From 422b94f107c9dcd6850816b8613804b2df1de77f Mon Sep 17 00:00:00 2001 From: freemine Date: Tue, 25 Apr 2023 07:14:07 +0800 Subject: [PATCH 001/695] fix unnecessary mkdir failure --- source/os/src/osDir.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/source/os/src/osDir.c b/source/os/src/osDir.c index 3d63da7ba33a..2268e88f1827 100644 --- a/source/os/src/osDir.c +++ b/source/os/src/osDir.c @@ -206,7 +206,15 @@ int32_t taosMulModeMkDir(const char *dirname, int mode) { #endif if (taosDirExist(temp)) { - return chmod(temp, mode); + int r = chmod(temp, mode); + if (r == 0) return 0; + { + struct stat statbuf = {0}; + int rr = stat(temp, &statbuf); + if (rr) return rr; + if ((statbuf.st_mode & mode) == mode) return 0; + } + return r; } if (strncmp(temp, TD_DIRSEP, 1) == 0) { From 1a8c8052067256041aafc8fd17fc2b24e9678d1e Mon Sep 17 00:00:00 2001 From: "chao.feng" Date: Fri, 9 Jun 2023 16:54:45 +0800 Subject: [PATCH 002/695] add test case user_privilege_show.py to the case file --- tests/parallel_test/cases.task | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index ddf5e7fce93f..67c5033ae964 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -562,6 +562,7 @@ ,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/user_control.py ,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/user_manage.py ,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/user_privilege.py +,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/user_privilege_show.py ,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/fsync.py ,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/multilevel.py ,,n,system-test,python3 ./test.py -f 0-others/compatibility.py From 1224134ae3bf419f633eeb7d3af64a29c4c523bd Mon Sep 17 00:00:00 2001 From: ljw0903 <42686420+ljw0903@users.noreply.github.com> Date: Wed, 14 Jun 2023 18:49:54 +0800 Subject: [PATCH 003/695] Update 05-insert.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修改错别字 --- docs/zh/12-taos-sql/05-insert.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/zh/12-taos-sql/05-insert.md b/docs/zh/12-taos-sql/05-insert.md index b72754b15437..d8c3e5f720d6 100644 --- a/docs/zh/12-taos-sql/05-insert.md +++ b/docs/zh/12-taos-sql/05-insert.md @@ -34,7 +34,7 @@ INSERT INTO tb_name [(field1_name, ...)] subquery 1. USING 子句是自动建表语法。如果用户在写数据时并不确定某个表是否存在,此时可以在写入数据时使用自动建表语法来创建不存在的表,若该表已存在则不会建立新表。自动建表时,要求必须以超级表为模板,并写明数据表的 TAGS 取值。可以只是指定部分 TAGS 列的取值,未被指定的 TAGS 列将置为 NULL。 -2. 可以指定要插入值的列,对于为指定的列数据库将自动填充为 NULL。 +2. 可以指定要插入值的列,对于未指定的列数据库将自动填充为 NULL。 3. VALUES 语法表示了要插入的一行或多行数据。 From c1b77953c5549f7e585a484b119be36e052a8edb Mon Sep 17 00:00:00 2001 From: EdgeGo <80612608+edgego@users.noreply.github.com> Date: Thu, 19 Oct 2023 08:46:32 +0800 Subject: [PATCH 004/695] Update libuv_CMakeLists.txt.in compiling error from alpine, need upgrade from 1.44.2 to 1.46.0 --- cmake/libuv_CMakeLists.txt.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/libuv_CMakeLists.txt.in b/cmake/libuv_CMakeLists.txt.in index 9c48ddefef16..3e259024b2c2 100644 --- a/cmake/libuv_CMakeLists.txt.in +++ b/cmake/libuv_CMakeLists.txt.in @@ -2,7 +2,7 @@ # libuv ExternalProject_Add(libuv GIT_REPOSITORY https://github.com/libuv/libuv.git - GIT_TAG v1.44.2 + GIT_TAG v1.46.0 SOURCE_DIR "${TD_CONTRIB_DIR}/libuv" BINARY_DIR "${TD_CONTRIB_DIR}/libuv" CONFIGURE_COMMAND "" From e55961068fc9bd0dd2fa5f8b1a59282ec8112783 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Fri, 27 Oct 2023 14:16:36 +0200 Subject: [PATCH 005/695] CMake: support build without COS --- source/dnode/vnode/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/dnode/vnode/CMakeLists.txt b/source/dnode/vnode/CMakeLists.txt index 84d54f3350c7..4eef8b9d1bba 100644 --- a/source/dnode/vnode/CMakeLists.txt +++ b/source/dnode/vnode/CMakeLists.txt @@ -163,6 +163,7 @@ target_link_libraries( if(${TD_LINUX}) set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") +if(${BUILD_WITH_COS}) find_library(APR_LIBRARY apr-1 PATHS /usr/local/apr/lib/) find_library(APR_UTIL_LIBRARY aprutil-1 PATHS /usr/local/apr/lib/) find_library(MINIXML_LIBRARY mxml) @@ -194,7 +195,6 @@ target_include_directories( PUBLIC "$ENV{HOME}/.cos-local.1/include" ) -if(${BUILD_WITH_COS}) add_definitions(-DUSE_COS) endif(${BUILD_WITH_COS}) From aaf3de42ef2aee3d646035d96405227e170f2bfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A4=E8=83=86=E6=9E=AA=E6=89=8B?= <37200724+alona789@users.noreply.github.com> Date: Tue, 5 Dec 2023 09:22:49 +0800 Subject: [PATCH 006/695] Update 02-docker.md --- docs/zh/10-deployment/02-docker.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/zh/10-deployment/02-docker.md b/docs/zh/10-deployment/02-docker.md index 3dbfabca7df7..83e624224d51 100644 --- a/docs/zh/10-deployment/02-docker.md +++ b/docs/zh/10-deployment/02-docker.md @@ -457,7 +457,7 @@ services: ## 使用 docker swarm 部署 -如果要想将基于容器的 TDengine 集群部署在多台主机上,可以使用 docker swarm。首先要在这些主机上建立 docke swarm 集群,请参考 docker 官方文档。 +如果要想将基于容器的 TDengine 集群部署在多台主机上,可以使用 docker swarm。首先要在这些主机上建立 docker swarm 集群,请参考 docker 官方文档。 docker-compose 文件可以参考上节。下面是使用 docker swarm 启动 TDengine 的命令: From 195ace04b81df05723717292c3c943a00a138c33 Mon Sep 17 00:00:00 2001 From: Jacob Su Date: Fri, 19 Apr 2024 10:28:37 +0800 Subject: [PATCH 007/695] fix compile errors on macOS 14.4 m2 chip. --- contrib/CMakeLists.txt | 2 ++ include/os/osString.h | 7 ++++++- source/client/CMakeLists.txt | 12 +++++------- source/dnode/mgmt/mgmt_snode/CMakeLists.txt | 5 ++++- source/dnode/mgmt/mgmt_vnode/CMakeLists.txt | 5 ++++- source/dnode/vnode/CMakeLists.txt | 3 +++ source/libs/executor/CMakeLists.txt | 2 ++ source/libs/function/CMakeLists.txt | 3 +++ source/libs/monitorfw/CMakeLists.txt | 2 +- source/libs/sync/CMakeLists.txt | 1 + source/os/src/osString.c | 4 ---- tools/shell/src/shellEngine.c | 2 +- 12 files changed, 32 insertions(+), 16 deletions(-) diff --git a/contrib/CMakeLists.txt b/contrib/CMakeLists.txt index ccd60df19a41..4cdafe539f7b 100644 --- a/contrib/CMakeLists.txt +++ b/contrib/CMakeLists.txt @@ -251,11 +251,13 @@ target_include_directories( # zlib set(CMAKE_PROJECT_INCLUDE_BEFORE "${TD_SUPPORT_DIR}/EnableCMP0048.txt.in") add_subdirectory(zlib EXCLUDE_FROM_ALL) +target_compile_options(zlibstatic PRIVATE -Wno-error=deprecated-non-prototype) target_include_directories( zlibstatic PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/zlib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/zlib ) +target_compile_options(zlib PRIVATE -Wno-error=deprecated-non-prototype) target_include_directories( zlib PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/zlib diff --git a/include/os/osString.h b/include/os/osString.h index 1aca1192931a..fd8e34f5399d 100644 --- a/include/os/osString.h +++ b/include/os/osString.h @@ -22,7 +22,12 @@ extern "C" { typedef wchar_t TdWchar; typedef int32_t TdUcs4; -typedef void *iconv_t; +#ifndef DISALLOW_NCHAR_WITHOUT_ICONV +#include "iconv.h" +#else + typedef void *iconv_t; +#endif + typedef enum { M2C = 0, C2M } ConvType; // If the error is in a third-party library, place this header file under the third-party library header file. diff --git a/source/client/CMakeLists.txt b/source/client/CMakeLists.txt index a17c27c2974e..293251f35d2f 100644 --- a/source/client/CMakeLists.txt +++ b/source/client/CMakeLists.txt @@ -10,6 +10,8 @@ else() add_library(taos SHARED ${CLIENT_SRC}) endif() +target_compile_options(taos PRIVATE -Wno-error=deprecated-non-prototype) + INCLUDE_DIRECTORIES(jni) target_include_directories( @@ -23,13 +25,6 @@ target_link_libraries( PRIVATE os util common transport monitor nodes parser command planner catalog scheduler function qcom geometry ) -if(TD_DARWIN_ARM64) - target_link_libraries( - taos - PRIVATE "-arch x86_64" - ) -endif() - if(TD_WINDOWS) INCLUDE_DIRECTORIES(jni/windows) INCLUDE_DIRECTORIES(jni/windows/win32) @@ -53,6 +48,9 @@ set_target_properties( ) add_library(taos_static STATIC ${CLIENT_SRC}) + +target_compile_options(taos_static PRIVATE -Wno-error=deprecated-non-prototype) + target_include_directories( taos_static PUBLIC "${TD_SOURCE_DIR}/include/client" diff --git a/source/dnode/mgmt/mgmt_snode/CMakeLists.txt b/source/dnode/mgmt/mgmt_snode/CMakeLists.txt index 62dc41a0aec6..59ea95631a1e 100644 --- a/source/dnode/mgmt/mgmt_snode/CMakeLists.txt +++ b/source/dnode/mgmt/mgmt_snode/CMakeLists.txt @@ -1,9 +1,12 @@ aux_source_directory(src MGMT_SNODE) add_library(mgmt_snode STATIC ${MGMT_SNODE}) + +target_compile_options(mgmt_snode PRIVATE -Wno-error=deprecated-non-prototype) + target_include_directories( mgmt_snode PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc" ) target_link_libraries( mgmt_snode node_util -) \ No newline at end of file +) diff --git a/source/dnode/mgmt/mgmt_vnode/CMakeLists.txt b/source/dnode/mgmt/mgmt_vnode/CMakeLists.txt index 15b822ad92e5..0cfd1da1e1e4 100644 --- a/source/dnode/mgmt/mgmt_vnode/CMakeLists.txt +++ b/source/dnode/mgmt/mgmt_vnode/CMakeLists.txt @@ -1,9 +1,12 @@ aux_source_directory(src MGMT_VNODE) add_library(mgmt_vnode STATIC ${MGMT_VNODE}) + +target_compile_options(mgmt_vnode PRIVATE -Wno-error=deprecated-non-prototype) + target_include_directories( mgmt_vnode PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc" ) target_link_libraries( mgmt_vnode node_util -) \ No newline at end of file +) diff --git a/source/dnode/vnode/CMakeLists.txt b/source/dnode/vnode/CMakeLists.txt index 43e680c3823a..886bbf4855f8 100644 --- a/source/dnode/vnode/CMakeLists.txt +++ b/source/dnode/vnode/CMakeLists.txt @@ -1,6 +1,9 @@ # vnode add_subdirectory(src/tqCommon) add_library(vnode STATIC "") + +target_compile_options(vnode PRIVATE -Wno-error=single-bit-bitfield-constant-conversion) + set( VNODE_SOURCE_FILES "src/vnd/vnodeOpen.c" diff --git a/source/libs/executor/CMakeLists.txt b/source/libs/executor/CMakeLists.txt index 838233346e8c..be94f3145fb0 100644 --- a/source/libs/executor/CMakeLists.txt +++ b/source/libs/executor/CMakeLists.txt @@ -2,6 +2,8 @@ aux_source_directory(src EXECUTOR_SRC) add_library(executor STATIC ${EXECUTOR_SRC}) +target_compile_options(executor PRIVATE -Wno-error=deprecated-non-prototype) + target_link_libraries(executor PRIVATE os util common function parser planner qcom scalar nodes index wal tdb geometry ) diff --git a/source/libs/function/CMakeLists.txt b/source/libs/function/CMakeLists.txt index 3a68648d4933..305fd29832cb 100644 --- a/source/libs/function/CMakeLists.txt +++ b/source/libs/function/CMakeLists.txt @@ -141,6 +141,9 @@ target_link_libraries( #SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/build/bin) add_executable(udfd src/udfd.c) + +target_compile_options(udfd PRIVATE -Wno-error=deprecated-non-prototype) + target_include_directories( udfd PUBLIC diff --git a/source/libs/monitorfw/CMakeLists.txt b/source/libs/monitorfw/CMakeLists.txt index 610cd639855f..cd00c2e2a10e 100644 --- a/source/libs/monitorfw/CMakeLists.txt +++ b/source/libs/monitorfw/CMakeLists.txt @@ -5,5 +5,5 @@ target_include_directories( PUBLIC "${TD_SOURCE_DIR}/include/libs/monitorfw" PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc" ) - +target_compile_options(monitorfw PRIVATE -Wno-error=deprecated-pragma) target_link_libraries(monitorfw os util common transport) diff --git a/source/libs/sync/CMakeLists.txt b/source/libs/sync/CMakeLists.txt index 6025070cb72a..d3344ea6fa2d 100644 --- a/source/libs/sync/CMakeLists.txt +++ b/source/libs/sync/CMakeLists.txt @@ -1,6 +1,7 @@ aux_source_directory(src SYNC_SRC) add_library(sync STATIC ${SYNC_SRC}) +target_compile_options(sync PRIVATE -Wno-error=deprecated-non-prototype) target_link_libraries( sync PUBLIC common diff --git a/source/os/src/osString.c b/source/os/src/osString.c index 768bbe5cd1b9..a4440ee5e893 100644 --- a/source/os/src/osString.c +++ b/source/os/src/osString.c @@ -17,10 +17,6 @@ #define _DEFAULT_SOURCE #include "os.h" -#ifndef DISALLOW_NCHAR_WITHOUT_ICONV -#include "iconv.h" -#endif - extern int wcwidth(wchar_t c); extern int wcswidth(const wchar_t *s, size_t n); diff --git a/tools/shell/src/shellEngine.c b/tools/shell/src/shellEngine.c index 57ed67530383..1d1050c1ec0f 100644 --- a/tools/shell/src/shellEngine.c +++ b/tools/shell/src/shellEngine.c @@ -56,7 +56,7 @@ static void shellWriteHistory(); static void shellPrintError(TAOS_RES *tres, int64_t st); static bool shellIsCommentLine(char *line); static void shellSourceFile(const char *file); -static bool shellGetGrantInfo(); +static bool shellGetGrantInfo(char* buf); static void shellCleanup(void *arg); static void *shellCancelHandler(void *arg); From 739acf425a3e380ef9e1229d63763d7d62b1d85a Mon Sep 17 00:00:00 2001 From: laiyongtao Date: Thu, 25 Apr 2024 20:58:50 +0800 Subject: [PATCH 008/695] set parent environ to udfd --- source/libs/function/src/tudf.c | 42 +++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/source/libs/function/src/tudf.c b/source/libs/function/src/tudf.c index 7e344866a51e..7c0e66d072d8 100644 --- a/source/libs/function/src/tudf.c +++ b/source/libs/function/src/tudf.c @@ -49,6 +49,8 @@ SUdfdData udfdGlobal = {0}; int32_t udfStartUdfd(int32_t startDnodeId); int32_t udfStopUdfd(); +extern char **environ; + static int32_t udfSpawnUdfd(SUdfdData *pData); void udfUdfdExit(uv_process_t *process, int64_t exitStatus, int termSignal); static int32_t udfSpawnUdfd(SUdfdData *pData); @@ -147,7 +149,33 @@ static int32_t udfSpawnUdfd(SUdfdData *pData) { snprintf(ldLibPathEnvItem, 1024 + 32, "%s=%s", "LD_LIBRARY_PATH", udfdPathLdLib); char *envUdfd[] = {dnodeIdEnvItem, thrdPoolSizeEnvItem, ldLibPathEnvItem, NULL}; - options.env = envUdfd; + char **envUdfdWithPEnv = NULL; + if (environ != NULL) { + int numEnviron = 0; + while (environ[numEnviron] != NULL) { + numEnviron++; + } + int lenEnvUdfd = ARRAY_SIZE(envUdfd); + + envUdfdWithPEnv = (char**) taosMemoryMalloc((numEnviron + lenEnvUdfd) * sizeof(char*)); + + int i; + for (i = 0; i < numEnviron; i++) { + envUdfdWithPEnv[i] = (char*) taosMemoryMalloc(strlen(environ[i]) + 1); + strcpy(envUdfdWithPEnv[i], environ[i]); + } + for (i = 0; i < lenEnvUdfd; i++) { + if (envUdfd[i] != NULL) { + envUdfdWithPEnv[numEnviron + i] = (char*) taosMemoryMalloc(strlen(envUdfd[i]) + 1); + strcpy(envUdfdWithPEnv[numEnviron + i], envUdfd[i]); + } + } + envUdfdWithPEnv[numEnviron + lenEnvUdfd - 1] = NULL; + + options.env = envUdfdWithPEnv; + } else { + options.env = envUdfd; + } int err = uv_spawn(&pData->loop, &pData->process, &options); pData->process.data = (void *)pData; @@ -176,6 +204,16 @@ static int32_t udfSpawnUdfd(SUdfdData *pData) { } else { fnInfo("udfd is initialized"); } + + if (envUdfdWithPEnv != NULL) { + int i = 0; + while (envUdfdWithPEnv[i] != NULL) { + taosMemoryFree(envUdfdWithPEnv[i]); + i++; + } + taosMemoryFree(envUdfdWithPEnv); + } + return err; } @@ -1941,7 +1979,7 @@ int32_t doCallUdfScalarFunc(UdfcFuncHandle handle, SScalarParam *input, int32_t convertDataBlockToScalarParm(&resultBlock, output); taosArrayDestroy(resultBlock.pDataBlock); } - + blockDataFreeRes(&inputBlock); return err; } From e86444100c1e0be71d9a62094e4b9a6e22f800c0 Mon Sep 17 00:00:00 2001 From: yinheli Date: Mon, 13 May 2024 17:37:08 +0800 Subject: [PATCH 009/695] chore(typo): fix typo --- source/dnode/mnode/impl/inc/mndDef.h | 2 +- source/dnode/mnode/impl/src/mndDnode.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/dnode/mnode/impl/inc/mndDef.h b/source/dnode/mnode/impl/inc/mndDef.h index 68c55e235f84..5953d39c4f75 100644 --- a/source/dnode/mnode/impl/inc/mndDef.h +++ b/source/dnode/mnode/impl/inc/mndDef.h @@ -70,7 +70,7 @@ typedef enum { MND_OPER_WRITE_DB, MND_OPER_READ_DB, MND_OPER_READ_OR_WRITE_DB, - MND_OPER_SHOW_VARIBALES, + MND_OPER_SHOW_VARIABLES, MND_OPER_SUBSCRIBE, MND_OPER_CREATE_TOPIC, MND_OPER_DROP_TOPIC, diff --git a/source/dnode/mnode/impl/src/mndDnode.c b/source/dnode/mnode/impl/src/mndDnode.c index 57ddbb9beb1c..b14062d613f7 100644 --- a/source/dnode/mnode/impl/src/mndDnode.c +++ b/source/dnode/mnode/impl/src/mndDnode.c @@ -1095,7 +1095,7 @@ static int32_t mndProcessShowVariablesReq(SRpcMsg *pReq) { SShowVariablesRsp rsp = {0}; int32_t code = -1; - if (mndCheckOperPrivilege(pReq->info.node, pReq->info.conn.user, MND_OPER_SHOW_VARIBALES) != 0) { + if (mndCheckOperPrivilege(pReq->info.node, pReq->info.conn.user, MND_OPER_SHOW_VARIABLES) != 0) { goto _OVER; } From 1c9011e82085437b490ce3dd0b879c1150583dd5 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Fri, 12 Jul 2024 11:03:45 +0800 Subject: [PATCH 010/695] stream time slice --- include/common/tmsg.h | 1 + include/libs/executor/storageapi.h | 7 +- include/libs/nodes/plannodes.h | 48 +- include/libs/stream/streamState.h | 2 + include/libs/stream/tstreamFileState.h | 17 +- source/dnode/snode/src/snodeInitApi.c | 2 + source/dnode/vnode/src/vnd/vnodeInitApi.c | 2 + source/libs/executor/inc/executorInt.h | 34 + source/libs/executor/inc/operator.h | 2 + source/libs/executor/inc/streamexecutorInt.h | 32 + source/libs/executor/src/executil.c | 2 + source/libs/executor/src/operator.c | 2 + source/libs/executor/src/scanoperator.c | 11 + .../executor/src/streamcountwindowoperator.c | 2 +- .../executor/src/streameventwindowoperator.c | 2 +- source/libs/executor/src/streamfilloperator.c | 52 +- .../executor/src/streamtimesliceoperator.c | 778 ++++++++++++++++++ .../executor/src/streamtimewindowoperator.c | 34 +- source/libs/executor/src/timesliceoperator.c | 8 +- source/libs/function/src/builtins.c | 2 +- source/libs/nodes/src/nodesCloneFuncs.c | 2 +- source/libs/nodes/src/nodesCodeFuncs.c | 15 +- source/libs/nodes/src/nodesMsgFuncs.c | 6 +- source/libs/nodes/src/nodesUtilFuncs.c | 5 +- source/libs/parser/src/parTranslater.c | 11 +- source/libs/planner/src/planLogicCreater.c | 13 + source/libs/planner/src/planPhysiCreater.c | 11 +- source/libs/planner/src/planValidator.c | 1 + source/libs/stream/inc/streamBackendRocksdb.h | 3 +- source/libs/stream/src/streamBackendRocksdb.c | 17 +- source/libs/stream/src/streamSessionState.c | 8 +- source/libs/stream/src/streamSliceState.c | 164 ++++ source/libs/stream/src/streamState.c | 11 + source/libs/stream/src/tstreamFileState.c | 84 +- 34 files changed, 1286 insertions(+), 105 deletions(-) create mode 100644 source/libs/executor/src/streamtimesliceoperator.c create mode 100644 source/libs/stream/src/streamSliceState.c diff --git a/include/common/tmsg.h b/include/common/tmsg.h index a83aa4da4489..4715290f728d 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -458,6 +458,7 @@ typedef enum ENodeType { QUERY_NODE_PHYSICAL_PLAN_MERGE_COUNT, QUERY_NODE_PHYSICAL_PLAN_STREAM_COUNT, QUERY_NODE_PHYSICAL_PLAN_STREAM_MID_INTERVAL, + QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERP_FUNC, } ENodeType; typedef struct { diff --git a/include/libs/executor/storageapi.h b/include/libs/executor/storageapi.h index 45f9f73fb18d..89bc208905a1 100644 --- a/include/libs/executor/storageapi.h +++ b/include/libs/executor/storageapi.h @@ -39,8 +39,9 @@ extern "C" { #define META_READER_LOCK 0x0 #define META_READER_NOLOCK 0x1 -#define STREAM_STATE_BUFF_HASH 1 -#define STREAM_STATE_BUFF_SORT 2 +#define STREAM_STATE_BUFF_HASH 1 +#define STREAM_STATE_BUFF_SORT 2 +#define STREAM_STATE_BUFF_HASH_SORT 3 typedef struct SMeta SMeta; typedef TSKEY (*GetTsFun)(void*); @@ -349,6 +350,8 @@ typedef struct SStateStore { int32_t (*streamStateFillPut)(SStreamState* pState, const SWinKey* key, const void* value, int32_t vLen); int32_t (*streamStateFillGet)(SStreamState* pState, const SWinKey* key, void** pVal, int32_t* pVLen); int32_t (*streamStateFillDel)(SStreamState* pState, const SWinKey* key); + int32_t (*streamStateFillGetNext)(SStreamState* pState, const SWinKey* pKey, SWinKey* pResKey, void** pVal, int32_t* pVLen); + int32_t (*streamStateFillGetPrev)(SStreamState* pState, const SWinKey* pKey, SWinKey* pResKey, void** pVal, int32_t* pVLen); int32_t (*streamStateCurNext)(SStreamState* pState, SStreamStateCur* pCur); int32_t (*streamStateCurPrev)(SStreamState* pState, SStreamStateCur* pCur); diff --git a/include/libs/nodes/plannodes.h b/include/libs/nodes/plannodes.h index a691433ee665..cc09ceb858a9 100644 --- a/include/libs/nodes/plannodes.h +++ b/include/libs/nodes/plannodes.h @@ -194,14 +194,25 @@ typedef struct SIndefRowsFuncLogicNode { bool isTimeLineFunc; } SIndefRowsFuncLogicNode; +typedef struct SStreamOption { + int8_t triggerType; + int64_t watermark; + int64_t deleteMark; + int8_t igExpired; + int8_t igCheckUpdate; + int8_t destHasPrimaryKey; +} SStreamOption; + typedef struct SInterpFuncLogicNode { - SLogicNode node; - SNodeList* pFuncs; - STimeWindow timeRange; - int64_t interval; - EFillMode fillMode; - SNode* pFillValues; // SNodeListNode - SNode* pTimeSeries; // SColumnNode + SLogicNode node; + SNodeList* pFuncs; + STimeWindow timeRange; + int64_t interval; + EFillMode fillMode; + SNode* pFillValues; // SNodeListNode + SNode* pTimeSeries; // SColumnNode + //todo(liuyao) 补充clone和json等 + SStreamOption streamOption; } SInterpFuncLogicNode; typedef struct SGroupCacheLogicNode { @@ -496,17 +507,20 @@ typedef struct SIndefRowsFuncPhysiNode { } SIndefRowsFuncPhysiNode; typedef struct SInterpFuncPhysiNode { - SPhysiNode node; - SNodeList* pExprs; - SNodeList* pFuncs; - STimeWindow timeRange; - int64_t interval; - int8_t intervalUnit; - EFillMode fillMode; - SNode* pFillValues; // SNodeListNode - SNode* pTimeSeries; // SColumnNode + SPhysiNode node; + SNodeList* pExprs; + SNodeList* pFuncs; + STimeWindow timeRange; + int64_t interval; + int8_t intervalUnit; + EFillMode fillMode; + SNode* pFillValues; // SNodeListNode + SNode* pTimeSeries; // SColumnNode + SStreamOption streamOption; //todo(liuyao) 补充clone和json等 } SInterpFuncPhysiNode; +typedef SInterpFuncPhysiNode SStreamInterpFuncPhysiNode; + typedef struct SSortMergeJoinPhysiNode { SPhysiNode node; EJoinType joinType; @@ -635,7 +649,7 @@ typedef struct SWindowPhysiNode { int64_t watermark; int64_t deleteMark; int8_t igExpired; - int8_t destHasPrimayKey; + int8_t destHasPrimaryKey; bool mergeDataBlock; } SWindowPhysiNode; diff --git a/include/libs/stream/streamState.h b/include/libs/stream/streamState.h index 5768160fdb43..7ece16e73dec 100644 --- a/include/libs/stream/streamState.h +++ b/include/libs/stream/streamState.h @@ -76,6 +76,8 @@ int32_t streamStateStateAddIfNotExist(SStreamState* pState, SSessionKey* key, ch int32_t streamStateFillPut(SStreamState* pState, const SWinKey* key, const void* value, int32_t vLen); int32_t streamStateFillGet(SStreamState* pState, const SWinKey* key, void** pVal, int32_t* pVLen); int32_t streamStateFillDel(SStreamState* pState, const SWinKey* key); +int32_t streamStateFillGetNext(SStreamState* pState, const SWinKey* pKey, SWinKey* pResKey, void** pVal, int32_t* pVLen); +int32_t streamStateFillGetPrev(SStreamState* pState, const SWinKey* pKey, SWinKey* pResKey, void** pVal, int32_t* pVLen); int32_t streamStateAddIfNotExist(SStreamState* pState, const SWinKey* key, void** pVal, int32_t* pVLen); int32_t streamStateReleaseBuf(SStreamState* pState, void* pVal, bool used); diff --git a/include/libs/stream/tstreamFileState.h b/include/libs/stream/tstreamFileState.h index 68b9c4baa291..8ab935a75d44 100644 --- a/include/libs/stream/tstreamFileState.h +++ b/include/libs/stream/tstreamFileState.h @@ -37,13 +37,15 @@ typedef void (*_state_buff_cleanup_fn)(void* pRowBuff); typedef void* (*_state_buff_create_statekey_fn)(SRowBuffPos* pPos, int64_t num); typedef int32_t (*_state_file_remove_fn)(SStreamFileState* pFileState, const void* pKey); -typedef int32_t (*_state_file_get_fn)(SStreamFileState* pFileState, void* pKey, void* data, int32_t* pDataLen); +typedef int32_t (*_state_file_get_fn)(SStreamFileState* pFileState, void* pKey, void** data, int32_t* pDataLen); typedef int32_t (*_state_file_clear_fn)(SStreamState* pState); typedef int32_t (*_state_fun_get_fn) (SStreamFileState* pFileState, void* pKey, int32_t keyLen, void** pVal, int32_t* pVLen); typedef int32_t (*range_cmpr_fn)(const SSessionKey* pWin1, const SSessionKey* pWin2); +typedef int (*__session_compare_fn_t)(const void* pWin, const void* pDatas, int pos); + SStreamFileState* streamFileStateInit(int64_t memSize, uint32_t keySize, uint32_t rowSize, uint32_t selectRowSize, GetTsFun fp, void* pFile, TSKEY delMark, const char* taskId, int64_t checkpointId, int8_t type); @@ -69,9 +71,11 @@ int32_t streamFileStateGetSelectRowSize(SStreamFileState* pFileState); void streamFileStateReloadInfo(SStreamFileState* pFileState, TSKEY ts); void* getRowStateBuff(SStreamFileState* pFileState); +void* getSearchBuff(SStreamFileState* pFileState); void* getStateFileStore(SStreamFileState* pFileState); bool isDeteled(SStreamFileState* pFileState, TSKEY ts); bool isFlushedState(SStreamFileState* pFileState, TSKEY ts, TSKEY gap); +TSKEY getFlushMark(SStreamFileState* pFileState); SRowBuffPos* getNewRowPosForWrite(SStreamFileState* pFileState); int32_t getRowStateRowSize(SStreamFileState* pFileState); @@ -98,6 +102,8 @@ int32_t sessionWinStateGetKVByCur(SStreamStateCur* pCur, SSessionKey* pKey, void int32_t sessionWinStateMoveToNext(SStreamStateCur* pCur); int32_t sessionWinStateGetKeyByRange(SStreamFileState* pFileState, const SSessionKey* key, SSessionKey* curKey, range_cmpr_fn cmpFn); +int32_t binarySearch(void* keyList, int num, const void* key, __session_compare_fn_t cmpFn); + // state window int32_t getStateWinResultBuff(SStreamFileState* pFileState, SSessionKey* key, char* pKeyData, int32_t keyDataLen, state_key_cmpr_fn fn, void** pVal, int32_t* pVLen); @@ -110,6 +116,15 @@ int32_t createCountWinResultBuff(SStreamFileState* pFileState, SSessionKey* pKey int32_t getSessionRowBuff(SStreamFileState* pFileState, void* pKey, int32_t keyLen, void** pVal, int32_t* pVLen); int32_t getFunctionRowBuff(SStreamFileState* pFileState, void* pKey, int32_t keyLen, void** pVal, int32_t* pVLen); +//fill +int32_t getHashSortRowBuff(SStreamFileState* pFileState, const SWinKey* pKey, void** pVal, int32_t* pVLen); +int32_t hashSortFileGetFn(SStreamFileState* pFileState, void* pKey, void** data, int32_t* pDataLen); +int32_t hashSortFileRemoveFn(SStreamFileState* pFileState, const void* pKey); +void clearSearchBuff(SStreamFileState* pFileState); +int32_t getHashSortNextRow(SStreamFileState* pFileState, const SWinKey* pKey, SWinKey* pResKey, void** pVal, int32_t* pVLen); +int32_t getHashSortPrevRow(SStreamFileState* pFileState, const SWinKey* pKey, SWinKey* pResKey, void** pVal, int32_t* pVLen); +int32_t recoverFillSnapshot(SStreamFileState* pFileState, int64_t ckId); + #ifdef __cplusplus } #endif diff --git a/source/dnode/snode/src/snodeInitApi.c b/source/dnode/snode/src/snodeInitApi.c index 196fa56c99a1..9a353a0b7c7a 100644 --- a/source/dnode/snode/src/snodeInitApi.c +++ b/source/dnode/snode/src/snodeInitApi.c @@ -50,6 +50,8 @@ void initStateStoreAPI(SStateStore* pStore) { pStore->streamStateFillPut = streamStateFillPut; pStore->streamStateFillGet = streamStateFillGet; pStore->streamStateFillDel = streamStateFillDel; + pStore->streamStateFillGetNext = streamStateFillGetNext; + pStore->streamStateFillGetPrev = streamStateFillGetPrev; pStore->streamStateCurNext = streamStateCurNext; pStore->streamStateCurPrev = streamStateCurPrev; diff --git a/source/dnode/vnode/src/vnd/vnodeInitApi.c b/source/dnode/vnode/src/vnd/vnodeInitApi.c index 48852dd15991..d03b04d57363 100644 --- a/source/dnode/vnode/src/vnd/vnodeInitApi.c +++ b/source/dnode/vnode/src/vnd/vnodeInitApi.c @@ -166,6 +166,8 @@ void initStateStoreAPI(SStateStore* pStore) { pStore->streamStateFillPut = streamStateFillPut; pStore->streamStateFillGet = streamStateFillGet; pStore->streamStateFillDel = streamStateFillDel; + pStore->streamStateFillGetNext = streamStateFillGetNext; + pStore->streamStateFillGetPrev = streamStateFillGetPrev; pStore->streamStateCurNext = streamStateCurNext; pStore->streamStateCurPrev = streamStateCurPrev; diff --git a/source/libs/executor/inc/executorInt.h b/source/libs/executor/inc/executorInt.h index 95414ff70e85..4b3875cc2358 100644 --- a/source/libs/executor/inc/executorInt.h +++ b/source/libs/executor/inc/executorInt.h @@ -806,6 +806,36 @@ typedef struct SStreamFillOperatorInfo { SStreamFillInfo* pFillInfo; } SStreamFillOperatorInfo; +typedef struct SStreamTimeSliceOperatorInfo { + SSteamOpBasicInfo basic; + STimeWindowAggSupp twAggSup; + SStreamAggSupporter streamAggSup; + SStreamFillSupporter* pFillSup; + SStreamFillInfo* pFillInfo; + SSDataBlock* pRes; + SSDataBlock* pDelRes; + bool recvCkBlock; + SSDataBlock* pCheckpointRes; + int32_t fillType; + SResultRowData leftRow; + SResultRowData valueRow; + SResultRowData rightRow; + int32_t primaryTsIndex; + SExprSupp scalarSup; // scalar calculation + bool ignoreExpiredData; + bool ignoreExpiredDataSaved; + bool destHasPrimaryKey; + SArray* historyPoints; + SArray* pUpdated; // SWinKey + SSHashObj* pUpdatedMap; + int32_t delIndex; + SArray* pDelWins; // SWinKey + SSHashObj* pDeletedMap; + uint64_t numOfDatapack; + SGroupResInfo groupResInfo; + bool ignoreNull; +} SStreamTimeSliceOperatorInfo; + #define OPTR_IS_OPENED(_optr) (((_optr)->status & OP_OPENED) == OP_OPENED) #define OPTR_SET_OPENED(_optr) ((_optr)->status |= OP_OPENED) @@ -963,6 +993,8 @@ void resetUnCloseSessionWinInfo(SSHashObj* winMap); void setStreamOperatorCompleted(struct SOperatorInfo* pOperator); void reloadAggSupFromDownStream(struct SOperatorInfo* downstream, SStreamAggSupporter* pAggSup); void destroyFlusedPos(void* pRes); +bool isIrowtsPseudoColumn(SExprInfo* pExprInfo); +bool isIsfilledPseudoColumn(SExprInfo* pExprInfo); int32_t encodeSSessionKey(void** buf, SSessionKey* key); void* decodeSSessionKey(void* buf, SSessionKey* key); @@ -995,6 +1027,8 @@ void doDeleteTimeWindows(SStreamAggSupporter* pAggSup, SSDataBlock* pBlock, SArr int32_t getNextQualifiedWindow(SInterval* pInterval, STimeWindow* pNext, SDataBlockInfo* pDataBlockInfo, TSKEY* primaryKeys, int32_t prevPosition, int32_t order); void extractQualifiedTupleByFilterResult(SSDataBlock* pBlock, const SColumnInfoData* p, int32_t status); +bool getIgoreNullRes(SExprSupp* pExprSup); +bool checkNullRow(SExprSupp* pExprSup, SSDataBlock* pSrcBlock, int32_t index, bool ignoreNull); diff --git a/source/libs/executor/inc/operator.h b/source/libs/executor/inc/operator.h index 95208545bdf3..dfd986271c3e 100644 --- a/source/libs/executor/inc/operator.h +++ b/source/libs/executor/inc/operator.h @@ -166,6 +166,8 @@ SOperatorInfo* createGroupCacheOperatorInfo(SOperatorInfo** pDownstream, int32_t SOperatorInfo* createDynQueryCtrlOperatorInfo(SOperatorInfo** pDownstream, int32_t numOfDownstream, SDynQueryCtrlPhysiNode* pPhyciNode, SExecTaskInfo* pTaskInfo); +SOperatorInfo* createStreamTimeSliceOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo, SReadHandle* pHandle); + // clang-format on SOperatorFpSet createOperatorFpSet(__optr_open_fn_t openFn, __optr_fn_t nextFn, __optr_fn_t cleanup, diff --git a/source/libs/executor/inc/streamexecutorInt.h b/source/libs/executor/inc/streamexecutorInt.h index 8b61b936015e..e16d14700a69 100644 --- a/source/libs/executor/inc/streamexecutorInt.h +++ b/source/libs/executor/inc/streamexecutorInt.h @@ -21,10 +21,42 @@ extern "C" { #include "executorInt.h" +#define FILL_POS_INVALID 0 +#define FILL_POS_START 1 +#define FILL_POS_MID 2 +#define FILL_POS_END 3 + void setStreamOperatorState(SSteamOpBasicInfo* pBasicInfo, EStreamType type); bool needSaveStreamOperatorInfo(SSteamOpBasicInfo* pBasicInfo); void saveStreamOperatorStateComplete(SSteamOpBasicInfo* pBasicInfo); +int64_t getDeleteMarkFromOption(SStreamOption* pOption); +void removeDeleteResults(SSHashObj* pUpdatedMap, SArray* pDelWins); +void copyIntervalDeleteKey(SSHashObj* pMap, SArray* pWins); +bool hasSrcPrimaryKeyCol(SSteamOpBasicInfo* pInfo); +void transBlockToResultRow(const SSDataBlock* pBlock, int32_t rowId, TSKEY ts, SResultRowData* pRowVal); +int32_t getNexWindowPos(SInterval* pInterval, SDataBlockInfo* pBlockInfo, TSKEY* tsCols, int32_t startPos, TSKEY eKey, + STimeWindow* pNextWin); +int32_t saveWinResult(SWinKey* pKey, SRowBuffPos* pPos, SSHashObj* pUpdatedMap); +void resetPrevAndNextWindow(SStreamFillSupporter* pFillSup); +void doBuildDeleteResultImpl(SStateStore* pAPI, SStreamState* pState, SArray* pWins, int32_t* index, + SSDataBlock* pBlock); + +SResultCellData* getResultCell(SResultRowData* pRaw, int32_t index); +int32_t initResultBuf(SStreamFillSupporter* pFillSup); +void* destroyStreamFillSupporter(SStreamFillSupporter* pFillSup); +void calcRowDeltaData(SResultRowData* pEndRow, SArray* pEndPoins, SFillColInfo* pFillCol, int32_t numOfCol); +void resetFillWindow(SResultRowData* pRowData); +bool hasPrevWindow(SStreamFillSupporter* pFillSup); +bool hasNextWindow(SStreamFillSupporter* pFillSup); +void copyNotFillExpData(SStreamFillSupporter* pFillSup, SStreamFillInfo* pFillInfo); +void setFillKeyInfo(TSKEY start, TSKEY end, SInterval* pInterval, SStreamFillInfo* pFillInfo); +void setRowCell(SColumnInfoData* pCol, int32_t rowId, const SResultCellData* pCell); +bool hasRemainCalc(SStreamFillInfo* pFillInfo); +void destroySPoint(void* ptr); + +int winPosCmprImpl(const void* pKey1, const void* pKey2); + #ifdef __cplusplus } #endif diff --git a/source/libs/executor/src/executil.c b/source/libs/executor/src/executil.c index cb2a75407a74..142fa6d86162 100644 --- a/source/libs/executor/src/executil.c +++ b/source/libs/executor/src/executil.c @@ -2317,6 +2317,8 @@ char* getStreamOpName(uint16_t opType) { return "stream event"; case QUERY_NODE_PHYSICAL_PLAN_STREAM_COUNT: return "stream count"; + case QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERP_FUNC: + return "stream interp"; } return ""; } diff --git a/source/libs/executor/src/operator.c b/source/libs/executor/src/operator.c index 494794f8c214..f68a14bc2dc5 100644 --- a/source/libs/executor/src/operator.c +++ b/source/libs/executor/src/operator.c @@ -546,6 +546,8 @@ SOperatorInfo* createOperator(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo, SR pOptr = createStreamCountAggOperatorInfo(ops[0], pPhyNode, pTaskInfo, pHandle); } else if (QUERY_NODE_PHYSICAL_PLAN_MERGE_COUNT == type) { pOptr = createCountwindowOperatorInfo(ops[0], pPhyNode, pTaskInfo); + } else if (QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERP_FUNC == type) { + pOptr = createStreamTimeSliceOperatorInfo(ops[0], pPhyNode, pTaskInfo, pHandle); } else { terrno = TSDB_CODE_INVALID_PARA; pTaskInfo->code = terrno; diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 490f6b86fa86..ed70b3184563 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -1299,6 +1299,10 @@ static bool isCountWindow(SStreamScanInfo* pInfo) { return pInfo->windowSup.parentType == QUERY_NODE_PHYSICAL_PLAN_STREAM_COUNT; } +static bool isTimeSlice(SStreamScanInfo* pInfo) { + return pInfo->windowSup.parentType == QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERP_FUNC; +} + static void setGroupId(SStreamScanInfo* pInfo, SSDataBlock* pBlock, int32_t groupColIndex, int32_t rowIndex) { SColumnInfoData* pColInfo = taosArrayGet(pBlock->pDataBlock, groupColIndex); uint64_t* groupCol = (uint64_t*)pColInfo->pData; @@ -1795,6 +1799,11 @@ static int32_t generateCountScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSrcB return TSDB_CODE_SUCCESS; } +static int32_t generateTimeSliceScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSrcBlock, SSDataBlock* pDestBlock, EStreamType mode) { + // todo(liuyao) add code 获取delete range的左邻居和右邻居,作为range + return TSDB_CODE_SUCCESS; +} + static int32_t generateIntervalScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSrcBlock, SSDataBlock* pDestBlock, EStreamType mode) { blockDataCleanup(pDestBlock); if (pSrcBlock->info.rows == 0) { @@ -1980,6 +1989,8 @@ static int32_t generateScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSrcBlock, code = generateSessionScanRange(pInfo, pSrcBlock, pDestBlock, type); } else if (isCountWindow(pInfo)) { code = generateCountScanRange(pInfo, pSrcBlock, pDestBlock, type); + } else if (isTimeSlice(pInfo)) { + code = generateTimeSliceScanRange(pInfo, pSrcBlock, pDestBlock, type); } else { code = generateDeleteResultBlock(pInfo, pSrcBlock, pDestBlock); } diff --git a/source/libs/executor/src/streamcountwindowoperator.c b/source/libs/executor/src/streamcountwindowoperator.c index 857d04845755..869af23acdd0 100644 --- a/source/libs/executor/src/streamcountwindowoperator.c +++ b/source/libs/executor/src/streamcountwindowoperator.c @@ -715,7 +715,7 @@ SOperatorInfo* createStreamCountAggOperatorInfo(SOperatorInfo* downstream, SPhys pInfo->pCheckpointRes = createSpecialDataBlock(STREAM_CHECKPOINT); pInfo->recvGetAll = false; pInfo->pPkDeleted = tSimpleHashInit(64, hashFn); - pInfo->destHasPrimaryKey = pCountNode->window.destHasPrimayKey; + pInfo->destHasPrimaryKey = pCountNode->window.destHasPrimaryKey; pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_STREAM_COUNT; setOperatorInfo(pOperator, getStreamOpName(pOperator->operatorType), QUERY_NODE_PHYSICAL_PLAN_STREAM_COUNT, true, diff --git a/source/libs/executor/src/streameventwindowoperator.c b/source/libs/executor/src/streameventwindowoperator.c index 1809d0cc6706..64f7f936d3a7 100644 --- a/source/libs/executor/src/streameventwindowoperator.c +++ b/source/libs/executor/src/streameventwindowoperator.c @@ -765,7 +765,7 @@ SOperatorInfo* createStreamEventAggOperatorInfo(SOperatorInfo* downstream, SPhys pInfo->reCkBlock = false; pInfo->recvGetAll = false; pInfo->pPkDeleted = tSimpleHashInit(64, hashFn); - pInfo->destHasPrimaryKey = pEventNode->window.destHasPrimayKey; + pInfo->destHasPrimaryKey = pEventNode->window.destHasPrimaryKey; setOperatorInfo(pOperator, "StreamEventAggOperator", QUERY_NODE_PHYSICAL_PLAN_STREAM_EVENT, true, OP_NOT_OPENED, pInfo, pTaskInfo); diff --git a/source/libs/executor/src/streamfilloperator.c b/source/libs/executor/src/streamfilloperator.c index c1a38b66ba0c..ab4d03c1cd7b 100644 --- a/source/libs/executor/src/streamfilloperator.c +++ b/source/libs/executor/src/streamfilloperator.c @@ -21,6 +21,7 @@ #include "ttypes.h" #include "executorInt.h" +#include "streamexecutorInt.h" #include "tcommon.h" #include "thash.h" #include "ttime.h" @@ -32,12 +33,6 @@ #include "operator.h" #include "querytask.h" - -#define FILL_POS_INVALID 0 -#define FILL_POS_START 1 -#define FILL_POS_MID 2 -#define FILL_POS_END 3 - typedef struct STimeRange { TSKEY skey; TSKEY ekey; @@ -133,12 +128,12 @@ static void destroyStreamFillOperatorInfo(void* param) { taosMemoryFree(pInfo); } -static void resetFillWindow(SResultRowData* pRowData) { +void resetFillWindow(SResultRowData* pRowData) { pRowData->key = INT64_MIN; taosMemoryFreeClear(pRowData->pRowVal); } -void resetPrevAndNextWindow(SStreamFillSupporter* pFillSup, void* pState, SStorageAPI* pAPI) { +void resetPrevAndNextWindow(SStreamFillSupporter* pFillSup) { if (pFillSup->cur.pRowVal != pFillSup->prev.pRowVal && pFillSup->cur.pRowVal != pFillSup->next.pRowVal) { resetFillWindow(&pFillSup->cur); } else { @@ -154,7 +149,7 @@ void getCurWindowFromDiscBuf(SOperatorInfo* pOperator, TSKEY ts, uint64_t groupI SStorageAPI* pAPI = &pOperator->pTaskInfo->storageAPI; void* pState = pOperator->pTaskInfo->streamInfo.pState; - resetPrevAndNextWindow(pFillSup, pState, pAPI); + resetPrevAndNextWindow(pFillSup); SWinKey key = {.ts = ts, .groupId = groupId}; int32_t curVLen = 0; @@ -167,7 +162,7 @@ void getCurWindowFromDiscBuf(SOperatorInfo* pOperator, TSKEY ts, uint64_t groupI void getWindowFromDiscBuf(SOperatorInfo* pOperator, TSKEY ts, uint64_t groupId, SStreamFillSupporter* pFillSup) { SStorageAPI* pAPI = &pOperator->pTaskInfo->storageAPI; void* pState = pOperator->pTaskInfo->streamInfo.pState; - resetPrevAndNextWindow(pFillSup, pState, pAPI); + resetPrevAndNextWindow(pFillSup); SWinKey key = {.ts = ts, .groupId = groupId}; void* curVal = NULL; @@ -233,14 +228,14 @@ void getWindowFromDiscBuf(SOperatorInfo* pOperator, TSKEY ts, uint64_t groupId, pAPI->stateStore.streamStateFreeCur(pCur); } -static bool hasPrevWindow(SStreamFillSupporter* pFillSup) { return pFillSup->prev.key != INT64_MIN; } -static bool hasNextWindow(SStreamFillSupporter* pFillSup) { return pFillSup->next.key != INT64_MIN; } +bool hasPrevWindow(SStreamFillSupporter* pFillSup) { return pFillSup->prev.key != INT64_MIN; } +bool hasNextWindow(SStreamFillSupporter* pFillSup) { return pFillSup->next.key != INT64_MIN; } static bool hasNextNextWindow(SStreamFillSupporter* pFillSup) { return pFillSup->nextNext.key != INT64_MIN; return false; } -static void transBlockToResultRow(const SSDataBlock* pBlock, int32_t rowId, TSKEY ts, SResultRowData* pRowVal) { +void transBlockToResultRow(const SSDataBlock* pBlock, int32_t rowId, TSKEY ts, SResultRowData* pRowVal) { int32_t numOfCols = taosArrayGetSize(pBlock->pDataBlock); for (int32_t i = 0; i < numOfCols; ++i) { SColumnInfoData* pColData = taosArrayGet(pBlock->pDataBlock, i); @@ -262,30 +257,7 @@ static void transBlockToResultRow(const SSDataBlock* pBlock, int32_t rowId, TSKE pRowVal->key = ts; } -static void calcDeltaData(SSDataBlock* pBlock, int32_t rowId, SResultRowData* pRowVal, SArray* pDelta, - SFillColInfo* pFillCol, int32_t numOfCol, int32_t winCount, int32_t order) { - for (int32_t i = 0; i < numOfCol; i++) { - if (!pFillCol[i].notFillCol) { - int32_t slotId = GET_DEST_SLOT_ID(pFillCol + i); - SColumnInfoData* pCol = taosArrayGet(pBlock->pDataBlock, slotId); - char* var = colDataGetData(pCol, rowId); - double start = 0; - GET_TYPED_DATA(start, double, pCol->info.type, var); - SResultCellData* pCell = getResultCell(pRowVal, slotId); - double end = 0; - GET_TYPED_DATA(end, double, pCell->type, pCell->pData); - double delta = 0; - if (order == TSDB_ORDER_ASC) { - delta = (end - start) / winCount; - } else { - delta = (start - end) / winCount; - } - taosArraySet(pDelta, slotId, &delta); - } - } -} - -static void calcRowDeltaData(SResultRowData* pEndRow, SArray* pEndPoins, SFillColInfo* pFillCol, +void calcRowDeltaData(SResultRowData* pEndRow, SArray* pEndPoins, SFillColInfo* pFillCol, int32_t numOfCol) { for (int32_t i = 0; i < numOfCol; i++) { if (!pFillCol[i].notFillCol) { @@ -308,7 +280,7 @@ static void setFillInfoEnd(TSKEY ts, SInterval* pInterval, SStreamFillInfo* pFil pFillInfo->end = ts; } -static void setFillKeyInfo(TSKEY start, TSKEY end, SInterval* pInterval, SStreamFillInfo* pFillInfo) { +void setFillKeyInfo(TSKEY start, TSKEY end, SInterval* pInterval, SStreamFillInfo* pFillInfo) { setFillInfoStart(start, pInterval, pFillInfo); pFillInfo->current = pFillInfo->start; setFillInfoEnd(end, pInterval, pFillInfo); @@ -519,7 +491,7 @@ static bool buildFillResult(SResultRowData* pResRow, SStreamFillSupporter* pFill return true; } -static bool hasRemainCalc(SStreamFillInfo* pFillInfo) { +bool hasRemainCalc(SStreamFillInfo* pFillInfo) { if (pFillInfo->current != INT64_MIN && pFillInfo->current <= pFillInfo->end) { return true; } @@ -1004,7 +976,7 @@ static SSDataBlock* doStreamFill(SOperatorInfo* pOperator) { return pInfo->pRes; } -static int32_t initResultBuf(SStreamFillSupporter* pFillSup) { +int32_t initResultBuf(SStreamFillSupporter* pFillSup) { pFillSup->rowSize = sizeof(SResultCellData) * pFillSup->numOfAllCols; for (int i = 0; i < pFillSup->numOfAllCols; i++) { SFillColInfo* pCol = &pFillSup->pAllColInfo[i]; diff --git a/source/libs/executor/src/streamtimesliceoperator.c b/source/libs/executor/src/streamtimesliceoperator.c new file mode 100644 index 000000000000..5ba985c02bb3 --- /dev/null +++ b/source/libs/executor/src/streamtimesliceoperator.c @@ -0,0 +1,778 @@ +/* + * 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 "executorInt.h" +#include "filter.h" +#include "function.h" +#include "functionMgt.h" +#include "operator.h" +#include "querytask.h" +#include "storageapi.h" +#include "streamexecutorInt.h" +#include "tcommon.h" +#include "tcompare.h" +#include "tdatablock.h" +#include "tfill.h" +#include "ttime.h" + +#define STREAM_TIME_SLICE_OP_STATE_NAME "StreamTimeSliceHistoryState" +#define STREAM_TIME_SLICE_OP_CHECKPOINT_NAME "StreamTimeSliceOperator_Checkpoint" +#define HAS_NON_ROW_DATA(pRowData) (pRowData->key == INT64_MIN) + +typedef struct SSlicePoint { + SWinKey key; + SResultRowData* pLeftRow; + SResultRowData* pRightRow; + SRowBuffPos* pResPos; +} SSlicePoint; + +void streamTimeSliceReleaseState(SOperatorInfo* pOperator) { + // todo(liuyao) add +} + +void streamTimeSliceReloadState(SOperatorInfo* pOperator) { + // todo(liuyao) add +} + +void destroyStreamTimeSliceOperatorInfo(void* param) { + SStreamTimeSliceOperatorInfo* pInfo = (SStreamTimeSliceOperatorInfo*)param; + clearGroupResInfo(&pInfo->groupResInfo); + taosArrayDestroyP(pInfo->pUpdated, destroyFlusedPos); + pInfo->pUpdated = NULL; + + taosArrayDestroy(pInfo->pDelWins); + blockDataDestroy(pInfo->pDelRes); + destroyStreamAggSupporter(&pInfo->streamAggSup); + + colDataDestroy(&pInfo->twAggSup.timeWindowData); + tSimpleHashCleanup(pInfo->pUpdatedMap); + pInfo->pUpdatedMap = NULL; + tSimpleHashCleanup(pInfo->pDeletedMap); + + blockDataDestroy(pInfo->pCheckpointRes); + // todo(liuyao) 看是否有遗漏 + taosMemoryFreeClear(param); +} + +static void doStreamTimeSliceSaveCheckpoint(SOperatorInfo* pOperator) { + // todo(liuyao) add +} + +static bool fillPointResult(SStreamFillSupporter* pFillSup, SResultRowData* pResRow, TSKEY ts, SSDataBlock* pBlock) { + if (pBlock->info.rows >= pBlock->info.capacity) { + return false; + } + for (int32_t i = 0; i < pFillSup->numOfAllCols; i++) { + SFillColInfo* pFillCol = pFillSup->pAllColInfo + i; + int32_t dstSlotId = GET_DEST_SLOT_ID(pFillCol); + SColumnInfoData* pDstCol = taosArrayGet(pBlock->pDataBlock, dstSlotId); + + if (isIrowtsPseudoColumn(pFillCol->pExpr)) { + colDataSetVal(pDstCol, pBlock->info.rows, (char*)&ts, false); + } else if (isIsfilledPseudoColumn(pFillCol->pExpr)) { + bool isFilled = false; + colDataSetVal(pDstCol, pBlock->info.rows, (char*)&isFilled, false); + } else { + int32_t srcSlot = pFillCol->pExpr->base.pParam[0].pCol->slotId; + SResultCellData* pCell = getResultCell(pResRow, srcSlot); + setRowCell(pDstCol, pBlock->info.rows, pCell); + } + } + + pBlock->info.rows += 1; + return true; +} + +static void fillNormalRange(SStreamFillSupporter* pFillSup, SStreamFillInfo* pFillInfo, SSDataBlock* pBlock) { + while (hasRemainCalc(pFillInfo) && pBlock->info.rows < pBlock->info.capacity) { + STimeWindow st = {.skey = pFillInfo->current, .ekey = pFillInfo->current}; + if (inWinRange(&pFillSup->winRange, &st)) { + fillPointResult(pFillSup, pFillInfo->pResRow, pFillInfo->current, pBlock); + } + pFillInfo->current = taosTimeAdd(pFillInfo->current, pFillSup->interval.sliding, pFillSup->interval.slidingUnit, + pFillSup->interval.precision); + } +} + +static void fillLinearRange(SStreamFillSupporter* pFillSup, SStreamFillInfo* pFillInfo, SSDataBlock* pBlock) { + while (hasRemainCalc(pFillInfo) && pBlock->info.rows < pBlock->info.capacity) { + for (int32_t i = 0; i < pFillSup->numOfAllCols; ++i) { + SFillColInfo* pFillCol = pFillSup->pAllColInfo + i; + int32_t dstSlotId = GET_DEST_SLOT_ID(pFillCol); + int32_t srcSlot = pFillCol->pExpr->base.pParam[0].pCol->slotId; + SColumnInfoData* pDstCol = taosArrayGet(pBlock->pDataBlock, dstSlotId); + int16_t type = pDstCol->info.type; + SResultCellData* pCell = getResultCell(pFillInfo->pResRow, srcSlot); + int32_t index = pBlock->info.rows; + if (isIrowtsPseudoColumn(pFillCol->pExpr)) { + colDataSetVal(pDstCol, pBlock->info.rows, (char*)&pFillInfo->current, false); + } else if (isIsfilledPseudoColumn(pFillCol->pExpr)) { + bool isFilled = true; + colDataSetVal(pDstCol, pBlock->info.rows, (char*)&isFilled, false); + } else { + if (IS_VAR_DATA_TYPE(type) || type == TSDB_DATA_TYPE_BOOL || pCell->isNull) { + colDataSetNULL(pDstCol, index); + continue; + } + SPoint* pEnd = taosArrayGet(pFillInfo->pLinearInfo->pEndPoints, srcSlot); + double vCell = 0; + SPoint start = {0}; + start.key = pFillInfo->pResRow->key; + start.val = pCell->pData; + + SPoint cur = {0}; + cur.key = pFillInfo->current; + cur.val = taosMemoryCalloc(1, pCell->bytes); + taosGetLinearInterpolationVal(&cur, pCell->type, &start, pEnd, pCell->type); + colDataSetVal(pDstCol, index, (const char*)cur.val, false); + destroySPoint(&cur); + } + } + pFillInfo->current = taosTimeAdd(pFillInfo->current, pFillSup->interval.sliding, pFillSup->interval.slidingUnit, + pFillSup->interval.precision); + pBlock->info.rows++; + } +} + +static void doStreamFillRange(SStreamFillSupporter* pFillSup, SStreamFillInfo* pFillInfo, + SSDataBlock* pRes) { + if (pFillInfo->needFill == false) { + fillPointResult(pFillSup, &pFillSup->cur, pFillSup->cur.key, pRes); + return; + } + + if (pFillInfo->pos == FILL_POS_START) { + if (fillPointResult(pFillSup, &pFillSup->cur, pFillSup->cur.key, pRes)) { + pFillInfo->pos = FILL_POS_INVALID; + } + } + if (pFillInfo->type != TSDB_FILL_LINEAR) { + fillNormalRange(pFillSup, pFillInfo, pRes); + } else { + fillLinearRange(pFillSup, pFillInfo, pRes); + + if (pFillInfo->pos == FILL_POS_MID) { + if (fillPointResult(pFillSup, &pFillSup->cur, pFillSup->cur.key, pRes)) { + pFillInfo->pos = FILL_POS_INVALID; + } + } + + if (pFillInfo->current > pFillInfo->end && pFillInfo->pLinearInfo->hasNext) { + pFillInfo->pLinearInfo->hasNext = false; + taosArraySwap(pFillInfo->pLinearInfo->pEndPoints, pFillInfo->pLinearInfo->pNextEndPoints); + pFillInfo->pResRow = &pFillSup->cur; + setFillKeyInfo(pFillSup->cur.key, pFillInfo->pLinearInfo->nextEnd, &pFillSup->interval, pFillInfo); + fillLinearRange(pFillSup, pFillInfo, pRes); + } + } + if (pFillInfo->pos == FILL_POS_END) { + if (fillPointResult(pFillSup, &pFillSup->cur, pFillSup->cur.key, pRes)) { + pFillInfo->pos = FILL_POS_INVALID; + } + } +} + +static int32_t getQualifiedRowNumAsc(SExprSupp* pExprSup, SSDataBlock* pBlock, int32_t rowId, bool ignoreNull) { + if (!ignoreNull) { + return rowId; + } + + for (int32_t i = rowId; rowId < pBlock->info.rows; i++) { + if (!checkNullRow(pExprSup, pBlock, rowId, ignoreNull)) { + return i; + } + } + return -1; +} + +static int32_t getQualifiedRowNumDesc(SExprSupp* pExprSup, SSDataBlock* pBlock, TSKEY* tsCols, int32_t rowId, + bool ignoreNull) { + TSKEY ts = tsCols[rowId]; + int32_t resRow = -1; + for (; rowId >= 0; rowId--) { + if (checkNullRow(pExprSup, pBlock, rowId, ignoreNull)) { + continue; + } + + if (ts != tsCols[rowId]) { + if (resRow >= 0) { + break; + } else { + ts = tsCols[rowId]; + } + } + resRow = rowId; + } + return resRow; +} + +static void getPointRowDataFromState(SStreamAggSupporter* pAggSup, SStreamFillSupporter* pFillSup, + SSlicePoint* pPoint) { + int32_t curVLen = 0; + int32_t code = + pAggSup->stateStore.streamStateFillGet(pAggSup->pState, &pPoint->key, (void**)&pPoint->pResPos, &curVLen); + pPoint->pLeftRow = pPoint->pResPos->pRowBuff; + if (pFillSup->type == TSDB_FILL_LINEAR) { + pPoint->pRightRow = POINTER_SHIFT(pPoint->pResPos->pRowBuff, pFillSup->rowSize); + } else { + pPoint->pRightRow = NULL; + } +} + +static void getPointInfoFromState(SStreamAggSupporter* pAggSup, SStreamFillSupporter* pFillSup, TSKEY ts, + int64_t groupId) { + void* pState = pAggSup->pState; + resetPrevAndNextWindow(pFillSup); + + SWinKey key = {.ts = ts, .groupId = groupId}; + void* curVal = NULL; + int32_t curVLen = 0; + int32_t code = pAggSup->stateStore.streamStateFillGet(pState, &key, (void**)&curVal, &curVLen); + if (code == TSDB_CODE_SUCCESS) { + pFillSup->cur.key = key.ts; + pFillSup->cur.pRowVal = curVal; + } else { + qDebug("streamStateFillGet key failed, Data may be deleted. ts:%" PRId64 ", groupId:%" PRId64, ts, groupId); + pFillSup->cur.key = ts; + pFillSup->cur.pRowVal = NULL; + } + + SWinKey preKey = {.ts = INT64_MIN, .groupId = groupId}; + void* preVal = NULL; + int32_t preVLen = 0; + code = pAggSup->stateStore.streamStateFillGetPrev(pState, &key, &preKey, &preVal, &preVLen); + if (code == TSDB_CODE_SUCCESS) { + pFillSup->prev.key = preKey.ts; + pFillSup->prev.pRowVal = preVal; + } + + SWinKey nextKey = {.ts = INT64_MIN, .groupId = groupId}; + void* nextVal = NULL; + int32_t nextVLen = 0; + code = pAggSup->stateStore.streamStateFillGetNext(pState, &key, &nextKey, &nextVal, &nextVLen); + if (code == TSDB_CODE_SUCCESS) { + pFillSup->next.key = nextKey.ts; + pFillSup->next.pRowVal = nextVal; + } +} + +static void setTimeSliceFillInfo(SStreamFillSupporter* pFillSup, SStreamFillInfo* pFillInfo, TSKEY ts) { + if (!hasPrevWindow(pFillSup) && !hasNextWindow(pFillSup)) { + pFillInfo->needFill = false; + pFillInfo->pos = FILL_POS_START; + return; + } + TSKEY prevWKey = INT64_MIN; + TSKEY nextWKey = INT64_MIN; + if (hasPrevWindow(pFillSup)) { + prevWKey = pFillSup->prev.key; + } + if (hasNextWindow(pFillSup)) { + nextWKey = pFillSup->next.key; + } + + pFillInfo->needFill = true; + pFillInfo->pos = FILL_POS_INVALID; + switch (pFillInfo->type) { + case TSDB_FILL_NULL: + case TSDB_FILL_NULL_F: + case TSDB_FILL_SET_VALUE: + case TSDB_FILL_SET_VALUE_F: { + if (hasPrevWindow(pFillSup) && hasNextWindow(pFillSup)) { + pFillInfo->needFill = false; + pFillInfo->pos = FILL_POS_START; + } else if (hasPrevWindow(pFillSup)) { + setFillKeyInfo(prevWKey, ts, &pFillSup->interval, pFillInfo); + pFillInfo->pos = FILL_POS_END; + } else { + setFillKeyInfo(ts, nextWKey, &pFillSup->interval, pFillInfo); + pFillInfo->pos = FILL_POS_START; + } + copyNotFillExpData(pFillSup, pFillInfo); + } break; + case TSDB_FILL_PREV: { + if (hasNextWindow(pFillSup)) { + setFillKeyInfo(ts, nextWKey, &pFillSup->interval, pFillInfo); + pFillInfo->pos = FILL_POS_START; + resetFillWindow(&pFillSup->prev); + pFillSup->prev.key = pFillSup->cur.key; + pFillSup->prev.pRowVal = pFillSup->cur.pRowVal; + } else { + ASSERT(hasPrevWindow(pFillSup)); + setFillKeyInfo(prevWKey, ts, &pFillSup->interval, pFillInfo); + pFillInfo->pos = FILL_POS_END; + pFillInfo->preRowKey = INT64_MIN; + } + pFillInfo->pResRow = &pFillSup->prev; + } break; + case TSDB_FILL_NEXT: { + if (hasPrevWindow(pFillSup)) { + setFillKeyInfo(prevWKey, ts, &pFillSup->interval, pFillInfo); + pFillInfo->pos = FILL_POS_END; + resetFillWindow(&pFillSup->next); + pFillSup->next.key = pFillSup->cur.key; + pFillSup->next.pRowVal = pFillSup->cur.pRowVal; + pFillInfo->preRowKey = INT64_MIN; + } else { + ASSERT(hasNextWindow(pFillSup)); + setFillKeyInfo(ts, nextWKey, &pFillSup->interval, pFillInfo); + pFillInfo->pos = FILL_POS_START; + } + pFillInfo->pResRow = &pFillSup->next; + } break; + case TSDB_FILL_LINEAR: { + if (hasPrevWindow(pFillSup) && hasNextWindow(pFillSup)) { + setFillKeyInfo(prevWKey, ts, &pFillSup->interval, pFillInfo); + pFillInfo->pos = FILL_POS_MID; + pFillInfo->pLinearInfo->nextEnd = nextWKey; + calcRowDeltaData(&pFillSup->cur, pFillInfo->pLinearInfo->pEndPoints, pFillSup->pAllColInfo, + pFillSup->numOfAllCols); + pFillInfo->pResRow = &pFillSup->prev; + + calcRowDeltaData(&pFillSup->next, pFillInfo->pLinearInfo->pNextEndPoints, pFillSup->pAllColInfo, + pFillSup->numOfAllCols); + pFillInfo->pLinearInfo->hasNext = true; + } else if (hasPrevWindow(pFillSup)) { + setFillKeyInfo(prevWKey, ts, &pFillSup->interval, pFillInfo); + pFillInfo->pos = FILL_POS_END; + pFillInfo->pLinearInfo->nextEnd = INT64_MIN; + calcRowDeltaData(&pFillSup->cur, pFillInfo->pLinearInfo->pEndPoints, pFillSup->pAllColInfo, + pFillSup->numOfAllCols); + pFillInfo->pResRow = &pFillSup->prev; + pFillInfo->pLinearInfo->hasNext = false; + } else { + ASSERT(hasNextWindow(pFillSup)); + setFillKeyInfo(ts, nextWKey, &pFillSup->interval, pFillInfo); + pFillInfo->pos = FILL_POS_START; + pFillInfo->pLinearInfo->nextEnd = INT64_MIN; + calcRowDeltaData(&pFillSup->next, pFillInfo->pLinearInfo->pEndPoints, pFillSup->pAllColInfo, + pFillSup->numOfAllCols); + pFillInfo->pResRow = &pFillSup->cur; + pFillInfo->pLinearInfo->hasNext = false; + } + } break; + default: + ASSERT(0); + break; + } + ASSERT(pFillInfo->pos != FILL_POS_INVALID); +} + +static bool needAdjValue(SSlicePoint* pPoint, TSKEY ts, bool isLeft, int32_t fillType) { + switch (fillType) { + case TSDB_FILL_NULL: + case TSDB_FILL_NULL_F: + case TSDB_FILL_SET_VALUE: + case TSDB_FILL_SET_VALUE_F: { + if (HAS_NON_ROW_DATA(pPoint->pRightRow) && HAS_NON_ROW_DATA(pPoint->pLeftRow)) { + return true; + } + } break; + case TSDB_FILL_PREV: { + if (isLeft && (HAS_NON_ROW_DATA(pPoint->pLeftRow) || pPoint->pLeftRow->key < ts)) { + return true; + } + } break; + case TSDB_FILL_NEXT: { + if (!isLeft && (HAS_NON_ROW_DATA(pPoint->pRightRow) || pPoint->pRightRow->key > ts)) { + return true; + } + } break; + case TSDB_FILL_LINEAR: { + if (isLeft && (HAS_NON_ROW_DATA(pPoint->pLeftRow) || pPoint->pLeftRow->key < ts)) { + return true; + } else if (!isLeft && (HAS_NON_ROW_DATA(pPoint->pRightRow) || pPoint->pRightRow->key > ts)) { + return true; + } + } break; + default: + ASSERT(0); + } + return false; +} + +static void doStreamTimeSliceImpl(SOperatorInfo* pOperator, SSDataBlock* pBlock) { + SStreamTimeSliceOperatorInfo* pInfo = (SStreamTimeSliceOperatorInfo*)pOperator->info; + SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; + SStreamAggSupporter* pAggSup = &pInfo->streamAggSup; + SExprSupp* pExprSup = &pOperator->exprSupp; + int32_t numOfOutput = pExprSup->numOfExprs; + SColumnInfoData* pColDataInfo = taosArrayGet(pBlock->pDataBlock, pInfo->primaryTsIndex); + TSKEY* tsCols = (int64_t*)pColDataInfo->pData; + void* pPkVal = NULL; + int32_t pkLen = 0; + int64_t groupId = pBlock->info.id.groupId; + SColumnInfoData* pPkColDataInfo = NULL; + SStreamFillSupporter* pFillSup = pInfo->pFillSup; + SStreamFillInfo* pFillInfo = pInfo->pFillInfo; + if (hasSrcPrimaryKeyCol(&pInfo->basic)) { + pPkColDataInfo = taosArrayGet(pBlock->pDataBlock, pInfo->basic.primaryPkIndex); + } + + pFillSup->winRange = pTaskInfo->streamInfo.fillHistoryWindow; + if (pFillSup->winRange.ekey <= 0) { + pFillSup->winRange.ekey = INT64_MIN; + } + + int32_t startPos = 0; + for (; startPos < pBlock->info.rows; startPos++) { + if (hasSrcPrimaryKeyCol(&pInfo->basic) && pInfo->ignoreExpiredData) { + pPkVal = colDataGetData(pPkColDataInfo, startPos); + pkLen = colDataGetRowLength(pPkColDataInfo, startPos); + } + + if (pInfo->ignoreExpiredData && checkExpiredData(&pAggSup->stateStore, pAggSup->pUpdateInfo, &pInfo->twAggSup, + pBlock->info.id.uid, tsCols[startPos], pPkVal, pkLen)) { + qDebug("===stream===ignore expired data, window end ts:%" PRId64 ", maxts - wartermak:%" PRId64, tsCols[startPos], + pInfo->twAggSup.maxTs - pInfo->twAggSup.waterMark); + continue; + } + + if (checkNullRow(pExprSup, pBlock, startPos, pInfo->ignoreNull)) { + continue; + } + } + + if (startPos >= pBlock->info.rows) { + return; + } + + SResultRowInfo dumyInfo = {0}; + dumyInfo.cur.pageId = -1; + STimeWindow curWin = getActiveTimeWindow(NULL, &dumyInfo, tsCols[startPos], &pFillSup->interval, TSDB_ORDER_ASC); + SSlicePoint point = {.key.ts = curWin.skey, .key.groupId = groupId}; + getPointRowDataFromState(pAggSup, pFillSup, &point); + if (needAdjValue(&point, tsCols[startPos], true, pFillSup->type)) { + transBlockToResultRow(pBlock, startPos, tsCols[startPos], point.pLeftRow); + saveWinResult(&point.key, point.pResPos, pInfo->pUpdatedMap); + } + + while (startPos < pBlock->info.rows) { + int32_t numOfWin = getNumOfRowsInTimeWindow(&pBlock->info, tsCols, startPos, curWin.ekey, binarySearchForKey, NULL, + TSDB_ORDER_ASC); + startPos += numOfWin; + int32_t leftRowId = getQualifiedRowNumDesc(pExprSup, pBlock, tsCols, startPos - 1, pInfo->ignoreNull); + startPos = getQualifiedRowNumAsc(pExprSup, pBlock, startPos, pInfo->ignoreNull); + if (startPos < 0) { + break; + } + curWin = getActiveTimeWindow(NULL, &dumyInfo, tsCols[startPos], &pFillSup->interval, TSDB_ORDER_ASC); + getPointInfoFromState(pAggSup, pFillSup, curWin.skey, groupId); + bool left = needAdjValue(&point, tsCols[leftRowId], true, pFillSup->type); + if (left) { + transBlockToResultRow(pBlock, leftRowId, tsCols[leftRowId], point.pLeftRow); + } + bool right = needAdjValue(&point, tsCols[startPos], false, pFillSup->type); + if (right) { + transBlockToResultRow(pBlock, startPos, tsCols[startPos], point.pRightRow); + } + + if (left || right) { + saveWinResult(&point.key, point.pResPos, pInfo->pUpdatedMap); + } + } +} + +void doBuildTimeSlicePointResult(SStreamAggSupporter* pAggSup, SStreamFillSupporter* pFillSup, + SStreamFillInfo* pFillInfo, SSDataBlock* pBlock, SGroupResInfo* pGroupResInfo) { + blockDataCleanup(pBlock); + if (!hasRemainResults(pGroupResInfo)) { + return; + } + + // clear the existed group id + pBlock->info.id.groupId = 0; + int32_t numOfRows = getNumOfTotalRes(pGroupResInfo); + for (; pGroupResInfo->index < numOfRows; pGroupResInfo->index++) { + SRowBuffPos* pPos = *(SRowBuffPos**)taosArrayGet(pGroupResInfo->pRows, pGroupResInfo->index); + // todo(liuyao) fill 增加接口,get buff from pos设置pFillSup->cur + SWinKey* pKey = (SWinKey*)pPos->pKey; + if (pBlock->info.id.groupId == 0) { + pBlock->info.id.groupId = pKey->groupId; + } else if (pBlock->info.id.groupId != pKey->groupId) { + pGroupResInfo->index--; + break; + } + getPointInfoFromState(pAggSup, pFillSup, pKey->ts, pKey->groupId); + setTimeSliceFillInfo(pFillSup, pFillInfo, pKey->ts); + doStreamFillRange(pFillSup, pFillInfo, pBlock); + } +} + +static SSDataBlock* buildTimeSliceResult(SOperatorInfo* pOperator) { + SStreamTimeSliceOperatorInfo* pInfo = pOperator->info; + SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; + uint16_t opType = pOperator->operatorType; + SStreamAggSupporter* pAggSup = &pInfo->streamAggSup; + + doBuildDeleteResultImpl(&pAggSup->stateStore, pAggSup->pState, pInfo->pDelWins, &pInfo->delIndex, pInfo->pDelRes); + if (pInfo->pDelRes->info.rows != 0) { + // process the rest of the data + printDataBlock(pInfo->pDelRes, getStreamOpName(opType), GET_TASKID(pTaskInfo)); + return pInfo->pDelRes; + } + + doBuildTimeSlicePointResult(pAggSup, pInfo->pFillSup, pInfo->pFillInfo, pInfo->pRes, &pInfo->groupResInfo); + if (pInfo->pRes->info.rows != 0) { + printDataBlock(pInfo->pRes, getStreamOpName(opType), GET_TASKID(pTaskInfo)); + return pInfo->pRes; + } + + return NULL; +} + +static SSDataBlock* doStreamTimeSlice(SOperatorInfo* pOperator) { + SStreamTimeSliceOperatorInfo* pInfo = pOperator->info; + SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; + SStreamAggSupporter* pAggSup = &pInfo->streamAggSup; + + if (pOperator->status == OP_EXEC_DONE) { + return NULL; + } + + if (pOperator->status == OP_RES_TO_RETURN) { + if (hasRemainCalc(pInfo->pFillInfo) || + (pInfo->pFillInfo->pos != FILL_POS_INVALID && pInfo->pFillInfo->needFill == true)) { + blockDataCleanup(pInfo->pRes); + doStreamFillRange(pInfo->pFillSup, pInfo->pFillInfo, pInfo->pRes); + if (pInfo->pRes->info.rows > 0) { + printDataBlock(pInfo->pRes, getStreamOpName(pOperator->operatorType), GET_TASKID(pTaskInfo)); + return pInfo->pRes; + } + } + + SSDataBlock* resBlock = buildTimeSliceResult(pOperator); + if (resBlock != NULL) { + return resBlock; + } + + if (pInfo->recvCkBlock) { + pInfo->recvCkBlock = false; + printDataBlock(pInfo->pCheckpointRes, getStreamOpName(pOperator->operatorType), GET_TASKID(pTaskInfo)); + return pInfo->pCheckpointRes; + } + + setStreamOperatorCompleted(pOperator); + return NULL; + } + + SSDataBlock* fillResult = NULL; + SOperatorInfo* downstream = pOperator->pDownstream[0]; + while (1) { + SSDataBlock* pBlock = getNextBlockFromDownstream(pOperator, 0); + if (pBlock == NULL) { + pOperator->status = OP_RES_TO_RETURN; + qDebug("===stream===return data:%s. recv datablock num:%" PRIu64, getStreamOpName(pOperator->operatorType), + pInfo->numOfDatapack); + pInfo->numOfDatapack = 0; + break; + } + pInfo->numOfDatapack++; + printSpecDataBlock(pBlock, getStreamOpName(pOperator->operatorType), "recv", GET_TASKID(pTaskInfo)); + + switch (pBlock->info.type) { + case STREAM_DELETE_RESULT: { + // todo(liuyao) add + } break; + case STREAM_NORMAL: + case STREAM_INVALID: { + SExprSupp* pExprSup = &pInfo->scalarSup; + if (pExprSup->pExprInfo != NULL) { + projectApplyFunctions(pExprSup->pExprInfo, pBlock, pBlock, pExprSup->pCtx, pExprSup->numOfExprs, NULL); + } + } break; + case STREAM_CHECKPOINT: { + pInfo->recvCkBlock = true; + pAggSup->stateStore.streamStateCommit(pAggSup->pState); + doStreamTimeSliceSaveCheckpoint(pOperator); + pInfo->recvCkBlock = true; + copyDataBlock(pInfo->pCheckpointRes, pBlock); + continue; + } break; + case STREAM_CREATE_CHILD_TABLE: { + return pBlock; + } break; + default: + ASSERTS(false, "invalid SSDataBlock type"); + } + + doStreamTimeSliceImpl(pOperator, pBlock); + } + + if (!pInfo->destHasPrimaryKey) { + removeDeleteResults(pInfo->pUpdatedMap, pInfo->pDelWins); + } else { + copyIntervalDeleteKey(pInfo->pDeletedMap, pInfo->pDelWins); + } + + void* pIte = NULL; + int32_t iter = 0; + while ((pIte = tSimpleHashIterate(pInfo->pUpdatedMap, pIte, &iter)) != NULL) { + taosArrayPush(pInfo->pUpdated, pIte); + } + taosArraySort(pInfo->pUpdated, winPosCmprImpl); + + initMultiResInfoFromArrayList(&pInfo->groupResInfo, pInfo->pUpdated); + pInfo->pUpdated = NULL; + blockDataEnsureCapacity(pInfo->pRes, pOperator->resultInfo.capacity); + tSimpleHashCleanup(pInfo->pUpdatedMap); + pInfo->pUpdatedMap = NULL; + + return buildTimeSliceResult(pOperator); +} + +int32_t doStreamTimeSliceEncodeOpState(void** buf, int32_t len, SOperatorInfo* pOperator) { + // todo(liuyao) add + return 0; +} + +void* doStreamTimeSliceDecodeOpState(void* buf, int32_t len, SOperatorInfo* pOperator) { + // todo(liuyao) add + return NULL; +} + +static SStreamFillSupporter* initTimeSliceFillSup(SStreamInterpFuncPhysiNode* pPhyFillNode, SExprInfo* pExprInfo, + int32_t numOfExprs) { + SStreamFillSupporter* pFillSup = taosMemoryCalloc(1, sizeof(SStreamFillSupporter)); + if (!pFillSup) { + return NULL; + } + pFillSup->numOfFillCols = numOfExprs; + int32_t numOfNotFillCols = 0; + pFillSup->pAllColInfo = createFillColInfo(pExprInfo, pFillSup->numOfFillCols, NULL, numOfNotFillCols, + (const SNodeListNode*)(pPhyFillNode->pFillValues)); + pFillSup->type = convertFillType(pPhyFillNode->fillMode); + pFillSup->numOfAllCols = pFillSup->numOfFillCols + numOfNotFillCols; + pFillSup->interval.interval = pPhyFillNode->interval; + // todo(liuyao) 初始化 pFillSup->interval其他属性 + pFillSup->pAPI = NULL; + + int32_t code = initResultBuf(pFillSup); + if (code != TSDB_CODE_SUCCESS) { + destroyStreamFillSupporter(pFillSup); + return NULL; + } + pFillSup->pResMap = NULL; + pFillSup->hasDelete = false; + return pFillSup; +} + +SOperatorInfo* createStreamTimeSliceOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pPhyNode, + SExecTaskInfo* pTaskInfo, SReadHandle* pHandle) { + SStreamTimeSliceOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SStreamTimeSliceOperatorInfo)); + SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); + if (pOperator == NULL || pInfo == NULL) { + goto _error; + } + SStreamInterpFuncPhysiNode* pInterpPhyNode = (SStreamInterpFuncPhysiNode*)pPhyNode; + pOperator->pTaskInfo = pTaskInfo; + initResultSizeInfo(&pOperator->resultInfo, 4096); + SExprSupp* pExpSup = &pOperator->exprSupp; + int32_t numOfExprs = 0; + SExprInfo* pExprInfo = createExprInfo(pInterpPhyNode->pFuncs, NULL, &numOfExprs); + int32_t code = initExprSupp(pExpSup, pExprInfo, numOfExprs, &pTaskInfo->storageAPI.functionStore); + if (code != TSDB_CODE_SUCCESS) { + goto _error; + } + + if (pInterpPhyNode->pExprs != NULL) { + int32_t num = 0; + SExprInfo* pScalarExprInfo = createExprInfo(pInterpPhyNode->pExprs, NULL, &num); + code = initExprSupp(&pInfo->scalarSup, pScalarExprInfo, num, &pTaskInfo->storageAPI.functionStore); + if (code != TSDB_CODE_SUCCESS) { + goto _error; + } + } + + code = filterInitFromNode((SNode*)pInterpPhyNode->node.pConditions, &pOperator->exprSupp.pFilterInfo, 0); + if (code != TSDB_CODE_SUCCESS) { + goto _error; + } + + pInfo->twAggSup = (STimeWindowAggSupp){ + .waterMark = pInterpPhyNode->streamOption.watermark, + .calTrigger = pInterpPhyNode->streamOption.triggerType, + .maxTs = INT64_MIN, + .minTs = INT64_MAX, + .deleteMark = getDeleteMarkFromOption(&pInterpPhyNode->streamOption), + }; + + pInfo->primaryTsIndex = ((SColumnNode*)pInterpPhyNode->pTimeSeries)->slotId; + code = initStreamAggSupporter(&pInfo->streamAggSup, pExpSup, numOfExprs, 0, pTaskInfo->streamInfo.pState, + sizeof(COUNT_TYPE), 0, &pTaskInfo->storageAPI.stateStore, pHandle, &pInfo->twAggSup, + GET_TASKID(pTaskInfo), &pTaskInfo->storageAPI, pInfo->primaryTsIndex); + if (code != TSDB_CODE_SUCCESS) { + goto _error; + } + + initExecTimeWindowInfo(&pInfo->twAggSup.timeWindowData, &pTaskInfo->window); + + pInfo->pRes = createDataBlockFromDescNode(pPhyNode->pOutputDataBlockDesc); + pInfo->delIndex = 0; + pInfo->pDelWins = taosArrayInit(4, sizeof(SWinKey)); + pInfo->pDelRes = createSpecialDataBlock(STREAM_DELETE_RESULT); + _hash_fn_t hashFn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY); + pInfo->pDeletedMap = tSimpleHashInit(4096, hashFn); + + pInfo->ignoreExpiredData = pInterpPhyNode->streamOption.igExpired; + pInfo->ignoreExpiredDataSaved = false; + pInfo->pUpdated = NULL; + pInfo->pUpdatedMap = NULL; + pInfo->historyPoints = taosArrayInit(4, sizeof(SWinKey)); + if (!pInfo->historyPoints) { + goto _error; + } + + pInfo->recvCkBlock = false; + pInfo->pCheckpointRes = createSpecialDataBlock(STREAM_CHECKPOINT); + pInfo->destHasPrimaryKey = pInterpPhyNode->streamOption.destHasPrimaryKey; + pInfo->numOfDatapack = 0; + pInfo->pFillSup = initTimeSliceFillSup(pInterpPhyNode, pExprInfo, numOfExprs); + + pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERP_FUNC; + setOperatorInfo(pOperator, getStreamOpName(pOperator->operatorType), QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERP_FUNC, + true, OP_NOT_OPENED, pInfo, pTaskInfo); + // for stream + void* buff = NULL; + int32_t len = 0; + int32_t res = pTaskInfo->storageAPI.stateStore.streamStateGetInfo( + pTaskInfo->streamInfo.pState, STREAM_TIME_SLICE_OP_CHECKPOINT_NAME, strlen(STREAM_TIME_SLICE_OP_CHECKPOINT_NAME), + &buff, &len); + if (res == TSDB_CODE_SUCCESS) { + doStreamTimeSliceDecodeOpState(buff, len, pOperator); + taosMemoryFree(buff); + } + pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, doStreamTimeSlice, NULL, destroyStreamTimeSliceOperatorInfo, + optrDefaultBufFn, NULL, optrDefaultGetNextExtFn, NULL); + setOperatorStreamStateFn(pOperator, streamTimeSliceReleaseState, streamTimeSliceReloadState); + + if (downstream) { + if (downstream->operatorType != QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN ) { + SStreamScanInfo* pScanInfo = downstream->info; + pScanInfo->igCheckUpdate = true; + } + initDownStream(downstream, &pInfo->streamAggSup, pOperator->operatorType, pInfo->primaryTsIndex, &pInfo->twAggSup, + &pInfo->basic); + code = appendDownstream(pOperator, &downstream, 1); + } + return pOperator; + +_error: + if (pInfo != NULL) { + destroyStreamTimeSliceOperatorInfo(pInfo); + } + taosMemoryFreeClear(pOperator); + pTaskInfo->code = code; + return NULL; +} diff --git a/source/libs/executor/src/streamtimewindowoperator.c b/source/libs/executor/src/streamtimewindowoperator.c index 5b9c018bba2c..78d14578a661 100644 --- a/source/libs/executor/src/streamtimewindowoperator.c +++ b/source/libs/executor/src/streamtimewindowoperator.c @@ -161,7 +161,7 @@ int32_t saveResult(SResultWindowInfo winInfo, SSHashObj* pStUpdated) { return tSimpleHashPut(pStUpdated, &winInfo.sessionWin, sizeof(SSessionKey), &winInfo, sizeof(SResultWindowInfo)); } -static int32_t saveWinResult(SWinKey* pKey, SRowBuffPos* pPos, SSHashObj* pUpdatedMap) { +int32_t saveWinResult(SWinKey* pKey, SRowBuffPos* pPos, SSHashObj* pUpdatedMap) { return tSimpleHashPut(pUpdatedMap, pKey, sizeof(SWinKey), &pPos, POINTER_BYTES); } @@ -189,7 +189,7 @@ static int32_t compareWinKey(void* pKey, void* data, int32_t index) { return winKeyCmprImpl(pKey, pDataPos); } -static void removeDeleteResults(SSHashObj* pUpdatedMap, SArray* pDelWins) { +void removeDeleteResults(SSHashObj* pUpdatedMap, SArray* pDelWins) { taosArraySort(pDelWins, winKeyCmprImpl); taosArrayRemoveDuplicate(pDelWins, winKeyCmprImpl, NULL); int32_t delSize = taosArrayGetSize(pDelWins); @@ -364,6 +364,10 @@ STimeWindow getFinalTimeWindow(int64_t ts, SInterval* pInterval) { static void doBuildDeleteResult(SStreamIntervalOperatorInfo* pInfo, SArray* pWins, int32_t* index, SSDataBlock* pBlock) { + doBuildDeleteResultImpl(&pInfo->stateStore, pInfo->pState, pWins, index, pBlock); +} + +void doBuildDeleteResultImpl(SStateStore* pAPI, SStreamState* pState, SArray* pWins, int32_t* index, SSDataBlock* pBlock) { blockDataCleanup(pBlock); int32_t size = taosArrayGetSize(pWins); if (*index == size) { @@ -376,7 +380,7 @@ static void doBuildDeleteResult(SStreamIntervalOperatorInfo* pInfo, SArray* pWin for (int32_t i = *index; i < size; i++) { SWinKey* pWin = taosArrayGet(pWins, i); void* tbname = NULL; - pInfo->stateStore.streamStateGetParName(pInfo->pState, pWin->groupId, &tbname, false); + pAPI->streamStateGetParName(pState, pWin->groupId, &tbname, false); if (tbname == NULL) { appendDataToSpecialBlock(pBlock, &pWin->ts, &pWin->ts, &uid, &pWin->groupId, NULL); } else { @@ -384,7 +388,7 @@ static void doBuildDeleteResult(SStreamIntervalOperatorInfo* pInfo, SArray* pWin STR_WITH_MAXSIZE_TO_VARSTR(parTbName, tbname, sizeof(parTbName)); appendDataToSpecialBlock(pBlock, &pWin->ts, &pWin->ts, &uid, &pWin->groupId, parTbName); } - pInfo->stateStore.streamStateFreeVal(tbname); + pAPI->streamStateFreeVal(tbname); (*index)++; } } @@ -994,7 +998,7 @@ static void doStreamIntervalAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSDat } } -static inline int winPosCmprImpl(const void* pKey1, const void* pKey2) { +int winPosCmprImpl(const void* pKey1, const void* pKey2) { SRowBuffPos* pos1 = *(SRowBuffPos**)pKey1; SRowBuffPos* pos2 = *(SRowBuffPos**)pKey2; SWinKey* pWin1 = (SWinKey*)pos1->pKey; @@ -1224,7 +1228,7 @@ void doStreamIntervalSaveCheckpoint(SOperatorInfo* pOperator) { } } -static void copyIntervalDeleteKey(SSHashObj* pMap, SArray* pWins) { +void copyIntervalDeleteKey(SSHashObj* pMap, SArray* pWins) { void* pIte = NULL; int32_t iter = 0; while ((pIte = tSimpleHashIterate(pMap, pIte, &iter)) != NULL) { @@ -1468,6 +1472,14 @@ int64_t getDeleteMark(SWindowPhysiNode* pWinPhyNode, int64_t interval) { return deleteMark; } +int64_t getDeleteMarkFromOption(SStreamOption* pOption) { + if (pOption->deleteMark <= 0) { + return DEAULT_DELETE_MARK; + } + int64_t deleteMark = TMAX(pOption->deleteMark, pOption->watermark); + return deleteMark; +} + static TSKEY compareTs(void* pKey) { SWinKey* pWinKey = (SWinKey*)pKey; return pWinKey->ts; @@ -1633,7 +1645,7 @@ SOperatorInfo* createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream, pInfo->clearState = false; pInfo->pMidPullDatas = taosArrayInit(4, sizeof(SWinKey)); pInfo->pDeletedMap = tSimpleHashInit(4096, hashFn); - pInfo->destHasPrimaryKey = pIntervalPhyNode->window.destHasPrimayKey; + pInfo->destHasPrimaryKey = pIntervalPhyNode->window.destHasPrimaryKey; pOperator->operatorType = pPhyNode->type; if (!IS_FINAL_INTERVAL_OP(pOperator) || numOfChild == 0) { @@ -3080,7 +3092,7 @@ SOperatorInfo* createStreamSessionAggOperatorInfo(SOperatorInfo* downstream, SPh pInfo->pCheckpointRes = createSpecialDataBlock(STREAM_CHECKPOINT); pInfo->clearState = false; pInfo->recvGetAll = false; - pInfo->destHasPrimaryKey = pSessionNode->window.destHasPrimayKey; + pInfo->destHasPrimaryKey = pSessionNode->window.destHasPrimaryKey; pInfo->pPkDeleted = tSimpleHashInit(64, hashFn); pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_STREAM_SESSION; @@ -3999,7 +4011,7 @@ SOperatorInfo* createStreamStateAggOperatorInfo(SOperatorInfo* downstream, SPhys pInfo->pCheckpointRes = createSpecialDataBlock(STREAM_CHECKPOINT); pInfo->recvGetAll = false; pInfo->pPkDeleted = tSimpleHashInit(64, hashFn); - pInfo->destHasPrimaryKey = pStateNode->window.destHasPrimayKey; + pInfo->destHasPrimaryKey = pStateNode->window.destHasPrimaryKey; setOperatorInfo(pOperator, "StreamStateAggOperator", QUERY_NODE_PHYSICAL_PLAN_STREAM_STATE, true, OP_NOT_OPENED, pInfo, pTaskInfo); @@ -4272,7 +4284,7 @@ SOperatorInfo* createStreamIntervalOperatorInfo(SOperatorInfo* downstream, SPhys _hash_fn_t hashFn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY); pInfo->pDeletedMap = tSimpleHashInit(4096, hashFn); - pInfo->destHasPrimaryKey = pIntervalPhyNode->window.destHasPrimayKey; + pInfo->destHasPrimaryKey = pIntervalPhyNode->window.destHasPrimaryKey; // for stream void* buff = NULL; @@ -4599,6 +4611,6 @@ static SSDataBlock* doStreamMidIntervalAgg(SOperatorInfo* pOperator) { } void setStreamOperatorCompleted(SOperatorInfo* pOperator) { - setOperatorCompleted(pOperator); qDebug("stask:%s %s status: %d. set completed", GET_TASKID(pOperator->pTaskInfo), getStreamOpName(pOperator->operatorType), pOperator->status); + setOperatorCompleted(pOperator); } diff --git a/source/libs/executor/src/timesliceoperator.c b/source/libs/executor/src/timesliceoperator.c index cda22fa3203c..c63b6aba9a22 100644 --- a/source/libs/executor/src/timesliceoperator.c +++ b/source/libs/executor/src/timesliceoperator.c @@ -168,12 +168,12 @@ static FORCE_INLINE int32_t timeSliceEnsureBlockCapacity(STimeSliceOperatorInfo* return TSDB_CODE_SUCCESS; } -static bool isIrowtsPseudoColumn(SExprInfo* pExprInfo) { +bool isIrowtsPseudoColumn(SExprInfo* pExprInfo) { char *name = pExprInfo->pExpr->_function.functionName; return (IS_TIMESTAMP_TYPE(pExprInfo->base.resSchema.type) && strcasecmp(name, "_irowts") == 0); } -static bool isIsfilledPseudoColumn(SExprInfo* pExprInfo) { +bool isIsfilledPseudoColumn(SExprInfo* pExprInfo) { char *name = pExprInfo->pExpr->_function.functionName; return (IS_BOOLEAN_TYPE(pExprInfo->base.resSchema.type) && strcasecmp(name, "_isfilled") == 0); } @@ -233,7 +233,7 @@ static bool isGroupKeyFunc(SExprInfo* pExprInfo) { return (functionType == FUNCTION_TYPE_GROUP_KEY); } -static bool getIgoreNullRes(SExprSupp* pExprSup) { +bool getIgoreNullRes(SExprSupp* pExprSup) { for (int32_t i = 0; i < pExprSup->numOfExprs; ++i) { SExprInfo* pExprInfo = &pExprSup->pExprInfo[i]; @@ -250,7 +250,7 @@ static bool getIgoreNullRes(SExprSupp* pExprSup) { return false; } -static bool checkNullRow(SExprSupp* pExprSup, SSDataBlock* pSrcBlock, int32_t index, bool ignoreNull) { +bool checkNullRow(SExprSupp* pExprSup, SSDataBlock* pSrcBlock, int32_t index, bool ignoreNull) { if (!ignoreNull) { return false; } diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c index e3e84ac20bc3..26bdf7e51e85 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -2893,7 +2893,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "interp", .type = FUNCTION_TYPE_INTERP, .classification = FUNC_MGT_TIMELINE_FUNC | FUNC_MGT_INTERVAL_INTERPO_FUNC | FUNC_MGT_IMPLICIT_TS_FUNC | - FUNC_MGT_FORBID_STREAM_FUNC | FUNC_MGT_FORBID_SYSTABLE_FUNC | FUNC_MGT_KEEP_ORDER_FUNC | FUNC_MGT_PRIMARY_KEY_FUNC, + FUNC_MGT_FORBID_SYSTABLE_FUNC | FUNC_MGT_KEEP_ORDER_FUNC | FUNC_MGT_PRIMARY_KEY_FUNC, .translateFunc = translateInterp, .getEnvFunc = getSelectivityFuncEnv, .initFunc = functionSetup, diff --git a/source/libs/nodes/src/nodesCloneFuncs.c b/source/libs/nodes/src/nodesCloneFuncs.c index f02fefd97743..991ec8d2e58e 100644 --- a/source/libs/nodes/src/nodesCloneFuncs.c +++ b/source/libs/nodes/src/nodesCloneFuncs.c @@ -762,7 +762,7 @@ static int32_t physiWindowCopy(const SWindowPhysiNode* pSrc, SWindowPhysiNode* p COPY_SCALAR_FIELD(triggerType); COPY_SCALAR_FIELD(watermark); COPY_SCALAR_FIELD(igExpired); - COPY_SCALAR_FIELD(destHasPrimayKey); + COPY_SCALAR_FIELD(destHasPrimaryKey); return TSDB_CODE_SUCCESS; } diff --git a/source/libs/nodes/src/nodesCodeFuncs.c b/source/libs/nodes/src/nodesCodeFuncs.c index d5b36aa1a885..38a4a2d1b6c4 100644 --- a/source/libs/nodes/src/nodesCodeFuncs.c +++ b/source/libs/nodes/src/nodesCodeFuncs.c @@ -413,6 +413,8 @@ const char* nodesNodeName(ENodeType type) { return "PhysiIndefRowsFunc"; case QUERY_NODE_PHYSICAL_PLAN_INTERP_FUNC: return "PhysiInterpFunc"; + case QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERP_FUNC: + return "PhysiStreamInterpFunc"; case QUERY_NODE_PHYSICAL_PLAN_DISPATCH: return "PhysiDispatch"; case QUERY_NODE_PHYSICAL_PLAN_INSERT: @@ -2740,7 +2742,7 @@ static int32_t physiWindowNodeToJson(const void* pObj, SJson* pJson) { code = tjsonAddBoolToObject(pJson, jkWindowPhysiPlanMergeDataBlock, pNode->mergeDataBlock); } if (TSDB_CODE_SUCCESS == code) { - code = tjsonAddIntegerToObject(pJson, jkWindowPhysiPlanDestHasPrimaryKey, pNode->destHasPrimayKey); + code = tjsonAddIntegerToObject(pJson, jkWindowPhysiPlanDestHasPrimaryKey, pNode->destHasPrimaryKey); } return code; @@ -2778,7 +2780,7 @@ static int32_t jsonToPhysiWindowNode(const SJson* pJson, void* pObj) { code = tjsonGetBoolValue(pJson, jkWindowPhysiPlanMergeDataBlock, &pNode->mergeDataBlock); } if (TSDB_CODE_SUCCESS == code) { - code = tjsonGetTinyIntValue(pJson, jkWindowPhysiPlanDestHasPrimaryKey, &pNode->destHasPrimayKey); + code = tjsonGetTinyIntValue(pJson, jkWindowPhysiPlanDestHasPrimaryKey, &pNode->destHasPrimaryKey); } return code; @@ -5619,6 +5621,7 @@ static const char* jkSelectStmtLimit = "Limit"; static const char* jkSelectStmtSlimit = "Slimit"; static const char* jkSelectStmtStmtName = "StmtName"; static const char* jkSelectStmtHasAggFuncs = "HasAggFuncs"; +static const char* jkSelectStmtInterpFuncs = "HasInterpFuncs"; static int32_t selectStmtToJson(const void* pObj, SJson* pJson) { const SSelectStmt* pNode = (const SSelectStmt*)pObj; @@ -5666,6 +5669,9 @@ static int32_t selectStmtToJson(const void* pObj, SJson* pJson) { if (TSDB_CODE_SUCCESS == code) { code = tjsonAddBoolToObject(pJson, jkSelectStmtHasAggFuncs, pNode->hasAggFuncs); } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonAddBoolToObject(pJson, jkSelectStmtInterpFuncs, pNode->hasInterpFunc); + } return code; } @@ -5716,6 +5722,9 @@ static int32_t jsonToSelectStmt(const SJson* pJson, void* pObj) { if (TSDB_CODE_SUCCESS == code) { code = tjsonGetBoolValue(pJson, jkSelectStmtHasAggFuncs, &pNode->hasAggFuncs); } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonGetBoolValue(pJson, jkSelectStmtInterpFuncs, &pNode->hasInterpFunc); + } return code; } @@ -7793,6 +7802,7 @@ static int32_t specificNodeToJson(const void* pObj, SJson* pJson) { case QUERY_NODE_PHYSICAL_PLAN_INDEF_ROWS_FUNC: return physiIndefRowsFuncNodeToJson(pObj, pJson); case QUERY_NODE_PHYSICAL_PLAN_INTERP_FUNC: + case QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERP_FUNC: return physiInterpFuncNodeToJson(pObj, pJson); case QUERY_NODE_PHYSICAL_PLAN_DISPATCH: return physiDispatchNodeToJson(pObj, pJson); @@ -8151,6 +8161,7 @@ static int32_t jsonToSpecificNode(const SJson* pJson, void* pObj) { case QUERY_NODE_PHYSICAL_PLAN_INDEF_ROWS_FUNC: return jsonToPhysiIndefRowsFuncNode(pJson, pObj); case QUERY_NODE_PHYSICAL_PLAN_INTERP_FUNC: + case QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERP_FUNC: return jsonToPhysiInterpFuncNode(pJson, pObj); case QUERY_NODE_PHYSICAL_PLAN_DISPATCH: return jsonToPhysiDispatchNode(pJson, pObj); diff --git a/source/libs/nodes/src/nodesMsgFuncs.c b/source/libs/nodes/src/nodesMsgFuncs.c index 54cf68523560..926e5aa19884 100644 --- a/source/libs/nodes/src/nodesMsgFuncs.c +++ b/source/libs/nodes/src/nodesMsgFuncs.c @@ -3183,7 +3183,7 @@ static int32_t physiWindowNodeToMsg(const void* pObj, STlvEncoder* pEncoder) { code = tlvEncodeBool(pEncoder, PHY_WINDOW_CODE_MERGE_DATA_BLOCK, pNode->mergeDataBlock); } if (TSDB_CODE_SUCCESS == code) { - code = tlvEncodeI8(pEncoder, PHY_WINDOW_CODE_DEST_HAS_PRIMARY_KEY, pNode->destHasPrimayKey); + code = tlvEncodeI8(pEncoder, PHY_WINDOW_CODE_DEST_HAS_PRIMARY_KEY, pNode->destHasPrimaryKey); } return code; @@ -3227,7 +3227,7 @@ static int32_t msgToPhysiWindowNode(STlvDecoder* pDecoder, void* pObj) { code = tlvDecodeBool(pTlv, &pNode->mergeDataBlock); break; case PHY_WINDOW_CODE_DEST_HAS_PRIMARY_KEY: - code = tlvDecodeI8(pTlv, &pNode->destHasPrimayKey); + code = tlvDecodeI8(pTlv, &pNode->destHasPrimaryKey); break; default: break; @@ -4539,6 +4539,7 @@ static int32_t specificNodeToMsg(const void* pObj, STlvEncoder* pEncoder) { code = physiIndefRowsFuncNodeToMsg(pObj, pEncoder); break; case QUERY_NODE_PHYSICAL_PLAN_INTERP_FUNC: + case QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERP_FUNC: code = physiInterpFuncNodeToMsg(pObj, pEncoder); break; case QUERY_NODE_PHYSICAL_PLAN_DISPATCH: @@ -4701,6 +4702,7 @@ static int32_t msgToSpecificNode(STlvDecoder* pDecoder, void* pObj) { code = msgToPhysiIndefRowsFuncNode(pDecoder, pObj); break; case QUERY_NODE_PHYSICAL_PLAN_INTERP_FUNC: + case QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERP_FUNC: code = msgToPhysiInterpFuncNode(pDecoder, pObj); break; case QUERY_NODE_PHYSICAL_PLAN_DISPATCH: diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c index f118c15b7a21..9d24b3512ebd 100644 --- a/source/libs/nodes/src/nodesUtilFuncs.c +++ b/source/libs/nodes/src/nodesUtilFuncs.c @@ -723,6 +723,8 @@ SNode* nodesMakeNode(ENodeType type) { return makeNode(type, sizeof(SSubplan)); case QUERY_NODE_PHYSICAL_PLAN: return makeNode(type, sizeof(SQueryPlan)); + case QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERP_FUNC: + return makeNode(type, sizeof(SStreamInterpFuncPhysiNode)); default: break; } @@ -1652,7 +1654,8 @@ void nodesDestroyNode(SNode* pNode) { nodesDestroyList(pPhyNode->pFuncs); break; } - case QUERY_NODE_PHYSICAL_PLAN_INTERP_FUNC: { + case QUERY_NODE_PHYSICAL_PLAN_INTERP_FUNC: + case QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERP_FUNC: { SInterpFuncPhysiNode* pPhyNode = (SInterpFuncPhysiNode*)pNode; destroyPhysiNode((SPhysiNode*)pPhyNode); nodesDestroyList(pPhyNode->pExprs); diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index b741db3ae6a7..f6072be96238 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -5496,8 +5496,15 @@ static int32_t translateInterp(STranslateContext* pCxt, SSelectStmt* pSelect) { if (pSelect->pRange != NULL && QUERY_NODE_OPERATOR == nodeType(pSelect->pRange) && pSelect->pEvery == NULL) { // single point interp every can be omitted } else { - return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_INTERP_CLAUSE, - "Missing RANGE clause, EVERY clause or FILL clause"); + if (pCxt->createStream) { + if (NULL == pSelect->pEvery || NULL == pSelect->pFill) { + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_INTERP_CLAUSE, + "Missing EVERY clause or FILL clause"); + } + } else { + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_INTERP_CLAUSE, + "Missing RANGE clause, EVERY clause or FILL clause"); + } } } diff --git a/source/libs/planner/src/planLogicCreater.c b/source/libs/planner/src/planLogicCreater.c index 66fa405a3a49..ea9c5df97634 100644 --- a/source/libs/planner/src/planLogicCreater.c +++ b/source/libs/planner/src/planLogicCreater.c @@ -894,6 +894,15 @@ static bool isInterpFunc(int32_t funcId) { return fmIsInterpFunc(funcId) || fmIsInterpPseudoColumnFunc(funcId) || fmIsGroupKeyFunc(funcId); } +static void initStreamOption(SLogicPlanContext* pCxt, SStreamOption* pOption) { + pOption->triggerType = pCxt->pPlanCxt->triggerType; + pOption->watermark = pCxt->pPlanCxt->watermark; + pOption->deleteMark = pCxt->pPlanCxt->deleteMark; + pOption->igExpired = pCxt->pPlanCxt->igExpired; + pOption->igCheckUpdate = pCxt->pPlanCxt->igCheckUpdate; + pOption->destHasPrimaryKey = pCxt->pPlanCxt->destHasPrimaryKey; +} + static int32_t createInterpFuncLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect, SLogicNode** pLogicNode) { if (!pSelect->hasInterpFunc) { return TSDB_CODE_SUCCESS; @@ -934,6 +943,10 @@ static int32_t createInterpFuncLogicNode(SLogicPlanContext* pCxt, SSelectStmt* p code = createColumnByRewriteExprs(pInterpFunc->pFuncs, &pInterpFunc->node.pTargets); } + if (TSDB_CODE_SUCCESS == code) { + initStreamOption(pCxt, &pInterpFunc->streamOption); + } + if (TSDB_CODE_SUCCESS == code) { *pLogicNode = (SLogicNode*)pInterpFunc; } else { diff --git a/source/libs/planner/src/planPhysiCreater.c b/source/libs/planner/src/planPhysiCreater.c index 1b896e03c397..44fc9a3fbb20 100644 --- a/source/libs/planner/src/planPhysiCreater.c +++ b/source/libs/planner/src/planPhysiCreater.c @@ -1684,8 +1684,9 @@ static int32_t createIndefRowsFuncPhysiNode(SPhysiPlanContext* pCxt, SNodeList* static int32_t createInterpFuncPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pChildren, SInterpFuncLogicNode* pFuncLogicNode, SPhysiNode** pPhyNode) { - SInterpFuncPhysiNode* pInterpFunc = - (SInterpFuncPhysiNode*)makePhysiNode(pCxt, (SLogicNode*)pFuncLogicNode, QUERY_NODE_PHYSICAL_PLAN_INTERP_FUNC); + SInterpFuncPhysiNode* pInterpFunc = (SInterpFuncPhysiNode*)makePhysiNode( + pCxt, (SLogicNode*)pFuncLogicNode, + pCxt->pPlanCxt->streamQuery ? QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERP_FUNC : QUERY_NODE_PHYSICAL_PLAN_INTERP_FUNC); if (NULL == pInterpFunc) { return TSDB_CODE_OUT_OF_MEMORY; } @@ -1728,6 +1729,10 @@ static int32_t createInterpFuncPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pCh code = setConditionsSlotId(pCxt, (const SLogicNode*)pFuncLogicNode, (SPhysiNode*)pInterpFunc); } + if (pCxt->pPlanCxt->streamQuery) { + pInterpFunc->streamOption = pFuncLogicNode->streamOption; + } + if (TSDB_CODE_SUCCESS == code) { *pPhyNode = (SPhysiNode*)pInterpFunc; } else { @@ -1869,7 +1874,7 @@ static int32_t createWindowPhysiNodeFinalize(SPhysiPlanContext* pCxt, SNodeList* pWindow->deleteMark = pWindowLogicNode->deleteMark; pWindow->igExpired = pWindowLogicNode->igExpired; if (pCxt->pPlanCxt->streamQuery) { - pWindow->destHasPrimayKey = pCxt->pPlanCxt->destHasPrimaryKey; + pWindow->destHasPrimaryKey = pCxt->pPlanCxt->destHasPrimaryKey; } pWindow->mergeDataBlock = (GROUP_ACTION_KEEP == pWindowLogicNode->node.groupAction ? false : true); pWindow->node.inputTsOrder = pWindowLogicNode->node.inputTsOrder; diff --git a/source/libs/planner/src/planValidator.c b/source/libs/planner/src/planValidator.c index 4fcd064e56fd..6b7b46cfa762 100755 --- a/source/libs/planner/src/planValidator.c +++ b/source/libs/planner/src/planValidator.c @@ -118,6 +118,7 @@ int32_t doValidatePhysiNode(SValidatePlanContext* pCxt, SNode* pNode) { case QUERY_NODE_PHYSICAL_PLAN_HASH_JOIN: case QUERY_NODE_PHYSICAL_PLAN_GROUP_CACHE: case QUERY_NODE_PHYSICAL_PLAN_DYN_QUERY_CTRL: + case QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERP_FUNC: break; case QUERY_NODE_PHYSICAL_SUBPLAN: return validateSubplanNode(pCxt, (SSubplan*)pNode); diff --git a/source/libs/stream/inc/streamBackendRocksdb.h b/source/libs/stream/inc/streamBackendRocksdb.h index 6b81ac87eecf..e0933f4fac2d 100644 --- a/source/libs/stream/inc/streamBackendRocksdb.h +++ b/source/libs/stream/inc/streamBackendRocksdb.h @@ -160,7 +160,7 @@ int32_t streamStatePut_rocksdb(SStreamState* pState, const SWinKey* key, const v int32_t streamStateGet_rocksdb(SStreamState* pState, const SWinKey* key, void** pVal, int32_t* pVLen); int32_t streamStateDel_rocksdb(SStreamState* pState, const SWinKey* key); int32_t streamStateClear_rocksdb(SStreamState* pState); -int32_t streamStateCurNext_rocksdb(SStreamState* pState, SStreamStateCur* pCur); +int32_t streamStateCurNext_rocksdb(SStreamStateCur* pCur); int32_t streamStateGetFirst_rocksdb(SStreamState* pState, SWinKey* key); int32_t streamStateGetGroupKVByCur_rocksdb(SStreamStateCur* pCur, SWinKey* pKey, const void** pVal, int32_t* pVLen); int32_t streamStateAddIfNotExist_rocksdb(SStreamState* pState, const SWinKey* key, void** pVal, int32_t* pVLen); @@ -205,6 +205,7 @@ SStreamStateCur* streamStateFillGetCur_rocksdb(SStreamState* pState, const SWinK int32_t streamStateFillGetKVByCur_rocksdb(SStreamStateCur* pCur, SWinKey* pKey, const void** pVal, int32_t* pVLen); SStreamStateCur* streamStateFillSeekKeyPrev_rocksdb(SStreamState* pState, const SWinKey* key); SStreamStateCur* streamStateFillSeekKeyNext_rocksdb(SStreamState* pState, const SWinKey* key); +SStreamStateCur* streamStateFillSeekToLast_rocksdb(SStreamState* pState); // partag cf int32_t streamStatePutParTag_rocksdb(SStreamState* pState, int64_t groupId, const void* tag, int32_t tagLen); diff --git a/source/libs/stream/src/streamBackendRocksdb.c b/source/libs/stream/src/streamBackendRocksdb.c index 4f07faad2590..3e0e19bdbdb9 100644 --- a/source/libs/stream/src/streamBackendRocksdb.c +++ b/source/libs/stream/src/streamBackendRocksdb.c @@ -2817,7 +2817,7 @@ int32_t streamStateClear_rocksdb(SStreamState* pState) { return 0; } -int32_t streamStateCurNext_rocksdb(SStreamState* pState, SStreamStateCur* pCur) { +int32_t streamStateCurNext_rocksdb(SStreamStateCur* pCur) { if (!pCur) { return -1; } @@ -2982,6 +2982,7 @@ SStreamStateCur* streamStateSeekToLast_rocksdb(SStreamState* pState) { STREAM_STATE_DEL_ROCKSDB(pState, "state", &maxStateKey); return pCur; } + SStreamStateCur* streamStateGetCur_rocksdb(SStreamState* pState, const SWinKey* key) { stDebug("streamStateGetCur_rocksdb"); STaskDbWrapper* wrapper = pState->pTdbState->pOwner->pBackend; @@ -3480,6 +3481,12 @@ SStreamStateCur* streamStateFillSeekKeyPrev_rocksdb(SStreamState* pState, const streamStateFreeCur(pCur); return NULL; } + +SStreamStateCur* streamStateFillSeekToLast_rocksdb(SStreamState* pState) { + SWinKey key = {.groupId = UINT64_MAX, .ts = INT64_MAX}; + return streamStateFillSeekKeyNext_rocksdb(pState, &key); +} + #ifdef BUILD_NO_CALL int32_t streamStateSessionGetKeyByRange_rocksdb(SStreamState* pState, const SSessionKey* key, SSessionKey* curKey) { stDebug("streamStateSessionGetKeyByRange_rocksdb"); @@ -3518,7 +3525,7 @@ int32_t streamStateSessionGetKeyByRange_rocksdb(SStreamState* pState, const SSes } if (c > 0) { - streamStateCurNext_rocksdb(pState, pCur); + streamStateCurNext_rocksdb(pCur); code = streamStateSessionGetKVByCur_rocksdb(pCur, &resKey, NULL, 0); if (code == 0 && sessionRangeKeyCmpr(key, &resKey) == 0) { *curKey = resKey; @@ -3565,7 +3572,7 @@ int32_t streamStateSessionAddIfNotExist_rocksdb(SStreamState* pState, SSessionKe goto _end; } taosMemoryFreeClear(*pVal); - streamStateCurNext_rocksdb(pState, pCur); + streamStateCurNext_rocksdb(pCur); } else { *key = originKey; streamStateFreeCur(pCur); @@ -3611,7 +3618,7 @@ int32_t streamStateSessionClear_rocksdb(SStreamState* pState) { } taosMemoryFreeClear(buf); - streamStateCurNext_rocksdb(pState, pCur); + streamStateCurNext_rocksdb(pCur); } streamStateFreeCur(pCur); return -1; @@ -3642,7 +3649,7 @@ int32_t streamStateStateAddIfNotExist_rocksdb(SStreamState* pState, SSessionKey* goto _end; } - streamStateCurNext_rocksdb(pState, pCur); + streamStateCurNext_rocksdb(pCur); } else { *key = tmpKey; streamStateFreeCur(pCur); diff --git a/source/libs/stream/src/streamSessionState.c b/source/libs/stream/src/streamSessionState.c index 84db65739204..feea9f048ef7 100644 --- a/source/libs/stream/src/streamSessionState.c +++ b/source/libs/stream/src/streamSessionState.c @@ -20,12 +20,10 @@ #include "tcommon.h" #include "tsimplehash.h" -typedef int (*__session_compare_fn_t)(const SSessionKey* pWin, const void* pDatas, int pos); - -int sessionStateKeyCompare(const SSessionKey* pWin1, const void* pDatas, int pos) { +int sessionStateKeyCompare(const void* pWin1, const void* pDatas, int pos) { SRowBuffPos* pPos2 = taosArrayGetP(pDatas, pos); SSessionKey* pWin2 = (SSessionKey*)pPos2->pKey; - return sessionWinKeyCmpr(pWin1, pWin2); + return sessionWinKeyCmpr((SSessionKey*)pWin1, pWin2); } int sessionStateRangeKeyCompare(const SSessionKey* pWin1, const void* pDatas, int pos) { @@ -595,7 +593,7 @@ int32_t sessionWinStateMoveToNext(SStreamStateCur* pCur) { if (pCur && pCur->buffIndex >= 0) { pCur->buffIndex++; } else { - streamStateCurNext_rocksdb(NULL, pCur); + streamStateCurNext_rocksdb(pCur); } return TSDB_CODE_SUCCESS; } diff --git a/source/libs/stream/src/streamSliceState.c b/source/libs/stream/src/streamSliceState.c new file mode 100644 index 000000000000..001bb02622af --- /dev/null +++ b/source/libs/stream/src/streamSliceState.c @@ -0,0 +1,164 @@ +/* + * 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 "tstreamFileState.h" + +#include "query.h" +#include "streamBackendRocksdb.h" +#include "tcommon.h" +#include "tsimplehash.h" + +#define NUM_OF_FLUSED_WIN 64 + +int fillStateKeyCompare(const void* pWin1, const void* pDatas, int pos) { + SWinKey* pWin2 = taosArrayGet(pDatas, pos); + return winKeyCmprImpl((SWinKey*)pWin1, pWin2); +} + +int32_t getHashSortRowBuff(SStreamFileState* pFileState, const SWinKey* pKey, void** pVal, int32_t* pVLen) { + int32_t code = getRowBuff(pFileState, (void*)pKey, sizeof(SWinKey), pVal, pVLen); + SArray* pWinStates = NULL; + SSHashObj* pSearchBuff = getSearchBuff(pFileState); + void** ppBuff = tSimpleHashGet(pSearchBuff, &pKey->groupId, sizeof(uint64_t)); + if (ppBuff) { + pWinStates = (SArray*)(*ppBuff); + } else { + pWinStates = taosArrayInit(16, sizeof(SWinKey)); + tSimpleHashPut(pSearchBuff, &pKey->groupId, sizeof(uint64_t), &pWinStates, POINTER_BYTES); + } + if (taosArrayGetSize(pWinStates) == 0 && needClearDiskBuff(pFileState)) { + TSKEY ts = getFlushMark(pFileState); + SWinKey start = {.groupId = pKey->groupId, .ts = INT64_MAX}; + void* pState = getStateFileStore(pFileState); + SStreamStateCur* pCur = streamStateFillSeekKeyPrev_rocksdb(pState, &start); + int32_t code = TSDB_CODE_SUCCESS; + for(int32_t i = 0; i < NUM_OF_FLUSED_WIN && code == TSDB_CODE_SUCCESS; i++) { + SWinKey tmp = {.groupId = pKey->groupId}; + code = streamStateGetGroupKVByCur_rocksdb(pCur, &tmp, NULL, 0); + if (code != TSDB_CODE_SUCCESS) { + break; + } + taosArrayPush(pWinStates, &tmp); + code = streamStateCurPrev_rocksdb(pCur); + } + taosArraySort(pWinStates, winKeyCmprImpl); + streamStateFreeCur(pCur); + } + + int32_t size = taosArrayGetSize(pWinStates); + if (!isFlushedState(pFileState, pKey->ts, 0)) { + // find the first position which is smaller than the pKey + int32_t index = binarySearch(pWinStates, size, pKey, fillStateKeyCompare); + if (index == -1) { + index = 0; + } + taosArrayInsert(pWinStates, index, pKey); + } + return code; +} + +int32_t hashSortFileGetFn(SStreamFileState* pFileState, void* pKey, void** data, int32_t* pDataLen) { + void* pState = getStateFileStore(pFileState); + return streamStateFillGet_rocksdb(pState, pKey, data, pDataLen); +} + +int32_t hashSortFileRemoveFn(SStreamFileState* pFileState, const void* pKey) { + void* pState = getStateFileStore(pFileState); + return streamStateFillDel_rocksdb(pState, pKey); +} + +void clearSearchBuff(SStreamFileState* pFileState) { + SSHashObj* pSearchBuff = getSearchBuff(pFileState); + if (!pSearchBuff) { + return; + } + void* pIte = NULL; + int32_t iter = 0; + void* pBuff = getRowStateBuff(pFileState); + while ((pIte = tSimpleHashIterate(pBuff, pIte, &iter)) != NULL) { + SArray* pWinStates = *((void**)pIte); + int32_t size = taosArrayGetSize(pWinStates); + if (size > 0) { + TSKEY ts = getFlushMark(pFileState); + SWinKey key = *(SWinKey*)taosArrayGet(pWinStates, 0); + key.ts = ts; + int32_t num = binarySearch(pWinStates, size, &key, fillStateKeyCompare); + if (size > NUM_OF_FLUSED_WIN) { + num = TMIN(num, size - NUM_OF_FLUSED_WIN); + taosArrayRemoveBatch(pWinStates, 0, num, NULL); + } + } + } +} + +int32_t getHashSortNextRow(SStreamFileState* pFileState, const SWinKey* pKey, SWinKey* pResKey, void** pVal, int32_t* pVLen) { + SArray* pWinStates = NULL; + SSHashObj* pSearchBuff = getSearchBuff(pFileState); + void* pState = getStateFileStore(pFileState); + void** ppBuff = tSimpleHashGet(pSearchBuff, &pKey->groupId, sizeof(uint64_t)); + if (ppBuff) { + pWinStates = (SArray*)(*ppBuff); + } else { + SStreamStateCur* pCur = streamStateFillSeekKeyNext_rocksdb(pState, pKey); + int32_t code = streamStateGetGroupKVByCur_rocksdb(pCur, pResKey, (const void **)pVal, pVLen); + streamStateFreeCur(pCur); + return code; + } + int32_t size = taosArrayGetSize(pWinStates); + int32_t index = binarySearch(pWinStates, size, pKey, fillStateKeyCompare); + if (index == -1) { + SStreamStateCur* pCur = streamStateFillSeekKeyNext_rocksdb(pState, pKey); + int32_t code = streamStateGetGroupKVByCur_rocksdb(pCur, pResKey, (const void **)pVal, pVLen); + streamStateFreeCur(pCur); + return code; + } else { + if (index == size - 1) { + return TSDB_CODE_FAILED; + } + SWinKey* pNext = taosArrayGet(pWinStates, index + 1); + *pResKey = *pNext; + return getHashSortRowBuff(pFileState, pResKey, pVal, pVLen); + } + return TSDB_CODE_FAILED; +} + +int32_t getHashSortPrevRow(SStreamFileState* pFileState, const SWinKey* pKey, SWinKey* pResKey, void** pVal, int32_t* pVLen) { + SArray* pWinStates = NULL; + SSHashObj* pSearchBuff = getSearchBuff(pFileState); + void* pState = getStateFileStore(pFileState); + void** ppBuff = tSimpleHashGet(pSearchBuff, &pKey->groupId, sizeof(uint64_t)); + if (ppBuff) { + pWinStates = (SArray*)(*ppBuff); + } else { + SStreamStateCur* pCur = streamStateFillSeekKeyPrev_rocksdb(pState, pKey); + int32_t code = streamStateGetGroupKVByCur_rocksdb(pCur, pResKey, (const void**)pVal, pVLen); + streamStateFreeCur(pCur); + return code; + } + int32_t size = taosArrayGetSize(pWinStates); + int32_t index = binarySearch(pWinStates, size, pKey, fillStateKeyCompare); + if (index == -1 || index == 0) { + SStreamStateCur* pCur = streamStateFillSeekKeyPrev_rocksdb(pState, pKey); + int32_t code = streamStateGetGroupKVByCur_rocksdb(pCur, pResKey, (const void**)pVal, pVLen); + streamStateFreeCur(pCur); + return code; + } else { + SWinKey* pNext = taosArrayGet(pWinStates, index - 1); + *pResKey = *pNext; + return getHashSortRowBuff(pFileState, pResKey, pVal, pVLen); + } + return TSDB_CODE_FAILED; +} + diff --git a/source/libs/stream/src/streamState.c b/source/libs/stream/src/streamState.c index a817070d5b5d..6bdfff2977b3 100644 --- a/source/libs/stream/src/streamState.c +++ b/source/libs/stream/src/streamState.c @@ -359,12 +359,23 @@ int32_t streamStateFillPut(SStreamState* pState, const SWinKey* key, const void* // todo refactor int32_t streamStateFillGet(SStreamState* pState, const SWinKey* key, void** pVal, int32_t* pVLen) { #ifdef USE_ROCKSDB + if (pState->pFileState) { + return getHashSortRowBuff(pState->pFileState, key, pVal, pVLen); + } return streamStateFillGet_rocksdb(pState, key, pVal, pVLen); #else return tdbTbGet(pState->pTdbState->pFillStateDb, key, sizeof(SWinKey), pVal, pVLen); #endif } +int32_t streamStateFillGetNext(SStreamState* pState, const SWinKey* pKey, SWinKey* pResKey, void** pVal, int32_t* pVLen) { + return getHashSortNextRow(pState->pFileState, pKey, pResKey, pVal, pVLen); +} + +int32_t streamStateFillGetPrev(SStreamState* pState, const SWinKey* pKey, SWinKey* pResKey, void** pVal, int32_t* pVLen) { + return getHashSortPrevRow(pState->pFileState, pKey, pResKey, pVal, pVLen); +} + // todo refactor int32_t streamStateFillDel(SStreamState* pState, const SWinKey* key) { #ifdef USE_ROCKSDB diff --git a/source/libs/stream/src/tstreamFileState.c b/source/libs/stream/src/tstreamFileState.c index fb745f86cb16..5c022c2a5b22 100644 --- a/source/libs/stream/src/tstreamFileState.c +++ b/source/libs/stream/src/tstreamFileState.c @@ -27,6 +27,8 @@ #define DEFAULT_MAX_STREAM_BUFFER_SIZE (128 * 1024 * 1024) #define MIN_NUM_OF_ROW_BUFF 10240 #define MIN_NUM_OF_RECOVER_ROW_BUFF 128 +#define MIN_NUM_SEARCH_BUCKET 128 +#define MAX_ARRAY_SIZE 1024 #define TASK_KEY "streamFileState" #define STREAM_STATE_INFO_NAME "StreamStateCheckPoint" @@ -49,6 +51,7 @@ struct SStreamFileState { GetTsFun getTs; char* id; char* cfName; + void* searchBuff; _state_buff_cleanup_fn stateBuffCleanupFn; _state_buff_remove_fn stateBuffRemoveFn; @@ -91,7 +94,7 @@ int32_t intervalFileRemoveFn(SStreamFileState* pFileState, const void* pKey) { return streamStateDel_rocksdb(pFileState->pFileStore, pKey); } -int32_t intervalFileGetFn(SStreamFileState* pFileState, void* pKey, void* data, int32_t* pDataLen) { +int32_t intervalFileGetFn(SStreamFileState* pFileState, void* pKey, void** data, int32_t* pDataLen) { return streamStateGet_rocksdb(pFileState->pFileStore, pKey, data, pDataLen); } @@ -107,7 +110,7 @@ int32_t sessionFileRemoveFn(SStreamFileState* pFileState, const void* pKey) { return streamStateSessionDel_rocksdb(pFileState->pFileStore, pKey); } -int32_t sessionFileGetFn(SStreamFileState* pFileState, void* pKey, void* data, int32_t* pDataLen) { +int32_t sessionFileGetFn(SStreamFileState* pFileState, void* pKey, void** data, int32_t* pDataLen) { return streamStateSessionGet_rocksdb(pFileState->pFileStore, pKey, data, pDataLen); } @@ -160,7 +163,7 @@ SStreamFileState* streamFileStateInit(int64_t memSize, uint32_t keySize, uint32_ pFileState->stateFileClearFn = streamStateClear_rocksdb; pFileState->cfName = taosStrdup("state"); pFileState->stateFunctionGetFn = getRowBuff; - } else { + } else if (type == STREAM_STATE_BUFF_SORT) { pFileState->rowStateBuff = tSimpleHashInit(cap, hashFn); pFileState->stateBuffCleanupFn = sessionWinStateCleanup; pFileState->stateBuffRemoveFn = deleteSessionWinStateBuffFn; @@ -172,6 +175,19 @@ SStreamFileState* streamFileStateInit(int64_t memSize, uint32_t keySize, uint32_ pFileState->stateFileClearFn = streamStateSessionClear_rocksdb; pFileState->cfName = taosStrdup("sess"); pFileState->stateFunctionGetFn = getSessionRowBuff; + } else if (type == STREAM_STATE_BUFF_HASH_SORT) { + pFileState->rowStateBuff = tSimpleHashInit(cap, hashFn); + pFileState->searchBuff = tSimpleHashInit(MIN_NUM_SEARCH_BUCKET, hashFn); + pFileState->stateBuffCleanupFn = stateHashBuffCleanupFn; + pFileState->stateBuffRemoveFn = stateHashBuffRemoveFn; + pFileState->stateBuffRemoveByPosFn = stateHashBuffRemoveByPosFn; + pFileState->stateBuffCreateStateKeyFn = intervalCreateStateKey; + + pFileState->stateFileRemoveFn = hashSortFileRemoveFn; + pFileState->stateFileGetFn = hashSortFileGetFn; + pFileState->stateFileClearFn = NULL; + pFileState->cfName = taosStrdup("fill"); + pFileState->stateFunctionGetFn = NULL; } if (!pFileState->usedBuffs || !pFileState->freeBuffs || !pFileState->rowStateBuff) { @@ -194,8 +210,10 @@ SStreamFileState* streamFileStateInit(int64_t memSize, uint32_t keySize, uint32_ // todo(liuyao) optimize if (type == STREAM_STATE_BUFF_HASH) { recoverSnapshot(pFileState, checkpointId); - } else { + } else if (type == STREAM_STATE_BUFF_SORT) { recoverSesssion(pFileState, checkpointId); + } else if (type == STREAM_STATE_BUFF_HASH_SORT) { + recoverFillSnapshot(pFileState, checkpointId); } void* valBuf = NULL; @@ -361,6 +379,11 @@ int32_t flushRowBuff(SStreamFileState* pFileState) { } } + if (pFileState->searchBuff) { + clearFlushedRowBuff(pFileState, pFlushList, pFileState->curRowCount); + } + + flushSnapshot(pFileState, pFlushList, false); SListIter fIter = {0}; @@ -461,7 +484,7 @@ int32_t getRowBuff(SStreamFileState* pFileState, void* pKey, int32_t keyLen, voi if (!isDeteled(pFileState, ts) && isFlushedState(pFileState, ts, 0)) { int32_t len = 0; void* p = NULL; - code = streamStateGet_rocksdb(pFileState->pFileStore, pKey, &p, &len); + code = pFileState->stateFileGetFn(pFileState->pFileStore, pKey, &p, &len); qDebug("===stream===get %" PRId64 " from disc, res %d", ts, code); if (code == TSDB_CODE_SUCCESS) { memcpy(pNewPos->pRowBuff, p, len); @@ -597,6 +620,8 @@ int32_t flushSnapshot(SStreamFileState* pFileState, SStreamSnapshot* pSnapshot, streamStateClearBatch(batch); + clearSearchBuff(pFileState); + int64_t elapsed = taosGetTimestampMs() - st; qDebug("%s flush to disk in batch model completed, rows:%d, batch size:%d, elapsed time:%" PRId64 "ms", pFileState->id, numOfElems, BATCH_LIMIT, elapsed); @@ -755,6 +780,7 @@ void streamFileStateReloadInfo(SStreamFileState* pFileState, TSKEY ts) { } void* getRowStateBuff(SStreamFileState* pFileState) { return pFileState->rowStateBuff; } +void* getSearchBuff(SStreamFileState* pFileState) { return pFileState->searchBuff; } void* getStateFileStore(SStreamFileState* pFileState) { return pFileState->pFileStore; } @@ -764,8 +790,56 @@ bool isDeteled(SStreamFileState* pFileState, TSKEY ts) { bool isFlushedState(SStreamFileState* pFileState, TSKEY ts, TSKEY gap) { return ts <= (pFileState->flushMark + gap); } +TSKEY getFlushMark(SStreamFileState* pFileState) {return pFileState->flushMark;}; + int32_t getRowStateRowSize(SStreamFileState* pFileState) { return pFileState->rowSize; } int32_t getFunctionRowBuff(SStreamFileState* pFileState, void* pKey, int32_t keyLen, void** pVal, int32_t* pVLen) { return pFileState->stateFunctionGetFn(pFileState, pKey, keyLen, pVal, pVLen); } + +int32_t recoverFillSnapshot(SStreamFileState* pFileState, int64_t ckId) { + int32_t code = TSDB_CODE_SUCCESS; + if (pFileState->maxTs != INT64_MIN) { + int64_t mark = (INT64_MIN + pFileState->deleteMark >= pFileState->maxTs) + ? INT64_MIN + : pFileState->maxTs - pFileState->deleteMark; + deleteExpiredCheckPoint(pFileState, mark); + } + + SStreamStateCur* pCur = streamStateFillSeekToLast_rocksdb(pFileState->pFileStore); + if (pCur == NULL) { + return -1; + } + int32_t recoverNum = TMIN(MIN_NUM_OF_RECOVER_ROW_BUFF, pFileState->maxRowCount); + while (code == TSDB_CODE_SUCCESS) { + if (pFileState->curRowCount >= recoverNum) { + break; + } + + void* pVal = NULL; + int32_t vlen = 0; + SRowBuffPos* pNewPos = getNewRowPosForWrite(pFileState); + code = streamStateFillGetKVByCur_rocksdb(pCur, pNewPos->pKey, (const void**)&pVal, &vlen); + if (code != TSDB_CODE_SUCCESS || isFlushedState(pFileState, pFileState->getTs(pNewPos->pKey), 0) ) { + destroyRowBuffPos(pNewPos); + SListNode* pNode = tdListPopTail(pFileState->usedBuffs); + taosMemoryFreeClear(pNode); + taosMemoryFreeClear(pVal); + break; + } + ASSERT(vlen == pFileState->rowSize); + memcpy(pNewPos->pRowBuff, pVal, vlen); + taosMemoryFreeClear(pVal); + pNewPos->beFlushed = true; + code = tSimpleHashPut(pFileState->rowStateBuff, pNewPos->pKey, pFileState->keyLen, &pNewPos, POINTER_BYTES); + if (code != TSDB_CODE_SUCCESS) { + destroyRowBuffPos(pNewPos); + break; + } + code = streamStateCurPrev_rocksdb(pCur); + } + streamStateFreeCur(pCur); + + return TSDB_CODE_SUCCESS; +} From 659e8736022b17f8808e80a7be3fab574535bd19 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Fri, 12 Jul 2024 13:41:22 +0800 Subject: [PATCH 011/695] adj flush state rule --- source/libs/stream/src/tstreamFileState.c | 27 ++++++++++++++--------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/source/libs/stream/src/tstreamFileState.c b/source/libs/stream/src/tstreamFileState.c index 5c022c2a5b22..ea9857ffefa1 100644 --- a/source/libs/stream/src/tstreamFileState.c +++ b/source/libs/stream/src/tstreamFileState.c @@ -303,7 +303,7 @@ void clearExpiredRowBuff(SStreamFileState* pFileState, TSKEY ts, bool all) { } } -void clearFlushedRowBuff(SStreamFileState* pFileState, SStreamSnapshot* pFlushList, uint64_t max) { +void clearFlushedRowBuff(SStreamFileState* pFileState, SStreamSnapshot* pFlushList, uint64_t max, bool all) { uint64_t i = 0; SListIter iter = {0}; tdListInitIter(pFileState->usedBuffs, &iter, TD_LIST_FORWARD); @@ -311,14 +311,19 @@ void clearFlushedRowBuff(SStreamFileState* pFileState, SStreamSnapshot* pFlushLi SListNode* pNode = NULL; while ((pNode = tdListNext(&iter)) != NULL && i < max) { SRowBuffPos* pPos = *(SRowBuffPos**)pNode->data; - if (isFlushedState(pFileState, pFileState->getTs(pPos->pKey), 0) && !pPos->beUsed) { - tdListAppend(pFlushList, &pPos); - pFileState->flushMark = TMAX(pFileState->flushMark, pFileState->getTs(pPos->pKey)); - pFileState->stateBuffRemoveByPosFn(pFileState, pPos); - tdListPopNode(pFileState->usedBuffs, pNode); - taosMemoryFreeClear(pNode); - if (pPos->pRowBuff) { - i++; + if (isFlushedState(pFileState, pFileState->getTs(pPos->pKey), 0)) { + if (all || !pPos->beUsed) { + if (all && !pPos->pRowBuff) { + continue; + } + tdListAppend(pFlushList, &pPos); + pFileState->flushMark = TMAX(pFileState->flushMark, pFileState->getTs(pPos->pKey)); + pFileState->stateBuffRemoveByPosFn(pFileState, pPos); + tdListPopNode(pFileState->usedBuffs, pNode); + taosMemoryFreeClear(pNode); + if (pPos->pRowBuff) { + i++; + } } } } @@ -370,7 +375,7 @@ int32_t flushRowBuff(SStreamFileState* pFileState) { uint64_t num = (uint64_t)(pFileState->curRowCount * FLUSH_RATIO); num = TMAX(num, FLUSH_NUM); - clearFlushedRowBuff(pFileState, pFlushList, num); + clearFlushedRowBuff(pFileState, pFlushList, num, false); if (isListEmpty(pFlushList)) { popUsedBuffs(pFileState, pFlushList, num, false); @@ -380,7 +385,7 @@ int32_t flushRowBuff(SStreamFileState* pFileState) { } if (pFileState->searchBuff) { - clearFlushedRowBuff(pFileState, pFlushList, pFileState->curRowCount); + clearFlushedRowBuff(pFileState, pFlushList, pFileState->curRowCount, true); } From 53f6016968a19e2f435d89cbab21b0bd941d0946 Mon Sep 17 00:00:00 2001 From: "cris.pei" Date: Fri, 12 Jul 2024 20:40:54 +0800 Subject: [PATCH 012/695] Modify the taosBenchmark documentation for the TS-4883 problem --- docs/en/14-reference/05-taosbenchmark.md | 3 +++ docs/zh/14-reference/05-taosbenchmark.md | 2 ++ 2 files changed, 5 insertions(+) diff --git a/docs/en/14-reference/05-taosbenchmark.md b/docs/en/14-reference/05-taosbenchmark.md index e4884b889c95..45c5cd2fb8b0 100644 --- a/docs/en/14-reference/05-taosbenchmark.md +++ b/docs/en/14-reference/05-taosbenchmark.md @@ -364,6 +364,9 @@ The configuration parameters for specifying super table tag columns and data col - **min**: The minimum value of the column/label of the data type. The generated value will equal or large than the minimum value. - **max**: The maximum value of the column/label of the data type. The generated value will less than the maximum value. + +- **scalingFactor**: Floating-point precision enhancement factor, which takes effect only when the data type is float/double. It has a valid range of positive integers from 1 to 1,000,000. It is used to enhance the precision of generated floating-point numbers, particularly when the min or max values are small. This property enhances the precision after the decimal point by powers of 10: scalingFactor of 10 indicates an enhancement of 1 decimal precision, 100 indicates an enhancement of 2 decimal precision, and so on. + - **fun**: This column of data is filled with functions. Currently, only the sin and cos functions are supported. The input parameter is the timestamp and converted to an angle value. The conversion formula is: angle x=input time column ts value % 360. At the same time, it supports coefficient adjustment and random fluctuation factor adjustment, presented in a fixed format expression, such as fun="10\*sin(x)+100\*random(5)", where x represents the angle, ranging from 0 to 360 degrees, and the growth step size is consistent with the time column step size. 10 represents the coefficient of multiplication, 100 represents the coefficient of addition or subtraction, and 5 represents the fluctuation range within a random range of 5%. The currently supported data types are int, bigint, float, and double. Note: The expression is fixed and cannot be reversed. - **values**: The value field of the nchar/binary column/label, which will be chosen randomly from the values. diff --git a/docs/zh/14-reference/05-taosbenchmark.md b/docs/zh/14-reference/05-taosbenchmark.md index d102497d7d6c..a6cc40c13460 100644 --- a/docs/zh/14-reference/05-taosbenchmark.md +++ b/docs/zh/14-reference/05-taosbenchmark.md @@ -367,6 +367,8 @@ taosBenchmark -A INT,DOUBLE,NCHAR,BINARY\(16\) - **max** : 数据类型的 列/标签 的最大值。生成的值将小于最小值。 +- **max** : 浮点数精度增强因子,仅当数据类型是float/double时生效,有效值范围为1至1000000的正整数。用于增强生成浮点数的精度,特别是在min或max值较小的情况下。此属性按10的幂次增强小数点后的精度:scalingFactor为10表示增强1位小数精度,100表示增强2位,依此类推。 + - **fun** : 此列数据以函数填充,目前只支持 sin 和 cos 两函数,输入参数为时间戳换算成角度值,换算公式: 角度 x = 输入的时间列ts值 % 360。同时支持系数调节,随机波动因子调节,以固定格式的表达式展现,如 fun=“10\*sin(x)+100\*random(5)” , x 表示角度,取值 0 ~ 360度,增长步长与时间列步长一致。10 表示乘的系数,100 表示加或减的系数,5 表示波动幅度在 5% 的随机范围内。目前支持的数据类型为 int, bigint, float, double 四种数据类型。注意:表达式为固定模式,不可前后颠倒。 - **values** : nchar/binary 列/标签的值域,将从值中随机选择。 From fe9d61b243fcefd61db0fd7b69a187e80a9abfc4 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Mon, 29 Jul 2024 14:14:34 +0800 Subject: [PATCH 013/695] add node to json --- include/libs/nodes/plannodes.h | 9 +- source/libs/executor/inc/streamexecutorInt.h | 3 +- .../executor/src/streamtimesliceoperator.c | 36 +++++--- .../executor/src/streamtimewindowoperator.c | 2 +- source/libs/nodes/src/nodesCloneFuncs.c | 1 + source/libs/nodes/src/nodesCodeFuncs.c | 86 +++++++++++++++++++ source/libs/planner/src/planLogicCreater.c | 4 +- source/libs/planner/src/planPhysiCreater.c | 2 +- 8 files changed, 120 insertions(+), 23 deletions(-) diff --git a/include/libs/nodes/plannodes.h b/include/libs/nodes/plannodes.h index cc09ceb858a9..509710707d0c 100644 --- a/include/libs/nodes/plannodes.h +++ b/include/libs/nodes/plannodes.h @@ -194,14 +194,14 @@ typedef struct SIndefRowsFuncLogicNode { bool isTimeLineFunc; } SIndefRowsFuncLogicNode; -typedef struct SStreamOption { +typedef struct SStreamNodeOption { int8_t triggerType; int64_t watermark; int64_t deleteMark; int8_t igExpired; int8_t igCheckUpdate; int8_t destHasPrimaryKey; -} SStreamOption; +} SStreamNodeOption; typedef struct SInterpFuncLogicNode { SLogicNode node; @@ -211,8 +211,7 @@ typedef struct SInterpFuncLogicNode { EFillMode fillMode; SNode* pFillValues; // SNodeListNode SNode* pTimeSeries; // SColumnNode - //todo(liuyao) 补充clone和json等 - SStreamOption streamOption; + SStreamNodeOption streamNodeOption; } SInterpFuncLogicNode; typedef struct SGroupCacheLogicNode { @@ -516,7 +515,7 @@ typedef struct SInterpFuncPhysiNode { EFillMode fillMode; SNode* pFillValues; // SNodeListNode SNode* pTimeSeries; // SColumnNode - SStreamOption streamOption; //todo(liuyao) 补充clone和json等 + SStreamNodeOption streamNodeOption; } SInterpFuncPhysiNode; typedef SInterpFuncPhysiNode SStreamInterpFuncPhysiNode; diff --git a/source/libs/executor/inc/streamexecutorInt.h b/source/libs/executor/inc/streamexecutorInt.h index 0ab32cf838b2..8332fb3c0d92 100644 --- a/source/libs/executor/inc/streamexecutorInt.h +++ b/source/libs/executor/inc/streamexecutorInt.h @@ -31,7 +31,7 @@ void setStreamOperatorState(SSteamOpBasicInfo* pBasicInfo, EStreamType type); bool needSaveStreamOperatorInfo(SSteamOpBasicInfo* pBasicInfo); void saveStreamOperatorStateComplete(SSteamOpBasicInfo* pBasicInfo); -int64_t getDeleteMarkFromOption(SStreamOption* pOption); +int64_t getDeleteMarkFromOption(SStreamNodeOption* pOption); void removeDeleteResults(SSHashObj* pUpdatedMap, SArray* pDelWins); int32_t copyIntervalDeleteKey(SSHashObj* pMap, SArray* pWins); bool hasSrcPrimaryKeyCol(SSteamOpBasicInfo* pInfo); @@ -55,6 +55,7 @@ void setFillKeyInfo(TSKEY start, TSKEY end, SInterval* pInterval, SS int32_t setRowCell(SColumnInfoData* pCol, int32_t rowId, const SResultCellData* pCell); bool hasRemainCalc(SStreamFillInfo* pFillInfo); void destroySPoint(void* ptr); +void destroyStreamFillInfo(SStreamFillInfo* pFillInfo); int winPosCmprImpl(const void* pKey1, const void* pKey2); diff --git a/source/libs/executor/src/streamtimesliceoperator.c b/source/libs/executor/src/streamtimesliceoperator.c index 695bec7fffc1..40ac0da3324e 100644 --- a/source/libs/executor/src/streamtimesliceoperator.c +++ b/source/libs/executor/src/streamtimesliceoperator.c @@ -47,21 +47,31 @@ void streamTimeSliceReloadState(SOperatorInfo* pOperator) { void destroyStreamTimeSliceOperatorInfo(void* param) { SStreamTimeSliceOperatorInfo* pInfo = (SStreamTimeSliceOperatorInfo*)param; - clearGroupResInfo(&pInfo->groupResInfo); + colDataDestroy(&pInfo->twAggSup.timeWindowData); + destroyStreamAggSupporter(&pInfo->streamAggSup); + destroyStreamFillSupporter(pInfo->pFillSup); + destroyStreamFillInfo(pInfo->pFillInfo); + blockDataDestroy(pInfo->pRes); + blockDataDestroy(pInfo->pDelRes); + blockDataDestroy(pInfo->pCheckpointRes); + + taosMemoryFreeClear(pInfo->leftRow.pRowVal); + taosMemoryFreeClear(pInfo->valueRow.pRowVal); + taosMemoryFreeClear(pInfo->rightRow.pRowVal); + + cleanupExprSupp(&pInfo->scalarSup); + taosArrayDestroy(pInfo->historyPoints); + taosArrayDestroyP(pInfo->pUpdated, destroyFlusedPos); pInfo->pUpdated = NULL; - taosArrayDestroy(pInfo->pDelWins); - blockDataDestroy(pInfo->pDelRes); - destroyStreamAggSupporter(&pInfo->streamAggSup); - - colDataDestroy(&pInfo->twAggSup.timeWindowData); tSimpleHashCleanup(pInfo->pUpdatedMap); pInfo->pUpdatedMap = NULL; + + taosArrayDestroy(pInfo->pDelWins); tSimpleHashCleanup(pInfo->pDeletedMap); + clearGroupResInfo(&pInfo->groupResInfo); - blockDataDestroy(pInfo->pCheckpointRes); - // todo(liuyao) 看是否有遗漏 taosMemoryFreeClear(param); } @@ -696,11 +706,11 @@ int32_t createStreamTimeSliceOperatorInfo(SOperatorInfo* downstream, SPhysiNode* QUERY_CHECK_CODE(code, lino, _error); pInfo->twAggSup = (STimeWindowAggSupp){ - .waterMark = pInterpPhyNode->streamOption.watermark, - .calTrigger = pInterpPhyNode->streamOption.triggerType, + .waterMark = pInterpPhyNode->streamNodeOption.watermark, + .calTrigger = pInterpPhyNode->streamNodeOption.triggerType, .maxTs = INT64_MIN, .minTs = INT64_MAX, - .deleteMark = getDeleteMarkFromOption(&pInterpPhyNode->streamOption), + .deleteMark = getDeleteMarkFromOption(&pInterpPhyNode->streamNodeOption), }; pInfo->primaryTsIndex = ((SColumnNode*)pInterpPhyNode->pTimeSeries)->slotId; @@ -721,7 +731,7 @@ int32_t createStreamTimeSliceOperatorInfo(SOperatorInfo* downstream, SPhysiNode* _hash_fn_t hashFn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY); pInfo->pDeletedMap = tSimpleHashInit(4096, hashFn); - pInfo->ignoreExpiredData = pInterpPhyNode->streamOption.igExpired; + pInfo->ignoreExpiredData = pInterpPhyNode->streamNodeOption.igExpired; pInfo->ignoreExpiredDataSaved = false; pInfo->pUpdated = NULL; pInfo->pUpdatedMap = NULL; @@ -733,7 +743,7 @@ int32_t createStreamTimeSliceOperatorInfo(SOperatorInfo* downstream, SPhysiNode* code = createSpecialDataBlock(STREAM_CHECKPOINT, &pInfo->pCheckpointRes); QUERY_CHECK_CODE(code, lino, _error); - pInfo->destHasPrimaryKey = pInterpPhyNode->streamOption.destHasPrimaryKey; + pInfo->destHasPrimaryKey = pInterpPhyNode->streamNodeOption.destHasPrimaryKey; pInfo->numOfDatapack = 0; pInfo->pFillSup = initTimeSliceFillSup(pInterpPhyNode, pExprInfo, numOfExprs); diff --git a/source/libs/executor/src/streamtimewindowoperator.c b/source/libs/executor/src/streamtimewindowoperator.c index b0609f4d0dbf..42d6e50e2a09 100644 --- a/source/libs/executor/src/streamtimewindowoperator.c +++ b/source/libs/executor/src/streamtimewindowoperator.c @@ -1769,7 +1769,7 @@ int64_t getDeleteMark(SWindowPhysiNode* pWinPhyNode, int64_t interval) { return deleteMark; } -int64_t getDeleteMarkFromOption(SStreamOption* pOption) { +int64_t getDeleteMarkFromOption(SStreamNodeOption* pOption) { if (pOption->deleteMark <= 0) { return DEAULT_DELETE_MARK; } diff --git a/source/libs/nodes/src/nodesCloneFuncs.c b/source/libs/nodes/src/nodesCloneFuncs.c index 83947a70de29..f0a6489a8fff 100644 --- a/source/libs/nodes/src/nodesCloneFuncs.c +++ b/source/libs/nodes/src/nodesCloneFuncs.c @@ -660,6 +660,7 @@ static int32_t logicInterpFuncCopy(const SInterpFuncLogicNode* pSrc, SInterpFunc COPY_SCALAR_FIELD(fillMode); CLONE_NODE_FIELD(pFillValues); CLONE_NODE_FIELD(pTimeSeries); + COPY_OBJECT_FIELD(streamNodeOption, sizeof(SStreamNodeOption)); return TSDB_CODE_SUCCESS; } diff --git a/source/libs/nodes/src/nodesCodeFuncs.c b/source/libs/nodes/src/nodesCodeFuncs.c index 1149eef6533c..0b3dcdea8d60 100644 --- a/source/libs/nodes/src/nodesCodeFuncs.c +++ b/source/libs/nodes/src/nodesCodeFuncs.c @@ -1217,10 +1217,65 @@ static int32_t jsonToLogicIndefRowsFuncNode(const SJson* pJson, void* pObj) { return code; } +static const char* jkStreamOption_triggerType = "StreamOptionTriggerType"; +static const char* jkStreamOption_watermark = "StreamOptionWatermark"; +static const char* jkStreamOption_deleteMark = "StreamOptionDeleteMark"; +static const char* jkStreamOption_igExpired = "StreamOptionIgExpired"; +static const char* jkStreamOption_igCheckUpdate = "StreamOption_igCheckUpdate"; +static const char* jkStreamOption_destHasPrimaryKey = "StreamOptionDestHasPrimaryKey"; + +static int32_t streamNodeOptionToJson(const void* pObj, SJson* pJson) { + const SStreamNodeOption* pNode = (const SStreamNodeOption*)pObj; + int32_t code = tjsonAddIntegerToObject(pJson, jkStreamOption_triggerType, pNode->triggerType); + + if (TSDB_CODE_SUCCESS == code) { + code = tjsonAddIntegerToObject(pJson, jkStreamOption_watermark, pNode->watermark); + } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonAddIntegerToObject(pJson, jkStreamOption_deleteMark, pNode->deleteMark); + } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonAddIntegerToObject(pJson, jkStreamOption_igExpired, pNode->igExpired); + } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonAddIntegerToObject(pJson, jkStreamOption_igCheckUpdate, pNode->igCheckUpdate); + } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonAddIntegerToObject(pJson, jkStreamOption_destHasPrimaryKey, pNode->destHasPrimaryKey); + } + return code; +} + +static int32_t jsonToStreamNodeOption(const SJson* pJson, void* pObj) { + SStreamNodeOption* pNode = (SStreamNodeOption*)pObj; + int32_t code = tjsonGetTinyIntValue(pJson, jkStreamOption_triggerType, &pNode->triggerType); + + if (TSDB_CODE_SUCCESS == code) { + code = tjsonGetBigIntValue(pJson, jkStreamOption_watermark, &pNode->watermark); + } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonGetBigIntValue(pJson, jkStreamOption_deleteMark, &pNode->deleteMark); + } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonGetTinyIntValue(pJson, jkStreamOption_igExpired, &pNode->igExpired); + } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonGetTinyIntValue(pJson, jkStreamOption_igCheckUpdate, &pNode->igCheckUpdate); + } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonGetTinyIntValue(pJson, jkStreamOption_destHasPrimaryKey, &pNode->destHasPrimaryKey); + } + return code; +} + static const char* jkInterpFuncLogicPlanFuncs = "Funcs"; static const char* jkInterpFuncLogicPlanStartTime = "StartTime"; static const char* jkInterpFuncLogicPlanEndTime = "EndTime"; static const char* jkInterpFuncLogicPlanInterval = "Interval"; +static const char* jkInterpFuncLogicPlanFillMode = "fillMode"; +static const char* jkInterpFuncLogicPlanFillValues = "FillValues"; +static const char* jkInterpFuncLogicPlanTimeSeries = "TimeSeries"; +static const char* jkInterpFuncLogicPlanStreamNodeOption = "StreamNodeOption"; static int32_t logicInterpFuncNodeToJson(const void* pObj, SJson* pJson) { const SInterpFuncLogicNode* pNode = (const SInterpFuncLogicNode*)pObj; @@ -1238,6 +1293,18 @@ static int32_t logicInterpFuncNodeToJson(const void* pObj, SJson* pJson) { if (TSDB_CODE_SUCCESS == code) { code = tjsonAddIntegerToObject(pJson, jkInterpFuncLogicPlanInterval, pNode->interval); } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonAddIntegerToObject(pJson, jkInterpFuncLogicPlanFillMode, pNode->fillMode); + } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonAddObject(pJson, jkInterpFuncLogicPlanFillValues, nodeToJson, pNode->pFillValues); + } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonAddObject(pJson, jkInterpFuncLogicPlanTimeSeries, nodeToJson, pNode->pTimeSeries); + } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonAddObject(pJson, jkInterpFuncLogicPlanStreamNodeOption, streamNodeOptionToJson, &pNode->streamNodeOption); + } return code; } @@ -1258,6 +1325,18 @@ static int32_t jsonToLogicInterpFuncNode(const SJson* pJson, void* pObj) { if (TSDB_CODE_SUCCESS == code) { code = tjsonGetBigIntValue(pJson, jkInterpFuncLogicPlanInterval, &pNode->interval); } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonGetTinyIntValue(pJson, jkInterpFuncLogicPlanFillMode, (int8_t*)&pNode->fillMode); + } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonToObject(pJson, jkInterpFuncLogicPlanFillValues, jsonToNode, pNode->pFillValues); + } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonToObject(pJson, jkInterpFuncLogicPlanTimeSeries, jsonToNode, pNode->pTimeSeries); + } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonToObject(pJson, jkInterpFuncLogicPlanStreamNodeOption, jsonToStreamNodeOption, &pNode->streamNodeOption); + } return code; } @@ -3135,6 +3214,7 @@ static const char* jkInterpFuncPhysiPlanInterval = "Interval"; static const char* jkInterpFuncPhysiPlanFillMode = "FillMode"; static const char* jkInterpFuncPhysiPlanFillValues = "FillValues"; static const char* jkInterpFuncPhysiPlanTimeSeries = "TimeSeries"; +static const char* jkInterpFuncPhysiPlanStreamNodeOption = "StreamNodeOption"; static int32_t physiInterpFuncNodeToJson(const void* pObj, SJson* pJson) { const SInterpFuncPhysiNode* pNode = (const SInterpFuncPhysiNode*)pObj; @@ -3164,6 +3244,9 @@ static int32_t physiInterpFuncNodeToJson(const void* pObj, SJson* pJson) { if (TSDB_CODE_SUCCESS == code) { code = tjsonAddObject(pJson, jkInterpFuncPhysiPlanTimeSeries, nodeToJson, pNode->pTimeSeries); } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonAddObject(pJson, jkInterpFuncPhysiPlanStreamNodeOption, streamNodeOptionToJson, &pNode->streamNodeOption); + } return code; } @@ -3196,6 +3279,9 @@ static int32_t jsonToPhysiInterpFuncNode(const SJson* pJson, void* pObj) { if (TSDB_CODE_SUCCESS == code) { code = jsonToNodeObject(pJson, jkInterpFuncPhysiPlanTimeSeries, &pNode->pTimeSeries); } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonToObject(pJson, jkInterpFuncPhysiPlanStreamNodeOption, jsonToStreamNodeOption, &pNode->streamNodeOption); + } return code; } diff --git a/source/libs/planner/src/planLogicCreater.c b/source/libs/planner/src/planLogicCreater.c index d3f328943c19..23e5d9c9028a 100644 --- a/source/libs/planner/src/planLogicCreater.c +++ b/source/libs/planner/src/planLogicCreater.c @@ -918,7 +918,7 @@ static bool isInterpFunc(int32_t funcId) { return fmIsInterpFunc(funcId) || fmIsInterpPseudoColumnFunc(funcId) || fmIsGroupKeyFunc(funcId) || fmisSelectGroupConstValueFunc(funcId); } -static void initStreamOption(SLogicPlanContext* pCxt, SStreamOption* pOption) { +static void initStreamOption(SLogicPlanContext* pCxt, SStreamNodeOption* pOption) { pOption->triggerType = pCxt->pPlanCxt->triggerType; pOption->watermark = pCxt->pPlanCxt->watermark; pOption->deleteMark = pCxt->pPlanCxt->deleteMark; @@ -969,7 +969,7 @@ static int32_t createInterpFuncLogicNode(SLogicPlanContext* pCxt, SSelectStmt* p } if (TSDB_CODE_SUCCESS == code) { - initStreamOption(pCxt, &pInterpFunc->streamOption); + initStreamOption(pCxt, &pInterpFunc->streamNodeOption); } if (TSDB_CODE_SUCCESS == code) { diff --git a/source/libs/planner/src/planPhysiCreater.c b/source/libs/planner/src/planPhysiCreater.c index ae28d44f1df9..26c971087695 100644 --- a/source/libs/planner/src/planPhysiCreater.c +++ b/source/libs/planner/src/planPhysiCreater.c @@ -1867,7 +1867,7 @@ static int32_t createInterpFuncPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pCh } if (pCxt->pPlanCxt->streamQuery) { - pInterpFunc->streamOption = pFuncLogicNode->streamOption; + pInterpFunc->streamNodeOption = pFuncLogicNode->streamNodeOption; } if (TSDB_CODE_SUCCESS == code) { From 23c8f8df3283dd71304637bf9600bac8cd550cb4 Mon Sep 17 00:00:00 2001 From: WANG Xu Date: Mon, 29 Jul 2024 17:15:11 +0800 Subject: [PATCH 014/695] Update docs/zh/14-reference/05-taosbenchmark.md fix typo --- docs/zh/14-reference/05-taosbenchmark.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/zh/14-reference/05-taosbenchmark.md b/docs/zh/14-reference/05-taosbenchmark.md index a6cc40c13460..373f15af94c1 100644 --- a/docs/zh/14-reference/05-taosbenchmark.md +++ b/docs/zh/14-reference/05-taosbenchmark.md @@ -367,7 +367,7 @@ taosBenchmark -A INT,DOUBLE,NCHAR,BINARY\(16\) - **max** : 数据类型的 列/标签 的最大值。生成的值将小于最小值。 -- **max** : 浮点数精度增强因子,仅当数据类型是float/double时生效,有效值范围为1至1000000的正整数。用于增强生成浮点数的精度,特别是在min或max值较小的情况下。此属性按10的幂次增强小数点后的精度:scalingFactor为10表示增强1位小数精度,100表示增强2位,依此类推。 +- **scalingFactor** : 浮点数精度增强因子,仅当数据类型是float/double时生效,有效值范围为1至1000000的正整数。用于增强生成浮点数的精度,特别是在min或max值较小的情况下。此属性按10的幂次增强小数点后的精度:scalingFactor为10表示增强1位小数精度,100表示增强2位,依此类推。 - **fun** : 此列数据以函数填充,目前只支持 sin 和 cos 两函数,输入参数为时间戳换算成角度值,换算公式: 角度 x = 输入的时间列ts值 % 360。同时支持系数调节,随机波动因子调节,以固定格式的表达式展现,如 fun=“10\*sin(x)+100\*random(5)” , x 表示角度,取值 0 ~ 360度,增长步长与时间列步长一致。10 表示乘的系数,100 表示加或减的系数,5 表示波动幅度在 5% 的随机范围内。目前支持的数据类型为 int, bigint, float, double 四种数据类型。注意:表达式为固定模式,不可前后颠倒。 From 3ff02561454c6a207df3b504eaae5632724ea257 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Tue, 30 Jul 2024 16:06:40 +0800 Subject: [PATCH 015/695] steam interp --- include/libs/nodes/plannodes.h | 5 +- include/libs/stream/tstreamFileState.h | 3 +- source/libs/executor/inc/executorInt.h | 102 +-- source/libs/executor/src/scanoperator.c | 119 +++- .../executor/src/streamtimesliceoperator.c | 638 ++++++++++++++---- source/libs/nodes/src/nodesCodeFuncs.c | 2 +- source/libs/planner/src/planLogicCreater.c | 2 + source/libs/planner/src/planPhysiCreater.c | 2 + source/libs/stream/src/streamSliceState.c | 38 +- source/libs/stream/src/streamState.c | 4 + source/libs/stream/src/tstreamFileState.c | 2 +- 11 files changed, 722 insertions(+), 195 deletions(-) diff --git a/include/libs/nodes/plannodes.h b/include/libs/nodes/plannodes.h index 509710707d0c..308dee14ddb2 100644 --- a/include/libs/nodes/plannodes.h +++ b/include/libs/nodes/plannodes.h @@ -208,6 +208,8 @@ typedef struct SInterpFuncLogicNode { SNodeList* pFuncs; STimeWindow timeRange; int64_t interval; + char intervalUnit; + int8_t precision; EFillMode fillMode; SNode* pFillValues; // SNodeListNode SNode* pTimeSeries; // SColumnNode @@ -511,7 +513,8 @@ typedef struct SInterpFuncPhysiNode { SNodeList* pFuncs; STimeWindow timeRange; int64_t interval; - int8_t intervalUnit; + char intervalUnit; + int8_t precision; EFillMode fillMode; SNode* pFillValues; // SNodeListNode SNode* pTimeSeries; // SColumnNode diff --git a/include/libs/stream/tstreamFileState.h b/include/libs/stream/tstreamFileState.h index 67e11e67f4ec..b19a7889902a 100644 --- a/include/libs/stream/tstreamFileState.h +++ b/include/libs/stream/tstreamFileState.h @@ -123,7 +123,7 @@ int32_t getSessionRowBuff(SStreamFileState* pFileState, void* pKey, int32_t keyL int32_t* pWinCode); int32_t getFunctionRowBuff(SStreamFileState* pFileState, void* pKey, int32_t keyLen, void** pVal, int32_t* pVLen); -// fill +// time slice int32_t getHashSortRowBuff(SStreamFileState* pFileState, const SWinKey* pKey, void** pVal, int32_t* pVLen); int32_t hashSortFileGetFn(SStreamFileState* pFileState, void* pKey, void** data, int32_t* pDataLen); int32_t hashSortFileRemoveFn(SStreamFileState* pFileState, const void* pKey); @@ -133,6 +133,7 @@ int32_t getHashSortNextRow(SStreamFileState* pFileState, const SWinKey* pKey, SW int32_t getHashSortPrevRow(SStreamFileState* pFileState, const SWinKey* pKey, SWinKey* pResKey, void** pVal, int32_t* pVLen); int32_t recoverFillSnapshot(SStreamFileState* pFileState, int64_t ckId); +void deleteHashSortRowBuff(SStreamFileState* pFileState, const SWinKey* pKey); #ifdef __cplusplus } diff --git a/source/libs/executor/inc/executorInt.h b/source/libs/executor/inc/executorInt.h index 7e0710b05aa3..00986674fb86 100644 --- a/source/libs/executor/inc/executorInt.h +++ b/source/libs/executor/inc/executorInt.h @@ -828,6 +828,7 @@ typedef struct SStreamTimeSliceOperatorInfo { bool destHasPrimaryKey; SArray* historyPoints; SArray* pUpdated; // SWinKey + SArray* historyWins; SSHashObj* pUpdatedMap; int32_t delIndex; SArray* pDelWins; // SWinKey @@ -835,6 +836,7 @@ typedef struct SStreamTimeSliceOperatorInfo { uint64_t numOfDatapack; SGroupResInfo groupResInfo; bool ignoreNull; + bool isHistoryOp; } SStreamTimeSliceOperatorInfo; #define OPTR_IS_OPENED(_optr) (((_optr)->status & OP_OPENED) == OP_OPENED) @@ -952,56 +954,56 @@ void copyResultrowToDataBlock(SExprInfo* pExprInfo, int32_t numOfExprs, SResultR void doUpdateNumOfRows(SqlFunctionCtx* pCtx, SResultRow* pRow, int32_t numOfExprs, const int32_t* rowEntryOffset); void doClearBufferedBlocks(SStreamScanInfo* pInfo); -void streamOpReleaseState(struct SOperatorInfo* pOperator); -void streamOpReloadState(struct SOperatorInfo* pOperator); -void destroyStreamAggSupporter(SStreamAggSupporter* pSup); -void clearGroupResInfo(SGroupResInfo* pGroupResInfo); -int32_t initBasicInfoEx(SOptrBasicInfo* pBasicInfo, SExprSupp* pSup, SExprInfo* pExprInfo, int32_t numOfCols, - SSDataBlock* pResultBlock, SFunctionStateStore* pStore); -int32_t initStreamAggSupporter(SStreamAggSupporter* pSup, SExprSupp* pExpSup, int32_t numOfOutput, int64_t gap, - SStreamState* pState, int32_t keySize, int16_t keyType, SStateStore* pStore, - SReadHandle* pHandle, STimeWindowAggSupp* pTwAggSup, const char* taskIdStr, - SStorageAPI* pApi, int32_t tsIndex); -int32_t initDownStream(struct SOperatorInfo* downstream, SStreamAggSupporter* pAggSup, uint16_t type, - int32_t tsColIndex, STimeWindowAggSupp* pTwSup, struct SSteamOpBasicInfo* pBasic); -int32_t getMaxTsWins(const SArray* pAllWins, SArray* pMaxWins); -void initGroupResInfoFromArrayList(SGroupResInfo* pGroupResInfo, SArray* pArrayList); -void getSessionHashKey(const SSessionKey* pKey, SSessionKey* pHashKey); -int32_t deleteSessionWinState(SStreamAggSupporter* pAggSup, SSDataBlock* pBlock, SSHashObj* pMapUpdate, - SSHashObj* pMapDelete, SSHashObj* pPkDelete, bool needAdd); -int32_t getAllSessionWindow(SSHashObj* pHashMap, SSHashObj* pStUpdated); -int32_t closeSessionWindow(SSHashObj* pHashMap, STimeWindowAggSupp* pTwSup, SSHashObj* pClosed); -int32_t copyUpdateResult(SSHashObj** ppWinUpdated, SArray* pUpdated, __compar_fn_t compar); -int32_t sessionKeyCompareAsc(const void* pKey1, const void* pKey2); -void removeSessionDeleteResults(SSHashObj* pHashMap, SArray* pWins); -int32_t doOneWindowAggImpl(SColumnInfoData* pTimeWindowData, SResultWindowInfo* pCurWin, SResultRow** pResult, - int32_t startIndex, int32_t winRows, int32_t rows, int32_t numOutput, - struct SOperatorInfo* pOperator, int64_t winDelta); -void setSessionWinOutputInfo(SSHashObj* pStUpdated, SResultWindowInfo* pWinInfo); -int32_t saveSessionOutputBuf(SStreamAggSupporter* pAggSup, SResultWindowInfo* pWinInfo); -int32_t saveResult(SResultWindowInfo winInfo, SSHashObj* pStUpdated); -int32_t saveDeleteRes(SSHashObj* pStDelete, SSessionKey key); -void removeSessionResult(SStreamAggSupporter* pAggSup, SSHashObj* pHashMap, SSHashObj* pResMap, SSessionKey* pKey); -void doBuildDeleteDataBlock(struct SOperatorInfo* pOp, SSHashObj* pStDeleted, SSDataBlock* pBlock, void** Ite); -void doBuildSessionResult(struct SOperatorInfo* pOperator, void* pState, SGroupResInfo* pGroupResInfo, - SSDataBlock* pBlock); -int32_t getSessionWindowInfoByKey(SStreamAggSupporter* pAggSup, SSessionKey* pKey, SResultWindowInfo* pWinInfo); -void getNextSessionWinInfo(SStreamAggSupporter* pAggSup, SSHashObj* pStUpdated, SResultWindowInfo* pCurWin, - SResultWindowInfo* pNextWin); -int32_t compactTimeWindow(SExprSupp* pSup, SStreamAggSupporter* pAggSup, STimeWindowAggSupp* pTwAggSup, - SExecTaskInfo* pTaskInfo, SResultWindowInfo* pCurWin, SResultWindowInfo* pNextWin, - SSHashObj* pStUpdated, SSHashObj* pStDeleted, bool addGap); -void releaseOutputBuf(void* pState, SRowBuffPos* pPos, SStateStore* pAPI); -void resetWinRange(STimeWindow* winRange); -bool checkExpiredData(SStateStore* pAPI, SUpdateInfo* pUpdateInfo, STimeWindowAggSupp* pTwSup, uint64_t tableId, - TSKEY ts, void* pPkVal, int32_t len); -int64_t getDeleteMark(SWindowPhysiNode* pWinPhyNode, int64_t interval); -void resetUnCloseSessionWinInfo(SSHashObj* winMap); -void setStreamOperatorCompleted(struct SOperatorInfo* pOperator); -void reloadAggSupFromDownStream(struct SOperatorInfo* downstream, SStreamAggSupporter* pAggSup); -void destroyFlusedPos(void* pRes); -bool isIrowtsPseudoColumn(SExprInfo* pExprInfo); -bool isIsfilledPseudoColumn(SExprInfo* pExprInfo); +void streamOpReleaseState(struct SOperatorInfo* pOperator); +void streamOpReloadState(struct SOperatorInfo* pOperator); +void destroyStreamAggSupporter(SStreamAggSupporter* pSup); +void clearGroupResInfo(SGroupResInfo* pGroupResInfo); +int32_t initBasicInfoEx(SOptrBasicInfo* pBasicInfo, SExprSupp* pSup, SExprInfo* pExprInfo, int32_t numOfCols, + SSDataBlock* pResultBlock, SFunctionStateStore* pStore); +int32_t initStreamAggSupporter(SStreamAggSupporter* pSup, SExprSupp* pExpSup, int32_t numOfOutput, int64_t gap, + SStreamState* pState, int32_t keySize, int16_t keyType, SStateStore* pStore, + SReadHandle* pHandle, STimeWindowAggSupp* pTwAggSup, const char* taskIdStr, + SStorageAPI* pApi, int32_t tsIndex); +int32_t initDownStream(struct SOperatorInfo* downstream, SStreamAggSupporter* pAggSup, uint16_t type, + int32_t tsColIndex, STimeWindowAggSupp* pTwSup, struct SSteamOpBasicInfo* pBasic); +int32_t getMaxTsWins(const SArray* pAllWins, SArray* pMaxWins); +void initGroupResInfoFromArrayList(SGroupResInfo* pGroupResInfo, SArray* pArrayList); +void getSessionHashKey(const SSessionKey* pKey, SSessionKey* pHashKey); +int32_t deleteSessionWinState(SStreamAggSupporter* pAggSup, SSDataBlock* pBlock, SSHashObj* pMapUpdate, + SSHashObj* pMapDelete, SSHashObj* pPkDelete, bool needAdd); +int32_t getAllSessionWindow(SSHashObj* pHashMap, SSHashObj* pStUpdated); +int32_t closeSessionWindow(SSHashObj* pHashMap, STimeWindowAggSupp* pTwSup, SSHashObj* pClosed); +int32_t copyUpdateResult(SSHashObj** ppWinUpdated, SArray* pUpdated, __compar_fn_t compar); +int32_t sessionKeyCompareAsc(const void* pKey1, const void* pKey2); +void removeSessionDeleteResults(SSHashObj* pHashMap, SArray* pWins); +int32_t doOneWindowAggImpl(SColumnInfoData* pTimeWindowData, SResultWindowInfo* pCurWin, SResultRow** pResult, + int32_t startIndex, int32_t winRows, int32_t rows, int32_t numOutput, + struct SOperatorInfo* pOperator, int64_t winDelta); +void setSessionWinOutputInfo(SSHashObj* pStUpdated, SResultWindowInfo* pWinInfo); +int32_t saveSessionOutputBuf(SStreamAggSupporter* pAggSup, SResultWindowInfo* pWinInfo); +int32_t saveResult(SResultWindowInfo winInfo, SSHashObj* pStUpdated); +int32_t saveDeleteRes(SSHashObj* pStDelete, SSessionKey key); +void removeSessionResult(SStreamAggSupporter* pAggSup, SSHashObj* pHashMap, SSHashObj* pResMap, SSessionKey* pKey); +void doBuildDeleteDataBlock(struct SOperatorInfo* pOp, SSHashObj* pStDeleted, SSDataBlock* pBlock, void** Ite); +void doBuildSessionResult(struct SOperatorInfo* pOperator, void* pState, SGroupResInfo* pGroupResInfo, + SSDataBlock* pBlock); +int32_t getSessionWindowInfoByKey(SStreamAggSupporter* pAggSup, SSessionKey* pKey, SResultWindowInfo* pWinInfo); +void getNextSessionWinInfo(SStreamAggSupporter* pAggSup, SSHashObj* pStUpdated, SResultWindowInfo* pCurWin, + SResultWindowInfo* pNextWin); +int32_t compactTimeWindow(SExprSupp* pSup, SStreamAggSupporter* pAggSup, STimeWindowAggSupp* pTwAggSup, + SExecTaskInfo* pTaskInfo, SResultWindowInfo* pCurWin, SResultWindowInfo* pNextWin, + SSHashObj* pStUpdated, SSHashObj* pStDeleted, bool addGap); +void releaseOutputBuf(void* pState, SRowBuffPos* pPos, SStateStore* pAPI); +void resetWinRange(STimeWindow* winRange); +bool checkExpiredData(SStateStore* pAPI, SUpdateInfo* pUpdateInfo, STimeWindowAggSupp* pTwSup, uint64_t tableId, + TSKEY ts, void* pPkVal, int32_t len); +int64_t getDeleteMark(SWindowPhysiNode* pWinPhyNode, int64_t interval); +void resetUnCloseSessionWinInfo(SSHashObj* winMap); +void setStreamOperatorCompleted(struct SOperatorInfo* pOperator); +void reloadAggSupFromDownStream(struct SOperatorInfo* downstream, SStreamAggSupporter* pAggSup); +void destroyFlusedPos(void* pRes); +bool isIrowtsPseudoColumn(SExprInfo* pExprInfo); +bool isIsfilledPseudoColumn(SExprInfo* pExprInfo); int32_t encodeSSessionKey(void** buf, SSessionKey* key); void* decodeSSessionKey(void* buf, SSessionKey* key); diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index a7ddd8f97a2f..61eda480b3b2 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -2065,9 +2065,117 @@ static int32_t generateCountScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSrcB return code; } -static int32_t generateTimeSliceScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSrcBlock, SSDataBlock* pDestBlock, EStreamType mode) { - // todo(liuyao) add code 获取delete range的左邻居和右邻居,作为range - return TSDB_CODE_SUCCESS; +void getTimeSliceWinRange(SStreamAggSupporter* pAggSup, SInterval* pInterval, TSKEY start, TSKEY end, int64_t groupId, + STimeWindow* pScanRange, STimeWindow* pDelRange) { + int32_t code = TSDB_CODE_SUCCESS; + SResultRowInfo dumyInfo = {0}; + dumyInfo.cur.pageId = -1; + STimeWindow sWin = getActiveTimeWindow(NULL, &dumyInfo, start, pInterval, TSDB_ORDER_ASC); + SWinKey startKey = {.groupId = groupId, .ts = sWin.skey}; + pDelRange->skey = sWin.skey; + + sWin = getActiveTimeWindow(NULL, &dumyInfo, end, pInterval, TSDB_ORDER_ASC); + SWinKey endKey = {.groupId = groupId, .ts = sWin.ekey}; + pDelRange->ekey = sWin.ekey; + + SWinKey preKey = {.groupId = groupId}; + code = pAggSup->stateStore.streamStateFillGetPrev(pAggSup->pState, &startKey, &preKey, NULL, NULL); + if (code == TSDB_CODE_SUCCESS) { + pScanRange->skey = preKey.ts; + } else { + pScanRange->skey = startKey.ts; + } + + SWinKey nextKey = {.groupId = groupId}; + code = pAggSup->stateStore.streamStateFillGetNext(pAggSup->pState, &endKey, &nextKey, NULL, NULL); + if (code == TSDB_CODE_SUCCESS) { + pScanRange->ekey = nextKey.ts; + } else { + pScanRange->ekey = endKey.ts; + } +} + +static int32_t generateTimeSliceScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSrcBlock, SSDataBlock* pDestBlock, + EStreamType mode) { + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; + blockDataCleanup(pDestBlock); + if (pSrcBlock->info.rows == 0) { + return TSDB_CODE_SUCCESS; + } + SExecTaskInfo* pTaskInfo = pInfo->pStreamScanOp->pTaskInfo; + SColumnInfoData* pStartTsCol = taosArrayGet(pSrcBlock->pDataBlock, START_TS_COLUMN_INDEX); + TSKEY* startData = (TSKEY*)pStartTsCol->pData; + SColumnInfoData* pEndTsCol = taosArrayGet(pSrcBlock->pDataBlock, END_TS_COLUMN_INDEX); + TSKEY* endData = (TSKEY*)pEndTsCol->pData; + SColumnInfoData* pUidCol = taosArrayGet(pSrcBlock->pDataBlock, UID_COLUMN_INDEX); + uint64_t* uidCol = (uint64_t*)pUidCol->pData; + SColumnInfoData* pGpCol = taosArrayGet(pSrcBlock->pDataBlock, GROUPID_COLUMN_INDEX); + uint64_t* pSrcGp = (uint64_t*)pGpCol->pData; + SColumnInfoData* pSrcPkCol = NULL; + if (taosArrayGetSize(pSrcBlock->pDataBlock) > PRIMARY_KEY_COLUMN_INDEX) { + pSrcPkCol = taosArrayGet(pSrcBlock->pDataBlock, PRIMARY_KEY_COLUMN_INDEX); + } + int64_t ver = pSrcBlock->info.version - 1; + + if (pInfo->partitionSup.needCalc && + (startData[0] != endData[0] || (hasPrimaryKeyCol(pInfo) && mode == STREAM_DELETE_DATA))) { + code = getPreVersionDataBlock(uidCol[0], startData[0], endData[0], ver, GET_TASKID(pTaskInfo), pInfo, pSrcBlock); + QUERY_CHECK_CODE(code, lino, _end); + startData = (TSKEY*)pStartTsCol->pData; + endData = (TSKEY*)pEndTsCol->pData; + uidCol = (uint64_t*)pUidCol->pData; + pSrcGp = (uint64_t*)pGpCol->pData; + } + + code = blockDataEnsureCapacity(pDestBlock, pSrcBlock->info.rows); + QUERY_CHECK_CODE(code, lino, _end); + + SColumnInfoData* pDestStartCol = taosArrayGet(pDestBlock->pDataBlock, START_TS_COLUMN_INDEX); + SColumnInfoData* pDestEndCol = taosArrayGet(pDestBlock->pDataBlock, END_TS_COLUMN_INDEX); + SColumnInfoData* pDestUidCol = taosArrayGet(pDestBlock->pDataBlock, UID_COLUMN_INDEX); + SColumnInfoData* pDestGpCol = taosArrayGet(pDestBlock->pDataBlock, GROUPID_COLUMN_INDEX); + SColumnInfoData* pDestCalStartTsCol = taosArrayGet(pDestBlock->pDataBlock, CALCULATE_START_TS_COLUMN_INDEX); + SColumnInfoData* pDestCalEndTsCol = taosArrayGet(pDestBlock->pDataBlock, CALCULATE_END_TS_COLUMN_INDEX); + for (int32_t i = 0; i < pSrcBlock->info.rows; i++) { + uint64_t groupId = pSrcGp[i]; + if (groupId == 0) { + void* pVal = NULL; + if (hasPrimaryKeyCol(pInfo) && pSrcPkCol) { + pVal = colDataGetData(pSrcPkCol, i); + } + groupId = getGroupIdByData(pInfo, uidCol[i], startData[i], ver, pVal); + } + + STimeWindow scanRange = {0}; + STimeWindow delRange = {0}; + ASSERT(mode == STREAM_DELETE_RESULT || mode == STREAM_DELETE_DATA); + getTimeSliceWinRange(pInfo->windowSup.pStreamAggSup, &pInfo->interval, startData[i], endData[i], groupId, &scanRange, &delRange); + + code = colDataSetVal(pDestStartCol, i, (const char*)&scanRange.skey, false); + QUERY_CHECK_CODE(code, lino, _end); + + code = colDataSetVal(pDestEndCol, i, (const char*)&scanRange.ekey, false); + QUERY_CHECK_CODE(code, lino, _end); + + colDataSetNULL(pDestUidCol, i); + code = colDataSetVal(pDestGpCol, i, (const char*)&groupId, false); + QUERY_CHECK_CODE(code, lino, _end); + + code = colDataSetVal(pDestCalStartTsCol, i, (const char*)&delRange.skey, false); + QUERY_CHECK_CODE(code, lino, _end); + + code = colDataSetVal(pDestCalEndTsCol, i, (const char*)&delRange.ekey, false); + QUERY_CHECK_CODE(code, lino, _end); + + pDestBlock->info.rows++; + } + +_end: + if (code != TSDB_CODE_SUCCESS) { + qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } + return code; } static int32_t generateIntervalScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSrcBlock, SSDataBlock* pDestBlock, @@ -3033,7 +3141,8 @@ static bool hasScanRange(SStreamScanInfo* pInfo) { } static bool isStreamWindow(SStreamScanInfo* pInfo) { - return isIntervalWindow(pInfo) || isSessionWindow(pInfo) || isStateWindow(pInfo) || isCountWindow(pInfo); + return isIntervalWindow(pInfo) || isSessionWindow(pInfo) || isStateWindow(pInfo) || isCountWindow(pInfo) || + isTimeSlice(pInfo); } static int32_t doStreamScanNext(SOperatorInfo* pOperator, SSDataBlock** ppRes) { @@ -4596,7 +4705,7 @@ int32_t createTagScanOperatorInfo(SReadHandle* pReadHandle, STagScanPhysiNode* p nodesRewriteExprPostOrder(&pTagCond, tagScanRewriteTagColumn, (void*)&pInfo->filterCtx); } } - //TODO wjm check pInfo->filterCtx.code + // TODO wjm check pInfo->filterCtx.code __optr_fn_t tagScanNextFn = (pTagScanNode->onlyMetaCtbIdx) ? doTagScanFromCtbIdx : doTagScanFromMetaEntry; pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, tagScanNextFn, NULL, destroyTagScanOperatorInfo, optrDefaultBufFn, NULL, optrDefaultGetNextExtFn, NULL); diff --git a/source/libs/executor/src/streamtimesliceoperator.c b/source/libs/executor/src/streamtimesliceoperator.c index 40ac0da3324e..883ab4609f6f 100644 --- a/source/libs/executor/src/streamtimesliceoperator.c +++ b/source/libs/executor/src/streamtimesliceoperator.c @@ -20,6 +20,7 @@ #include "querytask.h" #include "storageapi.h" #include "streamexecutorInt.h" +#include "tchecksum.h" #include "tcommon.h" #include "tcompare.h" #include "tdatablock.h" @@ -28,7 +29,7 @@ #define STREAM_TIME_SLICE_OP_STATE_NAME "StreamTimeSliceHistoryState" #define STREAM_TIME_SLICE_OP_CHECKPOINT_NAME "StreamTimeSliceOperator_Checkpoint" -#define HAS_NON_ROW_DATA(pRowData) (pRowData->key == INT64_MIN) +#define HAS_NON_ROW_DATA(pRowData) (pRowData == NULL || pRowData->key == INT64_MIN) typedef struct SSlicePoint { SWinKey key; @@ -37,12 +38,91 @@ typedef struct SSlicePoint { SRowBuffPos* pResPos; } SSlicePoint; +int32_t saveTimeSliceWinResult(SWinKey* pKey, SSHashObj* pUpdatedMap) { + return tSimpleHashPut(pUpdatedMap, pKey, sizeof(SWinKey), NULL, 0); +} + void streamTimeSliceReleaseState(SOperatorInfo* pOperator) { - // todo(liuyao) add + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; + SStreamTimeSliceOperatorInfo* pInfo = pOperator->info; + int32_t winSize = taosArrayGetSize(pInfo->historyWins) * sizeof(SWinKey); + int32_t resSize = winSize + sizeof(TSKEY); + char* pBuff = taosMemoryCalloc(1, resSize); + QUERY_CHECK_NULL(pBuff, code, lino, _end, terrno); + + memcpy(pBuff, pInfo->historyWins->pData, winSize); + memcpy(pBuff + winSize, &pInfo->twAggSup.maxTs, sizeof(TSKEY)); + qDebug("===stream=== time slice operator relase state. save result count:%d", + (int32_t)taosArrayGetSize(pInfo->historyWins)); + pInfo->streamAggSup.stateStore.streamStateSaveInfo(pInfo->streamAggSup.pState, STREAM_TIME_SLICE_OP_STATE_NAME, + strlen(STREAM_TIME_SLICE_OP_STATE_NAME), pBuff, resSize); + pInfo->streamAggSup.stateStore.streamStateCommit(pInfo->streamAggSup.pState); + taosMemoryFreeClear(pBuff); + + SOperatorInfo* downstream = pOperator->pDownstream[0]; + if (downstream->fpSet.releaseStreamStateFn) { + downstream->fpSet.releaseStreamStateFn(downstream); + } + +_end: + if (code != TSDB_CODE_SUCCESS) { + qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } } void streamTimeSliceReloadState(SOperatorInfo* pOperator) { - // todo(liuyao) add + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; + SStreamTimeSliceOperatorInfo* pInfo = pOperator->info; + SStreamAggSupporter* pAggSup = &pInfo->streamAggSup; + SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; + resetWinRange(&pAggSup->winRange); + + int32_t size = 0; + void* pBuf = NULL; + code = pAggSup->stateStore.streamStateGetInfo(pAggSup->pState, STREAM_TIME_SLICE_OP_STATE_NAME, + strlen(STREAM_TIME_SLICE_OP_STATE_NAME), &pBuf, &size); + QUERY_CHECK_CODE(code, lino, _end); + + int32_t num = (size - sizeof(TSKEY)) / sizeof(SWinKey); + qDebug("===stream=== time slice operator reload state. get result count:%d", num); + SWinKey* pKeyBuf = (SWinKey*)pBuf; + ASSERT(size == num * sizeof(SWinKey) + sizeof(TSKEY)); + + TSKEY ts = *(TSKEY*)((char*)pBuf + size - sizeof(TSKEY)); + pInfo->twAggSup.maxTs = TMAX(pInfo->twAggSup.maxTs, ts); + pAggSup->stateStore.streamStateReloadInfo(pAggSup->pState, ts); + + if (!pInfo->pUpdatedMap && num > 0) { + _hash_fn_t hashFn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY); + pInfo->pUpdatedMap = tSimpleHashInit(64, hashFn); + QUERY_CHECK_NULL(pInfo->pUpdatedMap, code, lino, _end, terrno); + } + if (!pInfo->pDeletedMap && num > 0) { + _hash_fn_t hashFn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY); + pInfo->pDeletedMap = tSimpleHashInit(64, hashFn); + QUERY_CHECK_NULL(pInfo->pDeletedMap, code, lino, _end, terrno); + } + for (int32_t i = 0; i < num; i++) { + SWinKey* pKey = pKeyBuf + i; + qDebug("===stream=== reload state. try process result %" PRId64 ", %" PRIu64 ", index:%d", pKey->ts, pKey->groupId, + i); + code = saveTimeSliceWinResult(pKey, pInfo->pUpdatedMap); + QUERY_CHECK_CODE(code, lino, _end); + } + taosMemoryFree(pBuf); + + SOperatorInfo* downstream = pOperator->pDownstream[0]; + if (downstream->fpSet.reloadStreamStateFn) { + downstream->fpSet.reloadStreamStateFn(downstream); + } + reloadAggSupFromDownStream(downstream, &pInfo->streamAggSup); + +_end: + if (code != TSDB_CODE_SUCCESS) { + qError("%s failed at line %d since %s. task:%s", __func__, lino, tstrerror(code), GET_TASKID(pTaskInfo)); + } } void destroyStreamTimeSliceOperatorInfo(void* param) { @@ -75,13 +155,165 @@ void destroyStreamTimeSliceOperatorInfo(void* param) { taosMemoryFreeClear(param); } +int32_t doStreamTimeSliceEncodeOpState(void** buf, int32_t len, SOperatorInfo* pOperator, int32_t* pLen) { + int32_t code = TSDB_CODE_SUCCESS; + SStreamTimeSliceOperatorInfo* pInfo = pOperator->info; + if (!pInfo) { + return TSDB_CODE_FAILED; + } + + void* pData = (buf == NULL) ? NULL : *buf; + + // 1.streamAggSup.pResultRows + int32_t tlen = 0; + int32_t mapSize = tSimpleHashGetSize(pInfo->streamAggSup.pResultRows); + tlen += taosEncodeFixedI32(buf, mapSize); + void* pIte = NULL; + size_t keyLen = 0; + int32_t iter = 0; + while ((pIte = tSimpleHashIterate(pInfo->streamAggSup.pResultRows, pIte, &iter)) != NULL) { + void* key = tSimpleHashGetKey(pIte, &keyLen); + tlen += encodeSSessionKey(buf, key); + tlen += encodeSResultWindowInfo(buf, pIte, pInfo->streamAggSup.resultRowSize); + } + + // 2.twAggSup + tlen += encodeSTimeWindowAggSupp(buf, &pInfo->twAggSup); + + // 3.checksum + if (buf) { + uint32_t cksum = taosCalcChecksum(0, pData, len - sizeof(uint32_t)); + tlen += taosEncodeFixedU32(buf, cksum); + } else { + tlen += sizeof(uint32_t); + } + + (*pLen) = tlen; + return code; +} + +int32_t doStreamTimeSliceDecodeOpState(void* buf, int32_t len, SOperatorInfo* pOperator) { + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; + SStreamTimeSliceOperatorInfo* pInfo = pOperator->info; + SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; + if (!pInfo) { + code = TSDB_CODE_FAILED; + QUERY_CHECK_CODE(code, lino, _end); + } + SStreamAggSupporter* pAggSup = &pInfo->streamAggSup; + + // 3.checksum + int32_t dataLen = len - sizeof(uint32_t); + void* pCksum = POINTER_SHIFT(buf, dataLen); + if (taosCheckChecksum(buf, dataLen, *(uint32_t*)pCksum) != TSDB_CODE_SUCCESS) { + qError("stream event state is invalid"); + code = TSDB_CODE_FAILED; + QUERY_CHECK_CODE(code, lino, _end); + } + + // 1.streamAggSup.pResultRows + int32_t mapSize = 0; + buf = taosDecodeFixedI32(buf, &mapSize); + for (int32_t i = 0; i < mapSize; i++) { + SResultWindowInfo winfo = {0}; + buf = decodeSSessionKey(buf, &winfo.sessionWin); + int32_t winCode = TSDB_CODE_SUCCESS; + code = pAggSup->stateStore.streamStateSessionAddIfNotExist( + pAggSup->pState, &winfo.sessionWin, pAggSup->gap, (void**)&winfo.pStatePos, &pAggSup->resultRowSize, &winCode); + QUERY_CHECK_CODE(code, lino, _end); + + buf = decodeSResultWindowInfo(buf, &winfo, pInfo->streamAggSup.resultRowSize); + code = tSimpleHashPut(pInfo->streamAggSup.pResultRows, &winfo.sessionWin, sizeof(SSessionKey), &winfo, + sizeof(SResultWindowInfo)); + QUERY_CHECK_CODE(code, lino, _end); + } + + // 2.twAggSup + buf = decodeSTimeWindowAggSupp(buf, &pInfo->twAggSup); + +_end: + if (code != TSDB_CODE_SUCCESS) { + qError("%s failed at line %d since %s. task:%s", __func__, lino, tstrerror(code), GET_TASKID(pTaskInfo)); + } + return code; +} + +static int32_t initTimeSliceFillSup(SStreamInterpFuncPhysiNode* pPhyFillNode, SExprInfo* pExprInfo, int32_t numOfExprs, + SStreamFillSupporter** ppResFillSup) { + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; + SStreamFillSupporter* pFillSup = taosMemoryCalloc(1, sizeof(SStreamFillSupporter)); + QUERY_CHECK_NULL(pFillSup, code, lino, _end, terrno); + + pFillSup->numOfFillCols = numOfExprs; + int32_t numOfNotFillCols = 0; + pFillSup->pAllColInfo = createFillColInfo(pExprInfo, pFillSup->numOfFillCols, NULL, numOfNotFillCols, + (const SNodeListNode*)(pPhyFillNode->pFillValues)); + QUERY_CHECK_NULL(pFillSup->pAllColInfo, code, lino, _end, terrno); + + pFillSup->type = convertFillType(pPhyFillNode->fillMode); + pFillSup->numOfAllCols = pFillSup->numOfFillCols + numOfNotFillCols; + pFillSup->interval.interval = pPhyFillNode->interval; + pFillSup->interval.intervalUnit = pPhyFillNode->intervalUnit; + pFillSup->interval.offset = 0; + pFillSup->interval.offsetUnit = pPhyFillNode->intervalUnit; + pFillSup->interval.precision = pPhyFillNode->precision; + pFillSup->interval.sliding = pPhyFillNode->interval; + pFillSup->interval.slidingUnit = pPhyFillNode->intervalUnit; + pFillSup->pAPI = NULL; + + code = initResultBuf(pFillSup); + QUERY_CHECK_CODE(code, lino, _end); + + pFillSup->pResMap = NULL; + pFillSup->hasDelete = false; + (*ppResFillSup) = pFillSup; + +_end: + if (code != TSDB_CODE_SUCCESS) { + destroyStreamFillSupporter(pFillSup); + qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } + return code; +} + static void doStreamTimeSliceSaveCheckpoint(SOperatorInfo* pOperator) { - // todo(liuyao) add + SStreamTimeSliceOperatorInfo* pInfo = pOperator->info; + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; + void* buf = NULL; + if (needSaveStreamOperatorInfo(&pInfo->basic)) { + int32_t len = 0; + code = doStreamTimeSliceEncodeOpState(NULL, 0, pOperator, &len); + QUERY_CHECK_CODE(code, lino, _end); + + buf = taosMemoryCalloc(1, len); + QUERY_CHECK_NULL(buf, code, lino, _end, terrno); + + void* pBuf = buf; + code = doStreamTimeSliceEncodeOpState(&pBuf, len, pOperator, &len); + QUERY_CHECK_CODE(code, lino, _end); + + pInfo->streamAggSup.stateStore.streamStateSaveInfo(pInfo->streamAggSup.pState, STREAM_TIME_SLICE_OP_CHECKPOINT_NAME, + strlen(STREAM_TIME_SLICE_OP_CHECKPOINT_NAME), buf, len); + saveStreamOperatorStateComplete(&pInfo->basic); + } + +_end: + taosMemoryFreeClear(buf); + if (code != TSDB_CODE_SUCCESS) { + qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } } -static bool fillPointResult(SStreamFillSupporter* pFillSup, SResultRowData* pResRow, TSKEY ts, SSDataBlock* pBlock) { +static int32_t fillPointResult(SStreamFillSupporter* pFillSup, SResultRowData* pResRow, TSKEY ts, SSDataBlock* pBlock, + bool* pRes) { + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; if (pBlock->info.rows >= pBlock->info.capacity) { - return false; + (*pRes) = false; + goto _end; } for (int32_t i = 0; i < pFillSup->numOfAllCols; i++) { SFillColInfo* pFillCol = pFillSup->pAllColInfo + i; @@ -89,33 +321,53 @@ static bool fillPointResult(SStreamFillSupporter* pFillSup, SResultRowData* pRes SColumnInfoData* pDstCol = taosArrayGet(pBlock->pDataBlock, dstSlotId); if (isIrowtsPseudoColumn(pFillCol->pExpr)) { - colDataSetVal(pDstCol, pBlock->info.rows, (char*)&ts, false); + code = colDataSetVal(pDstCol, pBlock->info.rows, (char*)&ts, false); + QUERY_CHECK_CODE(code, lino, _end); } else if (isIsfilledPseudoColumn(pFillCol->pExpr)) { bool isFilled = false; - colDataSetVal(pDstCol, pBlock->info.rows, (char*)&isFilled, false); + code = colDataSetVal(pDstCol, pBlock->info.rows, (char*)&isFilled, false); + QUERY_CHECK_CODE(code, lino, _end); } else { int32_t srcSlot = pFillCol->pExpr->base.pParam[0].pCol->slotId; SResultCellData* pCell = getResultCell(pResRow, srcSlot); - setRowCell(pDstCol, pBlock->info.rows, pCell); + code = setRowCell(pDstCol, pBlock->info.rows, pCell); + QUERY_CHECK_CODE(code, lino, _end); } } pBlock->info.rows += 1; - return true; + (*pRes) = true; + +_end: + if (code != TSDB_CODE_SUCCESS) { + qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } + return code; } static void fillNormalRange(SStreamFillSupporter* pFillSup, SStreamFillInfo* pFillInfo, SSDataBlock* pBlock) { + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; while (hasRemainCalc(pFillInfo) && pBlock->info.rows < pBlock->info.capacity) { STimeWindow st = {.skey = pFillInfo->current, .ekey = pFillInfo->current}; if (inWinRange(&pFillSup->winRange, &st)) { - fillPointResult(pFillSup, pFillInfo->pResRow, pFillInfo->current, pBlock); + bool res = true; + code = fillPointResult(pFillSup, pFillInfo->pResRow, pFillInfo->current, pBlock, &res); + QUERY_CHECK_CODE(code, lino, _end); } pFillInfo->current = taosTimeAdd(pFillInfo->current, pFillSup->interval.sliding, pFillSup->interval.slidingUnit, pFillSup->interval.precision); } + +_end: + if (code != TSDB_CODE_SUCCESS) { + qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } } static void fillLinearRange(SStreamFillSupporter* pFillSup, SStreamFillInfo* pFillInfo, SSDataBlock* pBlock) { + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; while (hasRemainCalc(pFillInfo) && pBlock->info.rows < pBlock->info.capacity) { for (int32_t i = 0; i < pFillSup->numOfAllCols; ++i) { SFillColInfo* pFillCol = pFillSup->pAllColInfo + i; @@ -126,10 +378,12 @@ static void fillLinearRange(SStreamFillSupporter* pFillSup, SStreamFillInfo* pFi SResultCellData* pCell = getResultCell(pFillInfo->pResRow, srcSlot); int32_t index = pBlock->info.rows; if (isIrowtsPseudoColumn(pFillCol->pExpr)) { - colDataSetVal(pDstCol, pBlock->info.rows, (char*)&pFillInfo->current, false); + code = colDataSetVal(pDstCol, pBlock->info.rows, (char*)&pFillInfo->current, false); + QUERY_CHECK_CODE(code, lino, _end); } else if (isIsfilledPseudoColumn(pFillCol->pExpr)) { bool isFilled = true; - colDataSetVal(pDstCol, pBlock->info.rows, (char*)&isFilled, false); + code = colDataSetVal(pDstCol, pBlock->info.rows, (char*)&isFilled, false); + QUERY_CHECK_CODE(code, lino, _end); } else { if (IS_VAR_DATA_TYPE(type) || type == TSDB_DATA_TYPE_BOOL || pCell->isNull) { colDataSetNULL(pDstCol, index); @@ -144,8 +398,12 @@ static void fillLinearRange(SStreamFillSupporter* pFillSup, SStreamFillInfo* pFi SPoint cur = {0}; cur.key = pFillInfo->current; cur.val = taosMemoryCalloc(1, pCell->bytes); + QUERY_CHECK_NULL(cur.val, code, lino, _end, terrno); + taosGetLinearInterpolationVal(&cur, pCell->type, &start, pEnd, pCell->type); - colDataSetVal(pDstCol, index, (const char*)cur.val, false); + code = colDataSetVal(pDstCol, index, (const char*)cur.val, false); + QUERY_CHECK_CODE(code, lino, _end); + destroySPoint(&cur); } } @@ -153,16 +411,27 @@ static void fillLinearRange(SStreamFillSupporter* pFillSup, SStreamFillInfo* pFi pFillSup->interval.precision); pBlock->info.rows++; } + +_end: + if (code != TSDB_CODE_SUCCESS) { + qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } } static void doStreamFillRange(SStreamFillSupporter* pFillSup, SStreamFillInfo* pFillInfo, SSDataBlock* pRes) { + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; + bool res = true; if (pFillInfo->needFill == false) { - fillPointResult(pFillSup, &pFillSup->cur, pFillSup->cur.key, pRes); + code = fillPointResult(pFillSup, &pFillSup->cur, pFillSup->cur.key, pRes, &res); + QUERY_CHECK_CODE(code, lino, _end); return; } if (pFillInfo->pos == FILL_POS_START) { - if (fillPointResult(pFillSup, &pFillSup->cur, pFillSup->cur.key, pRes)) { + code = fillPointResult(pFillSup, &pFillSup->cur, pFillSup->cur.key, pRes, &res); + QUERY_CHECK_CODE(code, lino, _end); + if (res) { pFillInfo->pos = FILL_POS_INVALID; } } @@ -172,7 +441,9 @@ static void doStreamFillRange(SStreamFillSupporter* pFillSup, SStreamFillInfo* p fillLinearRange(pFillSup, pFillInfo, pRes); if (pFillInfo->pos == FILL_POS_MID) { - if (fillPointResult(pFillSup, &pFillSup->cur, pFillSup->cur.key, pRes)) { + code = fillPointResult(pFillSup, &pFillSup->cur, pFillSup->cur.key, pRes, &res); + QUERY_CHECK_CODE(code, lino, _end); + if (res) { pFillInfo->pos = FILL_POS_INVALID; } } @@ -186,10 +457,17 @@ static void doStreamFillRange(SStreamFillSupporter* pFillSup, SStreamFillInfo* p } } if (pFillInfo->pos == FILL_POS_END) { - if (fillPointResult(pFillSup, &pFillSup->cur, pFillSup->cur.key, pRes)) { + code = fillPointResult(pFillSup, &pFillSup->cur, pFillSup->cur.key, pRes, &res); + QUERY_CHECK_CODE(code, lino, _end); + if (res) { pFillInfo->pos = FILL_POS_INVALID; } } + +_end: + if (code != TSDB_CODE_SUCCESS) { + qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } } static int32_t getQualifiedRowNumAsc(SExprSupp* pExprSup, SSDataBlock* pBlock, int32_t rowId, bool ignoreNull) { @@ -226,53 +504,59 @@ static int32_t getQualifiedRowNumDesc(SExprSupp* pExprSup, SSDataBlock* pBlock, return resRow; } -static void getPointRowDataFromState(SStreamAggSupporter* pAggSup, SStreamFillSupporter* pFillSup, - SSlicePoint* pPoint) { - int32_t curVLen = 0; - int32_t code = - pAggSup->stateStore.streamStateFillGet(pAggSup->pState, &pPoint->key, (void**)&pPoint->pResPos, &curVLen); - pPoint->pLeftRow = pPoint->pResPos->pRowBuff; - if (pFillSup->type == TSDB_FILL_LINEAR) { - pPoint->pRightRow = POINTER_SHIFT(pPoint->pResPos->pRowBuff, pFillSup->rowSize); - } else { - pPoint->pRightRow = NULL; - } -} - static void getPointInfoFromState(SStreamAggSupporter* pAggSup, SStreamFillSupporter* pFillSup, TSKEY ts, - int64_t groupId) { + int64_t groupId, SSlicePoint* pCurPoint, SSlicePoint* pPrevPoint, + SSlicePoint* pNextPoint) { void* pState = pAggSup->pState; resetPrevAndNextWindow(pFillSup); + pCurPoint->pResPos = NULL; + pPrevPoint->pResPos = NULL; + pNextPoint->pResPos = NULL; - SWinKey key = {.ts = ts, .groupId = groupId}; - void* curVal = NULL; + pCurPoint->key.groupId = groupId; + pCurPoint->key.ts = ts; int32_t curVLen = 0; - int32_t code = pAggSup->stateStore.streamStateFillGet(pState, &key, (void**)&curVal, &curVLen); - if (code == TSDB_CODE_SUCCESS) { - pFillSup->cur.key = key.ts; - pFillSup->cur.pRowVal = curVal; + int32_t code = pAggSup->stateStore.streamStateFillGet(pState, &pCurPoint->key, (void**)&pCurPoint->pResPos, &curVLen); + pCurPoint->pLeftRow = pCurPoint->pResPos->pRowBuff; + if (pFillSup->type == TSDB_FILL_LINEAR) { + pCurPoint->pRightRow = POINTER_SHIFT(pCurPoint->pResPos->pRowBuff, pFillSup->rowSize); } else { - qDebug("streamStateFillGet key failed, Data may be deleted. ts:%" PRId64 ", groupId:%" PRId64, ts, groupId); - pFillSup->cur.key = ts; - pFillSup->cur.pRowVal = NULL; + pCurPoint->pRightRow = NULL; } - SWinKey preKey = {.ts = INT64_MIN, .groupId = groupId}; - void* preVal = NULL; - int32_t preVLen = 0; - code = pAggSup->stateStore.streamStateFillGetPrev(pState, &key, &preKey, &preVal, &preVLen); - if (code == TSDB_CODE_SUCCESS) { - pFillSup->prev.key = preKey.ts; - pFillSup->prev.pRowVal = preVal; + if (pCurPoint->pLeftRow->key == pCurPoint->key.ts) { + pFillSup->cur.key = pCurPoint->key.ts; + pFillSup->cur.pRowVal = pCurPoint->pResPos->pRowBuff; } - SWinKey nextKey = {.ts = INT64_MIN, .groupId = groupId}; - void* nextVal = NULL; - int32_t nextVLen = 0; - code = pAggSup->stateStore.streamStateFillGetNext(pState, &key, &nextKey, &nextVal, &nextVLen); - if (code == TSDB_CODE_SUCCESS) { - pFillSup->next.key = nextKey.ts; - pFillSup->next.pRowVal = nextVal; + if (pPrevPoint) { + if (HAS_NON_ROW_DATA(pCurPoint->pLeftRow)) { + pPrevPoint->key.groupId = groupId; + int32_t preVLen = 0; + code = pAggSup->stateStore.streamStateFillGetPrev(pState, &pCurPoint->key, &pPrevPoint->key, + (void**)&pPrevPoint->pResPos, &preVLen); + if (code == TSDB_CODE_SUCCESS) { + pFillSup->prev.key = pPrevPoint->key.ts; + pFillSup->prev.pRowVal = pPrevPoint->pResPos->pRowBuff; + } + } else { + pFillSup->prev.key = pPrevPoint->pLeftRow->key; + pFillSup->prev.pRowVal = pPrevPoint->pLeftRow->pRowVal; + } + } + + if (HAS_NON_ROW_DATA(pCurPoint->pRightRow)) { + pNextPoint->key.groupId = groupId; + int32_t nextVLen = 0; + code = pAggSup->stateStore.streamStateFillGetNext(pState, &pCurPoint->key, &pNextPoint->key, + (void**)&pNextPoint->pResPos, &nextVLen); + if (code == TSDB_CODE_SUCCESS) { + pFillSup->next.key = pNextPoint->key.ts; + pFillSup->next.pRowVal = pNextPoint->pResPos->pRowBuff; + } + } else { + pFillSup->next.key = pCurPoint->pRightRow->key; + pFillSup->next.pRowVal = pCurPoint->pRightRow->pRowVal; } } @@ -460,36 +744,44 @@ static void doStreamTimeSliceImpl(SOperatorInfo* pOperator, SSDataBlock* pBlock) SResultRowInfo dumyInfo = {0}; dumyInfo.cur.pageId = -1; STimeWindow curWin = getActiveTimeWindow(NULL, &dumyInfo, tsCols[startPos], &pFillSup->interval, TSDB_ORDER_ASC); - SSlicePoint point = {.key.ts = curWin.skey, .key.groupId = groupId}; - getPointRowDataFromState(pAggSup, pFillSup, &point); - if (needAdjValue(&point, tsCols[startPos], true, pFillSup->type)) { - transBlockToResultRow(pBlock, startPos, tsCols[startPos], point.pLeftRow); - saveWinResult(&point.key, point.pResPos, pInfo->pUpdatedMap); + SSlicePoint curPoint = {.key.ts = curWin.skey, .key.groupId = groupId}; + SSlicePoint prevPoint = {0}; + SSlicePoint nextPoint = {0}; + bool left = false; + bool right = false; + getPointInfoFromState(pAggSup, pFillSup, curWin.skey, groupId, &curPoint, &prevPoint, &nextPoint); + right = needAdjValue(&curPoint, tsCols[startPos], false, pFillSup->type); + if (right) { + transBlockToResultRow(pBlock, startPos, tsCols[startPos], curPoint.pRightRow); + saveTimeSliceWinResult(&curPoint.key, pInfo->pUpdatedMap); } + releaseOutputBuf(pAggSup->pState, curPoint.pResPos, &pAggSup->stateStore); while (startPos < pBlock->info.rows) { int32_t numOfWin = getNumOfRowsInTimeWindow(&pBlock->info, tsCols, startPos, curWin.ekey, binarySearchForKey, NULL, TSDB_ORDER_ASC); startPos += numOfWin; int32_t leftRowId = getQualifiedRowNumDesc(pExprSup, pBlock, tsCols, startPos - 1, pInfo->ignoreNull); + left = needAdjValue(&nextPoint, tsCols[leftRowId], true, pFillSup->type); + if (left) { + transBlockToResultRow(pBlock, leftRowId, tsCols[leftRowId], nextPoint.pLeftRow); + saveTimeSliceWinResult(&nextPoint.key, pInfo->pUpdatedMap); + } + releaseOutputBuf(pAggSup->pState, nextPoint.pResPos, &pAggSup->stateStore); + startPos = getQualifiedRowNumAsc(pExprSup, pBlock, startPos, pInfo->ignoreNull); if (startPos < 0) { break; } curWin = getActiveTimeWindow(NULL, &dumyInfo, tsCols[startPos], &pFillSup->interval, TSDB_ORDER_ASC); - getPointInfoFromState(pAggSup, pFillSup, curWin.skey, groupId); - bool left = needAdjValue(&point, tsCols[leftRowId], true, pFillSup->type); - if (left) { - transBlockToResultRow(pBlock, leftRowId, tsCols[leftRowId], point.pLeftRow); - } - bool right = needAdjValue(&point, tsCols[startPos], false, pFillSup->type); - if (right) { - transBlockToResultRow(pBlock, startPos, tsCols[startPos], point.pRightRow); - } + getPointInfoFromState(pAggSup, pFillSup, curWin.skey, groupId, &curPoint, &prevPoint, &nextPoint); - if (left || right) { - saveWinResult(&point.key, point.pResPos, pInfo->pUpdatedMap); + right = needAdjValue(&curPoint, tsCols[startPos], false, pFillSup->type); + if (right) { + transBlockToResultRow(pBlock, startPos, tsCols[startPos], curPoint.pRightRow); + saveTimeSliceWinResult(&curPoint.key, pInfo->pUpdatedMap); } + releaseOutputBuf(pAggSup->pState, curPoint.pResPos, &pAggSup->stateStore); } } @@ -505,21 +797,28 @@ void doBuildTimeSlicePointResult(SStreamAggSupporter* pAggSup, SStreamFillSuppor int32_t numOfRows = getNumOfTotalRes(pGroupResInfo); for (; pGroupResInfo->index < numOfRows; pGroupResInfo->index++) { SRowBuffPos* pPos = *(SRowBuffPos**)taosArrayGet(pGroupResInfo->pRows, pGroupResInfo->index); - // todo(liuyao) fill 增加接口,get buff from pos设置pFillSup->cur - SWinKey* pKey = (SWinKey*)pPos->pKey; + SWinKey* pKey = (SWinKey*)pPos->pKey; if (pBlock->info.id.groupId == 0) { pBlock->info.id.groupId = pKey->groupId; } else if (pBlock->info.id.groupId != pKey->groupId) { pGroupResInfo->index--; break; } - getPointInfoFromState(pAggSup, pFillSup, pKey->ts, pKey->groupId); + SSlicePoint curPoint = {.key.ts = pKey->ts, .key.groupId = pKey->groupId}; + SSlicePoint prevPoint = {0}; + SSlicePoint nextPoint = {0}; + getPointInfoFromState(pAggSup, pFillSup, pKey->ts, pKey->groupId, &curPoint, &prevPoint, &nextPoint); setTimeSliceFillInfo(pFillSup, pFillInfo, pKey->ts); doStreamFillRange(pFillSup, pFillInfo, pBlock); + releaseOutputBuf(pAggSup->pState, curPoint.pResPos, &pAggSup->stateStore); + releaseOutputBuf(pAggSup->pState, prevPoint.pResPos, &pAggSup->stateStore); + releaseOutputBuf(pAggSup->pState, nextPoint.pResPos, &pAggSup->stateStore); } } -static SSDataBlock* buildTimeSliceResult(SOperatorInfo* pOperator) { +static int32_t buildTimeSliceResult(SOperatorInfo* pOperator, SSDataBlock** ppRes) { + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; SStreamTimeSliceOperatorInfo* pInfo = pOperator->info; SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; uint16_t opType = pOperator->operatorType; @@ -529,25 +828,97 @@ static SSDataBlock* buildTimeSliceResult(SOperatorInfo* pOperator) { if (pInfo->pDelRes->info.rows != 0) { // process the rest of the data printDataBlock(pInfo->pDelRes, getStreamOpName(opType), GET_TASKID(pTaskInfo)); - return pInfo->pDelRes; + (*ppRes) = pInfo->pDelRes; + goto _end; } doBuildTimeSlicePointResult(pAggSup, pInfo->pFillSup, pInfo->pFillInfo, pInfo->pRes, &pInfo->groupResInfo); if (pInfo->pRes->info.rows != 0) { printDataBlock(pInfo->pRes, getStreamOpName(opType), GET_TASKID(pTaskInfo)); - return pInfo->pRes; + (*ppRes) = pInfo->pRes; + goto _end; } - return NULL; + (*ppRes) = NULL; + +_end: + if (code != TSDB_CODE_SUCCESS) { + qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } + return code; } -static SSDataBlock* doStreamTimeSlice(SOperatorInfo* pOperator) { +int32_t getSliceMaxTsWins(const SArray* pAllWins, SArray* pMaxWins) { + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; + int32_t size = taosArrayGetSize(pAllWins); + if (size == 0) { + goto _end; + } + SWinKey* pKey = taosArrayGet(pAllWins, size - 1); + void* tmp = taosArrayPush(pMaxWins, pKey); + QUERY_CHECK_NULL(tmp, code, lino, _end, terrno); + + if (pKey->groupId == 0) { + goto _end; + } + uint64_t preGpId = pKey->groupId; + for (int32_t i = size - 2; i >= 0; i--) { + pKey = taosArrayGet(pAllWins, i); + if (preGpId != pKey->groupId) { + void* tmp = taosArrayPush(pMaxWins, pKey); + QUERY_CHECK_NULL(tmp, code, lino, _end, terrno); + preGpId = pKey->groupId; + } + } + +_end: + if (code != TSDB_CODE_SUCCESS) { + qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } + return code; +} + +static void doDeleteTimeSliceResult(SStreamAggSupporter* pAggSup, SSDataBlock* pBlock, SSHashObj* pUpdatedMap) { + int32_t winCode = TSDB_CODE_SUCCESS; + + SColumnInfoData* pGroupCol = taosArrayGet(pBlock->pDataBlock, GROUPID_COLUMN_INDEX); + uint64_t* groupIds = (uint64_t*)pGroupCol->pData; + SColumnInfoData* pCalStartCol = taosArrayGet(pBlock->pDataBlock, CALCULATE_START_TS_COLUMN_INDEX); + TSKEY* tsCalStarts = (TSKEY*)pCalStartCol->pData; + SColumnInfoData* pCalEndCol = taosArrayGet(pBlock->pDataBlock, CALCULATE_END_TS_COLUMN_INDEX); + TSKEY* tsCalEnds = (TSKEY*)pCalEndCol->pData; + for (int32_t i = 0; i < pBlock->info.rows; i++) { + while (1) { + TSKEY ts = tsCalStarts[i]; + TSKEY endTs = tsCalEnds[i]; + uint64_t groupId = groupIds[i]; + SWinKey key = {.ts = ts, .groupId = groupId}; + SWinKey nextKey = {.groupId = groupId}; + winCode = pAggSup->stateStore.streamStateFillGetNext(pAggSup->pState, &key, &nextKey, NULL, NULL); + if (key.ts > endTs) { + break; + } + (void)tSimpleHashRemove(pUpdatedMap, &key, sizeof(SWinKey)); + pAggSup->stateStore.streamStateDel(pAggSup->pState, &key); + if (winCode != TSDB_CODE_SUCCESS) { + break; + } + key = nextKey; + } + } +} + +static int32_t doStreamTimeSliceNext(SOperatorInfo* pOperator, SSDataBlock** ppRes) { + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; SStreamTimeSliceOperatorInfo* pInfo = pOperator->info; SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; SStreamAggSupporter* pAggSup = &pInfo->streamAggSup; if (pOperator->status == OP_EXEC_DONE) { - return NULL; + (*ppRes) = NULL; + goto _end; } if (pOperator->status == OP_RES_TO_RETURN) { @@ -557,23 +928,30 @@ static SSDataBlock* doStreamTimeSlice(SOperatorInfo* pOperator) { doStreamFillRange(pInfo->pFillSup, pInfo->pFillInfo, pInfo->pRes); if (pInfo->pRes->info.rows > 0) { printDataBlock(pInfo->pRes, getStreamOpName(pOperator->operatorType), GET_TASKID(pTaskInfo)); - return pInfo->pRes; + (*ppRes) = pInfo->pRes; + goto _end; } } - SSDataBlock* resBlock = buildTimeSliceResult(pOperator); + SSDataBlock* resBlock = NULL; + code = buildTimeSliceResult(pOperator, &resBlock); + QUERY_CHECK_CODE(code, lino, _end); + if (resBlock != NULL) { - return resBlock; + (*ppRes) = resBlock; + goto _end; } if (pInfo->recvCkBlock) { pInfo->recvCkBlock = false; printDataBlock(pInfo->pCheckpointRes, getStreamOpName(pOperator->operatorType), GET_TASKID(pTaskInfo)); - return pInfo->pCheckpointRes; + (*ppRes) = pInfo->pCheckpointRes; + goto _end; } setStreamOperatorCompleted(pOperator); - return NULL; + (*ppRes) = NULL; + goto _end; } SSDataBlock* fillResult = NULL; @@ -589,10 +967,11 @@ static SSDataBlock* doStreamTimeSlice(SOperatorInfo* pOperator) { } pInfo->numOfDatapack++; printSpecDataBlock(pBlock, getStreamOpName(pOperator->operatorType), "recv", GET_TASKID(pTaskInfo)); + setStreamOperatorState(&pInfo->basic, pBlock->info.type); switch (pBlock->info.type) { case STREAM_DELETE_RESULT: { - // todo(liuyao) add + doDeleteTimeSliceResult(pAggSup, pBlock, pInfo->pUpdatedMap); } break; case STREAM_NORMAL: case STREAM_INVALID: { @@ -610,7 +989,8 @@ static SSDataBlock* doStreamTimeSlice(SOperatorInfo* pOperator) { continue; } break; case STREAM_CREATE_CHILD_TABLE: { - return pBlock; + (*ppRes) = pBlock; + goto _end; } break; default: ASSERTS(false, "invalid SSDataBlock type"); @@ -628,53 +1008,38 @@ static SSDataBlock* doStreamTimeSlice(SOperatorInfo* pOperator) { void* pIte = NULL; int32_t iter = 0; while ((pIte = tSimpleHashIterate(pInfo->pUpdatedMap, pIte, &iter)) != NULL) { - taosArrayPush(pInfo->pUpdated, pIte); + void* tmp = taosArrayPush(pInfo->pUpdated, pIte); + QUERY_CHECK_NULL(tmp, code, lino, _end, terrno); + } + taosArraySort(pInfo->pUpdated, winKeyCmprImpl); + + if (pInfo->isHistoryOp) { + code = getSliceMaxTsWins(pInfo->pUpdated, pInfo->historyWins); + QUERY_CHECK_CODE(code, lino, _end); } - taosArraySort(pInfo->pUpdated, winPosCmprImpl); initMultiResInfoFromArrayList(&pInfo->groupResInfo, pInfo->pUpdated); pInfo->pUpdated = NULL; - blockDataEnsureCapacity(pInfo->pRes, pOperator->resultInfo.capacity); + code = blockDataEnsureCapacity(pInfo->pRes, pOperator->resultInfo.capacity); + QUERY_CHECK_CODE(code, lino, _end); + tSimpleHashCleanup(pInfo->pUpdatedMap); pInfo->pUpdatedMap = NULL; - return buildTimeSliceResult(pOperator); -} - -int32_t doStreamTimeSliceEncodeOpState(void** buf, int32_t len, SOperatorInfo* pOperator) { - // todo(liuyao) add - return 0; -} - -void* doStreamTimeSliceDecodeOpState(void* buf, int32_t len, SOperatorInfo* pOperator) { - // todo(liuyao) add - return NULL; -} - -static SStreamFillSupporter* initTimeSliceFillSup(SStreamInterpFuncPhysiNode* pPhyFillNode, SExprInfo* pExprInfo, - int32_t numOfExprs) { - SStreamFillSupporter* pFillSup = taosMemoryCalloc(1, sizeof(SStreamFillSupporter)); - if (!pFillSup) { - return NULL; - } - pFillSup->numOfFillCols = numOfExprs; - int32_t numOfNotFillCols = 0; - pFillSup->pAllColInfo = createFillColInfo(pExprInfo, pFillSup->numOfFillCols, NULL, numOfNotFillCols, - (const SNodeListNode*)(pPhyFillNode->pFillValues)); - pFillSup->type = convertFillType(pPhyFillNode->fillMode); - pFillSup->numOfAllCols = pFillSup->numOfFillCols + numOfNotFillCols; - pFillSup->interval.interval = pPhyFillNode->interval; - // todo(liuyao) 初始化 pFillSup->interval其他属性 - pFillSup->pAPI = NULL; + code = buildTimeSliceResult(pOperator, ppRes); + QUERY_CHECK_CODE(code, lino, _end); - int32_t code = initResultBuf(pFillSup); +_end: if (code != TSDB_CODE_SUCCESS) { - destroyStreamFillSupporter(pFillSup); - return NULL; + qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); } - pFillSup->pResMap = NULL; - pFillSup->hasDelete = false; - return pFillSup; + return code; +} + +static SSDataBlock* doStreamTimeSlice(SOperatorInfo* pOperator) { + SSDataBlock* pRes = NULL; + (void)doStreamTimeSliceNext(pOperator, &pRes); + return pRes; } int32_t createStreamTimeSliceOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo, @@ -682,10 +1047,11 @@ int32_t createStreamTimeSliceOperatorInfo(SOperatorInfo* downstream, SPhysiNode* int32_t code = TSDB_CODE_SUCCESS; int32_t lino = 0; SStreamTimeSliceOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SStreamTimeSliceOperatorInfo)); - SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); - if (pOperator == NULL || pInfo == NULL) { - goto _error; - } + QUERY_CHECK_NULL(pInfo, code, lino, _error, terrno); + + SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); + QUERY_CHECK_NULL(pOperator, code, lino, _error, terrno); + SStreamInterpFuncPhysiNode* pInterpPhyNode = (SStreamInterpFuncPhysiNode*)pPhyNode; pOperator->pTaskInfo = pTaskInfo; initResultSizeInfo(&pOperator->resultInfo, 4096); @@ -724,12 +1090,15 @@ int32_t createStreamTimeSliceOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pInfo->pRes = createDataBlockFromDescNode(pPhyNode->pOutputDataBlockDesc); pInfo->delIndex = 0; pInfo->pDelWins = taosArrayInit(4, sizeof(SWinKey)); + QUERY_CHECK_NULL(pInfo->pDelWins, code, lino, _error, terrno); + pInfo->pDelRes = NULL; code = createSpecialDataBlock(STREAM_DELETE_RESULT, &pInfo->pDelRes); QUERY_CHECK_CODE(code, lino, _error); _hash_fn_t hashFn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY); - pInfo->pDeletedMap = tSimpleHashInit(4096, hashFn); + pInfo->pDeletedMap = tSimpleHashInit(1024, hashFn); + QUERY_CHECK_NULL(pInfo->pDeletedMap, code, lino, _error, terrno); pInfo->ignoreExpiredData = pInterpPhyNode->streamNodeOption.igExpired; pInfo->ignoreExpiredDataSaved = false; @@ -745,7 +1114,13 @@ int32_t createStreamTimeSliceOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pInfo->destHasPrimaryKey = pInterpPhyNode->streamNodeOption.destHasPrimaryKey; pInfo->numOfDatapack = 0; - pInfo->pFillSup = initTimeSliceFillSup(pInterpPhyNode, pExprInfo, numOfExprs); + pInfo->pFillSup = NULL; + code = initTimeSliceFillSup(pInterpPhyNode, pExprInfo, numOfExprs, &pInfo->pFillSup); + QUERY_CHECK_CODE(code, lino, _error); + + if (pHandle) { + pInfo->isHistoryOp = pHandle->fillHistory; + } pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERP_FUNC; setOperatorInfo(pOperator, getStreamOpName(pOperator->operatorType), QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERP_FUNC, @@ -757,8 +1132,9 @@ int32_t createStreamTimeSliceOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pTaskInfo->streamInfo.pState, STREAM_TIME_SLICE_OP_CHECKPOINT_NAME, strlen(STREAM_TIME_SLICE_OP_CHECKPOINT_NAME), &buff, &len); if (res == TSDB_CODE_SUCCESS) { - doStreamTimeSliceDecodeOpState(buff, len, pOperator); + code = doStreamTimeSliceDecodeOpState(buff, len, pOperator); taosMemoryFree(buff); + QUERY_CHECK_CODE(code, lino, _error); } pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, doStreamTimeSlice, NULL, destroyStreamTimeSliceOperatorInfo, optrDefaultBufFn, NULL, optrDefaultGetNextExtFn, NULL); diff --git a/source/libs/nodes/src/nodesCodeFuncs.c b/source/libs/nodes/src/nodesCodeFuncs.c index 0b3dcdea8d60..308186f2c71c 100644 --- a/source/libs/nodes/src/nodesCodeFuncs.c +++ b/source/libs/nodes/src/nodesCodeFuncs.c @@ -1332,7 +1332,7 @@ static int32_t jsonToLogicInterpFuncNode(const SJson* pJson, void* pObj) { code = tjsonToObject(pJson, jkInterpFuncLogicPlanFillValues, jsonToNode, pNode->pFillValues); } if (TSDB_CODE_SUCCESS == code) { - code = tjsonToObject(pJson, jkInterpFuncLogicPlanTimeSeries, jsonToNode, pNode->pTimeSeries); + code = jsonToNodeObject(pJson, jkInterpFuncLogicPlanTimeSeries, &pNode->pTimeSeries); } if (TSDB_CODE_SUCCESS == code) { code = tjsonToObject(pJson, jkInterpFuncLogicPlanStreamNodeOption, jsonToStreamNodeOption, &pNode->streamNodeOption); diff --git a/source/libs/planner/src/planLogicCreater.c b/source/libs/planner/src/planLogicCreater.c index 23e5d9c9028a..42609c9a13da 100644 --- a/source/libs/planner/src/planLogicCreater.c +++ b/source/libs/planner/src/planLogicCreater.c @@ -961,6 +961,8 @@ static int32_t createInterpFuncLogicNode(SLogicPlanContext* pCxt, SSelectStmt* p if (TSDB_CODE_SUCCESS == code && NULL != pSelect->pEvery) { pInterpFunc->interval = ((SValueNode*)pSelect->pEvery)->datum.i; + pInterpFunc->intervalUnit = ((SValueNode*)pSelect->pEvery)->unit; + pInterpFunc->precision = pSelect->precision; } // set the output diff --git a/source/libs/planner/src/planPhysiCreater.c b/source/libs/planner/src/planPhysiCreater.c index 26c971087695..9ab10208fc7c 100644 --- a/source/libs/planner/src/planPhysiCreater.c +++ b/source/libs/planner/src/planPhysiCreater.c @@ -1851,6 +1851,8 @@ static int32_t createInterpFuncPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pCh pInterpFunc->timeRange = pFuncLogicNode->timeRange; pInterpFunc->interval = pFuncLogicNode->interval; pInterpFunc->fillMode = pFuncLogicNode->fillMode; + pInterpFunc->intervalUnit = pFuncLogicNode->intervalUnit; + pInterpFunc->precision = pFuncLogicNode->node.precision; pInterpFunc->pFillValues = NULL; code = nodesCloneNode(pFuncLogicNode->pFillValues, &pInterpFunc->pFillValues); if (TSDB_CODE_SUCCESS != code) { diff --git a/source/libs/stream/src/streamSliceState.c b/source/libs/stream/src/streamSliceState.c index a5de73095ef2..3a843a881f84 100644 --- a/source/libs/stream/src/streamSliceState.c +++ b/source/libs/stream/src/streamSliceState.c @@ -30,6 +30,7 @@ int fillStateKeyCompare(const void* pWin1, const void* pDatas, int pos) { int32_t getHashSortRowBuff(SStreamFileState* pFileState, const SWinKey* pKey, void** pVal, int32_t* pVLen) { int32_t winCode = TSDB_CODE_SUCCESS; int32_t code = getRowBuff(pFileState, (void*)pKey, sizeof(SWinKey), pVal, pVLen, &winCode); + SArray* pWinStates = NULL; SSHashObj* pSearchBuff = getSearchBuff(pFileState); void** ppBuff = tSimpleHashGet(pSearchBuff, &pKey->groupId, sizeof(uint64_t)); @@ -39,16 +40,18 @@ int32_t getHashSortRowBuff(SStreamFileState* pFileState, const SWinKey* pKey, vo pWinStates = taosArrayInit(16, sizeof(SWinKey)); tSimpleHashPut(pSearchBuff, &pKey->groupId, sizeof(uint64_t), &pWinStates, POINTER_BYTES); } + + //recover if (taosArrayGetSize(pWinStates) == 0 && needClearDiskBuff(pFileState)) { TSKEY ts = getFlushMark(pFileState); SWinKey start = {.groupId = pKey->groupId, .ts = INT64_MAX}; void* pState = getStateFileStore(pFileState); SStreamStateCur* pCur = streamStateFillSeekKeyPrev_rocksdb(pState, &start); - int32_t code = TSDB_CODE_SUCCESS; - for(int32_t i = 0; i < NUM_OF_FLUSED_WIN && code == TSDB_CODE_SUCCESS; i++) { + int32_t winCode = TSDB_CODE_SUCCESS; + for(int32_t i = 0; i < NUM_OF_FLUSED_WIN && winCode == TSDB_CODE_SUCCESS; i++) { SWinKey tmp = {.groupId = pKey->groupId}; - code = streamStateGetGroupKVByCur_rocksdb(pCur, &tmp, NULL, 0); - if (code != TSDB_CODE_SUCCESS) { + winCode = streamStateGetGroupKVByCur_rocksdb(pCur, &tmp, NULL, 0); + if (winCode != TSDB_CODE_SUCCESS) { break; } taosArrayPush(pWinStates, &tmp); @@ -65,7 +68,10 @@ int32_t getHashSortRowBuff(SStreamFileState* pFileState, const SWinKey* pKey, vo if (index == -1) { index = 0; } - taosArrayInsert(pWinStates, index, pKey); + SWinKey* pTmpKey = taosArrayGet(pWinStates, index); + if (winKeyCmprImpl(pTmpKey, pKey) != 0) { + taosArrayInsert(pWinStates, index, pKey); + } } return code; } @@ -163,3 +169,25 @@ int32_t getHashSortPrevRow(SStreamFileState* pFileState, const SWinKey* pKey, SW return TSDB_CODE_FAILED; } +void deleteHashSortRowBuff(SStreamFileState* pFileState, const SWinKey* pKey) { + deleteRowBuff(pFileState, pKey, sizeof(SWinKey)); + SSHashObj* pSearchBuff = getSearchBuff(pFileState); + void** ppBuff = tSimpleHashGet(pSearchBuff, &pKey->groupId, sizeof(uint64_t)); + if (!ppBuff) { + return; + } + SArray* pWinStates = *ppBuff; + int32_t size = taosArrayGetSize(pWinStates); + if (!isFlushedState(pFileState, pKey->ts, 0)) { + // find the first position which is smaller than the pKey + int32_t index = binarySearch(pWinStates, size, pKey, fillStateKeyCompare); + if (index == -1) { + index = 0; + } + SWinKey* pTmpKey = taosArrayGet(pWinStates, index); + if (winKeyCmprImpl(pTmpKey, pKey) == 0) { + taosArrayRemove(pWinStates, index); + } + } +} + diff --git a/source/libs/stream/src/streamState.c b/source/libs/stream/src/streamState.c index 6b20bd346a22..8139520e9773 100644 --- a/source/libs/stream/src/streamState.c +++ b/source/libs/stream/src/streamState.c @@ -249,6 +249,10 @@ int32_t streamStateFillGetPrev(SStreamState* pState, const SWinKey* pKey, SWinKe // todo refactor void streamStateFillDel(SStreamState* pState, const SWinKey* key) { + if (pState->pFileState) { + deleteHashSortRowBuff(pState->pFileState, key); + return; + } int32_t code = streamStateFillDel_rocksdb(pState, key); qTrace("%s at line %d res %d", __func__, __LINE__, code); } diff --git a/source/libs/stream/src/tstreamFileState.c b/source/libs/stream/src/tstreamFileState.c index 92684a0e363f..8298f9073634 100644 --- a/source/libs/stream/src/tstreamFileState.c +++ b/source/libs/stream/src/tstreamFileState.c @@ -574,7 +574,7 @@ int32_t getRowBuff(SStreamFileState* pFileState, void* pKey, int32_t keyLen, voi if (!isDeteled(pFileState, ts) && isFlushedState(pFileState, ts, 0)) { int32_t len = 0; void* p = NULL; - (*pWinCode) = pFileState->stateFileGetFn(pFileState->pFileStore, pKey, &p, &len); + (*pWinCode) = pFileState->stateFileGetFn(pFileState, pKey, &p, &len); qDebug("===stream===get %" PRId64 " from disc, res %d", ts, (*pWinCode)); if ((*pWinCode) == TSDB_CODE_SUCCESS) { memcpy(pNewPos->pRowBuff, p, len); From 745f14d140dab40b50a3352e921b79bc86f660e5 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Wed, 31 Jul 2024 08:57:42 +0800 Subject: [PATCH 016/695] stream interp --- source/libs/executor/src/executor.c | 16 +++++ .../executor/src/streamtimesliceoperator.c | 59 +++++++++++++------ source/libs/parser/src/parTranslater.c | 28 ++++++--- 3 files changed, 75 insertions(+), 28 deletions(-) diff --git a/source/libs/executor/src/executor.c b/source/libs/executor/src/executor.c index 3ee08d8fb0b0..bb2da006570f 100644 --- a/source/libs/executor/src/executor.c +++ b/source/libs/executor/src/executor.c @@ -1096,6 +1096,22 @@ int32_t qSetStreamOperatorOptionForScanHistory(qTaskInfo_t tinfo) { qInfo("save stream param for state: %d, %" PRId64, pSup->calTrigger, pSup->deleteMark); + pSup->calTriggerSaved = pSup->calTrigger; + pSup->deleteMarkSaved = pSup->deleteMark; + pSup->calTrigger = STREAM_TRIGGER_AT_ONCE; + pSup->deleteMark = INT64_MAX; + pInfo->ignoreExpiredDataSaved = pInfo->ignoreExpiredData; + pInfo->ignoreExpiredData = false; + qInfo("save stream task:%s, param for state: %d", GET_TASKID(pTaskInfo), pInfo->ignoreExpiredData); + } else if (type == QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERP_FUNC) { + SStreamTimeSliceOperatorInfo* pInfo = pOperator->info; + STimeWindowAggSupp* pSup = &pInfo->twAggSup; + + ASSERT(pSup->calTrigger == STREAM_TRIGGER_AT_ONCE || pSup->calTrigger == STREAM_TRIGGER_WINDOW_CLOSE); + ASSERT(pSup->calTriggerSaved == 0 && pSup->deleteMarkSaved == 0); + + qInfo("save stream param for state: %d, %" PRId64, pSup->calTrigger, pSup->deleteMark); + pSup->calTriggerSaved = pSup->calTrigger; pSup->deleteMarkSaved = pSup->deleteMark; pSup->calTrigger = STREAM_TRIGGER_AT_ONCE; diff --git a/source/libs/executor/src/streamtimesliceoperator.c b/source/libs/executor/src/streamtimesliceoperator.c index 883ab4609f6f..f49e45457c6c 100644 --- a/source/libs/executor/src/streamtimesliceoperator.c +++ b/source/libs/executor/src/streamtimesliceoperator.c @@ -99,11 +99,7 @@ void streamTimeSliceReloadState(SOperatorInfo* pOperator) { pInfo->pUpdatedMap = tSimpleHashInit(64, hashFn); QUERY_CHECK_NULL(pInfo->pUpdatedMap, code, lino, _end, terrno); } - if (!pInfo->pDeletedMap && num > 0) { - _hash_fn_t hashFn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY); - pInfo->pDeletedMap = tSimpleHashInit(64, hashFn); - QUERY_CHECK_NULL(pInfo->pDeletedMap, code, lino, _end, terrno); - } + for (int32_t i = 0; i < num; i++) { SWinKey* pKey = pKeyBuf + i; qDebug("===stream=== reload state. try process result %" PRId64 ", %" PRIu64 ", index:%d", pKey->ts, pKey->groupId, @@ -506,8 +502,9 @@ static int32_t getQualifiedRowNumDesc(SExprSupp* pExprSup, SSDataBlock* pBlock, static void getPointInfoFromState(SStreamAggSupporter* pAggSup, SStreamFillSupporter* pFillSup, TSKEY ts, int64_t groupId, SSlicePoint* pCurPoint, SSlicePoint* pPrevPoint, - SSlicePoint* pNextPoint) { - void* pState = pAggSup->pState; + SSlicePoint* pNextPoint, int32_t* pWinCode) { + int32_t tmpRes = TSDB_CODE_SUCCESS; + void* pState = pAggSup->pState; resetPrevAndNextWindow(pFillSup); pCurPoint->pResPos = NULL; pPrevPoint->pResPos = NULL; @@ -516,7 +513,7 @@ static void getPointInfoFromState(SStreamAggSupporter* pAggSup, SStreamFillSuppo pCurPoint->key.groupId = groupId; pCurPoint->key.ts = ts; int32_t curVLen = 0; - int32_t code = pAggSup->stateStore.streamStateFillGet(pState, &pCurPoint->key, (void**)&pCurPoint->pResPos, &curVLen); + (*pWinCode) = pAggSup->stateStore.streamStateFillGet(pState, &pCurPoint->key, (void**)&pCurPoint->pResPos, &curVLen); pCurPoint->pLeftRow = pCurPoint->pResPos->pRowBuff; if (pFillSup->type == TSDB_FILL_LINEAR) { pCurPoint->pRightRow = POINTER_SHIFT(pCurPoint->pResPos->pRowBuff, pFillSup->rowSize); @@ -533,9 +530,9 @@ static void getPointInfoFromState(SStreamAggSupporter* pAggSup, SStreamFillSuppo if (HAS_NON_ROW_DATA(pCurPoint->pLeftRow)) { pPrevPoint->key.groupId = groupId; int32_t preVLen = 0; - code = pAggSup->stateStore.streamStateFillGetPrev(pState, &pCurPoint->key, &pPrevPoint->key, - (void**)&pPrevPoint->pResPos, &preVLen); - if (code == TSDB_CODE_SUCCESS) { + tmpRes = pAggSup->stateStore.streamStateFillGetPrev(pState, &pCurPoint->key, &pPrevPoint->key, + (void**)&pPrevPoint->pResPos, &preVLen); + if (tmpRes == TSDB_CODE_SUCCESS) { pFillSup->prev.key = pPrevPoint->key.ts; pFillSup->prev.pRowVal = pPrevPoint->pResPos->pRowBuff; } @@ -548,9 +545,9 @@ static void getPointInfoFromState(SStreamAggSupporter* pAggSup, SStreamFillSuppo if (HAS_NON_ROW_DATA(pCurPoint->pRightRow)) { pNextPoint->key.groupId = groupId; int32_t nextVLen = 0; - code = pAggSup->stateStore.streamStateFillGetNext(pState, &pCurPoint->key, &pNextPoint->key, - (void**)&pNextPoint->pResPos, &nextVLen); - if (code == TSDB_CODE_SUCCESS) { + tmpRes = pAggSup->stateStore.streamStateFillGetNext(pState, &pCurPoint->key, &pNextPoint->key, + (void**)&pNextPoint->pResPos, &nextVLen); + if (tmpRes == TSDB_CODE_SUCCESS) { pFillSup->next.key = pNextPoint->key.ts; pFillSup->next.pRowVal = pNextPoint->pResPos->pRowBuff; } @@ -696,6 +693,7 @@ static bool needAdjValue(SSlicePoint* pPoint, TSKEY ts, bool isLeft, int32_t fil } static void doStreamTimeSliceImpl(SOperatorInfo* pOperator, SSDataBlock* pBlock) { + int32_t winCode = TSDB_CODE_SUCCESS; SStreamTimeSliceOperatorInfo* pInfo = (SStreamTimeSliceOperatorInfo*)pOperator->info; SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; SStreamAggSupporter* pAggSup = &pInfo->streamAggSup; @@ -749,11 +747,14 @@ static void doStreamTimeSliceImpl(SOperatorInfo* pOperator, SSDataBlock* pBlock) SSlicePoint nextPoint = {0}; bool left = false; bool right = false; - getPointInfoFromState(pAggSup, pFillSup, curWin.skey, groupId, &curPoint, &prevPoint, &nextPoint); + getPointInfoFromState(pAggSup, pFillSup, curWin.skey, groupId, &curPoint, &prevPoint, &nextPoint, &winCode); right = needAdjValue(&curPoint, tsCols[startPos], false, pFillSup->type); if (right) { transBlockToResultRow(pBlock, startPos, tsCols[startPos], curPoint.pRightRow); saveTimeSliceWinResult(&curPoint.key, pInfo->pUpdatedMap); + if (pInfo->destHasPrimaryKey && winCode == TSDB_CODE_SUCCESS) { + saveTimeSliceWinResult(&curPoint.key, pInfo->pDeletedMap); + } } releaseOutputBuf(pAggSup->pState, curPoint.pResPos, &pAggSup->stateStore); @@ -766,6 +767,9 @@ static void doStreamTimeSliceImpl(SOperatorInfo* pOperator, SSDataBlock* pBlock) if (left) { transBlockToResultRow(pBlock, leftRowId, tsCols[leftRowId], nextPoint.pLeftRow); saveTimeSliceWinResult(&nextPoint.key, pInfo->pUpdatedMap); + if (pInfo->destHasPrimaryKey && winCode == TSDB_CODE_SUCCESS) { + saveTimeSliceWinResult(&curPoint.key, pInfo->pDeletedMap); + } } releaseOutputBuf(pAggSup->pState, nextPoint.pResPos, &pAggSup->stateStore); @@ -774,12 +778,15 @@ static void doStreamTimeSliceImpl(SOperatorInfo* pOperator, SSDataBlock* pBlock) break; } curWin = getActiveTimeWindow(NULL, &dumyInfo, tsCols[startPos], &pFillSup->interval, TSDB_ORDER_ASC); - getPointInfoFromState(pAggSup, pFillSup, curWin.skey, groupId, &curPoint, &prevPoint, &nextPoint); + getPointInfoFromState(pAggSup, pFillSup, curWin.skey, groupId, &curPoint, &prevPoint, &nextPoint, &winCode); right = needAdjValue(&curPoint, tsCols[startPos], false, pFillSup->type); if (right) { transBlockToResultRow(pBlock, startPos, tsCols[startPos], curPoint.pRightRow); saveTimeSliceWinResult(&curPoint.key, pInfo->pUpdatedMap); + if (pInfo->destHasPrimaryKey && winCode == TSDB_CODE_SUCCESS) { + saveTimeSliceWinResult(&curPoint.key, pInfo->pDeletedMap); + } } releaseOutputBuf(pAggSup->pState, curPoint.pResPos, &pAggSup->stateStore); } @@ -807,7 +814,8 @@ void doBuildTimeSlicePointResult(SStreamAggSupporter* pAggSup, SStreamFillSuppor SSlicePoint curPoint = {.key.ts = pKey->ts, .key.groupId = pKey->groupId}; SSlicePoint prevPoint = {0}; SSlicePoint nextPoint = {0}; - getPointInfoFromState(pAggSup, pFillSup, pKey->ts, pKey->groupId, &curPoint, &prevPoint, &nextPoint); + int32_t winCode = TSDB_CODE_SUCCESS; + getPointInfoFromState(pAggSup, pFillSup, pKey->ts, pKey->groupId, &curPoint, &prevPoint, &nextPoint, &winCode); setTimeSliceFillInfo(pFillSup, pFillInfo, pKey->ts); doStreamFillRange(pFillSup, pFillInfo, pBlock); releaseOutputBuf(pAggSup->pState, curPoint.pResPos, &pAggSup->stateStore); @@ -879,7 +887,10 @@ int32_t getSliceMaxTsWins(const SArray* pAllWins, SArray* pMaxWins) { return code; } -static void doDeleteTimeSliceResult(SStreamAggSupporter* pAggSup, SSDataBlock* pBlock, SSHashObj* pUpdatedMap) { +static int32_t doDeleteTimeSliceResult(SStreamAggSupporter* pAggSup, SSDataBlock* pBlock, SSHashObj* pUpdatedMap, + SArray* pDelWins) { + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; int32_t winCode = TSDB_CODE_SUCCESS; SColumnInfoData* pGroupCol = taosArrayGet(pBlock->pDataBlock, GROUPID_COLUMN_INDEX); @@ -900,6 +911,9 @@ static void doDeleteTimeSliceResult(SStreamAggSupporter* pAggSup, SSDataBlock* p break; } (void)tSimpleHashRemove(pUpdatedMap, &key, sizeof(SWinKey)); + void* tmp = taosArrayPush(pDelWins, &key); + QUERY_CHECK_NULL(tmp, code, lino, _end, terrno); + pAggSup->stateStore.streamStateDel(pAggSup->pState, &key); if (winCode != TSDB_CODE_SUCCESS) { break; @@ -907,6 +921,12 @@ static void doDeleteTimeSliceResult(SStreamAggSupporter* pAggSup, SSDataBlock* p key = nextKey; } } + +_end: + if (code != TSDB_CODE_SUCCESS) { + qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } + return code; } static int32_t doStreamTimeSliceNext(SOperatorInfo* pOperator, SSDataBlock** ppRes) { @@ -971,7 +991,8 @@ static int32_t doStreamTimeSliceNext(SOperatorInfo* pOperator, SSDataBlock** ppR switch (pBlock->info.type) { case STREAM_DELETE_RESULT: { - doDeleteTimeSliceResult(pAggSup, pBlock, pInfo->pUpdatedMap); + code = doDeleteTimeSliceResult(pAggSup, pBlock, pInfo->pUpdatedMap, pInfo->pDelWins); + QUERY_CHECK_CODE(code, lino, _end); } break; case STREAM_NORMAL: case STREAM_INVALID: { diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 0fd1121aaa0f..bb770387f106 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -5736,15 +5736,20 @@ static int32_t translateInterp(STranslateContext* pCxt, SSelectStmt* pSelect) { } } - if (NULL == pSelect->pRange || NULL == pSelect->pEvery || NULL == pSelect->pFill) { - if (pSelect->pRange != NULL && QUERY_NODE_OPERATOR == nodeType(pSelect->pRange) && pSelect->pEvery == NULL) { - // single point interp every can be omitted - } else { - if (pCxt->createStream) { - if (NULL == pSelect->pEvery || NULL == pSelect->pFill) { - return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_INTERP_CLAUSE, - "Missing EVERY clause or FILL clause"); - } + if (pCxt->createStream) { + if (NULL != pSelect->pRange) { + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY, + "Stream Unsupported RANGE clause"); + } + + if (NULL == pSelect->pEvery || NULL == pSelect->pFill) { + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY, + "Missing EVERY clause or FILL clause"); + } + } else { + if (NULL == pSelect->pRange || NULL == pSelect->pEvery || NULL == pSelect->pFill) { + if (pSelect->pRange != NULL && QUERY_NODE_OPERATOR == nodeType(pSelect->pRange) && pSelect->pEvery == NULL) { + // single point interp every can be omitted } else { return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_INTERP_CLAUSE, "Missing RANGE clause, EVERY clause or FILL clause"); @@ -10182,6 +10187,11 @@ static int32_t checkStreamQuery(STranslateContext* pCxt, SCreateStreamStmt* pStm } } + if (pStmt->pOptions->fillHistory && pSelect->hasInterpFunc) { + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY, + "Stream interp unsupported Fill history"); + } + return TSDB_CODE_SUCCESS; } From b26750c200a7934ecfe0f3dc1f7452dd87d2d662 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Fri, 2 Aug 2024 13:22:14 +0800 Subject: [PATCH 017/695] add ci --- include/libs/executor/storageapi.h | 7 +- include/libs/nodes/plannodes.h | 4 +- include/libs/stream/streamState.h | 6 +- include/libs/stream/tstreamFileState.h | 7 +- source/libs/executor/inc/executorInt.h | 5 +- source/libs/executor/inc/streamexecutorInt.h | 29 +- source/libs/executor/src/scanoperator.c | 24 +- .../executor/src/streamcountwindowoperator.c | 7 +- .../executor/src/streameventwindowoperator.c | 7 +- source/libs/executor/src/streamfilloperator.c | 113 ++-- .../executor/src/streamtimesliceoperator.c | 640 +++++++++++++++--- .../executor/src/streamtimewindowoperator.c | 51 +- source/libs/executor/src/timesliceoperator.c | 2 +- source/libs/nodes/src/nodesCloneFuncs.c | 2 + source/libs/nodes/src/nodesCodeFuncs.c | 42 ++ source/libs/stream/src/streamSliceState.c | 93 ++- source/libs/stream/src/streamState.c | 12 +- .../tsim/stream/streamInterpLinear0.sim | 216 ++++++ .../script/tsim/stream/streamInterpNext0.sim | 216 ++++++ .../script/tsim/stream/streamInterpPrev0.sim | 216 ++++++ .../script/tsim/stream/streamInterpValue0.sim | 361 ++++++++++ 21 files changed, 1800 insertions(+), 260 deletions(-) create mode 100644 tests/script/tsim/stream/streamInterpLinear0.sim create mode 100644 tests/script/tsim/stream/streamInterpNext0.sim create mode 100644 tests/script/tsim/stream/streamInterpPrev0.sim create mode 100644 tests/script/tsim/stream/streamInterpValue0.sim diff --git a/include/libs/executor/storageapi.h b/include/libs/executor/storageapi.h index c2fc76453a70..de04288b7950 100644 --- a/include/libs/executor/storageapi.h +++ b/include/libs/executor/storageapi.h @@ -350,12 +350,13 @@ typedef struct SStateStore { int32_t (*streamStateGetInfo)(SStreamState* pState, void* pKey, int32_t keyLen, void** pVal, int32_t* pLen); int32_t (*streamStateFillPut)(SStreamState* pState, const SWinKey* key, const void* value, int32_t vLen); - int32_t (*streamStateFillGet)(SStreamState* pState, const SWinKey* key, void** pVal, int32_t* pVLen); + int32_t (*streamStateFillGet)(SStreamState* pState, const SWinKey* key, void** pVal, int32_t* pVLen, + int32_t* pWinCode); void (*streamStateFillDel)(SStreamState* pState, const SWinKey* key); int32_t (*streamStateFillGetNext)(SStreamState* pState, const SWinKey* pKey, SWinKey* pResKey, void** pVal, - int32_t* pVLen); + int32_t* pVLen, int32_t* pWinCode); int32_t (*streamStateFillGetPrev)(SStreamState* pState, const SWinKey* pKey, SWinKey* pResKey, void** pVal, - int32_t* pVLen); + int32_t* pVLen, int32_t* pWinCode); void (*streamStateCurNext)(SStreamState* pState, SStreamStateCur* pCur); void (*streamStateCurPrev)(SStreamState* pState, SStreamStateCur* pCur); diff --git a/include/libs/nodes/plannodes.h b/include/libs/nodes/plannodes.h index 308dee14ddb2..57b1a7d69215 100644 --- a/include/libs/nodes/plannodes.h +++ b/include/libs/nodes/plannodes.h @@ -208,7 +208,7 @@ typedef struct SInterpFuncLogicNode { SNodeList* pFuncs; STimeWindow timeRange; int64_t interval; - char intervalUnit; + int8_t intervalUnit; int8_t precision; EFillMode fillMode; SNode* pFillValues; // SNodeListNode @@ -513,7 +513,7 @@ typedef struct SInterpFuncPhysiNode { SNodeList* pFuncs; STimeWindow timeRange; int64_t interval; - char intervalUnit; + int8_t intervalUnit; int8_t precision; EFillMode fillMode; SNode* pFillValues; // SNodeListNode diff --git a/include/libs/stream/streamState.h b/include/libs/stream/streamState.h index db2c3a6391ee..046812f396b4 100644 --- a/include/libs/stream/streamState.h +++ b/include/libs/stream/streamState.h @@ -75,12 +75,12 @@ int32_t streamStateStateAddIfNotExist(SStreamState* pState, SSessionKey* key, ch // fill int32_t streamStateFillPut(SStreamState* pState, const SWinKey* key, const void* value, int32_t vLen); -int32_t streamStateFillGet(SStreamState* pState, const SWinKey* key, void** pVal, int32_t* pVLen); +int32_t streamStateFillGet(SStreamState* pState, const SWinKey* key, void** pVal, int32_t* pVLen, int32_t* pWinCode); void streamStateFillDel(SStreamState* pState, const SWinKey* key); int32_t streamStateFillGetNext(SStreamState* pState, const SWinKey* pKey, SWinKey* pResKey, void** pVal, - int32_t* pVLen); + int32_t* pVLen, int32_t* pWinCode); int32_t streamStateFillGetPrev(SStreamState* pState, const SWinKey* pKey, SWinKey* pResKey, void** pVal, - int32_t* pVLen); + int32_t* pVLen, int32_t* pWinCode); int32_t streamStateAddIfNotExist(SStreamState* pState, const SWinKey* key, void** pVal, int32_t* pVLen, int32_t* pWinCode); diff --git a/include/libs/stream/tstreamFileState.h b/include/libs/stream/tstreamFileState.h index b19a7889902a..bb0d49f1f1d9 100644 --- a/include/libs/stream/tstreamFileState.h +++ b/include/libs/stream/tstreamFileState.h @@ -124,14 +124,15 @@ int32_t getSessionRowBuff(SStreamFileState* pFileState, void* pKey, int32_t keyL int32_t getFunctionRowBuff(SStreamFileState* pFileState, void* pKey, int32_t keyLen, void** pVal, int32_t* pVLen); // time slice -int32_t getHashSortRowBuff(SStreamFileState* pFileState, const SWinKey* pKey, void** pVal, int32_t* pVLen); +int32_t getHashSortRowBuff(SStreamFileState* pFileState, const SWinKey* pKey, void** pVal, int32_t* pVLen, + int32_t* pWinCode); int32_t hashSortFileGetFn(SStreamFileState* pFileState, void* pKey, void** data, int32_t* pDataLen); int32_t hashSortFileRemoveFn(SStreamFileState* pFileState, const void* pKey); void clearSearchBuff(SStreamFileState* pFileState); int32_t getHashSortNextRow(SStreamFileState* pFileState, const SWinKey* pKey, SWinKey* pResKey, void** pVal, - int32_t* pVLen); + int32_t* pVLen, int32_t* pWinCode); int32_t getHashSortPrevRow(SStreamFileState* pFileState, const SWinKey* pKey, SWinKey* pResKey, void** pVal, - int32_t* pVLen); + int32_t* pVLen, int32_t* pWinCode); int32_t recoverFillSnapshot(SStreamFileState* pFileState, int64_t ckId); void deleteHashSortRowBuff(SStreamFileState* pFileState, const SWinKey* pKey); diff --git a/source/libs/executor/inc/executorInt.h b/source/libs/executor/inc/executorInt.h index 00986674fb86..3ae7a968ffd9 100644 --- a/source/libs/executor/inc/executorInt.h +++ b/source/libs/executor/inc/executorInt.h @@ -777,8 +777,10 @@ typedef struct SStreamFillSupporter { int32_t type; // fill type SInterval interval; SResultRowData prev; + TSKEY prevOriginKey; SResultRowData cur; SResultRowData next; + TSKEY nextOriginKey; SResultRowData nextNext; SFillColInfo* pAllColInfo; // fill exprs and not fill exprs SExprSupp notFillExprSup; @@ -963,7 +965,7 @@ int32_t initBasicInfoEx(SOptrBasicInfo* pBasicInfo, SExprSupp* pSup, SExprInfo* int32_t initStreamAggSupporter(SStreamAggSupporter* pSup, SExprSupp* pExpSup, int32_t numOfOutput, int64_t gap, SStreamState* pState, int32_t keySize, int16_t keyType, SStateStore* pStore, SReadHandle* pHandle, STimeWindowAggSupp* pTwAggSup, const char* taskIdStr, - SStorageAPI* pApi, int32_t tsIndex); + SStorageAPI* pApi, int32_t tsIndex, int8_t stateType, int32_t ratio); int32_t initDownStream(struct SOperatorInfo* downstream, SStreamAggSupporter* pAggSup, uint16_t type, int32_t tsColIndex, STimeWindowAggSupp* pTwSup, struct SSteamOpBasicInfo* pBasic); int32_t getMaxTsWins(const SArray* pAllWins, SArray* pMaxWins); @@ -1004,6 +1006,7 @@ void reloadAggSupFromDownStream(struct SOperatorInfo* downstream, SStreamAggS void destroyFlusedPos(void* pRes); bool isIrowtsPseudoColumn(SExprInfo* pExprInfo); bool isIsfilledPseudoColumn(SExprInfo* pExprInfo); +bool isInterpFunc(SExprInfo* pExprInfo); int32_t encodeSSessionKey(void** buf, SSessionKey* key); void* decodeSSessionKey(void* buf, SSessionKey* key); diff --git a/source/libs/executor/inc/streamexecutorInt.h b/source/libs/executor/inc/streamexecutorInt.h index 8332fb3c0d92..9b0e204f73c1 100644 --- a/source/libs/executor/inc/streamexecutorInt.h +++ b/source/libs/executor/inc/streamexecutorInt.h @@ -35,27 +35,28 @@ int64_t getDeleteMarkFromOption(SStreamNodeOption* pOption); void removeDeleteResults(SSHashObj* pUpdatedMap, SArray* pDelWins); int32_t copyIntervalDeleteKey(SSHashObj* pMap, SArray* pWins); bool hasSrcPrimaryKeyCol(SSteamOpBasicInfo* pInfo); -void transBlockToResultRow(const SSDataBlock* pBlock, int32_t rowId, TSKEY ts, SResultRowData* pRowVal); int32_t getNexWindowPos(SInterval* pInterval, SDataBlockInfo* pBlockInfo, TSKEY* tsCols, int32_t startPos, TSKEY eKey, STimeWindow* pNextWin); int32_t saveWinResult(SWinKey* pKey, SRowBuffPos* pPos, SSHashObj* pUpdatedMap); -void resetPrevAndNextWindow(SStreamFillSupporter* pFillSup); void doBuildDeleteResultImpl(SStateStore* pAPI, SStreamState* pState, SArray* pWins, int32_t* index, SSDataBlock* pBlock); -SResultCellData* getResultCell(SResultRowData* pRaw, int32_t index); int32_t initResultBuf(SStreamFillSupporter* pFillSup); -void destroyStreamFillSupporter(SStreamFillSupporter* pFillSup); -void calcRowDeltaData(SResultRowData* pEndRow, SArray* pEndPoins, SFillColInfo* pFillCol, int32_t numOfCol); -void resetFillWindow(SResultRowData* pRowData); -bool hasPrevWindow(SStreamFillSupporter* pFillSup); -bool hasNextWindow(SStreamFillSupporter* pFillSup); -void copyNotFillExpData(SStreamFillSupporter* pFillSup, SStreamFillInfo* pFillInfo); -void setFillKeyInfo(TSKEY start, TSKEY end, SInterval* pInterval, SStreamFillInfo* pFillInfo); -int32_t setRowCell(SColumnInfoData* pCol, int32_t rowId, const SResultCellData* pCell); -bool hasRemainCalc(SStreamFillInfo* pFillInfo); -void destroySPoint(void* ptr); -void destroyStreamFillInfo(SStreamFillInfo* pFillInfo); +SStreamFillInfo* initStreamFillInfo(SStreamFillSupporter* pFillSup, SSDataBlock* pRes); +SResultCellData* getResultCell(SResultRowData* pRaw, int32_t index); + +void destroyStreamFillSupporter(SStreamFillSupporter* pFillSup); +void calcRowDeltaData(SResultRowData* pEndRow, SArray* pEndPoins, SFillColInfo* pFillCol, int32_t numOfCol); +bool hasCurWindow(SStreamFillSupporter* pFillSup); +bool hasPrevWindow(SStreamFillSupporter* pFillSup); +bool hasNextWindow(SStreamFillSupporter* pFillSup); +void copyNotFillExpData(SStreamFillSupporter* pFillSup, SStreamFillInfo* pFillInfo); +int32_t setRowCell(SColumnInfoData* pCol, int32_t rowId, const SResultCellData* pCell); +bool hasRemainCalc(SStreamFillInfo* pFillInfo); +void destroySPoint(void* ptr); +void destroyStreamFillInfo(SStreamFillInfo* pFillInfo); +int32_t checkResult(SStreamFillSupporter* pFillSup, TSKEY ts, uint64_t groupId, bool* pRes); +void resetStreamFillSup(SStreamFillSupporter* pFillSup); int winPosCmprImpl(const void* pKey1, const void* pKey2); diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 61eda480b3b2..bd0b9057e020 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -2065,9 +2065,11 @@ static int32_t generateCountScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSrcB return code; } -void getTimeSliceWinRange(SStreamAggSupporter* pAggSup, SInterval* pInterval, TSKEY start, TSKEY end, int64_t groupId, +int32_t getTimeSliceWinRange(SStreamAggSupporter* pAggSup, SInterval* pInterval, TSKEY start, TSKEY end, int64_t groupId, STimeWindow* pScanRange, STimeWindow* pDelRange) { int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; + int32_t winCode = TSDB_CODE_SUCCESS; SResultRowInfo dumyInfo = {0}; dumyInfo.cur.pageId = -1; STimeWindow sWin = getActiveTimeWindow(NULL, &dumyInfo, start, pInterval, TSDB_ORDER_ASC); @@ -2079,20 +2081,28 @@ void getTimeSliceWinRange(SStreamAggSupporter* pAggSup, SInterval* pInterval, TS pDelRange->ekey = sWin.ekey; SWinKey preKey = {.groupId = groupId}; - code = pAggSup->stateStore.streamStateFillGetPrev(pAggSup->pState, &startKey, &preKey, NULL, NULL); - if (code == TSDB_CODE_SUCCESS) { + code = pAggSup->stateStore.streamStateFillGetPrev(pAggSup->pState, &startKey, &preKey, NULL, NULL, &winCode); + QUERY_CHECK_CODE(code, lino, _end); + if (winCode == TSDB_CODE_SUCCESS) { pScanRange->skey = preKey.ts; } else { pScanRange->skey = startKey.ts; } SWinKey nextKey = {.groupId = groupId}; - code = pAggSup->stateStore.streamStateFillGetNext(pAggSup->pState, &endKey, &nextKey, NULL, NULL); - if (code == TSDB_CODE_SUCCESS) { + code = pAggSup->stateStore.streamStateFillGetNext(pAggSup->pState, &endKey, &nextKey, NULL, NULL, &winCode); + QUERY_CHECK_CODE(code, lino, _end); + if (winCode == TSDB_CODE_SUCCESS) { pScanRange->ekey = nextKey.ts; } else { pScanRange->ekey = endKey.ts; } + +_end: + if (code != TSDB_CODE_SUCCESS) { + qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } + return code; } static int32_t generateTimeSliceScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSrcBlock, SSDataBlock* pDestBlock, @@ -2150,7 +2160,9 @@ static int32_t generateTimeSliceScanRange(SStreamScanInfo* pInfo, SSDataBlock* p STimeWindow scanRange = {0}; STimeWindow delRange = {0}; ASSERT(mode == STREAM_DELETE_RESULT || mode == STREAM_DELETE_DATA); - getTimeSliceWinRange(pInfo->windowSup.pStreamAggSup, &pInfo->interval, startData[i], endData[i], groupId, &scanRange, &delRange); + code = getTimeSliceWinRange(pInfo->windowSup.pStreamAggSup, &pInfo->interval, startData[i], endData[i], groupId, + &scanRange, &delRange); + QUERY_CHECK_CODE(code, lino, _end); code = colDataSetVal(pDestStartCol, i, (const char*)&scanRange.skey, false); QUERY_CHECK_CODE(code, lino, _end); diff --git a/source/libs/executor/src/streamcountwindowoperator.c b/source/libs/executor/src/streamcountwindowoperator.c index 9b9e9e2bf99a..69ff56c53025 100644 --- a/source/libs/executor/src/streamcountwindowoperator.c +++ b/source/libs/executor/src/streamcountwindowoperator.c @@ -803,8 +803,8 @@ void streamCountReloadState(SOperatorInfo* pOperator) { } } -int32_t createStreamCountAggOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pPhyNode, - SExecTaskInfo* pTaskInfo, SReadHandle* pHandle, SOperatorInfo** pOptrInfo) { +int32_t createStreamCountAggOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo, + SReadHandle* pHandle, SOperatorInfo** pOptrInfo) { QRY_OPTR_CHECK(pOptrInfo); SCountWinodwPhysiNode* pCountNode = (SCountWinodwPhysiNode*)pPhyNode; @@ -845,7 +845,8 @@ int32_t createStreamCountAggOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pInfo->primaryTsIndex = ((SColumnNode*)pCountNode->window.pTspk)->slotId; code = initStreamAggSupporter(&pInfo->streamAggSup, pExpSup, numOfCols, 0, pTaskInfo->streamInfo.pState, sizeof(COUNT_TYPE), 0, &pTaskInfo->storageAPI.stateStore, pHandle, &pInfo->twAggSup, - GET_TASKID(pTaskInfo), &pTaskInfo->storageAPI, pInfo->primaryTsIndex); + GET_TASKID(pTaskInfo), &pTaskInfo->storageAPI, pInfo->primaryTsIndex, + STREAM_STATE_BUFF_SORT, 1); QUERY_CHECK_CODE(code, lino, _error); pInfo->streamAggSup.windowCount = pCountNode->windowCount; diff --git a/source/libs/executor/src/streameventwindowoperator.c b/source/libs/executor/src/streameventwindowoperator.c index 86fc323991b3..3efaf0c00292 100644 --- a/source/libs/executor/src/streameventwindowoperator.c +++ b/source/libs/executor/src/streameventwindowoperator.c @@ -518,8 +518,8 @@ int32_t doStreamEventDecodeOpState(void* buf, int32_t len, SOperatorInfo* pOpera QUERY_CHECK_CODE(code, lino, _end); buf = decodeSResultWindowInfo(buf, &winfo, pInfo->streamAggSup.resultRowSize); - code = - tSimpleHashPut(pInfo->streamAggSup.pResultRows, &winfo.sessionWin, sizeof(SSessionKey), &winfo, sizeof(SResultWindowInfo)); + code = tSimpleHashPut(pInfo->streamAggSup.pResultRows, &winfo.sessionWin, sizeof(SSessionKey), &winfo, + sizeof(SResultWindowInfo)); QUERY_CHECK_CODE(code, lino, _end); } @@ -892,7 +892,8 @@ int32_t createStreamEventAggOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pInfo->primaryTsIndex = tsSlotId; code = initStreamAggSupporter(&pInfo->streamAggSup, pExpSup, numOfCols, 0, pTaskInfo->streamInfo.pState, sizeof(bool) + sizeof(bool), 0, &pTaskInfo->storageAPI.stateStore, pHandle, - &pInfo->twAggSup, GET_TASKID(pTaskInfo), &pTaskInfo->storageAPI, pInfo->primaryTsIndex); + &pInfo->twAggSup, GET_TASKID(pTaskInfo), &pTaskInfo->storageAPI, pInfo->primaryTsIndex, + STREAM_STATE_BUFF_SORT, 1); QUERY_CHECK_CODE(code, lino, _error); _hash_fn_t hashFn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY); diff --git a/source/libs/executor/src/streamfilloperator.c b/source/libs/executor/src/streamfilloperator.c index c8607267c71b..e08101fe7ae1 100644 --- a/source/libs/executor/src/streamfilloperator.c +++ b/source/libs/executor/src/streamfilloperator.c @@ -32,9 +32,6 @@ #include "querytask.h" #include "tdatablock.h" #include "tfill.h" -#include "operator.h" -#include "querytask.h" - #define FILL_POS_INVALID 0 #define FILL_POS_START 1 @@ -81,7 +78,9 @@ void* destroyFillColumnInfo(SFillColInfo* pFillCol, int32_t start, int32_t end) destroyExprInfo(pFillCol[i].pExpr, 1); taosVariantDestroy(&pFillCol[i].fillVal); } - taosMemoryFreeClear(pFillCol[start].pExpr); + if (start < end) { + taosMemoryFreeClear(pFillCol[start].pExpr); + } taosMemoryFree(pFillCol); return NULL; } @@ -140,12 +139,12 @@ static void destroyStreamFillOperatorInfo(void* param) { taosMemoryFree(pInfo); } -void resetFillWindow(SResultRowData* pRowData) { +static void resetFillWindow(SResultRowData* pRowData) { pRowData->key = INT64_MIN; taosMemoryFreeClear(pRowData->pRowVal); } -void resetPrevAndNextWindow(SStreamFillSupporter* pFillSup) { +static void resetPrevAndNextWindow(SStreamFillSupporter* pFillSup) { if (pFillSup->cur.pRowVal != pFillSup->prev.pRowVal && pFillSup->cur.pRowVal != pFillSup->next.pRowVal) { resetFillWindow(&pFillSup->cur); } else { @@ -166,7 +165,7 @@ void getCurWindowFromDiscBuf(SOperatorInfo* pOperator, TSKEY ts, uint64_t groupI SWinKey key = {.ts = ts, .groupId = groupId}; int32_t curVLen = 0; - int32_t code = pAPI->stateStore.streamStateFillGet(pState, &key, (void**)&pFillSup->cur.pRowVal, &curVLen); + int32_t code = pAPI->stateStore.streamStateFillGet(pState, &key, (void**)&pFillSup->cur.pRowVal, &curVLen, NULL); ASSERT(code == TSDB_CODE_SUCCESS); pFillSup->cur.key = key.ts; } @@ -180,7 +179,7 @@ void getWindowFromDiscBuf(SOperatorInfo* pOperator, TSKEY ts, uint64_t groupId, void* curVal = NULL; int32_t curVLen = 0; bool hasCurKey = true; - int32_t code = pAPI->stateStore.streamStateFillGet(pState, &key, (void**)&curVal, &curVLen); + int32_t code = pAPI->stateStore.streamStateFillGet(pState, &key, (void**)&curVal, &curVLen, NULL); if (code == TSDB_CODE_SUCCESS) { pFillSup->cur.key = key.ts; pFillSup->cur.pRowVal = curVal; @@ -233,14 +232,12 @@ void getWindowFromDiscBuf(SOperatorInfo* pOperator, TSKEY ts, uint64_t groupId, pAPI->stateStore.streamStateFreeCur(pCur); } -bool hasPrevWindow(SStreamFillSupporter* pFillSup) { return pFillSup->prev.key != INT64_MIN; } -bool hasNextWindow(SStreamFillSupporter* pFillSup) { return pFillSup->next.key != INT64_MIN; } -static bool hasNextNextWindow(SStreamFillSupporter* pFillSup) { - return pFillSup->nextNext.key != INT64_MIN; - return false; -} +bool hasCurWindow(SStreamFillSupporter* pFillSup) { return pFillSup->cur.key != INT64_MIN; } +bool hasPrevWindow(SStreamFillSupporter* pFillSup) { return pFillSup->prev.key != INT64_MIN; } +bool hasNextWindow(SStreamFillSupporter* pFillSup) { return pFillSup->next.key != INT64_MIN; } +static bool hasNextNextWindow(SStreamFillSupporter* pFillSup) { return pFillSup->nextNext.key != INT64_MIN; } -void transBlockToResultRow(const SSDataBlock* pBlock, int32_t rowId, TSKEY ts, SResultRowData* pRowVal) { +static void transBlockToResultRow(const SSDataBlock* pBlock, int32_t rowId, TSKEY ts, SResultRowData* pRowVal) { int32_t numOfCols = taosArrayGetSize(pBlock->pDataBlock); for (int32_t i = 0; i < numOfCols; ++i) { SColumnInfoData* pColData = taosArrayGet(pBlock->pDataBlock, i); @@ -262,8 +259,7 @@ void transBlockToResultRow(const SSDataBlock* pBlock, int32_t rowId, TSKEY ts, S pRowVal->key = ts; } -void calcRowDeltaData(SResultRowData* pEndRow, SArray* pEndPoins, SFillColInfo* pFillCol, - int32_t numOfCol) { +void calcRowDeltaData(SResultRowData* pEndRow, SArray* pEndPoins, SFillColInfo* pFillCol, int32_t numOfCol) { for (int32_t i = 0; i < numOfCol; i++) { if (!pFillCol[i].notFillCol) { int32_t slotId = GET_DEST_SLOT_ID(pFillCol + i); @@ -285,7 +281,7 @@ static void setFillInfoEnd(TSKEY ts, SInterval* pInterval, SStreamFillInfo* pFil pFillInfo->end = ts; } -void setFillKeyInfo(TSKEY start, TSKEY end, SInterval* pInterval, SStreamFillInfo* pFillInfo) { +static void setFillKeyInfo(TSKEY start, TSKEY end, SInterval* pInterval, SStreamFillInfo* pFillInfo) { setFillInfoStart(start, pInterval, pFillInfo); pFillInfo->current = pFillInfo->start; setFillInfoEnd(end, pInterval, pFillInfo); @@ -460,12 +456,13 @@ void setFillValueInfo(SSDataBlock* pBlock, TSKEY ts, int32_t rowId, SStreamFillS ASSERT(pFillInfo->pos != FILL_POS_INVALID); } -static int32_t checkResult(SStreamFillSupporter* pFillSup, TSKEY ts, uint64_t groupId, bool* pRes) { +int32_t checkResult(SStreamFillSupporter* pFillSup, TSKEY ts, uint64_t groupId, bool* pRes) { int32_t code = TSDB_CODE_SUCCESS; int32_t lino = 0; SWinKey key = {.groupId = groupId, .ts = ts}; if (tSimpleHashGet(pFillSup->pResMap, &key, sizeof(SWinKey)) != NULL) { (*pRes) = false; + goto _end; } code = tSimpleHashPut(pFillSup->pResMap, &key, sizeof(SWinKey), NULL, 0); QUERY_CHECK_CODE(code, lino, _end); @@ -721,7 +718,6 @@ static void doStreamFillImpl(SOperatorInfo* pOperator) { } while (pInfo->srcRowIndex < pBlock->info.rows) { - TSKEY ts = tsCol[pInfo->srcRowIndex]; keepBlockRowInDiscBuf(pOperator, pFillInfo, pBlock, tsCol, pInfo->srcRowIndex, groupId, pFillSup->rowSize); doFillResults(pOperator, pFillSup, pFillInfo, pBlock, tsCol, pInfo->srcRowIndex - 1, pRes); if (pInfo->pRes->info.rows == pInfo->pRes->info.capacity) { @@ -859,7 +855,7 @@ static void getWindowInfoByKey(SStorageAPI* pAPI, void* pState, TSKEY ts, int64_ SWinKey key = {.ts = ts, .groupId = groupId}; void* val = NULL; int32_t len = 0; - int32_t code = pAPI->stateStore.streamStateFillGet(pState, &key, (void**)&val, &len); + int32_t code = pAPI->stateStore.streamStateFillGet(pState, &key, (void**)&val, &len, NULL); if (code != TSDB_CODE_SUCCESS) { qDebug("get window info by key failed, Data may be deleted, try next window. ts:%" PRId64 ", groupId:%" PRId64, ts, groupId); @@ -971,9 +967,12 @@ static int32_t doDeleteFillResult(SOperatorInfo* pOperator) { return code; } -static void resetStreamFillInfo(SStreamFillOperatorInfo* pInfo) { - tSimpleHashClear(pInfo->pFillSup->pResMap); - pInfo->pFillSup->hasDelete = false; +void resetStreamFillSup(SStreamFillSupporter* pFillSup) { + tSimpleHashClear(pFillSup->pResMap); + pFillSup->hasDelete = false; +} +void resetStreamFillInfo(SStreamFillOperatorInfo* pInfo) { + resetStreamFillSup(pInfo->pFillSup); taosArrayClear(pInfo->pFillInfo->delRanges); pInfo->pFillInfo->delIndex = 0; } @@ -1323,8 +1322,41 @@ SStreamFillInfo* initStreamFillInfo(SStreamFillSupporter* pFillSup, SSDataBlock* return NULL; } +static void setValueForFillInfo(SStreamFillSupporter* pFillSup, SStreamFillInfo* pFillInfo) { + if (pFillInfo->type == TSDB_FILL_SET_VALUE || pFillInfo->type == TSDB_FILL_SET_VALUE_F) { + for (int32_t i = 0; i < pFillSup->numOfAllCols; ++i) { + SFillColInfo* pFillCol = pFillSup->pAllColInfo + i; + int32_t slotId = GET_DEST_SLOT_ID(pFillCol); + SResultCellData* pCell = getResultCell(pFillInfo->pResRow, slotId); + SVariant* pVar = &(pFillCol->fillVal); + if (pCell->type == TSDB_DATA_TYPE_FLOAT) { + float v = 0; + GET_TYPED_DATA(v, float, pVar->nType, &pVar->i); + SET_TYPED_DATA(pCell->pData, pCell->type, v); + } else if (IS_FLOAT_TYPE(pCell->type)) { + double v = 0; + GET_TYPED_DATA(v, double, pVar->nType, &pVar->i); + SET_TYPED_DATA(pCell->pData, pCell->type, v); + } else if (IS_INTEGER_TYPE(pCell->type)) { + int64_t v = 0; + GET_TYPED_DATA(v, int64_t, pVar->nType, &pVar->i); + SET_TYPED_DATA(pCell->pData, pCell->type, v); + } else { + pCell->isNull = true; + } + } + } else if (pFillInfo->type == TSDB_FILL_NULL || pFillInfo->type == TSDB_FILL_NULL_F) { + for (int32_t i = 0; i < pFillSup->numOfAllCols; ++i) { + SFillColInfo* pFillCol = pFillSup->pAllColInfo + i; + int32_t slotId = GET_DEST_SLOT_ID(pFillCol); + SResultCellData* pCell = getResultCell(pFillInfo->pResRow, slotId); + pCell->isNull = true; + } + } +} + int32_t createStreamFillOperatorInfo(SOperatorInfo* downstream, SStreamFillPhysiNode* pPhyFillNode, - SExecTaskInfo* pTaskInfo, SOperatorInfo** pOptrInfo) { + SExecTaskInfo* pTaskInfo, SOperatorInfo** pOptrInfo) { QRY_OPTR_CHECK(pOptrInfo); int32_t code = TSDB_CODE_SUCCESS; @@ -1359,36 +1391,7 @@ int32_t createStreamFillOperatorInfo(SOperatorInfo* downstream, SStreamFillPhysi goto _error; } - if (pInfo->pFillInfo->type == TSDB_FILL_SET_VALUE || pInfo->pFillInfo->type == TSDB_FILL_SET_VALUE_F) { - for (int32_t i = 0; i < pInfo->pFillSup->numOfAllCols; ++i) { - SFillColInfo* pFillCol = pInfo->pFillSup->pAllColInfo + i; - int32_t slotId = GET_DEST_SLOT_ID(pFillCol); - SResultCellData* pCell = getResultCell(pInfo->pFillInfo->pResRow, slotId); - SVariant* pVar = &(pFillCol->fillVal); - if (pCell->type == TSDB_DATA_TYPE_FLOAT) { - float v = 0; - GET_TYPED_DATA(v, float, pVar->nType, &pVar->i); - SET_TYPED_DATA(pCell->pData, pCell->type, v); - } else if (IS_FLOAT_TYPE(pCell->type)) { - double v = 0; - GET_TYPED_DATA(v, double, pVar->nType, &pVar->i); - SET_TYPED_DATA(pCell->pData, pCell->type, v); - } else if (IS_INTEGER_TYPE(pCell->type)) { - int64_t v = 0; - GET_TYPED_DATA(v, int64_t, pVar->nType, &pVar->i); - SET_TYPED_DATA(pCell->pData, pCell->type, v); - } else { - pCell->isNull = true; - } - } - } else if (pInfo->pFillInfo->type == TSDB_FILL_NULL || pInfo->pFillInfo->type == TSDB_FILL_NULL_F) { - for (int32_t i = 0; i < pInfo->pFillSup->numOfAllCols; ++i) { - SFillColInfo* pFillCol = pInfo->pFillSup->pAllColInfo + i; - int32_t slotId = GET_DEST_SLOT_ID(pFillCol); - SResultCellData* pCell = getResultCell(pInfo->pFillInfo->pResRow, slotId); - pCell->isNull = true; - } - } + setValueForFillInfo(pInfo->pFillSup, pInfo->pFillInfo); code = createSpecialDataBlock(STREAM_DELETE_RESULT, &pInfo->pDelRes); QUERY_CHECK_CODE(code, lino, _error); diff --git a/source/libs/executor/src/streamtimesliceoperator.c b/source/libs/executor/src/streamtimesliceoperator.c index f49e45457c6c..a58c80d9863b 100644 --- a/source/libs/executor/src/streamtimesliceoperator.c +++ b/source/libs/executor/src/streamtimesliceoperator.c @@ -29,13 +29,21 @@ #define STREAM_TIME_SLICE_OP_STATE_NAME "StreamTimeSliceHistoryState" #define STREAM_TIME_SLICE_OP_CHECKPOINT_NAME "StreamTimeSliceOperator_Checkpoint" -#define HAS_NON_ROW_DATA(pRowData) (pRowData == NULL || pRowData->key == INT64_MIN) +#define HAS_NON_ROW_DATA(pRowData) (pRowData->key == INT64_MIN) +#define HAS_ROW_DATA(pRowData) (pRowData && pRowData->key != INT64_MIN) +#define IS_INVALID_WIN_KEY(ts) ((ts) == INT64_MIN) +#define SET_WIN_KEY_INVALID(ts) ((ts) = INT64_MIN) + +typedef struct SSliceRowData { + TSKEY key; + SResultCellData pRowVal[]; +} SSliceRowData; typedef struct SSlicePoint { - SWinKey key; - SResultRowData* pLeftRow; - SResultRowData* pRightRow; - SRowBuffPos* pResPos; + SWinKey key; + SSliceRowData* pLeftRow; + SSliceRowData* pRightRow; + SRowBuffPos* pResPos; } SSlicePoint; int32_t saveTimeSliceWinResult(SWinKey* pKey, SSHashObj* pUpdatedMap) { @@ -121,10 +129,23 @@ void streamTimeSliceReloadState(SOperatorInfo* pOperator) { } } +static void resetFillWindow(SResultRowData* pRowData) { + pRowData->key = INT64_MIN; + pRowData->pRowVal = NULL; +} + +static void resetPrevAndNextWindow(SStreamFillSupporter* pFillSup) { + resetFillWindow(&pFillSup->cur); + resetFillWindow(&pFillSup->prev); + resetFillWindow(&pFillSup->next); + resetFillWindow(&pFillSup->nextNext); +} + void destroyStreamTimeSliceOperatorInfo(void* param) { SStreamTimeSliceOperatorInfo* pInfo = (SStreamTimeSliceOperatorInfo*)param; colDataDestroy(&pInfo->twAggSup.timeWindowData); destroyStreamAggSupporter(&pInfo->streamAggSup); + resetPrevAndNextWindow(pInfo->pFillSup); destroyStreamFillSupporter(pInfo->pFillSup); destroyStreamFillInfo(pInfo->pFillInfo); blockDataDestroy(pInfo->pRes); @@ -168,8 +189,8 @@ int32_t doStreamTimeSliceEncodeOpState(void** buf, int32_t len, SOperatorInfo* p size_t keyLen = 0; int32_t iter = 0; while ((pIte = tSimpleHashIterate(pInfo->streamAggSup.pResultRows, pIte, &iter)) != NULL) { - void* key = tSimpleHashGetKey(pIte, &keyLen); - tlen += encodeSSessionKey(buf, key); + void* pKey = tSimpleHashGetKey(pIte, &keyLen); + tlen += encodeSSessionKey(buf, pKey); tlen += encodeSResultWindowInfo(buf, pIte, pInfo->streamAggSup.resultRowSize); } @@ -258,11 +279,13 @@ static int32_t initTimeSliceFillSup(SStreamInterpFuncPhysiNode* pPhyFillNode, SE pFillSup->interval.sliding = pPhyFillNode->interval; pFillSup->interval.slidingUnit = pPhyFillNode->intervalUnit; pFillSup->pAPI = NULL; + _hash_fn_t hashFn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY); + pFillSup->pResMap = tSimpleHashInit(16, hashFn); + QUERY_CHECK_NULL(pFillSup->pResMap, code, lino, _end, terrno); code = initResultBuf(pFillSup); QUERY_CHECK_CODE(code, lino, _end); - pFillSup->pResMap = NULL; pFillSup->hasDelete = false; (*ppResFillSup) = pFillSup; @@ -303,6 +326,19 @@ static void doStreamTimeSliceSaveCheckpoint(SOperatorInfo* pOperator) { } } +static SResultCellData* getSliceResultCell(SResultCellData* pRowVal, int32_t index) { + if (!pRowVal) { + return NULL; + } + char* pData = (char*)pRowVal; + SResultCellData* pCell = pRowVal; + for (int32_t i = 0; i < index; i++) { + pData += (pCell->bytes + sizeof(SResultCellData)); + pCell = (SResultCellData*)pData; + } + return pCell; +} + static int32_t fillPointResult(SStreamFillSupporter* pFillSup, SResultRowData* pResRow, TSKEY ts, SSDataBlock* pBlock, bool* pRes) { int32_t code = TSDB_CODE_SUCCESS; @@ -311,6 +347,18 @@ static int32_t fillPointResult(SStreamFillSupporter* pFillSup, SResultRowData* p (*pRes) = false; goto _end; } + if (IS_INVALID_WIN_KEY(ts)) { + (*pRes) = true; + goto _end; + } + bool ckRes = true; + code = checkResult(pFillSup, ts, pBlock->info.id.groupId, &ckRes); + QUERY_CHECK_CODE(code, lino, _end); + if (!ckRes) { + (*pRes) = true; + goto _end; + } + for (int32_t i = 0; i < pFillSup->numOfAllCols; i++) { SFillColInfo* pFillCol = pFillSup->pAllColInfo + i; int32_t dstSlotId = GET_DEST_SLOT_ID(pFillCol); @@ -325,13 +373,13 @@ static int32_t fillPointResult(SStreamFillSupporter* pFillSup, SResultRowData* p QUERY_CHECK_CODE(code, lino, _end); } else { int32_t srcSlot = pFillCol->pExpr->base.pParam[0].pCol->slotId; - SResultCellData* pCell = getResultCell(pResRow, srcSlot); + SResultCellData* pCell = getSliceResultCell(pResRow->pRowVal, srcSlot); code = setRowCell(pDstCol, pBlock->info.rows, pCell); QUERY_CHECK_CODE(code, lino, _end); } } - pBlock->info.rows += 1; + pBlock->info.rows++; (*pRes) = true; _end: @@ -365,13 +413,14 @@ static void fillLinearRange(SStreamFillSupporter* pFillSup, SStreamFillInfo* pFi int32_t code = TSDB_CODE_SUCCESS; int32_t lino = 0; while (hasRemainCalc(pFillInfo) && pBlock->info.rows < pBlock->info.capacity) { - for (int32_t i = 0; i < pFillSup->numOfAllCols; ++i) { + bool ckRes = true; + code = checkResult(pFillSup, pFillInfo->current, pBlock->info.id.groupId, &ckRes); + QUERY_CHECK_CODE(code, lino, _end); + for (int32_t i = 0; i < pFillSup->numOfAllCols && ckRes; ++i) { SFillColInfo* pFillCol = pFillSup->pAllColInfo + i; int32_t dstSlotId = GET_DEST_SLOT_ID(pFillCol); - int32_t srcSlot = pFillCol->pExpr->base.pParam[0].pCol->slotId; SColumnInfoData* pDstCol = taosArrayGet(pBlock->pDataBlock, dstSlotId); int16_t type = pDstCol->info.type; - SResultCellData* pCell = getResultCell(pFillInfo->pResRow, srcSlot); int32_t index = pBlock->info.rows; if (isIrowtsPseudoColumn(pFillCol->pExpr)) { code = colDataSetVal(pDstCol, pBlock->info.rows, (char*)&pFillInfo->current, false); @@ -381,6 +430,8 @@ static void fillLinearRange(SStreamFillSupporter* pFillSup, SStreamFillInfo* pFi code = colDataSetVal(pDstCol, pBlock->info.rows, (char*)&isFilled, false); QUERY_CHECK_CODE(code, lino, _end); } else { + int32_t srcSlot = pFillCol->pExpr->base.pParam[0].pCol->slotId; + SResultCellData* pCell = getSliceResultCell(pFillInfo->pResRow->pRowVal, srcSlot); if (IS_VAR_DATA_TYPE(type) || type == TSDB_DATA_TYPE_BOOL || pCell->isNull) { colDataSetNULL(pDstCol, index); continue; @@ -405,7 +456,9 @@ static void fillLinearRange(SStreamFillSupporter* pFillSup, SStreamFillInfo* pFi } pFillInfo->current = taosTimeAdd(pFillInfo->current, pFillSup->interval.sliding, pFillSup->interval.slidingUnit, pFillSup->interval.precision); - pBlock->info.rows++; + if (ckRes) { + pBlock->info.rows++; + } } _end: @@ -414,6 +467,12 @@ static void fillLinearRange(SStreamFillSupporter* pFillSup, SStreamFillInfo* pFi } } +static void setFillKeyInfo(TSKEY start, TSKEY end, SInterval* pInterval, SStreamFillInfo* pFillInfo) { + pFillInfo->start = start; + pFillInfo->current = pFillInfo->start; + pFillInfo->end = end; +} + static void doStreamFillRange(SStreamFillSupporter* pFillSup, SStreamFillInfo* pFillInfo, SSDataBlock* pRes) { int32_t code = TSDB_CODE_SUCCESS; int32_t lino = 0; @@ -467,6 +526,10 @@ static void doStreamFillRange(SStreamFillSupporter* pFillSup, SStreamFillInfo* p } static int32_t getQualifiedRowNumAsc(SExprSupp* pExprSup, SSDataBlock* pBlock, int32_t rowId, bool ignoreNull) { + if (rowId >= pBlock->info.rows) { + return -1; + } + if (!ignoreNull) { return rowId; } @@ -500,9 +563,37 @@ static int32_t getQualifiedRowNumDesc(SExprSupp* pExprSup, SSDataBlock* pBlock, return resRow; } -static void getPointInfoFromState(SStreamAggSupporter* pAggSup, SStreamFillSupporter* pFillSup, TSKEY ts, - int64_t groupId, SSlicePoint* pCurPoint, SSlicePoint* pPrevPoint, - SSlicePoint* pNextPoint, int32_t* pWinCode) { +static void setResultRowData(SSliceRowData** ppRowData, void* pBuff) { (*ppRowData) = (SSliceRowData*)pBuff; } + +static void setPointBuff(SSlicePoint* pPoint, SStreamFillSupporter* pFillSup) { + if (pFillSup->type != TSDB_FILL_LINEAR) { + setResultRowData(&pPoint->pRightRow, pPoint->pResPos->pRowBuff); + pPoint->pLeftRow = pPoint->pRightRow; + } else { + setResultRowData(&pPoint->pLeftRow, pPoint->pResPos->pRowBuff); + void* pBuff = POINTER_SHIFT(pPoint->pResPos->pRowBuff, pFillSup->rowSize + sizeof(TSKEY)); + setResultRowData(&pPoint->pRightRow, pBuff); + } +} + +static TSKEY adustPrevTsKey(TSKEY pointTs, TSKEY rowTs, SInterval* pInterval) { + if (rowTs >= pointTs) { + pointTs = taosTimeAdd(pointTs, pInterval->sliding, pInterval->slidingUnit, pInterval->precision); + } + return pointTs; +} + +static TSKEY adustEndTsKey(TSKEY pointTs, TSKEY rowTs, SInterval* pInterval) { + if (rowTs <= pointTs) { + pointTs = taosTimeAdd(pointTs, pInterval->sliding * -1, pInterval->slidingUnit, pInterval->precision); + } + return pointTs; +} +static int32_t getLinearResultInfoFromState(SStreamAggSupporter* pAggSup, SStreamFillSupporter* pFillSup, TSKEY ts, + int64_t groupId, SSlicePoint* pCurPoint, SSlicePoint* pPrevPoint, + SSlicePoint* pNextPoint, int32_t* pWinCode) { + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; int32_t tmpRes = TSDB_CODE_SUCCESS; void* pState = pAggSup->pState; resetPrevAndNextWindow(pFillSup); @@ -513,55 +604,252 @@ static void getPointInfoFromState(SStreamAggSupporter* pAggSup, SStreamFillSuppo pCurPoint->key.groupId = groupId; pCurPoint->key.ts = ts; int32_t curVLen = 0; - (*pWinCode) = pAggSup->stateStore.streamStateFillGet(pState, &pCurPoint->key, (void**)&pCurPoint->pResPos, &curVLen); - pCurPoint->pLeftRow = pCurPoint->pResPos->pRowBuff; - if (pFillSup->type == TSDB_FILL_LINEAR) { - pCurPoint->pRightRow = POINTER_SHIFT(pCurPoint->pResPos->pRowBuff, pFillSup->rowSize); - } else { - pCurPoint->pRightRow = NULL; - } + code = + pAggSup->stateStore.streamStateFillGet(pState, &pCurPoint->key, (void**)&pCurPoint->pResPos, &curVLen, pWinCode); + QUERY_CHECK_CODE(code, lino, _end); - if (pCurPoint->pLeftRow->key == pCurPoint->key.ts) { - pFillSup->cur.key = pCurPoint->key.ts; - pFillSup->cur.pRowVal = pCurPoint->pResPos->pRowBuff; - } + setPointBuff(pCurPoint, pFillSup); - if (pPrevPoint) { + if (HAS_ROW_DATA(pCurPoint->pRightRow)) { + pFillSup->cur.key = pCurPoint->pRightRow->key; + pFillSup->cur.pRowVal = pCurPoint->pRightRow->pRowVal; if (HAS_NON_ROW_DATA(pCurPoint->pLeftRow)) { pPrevPoint->key.groupId = groupId; int32_t preVLen = 0; - tmpRes = pAggSup->stateStore.streamStateFillGetPrev(pState, &pCurPoint->key, &pPrevPoint->key, - (void**)&pPrevPoint->pResPos, &preVLen); + code = pAggSup->stateStore.streamStateFillGetPrev(pState, &pCurPoint->key, &pPrevPoint->key, + (void**)&pPrevPoint->pResPos, &preVLen, &tmpRes); + QUERY_CHECK_CODE(code, lino, _end); + if (tmpRes == TSDB_CODE_SUCCESS) { + ASSERT(!IS_INVALID_WIN_KEY(pPrevPoint->key.ts)); + setPointBuff(pPrevPoint, pFillSup); + if (HAS_ROW_DATA(pPrevPoint->pRightRow)) { + pFillSup->prev.key = pPrevPoint->pRightRow->key; + pFillSup->prev.pRowVal = pPrevPoint->pRightRow->pRowVal; + } else { + pFillSup->prev.key = pPrevPoint->pLeftRow->key; + pFillSup->prev.pRowVal = pPrevPoint->pLeftRow->pRowVal; + } + pFillSup->prevOriginKey = pFillSup->prev.key; + pFillSup->prev.key = adustPrevTsKey(pPrevPoint->key.ts, pFillSup->prev.key, &pFillSup->interval); + } + goto _end; + } + } + + if (HAS_ROW_DATA(pCurPoint->pLeftRow)) { + pFillSup->prev.key = pCurPoint->pLeftRow->key; + pFillSup->prev.pRowVal = pCurPoint->pLeftRow->pRowVal; + pFillSup->prevOriginKey = pFillSup->prev.key; + pFillSup->prev.key = adustPrevTsKey(pCurPoint->key.ts, pFillSup->prev.key, &pFillSup->interval); + if (HAS_NON_ROW_DATA(pCurPoint->pRightRow)) { + pNextPoint->key.groupId = groupId; + int32_t nextVLen = 0; + code = pAggSup->stateStore.streamStateFillGetNext(pState, &pCurPoint->key, &pNextPoint->key, + (void**)&pNextPoint->pResPos, &nextVLen, &tmpRes); + QUERY_CHECK_CODE(code, lino, _end); if (tmpRes == TSDB_CODE_SUCCESS) { - pFillSup->prev.key = pPrevPoint->key.ts; - pFillSup->prev.pRowVal = pPrevPoint->pResPos->pRowBuff; + ASSERT(!IS_INVALID_WIN_KEY(pNextPoint->key.ts)); + setPointBuff(pNextPoint, pFillSup); + if (HAS_ROW_DATA(pNextPoint->pLeftRow)) { + pFillSup->next.key = pNextPoint->pLeftRow->key; + pFillSup->next.pRowVal = pNextPoint->pLeftRow->pRowVal; + } else { + pFillSup->next.key = pNextPoint->pRightRow->key; + pFillSup->next.pRowVal = pNextPoint->pRightRow->pRowVal; + } + pFillSup->nextOriginKey = pFillSup->next.key; + pFillSup->next.key = adustEndTsKey(pNextPoint->key.ts, pFillSup->next.key, &pFillSup->interval); + } else { + resetFillWindow(&pFillSup->prev); } + } + } + +_end: + if (code != TSDB_CODE_SUCCESS) { + qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } + return code; +} + +static int32_t getResultInfoFromState(SStreamAggSupporter* pAggSup, SStreamFillSupporter* pFillSup, TSKEY ts, + int64_t groupId, SSlicePoint* pCurPoint, SSlicePoint* pPrevPoint, + SSlicePoint* pNextPoint, int32_t* pWinCode) { + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; + int32_t tmpRes = TSDB_CODE_SUCCESS; + void* pState = pAggSup->pState; + resetPrevAndNextWindow(pFillSup); + pCurPoint->pResPos = NULL; + pPrevPoint->pResPos = NULL; + pNextPoint->pResPos = NULL; + + pCurPoint->key.groupId = groupId; + pCurPoint->key.ts = ts; + int32_t curVLen = 0; + code = + pAggSup->stateStore.streamStateFillGet(pState, &pCurPoint->key, (void**)&pCurPoint->pResPos, &curVLen, pWinCode); + QUERY_CHECK_CODE(code, lino, _end); + + setPointBuff(pCurPoint, pFillSup); + + pFillSup->cur.key = pCurPoint->pRightRow->key; + pFillSup->cur.pRowVal = pCurPoint->pRightRow->pRowVal; + + pPrevPoint->key.groupId = groupId; + int32_t preVLen = 0; + code = pAggSup->stateStore.streamStateFillGetPrev(pState, &pCurPoint->key, &pPrevPoint->key, + (void**)&pPrevPoint->pResPos, &preVLen, &tmpRes); + QUERY_CHECK_CODE(code, lino, _end); + if (tmpRes == TSDB_CODE_SUCCESS) { + ASSERT(!IS_INVALID_WIN_KEY(pPrevPoint->key.ts)); + setPointBuff(pPrevPoint, pFillSup); + if (HAS_ROW_DATA(pPrevPoint->pRightRow)) { + pFillSup->prev.key = pPrevPoint->pRightRow->key; + pFillSup->prev.pRowVal = pPrevPoint->pRightRow->pRowVal; } else { pFillSup->prev.key = pPrevPoint->pLeftRow->key; pFillSup->prev.pRowVal = pPrevPoint->pLeftRow->pRowVal; } + pFillSup->prev.key = adustPrevTsKey(pPrevPoint->key.ts, pFillSup->prev.key, &pFillSup->interval); + } + + pNextPoint->key.groupId = groupId; + int32_t nextVLen = 0; + code = pAggSup->stateStore.streamStateFillGetNext(pState, &pCurPoint->key, &pNextPoint->key, + (void**)&pNextPoint->pResPos, &nextVLen, &tmpRes); + QUERY_CHECK_CODE(code, lino, _end); + if (tmpRes == TSDB_CODE_SUCCESS) { + ASSERT(!IS_INVALID_WIN_KEY(pNextPoint->key.ts)); + setPointBuff(pNextPoint, pFillSup); + if (HAS_ROW_DATA(pNextPoint->pLeftRow)) { + pFillSup->next.key = pNextPoint->pLeftRow->key; + pFillSup->next.pRowVal = pNextPoint->pLeftRow->pRowVal; + } else { + pFillSup->next.key = pNextPoint->pRightRow->key; + pFillSup->next.pRowVal = pNextPoint->pRightRow->pRowVal; + } + pFillSup->next.key = adustEndTsKey(pNextPoint->key.ts, pFillSup->next.key, &pFillSup->interval); + } + +_end: + if (code != TSDB_CODE_SUCCESS) { + qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } + return code; +} + +static int32_t getPointInfoFromStateRight(SStreamAggSupporter* pAggSup, SStreamFillSupporter* pFillSup, TSKEY ts, + int64_t groupId, SSlicePoint* pCurPoint, SSlicePoint* pNextPoint, + int32_t* pWinCode) { + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; + int32_t tmpRes = TSDB_CODE_SUCCESS; + void* pState = pAggSup->pState; + pCurPoint->pResPos = NULL; + pNextPoint->pResPos = NULL; + + pNextPoint->key.groupId = groupId; + STimeWindow stw = {.skey = ts, .ekey = ts}; + getNextTimeWindow(&pFillSup->interval, &stw, TSDB_ORDER_ASC); + pNextPoint->key.ts = stw.skey; + + int32_t curVLen = 0; + code = pAggSup->stateStore.streamStateFillGet(pState, &pNextPoint->key, (void**)&pNextPoint->pResPos, &curVLen, + pWinCode); + QUERY_CHECK_CODE(code, lino, _end); + + setPointBuff(pNextPoint, pFillSup); + + if (*pWinCode != TSDB_CODE_SUCCESS) { + if (pNextPoint->pLeftRow) { + SET_WIN_KEY_INVALID(pNextPoint->pLeftRow->key); + } + if (pNextPoint->pRightRow) { + SET_WIN_KEY_INVALID(pNextPoint->pRightRow->key); + } + } + + SET_WIN_KEY_INVALID(pCurPoint->key.ts); + pCurPoint->key.groupId = groupId; + int32_t nextVLen = 0; + code = pAggSup->stateStore.streamStateFillGetPrev(pState, &pNextPoint->key, &pCurPoint->key, + (void**)&pCurPoint->pResPos, &nextVLen, &tmpRes); + QUERY_CHECK_CODE(code, lino, _end); + if (tmpRes == TSDB_CODE_SUCCESS) { + setPointBuff(pCurPoint, pFillSup); + } + +_end: + if (code != TSDB_CODE_SUCCESS) { + qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } + return code; +} + +static int32_t getPointInfoFromState(SStreamAggSupporter* pAggSup, SStreamFillSupporter* pFillSup, TSKEY ts, + int64_t groupId, SSlicePoint* pCurPoint, SSlicePoint* pNextPoint, + int32_t* pWinCode) { + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; + int32_t tmpRes = TSDB_CODE_SUCCESS; + void* pState = pAggSup->pState; + pCurPoint->pResPos = NULL; + pNextPoint->pResPos = NULL; + pCurPoint->key.groupId = groupId; + pCurPoint->key.ts = ts; + + int32_t curVLen = 0; + code = + pAggSup->stateStore.streamStateFillGet(pState, &pCurPoint->key, (void**)&pCurPoint->pResPos, &curVLen, pWinCode); + QUERY_CHECK_CODE(code, lino, _end); + + setPointBuff(pCurPoint, pFillSup); + + if (*pWinCode != TSDB_CODE_SUCCESS) { + if (pCurPoint->pLeftRow) { + SET_WIN_KEY_INVALID(pCurPoint->pLeftRow->key); + } + if (pCurPoint->pRightRow) { + SET_WIN_KEY_INVALID(pCurPoint->pRightRow->key); + } } - if (HAS_NON_ROW_DATA(pCurPoint->pRightRow)) { - pNextPoint->key.groupId = groupId; - int32_t nextVLen = 0; - tmpRes = pAggSup->stateStore.streamStateFillGetNext(pState, &pCurPoint->key, &pNextPoint->key, - (void**)&pNextPoint->pResPos, &nextVLen); + int32_t nextVLen = 0; + pNextPoint->key.groupId = groupId; + if (pFillSup->type != TSDB_FILL_LINEAR) { + SET_WIN_KEY_INVALID(pNextPoint->key.ts); + code = pAggSup->stateStore.streamStateFillGetNext(pState, &pCurPoint->key, &pNextPoint->key, + (void**)&pNextPoint->pResPos, &nextVLen, &tmpRes); + QUERY_CHECK_CODE(code, lino, _end); if (tmpRes == TSDB_CODE_SUCCESS) { - pFillSup->next.key = pNextPoint->key.ts; - pFillSup->next.pRowVal = pNextPoint->pResPos->pRowBuff; + setPointBuff(pNextPoint, pFillSup); } } else { - pFillSup->next.key = pCurPoint->pRightRow->key; - pFillSup->next.pRowVal = pCurPoint->pRightRow->pRowVal; + pNextPoint->key.ts = taosTimeAdd(pCurPoint->key.ts, pFillSup->interval.sliding, pFillSup->interval.slidingUnit, + pFillSup->interval.precision); + code = pAggSup->stateStore.streamStateFillGet(pState, &pNextPoint->key, (void**)&pNextPoint->pResPos, &nextVLen, + &tmpRes); + QUERY_CHECK_CODE(code, lino, _end); + setPointBuff(pNextPoint, pFillSup); + if (tmpRes != TSDB_CODE_SUCCESS) { + SET_WIN_KEY_INVALID(pNextPoint->pLeftRow->key); + SET_WIN_KEY_INVALID(pNextPoint->pRightRow->key); + } } + +_end: + if (code != TSDB_CODE_SUCCESS) { + qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } + return code; } -static void setTimeSliceFillInfo(SStreamFillSupporter* pFillSup, SStreamFillInfo* pFillInfo, TSKEY ts) { +static void setTimeSliceFillRule(SStreamFillSupporter* pFillSup, SStreamFillInfo* pFillInfo, TSKEY ts) { if (!hasPrevWindow(pFillSup) && !hasNextWindow(pFillSup)) { pFillInfo->needFill = false; pFillInfo->pos = FILL_POS_START; - return; + goto _end; } TSKEY prevWKey = INT64_MIN; TSKEY nextWKey = INT64_MIN; @@ -579,73 +867,79 @@ static void setTimeSliceFillInfo(SStreamFillSupporter* pFillSup, SStreamFillInfo case TSDB_FILL_NULL_F: case TSDB_FILL_SET_VALUE: case TSDB_FILL_SET_VALUE_F: { - if (hasPrevWindow(pFillSup) && hasNextWindow(pFillSup)) { - pFillInfo->needFill = false; - pFillInfo->pos = FILL_POS_START; - } else if (hasPrevWindow(pFillSup)) { - setFillKeyInfo(prevWKey, ts, &pFillSup->interval, pFillInfo); + if (hasPrevWindow(pFillSup)) { + TSKEY endTs = adustEndTsKey(ts, pFillSup->cur.key, &pFillSup->interval); + setFillKeyInfo(prevWKey, endTs, &pFillSup->interval, pFillInfo); pFillInfo->pos = FILL_POS_END; } else { - setFillKeyInfo(ts, nextWKey, &pFillSup->interval, pFillInfo); + TSKEY startTs = adustPrevTsKey(ts, pFillSup->cur.key, &pFillSup->interval); + setFillKeyInfo(startTs, nextWKey, &pFillSup->interval, pFillInfo); pFillInfo->pos = FILL_POS_START; } copyNotFillExpData(pFillSup, pFillInfo); + pFillInfo->pResRow->key = ts; } break; case TSDB_FILL_PREV: { if (hasNextWindow(pFillSup)) { - setFillKeyInfo(ts, nextWKey, &pFillSup->interval, pFillInfo); + TSKEY startTs = adustPrevTsKey(ts, pFillSup->cur.key, &pFillSup->interval); + setFillKeyInfo(startTs, nextWKey, &pFillSup->interval, pFillInfo); pFillInfo->pos = FILL_POS_START; resetFillWindow(&pFillSup->prev); - pFillSup->prev.key = pFillSup->cur.key; + pFillSup->prev.key = ts; pFillSup->prev.pRowVal = pFillSup->cur.pRowVal; } else { ASSERT(hasPrevWindow(pFillSup)); - setFillKeyInfo(prevWKey, ts, &pFillSup->interval, pFillInfo); + TSKEY endTs = adustEndTsKey(ts, pFillSup->cur.key, &pFillSup->interval); + setFillKeyInfo(prevWKey, endTs, &pFillSup->interval, pFillInfo); pFillInfo->pos = FILL_POS_END; - pFillInfo->preRowKey = INT64_MIN; } pFillInfo->pResRow = &pFillSup->prev; } break; case TSDB_FILL_NEXT: { if (hasPrevWindow(pFillSup)) { - setFillKeyInfo(prevWKey, ts, &pFillSup->interval, pFillInfo); + TSKEY endTs = adustEndTsKey(ts, pFillSup->cur.key, &pFillSup->interval); + setFillKeyInfo(prevWKey, endTs, &pFillSup->interval, pFillInfo); pFillInfo->pos = FILL_POS_END; resetFillWindow(&pFillSup->next); - pFillSup->next.key = pFillSup->cur.key; + pFillSup->next.key = ts; pFillSup->next.pRowVal = pFillSup->cur.pRowVal; - pFillInfo->preRowKey = INT64_MIN; } else { ASSERT(hasNextWindow(pFillSup)); - setFillKeyInfo(ts, nextWKey, &pFillSup->interval, pFillInfo); + TSKEY startTs = adustPrevTsKey(ts, pFillSup->cur.key, &pFillSup->interval); + setFillKeyInfo(startTs, nextWKey, &pFillSup->interval, pFillInfo); pFillInfo->pos = FILL_POS_START; + resetFillWindow(&pFillSup->prev); } pFillInfo->pResRow = &pFillSup->next; } break; case TSDB_FILL_LINEAR: { if (hasPrevWindow(pFillSup) && hasNextWindow(pFillSup)) { - setFillKeyInfo(prevWKey, ts, &pFillSup->interval, pFillInfo); - pFillInfo->pos = FILL_POS_MID; - pFillInfo->pLinearInfo->nextEnd = nextWKey; - calcRowDeltaData(&pFillSup->cur, pFillInfo->pLinearInfo->pEndPoints, pFillSup->pAllColInfo, + setFillKeyInfo(prevWKey, nextWKey, &pFillSup->interval, pFillInfo); + pFillInfo->pos = FILL_POS_INVALID; + SET_WIN_KEY_INVALID(pFillInfo->pLinearInfo->nextEnd); + pFillSup->next.key = pFillSup->nextOriginKey; + calcRowDeltaData(&pFillSup->next, pFillInfo->pLinearInfo->pEndPoints, pFillSup->pAllColInfo, pFillSup->numOfAllCols); + pFillSup->prev.key = pFillSup->prevOriginKey; pFillInfo->pResRow = &pFillSup->prev; - - calcRowDeltaData(&pFillSup->next, pFillInfo->pLinearInfo->pNextEndPoints, pFillSup->pAllColInfo, - pFillSup->numOfAllCols); - pFillInfo->pLinearInfo->hasNext = true; + pFillInfo->pLinearInfo->hasNext = false; } else if (hasPrevWindow(pFillSup)) { - setFillKeyInfo(prevWKey, ts, &pFillSup->interval, pFillInfo); + TSKEY endTs = adustEndTsKey(ts, pFillSup->cur.key, &pFillSup->interval); + setFillKeyInfo(prevWKey, endTs, &pFillSup->interval, pFillInfo); pFillInfo->pos = FILL_POS_END; - pFillInfo->pLinearInfo->nextEnd = INT64_MIN; + SET_WIN_KEY_INVALID(pFillInfo->pLinearInfo->nextEnd); calcRowDeltaData(&pFillSup->cur, pFillInfo->pLinearInfo->pEndPoints, pFillSup->pAllColInfo, pFillSup->numOfAllCols); + pFillSup->prev.key = pFillSup->prevOriginKey; pFillInfo->pResRow = &pFillSup->prev; pFillInfo->pLinearInfo->hasNext = false; } else { ASSERT(hasNextWindow(pFillSup)); - setFillKeyInfo(ts, nextWKey, &pFillSup->interval, pFillInfo); + TSKEY startTs = adustPrevTsKey(ts, pFillSup->cur.key, &pFillSup->interval); + setFillKeyInfo(startTs, nextWKey, &pFillSup->interval, pFillInfo); pFillInfo->pos = FILL_POS_START; - pFillInfo->pLinearInfo->nextEnd = INT64_MIN; + SET_WIN_KEY_INVALID(pFillInfo->pLinearInfo->nextEnd); + pFillSup->next.key = pFillSup->nextOriginKey; calcRowDeltaData(&pFillSup->next, pFillInfo->pLinearInfo->pEndPoints, pFillSup->pAllColInfo, pFillSup->numOfAllCols); pFillInfo->pResRow = &pFillSup->cur; @@ -656,33 +950,46 @@ static void setTimeSliceFillInfo(SStreamFillSupporter* pFillSup, SStreamFillInfo ASSERT(0); break; } - ASSERT(pFillInfo->pos != FILL_POS_INVALID); + +_end: + if (ts != pFillSup->cur.key) { + SET_WIN_KEY_INVALID(pFillSup->cur.key); + pFillInfo->pos = FILL_POS_INVALID; + } } -static bool needAdjValue(SSlicePoint* pPoint, TSKEY ts, bool isLeft, int32_t fillType) { +static bool needAdjustValue(SSlicePoint* pPoint, TSKEY ts, bool isLeft, int32_t fillType) { + if (IS_INVALID_WIN_KEY(pPoint->key.ts)) { + return false; + } + switch (fillType) { case TSDB_FILL_NULL: case TSDB_FILL_NULL_F: case TSDB_FILL_SET_VALUE: case TSDB_FILL_SET_VALUE_F: { - if (HAS_NON_ROW_DATA(pPoint->pRightRow) && HAS_NON_ROW_DATA(pPoint->pLeftRow)) { + if (!isLeft && HAS_NON_ROW_DATA(pPoint->pRightRow)) { return true; } } break; case TSDB_FILL_PREV: { - if (isLeft && (HAS_NON_ROW_DATA(pPoint->pLeftRow) || pPoint->pLeftRow->key < ts)) { + if (isLeft && (HAS_NON_ROW_DATA(pPoint->pLeftRow) || pPoint->pLeftRow->key <= ts)) { + return true; + } + + if (!isLeft && pPoint->key.ts == ts) { return true; } } break; case TSDB_FILL_NEXT: { - if (!isLeft && (HAS_NON_ROW_DATA(pPoint->pRightRow) || pPoint->pRightRow->key > ts)) { + if (!isLeft && (HAS_NON_ROW_DATA(pPoint->pRightRow) || pPoint->pRightRow->key >= ts)) { return true; } } break; case TSDB_FILL_LINEAR: { - if (isLeft && (HAS_NON_ROW_DATA(pPoint->pLeftRow) || pPoint->pLeftRow->key < ts)) { + if (isLeft && (HAS_NON_ROW_DATA(pPoint->pLeftRow) || pPoint->pLeftRow->key <= ts)) { return true; - } else if (!isLeft && (HAS_NON_ROW_DATA(pPoint->pRightRow) || pPoint->pRightRow->key > ts)) { + } else if (!isLeft && (HAS_NON_ROW_DATA(pPoint->pRightRow) || pPoint->pRightRow->key >= ts)) { return true; } } break; @@ -692,7 +999,31 @@ static bool needAdjValue(SSlicePoint* pPoint, TSKEY ts, bool isLeft, int32_t fil return false; } +static void transBlockToResultRow(const SSDataBlock* pBlock, int32_t rowId, TSKEY ts, SSliceRowData* pRowVal) { + int32_t numOfCols = taosArrayGetSize(pBlock->pDataBlock); + for (int32_t i = 0; i < numOfCols; ++i) { + SColumnInfoData* pColData = taosArrayGet(pBlock->pDataBlock, i); + SResultCellData* pCell = getSliceResultCell(pRowVal->pRowVal, i); + if (!colDataIsNull_s(pColData, rowId)) { + pCell->isNull = false; + pCell->type = pColData->info.type; + pCell->bytes = pColData->info.bytes; + char* val = colDataGetData(pColData, rowId); + if (IS_VAR_DATA_TYPE(pCell->type)) { + memcpy(pCell->pData, val, varDataTLen(val)); + } else { + memcpy(pCell->pData, val, pCell->bytes); + } + } else { + pCell->isNull = true; + } + } + pRowVal->key = ts; +} + static void doStreamTimeSliceImpl(SOperatorInfo* pOperator, SSDataBlock* pBlock) { + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; int32_t winCode = TSDB_CODE_SUCCESS; SStreamTimeSliceOperatorInfo* pInfo = (SStreamTimeSliceOperatorInfo*)pOperator->info; SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; @@ -713,7 +1044,7 @@ static void doStreamTimeSliceImpl(SOperatorInfo* pOperator, SSDataBlock* pBlock) pFillSup->winRange = pTaskInfo->streamInfo.fillHistoryWindow; if (pFillSup->winRange.ekey <= 0) { - pFillSup->winRange.ekey = INT64_MIN; + pFillSup->winRange.ekey = INT64_MAX; } int32_t startPos = 0; @@ -733,6 +1064,7 @@ static void doStreamTimeSliceImpl(SOperatorInfo* pOperator, SSDataBlock* pBlock) if (checkNullRow(pExprSup, pBlock, startPos, pInfo->ignoreNull)) { continue; } + break; } if (startPos >= pBlock->info.rows) { @@ -742,13 +1074,18 @@ static void doStreamTimeSliceImpl(SOperatorInfo* pOperator, SSDataBlock* pBlock) SResultRowInfo dumyInfo = {0}; dumyInfo.cur.pageId = -1; STimeWindow curWin = getActiveTimeWindow(NULL, &dumyInfo, tsCols[startPos], &pFillSup->interval, TSDB_ORDER_ASC); - SSlicePoint curPoint = {.key.ts = curWin.skey, .key.groupId = groupId}; - SSlicePoint prevPoint = {0}; + SSlicePoint curPoint = {0}; SSlicePoint nextPoint = {0}; bool left = false; bool right = false; - getPointInfoFromState(pAggSup, pFillSup, curWin.skey, groupId, &curPoint, &prevPoint, &nextPoint, &winCode); - right = needAdjValue(&curPoint, tsCols[startPos], false, pFillSup->type); + if (pFillSup->type != TSDB_FILL_PREV || curWin.skey == tsCols[startPos]) { + code = getPointInfoFromState(pAggSup, pFillSup, curWin.skey, groupId, &curPoint, &nextPoint, &winCode); + } else { + code = getPointInfoFromStateRight(pAggSup, pFillSup, curWin.skey, groupId, &curPoint, &nextPoint, &winCode); + } + QUERY_CHECK_CODE(code, lino, _end); + + right = needAdjustValue(&curPoint, tsCols[startPos], false, pFillSup->type); if (right) { transBlockToResultRow(pBlock, startPos, tsCols[startPos], curPoint.pRightRow); saveTimeSliceWinResult(&curPoint.key, pInfo->pUpdatedMap); @@ -763,7 +1100,7 @@ static void doStreamTimeSliceImpl(SOperatorInfo* pOperator, SSDataBlock* pBlock) TSDB_ORDER_ASC); startPos += numOfWin; int32_t leftRowId = getQualifiedRowNumDesc(pExprSup, pBlock, tsCols, startPos - 1, pInfo->ignoreNull); - left = needAdjValue(&nextPoint, tsCols[leftRowId], true, pFillSup->type); + left = needAdjustValue(&nextPoint, tsCols[leftRowId], true, pFillSup->type); if (left) { transBlockToResultRow(pBlock, leftRowId, tsCols[leftRowId], nextPoint.pLeftRow); saveTimeSliceWinResult(&nextPoint.key, pInfo->pUpdatedMap); @@ -778,9 +1115,14 @@ static void doStreamTimeSliceImpl(SOperatorInfo* pOperator, SSDataBlock* pBlock) break; } curWin = getActiveTimeWindow(NULL, &dumyInfo, tsCols[startPos], &pFillSup->interval, TSDB_ORDER_ASC); - getPointInfoFromState(pAggSup, pFillSup, curWin.skey, groupId, &curPoint, &prevPoint, &nextPoint, &winCode); + if (pFillSup->type != TSDB_FILL_PREV || curWin.skey == tsCols[startPos]) { + code = getPointInfoFromState(pAggSup, pFillSup, curWin.skey, groupId, &curPoint, &nextPoint, &winCode); + } else { + code = getPointInfoFromStateRight(pAggSup, pFillSup, curWin.skey, groupId, &curPoint, &nextPoint, &winCode); + } + QUERY_CHECK_CODE(code, lino, _end); - right = needAdjValue(&curPoint, tsCols[startPos], false, pFillSup->type); + right = needAdjustValue(&curPoint, tsCols[startPos], false, pFillSup->type); if (right) { transBlockToResultRow(pBlock, startPos, tsCols[startPos], curPoint.pRightRow); saveTimeSliceWinResult(&curPoint.key, pInfo->pUpdatedMap); @@ -790,10 +1132,17 @@ static void doStreamTimeSliceImpl(SOperatorInfo* pOperator, SSDataBlock* pBlock) } releaseOutputBuf(pAggSup->pState, curPoint.pResPos, &pAggSup->stateStore); } + +_end: + if (code != TSDB_CODE_SUCCESS) { + qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } } void doBuildTimeSlicePointResult(SStreamAggSupporter* pAggSup, SStreamFillSupporter* pFillSup, SStreamFillInfo* pFillInfo, SSDataBlock* pBlock, SGroupResInfo* pGroupResInfo) { + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; blockDataCleanup(pBlock); if (!hasRemainResults(pGroupResInfo)) { return; @@ -803,8 +1152,7 @@ void doBuildTimeSlicePointResult(SStreamAggSupporter* pAggSup, SStreamFillSuppor pBlock->info.id.groupId = 0; int32_t numOfRows = getNumOfTotalRes(pGroupResInfo); for (; pGroupResInfo->index < numOfRows; pGroupResInfo->index++) { - SRowBuffPos* pPos = *(SRowBuffPos**)taosArrayGet(pGroupResInfo->pRows, pGroupResInfo->index); - SWinKey* pKey = (SWinKey*)pPos->pKey; + SWinKey* pKey = (SWinKey*)taosArrayGet(pGroupResInfo->pRows, pGroupResInfo->index); if (pBlock->info.id.groupId == 0) { pBlock->info.id.groupId = pKey->groupId; } else if (pBlock->info.id.groupId != pKey->groupId) { @@ -814,14 +1162,27 @@ void doBuildTimeSlicePointResult(SStreamAggSupporter* pAggSup, SStreamFillSuppor SSlicePoint curPoint = {.key.ts = pKey->ts, .key.groupId = pKey->groupId}; SSlicePoint prevPoint = {0}; SSlicePoint nextPoint = {0}; - int32_t winCode = TSDB_CODE_SUCCESS; - getPointInfoFromState(pAggSup, pFillSup, pKey->ts, pKey->groupId, &curPoint, &prevPoint, &nextPoint, &winCode); - setTimeSliceFillInfo(pFillSup, pFillInfo, pKey->ts); + int32_t winCode = TSDB_CODE_SUCCESS; + if (pFillSup->type != TSDB_FILL_LINEAR) { + code = getResultInfoFromState(pAggSup, pFillSup, pKey->ts, pKey->groupId, &curPoint, &prevPoint, &nextPoint, + &winCode); + } else { + code = getLinearResultInfoFromState(pAggSup, pFillSup, pKey->ts, pKey->groupId, &curPoint, &prevPoint, &nextPoint, + &winCode); + } + QUERY_CHECK_CODE(code, lino, _end); + + setTimeSliceFillRule(pFillSup, pFillInfo, pKey->ts); doStreamFillRange(pFillSup, pFillInfo, pBlock); releaseOutputBuf(pAggSup->pState, curPoint.pResPos, &pAggSup->stateStore); releaseOutputBuf(pAggSup->pState, prevPoint.pResPos, &pAggSup->stateStore); releaseOutputBuf(pAggSup->pState, nextPoint.pResPos, &pAggSup->stateStore); } + +_end: + if (code != TSDB_CODE_SUCCESS) { + qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } } static int32_t buildTimeSliceResult(SOperatorInfo* pOperator, SSDataBlock** ppRes) { @@ -906,7 +1267,8 @@ static int32_t doDeleteTimeSliceResult(SStreamAggSupporter* pAggSup, SSDataBlock uint64_t groupId = groupIds[i]; SWinKey key = {.ts = ts, .groupId = groupId}; SWinKey nextKey = {.groupId = groupId}; - winCode = pAggSup->stateStore.streamStateFillGetNext(pAggSup->pState, &key, &nextKey, NULL, NULL); + code = pAggSup->stateStore.streamStateFillGetNext(pAggSup->pState, &key, &nextKey, NULL, NULL, &winCode); + QUERY_CHECK_CODE(code, lino, _end); if (key.ts > endTs) { break; } @@ -970,6 +1332,7 @@ static int32_t doStreamTimeSliceNext(SOperatorInfo* pOperator, SSDataBlock** ppR } setStreamOperatorCompleted(pOperator); + resetStreamFillSup(pInfo->pFillSup); (*ppRes) = NULL; goto _end; } @@ -1029,7 +1392,8 @@ static int32_t doStreamTimeSliceNext(SOperatorInfo* pOperator, SSDataBlock** ppR void* pIte = NULL; int32_t iter = 0; while ((pIte = tSimpleHashIterate(pInfo->pUpdatedMap, pIte, &iter)) != NULL) { - void* tmp = taosArrayPush(pInfo->pUpdated, pIte); + SWinKey* pKey = (SWinKey*)tSimpleHashGetKey(pIte, NULL); + void* tmp = taosArrayPush(pInfo->pUpdated, pKey); QUERY_CHECK_NULL(tmp, code, lino, _end, terrno); } taosArraySort(pInfo->pUpdated, winKeyCmprImpl); @@ -1040,16 +1404,24 @@ static int32_t doStreamTimeSliceNext(SOperatorInfo* pOperator, SSDataBlock** ppR } initMultiResInfoFromArrayList(&pInfo->groupResInfo, pInfo->pUpdated); - pInfo->pUpdated = NULL; + pInfo->pUpdated = taosArrayInit(16, sizeof(SWinKey)); + QUERY_CHECK_NULL(pInfo->pUpdated, code, lino, _end, terrno); + code = blockDataEnsureCapacity(pInfo->pRes, pOperator->resultInfo.capacity); QUERY_CHECK_CODE(code, lino, _end); tSimpleHashCleanup(pInfo->pUpdatedMap); - pInfo->pUpdatedMap = NULL; + _hash_fn_t hashFn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY); + pInfo->pUpdatedMap = tSimpleHashInit(1024, hashFn); code = buildTimeSliceResult(pOperator, ppRes); QUERY_CHECK_CODE(code, lino, _end); + if (!(*ppRes)) { + setStreamOperatorCompleted(pOperator); + resetStreamFillSup(pInfo->pFillSup); + } + _end: if (code != TSDB_CODE_SUCCESS) { qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); @@ -1063,6 +1435,55 @@ static SSDataBlock* doStreamTimeSlice(SOperatorInfo* pOperator) { return pRes; } +static void setValueForFillInfo(SStreamFillSupporter* pFillSup, SStreamFillInfo* pFillInfo) { + if (pFillInfo->type == TSDB_FILL_SET_VALUE || pFillInfo->type == TSDB_FILL_SET_VALUE_F) { + int32_t valueIndex = 0; + for (int32_t i = 0; i < pFillSup->numOfAllCols; ++i) { + SFillColInfo* pFillCol = pFillSup->pAllColInfo + i; + if (!isInterpFunc(pFillCol->pExpr)) { + continue; + } + int32_t srcSlot = pFillCol->pExpr->base.pParam[0].pCol->slotId; + SResultCellData* pCell = getResultCell(pFillInfo->pResRow, srcSlot); + SFillColInfo* pValueCol = pFillSup->pAllColInfo + valueIndex; + SVariant* pVar = &(pValueCol->fillVal); + if (pCell->type == TSDB_DATA_TYPE_FLOAT) { + float v = 0; + GET_TYPED_DATA(v, float, pVar->nType, &pVar->i); + SET_TYPED_DATA(pCell->pData, pCell->type, v); + } else if (IS_FLOAT_TYPE(pCell->type)) { + double v = 0; + GET_TYPED_DATA(v, double, pVar->nType, &pVar->i); + SET_TYPED_DATA(pCell->pData, pCell->type, v); + } else if (IS_INTEGER_TYPE(pCell->type)) { + int64_t v = 0; + GET_TYPED_DATA(v, int64_t, pVar->nType, &pVar->i); + SET_TYPED_DATA(pCell->pData, pCell->type, v); + } else { + pCell->isNull = true; + } + valueIndex++; + } + } else if (pFillInfo->type == TSDB_FILL_NULL || pFillInfo->type == TSDB_FILL_NULL_F) { + for (int32_t i = 0; i < pFillSup->numOfAllCols; ++i) { + SFillColInfo* pFillCol = pFillSup->pAllColInfo + i; + int32_t slotId = GET_DEST_SLOT_ID(pFillCol); + SResultCellData* pCell = getResultCell(pFillInfo->pResRow, slotId); + pCell->isNull = true; + } + } +} + +int32_t getDownstreamRes(SOperatorInfo* downstream, SSDataBlock** ppRes) { + if (downstream->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN) { + SStreamScanInfo* pInfo = (SStreamScanInfo*)downstream->info; + *ppRes = pInfo->pRes; + return TSDB_CODE_SUCCESS; + } + qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(TSDB_CODE_FAILED)); + return TSDB_CODE_FAILED; +} + int32_t createStreamTimeSliceOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo, SReadHandle* pHandle, SOperatorInfo** ppOptInfo) { int32_t code = TSDB_CODE_SUCCESS; @@ -1101,9 +1522,20 @@ int32_t createStreamTimeSliceOperatorInfo(SOperatorInfo* downstream, SPhysiNode* }; pInfo->primaryTsIndex = ((SColumnNode*)pInterpPhyNode->pTimeSeries)->slotId; - code = initStreamAggSupporter(&pInfo->streamAggSup, pExpSup, numOfExprs, 0, pTaskInfo->streamInfo.pState, - sizeof(COUNT_TYPE), 0, &pTaskInfo->storageAPI.stateStore, pHandle, &pInfo->twAggSup, - GET_TASKID(pTaskInfo), &pTaskInfo->storageAPI, pInfo->primaryTsIndex); + + pInfo->pFillSup = NULL; + code = initTimeSliceFillSup(pInterpPhyNode, pExprInfo, numOfExprs, &pInfo->pFillSup); + QUERY_CHECK_CODE(code, lino, _error); + + int32_t ratio = 1; + if (pInfo->pFillSup->type == TSDB_FILL_LINEAR) { + ratio = 2; + } + + code = + initStreamAggSupporter(&pInfo->streamAggSup, pExpSup, numOfExprs, 0, pTaskInfo->streamInfo.pState, sizeof(TSKEY), + 0, &pTaskInfo->storageAPI.stateStore, pHandle, &pInfo->twAggSup, GET_TASKID(pTaskInfo), + &pTaskInfo->storageAPI, pInfo->primaryTsIndex, STREAM_STATE_BUFF_HASH_SORT, ratio); QUERY_CHECK_CODE(code, lino, _error); initExecTimeWindowInfo(&pInfo->twAggSup.timeWindowData, &pTaskInfo->window); @@ -1123,8 +1555,8 @@ int32_t createStreamTimeSliceOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pInfo->ignoreExpiredData = pInterpPhyNode->streamNodeOption.igExpired; pInfo->ignoreExpiredDataSaved = false; - pInfo->pUpdated = NULL; - pInfo->pUpdatedMap = NULL; + pInfo->pUpdated = taosArrayInit(64, sizeof(SWinKey)); + pInfo->pUpdatedMap = tSimpleHashInit(1024, hashFn); pInfo->historyPoints = taosArrayInit(4, sizeof(SWinKey)); QUERY_CHECK_NULL(pInfo->historyPoints, code, lino, _error, terrno); @@ -1135,10 +1567,14 @@ int32_t createStreamTimeSliceOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pInfo->destHasPrimaryKey = pInterpPhyNode->streamNodeOption.destHasPrimaryKey; pInfo->numOfDatapack = 0; - pInfo->pFillSup = NULL; - code = initTimeSliceFillSup(pInterpPhyNode, pExprInfo, numOfExprs, &pInfo->pFillSup); + + SSDataBlock* pDownRes = NULL; + code = getDownstreamRes(downstream, &pDownRes); QUERY_CHECK_CODE(code, lino, _error); + pInfo->pFillInfo = initStreamFillInfo(pInfo->pFillSup, pDownRes); + setValueForFillInfo(pInfo->pFillSup, pInfo->pFillInfo); + if (pHandle) { pInfo->isHistoryOp = pHandle->fillHistory; } @@ -1162,7 +1598,7 @@ int32_t createStreamTimeSliceOperatorInfo(SOperatorInfo* downstream, SPhysiNode* setOperatorStreamStateFn(pOperator, streamTimeSliceReleaseState, streamTimeSliceReloadState); if (downstream) { - if (downstream->operatorType != QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN) { + if (downstream->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN) { SStreamScanInfo* pScanInfo = downstream->info; pScanInfo->igCheckUpdate = true; } diff --git a/source/libs/executor/src/streamtimewindowoperator.c b/source/libs/executor/src/streamtimewindowoperator.c index af2b45bf132f..fc9c8f751304 100644 --- a/source/libs/executor/src/streamtimewindowoperator.c +++ b/source/libs/executor/src/streamtimewindowoperator.c @@ -394,7 +394,8 @@ static void doBuildDeleteResult(SStreamIntervalOperatorInfo* pInfo, SArray* pWin doBuildDeleteResultImpl(&pInfo->stateStore, pInfo->pState, pWins, index, pBlock); } -void doBuildDeleteResultImpl(SStateStore* pAPI, SStreamState* pState, SArray* pWins, int32_t* index, SSDataBlock* pBlock) { +void doBuildDeleteResultImpl(SStateStore* pAPI, SStreamState* pState, SArray* pWins, int32_t* index, + SSDataBlock* pBlock) { int32_t code = TSDB_CODE_SUCCESS; int32_t lino = 0; blockDataCleanup(pBlock); @@ -1852,9 +1853,8 @@ void streamIntervalReloadState(SOperatorInfo* pOperator) { } } -int32_t createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pPhyNode, - SExecTaskInfo* pTaskInfo, int32_t numOfChild, - SReadHandle* pHandle, SOperatorInfo** pOptrInfo) { +int32_t createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo, + int32_t numOfChild, SReadHandle* pHandle, SOperatorInfo** pOptrInfo) { QRY_OPTR_CHECK(pOptrInfo); int32_t code = TSDB_CODE_SUCCESS; @@ -2121,8 +2121,8 @@ static TSKEY sesionTs(void* pKey) { int32_t initStreamAggSupporter(SStreamAggSupporter* pSup, SExprSupp* pExpSup, int32_t numOfOutput, int64_t gap, SStreamState* pState, int32_t keySize, int16_t keyType, SStateStore* pStore, SReadHandle* pHandle, STimeWindowAggSupp* pTwAggSup, const char* taskIdStr, - SStorageAPI* pApi, int32_t tsIndex) { - pSup->resultRowSize = keySize + getResultRowSize(pExpSup->pCtx, numOfOutput); + SStorageAPI* pApi, int32_t tsIndex, int8_t stateType, int32_t ratio) { + pSup->resultRowSize = (keySize + getResultRowSize(pExpSup->pCtx, numOfOutput)) * ratio; int32_t code = createSpecialDataBlock(STREAM_CLEAR, &pSup->pScanBlock); if (code) { @@ -2144,9 +2144,15 @@ int32_t initStreamAggSupporter(SStreamAggSupporter* pSup, SExprSupp* pExpSup, in *(pSup->pState) = *pState; pSup->stateStore.streamStateSetNumber(pSup->pState, -1, tsIndex); int32_t funResSize = getMaxFunResSize(pExpSup, numOfOutput); - pSup->pState->pFileState = pSup->stateStore.streamFileStateInit( - tsStreamBufferSize, sizeof(SSessionKey), pSup->resultRowSize, funResSize, sesionTs, pSup->pState, - pTwAggSup->deleteMark, taskIdStr, pHandle->checkpointId, STREAM_STATE_BUFF_SORT); + if (stateType == STREAM_STATE_BUFF_SORT) { + pSup->pState->pFileState = pSup->stateStore.streamFileStateInit( + tsStreamBufferSize, sizeof(SSessionKey), pSup->resultRowSize, funResSize, sesionTs, pSup->pState, + pTwAggSup->deleteMark, taskIdStr, pHandle->checkpointId, stateType); + } else if (stateType == STREAM_STATE_BUFF_HASH_SORT) { + pSup->pState->pFileState = pSup->stateStore.streamFileStateInit( + tsStreamBufferSize, sizeof(SWinKey), pSup->resultRowSize, funResSize, compareTs, pSup->pState, + pTwAggSup->deleteMark, taskIdStr, pHandle->checkpointId, stateType); + } _hash_fn_t hashFn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY); pSup->pResultRows = tSimpleHashInit(32, hashFn); @@ -3682,8 +3688,8 @@ void streamSessionReloadState(SOperatorInfo* pOperator) { } } -int32_t createStreamSessionAggOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pPhyNode, - SExecTaskInfo* pTaskInfo, SReadHandle* pHandle, SOperatorInfo** pOptrInfo) { +int32_t createStreamSessionAggOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo, + SReadHandle* pHandle, SOperatorInfo** pOptrInfo) { QRY_OPTR_CHECK(pOptrInfo); SSessionWinodwPhysiNode* pSessionNode = (SSessionWinodwPhysiNode*)pPhyNode; @@ -3726,9 +3732,10 @@ int32_t createStreamSessionAggOperatorInfo(SOperatorInfo* downstream, SPhysiNode }; pInfo->primaryTsIndex = ((SColumnNode*)pSessionNode->window.pTspk)->slotId; - code = initStreamAggSupporter(&pInfo->streamAggSup, pExpSup, numOfCols, pSessionNode->gap, - pTaskInfo->streamInfo.pState, 0, 0, &pTaskInfo->storageAPI.stateStore, pHandle, - &pInfo->twAggSup, GET_TASKID(pTaskInfo), &pTaskInfo->storageAPI, pInfo->primaryTsIndex); + code = + initStreamAggSupporter(&pInfo->streamAggSup, pExpSup, numOfCols, pSessionNode->gap, pTaskInfo->streamInfo.pState, + 0, 0, &pTaskInfo->storageAPI.stateStore, pHandle, &pInfo->twAggSup, GET_TASKID(pTaskInfo), + &pTaskInfo->storageAPI, pInfo->primaryTsIndex, STREAM_STATE_BUFF_SORT, 1); if (code != TSDB_CODE_SUCCESS) { goto _error; } @@ -3993,8 +4000,8 @@ static SSDataBlock* doStreamSessionSemiAgg(SOperatorInfo* pOperator) { } int32_t createStreamFinalSessionAggOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pPhyNode, - SExecTaskInfo* pTaskInfo, int32_t numOfChild, - SReadHandle* pHandle, SOperatorInfo** pOptrInfo) { + SExecTaskInfo* pTaskInfo, int32_t numOfChild, SReadHandle* pHandle, + SOperatorInfo** pOptrInfo) { QRY_OPTR_CHECK(pOptrInfo); int32_t code = TSDB_CODE_SUCCESS; @@ -4870,9 +4877,10 @@ int32_t createStreamStateAggOperatorInfo(SOperatorInfo* downstream, SPhysiNode* int32_t keySize = sizeof(SStateKeys) + pColNode->node.resType.bytes; int16_t type = pColNode->node.resType.type; pInfo->primaryTsIndex = tsSlotId; - code = initStreamAggSupporter(&pInfo->streamAggSup, pExpSup, numOfCols, 0, pTaskInfo->streamInfo.pState, keySize, - type, &pTaskInfo->storageAPI.stateStore, pHandle, &pInfo->twAggSup, - GET_TASKID(pTaskInfo), &pTaskInfo->storageAPI, pInfo->primaryTsIndex); + code = + initStreamAggSupporter(&pInfo->streamAggSup, pExpSup, numOfCols, 0, pTaskInfo->streamInfo.pState, keySize, type, + &pTaskInfo->storageAPI.stateStore, pHandle, &pInfo->twAggSup, GET_TASKID(pTaskInfo), + &pTaskInfo->storageAPI, pInfo->primaryTsIndex, STREAM_STATE_BUFF_SORT, 1); QUERY_CHECK_CODE(code, lino, _error); _hash_fn_t hashFn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY); @@ -5229,7 +5237,7 @@ int32_t createStreamIntervalOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pInfo->recvGetAll = false; code = createSpecialDataBlock(STREAM_CHECKPOINT, &pInfo->pCheckpointRes); - QUERY_CHECK_CODE(code, lino, _error); + QUERY_CHECK_CODE(code, lino, _error); _hash_fn_t hashFn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY); pInfo->pDeletedMap = tSimpleHashInit(4096, hashFn); @@ -5643,6 +5651,7 @@ static SSDataBlock* doStreamMidIntervalAgg(SOperatorInfo* pOperator) { } void setStreamOperatorCompleted(SOperatorInfo* pOperator) { - qDebug("stask:%s %s status: %d. set completed", GET_TASKID(pOperator->pTaskInfo), getStreamOpName(pOperator->operatorType), pOperator->status); + qDebug("stask:%s %s status: %d. set completed", GET_TASKID(pOperator->pTaskInfo), + getStreamOpName(pOperator->operatorType), pOperator->status); setOperatorCompleted(pOperator); } diff --git a/source/libs/executor/src/timesliceoperator.c b/source/libs/executor/src/timesliceoperator.c index e55a8f028f97..00ec1203bac2 100644 --- a/source/libs/executor/src/timesliceoperator.c +++ b/source/libs/executor/src/timesliceoperator.c @@ -227,7 +227,7 @@ static bool checkDuplicateTimestamps(STimeSliceOperatorInfo* pSliceInfo, SColumn return false; } -static bool isInterpFunc(SExprInfo* pExprInfo) { +bool isInterpFunc(SExprInfo* pExprInfo) { int32_t functionType = pExprInfo->pExpr->_function.functionType; return (functionType == FUNCTION_TYPE_INTERP); } diff --git a/source/libs/nodes/src/nodesCloneFuncs.c b/source/libs/nodes/src/nodesCloneFuncs.c index f0a6489a8fff..18d17cc70200 100644 --- a/source/libs/nodes/src/nodesCloneFuncs.c +++ b/source/libs/nodes/src/nodesCloneFuncs.c @@ -657,6 +657,8 @@ static int32_t logicInterpFuncCopy(const SInterpFuncLogicNode* pSrc, SInterpFunc CLONE_NODE_LIST_FIELD(pFuncs); COPY_OBJECT_FIELD(timeRange, sizeof(STimeWindow)); COPY_SCALAR_FIELD(interval); + COPY_SCALAR_FIELD(intervalUnit); + COPY_SCALAR_FIELD(precision); COPY_SCALAR_FIELD(fillMode); CLONE_NODE_FIELD(pFillValues); CLONE_NODE_FIELD(pTimeSeries); diff --git a/source/libs/nodes/src/nodesCodeFuncs.c b/source/libs/nodes/src/nodesCodeFuncs.c index 308186f2c71c..da8168beb170 100644 --- a/source/libs/nodes/src/nodesCodeFuncs.c +++ b/source/libs/nodes/src/nodesCodeFuncs.c @@ -1272,6 +1272,8 @@ static const char* jkInterpFuncLogicPlanFuncs = "Funcs"; static const char* jkInterpFuncLogicPlanStartTime = "StartTime"; static const char* jkInterpFuncLogicPlanEndTime = "EndTime"; static const char* jkInterpFuncLogicPlanInterval = "Interval"; +static const char* jkInterpFuncLogicPlanIntervalUnit = "IntervalUnit"; +static const char* jkInterpFuncLogicPlanPrecision = "Precision"; static const char* jkInterpFuncLogicPlanFillMode = "fillMode"; static const char* jkInterpFuncLogicPlanFillValues = "FillValues"; static const char* jkInterpFuncLogicPlanTimeSeries = "TimeSeries"; @@ -1293,6 +1295,12 @@ static int32_t logicInterpFuncNodeToJson(const void* pObj, SJson* pJson) { if (TSDB_CODE_SUCCESS == code) { code = tjsonAddIntegerToObject(pJson, jkInterpFuncLogicPlanInterval, pNode->interval); } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonAddIntegerToObject(pJson, jkInterpFuncLogicPlanIntervalUnit, pNode->intervalUnit); + } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonAddIntegerToObject(pJson, jkInterpFuncLogicPlanPrecision, pNode->precision); + } if (TSDB_CODE_SUCCESS == code) { code = tjsonAddIntegerToObject(pJson, jkInterpFuncLogicPlanFillMode, pNode->fillMode); } @@ -1325,6 +1333,12 @@ static int32_t jsonToLogicInterpFuncNode(const SJson* pJson, void* pObj) { if (TSDB_CODE_SUCCESS == code) { code = tjsonGetBigIntValue(pJson, jkInterpFuncLogicPlanInterval, &pNode->interval); } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonGetTinyIntValue(pJson, jkInterpFuncLogicPlanIntervalUnit, &pNode->intervalUnit); + } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonGetTinyIntValue(pJson, jkInterpFuncLogicPlanPrecision, &pNode->precision); + } if (TSDB_CODE_SUCCESS == code) { code = tjsonGetTinyIntValue(pJson, jkInterpFuncLogicPlanFillMode, (int8_t*)&pNode->fillMode); } @@ -3211,6 +3225,8 @@ static const char* jkInterpFuncPhysiPlanFuncs = "Funcs"; static const char* jkInterpFuncPhysiPlanStartTime = "StartTime"; static const char* jkInterpFuncPhysiPlanEndTime = "EndTime"; static const char* jkInterpFuncPhysiPlanInterval = "Interval"; +static const char* jkInterpFuncPhysiPlanIntervalUnit = "intervalUnit"; +static const char* jkInterpFuncPhysiPlanPrecision = "precision"; static const char* jkInterpFuncPhysiPlanFillMode = "FillMode"; static const char* jkInterpFuncPhysiPlanFillValues = "FillValues"; static const char* jkInterpFuncPhysiPlanTimeSeries = "TimeSeries"; @@ -3235,6 +3251,12 @@ static int32_t physiInterpFuncNodeToJson(const void* pObj, SJson* pJson) { if (TSDB_CODE_SUCCESS == code) { code = tjsonAddIntegerToObject(pJson, jkInterpFuncPhysiPlanInterval, pNode->interval); } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonAddIntegerToObject(pJson, jkInterpFuncPhysiPlanIntervalUnit, pNode->intervalUnit); + } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonAddIntegerToObject(pJson, jkInterpFuncPhysiPlanPrecision, pNode->precision); + } if (TSDB_CODE_SUCCESS == code) { code = tjsonAddIntegerToObject(pJson, jkInterpFuncPhysiPlanFillMode, pNode->fillMode); } @@ -3270,6 +3292,12 @@ static int32_t jsonToPhysiInterpFuncNode(const SJson* pJson, void* pObj) { if (TSDB_CODE_SUCCESS == code) { code = tjsonGetBigIntValue(pJson, jkInterpFuncPhysiPlanInterval, &pNode->interval); } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonGetTinyIntValue(pJson, jkInterpFuncPhysiPlanIntervalUnit, &pNode->intervalUnit); + } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonGetTinyIntValue(pJson, jkInterpFuncPhysiPlanPrecision, &pNode->precision); + } if (TSDB_CODE_SUCCESS == code) { tjsonGetNumberValue(pJson, jkInterpFuncPhysiPlanFillMode, pNode->fillMode, code); } @@ -5708,6 +5736,8 @@ static const char* jkSelectStmtSlimit = "Slimit"; static const char* jkSelectStmtStmtName = "StmtName"; static const char* jkSelectStmtHasAggFuncs = "HasAggFuncs"; static const char* jkSelectStmtInterpFuncs = "HasInterpFuncs"; +static const char* jkSelectStmtInterpFill = "InterpFill"; +static const char* jkSelectStmtInterpEvery = "InterpEvery"; static int32_t selectStmtToJson(const void* pObj, SJson* pJson) { const SSelectStmt* pNode = (const SSelectStmt*)pObj; @@ -5758,6 +5788,12 @@ static int32_t selectStmtToJson(const void* pObj, SJson* pJson) { if (TSDB_CODE_SUCCESS == code) { code = tjsonAddBoolToObject(pJson, jkSelectStmtInterpFuncs, pNode->hasInterpFunc); } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonAddObject(pJson, jkSelectStmtInterpFill, nodeToJson, pNode->pFill); + } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonAddObject(pJson, jkSelectStmtInterpEvery, nodeToJson, pNode->pEvery); + } return code; } @@ -5811,6 +5847,12 @@ static int32_t jsonToSelectStmt(const SJson* pJson, void* pObj) { if (TSDB_CODE_SUCCESS == code) { code = tjsonGetBoolValue(pJson, jkSelectStmtInterpFuncs, &pNode->hasInterpFunc); } + if (TSDB_CODE_SUCCESS == code) { + code = jsonToNodeObject(pJson, jkSelectStmtInterpFill, &pNode->pFill); + } + if (TSDB_CODE_SUCCESS == code) { + code = jsonToNodeObject(pJson, jkSelectStmtInterpEvery, &pNode->pEvery); + } return code; } diff --git a/source/libs/stream/src/streamSliceState.c b/source/libs/stream/src/streamSliceState.c index 3a843a881f84..5dfc6e03e183 100644 --- a/source/libs/stream/src/streamSliceState.c +++ b/source/libs/stream/src/streamSliceState.c @@ -27,9 +27,13 @@ int fillStateKeyCompare(const void* pWin1, const void* pDatas, int pos) { return winKeyCmprImpl((SWinKey*)pWin1, pWin2); } -int32_t getHashSortRowBuff(SStreamFileState* pFileState, const SWinKey* pKey, void** pVal, int32_t* pVLen) { - int32_t winCode = TSDB_CODE_SUCCESS; - int32_t code = getRowBuff(pFileState, (void*)pKey, sizeof(SWinKey), pVal, pVLen, &winCode); +int32_t getHashSortRowBuff(SStreamFileState* pFileState, const SWinKey* pKey, void** pVal, int32_t* pVLen, + int32_t* pWinCode) { + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; + + code = getRowBuff(pFileState, (void*)pKey, sizeof(SWinKey), pVal, pVLen, pWinCode); + QUERY_CHECK_CODE(code, lino, _end); SArray* pWinStates = NULL; SSHashObj* pSearchBuff = getSearchBuff(pFileState); @@ -38,23 +42,26 @@ int32_t getHashSortRowBuff(SStreamFileState* pFileState, const SWinKey* pKey, vo pWinStates = (SArray*)(*ppBuff); } else { pWinStates = taosArrayInit(16, sizeof(SWinKey)); - tSimpleHashPut(pSearchBuff, &pKey->groupId, sizeof(uint64_t), &pWinStates, POINTER_BYTES); + QUERY_CHECK_NULL(pWinStates, code, lino, _end, terrno); + + code = tSimpleHashPut(pSearchBuff, &pKey->groupId, sizeof(uint64_t), &pWinStates, POINTER_BYTES); + QUERY_CHECK_CODE(code, lino, _end); } - //recover + // recover if (taosArrayGetSize(pWinStates) == 0 && needClearDiskBuff(pFileState)) { - TSKEY ts = getFlushMark(pFileState); - SWinKey start = {.groupId = pKey->groupId, .ts = INT64_MAX}; - void* pState = getStateFileStore(pFileState); + TSKEY ts = getFlushMark(pFileState); + SWinKey start = {.groupId = pKey->groupId, .ts = INT64_MAX}; + void* pState = getStateFileStore(pFileState); SStreamStateCur* pCur = streamStateFillSeekKeyPrev_rocksdb(pState, &start); - int32_t winCode = TSDB_CODE_SUCCESS; - for(int32_t i = 0; i < NUM_OF_FLUSED_WIN && winCode == TSDB_CODE_SUCCESS; i++) { - SWinKey tmp = {.groupId = pKey->groupId}; - winCode = streamStateGetGroupKVByCur_rocksdb(pCur, &tmp, NULL, 0); - if (winCode != TSDB_CODE_SUCCESS) { + for (int32_t i = 0; i < NUM_OF_FLUSED_WIN; i++) { + SWinKey tmpKey = {.groupId = pKey->groupId}; + int32_t tmpRes = streamStateGetGroupKVByCur_rocksdb(pCur, &tmpKey, NULL, 0); + if (tmpRes != TSDB_CODE_SUCCESS) { break; } - taosArrayPush(pWinStates, &tmp); + void* tmp = taosArrayPush(pWinStates, &tmp); + QUERY_CHECK_NULL(tmp, code, lino, _end, terrno); streamStateCurPrev_rocksdb(pCur); } taosArraySort(pWinStates, winKeyCmprImpl); @@ -65,13 +72,20 @@ int32_t getHashSortRowBuff(SStreamFileState* pFileState, const SWinKey* pKey, vo if (!isFlushedState(pFileState, pKey->ts, 0)) { // find the first position which is smaller than the pKey int32_t index = binarySearch(pWinStates, size, pKey, fillStateKeyCompare); - if (index == -1) { - index = 0; - } - SWinKey* pTmpKey = taosArrayGet(pWinStates, index); - if (winKeyCmprImpl(pTmpKey, pKey) != 0) { - taosArrayInsert(pWinStates, index, pKey); + if (index >= 0) { + SWinKey* pTmpKey = taosArrayGet(pWinStates, index); + if (winKeyCmprImpl(pTmpKey, pKey) == 0) { + goto _end; + } } + index++; + void* tmp = taosArrayInsert(pWinStates, index, pKey); + QUERY_CHECK_NULL(tmp, code, lino, _end, terrno); + } + +_end: + if (code != TSDB_CODE_SUCCESS) { + qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); } return code; } @@ -91,16 +105,15 @@ void clearSearchBuff(SStreamFileState* pFileState) { if (!pSearchBuff) { return; } + TSKEY flushMark = getFlushMark(pFileState); void* pIte = NULL; int32_t iter = 0; - void* pBuff = getRowStateBuff(pFileState); - while ((pIte = tSimpleHashIterate(pBuff, pIte, &iter)) != NULL) { + while ((pIte = tSimpleHashIterate(pSearchBuff, pIte, &iter)) != NULL) { SArray* pWinStates = *((void**)pIte); int32_t size = taosArrayGetSize(pWinStates); if (size > 0) { - TSKEY ts = getFlushMark(pFileState); - SWinKey key = *(SWinKey*)taosArrayGet(pWinStates, 0); - key.ts = ts; + int64_t gpId = *(int64_t*)tSimpleHashGetKey(pIte, NULL); + SWinKey key = {.ts = flushMark, .groupId = gpId}; int32_t num = binarySearch(pWinStates, size, &key, fillStateKeyCompare); if (size > NUM_OF_FLUSED_WIN) { num = TMIN(num, size - NUM_OF_FLUSED_WIN); @@ -110,7 +123,9 @@ void clearSearchBuff(SStreamFileState* pFileState) { } } -int32_t getHashSortNextRow(SStreamFileState* pFileState, const SWinKey* pKey, SWinKey* pResKey, void** pVal, int32_t* pVLen) { +int32_t getHashSortNextRow(SStreamFileState* pFileState, const SWinKey* pKey, SWinKey* pResKey, void** pVal, + int32_t* pVLen, int32_t* pWinCode) { + int32_t code = TSDB_CODE_SUCCESS; SArray* pWinStates = NULL; SSHashObj* pSearchBuff = getSearchBuff(pFileState); void* pState = getStateFileStore(pFileState); @@ -119,7 +134,7 @@ int32_t getHashSortNextRow(SStreamFileState* pFileState, const SWinKey* pKey, SW pWinStates = (SArray*)(*ppBuff); } else { SStreamStateCur* pCur = streamStateFillSeekKeyNext_rocksdb(pState, pKey); - int32_t code = streamStateGetGroupKVByCur_rocksdb(pCur, pResKey, (const void **)pVal, pVLen); + (*pWinCode) = streamStateGetGroupKVByCur_rocksdb(pCur, pResKey, (const void**)pVal, pVLen); streamStateFreeCur(pCur); return code; } @@ -127,21 +142,25 @@ int32_t getHashSortNextRow(SStreamFileState* pFileState, const SWinKey* pKey, SW int32_t index = binarySearch(pWinStates, size, pKey, fillStateKeyCompare); if (index == -1) { SStreamStateCur* pCur = streamStateFillSeekKeyNext_rocksdb(pState, pKey); - int32_t code = streamStateGetGroupKVByCur_rocksdb(pCur, pResKey, (const void **)pVal, pVLen); + (*pWinCode) = streamStateGetGroupKVByCur_rocksdb(pCur, pResKey, (const void**)pVal, pVLen); streamStateFreeCur(pCur); return code; } else { if (index == size - 1) { - return TSDB_CODE_FAILED; + (*pWinCode) = TSDB_CODE_FAILED; + return code; } SWinKey* pNext = taosArrayGet(pWinStates, index + 1); *pResKey = *pNext; - return getHashSortRowBuff(pFileState, pResKey, pVal, pVLen); + return getHashSortRowBuff(pFileState, pResKey, pVal, pVLen, pWinCode); } - return TSDB_CODE_FAILED; + (*pWinCode) = TSDB_CODE_FAILED; + return code; } -int32_t getHashSortPrevRow(SStreamFileState* pFileState, const SWinKey* pKey, SWinKey* pResKey, void** pVal, int32_t* pVLen) { +int32_t getHashSortPrevRow(SStreamFileState* pFileState, const SWinKey* pKey, SWinKey* pResKey, void** pVal, + int32_t* pVLen, int32_t* pWinCode) { + int32_t code = TSDB_CODE_SUCCESS; SArray* pWinStates = NULL; SSHashObj* pSearchBuff = getSearchBuff(pFileState); void* pState = getStateFileStore(pFileState); @@ -150,7 +169,7 @@ int32_t getHashSortPrevRow(SStreamFileState* pFileState, const SWinKey* pKey, SW pWinStates = (SArray*)(*ppBuff); } else { SStreamStateCur* pCur = streamStateFillSeekKeyPrev_rocksdb(pState, pKey); - int32_t code = streamStateGetGroupKVByCur_rocksdb(pCur, pResKey, (const void**)pVal, pVLen); + (*pWinCode) = streamStateGetGroupKVByCur_rocksdb(pCur, pResKey, (const void**)pVal, pVLen); streamStateFreeCur(pCur); return code; } @@ -158,15 +177,16 @@ int32_t getHashSortPrevRow(SStreamFileState* pFileState, const SWinKey* pKey, SW int32_t index = binarySearch(pWinStates, size, pKey, fillStateKeyCompare); if (index == -1 || index == 0) { SStreamStateCur* pCur = streamStateFillSeekKeyPrev_rocksdb(pState, pKey); - int32_t code = streamStateGetGroupKVByCur_rocksdb(pCur, pResKey, (const void**)pVal, pVLen); + (*pWinCode) = streamStateGetGroupKVByCur_rocksdb(pCur, pResKey, (const void**)pVal, pVLen); streamStateFreeCur(pCur); return code; } else { SWinKey* pNext = taosArrayGet(pWinStates, index - 1); *pResKey = *pNext; - return getHashSortRowBuff(pFileState, pResKey, pVal, pVLen); + return getHashSortRowBuff(pFileState, pResKey, pVal, pVLen, pWinCode); } - return TSDB_CODE_FAILED; + (*pWinCode) = TSDB_CODE_FAILED; + return code; } void deleteHashSortRowBuff(SStreamFileState* pFileState, const SWinKey* pKey) { @@ -190,4 +210,3 @@ void deleteHashSortRowBuff(SStreamFileState* pFileState, const SWinKey* pKey) { } } } - diff --git a/source/libs/stream/src/streamState.c b/source/libs/stream/src/streamState.c index 8139520e9773..7706a6507f2c 100644 --- a/source/libs/stream/src/streamState.c +++ b/source/libs/stream/src/streamState.c @@ -232,19 +232,19 @@ int32_t streamStateFillPut(SStreamState* pState, const SWinKey* key, const void* } // todo refactor -int32_t streamStateFillGet(SStreamState* pState, const SWinKey* key, void** pVal, int32_t* pVLen) { +int32_t streamStateFillGet(SStreamState* pState, const SWinKey* key, void** pVal, int32_t* pVLen, int32_t* pWinCode) { if (pState->pFileState) { - return getHashSortRowBuff(pState->pFileState, key, pVal, pVLen); + return getHashSortRowBuff(pState->pFileState, key, pVal, pVLen, pWinCode); } return streamStateFillGet_rocksdb(pState, key, pVal, pVLen); } -int32_t streamStateFillGetNext(SStreamState* pState, const SWinKey* pKey, SWinKey* pResKey, void** pVal, int32_t* pVLen) { - return getHashSortNextRow(pState->pFileState, pKey, pResKey, pVal, pVLen); +int32_t streamStateFillGetNext(SStreamState* pState, const SWinKey* pKey, SWinKey* pResKey, void** pVal, int32_t* pVLen, int32_t* pWinCode) { + return getHashSortNextRow(pState->pFileState, pKey, pResKey, pVal, pVLen, pWinCode); } -int32_t streamStateFillGetPrev(SStreamState* pState, const SWinKey* pKey, SWinKey* pResKey, void** pVal, int32_t* pVLen) { - return getHashSortPrevRow(pState->pFileState, pKey, pResKey, pVal, pVLen); +int32_t streamStateFillGetPrev(SStreamState* pState, const SWinKey* pKey, SWinKey* pResKey, void** pVal, int32_t* pVLen, int32_t* pWinCode) { + return getHashSortPrevRow(pState->pFileState, pKey, pResKey, pVal, pVLen, pWinCode); } // todo refactor diff --git a/tests/script/tsim/stream/streamInterpLinear0.sim b/tests/script/tsim/stream/streamInterpLinear0.sim new file mode 100644 index 000000000000..560121348309 --- /dev/null +++ b/tests/script/tsim/stream/streamInterpLinear0.sim @@ -0,0 +1,216 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sleep 50 +sql connect + +print step1 +print =============== create database +sql create database test vgroups 1; +sql use test; + +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 every(1s) fill(linear); + +run tsim/stream/checkTaskStatus.sim + + +sql insert into t1 values(1648791213000,1,1,1,1.1); + +$loop_count = 0 + +loop0: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 +print $data10 $data11 $data12 $data13 + +# row 0 +if $rows != 1 then + print ======rows=$rows + goto loop0 +endi + +# row 0 +if $data01 != 1 then + print ======data01=$data01 + goto loop0 +endi + + +sql insert into t1 values(1648791213001,2,2,2,2.1); +sql insert into t1 values(1648791213009,3,3,3,3.1); + +$loop_count = 0 + +loop1: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 1 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 +print $data10 $data11 $data12 $data13 + +# row 0 +if $rows != 1 then + print ======rows=$rows + goto loop1 +endi + +# row 0 +if $data01 != 1 then + print ======data01=$data01 + goto loop1 +endi + + +sql insert into t1 values(1648791217001,14,14,14,14.1); + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791213000, 1648791217001) every(1s) fill(linear); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791213000, 1648791217001) every(1s) fill(linear); + +print $data00 $data01 $data02 $data03 +print $data10 $data11 $data12 $data13 +print $data20 $data21 $data22 $data23 +print $data30 $data31 $data32 $data33 +print $data40 $data41 $data42 $data43 +print $data50 $data51 $data52 $data53 + + +$loop_count = 0 +loop2: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 2 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 +print $data10 $data11 $data12 $data13 +print $data20 $data21 $data22 $data23 +print $data30 $data31 $data32 $data33 +print $data40 $data41 $data42 $data43 +print $data50 $data51 $data52 $data53 + + +# row 0 +if $rows != 5 then + print ======rows=$rows + goto loop2 +endi + +# row 0 +if $data01 != 1 then + print ======data01=$data01 + goto loop2 +endi + +if $data11 != 5 then + print ======data11=$data11 + goto loop2 +endi + +if $data21 != 8 then + print ======data21=$data21 + goto loop2 +endi + +if $data31 != 11 then + print ======data31=$data31 + goto loop2 +endi + +if $data41 != 13 then + print ======data41=$data41 + goto loop2 +endi + + +sql insert into t1 values(1648791215001,7,7,7,7.1); + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791213000, 1648791217001) every(1s) fill(linear); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791213000, 1648791217001) every(1s) fill(linear); + +print $data00 $data01 $data02 $data03 +print $data10 $data11 $data12 $data13 +print $data20 $data21 $data22 $data23 +print $data30 $data31 $data32 $data33 +print $data40 $data41 $data42 $data43 +print $data50 $data51 $data52 $data53 + +$loop_count = 0 +loop3: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 3 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 +print $data10 $data11 $data12 $data13 +print $data20 $data21 $data22 $data23 +print $data30 $data31 $data32 $data33 +print $data40 $data41 $data42 $data43 +print $data50 $data51 $data52 $data53 + + +# row 0 +if $rows != 5 then + print ======rows=$rows + goto loop3 +endi + +# row 0 +if $data01 != 1 then + print ======data01=$data01 + goto loop3 +endi + +if $data11 != 4 then + print ======data11=$data11 + goto loop3 +endi + +if $data21 != 6 then + print ======data21=$data21 + goto loop3 +endi + +if $data31 != 10 then + print ======data31=$data31 + goto loop3 +endi + +if $data41 != 13 then + print ======data41=$data41 + goto loop3 +endi + +print count0 end +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/stream/streamInterpNext0.sim b/tests/script/tsim/stream/streamInterpNext0.sim new file mode 100644 index 000000000000..4bf2f278169c --- /dev/null +++ b/tests/script/tsim/stream/streamInterpNext0.sim @@ -0,0 +1,216 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sleep 50 +sql connect + +print step1 +print =============== create database +sql create database test vgroups 1; +sql use test; + +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 every(1s) fill(next); + +run tsim/stream/checkTaskStatus.sim + + +sql insert into t1 values(1648791213000,1,1,1,1.0); + +$loop_count = 0 + +loop0: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 +print $data10 $data11 $data12 $data13 + +# row 0 +if $rows != 1 then + print ======rows=$rows + goto loop0 +endi + +# row 0 +if $data01 != 1 then + print ======data01=$data01 + goto loop0 +endi + + +sql insert into t1 values(1648791213001,2,2,2,1.1); +sql insert into t1 values(1648791213009,3,3,3,1.0); + +$loop_count = 0 + +loop1: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 1 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 +print $data10 $data11 $data12 $data13 + +# row 0 +if $rows != 1 then + print ======rows=$rows + goto loop1 +endi + +# row 0 +if $data01 != 1 then + print ======data01=$data01 + goto loop1 +endi + + +sql insert into t1 values(1648791217001,4,4,4,4.1); + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791213000, 1648791217001) every(1s) fill(next); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791213000, 1648791217001) every(1s) fill(next); + +print $data00 $data01 $data02 $data03 +print $data10 $data11 $data12 $data13 +print $data20 $data21 $data22 $data23 +print $data30 $data31 $data32 $data33 +print $data40 $data41 $data42 $data43 +print $data50 $data51 $data52 $data53 + + +$loop_count = 0 +loop2: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 2 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 +print $data10 $data11 $data12 $data13 +print $data20 $data21 $data22 $data23 +print $data30 $data31 $data32 $data33 +print $data40 $data41 $data42 $data43 +print $data50 $data51 $data52 $data53 + + +# row 0 +if $rows != 5 then + print ======rows=$rows + goto loop2 +endi + +# row 0 +if $data01 != 1 then + print ======data01=$data01 + goto loop2 +endi + +if $data11 != 4 then + print ======data11=$data11 + goto loop2 +endi + +if $data21 != 4 then + print ======data21=$data21 + goto loop2 +endi + +if $data31 != 4 then + print ======data31=$data31 + goto loop2 +endi + +if $data41 != 4 then + print ======data41=$data41 + goto loop2 +endi + + +sql insert into t1 values(1648791215001,5,5,5,5.1); + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791213000, 1648791217001) every(1s) fill(next); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791213000, 1648791217001) every(1s) fill(next); + +print $data00 $data01 $data02 $data03 +print $data10 $data11 $data12 $data13 +print $data20 $data21 $data22 $data23 +print $data30 $data31 $data32 $data33 +print $data40 $data41 $data42 $data43 +print $data50 $data51 $data52 $data53 + +$loop_count = 0 +loop3: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 3 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 +print $data10 $data11 $data12 $data13 +print $data20 $data21 $data22 $data23 +print $data30 $data31 $data32 $data33 +print $data40 $data41 $data42 $data43 +print $data50 $data51 $data52 $data53 + + +# row 0 +if $rows != 5 then + print ======rows=$rows + goto loop3 +endi + +# row 0 +if $data01 != 1 then + print ======data01=$data01 + goto loop3 +endi + +if $data11 != 5 then + print ======data11=$data11 + goto loop3 +endi + +if $data21 != 5 then + print ======data21=$data21 + goto loop3 +endi + +if $data31 != 4 then + print ======data31=$data31 + goto loop3 +endi + +if $data41 != 4 then + print ======data41=$data41 + goto loop3 +endi + +print count0 end +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/stream/streamInterpPrev0.sim b/tests/script/tsim/stream/streamInterpPrev0.sim new file mode 100644 index 000000000000..962e2080fc49 --- /dev/null +++ b/tests/script/tsim/stream/streamInterpPrev0.sim @@ -0,0 +1,216 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sleep 50 +sql connect + +print step1 +print =============== create database +sql create database test vgroups 1; +sql use test; + +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 every(1s) fill(prev); + +run tsim/stream/checkTaskStatus.sim + + +sql insert into t1 values(1648791213000,1,1,1,1.0); + +$loop_count = 0 + +loop0: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 +print $data10 $data11 $data12 $data13 + +# row 0 +if $rows != 1 then + print ======rows=$rows + goto loop0 +endi + +# row 0 +if $data01 != 1 then + print ======data01=$data01 + goto loop0 +endi + + +sql insert into t1 values(1648791213001,2,2,2,1.1); +sql insert into t1 values(1648791213009,3,3,3,1.0); + +$loop_count = 0 + +loop1: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 1 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 +print $data10 $data11 $data12 $data13 + +# row 0 +if $rows != 1 then + print ======rows=$rows + goto loop1 +endi + +# row 0 +if $data01 != 1 then + print ======data01=$data01 + goto loop1 +endi + + +sql insert into t1 values(1648791217001,4,4,4,4.1); + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791213000, 1648791217001) every(1s) fill(prev); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791213000, 1648791217001) every(1s) fill(prev); + +print $data00 $data01 $data02 $data03 +print $data10 $data11 $data12 $data13 +print $data20 $data21 $data22 $data23 +print $data30 $data31 $data32 $data33 +print $data40 $data41 $data42 $data43 +print $data50 $data51 $data52 $data53 + + +$loop_count = 0 +loop2: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 2 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 +print $data10 $data11 $data12 $data13 +print $data20 $data21 $data22 $data23 +print $data30 $data31 $data32 $data33 +print $data40 $data41 $data42 $data43 +print $data50 $data51 $data52 $data53 + + +# row 0 +if $rows != 5 then + print ======rows=$rows + goto loop2 +endi + +# row 0 +if $data01 != 1 then + print ======data01=$data01 + goto loop2 +endi + +if $data11 != 3 then + print ======data11=$data11 + goto loop2 +endi + +if $data21 != 3 then + print ======data21=$data21 + goto loop2 +endi + +if $data31 != 3 then + print ======data31=$data31 + goto loop2 +endi + +if $data41 != 3 then + print ======data41=$data41 + goto loop2 +endi + + +sql insert into t1 values(1648791215001,5,5,5,5.1); + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791213000, 1648791217001) every(1s) fill(prev); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791213000, 1648791217001) every(1s) fill(prev); + +print $data00 $data01 $data02 $data03 +print $data10 $data11 $data12 $data13 +print $data20 $data21 $data22 $data23 +print $data30 $data31 $data32 $data33 +print $data40 $data41 $data42 $data43 +print $data50 $data51 $data52 $data53 + +$loop_count = 0 +loop3: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 3 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 +print $data10 $data11 $data12 $data13 +print $data20 $data21 $data22 $data23 +print $data30 $data31 $data32 $data33 +print $data40 $data41 $data42 $data43 +print $data50 $data51 $data52 $data53 + + +# row 0 +if $rows != 5 then + print ======rows=$rows + goto loop3 +endi + +# row 0 +if $data01 != 1 then + print ======data01=$data01 + goto loop3 +endi + +if $data11 != 3 then + print ======data11=$data11 + goto loop3 +endi + +if $data21 != 3 then + print ======data21=$data21 + goto loop3 +endi + +if $data31 != 5 then + print ======data31=$data31 + goto loop3 +endi + +if $data41 != 5 then + print ======data41=$data41 + goto loop3 +endi + +print count0 end +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/stream/streamInterpValue0.sim b/tests/script/tsim/stream/streamInterpValue0.sim new file mode 100644 index 000000000000..dedcf9a1d992 --- /dev/null +++ b/tests/script/tsim/stream/streamInterpValue0.sim @@ -0,0 +1,361 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sleep 50 +sql connect + +print step1 +print =============== create database +sql create database test vgroups 1; +sql use test; + +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 every(1s) fill(NULL); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2 as select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 every(1s) fill(value, 10,20,30,40); + +run tsim/stream/checkTaskStatus.sim + + +sql insert into t1 values(1648791213000,1,1,1,1.0); + +$loop_count = 0 + +loop0: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 +print $data10 $data11 $data12 $data13 + +# row 0 +if $rows != 1 then + print ======rows=$rows + goto loop0 +endi + +# row 0 +if $data01 != 1 then + print ======data01=$data01 + goto loop0 +endi + + +sql insert into t1 values(1648791213001,2,2,2,1.1); +sql insert into t1 values(1648791213009,3,3,3,1.0); + +$loop_count = 0 + +loop1: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 1 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 +print $data10 $data11 $data12 $data13 + +# row 0 +if $rows != 1 then + print ======rows=$rows + goto loop1 +endi + +# row 0 +if $data01 != 1 then + print ======data01=$data01 + goto loop1 +endi + + +sql insert into t1 values(1648791217001,4,4,4,4.1); + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791213000, 1648791217001) every(1s) fill(NULL); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791213000, 1648791217001) every(1s) fill(NULL); + +print $data00 $data01 $data02 $data03 +print $data10 $data11 $data12 $data13 +print $data20 $data21 $data22 $data23 +print $data30 $data31 $data32 $data33 +print $data40 $data41 $data42 $data43 +print $data50 $data51 $data52 $data53 + + +$loop_count = 0 +loop2: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 2 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 +print $data10 $data11 $data12 $data13 +print $data20 $data21 $data22 $data23 +print $data30 $data31 $data32 $data33 +print $data40 $data41 $data42 $data43 +print $data50 $data51 $data52 $data53 + + +# row 0 +if $rows != 5 then + print ======rows=$rows + goto loop2 +endi + +# row 0 +if $data01 != 1 then + print ======data01=$data01 + goto loop2 +endi + +if $data11 != NULL then + print ======data11=$data11 + goto loop2 +endi + +if $data21 != NULL then + print ======data21=$data21 + goto loop2 +endi + +if $data31 != NULL then + print ======data31=$data31 + goto loop2 +endi + +if $data41 != NULL then + print ======data41=$data41 + goto loop2 +endi + + + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791213000, 1648791217001) every(1s) fill(value, 10,20,30,40); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791213000, 1648791217001) every(1s) fill(value, 10,20,30,40); + +print $data00 $data01 $data02 $data03 +print $data10 $data11 $data12 $data13 +print $data20 $data21 $data22 $data23 +print $data30 $data31 $data32 $data33 +print $data40 $data41 $data42 $data43 +print $data50 $data51 $data52 $data53 + + +$loop_count = 0 +loop2_1: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 2 sql select * from streamt2; +sql select * from streamt2; + +print $data00 $data01 $data02 $data03 +print $data10 $data11 $data12 $data13 +print $data20 $data21 $data22 $data23 +print $data30 $data31 $data32 $data33 +print $data40 $data41 $data42 $data43 +print $data50 $data51 $data52 $data53 + + +# row 0 +if $rows != 5 then + print ======rows=$rows + goto loop2_1 +endi + +# row 0 +if $data01 != 1 then + print ======data01=$data01 + goto loop2_1 +endi + +if $data11 != 10 then + print ======data11=$data11 + goto loop2_1 +endi + +if $data21 != 10 then + print ======data21=$data21 + goto loop2_1 +endi + +if $data31 != 10 then + print ======data31=$data31 + goto loop2_1 +endi + +if $data41 != 10 then + print ======data41=$data41 + goto loop2_1 +endi + +sql insert into t1 values(1648791215001,5,5,5,5.1); + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791213000, 1648791217001) every(1s) fill(NULL); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791213000, 1648791217001) every(1s) fill(NULL); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 +loop3: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 3 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +# row 0 +if $rows != 5 then + print ======rows=$rows + goto loop3 +endi + +# row 0 +if $data01 != 1 then + print ======data01=$data01 + goto loop3 +endi + +if $data11 != NULL then + print ======data11=$data11 + goto loop3 +endi + +if $data21 != NULL then + print ======data21=$data21 + goto loop3 +endi + +if $data31 != NULL then + print ======data31=$data31 + goto loop3 +endi + +if $data41 != NULL then + print ======data41=$data41 + goto loop3 +endi + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791213000, 1648791217001) every(1s) fill(value, 10,20,30,40); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791213000, 1648791217001) every(1s) fill(value, 10,20,30,40); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +$loop_count = 0 +loop3_1: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 3 sql select * from streamt2; +sql select * from streamt2; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +# row 0 +if $rows != 5 then + print ======rows=$rows + goto loop3_1 +endi + +# row 0 +if $data01 != 1 then + print ======data01=$data01 + goto loop3_1 +endi + +if $data11 != 10 then + print ======data11=$data11 + goto loop3_1 +endi + +if $data21 != 10 then + print ======data21=$data21 + goto loop3_1 +endi + +if $data31 != 10 then + print ======data31=$data31 + goto loop3_1 +endi + +if $data41 != 10 then + print ======data41=$data41 + goto loop3_1 +endi + +if $data12 != 20 then + print ======data12=$data12 + goto loop3_1 +endi + +if $data13 != 30 then + print ======data13=$data13 + goto loop3_1 +endi + +if $data14 != 40.000000000 then + print ======data14=$data14 + goto loop3_1 +endi + +print count0 end +system sh/exec.sh -n dnode1 -s stop -x SIGINT From 2f9490d8bdf02cb475cfea51d115c488cc4cf9a6 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Fri, 2 Aug 2024 13:57:09 +0800 Subject: [PATCH 018/695] add ci --- source/libs/stream/src/tstreamFileState.c | 1 + .../tsim/stream/streamInterpLinear0.sim | 50 ++--- .../script/tsim/stream/streamInterpNext0.sim | 132 +++++++++--- .../script/tsim/stream/streamInterpPrev0.sim | 129 ++++++++--- .../script/tsim/stream/streamInterpValue0.sim | 204 +++++++++++++++--- 5 files changed, 416 insertions(+), 100 deletions(-) diff --git a/source/libs/stream/src/tstreamFileState.c b/source/libs/stream/src/tstreamFileState.c index 8298f9073634..ca0623c47eea 100644 --- a/source/libs/stream/src/tstreamFileState.c +++ b/source/libs/stream/src/tstreamFileState.c @@ -270,6 +270,7 @@ void streamFileStateDestroy(SStreamFileState* pFileState) { tdListFreeP(pFileState->usedBuffs, destroyRowBuffAllPosPtr); tdListFreeP(pFileState->freeBuffs, destroyRowBuff); pFileState->stateBuffCleanupFn(pFileState->rowStateBuff); + sessionWinStateCleanup(pFileState->searchBuff); taosMemoryFree(pFileState); } diff --git a/tests/script/tsim/stream/streamInterpLinear0.sim b/tests/script/tsim/stream/streamInterpLinear0.sim index 560121348309..95ae69b7368b 100644 --- a/tests/script/tsim/stream/streamInterpLinear0.sim +++ b/tests/script/tsim/stream/streamInterpLinear0.sim @@ -85,12 +85,12 @@ sql insert into t1 values(1648791217001,14,14,14,14.1); print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791213000, 1648791217001) every(1s) fill(linear); sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791213000, 1648791217001) every(1s) fill(linear); -print $data00 $data01 $data02 $data03 -print $data10 $data11 $data12 $data13 -print $data20 $data21 $data22 $data23 -print $data30 $data31 $data32 $data33 -print $data40 $data41 $data42 $data43 -print $data50 $data51 $data52 $data53 +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 $loop_count = 0 @@ -106,12 +106,12 @@ endi print 2 sql select * from streamt; sql select * from streamt; -print $data00 $data01 $data02 $data03 -print $data10 $data11 $data12 $data13 -print $data20 $data21 $data22 $data23 -print $data30 $data31 $data32 $data33 -print $data40 $data41 $data42 $data43 -print $data50 $data51 $data52 $data53 +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 # row 0 @@ -152,12 +152,12 @@ sql insert into t1 values(1648791215001,7,7,7,7.1); print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791213000, 1648791217001) every(1s) fill(linear); sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791213000, 1648791217001) every(1s) fill(linear); -print $data00 $data01 $data02 $data03 -print $data10 $data11 $data12 $data13 -print $data20 $data21 $data22 $data23 -print $data30 $data31 $data32 $data33 -print $data40 $data41 $data42 $data43 -print $data50 $data51 $data52 $data53 +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 $loop_count = 0 loop3: @@ -172,12 +172,12 @@ endi print 3 sql select * from streamt; sql select * from streamt; -print $data00 $data01 $data02 $data03 -print $data10 $data11 $data12 $data13 -print $data20 $data21 $data22 $data23 -print $data30 $data31 $data32 $data33 -print $data40 $data41 $data42 $data43 -print $data50 $data51 $data52 $data53 +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 # row 0 @@ -212,5 +212,5 @@ if $data41 != 13 then goto loop3 endi -print count0 end +print end system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/stream/streamInterpNext0.sim b/tests/script/tsim/stream/streamInterpNext0.sim index 4bf2f278169c..6e36b106e30e 100644 --- a/tests/script/tsim/stream/streamInterpNext0.sim +++ b/tests/script/tsim/stream/streamInterpNext0.sim @@ -85,12 +85,12 @@ sql insert into t1 values(1648791217001,4,4,4,4.1); print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791213000, 1648791217001) every(1s) fill(next); sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791213000, 1648791217001) every(1s) fill(next); -print $data00 $data01 $data02 $data03 -print $data10 $data11 $data12 $data13 -print $data20 $data21 $data22 $data23 -print $data30 $data31 $data32 $data33 -print $data40 $data41 $data42 $data43 -print $data50 $data51 $data52 $data53 +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 $loop_count = 0 @@ -106,12 +106,12 @@ endi print 2 sql select * from streamt; sql select * from streamt; -print $data00 $data01 $data02 $data03 -print $data10 $data11 $data12 $data13 -print $data20 $data21 $data22 $data23 -print $data30 $data31 $data32 $data33 -print $data40 $data41 $data42 $data43 -print $data50 $data51 $data52 $data53 +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 # row 0 @@ -152,12 +152,12 @@ sql insert into t1 values(1648791215001,5,5,5,5.1); print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791213000, 1648791217001) every(1s) fill(next); sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791213000, 1648791217001) every(1s) fill(next); -print $data00 $data01 $data02 $data03 -print $data10 $data11 $data12 $data13 -print $data20 $data21 $data22 $data23 -print $data30 $data31 $data32 $data33 -print $data40 $data41 $data42 $data43 -print $data50 $data51 $data52 $data53 +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 $loop_count = 0 loop3: @@ -172,12 +172,12 @@ endi print 3 sql select * from streamt; sql select * from streamt; -print $data00 $data01 $data02 $data03 -print $data10 $data11 $data12 $data13 -print $data20 $data21 $data22 $data23 -print $data30 $data31 $data32 $data33 -print $data40 $data41 $data42 $data43 -print $data50 $data51 $data52 $data53 +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 # row 0 @@ -212,5 +212,87 @@ if $data41 != 4 then goto loop3 endi -print count0 end +print step2 + +sql create database test2 vgroups 1; +sql use test2; + +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2 as select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 every(1s) fill(next); + +run tsim/stream/checkTaskStatus.sim + + +sql insert into t1 values(1648791212000,0,0,0,0.0) (1648791213001,1,1,1,1.0) (1648791213009,2,2,2,1.1) (1648791215001,5,5,5,5.1) (1648791217001,4,4,4,4.1); + + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(next); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(next); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 +loop4: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 1 sql select * from streamt2; +sql select * from streamt2; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +# row 0 +if $rows != 6 then + print ======rows=$rows + goto loop4 +endi + +# row 0 +if $data01 != 0 then + print ======data01=$data01 + goto loop4 +endi + +if $data11 != 1 then + print ======data11=$data11 + goto loop4 +endi + +if $data21 != 5 then + print ======data21=$data21 + goto loop4 +endi + +if $data31 != 5 then + print ======data31=$data31 + goto loop4 +endi + +if $data41 != 4 then + print ======data41=$data41 + goto loop4 +endi + +if $data51 != 4 then + print ======data51=$data51 + goto loop4 +endi + +print end system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/stream/streamInterpPrev0.sim b/tests/script/tsim/stream/streamInterpPrev0.sim index 962e2080fc49..fce4eb0f7035 100644 --- a/tests/script/tsim/stream/streamInterpPrev0.sim +++ b/tests/script/tsim/stream/streamInterpPrev0.sim @@ -85,12 +85,12 @@ sql insert into t1 values(1648791217001,4,4,4,4.1); print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791213000, 1648791217001) every(1s) fill(prev); sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791213000, 1648791217001) every(1s) fill(prev); -print $data00 $data01 $data02 $data03 -print $data10 $data11 $data12 $data13 -print $data20 $data21 $data22 $data23 -print $data30 $data31 $data32 $data33 -print $data40 $data41 $data42 $data43 -print $data50 $data51 $data52 $data53 +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 $loop_count = 0 @@ -106,12 +106,12 @@ endi print 2 sql select * from streamt; sql select * from streamt; -print $data00 $data01 $data02 $data03 -print $data10 $data11 $data12 $data13 -print $data20 $data21 $data22 $data23 -print $data30 $data31 $data32 $data33 -print $data40 $data41 $data42 $data43 -print $data50 $data51 $data52 $data53 +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 # row 0 @@ -152,12 +152,12 @@ sql insert into t1 values(1648791215001,5,5,5,5.1); print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791213000, 1648791217001) every(1s) fill(prev); sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791213000, 1648791217001) every(1s) fill(prev); -print $data00 $data01 $data02 $data03 -print $data10 $data11 $data12 $data13 -print $data20 $data21 $data22 $data23 -print $data30 $data31 $data32 $data33 -print $data40 $data41 $data42 $data43 -print $data50 $data51 $data52 $data53 +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 $loop_count = 0 loop3: @@ -172,12 +172,12 @@ endi print 3 sql select * from streamt; sql select * from streamt; -print $data00 $data01 $data02 $data03 -print $data10 $data11 $data12 $data13 -print $data20 $data21 $data22 $data23 -print $data30 $data31 $data32 $data33 -print $data40 $data41 $data42 $data43 -print $data50 $data51 $data52 $data53 +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 # row 0 @@ -212,5 +212,84 @@ if $data41 != 5 then goto loop3 endi -print count0 end +sql create database test2 vgroups 1; +sql use test2; + +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2 as select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 every(1s) fill(prev); + +run tsim/stream/checkTaskStatus.sim + + +sql insert into t1 values(1648791212000,0,0,0,0.0) (1648791213001,1,1,1,1.0) (1648791213009,2,2,2,1.1) (1648791215001,5,5,5,5.1) (1648791217001,4,4,4,4.1); + + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(prev); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(prev); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 +loop4: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 1 sql select * from streamt2; +sql select * from streamt2; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +# row 0 +if $rows != 6 then + print ======rows=$rows + goto loop4 +endi + +# row 0 +if $data01 != 0 then + print ======data01=$data01 + goto loop4 +endi + +if $data11 != 0 then + print ======data11=$data11 + goto loop4 +endi + +if $data21 != 2 then + print ======data21=$data21 + goto loop4 +endi + +if $data31 != 2 then + print ======data31=$data31 + goto loop4 +endi + +if $data41 != 5 then + print ======data41=$data41 + goto loop4 +endi + +if $data51 != 5 then + print ======data51=$data51 + goto loop4 +endi + system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/stream/streamInterpValue0.sim b/tests/script/tsim/stream/streamInterpValue0.sim index dedcf9a1d992..511a3515b12b 100644 --- a/tests/script/tsim/stream/streamInterpValue0.sim +++ b/tests/script/tsim/stream/streamInterpValue0.sim @@ -86,12 +86,12 @@ sql insert into t1 values(1648791217001,4,4,4,4.1); print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791213000, 1648791217001) every(1s) fill(NULL); sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791213000, 1648791217001) every(1s) fill(NULL); -print $data00 $data01 $data02 $data03 -print $data10 $data11 $data12 $data13 -print $data20 $data21 $data22 $data23 -print $data30 $data31 $data32 $data33 -print $data40 $data41 $data42 $data43 -print $data50 $data51 $data52 $data53 +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 $loop_count = 0 @@ -107,12 +107,12 @@ endi print 2 sql select * from streamt; sql select * from streamt; -print $data00 $data01 $data02 $data03 -print $data10 $data11 $data12 $data13 -print $data20 $data21 $data22 $data23 -print $data30 $data31 $data32 $data33 -print $data40 $data41 $data42 $data43 -print $data50 $data51 $data52 $data53 +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 # row 0 @@ -152,12 +152,12 @@ endi print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791213000, 1648791217001) every(1s) fill(value, 10,20,30,40); sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791213000, 1648791217001) every(1s) fill(value, 10,20,30,40); -print $data00 $data01 $data02 $data03 -print $data10 $data11 $data12 $data13 -print $data20 $data21 $data22 $data23 -print $data30 $data31 $data32 $data33 -print $data40 $data41 $data42 $data43 -print $data50 $data51 $data52 $data53 +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 $loop_count = 0 @@ -173,12 +173,12 @@ endi print 2 sql select * from streamt2; sql select * from streamt2; -print $data00 $data01 $data02 $data03 -print $data10 $data11 $data12 $data13 -print $data20 $data21 $data22 $data23 -print $data30 $data31 $data32 $data33 -print $data40 $data41 $data42 $data43 -print $data50 $data51 $data52 $data53 +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 # row 0 @@ -357,5 +357,159 @@ if $data14 != 40.000000000 then goto loop3_1 endi -print count0 end + + +print step2 + +sql create database test2 vgroups 1; +sql use test2; + +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stream streams3 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt3 as select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 every(1s) fill(NULL); +sql create stream streams4 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt4 as select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 every(1s) fill(value, 10,20,30,40); + +run tsim/stream/checkTaskStatus.sim + + +sql insert into t1 values(1648791212000,0,0,0,0.0) (1648791213001,1,1,1,1.0) (1648791213009,2,2,2,1.1) (1648791215001,5,5,5,5.1) (1648791217001,4,4,4,4.1); + + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(NULL); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(NULL); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 +loop4: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 1 sql select * from streamt3; +sql select * from streamt3; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +# row 0 +if $rows != 6 then + print ======rows=$rows + goto loop4 +endi + +# row 0 +if $data01 != 0 then + print ======data01=$data01 + goto loop4 +endi + +if $data11 != NULL then + print ======data11=$data11 + goto loop4 +endi + +if $data21 != NULL then + print ======data21=$data21 + goto loop4 +endi + +if $data31 != NULL then + print ======data31=$data31 + goto loop4 +endi + +if $data41 != NULL then + print ======data41=$data41 + goto loop4 +endi + +if $data51 != NULL then + print ======data51=$data51 + goto loop4 +endi + + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(value, 10,20,30,40); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(value, 10,20,30,40); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 +loop4_1: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 1 sql select * from streamt4; +sql select * from streamt4; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +# row 0 +if $rows != 6 then + print ======rows=$rows + goto loop4_1 +endi + +# row 0 +if $data01 != 0 then + print ======data01=$data01 + goto loop4_1 +endi + +if $data11 != 10 then + print ======data11=$data11 + goto loop4_1 +endi + +if $data21 != 10 then + print ======data21=$data21 + goto loop4_1 +endi + +if $data31 != 10 then + print ======data31=$data31 + goto loop4_1 +endi + +if $data41 != 10 then + print ======data41=$data41 + goto loop4_1 +endi + +if $data51 != 10 then + print ======data51=$data51 + goto loop4_1 +endi + +print end system sh/exec.sh -n dnode1 -s stop -x SIGINT From bdaf0d419ef13f36a0c2e9a9dd2e8f7611f2e9f7 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Tue, 6 Aug 2024 16:14:15 +0800 Subject: [PATCH 019/695] stream interp force window close --- include/common/tcommon.h | 5 + include/common/tmsg.h | 12 +- include/common/ttokendef.h | 292 +- include/libs/executor/storageapi.h | 10 + include/libs/stream/streamState.h | 16 +- include/libs/stream/tstreamFileState.h | 8 + source/dnode/mnode/impl/src/mndStreamUtil.c | 2 + source/dnode/snode/src/snodeInitApi.c | 14 +- source/dnode/vnode/src/vnd/vnodeInitApi.c | 6 + source/libs/executor/inc/executorInt.h | 1 + source/libs/executor/src/executil.c | 21 +- source/libs/executor/src/scanoperator.c | 40 +- .../executor/src/streamtimesliceoperator.c | 110 +- source/libs/parser/inc/sql.y | 1 + source/libs/parser/src/parAstCreater.c | 2 + source/libs/parser/src/parTokenizer.c | 1 + source/libs/parser/src/parTranslater.c | 2 +- source/libs/parser/src/sql.c | 9484 ++++++++--------- source/libs/stream/inc/streamBackendRocksdb.h | 2 + source/libs/stream/src/streamBackendRocksdb.c | 55 +- source/libs/stream/src/streamSessionState.c | 8 +- source/libs/stream/src/streamSliceState.c | 2 +- source/libs/stream/src/streamState.c | 57 +- source/libs/stream/src/tstreamFileState.c | 186 +- .../script/tsim/stream/checkpointSession1.sim | 2 + 25 files changed, 4826 insertions(+), 5513 deletions(-) diff --git a/include/common/tcommon.h b/include/common/tcommon.h index 5714990dd5f5..b706e13c4a2b 100644 --- a/include/common/tcommon.h +++ b/include/common/tcommon.h @@ -178,6 +178,7 @@ typedef enum EStreamType { STREAM_TRANS_STATE, STREAM_MID_RETRIEVE, STREAM_PARTITION_DELETE_DATA, + STREAM_GET_RESULT, } EStreamType; #pragma pack(push, 1) @@ -407,6 +408,10 @@ typedef struct STUidTagInfo { #define TABLE_NAME_COLUMN_INDEX 6 #define PRIMARY_KEY_COLUMN_INDEX 7 +//steam get result block column +#define DATA_TS_COLUMN_INDEX 0 +#define DATA_VERSION_COLUMN_INDEX 1 + // stream create table block column #define UD_TABLE_NAME_COLUMN_INDEX 0 #define UD_GROUPID_COLUMN_INDEX 1 diff --git a/include/common/tmsg.h b/include/common/tmsg.h index d0be5b43f69f..9c681e937ec0 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -2747,9 +2747,11 @@ typedef struct { int32_t code; } STaskDropRsp; -#define STREAM_TRIGGER_AT_ONCE 1 -#define STREAM_TRIGGER_WINDOW_CLOSE 2 -#define STREAM_TRIGGER_MAX_DELAY 3 +#define STREAM_TRIGGER_AT_ONCE 1 +#define STREAM_TRIGGER_WINDOW_CLOSE 2 +#define STREAM_TRIGGER_MAX_DELAY 3 +#define STREAM_TRIGGER_FORCE_WINDOW_CLOSE 4 + #define STREAM_DEFAULT_IGNORE_EXPIRED 1 #define STREAM_FILL_HISTORY_ON 1 #define STREAM_FILL_HISTORY_OFF 0 @@ -2812,8 +2814,8 @@ enum { TOPIC_SUB_TYPE__COLUMN, }; -#define DEFAULT_MAX_POLL_INTERVAL 3000000 -#define DEFAULT_SESSION_TIMEOUT 12000 +#define DEFAULT_MAX_POLL_INTERVAL 3000000 +#define DEFAULT_SESSION_TIMEOUT 12000 typedef struct { char name[TSDB_TOPIC_FNAME_LEN]; // accout.topic diff --git a/include/common/ttokendef.h b/include/common/ttokendef.h index 41802d540075..921ecf356da3 100644 --- a/include/common/ttokendef.h +++ b/include/common/ttokendef.h @@ -248,151 +248,153 @@ #define TK_TRIGGER 230 #define TK_AT_ONCE 231 #define TK_WINDOW_CLOSE 232 -#define TK_IGNORE 233 -#define TK_EXPIRED 234 -#define TK_FILL_HISTORY 235 -#define TK_UPDATE 236 -#define TK_SUBTABLE 237 -#define TK_UNTREATED 238 -#define TK_KILL 239 -#define TK_CONNECTION 240 -#define TK_TRANSACTION 241 -#define TK_BALANCE 242 -#define TK_VGROUP 243 -#define TK_LEADER 244 -#define TK_MERGE 245 -#define TK_REDISTRIBUTE 246 -#define TK_SPLIT 247 -#define TK_DELETE 248 -#define TK_INSERT 249 -#define TK_NK_BIN 250 -#define TK_NK_HEX 251 -#define TK_NULL 252 -#define TK_NK_QUESTION 253 -#define TK_NK_ALIAS 254 -#define TK_NK_ARROW 255 -#define TK_ROWTS 256 -#define TK_QSTART 257 -#define TK_QEND 258 -#define TK_QDURATION 259 -#define TK_WSTART 260 -#define TK_WEND 261 -#define TK_WDURATION 262 -#define TK_IROWTS 263 -#define TK_ISFILLED 264 -#define TK_CAST 265 -#define TK_NOW 266 -#define TK_TODAY 267 -#define TK_TIMEZONE 268 -#define TK_CLIENT_VERSION 269 -#define TK_SERVER_VERSION 270 -#define TK_SERVER_STATUS 271 -#define TK_CURRENT_USER 272 -#define TK_CASE 273 -#define TK_WHEN 274 -#define TK_THEN 275 -#define TK_ELSE 276 -#define TK_BETWEEN 277 -#define TK_IS 278 -#define TK_NK_LT 279 -#define TK_NK_GT 280 -#define TK_NK_LE 281 -#define TK_NK_GE 282 -#define TK_NK_NE 283 -#define TK_MATCH 284 -#define TK_NMATCH 285 -#define TK_CONTAINS 286 -#define TK_IN 287 -#define TK_JOIN 288 -#define TK_INNER 289 -#define TK_LEFT 290 -#define TK_RIGHT 291 -#define TK_OUTER 292 -#define TK_SEMI 293 -#define TK_ANTI 294 -#define TK_ASOF 295 -#define TK_WINDOW 296 -#define TK_WINDOW_OFFSET 297 -#define TK_JLIMIT 298 -#define TK_SELECT 299 -#define TK_NK_HINT 300 -#define TK_DISTINCT 301 -#define TK_WHERE 302 -#define TK_PARTITION 303 -#define TK_BY 304 -#define TK_SESSION 305 -#define TK_STATE_WINDOW 306 -#define TK_EVENT_WINDOW 307 -#define TK_COUNT_WINDOW 308 -#define TK_SLIDING 309 -#define TK_FILL 310 -#define TK_VALUE 311 -#define TK_VALUE_F 312 -#define TK_NONE 313 -#define TK_PREV 314 -#define TK_NULL_F 315 -#define TK_LINEAR 316 -#define TK_NEXT 317 -#define TK_HAVING 318 -#define TK_RANGE 319 -#define TK_EVERY 320 -#define TK_ORDER 321 -#define TK_SLIMIT 322 -#define TK_SOFFSET 323 -#define TK_LIMIT 324 -#define TK_OFFSET 325 -#define TK_ASC 326 -#define TK_NULLS 327 -#define TK_ABORT 328 -#define TK_AFTER 329 -#define TK_ATTACH 330 -#define TK_BEFORE 331 -#define TK_BEGIN 332 -#define TK_BITAND 333 -#define TK_BITNOT 334 -#define TK_BITOR 335 -#define TK_BLOCKS 336 -#define TK_CHANGE 337 -#define TK_COMMA 338 -#define TK_CONCAT 339 -#define TK_CONFLICT 340 -#define TK_COPY 341 -#define TK_DEFERRED 342 -#define TK_DELIMITERS 343 -#define TK_DETACH 344 -#define TK_DIVIDE 345 -#define TK_DOT 346 -#define TK_EACH 347 -#define TK_FAIL 348 -#define TK_FOR 349 -#define TK_GLOB 350 -#define TK_ID 351 -#define TK_IMMEDIATE 352 -#define TK_IMPORT 353 -#define TK_INITIALLY 354 -#define TK_INSTEAD 355 -#define TK_ISNULL 356 -#define TK_MODULES 357 -#define TK_NK_BITNOT 358 -#define TK_NK_SEMI 359 -#define TK_NOTNULL 360 -#define TK_OF 361 -#define TK_PLUS 362 -#define TK_PRIVILEGE 363 -#define TK_RAISE 364 -#define TK_RESTRICT 365 -#define TK_ROW 366 -#define TK_STAR 367 -#define TK_STATEMENT 368 -#define TK_STRICT 369 -#define TK_STRING 370 -#define TK_TIMES 371 -#define TK_VALUES 372 -#define TK_VARIABLE 373 -#define TK_WAL 374 -#define TK_ENCODE 375 -#define TK_COMPRESS 376 -#define TK_LEVEL 377 +#define TK_FORCE_WINDOW_CLOSE 233 +#define TK_IGNORE 234 +#define TK_EXPIRED 235 +#define TK_FILL_HISTORY 236 +#define TK_UPDATE 237 +#define TK_SUBTABLE 238 +#define TK_UNTREATED 239 +#define TK_KILL 240 +#define TK_CONNECTION 241 +#define TK_TRANSACTION 242 +#define TK_BALANCE 243 +#define TK_VGROUP 244 +#define TK_LEADER 245 +#define TK_MERGE 246 +#define TK_REDISTRIBUTE 247 +#define TK_SPLIT 248 +#define TK_DELETE 249 +#define TK_INSERT 250 +#define TK_NK_BIN 251 +#define TK_NK_HEX 252 +#define TK_NULL 253 +#define TK_NK_QUESTION 254 +#define TK_NK_ALIAS 255 +#define TK_NK_ARROW 256 +#define TK_ROWTS 257 +#define TK_QSTART 258 +#define TK_QEND 259 +#define TK_QDURATION 260 +#define TK_WSTART 261 +#define TK_WEND 262 +#define TK_WDURATION 263 +#define TK_IROWTS 264 +#define TK_ISFILLED 265 +#define TK_CAST 266 +#define TK_NOW 267 +#define TK_TODAY 268 +#define TK_TIMEZONE 269 +#define TK_CLIENT_VERSION 270 +#define TK_SERVER_VERSION 271 +#define TK_SERVER_STATUS 272 +#define TK_CURRENT_USER 273 +#define TK_CASE 274 +#define TK_WHEN 275 +#define TK_THEN 276 +#define TK_ELSE 277 +#define TK_BETWEEN 278 +#define TK_IS 279 +#define TK_NK_LT 280 +#define TK_NK_GT 281 +#define TK_NK_LE 282 +#define TK_NK_GE 283 +#define TK_NK_NE 284 +#define TK_MATCH 285 +#define TK_NMATCH 286 +#define TK_CONTAINS 287 +#define TK_IN 288 +#define TK_JOIN 289 +#define TK_INNER 290 +#define TK_LEFT 291 +#define TK_RIGHT 292 +#define TK_OUTER 293 +#define TK_SEMI 294 +#define TK_ANTI 295 +#define TK_ASOF 296 +#define TK_WINDOW 297 +#define TK_WINDOW_OFFSET 298 +#define TK_JLIMIT 299 +#define TK_SELECT 300 +#define TK_NK_HINT 301 +#define TK_DISTINCT 302 +#define TK_WHERE 303 +#define TK_PARTITION 304 +#define TK_BY 305 +#define TK_SESSION 306 +#define TK_STATE_WINDOW 307 +#define TK_EVENT_WINDOW 308 +#define TK_COUNT_WINDOW 309 +#define TK_SLIDING 310 +#define TK_FILL 311 +#define TK_VALUE 312 +#define TK_VALUE_F 313 +#define TK_NONE 314 +#define TK_PREV 315 +#define TK_NULL_F 316 +#define TK_LINEAR 317 +#define TK_NEXT 318 +#define TK_HAVING 319 +#define TK_RANGE 320 +#define TK_EVERY 321 +#define TK_ORDER 322 +#define TK_SLIMIT 323 +#define TK_SOFFSET 324 +#define TK_LIMIT 325 +#define TK_OFFSET 326 +#define TK_ASC 327 +#define TK_NULLS 328 +#define TK_ABORT 329 +#define TK_AFTER 330 +#define TK_ATTACH 331 +#define TK_BEFORE 332 +#define TK_BEGIN 333 +#define TK_BITAND 334 +#define TK_BITNOT 335 +#define TK_BITOR 336 +#define TK_BLOCKS 337 +#define TK_CHANGE 338 +#define TK_COMMA 339 +#define TK_CONCAT 340 +#define TK_CONFLICT 341 +#define TK_COPY 342 +#define TK_DEFERRED 343 +#define TK_DELIMITERS 344 +#define TK_DETACH 345 +#define TK_DIVIDE 346 +#define TK_DOT 347 +#define TK_EACH 348 +#define TK_FAIL 349 +#define TK_FOR 350 +#define TK_GLOB 351 +#define TK_ID 352 +#define TK_IMMEDIATE 353 +#define TK_IMPORT 354 +#define TK_INITIALLY 355 +#define TK_INSTEAD 356 +#define TK_ISNULL 357 +#define TK_MODULES 358 +#define TK_NK_BITNOT 359 +#define TK_NK_SEMI 360 +#define TK_NOTNULL 361 +#define TK_OF 362 +#define TK_PLUS 363 +#define TK_PRIVILEGE 364 +#define TK_RAISE 365 +#define TK_RESTRICT 366 +#define TK_ROW 367 +#define TK_STAR 368 +#define TK_STATEMENT 369 +#define TK_STRICT 370 +#define TK_STRING 371 +#define TK_TIMES 372 +#define TK_VALUES 373 +#define TK_VARIABLE 374 +#define TK_WAL 375 +#define TK_ENCODE 376 +#define TK_COMPRESS 377 +#define TK_LEVEL 378 + #define TK_NK_SPACE 600 #define TK_NK_COMMENT 601 diff --git a/include/libs/executor/storageapi.h b/include/libs/executor/storageapi.h index de04288b7950..06a0a0348fab 100644 --- a/include/libs/executor/storageapi.h +++ b/include/libs/executor/storageapi.h @@ -326,6 +326,9 @@ typedef struct { int64_t number; void* pStreamFileState; int32_t buffIndex; + int32_t hashIter; + void* pHashData; + int64_t minGpId; } SStreamStateCur; typedef struct SStateStore { @@ -352,6 +355,8 @@ typedef struct SStateStore { int32_t (*streamStateFillPut)(SStreamState* pState, const SWinKey* key, const void* value, int32_t vLen); int32_t (*streamStateFillGet)(SStreamState* pState, const SWinKey* key, void** pVal, int32_t* pVLen, int32_t* pWinCode); + int32_t (*streamStateFillAddIfNotExist)(SStreamState* pState, const SWinKey* key, void** pVal, int32_t* pVLen, + int32_t* pWinCode); void (*streamStateFillDel)(SStreamState* pState, const SWinKey* key); int32_t (*streamStateFillGetNext)(SStreamState* pState, const SWinKey* pKey, SWinKey* pResKey, void** pVal, int32_t* pVLen, int32_t* pWinCode); @@ -417,6 +422,11 @@ typedef struct SStateStore { struct SStreamFileState* (*streamFileStateInit)(int64_t memSize, uint32_t keySize, uint32_t rowSize, uint32_t selectRowSize, GetTsFun fp, void* pFile, TSKEY delMark, const char* id, int64_t ckId, int8_t type); + + int32_t (*streamStateGroupPut)(SStreamState* pState, int64_t groupId, void* value, int32_t vLen); + SStreamStateCur* (*streamStateGroupGetCur)(SStreamState* pState); + void (*streamStateGroupCurNext)(SStreamStateCur* pCur); + int32_t (*streamStateGroupGetKVByCur)(SStreamStateCur* pCur, int64_t* pKey, void** pVal, int32_t* pVLen); void (*streamFileStateDestroy)(struct SStreamFileState* pFileState); void (*streamFileStateClear)(struct SStreamFileState* pFileState); diff --git a/include/libs/stream/streamState.h b/include/libs/stream/streamState.h index 046812f396b4..415a33a0a371 100644 --- a/include/libs/stream/streamState.h +++ b/include/libs/stream/streamState.h @@ -76,11 +76,13 @@ int32_t streamStateStateAddIfNotExist(SStreamState* pState, SSessionKey* key, ch // fill int32_t streamStateFillPut(SStreamState* pState, const SWinKey* key, const void* value, int32_t vLen); int32_t streamStateFillGet(SStreamState* pState, const SWinKey* key, void** pVal, int32_t* pVLen, int32_t* pWinCode); +int32_t streamStateFillAddIfNotExist(SStreamState* pState, const SWinKey* key, void** pVal, int32_t* pVLen, + int32_t* pWinCode); void streamStateFillDel(SStreamState* pState, const SWinKey* key); -int32_t streamStateFillGetNext(SStreamState* pState, const SWinKey* pKey, SWinKey* pResKey, void** pVal, - int32_t* pVLen, int32_t* pWinCode); -int32_t streamStateFillGetPrev(SStreamState* pState, const SWinKey* pKey, SWinKey* pResKey, void** pVal, - int32_t* pVLen, int32_t* pWinCode); +int32_t streamStateFillGetNext(SStreamState* pState, const SWinKey* pKey, SWinKey* pResKey, void** pVal, int32_t* pVLen, + int32_t* pWinCode); +int32_t streamStateFillGetPrev(SStreamState* pState, const SWinKey* pKey, SWinKey* pResKey, void** pVal, int32_t* pVLen, + int32_t* pWinCode); int32_t streamStateAddIfNotExist(SStreamState* pState, const SWinKey* key, void** pVal, int32_t* pVLen, int32_t* pWinCode); @@ -109,6 +111,12 @@ void streamStateCurPrev(SStreamState* pState, SStreamStateCur* pCur); int32_t streamStatePutParName(SStreamState* pState, int64_t groupId, const char* tbname); int32_t streamStateGetParName(SStreamState* pState, int64_t groupId, void** pVal, bool onlyCache, int32_t* pWinCode); +// group id +int32_t streamStateGroupPut(SStreamState* pState, int64_t groupId, void* value, int32_t vLen); +SStreamStateCur* streamStateGroupGetCur(SStreamState* pState); +void streamStateGroupCurNext(SStreamStateCur* pCur); +int32_t streamStateGroupGetKVByCur(SStreamStateCur* pCur, int64_t* pKey, void** pVal, int32_t* pVLen); + void streamStateReloadInfo(SStreamState* pState, TSKEY ts); void streamStateCopyBackend(SStreamState* src, SStreamState* dst); diff --git a/include/libs/stream/tstreamFileState.h b/include/libs/stream/tstreamFileState.h index bb0d49f1f1d9..f6f3943240ac 100644 --- a/include/libs/stream/tstreamFileState.h +++ b/include/libs/stream/tstreamFileState.h @@ -56,6 +56,8 @@ bool needClearDiskBuff(SStreamFileState* pFileState); void streamFileStateReleaseBuff(SStreamFileState* pFileState, SRowBuffPos* pPos, bool used); void streamFileStateClearBuff(SStreamFileState* pFileState, SRowBuffPos* pPos); +int32_t addRowBuffIfNotExist(SStreamFileState* pFileState, void* pKey, int32_t keyLen, void** pVal, int32_t* pVLen, + int32_t* pWinCode); int32_t getRowBuff(SStreamFileState* pFileState, void* pKey, int32_t keyLen, void** pVal, int32_t* pVLen, int32_t* pWinCode); void deleteRowBuff(SStreamFileState* pFileState, const void* pKey, int32_t keyLen); @@ -98,6 +100,7 @@ void recoverSesssion(SStreamFileState* pFileState, int64_t ckId); void sessionWinStateClear(SStreamFileState* pFileState); void sessionWinStateCleanup(void* pBuff); +SStreamStateCur* createStateCursor(SStreamFileState* pFileState); SStreamStateCur* sessionWinStateSeekKeyCurrentPrev(SStreamFileState* pFileState, const SSessionKey* pWinKey); SStreamStateCur* sessionWinStateSeekKeyCurrentNext(SStreamFileState* pFileState, const SSessionKey* pWinKey); SStreamStateCur* sessionWinStateSeekKeyNext(SStreamFileState* pFileState, const SSessionKey* pWinKey); @@ -136,6 +139,11 @@ int32_t getHashSortPrevRow(SStreamFileState* pFileState, const SWinKey* pKey, SW int32_t recoverFillSnapshot(SStreamFileState* pFileState, int64_t ckId); void deleteHashSortRowBuff(SStreamFileState* pFileState, const SWinKey* pKey); +//group +int32_t streamFileStateGroupPut(SStreamFileState* pFileState, int64_t groupId, void* value, int32_t vLen); +void streamFileStateGroupCurNext(SStreamStateCur* pCur); +int32_t streamFileStateGroupGetKVByCur(SStreamStateCur* pCur, int64_t* pKey, void** pVal, int32_t* pVLen); + #ifdef __cplusplus } #endif diff --git a/source/dnode/mnode/impl/src/mndStreamUtil.c b/source/dnode/mnode/impl/src/mndStreamUtil.c index 38fddd8bf0f0..71858be72fad 100644 --- a/source/dnode/mnode/impl/src/mndStreamUtil.c +++ b/source/dnode/mnode/impl/src/mndStreamUtil.c @@ -1349,6 +1349,8 @@ static void mndShowStreamTrigger(char *dst, SStreamObj *pStream) { strcpy(dst, "window close"); } else if (trigger == STREAM_TRIGGER_MAX_DELAY) { strcpy(dst, "max delay"); + } else if (trigger == STREAM_TRIGGER_FORCE_WINDOW_CLOSE) { + strcpy(dst, "force window close"); } } diff --git a/source/dnode/snode/src/snodeInitApi.c b/source/dnode/snode/src/snodeInitApi.c index 9a353a0b7c7a..5485c000d1c5 100644 --- a/source/dnode/snode/src/snodeInitApi.c +++ b/source/dnode/snode/src/snodeInitApi.c @@ -49,6 +49,7 @@ void initStateStoreAPI(SStateStore* pStore) { pStore->streamStateFillPut = streamStateFillPut; pStore->streamStateFillGet = streamStateFillGet; + pStore->streamStateFillAddIfNotExist = streamStateFillAddIfNotExist; pStore->streamStateFillDel = streamStateFillDel; pStore->streamStateFillGetNext = streamStateFillGetNext; pStore->streamStateFillGetPrev = streamStateFillGetPrev; @@ -77,10 +78,10 @@ void initStateStoreAPI(SStateStore* pStore) { pStore->streamStateCountGetKeyByRange = streamStateCountGetKeyByRange; pStore->streamStateSessionAllocWinBuffByNextPosition = streamStateSessionAllocWinBuffByNextPosition; -//void initStreamStateAPI(SStorageAPI* pAPI) { -// initStateStoreAPI(&pAPI->stateStore); -// initFunctionStateStore(&pAPI->functionStore); -//} + // void initStreamStateAPI(SStorageAPI* pAPI) { + // initStateStoreAPI(&pAPI->stateStore); + // initFunctionStateStore(&pAPI->functionStore); + // } pStore->updateInfoInit = updateInfoInit; pStore->updateInfoFillBlockData = updateInfoFillBlockData; @@ -102,6 +103,11 @@ void initStateStoreAPI(SStateStore* pStore) { pStore->streamStateSessionSeekKeyCurrentPrev = streamStateSessionSeekKeyCurrentPrev; pStore->streamStateSessionSeekKeyCurrentNext = streamStateSessionSeekKeyCurrentNext; + pStore->streamStateGroupPut = streamStateGroupPut; + pStore->streamStateGroupGetCur = streamStateGroupGetCur; + pStore->streamStateGroupCurNext = streamStateGroupCurNext; + pStore->streamStateGroupGetKVByCur = streamStateGroupGetKVByCur; + pStore->streamFileStateDestroy = streamFileStateDestroy; pStore->streamFileStateClear = streamFileStateClear; pStore->needClearDiskBuff = needClearDiskBuff; diff --git a/source/dnode/vnode/src/vnd/vnodeInitApi.c b/source/dnode/vnode/src/vnd/vnodeInitApi.c index b96f7ba0a77e..ed1632cb9731 100644 --- a/source/dnode/vnode/src/vnd/vnodeInitApi.c +++ b/source/dnode/vnode/src/vnd/vnodeInitApi.c @@ -165,6 +165,7 @@ void initStateStoreAPI(SStateStore* pStore) { pStore->streamStateFillPut = streamStateFillPut; pStore->streamStateFillGet = streamStateFillGet; + pStore->streamStateFillAddIfNotExist = streamStateFillAddIfNotExist; pStore->streamStateFillDel = streamStateFillDel; pStore->streamStateFillGetNext = streamStateFillGetNext; pStore->streamStateFillGetPrev = streamStateFillGetPrev; @@ -216,6 +217,11 @@ void initStateStoreAPI(SStateStore* pStore) { pStore->streamStateSessionSeekKeyCurrentPrev = streamStateSessionSeekKeyCurrentPrev; pStore->streamStateSessionSeekKeyCurrentNext = streamStateSessionSeekKeyCurrentNext; + pStore->streamStateGroupPut = streamStateGroupPut; + pStore->streamStateGroupGetCur = streamStateGroupGetCur; + pStore->streamStateGroupCurNext = streamStateGroupCurNext; + pStore->streamStateGroupGetKVByCur = streamStateGroupGetKVByCur; + pStore->streamFileStateDestroy = streamFileStateDestroy; pStore->streamFileStateClear = streamFileStateClear; pStore->needClearDiskBuff = needClearDiskBuff; diff --git a/source/libs/executor/inc/executorInt.h b/source/libs/executor/inc/executorInt.h index 3ae7a968ffd9..f09545a8db58 100644 --- a/source/libs/executor/inc/executorInt.h +++ b/source/libs/executor/inc/executorInt.h @@ -476,6 +476,7 @@ typedef struct SStreamScanInfo { STqReader* tqReader; uint64_t groupId; + bool igCheckGroupId; struct SUpdateInfo* pUpdateInfo; EStreamScanMode scanMode; diff --git a/source/libs/executor/src/executil.c b/source/libs/executor/src/executil.c index 573cc0425d15..2a9f952477bc 100644 --- a/source/libs/executor/src/executil.c +++ b/source/libs/executor/src/executil.c @@ -321,8 +321,8 @@ int32_t prepareDataBlockBuf(SSDataBlock* pDataBlock, SColMatchInfo* pMatchInfo) EDealRes doTranslateTagExpr(SNode** pNode, void* pContext) { STransTagExprCtx* pCtx = pContext; - SMetaReader* mr = pCtx->pReader; - bool isTagCol = false, isTbname = false; + SMetaReader* mr = pCtx->pReader; + bool isTagCol = false, isTbname = false; if (nodeType(*pNode) == QUERY_NODE_COLUMN) { SColumnNode* pCol = (SColumnNode*)*pNode; if (pCol->colType == COLUMN_TYPE_TBNAME) @@ -434,7 +434,7 @@ int32_t isQualifiedTable(STableKeyInfo* info, SNode* pTagCond, void* metaHandle, static EDealRes getColumn(SNode** pNode, void* pContext) { tagFilterAssist* pData = (tagFilterAssist*)pContext; - SColumnNode* pSColumnNode = NULL; + SColumnNode* pSColumnNode = NULL; if (QUERY_NODE_COLUMN == nodeType((*pNode))) { pSColumnNode = *(SColumnNode**)pNode; } else if (QUERY_NODE_FUNCTION == nodeType((*pNode))) { @@ -457,7 +457,7 @@ static EDealRes getColumn(SNode** pNode, void* pContext) { return DEAL_RES_CONTINUE; } - void* data = taosHashGet(pData->colHash, &pSColumnNode->colId, sizeof(pSColumnNode->colId)); + void* data = taosHashGet(pData->colHash, &pSColumnNode->colId, sizeof(pSColumnNode->colId)); if (!data) { int32_t tempRes = taosHashPut(pData->colHash, &pSColumnNode->colId, sizeof(pSColumnNode->colId), pNode, sizeof((*pNode))); @@ -1458,7 +1458,7 @@ int32_t getGroupIdFromTagsVal(void* pVnode, uint64_t uid, SNodeList* pGroupNode, } SNodeList* groupNew = NULL; - int32_t code = nodesCloneList(pGroupNode, &groupNew); + int32_t code = nodesCloneList(pGroupNode, &groupNew); if (TSDB_CODE_SUCCESS != code) { pAPI->metaReaderFn.clearReader(&mr); return code; @@ -1722,7 +1722,7 @@ int32_t createExprFromOneNode(SExprInfo* pExp, SNode* pNode, int16_t slotId) { if (!pFuncNode->pParameterList && (memcmp(pExprNode->_function.functionName, name, len) == 0) && pExprNode->_function.functionName[len] == 0) { pFuncNode->pParameterList = NULL; - int32_t code = nodesMakeList(&pFuncNode->pParameterList); + int32_t code = nodesMakeList(&pFuncNode->pParameterList); SValueNode* res = NULL; if (TSDB_CODE_SUCCESS == code) { code = nodesMakeNode(QUERY_NODE_VALUE, (SNode**)&res); @@ -1787,7 +1787,8 @@ int32_t createExprFromOneNode(SExprInfo* pExp, SNode* pNode, int16_t slotId) { if (TSDB_CODE_SUCCESS == code) { pExp->base.numOfParams = 1; SDataType* pType = &pCond->node.resType; - pExp->base.resSchema = createResSchema(pType->type, pType->bytes, slotId, pType->scale, pType->precision, pCond->node.aliasName); + pExp->base.resSchema = + createResSchema(pType->type, pType->bytes, slotId, pType->scale, pType->precision, pCond->node.aliasName); pExp->pExpr->_optrRoot.pRootNode = pNode; } } else { @@ -2325,7 +2326,7 @@ int32_t tableListAddTableInfo(STableListInfo* pTableList, uint64_t uid, uint64_t int32_t slot = (int32_t)taosArrayGetSize(pTableList->pTableList) - 1; code = taosHashPut(pTableList->map, &uid, sizeof(uid), &slot, sizeof(slot)); if (code != TSDB_CODE_SUCCESS) { - ASSERT(code != TSDB_CODE_DUP_KEY); // we have checked the existence of uid in hash map above + ASSERT(code != TSDB_CODE_DUP_KEY); // we have checked the existence of uid in hash map above taosArrayPopTailBatch(pTableList->pTableList, 1); // let's pop the last element in the array list } @@ -2664,7 +2665,9 @@ void printSpecDataBlock(SSDataBlock* pBlock, const char* flag, const char* opStr qDebug("%s===stream===%s %s: Block is Null", taskIdStr, flag, opStr); return; } else if (pBlock->info.rows == 0) { - qDebug("%s===stream===%s %s: Block is Empty. block type %d", taskIdStr, flag, opStr, pBlock->info.type); + qDebug("%s===stream===%s %s: Block is Empty. block type %d.skey:%" PRId64 ",ekey:%" PRId64 ",version%" PRId64, + taskIdStr, flag, opStr, pBlock->info.type, pBlock->info.window.skey, pBlock->info.window.ekey, + pBlock->info.version); return; } if (qDebugFlag & DEBUG_DEBUG) { diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index bd0b9057e020..ff2cdcd0270c 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -1483,7 +1483,11 @@ static void setGroupId(SStreamScanInfo* pInfo, SSDataBlock* pBlock, int32_t grou SColumnInfoData* pColInfo = taosArrayGet(pBlock->pDataBlock, groupColIndex); uint64_t* groupCol = (uint64_t*)pColInfo->pData; ASSERT(rowIndex < pBlock->info.rows); - pInfo->groupId = groupCol[rowIndex]; + if (colDataIsNull_s(pColInfo, rowIndex)) { + pInfo->igCheckGroupId = true; + } else { + pInfo->groupId = groupCol[rowIndex]; + } } void resetTableScanInfo(STableScanInfo* pTableScanInfo, STimeWindow* pWin, uint64_t ver) { @@ -1751,6 +1755,12 @@ static int32_t doRangeScan(SStreamScanInfo* pInfo, SSDataBlock* pSDB, int32_t ts continue; } + if (pInfo->igCheckGroupId == true) { + pResult->info.calWin = pInfo->updateWin; + (*ppRes) = pResult; + goto _end; + } + if (pInfo->partitionSup.needCalc) { SSDataBlock* tmpBlock = NULL; code = createOneDataBlock(pResult, true, &tmpBlock); @@ -1825,10 +1835,10 @@ int32_t appendOneRowToSpecialBlockImpl(SSDataBlock* pBlock, TSKEY* pStartTs, TSK code = colDataSetVal(pEndTsCol, pBlock->info.rows, (const char*)pEndTs, false); QUERY_CHECK_CODE(code, lino, _end); - code = colDataSetVal(pUidCol, pBlock->info.rows, (const char*)pUid, false); + code = colDataSetVal(pUidCol, pBlock->info.rows, (const char*)pUid, pUid == NULL); QUERY_CHECK_CODE(code, lino, _end); - code = colDataSetVal(pGpCol, pBlock->info.rows, (const char*)pGp, false); + code = colDataSetVal(pGpCol, pBlock->info.rows, (const char*)pGp, pGp == NULL); QUERY_CHECK_CODE(code, lino, _end); code = colDataSetVal(pCalStartCol, pBlock->info.rows, (const char*)pCalStartTs, false); @@ -2065,8 +2075,8 @@ static int32_t generateCountScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSrcB return code; } -int32_t getTimeSliceWinRange(SStreamAggSupporter* pAggSup, SInterval* pInterval, TSKEY start, TSKEY end, int64_t groupId, - STimeWindow* pScanRange, STimeWindow* pDelRange) { +int32_t getTimeSliceWinRange(SStreamAggSupporter* pAggSup, SInterval* pInterval, TSKEY start, TSKEY end, + int64_t groupId, STimeWindow* pScanRange, STimeWindow* pDelRange) { int32_t code = TSDB_CODE_SUCCESS; int32_t lino = 0; int32_t winCode = TSDB_CODE_SUCCESS; @@ -2161,7 +2171,7 @@ static int32_t generateTimeSliceScanRange(SStreamScanInfo* pInfo, SSDataBlock* p STimeWindow delRange = {0}; ASSERT(mode == STREAM_DELETE_RESULT || mode == STREAM_DELETE_DATA); code = getTimeSliceWinRange(pInfo->windowSup.pStreamAggSup, &pInfo->interval, startData[i], endData[i], groupId, - &scanRange, &delRange); + &scanRange, &delRange); QUERY_CHECK_CODE(code, lino, _end); code = colDataSetVal(pDestStartCol, i, (const char*)&scanRange.skey, false); @@ -3157,6 +3167,12 @@ static bool isStreamWindow(SStreamScanInfo* pInfo) { isTimeSlice(pInfo); } +static int32_t copyGetResultBlock(SSDataBlock* dest, const SSDataBlock* src) { + TSKEY start = src->info.window.skey; + TSKEY end = src->info.window.ekey; + return appendDataToSpecialBlock(dest, &start, &end, NULL, NULL, NULL); +} + static int32_t doStreamScanNext(SOperatorInfo* pOperator, SSDataBlock** ppRes) { // NOTE: this operator does never check if current status is done or not int32_t code = TSDB_CODE_SUCCESS; @@ -3380,13 +3396,22 @@ static int32_t doStreamScanNext(SOperatorInfo* pOperator, SSDataBlock** ppRes) { } } } break; + case STREAM_GET_RESULT: { + pInfo->blockType = STREAM_INPUT__DATA_SUBMIT; + pInfo->updateResIndex = 0; + code = copyGetResultBlock(pInfo->pUpdateRes, pBlock); + QUERY_CHECK_CODE(code, lino, _end); + pInfo->pUpdateInfo->maxDataVersion = pBlock->info.version; + prepareRangeScan(pInfo, pInfo->pUpdateRes, &pInfo->updateResIndex, NULL); + pInfo->scanMode = STREAM_SCAN_FROM_DATAREADER_RANGE; + } break; case STREAM_CHECKPOINT: { qError("stream check point error. msg type: STREAM_INPUT__DATA_BLOCK"); } break; default: break; } - printDataBlock(pBlock, getStreamOpName(pOperator->operatorType), GET_TASKID(pTaskInfo)); + printSpecDataBlock(pBlock, getStreamOpName(pOperator->operatorType), "block recv", GET_TASKID(pTaskInfo)); setStreamOperatorState(&pInfo->basic, pBlock->info.type); (*ppRes) = pBlock; return code; @@ -4129,6 +4154,7 @@ int32_t createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhysiNode* pInfo->scanMode = STREAM_SCAN_FROM_READERHANDLE; pInfo->windowSup = (SWindowSupporter){.pStreamAggSup = NULL, .gap = -1, .parentType = QUERY_NODE_PHYSICAL_PLAN}; pInfo->groupId = 0; + pInfo->igCheckGroupId = false; pInfo->pStreamScanOp = pOperator; pInfo->deleteDataIndex = 0; code = createSpecialDataBlock(STREAM_DELETE_DATA, &pInfo->pDeleteDataRes); diff --git a/source/libs/executor/src/streamtimesliceoperator.c b/source/libs/executor/src/streamtimesliceoperator.c index a58c80d9863b..98991a850af0 100644 --- a/source/libs/executor/src/streamtimesliceoperator.c +++ b/source/libs/executor/src/streamtimesliceoperator.c @@ -591,7 +591,7 @@ static TSKEY adustEndTsKey(TSKEY pointTs, TSKEY rowTs, SInterval* pInterval) { } static int32_t getLinearResultInfoFromState(SStreamAggSupporter* pAggSup, SStreamFillSupporter* pFillSup, TSKEY ts, int64_t groupId, SSlicePoint* pCurPoint, SSlicePoint* pPrevPoint, - SSlicePoint* pNextPoint, int32_t* pWinCode) { + SSlicePoint* pNextPoint) { int32_t code = TSDB_CODE_SUCCESS; int32_t lino = 0; int32_t tmpRes = TSDB_CODE_SUCCESS; @@ -605,7 +605,7 @@ static int32_t getLinearResultInfoFromState(SStreamAggSupporter* pAggSup, SStrea pCurPoint->key.ts = ts; int32_t curVLen = 0; code = - pAggSup->stateStore.streamStateFillGet(pState, &pCurPoint->key, (void**)&pCurPoint->pResPos, &curVLen, pWinCode); + pAggSup->stateStore.streamStateFillGet(pState, &pCurPoint->key, (void**)&pCurPoint->pResPos, &curVLen, &tmpRes); QUERY_CHECK_CODE(code, lino, _end); setPointBuff(pCurPoint, pFillSup); @@ -674,7 +674,7 @@ static int32_t getLinearResultInfoFromState(SStreamAggSupporter* pAggSup, SStrea static int32_t getResultInfoFromState(SStreamAggSupporter* pAggSup, SStreamFillSupporter* pFillSup, TSKEY ts, int64_t groupId, SSlicePoint* pCurPoint, SSlicePoint* pPrevPoint, - SSlicePoint* pNextPoint, int32_t* pWinCode) { + SSlicePoint* pNextPoint) { int32_t code = TSDB_CODE_SUCCESS; int32_t lino = 0; int32_t tmpRes = TSDB_CODE_SUCCESS; @@ -688,13 +688,16 @@ static int32_t getResultInfoFromState(SStreamAggSupporter* pAggSup, SStreamFillS pCurPoint->key.ts = ts; int32_t curVLen = 0; code = - pAggSup->stateStore.streamStateFillGet(pState, &pCurPoint->key, (void**)&pCurPoint->pResPos, &curVLen, pWinCode); + pAggSup->stateStore.streamStateFillGet(pState, &pCurPoint->key, (void**)&pCurPoint->pResPos, &curVLen, &tmpRes); QUERY_CHECK_CODE(code, lino, _end); - setPointBuff(pCurPoint, pFillSup); - - pFillSup->cur.key = pCurPoint->pRightRow->key; - pFillSup->cur.pRowVal = pCurPoint->pRightRow->pRowVal; + if (tmpRes == TSDB_CODE_SUCCESS) { + setPointBuff(pCurPoint, pFillSup); + pFillSup->cur.key = pCurPoint->pRightRow->key; + pFillSup->cur.pRowVal = pCurPoint->pRightRow->pRowVal; + } else { + pFillSup->cur.key = pCurPoint->key.ts + 1; + } pPrevPoint->key.groupId = groupId; int32_t preVLen = 0; @@ -755,8 +758,8 @@ static int32_t getPointInfoFromStateRight(SStreamAggSupporter* pAggSup, SStreamF pNextPoint->key.ts = stw.skey; int32_t curVLen = 0; - code = pAggSup->stateStore.streamStateFillGet(pState, &pNextPoint->key, (void**)&pNextPoint->pResPos, &curVLen, - pWinCode); + code = pAggSup->stateStore.streamStateFillAddIfNotExist(pState, &pNextPoint->key, (void**)&pNextPoint->pResPos, + &curVLen, pWinCode); QUERY_CHECK_CODE(code, lino, _end); setPointBuff(pNextPoint, pFillSup); @@ -800,8 +803,8 @@ static int32_t getPointInfoFromState(SStreamAggSupporter* pAggSup, SStreamFillSu pCurPoint->key.ts = ts; int32_t curVLen = 0; - code = - pAggSup->stateStore.streamStateFillGet(pState, &pCurPoint->key, (void**)&pCurPoint->pResPos, &curVLen, pWinCode); + code = pAggSup->stateStore.streamStateFillAddIfNotExist(pState, &pCurPoint->key, (void**)&pCurPoint->pResPos, + &curVLen, pWinCode); QUERY_CHECK_CODE(code, lino, _end); setPointBuff(pCurPoint, pFillSup); @@ -828,8 +831,8 @@ static int32_t getPointInfoFromState(SStreamAggSupporter* pAggSup, SStreamFillSu } else { pNextPoint->key.ts = taosTimeAdd(pCurPoint->key.ts, pFillSup->interval.sliding, pFillSup->interval.slidingUnit, pFillSup->interval.precision); - code = pAggSup->stateStore.streamStateFillGet(pState, &pNextPoint->key, (void**)&pNextPoint->pResPos, &nextVLen, - &tmpRes); + code = pAggSup->stateStore.streamStateFillAddIfNotExist(pState, &pNextPoint->key, (void**)&pNextPoint->pResPos, + &nextVLen, &tmpRes); QUERY_CHECK_CODE(code, lino, _end); setPointBuff(pNextPoint, pFillSup); if (tmpRes != TSDB_CODE_SUCCESS) { @@ -1021,6 +1024,30 @@ static void transBlockToResultRow(const SSDataBlock* pBlock, int32_t rowId, TSKE pRowVal->key = ts; } +static int32_t saveTimeSliceWinResultInfo(SStreamAggSupporter* pAggSup, int8_t trigger, SWinKey* pKey, + SSHashObj* pUpdatedMap, bool needDel, SSHashObj* pDeletedMap) { + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; + + if (trigger == STREAM_TRIGGER_AT_ONCE) { + code = saveTimeSliceWinResult(pKey, pUpdatedMap); + QUERY_CHECK_CODE(code, lino, _end); + if (needDel) { + code = saveTimeSliceWinResult(pKey, pDeletedMap); + QUERY_CHECK_CODE(code, lino, _end); + } + } else if (trigger == STREAM_TRIGGER_FORCE_WINDOW_CLOSE) { + code = pAggSup->stateStore.streamStateGroupPut(pAggSup->pState, pKey->groupId, NULL, 0); + QUERY_CHECK_CODE(code, lino, _end); + } + +_end: + if (code != TSDB_CODE_SUCCESS) { + qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } + return code; +} + static void doStreamTimeSliceImpl(SOperatorInfo* pOperator, SSDataBlock* pBlock) { int32_t code = TSDB_CODE_SUCCESS; int32_t lino = 0; @@ -1088,10 +1115,9 @@ static void doStreamTimeSliceImpl(SOperatorInfo* pOperator, SSDataBlock* pBlock) right = needAdjustValue(&curPoint, tsCols[startPos], false, pFillSup->type); if (right) { transBlockToResultRow(pBlock, startPos, tsCols[startPos], curPoint.pRightRow); - saveTimeSliceWinResult(&curPoint.key, pInfo->pUpdatedMap); - if (pInfo->destHasPrimaryKey && winCode == TSDB_CODE_SUCCESS) { - saveTimeSliceWinResult(&curPoint.key, pInfo->pDeletedMap); - } + bool needDel = pInfo->destHasPrimaryKey && winCode == TSDB_CODE_SUCCESS; + saveTimeSliceWinResultInfo(pAggSup, pInfo->twAggSup.calTrigger, &curPoint.key, pInfo->pUpdatedMap, needDel, + pInfo->pDeletedMap); } releaseOutputBuf(pAggSup->pState, curPoint.pResPos, &pAggSup->stateStore); @@ -1103,10 +1129,9 @@ static void doStreamTimeSliceImpl(SOperatorInfo* pOperator, SSDataBlock* pBlock) left = needAdjustValue(&nextPoint, tsCols[leftRowId], true, pFillSup->type); if (left) { transBlockToResultRow(pBlock, leftRowId, tsCols[leftRowId], nextPoint.pLeftRow); - saveTimeSliceWinResult(&nextPoint.key, pInfo->pUpdatedMap); - if (pInfo->destHasPrimaryKey && winCode == TSDB_CODE_SUCCESS) { - saveTimeSliceWinResult(&curPoint.key, pInfo->pDeletedMap); - } + bool needDel = pInfo->destHasPrimaryKey && winCode == TSDB_CODE_SUCCESS; + saveTimeSliceWinResultInfo(pAggSup, pInfo->twAggSup.calTrigger, &nextPoint.key, pInfo->pUpdatedMap, needDel, + pInfo->pDeletedMap); } releaseOutputBuf(pAggSup->pState, nextPoint.pResPos, &pAggSup->stateStore); @@ -1125,10 +1150,9 @@ static void doStreamTimeSliceImpl(SOperatorInfo* pOperator, SSDataBlock* pBlock) right = needAdjustValue(&curPoint, tsCols[startPos], false, pFillSup->type); if (right) { transBlockToResultRow(pBlock, startPos, tsCols[startPos], curPoint.pRightRow); - saveTimeSliceWinResult(&curPoint.key, pInfo->pUpdatedMap); - if (pInfo->destHasPrimaryKey && winCode == TSDB_CODE_SUCCESS) { - saveTimeSliceWinResult(&curPoint.key, pInfo->pDeletedMap); - } + bool needDel = pInfo->destHasPrimaryKey && winCode == TSDB_CODE_SUCCESS; + saveTimeSliceWinResultInfo(pAggSup, pInfo->twAggSup.calTrigger, &curPoint.key, pInfo->pUpdatedMap, needDel, + pInfo->pDeletedMap); } releaseOutputBuf(pAggSup->pState, curPoint.pResPos, &pAggSup->stateStore); } @@ -1162,13 +1186,11 @@ void doBuildTimeSlicePointResult(SStreamAggSupporter* pAggSup, SStreamFillSuppor SSlicePoint curPoint = {.key.ts = pKey->ts, .key.groupId = pKey->groupId}; SSlicePoint prevPoint = {0}; SSlicePoint nextPoint = {0}; - int32_t winCode = TSDB_CODE_SUCCESS; if (pFillSup->type != TSDB_FILL_LINEAR) { - code = getResultInfoFromState(pAggSup, pFillSup, pKey->ts, pKey->groupId, &curPoint, &prevPoint, &nextPoint, - &winCode); + code = getResultInfoFromState(pAggSup, pFillSup, pKey->ts, pKey->groupId, &curPoint, &prevPoint, &nextPoint); } else { - code = getLinearResultInfoFromState(pAggSup, pFillSup, pKey->ts, pKey->groupId, &curPoint, &prevPoint, &nextPoint, - &winCode); + code = + getLinearResultInfoFromState(pAggSup, pFillSup, pKey->ts, pKey->groupId, &curPoint, &prevPoint, &nextPoint); } QUERY_CHECK_CODE(code, lino, _end); @@ -1291,6 +1313,28 @@ static int32_t doDeleteTimeSliceResult(SStreamAggSupporter* pAggSup, SSDataBlock return code; } +static int32_t setAllResultKey(SStreamAggSupporter* pAggSup, TSKEY ts, SSHashObj* pUpdatedMap) { + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; + int64_t groupId = 0; + SStreamStateCur* pCur = pAggSup->stateStore.streamStateGroupGetCur(pAggSup->pState); + int32_t winCode = pAggSup->stateStore.streamStateGroupGetKVByCur(pCur, &groupId, NULL, NULL); + if (winCode != TSDB_CODE_SUCCESS) { + goto _end; + } + SWinKey key = {.ts = ts, .groupId = groupId}; + code = saveTimeSliceWinResult(&key, pUpdatedMap); + QUERY_CHECK_CODE(code, lino, _end); + + pAggSup->stateStore.streamStateGroupCurNext(pCur); + +_end: + if (code != TSDB_CODE_SUCCESS) { + qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } + return code; +} + static int32_t doStreamTimeSliceNext(SOperatorInfo* pOperator, SSDataBlock** ppRes) { int32_t code = TSDB_CODE_SUCCESS; int32_t lino = 0; @@ -1376,6 +1420,10 @@ static int32_t doStreamTimeSliceNext(SOperatorInfo* pOperator, SSDataBlock** ppR (*ppRes) = pBlock; goto _end; } break; + case STREAM_GET_RESULT: { + setAllResultKey(pAggSup, pBlock->info.window.skey, pInfo->pUpdatedMap); + continue; + } default: ASSERTS(false, "invalid SSDataBlock type"); } diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index f2d804df279e..5b8e7b33a20d 100644 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -762,6 +762,7 @@ tag_def_or_ref_opt(A) ::= TAGS NK_LP column_stream_def_list(B) NK_RP. stream_options(A) ::= . { A = createStreamOptions(pCxt); } stream_options(A) ::= stream_options(B) TRIGGER AT_ONCE(C). { A = setStreamOptions(pCxt, B, SOPT_TRIGGER_TYPE_SET, &C, NULL); } stream_options(A) ::= stream_options(B) TRIGGER WINDOW_CLOSE(C). { A = setStreamOptions(pCxt, B, SOPT_TRIGGER_TYPE_SET, &C, NULL); } +stream_options(A) ::= stream_options(B) TRIGGER FORCE_WINDOW_CLOSE(C). { A = setStreamOptions(pCxt, B, SOPT_TRIGGER_TYPE_SET, &C, NULL); } stream_options(A) ::= stream_options(B) TRIGGER MAX_DELAY(C) duration_literal(D). { A = setStreamOptions(pCxt, B, SOPT_TRIGGER_TYPE_SET, &C, releaseRawExprNode(pCxt, D)); } stream_options(A) ::= stream_options(B) WATERMARK duration_literal(C). { A = setStreamOptions(pCxt, B, SOPT_WATERMARK_SET, NULL, releaseRawExprNode(pCxt, C)); } stream_options(A) ::= stream_options(B) IGNORE EXPIRED NK_INTEGER(C). { A = setStreamOptions(pCxt, B, SOPT_IGNORE_EXPIRED_SET, &C, NULL); } diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c index cd7cda01e047..a196fcfb56d6 100644 --- a/source/libs/parser/src/parAstCreater.c +++ b/source/libs/parser/src/parAstCreater.c @@ -2953,6 +2953,8 @@ static int8_t getTriggerType(uint32_t tokenType) { return STREAM_TRIGGER_WINDOW_CLOSE; case TK_MAX_DELAY: return STREAM_TRIGGER_MAX_DELAY; + case TK_FORCE_WINDOW_CLOSE: + return STREAM_TRIGGER_FORCE_WINDOW_CLOSE; default: break; } diff --git a/source/libs/parser/src/parTokenizer.c b/source/libs/parser/src/parTokenizer.c index deec31086222..9fe191208c3d 100644 --- a/source/libs/parser/src/parTokenizer.c +++ b/source/libs/parser/src/parTokenizer.c @@ -335,6 +335,7 @@ static SKeyword keywordTable[] = { {"LEVEL", TK_LEVEL}, {"ARBGROUPS", TK_ARBGROUPS}, {"IS_IMPORT", TK_IS_IMPORT}, + {"FORCE_WINDOW_CLOSE", TK_FORCE_WINDOW_CLOSE}, }; // clang-format on diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 0cc8f39f3369..ef89131564cc 100755 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -10291,7 +10291,7 @@ static int32_t checkStreamQuery(STranslateContext* pCxt, SCreateStreamStmt* pStm "SUBTABLE expression must not has column when no partition by clause"); } - if (NULL == pSelect->pWindow && STREAM_TRIGGER_AT_ONCE != pStmt->pOptions->triggerType) { + if (NULL == pSelect->pWindow && !pSelect->hasInterpFunc && STREAM_TRIGGER_AT_ONCE != pStmt->pOptions->triggerType) { return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY, "The trigger mode of non window query can only be AT_ONCE"); } diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c index 26c5465b8c49..dabd25a4120e 100644 --- a/source/libs/parser/src/sql.c +++ b/source/libs/parser/src/sql.c @@ -25,8 +25,6 @@ ** input grammar file: */ /************ Begin %include sections from the grammar ************************/ -#line 11 "sql.y" - #include #include #include @@ -42,7 +40,6 @@ #include "parAst.h" #define YYSTACKDEPTH 0 -#line 46 "sql.c" /**************** End of %include directives **********************************/ /* These constants specify the various numeric values for terminal symbols. ***************** Begin token definitions *************************************/ @@ -279,151 +276,152 @@ #define TK_TRIGGER 230 #define TK_AT_ONCE 231 #define TK_WINDOW_CLOSE 232 -#define TK_IGNORE 233 -#define TK_EXPIRED 234 -#define TK_FILL_HISTORY 235 -#define TK_UPDATE 236 -#define TK_SUBTABLE 237 -#define TK_UNTREATED 238 -#define TK_KILL 239 -#define TK_CONNECTION 240 -#define TK_TRANSACTION 241 -#define TK_BALANCE 242 -#define TK_VGROUP 243 -#define TK_LEADER 244 -#define TK_MERGE 245 -#define TK_REDISTRIBUTE 246 -#define TK_SPLIT 247 -#define TK_DELETE 248 -#define TK_INSERT 249 -#define TK_NK_BIN 250 -#define TK_NK_HEX 251 -#define TK_NULL 252 -#define TK_NK_QUESTION 253 -#define TK_NK_ALIAS 254 -#define TK_NK_ARROW 255 -#define TK_ROWTS 256 -#define TK_QSTART 257 -#define TK_QEND 258 -#define TK_QDURATION 259 -#define TK_WSTART 260 -#define TK_WEND 261 -#define TK_WDURATION 262 -#define TK_IROWTS 263 -#define TK_ISFILLED 264 -#define TK_CAST 265 -#define TK_NOW 266 -#define TK_TODAY 267 -#define TK_TIMEZONE 268 -#define TK_CLIENT_VERSION 269 -#define TK_SERVER_VERSION 270 -#define TK_SERVER_STATUS 271 -#define TK_CURRENT_USER 272 -#define TK_CASE 273 -#define TK_WHEN 274 -#define TK_THEN 275 -#define TK_ELSE 276 -#define TK_BETWEEN 277 -#define TK_IS 278 -#define TK_NK_LT 279 -#define TK_NK_GT 280 -#define TK_NK_LE 281 -#define TK_NK_GE 282 -#define TK_NK_NE 283 -#define TK_MATCH 284 -#define TK_NMATCH 285 -#define TK_CONTAINS 286 -#define TK_IN 287 -#define TK_JOIN 288 -#define TK_INNER 289 -#define TK_LEFT 290 -#define TK_RIGHT 291 -#define TK_OUTER 292 -#define TK_SEMI 293 -#define TK_ANTI 294 -#define TK_ASOF 295 -#define TK_WINDOW 296 -#define TK_WINDOW_OFFSET 297 -#define TK_JLIMIT 298 -#define TK_SELECT 299 -#define TK_NK_HINT 300 -#define TK_DISTINCT 301 -#define TK_WHERE 302 -#define TK_PARTITION 303 -#define TK_BY 304 -#define TK_SESSION 305 -#define TK_STATE_WINDOW 306 -#define TK_EVENT_WINDOW 307 -#define TK_COUNT_WINDOW 308 -#define TK_SLIDING 309 -#define TK_FILL 310 -#define TK_VALUE 311 -#define TK_VALUE_F 312 -#define TK_NONE 313 -#define TK_PREV 314 -#define TK_NULL_F 315 -#define TK_LINEAR 316 -#define TK_NEXT 317 -#define TK_HAVING 318 -#define TK_RANGE 319 -#define TK_EVERY 320 -#define TK_ORDER 321 -#define TK_SLIMIT 322 -#define TK_SOFFSET 323 -#define TK_LIMIT 324 -#define TK_OFFSET 325 -#define TK_ASC 326 -#define TK_NULLS 327 -#define TK_ABORT 328 -#define TK_AFTER 329 -#define TK_ATTACH 330 -#define TK_BEFORE 331 -#define TK_BEGIN 332 -#define TK_BITAND 333 -#define TK_BITNOT 334 -#define TK_BITOR 335 -#define TK_BLOCKS 336 -#define TK_CHANGE 337 -#define TK_COMMA 338 -#define TK_CONCAT 339 -#define TK_CONFLICT 340 -#define TK_COPY 341 -#define TK_DEFERRED 342 -#define TK_DELIMITERS 343 -#define TK_DETACH 344 -#define TK_DIVIDE 345 -#define TK_DOT 346 -#define TK_EACH 347 -#define TK_FAIL 348 -#define TK_FOR 349 -#define TK_GLOB 350 -#define TK_ID 351 -#define TK_IMMEDIATE 352 -#define TK_IMPORT 353 -#define TK_INITIALLY 354 -#define TK_INSTEAD 355 -#define TK_ISNULL 356 -#define TK_MODULES 357 -#define TK_NK_BITNOT 358 -#define TK_NK_SEMI 359 -#define TK_NOTNULL 360 -#define TK_OF 361 -#define TK_PLUS 362 -#define TK_PRIVILEGE 363 -#define TK_RAISE 364 -#define TK_RESTRICT 365 -#define TK_ROW 366 -#define TK_STAR 367 -#define TK_STATEMENT 368 -#define TK_STRICT 369 -#define TK_STRING 370 -#define TK_TIMES 371 -#define TK_VALUES 372 -#define TK_VARIABLE 373 -#define TK_WAL 374 -#define TK_ENCODE 375 -#define TK_COMPRESS 376 -#define TK_LEVEL 377 +#define TK_FORCE_WINDOW_CLOSE 233 +#define TK_IGNORE 234 +#define TK_EXPIRED 235 +#define TK_FILL_HISTORY 236 +#define TK_UPDATE 237 +#define TK_SUBTABLE 238 +#define TK_UNTREATED 239 +#define TK_KILL 240 +#define TK_CONNECTION 241 +#define TK_TRANSACTION 242 +#define TK_BALANCE 243 +#define TK_VGROUP 244 +#define TK_LEADER 245 +#define TK_MERGE 246 +#define TK_REDISTRIBUTE 247 +#define TK_SPLIT 248 +#define TK_DELETE 249 +#define TK_INSERT 250 +#define TK_NK_BIN 251 +#define TK_NK_HEX 252 +#define TK_NULL 253 +#define TK_NK_QUESTION 254 +#define TK_NK_ALIAS 255 +#define TK_NK_ARROW 256 +#define TK_ROWTS 257 +#define TK_QSTART 258 +#define TK_QEND 259 +#define TK_QDURATION 260 +#define TK_WSTART 261 +#define TK_WEND 262 +#define TK_WDURATION 263 +#define TK_IROWTS 264 +#define TK_ISFILLED 265 +#define TK_CAST 266 +#define TK_NOW 267 +#define TK_TODAY 268 +#define TK_TIMEZONE 269 +#define TK_CLIENT_VERSION 270 +#define TK_SERVER_VERSION 271 +#define TK_SERVER_STATUS 272 +#define TK_CURRENT_USER 273 +#define TK_CASE 274 +#define TK_WHEN 275 +#define TK_THEN 276 +#define TK_ELSE 277 +#define TK_BETWEEN 278 +#define TK_IS 279 +#define TK_NK_LT 280 +#define TK_NK_GT 281 +#define TK_NK_LE 282 +#define TK_NK_GE 283 +#define TK_NK_NE 284 +#define TK_MATCH 285 +#define TK_NMATCH 286 +#define TK_CONTAINS 287 +#define TK_IN 288 +#define TK_JOIN 289 +#define TK_INNER 290 +#define TK_LEFT 291 +#define TK_RIGHT 292 +#define TK_OUTER 293 +#define TK_SEMI 294 +#define TK_ANTI 295 +#define TK_ASOF 296 +#define TK_WINDOW 297 +#define TK_WINDOW_OFFSET 298 +#define TK_JLIMIT 299 +#define TK_SELECT 300 +#define TK_NK_HINT 301 +#define TK_DISTINCT 302 +#define TK_WHERE 303 +#define TK_PARTITION 304 +#define TK_BY 305 +#define TK_SESSION 306 +#define TK_STATE_WINDOW 307 +#define TK_EVENT_WINDOW 308 +#define TK_COUNT_WINDOW 309 +#define TK_SLIDING 310 +#define TK_FILL 311 +#define TK_VALUE 312 +#define TK_VALUE_F 313 +#define TK_NONE 314 +#define TK_PREV 315 +#define TK_NULL_F 316 +#define TK_LINEAR 317 +#define TK_NEXT 318 +#define TK_HAVING 319 +#define TK_RANGE 320 +#define TK_EVERY 321 +#define TK_ORDER 322 +#define TK_SLIMIT 323 +#define TK_SOFFSET 324 +#define TK_LIMIT 325 +#define TK_OFFSET 326 +#define TK_ASC 327 +#define TK_NULLS 328 +#define TK_ABORT 329 +#define TK_AFTER 330 +#define TK_ATTACH 331 +#define TK_BEFORE 332 +#define TK_BEGIN 333 +#define TK_BITAND 334 +#define TK_BITNOT 335 +#define TK_BITOR 336 +#define TK_BLOCKS 337 +#define TK_CHANGE 338 +#define TK_COMMA 339 +#define TK_CONCAT 340 +#define TK_CONFLICT 341 +#define TK_COPY 342 +#define TK_DEFERRED 343 +#define TK_DELIMITERS 344 +#define TK_DETACH 345 +#define TK_DIVIDE 346 +#define TK_DOT 347 +#define TK_EACH 348 +#define TK_FAIL 349 +#define TK_FOR 350 +#define TK_GLOB 351 +#define TK_ID 352 +#define TK_IMMEDIATE 353 +#define TK_IMPORT 354 +#define TK_INITIALLY 355 +#define TK_INSTEAD 356 +#define TK_ISNULL 357 +#define TK_MODULES 358 +#define TK_NK_BITNOT 359 +#define TK_NK_SEMI 360 +#define TK_NOTNULL 361 +#define TK_OF 362 +#define TK_PLUS 363 +#define TK_PRIVILEGE 364 +#define TK_RAISE 365 +#define TK_RESTRICT 366 +#define TK_ROW 367 +#define TK_STAR 368 +#define TK_STATEMENT 369 +#define TK_STRICT 370 +#define TK_STRING 371 +#define TK_TIMES 372 +#define TK_VALUES 373 +#define TK_VARIABLE 374 +#define TK_WAL 375 +#define TK_ENCODE 376 +#define TK_COMPRESS 377 +#define TK_LEVEL 378 #endif /**************** End token definitions ***************************************/ @@ -483,30 +481,30 @@ #endif /************* Begin control #defines *****************************************/ #define YYCODETYPE unsigned short int -#define YYNOCODE 558 +#define YYNOCODE 559 #define YYACTIONTYPE unsigned short int #define ParseTOKENTYPE SToken typedef union { int yyinit; ParseTOKENTYPE yy0; - SAlterOption yy101; - bool yy209; - SNodeList* yy316; - SNode* yy416; - EOrder yy506; - EJoinSubType yy630; - EShowKind yy681; - int32_t yy820; - EOperatorType yy848; - STokenPair yy849; - EFillMode yy882; - SShowTablesOption yy925; - SDataType yy952; - EJoinType yy972; - int8_t yy1043; - ENullOrder yy1045; - int64_t yy1089; - SToken yy1109; + SNode* yy54; + SDataType yy84; + EJoinType yy230; + bool yy325; + int32_t yy332; + EFillMode yy478; + STokenPair yy495; + ENullOrder yy503; + int8_t yy535; + SShowTablesOption yy579; + SNodeList* yy652; + SAlterOption yy663; + EShowKind yy719; + EOrder yy760; + SToken yy837; + int64_t yy909; + EOperatorType yy922; + EJoinSubType yy948; } YYMINORTYPE; #ifndef YYSTACKDEPTH #define YYSTACKDEPTH 100 @@ -523,17 +521,17 @@ typedef union { #define ParseCTX_STORE #define YYFALLBACK 1 #define YYNSTATE 979 -#define YYNRULE 755 -#define YYNRULE_WITH_ACTION 755 -#define YYNTOKEN 378 +#define YYNRULE 756 +#define YYNRULE_WITH_ACTION 756 +#define YYNTOKEN 379 #define YY_MAX_SHIFT 978 -#define YY_MIN_SHIFTREDUCE 1448 -#define YY_MAX_SHIFTREDUCE 2202 -#define YY_ERROR_ACTION 2203 -#define YY_ACCEPT_ACTION 2204 -#define YY_NO_ACTION 2205 -#define YY_MIN_REDUCE 2206 -#define YY_MAX_REDUCE 2960 +#define YY_MIN_SHIFTREDUCE 1449 +#define YY_MAX_SHIFTREDUCE 2204 +#define YY_ERROR_ACTION 2205 +#define YY_ACCEPT_ACTION 2206 +#define YY_NO_ACTION 2207 +#define YY_MIN_REDUCE 2208 +#define YY_MAX_REDUCE 2963 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -600,900 +598,936 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (3018) +#define YY_ACTTAB_COUNT (3192) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 2711, 2403, 647, 543, 2569, 648, 2254, 2569, 542, 37, - /* 10 */ 340, 550, 47, 45, 2119, 2401, 2736, 652, 798, 211, - /* 20 */ 476, 471, 1940, 649, 2567, 855, 2926, 2566, 855, 2715, - /* 30 */ 2711, 813, 124, 810, 157, 2461, 1938, 787, 2028, 2405, - /* 40 */ 1965, 495, 2416, 2694, 797, 218, 493, 40, 39, 2927, - /* 50 */ 799, 46, 44, 43, 42, 41, 2736, 764, 748, 2715, - /* 60 */ 2754, 612, 610, 2123, 415, 2926, 2754, 232, 2023, 1965, - /* 70 */ 788, 851, 868, 502, 501, 19, 2701, 527, 850, 2717, - /* 80 */ 2719, 473, 1946, 2932, 218, 810, 157, 2569, 2927, 799, - /* 90 */ 873, 2645, 460, 2616, 1966, 47, 45, 1947, 810, 157, - /* 100 */ 2754, 478, 482, 476, 2695, 1940, 482, 2566, 855, 2717, - /* 110 */ 2720, 670, 975, 873, 435, 15, 2701, 873, 850, 1938, - /* 120 */ 873, 2028, 868, 2735, 810, 157, 2774, 43, 42, 41, - /* 130 */ 121, 2737, 854, 2739, 2740, 849, 1965, 873, 786, 2204, - /* 140 */ 657, 2608, 200, 655, 2828, 515, 648, 2254, 472, 2824, - /* 150 */ 2229, 2023, 2030, 2031, 812, 187, 2836, 2837, 19, 155, - /* 160 */ 2841, 14, 13, 2735, 2057, 1946, 2774, 482, 219, 114, - /* 170 */ 121, 2737, 854, 2739, 2740, 849, 2875, 873, 873, 2736, - /* 180 */ 159, 488, 168, 2799, 2828, 869, 2414, 929, 472, 2824, - /* 190 */ 2373, 2001, 2011, 254, 851, 975, 2264, 650, 15, 2262, - /* 200 */ 256, 2029, 2032, 841, 650, 148, 2262, 194, 2836, 809, - /* 210 */ 2701, 149, 808, 693, 840, 531, 1941, 50, 1939, 2926, - /* 220 */ 127, 2836, 2837, 2754, 155, 2841, 1712, 1713, 508, 2058, - /* 230 */ 2474, 62, 868, 507, 868, 2030, 2031, 797, 218, 2701, - /* 240 */ 2002, 850, 2927, 799, 533, 529, 188, 2836, 2837, 817, - /* 250 */ 155, 2841, 1944, 1945, 1998, 172, 2000, 2003, 2004, 2005, - /* 260 */ 2006, 2007, 2008, 2009, 2010, 846, 871, 870, 2022, 2024, - /* 270 */ 2025, 2026, 2027, 2, 2001, 2011, 2071, 2094, 443, 1950, - /* 280 */ 9, 1968, 764, 207, 2029, 2032, 2735, 331, 332, 2774, - /* 290 */ 2926, 491, 330, 121, 2737, 854, 2739, 2740, 849, 1941, - /* 300 */ 873, 1939, 2301, 1999, 1998, 2946, 747, 2828, 2932, 218, - /* 310 */ 2542, 472, 2824, 2927, 799, 2418, 36, 474, 2052, 2053, - /* 320 */ 2054, 2055, 2056, 2060, 2061, 2062, 2063, 50, 910, 174, - /* 330 */ 173, 907, 906, 905, 171, 1944, 1945, 1998, 54, 2000, - /* 340 */ 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 846, 871, - /* 350 */ 870, 2022, 2024, 2025, 2026, 2027, 2, 12, 47, 45, - /* 360 */ 2398, 422, 2736, 1909, 2474, 183, 476, 291, 1940, 388, - /* 370 */ 394, 290, 441, 2451, 869, 2414, 744, 813, 2228, 714, - /* 380 */ 713, 712, 1938, 2472, 2028, 667, 704, 154, 708, 392, - /* 390 */ 76, 2094, 707, 75, 148, 487, 486, 706, 711, 453, - /* 400 */ 452, 324, 698, 705, 421, 2207, 2754, 451, 701, 700, - /* 410 */ 699, 2091, 2092, 2093, 2023, 324, 252, 629, 627, 624, - /* 420 */ 622, 19, 2701, 192, 850, 317, 138, 663, 1946, 137, - /* 430 */ 136, 135, 134, 133, 132, 131, 130, 129, 2701, 2931, - /* 440 */ 2474, 47, 45, 2033, 2556, 103, 668, 2926, 469, 476, - /* 450 */ 430, 1940, 1966, 458, 322, 736, 2474, 1965, 975, 2472, - /* 460 */ 798, 15, 62, 1493, 481, 1938, 2930, 2028, 2926, 2735, - /* 470 */ 2927, 2929, 2774, 1908, 926, 2472, 121, 2737, 854, 2739, - /* 480 */ 2740, 849, 1500, 873, 869, 2414, 797, 218, 200, 381, - /* 490 */ 2828, 2927, 799, 666, 472, 2824, 2388, 2023, 2030, 2031, - /* 500 */ 185, 63, 2218, 2094, 499, 490, 489, 1495, 1498, 1499, - /* 510 */ 138, 1946, 207, 137, 136, 135, 134, 133, 132, 131, - /* 520 */ 130, 129, 2876, 62, 2848, 2091, 2092, 2093, 2848, 2848, - /* 530 */ 2848, 2848, 2848, 734, 2931, 480, 182, 2001, 2011, 2543, - /* 540 */ 207, 975, 2926, 928, 48, 495, 2416, 2029, 2032, 728, - /* 550 */ 2617, 732, 730, 288, 287, 88, 87, 546, 2285, 783, - /* 560 */ 231, 2930, 1941, 1965, 1939, 2927, 2928, 2542, 869, 2414, - /* 570 */ 912, 40, 39, 538, 536, 46, 44, 43, 42, 41, - /* 580 */ 715, 2030, 2031, 1969, 1813, 1814, 418, 497, 223, 525, - /* 590 */ 2467, 2469, 521, 517, 513, 510, 539, 697, 1944, 1945, - /* 600 */ 1998, 696, 2000, 2003, 2004, 2005, 2006, 2007, 2008, 2009, - /* 610 */ 2010, 846, 871, 870, 2022, 2024, 2025, 2026, 2027, 2, - /* 620 */ 2001, 2011, 2096, 2097, 2098, 2099, 2100, 66, 1786, 1787, - /* 630 */ 2029, 2032, 100, 1812, 1815, 1673, 2848, 2091, 2092, 2093, - /* 640 */ 2848, 2848, 2848, 2848, 2848, 1941, 324, 1939, 2206, 62, - /* 650 */ 1664, 902, 901, 900, 1668, 899, 1670, 1671, 898, 895, - /* 660 */ 2410, 1679, 892, 1681, 1682, 889, 886, 883, 789, 784, - /* 670 */ 777, 773, 147, 146, 145, 144, 143, 142, 141, 140, - /* 680 */ 139, 1944, 1945, 1998, 238, 2000, 2003, 2004, 2005, 2006, - /* 690 */ 2007, 2008, 2009, 2010, 846, 871, 870, 2022, 2024, 2025, - /* 700 */ 2026, 2027, 2, 47, 45, 1623, 2736, 324, 869, 2414, - /* 710 */ 912, 476, 1969, 1940, 46, 44, 43, 42, 41, 1622, - /* 720 */ 1520, 851, 1519, 2883, 714, 713, 712, 1938, 55, 2028, - /* 730 */ 94, 704, 154, 708, 2002, 93, 153, 707, 62, 745, - /* 740 */ 869, 2414, 706, 711, 453, 452, 2931, 2736, 705, 541, - /* 750 */ 2754, 540, 451, 701, 700, 699, 214, 12, 1521, 2023, - /* 760 */ 547, 2038, 851, 1968, 2896, 479, 2701, 1965, 850, 2494, - /* 770 */ 879, 40, 39, 1946, 181, 46, 44, 43, 42, 41, - /* 780 */ 644, 498, 664, 539, 606, 2419, 47, 45, 748, 642, - /* 790 */ 181, 2754, 638, 634, 476, 617, 1940, 1999, 869, 2414, - /* 800 */ 2474, 2419, 92, 975, 559, 2538, 48, 2701, 496, 850, - /* 810 */ 1938, 2511, 2028, 2735, 2468, 2469, 2774, 1970, 548, 2472, - /* 820 */ 121, 2737, 854, 2739, 2740, 849, 1611, 873, 869, 2414, - /* 830 */ 565, 2538, 2946, 324, 2828, 869, 2414, 381, 472, 2824, - /* 840 */ 869, 2414, 2023, 2030, 2031, 839, 665, 2562, 567, 869, - /* 850 */ 2414, 2152, 243, 3, 2735, 581, 1946, 2774, 234, 2187, - /* 860 */ 669, 121, 2737, 854, 2739, 2740, 849, 53, 873, 582, - /* 870 */ 750, 2608, 1613, 2946, 1946, 2828, 100, 605, 242, 472, - /* 880 */ 2824, 51, 2001, 2011, 236, 213, 975, 596, 2538, 15, - /* 890 */ 903, 603, 2029, 2032, 446, 40, 39, 459, 2616, 46, - /* 900 */ 44, 43, 42, 41, 2409, 274, 12, 1941, 10, 1939, - /* 910 */ 780, 779, 2150, 2151, 2153, 2154, 2155, 878, 877, 876, - /* 920 */ 29, 193, 324, 2144, 589, 2521, 2030, 2031, 2059, 2227, - /* 930 */ 687, 683, 679, 675, 2390, 273, 322, 2145, 2002, 588, - /* 940 */ 834, 241, 2800, 1944, 1945, 1998, 1970, 2000, 2003, 2004, - /* 950 */ 2005, 2006, 2007, 2008, 2009, 2010, 846, 871, 870, 2022, - /* 960 */ 2024, 2025, 2026, 2027, 2, 2001, 2011, 84, 419, 557, - /* 970 */ 1963, 2194, 2474, 869, 2414, 2029, 2032, 594, 869, 2414, - /* 980 */ 445, 101, 587, 2143, 160, 2116, 271, 586, 614, 2701, - /* 990 */ 1941, 825, 1939, 583, 2406, 585, 869, 2414, 2411, 763, - /* 1000 */ 184, 1999, 292, 2164, 573, 836, 616, 2800, 2347, 869, - /* 1010 */ 2414, 420, 575, 40, 39, 34, 294, 46, 44, 43, - /* 1020 */ 42, 41, 2049, 553, 2843, 2064, 1944, 1945, 1998, 302, - /* 1030 */ 2000, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 846, - /* 1040 */ 871, 870, 2022, 2024, 2025, 2026, 2027, 2, 869, 2414, - /* 1050 */ 2840, 40, 39, 259, 522, 46, 44, 43, 42, 41, - /* 1060 */ 1940, 1969, 270, 1502, 444, 324, 261, 268, 816, 1964, - /* 1070 */ 869, 2414, 266, 661, 1938, 113, 561, 2298, 225, 910, - /* 1080 */ 174, 173, 907, 906, 905, 171, 2736, 1867, 1868, 2193, - /* 1090 */ 335, 258, 40, 39, 1523, 1524, 46, 44, 43, 42, - /* 1100 */ 41, 851, 2407, 775, 689, 688, 2930, 2549, 2528, 1500, - /* 1110 */ 602, 601, 600, 599, 598, 593, 592, 591, 590, 427, - /* 1120 */ 1946, 2163, 580, 579, 578, 577, 576, 570, 569, 568, - /* 1130 */ 2754, 563, 562, 442, 2226, 1498, 1499, 554, 1774, 1775, - /* 1140 */ 60, 691, 690, 182, 1793, 78, 2701, 805, 850, 158, - /* 1150 */ 975, 761, 2799, 2417, 946, 945, 944, 943, 505, 2135, - /* 1160 */ 942, 941, 162, 936, 935, 934, 933, 932, 931, 930, - /* 1170 */ 161, 924, 923, 922, 504, 503, 919, 918, 917, 198, - /* 1180 */ 197, 916, 500, 915, 914, 913, 1969, 502, 501, 869, - /* 1190 */ 2414, 2736, 1965, 2735, 2701, 2225, 2774, 1954, 2224, 91, - /* 1200 */ 121, 2737, 854, 2739, 2740, 849, 851, 873, 2919, 830, - /* 1210 */ 721, 1947, 2946, 2028, 2828, 2223, 33, 2222, 472, 2824, - /* 1220 */ 2221, 2736, 40, 39, 2220, 735, 46, 44, 43, 42, - /* 1230 */ 41, 1627, 869, 2414, 221, 2754, 851, 104, 2860, 869, - /* 1240 */ 2414, 2641, 2217, 2023, 289, 1626, 869, 2414, 1520, 2476, - /* 1250 */ 1519, 2701, 342, 850, 1941, 2701, 1939, 1946, 2701, 862, - /* 1260 */ 724, 374, 2216, 450, 449, 2754, 863, 718, 716, 869, - /* 1270 */ 2414, 1841, 869, 2414, 286, 2701, 303, 2701, 710, 709, - /* 1280 */ 2701, 2701, 2115, 850, 2701, 2215, 1521, 838, 181, 867, - /* 1290 */ 1944, 1945, 370, 940, 938, 1970, 2474, 2214, 2735, 2420, - /* 1300 */ 2843, 2774, 2701, 2234, 968, 121, 2737, 854, 2739, 2740, - /* 1310 */ 849, 802, 873, 2213, 2622, 2473, 164, 2946, 2212, 2828, - /* 1320 */ 72, 619, 2701, 472, 2824, 71, 2839, 105, 2735, 2211, - /* 1330 */ 2210, 2774, 2654, 792, 150, 121, 2737, 854, 2739, 2740, - /* 1340 */ 849, 2736, 873, 448, 447, 2701, 695, 2946, 90, 2828, - /* 1350 */ 425, 424, 35, 472, 2824, 2209, 851, 2701, 40, 39, - /* 1360 */ 483, 380, 46, 44, 43, 42, 41, 697, 2196, 2197, - /* 1370 */ 2843, 696, 2736, 2701, 492, 293, 2028, 904, 2701, 908, - /* 1380 */ 2465, 909, 2465, 1606, 2465, 2754, 764, 851, 2391, 2701, - /* 1390 */ 2701, 1955, 279, 1950, 2926, 277, 2838, 2283, 738, 1857, - /* 1400 */ 737, 2701, 2105, 850, 615, 1949, 2023, 281, 2736, 164, - /* 1410 */ 280, 283, 2932, 218, 282, 2701, 2754, 2927, 799, 717, - /* 1420 */ 1970, 163, 2655, 851, 801, 299, 1999, 1958, 1960, 1607, - /* 1430 */ 285, 702, 2701, 284, 850, 387, 771, 49, 703, 806, - /* 1440 */ 2266, 871, 870, 2022, 2024, 2025, 2026, 2027, 2735, 2274, - /* 1450 */ 2272, 2774, 2754, 2722, 1604, 121, 2737, 854, 2739, 2740, - /* 1460 */ 849, 1602, 873, 49, 201, 172, 2418, 2803, 2701, 2828, - /* 1470 */ 850, 719, 722, 472, 2824, 2387, 764, 14, 13, 2735, - /* 1480 */ 212, 119, 2774, 116, 2926, 209, 121, 2737, 854, 2739, - /* 1490 */ 2740, 849, 1865, 873, 1948, 964, 329, 77, 2801, 64, - /* 1500 */ 2828, 49, 2932, 218, 472, 2824, 2348, 2927, 799, 1584, - /* 1510 */ 49, 77, 169, 349, 348, 2735, 2219, 2724, 2774, 2139, - /* 1520 */ 2149, 920, 121, 2737, 854, 2739, 2740, 849, 2889, 873, - /* 1530 */ 150, 172, 351, 350, 835, 192, 2828, 2736, 353, 352, - /* 1540 */ 472, 2824, 355, 354, 1576, 1673, 2148, 308, 815, 318, - /* 1550 */ 357, 356, 851, 781, 1931, 1585, 1907, 811, 359, 358, - /* 1560 */ 1664, 902, 901, 900, 1668, 899, 1670, 1671, 845, 844, - /* 1570 */ 310, 1679, 843, 1681, 1682, 842, 886, 883, 746, 333, - /* 1580 */ 822, 2754, 2065, 1557, 2012, 361, 360, 1952, 485, 484, - /* 1590 */ 1932, 363, 362, 1810, 1800, 345, 978, 2701, 74, 850, - /* 1600 */ 881, 803, 365, 364, 871, 870, 2022, 2024, 2025, 2026, - /* 1610 */ 2027, 921, 741, 866, 1655, 378, 367, 366, 2736, 170, - /* 1620 */ 910, 174, 173, 907, 906, 905, 171, 369, 368, 1558, - /* 1630 */ 966, 208, 749, 851, 1574, 152, 172, 2755, 2340, 2255, - /* 1640 */ 962, 958, 954, 950, 2735, 373, 151, 2774, 2879, 778, - /* 1650 */ 2339, 122, 2737, 854, 2739, 2740, 849, 169, 873, 465, - /* 1660 */ 785, 819, 2754, 461, 2547, 2828, 764, 506, 814, 2827, - /* 1670 */ 2824, 524, 2261, 2462, 2926, 793, 1951, 757, 2701, 794, - /* 1680 */ 850, 386, 2880, 1686, 2890, 320, 764, 2548, 315, 323, - /* 1690 */ 514, 120, 2932, 218, 2926, 2374, 346, 2927, 799, 2736, - /* 1700 */ 40, 39, 1694, 5, 46, 44, 43, 42, 41, 439, - /* 1710 */ 509, 1963, 2932, 218, 851, 1973, 523, 2927, 799, 1701, - /* 1720 */ 534, 227, 764, 2736, 226, 2735, 535, 826, 2774, 1699, - /* 1730 */ 2926, 537, 122, 2737, 854, 2739, 2740, 849, 848, 873, - /* 1740 */ 175, 229, 2736, 2754, 379, 1834, 2828, 551, 2932, 218, - /* 1750 */ 837, 2824, 1964, 2927, 799, 558, 240, 851, 560, 2701, - /* 1760 */ 564, 850, 566, 571, 608, 584, 2540, 2754, 595, 597, - /* 1770 */ 604, 607, 344, 609, 832, 620, 621, 327, 618, 246, - /* 1780 */ 245, 623, 326, 2701, 625, 850, 2754, 626, 249, 628, - /* 1790 */ 630, 1971, 4, 645, 656, 653, 257, 1966, 646, 658, - /* 1800 */ 654, 296, 2701, 96, 850, 1972, 852, 659, 1974, 2774, - /* 1810 */ 2736, 662, 660, 122, 2737, 854, 2739, 2740, 849, 260, - /* 1820 */ 873, 263, 1975, 265, 97, 851, 1976, 2828, 98, 2557, - /* 1830 */ 2735, 434, 2824, 2774, 2563, 692, 671, 410, 2737, 854, - /* 1840 */ 2739, 2740, 849, 847, 873, 833, 2793, 99, 272, 2735, - /* 1850 */ 2736, 694, 2774, 2404, 2754, 126, 186, 2737, 854, 2739, - /* 1860 */ 2740, 849, 276, 873, 2400, 851, 725, 278, 726, 413, - /* 1870 */ 2701, 177, 850, 123, 740, 2736, 2402, 2397, 178, 179, - /* 1880 */ 102, 742, 295, 1967, 751, 125, 2631, 752, 382, 758, - /* 1890 */ 851, 2609, 165, 300, 2754, 759, 2628, 2627, 753, 782, - /* 1900 */ 756, 820, 298, 765, 2886, 8, 768, 2867, 791, 766, - /* 1910 */ 2701, 769, 850, 767, 2895, 2894, 191, 2735, 2736, 2754, - /* 1920 */ 2774, 309, 305, 307, 189, 2737, 854, 2739, 2740, 849, - /* 1930 */ 796, 873, 311, 851, 313, 2701, 795, 850, 314, 466, - /* 1940 */ 2949, 807, 2925, 2847, 2736, 804, 156, 312, 2113, 316, - /* 1950 */ 1968, 2111, 204, 325, 166, 818, 383, 2735, 2577, 851, - /* 1960 */ 2774, 2844, 2754, 2576, 186, 2737, 854, 2739, 2740, 849, - /* 1970 */ 1, 873, 384, 2575, 470, 823, 824, 167, 2701, 831, - /* 1980 */ 850, 828, 2735, 800, 2947, 2774, 2736, 338, 2754, 122, - /* 1990 */ 2737, 854, 2739, 2740, 849, 61, 873, 2809, 858, 856, - /* 2000 */ 860, 851, 463, 2828, 2701, 385, 850, 861, 2825, 319, - /* 2010 */ 343, 112, 2887, 220, 2415, 115, 389, 2693, 1472, 2692, - /* 2020 */ 971, 2688, 2687, 2736, 2679, 2735, 875, 970, 2774, 2678, - /* 2030 */ 2754, 372, 411, 2737, 854, 2739, 2740, 849, 851, 873, - /* 2040 */ 2670, 2669, 2685, 2684, 176, 972, 2701, 375, 850, 967, - /* 2050 */ 376, 2735, 2676, 52, 2774, 2675, 974, 2664, 404, 2737, - /* 2060 */ 854, 2739, 2740, 849, 393, 873, 2663, 2754, 2682, 2681, - /* 2070 */ 464, 2673, 2672, 423, 2661, 2660, 2658, 414, 391, 2657, - /* 2080 */ 744, 2466, 431, 2701, 432, 850, 426, 401, 412, 402, - /* 2090 */ 2653, 2652, 2651, 2735, 85, 2646, 2774, 511, 512, 1891, - /* 2100 */ 411, 2737, 854, 2739, 2740, 849, 1892, 873, 224, 790, - /* 2110 */ 2736, 516, 2644, 518, 519, 520, 1890, 2643, 2642, 440, - /* 2120 */ 2640, 526, 2639, 528, 2638, 848, 530, 2637, 1878, 532, - /* 2130 */ 2735, 2613, 2736, 2774, 228, 2612, 230, 189, 2737, 854, - /* 2140 */ 2739, 2740, 849, 86, 873, 1837, 2590, 851, 1836, 2589, - /* 2150 */ 2588, 544, 545, 2587, 2754, 2586, 2530, 549, 1773, 2736, - /* 2160 */ 2527, 552, 2526, 2520, 555, 556, 2517, 233, 2516, 2515, - /* 2170 */ 2701, 2514, 850, 89, 851, 2519, 2754, 2518, 2513, 2512, - /* 2180 */ 235, 2510, 2509, 2508, 572, 2507, 237, 574, 2505, 2504, - /* 2190 */ 2503, 2502, 2701, 2501, 850, 2525, 2736, 2948, 2500, 2499, - /* 2200 */ 2498, 2523, 2506, 2754, 2497, 2496, 2495, 2493, 2492, 2491, - /* 2210 */ 2490, 851, 2489, 2488, 2487, 239, 475, 2735, 2486, 2701, - /* 2220 */ 2774, 850, 2485, 2736, 410, 2737, 854, 2739, 2740, 849, - /* 2230 */ 2484, 873, 2483, 2794, 95, 2555, 2524, 2522, 851, 2735, - /* 2240 */ 2754, 2482, 2774, 477, 2481, 2736, 411, 2737, 854, 2739, - /* 2250 */ 2740, 849, 2480, 873, 244, 1779, 2701, 2479, 850, 611, - /* 2260 */ 851, 2478, 2477, 2475, 613, 1624, 2735, 2754, 428, 2774, - /* 2270 */ 1628, 429, 2736, 411, 2737, 854, 2739, 2740, 849, 2305, - /* 2280 */ 873, 2304, 2303, 2701, 2302, 850, 1620, 851, 247, 2754, - /* 2290 */ 2300, 248, 250, 251, 2297, 631, 632, 633, 2296, 636, - /* 2300 */ 635, 2289, 637, 739, 639, 2701, 2774, 850, 640, 2736, - /* 2310 */ 406, 2737, 854, 2739, 2740, 849, 2754, 873, 641, 2276, - /* 2320 */ 2250, 643, 253, 2721, 851, 199, 1501, 81, 210, 651, - /* 2330 */ 2735, 2249, 2701, 2774, 850, 2611, 255, 396, 2737, 854, - /* 2340 */ 2739, 2740, 849, 82, 873, 2607, 2597, 2585, 262, 264, - /* 2350 */ 2736, 267, 2735, 2754, 2584, 2774, 2561, 269, 2554, 395, - /* 2360 */ 2737, 854, 2739, 2740, 849, 851, 873, 2392, 2299, 2701, - /* 2370 */ 2295, 850, 1550, 672, 674, 673, 2293, 676, 677, 2735, - /* 2380 */ 678, 2291, 2774, 681, 680, 2736, 397, 2737, 854, 2739, - /* 2390 */ 2740, 849, 2288, 873, 2754, 684, 682, 685, 2271, 686, - /* 2400 */ 851, 2269, 2270, 2268, 2246, 2394, 1705, 1706, 2393, 1610, - /* 2410 */ 2701, 1609, 850, 73, 1608, 1605, 2735, 2736, 275, 2774, - /* 2420 */ 2286, 1603, 1601, 403, 2737, 854, 2739, 2740, 849, 2754, - /* 2430 */ 873, 1600, 851, 1599, 2284, 1598, 2736, 1592, 454, 455, - /* 2440 */ 937, 2275, 1597, 939, 456, 2701, 720, 850, 1594, 1593, - /* 2450 */ 1591, 851, 2273, 457, 2245, 723, 2244, 2735, 2243, 727, - /* 2460 */ 2774, 2754, 2242, 729, 407, 2737, 854, 2739, 2740, 849, - /* 2470 */ 2241, 873, 731, 2240, 1872, 733, 1874, 2701, 1871, 850, - /* 2480 */ 2754, 128, 2736, 2610, 1862, 1876, 56, 28, 743, 67, - /* 2490 */ 1847, 2606, 2735, 1843, 297, 2774, 2701, 851, 850, 398, - /* 2500 */ 2737, 854, 2739, 2740, 849, 2596, 873, 57, 1845, 754, - /* 2510 */ 755, 2583, 301, 2582, 2736, 1822, 180, 2931, 760, 1821, - /* 2520 */ 770, 762, 20, 6, 2735, 2166, 2754, 2774, 462, 851, - /* 2530 */ 17, 408, 2737, 854, 2739, 2740, 849, 2140, 873, 30, - /* 2540 */ 304, 772, 2701, 2735, 850, 774, 2774, 7, 215, 306, - /* 2550 */ 399, 2737, 854, 2739, 2740, 849, 776, 873, 2754, 21, - /* 2560 */ 22, 203, 2147, 190, 202, 31, 32, 2134, 2722, 23, - /* 2570 */ 83, 216, 2106, 2108, 2701, 2104, 850, 65, 2736, 217, - /* 2580 */ 24, 2186, 2187, 2088, 18, 2181, 2180, 467, 2185, 2735, - /* 2590 */ 2184, 468, 2774, 851, 2087, 321, 409, 2737, 854, 2739, - /* 2600 */ 2740, 849, 2736, 873, 58, 59, 2581, 195, 2560, 106, - /* 2610 */ 107, 2559, 328, 108, 2142, 205, 334, 851, 69, 2553, - /* 2620 */ 827, 2735, 2754, 337, 2774, 821, 829, 2736, 400, 2737, - /* 2630 */ 854, 2739, 2740, 849, 109, 873, 25, 2040, 2701, 336, - /* 2640 */ 850, 11, 851, 2039, 13, 1956, 2754, 2015, 2050, 196, - /* 2650 */ 2014, 888, 206, 1991, 891, 339, 894, 897, 38, 2552, - /* 2660 */ 110, 2013, 2701, 16, 850, 859, 853, 2736, 26, 2389, - /* 2670 */ 864, 2754, 347, 1983, 27, 70, 865, 857, 341, 111, - /* 2680 */ 79, 880, 851, 2779, 116, 2735, 2778, 2701, 2774, 850, - /* 2690 */ 872, 2736, 416, 2737, 854, 2739, 2740, 849, 2017, 873, - /* 2700 */ 68, 2202, 874, 2201, 2199, 2200, 851, 1687, 494, 2735, - /* 2710 */ 882, 2754, 2774, 1684, 884, 885, 417, 2737, 854, 2739, - /* 2720 */ 2740, 849, 887, 873, 890, 1683, 1680, 2701, 1674, 850, - /* 2730 */ 893, 1672, 2736, 896, 2735, 2754, 1678, 2774, 371, 1677, - /* 2740 */ 117, 2748, 2737, 854, 2739, 2740, 849, 851, 873, 118, - /* 2750 */ 1676, 2701, 1700, 850, 1675, 80, 1696, 1588, 1548, 911, - /* 2760 */ 1587, 1586, 1583, 1580, 1579, 1578, 1577, 1575, 1573, 1572, - /* 2770 */ 925, 1618, 2736, 1571, 2735, 1617, 2754, 2774, 222, 927, - /* 2780 */ 1569, 2747, 2737, 854, 2739, 2740, 849, 851, 873, 1568, - /* 2790 */ 1567, 1566, 2701, 1565, 850, 1564, 1563, 1614, 2735, 2736, - /* 2800 */ 1612, 2774, 1560, 1559, 1556, 2746, 2737, 854, 2739, 2740, - /* 2810 */ 849, 1555, 873, 1554, 851, 1553, 2754, 2294, 2736, 947, - /* 2820 */ 949, 2292, 951, 2290, 948, 952, 953, 956, 955, 957, - /* 2830 */ 2287, 959, 2701, 851, 850, 960, 2267, 961, 963, 2735, - /* 2840 */ 2265, 965, 2774, 2754, 1490, 2239, 436, 2737, 854, 2739, - /* 2850 */ 2740, 849, 1478, 873, 1473, 969, 1480, 377, 973, 2701, - /* 2860 */ 1942, 850, 2754, 390, 976, 2205, 977, 2205, 2205, 2205, - /* 2870 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2701, 2735, - /* 2880 */ 850, 2205, 2774, 2736, 2205, 2205, 437, 2737, 854, 2739, - /* 2890 */ 2740, 849, 2205, 873, 2205, 2205, 2736, 2205, 851, 2205, - /* 2900 */ 2205, 2205, 2205, 2205, 2205, 2205, 2735, 2205, 2205, 2774, - /* 2910 */ 2205, 851, 2205, 433, 2737, 854, 2739, 2740, 849, 2205, - /* 2920 */ 873, 2205, 2205, 2205, 2205, 2735, 2205, 2754, 2774, 2205, - /* 2930 */ 2205, 2205, 438, 2737, 854, 2739, 2740, 849, 2205, 873, - /* 2940 */ 2754, 2205, 2205, 2701, 2205, 850, 2205, 2205, 2205, 2205, - /* 2950 */ 2205, 2205, 2205, 2205, 2205, 2205, 2701, 2205, 850, 2205, - /* 2960 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, - /* 2970 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, - /* 2980 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, - /* 2990 */ 852, 2205, 2205, 2774, 2205, 2205, 2205, 406, 2737, 854, - /* 3000 */ 2739, 2740, 849, 2735, 873, 2205, 2774, 2205, 2205, 2205, - /* 3010 */ 405, 2737, 854, 2739, 2740, 849, 2205, 873, + /* 0 */ 543, 559, 2540, 184, 2697, 542, 647, 493, 841, 648, + /* 10 */ 2256, 2349, 47, 45, 2121, 869, 2416, 869, 2416, 840, + /* 20 */ 476, 2209, 1942, 40, 39, 565, 2540, 46, 44, 43, + /* 30 */ 42, 41, 37, 340, 1501, 148, 1940, 499, 2030, 2300, + /* 40 */ 2407, 374, 138, 693, 2739, 137, 136, 135, 134, 133, + /* 50 */ 132, 131, 130, 129, 764, 234, 810, 157, 9, 813, + /* 60 */ 1499, 1500, 2929, 869, 2416, 40, 39, 482, 2025, 46, + /* 70 */ 44, 43, 42, 41, 868, 19, 2714, 1971, 873, 236, + /* 80 */ 2935, 218, 1948, 148, 1967, 2930, 799, 2571, 2757, 929, + /* 90 */ 138, 698, 2375, 137, 136, 135, 134, 133, 132, 131, + /* 100 */ 130, 129, 2476, 482, 2704, 2718, 850, 2569, 855, 868, + /* 110 */ 441, 2698, 975, 2231, 873, 15, 946, 945, 944, 943, + /* 120 */ 505, 2474, 942, 941, 162, 936, 935, 934, 933, 932, + /* 130 */ 931, 930, 161, 924, 923, 922, 504, 503, 919, 918, + /* 140 */ 917, 198, 197, 916, 500, 915, 914, 913, 211, 596, + /* 150 */ 2540, 2738, 2032, 2033, 2777, 2720, 2722, 473, 121, 2740, + /* 160 */ 854, 2742, 2743, 849, 2463, 873, 873, 66, 734, 2096, + /* 170 */ 200, 114, 2831, 2704, 482, 1494, 472, 2827, 194, 2839, + /* 180 */ 809, 62, 149, 808, 728, 873, 732, 730, 288, 287, + /* 190 */ 2929, 2003, 2013, 254, 1501, 182, 219, 650, 798, 2264, + /* 200 */ 2846, 2031, 2034, 241, 2878, 2419, 2929, 655, 797, 218, + /* 210 */ 648, 2256, 51, 2930, 799, 2208, 1943, 443, 1941, 1496, + /* 220 */ 1499, 1500, 207, 2196, 797, 218, 2843, 40, 39, 2930, + /* 230 */ 799, 46, 44, 43, 42, 41, 2096, 550, 1970, 147, + /* 240 */ 146, 145, 144, 143, 142, 141, 140, 139, 62, 2544, + /* 250 */ 214, 331, 332, 1946, 1947, 2000, 330, 2002, 2005, 2006, + /* 260 */ 2007, 2008, 2009, 2010, 2011, 2012, 846, 871, 870, 2024, + /* 270 */ 2026, 2027, 2028, 2029, 2, 47, 45, 2571, 62, 2657, + /* 280 */ 419, 670, 1965, 476, 2303, 1942, 124, 612, 610, 594, + /* 290 */ 415, 471, 445, 232, 435, 495, 2418, 2568, 855, 1940, + /* 300 */ 614, 2030, 100, 2851, 2093, 2094, 2095, 2851, 2851, 2851, + /* 310 */ 2851, 2851, 1972, 502, 501, 33, 573, 747, 616, 2934, + /* 320 */ 446, 40, 39, 420, 575, 46, 44, 43, 42, 41, + /* 330 */ 2411, 2025, 2476, 764, 2420, 553, 1970, 1949, 19, 1967, + /* 340 */ 469, 2929, 2195, 721, 2059, 1948, 460, 2618, 541, 667, + /* 350 */ 540, 2474, 2739, 2098, 2099, 2100, 2101, 2102, 735, 2935, + /* 360 */ 218, 714, 713, 712, 2930, 799, 324, 813, 704, 154, + /* 370 */ 708, 2093, 2094, 2095, 707, 975, 444, 289, 15, 706, + /* 380 */ 711, 453, 452, 539, 788, 705, 2934, 2268, 561, 451, + /* 390 */ 701, 700, 699, 724, 2929, 744, 2757, 324, 40, 39, + /* 400 */ 718, 716, 46, 44, 43, 42, 41, 286, 2558, 2060, + /* 410 */ 668, 322, 2704, 2933, 850, 2032, 2033, 2930, 2932, 2551, + /* 420 */ 2530, 2513, 602, 601, 600, 599, 598, 593, 592, 591, + /* 430 */ 590, 428, 2189, 324, 580, 579, 578, 577, 576, 570, + /* 440 */ 569, 568, 964, 563, 562, 442, 652, 868, 644, 554, + /* 450 */ 1775, 1776, 649, 72, 2003, 2013, 1794, 642, 71, 2738, + /* 460 */ 638, 634, 2777, 324, 2031, 2034, 121, 2740, 854, 2742, + /* 470 */ 2743, 849, 497, 873, 158, 2469, 2471, 2802, 200, 1943, + /* 480 */ 2831, 1941, 879, 904, 472, 2827, 2467, 2096, 40, 39, + /* 490 */ 810, 157, 46, 44, 43, 42, 41, 36, 474, 2054, + /* 500 */ 2055, 2056, 2057, 2058, 2062, 2063, 2064, 2065, 663, 322, + /* 510 */ 1787, 1788, 2879, 29, 2714, 926, 1946, 1947, 2000, 1952, + /* 520 */ 2002, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 846, + /* 530 */ 871, 870, 2024, 2026, 2027, 2028, 2029, 2, 12, 47, + /* 540 */ 45, 2739, 50, 2718, 256, 666, 2934, 476, 650, 1942, + /* 550 */ 2264, 714, 713, 712, 2929, 868, 851, 291, 704, 154, + /* 560 */ 708, 290, 100, 1940, 707, 2030, 527, 2400, 422, 706, + /* 570 */ 711, 453, 452, 2933, 2739, 705, 792, 2930, 2931, 451, + /* 580 */ 701, 700, 699, 125, 928, 2757, 2571, 238, 2206, 851, + /* 590 */ 2412, 2266, 587, 2720, 2723, 2025, 2166, 586, 2470, 2471, + /* 600 */ 478, 2704, 19, 850, 873, 585, 2568, 855, 1968, 1948, + /* 610 */ 381, 812, 187, 2839, 2840, 2846, 155, 2844, 2757, 2000, + /* 620 */ 2393, 2851, 2093, 2094, 2095, 2851, 2851, 2851, 2851, 2851, + /* 630 */ 878, 877, 876, 94, 2704, 103, 850, 84, 93, 975, + /* 640 */ 424, 2842, 15, 606, 458, 2107, 736, 1521, 2738, 1520, + /* 650 */ 50, 2777, 1942, 163, 160, 121, 2740, 854, 2742, 2743, + /* 660 */ 849, 2154, 873, 153, 2408, 159, 1940, 168, 2802, 2831, + /* 670 */ 459, 2618, 2146, 472, 2827, 488, 2648, 508, 479, 2032, + /* 680 */ 2033, 2738, 507, 1968, 2777, 1522, 2147, 181, 121, 2740, + /* 690 */ 854, 2742, 2743, 849, 2392, 873, 14, 13, 2421, 192, + /* 700 */ 2949, 317, 2831, 491, 531, 92, 472, 2827, 2230, 40, + /* 710 */ 39, 243, 1948, 46, 44, 43, 42, 41, 2003, 2013, + /* 720 */ 780, 779, 2152, 2153, 2155, 2156, 2157, 2125, 2031, 2034, + /* 730 */ 515, 764, 2145, 1967, 533, 529, 605, 242, 2040, 2929, + /* 740 */ 1713, 1714, 975, 1943, 1967, 1941, 787, 292, 40, 39, + /* 750 */ 603, 2390, 46, 44, 43, 42, 41, 2935, 218, 35, + /* 760 */ 2229, 2739, 2930, 799, 1971, 40, 39, 839, 2704, 46, + /* 770 */ 44, 43, 42, 41, 480, 2757, 851, 748, 2886, 207, + /* 780 */ 1946, 1947, 2000, 1612, 2002, 2005, 2006, 2007, 2008, 2009, + /* 790 */ 2010, 2011, 2012, 846, 871, 870, 2024, 2026, 2027, 2028, + /* 800 */ 2029, 2, 47, 45, 2035, 2757, 2544, 2739, 912, 664, + /* 810 */ 476, 2073, 1942, 1967, 745, 1814, 1815, 2165, 869, 2416, + /* 820 */ 2704, 2704, 851, 850, 2899, 912, 1940, 2389, 2030, 1614, + /* 830 */ 450, 449, 1868, 1869, 1870, 324, 113, 2739, 223, 910, + /* 840 */ 174, 173, 907, 906, 905, 171, 1943, 786, 1941, 783, + /* 850 */ 1971, 2757, 851, 185, 775, 2220, 2137, 1911, 2025, 657, + /* 860 */ 2610, 810, 157, 2409, 1813, 1816, 2846, 2704, 2738, 850, + /* 870 */ 12, 2777, 1948, 665, 2564, 121, 2740, 854, 2742, 2743, + /* 880 */ 849, 2757, 873, 1946, 1947, 1910, 2739, 2949, 2476, 2831, + /* 890 */ 487, 486, 2841, 472, 2827, 1971, 481, 2704, 1967, 850, + /* 900 */ 1948, 851, 975, 2922, 2004, 48, 908, 2474, 62, 2467, + /* 910 */ 448, 447, 2476, 695, 2738, 2004, 181, 2777, 490, 489, + /* 920 */ 496, 121, 2740, 854, 2742, 2743, 849, 2422, 873, 2228, + /* 930 */ 2757, 2474, 903, 2949, 697, 2831, 2658, 213, 696, 472, + /* 940 */ 2827, 748, 2032, 2033, 2738, 2051, 2704, 2777, 850, 2227, + /* 950 */ 2405, 121, 2740, 854, 2742, 2743, 849, 3, 873, 789, + /* 960 */ 784, 777, 773, 2949, 2933, 2831, 869, 2416, 2001, 472, + /* 970 */ 2827, 53, 910, 174, 173, 907, 906, 905, 171, 2001, + /* 980 */ 1951, 2003, 2013, 127, 2839, 2840, 55, 155, 2844, 2704, + /* 990 */ 764, 2031, 2034, 2738, 2496, 763, 2777, 2350, 2929, 1972, + /* 1000 */ 121, 2740, 854, 2742, 2743, 849, 1943, 873, 1941, 2704, + /* 1010 */ 1674, 2226, 2949, 12, 2831, 10, 2935, 218, 472, 2827, + /* 1020 */ 381, 2930, 799, 750, 2610, 1665, 902, 901, 900, 1669, + /* 1030 */ 899, 1671, 1672, 898, 895, 2403, 1680, 892, 1682, 1683, + /* 1040 */ 889, 886, 883, 1946, 1947, 2000, 2523, 2002, 2005, 2006, + /* 1050 */ 2007, 2008, 2009, 2010, 2011, 2012, 846, 871, 870, 2024, + /* 1060 */ 2026, 2027, 2028, 2029, 2, 47, 45, 2739, 221, 2004, + /* 1070 */ 741, 2704, 749, 476, 498, 1942, 46, 44, 43, 42, + /* 1080 */ 41, 2619, 851, 181, 2863, 1972, 814, 869, 2416, 1940, + /* 1090 */ 557, 2030, 207, 324, 2421, 869, 2416, 909, 40, 39, + /* 1100 */ 2467, 2739, 46, 44, 43, 42, 41, 547, 869, 2416, + /* 1110 */ 380, 2757, 798, 810, 157, 862, 851, 869, 2416, 2545, + /* 1120 */ 2929, 2025, 869, 2416, 764, 2118, 764, 2704, 548, 850, + /* 1130 */ 1972, 299, 2929, 2001, 2929, 1948, 60, 567, 797, 218, + /* 1140 */ 764, 387, 581, 2930, 799, 2757, 212, 761, 2929, 589, + /* 1150 */ 2935, 218, 2935, 218, 2476, 2930, 799, 2930, 799, 869, + /* 1160 */ 2416, 2704, 1954, 850, 588, 975, 2935, 218, 48, 869, + /* 1170 */ 2416, 2930, 799, 817, 2738, 2644, 1521, 2777, 1520, 582, + /* 1180 */ 1624, 121, 2740, 854, 2742, 2743, 849, 1967, 873, 583, + /* 1190 */ 869, 2416, 182, 2949, 1623, 2831, 2624, 502, 501, 472, + /* 1200 */ 2827, 495, 2418, 1524, 1525, 2032, 2033, 1956, 2738, 2476, + /* 1210 */ 669, 2777, 869, 2416, 1522, 121, 2740, 854, 2742, 2743, + /* 1220 */ 849, 1949, 873, 2030, 689, 688, 1607, 2806, 825, 2831, + /* 1230 */ 869, 2416, 2413, 472, 2827, 188, 2839, 2840, 2225, 155, + /* 1240 */ 2844, 2224, 1628, 2223, 2003, 2013, 869, 2416, 869, 2416, + /* 1250 */ 294, 710, 709, 2025, 2031, 2034, 1627, 293, 1674, 910, + /* 1260 */ 174, 173, 907, 906, 905, 171, 302, 1948, 816, 1943, + /* 1270 */ 617, 1941, 1608, 1665, 902, 901, 900, 1669, 899, 1671, + /* 1280 */ 1672, 845, 844, 801, 1680, 843, 1682, 1683, 842, 886, + /* 1290 */ 883, 43, 42, 41, 2061, 691, 690, 838, 2704, 940, + /* 1300 */ 938, 2704, 2222, 2704, 2236, 968, 1946, 1947, 2000, 2219, + /* 1310 */ 2002, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 846, + /* 1320 */ 871, 870, 2024, 2026, 2027, 2028, 2029, 2, 47, 45, + /* 1330 */ 869, 2416, 619, 869, 2416, 183, 476, 2218, 1942, 2217, + /* 1340 */ 394, 869, 2416, 388, 869, 2416, 2216, 2453, 869, 2416, + /* 1350 */ 335, 2215, 1940, 830, 2030, 869, 2416, 2214, 2213, 392, + /* 1360 */ 76, 342, 2704, 75, 863, 2739, 2212, 522, 867, 2704, + /* 1370 */ 2211, 2198, 2199, 104, 421, 370, 834, 836, 2803, 2803, + /* 1380 */ 851, 78, 34, 2287, 2025, 2739, 252, 629, 627, 624, + /* 1390 */ 622, 225, 2066, 2476, 2478, 172, 802, 2704, 1948, 2704, + /* 1400 */ 851, 1957, 1503, 1952, 164, 715, 2704, 1842, 1966, 2757, + /* 1410 */ 697, 2704, 2475, 279, 696, 805, 277, 2704, 2704, 150, + /* 1420 */ 209, 281, 2001, 2117, 280, 2704, 2704, 850, 975, 2757, + /* 1430 */ 2704, 15, 62, 90, 283, 91, 702, 282, 1960, 1962, + /* 1440 */ 426, 425, 703, 14, 13, 2704, 285, 850, 2285, 284, + /* 1450 */ 483, 2276, 871, 870, 2024, 2026, 2027, 2028, 2029, 1605, + /* 1460 */ 738, 303, 737, 2420, 492, 1603, 2030, 2274, 2032, 2033, + /* 1470 */ 717, 63, 2738, 719, 2221, 2777, 164, 2725, 54, 121, + /* 1480 */ 2740, 854, 2742, 2743, 849, 771, 873, 1858, 119, 722, + /* 1490 */ 116, 2804, 2738, 2831, 2739, 2777, 2025, 472, 2827, 186, + /* 1500 */ 2740, 854, 2742, 2743, 849, 2892, 873, 2003, 2013, 851, + /* 1510 */ 49, 49, 105, 49, 201, 172, 192, 2031, 2034, 329, + /* 1520 */ 349, 348, 318, 77, 1950, 88, 87, 546, 351, 350, + /* 1530 */ 231, 64, 1943, 781, 1941, 49, 77, 310, 2757, 811, + /* 1540 */ 169, 2727, 150, 538, 536, 172, 765, 2889, 152, 615, + /* 1550 */ 2758, 353, 352, 2342, 2704, 2341, 850, 418, 2257, 1866, + /* 1560 */ 525, 2882, 74, 521, 517, 513, 510, 539, 2141, 1946, + /* 1570 */ 1947, 2000, 778, 2002, 2005, 2006, 2007, 2008, 2009, 2010, + /* 1580 */ 2011, 2012, 846, 871, 870, 2024, 2026, 2027, 2028, 2029, + /* 1590 */ 2, 355, 354, 2151, 1811, 465, 2150, 308, 815, 357, + /* 1600 */ 356, 2738, 333, 746, 2777, 881, 822, 170, 121, 2740, + /* 1610 */ 854, 2742, 2743, 849, 2067, 873, 2739, 324, 2014, 1801, + /* 1620 */ 835, 978, 2831, 345, 172, 866, 472, 2827, 1656, 359, + /* 1630 */ 358, 851, 361, 360, 363, 362, 365, 364, 367, 366, + /* 1640 */ 378, 369, 368, 1585, 1933, 386, 1909, 1558, 920, 921, + /* 1650 */ 785, 461, 2549, 819, 506, 966, 208, 2263, 2739, 524, + /* 1660 */ 2757, 757, 2464, 151, 169, 962, 958, 954, 950, 2883, + /* 1670 */ 373, 1577, 1575, 851, 793, 320, 2704, 2893, 850, 485, + /* 1680 */ 484, 1934, 794, 323, 315, 2550, 2376, 803, 1687, 1586, + /* 1690 */ 1695, 509, 5, 1559, 2739, 871, 870, 2024, 2026, 2027, + /* 1700 */ 2028, 2029, 2757, 514, 439, 1965, 1953, 1702, 806, 848, + /* 1710 */ 1975, 523, 535, 534, 226, 227, 120, 537, 2704, 1835, + /* 1720 */ 850, 346, 379, 2738, 229, 551, 2777, 1966, 558, 240, + /* 1730 */ 122, 2740, 854, 2742, 2743, 849, 560, 873, 2757, 564, + /* 1740 */ 566, 608, 571, 2739, 2831, 584, 1700, 175, 2830, 2827, + /* 1750 */ 595, 2542, 826, 597, 2704, 604, 850, 607, 851, 609, + /* 1760 */ 621, 620, 618, 246, 245, 2738, 623, 625, 2777, 1973, + /* 1770 */ 249, 626, 122, 2740, 854, 2742, 2743, 849, 4, 873, + /* 1780 */ 628, 2739, 257, 630, 645, 646, 2831, 2757, 656, 653, + /* 1790 */ 837, 2827, 1968, 1974, 654, 96, 851, 344, 658, 832, + /* 1800 */ 659, 2738, 327, 2704, 2777, 850, 1976, 326, 410, 2740, + /* 1810 */ 854, 2742, 2743, 849, 847, 873, 833, 2796, 260, 263, + /* 1820 */ 660, 265, 662, 2739, 1977, 2757, 296, 2565, 671, 1978, + /* 1830 */ 97, 2559, 98, 692, 694, 99, 272, 2406, 851, 725, + /* 1840 */ 726, 2704, 740, 850, 276, 2402, 278, 177, 123, 126, + /* 1850 */ 852, 413, 2634, 2777, 2631, 102, 742, 122, 2740, 854, + /* 1860 */ 2742, 2743, 849, 2404, 873, 2739, 2399, 2757, 295, 1969, + /* 1870 */ 2611, 2831, 178, 179, 752, 434, 2827, 2630, 165, 751, + /* 1880 */ 851, 759, 753, 2704, 382, 850, 782, 300, 2738, 274, + /* 1890 */ 2898, 2777, 820, 298, 756, 189, 2740, 854, 2742, 2743, + /* 1900 */ 849, 768, 873, 758, 8, 193, 2897, 305, 791, 2757, + /* 1910 */ 2870, 307, 767, 191, 687, 683, 679, 675, 309, 273, + /* 1920 */ 769, 795, 311, 766, 796, 2704, 314, 850, 466, 804, + /* 1930 */ 2738, 2850, 313, 2777, 312, 807, 316, 122, 2740, 854, + /* 1940 */ 2742, 2743, 849, 156, 873, 1970, 2115, 2113, 2739, 383, + /* 1950 */ 204, 2831, 325, 2847, 800, 2950, 2828, 166, 384, 2928, + /* 1960 */ 818, 2579, 2578, 851, 2952, 101, 319, 2577, 470, 1, + /* 1970 */ 271, 167, 2738, 823, 824, 2777, 828, 831, 61, 186, + /* 1980 */ 2740, 854, 2742, 2743, 849, 2812, 873, 2739, 856, 338, + /* 1990 */ 858, 220, 2757, 860, 2417, 861, 343, 112, 385, 2696, + /* 2000 */ 2695, 2691, 851, 2690, 2682, 2681, 2673, 2672, 2704, 2688, + /* 2010 */ 850, 2687, 2679, 2678, 115, 2667, 372, 389, 1473, 2666, + /* 2020 */ 2685, 875, 2684, 2676, 970, 2675, 2664, 2890, 971, 2739, + /* 2030 */ 2663, 2757, 463, 375, 972, 967, 423, 259, 2661, 974, + /* 2040 */ 2660, 176, 391, 2468, 851, 376, 270, 2704, 744, 850, + /* 2050 */ 261, 268, 401, 412, 393, 2738, 266, 661, 2777, 2656, + /* 2060 */ 427, 52, 411, 2740, 854, 2742, 2743, 849, 2655, 873, + /* 2070 */ 2654, 464, 431, 2757, 85, 258, 414, 432, 402, 2649, + /* 2080 */ 511, 512, 1893, 1894, 224, 516, 2647, 518, 519, 2704, + /* 2090 */ 520, 850, 1892, 2646, 2738, 2645, 440, 2777, 2643, 526, + /* 2100 */ 2642, 411, 2740, 854, 2742, 2743, 849, 528, 873, 2739, + /* 2110 */ 2641, 530, 2640, 532, 1880, 2615, 228, 2614, 230, 1838, + /* 2120 */ 86, 1837, 2592, 2591, 851, 2590, 2739, 544, 545, 2589, + /* 2130 */ 2588, 2532, 549, 1774, 2529, 552, 2738, 2528, 2522, 2777, + /* 2140 */ 555, 848, 556, 404, 2740, 854, 2742, 2743, 849, 2519, + /* 2150 */ 873, 2739, 233, 2757, 2518, 89, 2517, 2516, 2521, 2520, + /* 2160 */ 235, 2515, 2514, 2512, 2511, 2510, 851, 237, 572, 2704, + /* 2170 */ 2757, 850, 2509, 2507, 574, 2506, 2505, 2504, 2503, 2527, + /* 2180 */ 2502, 2501, 2500, 2525, 2508, 2499, 2704, 2498, 850, 95, + /* 2190 */ 2739, 2497, 2495, 2494, 790, 2757, 2493, 2492, 2491, 2490, + /* 2200 */ 2489, 239, 2488, 2487, 2486, 851, 2485, 2557, 2526, 2524, + /* 2210 */ 2484, 2704, 2483, 850, 2482, 244, 2738, 1780, 2481, 2777, + /* 2220 */ 2480, 611, 613, 189, 2740, 854, 2742, 2743, 849, 2479, + /* 2230 */ 873, 2477, 2307, 2738, 2757, 475, 2777, 1625, 429, 1629, + /* 2240 */ 410, 2740, 854, 2742, 2743, 849, 430, 873, 2306, 2797, + /* 2250 */ 2704, 2305, 850, 1502, 2251, 1621, 247, 2304, 2738, 2302, + /* 2260 */ 2299, 2777, 631, 2298, 635, 411, 2740, 854, 2742, 2743, + /* 2270 */ 849, 2739, 873, 248, 477, 632, 636, 633, 637, 250, + /* 2280 */ 2291, 251, 639, 2951, 640, 641, 851, 2278, 2739, 2252, + /* 2290 */ 253, 81, 643, 2724, 199, 210, 651, 2738, 2613, 82, + /* 2300 */ 2777, 2609, 2599, 851, 411, 2740, 854, 2742, 2743, 849, + /* 2310 */ 2739, 873, 255, 2587, 262, 2757, 2586, 267, 264, 2563, + /* 2320 */ 269, 2556, 2394, 2301, 2297, 851, 1551, 672, 673, 674, + /* 2330 */ 2295, 2704, 2757, 850, 678, 676, 677, 2293, 681, 680, + /* 2340 */ 682, 2290, 684, 2273, 686, 2271, 685, 2272, 2704, 2270, + /* 2350 */ 850, 1707, 73, 2739, 2757, 2248, 2396, 1706, 275, 2395, + /* 2360 */ 1611, 1610, 1609, 1606, 1604, 1602, 2288, 1601, 851, 1600, + /* 2370 */ 2704, 2286, 850, 720, 1593, 1599, 1598, 937, 739, 939, + /* 2380 */ 2277, 2777, 2275, 454, 1595, 406, 2740, 854, 2742, 2743, + /* 2390 */ 849, 455, 873, 2739, 1594, 2738, 1592, 2757, 2777, 456, + /* 2400 */ 457, 723, 396, 2740, 854, 2742, 2743, 849, 851, 873, + /* 2410 */ 2247, 2246, 2245, 2704, 2244, 850, 733, 2738, 2243, 727, + /* 2420 */ 2777, 729, 2242, 731, 395, 2740, 854, 2742, 2743, 849, + /* 2430 */ 1878, 873, 2739, 128, 1874, 1876, 1873, 2757, 2612, 297, + /* 2440 */ 2608, 1844, 56, 1846, 2598, 1863, 754, 851, 1848, 28, + /* 2450 */ 2585, 743, 2584, 2704, 2934, 850, 180, 67, 2739, 20, + /* 2460 */ 2738, 57, 21, 2777, 755, 1823, 1822, 397, 2740, 854, + /* 2470 */ 2742, 2743, 849, 851, 873, 301, 2757, 30, 304, 17, + /* 2480 */ 760, 762, 770, 2168, 2142, 462, 6, 772, 774, 7, + /* 2490 */ 776, 22, 2704, 203, 850, 32, 215, 306, 2725, 190, + /* 2500 */ 2738, 2108, 2757, 2777, 216, 2149, 202, 403, 2740, 854, + /* 2510 */ 2742, 2743, 849, 2136, 873, 2110, 31, 83, 2704, 2106, + /* 2520 */ 850, 217, 2739, 2188, 2189, 65, 24, 2183, 2182, 23, + /* 2530 */ 467, 2090, 2187, 2186, 468, 321, 2089, 851, 59, 2738, + /* 2540 */ 195, 18, 2777, 2583, 2562, 106, 407, 2740, 854, 2742, + /* 2550 */ 2743, 849, 2739, 873, 58, 107, 2561, 328, 2144, 108, + /* 2560 */ 821, 2555, 109, 205, 25, 2738, 2757, 851, 2777, 334, + /* 2570 */ 69, 2739, 398, 2740, 854, 2742, 2743, 849, 337, 873, + /* 2580 */ 827, 2042, 2704, 11, 850, 2041, 851, 13, 829, 1958, + /* 2590 */ 336, 339, 2017, 2016, 2015, 888, 2757, 891, 894, 196, + /* 2600 */ 897, 38, 16, 2052, 206, 26, 1993, 2554, 110, 853, + /* 2610 */ 2391, 864, 2704, 859, 850, 2757, 1985, 27, 70, 865, + /* 2620 */ 857, 341, 111, 347, 79, 116, 2019, 2204, 2782, 2738, + /* 2630 */ 2203, 2704, 2777, 850, 2781, 2739, 408, 2740, 854, 2742, + /* 2640 */ 2743, 849, 872, 873, 68, 2202, 874, 880, 1688, 494, + /* 2650 */ 851, 882, 2201, 1685, 884, 885, 887, 2739, 1684, 2738, + /* 2660 */ 890, 1681, 2777, 1675, 893, 1673, 399, 2740, 854, 2742, + /* 2670 */ 2743, 849, 851, 873, 896, 117, 1679, 371, 2738, 2757, + /* 2680 */ 118, 2777, 1701, 1678, 80, 409, 2740, 854, 2742, 2743, + /* 2690 */ 849, 1677, 873, 1697, 1676, 2704, 911, 850, 1549, 1589, + /* 2700 */ 1588, 2757, 1587, 1584, 1581, 1580, 1579, 1619, 1578, 1576, + /* 2710 */ 1574, 1573, 1572, 925, 1618, 927, 222, 2704, 1570, 850, + /* 2720 */ 1569, 1568, 1567, 1566, 1615, 1565, 1564, 1613, 1561, 1560, + /* 2730 */ 1557, 1556, 1555, 2739, 1554, 2296, 2294, 947, 951, 2292, + /* 2740 */ 948, 949, 2738, 953, 955, 2777, 2289, 959, 851, 400, + /* 2750 */ 2740, 854, 2742, 2743, 849, 2739, 873, 952, 956, 957, + /* 2760 */ 960, 961, 2269, 963, 2738, 2267, 965, 2777, 2739, 1491, + /* 2770 */ 851, 416, 2740, 854, 2742, 2743, 849, 2757, 873, 2241, + /* 2780 */ 1474, 969, 377, 851, 973, 1479, 1481, 2207, 1944, 390, + /* 2790 */ 976, 977, 2207, 2704, 2207, 850, 2207, 2207, 2739, 2757, + /* 2800 */ 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, + /* 2810 */ 2207, 2207, 2757, 851, 2207, 2704, 2207, 850, 2207, 2207, + /* 2820 */ 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2704, 2207, + /* 2830 */ 850, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, + /* 2840 */ 2738, 2207, 2757, 2777, 2207, 2207, 2207, 417, 2740, 854, + /* 2850 */ 2742, 2743, 849, 2207, 873, 2207, 2207, 2207, 2704, 2207, + /* 2860 */ 850, 2207, 2738, 2207, 2207, 2777, 2207, 2207, 2207, 2751, + /* 2870 */ 2740, 854, 2742, 2743, 849, 2738, 873, 2739, 2777, 2207, + /* 2880 */ 2207, 2207, 2750, 2740, 854, 2742, 2743, 849, 2207, 873, + /* 2890 */ 2207, 2207, 851, 2207, 2739, 2207, 2207, 2207, 2207, 2207, + /* 2900 */ 2207, 2207, 2207, 2207, 2207, 2738, 2207, 2207, 2777, 851, + /* 2910 */ 2207, 2207, 2749, 2740, 854, 2742, 2743, 849, 2207, 873, + /* 2920 */ 2739, 2757, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, + /* 2930 */ 2207, 2207, 2207, 2207, 2207, 851, 2207, 2704, 2757, 850, + /* 2940 */ 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, + /* 2950 */ 2207, 2207, 2207, 2207, 2704, 2207, 850, 2207, 2739, 2207, + /* 2960 */ 2207, 2207, 2207, 2207, 2757, 2207, 2207, 2207, 2207, 2207, + /* 2970 */ 2207, 2207, 2207, 851, 2207, 2207, 2207, 2207, 2207, 2207, + /* 2980 */ 2704, 2207, 850, 2207, 2738, 2207, 2207, 2777, 2207, 2207, + /* 2990 */ 2207, 436, 2740, 854, 2742, 2743, 849, 2207, 873, 2207, + /* 3000 */ 2207, 2738, 2757, 2207, 2777, 2207, 2207, 2207, 437, 2740, + /* 3010 */ 854, 2742, 2743, 849, 2207, 873, 2207, 2207, 2704, 2207, + /* 3020 */ 850, 2207, 2207, 2207, 2207, 2207, 2207, 2738, 2207, 2207, + /* 3030 */ 2777, 2207, 2207, 2207, 433, 2740, 854, 2742, 2743, 849, + /* 3040 */ 2739, 873, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, + /* 3050 */ 2207, 2207, 2207, 2207, 2207, 851, 2207, 2207, 2207, 2207, + /* 3060 */ 2207, 2207, 2207, 2207, 2207, 2738, 2207, 2207, 2777, 2207, + /* 3070 */ 2739, 2207, 438, 2740, 854, 2742, 2743, 849, 2207, 873, + /* 3080 */ 2207, 2207, 2207, 2207, 2757, 851, 2207, 2207, 2207, 2207, + /* 3090 */ 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, + /* 3100 */ 2704, 2207, 850, 2207, 2207, 2207, 2207, 2207, 2207, 2207, + /* 3110 */ 2207, 2207, 2207, 2207, 2757, 2207, 2207, 2207, 2207, 2207, + /* 3120 */ 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, + /* 3130 */ 2704, 2207, 850, 2207, 2207, 2207, 2207, 2207, 2207, 2207, + /* 3140 */ 2207, 2207, 2207, 2207, 2207, 2207, 2207, 852, 2207, 2207, + /* 3150 */ 2777, 2207, 2207, 2207, 406, 2740, 854, 2742, 2743, 849, + /* 3160 */ 2207, 873, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, + /* 3170 */ 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2738, 2207, 2207, + /* 3180 */ 2777, 2207, 2207, 2207, 405, 2740, 854, 2742, 2743, 849, + /* 3190 */ 2207, 873, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 412, 426, 390, 467, 443, 393, 394, 443, 472, 510, - /* 10 */ 511, 395, 12, 13, 14, 426, 381, 14, 521, 424, - /* 20 */ 20, 457, 22, 20, 463, 464, 529, 463, 464, 441, - /* 30 */ 412, 396, 425, 395, 396, 440, 36, 396, 38, 428, - /* 40 */ 20, 434, 435, 428, 547, 548, 431, 8, 9, 552, - /* 50 */ 553, 12, 13, 14, 15, 16, 381, 521, 395, 441, - /* 60 */ 425, 445, 446, 14, 448, 529, 425, 451, 68, 20, - /* 70 */ 20, 396, 20, 12, 13, 75, 441, 73, 443, 491, - /* 80 */ 492, 493, 82, 547, 548, 395, 396, 443, 552, 553, - /* 90 */ 502, 0, 485, 486, 20, 12, 13, 36, 395, 396, - /* 100 */ 425, 457, 491, 20, 428, 22, 491, 463, 464, 491, - /* 110 */ 492, 74, 112, 502, 75, 115, 441, 502, 443, 36, - /* 120 */ 502, 38, 20, 488, 395, 396, 491, 14, 15, 16, - /* 130 */ 495, 496, 497, 498, 499, 500, 20, 502, 497, 378, - /* 140 */ 477, 478, 507, 390, 509, 54, 393, 394, 513, 514, - /* 150 */ 381, 68, 152, 153, 516, 517, 518, 519, 75, 521, - /* 160 */ 522, 1, 2, 488, 125, 82, 491, 491, 533, 117, - /* 170 */ 495, 496, 497, 498, 499, 500, 541, 502, 502, 381, - /* 180 */ 505, 36, 507, 508, 509, 395, 396, 411, 513, 514, - /* 190 */ 414, 191, 192, 391, 396, 112, 398, 395, 115, 397, - /* 200 */ 391, 201, 202, 426, 395, 415, 397, 517, 518, 519, - /* 210 */ 441, 521, 522, 423, 437, 211, 216, 115, 218, 529, - /* 220 */ 517, 518, 519, 425, 521, 522, 152, 153, 467, 190, - /* 230 */ 425, 115, 20, 472, 20, 152, 153, 547, 548, 441, - /* 240 */ 191, 443, 552, 553, 240, 241, 517, 518, 519, 444, - /* 250 */ 521, 522, 252, 253, 254, 33, 256, 257, 258, 259, + /* 0 */ 468, 396, 397, 406, 429, 473, 391, 432, 427, 394, + /* 10 */ 395, 414, 12, 13, 14, 396, 397, 396, 397, 438, + /* 20 */ 20, 0, 22, 8, 9, 396, 397, 12, 13, 14, + /* 30 */ 15, 16, 511, 512, 23, 416, 36, 416, 38, 0, + /* 40 */ 429, 34, 21, 424, 382, 24, 25, 26, 27, 28, + /* 50 */ 29, 30, 31, 32, 522, 450, 396, 397, 44, 397, + /* 60 */ 49, 50, 530, 396, 397, 8, 9, 492, 68, 12, + /* 70 */ 13, 14, 15, 16, 20, 75, 413, 20, 503, 450, + /* 80 */ 548, 549, 82, 416, 20, 553, 554, 444, 426, 412, + /* 90 */ 21, 424, 415, 24, 25, 26, 27, 28, 29, 30, + /* 100 */ 31, 32, 426, 492, 442, 442, 444, 464, 465, 20, + /* 110 */ 434, 429, 112, 382, 503, 115, 77, 78, 79, 80, + /* 120 */ 81, 445, 83, 84, 85, 86, 87, 88, 89, 90, + /* 130 */ 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, + /* 140 */ 101, 102, 103, 104, 105, 106, 107, 108, 425, 396, + /* 150 */ 397, 489, 152, 153, 492, 492, 493, 494, 496, 497, + /* 160 */ 498, 499, 500, 501, 441, 503, 503, 4, 21, 155, + /* 170 */ 508, 117, 510, 442, 492, 4, 514, 515, 518, 519, + /* 180 */ 520, 115, 522, 523, 37, 503, 39, 40, 41, 42, + /* 190 */ 530, 191, 192, 392, 23, 426, 534, 396, 522, 398, + /* 200 */ 495, 201, 202, 450, 542, 436, 530, 391, 548, 549, + /* 210 */ 394, 395, 115, 553, 554, 0, 216, 421, 218, 48, + /* 220 */ 49, 50, 426, 208, 548, 549, 521, 8, 9, 553, + /* 230 */ 554, 12, 13, 14, 15, 16, 155, 396, 20, 24, + /* 240 */ 25, 26, 27, 28, 29, 30, 31, 32, 115, 453, + /* 250 */ 193, 146, 147, 253, 254, 255, 151, 257, 258, 259, /* 260 */ 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, - /* 270 */ 270, 271, 272, 273, 191, 192, 116, 155, 420, 218, - /* 280 */ 44, 20, 521, 425, 201, 202, 488, 146, 147, 491, - /* 290 */ 529, 36, 151, 495, 496, 497, 498, 499, 500, 216, - /* 300 */ 502, 218, 0, 254, 254, 507, 20, 509, 547, 548, - /* 310 */ 452, 513, 514, 552, 553, 426, 277, 278, 279, 280, - /* 320 */ 281, 282, 283, 284, 285, 286, 287, 115, 145, 146, - /* 330 */ 147, 148, 149, 150, 151, 252, 253, 254, 116, 256, - /* 340 */ 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, - /* 350 */ 267, 268, 269, 270, 271, 272, 273, 274, 12, 13, - /* 360 */ 426, 427, 381, 218, 425, 18, 20, 147, 22, 417, - /* 370 */ 23, 151, 433, 421, 395, 396, 487, 396, 381, 77, - /* 380 */ 78, 79, 36, 444, 38, 395, 84, 85, 86, 42, - /* 390 */ 43, 155, 90, 46, 415, 250, 251, 95, 96, 97, - /* 400 */ 98, 299, 423, 101, 57, 0, 425, 105, 106, 107, - /* 410 */ 108, 289, 290, 291, 68, 299, 69, 70, 71, 72, - /* 420 */ 73, 75, 441, 523, 443, 525, 21, 20, 82, 24, - /* 430 */ 25, 26, 27, 28, 29, 30, 31, 32, 441, 521, - /* 440 */ 425, 12, 13, 14, 454, 225, 456, 529, 433, 20, - /* 450 */ 230, 22, 20, 233, 193, 235, 425, 20, 112, 444, - /* 460 */ 521, 115, 115, 4, 433, 36, 548, 38, 529, 488, - /* 470 */ 552, 553, 491, 218, 13, 444, 495, 496, 497, 498, - /* 480 */ 499, 500, 23, 502, 395, 396, 547, 548, 507, 425, - /* 490 */ 509, 552, 553, 20, 513, 514, 0, 68, 152, 153, - /* 500 */ 380, 154, 382, 155, 415, 250, 251, 48, 49, 50, - /* 510 */ 21, 82, 425, 24, 25, 26, 27, 28, 29, 30, - /* 520 */ 31, 32, 541, 115, 288, 289, 290, 291, 292, 293, - /* 530 */ 294, 295, 296, 21, 521, 420, 425, 191, 192, 452, - /* 540 */ 425, 112, 529, 82, 115, 434, 435, 201, 202, 37, - /* 550 */ 486, 39, 40, 41, 42, 208, 209, 210, 0, 196, - /* 560 */ 213, 548, 216, 20, 218, 552, 553, 452, 395, 396, - /* 570 */ 74, 8, 9, 226, 227, 12, 13, 14, 15, 16, - /* 580 */ 22, 152, 153, 20, 152, 153, 239, 439, 415, 242, - /* 590 */ 442, 443, 245, 246, 247, 248, 249, 145, 252, 253, - /* 600 */ 254, 149, 256, 257, 258, 259, 260, 261, 262, 263, - /* 610 */ 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, - /* 620 */ 191, 192, 292, 293, 294, 295, 296, 4, 191, 192, - /* 630 */ 201, 202, 404, 201, 202, 112, 288, 289, 290, 291, - /* 640 */ 292, 293, 294, 295, 296, 216, 299, 218, 0, 115, - /* 650 */ 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, - /* 660 */ 432, 138, 139, 140, 141, 142, 143, 144, 305, 306, - /* 670 */ 307, 308, 24, 25, 26, 27, 28, 29, 30, 31, - /* 680 */ 32, 252, 253, 254, 68, 256, 257, 258, 259, 260, - /* 690 */ 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, - /* 700 */ 271, 272, 273, 12, 13, 22, 381, 299, 395, 396, - /* 710 */ 74, 20, 20, 22, 12, 13, 14, 15, 16, 36, - /* 720 */ 20, 396, 22, 398, 77, 78, 79, 36, 415, 38, - /* 730 */ 114, 84, 85, 86, 191, 119, 36, 90, 115, 126, - /* 740 */ 395, 396, 95, 96, 97, 98, 3, 381, 101, 215, - /* 750 */ 425, 217, 105, 106, 107, 108, 193, 274, 58, 68, - /* 760 */ 415, 14, 396, 20, 398, 416, 441, 20, 443, 0, - /* 770 */ 228, 8, 9, 82, 425, 12, 13, 14, 15, 16, - /* 780 */ 54, 416, 395, 249, 91, 436, 12, 13, 395, 63, - /* 790 */ 425, 425, 66, 67, 20, 112, 22, 254, 395, 396, - /* 800 */ 425, 436, 186, 112, 395, 396, 115, 441, 433, 443, - /* 810 */ 36, 0, 38, 488, 442, 443, 491, 254, 415, 444, - /* 820 */ 495, 496, 497, 498, 499, 500, 36, 502, 395, 396, - /* 830 */ 395, 396, 507, 299, 509, 395, 396, 425, 513, 514, - /* 840 */ 395, 396, 68, 152, 153, 75, 459, 460, 415, 395, - /* 850 */ 396, 252, 159, 33, 488, 415, 82, 491, 449, 116, - /* 860 */ 415, 495, 496, 497, 498, 499, 500, 47, 502, 415, - /* 870 */ 477, 478, 82, 507, 82, 509, 404, 184, 185, 513, - /* 880 */ 514, 115, 191, 192, 449, 193, 112, 395, 396, 115, - /* 890 */ 126, 198, 201, 202, 422, 8, 9, 485, 486, 12, - /* 900 */ 13, 14, 15, 16, 432, 38, 274, 216, 276, 218, - /* 910 */ 311, 312, 313, 314, 315, 316, 317, 375, 376, 377, - /* 920 */ 33, 54, 299, 22, 155, 0, 152, 153, 190, 381, - /* 930 */ 63, 64, 65, 66, 0, 68, 193, 36, 191, 170, - /* 940 */ 506, 449, 508, 252, 253, 254, 254, 256, 257, 258, - /* 950 */ 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, - /* 960 */ 269, 270, 271, 272, 273, 191, 192, 402, 18, 44, - /* 970 */ 20, 208, 425, 395, 396, 201, 202, 27, 395, 396, - /* 980 */ 30, 114, 171, 82, 419, 4, 119, 176, 38, 441, - /* 990 */ 216, 444, 218, 415, 429, 184, 395, 396, 415, 52, - /* 1000 */ 405, 254, 146, 116, 54, 506, 56, 508, 413, 395, - /* 1010 */ 396, 61, 62, 8, 9, 277, 415, 12, 13, 14, - /* 1020 */ 15, 16, 252, 73, 494, 287, 252, 253, 254, 415, - /* 1030 */ 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, - /* 1040 */ 266, 267, 268, 269, 270, 271, 272, 273, 395, 396, - /* 1050 */ 520, 8, 9, 186, 44, 12, 13, 14, 15, 16, - /* 1060 */ 22, 20, 195, 14, 114, 299, 199, 200, 415, 20, - /* 1070 */ 395, 396, 205, 206, 36, 402, 126, 0, 68, 145, - /* 1080 */ 146, 147, 148, 149, 150, 151, 381, 231, 232, 326, - /* 1090 */ 415, 224, 8, 9, 59, 60, 12, 13, 14, 15, - /* 1100 */ 16, 396, 429, 398, 400, 401, 3, 157, 158, 23, - /* 1110 */ 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, - /* 1120 */ 82, 116, 172, 173, 174, 175, 176, 177, 178, 179, - /* 1130 */ 425, 181, 182, 183, 381, 49, 50, 187, 188, 189, - /* 1140 */ 193, 400, 401, 425, 194, 126, 441, 33, 443, 505, - /* 1150 */ 112, 204, 508, 435, 77, 78, 79, 80, 81, 116, - /* 1160 */ 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - /* 1170 */ 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - /* 1180 */ 103, 104, 105, 106, 107, 108, 20, 12, 13, 395, - /* 1190 */ 396, 381, 20, 488, 441, 381, 491, 22, 381, 180, - /* 1200 */ 495, 496, 497, 498, 499, 500, 396, 502, 398, 415, - /* 1210 */ 4, 36, 507, 38, 509, 381, 2, 381, 513, 514, - /* 1220 */ 381, 381, 8, 9, 381, 19, 12, 13, 14, 15, - /* 1230 */ 16, 22, 395, 396, 193, 425, 396, 186, 398, 395, - /* 1240 */ 396, 0, 381, 68, 38, 36, 395, 396, 20, 0, - /* 1250 */ 22, 441, 415, 443, 216, 441, 218, 82, 441, 415, - /* 1260 */ 54, 34, 381, 41, 42, 425, 415, 61, 62, 395, - /* 1270 */ 396, 220, 395, 396, 68, 441, 68, 441, 409, 410, - /* 1280 */ 441, 441, 301, 443, 441, 381, 58, 112, 425, 415, - /* 1290 */ 252, 253, 415, 409, 410, 254, 425, 381, 488, 436, - /* 1300 */ 494, 491, 441, 384, 385, 495, 496, 497, 498, 499, - /* 1310 */ 500, 33, 502, 381, 421, 444, 33, 507, 381, 509, - /* 1320 */ 114, 112, 441, 513, 514, 119, 520, 119, 488, 381, - /* 1330 */ 381, 491, 467, 13, 33, 495, 496, 497, 498, 499, - /* 1340 */ 500, 381, 502, 121, 122, 441, 124, 507, 47, 509, - /* 1350 */ 12, 13, 2, 513, 514, 381, 396, 441, 8, 9, - /* 1360 */ 22, 426, 12, 13, 14, 15, 16, 145, 152, 153, - /* 1370 */ 494, 149, 381, 441, 36, 482, 38, 438, 441, 438, - /* 1380 */ 441, 438, 441, 36, 441, 425, 521, 396, 0, 441, - /* 1390 */ 441, 216, 120, 218, 529, 123, 520, 0, 234, 116, - /* 1400 */ 236, 441, 82, 443, 155, 36, 68, 120, 381, 33, - /* 1410 */ 123, 120, 547, 548, 123, 441, 425, 552, 553, 22, - /* 1420 */ 254, 33, 467, 396, 321, 426, 254, 252, 253, 82, - /* 1430 */ 120, 13, 441, 123, 443, 426, 33, 33, 13, 325, - /* 1440 */ 0, 266, 267, 268, 269, 270, 271, 272, 488, 0, - /* 1450 */ 0, 491, 425, 51, 36, 495, 496, 497, 498, 499, - /* 1460 */ 500, 36, 502, 33, 33, 33, 426, 507, 441, 509, - /* 1470 */ 443, 22, 22, 513, 514, 0, 521, 1, 2, 488, - /* 1480 */ 473, 115, 491, 117, 529, 244, 495, 496, 497, 498, - /* 1490 */ 499, 500, 116, 502, 36, 55, 33, 33, 507, 33, - /* 1500 */ 509, 33, 547, 548, 513, 514, 413, 552, 553, 36, - /* 1510 */ 33, 33, 33, 12, 13, 488, 382, 115, 491, 116, - /* 1520 */ 116, 13, 495, 496, 497, 498, 499, 500, 453, 502, - /* 1530 */ 33, 33, 12, 13, 507, 523, 509, 381, 12, 13, - /* 1540 */ 513, 514, 12, 13, 36, 112, 116, 116, 116, 556, - /* 1550 */ 12, 13, 396, 545, 216, 82, 218, 524, 12, 13, - /* 1560 */ 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, - /* 1570 */ 538, 138, 139, 140, 141, 142, 143, 144, 1, 116, - /* 1580 */ 116, 425, 116, 36, 116, 12, 13, 218, 250, 251, - /* 1590 */ 252, 12, 13, 116, 116, 116, 19, 441, 33, 443, - /* 1600 */ 33, 323, 12, 13, 266, 267, 268, 269, 270, 271, - /* 1610 */ 272, 13, 467, 116, 116, 38, 12, 13, 381, 33, - /* 1620 */ 145, 146, 147, 148, 149, 150, 151, 12, 13, 82, - /* 1630 */ 53, 54, 467, 396, 36, 399, 33, 425, 412, 394, - /* 1640 */ 63, 64, 65, 66, 488, 68, 33, 491, 453, 544, - /* 1650 */ 412, 495, 496, 497, 498, 499, 500, 33, 502, 544, - /* 1660 */ 544, 544, 425, 466, 453, 509, 521, 399, 467, 513, - /* 1670 */ 514, 489, 396, 440, 529, 528, 218, 474, 441, 528, - /* 1680 */ 443, 116, 453, 116, 453, 549, 521, 453, 515, 531, - /* 1690 */ 54, 114, 547, 548, 529, 414, 119, 552, 553, 381, - /* 1700 */ 8, 9, 116, 302, 12, 13, 14, 15, 16, 490, - /* 1710 */ 468, 20, 547, 548, 396, 20, 395, 552, 553, 116, - /* 1720 */ 233, 404, 521, 381, 484, 488, 479, 150, 491, 116, - /* 1730 */ 529, 479, 495, 496, 497, 498, 499, 500, 396, 502, - /* 1740 */ 116, 404, 381, 425, 470, 214, 509, 395, 547, 548, - /* 1750 */ 513, 514, 20, 552, 553, 396, 47, 396, 450, 441, - /* 1760 */ 396, 443, 450, 447, 190, 395, 395, 425, 396, 450, - /* 1770 */ 447, 447, 195, 447, 197, 113, 408, 200, 111, 395, - /* 1780 */ 407, 395, 205, 441, 110, 443, 425, 406, 395, 395, - /* 1790 */ 395, 20, 52, 388, 479, 388, 404, 20, 392, 443, - /* 1800 */ 392, 224, 441, 404, 443, 20, 488, 397, 20, 491, - /* 1810 */ 381, 397, 469, 495, 496, 497, 498, 499, 500, 404, - /* 1820 */ 502, 404, 20, 404, 404, 396, 20, 509, 404, 454, - /* 1830 */ 488, 513, 514, 491, 460, 388, 395, 495, 496, 497, - /* 1840 */ 498, 499, 500, 501, 502, 503, 504, 404, 404, 488, - /* 1850 */ 381, 425, 491, 425, 425, 395, 495, 496, 497, 498, - /* 1860 */ 499, 500, 425, 502, 425, 396, 384, 425, 384, 388, - /* 1870 */ 441, 425, 443, 425, 237, 381, 425, 425, 425, 425, - /* 1880 */ 115, 483, 402, 20, 221, 193, 441, 222, 479, 468, - /* 1890 */ 396, 478, 481, 402, 425, 395, 441, 441, 476, 310, - /* 1900 */ 443, 309, 475, 542, 543, 318, 441, 540, 207, 303, - /* 1910 */ 441, 320, 443, 319, 537, 537, 537, 488, 381, 425, - /* 1920 */ 491, 539, 461, 461, 495, 496, 497, 498, 499, 500, - /* 1930 */ 298, 502, 536, 396, 534, 441, 297, 443, 468, 327, - /* 1940 */ 557, 324, 551, 527, 381, 322, 396, 535, 126, 526, - /* 1950 */ 20, 300, 397, 402, 402, 441, 461, 488, 441, 396, - /* 1960 */ 491, 494, 425, 441, 495, 496, 497, 498, 499, 500, - /* 1970 */ 532, 502, 461, 441, 441, 199, 458, 402, 441, 454, - /* 1980 */ 443, 441, 488, 554, 555, 491, 381, 402, 425, 495, - /* 1990 */ 496, 497, 498, 499, 500, 115, 502, 512, 441, 199, - /* 2000 */ 455, 396, 465, 509, 441, 421, 443, 454, 514, 550, - /* 2010 */ 402, 402, 543, 530, 396, 115, 395, 441, 22, 441, - /* 2020 */ 35, 441, 441, 381, 441, 488, 430, 383, 491, 441, - /* 2030 */ 425, 402, 495, 496, 497, 498, 499, 500, 396, 502, - /* 2040 */ 441, 441, 441, 441, 386, 37, 441, 387, 443, 40, - /* 2050 */ 389, 488, 441, 471, 491, 441, 388, 441, 495, 496, - /* 2060 */ 497, 498, 499, 500, 379, 502, 441, 425, 441, 441, - /* 2070 */ 465, 441, 441, 427, 441, 441, 441, 480, 403, 441, - /* 2080 */ 487, 441, 462, 441, 462, 443, 427, 418, 418, 418, - /* 2090 */ 0, 0, 0, 488, 47, 0, 491, 36, 243, 36, - /* 2100 */ 495, 496, 497, 498, 499, 500, 36, 502, 36, 546, - /* 2110 */ 381, 243, 0, 36, 36, 243, 36, 0, 0, 243, - /* 2120 */ 0, 36, 0, 36, 0, 396, 22, 0, 238, 36, - /* 2130 */ 488, 0, 381, 491, 224, 0, 224, 495, 496, 497, - /* 2140 */ 498, 499, 500, 225, 502, 218, 0, 396, 216, 0, - /* 2150 */ 0, 212, 211, 0, 425, 0, 158, 51, 51, 381, - /* 2160 */ 0, 36, 0, 0, 36, 54, 0, 51, 0, 0, - /* 2170 */ 441, 0, 443, 47, 396, 0, 425, 0, 0, 0, - /* 2180 */ 51, 0, 0, 0, 36, 0, 176, 176, 0, 0, - /* 2190 */ 0, 0, 441, 0, 443, 0, 381, 555, 0, 0, - /* 2200 */ 0, 0, 0, 425, 0, 0, 0, 0, 0, 0, - /* 2210 */ 0, 396, 0, 0, 0, 51, 465, 488, 0, 441, - /* 2220 */ 491, 443, 0, 381, 495, 496, 497, 498, 499, 500, - /* 2230 */ 0, 502, 0, 504, 47, 0, 0, 0, 396, 488, - /* 2240 */ 425, 0, 491, 465, 0, 381, 495, 496, 497, 498, - /* 2250 */ 499, 500, 0, 502, 158, 22, 441, 0, 443, 157, - /* 2260 */ 396, 0, 0, 0, 156, 22, 488, 425, 52, 491, - /* 2270 */ 22, 52, 381, 495, 496, 497, 498, 499, 500, 0, - /* 2280 */ 502, 0, 0, 441, 0, 443, 36, 396, 68, 425, - /* 2290 */ 0, 68, 68, 68, 0, 36, 54, 44, 0, 54, - /* 2300 */ 36, 0, 44, 488, 36, 441, 491, 443, 54, 381, - /* 2310 */ 495, 496, 497, 498, 499, 500, 425, 502, 44, 0, - /* 2320 */ 0, 36, 47, 51, 396, 33, 14, 44, 51, 51, - /* 2330 */ 488, 0, 441, 491, 443, 0, 45, 495, 496, 497, - /* 2340 */ 498, 499, 500, 44, 502, 0, 0, 0, 44, 207, - /* 2350 */ 381, 51, 488, 425, 0, 491, 0, 51, 0, 495, - /* 2360 */ 496, 497, 498, 499, 500, 396, 502, 0, 0, 441, - /* 2370 */ 0, 443, 76, 36, 44, 54, 0, 36, 54, 488, - /* 2380 */ 44, 0, 491, 54, 36, 381, 495, 496, 497, 498, - /* 2390 */ 499, 500, 0, 502, 425, 36, 44, 54, 0, 44, - /* 2400 */ 396, 0, 0, 0, 0, 0, 22, 36, 0, 22, - /* 2410 */ 441, 36, 443, 125, 36, 36, 488, 381, 123, 491, - /* 2420 */ 0, 36, 36, 495, 496, 497, 498, 499, 500, 425, - /* 2430 */ 502, 36, 396, 36, 0, 36, 381, 22, 22, 22, - /* 2440 */ 33, 0, 36, 33, 22, 441, 56, 443, 36, 36, - /* 2450 */ 36, 396, 0, 22, 0, 36, 0, 488, 0, 36, - /* 2460 */ 491, 425, 0, 36, 495, 496, 497, 498, 499, 500, - /* 2470 */ 0, 502, 36, 0, 36, 22, 36, 441, 36, 443, - /* 2480 */ 425, 20, 381, 0, 229, 116, 193, 115, 228, 115, - /* 2490 */ 223, 0, 488, 36, 51, 491, 441, 396, 443, 495, - /* 2500 */ 496, 497, 498, 499, 500, 0, 502, 193, 22, 22, - /* 2510 */ 193, 0, 199, 0, 381, 193, 219, 3, 203, 193, - /* 2520 */ 36, 203, 33, 52, 488, 116, 425, 491, 36, 396, - /* 2530 */ 304, 495, 496, 497, 498, 499, 500, 116, 502, 115, - /* 2540 */ 115, 115, 441, 488, 443, 113, 491, 52, 51, 116, - /* 2550 */ 495, 496, 497, 498, 499, 500, 111, 502, 425, 33, - /* 2560 */ 33, 33, 116, 115, 115, 115, 33, 116, 51, 304, - /* 2570 */ 115, 33, 82, 36, 441, 116, 443, 3, 381, 115, - /* 2580 */ 33, 116, 116, 116, 304, 36, 36, 36, 36, 488, - /* 2590 */ 36, 36, 491, 396, 116, 51, 495, 496, 497, 498, - /* 2600 */ 499, 500, 381, 502, 288, 33, 0, 51, 0, 115, - /* 2610 */ 44, 0, 116, 44, 116, 115, 115, 396, 115, 0, - /* 2620 */ 116, 488, 425, 115, 491, 196, 196, 381, 495, 496, - /* 2630 */ 497, 498, 499, 500, 44, 502, 33, 113, 441, 200, - /* 2640 */ 443, 275, 396, 113, 2, 22, 425, 116, 252, 51, - /* 2650 */ 116, 115, 51, 22, 115, 195, 115, 115, 115, 0, - /* 2660 */ 44, 116, 441, 115, 443, 196, 255, 381, 115, 0, - /* 2670 */ 22, 425, 51, 116, 115, 115, 118, 116, 115, 115, - /* 2680 */ 115, 36, 396, 115, 117, 488, 115, 441, 491, 443, - /* 2690 */ 115, 381, 495, 496, 497, 498, 499, 500, 116, 502, - /* 2700 */ 115, 22, 126, 22, 229, 22, 396, 116, 36, 488, - /* 2710 */ 115, 425, 491, 116, 36, 115, 495, 496, 497, 498, - /* 2720 */ 499, 500, 36, 502, 36, 116, 116, 441, 116, 443, - /* 2730 */ 36, 116, 381, 36, 488, 425, 137, 491, 33, 137, - /* 2740 */ 115, 495, 496, 497, 498, 499, 500, 396, 502, 115, - /* 2750 */ 137, 441, 36, 443, 137, 115, 22, 22, 76, 75, - /* 2760 */ 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, - /* 2770 */ 109, 82, 381, 36, 488, 82, 425, 491, 33, 109, - /* 2780 */ 36, 495, 496, 497, 498, 499, 500, 396, 502, 36, - /* 2790 */ 36, 22, 441, 36, 443, 36, 36, 82, 488, 381, - /* 2800 */ 36, 491, 36, 36, 36, 495, 496, 497, 498, 499, - /* 2810 */ 500, 36, 502, 22, 396, 36, 425, 0, 381, 36, - /* 2820 */ 44, 0, 36, 0, 54, 54, 44, 54, 36, 44, - /* 2830 */ 0, 36, 441, 396, 443, 54, 0, 44, 36, 488, - /* 2840 */ 0, 22, 491, 425, 36, 0, 495, 496, 497, 498, - /* 2850 */ 499, 500, 36, 502, 22, 33, 36, 22, 21, 441, - /* 2860 */ 22, 443, 425, 22, 21, 558, 20, 558, 558, 558, - /* 2870 */ 558, 558, 558, 558, 558, 558, 558, 558, 441, 488, - /* 2880 */ 443, 558, 491, 381, 558, 558, 495, 496, 497, 498, - /* 2890 */ 499, 500, 558, 502, 558, 558, 381, 558, 396, 558, - /* 2900 */ 558, 558, 558, 558, 558, 558, 488, 558, 558, 491, - /* 2910 */ 558, 396, 558, 495, 496, 497, 498, 499, 500, 558, - /* 2920 */ 502, 558, 558, 558, 558, 488, 558, 425, 491, 558, - /* 2930 */ 558, 558, 495, 496, 497, 498, 499, 500, 558, 502, - /* 2940 */ 425, 558, 558, 441, 558, 443, 558, 558, 558, 558, - /* 2950 */ 558, 558, 558, 558, 558, 558, 441, 558, 443, 558, - /* 2960 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 2970 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 2980 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 2990 */ 488, 558, 558, 491, 558, 558, 558, 495, 496, 497, - /* 3000 */ 498, 499, 500, 488, 502, 558, 491, 558, 558, 558, - /* 3010 */ 495, 496, 497, 498, 499, 500, 558, 502, 558, 558, - /* 3020 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 3030 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 3040 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 3050 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 3060 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 3070 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 3080 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 3090 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 3100 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 3110 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 3120 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 3130 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 3140 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 3150 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 3160 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 3170 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 3180 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 3190 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 3200 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 3210 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 3220 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 3230 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 3240 */ 558, 558, 558, 558, 558, 378, 378, 378, 378, 378, - /* 3250 */ 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, - /* 3260 */ 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, - /* 3270 */ 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, - /* 3280 */ 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, - /* 3290 */ 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, - /* 3300 */ 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, - /* 3310 */ 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, - /* 3320 */ 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, - /* 3330 */ 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, - /* 3340 */ 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, - /* 3350 */ 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, - /* 3360 */ 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, - /* 3370 */ 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, - /* 3380 */ 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, - /* 3390 */ 378, 378, 378, 378, 378, 378, + /* 270 */ 270, 271, 272, 273, 274, 12, 13, 444, 115, 468, + /* 280 */ 18, 74, 20, 20, 0, 22, 426, 446, 447, 27, + /* 290 */ 449, 458, 30, 452, 75, 435, 436, 464, 465, 36, + /* 300 */ 38, 38, 405, 289, 290, 291, 292, 293, 294, 295, + /* 310 */ 296, 297, 255, 12, 13, 2, 54, 20, 56, 3, + /* 320 */ 423, 8, 9, 61, 62, 12, 13, 14, 15, 16, + /* 330 */ 433, 68, 426, 522, 427, 73, 20, 36, 75, 20, + /* 340 */ 434, 530, 327, 4, 125, 82, 486, 487, 215, 396, + /* 350 */ 217, 445, 382, 293, 294, 295, 296, 297, 19, 548, + /* 360 */ 549, 77, 78, 79, 553, 554, 300, 397, 84, 85, + /* 370 */ 86, 290, 291, 292, 90, 112, 114, 38, 115, 95, + /* 380 */ 96, 97, 98, 250, 20, 101, 522, 0, 126, 105, + /* 390 */ 106, 107, 108, 54, 530, 488, 426, 300, 8, 9, + /* 400 */ 61, 62, 12, 13, 14, 15, 16, 68, 455, 190, + /* 410 */ 457, 193, 442, 549, 444, 152, 153, 553, 554, 157, + /* 420 */ 158, 0, 160, 161, 162, 163, 164, 165, 166, 167, + /* 430 */ 168, 169, 116, 300, 172, 173, 174, 175, 176, 177, + /* 440 */ 178, 179, 55, 181, 182, 183, 14, 20, 54, 187, + /* 450 */ 188, 189, 20, 114, 191, 192, 194, 63, 119, 489, + /* 460 */ 66, 67, 492, 300, 201, 202, 496, 497, 498, 499, + /* 470 */ 500, 501, 440, 503, 506, 443, 444, 509, 508, 216, + /* 480 */ 510, 218, 228, 439, 514, 515, 442, 155, 8, 9, + /* 490 */ 396, 397, 12, 13, 14, 15, 16, 278, 279, 280, + /* 500 */ 281, 282, 283, 284, 285, 286, 287, 288, 20, 193, + /* 510 */ 191, 192, 542, 33, 413, 13, 253, 254, 255, 218, + /* 520 */ 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, + /* 530 */ 267, 268, 269, 270, 271, 272, 273, 274, 275, 12, + /* 540 */ 13, 382, 115, 442, 392, 20, 522, 20, 396, 22, + /* 550 */ 398, 77, 78, 79, 530, 20, 397, 147, 84, 85, + /* 560 */ 86, 151, 405, 36, 90, 38, 73, 427, 428, 95, + /* 570 */ 96, 97, 98, 549, 382, 101, 13, 553, 554, 105, + /* 580 */ 106, 107, 108, 193, 82, 426, 444, 68, 379, 397, + /* 590 */ 433, 399, 171, 492, 493, 68, 116, 176, 443, 444, + /* 600 */ 458, 442, 75, 444, 503, 184, 464, 465, 20, 82, + /* 610 */ 426, 517, 518, 519, 520, 495, 522, 523, 426, 255, + /* 620 */ 0, 289, 290, 291, 292, 293, 294, 295, 296, 297, + /* 630 */ 376, 377, 378, 114, 442, 225, 444, 403, 119, 112, + /* 640 */ 230, 521, 115, 91, 234, 82, 236, 20, 489, 22, + /* 650 */ 115, 492, 22, 33, 420, 496, 497, 498, 499, 500, + /* 660 */ 501, 253, 503, 36, 430, 506, 36, 508, 509, 510, + /* 670 */ 486, 487, 22, 514, 515, 36, 0, 468, 417, 152, + /* 680 */ 153, 489, 473, 20, 492, 58, 36, 426, 496, 497, + /* 690 */ 498, 499, 500, 501, 0, 503, 1, 2, 437, 524, + /* 700 */ 508, 526, 510, 36, 211, 186, 514, 515, 382, 8, + /* 710 */ 9, 159, 82, 12, 13, 14, 15, 16, 191, 192, + /* 720 */ 312, 313, 314, 315, 316, 317, 318, 14, 201, 202, + /* 730 */ 54, 522, 82, 20, 241, 242, 184, 185, 14, 530, + /* 740 */ 152, 153, 112, 216, 20, 218, 397, 146, 8, 9, + /* 750 */ 198, 0, 12, 13, 14, 15, 16, 548, 549, 2, + /* 760 */ 382, 382, 553, 554, 20, 8, 9, 75, 442, 12, + /* 770 */ 13, 14, 15, 16, 421, 426, 397, 396, 399, 426, + /* 780 */ 253, 254, 255, 36, 257, 258, 259, 260, 261, 262, + /* 790 */ 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, + /* 800 */ 273, 274, 12, 13, 14, 426, 453, 382, 74, 396, + /* 810 */ 20, 116, 22, 20, 126, 152, 153, 116, 396, 397, + /* 820 */ 442, 442, 397, 444, 399, 74, 36, 0, 38, 82, + /* 830 */ 41, 42, 231, 232, 233, 300, 403, 382, 416, 145, + /* 840 */ 146, 147, 148, 149, 150, 151, 216, 498, 218, 196, + /* 850 */ 20, 426, 397, 381, 399, 383, 116, 218, 68, 478, + /* 860 */ 479, 396, 397, 430, 201, 202, 495, 442, 489, 444, + /* 870 */ 275, 492, 82, 460, 461, 496, 497, 498, 499, 500, + /* 880 */ 501, 426, 503, 253, 254, 218, 382, 508, 426, 510, + /* 890 */ 251, 252, 521, 514, 515, 20, 434, 442, 20, 444, + /* 900 */ 82, 397, 112, 399, 191, 115, 439, 445, 115, 442, + /* 910 */ 121, 122, 426, 124, 489, 191, 426, 492, 251, 252, + /* 920 */ 434, 496, 497, 498, 499, 500, 501, 437, 503, 382, + /* 930 */ 426, 445, 126, 508, 145, 510, 468, 193, 149, 514, + /* 940 */ 515, 396, 152, 153, 489, 253, 442, 492, 444, 382, + /* 950 */ 427, 496, 497, 498, 499, 500, 501, 33, 503, 306, + /* 960 */ 307, 308, 309, 508, 3, 510, 396, 397, 255, 514, + /* 970 */ 515, 47, 145, 146, 147, 148, 149, 150, 151, 255, + /* 980 */ 36, 191, 192, 518, 519, 520, 416, 522, 523, 442, + /* 990 */ 522, 201, 202, 489, 0, 52, 492, 414, 530, 255, + /* 1000 */ 496, 497, 498, 499, 500, 501, 216, 503, 218, 442, + /* 1010 */ 112, 382, 508, 275, 510, 277, 548, 549, 514, 515, + /* 1020 */ 426, 553, 554, 478, 479, 127, 128, 129, 130, 131, + /* 1030 */ 132, 133, 134, 135, 136, 427, 138, 139, 140, 141, + /* 1040 */ 142, 143, 144, 253, 254, 255, 0, 257, 258, 259, + /* 1050 */ 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, + /* 1060 */ 270, 271, 272, 273, 274, 12, 13, 382, 193, 191, + /* 1070 */ 468, 442, 468, 20, 417, 22, 12, 13, 14, 15, + /* 1080 */ 16, 487, 397, 426, 399, 255, 468, 396, 397, 36, + /* 1090 */ 44, 38, 426, 300, 437, 396, 397, 439, 8, 9, + /* 1100 */ 442, 382, 12, 13, 14, 15, 16, 416, 396, 397, + /* 1110 */ 427, 426, 522, 396, 397, 416, 397, 396, 397, 453, + /* 1120 */ 530, 68, 396, 397, 522, 4, 522, 442, 416, 444, + /* 1130 */ 255, 427, 530, 255, 530, 82, 193, 416, 548, 549, + /* 1140 */ 522, 427, 416, 553, 554, 426, 474, 204, 530, 155, + /* 1150 */ 548, 549, 548, 549, 426, 553, 554, 553, 554, 396, + /* 1160 */ 397, 442, 218, 444, 170, 112, 548, 549, 115, 396, + /* 1170 */ 397, 553, 554, 445, 489, 0, 20, 492, 22, 416, + /* 1180 */ 22, 496, 497, 498, 499, 500, 501, 20, 503, 416, + /* 1190 */ 396, 397, 426, 508, 36, 510, 422, 12, 13, 514, + /* 1200 */ 515, 435, 436, 59, 60, 152, 153, 22, 489, 426, + /* 1210 */ 416, 492, 396, 397, 58, 496, 497, 498, 499, 500, + /* 1220 */ 501, 36, 503, 38, 401, 402, 36, 508, 445, 510, + /* 1230 */ 396, 397, 416, 514, 515, 518, 519, 520, 382, 522, + /* 1240 */ 523, 382, 22, 382, 191, 192, 396, 397, 396, 397, + /* 1250 */ 416, 410, 411, 68, 201, 202, 36, 483, 112, 145, + /* 1260 */ 146, 147, 148, 149, 150, 151, 416, 82, 416, 216, + /* 1270 */ 112, 218, 82, 127, 128, 129, 130, 131, 132, 133, + /* 1280 */ 134, 135, 136, 322, 138, 139, 140, 141, 142, 143, + /* 1290 */ 144, 14, 15, 16, 190, 401, 402, 112, 442, 410, + /* 1300 */ 411, 442, 382, 442, 385, 386, 253, 254, 255, 382, + /* 1310 */ 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, + /* 1320 */ 267, 268, 269, 270, 271, 272, 273, 274, 12, 13, + /* 1330 */ 396, 397, 112, 396, 397, 18, 20, 382, 22, 382, + /* 1340 */ 23, 396, 397, 418, 396, 397, 382, 422, 396, 397, + /* 1350 */ 416, 382, 36, 416, 38, 396, 397, 382, 382, 42, + /* 1360 */ 43, 416, 442, 46, 416, 382, 382, 44, 416, 442, + /* 1370 */ 382, 152, 153, 186, 57, 416, 507, 507, 509, 509, + /* 1380 */ 397, 126, 278, 0, 68, 382, 69, 70, 71, 72, + /* 1390 */ 73, 68, 288, 426, 0, 33, 33, 442, 82, 442, + /* 1400 */ 397, 216, 14, 218, 33, 22, 442, 220, 20, 426, + /* 1410 */ 145, 442, 445, 120, 149, 33, 123, 442, 442, 33, + /* 1420 */ 245, 120, 255, 302, 123, 442, 442, 444, 112, 426, + /* 1430 */ 442, 115, 115, 47, 120, 180, 13, 123, 253, 254, + /* 1440 */ 12, 13, 13, 1, 2, 442, 120, 444, 0, 123, + /* 1450 */ 22, 0, 267, 268, 269, 270, 271, 272, 273, 36, + /* 1460 */ 235, 68, 237, 427, 36, 36, 38, 0, 152, 153, + /* 1470 */ 22, 154, 489, 22, 383, 492, 33, 51, 116, 496, + /* 1480 */ 497, 498, 499, 500, 501, 33, 503, 116, 115, 22, + /* 1490 */ 117, 508, 489, 510, 382, 492, 68, 514, 515, 496, + /* 1500 */ 497, 498, 499, 500, 501, 454, 503, 191, 192, 397, + /* 1510 */ 33, 33, 119, 33, 33, 33, 524, 201, 202, 33, + /* 1520 */ 12, 13, 557, 33, 36, 208, 209, 210, 12, 13, + /* 1530 */ 213, 33, 216, 546, 218, 33, 33, 539, 426, 525, + /* 1540 */ 33, 115, 33, 226, 227, 33, 543, 544, 400, 155, + /* 1550 */ 426, 12, 13, 413, 442, 413, 444, 240, 395, 116, + /* 1560 */ 243, 454, 33, 246, 247, 248, 249, 250, 116, 253, + /* 1570 */ 254, 255, 545, 257, 258, 259, 260, 261, 262, 263, + /* 1580 */ 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, + /* 1590 */ 274, 12, 13, 116, 116, 545, 116, 116, 116, 12, + /* 1600 */ 13, 489, 116, 1, 492, 33, 116, 33, 496, 497, + /* 1610 */ 498, 499, 500, 501, 116, 503, 382, 300, 116, 116, + /* 1620 */ 508, 19, 510, 116, 33, 116, 514, 515, 116, 12, + /* 1630 */ 13, 397, 12, 13, 12, 13, 12, 13, 12, 13, + /* 1640 */ 38, 12, 13, 36, 216, 116, 218, 36, 13, 13, + /* 1650 */ 545, 467, 454, 545, 400, 53, 54, 397, 382, 490, + /* 1660 */ 426, 475, 441, 33, 33, 63, 64, 65, 66, 454, + /* 1670 */ 68, 36, 36, 397, 529, 550, 442, 454, 444, 251, + /* 1680 */ 252, 253, 529, 532, 516, 454, 415, 324, 116, 82, + /* 1690 */ 116, 469, 303, 82, 382, 267, 268, 269, 270, 271, + /* 1700 */ 272, 273, 426, 54, 491, 20, 218, 116, 326, 397, + /* 1710 */ 20, 396, 480, 234, 485, 405, 114, 480, 442, 214, + /* 1720 */ 444, 119, 471, 489, 405, 396, 492, 20, 397, 47, + /* 1730 */ 496, 497, 498, 499, 500, 501, 451, 503, 426, 397, + /* 1740 */ 451, 190, 448, 382, 510, 396, 116, 116, 514, 515, + /* 1750 */ 397, 396, 150, 451, 442, 448, 444, 448, 397, 448, + /* 1760 */ 409, 113, 111, 396, 408, 489, 396, 110, 492, 20, + /* 1770 */ 396, 407, 496, 497, 498, 499, 500, 501, 52, 503, + /* 1780 */ 396, 382, 405, 396, 389, 393, 510, 426, 480, 389, + /* 1790 */ 514, 515, 20, 20, 393, 405, 397, 195, 444, 197, + /* 1800 */ 398, 489, 200, 442, 492, 444, 20, 205, 496, 497, + /* 1810 */ 498, 499, 500, 501, 502, 503, 504, 505, 405, 405, + /* 1820 */ 470, 405, 398, 382, 20, 426, 224, 461, 396, 20, + /* 1830 */ 405, 455, 405, 389, 426, 405, 405, 426, 397, 385, + /* 1840 */ 385, 442, 238, 444, 426, 426, 426, 426, 426, 396, + /* 1850 */ 489, 389, 442, 492, 442, 115, 484, 496, 497, 498, + /* 1860 */ 499, 500, 501, 426, 503, 382, 426, 426, 403, 20, + /* 1870 */ 479, 510, 426, 426, 222, 514, 515, 442, 482, 221, + /* 1880 */ 397, 396, 477, 442, 480, 444, 311, 403, 489, 38, + /* 1890 */ 538, 492, 310, 476, 444, 496, 497, 498, 499, 500, + /* 1900 */ 501, 442, 503, 469, 319, 54, 538, 462, 207, 426, + /* 1910 */ 541, 462, 320, 538, 63, 64, 65, 66, 540, 68, + /* 1920 */ 321, 298, 537, 304, 299, 442, 469, 444, 328, 323, + /* 1930 */ 489, 528, 535, 492, 536, 325, 527, 496, 497, 498, + /* 1940 */ 499, 500, 501, 397, 503, 20, 126, 301, 382, 462, + /* 1950 */ 398, 510, 403, 495, 555, 556, 515, 403, 462, 552, + /* 1960 */ 442, 442, 442, 397, 558, 114, 551, 442, 442, 533, + /* 1970 */ 119, 403, 489, 199, 459, 492, 442, 455, 115, 496, + /* 1980 */ 497, 498, 499, 500, 501, 513, 503, 382, 199, 403, + /* 1990 */ 442, 531, 426, 456, 397, 455, 403, 403, 422, 442, + /* 2000 */ 442, 442, 397, 442, 442, 442, 442, 442, 442, 442, + /* 2010 */ 444, 442, 442, 442, 115, 442, 403, 396, 22, 442, + /* 2020 */ 442, 431, 442, 442, 384, 442, 442, 544, 35, 382, + /* 2030 */ 442, 426, 466, 388, 37, 40, 428, 186, 442, 389, + /* 2040 */ 442, 387, 404, 442, 397, 390, 195, 442, 488, 444, + /* 2050 */ 199, 200, 419, 419, 380, 489, 205, 206, 492, 0, + /* 2060 */ 428, 472, 496, 497, 498, 499, 500, 501, 0, 503, + /* 2070 */ 0, 466, 463, 426, 47, 224, 481, 463, 419, 0, + /* 2080 */ 36, 244, 36, 36, 36, 244, 0, 36, 36, 442, + /* 2090 */ 244, 444, 36, 0, 489, 0, 244, 492, 0, 36, + /* 2100 */ 0, 496, 497, 498, 499, 500, 501, 36, 503, 382, + /* 2110 */ 0, 22, 0, 36, 239, 0, 224, 0, 224, 218, + /* 2120 */ 225, 216, 0, 0, 397, 0, 382, 212, 211, 0, + /* 2130 */ 0, 158, 51, 51, 0, 36, 489, 0, 0, 492, + /* 2140 */ 36, 397, 54, 496, 497, 498, 499, 500, 501, 0, + /* 2150 */ 503, 382, 51, 426, 0, 47, 0, 0, 0, 0, + /* 2160 */ 51, 0, 0, 0, 0, 0, 397, 176, 36, 442, + /* 2170 */ 426, 444, 0, 0, 176, 0, 0, 0, 0, 0, + /* 2180 */ 0, 0, 0, 0, 0, 0, 442, 0, 444, 47, + /* 2190 */ 382, 0, 0, 0, 547, 426, 0, 0, 0, 0, + /* 2200 */ 0, 51, 0, 0, 0, 397, 0, 0, 0, 0, + /* 2210 */ 0, 442, 0, 444, 0, 158, 489, 22, 0, 492, + /* 2220 */ 0, 157, 156, 496, 497, 498, 499, 500, 501, 0, + /* 2230 */ 503, 0, 0, 489, 426, 466, 492, 22, 52, 22, + /* 2240 */ 496, 497, 498, 499, 500, 501, 52, 503, 0, 505, + /* 2250 */ 442, 0, 444, 14, 0, 36, 68, 0, 489, 0, + /* 2260 */ 0, 492, 36, 0, 36, 496, 497, 498, 499, 500, + /* 2270 */ 501, 382, 503, 68, 466, 54, 54, 44, 44, 68, + /* 2280 */ 0, 68, 36, 556, 54, 44, 397, 0, 382, 0, + /* 2290 */ 47, 44, 36, 51, 33, 51, 51, 489, 0, 44, + /* 2300 */ 492, 0, 0, 397, 496, 497, 498, 499, 500, 501, + /* 2310 */ 382, 503, 45, 0, 44, 426, 0, 51, 207, 0, + /* 2320 */ 51, 0, 0, 0, 0, 397, 76, 36, 54, 44, + /* 2330 */ 0, 442, 426, 444, 44, 36, 54, 0, 54, 36, + /* 2340 */ 44, 0, 36, 0, 44, 0, 54, 0, 442, 0, + /* 2350 */ 444, 36, 125, 382, 426, 0, 0, 22, 123, 0, + /* 2360 */ 22, 36, 36, 36, 36, 36, 0, 36, 397, 36, + /* 2370 */ 442, 0, 444, 56, 22, 36, 36, 33, 489, 33, + /* 2380 */ 0, 492, 0, 22, 36, 496, 497, 498, 499, 500, + /* 2390 */ 501, 22, 503, 382, 36, 489, 36, 426, 492, 22, + /* 2400 */ 22, 36, 496, 497, 498, 499, 500, 501, 397, 503, + /* 2410 */ 0, 0, 0, 442, 0, 444, 22, 489, 0, 36, + /* 2420 */ 492, 36, 0, 36, 496, 497, 498, 499, 500, 501, + /* 2430 */ 116, 503, 382, 20, 36, 36, 36, 426, 0, 51, + /* 2440 */ 0, 36, 193, 22, 0, 229, 22, 397, 223, 115, + /* 2450 */ 0, 228, 0, 442, 3, 444, 219, 115, 382, 33, + /* 2460 */ 489, 193, 33, 492, 193, 193, 193, 496, 497, 498, + /* 2470 */ 499, 500, 501, 397, 503, 199, 426, 115, 115, 305, + /* 2480 */ 203, 203, 36, 116, 116, 36, 52, 115, 113, 52, + /* 2490 */ 111, 33, 442, 33, 444, 33, 51, 116, 51, 115, + /* 2500 */ 489, 82, 426, 492, 33, 116, 115, 496, 497, 498, + /* 2510 */ 499, 500, 501, 116, 503, 36, 115, 115, 442, 116, + /* 2520 */ 444, 115, 382, 116, 116, 3, 33, 36, 36, 305, + /* 2530 */ 36, 116, 36, 36, 36, 51, 116, 397, 33, 489, + /* 2540 */ 51, 305, 492, 0, 0, 115, 496, 497, 498, 499, + /* 2550 */ 500, 501, 382, 503, 289, 44, 0, 116, 116, 44, + /* 2560 */ 196, 0, 44, 115, 33, 489, 426, 397, 492, 115, + /* 2570 */ 115, 382, 496, 497, 498, 499, 500, 501, 115, 503, + /* 2580 */ 116, 113, 442, 276, 444, 113, 397, 2, 196, 22, + /* 2590 */ 200, 195, 116, 116, 116, 115, 426, 115, 115, 51, + /* 2600 */ 115, 115, 115, 253, 51, 115, 22, 0, 44, 256, + /* 2610 */ 0, 22, 442, 196, 444, 426, 116, 115, 115, 118, + /* 2620 */ 116, 115, 115, 51, 115, 117, 116, 22, 115, 489, + /* 2630 */ 22, 442, 492, 444, 115, 382, 496, 497, 498, 499, + /* 2640 */ 500, 501, 115, 503, 115, 22, 126, 36, 116, 36, + /* 2650 */ 397, 115, 229, 116, 36, 115, 36, 382, 116, 489, + /* 2660 */ 36, 116, 492, 116, 36, 116, 496, 497, 498, 499, + /* 2670 */ 500, 501, 397, 503, 36, 115, 137, 33, 489, 426, + /* 2680 */ 115, 492, 36, 137, 115, 496, 497, 498, 499, 500, + /* 2690 */ 501, 137, 503, 22, 137, 442, 75, 444, 76, 22, + /* 2700 */ 36, 426, 36, 36, 36, 36, 36, 82, 36, 36, + /* 2710 */ 36, 36, 36, 109, 82, 109, 33, 442, 36, 444, + /* 2720 */ 36, 36, 22, 36, 82, 36, 36, 36, 36, 36, + /* 2730 */ 36, 36, 22, 382, 36, 0, 0, 36, 36, 0, + /* 2740 */ 54, 44, 489, 44, 36, 492, 0, 36, 397, 496, + /* 2750 */ 497, 498, 499, 500, 501, 382, 503, 54, 54, 44, + /* 2760 */ 54, 44, 0, 36, 489, 0, 22, 492, 382, 36, + /* 2770 */ 397, 496, 497, 498, 499, 500, 501, 426, 503, 0, + /* 2780 */ 22, 33, 22, 397, 21, 36, 36, 559, 22, 22, + /* 2790 */ 21, 20, 559, 442, 559, 444, 559, 559, 382, 426, + /* 2800 */ 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, + /* 2810 */ 559, 559, 426, 397, 559, 442, 559, 444, 559, 559, + /* 2820 */ 559, 559, 559, 559, 559, 559, 559, 559, 442, 559, + /* 2830 */ 444, 559, 559, 559, 559, 559, 559, 559, 559, 559, + /* 2840 */ 489, 559, 426, 492, 559, 559, 559, 496, 497, 498, + /* 2850 */ 499, 500, 501, 559, 503, 559, 559, 559, 442, 559, + /* 2860 */ 444, 559, 489, 559, 559, 492, 559, 559, 559, 496, + /* 2870 */ 497, 498, 499, 500, 501, 489, 503, 382, 492, 559, + /* 2880 */ 559, 559, 496, 497, 498, 499, 500, 501, 559, 503, + /* 2890 */ 559, 559, 397, 559, 382, 559, 559, 559, 559, 559, + /* 2900 */ 559, 559, 559, 559, 559, 489, 559, 559, 492, 397, + /* 2910 */ 559, 559, 496, 497, 498, 499, 500, 501, 559, 503, + /* 2920 */ 382, 426, 559, 559, 559, 559, 559, 559, 559, 559, + /* 2930 */ 559, 559, 559, 559, 559, 397, 559, 442, 426, 444, + /* 2940 */ 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, + /* 2950 */ 559, 559, 559, 559, 442, 559, 444, 559, 382, 559, + /* 2960 */ 559, 559, 559, 559, 426, 559, 559, 559, 559, 559, + /* 2970 */ 559, 559, 559, 397, 559, 559, 559, 559, 559, 559, + /* 2980 */ 442, 559, 444, 559, 489, 559, 559, 492, 559, 559, + /* 2990 */ 559, 496, 497, 498, 499, 500, 501, 559, 503, 559, + /* 3000 */ 559, 489, 426, 559, 492, 559, 559, 559, 496, 497, + /* 3010 */ 498, 499, 500, 501, 559, 503, 559, 559, 442, 559, + /* 3020 */ 444, 559, 559, 559, 559, 559, 559, 489, 559, 559, + /* 3030 */ 492, 559, 559, 559, 496, 497, 498, 499, 500, 501, + /* 3040 */ 382, 503, 559, 559, 559, 559, 559, 559, 559, 559, + /* 3050 */ 559, 559, 559, 559, 559, 397, 559, 559, 559, 559, + /* 3060 */ 559, 559, 559, 559, 559, 489, 559, 559, 492, 559, + /* 3070 */ 382, 559, 496, 497, 498, 499, 500, 501, 559, 503, + /* 3080 */ 559, 559, 559, 559, 426, 397, 559, 559, 559, 559, + /* 3090 */ 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, + /* 3100 */ 442, 559, 444, 559, 559, 559, 559, 559, 559, 559, + /* 3110 */ 559, 559, 559, 559, 426, 559, 559, 559, 559, 559, + /* 3120 */ 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, + /* 3130 */ 442, 559, 444, 559, 559, 559, 559, 559, 559, 559, + /* 3140 */ 559, 559, 559, 559, 559, 559, 559, 489, 559, 559, + /* 3150 */ 492, 559, 559, 559, 496, 497, 498, 499, 500, 501, + /* 3160 */ 559, 503, 559, 559, 559, 559, 559, 559, 559, 559, + /* 3170 */ 559, 559, 559, 559, 559, 559, 559, 489, 559, 559, + /* 3180 */ 492, 559, 559, 559, 496, 497, 498, 499, 500, 501, + /* 3190 */ 559, 503, 379, 379, 379, 379, 379, 379, 379, 379, + /* 3200 */ 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, + /* 3210 */ 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, + /* 3220 */ 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, + /* 3230 */ 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, + /* 3240 */ 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, + /* 3250 */ 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, + /* 3260 */ 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, + /* 3270 */ 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, + /* 3280 */ 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, + /* 3290 */ 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, + /* 3300 */ 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, + /* 3310 */ 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, + /* 3320 */ 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, + /* 3330 */ 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, + /* 3340 */ 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, + /* 3350 */ 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, + /* 3360 */ 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, + /* 3370 */ 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, + /* 3380 */ 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, + /* 3390 */ 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, + /* 3400 */ 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, + /* 3410 */ 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, + /* 3420 */ 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, + /* 3430 */ 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, + /* 3440 */ 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, + /* 3450 */ 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, + /* 3460 */ 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, + /* 3470 */ 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, + /* 3480 */ 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, + /* 3490 */ 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, + /* 3500 */ 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, + /* 3510 */ 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, + /* 3520 */ 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, + /* 3530 */ 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, + /* 3540 */ 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, + /* 3550 */ 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, + /* 3560 */ 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, + /* 3570 */ 379, }; #define YY_SHIFT_COUNT (978) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (2846) +#define YY_SHIFT_MAX (2779) static const unsigned short int yy_shift_ofst[] = { - /* 0 */ 347, 0, 83, 0, 346, 346, 346, 346, 346, 346, - /* 10 */ 346, 346, 346, 346, 346, 346, 429, 691, 691, 774, - /* 20 */ 691, 691, 691, 691, 691, 691, 691, 691, 691, 691, - /* 30 */ 691, 691, 691, 691, 691, 691, 691, 691, 691, 691, - /* 40 */ 691, 691, 691, 691, 691, 691, 691, 691, 691, 691, - /* 50 */ 102, 116, 534, 212, 408, 766, 408, 408, 212, 212, - /* 60 */ 408, 1175, 408, 950, 1175, 623, 408, 20, 1338, 432, - /* 70 */ 432, 214, 214, 1338, 1338, 459, 459, 432, 437, 437, - /* 80 */ 74, 3, 3, 50, 52, 214, 214, 214, 214, 214, - /* 90 */ 214, 214, 214, 214, 214, 214, 286, 407, 473, 214, - /* 100 */ 214, 37, 20, 214, 286, 214, 20, 214, 214, 214, - /* 110 */ 214, 20, 214, 214, 214, 20, 214, 20, 20, 20, - /* 120 */ 636, 39, 39, 523, 523, 1433, 647, 236, 489, 1038, - /* 130 */ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, - /* 140 */ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1222, 743, - /* 150 */ 437, 74, 1035, 1035, 790, 261, 261, 261, 632, 632, - /* 160 */ 496, 461, 790, 37, 20, 613, 20, 20, 483, 20, - /* 170 */ 20, 792, 20, 792, 792, 764, 1227, 523, 523, 523, - /* 180 */ 523, 523, 523, 1577, 302, 405, 563, 348, 348, 763, - /* 190 */ 599, 363, 330, 700, 122, 49, 747, 61, 61, 1086, - /* 200 */ 692, 901, 901, 901, 947, 901, 543, 1041, 1228, 1010, - /* 210 */ 1049, 452, 1051, 1166, 1166, 1172, 1320, 1320, 1103, 820, - /* 220 */ 981, 1166, 461, 1401, 1636, 1691, 1695, 1487, 37, 1695, - /* 230 */ 37, 1531, 1691, 1732, 1709, 1732, 1709, 1574, 1691, 1732, - /* 240 */ 1691, 1709, 1574, 1574, 1574, 1662, 1667, 1691, 1691, 1674, - /* 250 */ 1691, 1691, 1691, 1771, 1740, 1771, 1740, 1695, 37, 37, - /* 260 */ 1777, 37, 1785, 1788, 37, 1785, 37, 1802, 37, 1806, - /* 270 */ 37, 37, 1691, 37, 1771, 20, 20, 20, 20, 20, - /* 280 */ 20, 20, 20, 20, 20, 20, 1691, 1227, 1227, 1771, - /* 290 */ 792, 792, 792, 1637, 1765, 1695, 636, 1863, 1665, 1663, - /* 300 */ 1777, 636, 1401, 1691, 792, 1589, 1592, 1589, 1592, 1587, - /* 310 */ 1701, 1589, 1591, 1594, 1606, 1401, 1632, 1639, 1612, 1617, - /* 320 */ 1623, 1732, 1930, 1822, 1651, 1785, 636, 636, 1592, 792, - /* 330 */ 792, 792, 792, 1592, 792, 1776, 636, 792, 1806, 636, - /* 340 */ 1880, 792, 1800, 1806, 636, 764, 636, 1732, 792, 792, - /* 350 */ 792, 792, 792, 792, 792, 792, 792, 792, 792, 792, - /* 360 */ 792, 792, 792, 792, 792, 792, 792, 792, 792, 792, - /* 370 */ 1900, 792, 1691, 636, 1996, 1985, 2008, 2009, 1771, 3018, - /* 380 */ 3018, 3018, 3018, 3018, 3018, 3018, 3018, 3018, 3018, 3018, - /* 390 */ 3018, 1077, 867, 648, 1206, 887, 1005, 1043, 1214, 1350, - /* 400 */ 1692, 934, 1475, 1084, 1084, 1084, 1084, 1084, 1084, 1084, - /* 410 */ 1084, 1084, 183, 512, 220, 693, 702, 702, 4, 616, - /* 420 */ 811, 726, 542, 542, 145, 255, 542, 769, 683, 1209, - /* 430 */ 856, 141, 141, 113, 160, 738, 113, 113, 113, 91, - /* 440 */ 1241, 222, 925, 1301, 1019, 1249, 1388, 1272, 1287, 1291, - /* 450 */ 1310, 1347, 1418, 1425, 558, 1397, 1449, 1450, 1164, 1283, - /* 460 */ 1376, 1208, 1403, 1404, 1430, 1431, 1216, 1278, 1114, 1432, - /* 470 */ 1463, 1464, 1476, 1466, 770, 1468, 1402, 1477, 1478, 1479, - /* 480 */ 1497, 1498, 1501, 1520, 1526, 1530, 1538, 1546, 1573, 1579, - /* 490 */ 1590, 1604, 1615, 1565, 1567, 1586, 1603, 1613, 1624, 1366, - /* 500 */ 1473, 1369, 1458, 1508, 1598, 1547, 1440, 2090, 2091, 2092, - /* 510 */ 2047, 2095, 2061, 1855, 2063, 2070, 2072, 1868, 2112, 2077, - /* 520 */ 2078, 1872, 2080, 2117, 2118, 1876, 2120, 2085, 2122, 2087, - /* 530 */ 2124, 2104, 2127, 2093, 1890, 2131, 1910, 2135, 1912, 1918, - /* 540 */ 1927, 1932, 2146, 2149, 2150, 1939, 1941, 2153, 2155, 1998, - /* 550 */ 2106, 2107, 2160, 2125, 2162, 2163, 2128, 2111, 2166, 2116, - /* 560 */ 2168, 2126, 2169, 2171, 2175, 2129, 2177, 2178, 2179, 2181, - /* 570 */ 2182, 2183, 2010, 2148, 2185, 2011, 2188, 2189, 2190, 2191, - /* 580 */ 2193, 2195, 2198, 2199, 2200, 2201, 2202, 2204, 2205, 2206, - /* 590 */ 2207, 2208, 2209, 2210, 2212, 2213, 2164, 2214, 2187, 2218, - /* 600 */ 2222, 2230, 2232, 2235, 2236, 2237, 2241, 2244, 2233, 2252, - /* 610 */ 2096, 2257, 2102, 2261, 2108, 2262, 2263, 2243, 2216, 2248, - /* 620 */ 2219, 2279, 2220, 2281, 2223, 2250, 2282, 2224, 2284, 2225, - /* 630 */ 2290, 2294, 2259, 2242, 2253, 2298, 2264, 2245, 2258, 2301, - /* 640 */ 2268, 2254, 2274, 2319, 2285, 2320, 2275, 2283, 2292, 2272, - /* 650 */ 2277, 2312, 2278, 2331, 2291, 2299, 2335, 2345, 2346, 2347, - /* 660 */ 2304, 2142, 2354, 2272, 2300, 2356, 2272, 2306, 2358, 2367, - /* 670 */ 2296, 2368, 2370, 2337, 2321, 2330, 2376, 2341, 2324, 2336, - /* 680 */ 2381, 2348, 2329, 2352, 2392, 2359, 2343, 2355, 2398, 2401, - /* 690 */ 2402, 2403, 2404, 2405, 2288, 2295, 2371, 2384, 2408, 2387, - /* 700 */ 2375, 2378, 2379, 2385, 2386, 2395, 2397, 2399, 2406, 2407, - /* 710 */ 2410, 2412, 2413, 2415, 2414, 2420, 2416, 2434, 2417, 2441, - /* 720 */ 2422, 2390, 2452, 2431, 2419, 2454, 2456, 2458, 2423, 2462, - /* 730 */ 2427, 2470, 2436, 2473, 2453, 2461, 2438, 2440, 2442, 2369, - /* 740 */ 2372, 2483, 2293, 2255, 2260, 2374, 2267, 2272, 2443, 2491, - /* 750 */ 2314, 2457, 2486, 2505, 2297, 2487, 2317, 2313, 2511, 2513, - /* 760 */ 2322, 2315, 2326, 2318, 2514, 2489, 2226, 2424, 2409, 2425, - /* 770 */ 2421, 2484, 2492, 2426, 2471, 2432, 2495, 2445, 2433, 2526, - /* 780 */ 2527, 2446, 2448, 2449, 2450, 2451, 2528, 2497, 2517, 2455, - /* 790 */ 2533, 2265, 2490, 2459, 2538, 2464, 2537, 2465, 2466, 2574, - /* 800 */ 2547, 2280, 2549, 2550, 2551, 2552, 2554, 2555, 2467, 2478, - /* 810 */ 2544, 2316, 2572, 2556, 2606, 2608, 2494, 2566, 2496, 2498, - /* 820 */ 2500, 2501, 2429, 2503, 2611, 2569, 2439, 2619, 2504, 2508, - /* 830 */ 2430, 2590, 2460, 2603, 2524, 2366, 2530, 2642, 2623, 2396, - /* 840 */ 2531, 2534, 2536, 2539, 2541, 2542, 2543, 2545, 2598, 2548, - /* 850 */ 2553, 2601, 2557, 2631, 2411, 2559, 2560, 2659, 2561, 2563, - /* 860 */ 2469, 2616, 2564, 2567, 2669, 2648, 2558, 2565, 2272, 2621, - /* 870 */ 2568, 2571, 2582, 2575, 2585, 2576, 2679, 2681, 2683, 2475, - /* 880 */ 2591, 2645, 2672, 2595, 2597, 2678, 2600, 2609, 2686, 2536, - /* 890 */ 2610, 2688, 2539, 2612, 2694, 2541, 2615, 2697, 2542, 2599, - /* 900 */ 2602, 2613, 2617, 2625, 2705, 2634, 2716, 2640, 2705, 2705, - /* 910 */ 2734, 2682, 2684, 2735, 2724, 2725, 2726, 2727, 2728, 2729, - /* 920 */ 2730, 2731, 2732, 2733, 2737, 2689, 2661, 2693, 2670, 2745, - /* 930 */ 2744, 2753, 2754, 2769, 2757, 2759, 2760, 2715, 2407, 2764, - /* 940 */ 2410, 2766, 2767, 2768, 2775, 2791, 2779, 2817, 2783, 2770, - /* 950 */ 2776, 2821, 2786, 2771, 2782, 2823, 2792, 2773, 2785, 2830, - /* 960 */ 2795, 2781, 2793, 2836, 2802, 2840, 2819, 2808, 2845, 2832, - /* 970 */ 2822, 2816, 2820, 2835, 2837, 2838, 2841, 2843, 2846, + /* 0 */ 1317, 0, 263, 0, 527, 527, 527, 527, 527, 527, + /* 10 */ 527, 527, 527, 527, 527, 527, 790, 1053, 1053, 1316, + /* 20 */ 1053, 1053, 1053, 1053, 1053, 1053, 1053, 1053, 1053, 1053, + /* 30 */ 1053, 1053, 1053, 1053, 1053, 1053, 1053, 1053, 1053, 1053, + /* 40 */ 1053, 1053, 1053, 1053, 1053, 1053, 1053, 1053, 1053, 1053, + /* 50 */ 535, 793, 133, 427, 66, 97, 66, 66, 427, 427, + /* 60 */ 66, 1185, 66, 262, 1185, 163, 66, 64, 1428, 663, + /* 70 */ 663, 89, 89, 1428, 1428, 171, 171, 663, 319, 319, + /* 80 */ 588, 432, 432, 364, 54, 89, 89, 89, 89, 89, + /* 90 */ 89, 89, 89, 89, 89, 89, 297, 488, 525, 89, + /* 100 */ 89, 207, 64, 89, 297, 89, 64, 89, 89, 89, + /* 110 */ 89, 64, 89, 89, 89, 64, 89, 64, 64, 64, + /* 120 */ 734, 219, 219, 898, 898, 1146, 474, 14, 69, 630, + /* 130 */ 630, 630, 630, 630, 630, 630, 630, 630, 630, 630, + /* 140 */ 630, 630, 630, 630, 630, 630, 630, 630, 789, 316, + /* 150 */ 319, 588, 1144, 1144, 747, 218, 218, 218, 738, 738, + /* 160 */ 751, 502, 747, 207, 64, 688, 64, 64, 595, 64, + /* 170 */ 64, 818, 64, 818, 818, 806, 7, 898, 898, 898, + /* 180 */ 898, 898, 898, 1602, 284, 21, 57, 332, 332, 15, + /* 190 */ 408, 653, 60, 627, 81, 713, 724, 301, 301, 11, + /* 200 */ 744, 650, 650, 650, 943, 650, 878, 875, 1156, 1323, + /* 210 */ 1388, 1265, 1187, 830, 830, 1167, 563, 563, 961, 924, + /* 220 */ 1121, 830, 502, 1389, 1649, 1685, 1690, 1479, 207, 1690, + /* 230 */ 207, 1505, 1685, 1707, 1682, 1707, 1682, 1551, 1685, 1707, + /* 240 */ 1685, 1682, 1551, 1551, 1551, 1648, 1651, 1685, 1685, 1657, + /* 250 */ 1685, 1685, 1685, 1749, 1726, 1749, 1726, 1690, 207, 207, + /* 260 */ 1772, 207, 1773, 1786, 207, 1773, 207, 1804, 207, 1809, + /* 270 */ 207, 207, 1685, 207, 1749, 64, 64, 64, 64, 64, + /* 280 */ 64, 64, 64, 64, 64, 64, 1685, 7, 7, 1749, + /* 290 */ 818, 818, 818, 1604, 1740, 1690, 734, 1849, 1652, 1658, + /* 300 */ 1772, 734, 1389, 1685, 818, 1575, 1582, 1575, 1582, 1585, + /* 310 */ 1701, 1575, 1599, 1592, 1619, 1389, 1625, 1623, 1600, 1610, + /* 320 */ 1606, 1707, 1925, 1820, 1646, 1773, 734, 734, 1582, 818, + /* 330 */ 818, 818, 818, 1582, 818, 1774, 734, 818, 1809, 734, + /* 340 */ 1863, 818, 1789, 1809, 734, 806, 734, 1707, 818, 818, + /* 350 */ 818, 818, 818, 818, 818, 818, 818, 818, 818, 818, + /* 360 */ 818, 818, 818, 818, 818, 818, 818, 818, 818, 818, + /* 370 */ 1899, 818, 1685, 734, 1996, 1993, 1997, 1995, 1749, 3192, + /* 380 */ 3192, 3192, 3192, 3192, 3192, 3192, 3192, 3192, 3192, 3192, + /* 390 */ 3192, 39, 1851, 215, 339, 480, 701, 740, 313, 757, + /* 400 */ 390, 694, 827, 1090, 1090, 1090, 1090, 1090, 1090, 1090, + /* 410 */ 1090, 1090, 1114, 147, 410, 552, 1064, 1064, 493, 519, + /* 420 */ 421, 394, 254, 254, 601, 639, 667, 254, 994, 1158, + /* 430 */ 1220, 105, 105, 1277, 695, 1104, 1277, 1277, 1277, 676, + /* 440 */ 1175, 1362, 1046, 1386, 1255, 1394, 620, 1293, 1301, 1314, + /* 450 */ 1326, 1190, 1423, 1429, 1383, 1448, 1451, 1467, 1225, 1371, + /* 460 */ 1443, 1393, 1452, 1477, 1480, 1481, 1219, 1363, 1382, 1482, + /* 470 */ 1486, 1490, 1442, 1498, 692, 1502, 1426, 1478, 1503, 1507, + /* 480 */ 1509, 1512, 1508, 1516, 1539, 1579, 1587, 1617, 1620, 1622, + /* 490 */ 1624, 1626, 1629, 1529, 1572, 1574, 1591, 1630, 1631, 1373, + /* 500 */ 1607, 944, 1488, 1635, 1636, 1611, 387, 2059, 2068, 2070, + /* 510 */ 2027, 2079, 2044, 1837, 2046, 2047, 2048, 1841, 2086, 2051, + /* 520 */ 2052, 1846, 2056, 2093, 2095, 1852, 2098, 2063, 2100, 2071, + /* 530 */ 2110, 2089, 2112, 2077, 1875, 2115, 1892, 2117, 1894, 1895, + /* 540 */ 1901, 1905, 2122, 2123, 2125, 1915, 1917, 2129, 2130, 1973, + /* 550 */ 2081, 2082, 2134, 2099, 2137, 2138, 2104, 2088, 2149, 2101, + /* 560 */ 2154, 2108, 2156, 2157, 2158, 2109, 2159, 2161, 2162, 2163, + /* 570 */ 2164, 2165, 1991, 2132, 2172, 1998, 2173, 2175, 2176, 2177, + /* 580 */ 2178, 2179, 2180, 2181, 2182, 2183, 2184, 2185, 2187, 2191, + /* 590 */ 2192, 2193, 2196, 2197, 2198, 2199, 2150, 2200, 2142, 2202, + /* 600 */ 2203, 2204, 2206, 2207, 2208, 2209, 2210, 2212, 2195, 2214, + /* 610 */ 2057, 2218, 2064, 2220, 2066, 2229, 2231, 2215, 2186, 2217, + /* 620 */ 2194, 2232, 2188, 2248, 2205, 2219, 2251, 2211, 2257, 2213, + /* 630 */ 2259, 2260, 2226, 2221, 2233, 2263, 2228, 2222, 2234, 2280, + /* 640 */ 2246, 2230, 2241, 2287, 2256, 2289, 2243, 2247, 2261, 2242, + /* 650 */ 2244, 2239, 2245, 2254, 2267, 2255, 2298, 2301, 2302, 2313, + /* 660 */ 2270, 2111, 2316, 2242, 2266, 2319, 2242, 2269, 2321, 2322, + /* 670 */ 2250, 2323, 2324, 2291, 2274, 2285, 2330, 2299, 2282, 2290, + /* 680 */ 2337, 2303, 2284, 2296, 2341, 2306, 2292, 2300, 2343, 2345, + /* 690 */ 2347, 2349, 2355, 2356, 2227, 2235, 2315, 2335, 2359, 2338, + /* 700 */ 2325, 2326, 2327, 2328, 2329, 2331, 2333, 2339, 2340, 2344, + /* 710 */ 2346, 2348, 2358, 2352, 2360, 2366, 2361, 2371, 2369, 2380, + /* 720 */ 2377, 2317, 2382, 2378, 2365, 2410, 2411, 2412, 2383, 2414, + /* 730 */ 2385, 2418, 2387, 2422, 2394, 2413, 2398, 2399, 2400, 2314, + /* 740 */ 2334, 2438, 2249, 2216, 2223, 2342, 2225, 2242, 2388, 2440, + /* 750 */ 2268, 2405, 2421, 2444, 2237, 2424, 2271, 2276, 2450, 2452, + /* 760 */ 2272, 2277, 2273, 2278, 2451, 2426, 2174, 2362, 2367, 2363, + /* 770 */ 2368, 2446, 2449, 2372, 2434, 2375, 2437, 2379, 2381, 2429, + /* 780 */ 2458, 2389, 2384, 2391, 2401, 2397, 2460, 2445, 2447, 2402, + /* 790 */ 2462, 2224, 2419, 2403, 2471, 2406, 2479, 2407, 2408, 2522, + /* 800 */ 2493, 2236, 2491, 2492, 2494, 2496, 2497, 2498, 2415, 2420, + /* 810 */ 2484, 2265, 2505, 2489, 2543, 2544, 2430, 2511, 2441, 2442, + /* 820 */ 2448, 2454, 2364, 2455, 2556, 2515, 2390, 2561, 2464, 2463, + /* 830 */ 2392, 2518, 2396, 2531, 2468, 2307, 2472, 2585, 2567, 2350, + /* 840 */ 2476, 2477, 2480, 2482, 2483, 2485, 2486, 2478, 2548, 2487, + /* 850 */ 2490, 2553, 2500, 2584, 2353, 2502, 2503, 2607, 2504, 2506, + /* 860 */ 2417, 2564, 2507, 2508, 2610, 2589, 2501, 2509, 2242, 2572, + /* 870 */ 2513, 2519, 2510, 2527, 2529, 2520, 2605, 2608, 2623, 2423, + /* 880 */ 2532, 2611, 2613, 2536, 2537, 2618, 2540, 2542, 2620, 2480, + /* 890 */ 2545, 2624, 2482, 2547, 2628, 2483, 2549, 2638, 2485, 2539, + /* 900 */ 2546, 2554, 2557, 2560, 2644, 2565, 2646, 2569, 2644, 2644, + /* 910 */ 2671, 2622, 2621, 2677, 2664, 2666, 2667, 2668, 2669, 2670, + /* 920 */ 2672, 2673, 2674, 2675, 2676, 2625, 2604, 2632, 2606, 2683, + /* 930 */ 2682, 2684, 2685, 2700, 2687, 2689, 2690, 2642, 2344, 2691, + /* 940 */ 2346, 2692, 2693, 2694, 2695, 2710, 2698, 2735, 2701, 2686, + /* 950 */ 2697, 2736, 2702, 2703, 2699, 2739, 2708, 2704, 2715, 2746, + /* 960 */ 2711, 2706, 2717, 2762, 2727, 2765, 2744, 2733, 2779, 2758, + /* 970 */ 2748, 2749, 2750, 2760, 2763, 2766, 2767, 2769, 2771, }; #define YY_REDUCE_COUNT (390) -#define YY_REDUCE_MIN (-503) -#define YY_REDUCE_MAX (2515) +#define YY_REDUCE_MIN (-479) +#define YY_REDUCE_MAX (2688) static const short yy_reduce_ofst[] = { - /* 0 */ -239, -365, -325, -19, -202, 325, 366, 705, 810, 840, - /* 10 */ 960, 991, 1027, 1156, 1237, 1318, 1342, 1361, 1429, 1494, - /* 20 */ 1469, 1537, 1605, 1563, 1642, 1729, 1751, 1778, 1815, 1842, - /* 30 */ 1864, 1891, 1928, 1969, 2004, 2036, 2055, 2101, 2133, 2197, - /* 40 */ 2221, 2246, 2286, 2310, 2351, 2391, 2418, 2437, 2502, 2515, - /* 50 */ -310, -61, -464, -362, 865, 955, 1145, 1165, -297, -271, - /* 60 */ 1201, -412, -503, -384, -382, -82, 13, -393, -385, -436, - /* 70 */ -356, -210, -21, -389, -324, -388, -247, -439, -142, 115, - /* 80 */ 148, -198, -191, -359, 89, 173, 313, 345, 403, 409, - /* 90 */ 435, 433, 440, 454, 578, 492, -337, 387, -10, 445, - /* 100 */ 583, 472, 412, 601, 393, 614, 15, 653, 675, 794, - /* 110 */ 837, 349, 844, 851, 874, 31, 877, 111, 375, 365, - /* 120 */ 565, -501, -501, -66, -111, -223, 595, -100, 120, -231, - /* 130 */ -3, 548, 753, 814, 817, 834, 836, 839, 843, 861, - /* 140 */ 881, 904, 916, 932, 937, 948, 949, 974, -405, 530, - /* 150 */ 87, 372, 704, 741, 869, 530, 806, 876, 434, 499, - /* 160 */ 673, -224, 884, 228, 64, 893, -195, 547, 644, 863, - /* 170 */ 718, 939, 871, 941, 943, -48, 919, -425, -411, 935, - /* 180 */ 999, 1009, 1040, 1007, 1093, 1134, 1075, 1012, 1012, 993, - /* 190 */ 1008, 1032, 1033, 1236, 1012, 1212, 1212, 1226, 1238, 1245, - /* 200 */ 1195, 1105, 1115, 1116, 1197, 1117, 1212, 1211, 1268, 1182, - /* 210 */ 1276, 1233, 1203, 1229, 1231, 1212, 1147, 1151, 1136, 1173, - /* 220 */ 1158, 1234, 1281, 1242, 1219, 1321, 1247, 1240, 1317, 1252, - /* 230 */ 1337, 1274, 1352, 1359, 1308, 1364, 1312, 1316, 1370, 1372, - /* 240 */ 1371, 1319, 1323, 1324, 1326, 1368, 1373, 1384, 1386, 1381, - /* 250 */ 1393, 1394, 1395, 1405, 1406, 1407, 1408, 1315, 1392, 1399, - /* 260 */ 1356, 1415, 1410, 1343, 1417, 1414, 1419, 1374, 1420, 1375, - /* 270 */ 1424, 1443, 1441, 1444, 1447, 1426, 1428, 1437, 1439, 1442, - /* 280 */ 1446, 1448, 1451, 1452, 1453, 1454, 1460, 1482, 1484, 1481, - /* 290 */ 1445, 1455, 1456, 1398, 1411, 1409, 1480, 1413, 1422, 1427, - /* 300 */ 1457, 1491, 1421, 1500, 1465, 1377, 1461, 1378, 1462, 1367, - /* 310 */ 1382, 1379, 1396, 1412, 1400, 1470, 1416, 1423, 1383, 1391, - /* 320 */ 1459, 1550, 1467, 1438, 1483, 1555, 1551, 1552, 1495, 1514, - /* 330 */ 1517, 1522, 1532, 1511, 1533, 1518, 1575, 1540, 1525, 1585, - /* 340 */ 1485, 1557, 1545, 1553, 1608, 1584, 1609, 1618, 1576, 1578, - /* 350 */ 1580, 1581, 1583, 1588, 1599, 1600, 1601, 1602, 1611, 1614, - /* 360 */ 1616, 1625, 1627, 1628, 1630, 1631, 1633, 1634, 1635, 1638, - /* 370 */ 1596, 1640, 1621, 1629, 1644, 1658, 1660, 1661, 1668, 1582, - /* 380 */ 1646, 1593, 1597, 1620, 1622, 1669, 1670, 1659, 1671, 1675, - /* 390 */ 1685, + /* 0 */ 209, -338, 159, -30, 192, 379, 425, 455, 504, 685, + /* 10 */ 719, 983, 1112, 1234, 1276, 1361, 1312, 1003, 1399, 1441, + /* 20 */ 1483, 1566, 1605, 1647, 1727, 1744, 1769, 1808, 1889, 1906, + /* 30 */ 1928, 1971, 2011, 2050, 2076, 2140, 2170, 2189, 2253, 2275, + /* 40 */ 2351, 2373, 2386, 2416, 2495, 2512, 2538, 2576, 2658, 2688, + /* 50 */ -340, -324, -468, 94, -189, 468, 602, 604, 465, 717, + /* 60 */ 618, -337, 590, -159, 101, -136, 24, -140, -425, -167, + /* 70 */ 142, -381, -333, -389, -318, -385, -184, -357, -204, 353, + /* 80 */ 32, -199, 152, 349, -379, 422, 570, 691, 712, -395, + /* 90 */ -371, 721, 726, 763, 773, -247, 381, 413, -47, 794, + /* 100 */ 816, -103, 184, 834, 545, 850, -94, 852, 934, 937, + /* 110 */ 945, 261, 699, 948, 952, 462, 959, 766, 486, 657, + /* 120 */ 234, -479, -479, 140, -93, -419, -403, 175, 472, -269, + /* 130 */ 326, 378, 547, 567, 629, 856, 859, 861, 920, 927, + /* 140 */ 955, 957, 964, 969, 975, 976, 984, 988, -277, -295, + /* 150 */ 666, 155, 823, 894, 841, -295, 120, 371, 869, 870, + /* 160 */ 433, -323, 889, 157, 594, 774, 728, 783, -32, 490, + /* 170 */ -231, 44, 967, 467, 658, 925, 919, 523, 608, 683, + /* 180 */ 704, 714, 1036, 672, 583, 1091, 1051, 992, 992, 965, + /* 190 */ 987, 998, 1014, 1148, 992, 1124, 1124, 1140, 1142, 1163, + /* 200 */ 1107, 1027, 1050, 1105, 1184, 1108, 1124, 1198, 1254, 1169, + /* 210 */ 1260, 1221, 1186, 1215, 1223, 1124, 1145, 1153, 1125, 1168, + /* 220 */ 1151, 1231, 1271, 1222, 1213, 1315, 1232, 1229, 1310, 1237, + /* 230 */ 1319, 1251, 1329, 1331, 1285, 1342, 1289, 1294, 1349, 1353, + /* 240 */ 1355, 1302, 1307, 1309, 1311, 1351, 1356, 1367, 1370, 1364, + /* 250 */ 1374, 1384, 1387, 1395, 1392, 1400, 1401, 1308, 1377, 1390, + /* 260 */ 1354, 1413, 1402, 1350, 1414, 1424, 1416, 1366, 1425, 1376, + /* 270 */ 1427, 1430, 1432, 1431, 1444, 1408, 1411, 1418, 1419, 1420, + /* 280 */ 1421, 1422, 1437, 1440, 1446, 1447, 1453, 1454, 1455, 1462, + /* 290 */ 1410, 1412, 1435, 1372, 1396, 1404, 1465, 1391, 1405, 1417, + /* 300 */ 1450, 1484, 1434, 1485, 1459, 1352, 1445, 1368, 1449, 1369, + /* 310 */ 1378, 1375, 1385, 1398, 1397, 1457, 1403, 1409, 1406, 1407, + /* 320 */ 1415, 1546, 1458, 1436, 1460, 1552, 1549, 1554, 1487, 1518, + /* 330 */ 1519, 1520, 1525, 1496, 1526, 1515, 1568, 1534, 1522, 1586, + /* 340 */ 1472, 1548, 1537, 1540, 1593, 1576, 1594, 1597, 1557, 1558, + /* 350 */ 1559, 1561, 1562, 1563, 1564, 1565, 1567, 1569, 1570, 1571, + /* 360 */ 1573, 1577, 1578, 1580, 1581, 1583, 1584, 1588, 1596, 1598, + /* 370 */ 1590, 1601, 1621, 1613, 1640, 1654, 1645, 1655, 1650, 1589, + /* 380 */ 1608, 1560, 1595, 1609, 1614, 1633, 1634, 1632, 1659, 1638, + /* 390 */ 1674, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 10 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 20 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 30 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 40 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 50 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 60 */ 2578, 2203, 2203, 2534, 2203, 2203, 2203, 2203, 2203, 2203, - /* 70 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2541, 2541, - /* 80 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 90 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 100 */ 2203, 2309, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 110 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 120 */ 2307, 2830, 2203, 2956, 2619, 2203, 2203, 2859, 2203, 2203, - /* 130 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 140 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2842, - /* 150 */ 2203, 2203, 2280, 2280, 2203, 2842, 2842, 2842, 2802, 2802, - /* 160 */ 2307, 2203, 2203, 2309, 2203, 2621, 2203, 2203, 2203, 2203, - /* 170 */ 2203, 2203, 2203, 2203, 2203, 2450, 2233, 2203, 2203, 2203, - /* 180 */ 2203, 2203, 2203, 2604, 2203, 2203, 2888, 2834, 2835, 2950, - /* 190 */ 2203, 2891, 2853, 2203, 2848, 2203, 2203, 2203, 2203, 2203, - /* 200 */ 2878, 2203, 2203, 2203, 2203, 2203, 2203, 2546, 2203, 2647, - /* 210 */ 2203, 2395, 2598, 2203, 2203, 2203, 2203, 2203, 2934, 2832, - /* 220 */ 2872, 2203, 2203, 2882, 2203, 2203, 2203, 2635, 2309, 2203, - /* 230 */ 2309, 2591, 2529, 2203, 2539, 2203, 2539, 2536, 2203, 2203, - /* 240 */ 2203, 2539, 2536, 2536, 2536, 2383, 2379, 2203, 2203, 2377, - /* 250 */ 2203, 2203, 2203, 2203, 2263, 2203, 2263, 2203, 2309, 2309, - /* 260 */ 2203, 2309, 2203, 2203, 2309, 2203, 2309, 2203, 2309, 2203, - /* 270 */ 2309, 2309, 2203, 2309, 2203, 2203, 2203, 2203, 2203, 2203, - /* 280 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 290 */ 2203, 2203, 2203, 2633, 2614, 2203, 2307, 2203, 2602, 2600, - /* 300 */ 2203, 2307, 2882, 2203, 2203, 2904, 2899, 2904, 2899, 2918, - /* 310 */ 2914, 2904, 2923, 2920, 2884, 2882, 2865, 2861, 2953, 2940, - /* 320 */ 2936, 2203, 2203, 2870, 2868, 2203, 2307, 2307, 2899, 2203, - /* 330 */ 2203, 2203, 2203, 2899, 2203, 2203, 2307, 2203, 2203, 2307, - /* 340 */ 2203, 2203, 2203, 2203, 2307, 2203, 2307, 2203, 2203, 2203, - /* 350 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 360 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 370 */ 2412, 2203, 2203, 2307, 2203, 2235, 2237, 2247, 2203, 2593, - /* 380 */ 2956, 2619, 2624, 2574, 2574, 2453, 2453, 2956, 2453, 2310, - /* 390 */ 2208, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 400 */ 2203, 2203, 2203, 2917, 2916, 2753, 2203, 2806, 2805, 2804, - /* 410 */ 2795, 2752, 2408, 2203, 2203, 2203, 2751, 2750, 2203, 2203, - /* 420 */ 2203, 2203, 2399, 2396, 2203, 2203, 2421, 2203, 2203, 2203, - /* 430 */ 2203, 2565, 2564, 2744, 2203, 2203, 2745, 2743, 2742, 2203, - /* 440 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 450 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 460 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2937, 2941, 2203, - /* 470 */ 2203, 2203, 2831, 2203, 2203, 2203, 2723, 2203, 2203, 2203, - /* 480 */ 2203, 2203, 2691, 2686, 2677, 2668, 2683, 2674, 2662, 2680, - /* 490 */ 2671, 2659, 2656, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 500 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 510 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 520 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 530 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 540 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2535, - /* 550 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 560 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 570 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 580 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 590 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 600 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 610 */ 2203, 2203, 2203, 2203, 2550, 2203, 2203, 2203, 2203, 2203, - /* 620 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 630 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 640 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2252, 2730, - /* 650 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 660 */ 2203, 2203, 2203, 2733, 2203, 2203, 2734, 2203, 2203, 2203, - /* 670 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 680 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 690 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 700 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2354, - /* 710 */ 2353, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 720 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 730 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2735, - /* 740 */ 2203, 2203, 2203, 2203, 2618, 2203, 2203, 2725, 2203, 2203, - /* 750 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 760 */ 2203, 2203, 2203, 2203, 2933, 2885, 2203, 2203, 2203, 2203, - /* 770 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 780 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2723, 2203, - /* 790 */ 2915, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2931, 2203, - /* 800 */ 2935, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2841, 2837, - /* 810 */ 2203, 2203, 2833, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 820 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 830 */ 2203, 2203, 2203, 2792, 2203, 2203, 2203, 2826, 2203, 2203, - /* 840 */ 2203, 2203, 2449, 2448, 2447, 2446, 2203, 2203, 2203, 2203, - /* 850 */ 2203, 2203, 2735, 2203, 2738, 2203, 2203, 2203, 2203, 2203, - /* 860 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2722, 2203, - /* 870 */ 2777, 2776, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 880 */ 2203, 2203, 2203, 2443, 2203, 2203, 2203, 2203, 2203, 2203, - /* 890 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2427, - /* 900 */ 2425, 2424, 2423, 2203, 2460, 2203, 2203, 2203, 2456, 2455, - /* 910 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 920 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2328, - /* 930 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2320, 2203, - /* 940 */ 2319, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 950 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 960 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 970 */ 2232, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, + /* 0 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 10 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 20 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 30 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 40 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 50 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 60 */ 2580, 2205, 2205, 2536, 2205, 2205, 2205, 2205, 2205, 2205, + /* 70 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2543, 2543, + /* 80 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 90 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 100 */ 2205, 2311, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 110 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 120 */ 2309, 2833, 2205, 2959, 2621, 2205, 2205, 2862, 2205, 2205, + /* 130 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 140 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2845, + /* 150 */ 2205, 2205, 2282, 2282, 2205, 2845, 2845, 2845, 2805, 2805, + /* 160 */ 2309, 2205, 2205, 2311, 2205, 2623, 2205, 2205, 2205, 2205, + /* 170 */ 2205, 2205, 2205, 2205, 2205, 2452, 2235, 2205, 2205, 2205, + /* 180 */ 2205, 2205, 2205, 2606, 2205, 2205, 2891, 2837, 2838, 2953, + /* 190 */ 2205, 2894, 2856, 2205, 2851, 2205, 2205, 2205, 2205, 2205, + /* 200 */ 2881, 2205, 2205, 2205, 2205, 2205, 2205, 2548, 2205, 2650, + /* 210 */ 2205, 2397, 2600, 2205, 2205, 2205, 2205, 2205, 2937, 2835, + /* 220 */ 2875, 2205, 2205, 2885, 2205, 2205, 2205, 2638, 2311, 2205, + /* 230 */ 2311, 2593, 2531, 2205, 2541, 2205, 2541, 2538, 2205, 2205, + /* 240 */ 2205, 2541, 2538, 2538, 2538, 2385, 2381, 2205, 2205, 2379, + /* 250 */ 2205, 2205, 2205, 2205, 2265, 2205, 2265, 2205, 2311, 2311, + /* 260 */ 2205, 2311, 2205, 2205, 2311, 2205, 2311, 2205, 2311, 2205, + /* 270 */ 2311, 2311, 2205, 2311, 2205, 2205, 2205, 2205, 2205, 2205, + /* 280 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 290 */ 2205, 2205, 2205, 2636, 2616, 2205, 2309, 2205, 2604, 2602, + /* 300 */ 2205, 2309, 2885, 2205, 2205, 2907, 2902, 2907, 2902, 2921, + /* 310 */ 2917, 2907, 2926, 2923, 2887, 2885, 2868, 2864, 2956, 2943, + /* 320 */ 2939, 2205, 2205, 2873, 2871, 2205, 2309, 2309, 2902, 2205, + /* 330 */ 2205, 2205, 2205, 2902, 2205, 2205, 2309, 2205, 2205, 2309, + /* 340 */ 2205, 2205, 2205, 2205, 2309, 2205, 2309, 2205, 2205, 2205, + /* 350 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 360 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 370 */ 2414, 2205, 2205, 2309, 2205, 2237, 2239, 2249, 2205, 2595, + /* 380 */ 2959, 2621, 2626, 2576, 2576, 2455, 2455, 2959, 2455, 2312, + /* 390 */ 2210, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 400 */ 2205, 2205, 2205, 2920, 2919, 2756, 2205, 2809, 2808, 2807, + /* 410 */ 2798, 2755, 2410, 2205, 2205, 2205, 2754, 2753, 2205, 2205, + /* 420 */ 2205, 2205, 2401, 2398, 2205, 2205, 2205, 2423, 2205, 2205, + /* 430 */ 2205, 2567, 2566, 2747, 2205, 2205, 2748, 2746, 2745, 2205, + /* 440 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 450 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 460 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2940, 2944, 2205, + /* 470 */ 2205, 2205, 2834, 2205, 2205, 2205, 2726, 2205, 2205, 2205, + /* 480 */ 2205, 2205, 2694, 2689, 2680, 2671, 2686, 2677, 2665, 2683, + /* 490 */ 2674, 2662, 2659, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 500 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 510 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 520 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 530 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 540 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2537, + /* 550 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 560 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 570 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 580 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 590 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 600 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 610 */ 2205, 2205, 2205, 2205, 2552, 2205, 2205, 2205, 2205, 2205, + /* 620 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 630 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 640 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2254, 2733, + /* 650 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 660 */ 2205, 2205, 2205, 2736, 2205, 2205, 2737, 2205, 2205, 2205, + /* 670 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 680 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 690 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 700 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2356, + /* 710 */ 2355, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 720 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 730 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2738, + /* 740 */ 2205, 2205, 2205, 2205, 2620, 2205, 2205, 2728, 2205, 2205, + /* 750 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 760 */ 2205, 2205, 2205, 2205, 2936, 2888, 2205, 2205, 2205, 2205, + /* 770 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 780 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2726, 2205, + /* 790 */ 2918, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2934, 2205, + /* 800 */ 2938, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2844, 2840, + /* 810 */ 2205, 2205, 2836, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 820 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 830 */ 2205, 2205, 2205, 2795, 2205, 2205, 2205, 2829, 2205, 2205, + /* 840 */ 2205, 2205, 2451, 2450, 2449, 2448, 2205, 2205, 2205, 2205, + /* 850 */ 2205, 2205, 2738, 2205, 2741, 2205, 2205, 2205, 2205, 2205, + /* 860 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2725, 2205, + /* 870 */ 2780, 2779, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 880 */ 2205, 2205, 2205, 2445, 2205, 2205, 2205, 2205, 2205, 2205, + /* 890 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2429, + /* 900 */ 2427, 2426, 2425, 2205, 2462, 2205, 2205, 2205, 2458, 2457, + /* 910 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 920 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2330, + /* 930 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2322, 2205, + /* 940 */ 2321, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 950 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 960 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 970 */ 2234, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, }; /********** End of lemon-generated parsing tables *****************************/ @@ -1626,12 +1660,12 @@ static const YYCODETYPE yyFallback[] = { 0, /* BWLIMIT => nothing */ 0, /* START => nothing */ 0, /* TIMESTAMP => nothing */ - 328, /* END => ABORT */ + 329, /* END => ABORT */ 0, /* TABLE => nothing */ 0, /* NK_LP => nothing */ 0, /* NK_RP => nothing */ 0, /* USING => nothing */ - 328, /* FILE => ABORT */ + 329, /* FILE => ABORT */ 0, /* STABLE => nothing */ 0, /* COLUMN => nothing */ 0, /* MODIFY => nothing */ @@ -1699,7 +1733,7 @@ static const YYCODETYPE yyFallback[] = { 0, /* VNODES => nothing */ 0, /* ALIVE => nothing */ 0, /* VIEWS => nothing */ - 328, /* VIEW => ABORT */ + 329, /* VIEW => ABORT */ 0, /* COMPACTS => nothing */ 0, /* NORMAL => nothing */ 0, /* CHILD => nothing */ @@ -1742,10 +1776,11 @@ static const YYCODETYPE yyFallback[] = { 0, /* PAUSE => nothing */ 0, /* RESUME => nothing */ 0, /* PRIMARY => nothing */ - 328, /* KEY => ABORT */ + 329, /* KEY => ABORT */ 0, /* TRIGGER => nothing */ 0, /* AT_ONCE => nothing */ 0, /* WINDOW_CLOSE => nothing */ + 0, /* FORCE_WINDOW_CLOSE => nothing */ 0, /* IGNORE => nothing */ 0, /* EXPIRED => nothing */ 0, /* FILL_HISTORY => nothing */ @@ -1806,7 +1841,7 @@ static const YYCODETYPE yyFallback[] = { 0, /* LEFT => nothing */ 0, /* RIGHT => nothing */ 0, /* OUTER => nothing */ - 328, /* SEMI => ABORT */ + 329, /* SEMI => ABORT */ 0, /* ANTI => nothing */ 0, /* ASOF => nothing */ 0, /* WINDOW => nothing */ @@ -1842,52 +1877,52 @@ static const YYCODETYPE yyFallback[] = { 0, /* ASC => nothing */ 0, /* NULLS => nothing */ 0, /* ABORT => nothing */ - 328, /* AFTER => ABORT */ - 328, /* ATTACH => ABORT */ - 328, /* BEFORE => ABORT */ - 328, /* BEGIN => ABORT */ - 328, /* BITAND => ABORT */ - 328, /* BITNOT => ABORT */ - 328, /* BITOR => ABORT */ - 328, /* BLOCKS => ABORT */ - 328, /* CHANGE => ABORT */ - 328, /* COMMA => ABORT */ - 328, /* CONCAT => ABORT */ - 328, /* CONFLICT => ABORT */ - 328, /* COPY => ABORT */ - 328, /* DEFERRED => ABORT */ - 328, /* DELIMITERS => ABORT */ - 328, /* DETACH => ABORT */ - 328, /* DIVIDE => ABORT */ - 328, /* DOT => ABORT */ - 328, /* EACH => ABORT */ - 328, /* FAIL => ABORT */ - 328, /* FOR => ABORT */ - 328, /* GLOB => ABORT */ - 328, /* ID => ABORT */ - 328, /* IMMEDIATE => ABORT */ - 328, /* IMPORT => ABORT */ - 328, /* INITIALLY => ABORT */ - 328, /* INSTEAD => ABORT */ - 328, /* ISNULL => ABORT */ - 328, /* MODULES => ABORT */ - 328, /* NK_BITNOT => ABORT */ - 328, /* NK_SEMI => ABORT */ - 328, /* NOTNULL => ABORT */ - 328, /* OF => ABORT */ - 328, /* PLUS => ABORT */ - 328, /* PRIVILEGE => ABORT */ - 328, /* RAISE => ABORT */ - 328, /* RESTRICT => ABORT */ - 328, /* ROW => ABORT */ - 328, /* STAR => ABORT */ - 328, /* STATEMENT => ABORT */ - 328, /* STRICT => ABORT */ - 328, /* STRING => ABORT */ - 328, /* TIMES => ABORT */ - 328, /* VALUES => ABORT */ - 328, /* VARIABLE => ABORT */ - 328, /* WAL => ABORT */ + 329, /* AFTER => ABORT */ + 329, /* ATTACH => ABORT */ + 329, /* BEFORE => ABORT */ + 329, /* BEGIN => ABORT */ + 329, /* BITAND => ABORT */ + 329, /* BITNOT => ABORT */ + 329, /* BITOR => ABORT */ + 329, /* BLOCKS => ABORT */ + 329, /* CHANGE => ABORT */ + 329, /* COMMA => ABORT */ + 329, /* CONCAT => ABORT */ + 329, /* CONFLICT => ABORT */ + 329, /* COPY => ABORT */ + 329, /* DEFERRED => ABORT */ + 329, /* DELIMITERS => ABORT */ + 329, /* DETACH => ABORT */ + 329, /* DIVIDE => ABORT */ + 329, /* DOT => ABORT */ + 329, /* EACH => ABORT */ + 329, /* FAIL => ABORT */ + 329, /* FOR => ABORT */ + 329, /* GLOB => ABORT */ + 329, /* ID => ABORT */ + 329, /* IMMEDIATE => ABORT */ + 329, /* IMPORT => ABORT */ + 329, /* INITIALLY => ABORT */ + 329, /* INSTEAD => ABORT */ + 329, /* ISNULL => ABORT */ + 329, /* MODULES => ABORT */ + 329, /* NK_BITNOT => ABORT */ + 329, /* NK_SEMI => ABORT */ + 329, /* NOTNULL => ABORT */ + 329, /* OF => ABORT */ + 329, /* PLUS => ABORT */ + 329, /* PRIVILEGE => ABORT */ + 329, /* RAISE => ABORT */ + 329, /* RESTRICT => ABORT */ + 329, /* ROW => ABORT */ + 329, /* STAR => ABORT */ + 329, /* STATEMENT => ABORT */ + 329, /* STRICT => ABORT */ + 329, /* STRING => ABORT */ + 329, /* TIMES => ABORT */ + 329, /* VALUES => ABORT */ + 329, /* VARIABLE => ABORT */ + 329, /* WAL => ABORT */ 0, /* ENCODE => nothing */ 0, /* COMPRESS => nothing */ 0, /* LEVEL => nothing */ @@ -2212,331 +2247,332 @@ static const char *const yyTokenName[] = { /* 230 */ "TRIGGER", /* 231 */ "AT_ONCE", /* 232 */ "WINDOW_CLOSE", - /* 233 */ "IGNORE", - /* 234 */ "EXPIRED", - /* 235 */ "FILL_HISTORY", - /* 236 */ "UPDATE", - /* 237 */ "SUBTABLE", - /* 238 */ "UNTREATED", - /* 239 */ "KILL", - /* 240 */ "CONNECTION", - /* 241 */ "TRANSACTION", - /* 242 */ "BALANCE", - /* 243 */ "VGROUP", - /* 244 */ "LEADER", - /* 245 */ "MERGE", - /* 246 */ "REDISTRIBUTE", - /* 247 */ "SPLIT", - /* 248 */ "DELETE", - /* 249 */ "INSERT", - /* 250 */ "NK_BIN", - /* 251 */ "NK_HEX", - /* 252 */ "NULL", - /* 253 */ "NK_QUESTION", - /* 254 */ "NK_ALIAS", - /* 255 */ "NK_ARROW", - /* 256 */ "ROWTS", - /* 257 */ "QSTART", - /* 258 */ "QEND", - /* 259 */ "QDURATION", - /* 260 */ "WSTART", - /* 261 */ "WEND", - /* 262 */ "WDURATION", - /* 263 */ "IROWTS", - /* 264 */ "ISFILLED", - /* 265 */ "CAST", - /* 266 */ "NOW", - /* 267 */ "TODAY", - /* 268 */ "TIMEZONE", - /* 269 */ "CLIENT_VERSION", - /* 270 */ "SERVER_VERSION", - /* 271 */ "SERVER_STATUS", - /* 272 */ "CURRENT_USER", - /* 273 */ "CASE", - /* 274 */ "WHEN", - /* 275 */ "THEN", - /* 276 */ "ELSE", - /* 277 */ "BETWEEN", - /* 278 */ "IS", - /* 279 */ "NK_LT", - /* 280 */ "NK_GT", - /* 281 */ "NK_LE", - /* 282 */ "NK_GE", - /* 283 */ "NK_NE", - /* 284 */ "MATCH", - /* 285 */ "NMATCH", - /* 286 */ "CONTAINS", - /* 287 */ "IN", - /* 288 */ "JOIN", - /* 289 */ "INNER", - /* 290 */ "LEFT", - /* 291 */ "RIGHT", - /* 292 */ "OUTER", - /* 293 */ "SEMI", - /* 294 */ "ANTI", - /* 295 */ "ASOF", - /* 296 */ "WINDOW", - /* 297 */ "WINDOW_OFFSET", - /* 298 */ "JLIMIT", - /* 299 */ "SELECT", - /* 300 */ "NK_HINT", - /* 301 */ "DISTINCT", - /* 302 */ "WHERE", - /* 303 */ "PARTITION", - /* 304 */ "BY", - /* 305 */ "SESSION", - /* 306 */ "STATE_WINDOW", - /* 307 */ "EVENT_WINDOW", - /* 308 */ "COUNT_WINDOW", - /* 309 */ "SLIDING", - /* 310 */ "FILL", - /* 311 */ "VALUE", - /* 312 */ "VALUE_F", - /* 313 */ "NONE", - /* 314 */ "PREV", - /* 315 */ "NULL_F", - /* 316 */ "LINEAR", - /* 317 */ "NEXT", - /* 318 */ "HAVING", - /* 319 */ "RANGE", - /* 320 */ "EVERY", - /* 321 */ "ORDER", - /* 322 */ "SLIMIT", - /* 323 */ "SOFFSET", - /* 324 */ "LIMIT", - /* 325 */ "OFFSET", - /* 326 */ "ASC", - /* 327 */ "NULLS", - /* 328 */ "ABORT", - /* 329 */ "AFTER", - /* 330 */ "ATTACH", - /* 331 */ "BEFORE", - /* 332 */ "BEGIN", - /* 333 */ "BITAND", - /* 334 */ "BITNOT", - /* 335 */ "BITOR", - /* 336 */ "BLOCKS", - /* 337 */ "CHANGE", - /* 338 */ "COMMA", - /* 339 */ "CONCAT", - /* 340 */ "CONFLICT", - /* 341 */ "COPY", - /* 342 */ "DEFERRED", - /* 343 */ "DELIMITERS", - /* 344 */ "DETACH", - /* 345 */ "DIVIDE", - /* 346 */ "DOT", - /* 347 */ "EACH", - /* 348 */ "FAIL", - /* 349 */ "FOR", - /* 350 */ "GLOB", - /* 351 */ "ID", - /* 352 */ "IMMEDIATE", - /* 353 */ "IMPORT", - /* 354 */ "INITIALLY", - /* 355 */ "INSTEAD", - /* 356 */ "ISNULL", - /* 357 */ "MODULES", - /* 358 */ "NK_BITNOT", - /* 359 */ "NK_SEMI", - /* 360 */ "NOTNULL", - /* 361 */ "OF", - /* 362 */ "PLUS", - /* 363 */ "PRIVILEGE", - /* 364 */ "RAISE", - /* 365 */ "RESTRICT", - /* 366 */ "ROW", - /* 367 */ "STAR", - /* 368 */ "STATEMENT", - /* 369 */ "STRICT", - /* 370 */ "STRING", - /* 371 */ "TIMES", - /* 372 */ "VALUES", - /* 373 */ "VARIABLE", - /* 374 */ "WAL", - /* 375 */ "ENCODE", - /* 376 */ "COMPRESS", - /* 377 */ "LEVEL", - /* 378 */ "cmd", - /* 379 */ "account_options", - /* 380 */ "alter_account_options", - /* 381 */ "literal", - /* 382 */ "alter_account_option", - /* 383 */ "ip_range_list", - /* 384 */ "white_list", - /* 385 */ "white_list_opt", - /* 386 */ "is_import_opt", - /* 387 */ "is_createdb_opt", - /* 388 */ "user_name", - /* 389 */ "sysinfo_opt", - /* 390 */ "privileges", - /* 391 */ "priv_level", - /* 392 */ "with_opt", - /* 393 */ "priv_type_list", - /* 394 */ "priv_type", - /* 395 */ "db_name", - /* 396 */ "table_name", - /* 397 */ "topic_name", - /* 398 */ "search_condition", - /* 399 */ "dnode_endpoint", - /* 400 */ "force_opt", - /* 401 */ "unsafe_opt", - /* 402 */ "not_exists_opt", - /* 403 */ "db_options", - /* 404 */ "exists_opt", - /* 405 */ "alter_db_options", - /* 406 */ "speed_opt", - /* 407 */ "start_opt", - /* 408 */ "end_opt", - /* 409 */ "integer_list", - /* 410 */ "variable_list", - /* 411 */ "retention_list", - /* 412 */ "signed", - /* 413 */ "alter_db_option", - /* 414 */ "retention", - /* 415 */ "full_table_name", - /* 416 */ "column_def_list", - /* 417 */ "tags_def_opt", - /* 418 */ "table_options", - /* 419 */ "multi_create_clause", - /* 420 */ "tag_list_opt", - /* 421 */ "tags_def", - /* 422 */ "multi_drop_clause", - /* 423 */ "alter_table_clause", - /* 424 */ "alter_table_options", - /* 425 */ "column_name", - /* 426 */ "type_name", - /* 427 */ "column_options", - /* 428 */ "tags_literal", - /* 429 */ "create_subtable_clause", - /* 430 */ "specific_cols_opt", - /* 431 */ "tags_literal_list", - /* 432 */ "drop_table_clause", - /* 433 */ "col_name_list", - /* 434 */ "tag_def_list", - /* 435 */ "tag_def", - /* 436 */ "column_def", - /* 437 */ "type_name_default_len", - /* 438 */ "duration_list", - /* 439 */ "rollup_func_list", - /* 440 */ "alter_table_option", - /* 441 */ "duration_literal", - /* 442 */ "rollup_func_name", - /* 443 */ "function_name", - /* 444 */ "col_name", - /* 445 */ "db_kind_opt", - /* 446 */ "table_kind_db_name_cond_opt", - /* 447 */ "like_pattern_opt", - /* 448 */ "db_name_cond_opt", - /* 449 */ "table_name_cond", - /* 450 */ "from_db_opt", - /* 451 */ "table_kind", - /* 452 */ "tag_item", - /* 453 */ "column_alias", - /* 454 */ "tsma_name", - /* 455 */ "tsma_func_list", - /* 456 */ "full_tsma_name", - /* 457 */ "func_list", - /* 458 */ "index_options", - /* 459 */ "full_index_name", - /* 460 */ "index_name", - /* 461 */ "sliding_opt", - /* 462 */ "sma_stream_opt", - /* 463 */ "func", - /* 464 */ "sma_func_name", - /* 465 */ "expression_list", - /* 466 */ "with_meta", - /* 467 */ "query_or_subquery", - /* 468 */ "where_clause_opt", - /* 469 */ "cgroup_name", - /* 470 */ "analyze_opt", - /* 471 */ "explain_options", - /* 472 */ "insert_query", - /* 473 */ "or_replace_opt", - /* 474 */ "agg_func_opt", - /* 475 */ "bufsize_opt", - /* 476 */ "language_opt", - /* 477 */ "full_view_name", - /* 478 */ "view_name", - /* 479 */ "stream_name", - /* 480 */ "stream_options", - /* 481 */ "col_list_opt", - /* 482 */ "tag_def_or_ref_opt", - /* 483 */ "subtable_opt", - /* 484 */ "ignore_opt", - /* 485 */ "column_stream_def_list", - /* 486 */ "column_stream_def", - /* 487 */ "stream_col_options", - /* 488 */ "expression", - /* 489 */ "on_vgroup_id", - /* 490 */ "dnode_list", - /* 491 */ "literal_func", - /* 492 */ "signed_literal", - /* 493 */ "literal_list", - /* 494 */ "table_alias", - /* 495 */ "expr_or_subquery", - /* 496 */ "pseudo_column", - /* 497 */ "column_reference", - /* 498 */ "function_expression", - /* 499 */ "case_when_expression", - /* 500 */ "star_func", - /* 501 */ "star_func_para_list", - /* 502 */ "noarg_func", - /* 503 */ "other_para_list", - /* 504 */ "star_func_para", - /* 505 */ "when_then_list", - /* 506 */ "case_when_else_opt", - /* 507 */ "common_expression", - /* 508 */ "when_then_expr", - /* 509 */ "predicate", - /* 510 */ "compare_op", - /* 511 */ "in_op", - /* 512 */ "in_predicate_value", - /* 513 */ "boolean_value_expression", - /* 514 */ "boolean_primary", - /* 515 */ "from_clause_opt", - /* 516 */ "table_reference_list", - /* 517 */ "table_reference", - /* 518 */ "table_primary", - /* 519 */ "joined_table", - /* 520 */ "alias_opt", - /* 521 */ "subquery", - /* 522 */ "parenthesized_joined_table", - /* 523 */ "join_type", - /* 524 */ "join_subtype", - /* 525 */ "join_on_clause_opt", - /* 526 */ "window_offset_clause_opt", - /* 527 */ "jlimit_clause_opt", - /* 528 */ "window_offset_literal", - /* 529 */ "query_specification", - /* 530 */ "hint_list", - /* 531 */ "set_quantifier_opt", - /* 532 */ "tag_mode_opt", - /* 533 */ "select_list", - /* 534 */ "partition_by_clause_opt", - /* 535 */ "range_opt", - /* 536 */ "every_opt", - /* 537 */ "fill_opt", - /* 538 */ "twindow_clause_opt", - /* 539 */ "group_by_clause_opt", - /* 540 */ "having_clause_opt", - /* 541 */ "select_item", - /* 542 */ "partition_list", - /* 543 */ "partition_item", - /* 544 */ "interval_sliding_duration_literal", - /* 545 */ "fill_mode", - /* 546 */ "group_by_list", - /* 547 */ "query_expression", - /* 548 */ "query_simple", - /* 549 */ "order_by_clause_opt", - /* 550 */ "slimit_clause_opt", - /* 551 */ "limit_clause_opt", - /* 552 */ "union_query_expression", - /* 553 */ "query_simple_or_subquery", - /* 554 */ "sort_specification_list", - /* 555 */ "sort_specification", - /* 556 */ "ordering_specification_opt", - /* 557 */ "null_ordering_opt", + /* 233 */ "FORCE_WINDOW_CLOSE", + /* 234 */ "IGNORE", + /* 235 */ "EXPIRED", + /* 236 */ "FILL_HISTORY", + /* 237 */ "UPDATE", + /* 238 */ "SUBTABLE", + /* 239 */ "UNTREATED", + /* 240 */ "KILL", + /* 241 */ "CONNECTION", + /* 242 */ "TRANSACTION", + /* 243 */ "BALANCE", + /* 244 */ "VGROUP", + /* 245 */ "LEADER", + /* 246 */ "MERGE", + /* 247 */ "REDISTRIBUTE", + /* 248 */ "SPLIT", + /* 249 */ "DELETE", + /* 250 */ "INSERT", + /* 251 */ "NK_BIN", + /* 252 */ "NK_HEX", + /* 253 */ "NULL", + /* 254 */ "NK_QUESTION", + /* 255 */ "NK_ALIAS", + /* 256 */ "NK_ARROW", + /* 257 */ "ROWTS", + /* 258 */ "QSTART", + /* 259 */ "QEND", + /* 260 */ "QDURATION", + /* 261 */ "WSTART", + /* 262 */ "WEND", + /* 263 */ "WDURATION", + /* 264 */ "IROWTS", + /* 265 */ "ISFILLED", + /* 266 */ "CAST", + /* 267 */ "NOW", + /* 268 */ "TODAY", + /* 269 */ "TIMEZONE", + /* 270 */ "CLIENT_VERSION", + /* 271 */ "SERVER_VERSION", + /* 272 */ "SERVER_STATUS", + /* 273 */ "CURRENT_USER", + /* 274 */ "CASE", + /* 275 */ "WHEN", + /* 276 */ "THEN", + /* 277 */ "ELSE", + /* 278 */ "BETWEEN", + /* 279 */ "IS", + /* 280 */ "NK_LT", + /* 281 */ "NK_GT", + /* 282 */ "NK_LE", + /* 283 */ "NK_GE", + /* 284 */ "NK_NE", + /* 285 */ "MATCH", + /* 286 */ "NMATCH", + /* 287 */ "CONTAINS", + /* 288 */ "IN", + /* 289 */ "JOIN", + /* 290 */ "INNER", + /* 291 */ "LEFT", + /* 292 */ "RIGHT", + /* 293 */ "OUTER", + /* 294 */ "SEMI", + /* 295 */ "ANTI", + /* 296 */ "ASOF", + /* 297 */ "WINDOW", + /* 298 */ "WINDOW_OFFSET", + /* 299 */ "JLIMIT", + /* 300 */ "SELECT", + /* 301 */ "NK_HINT", + /* 302 */ "DISTINCT", + /* 303 */ "WHERE", + /* 304 */ "PARTITION", + /* 305 */ "BY", + /* 306 */ "SESSION", + /* 307 */ "STATE_WINDOW", + /* 308 */ "EVENT_WINDOW", + /* 309 */ "COUNT_WINDOW", + /* 310 */ "SLIDING", + /* 311 */ "FILL", + /* 312 */ "VALUE", + /* 313 */ "VALUE_F", + /* 314 */ "NONE", + /* 315 */ "PREV", + /* 316 */ "NULL_F", + /* 317 */ "LINEAR", + /* 318 */ "NEXT", + /* 319 */ "HAVING", + /* 320 */ "RANGE", + /* 321 */ "EVERY", + /* 322 */ "ORDER", + /* 323 */ "SLIMIT", + /* 324 */ "SOFFSET", + /* 325 */ "LIMIT", + /* 326 */ "OFFSET", + /* 327 */ "ASC", + /* 328 */ "NULLS", + /* 329 */ "ABORT", + /* 330 */ "AFTER", + /* 331 */ "ATTACH", + /* 332 */ "BEFORE", + /* 333 */ "BEGIN", + /* 334 */ "BITAND", + /* 335 */ "BITNOT", + /* 336 */ "BITOR", + /* 337 */ "BLOCKS", + /* 338 */ "CHANGE", + /* 339 */ "COMMA", + /* 340 */ "CONCAT", + /* 341 */ "CONFLICT", + /* 342 */ "COPY", + /* 343 */ "DEFERRED", + /* 344 */ "DELIMITERS", + /* 345 */ "DETACH", + /* 346 */ "DIVIDE", + /* 347 */ "DOT", + /* 348 */ "EACH", + /* 349 */ "FAIL", + /* 350 */ "FOR", + /* 351 */ "GLOB", + /* 352 */ "ID", + /* 353 */ "IMMEDIATE", + /* 354 */ "IMPORT", + /* 355 */ "INITIALLY", + /* 356 */ "INSTEAD", + /* 357 */ "ISNULL", + /* 358 */ "MODULES", + /* 359 */ "NK_BITNOT", + /* 360 */ "NK_SEMI", + /* 361 */ "NOTNULL", + /* 362 */ "OF", + /* 363 */ "PLUS", + /* 364 */ "PRIVILEGE", + /* 365 */ "RAISE", + /* 366 */ "RESTRICT", + /* 367 */ "ROW", + /* 368 */ "STAR", + /* 369 */ "STATEMENT", + /* 370 */ "STRICT", + /* 371 */ "STRING", + /* 372 */ "TIMES", + /* 373 */ "VALUES", + /* 374 */ "VARIABLE", + /* 375 */ "WAL", + /* 376 */ "ENCODE", + /* 377 */ "COMPRESS", + /* 378 */ "LEVEL", + /* 379 */ "cmd", + /* 380 */ "account_options", + /* 381 */ "alter_account_options", + /* 382 */ "literal", + /* 383 */ "alter_account_option", + /* 384 */ "ip_range_list", + /* 385 */ "white_list", + /* 386 */ "white_list_opt", + /* 387 */ "is_import_opt", + /* 388 */ "is_createdb_opt", + /* 389 */ "user_name", + /* 390 */ "sysinfo_opt", + /* 391 */ "privileges", + /* 392 */ "priv_level", + /* 393 */ "with_opt", + /* 394 */ "priv_type_list", + /* 395 */ "priv_type", + /* 396 */ "db_name", + /* 397 */ "table_name", + /* 398 */ "topic_name", + /* 399 */ "search_condition", + /* 400 */ "dnode_endpoint", + /* 401 */ "force_opt", + /* 402 */ "unsafe_opt", + /* 403 */ "not_exists_opt", + /* 404 */ "db_options", + /* 405 */ "exists_opt", + /* 406 */ "alter_db_options", + /* 407 */ "speed_opt", + /* 408 */ "start_opt", + /* 409 */ "end_opt", + /* 410 */ "integer_list", + /* 411 */ "variable_list", + /* 412 */ "retention_list", + /* 413 */ "signed", + /* 414 */ "alter_db_option", + /* 415 */ "retention", + /* 416 */ "full_table_name", + /* 417 */ "column_def_list", + /* 418 */ "tags_def_opt", + /* 419 */ "table_options", + /* 420 */ "multi_create_clause", + /* 421 */ "tag_list_opt", + /* 422 */ "tags_def", + /* 423 */ "multi_drop_clause", + /* 424 */ "alter_table_clause", + /* 425 */ "alter_table_options", + /* 426 */ "column_name", + /* 427 */ "type_name", + /* 428 */ "column_options", + /* 429 */ "tags_literal", + /* 430 */ "create_subtable_clause", + /* 431 */ "specific_cols_opt", + /* 432 */ "tags_literal_list", + /* 433 */ "drop_table_clause", + /* 434 */ "col_name_list", + /* 435 */ "tag_def_list", + /* 436 */ "tag_def", + /* 437 */ "column_def", + /* 438 */ "type_name_default_len", + /* 439 */ "duration_list", + /* 440 */ "rollup_func_list", + /* 441 */ "alter_table_option", + /* 442 */ "duration_literal", + /* 443 */ "rollup_func_name", + /* 444 */ "function_name", + /* 445 */ "col_name", + /* 446 */ "db_kind_opt", + /* 447 */ "table_kind_db_name_cond_opt", + /* 448 */ "like_pattern_opt", + /* 449 */ "db_name_cond_opt", + /* 450 */ "table_name_cond", + /* 451 */ "from_db_opt", + /* 452 */ "table_kind", + /* 453 */ "tag_item", + /* 454 */ "column_alias", + /* 455 */ "tsma_name", + /* 456 */ "tsma_func_list", + /* 457 */ "full_tsma_name", + /* 458 */ "func_list", + /* 459 */ "index_options", + /* 460 */ "full_index_name", + /* 461 */ "index_name", + /* 462 */ "sliding_opt", + /* 463 */ "sma_stream_opt", + /* 464 */ "func", + /* 465 */ "sma_func_name", + /* 466 */ "expression_list", + /* 467 */ "with_meta", + /* 468 */ "query_or_subquery", + /* 469 */ "where_clause_opt", + /* 470 */ "cgroup_name", + /* 471 */ "analyze_opt", + /* 472 */ "explain_options", + /* 473 */ "insert_query", + /* 474 */ "or_replace_opt", + /* 475 */ "agg_func_opt", + /* 476 */ "bufsize_opt", + /* 477 */ "language_opt", + /* 478 */ "full_view_name", + /* 479 */ "view_name", + /* 480 */ "stream_name", + /* 481 */ "stream_options", + /* 482 */ "col_list_opt", + /* 483 */ "tag_def_or_ref_opt", + /* 484 */ "subtable_opt", + /* 485 */ "ignore_opt", + /* 486 */ "column_stream_def_list", + /* 487 */ "column_stream_def", + /* 488 */ "stream_col_options", + /* 489 */ "expression", + /* 490 */ "on_vgroup_id", + /* 491 */ "dnode_list", + /* 492 */ "literal_func", + /* 493 */ "signed_literal", + /* 494 */ "literal_list", + /* 495 */ "table_alias", + /* 496 */ "expr_or_subquery", + /* 497 */ "pseudo_column", + /* 498 */ "column_reference", + /* 499 */ "function_expression", + /* 500 */ "case_when_expression", + /* 501 */ "star_func", + /* 502 */ "star_func_para_list", + /* 503 */ "noarg_func", + /* 504 */ "other_para_list", + /* 505 */ "star_func_para", + /* 506 */ "when_then_list", + /* 507 */ "case_when_else_opt", + /* 508 */ "common_expression", + /* 509 */ "when_then_expr", + /* 510 */ "predicate", + /* 511 */ "compare_op", + /* 512 */ "in_op", + /* 513 */ "in_predicate_value", + /* 514 */ "boolean_value_expression", + /* 515 */ "boolean_primary", + /* 516 */ "from_clause_opt", + /* 517 */ "table_reference_list", + /* 518 */ "table_reference", + /* 519 */ "table_primary", + /* 520 */ "joined_table", + /* 521 */ "alias_opt", + /* 522 */ "subquery", + /* 523 */ "parenthesized_joined_table", + /* 524 */ "join_type", + /* 525 */ "join_subtype", + /* 526 */ "join_on_clause_opt", + /* 527 */ "window_offset_clause_opt", + /* 528 */ "jlimit_clause_opt", + /* 529 */ "window_offset_literal", + /* 530 */ "query_specification", + /* 531 */ "hint_list", + /* 532 */ "set_quantifier_opt", + /* 533 */ "tag_mode_opt", + /* 534 */ "select_list", + /* 535 */ "partition_by_clause_opt", + /* 536 */ "range_opt", + /* 537 */ "every_opt", + /* 538 */ "fill_opt", + /* 539 */ "twindow_clause_opt", + /* 540 */ "group_by_clause_opt", + /* 541 */ "having_clause_opt", + /* 542 */ "select_item", + /* 543 */ "partition_list", + /* 544 */ "partition_item", + /* 545 */ "interval_sliding_duration_literal", + /* 546 */ "fill_mode", + /* 547 */ "group_by_list", + /* 548 */ "query_expression", + /* 549 */ "query_simple", + /* 550 */ "order_by_clause_opt", + /* 551 */ "slimit_clause_opt", + /* 552 */ "limit_clause_opt", + /* 553 */ "union_query_expression", + /* 554 */ "query_simple_or_subquery", + /* 555 */ "sort_specification_list", + /* 556 */ "sort_specification", + /* 557 */ "ordering_specification_opt", + /* 558 */ "null_ordering_opt", }; #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ @@ -2965,340 +3001,341 @@ static const char *const yyRuleName[] = { /* 418 */ "stream_options ::=", /* 419 */ "stream_options ::= stream_options TRIGGER AT_ONCE", /* 420 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE", - /* 421 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal", - /* 422 */ "stream_options ::= stream_options WATERMARK duration_literal", - /* 423 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER", - /* 424 */ "stream_options ::= stream_options FILL_HISTORY NK_INTEGER", - /* 425 */ "stream_options ::= stream_options DELETE_MARK duration_literal", - /* 426 */ "stream_options ::= stream_options IGNORE UPDATE NK_INTEGER", - /* 427 */ "subtable_opt ::=", - /* 428 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP", - /* 429 */ "ignore_opt ::=", - /* 430 */ "ignore_opt ::= IGNORE UNTREATED", - /* 431 */ "cmd ::= KILL CONNECTION NK_INTEGER", - /* 432 */ "cmd ::= KILL QUERY NK_STRING", - /* 433 */ "cmd ::= KILL TRANSACTION NK_INTEGER", - /* 434 */ "cmd ::= KILL COMPACT NK_INTEGER", - /* 435 */ "cmd ::= BALANCE VGROUP", - /* 436 */ "cmd ::= BALANCE VGROUP LEADER on_vgroup_id", - /* 437 */ "cmd ::= BALANCE VGROUP LEADER DATABASE db_name", - /* 438 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", - /* 439 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", - /* 440 */ "cmd ::= SPLIT VGROUP NK_INTEGER", - /* 441 */ "on_vgroup_id ::=", - /* 442 */ "on_vgroup_id ::= ON NK_INTEGER", - /* 443 */ "dnode_list ::= DNODE NK_INTEGER", - /* 444 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", - /* 445 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", - /* 446 */ "cmd ::= query_or_subquery", - /* 447 */ "cmd ::= insert_query", - /* 448 */ "insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery", - /* 449 */ "insert_query ::= INSERT INTO full_table_name query_or_subquery", - /* 450 */ "tags_literal ::= NK_INTEGER", - /* 451 */ "tags_literal ::= NK_INTEGER NK_PLUS duration_literal", - /* 452 */ "tags_literal ::= NK_INTEGER NK_MINUS duration_literal", - /* 453 */ "tags_literal ::= NK_PLUS NK_INTEGER", - /* 454 */ "tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal", - /* 455 */ "tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal", - /* 456 */ "tags_literal ::= NK_MINUS NK_INTEGER", - /* 457 */ "tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal", - /* 458 */ "tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal", - /* 459 */ "tags_literal ::= NK_FLOAT", - /* 460 */ "tags_literal ::= NK_PLUS NK_FLOAT", - /* 461 */ "tags_literal ::= NK_MINUS NK_FLOAT", - /* 462 */ "tags_literal ::= NK_BIN", - /* 463 */ "tags_literal ::= NK_BIN NK_PLUS duration_literal", - /* 464 */ "tags_literal ::= NK_BIN NK_MINUS duration_literal", - /* 465 */ "tags_literal ::= NK_PLUS NK_BIN", - /* 466 */ "tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal", - /* 467 */ "tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal", - /* 468 */ "tags_literal ::= NK_MINUS NK_BIN", - /* 469 */ "tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal", - /* 470 */ "tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal", - /* 471 */ "tags_literal ::= NK_HEX", - /* 472 */ "tags_literal ::= NK_HEX NK_PLUS duration_literal", - /* 473 */ "tags_literal ::= NK_HEX NK_MINUS duration_literal", - /* 474 */ "tags_literal ::= NK_PLUS NK_HEX", - /* 475 */ "tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal", - /* 476 */ "tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal", - /* 477 */ "tags_literal ::= NK_MINUS NK_HEX", - /* 478 */ "tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal", - /* 479 */ "tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal", - /* 480 */ "tags_literal ::= NK_STRING", - /* 481 */ "tags_literal ::= NK_STRING NK_PLUS duration_literal", - /* 482 */ "tags_literal ::= NK_STRING NK_MINUS duration_literal", - /* 483 */ "tags_literal ::= NK_BOOL", - /* 484 */ "tags_literal ::= NULL", - /* 485 */ "tags_literal ::= literal_func", - /* 486 */ "tags_literal ::= literal_func NK_PLUS duration_literal", - /* 487 */ "tags_literal ::= literal_func NK_MINUS duration_literal", - /* 488 */ "tags_literal_list ::= tags_literal", - /* 489 */ "tags_literal_list ::= tags_literal_list NK_COMMA tags_literal", - /* 490 */ "literal ::= NK_INTEGER", - /* 491 */ "literal ::= NK_FLOAT", - /* 492 */ "literal ::= NK_STRING", - /* 493 */ "literal ::= NK_BOOL", - /* 494 */ "literal ::= TIMESTAMP NK_STRING", - /* 495 */ "literal ::= duration_literal", - /* 496 */ "literal ::= NULL", - /* 497 */ "literal ::= NK_QUESTION", - /* 498 */ "duration_literal ::= NK_VARIABLE", - /* 499 */ "signed ::= NK_INTEGER", - /* 500 */ "signed ::= NK_PLUS NK_INTEGER", - /* 501 */ "signed ::= NK_MINUS NK_INTEGER", - /* 502 */ "signed ::= NK_FLOAT", - /* 503 */ "signed ::= NK_PLUS NK_FLOAT", - /* 504 */ "signed ::= NK_MINUS NK_FLOAT", - /* 505 */ "signed_literal ::= signed", - /* 506 */ "signed_literal ::= NK_STRING", - /* 507 */ "signed_literal ::= NK_BOOL", - /* 508 */ "signed_literal ::= TIMESTAMP NK_STRING", - /* 509 */ "signed_literal ::= duration_literal", - /* 510 */ "signed_literal ::= NULL", - /* 511 */ "signed_literal ::= literal_func", - /* 512 */ "signed_literal ::= NK_QUESTION", - /* 513 */ "literal_list ::= signed_literal", - /* 514 */ "literal_list ::= literal_list NK_COMMA signed_literal", - /* 515 */ "db_name ::= NK_ID", - /* 516 */ "table_name ::= NK_ID", - /* 517 */ "column_name ::= NK_ID", - /* 518 */ "function_name ::= NK_ID", - /* 519 */ "view_name ::= NK_ID", - /* 520 */ "table_alias ::= NK_ID", - /* 521 */ "column_alias ::= NK_ID", - /* 522 */ "column_alias ::= NK_ALIAS", - /* 523 */ "user_name ::= NK_ID", - /* 524 */ "topic_name ::= NK_ID", - /* 525 */ "stream_name ::= NK_ID", - /* 526 */ "cgroup_name ::= NK_ID", - /* 527 */ "index_name ::= NK_ID", - /* 528 */ "tsma_name ::= NK_ID", - /* 529 */ "expr_or_subquery ::= expression", - /* 530 */ "expression ::= literal", - /* 531 */ "expression ::= pseudo_column", - /* 532 */ "expression ::= column_reference", - /* 533 */ "expression ::= function_expression", - /* 534 */ "expression ::= case_when_expression", - /* 535 */ "expression ::= NK_LP expression NK_RP", - /* 536 */ "expression ::= NK_PLUS expr_or_subquery", - /* 537 */ "expression ::= NK_MINUS expr_or_subquery", - /* 538 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery", - /* 539 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery", - /* 540 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery", - /* 541 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery", - /* 542 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery", - /* 543 */ "expression ::= column_reference NK_ARROW NK_STRING", - /* 544 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery", - /* 545 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery", - /* 546 */ "expression_list ::= expr_or_subquery", - /* 547 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery", - /* 548 */ "column_reference ::= column_name", - /* 549 */ "column_reference ::= table_name NK_DOT column_name", - /* 550 */ "column_reference ::= NK_ALIAS", - /* 551 */ "column_reference ::= table_name NK_DOT NK_ALIAS", - /* 552 */ "pseudo_column ::= ROWTS", - /* 553 */ "pseudo_column ::= TBNAME", - /* 554 */ "pseudo_column ::= table_name NK_DOT TBNAME", - /* 555 */ "pseudo_column ::= QSTART", - /* 556 */ "pseudo_column ::= QEND", - /* 557 */ "pseudo_column ::= QDURATION", - /* 558 */ "pseudo_column ::= WSTART", - /* 559 */ "pseudo_column ::= WEND", - /* 560 */ "pseudo_column ::= WDURATION", - /* 561 */ "pseudo_column ::= IROWTS", - /* 562 */ "pseudo_column ::= ISFILLED", - /* 563 */ "pseudo_column ::= QTAGS", - /* 564 */ "function_expression ::= function_name NK_LP expression_list NK_RP", - /* 565 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", - /* 566 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP", - /* 567 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP", - /* 568 */ "function_expression ::= literal_func", - /* 569 */ "literal_func ::= noarg_func NK_LP NK_RP", - /* 570 */ "literal_func ::= NOW", - /* 571 */ "literal_func ::= TODAY", - /* 572 */ "noarg_func ::= NOW", - /* 573 */ "noarg_func ::= TODAY", - /* 574 */ "noarg_func ::= TIMEZONE", - /* 575 */ "noarg_func ::= DATABASE", - /* 576 */ "noarg_func ::= CLIENT_VERSION", - /* 577 */ "noarg_func ::= SERVER_VERSION", - /* 578 */ "noarg_func ::= SERVER_STATUS", - /* 579 */ "noarg_func ::= CURRENT_USER", - /* 580 */ "noarg_func ::= USER", - /* 581 */ "star_func ::= COUNT", - /* 582 */ "star_func ::= FIRST", - /* 583 */ "star_func ::= LAST", - /* 584 */ "star_func ::= LAST_ROW", - /* 585 */ "star_func_para_list ::= NK_STAR", - /* 586 */ "star_func_para_list ::= other_para_list", - /* 587 */ "other_para_list ::= star_func_para", - /* 588 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", - /* 589 */ "star_func_para ::= expr_or_subquery", - /* 590 */ "star_func_para ::= table_name NK_DOT NK_STAR", - /* 591 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END", - /* 592 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END", - /* 593 */ "when_then_list ::= when_then_expr", - /* 594 */ "when_then_list ::= when_then_list when_then_expr", - /* 595 */ "when_then_expr ::= WHEN common_expression THEN common_expression", - /* 596 */ "case_when_else_opt ::=", - /* 597 */ "case_when_else_opt ::= ELSE common_expression", - /* 598 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery", - /* 599 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery", - /* 600 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery", - /* 601 */ "predicate ::= expr_or_subquery IS NULL", - /* 602 */ "predicate ::= expr_or_subquery IS NOT NULL", - /* 603 */ "predicate ::= expr_or_subquery in_op in_predicate_value", - /* 604 */ "compare_op ::= NK_LT", - /* 605 */ "compare_op ::= NK_GT", - /* 606 */ "compare_op ::= NK_LE", - /* 607 */ "compare_op ::= NK_GE", - /* 608 */ "compare_op ::= NK_NE", - /* 609 */ "compare_op ::= NK_EQ", - /* 610 */ "compare_op ::= LIKE", - /* 611 */ "compare_op ::= NOT LIKE", - /* 612 */ "compare_op ::= MATCH", - /* 613 */ "compare_op ::= NMATCH", - /* 614 */ "compare_op ::= CONTAINS", - /* 615 */ "in_op ::= IN", - /* 616 */ "in_op ::= NOT IN", - /* 617 */ "in_predicate_value ::= NK_LP literal_list NK_RP", - /* 618 */ "boolean_value_expression ::= boolean_primary", - /* 619 */ "boolean_value_expression ::= NOT boolean_primary", - /* 620 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", - /* 621 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", - /* 622 */ "boolean_primary ::= predicate", - /* 623 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", - /* 624 */ "common_expression ::= expr_or_subquery", - /* 625 */ "common_expression ::= boolean_value_expression", - /* 626 */ "from_clause_opt ::=", - /* 627 */ "from_clause_opt ::= FROM table_reference_list", - /* 628 */ "table_reference_list ::= table_reference", - /* 629 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", - /* 630 */ "table_reference ::= table_primary", - /* 631 */ "table_reference ::= joined_table", - /* 632 */ "table_primary ::= table_name alias_opt", - /* 633 */ "table_primary ::= db_name NK_DOT table_name alias_opt", - /* 634 */ "table_primary ::= subquery alias_opt", - /* 635 */ "table_primary ::= parenthesized_joined_table", - /* 636 */ "alias_opt ::=", - /* 637 */ "alias_opt ::= table_alias", - /* 638 */ "alias_opt ::= AS table_alias", - /* 639 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", - /* 640 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", - /* 641 */ "joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt", - /* 642 */ "join_type ::=", - /* 643 */ "join_type ::= INNER", - /* 644 */ "join_type ::= LEFT", - /* 645 */ "join_type ::= RIGHT", - /* 646 */ "join_type ::= FULL", - /* 647 */ "join_subtype ::=", - /* 648 */ "join_subtype ::= OUTER", - /* 649 */ "join_subtype ::= SEMI", - /* 650 */ "join_subtype ::= ANTI", - /* 651 */ "join_subtype ::= ASOF", - /* 652 */ "join_subtype ::= WINDOW", - /* 653 */ "join_on_clause_opt ::=", - /* 654 */ "join_on_clause_opt ::= ON search_condition", - /* 655 */ "window_offset_clause_opt ::=", - /* 656 */ "window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP", - /* 657 */ "window_offset_literal ::= NK_VARIABLE", - /* 658 */ "window_offset_literal ::= NK_MINUS NK_VARIABLE", - /* 659 */ "jlimit_clause_opt ::=", - /* 660 */ "jlimit_clause_opt ::= JLIMIT NK_INTEGER", - /* 661 */ "query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_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", - /* 662 */ "hint_list ::=", - /* 663 */ "hint_list ::= NK_HINT", - /* 664 */ "tag_mode_opt ::=", - /* 665 */ "tag_mode_opt ::= TAGS", - /* 666 */ "set_quantifier_opt ::=", - /* 667 */ "set_quantifier_opt ::= DISTINCT", - /* 668 */ "set_quantifier_opt ::= ALL", - /* 669 */ "select_list ::= select_item", - /* 670 */ "select_list ::= select_list NK_COMMA select_item", - /* 671 */ "select_item ::= NK_STAR", - /* 672 */ "select_item ::= common_expression", - /* 673 */ "select_item ::= common_expression column_alias", - /* 674 */ "select_item ::= common_expression AS column_alias", - /* 675 */ "select_item ::= table_name NK_DOT NK_STAR", - /* 676 */ "where_clause_opt ::=", - /* 677 */ "where_clause_opt ::= WHERE search_condition", - /* 678 */ "partition_by_clause_opt ::=", - /* 679 */ "partition_by_clause_opt ::= PARTITION BY partition_list", - /* 680 */ "partition_list ::= partition_item", - /* 681 */ "partition_list ::= partition_list NK_COMMA partition_item", - /* 682 */ "partition_item ::= expr_or_subquery", - /* 683 */ "partition_item ::= expr_or_subquery column_alias", - /* 684 */ "partition_item ::= expr_or_subquery AS column_alias", - /* 685 */ "twindow_clause_opt ::=", - /* 686 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP", - /* 687 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP", - /* 688 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt", - /* 689 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt", - /* 690 */ "twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition", - /* 691 */ "twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP", - /* 692 */ "twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", - /* 693 */ "sliding_opt ::=", - /* 694 */ "sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP", - /* 695 */ "interval_sliding_duration_literal ::= NK_VARIABLE", - /* 696 */ "interval_sliding_duration_literal ::= NK_STRING", - /* 697 */ "interval_sliding_duration_literal ::= NK_INTEGER", - /* 698 */ "fill_opt ::=", - /* 699 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", - /* 700 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP", - /* 701 */ "fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP", - /* 702 */ "fill_mode ::= NONE", - /* 703 */ "fill_mode ::= PREV", - /* 704 */ "fill_mode ::= NULL", - /* 705 */ "fill_mode ::= NULL_F", - /* 706 */ "fill_mode ::= LINEAR", - /* 707 */ "fill_mode ::= NEXT", - /* 708 */ "group_by_clause_opt ::=", - /* 709 */ "group_by_clause_opt ::= GROUP BY group_by_list", - /* 710 */ "group_by_list ::= expr_or_subquery", - /* 711 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery", - /* 712 */ "having_clause_opt ::=", - /* 713 */ "having_clause_opt ::= HAVING search_condition", - /* 714 */ "range_opt ::=", - /* 715 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP", - /* 716 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_RP", - /* 717 */ "every_opt ::=", - /* 718 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", - /* 719 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt", - /* 720 */ "query_simple ::= query_specification", - /* 721 */ "query_simple ::= union_query_expression", - /* 722 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery", - /* 723 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery", - /* 724 */ "query_simple_or_subquery ::= query_simple", - /* 725 */ "query_simple_or_subquery ::= subquery", - /* 726 */ "query_or_subquery ::= query_expression", - /* 727 */ "query_or_subquery ::= subquery", - /* 728 */ "order_by_clause_opt ::=", - /* 729 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", - /* 730 */ "slimit_clause_opt ::=", - /* 731 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", - /* 732 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", - /* 733 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 734 */ "limit_clause_opt ::=", - /* 735 */ "limit_clause_opt ::= LIMIT NK_INTEGER", - /* 736 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", - /* 737 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 738 */ "subquery ::= NK_LP query_expression NK_RP", - /* 739 */ "subquery ::= NK_LP subquery NK_RP", - /* 740 */ "search_condition ::= common_expression", - /* 741 */ "sort_specification_list ::= sort_specification", - /* 742 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", - /* 743 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt", - /* 744 */ "ordering_specification_opt ::=", - /* 745 */ "ordering_specification_opt ::= ASC", - /* 746 */ "ordering_specification_opt ::= DESC", - /* 747 */ "null_ordering_opt ::=", - /* 748 */ "null_ordering_opt ::= NULLS FIRST", - /* 749 */ "null_ordering_opt ::= NULLS LAST", - /* 750 */ "column_options ::=", - /* 751 */ "column_options ::= column_options PRIMARY KEY", - /* 752 */ "column_options ::= column_options ENCODE NK_STRING", - /* 753 */ "column_options ::= column_options COMPRESS NK_STRING", - /* 754 */ "column_options ::= column_options LEVEL NK_STRING", + /* 421 */ "stream_options ::= stream_options TRIGGER FORCE_WINDOW_CLOSE", + /* 422 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal", + /* 423 */ "stream_options ::= stream_options WATERMARK duration_literal", + /* 424 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER", + /* 425 */ "stream_options ::= stream_options FILL_HISTORY NK_INTEGER", + /* 426 */ "stream_options ::= stream_options DELETE_MARK duration_literal", + /* 427 */ "stream_options ::= stream_options IGNORE UPDATE NK_INTEGER", + /* 428 */ "subtable_opt ::=", + /* 429 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP", + /* 430 */ "ignore_opt ::=", + /* 431 */ "ignore_opt ::= IGNORE UNTREATED", + /* 432 */ "cmd ::= KILL CONNECTION NK_INTEGER", + /* 433 */ "cmd ::= KILL QUERY NK_STRING", + /* 434 */ "cmd ::= KILL TRANSACTION NK_INTEGER", + /* 435 */ "cmd ::= KILL COMPACT NK_INTEGER", + /* 436 */ "cmd ::= BALANCE VGROUP", + /* 437 */ "cmd ::= BALANCE VGROUP LEADER on_vgroup_id", + /* 438 */ "cmd ::= BALANCE VGROUP LEADER DATABASE db_name", + /* 439 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", + /* 440 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", + /* 441 */ "cmd ::= SPLIT VGROUP NK_INTEGER", + /* 442 */ "on_vgroup_id ::=", + /* 443 */ "on_vgroup_id ::= ON NK_INTEGER", + /* 444 */ "dnode_list ::= DNODE NK_INTEGER", + /* 445 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", + /* 446 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", + /* 447 */ "cmd ::= query_or_subquery", + /* 448 */ "cmd ::= insert_query", + /* 449 */ "insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery", + /* 450 */ "insert_query ::= INSERT INTO full_table_name query_or_subquery", + /* 451 */ "tags_literal ::= NK_INTEGER", + /* 452 */ "tags_literal ::= NK_INTEGER NK_PLUS duration_literal", + /* 453 */ "tags_literal ::= NK_INTEGER NK_MINUS duration_literal", + /* 454 */ "tags_literal ::= NK_PLUS NK_INTEGER", + /* 455 */ "tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal", + /* 456 */ "tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal", + /* 457 */ "tags_literal ::= NK_MINUS NK_INTEGER", + /* 458 */ "tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal", + /* 459 */ "tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal", + /* 460 */ "tags_literal ::= NK_FLOAT", + /* 461 */ "tags_literal ::= NK_PLUS NK_FLOAT", + /* 462 */ "tags_literal ::= NK_MINUS NK_FLOAT", + /* 463 */ "tags_literal ::= NK_BIN", + /* 464 */ "tags_literal ::= NK_BIN NK_PLUS duration_literal", + /* 465 */ "tags_literal ::= NK_BIN NK_MINUS duration_literal", + /* 466 */ "tags_literal ::= NK_PLUS NK_BIN", + /* 467 */ "tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal", + /* 468 */ "tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal", + /* 469 */ "tags_literal ::= NK_MINUS NK_BIN", + /* 470 */ "tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal", + /* 471 */ "tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal", + /* 472 */ "tags_literal ::= NK_HEX", + /* 473 */ "tags_literal ::= NK_HEX NK_PLUS duration_literal", + /* 474 */ "tags_literal ::= NK_HEX NK_MINUS duration_literal", + /* 475 */ "tags_literal ::= NK_PLUS NK_HEX", + /* 476 */ "tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal", + /* 477 */ "tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal", + /* 478 */ "tags_literal ::= NK_MINUS NK_HEX", + /* 479 */ "tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal", + /* 480 */ "tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal", + /* 481 */ "tags_literal ::= NK_STRING", + /* 482 */ "tags_literal ::= NK_STRING NK_PLUS duration_literal", + /* 483 */ "tags_literal ::= NK_STRING NK_MINUS duration_literal", + /* 484 */ "tags_literal ::= NK_BOOL", + /* 485 */ "tags_literal ::= NULL", + /* 486 */ "tags_literal ::= literal_func", + /* 487 */ "tags_literal ::= literal_func NK_PLUS duration_literal", + /* 488 */ "tags_literal ::= literal_func NK_MINUS duration_literal", + /* 489 */ "tags_literal_list ::= tags_literal", + /* 490 */ "tags_literal_list ::= tags_literal_list NK_COMMA tags_literal", + /* 491 */ "literal ::= NK_INTEGER", + /* 492 */ "literal ::= NK_FLOAT", + /* 493 */ "literal ::= NK_STRING", + /* 494 */ "literal ::= NK_BOOL", + /* 495 */ "literal ::= TIMESTAMP NK_STRING", + /* 496 */ "literal ::= duration_literal", + /* 497 */ "literal ::= NULL", + /* 498 */ "literal ::= NK_QUESTION", + /* 499 */ "duration_literal ::= NK_VARIABLE", + /* 500 */ "signed ::= NK_INTEGER", + /* 501 */ "signed ::= NK_PLUS NK_INTEGER", + /* 502 */ "signed ::= NK_MINUS NK_INTEGER", + /* 503 */ "signed ::= NK_FLOAT", + /* 504 */ "signed ::= NK_PLUS NK_FLOAT", + /* 505 */ "signed ::= NK_MINUS NK_FLOAT", + /* 506 */ "signed_literal ::= signed", + /* 507 */ "signed_literal ::= NK_STRING", + /* 508 */ "signed_literal ::= NK_BOOL", + /* 509 */ "signed_literal ::= TIMESTAMP NK_STRING", + /* 510 */ "signed_literal ::= duration_literal", + /* 511 */ "signed_literal ::= NULL", + /* 512 */ "signed_literal ::= literal_func", + /* 513 */ "signed_literal ::= NK_QUESTION", + /* 514 */ "literal_list ::= signed_literal", + /* 515 */ "literal_list ::= literal_list NK_COMMA signed_literal", + /* 516 */ "db_name ::= NK_ID", + /* 517 */ "table_name ::= NK_ID", + /* 518 */ "column_name ::= NK_ID", + /* 519 */ "function_name ::= NK_ID", + /* 520 */ "view_name ::= NK_ID", + /* 521 */ "table_alias ::= NK_ID", + /* 522 */ "column_alias ::= NK_ID", + /* 523 */ "column_alias ::= NK_ALIAS", + /* 524 */ "user_name ::= NK_ID", + /* 525 */ "topic_name ::= NK_ID", + /* 526 */ "stream_name ::= NK_ID", + /* 527 */ "cgroup_name ::= NK_ID", + /* 528 */ "index_name ::= NK_ID", + /* 529 */ "tsma_name ::= NK_ID", + /* 530 */ "expr_or_subquery ::= expression", + /* 531 */ "expression ::= literal", + /* 532 */ "expression ::= pseudo_column", + /* 533 */ "expression ::= column_reference", + /* 534 */ "expression ::= function_expression", + /* 535 */ "expression ::= case_when_expression", + /* 536 */ "expression ::= NK_LP expression NK_RP", + /* 537 */ "expression ::= NK_PLUS expr_or_subquery", + /* 538 */ "expression ::= NK_MINUS expr_or_subquery", + /* 539 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery", + /* 540 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery", + /* 541 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery", + /* 542 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery", + /* 543 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery", + /* 544 */ "expression ::= column_reference NK_ARROW NK_STRING", + /* 545 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery", + /* 546 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery", + /* 547 */ "expression_list ::= expr_or_subquery", + /* 548 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery", + /* 549 */ "column_reference ::= column_name", + /* 550 */ "column_reference ::= table_name NK_DOT column_name", + /* 551 */ "column_reference ::= NK_ALIAS", + /* 552 */ "column_reference ::= table_name NK_DOT NK_ALIAS", + /* 553 */ "pseudo_column ::= ROWTS", + /* 554 */ "pseudo_column ::= TBNAME", + /* 555 */ "pseudo_column ::= table_name NK_DOT TBNAME", + /* 556 */ "pseudo_column ::= QSTART", + /* 557 */ "pseudo_column ::= QEND", + /* 558 */ "pseudo_column ::= QDURATION", + /* 559 */ "pseudo_column ::= WSTART", + /* 560 */ "pseudo_column ::= WEND", + /* 561 */ "pseudo_column ::= WDURATION", + /* 562 */ "pseudo_column ::= IROWTS", + /* 563 */ "pseudo_column ::= ISFILLED", + /* 564 */ "pseudo_column ::= QTAGS", + /* 565 */ "function_expression ::= function_name NK_LP expression_list NK_RP", + /* 566 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", + /* 567 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP", + /* 568 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP", + /* 569 */ "function_expression ::= literal_func", + /* 570 */ "literal_func ::= noarg_func NK_LP NK_RP", + /* 571 */ "literal_func ::= NOW", + /* 572 */ "literal_func ::= TODAY", + /* 573 */ "noarg_func ::= NOW", + /* 574 */ "noarg_func ::= TODAY", + /* 575 */ "noarg_func ::= TIMEZONE", + /* 576 */ "noarg_func ::= DATABASE", + /* 577 */ "noarg_func ::= CLIENT_VERSION", + /* 578 */ "noarg_func ::= SERVER_VERSION", + /* 579 */ "noarg_func ::= SERVER_STATUS", + /* 580 */ "noarg_func ::= CURRENT_USER", + /* 581 */ "noarg_func ::= USER", + /* 582 */ "star_func ::= COUNT", + /* 583 */ "star_func ::= FIRST", + /* 584 */ "star_func ::= LAST", + /* 585 */ "star_func ::= LAST_ROW", + /* 586 */ "star_func_para_list ::= NK_STAR", + /* 587 */ "star_func_para_list ::= other_para_list", + /* 588 */ "other_para_list ::= star_func_para", + /* 589 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", + /* 590 */ "star_func_para ::= expr_or_subquery", + /* 591 */ "star_func_para ::= table_name NK_DOT NK_STAR", + /* 592 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END", + /* 593 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END", + /* 594 */ "when_then_list ::= when_then_expr", + /* 595 */ "when_then_list ::= when_then_list when_then_expr", + /* 596 */ "when_then_expr ::= WHEN common_expression THEN common_expression", + /* 597 */ "case_when_else_opt ::=", + /* 598 */ "case_when_else_opt ::= ELSE common_expression", + /* 599 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery", + /* 600 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery", + /* 601 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery", + /* 602 */ "predicate ::= expr_or_subquery IS NULL", + /* 603 */ "predicate ::= expr_or_subquery IS NOT NULL", + /* 604 */ "predicate ::= expr_or_subquery in_op in_predicate_value", + /* 605 */ "compare_op ::= NK_LT", + /* 606 */ "compare_op ::= NK_GT", + /* 607 */ "compare_op ::= NK_LE", + /* 608 */ "compare_op ::= NK_GE", + /* 609 */ "compare_op ::= NK_NE", + /* 610 */ "compare_op ::= NK_EQ", + /* 611 */ "compare_op ::= LIKE", + /* 612 */ "compare_op ::= NOT LIKE", + /* 613 */ "compare_op ::= MATCH", + /* 614 */ "compare_op ::= NMATCH", + /* 615 */ "compare_op ::= CONTAINS", + /* 616 */ "in_op ::= IN", + /* 617 */ "in_op ::= NOT IN", + /* 618 */ "in_predicate_value ::= NK_LP literal_list NK_RP", + /* 619 */ "boolean_value_expression ::= boolean_primary", + /* 620 */ "boolean_value_expression ::= NOT boolean_primary", + /* 621 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", + /* 622 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", + /* 623 */ "boolean_primary ::= predicate", + /* 624 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", + /* 625 */ "common_expression ::= expr_or_subquery", + /* 626 */ "common_expression ::= boolean_value_expression", + /* 627 */ "from_clause_opt ::=", + /* 628 */ "from_clause_opt ::= FROM table_reference_list", + /* 629 */ "table_reference_list ::= table_reference", + /* 630 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", + /* 631 */ "table_reference ::= table_primary", + /* 632 */ "table_reference ::= joined_table", + /* 633 */ "table_primary ::= table_name alias_opt", + /* 634 */ "table_primary ::= db_name NK_DOT table_name alias_opt", + /* 635 */ "table_primary ::= subquery alias_opt", + /* 636 */ "table_primary ::= parenthesized_joined_table", + /* 637 */ "alias_opt ::=", + /* 638 */ "alias_opt ::= table_alias", + /* 639 */ "alias_opt ::= AS table_alias", + /* 640 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", + /* 641 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", + /* 642 */ "joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt", + /* 643 */ "join_type ::=", + /* 644 */ "join_type ::= INNER", + /* 645 */ "join_type ::= LEFT", + /* 646 */ "join_type ::= RIGHT", + /* 647 */ "join_type ::= FULL", + /* 648 */ "join_subtype ::=", + /* 649 */ "join_subtype ::= OUTER", + /* 650 */ "join_subtype ::= SEMI", + /* 651 */ "join_subtype ::= ANTI", + /* 652 */ "join_subtype ::= ASOF", + /* 653 */ "join_subtype ::= WINDOW", + /* 654 */ "join_on_clause_opt ::=", + /* 655 */ "join_on_clause_opt ::= ON search_condition", + /* 656 */ "window_offset_clause_opt ::=", + /* 657 */ "window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP", + /* 658 */ "window_offset_literal ::= NK_VARIABLE", + /* 659 */ "window_offset_literal ::= NK_MINUS NK_VARIABLE", + /* 660 */ "jlimit_clause_opt ::=", + /* 661 */ "jlimit_clause_opt ::= JLIMIT NK_INTEGER", + /* 662 */ "query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_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", + /* 663 */ "hint_list ::=", + /* 664 */ "hint_list ::= NK_HINT", + /* 665 */ "tag_mode_opt ::=", + /* 666 */ "tag_mode_opt ::= TAGS", + /* 667 */ "set_quantifier_opt ::=", + /* 668 */ "set_quantifier_opt ::= DISTINCT", + /* 669 */ "set_quantifier_opt ::= ALL", + /* 670 */ "select_list ::= select_item", + /* 671 */ "select_list ::= select_list NK_COMMA select_item", + /* 672 */ "select_item ::= NK_STAR", + /* 673 */ "select_item ::= common_expression", + /* 674 */ "select_item ::= common_expression column_alias", + /* 675 */ "select_item ::= common_expression AS column_alias", + /* 676 */ "select_item ::= table_name NK_DOT NK_STAR", + /* 677 */ "where_clause_opt ::=", + /* 678 */ "where_clause_opt ::= WHERE search_condition", + /* 679 */ "partition_by_clause_opt ::=", + /* 680 */ "partition_by_clause_opt ::= PARTITION BY partition_list", + /* 681 */ "partition_list ::= partition_item", + /* 682 */ "partition_list ::= partition_list NK_COMMA partition_item", + /* 683 */ "partition_item ::= expr_or_subquery", + /* 684 */ "partition_item ::= expr_or_subquery column_alias", + /* 685 */ "partition_item ::= expr_or_subquery AS column_alias", + /* 686 */ "twindow_clause_opt ::=", + /* 687 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP", + /* 688 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP", + /* 689 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt", + /* 690 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt", + /* 691 */ "twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition", + /* 692 */ "twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP", + /* 693 */ "twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", + /* 694 */ "sliding_opt ::=", + /* 695 */ "sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP", + /* 696 */ "interval_sliding_duration_literal ::= NK_VARIABLE", + /* 697 */ "interval_sliding_duration_literal ::= NK_STRING", + /* 698 */ "interval_sliding_duration_literal ::= NK_INTEGER", + /* 699 */ "fill_opt ::=", + /* 700 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", + /* 701 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP", + /* 702 */ "fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP", + /* 703 */ "fill_mode ::= NONE", + /* 704 */ "fill_mode ::= PREV", + /* 705 */ "fill_mode ::= NULL", + /* 706 */ "fill_mode ::= NULL_F", + /* 707 */ "fill_mode ::= LINEAR", + /* 708 */ "fill_mode ::= NEXT", + /* 709 */ "group_by_clause_opt ::=", + /* 710 */ "group_by_clause_opt ::= GROUP BY group_by_list", + /* 711 */ "group_by_list ::= expr_or_subquery", + /* 712 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery", + /* 713 */ "having_clause_opt ::=", + /* 714 */ "having_clause_opt ::= HAVING search_condition", + /* 715 */ "range_opt ::=", + /* 716 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP", + /* 717 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_RP", + /* 718 */ "every_opt ::=", + /* 719 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", + /* 720 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt", + /* 721 */ "query_simple ::= query_specification", + /* 722 */ "query_simple ::= union_query_expression", + /* 723 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery", + /* 724 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery", + /* 725 */ "query_simple_or_subquery ::= query_simple", + /* 726 */ "query_simple_or_subquery ::= subquery", + /* 727 */ "query_or_subquery ::= query_expression", + /* 728 */ "query_or_subquery ::= subquery", + /* 729 */ "order_by_clause_opt ::=", + /* 730 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", + /* 731 */ "slimit_clause_opt ::=", + /* 732 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", + /* 733 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", + /* 734 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 735 */ "limit_clause_opt ::=", + /* 736 */ "limit_clause_opt ::= LIMIT NK_INTEGER", + /* 737 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", + /* 738 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 739 */ "subquery ::= NK_LP query_expression NK_RP", + /* 740 */ "subquery ::= NK_LP subquery NK_RP", + /* 741 */ "search_condition ::= common_expression", + /* 742 */ "sort_specification_list ::= sort_specification", + /* 743 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", + /* 744 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt", + /* 745 */ "ordering_specification_opt ::=", + /* 746 */ "ordering_specification_opt ::= ASC", + /* 747 */ "ordering_specification_opt ::= DESC", + /* 748 */ "null_ordering_opt ::=", + /* 749 */ "null_ordering_opt ::= NULLS FIRST", + /* 750 */ "null_ordering_opt ::= NULLS LAST", + /* 751 */ "column_options ::=", + /* 752 */ "column_options ::= column_options PRIMARY KEY", + /* 753 */ "column_options ::= column_options ENCODE NK_STRING", + /* 754 */ "column_options ::= column_options COMPRESS NK_STRING", + /* 755 */ "column_options ::= column_options LEVEL NK_STRING", }; #endif /* NDEBUG */ @@ -3425,298 +3462,260 @@ static void yy_destructor( */ /********* Begin destructor definitions ***************************************/ /* Default NON-TERMINAL Destructor */ - case 378: /* cmd */ - case 381: /* literal */ - case 392: /* with_opt */ - case 398: /* search_condition */ - case 403: /* db_options */ - case 405: /* alter_db_options */ - case 407: /* start_opt */ - case 408: /* end_opt */ - case 412: /* signed */ - case 414: /* retention */ - case 415: /* full_table_name */ - case 418: /* table_options */ - case 423: /* alter_table_clause */ - case 424: /* alter_table_options */ - case 427: /* column_options */ - case 428: /* tags_literal */ - case 429: /* create_subtable_clause */ - case 432: /* drop_table_clause */ - case 435: /* tag_def */ - case 436: /* column_def */ - case 441: /* duration_literal */ - case 442: /* rollup_func_name */ - case 444: /* col_name */ - case 447: /* like_pattern_opt */ - case 448: /* db_name_cond_opt */ - case 449: /* table_name_cond */ - case 450: /* from_db_opt */ - case 452: /* tag_item */ - case 456: /* full_tsma_name */ - case 458: /* index_options */ - case 459: /* full_index_name */ - case 461: /* sliding_opt */ - case 462: /* sma_stream_opt */ - case 463: /* func */ - case 467: /* query_or_subquery */ - case 468: /* where_clause_opt */ - case 471: /* explain_options */ - case 472: /* insert_query */ - case 477: /* full_view_name */ - case 480: /* stream_options */ - case 483: /* subtable_opt */ - case 486: /* column_stream_def */ - case 487: /* stream_col_options */ - case 488: /* expression */ - case 491: /* literal_func */ - case 492: /* signed_literal */ - case 495: /* expr_or_subquery */ - case 496: /* pseudo_column */ - case 497: /* column_reference */ - case 498: /* function_expression */ - case 499: /* case_when_expression */ - case 504: /* star_func_para */ - case 506: /* case_when_else_opt */ - case 507: /* common_expression */ - case 508: /* when_then_expr */ - case 509: /* predicate */ - case 512: /* in_predicate_value */ - case 513: /* boolean_value_expression */ - case 514: /* boolean_primary */ - case 515: /* from_clause_opt */ - case 516: /* table_reference_list */ - case 517: /* table_reference */ - case 518: /* table_primary */ - case 519: /* joined_table */ - case 521: /* subquery */ - case 522: /* parenthesized_joined_table */ - case 525: /* join_on_clause_opt */ - case 526: /* window_offset_clause_opt */ - case 527: /* jlimit_clause_opt */ - case 528: /* window_offset_literal */ - case 529: /* query_specification */ - case 535: /* range_opt */ - case 536: /* every_opt */ - case 537: /* fill_opt */ - case 538: /* twindow_clause_opt */ - case 540: /* having_clause_opt */ - case 541: /* select_item */ - case 543: /* partition_item */ - case 544: /* interval_sliding_duration_literal */ - case 547: /* query_expression */ - case 548: /* query_simple */ - case 550: /* slimit_clause_opt */ - case 551: /* limit_clause_opt */ - case 552: /* union_query_expression */ - case 553: /* query_simple_or_subquery */ - case 555: /* sort_specification */ + case 379: /* cmd */ + case 382: /* literal */ + case 393: /* with_opt */ + case 399: /* search_condition */ + case 404: /* db_options */ + case 406: /* alter_db_options */ + case 408: /* start_opt */ + case 409: /* end_opt */ + case 413: /* signed */ + case 415: /* retention */ + case 416: /* full_table_name */ + case 419: /* table_options */ + case 424: /* alter_table_clause */ + case 425: /* alter_table_options */ + case 428: /* column_options */ + case 429: /* tags_literal */ + case 430: /* create_subtable_clause */ + case 433: /* drop_table_clause */ + case 436: /* tag_def */ + case 437: /* column_def */ + case 442: /* duration_literal */ + case 443: /* rollup_func_name */ + case 445: /* col_name */ + case 448: /* like_pattern_opt */ + case 449: /* db_name_cond_opt */ + case 450: /* table_name_cond */ + case 451: /* from_db_opt */ + case 453: /* tag_item */ + case 457: /* full_tsma_name */ + case 459: /* index_options */ + case 460: /* full_index_name */ + case 462: /* sliding_opt */ + case 463: /* sma_stream_opt */ + case 464: /* func */ + case 468: /* query_or_subquery */ + case 469: /* where_clause_opt */ + case 472: /* explain_options */ + case 473: /* insert_query */ + case 478: /* full_view_name */ + case 481: /* stream_options */ + case 484: /* subtable_opt */ + case 487: /* column_stream_def */ + case 488: /* stream_col_options */ + case 489: /* expression */ + case 492: /* literal_func */ + case 493: /* signed_literal */ + case 496: /* expr_or_subquery */ + case 497: /* pseudo_column */ + case 498: /* column_reference */ + case 499: /* function_expression */ + case 500: /* case_when_expression */ + case 505: /* star_func_para */ + case 507: /* case_when_else_opt */ + case 508: /* common_expression */ + case 509: /* when_then_expr */ + case 510: /* predicate */ + case 513: /* in_predicate_value */ + case 514: /* boolean_value_expression */ + case 515: /* boolean_primary */ + case 516: /* from_clause_opt */ + case 517: /* table_reference_list */ + case 518: /* table_reference */ + case 519: /* table_primary */ + case 520: /* joined_table */ + case 522: /* subquery */ + case 523: /* parenthesized_joined_table */ + case 526: /* join_on_clause_opt */ + case 527: /* window_offset_clause_opt */ + case 528: /* jlimit_clause_opt */ + case 529: /* window_offset_literal */ + case 530: /* query_specification */ + case 536: /* range_opt */ + case 537: /* every_opt */ + case 538: /* fill_opt */ + case 539: /* twindow_clause_opt */ + case 541: /* having_clause_opt */ + case 542: /* select_item */ + case 544: /* partition_item */ + case 545: /* interval_sliding_duration_literal */ + case 548: /* query_expression */ + case 549: /* query_simple */ + case 551: /* slimit_clause_opt */ + case 552: /* limit_clause_opt */ + case 553: /* union_query_expression */ + case 554: /* query_simple_or_subquery */ + case 556: /* sort_specification */ { -#line 7 "sql.y" - nodesDestroyNode((yypminor->yy416)); -#line 3517 "sql.c" + nodesDestroyNode((yypminor->yy54)); } break; - case 379: /* account_options */ - case 380: /* alter_account_options */ - case 382: /* alter_account_option */ - case 406: /* speed_opt */ - case 466: /* with_meta */ - case 475: /* bufsize_opt */ + case 380: /* account_options */ + case 381: /* alter_account_options */ + case 383: /* alter_account_option */ + case 407: /* speed_opt */ + case 467: /* with_meta */ + case 476: /* bufsize_opt */ { -#line 54 "sql.y" -#line 3529 "sql.c" } break; - case 383: /* ip_range_list */ - case 384: /* white_list */ - case 385: /* white_list_opt */ - case 409: /* integer_list */ - case 410: /* variable_list */ - case 411: /* retention_list */ - case 416: /* column_def_list */ - case 417: /* tags_def_opt */ - case 419: /* multi_create_clause */ - case 420: /* tag_list_opt */ - case 421: /* tags_def */ - case 422: /* multi_drop_clause */ - case 430: /* specific_cols_opt */ - case 431: /* tags_literal_list */ - case 433: /* col_name_list */ - case 434: /* tag_def_list */ - case 438: /* duration_list */ - case 439: /* rollup_func_list */ - case 457: /* func_list */ - case 465: /* expression_list */ - case 481: /* col_list_opt */ - case 482: /* tag_def_or_ref_opt */ - case 485: /* column_stream_def_list */ - case 490: /* dnode_list */ - case 493: /* literal_list */ - case 501: /* star_func_para_list */ - case 503: /* other_para_list */ - case 505: /* when_then_list */ - case 530: /* hint_list */ - case 533: /* select_list */ - case 534: /* partition_by_clause_opt */ - case 539: /* group_by_clause_opt */ - case 542: /* partition_list */ - case 546: /* group_by_list */ - case 549: /* order_by_clause_opt */ - case 554: /* sort_specification_list */ + case 384: /* ip_range_list */ + case 385: /* white_list */ + case 386: /* white_list_opt */ + case 410: /* integer_list */ + case 411: /* variable_list */ + case 412: /* retention_list */ + case 417: /* column_def_list */ + case 418: /* tags_def_opt */ + case 420: /* multi_create_clause */ + case 421: /* tag_list_opt */ + case 422: /* tags_def */ + case 423: /* multi_drop_clause */ + case 431: /* specific_cols_opt */ + case 432: /* tags_literal_list */ + case 434: /* col_name_list */ + case 435: /* tag_def_list */ + case 439: /* duration_list */ + case 440: /* rollup_func_list */ + case 458: /* func_list */ + case 466: /* expression_list */ + case 482: /* col_list_opt */ + case 483: /* tag_def_or_ref_opt */ + case 486: /* column_stream_def_list */ + case 491: /* dnode_list */ + case 494: /* literal_list */ + case 502: /* star_func_para_list */ + case 504: /* other_para_list */ + case 506: /* when_then_list */ + case 531: /* hint_list */ + case 534: /* select_list */ + case 535: /* partition_by_clause_opt */ + case 540: /* group_by_clause_opt */ + case 543: /* partition_list */ + case 547: /* group_by_list */ + case 550: /* order_by_clause_opt */ + case 555: /* sort_specification_list */ { -#line 85 "sql.y" - nodesDestroyList((yypminor->yy316)); -#line 3571 "sql.c" + nodesDestroyList((yypminor->yy652)); } break; - case 386: /* is_import_opt */ - case 387: /* is_createdb_opt */ - case 389: /* sysinfo_opt */ + case 387: /* is_import_opt */ + case 388: /* is_createdb_opt */ + case 390: /* sysinfo_opt */ { -#line 99 "sql.y" -#line 3580 "sql.c" } break; - case 388: /* user_name */ - case 395: /* db_name */ - case 396: /* table_name */ - case 397: /* topic_name */ - case 399: /* dnode_endpoint */ - case 425: /* column_name */ - case 443: /* function_name */ - case 453: /* column_alias */ - case 454: /* tsma_name */ - case 460: /* index_name */ - case 464: /* sma_func_name */ - case 469: /* cgroup_name */ - case 476: /* language_opt */ - case 478: /* view_name */ - case 479: /* stream_name */ - case 489: /* on_vgroup_id */ - case 494: /* table_alias */ - case 500: /* star_func */ - case 502: /* noarg_func */ - case 520: /* alias_opt */ + case 389: /* user_name */ + case 396: /* db_name */ + case 397: /* table_name */ + case 398: /* topic_name */ + case 400: /* dnode_endpoint */ + case 426: /* column_name */ + case 444: /* function_name */ + case 454: /* column_alias */ + case 455: /* tsma_name */ + case 461: /* index_name */ + case 465: /* sma_func_name */ + case 470: /* cgroup_name */ + case 477: /* language_opt */ + case 479: /* view_name */ + case 480: /* stream_name */ + case 490: /* on_vgroup_id */ + case 495: /* table_alias */ + case 501: /* star_func */ + case 503: /* noarg_func */ + case 521: /* alias_opt */ { -#line 1082 "sql.y" -#line 3606 "sql.c" } break; - case 390: /* privileges */ - case 393: /* priv_type_list */ - case 394: /* priv_type */ + case 391: /* privileges */ + case 394: /* priv_type_list */ + case 395: /* priv_type */ { -#line 131 "sql.y" -#line 3615 "sql.c" } break; - case 391: /* priv_level */ + case 392: /* priv_level */ { -#line 148 "sql.y" -#line 3622 "sql.c" } break; - case 400: /* force_opt */ - case 401: /* unsafe_opt */ - case 402: /* not_exists_opt */ - case 404: /* exists_opt */ - case 470: /* analyze_opt */ - case 473: /* or_replace_opt */ - case 474: /* agg_func_opt */ - case 484: /* ignore_opt */ - case 531: /* set_quantifier_opt */ - case 532: /* tag_mode_opt */ + case 401: /* force_opt */ + case 402: /* unsafe_opt */ + case 403: /* not_exists_opt */ + case 405: /* exists_opt */ + case 471: /* analyze_opt */ + case 474: /* or_replace_opt */ + case 475: /* agg_func_opt */ + case 485: /* ignore_opt */ + case 532: /* set_quantifier_opt */ + case 533: /* tag_mode_opt */ { -#line 180 "sql.y" -#line 3638 "sql.c" } break; - case 413: /* alter_db_option */ - case 440: /* alter_table_option */ + case 414: /* alter_db_option */ + case 441: /* alter_table_option */ { -#line 288 "sql.y" -#line 3646 "sql.c" } break; - case 426: /* type_name */ - case 437: /* type_name_default_len */ + case 427: /* type_name */ + case 438: /* type_name_default_len */ { -#line 425 "sql.y" -#line 3654 "sql.c" } break; - case 445: /* db_kind_opt */ - case 451: /* table_kind */ + case 446: /* db_kind_opt */ + case 452: /* table_kind */ { -#line 604 "sql.y" -#line 3662 "sql.c" } break; - case 446: /* table_kind_db_name_cond_opt */ + case 447: /* table_kind_db_name_cond_opt */ { -#line 569 "sql.y" -#line 3669 "sql.c" } break; - case 455: /* tsma_func_list */ + case 456: /* tsma_func_list */ { -#line 623 "sql.y" - nodesDestroyNode((yypminor->yy416)); -#line 3676 "sql.c" + nodesDestroyNode((yypminor->yy54)); } break; - case 510: /* compare_op */ - case 511: /* in_op */ + case 511: /* compare_op */ + case 512: /* in_op */ { -#line 1280 "sql.y" -#line 3684 "sql.c" } break; - case 523: /* join_type */ + case 524: /* join_type */ { -#line 1361 "sql.y" -#line 3691 "sql.c" } break; - case 524: /* join_subtype */ + case 525: /* join_subtype */ { -#line 1369 "sql.y" -#line 3698 "sql.c" } break; - case 545: /* fill_mode */ + case 546: /* fill_mode */ { -#line 1485 "sql.y" -#line 3705 "sql.c" } break; - case 556: /* ordering_specification_opt */ + case 557: /* ordering_specification_opt */ { -#line 1570 "sql.y" -#line 3712 "sql.c" } break; - case 557: /* null_ordering_opt */ + case 558: /* null_ordering_opt */ { -#line 1576 "sql.y" -#line 3719 "sql.c" } break; /********* End destructor definitions *****************************************/ @@ -4005,761 +4004,762 @@ static void yy_shift( /* For rule J, yyRuleInfoLhs[J] contains the symbol on the left-hand side ** of that rule */ static const YYCODETYPE yyRuleInfoLhs[] = { - 378, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ - 378, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ - 379, /* (2) account_options ::= */ - 379, /* (3) account_options ::= account_options PPS literal */ - 379, /* (4) account_options ::= account_options TSERIES literal */ - 379, /* (5) account_options ::= account_options STORAGE literal */ - 379, /* (6) account_options ::= account_options STREAMS literal */ - 379, /* (7) account_options ::= account_options QTIME literal */ - 379, /* (8) account_options ::= account_options DBS literal */ - 379, /* (9) account_options ::= account_options USERS literal */ - 379, /* (10) account_options ::= account_options CONNS literal */ - 379, /* (11) account_options ::= account_options STATE literal */ - 380, /* (12) alter_account_options ::= alter_account_option */ - 380, /* (13) alter_account_options ::= alter_account_options alter_account_option */ - 382, /* (14) alter_account_option ::= PASS literal */ - 382, /* (15) alter_account_option ::= PPS literal */ - 382, /* (16) alter_account_option ::= TSERIES literal */ - 382, /* (17) alter_account_option ::= STORAGE literal */ - 382, /* (18) alter_account_option ::= STREAMS literal */ - 382, /* (19) alter_account_option ::= QTIME literal */ - 382, /* (20) alter_account_option ::= DBS literal */ - 382, /* (21) alter_account_option ::= USERS literal */ - 382, /* (22) alter_account_option ::= CONNS literal */ - 382, /* (23) alter_account_option ::= STATE literal */ - 383, /* (24) ip_range_list ::= NK_STRING */ - 383, /* (25) ip_range_list ::= ip_range_list NK_COMMA NK_STRING */ - 384, /* (26) white_list ::= HOST ip_range_list */ - 385, /* (27) white_list_opt ::= */ - 385, /* (28) white_list_opt ::= white_list */ - 386, /* (29) is_import_opt ::= */ - 386, /* (30) is_import_opt ::= IS_IMPORT NK_INTEGER */ - 387, /* (31) is_createdb_opt ::= */ - 387, /* (32) is_createdb_opt ::= CREATEDB NK_INTEGER */ - 378, /* (33) cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt is_createdb_opt is_import_opt white_list_opt */ - 378, /* (34) cmd ::= ALTER USER user_name PASS NK_STRING */ - 378, /* (35) cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ - 378, /* (36) cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ - 378, /* (37) cmd ::= ALTER USER user_name CREATEDB NK_INTEGER */ - 378, /* (38) cmd ::= ALTER USER user_name ADD white_list */ - 378, /* (39) cmd ::= ALTER USER user_name DROP white_list */ - 378, /* (40) cmd ::= DROP USER user_name */ - 389, /* (41) sysinfo_opt ::= */ - 389, /* (42) sysinfo_opt ::= SYSINFO NK_INTEGER */ - 378, /* (43) cmd ::= GRANT privileges ON priv_level with_opt TO user_name */ - 378, /* (44) cmd ::= REVOKE privileges ON priv_level with_opt FROM user_name */ - 390, /* (45) privileges ::= ALL */ - 390, /* (46) privileges ::= priv_type_list */ - 390, /* (47) privileges ::= SUBSCRIBE */ - 393, /* (48) priv_type_list ::= priv_type */ - 393, /* (49) priv_type_list ::= priv_type_list NK_COMMA priv_type */ - 394, /* (50) priv_type ::= READ */ - 394, /* (51) priv_type ::= WRITE */ - 394, /* (52) priv_type ::= ALTER */ - 391, /* (53) priv_level ::= NK_STAR NK_DOT NK_STAR */ - 391, /* (54) priv_level ::= db_name NK_DOT NK_STAR */ - 391, /* (55) priv_level ::= db_name NK_DOT table_name */ - 391, /* (56) priv_level ::= topic_name */ - 392, /* (57) with_opt ::= */ - 392, /* (58) with_opt ::= WITH search_condition */ - 378, /* (59) cmd ::= CREATE ENCRYPT_KEY NK_STRING */ - 378, /* (60) cmd ::= CREATE DNODE dnode_endpoint */ - 378, /* (61) cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ - 378, /* (62) cmd ::= DROP DNODE NK_INTEGER force_opt */ - 378, /* (63) cmd ::= DROP DNODE dnode_endpoint force_opt */ - 378, /* (64) cmd ::= DROP DNODE NK_INTEGER unsafe_opt */ - 378, /* (65) cmd ::= DROP DNODE dnode_endpoint unsafe_opt */ - 378, /* (66) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ - 378, /* (67) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ - 378, /* (68) cmd ::= ALTER ALL DNODES NK_STRING */ - 378, /* (69) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ - 378, /* (70) cmd ::= RESTORE DNODE NK_INTEGER */ - 399, /* (71) dnode_endpoint ::= NK_STRING */ - 399, /* (72) dnode_endpoint ::= NK_ID */ - 399, /* (73) dnode_endpoint ::= NK_IPTOKEN */ - 400, /* (74) force_opt ::= */ - 400, /* (75) force_opt ::= FORCE */ - 401, /* (76) unsafe_opt ::= UNSAFE */ - 378, /* (77) cmd ::= ALTER CLUSTER NK_STRING */ - 378, /* (78) cmd ::= ALTER CLUSTER NK_STRING NK_STRING */ - 378, /* (79) cmd ::= ALTER LOCAL NK_STRING */ - 378, /* (80) cmd ::= ALTER LOCAL NK_STRING NK_STRING */ - 378, /* (81) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ - 378, /* (82) cmd ::= DROP QNODE ON DNODE NK_INTEGER */ - 378, /* (83) cmd ::= RESTORE QNODE ON DNODE NK_INTEGER */ - 378, /* (84) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ - 378, /* (85) cmd ::= DROP BNODE ON DNODE NK_INTEGER */ - 378, /* (86) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ - 378, /* (87) cmd ::= DROP SNODE ON DNODE NK_INTEGER */ - 378, /* (88) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ - 378, /* (89) cmd ::= DROP MNODE ON DNODE NK_INTEGER */ - 378, /* (90) cmd ::= RESTORE MNODE ON DNODE NK_INTEGER */ - 378, /* (91) cmd ::= RESTORE VNODE ON DNODE NK_INTEGER */ - 378, /* (92) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ - 378, /* (93) cmd ::= DROP DATABASE exists_opt db_name */ - 378, /* (94) cmd ::= USE db_name */ - 378, /* (95) cmd ::= ALTER DATABASE db_name alter_db_options */ - 378, /* (96) cmd ::= FLUSH DATABASE db_name */ - 378, /* (97) cmd ::= TRIM DATABASE db_name speed_opt */ - 378, /* (98) cmd ::= S3MIGRATE DATABASE db_name */ - 378, /* (99) cmd ::= COMPACT DATABASE db_name start_opt end_opt */ - 402, /* (100) not_exists_opt ::= IF NOT EXISTS */ - 402, /* (101) not_exists_opt ::= */ - 404, /* (102) exists_opt ::= IF EXISTS */ - 404, /* (103) exists_opt ::= */ - 403, /* (104) db_options ::= */ - 403, /* (105) db_options ::= db_options BUFFER NK_INTEGER */ - 403, /* (106) db_options ::= db_options CACHEMODEL NK_STRING */ - 403, /* (107) db_options ::= db_options CACHESIZE NK_INTEGER */ - 403, /* (108) db_options ::= db_options COMP NK_INTEGER */ - 403, /* (109) db_options ::= db_options DURATION NK_INTEGER */ - 403, /* (110) db_options ::= db_options DURATION NK_VARIABLE */ - 403, /* (111) db_options ::= db_options MAXROWS NK_INTEGER */ - 403, /* (112) db_options ::= db_options MINROWS NK_INTEGER */ - 403, /* (113) db_options ::= db_options KEEP integer_list */ - 403, /* (114) db_options ::= db_options KEEP variable_list */ - 403, /* (115) db_options ::= db_options PAGES NK_INTEGER */ - 403, /* (116) db_options ::= db_options PAGESIZE NK_INTEGER */ - 403, /* (117) db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ - 403, /* (118) db_options ::= db_options PRECISION NK_STRING */ - 403, /* (119) db_options ::= db_options REPLICA NK_INTEGER */ - 403, /* (120) db_options ::= db_options VGROUPS NK_INTEGER */ - 403, /* (121) db_options ::= db_options SINGLE_STABLE NK_INTEGER */ - 403, /* (122) db_options ::= db_options RETENTIONS retention_list */ - 403, /* (123) db_options ::= db_options SCHEMALESS NK_INTEGER */ - 403, /* (124) db_options ::= db_options WAL_LEVEL NK_INTEGER */ - 403, /* (125) db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ - 403, /* (126) db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ - 403, /* (127) db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ - 403, /* (128) db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ - 403, /* (129) db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ - 403, /* (130) db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ - 403, /* (131) db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ - 403, /* (132) db_options ::= db_options STT_TRIGGER NK_INTEGER */ - 403, /* (133) db_options ::= db_options TABLE_PREFIX signed */ - 403, /* (134) db_options ::= db_options TABLE_SUFFIX signed */ - 403, /* (135) db_options ::= db_options S3_CHUNKSIZE NK_INTEGER */ - 403, /* (136) db_options ::= db_options S3_KEEPLOCAL NK_INTEGER */ - 403, /* (137) db_options ::= db_options S3_KEEPLOCAL NK_VARIABLE */ - 403, /* (138) db_options ::= db_options S3_COMPACT NK_INTEGER */ - 403, /* (139) db_options ::= db_options KEEP_TIME_OFFSET NK_INTEGER */ - 403, /* (140) db_options ::= db_options ENCRYPT_ALGORITHM NK_STRING */ - 405, /* (141) alter_db_options ::= alter_db_option */ - 405, /* (142) alter_db_options ::= alter_db_options alter_db_option */ - 413, /* (143) alter_db_option ::= BUFFER NK_INTEGER */ - 413, /* (144) alter_db_option ::= CACHEMODEL NK_STRING */ - 413, /* (145) alter_db_option ::= CACHESIZE NK_INTEGER */ - 413, /* (146) alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ - 413, /* (147) alter_db_option ::= KEEP integer_list */ - 413, /* (148) alter_db_option ::= KEEP variable_list */ - 413, /* (149) alter_db_option ::= PAGES NK_INTEGER */ - 413, /* (150) alter_db_option ::= REPLICA NK_INTEGER */ - 413, /* (151) alter_db_option ::= WAL_LEVEL NK_INTEGER */ - 413, /* (152) alter_db_option ::= STT_TRIGGER NK_INTEGER */ - 413, /* (153) alter_db_option ::= MINROWS NK_INTEGER */ - 413, /* (154) alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */ - 413, /* (155) alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ - 413, /* (156) alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */ - 413, /* (157) alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ - 413, /* (158) alter_db_option ::= S3_KEEPLOCAL NK_INTEGER */ - 413, /* (159) alter_db_option ::= S3_KEEPLOCAL NK_VARIABLE */ - 413, /* (160) alter_db_option ::= S3_COMPACT NK_INTEGER */ - 413, /* (161) alter_db_option ::= KEEP_TIME_OFFSET NK_INTEGER */ - 413, /* (162) alter_db_option ::= ENCRYPT_ALGORITHM NK_STRING */ - 409, /* (163) integer_list ::= NK_INTEGER */ - 409, /* (164) integer_list ::= integer_list NK_COMMA NK_INTEGER */ - 410, /* (165) variable_list ::= NK_VARIABLE */ - 410, /* (166) variable_list ::= variable_list NK_COMMA NK_VARIABLE */ - 411, /* (167) retention_list ::= retention */ - 411, /* (168) retention_list ::= retention_list NK_COMMA retention */ - 414, /* (169) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ - 414, /* (170) retention ::= NK_MINUS NK_COLON NK_VARIABLE */ - 406, /* (171) speed_opt ::= */ - 406, /* (172) speed_opt ::= BWLIMIT NK_INTEGER */ - 407, /* (173) start_opt ::= */ - 407, /* (174) start_opt ::= START WITH NK_INTEGER */ - 407, /* (175) start_opt ::= START WITH NK_STRING */ - 407, /* (176) start_opt ::= START WITH TIMESTAMP NK_STRING */ - 408, /* (177) end_opt ::= */ - 408, /* (178) end_opt ::= END WITH NK_INTEGER */ - 408, /* (179) end_opt ::= END WITH NK_STRING */ - 408, /* (180) end_opt ::= END WITH TIMESTAMP NK_STRING */ - 378, /* (181) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ - 378, /* (182) cmd ::= CREATE TABLE multi_create_clause */ - 378, /* (183) cmd ::= CREATE TABLE not_exists_opt USING full_table_name NK_LP tag_list_opt NK_RP FILE NK_STRING */ - 378, /* (184) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ - 378, /* (185) cmd ::= DROP TABLE multi_drop_clause */ - 378, /* (186) cmd ::= DROP STABLE exists_opt full_table_name */ - 378, /* (187) cmd ::= ALTER TABLE alter_table_clause */ - 378, /* (188) cmd ::= ALTER STABLE alter_table_clause */ - 423, /* (189) alter_table_clause ::= full_table_name alter_table_options */ - 423, /* (190) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name column_options */ - 423, /* (191) alter_table_clause ::= full_table_name DROP COLUMN column_name */ - 423, /* (192) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ - 423, /* (193) alter_table_clause ::= full_table_name MODIFY COLUMN column_name column_options */ - 423, /* (194) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ - 423, /* (195) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ - 423, /* (196) alter_table_clause ::= full_table_name DROP TAG column_name */ - 423, /* (197) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ - 423, /* (198) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ - 423, /* (199) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ tags_literal */ - 419, /* (200) multi_create_clause ::= create_subtable_clause */ - 419, /* (201) multi_create_clause ::= multi_create_clause create_subtable_clause */ - 429, /* (202) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP tags_literal_list NK_RP table_options */ - 422, /* (203) multi_drop_clause ::= drop_table_clause */ - 422, /* (204) multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ - 432, /* (205) drop_table_clause ::= exists_opt full_table_name */ - 430, /* (206) specific_cols_opt ::= */ - 430, /* (207) specific_cols_opt ::= NK_LP col_name_list NK_RP */ - 415, /* (208) full_table_name ::= table_name */ - 415, /* (209) full_table_name ::= db_name NK_DOT table_name */ - 434, /* (210) tag_def_list ::= tag_def */ - 434, /* (211) tag_def_list ::= tag_def_list NK_COMMA tag_def */ - 435, /* (212) tag_def ::= column_name type_name */ - 416, /* (213) column_def_list ::= column_def */ - 416, /* (214) column_def_list ::= column_def_list NK_COMMA column_def */ - 436, /* (215) column_def ::= column_name type_name column_options */ - 426, /* (216) type_name ::= BOOL */ - 426, /* (217) type_name ::= TINYINT */ - 426, /* (218) type_name ::= SMALLINT */ - 426, /* (219) type_name ::= INT */ - 426, /* (220) type_name ::= INTEGER */ - 426, /* (221) type_name ::= BIGINT */ - 426, /* (222) type_name ::= FLOAT */ - 426, /* (223) type_name ::= DOUBLE */ - 426, /* (224) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ - 426, /* (225) type_name ::= TIMESTAMP */ - 426, /* (226) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ - 426, /* (227) type_name ::= TINYINT UNSIGNED */ - 426, /* (228) type_name ::= SMALLINT UNSIGNED */ - 426, /* (229) type_name ::= INT UNSIGNED */ - 426, /* (230) type_name ::= BIGINT UNSIGNED */ - 426, /* (231) type_name ::= JSON */ - 426, /* (232) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ - 426, /* (233) type_name ::= MEDIUMBLOB */ - 426, /* (234) type_name ::= BLOB */ - 426, /* (235) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ - 426, /* (236) type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ - 426, /* (237) type_name ::= DECIMAL */ - 426, /* (238) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ - 426, /* (239) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - 437, /* (240) type_name_default_len ::= BINARY */ - 437, /* (241) type_name_default_len ::= NCHAR */ - 437, /* (242) type_name_default_len ::= VARCHAR */ - 437, /* (243) type_name_default_len ::= VARBINARY */ - 417, /* (244) tags_def_opt ::= */ - 417, /* (245) tags_def_opt ::= tags_def */ - 421, /* (246) tags_def ::= TAGS NK_LP tag_def_list NK_RP */ - 418, /* (247) table_options ::= */ - 418, /* (248) table_options ::= table_options COMMENT NK_STRING */ - 418, /* (249) table_options ::= table_options MAX_DELAY duration_list */ - 418, /* (250) table_options ::= table_options WATERMARK duration_list */ - 418, /* (251) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ - 418, /* (252) table_options ::= table_options TTL NK_INTEGER */ - 418, /* (253) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ - 418, /* (254) table_options ::= table_options DELETE_MARK duration_list */ - 424, /* (255) alter_table_options ::= alter_table_option */ - 424, /* (256) alter_table_options ::= alter_table_options alter_table_option */ - 440, /* (257) alter_table_option ::= COMMENT NK_STRING */ - 440, /* (258) alter_table_option ::= TTL NK_INTEGER */ - 438, /* (259) duration_list ::= duration_literal */ - 438, /* (260) duration_list ::= duration_list NK_COMMA duration_literal */ - 439, /* (261) rollup_func_list ::= rollup_func_name */ - 439, /* (262) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ - 442, /* (263) rollup_func_name ::= function_name */ - 442, /* (264) rollup_func_name ::= FIRST */ - 442, /* (265) rollup_func_name ::= LAST */ - 433, /* (266) col_name_list ::= col_name */ - 433, /* (267) col_name_list ::= col_name_list NK_COMMA col_name */ - 444, /* (268) col_name ::= column_name */ - 378, /* (269) cmd ::= SHOW DNODES */ - 378, /* (270) cmd ::= SHOW USERS */ - 378, /* (271) cmd ::= SHOW USERS FULL */ - 378, /* (272) cmd ::= SHOW USER PRIVILEGES */ - 378, /* (273) cmd ::= SHOW db_kind_opt DATABASES */ - 378, /* (274) cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */ - 378, /* (275) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ - 378, /* (276) cmd ::= SHOW db_name_cond_opt VGROUPS */ - 378, /* (277) cmd ::= SHOW MNODES */ - 378, /* (278) cmd ::= SHOW QNODES */ - 378, /* (279) cmd ::= SHOW ARBGROUPS */ - 378, /* (280) cmd ::= SHOW FUNCTIONS */ - 378, /* (281) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ - 378, /* (282) cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ - 378, /* (283) cmd ::= SHOW STREAMS */ - 378, /* (284) cmd ::= SHOW ACCOUNTS */ - 378, /* (285) cmd ::= SHOW APPS */ - 378, /* (286) cmd ::= SHOW CONNECTIONS */ - 378, /* (287) cmd ::= SHOW LICENCES */ - 378, /* (288) cmd ::= SHOW GRANTS */ - 378, /* (289) cmd ::= SHOW GRANTS FULL */ - 378, /* (290) cmd ::= SHOW GRANTS LOGS */ - 378, /* (291) cmd ::= SHOW CLUSTER MACHINES */ - 378, /* (292) cmd ::= SHOW CREATE DATABASE db_name */ - 378, /* (293) cmd ::= SHOW CREATE TABLE full_table_name */ - 378, /* (294) cmd ::= SHOW CREATE STABLE full_table_name */ - 378, /* (295) cmd ::= SHOW ENCRYPTIONS */ - 378, /* (296) cmd ::= SHOW QUERIES */ - 378, /* (297) cmd ::= SHOW SCORES */ - 378, /* (298) cmd ::= SHOW TOPICS */ - 378, /* (299) cmd ::= SHOW VARIABLES */ - 378, /* (300) cmd ::= SHOW CLUSTER VARIABLES */ - 378, /* (301) cmd ::= SHOW LOCAL VARIABLES */ - 378, /* (302) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ - 378, /* (303) cmd ::= SHOW BNODES */ - 378, /* (304) cmd ::= SHOW SNODES */ - 378, /* (305) cmd ::= SHOW CLUSTER */ - 378, /* (306) cmd ::= SHOW TRANSACTIONS */ - 378, /* (307) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ - 378, /* (308) cmd ::= SHOW CONSUMERS */ - 378, /* (309) cmd ::= SHOW SUBSCRIPTIONS */ - 378, /* (310) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ - 378, /* (311) cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ - 378, /* (312) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ - 378, /* (313) cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ - 378, /* (314) cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ - 378, /* (315) cmd ::= SHOW VNODES */ - 378, /* (316) cmd ::= SHOW db_name_cond_opt ALIVE */ - 378, /* (317) cmd ::= SHOW CLUSTER ALIVE */ - 378, /* (318) cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt */ - 378, /* (319) cmd ::= SHOW CREATE VIEW full_table_name */ - 378, /* (320) cmd ::= SHOW COMPACTS */ - 378, /* (321) cmd ::= SHOW COMPACT NK_INTEGER */ - 446, /* (322) table_kind_db_name_cond_opt ::= */ - 446, /* (323) table_kind_db_name_cond_opt ::= table_kind */ - 446, /* (324) table_kind_db_name_cond_opt ::= db_name NK_DOT */ - 446, /* (325) table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */ - 451, /* (326) table_kind ::= NORMAL */ - 451, /* (327) table_kind ::= CHILD */ - 448, /* (328) db_name_cond_opt ::= */ - 448, /* (329) db_name_cond_opt ::= db_name NK_DOT */ - 447, /* (330) like_pattern_opt ::= */ - 447, /* (331) like_pattern_opt ::= LIKE NK_STRING */ - 449, /* (332) table_name_cond ::= table_name */ - 450, /* (333) from_db_opt ::= */ - 450, /* (334) from_db_opt ::= FROM db_name */ - 420, /* (335) tag_list_opt ::= */ - 420, /* (336) tag_list_opt ::= tag_item */ - 420, /* (337) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ - 452, /* (338) tag_item ::= TBNAME */ - 452, /* (339) tag_item ::= QTAGS */ - 452, /* (340) tag_item ::= column_name */ - 452, /* (341) tag_item ::= column_name column_alias */ - 452, /* (342) tag_item ::= column_name AS column_alias */ - 445, /* (343) db_kind_opt ::= */ - 445, /* (344) db_kind_opt ::= USER */ - 445, /* (345) db_kind_opt ::= SYSTEM */ - 378, /* (346) cmd ::= CREATE TSMA not_exists_opt tsma_name ON full_table_name tsma_func_list INTERVAL NK_LP duration_literal NK_RP */ - 378, /* (347) cmd ::= CREATE RECURSIVE TSMA not_exists_opt tsma_name ON full_table_name INTERVAL NK_LP duration_literal NK_RP */ - 378, /* (348) cmd ::= DROP TSMA exists_opt full_tsma_name */ - 378, /* (349) cmd ::= SHOW db_name_cond_opt TSMAS */ - 456, /* (350) full_tsma_name ::= tsma_name */ - 456, /* (351) full_tsma_name ::= db_name NK_DOT tsma_name */ - 455, /* (352) tsma_func_list ::= FUNCTION NK_LP func_list NK_RP */ - 378, /* (353) cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */ - 378, /* (354) cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */ - 378, /* (355) cmd ::= DROP INDEX exists_opt full_index_name */ - 459, /* (356) full_index_name ::= index_name */ - 459, /* (357) full_index_name ::= db_name NK_DOT index_name */ - 458, /* (358) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ - 458, /* (359) 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 */ - 457, /* (360) func_list ::= func */ - 457, /* (361) func_list ::= func_list NK_COMMA func */ - 463, /* (362) func ::= sma_func_name NK_LP expression_list NK_RP */ - 464, /* (363) sma_func_name ::= function_name */ - 464, /* (364) sma_func_name ::= COUNT */ - 464, /* (365) sma_func_name ::= FIRST */ - 464, /* (366) sma_func_name ::= LAST */ - 464, /* (367) sma_func_name ::= LAST_ROW */ - 462, /* (368) sma_stream_opt ::= */ - 462, /* (369) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ - 462, /* (370) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ - 462, /* (371) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ - 466, /* (372) with_meta ::= AS */ - 466, /* (373) with_meta ::= WITH META AS */ - 466, /* (374) with_meta ::= ONLY META AS */ - 378, /* (375) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ - 378, /* (376) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ - 378, /* (377) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ - 378, /* (378) cmd ::= DROP TOPIC exists_opt topic_name */ - 378, /* (379) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ - 378, /* (380) cmd ::= DESC full_table_name */ - 378, /* (381) cmd ::= DESCRIBE full_table_name */ - 378, /* (382) cmd ::= RESET QUERY CACHE */ - 378, /* (383) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ - 378, /* (384) cmd ::= EXPLAIN analyze_opt explain_options insert_query */ - 470, /* (385) analyze_opt ::= */ - 470, /* (386) analyze_opt ::= ANALYZE */ - 471, /* (387) explain_options ::= */ - 471, /* (388) explain_options ::= explain_options VERBOSE NK_BOOL */ - 471, /* (389) explain_options ::= explain_options RATIO NK_FLOAT */ - 378, /* (390) cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ - 378, /* (391) cmd ::= DROP FUNCTION exists_opt function_name */ - 474, /* (392) agg_func_opt ::= */ - 474, /* (393) agg_func_opt ::= AGGREGATE */ - 475, /* (394) bufsize_opt ::= */ - 475, /* (395) bufsize_opt ::= BUFSIZE NK_INTEGER */ - 476, /* (396) language_opt ::= */ - 476, /* (397) language_opt ::= LANGUAGE NK_STRING */ - 473, /* (398) or_replace_opt ::= */ - 473, /* (399) or_replace_opt ::= OR REPLACE */ - 378, /* (400) cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */ - 378, /* (401) cmd ::= DROP VIEW exists_opt full_view_name */ - 477, /* (402) full_view_name ::= view_name */ - 477, /* (403) full_view_name ::= db_name NK_DOT view_name */ - 378, /* (404) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */ - 378, /* (405) cmd ::= DROP STREAM exists_opt stream_name */ - 378, /* (406) cmd ::= PAUSE STREAM exists_opt stream_name */ - 378, /* (407) cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ - 481, /* (408) col_list_opt ::= */ - 481, /* (409) col_list_opt ::= NK_LP column_stream_def_list NK_RP */ - 485, /* (410) column_stream_def_list ::= column_stream_def */ - 485, /* (411) column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def */ - 486, /* (412) column_stream_def ::= column_name stream_col_options */ - 487, /* (413) stream_col_options ::= */ - 487, /* (414) stream_col_options ::= stream_col_options PRIMARY KEY */ - 482, /* (415) tag_def_or_ref_opt ::= */ - 482, /* (416) tag_def_or_ref_opt ::= tags_def */ - 482, /* (417) tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP */ - 480, /* (418) stream_options ::= */ - 480, /* (419) stream_options ::= stream_options TRIGGER AT_ONCE */ - 480, /* (420) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ - 480, /* (421) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ - 480, /* (422) stream_options ::= stream_options WATERMARK duration_literal */ - 480, /* (423) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ - 480, /* (424) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ - 480, /* (425) stream_options ::= stream_options DELETE_MARK duration_literal */ - 480, /* (426) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ - 483, /* (427) subtable_opt ::= */ - 483, /* (428) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - 484, /* (429) ignore_opt ::= */ - 484, /* (430) ignore_opt ::= IGNORE UNTREATED */ - 378, /* (431) cmd ::= KILL CONNECTION NK_INTEGER */ - 378, /* (432) cmd ::= KILL QUERY NK_STRING */ - 378, /* (433) cmd ::= KILL TRANSACTION NK_INTEGER */ - 378, /* (434) cmd ::= KILL COMPACT NK_INTEGER */ - 378, /* (435) cmd ::= BALANCE VGROUP */ - 378, /* (436) cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ - 378, /* (437) cmd ::= BALANCE VGROUP LEADER DATABASE db_name */ - 378, /* (438) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ - 378, /* (439) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ - 378, /* (440) cmd ::= SPLIT VGROUP NK_INTEGER */ - 489, /* (441) on_vgroup_id ::= */ - 489, /* (442) on_vgroup_id ::= ON NK_INTEGER */ - 490, /* (443) dnode_list ::= DNODE NK_INTEGER */ - 490, /* (444) dnode_list ::= dnode_list DNODE NK_INTEGER */ - 378, /* (445) cmd ::= DELETE FROM full_table_name where_clause_opt */ - 378, /* (446) cmd ::= query_or_subquery */ - 378, /* (447) cmd ::= insert_query */ - 472, /* (448) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ - 472, /* (449) insert_query ::= INSERT INTO full_table_name query_or_subquery */ - 428, /* (450) tags_literal ::= NK_INTEGER */ - 428, /* (451) tags_literal ::= NK_INTEGER NK_PLUS duration_literal */ - 428, /* (452) tags_literal ::= NK_INTEGER NK_MINUS duration_literal */ - 428, /* (453) tags_literal ::= NK_PLUS NK_INTEGER */ - 428, /* (454) tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal */ - 428, /* (455) tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal */ - 428, /* (456) tags_literal ::= NK_MINUS NK_INTEGER */ - 428, /* (457) tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal */ - 428, /* (458) tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal */ - 428, /* (459) tags_literal ::= NK_FLOAT */ - 428, /* (460) tags_literal ::= NK_PLUS NK_FLOAT */ - 428, /* (461) tags_literal ::= NK_MINUS NK_FLOAT */ - 428, /* (462) tags_literal ::= NK_BIN */ - 428, /* (463) tags_literal ::= NK_BIN NK_PLUS duration_literal */ - 428, /* (464) tags_literal ::= NK_BIN NK_MINUS duration_literal */ - 428, /* (465) tags_literal ::= NK_PLUS NK_BIN */ - 428, /* (466) tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal */ - 428, /* (467) tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal */ - 428, /* (468) tags_literal ::= NK_MINUS NK_BIN */ - 428, /* (469) tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal */ - 428, /* (470) tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal */ - 428, /* (471) tags_literal ::= NK_HEX */ - 428, /* (472) tags_literal ::= NK_HEX NK_PLUS duration_literal */ - 428, /* (473) tags_literal ::= NK_HEX NK_MINUS duration_literal */ - 428, /* (474) tags_literal ::= NK_PLUS NK_HEX */ - 428, /* (475) tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal */ - 428, /* (476) tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal */ - 428, /* (477) tags_literal ::= NK_MINUS NK_HEX */ - 428, /* (478) tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal */ - 428, /* (479) tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal */ - 428, /* (480) tags_literal ::= NK_STRING */ - 428, /* (481) tags_literal ::= NK_STRING NK_PLUS duration_literal */ - 428, /* (482) tags_literal ::= NK_STRING NK_MINUS duration_literal */ - 428, /* (483) tags_literal ::= NK_BOOL */ - 428, /* (484) tags_literal ::= NULL */ - 428, /* (485) tags_literal ::= literal_func */ - 428, /* (486) tags_literal ::= literal_func NK_PLUS duration_literal */ - 428, /* (487) tags_literal ::= literal_func NK_MINUS duration_literal */ - 431, /* (488) tags_literal_list ::= tags_literal */ - 431, /* (489) tags_literal_list ::= tags_literal_list NK_COMMA tags_literal */ - 381, /* (490) literal ::= NK_INTEGER */ - 381, /* (491) literal ::= NK_FLOAT */ - 381, /* (492) literal ::= NK_STRING */ - 381, /* (493) literal ::= NK_BOOL */ - 381, /* (494) literal ::= TIMESTAMP NK_STRING */ - 381, /* (495) literal ::= duration_literal */ - 381, /* (496) literal ::= NULL */ - 381, /* (497) literal ::= NK_QUESTION */ - 441, /* (498) duration_literal ::= NK_VARIABLE */ - 412, /* (499) signed ::= NK_INTEGER */ - 412, /* (500) signed ::= NK_PLUS NK_INTEGER */ - 412, /* (501) signed ::= NK_MINUS NK_INTEGER */ - 412, /* (502) signed ::= NK_FLOAT */ - 412, /* (503) signed ::= NK_PLUS NK_FLOAT */ - 412, /* (504) signed ::= NK_MINUS NK_FLOAT */ - 492, /* (505) signed_literal ::= signed */ - 492, /* (506) signed_literal ::= NK_STRING */ - 492, /* (507) signed_literal ::= NK_BOOL */ - 492, /* (508) signed_literal ::= TIMESTAMP NK_STRING */ - 492, /* (509) signed_literal ::= duration_literal */ - 492, /* (510) signed_literal ::= NULL */ - 492, /* (511) signed_literal ::= literal_func */ - 492, /* (512) signed_literal ::= NK_QUESTION */ - 493, /* (513) literal_list ::= signed_literal */ - 493, /* (514) literal_list ::= literal_list NK_COMMA signed_literal */ - 395, /* (515) db_name ::= NK_ID */ - 396, /* (516) table_name ::= NK_ID */ - 425, /* (517) column_name ::= NK_ID */ - 443, /* (518) function_name ::= NK_ID */ - 478, /* (519) view_name ::= NK_ID */ - 494, /* (520) table_alias ::= NK_ID */ - 453, /* (521) column_alias ::= NK_ID */ - 453, /* (522) column_alias ::= NK_ALIAS */ - 388, /* (523) user_name ::= NK_ID */ - 397, /* (524) topic_name ::= NK_ID */ - 479, /* (525) stream_name ::= NK_ID */ - 469, /* (526) cgroup_name ::= NK_ID */ - 460, /* (527) index_name ::= NK_ID */ - 454, /* (528) tsma_name ::= NK_ID */ - 495, /* (529) expr_or_subquery ::= expression */ - 488, /* (530) expression ::= literal */ - 488, /* (531) expression ::= pseudo_column */ - 488, /* (532) expression ::= column_reference */ - 488, /* (533) expression ::= function_expression */ - 488, /* (534) expression ::= case_when_expression */ - 488, /* (535) expression ::= NK_LP expression NK_RP */ - 488, /* (536) expression ::= NK_PLUS expr_or_subquery */ - 488, /* (537) expression ::= NK_MINUS expr_or_subquery */ - 488, /* (538) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ - 488, /* (539) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ - 488, /* (540) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ - 488, /* (541) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ - 488, /* (542) expression ::= expr_or_subquery NK_REM expr_or_subquery */ - 488, /* (543) expression ::= column_reference NK_ARROW NK_STRING */ - 488, /* (544) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ - 488, /* (545) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ - 465, /* (546) expression_list ::= expr_or_subquery */ - 465, /* (547) expression_list ::= expression_list NK_COMMA expr_or_subquery */ - 497, /* (548) column_reference ::= column_name */ - 497, /* (549) column_reference ::= table_name NK_DOT column_name */ - 497, /* (550) column_reference ::= NK_ALIAS */ - 497, /* (551) column_reference ::= table_name NK_DOT NK_ALIAS */ - 496, /* (552) pseudo_column ::= ROWTS */ - 496, /* (553) pseudo_column ::= TBNAME */ - 496, /* (554) pseudo_column ::= table_name NK_DOT TBNAME */ - 496, /* (555) pseudo_column ::= QSTART */ - 496, /* (556) pseudo_column ::= QEND */ - 496, /* (557) pseudo_column ::= QDURATION */ - 496, /* (558) pseudo_column ::= WSTART */ - 496, /* (559) pseudo_column ::= WEND */ - 496, /* (560) pseudo_column ::= WDURATION */ - 496, /* (561) pseudo_column ::= IROWTS */ - 496, /* (562) pseudo_column ::= ISFILLED */ - 496, /* (563) pseudo_column ::= QTAGS */ - 498, /* (564) function_expression ::= function_name NK_LP expression_list NK_RP */ - 498, /* (565) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ - 498, /* (566) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ - 498, /* (567) function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP */ - 498, /* (568) function_expression ::= literal_func */ - 491, /* (569) literal_func ::= noarg_func NK_LP NK_RP */ - 491, /* (570) literal_func ::= NOW */ - 491, /* (571) literal_func ::= TODAY */ - 502, /* (572) noarg_func ::= NOW */ - 502, /* (573) noarg_func ::= TODAY */ - 502, /* (574) noarg_func ::= TIMEZONE */ - 502, /* (575) noarg_func ::= DATABASE */ - 502, /* (576) noarg_func ::= CLIENT_VERSION */ - 502, /* (577) noarg_func ::= SERVER_VERSION */ - 502, /* (578) noarg_func ::= SERVER_STATUS */ - 502, /* (579) noarg_func ::= CURRENT_USER */ - 502, /* (580) noarg_func ::= USER */ - 500, /* (581) star_func ::= COUNT */ - 500, /* (582) star_func ::= FIRST */ - 500, /* (583) star_func ::= LAST */ - 500, /* (584) star_func ::= LAST_ROW */ - 501, /* (585) star_func_para_list ::= NK_STAR */ - 501, /* (586) star_func_para_list ::= other_para_list */ - 503, /* (587) other_para_list ::= star_func_para */ - 503, /* (588) other_para_list ::= other_para_list NK_COMMA star_func_para */ - 504, /* (589) star_func_para ::= expr_or_subquery */ - 504, /* (590) star_func_para ::= table_name NK_DOT NK_STAR */ - 499, /* (591) case_when_expression ::= CASE when_then_list case_when_else_opt END */ - 499, /* (592) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ - 505, /* (593) when_then_list ::= when_then_expr */ - 505, /* (594) when_then_list ::= when_then_list when_then_expr */ - 508, /* (595) when_then_expr ::= WHEN common_expression THEN common_expression */ - 506, /* (596) case_when_else_opt ::= */ - 506, /* (597) case_when_else_opt ::= ELSE common_expression */ - 509, /* (598) predicate ::= expr_or_subquery compare_op expr_or_subquery */ - 509, /* (599) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ - 509, /* (600) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ - 509, /* (601) predicate ::= expr_or_subquery IS NULL */ - 509, /* (602) predicate ::= expr_or_subquery IS NOT NULL */ - 509, /* (603) predicate ::= expr_or_subquery in_op in_predicate_value */ - 510, /* (604) compare_op ::= NK_LT */ - 510, /* (605) compare_op ::= NK_GT */ - 510, /* (606) compare_op ::= NK_LE */ - 510, /* (607) compare_op ::= NK_GE */ - 510, /* (608) compare_op ::= NK_NE */ - 510, /* (609) compare_op ::= NK_EQ */ - 510, /* (610) compare_op ::= LIKE */ - 510, /* (611) compare_op ::= NOT LIKE */ - 510, /* (612) compare_op ::= MATCH */ - 510, /* (613) compare_op ::= NMATCH */ - 510, /* (614) compare_op ::= CONTAINS */ - 511, /* (615) in_op ::= IN */ - 511, /* (616) in_op ::= NOT IN */ - 512, /* (617) in_predicate_value ::= NK_LP literal_list NK_RP */ - 513, /* (618) boolean_value_expression ::= boolean_primary */ - 513, /* (619) boolean_value_expression ::= NOT boolean_primary */ - 513, /* (620) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - 513, /* (621) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - 514, /* (622) boolean_primary ::= predicate */ - 514, /* (623) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ - 507, /* (624) common_expression ::= expr_or_subquery */ - 507, /* (625) common_expression ::= boolean_value_expression */ - 515, /* (626) from_clause_opt ::= */ - 515, /* (627) from_clause_opt ::= FROM table_reference_list */ - 516, /* (628) table_reference_list ::= table_reference */ - 516, /* (629) table_reference_list ::= table_reference_list NK_COMMA table_reference */ - 517, /* (630) table_reference ::= table_primary */ - 517, /* (631) table_reference ::= joined_table */ - 518, /* (632) table_primary ::= table_name alias_opt */ - 518, /* (633) table_primary ::= db_name NK_DOT table_name alias_opt */ - 518, /* (634) table_primary ::= subquery alias_opt */ - 518, /* (635) table_primary ::= parenthesized_joined_table */ - 520, /* (636) alias_opt ::= */ - 520, /* (637) alias_opt ::= table_alias */ - 520, /* (638) alias_opt ::= AS table_alias */ - 522, /* (639) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - 522, /* (640) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ - 519, /* (641) joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt */ - 523, /* (642) join_type ::= */ - 523, /* (643) join_type ::= INNER */ - 523, /* (644) join_type ::= LEFT */ - 523, /* (645) join_type ::= RIGHT */ - 523, /* (646) join_type ::= FULL */ - 524, /* (647) join_subtype ::= */ - 524, /* (648) join_subtype ::= OUTER */ - 524, /* (649) join_subtype ::= SEMI */ - 524, /* (650) join_subtype ::= ANTI */ - 524, /* (651) join_subtype ::= ASOF */ - 524, /* (652) join_subtype ::= WINDOW */ - 525, /* (653) join_on_clause_opt ::= */ - 525, /* (654) join_on_clause_opt ::= ON search_condition */ - 526, /* (655) window_offset_clause_opt ::= */ - 526, /* (656) window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP */ - 528, /* (657) window_offset_literal ::= NK_VARIABLE */ - 528, /* (658) window_offset_literal ::= NK_MINUS NK_VARIABLE */ - 527, /* (659) jlimit_clause_opt ::= */ - 527, /* (660) jlimit_clause_opt ::= JLIMIT NK_INTEGER */ - 529, /* (661) query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_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 */ - 530, /* (662) hint_list ::= */ - 530, /* (663) hint_list ::= NK_HINT */ - 532, /* (664) tag_mode_opt ::= */ - 532, /* (665) tag_mode_opt ::= TAGS */ - 531, /* (666) set_quantifier_opt ::= */ - 531, /* (667) set_quantifier_opt ::= DISTINCT */ - 531, /* (668) set_quantifier_opt ::= ALL */ - 533, /* (669) select_list ::= select_item */ - 533, /* (670) select_list ::= select_list NK_COMMA select_item */ - 541, /* (671) select_item ::= NK_STAR */ - 541, /* (672) select_item ::= common_expression */ - 541, /* (673) select_item ::= common_expression column_alias */ - 541, /* (674) select_item ::= common_expression AS column_alias */ - 541, /* (675) select_item ::= table_name NK_DOT NK_STAR */ - 468, /* (676) where_clause_opt ::= */ - 468, /* (677) where_clause_opt ::= WHERE search_condition */ - 534, /* (678) partition_by_clause_opt ::= */ - 534, /* (679) partition_by_clause_opt ::= PARTITION BY partition_list */ - 542, /* (680) partition_list ::= partition_item */ - 542, /* (681) partition_list ::= partition_list NK_COMMA partition_item */ - 543, /* (682) partition_item ::= expr_or_subquery */ - 543, /* (683) partition_item ::= expr_or_subquery column_alias */ - 543, /* (684) partition_item ::= expr_or_subquery AS column_alias */ - 538, /* (685) twindow_clause_opt ::= */ - 538, /* (686) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ - 538, /* (687) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ - 538, /* (688) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ - 538, /* (689) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ - 538, /* (690) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ - 538, /* (691) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */ - 538, /* (692) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - 461, /* (693) sliding_opt ::= */ - 461, /* (694) sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ - 544, /* (695) interval_sliding_duration_literal ::= NK_VARIABLE */ - 544, /* (696) interval_sliding_duration_literal ::= NK_STRING */ - 544, /* (697) interval_sliding_duration_literal ::= NK_INTEGER */ - 537, /* (698) fill_opt ::= */ - 537, /* (699) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - 537, /* (700) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ - 537, /* (701) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ - 545, /* (702) fill_mode ::= NONE */ - 545, /* (703) fill_mode ::= PREV */ - 545, /* (704) fill_mode ::= NULL */ - 545, /* (705) fill_mode ::= NULL_F */ - 545, /* (706) fill_mode ::= LINEAR */ - 545, /* (707) fill_mode ::= NEXT */ - 539, /* (708) group_by_clause_opt ::= */ - 539, /* (709) group_by_clause_opt ::= GROUP BY group_by_list */ - 546, /* (710) group_by_list ::= expr_or_subquery */ - 546, /* (711) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ - 540, /* (712) having_clause_opt ::= */ - 540, /* (713) having_clause_opt ::= HAVING search_condition */ - 535, /* (714) range_opt ::= */ - 535, /* (715) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ - 535, /* (716) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ - 536, /* (717) every_opt ::= */ - 536, /* (718) every_opt ::= EVERY NK_LP duration_literal NK_RP */ - 547, /* (719) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ - 548, /* (720) query_simple ::= query_specification */ - 548, /* (721) query_simple ::= union_query_expression */ - 552, /* (722) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ - 552, /* (723) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ - 553, /* (724) query_simple_or_subquery ::= query_simple */ - 553, /* (725) query_simple_or_subquery ::= subquery */ - 467, /* (726) query_or_subquery ::= query_expression */ - 467, /* (727) query_or_subquery ::= subquery */ - 549, /* (728) order_by_clause_opt ::= */ - 549, /* (729) order_by_clause_opt ::= ORDER BY sort_specification_list */ - 550, /* (730) slimit_clause_opt ::= */ - 550, /* (731) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - 550, /* (732) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - 550, /* (733) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - 551, /* (734) limit_clause_opt ::= */ - 551, /* (735) limit_clause_opt ::= LIMIT NK_INTEGER */ - 551, /* (736) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - 551, /* (737) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - 521, /* (738) subquery ::= NK_LP query_expression NK_RP */ - 521, /* (739) subquery ::= NK_LP subquery NK_RP */ - 398, /* (740) search_condition ::= common_expression */ - 554, /* (741) sort_specification_list ::= sort_specification */ - 554, /* (742) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - 555, /* (743) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ - 556, /* (744) ordering_specification_opt ::= */ - 556, /* (745) ordering_specification_opt ::= ASC */ - 556, /* (746) ordering_specification_opt ::= DESC */ - 557, /* (747) null_ordering_opt ::= */ - 557, /* (748) null_ordering_opt ::= NULLS FIRST */ - 557, /* (749) null_ordering_opt ::= NULLS LAST */ - 427, /* (750) column_options ::= */ - 427, /* (751) column_options ::= column_options PRIMARY KEY */ - 427, /* (752) column_options ::= column_options ENCODE NK_STRING */ - 427, /* (753) column_options ::= column_options COMPRESS NK_STRING */ - 427, /* (754) column_options ::= column_options LEVEL NK_STRING */ + 379, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ + 379, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ + 380, /* (2) account_options ::= */ + 380, /* (3) account_options ::= account_options PPS literal */ + 380, /* (4) account_options ::= account_options TSERIES literal */ + 380, /* (5) account_options ::= account_options STORAGE literal */ + 380, /* (6) account_options ::= account_options STREAMS literal */ + 380, /* (7) account_options ::= account_options QTIME literal */ + 380, /* (8) account_options ::= account_options DBS literal */ + 380, /* (9) account_options ::= account_options USERS literal */ + 380, /* (10) account_options ::= account_options CONNS literal */ + 380, /* (11) account_options ::= account_options STATE literal */ + 381, /* (12) alter_account_options ::= alter_account_option */ + 381, /* (13) alter_account_options ::= alter_account_options alter_account_option */ + 383, /* (14) alter_account_option ::= PASS literal */ + 383, /* (15) alter_account_option ::= PPS literal */ + 383, /* (16) alter_account_option ::= TSERIES literal */ + 383, /* (17) alter_account_option ::= STORAGE literal */ + 383, /* (18) alter_account_option ::= STREAMS literal */ + 383, /* (19) alter_account_option ::= QTIME literal */ + 383, /* (20) alter_account_option ::= DBS literal */ + 383, /* (21) alter_account_option ::= USERS literal */ + 383, /* (22) alter_account_option ::= CONNS literal */ + 383, /* (23) alter_account_option ::= STATE literal */ + 384, /* (24) ip_range_list ::= NK_STRING */ + 384, /* (25) ip_range_list ::= ip_range_list NK_COMMA NK_STRING */ + 385, /* (26) white_list ::= HOST ip_range_list */ + 386, /* (27) white_list_opt ::= */ + 386, /* (28) white_list_opt ::= white_list */ + 387, /* (29) is_import_opt ::= */ + 387, /* (30) is_import_opt ::= IS_IMPORT NK_INTEGER */ + 388, /* (31) is_createdb_opt ::= */ + 388, /* (32) is_createdb_opt ::= CREATEDB NK_INTEGER */ + 379, /* (33) cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt is_createdb_opt is_import_opt white_list_opt */ + 379, /* (34) cmd ::= ALTER USER user_name PASS NK_STRING */ + 379, /* (35) cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ + 379, /* (36) cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ + 379, /* (37) cmd ::= ALTER USER user_name CREATEDB NK_INTEGER */ + 379, /* (38) cmd ::= ALTER USER user_name ADD white_list */ + 379, /* (39) cmd ::= ALTER USER user_name DROP white_list */ + 379, /* (40) cmd ::= DROP USER user_name */ + 390, /* (41) sysinfo_opt ::= */ + 390, /* (42) sysinfo_opt ::= SYSINFO NK_INTEGER */ + 379, /* (43) cmd ::= GRANT privileges ON priv_level with_opt TO user_name */ + 379, /* (44) cmd ::= REVOKE privileges ON priv_level with_opt FROM user_name */ + 391, /* (45) privileges ::= ALL */ + 391, /* (46) privileges ::= priv_type_list */ + 391, /* (47) privileges ::= SUBSCRIBE */ + 394, /* (48) priv_type_list ::= priv_type */ + 394, /* (49) priv_type_list ::= priv_type_list NK_COMMA priv_type */ + 395, /* (50) priv_type ::= READ */ + 395, /* (51) priv_type ::= WRITE */ + 395, /* (52) priv_type ::= ALTER */ + 392, /* (53) priv_level ::= NK_STAR NK_DOT NK_STAR */ + 392, /* (54) priv_level ::= db_name NK_DOT NK_STAR */ + 392, /* (55) priv_level ::= db_name NK_DOT table_name */ + 392, /* (56) priv_level ::= topic_name */ + 393, /* (57) with_opt ::= */ + 393, /* (58) with_opt ::= WITH search_condition */ + 379, /* (59) cmd ::= CREATE ENCRYPT_KEY NK_STRING */ + 379, /* (60) cmd ::= CREATE DNODE dnode_endpoint */ + 379, /* (61) cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ + 379, /* (62) cmd ::= DROP DNODE NK_INTEGER force_opt */ + 379, /* (63) cmd ::= DROP DNODE dnode_endpoint force_opt */ + 379, /* (64) cmd ::= DROP DNODE NK_INTEGER unsafe_opt */ + 379, /* (65) cmd ::= DROP DNODE dnode_endpoint unsafe_opt */ + 379, /* (66) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ + 379, /* (67) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ + 379, /* (68) cmd ::= ALTER ALL DNODES NK_STRING */ + 379, /* (69) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ + 379, /* (70) cmd ::= RESTORE DNODE NK_INTEGER */ + 400, /* (71) dnode_endpoint ::= NK_STRING */ + 400, /* (72) dnode_endpoint ::= NK_ID */ + 400, /* (73) dnode_endpoint ::= NK_IPTOKEN */ + 401, /* (74) force_opt ::= */ + 401, /* (75) force_opt ::= FORCE */ + 402, /* (76) unsafe_opt ::= UNSAFE */ + 379, /* (77) cmd ::= ALTER CLUSTER NK_STRING */ + 379, /* (78) cmd ::= ALTER CLUSTER NK_STRING NK_STRING */ + 379, /* (79) cmd ::= ALTER LOCAL NK_STRING */ + 379, /* (80) cmd ::= ALTER LOCAL NK_STRING NK_STRING */ + 379, /* (81) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ + 379, /* (82) cmd ::= DROP QNODE ON DNODE NK_INTEGER */ + 379, /* (83) cmd ::= RESTORE QNODE ON DNODE NK_INTEGER */ + 379, /* (84) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ + 379, /* (85) cmd ::= DROP BNODE ON DNODE NK_INTEGER */ + 379, /* (86) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ + 379, /* (87) cmd ::= DROP SNODE ON DNODE NK_INTEGER */ + 379, /* (88) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ + 379, /* (89) cmd ::= DROP MNODE ON DNODE NK_INTEGER */ + 379, /* (90) cmd ::= RESTORE MNODE ON DNODE NK_INTEGER */ + 379, /* (91) cmd ::= RESTORE VNODE ON DNODE NK_INTEGER */ + 379, /* (92) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ + 379, /* (93) cmd ::= DROP DATABASE exists_opt db_name */ + 379, /* (94) cmd ::= USE db_name */ + 379, /* (95) cmd ::= ALTER DATABASE db_name alter_db_options */ + 379, /* (96) cmd ::= FLUSH DATABASE db_name */ + 379, /* (97) cmd ::= TRIM DATABASE db_name speed_opt */ + 379, /* (98) cmd ::= S3MIGRATE DATABASE db_name */ + 379, /* (99) cmd ::= COMPACT DATABASE db_name start_opt end_opt */ + 403, /* (100) not_exists_opt ::= IF NOT EXISTS */ + 403, /* (101) not_exists_opt ::= */ + 405, /* (102) exists_opt ::= IF EXISTS */ + 405, /* (103) exists_opt ::= */ + 404, /* (104) db_options ::= */ + 404, /* (105) db_options ::= db_options BUFFER NK_INTEGER */ + 404, /* (106) db_options ::= db_options CACHEMODEL NK_STRING */ + 404, /* (107) db_options ::= db_options CACHESIZE NK_INTEGER */ + 404, /* (108) db_options ::= db_options COMP NK_INTEGER */ + 404, /* (109) db_options ::= db_options DURATION NK_INTEGER */ + 404, /* (110) db_options ::= db_options DURATION NK_VARIABLE */ + 404, /* (111) db_options ::= db_options MAXROWS NK_INTEGER */ + 404, /* (112) db_options ::= db_options MINROWS NK_INTEGER */ + 404, /* (113) db_options ::= db_options KEEP integer_list */ + 404, /* (114) db_options ::= db_options KEEP variable_list */ + 404, /* (115) db_options ::= db_options PAGES NK_INTEGER */ + 404, /* (116) db_options ::= db_options PAGESIZE NK_INTEGER */ + 404, /* (117) db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ + 404, /* (118) db_options ::= db_options PRECISION NK_STRING */ + 404, /* (119) db_options ::= db_options REPLICA NK_INTEGER */ + 404, /* (120) db_options ::= db_options VGROUPS NK_INTEGER */ + 404, /* (121) db_options ::= db_options SINGLE_STABLE NK_INTEGER */ + 404, /* (122) db_options ::= db_options RETENTIONS retention_list */ + 404, /* (123) db_options ::= db_options SCHEMALESS NK_INTEGER */ + 404, /* (124) db_options ::= db_options WAL_LEVEL NK_INTEGER */ + 404, /* (125) db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ + 404, /* (126) db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ + 404, /* (127) db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ + 404, /* (128) db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ + 404, /* (129) db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ + 404, /* (130) db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ + 404, /* (131) db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ + 404, /* (132) db_options ::= db_options STT_TRIGGER NK_INTEGER */ + 404, /* (133) db_options ::= db_options TABLE_PREFIX signed */ + 404, /* (134) db_options ::= db_options TABLE_SUFFIX signed */ + 404, /* (135) db_options ::= db_options S3_CHUNKSIZE NK_INTEGER */ + 404, /* (136) db_options ::= db_options S3_KEEPLOCAL NK_INTEGER */ + 404, /* (137) db_options ::= db_options S3_KEEPLOCAL NK_VARIABLE */ + 404, /* (138) db_options ::= db_options S3_COMPACT NK_INTEGER */ + 404, /* (139) db_options ::= db_options KEEP_TIME_OFFSET NK_INTEGER */ + 404, /* (140) db_options ::= db_options ENCRYPT_ALGORITHM NK_STRING */ + 406, /* (141) alter_db_options ::= alter_db_option */ + 406, /* (142) alter_db_options ::= alter_db_options alter_db_option */ + 414, /* (143) alter_db_option ::= BUFFER NK_INTEGER */ + 414, /* (144) alter_db_option ::= CACHEMODEL NK_STRING */ + 414, /* (145) alter_db_option ::= CACHESIZE NK_INTEGER */ + 414, /* (146) alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ + 414, /* (147) alter_db_option ::= KEEP integer_list */ + 414, /* (148) alter_db_option ::= KEEP variable_list */ + 414, /* (149) alter_db_option ::= PAGES NK_INTEGER */ + 414, /* (150) alter_db_option ::= REPLICA NK_INTEGER */ + 414, /* (151) alter_db_option ::= WAL_LEVEL NK_INTEGER */ + 414, /* (152) alter_db_option ::= STT_TRIGGER NK_INTEGER */ + 414, /* (153) alter_db_option ::= MINROWS NK_INTEGER */ + 414, /* (154) alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */ + 414, /* (155) alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ + 414, /* (156) alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */ + 414, /* (157) alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ + 414, /* (158) alter_db_option ::= S3_KEEPLOCAL NK_INTEGER */ + 414, /* (159) alter_db_option ::= S3_KEEPLOCAL NK_VARIABLE */ + 414, /* (160) alter_db_option ::= S3_COMPACT NK_INTEGER */ + 414, /* (161) alter_db_option ::= KEEP_TIME_OFFSET NK_INTEGER */ + 414, /* (162) alter_db_option ::= ENCRYPT_ALGORITHM NK_STRING */ + 410, /* (163) integer_list ::= NK_INTEGER */ + 410, /* (164) integer_list ::= integer_list NK_COMMA NK_INTEGER */ + 411, /* (165) variable_list ::= NK_VARIABLE */ + 411, /* (166) variable_list ::= variable_list NK_COMMA NK_VARIABLE */ + 412, /* (167) retention_list ::= retention */ + 412, /* (168) retention_list ::= retention_list NK_COMMA retention */ + 415, /* (169) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ + 415, /* (170) retention ::= NK_MINUS NK_COLON NK_VARIABLE */ + 407, /* (171) speed_opt ::= */ + 407, /* (172) speed_opt ::= BWLIMIT NK_INTEGER */ + 408, /* (173) start_opt ::= */ + 408, /* (174) start_opt ::= START WITH NK_INTEGER */ + 408, /* (175) start_opt ::= START WITH NK_STRING */ + 408, /* (176) start_opt ::= START WITH TIMESTAMP NK_STRING */ + 409, /* (177) end_opt ::= */ + 409, /* (178) end_opt ::= END WITH NK_INTEGER */ + 409, /* (179) end_opt ::= END WITH NK_STRING */ + 409, /* (180) end_opt ::= END WITH TIMESTAMP NK_STRING */ + 379, /* (181) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ + 379, /* (182) cmd ::= CREATE TABLE multi_create_clause */ + 379, /* (183) cmd ::= CREATE TABLE not_exists_opt USING full_table_name NK_LP tag_list_opt NK_RP FILE NK_STRING */ + 379, /* (184) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ + 379, /* (185) cmd ::= DROP TABLE multi_drop_clause */ + 379, /* (186) cmd ::= DROP STABLE exists_opt full_table_name */ + 379, /* (187) cmd ::= ALTER TABLE alter_table_clause */ + 379, /* (188) cmd ::= ALTER STABLE alter_table_clause */ + 424, /* (189) alter_table_clause ::= full_table_name alter_table_options */ + 424, /* (190) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name column_options */ + 424, /* (191) alter_table_clause ::= full_table_name DROP COLUMN column_name */ + 424, /* (192) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ + 424, /* (193) alter_table_clause ::= full_table_name MODIFY COLUMN column_name column_options */ + 424, /* (194) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ + 424, /* (195) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ + 424, /* (196) alter_table_clause ::= full_table_name DROP TAG column_name */ + 424, /* (197) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ + 424, /* (198) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ + 424, /* (199) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ tags_literal */ + 420, /* (200) multi_create_clause ::= create_subtable_clause */ + 420, /* (201) multi_create_clause ::= multi_create_clause create_subtable_clause */ + 430, /* (202) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP tags_literal_list NK_RP table_options */ + 423, /* (203) multi_drop_clause ::= drop_table_clause */ + 423, /* (204) multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ + 433, /* (205) drop_table_clause ::= exists_opt full_table_name */ + 431, /* (206) specific_cols_opt ::= */ + 431, /* (207) specific_cols_opt ::= NK_LP col_name_list NK_RP */ + 416, /* (208) full_table_name ::= table_name */ + 416, /* (209) full_table_name ::= db_name NK_DOT table_name */ + 435, /* (210) tag_def_list ::= tag_def */ + 435, /* (211) tag_def_list ::= tag_def_list NK_COMMA tag_def */ + 436, /* (212) tag_def ::= column_name type_name */ + 417, /* (213) column_def_list ::= column_def */ + 417, /* (214) column_def_list ::= column_def_list NK_COMMA column_def */ + 437, /* (215) column_def ::= column_name type_name column_options */ + 427, /* (216) type_name ::= BOOL */ + 427, /* (217) type_name ::= TINYINT */ + 427, /* (218) type_name ::= SMALLINT */ + 427, /* (219) type_name ::= INT */ + 427, /* (220) type_name ::= INTEGER */ + 427, /* (221) type_name ::= BIGINT */ + 427, /* (222) type_name ::= FLOAT */ + 427, /* (223) type_name ::= DOUBLE */ + 427, /* (224) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ + 427, /* (225) type_name ::= TIMESTAMP */ + 427, /* (226) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ + 427, /* (227) type_name ::= TINYINT UNSIGNED */ + 427, /* (228) type_name ::= SMALLINT UNSIGNED */ + 427, /* (229) type_name ::= INT UNSIGNED */ + 427, /* (230) type_name ::= BIGINT UNSIGNED */ + 427, /* (231) type_name ::= JSON */ + 427, /* (232) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ + 427, /* (233) type_name ::= MEDIUMBLOB */ + 427, /* (234) type_name ::= BLOB */ + 427, /* (235) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ + 427, /* (236) type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ + 427, /* (237) type_name ::= DECIMAL */ + 427, /* (238) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ + 427, /* (239) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + 438, /* (240) type_name_default_len ::= BINARY */ + 438, /* (241) type_name_default_len ::= NCHAR */ + 438, /* (242) type_name_default_len ::= VARCHAR */ + 438, /* (243) type_name_default_len ::= VARBINARY */ + 418, /* (244) tags_def_opt ::= */ + 418, /* (245) tags_def_opt ::= tags_def */ + 422, /* (246) tags_def ::= TAGS NK_LP tag_def_list NK_RP */ + 419, /* (247) table_options ::= */ + 419, /* (248) table_options ::= table_options COMMENT NK_STRING */ + 419, /* (249) table_options ::= table_options MAX_DELAY duration_list */ + 419, /* (250) table_options ::= table_options WATERMARK duration_list */ + 419, /* (251) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ + 419, /* (252) table_options ::= table_options TTL NK_INTEGER */ + 419, /* (253) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ + 419, /* (254) table_options ::= table_options DELETE_MARK duration_list */ + 425, /* (255) alter_table_options ::= alter_table_option */ + 425, /* (256) alter_table_options ::= alter_table_options alter_table_option */ + 441, /* (257) alter_table_option ::= COMMENT NK_STRING */ + 441, /* (258) alter_table_option ::= TTL NK_INTEGER */ + 439, /* (259) duration_list ::= duration_literal */ + 439, /* (260) duration_list ::= duration_list NK_COMMA duration_literal */ + 440, /* (261) rollup_func_list ::= rollup_func_name */ + 440, /* (262) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ + 443, /* (263) rollup_func_name ::= function_name */ + 443, /* (264) rollup_func_name ::= FIRST */ + 443, /* (265) rollup_func_name ::= LAST */ + 434, /* (266) col_name_list ::= col_name */ + 434, /* (267) col_name_list ::= col_name_list NK_COMMA col_name */ + 445, /* (268) col_name ::= column_name */ + 379, /* (269) cmd ::= SHOW DNODES */ + 379, /* (270) cmd ::= SHOW USERS */ + 379, /* (271) cmd ::= SHOW USERS FULL */ + 379, /* (272) cmd ::= SHOW USER PRIVILEGES */ + 379, /* (273) cmd ::= SHOW db_kind_opt DATABASES */ + 379, /* (274) cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */ + 379, /* (275) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ + 379, /* (276) cmd ::= SHOW db_name_cond_opt VGROUPS */ + 379, /* (277) cmd ::= SHOW MNODES */ + 379, /* (278) cmd ::= SHOW QNODES */ + 379, /* (279) cmd ::= SHOW ARBGROUPS */ + 379, /* (280) cmd ::= SHOW FUNCTIONS */ + 379, /* (281) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ + 379, /* (282) cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ + 379, /* (283) cmd ::= SHOW STREAMS */ + 379, /* (284) cmd ::= SHOW ACCOUNTS */ + 379, /* (285) cmd ::= SHOW APPS */ + 379, /* (286) cmd ::= SHOW CONNECTIONS */ + 379, /* (287) cmd ::= SHOW LICENCES */ + 379, /* (288) cmd ::= SHOW GRANTS */ + 379, /* (289) cmd ::= SHOW GRANTS FULL */ + 379, /* (290) cmd ::= SHOW GRANTS LOGS */ + 379, /* (291) cmd ::= SHOW CLUSTER MACHINES */ + 379, /* (292) cmd ::= SHOW CREATE DATABASE db_name */ + 379, /* (293) cmd ::= SHOW CREATE TABLE full_table_name */ + 379, /* (294) cmd ::= SHOW CREATE STABLE full_table_name */ + 379, /* (295) cmd ::= SHOW ENCRYPTIONS */ + 379, /* (296) cmd ::= SHOW QUERIES */ + 379, /* (297) cmd ::= SHOW SCORES */ + 379, /* (298) cmd ::= SHOW TOPICS */ + 379, /* (299) cmd ::= SHOW VARIABLES */ + 379, /* (300) cmd ::= SHOW CLUSTER VARIABLES */ + 379, /* (301) cmd ::= SHOW LOCAL VARIABLES */ + 379, /* (302) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ + 379, /* (303) cmd ::= SHOW BNODES */ + 379, /* (304) cmd ::= SHOW SNODES */ + 379, /* (305) cmd ::= SHOW CLUSTER */ + 379, /* (306) cmd ::= SHOW TRANSACTIONS */ + 379, /* (307) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ + 379, /* (308) cmd ::= SHOW CONSUMERS */ + 379, /* (309) cmd ::= SHOW SUBSCRIPTIONS */ + 379, /* (310) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ + 379, /* (311) cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ + 379, /* (312) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ + 379, /* (313) cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ + 379, /* (314) cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ + 379, /* (315) cmd ::= SHOW VNODES */ + 379, /* (316) cmd ::= SHOW db_name_cond_opt ALIVE */ + 379, /* (317) cmd ::= SHOW CLUSTER ALIVE */ + 379, /* (318) cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt */ + 379, /* (319) cmd ::= SHOW CREATE VIEW full_table_name */ + 379, /* (320) cmd ::= SHOW COMPACTS */ + 379, /* (321) cmd ::= SHOW COMPACT NK_INTEGER */ + 447, /* (322) table_kind_db_name_cond_opt ::= */ + 447, /* (323) table_kind_db_name_cond_opt ::= table_kind */ + 447, /* (324) table_kind_db_name_cond_opt ::= db_name NK_DOT */ + 447, /* (325) table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */ + 452, /* (326) table_kind ::= NORMAL */ + 452, /* (327) table_kind ::= CHILD */ + 449, /* (328) db_name_cond_opt ::= */ + 449, /* (329) db_name_cond_opt ::= db_name NK_DOT */ + 448, /* (330) like_pattern_opt ::= */ + 448, /* (331) like_pattern_opt ::= LIKE NK_STRING */ + 450, /* (332) table_name_cond ::= table_name */ + 451, /* (333) from_db_opt ::= */ + 451, /* (334) from_db_opt ::= FROM db_name */ + 421, /* (335) tag_list_opt ::= */ + 421, /* (336) tag_list_opt ::= tag_item */ + 421, /* (337) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ + 453, /* (338) tag_item ::= TBNAME */ + 453, /* (339) tag_item ::= QTAGS */ + 453, /* (340) tag_item ::= column_name */ + 453, /* (341) tag_item ::= column_name column_alias */ + 453, /* (342) tag_item ::= column_name AS column_alias */ + 446, /* (343) db_kind_opt ::= */ + 446, /* (344) db_kind_opt ::= USER */ + 446, /* (345) db_kind_opt ::= SYSTEM */ + 379, /* (346) cmd ::= CREATE TSMA not_exists_opt tsma_name ON full_table_name tsma_func_list INTERVAL NK_LP duration_literal NK_RP */ + 379, /* (347) cmd ::= CREATE RECURSIVE TSMA not_exists_opt tsma_name ON full_table_name INTERVAL NK_LP duration_literal NK_RP */ + 379, /* (348) cmd ::= DROP TSMA exists_opt full_tsma_name */ + 379, /* (349) cmd ::= SHOW db_name_cond_opt TSMAS */ + 457, /* (350) full_tsma_name ::= tsma_name */ + 457, /* (351) full_tsma_name ::= db_name NK_DOT tsma_name */ + 456, /* (352) tsma_func_list ::= FUNCTION NK_LP func_list NK_RP */ + 379, /* (353) cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */ + 379, /* (354) cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */ + 379, /* (355) cmd ::= DROP INDEX exists_opt full_index_name */ + 460, /* (356) full_index_name ::= index_name */ + 460, /* (357) full_index_name ::= db_name NK_DOT index_name */ + 459, /* (358) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ + 459, /* (359) 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 */ + 458, /* (360) func_list ::= func */ + 458, /* (361) func_list ::= func_list NK_COMMA func */ + 464, /* (362) func ::= sma_func_name NK_LP expression_list NK_RP */ + 465, /* (363) sma_func_name ::= function_name */ + 465, /* (364) sma_func_name ::= COUNT */ + 465, /* (365) sma_func_name ::= FIRST */ + 465, /* (366) sma_func_name ::= LAST */ + 465, /* (367) sma_func_name ::= LAST_ROW */ + 463, /* (368) sma_stream_opt ::= */ + 463, /* (369) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ + 463, /* (370) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ + 463, /* (371) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ + 467, /* (372) with_meta ::= AS */ + 467, /* (373) with_meta ::= WITH META AS */ + 467, /* (374) with_meta ::= ONLY META AS */ + 379, /* (375) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ + 379, /* (376) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ + 379, /* (377) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ + 379, /* (378) cmd ::= DROP TOPIC exists_opt topic_name */ + 379, /* (379) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ + 379, /* (380) cmd ::= DESC full_table_name */ + 379, /* (381) cmd ::= DESCRIBE full_table_name */ + 379, /* (382) cmd ::= RESET QUERY CACHE */ + 379, /* (383) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ + 379, /* (384) cmd ::= EXPLAIN analyze_opt explain_options insert_query */ + 471, /* (385) analyze_opt ::= */ + 471, /* (386) analyze_opt ::= ANALYZE */ + 472, /* (387) explain_options ::= */ + 472, /* (388) explain_options ::= explain_options VERBOSE NK_BOOL */ + 472, /* (389) explain_options ::= explain_options RATIO NK_FLOAT */ + 379, /* (390) cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ + 379, /* (391) cmd ::= DROP FUNCTION exists_opt function_name */ + 475, /* (392) agg_func_opt ::= */ + 475, /* (393) agg_func_opt ::= AGGREGATE */ + 476, /* (394) bufsize_opt ::= */ + 476, /* (395) bufsize_opt ::= BUFSIZE NK_INTEGER */ + 477, /* (396) language_opt ::= */ + 477, /* (397) language_opt ::= LANGUAGE NK_STRING */ + 474, /* (398) or_replace_opt ::= */ + 474, /* (399) or_replace_opt ::= OR REPLACE */ + 379, /* (400) cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */ + 379, /* (401) cmd ::= DROP VIEW exists_opt full_view_name */ + 478, /* (402) full_view_name ::= view_name */ + 478, /* (403) full_view_name ::= db_name NK_DOT view_name */ + 379, /* (404) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */ + 379, /* (405) cmd ::= DROP STREAM exists_opt stream_name */ + 379, /* (406) cmd ::= PAUSE STREAM exists_opt stream_name */ + 379, /* (407) cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ + 482, /* (408) col_list_opt ::= */ + 482, /* (409) col_list_opt ::= NK_LP column_stream_def_list NK_RP */ + 486, /* (410) column_stream_def_list ::= column_stream_def */ + 486, /* (411) column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def */ + 487, /* (412) column_stream_def ::= column_name stream_col_options */ + 488, /* (413) stream_col_options ::= */ + 488, /* (414) stream_col_options ::= stream_col_options PRIMARY KEY */ + 483, /* (415) tag_def_or_ref_opt ::= */ + 483, /* (416) tag_def_or_ref_opt ::= tags_def */ + 483, /* (417) tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP */ + 481, /* (418) stream_options ::= */ + 481, /* (419) stream_options ::= stream_options TRIGGER AT_ONCE */ + 481, /* (420) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ + 481, /* (421) stream_options ::= stream_options TRIGGER FORCE_WINDOW_CLOSE */ + 481, /* (422) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ + 481, /* (423) stream_options ::= stream_options WATERMARK duration_literal */ + 481, /* (424) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ + 481, /* (425) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ + 481, /* (426) stream_options ::= stream_options DELETE_MARK duration_literal */ + 481, /* (427) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ + 484, /* (428) subtable_opt ::= */ + 484, /* (429) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + 485, /* (430) ignore_opt ::= */ + 485, /* (431) ignore_opt ::= IGNORE UNTREATED */ + 379, /* (432) cmd ::= KILL CONNECTION NK_INTEGER */ + 379, /* (433) cmd ::= KILL QUERY NK_STRING */ + 379, /* (434) cmd ::= KILL TRANSACTION NK_INTEGER */ + 379, /* (435) cmd ::= KILL COMPACT NK_INTEGER */ + 379, /* (436) cmd ::= BALANCE VGROUP */ + 379, /* (437) cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ + 379, /* (438) cmd ::= BALANCE VGROUP LEADER DATABASE db_name */ + 379, /* (439) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + 379, /* (440) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ + 379, /* (441) cmd ::= SPLIT VGROUP NK_INTEGER */ + 490, /* (442) on_vgroup_id ::= */ + 490, /* (443) on_vgroup_id ::= ON NK_INTEGER */ + 491, /* (444) dnode_list ::= DNODE NK_INTEGER */ + 491, /* (445) dnode_list ::= dnode_list DNODE NK_INTEGER */ + 379, /* (446) cmd ::= DELETE FROM full_table_name where_clause_opt */ + 379, /* (447) cmd ::= query_or_subquery */ + 379, /* (448) cmd ::= insert_query */ + 473, /* (449) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ + 473, /* (450) insert_query ::= INSERT INTO full_table_name query_or_subquery */ + 429, /* (451) tags_literal ::= NK_INTEGER */ + 429, /* (452) tags_literal ::= NK_INTEGER NK_PLUS duration_literal */ + 429, /* (453) tags_literal ::= NK_INTEGER NK_MINUS duration_literal */ + 429, /* (454) tags_literal ::= NK_PLUS NK_INTEGER */ + 429, /* (455) tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal */ + 429, /* (456) tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal */ + 429, /* (457) tags_literal ::= NK_MINUS NK_INTEGER */ + 429, /* (458) tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal */ + 429, /* (459) tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal */ + 429, /* (460) tags_literal ::= NK_FLOAT */ + 429, /* (461) tags_literal ::= NK_PLUS NK_FLOAT */ + 429, /* (462) tags_literal ::= NK_MINUS NK_FLOAT */ + 429, /* (463) tags_literal ::= NK_BIN */ + 429, /* (464) tags_literal ::= NK_BIN NK_PLUS duration_literal */ + 429, /* (465) tags_literal ::= NK_BIN NK_MINUS duration_literal */ + 429, /* (466) tags_literal ::= NK_PLUS NK_BIN */ + 429, /* (467) tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal */ + 429, /* (468) tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal */ + 429, /* (469) tags_literal ::= NK_MINUS NK_BIN */ + 429, /* (470) tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal */ + 429, /* (471) tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal */ + 429, /* (472) tags_literal ::= NK_HEX */ + 429, /* (473) tags_literal ::= NK_HEX NK_PLUS duration_literal */ + 429, /* (474) tags_literal ::= NK_HEX NK_MINUS duration_literal */ + 429, /* (475) tags_literal ::= NK_PLUS NK_HEX */ + 429, /* (476) tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal */ + 429, /* (477) tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal */ + 429, /* (478) tags_literal ::= NK_MINUS NK_HEX */ + 429, /* (479) tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal */ + 429, /* (480) tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal */ + 429, /* (481) tags_literal ::= NK_STRING */ + 429, /* (482) tags_literal ::= NK_STRING NK_PLUS duration_literal */ + 429, /* (483) tags_literal ::= NK_STRING NK_MINUS duration_literal */ + 429, /* (484) tags_literal ::= NK_BOOL */ + 429, /* (485) tags_literal ::= NULL */ + 429, /* (486) tags_literal ::= literal_func */ + 429, /* (487) tags_literal ::= literal_func NK_PLUS duration_literal */ + 429, /* (488) tags_literal ::= literal_func NK_MINUS duration_literal */ + 432, /* (489) tags_literal_list ::= tags_literal */ + 432, /* (490) tags_literal_list ::= tags_literal_list NK_COMMA tags_literal */ + 382, /* (491) literal ::= NK_INTEGER */ + 382, /* (492) literal ::= NK_FLOAT */ + 382, /* (493) literal ::= NK_STRING */ + 382, /* (494) literal ::= NK_BOOL */ + 382, /* (495) literal ::= TIMESTAMP NK_STRING */ + 382, /* (496) literal ::= duration_literal */ + 382, /* (497) literal ::= NULL */ + 382, /* (498) literal ::= NK_QUESTION */ + 442, /* (499) duration_literal ::= NK_VARIABLE */ + 413, /* (500) signed ::= NK_INTEGER */ + 413, /* (501) signed ::= NK_PLUS NK_INTEGER */ + 413, /* (502) signed ::= NK_MINUS NK_INTEGER */ + 413, /* (503) signed ::= NK_FLOAT */ + 413, /* (504) signed ::= NK_PLUS NK_FLOAT */ + 413, /* (505) signed ::= NK_MINUS NK_FLOAT */ + 493, /* (506) signed_literal ::= signed */ + 493, /* (507) signed_literal ::= NK_STRING */ + 493, /* (508) signed_literal ::= NK_BOOL */ + 493, /* (509) signed_literal ::= TIMESTAMP NK_STRING */ + 493, /* (510) signed_literal ::= duration_literal */ + 493, /* (511) signed_literal ::= NULL */ + 493, /* (512) signed_literal ::= literal_func */ + 493, /* (513) signed_literal ::= NK_QUESTION */ + 494, /* (514) literal_list ::= signed_literal */ + 494, /* (515) literal_list ::= literal_list NK_COMMA signed_literal */ + 396, /* (516) db_name ::= NK_ID */ + 397, /* (517) table_name ::= NK_ID */ + 426, /* (518) column_name ::= NK_ID */ + 444, /* (519) function_name ::= NK_ID */ + 479, /* (520) view_name ::= NK_ID */ + 495, /* (521) table_alias ::= NK_ID */ + 454, /* (522) column_alias ::= NK_ID */ + 454, /* (523) column_alias ::= NK_ALIAS */ + 389, /* (524) user_name ::= NK_ID */ + 398, /* (525) topic_name ::= NK_ID */ + 480, /* (526) stream_name ::= NK_ID */ + 470, /* (527) cgroup_name ::= NK_ID */ + 461, /* (528) index_name ::= NK_ID */ + 455, /* (529) tsma_name ::= NK_ID */ + 496, /* (530) expr_or_subquery ::= expression */ + 489, /* (531) expression ::= literal */ + 489, /* (532) expression ::= pseudo_column */ + 489, /* (533) expression ::= column_reference */ + 489, /* (534) expression ::= function_expression */ + 489, /* (535) expression ::= case_when_expression */ + 489, /* (536) expression ::= NK_LP expression NK_RP */ + 489, /* (537) expression ::= NK_PLUS expr_or_subquery */ + 489, /* (538) expression ::= NK_MINUS expr_or_subquery */ + 489, /* (539) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ + 489, /* (540) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ + 489, /* (541) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ + 489, /* (542) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ + 489, /* (543) expression ::= expr_or_subquery NK_REM expr_or_subquery */ + 489, /* (544) expression ::= column_reference NK_ARROW NK_STRING */ + 489, /* (545) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ + 489, /* (546) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ + 466, /* (547) expression_list ::= expr_or_subquery */ + 466, /* (548) expression_list ::= expression_list NK_COMMA expr_or_subquery */ + 498, /* (549) column_reference ::= column_name */ + 498, /* (550) column_reference ::= table_name NK_DOT column_name */ + 498, /* (551) column_reference ::= NK_ALIAS */ + 498, /* (552) column_reference ::= table_name NK_DOT NK_ALIAS */ + 497, /* (553) pseudo_column ::= ROWTS */ + 497, /* (554) pseudo_column ::= TBNAME */ + 497, /* (555) pseudo_column ::= table_name NK_DOT TBNAME */ + 497, /* (556) pseudo_column ::= QSTART */ + 497, /* (557) pseudo_column ::= QEND */ + 497, /* (558) pseudo_column ::= QDURATION */ + 497, /* (559) pseudo_column ::= WSTART */ + 497, /* (560) pseudo_column ::= WEND */ + 497, /* (561) pseudo_column ::= WDURATION */ + 497, /* (562) pseudo_column ::= IROWTS */ + 497, /* (563) pseudo_column ::= ISFILLED */ + 497, /* (564) pseudo_column ::= QTAGS */ + 499, /* (565) function_expression ::= function_name NK_LP expression_list NK_RP */ + 499, /* (566) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ + 499, /* (567) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ + 499, /* (568) function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP */ + 499, /* (569) function_expression ::= literal_func */ + 492, /* (570) literal_func ::= noarg_func NK_LP NK_RP */ + 492, /* (571) literal_func ::= NOW */ + 492, /* (572) literal_func ::= TODAY */ + 503, /* (573) noarg_func ::= NOW */ + 503, /* (574) noarg_func ::= TODAY */ + 503, /* (575) noarg_func ::= TIMEZONE */ + 503, /* (576) noarg_func ::= DATABASE */ + 503, /* (577) noarg_func ::= CLIENT_VERSION */ + 503, /* (578) noarg_func ::= SERVER_VERSION */ + 503, /* (579) noarg_func ::= SERVER_STATUS */ + 503, /* (580) noarg_func ::= CURRENT_USER */ + 503, /* (581) noarg_func ::= USER */ + 501, /* (582) star_func ::= COUNT */ + 501, /* (583) star_func ::= FIRST */ + 501, /* (584) star_func ::= LAST */ + 501, /* (585) star_func ::= LAST_ROW */ + 502, /* (586) star_func_para_list ::= NK_STAR */ + 502, /* (587) star_func_para_list ::= other_para_list */ + 504, /* (588) other_para_list ::= star_func_para */ + 504, /* (589) other_para_list ::= other_para_list NK_COMMA star_func_para */ + 505, /* (590) star_func_para ::= expr_or_subquery */ + 505, /* (591) star_func_para ::= table_name NK_DOT NK_STAR */ + 500, /* (592) case_when_expression ::= CASE when_then_list case_when_else_opt END */ + 500, /* (593) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ + 506, /* (594) when_then_list ::= when_then_expr */ + 506, /* (595) when_then_list ::= when_then_list when_then_expr */ + 509, /* (596) when_then_expr ::= WHEN common_expression THEN common_expression */ + 507, /* (597) case_when_else_opt ::= */ + 507, /* (598) case_when_else_opt ::= ELSE common_expression */ + 510, /* (599) predicate ::= expr_or_subquery compare_op expr_or_subquery */ + 510, /* (600) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ + 510, /* (601) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ + 510, /* (602) predicate ::= expr_or_subquery IS NULL */ + 510, /* (603) predicate ::= expr_or_subquery IS NOT NULL */ + 510, /* (604) predicate ::= expr_or_subquery in_op in_predicate_value */ + 511, /* (605) compare_op ::= NK_LT */ + 511, /* (606) compare_op ::= NK_GT */ + 511, /* (607) compare_op ::= NK_LE */ + 511, /* (608) compare_op ::= NK_GE */ + 511, /* (609) compare_op ::= NK_NE */ + 511, /* (610) compare_op ::= NK_EQ */ + 511, /* (611) compare_op ::= LIKE */ + 511, /* (612) compare_op ::= NOT LIKE */ + 511, /* (613) compare_op ::= MATCH */ + 511, /* (614) compare_op ::= NMATCH */ + 511, /* (615) compare_op ::= CONTAINS */ + 512, /* (616) in_op ::= IN */ + 512, /* (617) in_op ::= NOT IN */ + 513, /* (618) in_predicate_value ::= NK_LP literal_list NK_RP */ + 514, /* (619) boolean_value_expression ::= boolean_primary */ + 514, /* (620) boolean_value_expression ::= NOT boolean_primary */ + 514, /* (621) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + 514, /* (622) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + 515, /* (623) boolean_primary ::= predicate */ + 515, /* (624) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ + 508, /* (625) common_expression ::= expr_or_subquery */ + 508, /* (626) common_expression ::= boolean_value_expression */ + 516, /* (627) from_clause_opt ::= */ + 516, /* (628) from_clause_opt ::= FROM table_reference_list */ + 517, /* (629) table_reference_list ::= table_reference */ + 517, /* (630) table_reference_list ::= table_reference_list NK_COMMA table_reference */ + 518, /* (631) table_reference ::= table_primary */ + 518, /* (632) table_reference ::= joined_table */ + 519, /* (633) table_primary ::= table_name alias_opt */ + 519, /* (634) table_primary ::= db_name NK_DOT table_name alias_opt */ + 519, /* (635) table_primary ::= subquery alias_opt */ + 519, /* (636) table_primary ::= parenthesized_joined_table */ + 521, /* (637) alias_opt ::= */ + 521, /* (638) alias_opt ::= table_alias */ + 521, /* (639) alias_opt ::= AS table_alias */ + 523, /* (640) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + 523, /* (641) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ + 520, /* (642) joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt */ + 524, /* (643) join_type ::= */ + 524, /* (644) join_type ::= INNER */ + 524, /* (645) join_type ::= LEFT */ + 524, /* (646) join_type ::= RIGHT */ + 524, /* (647) join_type ::= FULL */ + 525, /* (648) join_subtype ::= */ + 525, /* (649) join_subtype ::= OUTER */ + 525, /* (650) join_subtype ::= SEMI */ + 525, /* (651) join_subtype ::= ANTI */ + 525, /* (652) join_subtype ::= ASOF */ + 525, /* (653) join_subtype ::= WINDOW */ + 526, /* (654) join_on_clause_opt ::= */ + 526, /* (655) join_on_clause_opt ::= ON search_condition */ + 527, /* (656) window_offset_clause_opt ::= */ + 527, /* (657) window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP */ + 529, /* (658) window_offset_literal ::= NK_VARIABLE */ + 529, /* (659) window_offset_literal ::= NK_MINUS NK_VARIABLE */ + 528, /* (660) jlimit_clause_opt ::= */ + 528, /* (661) jlimit_clause_opt ::= JLIMIT NK_INTEGER */ + 530, /* (662) query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_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 */ + 531, /* (663) hint_list ::= */ + 531, /* (664) hint_list ::= NK_HINT */ + 533, /* (665) tag_mode_opt ::= */ + 533, /* (666) tag_mode_opt ::= TAGS */ + 532, /* (667) set_quantifier_opt ::= */ + 532, /* (668) set_quantifier_opt ::= DISTINCT */ + 532, /* (669) set_quantifier_opt ::= ALL */ + 534, /* (670) select_list ::= select_item */ + 534, /* (671) select_list ::= select_list NK_COMMA select_item */ + 542, /* (672) select_item ::= NK_STAR */ + 542, /* (673) select_item ::= common_expression */ + 542, /* (674) select_item ::= common_expression column_alias */ + 542, /* (675) select_item ::= common_expression AS column_alias */ + 542, /* (676) select_item ::= table_name NK_DOT NK_STAR */ + 469, /* (677) where_clause_opt ::= */ + 469, /* (678) where_clause_opt ::= WHERE search_condition */ + 535, /* (679) partition_by_clause_opt ::= */ + 535, /* (680) partition_by_clause_opt ::= PARTITION BY partition_list */ + 543, /* (681) partition_list ::= partition_item */ + 543, /* (682) partition_list ::= partition_list NK_COMMA partition_item */ + 544, /* (683) partition_item ::= expr_or_subquery */ + 544, /* (684) partition_item ::= expr_or_subquery column_alias */ + 544, /* (685) partition_item ::= expr_or_subquery AS column_alias */ + 539, /* (686) twindow_clause_opt ::= */ + 539, /* (687) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ + 539, /* (688) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ + 539, /* (689) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ + 539, /* (690) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ + 539, /* (691) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ + 539, /* (692) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */ + 539, /* (693) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + 462, /* (694) sliding_opt ::= */ + 462, /* (695) sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ + 545, /* (696) interval_sliding_duration_literal ::= NK_VARIABLE */ + 545, /* (697) interval_sliding_duration_literal ::= NK_STRING */ + 545, /* (698) interval_sliding_duration_literal ::= NK_INTEGER */ + 538, /* (699) fill_opt ::= */ + 538, /* (700) fill_opt ::= FILL NK_LP fill_mode NK_RP */ + 538, /* (701) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ + 538, /* (702) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ + 546, /* (703) fill_mode ::= NONE */ + 546, /* (704) fill_mode ::= PREV */ + 546, /* (705) fill_mode ::= NULL */ + 546, /* (706) fill_mode ::= NULL_F */ + 546, /* (707) fill_mode ::= LINEAR */ + 546, /* (708) fill_mode ::= NEXT */ + 540, /* (709) group_by_clause_opt ::= */ + 540, /* (710) group_by_clause_opt ::= GROUP BY group_by_list */ + 547, /* (711) group_by_list ::= expr_or_subquery */ + 547, /* (712) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ + 541, /* (713) having_clause_opt ::= */ + 541, /* (714) having_clause_opt ::= HAVING search_condition */ + 536, /* (715) range_opt ::= */ + 536, /* (716) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ + 536, /* (717) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ + 537, /* (718) every_opt ::= */ + 537, /* (719) every_opt ::= EVERY NK_LP duration_literal NK_RP */ + 548, /* (720) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ + 549, /* (721) query_simple ::= query_specification */ + 549, /* (722) query_simple ::= union_query_expression */ + 553, /* (723) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ + 553, /* (724) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ + 554, /* (725) query_simple_or_subquery ::= query_simple */ + 554, /* (726) query_simple_or_subquery ::= subquery */ + 468, /* (727) query_or_subquery ::= query_expression */ + 468, /* (728) query_or_subquery ::= subquery */ + 550, /* (729) order_by_clause_opt ::= */ + 550, /* (730) order_by_clause_opt ::= ORDER BY sort_specification_list */ + 551, /* (731) slimit_clause_opt ::= */ + 551, /* (732) slimit_clause_opt ::= SLIMIT NK_INTEGER */ + 551, /* (733) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + 551, /* (734) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + 552, /* (735) limit_clause_opt ::= */ + 552, /* (736) limit_clause_opt ::= LIMIT NK_INTEGER */ + 552, /* (737) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ + 552, /* (738) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + 522, /* (739) subquery ::= NK_LP query_expression NK_RP */ + 522, /* (740) subquery ::= NK_LP subquery NK_RP */ + 399, /* (741) search_condition ::= common_expression */ + 555, /* (742) sort_specification_list ::= sort_specification */ + 555, /* (743) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ + 556, /* (744) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ + 557, /* (745) ordering_specification_opt ::= */ + 557, /* (746) ordering_specification_opt ::= ASC */ + 557, /* (747) ordering_specification_opt ::= DESC */ + 558, /* (748) null_ordering_opt ::= */ + 558, /* (749) null_ordering_opt ::= NULLS FIRST */ + 558, /* (750) null_ordering_opt ::= NULLS LAST */ + 428, /* (751) column_options ::= */ + 428, /* (752) column_options ::= column_options PRIMARY KEY */ + 428, /* (753) column_options ::= column_options ENCODE NK_STRING */ + 428, /* (754) column_options ::= column_options COMPRESS NK_STRING */ + 428, /* (755) column_options ::= column_options LEVEL NK_STRING */ }; /* For rule J, yyRuleInfoNRhs[J] contains the negative of the number @@ -5186,340 +5186,341 @@ static const signed char yyRuleInfoNRhs[] = { 0, /* (418) stream_options ::= */ -3, /* (419) stream_options ::= stream_options TRIGGER AT_ONCE */ -3, /* (420) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ - -4, /* (421) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ - -3, /* (422) stream_options ::= stream_options WATERMARK duration_literal */ - -4, /* (423) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ - -3, /* (424) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ - -3, /* (425) stream_options ::= stream_options DELETE_MARK duration_literal */ - -4, /* (426) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ - 0, /* (427) subtable_opt ::= */ - -4, /* (428) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - 0, /* (429) ignore_opt ::= */ - -2, /* (430) ignore_opt ::= IGNORE UNTREATED */ - -3, /* (431) cmd ::= KILL CONNECTION NK_INTEGER */ - -3, /* (432) cmd ::= KILL QUERY NK_STRING */ - -3, /* (433) cmd ::= KILL TRANSACTION NK_INTEGER */ - -3, /* (434) cmd ::= KILL COMPACT NK_INTEGER */ - -2, /* (435) cmd ::= BALANCE VGROUP */ - -4, /* (436) cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ - -5, /* (437) cmd ::= BALANCE VGROUP LEADER DATABASE db_name */ - -4, /* (438) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ - -4, /* (439) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ - -3, /* (440) cmd ::= SPLIT VGROUP NK_INTEGER */ - 0, /* (441) on_vgroup_id ::= */ - -2, /* (442) on_vgroup_id ::= ON NK_INTEGER */ - -2, /* (443) dnode_list ::= DNODE NK_INTEGER */ - -3, /* (444) dnode_list ::= dnode_list DNODE NK_INTEGER */ - -4, /* (445) cmd ::= DELETE FROM full_table_name where_clause_opt */ - -1, /* (446) cmd ::= query_or_subquery */ - -1, /* (447) cmd ::= insert_query */ - -7, /* (448) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ - -4, /* (449) insert_query ::= INSERT INTO full_table_name query_or_subquery */ - -1, /* (450) tags_literal ::= NK_INTEGER */ - -3, /* (451) tags_literal ::= NK_INTEGER NK_PLUS duration_literal */ - -3, /* (452) tags_literal ::= NK_INTEGER NK_MINUS duration_literal */ - -2, /* (453) tags_literal ::= NK_PLUS NK_INTEGER */ - -4, /* (454) tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal */ - -4, /* (455) tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal */ - -2, /* (456) tags_literal ::= NK_MINUS NK_INTEGER */ - -4, /* (457) tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal */ - -4, /* (458) tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal */ - -1, /* (459) tags_literal ::= NK_FLOAT */ - -2, /* (460) tags_literal ::= NK_PLUS NK_FLOAT */ - -2, /* (461) tags_literal ::= NK_MINUS NK_FLOAT */ - -1, /* (462) tags_literal ::= NK_BIN */ - -3, /* (463) tags_literal ::= NK_BIN NK_PLUS duration_literal */ - -3, /* (464) tags_literal ::= NK_BIN NK_MINUS duration_literal */ - -2, /* (465) tags_literal ::= NK_PLUS NK_BIN */ - -4, /* (466) tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal */ - -4, /* (467) tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal */ - -2, /* (468) tags_literal ::= NK_MINUS NK_BIN */ - -4, /* (469) tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal */ - -4, /* (470) tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal */ - -1, /* (471) tags_literal ::= NK_HEX */ - -3, /* (472) tags_literal ::= NK_HEX NK_PLUS duration_literal */ - -3, /* (473) tags_literal ::= NK_HEX NK_MINUS duration_literal */ - -2, /* (474) tags_literal ::= NK_PLUS NK_HEX */ - -4, /* (475) tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal */ - -4, /* (476) tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal */ - -2, /* (477) tags_literal ::= NK_MINUS NK_HEX */ - -4, /* (478) tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal */ - -4, /* (479) tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal */ - -1, /* (480) tags_literal ::= NK_STRING */ - -3, /* (481) tags_literal ::= NK_STRING NK_PLUS duration_literal */ - -3, /* (482) tags_literal ::= NK_STRING NK_MINUS duration_literal */ - -1, /* (483) tags_literal ::= NK_BOOL */ - -1, /* (484) tags_literal ::= NULL */ - -1, /* (485) tags_literal ::= literal_func */ - -3, /* (486) tags_literal ::= literal_func NK_PLUS duration_literal */ - -3, /* (487) tags_literal ::= literal_func NK_MINUS duration_literal */ - -1, /* (488) tags_literal_list ::= tags_literal */ - -3, /* (489) tags_literal_list ::= tags_literal_list NK_COMMA tags_literal */ - -1, /* (490) literal ::= NK_INTEGER */ - -1, /* (491) literal ::= NK_FLOAT */ - -1, /* (492) literal ::= NK_STRING */ - -1, /* (493) literal ::= NK_BOOL */ - -2, /* (494) literal ::= TIMESTAMP NK_STRING */ - -1, /* (495) literal ::= duration_literal */ - -1, /* (496) literal ::= NULL */ - -1, /* (497) literal ::= NK_QUESTION */ - -1, /* (498) duration_literal ::= NK_VARIABLE */ - -1, /* (499) signed ::= NK_INTEGER */ - -2, /* (500) signed ::= NK_PLUS NK_INTEGER */ - -2, /* (501) signed ::= NK_MINUS NK_INTEGER */ - -1, /* (502) signed ::= NK_FLOAT */ - -2, /* (503) signed ::= NK_PLUS NK_FLOAT */ - -2, /* (504) signed ::= NK_MINUS NK_FLOAT */ - -1, /* (505) signed_literal ::= signed */ - -1, /* (506) signed_literal ::= NK_STRING */ - -1, /* (507) signed_literal ::= NK_BOOL */ - -2, /* (508) signed_literal ::= TIMESTAMP NK_STRING */ - -1, /* (509) signed_literal ::= duration_literal */ - -1, /* (510) signed_literal ::= NULL */ - -1, /* (511) signed_literal ::= literal_func */ - -1, /* (512) signed_literal ::= NK_QUESTION */ - -1, /* (513) literal_list ::= signed_literal */ - -3, /* (514) literal_list ::= literal_list NK_COMMA signed_literal */ - -1, /* (515) db_name ::= NK_ID */ - -1, /* (516) table_name ::= NK_ID */ - -1, /* (517) column_name ::= NK_ID */ - -1, /* (518) function_name ::= NK_ID */ - -1, /* (519) view_name ::= NK_ID */ - -1, /* (520) table_alias ::= NK_ID */ - -1, /* (521) column_alias ::= NK_ID */ - -1, /* (522) column_alias ::= NK_ALIAS */ - -1, /* (523) user_name ::= NK_ID */ - -1, /* (524) topic_name ::= NK_ID */ - -1, /* (525) stream_name ::= NK_ID */ - -1, /* (526) cgroup_name ::= NK_ID */ - -1, /* (527) index_name ::= NK_ID */ - -1, /* (528) tsma_name ::= NK_ID */ - -1, /* (529) expr_or_subquery ::= expression */ - -1, /* (530) expression ::= literal */ - -1, /* (531) expression ::= pseudo_column */ - -1, /* (532) expression ::= column_reference */ - -1, /* (533) expression ::= function_expression */ - -1, /* (534) expression ::= case_when_expression */ - -3, /* (535) expression ::= NK_LP expression NK_RP */ - -2, /* (536) expression ::= NK_PLUS expr_or_subquery */ - -2, /* (537) expression ::= NK_MINUS expr_or_subquery */ - -3, /* (538) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ - -3, /* (539) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ - -3, /* (540) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ - -3, /* (541) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ - -3, /* (542) expression ::= expr_or_subquery NK_REM expr_or_subquery */ - -3, /* (543) expression ::= column_reference NK_ARROW NK_STRING */ - -3, /* (544) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ - -3, /* (545) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ - -1, /* (546) expression_list ::= expr_or_subquery */ - -3, /* (547) expression_list ::= expression_list NK_COMMA expr_or_subquery */ - -1, /* (548) column_reference ::= column_name */ - -3, /* (549) column_reference ::= table_name NK_DOT column_name */ - -1, /* (550) column_reference ::= NK_ALIAS */ - -3, /* (551) column_reference ::= table_name NK_DOT NK_ALIAS */ - -1, /* (552) pseudo_column ::= ROWTS */ - -1, /* (553) pseudo_column ::= TBNAME */ - -3, /* (554) pseudo_column ::= table_name NK_DOT TBNAME */ - -1, /* (555) pseudo_column ::= QSTART */ - -1, /* (556) pseudo_column ::= QEND */ - -1, /* (557) pseudo_column ::= QDURATION */ - -1, /* (558) pseudo_column ::= WSTART */ - -1, /* (559) pseudo_column ::= WEND */ - -1, /* (560) pseudo_column ::= WDURATION */ - -1, /* (561) pseudo_column ::= IROWTS */ - -1, /* (562) pseudo_column ::= ISFILLED */ - -1, /* (563) pseudo_column ::= QTAGS */ - -4, /* (564) function_expression ::= function_name NK_LP expression_list NK_RP */ - -4, /* (565) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ - -6, /* (566) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ - -6, /* (567) function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP */ - -1, /* (568) function_expression ::= literal_func */ - -3, /* (569) literal_func ::= noarg_func NK_LP NK_RP */ - -1, /* (570) literal_func ::= NOW */ - -1, /* (571) literal_func ::= TODAY */ - -1, /* (572) noarg_func ::= NOW */ - -1, /* (573) noarg_func ::= TODAY */ - -1, /* (574) noarg_func ::= TIMEZONE */ - -1, /* (575) noarg_func ::= DATABASE */ - -1, /* (576) noarg_func ::= CLIENT_VERSION */ - -1, /* (577) noarg_func ::= SERVER_VERSION */ - -1, /* (578) noarg_func ::= SERVER_STATUS */ - -1, /* (579) noarg_func ::= CURRENT_USER */ - -1, /* (580) noarg_func ::= USER */ - -1, /* (581) star_func ::= COUNT */ - -1, /* (582) star_func ::= FIRST */ - -1, /* (583) star_func ::= LAST */ - -1, /* (584) star_func ::= LAST_ROW */ - -1, /* (585) star_func_para_list ::= NK_STAR */ - -1, /* (586) star_func_para_list ::= other_para_list */ - -1, /* (587) other_para_list ::= star_func_para */ - -3, /* (588) other_para_list ::= other_para_list NK_COMMA star_func_para */ - -1, /* (589) star_func_para ::= expr_or_subquery */ - -3, /* (590) star_func_para ::= table_name NK_DOT NK_STAR */ - -4, /* (591) case_when_expression ::= CASE when_then_list case_when_else_opt END */ - -5, /* (592) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ - -1, /* (593) when_then_list ::= when_then_expr */ - -2, /* (594) when_then_list ::= when_then_list when_then_expr */ - -4, /* (595) when_then_expr ::= WHEN common_expression THEN common_expression */ - 0, /* (596) case_when_else_opt ::= */ - -2, /* (597) case_when_else_opt ::= ELSE common_expression */ - -3, /* (598) predicate ::= expr_or_subquery compare_op expr_or_subquery */ - -5, /* (599) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ - -6, /* (600) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ - -3, /* (601) predicate ::= expr_or_subquery IS NULL */ - -4, /* (602) predicate ::= expr_or_subquery IS NOT NULL */ - -3, /* (603) predicate ::= expr_or_subquery in_op in_predicate_value */ - -1, /* (604) compare_op ::= NK_LT */ - -1, /* (605) compare_op ::= NK_GT */ - -1, /* (606) compare_op ::= NK_LE */ - -1, /* (607) compare_op ::= NK_GE */ - -1, /* (608) compare_op ::= NK_NE */ - -1, /* (609) compare_op ::= NK_EQ */ - -1, /* (610) compare_op ::= LIKE */ - -2, /* (611) compare_op ::= NOT LIKE */ - -1, /* (612) compare_op ::= MATCH */ - -1, /* (613) compare_op ::= NMATCH */ - -1, /* (614) compare_op ::= CONTAINS */ - -1, /* (615) in_op ::= IN */ - -2, /* (616) in_op ::= NOT IN */ - -3, /* (617) in_predicate_value ::= NK_LP literal_list NK_RP */ - -1, /* (618) boolean_value_expression ::= boolean_primary */ - -2, /* (619) boolean_value_expression ::= NOT boolean_primary */ - -3, /* (620) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - -3, /* (621) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - -1, /* (622) boolean_primary ::= predicate */ - -3, /* (623) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ - -1, /* (624) common_expression ::= expr_or_subquery */ - -1, /* (625) common_expression ::= boolean_value_expression */ - 0, /* (626) from_clause_opt ::= */ - -2, /* (627) from_clause_opt ::= FROM table_reference_list */ - -1, /* (628) table_reference_list ::= table_reference */ - -3, /* (629) table_reference_list ::= table_reference_list NK_COMMA table_reference */ - -1, /* (630) table_reference ::= table_primary */ - -1, /* (631) table_reference ::= joined_table */ - -2, /* (632) table_primary ::= table_name alias_opt */ - -4, /* (633) table_primary ::= db_name NK_DOT table_name alias_opt */ - -2, /* (634) table_primary ::= subquery alias_opt */ - -1, /* (635) table_primary ::= parenthesized_joined_table */ - 0, /* (636) alias_opt ::= */ - -1, /* (637) alias_opt ::= table_alias */ - -2, /* (638) alias_opt ::= AS table_alias */ - -3, /* (639) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - -3, /* (640) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ - -8, /* (641) joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt */ - 0, /* (642) join_type ::= */ - -1, /* (643) join_type ::= INNER */ - -1, /* (644) join_type ::= LEFT */ - -1, /* (645) join_type ::= RIGHT */ - -1, /* (646) join_type ::= FULL */ - 0, /* (647) join_subtype ::= */ - -1, /* (648) join_subtype ::= OUTER */ - -1, /* (649) join_subtype ::= SEMI */ - -1, /* (650) join_subtype ::= ANTI */ - -1, /* (651) join_subtype ::= ASOF */ - -1, /* (652) join_subtype ::= WINDOW */ - 0, /* (653) join_on_clause_opt ::= */ - -2, /* (654) join_on_clause_opt ::= ON search_condition */ - 0, /* (655) window_offset_clause_opt ::= */ - -6, /* (656) window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP */ - -1, /* (657) window_offset_literal ::= NK_VARIABLE */ - -2, /* (658) window_offset_literal ::= NK_MINUS NK_VARIABLE */ - 0, /* (659) jlimit_clause_opt ::= */ - -2, /* (660) jlimit_clause_opt ::= JLIMIT NK_INTEGER */ - -14, /* (661) query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_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 */ - 0, /* (662) hint_list ::= */ - -1, /* (663) hint_list ::= NK_HINT */ - 0, /* (664) tag_mode_opt ::= */ - -1, /* (665) tag_mode_opt ::= TAGS */ - 0, /* (666) set_quantifier_opt ::= */ - -1, /* (667) set_quantifier_opt ::= DISTINCT */ - -1, /* (668) set_quantifier_opt ::= ALL */ - -1, /* (669) select_list ::= select_item */ - -3, /* (670) select_list ::= select_list NK_COMMA select_item */ - -1, /* (671) select_item ::= NK_STAR */ - -1, /* (672) select_item ::= common_expression */ - -2, /* (673) select_item ::= common_expression column_alias */ - -3, /* (674) select_item ::= common_expression AS column_alias */ - -3, /* (675) select_item ::= table_name NK_DOT NK_STAR */ - 0, /* (676) where_clause_opt ::= */ - -2, /* (677) where_clause_opt ::= WHERE search_condition */ - 0, /* (678) partition_by_clause_opt ::= */ - -3, /* (679) partition_by_clause_opt ::= PARTITION BY partition_list */ - -1, /* (680) partition_list ::= partition_item */ - -3, /* (681) partition_list ::= partition_list NK_COMMA partition_item */ - -1, /* (682) partition_item ::= expr_or_subquery */ - -2, /* (683) partition_item ::= expr_or_subquery column_alias */ - -3, /* (684) partition_item ::= expr_or_subquery AS column_alias */ - 0, /* (685) twindow_clause_opt ::= */ - -6, /* (686) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ - -4, /* (687) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ - -6, /* (688) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ - -8, /* (689) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ - -7, /* (690) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ - -4, /* (691) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */ - -6, /* (692) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - 0, /* (693) sliding_opt ::= */ - -4, /* (694) sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ - -1, /* (695) interval_sliding_duration_literal ::= NK_VARIABLE */ - -1, /* (696) interval_sliding_duration_literal ::= NK_STRING */ - -1, /* (697) interval_sliding_duration_literal ::= NK_INTEGER */ - 0, /* (698) fill_opt ::= */ - -4, /* (699) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - -6, /* (700) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ - -6, /* (701) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ - -1, /* (702) fill_mode ::= NONE */ - -1, /* (703) fill_mode ::= PREV */ - -1, /* (704) fill_mode ::= NULL */ - -1, /* (705) fill_mode ::= NULL_F */ - -1, /* (706) fill_mode ::= LINEAR */ - -1, /* (707) fill_mode ::= NEXT */ - 0, /* (708) group_by_clause_opt ::= */ - -3, /* (709) group_by_clause_opt ::= GROUP BY group_by_list */ - -1, /* (710) group_by_list ::= expr_or_subquery */ - -3, /* (711) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ - 0, /* (712) having_clause_opt ::= */ - -2, /* (713) having_clause_opt ::= HAVING search_condition */ - 0, /* (714) range_opt ::= */ - -6, /* (715) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ - -4, /* (716) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ - 0, /* (717) every_opt ::= */ - -4, /* (718) every_opt ::= EVERY NK_LP duration_literal NK_RP */ - -4, /* (719) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ - -1, /* (720) query_simple ::= query_specification */ - -1, /* (721) query_simple ::= union_query_expression */ - -4, /* (722) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ - -3, /* (723) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ - -1, /* (724) query_simple_or_subquery ::= query_simple */ - -1, /* (725) query_simple_or_subquery ::= subquery */ - -1, /* (726) query_or_subquery ::= query_expression */ - -1, /* (727) query_or_subquery ::= subquery */ - 0, /* (728) order_by_clause_opt ::= */ - -3, /* (729) order_by_clause_opt ::= ORDER BY sort_specification_list */ - 0, /* (730) slimit_clause_opt ::= */ - -2, /* (731) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - -4, /* (732) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - -4, /* (733) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - 0, /* (734) limit_clause_opt ::= */ - -2, /* (735) limit_clause_opt ::= LIMIT NK_INTEGER */ - -4, /* (736) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - -4, /* (737) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - -3, /* (738) subquery ::= NK_LP query_expression NK_RP */ - -3, /* (739) subquery ::= NK_LP subquery NK_RP */ - -1, /* (740) search_condition ::= common_expression */ - -1, /* (741) sort_specification_list ::= sort_specification */ - -3, /* (742) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - -3, /* (743) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ - 0, /* (744) ordering_specification_opt ::= */ - -1, /* (745) ordering_specification_opt ::= ASC */ - -1, /* (746) ordering_specification_opt ::= DESC */ - 0, /* (747) null_ordering_opt ::= */ - -2, /* (748) null_ordering_opt ::= NULLS FIRST */ - -2, /* (749) null_ordering_opt ::= NULLS LAST */ - 0, /* (750) column_options ::= */ - -3, /* (751) column_options ::= column_options PRIMARY KEY */ - -3, /* (752) column_options ::= column_options ENCODE NK_STRING */ - -3, /* (753) column_options ::= column_options COMPRESS NK_STRING */ - -3, /* (754) column_options ::= column_options LEVEL NK_STRING */ + -3, /* (421) stream_options ::= stream_options TRIGGER FORCE_WINDOW_CLOSE */ + -4, /* (422) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ + -3, /* (423) stream_options ::= stream_options WATERMARK duration_literal */ + -4, /* (424) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ + -3, /* (425) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ + -3, /* (426) stream_options ::= stream_options DELETE_MARK duration_literal */ + -4, /* (427) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ + 0, /* (428) subtable_opt ::= */ + -4, /* (429) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + 0, /* (430) ignore_opt ::= */ + -2, /* (431) ignore_opt ::= IGNORE UNTREATED */ + -3, /* (432) cmd ::= KILL CONNECTION NK_INTEGER */ + -3, /* (433) cmd ::= KILL QUERY NK_STRING */ + -3, /* (434) cmd ::= KILL TRANSACTION NK_INTEGER */ + -3, /* (435) cmd ::= KILL COMPACT NK_INTEGER */ + -2, /* (436) cmd ::= BALANCE VGROUP */ + -4, /* (437) cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ + -5, /* (438) cmd ::= BALANCE VGROUP LEADER DATABASE db_name */ + -4, /* (439) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + -4, /* (440) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ + -3, /* (441) cmd ::= SPLIT VGROUP NK_INTEGER */ + 0, /* (442) on_vgroup_id ::= */ + -2, /* (443) on_vgroup_id ::= ON NK_INTEGER */ + -2, /* (444) dnode_list ::= DNODE NK_INTEGER */ + -3, /* (445) dnode_list ::= dnode_list DNODE NK_INTEGER */ + -4, /* (446) cmd ::= DELETE FROM full_table_name where_clause_opt */ + -1, /* (447) cmd ::= query_or_subquery */ + -1, /* (448) cmd ::= insert_query */ + -7, /* (449) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ + -4, /* (450) insert_query ::= INSERT INTO full_table_name query_or_subquery */ + -1, /* (451) tags_literal ::= NK_INTEGER */ + -3, /* (452) tags_literal ::= NK_INTEGER NK_PLUS duration_literal */ + -3, /* (453) tags_literal ::= NK_INTEGER NK_MINUS duration_literal */ + -2, /* (454) tags_literal ::= NK_PLUS NK_INTEGER */ + -4, /* (455) tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal */ + -4, /* (456) tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal */ + -2, /* (457) tags_literal ::= NK_MINUS NK_INTEGER */ + -4, /* (458) tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal */ + -4, /* (459) tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal */ + -1, /* (460) tags_literal ::= NK_FLOAT */ + -2, /* (461) tags_literal ::= NK_PLUS NK_FLOAT */ + -2, /* (462) tags_literal ::= NK_MINUS NK_FLOAT */ + -1, /* (463) tags_literal ::= NK_BIN */ + -3, /* (464) tags_literal ::= NK_BIN NK_PLUS duration_literal */ + -3, /* (465) tags_literal ::= NK_BIN NK_MINUS duration_literal */ + -2, /* (466) tags_literal ::= NK_PLUS NK_BIN */ + -4, /* (467) tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal */ + -4, /* (468) tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal */ + -2, /* (469) tags_literal ::= NK_MINUS NK_BIN */ + -4, /* (470) tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal */ + -4, /* (471) tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal */ + -1, /* (472) tags_literal ::= NK_HEX */ + -3, /* (473) tags_literal ::= NK_HEX NK_PLUS duration_literal */ + -3, /* (474) tags_literal ::= NK_HEX NK_MINUS duration_literal */ + -2, /* (475) tags_literal ::= NK_PLUS NK_HEX */ + -4, /* (476) tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal */ + -4, /* (477) tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal */ + -2, /* (478) tags_literal ::= NK_MINUS NK_HEX */ + -4, /* (479) tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal */ + -4, /* (480) tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal */ + -1, /* (481) tags_literal ::= NK_STRING */ + -3, /* (482) tags_literal ::= NK_STRING NK_PLUS duration_literal */ + -3, /* (483) tags_literal ::= NK_STRING NK_MINUS duration_literal */ + -1, /* (484) tags_literal ::= NK_BOOL */ + -1, /* (485) tags_literal ::= NULL */ + -1, /* (486) tags_literal ::= literal_func */ + -3, /* (487) tags_literal ::= literal_func NK_PLUS duration_literal */ + -3, /* (488) tags_literal ::= literal_func NK_MINUS duration_literal */ + -1, /* (489) tags_literal_list ::= tags_literal */ + -3, /* (490) tags_literal_list ::= tags_literal_list NK_COMMA tags_literal */ + -1, /* (491) literal ::= NK_INTEGER */ + -1, /* (492) literal ::= NK_FLOAT */ + -1, /* (493) literal ::= NK_STRING */ + -1, /* (494) literal ::= NK_BOOL */ + -2, /* (495) literal ::= TIMESTAMP NK_STRING */ + -1, /* (496) literal ::= duration_literal */ + -1, /* (497) literal ::= NULL */ + -1, /* (498) literal ::= NK_QUESTION */ + -1, /* (499) duration_literal ::= NK_VARIABLE */ + -1, /* (500) signed ::= NK_INTEGER */ + -2, /* (501) signed ::= NK_PLUS NK_INTEGER */ + -2, /* (502) signed ::= NK_MINUS NK_INTEGER */ + -1, /* (503) signed ::= NK_FLOAT */ + -2, /* (504) signed ::= NK_PLUS NK_FLOAT */ + -2, /* (505) signed ::= NK_MINUS NK_FLOAT */ + -1, /* (506) signed_literal ::= signed */ + -1, /* (507) signed_literal ::= NK_STRING */ + -1, /* (508) signed_literal ::= NK_BOOL */ + -2, /* (509) signed_literal ::= TIMESTAMP NK_STRING */ + -1, /* (510) signed_literal ::= duration_literal */ + -1, /* (511) signed_literal ::= NULL */ + -1, /* (512) signed_literal ::= literal_func */ + -1, /* (513) signed_literal ::= NK_QUESTION */ + -1, /* (514) literal_list ::= signed_literal */ + -3, /* (515) literal_list ::= literal_list NK_COMMA signed_literal */ + -1, /* (516) db_name ::= NK_ID */ + -1, /* (517) table_name ::= NK_ID */ + -1, /* (518) column_name ::= NK_ID */ + -1, /* (519) function_name ::= NK_ID */ + -1, /* (520) view_name ::= NK_ID */ + -1, /* (521) table_alias ::= NK_ID */ + -1, /* (522) column_alias ::= NK_ID */ + -1, /* (523) column_alias ::= NK_ALIAS */ + -1, /* (524) user_name ::= NK_ID */ + -1, /* (525) topic_name ::= NK_ID */ + -1, /* (526) stream_name ::= NK_ID */ + -1, /* (527) cgroup_name ::= NK_ID */ + -1, /* (528) index_name ::= NK_ID */ + -1, /* (529) tsma_name ::= NK_ID */ + -1, /* (530) expr_or_subquery ::= expression */ + -1, /* (531) expression ::= literal */ + -1, /* (532) expression ::= pseudo_column */ + -1, /* (533) expression ::= column_reference */ + -1, /* (534) expression ::= function_expression */ + -1, /* (535) expression ::= case_when_expression */ + -3, /* (536) expression ::= NK_LP expression NK_RP */ + -2, /* (537) expression ::= NK_PLUS expr_or_subquery */ + -2, /* (538) expression ::= NK_MINUS expr_or_subquery */ + -3, /* (539) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ + -3, /* (540) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ + -3, /* (541) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ + -3, /* (542) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ + -3, /* (543) expression ::= expr_or_subquery NK_REM expr_or_subquery */ + -3, /* (544) expression ::= column_reference NK_ARROW NK_STRING */ + -3, /* (545) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ + -3, /* (546) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ + -1, /* (547) expression_list ::= expr_or_subquery */ + -3, /* (548) expression_list ::= expression_list NK_COMMA expr_or_subquery */ + -1, /* (549) column_reference ::= column_name */ + -3, /* (550) column_reference ::= table_name NK_DOT column_name */ + -1, /* (551) column_reference ::= NK_ALIAS */ + -3, /* (552) column_reference ::= table_name NK_DOT NK_ALIAS */ + -1, /* (553) pseudo_column ::= ROWTS */ + -1, /* (554) pseudo_column ::= TBNAME */ + -3, /* (555) pseudo_column ::= table_name NK_DOT TBNAME */ + -1, /* (556) pseudo_column ::= QSTART */ + -1, /* (557) pseudo_column ::= QEND */ + -1, /* (558) pseudo_column ::= QDURATION */ + -1, /* (559) pseudo_column ::= WSTART */ + -1, /* (560) pseudo_column ::= WEND */ + -1, /* (561) pseudo_column ::= WDURATION */ + -1, /* (562) pseudo_column ::= IROWTS */ + -1, /* (563) pseudo_column ::= ISFILLED */ + -1, /* (564) pseudo_column ::= QTAGS */ + -4, /* (565) function_expression ::= function_name NK_LP expression_list NK_RP */ + -4, /* (566) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ + -6, /* (567) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ + -6, /* (568) function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP */ + -1, /* (569) function_expression ::= literal_func */ + -3, /* (570) literal_func ::= noarg_func NK_LP NK_RP */ + -1, /* (571) literal_func ::= NOW */ + -1, /* (572) literal_func ::= TODAY */ + -1, /* (573) noarg_func ::= NOW */ + -1, /* (574) noarg_func ::= TODAY */ + -1, /* (575) noarg_func ::= TIMEZONE */ + -1, /* (576) noarg_func ::= DATABASE */ + -1, /* (577) noarg_func ::= CLIENT_VERSION */ + -1, /* (578) noarg_func ::= SERVER_VERSION */ + -1, /* (579) noarg_func ::= SERVER_STATUS */ + -1, /* (580) noarg_func ::= CURRENT_USER */ + -1, /* (581) noarg_func ::= USER */ + -1, /* (582) star_func ::= COUNT */ + -1, /* (583) star_func ::= FIRST */ + -1, /* (584) star_func ::= LAST */ + -1, /* (585) star_func ::= LAST_ROW */ + -1, /* (586) star_func_para_list ::= NK_STAR */ + -1, /* (587) star_func_para_list ::= other_para_list */ + -1, /* (588) other_para_list ::= star_func_para */ + -3, /* (589) other_para_list ::= other_para_list NK_COMMA star_func_para */ + -1, /* (590) star_func_para ::= expr_or_subquery */ + -3, /* (591) star_func_para ::= table_name NK_DOT NK_STAR */ + -4, /* (592) case_when_expression ::= CASE when_then_list case_when_else_opt END */ + -5, /* (593) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ + -1, /* (594) when_then_list ::= when_then_expr */ + -2, /* (595) when_then_list ::= when_then_list when_then_expr */ + -4, /* (596) when_then_expr ::= WHEN common_expression THEN common_expression */ + 0, /* (597) case_when_else_opt ::= */ + -2, /* (598) case_when_else_opt ::= ELSE common_expression */ + -3, /* (599) predicate ::= expr_or_subquery compare_op expr_or_subquery */ + -5, /* (600) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ + -6, /* (601) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ + -3, /* (602) predicate ::= expr_or_subquery IS NULL */ + -4, /* (603) predicate ::= expr_or_subquery IS NOT NULL */ + -3, /* (604) predicate ::= expr_or_subquery in_op in_predicate_value */ + -1, /* (605) compare_op ::= NK_LT */ + -1, /* (606) compare_op ::= NK_GT */ + -1, /* (607) compare_op ::= NK_LE */ + -1, /* (608) compare_op ::= NK_GE */ + -1, /* (609) compare_op ::= NK_NE */ + -1, /* (610) compare_op ::= NK_EQ */ + -1, /* (611) compare_op ::= LIKE */ + -2, /* (612) compare_op ::= NOT LIKE */ + -1, /* (613) compare_op ::= MATCH */ + -1, /* (614) compare_op ::= NMATCH */ + -1, /* (615) compare_op ::= CONTAINS */ + -1, /* (616) in_op ::= IN */ + -2, /* (617) in_op ::= NOT IN */ + -3, /* (618) in_predicate_value ::= NK_LP literal_list NK_RP */ + -1, /* (619) boolean_value_expression ::= boolean_primary */ + -2, /* (620) boolean_value_expression ::= NOT boolean_primary */ + -3, /* (621) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + -3, /* (622) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + -1, /* (623) boolean_primary ::= predicate */ + -3, /* (624) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ + -1, /* (625) common_expression ::= expr_or_subquery */ + -1, /* (626) common_expression ::= boolean_value_expression */ + 0, /* (627) from_clause_opt ::= */ + -2, /* (628) from_clause_opt ::= FROM table_reference_list */ + -1, /* (629) table_reference_list ::= table_reference */ + -3, /* (630) table_reference_list ::= table_reference_list NK_COMMA table_reference */ + -1, /* (631) table_reference ::= table_primary */ + -1, /* (632) table_reference ::= joined_table */ + -2, /* (633) table_primary ::= table_name alias_opt */ + -4, /* (634) table_primary ::= db_name NK_DOT table_name alias_opt */ + -2, /* (635) table_primary ::= subquery alias_opt */ + -1, /* (636) table_primary ::= parenthesized_joined_table */ + 0, /* (637) alias_opt ::= */ + -1, /* (638) alias_opt ::= table_alias */ + -2, /* (639) alias_opt ::= AS table_alias */ + -3, /* (640) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + -3, /* (641) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ + -8, /* (642) joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt */ + 0, /* (643) join_type ::= */ + -1, /* (644) join_type ::= INNER */ + -1, /* (645) join_type ::= LEFT */ + -1, /* (646) join_type ::= RIGHT */ + -1, /* (647) join_type ::= FULL */ + 0, /* (648) join_subtype ::= */ + -1, /* (649) join_subtype ::= OUTER */ + -1, /* (650) join_subtype ::= SEMI */ + -1, /* (651) join_subtype ::= ANTI */ + -1, /* (652) join_subtype ::= ASOF */ + -1, /* (653) join_subtype ::= WINDOW */ + 0, /* (654) join_on_clause_opt ::= */ + -2, /* (655) join_on_clause_opt ::= ON search_condition */ + 0, /* (656) window_offset_clause_opt ::= */ + -6, /* (657) window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP */ + -1, /* (658) window_offset_literal ::= NK_VARIABLE */ + -2, /* (659) window_offset_literal ::= NK_MINUS NK_VARIABLE */ + 0, /* (660) jlimit_clause_opt ::= */ + -2, /* (661) jlimit_clause_opt ::= JLIMIT NK_INTEGER */ + -14, /* (662) query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_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 */ + 0, /* (663) hint_list ::= */ + -1, /* (664) hint_list ::= NK_HINT */ + 0, /* (665) tag_mode_opt ::= */ + -1, /* (666) tag_mode_opt ::= TAGS */ + 0, /* (667) set_quantifier_opt ::= */ + -1, /* (668) set_quantifier_opt ::= DISTINCT */ + -1, /* (669) set_quantifier_opt ::= ALL */ + -1, /* (670) select_list ::= select_item */ + -3, /* (671) select_list ::= select_list NK_COMMA select_item */ + -1, /* (672) select_item ::= NK_STAR */ + -1, /* (673) select_item ::= common_expression */ + -2, /* (674) select_item ::= common_expression column_alias */ + -3, /* (675) select_item ::= common_expression AS column_alias */ + -3, /* (676) select_item ::= table_name NK_DOT NK_STAR */ + 0, /* (677) where_clause_opt ::= */ + -2, /* (678) where_clause_opt ::= WHERE search_condition */ + 0, /* (679) partition_by_clause_opt ::= */ + -3, /* (680) partition_by_clause_opt ::= PARTITION BY partition_list */ + -1, /* (681) partition_list ::= partition_item */ + -3, /* (682) partition_list ::= partition_list NK_COMMA partition_item */ + -1, /* (683) partition_item ::= expr_or_subquery */ + -2, /* (684) partition_item ::= expr_or_subquery column_alias */ + -3, /* (685) partition_item ::= expr_or_subquery AS column_alias */ + 0, /* (686) twindow_clause_opt ::= */ + -6, /* (687) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ + -4, /* (688) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ + -6, /* (689) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ + -8, /* (690) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ + -7, /* (691) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ + -4, /* (692) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */ + -6, /* (693) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + 0, /* (694) sliding_opt ::= */ + -4, /* (695) sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ + -1, /* (696) interval_sliding_duration_literal ::= NK_VARIABLE */ + -1, /* (697) interval_sliding_duration_literal ::= NK_STRING */ + -1, /* (698) interval_sliding_duration_literal ::= NK_INTEGER */ + 0, /* (699) fill_opt ::= */ + -4, /* (700) fill_opt ::= FILL NK_LP fill_mode NK_RP */ + -6, /* (701) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ + -6, /* (702) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ + -1, /* (703) fill_mode ::= NONE */ + -1, /* (704) fill_mode ::= PREV */ + -1, /* (705) fill_mode ::= NULL */ + -1, /* (706) fill_mode ::= NULL_F */ + -1, /* (707) fill_mode ::= LINEAR */ + -1, /* (708) fill_mode ::= NEXT */ + 0, /* (709) group_by_clause_opt ::= */ + -3, /* (710) group_by_clause_opt ::= GROUP BY group_by_list */ + -1, /* (711) group_by_list ::= expr_or_subquery */ + -3, /* (712) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ + 0, /* (713) having_clause_opt ::= */ + -2, /* (714) having_clause_opt ::= HAVING search_condition */ + 0, /* (715) range_opt ::= */ + -6, /* (716) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ + -4, /* (717) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ + 0, /* (718) every_opt ::= */ + -4, /* (719) every_opt ::= EVERY NK_LP duration_literal NK_RP */ + -4, /* (720) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ + -1, /* (721) query_simple ::= query_specification */ + -1, /* (722) query_simple ::= union_query_expression */ + -4, /* (723) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ + -3, /* (724) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ + -1, /* (725) query_simple_or_subquery ::= query_simple */ + -1, /* (726) query_simple_or_subquery ::= subquery */ + -1, /* (727) query_or_subquery ::= query_expression */ + -1, /* (728) query_or_subquery ::= subquery */ + 0, /* (729) order_by_clause_opt ::= */ + -3, /* (730) order_by_clause_opt ::= ORDER BY sort_specification_list */ + 0, /* (731) slimit_clause_opt ::= */ + -2, /* (732) slimit_clause_opt ::= SLIMIT NK_INTEGER */ + -4, /* (733) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + -4, /* (734) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + 0, /* (735) limit_clause_opt ::= */ + -2, /* (736) limit_clause_opt ::= LIMIT NK_INTEGER */ + -4, /* (737) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ + -4, /* (738) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + -3, /* (739) subquery ::= NK_LP query_expression NK_RP */ + -3, /* (740) subquery ::= NK_LP subquery NK_RP */ + -1, /* (741) search_condition ::= common_expression */ + -1, /* (742) sort_specification_list ::= sort_specification */ + -3, /* (743) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ + -3, /* (744) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ + 0, /* (745) ordering_specification_opt ::= */ + -1, /* (746) ordering_specification_opt ::= ASC */ + -1, /* (747) ordering_specification_opt ::= DESC */ + 0, /* (748) null_ordering_opt ::= */ + -2, /* (749) null_ordering_opt ::= NULLS FIRST */ + -2, /* (750) null_ordering_opt ::= NULLS LAST */ + 0, /* (751) column_options ::= */ + -3, /* (752) column_options ::= column_options PRIMARY KEY */ + -3, /* (753) column_options ::= column_options ENCODE NK_STRING */ + -3, /* (754) column_options ::= column_options COMPRESS NK_STRING */ + -3, /* (755) column_options ::= column_options LEVEL NK_STRING */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -5562,21 +5563,15 @@ static YYACTIONTYPE yy_reduce( /********** Begin reduce actions **********************************************/ YYMINORTYPE yylhsminor; case 0: /* cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ -#line 50 "sql.y" { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } -#line 5567 "sql.c" - yy_destructor(yypParser,379,&yymsp[0].minor); + yy_destructor(yypParser,380,&yymsp[0].minor); break; case 1: /* cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ -#line 51 "sql.y" { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } -#line 5573 "sql.c" - yy_destructor(yypParser,380,&yymsp[0].minor); + yy_destructor(yypParser,381,&yymsp[0].minor); break; case 2: /* account_options ::= */ -#line 55 "sql.y" { } -#line 5579 "sql.c" break; case 3: /* account_options ::= account_options PPS literal */ case 4: /* account_options ::= account_options TSERIES literal */ yytestcase(yyruleno==4); @@ -5587,26 +5582,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,379,&yymsp[-2].minor); -#line 56 "sql.y" +{ yy_destructor(yypParser,380,&yymsp[-2].minor); { } -#line 5593 "sql.c" - yy_destructor(yypParser,381,&yymsp[0].minor); + yy_destructor(yypParser,382,&yymsp[0].minor); } break; case 12: /* alter_account_options ::= alter_account_option */ -{ yy_destructor(yypParser,382,&yymsp[0].minor); -#line 68 "sql.y" +{ yy_destructor(yypParser,383,&yymsp[0].minor); { } -#line 5601 "sql.c" } break; case 13: /* alter_account_options ::= alter_account_options alter_account_option */ -{ yy_destructor(yypParser,380,&yymsp[-1].minor); -#line 69 "sql.y" +{ yy_destructor(yypParser,381,&yymsp[-1].minor); { } -#line 5608 "sql.c" - yy_destructor(yypParser,382,&yymsp[0].minor); + yy_destructor(yypParser,383,&yymsp[0].minor); } break; case 14: /* alter_account_option ::= PASS literal */ @@ -5619,27 +5608,19 @@ static YYACTIONTYPE yy_reduce( case 21: /* alter_account_option ::= USERS literal */ yytestcase(yyruleno==21); case 22: /* alter_account_option ::= CONNS literal */ yytestcase(yyruleno==22); case 23: /* alter_account_option ::= STATE literal */ yytestcase(yyruleno==23); -#line 73 "sql.y" { } -#line 5624 "sql.c" - yy_destructor(yypParser,381,&yymsp[0].minor); + yy_destructor(yypParser,382,&yymsp[0].minor); break; case 24: /* ip_range_list ::= NK_STRING */ -#line 86 "sql.y" -{ yylhsminor.yy316 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } -#line 5630 "sql.c" - yymsp[0].minor.yy316 = yylhsminor.yy316; +{ yylhsminor.yy652 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy652 = yylhsminor.yy652; break; case 25: /* ip_range_list ::= ip_range_list NK_COMMA NK_STRING */ -#line 87 "sql.y" -{ yylhsminor.yy316 = addNodeToList(pCxt, yymsp[-2].minor.yy316, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } -#line 5636 "sql.c" - yymsp[-2].minor.yy316 = yylhsminor.yy316; +{ yylhsminor.yy652 = addNodeToList(pCxt, yymsp[-2].minor.yy652, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy652 = yylhsminor.yy652; break; case 26: /* white_list ::= HOST ip_range_list */ -#line 91 "sql.y" -{ yymsp[-1].minor.yy316 = yymsp[0].minor.yy316; } -#line 5642 "sql.c" +{ yymsp[-1].minor.yy652 = yymsp[0].minor.yy652; } break; case 27: /* white_list_opt ::= */ case 206: /* specific_cols_opt ::= */ yytestcase(yyruleno==206); @@ -5647,246 +5628,166 @@ static YYACTIONTYPE yy_reduce( case 335: /* tag_list_opt ::= */ yytestcase(yyruleno==335); case 408: /* col_list_opt ::= */ yytestcase(yyruleno==408); case 415: /* tag_def_or_ref_opt ::= */ yytestcase(yyruleno==415); - case 678: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==678); - case 708: /* group_by_clause_opt ::= */ yytestcase(yyruleno==708); - case 728: /* order_by_clause_opt ::= */ yytestcase(yyruleno==728); -#line 95 "sql.y" -{ yymsp[1].minor.yy316 = NULL; } -#line 5655 "sql.c" + case 679: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==679); + case 709: /* group_by_clause_opt ::= */ yytestcase(yyruleno==709); + case 729: /* order_by_clause_opt ::= */ yytestcase(yyruleno==729); +{ yymsp[1].minor.yy652 = NULL; } break; case 28: /* white_list_opt ::= white_list */ case 245: /* tags_def_opt ::= tags_def */ yytestcase(yyruleno==245); case 416: /* tag_def_or_ref_opt ::= tags_def */ yytestcase(yyruleno==416); - case 586: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==586); -#line 96 "sql.y" -{ yylhsminor.yy316 = yymsp[0].minor.yy316; } -#line 5663 "sql.c" - yymsp[0].minor.yy316 = yylhsminor.yy316; + case 587: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==587); +{ yylhsminor.yy652 = yymsp[0].minor.yy652; } + yymsp[0].minor.yy652 = yylhsminor.yy652; break; case 29: /* is_import_opt ::= */ case 31: /* is_createdb_opt ::= */ yytestcase(yyruleno==31); -#line 100 "sql.y" -{ yymsp[1].minor.yy1043 = 0; } -#line 5670 "sql.c" +{ yymsp[1].minor.yy535 = 0; } break; case 30: /* is_import_opt ::= IS_IMPORT NK_INTEGER */ case 32: /* is_createdb_opt ::= CREATEDB NK_INTEGER */ yytestcase(yyruleno==32); case 42: /* sysinfo_opt ::= SYSINFO NK_INTEGER */ yytestcase(yyruleno==42); -#line 101 "sql.y" -{ yymsp[-1].minor.yy1043 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); } -#line 5677 "sql.c" +{ yymsp[-1].minor.yy535 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); } break; case 33: /* cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt is_createdb_opt is_import_opt white_list_opt */ -#line 109 "sql.y" { - pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-6].minor.yy1109, &yymsp[-4].minor.yy0, yymsp[-3].minor.yy1043, yymsp[-1].minor.yy1043, yymsp[-2].minor.yy1043); - pCxt->pRootNode = addCreateUserStmtWhiteList(pCxt, pCxt->pRootNode, yymsp[0].minor.yy316); + pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-6].minor.yy837, &yymsp[-4].minor.yy0, yymsp[-3].minor.yy535, yymsp[-1].minor.yy535, yymsp[-2].minor.yy535); + pCxt->pRootNode = addCreateUserStmtWhiteList(pCxt, pCxt->pRootNode, yymsp[0].minor.yy652); } -#line 5685 "sql.c" break; case 34: /* cmd ::= ALTER USER user_name PASS NK_STRING */ -#line 113 "sql.y" -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy1109, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } -#line 5690 "sql.c" +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy837, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } break; case 35: /* cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ -#line 114 "sql.y" -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy1109, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); } -#line 5695 "sql.c" +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy837, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); } break; case 36: /* cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ -#line 115 "sql.y" -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy1109, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); } -#line 5700 "sql.c" +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy837, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); } break; case 37: /* cmd ::= ALTER USER user_name CREATEDB NK_INTEGER */ -#line 116 "sql.y" -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy1109, TSDB_ALTER_USER_CREATEDB, &yymsp[0].minor.yy0); } -#line 5705 "sql.c" +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy837, TSDB_ALTER_USER_CREATEDB, &yymsp[0].minor.yy0); } break; case 38: /* cmd ::= ALTER USER user_name ADD white_list */ -#line 117 "sql.y" -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy1109, TSDB_ALTER_USER_ADD_WHITE_LIST, yymsp[0].minor.yy316); } -#line 5710 "sql.c" +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy837, TSDB_ALTER_USER_ADD_WHITE_LIST, yymsp[0].minor.yy652); } break; case 39: /* cmd ::= ALTER USER user_name DROP white_list */ -#line 118 "sql.y" -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy1109, TSDB_ALTER_USER_DROP_WHITE_LIST, yymsp[0].minor.yy316); } -#line 5715 "sql.c" +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy837, TSDB_ALTER_USER_DROP_WHITE_LIST, yymsp[0].minor.yy652); } break; case 40: /* cmd ::= DROP USER user_name */ -#line 119 "sql.y" -{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy1109); } -#line 5720 "sql.c" +{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy837); } break; case 41: /* sysinfo_opt ::= */ -#line 123 "sql.y" -{ yymsp[1].minor.yy1043 = 1; } -#line 5725 "sql.c" +{ yymsp[1].minor.yy535 = 1; } break; case 43: /* cmd ::= GRANT privileges ON priv_level with_opt TO user_name */ -#line 127 "sql.y" -{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-5].minor.yy1089, &yymsp[-3].minor.yy849, &yymsp[0].minor.yy1109, yymsp[-2].minor.yy416); } -#line 5730 "sql.c" +{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-5].minor.yy909, &yymsp[-3].minor.yy495, &yymsp[0].minor.yy837, yymsp[-2].minor.yy54); } break; case 44: /* cmd ::= REVOKE privileges ON priv_level with_opt FROM user_name */ -#line 128 "sql.y" -{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-5].minor.yy1089, &yymsp[-3].minor.yy849, &yymsp[0].minor.yy1109, yymsp[-2].minor.yy416); } -#line 5735 "sql.c" +{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-5].minor.yy909, &yymsp[-3].minor.yy495, &yymsp[0].minor.yy837, yymsp[-2].minor.yy54); } break; case 45: /* privileges ::= ALL */ -#line 132 "sql.y" -{ yymsp[0].minor.yy1089 = PRIVILEGE_TYPE_ALL; } -#line 5740 "sql.c" +{ yymsp[0].minor.yy909 = PRIVILEGE_TYPE_ALL; } break; case 46: /* privileges ::= priv_type_list */ case 48: /* priv_type_list ::= priv_type */ yytestcase(yyruleno==48); -#line 133 "sql.y" -{ yylhsminor.yy1089 = yymsp[0].minor.yy1089; } -#line 5746 "sql.c" - yymsp[0].minor.yy1089 = yylhsminor.yy1089; +{ yylhsminor.yy909 = yymsp[0].minor.yy909; } + yymsp[0].minor.yy909 = yylhsminor.yy909; break; case 47: /* privileges ::= SUBSCRIBE */ -#line 134 "sql.y" -{ yymsp[0].minor.yy1089 = PRIVILEGE_TYPE_SUBSCRIBE; } -#line 5752 "sql.c" +{ yymsp[0].minor.yy909 = PRIVILEGE_TYPE_SUBSCRIBE; } break; case 49: /* priv_type_list ::= priv_type_list NK_COMMA priv_type */ -#line 139 "sql.y" -{ yylhsminor.yy1089 = yymsp[-2].minor.yy1089 | yymsp[0].minor.yy1089; } -#line 5757 "sql.c" - yymsp[-2].minor.yy1089 = yylhsminor.yy1089; +{ yylhsminor.yy909 = yymsp[-2].minor.yy909 | yymsp[0].minor.yy909; } + yymsp[-2].minor.yy909 = yylhsminor.yy909; break; case 50: /* priv_type ::= READ */ -#line 143 "sql.y" -{ yymsp[0].minor.yy1089 = PRIVILEGE_TYPE_READ; } -#line 5763 "sql.c" +{ yymsp[0].minor.yy909 = PRIVILEGE_TYPE_READ; } break; case 51: /* priv_type ::= WRITE */ -#line 144 "sql.y" -{ yymsp[0].minor.yy1089 = PRIVILEGE_TYPE_WRITE; } -#line 5768 "sql.c" +{ yymsp[0].minor.yy909 = PRIVILEGE_TYPE_WRITE; } break; case 52: /* priv_type ::= ALTER */ -#line 145 "sql.y" -{ yymsp[0].minor.yy1089 = PRIVILEGE_TYPE_ALTER; } -#line 5773 "sql.c" +{ yymsp[0].minor.yy909 = PRIVILEGE_TYPE_ALTER; } break; case 53: /* priv_level ::= NK_STAR NK_DOT NK_STAR */ -#line 149 "sql.y" -{ yylhsminor.yy849.first = yymsp[-2].minor.yy0; yylhsminor.yy849.second = yymsp[0].minor.yy0; } -#line 5778 "sql.c" - yymsp[-2].minor.yy849 = yylhsminor.yy849; +{ yylhsminor.yy495.first = yymsp[-2].minor.yy0; yylhsminor.yy495.second = yymsp[0].minor.yy0; } + yymsp[-2].minor.yy495 = yylhsminor.yy495; break; case 54: /* priv_level ::= db_name NK_DOT NK_STAR */ -#line 150 "sql.y" -{ yylhsminor.yy849.first = yymsp[-2].minor.yy1109; yylhsminor.yy849.second = yymsp[0].minor.yy0; } -#line 5784 "sql.c" - yymsp[-2].minor.yy849 = yylhsminor.yy849; +{ yylhsminor.yy495.first = yymsp[-2].minor.yy837; yylhsminor.yy495.second = yymsp[0].minor.yy0; } + yymsp[-2].minor.yy495 = yylhsminor.yy495; break; case 55: /* priv_level ::= db_name NK_DOT table_name */ -#line 151 "sql.y" -{ yylhsminor.yy849.first = yymsp[-2].minor.yy1109; yylhsminor.yy849.second = yymsp[0].minor.yy1109; } -#line 5790 "sql.c" - yymsp[-2].minor.yy849 = yylhsminor.yy849; +{ yylhsminor.yy495.first = yymsp[-2].minor.yy837; yylhsminor.yy495.second = yymsp[0].minor.yy837; } + yymsp[-2].minor.yy495 = yylhsminor.yy495; break; case 56: /* priv_level ::= topic_name */ -#line 152 "sql.y" -{ yylhsminor.yy849.first = yymsp[0].minor.yy1109; yylhsminor.yy849.second = nil_token; } -#line 5796 "sql.c" - yymsp[0].minor.yy849 = yylhsminor.yy849; +{ yylhsminor.yy495.first = yymsp[0].minor.yy837; yylhsminor.yy495.second = nil_token; } + yymsp[0].minor.yy495 = yylhsminor.yy495; break; case 57: /* with_opt ::= */ case 173: /* start_opt ::= */ yytestcase(yyruleno==173); case 177: /* end_opt ::= */ yytestcase(yyruleno==177); case 330: /* like_pattern_opt ::= */ yytestcase(yyruleno==330); - case 427: /* subtable_opt ::= */ yytestcase(yyruleno==427); - case 596: /* case_when_else_opt ::= */ yytestcase(yyruleno==596); - case 626: /* from_clause_opt ::= */ yytestcase(yyruleno==626); - case 653: /* join_on_clause_opt ::= */ yytestcase(yyruleno==653); - case 655: /* window_offset_clause_opt ::= */ yytestcase(yyruleno==655); - case 659: /* jlimit_clause_opt ::= */ yytestcase(yyruleno==659); - case 676: /* where_clause_opt ::= */ yytestcase(yyruleno==676); - case 685: /* twindow_clause_opt ::= */ yytestcase(yyruleno==685); - case 693: /* sliding_opt ::= */ yytestcase(yyruleno==693); - case 698: /* fill_opt ::= */ yytestcase(yyruleno==698); - case 712: /* having_clause_opt ::= */ yytestcase(yyruleno==712); - case 714: /* range_opt ::= */ yytestcase(yyruleno==714); - case 717: /* every_opt ::= */ yytestcase(yyruleno==717); - case 730: /* slimit_clause_opt ::= */ yytestcase(yyruleno==730); - case 734: /* limit_clause_opt ::= */ yytestcase(yyruleno==734); -#line 154 "sql.y" -{ yymsp[1].minor.yy416 = NULL; } -#line 5820 "sql.c" + case 428: /* subtable_opt ::= */ yytestcase(yyruleno==428); + case 597: /* case_when_else_opt ::= */ yytestcase(yyruleno==597); + case 627: /* from_clause_opt ::= */ yytestcase(yyruleno==627); + case 654: /* join_on_clause_opt ::= */ yytestcase(yyruleno==654); + case 656: /* window_offset_clause_opt ::= */ yytestcase(yyruleno==656); + case 660: /* jlimit_clause_opt ::= */ yytestcase(yyruleno==660); + case 677: /* where_clause_opt ::= */ yytestcase(yyruleno==677); + case 686: /* twindow_clause_opt ::= */ yytestcase(yyruleno==686); + case 694: /* sliding_opt ::= */ yytestcase(yyruleno==694); + case 699: /* fill_opt ::= */ yytestcase(yyruleno==699); + case 713: /* having_clause_opt ::= */ yytestcase(yyruleno==713); + case 715: /* range_opt ::= */ yytestcase(yyruleno==715); + case 718: /* every_opt ::= */ yytestcase(yyruleno==718); + case 731: /* slimit_clause_opt ::= */ yytestcase(yyruleno==731); + case 735: /* limit_clause_opt ::= */ yytestcase(yyruleno==735); +{ yymsp[1].minor.yy54 = NULL; } break; case 58: /* with_opt ::= WITH search_condition */ - case 627: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==627); - case 654: /* join_on_clause_opt ::= ON search_condition */ yytestcase(yyruleno==654); - case 677: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==677); - case 713: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==713); -#line 155 "sql.y" -{ yymsp[-1].minor.yy416 = yymsp[0].minor.yy416; } -#line 5829 "sql.c" + case 628: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==628); + case 655: /* join_on_clause_opt ::= ON search_condition */ yytestcase(yyruleno==655); + case 678: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==678); + case 714: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==714); +{ yymsp[-1].minor.yy54 = yymsp[0].minor.yy54; } break; case 59: /* cmd ::= CREATE ENCRYPT_KEY NK_STRING */ -#line 158 "sql.y" { pCxt->pRootNode = createEncryptKeyStmt(pCxt, &yymsp[0].minor.yy0); } -#line 5834 "sql.c" break; case 60: /* cmd ::= CREATE DNODE dnode_endpoint */ -#line 161 "sql.y" -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy1109, NULL); } -#line 5839 "sql.c" +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy837, NULL); } break; case 61: /* cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ -#line 162 "sql.y" -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy1109, &yymsp[0].minor.yy0); } -#line 5844 "sql.c" +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy837, &yymsp[0].minor.yy0); } break; case 62: /* cmd ::= DROP DNODE NK_INTEGER force_opt */ -#line 163 "sql.y" -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy209, false); } -#line 5849 "sql.c" +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy325, false); } break; case 63: /* cmd ::= DROP DNODE dnode_endpoint force_opt */ -#line 164 "sql.y" -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy1109, yymsp[0].minor.yy209, false); } -#line 5854 "sql.c" +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy837, yymsp[0].minor.yy325, false); } break; case 64: /* cmd ::= DROP DNODE NK_INTEGER unsafe_opt */ -#line 165 "sql.y" -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, false, yymsp[0].minor.yy209); } -#line 5859 "sql.c" +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, false, yymsp[0].minor.yy325); } break; case 65: /* cmd ::= DROP DNODE dnode_endpoint unsafe_opt */ -#line 166 "sql.y" -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy1109, false, yymsp[0].minor.yy209); } -#line 5864 "sql.c" +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy837, false, yymsp[0].minor.yy325); } break; case 66: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ -#line 167 "sql.y" { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, NULL); } -#line 5869 "sql.c" break; case 67: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ -#line 168 "sql.y" { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-2].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } -#line 5874 "sql.c" break; case 68: /* cmd ::= ALTER ALL DNODES NK_STRING */ -#line 169 "sql.y" { pCxt->pRootNode = createAlterDnodeStmt(pCxt, NULL, &yymsp[0].minor.yy0, NULL); } -#line 5879 "sql.c" break; case 69: /* cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ -#line 170 "sql.y" { pCxt->pRootNode = createAlterDnodeStmt(pCxt, NULL, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } -#line 5884 "sql.c" break; case 70: /* cmd ::= RESTORE DNODE NK_INTEGER */ -#line 171 "sql.y" { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_DNODE_STMT, &yymsp[0].minor.yy0); } -#line 5889 "sql.c" break; case 71: /* dnode_endpoint ::= NK_STRING */ case 72: /* dnode_endpoint ::= NK_ID */ yytestcase(yyruleno==72); @@ -5895,37 +5796,35 @@ static YYACTIONTYPE yy_reduce( case 365: /* sma_func_name ::= FIRST */ yytestcase(yyruleno==365); case 366: /* sma_func_name ::= LAST */ yytestcase(yyruleno==366); case 367: /* sma_func_name ::= LAST_ROW */ yytestcase(yyruleno==367); - case 515: /* db_name ::= NK_ID */ yytestcase(yyruleno==515); - case 516: /* table_name ::= NK_ID */ yytestcase(yyruleno==516); - case 517: /* column_name ::= NK_ID */ yytestcase(yyruleno==517); - case 518: /* function_name ::= NK_ID */ yytestcase(yyruleno==518); - case 519: /* view_name ::= NK_ID */ yytestcase(yyruleno==519); - case 520: /* table_alias ::= NK_ID */ yytestcase(yyruleno==520); - case 521: /* column_alias ::= NK_ID */ yytestcase(yyruleno==521); - case 522: /* column_alias ::= NK_ALIAS */ yytestcase(yyruleno==522); - case 523: /* user_name ::= NK_ID */ yytestcase(yyruleno==523); - case 524: /* topic_name ::= NK_ID */ yytestcase(yyruleno==524); - case 525: /* stream_name ::= NK_ID */ yytestcase(yyruleno==525); - case 526: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==526); - case 527: /* index_name ::= NK_ID */ yytestcase(yyruleno==527); - case 528: /* tsma_name ::= NK_ID */ yytestcase(yyruleno==528); - case 572: /* noarg_func ::= NOW */ yytestcase(yyruleno==572); - case 573: /* noarg_func ::= TODAY */ yytestcase(yyruleno==573); - case 574: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==574); - case 575: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==575); - case 576: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==576); - case 577: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==577); - case 578: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==578); - case 579: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==579); - case 580: /* noarg_func ::= USER */ yytestcase(yyruleno==580); - case 581: /* star_func ::= COUNT */ yytestcase(yyruleno==581); - case 582: /* star_func ::= FIRST */ yytestcase(yyruleno==582); - case 583: /* star_func ::= LAST */ yytestcase(yyruleno==583); - case 584: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==584); -#line 175 "sql.y" -{ yylhsminor.yy1109 = yymsp[0].minor.yy0; } -#line 5927 "sql.c" - yymsp[0].minor.yy1109 = yylhsminor.yy1109; + case 516: /* db_name ::= NK_ID */ yytestcase(yyruleno==516); + case 517: /* table_name ::= NK_ID */ yytestcase(yyruleno==517); + case 518: /* column_name ::= NK_ID */ yytestcase(yyruleno==518); + case 519: /* function_name ::= NK_ID */ yytestcase(yyruleno==519); + case 520: /* view_name ::= NK_ID */ yytestcase(yyruleno==520); + case 521: /* table_alias ::= NK_ID */ yytestcase(yyruleno==521); + case 522: /* column_alias ::= NK_ID */ yytestcase(yyruleno==522); + case 523: /* column_alias ::= NK_ALIAS */ yytestcase(yyruleno==523); + case 524: /* user_name ::= NK_ID */ yytestcase(yyruleno==524); + case 525: /* topic_name ::= NK_ID */ yytestcase(yyruleno==525); + case 526: /* stream_name ::= NK_ID */ yytestcase(yyruleno==526); + case 527: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==527); + case 528: /* index_name ::= NK_ID */ yytestcase(yyruleno==528); + case 529: /* tsma_name ::= NK_ID */ yytestcase(yyruleno==529); + case 573: /* noarg_func ::= NOW */ yytestcase(yyruleno==573); + case 574: /* noarg_func ::= TODAY */ yytestcase(yyruleno==574); + case 575: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==575); + case 576: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==576); + case 577: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==577); + case 578: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==578); + case 579: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==579); + case 580: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==580); + case 581: /* noarg_func ::= USER */ yytestcase(yyruleno==581); + case 582: /* star_func ::= COUNT */ yytestcase(yyruleno==582); + case 583: /* star_func ::= FIRST */ yytestcase(yyruleno==583); + case 584: /* star_func ::= LAST */ yytestcase(yyruleno==584); + case 585: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==585); +{ yylhsminor.yy837 = yymsp[0].minor.yy0; } + yymsp[0].minor.yy837 = yylhsminor.yy837; break; case 74: /* force_opt ::= */ case 101: /* not_exists_opt ::= */ yytestcase(yyruleno==101); @@ -5933,500 +5832,330 @@ static YYACTIONTYPE yy_reduce( case 385: /* analyze_opt ::= */ yytestcase(yyruleno==385); case 392: /* agg_func_opt ::= */ yytestcase(yyruleno==392); case 398: /* or_replace_opt ::= */ yytestcase(yyruleno==398); - case 429: /* ignore_opt ::= */ yytestcase(yyruleno==429); - case 664: /* tag_mode_opt ::= */ yytestcase(yyruleno==664); - case 666: /* set_quantifier_opt ::= */ yytestcase(yyruleno==666); -#line 181 "sql.y" -{ yymsp[1].minor.yy209 = false; } -#line 5941 "sql.c" + case 430: /* ignore_opt ::= */ yytestcase(yyruleno==430); + case 665: /* tag_mode_opt ::= */ yytestcase(yyruleno==665); + case 667: /* set_quantifier_opt ::= */ yytestcase(yyruleno==667); +{ yymsp[1].minor.yy325 = false; } break; case 75: /* force_opt ::= FORCE */ case 76: /* unsafe_opt ::= UNSAFE */ yytestcase(yyruleno==76); case 386: /* analyze_opt ::= ANALYZE */ yytestcase(yyruleno==386); case 393: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==393); - case 665: /* tag_mode_opt ::= TAGS */ yytestcase(yyruleno==665); - case 667: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==667); -#line 182 "sql.y" -{ yymsp[0].minor.yy209 = true; } -#line 5951 "sql.c" + case 666: /* tag_mode_opt ::= TAGS */ yytestcase(yyruleno==666); + case 668: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==668); +{ yymsp[0].minor.yy325 = true; } break; case 77: /* cmd ::= ALTER CLUSTER NK_STRING */ -#line 189 "sql.y" { pCxt->pRootNode = createAlterClusterStmt(pCxt, &yymsp[0].minor.yy0, NULL); } -#line 5956 "sql.c" break; case 78: /* cmd ::= ALTER CLUSTER NK_STRING NK_STRING */ -#line 190 "sql.y" { pCxt->pRootNode = createAlterClusterStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } -#line 5961 "sql.c" break; case 79: /* cmd ::= ALTER LOCAL NK_STRING */ -#line 193 "sql.y" { pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[0].minor.yy0, NULL); } -#line 5966 "sql.c" break; case 80: /* cmd ::= ALTER LOCAL NK_STRING NK_STRING */ -#line 194 "sql.y" { pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } -#line 5971 "sql.c" break; case 81: /* cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ -#line 197 "sql.y" { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_QNODE_STMT, &yymsp[0].minor.yy0); } -#line 5976 "sql.c" break; case 82: /* cmd ::= DROP QNODE ON DNODE NK_INTEGER */ -#line 198 "sql.y" { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_QNODE_STMT, &yymsp[0].minor.yy0); } -#line 5981 "sql.c" break; case 83: /* cmd ::= RESTORE QNODE ON DNODE NK_INTEGER */ -#line 199 "sql.y" { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_QNODE_STMT, &yymsp[0].minor.yy0); } -#line 5986 "sql.c" break; case 84: /* cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ -#line 202 "sql.y" { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_BNODE_STMT, &yymsp[0].minor.yy0); } -#line 5991 "sql.c" break; case 85: /* cmd ::= DROP BNODE ON DNODE NK_INTEGER */ -#line 203 "sql.y" { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_BNODE_STMT, &yymsp[0].minor.yy0); } -#line 5996 "sql.c" break; case 86: /* cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ -#line 206 "sql.y" { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_SNODE_STMT, &yymsp[0].minor.yy0); } -#line 6001 "sql.c" break; case 87: /* cmd ::= DROP SNODE ON DNODE NK_INTEGER */ -#line 207 "sql.y" { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_SNODE_STMT, &yymsp[0].minor.yy0); } -#line 6006 "sql.c" break; case 88: /* cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ -#line 210 "sql.y" { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_MNODE_STMT, &yymsp[0].minor.yy0); } -#line 6011 "sql.c" break; case 89: /* cmd ::= DROP MNODE ON DNODE NK_INTEGER */ -#line 211 "sql.y" { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_MNODE_STMT, &yymsp[0].minor.yy0); } -#line 6016 "sql.c" break; case 90: /* cmd ::= RESTORE MNODE ON DNODE NK_INTEGER */ -#line 212 "sql.y" { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_MNODE_STMT, &yymsp[0].minor.yy0); } -#line 6021 "sql.c" break; case 91: /* cmd ::= RESTORE VNODE ON DNODE NK_INTEGER */ -#line 215 "sql.y" { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_VNODE_STMT, &yymsp[0].minor.yy0); } -#line 6026 "sql.c" break; case 92: /* cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ -#line 218 "sql.y" -{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy209, &yymsp[-1].minor.yy1109, yymsp[0].minor.yy416); } -#line 6031 "sql.c" +{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy325, &yymsp[-1].minor.yy837, yymsp[0].minor.yy54); } break; case 93: /* cmd ::= DROP DATABASE exists_opt db_name */ -#line 219 "sql.y" -{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy209, &yymsp[0].minor.yy1109); } -#line 6036 "sql.c" +{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy325, &yymsp[0].minor.yy837); } break; case 94: /* cmd ::= USE db_name */ -#line 220 "sql.y" -{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy1109); } -#line 6041 "sql.c" +{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy837); } break; case 95: /* cmd ::= ALTER DATABASE db_name alter_db_options */ -#line 221 "sql.y" -{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy1109, yymsp[0].minor.yy416); } -#line 6046 "sql.c" +{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy837, yymsp[0].minor.yy54); } break; case 96: /* cmd ::= FLUSH DATABASE db_name */ -#line 222 "sql.y" -{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy1109); } -#line 6051 "sql.c" +{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy837); } break; case 97: /* cmd ::= TRIM DATABASE db_name speed_opt */ -#line 223 "sql.y" -{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy1109, yymsp[0].minor.yy820); } -#line 6056 "sql.c" +{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy837, yymsp[0].minor.yy332); } break; case 98: /* cmd ::= S3MIGRATE DATABASE db_name */ -#line 224 "sql.y" -{ pCxt->pRootNode = createS3MigrateDatabaseStmt(pCxt, &yymsp[0].minor.yy1109); } -#line 6061 "sql.c" +{ pCxt->pRootNode = createS3MigrateDatabaseStmt(pCxt, &yymsp[0].minor.yy837); } break; case 99: /* cmd ::= COMPACT DATABASE db_name start_opt end_opt */ -#line 225 "sql.y" -{ pCxt->pRootNode = createCompactStmt(pCxt, &yymsp[-2].minor.yy1109, yymsp[-1].minor.yy416, yymsp[0].minor.yy416); } -#line 6066 "sql.c" +{ pCxt->pRootNode = createCompactStmt(pCxt, &yymsp[-2].minor.yy837, yymsp[-1].minor.yy54, yymsp[0].minor.yy54); } break; case 100: /* not_exists_opt ::= IF NOT EXISTS */ -#line 229 "sql.y" -{ yymsp[-2].minor.yy209 = true; } -#line 6071 "sql.c" +{ yymsp[-2].minor.yy325 = true; } break; case 102: /* exists_opt ::= IF EXISTS */ case 399: /* or_replace_opt ::= OR REPLACE */ yytestcase(yyruleno==399); - case 430: /* ignore_opt ::= IGNORE UNTREATED */ yytestcase(yyruleno==430); -#line 234 "sql.y" -{ yymsp[-1].minor.yy209 = true; } -#line 6078 "sql.c" + case 431: /* ignore_opt ::= IGNORE UNTREATED */ yytestcase(yyruleno==431); +{ yymsp[-1].minor.yy325 = true; } break; case 104: /* db_options ::= */ -#line 237 "sql.y" -{ yymsp[1].minor.yy416 = createDefaultDatabaseOptions(pCxt); } -#line 6083 "sql.c" +{ yymsp[1].minor.yy54 = createDefaultDatabaseOptions(pCxt); } break; case 105: /* db_options ::= db_options BUFFER NK_INTEGER */ -#line 238 "sql.y" -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } -#line 6088 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 106: /* db_options ::= db_options CACHEMODEL NK_STRING */ -#line 239 "sql.y" -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); } -#line 6094 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 107: /* db_options ::= db_options CACHESIZE NK_INTEGER */ -#line 240 "sql.y" -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); } -#line 6100 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 108: /* db_options ::= db_options COMP NK_INTEGER */ -#line 241 "sql.y" -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_COMP, &yymsp[0].minor.yy0); } -#line 6106 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_COMP, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 109: /* db_options ::= db_options DURATION NK_INTEGER */ case 110: /* db_options ::= db_options DURATION NK_VARIABLE */ yytestcase(yyruleno==110); -#line 242 "sql.y" -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } -#line 6113 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 111: /* db_options ::= db_options MAXROWS NK_INTEGER */ -#line 244 "sql.y" -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } -#line 6119 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 112: /* db_options ::= db_options MINROWS NK_INTEGER */ -#line 245 "sql.y" -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } -#line 6125 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 113: /* db_options ::= db_options KEEP integer_list */ case 114: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==114); -#line 246 "sql.y" -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_KEEP, yymsp[0].minor.yy316); } -#line 6132 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_KEEP, yymsp[0].minor.yy652); } + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 115: /* db_options ::= db_options PAGES NK_INTEGER */ -#line 248 "sql.y" -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } -#line 6138 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 116: /* db_options ::= db_options PAGESIZE NK_INTEGER */ -#line 249 "sql.y" -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } -#line 6144 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 117: /* db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ -#line 250 "sql.y" -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); } -#line 6150 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 118: /* db_options ::= db_options PRECISION NK_STRING */ -#line 251 "sql.y" -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } -#line 6156 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 119: /* db_options ::= db_options REPLICA NK_INTEGER */ -#line 252 "sql.y" -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } -#line 6162 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 120: /* db_options ::= db_options VGROUPS NK_INTEGER */ -#line 254 "sql.y" -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } -#line 6168 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 121: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */ -#line 255 "sql.y" -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } -#line 6174 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 122: /* db_options ::= db_options RETENTIONS retention_list */ -#line 256 "sql.y" -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_RETENTIONS, yymsp[0].minor.yy316); } -#line 6180 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_RETENTIONS, yymsp[0].minor.yy652); } + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 123: /* db_options ::= db_options SCHEMALESS NK_INTEGER */ -#line 257 "sql.y" -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } -#line 6186 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 124: /* db_options ::= db_options WAL_LEVEL NK_INTEGER */ -#line 258 "sql.y" -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_WAL, &yymsp[0].minor.yy0); } -#line 6192 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_WAL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 125: /* db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ -#line 259 "sql.y" -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } -#line 6198 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 126: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ -#line 260 "sql.y" -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); } -#line 6204 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 127: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ -#line 261 "sql.y" { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-3].minor.yy416, DB_OPTION_WAL_RETENTION_PERIOD, &t); + yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-3].minor.yy54, DB_OPTION_WAL_RETENTION_PERIOD, &t); } -#line 6214 "sql.c" - yymsp[-3].minor.yy416 = yylhsminor.yy416; + yymsp[-3].minor.yy54 = yylhsminor.yy54; break; case 128: /* db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ -#line 266 "sql.y" -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); } -#line 6220 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 129: /* db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ -#line 267 "sql.y" { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-3].minor.yy416, DB_OPTION_WAL_RETENTION_SIZE, &t); + yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-3].minor.yy54, DB_OPTION_WAL_RETENTION_SIZE, &t); } -#line 6230 "sql.c" - yymsp[-3].minor.yy416 = yylhsminor.yy416; + yymsp[-3].minor.yy54 = yylhsminor.yy54; break; case 130: /* db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ -#line 272 "sql.y" -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); } -#line 6236 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 131: /* db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ -#line 273 "sql.y" -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); } -#line 6242 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 132: /* db_options ::= db_options STT_TRIGGER NK_INTEGER */ -#line 274 "sql.y" -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); } -#line 6248 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 133: /* db_options ::= db_options TABLE_PREFIX signed */ -#line 275 "sql.y" -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_TABLE_PREFIX, yymsp[0].minor.yy416); } -#line 6254 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_TABLE_PREFIX, yymsp[0].minor.yy54); } + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 134: /* db_options ::= db_options TABLE_SUFFIX signed */ -#line 276 "sql.y" -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_TABLE_SUFFIX, yymsp[0].minor.yy416); } -#line 6260 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_TABLE_SUFFIX, yymsp[0].minor.yy54); } + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 135: /* db_options ::= db_options S3_CHUNKSIZE NK_INTEGER */ -#line 277 "sql.y" -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_S3_CHUNKSIZE, &yymsp[0].minor.yy0); } -#line 6266 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_S3_CHUNKSIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 136: /* db_options ::= db_options S3_KEEPLOCAL NK_INTEGER */ case 137: /* db_options ::= db_options S3_KEEPLOCAL NK_VARIABLE */ yytestcase(yyruleno==137); -#line 278 "sql.y" -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_S3_KEEPLOCAL, &yymsp[0].minor.yy0); } -#line 6273 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_S3_KEEPLOCAL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 138: /* db_options ::= db_options S3_COMPACT NK_INTEGER */ -#line 280 "sql.y" -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_S3_COMPACT, &yymsp[0].minor.yy0); } -#line 6279 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_S3_COMPACT, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 139: /* db_options ::= db_options KEEP_TIME_OFFSET NK_INTEGER */ -#line 281 "sql.y" -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_KEEP_TIME_OFFSET, &yymsp[0].minor.yy0); } -#line 6285 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_KEEP_TIME_OFFSET, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 140: /* db_options ::= db_options ENCRYPT_ALGORITHM NK_STRING */ -#line 282 "sql.y" -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_ENCRYPT_ALGORITHM, &yymsp[0].minor.yy0); } -#line 6291 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_ENCRYPT_ALGORITHM, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 141: /* alter_db_options ::= alter_db_option */ -#line 284 "sql.y" -{ yylhsminor.yy416 = createAlterDatabaseOptions(pCxt); yylhsminor.yy416 = setAlterDatabaseOption(pCxt, yylhsminor.yy416, &yymsp[0].minor.yy101); } -#line 6297 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = createAlterDatabaseOptions(pCxt); yylhsminor.yy54 = setAlterDatabaseOption(pCxt, yylhsminor.yy54, &yymsp[0].minor.yy663); } + yymsp[0].minor.yy54 = yylhsminor.yy54; break; case 142: /* alter_db_options ::= alter_db_options alter_db_option */ -#line 285 "sql.y" -{ yylhsminor.yy416 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy416, &yymsp[0].minor.yy101); } -#line 6303 "sql.c" - yymsp[-1].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy54, &yymsp[0].minor.yy663); } + yymsp[-1].minor.yy54 = yylhsminor.yy54; break; case 143: /* alter_db_option ::= BUFFER NK_INTEGER */ -#line 289 "sql.y" -{ yymsp[-1].minor.yy101.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } -#line 6309 "sql.c" +{ yymsp[-1].minor.yy663.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy663.val = yymsp[0].minor.yy0; } break; case 144: /* alter_db_option ::= CACHEMODEL NK_STRING */ -#line 290 "sql.y" -{ yymsp[-1].minor.yy101.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } -#line 6314 "sql.c" +{ yymsp[-1].minor.yy663.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy663.val = yymsp[0].minor.yy0; } break; case 145: /* alter_db_option ::= CACHESIZE NK_INTEGER */ -#line 291 "sql.y" -{ yymsp[-1].minor.yy101.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } -#line 6319 "sql.c" +{ yymsp[-1].minor.yy663.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy663.val = yymsp[0].minor.yy0; } break; case 146: /* alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ -#line 292 "sql.y" -{ yymsp[-1].minor.yy101.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } -#line 6324 "sql.c" +{ yymsp[-1].minor.yy663.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy663.val = yymsp[0].minor.yy0; } break; case 147: /* alter_db_option ::= KEEP integer_list */ case 148: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==148); -#line 293 "sql.y" -{ yymsp[-1].minor.yy101.type = DB_OPTION_KEEP; yymsp[-1].minor.yy101.pList = yymsp[0].minor.yy316; } -#line 6330 "sql.c" +{ yymsp[-1].minor.yy663.type = DB_OPTION_KEEP; yymsp[-1].minor.yy663.pList = yymsp[0].minor.yy652; } break; case 149: /* alter_db_option ::= PAGES NK_INTEGER */ -#line 295 "sql.y" -{ yymsp[-1].minor.yy101.type = DB_OPTION_PAGES; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } -#line 6335 "sql.c" +{ yymsp[-1].minor.yy663.type = DB_OPTION_PAGES; yymsp[-1].minor.yy663.val = yymsp[0].minor.yy0; } break; case 150: /* alter_db_option ::= REPLICA NK_INTEGER */ -#line 296 "sql.y" -{ yymsp[-1].minor.yy101.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } -#line 6340 "sql.c" +{ yymsp[-1].minor.yy663.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy663.val = yymsp[0].minor.yy0; } break; case 151: /* alter_db_option ::= WAL_LEVEL NK_INTEGER */ -#line 298 "sql.y" -{ yymsp[-1].minor.yy101.type = DB_OPTION_WAL; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } -#line 6345 "sql.c" +{ yymsp[-1].minor.yy663.type = DB_OPTION_WAL; yymsp[-1].minor.yy663.val = yymsp[0].minor.yy0; } break; case 152: /* alter_db_option ::= STT_TRIGGER NK_INTEGER */ -#line 299 "sql.y" -{ yymsp[-1].minor.yy101.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } -#line 6350 "sql.c" +{ yymsp[-1].minor.yy663.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy663.val = yymsp[0].minor.yy0; } break; case 153: /* alter_db_option ::= MINROWS NK_INTEGER */ -#line 300 "sql.y" -{ yymsp[-1].minor.yy101.type = DB_OPTION_MINROWS; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } -#line 6355 "sql.c" +{ yymsp[-1].minor.yy663.type = DB_OPTION_MINROWS; yymsp[-1].minor.yy663.val = yymsp[0].minor.yy0; } break; case 154: /* alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */ -#line 301 "sql.y" -{ yymsp[-1].minor.yy101.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } -#line 6360 "sql.c" +{ yymsp[-1].minor.yy663.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-1].minor.yy663.val = yymsp[0].minor.yy0; } break; case 155: /* alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ -#line 302 "sql.y" { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yymsp[-2].minor.yy101.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-2].minor.yy101.val = t; + yymsp[-2].minor.yy663.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-2].minor.yy663.val = t; } -#line 6369 "sql.c" break; case 156: /* alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */ -#line 307 "sql.y" -{ yymsp[-1].minor.yy101.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } -#line 6374 "sql.c" +{ yymsp[-1].minor.yy663.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-1].minor.yy663.val = yymsp[0].minor.yy0; } break; case 157: /* alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ -#line 308 "sql.y" { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yymsp[-2].minor.yy101.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-2].minor.yy101.val = t; + yymsp[-2].minor.yy663.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-2].minor.yy663.val = t; } -#line 6383 "sql.c" break; case 158: /* alter_db_option ::= S3_KEEPLOCAL NK_INTEGER */ case 159: /* alter_db_option ::= S3_KEEPLOCAL NK_VARIABLE */ yytestcase(yyruleno==159); -#line 313 "sql.y" -{ yymsp[-1].minor.yy101.type = DB_OPTION_S3_KEEPLOCAL; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } -#line 6389 "sql.c" +{ yymsp[-1].minor.yy663.type = DB_OPTION_S3_KEEPLOCAL; yymsp[-1].minor.yy663.val = yymsp[0].minor.yy0; } break; case 160: /* alter_db_option ::= S3_COMPACT NK_INTEGER */ -#line 315 "sql.y" -{ yymsp[-1].minor.yy101.type = DB_OPTION_S3_COMPACT, yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } -#line 6394 "sql.c" +{ yymsp[-1].minor.yy663.type = DB_OPTION_S3_COMPACT, yymsp[-1].minor.yy663.val = yymsp[0].minor.yy0; } break; case 161: /* alter_db_option ::= KEEP_TIME_OFFSET NK_INTEGER */ -#line 316 "sql.y" -{ yymsp[-1].minor.yy101.type = DB_OPTION_KEEP_TIME_OFFSET; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } -#line 6399 "sql.c" +{ yymsp[-1].minor.yy663.type = DB_OPTION_KEEP_TIME_OFFSET; yymsp[-1].minor.yy663.val = yymsp[0].minor.yy0; } break; case 162: /* alter_db_option ::= ENCRYPT_ALGORITHM NK_STRING */ -#line 317 "sql.y" -{ yymsp[-1].minor.yy101.type = DB_OPTION_ENCRYPT_ALGORITHM; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } -#line 6404 "sql.c" +{ yymsp[-1].minor.yy663.type = DB_OPTION_ENCRYPT_ALGORITHM; yymsp[-1].minor.yy663.val = yymsp[0].minor.yy0; } break; case 163: /* integer_list ::= NK_INTEGER */ -#line 321 "sql.y" -{ yylhsminor.yy316 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } -#line 6409 "sql.c" - yymsp[0].minor.yy316 = yylhsminor.yy316; +{ yylhsminor.yy652 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy652 = yylhsminor.yy652; break; case 164: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */ - case 444: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==444); -#line 322 "sql.y" -{ yylhsminor.yy316 = addNodeToList(pCxt, yymsp[-2].minor.yy316, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } -#line 6416 "sql.c" - yymsp[-2].minor.yy316 = yylhsminor.yy316; + case 445: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==445); +{ yylhsminor.yy652 = addNodeToList(pCxt, yymsp[-2].minor.yy652, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy652 = yylhsminor.yy652; break; case 165: /* variable_list ::= NK_VARIABLE */ -#line 326 "sql.y" -{ yylhsminor.yy316 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } -#line 6422 "sql.c" - yymsp[0].minor.yy316 = yylhsminor.yy316; +{ yylhsminor.yy652 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy652 = yylhsminor.yy652; break; case 166: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */ -#line 327 "sql.y" -{ yylhsminor.yy316 = addNodeToList(pCxt, yymsp[-2].minor.yy316, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } -#line 6428 "sql.c" - yymsp[-2].minor.yy316 = yylhsminor.yy316; +{ yylhsminor.yy652 = addNodeToList(pCxt, yymsp[-2].minor.yy652, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy652 = yylhsminor.yy652; break; case 167: /* retention_list ::= retention */ case 200: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==200); @@ -6438,17 +6167,15 @@ static YYACTIONTYPE yy_reduce( case 336: /* tag_list_opt ::= tag_item */ yytestcase(yyruleno==336); case 360: /* func_list ::= func */ yytestcase(yyruleno==360); case 410: /* column_stream_def_list ::= column_stream_def */ yytestcase(yyruleno==410); - case 488: /* tags_literal_list ::= tags_literal */ yytestcase(yyruleno==488); - case 513: /* literal_list ::= signed_literal */ yytestcase(yyruleno==513); - case 587: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==587); - case 593: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==593); - case 669: /* select_list ::= select_item */ yytestcase(yyruleno==669); - case 680: /* partition_list ::= partition_item */ yytestcase(yyruleno==680); - case 741: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==741); -#line 331 "sql.y" -{ yylhsminor.yy316 = createNodeList(pCxt, yymsp[0].minor.yy416); } -#line 6450 "sql.c" - yymsp[0].minor.yy316 = yylhsminor.yy316; + case 489: /* tags_literal_list ::= tags_literal */ yytestcase(yyruleno==489); + case 514: /* literal_list ::= signed_literal */ yytestcase(yyruleno==514); + case 588: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==588); + case 594: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==594); + case 670: /* select_list ::= select_item */ yytestcase(yyruleno==670); + case 681: /* partition_list ::= partition_item */ yytestcase(yyruleno==681); + case 742: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==742); +{ yylhsminor.yy652 = createNodeList(pCxt, yymsp[0].minor.yy54); } + yymsp[0].minor.yy652 = yylhsminor.yy652; break; case 168: /* retention_list ::= retention_list NK_COMMA retention */ case 204: /* multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ yytestcase(yyruleno==204); @@ -6459,2214 +6186,1489 @@ static YYACTIONTYPE yy_reduce( case 337: /* tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ yytestcase(yyruleno==337); case 361: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==361); case 411: /* column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def */ yytestcase(yyruleno==411); - case 489: /* tags_literal_list ::= tags_literal_list NK_COMMA tags_literal */ yytestcase(yyruleno==489); - case 514: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==514); - case 588: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==588); - case 670: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==670); - case 681: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==681); - case 742: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==742); -#line 332 "sql.y" -{ yylhsminor.yy316 = addNodeToList(pCxt, yymsp[-2].minor.yy316, yymsp[0].minor.yy416); } -#line 6470 "sql.c" - yymsp[-2].minor.yy316 = yylhsminor.yy316; + case 490: /* tags_literal_list ::= tags_literal_list NK_COMMA tags_literal */ yytestcase(yyruleno==490); + case 515: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==515); + case 589: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==589); + case 671: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==671); + case 682: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==682); + case 743: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==743); +{ yylhsminor.yy652 = addNodeToList(pCxt, yymsp[-2].minor.yy652, yymsp[0].minor.yy54); } + yymsp[-2].minor.yy652 = yylhsminor.yy652; break; case 169: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ case 170: /* retention ::= NK_MINUS NK_COLON NK_VARIABLE */ yytestcase(yyruleno==170); -#line 334 "sql.y" -{ yylhsminor.yy416 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } -#line 6477 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 171: /* speed_opt ::= */ case 394: /* bufsize_opt ::= */ yytestcase(yyruleno==394); -#line 339 "sql.y" -{ yymsp[1].minor.yy820 = 0; } -#line 6484 "sql.c" +{ yymsp[1].minor.yy332 = 0; } break; case 172: /* speed_opt ::= BWLIMIT NK_INTEGER */ case 395: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==395); -#line 340 "sql.y" -{ yymsp[-1].minor.yy820 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } -#line 6490 "sql.c" +{ yymsp[-1].minor.yy332 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } break; case 174: /* start_opt ::= START WITH NK_INTEGER */ case 178: /* end_opt ::= END WITH NK_INTEGER */ yytestcase(yyruleno==178); -#line 343 "sql.y" -{ yymsp[-2].minor.yy416 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } -#line 6496 "sql.c" +{ yymsp[-2].minor.yy54 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } break; case 175: /* start_opt ::= START WITH NK_STRING */ case 179: /* end_opt ::= END WITH NK_STRING */ yytestcase(yyruleno==179); -#line 344 "sql.y" -{ yymsp[-2].minor.yy416 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } -#line 6502 "sql.c" +{ yymsp[-2].minor.yy54 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } break; case 176: /* start_opt ::= START WITH TIMESTAMP NK_STRING */ case 180: /* end_opt ::= END WITH TIMESTAMP NK_STRING */ yytestcase(yyruleno==180); -#line 345 "sql.y" -{ yymsp[-3].minor.yy416 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } -#line 6508 "sql.c" +{ yymsp[-3].minor.yy54 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } break; case 181: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ case 184: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==184); -#line 354 "sql.y" -{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy209, yymsp[-5].minor.yy416, yymsp[-3].minor.yy316, yymsp[-1].minor.yy316, yymsp[0].minor.yy416); } -#line 6514 "sql.c" +{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy325, yymsp[-5].minor.yy54, yymsp[-3].minor.yy652, yymsp[-1].minor.yy652, yymsp[0].minor.yy54); } break; case 182: /* cmd ::= CREATE TABLE multi_create_clause */ -#line 355 "sql.y" -{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy316); } -#line 6519 "sql.c" +{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy652); } break; case 183: /* cmd ::= CREATE TABLE not_exists_opt USING full_table_name NK_LP tag_list_opt NK_RP FILE NK_STRING */ -#line 357 "sql.y" -{ pCxt->pRootNode = createCreateSubTableFromFileClause(pCxt, yymsp[-7].minor.yy209, yymsp[-5].minor.yy416, yymsp[-3].minor.yy316, &yymsp[0].minor.yy0); } -#line 6524 "sql.c" +{ pCxt->pRootNode = createCreateSubTableFromFileClause(pCxt, yymsp[-7].minor.yy325, yymsp[-5].minor.yy54, yymsp[-3].minor.yy652, &yymsp[0].minor.yy0); } break; case 185: /* cmd ::= DROP TABLE multi_drop_clause */ -#line 360 "sql.y" -{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy316); } -#line 6529 "sql.c" +{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy652); } break; case 186: /* cmd ::= DROP STABLE exists_opt full_table_name */ -#line 361 "sql.y" -{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy209, yymsp[0].minor.yy416); } -#line 6534 "sql.c" +{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy325, yymsp[0].minor.yy54); } break; case 187: /* cmd ::= ALTER TABLE alter_table_clause */ - case 446: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==446); - case 447: /* cmd ::= insert_query */ yytestcase(yyruleno==447); -#line 363 "sql.y" -{ pCxt->pRootNode = yymsp[0].minor.yy416; } -#line 6541 "sql.c" + case 447: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==447); + case 448: /* cmd ::= insert_query */ yytestcase(yyruleno==448); +{ pCxt->pRootNode = yymsp[0].minor.yy54; } break; case 188: /* cmd ::= ALTER STABLE alter_table_clause */ -#line 364 "sql.y" -{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy416); } -#line 6546 "sql.c" +{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy54); } break; case 189: /* alter_table_clause ::= full_table_name alter_table_options */ -#line 366 "sql.y" -{ yylhsminor.yy416 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy416, yymsp[0].minor.yy416); } -#line 6551 "sql.c" - yymsp[-1].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy54, yymsp[0].minor.yy54); } + yymsp[-1].minor.yy54 = yylhsminor.yy54; break; case 190: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name column_options */ -#line 368 "sql.y" -{ yylhsminor.yy416 = createAlterTableAddModifyColOptions2(pCxt, yymsp[-5].minor.yy416, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-2].minor.yy1109, yymsp[-1].minor.yy952, yymsp[0].minor.yy416); } -#line 6557 "sql.c" - yymsp[-5].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = createAlterTableAddModifyColOptions2(pCxt, yymsp[-5].minor.yy54, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-2].minor.yy837, yymsp[-1].minor.yy84, yymsp[0].minor.yy54); } + yymsp[-5].minor.yy54 = yylhsminor.yy54; break; case 191: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ -#line 369 "sql.y" -{ yylhsminor.yy416 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy416, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy1109); } -#line 6563 "sql.c" - yymsp[-3].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy54, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy837); } + yymsp[-3].minor.yy54 = yylhsminor.yy54; break; case 192: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ -#line 371 "sql.y" -{ yylhsminor.yy416 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy416, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy1109, yymsp[0].minor.yy952); } -#line 6569 "sql.c" - yymsp[-4].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy54, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy837, yymsp[0].minor.yy84); } + yymsp[-4].minor.yy54 = yylhsminor.yy54; break; case 193: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name column_options */ -#line 373 "sql.y" -{ yylhsminor.yy416 = createAlterTableAddModifyColOptions(pCxt, yymsp[-4].minor.yy416, TSDB_ALTER_TABLE_UPDATE_COLUMN_COMPRESS, &yymsp[-1].minor.yy1109, yymsp[0].minor.yy416); } -#line 6575 "sql.c" - yymsp[-4].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = createAlterTableAddModifyColOptions(pCxt, yymsp[-4].minor.yy54, TSDB_ALTER_TABLE_UPDATE_COLUMN_COMPRESS, &yymsp[-1].minor.yy837, yymsp[0].minor.yy54); } + yymsp[-4].minor.yy54 = yylhsminor.yy54; break; case 194: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ -#line 375 "sql.y" -{ yylhsminor.yy416 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy416, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy1109, &yymsp[0].minor.yy1109); } -#line 6581 "sql.c" - yymsp[-4].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy54, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy837, &yymsp[0].minor.yy837); } + yymsp[-4].minor.yy54 = yylhsminor.yy54; break; case 195: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ -#line 377 "sql.y" -{ yylhsminor.yy416 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy416, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy1109, yymsp[0].minor.yy952); } -#line 6587 "sql.c" - yymsp[-4].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy54, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy837, yymsp[0].minor.yy84); } + yymsp[-4].minor.yy54 = yylhsminor.yy54; break; case 196: /* alter_table_clause ::= full_table_name DROP TAG column_name */ -#line 378 "sql.y" -{ yylhsminor.yy416 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy416, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy1109); } -#line 6593 "sql.c" - yymsp[-3].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy54, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy837); } + yymsp[-3].minor.yy54 = yylhsminor.yy54; break; case 197: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ -#line 380 "sql.y" -{ yylhsminor.yy416 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy416, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy1109, yymsp[0].minor.yy952); } -#line 6599 "sql.c" - yymsp[-4].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy54, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy837, yymsp[0].minor.yy84); } + yymsp[-4].minor.yy54 = yylhsminor.yy54; break; case 198: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ -#line 382 "sql.y" -{ yylhsminor.yy416 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy416, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy1109, &yymsp[0].minor.yy1109); } -#line 6605 "sql.c" - yymsp[-4].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy54, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy837, &yymsp[0].minor.yy837); } + yymsp[-4].minor.yy54 = yylhsminor.yy54; break; case 199: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ tags_literal */ -#line 384 "sql.y" -{ yylhsminor.yy416 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy416, &yymsp[-2].minor.yy1109, yymsp[0].minor.yy416); } -#line 6611 "sql.c" - yymsp[-5].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy54, &yymsp[-2].minor.yy837, yymsp[0].minor.yy54); } + yymsp[-5].minor.yy54 = yylhsminor.yy54; break; case 201: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ - case 594: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==594); -#line 389 "sql.y" -{ yylhsminor.yy316 = addNodeToList(pCxt, yymsp[-1].minor.yy316, yymsp[0].minor.yy416); } -#line 6618 "sql.c" - yymsp[-1].minor.yy316 = yylhsminor.yy316; + case 595: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==595); +{ yylhsminor.yy652 = addNodeToList(pCxt, yymsp[-1].minor.yy652, yymsp[0].minor.yy54); } + yymsp[-1].minor.yy652 = yylhsminor.yy652; break; case 202: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP tags_literal_list NK_RP table_options */ -#line 393 "sql.y" -{ yylhsminor.yy416 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy209, yymsp[-8].minor.yy416, yymsp[-6].minor.yy416, yymsp[-5].minor.yy316, yymsp[-2].minor.yy316, yymsp[0].minor.yy416); } -#line 6624 "sql.c" - yymsp[-9].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy325, yymsp[-8].minor.yy54, yymsp[-6].minor.yy54, yymsp[-5].minor.yy652, yymsp[-2].minor.yy652, yymsp[0].minor.yy54); } + yymsp[-9].minor.yy54 = yylhsminor.yy54; break; case 205: /* drop_table_clause ::= exists_opt full_table_name */ -#line 400 "sql.y" -{ yylhsminor.yy416 = createDropTableClause(pCxt, yymsp[-1].minor.yy209, yymsp[0].minor.yy416); } -#line 6630 "sql.c" - yymsp[-1].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = createDropTableClause(pCxt, yymsp[-1].minor.yy325, yymsp[0].minor.yy54); } + yymsp[-1].minor.yy54 = yylhsminor.yy54; break; case 207: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */ case 409: /* col_list_opt ::= NK_LP column_stream_def_list NK_RP */ yytestcase(yyruleno==409); -#line 405 "sql.y" -{ yymsp[-2].minor.yy316 = yymsp[-1].minor.yy316; } -#line 6637 "sql.c" +{ yymsp[-2].minor.yy652 = yymsp[-1].minor.yy652; } break; case 208: /* full_table_name ::= table_name */ case 350: /* full_tsma_name ::= tsma_name */ yytestcase(yyruleno==350); -#line 407 "sql.y" -{ yylhsminor.yy416 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy1109, NULL); } -#line 6643 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy837, NULL); } + yymsp[0].minor.yy54 = yylhsminor.yy54; break; case 209: /* full_table_name ::= db_name NK_DOT table_name */ case 351: /* full_tsma_name ::= db_name NK_DOT tsma_name */ yytestcase(yyruleno==351); -#line 408 "sql.y" -{ yylhsminor.yy416 = createRealTableNode(pCxt, &yymsp[-2].minor.yy1109, &yymsp[0].minor.yy1109, NULL); } -#line 6650 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = createRealTableNode(pCxt, &yymsp[-2].minor.yy837, &yymsp[0].minor.yy837, NULL); } + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 212: /* tag_def ::= column_name type_name */ -#line 414 "sql.y" -{ yylhsminor.yy416 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy1109, yymsp[0].minor.yy952, NULL); } -#line 6656 "sql.c" - yymsp[-1].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy837, yymsp[0].minor.yy84, NULL); } + yymsp[-1].minor.yy54 = yylhsminor.yy54; break; case 215: /* column_def ::= column_name type_name column_options */ -#line 422 "sql.y" -{ yylhsminor.yy416 = createColumnDefNode(pCxt, &yymsp[-2].minor.yy1109, yymsp[-1].minor.yy952, yymsp[0].minor.yy416); } -#line 6662 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = createColumnDefNode(pCxt, &yymsp[-2].minor.yy837, yymsp[-1].minor.yy84, yymsp[0].minor.yy54); } + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 216: /* type_name ::= BOOL */ -#line 426 "sql.y" -{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_BOOL); } -#line 6668 "sql.c" +{ yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_BOOL); } break; case 217: /* type_name ::= TINYINT */ -#line 427 "sql.y" -{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_TINYINT); } -#line 6673 "sql.c" +{ yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_TINYINT); } break; case 218: /* type_name ::= SMALLINT */ -#line 428 "sql.y" -{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_SMALLINT); } -#line 6678 "sql.c" +{ yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_SMALLINT); } break; case 219: /* type_name ::= INT */ case 220: /* type_name ::= INTEGER */ yytestcase(yyruleno==220); -#line 429 "sql.y" -{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_INT); } -#line 6684 "sql.c" +{ yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_INT); } break; case 221: /* type_name ::= BIGINT */ -#line 431 "sql.y" -{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_BIGINT); } -#line 6689 "sql.c" +{ yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_BIGINT); } break; case 222: /* type_name ::= FLOAT */ -#line 432 "sql.y" -{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_FLOAT); } -#line 6694 "sql.c" +{ yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_FLOAT); } break; case 223: /* type_name ::= DOUBLE */ -#line 433 "sql.y" -{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_DOUBLE); } -#line 6699 "sql.c" +{ yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_DOUBLE); } break; case 224: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ -#line 434 "sql.y" -{ yymsp[-3].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } -#line 6704 "sql.c" +{ yymsp[-3].minor.yy84 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } break; case 225: /* type_name ::= TIMESTAMP */ -#line 435 "sql.y" -{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } -#line 6709 "sql.c" +{ yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } break; case 226: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ -#line 436 "sql.y" -{ yymsp[-3].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } -#line 6714 "sql.c" +{ yymsp[-3].minor.yy84 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } break; case 227: /* type_name ::= TINYINT UNSIGNED */ -#line 437 "sql.y" -{ yymsp[-1].minor.yy952 = createDataType(TSDB_DATA_TYPE_UTINYINT); } -#line 6719 "sql.c" +{ yymsp[-1].minor.yy84 = createDataType(TSDB_DATA_TYPE_UTINYINT); } break; case 228: /* type_name ::= SMALLINT UNSIGNED */ -#line 438 "sql.y" -{ yymsp[-1].minor.yy952 = createDataType(TSDB_DATA_TYPE_USMALLINT); } -#line 6724 "sql.c" +{ yymsp[-1].minor.yy84 = createDataType(TSDB_DATA_TYPE_USMALLINT); } break; case 229: /* type_name ::= INT UNSIGNED */ -#line 439 "sql.y" -{ yymsp[-1].minor.yy952 = createDataType(TSDB_DATA_TYPE_UINT); } -#line 6729 "sql.c" +{ yymsp[-1].minor.yy84 = createDataType(TSDB_DATA_TYPE_UINT); } break; case 230: /* type_name ::= BIGINT UNSIGNED */ -#line 440 "sql.y" -{ yymsp[-1].minor.yy952 = createDataType(TSDB_DATA_TYPE_UBIGINT); } -#line 6734 "sql.c" +{ yymsp[-1].minor.yy84 = createDataType(TSDB_DATA_TYPE_UBIGINT); } break; case 231: /* type_name ::= JSON */ -#line 441 "sql.y" -{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_JSON); } -#line 6739 "sql.c" +{ yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_JSON); } break; case 232: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ -#line 442 "sql.y" -{ yymsp[-3].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } -#line 6744 "sql.c" +{ yymsp[-3].minor.yy84 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } break; case 233: /* type_name ::= MEDIUMBLOB */ -#line 443 "sql.y" -{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } -#line 6749 "sql.c" +{ yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } break; case 234: /* type_name ::= BLOB */ -#line 444 "sql.y" -{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_BLOB); } -#line 6754 "sql.c" +{ yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_BLOB); } break; case 235: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ -#line 445 "sql.y" -{ yymsp[-3].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } -#line 6759 "sql.c" +{ yymsp[-3].minor.yy84 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } break; case 236: /* type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ -#line 446 "sql.y" -{ yymsp[-3].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_GEOMETRY, &yymsp[-1].minor.yy0); } -#line 6764 "sql.c" +{ yymsp[-3].minor.yy84 = createVarLenDataType(TSDB_DATA_TYPE_GEOMETRY, &yymsp[-1].minor.yy0); } break; case 237: /* type_name ::= DECIMAL */ -#line 447 "sql.y" -{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_DECIMAL); } -#line 6769 "sql.c" +{ yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 238: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ -#line 448 "sql.y" -{ yymsp[-3].minor.yy952 = createDataType(TSDB_DATA_TYPE_DECIMAL); } -#line 6774 "sql.c" +{ yymsp[-3].minor.yy84 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 239: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ -#line 449 "sql.y" -{ yymsp[-5].minor.yy952 = createDataType(TSDB_DATA_TYPE_DECIMAL); } -#line 6779 "sql.c" +{ yymsp[-5].minor.yy84 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 240: /* type_name_default_len ::= BINARY */ -#line 453 "sql.y" -{ yymsp[0].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, NULL); } -#line 6784 "sql.c" +{ yymsp[0].minor.yy84 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, NULL); } break; case 241: /* type_name_default_len ::= NCHAR */ -#line 454 "sql.y" -{ yymsp[0].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, NULL); } -#line 6789 "sql.c" +{ yymsp[0].minor.yy84 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, NULL); } break; case 242: /* type_name_default_len ::= VARCHAR */ -#line 455 "sql.y" -{ yymsp[0].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, NULL); } -#line 6794 "sql.c" +{ yymsp[0].minor.yy84 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, NULL); } break; case 243: /* type_name_default_len ::= VARBINARY */ -#line 456 "sql.y" -{ yymsp[0].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, NULL); } -#line 6799 "sql.c" +{ yymsp[0].minor.yy84 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, NULL); } break; case 246: /* tags_def ::= TAGS NK_LP tag_def_list NK_RP */ case 417: /* tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP */ yytestcase(yyruleno==417); -#line 465 "sql.y" -{ yymsp[-3].minor.yy316 = yymsp[-1].minor.yy316; } -#line 6805 "sql.c" +{ yymsp[-3].minor.yy652 = yymsp[-1].minor.yy652; } break; case 247: /* table_options ::= */ -#line 467 "sql.y" -{ yymsp[1].minor.yy416 = createDefaultTableOptions(pCxt); } -#line 6810 "sql.c" +{ yymsp[1].minor.yy54 = createDefaultTableOptions(pCxt); } break; case 248: /* table_options ::= table_options COMMENT NK_STRING */ -#line 468 "sql.y" -{ yylhsminor.yy416 = setTableOption(pCxt, yymsp[-2].minor.yy416, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } -#line 6815 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = setTableOption(pCxt, yymsp[-2].minor.yy54, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 249: /* table_options ::= table_options MAX_DELAY duration_list */ -#line 469 "sql.y" -{ yylhsminor.yy416 = setTableOption(pCxt, yymsp[-2].minor.yy416, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy316); } -#line 6821 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = setTableOption(pCxt, yymsp[-2].minor.yy54, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy652); } + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 250: /* table_options ::= table_options WATERMARK duration_list */ -#line 470 "sql.y" -{ yylhsminor.yy416 = setTableOption(pCxt, yymsp[-2].minor.yy416, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy316); } -#line 6827 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = setTableOption(pCxt, yymsp[-2].minor.yy54, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy652); } + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 251: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ -#line 471 "sql.y" -{ yylhsminor.yy416 = setTableOption(pCxt, yymsp[-4].minor.yy416, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy316); } -#line 6833 "sql.c" - yymsp[-4].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = setTableOption(pCxt, yymsp[-4].minor.yy54, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy652); } + yymsp[-4].minor.yy54 = yylhsminor.yy54; break; case 252: /* table_options ::= table_options TTL NK_INTEGER */ -#line 472 "sql.y" -{ yylhsminor.yy416 = setTableOption(pCxt, yymsp[-2].minor.yy416, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } -#line 6839 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = setTableOption(pCxt, yymsp[-2].minor.yy54, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 253: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ -#line 473 "sql.y" -{ yylhsminor.yy416 = setTableOption(pCxt, yymsp[-4].minor.yy416, TABLE_OPTION_SMA, yymsp[-1].minor.yy316); } -#line 6845 "sql.c" - yymsp[-4].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = setTableOption(pCxt, yymsp[-4].minor.yy54, TABLE_OPTION_SMA, yymsp[-1].minor.yy652); } + yymsp[-4].minor.yy54 = yylhsminor.yy54; break; case 254: /* table_options ::= table_options DELETE_MARK duration_list */ -#line 474 "sql.y" -{ yylhsminor.yy416 = setTableOption(pCxt, yymsp[-2].minor.yy416, TABLE_OPTION_DELETE_MARK, yymsp[0].minor.yy316); } -#line 6851 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = setTableOption(pCxt, yymsp[-2].minor.yy54, TABLE_OPTION_DELETE_MARK, yymsp[0].minor.yy652); } + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 255: /* alter_table_options ::= alter_table_option */ -#line 476 "sql.y" -{ yylhsminor.yy416 = createAlterTableOptions(pCxt); yylhsminor.yy416 = setTableOption(pCxt, yylhsminor.yy416, yymsp[0].minor.yy101.type, &yymsp[0].minor.yy101.val); } -#line 6857 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = createAlterTableOptions(pCxt); yylhsminor.yy54 = setTableOption(pCxt, yylhsminor.yy54, yymsp[0].minor.yy663.type, &yymsp[0].minor.yy663.val); } + yymsp[0].minor.yy54 = yylhsminor.yy54; break; case 256: /* alter_table_options ::= alter_table_options alter_table_option */ -#line 477 "sql.y" -{ yylhsminor.yy416 = setTableOption(pCxt, yymsp[-1].minor.yy416, yymsp[0].minor.yy101.type, &yymsp[0].minor.yy101.val); } -#line 6863 "sql.c" - yymsp[-1].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = setTableOption(pCxt, yymsp[-1].minor.yy54, yymsp[0].minor.yy663.type, &yymsp[0].minor.yy663.val); } + yymsp[-1].minor.yy54 = yylhsminor.yy54; break; case 257: /* alter_table_option ::= COMMENT NK_STRING */ -#line 481 "sql.y" -{ yymsp[-1].minor.yy101.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } -#line 6869 "sql.c" +{ yymsp[-1].minor.yy663.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy663.val = yymsp[0].minor.yy0; } break; case 258: /* alter_table_option ::= TTL NK_INTEGER */ -#line 482 "sql.y" -{ yymsp[-1].minor.yy101.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } -#line 6874 "sql.c" +{ yymsp[-1].minor.yy663.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy663.val = yymsp[0].minor.yy0; } break; case 259: /* duration_list ::= duration_literal */ - case 546: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==546); -#line 486 "sql.y" -{ yylhsminor.yy316 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy416)); } -#line 6880 "sql.c" - yymsp[0].minor.yy316 = yylhsminor.yy316; + case 547: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==547); +{ yylhsminor.yy652 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy54)); } + yymsp[0].minor.yy652 = yylhsminor.yy652; break; case 260: /* duration_list ::= duration_list NK_COMMA duration_literal */ - case 547: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==547); -#line 487 "sql.y" -{ yylhsminor.yy316 = addNodeToList(pCxt, yymsp[-2].minor.yy316, releaseRawExprNode(pCxt, yymsp[0].minor.yy416)); } -#line 6887 "sql.c" - yymsp[-2].minor.yy316 = yylhsminor.yy316; + case 548: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==548); +{ yylhsminor.yy652 = addNodeToList(pCxt, yymsp[-2].minor.yy652, releaseRawExprNode(pCxt, yymsp[0].minor.yy54)); } + yymsp[-2].minor.yy652 = yylhsminor.yy652; break; case 263: /* rollup_func_name ::= function_name */ -#line 494 "sql.y" -{ yylhsminor.yy416 = createFunctionNode(pCxt, &yymsp[0].minor.yy1109, NULL); } -#line 6893 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = createFunctionNode(pCxt, &yymsp[0].minor.yy837, NULL); } + yymsp[0].minor.yy54 = yylhsminor.yy54; break; case 264: /* rollup_func_name ::= FIRST */ case 265: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==265); case 339: /* tag_item ::= QTAGS */ yytestcase(yyruleno==339); -#line 495 "sql.y" -{ yylhsminor.yy416 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } -#line 6901 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } + yymsp[0].minor.yy54 = yylhsminor.yy54; break; case 268: /* col_name ::= column_name */ case 340: /* tag_item ::= column_name */ yytestcase(yyruleno==340); -#line 503 "sql.y" -{ yylhsminor.yy416 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy1109); } -#line 6908 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy837); } + yymsp[0].minor.yy54 = yylhsminor.yy54; break; case 269: /* cmd ::= SHOW DNODES */ -#line 506 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT); } -#line 6914 "sql.c" break; case 270: /* cmd ::= SHOW USERS */ -#line 507 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USERS_STMT); } -#line 6919 "sql.c" break; case 271: /* cmd ::= SHOW USERS FULL */ -#line 508 "sql.y" { pCxt->pRootNode = createShowStmtWithFull(pCxt, QUERY_NODE_SHOW_USERS_FULL_STMT); } -#line 6924 "sql.c" break; case 272: /* cmd ::= SHOW USER PRIVILEGES */ -#line 509 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USER_PRIVILEGES_STMT); } -#line 6929 "sql.c" break; case 273: /* cmd ::= SHOW db_kind_opt DATABASES */ -#line 510 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT); - setShowKind(pCxt, pCxt->pRootNode, yymsp[-1].minor.yy681); + (void)setShowKind(pCxt, pCxt->pRootNode, yymsp[-1].minor.yy719); } -#line 6937 "sql.c" break; case 274: /* cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */ -#line 514 "sql.y" { - pCxt->pRootNode = createShowTablesStmt(pCxt, yymsp[-2].minor.yy925, yymsp[0].minor.yy416, OP_TYPE_LIKE); + pCxt->pRootNode = createShowTablesStmt(pCxt, yymsp[-2].minor.yy579, yymsp[0].minor.yy54, OP_TYPE_LIKE); } -#line 6944 "sql.c" break; case 275: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ -#line 517 "sql.y" -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy416, yymsp[0].minor.yy416, OP_TYPE_LIKE); } -#line 6949 "sql.c" +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy54, yymsp[0].minor.yy54, OP_TYPE_LIKE); } break; case 276: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ -#line 518 "sql.y" -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy416, NULL, OP_TYPE_LIKE); } -#line 6954 "sql.c" +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy54, NULL, OP_TYPE_LIKE); } break; case 277: /* cmd ::= SHOW MNODES */ -#line 519 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT); } -#line 6959 "sql.c" break; case 278: /* cmd ::= SHOW QNODES */ -#line 521 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QNODES_STMT); } -#line 6964 "sql.c" break; case 279: /* cmd ::= SHOW ARBGROUPS */ -#line 522 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_ARBGROUPS_STMT); } -#line 6969 "sql.c" break; case 280: /* cmd ::= SHOW FUNCTIONS */ -#line 523 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT); } -#line 6974 "sql.c" break; case 281: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ -#line 524 "sql.y" -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy416, yymsp[-1].minor.yy416, OP_TYPE_EQUAL); } -#line 6979 "sql.c" +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy54, yymsp[-1].minor.yy54, OP_TYPE_EQUAL); } break; case 282: /* cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ -#line 525 "sql.y" -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy1109), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy1109), OP_TYPE_EQUAL); } -#line 6984 "sql.c" +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy837), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy837), OP_TYPE_EQUAL); } break; case 283: /* cmd ::= SHOW STREAMS */ -#line 526 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT); } -#line 6989 "sql.c" break; case 284: /* cmd ::= SHOW ACCOUNTS */ -#line 527 "sql.y" { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } -#line 6994 "sql.c" break; case 285: /* cmd ::= SHOW APPS */ -#line 528 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_APPS_STMT); } -#line 6999 "sql.c" break; case 286: /* cmd ::= SHOW CONNECTIONS */ -#line 529 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONNECTIONS_STMT); } -#line 7004 "sql.c" break; case 287: /* cmd ::= SHOW LICENCES */ case 288: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==288); -#line 530 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LICENCES_STMT); } -#line 7010 "sql.c" break; case 289: /* cmd ::= SHOW GRANTS FULL */ -#line 532 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_GRANTS_FULL_STMT); } -#line 7015 "sql.c" break; case 290: /* cmd ::= SHOW GRANTS LOGS */ -#line 533 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_GRANTS_LOGS_STMT); } -#line 7020 "sql.c" break; case 291: /* cmd ::= SHOW CLUSTER MACHINES */ -#line 534 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_MACHINES_STMT); } -#line 7025 "sql.c" break; case 292: /* cmd ::= SHOW CREATE DATABASE db_name */ -#line 535 "sql.y" -{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy1109); } -#line 7030 "sql.c" +{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy837); } break; case 293: /* cmd ::= SHOW CREATE TABLE full_table_name */ -#line 536 "sql.y" -{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy416); } -#line 7035 "sql.c" +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy54); } break; case 294: /* cmd ::= SHOW CREATE STABLE full_table_name */ -#line 537 "sql.y" { pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, -yymsp[0].minor.yy416); } -#line 7041 "sql.c" +yymsp[0].minor.yy54); } break; case 295: /* cmd ::= SHOW ENCRYPTIONS */ -#line 539 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_ENCRYPTIONS_STMT); } -#line 7046 "sql.c" break; case 296: /* cmd ::= SHOW QUERIES */ -#line 540 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT); } -#line 7051 "sql.c" break; case 297: /* cmd ::= SHOW SCORES */ -#line 541 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SCORES_STMT); } -#line 7056 "sql.c" break; case 298: /* cmd ::= SHOW TOPICS */ -#line 542 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TOPICS_STMT); } -#line 7061 "sql.c" break; case 299: /* cmd ::= SHOW VARIABLES */ case 300: /* cmd ::= SHOW CLUSTER VARIABLES */ yytestcase(yyruleno==300); -#line 543 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VARIABLES_STMT); } -#line 7067 "sql.c" break; case 301: /* cmd ::= SHOW LOCAL VARIABLES */ -#line 545 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT); } -#line 7072 "sql.c" break; case 302: /* cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ -#line 546 "sql.y" -{ pCxt->pRootNode = createShowDnodeVariablesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[-2].minor.yy0), yymsp[0].minor.yy416); } -#line 7077 "sql.c" +{ pCxt->pRootNode = createShowDnodeVariablesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[-2].minor.yy0), yymsp[0].minor.yy54); } break; case 303: /* cmd ::= SHOW BNODES */ -#line 547 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_BNODES_STMT); } -#line 7082 "sql.c" break; case 304: /* cmd ::= SHOW SNODES */ -#line 548 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SNODES_STMT); } -#line 7087 "sql.c" break; case 305: /* cmd ::= SHOW CLUSTER */ -#line 549 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_STMT); } -#line 7092 "sql.c" break; case 306: /* cmd ::= SHOW TRANSACTIONS */ -#line 550 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TRANSACTIONS_STMT); } -#line 7097 "sql.c" break; case 307: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ -#line 551 "sql.y" -{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy416); } -#line 7102 "sql.c" +{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy54); } break; case 308: /* cmd ::= SHOW CONSUMERS */ -#line 552 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONSUMERS_STMT); } -#line 7107 "sql.c" break; case 309: /* cmd ::= SHOW SUBSCRIPTIONS */ -#line 553 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT); } -#line 7112 "sql.c" break; case 310: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ -#line 554 "sql.y" -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy416, yymsp[-1].minor.yy416, OP_TYPE_EQUAL); } -#line 7117 "sql.c" +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy54, yymsp[-1].minor.yy54, OP_TYPE_EQUAL); } break; case 311: /* cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ -#line 555 "sql.y" -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy1109), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy1109), OP_TYPE_EQUAL); } -#line 7122 "sql.c" +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy837), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy837), OP_TYPE_EQUAL); } break; case 312: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ -#line 556 "sql.y" -{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, yymsp[-1].minor.yy416, yymsp[0].minor.yy416, yymsp[-3].minor.yy316); } -#line 7127 "sql.c" +{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, yymsp[-1].minor.yy54, yymsp[0].minor.yy54, yymsp[-3].minor.yy652); } break; case 313: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ -#line 557 "sql.y" -{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, createIdentifierValueNode(pCxt, &yymsp[0].minor.yy1109), createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy1109), yymsp[-4].minor.yy316); } -#line 7132 "sql.c" +{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, createIdentifierValueNode(pCxt, &yymsp[0].minor.yy837), createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy837), yymsp[-4].minor.yy652); } break; case 314: /* cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ -#line 558 "sql.y" { pCxt->pRootNode = createShowVnodesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0), NULL); } -#line 7137 "sql.c" break; case 315: /* cmd ::= SHOW VNODES */ -#line 559 "sql.y" { pCxt->pRootNode = createShowVnodesStmt(pCxt, NULL, NULL); } -#line 7142 "sql.c" break; case 316: /* cmd ::= SHOW db_name_cond_opt ALIVE */ -#line 561 "sql.y" -{ pCxt->pRootNode = createShowAliveStmt(pCxt, yymsp[-1].minor.yy416, QUERY_NODE_SHOW_DB_ALIVE_STMT); } -#line 7147 "sql.c" +{ pCxt->pRootNode = createShowAliveStmt(pCxt, yymsp[-1].minor.yy54, QUERY_NODE_SHOW_DB_ALIVE_STMT); } break; case 317: /* cmd ::= SHOW CLUSTER ALIVE */ -#line 562 "sql.y" { pCxt->pRootNode = createShowAliveStmt(pCxt, NULL, QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT); } -#line 7152 "sql.c" break; case 318: /* cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt */ -#line 563 "sql.y" -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VIEWS_STMT, yymsp[-2].minor.yy416, yymsp[0].minor.yy416, OP_TYPE_LIKE); } -#line 7157 "sql.c" +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VIEWS_STMT, yymsp[-2].minor.yy54, yymsp[0].minor.yy54, OP_TYPE_LIKE); } break; case 319: /* cmd ::= SHOW CREATE VIEW full_table_name */ -#line 564 "sql.y" -{ pCxt->pRootNode = createShowCreateViewStmt(pCxt, QUERY_NODE_SHOW_CREATE_VIEW_STMT, yymsp[0].minor.yy416); } -#line 7162 "sql.c" +{ pCxt->pRootNode = createShowCreateViewStmt(pCxt, QUERY_NODE_SHOW_CREATE_VIEW_STMT, yymsp[0].minor.yy54); } break; case 320: /* cmd ::= SHOW COMPACTS */ -#line 565 "sql.y" { pCxt->pRootNode = createShowCompactsStmt(pCxt, QUERY_NODE_SHOW_COMPACTS_STMT); } -#line 7167 "sql.c" break; case 321: /* cmd ::= SHOW COMPACT NK_INTEGER */ -#line 566 "sql.y" { pCxt->pRootNode = createShowCompactDetailsStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } -#line 7172 "sql.c" break; case 322: /* table_kind_db_name_cond_opt ::= */ -#line 570 "sql.y" -{ yymsp[1].minor.yy925.kind = SHOW_KIND_ALL; yymsp[1].minor.yy925.dbName = nil_token; } -#line 7177 "sql.c" +{ yymsp[1].minor.yy579.kind = SHOW_KIND_ALL; yymsp[1].minor.yy579.dbName = nil_token; } break; case 323: /* table_kind_db_name_cond_opt ::= table_kind */ -#line 571 "sql.y" -{ yylhsminor.yy925.kind = yymsp[0].minor.yy681; yylhsminor.yy925.dbName = nil_token; } -#line 7182 "sql.c" - yymsp[0].minor.yy925 = yylhsminor.yy925; +{ yylhsminor.yy579.kind = yymsp[0].minor.yy719; yylhsminor.yy579.dbName = nil_token; } + yymsp[0].minor.yy579 = yylhsminor.yy579; break; case 324: /* table_kind_db_name_cond_opt ::= db_name NK_DOT */ -#line 572 "sql.y" -{ yylhsminor.yy925.kind = SHOW_KIND_ALL; yylhsminor.yy925.dbName = yymsp[-1].minor.yy1109; } -#line 7188 "sql.c" - yymsp[-1].minor.yy925 = yylhsminor.yy925; +{ yylhsminor.yy579.kind = SHOW_KIND_ALL; yylhsminor.yy579.dbName = yymsp[-1].minor.yy837; } + yymsp[-1].minor.yy579 = yylhsminor.yy579; break; case 325: /* table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */ -#line 573 "sql.y" -{ yylhsminor.yy925.kind = yymsp[-2].minor.yy681; yylhsminor.yy925.dbName = yymsp[-1].minor.yy1109; } -#line 7194 "sql.c" - yymsp[-2].minor.yy925 = yylhsminor.yy925; +{ yylhsminor.yy579.kind = yymsp[-2].minor.yy719; yylhsminor.yy579.dbName = yymsp[-1].minor.yy837; } + yymsp[-2].minor.yy579 = yylhsminor.yy579; break; case 326: /* table_kind ::= NORMAL */ -#line 577 "sql.y" -{ yymsp[0].minor.yy681 = SHOW_KIND_TABLES_NORMAL; } -#line 7200 "sql.c" +{ yymsp[0].minor.yy719 = SHOW_KIND_TABLES_NORMAL; } break; case 327: /* table_kind ::= CHILD */ -#line 578 "sql.y" -{ yymsp[0].minor.yy681 = SHOW_KIND_TABLES_CHILD; } -#line 7205 "sql.c" +{ yymsp[0].minor.yy719 = SHOW_KIND_TABLES_CHILD; } break; case 328: /* db_name_cond_opt ::= */ case 333: /* from_db_opt ::= */ yytestcase(yyruleno==333); -#line 580 "sql.y" -{ yymsp[1].minor.yy416 = createDefaultDatabaseCondValue(pCxt); } -#line 7211 "sql.c" +{ yymsp[1].minor.yy54 = createDefaultDatabaseCondValue(pCxt); } break; case 329: /* db_name_cond_opt ::= db_name NK_DOT */ -#line 581 "sql.y" -{ yylhsminor.yy416 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy1109); } -#line 7216 "sql.c" - yymsp[-1].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy837); } + yymsp[-1].minor.yy54 = yylhsminor.yy54; break; case 331: /* like_pattern_opt ::= LIKE NK_STRING */ -#line 584 "sql.y" -{ yymsp[-1].minor.yy416 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } -#line 7222 "sql.c" +{ yymsp[-1].minor.yy54 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } break; case 332: /* table_name_cond ::= table_name */ -#line 586 "sql.y" -{ yylhsminor.yy416 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy1109); } -#line 7227 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy837); } + yymsp[0].minor.yy54 = yylhsminor.yy54; break; case 334: /* from_db_opt ::= FROM db_name */ -#line 589 "sql.y" -{ yymsp[-1].minor.yy416 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy1109); } -#line 7233 "sql.c" +{ yymsp[-1].minor.yy54 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy837); } break; case 338: /* tag_item ::= TBNAME */ -#line 597 "sql.y" -{ yylhsminor.yy416 = setProjectionAlias(pCxt, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL), &yymsp[0].minor.yy0); } -#line 7238 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = setProjectionAlias(pCxt, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL), &yymsp[0].minor.yy0); } + yymsp[0].minor.yy54 = yylhsminor.yy54; break; case 341: /* tag_item ::= column_name column_alias */ -#line 600 "sql.y" -{ yylhsminor.yy416 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy1109), &yymsp[0].minor.yy1109); } -#line 7244 "sql.c" - yymsp[-1].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy837), &yymsp[0].minor.yy837); } + yymsp[-1].minor.yy54 = yylhsminor.yy54; break; case 342: /* tag_item ::= column_name AS column_alias */ -#line 601 "sql.y" -{ yylhsminor.yy416 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-2].minor.yy1109), &yymsp[0].minor.yy1109); } -#line 7250 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-2].minor.yy837), &yymsp[0].minor.yy837); } + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 343: /* db_kind_opt ::= */ -#line 605 "sql.y" -{ yymsp[1].minor.yy681 = SHOW_KIND_ALL; } -#line 7256 "sql.c" +{ yymsp[1].minor.yy719 = SHOW_KIND_ALL; } break; case 344: /* db_kind_opt ::= USER */ -#line 606 "sql.y" -{ yymsp[0].minor.yy681 = SHOW_KIND_DATABASES_USER; } -#line 7261 "sql.c" +{ yymsp[0].minor.yy719 = SHOW_KIND_DATABASES_USER; } break; case 345: /* db_kind_opt ::= SYSTEM */ -#line 607 "sql.y" -{ yymsp[0].minor.yy681 = SHOW_KIND_DATABASES_SYSTEM; } -#line 7266 "sql.c" +{ yymsp[0].minor.yy719 = SHOW_KIND_DATABASES_SYSTEM; } break; case 346: /* cmd ::= CREATE TSMA not_exists_opt tsma_name ON full_table_name tsma_func_list INTERVAL NK_LP duration_literal NK_RP */ -#line 613 "sql.y" -{ pCxt->pRootNode = createCreateTSMAStmt(pCxt, yymsp[-8].minor.yy209, &yymsp[-7].minor.yy1109, yymsp[-4].minor.yy416, yymsp[-5].minor.yy416, releaseRawExprNode(pCxt, yymsp[-1].minor.yy416)); } -#line 7271 "sql.c" +{ pCxt->pRootNode = createCreateTSMAStmt(pCxt, yymsp[-8].minor.yy325, &yymsp[-7].minor.yy837, yymsp[-4].minor.yy54, yymsp[-5].minor.yy54, releaseRawExprNode(pCxt, yymsp[-1].minor.yy54)); } break; case 347: /* cmd ::= CREATE RECURSIVE TSMA not_exists_opt tsma_name ON full_table_name INTERVAL NK_LP duration_literal NK_RP */ -#line 615 "sql.y" -{ pCxt->pRootNode = createCreateTSMAStmt(pCxt, yymsp[-7].minor.yy209, &yymsp[-6].minor.yy1109, NULL, yymsp[-4].minor.yy416, releaseRawExprNode(pCxt, yymsp[-1].minor.yy416)); } -#line 7276 "sql.c" +{ pCxt->pRootNode = createCreateTSMAStmt(pCxt, yymsp[-7].minor.yy325, &yymsp[-6].minor.yy837, NULL, yymsp[-4].minor.yy54, releaseRawExprNode(pCxt, yymsp[-1].minor.yy54)); } break; case 348: /* cmd ::= DROP TSMA exists_opt full_tsma_name */ -#line 616 "sql.y" -{ pCxt->pRootNode = createDropTSMAStmt(pCxt, yymsp[-1].minor.yy209, yymsp[0].minor.yy416); } -#line 7281 "sql.c" +{ pCxt->pRootNode = createDropTSMAStmt(pCxt, yymsp[-1].minor.yy325, yymsp[0].minor.yy54); } break; case 349: /* cmd ::= SHOW db_name_cond_opt TSMAS */ -#line 617 "sql.y" -{ pCxt->pRootNode = createShowTSMASStmt(pCxt, yymsp[-1].minor.yy416); } -#line 7286 "sql.c" +{ pCxt->pRootNode = createShowTSMASStmt(pCxt, yymsp[-1].minor.yy54); } break; case 352: /* tsma_func_list ::= FUNCTION NK_LP func_list NK_RP */ -#line 624 "sql.y" -{ yymsp[-3].minor.yy416 = createTSMAOptions(pCxt, yymsp[-1].minor.yy316); } -#line 7291 "sql.c" +{ yymsp[-3].minor.yy54 = createTSMAOptions(pCxt, yymsp[-1].minor.yy652); } break; case 353: /* cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */ -#line 628 "sql.y" -{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy209, yymsp[-3].minor.yy416, yymsp[-1].minor.yy416, NULL, yymsp[0].minor.yy416); } -#line 7296 "sql.c" +{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy325, yymsp[-3].minor.yy54, yymsp[-1].minor.yy54, NULL, yymsp[0].minor.yy54); } break; case 354: /* cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */ -#line 630 "sql.y" -{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_NORMAL, yymsp[-6].minor.yy209, yymsp[-5].minor.yy416, yymsp[-3].minor.yy416, yymsp[-1].minor.yy316, NULL); } -#line 7301 "sql.c" +{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_NORMAL, yymsp[-6].minor.yy325, yymsp[-5].minor.yy54, yymsp[-3].minor.yy54, yymsp[-1].minor.yy652, NULL); } break; case 355: /* cmd ::= DROP INDEX exists_opt full_index_name */ -#line 631 "sql.y" -{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy209, yymsp[0].minor.yy416); } -#line 7306 "sql.c" +{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy325, yymsp[0].minor.yy54); } break; case 356: /* full_index_name ::= index_name */ -#line 633 "sql.y" -{ yylhsminor.yy416 = createRealTableNodeForIndexName(pCxt, NULL, &yymsp[0].minor.yy1109); } -#line 7311 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = createRealTableNodeForIndexName(pCxt, NULL, &yymsp[0].minor.yy837); } + yymsp[0].minor.yy54 = yylhsminor.yy54; break; case 357: /* full_index_name ::= db_name NK_DOT index_name */ -#line 634 "sql.y" -{ yylhsminor.yy416 = createRealTableNodeForIndexName(pCxt, &yymsp[-2].minor.yy1109, &yymsp[0].minor.yy1109); } -#line 7317 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = createRealTableNodeForIndexName(pCxt, &yymsp[-2].minor.yy837, &yymsp[0].minor.yy837); } + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 358: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ -#line 637 "sql.y" -{ yymsp[-9].minor.yy416 = createIndexOption(pCxt, yymsp[-7].minor.yy316, releaseRawExprNode(pCxt, yymsp[-3].minor.yy416), NULL, yymsp[-1].minor.yy416, yymsp[0].minor.yy416); } -#line 7323 "sql.c" +{ yymsp[-9].minor.yy54 = createIndexOption(pCxt, yymsp[-7].minor.yy652, releaseRawExprNode(pCxt, yymsp[-3].minor.yy54), NULL, yymsp[-1].minor.yy54, yymsp[0].minor.yy54); } break; case 359: /* 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 */ -#line 640 "sql.y" -{ yymsp[-11].minor.yy416 = createIndexOption(pCxt, yymsp[-9].minor.yy316, releaseRawExprNode(pCxt, yymsp[-5].minor.yy416), releaseRawExprNode(pCxt, yymsp[-3].minor.yy416), yymsp[-1].minor.yy416, yymsp[0].minor.yy416); } -#line 7328 "sql.c" +{ yymsp[-11].minor.yy54 = createIndexOption(pCxt, yymsp[-9].minor.yy652, releaseRawExprNode(pCxt, yymsp[-5].minor.yy54), releaseRawExprNode(pCxt, yymsp[-3].minor.yy54), yymsp[-1].minor.yy54, yymsp[0].minor.yy54); } break; case 362: /* func ::= sma_func_name NK_LP expression_list NK_RP */ -#line 647 "sql.y" -{ yylhsminor.yy416 = createFunctionNode(pCxt, &yymsp[-3].minor.yy1109, yymsp[-1].minor.yy316); } -#line 7333 "sql.c" - yymsp[-3].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = createFunctionNode(pCxt, &yymsp[-3].minor.yy837, yymsp[-1].minor.yy652); } + yymsp[-3].minor.yy54 = yylhsminor.yy54; break; case 363: /* sma_func_name ::= function_name */ - case 637: /* alias_opt ::= table_alias */ yytestcase(yyruleno==637); -#line 651 "sql.y" -{ yylhsminor.yy1109 = yymsp[0].minor.yy1109; } -#line 7340 "sql.c" - yymsp[0].minor.yy1109 = yylhsminor.yy1109; + case 638: /* alias_opt ::= table_alias */ yytestcase(yyruleno==638); +{ yylhsminor.yy837 = yymsp[0].minor.yy837; } + yymsp[0].minor.yy837 = yylhsminor.yy837; break; case 368: /* sma_stream_opt ::= */ case 418: /* stream_options ::= */ yytestcase(yyruleno==418); -#line 657 "sql.y" -{ yymsp[1].minor.yy416 = createStreamOptions(pCxt); } -#line 7347 "sql.c" +{ yymsp[1].minor.yy54 = createStreamOptions(pCxt); } break; case 369: /* sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ -#line 658 "sql.y" -{ ((SStreamOptions*)yymsp[-2].minor.yy416)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy416); yylhsminor.yy416 = yymsp[-2].minor.yy416; } -#line 7352 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ ((SStreamOptions*)yymsp[-2].minor.yy54)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy54); yylhsminor.yy54 = yymsp[-2].minor.yy54; } + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 370: /* sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ -#line 659 "sql.y" -{ ((SStreamOptions*)yymsp[-2].minor.yy416)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy416); yylhsminor.yy416 = yymsp[-2].minor.yy416; } -#line 7358 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ ((SStreamOptions*)yymsp[-2].minor.yy54)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy54); yylhsminor.yy54 = yymsp[-2].minor.yy54; } + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 371: /* sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ -#line 660 "sql.y" -{ ((SStreamOptions*)yymsp[-2].minor.yy416)->pDeleteMark = releaseRawExprNode(pCxt, yymsp[0].minor.yy416); yylhsminor.yy416 = yymsp[-2].minor.yy416; } -#line 7364 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ ((SStreamOptions*)yymsp[-2].minor.yy54)->pDeleteMark = releaseRawExprNode(pCxt, yymsp[0].minor.yy54); yylhsminor.yy54 = yymsp[-2].minor.yy54; } + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 372: /* with_meta ::= AS */ -#line 665 "sql.y" -{ yymsp[0].minor.yy820 = 0; } -#line 7370 "sql.c" +{ yymsp[0].minor.yy332 = 0; } break; case 373: /* with_meta ::= WITH META AS */ -#line 666 "sql.y" -{ yymsp[-2].minor.yy820 = 1; } -#line 7375 "sql.c" +{ yymsp[-2].minor.yy332 = 1; } break; case 374: /* with_meta ::= ONLY META AS */ -#line 667 "sql.y" -{ yymsp[-2].minor.yy820 = 2; } -#line 7380 "sql.c" +{ yymsp[-2].minor.yy332 = 2; } break; case 375: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ -#line 669 "sql.y" -{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy209, &yymsp[-2].minor.yy1109, yymsp[0].minor.yy416); } -#line 7385 "sql.c" +{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy325, &yymsp[-2].minor.yy837, yymsp[0].minor.yy54); } break; case 376: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ -#line 671 "sql.y" -{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy209, &yymsp[-3].minor.yy1109, &yymsp[0].minor.yy1109, yymsp[-2].minor.yy820); } -#line 7390 "sql.c" +{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy325, &yymsp[-3].minor.yy837, &yymsp[0].minor.yy837, yymsp[-2].minor.yy332); } break; case 377: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ -#line 673 "sql.y" -{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-5].minor.yy209, &yymsp[-4].minor.yy1109, yymsp[-1].minor.yy416, yymsp[-3].minor.yy820, yymsp[0].minor.yy416); } -#line 7395 "sql.c" +{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-5].minor.yy325, &yymsp[-4].minor.yy837, yymsp[-1].minor.yy54, yymsp[-3].minor.yy332, yymsp[0].minor.yy54); } break; case 378: /* cmd ::= DROP TOPIC exists_opt topic_name */ -#line 675 "sql.y" -{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy209, &yymsp[0].minor.yy1109); } -#line 7400 "sql.c" +{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy325, &yymsp[0].minor.yy837); } break; case 379: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ -#line 676 "sql.y" -{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy209, &yymsp[-2].minor.yy1109, &yymsp[0].minor.yy1109); } -#line 7405 "sql.c" +{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy325, &yymsp[-2].minor.yy837, &yymsp[0].minor.yy837); } break; case 380: /* cmd ::= DESC full_table_name */ case 381: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==381); -#line 679 "sql.y" -{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy416); } -#line 7411 "sql.c" +{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy54); } break; case 382: /* cmd ::= RESET QUERY CACHE */ -#line 683 "sql.y" { pCxt->pRootNode = createResetQueryCacheStmt(pCxt); } -#line 7416 "sql.c" break; case 383: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ case 384: /* cmd ::= EXPLAIN analyze_opt explain_options insert_query */ yytestcase(yyruleno==384); -#line 686 "sql.y" -{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy209, yymsp[-1].minor.yy416, yymsp[0].minor.yy416); } -#line 7422 "sql.c" +{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy325, yymsp[-1].minor.yy54, yymsp[0].minor.yy54); } break; case 387: /* explain_options ::= */ -#line 694 "sql.y" -{ yymsp[1].minor.yy416 = createDefaultExplainOptions(pCxt); } -#line 7427 "sql.c" +{ yymsp[1].minor.yy54 = createDefaultExplainOptions(pCxt); } break; case 388: /* explain_options ::= explain_options VERBOSE NK_BOOL */ -#line 695 "sql.y" -{ yylhsminor.yy416 = setExplainVerbose(pCxt, yymsp[-2].minor.yy416, &yymsp[0].minor.yy0); } -#line 7432 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = setExplainVerbose(pCxt, yymsp[-2].minor.yy54, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 389: /* explain_options ::= explain_options RATIO NK_FLOAT */ -#line 696 "sql.y" -{ yylhsminor.yy416 = setExplainRatio(pCxt, yymsp[-2].minor.yy416, &yymsp[0].minor.yy0); } -#line 7438 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = setExplainRatio(pCxt, yymsp[-2].minor.yy54, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 390: /* cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ -#line 701 "sql.y" -{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-7].minor.yy209, yymsp[-9].minor.yy209, &yymsp[-6].minor.yy1109, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy952, yymsp[-1].minor.yy820, &yymsp[0].minor.yy1109, yymsp[-10].minor.yy209); } -#line 7444 "sql.c" +{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-7].minor.yy325, yymsp[-9].minor.yy325, &yymsp[-6].minor.yy837, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy84, yymsp[-1].minor.yy332, &yymsp[0].minor.yy837, yymsp[-10].minor.yy325); } break; case 391: /* cmd ::= DROP FUNCTION exists_opt function_name */ -#line 702 "sql.y" -{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy209, &yymsp[0].minor.yy1109); } -#line 7449 "sql.c" +{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy325, &yymsp[0].minor.yy837); } break; case 396: /* language_opt ::= */ - case 441: /* on_vgroup_id ::= */ yytestcase(yyruleno==441); -#line 716 "sql.y" -{ yymsp[1].minor.yy1109 = nil_token; } -#line 7455 "sql.c" + case 442: /* on_vgroup_id ::= */ yytestcase(yyruleno==442); +{ yymsp[1].minor.yy837 = nil_token; } break; case 397: /* language_opt ::= LANGUAGE NK_STRING */ - case 442: /* on_vgroup_id ::= ON NK_INTEGER */ yytestcase(yyruleno==442); -#line 717 "sql.y" -{ yymsp[-1].minor.yy1109 = yymsp[0].minor.yy0; } -#line 7461 "sql.c" + case 443: /* on_vgroup_id ::= ON NK_INTEGER */ yytestcase(yyruleno==443); +{ yymsp[-1].minor.yy837 = yymsp[0].minor.yy0; } break; case 400: /* cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */ -#line 726 "sql.y" -{ pCxt->pRootNode = createCreateViewStmt(pCxt, yymsp[-4].minor.yy209, yymsp[-2].minor.yy416, &yymsp[-1].minor.yy0, yymsp[0].minor.yy416); } -#line 7466 "sql.c" +{ pCxt->pRootNode = createCreateViewStmt(pCxt, yymsp[-4].minor.yy325, yymsp[-2].minor.yy54, &yymsp[-1].minor.yy0, yymsp[0].minor.yy54); } break; case 401: /* cmd ::= DROP VIEW exists_opt full_view_name */ -#line 727 "sql.y" -{ pCxt->pRootNode = createDropViewStmt(pCxt, yymsp[-1].minor.yy209, yymsp[0].minor.yy416); } -#line 7471 "sql.c" +{ pCxt->pRootNode = createDropViewStmt(pCxt, yymsp[-1].minor.yy325, yymsp[0].minor.yy54); } break; case 402: /* full_view_name ::= view_name */ -#line 729 "sql.y" -{ yylhsminor.yy416 = createViewNode(pCxt, NULL, &yymsp[0].minor.yy1109); } -#line 7476 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = createViewNode(pCxt, NULL, &yymsp[0].minor.yy837); } + yymsp[0].minor.yy54 = yylhsminor.yy54; break; case 403: /* full_view_name ::= db_name NK_DOT view_name */ -#line 730 "sql.y" -{ yylhsminor.yy416 = createViewNode(pCxt, &yymsp[-2].minor.yy1109, &yymsp[0].minor.yy1109); } -#line 7482 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = createViewNode(pCxt, &yymsp[-2].minor.yy837, &yymsp[0].minor.yy837); } + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 404: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */ -#line 735 "sql.y" -{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-9].minor.yy209, &yymsp[-8].minor.yy1109, yymsp[-5].minor.yy416, yymsp[-7].minor.yy416, yymsp[-3].minor.yy316, yymsp[-2].minor.yy416, yymsp[0].minor.yy416, yymsp[-4].minor.yy316); } -#line 7488 "sql.c" +{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-9].minor.yy325, &yymsp[-8].minor.yy837, yymsp[-5].minor.yy54, yymsp[-7].minor.yy54, yymsp[-3].minor.yy652, yymsp[-2].minor.yy54, yymsp[0].minor.yy54, yymsp[-4].minor.yy652); } break; case 405: /* cmd ::= DROP STREAM exists_opt stream_name */ -#line 736 "sql.y" -{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy209, &yymsp[0].minor.yy1109); } -#line 7493 "sql.c" +{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy325, &yymsp[0].minor.yy837); } break; case 406: /* cmd ::= PAUSE STREAM exists_opt stream_name */ -#line 737 "sql.y" -{ pCxt->pRootNode = createPauseStreamStmt(pCxt, yymsp[-1].minor.yy209, &yymsp[0].minor.yy1109); } -#line 7498 "sql.c" +{ pCxt->pRootNode = createPauseStreamStmt(pCxt, yymsp[-1].minor.yy325, &yymsp[0].minor.yy837); } break; case 407: /* cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ -#line 738 "sql.y" -{ pCxt->pRootNode = createResumeStreamStmt(pCxt, yymsp[-2].minor.yy209, yymsp[-1].minor.yy209, &yymsp[0].minor.yy1109); } -#line 7503 "sql.c" +{ pCxt->pRootNode = createResumeStreamStmt(pCxt, yymsp[-2].minor.yy325, yymsp[-1].minor.yy325, &yymsp[0].minor.yy837); } break; case 412: /* column_stream_def ::= column_name stream_col_options */ -#line 751 "sql.y" -{ yylhsminor.yy416 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy1109, createDataType(TSDB_DATA_TYPE_NULL), yymsp[0].minor.yy416); } -#line 7508 "sql.c" - yymsp[-1].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy54 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy837, createDataType(TSDB_DATA_TYPE_NULL), yymsp[0].minor.yy54); } + yymsp[-1].minor.yy54 = yylhsminor.yy54; break; case 413: /* stream_col_options ::= */ - case 750: /* column_options ::= */ yytestcase(yyruleno==750); -#line 752 "sql.y" -{ yymsp[1].minor.yy416 = createDefaultColumnOptions(pCxt); } -#line 7515 "sql.c" + case 751: /* column_options ::= */ yytestcase(yyruleno==751); +{ yymsp[1].minor.yy54 = createDefaultColumnOptions(pCxt); } break; case 414: /* stream_col_options ::= stream_col_options PRIMARY KEY */ - case 751: /* column_options ::= column_options PRIMARY KEY */ yytestcase(yyruleno==751); -#line 753 "sql.y" -{ yylhsminor.yy416 = setColumnOptions(pCxt, yymsp[-2].minor.yy416, COLUMN_OPTION_PRIMARYKEY, NULL); } -#line 7521 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; + case 752: /* column_options ::= column_options PRIMARY KEY */ yytestcase(yyruleno==752); +{ yylhsminor.yy54 = setColumnOptions(pCxt, yymsp[-2].minor.yy54, COLUMN_OPTION_PRIMARYKEY, NULL); } + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; case 419: /* stream_options ::= stream_options TRIGGER AT_ONCE */ case 420: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ yytestcase(yyruleno==420); -#line 763 "sql.y" -{ yylhsminor.yy416 = setStreamOptions(pCxt, yymsp[-2].minor.yy416, SOPT_TRIGGER_TYPE_SET, &yymsp[0].minor.yy0, NULL); } -#line 7528 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; - break; - case 421: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ -#line 765 "sql.y" -{ yylhsminor.yy416 = setStreamOptions(pCxt, yymsp[-3].minor.yy416, SOPT_TRIGGER_TYPE_SET, &yymsp[-1].minor.yy0, releaseRawExprNode(pCxt, yymsp[0].minor.yy416)); } -#line 7534 "sql.c" - yymsp[-3].minor.yy416 = yylhsminor.yy416; - break; - case 422: /* stream_options ::= stream_options WATERMARK duration_literal */ -#line 766 "sql.y" -{ yylhsminor.yy416 = setStreamOptions(pCxt, yymsp[-2].minor.yy416, SOPT_WATERMARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy416)); } -#line 7540 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; - break; - case 423: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ -#line 767 "sql.y" -{ yylhsminor.yy416 = setStreamOptions(pCxt, yymsp[-3].minor.yy416, SOPT_IGNORE_EXPIRED_SET, &yymsp[0].minor.yy0, NULL); } -#line 7546 "sql.c" - yymsp[-3].minor.yy416 = yylhsminor.yy416; - break; - case 424: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ -#line 768 "sql.y" -{ yylhsminor.yy416 = setStreamOptions(pCxt, yymsp[-2].minor.yy416, SOPT_FILL_HISTORY_SET, &yymsp[0].minor.yy0, NULL); } -#line 7552 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; - break; - case 425: /* stream_options ::= stream_options DELETE_MARK duration_literal */ -#line 769 "sql.y" -{ yylhsminor.yy416 = setStreamOptions(pCxt, yymsp[-2].minor.yy416, SOPT_DELETE_MARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy416)); } -#line 7558 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; - break; - case 426: /* stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ -#line 770 "sql.y" -{ yylhsminor.yy416 = setStreamOptions(pCxt, yymsp[-3].minor.yy416, SOPT_IGNORE_UPDATE_SET, &yymsp[0].minor.yy0, NULL); } -#line 7564 "sql.c" - yymsp[-3].minor.yy416 = yylhsminor.yy416; - break; - case 428: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - case 694: /* sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ yytestcase(yyruleno==694); - case 718: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==718); -#line 773 "sql.y" -{ yymsp[-3].minor.yy416 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy416); } -#line 7572 "sql.c" - break; - case 431: /* cmd ::= KILL CONNECTION NK_INTEGER */ -#line 781 "sql.y" + case 421: /* stream_options ::= stream_options TRIGGER FORCE_WINDOW_CLOSE */ yytestcase(yyruleno==421); +{ yylhsminor.yy54 = setStreamOptions(pCxt, yymsp[-2].minor.yy54, SOPT_TRIGGER_TYPE_SET, &yymsp[0].minor.yy0, NULL); } + yymsp[-2].minor.yy54 = yylhsminor.yy54; + break; + case 422: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ +{ yylhsminor.yy54 = setStreamOptions(pCxt, yymsp[-3].minor.yy54, SOPT_TRIGGER_TYPE_SET, &yymsp[-1].minor.yy0, releaseRawExprNode(pCxt, yymsp[0].minor.yy54)); } + yymsp[-3].minor.yy54 = yylhsminor.yy54; + break; + case 423: /* stream_options ::= stream_options WATERMARK duration_literal */ +{ yylhsminor.yy54 = setStreamOptions(pCxt, yymsp[-2].minor.yy54, SOPT_WATERMARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy54)); } + yymsp[-2].minor.yy54 = yylhsminor.yy54; + break; + case 424: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ +{ yylhsminor.yy54 = setStreamOptions(pCxt, yymsp[-3].minor.yy54, SOPT_IGNORE_EXPIRED_SET, &yymsp[0].minor.yy0, NULL); } + yymsp[-3].minor.yy54 = yylhsminor.yy54; + break; + case 425: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ +{ yylhsminor.yy54 = setStreamOptions(pCxt, yymsp[-2].minor.yy54, SOPT_FILL_HISTORY_SET, &yymsp[0].minor.yy0, NULL); } + yymsp[-2].minor.yy54 = yylhsminor.yy54; + break; + case 426: /* stream_options ::= stream_options DELETE_MARK duration_literal */ +{ yylhsminor.yy54 = setStreamOptions(pCxt, yymsp[-2].minor.yy54, SOPT_DELETE_MARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy54)); } + yymsp[-2].minor.yy54 = yylhsminor.yy54; + break; + case 427: /* stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ +{ yylhsminor.yy54 = setStreamOptions(pCxt, yymsp[-3].minor.yy54, SOPT_IGNORE_UPDATE_SET, &yymsp[0].minor.yy0, NULL); } + yymsp[-3].minor.yy54 = yylhsminor.yy54; + break; + case 429: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + case 695: /* sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ yytestcase(yyruleno==695); + case 719: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==719); +{ yymsp[-3].minor.yy54 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy54); } + break; + case 432: /* cmd ::= KILL CONNECTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); } -#line 7577 "sql.c" break; - case 432: /* cmd ::= KILL QUERY NK_STRING */ -#line 782 "sql.y" + case 433: /* cmd ::= KILL QUERY NK_STRING */ { pCxt->pRootNode = createKillQueryStmt(pCxt, &yymsp[0].minor.yy0); } -#line 7582 "sql.c" break; - case 433: /* cmd ::= KILL TRANSACTION NK_INTEGER */ -#line 783 "sql.y" + case 434: /* cmd ::= KILL TRANSACTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_TRANSACTION_STMT, &yymsp[0].minor.yy0); } -#line 7587 "sql.c" break; - case 434: /* cmd ::= KILL COMPACT NK_INTEGER */ -#line 784 "sql.y" + case 435: /* cmd ::= KILL COMPACT NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_COMPACT_STMT, &yymsp[0].minor.yy0); } -#line 7592 "sql.c" break; - case 435: /* cmd ::= BALANCE VGROUP */ -#line 787 "sql.y" + case 436: /* cmd ::= BALANCE VGROUP */ { pCxt->pRootNode = createBalanceVgroupStmt(pCxt); } -#line 7597 "sql.c" break; - case 436: /* cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ -#line 788 "sql.y" -{ pCxt->pRootNode = createBalanceVgroupLeaderStmt(pCxt, &yymsp[0].minor.yy1109); } -#line 7602 "sql.c" + case 437: /* cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ +{ pCxt->pRootNode = createBalanceVgroupLeaderStmt(pCxt, &yymsp[0].minor.yy837); } break; - case 437: /* cmd ::= BALANCE VGROUP LEADER DATABASE db_name */ -#line 789 "sql.y" -{ pCxt->pRootNode = createBalanceVgroupLeaderDBNameStmt(pCxt, &yymsp[0].minor.yy1109); } -#line 7607 "sql.c" + case 438: /* cmd ::= BALANCE VGROUP LEADER DATABASE db_name */ +{ pCxt->pRootNode = createBalanceVgroupLeaderDBNameStmt(pCxt, &yymsp[0].minor.yy837); } break; - case 438: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ -#line 790 "sql.y" + case 439: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ { pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } -#line 7612 "sql.c" break; - case 439: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ -#line 791 "sql.y" -{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy316); } -#line 7617 "sql.c" + case 440: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ +{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy652); } break; - case 440: /* cmd ::= SPLIT VGROUP NK_INTEGER */ -#line 792 "sql.y" + case 441: /* cmd ::= SPLIT VGROUP NK_INTEGER */ { pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); } -#line 7622 "sql.c" - break; - case 443: /* dnode_list ::= DNODE NK_INTEGER */ -#line 801 "sql.y" -{ yymsp[-1].minor.yy316 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } -#line 7627 "sql.c" - break; - case 445: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ -#line 808 "sql.y" -{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy416, yymsp[0].minor.yy416); } -#line 7632 "sql.c" - break; - case 448: /* insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ -#line 817 "sql.y" -{ yymsp[-6].minor.yy416 = createInsertStmt(pCxt, yymsp[-4].minor.yy416, yymsp[-2].minor.yy316, yymsp[0].minor.yy416); } -#line 7637 "sql.c" - break; - case 449: /* insert_query ::= INSERT INTO full_table_name query_or_subquery */ -#line 818 "sql.y" -{ yymsp[-3].minor.yy416 = createInsertStmt(pCxt, yymsp[-1].minor.yy416, NULL, yymsp[0].minor.yy416); } -#line 7642 "sql.c" - break; - case 450: /* tags_literal ::= NK_INTEGER */ - case 462: /* tags_literal ::= NK_BIN */ yytestcase(yyruleno==462); - case 471: /* tags_literal ::= NK_HEX */ yytestcase(yyruleno==471); -#line 821 "sql.y" -{ yylhsminor.yy416 = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0, NULL); } -#line 7649 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 451: /* tags_literal ::= NK_INTEGER NK_PLUS duration_literal */ - case 452: /* tags_literal ::= NK_INTEGER NK_MINUS duration_literal */ yytestcase(yyruleno==452); - case 463: /* tags_literal ::= NK_BIN NK_PLUS duration_literal */ yytestcase(yyruleno==463); - case 464: /* tags_literal ::= NK_BIN NK_MINUS duration_literal */ yytestcase(yyruleno==464); - case 472: /* tags_literal ::= NK_HEX NK_PLUS duration_literal */ yytestcase(yyruleno==472); - case 473: /* tags_literal ::= NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==473); - case 481: /* tags_literal ::= NK_STRING NK_PLUS duration_literal */ yytestcase(yyruleno==481); - case 482: /* tags_literal ::= NK_STRING NK_MINUS duration_literal */ yytestcase(yyruleno==482); -#line 822 "sql.y" + break; + case 444: /* dnode_list ::= DNODE NK_INTEGER */ +{ yymsp[-1].minor.yy652 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + break; + case 446: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ +{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy54, yymsp[0].minor.yy54); } + break; + case 449: /* insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ +{ yymsp[-6].minor.yy54 = createInsertStmt(pCxt, yymsp[-4].minor.yy54, yymsp[-2].minor.yy652, yymsp[0].minor.yy54); } + break; + case 450: /* insert_query ::= INSERT INTO full_table_name query_or_subquery */ +{ yymsp[-3].minor.yy54 = createInsertStmt(pCxt, yymsp[-1].minor.yy54, NULL, yymsp[0].minor.yy54); } + break; + case 451: /* tags_literal ::= NK_INTEGER */ + case 463: /* tags_literal ::= NK_BIN */ yytestcase(yyruleno==463); + case 472: /* tags_literal ::= NK_HEX */ yytestcase(yyruleno==472); +{ yylhsminor.yy54 = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0, NULL); } + yymsp[0].minor.yy54 = yylhsminor.yy54; + break; + case 452: /* tags_literal ::= NK_INTEGER NK_PLUS duration_literal */ + case 453: /* tags_literal ::= NK_INTEGER NK_MINUS duration_literal */ yytestcase(yyruleno==453); + case 464: /* tags_literal ::= NK_BIN NK_PLUS duration_literal */ yytestcase(yyruleno==464); + case 465: /* tags_literal ::= NK_BIN NK_MINUS duration_literal */ yytestcase(yyruleno==465); + case 473: /* tags_literal ::= NK_HEX NK_PLUS duration_literal */ yytestcase(yyruleno==473); + case 474: /* tags_literal ::= NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==474); + case 482: /* tags_literal ::= NK_STRING NK_PLUS duration_literal */ yytestcase(yyruleno==482); + case 483: /* tags_literal ::= NK_STRING NK_MINUS duration_literal */ yytestcase(yyruleno==483); { SToken l = yymsp[-2].minor.yy0; - SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); + SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy54); l.n = (r.z + r.n) - l.z; - yylhsminor.yy416 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, yymsp[0].minor.yy416); + yylhsminor.yy54 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, yymsp[0].minor.yy54); } -#line 7667 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; - break; - case 453: /* tags_literal ::= NK_PLUS NK_INTEGER */ - case 456: /* tags_literal ::= NK_MINUS NK_INTEGER */ yytestcase(yyruleno==456); - case 465: /* tags_literal ::= NK_PLUS NK_BIN */ yytestcase(yyruleno==465); - case 468: /* tags_literal ::= NK_MINUS NK_BIN */ yytestcase(yyruleno==468); - case 474: /* tags_literal ::= NK_PLUS NK_HEX */ yytestcase(yyruleno==474); - case 477: /* tags_literal ::= NK_MINUS NK_HEX */ yytestcase(yyruleno==477); -#line 834 "sql.y" + yymsp[-2].minor.yy54 = yylhsminor.yy54; + break; + case 454: /* tags_literal ::= NK_PLUS NK_INTEGER */ + case 457: /* tags_literal ::= NK_MINUS NK_INTEGER */ yytestcase(yyruleno==457); + case 466: /* tags_literal ::= NK_PLUS NK_BIN */ yytestcase(yyruleno==466); + case 469: /* tags_literal ::= NK_MINUS NK_BIN */ yytestcase(yyruleno==469); + case 475: /* tags_literal ::= NK_PLUS NK_HEX */ yytestcase(yyruleno==475); + case 478: /* tags_literal ::= NK_MINUS NK_HEX */ yytestcase(yyruleno==478); { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy416 = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &t, NULL); + yylhsminor.yy54 = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &t, NULL); } -#line 7682 "sql.c" - yymsp[-1].minor.yy416 = yylhsminor.yy416; - break; - case 454: /* tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal */ - case 455: /* tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal */ yytestcase(yyruleno==455); - case 457: /* tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal */ yytestcase(yyruleno==457); - case 458: /* tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal */ yytestcase(yyruleno==458); - case 466: /* tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal */ yytestcase(yyruleno==466); - case 467: /* tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal */ yytestcase(yyruleno==467); - case 469: /* tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal */ yytestcase(yyruleno==469); - case 470: /* tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal */ yytestcase(yyruleno==470); - case 475: /* tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal */ yytestcase(yyruleno==475); - case 476: /* tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==476); - case 478: /* tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal */ yytestcase(yyruleno==478); - case 479: /* tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==479); -#line 839 "sql.y" + yymsp[-1].minor.yy54 = yylhsminor.yy54; + break; + case 455: /* tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal */ + case 456: /* tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal */ yytestcase(yyruleno==456); + case 458: /* tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal */ yytestcase(yyruleno==458); + case 459: /* tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal */ yytestcase(yyruleno==459); + case 467: /* tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal */ yytestcase(yyruleno==467); + case 468: /* tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal */ yytestcase(yyruleno==468); + case 470: /* tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal */ yytestcase(yyruleno==470); + case 471: /* tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal */ yytestcase(yyruleno==471); + case 476: /* tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal */ yytestcase(yyruleno==476); + case 477: /* tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==477); + case 479: /* tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal */ yytestcase(yyruleno==479); + case 480: /* tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==480); { SToken l = yymsp[-3].minor.yy0; - SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); + SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy54); l.n = (r.z + r.n) - l.z; - yylhsminor.yy416 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, yymsp[0].minor.yy416); + yylhsminor.yy54 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, yymsp[0].minor.yy54); } -#line 7704 "sql.c" - yymsp[-3].minor.yy416 = yylhsminor.yy416; - break; - case 459: /* tags_literal ::= NK_FLOAT */ -#line 868 "sql.y" -{ yylhsminor.yy416 = createRawValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0, NULL); } -#line 7710 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 460: /* tags_literal ::= NK_PLUS NK_FLOAT */ - case 461: /* tags_literal ::= NK_MINUS NK_FLOAT */ yytestcase(yyruleno==461); -#line 869 "sql.y" + yymsp[-3].minor.yy54 = yylhsminor.yy54; + break; + case 460: /* tags_literal ::= NK_FLOAT */ +{ yylhsminor.yy54 = createRawValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0, NULL); } + yymsp[0].minor.yy54 = yylhsminor.yy54; + break; + case 461: /* tags_literal ::= NK_PLUS NK_FLOAT */ + case 462: /* tags_literal ::= NK_MINUS NK_FLOAT */ yytestcase(yyruleno==462); { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy416 = createRawValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t, NULL); + yylhsminor.yy54 = createRawValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t, NULL); } -#line 7721 "sql.c" - yymsp[-1].minor.yy416 = yylhsminor.yy416; - break; - case 480: /* tags_literal ::= NK_STRING */ -#line 975 "sql.y" -{ yylhsminor.yy416 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0, NULL); } -#line 7727 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 483: /* tags_literal ::= NK_BOOL */ -#line 988 "sql.y" -{ yylhsminor.yy416 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0, NULL); } -#line 7733 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 484: /* tags_literal ::= NULL */ -#line 989 "sql.y" -{ yylhsminor.yy416 = createRawValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0, NULL); } -#line 7739 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 485: /* tags_literal ::= literal_func */ -#line 991 "sql.y" -{ yylhsminor.yy416 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BINARY, NULL, yymsp[0].minor.yy416); } -#line 7745 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 486: /* tags_literal ::= literal_func NK_PLUS duration_literal */ - case 487: /* tags_literal ::= literal_func NK_MINUS duration_literal */ yytestcase(yyruleno==487); -#line 992 "sql.y" + yymsp[-1].minor.yy54 = yylhsminor.yy54; + break; + case 481: /* tags_literal ::= NK_STRING */ +{ yylhsminor.yy54 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0, NULL); } + yymsp[0].minor.yy54 = yylhsminor.yy54; + break; + case 484: /* tags_literal ::= NK_BOOL */ +{ yylhsminor.yy54 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0, NULL); } + yymsp[0].minor.yy54 = yylhsminor.yy54; + break; + case 485: /* tags_literal ::= NULL */ +{ yylhsminor.yy54 = createRawValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0, NULL); } + yymsp[0].minor.yy54 = yylhsminor.yy54; + break; + case 486: /* tags_literal ::= literal_func */ +{ yylhsminor.yy54 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BINARY, NULL, yymsp[0].minor.yy54); } + yymsp[0].minor.yy54 = yylhsminor.yy54; + break; + case 487: /* tags_literal ::= literal_func NK_PLUS duration_literal */ + case 488: /* tags_literal ::= literal_func NK_MINUS duration_literal */ yytestcase(yyruleno==488); { - SToken l = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy416); - SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); + SToken l = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy54); + SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy54); l.n = (r.z + r.n) - l.z; - yylhsminor.yy416 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, yymsp[-2].minor.yy416, yymsp[0].minor.yy416); + yylhsminor.yy54 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, yymsp[-2].minor.yy54, yymsp[0].minor.yy54); } -#line 7757 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; - break; - case 490: /* literal ::= NK_INTEGER */ -#line 1011 "sql.y" -{ yylhsminor.yy416 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); } -#line 7763 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 491: /* literal ::= NK_FLOAT */ -#line 1012 "sql.y" -{ yylhsminor.yy416 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } -#line 7769 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 492: /* literal ::= NK_STRING */ -#line 1013 "sql.y" -{ yylhsminor.yy416 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } -#line 7775 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 493: /* literal ::= NK_BOOL */ -#line 1014 "sql.y" -{ yylhsminor.yy416 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } -#line 7781 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 494: /* literal ::= TIMESTAMP NK_STRING */ -#line 1015 "sql.y" -{ yylhsminor.yy416 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } -#line 7787 "sql.c" - yymsp[-1].minor.yy416 = yylhsminor.yy416; - break; - case 495: /* literal ::= duration_literal */ - case 505: /* signed_literal ::= signed */ yytestcase(yyruleno==505); - case 529: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==529); - case 530: /* expression ::= literal */ yytestcase(yyruleno==530); - case 532: /* expression ::= column_reference */ yytestcase(yyruleno==532); - case 533: /* expression ::= function_expression */ yytestcase(yyruleno==533); - case 534: /* expression ::= case_when_expression */ yytestcase(yyruleno==534); - case 568: /* function_expression ::= literal_func */ yytestcase(yyruleno==568); - case 618: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==618); - case 622: /* boolean_primary ::= predicate */ yytestcase(yyruleno==622); - case 624: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==624); - case 625: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==625); - case 628: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==628); - case 630: /* table_reference ::= table_primary */ yytestcase(yyruleno==630); - case 631: /* table_reference ::= joined_table */ yytestcase(yyruleno==631); - case 635: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==635); - case 720: /* query_simple ::= query_specification */ yytestcase(yyruleno==720); - case 721: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==721); - case 724: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==724); - case 726: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==726); -#line 1016 "sql.y" -{ yylhsminor.yy416 = yymsp[0].minor.yy416; } -#line 7812 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 496: /* literal ::= NULL */ -#line 1017 "sql.y" -{ yylhsminor.yy416 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } -#line 7818 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 497: /* literal ::= NK_QUESTION */ -#line 1018 "sql.y" -{ yylhsminor.yy416 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } -#line 7824 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 498: /* duration_literal ::= NK_VARIABLE */ - case 695: /* interval_sliding_duration_literal ::= NK_VARIABLE */ yytestcase(yyruleno==695); - case 696: /* interval_sliding_duration_literal ::= NK_STRING */ yytestcase(yyruleno==696); - case 697: /* interval_sliding_duration_literal ::= NK_INTEGER */ yytestcase(yyruleno==697); -#line 1020 "sql.y" -{ yylhsminor.yy416 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } -#line 7833 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 499: /* signed ::= NK_INTEGER */ -#line 1022 "sql.y" -{ yylhsminor.yy416 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } -#line 7839 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 500: /* signed ::= NK_PLUS NK_INTEGER */ -#line 1023 "sql.y" -{ yymsp[-1].minor.yy416 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } -#line 7845 "sql.c" - break; - case 501: /* signed ::= NK_MINUS NK_INTEGER */ -#line 1024 "sql.y" + yymsp[-2].minor.yy54 = yylhsminor.yy54; + break; + case 491: /* literal ::= NK_INTEGER */ +{ yylhsminor.yy54 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy54 = yylhsminor.yy54; + break; + case 492: /* literal ::= NK_FLOAT */ +{ yylhsminor.yy54 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy54 = yylhsminor.yy54; + break; + case 493: /* literal ::= NK_STRING */ +{ yylhsminor.yy54 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy54 = yylhsminor.yy54; + break; + case 494: /* literal ::= NK_BOOL */ +{ yylhsminor.yy54 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy54 = yylhsminor.yy54; + break; + case 495: /* literal ::= TIMESTAMP NK_STRING */ +{ yylhsminor.yy54 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } + yymsp[-1].minor.yy54 = yylhsminor.yy54; + break; + case 496: /* literal ::= duration_literal */ + case 506: /* signed_literal ::= signed */ yytestcase(yyruleno==506); + case 530: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==530); + case 531: /* expression ::= literal */ yytestcase(yyruleno==531); + case 533: /* expression ::= column_reference */ yytestcase(yyruleno==533); + case 534: /* expression ::= function_expression */ yytestcase(yyruleno==534); + case 535: /* expression ::= case_when_expression */ yytestcase(yyruleno==535); + case 569: /* function_expression ::= literal_func */ yytestcase(yyruleno==569); + case 619: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==619); + case 623: /* boolean_primary ::= predicate */ yytestcase(yyruleno==623); + case 625: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==625); + case 626: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==626); + case 629: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==629); + case 631: /* table_reference ::= table_primary */ yytestcase(yyruleno==631); + case 632: /* table_reference ::= joined_table */ yytestcase(yyruleno==632); + case 636: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==636); + case 721: /* query_simple ::= query_specification */ yytestcase(yyruleno==721); + case 722: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==722); + case 725: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==725); + case 727: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==727); +{ yylhsminor.yy54 = yymsp[0].minor.yy54; } + yymsp[0].minor.yy54 = yylhsminor.yy54; + break; + case 497: /* literal ::= NULL */ +{ yylhsminor.yy54 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy54 = yylhsminor.yy54; + break; + case 498: /* literal ::= NK_QUESTION */ +{ yylhsminor.yy54 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy54 = yylhsminor.yy54; + break; + case 499: /* duration_literal ::= NK_VARIABLE */ + case 696: /* interval_sliding_duration_literal ::= NK_VARIABLE */ yytestcase(yyruleno==696); + case 697: /* interval_sliding_duration_literal ::= NK_STRING */ yytestcase(yyruleno==697); + case 698: /* interval_sliding_duration_literal ::= NK_INTEGER */ yytestcase(yyruleno==698); +{ yylhsminor.yy54 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy54 = yylhsminor.yy54; + break; + case 500: /* signed ::= NK_INTEGER */ +{ yylhsminor.yy54 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy54 = yylhsminor.yy54; + break; + case 501: /* signed ::= NK_PLUS NK_INTEGER */ +{ yymsp[-1].minor.yy54 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } + break; + case 502: /* 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.yy416 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); + yylhsminor.yy54 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); } -#line 7854 "sql.c" - yymsp[-1].minor.yy416 = yylhsminor.yy416; - break; - case 502: /* signed ::= NK_FLOAT */ -#line 1029 "sql.y" -{ yylhsminor.yy416 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } -#line 7860 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 503: /* signed ::= NK_PLUS NK_FLOAT */ -#line 1030 "sql.y" -{ yymsp[-1].minor.yy416 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } -#line 7866 "sql.c" - break; - case 504: /* signed ::= NK_MINUS NK_FLOAT */ -#line 1031 "sql.y" + yymsp[-1].minor.yy54 = yylhsminor.yy54; + break; + case 503: /* signed ::= NK_FLOAT */ +{ yylhsminor.yy54 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy54 = yylhsminor.yy54; + break; + case 504: /* signed ::= NK_PLUS NK_FLOAT */ +{ yymsp[-1].minor.yy54 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + break; + case 505: /* 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.yy416 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); + yylhsminor.yy54 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); } -#line 7875 "sql.c" - yymsp[-1].minor.yy416 = yylhsminor.yy416; - break; - case 506: /* signed_literal ::= NK_STRING */ -#line 1038 "sql.y" -{ yylhsminor.yy416 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } -#line 7881 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 507: /* signed_literal ::= NK_BOOL */ -#line 1039 "sql.y" -{ yylhsminor.yy416 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } -#line 7887 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 508: /* signed_literal ::= TIMESTAMP NK_STRING */ -#line 1040 "sql.y" -{ yymsp[-1].minor.yy416 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } -#line 7893 "sql.c" - break; - case 509: /* signed_literal ::= duration_literal */ - case 511: /* signed_literal ::= literal_func */ yytestcase(yyruleno==511); - case 589: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==589); - case 672: /* select_item ::= common_expression */ yytestcase(yyruleno==672); - case 682: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==682); - case 725: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==725); - case 727: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==727); - case 740: /* search_condition ::= common_expression */ yytestcase(yyruleno==740); -#line 1041 "sql.y" -{ yylhsminor.yy416 = releaseRawExprNode(pCxt, yymsp[0].minor.yy416); } -#line 7905 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 510: /* signed_literal ::= NULL */ -#line 1042 "sql.y" -{ yylhsminor.yy416 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } -#line 7911 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 512: /* signed_literal ::= NK_QUESTION */ -#line 1044 "sql.y" -{ yylhsminor.yy416 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); } -#line 7917 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 531: /* expression ::= pseudo_column */ -#line 1110 "sql.y" -{ yylhsminor.yy416 = yymsp[0].minor.yy416; setRawExprNodeIsPseudoColumn(pCxt, yylhsminor.yy416, true); } -#line 7923 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 535: /* expression ::= NK_LP expression NK_RP */ - case 623: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==623); - case 739: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==739); -#line 1114 "sql.y" -{ yylhsminor.yy416 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy416)); } -#line 7931 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; - break; - case 536: /* expression ::= NK_PLUS expr_or_subquery */ -#line 1115 "sql.y" + yymsp[-1].minor.yy54 = yylhsminor.yy54; + break; + case 507: /* signed_literal ::= NK_STRING */ +{ yylhsminor.yy54 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy54 = yylhsminor.yy54; + break; + case 508: /* signed_literal ::= NK_BOOL */ +{ yylhsminor.yy54 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy54 = yylhsminor.yy54; + break; + case 509: /* signed_literal ::= TIMESTAMP NK_STRING */ +{ yymsp[-1].minor.yy54 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } + break; + case 510: /* signed_literal ::= duration_literal */ + case 512: /* signed_literal ::= literal_func */ yytestcase(yyruleno==512); + case 590: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==590); + case 673: /* select_item ::= common_expression */ yytestcase(yyruleno==673); + case 683: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==683); + case 726: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==726); + case 728: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==728); + case 741: /* search_condition ::= common_expression */ yytestcase(yyruleno==741); +{ yylhsminor.yy54 = releaseRawExprNode(pCxt, yymsp[0].minor.yy54); } + yymsp[0].minor.yy54 = yylhsminor.yy54; + break; + case 511: /* signed_literal ::= NULL */ +{ yylhsminor.yy54 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy54 = yylhsminor.yy54; + break; + case 513: /* signed_literal ::= NK_QUESTION */ +{ yylhsminor.yy54 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy54 = yylhsminor.yy54; + break; + case 532: /* expression ::= pseudo_column */ +{ yylhsminor.yy54 = yymsp[0].minor.yy54; (void)setRawExprNodeIsPseudoColumn(pCxt, yylhsminor.yy54, true); } + yymsp[0].minor.yy54 = yylhsminor.yy54; + break; + case 536: /* expression ::= NK_LP expression NK_RP */ + case 624: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==624); + case 740: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==740); +{ yylhsminor.yy54 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy54)); } + yymsp[-2].minor.yy54 = yylhsminor.yy54; + break; + case 537: /* expression ::= NK_PLUS expr_or_subquery */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); - yylhsminor.yy416 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy416)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy54); + yylhsminor.yy54 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy54)); } -#line 7940 "sql.c" - yymsp[-1].minor.yy416 = yylhsminor.yy416; + yymsp[-1].minor.yy54 = yylhsminor.yy54; break; - case 537: /* expression ::= NK_MINUS expr_or_subquery */ -#line 1119 "sql.y" + case 538: /* expression ::= NK_MINUS expr_or_subquery */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); - yylhsminor.yy416 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy416), NULL)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy54); + yylhsminor.yy54 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy54), NULL)); } -#line 7949 "sql.c" - yymsp[-1].minor.yy416 = yylhsminor.yy416; + yymsp[-1].minor.yy54 = yylhsminor.yy54; break; - case 538: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ -#line 1123 "sql.y" + case 539: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy416); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); - yylhsminor.yy416 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), releaseRawExprNode(pCxt, yymsp[0].minor.yy416))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy54); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy54); + yylhsminor.yy54 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy54), releaseRawExprNode(pCxt, yymsp[0].minor.yy54))); } -#line 7959 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; - case 539: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ -#line 1128 "sql.y" + case 540: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy416); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); - yylhsminor.yy416 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), releaseRawExprNode(pCxt, yymsp[0].minor.yy416))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy54); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy54); + yylhsminor.yy54 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy54), releaseRawExprNode(pCxt, yymsp[0].minor.yy54))); } -#line 7969 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; - case 540: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */ -#line 1133 "sql.y" + case 541: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy416); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); - yylhsminor.yy416 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), releaseRawExprNode(pCxt, yymsp[0].minor.yy416))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy54); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy54); + yylhsminor.yy54 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy54), releaseRawExprNode(pCxt, yymsp[0].minor.yy54))); } -#line 7979 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; - case 541: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ -#line 1138 "sql.y" + case 542: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy416); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); - yylhsminor.yy416 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), releaseRawExprNode(pCxt, yymsp[0].minor.yy416))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy54); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy54); + yylhsminor.yy54 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy54), releaseRawExprNode(pCxt, yymsp[0].minor.yy54))); } -#line 7989 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; - case 542: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */ -#line 1143 "sql.y" + case 543: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy416); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); - yylhsminor.yy416 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), releaseRawExprNode(pCxt, yymsp[0].minor.yy416))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy54); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy54); + yylhsminor.yy54 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy54), releaseRawExprNode(pCxt, yymsp[0].minor.yy54))); } -#line 7999 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; - case 543: /* expression ::= column_reference NK_ARROW NK_STRING */ -#line 1148 "sql.y" + case 544: /* expression ::= column_reference NK_ARROW NK_STRING */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy416); - yylhsminor.yy416 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy54); + yylhsminor.yy54 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy54), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); } -#line 8008 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; - case 544: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ -#line 1152 "sql.y" + case 545: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy416); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); - yylhsminor.yy416 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), releaseRawExprNode(pCxt, yymsp[0].minor.yy416))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy54); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy54); + yylhsminor.yy54 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy54), releaseRawExprNode(pCxt, yymsp[0].minor.yy54))); } -#line 8018 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; - case 545: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ -#line 1157 "sql.y" + case 546: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy416); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); - yylhsminor.yy416 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), releaseRawExprNode(pCxt, yymsp[0].minor.yy416))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy54); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy54); + yylhsminor.yy54 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy54), releaseRawExprNode(pCxt, yymsp[0].minor.yy54))); } -#line 8028 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; - break; - case 548: /* column_reference ::= column_name */ -#line 1168 "sql.y" -{ yylhsminor.yy416 = createRawExprNode(pCxt, &yymsp[0].minor.yy1109, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy1109)); } -#line 8034 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 549: /* column_reference ::= table_name NK_DOT column_name */ -#line 1169 "sql.y" -{ yylhsminor.yy416 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy1109, &yymsp[0].minor.yy1109, createColumnNode(pCxt, &yymsp[-2].minor.yy1109, &yymsp[0].minor.yy1109)); } -#line 8040 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; - break; - case 550: /* column_reference ::= NK_ALIAS */ -#line 1170 "sql.y" -{ yylhsminor.yy416 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } -#line 8046 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 551: /* column_reference ::= table_name NK_DOT NK_ALIAS */ -#line 1171 "sql.y" -{ yylhsminor.yy416 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy1109, &yymsp[0].minor.yy0, createColumnNode(pCxt, &yymsp[-2].minor.yy1109, &yymsp[0].minor.yy0)); } -#line 8052 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; - break; - case 552: /* pseudo_column ::= ROWTS */ - case 553: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==553); - case 555: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==555); - case 556: /* pseudo_column ::= QEND */ yytestcase(yyruleno==556); - case 557: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==557); - case 558: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==558); - case 559: /* pseudo_column ::= WEND */ yytestcase(yyruleno==559); - case 560: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==560); - case 561: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==561); - case 562: /* pseudo_column ::= ISFILLED */ yytestcase(yyruleno==562); - case 563: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==563); - case 570: /* literal_func ::= NOW */ yytestcase(yyruleno==570); - case 571: /* literal_func ::= TODAY */ yytestcase(yyruleno==571); -#line 1173 "sql.y" -{ yylhsminor.yy416 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } -#line 8070 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 554: /* pseudo_column ::= table_name NK_DOT TBNAME */ -#line 1175 "sql.y" -{ yylhsminor.yy416 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy1109, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy1109)))); } -#line 8076 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; - break; - case 564: /* function_expression ::= function_name NK_LP expression_list NK_RP */ - case 565: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==565); -#line 1186 "sql.y" -{ yylhsminor.yy416 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy1109, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy1109, yymsp[-1].minor.yy316)); } -#line 8083 "sql.c" - yymsp[-3].minor.yy416 = yylhsminor.yy416; - break; - case 566: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ - case 567: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP */ yytestcase(yyruleno==567); -#line 1189 "sql.y" -{ yylhsminor.yy416 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy416), yymsp[-1].minor.yy952)); } -#line 8090 "sql.c" - yymsp[-5].minor.yy416 = yylhsminor.yy416; - break; - case 569: /* literal_func ::= noarg_func NK_LP NK_RP */ -#line 1195 "sql.y" -{ yylhsminor.yy416 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy1109, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy1109, NULL)); } -#line 8096 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; - break; - case 585: /* star_func_para_list ::= NK_STAR */ -#line 1220 "sql.y" -{ yylhsminor.yy316 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } -#line 8102 "sql.c" - yymsp[0].minor.yy316 = yylhsminor.yy316; - break; - case 590: /* star_func_para ::= table_name NK_DOT NK_STAR */ - case 675: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==675); -#line 1229 "sql.y" -{ yylhsminor.yy416 = createColumnNode(pCxt, &yymsp[-2].minor.yy1109, &yymsp[0].minor.yy0); } -#line 8109 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; - break; - case 591: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */ -#line 1232 "sql.y" -{ yylhsminor.yy416 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy316, yymsp[-1].minor.yy416)); } -#line 8115 "sql.c" - yymsp[-3].minor.yy416 = yylhsminor.yy416; - break; - case 592: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ -#line 1234 "sql.y" -{ yylhsminor.yy416 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy416), yymsp[-2].minor.yy316, yymsp[-1].minor.yy416)); } -#line 8121 "sql.c" - yymsp[-4].minor.yy416 = yylhsminor.yy416; - break; - case 595: /* when_then_expr ::= WHEN common_expression THEN common_expression */ -#line 1241 "sql.y" -{ yymsp[-3].minor.yy416 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), releaseRawExprNode(pCxt, yymsp[0].minor.yy416)); } -#line 8127 "sql.c" - break; - case 597: /* case_when_else_opt ::= ELSE common_expression */ -#line 1244 "sql.y" -{ yymsp[-1].minor.yy416 = releaseRawExprNode(pCxt, yymsp[0].minor.yy416); } -#line 8132 "sql.c" - break; - case 598: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */ - case 603: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==603); -#line 1247 "sql.y" + yymsp[-2].minor.yy54 = yylhsminor.yy54; + break; + case 549: /* column_reference ::= column_name */ +{ yylhsminor.yy54 = createRawExprNode(pCxt, &yymsp[0].minor.yy837, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy837)); } + yymsp[0].minor.yy54 = yylhsminor.yy54; + break; + case 550: /* column_reference ::= table_name NK_DOT column_name */ +{ yylhsminor.yy54 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy837, &yymsp[0].minor.yy837, createColumnNode(pCxt, &yymsp[-2].minor.yy837, &yymsp[0].minor.yy837)); } + yymsp[-2].minor.yy54 = yylhsminor.yy54; + break; + case 551: /* column_reference ::= NK_ALIAS */ +{ yylhsminor.yy54 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy54 = yylhsminor.yy54; + break; + case 552: /* column_reference ::= table_name NK_DOT NK_ALIAS */ +{ yylhsminor.yy54 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy837, &yymsp[0].minor.yy0, createColumnNode(pCxt, &yymsp[-2].minor.yy837, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy54 = yylhsminor.yy54; + break; + case 553: /* pseudo_column ::= ROWTS */ + case 554: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==554); + case 556: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==556); + case 557: /* pseudo_column ::= QEND */ yytestcase(yyruleno==557); + case 558: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==558); + case 559: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==559); + case 560: /* pseudo_column ::= WEND */ yytestcase(yyruleno==560); + case 561: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==561); + case 562: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==562); + case 563: /* pseudo_column ::= ISFILLED */ yytestcase(yyruleno==563); + case 564: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==564); + case 571: /* literal_func ::= NOW */ yytestcase(yyruleno==571); + case 572: /* literal_func ::= TODAY */ yytestcase(yyruleno==572); +{ yylhsminor.yy54 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } + yymsp[0].minor.yy54 = yylhsminor.yy54; + break; + case 555: /* pseudo_column ::= table_name NK_DOT TBNAME */ +{ yylhsminor.yy54 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy837, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy837)))); } + yymsp[-2].minor.yy54 = yylhsminor.yy54; + break; + case 565: /* function_expression ::= function_name NK_LP expression_list NK_RP */ + case 566: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==566); +{ yylhsminor.yy54 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy837, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy837, yymsp[-1].minor.yy652)); } + yymsp[-3].minor.yy54 = yylhsminor.yy54; + break; + case 567: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ + case 568: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP */ yytestcase(yyruleno==568); +{ yylhsminor.yy54 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy54), yymsp[-1].minor.yy84)); } + yymsp[-5].minor.yy54 = yylhsminor.yy54; + break; + case 570: /* literal_func ::= noarg_func NK_LP NK_RP */ +{ yylhsminor.yy54 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy837, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy837, NULL)); } + yymsp[-2].minor.yy54 = yylhsminor.yy54; + break; + case 586: /* star_func_para_list ::= NK_STAR */ +{ yylhsminor.yy652 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy652 = yylhsminor.yy652; + break; + case 591: /* star_func_para ::= table_name NK_DOT NK_STAR */ + case 676: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==676); +{ yylhsminor.yy54 = createColumnNode(pCxt, &yymsp[-2].minor.yy837, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy54 = yylhsminor.yy54; + break; + case 592: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */ +{ yylhsminor.yy54 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy652, yymsp[-1].minor.yy54)); } + yymsp[-3].minor.yy54 = yylhsminor.yy54; + break; + case 593: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ +{ yylhsminor.yy54 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy54), yymsp[-2].minor.yy652, yymsp[-1].minor.yy54)); } + yymsp[-4].minor.yy54 = yylhsminor.yy54; + break; + case 596: /* when_then_expr ::= WHEN common_expression THEN common_expression */ +{ yymsp[-3].minor.yy54 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy54), releaseRawExprNode(pCxt, yymsp[0].minor.yy54)); } + break; + case 598: /* case_when_else_opt ::= ELSE common_expression */ +{ yymsp[-1].minor.yy54 = releaseRawExprNode(pCxt, yymsp[0].minor.yy54); } + break; + case 599: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */ + case 604: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==604); { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy416); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); - yylhsminor.yy416 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy848, releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), releaseRawExprNode(pCxt, yymsp[0].minor.yy416))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy54); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy54); + yylhsminor.yy54 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy922, releaseRawExprNode(pCxt, yymsp[-2].minor.yy54), releaseRawExprNode(pCxt, yymsp[0].minor.yy54))); } -#line 8142 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; - case 599: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ -#line 1254 "sql.y" + case 600: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy416); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); - yylhsminor.yy416 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy416), releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), releaseRawExprNode(pCxt, yymsp[0].minor.yy416))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy54); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy54); + yylhsminor.yy54 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy54), releaseRawExprNode(pCxt, yymsp[-2].minor.yy54), releaseRawExprNode(pCxt, yymsp[0].minor.yy54))); } -#line 8152 "sql.c" - yymsp[-4].minor.yy416 = yylhsminor.yy416; + yymsp[-4].minor.yy54 = yylhsminor.yy54; break; - case 600: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ -#line 1260 "sql.y" + case 601: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy416); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); - yylhsminor.yy416 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy416), releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), releaseRawExprNode(pCxt, yymsp[0].minor.yy416))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy54); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy54); + yylhsminor.yy54 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy54), releaseRawExprNode(pCxt, yymsp[-2].minor.yy54), releaseRawExprNode(pCxt, yymsp[0].minor.yy54))); } -#line 8162 "sql.c" - yymsp[-5].minor.yy416 = yylhsminor.yy416; + yymsp[-5].minor.yy54 = yylhsminor.yy54; break; - case 601: /* predicate ::= expr_or_subquery IS NULL */ -#line 1265 "sql.y" + case 602: /* predicate ::= expr_or_subquery IS NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy416); - yylhsminor.yy416 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy54); + yylhsminor.yy54 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy54), NULL)); } -#line 8171 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; - case 602: /* predicate ::= expr_or_subquery IS NOT NULL */ -#line 1269 "sql.y" + case 603: /* predicate ::= expr_or_subquery IS NOT NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy416); - yylhsminor.yy416 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy416), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy54); + yylhsminor.yy54 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy54), NULL)); } -#line 8180 "sql.c" - yymsp[-3].minor.yy416 = yylhsminor.yy416; - break; - case 604: /* compare_op ::= NK_LT */ -#line 1281 "sql.y" -{ yymsp[0].minor.yy848 = OP_TYPE_LOWER_THAN; } -#line 8186 "sql.c" - break; - case 605: /* compare_op ::= NK_GT */ -#line 1282 "sql.y" -{ yymsp[0].minor.yy848 = OP_TYPE_GREATER_THAN; } -#line 8191 "sql.c" - break; - case 606: /* compare_op ::= NK_LE */ -#line 1283 "sql.y" -{ yymsp[0].minor.yy848 = OP_TYPE_LOWER_EQUAL; } -#line 8196 "sql.c" - break; - case 607: /* compare_op ::= NK_GE */ -#line 1284 "sql.y" -{ yymsp[0].minor.yy848 = OP_TYPE_GREATER_EQUAL; } -#line 8201 "sql.c" - break; - case 608: /* compare_op ::= NK_NE */ -#line 1285 "sql.y" -{ yymsp[0].minor.yy848 = OP_TYPE_NOT_EQUAL; } -#line 8206 "sql.c" - break; - case 609: /* compare_op ::= NK_EQ */ -#line 1286 "sql.y" -{ yymsp[0].minor.yy848 = OP_TYPE_EQUAL; } -#line 8211 "sql.c" - break; - case 610: /* compare_op ::= LIKE */ -#line 1287 "sql.y" -{ yymsp[0].minor.yy848 = OP_TYPE_LIKE; } -#line 8216 "sql.c" - break; - case 611: /* compare_op ::= NOT LIKE */ -#line 1288 "sql.y" -{ yymsp[-1].minor.yy848 = OP_TYPE_NOT_LIKE; } -#line 8221 "sql.c" - break; - case 612: /* compare_op ::= MATCH */ -#line 1289 "sql.y" -{ yymsp[0].minor.yy848 = OP_TYPE_MATCH; } -#line 8226 "sql.c" - break; - case 613: /* compare_op ::= NMATCH */ -#line 1290 "sql.y" -{ yymsp[0].minor.yy848 = OP_TYPE_NMATCH; } -#line 8231 "sql.c" - break; - case 614: /* compare_op ::= CONTAINS */ -#line 1291 "sql.y" -{ yymsp[0].minor.yy848 = OP_TYPE_JSON_CONTAINS; } -#line 8236 "sql.c" - break; - case 615: /* in_op ::= IN */ -#line 1295 "sql.y" -{ yymsp[0].minor.yy848 = OP_TYPE_IN; } -#line 8241 "sql.c" - break; - case 616: /* in_op ::= NOT IN */ -#line 1296 "sql.y" -{ yymsp[-1].minor.yy848 = OP_TYPE_NOT_IN; } -#line 8246 "sql.c" - break; - case 617: /* in_predicate_value ::= NK_LP literal_list NK_RP */ -#line 1298 "sql.y" -{ yylhsminor.yy416 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy316)); } -#line 8251 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; - break; - case 619: /* boolean_value_expression ::= NOT boolean_primary */ -#line 1302 "sql.y" + yymsp[-3].minor.yy54 = yylhsminor.yy54; + break; + case 605: /* compare_op ::= NK_LT */ +{ yymsp[0].minor.yy922 = OP_TYPE_LOWER_THAN; } + break; + case 606: /* compare_op ::= NK_GT */ +{ yymsp[0].minor.yy922 = OP_TYPE_GREATER_THAN; } + break; + case 607: /* compare_op ::= NK_LE */ +{ yymsp[0].minor.yy922 = OP_TYPE_LOWER_EQUAL; } + break; + case 608: /* compare_op ::= NK_GE */ +{ yymsp[0].minor.yy922 = OP_TYPE_GREATER_EQUAL; } + break; + case 609: /* compare_op ::= NK_NE */ +{ yymsp[0].minor.yy922 = OP_TYPE_NOT_EQUAL; } + break; + case 610: /* compare_op ::= NK_EQ */ +{ yymsp[0].minor.yy922 = OP_TYPE_EQUAL; } + break; + case 611: /* compare_op ::= LIKE */ +{ yymsp[0].minor.yy922 = OP_TYPE_LIKE; } + break; + case 612: /* compare_op ::= NOT LIKE */ +{ yymsp[-1].minor.yy922 = OP_TYPE_NOT_LIKE; } + break; + case 613: /* compare_op ::= MATCH */ +{ yymsp[0].minor.yy922 = OP_TYPE_MATCH; } + break; + case 614: /* compare_op ::= NMATCH */ +{ yymsp[0].minor.yy922 = OP_TYPE_NMATCH; } + break; + case 615: /* compare_op ::= CONTAINS */ +{ yymsp[0].minor.yy922 = OP_TYPE_JSON_CONTAINS; } + break; + case 616: /* in_op ::= IN */ +{ yymsp[0].minor.yy922 = OP_TYPE_IN; } + break; + case 617: /* in_op ::= NOT IN */ +{ yymsp[-1].minor.yy922 = OP_TYPE_NOT_IN; } + break; + case 618: /* in_predicate_value ::= NK_LP literal_list NK_RP */ +{ yylhsminor.yy54 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy652)); } + yymsp[-2].minor.yy54 = yylhsminor.yy54; + break; + case 620: /* boolean_value_expression ::= NOT boolean_primary */ { - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); - yylhsminor.yy416 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy416), NULL)); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy54); + yylhsminor.yy54 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy54), NULL)); } -#line 8260 "sql.c" - yymsp[-1].minor.yy416 = yylhsminor.yy416; + yymsp[-1].minor.yy54 = yylhsminor.yy54; break; - case 620: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ -#line 1307 "sql.y" + case 621: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy416); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); - yylhsminor.yy416 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), releaseRawExprNode(pCxt, yymsp[0].minor.yy416))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy54); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy54); + yylhsminor.yy54 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy54), releaseRawExprNode(pCxt, yymsp[0].minor.yy54))); } -#line 8270 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; - case 621: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ -#line 1313 "sql.y" + case 622: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy416); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); - yylhsminor.yy416 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), releaseRawExprNode(pCxt, yymsp[0].minor.yy416))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy54); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy54); + yylhsminor.yy54 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy54), releaseRawExprNode(pCxt, yymsp[0].minor.yy54))); } -#line 8280 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; - break; - case 629: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ -#line 1331 "sql.y" -{ yylhsminor.yy416 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, JOIN_STYPE_NONE, yymsp[-2].minor.yy416, yymsp[0].minor.yy416, NULL); } -#line 8286 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; - break; - case 632: /* table_primary ::= table_name alias_opt */ -#line 1337 "sql.y" -{ yylhsminor.yy416 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy1109, &yymsp[0].minor.yy1109); } -#line 8292 "sql.c" - yymsp[-1].minor.yy416 = yylhsminor.yy416; - break; - case 633: /* table_primary ::= db_name NK_DOT table_name alias_opt */ -#line 1338 "sql.y" -{ yylhsminor.yy416 = createRealTableNode(pCxt, &yymsp[-3].minor.yy1109, &yymsp[-1].minor.yy1109, &yymsp[0].minor.yy1109); } -#line 8298 "sql.c" - yymsp[-3].minor.yy416 = yylhsminor.yy416; - break; - case 634: /* table_primary ::= subquery alias_opt */ -#line 1339 "sql.y" -{ yylhsminor.yy416 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy416), &yymsp[0].minor.yy1109); } -#line 8304 "sql.c" - yymsp[-1].minor.yy416 = yylhsminor.yy416; - break; - case 636: /* alias_opt ::= */ -#line 1344 "sql.y" -{ yymsp[1].minor.yy1109 = nil_token; } -#line 8310 "sql.c" - break; - case 638: /* alias_opt ::= AS table_alias */ -#line 1346 "sql.y" -{ yymsp[-1].minor.yy1109 = yymsp[0].minor.yy1109; } -#line 8315 "sql.c" - break; - case 639: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - case 640: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==640); -#line 1348 "sql.y" -{ yymsp[-2].minor.yy416 = yymsp[-1].minor.yy416; } -#line 8321 "sql.c" - break; - case 641: /* joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt */ -#line 1354 "sql.y" + yymsp[-2].minor.yy54 = yylhsminor.yy54; + break; + case 630: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ +{ yylhsminor.yy54 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, JOIN_STYPE_NONE, yymsp[-2].minor.yy54, yymsp[0].minor.yy54, NULL); } + yymsp[-2].minor.yy54 = yylhsminor.yy54; + break; + case 633: /* table_primary ::= table_name alias_opt */ +{ yylhsminor.yy54 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy837, &yymsp[0].minor.yy837); } + yymsp[-1].minor.yy54 = yylhsminor.yy54; + break; + case 634: /* table_primary ::= db_name NK_DOT table_name alias_opt */ +{ yylhsminor.yy54 = createRealTableNode(pCxt, &yymsp[-3].minor.yy837, &yymsp[-1].minor.yy837, &yymsp[0].minor.yy837); } + yymsp[-3].minor.yy54 = yylhsminor.yy54; + break; + case 635: /* table_primary ::= subquery alias_opt */ +{ yylhsminor.yy54 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy54), &yymsp[0].minor.yy837); } + yymsp[-1].minor.yy54 = yylhsminor.yy54; + break; + case 637: /* alias_opt ::= */ +{ yymsp[1].minor.yy837 = nil_token; } + break; + case 639: /* alias_opt ::= AS table_alias */ +{ yymsp[-1].minor.yy837 = yymsp[0].minor.yy837; } + break; + case 640: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + case 641: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==641); +{ yymsp[-2].minor.yy54 = yymsp[-1].minor.yy54; } + break; + case 642: /* joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt */ { - yylhsminor.yy416 = createJoinTableNode(pCxt, yymsp[-6].minor.yy972, yymsp[-5].minor.yy630, yymsp[-7].minor.yy416, yymsp[-3].minor.yy416, yymsp[-2].minor.yy416); - yylhsminor.yy416 = addWindowOffsetClause(pCxt, yylhsminor.yy416, yymsp[-1].minor.yy416); - yylhsminor.yy416 = addJLimitClause(pCxt, yylhsminor.yy416, yymsp[0].minor.yy416); + yylhsminor.yy54 = createJoinTableNode(pCxt, yymsp[-6].minor.yy230, yymsp[-5].minor.yy948, yymsp[-7].minor.yy54, yymsp[-3].minor.yy54, yymsp[-2].minor.yy54); + yylhsminor.yy54 = addWindowOffsetClause(pCxt, yylhsminor.yy54, yymsp[-1].minor.yy54); + yylhsminor.yy54 = addJLimitClause(pCxt, yylhsminor.yy54, yymsp[0].minor.yy54); } -#line 8330 "sql.c" - yymsp[-7].minor.yy416 = yylhsminor.yy416; - break; - case 642: /* join_type ::= */ -#line 1362 "sql.y" -{ yymsp[1].minor.yy972 = JOIN_TYPE_INNER; } -#line 8336 "sql.c" - break; - case 643: /* join_type ::= INNER */ -#line 1363 "sql.y" -{ yymsp[0].minor.yy972 = JOIN_TYPE_INNER; } -#line 8341 "sql.c" - break; - case 644: /* join_type ::= LEFT */ -#line 1364 "sql.y" -{ yymsp[0].minor.yy972 = JOIN_TYPE_LEFT; } -#line 8346 "sql.c" - break; - case 645: /* join_type ::= RIGHT */ -#line 1365 "sql.y" -{ yymsp[0].minor.yy972 = JOIN_TYPE_RIGHT; } -#line 8351 "sql.c" - break; - case 646: /* join_type ::= FULL */ -#line 1366 "sql.y" -{ yymsp[0].minor.yy972 = JOIN_TYPE_FULL; } -#line 8356 "sql.c" - break; - case 647: /* join_subtype ::= */ -#line 1370 "sql.y" -{ yymsp[1].minor.yy630 = JOIN_STYPE_NONE; } -#line 8361 "sql.c" - break; - case 648: /* join_subtype ::= OUTER */ -#line 1371 "sql.y" -{ yymsp[0].minor.yy630 = JOIN_STYPE_OUTER; } -#line 8366 "sql.c" - break; - case 649: /* join_subtype ::= SEMI */ -#line 1372 "sql.y" -{ yymsp[0].minor.yy630 = JOIN_STYPE_SEMI; } -#line 8371 "sql.c" - break; - case 650: /* join_subtype ::= ANTI */ -#line 1373 "sql.y" -{ yymsp[0].minor.yy630 = JOIN_STYPE_ANTI; } -#line 8376 "sql.c" - break; - case 651: /* join_subtype ::= ASOF */ -#line 1374 "sql.y" -{ yymsp[0].minor.yy630 = JOIN_STYPE_ASOF; } -#line 8381 "sql.c" - break; - case 652: /* join_subtype ::= WINDOW */ -#line 1375 "sql.y" -{ yymsp[0].minor.yy630 = JOIN_STYPE_WIN; } -#line 8386 "sql.c" - break; - case 656: /* window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP */ -#line 1382 "sql.y" -{ yymsp[-5].minor.yy416 = createWindowOffsetNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy416), releaseRawExprNode(pCxt, yymsp[-1].minor.yy416)); } -#line 8391 "sql.c" - break; - case 657: /* window_offset_literal ::= NK_VARIABLE */ -#line 1384 "sql.y" -{ yylhsminor.yy416 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createTimeOffsetValueNode(pCxt, &yymsp[0].minor.yy0)); } -#line 8396 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 658: /* window_offset_literal ::= NK_MINUS NK_VARIABLE */ -#line 1385 "sql.y" + yymsp[-7].minor.yy54 = yylhsminor.yy54; + break; + case 643: /* join_type ::= */ +{ yymsp[1].minor.yy230 = JOIN_TYPE_INNER; } + break; + case 644: /* join_type ::= INNER */ +{ yymsp[0].minor.yy230 = JOIN_TYPE_INNER; } + break; + case 645: /* join_type ::= LEFT */ +{ yymsp[0].minor.yy230 = JOIN_TYPE_LEFT; } + break; + case 646: /* join_type ::= RIGHT */ +{ yymsp[0].minor.yy230 = JOIN_TYPE_RIGHT; } + break; + case 647: /* join_type ::= FULL */ +{ yymsp[0].minor.yy230 = JOIN_TYPE_FULL; } + break; + case 648: /* join_subtype ::= */ +{ yymsp[1].minor.yy948 = JOIN_STYPE_NONE; } + break; + case 649: /* join_subtype ::= OUTER */ +{ yymsp[0].minor.yy948 = JOIN_STYPE_OUTER; } + break; + case 650: /* join_subtype ::= SEMI */ +{ yymsp[0].minor.yy948 = JOIN_STYPE_SEMI; } + break; + case 651: /* join_subtype ::= ANTI */ +{ yymsp[0].minor.yy948 = JOIN_STYPE_ANTI; } + break; + case 652: /* join_subtype ::= ASOF */ +{ yymsp[0].minor.yy948 = JOIN_STYPE_ASOF; } + break; + case 653: /* join_subtype ::= WINDOW */ +{ yymsp[0].minor.yy948 = JOIN_STYPE_WIN; } + break; + case 657: /* window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP */ +{ yymsp[-5].minor.yy54 = createWindowOffsetNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy54), releaseRawExprNode(pCxt, yymsp[-1].minor.yy54)); } + break; + case 658: /* window_offset_literal ::= NK_VARIABLE */ +{ yylhsminor.yy54 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createTimeOffsetValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy54 = yylhsminor.yy54; + break; + case 659: /* window_offset_literal ::= NK_MINUS NK_VARIABLE */ { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy416 = createRawExprNode(pCxt, &t, createTimeOffsetValueNode(pCxt, &t)); + yylhsminor.yy54 = createRawExprNode(pCxt, &t, createTimeOffsetValueNode(pCxt, &t)); } -#line 8406 "sql.c" - yymsp[-1].minor.yy416 = yylhsminor.yy416; - break; - case 660: /* jlimit_clause_opt ::= JLIMIT NK_INTEGER */ - case 731: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ yytestcase(yyruleno==731); - case 735: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==735); -#line 1392 "sql.y" -{ yymsp[-1].minor.yy416 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } -#line 8414 "sql.c" - break; - case 661: /* query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_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 */ -#line 1398 "sql.y" + yymsp[-1].minor.yy54 = yylhsminor.yy54; + break; + case 661: /* jlimit_clause_opt ::= JLIMIT NK_INTEGER */ + case 732: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ yytestcase(yyruleno==732); + case 736: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==736); +{ yymsp[-1].minor.yy54 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } + break; + case 662: /* query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_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[-13].minor.yy416 = createSelectStmt(pCxt, yymsp[-11].minor.yy209, yymsp[-9].minor.yy316, yymsp[-8].minor.yy416, yymsp[-12].minor.yy316); - yymsp[-13].minor.yy416 = setSelectStmtTagMode(pCxt, yymsp[-13].minor.yy416, yymsp[-10].minor.yy209); - yymsp[-13].minor.yy416 = addWhereClause(pCxt, yymsp[-13].minor.yy416, yymsp[-7].minor.yy416); - yymsp[-13].minor.yy416 = addPartitionByClause(pCxt, yymsp[-13].minor.yy416, yymsp[-6].minor.yy316); - yymsp[-13].minor.yy416 = addWindowClauseClause(pCxt, yymsp[-13].minor.yy416, yymsp[-2].minor.yy416); - yymsp[-13].minor.yy416 = addGroupByClause(pCxt, yymsp[-13].minor.yy416, yymsp[-1].minor.yy316); - yymsp[-13].minor.yy416 = addHavingClause(pCxt, yymsp[-13].minor.yy416, yymsp[0].minor.yy416); - yymsp[-13].minor.yy416 = addRangeClause(pCxt, yymsp[-13].minor.yy416, yymsp[-5].minor.yy416); - yymsp[-13].minor.yy416 = addEveryClause(pCxt, yymsp[-13].minor.yy416, yymsp[-4].minor.yy416); - yymsp[-13].minor.yy416 = addFillClause(pCxt, yymsp[-13].minor.yy416, yymsp[-3].minor.yy416); + yymsp[-13].minor.yy54 = createSelectStmt(pCxt, yymsp[-11].minor.yy325, yymsp[-9].minor.yy652, yymsp[-8].minor.yy54, yymsp[-12].minor.yy652); + yymsp[-13].minor.yy54 = setSelectStmtTagMode(pCxt, yymsp[-13].minor.yy54, yymsp[-10].minor.yy325); + yymsp[-13].minor.yy54 = addWhereClause(pCxt, yymsp[-13].minor.yy54, yymsp[-7].minor.yy54); + yymsp[-13].minor.yy54 = addPartitionByClause(pCxt, yymsp[-13].minor.yy54, yymsp[-6].minor.yy652); + yymsp[-13].minor.yy54 = addWindowClauseClause(pCxt, yymsp[-13].minor.yy54, yymsp[-2].minor.yy54); + yymsp[-13].minor.yy54 = addGroupByClause(pCxt, yymsp[-13].minor.yy54, yymsp[-1].minor.yy652); + yymsp[-13].minor.yy54 = addHavingClause(pCxt, yymsp[-13].minor.yy54, yymsp[0].minor.yy54); + yymsp[-13].minor.yy54 = addRangeClause(pCxt, yymsp[-13].minor.yy54, yymsp[-5].minor.yy54); + yymsp[-13].minor.yy54 = addEveryClause(pCxt, yymsp[-13].minor.yy54, yymsp[-4].minor.yy54); + yymsp[-13].minor.yy54 = addFillClause(pCxt, yymsp[-13].minor.yy54, yymsp[-3].minor.yy54); } -#line 8430 "sql.c" - break; - case 662: /* hint_list ::= */ -#line 1413 "sql.y" -{ yymsp[1].minor.yy316 = createHintNodeList(pCxt, NULL); } -#line 8435 "sql.c" - break; - case 663: /* hint_list ::= NK_HINT */ -#line 1414 "sql.y" -{ yylhsminor.yy316 = createHintNodeList(pCxt, &yymsp[0].minor.yy0); } -#line 8440 "sql.c" - yymsp[0].minor.yy316 = yylhsminor.yy316; - break; - case 668: /* set_quantifier_opt ::= ALL */ -#line 1425 "sql.y" -{ yymsp[0].minor.yy209 = false; } -#line 8446 "sql.c" - break; - case 671: /* select_item ::= NK_STAR */ -#line 1432 "sql.y" -{ yylhsminor.yy416 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } -#line 8451 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 673: /* select_item ::= common_expression column_alias */ - case 683: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==683); -#line 1434 "sql.y" -{ yylhsminor.yy416 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy416), &yymsp[0].minor.yy1109); } -#line 8458 "sql.c" - yymsp[-1].minor.yy416 = yylhsminor.yy416; - break; - case 674: /* select_item ::= common_expression AS column_alias */ - case 684: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==684); -#line 1435 "sql.y" -{ yylhsminor.yy416 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), &yymsp[0].minor.yy1109); } -#line 8465 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; - break; - case 679: /* partition_by_clause_opt ::= PARTITION BY partition_list */ - case 709: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==709); - case 729: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==729); -#line 1444 "sql.y" -{ yymsp[-2].minor.yy316 = yymsp[0].minor.yy316; } -#line 8473 "sql.c" - break; - case 686: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ -#line 1457 "sql.y" -{ yymsp[-5].minor.yy416 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy416), releaseRawExprNode(pCxt, yymsp[-1].minor.yy416)); } -#line 8478 "sql.c" - break; - case 687: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ -#line 1458 "sql.y" -{ yymsp[-3].minor.yy416 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy416)); } -#line 8483 "sql.c" - break; - case 688: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ -#line 1460 "sql.y" -{ yymsp[-5].minor.yy416 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy416), NULL, yymsp[-1].minor.yy416, yymsp[0].minor.yy416); } -#line 8488 "sql.c" - break; - case 689: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ -#line 1464 "sql.y" -{ yymsp[-7].minor.yy416 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy416), releaseRawExprNode(pCxt, yymsp[-3].minor.yy416), yymsp[-1].minor.yy416, yymsp[0].minor.yy416); } -#line 8493 "sql.c" - break; - case 690: /* twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ -#line 1466 "sql.y" -{ yymsp[-6].minor.yy416 = createEventWindowNode(pCxt, yymsp[-3].minor.yy416, yymsp[0].minor.yy416); } -#line 8498 "sql.c" - break; - case 691: /* twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */ -#line 1468 "sql.y" -{ yymsp[-3].minor.yy416 = createCountWindowNode(pCxt, &yymsp[-1].minor.yy0, &yymsp[-1].minor.yy0); } -#line 8503 "sql.c" - break; - case 692: /* twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ -#line 1470 "sql.y" -{ yymsp[-5].minor.yy416 = createCountWindowNode(pCxt, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0); } -#line 8508 "sql.c" - break; - case 699: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ -#line 1480 "sql.y" -{ yymsp[-3].minor.yy416 = createFillNode(pCxt, yymsp[-1].minor.yy882, NULL); } -#line 8513 "sql.c" - break; - case 700: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ -#line 1481 "sql.y" -{ yymsp[-5].minor.yy416 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy316)); } -#line 8518 "sql.c" - break; - case 701: /* fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ -#line 1482 "sql.y" -{ yymsp[-5].minor.yy416 = createFillNode(pCxt, FILL_MODE_VALUE_F, createNodeListNode(pCxt, yymsp[-1].minor.yy316)); } -#line 8523 "sql.c" - break; - case 702: /* fill_mode ::= NONE */ -#line 1486 "sql.y" -{ yymsp[0].minor.yy882 = FILL_MODE_NONE; } -#line 8528 "sql.c" - break; - case 703: /* fill_mode ::= PREV */ -#line 1487 "sql.y" -{ yymsp[0].minor.yy882 = FILL_MODE_PREV; } -#line 8533 "sql.c" - break; - case 704: /* fill_mode ::= NULL */ -#line 1488 "sql.y" -{ yymsp[0].minor.yy882 = FILL_MODE_NULL; } -#line 8538 "sql.c" - break; - case 705: /* fill_mode ::= NULL_F */ -#line 1489 "sql.y" -{ yymsp[0].minor.yy882 = FILL_MODE_NULL_F; } -#line 8543 "sql.c" - break; - case 706: /* fill_mode ::= LINEAR */ -#line 1490 "sql.y" -{ yymsp[0].minor.yy882 = FILL_MODE_LINEAR; } -#line 8548 "sql.c" - break; - case 707: /* fill_mode ::= NEXT */ -#line 1491 "sql.y" -{ yymsp[0].minor.yy882 = FILL_MODE_NEXT; } -#line 8553 "sql.c" - break; - case 710: /* group_by_list ::= expr_or_subquery */ -#line 1500 "sql.y" -{ yylhsminor.yy316 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy416))); } -#line 8558 "sql.c" - yymsp[0].minor.yy316 = yylhsminor.yy316; - break; - case 711: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ -#line 1501 "sql.y" -{ yylhsminor.yy316 = addNodeToList(pCxt, yymsp[-2].minor.yy316, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy416))); } -#line 8564 "sql.c" - yymsp[-2].minor.yy316 = yylhsminor.yy316; - break; - case 715: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ -#line 1508 "sql.y" -{ yymsp[-5].minor.yy416 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy416), releaseRawExprNode(pCxt, yymsp[-1].minor.yy416)); } -#line 8570 "sql.c" - break; - case 716: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ -#line 1510 "sql.y" -{ yymsp[-3].minor.yy416 = createInterpTimePoint(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy416)); } -#line 8575 "sql.c" - break; - case 719: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ -#line 1517 "sql.y" + break; + case 663: /* hint_list ::= */ +{ yymsp[1].minor.yy652 = createHintNodeList(pCxt, NULL); } + break; + case 664: /* hint_list ::= NK_HINT */ +{ yylhsminor.yy652 = createHintNodeList(pCxt, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy652 = yylhsminor.yy652; + break; + case 669: /* set_quantifier_opt ::= ALL */ +{ yymsp[0].minor.yy325 = false; } + break; + case 672: /* select_item ::= NK_STAR */ +{ yylhsminor.yy54 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy54 = yylhsminor.yy54; + break; + case 674: /* select_item ::= common_expression column_alias */ + case 684: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==684); +{ yylhsminor.yy54 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy54), &yymsp[0].minor.yy837); } + yymsp[-1].minor.yy54 = yylhsminor.yy54; + break; + case 675: /* select_item ::= common_expression AS column_alias */ + case 685: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==685); +{ yylhsminor.yy54 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy54), &yymsp[0].minor.yy837); } + yymsp[-2].minor.yy54 = yylhsminor.yy54; + break; + case 680: /* partition_by_clause_opt ::= PARTITION BY partition_list */ + case 710: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==710); + case 730: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==730); +{ yymsp[-2].minor.yy652 = yymsp[0].minor.yy652; } + break; + case 687: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ +{ yymsp[-5].minor.yy54 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy54), releaseRawExprNode(pCxt, yymsp[-1].minor.yy54)); } + break; + case 688: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ +{ yymsp[-3].minor.yy54 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy54)); } + break; + case 689: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-5].minor.yy54 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy54), NULL, yymsp[-1].minor.yy54, yymsp[0].minor.yy54); } + break; + case 690: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-7].minor.yy54 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy54), releaseRawExprNode(pCxt, yymsp[-3].minor.yy54), yymsp[-1].minor.yy54, yymsp[0].minor.yy54); } + break; + case 691: /* twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ +{ yymsp[-6].minor.yy54 = createEventWindowNode(pCxt, yymsp[-3].minor.yy54, yymsp[0].minor.yy54); } + break; + case 692: /* twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy54 = createCountWindowNode(pCxt, &yymsp[-1].minor.yy0, &yymsp[-1].minor.yy0); } + break; + case 693: /* twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ +{ yymsp[-5].minor.yy54 = createCountWindowNode(pCxt, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0); } + break; + case 700: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ +{ yymsp[-3].minor.yy54 = createFillNode(pCxt, yymsp[-1].minor.yy478, NULL); } + break; + case 701: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ +{ yymsp[-5].minor.yy54 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy652)); } + break; + case 702: /* fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ +{ yymsp[-5].minor.yy54 = createFillNode(pCxt, FILL_MODE_VALUE_F, createNodeListNode(pCxt, yymsp[-1].minor.yy652)); } + break; + case 703: /* fill_mode ::= NONE */ +{ yymsp[0].minor.yy478 = FILL_MODE_NONE; } + break; + case 704: /* fill_mode ::= PREV */ +{ yymsp[0].minor.yy478 = FILL_MODE_PREV; } + break; + case 705: /* fill_mode ::= NULL */ +{ yymsp[0].minor.yy478 = FILL_MODE_NULL; } + break; + case 706: /* fill_mode ::= NULL_F */ +{ yymsp[0].minor.yy478 = FILL_MODE_NULL_F; } + break; + case 707: /* fill_mode ::= LINEAR */ +{ yymsp[0].minor.yy478 = FILL_MODE_LINEAR; } + break; + case 708: /* fill_mode ::= NEXT */ +{ yymsp[0].minor.yy478 = FILL_MODE_NEXT; } + break; + case 711: /* group_by_list ::= expr_or_subquery */ +{ yylhsminor.yy652 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy54))); } + yymsp[0].minor.yy652 = yylhsminor.yy652; + break; + case 712: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ +{ yylhsminor.yy652 = addNodeToList(pCxt, yymsp[-2].minor.yy652, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy54))); } + yymsp[-2].minor.yy652 = yylhsminor.yy652; + break; + case 716: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ +{ yymsp[-5].minor.yy54 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy54), releaseRawExprNode(pCxt, yymsp[-1].minor.yy54)); } + break; + case 717: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ +{ yymsp[-3].minor.yy54 = createInterpTimePoint(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy54)); } + break; + case 720: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ { - yylhsminor.yy416 = addOrderByClause(pCxt, yymsp[-3].minor.yy416, yymsp[-2].minor.yy316); - yylhsminor.yy416 = addSlimitClause(pCxt, yylhsminor.yy416, yymsp[-1].minor.yy416); - yylhsminor.yy416 = addLimitClause(pCxt, yylhsminor.yy416, yymsp[0].minor.yy416); + yylhsminor.yy54 = addOrderByClause(pCxt, yymsp[-3].minor.yy54, yymsp[-2].minor.yy652); + yylhsminor.yy54 = addSlimitClause(pCxt, yylhsminor.yy54, yymsp[-1].minor.yy54); + yylhsminor.yy54 = addLimitClause(pCxt, yylhsminor.yy54, yymsp[0].minor.yy54); } -#line 8584 "sql.c" - yymsp[-3].minor.yy416 = yylhsminor.yy416; - break; - case 722: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ -#line 1527 "sql.y" -{ yylhsminor.yy416 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy416, yymsp[0].minor.yy416); } -#line 8590 "sql.c" - yymsp[-3].minor.yy416 = yylhsminor.yy416; - break; - case 723: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ -#line 1529 "sql.y" -{ yylhsminor.yy416 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy416, yymsp[0].minor.yy416); } -#line 8596 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; - break; - case 732: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - case 736: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==736); -#line 1544 "sql.y" -{ yymsp[-3].minor.yy416 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } -#line 8603 "sql.c" - break; - case 733: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - case 737: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==737); -#line 1545 "sql.y" -{ yymsp[-3].minor.yy416 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } -#line 8609 "sql.c" - break; - case 738: /* subquery ::= NK_LP query_expression NK_RP */ -#line 1553 "sql.y" -{ yylhsminor.yy416 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy416); } -#line 8614 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; - break; - case 743: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ -#line 1567 "sql.y" -{ yylhsminor.yy416 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), yymsp[-1].minor.yy506, yymsp[0].minor.yy1045); } -#line 8620 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; - break; - case 744: /* ordering_specification_opt ::= */ -#line 1571 "sql.y" -{ yymsp[1].minor.yy506 = ORDER_ASC; } -#line 8626 "sql.c" - break; - case 745: /* ordering_specification_opt ::= ASC */ -#line 1572 "sql.y" -{ yymsp[0].minor.yy506 = ORDER_ASC; } -#line 8631 "sql.c" - break; - case 746: /* ordering_specification_opt ::= DESC */ -#line 1573 "sql.y" -{ yymsp[0].minor.yy506 = ORDER_DESC; } -#line 8636 "sql.c" - break; - case 747: /* null_ordering_opt ::= */ -#line 1577 "sql.y" -{ yymsp[1].minor.yy1045 = NULL_ORDER_DEFAULT; } -#line 8641 "sql.c" - break; - case 748: /* null_ordering_opt ::= NULLS FIRST */ -#line 1578 "sql.y" -{ yymsp[-1].minor.yy1045 = NULL_ORDER_FIRST; } -#line 8646 "sql.c" - break; - case 749: /* null_ordering_opt ::= NULLS LAST */ -#line 1579 "sql.y" -{ yymsp[-1].minor.yy1045 = NULL_ORDER_LAST; } -#line 8651 "sql.c" - break; - case 752: /* column_options ::= column_options ENCODE NK_STRING */ -#line 1587 "sql.y" -{ yylhsminor.yy416 = setColumnOptions(pCxt, yymsp[-2].minor.yy416, COLUMN_OPTION_ENCODE, &yymsp[0].minor.yy0); } -#line 8656 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; - break; - case 753: /* column_options ::= column_options COMPRESS NK_STRING */ -#line 1588 "sql.y" -{ yylhsminor.yy416 = setColumnOptions(pCxt, yymsp[-2].minor.yy416, COLUMN_OPTION_COMPRESS, &yymsp[0].minor.yy0); } -#line 8662 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; - break; - case 754: /* column_options ::= column_options LEVEL NK_STRING */ -#line 1589 "sql.y" -{ yylhsminor.yy416 = setColumnOptions(pCxt, yymsp[-2].minor.yy416, COLUMN_OPTION_LEVEL, &yymsp[0].minor.yy0); } -#line 8668 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; + yymsp[-3].minor.yy54 = yylhsminor.yy54; + break; + case 723: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ +{ yylhsminor.yy54 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy54, yymsp[0].minor.yy54); } + yymsp[-3].minor.yy54 = yylhsminor.yy54; + break; + case 724: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ +{ yylhsminor.yy54 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy54, yymsp[0].minor.yy54); } + yymsp[-2].minor.yy54 = yylhsminor.yy54; + break; + case 733: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + case 737: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==737); +{ yymsp[-3].minor.yy54 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } + break; + case 734: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + case 738: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==738); +{ yymsp[-3].minor.yy54 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } + break; + case 739: /* subquery ::= NK_LP query_expression NK_RP */ +{ yylhsminor.yy54 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy54); } + yymsp[-2].minor.yy54 = yylhsminor.yy54; + break; + case 744: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ +{ yylhsminor.yy54 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy54), yymsp[-1].minor.yy760, yymsp[0].minor.yy503); } + yymsp[-2].minor.yy54 = yylhsminor.yy54; + break; + case 745: /* ordering_specification_opt ::= */ +{ yymsp[1].minor.yy760 = ORDER_ASC; } + break; + case 746: /* ordering_specification_opt ::= ASC */ +{ yymsp[0].minor.yy760 = ORDER_ASC; } + break; + case 747: /* ordering_specification_opt ::= DESC */ +{ yymsp[0].minor.yy760 = ORDER_DESC; } + break; + case 748: /* null_ordering_opt ::= */ +{ yymsp[1].minor.yy503 = NULL_ORDER_DEFAULT; } + break; + case 749: /* null_ordering_opt ::= NULLS FIRST */ +{ yymsp[-1].minor.yy503 = NULL_ORDER_FIRST; } + break; + case 750: /* null_ordering_opt ::= NULLS LAST */ +{ yymsp[-1].minor.yy503 = NULL_ORDER_LAST; } + break; + case 753: /* column_options ::= column_options ENCODE NK_STRING */ +{ yylhsminor.yy54 = setColumnOptions(pCxt, yymsp[-2].minor.yy54, COLUMN_OPTION_ENCODE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy54 = yylhsminor.yy54; + break; + case 754: /* column_options ::= column_options COMPRESS NK_STRING */ +{ yylhsminor.yy54 = setColumnOptions(pCxt, yymsp[-2].minor.yy54, COLUMN_OPTION_COMPRESS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy54 = yylhsminor.yy54; + break; + case 755: /* column_options ::= column_options LEVEL NK_STRING */ +{ yylhsminor.yy54 = setColumnOptions(pCxt, yymsp[-2].minor.yy54, COLUMN_OPTION_LEVEL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy54 = yylhsminor.yy54; break; default: break; @@ -8728,7 +7730,6 @@ static void yy_syntax_error( ParseCTX_FETCH #define TOKEN yyminor /************ Begin %syntax_error code ****************************************/ -#line 29 "sql.y" if (TSDB_CODE_SUCCESS == pCxt->errCode) { if(TOKEN.z) { @@ -8739,7 +7740,6 @@ static void yy_syntax_error( } else if (TSDB_CODE_PAR_DB_NOT_SPECIFIED == pCxt->errCode && TK_NK_FLOAT == TOKEN.type) { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_SYNTAX_ERROR, TOKEN.z); } -#line 8742 "sql.c" /************ End %syntax_error code ******************************************/ ParseARG_STORE /* Suppress warning about unused %extra_argument variable */ ParseCTX_STORE diff --git a/source/libs/stream/inc/streamBackendRocksdb.h b/source/libs/stream/inc/streamBackendRocksdb.h index df513f43b390..c965d620f45f 100644 --- a/source/libs/stream/inc/streamBackendRocksdb.h +++ b/source/libs/stream/inc/streamBackendRocksdb.h @@ -211,6 +211,8 @@ SStreamStateCur* streamStateFillSeekToLast_rocksdb(SStreamState* pState); // partag cf int32_t streamStatePutParTag_rocksdb(SStreamState* pState, int64_t groupId, const void* tag, int32_t tagLen); int32_t streamStateGetParTag_rocksdb(SStreamState* pState, int64_t groupId, void** tagVal, int32_t* tagLen); +void streamStateParTagSeekKeyNext_rocksdb(SStreamState* pState, const int64_t groupId, SStreamStateCur* pCur); +int32_t streamStateParTagGetKVByCur_rocksdb(SStreamStateCur* pCur, int64_t* pGroupId, const void** pVal, int32_t* pVLen); // parname cf int32_t streamStatePutParName_rocksdb(SStreamState* pState, int64_t groupId, const char tbname[TSDB_TABLE_NAME_LEN]); diff --git a/source/libs/stream/src/streamBackendRocksdb.c b/source/libs/stream/src/streamBackendRocksdb.c index 7e7240d0efa5..043bd2e59802 100644 --- a/source/libs/stream/src/streamBackendRocksdb.c +++ b/source/libs/stream/src/streamBackendRocksdb.c @@ -4166,7 +4166,6 @@ int32_t streamStateStateAddIfNotExist_rocksdb(SStreamState* pState, SSessionKey* return res; } -#ifdef BUILD_NO_CALL // partag cf int32_t streamStatePutParTag_rocksdb(SStreamState* pState, int64_t groupId, const void* tag, int32_t tagLen) { int code = 0; @@ -4174,6 +4173,60 @@ int32_t streamStatePutParTag_rocksdb(SStreamState* pState, int64_t groupId, cons return code; } +void streamStateParTagSeekKeyNext_rocksdb(SStreamState* pState, const int64_t groupId, SStreamStateCur* pCur) { + if (pCur == NULL) { + return ; + } + STaskDbWrapper* wrapper = pState->pTdbState->pOwner->pBackend; + pCur->number = pState->number; + pCur->db = wrapper->db; + pCur->iter = streamStateIterCreate(pState, "partag", (rocksdb_snapshot_t**)&pCur->snapshot, + (rocksdb_readoptions_t**)&pCur->readOpt); + int i = streamStateGetCfIdx(pState, "partag"); + if (i < 0) { + stError("streamState failed to put to cf name:%s", "partag"); + return ; + } + + char buf[128] = {0}; + int32_t klen = ginitDict[i].enFunc((void*)&groupId, buf); + if (!streamStateIterSeekAndValid(pCur->iter, buf, klen)) { + streamStateFreeCur(pCur); + return ; + } + // skip ttl expired data + while (rocksdb_iter_valid(pCur->iter) && iterValueIsStale(pCur->iter)) { + rocksdb_iter_next(pCur->iter); + } +} + +int32_t streamStateParTagGetKVByCur_rocksdb(SStreamStateCur* pCur, int64_t* pGroupId, const void** pVal, int32_t* pVLen) { + stDebug("streamStateFillGetKVByCur_rocksdb"); + if (!pCur) { + return -1; + } + SWinKey winKey; + if (!rocksdb_iter_valid(pCur->iter) || iterValueIsStale(pCur->iter)) { + return -1; + } + + size_t klen, vlen; + char* keyStr = (char*)rocksdb_iter_key(pCur->iter, &klen); + (void)parKeyDecode(pGroupId, keyStr); + + if (pVal) { + const char* valStr = rocksdb_iter_value(pCur->iter, &vlen); + int32_t len = valueDecode((void*)valStr, vlen, NULL, (char**)pVal); + if (len < 0) { + return -1; + } + if (pVLen != NULL) *pVLen = len; + } + + return 0; +} + +#ifdef BUILD_NO_CALL int32_t streamStateGetParTag_rocksdb(SStreamState* pState, int64_t groupId, void** tagVal, int32_t* tagLen) { int code = 0; STREAM_STATE_GET_ROCKSDB(pState, "partag", &groupId, tagVal, tagLen); diff --git a/source/libs/stream/src/streamSessionState.c b/source/libs/stream/src/streamSessionState.c index 0d2303ba6545..1a545176be46 100644 --- a/source/libs/stream/src/streamSessionState.c +++ b/source/libs/stream/src/streamSessionState.c @@ -73,7 +73,7 @@ bool inSessionWindow(SSessionKey* pKey, TSKEY ts, int64_t gap) { return false; } -SStreamStateCur* createSessionStateCursor(SStreamFileState* pFileState) { +SStreamStateCur* createStateCursor(SStreamFileState* pFileState) { SStreamStateCur* pCur = createStreamStateCursor(); pCur->pStreamFileState = pFileState; return pCur; @@ -527,7 +527,7 @@ static SStreamStateCur* seekKeyCurrentPrev_buff(SStreamFileState* pFileState, co } if (index >= 0) { - pCur = createSessionStateCursor(pFileState); + pCur = createStateCursor(pFileState); pCur->buffIndex = index; if (pIndex) { *pIndex = index; @@ -568,7 +568,7 @@ static void checkAndTransformCursor(SStreamFileState* pFileState, const uint64_t if (taosArrayGetSize(pWinStates) > 0 && (code == TSDB_CODE_FAILED || sessionStateKeyCompare(&key, pWinStates, 0) >= 0)) { if (!(*ppCur)) { - (*ppCur) = createSessionStateCursor(pFileState); + (*ppCur) = createStateCursor(pFileState); } transformCursor(pFileState, *ppCur); } else if (*ppCur) { @@ -628,7 +628,7 @@ SStreamStateCur* countWinStateSeekKeyPrev(SStreamFileState* pFileState, const SS } pBuffCur->buffIndex = 0; } else if (taosArrayGetSize(pWinStates) > 0) { - pBuffCur = createSessionStateCursor(pFileState); + pBuffCur = createStateCursor(pFileState); pBuffCur->buffIndex = 0; } diff --git a/source/libs/stream/src/streamSliceState.c b/source/libs/stream/src/streamSliceState.c index 5dfc6e03e183..ea5e35e2454d 100644 --- a/source/libs/stream/src/streamSliceState.c +++ b/source/libs/stream/src/streamSliceState.c @@ -32,7 +32,7 @@ int32_t getHashSortRowBuff(SStreamFileState* pFileState, const SWinKey* pKey, vo int32_t code = TSDB_CODE_SUCCESS; int32_t lino = 0; - code = getRowBuff(pFileState, (void*)pKey, sizeof(SWinKey), pVal, pVLen, pWinCode); + code = addRowBuffIfNotExist(pFileState, (void*)pKey, sizeof(SWinKey), pVal, pVLen, pWinCode); QUERY_CHECK_CODE(code, lino, _end); SArray* pWinStates = NULL; diff --git a/source/libs/stream/src/streamState.c b/source/libs/stream/src/streamState.c index 7706a6507f2c..ed4c639aaaf2 100644 --- a/source/libs/stream/src/streamState.c +++ b/source/libs/stream/src/streamState.c @@ -128,10 +128,8 @@ SStreamState* streamStateOpen(const char* path, void* pTask, int64_t streamId, i pState->pFileState = NULL; _hash_fn_t hashFn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT); pState->parNameMap = tSimpleHashInit(1024, hashFn); - if (!pState->parNameMap) { - code = TSDB_CODE_OUT_OF_MEMORY; - QUERY_CHECK_CODE(code, lino, _end); - } + QUERY_CHECK_NULL(pState->parNameMap, code, lino, _end, terrno); + stInfo("open state %p on backend %p 0x%" PRIx64 "-%d succ", pState, pMeta->streamBackend, pState->streamId, pState->taskId); return pState; @@ -201,14 +199,10 @@ int32_t streamStateFuncGet(SStreamState* pState, const SWinKey* key, void** ppVa return code; } -// todo refactor -int32_t streamStatePut(SStreamState* pState, const SWinKey* key, const void* value, int32_t vLen) { - return 0; - // return streamStatePut_rocksdb(pState, key, value, vLen); -} +int32_t streamStatePut(SStreamState* pState, const SWinKey* key, const void* value, int32_t vLen) { return 0; } int32_t streamStateGet(SStreamState* pState, const SWinKey* key, void** pVal, int32_t* pVLen, int32_t* pWinCode) { - return getRowBuff(pState->pFileState, (void*)key, sizeof(SWinKey), pVal, pVLen, pWinCode); + return addRowBuffIfNotExist(pState->pFileState, (void*)key, sizeof(SWinKey), pVal, pVLen, pWinCode); } bool streamStateCheck(SStreamState* pState, const SWinKey* key) { @@ -221,33 +215,36 @@ int32_t streamStateGetByPos(SStreamState* pState, void* pos, void** pVal) { return code; } -// todo refactor void streamStateDel(SStreamState* pState, const SWinKey* key) { deleteRowBuff(pState->pFileState, key, sizeof(SWinKey)); } -// todo refactor int32_t streamStateFillPut(SStreamState* pState, const SWinKey* key, const void* value, int32_t vLen) { return streamStateFillPut_rocksdb(pState, key, value, vLen); } -// todo refactor int32_t streamStateFillGet(SStreamState* pState, const SWinKey* key, void** pVal, int32_t* pVLen, int32_t* pWinCode) { if (pState->pFileState) { - return getHashSortRowBuff(pState->pFileState, key, pVal, pVLen, pWinCode); + return getRowBuff(pState->pFileState, (void*)key, sizeof(SWinKey), pVal, pVLen, pWinCode); } return streamStateFillGet_rocksdb(pState, key, pVal, pVLen); } -int32_t streamStateFillGetNext(SStreamState* pState, const SWinKey* pKey, SWinKey* pResKey, void** pVal, int32_t* pVLen, int32_t* pWinCode) { - return getHashSortNextRow(pState->pFileState, pKey, pResKey, pVal, pVLen, pWinCode); +int32_t streamStateFillAddIfNotExist(SStreamState* pState, const SWinKey* key, void** pVal, int32_t* pVLen, + int32_t* pWinCode) { + return getHashSortRowBuff(pState->pFileState, key, pVal, pVLen, pWinCode); +} + +int32_t streamStateFillGetNext(SStreamState* pState, const SWinKey* pKey, SWinKey* pResKey, void** pVal, int32_t* pVLen, + int32_t* pWinCode) { + return getHashSortNextRow(pState->pFileState, pKey, pResKey, pVal, pVLen, pWinCode); } -int32_t streamStateFillGetPrev(SStreamState* pState, const SWinKey* pKey, SWinKey* pResKey, void** pVal, int32_t* pVLen, int32_t* pWinCode) { +int32_t streamStateFillGetPrev(SStreamState* pState, const SWinKey* pKey, SWinKey* pResKey, void** pVal, int32_t* pVLen, + int32_t* pWinCode) { return getHashSortPrevRow(pState->pFileState, pKey, pResKey, pVal, pVLen, pWinCode); } -// todo refactor void streamStateFillDel(SStreamState* pState, const SWinKey* key) { if (pState->pFileState) { deleteHashSortRowBuff(pState->pFileState, key); @@ -295,7 +292,6 @@ int32_t streamStateAddIfNotExist(SStreamState* pState, const SWinKey* key, void* } void streamStateReleaseBuf(SStreamState* pState, void* pVal, bool used) { - // todo refactor if (!pVal) { return; } @@ -458,7 +454,6 @@ int32_t streamStateSessionAddIfNotExist(SStreamState* pState, SSessionKey* key, int32_t streamStateStateAddIfNotExist(SStreamState* pState, SSessionKey* key, char* pKeyData, int32_t keyDataLen, state_key_cmpr_fn fn, void** pVal, int32_t* pVLen, int32_t* pWinCode) { - // todo refactor return getStateWinResultBuff(pState->pFileState, key, pKeyData, keyDataLen, fn, pVal, pVLen, pWinCode); } @@ -556,3 +551,25 @@ int32_t streamStateCountWinAddIfNotExist(SStreamState* pState, SSessionKey* pKey int32_t streamStateCountWinAdd(SStreamState* pState, SSessionKey* pKey, void** pVal, int32_t* pVLen) { return createCountWinResultBuff(pState->pFileState, pKey, pVal, pVLen); } + +int32_t streamStateGroupPut(SStreamState* pState, int64_t groupId, void* value, int32_t vLen) { + return streamFileStateGroupPut(pState->pFileState, groupId, value, vLen); +} + +SStreamStateCur* streamStateGroupGetCur(SStreamState* pState) { + SStreamStateCur* pCur = createStateCursor(pState->pFileState); + pCur->hashIter = 0; + pCur->pHashData = NULL; + return pCur; +} + +void streamStateGroupCurNext(SStreamStateCur* pCur) { + streamFileStateGroupCurNext(pCur); +} + +int32_t streamStateGroupGetKVByCur(SStreamStateCur* pCur, int64_t* pKey, void** pVal, int32_t* pVLen) { + if (pVal != NULL) { + return -1; + } + return streamFileStateGroupGetKVByCur(pCur, pKey, pVal, pVLen); +} diff --git a/source/libs/stream/src/tstreamFileState.c b/source/libs/stream/src/tstreamFileState.c index ca0623c47eea..80998ca08710 100644 --- a/source/libs/stream/src/tstreamFileState.c +++ b/source/libs/stream/src/tstreamFileState.c @@ -29,29 +29,31 @@ #define MIN_NUM_OF_RECOVER_ROW_BUFF 128 #define MIN_NUM_SEARCH_BUCKET 128 #define MAX_ARRAY_SIZE 1024 +#define MAX_GROUP_ID_NUM 200000 #define TASK_KEY "streamFileState" #define STREAM_STATE_INFO_NAME "StreamStateCheckPoint" struct SStreamFileState { - SList* usedBuffs; - SList* freeBuffs; - void* rowStateBuff; - void* pFileStore; - int32_t rowSize; - int32_t selectivityRowSize; - int32_t keyLen; - uint64_t preCheckPointVersion; - uint64_t checkPointVersion; - TSKEY maxTs; - TSKEY deleteMark; - TSKEY flushMark; - uint64_t maxRowCount; - uint64_t curRowCount; - GetTsFun getTs; - char* id; - char* cfName; - void* searchBuff; + SList* usedBuffs; + SList* freeBuffs; + void* rowStateBuff; + void* pFileStore; + int32_t rowSize; + int32_t selectivityRowSize; + int32_t keyLen; + uint64_t preCheckPointVersion; + uint64_t checkPointVersion; + TSKEY maxTs; + TSKEY deleteMark; + TSKEY flushMark; + uint64_t maxRowCount; + uint64_t curRowCount; + GetTsFun getTs; + char* id; + char* cfName; + void* searchBuff; + SSHashObj* pGroupIdMap; _state_buff_cleanup_fn stateBuffCleanupFn; _state_buff_remove_fn stateBuffRemoveFn; @@ -134,17 +136,19 @@ static void streamFileStateEncode(TSKEY* pKey, void** pVal, int32_t* pLen) { SStreamFileState* streamFileStateInit(int64_t memSize, uint32_t keySize, uint32_t rowSize, uint32_t selectRowSize, GetTsFun fp, void* pFile, TSKEY delMark, const char* taskId, int64_t checkpointId, int8_t type) { + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; if (memSize <= 0) { memSize = DEFAULT_MAX_STREAM_BUFFER_SIZE; } if (rowSize == 0) { - goto _error; + code = TSDB_CODE_INVALID_PARA; + QUERY_CHECK_CODE(code, lino, _end); } SStreamFileState* pFileState = taosMemoryCalloc(1, sizeof(SStreamFileState)); - if (!pFileState) { - goto _error; - } + QUERY_CHECK_NULL(pFileState, code, lino, _end, terrno); + rowSize += selectRowSize; pFileState->maxRowCount = TMAX((uint64_t)memSize / rowSize, FLUSH_NUM * 2); pFileState->usedBuffs = tdListNew(POINTER_BYTES); @@ -161,7 +165,7 @@ SStreamFileState* streamFileStateInit(int64_t memSize, uint32_t keySize, uint32_ pFileState->stateFileRemoveFn = intervalFileRemoveFn; pFileState->stateFileGetFn = intervalFileGetFn; pFileState->cfName = taosStrdup("state"); - pFileState->stateFunctionGetFn = getRowBuff; + pFileState->stateFunctionGetFn = addRowBuffIfNotExist; } else if (type == STREAM_STATE_BUFF_SORT) { pFileState->rowStateBuff = tSimpleHashInit(cap, hashFn); pFileState->stateBuffCleanupFn = sessionWinStateCleanup; @@ -176,6 +180,7 @@ SStreamFileState* streamFileStateInit(int64_t memSize, uint32_t keySize, uint32_ } else if (type == STREAM_STATE_BUFF_HASH_SORT) { pFileState->rowStateBuff = tSimpleHashInit(cap, hashFn); pFileState->searchBuff = tSimpleHashInit(MIN_NUM_SEARCH_BUCKET, hashFn); + QUERY_CHECK_NULL(pFileState->searchBuff, code, lino, _end, terrno); pFileState->stateBuffCleanupFn = stateHashBuffCleanupFn; pFileState->stateBuffRemoveFn = stateHashBuffRemoveFn; pFileState->stateBuffRemoveByPosFn = stateHashBuffRemoveByPosFn; @@ -187,9 +192,10 @@ SStreamFileState* streamFileStateInit(int64_t memSize, uint32_t keySize, uint32_ pFileState->stateFunctionGetFn = NULL; } - if (!pFileState->usedBuffs || !pFileState->freeBuffs || !pFileState->rowStateBuff) { - goto _error; - } + QUERY_CHECK_NULL(pFileState->usedBuffs, code, lino, _end, terrno); + QUERY_CHECK_NULL(pFileState->freeBuffs, code, lino, _end, terrno); + QUERY_CHECK_NULL(pFileState->rowStateBuff, code, lino, _end, terrno); + QUERY_CHECK_NULL(pFileState->cfName, code, lino, _end, terrno); pFileState->keyLen = keySize; pFileState->rowSize = rowSize; @@ -203,6 +209,10 @@ SStreamFileState* streamFileStateInit(int64_t memSize, uint32_t keySize, uint32_ pFileState->flushMark = INT64_MIN; pFileState->maxTs = INT64_MIN; pFileState->id = taosStrdup(taskId); + QUERY_CHECK_NULL(pFileState->id, code, lino, _end, terrno); + + pFileState->pGroupIdMap = tSimpleHashInit(1024, hashFn); + QUERY_CHECK_NULL(pFileState->pGroupIdMap, code, lino, _end, terrno); // todo(liuyao) optimize if (type == STREAM_STATE_BUFF_HASH) { @@ -215,18 +225,21 @@ SStreamFileState* streamFileStateInit(int64_t memSize, uint32_t keySize, uint32_ void* valBuf = NULL; int32_t len = 0; - int32_t code = streamDefaultGet_rocksdb(pFileState->pFileStore, STREAM_STATE_INFO_NAME, &valBuf, &len); - if (code == TSDB_CODE_SUCCESS) { + int32_t tmpRes = streamDefaultGet_rocksdb(pFileState->pFileStore, STREAM_STATE_INFO_NAME, &valBuf, &len); + if (tmpRes == TSDB_CODE_SUCCESS) { ASSERT(len == sizeof(TSKEY)); streamFileStateDecode(&pFileState->flushMark, valBuf, len); qDebug("===stream===flushMark read:%" PRId64, pFileState->flushMark); } taosMemoryFreeClear(valBuf); - return pFileState; -_error: - streamFileStateDestroy(pFileState); - return NULL; +_end: + if (code != TSDB_CODE_SUCCESS) { + qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + streamFileStateDestroy(pFileState); + pFileState = NULL; + } + return pFileState; } void destroyRowBuffPos(SRowBuffPos* pPos) { @@ -332,11 +345,11 @@ int32_t clearFlushedRowBuff(SStreamFileState* pFileState, SStreamSnapshot* pFlus if (all || !pPos->beUsed) { if (all && !pPos->pRowBuff) { continue; - } + } code = tdListAppend(pFlushList, &pPos); QUERY_CHECK_CODE(code, lino, _end); - pFileState->flushMark = TMAX(pFileState->flushMark, pFileState->getTs(pPos->pKey)); + pFileState->flushMark = TMAX(pFileState->flushMark, pFileState->getTs(pPos->pKey)); pFileState->stateBuffRemoveByPosFn(pFileState, pPos); SListNode* tmp = tdListPopNode(pFileState->usedBuffs, pNode); taosMemoryFreeClear(tmp); @@ -429,7 +442,6 @@ int32_t flushRowBuff(SStreamFileState* pFileState) { if (pFileState->searchBuff) { clearFlushedRowBuff(pFileState, pFlushList, pFileState->curRowCount, true); } - flushSnapshot(pFileState, pFlushList, false); @@ -548,8 +560,8 @@ SRowBuffPos* getNewRowPosForWrite(SStreamFileState* pFileState) { return NULL; } -int32_t getRowBuff(SStreamFileState* pFileState, void* pKey, int32_t keyLen, void** pVal, int32_t* pVLen, - int32_t* pWinCode) { +int32_t addRowBuffIfNotExist(SStreamFileState* pFileState, void* pKey, int32_t keyLen, void** pVal, int32_t* pVLen, + int32_t* pWinCode) { int32_t code = TSDB_CODE_SUCCESS; int32_t lino = 0; (*pWinCode) = TSDB_CODE_SUCCESS; @@ -938,7 +950,7 @@ bool isDeteled(SStreamFileState* pFileState, TSKEY ts) { bool isFlushedState(SStreamFileState* pFileState, TSKEY ts, TSKEY gap) { return ts <= (pFileState->flushMark + gap); } -TSKEY getFlushMark(SStreamFileState* pFileState) {return pFileState->flushMark;}; +TSKEY getFlushMark(SStreamFileState* pFileState) { return pFileState->flushMark; }; int32_t getRowStateRowSize(SStreamFileState* pFileState) { return pFileState->rowSize; } @@ -970,7 +982,7 @@ int32_t recoverFillSnapshot(SStreamFileState* pFileState, int64_t ckId) { int32_t vlen = 0; SRowBuffPos* pNewPos = getNewRowPosForWrite(pFileState); code = streamStateFillGetKVByCur_rocksdb(pCur, pNewPos->pKey, (const void**)&pVal, &vlen); - if (code != TSDB_CODE_SUCCESS || isFlushedState(pFileState, pFileState->getTs(pNewPos->pKey), 0) ) { + if (code != TSDB_CODE_SUCCESS || isFlushedState(pFileState, pFileState->getTs(pNewPos->pKey), 0)) { destroyRowBuffPos(pNewPos); SListNode* pNode = tdListPopTail(pFileState->usedBuffs); taosMemoryFreeClear(pNode); @@ -992,3 +1004,99 @@ int32_t recoverFillSnapshot(SStreamFileState* pFileState, int64_t ckId) { return TSDB_CODE_SUCCESS; } + +int32_t getRowBuff(SStreamFileState* pFileState, void* pKey, int32_t keyLen, void** pVal, int32_t* pVLen, + int32_t* pWinCode) { + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; + (*pWinCode) = TSDB_CODE_FAILED; + pFileState->maxTs = TMAX(pFileState->maxTs, pFileState->getTs(pKey)); + SRowBuffPos** pos = tSimpleHashGet(pFileState->rowStateBuff, pKey, keyLen); + if (pos) { + *pVLen = pFileState->rowSize; + *pVal = *pos; + (*pos)->beUsed = true; + (*pos)->beFlushed = false; + (*pWinCode) = TSDB_CODE_SUCCESS; + } + TSKEY ts = pFileState->getTs(pKey); + if (!isDeteled(pFileState, ts) && isFlushedState(pFileState, ts, 0)) { + int32_t len = 0; + void* p = NULL; + (*pWinCode) = pFileState->stateFileGetFn(pFileState, pKey, &p, &len); + qDebug("===stream===get %" PRId64 " from disc, res %d", ts, (*pWinCode)); + if ((*pWinCode) == TSDB_CODE_SUCCESS) { + SRowBuffPos* pNewPos = getNewRowPosForWrite(pFileState); + if (!pNewPos || !pNewPos->pRowBuff) { + code = TSDB_CODE_OUT_OF_MEMORY; + QUERY_CHECK_CODE(code, lino, _end); + } + + memcpy(pNewPos->pKey, pKey, keyLen); + memcpy(pNewPos->pRowBuff, p, len); + code = tSimpleHashPut(pFileState->rowStateBuff, pKey, keyLen, &pNewPos, POINTER_BYTES); + QUERY_CHECK_CODE(code, lino, _end); + + if (pVal) { + *pVLen = pFileState->rowSize; + *pVal = pNewPos; + } + } + taosMemoryFree(p); + } + +_end: + if (code != TSDB_CODE_SUCCESS) { + qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } + return code; +} + +int32_t streamFileStateGroupPut(SStreamFileState* pFileState, int64_t groupId, void* value, int32_t vLen) { + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; + if (value != NULL) { + code = TSDB_CODE_INVALID_PARA; + QUERY_CHECK_CODE(code, lino, _end); + } + + if (tSimpleHashGet(pFileState->pGroupIdMap, &groupId, sizeof(int64_t)) == NULL) { + if (tSimpleHashGetSize(pFileState->pGroupIdMap) <= MAX_GROUP_ID_NUM) { + code = tSimpleHashPut(pFileState->pGroupIdMap, &groupId, sizeof(int64_t), NULL, 0); + QUERY_CHECK_CODE(code, lino, _end); + } + code = streamStatePutParTag_rocksdb(pFileState->pFileStore, groupId, value, vLen); + QUERY_CHECK_CODE(code, lino, _end); + } + +_end: + if (code != TSDB_CODE_SUCCESS) { + qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } + return code; +} + +void streamFileStateGroupCurNext(SStreamStateCur* pCur) { + SStreamFileState* pFileState = (SStreamFileState*)pCur->pStreamFileState; + if (pCur->hashIter == -1) { + streamStateCurNext(pFileState->pFileStore, pCur); + } + + SSHashObj* pHash = pFileState->pGroupIdMap; + pCur->pHashData = tSimpleHashIterate(pHash, pCur->pHashData, &pCur->hashIter); + if (!pCur->pHashData) { + pCur->hashIter = -1; + streamStateParTagSeekKeyNext_rocksdb(pFileState->pFileStore, pCur->minGpId, pCur); + } + int64_t gpId = *(int64_t*)tSimpleHashGetKey(pCur->pHashData, NULL); + pCur->minGpId = TMIN(pCur->minGpId, gpId); +} + +int32_t streamFileStateGroupGetKVByCur(SStreamStateCur* pCur, int64_t* pKey, void** pVal, int32_t* pVLen) { + int32_t code = TSDB_CODE_SUCCESS; + if (pCur->pHashData) { + *pKey = *(int64_t*)tSimpleHashGetKey(pCur->pHashData, NULL); + return code; + } + return streamStateParTagGetKVByCur_rocksdb(pCur, pKey, NULL, NULL); +} diff --git a/tests/script/tsim/stream/checkpointSession1.sim b/tests/script/tsim/stream/checkpointSession1.sim index 0427585122c8..5ad7ef0b9611 100644 --- a/tests/script/tsim/stream/checkpointSession1.sim +++ b/tests/script/tsim/stream/checkpointSession1.sim @@ -62,6 +62,8 @@ system sh/exec.sh -n dnode1 -s start sleep 2000 +run tsim/stream/checkTaskStatus.sim + sql insert into t1 values(1648791213002,3,2,3,1.1); sql insert into t2 values(1648791233003,4,2,3,1.1); From c7f94400958019ed767730aef7a69e08be8d63ef Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Tue, 6 Aug 2024 16:25:37 +0800 Subject: [PATCH 020/695] adj function --- source/libs/executor/src/streamtimesliceoperator.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/source/libs/executor/src/streamtimesliceoperator.c b/source/libs/executor/src/streamtimesliceoperator.c index 98991a850af0..f0e2424d39d1 100644 --- a/source/libs/executor/src/streamtimesliceoperator.c +++ b/source/libs/executor/src/streamtimesliceoperator.c @@ -1547,13 +1547,19 @@ int32_t createStreamTimeSliceOperatorInfo(SOperatorInfo* downstream, SPhysiNode* initResultSizeInfo(&pOperator->resultInfo, 4096); SExprSupp* pExpSup = &pOperator->exprSupp; int32_t numOfExprs = 0; - SExprInfo* pExprInfo = createExprInfo(pInterpPhyNode->pFuncs, NULL, &numOfExprs); + SExprInfo* pExprInfo = NULL; + code = createExprInfo(pInterpPhyNode->pFuncs, NULL, &pExprInfo, &numOfExprs); + QUERY_CHECK_CODE(code, lino, _error); + code = initExprSupp(pExpSup, pExprInfo, numOfExprs, &pTaskInfo->storageAPI.functionStore); QUERY_CHECK_CODE(code, lino, _error); if (pInterpPhyNode->pExprs != NULL) { int32_t num = 0; - SExprInfo* pScalarExprInfo = createExprInfo(pInterpPhyNode->pExprs, NULL, &num); + SExprInfo* pScalarExprInfo = NULL; + code = createExprInfo(pInterpPhyNode->pExprs, NULL, &pScalarExprInfo, &num); + QUERY_CHECK_CODE(code, lino, _error); + code = initExprSupp(&pInfo->scalarSup, pScalarExprInfo, num, &pTaskInfo->storageAPI.functionStore); QUERY_CHECK_CODE(code, lino, _error); } From 9cc20ba687c9b6eb719234115db007202cc1fea6 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Tue, 6 Aug 2024 17:42:44 +0800 Subject: [PATCH 021/695] add ci --- source/libs/stream/src/tstreamFileState.c | 1 + .../tsim/stream/streamInterpLinear0.sim | 291 ++++++++++++++++++ .../script/tsim/stream/streamInterpNext0.sim | 117 +++++++ .../script/tsim/stream/streamInterpPrev0.sim | 117 +++++++ .../script/tsim/stream/streamInterpValue0.sim | 223 +++++++++++++- 5 files changed, 747 insertions(+), 2 deletions(-) diff --git a/source/libs/stream/src/tstreamFileState.c b/source/libs/stream/src/tstreamFileState.c index 80998ca08710..522f911f6452 100644 --- a/source/libs/stream/src/tstreamFileState.c +++ b/source/libs/stream/src/tstreamFileState.c @@ -284,6 +284,7 @@ void streamFileStateDestroy(SStreamFileState* pFileState) { tdListFreeP(pFileState->freeBuffs, destroyRowBuff); pFileState->stateBuffCleanupFn(pFileState->rowStateBuff); sessionWinStateCleanup(pFileState->searchBuff); + tSimpleHashCleanup(pFileState->pGroupIdMap); taosMemoryFree(pFileState); } diff --git a/tests/script/tsim/stream/streamInterpLinear0.sim b/tests/script/tsim/stream/streamInterpLinear0.sim index 95ae69b7368b..7d4b28d545a1 100644 --- a/tests/script/tsim/stream/streamInterpLinear0.sim +++ b/tests/script/tsim/stream/streamInterpLinear0.sim @@ -212,5 +212,296 @@ if $data41 != 13 then goto loop3 endi + +print step2 + +sql create database test2 vgroups 1; +sql use test2; + +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2 as select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 every(1s) fill(linear); + +run tsim/stream/checkTaskStatus.sim + + +sql insert into t1 values(1648791212000,0,0,0,0.0) (1648791213001,11,11,11,11.0) (1648791213009,22,22,22,2.1) (1648791215001,15,15,15,15.1) (1648791217001,34,34,34,34.1); + + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(linear); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(linear); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 +loop4: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 1 sql select * from streamt2; +sql select * from streamt2; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +# row 0 +if $rows != 6 then + print ======rows=$rows + goto loop4 +endi + +# row 0 +if $data01 != 0 then + print ======data01=$data01 + goto loop4 +endi + +if $data11 != 10 then + print ======data11=$data11 + goto loop4 +endi + +if $data21 != 18 then + print ======data21=$data21 + goto loop4 +endi + +if $data31 != 15 then + print ======data31=$data31 + goto loop4 +endi + +if $data41 != 24 then + print ======data41=$data41 + goto loop4 +endi + +if $data51 != 33 then + print ======data51=$data51 + goto loop4 +endi + + +print step2_1 + +sql create database test2_1 vgroups 1; +sql use test2_1; + +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stream streams2_1 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_1 as select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 every(1s) fill(linear); + +run tsim/stream/checkTaskStatus.sim + + +sql insert into t1 values(1648791212011,0,0,0,0.0) (1648791212099,20,20,20,20.0) (1648791213011,11,11,11,11.0) (1648791214099,35,35,35,35.1) (1648791215011,10,10,10,10.1) (1648791218099,34,34,34,34.1) (1648791219011,5,5,5,5.1); + + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791219011) every(1s) fill(linear); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791219011) every(1s) fill(linear); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 +print $data60 $data61 $data62 $data63 $data64 +print $data70 $data71 $data72 $data73 $data74 + +$loop_count = 0 +loop4_1: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 1 sql select * from streamt2_1; +sql select * from streamt2_1; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 +print $data60 $data61 $data62 $data63 $data64 +print $data70 $data71 $data72 $data73 $data74 + + +# row 0 +if $rows != 7 then + print ======rows=$rows + goto loop4_1 +endi + +# row 0 +if $data01 != 11 then + print ======data01=$data01 + goto loop4_1 +endi + +if $data11 != 32 then + print ======data11=$data11 + goto loop4_1 +endi + +if $data21 != 10 then + print ======data21=$data21 + goto loop4_1 +endi + +if $data31 != 17 then + print ======data31=$data31 + goto loop4_1 +endi + +if $data41 != 25 then + print ======data41=$data41 + goto loop4_1 +endi + +if $data51 != 33 then + print ======data51=$data51 + goto loop4_1 +endi + +if $data61 != 5 then + print ======data51=$data51 + goto loop4_1 +endi + + +print step3 +sql create database test3 vgroups 1; +sql use test3; + +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stream streams3 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt3 as select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 every(1s) fill(linear); + +run tsim/stream/checkTaskStatus.sim + + +sql insert into t1 values(1648791212001,0,0,0,0.0) (1648791217001,8,4,4,4.1); + + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217000) every(1s) fill(linear); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217000) every(1s) fill(linear); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 +loop5: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 1 sql select * from streamt3; +sql select * from streamt3; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +# row 0 +if $rows != 5 then + print ======rows=$rows + goto loop5 +endi + +sql insert into t1 values(1648791213001,11,11,11,11.0) (1648791213009,22,22,22,22.1) (1648791215001,15,15,15,15.1) + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(linear); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(linear); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 +loop6: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 2 sql select * from streamt3; +sql select * from streamt3; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +# row 0 +if $rows != 5 then + print ======rows=$rows + goto loop6 +endi + +# row 0 +if $data01 != 10 then + print ======data01=$data01 + goto loop6 +endi + +if $data11 != 18 then + print ======data11=$data11 + goto loop6 +endi + +if $data21 != 15 then + print ======data21=$data21 + goto loop6 +endi + +if $data31 != 11 then + print ======data31=$data31 + goto loop6 +endi + +if $data41 != 8 then + print ======data41=$data41 + goto loop6 +endi + print end system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/stream/streamInterpNext0.sim b/tests/script/tsim/stream/streamInterpNext0.sim index 6e36b106e30e..da76354e073e 100644 --- a/tests/script/tsim/stream/streamInterpNext0.sim +++ b/tests/script/tsim/stream/streamInterpNext0.sim @@ -294,5 +294,122 @@ if $data51 != 4 then goto loop4 endi + + +print step3 +sql create database test3 vgroups 1; +sql use test3; + +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stream streams3 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt3 as select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 every(1s) fill(next); + +run tsim/stream/checkTaskStatus.sim + + +sql insert into t1 values(1648791212001,0,0,0,0.0) (1648791217001,4,4,4,4.1); + + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217000) every(1s) fill(next); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217000) every(1s) fill(next); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 +loop5: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 1 sql select * from streamt3; +sql select * from streamt3; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +# row 0 +if $rows != 5 then + print ======rows=$rows + goto loop5 +endi + +sql insert into t1 values(1648791213001,1,1,1,1.0) (1648791213009,2,2,2,1.1) (1648791215001,5,5,5,5.1) + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(next); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(next); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 +loop6: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 2 sql select * from streamt3; +sql select * from streamt3; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +# row 0 +if $rows != 5 then + print ======rows=$rows + goto loop6 +endi + +# row 0 +if $data01 != 1 then + print ======data01=$data01 + goto loop6 +endi + +if $data11 != 5 then + print ======data11=$data11 + goto loop6 +endi + +if $data21 != 5 then + print ======data21=$data21 + goto loop6 +endi + +if $data31 != 4 then + print ======data31=$data31 + goto loop6 +endi + +if $data41 != 4 then + print ======data41=$data41 + goto loop6 +endi + print end system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/stream/streamInterpPrev0.sim b/tests/script/tsim/stream/streamInterpPrev0.sim index fce4eb0f7035..9ff18d4a7141 100644 --- a/tests/script/tsim/stream/streamInterpPrev0.sim +++ b/tests/script/tsim/stream/streamInterpPrev0.sim @@ -212,6 +212,8 @@ if $data41 != 5 then goto loop3 endi +print step2 + sql create database test2 vgroups 1; sql use test2; @@ -292,4 +294,119 @@ if $data51 != 5 then goto loop4 endi +print step3 +sql create database test3 vgroups 1; +sql use test3; + +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stream streams3 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt3 as select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 every(1s) fill(prev); + +run tsim/stream/checkTaskStatus.sim + + +sql insert into t1 values(1648791212001,0,0,0,0.0) (1648791217001,4,4,4,4.1); + + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217000) every(1s) fill(prev); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217000) every(1s) fill(prev); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 +loop5: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 1 sql select * from streamt3; +sql select * from streamt3; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +# row 0 +if $rows != 5 then + print ======rows=$rows + goto loop5 +endi + +sql insert into t1 values(1648791213001,1,1,1,1.0) (1648791213009,2,2,2,1.1) (1648791215001,5,5,5,5.1) + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(prev); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(prev); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 +loop6: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 2 sql select * from streamt3; +sql select * from streamt3; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +# row 0 +if $rows != 5 then + print ======rows=$rows + goto loop6 +endi + +# row 0 +if $data01 != 0 then + print ======data01=$data01 + goto loop6 +endi + +if $data11 != 2 then + print ======data11=$data11 + goto loop6 +endi + +if $data21 != 2 then + print ======data21=$data21 + goto loop6 +endi + +if $data31 != 5 then + print ======data31=$data31 + goto loop6 +endi + +if $data41 != 5 then + print ======data41=$data41 + goto loop6 +endi + system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/stream/streamInterpValue0.sim b/tests/script/tsim/stream/streamInterpValue0.sim index 511a3515b12b..1d79d2ec1cde 100644 --- a/tests/script/tsim/stream/streamInterpValue0.sim +++ b/tests/script/tsim/stream/streamInterpValue0.sim @@ -365,8 +365,8 @@ sql create database test2 vgroups 1; sql use test2; sql create table t1(ts timestamp, a int, b int , c int, d double); -sql create stream streams3 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt3 as select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 every(1s) fill(NULL); -sql create stream streams4 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt4 as select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 every(1s) fill(value, 10,20,30,40); +sql create stream streams2_1 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt3 as select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 every(1s) fill(NULL); +sql create stream streams2_2 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt4 as select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 every(1s) fill(value, 10,20,30,40); run tsim/stream/checkTaskStatus.sim @@ -511,5 +511,224 @@ if $data51 != 10 then goto loop4_1 endi + + +print step3 +sql create database test3 vgroups 1; +sql use test3; + +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stream streams3_1 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt3_1 as select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 every(1s) fill(NULL); +sql create stream streams3_2 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt3_2 as select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 every(1s) fill(value, 10,20,30,40); + +run tsim/stream/checkTaskStatus.sim + + +sql insert into t1 values(1648791212001,0,0,0,0.0) (1648791217001,4,4,4,4.1); + + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217000) every(1s) fill(NULL); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217000) every(1s) fill(NULL); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 +loop5: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 1 sql select * from streamt3_1; +sql select * from streamt3_1; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +# row 0 +if $rows != 5 then + print ======rows=$rows + goto loop5 +endi + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217000) every(1s) fill(value, 10,20,30,40); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217000) every(1s) fill(value, 10,20,30,40); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 +loop5_1: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 1 sql select * from streamt3_2; +sql select * from streamt3_2; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +# row 0 +if $rows != 5 then + print ======rows=$rows + goto loop5_1 +endi + +sql insert into t1 values(1648791213001,1,1,1,1.0) (1648791213009,2,2,2,1.1) (1648791215001,5,5,5,5.1) + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(NULL); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(NULL); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 +loop6: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 2 sql select * from streamt3_1; +sql select * from streamt3_1; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +# row 0 +if $rows != 5 then + print ======rows=$rows + goto loop6 +endi + +# row 0 +if $data01 != NULL then + print ======data01=$data01 + goto loop6 +endi + +if $data11 != NULL then + print ======data11=$data11 + goto loop6 +endi + +if $data21 != NULL then + print ======data21=$data21 + goto loop6 +endi + +if $data31 != NULL then + print ======data31=$data31 + goto loop6 +endi + +if $data41 != NULL then + print ======data41=$data41 + goto loop6 +endi + + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(value, 10,20,30,40); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(value, 10,20,30,40); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 +loop6_1: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 2 sql select * from streamt3_2; +sql select * from streamt3_2; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +# row 0 +if $rows != 5 then + print ======rows=$rows + goto loop6_1 +endi + +# row 0 +if $data01 != 10 then + print ======data01=$data01 + goto loop6_1 +endi + +if $data11 != 10 then + print ======data11=$data11 + goto loop6_1 +endi + +if $data21 != 10 then + print ======data21=$data21 + goto loop6_1 +endi + +if $data31 != 10 then + print ======data31=$data31 + goto loop6_1 +endi + +if $data41 != 10 then + print ======data41=$data41 + goto loop6_1 +endi + print end system sh/exec.sh -n dnode1 -s stop -x SIGINT From 3b9eda95fcbfe2ec845fe21b7a23d4a98a5464b0 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Thu, 8 Aug 2024 09:40:13 +0800 Subject: [PATCH 022/695] add ci --- .../executor/src/streamtimesliceoperator.c | 26 +- .../tsim/stream/streamInterpPartitionBy0.sim | 554 ++++++++++++++++++ 2 files changed, 570 insertions(+), 10 deletions(-) create mode 100644 tests/script/tsim/stream/streamInterpPartitionBy0.sim diff --git a/source/libs/executor/src/streamtimesliceoperator.c b/source/libs/executor/src/streamtimesliceoperator.c index f0e2424d39d1..94a856d4d5ef 100644 --- a/source/libs/executor/src/streamtimesliceoperator.c +++ b/source/libs/executor/src/streamtimesliceoperator.c @@ -340,7 +340,7 @@ static SResultCellData* getSliceResultCell(SResultCellData* pRowVal, int32_t ind } static int32_t fillPointResult(SStreamFillSupporter* pFillSup, SResultRowData* pResRow, TSKEY ts, SSDataBlock* pBlock, - bool* pRes) { + bool* pRes, bool isFilled) { int32_t code = TSDB_CODE_SUCCESS; int32_t lino = 0; if (pBlock->info.rows >= pBlock->info.capacity) { @@ -368,7 +368,6 @@ static int32_t fillPointResult(SStreamFillSupporter* pFillSup, SResultRowData* p code = colDataSetVal(pDstCol, pBlock->info.rows, (char*)&ts, false); QUERY_CHECK_CODE(code, lino, _end); } else if (isIsfilledPseudoColumn(pFillCol->pExpr)) { - bool isFilled = false; code = colDataSetVal(pDstCol, pBlock->info.rows, (char*)&isFilled, false); QUERY_CHECK_CODE(code, lino, _end); } else { @@ -396,7 +395,7 @@ static void fillNormalRange(SStreamFillSupporter* pFillSup, SStreamFillInfo* pFi STimeWindow st = {.skey = pFillInfo->current, .ekey = pFillInfo->current}; if (inWinRange(&pFillSup->winRange, &st)) { bool res = true; - code = fillPointResult(pFillSup, pFillInfo->pResRow, pFillInfo->current, pBlock, &res); + code = fillPointResult(pFillSup, pFillInfo->pResRow, pFillInfo->current, pBlock, &res, true); QUERY_CHECK_CODE(code, lino, _end); } pFillInfo->current = taosTimeAdd(pFillInfo->current, pFillSup->interval.sliding, pFillSup->interval.slidingUnit, @@ -478,13 +477,13 @@ static void doStreamFillRange(SStreamFillSupporter* pFillSup, SStreamFillInfo* p int32_t lino = 0; bool res = true; if (pFillInfo->needFill == false) { - code = fillPointResult(pFillSup, &pFillSup->cur, pFillSup->cur.key, pRes, &res); + code = fillPointResult(pFillSup, &pFillSup->cur, pFillSup->cur.key, pRes, &res, false); QUERY_CHECK_CODE(code, lino, _end); return; } if (pFillInfo->pos == FILL_POS_START) { - code = fillPointResult(pFillSup, &pFillSup->cur, pFillSup->cur.key, pRes, &res); + code = fillPointResult(pFillSup, &pFillSup->cur, pFillSup->cur.key, pRes, &res, false); QUERY_CHECK_CODE(code, lino, _end); if (res) { pFillInfo->pos = FILL_POS_INVALID; @@ -496,7 +495,7 @@ static void doStreamFillRange(SStreamFillSupporter* pFillSup, SStreamFillInfo* p fillLinearRange(pFillSup, pFillInfo, pRes); if (pFillInfo->pos == FILL_POS_MID) { - code = fillPointResult(pFillSup, &pFillSup->cur, pFillSup->cur.key, pRes, &res); + code = fillPointResult(pFillSup, &pFillSup->cur, pFillSup->cur.key, pRes, &res, false); QUERY_CHECK_CODE(code, lino, _end); if (res) { pFillInfo->pos = FILL_POS_INVALID; @@ -512,7 +511,7 @@ static void doStreamFillRange(SStreamFillSupporter* pFillSup, SStreamFillInfo* p } } if (pFillInfo->pos == FILL_POS_END) { - code = fillPointResult(pFillSup, &pFillSup->cur, pFillSup->cur.key, pRes, &res); + code = fillPointResult(pFillSup, &pFillSup->cur, pFillSup->cur.key, pRes, &res, false); QUERY_CHECK_CODE(code, lino, _end); if (res) { pFillInfo->pos = FILL_POS_INVALID; @@ -820,7 +819,7 @@ static int32_t getPointInfoFromState(SStreamAggSupporter* pAggSup, SStreamFillSu int32_t nextVLen = 0; pNextPoint->key.groupId = groupId; - if (pFillSup->type != TSDB_FILL_LINEAR) { + if (pFillSup->type != TSDB_FILL_LINEAR && pFillSup->type != TSDB_FILL_PREV) { SET_WIN_KEY_INVALID(pNextPoint->key.ts); code = pAggSup->stateStore.streamStateFillGetNext(pState, &pCurPoint->key, &pNextPoint->key, (void**)&pNextPoint->pResPos, &nextVLen, &tmpRes); @@ -1180,7 +1179,6 @@ void doBuildTimeSlicePointResult(SStreamAggSupporter* pAggSup, SStreamFillSuppor if (pBlock->info.id.groupId == 0) { pBlock->info.id.groupId = pKey->groupId; } else if (pBlock->info.id.groupId != pKey->groupId) { - pGroupResInfo->index--; break; } SSlicePoint curPoint = {.key.ts = pKey->ts, .key.groupId = pKey->groupId}; @@ -1527,6 +1525,8 @@ int32_t getDownstreamRes(SOperatorInfo* downstream, SSDataBlock** ppRes) { SStreamScanInfo* pInfo = (SStreamScanInfo*)downstream->info; *ppRes = pInfo->pRes; return TSDB_CODE_SUCCESS; + } else if (downstream->pDownstream[0] != NULL) { + return getDownstreamRes(downstream->pDownstream[0], ppRes); } qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(TSDB_CODE_FAILED)); return TSDB_CODE_FAILED; @@ -1664,10 +1664,16 @@ int32_t createStreamTimeSliceOperatorInfo(SOperatorInfo* downstream, SPhysiNode* return code; _error: + if (code != TSDB_CODE_SUCCESS) { + qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } if (pInfo != NULL) { destroyStreamTimeSliceOperatorInfo(pInfo); } - taosMemoryFreeClear(pOperator); + if (pOperator != NULL) { + pOperator->info = NULL; + destroyOperator(pOperator); + } pTaskInfo->code = code; (*ppOptInfo) = NULL; return code; diff --git a/tests/script/tsim/stream/streamInterpPartitionBy0.sim b/tests/script/tsim/stream/streamInterpPartitionBy0.sim new file mode 100644 index 000000000000..eff670641677 --- /dev/null +++ b/tests/script/tsim/stream/streamInterpPartitionBy0.sim @@ -0,0 +1,554 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sleep 50 +sql connect + +print step prev +print =============== create database +sql create database test vgroups 1; +sql use test; +sql create stable st(ts timestamp,a int,b int,c int, d double) tags(ta int,tb int,tc int); + +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); +sql create table t3 using st tags(2,2,2); + +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _irowts, interp(a), _isfilled, tbname, b, c from st partition by tbname, b,c every(1s) fill(prev); + +run tsim/stream/checkTaskStatus.sim + +sql insert into t1 values(1648791212000,0,0,0,0.0) (1648791212001,1,0,0,1.0) (1648791217001,2,0,0,2.1) t2 values(1648791212000,0,1,1,0.0) (1648791212001,1,1,1,1.0) (1648791217001,2,1,1,2.1); + +sql insert into t3 values(1648791212000,0,2,2,0.0) (1648791212001,1,2,2,1.0) (1648791217001,2,2,2,2.1); + +print sql select _irowts, interp(a), _isfilled, tbname, b, c from st partition by tbname, b,c range(1648791212000, 1648791217001) every(1s) fill(prev) order by b, 1; +#sql select _irowts, interp(a), _isfilled, tbname, b, c from st partition by tbname, b,c range(1648791212000, 1648791217001) every(1s) fill(prev) order by b, 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 + +$loop_count = 0 +loop0: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 0 sql select * from streamt where b = 0 and c = 0 order by 1; +sql select * from streamt where b = 0 and c = 0 order by 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 + + +# row 0 +if $rows != 6 then + print ======rows=$rows + goto loop0 +endi + +# row 0 +if $data01 != 0 then + print ======data01=$data01 + goto loop0 +endi + +if $data02 != 0 then + print ======data02=$data02 + goto loop0 +endi + +if $data11 != 1 then + print ======data11=$data11 + goto loop0 +endi + +if $data12 != 1 then + print ======data12=$data12 + goto loop0 +endi + +if $data21 != 1 then + print ======data21=$data21 + goto loop0 +endi + +if $data22 != 1 then + print ======data22=$data22 + goto loop0 +endi + +if $data31 != 1 then + print ======data31=$data31 + goto loop0 +endi + +if $data32 != 1 then + print ======data32=$data32 + goto loop0 +endi + +if $data41 != 1 then + print ======data41=$data41 + goto loop0 +endi + +if $data42 != 1 then + print ======data41=$data41 + goto loop0 +endi + +if $data51 != 1 then + print ======data51=$data51 + goto loop0 +endi + +if $data52 != 1 then + print ======data51=$data51 + goto loop0 +endi + +print 1 sql select * from streamt where b = 1 and c = 1 order by 1; +sql select * from streamt where b = 1 and c = 1 order by 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 + + +# row 0 +if $rows != 6 then + print ======rows=$rows + goto loop0 +endi + +# row 0 +if $data01 != 0 then + print ======data01=$data01 + goto loop0 +endi + +if $data02 != 0 then + print ======data02=$data02 + goto loop0 +endi + +if $data11 != 1 then + print ======data11=$data11 + goto loop0 +endi + +if $data12 != 1 then + print ======data12=$data12 + goto loop0 +endi + +if $data21 != 1 then + print ======data21=$data21 + goto loop0 +endi + +if $data22 != 1 then + print ======data22=$data22 + goto loop0 +endi + +if $data31 != 1 then + print ======data31=$data31 + goto loop0 +endi + +if $data32 != 1 then + print ======data32=$data32 + goto loop0 +endi + +if $data41 != 1 then + print ======data41=$data41 + goto loop0 +endi + +if $data42 != 1 then + print ======data41=$data41 + goto loop0 +endi + +if $data51 != 1 then + print ======data51=$data51 + goto loop0 +endi + +if $data52 != 1 then + print ======data51=$data51 + goto loop0 +endi + +print 2 sql select * from streamt where b = 2 and c = 2 order by 1; +sql select * from streamt where b = 2 and c = 2 order by 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 + + +# row 0 +if $rows != 6 then + print ======rows=$rows + goto loop0 +endi + +# row 0 +if $data01 != 0 then + print ======data01=$data01 + goto loop0 +endi + +if $data02 != 0 then + print ======data02=$data02 + goto loop0 +endi + +if $data11 != 1 then + print ======data11=$data11 + goto loop0 +endi + +if $data12 != 1 then + print ======data12=$data12 + goto loop0 +endi + +if $data21 != 1 then + print ======data21=$data21 + goto loop0 +endi + +if $data22 != 1 then + print ======data22=$data22 + goto loop0 +endi + +if $data31 != 1 then + print ======data31=$data31 + goto loop0 +endi + +if $data32 != 1 then + print ======data32=$data32 + goto loop0 +endi + +if $data41 != 1 then + print ======data41=$data41 + goto loop0 +endi + +if $data42 != 1 then + print ======data41=$data41 + goto loop0 +endi + +if $data51 != 1 then + print ======data51=$data51 + goto loop0 +endi + +if $data52 != 1 then + print ======data51=$data51 + goto loop0 +endi + +print step next +print =============== create database +sql create database test2 vgroups 1; +sql use test2; +sql create stable st(ts timestamp,a int,b int,c int, d double) tags(ta int,tb int,tc int); + +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); +sql create table t3 using st tags(2,2,2); + +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2 as select _irowts, interp(a), _isfilled, tbname, b, c from st partition by tbname, b,c every(1s) fill(next); + +run tsim/stream/checkTaskStatus.sim + +sql insert into t1 values(1648791212000,0,0,0,0.0) (1648791212001,1,0,0,1.0) (1648791217001,2,0,0,2.1); + +sql insert into t2 values(1648791212000,0,1,1,0.0) (1648791212001,1,1,1,1.0) (1648791217001,2,1,1,2.1); + +sql insert into t3 values(1648791212000,0,2,2,0.0) (1648791212001,1,2,2,1.0) (1648791217001,2,2,2,2.1); + +print sql select _irowts, interp(a), _isfilled, tbname, b, c from st partition by tbname, b,c range(1648791212000, 1648791217001) every(1s) fill(next) order by b, 1; +#sql select _irowts, interp(a), _isfilled, tbname, b, c from st partition by tbname, b,c range(1648791212000, 1648791217001) every(1s) fill(next) order by b, 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 + +$loop_count = 0 +loop1: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 0 sql select * from streamt2 where b = 0 and c = 0 order by 1; +sql select * from streamt2 where b = 0 and c = 0 order by 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 + + +# row 0 +if $rows != 6 then + print ======rows=$rows + goto loop1 +endi + +# row 0 +if $data01 != 0 then + print ======data01=$data01 + goto loop1 +endi + +if $data02 != 0 then + print ======data02=$data02 + goto loop1 +endi + +if $data11 != 2 then + print ======data11=$data11 + goto loop1 +endi + +if $data12 != 1 then + print ======data12=$data12 + goto loop1 +endi + +if $data21 != 2 then + print ======data21=$data21 + goto loop1 +endi + +if $data22 != 1 then + print ======data22=$data22 + goto loop1 +endi + +if $data31 != 2 then + print ======data31=$data31 + goto loop1 +endi + +if $data32 != 1 then + print ======data32=$data32 + goto loop1 +endi + +if $data41 != 2 then + print ======data41=$data41 + goto loop1 +endi + +if $data42 != 1 then + print ======data41=$data41 + goto loop1 +endi + +if $data51 != 2 then + print ======data51=$data51 + goto loop1 +endi + +if $data52 != 1 then + print ======data51=$data51 + goto loop1 +endi + +print 1 sql select * from streamt2 where b = 1 and c = 1 order by 1; +sql select * from streamt2 where b = 1 and c = 1 order by 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 + + +# row 0 +if $rows != 6 then + print ======rows=$rows + goto loop1 +endi + +# row 0 +if $data01 != 0 then + print ======data01=$data01 + goto loop1 +endi + +if $data02 != 0 then + print ======data02=$data02 + goto loop1 +endi + +if $data11 != 2 then + print ======data11=$data11 + goto loop1 +endi + +if $data12 != 1 then + print ======data12=$data12 + goto loop1 +endi + +if $data21 != 2 then + print ======data21=$data21 + goto loop1 +endi + +if $data22 != 1 then + print ======data22=$data22 + goto loop1 +endi + +if $data31 != 2 then + print ======data31=$data31 + goto loop1 +endi + +if $data32 != 1 then + print ======data32=$data32 + goto loop1 +endi + +if $data41 != 2 then + print ======data41=$data41 + goto loop1 +endi + +if $data42 != 1 then + print ======data41=$data41 + goto loop1 +endi + +if $data51 != 2 then + print ======data51=$data51 + goto loop1 +endi + +if $data52 != 1 then + print ======data51=$data51 + goto loop1 +endi + +print 2 sql select * from streamt2 where b = 2 and c = 2 order by 1; +sql select * from streamt2 where b = 2 and c = 2 order by 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 + + +# row 0 +if $rows != 6 then + print ======rows=$rows + goto loop1 +endi + +# row 0 +if $data01 != 0 then + print ======data01=$data01 + goto loop1 +endi + +if $data02 != 0 then + print ======data02=$data02 + goto loop1 +endi + +if $data11 != 2 then + print ======data11=$data11 + goto loop1 +endi + +if $data12 != 1 then + print ======data12=$data12 + goto loop1 +endi + +if $data21 != 2 then + print ======data21=$data21 + goto loop1 +endi + +if $data22 != 1 then + print ======data22=$data22 + goto loop1 +endi + +if $data31 != 2 then + print ======data31=$data31 + goto loop1 +endi + +if $data32 != 1 then + print ======data32=$data32 + goto loop1 +endi + +if $data41 != 2 then + print ======data41=$data41 + goto loop1 +endi + +if $data42 != 1 then + print ======data41=$data41 + goto loop1 +endi + +if $data51 != 2 then + print ======data51=$data51 + goto loop1 +endi + +if $data52 != 1 then + print ======data51=$data51 + goto loop1 +endi + + +system sh/exec.sh -n dnode1 -s stop -x SIGINT From 3a14454fb5ac970f2399e0a73ac81d8033083390 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Thu, 8 Aug 2024 19:30:18 +0800 Subject: [PATCH 023/695] add ci --- source/libs/executor/inc/streamexecutorInt.h | 1 - source/libs/executor/src/streamfilloperator.c | 37 +- .../executor/src/streamtimesliceoperator.c | 61 +- .../tsim/stream/streamInterpPartitionBy0.sim | 52 +- .../tsim/stream/streamInterpPartitionBy1.sim | 592 ++++++++++++++++++ 5 files changed, 702 insertions(+), 41 deletions(-) create mode 100644 tests/script/tsim/stream/streamInterpPartitionBy1.sim diff --git a/source/libs/executor/inc/streamexecutorInt.h b/source/libs/executor/inc/streamexecutorInt.h index 9b0e204f73c1..869623417d76 100644 --- a/source/libs/executor/inc/streamexecutorInt.h +++ b/source/libs/executor/inc/streamexecutorInt.h @@ -46,7 +46,6 @@ SStreamFillInfo* initStreamFillInfo(SStreamFillSupporter* pFillSup, SSDataBlock* SResultCellData* getResultCell(SResultRowData* pRaw, int32_t index); void destroyStreamFillSupporter(SStreamFillSupporter* pFillSup); -void calcRowDeltaData(SResultRowData* pEndRow, SArray* pEndPoins, SFillColInfo* pFillCol, int32_t numOfCol); bool hasCurWindow(SStreamFillSupporter* pFillSup); bool hasPrevWindow(SStreamFillSupporter* pFillSup); bool hasNextWindow(SStreamFillSupporter* pFillSup); diff --git a/source/libs/executor/src/streamfilloperator.c b/source/libs/executor/src/streamfilloperator.c index b602610b98b8..4cfacb03b4e8 100644 --- a/source/libs/executor/src/streamfilloperator.c +++ b/source/libs/executor/src/streamfilloperator.c @@ -259,7 +259,7 @@ static void transBlockToResultRow(const SSDataBlock* pBlock, int32_t rowId, TSKE pRowVal->key = ts; } -void calcRowDeltaData(SResultRowData* pEndRow, SArray* pEndPoins, SFillColInfo* pFillCol, int32_t numOfCol) { +static void calcRowDeltaData(SResultRowData* pEndRow, SArray* pEndPoins, SFillColInfo* pFillCol, int32_t numOfCol) { for (int32_t i = 0; i < numOfCol; i++) { if (!pFillCol[i].notFillCol) { int32_t slotId = GET_DEST_SLOT_ID(pFillCol + i); @@ -1271,30 +1271,26 @@ SStreamFillInfo* initStreamFillInfo(SStreamFillSupporter* pFillSup, SSDataBlock* for (int32_t i = 0; i < pFillSup->numOfAllCols; i++) { SColumnInfoData* pColData = taosArrayGet(pRes->pDataBlock, i); - SPoint value = {0}; - value.val = taosMemoryCalloc(1, pColData->info.bytes); - if (!value.val) { - code = TSDB_CODE_OUT_OF_MEMORY; - QUERY_CHECK_CODE(code, lino, _end); + if (pColData == NULL) { + SPoint dummy = {0}; + dummy.val = taosMemoryCalloc(1, 1); + taosArrayPush(pFillInfo->pLinearInfo->pEndPoints, &dummy); + dummy.val = taosMemoryCalloc(1, 1); + taosArrayPush(pFillInfo->pLinearInfo->pNextEndPoints, &dummy); + continue; } + SPoint value = {0}; + value.val = taosMemoryCalloc(1, pColData->info.bytes); + QUERY_CHECK_NULL(value.val, code, lino, _end, terrno); void* tmpRes = taosArrayPush(pFillInfo->pLinearInfo->pEndPoints, &value); - if (!tmpRes) { - code = TSDB_CODE_OUT_OF_MEMORY; - QUERY_CHECK_CODE(code, lino, _end); - } + QUERY_CHECK_NULL(tmpRes, code, lino, _end, terrno); value.val = taosMemoryCalloc(1, pColData->info.bytes); - if (!value.val) { - code = TSDB_CODE_OUT_OF_MEMORY; - QUERY_CHECK_CODE(code, lino, _end); - } + QUERY_CHECK_NULL(value.val, code, lino, _end, terrno); tmpRes = taosArrayPush(pFillInfo->pLinearInfo->pNextEndPoints, &value); - if (!tmpRes) { - code = TSDB_CODE_OUT_OF_MEMORY; - QUERY_CHECK_CODE(code, lino, _end); - } + QUERY_CHECK_NULL(tmpRes, code, lino, _end, terrno); } } pFillInfo->pLinearInfo->winIndex = 0; @@ -1318,6 +1314,11 @@ SStreamFillInfo* initStreamFillInfo(SStreamFillSupporter* pFillSup, SSDataBlock* for (int32_t i = 0; i < pFillSup->numOfAllCols; ++i) { SColumnInfoData* pColData = taosArrayGet(pRes->pDataBlock, i); SResultCellData* pCell = getResultCell(pFillInfo->pResRow, i); + if (pColData == NULL) { + pCell->bytes = 1; + pCell->type = 4; + continue; + } pCell->bytes = pColData->info.bytes; pCell->type = pColData->info.type; } diff --git a/source/libs/executor/src/streamtimesliceoperator.c b/source/libs/executor/src/streamtimesliceoperator.c index 94a856d4d5ef..ddc414d222c9 100644 --- a/source/libs/executor/src/streamtimesliceoperator.c +++ b/source/libs/executor/src/streamtimesliceoperator.c @@ -347,10 +347,7 @@ static int32_t fillPointResult(SStreamFillSupporter* pFillSup, SResultRowData* p (*pRes) = false; goto _end; } - if (IS_INVALID_WIN_KEY(ts)) { - (*pRes) = true; - goto _end; - } + bool ckRes = true; code = checkResult(pFillSup, ts, pBlock->info.id.groupId, &ckRes); QUERY_CHECK_CODE(code, lino, _end); @@ -428,7 +425,7 @@ static void fillLinearRange(SStreamFillSupporter* pFillSup, SStreamFillInfo* pFi bool isFilled = true; code = colDataSetVal(pDstCol, pBlock->info.rows, (char*)&isFilled, false); QUERY_CHECK_CODE(code, lino, _end); - } else { + } else if (isInterpFunc(pFillCol->pExpr)) { int32_t srcSlot = pFillCol->pExpr->base.pParam[0].pCol->slotId; SResultCellData* pCell = getSliceResultCell(pFillInfo->pResRow->pRowVal, srcSlot); if (IS_VAR_DATA_TYPE(type) || type == TSDB_DATA_TYPE_BOOL || pCell->isNull) { @@ -451,6 +448,11 @@ static void fillLinearRange(SStreamFillSupporter* pFillSup, SStreamFillInfo* pFi QUERY_CHECK_CODE(code, lino, _end); destroySPoint(&cur); + } else { + int32_t srcSlot = pFillCol->pExpr->base.pParam[0].pCol->slotId; + SResultCellData* pCell = getSliceResultCell(pFillInfo->pResRow->pRowVal, srcSlot); + code = setRowCell(pDstCol, pBlock->info.rows, pCell); + QUERY_CHECK_CODE(code, lino, _end); } } pFillInfo->current = taosTimeAdd(pFillInfo->current, pFillSup->interval.sliding, pFillSup->interval.slidingUnit, @@ -476,7 +478,7 @@ static void doStreamFillRange(SStreamFillSupporter* pFillSup, SStreamFillInfo* p int32_t code = TSDB_CODE_SUCCESS; int32_t lino = 0; bool res = true; - if (pFillInfo->needFill == false) { + if (pFillInfo->needFill == false && pFillInfo->pos != FILL_POS_INVALID) { code = fillPointResult(pFillSup, &pFillSup->cur, pFillSup->cur.key, pRes, &res, false); QUERY_CHECK_CODE(code, lino, _end); return; @@ -847,6 +849,34 @@ static int32_t getPointInfoFromState(SStreamAggSupporter* pAggSup, SStreamFillSu return code; } +static void copyNonFillValueInfo(SStreamFillSupporter* pFillSup, SStreamFillInfo* pFillInfo) { + for (int32_t i = 0; i < pFillSup->numOfAllCols; ++i) { + SFillColInfo* pFillCol = pFillSup->pAllColInfo + i; + if (!isInterpFunc(pFillCol->pExpr) && !isIrowtsPseudoColumn(pFillCol->pExpr) && + !isIsfilledPseudoColumn(pFillCol->pExpr)) { + int32_t srcSlot = pFillCol->pExpr->base.pParam[0].pCol->slotId; + SResultCellData* pSrcCell = getResultCell(&pFillSup->cur, srcSlot); + SResultCellData* pDestCell = getResultCell(pFillInfo->pResRow, srcSlot); + pDestCell->isNull = pSrcCell->isNull; + if (!pDestCell->isNull) { + memcpy(pDestCell->pData, pSrcCell->pData, pSrcCell->bytes); + } + } + } +} + +static void copyCalcRowDeltaData(SResultRowData* pEndRow, SArray* pEndPoins, SFillColInfo* pFillCol, int32_t numOfCol) { + for (int32_t i = 0; i < numOfCol; i++) { + if (isInterpFunc(pFillCol[i].pExpr)) { + int32_t slotId = pFillCol[i].pExpr->base.pParam[0].pCol->slotId; + SResultCellData* pECell = getResultCell(pEndRow, slotId); + SPoint* pPoint = taosArrayGet(pEndPoins, slotId); + pPoint->key = pEndRow->key; + memcpy(pPoint->val, pECell->pData, pECell->bytes); + } + } +} + static void setTimeSliceFillRule(SStreamFillSupporter* pFillSup, SStreamFillInfo* pFillInfo, TSKEY ts) { if (!hasPrevWindow(pFillSup) && !hasNextWindow(pFillSup)) { pFillInfo->needFill = false; @@ -878,7 +908,7 @@ static void setTimeSliceFillRule(SStreamFillSupporter* pFillSup, SStreamFillInfo setFillKeyInfo(startTs, nextWKey, &pFillSup->interval, pFillInfo); pFillInfo->pos = FILL_POS_START; } - copyNotFillExpData(pFillSup, pFillInfo); + copyNonFillValueInfo(pFillSup, pFillInfo); pFillInfo->pResRow->key = ts; } break; case TSDB_FILL_PREV: { @@ -920,7 +950,7 @@ static void setTimeSliceFillRule(SStreamFillSupporter* pFillSup, SStreamFillInfo pFillInfo->pos = FILL_POS_INVALID; SET_WIN_KEY_INVALID(pFillInfo->pLinearInfo->nextEnd); pFillSup->next.key = pFillSup->nextOriginKey; - calcRowDeltaData(&pFillSup->next, pFillInfo->pLinearInfo->pEndPoints, pFillSup->pAllColInfo, + copyCalcRowDeltaData(&pFillSup->next, pFillInfo->pLinearInfo->pEndPoints, pFillSup->pAllColInfo, pFillSup->numOfAllCols); pFillSup->prev.key = pFillSup->prevOriginKey; pFillInfo->pResRow = &pFillSup->prev; @@ -930,7 +960,7 @@ static void setTimeSliceFillRule(SStreamFillSupporter* pFillSup, SStreamFillInfo setFillKeyInfo(prevWKey, endTs, &pFillSup->interval, pFillInfo); pFillInfo->pos = FILL_POS_END; SET_WIN_KEY_INVALID(pFillInfo->pLinearInfo->nextEnd); - calcRowDeltaData(&pFillSup->cur, pFillInfo->pLinearInfo->pEndPoints, pFillSup->pAllColInfo, + copyCalcRowDeltaData(&pFillSup->cur, pFillInfo->pLinearInfo->pEndPoints, pFillSup->pAllColInfo, pFillSup->numOfAllCols); pFillSup->prev.key = pFillSup->prevOriginKey; pFillInfo->pResRow = &pFillSup->prev; @@ -942,7 +972,7 @@ static void setTimeSliceFillRule(SStreamFillSupporter* pFillSup, SStreamFillInfo pFillInfo->pos = FILL_POS_START; SET_WIN_KEY_INVALID(pFillInfo->pLinearInfo->nextEnd); pFillSup->next.key = pFillSup->nextOriginKey; - calcRowDeltaData(&pFillSup->next, pFillInfo->pLinearInfo->pEndPoints, pFillSup->pAllColInfo, + copyCalcRowDeltaData(&pFillSup->next, pFillInfo->pLinearInfo->pEndPoints, pFillSup->pAllColInfo, pFillSup->numOfAllCols); pFillInfo->pResRow = &pFillSup->cur; pFillInfo->pLinearInfo->hasNext = false; @@ -955,7 +985,6 @@ static void setTimeSliceFillRule(SStreamFillSupporter* pFillSup, SStreamFillInfo _end: if (ts != pFillSup->cur.key) { - SET_WIN_KEY_INVALID(pFillSup->cur.key); pFillInfo->pos = FILL_POS_INVALID; } } @@ -1481,7 +1510,7 @@ static SSDataBlock* doStreamTimeSlice(SOperatorInfo* pOperator) { return pRes; } -static void setValueForFillInfo(SStreamFillSupporter* pFillSup, SStreamFillInfo* pFillInfo) { +static void copyFillValueInfo(SStreamFillSupporter* pFillSup, SStreamFillInfo* pFillInfo) { if (pFillInfo->type == TSDB_FILL_SET_VALUE || pFillInfo->type == TSDB_FILL_SET_VALUE_F) { int32_t valueIndex = 0; for (int32_t i = 0; i < pFillSup->numOfAllCols; ++i) { @@ -1525,8 +1554,10 @@ int32_t getDownstreamRes(SOperatorInfo* downstream, SSDataBlock** ppRes) { SStreamScanInfo* pInfo = (SStreamScanInfo*)downstream->info; *ppRes = pInfo->pRes; return TSDB_CODE_SUCCESS; - } else if (downstream->pDownstream[0] != NULL) { - return getDownstreamRes(downstream->pDownstream[0], ppRes); + } else if (downstream->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_PARTITION) { + SStreamPartitionOperatorInfo* pInfo = (SStreamPartitionOperatorInfo*)downstream->info; + *ppRes = pInfo->binfo.pRes; + return TSDB_CODE_SUCCESS; } qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(TSDB_CODE_FAILED)); return TSDB_CODE_FAILED; @@ -1627,7 +1658,7 @@ int32_t createStreamTimeSliceOperatorInfo(SOperatorInfo* downstream, SPhysiNode* QUERY_CHECK_CODE(code, lino, _error); pInfo->pFillInfo = initStreamFillInfo(pInfo->pFillSup, pDownRes); - setValueForFillInfo(pInfo->pFillSup, pInfo->pFillInfo); + copyFillValueInfo(pInfo->pFillSup, pInfo->pFillInfo); if (pHandle) { pInfo->isHistoryOp = pHandle->fillHistory; diff --git a/tests/script/tsim/stream/streamInterpPartitionBy0.sim b/tests/script/tsim/stream/streamInterpPartitionBy0.sim index eff670641677..6b222de228ef 100644 --- a/tests/script/tsim/stream/streamInterpPartitionBy0.sim +++ b/tests/script/tsim/stream/streamInterpPartitionBy0.sim @@ -22,8 +22,28 @@ sql insert into t1 values(1648791212000,0,0,0,0.0) (1648791212001,1,0,0,1.0) (16 sql insert into t3 values(1648791212000,0,2,2,0.0) (1648791212001,1,2,2,1.0) (1648791217001,2,2,2,2.1); -print sql select _irowts, interp(a), _isfilled, tbname, b, c from st partition by tbname, b,c range(1648791212000, 1648791217001) every(1s) fill(prev) order by b, 1; -#sql select _irowts, interp(a), _isfilled, tbname, b, c from st partition by tbname, b,c range(1648791212000, 1648791217001) every(1s) fill(prev) order by b, 1; +print sql select _irowts, interp(a), _isfilled, b from st where b = 0 and c = 0 partition by tbname, b,c range(1648791212000, 1648791217001) every(1s) fill(prev) order by b, 1; +sql select _irowts, interp(a), _isfilled, b from st where b = 0 and c = 0 partition by tbname, b,c range(1648791212000, 1648791217001) every(1s) fill(prev) order by b, 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 + +print sql select _irowts, interp(a), _isfilled, b from st where b = 1 and c =1 partition by tbname, b,c range(1648791212000, 1648791217001) every(1s) fill(prev) order by b, 1; +sql select _irowts, interp(a), _isfilled, b from st where b = 1 and c = 1 partition by tbname, b,c range(1648791212000, 1648791217001) every(1s) fill(prev) order by b, 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 + +print sql select _irowts, interp(a), _isfilled, b from st where b = 2 and c = 2 partition by tbname, b,c range(1648791212000, 1648791217001) every(1s) fill(prev) order by b, 1; +sql select _irowts, interp(a), _isfilled, b from st where b = 2 and c = 2 partition by tbname, b,c range(1648791212000, 1648791217001) every(1s) fill(prev) order by b, 1; print $data00 $data01 $data02 $data03 $data04 $data05 print $data10 $data11 $data12 $data13 $data14 $data15 @@ -290,14 +310,32 @@ sql create stream streams2 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into run tsim/stream/checkTaskStatus.sim -sql insert into t1 values(1648791212000,0,0,0,0.0) (1648791212001,1,0,0,1.0) (1648791217001,2,0,0,2.1); - -sql insert into t2 values(1648791212000,0,1,1,0.0) (1648791212001,1,1,1,1.0) (1648791217001,2,1,1,2.1); +sql insert into t1 values(1648791212000,0,0,0,0.0) (1648791212001,1,0,0,1.0) (1648791217001,2,0,0,2.1) t2 values(1648791212000,0,1,1,0.0) (1648791212001,1,1,1,1.0) (1648791217001,2,1,1,2.1); sql insert into t3 values(1648791212000,0,2,2,0.0) (1648791212001,1,2,2,1.0) (1648791217001,2,2,2,2.1); -print sql select _irowts, interp(a), _isfilled, tbname, b, c from st partition by tbname, b,c range(1648791212000, 1648791217001) every(1s) fill(next) order by b, 1; -#sql select _irowts, interp(a), _isfilled, tbname, b, c from st partition by tbname, b,c range(1648791212000, 1648791217001) every(1s) fill(next) order by b, 1; +print sql select _irowts, interp(a), _isfilled, b from st where b = 0 and c = 0 partition by tbname, b,c range(1648791212000, 1648791217001) every(1s) fill(next) order by b, 1; +sql select _irowts, interp(a), _isfilled, b from st where b = 0 and c = 0 partition by tbname, b,c range(1648791212000, 1648791217001) every(1s) fill(next) order by b, 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 + +print sql select _irowts, interp(a), _isfilled, b from st where b = 1 and c =1 partition by tbname, b,c range(1648791212000, 1648791217001) every(1s) fill(next) order by b, 1; +sql select _irowts, interp(a), _isfilled, b from st where b = 1 and c = 1 partition by tbname, b,c range(1648791212000, 1648791217001) every(1s) fill(next) order by b, 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 + +print sql select _irowts, interp(a), _isfilled, b from st where b = 2 and c = 2 partition by tbname, b,c range(1648791212000, 1648791217001) every(1s) fill(next) order by b, 1; +sql select _irowts, interp(a), _isfilled, b from st where b = 2 and c = 2 partition by tbname, b,c range(1648791212000, 1648791217001) every(1s) fill(next) order by b, 1; print $data00 $data01 $data02 $data03 $data04 $data05 print $data10 $data11 $data12 $data13 $data14 $data15 diff --git a/tests/script/tsim/stream/streamInterpPartitionBy1.sim b/tests/script/tsim/stream/streamInterpPartitionBy1.sim new file mode 100644 index 000000000000..ecb5e0ee6290 --- /dev/null +++ b/tests/script/tsim/stream/streamInterpPartitionBy1.sim @@ -0,0 +1,592 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sleep 50 +sql connect + +print step NULL +print =============== create database +sql create database test vgroups 1; +sql use test; +sql create stable st(ts timestamp,a int,b int,c int, d double) tags(ta int,tb int,tc int); + +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); +sql create table t3 using st tags(2,2,2); + +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _irowts, interp(a), _isfilled, tbname, b, c from st partition by tbname, b,c every(1s) fill(NULL); + +run tsim/stream/checkTaskStatus.sim + +sql insert into t1 values(1648791212000,0,0,0,0.0) (1648791212001,1,0,0,1.0) (1648791217001,2,0,0,2.1) t2 values(1648791212000,0,1,1,0.0) (1648791212001,1,1,1,1.0) (1648791217001,2,1,1,2.1); + +sql insert into t3 values(1648791212000,0,2,2,0.0) (1648791212001,1,2,2,1.0) (1648791217001,2,2,2,2.1); + +print sql select _irowts, interp(a), _isfilled, b from st where b = 0 partition by tbname, b, c range(1648791212000, 1648791217001) every(1s) fill(NULL) order by b, 1; +sql select _irowts, interp(a), _isfilled, b from st where b = 0 partition by tbname, b, c range(1648791212000, 1648791217001) every(1s) fill(NULL) order by b, 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 + +print sql select _irowts, interp(a), _isfilled, b from st where b = 1 partition by tbname, b, c range(1648791212000, 1648791217001) every(1s) fill(NULL) order by b, 1; +sql select _irowts, interp(a), _isfilled, b from st where b = 1 partition by tbname, b, c range(1648791212000, 1648791217001) every(1s) fill(NULL) order by b, 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 + +print sql select _irowts, interp(a), _isfilled, b from st where b = 2 partition by tbname, b, c range(1648791212000, 1648791217001) every(1s) fill(NULL) order by b, 1; +sql select _irowts, interp(a), _isfilled, b from st where b = 2 partition by tbname, b, c range(1648791212000, 1648791217001) every(1s) fill(NULL) order by b, 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 + +$loop_count = 0 +loop0: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 0 sql select * from streamt where b = 0 and c = 0 order by 1; +sql select * from streamt where b = 0 and c = 0 order by 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 + + +# row 0 +if $rows != 6 then + print ======rows=$rows + goto loop0 +endi + +# row 0 +if $data01 != 0 then + print ======data01=$data01 + goto loop0 +endi + +if $data02 != 0 then + print ======data02=$data02 + goto loop0 +endi + +if $data11 != NULL then + print ======data11=$data11 + goto loop0 +endi + +if $data12 != 1 then + print ======data12=$data12 + goto loop0 +endi + +if $data21 != NULL then + print ======data21=$data21 + goto loop0 +endi + +if $data22 != 1 then + print ======data22=$data22 + goto loop0 +endi + +if $data31 != NULL then + print ======data31=$data31 + goto loop0 +endi + +if $data32 != 1 then + print ======data32=$data32 + goto loop0 +endi + +if $data41 != NULL then + print ======data41=$data41 + goto loop0 +endi + +if $data42 != 1 then + print ======data41=$data41 + goto loop0 +endi + +if $data51 != NULL then + print ======data51=$data51 + goto loop0 +endi + +if $data52 != 1 then + print ======data51=$data51 + goto loop0 +endi + +print 1 sql select * from streamt where b = 1 and c = 1 order by 1; +sql select * from streamt where b = 1 and c = 1 order by 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 + + +# row 0 +if $rows != 6 then + print ======rows=$rows + goto loop0 +endi + +# row 0 +if $data01 != 0 then + print ======data01=$data01 + goto loop0 +endi + +if $data02 != 0 then + print ======data02=$data02 + goto loop0 +endi + +if $data11 != NULL then + print ======data11=$data11 + goto loop0 +endi + +if $data12 != 1 then + print ======data12=$data12 + goto loop0 +endi + +if $data21 != NULL then + print ======data21=$data21 + goto loop0 +endi + +if $data22 != 1 then + print ======data22=$data22 + goto loop0 +endi + +if $data31 != NULL then + print ======data31=$data31 + goto loop0 +endi + +if $data32 != 1 then + print ======data32=$data32 + goto loop0 +endi + +if $data41 != NULL then + print ======data41=$data41 + goto loop0 +endi + +if $data42 != 1 then + print ======data41=$data41 + goto loop0 +endi + +if $data51 != NULL then + print ======data51=$data51 + goto loop0 +endi + +if $data52 != 1 then + print ======data51=$data51 + goto loop0 +endi + +print 2 sql select * from streamt where b = 2 and c = 2 order by 1; +sql select * from streamt where b = 2 and c = 2 order by 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 + + +# row 0 +if $rows != 6 then + print ======rows=$rows + goto loop0 +endi + +# row 0 +if $data01 != 0 then + print ======data01=$data01 + goto loop0 +endi + +if $data02 != 0 then + print ======data02=$data02 + goto loop0 +endi + +if $data11 != NULL then + print ======data11=$data11 + goto loop0 +endi + +if $data12 != 1 then + print ======data12=$data12 + goto loop0 +endi + +if $data21 != NULL then + print ======data21=$data21 + goto loop0 +endi + +if $data22 != 1 then + print ======data22=$data22 + goto loop0 +endi + +if $data31 != NULL then + print ======data31=$data31 + goto loop0 +endi + +if $data32 != 1 then + print ======data32=$data32 + goto loop0 +endi + +if $data41 != NULL then + print ======data41=$data41 + goto loop0 +endi + +if $data42 != 1 then + print ======data41=$data41 + goto loop0 +endi + +if $data51 != NULL then + print ======data51=$data51 + goto loop0 +endi + +if $data52 != 1 then + print ======data51=$data51 + goto loop0 +endi + +print step linear +print =============== create database +sql create database test2 vgroups 1; +sql use test2; +sql create stable st(ts timestamp,a int,b int,c int, d double) tags(ta int,tb int,tc int); + +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); +sql create table t3 using st tags(2,2,2); + +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2 as select _irowts, interp(a), _isfilled, tbname, b, c from st partition by tbname, b,c every(1s) fill(linear); + +run tsim/stream/checkTaskStatus.sim + +sql insert into t1 values(1648791212000,0,0,0,0.0) (1648791212001,10,0,0,1.0) (1648791217001,20,0,0,2.1) t2 values(1648791212000,0,1,1,0.0) (1648791212001,10,1,1,1.0) (1648791217001,20,1,1,2.1); + +sql insert into t3 values(1648791212000,0,2,2,0.0) (1648791212001,10,2,2,1.0) (1648791217001,20,2,2,2.1); + +print sql select _irowts, interp(a), _isfilled, b from st where b = 0 partition by tbname, b, c range(1648791212000, 1648791217001) every(1s) fill(linear) order by b, 1; +sql select _irowts, interp(a), _isfilled, b from st where b = 0 partition by tbname, b, c range(1648791212000, 1648791217001) every(1s) fill(linear) order by b, 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 + +$loop_count = 0 +loop1: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 0 sql select * from streamt2 where b = 0 and c = 0 order by 1; +sql select * from streamt2 where b = 0 and c = 0 order by 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 + + +# row 0 +if $rows != 6 then + print ======rows=$rows + goto loop1 +endi + +# row 0 +if $data01 != 0 then + print ======data01=$data01 + goto loop1 +endi + +if $data02 != 0 then + print ======data02=$data02 + goto loop1 +endi + +if $data11 != 11 then + print ======data11=$data11 + goto loop1 +endi + +if $data12 != 1 then + print ======data12=$data12 + goto loop1 +endi + +if $data21 != 13 then + print ======data21=$data21 + goto loop1 +endi + +if $data22 != 1 then + print ======data22=$data22 + goto loop1 +endi + +if $data31 != 15 then + print ======data31=$data31 + goto loop1 +endi + +if $data32 != 1 then + print ======data32=$data32 + goto loop1 +endi + +if $data41 != 17 then + print ======data41=$data41 + goto loop1 +endi + +if $data42 != 1 then + print ======data41=$data41 + goto loop1 +endi + +if $data51 != 19 then + print ======data51=$data51 + goto loop1 +endi + +if $data52 != 1 then + print ======data51=$data51 + goto loop1 +endi + +print sql select _irowts, interp(a), _isfilled, b from st where b = 1 partition by tbname, b, c range(1648791212000, 1648791217001) every(1s) fill(linear) order by b, 1; +sql select _irowts, interp(a), _isfilled, b from st where b = 1 partition by tbname, b, c range(1648791212000, 1648791217001) every(1s) fill(linear) order by b, 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 + +print 1 sql select * from streamt2 where b = 1 and c = 1 order by 1; +sql select * from streamt2 where b = 1 and c = 1 order by 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 + + +# row 0 +if $rows != 6 then + print ======rows=$rows + goto loop1 +endi + +# row 0 +if $data01 != 0 then + print ======data01=$data01 + goto loop1 +endi + +if $data02 != 0 then + print ======data02=$data02 + goto loop1 +endi + +if $data11 != 11 then + print ======data11=$data11 + goto loop1 +endi + +if $data12 != 1 then + print ======data12=$data12 + goto loop1 +endi + +if $data21 != 13 then + print ======data21=$data21 + goto loop1 +endi + +if $data22 != 1 then + print ======data22=$data22 + goto loop1 +endi + +if $data31 != 15 then + print ======data31=$data31 + goto loop1 +endi + +if $data32 != 1 then + print ======data32=$data32 + goto loop1 +endi + +if $data41 != 17 then + print ======data41=$data41 + goto loop1 +endi + +if $data42 != 1 then + print ======data41=$data41 + goto loop1 +endi + +if $data51 != 19 then + print ======data51=$data51 + goto loop1 +endi + +if $data52 != 1 then + print ======data51=$data51 + goto loop1 +endi + +print sql select _irowts, interp(a), _isfilled, b from st where b = 2 partition by tbname, b, c range(1648791212000, 1648791217001) every(1s) fill(linear) order by b, 1; +sql select _irowts, interp(a), _isfilled, b from st where b = 2 partition by tbname, b, c range(1648791212000, 1648791217001) every(1s) fill(linear) order by b, 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 + +print 2 sql select * from streamt2 where b = 2 and c = 2 order by 1; +sql select * from streamt2 where b = 2 and c = 2 order by 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 + + +# row 0 +if $rows != 6 then + print ======rows=$rows + goto loop1 +endi + +# row 0 +if $data01 != 0 then + print ======data01=$data01 + goto loop1 +endi + +if $data02 != 0 then + print ======data02=$data02 + goto loop1 +endi + +if $data11 != 11 then + print ======data11=$data11 + goto loop1 +endi + +if $data12 != 1 then + print ======data12=$data12 + goto loop1 +endi + +if $data21 != 13 then + print ======data21=$data21 + goto loop1 +endi + +if $data22 != 1 then + print ======data22=$data22 + goto loop1 +endi + +if $data31 != 15 then + print ======data31=$data31 + goto loop1 +endi + +if $data32 != 1 then + print ======data32=$data32 + goto loop1 +endi + +if $data41 != 17 then + print ======data41=$data41 + goto loop1 +endi + +if $data42 != 1 then + print ======data41=$data41 + goto loop1 +endi + +if $data51 != 19 then + print ======data51=$data51 + goto loop1 +endi + +if $data52 != 1 then + print ======data51=$data51 + goto loop1 +endi + + +system sh/exec.sh -n dnode1 -s stop -x SIGINT From 52e693511f8f030ff0591664868f7f959f1b3d90 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Mon, 12 Aug 2024 15:52:50 +0800 Subject: [PATCH 024/695] add ci --- source/libs/parser/src/parTranslater.c | 59 +- .../script/tsim/stream/streamInterpOther.sim | 628 ++++++++++++++++++ 2 files changed, 678 insertions(+), 9 deletions(-) create mode 100644 tests/script/tsim/stream/streamInterpOther.sim diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index f00d1184cfd9..ce1597251f15 100755 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -9975,15 +9975,14 @@ static void getSourceDatabase(SNode* pStmt, int32_t acctId, char* pDbFName) { (void)tNameGetFullDbName(&name, pDbFName); } -static void getStreamQueryFirstProjectAliasName(SHashObj* pUserAliasSet, char* aliasName, int32_t len) { - if (NULL == taosHashGet(pUserAliasSet, "_wstart", strlen("_wstart"))) { - snprintf(aliasName, len, "%s", "_wstart"); - return; - } - if (NULL == taosHashGet(pUserAliasSet, "ts", strlen("ts"))) { - snprintf(aliasName, len, "%s", "ts"); - return; +static void getStreamQueryFirstProjectAliasName(SHashObj* pUserAliasSet, char* aliasName, int32_t len, char* defaultName[], int32_t defaultNum) { + for (int32_t i = 0; i < defaultNum; i++) { + if (NULL == taosHashGet(pUserAliasSet, defaultName[i], strlen(defaultName[i]))) { + snprintf(aliasName, len, "%s", defaultName[i]); + return; + } } + do { taosRandStr(aliasName, len - 1); aliasName[len - 1] = '\0'; @@ -10002,6 +10001,44 @@ static int32_t setColumnDefNodePrimaryKey(SColumnDefNode* pNode, bool isPk) { return code; } +static int32_t addTsToCreateStreamQueryImpl(STranslateContext* pCxt, SSelectStmt* pSelect, + SHashObj* pUserAliasSet, SNodeList* pCols, SCMCreateStreamReq* pReq) { + SNode* pProj = nodesListGetNode(pSelect->pProjectionList, 0); + if (!pSelect->hasInterpFunc || + (QUERY_NODE_FUNCTION == nodeType(pProj) && 0 == strcmp("_irowts", ((SFunctionNode*)pProj)->functionName))) { + return TSDB_CODE_SUCCESS; + } + SFunctionNode* pFunc = NULL; + int32_t code = nodesMakeNode(QUERY_NODE_FUNCTION, (SNode**)&pFunc); + if (NULL == pFunc) { + return code; + } + strcpy(pFunc->functionName, "_irowts"); + char* defaultName[] = {"_irowts"}; + getStreamQueryFirstProjectAliasName(pUserAliasSet, pFunc->node.aliasName, sizeof(pFunc->node.aliasName), defaultName, sizeof(defaultName)); + code = getFuncInfo(pCxt, pFunc); + if (TSDB_CODE_SUCCESS == code) { + code = nodesListPushFront(pSelect->pProjectionList, (SNode*)pFunc); + } + + if (TSDB_CODE_SUCCESS == code && STREAM_CREATE_STABLE_TRUE == pReq->createStb) { + SColumnDefNode* pColDef = NULL; + code = nodesMakeNode(QUERY_NODE_COLUMN_DEF, (SNode**)&pColDef); + if (TSDB_CODE_SUCCESS == code) { + strcpy(pColDef->colName, pFunc->node.aliasName); + pColDef->dataType = pFunc->node.resType; + pColDef->sma = true; + code = setColumnDefNodePrimaryKey(pColDef, false); + } + if (TSDB_CODE_SUCCESS == code) code = nodesListPushFront(pCols, (SNode*)pColDef); + if (TSDB_CODE_SUCCESS != code) nodesDestroyNode((SNode*)pColDef); + } + if (TSDB_CODE_SUCCESS != code) { + nodesDestroyNode((SNode*)pFunc); + } + return code; +} + static int32_t addWstartTsToCreateStreamQueryImpl(STranslateContext* pCxt, SSelectStmt* pSelect, SHashObj* pUserAliasSet, SNodeList* pCols, SCMCreateStreamReq* pReq) { SNode* pProj = nodesListGetNode(pSelect->pProjectionList, 0); @@ -10015,7 +10052,8 @@ static int32_t addWstartTsToCreateStreamQueryImpl(STranslateContext* pCxt, SSele return code; } strcpy(pFunc->functionName, "_wstart"); - getStreamQueryFirstProjectAliasName(pUserAliasSet, pFunc->node.aliasName, sizeof(pFunc->node.aliasName)); + char* defaultName[] = {"_wstart", "ts"}; + getStreamQueryFirstProjectAliasName(pUserAliasSet, pFunc->node.aliasName, sizeof(pFunc->node.aliasName), defaultName, sizeof(defaultName)); code = getFuncInfo(pCxt, pFunc); if (TSDB_CODE_SUCCESS == code) { code = nodesListPushFront(pSelect->pProjectionList, (SNode*)pFunc); @@ -10047,6 +10085,9 @@ static int32_t addWstartTsToCreateStreamQuery(STranslateContext* pCxt, SNode* pS if (TSDB_CODE_SUCCESS == code) { code = addWstartTsToCreateStreamQueryImpl(pCxt, pSelect, pUserAliasSet, pCols, pReq); } + if (TSDB_CODE_SUCCESS == code) { + code = addTsToCreateStreamQueryImpl(pCxt, pSelect, pUserAliasSet, pCols, pReq); + } taosHashCleanup(pUserAliasSet); return code; } diff --git a/tests/script/tsim/stream/streamInterpOther.sim b/tests/script/tsim/stream/streamInterpOther.sim new file mode 100644 index 000000000000..31e1e3af635a --- /dev/null +++ b/tests/script/tsim/stream/streamInterpOther.sim @@ -0,0 +1,628 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sleep 50 +sql connect + +print step1 +print =============== create database +sql create database test vgroups 4; +sql use test; + +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stream streams1_1 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt1_1 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(prev); +sql create stream streams1_2 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt1_2 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(next); +sql create stream streams1_3 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt1_3 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(linear); +sql create stream streams1_4 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt1_4 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(NULL); +sql create stream streams1_5 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt1_5 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(value,11,22,33,44); + +run tsim/stream/checkTaskStatus.sim + +sql insert into t1 values(1648791215000,0,0,0,0.0); + +sql insert into t1 values(1648791212000,10,10,10,10.0); + +$loop_count = 0 +loop0: + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +sleep 300 + +print sql desc streamt1_1; +sql desc streamt1_1; + +if $rows != 9 then + print ======rows=$rows + goto loop0 +endi + +sql desc streamt1_2; + +if $rows != 9 then + print ======rows=$rows + goto loop0 +endi + +sql desc streamt1_3; + +if $rows != 9 then + print ======rows=$rows + goto loop0 +endi + +sql desc streamt1_4; + +if $rows != 9 then + print ======rows=$rows + goto loop0 +endi + +sql desc streamt1_5; + +if $rows != 9 then + print ======rows=$rows + goto loop0 +endi + +$loop_count = 0 +loop0_1: + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +sleep 300 + +print sql select * from streamt1_1; +sql select * from streamt1_1; + +if $rows != 4 then + print ======rows=$rows + goto loop0_1 +endi + +print sql select * from streamt1_2; +sql select * from streamt1_2; + +if $rows != 4 then + print ======rows=$rows + goto loop0_1 +endi + +print sql select * from streamt1_3; +sql select * from streamt1_3; + +if $rows != 4 then + print ======rows=$rows + goto loop0_1 +endi + +print sql select * from streamt1_4; +sql select * from streamt1_4; + +if $rows != 4 then + print ======rows=$rows + goto loop0_1 +endi + +print sql select * from streamt1_5; +sql select * from streamt1_5; + +if $rows != 4 then + print ======rows=$rows + goto loop0_1 +endi + +print sql select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 range(1648791212000, 1648791215000) every(1s) fill(value,11,22,33,44); +sql select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 range(1648791212000, 1648791215000) every(1s) fill(value,11,22,33,44); + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 + +$loop_count = 0 +loop0_2: + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +sleep 300 + +print sql select * from streamt1_5; +sql select * from streamt1_5; + +if $data01 != 10 then + print ======data01=$data01 + goto loop0_2 +endi + +if $data02 != 0 then + print ======data02=$data02 + goto loop0_2 +endi + +if $data03 != 10 then + print ======data03=$data03 + goto loop0_2 +endi + +if $data04 != 0 then + print ======data04=$data04 + goto loop0_2 +endi + +if $data05 != 10 then + print ======data05=$data05 + goto loop0_2 +endi + +if $data06 != 0 then + print ======data06=$data06 + goto loop0_2 +endi + +if $data07 != 10.000000000 then + print ======data07=$data07 + goto loop0_2 +endi + +if $data11 != 11 then + print ======data11=$data11 + goto loop0_2 +endi + +if $data12 != 1 then + print ======data12=$data12 + goto loop0_2 +endi + +if $data13 != 22 then + print ======data13=$data13 + goto loop0_2 +endi + +if $data14 != 1 then + print ======data14=$data14 + goto loop0_2 +endi + +if $data15 != 33 then + print ======data15=$data15 + goto loop0_2 +endi + +if $data16 != 1 then + print ======data16=$data16 + goto loop0_2 +endi + +if $data17 != 44.000000000 then + print ======data17=$data17 + goto loop0_2 +endi + +print step2 + +sql create database test2 vgroups 1; +sql use test2; + +sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int); +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); + +sql_error create stream streams2_1_1 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_1 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 range(1648791212000, 1648791215000) every(1s) fill(prev); +sql_error create stream streams2_1_2 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_2 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 range(1648791212000, 1648791215000) every(1s) fill(next); +sql_error create stream streams2_1_3 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_3 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 range(1648791212000, 1648791215000) every(1s) fill(linear); +sql_error create stream streams2_1_4 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_4 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 range(1648791212000, 1648791215000) every(1s) fill(NULL); +sql_error create stream streams2_1_5 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_5 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 range(1648791212000, 1648791215000) every(1s) fill(value,11,22,33,44); + +sql_error create stream streams2_2_1 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt1_1 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from st every(1s) fill(prev); +sql_error create stream streams2_2_2 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt1_2 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from st every(1s) fill(next); +sql_error create stream streams2_2_3 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt1_3 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from st every(1s) fill(linear); +sql_error create stream streams2_2_4 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt1_4 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from st every(1s) fill(NULL); +sql_error create stream streams2_2_5 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt1_5 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from st every(1s) fill(value,11,22,33,44); + +sql_error create stream streams2_3_1 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_1 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from st prartition by a every(1s) fill(prev); +sql_error create stream streams2_3_2 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_2 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from st prartition by a every(1s) fill(next); +sql_error create stream streams2_3_3 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_3 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from st prartition by a every(1s) fill(linear); +sql_error create stream streams2_3_4 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_4 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from st prartition by a every(1s) fill(NULL); +sql_error create stream streams2_3_5 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_5 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from st prartition by a every(1s) fill(value,11,22,33,44); + +sql_error create stream streams2_4_1 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt3_1 as select INTERP(a) FROM t1 RANGE('2023-01-01 00:00:00') fill(prev); +sql_error create stream streams2_4_2 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt3_2 as select INTERP(a) FROM t1 RANGE('2023-01-01 00:00:00') fill(next); +sql_error create stream streams2_4_3 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt3_3 as select INTERP(a) FROM t1 RANGE('2023-01-01 00:00:00') fill(linear); +sql_error create stream streams2_4_4 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt3_4 as select INTERP(a) FROM t1 RANGE('2023-01-01 00:00:00') fill(NULL); +sql_error create stream streams2_4_5 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt3_5 as select INTERP(a) FROM t1 RANGE('2023-01-01 00:00:00') fill(value,11,22,33,44); + +print step3 + +sql create database test3 vgroups 4; +sql use test3; + +sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int); +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); + + +sql create stream streams3_1 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt3_1 TAGS(cc varchar(100)) SUBTABLE(concat(concat("tbn-", tbname), "_1")) as select interp(a), _isfilled as a1 from st partition by tbname, b as cc every(1s) fill(prev); +sql create stream streams3_2 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt3_2 TAGS(cc varchar(100)) SUBTABLE(concat(concat("tbn-", tbname), "_2")) as select interp(a), _isfilled as a1 from st partition by tbname, b as cc every(1s) fill(next); +sql create stream streams3_3 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt3_3 TAGS(cc varchar(100)) SUBTABLE(concat(concat("tbn-", tbname), "_3")) as select interp(a), _isfilled as a1 from st partition by tbname, b as cc every(1s) fill(linear); +sql create stream streams3_4 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt3_4 TAGS(cc varchar(100)) SUBTABLE(concat(concat("tbn-", tbname), "_4")) as select interp(a), _isfilled as a1 from st partition by tbname, b as cc every(1s) fill(NULL); +sql create stream streams3_5 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt3_5 TAGS(cc varchar(100)) SUBTABLE(concat(concat("tbn-", tbname), "_5")) as select interp(a), _isfilled as a1 from st partition by tbname, b as cc every(1s) fill(value,11); + +run tsim/stream/checkTaskStatus.sim + +sql insert into t1 values(1648791217000,1,2,3); + +sleep 500 + +sql insert into t1 values(1648791212000,10,2,3); + +sleep 500 + +sql insert into t1 values(1648791215001,20,2,3); + +sleep 500 + +sql insert into t2 values(1648791215001,20,2,3); + +$loop_count = 0 +loop3: + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +sleep 300 + +print sql select cc, * from `tbn-t1_1_streamt3_1_914568691400502130`; +sql select cc, * from `tbn-t1_1_streamt3_1_914568691400502130`; + +if $rows != 6 then + print ======rows=$rows + goto loop3 +endi + +if $data00 != 2 then + print ======rows=$rows + goto loop3 +endi + +print sql select cc, * from `tbn-t1_2_streamt3_2_914568691400502130`; +sql select cc, * from `tbn-t1_2_streamt3_2_914568691400502130`; + +if $rows != 6 then + print ======rows=$rows + goto loop3 +endi + +if $data00 != 2 then + print ======rows=$rows + goto loop3 +endi + +print sql select cc, * from `tbn-t1_3_streamt3_3_914568691400502130`; +sql select cc, * from `tbn-t1_3_streamt3_3_914568691400502130`; + +if $rows != 6 then + print ======rows=$rows + goto loop3 +endi + +if $data00 != 2 then + print ======rows=$rows + goto loop3 +endi + +print sql select cc, * from `tbn-t1_4_streamt3_4_914568691400502130`; +sql select cc, * from `tbn-t1_4_streamt3_4_914568691400502130`; + +if $rows != 6 then + print ======rows=$rows + goto loop3 +endi + +if $data00 != 2 then + print ======rows=$rows + goto loop3 +endi + +print sql select cc, * from `tbn-t1_5_streamt3_5_914568691400502130`; +sql select cc, * from `tbn-t1_5_streamt3_5_914568691400502130`; + +if $rows != 6 then + print ======rows=$rows + goto loop3 +endi + +if $data00 != 2 then + print ======rows=$rows + goto loop3 +endi + + + +print sql select * from `tbn-t2_1_streamt3_1_8905952758123525205`; +sql select * from `tbn-t2_1_streamt3_1_8905952758123525205`; + +if $rows != 0 then + print ======rows=$rows + goto loop3 +endi + +print sql select * from `tbn-t2_2_streamt3_2_8905952758123525205`; +sql select * from `tbn-t2_2_streamt3_2_8905952758123525205`; + +if $rows != 0 then + print ======rows=$rows + goto loop3 +endi + +print sql select * from `tbn-t2_3_streamt3_3_8905952758123525205`; +sql select * from `tbn-t2_3_streamt3_3_8905952758123525205`; + +if $rows != 0 then + print ======rows=$rows + goto loop3 +endi + +print sql select * from `tbn-t2_4_streamt3_4_8905952758123525205`; +sql select * from `tbn-t2_4_streamt3_4_8905952758123525205`; + +if $rows != 0 then + print ======rows=$rows + goto loop3 +endi + +print sql select * from `tbn-t2_5_streamt3_5_8905952758123525205`; +sql select * from `tbn-t2_5_streamt3_5_8905952758123525205`; + +if $rows != 0 then + print ======rows=$rows + goto loop3 +endi + +print step4 + +sql create database test4 vgroups 4; +sql use test4; + +sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int); +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); + +sql create stable streamt4_1(ts timestamp,a varchar(10),b tinyint,c tinyint) tags(ta int,cc int,tc int); +sql create stable streamt4_2(ts timestamp,a varchar(10),b tinyint,c tinyint) tags(ta int,cc int,tc int); +sql create stable streamt4_3(ts timestamp,a varchar(10),b tinyint,c tinyint) tags(ta int,cc int,tc int); +sql create stable streamt4_4(ts timestamp,a varchar(10),b tinyint,c tinyint) tags(ta int,cc int,tc int); +sql create stable streamt4_5(ts timestamp,a varchar(10),b tinyint,c tinyint) tags(ta int,cc int,tc int); + +sql create stream streams4_1 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt4_1(ts, b, a) TAGS(cc) SUBTABLE(concat(concat("tbn-", tbname), "_1")) as select _irowts, interp(a), _isfilled as a1 from st partition by tbname, b as cc every(1s) fill(prev); +sql create stream streams4_2 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt4_2(ts, b, a) TAGS(cc) SUBTABLE(concat(concat("tbn-", tbname), "_2")) as select _irowts, interp(a), _isfilled as a1 from st partition by tbname, b as cc every(1s) fill(next); +sql create stream streams4_3 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt4_3(ts, b, a) TAGS(cc) SUBTABLE(concat(concat("tbn-", tbname), "_3")) as select _irowts, interp(a), _isfilled as a1 from st partition by tbname, b as cc every(1s) fill(linear); +sql create stream streams4_4 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt4_4(ts, b, a) TAGS(cc) SUBTABLE(concat(concat("tbn-", tbname), "_4")) as select _irowts, interp(a), _isfilled as a1 from st partition by tbname, b as cc every(1s) fill(NULL); +sql create stream streams4_5 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt4_5(ts, b, a) TAGS(cc) SUBTABLE(concat(concat("tbn-", tbname), "_5")) as select _irowts, interp(a), _isfilled as a1 from st partition by tbname, b as cc every(1s) fill(value,1100); + +run tsim/stream/checkTaskStatus.sim + +sql insert into t1 values(1648791217000,20000,2,3); + +sleep 500 + +sql insert into t1 values(1648791212000,10000,2,3); + +sleep 500 + +sql insert into t1 values(1648791215001,20,2,3); + +$loop_count = 0 +loop4: + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +sleep 300 + +print sql select a,b from streamt4_1; +sql select a,b from streamt4_1; + +if $rows != 6 then + print ======rows=$rows + goto loop4 +endi + +if $data00 != false then + print ======data00=$data00 + goto loop4 +endi + +if $data01 != 16 then + print ======data01=$data01 + goto loop4 +endi + +if $data10 != true then + print ======data10=$data10 + goto loop4 +endi + +if $data20 != true then + print ======data20=$data20 + goto loop4 +endi + +if $data50 != false then + print ======data50=$data50 + goto loop4 +endi + +if $data51 != 32 then + print ======data51=$data51 + goto loop4 +endi + +print sql select a,b from streamt4_2; +sql select a,b from streamt4_2; + +if $rows != 6 then + print ======rows=$rows + goto loop4 +endi + +if $data00 != false then + print ======data00=$data00 + goto loop4 +endi + +if $data01 != 16 then + print ======data01=$data01 + goto loop4 +endi + +if $data10 != true then + print ======data10=$data10 + goto loop4 +endi + +if $data20 != true then + print ======data20=$data20 + goto loop4 +endi + +if $data50 != false then + print ======data50=$data50 + goto loop4 +endi + +if $data51 != 32 then + print ======data51=$data51 + goto loop4 +endi + +print sql select a,b from streamt4_3; +sql select a,b from streamt4_3; + +if $rows != 6 then + print ======rows=$rows + goto loop4 +endi + +if $data00 != false then + print ======data00=$data00 + goto loop4 +endi + +if $data01 != 16 then + print ======data01=$data01 + goto loop4 +endi + +if $data10 != true then + print ======data10=$data10 + goto loop4 +endi + +if $data20 != true then + print ======data20=$data20 + goto loop4 +endi + +if $data50 != false then + print ======data50=$data50 + goto loop4 +endi + +if $data51 != 32 then + print ======data51=$data51 + goto loop4 +endi + +print sql select a,b from streamt4_4; +sql select a,b from streamt4_4; + +if $rows != 6 then + print ======rows=$rows + goto loop4 +endi + +if $data00 != false then + print ======data00=$data00 + goto loop4 +endi + +if $data01 != 16 then + print ======data01=$data01 + goto loop4 +endi + +if $data10 != true then + print ======data10=$data10 + goto loop4 +endi + +if $data20 != true then + print ======data20=$data20 + goto loop4 +endi + +if $data50 != false then + print ======data50=$data50 + goto loop4 +endi + +if $data51 != 32 then + print ======data51=$data51 + goto loop4 +endi + +print sql select a,b from streamt4_5; +sql select a,b from streamt4_5; + +if $rows != 6 then + print ======rows=$rows + goto loop4 +endi + +if $data00 != false then + print ======data00=$data00 + goto loop4 +endi + +if $data01 != 16 then + print ======data01=$data01 + goto loop4 +endi + +if $data10 != true then + print ======data10=$data10 + goto loop4 +endi + +if $data20 != true then + print ======data20=$data20 + goto loop4 +endi + +if $data50 != false then + print ======data50=$data50 + goto loop4 +endi + +if $data51 != 32 then + print ======data51=$data51 + goto loop4 +endi +system sh/exec.sh -n dnode1 -s stop -x SIGINT From 575eee86282e1ea1b8d5cd0af45e4d36f5687b01 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Mon, 12 Aug 2024 16:18:03 +0800 Subject: [PATCH 025/695] add ci --- .../script/tsim/stream/streamInterpOther.sim | 232 ------------ .../script/tsim/stream/streamInterpOther1.sim | 335 ++++++++++++++++++ 2 files changed, 335 insertions(+), 232 deletions(-) create mode 100644 tests/script/tsim/stream/streamInterpOther1.sim diff --git a/tests/script/tsim/stream/streamInterpOther.sim b/tests/script/tsim/stream/streamInterpOther.sim index 31e1e3af635a..c135a319925c 100644 --- a/tests/script/tsim/stream/streamInterpOther.sim +++ b/tests/script/tsim/stream/streamInterpOther.sim @@ -393,236 +393,4 @@ if $rows != 0 then goto loop3 endi -print step4 - -sql create database test4 vgroups 4; -sql use test4; - -sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int); -sql create table t1 using st tags(1,1,1); -sql create table t2 using st tags(2,2,2); - -sql create stable streamt4_1(ts timestamp,a varchar(10),b tinyint,c tinyint) tags(ta int,cc int,tc int); -sql create stable streamt4_2(ts timestamp,a varchar(10),b tinyint,c tinyint) tags(ta int,cc int,tc int); -sql create stable streamt4_3(ts timestamp,a varchar(10),b tinyint,c tinyint) tags(ta int,cc int,tc int); -sql create stable streamt4_4(ts timestamp,a varchar(10),b tinyint,c tinyint) tags(ta int,cc int,tc int); -sql create stable streamt4_5(ts timestamp,a varchar(10),b tinyint,c tinyint) tags(ta int,cc int,tc int); - -sql create stream streams4_1 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt4_1(ts, b, a) TAGS(cc) SUBTABLE(concat(concat("tbn-", tbname), "_1")) as select _irowts, interp(a), _isfilled as a1 from st partition by tbname, b as cc every(1s) fill(prev); -sql create stream streams4_2 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt4_2(ts, b, a) TAGS(cc) SUBTABLE(concat(concat("tbn-", tbname), "_2")) as select _irowts, interp(a), _isfilled as a1 from st partition by tbname, b as cc every(1s) fill(next); -sql create stream streams4_3 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt4_3(ts, b, a) TAGS(cc) SUBTABLE(concat(concat("tbn-", tbname), "_3")) as select _irowts, interp(a), _isfilled as a1 from st partition by tbname, b as cc every(1s) fill(linear); -sql create stream streams4_4 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt4_4(ts, b, a) TAGS(cc) SUBTABLE(concat(concat("tbn-", tbname), "_4")) as select _irowts, interp(a), _isfilled as a1 from st partition by tbname, b as cc every(1s) fill(NULL); -sql create stream streams4_5 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt4_5(ts, b, a) TAGS(cc) SUBTABLE(concat(concat("tbn-", tbname), "_5")) as select _irowts, interp(a), _isfilled as a1 from st partition by tbname, b as cc every(1s) fill(value,1100); - -run tsim/stream/checkTaskStatus.sim - -sql insert into t1 values(1648791217000,20000,2,3); - -sleep 500 - -sql insert into t1 values(1648791212000,10000,2,3); - -sleep 500 - -sql insert into t1 values(1648791215001,20,2,3); - -$loop_count = 0 -loop4: - -$loop_count = $loop_count + 1 -if $loop_count == 10 then - return -1 -endi - -sleep 300 - -print sql select a,b from streamt4_1; -sql select a,b from streamt4_1; - -if $rows != 6 then - print ======rows=$rows - goto loop4 -endi - -if $data00 != false then - print ======data00=$data00 - goto loop4 -endi - -if $data01 != 16 then - print ======data01=$data01 - goto loop4 -endi - -if $data10 != true then - print ======data10=$data10 - goto loop4 -endi - -if $data20 != true then - print ======data20=$data20 - goto loop4 -endi - -if $data50 != false then - print ======data50=$data50 - goto loop4 -endi - -if $data51 != 32 then - print ======data51=$data51 - goto loop4 -endi - -print sql select a,b from streamt4_2; -sql select a,b from streamt4_2; - -if $rows != 6 then - print ======rows=$rows - goto loop4 -endi - -if $data00 != false then - print ======data00=$data00 - goto loop4 -endi - -if $data01 != 16 then - print ======data01=$data01 - goto loop4 -endi - -if $data10 != true then - print ======data10=$data10 - goto loop4 -endi - -if $data20 != true then - print ======data20=$data20 - goto loop4 -endi - -if $data50 != false then - print ======data50=$data50 - goto loop4 -endi - -if $data51 != 32 then - print ======data51=$data51 - goto loop4 -endi - -print sql select a,b from streamt4_3; -sql select a,b from streamt4_3; - -if $rows != 6 then - print ======rows=$rows - goto loop4 -endi - -if $data00 != false then - print ======data00=$data00 - goto loop4 -endi - -if $data01 != 16 then - print ======data01=$data01 - goto loop4 -endi - -if $data10 != true then - print ======data10=$data10 - goto loop4 -endi - -if $data20 != true then - print ======data20=$data20 - goto loop4 -endi - -if $data50 != false then - print ======data50=$data50 - goto loop4 -endi - -if $data51 != 32 then - print ======data51=$data51 - goto loop4 -endi - -print sql select a,b from streamt4_4; -sql select a,b from streamt4_4; - -if $rows != 6 then - print ======rows=$rows - goto loop4 -endi - -if $data00 != false then - print ======data00=$data00 - goto loop4 -endi - -if $data01 != 16 then - print ======data01=$data01 - goto loop4 -endi - -if $data10 != true then - print ======data10=$data10 - goto loop4 -endi - -if $data20 != true then - print ======data20=$data20 - goto loop4 -endi - -if $data50 != false then - print ======data50=$data50 - goto loop4 -endi - -if $data51 != 32 then - print ======data51=$data51 - goto loop4 -endi - -print sql select a,b from streamt4_5; -sql select a,b from streamt4_5; - -if $rows != 6 then - print ======rows=$rows - goto loop4 -endi - -if $data00 != false then - print ======data00=$data00 - goto loop4 -endi - -if $data01 != 16 then - print ======data01=$data01 - goto loop4 -endi - -if $data10 != true then - print ======data10=$data10 - goto loop4 -endi - -if $data20 != true then - print ======data20=$data20 - goto loop4 -endi - -if $data50 != false then - print ======data50=$data50 - goto loop4 -endi - -if $data51 != 32 then - print ======data51=$data51 - goto loop4 -endi system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/stream/streamInterpOther1.sim b/tests/script/tsim/stream/streamInterpOther1.sim new file mode 100644 index 000000000000..045da1ce84c7 --- /dev/null +++ b/tests/script/tsim/stream/streamInterpOther1.sim @@ -0,0 +1,335 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sleep 50 +sql connect + +print step4 + +sql create database test4_1 vgroups 4; +sql use test4_1; + +sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int); +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); + +sql create stable streamt4_1(ts timestamp,a varchar(10),b tinyint,c tinyint) tags(ta int,cc int,tc int); + +sql create stream streams4_1 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt4_1(ts, b, a) TAGS(cc) SUBTABLE(concat(concat("tbn-", tbname), "_1")) as select _irowts, interp(a), _isfilled as a1 from st partition by tbname, b as cc every(1s) fill(prev); + +run tsim/stream/checkTaskStatus.sim + +sql insert into t1 values(1648791217000,20000,2,3); + +sleep 500 + +sql insert into t1 values(1648791212000,10000,2,3); + +sleep 500 + +sql insert into t1 values(1648791215001,20,2,3); + +$loop_count = 0 +loop4_1: + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +sleep 300 + +print sql select a,b from streamt4_1; +sql select a,b from streamt4_1; + +if $rows != 6 then + print ======rows=$rows + goto loop4_1 +endi + +if $data00 != false then + print ======data00=$data00 + goto loop4_1 +endi + +if $data01 != 16 then + print ======data01=$data01 + goto loop4_1 +endi + +if $data10 != true then + print ======data10=$data10 + goto loop4_1 +endi + +if $data20 != true then + print ======data20=$data20 + goto loop4_1 +endi + +if $data50 != false then + print ======data50=$data50 + goto loop4_1 +endi + +if $data51 != 32 then + print ======data51=$data51 + goto loop4_1 +endi + +sql create database test4_2 vgroups 4; +sql use test4_2; + +sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int); +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); + +sql create stable streamt4_2(ts timestamp,a varchar(10),b tinyint,c tinyint) tags(ta int,cc int,tc int); + +sql create stream streams4_2 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt4_2(ts, b, a) TAGS(cc) SUBTABLE(concat(concat("tbn-", tbname), "_2")) as select _irowts, interp(a), _isfilled as a1 from st partition by tbname, b as cc every(1s) fill(next); + +run tsim/stream/checkTaskStatus.sim + +sql insert into t1 values(1648791217000,20000,2,3); + +sleep 500 + +sql insert into t1 values(1648791212000,10000,2,3); + +sleep 500 + +sql insert into t1 values(1648791215001,20,2,3); + +$loop_count = 0 +loop4_2: + +print sql select a,b from streamt4_2; +sql select a,b from streamt4_2; + +if $rows != 6 then + print ======rows=$rows + goto loop4_2 +endi + +if $data00 != false then + print ======data00=$data00 + goto loop4_2 +endi + +if $data01 != 16 then + print ======data01=$data01 + goto loop4_2 +endi + +if $data10 != true then + print ======data10=$data10 + goto loop4_2 +endi + +if $data20 != true then + print ======data20=$data20 + goto loop4_2 +endi + +if $data50 != false then + print ======data50=$data50 + goto loop4_2 +endi + +if $data51 != 32 then + print ======data51=$data51 + goto loop4_2 +endi + +sql create database test4_3 vgroups 4; +sql use test4_3; + +sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int); +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); + +sql create stable streamt4_3(ts timestamp,a varchar(10),b tinyint,c tinyint) tags(ta int,cc int,tc int); + +sql create stream streams4_3 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt4_3(ts, b, a) TAGS(cc) SUBTABLE(concat(concat("tbn-", tbname), "_3")) as select _irowts, interp(a), _isfilled as a1 from st partition by tbname, b as cc every(1s) fill(linear); + +run tsim/stream/checkTaskStatus.sim + +sql insert into t1 values(1648791217000,20000,2,3); + +sleep 500 + +sql insert into t1 values(1648791212000,10000,2,3); + +sleep 500 + +sql insert into t1 values(1648791215001,20,2,3); + +$loop_count = 0 +loop4_3: + +print sql select a,b from streamt4_3; +sql select a,b from streamt4_3; + +if $rows != 6 then + print ======rows=$rows + goto loop4_3 +endi + +if $data00 != false then + print ======data00=$data00 + goto loop4_3 +endi + +if $data01 != 16 then + print ======data01=$data01 + goto loop4_3 +endi + +if $data10 != true then + print ======data10=$data10 + goto loop4_3 +endi + +if $data20 != true then + print ======data20=$data20 + goto loop4_3 +endi + +if $data50 != false then + print ======data50=$data50 + goto loop4_3 +endi + +if $data51 != 32 then + print ======data51=$data51 + goto loop4_3 +endi + +sql create database test4_4 vgroups 4; +sql use test4_4; + +sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int); +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); + +sql create stable streamt4_4(ts timestamp,a varchar(10),b tinyint,c tinyint) tags(ta int,cc int,tc int); + +sql create stream streams4_4 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt4_4(ts, b, a) TAGS(cc) SUBTABLE(concat(concat("tbn-", tbname), "_4")) as select _irowts, interp(a), _isfilled as a1 from st partition by tbname, b as cc every(1s) fill(NULL); + +run tsim/stream/checkTaskStatus.sim + +sql insert into t1 values(1648791217000,20000,2,3); + +sleep 500 + +sql insert into t1 values(1648791212000,10000,2,3); + +sleep 500 + +sql insert into t1 values(1648791215001,20,2,3); + +$loop_count = 0 +loop4_4: + +print sql select a,b from streamt4_4; +sql select a,b from streamt4_4; + +if $rows != 6 then + print ======rows=$rows + goto loop4_4 +endi + +if $data00 != false then + print ======data00=$data00 + goto loop4_4 +endi + +if $data01 != 16 then + print ======data01=$data01 + goto loop4_4 +endi + +if $data10 != true then + print ======data10=$data10 + goto loop4_4 +endi + +if $data20 != true then + print ======data20=$data20 + goto loop4_4 +endi + +if $data50 != false then + print ======data50=$data50 + goto loop4_4 +endi + +if $data51 != 32 then + print ======data51=$data51 + goto loop4_4 +endi + +sql create database test4_5 vgroups 4; +sql use test4_5; + +sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int); +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); + +sql create stable streamt4_5(ts timestamp,a varchar(10),b tinyint,c tinyint) tags(ta int,cc int,tc int); + +sql create stream streams4_5 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt4_5(ts, b, a) TAGS(cc) SUBTABLE(concat(concat("tbn-", tbname), "_5")) as select _irowts, interp(a), _isfilled as a1 from st partition by tbname, b as cc every(1s) fill(value,1100); + +run tsim/stream/checkTaskStatus.sim + +sql insert into t1 values(1648791217000,20000,2,3); + +sleep 500 + +sql insert into t1 values(1648791212000,10000,2,3); + +sleep 500 + +sql insert into t1 values(1648791215001,20,2,3); + +$loop_count = 0 +loop4_5: + +print sql select a,b from streamt4_5; +sql select a,b from streamt4_5; + +if $rows != 6 then + print ======rows=$rows + goto loop4_5 +endi + +if $data00 != false then + print ======data00=$data00 + goto loop4_5 +endi + +if $data01 != 16 then + print ======data01=$data01 + goto loop4_5 +endi + +if $data10 != true then + print ======data10=$data10 + goto loop4_5 +endi + +if $data20 != true then + print ======data20=$data20 + goto loop4_5 +endi + +if $data50 != false then + print ======data50=$data50 + goto loop4_5 +endi + +if $data51 != 32 then + print ======data51=$data51 + goto loop4_5 +endi +system sh/exec.sh -n dnode1 -s stop -x SIGINT From 3e763f5ede0eb020977aea209be29fbeb7feb0aa Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Mon, 12 Aug 2024 17:40:44 +0800 Subject: [PATCH 026/695] fix issue --- source/libs/parser/src/parTranslater.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index ce1597251f15..4b89c5aba5c0 100755 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -10001,7 +10001,7 @@ static int32_t setColumnDefNodePrimaryKey(SColumnDefNode* pNode, bool isPk) { return code; } -static int32_t addTsToCreateStreamQueryImpl(STranslateContext* pCxt, SSelectStmt* pSelect, +static int32_t addIrowTsToCreateStreamQueryImpl(STranslateContext* pCxt, SSelectStmt* pSelect, SHashObj* pUserAliasSet, SNodeList* pCols, SCMCreateStreamReq* pReq) { SNode* pProj = nodesListGetNode(pSelect->pProjectionList, 0); if (!pSelect->hasInterpFunc || @@ -10014,6 +10014,7 @@ static int32_t addTsToCreateStreamQueryImpl(STranslateContext* pCxt, SSelectStmt return code; } strcpy(pFunc->functionName, "_irowts"); + strcpy(pFunc->node.userAlias, "_irowts"); char* defaultName[] = {"_irowts"}; getStreamQueryFirstProjectAliasName(pUserAliasSet, pFunc->node.aliasName, sizeof(pFunc->node.aliasName), defaultName, sizeof(defaultName)); code = getFuncInfo(pCxt, pFunc); @@ -10052,6 +10053,7 @@ static int32_t addWstartTsToCreateStreamQueryImpl(STranslateContext* pCxt, SSele return code; } strcpy(pFunc->functionName, "_wstart"); + strcpy(pFunc->node.userAlias, "_irowts"); char* defaultName[] = {"_wstart", "ts"}; getStreamQueryFirstProjectAliasName(pUserAliasSet, pFunc->node.aliasName, sizeof(pFunc->node.aliasName), defaultName, sizeof(defaultName)); code = getFuncInfo(pCxt, pFunc); @@ -10077,7 +10079,7 @@ static int32_t addWstartTsToCreateStreamQueryImpl(STranslateContext* pCxt, SSele return code; } -static int32_t addWstartTsToCreateStreamQuery(STranslateContext* pCxt, SNode* pStmt, SNodeList* pCols, +static int32_t addTsKeyToCreateStreamQuery(STranslateContext* pCxt, SNode* pStmt, SNodeList* pCols, SCMCreateStreamReq* pReq) { SSelectStmt* pSelect = (SSelectStmt*)pStmt; SHashObj* pUserAliasSet = NULL; @@ -10086,7 +10088,7 @@ static int32_t addWstartTsToCreateStreamQuery(STranslateContext* pCxt, SNode* pS code = addWstartTsToCreateStreamQueryImpl(pCxt, pSelect, pUserAliasSet, pCols, pReq); } if (TSDB_CODE_SUCCESS == code) { - code = addTsToCreateStreamQueryImpl(pCxt, pSelect, pUserAliasSet, pCols, pReq); + code = addIrowTsToCreateStreamQueryImpl(pCxt, pSelect, pUserAliasSet, pCols, pReq); } taosHashCleanup(pUserAliasSet); return code; @@ -10970,7 +10972,7 @@ static int32_t buildCreateStreamQuery(STranslateContext* pCxt, SCreateStreamStmt code = addColsToCreateStreamQuery(pCxt, pStmt, pReq); } if (TSDB_CODE_SUCCESS == code) { - code = addWstartTsToCreateStreamQuery(pCxt, pStmt->pQuery, pStmt->pCols, pReq); + code = addTsKeyToCreateStreamQuery(pCxt, pStmt->pQuery, pStmt->pCols, pReq); } if (TSDB_CODE_SUCCESS == code) { code = checkStreamQuery(pCxt, pStmt); From 5a2b89c35737d5729faaed4cff58ecda460cd134 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Tue, 13 Aug 2024 14:05:16 +0800 Subject: [PATCH 027/695] fix issue --- source/libs/executor/inc/streamexecutorInt.h | 1 - source/libs/executor/src/streamfilloperator.c | 2 +- .../executor/src/streamtimesliceoperator.c | 25 +- .../script/tsim/stream/streamInterpOther2.sim | 525 ++++++++++++++++++ 4 files changed, 546 insertions(+), 7 deletions(-) create mode 100644 tests/script/tsim/stream/streamInterpOther2.sim diff --git a/source/libs/executor/inc/streamexecutorInt.h b/source/libs/executor/inc/streamexecutorInt.h index 869623417d76..c02c3bcd4a93 100644 --- a/source/libs/executor/inc/streamexecutorInt.h +++ b/source/libs/executor/inc/streamexecutorInt.h @@ -41,7 +41,6 @@ int32_t saveWinResult(SWinKey* pKey, SRowBuffPos* pPos, SSHashObj* pUpdatedMap); void doBuildDeleteResultImpl(SStateStore* pAPI, SStreamState* pState, SArray* pWins, int32_t* index, SSDataBlock* pBlock); -int32_t initResultBuf(SStreamFillSupporter* pFillSup); SStreamFillInfo* initStreamFillInfo(SStreamFillSupporter* pFillSup, SSDataBlock* pRes); SResultCellData* getResultCell(SResultRowData* pRaw, int32_t index); diff --git a/source/libs/executor/src/streamfilloperator.c b/source/libs/executor/src/streamfilloperator.c index 8df5c004ebdb..7c7b800b71a7 100644 --- a/source/libs/executor/src/streamfilloperator.c +++ b/source/libs/executor/src/streamfilloperator.c @@ -1166,7 +1166,7 @@ static SSDataBlock* doStreamFill(SOperatorInfo* pOperator) { return pRes; } -int32_t initResultBuf(SStreamFillSupporter* pFillSup) { +static int32_t initResultBuf(SStreamFillSupporter* pFillSup) { pFillSup->rowSize = sizeof(SResultCellData) * pFillSup->numOfAllCols; for (int i = 0; i < pFillSup->numOfAllCols; i++) { SFillColInfo* pCol = &pFillSup->pAllColInfo[i]; diff --git a/source/libs/executor/src/streamtimesliceoperator.c b/source/libs/executor/src/streamtimesliceoperator.c index ddc414d222c9..7a17b2d4b528 100644 --- a/source/libs/executor/src/streamtimesliceoperator.c +++ b/source/libs/executor/src/streamtimesliceoperator.c @@ -256,7 +256,21 @@ int32_t doStreamTimeSliceDecodeOpState(void* buf, int32_t len, SOperatorInfo* pO return code; } -static int32_t initTimeSliceFillSup(SStreamInterpFuncPhysiNode* pPhyFillNode, SExprInfo* pExprInfo, int32_t numOfExprs, +static int32_t initTimeSliceResultBuf(SStreamFillSupporter* pFillSup, SExprSupp* pExpSup) { + pFillSup->rowSize = sizeof(TSKEY) + getResultRowSize(pExpSup->pCtx, pFillSup->numOfAllCols); + pFillSup->next.key = INT64_MIN; + pFillSup->nextNext.key = INT64_MIN; + pFillSup->prev.key = INT64_MIN; + pFillSup->cur.key = INT64_MIN; + pFillSup->next.pRowVal = NULL; + pFillSup->nextNext.pRowVal = NULL; + pFillSup->prev.pRowVal = NULL; + pFillSup->cur.pRowVal = NULL; + + return TSDB_CODE_SUCCESS; +} + +static int32_t initTimeSliceFillSup(SStreamInterpFuncPhysiNode* pPhyFillNode, SExprSupp* pExprSup, int32_t numOfExprs, SStreamFillSupporter** ppResFillSup) { int32_t code = TSDB_CODE_SUCCESS; int32_t lino = 0; @@ -265,7 +279,7 @@ static int32_t initTimeSliceFillSup(SStreamInterpFuncPhysiNode* pPhyFillNode, SE pFillSup->numOfFillCols = numOfExprs; int32_t numOfNotFillCols = 0; - pFillSup->pAllColInfo = createFillColInfo(pExprInfo, pFillSup->numOfFillCols, NULL, numOfNotFillCols, + pFillSup->pAllColInfo = createFillColInfo(pExprSup->pExprInfo, pFillSup->numOfFillCols, NULL, numOfNotFillCols, (const SNodeListNode*)(pPhyFillNode->pFillValues)); QUERY_CHECK_NULL(pFillSup->pAllColInfo, code, lino, _end, terrno); @@ -283,7 +297,7 @@ static int32_t initTimeSliceFillSup(SStreamInterpFuncPhysiNode* pPhyFillNode, SE pFillSup->pResMap = tSimpleHashInit(16, hashFn); QUERY_CHECK_NULL(pFillSup->pResMap, code, lino, _end, terrno); - code = initResultBuf(pFillSup); + code = initTimeSliceResultBuf(pFillSup, pExprSup); QUERY_CHECK_CODE(code, lino, _end); pFillSup->hasDelete = false; @@ -572,7 +586,7 @@ static void setPointBuff(SSlicePoint* pPoint, SStreamFillSupporter* pFillSup) { pPoint->pLeftRow = pPoint->pRightRow; } else { setResultRowData(&pPoint->pLeftRow, pPoint->pResPos->pRowBuff); - void* pBuff = POINTER_SHIFT(pPoint->pResPos->pRowBuff, pFillSup->rowSize + sizeof(TSKEY)); + void* pBuff = POINTER_SHIFT(pPoint->pResPos->pRowBuff, pFillSup->rowSize); setResultRowData(&pPoint->pRightRow, pBuff); } } @@ -1609,7 +1623,7 @@ int32_t createStreamTimeSliceOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pInfo->primaryTsIndex = ((SColumnNode*)pInterpPhyNode->pTimeSeries)->slotId; pInfo->pFillSup = NULL; - code = initTimeSliceFillSup(pInterpPhyNode, pExprInfo, numOfExprs, &pInfo->pFillSup); + code = initTimeSliceFillSup(pInterpPhyNode, pExpSup, numOfExprs, &pInfo->pFillSup); QUERY_CHECK_CODE(code, lino, _error); int32_t ratio = 1; @@ -1659,6 +1673,7 @@ int32_t createStreamTimeSliceOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pInfo->pFillInfo = initStreamFillInfo(pInfo->pFillSup, pDownRes); copyFillValueInfo(pInfo->pFillSup, pInfo->pFillInfo); + pInfo->ignoreNull = getIgoreNullRes(pExpSup); if (pHandle) { pInfo->isHistoryOp = pHandle->fillHistory; diff --git a/tests/script/tsim/stream/streamInterpOther2.sim b/tests/script/tsim/stream/streamInterpOther2.sim new file mode 100644 index 000000000000..25d5171a5ce9 --- /dev/null +++ b/tests/script/tsim/stream/streamInterpOther2.sim @@ -0,0 +1,525 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sleep 50 +sql connect + +print step prev + +sql create database test1 vgroups 4; +sql use test1; + +sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int); +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); + +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt1 as select _irowts, _isfilled as a1, interp(b, 1) from st partition by tbname every(1s) fill(prev); + +run tsim/stream/checkTaskStatus.sim + +sql insert into t1 values(1648791217000,0,0,3) (1648791212000,10,10,3) (1648791212001,11,NULL,3); + +sleep 500 + +sql insert into t1 values(1648791214001,20,NULL,3) (1648791213000,22,NULL,3); + +print sql select _irowts, _isfilled as a1, interp(b, 1) from st partition by tbname range(1648791212000, 1648791217000) every(1s) fill(prev); +sql select _irowts, _isfilled as a1, interp(b, 1) from st partition by tbname range(1648791212000, 1648791217000) every(1s) fill(prev); + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 + +$loop_count = 0 +loop0: + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +sleep 300 + +print sql select * from streamt1; +sql select * from streamt1; + +if $rows != 6 then + print ======rows=$rows + goto loop0 +endi + +if $data01 != 0 then + print ======data01=$data01 + goto loop0 +endi + +if $data02 != 10 then + print ======data02=$data02 + goto loop0 +endi + +if $data11 != 1 then + print ======data11=$data11 + goto loop0 +endi + +if $data12 != 10 then + print ======data12=$data12 + goto loop0 +endi + +if $data21 != 1 then + print ======data21=$data21 + goto loop0 +endi + +if $data22 != 10 then + print ======data22=$data22 + goto loop0 +endi + +if $data31 != 1 then + print ======data31=$data31 + goto loop0 +endi + +if $data32 != 10 then + print ======data32=$data32 + goto loop0 +endi + +if $data41 != 1 then + print ======data41=$data41 + goto loop0 +endi + +if $data42 != 10 then + print ======data42=$data42 + goto loop0 +endi + +if $data51 != 0 then + print ======data51=$data51 + goto loop0 +endi + +if $data52 != 0 then + print ======data52=$data52 + goto loop0 +endi + +print step next + +sql create database test2 vgroups 4; +sql use test2; + +sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int); +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); + +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2 as select _irowts, _isfilled as a1, interp(b, 1) from st partition by tbname every(1s) fill(next); + +run tsim/stream/checkTaskStatus.sim + +sql insert into t1 values(1648791217000,11,11,3) (1648791212000,10,10,3) (1648791212001,11,NULL,3); + +sleep 500 + +sql insert into t1 values(1648791214001,20,NULL,3) (1648791213000,22,NULL,3); + +print sql select _irowts, _isfilled as a1, interp(b, 1) from st partition by tbname range(1648791212000, 1648791217000) every(1s) fill(next); +sql select _irowts, _isfilled as a1, interp(b, 1) from st partition by tbname range(1648791212000, 1648791217000) every(1s) fill(next); + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 + +$loop_count = 0 +loop1: + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +sleep 300 + +print sql select * from streamt2; +sql select * from streamt2; + +if $rows != 6 then + print ======rows=$rows + goto loop1 +endi + +if $data01 != 0 then + print ======data01=$data01 + goto loop1 +endi + +if $data02 != 10 then + print ======data02=$data02 + goto loop1 +endi + +if $data11 != 1 then + print ======data11=$data11 + goto loop1 +endi + +if $data12 != 11 then + print ======data12=$data12 + goto loop1 +endi + +if $data21 != 1 then + print ======data21=$data21 + goto loop1 +endi + +if $data22 != 11 then + print ======data22=$data22 + goto loop1 +endi + +if $data31 != 1 then + print ======data31=$data31 + goto loop1 +endi + +if $data32 != 11 then + print ======data32=$data32 + goto loop1 +endi + +if $data41 != 1 then + print ======data41=$data41 + goto loop1 +endi + +if $data42 != 11 then + print ======data42=$data42 + goto loop1 +endi + +if $data51 != 0 then + print ======data51=$data51 + goto loop1 +endi + +if $data52 != 11 then + print ======data52=$data52 + goto loop1 +endi + +print step value + +sql create database test3 vgroups 4; +sql use test3; + +sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int); +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); + +sql create stream streams3_1 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt3_1 as select _irowts, _isfilled as a1, interp(b, 1) from st partition by tbname every(1s) fill(NULL); +sql create stream streams3_2 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt3_2 as select _irowts, _isfilled as a1, interp(b, 1) from st partition by tbname every(1s) fill(value, 110); + +run tsim/stream/checkTaskStatus.sim + +sql insert into t1 values(1648791217000,11,11,3) (1648791212000,10,10,3) (1648791212001,11,NULL,3); + +sleep 500 + +sql insert into t1 values(1648791214001,20,NULL,3) (1648791213000,22,NULL,3); + +print sql select _irowts, _isfilled as a1, interp(b, 1) from st partition by tbname range(1648791212000, 1648791217000) every(1s) fill(NULL); +sql select _irowts, _isfilled as a1, interp(b, 1) from st partition by tbname range(1648791212000, 1648791217000) every(1s) fill(NULL); + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 + +$loop_count = 0 +loop3: + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +sleep 300 + +print sql select * from streamt3_1; +sql select * from streamt3_1; + +if $rows != 6 then + print ======rows=$rows + goto loop3 +endi + +if $data01 != 0 then + print ======data01=$data01 + goto loop3 +endi + +if $data02 != 10 then + print ======data02=$data02 + goto loop3 +endi + +if $data11 != 1 then + print ======data11=$data11 + goto loop3 +endi + +if $data12 != NULL then + print ======data12=$data12 + goto loop3 +endi + +if $data21 != 1 then + print ======data21=$data21 + goto loop3 +endi + +if $data22 != NULL then + print ======data22=$data22 + goto loop3 +endi + +if $data31 != 1 then + print ======data31=$data31 + goto loop3 +endi + +if $data32 != NULL then + print ======data32=$data32 + goto loop3 +endi + +if $data41 != 1 then + print ======data41=$data41 + goto loop3 +endi + +if $data42 != NULL then + print ======data42=$data42 + goto loop3 +endi + +if $data51 != 0 then + print ======data51=$data51 + goto loop3 +endi + +if $data52 != 11 then + print ======data52=$data52 + goto loop3 +endi + + +print sql select _irowts, _isfilled as a1, interp(b, 1) from st partition by tbname range(1648791212000, 1648791217000) every(1s) fill(value, 110); +sql select _irowts, _isfilled as a1, interp(b, 1) from st partition by tbname range(1648791212000, 1648791217000) every(1s) fill(value, 110); + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 + +$loop_count = 0 +loop3_2: + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +sleep 300 + +print sql select * from streamt3_2; +sql select * from streamt3_2; + +if $rows != 6 then + print ======rows=$rows + goto loop3_2 +endi + +if $data01 != 0 then + print ======data01=$data01 + goto loop3_2 +endi + +if $data02 != 10 then + print ======data02=$data02 + goto loop3_2 +endi + +if $data11 != 1 then + print ======data11=$data11 + goto loop3_2 +endi + +if $data12 != 110 then + print ======data12=$data12 + goto loop3_2 +endi + +if $data21 != 1 then + print ======data21=$data21 + goto loop3_2 +endi + +if $data22 != 110 then + print ======data22=$data22 + goto loop3_2 +endi + +if $data31 != 1 then + print ======data31=$data31 + goto loop3_2 +endi + +if $data32 != 110 then + print ======data32=$data32 + goto loop3_2 +endi + +if $data41 != 1 then + print ======data41=$data41 + goto loop3_2 +endi + +if $data42 != 110 then + print ======data42=$data42 + goto loop3_2 +endi + +if $data51 != 0 then + print ======data51=$data51 + goto loop3_2 +endi + +if $data52 != 11 then + print ======data52=$data52 + goto loop3_2 +endi + +print step linear + +sql create database test4 vgroups 4; +sql use test4; + +sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int); +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); + +sql create stream streams4 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt4 as select _irowts, _isfilled as a1, interp(b, 1) from st partition by tbname every(1s) fill(linear); + +run tsim/stream/checkTaskStatus.sim + +sql insert into t1 values(1648791217000,11,55,3) (1648791212000,10,10,3) (1648791212001,11,NULL,3); + +sleep 500 + +sql insert into t1 values(1648791214001,20,NULL,3) (1648791213000,22,NULL,3); + +print sql select _irowts, _isfilled as a1, interp(b, 1) from st partition by tbname range(1648791212000, 1648791217000) every(1s) fill(linear); +sql select _irowts, _isfilled as a1, interp(b, 1) from st partition by tbname range(1648791212000, 1648791217000) every(1s) fill(linear); + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 + +$loop_count = 0 +loop4: + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +sleep 300 + +print sql select * from streamt4; +sql select * from streamt4; + +if $rows != 6 then + print ======rows=$rows + goto loop4 +endi + +if $data01 != 0 then + print ======data01=$data01 + goto loop4 +endi + +if $data02 != 10 then + print ======data02=$data02 + goto loop4 +endi + +if $data11 != 1 then + print ======data11=$data11 + goto loop4 +endi + +if $data12 != 19 then + print ======data12=$data12 + goto loop4 +endi + +if $data21 != 1 then + print ======data21=$data21 + goto loop4 +endi + +if $data22 != 28 then + print ======data22=$data22 + goto loop4 +endi + +if $data31 != 1 then + print ======data31=$data31 + goto loop4 +endi + +if $data32 != 37 then + print ======data32=$data32 + goto loop4 +endi + +if $data41 != 1 then + print ======data41=$data41 + goto loop4 +endi + +if $data42 != 46 then + print ======data42=$data42 + goto loop4 +endi + +if $data51 != 0 then + print ======data51=$data51 + goto loop4 +endi + +if $data52 != 55 then + print ======data52=$data52 + goto loop4 +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT From 216c53f0aefd15904d9ff4473a9357c7825becb9 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Wed, 14 Aug 2024 15:22:42 +0800 Subject: [PATCH 028/695] fix issue --- include/libs/stream/tstreamFileState.h | 2 +- source/libs/executor/inc/tfill.h | 1 + .../executor/src/streamtimesliceoperator.c | 60 ++++++---- source/libs/parser/src/parTranslater.c | 20 +++- source/libs/stream/src/streamSliceState.c | 106 ++++++++++++++++-- .../script/tsim/stream/streamInterpError.sim | 82 ++++++++++++++ .../script/tsim/stream/streamInterpOther.sim | 33 ------ 7 files changed, 237 insertions(+), 67 deletions(-) create mode 100644 tests/script/tsim/stream/streamInterpError.sim diff --git a/include/libs/stream/tstreamFileState.h b/include/libs/stream/tstreamFileState.h index f6f3943240ac..17c01bad949b 100644 --- a/include/libs/stream/tstreamFileState.h +++ b/include/libs/stream/tstreamFileState.h @@ -134,7 +134,7 @@ int32_t hashSortFileRemoveFn(SStreamFileState* pFileState, const void* pKey); void clearSearchBuff(SStreamFileState* pFileState); int32_t getHashSortNextRow(SStreamFileState* pFileState, const SWinKey* pKey, SWinKey* pResKey, void** pVal, int32_t* pVLen, int32_t* pWinCode); -int32_t getHashSortPrevRow(SStreamFileState* pFileState, const SWinKey* pKey, SWinKey* pResKey, void** pVal, +int32_t getHashSortPrevRow(SStreamFileState* pFileState, const SWinKey* pKey, SWinKey* pResKey, void** ppVal, int32_t* pVLen, int32_t* pWinCode); int32_t recoverFillSnapshot(SStreamFileState* pFileState, int64_t ckId); void deleteHashSortRowBuff(SStreamFileState* pFileState, const SWinKey* pKey); diff --git a/source/libs/executor/inc/tfill.h b/source/libs/executor/inc/tfill.h index b659c123153f..4044cc0b9b40 100644 --- a/source/libs/executor/inc/tfill.h +++ b/source/libs/executor/inc/tfill.h @@ -107,6 +107,7 @@ typedef struct SStreamFillInfo { TSKEY current; // current Key for fill TSKEY preRowKey; TSKEY nextRowKey; + TSKEY nextPointKey; SResultRowData* pResRow; SStreamFillLinearInfo* pLinearInfo; bool needFill; diff --git a/source/libs/executor/src/streamtimesliceoperator.c b/source/libs/executor/src/streamtimesliceoperator.c index 7a17b2d4b528..7b0e316b2faf 100644 --- a/source/libs/executor/src/streamtimesliceoperator.c +++ b/source/libs/executor/src/streamtimesliceoperator.c @@ -54,15 +54,18 @@ void streamTimeSliceReleaseState(SOperatorInfo* pOperator) { int32_t code = TSDB_CODE_SUCCESS; int32_t lino = 0; SStreamTimeSliceOperatorInfo* pInfo = pOperator->info; - int32_t winSize = taosArrayGetSize(pInfo->historyWins) * sizeof(SWinKey); - int32_t resSize = winSize + sizeof(TSKEY); - char* pBuff = taosMemoryCalloc(1, resSize); + int32_t winNum = taosArrayGetSize(pInfo->historyWins); + + int32_t winSize = winNum * sizeof(SWinKey); + int32_t resSize = winSize + sizeof(TSKEY); + char* pBuff = taosMemoryCalloc(1, resSize); QUERY_CHECK_NULL(pBuff, code, lino, _end, terrno); - memcpy(pBuff, pInfo->historyWins->pData, winSize); + if (winNum > 0) { + memcpy(pBuff, pInfo->historyWins->pData, winSize); + } memcpy(pBuff + winSize, &pInfo->twAggSup.maxTs, sizeof(TSKEY)); - qDebug("===stream=== time slice operator relase state. save result count:%d", - (int32_t)taosArrayGetSize(pInfo->historyWins)); + qDebug("===stream=== time slice operator relase state. save result count:%d", winNum); pInfo->streamAggSup.stateStore.streamStateSaveInfo(pInfo->streamAggSup.pState, STREAM_TIME_SLICE_OP_STATE_NAME, strlen(STREAM_TIME_SLICE_OP_STATE_NAME), pBuff, resSize); pInfo->streamAggSup.stateStore.streamStateCommit(pInfo->streamAggSup.pState); @@ -169,6 +172,8 @@ void destroyStreamTimeSliceOperatorInfo(void* param) { tSimpleHashCleanup(pInfo->pDeletedMap); clearGroupResInfo(&pInfo->groupResInfo); + taosArrayDestroy(pInfo->historyWins); + taosMemoryFreeClear(param); } @@ -404,11 +409,11 @@ static void fillNormalRange(SStreamFillSupporter* pFillSup, SStreamFillInfo* pFi int32_t lino = 0; while (hasRemainCalc(pFillInfo) && pBlock->info.rows < pBlock->info.capacity) { STimeWindow st = {.skey = pFillInfo->current, .ekey = pFillInfo->current}; - if (inWinRange(&pFillSup->winRange, &st)) { - bool res = true; - code = fillPointResult(pFillSup, pFillInfo->pResRow, pFillInfo->current, pBlock, &res, true); - QUERY_CHECK_CODE(code, lino, _end); - } + // if (inWinRange(&pFillSup->winRange, &st)) { + bool res = true; + code = fillPointResult(pFillSup, pFillInfo->pResRow, pFillInfo->current, pBlock, &res, true); + QUERY_CHECK_CODE(code, lino, _end); + // } pFillInfo->current = taosTimeAdd(pFillInfo->current, pFillSup->interval.sliding, pFillSup->interval.slidingUnit, pFillSup->interval.precision); } @@ -905,6 +910,8 @@ static void setTimeSliceFillRule(SStreamFillSupporter* pFillSup, SStreamFillInfo if (hasNextWindow(pFillSup)) { nextWKey = pFillSup->next.key; } + TSKEY endTs = adustEndTsKey(ts, pFillSup->cur.key, &pFillSup->interval); + TSKEY startTs = adustPrevTsKey(ts, pFillSup->cur.key, &pFillSup->interval); pFillInfo->needFill = true; pFillInfo->pos = FILL_POS_INVALID; @@ -914,11 +921,9 @@ static void setTimeSliceFillRule(SStreamFillSupporter* pFillSup, SStreamFillInfo case TSDB_FILL_SET_VALUE: case TSDB_FILL_SET_VALUE_F: { if (hasPrevWindow(pFillSup)) { - TSKEY endTs = adustEndTsKey(ts, pFillSup->cur.key, &pFillSup->interval); setFillKeyInfo(prevWKey, endTs, &pFillSup->interval, pFillInfo); pFillInfo->pos = FILL_POS_END; } else { - TSKEY startTs = adustPrevTsKey(ts, pFillSup->cur.key, &pFillSup->interval); setFillKeyInfo(startTs, nextWKey, &pFillSup->interval, pFillInfo); pFillInfo->pos = FILL_POS_START; } @@ -927,7 +932,6 @@ static void setTimeSliceFillRule(SStreamFillSupporter* pFillSup, SStreamFillInfo } break; case TSDB_FILL_PREV: { if (hasNextWindow(pFillSup)) { - TSKEY startTs = adustPrevTsKey(ts, pFillSup->cur.key, &pFillSup->interval); setFillKeyInfo(startTs, nextWKey, &pFillSup->interval, pFillInfo); pFillInfo->pos = FILL_POS_START; resetFillWindow(&pFillSup->prev); @@ -935,7 +939,6 @@ static void setTimeSliceFillRule(SStreamFillSupporter* pFillSup, SStreamFillInfo pFillSup->prev.pRowVal = pFillSup->cur.pRowVal; } else { ASSERT(hasPrevWindow(pFillSup)); - TSKEY endTs = adustEndTsKey(ts, pFillSup->cur.key, &pFillSup->interval); setFillKeyInfo(prevWKey, endTs, &pFillSup->interval, pFillInfo); pFillInfo->pos = FILL_POS_END; } @@ -943,7 +946,6 @@ static void setTimeSliceFillRule(SStreamFillSupporter* pFillSup, SStreamFillInfo } break; case TSDB_FILL_NEXT: { if (hasPrevWindow(pFillSup)) { - TSKEY endTs = adustEndTsKey(ts, pFillSup->cur.key, &pFillSup->interval); setFillKeyInfo(prevWKey, endTs, &pFillSup->interval, pFillInfo); pFillInfo->pos = FILL_POS_END; resetFillWindow(&pFillSup->next); @@ -951,7 +953,6 @@ static void setTimeSliceFillRule(SStreamFillSupporter* pFillSup, SStreamFillInfo pFillSup->next.pRowVal = pFillSup->cur.pRowVal; } else { ASSERT(hasNextWindow(pFillSup)); - TSKEY startTs = adustPrevTsKey(ts, pFillSup->cur.key, &pFillSup->interval); setFillKeyInfo(startTs, nextWKey, &pFillSup->interval, pFillInfo); pFillInfo->pos = FILL_POS_START; resetFillWindow(&pFillSup->prev); @@ -970,7 +971,6 @@ static void setTimeSliceFillRule(SStreamFillSupporter* pFillSup, SStreamFillInfo pFillInfo->pResRow = &pFillSup->prev; pFillInfo->pLinearInfo->hasNext = false; } else if (hasPrevWindow(pFillSup)) { - TSKEY endTs = adustEndTsKey(ts, pFillSup->cur.key, &pFillSup->interval); setFillKeyInfo(prevWKey, endTs, &pFillSup->interval, pFillInfo); pFillInfo->pos = FILL_POS_END; SET_WIN_KEY_INVALID(pFillInfo->pLinearInfo->nextEnd); @@ -981,7 +981,6 @@ static void setTimeSliceFillRule(SStreamFillSupporter* pFillSup, SStreamFillInfo pFillInfo->pLinearInfo->hasNext = false; } else { ASSERT(hasNextWindow(pFillSup)); - TSKEY startTs = adustPrevTsKey(ts, pFillSup->cur.key, &pFillSup->interval); setFillKeyInfo(startTs, nextWKey, &pFillSup->interval, pFillInfo); pFillInfo->pos = FILL_POS_START; SET_WIN_KEY_INVALID(pFillInfo->pLinearInfo->nextEnd); @@ -1205,6 +1204,18 @@ static void doStreamTimeSliceImpl(SOperatorInfo* pOperator, SSDataBlock* pBlock) } } +void getNextResKey(int64_t curGroupId, SArray* pKeyArray, int32_t curIndex, TSKEY* pNextKey) { + int32_t nextIndex = curIndex + 1; + if (nextIndex < taosArrayGetSize(pKeyArray)) { + SWinKey* pKey = (SWinKey*)taosArrayGet(pKeyArray, nextIndex); + if (pKey->groupId == curGroupId) { + *pNextKey = pKey->ts; + return; + } + } + *pNextKey = INT64_MIN; +} + void doBuildTimeSlicePointResult(SStreamAggSupporter* pAggSup, SStreamFillSupporter* pFillSup, SStreamFillInfo* pFillInfo, SSDataBlock* pBlock, SGroupResInfo* pGroupResInfo) { int32_t code = TSDB_CODE_SUCCESS; @@ -1235,6 +1246,10 @@ void doBuildTimeSlicePointResult(SStreamAggSupporter* pAggSup, SStreamFillSuppor } QUERY_CHECK_CODE(code, lino, _end); + getNextResKey(pKey->groupId, pGroupResInfo->pRows, pGroupResInfo->index, &pFillInfo->nextRowKey); + if (hasNextWindow(pFillSup)) { + pFillInfo->nextPointKey = nextPoint.key.ts; + } setTimeSliceFillRule(pFillSup, pFillInfo, pKey->ts); doStreamFillRange(pFillSup, pFillInfo, pBlock); releaseOutputBuf(pAggSup->pState, curPoint.pResPos, &pAggSup->stateStore); @@ -1326,13 +1341,13 @@ static int32_t doDeleteTimeSliceResult(SStreamAggSupporter* pAggSup, SSDataBlock for (int32_t i = 0; i < pBlock->info.rows; i++) { while (1) { TSKEY ts = tsCalStarts[i]; - TSKEY endTs = tsCalEnds[i]; + TSKEY endCalTs = tsCalEnds[i]; uint64_t groupId = groupIds[i]; SWinKey key = {.ts = ts, .groupId = groupId}; SWinKey nextKey = {.groupId = groupId}; code = pAggSup->stateStore.streamStateFillGetNext(pAggSup->pState, &key, &nextKey, NULL, NULL, &winCode); QUERY_CHECK_CODE(code, lino, _end); - if (key.ts > endTs) { + if (key.ts > endCalTs) { break; } (void)tSimpleHashRemove(pUpdatedMap, &key, sizeof(SWinKey)); @@ -1675,6 +1690,9 @@ int32_t createStreamTimeSliceOperatorInfo(SOperatorInfo* downstream, SPhysiNode* copyFillValueInfo(pInfo->pFillSup, pInfo->pFillInfo); pInfo->ignoreNull = getIgoreNullRes(pExpSup); + pInfo->historyWins = taosArrayInit(4, sizeof(SWinKey)); + QUERY_CHECK_NULL(pInfo->historyWins, code, lino, _error, terrno); + if (pHandle) { pInfo->isHistoryOp = pHandle->fillHistory; } diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 5ac833bc6971..8492fba70e43 100755 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -10384,9 +10384,23 @@ static int32_t checkStreamQuery(STranslateContext* pCxt, SCreateStreamStmt* pStm } } - if (pStmt->pOptions->fillHistory && pSelect->hasInterpFunc) { - return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY, - "Stream interp unsupported Fill history"); + if (pSelect->hasInterpFunc) { + if (pStmt->pOptions->fillHistory && pStmt->pOptions->triggerType == STREAM_TRIGGER_FORCE_WINDOW_CLOSE) { + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY, + "When trigger was force window close, Stream interp unsupported Fill history"); + } + + if (pStmt->pOptions->triggerType == STREAM_TRIGGER_WINDOW_CLOSE) { + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY, + "Stream interp unsupported window close"); + } + + if ((SRealTableNode*)pSelect->pFromTable && ((SRealTableNode*)pSelect->pFromTable)->pMeta && + TSDB_SUPER_TABLE == ((SRealTableNode*)pSelect->pFromTable)->pMeta->tableType && + !hasTbnameFunction(pSelect->pPartitionByList)) { + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY, + "Interp for stream on super table must patitioned by table name"); + } } return TSDB_CODE_SUCCESS; diff --git a/source/libs/stream/src/streamSliceState.c b/source/libs/stream/src/streamSliceState.c index ea5e35e2454d..9eb4f5788713 100644 --- a/source/libs/stream/src/streamSliceState.c +++ b/source/libs/stream/src/streamSliceState.c @@ -123,9 +123,34 @@ void clearSearchBuff(SStreamFileState* pFileState) { } } -int32_t getHashSortNextRow(SStreamFileState* pFileState, const SWinKey* pKey, SWinKey* pResKey, void** pVal, +int32_t getStateFromRocksdbByCur(SStreamFileState* pFileState, SStreamStateCur* pCur, SWinKey* pResKey, SRowBuffPos** ppPos, int32_t* pVLen, int32_t* pWinCode) { + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; + void* tmpVal = NULL; + int32_t len = 0; + (*pWinCode) = streamStateGetGroupKVByCur_rocksdb(pCur, pResKey, (const void**)&tmpVal, &len); + if ((*pWinCode) == TSDB_CODE_SUCCESS) { + SRowBuffPos* pNewPos = getNewRowPosForWrite(pFileState); + if (!pNewPos || !pNewPos->pRowBuff) { + code = TSDB_CODE_OUT_OF_MEMORY; + QUERY_CHECK_CODE(code, lino, _end); + } + memcpy(pNewPos->pRowBuff, tmpVal, len); + taosMemoryFreeClear(tmpVal); + *pVLen = getRowStateRowSize(pFileState); + (*ppPos) = pNewPos; + } +_end: + if (code != TSDB_CODE_SUCCESS) { + qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } + return code; +} + +int32_t getHashSortNextRow(SStreamFileState* pFileState, const SWinKey* pKey, SWinKey* pResKey, void** ppVal, int32_t* pVLen, int32_t* pWinCode) { - int32_t code = TSDB_CODE_SUCCESS; + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; SArray* pWinStates = NULL; SSHashObj* pSearchBuff = getSearchBuff(pFileState); void* pState = getStateFileStore(pFileState); @@ -134,7 +159,20 @@ int32_t getHashSortNextRow(SStreamFileState* pFileState, const SWinKey* pKey, SW pWinStates = (SArray*)(*ppBuff); } else { SStreamStateCur* pCur = streamStateFillSeekKeyNext_rocksdb(pState, pKey); - (*pWinCode) = streamStateGetGroupKVByCur_rocksdb(pCur, pResKey, (const void**)pVal, pVLen); + void* tmpVal = NULL; + int32_t len = 0; + (*pWinCode) = streamStateGetGroupKVByCur_rocksdb(pCur, pResKey, (const void**)&tmpVal, &len); + if ((*pWinCode) == TSDB_CODE_SUCCESS) { + SRowBuffPos* pNewPos = getNewRowPosForWrite(pFileState); + if (!pNewPos || !pNewPos->pRowBuff) { + code = TSDB_CODE_OUT_OF_MEMORY; + QUERY_CHECK_CODE(code, lino, _end); + } + memcpy(pNewPos->pRowBuff, tmpVal, len); + taosMemoryFreeClear(tmpVal); + *pVLen = getRowStateRowSize(pFileState); + (*ppVal) = pNewPos; + } streamStateFreeCur(pCur); return code; } @@ -142,7 +180,20 @@ int32_t getHashSortNextRow(SStreamFileState* pFileState, const SWinKey* pKey, SW int32_t index = binarySearch(pWinStates, size, pKey, fillStateKeyCompare); if (index == -1) { SStreamStateCur* pCur = streamStateFillSeekKeyNext_rocksdb(pState, pKey); - (*pWinCode) = streamStateGetGroupKVByCur_rocksdb(pCur, pResKey, (const void**)pVal, pVLen); + void* tmpVal = NULL; + int32_t len = 0; + (*pWinCode) = streamStateGetGroupKVByCur_rocksdb(pCur, pResKey, (const void**)&tmpVal, &len); + if ((*pWinCode) == TSDB_CODE_SUCCESS) { + SRowBuffPos* pNewPos = getNewRowPosForWrite(pFileState); + if (!pNewPos || !pNewPos->pRowBuff) { + code = TSDB_CODE_OUT_OF_MEMORY; + QUERY_CHECK_CODE(code, lino, _end); + } + memcpy(pNewPos->pRowBuff, tmpVal, len); + taosMemoryFreeClear(tmpVal); + *pVLen = getRowStateRowSize(pFileState); + (*ppVal) = pNewPos; + } streamStateFreeCur(pCur); return code; } else { @@ -152,15 +203,21 @@ int32_t getHashSortNextRow(SStreamFileState* pFileState, const SWinKey* pKey, SW } SWinKey* pNext = taosArrayGet(pWinStates, index + 1); *pResKey = *pNext; - return getHashSortRowBuff(pFileState, pResKey, pVal, pVLen, pWinCode); + return getHashSortRowBuff(pFileState, pResKey, ppVal, pVLen, pWinCode); } (*pWinCode) = TSDB_CODE_FAILED; + +_end: + if (code != TSDB_CODE_SUCCESS) { + qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } return code; } -int32_t getHashSortPrevRow(SStreamFileState* pFileState, const SWinKey* pKey, SWinKey* pResKey, void** pVal, +int32_t getHashSortPrevRow(SStreamFileState* pFileState, const SWinKey* pKey, SWinKey* pResKey, void** ppVal, int32_t* pVLen, int32_t* pWinCode) { int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; SArray* pWinStates = NULL; SSHashObj* pSearchBuff = getSearchBuff(pFileState); void* pState = getStateFileStore(pFileState); @@ -169,7 +226,20 @@ int32_t getHashSortPrevRow(SStreamFileState* pFileState, const SWinKey* pKey, SW pWinStates = (SArray*)(*ppBuff); } else { SStreamStateCur* pCur = streamStateFillSeekKeyPrev_rocksdb(pState, pKey); - (*pWinCode) = streamStateGetGroupKVByCur_rocksdb(pCur, pResKey, (const void**)pVal, pVLen); + void* tmpVal = NULL; + int32_t len = 0; + (*pWinCode) = streamStateGetGroupKVByCur_rocksdb(pCur, pResKey, (const void**)&tmpVal, &len); + if ((*pWinCode) == TSDB_CODE_SUCCESS) { + SRowBuffPos* pNewPos = getNewRowPosForWrite(pFileState); + if (!pNewPos || !pNewPos->pRowBuff) { + code = TSDB_CODE_OUT_OF_MEMORY; + QUERY_CHECK_CODE(code, lino, _end); + } + memcpy(pNewPos->pRowBuff, tmpVal, len); + taosMemoryFreeClear(tmpVal); + *pVLen = getRowStateRowSize(pFileState); + (*ppVal) = pNewPos; + } streamStateFreeCur(pCur); return code; } @@ -177,15 +247,33 @@ int32_t getHashSortPrevRow(SStreamFileState* pFileState, const SWinKey* pKey, SW int32_t index = binarySearch(pWinStates, size, pKey, fillStateKeyCompare); if (index == -1 || index == 0) { SStreamStateCur* pCur = streamStateFillSeekKeyPrev_rocksdb(pState, pKey); - (*pWinCode) = streamStateGetGroupKVByCur_rocksdb(pCur, pResKey, (const void**)pVal, pVLen); + void* tmpVal = NULL; + int32_t len = 0; + (*pWinCode) = streamStateGetGroupKVByCur_rocksdb(pCur, pResKey, (const void**)&tmpVal, &len); + if ((*pWinCode) == TSDB_CODE_SUCCESS) { + SRowBuffPos* pNewPos = getNewRowPosForWrite(pFileState); + if (!pNewPos || !pNewPos->pRowBuff) { + code = TSDB_CODE_OUT_OF_MEMORY; + QUERY_CHECK_CODE(code, lino, _end); + } + memcpy(pNewPos->pRowBuff, tmpVal, len); + taosMemoryFreeClear(tmpVal); + *pVLen = getRowStateRowSize(pFileState); + (*ppVal) = pNewPos; + } streamStateFreeCur(pCur); return code; } else { SWinKey* pNext = taosArrayGet(pWinStates, index - 1); *pResKey = *pNext; - return getHashSortRowBuff(pFileState, pResKey, pVal, pVLen, pWinCode); + return getHashSortRowBuff(pFileState, pResKey, ppVal, pVLen, pWinCode); } (*pWinCode) = TSDB_CODE_FAILED; + +_end: + if (code != TSDB_CODE_SUCCESS) { + qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } return code; } diff --git a/tests/script/tsim/stream/streamInterpError.sim b/tests/script/tsim/stream/streamInterpError.sim new file mode 100644 index 000000000000..49366dc9ee0a --- /dev/null +++ b/tests/script/tsim/stream/streamInterpError.sim @@ -0,0 +1,82 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sleep 50 +sql connect + +print step2 + +sql create database test2 vgroups 1; +sql use test2; + +sql create stable st(ts timestamp,a int,b int,c int, d double) tags(ta int,tb int,tc int); +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); + +print step2_0 + +sql create stream streams2_0_1 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_0_1 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(prev); +sql create stream streams2_0_2 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_0_2 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(next); +sql create stream streams2_0_3 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_0_3 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(linear); +sql create stream streams2_0_4 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_0_4 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(NULL); +sql create stream streams2_0_5 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_0_5 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(value,11,22,33,44); + +print step2_1 + +sql_error create stream streams2_1_1 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_1_1 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 range(1648791212000, 1648791215000) every(1s) fill(prev); +sql_error create stream streams2_1_2 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_1_2 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 range(1648791212000, 1648791215000) every(1s) fill(next); +sql_error create stream streams2_1_3 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_1_3 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 range(1648791212000, 1648791215000) every(1s) fill(linear); +sql_error create stream streams2_1_4 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_1_4 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 range(1648791212000, 1648791215000) every(1s) fill(NULL); +sql_error create stream streams2_1_5 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_1_5 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 range(1648791212000, 1648791215000) every(1s) fill(value,11,22,33,44); + +print step2_2 + +sql_error create stream streams2_2_1 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_2_1 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from st every(1s) fill(prev); +sql_error create stream streams2_2_2 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_2_2 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from st every(1s) fill(next); +sql_error create stream streams2_2_3 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_2_3 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from st every(1s) fill(linear); +sql_error create stream streams2_2_4 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_2_4 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from st every(1s) fill(NULL); +sql_error create stream streams2_2_5 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_2_5 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from st every(1s) fill(value,11,22,33,44); + +print step2_3 + +sql_error create stream streams2_3_1 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_3_1 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from st partition by a every(1s) fill(prev); +sql_error create stream streams2_3_2 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_3_2 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from st partition by a every(1s) fill(next); +sql_error create stream streams2_3_3 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_3_3 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from st partition by a every(1s) fill(linear); +sql_error create stream streams2_3_4 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_3_4 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from st partition by a every(1s) fill(NULL); +sql_error create stream streams2_3_5 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_3_5 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from st partition by a every(1s) fill(value,11,22,33,44); + +print step2_4 + +sql_error create stream streams2_4_1 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_4_1 as select INTERP(a) FROM t1 RANGE('2023-01-01 00:00:00') fill(prev); +sql_error create stream streams2_4_2 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_4_2 as select INTERP(a) FROM t1 RANGE('2023-01-01 00:00:00') fill(next); +sql_error create stream streams2_4_3 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_4_3 as select INTERP(a) FROM t1 RANGE('2023-01-01 00:00:00') fill(linear); +sql_error create stream streams2_4_4 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_4_4 as select INTERP(a) FROM t1 RANGE('2023-01-01 00:00:00') fill(NULL); +sql_error create stream streams2_4_5 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_4_5 as select INTERP(a) FROM t1 RANGE('2023-01-01 00:00:00') fill(value,11,22,33,44); + +print step2_5 + +sql_error create stream streams2_5_1 trigger window_close IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_5_1 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(prev); +sql_error create stream streams2_5_2 trigger window_close IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_5_2 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(next); +sql_error create stream streams2_5_3 trigger window_close IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_5_3 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(linear); +sql_error create stream streams2_5_4 trigger window_close IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_5_4 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(NULL); +sql_error create stream streams2_5_5 trigger window_close IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_5_5 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(value,11,22,33,44); + +print step2_6 + +sql create stream streams2_6_1 trigger at_once FILL_HISTORY 1 IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_6_1 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(prev); +sql create stream streams2_6_2 trigger at_once FILL_HISTORY 1 IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_6_2 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(next); +sql create stream streams2_6_3 trigger at_once FILL_HISTORY 1 IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_6_3 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(linear); +sql create stream streams2_6_4 trigger at_once FILL_HISTORY 1 IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_6_4 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(NULL); +sql create stream streams2_6_5 trigger at_once FILL_HISTORY 1 IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_6_5 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(value,11,22,33,44); + +sql_error create stream streams2_6_6 trigger force_window_close FILL_HISTORY 1 IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_6_6 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(prev); +sql_error create stream streams2_6_7 trigger force_window_close FILL_HISTORY 1 IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_6_7 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(next); +sql_error create stream streams2_6_8 trigger force_window_close FILL_HISTORY 1 IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_6_8 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(linear); +sql_error create stream streams2_6_9 trigger force_window_close FILL_HISTORY 1 IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_6_9 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(NULL); +sql_error create stream streams2_6_10 trigger force_window_close FILL_HISTORY 1 IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_6_10 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(value,11,22,33,44); + +run tsim/stream/checkTaskStatus.sim + +run tsim/stream/checkTaskStatus.sim + +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/stream/streamInterpOther.sim b/tests/script/tsim/stream/streamInterpOther.sim index c135a319925c..8af1274bb6e4 100644 --- a/tests/script/tsim/stream/streamInterpOther.sim +++ b/tests/script/tsim/stream/streamInterpOther.sim @@ -211,39 +211,6 @@ if $data17 != 44.000000000 then goto loop0_2 endi -print step2 - -sql create database test2 vgroups 1; -sql use test2; - -sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int); -sql create table t1 using st tags(1,1,1); -sql create table t2 using st tags(2,2,2); - -sql_error create stream streams2_1_1 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_1 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 range(1648791212000, 1648791215000) every(1s) fill(prev); -sql_error create stream streams2_1_2 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_2 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 range(1648791212000, 1648791215000) every(1s) fill(next); -sql_error create stream streams2_1_3 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_3 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 range(1648791212000, 1648791215000) every(1s) fill(linear); -sql_error create stream streams2_1_4 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_4 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 range(1648791212000, 1648791215000) every(1s) fill(NULL); -sql_error create stream streams2_1_5 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_5 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 range(1648791212000, 1648791215000) every(1s) fill(value,11,22,33,44); - -sql_error create stream streams2_2_1 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt1_1 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from st every(1s) fill(prev); -sql_error create stream streams2_2_2 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt1_2 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from st every(1s) fill(next); -sql_error create stream streams2_2_3 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt1_3 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from st every(1s) fill(linear); -sql_error create stream streams2_2_4 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt1_4 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from st every(1s) fill(NULL); -sql_error create stream streams2_2_5 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt1_5 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from st every(1s) fill(value,11,22,33,44); - -sql_error create stream streams2_3_1 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_1 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from st prartition by a every(1s) fill(prev); -sql_error create stream streams2_3_2 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_2 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from st prartition by a every(1s) fill(next); -sql_error create stream streams2_3_3 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_3 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from st prartition by a every(1s) fill(linear); -sql_error create stream streams2_3_4 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_4 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from st prartition by a every(1s) fill(NULL); -sql_error create stream streams2_3_5 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_5 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from st prartition by a every(1s) fill(value,11,22,33,44); - -sql_error create stream streams2_4_1 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt3_1 as select INTERP(a) FROM t1 RANGE('2023-01-01 00:00:00') fill(prev); -sql_error create stream streams2_4_2 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt3_2 as select INTERP(a) FROM t1 RANGE('2023-01-01 00:00:00') fill(next); -sql_error create stream streams2_4_3 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt3_3 as select INTERP(a) FROM t1 RANGE('2023-01-01 00:00:00') fill(linear); -sql_error create stream streams2_4_4 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt3_4 as select INTERP(a) FROM t1 RANGE('2023-01-01 00:00:00') fill(NULL); -sql_error create stream streams2_4_5 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt3_5 as select INTERP(a) FROM t1 RANGE('2023-01-01 00:00:00') fill(value,11,22,33,44); - print step3 sql create database test3 vgroups 4; From 057f09ffbfac42a071e55a53e91546835be1b976 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Wed, 14 Aug 2024 19:20:21 +0800 Subject: [PATCH 029/695] fix issue && add ci --- source/libs/executor/inc/executorInt.h | 1 + source/libs/executor/inc/streamexecutorInt.h | 1 + source/libs/executor/inc/tfill.h | 2 + source/libs/executor/src/streamfilloperator.c | 8 +- .../executor/src/streamtimesliceoperator.c | 40 +- source/libs/stream/src/streamSliceState.c | 11 +- .../tsim/stream/streamInterpHistory.sim | 492 ++++++++++++ .../tsim/stream/streamInterpHistory1.sim | 737 ++++++++++++++++++ .../script/tsim/stream/streamInterpPrev1.sim | 239 ++++++ 9 files changed, 1515 insertions(+), 16 deletions(-) create mode 100644 tests/script/tsim/stream/streamInterpHistory.sim create mode 100644 tests/script/tsim/stream/streamInterpHistory1.sim create mode 100644 tests/script/tsim/stream/streamInterpPrev1.sim diff --git a/source/libs/executor/inc/executorInt.h b/source/libs/executor/inc/executorInt.h index 54c8d092d387..46a348479af7 100644 --- a/source/libs/executor/inc/executorInt.h +++ b/source/libs/executor/inc/executorInt.h @@ -841,6 +841,7 @@ typedef struct SStreamTimeSliceOperatorInfo { SGroupResInfo groupResInfo; bool ignoreNull; bool isHistoryOp; + bool isReloadState; } SStreamTimeSliceOperatorInfo; #define OPTR_IS_OPENED(_optr) (((_optr)->status & OP_OPENED) == OP_OPENED) diff --git a/source/libs/executor/inc/streamexecutorInt.h b/source/libs/executor/inc/streamexecutorInt.h index c02c3bcd4a93..f4b5030d3a72 100644 --- a/source/libs/executor/inc/streamexecutorInt.h +++ b/source/libs/executor/inc/streamexecutorInt.h @@ -48,6 +48,7 @@ void destroyStreamFillSupporter(SStreamFillSupporter* pFillSup); bool hasCurWindow(SStreamFillSupporter* pFillSup); bool hasPrevWindow(SStreamFillSupporter* pFillSup); bool hasNextWindow(SStreamFillSupporter* pFillSup); +bool hasNextNextWindow(SStreamFillSupporter* pFillSup); void copyNotFillExpData(SStreamFillSupporter* pFillSup, SStreamFillInfo* pFillInfo); int32_t setRowCell(SColumnInfoData* pCol, int32_t rowId, const SResultCellData* pCell); bool hasRemainCalc(SStreamFillInfo* pFillInfo); diff --git a/source/libs/executor/inc/tfill.h b/source/libs/executor/inc/tfill.h index 4044cc0b9b40..a8ebc6bb1706 100644 --- a/source/libs/executor/inc/tfill.h +++ b/source/libs/executor/inc/tfill.h @@ -108,6 +108,8 @@ typedef struct SStreamFillInfo { TSKEY preRowKey; TSKEY nextRowKey; TSKEY nextPointKey; + TSKEY nextNextRowKey; + TSKEY nextNextPointKey; SResultRowData* pResRow; SStreamFillLinearInfo* pLinearInfo; bool needFill; diff --git a/source/libs/executor/src/streamfilloperator.c b/source/libs/executor/src/streamfilloperator.c index 7c7b800b71a7..75d072a828a4 100644 --- a/source/libs/executor/src/streamfilloperator.c +++ b/source/libs/executor/src/streamfilloperator.c @@ -232,10 +232,10 @@ void getWindowFromDiscBuf(SOperatorInfo* pOperator, TSKEY ts, uint64_t groupId, pAPI->stateStore.streamStateFreeCur(pCur); } -bool hasCurWindow(SStreamFillSupporter* pFillSup) { return pFillSup->cur.key != INT64_MIN; } -bool hasPrevWindow(SStreamFillSupporter* pFillSup) { return pFillSup->prev.key != INT64_MIN; } -bool hasNextWindow(SStreamFillSupporter* pFillSup) { return pFillSup->next.key != INT64_MIN; } -static bool hasNextNextWindow(SStreamFillSupporter* pFillSup) { return pFillSup->nextNext.key != INT64_MIN; } +bool hasCurWindow(SStreamFillSupporter* pFillSup) { return pFillSup->cur.key != INT64_MIN; } +bool hasPrevWindow(SStreamFillSupporter* pFillSup) { return pFillSup->prev.key != INT64_MIN; } +bool hasNextWindow(SStreamFillSupporter* pFillSup) { return pFillSup->next.key != INT64_MIN; } +bool hasNextNextWindow(SStreamFillSupporter* pFillSup) { return pFillSup->nextNext.key != INT64_MIN; } static void transBlockToResultRow(const SSDataBlock* pBlock, int32_t rowId, TSKEY ts, SResultRowData* pRowVal) { int32_t numOfCols = taosArrayGetSize(pBlock->pDataBlock); diff --git a/source/libs/executor/src/streamtimesliceoperator.c b/source/libs/executor/src/streamtimesliceoperator.c index 7b0e316b2faf..e1d91de54e69 100644 --- a/source/libs/executor/src/streamtimesliceoperator.c +++ b/source/libs/executor/src/streamtimesliceoperator.c @@ -125,6 +125,7 @@ void streamTimeSliceReloadState(SOperatorInfo* pOperator) { downstream->fpSet.reloadStreamStateFn(downstream); } reloadAggSupFromDownStream(downstream, &pInfo->streamAggSup); + pInfo->isReloadState = true; _end: if (code != TSDB_CODE_SUCCESS) { @@ -753,6 +754,16 @@ static int32_t getResultInfoFromState(SStreamAggSupporter* pAggSup, SStreamFillS pFillSup->next.pRowVal = pNextPoint->pRightRow->pRowVal; } pFillSup->next.key = adustEndTsKey(pNextPoint->key.ts, pFillSup->next.key, &pFillSup->interval); + + int32_t nextNextVLen = 0; + int32_t tmpWinCode = TSDB_CODE_SUCCESS; + SSlicePoint nextNextPoint = {.key.groupId = pNextPoint->key.groupId}; + code = + pAggSup->stateStore.streamStateFillGetNext(pState, &pNextPoint->key, &nextNextPoint.key, NULL, NULL, &tmpWinCode); + if (tmpWinCode == TSDB_CODE_SUCCESS) { + pFillSup->nextNext.key = nextNextPoint.key.ts; + } + QUERY_CHECK_CODE(code, lino, _end); } _end: @@ -896,12 +907,14 @@ static void copyCalcRowDeltaData(SResultRowData* pEndRow, SArray* pEndPoins, SFi } } -static void setTimeSliceFillRule(SStreamFillSupporter* pFillSup, SStreamFillInfo* pFillInfo, TSKEY ts) { - if (!hasPrevWindow(pFillSup) && !hasNextWindow(pFillSup)) { +static void setTimeSliceFillRule(SStreamFillSupporter* pFillSup, SStreamFillInfo* pFillInfo, TSKEY ts, bool isReloadState) { + qDebug("set stream interp fill rule, isReloadState:%d", isReloadState); + if (!hasNextWindow(pFillSup) && (!hasPrevWindow(pFillSup) || isReloadState) ) { pFillInfo->needFill = false; pFillInfo->pos = FILL_POS_START; goto _end; } + TSKEY prevWKey = INT64_MIN; TSKEY nextWKey = INT64_MIN; if (hasPrevWindow(pFillSup)) { @@ -920,7 +933,7 @@ static void setTimeSliceFillRule(SStreamFillSupporter* pFillSup, SStreamFillInfo case TSDB_FILL_NULL_F: case TSDB_FILL_SET_VALUE: case TSDB_FILL_SET_VALUE_F: { - if (hasPrevWindow(pFillSup)) { + if (hasPrevWindow(pFillSup) && !isReloadState) { setFillKeyInfo(prevWKey, endTs, &pFillSup->interval, pFillInfo); pFillInfo->pos = FILL_POS_END; } else { @@ -931,7 +944,11 @@ static void setTimeSliceFillRule(SStreamFillSupporter* pFillSup, SStreamFillInfo pFillInfo->pResRow->key = ts; } break; case TSDB_FILL_PREV: { - if (hasNextWindow(pFillSup)) { + if (hasPrevWindow(pFillSup) && hasNextWindow(pFillSup) && pFillInfo->nextRowKey == pFillInfo->nextPointKey && + (!hasNextNextWindow(pFillSup) || pFillInfo->nextNextRowKey == pFillInfo->nextNextPointKey) && !isReloadState ) { + setFillKeyInfo(prevWKey, endTs, &pFillSup->interval, pFillInfo); + pFillInfo->pos = FILL_POS_END; + } else if (hasNextWindow(pFillSup)) { setFillKeyInfo(startTs, nextWKey, &pFillSup->interval, pFillInfo); pFillInfo->pos = FILL_POS_START; resetFillWindow(&pFillSup->prev); @@ -945,7 +962,7 @@ static void setTimeSliceFillRule(SStreamFillSupporter* pFillSup, SStreamFillInfo pFillInfo->pResRow = &pFillSup->prev; } break; case TSDB_FILL_NEXT: { - if (hasPrevWindow(pFillSup)) { + if (hasPrevWindow(pFillSup) && !isReloadState) { setFillKeyInfo(prevWKey, endTs, &pFillSup->interval, pFillInfo); pFillInfo->pos = FILL_POS_END; resetFillWindow(&pFillSup->next); @@ -1217,7 +1234,7 @@ void getNextResKey(int64_t curGroupId, SArray* pKeyArray, int32_t curIndex, TSKE } void doBuildTimeSlicePointResult(SStreamAggSupporter* pAggSup, SStreamFillSupporter* pFillSup, - SStreamFillInfo* pFillInfo, SSDataBlock* pBlock, SGroupResInfo* pGroupResInfo) { + SStreamFillInfo* pFillInfo, SSDataBlock* pBlock, SGroupResInfo* pGroupResInfo, bool isReloadState) { int32_t code = TSDB_CODE_SUCCESS; int32_t lino = 0; blockDataCleanup(pBlock); @@ -1250,7 +1267,11 @@ void doBuildTimeSlicePointResult(SStreamAggSupporter* pAggSup, SStreamFillSuppor if (hasNextWindow(pFillSup)) { pFillInfo->nextPointKey = nextPoint.key.ts; } - setTimeSliceFillRule(pFillSup, pFillInfo, pKey->ts); + getNextResKey(pKey->groupId, pGroupResInfo->pRows, pGroupResInfo->index + 1, &pFillInfo->nextNextRowKey); + if (hasNextNextWindow(pFillSup)) { + pFillInfo->nextNextPointKey = pFillSup->nextNext.key; + } + setTimeSliceFillRule(pFillSup, pFillInfo, pKey->ts, isReloadState); doStreamFillRange(pFillSup, pFillInfo, pBlock); releaseOutputBuf(pAggSup->pState, curPoint.pResPos, &pAggSup->stateStore); releaseOutputBuf(pAggSup->pState, prevPoint.pResPos, &pAggSup->stateStore); @@ -1279,7 +1300,7 @@ static int32_t buildTimeSliceResult(SOperatorInfo* pOperator, SSDataBlock** ppRe goto _end; } - doBuildTimeSlicePointResult(pAggSup, pInfo->pFillSup, pInfo->pFillInfo, pInfo->pRes, &pInfo->groupResInfo); + doBuildTimeSlicePointResult(pAggSup, pInfo->pFillSup, pInfo->pFillInfo, pInfo->pRes, &pInfo->groupResInfo, pInfo->isReloadState); if (pInfo->pRes->info.rows != 0) { printDataBlock(pInfo->pRes, getStreamOpName(opType), GET_TASKID(pTaskInfo)); (*ppRes) = pInfo->pRes; @@ -1431,6 +1452,7 @@ static int32_t doStreamTimeSliceNext(SOperatorInfo* pOperator, SSDataBlock** ppR goto _end; } + pInfo->isReloadState = false; setStreamOperatorCompleted(pOperator); resetStreamFillSup(pInfo->pFillSup); (*ppRes) = NULL; @@ -1522,6 +1544,7 @@ static int32_t doStreamTimeSliceNext(SOperatorInfo* pOperator, SSDataBlock** ppR QUERY_CHECK_CODE(code, lino, _end); if (!(*ppRes)) { + pInfo->isReloadState = false; setStreamOperatorCompleted(pOperator); resetStreamFillSup(pInfo->pFillSup); } @@ -1696,6 +1719,7 @@ int32_t createStreamTimeSliceOperatorInfo(SOperatorInfo* downstream, SPhysiNode* if (pHandle) { pInfo->isHistoryOp = pHandle->fillHistory; } + pInfo->isReloadState = false; pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERP_FUNC; setOperatorInfo(pOperator, getStreamOpName(pOperator->operatorType), QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERP_FUNC, diff --git a/source/libs/stream/src/streamSliceState.c b/source/libs/stream/src/streamSliceState.c index 9eb4f5788713..f5589f53aea2 100644 --- a/source/libs/stream/src/streamSliceState.c +++ b/source/libs/stream/src/streamSliceState.c @@ -162,17 +162,17 @@ int32_t getHashSortNextRow(SStreamFileState* pFileState, const SWinKey* pKey, SW void* tmpVal = NULL; int32_t len = 0; (*pWinCode) = streamStateGetGroupKVByCur_rocksdb(pCur, pResKey, (const void**)&tmpVal, &len); - if ((*pWinCode) == TSDB_CODE_SUCCESS) { + if ((*pWinCode) == TSDB_CODE_SUCCESS && ppVal != NULL) { SRowBuffPos* pNewPos = getNewRowPosForWrite(pFileState); if (!pNewPos || !pNewPos->pRowBuff) { code = TSDB_CODE_OUT_OF_MEMORY; QUERY_CHECK_CODE(code, lino, _end); } memcpy(pNewPos->pRowBuff, tmpVal, len); - taosMemoryFreeClear(tmpVal); *pVLen = getRowStateRowSize(pFileState); (*ppVal) = pNewPos; } + taosMemoryFreeClear(tmpVal); streamStateFreeCur(pCur); return code; } @@ -183,17 +183,17 @@ int32_t getHashSortNextRow(SStreamFileState* pFileState, const SWinKey* pKey, SW void* tmpVal = NULL; int32_t len = 0; (*pWinCode) = streamStateGetGroupKVByCur_rocksdb(pCur, pResKey, (const void**)&tmpVal, &len); - if ((*pWinCode) == TSDB_CODE_SUCCESS) { + if ((*pWinCode) == TSDB_CODE_SUCCESS && ppVal != NULL) { SRowBuffPos* pNewPos = getNewRowPosForWrite(pFileState); if (!pNewPos || !pNewPos->pRowBuff) { code = TSDB_CODE_OUT_OF_MEMORY; QUERY_CHECK_CODE(code, lino, _end); } memcpy(pNewPos->pRowBuff, tmpVal, len); - taosMemoryFreeClear(tmpVal); *pVLen = getRowStateRowSize(pFileState); (*ppVal) = pNewPos; } + taosMemoryFreeClear(tmpVal); streamStateFreeCur(pCur); return code; } else { @@ -203,6 +203,9 @@ int32_t getHashSortNextRow(SStreamFileState* pFileState, const SWinKey* pKey, SW } SWinKey* pNext = taosArrayGet(pWinStates, index + 1); *pResKey = *pNext; + if (ppVal == NULL) { + return code; + } return getHashSortRowBuff(pFileState, pResKey, ppVal, pVLen, pWinCode); } (*pWinCode) = TSDB_CODE_FAILED; diff --git a/tests/script/tsim/stream/streamInterpHistory.sim b/tests/script/tsim/stream/streamInterpHistory.sim new file mode 100644 index 000000000000..6e6e99f98b61 --- /dev/null +++ b/tests/script/tsim/stream/streamInterpHistory.sim @@ -0,0 +1,492 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sleep 50 +sql connect + +print step1 +print =============== create database +sql create database test vgroups 1; +sql use test; + +sql create stable st(ts timestamp,a int,b int,c int, d double) tags(ta int,tb int,tc int); +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); + +sql insert into t1 values(1648791212000,1,1,1,1.0); +sql insert into t1 values(1648791215001,2,1,1,1.0); + +sql insert into t2 values(1648791212000,31,1,1,1.0); +sql insert into t2 values(1648791215001,41,1,1,1.0); + +sql create stream streams1 trigger at_once FILL_HISTORY 1 IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _irowts, _isfilled as a1, interp(a) as a2 from st partition by tbname every(1s) fill(prev); + + +sql insert into t1 values(1648791217000,5,1,1,1.0); +sql insert into t2 values(1648791217000,61,1,1,1.0); + +print sql select _irowts, _isfilled as a1, interp(a) as a2 from t1 partition by tbname range(1648791212000, 1648791217000) every(1s) fill(prev) order by 3, 1; +sql select _irowts, _isfilled as a1, interp(a) as a2 from t1 partition by tbname range(1648791212000, 1648791217000) every(1s) fill(prev) order by 3, 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 + + +$loop_count = 0 + +loop0: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 0 sql select * from streamt where a2 <= 10 order by 1; +sql select * from streamt where a2 < 10 order by 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 + +# row 0 +if $rows != 6 then + print ======rows=$rows + goto loop0 +endi + +# row 0 +if $data02 != 1 then + print ======data02=$data02 + goto loop0 +endi + +if $data12 != 1 then + print ======data12=$data12 + goto loop0 +endi + +if $data22 != 1 then + print ======data22=$data22 + goto loop0 +endi + +if $data32 != 1 then + print ======data32=$data32 + goto loop0 +endi + +if $data42 != 2 then + print ======data42=$data42 + goto loop0 +endi + +if $data52 != 5 then + print ======data52=$data52 + goto loop0 +endi + + +print sql select _irowts, _isfilled as a1, interp(a) as a2 from t2 partition by tbname range(1648791212000, 1648791217000) every(1s) fill(prev) order by 3, 1; +sql select _irowts, _isfilled as a1, interp(a) as a2 from t2 partition by tbname range(1648791212000, 1648791217000) every(1s) fill(prev) order by 3, 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 + +$loop_count = 0 + +loop0_1: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 0 sql select * from streamt where a2 > 10 order by 1; +sql select * from streamt where a2 > 10 order by 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 + +# row 0 +if $rows != 6 then + print ======rows=$rows + goto loop0_1 +endi + +if $data02 != 31 then + print ======data02=$data02 + goto loop0_1 +endi + +if $data12 != 31 then + print ======data12=$data12 + goto loop0_1 +endi + +if $data22 != 31 then + print ======data22=$data22 + goto loop0_1 +endi + +if $data32 != 31 then + print ======data32=$data32 + goto loop0_1 +endi + +if $data42 != 41 then + print ======data42=$data42 + goto loop0_1 +endi + +if $data52 != 61 then + print ======data52=$data52 + goto loop0_1 +endi + +run tsim/stream/checkTaskStatus.sim + +sql insert into t1 values(1648791219001,7,1,1,1.0); +sql insert into t2 values(1648791219001,81,1,1,1.0); + +print sql select _irowts, _isfilled as a1, interp(a) as a2 from t1 partition by tbname range(1648791212000, 1648791219000) every(1s) fill(prev) order by 3, 1; +sql select _irowts, _isfilled as a1, interp(a) as a2 from t1 partition by tbname range(1648791212000, 1648791219000) every(1s) fill(prev) order by 3, 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 +print $data60 $data61 $data62 $data63 $data64 $data65 +print $data70 $data71 $data72 $data73 $data74 $data75 + +$loop_count = 0 + +loop1: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 0 sql select * from streamt where a2 <= 10 order by 1; +sql select * from streamt where a2 < 10 order by 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 +print $data60 $data61 $data62 $data63 $data64 $data65 +print $data70 $data71 $data72 $data73 $data74 $data75 + +if $rows != 8 then + print ======rows=$rows + goto loop1 +endi + +print sql select _irowts, _isfilled as a1, interp(a) as a2 from t2 partition by tbname range(1648791212000, 1648791219000) every(1s) fill(prev) order by 3, 1; +sql select _irowts, _isfilled as a1, interp(a) as a2 from t2 partition by tbname range(1648791212000, 1648791219000) every(1s) fill(prev) order by 3, 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 +print $data60 $data61 $data62 $data63 $data64 $data65 +print $data70 $data71 $data72 $data73 $data74 $data75 + +$loop_count = 0 + +loop1_1: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 0 sql select * from streamt where a2 > 10 order by 1; +sql select * from streamt where a2 > 10 order by 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 +print $data60 $data61 $data62 $data63 $data64 $data65 +print $data70 $data71 $data72 $data73 $data74 $data75 + +if $rows != 8 then + print ======rows=$rows + goto loop1_1 +endi + +print step2 +print =============== create database +sql create database test2 vgroups 1; +sql use test2; + +sql create stable st(ts timestamp,a int,b int,c int, d double) tags(ta int,tb int,tc int); +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); + +sql insert into t1 values(1648791212000,1,1,1,1.0); +sql insert into t1 values(1648791215001,2,1,1,1.0); + +sql insert into t2 values(1648791212000,31,1,1,1.0); +sql insert into t2 values(1648791215001,41,1,1,1.0); + +sql create stream streams2 trigger at_once FILL_HISTORY 1 IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _irowts, _isfilled as a1, interp(a) as a2 from st partition by tbname every(1s) fill(next); + + +sql insert into t1 values(1648791217000,5,1,1,1.0); +sql insert into t2 values(1648791217000,61,1,1,1.0); + +print sql select _irowts, _isfilled as a1, interp(a) as a2 from t1 partition by tbname range(1648791212000, 1648791217000) every(1s) fill(next) order by 3, 1; +sql select _irowts, _isfilled as a1, interp(a) as a2 from t1 partition by tbname range(1648791212000, 1648791217000) every(1s) fill(next) order by 3, 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 + + +$loop_count = 0 + +loop2: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 0 sql select * from streamt where a2 <= 10 order by 1; +sql select * from streamt where a2 < 10 order by 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 + +# row 0 +if $rows != 6 then + print ======rows=$rows + goto loop2 +endi + +# row 0 +if $data02 != 1 then + print ======data02=$data02 + goto loop2 +endi + +if $data12 != 2 then + print ======data12=$data12 + goto loop2 +endi + +if $data22 != 2 then + print ======data22=$data22 + goto loop2 +endi + +if $data32 != 2 then + print ======data32=$data32 + goto loop2 +endi + +if $data42 != 5 then + print ======data42=$data42 + goto loop2 +endi + +if $data52 != 5 then + print ======data52=$data52 + goto loop2 +endi + + +print sql select _irowts, _isfilled as a1, interp(a) as a2 from t2 partition by tbname range(1648791212000, 1648791217000) every(1s) fill(next) order by 3, 1; +sql select _irowts, _isfilled as a1, interp(a) as a2 from t2 partition by tbname range(1648791212000, 1648791217000) every(1s) fill(next) order by 3, 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 + +$loop_count = 0 + +loop2_1: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 0 sql select * from streamt where a2 > 10 order by 1; +sql select * from streamt where a2 > 10 order by 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 + +# row 0 +if $rows != 6 then + print ======rows=$rows + goto loop2_1 +endi + +if $data02 != 31 then + print ======data02=$data02 + goto loop2_1 +endi + +if $data12 != 41 then + print ======data12=$data12 + goto loop2_1 +endi + +if $data22 != 41 then + print ======data22=$data22 + goto loop2_1 +endi + +if $data32 != 41 then + print ======data32=$data32 + goto loop2_1 +endi + +if $data42 != 61 then + print ======data42=$data42 + goto loop2_1 +endi + +if $data52 != 61 then + print ======data52=$data52 + goto loop2_1 +endi + +run tsim/stream/checkTaskStatus.sim + +sql insert into t1 values(1648791219001,7,1,1,1.0); +sql insert into t2 values(1648791219001,81,1,1,1.0); + +print sql select _irowts, _isfilled as a1, interp(a) as a2 from t1 partition by tbname range(1648791212000, 1648791219000) every(1s) fill(next) order by 3, 1; +sql select _irowts, _isfilled as a1, interp(a) as a2 from t1 partition by tbname range(1648791212000, 1648791219000) every(1s) fill(next) order by 3, 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 +print $data60 $data61 $data62 $data63 $data64 $data65 +print $data70 $data71 $data72 $data73 $data74 $data75 + +$loop_count = 0 + +loop3: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 0 sql select * from streamt where a2 <= 10 order by 1; +sql select * from streamt where a2 < 10 order by 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 +print $data60 $data61 $data62 $data63 $data64 $data65 +print $data70 $data71 $data72 $data73 $data74 $data75 + +if $rows != 8 then + print ======rows=$rows + goto loop3 +endi + +print sql select _irowts, _isfilled as a1, interp(a) as a2 from t2 partition by tbname range(1648791212000, 1648791219000) every(1s) fill(next) order by 3, 1; +sql select _irowts, _isfilled as a1, interp(a) as a2 from t2 partition by tbname range(1648791212000, 1648791219000) every(1s) fill(next) order by 3, 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 +print $data60 $data61 $data62 $data63 $data64 $data65 +print $data70 $data71 $data72 $data73 $data74 $data75 + +$loop_count = 0 + +loop3_1: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 0 sql select * from streamt where a2 > 10 order by 1; +sql select * from streamt where a2 > 10 order by 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 +print $data60 $data61 $data62 $data63 $data64 $data65 +print $data70 $data71 $data72 $data73 $data74 $data75 + +if $rows != 8 then + print ======rows=$rows + goto loop3_1 +endi +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/stream/streamInterpHistory1.sim b/tests/script/tsim/stream/streamInterpHistory1.sim new file mode 100644 index 000000000000..c4d558592c01 --- /dev/null +++ b/tests/script/tsim/stream/streamInterpHistory1.sim @@ -0,0 +1,737 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sleep 50 +sql connect + +print step1 +print =============== create database +sql create database test vgroups 1; +sql use test; + +sql create stable st(ts timestamp,a int,b int,c int, d double) tags(ta int,tb int,tc int); +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); + +sql insert into t1 values(1648791212000,1,1,1,1.0); +sql insert into t1 values(1648791215001,2,1,1,1.0); + +sql insert into t2 values(1648791212000,31,1,1,1.0); +sql insert into t2 values(1648791215001,41,1,1,1.0); + +sql create stream streams1 trigger at_once FILL_HISTORY 1 IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _irowts, _isfilled as a1, interp(a) as a2, tbname as tb from st partition by tbname every(1s) fill(NULL); + + +sql insert into t1 values(1648791217000,5,1,1,1.0); +sql insert into t2 values(1648791217000,61,1,1,1.0); + +print sql select _irowts, _isfilled as a1, interp(a) as a2 from t1 partition by tbname range(1648791212000, 1648791217000) every(1s) fill(NULL) order by 3, 1; +sql select _irowts, _isfilled as a1, interp(a) as a2 from t1 partition by tbname range(1648791212000, 1648791217000) every(1s) fill(NULL) order by 3, 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 + + +$loop_count = 0 + +loop0: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 0 sql select * from streamt where tb = "t1" order by 1; +sql select * from streamt where tb = "t1" order by 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 + +# row 0 +if $rows != 6 then + print ======rows=$rows + goto loop0 +endi + +# row 0 +if $data02 != 1 then + print ======data02=$data02 + goto loop0 +endi + +if $data12 != NULL then + print ======data12=$data12 + goto loop0 +endi + +if $data22 != NULL then + print ======data22=$data22 + goto loop0 +endi + +if $data32 != NULL then + print ======data32=$data32 + goto loop0 +endi + +if $data42 != NULL then + print ======data42=$data42 + goto loop0 +endi + +if $data52 != 5 then + print ======data52=$data52 + goto loop0 +endi + + +print sql select _irowts, _isfilled as a1, interp(a) as a2 from t2 partition by tbname range(1648791212000, 1648791217000) every(1s) fill(NULL) order by 3, 1; +sql select _irowts, _isfilled as a1, interp(a) as a2 from t2 partition by tbname range(1648791212000, 1648791217000) every(1s) fill(NULL) order by 3, 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 + +$loop_count = 0 + +loop0_1: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 0 sql select * from streamt where tb = "t2" order by 1; +sql select * from streamt where tb = "t2" order by 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 + +# row 0 +if $rows != 6 then + print ======rows=$rows + goto loop0_1 +endi + +if $data02 != 31 then + print ======data02=$data02 + goto loop0_1 +endi + +if $data12 != NULL then + print ======data12=$data12 + goto loop0_1 +endi + +if $data22 != NULL then + print ======data22=$data22 + goto loop0_1 +endi + +if $data32 != NULL then + print ======data32=$data32 + goto loop0_1 +endi + +if $data42 != NULL then + print ======data42=$data42 + goto loop0_1 +endi + +if $data52 != 61 then + print ======data52=$data52 + goto loop0_1 +endi + +run tsim/stream/checkTaskStatus.sim + +sql insert into t1 values(1648791219001,7,1,1,1.0); +sql insert into t2 values(1648791219001,81,1,1,1.0); + +print sql select _irowts, _isfilled as a1, interp(a) as a2 from t1 partition by tbname range(1648791212000, 1648791219000) every(1s) fill(NULL) order by 3, 1; +sql select _irowts, _isfilled as a1, interp(a) as a2 from t1 partition by tbname range(1648791212000, 1648791219000) every(1s) fill(NULL) order by 3, 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 +print $data60 $data61 $data62 $data63 $data64 $data65 +print $data70 $data71 $data72 $data73 $data74 $data75 + +$loop_count = 0 + +loop1: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 0 sql select * from streamt where tb = "t1" order by 1; +sql select * from streamt where tb = "t1" order by 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 +print $data60 $data61 $data62 $data63 $data64 $data65 +print $data70 $data71 $data72 $data73 $data74 $data75 + +if $rows != 8 then + print ======rows=$rows + goto loop1 +endi + +print sql select _irowts, _isfilled as a1, interp(a) as a2 from t2 partition by tbname range(1648791212000, 1648791219000) every(1s) fill(NULL) order by 3, 1; +sql select _irowts, _isfilled as a1, interp(a) as a2 from t2 partition by tbname range(1648791212000, 1648791219000) every(1s) fill(NULL) order by 3, 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 +print $data60 $data61 $data62 $data63 $data64 $data65 +print $data70 $data71 $data72 $data73 $data74 $data75 + +$loop_count = 0 + +loop1_1: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 0 sql select * from streamt where tb = "t2" order by 1; +sql select * from streamt where tb = "t2" order by 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 +print $data60 $data61 $data62 $data63 $data64 $data65 +print $data70 $data71 $data72 $data73 $data74 $data75 + +if $rows != 8 then + print ======rows=$rows + goto loop1_1 +endi + +print step2 +print =============== create database +sql create database test2 vgroups 1; +sql use test2; + +sql create stable st(ts timestamp,a int,b int,c int, d double) tags(ta int,tb int,tc int); +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); + +sql insert into t1 values(1648791212000,1,1,1,1.0); +sql insert into t1 values(1648791215001,2,1,1,1.0); + +sql insert into t2 values(1648791212000,31,1,1,1.0); +sql insert into t2 values(1648791212001,41,1,1,1.0); + +sql create stream streams2 trigger at_once FILL_HISTORY 1 IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _irowts, _isfilled as a1, interp(a) as a2, tbname as tb from st partition by tbname every(1s) fill(value, 888); + + +sql insert into t1 values(1648791217000,5,1,1,1.0); +sql insert into t2 values(1648791217000,61,1,1,1.0); + +print sql select _irowts, _isfilled as a1, interp(a) as a2 from t1 partition by tbname range(1648791212000, 1648791217000) every(1s) fill(value, 888) order by 3, 1; +sql select _irowts, _isfilled as a1, interp(a) as a2 from t1 partition by tbname range(1648791212000, 1648791217000) every(1s) fill(value, 888) order by 3, 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 + + +$loop_count = 0 + +loop2: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 0 sql select * from streamt where tb = "t1" order by 1; +sql select * from streamt where tb = "t1" order by 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 + +# row 0 +if $rows != 6 then + print ======rows=$rows + goto loop2 +endi + +# row 0 +if $data02 != 1 then + print ======data02=$data02 + goto loop2 +endi + +if $data12 != 888 then + print ======data12=$data12 + goto loop2 +endi + +if $data22 != 888 then + print ======data22=$data22 + goto loop2 +endi + +if $data32 != 888 then + print ======data32=$data32 + goto loop2 +endi + +if $data42 != 888 then + print ======data42=$data42 + goto loop2 +endi + +if $data52 != 5 then + print ======data52=$data52 + goto loop2 +endi + + +print sql select _irowts, _isfilled as a1, interp(a) as a2 from t2 partition by tbname range(1648791212000, 1648791217000) every(1s) fill(value, 888) order by 3, 1; +sql select _irowts, _isfilled as a1, interp(a) as a2 from t2 partition by tbname range(1648791212000, 1648791217000) every(1s) fill(value, 888) order by 3, 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 + +$loop_count = 0 + +loop2_1: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 0 sql select * from streamt where tb = "t2" order by 1; +sql select * from streamt where tb = "t2" order by 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 + +# row 0 +if $rows != 6 then + print ======rows=$rows + goto loop2_1 +endi + +if $data02 != 31 then + print ======data02=$data02 + goto loop2_1 +endi + +if $data12 != 888 then + print ======data12=$data12 + goto loop2_1 +endi + +if $data22 != 888 then + print ======data22=$data22 + goto loop2_1 +endi + +if $data32 != 888 then + print ======data32=$data32 + goto loop2_1 +endi + +if $data42 != 888 then + print ======data42=$data42 + goto loop2_1 +endi + +if $data52 != 61 then + print ======data52=$data52 + goto loop2_1 +endi + +run tsim/stream/checkTaskStatus.sim + +sql insert into t1 values(1648791219001,7,1,1,1.0); +sql insert into t2 values(1648791219001,81,1,1,1.0); + +print sql select _irowts, _isfilled as a1, interp(a) as a2 from t1 partition by tbname range(1648791212000, 1648791219000) every(1s) fill(value, 888) order by 3, 1; +sql select _irowts, _isfilled as a1, interp(a) as a2 from t1 partition by tbname range(1648791212000, 1648791219000) every(1s) fill(value, 888) order by 3, 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 +print $data60 $data61 $data62 $data63 $data64 $data65 +print $data70 $data71 $data72 $data73 $data74 $data75 + +$loop_count = 0 + +loop3: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 0 sql select * from streamt where tb = "t1" order by 1; +sql select * from streamt where tb = "t1" order by 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 +print $data60 $data61 $data62 $data63 $data64 $data65 +print $data70 $data71 $data72 $data73 $data74 $data75 + +if $rows != 8 then + print ======rows=$rows + goto loop3 +endi + +print sql select _irowts, _isfilled as a1, interp(a) as a2 from t2 partition by tbname range(1648791212000, 1648791219000) every(1s) fill(value, 888) order by 3, 1; +sql select _irowts, _isfilled as a1, interp(a) as a2 from t2 partition by tbname range(1648791212000, 1648791219000) every(1s) fill(value, 888) order by 3, 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 +print $data60 $data61 $data62 $data63 $data64 $data65 +print $data70 $data71 $data72 $data73 $data74 $data75 + +$loop_count = 0 + +loop3_1: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 0 sql select * from streamt where tb = "t2" order by 1; +sql select * from streamt where tb = "t2" order by 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 +print $data60 $data61 $data62 $data63 $data64 $data65 +print $data70 $data71 $data72 $data73 $data74 $data75 + +if $rows != 8 then + print ======rows=$rows + goto loop3_1 +endi + + +print step3 +print =============== create database +sql create database test3 vgroups 1; +sql use test3; + +sql create stable st(ts timestamp,a int,b int,c int, d double) tags(ta int,tb int,tc int); +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); + +sql insert into t1 values(1648791212000,1,1,1,1.0); +sql insert into t1 values(1648791215001,20,1,1,1.0); + +sql insert into t2 values(1648791212000,31,1,1,1.0); +sql insert into t2 values(1648791215001,41,1,1,1.0); + +sql create stream streams3 trigger at_once FILL_HISTORY 1 IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _irowts, _isfilled as a1, interp(a) as a2, tbname as tb from st partition by tbname every(1s) fill(linear); + + +sql insert into t1 values(1648791217000,5,1,1,1.0); +sql insert into t2 values(1648791217000,61,1,1,1.0); + +print sql select _irowts, _isfilled as a1, interp(a) as a2 from t1 partition by tbname range(1648791212000, 1648791217000) every(1s) fill(linear) order by 1; +sql select _irowts, _isfilled as a1, interp(a) as a2 from t1 partition by tbname range(1648791212000, 1648791217000) every(1s) fill(linear) order by 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 + + +$loop_count = 0 + +loop4: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 0 sql select * from streamt where tb = "t1" order by 1; +sql select * from streamt where tb = "t1" order by 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 + +# row 0 +if $rows != 6 then + print ======rows=$rows + goto loop4 +endi + +# row 0 +if $data02 != 1 then + print ======data02=$data02 + goto loop4 +endi + +if $data12 != 7 then + print ======data12=$data12 + goto loop4 +endi + +if $data22 != 13 then + print ======data22=$data22 + goto loop4 +endi + +if $data32 != 19 then + print ======data32=$data32 + goto loop4 +endi + +if $data42 != 12 then + print ======data42=$data42 + goto loop4 +endi + +if $data52 != 5 then + print ======data52=$data52 + goto loop4 +endi + + +print sql select _irowts, _isfilled as a1, interp(a) as a2 from t2 partition by tbname range(1648791212000, 1648791217000) every(1s) fill(linear) order by 1; +sql select _irowts, _isfilled as a1, interp(a) as a2 from t2 partition by tbname range(1648791212000, 1648791217000) every(1s) fill(linear) order by 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 + +$loop_count = 0 + +loop4_1: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 0 sql select * from streamt where tb = "t2" order by 1; +sql select * from streamt where tb = "t2" order by 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 + +# row 0 +if $rows != 6 then + print ======rows=$rows + goto loop4_1 +endi + +if $data02 != 31 then + print ======data02=$data02 + goto loop4_1 +endi + +if $data12 != 34 then + print ======data12=$data12 + goto loop4_1 +endi + +if $data22 != 37 then + print ======data22=$data22 + goto loop4_1 +endi + +if $data32 != 40 then + print ======data32=$data32 + goto loop4_1 +endi + +if $data42 != 50 then + print ======data42=$data42 + goto loop4_1 +endi + +if $data52 != 61 then + print ======data52=$data52 + goto loop4_1 +endi + +run tsim/stream/checkTaskStatus.sim + +sql insert into t1 values(1648791219001,7,1,1,1.0); +sql insert into t2 values(1648791219001,81,1,1,1.0); + +print sql select _irowts, _isfilled as a1, interp(a) as a2 from t1 partition by tbname range(1648791212000, 1648791219000) every(1s) fill(linear) order by 1; +sql select _irowts, _isfilled as a1, interp(a) as a2 from t1 partition by tbname range(1648791212000, 1648791219000) every(1s) fill(linear) order by 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 +print $data60 $data61 $data62 $data63 $data64 $data65 +print $data70 $data71 $data72 $data73 $data74 $data75 + +$loop_count = 0 + +loop5: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 0 sql select * from streamt where tb = "t1" order by 1; +sql select * from streamt where tb = "t1" order by 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 +print $data60 $data61 $data62 $data63 $data64 $data65 +print $data70 $data71 $data72 $data73 $data74 $data75 + +if $rows != 8 then + print ======rows=$rows + goto loop5 +endi + +print sql select _irowts, _isfilled as a1, interp(a) as a2 from t2 partition by tbname range(1648791212000, 1648791219000) every(1s) fill(linear) order by 1; +sql select _irowts, _isfilled as a1, interp(a) as a2 from t2 partition by tbname range(1648791212000, 1648791219000) every(1s) fill(linear) order by 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 +print $data60 $data61 $data62 $data63 $data64 $data65 +print $data70 $data71 $data72 $data73 $data74 $data75 + +$loop_count = 0 + +loop5_1: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 0 sql select * from streamt where tb = "t2" order by 1; +sql select * from streamt where tb = "t2" order by 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 +print $data60 $data61 $data62 $data63 $data64 $data65 +print $data70 $data71 $data72 $data73 $data74 $data75 + +if $rows != 8 then + print ======rows=$rows + goto loop5_1 +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/stream/streamInterpPrev1.sim b/tests/script/tsim/stream/streamInterpPrev1.sim new file mode 100644 index 000000000000..5d40d0a11f3e --- /dev/null +++ b/tests/script/tsim/stream/streamInterpPrev1.sim @@ -0,0 +1,239 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sleep 50 +sql connect + +print step1 +print =============== create database +sql create database test vgroups 1; +sql use test; + +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 every(1s) fill(prev); + +run tsim/stream/checkTaskStatus.sim + + +sql insert into t1 values(1648791213000,1,1,1,1.0); + +$loop_count = 0 + +loop0: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 +print $data10 $data11 $data12 $data13 + +# row 0 +if $rows != 1 then + print ======rows=$rows + goto loop0 +endi + +# row 0 +if $data01 != 1 then + print ======data01=$data01 + goto loop0 +endi + + +sql insert into t1 values(1648791213009,3,3,3,1.0) (1648791217001,4,4,4,4.1); + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791213000, 1648791217001) every(1s) fill(prev); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791213000, 1648791217001) every(1s) fill(prev); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +$loop_count = 0 +loop2: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 2 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +# row 0 +if $rows != 5 then + print ======rows=$rows + goto loop2 +endi + +# row 0 +if $data01 != 1 then + print ======data01=$data01 + goto loop2 +endi + +if $data11 != 3 then + print ======data11=$data11 + goto loop2 +endi + +if $data21 != 3 then + print ======data21=$data21 + goto loop2 +endi + +if $data31 != 3 then + print ======data31=$data31 + goto loop2 +endi + +if $data41 != 3 then + print ======data41=$data41 + goto loop2 +endi + + +print step2 + +sql create database test2 vgroups 1; +sql use test2; + +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 every(1s) fill(prev); + +run tsim/stream/checkTaskStatus.sim + +sql insert into t1 values(1648791213000,1,1,1,1.0); + + +$loop_count = 0 + +loop3: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 +print $data10 $data11 $data12 $data13 + +# row 0 +if $rows != 1 then + print ======rows=$rows + goto loop3 +endi + +# row 0 +if $data01 != 1 then + print ======data01=$data01 + goto loop3 +endi + + +sql insert into t1 values(1648791213009,3,3,3,1.0) (1648791217001,4,4,4,4.1) (1648791219000,5,5,5,5.1); + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791213000, 1648791217001) every(1s) fill(prev); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791213000, 1648791217001) every(1s) fill(prev); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 +print $data60 $data61 $data62 $data63 $data64 +print $data70 $data71 $data72 $data73 $data74 + + +$loop_count = 0 +loop4: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 2 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 +print $data60 $data61 $data62 $data63 $data64 +print $data70 $data71 $data72 $data73 $data74 + +# row 0 +if $rows != 7 then + print ======rows=$rows + goto loop4 +endi + +# row 0 +if $data01 != 1 then + print ======data01=$data01 + goto loop4 +endi + +if $data11 != 3 then + print ======data11=$data11 + goto loop4 +endi + +if $data21 != 3 then + print ======data21=$data21 + goto loop4 +endi + +if $data31 != 3 then + print ======data31=$data31 + goto loop4 +endi + +if $data41 != 3 then + print ======data41=$data41 + goto loop4 +endi + +if $data51 != 4 then + print ======data51=$data51 + goto loop4 +endi + +if $data61 != 5 then + print ======data61=$data61 + goto loop4 +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT From 345d852de75661b24234090e98075ca87e0633fa Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Wed, 14 Aug 2024 19:26:06 +0800 Subject: [PATCH 030/695] adj sql.y --- include/common/ttokendef.h | 232 +- source/libs/parser/src/sql.c | 10913 +++++++++++++++------------------ 2 files changed, 5228 insertions(+), 5917 deletions(-) diff --git a/include/common/ttokendef.h b/include/common/ttokendef.h index 921ecf356da3..aeded4b05bcd 100644 --- a/include/common/ttokendef.h +++ b/include/common/ttokendef.h @@ -282,118 +282,126 @@ #define TK_IROWTS 264 #define TK_ISFILLED 265 #define TK_CAST 266 -#define TK_NOW 267 -#define TK_TODAY 268 -#define TK_TIMEZONE 269 -#define TK_CLIENT_VERSION 270 -#define TK_SERVER_VERSION 271 -#define TK_SERVER_STATUS 272 -#define TK_CURRENT_USER 273 -#define TK_CASE 274 -#define TK_WHEN 275 -#define TK_THEN 276 -#define TK_ELSE 277 -#define TK_BETWEEN 278 -#define TK_IS 279 -#define TK_NK_LT 280 -#define TK_NK_GT 281 -#define TK_NK_LE 282 -#define TK_NK_GE 283 -#define TK_NK_NE 284 -#define TK_MATCH 285 -#define TK_NMATCH 286 -#define TK_CONTAINS 287 -#define TK_IN 288 -#define TK_JOIN 289 -#define TK_INNER 290 -#define TK_LEFT 291 -#define TK_RIGHT 292 -#define TK_OUTER 293 -#define TK_SEMI 294 -#define TK_ANTI 295 -#define TK_ASOF 296 -#define TK_WINDOW 297 -#define TK_WINDOW_OFFSET 298 -#define TK_JLIMIT 299 -#define TK_SELECT 300 -#define TK_NK_HINT 301 -#define TK_DISTINCT 302 -#define TK_WHERE 303 -#define TK_PARTITION 304 -#define TK_BY 305 -#define TK_SESSION 306 -#define TK_STATE_WINDOW 307 -#define TK_EVENT_WINDOW 308 -#define TK_COUNT_WINDOW 309 -#define TK_SLIDING 310 -#define TK_FILL 311 -#define TK_VALUE 312 -#define TK_VALUE_F 313 -#define TK_NONE 314 -#define TK_PREV 315 -#define TK_NULL_F 316 -#define TK_LINEAR 317 -#define TK_NEXT 318 -#define TK_HAVING 319 -#define TK_RANGE 320 -#define TK_EVERY 321 -#define TK_ORDER 322 -#define TK_SLIMIT 323 -#define TK_SOFFSET 324 -#define TK_LIMIT 325 -#define TK_OFFSET 326 -#define TK_ASC 327 -#define TK_NULLS 328 -#define TK_ABORT 329 -#define TK_AFTER 330 -#define TK_ATTACH 331 -#define TK_BEFORE 332 -#define TK_BEGIN 333 -#define TK_BITAND 334 -#define TK_BITNOT 335 -#define TK_BITOR 336 -#define TK_BLOCKS 337 -#define TK_CHANGE 338 -#define TK_COMMA 339 -#define TK_CONCAT 340 -#define TK_CONFLICT 341 -#define TK_COPY 342 -#define TK_DEFERRED 343 -#define TK_DELIMITERS 344 -#define TK_DETACH 345 -#define TK_DIVIDE 346 -#define TK_DOT 347 -#define TK_EACH 348 -#define TK_FAIL 349 -#define TK_FOR 350 -#define TK_GLOB 351 -#define TK_ID 352 -#define TK_IMMEDIATE 353 -#define TK_IMPORT 354 -#define TK_INITIALLY 355 -#define TK_INSTEAD 356 -#define TK_ISNULL 357 -#define TK_MODULES 358 -#define TK_NK_BITNOT 359 -#define TK_NK_SEMI 360 -#define TK_NOTNULL 361 -#define TK_OF 362 -#define TK_PLUS 363 -#define TK_PRIVILEGE 364 -#define TK_RAISE 365 -#define TK_RESTRICT 366 -#define TK_ROW 367 -#define TK_STAR 368 -#define TK_STATEMENT 369 -#define TK_STRICT 370 -#define TK_STRING 371 -#define TK_TIMES 372 -#define TK_VALUES 373 -#define TK_VARIABLE 374 -#define TK_WAL 375 -#define TK_ENCODE 376 -#define TK_COMPRESS 377 -#define TK_LEVEL 378 +#define TK_POSITION 267 +#define TK_IN 268 +#define TK_FOR 269 +#define TK_NOW 270 +#define TK_TODAY 271 +#define TK_SUBSTR 272 +#define TK_SUBSTRING 273 +#define TK_BOTH 274 +#define TK_TRAILING 275 +#define TK_LEADING 276 +#define TK_TIMEZONE 277 +#define TK_CLIENT_VERSION 278 +#define TK_SERVER_VERSION 279 +#define TK_SERVER_STATUS 280 +#define TK_CURRENT_USER 281 +#define TK_PI 282 +#define TK_CASE 283 +#define TK_WHEN 284 +#define TK_THEN 285 +#define TK_ELSE 286 +#define TK_BETWEEN 287 +#define TK_IS 288 +#define TK_NK_LT 289 +#define TK_NK_GT 290 +#define TK_NK_LE 291 +#define TK_NK_GE 292 +#define TK_NK_NE 293 +#define TK_MATCH 294 +#define TK_NMATCH 295 +#define TK_CONTAINS 296 +#define TK_JOIN 297 +#define TK_INNER 298 +#define TK_LEFT 299 +#define TK_RIGHT 300 +#define TK_OUTER 301 +#define TK_SEMI 302 +#define TK_ANTI 303 +#define TK_ASOF 304 +#define TK_WINDOW 305 +#define TK_WINDOW_OFFSET 306 +#define TK_JLIMIT 307 +#define TK_SELECT 308 +#define TK_NK_HINT 309 +#define TK_DISTINCT 310 +#define TK_WHERE 311 +#define TK_PARTITION 312 +#define TK_BY 313 +#define TK_SESSION 314 +#define TK_STATE_WINDOW 315 +#define TK_EVENT_WINDOW 316 +#define TK_COUNT_WINDOW 317 +#define TK_SLIDING 318 +#define TK_FILL 319 +#define TK_VALUE 320 +#define TK_VALUE_F 321 +#define TK_NONE 322 +#define TK_PREV 323 +#define TK_NULL_F 324 +#define TK_LINEAR 325 +#define TK_NEXT 326 +#define TK_HAVING 327 +#define TK_RANGE 328 +#define TK_EVERY 329 +#define TK_ORDER 330 +#define TK_SLIMIT 331 +#define TK_SOFFSET 332 +#define TK_LIMIT 333 +#define TK_OFFSET 334 +#define TK_ASC 335 +#define TK_NULLS 336 +#define TK_ABORT 337 +#define TK_AFTER 338 +#define TK_ATTACH 339 +#define TK_BEFORE 340 +#define TK_BEGIN 341 +#define TK_BITAND 342 +#define TK_BITNOT 343 +#define TK_BITOR 344 +#define TK_BLOCKS 345 +#define TK_CHANGE 346 +#define TK_COMMA 347 +#define TK_CONCAT 348 +#define TK_CONFLICT 349 +#define TK_COPY 350 +#define TK_DEFERRED 351 +#define TK_DELIMITERS 352 +#define TK_DETACH 353 +#define TK_DIVIDE 354 +#define TK_DOT 355 +#define TK_EACH 356 +#define TK_FAIL 357 +#define TK_GLOB 358 +#define TK_ID 359 +#define TK_IMMEDIATE 360 +#define TK_IMPORT 361 +#define TK_INITIALLY 362 +#define TK_INSTEAD 363 +#define TK_ISNULL 364 +#define TK_MODULES 365 +#define TK_NK_BITNOT 366 +#define TK_NK_SEMI 367 +#define TK_NOTNULL 368 +#define TK_OF 369 +#define TK_PLUS 370 +#define TK_PRIVILEGE 371 +#define TK_RAISE 372 +#define TK_RESTRICT 373 +#define TK_ROW 374 +#define TK_STAR 375 +#define TK_STATEMENT 376 +#define TK_STRICT 377 +#define TK_STRING 378 +#define TK_TIMES 379 +#define TK_VALUES 380 +#define TK_VARIABLE 381 +#define TK_WAL 382 +#define TK_ENCODE 383 +#define TK_COMPRESS 384 +#define TK_LEVEL 385 + #define TK_NK_SPACE 600 diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c index 0d0992af2823..29062bc77394 100644 --- a/source/libs/parser/src/sql.c +++ b/source/libs/parser/src/sql.c @@ -1,6 +1,5 @@ /* This file is automatically generated by Lemon from input grammar -** source file "sql.y". -*/ +** source file "sql.y". */ /* ** 2000-05-29 ** @@ -277,151 +276,159 @@ #define TK_TRIGGER 230 #define TK_AT_ONCE 231 #define TK_WINDOW_CLOSE 232 -#define TK_IGNORE 233 -#define TK_EXPIRED 234 -#define TK_FILL_HISTORY 235 -#define TK_UPDATE 236 -#define TK_SUBTABLE 237 -#define TK_UNTREATED 238 -#define TK_KILL 239 -#define TK_CONNECTION 240 -#define TK_TRANSACTION 241 -#define TK_BALANCE 242 -#define TK_VGROUP 243 -#define TK_LEADER 244 -#define TK_MERGE 245 -#define TK_REDISTRIBUTE 246 -#define TK_SPLIT 247 -#define TK_DELETE 248 -#define TK_INSERT 249 -#define TK_NK_BIN 250 -#define TK_NK_HEX 251 -#define TK_NULL 252 -#define TK_NK_QUESTION 253 -#define TK_NK_ALIAS 254 -#define TK_NK_ARROW 255 -#define TK_ROWTS 256 -#define TK_QSTART 257 -#define TK_QEND 258 -#define TK_QDURATION 259 -#define TK_WSTART 260 -#define TK_WEND 261 -#define TK_WDURATION 262 -#define TK_IROWTS 263 -#define TK_ISFILLED 264 -#define TK_CAST 265 -#define TK_NOW 266 -#define TK_TODAY 267 -#define TK_TIMEZONE 268 -#define TK_CLIENT_VERSION 269 -#define TK_SERVER_VERSION 270 -#define TK_SERVER_STATUS 271 -#define TK_CURRENT_USER 272 -#define TK_CASE 273 -#define TK_WHEN 274 -#define TK_THEN 275 -#define TK_ELSE 276 -#define TK_BETWEEN 277 -#define TK_IS 278 -#define TK_NK_LT 279 -#define TK_NK_GT 280 -#define TK_NK_LE 281 -#define TK_NK_GE 282 -#define TK_NK_NE 283 -#define TK_MATCH 284 -#define TK_NMATCH 285 -#define TK_CONTAINS 286 -#define TK_IN 287 -#define TK_JOIN 288 -#define TK_INNER 289 -#define TK_LEFT 290 -#define TK_RIGHT 291 -#define TK_OUTER 292 -#define TK_SEMI 293 -#define TK_ANTI 294 -#define TK_ASOF 295 -#define TK_WINDOW 296 -#define TK_WINDOW_OFFSET 297 -#define TK_JLIMIT 298 -#define TK_SELECT 299 -#define TK_NK_HINT 300 -#define TK_DISTINCT 301 -#define TK_WHERE 302 -#define TK_PARTITION 303 -#define TK_BY 304 -#define TK_SESSION 305 -#define TK_STATE_WINDOW 306 -#define TK_EVENT_WINDOW 307 -#define TK_COUNT_WINDOW 308 -#define TK_SLIDING 309 -#define TK_FILL 310 -#define TK_VALUE 311 -#define TK_VALUE_F 312 -#define TK_NONE 313 -#define TK_PREV 314 -#define TK_NULL_F 315 -#define TK_LINEAR 316 -#define TK_NEXT 317 -#define TK_HAVING 318 -#define TK_RANGE 319 -#define TK_EVERY 320 -#define TK_ORDER 321 -#define TK_SLIMIT 322 -#define TK_SOFFSET 323 -#define TK_LIMIT 324 -#define TK_OFFSET 325 -#define TK_ASC 326 -#define TK_NULLS 327 -#define TK_ABORT 328 -#define TK_AFTER 329 -#define TK_ATTACH 330 -#define TK_BEFORE 331 -#define TK_BEGIN 332 -#define TK_BITAND 333 -#define TK_BITNOT 334 -#define TK_BITOR 335 -#define TK_BLOCKS 336 -#define TK_CHANGE 337 -#define TK_COMMA 338 -#define TK_CONCAT 339 -#define TK_CONFLICT 340 -#define TK_COPY 341 -#define TK_DEFERRED 342 -#define TK_DELIMITERS 343 -#define TK_DETACH 344 -#define TK_DIVIDE 345 -#define TK_DOT 346 -#define TK_EACH 347 -#define TK_FAIL 348 -#define TK_FOR 349 -#define TK_GLOB 350 -#define TK_ID 351 -#define TK_IMMEDIATE 352 -#define TK_IMPORT 353 -#define TK_INITIALLY 354 -#define TK_INSTEAD 355 -#define TK_ISNULL 356 -#define TK_MODULES 357 -#define TK_NK_BITNOT 358 -#define TK_NK_SEMI 359 -#define TK_NOTNULL 360 -#define TK_OF 361 -#define TK_PLUS 362 -#define TK_PRIVILEGE 363 -#define TK_RAISE 364 -#define TK_RESTRICT 365 -#define TK_ROW 366 -#define TK_STAR 367 -#define TK_STATEMENT 368 -#define TK_STRICT 369 -#define TK_STRING 370 -#define TK_TIMES 371 -#define TK_VALUES 372 -#define TK_VARIABLE 373 -#define TK_WAL 374 -#define TK_ENCODE 375 -#define TK_COMPRESS 376 -#define TK_LEVEL 377 +#define TK_FORCE_WINDOW_CLOSE 233 +#define TK_IGNORE 234 +#define TK_EXPIRED 235 +#define TK_FILL_HISTORY 236 +#define TK_UPDATE 237 +#define TK_SUBTABLE 238 +#define TK_UNTREATED 239 +#define TK_KILL 240 +#define TK_CONNECTION 241 +#define TK_TRANSACTION 242 +#define TK_BALANCE 243 +#define TK_VGROUP 244 +#define TK_LEADER 245 +#define TK_MERGE 246 +#define TK_REDISTRIBUTE 247 +#define TK_SPLIT 248 +#define TK_DELETE 249 +#define TK_INSERT 250 +#define TK_NK_BIN 251 +#define TK_NK_HEX 252 +#define TK_NULL 253 +#define TK_NK_QUESTION 254 +#define TK_NK_ALIAS 255 +#define TK_NK_ARROW 256 +#define TK_ROWTS 257 +#define TK_QSTART 258 +#define TK_QEND 259 +#define TK_QDURATION 260 +#define TK_WSTART 261 +#define TK_WEND 262 +#define TK_WDURATION 263 +#define TK_IROWTS 264 +#define TK_ISFILLED 265 +#define TK_CAST 266 +#define TK_POSITION 267 +#define TK_IN 268 +#define TK_FOR 269 +#define TK_NOW 270 +#define TK_TODAY 271 +#define TK_SUBSTR 272 +#define TK_SUBSTRING 273 +#define TK_BOTH 274 +#define TK_TRAILING 275 +#define TK_LEADING 276 +#define TK_TIMEZONE 277 +#define TK_CLIENT_VERSION 278 +#define TK_SERVER_VERSION 279 +#define TK_SERVER_STATUS 280 +#define TK_CURRENT_USER 281 +#define TK_PI 282 +#define TK_CASE 283 +#define TK_WHEN 284 +#define TK_THEN 285 +#define TK_ELSE 286 +#define TK_BETWEEN 287 +#define TK_IS 288 +#define TK_NK_LT 289 +#define TK_NK_GT 290 +#define TK_NK_LE 291 +#define TK_NK_GE 292 +#define TK_NK_NE 293 +#define TK_MATCH 294 +#define TK_NMATCH 295 +#define TK_CONTAINS 296 +#define TK_JOIN 297 +#define TK_INNER 298 +#define TK_LEFT 299 +#define TK_RIGHT 300 +#define TK_OUTER 301 +#define TK_SEMI 302 +#define TK_ANTI 303 +#define TK_ASOF 304 +#define TK_WINDOW 305 +#define TK_WINDOW_OFFSET 306 +#define TK_JLIMIT 307 +#define TK_SELECT 308 +#define TK_NK_HINT 309 +#define TK_DISTINCT 310 +#define TK_WHERE 311 +#define TK_PARTITION 312 +#define TK_BY 313 +#define TK_SESSION 314 +#define TK_STATE_WINDOW 315 +#define TK_EVENT_WINDOW 316 +#define TK_COUNT_WINDOW 317 +#define TK_SLIDING 318 +#define TK_FILL 319 +#define TK_VALUE 320 +#define TK_VALUE_F 321 +#define TK_NONE 322 +#define TK_PREV 323 +#define TK_NULL_F 324 +#define TK_LINEAR 325 +#define TK_NEXT 326 +#define TK_HAVING 327 +#define TK_RANGE 328 +#define TK_EVERY 329 +#define TK_ORDER 330 +#define TK_SLIMIT 331 +#define TK_SOFFSET 332 +#define TK_LIMIT 333 +#define TK_OFFSET 334 +#define TK_ASC 335 +#define TK_NULLS 336 +#define TK_ABORT 337 +#define TK_AFTER 338 +#define TK_ATTACH 339 +#define TK_BEFORE 340 +#define TK_BEGIN 341 +#define TK_BITAND 342 +#define TK_BITNOT 343 +#define TK_BITOR 344 +#define TK_BLOCKS 345 +#define TK_CHANGE 346 +#define TK_COMMA 347 +#define TK_CONCAT 348 +#define TK_CONFLICT 349 +#define TK_COPY 350 +#define TK_DEFERRED 351 +#define TK_DELIMITERS 352 +#define TK_DETACH 353 +#define TK_DIVIDE 354 +#define TK_DOT 355 +#define TK_EACH 356 +#define TK_FAIL 357 +#define TK_GLOB 358 +#define TK_ID 359 +#define TK_IMMEDIATE 360 +#define TK_IMPORT 361 +#define TK_INITIALLY 362 +#define TK_INSTEAD 363 +#define TK_ISNULL 364 +#define TK_MODULES 365 +#define TK_NK_BITNOT 366 +#define TK_NK_SEMI 367 +#define TK_NOTNULL 368 +#define TK_OF 369 +#define TK_PLUS 370 +#define TK_PRIVILEGE 371 +#define TK_RAISE 372 +#define TK_RESTRICT 373 +#define TK_ROW 374 +#define TK_STAR 375 +#define TK_STATEMENT 376 +#define TK_STRICT 377 +#define TK_STRING 378 +#define TK_TIMES 379 +#define TK_VALUES 380 +#define TK_VARIABLE 381 +#define TK_WAL 382 +#define TK_ENCODE 383 +#define TK_COMPRESS 384 +#define TK_LEVEL 385 #endif /**************** End token definitions ***************************************/ @@ -448,7 +455,7 @@ ** the minor type might be the name of the identifier. ** Each non-terminal can have a different minor type. ** Terminal symbols all have the same minor type, though. -** This macros defines the minor type for terminal +** This macros defines the minor type for terminal ** symbols. ** YYMINORTYPE is the data type used for all minor types. ** This is typically a union of many types, one of @@ -462,9 +469,6 @@ ** ParseARG_STORE Code to store %extra_argument into yypParser ** ParseARG_FETCH Code to extract %extra_argument from yypParser ** ParseCTX_* As ParseARG_ except for %extra_context -** YYREALLOC Name of the realloc() function to use -** YYFREE Name of the free() function to use -** YYDYNSTACK True if stack space should be extended on heap ** YYERRORSYMBOL is the code number of the error symbol. If not ** defined, then do no error processing. ** YYNSTATE the combined number of states. @@ -478,68 +482,64 @@ ** YY_NO_ACTION The yy_action[] code for no-op ** YY_MIN_REDUCE Minimum value for reduce actions ** YY_MAX_REDUCE Maximum value for reduce actions -** YY_MIN_DSTRCTR Minimum symbol value that has a destructor -** YY_MAX_DSTRCTR Maximum symbol value that has a destructor */ #ifndef INTERFACE # define INTERFACE 1 #endif /************* Begin control #defines *****************************************/ #define YYCODETYPE unsigned short int -#define YYNOCODE 558 +#define YYNOCODE 568 #define YYACTIONTYPE unsigned short int -#define ParseTOKENTYPE SToken +#define ParseTOKENTYPE SToken typedef union { int yyinit; ParseTOKENTYPE yy0; - SAlterOption yy101; - bool yy209; - SNodeList* yy316; - SNode* yy416; - EOrder yy506; - EJoinSubType yy630; - EShowKind yy681; - int32_t yy820; - EOperatorType yy848; - STokenPair yy849; - EFillMode yy882; - SShowTablesOption yy925; - SDataType yy952; - EJoinType yy972; - int8_t yy1043; - ENullOrder yy1045; - int64_t yy1089; - SToken yy1109; + bool yy9; + SShowTablesOption yy13; + SDataType yy48; + EOperatorType yy108; + SToken yy209; + EJoinSubType yy278; + int8_t yy343; + SNodeList* yy456; + EFillMode yy470; + ETrimType yy512; + int32_t yy516; + SAlterOption yy573; + int64_t yy637; + EJoinType yy724; + ENullOrder yy777; + EOrder yy818; + SNode* yy840; + EShowKind yy881; + STokenPair yy1065; } YYMINORTYPE; #ifndef YYSTACKDEPTH #define YYSTACKDEPTH 100 #endif #define ParseARG_SDECL SAstCreateContext* pCxt ; -#define ParseARG_PDECL , SAstCreateContext* pCxt -#define ParseARG_PARAM ,pCxt +#define ParseARG_PDECL , SAstCreateContext* pCxt +#define ParseARG_PARAM ,pCxt #define ParseARG_FETCH SAstCreateContext* pCxt =yypParser->pCxt ; #define ParseARG_STORE yypParser->pCxt =pCxt ; -#define YYREALLOC realloc -#define YYFREE free -#define YYDYNSTACK 0 #define ParseCTX_SDECL #define ParseCTX_PDECL #define ParseCTX_PARAM #define ParseCTX_FETCH #define ParseCTX_STORE #define YYFALLBACK 1 -#define YYNSTATE 979 -#define YYNRULE 755 -#define YYNRULE_WITH_ACTION 755 -#define YYNTOKEN 378 -#define YY_MAX_SHIFT 978 -#define YY_MIN_SHIFTREDUCE 1448 -#define YY_MAX_SHIFTREDUCE 2202 -#define YY_ERROR_ACTION 2203 -#define YY_ACCEPT_ACTION 2204 -#define YY_NO_ACTION 2205 -#define YY_MIN_REDUCE 2206 -#define YY_MAX_REDUCE 2960 +#define YYNSTATE 1004 +#define YYNRULE 771 +#define YYNRULE_WITH_ACTION 771 +#define YYNTOKEN 386 +#define YY_MAX_SHIFT 1003 +#define YY_MIN_SHIFTREDUCE 1488 +#define YY_MAX_SHIFTREDUCE 2258 +#define YY_ERROR_ACTION 2259 +#define YY_ACCEPT_ACTION 2260 +#define YY_NO_ACTION 2261 +#define YY_MIN_REDUCE 2262 +#define YY_MAX_REDUCE 3032 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -555,27 +555,11 @@ typedef union { # define yytestcase(X) #endif -/* Macro to determine if stack space has the ability to grow using -** heap memory. -*/ -#if YYSTACKDEPTH<=0 || YYDYNSTACK -# define YYGROWABLESTACK 1 -#else -# define YYGROWABLESTACK 0 -#endif - -/* Guarantee a minimum number of initial stack slots. - */ -#if YYSTACKDEPTH<=0 -# undef YYSTACKDEPTH -# define YYSTACKDEPTH 2 /* Need a minimum stack size */ -#endif - /* Next are the tables used to determine what action to take based on the ** current state and lookahead token. These tables are used to implement ** functions that take a state number and lookahead value and return an -** action integer. +** action integer. ** ** Suppose the action integer is N. Then the action is determined as ** follows @@ -622,906 +606,1154 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (3018) +#define YY_ACTTAB_COUNT (4218) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 2711, 2403, 647, 543, 2569, 648, 2254, 2569, 542, 37, - /* 10 */ 340, 550, 47, 45, 2119, 2401, 2736, 652, 798, 211, - /* 20 */ 476, 471, 1940, 649, 2567, 855, 2926, 2566, 855, 2715, - /* 30 */ 2711, 813, 124, 810, 157, 2461, 1938, 787, 2028, 2405, - /* 40 */ 1965, 495, 2416, 2694, 797, 218, 493, 40, 39, 2927, - /* 50 */ 799, 46, 44, 43, 42, 41, 2736, 764, 748, 2715, - /* 60 */ 2754, 612, 610, 2123, 415, 2926, 2754, 232, 2023, 1965, - /* 70 */ 788, 851, 868, 502, 501, 19, 2701, 527, 850, 2717, - /* 80 */ 2719, 473, 1946, 2932, 218, 810, 157, 2569, 2927, 799, - /* 90 */ 873, 2645, 460, 2616, 1966, 47, 45, 1947, 810, 157, - /* 100 */ 2754, 478, 482, 476, 2695, 1940, 482, 2566, 855, 2717, - /* 110 */ 2720, 670, 975, 873, 435, 15, 2701, 873, 850, 1938, - /* 120 */ 873, 2028, 868, 2735, 810, 157, 2774, 43, 42, 41, - /* 130 */ 121, 2737, 854, 2739, 2740, 849, 1965, 873, 786, 2204, - /* 140 */ 657, 2608, 200, 655, 2828, 515, 648, 2254, 472, 2824, - /* 150 */ 2229, 2023, 2030, 2031, 812, 187, 2836, 2837, 19, 155, - /* 160 */ 2841, 14, 13, 2735, 2057, 1946, 2774, 482, 219, 114, - /* 170 */ 121, 2737, 854, 2739, 2740, 849, 2875, 873, 873, 2736, - /* 180 */ 159, 488, 168, 2799, 2828, 869, 2414, 929, 472, 2824, - /* 190 */ 2373, 2001, 2011, 254, 851, 975, 2264, 650, 15, 2262, - /* 200 */ 256, 2029, 2032, 841, 650, 148, 2262, 194, 2836, 809, - /* 210 */ 2701, 149, 808, 693, 840, 531, 1941, 50, 1939, 2926, - /* 220 */ 127, 2836, 2837, 2754, 155, 2841, 1712, 1713, 508, 2058, - /* 230 */ 2474, 62, 868, 507, 868, 2030, 2031, 797, 218, 2701, - /* 240 */ 2002, 850, 2927, 799, 533, 529, 188, 2836, 2837, 817, - /* 250 */ 155, 2841, 1944, 1945, 1998, 172, 2000, 2003, 2004, 2005, - /* 260 */ 2006, 2007, 2008, 2009, 2010, 846, 871, 870, 2022, 2024, - /* 270 */ 2025, 2026, 2027, 2, 2001, 2011, 2071, 2094, 443, 1950, - /* 280 */ 9, 1968, 764, 207, 2029, 2032, 2735, 331, 332, 2774, - /* 290 */ 2926, 491, 330, 121, 2737, 854, 2739, 2740, 849, 1941, - /* 300 */ 873, 1939, 2301, 1999, 1998, 2946, 747, 2828, 2932, 218, - /* 310 */ 2542, 472, 2824, 2927, 799, 2418, 36, 474, 2052, 2053, - /* 320 */ 2054, 2055, 2056, 2060, 2061, 2062, 2063, 50, 910, 174, - /* 330 */ 173, 907, 906, 905, 171, 1944, 1945, 1998, 54, 2000, - /* 340 */ 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 846, 871, - /* 350 */ 870, 2022, 2024, 2025, 2026, 2027, 2, 12, 47, 45, - /* 360 */ 2398, 422, 2736, 1909, 2474, 183, 476, 291, 1940, 388, - /* 370 */ 394, 290, 441, 2451, 869, 2414, 744, 813, 2228, 714, - /* 380 */ 713, 712, 1938, 2472, 2028, 667, 704, 154, 708, 392, - /* 390 */ 76, 2094, 707, 75, 148, 487, 486, 706, 711, 453, - /* 400 */ 452, 324, 698, 705, 421, 2207, 2754, 451, 701, 700, - /* 410 */ 699, 2091, 2092, 2093, 2023, 324, 252, 629, 627, 624, - /* 420 */ 622, 19, 2701, 192, 850, 317, 138, 663, 1946, 137, - /* 430 */ 136, 135, 134, 133, 132, 131, 130, 129, 2701, 2931, - /* 440 */ 2474, 47, 45, 2033, 2556, 103, 668, 2926, 469, 476, - /* 450 */ 430, 1940, 1966, 458, 322, 736, 2474, 1965, 975, 2472, - /* 460 */ 798, 15, 62, 1493, 481, 1938, 2930, 2028, 2926, 2735, - /* 470 */ 2927, 2929, 2774, 1908, 926, 2472, 121, 2737, 854, 2739, - /* 480 */ 2740, 849, 1500, 873, 869, 2414, 797, 218, 200, 381, - /* 490 */ 2828, 2927, 799, 666, 472, 2824, 2388, 2023, 2030, 2031, - /* 500 */ 185, 63, 2218, 2094, 499, 490, 489, 1495, 1498, 1499, - /* 510 */ 138, 1946, 207, 137, 136, 135, 134, 133, 132, 131, - /* 520 */ 130, 129, 2876, 62, 2848, 2091, 2092, 2093, 2848, 2848, - /* 530 */ 2848, 2848, 2848, 734, 2931, 480, 182, 2001, 2011, 2543, - /* 540 */ 207, 975, 2926, 928, 48, 495, 2416, 2029, 2032, 728, - /* 550 */ 2617, 732, 730, 288, 287, 88, 87, 546, 2285, 783, - /* 560 */ 231, 2930, 1941, 1965, 1939, 2927, 2928, 2542, 869, 2414, - /* 570 */ 912, 40, 39, 538, 536, 46, 44, 43, 42, 41, - /* 580 */ 715, 2030, 2031, 1969, 1813, 1814, 418, 497, 223, 525, - /* 590 */ 2467, 2469, 521, 517, 513, 510, 539, 697, 1944, 1945, - /* 600 */ 1998, 696, 2000, 2003, 2004, 2005, 2006, 2007, 2008, 2009, - /* 610 */ 2010, 846, 871, 870, 2022, 2024, 2025, 2026, 2027, 2, - /* 620 */ 2001, 2011, 2096, 2097, 2098, 2099, 2100, 66, 1786, 1787, - /* 630 */ 2029, 2032, 100, 1812, 1815, 1673, 2848, 2091, 2092, 2093, - /* 640 */ 2848, 2848, 2848, 2848, 2848, 1941, 324, 1939, 2206, 62, - /* 650 */ 1664, 902, 901, 900, 1668, 899, 1670, 1671, 898, 895, - /* 660 */ 2410, 1679, 892, 1681, 1682, 889, 886, 883, 789, 784, - /* 670 */ 777, 773, 147, 146, 145, 144, 143, 142, 141, 140, - /* 680 */ 139, 1944, 1945, 1998, 238, 2000, 2003, 2004, 2005, 2006, - /* 690 */ 2007, 2008, 2009, 2010, 846, 871, 870, 2022, 2024, 2025, - /* 700 */ 2026, 2027, 2, 47, 45, 1623, 2736, 324, 869, 2414, - /* 710 */ 912, 476, 1969, 1940, 46, 44, 43, 42, 41, 1622, - /* 720 */ 1520, 851, 1519, 2883, 714, 713, 712, 1938, 55, 2028, - /* 730 */ 94, 704, 154, 708, 2002, 93, 153, 707, 62, 745, - /* 740 */ 869, 2414, 706, 711, 453, 452, 2931, 2736, 705, 541, - /* 750 */ 2754, 540, 451, 701, 700, 699, 214, 12, 1521, 2023, - /* 760 */ 547, 2038, 851, 1968, 2896, 479, 2701, 1965, 850, 2494, - /* 770 */ 879, 40, 39, 1946, 181, 46, 44, 43, 42, 41, - /* 780 */ 644, 498, 664, 539, 606, 2419, 47, 45, 748, 642, - /* 790 */ 181, 2754, 638, 634, 476, 617, 1940, 1999, 869, 2414, - /* 800 */ 2474, 2419, 92, 975, 559, 2538, 48, 2701, 496, 850, - /* 810 */ 1938, 2511, 2028, 2735, 2468, 2469, 2774, 1970, 548, 2472, - /* 820 */ 121, 2737, 854, 2739, 2740, 849, 1611, 873, 869, 2414, - /* 830 */ 565, 2538, 2946, 324, 2828, 869, 2414, 381, 472, 2824, - /* 840 */ 869, 2414, 2023, 2030, 2031, 839, 665, 2562, 567, 869, - /* 850 */ 2414, 2152, 243, 3, 2735, 581, 1946, 2774, 234, 2187, - /* 860 */ 669, 121, 2737, 854, 2739, 2740, 849, 53, 873, 582, - /* 870 */ 750, 2608, 1613, 2946, 1946, 2828, 100, 605, 242, 472, - /* 880 */ 2824, 51, 2001, 2011, 236, 213, 975, 596, 2538, 15, - /* 890 */ 903, 603, 2029, 2032, 446, 40, 39, 459, 2616, 46, - /* 900 */ 44, 43, 42, 41, 2409, 274, 12, 1941, 10, 1939, - /* 910 */ 780, 779, 2150, 2151, 2153, 2154, 2155, 878, 877, 876, - /* 920 */ 29, 193, 324, 2144, 589, 2521, 2030, 2031, 2059, 2227, - /* 930 */ 687, 683, 679, 675, 2390, 273, 322, 2145, 2002, 588, - /* 940 */ 834, 241, 2800, 1944, 1945, 1998, 1970, 2000, 2003, 2004, - /* 950 */ 2005, 2006, 2007, 2008, 2009, 2010, 846, 871, 870, 2022, - /* 960 */ 2024, 2025, 2026, 2027, 2, 2001, 2011, 84, 419, 557, - /* 970 */ 1963, 2194, 2474, 869, 2414, 2029, 2032, 594, 869, 2414, - /* 980 */ 445, 101, 587, 2143, 160, 2116, 271, 586, 614, 2701, - /* 990 */ 1941, 825, 1939, 583, 2406, 585, 869, 2414, 2411, 763, - /* 1000 */ 184, 1999, 292, 2164, 573, 836, 616, 2800, 2347, 869, - /* 1010 */ 2414, 420, 575, 40, 39, 34, 294, 46, 44, 43, - /* 1020 */ 42, 41, 2049, 553, 2843, 2064, 1944, 1945, 1998, 302, - /* 1030 */ 2000, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 846, - /* 1040 */ 871, 870, 2022, 2024, 2025, 2026, 2027, 2, 869, 2414, - /* 1050 */ 2840, 40, 39, 259, 522, 46, 44, 43, 42, 41, - /* 1060 */ 1940, 1969, 270, 1502, 444, 324, 261, 268, 816, 1964, - /* 1070 */ 869, 2414, 266, 661, 1938, 113, 561, 2298, 225, 910, - /* 1080 */ 174, 173, 907, 906, 905, 171, 2736, 1867, 1868, 2193, - /* 1090 */ 335, 258, 40, 39, 1523, 1524, 46, 44, 43, 42, - /* 1100 */ 41, 851, 2407, 775, 689, 688, 2930, 2549, 2528, 1500, - /* 1110 */ 602, 601, 600, 599, 598, 593, 592, 591, 590, 427, - /* 1120 */ 1946, 2163, 580, 579, 578, 577, 576, 570, 569, 568, - /* 1130 */ 2754, 563, 562, 442, 2226, 1498, 1499, 554, 1774, 1775, - /* 1140 */ 60, 691, 690, 182, 1793, 78, 2701, 805, 850, 158, - /* 1150 */ 975, 761, 2799, 2417, 946, 945, 944, 943, 505, 2135, - /* 1160 */ 942, 941, 162, 936, 935, 934, 933, 932, 931, 930, - /* 1170 */ 161, 924, 923, 922, 504, 503, 919, 918, 917, 198, - /* 1180 */ 197, 916, 500, 915, 914, 913, 1969, 502, 501, 869, - /* 1190 */ 2414, 2736, 1965, 2735, 2701, 2225, 2774, 1954, 2224, 91, - /* 1200 */ 121, 2737, 854, 2739, 2740, 849, 851, 873, 2919, 830, - /* 1210 */ 721, 1947, 2946, 2028, 2828, 2223, 33, 2222, 472, 2824, - /* 1220 */ 2221, 2736, 40, 39, 2220, 735, 46, 44, 43, 42, - /* 1230 */ 41, 1627, 869, 2414, 221, 2754, 851, 104, 2860, 869, - /* 1240 */ 2414, 2641, 2217, 2023, 289, 1626, 869, 2414, 1520, 2476, - /* 1250 */ 1519, 2701, 342, 850, 1941, 2701, 1939, 1946, 2701, 862, - /* 1260 */ 724, 374, 2216, 450, 449, 2754, 863, 718, 716, 869, - /* 1270 */ 2414, 1841, 869, 2414, 286, 2701, 303, 2701, 710, 709, - /* 1280 */ 2701, 2701, 2115, 850, 2701, 2215, 1521, 838, 181, 867, - /* 1290 */ 1944, 1945, 370, 940, 938, 1970, 2474, 2214, 2735, 2420, - /* 1300 */ 2843, 2774, 2701, 2234, 968, 121, 2737, 854, 2739, 2740, - /* 1310 */ 849, 802, 873, 2213, 2622, 2473, 164, 2946, 2212, 2828, - /* 1320 */ 72, 619, 2701, 472, 2824, 71, 2839, 105, 2735, 2211, - /* 1330 */ 2210, 2774, 2654, 792, 150, 121, 2737, 854, 2739, 2740, - /* 1340 */ 849, 2736, 873, 448, 447, 2701, 695, 2946, 90, 2828, - /* 1350 */ 425, 424, 35, 472, 2824, 2209, 851, 2701, 40, 39, - /* 1360 */ 483, 380, 46, 44, 43, 42, 41, 697, 2196, 2197, - /* 1370 */ 2843, 696, 2736, 2701, 492, 293, 2028, 904, 2701, 908, - /* 1380 */ 2465, 909, 2465, 1606, 2465, 2754, 764, 851, 2391, 2701, - /* 1390 */ 2701, 1955, 279, 1950, 2926, 277, 2838, 2283, 738, 1857, - /* 1400 */ 737, 2701, 2105, 850, 615, 1949, 2023, 281, 2736, 164, - /* 1410 */ 280, 283, 2932, 218, 282, 2701, 2754, 2927, 799, 717, - /* 1420 */ 1970, 163, 2655, 851, 801, 299, 1999, 1958, 1960, 1607, - /* 1430 */ 285, 702, 2701, 284, 850, 387, 771, 49, 703, 806, - /* 1440 */ 2266, 871, 870, 2022, 2024, 2025, 2026, 2027, 2735, 2274, - /* 1450 */ 2272, 2774, 2754, 2722, 1604, 121, 2737, 854, 2739, 2740, - /* 1460 */ 849, 1602, 873, 49, 201, 172, 2418, 2803, 2701, 2828, - /* 1470 */ 850, 719, 722, 472, 2824, 2387, 764, 14, 13, 2735, - /* 1480 */ 212, 119, 2774, 116, 2926, 209, 121, 2737, 854, 2739, - /* 1490 */ 2740, 849, 1865, 873, 1948, 964, 329, 77, 2801, 64, - /* 1500 */ 2828, 49, 2932, 218, 472, 2824, 2348, 2927, 799, 1584, - /* 1510 */ 49, 77, 169, 349, 348, 2735, 2219, 2724, 2774, 2139, - /* 1520 */ 2149, 920, 121, 2737, 854, 2739, 2740, 849, 2889, 873, - /* 1530 */ 150, 172, 351, 350, 835, 192, 2828, 2736, 353, 352, - /* 1540 */ 472, 2824, 355, 354, 1576, 1673, 2148, 308, 815, 318, - /* 1550 */ 357, 356, 851, 781, 1931, 1585, 1907, 811, 359, 358, - /* 1560 */ 1664, 902, 901, 900, 1668, 899, 1670, 1671, 845, 844, - /* 1570 */ 310, 1679, 843, 1681, 1682, 842, 886, 883, 746, 333, - /* 1580 */ 822, 2754, 2065, 1557, 2012, 361, 360, 1952, 485, 484, - /* 1590 */ 1932, 363, 362, 1810, 1800, 345, 978, 2701, 74, 850, - /* 1600 */ 881, 803, 365, 364, 871, 870, 2022, 2024, 2025, 2026, - /* 1610 */ 2027, 921, 741, 866, 1655, 378, 367, 366, 2736, 170, - /* 1620 */ 910, 174, 173, 907, 906, 905, 171, 369, 368, 1558, - /* 1630 */ 966, 208, 749, 851, 1574, 152, 172, 2755, 2340, 2255, - /* 1640 */ 962, 958, 954, 950, 2735, 373, 151, 2774, 2879, 778, - /* 1650 */ 2339, 122, 2737, 854, 2739, 2740, 849, 169, 873, 465, - /* 1660 */ 785, 819, 2754, 461, 2547, 2828, 764, 506, 814, 2827, - /* 1670 */ 2824, 524, 2261, 2462, 2926, 793, 1951, 757, 2701, 794, - /* 1680 */ 850, 386, 2880, 1686, 2890, 320, 764, 2548, 315, 323, - /* 1690 */ 514, 120, 2932, 218, 2926, 2374, 346, 2927, 799, 2736, - /* 1700 */ 40, 39, 1694, 5, 46, 44, 43, 42, 41, 439, - /* 1710 */ 509, 1963, 2932, 218, 851, 1973, 523, 2927, 799, 1701, - /* 1720 */ 534, 227, 764, 2736, 226, 2735, 535, 826, 2774, 1699, - /* 1730 */ 2926, 537, 122, 2737, 854, 2739, 2740, 849, 848, 873, - /* 1740 */ 175, 229, 2736, 2754, 379, 1834, 2828, 551, 2932, 218, - /* 1750 */ 837, 2824, 1964, 2927, 799, 558, 240, 851, 560, 2701, - /* 1760 */ 564, 850, 566, 571, 608, 584, 2540, 2754, 595, 597, - /* 1770 */ 604, 607, 344, 609, 832, 620, 621, 327, 618, 246, - /* 1780 */ 245, 623, 326, 2701, 625, 850, 2754, 626, 249, 628, - /* 1790 */ 630, 1971, 4, 645, 656, 653, 257, 1966, 646, 658, - /* 1800 */ 654, 296, 2701, 96, 850, 1972, 852, 659, 1974, 2774, - /* 1810 */ 2736, 662, 660, 122, 2737, 854, 2739, 2740, 849, 260, - /* 1820 */ 873, 263, 1975, 265, 97, 851, 1976, 2828, 98, 2557, - /* 1830 */ 2735, 434, 2824, 2774, 2563, 692, 671, 410, 2737, 854, - /* 1840 */ 2739, 2740, 849, 847, 873, 833, 2793, 99, 272, 2735, - /* 1850 */ 2736, 694, 2774, 2404, 2754, 126, 186, 2737, 854, 2739, - /* 1860 */ 2740, 849, 276, 873, 2400, 851, 725, 278, 726, 413, - /* 1870 */ 2701, 177, 850, 123, 740, 2736, 2402, 2397, 178, 179, - /* 1880 */ 102, 742, 295, 1967, 751, 125, 2631, 752, 382, 758, - /* 1890 */ 851, 2609, 165, 300, 2754, 759, 2628, 2627, 753, 782, - /* 1900 */ 756, 820, 298, 765, 2886, 8, 768, 2867, 791, 766, - /* 1910 */ 2701, 769, 850, 767, 2895, 2894, 191, 2735, 2736, 2754, - /* 1920 */ 2774, 309, 305, 307, 189, 2737, 854, 2739, 2740, 849, - /* 1930 */ 796, 873, 311, 851, 313, 2701, 795, 850, 314, 466, - /* 1940 */ 2949, 807, 2925, 2847, 2736, 804, 156, 312, 2113, 316, - /* 1950 */ 1968, 2111, 204, 325, 166, 818, 383, 2735, 2577, 851, - /* 1960 */ 2774, 2844, 2754, 2576, 186, 2737, 854, 2739, 2740, 849, - /* 1970 */ 1, 873, 384, 2575, 470, 823, 824, 167, 2701, 831, - /* 1980 */ 850, 828, 2735, 800, 2947, 2774, 2736, 338, 2754, 122, - /* 1990 */ 2737, 854, 2739, 2740, 849, 61, 873, 2809, 858, 856, - /* 2000 */ 860, 851, 463, 2828, 2701, 385, 850, 861, 2825, 319, - /* 2010 */ 343, 112, 2887, 220, 2415, 115, 389, 2693, 1472, 2692, - /* 2020 */ 971, 2688, 2687, 2736, 2679, 2735, 875, 970, 2774, 2678, - /* 2030 */ 2754, 372, 411, 2737, 854, 2739, 2740, 849, 851, 873, - /* 2040 */ 2670, 2669, 2685, 2684, 176, 972, 2701, 375, 850, 967, - /* 2050 */ 376, 2735, 2676, 52, 2774, 2675, 974, 2664, 404, 2737, - /* 2060 */ 854, 2739, 2740, 849, 393, 873, 2663, 2754, 2682, 2681, - /* 2070 */ 464, 2673, 2672, 423, 2661, 2660, 2658, 414, 391, 2657, - /* 2080 */ 744, 2466, 431, 2701, 432, 850, 426, 401, 412, 402, - /* 2090 */ 2653, 2652, 2651, 2735, 85, 2646, 2774, 511, 512, 1891, - /* 2100 */ 411, 2737, 854, 2739, 2740, 849, 1892, 873, 224, 790, - /* 2110 */ 2736, 516, 2644, 518, 519, 520, 1890, 2643, 2642, 440, - /* 2120 */ 2640, 526, 2639, 528, 2638, 848, 530, 2637, 1878, 532, - /* 2130 */ 2735, 2613, 2736, 2774, 228, 2612, 230, 189, 2737, 854, - /* 2140 */ 2739, 2740, 849, 86, 873, 1837, 2590, 851, 1836, 2589, - /* 2150 */ 2588, 544, 545, 2587, 2754, 2586, 2530, 549, 1773, 2736, - /* 2160 */ 2527, 552, 2526, 2520, 555, 556, 2517, 233, 2516, 2515, - /* 2170 */ 2701, 2514, 850, 89, 851, 2519, 2754, 2518, 2513, 2512, - /* 2180 */ 235, 2510, 2509, 2508, 572, 2507, 237, 574, 2505, 2504, - /* 2190 */ 2503, 2502, 2701, 2501, 850, 2525, 2736, 2948, 2500, 2499, - /* 2200 */ 2498, 2523, 2506, 2754, 2497, 2496, 2495, 2493, 2492, 2491, - /* 2210 */ 2490, 851, 2489, 2488, 2487, 239, 475, 2735, 2486, 2701, - /* 2220 */ 2774, 850, 2485, 2736, 410, 2737, 854, 2739, 2740, 849, - /* 2230 */ 2484, 873, 2483, 2794, 95, 2555, 2524, 2522, 851, 2735, - /* 2240 */ 2754, 2482, 2774, 477, 2481, 2736, 411, 2737, 854, 2739, - /* 2250 */ 2740, 849, 2480, 873, 244, 1779, 2701, 2479, 850, 611, - /* 2260 */ 851, 2478, 2477, 2475, 613, 1624, 2735, 2754, 428, 2774, - /* 2270 */ 1628, 429, 2736, 411, 2737, 854, 2739, 2740, 849, 2305, - /* 2280 */ 873, 2304, 2303, 2701, 2302, 850, 1620, 851, 247, 2754, - /* 2290 */ 2300, 248, 250, 251, 2297, 631, 632, 633, 2296, 636, - /* 2300 */ 635, 2289, 637, 739, 639, 2701, 2774, 850, 640, 2736, - /* 2310 */ 406, 2737, 854, 2739, 2740, 849, 2754, 873, 641, 2276, - /* 2320 */ 2250, 643, 253, 2721, 851, 199, 1501, 81, 210, 651, - /* 2330 */ 2735, 2249, 2701, 2774, 850, 2611, 255, 396, 2737, 854, - /* 2340 */ 2739, 2740, 849, 82, 873, 2607, 2597, 2585, 262, 264, - /* 2350 */ 2736, 267, 2735, 2754, 2584, 2774, 2561, 269, 2554, 395, - /* 2360 */ 2737, 854, 2739, 2740, 849, 851, 873, 2392, 2299, 2701, - /* 2370 */ 2295, 850, 1550, 672, 674, 673, 2293, 676, 677, 2735, - /* 2380 */ 678, 2291, 2774, 681, 680, 2736, 397, 2737, 854, 2739, - /* 2390 */ 2740, 849, 2288, 873, 2754, 684, 682, 685, 2271, 686, - /* 2400 */ 851, 2269, 2270, 2268, 2246, 2394, 1705, 1706, 2393, 1610, - /* 2410 */ 2701, 1609, 850, 73, 1608, 1605, 2735, 2736, 275, 2774, - /* 2420 */ 2286, 1603, 1601, 403, 2737, 854, 2739, 2740, 849, 2754, - /* 2430 */ 873, 1600, 851, 1599, 2284, 1598, 2736, 1592, 454, 455, - /* 2440 */ 937, 2275, 1597, 939, 456, 2701, 720, 850, 1594, 1593, - /* 2450 */ 1591, 851, 2273, 457, 2245, 723, 2244, 2735, 2243, 727, - /* 2460 */ 2774, 2754, 2242, 729, 407, 2737, 854, 2739, 2740, 849, - /* 2470 */ 2241, 873, 731, 2240, 1872, 733, 1874, 2701, 1871, 850, - /* 2480 */ 2754, 128, 2736, 2610, 1862, 1876, 56, 28, 743, 67, - /* 2490 */ 1847, 2606, 2735, 1843, 297, 2774, 2701, 851, 850, 398, - /* 2500 */ 2737, 854, 2739, 2740, 849, 2596, 873, 57, 1845, 754, - /* 2510 */ 755, 2583, 301, 2582, 2736, 1822, 180, 2931, 760, 1821, - /* 2520 */ 770, 762, 20, 6, 2735, 2166, 2754, 2774, 462, 851, - /* 2530 */ 17, 408, 2737, 854, 2739, 2740, 849, 2140, 873, 30, - /* 2540 */ 304, 772, 2701, 2735, 850, 774, 2774, 7, 215, 306, - /* 2550 */ 399, 2737, 854, 2739, 2740, 849, 776, 873, 2754, 21, - /* 2560 */ 22, 203, 2147, 190, 202, 31, 32, 2134, 2722, 23, - /* 2570 */ 83, 216, 2106, 2108, 2701, 2104, 850, 65, 2736, 217, - /* 2580 */ 24, 2186, 2187, 2088, 18, 2181, 2180, 467, 2185, 2735, - /* 2590 */ 2184, 468, 2774, 851, 2087, 321, 409, 2737, 854, 2739, - /* 2600 */ 2740, 849, 2736, 873, 58, 59, 2581, 195, 2560, 106, - /* 2610 */ 107, 2559, 328, 108, 2142, 205, 334, 851, 69, 2553, - /* 2620 */ 827, 2735, 2754, 337, 2774, 821, 829, 2736, 400, 2737, - /* 2630 */ 854, 2739, 2740, 849, 109, 873, 25, 2040, 2701, 336, - /* 2640 */ 850, 11, 851, 2039, 13, 1956, 2754, 2015, 2050, 196, - /* 2650 */ 2014, 888, 206, 1991, 891, 339, 894, 897, 38, 2552, - /* 2660 */ 110, 2013, 2701, 16, 850, 859, 853, 2736, 26, 2389, - /* 2670 */ 864, 2754, 347, 1983, 27, 70, 865, 857, 341, 111, - /* 2680 */ 79, 880, 851, 2779, 116, 2735, 2778, 2701, 2774, 850, - /* 2690 */ 872, 2736, 416, 2737, 854, 2739, 2740, 849, 2017, 873, - /* 2700 */ 68, 2202, 874, 2201, 2199, 2200, 851, 1687, 494, 2735, - /* 2710 */ 882, 2754, 2774, 1684, 884, 885, 417, 2737, 854, 2739, - /* 2720 */ 2740, 849, 887, 873, 890, 1683, 1680, 2701, 1674, 850, - /* 2730 */ 893, 1672, 2736, 896, 2735, 2754, 1678, 2774, 371, 1677, - /* 2740 */ 117, 2748, 2737, 854, 2739, 2740, 849, 851, 873, 118, - /* 2750 */ 1676, 2701, 1700, 850, 1675, 80, 1696, 1588, 1548, 911, - /* 2760 */ 1587, 1586, 1583, 1580, 1579, 1578, 1577, 1575, 1573, 1572, - /* 2770 */ 925, 1618, 2736, 1571, 2735, 1617, 2754, 2774, 222, 927, - /* 2780 */ 1569, 2747, 2737, 854, 2739, 2740, 849, 851, 873, 1568, - /* 2790 */ 1567, 1566, 2701, 1565, 850, 1564, 1563, 1614, 2735, 2736, - /* 2800 */ 1612, 2774, 1560, 1559, 1556, 2746, 2737, 854, 2739, 2740, - /* 2810 */ 849, 1555, 873, 1554, 851, 1553, 2754, 2294, 2736, 947, - /* 2820 */ 949, 2292, 951, 2290, 948, 952, 953, 956, 955, 957, - /* 2830 */ 2287, 959, 2701, 851, 850, 960, 2267, 961, 963, 2735, - /* 2840 */ 2265, 965, 2774, 2754, 1490, 2239, 436, 2737, 854, 2739, - /* 2850 */ 2740, 849, 1478, 873, 1473, 969, 1480, 377, 973, 2701, - /* 2860 */ 1942, 850, 2754, 390, 976, 2205, 977, 2205, 2205, 2205, - /* 2870 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2701, 2735, - /* 2880 */ 850, 2205, 2774, 2736, 2205, 2205, 437, 2737, 854, 2739, - /* 2890 */ 2740, 849, 2205, 873, 2205, 2205, 2736, 2205, 851, 2205, - /* 2900 */ 2205, 2205, 2205, 2205, 2205, 2205, 2735, 2205, 2205, 2774, - /* 2910 */ 2205, 851, 2205, 433, 2737, 854, 2739, 2740, 849, 2205, - /* 2920 */ 873, 2205, 2205, 2205, 2205, 2735, 2205, 2754, 2774, 2205, - /* 2930 */ 2205, 2205, 438, 2737, 854, 2739, 2740, 849, 2205, 873, - /* 2940 */ 2754, 2205, 2205, 2701, 2205, 850, 2205, 2205, 2205, 2205, - /* 2950 */ 2205, 2205, 2205, 2205, 2205, 2205, 2701, 2205, 850, 2205, - /* 2960 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, - /* 2970 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, - /* 2980 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, - /* 2990 */ 852, 2205, 2205, 2774, 2205, 2205, 2205, 406, 2737, 854, - /* 3000 */ 2739, 2740, 849, 2735, 873, 2205, 2774, 2205, 2205, 2205, - /* 3010 */ 405, 2737, 854, 2739, 2740, 849, 2205, 873, + /* 0 */ 2751, 564, 2459, 514, 38, 685, 563, 2625, 571, 2567, + /* 10 */ 50, 49, 57, 55, 56, 54, 53, 52, 51, 40, + /* 20 */ 497, 490, 1981, 2711, 2625, 50, 49, 2622, 880, 56, + /* 30 */ 54, 53, 52, 51, 2006, 462, 1979, 2285, 2083, 2354, + /* 40 */ 217, 2793, 50, 49, 2623, 880, 56, 54, 53, 52, + /* 50 */ 51, 866, 2625, 831, 167, 2006, 834, 785, 633, 631, + /* 60 */ 809, 434, 865, 503, 242, 2998, 499, 2598, 2078, 686, + /* 70 */ 2618, 863, 2622, 880, 668, 755, 898, 669, 2310, 785, + /* 80 */ 894, 2470, 1987, 3004, 228, 2811, 673, 2998, 2999, 820, + /* 90 */ 2530, 749, 670, 753, 751, 298, 297, 2758, 460, 194, + /* 100 */ 158, 2758, 202, 875, 327, 3004, 228, 2403, 714, 2528, + /* 110 */ 2999, 820, 1000, 831, 167, 58, 971, 970, 969, 968, + /* 120 */ 526, 2447, 967, 966, 172, 961, 960, 959, 958, 957, + /* 130 */ 956, 955, 171, 949, 948, 947, 525, 524, 944, 943, + /* 140 */ 942, 208, 207, 941, 521, 940, 939, 938, 2792, 893, + /* 150 */ 2063, 2839, 2086, 2087, 173, 131, 2794, 879, 2796, 2797, + /* 160 */ 874, 302, 2322, 862, 898, 1533, 894, 2470, 2179, 210, + /* 170 */ 94, 2900, 580, 2594, 2006, 492, 2896, 204, 2908, 830, + /* 180 */ 608, 159, 829, 2793, 1540, 607, 158, 170, 819, 2998, + /* 190 */ 134, 2042, 2052, 606, 719, 229, 2998, 2462, 876, 516, + /* 200 */ 2472, 2085, 2088, 2947, 2263, 1826, 1827, 818, 228, 1535, + /* 210 */ 1538, 1539, 2999, 820, 818, 228, 1982, 989, 1980, 2999, + /* 220 */ 820, 2915, 9, 861, 221, 148, 244, 2811, 147, 146, + /* 230 */ 145, 144, 143, 142, 141, 140, 139, 137, 2908, 2909, + /* 240 */ 2517, 165, 2913, 2758, 60, 875, 1907, 1908, 1909, 2912, + /* 250 */ 479, 2672, 766, 1985, 1986, 2039, 2150, 2041, 2044, 2045, + /* 260 */ 2046, 2047, 2048, 2049, 2050, 2051, 871, 864, 42, 350, + /* 270 */ 896, 895, 2069, 2070, 2072, 2073, 2074, 2077, 2079, 2080, + /* 280 */ 2081, 2082, 2084, 2, 57, 55, 2175, 500, 2793, 195, + /* 290 */ 2792, 2274, 497, 2839, 1981, 2039, 191, 131, 2794, 879, + /* 300 */ 2796, 2797, 874, 873, 893, 862, 898, 2475, 1979, 169, + /* 310 */ 2083, 178, 2871, 2900, 2550, 50, 49, 492, 2896, 56, + /* 320 */ 54, 53, 52, 51, 676, 2200, 2793, 669, 2310, 217, + /* 330 */ 50, 49, 2811, 2150, 56, 54, 53, 52, 51, 2201, + /* 340 */ 2078, 876, 2702, 863, 2915, 2043, 904, 19, 2758, 3003, + /* 350 */ 875, 1560, 2461, 1559, 1987, 148, 2599, 2998, 147, 146, + /* 360 */ 145, 144, 143, 142, 141, 140, 139, 57, 55, 44, + /* 370 */ 2811, 2752, 2911, 523, 522, 497, 3002, 1981, 627, 301, + /* 380 */ 2999, 3001, 454, 300, 1000, 2199, 2758, 15, 875, 1561, + /* 390 */ 548, 1979, 893, 2083, 2474, 2792, 536, 1988, 2839, 2147, + /* 400 */ 2148, 2149, 429, 2794, 879, 2796, 2797, 874, 872, 2040, + /* 410 */ 862, 898, 854, 2865, 2357, 503, 935, 184, 183, 932, + /* 420 */ 931, 930, 181, 2078, 2086, 2087, 863, 2284, 898, 2341, + /* 430 */ 19, 2530, 2113, 2792, 503, 543, 2839, 1987, 2150, 488, + /* 440 */ 131, 2794, 879, 2796, 2797, 874, 253, 898, 862, 898, + /* 450 */ 2528, 736, 2094, 893, 2875, 765, 2900, 113, 2006, 235, + /* 460 */ 492, 2896, 443, 2042, 2052, 76, 477, 1000, 757, 610, + /* 470 */ 15, 626, 252, 2085, 2088, 2920, 2147, 2148, 2149, 2920, + /* 480 */ 2920, 2920, 2920, 2920, 609, 624, 3003, 2758, 1982, 124, + /* 490 */ 1980, 735, 734, 733, 2998, 861, 2006, 2114, 725, 164, + /* 500 */ 729, 903, 902, 901, 728, 72, 768, 2086, 2087, 727, + /* 510 */ 732, 472, 471, 3002, 2007, 726, 61, 2999, 3000, 470, + /* 520 */ 722, 721, 720, 586, 2594, 1985, 1986, 2039, 552, 2041, + /* 530 */ 2044, 2045, 2046, 2047, 2048, 2049, 2050, 2051, 871, 864, + /* 540 */ 804, 684, 896, 895, 2069, 2070, 2042, 2052, 60, 2077, + /* 550 */ 2079, 2080, 2081, 2082, 2084, 2, 2085, 2088, 554, 550, + /* 560 */ 50, 49, 2915, 2768, 56, 54, 53, 52, 51, 894, + /* 570 */ 2470, 1982, 2010, 1980, 2530, 2119, 72, 246, 861, 1991, + /* 580 */ 2920, 2147, 2148, 2149, 2920, 2920, 2920, 2920, 2920, 520, + /* 590 */ 2910, 72, 2772, 838, 41, 494, 2108, 2109, 2110, 2111, + /* 600 */ 2112, 2116, 2117, 2118, 894, 2470, 2454, 441, 1985, 1986, + /* 610 */ 2039, 687, 2041, 2044, 2045, 2046, 2047, 2048, 2049, 2050, + /* 620 */ 2051, 871, 864, 691, 233, 896, 895, 2069, 2070, 2043, + /* 630 */ 769, 114, 2077, 2079, 2080, 2081, 2082, 2084, 2, 12, + /* 640 */ 57, 55, 2774, 2776, 493, 688, 1752, 1753, 497, 518, + /* 650 */ 1981, 2283, 2523, 2525, 248, 898, 509, 1713, 810, 805, + /* 660 */ 798, 794, 831, 167, 1979, 1881, 2083, 2152, 2153, 2154, + /* 670 */ 2155, 2156, 1704, 927, 926, 925, 1708, 924, 1710, 1711, + /* 680 */ 923, 920, 2793, 1719, 917, 1721, 1722, 914, 911, 908, + /* 690 */ 2262, 951, 1560, 2040, 1559, 2007, 2078, 876, 334, 863, + /* 700 */ 104, 2010, 501, 19, 2612, 103, 689, 217, 163, 334, + /* 710 */ 1987, 2758, 678, 2664, 157, 156, 155, 154, 153, 152, + /* 720 */ 151, 150, 149, 57, 55, 2089, 2811, 192, 469, 468, + /* 730 */ 1561, 497, 512, 1981, 2598, 1713, 516, 2472, 2524, 2525, + /* 740 */ 1000, 334, 2758, 15, 875, 224, 123, 1979, 1651, 2083, + /* 750 */ 1704, 927, 926, 925, 1708, 924, 1710, 1711, 870, 869, + /* 760 */ 953, 1719, 868, 1721, 1722, 867, 911, 908, 937, 334, + /* 770 */ 50, 49, 102, 2463, 56, 54, 53, 52, 51, 2078, + /* 780 */ 2086, 2087, 863, 2530, 334, 2260, 198, 2908, 2909, 2792, + /* 790 */ 165, 2913, 2839, 1987, 1653, 33, 131, 2794, 879, 2796, + /* 800 */ 2797, 874, 846, 767, 862, 898, 2010, 2011, 467, 466, + /* 810 */ 2873, 716, 2900, 2282, 769, 72, 492, 2896, 313, 2042, + /* 820 */ 2052, 1003, 665, 1000, 1563, 1564, 58, 1853, 1854, 2085, + /* 830 */ 2088, 663, 718, 3003, 659, 655, 717, 12, 1950, 10, + /* 840 */ 388, 264, 894, 2470, 1982, 671, 1980, 2318, 14, 13, + /* 850 */ 2009, 861, 2010, 50, 49, 991, 218, 56, 54, 53, + /* 860 */ 52, 51, 65, 2086, 2087, 987, 983, 979, 975, 115, + /* 870 */ 383, 508, 507, 2758, 529, 2768, 1852, 1855, 2220, 528, + /* 880 */ 2172, 1985, 1986, 2039, 2006, 2041, 2044, 2045, 2046, 2047, + /* 890 */ 2048, 2049, 2050, 2051, 871, 864, 771, 2664, 896, 895, + /* 900 */ 2069, 2070, 2042, 2052, 2772, 2077, 2079, 2080, 2081, 2082, + /* 910 */ 2084, 2, 2085, 2088, 1949, 562, 130, 561, 50, 49, + /* 920 */ 2009, 356, 56, 54, 53, 52, 51, 1982, 860, 1980, + /* 930 */ 785, 266, 2444, 519, 861, 671, 2011, 2318, 2998, 894, + /* 940 */ 2470, 2530, 191, 831, 167, 12, 2243, 511, 510, 502, + /* 950 */ 560, 808, 847, 2475, 2774, 2777, 3004, 228, 384, 568, + /* 960 */ 2528, 2999, 820, 2127, 1985, 1986, 2039, 898, 2041, 2044, + /* 970 */ 2045, 2046, 2047, 2048, 2049, 2050, 2051, 871, 864, 223, + /* 980 */ 2811, 896, 895, 2069, 2070, 855, 742, 2872, 2077, 2079, + /* 990 */ 2080, 2081, 2082, 2084, 2, 57, 55, 354, 2793, 853, + /* 1000 */ 391, 756, 337, 497, 2281, 1981, 937, 336, 334, 954, + /* 1010 */ 50, 49, 2429, 834, 56, 54, 53, 52, 51, 1979, + /* 1020 */ 299, 2083, 1540, 332, 2678, 231, 306, 50, 49, 391, + /* 1030 */ 37, 56, 54, 53, 52, 51, 745, 894, 2470, 894, + /* 1040 */ 2470, 2011, 2811, 739, 737, 617, 2594, 2793, 1538, 1539, + /* 1050 */ 296, 2078, 807, 2250, 863, 2043, 2006, 569, 2758, 588, + /* 1060 */ 875, 2673, 876, 1663, 2758, 1987, 833, 197, 2908, 2909, + /* 1070 */ 1542, 165, 2913, 2208, 894, 2470, 2005, 1662, 57, 55, + /* 1080 */ 56, 54, 53, 52, 51, 303, 497, 2011, 1981, 478, + /* 1090 */ 2672, 2811, 2530, 332, 602, 1000, 82, 110, 58, 251, + /* 1100 */ 517, 81, 1979, 135, 2083, 2792, 2105, 2758, 2839, 875, + /* 1110 */ 1667, 2528, 131, 2794, 879, 2796, 2797, 874, 2062, 2040, + /* 1120 */ 862, 898, 341, 342, 1666, 2466, 210, 340, 2900, 894, + /* 1130 */ 2470, 784, 492, 2896, 2078, 2086, 2087, 863, 894, 2470, + /* 1140 */ 801, 800, 2206, 2207, 2209, 2210, 2211, 3002, 1987, 603, + /* 1150 */ 53, 52, 51, 638, 2792, 110, 168, 2839, 604, 2871, + /* 1160 */ 2948, 196, 2794, 879, 2796, 2797, 874, 710, 709, 862, + /* 1170 */ 898, 819, 192, 465, 2042, 2052, 894, 2470, 1000, 2998, + /* 1180 */ 2249, 58, 2473, 2465, 2085, 2088, 2171, 50, 49, 712, + /* 1190 */ 711, 56, 54, 53, 52, 51, 690, 818, 228, 1982, + /* 1200 */ 640, 1980, 2999, 820, 894, 2470, 861, 2115, 50, 49, + /* 1210 */ 786, 2958, 56, 54, 53, 52, 51, 929, 2086, 2087, + /* 1220 */ 2521, 731, 730, 857, 2467, 2872, 933, 50, 49, 2521, + /* 1230 */ 2280, 56, 54, 53, 52, 51, 1985, 1986, 2039, 2446, + /* 1240 */ 2041, 2044, 2045, 2046, 2047, 2048, 2049, 2050, 2051, 871, + /* 1250 */ 864, 2279, 2278, 896, 895, 2069, 2070, 2042, 2052, 2530, + /* 1260 */ 2077, 2079, 2080, 2081, 2082, 2084, 2, 2085, 2088, 50, + /* 1270 */ 49, 43, 70, 56, 54, 53, 52, 51, 2529, 735, + /* 1280 */ 734, 733, 1982, 782, 1980, 2120, 725, 164, 729, 861, + /* 1290 */ 2758, 2040, 728, 894, 2470, 2219, 2277, 727, 732, 472, + /* 1300 */ 471, 2532, 2276, 726, 39, 2273, 191, 470, 722, 721, + /* 1310 */ 720, 2758, 2758, 304, 894, 2470, 2191, 2476, 398, 1985, + /* 1320 */ 1986, 2039, 2507, 2041, 2044, 2045, 2046, 2047, 2048, 2049, + /* 1330 */ 2050, 2051, 871, 864, 312, 2059, 896, 895, 2069, 2070, + /* 1340 */ 3, 894, 2470, 2077, 2079, 2080, 2081, 2082, 2084, 2, + /* 1350 */ 57, 55, 1981, 2272, 63, 438, 2758, 2004, 497, 823, + /* 1360 */ 1981, 837, 2758, 2793, 615, 2758, 1979, 464, 965, 963, + /* 1370 */ 2290, 993, 894, 2470, 1979, 635, 2083, 2060, 876, 2698, + /* 1380 */ 894, 2470, 894, 2470, 935, 184, 183, 932, 931, 930, + /* 1390 */ 181, 594, 345, 637, 894, 2470, 894, 2470, 439, 596, + /* 1400 */ 851, 934, 352, 813, 2521, 2271, 2078, 2811, 2577, 863, + /* 1410 */ 574, 2270, 1987, 2758, 887, 2269, 888, 826, 894, 2470, + /* 1420 */ 1987, 894, 2470, 2758, 182, 875, 1987, 718, 2268, 50, + /* 1430 */ 49, 717, 2267, 56, 54, 53, 52, 51, 892, 50, + /* 1440 */ 49, 380, 1000, 56, 54, 53, 52, 51, 2266, 928, + /* 1450 */ 1000, 463, 578, 15, 50, 49, 636, 2457, 56, 54, + /* 1460 */ 53, 52, 51, 582, 759, 2758, 758, 2265, 45, 160, + /* 1470 */ 2792, 2758, 2161, 2839, 822, 2758, 1646, 416, 2794, 879, + /* 1480 */ 2796, 2797, 874, 100, 31, 862, 898, 2443, 2758, 88, + /* 1490 */ 2086, 2087, 2758, 289, 2605, 2584, 287, 623, 622, 621, + /* 1500 */ 620, 619, 614, 613, 612, 611, 447, 64, 2758, 601, + /* 1510 */ 600, 599, 598, 597, 591, 590, 589, 2779, 584, 583, + /* 1520 */ 461, 723, 1647, 2339, 575, 1814, 1815, 2758, 724, 2042, + /* 1530 */ 2052, 1833, 291, 293, 295, 290, 292, 294, 2330, 2085, + /* 1540 */ 2088, 2252, 2253, 101, 1644, 738, 1982, 2058, 1980, 284, + /* 1550 */ 2328, 1642, 14, 13, 1982, 390, 1980, 174, 309, 174, + /* 1560 */ 740, 861, 2057, 50, 49, 203, 792, 56, 54, 53, + /* 1570 */ 52, 51, 743, 59, 708, 704, 700, 696, 222, 283, + /* 1580 */ 59, 2781, 211, 1985, 1986, 182, 397, 359, 358, 361, + /* 1590 */ 360, 1985, 1986, 2039, 2474, 2041, 2044, 2045, 2046, 2047, + /* 1600 */ 2048, 2049, 2050, 2051, 871, 864, 339, 87, 896, 895, + /* 1610 */ 2069, 2070, 363, 362, 1624, 2077, 2079, 2080, 2081, 2082, + /* 1620 */ 2084, 2, 193, 2275, 219, 111, 2793, 404, 365, 364, + /* 1630 */ 281, 2404, 935, 184, 183, 932, 931, 930, 181, 2712, + /* 1640 */ 1897, 876, 1905, 2320, 2961, 1990, 402, 86, 202, 2195, + /* 1650 */ 85, 59, 2793, 1989, 74, 59, 2205, 129, 824, 126, + /* 1660 */ 1625, 440, 328, 2204, 762, 318, 802, 876, 836, 2955, + /* 1670 */ 2811, 367, 366, 262, 650, 648, 645, 643, 369, 368, + /* 1680 */ 59, 320, 371, 370, 373, 372, 2758, 832, 875, 343, + /* 1690 */ 843, 375, 374, 377, 376, 785, 2811, 269, 379, 378, + /* 1700 */ 162, 59, 87, 2998, 2812, 2396, 280, 179, 945, 770, + /* 1710 */ 271, 278, 2758, 2311, 875, 2395, 276, 682, 827, 72, + /* 1720 */ 785, 3004, 228, 160, 182, 2951, 2999, 820, 2998, 799, + /* 1730 */ 484, 1616, 84, 2792, 2061, 268, 2839, 2121, 2064, 806, + /* 1740 */ 131, 2794, 879, 2796, 2797, 874, 3004, 228, 862, 898, + /* 1750 */ 906, 2999, 820, 480, 3018, 835, 2900, 1597, 73, 2792, + /* 1760 */ 492, 2896, 2839, 2053, 2793, 785, 131, 2794, 879, 2796, + /* 1770 */ 2797, 874, 946, 2998, 862, 898, 180, 182, 161, 876, + /* 1780 */ 3018, 2968, 2900, 179, 1850, 1840, 492, 2896, 2603, 840, + /* 1790 */ 355, 3004, 228, 527, 545, 1614, 2999, 820, 2317, 2518, + /* 1800 */ 778, 2952, 2962, 1598, 814, 815, 891, 1695, 2811, 330, + /* 1810 */ 333, 785, 98, 97, 567, 396, 325, 241, 2604, 2998, + /* 1820 */ 2430, 5, 530, 46, 2758, 535, 875, 1993, 2004, 458, + /* 1830 */ 559, 557, 544, 1726, 2014, 1992, 556, 3004, 228, 555, + /* 1840 */ 2793, 558, 2999, 820, 437, 236, 237, 546, 1874, 239, + /* 1850 */ 542, 538, 534, 531, 560, 876, 389, 796, 572, 1734, + /* 1860 */ 1741, 1739, 2005, 579, 250, 581, 185, 585, 587, 616, + /* 1870 */ 629, 2792, 592, 605, 2839, 2596, 618, 625, 131, 2794, + /* 1880 */ 879, 2796, 2797, 874, 2811, 628, 862, 898, 630, 2793, + /* 1890 */ 641, 642, 3018, 639, 2900, 255, 256, 644, 492, 2896, + /* 1900 */ 2758, 646, 875, 647, 876, 259, 2991, 649, 651, 2012, + /* 1910 */ 666, 4, 334, 667, 674, 523, 522, 675, 267, 677, + /* 1920 */ 2793, 106, 2007, 2613, 679, 1995, 2013, 680, 270, 2015, + /* 1930 */ 681, 273, 683, 2811, 2016, 876, 2619, 2932, 2017, 1988, + /* 1940 */ 275, 2083, 107, 761, 108, 715, 109, 2792, 692, 2758, + /* 1950 */ 2839, 875, 713, 282, 131, 2794, 879, 2796, 2797, 874, + /* 1960 */ 746, 747, 862, 898, 2811, 136, 432, 763, 3018, 2460, + /* 1970 */ 2900, 2078, 286, 112, 492, 2896, 2456, 288, 2688, 187, + /* 1980 */ 2758, 133, 875, 392, 2685, 1987, 2458, 2453, 175, 305, + /* 1990 */ 188, 189, 2008, 2665, 773, 772, 2792, 310, 780, 2839, + /* 2000 */ 841, 779, 803, 131, 2794, 879, 2796, 2797, 874, 2684, + /* 2010 */ 777, 862, 898, 789, 2967, 859, 2793, 3018, 2966, 2900, + /* 2020 */ 8, 774, 812, 492, 2896, 790, 319, 2792, 2939, 201, + /* 2030 */ 2839, 876, 315, 322, 131, 2794, 879, 2796, 2797, 874, + /* 2040 */ 317, 321, 862, 898, 308, 787, 788, 323, 3018, 817, + /* 2050 */ 2900, 445, 444, 816, 492, 2896, 324, 2919, 485, 3021, + /* 2060 */ 2811, 504, 828, 825, 166, 2009, 2169, 2167, 2916, 214, + /* 2070 */ 393, 335, 176, 839, 2633, 513, 2758, 2083, 875, 2632, + /* 2080 */ 2631, 394, 2997, 844, 489, 845, 177, 849, 852, 71, + /* 2090 */ 883, 881, 885, 2471, 348, 886, 395, 353, 122, 2750, + /* 2100 */ 2749, 326, 2745, 2881, 2744, 2736, 2735, 2078, 125, 2793, + /* 2110 */ 399, 382, 2727, 900, 1, 1512, 230, 995, 996, 1996, + /* 2120 */ 2726, 1991, 2742, 2792, 876, 186, 2839, 329, 997, 385, + /* 2130 */ 131, 2794, 879, 2796, 2797, 874, 992, 386, 862, 898, + /* 2140 */ 765, 2741, 999, 2733, 856, 2710, 2900, 2732, 401, 2793, + /* 2150 */ 492, 2896, 2721, 2811, 420, 2720, 1999, 2001, 2739, 2738, + /* 2160 */ 2730, 2729, 2718, 2717, 876, 2715, 433, 431, 2714, 2758, + /* 2170 */ 442, 875, 2522, 896, 895, 421, 62, 403, 450, 2709, + /* 2180 */ 2077, 2079, 2080, 2081, 2082, 2084, 446, 2708, 95, 2703, + /* 2190 */ 532, 533, 1932, 2811, 451, 1933, 234, 537, 2701, 539, + /* 2200 */ 540, 1931, 541, 2700, 2699, 459, 2697, 547, 2696, 2758, + /* 2210 */ 549, 875, 551, 2694, 553, 1919, 2792, 2695, 2669, 2839, + /* 2220 */ 238, 2668, 240, 132, 2794, 879, 2796, 2797, 874, 96, + /* 2230 */ 1877, 862, 898, 1876, 2793, 2646, 2645, 2644, 565, 2900, + /* 2240 */ 566, 2643, 2642, 2899, 2896, 2586, 570, 1813, 2583, 876, + /* 2250 */ 573, 2582, 2576, 577, 2573, 1972, 2792, 1948, 576, 2839, + /* 2260 */ 243, 2572, 99, 132, 2794, 879, 2796, 2797, 874, 2571, + /* 2270 */ 2793, 862, 898, 2570, 2575, 245, 2574, 2569, 2811, 2900, + /* 2280 */ 2568, 2566, 2565, 858, 2896, 876, 2564, 247, 2563, 593, + /* 2290 */ 506, 505, 1973, 595, 2758, 2561, 875, 2560, 2559, 2558, + /* 2300 */ 2557, 2581, 2556, 2555, 2554, 2579, 2562, 2553, 2552, 896, + /* 2310 */ 895, 2551, 2549, 2548, 2811, 2547, 2077, 2079, 2080, 2081, + /* 2320 */ 2082, 2084, 2546, 2545, 2544, 2543, 249, 2542, 2541, 2540, + /* 2330 */ 2758, 105, 875, 2539, 2611, 2580, 2578, 2538, 2537, 2536, + /* 2340 */ 1819, 877, 254, 2535, 2839, 632, 2793, 2534, 132, 2794, + /* 2350 */ 879, 2796, 2797, 874, 2533, 2531, 862, 898, 634, 2361, + /* 2360 */ 257, 876, 1664, 1668, 2900, 2360, 448, 1660, 453, 2896, + /* 2370 */ 2359, 449, 2358, 2356, 2353, 653, 654, 2792, 258, 2352, + /* 2380 */ 2839, 83, 652, 2345, 199, 2794, 879, 2796, 2797, 874, + /* 2390 */ 2811, 2332, 862, 898, 260, 2793, 656, 658, 261, 660, + /* 2400 */ 662, 2306, 657, 661, 664, 263, 2758, 1541, 875, 209, + /* 2410 */ 876, 91, 2778, 220, 2305, 672, 265, 2667, 2663, 92, + /* 2420 */ 2653, 2641, 272, 274, 2640, 2617, 2610, 2793, 277, 2448, + /* 2430 */ 2355, 279, 2351, 1590, 693, 2349, 695, 2347, 694, 2811, + /* 2440 */ 697, 698, 876, 699, 701, 821, 3019, 703, 702, 2344, + /* 2450 */ 706, 705, 2327, 2792, 707, 2758, 2839, 875, 2325, 2326, + /* 2460 */ 132, 2794, 879, 2796, 2797, 874, 2324, 2302, 862, 898, + /* 2470 */ 2450, 2811, 1746, 285, 2449, 1745, 2900, 1650, 1649, 1648, + /* 2480 */ 1645, 2897, 1643, 1641, 1640, 2342, 1639, 2758, 2340, 875, + /* 2490 */ 1638, 1632, 1637, 962, 964, 473, 2331, 474, 1634, 1633, + /* 2500 */ 1631, 475, 2792, 2329, 476, 2839, 2301, 741, 744, 196, + /* 2510 */ 2794, 879, 2796, 2797, 874, 2300, 2793, 862, 898, 2299, + /* 2520 */ 748, 2298, 750, 2297, 2296, 752, 754, 138, 1913, 1915, + /* 2530 */ 1912, 876, 1917, 2666, 2792, 66, 2793, 2839, 32, 1887, + /* 2540 */ 2662, 423, 2794, 879, 2796, 2797, 874, 1883, 764, 862, + /* 2550 */ 898, 876, 307, 77, 1885, 2652, 775, 2639, 2638, 2959, + /* 2560 */ 2811, 21, 67, 3003, 6, 311, 791, 481, 17, 7, + /* 2570 */ 190, 22, 23, 1902, 213, 776, 2758, 225, 875, 1862, + /* 2580 */ 2811, 1861, 36, 34, 24, 226, 2779, 2222, 781, 2164, + /* 2590 */ 2162, 314, 783, 793, 811, 200, 2758, 2196, 875, 316, + /* 2600 */ 482, 2793, 797, 795, 75, 25, 18, 2237, 69, 2236, + /* 2610 */ 486, 2203, 212, 35, 2241, 2190, 876, 93, 2240, 487, + /* 2620 */ 483, 2793, 346, 2792, 2637, 2160, 2839, 331, 227, 2616, + /* 2630 */ 430, 2794, 879, 2796, 2797, 874, 873, 205, 862, 898, + /* 2640 */ 117, 2242, 116, 2792, 215, 2811, 2839, 2615, 118, 68, + /* 2650 */ 430, 2794, 879, 2796, 2797, 874, 2609, 119, 862, 898, + /* 2660 */ 2243, 2758, 2144, 875, 2143, 2811, 338, 2198, 26, 344, + /* 2670 */ 13, 79, 1997, 2032, 206, 848, 347, 2096, 2095, 2056, + /* 2680 */ 11, 2758, 349, 875, 2106, 27, 2608, 120, 216, 878, + /* 2690 */ 2445, 889, 28, 357, 20, 47, 842, 2055, 2258, 913, + /* 2700 */ 916, 850, 919, 922, 48, 16, 2793, 2054, 2792, 29, + /* 2710 */ 30, 2839, 884, 2024, 80, 199, 2794, 879, 2796, 2797, + /* 2720 */ 874, 876, 882, 862, 898, 351, 121, 890, 2792, 126, + /* 2730 */ 89, 2839, 2850, 2849, 2793, 429, 2794, 879, 2796, 2797, + /* 2740 */ 874, 2066, 897, 862, 898, 78, 2866, 899, 2257, 876, + /* 2750 */ 2811, 2256, 905, 515, 1727, 907, 909, 1724, 912, 910, + /* 2760 */ 915, 1723, 1720, 918, 1714, 2255, 2758, 921, 875, 1718, + /* 2770 */ 2793, 1712, 127, 381, 128, 1740, 1717, 3020, 2811, 90, + /* 2780 */ 1736, 1588, 936, 1628, 1627, 876, 1716, 1626, 1623, 1715, + /* 2790 */ 495, 1620, 1619, 1618, 2758, 1617, 875, 1658, 1615, 1613, + /* 2800 */ 1612, 1611, 950, 1657, 952, 232, 1609, 1608, 2350, 1607, + /* 2810 */ 1606, 1605, 1604, 2792, 2811, 1603, 2839, 1654, 491, 1652, + /* 2820 */ 430, 2794, 879, 2796, 2797, 874, 1600, 1599, 862, 898, + /* 2830 */ 2758, 1596, 875, 1595, 1594, 1593, 972, 974, 973, 2348, + /* 2840 */ 976, 2792, 978, 977, 2839, 2346, 2793, 980, 413, 2794, + /* 2850 */ 879, 2796, 2797, 874, 496, 981, 862, 898, 2343, 982, + /* 2860 */ 984, 876, 986, 985, 2323, 988, 2793, 2321, 990, 1530, + /* 2870 */ 2295, 1513, 1518, 994, 1520, 387, 998, 2792, 1983, 400, + /* 2880 */ 2839, 876, 1001, 1002, 430, 2794, 879, 2796, 2797, 874, + /* 2890 */ 2811, 2261, 862, 898, 2261, 2261, 2261, 2261, 2261, 2261, + /* 2900 */ 2261, 2261, 2261, 2261, 2261, 2261, 2758, 2261, 875, 2261, + /* 2910 */ 2811, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, + /* 2920 */ 2261, 2261, 2261, 2261, 2261, 2261, 2758, 2261, 875, 2261, + /* 2930 */ 498, 2793, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, + /* 2940 */ 2261, 2261, 2261, 2261, 2261, 2261, 876, 2261, 2261, 2261, + /* 2950 */ 2261, 2261, 2261, 2792, 2261, 2261, 2839, 2261, 2261, 2261, + /* 2960 */ 430, 2794, 879, 2796, 2797, 874, 2261, 2261, 862, 898, + /* 2970 */ 2261, 2261, 2261, 2792, 2261, 2811, 2839, 2261, 2261, 2261, + /* 2980 */ 415, 2794, 879, 2796, 2797, 874, 2261, 2261, 862, 898, + /* 2990 */ 2261, 2758, 2261, 875, 2261, 2261, 2261, 2261, 2261, 2261, + /* 3000 */ 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, + /* 3010 */ 2261, 2793, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, + /* 3020 */ 2261, 2261, 2261, 2261, 2261, 2793, 876, 2261, 2261, 2261, + /* 3030 */ 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 760, 2261, + /* 3040 */ 876, 2839, 2793, 2261, 2261, 425, 2794, 879, 2796, 2797, + /* 3050 */ 874, 2261, 2261, 862, 898, 2811, 2261, 876, 2261, 2261, + /* 3060 */ 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2811, + /* 3070 */ 2261, 2758, 2261, 875, 2261, 2261, 2261, 2261, 2261, 2261, + /* 3080 */ 2261, 2261, 2261, 2261, 2261, 2758, 2811, 875, 2261, 2261, + /* 3090 */ 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, + /* 3100 */ 2261, 2261, 2758, 2261, 875, 2261, 2261, 2793, 2261, 2261, + /* 3110 */ 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2792, 2261, + /* 3120 */ 2261, 2839, 876, 2261, 2261, 407, 2794, 879, 2796, 2797, + /* 3130 */ 874, 2261, 2792, 862, 898, 2839, 2261, 2261, 2261, 405, + /* 3140 */ 2794, 879, 2796, 2797, 874, 2261, 2261, 862, 898, 2792, + /* 3150 */ 2261, 2811, 2839, 2261, 2261, 2261, 408, 2794, 879, 2796, + /* 3160 */ 2797, 874, 2261, 2261, 862, 898, 2261, 2758, 2261, 875, + /* 3170 */ 2261, 2261, 2261, 2261, 2261, 2793, 2261, 2261, 2261, 2261, + /* 3180 */ 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, + /* 3190 */ 876, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, + /* 3200 */ 2261, 2261, 2261, 2793, 2261, 2261, 2261, 2261, 2261, 2261, + /* 3210 */ 2261, 2261, 2261, 2261, 2792, 2261, 2261, 2839, 876, 2811, + /* 3220 */ 2261, 422, 2794, 879, 2796, 2797, 874, 2261, 2261, 862, + /* 3230 */ 898, 2261, 2261, 2261, 2261, 2758, 2261, 875, 2261, 2793, + /* 3240 */ 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2811, 2261, 2261, + /* 3250 */ 2261, 2261, 2261, 2261, 876, 2261, 2261, 2261, 2261, 2261, + /* 3260 */ 2261, 2261, 2261, 2758, 2261, 875, 2261, 2261, 2261, 2261, + /* 3270 */ 2261, 2793, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, + /* 3280 */ 2261, 2261, 2792, 2811, 2261, 2839, 876, 2261, 2261, 409, + /* 3290 */ 2794, 879, 2796, 2797, 874, 2261, 2261, 862, 898, 2758, + /* 3300 */ 2261, 875, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, + /* 3310 */ 2792, 2261, 2261, 2839, 2261, 2811, 2261, 426, 2794, 879, + /* 3320 */ 2796, 2797, 874, 2261, 2261, 862, 898, 2261, 2261, 2261, + /* 3330 */ 2261, 2758, 2261, 875, 2261, 2261, 2793, 2261, 2261, 2261, + /* 3340 */ 2261, 2261, 2261, 2261, 2261, 2261, 2792, 2261, 2261, 2839, + /* 3350 */ 2261, 876, 2261, 410, 2794, 879, 2796, 2797, 874, 2793, + /* 3360 */ 2261, 862, 898, 2261, 2261, 2261, 2261, 2261, 2261, 2261, + /* 3370 */ 2261, 2261, 2261, 2261, 876, 2261, 2261, 2261, 2792, 2261, + /* 3380 */ 2811, 2839, 2261, 2261, 2261, 427, 2794, 879, 2796, 2797, + /* 3390 */ 874, 2261, 2261, 862, 898, 2261, 2758, 2261, 875, 2261, + /* 3400 */ 2261, 2793, 2261, 2811, 2261, 2261, 2261, 2261, 2261, 2261, + /* 3410 */ 2261, 2261, 2261, 2261, 2261, 2261, 876, 2261, 2261, 2758, + /* 3420 */ 2261, 875, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, + /* 3430 */ 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, + /* 3440 */ 2261, 2261, 2261, 2792, 2261, 2811, 2839, 2793, 2261, 2261, + /* 3450 */ 411, 2794, 879, 2796, 2797, 874, 2261, 2261, 862, 898, + /* 3460 */ 2261, 2758, 876, 875, 2261, 2261, 2792, 2261, 2261, 2839, + /* 3470 */ 2261, 2261, 2261, 428, 2794, 879, 2796, 2797, 874, 2261, + /* 3480 */ 2261, 862, 898, 2261, 2261, 2261, 2261, 2261, 2261, 2261, + /* 3490 */ 2261, 2811, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, + /* 3500 */ 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2758, 2792, 875, + /* 3510 */ 2261, 2839, 2793, 2261, 2261, 412, 2794, 879, 2796, 2797, + /* 3520 */ 874, 2261, 2261, 862, 898, 2261, 2261, 876, 2261, 2793, + /* 3530 */ 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, + /* 3540 */ 2261, 2261, 2261, 2261, 876, 2261, 2261, 2261, 2261, 2261, + /* 3550 */ 2261, 2261, 2261, 2261, 2792, 2261, 2811, 2839, 2261, 2261, + /* 3560 */ 2261, 406, 2794, 879, 2796, 2797, 874, 2261, 2261, 862, + /* 3570 */ 898, 2261, 2758, 2811, 875, 2261, 2261, 2261, 2261, 2261, + /* 3580 */ 2793, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2758, + /* 3590 */ 2261, 875, 2261, 2261, 2261, 876, 2261, 2261, 2261, 2261, + /* 3600 */ 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, + /* 3610 */ 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2792, + /* 3620 */ 2261, 2261, 2839, 2261, 2811, 2261, 414, 2794, 879, 2796, + /* 3630 */ 2797, 874, 2261, 2261, 862, 898, 2792, 2261, 2261, 2839, + /* 3640 */ 2758, 2261, 875, 417, 2794, 879, 2796, 2797, 874, 2261, + /* 3650 */ 2261, 862, 898, 2261, 2261, 2261, 2261, 2261, 2261, 2261, + /* 3660 */ 2261, 2793, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, + /* 3670 */ 2261, 2261, 2261, 2261, 2261, 2261, 876, 2261, 2261, 2261, + /* 3680 */ 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2792, 2261, 2793, + /* 3690 */ 2839, 2261, 2261, 2261, 418, 2794, 879, 2796, 2797, 874, + /* 3700 */ 2261, 2261, 862, 898, 876, 2811, 2261, 2261, 2261, 2261, + /* 3710 */ 2793, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, + /* 3720 */ 2261, 2758, 2261, 875, 2261, 876, 2261, 2261, 2261, 2261, + /* 3730 */ 2261, 2261, 2261, 2811, 2261, 2261, 2261, 2261, 2261, 2261, + /* 3740 */ 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2758, + /* 3750 */ 2261, 875, 2261, 2261, 2811, 2261, 2261, 2261, 2261, 2261, + /* 3760 */ 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2792, 2261, + /* 3770 */ 2758, 2839, 875, 2261, 2261, 419, 2794, 879, 2796, 2797, + /* 3780 */ 874, 2261, 2261, 862, 898, 2261, 2793, 2261, 2261, 2261, + /* 3790 */ 2261, 2261, 2261, 2261, 2261, 2261, 2792, 2261, 2261, 2839, + /* 3800 */ 2261, 876, 2261, 435, 2794, 879, 2796, 2797, 874, 2261, + /* 3810 */ 2261, 862, 898, 2261, 2261, 2261, 2261, 2792, 2261, 2261, + /* 3820 */ 2839, 2261, 2261, 2261, 436, 2794, 879, 2796, 2797, 874, + /* 3830 */ 2811, 2261, 862, 898, 2261, 2793, 2261, 2261, 2261, 2261, + /* 3840 */ 2261, 2261, 2261, 2261, 2261, 2261, 2758, 2261, 875, 2261, + /* 3850 */ 876, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, + /* 3860 */ 2261, 2261, 2261, 2793, 2261, 2261, 2261, 2261, 2261, 2261, + /* 3870 */ 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 876, 2811, + /* 3880 */ 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, + /* 3890 */ 2261, 2261, 2261, 2792, 2261, 2758, 2839, 875, 2261, 2793, + /* 3900 */ 2805, 2794, 879, 2796, 2797, 874, 2261, 2811, 862, 898, + /* 3910 */ 2261, 2261, 2261, 2261, 876, 2261, 2261, 2261, 2261, 2261, + /* 3920 */ 2261, 2261, 2261, 2758, 2261, 875, 2261, 2261, 2261, 2261, + /* 3930 */ 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, + /* 3940 */ 2261, 2261, 2792, 2811, 2261, 2839, 2261, 2261, 2261, 2804, + /* 3950 */ 2794, 879, 2796, 2797, 874, 2261, 2261, 862, 898, 2758, + /* 3960 */ 2261, 875, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, + /* 3970 */ 2792, 2261, 2261, 2839, 2261, 2261, 2261, 2803, 2794, 879, + /* 3980 */ 2796, 2797, 874, 2261, 2261, 862, 898, 2261, 2261, 2261, + /* 3990 */ 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, + /* 4000 */ 2261, 2261, 2261, 2261, 2261, 2261, 2792, 2261, 2261, 2839, + /* 4010 */ 2261, 2261, 2793, 455, 2794, 879, 2796, 2797, 874, 2261, + /* 4020 */ 2261, 862, 898, 2261, 2261, 2261, 2793, 876, 2261, 2261, + /* 4030 */ 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, + /* 4040 */ 2261, 876, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, + /* 4050 */ 2261, 2793, 2261, 2261, 2261, 2261, 2811, 2261, 2261, 2261, + /* 4060 */ 2261, 2261, 2261, 2261, 2261, 2261, 876, 2261, 2261, 2261, + /* 4070 */ 2811, 2261, 2758, 2261, 875, 2261, 2261, 2793, 2261, 2261, + /* 4080 */ 2261, 2261, 2261, 2261, 2261, 2261, 2758, 2261, 875, 2261, + /* 4090 */ 2261, 2261, 876, 2261, 2793, 2811, 2261, 2261, 2261, 2261, + /* 4100 */ 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 876, + /* 4110 */ 2261, 2758, 2261, 875, 2261, 2261, 2261, 2261, 2261, 2792, + /* 4120 */ 2261, 2811, 2839, 2261, 2261, 2261, 456, 2794, 879, 2796, + /* 4130 */ 2797, 874, 2261, 2792, 862, 898, 2839, 2758, 2811, 875, + /* 4140 */ 452, 2794, 879, 2796, 2797, 874, 2261, 2261, 862, 898, + /* 4150 */ 2261, 2261, 2261, 2261, 2758, 2261, 875, 2261, 2792, 2261, + /* 4160 */ 2261, 2839, 2261, 2261, 2261, 457, 2794, 879, 2796, 2797, + /* 4170 */ 874, 2261, 2261, 862, 898, 2261, 2261, 2261, 2261, 2261, + /* 4180 */ 2261, 2261, 2261, 2261, 877, 2261, 2261, 2839, 2261, 2261, + /* 4190 */ 2261, 425, 2794, 879, 2796, 2797, 874, 2261, 2261, 862, + /* 4200 */ 898, 2792, 2261, 2261, 2839, 2261, 2261, 2261, 424, 2794, + /* 4210 */ 879, 2796, 2797, 874, 2261, 2261, 862, 898, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 412, 426, 390, 467, 443, 393, 394, 443, 472, 510, - /* 10 */ 511, 395, 12, 13, 14, 426, 381, 14, 521, 424, - /* 20 */ 20, 457, 22, 20, 463, 464, 529, 463, 464, 441, - /* 30 */ 412, 396, 425, 395, 396, 440, 36, 396, 38, 428, - /* 40 */ 20, 434, 435, 428, 547, 548, 431, 8, 9, 552, - /* 50 */ 553, 12, 13, 14, 15, 16, 381, 521, 395, 441, - /* 60 */ 425, 445, 446, 14, 448, 529, 425, 451, 68, 20, - /* 70 */ 20, 396, 20, 12, 13, 75, 441, 73, 443, 491, - /* 80 */ 492, 493, 82, 547, 548, 395, 396, 443, 552, 553, - /* 90 */ 502, 0, 485, 486, 20, 12, 13, 36, 395, 396, - /* 100 */ 425, 457, 491, 20, 428, 22, 491, 463, 464, 491, - /* 110 */ 492, 74, 112, 502, 75, 115, 441, 502, 443, 36, - /* 120 */ 502, 38, 20, 488, 395, 396, 491, 14, 15, 16, - /* 130 */ 495, 496, 497, 498, 499, 500, 20, 502, 497, 378, - /* 140 */ 477, 478, 507, 390, 509, 54, 393, 394, 513, 514, - /* 150 */ 381, 68, 152, 153, 516, 517, 518, 519, 75, 521, - /* 160 */ 522, 1, 2, 488, 125, 82, 491, 491, 533, 117, - /* 170 */ 495, 496, 497, 498, 499, 500, 541, 502, 502, 381, - /* 180 */ 505, 36, 507, 508, 509, 395, 396, 411, 513, 514, - /* 190 */ 414, 191, 192, 391, 396, 112, 398, 395, 115, 397, - /* 200 */ 391, 201, 202, 426, 395, 415, 397, 517, 518, 519, - /* 210 */ 441, 521, 522, 423, 437, 211, 216, 115, 218, 529, - /* 220 */ 517, 518, 519, 425, 521, 522, 152, 153, 467, 190, - /* 230 */ 425, 115, 20, 472, 20, 152, 153, 547, 548, 441, - /* 240 */ 191, 443, 552, 553, 240, 241, 517, 518, 519, 444, - /* 250 */ 521, 522, 252, 253, 254, 33, 256, 257, 258, 259, - /* 260 */ 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, - /* 270 */ 270, 271, 272, 273, 191, 192, 116, 155, 420, 218, - /* 280 */ 44, 20, 521, 425, 201, 202, 488, 146, 147, 491, - /* 290 */ 529, 36, 151, 495, 496, 497, 498, 499, 500, 216, - /* 300 */ 502, 218, 0, 254, 254, 507, 20, 509, 547, 548, - /* 310 */ 452, 513, 514, 552, 553, 426, 277, 278, 279, 280, - /* 320 */ 281, 282, 283, 284, 285, 286, 287, 115, 145, 146, - /* 330 */ 147, 148, 149, 150, 151, 252, 253, 254, 116, 256, - /* 340 */ 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, - /* 350 */ 267, 268, 269, 270, 271, 272, 273, 274, 12, 13, - /* 360 */ 426, 427, 381, 218, 425, 18, 20, 147, 22, 417, - /* 370 */ 23, 151, 433, 421, 395, 396, 487, 396, 381, 77, - /* 380 */ 78, 79, 36, 444, 38, 395, 84, 85, 86, 42, - /* 390 */ 43, 155, 90, 46, 415, 250, 251, 95, 96, 97, - /* 400 */ 98, 299, 423, 101, 57, 0, 425, 105, 106, 107, - /* 410 */ 108, 289, 290, 291, 68, 299, 69, 70, 71, 72, - /* 420 */ 73, 75, 441, 523, 443, 525, 21, 20, 82, 24, - /* 430 */ 25, 26, 27, 28, 29, 30, 31, 32, 441, 521, - /* 440 */ 425, 12, 13, 14, 454, 225, 456, 529, 433, 20, - /* 450 */ 230, 22, 20, 233, 193, 235, 425, 20, 112, 444, - /* 460 */ 521, 115, 115, 4, 433, 36, 548, 38, 529, 488, - /* 470 */ 552, 553, 491, 218, 13, 444, 495, 496, 497, 498, - /* 480 */ 499, 500, 23, 502, 395, 396, 547, 548, 507, 425, - /* 490 */ 509, 552, 553, 20, 513, 514, 0, 68, 152, 153, - /* 500 */ 380, 154, 382, 155, 415, 250, 251, 48, 49, 50, - /* 510 */ 21, 82, 425, 24, 25, 26, 27, 28, 29, 30, - /* 520 */ 31, 32, 541, 115, 288, 289, 290, 291, 292, 293, - /* 530 */ 294, 295, 296, 21, 521, 420, 425, 191, 192, 452, - /* 540 */ 425, 112, 529, 82, 115, 434, 435, 201, 202, 37, - /* 550 */ 486, 39, 40, 41, 42, 208, 209, 210, 0, 196, - /* 560 */ 213, 548, 216, 20, 218, 552, 553, 452, 395, 396, - /* 570 */ 74, 8, 9, 226, 227, 12, 13, 14, 15, 16, - /* 580 */ 22, 152, 153, 20, 152, 153, 239, 439, 415, 242, - /* 590 */ 442, 443, 245, 246, 247, 248, 249, 145, 252, 253, - /* 600 */ 254, 149, 256, 257, 258, 259, 260, 261, 262, 263, - /* 610 */ 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, - /* 620 */ 191, 192, 292, 293, 294, 295, 296, 4, 191, 192, - /* 630 */ 201, 202, 404, 201, 202, 112, 288, 289, 290, 291, - /* 640 */ 292, 293, 294, 295, 296, 216, 299, 218, 0, 115, - /* 650 */ 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, - /* 660 */ 432, 138, 139, 140, 141, 142, 143, 144, 305, 306, - /* 670 */ 307, 308, 24, 25, 26, 27, 28, 29, 30, 31, - /* 680 */ 32, 252, 253, 254, 68, 256, 257, 258, 259, 260, - /* 690 */ 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, - /* 700 */ 271, 272, 273, 12, 13, 22, 381, 299, 395, 396, - /* 710 */ 74, 20, 20, 22, 12, 13, 14, 15, 16, 36, - /* 720 */ 20, 396, 22, 398, 77, 78, 79, 36, 415, 38, - /* 730 */ 114, 84, 85, 86, 191, 119, 36, 90, 115, 126, - /* 740 */ 395, 396, 95, 96, 97, 98, 3, 381, 101, 215, - /* 750 */ 425, 217, 105, 106, 107, 108, 193, 274, 58, 68, - /* 760 */ 415, 14, 396, 20, 398, 416, 441, 20, 443, 0, - /* 770 */ 228, 8, 9, 82, 425, 12, 13, 14, 15, 16, - /* 780 */ 54, 416, 395, 249, 91, 436, 12, 13, 395, 63, - /* 790 */ 425, 425, 66, 67, 20, 112, 22, 254, 395, 396, - /* 800 */ 425, 436, 186, 112, 395, 396, 115, 441, 433, 443, - /* 810 */ 36, 0, 38, 488, 442, 443, 491, 254, 415, 444, - /* 820 */ 495, 496, 497, 498, 499, 500, 36, 502, 395, 396, - /* 830 */ 395, 396, 507, 299, 509, 395, 396, 425, 513, 514, - /* 840 */ 395, 396, 68, 152, 153, 75, 459, 460, 415, 395, - /* 850 */ 396, 252, 159, 33, 488, 415, 82, 491, 449, 116, - /* 860 */ 415, 495, 496, 497, 498, 499, 500, 47, 502, 415, - /* 870 */ 477, 478, 82, 507, 82, 509, 404, 184, 185, 513, - /* 880 */ 514, 115, 191, 192, 449, 193, 112, 395, 396, 115, - /* 890 */ 126, 198, 201, 202, 422, 8, 9, 485, 486, 12, - /* 900 */ 13, 14, 15, 16, 432, 38, 274, 216, 276, 218, - /* 910 */ 311, 312, 313, 314, 315, 316, 317, 375, 376, 377, - /* 920 */ 33, 54, 299, 22, 155, 0, 152, 153, 190, 381, - /* 930 */ 63, 64, 65, 66, 0, 68, 193, 36, 191, 170, - /* 940 */ 506, 449, 508, 252, 253, 254, 254, 256, 257, 258, - /* 950 */ 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, - /* 960 */ 269, 270, 271, 272, 273, 191, 192, 402, 18, 44, - /* 970 */ 20, 208, 425, 395, 396, 201, 202, 27, 395, 396, - /* 980 */ 30, 114, 171, 82, 419, 4, 119, 176, 38, 441, - /* 990 */ 216, 444, 218, 415, 429, 184, 395, 396, 415, 52, - /* 1000 */ 405, 254, 146, 116, 54, 506, 56, 508, 413, 395, - /* 1010 */ 396, 61, 62, 8, 9, 277, 415, 12, 13, 14, - /* 1020 */ 15, 16, 252, 73, 494, 287, 252, 253, 254, 415, - /* 1030 */ 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, - /* 1040 */ 266, 267, 268, 269, 270, 271, 272, 273, 395, 396, - /* 1050 */ 520, 8, 9, 186, 44, 12, 13, 14, 15, 16, - /* 1060 */ 22, 20, 195, 14, 114, 299, 199, 200, 415, 20, - /* 1070 */ 395, 396, 205, 206, 36, 402, 126, 0, 68, 145, - /* 1080 */ 146, 147, 148, 149, 150, 151, 381, 231, 232, 326, - /* 1090 */ 415, 224, 8, 9, 59, 60, 12, 13, 14, 15, - /* 1100 */ 16, 396, 429, 398, 400, 401, 3, 157, 158, 23, - /* 1110 */ 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, - /* 1120 */ 82, 116, 172, 173, 174, 175, 176, 177, 178, 179, - /* 1130 */ 425, 181, 182, 183, 381, 49, 50, 187, 188, 189, - /* 1140 */ 193, 400, 401, 425, 194, 126, 441, 33, 443, 505, - /* 1150 */ 112, 204, 508, 435, 77, 78, 79, 80, 81, 116, - /* 1160 */ 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - /* 1170 */ 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - /* 1180 */ 103, 104, 105, 106, 107, 108, 20, 12, 13, 395, - /* 1190 */ 396, 381, 20, 488, 441, 381, 491, 22, 381, 180, - /* 1200 */ 495, 496, 497, 498, 499, 500, 396, 502, 398, 415, - /* 1210 */ 4, 36, 507, 38, 509, 381, 2, 381, 513, 514, - /* 1220 */ 381, 381, 8, 9, 381, 19, 12, 13, 14, 15, - /* 1230 */ 16, 22, 395, 396, 193, 425, 396, 186, 398, 395, - /* 1240 */ 396, 0, 381, 68, 38, 36, 395, 396, 20, 0, - /* 1250 */ 22, 441, 415, 443, 216, 441, 218, 82, 441, 415, - /* 1260 */ 54, 34, 381, 41, 42, 425, 415, 61, 62, 395, - /* 1270 */ 396, 220, 395, 396, 68, 441, 68, 441, 409, 410, - /* 1280 */ 441, 441, 301, 443, 441, 381, 58, 112, 425, 415, - /* 1290 */ 252, 253, 415, 409, 410, 254, 425, 381, 488, 436, - /* 1300 */ 494, 491, 441, 384, 385, 495, 496, 497, 498, 499, - /* 1310 */ 500, 33, 502, 381, 421, 444, 33, 507, 381, 509, - /* 1320 */ 114, 112, 441, 513, 514, 119, 520, 119, 488, 381, - /* 1330 */ 381, 491, 467, 13, 33, 495, 496, 497, 498, 499, - /* 1340 */ 500, 381, 502, 121, 122, 441, 124, 507, 47, 509, - /* 1350 */ 12, 13, 2, 513, 514, 381, 396, 441, 8, 9, - /* 1360 */ 22, 426, 12, 13, 14, 15, 16, 145, 152, 153, - /* 1370 */ 494, 149, 381, 441, 36, 482, 38, 438, 441, 438, - /* 1380 */ 441, 438, 441, 36, 441, 425, 521, 396, 0, 441, - /* 1390 */ 441, 216, 120, 218, 529, 123, 520, 0, 234, 116, - /* 1400 */ 236, 441, 82, 443, 155, 36, 68, 120, 381, 33, - /* 1410 */ 123, 120, 547, 548, 123, 441, 425, 552, 553, 22, - /* 1420 */ 254, 33, 467, 396, 321, 426, 254, 252, 253, 82, - /* 1430 */ 120, 13, 441, 123, 443, 426, 33, 33, 13, 325, - /* 1440 */ 0, 266, 267, 268, 269, 270, 271, 272, 488, 0, - /* 1450 */ 0, 491, 425, 51, 36, 495, 496, 497, 498, 499, - /* 1460 */ 500, 36, 502, 33, 33, 33, 426, 507, 441, 509, - /* 1470 */ 443, 22, 22, 513, 514, 0, 521, 1, 2, 488, - /* 1480 */ 473, 115, 491, 117, 529, 244, 495, 496, 497, 498, - /* 1490 */ 499, 500, 116, 502, 36, 55, 33, 33, 507, 33, - /* 1500 */ 509, 33, 547, 548, 513, 514, 413, 552, 553, 36, - /* 1510 */ 33, 33, 33, 12, 13, 488, 382, 115, 491, 116, - /* 1520 */ 116, 13, 495, 496, 497, 498, 499, 500, 453, 502, - /* 1530 */ 33, 33, 12, 13, 507, 523, 509, 381, 12, 13, - /* 1540 */ 513, 514, 12, 13, 36, 112, 116, 116, 116, 556, - /* 1550 */ 12, 13, 396, 545, 216, 82, 218, 524, 12, 13, - /* 1560 */ 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, - /* 1570 */ 538, 138, 139, 140, 141, 142, 143, 144, 1, 116, - /* 1580 */ 116, 425, 116, 36, 116, 12, 13, 218, 250, 251, - /* 1590 */ 252, 12, 13, 116, 116, 116, 19, 441, 33, 443, - /* 1600 */ 33, 323, 12, 13, 266, 267, 268, 269, 270, 271, - /* 1610 */ 272, 13, 467, 116, 116, 38, 12, 13, 381, 33, - /* 1620 */ 145, 146, 147, 148, 149, 150, 151, 12, 13, 82, - /* 1630 */ 53, 54, 467, 396, 36, 399, 33, 425, 412, 394, - /* 1640 */ 63, 64, 65, 66, 488, 68, 33, 491, 453, 544, - /* 1650 */ 412, 495, 496, 497, 498, 499, 500, 33, 502, 544, - /* 1660 */ 544, 544, 425, 466, 453, 509, 521, 399, 467, 513, - /* 1670 */ 514, 489, 396, 440, 529, 528, 218, 474, 441, 528, - /* 1680 */ 443, 116, 453, 116, 453, 549, 521, 453, 515, 531, - /* 1690 */ 54, 114, 547, 548, 529, 414, 119, 552, 553, 381, - /* 1700 */ 8, 9, 116, 302, 12, 13, 14, 15, 16, 490, - /* 1710 */ 468, 20, 547, 548, 396, 20, 395, 552, 553, 116, - /* 1720 */ 233, 404, 521, 381, 484, 488, 479, 150, 491, 116, - /* 1730 */ 529, 479, 495, 496, 497, 498, 499, 500, 396, 502, - /* 1740 */ 116, 404, 381, 425, 470, 214, 509, 395, 547, 548, - /* 1750 */ 513, 514, 20, 552, 553, 396, 47, 396, 450, 441, - /* 1760 */ 396, 443, 450, 447, 190, 395, 395, 425, 396, 450, - /* 1770 */ 447, 447, 195, 447, 197, 113, 408, 200, 111, 395, - /* 1780 */ 407, 395, 205, 441, 110, 443, 425, 406, 395, 395, - /* 1790 */ 395, 20, 52, 388, 479, 388, 404, 20, 392, 443, - /* 1800 */ 392, 224, 441, 404, 443, 20, 488, 397, 20, 491, - /* 1810 */ 381, 397, 469, 495, 496, 497, 498, 499, 500, 404, - /* 1820 */ 502, 404, 20, 404, 404, 396, 20, 509, 404, 454, - /* 1830 */ 488, 513, 514, 491, 460, 388, 395, 495, 496, 497, - /* 1840 */ 498, 499, 500, 501, 502, 503, 504, 404, 404, 488, - /* 1850 */ 381, 425, 491, 425, 425, 395, 495, 496, 497, 498, - /* 1860 */ 499, 500, 425, 502, 425, 396, 384, 425, 384, 388, - /* 1870 */ 441, 425, 443, 425, 237, 381, 425, 425, 425, 425, - /* 1880 */ 115, 483, 402, 20, 221, 193, 441, 222, 479, 468, - /* 1890 */ 396, 478, 481, 402, 425, 395, 441, 441, 476, 310, - /* 1900 */ 443, 309, 475, 542, 543, 318, 441, 540, 207, 303, - /* 1910 */ 441, 320, 443, 319, 537, 537, 537, 488, 381, 425, - /* 1920 */ 491, 539, 461, 461, 495, 496, 497, 498, 499, 500, - /* 1930 */ 298, 502, 536, 396, 534, 441, 297, 443, 468, 327, - /* 1940 */ 557, 324, 551, 527, 381, 322, 396, 535, 126, 526, - /* 1950 */ 20, 300, 397, 402, 402, 441, 461, 488, 441, 396, - /* 1960 */ 491, 494, 425, 441, 495, 496, 497, 498, 499, 500, - /* 1970 */ 532, 502, 461, 441, 441, 199, 458, 402, 441, 454, - /* 1980 */ 443, 441, 488, 554, 555, 491, 381, 402, 425, 495, - /* 1990 */ 496, 497, 498, 499, 500, 115, 502, 512, 441, 199, - /* 2000 */ 455, 396, 465, 509, 441, 421, 443, 454, 514, 550, - /* 2010 */ 402, 402, 543, 530, 396, 115, 395, 441, 22, 441, - /* 2020 */ 35, 441, 441, 381, 441, 488, 430, 383, 491, 441, - /* 2030 */ 425, 402, 495, 496, 497, 498, 499, 500, 396, 502, - /* 2040 */ 441, 441, 441, 441, 386, 37, 441, 387, 443, 40, - /* 2050 */ 389, 488, 441, 471, 491, 441, 388, 441, 495, 496, - /* 2060 */ 497, 498, 499, 500, 379, 502, 441, 425, 441, 441, - /* 2070 */ 465, 441, 441, 427, 441, 441, 441, 480, 403, 441, - /* 2080 */ 487, 441, 462, 441, 462, 443, 427, 418, 418, 418, - /* 2090 */ 0, 0, 0, 488, 47, 0, 491, 36, 243, 36, - /* 2100 */ 495, 496, 497, 498, 499, 500, 36, 502, 36, 546, - /* 2110 */ 381, 243, 0, 36, 36, 243, 36, 0, 0, 243, - /* 2120 */ 0, 36, 0, 36, 0, 396, 22, 0, 238, 36, - /* 2130 */ 488, 0, 381, 491, 224, 0, 224, 495, 496, 497, - /* 2140 */ 498, 499, 500, 225, 502, 218, 0, 396, 216, 0, - /* 2150 */ 0, 212, 211, 0, 425, 0, 158, 51, 51, 381, - /* 2160 */ 0, 36, 0, 0, 36, 54, 0, 51, 0, 0, - /* 2170 */ 441, 0, 443, 47, 396, 0, 425, 0, 0, 0, - /* 2180 */ 51, 0, 0, 0, 36, 0, 176, 176, 0, 0, - /* 2190 */ 0, 0, 441, 0, 443, 0, 381, 555, 0, 0, - /* 2200 */ 0, 0, 0, 425, 0, 0, 0, 0, 0, 0, - /* 2210 */ 0, 396, 0, 0, 0, 51, 465, 488, 0, 441, - /* 2220 */ 491, 443, 0, 381, 495, 496, 497, 498, 499, 500, - /* 2230 */ 0, 502, 0, 504, 47, 0, 0, 0, 396, 488, - /* 2240 */ 425, 0, 491, 465, 0, 381, 495, 496, 497, 498, - /* 2250 */ 499, 500, 0, 502, 158, 22, 441, 0, 443, 157, - /* 2260 */ 396, 0, 0, 0, 156, 22, 488, 425, 52, 491, - /* 2270 */ 22, 52, 381, 495, 496, 497, 498, 499, 500, 0, - /* 2280 */ 502, 0, 0, 441, 0, 443, 36, 396, 68, 425, - /* 2290 */ 0, 68, 68, 68, 0, 36, 54, 44, 0, 54, - /* 2300 */ 36, 0, 44, 488, 36, 441, 491, 443, 54, 381, - /* 2310 */ 495, 496, 497, 498, 499, 500, 425, 502, 44, 0, - /* 2320 */ 0, 36, 47, 51, 396, 33, 14, 44, 51, 51, - /* 2330 */ 488, 0, 441, 491, 443, 0, 45, 495, 496, 497, - /* 2340 */ 498, 499, 500, 44, 502, 0, 0, 0, 44, 207, - /* 2350 */ 381, 51, 488, 425, 0, 491, 0, 51, 0, 495, - /* 2360 */ 496, 497, 498, 499, 500, 396, 502, 0, 0, 441, - /* 2370 */ 0, 443, 76, 36, 44, 54, 0, 36, 54, 488, - /* 2380 */ 44, 0, 491, 54, 36, 381, 495, 496, 497, 498, - /* 2390 */ 499, 500, 0, 502, 425, 36, 44, 54, 0, 44, - /* 2400 */ 396, 0, 0, 0, 0, 0, 22, 36, 0, 22, - /* 2410 */ 441, 36, 443, 125, 36, 36, 488, 381, 123, 491, - /* 2420 */ 0, 36, 36, 495, 496, 497, 498, 499, 500, 425, - /* 2430 */ 502, 36, 396, 36, 0, 36, 381, 22, 22, 22, - /* 2440 */ 33, 0, 36, 33, 22, 441, 56, 443, 36, 36, - /* 2450 */ 36, 396, 0, 22, 0, 36, 0, 488, 0, 36, - /* 2460 */ 491, 425, 0, 36, 495, 496, 497, 498, 499, 500, - /* 2470 */ 0, 502, 36, 0, 36, 22, 36, 441, 36, 443, - /* 2480 */ 425, 20, 381, 0, 229, 116, 193, 115, 228, 115, - /* 2490 */ 223, 0, 488, 36, 51, 491, 441, 396, 443, 495, - /* 2500 */ 496, 497, 498, 499, 500, 0, 502, 193, 22, 22, - /* 2510 */ 193, 0, 199, 0, 381, 193, 219, 3, 203, 193, - /* 2520 */ 36, 203, 33, 52, 488, 116, 425, 491, 36, 396, - /* 2530 */ 304, 495, 496, 497, 498, 499, 500, 116, 502, 115, - /* 2540 */ 115, 115, 441, 488, 443, 113, 491, 52, 51, 116, - /* 2550 */ 495, 496, 497, 498, 499, 500, 111, 502, 425, 33, - /* 2560 */ 33, 33, 116, 115, 115, 115, 33, 116, 51, 304, - /* 2570 */ 115, 33, 82, 36, 441, 116, 443, 3, 381, 115, - /* 2580 */ 33, 116, 116, 116, 304, 36, 36, 36, 36, 488, - /* 2590 */ 36, 36, 491, 396, 116, 51, 495, 496, 497, 498, - /* 2600 */ 499, 500, 381, 502, 288, 33, 0, 51, 0, 115, - /* 2610 */ 44, 0, 116, 44, 116, 115, 115, 396, 115, 0, - /* 2620 */ 116, 488, 425, 115, 491, 196, 196, 381, 495, 496, - /* 2630 */ 497, 498, 499, 500, 44, 502, 33, 113, 441, 200, - /* 2640 */ 443, 275, 396, 113, 2, 22, 425, 116, 252, 51, - /* 2650 */ 116, 115, 51, 22, 115, 195, 115, 115, 115, 0, - /* 2660 */ 44, 116, 441, 115, 443, 196, 255, 381, 115, 0, - /* 2670 */ 22, 425, 51, 116, 115, 115, 118, 116, 115, 115, - /* 2680 */ 115, 36, 396, 115, 117, 488, 115, 441, 491, 443, - /* 2690 */ 115, 381, 495, 496, 497, 498, 499, 500, 116, 502, - /* 2700 */ 115, 22, 126, 22, 229, 22, 396, 116, 36, 488, - /* 2710 */ 115, 425, 491, 116, 36, 115, 495, 496, 497, 498, - /* 2720 */ 499, 500, 36, 502, 36, 116, 116, 441, 116, 443, - /* 2730 */ 36, 116, 381, 36, 488, 425, 137, 491, 33, 137, - /* 2740 */ 115, 495, 496, 497, 498, 499, 500, 396, 502, 115, - /* 2750 */ 137, 441, 36, 443, 137, 115, 22, 22, 76, 75, - /* 2760 */ 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, - /* 2770 */ 109, 82, 381, 36, 488, 82, 425, 491, 33, 109, - /* 2780 */ 36, 495, 496, 497, 498, 499, 500, 396, 502, 36, - /* 2790 */ 36, 22, 441, 36, 443, 36, 36, 82, 488, 381, - /* 2800 */ 36, 491, 36, 36, 36, 495, 496, 497, 498, 499, - /* 2810 */ 500, 36, 502, 22, 396, 36, 425, 0, 381, 36, - /* 2820 */ 44, 0, 36, 0, 54, 54, 44, 54, 36, 44, - /* 2830 */ 0, 36, 441, 396, 443, 54, 0, 44, 36, 488, - /* 2840 */ 0, 22, 491, 425, 36, 0, 495, 496, 497, 498, - /* 2850 */ 499, 500, 36, 502, 22, 33, 36, 22, 21, 441, - /* 2860 */ 22, 443, 425, 22, 21, 558, 20, 558, 558, 558, - /* 2870 */ 558, 558, 558, 558, 558, 558, 558, 558, 441, 488, - /* 2880 */ 443, 558, 491, 381, 558, 558, 495, 496, 497, 498, - /* 2890 */ 499, 500, 558, 502, 558, 558, 381, 558, 396, 558, - /* 2900 */ 558, 558, 558, 558, 558, 558, 488, 558, 558, 491, - /* 2910 */ 558, 396, 558, 495, 496, 497, 498, 499, 500, 558, - /* 2920 */ 502, 558, 558, 558, 558, 488, 558, 425, 491, 558, - /* 2930 */ 558, 558, 495, 496, 497, 498, 499, 500, 558, 502, - /* 2940 */ 425, 558, 558, 441, 558, 443, 558, 558, 558, 558, - /* 2950 */ 558, 558, 558, 558, 558, 558, 441, 558, 443, 558, - /* 2960 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 2970 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 2980 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 2990 */ 488, 558, 558, 491, 558, 558, 558, 495, 496, 497, - /* 3000 */ 498, 499, 500, 488, 502, 558, 491, 558, 558, 558, - /* 3010 */ 495, 496, 497, 498, 499, 500, 558, 502, 558, 558, - /* 3020 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 3030 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 3040 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 3050 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 3060 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 3070 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 3080 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 3090 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 3100 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 3110 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 3120 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 3130 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 3140 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 3150 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 3160 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 3170 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 3180 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 3190 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 3200 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 3210 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 3220 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 3230 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, - /* 3240 */ 558, 558, 558, 558, 558, 378, 378, 378, 378, 378, - /* 3250 */ 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, - /* 3260 */ 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, - /* 3270 */ 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, - /* 3280 */ 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, - /* 3290 */ 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, - /* 3300 */ 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, - /* 3310 */ 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, - /* 3320 */ 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, - /* 3330 */ 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, - /* 3340 */ 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, - /* 3350 */ 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, - /* 3360 */ 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, - /* 3370 */ 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, - /* 3380 */ 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, - /* 3390 */ 378, 378, 378, 378, 378, 378, + /* 0 */ 436, 475, 434, 439, 2, 403, 480, 451, 403, 0, + /* 10 */ 8, 9, 12, 13, 12, 13, 14, 15, 16, 2, + /* 20 */ 20, 465, 22, 475, 451, 8, 9, 471, 472, 12, + /* 30 */ 13, 14, 15, 16, 20, 428, 36, 389, 38, 0, + /* 40 */ 433, 389, 8, 9, 471, 472, 12, 13, 14, 15, + /* 50 */ 16, 434, 451, 403, 404, 20, 404, 531, 453, 454, + /* 60 */ 20, 456, 445, 499, 459, 539, 465, 460, 68, 467, + /* 70 */ 468, 71, 471, 472, 398, 21, 512, 401, 402, 531, + /* 80 */ 403, 404, 82, 557, 558, 433, 14, 539, 562, 563, + /* 90 */ 433, 37, 20, 39, 40, 41, 42, 449, 441, 413, + /* 100 */ 423, 449, 533, 451, 535, 557, 558, 421, 431, 452, + /* 110 */ 562, 563, 112, 403, 404, 115, 77, 78, 79, 80, + /* 120 */ 81, 0, 83, 84, 85, 86, 87, 88, 89, 90, + /* 130 */ 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, + /* 140 */ 101, 102, 103, 104, 105, 106, 107, 108, 496, 20, + /* 150 */ 116, 499, 152, 153, 33, 503, 504, 505, 506, 507, + /* 160 */ 508, 146, 0, 511, 512, 4, 403, 404, 14, 517, + /* 170 */ 410, 519, 403, 404, 20, 523, 524, 527, 528, 529, + /* 180 */ 171, 531, 532, 389, 23, 176, 423, 427, 531, 539, + /* 190 */ 433, 191, 192, 184, 431, 543, 539, 437, 404, 442, + /* 200 */ 443, 201, 202, 551, 0, 191, 192, 557, 558, 48, + /* 210 */ 49, 50, 562, 563, 557, 558, 216, 55, 218, 562, + /* 220 */ 563, 502, 44, 223, 432, 21, 457, 433, 24, 25, + /* 230 */ 26, 27, 28, 29, 30, 31, 32, 527, 528, 529, + /* 240 */ 448, 531, 532, 449, 115, 451, 231, 232, 233, 530, + /* 250 */ 493, 494, 126, 253, 254, 255, 155, 257, 258, 259, + /* 260 */ 260, 261, 262, 263, 264, 265, 266, 267, 520, 521, + /* 270 */ 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, + /* 280 */ 280, 281, 282, 283, 12, 13, 14, 424, 389, 388, + /* 290 */ 496, 390, 20, 499, 22, 255, 433, 503, 504, 505, + /* 300 */ 506, 507, 508, 404, 20, 511, 512, 444, 36, 515, + /* 310 */ 38, 517, 518, 519, 0, 8, 9, 523, 524, 12, + /* 320 */ 13, 14, 15, 16, 398, 22, 389, 401, 402, 433, + /* 330 */ 8, 9, 433, 155, 12, 13, 14, 15, 16, 36, + /* 340 */ 68, 404, 0, 71, 502, 191, 228, 75, 449, 531, + /* 350 */ 451, 20, 436, 22, 82, 21, 460, 539, 24, 25, + /* 360 */ 26, 27, 28, 29, 30, 31, 32, 12, 13, 47, + /* 370 */ 433, 436, 530, 12, 13, 20, 558, 22, 91, 147, + /* 380 */ 562, 563, 75, 151, 112, 82, 449, 115, 451, 58, + /* 390 */ 73, 36, 20, 38, 434, 496, 54, 36, 499, 298, + /* 400 */ 299, 300, 503, 504, 505, 506, 507, 508, 509, 255, + /* 410 */ 511, 512, 513, 514, 0, 499, 145, 146, 147, 148, + /* 420 */ 149, 150, 151, 68, 152, 153, 71, 389, 512, 0, + /* 430 */ 75, 433, 125, 496, 499, 44, 499, 82, 155, 441, + /* 440 */ 503, 504, 505, 506, 507, 508, 159, 512, 511, 512, + /* 450 */ 452, 22, 14, 20, 517, 495, 519, 225, 20, 68, + /* 460 */ 523, 524, 230, 191, 192, 4, 234, 112, 236, 155, + /* 470 */ 115, 184, 185, 201, 202, 297, 298, 299, 300, 301, + /* 480 */ 302, 303, 304, 305, 170, 198, 531, 449, 216, 117, + /* 490 */ 218, 77, 78, 79, 539, 223, 20, 190, 84, 85, + /* 500 */ 86, 383, 384, 385, 90, 115, 20, 152, 153, 95, + /* 510 */ 96, 97, 98, 558, 20, 101, 115, 562, 563, 105, + /* 520 */ 106, 107, 108, 403, 404, 253, 254, 255, 211, 257, + /* 530 */ 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, + /* 540 */ 196, 20, 270, 271, 272, 273, 191, 192, 115, 277, + /* 550 */ 278, 279, 280, 281, 282, 283, 201, 202, 241, 242, + /* 560 */ 8, 9, 502, 420, 12, 13, 14, 15, 16, 403, + /* 570 */ 404, 216, 20, 218, 433, 268, 115, 457, 223, 218, + /* 580 */ 297, 298, 299, 300, 301, 302, 303, 304, 305, 423, + /* 590 */ 530, 115, 449, 452, 287, 288, 289, 290, 291, 292, + /* 600 */ 293, 294, 295, 296, 403, 404, 434, 435, 253, 254, + /* 610 */ 255, 20, 257, 258, 259, 260, 261, 262, 263, 264, + /* 620 */ 265, 266, 267, 74, 423, 270, 271, 272, 273, 191, + /* 630 */ 403, 186, 277, 278, 279, 280, 281, 282, 283, 284, + /* 640 */ 12, 13, 499, 500, 501, 403, 152, 153, 20, 447, + /* 650 */ 22, 389, 450, 451, 68, 512, 36, 112, 314, 315, + /* 660 */ 316, 317, 403, 404, 36, 220, 38, 301, 302, 303, + /* 670 */ 304, 305, 127, 128, 129, 130, 131, 132, 133, 134, + /* 680 */ 135, 136, 389, 138, 139, 140, 141, 142, 143, 144, + /* 690 */ 0, 13, 20, 255, 22, 20, 68, 404, 308, 71, + /* 700 */ 114, 20, 428, 75, 462, 119, 464, 433, 36, 308, + /* 710 */ 82, 449, 485, 486, 24, 25, 26, 27, 28, 29, + /* 720 */ 30, 31, 32, 12, 13, 14, 433, 433, 41, 42, + /* 730 */ 58, 20, 36, 22, 460, 112, 442, 443, 450, 451, + /* 740 */ 112, 308, 449, 115, 451, 193, 410, 36, 36, 38, + /* 750 */ 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, + /* 760 */ 82, 138, 139, 140, 141, 142, 143, 144, 74, 308, + /* 770 */ 8, 9, 186, 437, 12, 13, 14, 15, 16, 68, + /* 780 */ 152, 153, 71, 433, 308, 386, 527, 528, 529, 496, + /* 790 */ 531, 532, 499, 82, 82, 33, 503, 504, 505, 506, + /* 800 */ 507, 508, 452, 1, 511, 512, 20, 255, 121, 122, + /* 810 */ 517, 124, 519, 389, 403, 115, 523, 524, 68, 191, + /* 820 */ 192, 19, 54, 112, 59, 60, 115, 152, 153, 201, + /* 830 */ 202, 63, 145, 3, 66, 67, 149, 284, 218, 286, + /* 840 */ 38, 399, 403, 404, 216, 403, 218, 405, 1, 2, + /* 850 */ 20, 223, 20, 8, 9, 53, 54, 12, 13, 14, + /* 860 */ 15, 16, 423, 152, 153, 63, 64, 65, 66, 119, + /* 870 */ 68, 251, 252, 449, 475, 420, 201, 202, 116, 480, + /* 880 */ 4, 253, 254, 255, 20, 257, 258, 259, 260, 261, + /* 890 */ 262, 263, 264, 265, 266, 267, 485, 486, 270, 271, + /* 900 */ 272, 273, 191, 192, 449, 277, 278, 279, 280, 281, + /* 910 */ 282, 283, 201, 202, 218, 215, 114, 217, 8, 9, + /* 920 */ 20, 119, 12, 13, 14, 15, 16, 216, 75, 218, + /* 930 */ 531, 399, 0, 424, 223, 403, 255, 405, 539, 403, + /* 940 */ 404, 433, 433, 403, 404, 284, 116, 251, 252, 441, + /* 950 */ 250, 404, 150, 444, 499, 500, 557, 558, 34, 423, + /* 960 */ 452, 562, 563, 116, 253, 254, 255, 512, 257, 258, + /* 970 */ 259, 260, 261, 262, 263, 264, 265, 266, 267, 193, + /* 980 */ 433, 270, 271, 272, 273, 516, 4, 518, 277, 278, + /* 990 */ 279, 280, 281, 282, 283, 12, 13, 195, 389, 197, + /* 1000 */ 433, 19, 200, 20, 389, 22, 74, 205, 308, 419, + /* 1010 */ 8, 9, 422, 404, 12, 13, 14, 15, 16, 36, + /* 1020 */ 38, 38, 23, 193, 429, 193, 224, 8, 9, 433, + /* 1030 */ 47, 12, 13, 14, 15, 16, 54, 403, 404, 403, + /* 1040 */ 404, 255, 433, 61, 62, 403, 404, 389, 49, 50, + /* 1050 */ 68, 68, 505, 208, 71, 191, 20, 423, 449, 423, + /* 1060 */ 451, 494, 404, 22, 449, 82, 526, 527, 528, 529, + /* 1070 */ 14, 531, 532, 253, 403, 404, 20, 36, 12, 13, + /* 1080 */ 12, 13, 14, 15, 16, 490, 20, 255, 22, 493, + /* 1090 */ 494, 433, 433, 193, 423, 112, 114, 412, 115, 457, + /* 1100 */ 441, 119, 36, 193, 38, 496, 253, 449, 499, 451, + /* 1110 */ 22, 452, 503, 504, 505, 506, 507, 508, 116, 255, + /* 1120 */ 511, 512, 146, 147, 36, 440, 517, 151, 519, 403, + /* 1130 */ 404, 52, 523, 524, 68, 152, 153, 71, 403, 404, + /* 1140 */ 320, 321, 322, 323, 324, 325, 326, 3, 82, 423, + /* 1150 */ 14, 15, 16, 112, 496, 412, 515, 499, 423, 518, + /* 1160 */ 551, 503, 504, 505, 506, 507, 508, 408, 409, 511, + /* 1170 */ 512, 531, 433, 430, 191, 192, 403, 404, 112, 539, + /* 1180 */ 335, 115, 443, 440, 201, 202, 310, 8, 9, 408, + /* 1190 */ 409, 12, 13, 14, 15, 16, 423, 557, 558, 216, + /* 1200 */ 112, 218, 562, 563, 403, 404, 223, 190, 8, 9, + /* 1210 */ 552, 553, 12, 13, 14, 15, 16, 446, 152, 153, + /* 1220 */ 449, 417, 418, 516, 423, 518, 446, 8, 9, 449, + /* 1230 */ 389, 12, 13, 14, 15, 16, 253, 254, 255, 0, + /* 1240 */ 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, + /* 1250 */ 267, 389, 389, 270, 271, 272, 273, 191, 192, 433, + /* 1260 */ 277, 278, 279, 280, 281, 282, 283, 201, 202, 8, + /* 1270 */ 9, 269, 193, 12, 13, 14, 15, 16, 452, 77, + /* 1280 */ 78, 79, 216, 204, 218, 268, 84, 85, 86, 223, + /* 1290 */ 449, 255, 90, 403, 404, 116, 389, 95, 96, 97, + /* 1300 */ 98, 0, 389, 101, 287, 389, 433, 105, 106, 107, + /* 1310 */ 108, 449, 449, 423, 403, 404, 116, 444, 425, 253, + /* 1320 */ 254, 255, 429, 257, 258, 259, 260, 261, 262, 263, + /* 1330 */ 264, 265, 266, 267, 423, 116, 270, 271, 272, 273, + /* 1340 */ 33, 403, 404, 277, 278, 279, 280, 281, 282, 283, + /* 1350 */ 12, 13, 22, 389, 47, 18, 449, 20, 20, 33, + /* 1360 */ 22, 423, 449, 389, 27, 449, 36, 30, 417, 418, + /* 1370 */ 392, 393, 403, 404, 36, 38, 38, 116, 404, 0, + /* 1380 */ 403, 404, 403, 404, 145, 146, 147, 148, 149, 150, + /* 1390 */ 151, 54, 423, 56, 403, 404, 403, 404, 61, 62, + /* 1400 */ 423, 446, 423, 13, 449, 389, 68, 433, 0, 71, + /* 1410 */ 73, 389, 82, 449, 423, 389, 423, 33, 403, 404, + /* 1420 */ 82, 403, 404, 449, 33, 451, 82, 145, 389, 8, + /* 1430 */ 9, 149, 389, 12, 13, 14, 15, 16, 423, 8, + /* 1440 */ 9, 423, 112, 12, 13, 14, 15, 16, 389, 126, + /* 1450 */ 112, 114, 44, 115, 8, 9, 155, 434, 12, 13, + /* 1460 */ 14, 15, 16, 126, 235, 449, 237, 389, 47, 33, + /* 1470 */ 496, 449, 82, 499, 330, 449, 36, 503, 504, 505, + /* 1480 */ 506, 507, 508, 47, 510, 511, 512, 0, 449, 126, + /* 1490 */ 152, 153, 449, 120, 157, 158, 123, 160, 161, 162, + /* 1500 */ 163, 164, 165, 166, 167, 168, 169, 116, 449, 172, + /* 1510 */ 173, 174, 175, 176, 177, 178, 179, 51, 181, 182, + /* 1520 */ 183, 13, 82, 0, 187, 188, 189, 449, 13, 191, + /* 1530 */ 192, 194, 120, 120, 120, 123, 123, 123, 0, 201, + /* 1540 */ 202, 152, 153, 180, 36, 22, 216, 116, 218, 38, + /* 1550 */ 0, 36, 1, 2, 216, 434, 218, 33, 434, 33, + /* 1560 */ 22, 223, 116, 8, 9, 54, 33, 12, 13, 14, + /* 1570 */ 15, 16, 22, 33, 63, 64, 65, 66, 481, 68, + /* 1580 */ 33, 115, 33, 253, 254, 33, 434, 12, 13, 12, + /* 1590 */ 13, 253, 254, 255, 434, 257, 258, 259, 260, 261, + /* 1600 */ 262, 263, 264, 265, 266, 267, 33, 33, 270, 271, + /* 1610 */ 272, 273, 12, 13, 36, 277, 278, 279, 280, 281, + /* 1620 */ 282, 283, 18, 390, 245, 114, 389, 23, 12, 13, + /* 1630 */ 119, 421, 145, 146, 147, 148, 149, 150, 151, 475, + /* 1640 */ 116, 404, 116, 406, 461, 36, 42, 43, 533, 116, + /* 1650 */ 46, 33, 389, 36, 33, 33, 116, 115, 332, 117, + /* 1660 */ 82, 57, 566, 116, 475, 116, 555, 404, 116, 406, + /* 1670 */ 433, 12, 13, 69, 70, 71, 72, 73, 12, 13, + /* 1680 */ 33, 548, 12, 13, 12, 13, 449, 534, 451, 116, + /* 1690 */ 116, 12, 13, 12, 13, 531, 433, 186, 12, 13, + /* 1700 */ 407, 33, 33, 539, 433, 420, 195, 33, 13, 475, + /* 1710 */ 199, 200, 449, 402, 451, 420, 205, 206, 334, 115, + /* 1720 */ 531, 557, 558, 33, 33, 461, 562, 563, 539, 554, + /* 1730 */ 554, 36, 33, 496, 116, 224, 499, 116, 116, 554, + /* 1740 */ 503, 504, 505, 506, 507, 508, 557, 558, 511, 512, + /* 1750 */ 33, 562, 563, 474, 517, 475, 519, 36, 154, 496, + /* 1760 */ 523, 524, 499, 116, 389, 531, 503, 504, 505, 506, + /* 1770 */ 507, 508, 13, 539, 511, 512, 33, 33, 33, 404, + /* 1780 */ 517, 406, 519, 33, 116, 116, 523, 524, 461, 554, + /* 1790 */ 116, 557, 558, 407, 497, 36, 562, 563, 404, 448, + /* 1800 */ 482, 461, 461, 82, 538, 538, 116, 116, 433, 559, + /* 1810 */ 541, 531, 208, 209, 210, 116, 525, 213, 461, 539, + /* 1820 */ 422, 311, 476, 268, 449, 54, 451, 218, 20, 498, + /* 1830 */ 226, 227, 403, 116, 20, 218, 487, 557, 558, 234, + /* 1840 */ 389, 487, 562, 563, 240, 492, 412, 243, 214, 412, + /* 1850 */ 246, 247, 248, 249, 250, 404, 478, 406, 403, 116, + /* 1860 */ 116, 116, 20, 404, 47, 458, 116, 404, 458, 404, + /* 1870 */ 190, 496, 455, 403, 499, 403, 458, 455, 503, 504, + /* 1880 */ 505, 506, 507, 508, 433, 455, 511, 512, 455, 389, + /* 1890 */ 113, 416, 517, 111, 519, 415, 403, 403, 523, 524, + /* 1900 */ 449, 110, 451, 414, 404, 403, 406, 403, 403, 20, + /* 1910 */ 396, 52, 308, 400, 396, 12, 13, 400, 412, 487, + /* 1920 */ 389, 412, 20, 462, 451, 22, 20, 405, 412, 20, + /* 1930 */ 477, 412, 405, 433, 20, 404, 468, 406, 20, 36, + /* 1940 */ 412, 38, 412, 238, 412, 433, 412, 496, 403, 449, + /* 1950 */ 499, 451, 396, 412, 503, 504, 505, 506, 507, 508, + /* 1960 */ 392, 392, 511, 512, 433, 403, 396, 491, 517, 433, + /* 1970 */ 519, 68, 433, 115, 523, 524, 433, 433, 449, 433, + /* 1980 */ 449, 433, 451, 487, 449, 82, 433, 433, 489, 410, + /* 1990 */ 433, 433, 20, 486, 222, 221, 496, 410, 403, 499, + /* 2000 */ 318, 476, 319, 503, 504, 505, 506, 507, 508, 449, + /* 2010 */ 451, 511, 512, 449, 547, 112, 389, 517, 547, 519, + /* 2020 */ 327, 484, 207, 523, 524, 329, 549, 496, 550, 547, + /* 2030 */ 499, 404, 469, 545, 503, 504, 505, 506, 507, 508, + /* 2040 */ 469, 546, 511, 512, 483, 312, 328, 544, 517, 307, + /* 2050 */ 519, 12, 13, 306, 523, 524, 476, 537, 336, 567, + /* 2060 */ 433, 22, 333, 331, 404, 20, 126, 309, 502, 405, + /* 2070 */ 469, 410, 410, 449, 449, 36, 449, 38, 451, 449, + /* 2080 */ 449, 469, 561, 199, 449, 466, 410, 449, 462, 115, + /* 2090 */ 449, 199, 463, 404, 410, 462, 429, 410, 410, 449, + /* 2100 */ 449, 536, 449, 522, 449, 449, 449, 68, 115, 389, + /* 2110 */ 403, 410, 449, 438, 542, 22, 540, 391, 35, 216, + /* 2120 */ 449, 218, 449, 496, 404, 394, 499, 560, 37, 395, + /* 2130 */ 503, 504, 505, 506, 507, 508, 40, 397, 511, 512, + /* 2140 */ 495, 449, 396, 449, 517, 0, 519, 449, 411, 389, + /* 2150 */ 523, 524, 449, 433, 426, 449, 253, 254, 449, 449, + /* 2160 */ 449, 449, 449, 449, 404, 449, 488, 426, 449, 449, + /* 2170 */ 435, 451, 449, 270, 271, 426, 479, 387, 470, 0, + /* 2180 */ 277, 278, 279, 280, 281, 282, 435, 0, 47, 0, + /* 2190 */ 36, 244, 36, 433, 470, 36, 36, 244, 0, 36, + /* 2200 */ 36, 36, 244, 0, 0, 244, 0, 36, 0, 449, + /* 2210 */ 36, 451, 22, 0, 36, 239, 496, 0, 0, 499, + /* 2220 */ 224, 0, 224, 503, 504, 505, 506, 507, 508, 225, + /* 2230 */ 218, 511, 512, 216, 389, 0, 0, 0, 212, 519, + /* 2240 */ 211, 0, 0, 523, 524, 158, 51, 51, 0, 404, + /* 2250 */ 36, 0, 0, 54, 0, 216, 496, 218, 36, 499, + /* 2260 */ 51, 0, 47, 503, 504, 505, 506, 507, 508, 0, + /* 2270 */ 389, 511, 512, 0, 0, 51, 0, 0, 433, 519, + /* 2280 */ 0, 0, 0, 523, 524, 404, 0, 176, 0, 36, + /* 2290 */ 251, 252, 253, 176, 449, 0, 451, 0, 0, 0, + /* 2300 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 270, + /* 2310 */ 271, 0, 0, 0, 433, 0, 277, 278, 279, 280, + /* 2320 */ 281, 282, 0, 0, 0, 0, 51, 0, 0, 0, + /* 2330 */ 449, 47, 451, 0, 0, 0, 0, 0, 0, 0, + /* 2340 */ 22, 496, 158, 0, 499, 157, 389, 0, 503, 504, + /* 2350 */ 505, 506, 507, 508, 0, 0, 511, 512, 156, 0, + /* 2360 */ 68, 404, 22, 22, 519, 0, 52, 36, 523, 524, + /* 2370 */ 0, 52, 0, 0, 0, 54, 44, 496, 68, 0, + /* 2380 */ 499, 125, 36, 0, 503, 504, 505, 506, 507, 508, + /* 2390 */ 433, 0, 511, 512, 68, 389, 36, 44, 68, 36, + /* 2400 */ 44, 0, 54, 54, 36, 47, 449, 14, 451, 33, + /* 2410 */ 404, 44, 51, 51, 0, 51, 45, 0, 0, 44, + /* 2420 */ 0, 0, 44, 207, 0, 0, 0, 389, 51, 0, + /* 2430 */ 0, 51, 0, 76, 36, 0, 44, 0, 54, 433, + /* 2440 */ 36, 54, 404, 44, 36, 564, 565, 44, 54, 0, + /* 2450 */ 54, 36, 0, 496, 44, 449, 499, 451, 0, 0, + /* 2460 */ 503, 504, 505, 506, 507, 508, 0, 0, 511, 512, + /* 2470 */ 0, 433, 36, 123, 0, 22, 519, 22, 36, 36, + /* 2480 */ 36, 524, 36, 36, 36, 0, 36, 449, 0, 451, + /* 2490 */ 36, 22, 36, 33, 33, 22, 0, 22, 36, 36, + /* 2500 */ 36, 22, 496, 0, 22, 499, 0, 56, 36, 503, + /* 2510 */ 504, 505, 506, 507, 508, 0, 389, 511, 512, 0, + /* 2520 */ 36, 0, 36, 0, 0, 36, 22, 20, 36, 36, + /* 2530 */ 36, 404, 116, 0, 496, 193, 389, 499, 115, 223, + /* 2540 */ 0, 503, 504, 505, 506, 507, 508, 36, 228, 511, + /* 2550 */ 512, 404, 51, 115, 22, 0, 22, 0, 0, 553, + /* 2560 */ 433, 33, 193, 3, 52, 199, 36, 36, 313, 52, + /* 2570 */ 219, 33, 33, 229, 33, 193, 449, 51, 451, 193, + /* 2580 */ 433, 193, 33, 115, 313, 33, 51, 116, 203, 36, + /* 2590 */ 82, 115, 203, 115, 556, 115, 449, 116, 451, 116, + /* 2600 */ 473, 389, 111, 113, 3, 33, 313, 36, 33, 36, + /* 2610 */ 36, 116, 115, 115, 36, 116, 404, 115, 36, 36, + /* 2620 */ 473, 389, 200, 496, 0, 116, 499, 51, 115, 0, + /* 2630 */ 503, 504, 505, 506, 507, 508, 404, 51, 511, 512, + /* 2640 */ 44, 116, 115, 496, 115, 433, 499, 0, 44, 297, + /* 2650 */ 503, 504, 505, 506, 507, 508, 0, 44, 511, 512, + /* 2660 */ 116, 449, 116, 451, 116, 433, 116, 116, 33, 115, + /* 2670 */ 2, 115, 22, 22, 51, 116, 115, 113, 113, 116, + /* 2680 */ 285, 449, 195, 451, 253, 115, 0, 44, 51, 256, + /* 2690 */ 0, 22, 115, 51, 115, 115, 196, 116, 22, 115, + /* 2700 */ 115, 196, 115, 115, 115, 115, 389, 116, 496, 115, + /* 2710 */ 115, 499, 196, 116, 115, 503, 504, 505, 506, 507, + /* 2720 */ 508, 404, 116, 511, 512, 115, 115, 118, 496, 117, + /* 2730 */ 115, 499, 115, 115, 389, 503, 504, 505, 506, 507, + /* 2740 */ 508, 116, 115, 511, 512, 115, 514, 126, 22, 404, + /* 2750 */ 433, 22, 36, 36, 116, 115, 36, 116, 36, 115, + /* 2760 */ 36, 116, 116, 36, 116, 229, 449, 36, 451, 137, + /* 2770 */ 389, 116, 115, 33, 115, 36, 137, 565, 433, 115, + /* 2780 */ 22, 76, 75, 22, 36, 404, 137, 36, 36, 137, + /* 2790 */ 473, 36, 36, 36, 449, 36, 451, 82, 36, 36, + /* 2800 */ 36, 36, 109, 82, 109, 33, 36, 36, 0, 36, + /* 2810 */ 22, 36, 36, 496, 433, 36, 499, 82, 473, 36, + /* 2820 */ 503, 504, 505, 506, 507, 508, 36, 36, 511, 512, + /* 2830 */ 449, 36, 451, 36, 22, 36, 36, 44, 54, 0, + /* 2840 */ 36, 496, 44, 54, 499, 0, 389, 36, 503, 504, + /* 2850 */ 505, 506, 507, 508, 473, 54, 511, 512, 0, 44, + /* 2860 */ 36, 404, 44, 54, 0, 36, 389, 0, 22, 36, + /* 2870 */ 0, 22, 36, 33, 36, 22, 21, 496, 22, 22, + /* 2880 */ 499, 404, 21, 20, 503, 504, 505, 506, 507, 508, + /* 2890 */ 433, 568, 511, 512, 568, 568, 568, 568, 568, 568, + /* 2900 */ 568, 568, 568, 568, 568, 568, 449, 568, 451, 568, + /* 2910 */ 433, 568, 568, 568, 568, 568, 568, 568, 568, 568, + /* 2920 */ 568, 568, 568, 568, 568, 568, 449, 568, 451, 568, + /* 2930 */ 473, 389, 568, 568, 568, 568, 568, 568, 568, 568, + /* 2940 */ 568, 568, 568, 568, 568, 568, 404, 568, 568, 568, + /* 2950 */ 568, 568, 568, 496, 568, 568, 499, 568, 568, 568, + /* 2960 */ 503, 504, 505, 506, 507, 508, 568, 568, 511, 512, + /* 2970 */ 568, 568, 568, 496, 568, 433, 499, 568, 568, 568, + /* 2980 */ 503, 504, 505, 506, 507, 508, 568, 568, 511, 512, + /* 2990 */ 568, 449, 568, 451, 568, 568, 568, 568, 568, 568, + /* 3000 */ 568, 568, 568, 568, 568, 568, 568, 568, 568, 568, + /* 3010 */ 568, 389, 568, 568, 568, 568, 568, 568, 568, 568, + /* 3020 */ 568, 568, 568, 568, 568, 389, 404, 568, 568, 568, + /* 3030 */ 568, 568, 568, 568, 568, 568, 568, 568, 496, 568, + /* 3040 */ 404, 499, 389, 568, 568, 503, 504, 505, 506, 507, + /* 3050 */ 508, 568, 568, 511, 512, 433, 568, 404, 568, 568, + /* 3060 */ 568, 568, 568, 568, 568, 568, 568, 568, 568, 433, + /* 3070 */ 568, 449, 568, 451, 568, 568, 568, 568, 568, 568, + /* 3080 */ 568, 568, 568, 568, 568, 449, 433, 451, 568, 568, + /* 3090 */ 568, 568, 568, 568, 568, 568, 568, 568, 568, 568, + /* 3100 */ 568, 568, 449, 568, 451, 568, 568, 389, 568, 568, + /* 3110 */ 568, 568, 568, 568, 568, 568, 568, 568, 496, 568, + /* 3120 */ 568, 499, 404, 568, 568, 503, 504, 505, 506, 507, + /* 3130 */ 508, 568, 496, 511, 512, 499, 568, 568, 568, 503, + /* 3140 */ 504, 505, 506, 507, 508, 568, 568, 511, 512, 496, + /* 3150 */ 568, 433, 499, 568, 568, 568, 503, 504, 505, 506, + /* 3160 */ 507, 508, 568, 568, 511, 512, 568, 449, 568, 451, + /* 3170 */ 568, 568, 568, 568, 568, 389, 568, 568, 568, 568, + /* 3180 */ 568, 568, 568, 568, 568, 568, 568, 568, 568, 568, + /* 3190 */ 404, 568, 568, 568, 568, 568, 568, 568, 568, 568, + /* 3200 */ 568, 568, 568, 389, 568, 568, 568, 568, 568, 568, + /* 3210 */ 568, 568, 568, 568, 496, 568, 568, 499, 404, 433, + /* 3220 */ 568, 503, 504, 505, 506, 507, 508, 568, 568, 511, + /* 3230 */ 512, 568, 568, 568, 568, 449, 568, 451, 568, 389, + /* 3240 */ 568, 568, 568, 568, 568, 568, 568, 433, 568, 568, + /* 3250 */ 568, 568, 568, 568, 404, 568, 568, 568, 568, 568, + /* 3260 */ 568, 568, 568, 449, 568, 451, 568, 568, 568, 568, + /* 3270 */ 568, 389, 568, 568, 568, 568, 568, 568, 568, 568, + /* 3280 */ 568, 568, 496, 433, 568, 499, 404, 568, 568, 503, + /* 3290 */ 504, 505, 506, 507, 508, 568, 568, 511, 512, 449, + /* 3300 */ 568, 451, 568, 568, 568, 568, 568, 568, 568, 568, + /* 3310 */ 496, 568, 568, 499, 568, 433, 568, 503, 504, 505, + /* 3320 */ 506, 507, 508, 568, 568, 511, 512, 568, 568, 568, + /* 3330 */ 568, 449, 568, 451, 568, 568, 389, 568, 568, 568, + /* 3340 */ 568, 568, 568, 568, 568, 568, 496, 568, 568, 499, + /* 3350 */ 568, 404, 568, 503, 504, 505, 506, 507, 508, 389, + /* 3360 */ 568, 511, 512, 568, 568, 568, 568, 568, 568, 568, + /* 3370 */ 568, 568, 568, 568, 404, 568, 568, 568, 496, 568, + /* 3380 */ 433, 499, 568, 568, 568, 503, 504, 505, 506, 507, + /* 3390 */ 508, 568, 568, 511, 512, 568, 449, 568, 451, 568, + /* 3400 */ 568, 389, 568, 433, 568, 568, 568, 568, 568, 568, + /* 3410 */ 568, 568, 568, 568, 568, 568, 404, 568, 568, 449, + /* 3420 */ 568, 451, 568, 568, 568, 568, 568, 568, 568, 568, + /* 3430 */ 568, 568, 568, 568, 568, 568, 568, 568, 568, 568, + /* 3440 */ 568, 568, 568, 496, 568, 433, 499, 389, 568, 568, + /* 3450 */ 503, 504, 505, 506, 507, 508, 568, 568, 511, 512, + /* 3460 */ 568, 449, 404, 451, 568, 568, 496, 568, 568, 499, + /* 3470 */ 568, 568, 568, 503, 504, 505, 506, 507, 508, 568, + /* 3480 */ 568, 511, 512, 568, 568, 568, 568, 568, 568, 568, + /* 3490 */ 568, 433, 568, 568, 568, 568, 568, 568, 568, 568, + /* 3500 */ 568, 568, 568, 568, 568, 568, 568, 449, 496, 451, + /* 3510 */ 568, 499, 389, 568, 568, 503, 504, 505, 506, 507, + /* 3520 */ 508, 568, 568, 511, 512, 568, 568, 404, 568, 389, + /* 3530 */ 568, 568, 568, 568, 568, 568, 568, 568, 568, 568, + /* 3540 */ 568, 568, 568, 568, 404, 568, 568, 568, 568, 568, + /* 3550 */ 568, 568, 568, 568, 496, 568, 433, 499, 568, 568, + /* 3560 */ 568, 503, 504, 505, 506, 507, 508, 568, 568, 511, + /* 3570 */ 512, 568, 449, 433, 451, 568, 568, 568, 568, 568, + /* 3580 */ 389, 568, 568, 568, 568, 568, 568, 568, 568, 449, + /* 3590 */ 568, 451, 568, 568, 568, 404, 568, 568, 568, 568, + /* 3600 */ 568, 568, 568, 568, 568, 568, 568, 568, 568, 568, + /* 3610 */ 568, 568, 568, 568, 568, 568, 568, 568, 568, 496, + /* 3620 */ 568, 568, 499, 568, 433, 568, 503, 504, 505, 506, + /* 3630 */ 507, 508, 568, 568, 511, 512, 496, 568, 568, 499, + /* 3640 */ 449, 568, 451, 503, 504, 505, 506, 507, 508, 568, + /* 3650 */ 568, 511, 512, 568, 568, 568, 568, 568, 568, 568, + /* 3660 */ 568, 389, 568, 568, 568, 568, 568, 568, 568, 568, + /* 3670 */ 568, 568, 568, 568, 568, 568, 404, 568, 568, 568, + /* 3680 */ 568, 568, 568, 568, 568, 568, 568, 496, 568, 389, + /* 3690 */ 499, 568, 568, 568, 503, 504, 505, 506, 507, 508, + /* 3700 */ 568, 568, 511, 512, 404, 433, 568, 568, 568, 568, + /* 3710 */ 389, 568, 568, 568, 568, 568, 568, 568, 568, 568, + /* 3720 */ 568, 449, 568, 451, 568, 404, 568, 568, 568, 568, + /* 3730 */ 568, 568, 568, 433, 568, 568, 568, 568, 568, 568, + /* 3740 */ 568, 568, 568, 568, 568, 568, 568, 568, 568, 449, + /* 3750 */ 568, 451, 568, 568, 433, 568, 568, 568, 568, 568, + /* 3760 */ 568, 568, 568, 568, 568, 568, 568, 568, 496, 568, + /* 3770 */ 449, 499, 451, 568, 568, 503, 504, 505, 506, 507, + /* 3780 */ 508, 568, 568, 511, 512, 568, 389, 568, 568, 568, + /* 3790 */ 568, 568, 568, 568, 568, 568, 496, 568, 568, 499, + /* 3800 */ 568, 404, 568, 503, 504, 505, 506, 507, 508, 568, + /* 3810 */ 568, 511, 512, 568, 568, 568, 568, 496, 568, 568, + /* 3820 */ 499, 568, 568, 568, 503, 504, 505, 506, 507, 508, + /* 3830 */ 433, 568, 511, 512, 568, 389, 568, 568, 568, 568, + /* 3840 */ 568, 568, 568, 568, 568, 568, 449, 568, 451, 568, + /* 3850 */ 404, 568, 568, 568, 568, 568, 568, 568, 568, 568, + /* 3860 */ 568, 568, 568, 389, 568, 568, 568, 568, 568, 568, + /* 3870 */ 568, 568, 568, 568, 568, 568, 568, 568, 404, 433, + /* 3880 */ 568, 568, 568, 568, 568, 568, 568, 568, 568, 568, + /* 3890 */ 568, 568, 568, 496, 568, 449, 499, 451, 568, 389, + /* 3900 */ 503, 504, 505, 506, 507, 508, 568, 433, 511, 512, + /* 3910 */ 568, 568, 568, 568, 404, 568, 568, 568, 568, 568, + /* 3920 */ 568, 568, 568, 449, 568, 451, 568, 568, 568, 568, + /* 3930 */ 568, 568, 568, 568, 568, 568, 568, 568, 568, 568, + /* 3940 */ 568, 568, 496, 433, 568, 499, 568, 568, 568, 503, + /* 3950 */ 504, 505, 506, 507, 508, 568, 568, 511, 512, 449, + /* 3960 */ 568, 451, 568, 568, 568, 568, 568, 568, 568, 568, + /* 3970 */ 496, 568, 568, 499, 568, 568, 568, 503, 504, 505, + /* 3980 */ 506, 507, 508, 568, 568, 511, 512, 568, 568, 568, + /* 3990 */ 568, 568, 568, 568, 568, 568, 568, 568, 568, 568, + /* 4000 */ 568, 568, 568, 568, 568, 568, 496, 568, 568, 499, + /* 4010 */ 568, 568, 389, 503, 504, 505, 506, 507, 508, 568, + /* 4020 */ 568, 511, 512, 568, 568, 568, 389, 404, 568, 568, + /* 4030 */ 568, 568, 568, 568, 568, 568, 568, 568, 568, 568, + /* 4040 */ 568, 404, 568, 568, 568, 568, 568, 568, 568, 568, + /* 4050 */ 568, 389, 568, 568, 568, 568, 433, 568, 568, 568, + /* 4060 */ 568, 568, 568, 568, 568, 568, 404, 568, 568, 568, + /* 4070 */ 433, 568, 449, 568, 451, 568, 568, 389, 568, 568, + /* 4080 */ 568, 568, 568, 568, 568, 568, 449, 568, 451, 568, + /* 4090 */ 568, 568, 404, 568, 389, 433, 568, 568, 568, 568, + /* 4100 */ 568, 568, 568, 568, 568, 568, 568, 568, 568, 404, + /* 4110 */ 568, 449, 568, 451, 568, 568, 568, 568, 568, 496, + /* 4120 */ 568, 433, 499, 568, 568, 568, 503, 504, 505, 506, + /* 4130 */ 507, 508, 568, 496, 511, 512, 499, 449, 433, 451, + /* 4140 */ 503, 504, 505, 506, 507, 508, 568, 568, 511, 512, + /* 4150 */ 568, 568, 568, 568, 449, 568, 451, 568, 496, 568, + /* 4160 */ 568, 499, 568, 568, 568, 503, 504, 505, 506, 507, + /* 4170 */ 508, 568, 568, 511, 512, 568, 568, 568, 568, 568, + /* 4180 */ 568, 568, 568, 568, 496, 568, 568, 499, 568, 568, + /* 4190 */ 568, 503, 504, 505, 506, 507, 508, 568, 568, 511, + /* 4200 */ 512, 496, 568, 568, 499, 568, 568, 568, 503, 504, + /* 4210 */ 505, 506, 507, 508, 568, 568, 511, 512, 386, 386, + /* 4220 */ 386, 386, 386, 386, 386, 386, 386, 386, 386, 386, + /* 4230 */ 386, 386, 386, 386, 386, 386, 386, 386, 386, 386, + /* 4240 */ 386, 386, 386, 386, 386, 386, 386, 386, 386, 386, + /* 4250 */ 386, 386, 386, 386, 386, 386, 386, 386, 386, 386, + /* 4260 */ 386, 386, 386, 386, 386, 386, 386, 386, 386, 386, + /* 4270 */ 386, 386, 386, 386, 386, 386, 386, 386, 386, 386, + /* 4280 */ 386, 386, 386, 386, 386, 386, 386, 386, 386, 386, + /* 4290 */ 386, 386, 386, 386, 386, 386, 386, 386, 386, 386, + /* 4300 */ 386, 386, 386, 386, 386, 386, 386, 386, 386, 386, + /* 4310 */ 386, 386, 386, 386, 386, 386, 386, 386, 386, 386, + /* 4320 */ 386, 386, 386, 386, 386, 386, 386, 386, 386, 386, + /* 4330 */ 386, 386, 386, 386, 386, 386, 386, 386, 386, 386, + /* 4340 */ 386, 386, 386, 386, 386, 386, 386, 386, 386, 386, + /* 4350 */ 386, 386, 386, 386, 386, 386, 386, 386, 386, 386, + /* 4360 */ 386, 386, 386, 386, 386, 386, 386, 386, 386, 386, + /* 4370 */ 386, 386, 386, 386, 386, 386, 386, 386, 386, 386, + /* 4380 */ 386, 386, 386, 386, 386, 386, 386, 386, 386, 386, + /* 4390 */ 386, 386, 386, 386, 386, 386, 386, 386, 386, 386, + /* 4400 */ 386, 386, 386, 386, 386, 386, 386, 386, 386, 386, + /* 4410 */ 386, 386, 386, 386, 386, 386, 386, 386, 386, 386, + /* 4420 */ 386, 386, 386, 386, 386, 386, 386, 386, 386, 386, + /* 4430 */ 386, 386, 386, 386, 386, 386, 386, 386, 386, 386, + /* 4440 */ 386, 386, 386, 386, 386, 386, 386, 386, 386, 386, + /* 4450 */ 386, 386, 386, 386, 386, 386, 386, 386, 386, 386, + /* 4460 */ 386, 386, 386, 386, 386, 386, 386, 386, 386, 386, + /* 4470 */ 386, 386, 386, 386, 386, 386, 386, 386, 386, 386, + /* 4480 */ 386, 386, 386, 386, 386, 386, 386, 386, 386, 386, + /* 4490 */ 386, 386, 386, 386, 386, 386, 386, 386, 386, 386, + /* 4500 */ 386, 386, 386, 386, 386, 386, 386, 386, 386, 386, + /* 4510 */ 386, 386, 386, 386, 386, 386, 386, 386, 386, 386, + /* 4520 */ 386, 386, 386, 386, 386, 386, 386, 386, 386, 386, + /* 4530 */ 386, 386, 386, 386, 386, 386, 386, 386, 386, 386, + /* 4540 */ 386, 386, 386, 386, 386, 386, 386, 386, 386, 386, + /* 4550 */ 386, 386, 386, 386, 386, 386, 386, 386, 386, 386, + /* 4560 */ 386, 386, 386, 386, 386, 386, 386, 386, 386, 386, + /* 4570 */ 386, 386, 386, 386, 386, 386, 386, 386, 386, 386, + /* 4580 */ 386, 386, 386, 386, 386, 386, 386, 386, 386, 386, + /* 4590 */ 386, 386, 386, 386, 386, 386, 386, 386, 386, 386, + /* 4600 */ 386, 386, 386, 386, }; #define YY_SHIFT_COUNT (1003) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (2846) +#define YY_SHIFT_MAX (2870) static const unsigned short int yy_shift_ofst[] = { - /* 0 */ 347, 0, 83, 0, 346, 346, 346, 346, 346, 346, - /* 10 */ 346, 346, 346, 346, 346, 346, 429, 691, 691, 774, - /* 20 */ 691, 691, 691, 691, 691, 691, 691, 691, 691, 691, - /* 30 */ 691, 691, 691, 691, 691, 691, 691, 691, 691, 691, - /* 40 */ 691, 691, 691, 691, 691, 691, 691, 691, 691, 691, - /* 50 */ 102, 116, 534, 212, 408, 766, 408, 408, 212, 212, - /* 60 */ 408, 1175, 408, 950, 1175, 623, 408, 20, 1338, 432, - /* 70 */ 432, 214, 214, 1338, 1338, 459, 459, 432, 437, 437, - /* 80 */ 74, 3, 3, 50, 52, 214, 214, 214, 214, 214, - /* 90 */ 214, 214, 214, 214, 214, 214, 286, 407, 473, 214, - /* 100 */ 214, 37, 20, 214, 286, 214, 20, 214, 214, 214, - /* 110 */ 214, 20, 214, 214, 214, 20, 214, 20, 20, 20, - /* 120 */ 636, 39, 39, 523, 523, 1433, 647, 236, 489, 1038, - /* 130 */ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, - /* 140 */ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1222, 743, - /* 150 */ 437, 74, 1035, 1035, 790, 261, 261, 261, 632, 632, - /* 160 */ 496, 461, 790, 37, 20, 613, 20, 20, 483, 20, - /* 170 */ 20, 792, 20, 792, 792, 764, 1227, 523, 523, 523, - /* 180 */ 523, 523, 523, 1577, 302, 405, 563, 348, 348, 763, - /* 190 */ 599, 363, 330, 700, 122, 49, 747, 61, 61, 1086, - /* 200 */ 692, 901, 901, 901, 947, 901, 543, 1041, 1228, 1010, - /* 210 */ 1049, 452, 1051, 1166, 1166, 1172, 1320, 1320, 1103, 820, - /* 220 */ 981, 1166, 461, 1401, 1636, 1691, 1695, 1487, 37, 1695, - /* 230 */ 37, 1531, 1691, 1732, 1709, 1732, 1709, 1574, 1691, 1732, - /* 240 */ 1691, 1709, 1574, 1574, 1574, 1662, 1667, 1691, 1691, 1674, - /* 250 */ 1691, 1691, 1691, 1771, 1740, 1771, 1740, 1695, 37, 37, - /* 260 */ 1777, 37, 1785, 1788, 37, 1785, 37, 1802, 37, 1806, - /* 270 */ 37, 37, 1691, 37, 1771, 20, 20, 20, 20, 20, - /* 280 */ 20, 20, 20, 20, 20, 20, 1691, 1227, 1227, 1771, - /* 290 */ 792, 792, 792, 1637, 1765, 1695, 636, 1863, 1665, 1663, - /* 300 */ 1777, 636, 1401, 1691, 792, 1589, 1592, 1589, 1592, 1587, - /* 310 */ 1701, 1589, 1591, 1594, 1606, 1401, 1632, 1639, 1612, 1617, - /* 320 */ 1623, 1732, 1930, 1822, 1651, 1785, 636, 636, 1592, 792, - /* 330 */ 792, 792, 792, 1592, 792, 1776, 636, 792, 1806, 636, - /* 340 */ 1880, 792, 1800, 1806, 636, 764, 636, 1732, 792, 792, - /* 350 */ 792, 792, 792, 792, 792, 792, 792, 792, 792, 792, - /* 360 */ 792, 792, 792, 792, 792, 792, 792, 792, 792, 792, - /* 370 */ 1900, 792, 1691, 636, 1996, 1985, 2008, 2009, 1771, 3018, - /* 380 */ 3018, 3018, 3018, 3018, 3018, 3018, 3018, 3018, 3018, 3018, - /* 390 */ 3018, 1077, 867, 648, 1206, 887, 1005, 1043, 1214, 1350, - /* 400 */ 1692, 934, 1475, 1084, 1084, 1084, 1084, 1084, 1084, 1084, - /* 410 */ 1084, 1084, 183, 512, 220, 693, 702, 702, 4, 616, - /* 420 */ 811, 726, 542, 542, 145, 255, 542, 769, 683, 1209, - /* 430 */ 856, 141, 141, 113, 160, 738, 113, 113, 113, 91, - /* 440 */ 1241, 222, 925, 1301, 1019, 1249, 1388, 1272, 1287, 1291, - /* 450 */ 1310, 1347, 1418, 1425, 558, 1397, 1449, 1450, 1164, 1283, - /* 460 */ 1376, 1208, 1403, 1404, 1430, 1431, 1216, 1278, 1114, 1432, - /* 470 */ 1463, 1464, 1476, 1466, 770, 1468, 1402, 1477, 1478, 1479, - /* 480 */ 1497, 1498, 1501, 1520, 1526, 1530, 1538, 1546, 1573, 1579, - /* 490 */ 1590, 1604, 1615, 1565, 1567, 1586, 1603, 1613, 1624, 1366, - /* 500 */ 1473, 1369, 1458, 1508, 1598, 1547, 1440, 2090, 2091, 2092, - /* 510 */ 2047, 2095, 2061, 1855, 2063, 2070, 2072, 1868, 2112, 2077, - /* 520 */ 2078, 1872, 2080, 2117, 2118, 1876, 2120, 2085, 2122, 2087, - /* 530 */ 2124, 2104, 2127, 2093, 1890, 2131, 1910, 2135, 1912, 1918, - /* 540 */ 1927, 1932, 2146, 2149, 2150, 1939, 1941, 2153, 2155, 1998, - /* 550 */ 2106, 2107, 2160, 2125, 2162, 2163, 2128, 2111, 2166, 2116, - /* 560 */ 2168, 2126, 2169, 2171, 2175, 2129, 2177, 2178, 2179, 2181, - /* 570 */ 2182, 2183, 2010, 2148, 2185, 2011, 2188, 2189, 2190, 2191, - /* 580 */ 2193, 2195, 2198, 2199, 2200, 2201, 2202, 2204, 2205, 2206, - /* 590 */ 2207, 2208, 2209, 2210, 2212, 2213, 2164, 2214, 2187, 2218, - /* 600 */ 2222, 2230, 2232, 2235, 2236, 2237, 2241, 2244, 2233, 2252, - /* 610 */ 2096, 2257, 2102, 2261, 2108, 2262, 2263, 2243, 2216, 2248, - /* 620 */ 2219, 2279, 2220, 2281, 2223, 2250, 2282, 2224, 2284, 2225, - /* 630 */ 2290, 2294, 2259, 2242, 2253, 2298, 2264, 2245, 2258, 2301, - /* 640 */ 2268, 2254, 2274, 2319, 2285, 2320, 2275, 2283, 2292, 2272, - /* 650 */ 2277, 2312, 2278, 2331, 2291, 2299, 2335, 2345, 2346, 2347, - /* 660 */ 2304, 2142, 2354, 2272, 2300, 2356, 2272, 2306, 2358, 2367, - /* 670 */ 2296, 2368, 2370, 2337, 2321, 2330, 2376, 2341, 2324, 2336, - /* 680 */ 2381, 2348, 2329, 2352, 2392, 2359, 2343, 2355, 2398, 2401, - /* 690 */ 2402, 2403, 2404, 2405, 2288, 2295, 2371, 2384, 2408, 2387, - /* 700 */ 2375, 2378, 2379, 2385, 2386, 2395, 2397, 2399, 2406, 2407, - /* 710 */ 2410, 2412, 2413, 2415, 2414, 2420, 2416, 2434, 2417, 2441, - /* 720 */ 2422, 2390, 2452, 2431, 2419, 2454, 2456, 2458, 2423, 2462, - /* 730 */ 2427, 2470, 2436, 2473, 2453, 2461, 2438, 2440, 2442, 2369, - /* 740 */ 2372, 2483, 2293, 2255, 2260, 2374, 2267, 2272, 2443, 2491, - /* 750 */ 2314, 2457, 2486, 2505, 2297, 2487, 2317, 2313, 2511, 2513, - /* 760 */ 2322, 2315, 2326, 2318, 2514, 2489, 2226, 2424, 2409, 2425, - /* 770 */ 2421, 2484, 2492, 2426, 2471, 2432, 2495, 2445, 2433, 2526, - /* 780 */ 2527, 2446, 2448, 2449, 2450, 2451, 2528, 2497, 2517, 2455, - /* 790 */ 2533, 2265, 2490, 2459, 2538, 2464, 2537, 2465, 2466, 2574, - /* 800 */ 2547, 2280, 2549, 2550, 2551, 2552, 2554, 2555, 2467, 2478, - /* 810 */ 2544, 2316, 2572, 2556, 2606, 2608, 2494, 2566, 2496, 2498, - /* 820 */ 2500, 2501, 2429, 2503, 2611, 2569, 2439, 2619, 2504, 2508, - /* 830 */ 2430, 2590, 2460, 2603, 2524, 2366, 2530, 2642, 2623, 2396, - /* 840 */ 2531, 2534, 2536, 2539, 2541, 2542, 2543, 2545, 2598, 2548, - /* 850 */ 2553, 2601, 2557, 2631, 2411, 2559, 2560, 2659, 2561, 2563, - /* 860 */ 2469, 2616, 2564, 2567, 2669, 2648, 2558, 2565, 2272, 2621, - /* 870 */ 2568, 2571, 2582, 2575, 2585, 2576, 2679, 2681, 2683, 2475, - /* 880 */ 2591, 2645, 2672, 2595, 2597, 2678, 2600, 2609, 2686, 2536, - /* 890 */ 2610, 2688, 2539, 2612, 2694, 2541, 2615, 2697, 2542, 2599, - /* 900 */ 2602, 2613, 2617, 2625, 2705, 2634, 2716, 2640, 2705, 2705, - /* 910 */ 2734, 2682, 2684, 2735, 2724, 2725, 2726, 2727, 2728, 2729, - /* 920 */ 2730, 2731, 2732, 2733, 2737, 2689, 2661, 2693, 2670, 2745, - /* 930 */ 2744, 2753, 2754, 2769, 2757, 2759, 2760, 2715, 2407, 2764, - /* 940 */ 2410, 2766, 2767, 2768, 2775, 2791, 2779, 2817, 2783, 2770, - /* 950 */ 2776, 2821, 2786, 2771, 2782, 2823, 2792, 2773, 2785, 2830, - /* 960 */ 2795, 2781, 2793, 2836, 2802, 2840, 2819, 2808, 2845, 2832, - /* 970 */ 2822, 2816, 2820, 2835, 2837, 2838, 2841, 2843, 2846, + /* 0 */ 1604, 272, 355, 272, 628, 628, 628, 628, 628, 628, + /* 10 */ 628, 628, 628, 628, 628, 628, 711, 1066, 1066, 1338, + /* 20 */ 0, 1066, 1066, 1066, 1066, 1066, 1066, 1066, 1066, 1066, + /* 30 */ 1066, 983, 1066, 1066, 1066, 1066, 1066, 1066, 1066, 1066, + /* 40 */ 1066, 1066, 1066, 1066, 1066, 1066, 1066, 1066, 1066, 1066, + /* 50 */ 1066, 1066, 1066, 1066, 1066, 1066, 1066, 1066, 1066, 1066, + /* 60 */ 433, 476, 700, 129, 390, 401, 390, 390, 129, 129, + /* 70 */ 390, 1903, 390, 1337, 1903, 461, 390, 35, 2039, 675, + /* 80 */ 675, 284, 284, 2039, 2039, 161, 161, 675, 14, 14, + /* 90 */ 494, 72, 72, 40, 372, 284, 284, 284, 284, 284, + /* 100 */ 284, 284, 284, 284, 284, 284, 486, 521, 591, 284, + /* 110 */ 284, 549, 35, 284, 486, 284, 35, 284, 284, 284, + /* 120 */ 284, 35, 284, 284, 284, 35, 284, 35, 35, 35, + /* 130 */ 694, 307, 307, 545, 545, 623, 1202, 178, 334, 1330, + /* 140 */ 1330, 1330, 1330, 1330, 1330, 1330, 1330, 1330, 1330, 1330, + /* 150 */ 1330, 1330, 1330, 1330, 1330, 1330, 1330, 1330, 687, 830, + /* 160 */ 14, 494, 765, 765, 712, 900, 900, 900, 553, 553, + /* 170 */ 932, 678, 712, 549, 35, 126, 35, 35, 661, 35, + /* 180 */ 35, 1344, 35, 1344, 1344, 1323, 924, 545, 545, 545, + /* 190 */ 545, 545, 545, 802, 414, 204, 552, 283, 283, 845, + /* 200 */ 820, 344, 366, 672, 101, 154, 438, 361, 361, 999, + /* 210 */ 786, 303, 303, 303, 1079, 303, 864, 832, 331, 391, + /* 220 */ 1056, 1282, 445, 681, 681, 1036, 1390, 1390, 1144, 1307, + /* 230 */ 876, 681, 678, 1510, 1771, 1808, 1814, 1605, 549, 1814, + /* 240 */ 549, 1634, 1808, 1842, 1817, 1842, 1817, 1680, 1808, 1842, + /* 250 */ 1808, 1817, 1680, 1680, 1680, 1777, 1782, 1808, 1808, 1791, + /* 260 */ 1808, 1808, 1808, 1889, 1859, 1889, 1859, 1814, 549, 549, + /* 270 */ 1902, 549, 1906, 1909, 549, 1906, 549, 1914, 549, 1918, + /* 280 */ 549, 549, 1808, 549, 1889, 35, 35, 35, 35, 35, + /* 290 */ 35, 35, 35, 35, 35, 35, 1808, 924, 924, 1889, + /* 300 */ 1344, 1344, 1344, 1705, 1858, 1814, 694, 1972, 1772, 1774, + /* 310 */ 1902, 694, 1510, 1808, 1344, 1683, 1682, 1683, 1682, 1693, + /* 320 */ 1815, 1683, 1696, 1718, 1733, 1510, 1742, 1747, 1722, 1729, + /* 330 */ 1732, 1842, 2045, 1940, 1758, 1906, 694, 694, 1682, 1344, + /* 340 */ 1344, 1344, 1344, 1682, 1344, 1884, 694, 1344, 1918, 694, + /* 350 */ 1974, 1344, 1892, 1918, 694, 1323, 694, 1842, 1344, 1344, + /* 360 */ 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + /* 370 */ 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + /* 380 */ 1993, 1344, 1808, 694, 2093, 2083, 2091, 2096, 1889, 4218, + /* 390 */ 4218, 4218, 4218, 4218, 4218, 4218, 4218, 4218, 4218, 4218, + /* 400 */ 4218, 39, 1511, 690, 982, 762, 1002, 1179, 1200, 1219, + /* 410 */ 2, 17, 34, 322, 1261, 1421, 1431, 1446, 1555, 910, + /* 420 */ 1239, 1487, 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, + /* 430 */ 1019, 271, 54, 232, 287, 1068, 1068, 317, 586, 9, + /* 440 */ 768, 118, 118, 15, 620, 696, 118, 314, 1041, 1088, + /* 450 */ 976, 976, 1136, 847, 1017, 1136, 1136, 1136, 342, 1379, + /* 460 */ 1391, 1408, 1436, 1363, 1301, 121, 1373, 1412, 1413, 1414, + /* 470 */ 1440, 1508, 1515, 429, 1523, 1538, 1550, 1229, 1524, 1526, + /* 480 */ 750, 1533, 1540, 1547, 1549, 1389, 1326, 1384, 1552, 1573, + /* 490 */ 1574, 1618, 1551, 1621, 853, 1622, 1647, 1466, 1668, 1669, + /* 500 */ 1674, 1690, 1691, 1575, 1577, 1600, 1616, 1659, 1666, 1670, + /* 510 */ 1672, 1679, 1681, 1686, 1699, 1717, 1743, 1744, 1745, 1750, + /* 520 */ 1542, 1578, 1609, 1617, 1695, 1759, 1721, 162, 2145, 2179, + /* 530 */ 2187, 2141, 2189, 2154, 1947, 2156, 2159, 2160, 1953, 2198, + /* 540 */ 2163, 2164, 1958, 2165, 2203, 2204, 1961, 2206, 2171, 2208, + /* 550 */ 2174, 2217, 2190, 2213, 2178, 1976, 2218, 1996, 2221, 1998, + /* 560 */ 2004, 2012, 2017, 2235, 2236, 2237, 2026, 2029, 2241, 2242, + /* 570 */ 2087, 2195, 2196, 2248, 2214, 2251, 2252, 2222, 2199, 2254, + /* 580 */ 2209, 2261, 2215, 2269, 2273, 2274, 2224, 2276, 2277, 2280, + /* 590 */ 2281, 2282, 2286, 2111, 2253, 2288, 2117, 2295, 2297, 2298, + /* 600 */ 2299, 2300, 2301, 2302, 2303, 2304, 2305, 2306, 2307, 2308, + /* 610 */ 2311, 2312, 2313, 2315, 2322, 2323, 2324, 2275, 2325, 2284, + /* 620 */ 2327, 2328, 2329, 2333, 2334, 2335, 2336, 2337, 2338, 2318, + /* 630 */ 2339, 2184, 2343, 2188, 2347, 2202, 2354, 2355, 2340, 2314, + /* 640 */ 2341, 2319, 2359, 2292, 2365, 2310, 2331, 2370, 2326, 2372, + /* 650 */ 2330, 2373, 2374, 2346, 2321, 2332, 2379, 2360, 2348, 2353, + /* 660 */ 2383, 2363, 2349, 2356, 2391, 2368, 2401, 2358, 2367, 2376, + /* 670 */ 2361, 2362, 2393, 2364, 2414, 2371, 2375, 2417, 2418, 2420, + /* 680 */ 2421, 2378, 2216, 2424, 2361, 2377, 2425, 2361, 2380, 2426, + /* 690 */ 2429, 2357, 2430, 2432, 2398, 2384, 2392, 2435, 2404, 2387, + /* 700 */ 2399, 2437, 2408, 2394, 2403, 2449, 2415, 2396, 2410, 2452, + /* 710 */ 2458, 2459, 2466, 2467, 2470, 2256, 2350, 2436, 2453, 2474, + /* 720 */ 2455, 2442, 2443, 2444, 2446, 2447, 2448, 2450, 2454, 2456, + /* 730 */ 2460, 2461, 2462, 2463, 2469, 2464, 2485, 2473, 2488, 2475, + /* 740 */ 2496, 2479, 2451, 2503, 2482, 2472, 2506, 2515, 2519, 2484, + /* 750 */ 2521, 2486, 2523, 2489, 2524, 2504, 2507, 2492, 2493, 2494, + /* 760 */ 2416, 2423, 2533, 2342, 2344, 2320, 2438, 2316, 2361, 2501, + /* 770 */ 2540, 2369, 2511, 2532, 2555, 2351, 2534, 2382, 2366, 2557, + /* 780 */ 2558, 2386, 2385, 2388, 2389, 2560, 2528, 2255, 2468, 2471, + /* 790 */ 2476, 2481, 2530, 2531, 2478, 2512, 2490, 2517, 2491, 2483, + /* 800 */ 2538, 2539, 2495, 2480, 2497, 2498, 2499, 2541, 2526, 2535, + /* 810 */ 2502, 2549, 2271, 2508, 2509, 2552, 2513, 2553, 2525, 2544, + /* 820 */ 2601, 2572, 2293, 2571, 2573, 2574, 2578, 2582, 2583, 2546, + /* 830 */ 2548, 2576, 2352, 2575, 2586, 2624, 2629, 2527, 2596, 2550, + /* 840 */ 2551, 2529, 2554, 2500, 2556, 2647, 2604, 2422, 2656, 2559, + /* 850 */ 2561, 2505, 2613, 2487, 2635, 2564, 2395, 2565, 2668, 2650, + /* 860 */ 2431, 2570, 2577, 2579, 2580, 2563, 2581, 2584, 2585, 2587, + /* 870 */ 2588, 2589, 2591, 2623, 2590, 2594, 2637, 2597, 2651, 2433, + /* 880 */ 2595, 2599, 2686, 2606, 2610, 2516, 2643, 2611, 2612, 2690, + /* 890 */ 2669, 2609, 2615, 2361, 2642, 2617, 2618, 2625, 2627, 2630, + /* 900 */ 2621, 2676, 2726, 2729, 2536, 2638, 2716, 2717, 2640, 2641, + /* 910 */ 2720, 2644, 2645, 2722, 2584, 2646, 2724, 2585, 2648, 2727, + /* 920 */ 2587, 2655, 2731, 2588, 2632, 2639, 2649, 2652, 2657, 2740, + /* 930 */ 2659, 2739, 2664, 2740, 2740, 2758, 2705, 2707, 2761, 2748, + /* 940 */ 2751, 2752, 2755, 2756, 2757, 2759, 2762, 2763, 2764, 2765, + /* 950 */ 2715, 2693, 2721, 2695, 2772, 2770, 2771, 2773, 2788, 2775, + /* 960 */ 2776, 2779, 2735, 2460, 2783, 2461, 2790, 2791, 2795, 2797, + /* 970 */ 2812, 2799, 2808, 2800, 2784, 2793, 2839, 2804, 2789, 2798, + /* 980 */ 2845, 2811, 2801, 2815, 2858, 2824, 2809, 2818, 2864, 2829, + /* 990 */ 2867, 2846, 2833, 2870, 2849, 2840, 2836, 2838, 2853, 2855, + /* 1000 */ 2856, 2857, 2861, 2863, }; -#define YY_REDUCE_COUNT (390) -#define YY_REDUCE_MIN (-503) -#define YY_REDUCE_MAX (2515) +#define YY_REDUCE_COUNT (400) +#define YY_REDUCE_MIN (-474) +#define YY_REDUCE_MAX (3705) static const short yy_reduce_ofst[] = { - /* 0 */ -239, -365, -325, -19, -202, 325, 366, 705, 810, 840, - /* 10 */ 960, 991, 1027, 1156, 1237, 1318, 1342, 1361, 1429, 1494, - /* 20 */ 1469, 1537, 1605, 1563, 1642, 1729, 1751, 1778, 1815, 1842, - /* 30 */ 1864, 1891, 1928, 1969, 2004, 2036, 2055, 2101, 2133, 2197, - /* 40 */ 2221, 2246, 2286, 2310, 2351, 2391, 2418, 2437, 2502, 2515, - /* 50 */ -310, -61, -464, -362, 865, 955, 1145, 1165, -297, -271, - /* 60 */ 1201, -412, -503, -384, -382, -82, 13, -393, -385, -436, - /* 70 */ -356, -210, -21, -389, -324, -388, -247, -439, -142, 115, - /* 80 */ 148, -198, -191, -359, 89, 173, 313, 345, 403, 409, - /* 90 */ 435, 433, 440, 454, 578, 492, -337, 387, -10, 445, - /* 100 */ 583, 472, 412, 601, 393, 614, 15, 653, 675, 794, - /* 110 */ 837, 349, 844, 851, 874, 31, 877, 111, 375, 365, - /* 120 */ 565, -501, -501, -66, -111, -223, 595, -100, 120, -231, - /* 130 */ -3, 548, 753, 814, 817, 834, 836, 839, 843, 861, - /* 140 */ 881, 904, 916, 932, 937, 948, 949, 974, -405, 530, - /* 150 */ 87, 372, 704, 741, 869, 530, 806, 876, 434, 499, - /* 160 */ 673, -224, 884, 228, 64, 893, -195, 547, 644, 863, - /* 170 */ 718, 939, 871, 941, 943, -48, 919, -425, -411, 935, - /* 180 */ 999, 1009, 1040, 1007, 1093, 1134, 1075, 1012, 1012, 993, - /* 190 */ 1008, 1032, 1033, 1236, 1012, 1212, 1212, 1226, 1238, 1245, - /* 200 */ 1195, 1105, 1115, 1116, 1197, 1117, 1212, 1211, 1268, 1182, - /* 210 */ 1276, 1233, 1203, 1229, 1231, 1212, 1147, 1151, 1136, 1173, - /* 220 */ 1158, 1234, 1281, 1242, 1219, 1321, 1247, 1240, 1317, 1252, - /* 230 */ 1337, 1274, 1352, 1359, 1308, 1364, 1312, 1316, 1370, 1372, - /* 240 */ 1371, 1319, 1323, 1324, 1326, 1368, 1373, 1384, 1386, 1381, - /* 250 */ 1393, 1394, 1395, 1405, 1406, 1407, 1408, 1315, 1392, 1399, - /* 260 */ 1356, 1415, 1410, 1343, 1417, 1414, 1419, 1374, 1420, 1375, - /* 270 */ 1424, 1443, 1441, 1444, 1447, 1426, 1428, 1437, 1439, 1442, - /* 280 */ 1446, 1448, 1451, 1452, 1453, 1454, 1460, 1482, 1484, 1481, - /* 290 */ 1445, 1455, 1456, 1398, 1411, 1409, 1480, 1413, 1422, 1427, - /* 300 */ 1457, 1491, 1421, 1500, 1465, 1377, 1461, 1378, 1462, 1367, - /* 310 */ 1382, 1379, 1396, 1412, 1400, 1470, 1416, 1423, 1383, 1391, - /* 320 */ 1459, 1550, 1467, 1438, 1483, 1555, 1551, 1552, 1495, 1514, - /* 330 */ 1517, 1522, 1532, 1511, 1533, 1518, 1575, 1540, 1525, 1585, - /* 340 */ 1485, 1557, 1545, 1553, 1608, 1584, 1609, 1618, 1576, 1578, - /* 350 */ 1580, 1581, 1583, 1588, 1599, 1600, 1601, 1602, 1611, 1614, - /* 360 */ 1616, 1625, 1627, 1628, 1630, 1631, 1633, 1634, 1635, 1638, - /* 370 */ 1596, 1640, 1621, 1629, 1644, 1658, 1660, 1661, 1668, 1582, - /* 380 */ 1646, 1593, 1597, 1620, 1622, 1669, 1670, 1659, 1671, 1675, - /* 390 */ 1685, + /* 0 */ 399, -348, -206, 609, 1237, 1263, 1375, 1451, 1500, 1531, + /* 10 */ -63, 293, 1627, 1720, 1760, 1845, -101, 658, 1881, 1957, + /* 20 */ 974, 2006, 2127, 2147, 2038, 2212, 2232, 2317, 2345, 2381, + /* 30 */ 2457, 2477, 2542, 2622, 2636, 2653, 2718, 2786, 2814, 2850, + /* 40 */ 2882, 2947, 2970, 3012, 3058, 3123, 3140, 3191, 3272, 3300, + /* 50 */ 3321, 3397, 3446, 3474, 3510, 3623, 3637, 3662, 3688, 3705, + /* 60 */ -350, -343, -474, 540, -452, 1164, 1189, 1234, -290, 259, + /* 70 */ 1280, 143, 640, -395, 455, -182, -45, -243, -436, -444, + /* 80 */ -399, -323, -237, -84, -65, -324, -74, -427, -393, 274, + /* 90 */ 202, 442, 532, 547, 166, 201, 439, 536, 634, -231, + /* 100 */ 120, 636, 671, 726, 735, 642, 227, -398, 242, 773, + /* 110 */ 801, 743, 596, 890, 411, 911, -2, 938, 969, 977, + /* 120 */ 979, -137, 991, 993, 1015, 508, 1018, 294, 659, 509, + /* 130 */ -240, -252, -252, 172, -40, -383, -314, -431, -99, -352, + /* 140 */ 38, 262, 424, 615, 841, 862, 863, 907, 913, 916, + /* 150 */ 964, 1016, 1022, 1026, 1039, 1043, 1059, 1078, -208, -281, + /* 160 */ -104, 288, 759, 781, 804, -281, -158, 60, 469, 707, + /* 170 */ 336, 590, 951, 685, 567, 595, 141, 350, 641, 873, + /* 180 */ 739, 771, 826, 780, 955, 893, 978, -432, 1023, 1121, + /* 190 */ 1124, 1152, 1160, 1097, 1210, 1233, 1183, 1115, 1115, 1096, + /* 200 */ 1111, 1133, 1153, 1293, 1115, 1271, 1271, 1285, 1295, 1311, + /* 210 */ 1264, 1175, 1176, 1185, 1279, 1235, 1271, 1327, 1386, 1297, + /* 220 */ 1394, 1351, 1318, 1340, 1341, 1271, 1266, 1267, 1250, 1291, + /* 230 */ 1269, 1357, 1398, 1346, 1331, 1429, 1349, 1353, 1434, 1354, + /* 240 */ 1437, 1378, 1455, 1459, 1407, 1463, 1410, 1417, 1470, 1465, + /* 250 */ 1472, 1418, 1422, 1430, 1433, 1475, 1480, 1493, 1494, 1489, + /* 260 */ 1502, 1504, 1505, 1514, 1513, 1518, 1517, 1432, 1506, 1509, + /* 270 */ 1473, 1516, 1522, 1453, 1519, 1527, 1528, 1468, 1530, 1461, + /* 280 */ 1532, 1534, 1545, 1541, 1556, 1512, 1536, 1539, 1543, 1544, + /* 290 */ 1546, 1548, 1553, 1554, 1557, 1558, 1562, 1568, 1569, 1570, + /* 300 */ 1529, 1535, 1560, 1476, 1499, 1496, 1579, 1507, 1537, 1561, + /* 310 */ 1559, 1587, 1525, 1595, 1564, 1467, 1563, 1471, 1571, 1478, + /* 320 */ 1477, 1482, 1495, 1488, 1503, 1580, 1520, 1565, 1492, 1521, + /* 330 */ 1567, 1660, 1566, 1572, 1576, 1664, 1661, 1662, 1601, 1624, + /* 340 */ 1625, 1630, 1631, 1612, 1635, 1619, 1676, 1638, 1626, 1684, + /* 350 */ 1581, 1641, 1629, 1633, 1687, 1667, 1688, 1689, 1650, 1651, + /* 360 */ 1653, 1655, 1656, 1657, 1663, 1671, 1673, 1692, 1694, 1698, + /* 370 */ 1703, 1706, 1709, 1710, 1711, 1712, 1713, 1714, 1716, 1719, + /* 380 */ 1675, 1723, 1707, 1701, 1726, 1731, 1734, 1740, 1746, 1697, + /* 390 */ 1735, 1645, 1678, 1708, 1724, 1728, 1741, 1751, 1749, 1737, + /* 400 */ 1790, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 10 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 20 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 30 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 40 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 50 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 60 */ 2578, 2203, 2203, 2534, 2203, 2203, 2203, 2203, 2203, 2203, - /* 70 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2541, 2541, - /* 80 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 90 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 100 */ 2203, 2309, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 110 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 120 */ 2307, 2830, 2203, 2956, 2619, 2203, 2203, 2859, 2203, 2203, - /* 130 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 140 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2842, - /* 150 */ 2203, 2203, 2280, 2280, 2203, 2842, 2842, 2842, 2802, 2802, - /* 160 */ 2307, 2203, 2203, 2309, 2203, 2621, 2203, 2203, 2203, 2203, - /* 170 */ 2203, 2203, 2203, 2203, 2203, 2450, 2233, 2203, 2203, 2203, - /* 180 */ 2203, 2203, 2203, 2604, 2203, 2203, 2888, 2834, 2835, 2950, - /* 190 */ 2203, 2891, 2853, 2203, 2848, 2203, 2203, 2203, 2203, 2203, - /* 200 */ 2878, 2203, 2203, 2203, 2203, 2203, 2203, 2546, 2203, 2647, - /* 210 */ 2203, 2395, 2598, 2203, 2203, 2203, 2203, 2203, 2934, 2832, - /* 220 */ 2872, 2203, 2203, 2882, 2203, 2203, 2203, 2635, 2309, 2203, - /* 230 */ 2309, 2591, 2529, 2203, 2539, 2203, 2539, 2536, 2203, 2203, - /* 240 */ 2203, 2539, 2536, 2536, 2536, 2383, 2379, 2203, 2203, 2377, - /* 250 */ 2203, 2203, 2203, 2203, 2263, 2203, 2263, 2203, 2309, 2309, - /* 260 */ 2203, 2309, 2203, 2203, 2309, 2203, 2309, 2203, 2309, 2203, - /* 270 */ 2309, 2309, 2203, 2309, 2203, 2203, 2203, 2203, 2203, 2203, - /* 280 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 290 */ 2203, 2203, 2203, 2633, 2614, 2203, 2307, 2203, 2602, 2600, - /* 300 */ 2203, 2307, 2882, 2203, 2203, 2904, 2899, 2904, 2899, 2918, - /* 310 */ 2914, 2904, 2923, 2920, 2884, 2882, 2865, 2861, 2953, 2940, - /* 320 */ 2936, 2203, 2203, 2870, 2868, 2203, 2307, 2307, 2899, 2203, - /* 330 */ 2203, 2203, 2203, 2899, 2203, 2203, 2307, 2203, 2203, 2307, - /* 340 */ 2203, 2203, 2203, 2203, 2307, 2203, 2307, 2203, 2203, 2203, - /* 350 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 360 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 370 */ 2412, 2203, 2203, 2307, 2203, 2235, 2237, 2247, 2203, 2593, - /* 380 */ 2956, 2619, 2624, 2574, 2574, 2453, 2453, 2956, 2453, 2310, - /* 390 */ 2208, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 400 */ 2203, 2203, 2203, 2917, 2916, 2753, 2203, 2806, 2805, 2804, - /* 410 */ 2795, 2752, 2408, 2203, 2203, 2203, 2751, 2750, 2203, 2203, - /* 420 */ 2203, 2203, 2399, 2396, 2203, 2203, 2421, 2203, 2203, 2203, - /* 430 */ 2203, 2565, 2564, 2744, 2203, 2203, 2745, 2743, 2742, 2203, - /* 440 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 450 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 460 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2937, 2941, 2203, - /* 470 */ 2203, 2203, 2831, 2203, 2203, 2203, 2723, 2203, 2203, 2203, - /* 480 */ 2203, 2203, 2691, 2686, 2677, 2668, 2683, 2674, 2662, 2680, - /* 490 */ 2671, 2659, 2656, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 500 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 510 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 520 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 530 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 540 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2535, - /* 550 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 560 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 570 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 580 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 590 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 600 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 610 */ 2203, 2203, 2203, 2203, 2550, 2203, 2203, 2203, 2203, 2203, - /* 620 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 630 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 640 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2252, 2730, - /* 650 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 660 */ 2203, 2203, 2203, 2733, 2203, 2203, 2734, 2203, 2203, 2203, - /* 670 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 680 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 690 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 700 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2354, - /* 710 */ 2353, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 720 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 730 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2735, - /* 740 */ 2203, 2203, 2203, 2203, 2618, 2203, 2203, 2725, 2203, 2203, - /* 750 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 760 */ 2203, 2203, 2203, 2203, 2933, 2885, 2203, 2203, 2203, 2203, - /* 770 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 780 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2723, 2203, - /* 790 */ 2915, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2931, 2203, - /* 800 */ 2935, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2841, 2837, - /* 810 */ 2203, 2203, 2833, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 820 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 830 */ 2203, 2203, 2203, 2792, 2203, 2203, 2203, 2826, 2203, 2203, - /* 840 */ 2203, 2203, 2449, 2448, 2447, 2446, 2203, 2203, 2203, 2203, - /* 850 */ 2203, 2203, 2735, 2203, 2738, 2203, 2203, 2203, 2203, 2203, - /* 860 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2722, 2203, - /* 870 */ 2777, 2776, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 880 */ 2203, 2203, 2203, 2443, 2203, 2203, 2203, 2203, 2203, 2203, - /* 890 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2427, - /* 900 */ 2425, 2424, 2423, 2203, 2460, 2203, 2203, 2203, 2456, 2455, - /* 910 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 920 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2328, - /* 930 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2320, 2203, - /* 940 */ 2319, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 950 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 960 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, - /* 970 */ 2232, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, + /* 0 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, + /* 10 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, + /* 20 */ 2845, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, + /* 30 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, + /* 40 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, + /* 50 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, + /* 60 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, + /* 70 */ 2634, 2259, 2259, 2590, 2259, 2259, 2259, 2259, 2259, 2259, + /* 80 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2597, 2597, + /* 90 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, + /* 100 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, + /* 110 */ 2259, 2365, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, + /* 120 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, + /* 130 */ 2363, 2902, 2259, 3028, 2675, 2259, 2259, 2931, 2259, 2259, + /* 140 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, + /* 150 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2914, + /* 160 */ 2259, 2259, 2336, 2336, 2259, 2914, 2914, 2914, 2874, 2874, + /* 170 */ 2363, 2259, 2259, 2365, 2259, 2677, 2259, 2259, 2259, 2259, + /* 180 */ 2259, 2259, 2259, 2259, 2259, 2506, 2289, 2259, 2259, 2259, + /* 190 */ 2259, 2259, 2259, 2660, 2259, 2259, 2960, 2906, 2907, 3022, + /* 200 */ 2259, 2963, 2925, 2259, 2920, 2259, 2259, 2259, 2259, 2259, + /* 210 */ 2950, 2259, 2259, 2259, 2259, 2259, 2259, 2602, 2259, 2704, + /* 220 */ 2259, 2451, 2654, 2259, 2259, 2259, 2259, 2259, 3006, 2904, + /* 230 */ 2944, 2259, 2259, 2954, 2259, 2259, 2259, 2692, 2365, 2259, + /* 240 */ 2365, 2647, 2585, 2259, 2595, 2259, 2595, 2592, 2259, 2259, + /* 250 */ 2259, 2595, 2592, 2592, 2592, 2439, 2435, 2259, 2259, 2433, + /* 260 */ 2259, 2259, 2259, 2259, 2319, 2259, 2319, 2259, 2365, 2365, + /* 270 */ 2259, 2365, 2259, 2259, 2365, 2259, 2365, 2259, 2365, 2259, + /* 280 */ 2365, 2365, 2259, 2365, 2259, 2259, 2259, 2259, 2259, 2259, + /* 290 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, + /* 300 */ 2259, 2259, 2259, 2690, 2670, 2259, 2363, 2259, 2658, 2656, + /* 310 */ 2259, 2363, 2954, 2259, 2259, 2976, 2971, 2976, 2971, 2990, + /* 320 */ 2986, 2976, 2995, 2992, 2956, 2954, 2937, 2933, 3025, 3012, + /* 330 */ 3008, 2259, 2259, 2942, 2940, 2259, 2363, 2363, 2971, 2259, + /* 340 */ 2259, 2259, 2259, 2971, 2259, 2259, 2363, 2259, 2259, 2363, + /* 350 */ 2259, 2259, 2259, 2259, 2363, 2259, 2363, 2259, 2259, 2259, + /* 360 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, + /* 370 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, + /* 380 */ 2468, 2259, 2259, 2363, 2259, 2291, 2293, 2303, 2259, 2649, + /* 390 */ 3028, 2675, 2680, 2630, 2630, 2509, 2509, 3028, 2509, 2366, + /* 400 */ 2264, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, + /* 410 */ 2259, 2259, 2259, 2809, 2259, 2259, 2259, 2259, 2259, 2259, + /* 420 */ 2259, 2259, 2989, 2988, 2810, 2259, 2878, 2877, 2876, 2867, + /* 430 */ 2809, 2464, 2259, 2259, 2259, 2808, 2807, 2259, 2259, 2259, + /* 440 */ 2259, 2455, 2452, 2259, 2259, 2259, 2477, 2259, 2259, 2259, + /* 450 */ 2621, 2620, 2801, 2259, 2259, 2802, 2800, 2799, 2259, 2259, + /* 460 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, + /* 470 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, + /* 480 */ 2259, 2259, 2259, 2259, 2259, 2259, 3009, 3013, 2259, 2259, + /* 490 */ 2259, 2259, 2903, 2259, 2259, 2259, 2259, 2780, 2259, 2259, + /* 500 */ 2259, 2259, 2259, 2748, 2743, 2734, 2725, 2740, 2731, 2719, + /* 510 */ 2737, 2728, 2716, 2713, 2259, 2259, 2259, 2259, 2259, 2259, + /* 520 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, + /* 530 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, + /* 540 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, + /* 550 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, + /* 560 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, + /* 570 */ 2591, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, + /* 580 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, + /* 590 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, + /* 600 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, + /* 610 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, + /* 620 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, + /* 630 */ 2259, 2259, 2259, 2259, 2259, 2606, 2259, 2259, 2259, 2259, + /* 640 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, + /* 650 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, + /* 660 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2308, + /* 670 */ 2787, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, + /* 680 */ 2259, 2259, 2259, 2259, 2790, 2259, 2259, 2791, 2259, 2259, + /* 690 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, + /* 700 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, + /* 710 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, + /* 720 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, + /* 730 */ 2410, 2409, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, + /* 740 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, + /* 750 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, + /* 760 */ 2792, 2259, 2259, 2259, 2259, 2674, 2259, 2259, 2782, 2259, + /* 770 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, + /* 780 */ 2259, 2259, 2259, 2259, 2259, 3005, 2957, 2259, 2259, 2259, + /* 790 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, + /* 800 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2780, + /* 810 */ 2259, 2987, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 3003, + /* 820 */ 2259, 3007, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2913, + /* 830 */ 2909, 2259, 2259, 2905, 2259, 2259, 2259, 2259, 2259, 2259, + /* 840 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, + /* 850 */ 2259, 2259, 2259, 2259, 2864, 2259, 2259, 2259, 2898, 2259, + /* 860 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2505, 2504, 2503, + /* 870 */ 2502, 2259, 2259, 2259, 2259, 2259, 2259, 2792, 2259, 2795, + /* 880 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, + /* 890 */ 2259, 2259, 2259, 2779, 2259, 2842, 2841, 2259, 2259, 2259, + /* 900 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2499, 2259, + /* 910 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, + /* 920 */ 2259, 2259, 2259, 2259, 2483, 2481, 2480, 2479, 2259, 2516, + /* 930 */ 2259, 2259, 2259, 2512, 2511, 2259, 2259, 2259, 2259, 2259, + /* 940 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, + /* 950 */ 2259, 2259, 2259, 2259, 2384, 2259, 2259, 2259, 2259, 2259, + /* 960 */ 2259, 2259, 2259, 2376, 2259, 2375, 2259, 2259, 2259, 2259, + /* 970 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, + /* 980 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, + /* 990 */ 2259, 2259, 2259, 2259, 2259, 2288, 2259, 2259, 2259, 2259, + /* 1000 */ 2259, 2259, 2259, 2259, }; /********** End of lemon-generated parsing tables *****************************/ -/* The next table maps tokens (terminal symbols) into fallback tokens. +/* The next table maps tokens (terminal symbols) into fallback tokens. ** If a construct like the following: -** +** ** %fallback ID X Y Z. ** ** appears in the grammar, then ID becomes a fallback token for X, Y, @@ -1648,12 +1880,12 @@ static const YYCODETYPE yyFallback[] = { 0, /* BWLIMIT => nothing */ 0, /* START => nothing */ 0, /* TIMESTAMP => nothing */ - 328, /* END => ABORT */ + 337, /* END => ABORT */ 0, /* TABLE => nothing */ 0, /* NK_LP => nothing */ 0, /* NK_RP => nothing */ 0, /* USING => nothing */ - 328, /* FILE => ABORT */ + 337, /* FILE => ABORT */ 0, /* STABLE => nothing */ 0, /* COLUMN => nothing */ 0, /* MODIFY => nothing */ @@ -1721,7 +1953,7 @@ static const YYCODETYPE yyFallback[] = { 0, /* VNODES => nothing */ 0, /* ALIVE => nothing */ 0, /* VIEWS => nothing */ - 328, /* VIEW => ABORT */ + 337, /* VIEW => ABORT */ 0, /* COMPACTS => nothing */ 0, /* NORMAL => nothing */ 0, /* CHILD => nothing */ @@ -1764,7 +1996,7 @@ static const YYCODETYPE yyFallback[] = { 0, /* PAUSE => nothing */ 0, /* RESUME => nothing */ 0, /* PRIMARY => nothing */ - 328, /* KEY => ABORT */ + 337, /* KEY => ABORT */ 0, /* TRIGGER => nothing */ 0, /* AT_ONCE => nothing */ 0, /* WINDOW_CLOSE => nothing */ @@ -1804,7 +2036,7 @@ static const YYCODETYPE yyFallback[] = { 0, /* CAST => nothing */ 0, /* POSITION => nothing */ 0, /* IN => nothing */ - 336, /* FOR => ABORT */ + 337, /* FOR => ABORT */ 0, /* NOW => nothing */ 0, /* TODAY => nothing */ 0, /* SUBSTR => nothing */ @@ -1837,7 +2069,7 @@ static const YYCODETYPE yyFallback[] = { 0, /* LEFT => nothing */ 0, /* RIGHT => nothing */ 0, /* OUTER => nothing */ - 328, /* SEMI => ABORT */ + 337, /* SEMI => ABORT */ 0, /* ANTI => nothing */ 0, /* ASOF => nothing */ 0, /* WINDOW => nothing */ @@ -1873,52 +2105,51 @@ static const YYCODETYPE yyFallback[] = { 0, /* ASC => nothing */ 0, /* NULLS => nothing */ 0, /* ABORT => nothing */ - 328, /* AFTER => ABORT */ - 328, /* ATTACH => ABORT */ - 328, /* BEFORE => ABORT */ - 328, /* BEGIN => ABORT */ - 328, /* BITAND => ABORT */ - 328, /* BITNOT => ABORT */ - 328, /* BITOR => ABORT */ - 328, /* BLOCKS => ABORT */ - 328, /* CHANGE => ABORT */ - 328, /* COMMA => ABORT */ - 328, /* CONCAT => ABORT */ - 328, /* CONFLICT => ABORT */ - 328, /* COPY => ABORT */ - 328, /* DEFERRED => ABORT */ - 328, /* DELIMITERS => ABORT */ - 328, /* DETACH => ABORT */ - 328, /* DIVIDE => ABORT */ - 328, /* DOT => ABORT */ - 328, /* EACH => ABORT */ - 328, /* FAIL => ABORT */ - 328, /* FOR => ABORT */ - 328, /* GLOB => ABORT */ - 328, /* ID => ABORT */ - 328, /* IMMEDIATE => ABORT */ - 328, /* IMPORT => ABORT */ - 328, /* INITIALLY => ABORT */ - 328, /* INSTEAD => ABORT */ - 328, /* ISNULL => ABORT */ - 328, /* MODULES => ABORT */ - 328, /* NK_BITNOT => ABORT */ - 328, /* NK_SEMI => ABORT */ - 328, /* NOTNULL => ABORT */ - 328, /* OF => ABORT */ - 328, /* PLUS => ABORT */ - 328, /* PRIVILEGE => ABORT */ - 328, /* RAISE => ABORT */ - 328, /* RESTRICT => ABORT */ - 328, /* ROW => ABORT */ - 328, /* STAR => ABORT */ - 328, /* STATEMENT => ABORT */ - 328, /* STRICT => ABORT */ - 328, /* STRING => ABORT */ - 328, /* TIMES => ABORT */ - 328, /* VALUES => ABORT */ - 328, /* VARIABLE => ABORT */ - 328, /* WAL => ABORT */ + 337, /* AFTER => ABORT */ + 337, /* ATTACH => ABORT */ + 337, /* BEFORE => ABORT */ + 337, /* BEGIN => ABORT */ + 337, /* BITAND => ABORT */ + 337, /* BITNOT => ABORT */ + 337, /* BITOR => ABORT */ + 337, /* BLOCKS => ABORT */ + 337, /* CHANGE => ABORT */ + 337, /* COMMA => ABORT */ + 337, /* CONCAT => ABORT */ + 337, /* CONFLICT => ABORT */ + 337, /* COPY => ABORT */ + 337, /* DEFERRED => ABORT */ + 337, /* DELIMITERS => ABORT */ + 337, /* DETACH => ABORT */ + 337, /* DIVIDE => ABORT */ + 337, /* DOT => ABORT */ + 337, /* EACH => ABORT */ + 337, /* FAIL => ABORT */ + 337, /* GLOB => ABORT */ + 337, /* ID => ABORT */ + 337, /* IMMEDIATE => ABORT */ + 337, /* IMPORT => ABORT */ + 337, /* INITIALLY => ABORT */ + 337, /* INSTEAD => ABORT */ + 337, /* ISNULL => ABORT */ + 337, /* MODULES => ABORT */ + 337, /* NK_BITNOT => ABORT */ + 337, /* NK_SEMI => ABORT */ + 337, /* NOTNULL => ABORT */ + 337, /* OF => ABORT */ + 337, /* PLUS => ABORT */ + 337, /* PRIVILEGE => ABORT */ + 337, /* RAISE => ABORT */ + 337, /* RESTRICT => ABORT */ + 337, /* ROW => ABORT */ + 337, /* STAR => ABORT */ + 337, /* STATEMENT => ABORT */ + 337, /* STRICT => ABORT */ + 337, /* STRING => ABORT */ + 337, /* TIMES => ABORT */ + 337, /* VALUES => ABORT */ + 337, /* VARIABLE => ABORT */ + 337, /* WAL => ABORT */ 0, /* ENCODE => nothing */ 0, /* COMPRESS => nothing */ 0, /* LEVEL => nothing */ @@ -1961,10 +2192,15 @@ struct yyParser { int yyerrcnt; /* Shifts left before out of the error */ #endif ParseARG_SDECL /* A place to hold %extra_argument */ - ParseCTX_SDECL /* A place to hold %extra_context */ - yyStackEntry *yystackEnd; /* Last entry in the stack */ - yyStackEntry *yystack; /* The parser stack */ - yyStackEntry yystk0[YYSTACKDEPTH]; /* Initial stack space */ + ParseCTX_SDECL /* A place to hold %extra_context */ +#if YYSTACKDEPTH<=0 + int yystksz; /* Current side of the stack */ + yyStackEntry *yystack; /* The parser's stack */ + yyStackEntry yystk0; /* First stack entry */ +#else + yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */ + yyStackEntry *yystackEnd; /* Last entry in the stack */ +#endif }; typedef struct yyParser yyParser; @@ -1976,10 +2212,10 @@ static char *yyTracePrompt = 0; #endif /* NDEBUG */ #ifndef NDEBUG -/* +/* ** Turn parser tracing on by giving a stream to which to write the trace ** and a prompt to preface each trace message. Tracing is turned off -** by making either argument NULL +** by making either argument NULL ** ** Inputs: **
    @@ -2238,337 +2474,347 @@ static const char *const yyTokenName[] = { /* 230 */ "TRIGGER", /* 231 */ "AT_ONCE", /* 232 */ "WINDOW_CLOSE", - /* 233 */ "IGNORE", - /* 234 */ "EXPIRED", - /* 235 */ "FILL_HISTORY", - /* 236 */ "UPDATE", - /* 237 */ "SUBTABLE", - /* 238 */ "UNTREATED", - /* 239 */ "KILL", - /* 240 */ "CONNECTION", - /* 241 */ "TRANSACTION", - /* 242 */ "BALANCE", - /* 243 */ "VGROUP", - /* 244 */ "LEADER", - /* 245 */ "MERGE", - /* 246 */ "REDISTRIBUTE", - /* 247 */ "SPLIT", - /* 248 */ "DELETE", - /* 249 */ "INSERT", - /* 250 */ "NK_BIN", - /* 251 */ "NK_HEX", - /* 252 */ "NULL", - /* 253 */ "NK_QUESTION", - /* 254 */ "NK_ALIAS", - /* 255 */ "NK_ARROW", - /* 256 */ "ROWTS", - /* 257 */ "QSTART", - /* 258 */ "QEND", - /* 259 */ "QDURATION", - /* 260 */ "WSTART", - /* 261 */ "WEND", - /* 262 */ "WDURATION", - /* 263 */ "IROWTS", - /* 264 */ "ISFILLED", - /* 265 */ "CAST", - /* 266 */ "NOW", - /* 267 */ "TODAY", - /* 268 */ "TIMEZONE", - /* 269 */ "CLIENT_VERSION", - /* 270 */ "SERVER_VERSION", - /* 271 */ "SERVER_STATUS", - /* 272 */ "CURRENT_USER", - /* 273 */ "CASE", - /* 274 */ "WHEN", - /* 275 */ "THEN", - /* 276 */ "ELSE", - /* 277 */ "BETWEEN", - /* 278 */ "IS", - /* 279 */ "NK_LT", - /* 280 */ "NK_GT", - /* 281 */ "NK_LE", - /* 282 */ "NK_GE", - /* 283 */ "NK_NE", - /* 284 */ "MATCH", - /* 285 */ "NMATCH", - /* 286 */ "CONTAINS", - /* 287 */ "IN", - /* 288 */ "JOIN", - /* 289 */ "INNER", - /* 290 */ "LEFT", - /* 291 */ "RIGHT", - /* 292 */ "OUTER", - /* 293 */ "SEMI", - /* 294 */ "ANTI", - /* 295 */ "ASOF", - /* 296 */ "WINDOW", - /* 297 */ "WINDOW_OFFSET", - /* 298 */ "JLIMIT", - /* 299 */ "SELECT", - /* 300 */ "NK_HINT", - /* 301 */ "DISTINCT", - /* 302 */ "WHERE", - /* 303 */ "PARTITION", - /* 304 */ "BY", - /* 305 */ "SESSION", - /* 306 */ "STATE_WINDOW", - /* 307 */ "EVENT_WINDOW", - /* 308 */ "COUNT_WINDOW", - /* 309 */ "SLIDING", - /* 310 */ "FILL", - /* 311 */ "VALUE", - /* 312 */ "VALUE_F", - /* 313 */ "NONE", - /* 314 */ "PREV", - /* 315 */ "NULL_F", - /* 316 */ "LINEAR", - /* 317 */ "NEXT", - /* 318 */ "HAVING", - /* 319 */ "RANGE", - /* 320 */ "EVERY", - /* 321 */ "ORDER", - /* 322 */ "SLIMIT", - /* 323 */ "SOFFSET", - /* 324 */ "LIMIT", - /* 325 */ "OFFSET", - /* 326 */ "ASC", - /* 327 */ "NULLS", - /* 328 */ "ABORT", - /* 329 */ "AFTER", - /* 330 */ "ATTACH", - /* 331 */ "BEFORE", - /* 332 */ "BEGIN", - /* 333 */ "BITAND", - /* 334 */ "BITNOT", - /* 335 */ "BITOR", - /* 336 */ "BLOCKS", - /* 337 */ "CHANGE", - /* 338 */ "COMMA", - /* 339 */ "CONCAT", - /* 340 */ "CONFLICT", - /* 341 */ "COPY", - /* 342 */ "DEFERRED", - /* 343 */ "DELIMITERS", - /* 344 */ "DETACH", - /* 345 */ "DIVIDE", - /* 346 */ "DOT", - /* 347 */ "EACH", - /* 348 */ "FAIL", - /* 349 */ "FOR", - /* 350 */ "GLOB", - /* 351 */ "ID", - /* 352 */ "IMMEDIATE", - /* 353 */ "IMPORT", - /* 354 */ "INITIALLY", - /* 355 */ "INSTEAD", - /* 356 */ "ISNULL", - /* 357 */ "MODULES", - /* 358 */ "NK_BITNOT", - /* 359 */ "NK_SEMI", - /* 360 */ "NOTNULL", - /* 361 */ "OF", - /* 362 */ "PLUS", - /* 363 */ "PRIVILEGE", - /* 364 */ "RAISE", - /* 365 */ "RESTRICT", - /* 366 */ "ROW", - /* 367 */ "STAR", - /* 368 */ "STATEMENT", - /* 369 */ "STRICT", - /* 370 */ "STRING", - /* 371 */ "TIMES", - /* 372 */ "VALUES", - /* 373 */ "VARIABLE", - /* 374 */ "WAL", - /* 375 */ "ENCODE", - /* 376 */ "COMPRESS", - /* 377 */ "LEVEL", - /* 378 */ "cmd", - /* 379 */ "account_options", - /* 380 */ "alter_account_options", - /* 381 */ "literal", - /* 382 */ "alter_account_option", - /* 383 */ "ip_range_list", - /* 384 */ "white_list", - /* 385 */ "white_list_opt", - /* 386 */ "is_import_opt", - /* 387 */ "is_createdb_opt", - /* 388 */ "user_name", - /* 389 */ "sysinfo_opt", - /* 390 */ "privileges", - /* 391 */ "priv_level", - /* 392 */ "with_opt", - /* 393 */ "priv_type_list", - /* 394 */ "priv_type", - /* 395 */ "db_name", - /* 396 */ "table_name", - /* 397 */ "topic_name", - /* 398 */ "search_condition", - /* 399 */ "dnode_endpoint", - /* 400 */ "force_opt", - /* 401 */ "unsafe_opt", - /* 402 */ "not_exists_opt", - /* 403 */ "db_options", - /* 404 */ "exists_opt", - /* 405 */ "alter_db_options", - /* 406 */ "speed_opt", - /* 407 */ "start_opt", - /* 408 */ "end_opt", - /* 409 */ "integer_list", - /* 410 */ "variable_list", - /* 411 */ "retention_list", - /* 412 */ "signed", - /* 413 */ "alter_db_option", - /* 414 */ "retention", - /* 415 */ "full_table_name", - /* 416 */ "column_def_list", - /* 417 */ "tags_def_opt", - /* 418 */ "table_options", - /* 419 */ "multi_create_clause", - /* 420 */ "tag_list_opt", - /* 421 */ "tags_def", - /* 422 */ "multi_drop_clause", - /* 423 */ "alter_table_clause", - /* 424 */ "alter_table_options", - /* 425 */ "column_name", - /* 426 */ "type_name", - /* 427 */ "column_options", - /* 428 */ "tags_literal", - /* 429 */ "create_subtable_clause", - /* 430 */ "specific_cols_opt", - /* 431 */ "tags_literal_list", - /* 432 */ "drop_table_clause", - /* 433 */ "col_name_list", - /* 434 */ "tag_def_list", - /* 435 */ "tag_def", - /* 436 */ "column_def", - /* 437 */ "type_name_default_len", - /* 438 */ "duration_list", - /* 439 */ "rollup_func_list", - /* 440 */ "alter_table_option", - /* 441 */ "duration_literal", - /* 442 */ "rollup_func_name", - /* 443 */ "function_name", - /* 444 */ "col_name", - /* 445 */ "db_kind_opt", - /* 446 */ "table_kind_db_name_cond_opt", - /* 447 */ "like_pattern_opt", - /* 448 */ "db_name_cond_opt", - /* 449 */ "table_name_cond", - /* 450 */ "from_db_opt", - /* 451 */ "table_kind", - /* 452 */ "tag_item", - /* 453 */ "column_alias", - /* 454 */ "tsma_name", - /* 455 */ "tsma_func_list", - /* 456 */ "full_tsma_name", - /* 457 */ "func_list", - /* 458 */ "index_options", - /* 459 */ "full_index_name", - /* 460 */ "index_name", - /* 461 */ "sliding_opt", - /* 462 */ "sma_stream_opt", - /* 463 */ "func", - /* 464 */ "sma_func_name", - /* 465 */ "expression_list", - /* 466 */ "with_meta", - /* 467 */ "query_or_subquery", - /* 468 */ "where_clause_opt", - /* 469 */ "cgroup_name", - /* 470 */ "analyze_opt", - /* 471 */ "explain_options", - /* 472 */ "insert_query", - /* 473 */ "or_replace_opt", - /* 474 */ "agg_func_opt", - /* 475 */ "bufsize_opt", - /* 476 */ "language_opt", - /* 477 */ "full_view_name", - /* 478 */ "view_name", - /* 479 */ "stream_name", - /* 480 */ "stream_options", - /* 481 */ "col_list_opt", - /* 482 */ "tag_def_or_ref_opt", - /* 483 */ "subtable_opt", - /* 484 */ "ignore_opt", - /* 485 */ "column_stream_def_list", - /* 486 */ "column_stream_def", - /* 487 */ "stream_col_options", - /* 488 */ "expression", - /* 489 */ "on_vgroup_id", - /* 490 */ "dnode_list", - /* 491 */ "literal_func", - /* 492 */ "signed_literal", - /* 493 */ "literal_list", - /* 494 */ "table_alias", - /* 495 */ "expr_or_subquery", - /* 496 */ "pseudo_column", - /* 497 */ "column_reference", - /* 498 */ "function_expression", - /* 499 */ "case_when_expression", - /* 500 */ "star_func", - /* 501 */ "star_func_para_list", - /* 502 */ "noarg_func", - /* 503 */ "other_para_list", - /* 504 */ "star_func_para", - /* 505 */ "when_then_list", - /* 506 */ "case_when_else_opt", - /* 507 */ "common_expression", - /* 508 */ "when_then_expr", - /* 509 */ "predicate", - /* 510 */ "compare_op", - /* 511 */ "in_op", - /* 512 */ "in_predicate_value", - /* 513 */ "boolean_value_expression", - /* 514 */ "boolean_primary", - /* 515 */ "from_clause_opt", - /* 516 */ "table_reference_list", - /* 517 */ "table_reference", - /* 518 */ "table_primary", - /* 519 */ "joined_table", - /* 520 */ "alias_opt", - /* 521 */ "subquery", - /* 522 */ "parenthesized_joined_table", - /* 523 */ "join_type", - /* 524 */ "join_subtype", - /* 525 */ "join_on_clause_opt", - /* 526 */ "window_offset_clause_opt", - /* 527 */ "jlimit_clause_opt", - /* 528 */ "window_offset_literal", - /* 529 */ "query_specification", - /* 530 */ "hint_list", - /* 531 */ "set_quantifier_opt", - /* 532 */ "tag_mode_opt", - /* 533 */ "select_list", - /* 534 */ "partition_by_clause_opt", - /* 535 */ "range_opt", - /* 536 */ "every_opt", - /* 537 */ "fill_opt", - /* 538 */ "twindow_clause_opt", - /* 539 */ "group_by_clause_opt", - /* 540 */ "having_clause_opt", - /* 541 */ "select_item", - /* 542 */ "partition_list", - /* 543 */ "partition_item", - /* 544 */ "interval_sliding_duration_literal", - /* 545 */ "fill_mode", - /* 546 */ "group_by_list", - /* 547 */ "query_expression", - /* 548 */ "query_simple", - /* 549 */ "order_by_clause_opt", - /* 550 */ "slimit_clause_opt", - /* 551 */ "limit_clause_opt", - /* 552 */ "union_query_expression", - /* 553 */ "query_simple_or_subquery", - /* 554 */ "sort_specification_list", - /* 555 */ "sort_specification", - /* 556 */ "ordering_specification_opt", - /* 557 */ "null_ordering_opt", + /* 233 */ "FORCE_WINDOW_CLOSE", + /* 234 */ "IGNORE", + /* 235 */ "EXPIRED", + /* 236 */ "FILL_HISTORY", + /* 237 */ "UPDATE", + /* 238 */ "SUBTABLE", + /* 239 */ "UNTREATED", + /* 240 */ "KILL", + /* 241 */ "CONNECTION", + /* 242 */ "TRANSACTION", + /* 243 */ "BALANCE", + /* 244 */ "VGROUP", + /* 245 */ "LEADER", + /* 246 */ "MERGE", + /* 247 */ "REDISTRIBUTE", + /* 248 */ "SPLIT", + /* 249 */ "DELETE", + /* 250 */ "INSERT", + /* 251 */ "NK_BIN", + /* 252 */ "NK_HEX", + /* 253 */ "NULL", + /* 254 */ "NK_QUESTION", + /* 255 */ "NK_ALIAS", + /* 256 */ "NK_ARROW", + /* 257 */ "ROWTS", + /* 258 */ "QSTART", + /* 259 */ "QEND", + /* 260 */ "QDURATION", + /* 261 */ "WSTART", + /* 262 */ "WEND", + /* 263 */ "WDURATION", + /* 264 */ "IROWTS", + /* 265 */ "ISFILLED", + /* 266 */ "CAST", + /* 267 */ "POSITION", + /* 268 */ "IN", + /* 269 */ "FOR", + /* 270 */ "NOW", + /* 271 */ "TODAY", + /* 272 */ "SUBSTR", + /* 273 */ "SUBSTRING", + /* 274 */ "BOTH", + /* 275 */ "TRAILING", + /* 276 */ "LEADING", + /* 277 */ "TIMEZONE", + /* 278 */ "CLIENT_VERSION", + /* 279 */ "SERVER_VERSION", + /* 280 */ "SERVER_STATUS", + /* 281 */ "CURRENT_USER", + /* 282 */ "PI", + /* 283 */ "CASE", + /* 284 */ "WHEN", + /* 285 */ "THEN", + /* 286 */ "ELSE", + /* 287 */ "BETWEEN", + /* 288 */ "IS", + /* 289 */ "NK_LT", + /* 290 */ "NK_GT", + /* 291 */ "NK_LE", + /* 292 */ "NK_GE", + /* 293 */ "NK_NE", + /* 294 */ "MATCH", + /* 295 */ "NMATCH", + /* 296 */ "CONTAINS", + /* 297 */ "JOIN", + /* 298 */ "INNER", + /* 299 */ "LEFT", + /* 300 */ "RIGHT", + /* 301 */ "OUTER", + /* 302 */ "SEMI", + /* 303 */ "ANTI", + /* 304 */ "ASOF", + /* 305 */ "WINDOW", + /* 306 */ "WINDOW_OFFSET", + /* 307 */ "JLIMIT", + /* 308 */ "SELECT", + /* 309 */ "NK_HINT", + /* 310 */ "DISTINCT", + /* 311 */ "WHERE", + /* 312 */ "PARTITION", + /* 313 */ "BY", + /* 314 */ "SESSION", + /* 315 */ "STATE_WINDOW", + /* 316 */ "EVENT_WINDOW", + /* 317 */ "COUNT_WINDOW", + /* 318 */ "SLIDING", + /* 319 */ "FILL", + /* 320 */ "VALUE", + /* 321 */ "VALUE_F", + /* 322 */ "NONE", + /* 323 */ "PREV", + /* 324 */ "NULL_F", + /* 325 */ "LINEAR", + /* 326 */ "NEXT", + /* 327 */ "HAVING", + /* 328 */ "RANGE", + /* 329 */ "EVERY", + /* 330 */ "ORDER", + /* 331 */ "SLIMIT", + /* 332 */ "SOFFSET", + /* 333 */ "LIMIT", + /* 334 */ "OFFSET", + /* 335 */ "ASC", + /* 336 */ "NULLS", + /* 337 */ "ABORT", + /* 338 */ "AFTER", + /* 339 */ "ATTACH", + /* 340 */ "BEFORE", + /* 341 */ "BEGIN", + /* 342 */ "BITAND", + /* 343 */ "BITNOT", + /* 344 */ "BITOR", + /* 345 */ "BLOCKS", + /* 346 */ "CHANGE", + /* 347 */ "COMMA", + /* 348 */ "CONCAT", + /* 349 */ "CONFLICT", + /* 350 */ "COPY", + /* 351 */ "DEFERRED", + /* 352 */ "DELIMITERS", + /* 353 */ "DETACH", + /* 354 */ "DIVIDE", + /* 355 */ "DOT", + /* 356 */ "EACH", + /* 357 */ "FAIL", + /* 358 */ "GLOB", + /* 359 */ "ID", + /* 360 */ "IMMEDIATE", + /* 361 */ "IMPORT", + /* 362 */ "INITIALLY", + /* 363 */ "INSTEAD", + /* 364 */ "ISNULL", + /* 365 */ "MODULES", + /* 366 */ "NK_BITNOT", + /* 367 */ "NK_SEMI", + /* 368 */ "NOTNULL", + /* 369 */ "OF", + /* 370 */ "PLUS", + /* 371 */ "PRIVILEGE", + /* 372 */ "RAISE", + /* 373 */ "RESTRICT", + /* 374 */ "ROW", + /* 375 */ "STAR", + /* 376 */ "STATEMENT", + /* 377 */ "STRICT", + /* 378 */ "STRING", + /* 379 */ "TIMES", + /* 380 */ "VALUES", + /* 381 */ "VARIABLE", + /* 382 */ "WAL", + /* 383 */ "ENCODE", + /* 384 */ "COMPRESS", + /* 385 */ "LEVEL", + /* 386 */ "cmd", + /* 387 */ "account_options", + /* 388 */ "alter_account_options", + /* 389 */ "literal", + /* 390 */ "alter_account_option", + /* 391 */ "ip_range_list", + /* 392 */ "white_list", + /* 393 */ "white_list_opt", + /* 394 */ "is_import_opt", + /* 395 */ "is_createdb_opt", + /* 396 */ "user_name", + /* 397 */ "sysinfo_opt", + /* 398 */ "privileges", + /* 399 */ "priv_level", + /* 400 */ "with_opt", + /* 401 */ "priv_type_list", + /* 402 */ "priv_type", + /* 403 */ "db_name", + /* 404 */ "table_name", + /* 405 */ "topic_name", + /* 406 */ "search_condition", + /* 407 */ "dnode_endpoint", + /* 408 */ "force_opt", + /* 409 */ "unsafe_opt", + /* 410 */ "not_exists_opt", + /* 411 */ "db_options", + /* 412 */ "exists_opt", + /* 413 */ "alter_db_options", + /* 414 */ "speed_opt", + /* 415 */ "start_opt", + /* 416 */ "end_opt", + /* 417 */ "integer_list", + /* 418 */ "variable_list", + /* 419 */ "retention_list", + /* 420 */ "signed", + /* 421 */ "alter_db_option", + /* 422 */ "retention", + /* 423 */ "full_table_name", + /* 424 */ "column_def_list", + /* 425 */ "tags_def_opt", + /* 426 */ "table_options", + /* 427 */ "multi_create_clause", + /* 428 */ "tag_list_opt", + /* 429 */ "tags_def", + /* 430 */ "multi_drop_clause", + /* 431 */ "alter_table_clause", + /* 432 */ "alter_table_options", + /* 433 */ "column_name", + /* 434 */ "type_name", + /* 435 */ "column_options", + /* 436 */ "tags_literal", + /* 437 */ "create_subtable_clause", + /* 438 */ "specific_cols_opt", + /* 439 */ "tags_literal_list", + /* 440 */ "drop_table_clause", + /* 441 */ "col_name_list", + /* 442 */ "tag_def_list", + /* 443 */ "tag_def", + /* 444 */ "column_def", + /* 445 */ "type_name_default_len", + /* 446 */ "duration_list", + /* 447 */ "rollup_func_list", + /* 448 */ "alter_table_option", + /* 449 */ "duration_literal", + /* 450 */ "rollup_func_name", + /* 451 */ "function_name", + /* 452 */ "col_name", + /* 453 */ "db_kind_opt", + /* 454 */ "table_kind_db_name_cond_opt", + /* 455 */ "like_pattern_opt", + /* 456 */ "db_name_cond_opt", + /* 457 */ "table_name_cond", + /* 458 */ "from_db_opt", + /* 459 */ "table_kind", + /* 460 */ "tag_item", + /* 461 */ "column_alias", + /* 462 */ "tsma_name", + /* 463 */ "tsma_func_list", + /* 464 */ "full_tsma_name", + /* 465 */ "func_list", + /* 466 */ "index_options", + /* 467 */ "full_index_name", + /* 468 */ "index_name", + /* 469 */ "sliding_opt", + /* 470 */ "sma_stream_opt", + /* 471 */ "func", + /* 472 */ "sma_func_name", + /* 473 */ "expression_list", + /* 474 */ "with_meta", + /* 475 */ "query_or_subquery", + /* 476 */ "where_clause_opt", + /* 477 */ "cgroup_name", + /* 478 */ "analyze_opt", + /* 479 */ "explain_options", + /* 480 */ "insert_query", + /* 481 */ "or_replace_opt", + /* 482 */ "agg_func_opt", + /* 483 */ "bufsize_opt", + /* 484 */ "language_opt", + /* 485 */ "full_view_name", + /* 486 */ "view_name", + /* 487 */ "stream_name", + /* 488 */ "stream_options", + /* 489 */ "col_list_opt", + /* 490 */ "tag_def_or_ref_opt", + /* 491 */ "subtable_opt", + /* 492 */ "ignore_opt", + /* 493 */ "column_stream_def_list", + /* 494 */ "column_stream_def", + /* 495 */ "stream_col_options", + /* 496 */ "expression", + /* 497 */ "on_vgroup_id", + /* 498 */ "dnode_list", + /* 499 */ "literal_func", + /* 500 */ "signed_literal", + /* 501 */ "literal_list", + /* 502 */ "table_alias", + /* 503 */ "expr_or_subquery", + /* 504 */ "pseudo_column", + /* 505 */ "column_reference", + /* 506 */ "function_expression", + /* 507 */ "case_when_expression", + /* 508 */ "star_func", + /* 509 */ "star_func_para_list", + /* 510 */ "trim_specification_type", + /* 511 */ "substr_func", + /* 512 */ "noarg_func", + /* 513 */ "other_para_list", + /* 514 */ "star_func_para", + /* 515 */ "when_then_list", + /* 516 */ "case_when_else_opt", + /* 517 */ "common_expression", + /* 518 */ "when_then_expr", + /* 519 */ "predicate", + /* 520 */ "compare_op", + /* 521 */ "in_op", + /* 522 */ "in_predicate_value", + /* 523 */ "boolean_value_expression", + /* 524 */ "boolean_primary", + /* 525 */ "from_clause_opt", + /* 526 */ "table_reference_list", + /* 527 */ "table_reference", + /* 528 */ "table_primary", + /* 529 */ "joined_table", + /* 530 */ "alias_opt", + /* 531 */ "subquery", + /* 532 */ "parenthesized_joined_table", + /* 533 */ "join_type", + /* 534 */ "join_subtype", + /* 535 */ "join_on_clause_opt", + /* 536 */ "window_offset_clause_opt", + /* 537 */ "jlimit_clause_opt", + /* 538 */ "window_offset_literal", + /* 539 */ "query_specification", + /* 540 */ "hint_list", + /* 541 */ "set_quantifier_opt", + /* 542 */ "tag_mode_opt", + /* 543 */ "select_list", + /* 544 */ "partition_by_clause_opt", + /* 545 */ "range_opt", + /* 546 */ "every_opt", + /* 547 */ "fill_opt", + /* 548 */ "twindow_clause_opt", + /* 549 */ "group_by_clause_opt", + /* 550 */ "having_clause_opt", + /* 551 */ "select_item", + /* 552 */ "partition_list", + /* 553 */ "partition_item", + /* 554 */ "interval_sliding_duration_literal", + /* 555 */ "fill_mode", + /* 556 */ "group_by_list", + /* 557 */ "query_expression", + /* 558 */ "query_simple", + /* 559 */ "order_by_clause_opt", + /* 560 */ "slimit_clause_opt", + /* 561 */ "limit_clause_opt", + /* 562 */ "union_query_expression", + /* 563 */ "query_simple_or_subquery", + /* 564 */ "sort_specification_list", + /* 565 */ "sort_specification", + /* 566 */ "ordering_specification_opt", + /* 567 */ "null_ordering_opt", }; #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ #ifndef NDEBUG /* For tracing reduce actions, the names of all rules are required. - */ +*/ static const char *const yyRuleName[] = { /* 0 */ "cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options", /* 1 */ "cmd ::= ALTER ACCOUNT NK_ID alter_account_options", @@ -2991,383 +3237,391 @@ static const char *const yyRuleName[] = { /* 418 */ "stream_options ::=", /* 419 */ "stream_options ::= stream_options TRIGGER AT_ONCE", /* 420 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE", - /* 421 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal", - /* 422 */ "stream_options ::= stream_options WATERMARK duration_literal", - /* 423 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER", - /* 424 */ "stream_options ::= stream_options FILL_HISTORY NK_INTEGER", - /* 425 */ "stream_options ::= stream_options DELETE_MARK duration_literal", - /* 426 */ "stream_options ::= stream_options IGNORE UPDATE NK_INTEGER", - /* 427 */ "subtable_opt ::=", - /* 428 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP", - /* 429 */ "ignore_opt ::=", - /* 430 */ "ignore_opt ::= IGNORE UNTREATED", - /* 431 */ "cmd ::= KILL CONNECTION NK_INTEGER", - /* 432 */ "cmd ::= KILL QUERY NK_STRING", - /* 433 */ "cmd ::= KILL TRANSACTION NK_INTEGER", - /* 434 */ "cmd ::= KILL COMPACT NK_INTEGER", - /* 435 */ "cmd ::= BALANCE VGROUP", - /* 436 */ "cmd ::= BALANCE VGROUP LEADER on_vgroup_id", - /* 437 */ "cmd ::= BALANCE VGROUP LEADER DATABASE db_name", - /* 438 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", - /* 439 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", - /* 440 */ "cmd ::= SPLIT VGROUP NK_INTEGER", - /* 441 */ "on_vgroup_id ::=", - /* 442 */ "on_vgroup_id ::= ON NK_INTEGER", - /* 443 */ "dnode_list ::= DNODE NK_INTEGER", - /* 444 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", - /* 445 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", - /* 446 */ "cmd ::= query_or_subquery", - /* 447 */ "cmd ::= insert_query", - /* 448 */ "insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery", - /* 449 */ "insert_query ::= INSERT INTO full_table_name query_or_subquery", - /* 450 */ "tags_literal ::= NK_INTEGER", - /* 451 */ "tags_literal ::= NK_INTEGER NK_PLUS duration_literal", - /* 452 */ "tags_literal ::= NK_INTEGER NK_MINUS duration_literal", - /* 453 */ "tags_literal ::= NK_PLUS NK_INTEGER", - /* 454 */ "tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal", - /* 455 */ "tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal", - /* 456 */ "tags_literal ::= NK_MINUS NK_INTEGER", - /* 457 */ "tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal", - /* 458 */ "tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal", - /* 459 */ "tags_literal ::= NK_FLOAT", - /* 460 */ "tags_literal ::= NK_PLUS NK_FLOAT", - /* 461 */ "tags_literal ::= NK_MINUS NK_FLOAT", - /* 462 */ "tags_literal ::= NK_BIN", - /* 463 */ "tags_literal ::= NK_BIN NK_PLUS duration_literal", - /* 464 */ "tags_literal ::= NK_BIN NK_MINUS duration_literal", - /* 465 */ "tags_literal ::= NK_PLUS NK_BIN", - /* 466 */ "tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal", - /* 467 */ "tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal", - /* 468 */ "tags_literal ::= NK_MINUS NK_BIN", - /* 469 */ "tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal", - /* 470 */ "tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal", - /* 471 */ "tags_literal ::= NK_HEX", - /* 472 */ "tags_literal ::= NK_HEX NK_PLUS duration_literal", - /* 473 */ "tags_literal ::= NK_HEX NK_MINUS duration_literal", - /* 474 */ "tags_literal ::= NK_PLUS NK_HEX", - /* 475 */ "tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal", - /* 476 */ "tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal", - /* 477 */ "tags_literal ::= NK_MINUS NK_HEX", - /* 478 */ "tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal", - /* 479 */ "tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal", - /* 480 */ "tags_literal ::= NK_STRING", - /* 481 */ "tags_literal ::= NK_STRING NK_PLUS duration_literal", - /* 482 */ "tags_literal ::= NK_STRING NK_MINUS duration_literal", - /* 483 */ "tags_literal ::= NK_BOOL", - /* 484 */ "tags_literal ::= NULL", - /* 485 */ "tags_literal ::= literal_func", - /* 486 */ "tags_literal ::= literal_func NK_PLUS duration_literal", - /* 487 */ "tags_literal ::= literal_func NK_MINUS duration_literal", - /* 488 */ "tags_literal_list ::= tags_literal", - /* 489 */ "tags_literal_list ::= tags_literal_list NK_COMMA tags_literal", - /* 490 */ "literal ::= NK_INTEGER", - /* 491 */ "literal ::= NK_FLOAT", - /* 492 */ "literal ::= NK_STRING", - /* 493 */ "literal ::= NK_BOOL", - /* 494 */ "literal ::= TIMESTAMP NK_STRING", - /* 495 */ "literal ::= duration_literal", - /* 496 */ "literal ::= NULL", - /* 497 */ "literal ::= NK_QUESTION", - /* 498 */ "duration_literal ::= NK_VARIABLE", - /* 499 */ "signed ::= NK_INTEGER", - /* 500 */ "signed ::= NK_PLUS NK_INTEGER", - /* 501 */ "signed ::= NK_MINUS NK_INTEGER", - /* 502 */ "signed ::= NK_FLOAT", - /* 503 */ "signed ::= NK_PLUS NK_FLOAT", - /* 504 */ "signed ::= NK_MINUS NK_FLOAT", - /* 505 */ "signed_literal ::= signed", - /* 506 */ "signed_literal ::= NK_STRING", - /* 507 */ "signed_literal ::= NK_BOOL", - /* 508 */ "signed_literal ::= TIMESTAMP NK_STRING", - /* 509 */ "signed_literal ::= duration_literal", - /* 510 */ "signed_literal ::= NULL", - /* 511 */ "signed_literal ::= literal_func", - /* 512 */ "signed_literal ::= NK_QUESTION", - /* 513 */ "literal_list ::= signed_literal", - /* 514 */ "literal_list ::= literal_list NK_COMMA signed_literal", - /* 515 */ "db_name ::= NK_ID", - /* 516 */ "table_name ::= NK_ID", - /* 517 */ "column_name ::= NK_ID", - /* 518 */ "function_name ::= NK_ID", - /* 519 */ "view_name ::= NK_ID", - /* 520 */ "table_alias ::= NK_ID", - /* 521 */ "column_alias ::= NK_ID", - /* 522 */ "column_alias ::= NK_ALIAS", - /* 523 */ "user_name ::= NK_ID", - /* 524 */ "topic_name ::= NK_ID", - /* 525 */ "stream_name ::= NK_ID", - /* 526 */ "cgroup_name ::= NK_ID", - /* 527 */ "index_name ::= NK_ID", - /* 528 */ "tsma_name ::= NK_ID", - /* 529 */ "expr_or_subquery ::= expression", - /* 530 */ "expression ::= literal", - /* 531 */ "expression ::= pseudo_column", - /* 532 */ "expression ::= column_reference", - /* 533 */ "expression ::= function_expression", - /* 534 */ "expression ::= case_when_expression", - /* 535 */ "expression ::= NK_LP expression NK_RP", - /* 536 */ "expression ::= NK_PLUS expr_or_subquery", - /* 537 */ "expression ::= NK_MINUS expr_or_subquery", - /* 538 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery", - /* 539 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery", - /* 540 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery", - /* 541 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery", - /* 542 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery", - /* 543 */ "expression ::= column_reference NK_ARROW NK_STRING", - /* 544 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery", - /* 545 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery", - /* 546 */ "expression_list ::= expr_or_subquery", - /* 547 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery", - /* 548 */ "column_reference ::= column_name", - /* 549 */ "column_reference ::= table_name NK_DOT column_name", - /* 550 */ "column_reference ::= NK_ALIAS", - /* 551 */ "column_reference ::= table_name NK_DOT NK_ALIAS", - /* 552 */ "pseudo_column ::= ROWTS", - /* 553 */ "pseudo_column ::= TBNAME", - /* 554 */ "pseudo_column ::= table_name NK_DOT TBNAME", - /* 555 */ "pseudo_column ::= QSTART", - /* 556 */ "pseudo_column ::= QEND", - /* 557 */ "pseudo_column ::= QDURATION", - /* 558 */ "pseudo_column ::= WSTART", - /* 559 */ "pseudo_column ::= WEND", - /* 560 */ "pseudo_column ::= WDURATION", - /* 561 */ "pseudo_column ::= IROWTS", - /* 562 */ "pseudo_column ::= ISFILLED", - /* 563 */ "pseudo_column ::= QTAGS", - /* 564 */ "function_expression ::= function_name NK_LP expression_list NK_RP", - /* 565 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", - /* 566 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP", - /* 567 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP", - /* 568 */ "function_expression ::= literal_func", - /* 569 */ "literal_func ::= noarg_func NK_LP NK_RP", - /* 570 */ "literal_func ::= NOW", - /* 571 */ "literal_func ::= TODAY", - /* 572 */ "noarg_func ::= NOW", - /* 573 */ "noarg_func ::= TODAY", - /* 574 */ "noarg_func ::= TIMEZONE", - /* 575 */ "noarg_func ::= DATABASE", - /* 576 */ "noarg_func ::= CLIENT_VERSION", - /* 577 */ "noarg_func ::= SERVER_VERSION", - /* 578 */ "noarg_func ::= SERVER_STATUS", - /* 579 */ "noarg_func ::= CURRENT_USER", - /* 580 */ "noarg_func ::= USER", - /* 581 */ "star_func ::= COUNT", - /* 582 */ "star_func ::= FIRST", - /* 583 */ "star_func ::= LAST", - /* 584 */ "star_func ::= LAST_ROW", - /* 585 */ "star_func_para_list ::= NK_STAR", - /* 586 */ "star_func_para_list ::= other_para_list", - /* 587 */ "other_para_list ::= star_func_para", - /* 588 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", - /* 589 */ "star_func_para ::= expr_or_subquery", - /* 590 */ "star_func_para ::= table_name NK_DOT NK_STAR", - /* 591 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END", - /* 592 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END", - /* 593 */ "when_then_list ::= when_then_expr", - /* 594 */ "when_then_list ::= when_then_list when_then_expr", - /* 595 */ "when_then_expr ::= WHEN common_expression THEN common_expression", - /* 596 */ "case_when_else_opt ::=", - /* 597 */ "case_when_else_opt ::= ELSE common_expression", - /* 598 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery", - /* 599 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery", - /* 600 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery", - /* 601 */ "predicate ::= expr_or_subquery IS NULL", - /* 602 */ "predicate ::= expr_or_subquery IS NOT NULL", - /* 603 */ "predicate ::= expr_or_subquery in_op in_predicate_value", - /* 604 */ "compare_op ::= NK_LT", - /* 605 */ "compare_op ::= NK_GT", - /* 606 */ "compare_op ::= NK_LE", - /* 607 */ "compare_op ::= NK_GE", - /* 608 */ "compare_op ::= NK_NE", - /* 609 */ "compare_op ::= NK_EQ", - /* 610 */ "compare_op ::= LIKE", - /* 611 */ "compare_op ::= NOT LIKE", - /* 612 */ "compare_op ::= MATCH", - /* 613 */ "compare_op ::= NMATCH", - /* 614 */ "compare_op ::= CONTAINS", - /* 615 */ "in_op ::= IN", - /* 616 */ "in_op ::= NOT IN", - /* 617 */ "in_predicate_value ::= NK_LP literal_list NK_RP", - /* 618 */ "boolean_value_expression ::= boolean_primary", - /* 619 */ "boolean_value_expression ::= NOT boolean_primary", - /* 620 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", - /* 621 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", - /* 622 */ "boolean_primary ::= predicate", - /* 623 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", - /* 624 */ "common_expression ::= expr_or_subquery", - /* 625 */ "common_expression ::= boolean_value_expression", - /* 626 */ "from_clause_opt ::=", - /* 627 */ "from_clause_opt ::= FROM table_reference_list", - /* 628 */ "table_reference_list ::= table_reference", - /* 629 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", - /* 630 */ "table_reference ::= table_primary", - /* 631 */ "table_reference ::= joined_table", - /* 632 */ "table_primary ::= table_name alias_opt", - /* 633 */ "table_primary ::= db_name NK_DOT table_name alias_opt", - /* 634 */ "table_primary ::= subquery alias_opt", - /* 635 */ "table_primary ::= parenthesized_joined_table", - /* 636 */ "alias_opt ::=", - /* 637 */ "alias_opt ::= table_alias", - /* 638 */ "alias_opt ::= AS table_alias", - /* 639 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", - /* 640 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", - /* 641 */ "joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt", - /* 642 */ "join_type ::=", - /* 643 */ "join_type ::= INNER", - /* 644 */ "join_type ::= LEFT", - /* 645 */ "join_type ::= RIGHT", - /* 646 */ "join_type ::= FULL", - /* 647 */ "join_subtype ::=", - /* 648 */ "join_subtype ::= OUTER", - /* 649 */ "join_subtype ::= SEMI", - /* 650 */ "join_subtype ::= ANTI", - /* 651 */ "join_subtype ::= ASOF", - /* 652 */ "join_subtype ::= WINDOW", - /* 653 */ "join_on_clause_opt ::=", - /* 654 */ "join_on_clause_opt ::= ON search_condition", - /* 655 */ "window_offset_clause_opt ::=", - /* 656 */ "window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP", - /* 657 */ "window_offset_literal ::= NK_VARIABLE", - /* 658 */ "window_offset_literal ::= NK_MINUS NK_VARIABLE", - /* 659 */ "jlimit_clause_opt ::=", - /* 660 */ "jlimit_clause_opt ::= JLIMIT NK_INTEGER", - /* 661 */ "query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_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", - /* 662 */ "hint_list ::=", - /* 663 */ "hint_list ::= NK_HINT", - /* 664 */ "tag_mode_opt ::=", - /* 665 */ "tag_mode_opt ::= TAGS", - /* 666 */ "set_quantifier_opt ::=", - /* 667 */ "set_quantifier_opt ::= DISTINCT", - /* 668 */ "set_quantifier_opt ::= ALL", - /* 669 */ "select_list ::= select_item", - /* 670 */ "select_list ::= select_list NK_COMMA select_item", - /* 671 */ "select_item ::= NK_STAR", - /* 672 */ "select_item ::= common_expression", - /* 673 */ "select_item ::= common_expression column_alias", - /* 674 */ "select_item ::= common_expression AS column_alias", - /* 675 */ "select_item ::= table_name NK_DOT NK_STAR", - /* 676 */ "where_clause_opt ::=", - /* 677 */ "where_clause_opt ::= WHERE search_condition", - /* 678 */ "partition_by_clause_opt ::=", - /* 679 */ "partition_by_clause_opt ::= PARTITION BY partition_list", - /* 680 */ "partition_list ::= partition_item", - /* 681 */ "partition_list ::= partition_list NK_COMMA partition_item", - /* 682 */ "partition_item ::= expr_or_subquery", - /* 683 */ "partition_item ::= expr_or_subquery column_alias", - /* 684 */ "partition_item ::= expr_or_subquery AS column_alias", - /* 685 */ "twindow_clause_opt ::=", - /* 686 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP", - /* 687 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP", - /* 688 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt", - /* 689 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt", - /* 690 */ "twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition", - /* 691 */ "twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP", - /* 692 */ "twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", - /* 693 */ "sliding_opt ::=", - /* 694 */ "sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP", - /* 695 */ "interval_sliding_duration_literal ::= NK_VARIABLE", - /* 696 */ "interval_sliding_duration_literal ::= NK_STRING", - /* 697 */ "interval_sliding_duration_literal ::= NK_INTEGER", - /* 698 */ "fill_opt ::=", - /* 699 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", - /* 700 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP", - /* 701 */ "fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP", - /* 702 */ "fill_mode ::= NONE", - /* 703 */ "fill_mode ::= PREV", - /* 704 */ "fill_mode ::= NULL", - /* 705 */ "fill_mode ::= NULL_F", - /* 706 */ "fill_mode ::= LINEAR", - /* 707 */ "fill_mode ::= NEXT", - /* 708 */ "group_by_clause_opt ::=", - /* 709 */ "group_by_clause_opt ::= GROUP BY group_by_list", - /* 710 */ "group_by_list ::= expr_or_subquery", - /* 711 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery", - /* 712 */ "having_clause_opt ::=", - /* 713 */ "having_clause_opt ::= HAVING search_condition", - /* 714 */ "range_opt ::=", - /* 715 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP", - /* 716 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_RP", - /* 717 */ "every_opt ::=", - /* 718 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", - /* 719 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt", - /* 720 */ "query_simple ::= query_specification", - /* 721 */ "query_simple ::= union_query_expression", - /* 722 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery", - /* 723 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery", - /* 724 */ "query_simple_or_subquery ::= query_simple", - /* 725 */ "query_simple_or_subquery ::= subquery", - /* 726 */ "query_or_subquery ::= query_expression", - /* 727 */ "query_or_subquery ::= subquery", - /* 728 */ "order_by_clause_opt ::=", - /* 729 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", - /* 730 */ "slimit_clause_opt ::=", - /* 731 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", - /* 732 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", - /* 733 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 734 */ "limit_clause_opt ::=", - /* 735 */ "limit_clause_opt ::= LIMIT NK_INTEGER", - /* 736 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", - /* 737 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 738 */ "subquery ::= NK_LP query_expression NK_RP", - /* 739 */ "subquery ::= NK_LP subquery NK_RP", - /* 740 */ "search_condition ::= common_expression", - /* 741 */ "sort_specification_list ::= sort_specification", - /* 742 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", - /* 743 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt", - /* 744 */ "ordering_specification_opt ::=", - /* 745 */ "ordering_specification_opt ::= ASC", - /* 746 */ "ordering_specification_opt ::= DESC", - /* 747 */ "null_ordering_opt ::=", - /* 748 */ "null_ordering_opt ::= NULLS FIRST", - /* 749 */ "null_ordering_opt ::= NULLS LAST", - /* 750 */ "column_options ::=", - /* 751 */ "column_options ::= column_options PRIMARY KEY", - /* 752 */ "column_options ::= column_options ENCODE NK_STRING", - /* 753 */ "column_options ::= column_options COMPRESS NK_STRING", - /* 754 */ "column_options ::= column_options LEVEL NK_STRING", + /* 421 */ "stream_options ::= stream_options TRIGGER FORCE_WINDOW_CLOSE", + /* 422 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal", + /* 423 */ "stream_options ::= stream_options WATERMARK duration_literal", + /* 424 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER", + /* 425 */ "stream_options ::= stream_options FILL_HISTORY NK_INTEGER", + /* 426 */ "stream_options ::= stream_options DELETE_MARK duration_literal", + /* 427 */ "stream_options ::= stream_options IGNORE UPDATE NK_INTEGER", + /* 428 */ "subtable_opt ::=", + /* 429 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP", + /* 430 */ "ignore_opt ::=", + /* 431 */ "ignore_opt ::= IGNORE UNTREATED", + /* 432 */ "cmd ::= KILL CONNECTION NK_INTEGER", + /* 433 */ "cmd ::= KILL QUERY NK_STRING", + /* 434 */ "cmd ::= KILL TRANSACTION NK_INTEGER", + /* 435 */ "cmd ::= KILL COMPACT NK_INTEGER", + /* 436 */ "cmd ::= BALANCE VGROUP", + /* 437 */ "cmd ::= BALANCE VGROUP LEADER on_vgroup_id", + /* 438 */ "cmd ::= BALANCE VGROUP LEADER DATABASE db_name", + /* 439 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", + /* 440 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", + /* 441 */ "cmd ::= SPLIT VGROUP NK_INTEGER", + /* 442 */ "on_vgroup_id ::=", + /* 443 */ "on_vgroup_id ::= ON NK_INTEGER", + /* 444 */ "dnode_list ::= DNODE NK_INTEGER", + /* 445 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", + /* 446 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", + /* 447 */ "cmd ::= query_or_subquery", + /* 448 */ "cmd ::= insert_query", + /* 449 */ "insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery", + /* 450 */ "insert_query ::= INSERT INTO full_table_name query_or_subquery", + /* 451 */ "tags_literal ::= NK_INTEGER", + /* 452 */ "tags_literal ::= NK_INTEGER NK_PLUS duration_literal", + /* 453 */ "tags_literal ::= NK_INTEGER NK_MINUS duration_literal", + /* 454 */ "tags_literal ::= NK_PLUS NK_INTEGER", + /* 455 */ "tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal", + /* 456 */ "tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal", + /* 457 */ "tags_literal ::= NK_MINUS NK_INTEGER", + /* 458 */ "tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal", + /* 459 */ "tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal", + /* 460 */ "tags_literal ::= NK_FLOAT", + /* 461 */ "tags_literal ::= NK_PLUS NK_FLOAT", + /* 462 */ "tags_literal ::= NK_MINUS NK_FLOAT", + /* 463 */ "tags_literal ::= NK_BIN", + /* 464 */ "tags_literal ::= NK_BIN NK_PLUS duration_literal", + /* 465 */ "tags_literal ::= NK_BIN NK_MINUS duration_literal", + /* 466 */ "tags_literal ::= NK_PLUS NK_BIN", + /* 467 */ "tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal", + /* 468 */ "tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal", + /* 469 */ "tags_literal ::= NK_MINUS NK_BIN", + /* 470 */ "tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal", + /* 471 */ "tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal", + /* 472 */ "tags_literal ::= NK_HEX", + /* 473 */ "tags_literal ::= NK_HEX NK_PLUS duration_literal", + /* 474 */ "tags_literal ::= NK_HEX NK_MINUS duration_literal", + /* 475 */ "tags_literal ::= NK_PLUS NK_HEX", + /* 476 */ "tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal", + /* 477 */ "tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal", + /* 478 */ "tags_literal ::= NK_MINUS NK_HEX", + /* 479 */ "tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal", + /* 480 */ "tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal", + /* 481 */ "tags_literal ::= NK_STRING", + /* 482 */ "tags_literal ::= NK_STRING NK_PLUS duration_literal", + /* 483 */ "tags_literal ::= NK_STRING NK_MINUS duration_literal", + /* 484 */ "tags_literal ::= NK_BOOL", + /* 485 */ "tags_literal ::= NULL", + /* 486 */ "tags_literal ::= literal_func", + /* 487 */ "tags_literal ::= literal_func NK_PLUS duration_literal", + /* 488 */ "tags_literal ::= literal_func NK_MINUS duration_literal", + /* 489 */ "tags_literal_list ::= tags_literal", + /* 490 */ "tags_literal_list ::= tags_literal_list NK_COMMA tags_literal", + /* 491 */ "literal ::= NK_INTEGER", + /* 492 */ "literal ::= NK_FLOAT", + /* 493 */ "literal ::= NK_STRING", + /* 494 */ "literal ::= NK_BOOL", + /* 495 */ "literal ::= TIMESTAMP NK_STRING", + /* 496 */ "literal ::= duration_literal", + /* 497 */ "literal ::= NULL", + /* 498 */ "literal ::= NK_QUESTION", + /* 499 */ "duration_literal ::= NK_VARIABLE", + /* 500 */ "signed ::= NK_INTEGER", + /* 501 */ "signed ::= NK_PLUS NK_INTEGER", + /* 502 */ "signed ::= NK_MINUS NK_INTEGER", + /* 503 */ "signed ::= NK_FLOAT", + /* 504 */ "signed ::= NK_PLUS NK_FLOAT", + /* 505 */ "signed ::= NK_MINUS NK_FLOAT", + /* 506 */ "signed_literal ::= signed", + /* 507 */ "signed_literal ::= NK_STRING", + /* 508 */ "signed_literal ::= NK_BOOL", + /* 509 */ "signed_literal ::= TIMESTAMP NK_STRING", + /* 510 */ "signed_literal ::= duration_literal", + /* 511 */ "signed_literal ::= NULL", + /* 512 */ "signed_literal ::= literal_func", + /* 513 */ "signed_literal ::= NK_QUESTION", + /* 514 */ "literal_list ::= signed_literal", + /* 515 */ "literal_list ::= literal_list NK_COMMA signed_literal", + /* 516 */ "db_name ::= NK_ID", + /* 517 */ "table_name ::= NK_ID", + /* 518 */ "column_name ::= NK_ID", + /* 519 */ "function_name ::= NK_ID", + /* 520 */ "view_name ::= NK_ID", + /* 521 */ "table_alias ::= NK_ID", + /* 522 */ "column_alias ::= NK_ID", + /* 523 */ "column_alias ::= NK_ALIAS", + /* 524 */ "user_name ::= NK_ID", + /* 525 */ "topic_name ::= NK_ID", + /* 526 */ "stream_name ::= NK_ID", + /* 527 */ "cgroup_name ::= NK_ID", + /* 528 */ "index_name ::= NK_ID", + /* 529 */ "tsma_name ::= NK_ID", + /* 530 */ "expr_or_subquery ::= expression", + /* 531 */ "expression ::= literal", + /* 532 */ "expression ::= pseudo_column", + /* 533 */ "expression ::= column_reference", + /* 534 */ "expression ::= function_expression", + /* 535 */ "expression ::= case_when_expression", + /* 536 */ "expression ::= NK_LP expression NK_RP", + /* 537 */ "expression ::= NK_PLUS expr_or_subquery", + /* 538 */ "expression ::= NK_MINUS expr_or_subquery", + /* 539 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery", + /* 540 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery", + /* 541 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery", + /* 542 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery", + /* 543 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery", + /* 544 */ "expression ::= column_reference NK_ARROW NK_STRING", + /* 545 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery", + /* 546 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery", + /* 547 */ "expression_list ::= expr_or_subquery", + /* 548 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery", + /* 549 */ "column_reference ::= column_name", + /* 550 */ "column_reference ::= table_name NK_DOT column_name", + /* 551 */ "column_reference ::= NK_ALIAS", + /* 552 */ "column_reference ::= table_name NK_DOT NK_ALIAS", + /* 553 */ "pseudo_column ::= ROWTS", + /* 554 */ "pseudo_column ::= TBNAME", + /* 555 */ "pseudo_column ::= table_name NK_DOT TBNAME", + /* 556 */ "pseudo_column ::= QSTART", + /* 557 */ "pseudo_column ::= QEND", + /* 558 */ "pseudo_column ::= QDURATION", + /* 559 */ "pseudo_column ::= WSTART", + /* 560 */ "pseudo_column ::= WEND", + /* 561 */ "pseudo_column ::= WDURATION", + /* 562 */ "pseudo_column ::= IROWTS", + /* 563 */ "pseudo_column ::= ISFILLED", + /* 564 */ "pseudo_column ::= QTAGS", + /* 565 */ "function_expression ::= function_name NK_LP expression_list NK_RP", + /* 566 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", + /* 567 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP", + /* 568 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP", + /* 569 */ "function_expression ::= POSITION NK_LP expr_or_subquery IN expr_or_subquery NK_RP", + /* 570 */ "function_expression ::= TRIM NK_LP expr_or_subquery NK_RP", + /* 571 */ "function_expression ::= TRIM NK_LP trim_specification_type FROM expr_or_subquery NK_RP", + /* 572 */ "function_expression ::= TRIM NK_LP trim_specification_type expr_or_subquery FROM expr_or_subquery NK_RP", + /* 573 */ "function_expression ::= substr_func NK_LP expression_list NK_RP", + /* 574 */ "function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery NK_RP", + /* 575 */ "function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery FOR expr_or_subquery NK_RP", + /* 576 */ "function_expression ::= REPLACE NK_LP expression_list NK_RP", + /* 577 */ "function_expression ::= literal_func", + /* 578 */ "literal_func ::= noarg_func NK_LP NK_RP", + /* 579 */ "literal_func ::= NOW", + /* 580 */ "literal_func ::= TODAY", + /* 581 */ "substr_func ::= SUBSTR", + /* 582 */ "substr_func ::= SUBSTRING", + /* 583 */ "trim_specification_type ::=", + /* 584 */ "trim_specification_type ::= BOTH", + /* 585 */ "trim_specification_type ::= TRAILING", + /* 586 */ "trim_specification_type ::= LEADING", + /* 587 */ "noarg_func ::= NOW", + /* 588 */ "noarg_func ::= TODAY", + /* 589 */ "noarg_func ::= TIMEZONE", + /* 590 */ "noarg_func ::= DATABASE", + /* 591 */ "noarg_func ::= CLIENT_VERSION", + /* 592 */ "noarg_func ::= SERVER_VERSION", + /* 593 */ "noarg_func ::= SERVER_STATUS", + /* 594 */ "noarg_func ::= CURRENT_USER", + /* 595 */ "noarg_func ::= USER", + /* 596 */ "noarg_func ::= PI", + /* 597 */ "star_func ::= COUNT", + /* 598 */ "star_func ::= FIRST", + /* 599 */ "star_func ::= LAST", + /* 600 */ "star_func ::= LAST_ROW", + /* 601 */ "star_func_para_list ::= NK_STAR", + /* 602 */ "star_func_para_list ::= other_para_list", + /* 603 */ "other_para_list ::= star_func_para", + /* 604 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", + /* 605 */ "star_func_para ::= expr_or_subquery", + /* 606 */ "star_func_para ::= table_name NK_DOT NK_STAR", + /* 607 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END", + /* 608 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END", + /* 609 */ "when_then_list ::= when_then_expr", + /* 610 */ "when_then_list ::= when_then_list when_then_expr", + /* 611 */ "when_then_expr ::= WHEN common_expression THEN common_expression", + /* 612 */ "case_when_else_opt ::=", + /* 613 */ "case_when_else_opt ::= ELSE common_expression", + /* 614 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery", + /* 615 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery", + /* 616 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery", + /* 617 */ "predicate ::= expr_or_subquery IS NULL", + /* 618 */ "predicate ::= expr_or_subquery IS NOT NULL", + /* 619 */ "predicate ::= expr_or_subquery in_op in_predicate_value", + /* 620 */ "compare_op ::= NK_LT", + /* 621 */ "compare_op ::= NK_GT", + /* 622 */ "compare_op ::= NK_LE", + /* 623 */ "compare_op ::= NK_GE", + /* 624 */ "compare_op ::= NK_NE", + /* 625 */ "compare_op ::= NK_EQ", + /* 626 */ "compare_op ::= LIKE", + /* 627 */ "compare_op ::= NOT LIKE", + /* 628 */ "compare_op ::= MATCH", + /* 629 */ "compare_op ::= NMATCH", + /* 630 */ "compare_op ::= CONTAINS", + /* 631 */ "in_op ::= IN", + /* 632 */ "in_op ::= NOT IN", + /* 633 */ "in_predicate_value ::= NK_LP literal_list NK_RP", + /* 634 */ "boolean_value_expression ::= boolean_primary", + /* 635 */ "boolean_value_expression ::= NOT boolean_primary", + /* 636 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", + /* 637 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", + /* 638 */ "boolean_primary ::= predicate", + /* 639 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", + /* 640 */ "common_expression ::= expr_or_subquery", + /* 641 */ "common_expression ::= boolean_value_expression", + /* 642 */ "from_clause_opt ::=", + /* 643 */ "from_clause_opt ::= FROM table_reference_list", + /* 644 */ "table_reference_list ::= table_reference", + /* 645 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", + /* 646 */ "table_reference ::= table_primary", + /* 647 */ "table_reference ::= joined_table", + /* 648 */ "table_primary ::= table_name alias_opt", + /* 649 */ "table_primary ::= db_name NK_DOT table_name alias_opt", + /* 650 */ "table_primary ::= subquery alias_opt", + /* 651 */ "table_primary ::= parenthesized_joined_table", + /* 652 */ "alias_opt ::=", + /* 653 */ "alias_opt ::= table_alias", + /* 654 */ "alias_opt ::= AS table_alias", + /* 655 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", + /* 656 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", + /* 657 */ "joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt", + /* 658 */ "join_type ::=", + /* 659 */ "join_type ::= INNER", + /* 660 */ "join_type ::= LEFT", + /* 661 */ "join_type ::= RIGHT", + /* 662 */ "join_type ::= FULL", + /* 663 */ "join_subtype ::=", + /* 664 */ "join_subtype ::= OUTER", + /* 665 */ "join_subtype ::= SEMI", + /* 666 */ "join_subtype ::= ANTI", + /* 667 */ "join_subtype ::= ASOF", + /* 668 */ "join_subtype ::= WINDOW", + /* 669 */ "join_on_clause_opt ::=", + /* 670 */ "join_on_clause_opt ::= ON search_condition", + /* 671 */ "window_offset_clause_opt ::=", + /* 672 */ "window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP", + /* 673 */ "window_offset_literal ::= NK_VARIABLE", + /* 674 */ "window_offset_literal ::= NK_MINUS NK_VARIABLE", + /* 675 */ "jlimit_clause_opt ::=", + /* 676 */ "jlimit_clause_opt ::= JLIMIT NK_INTEGER", + /* 677 */ "query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_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", + /* 678 */ "hint_list ::=", + /* 679 */ "hint_list ::= NK_HINT", + /* 680 */ "tag_mode_opt ::=", + /* 681 */ "tag_mode_opt ::= TAGS", + /* 682 */ "set_quantifier_opt ::=", + /* 683 */ "set_quantifier_opt ::= DISTINCT", + /* 684 */ "set_quantifier_opt ::= ALL", + /* 685 */ "select_list ::= select_item", + /* 686 */ "select_list ::= select_list NK_COMMA select_item", + /* 687 */ "select_item ::= NK_STAR", + /* 688 */ "select_item ::= common_expression", + /* 689 */ "select_item ::= common_expression column_alias", + /* 690 */ "select_item ::= common_expression AS column_alias", + /* 691 */ "select_item ::= table_name NK_DOT NK_STAR", + /* 692 */ "where_clause_opt ::=", + /* 693 */ "where_clause_opt ::= WHERE search_condition", + /* 694 */ "partition_by_clause_opt ::=", + /* 695 */ "partition_by_clause_opt ::= PARTITION BY partition_list", + /* 696 */ "partition_list ::= partition_item", + /* 697 */ "partition_list ::= partition_list NK_COMMA partition_item", + /* 698 */ "partition_item ::= expr_or_subquery", + /* 699 */ "partition_item ::= expr_or_subquery column_alias", + /* 700 */ "partition_item ::= expr_or_subquery AS column_alias", + /* 701 */ "twindow_clause_opt ::=", + /* 702 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP", + /* 703 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP", + /* 704 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt", + /* 705 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt", + /* 706 */ "twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition", + /* 707 */ "twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP", + /* 708 */ "twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", + /* 709 */ "sliding_opt ::=", + /* 710 */ "sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP", + /* 711 */ "interval_sliding_duration_literal ::= NK_VARIABLE", + /* 712 */ "interval_sliding_duration_literal ::= NK_STRING", + /* 713 */ "interval_sliding_duration_literal ::= NK_INTEGER", + /* 714 */ "fill_opt ::=", + /* 715 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", + /* 716 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP", + /* 717 */ "fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP", + /* 718 */ "fill_mode ::= NONE", + /* 719 */ "fill_mode ::= PREV", + /* 720 */ "fill_mode ::= NULL", + /* 721 */ "fill_mode ::= NULL_F", + /* 722 */ "fill_mode ::= LINEAR", + /* 723 */ "fill_mode ::= NEXT", + /* 724 */ "group_by_clause_opt ::=", + /* 725 */ "group_by_clause_opt ::= GROUP BY group_by_list", + /* 726 */ "group_by_list ::= expr_or_subquery", + /* 727 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery", + /* 728 */ "having_clause_opt ::=", + /* 729 */ "having_clause_opt ::= HAVING search_condition", + /* 730 */ "range_opt ::=", + /* 731 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP", + /* 732 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_RP", + /* 733 */ "every_opt ::=", + /* 734 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", + /* 735 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt", + /* 736 */ "query_simple ::= query_specification", + /* 737 */ "query_simple ::= union_query_expression", + /* 738 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery", + /* 739 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery", + /* 740 */ "query_simple_or_subquery ::= query_simple", + /* 741 */ "query_simple_or_subquery ::= subquery", + /* 742 */ "query_or_subquery ::= query_expression", + /* 743 */ "query_or_subquery ::= subquery", + /* 744 */ "order_by_clause_opt ::=", + /* 745 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", + /* 746 */ "slimit_clause_opt ::=", + /* 747 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", + /* 748 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", + /* 749 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 750 */ "limit_clause_opt ::=", + /* 751 */ "limit_clause_opt ::= LIMIT NK_INTEGER", + /* 752 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", + /* 753 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 754 */ "subquery ::= NK_LP query_expression NK_RP", + /* 755 */ "subquery ::= NK_LP subquery NK_RP", + /* 756 */ "search_condition ::= common_expression", + /* 757 */ "sort_specification_list ::= sort_specification", + /* 758 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", + /* 759 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt", + /* 760 */ "ordering_specification_opt ::=", + /* 761 */ "ordering_specification_opt ::= ASC", + /* 762 */ "ordering_specification_opt ::= DESC", + /* 763 */ "null_ordering_opt ::=", + /* 764 */ "null_ordering_opt ::= NULLS FIRST", + /* 765 */ "null_ordering_opt ::= NULLS LAST", + /* 766 */ "column_options ::=", + /* 767 */ "column_options ::= column_options PRIMARY KEY", + /* 768 */ "column_options ::= column_options ENCODE NK_STRING", + /* 769 */ "column_options ::= column_options COMPRESS NK_STRING", + /* 770 */ "column_options ::= column_options LEVEL NK_STRING", }; #endif /* NDEBUG */ -#if YYGROWABLESTACK +#if YYSTACKDEPTH<=0 /* ** Try to increase the size of the parser stack. Return the number ** of errors. Return 0 on success. */ static int yyGrowStack(yyParser *p){ - int oldSize = 1 + (int)(p->yystackEnd - p->yystack); int newSize; int idx; yyStackEntry *pNew; - newSize = oldSize*2 + 100; - idx = (int)(p->yytos - p->yystack); - if( p->yystack==p->yystk0 ){ - pNew = YYREALLOC(0, newSize*sizeof(pNew[0])); - if( pNew==0 ) return 1; - memcpy(pNew, p->yystack, oldSize*sizeof(pNew[0])); + newSize = p->yystksz*2 + 100; + idx = p->yytos ? (int)(p->yytos - p->yystack) : 0; + if( p->yystack==&p->yystk0 ){ + pNew = malloc(newSize*sizeof(pNew[0])); + if( pNew ) pNew[0] = p->yystk0; }else{ - pNew = YYREALLOC(p->yystack, newSize*sizeof(pNew[0])); - if( pNew==0 ) return 1; + pNew = realloc(p->yystack, newSize*sizeof(pNew[0])); } - p->yystack = pNew; - p->yytos = &p->yystack[idx]; + if( pNew ){ + p->yystack = pNew; + p->yytos = &p->yystack[idx]; #ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sStack grows from %d to %d entries.\n", - yyTracePrompt, oldSize, newSize); - } + if( yyTraceFILE ){ + fprintf(yyTraceFILE,"%sStack grows from %d to %d entries.\n", + yyTracePrompt, p->yystksz, newSize); + } #endif - p->yystackEnd = &p->yystack[newSize-1]; - return 0; + p->yystksz = newSize; + } + return pNew==0; } -#endif /* YYGROWABLESTACK */ - -#if !YYGROWABLESTACK -/* For builds that do no have a growable stack, yyGrowStack always -** returns an error. -*/ -# define yyGrowStack(X) 1 #endif /* Datatype of the argument to the memory allocated passed as the @@ -3380,25 +3634,35 @@ static int yyGrowStack(yyParser *p){ #endif /* Initialize a new parser that has already been allocated. - */ +*/ void ParseInit(void *yypRawParser ParseCTX_PDECL){ yyParser *yypParser = (yyParser*)yypRawParser; ParseCTX_STORE #ifdef YYTRACKMAXSTACKDEPTH - yypParser->yyhwm = 0; + yypParser->yyhwm = 0; +#endif +#if YYSTACKDEPTH<=0 + yypParser->yytos = NULL; + yypParser->yystack = NULL; + yypParser->yystksz = 0; + if( yyGrowStack(yypParser) ){ + yypParser->yystack = &yypParser->yystk0; + yypParser->yystksz = 1; + } #endif - yypParser->yystack = yypParser->yystk0; - yypParser->yystackEnd = &yypParser->yystack[YYSTACKDEPTH-1]; #ifndef YYNOERRORRECOVERY yypParser->yyerrcnt = -1; #endif yypParser->yytos = yypParser->yystack; yypParser->yystack[0].stateno = 0; yypParser->yystack[0].major = 0; +#if YYSTACKDEPTH>0 + yypParser->yystackEnd = &yypParser->yystack[YYSTACKDEPTH-1]; +#endif } #ifndef Parse_ENGINEALWAYSONSTACK -/* +/* ** This function allocates a new parser. ** The only argument is a pointer to a function which works like ** malloc. @@ -3425,322 +3689,290 @@ void *ParseAlloc(void *(*mallocProc)(YYMALLOCARGTYPE) ParseCTX_PDECL){ /* The following function deletes the "minor type" or semantic value ** associated with a symbol. The symbol can be either a terminal ** or nonterminal. "yymajor" is the symbol code, and "yypminor" is -** a pointer to the value to be deleted. The code used to do the +** a pointer to the value to be deleted. The code used to do the ** deletions is derived from the %destructor and/or %token_destructor ** directives of the input grammar. */ static void yy_destructor( - yyParser *yypParser, /* The parser */ - YYCODETYPE yymajor, /* Type code for object to destroy */ - YYMINORTYPE *yypminor /* The object to be destroyed */ + yyParser *yypParser, /* The parser */ + YYCODETYPE yymajor, /* Type code for object to destroy */ + YYMINORTYPE *yypminor /* The object to be destroyed */ ){ ParseARG_FETCH - ParseCTX_FETCH - switch( yymajor ){ - /* Here is inserted the actions which take place when a + ParseCTX_FETCH + switch( yymajor ){ + /* Here is inserted the actions which take place when a ** terminal or non-terminal is destroyed. This can happen ** when the symbol is popped from the stack during a - ** reduce or during error processing or when a parser is + ** reduce or during error processing or when a parser is ** being destroyed before it is finished parsing. ** ** Note: during a reduce, the only symbols destroyed are those ** which appear on the RHS of the rule, but which are *not* used ** inside the C code. - */ - /********* Begin destructor definitions ***************************************/ + */ +/********* Begin destructor definitions ***************************************/ /* Default NON-TERMINAL Destructor */ - case 378: /* cmd */ - case 381: /* literal */ - case 392: /* with_opt */ - case 398: /* search_condition */ - case 403: /* db_options */ - case 405: /* alter_db_options */ - case 407: /* start_opt */ - case 408: /* end_opt */ - case 412: /* signed */ - case 414: /* retention */ - case 415: /* full_table_name */ - case 418: /* table_options */ - case 423: /* alter_table_clause */ - case 424: /* alter_table_options */ - case 427: /* column_options */ - case 428: /* tags_literal */ - case 429: /* create_subtable_clause */ - case 432: /* drop_table_clause */ - case 435: /* tag_def */ - case 436: /* column_def */ - case 441: /* duration_literal */ - case 442: /* rollup_func_name */ - case 444: /* col_name */ - case 447: /* like_pattern_opt */ - case 448: /* db_name_cond_opt */ - case 449: /* table_name_cond */ - case 450: /* from_db_opt */ - case 452: /* tag_item */ - case 456: /* full_tsma_name */ - case 458: /* index_options */ - case 459: /* full_index_name */ - case 461: /* sliding_opt */ - case 462: /* sma_stream_opt */ - case 463: /* func */ - case 467: /* query_or_subquery */ - case 468: /* where_clause_opt */ - case 471: /* explain_options */ - case 472: /* insert_query */ - case 477: /* full_view_name */ - case 480: /* stream_options */ - case 483: /* subtable_opt */ - case 486: /* column_stream_def */ - case 487: /* stream_col_options */ - case 488: /* expression */ - case 491: /* literal_func */ - case 492: /* signed_literal */ - case 495: /* expr_or_subquery */ - case 496: /* pseudo_column */ - case 497: /* column_reference */ - case 498: /* function_expression */ - case 499: /* case_when_expression */ - case 504: /* star_func_para */ - case 506: /* case_when_else_opt */ - case 507: /* common_expression */ - case 508: /* when_then_expr */ - case 509: /* predicate */ - case 512: /* in_predicate_value */ - case 513: /* boolean_value_expression */ - case 514: /* boolean_primary */ - case 515: /* from_clause_opt */ - case 516: /* table_reference_list */ - case 517: /* table_reference */ - case 518: /* table_primary */ - case 519: /* joined_table */ - case 521: /* subquery */ - case 522: /* parenthesized_joined_table */ - case 525: /* join_on_clause_opt */ - case 526: /* window_offset_clause_opt */ - case 527: /* jlimit_clause_opt */ - case 528: /* window_offset_literal */ - case 529: /* query_specification */ - case 535: /* range_opt */ - case 536: /* every_opt */ - case 537: /* fill_opt */ - case 538: /* twindow_clause_opt */ - case 540: /* having_clause_opt */ - case 541: /* select_item */ - case 543: /* partition_item */ - case 544: /* interval_sliding_duration_literal */ - case 547: /* query_expression */ - case 548: /* query_simple */ - case 550: /* slimit_clause_opt */ - case 551: /* limit_clause_opt */ - case 552: /* union_query_expression */ - case 553: /* query_simple_or_subquery */ - case 555: /* sort_specification */ + case 386: /* cmd */ + case 389: /* literal */ + case 400: /* with_opt */ + case 406: /* search_condition */ + case 411: /* db_options */ + case 413: /* alter_db_options */ + case 415: /* start_opt */ + case 416: /* end_opt */ + case 420: /* signed */ + case 422: /* retention */ + case 423: /* full_table_name */ + case 426: /* table_options */ + case 431: /* alter_table_clause */ + case 432: /* alter_table_options */ + case 435: /* column_options */ + case 436: /* tags_literal */ + case 437: /* create_subtable_clause */ + case 440: /* drop_table_clause */ + case 443: /* tag_def */ + case 444: /* column_def */ + case 449: /* duration_literal */ + case 450: /* rollup_func_name */ + case 452: /* col_name */ + case 455: /* like_pattern_opt */ + case 456: /* db_name_cond_opt */ + case 457: /* table_name_cond */ + case 458: /* from_db_opt */ + case 460: /* tag_item */ + case 464: /* full_tsma_name */ + case 466: /* index_options */ + case 467: /* full_index_name */ + case 469: /* sliding_opt */ + case 470: /* sma_stream_opt */ + case 471: /* func */ + case 475: /* query_or_subquery */ + case 476: /* where_clause_opt */ + case 479: /* explain_options */ + case 480: /* insert_query */ + case 485: /* full_view_name */ + case 488: /* stream_options */ + case 491: /* subtable_opt */ + case 494: /* column_stream_def */ + case 495: /* stream_col_options */ + case 496: /* expression */ + case 499: /* literal_func */ + case 500: /* signed_literal */ + case 503: /* expr_or_subquery */ + case 504: /* pseudo_column */ + case 505: /* column_reference */ + case 506: /* function_expression */ + case 507: /* case_when_expression */ + case 514: /* star_func_para */ + case 516: /* case_when_else_opt */ + case 517: /* common_expression */ + case 518: /* when_then_expr */ + case 519: /* predicate */ + case 522: /* in_predicate_value */ + case 523: /* boolean_value_expression */ + case 524: /* boolean_primary */ + case 525: /* from_clause_opt */ + case 526: /* table_reference_list */ + case 527: /* table_reference */ + case 528: /* table_primary */ + case 529: /* joined_table */ + case 531: /* subquery */ + case 532: /* parenthesized_joined_table */ + case 535: /* join_on_clause_opt */ + case 536: /* window_offset_clause_opt */ + case 537: /* jlimit_clause_opt */ + case 538: /* window_offset_literal */ + case 539: /* query_specification */ + case 545: /* range_opt */ + case 546: /* every_opt */ + case 547: /* fill_opt */ + case 548: /* twindow_clause_opt */ + case 550: /* having_clause_opt */ + case 551: /* select_item */ + case 553: /* partition_item */ + case 554: /* interval_sliding_duration_literal */ + case 557: /* query_expression */ + case 558: /* query_simple */ + case 560: /* slimit_clause_opt */ + case 561: /* limit_clause_opt */ + case 562: /* union_query_expression */ + case 563: /* query_simple_or_subquery */ + case 565: /* sort_specification */ { -#line 7 "sql.y" - nodesDestroyNode((yypminor->yy416)); -#line 3517 "sql.c" + nodesDestroyNode((yypminor->yy840)); } break; - case 379: /* account_options */ - case 380: /* alter_account_options */ - case 382: /* alter_account_option */ - case 406: /* speed_opt */ - case 466: /* with_meta */ - case 475: /* bufsize_opt */ + case 387: /* account_options */ + case 388: /* alter_account_options */ + case 390: /* alter_account_option */ + case 414: /* speed_opt */ + case 474: /* with_meta */ + case 483: /* bufsize_opt */ { -#line 54 "sql.y" -#line 3529 "sql.c" } break; - case 383: /* ip_range_list */ - case 384: /* white_list */ - case 385: /* white_list_opt */ - case 409: /* integer_list */ - case 410: /* variable_list */ - case 411: /* retention_list */ - case 416: /* column_def_list */ - case 417: /* tags_def_opt */ - case 419: /* multi_create_clause */ - case 420: /* tag_list_opt */ - case 421: /* tags_def */ - case 422: /* multi_drop_clause */ - case 430: /* specific_cols_opt */ - case 431: /* tags_literal_list */ - case 433: /* col_name_list */ - case 434: /* tag_def_list */ - case 438: /* duration_list */ - case 439: /* rollup_func_list */ - case 457: /* func_list */ - case 465: /* expression_list */ - case 481: /* col_list_opt */ - case 482: /* tag_def_or_ref_opt */ - case 485: /* column_stream_def_list */ - case 490: /* dnode_list */ - case 493: /* literal_list */ - case 501: /* star_func_para_list */ - case 503: /* other_para_list */ - case 505: /* when_then_list */ - case 530: /* hint_list */ - case 533: /* select_list */ - case 534: /* partition_by_clause_opt */ - case 539: /* group_by_clause_opt */ - case 542: /* partition_list */ - case 546: /* group_by_list */ - case 549: /* order_by_clause_opt */ - case 554: /* sort_specification_list */ + case 391: /* ip_range_list */ + case 392: /* white_list */ + case 393: /* white_list_opt */ + case 417: /* integer_list */ + case 418: /* variable_list */ + case 419: /* retention_list */ + case 424: /* column_def_list */ + case 425: /* tags_def_opt */ + case 427: /* multi_create_clause */ + case 428: /* tag_list_opt */ + case 429: /* tags_def */ + case 430: /* multi_drop_clause */ + case 438: /* specific_cols_opt */ + case 439: /* tags_literal_list */ + case 441: /* col_name_list */ + case 442: /* tag_def_list */ + case 446: /* duration_list */ + case 447: /* rollup_func_list */ + case 465: /* func_list */ + case 473: /* expression_list */ + case 489: /* col_list_opt */ + case 490: /* tag_def_or_ref_opt */ + case 493: /* column_stream_def_list */ + case 498: /* dnode_list */ + case 501: /* literal_list */ + case 509: /* star_func_para_list */ + case 513: /* other_para_list */ + case 515: /* when_then_list */ + case 540: /* hint_list */ + case 543: /* select_list */ + case 544: /* partition_by_clause_opt */ + case 549: /* group_by_clause_opt */ + case 552: /* partition_list */ + case 556: /* group_by_list */ + case 559: /* order_by_clause_opt */ + case 564: /* sort_specification_list */ { -#line 85 "sql.y" - nodesDestroyList((yypminor->yy316)); -#line 3571 "sql.c" + nodesDestroyList((yypminor->yy456)); } break; - case 386: /* is_import_opt */ - case 387: /* is_createdb_opt */ - case 389: /* sysinfo_opt */ + case 394: /* is_import_opt */ + case 395: /* is_createdb_opt */ + case 397: /* sysinfo_opt */ { -#line 99 "sql.y" -#line 3580 "sql.c" } break; - case 388: /* user_name */ - case 395: /* db_name */ - case 396: /* table_name */ - case 397: /* topic_name */ - case 399: /* dnode_endpoint */ - case 425: /* column_name */ - case 443: /* function_name */ - case 453: /* column_alias */ - case 454: /* tsma_name */ - case 460: /* index_name */ - case 464: /* sma_func_name */ - case 469: /* cgroup_name */ - case 476: /* language_opt */ - case 478: /* view_name */ - case 479: /* stream_name */ - case 489: /* on_vgroup_id */ - case 494: /* table_alias */ - case 500: /* star_func */ - case 502: /* noarg_func */ - case 520: /* alias_opt */ + case 396: /* user_name */ + case 403: /* db_name */ + case 404: /* table_name */ + case 405: /* topic_name */ + case 407: /* dnode_endpoint */ + case 433: /* column_name */ + case 451: /* function_name */ + case 461: /* column_alias */ + case 462: /* tsma_name */ + case 468: /* index_name */ + case 472: /* sma_func_name */ + case 477: /* cgroup_name */ + case 484: /* language_opt */ + case 486: /* view_name */ + case 487: /* stream_name */ + case 497: /* on_vgroup_id */ + case 502: /* table_alias */ + case 508: /* star_func */ + case 511: /* substr_func */ + case 512: /* noarg_func */ + case 530: /* alias_opt */ { -#line 1082 "sql.y" -#line 3606 "sql.c" } break; - case 390: /* privileges */ - case 393: /* priv_type_list */ - case 394: /* priv_type */ + case 398: /* privileges */ + case 401: /* priv_type_list */ + case 402: /* priv_type */ { -#line 131 "sql.y" -#line 3615 "sql.c" } break; - case 391: /* priv_level */ + case 399: /* priv_level */ { -#line 148 "sql.y" -#line 3622 "sql.c" } break; - case 400: /* force_opt */ - case 401: /* unsafe_opt */ - case 402: /* not_exists_opt */ - case 404: /* exists_opt */ - case 470: /* analyze_opt */ - case 473: /* or_replace_opt */ - case 474: /* agg_func_opt */ - case 484: /* ignore_opt */ - case 531: /* set_quantifier_opt */ - case 532: /* tag_mode_opt */ + case 408: /* force_opt */ + case 409: /* unsafe_opt */ + case 410: /* not_exists_opt */ + case 412: /* exists_opt */ + case 478: /* analyze_opt */ + case 481: /* or_replace_opt */ + case 482: /* agg_func_opt */ + case 492: /* ignore_opt */ + case 541: /* set_quantifier_opt */ + case 542: /* tag_mode_opt */ { -#line 180 "sql.y" -#line 3638 "sql.c" } break; - case 413: /* alter_db_option */ - case 440: /* alter_table_option */ + case 421: /* alter_db_option */ + case 448: /* alter_table_option */ { -#line 288 "sql.y" -#line 3646 "sql.c" } break; - case 426: /* type_name */ - case 437: /* type_name_default_len */ + case 434: /* type_name */ + case 445: /* type_name_default_len */ { -#line 425 "sql.y" -#line 3654 "sql.c" } break; - case 445: /* db_kind_opt */ - case 451: /* table_kind */ + case 453: /* db_kind_opt */ + case 459: /* table_kind */ { -#line 604 "sql.y" -#line 3662 "sql.c" } break; - case 446: /* table_kind_db_name_cond_opt */ + case 454: /* table_kind_db_name_cond_opt */ { -#line 569 "sql.y" -#line 3669 "sql.c" } break; - case 455: /* tsma_func_list */ + case 463: /* tsma_func_list */ +{ + nodesDestroyNode((yypminor->yy840)); +} + break; + case 510: /* trim_specification_type */ { -#line 623 "sql.y" - nodesDestroyNode((yypminor->yy416)); -#line 3676 "sql.c" + } break; - case 510: /* compare_op */ - case 511: /* in_op */ + case 520: /* compare_op */ + case 521: /* in_op */ { -#line 1280 "sql.y" -#line 3684 "sql.c" } break; - case 523: /* join_type */ + case 533: /* join_type */ { -#line 1361 "sql.y" -#line 3691 "sql.c" } break; - case 524: /* join_subtype */ + case 534: /* join_subtype */ { -#line 1369 "sql.y" -#line 3698 "sql.c" } break; - case 545: /* fill_mode */ + case 555: /* fill_mode */ { -#line 1485 "sql.y" -#line 3705 "sql.c" } break; - case 556: /* ordering_specification_opt */ + case 566: /* ordering_specification_opt */ { -#line 1570 "sql.y" -#line 3712 "sql.c" } break; - case 557: /* null_ordering_opt */ + case 567: /* null_ordering_opt */ { -#line 1576 "sql.y" -#line 3719 "sql.c" } break; /********* End destructor definitions *****************************************/ @@ -3762,8 +3994,8 @@ static void yy_pop_parser_stack(yyParser *pParser){ #ifndef NDEBUG if( yyTraceFILE ){ fprintf(yyTraceFILE,"%sPopping %s\n", - yyTracePrompt, - yyTokenName[yytos->major]); + yyTracePrompt, + yyTokenName[yytos->major]); } #endif yy_destructor(pParser, yytos->major, &yytos->minor); @@ -3774,31 +4006,14 @@ static void yy_pop_parser_stack(yyParser *pParser){ */ void ParseFinalize(void *p){ yyParser *pParser = (yyParser*)p; - - /* In-lined version of calling yy_pop_parser_stack() for each - ** element left in the stack */ - yyStackEntry *yytos = pParser->yytos; - while( yytos>pParser->yystack ){ -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sPopping %s\n", - yyTracePrompt, - yyTokenName[yytos->major]); - } -#endif - if( yytos->major>=YY_MIN_DSTRCTR ){ - yy_destructor(pParser, yytos->major, &yytos->minor); - } - yytos--; - } - -#if YYGROWABLESTACK - if( pParser->yystack!=pParser->yystk0 ) YYFREE(pParser->yystack); + while( pParser->yytos>pParser->yystack ) yy_pop_parser_stack(pParser); +#if YYSTACKDEPTH<=0 + if( pParser->yystack!=&pParser->yystk0 ) free(pParser->yystack); #endif } #ifndef Parse_ENGINEALWAYSONSTACK -/* +/* ** Deallocate and destroy a parser. Destructors are called for ** all stack elements before shutting the parser down. ** @@ -3807,8 +4022,8 @@ void ParseFinalize(void *p){ ** assumed that the input pointer is never NULL. */ void ParseFree( - void *p, /* The parser to be deleted */ - void (*freeProc)(void*) /* Function used to reclaim memory */ + void *p, /* The parser to be deleted */ + void (*freeProc)(void*) /* Function used to reclaim memory */ ){ #ifndef YYPARSEFREENEVERNULL if( p==0 ) return; @@ -3870,8 +4085,8 @@ int ParseCoverage(FILE *out){ ** look-ahead token iLookAhead. */ static YYACTIONTYPE yy_find_shift_action( - YYCODETYPE iLookAhead, /* The look-ahead token */ - YYACTIONTYPE stateno /* Current state number */ + YYCODETYPE iLookAhead, /* The look-ahead token */ + YYACTIONTYPE stateno /* Current state number */ ){ int i; @@ -3898,7 +4113,7 @@ static YYACTIONTYPE yy_find_shift_action( #ifndef NDEBUG if( yyTraceFILE ){ fprintf(yyTraceFILE, "%sFALLBACK %s => %s\n", - yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]); + yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]); } #endif assert( yyFallback[iFallback]==0 ); /* Fallback loop must terminate */ @@ -3914,8 +4129,8 @@ static YYACTIONTYPE yy_find_shift_action( #ifndef NDEBUG if( yyTraceFILE ){ fprintf(yyTraceFILE, "%sWILDCARD %s => %s\n", - yyTracePrompt, yyTokenName[iLookAhead], - yyTokenName[YYWILDCARD]); + yyTracePrompt, yyTokenName[iLookAhead], + yyTokenName[YYWILDCARD]); } #endif /* NDEBUG */ return yy_action[j]; @@ -3935,8 +4150,8 @@ static YYACTIONTYPE yy_find_shift_action( ** look-ahead token iLookAhead. */ static YYACTIONTYPE yy_find_reduce_action( - YYACTIONTYPE stateno, /* Current state number */ - YYCODETYPE iLookAhead /* The look-ahead token */ + YYACTIONTYPE stateno, /* Current state number */ + YYCODETYPE iLookAhead /* The look-ahead token */ ){ int i; #ifdef YYERRORSYMBOL @@ -3964,20 +4179,20 @@ static YYACTIONTYPE yy_find_reduce_action( ** The following routine is called if the stack overflows. */ static void yyStackOverflow(yyParser *yypParser){ - ParseARG_FETCH - ParseCTX_FETCH + ParseARG_FETCH + ParseCTX_FETCH #ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt); - } + if( yyTraceFILE ){ + fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt); + } #endif - while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will execute if the parser + while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser); + /* Here code is inserted which will execute if the parser ** stack every overflows */ - /******** Begin %stack_overflow code ******************************************/ - /******** End %stack_overflow code ********************************************/ - ParseARG_STORE /* Suppress warning about unused %extra_argument var */ - ParseCTX_STORE +/******** Begin %stack_overflow code ******************************************/ +/******** End %stack_overflow code ********************************************/ + ParseARG_STORE /* Suppress warning about unused %extra_argument var */ + ParseCTX_STORE } /* @@ -3988,12 +4203,12 @@ static void yyTraceShift(yyParser *yypParser, int yyNewState, const char *zTag){ if( yyTraceFILE ){ if( yyNewStateyytos->major], - yyNewState); + yyTracePrompt, zTag, yyTokenName[yypParser->yytos->major], + yyNewState); }else{ fprintf(yyTraceFILE,"%s%s '%s', pending reduce %d\n", - yyTracePrompt, zTag, yyTokenName[yypParser->yytos->major], - yyNewState - YY_MIN_REDUCE); + yyTracePrompt, zTag, yyTokenName[yypParser->yytos->major], + yyNewState - YY_MIN_REDUCE); } } } @@ -4005,10 +4220,10 @@ static void yyTraceShift(yyParser *yypParser, int yyNewState, const char *zTag){ ** Perform a shift action. */ static void yy_shift( - yyParser *yypParser, /* The parser to be shifted */ - YYACTIONTYPE yyNewState, /* The new state to shift in */ - YYCODETYPE yyMajor, /* The major token to shift in */ - ParseTOKENTYPE yyMinor /* The minor token to shift in */ + yyParser *yypParser, /* The parser to be shifted */ + YYACTIONTYPE yyNewState, /* The new state to shift in */ + YYCODETYPE yyMajor, /* The major token to shift in */ + ParseTOKENTYPE yyMinor /* The minor token to shift in */ ){ yyStackEntry *yytos; yypParser->yytos++; @@ -4018,19 +4233,25 @@ static void yy_shift( assert( yypParser->yyhwm == (int)(yypParser->yytos - yypParser->yystack) ); } #endif - yytos = yypParser->yytos; - if( yytos>yypParser->yystackEnd ){ +#if YYSTACKDEPTH>0 + if( yypParser->yytos>yypParser->yystackEnd ){ + yypParser->yytos--; + yyStackOverflow(yypParser); + return; + } +#else + if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz] ){ if( yyGrowStack(yypParser) ){ yypParser->yytos--; yyStackOverflow(yypParser); return; } - yytos = yypParser->yytos; - assert( yytos <= yypParser->yystackEnd ); } +#endif if( yyNewState > YY_MAX_SHIFT ){ yyNewState += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE; } + yytos = yypParser->yytos; yytos->stateno = yyNewState; yytos->major = yyMajor; yytos->minor.yy0 = yyMinor; @@ -4040,1521 +4261,1553 @@ static void yy_shift( /* For rule J, yyRuleInfoLhs[J] contains the symbol on the left-hand side ** of that rule */ static const YYCODETYPE yyRuleInfoLhs[] = { - 378, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ - 378, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ - 379, /* (2) account_options ::= */ - 379, /* (3) account_options ::= account_options PPS literal */ - 379, /* (4) account_options ::= account_options TSERIES literal */ - 379, /* (5) account_options ::= account_options STORAGE literal */ - 379, /* (6) account_options ::= account_options STREAMS literal */ - 379, /* (7) account_options ::= account_options QTIME literal */ - 379, /* (8) account_options ::= account_options DBS literal */ - 379, /* (9) account_options ::= account_options USERS literal */ - 379, /* (10) account_options ::= account_options CONNS literal */ - 379, /* (11) account_options ::= account_options STATE literal */ - 380, /* (12) alter_account_options ::= alter_account_option */ - 380, /* (13) alter_account_options ::= alter_account_options alter_account_option */ - 382, /* (14) alter_account_option ::= PASS literal */ - 382, /* (15) alter_account_option ::= PPS literal */ - 382, /* (16) alter_account_option ::= TSERIES literal */ - 382, /* (17) alter_account_option ::= STORAGE literal */ - 382, /* (18) alter_account_option ::= STREAMS literal */ - 382, /* (19) alter_account_option ::= QTIME literal */ - 382, /* (20) alter_account_option ::= DBS literal */ - 382, /* (21) alter_account_option ::= USERS literal */ - 382, /* (22) alter_account_option ::= CONNS literal */ - 382, /* (23) alter_account_option ::= STATE literal */ - 383, /* (24) ip_range_list ::= NK_STRING */ - 383, /* (25) ip_range_list ::= ip_range_list NK_COMMA NK_STRING */ - 384, /* (26) white_list ::= HOST ip_range_list */ - 385, /* (27) white_list_opt ::= */ - 385, /* (28) white_list_opt ::= white_list */ - 386, /* (29) is_import_opt ::= */ - 386, /* (30) is_import_opt ::= IS_IMPORT NK_INTEGER */ - 387, /* (31) is_createdb_opt ::= */ - 387, /* (32) is_createdb_opt ::= CREATEDB NK_INTEGER */ - 378, /* (33) cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt is_createdb_opt is_import_opt white_list_opt */ - 378, /* (34) cmd ::= ALTER USER user_name PASS NK_STRING */ - 378, /* (35) cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ - 378, /* (36) cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ - 378, /* (37) cmd ::= ALTER USER user_name CREATEDB NK_INTEGER */ - 378, /* (38) cmd ::= ALTER USER user_name ADD white_list */ - 378, /* (39) cmd ::= ALTER USER user_name DROP white_list */ - 378, /* (40) cmd ::= DROP USER user_name */ - 389, /* (41) sysinfo_opt ::= */ - 389, /* (42) sysinfo_opt ::= SYSINFO NK_INTEGER */ - 378, /* (43) cmd ::= GRANT privileges ON priv_level with_opt TO user_name */ - 378, /* (44) cmd ::= REVOKE privileges ON priv_level with_opt FROM user_name */ - 390, /* (45) privileges ::= ALL */ - 390, /* (46) privileges ::= priv_type_list */ - 390, /* (47) privileges ::= SUBSCRIBE */ - 393, /* (48) priv_type_list ::= priv_type */ - 393, /* (49) priv_type_list ::= priv_type_list NK_COMMA priv_type */ - 394, /* (50) priv_type ::= READ */ - 394, /* (51) priv_type ::= WRITE */ - 394, /* (52) priv_type ::= ALTER */ - 391, /* (53) priv_level ::= NK_STAR NK_DOT NK_STAR */ - 391, /* (54) priv_level ::= db_name NK_DOT NK_STAR */ - 391, /* (55) priv_level ::= db_name NK_DOT table_name */ - 391, /* (56) priv_level ::= topic_name */ - 392, /* (57) with_opt ::= */ - 392, /* (58) with_opt ::= WITH search_condition */ - 378, /* (59) cmd ::= CREATE ENCRYPT_KEY NK_STRING */ - 378, /* (60) cmd ::= CREATE DNODE dnode_endpoint */ - 378, /* (61) cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ - 378, /* (62) cmd ::= DROP DNODE NK_INTEGER force_opt */ - 378, /* (63) cmd ::= DROP DNODE dnode_endpoint force_opt */ - 378, /* (64) cmd ::= DROP DNODE NK_INTEGER unsafe_opt */ - 378, /* (65) cmd ::= DROP DNODE dnode_endpoint unsafe_opt */ - 378, /* (66) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ - 378, /* (67) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ - 378, /* (68) cmd ::= ALTER ALL DNODES NK_STRING */ - 378, /* (69) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ - 378, /* (70) cmd ::= RESTORE DNODE NK_INTEGER */ - 399, /* (71) dnode_endpoint ::= NK_STRING */ - 399, /* (72) dnode_endpoint ::= NK_ID */ - 399, /* (73) dnode_endpoint ::= NK_IPTOKEN */ - 400, /* (74) force_opt ::= */ - 400, /* (75) force_opt ::= FORCE */ - 401, /* (76) unsafe_opt ::= UNSAFE */ - 378, /* (77) cmd ::= ALTER CLUSTER NK_STRING */ - 378, /* (78) cmd ::= ALTER CLUSTER NK_STRING NK_STRING */ - 378, /* (79) cmd ::= ALTER LOCAL NK_STRING */ - 378, /* (80) cmd ::= ALTER LOCAL NK_STRING NK_STRING */ - 378, /* (81) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ - 378, /* (82) cmd ::= DROP QNODE ON DNODE NK_INTEGER */ - 378, /* (83) cmd ::= RESTORE QNODE ON DNODE NK_INTEGER */ - 378, /* (84) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ - 378, /* (85) cmd ::= DROP BNODE ON DNODE NK_INTEGER */ - 378, /* (86) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ - 378, /* (87) cmd ::= DROP SNODE ON DNODE NK_INTEGER */ - 378, /* (88) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ - 378, /* (89) cmd ::= DROP MNODE ON DNODE NK_INTEGER */ - 378, /* (90) cmd ::= RESTORE MNODE ON DNODE NK_INTEGER */ - 378, /* (91) cmd ::= RESTORE VNODE ON DNODE NK_INTEGER */ - 378, /* (92) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ - 378, /* (93) cmd ::= DROP DATABASE exists_opt db_name */ - 378, /* (94) cmd ::= USE db_name */ - 378, /* (95) cmd ::= ALTER DATABASE db_name alter_db_options */ - 378, /* (96) cmd ::= FLUSH DATABASE db_name */ - 378, /* (97) cmd ::= TRIM DATABASE db_name speed_opt */ - 378, /* (98) cmd ::= S3MIGRATE DATABASE db_name */ - 378, /* (99) cmd ::= COMPACT DATABASE db_name start_opt end_opt */ - 402, /* (100) not_exists_opt ::= IF NOT EXISTS */ - 402, /* (101) not_exists_opt ::= */ - 404, /* (102) exists_opt ::= IF EXISTS */ - 404, /* (103) exists_opt ::= */ - 403, /* (104) db_options ::= */ - 403, /* (105) db_options ::= db_options BUFFER NK_INTEGER */ - 403, /* (106) db_options ::= db_options CACHEMODEL NK_STRING */ - 403, /* (107) db_options ::= db_options CACHESIZE NK_INTEGER */ - 403, /* (108) db_options ::= db_options COMP NK_INTEGER */ - 403, /* (109) db_options ::= db_options DURATION NK_INTEGER */ - 403, /* (110) db_options ::= db_options DURATION NK_VARIABLE */ - 403, /* (111) db_options ::= db_options MAXROWS NK_INTEGER */ - 403, /* (112) db_options ::= db_options MINROWS NK_INTEGER */ - 403, /* (113) db_options ::= db_options KEEP integer_list */ - 403, /* (114) db_options ::= db_options KEEP variable_list */ - 403, /* (115) db_options ::= db_options PAGES NK_INTEGER */ - 403, /* (116) db_options ::= db_options PAGESIZE NK_INTEGER */ - 403, /* (117) db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ - 403, /* (118) db_options ::= db_options PRECISION NK_STRING */ - 403, /* (119) db_options ::= db_options REPLICA NK_INTEGER */ - 403, /* (120) db_options ::= db_options VGROUPS NK_INTEGER */ - 403, /* (121) db_options ::= db_options SINGLE_STABLE NK_INTEGER */ - 403, /* (122) db_options ::= db_options RETENTIONS retention_list */ - 403, /* (123) db_options ::= db_options SCHEMALESS NK_INTEGER */ - 403, /* (124) db_options ::= db_options WAL_LEVEL NK_INTEGER */ - 403, /* (125) db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ - 403, /* (126) db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ - 403, /* (127) db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ - 403, /* (128) db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ - 403, /* (129) db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ - 403, /* (130) db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ - 403, /* (131) db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ - 403, /* (132) db_options ::= db_options STT_TRIGGER NK_INTEGER */ - 403, /* (133) db_options ::= db_options TABLE_PREFIX signed */ - 403, /* (134) db_options ::= db_options TABLE_SUFFIX signed */ - 403, /* (135) db_options ::= db_options S3_CHUNKSIZE NK_INTEGER */ - 403, /* (136) db_options ::= db_options S3_KEEPLOCAL NK_INTEGER */ - 403, /* (137) db_options ::= db_options S3_KEEPLOCAL NK_VARIABLE */ - 403, /* (138) db_options ::= db_options S3_COMPACT NK_INTEGER */ - 403, /* (139) db_options ::= db_options KEEP_TIME_OFFSET NK_INTEGER */ - 403, /* (140) db_options ::= db_options ENCRYPT_ALGORITHM NK_STRING */ - 405, /* (141) alter_db_options ::= alter_db_option */ - 405, /* (142) alter_db_options ::= alter_db_options alter_db_option */ - 413, /* (143) alter_db_option ::= BUFFER NK_INTEGER */ - 413, /* (144) alter_db_option ::= CACHEMODEL NK_STRING */ - 413, /* (145) alter_db_option ::= CACHESIZE NK_INTEGER */ - 413, /* (146) alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ - 413, /* (147) alter_db_option ::= KEEP integer_list */ - 413, /* (148) alter_db_option ::= KEEP variable_list */ - 413, /* (149) alter_db_option ::= PAGES NK_INTEGER */ - 413, /* (150) alter_db_option ::= REPLICA NK_INTEGER */ - 413, /* (151) alter_db_option ::= WAL_LEVEL NK_INTEGER */ - 413, /* (152) alter_db_option ::= STT_TRIGGER NK_INTEGER */ - 413, /* (153) alter_db_option ::= MINROWS NK_INTEGER */ - 413, /* (154) alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */ - 413, /* (155) alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ - 413, /* (156) alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */ - 413, /* (157) alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ - 413, /* (158) alter_db_option ::= S3_KEEPLOCAL NK_INTEGER */ - 413, /* (159) alter_db_option ::= S3_KEEPLOCAL NK_VARIABLE */ - 413, /* (160) alter_db_option ::= S3_COMPACT NK_INTEGER */ - 413, /* (161) alter_db_option ::= KEEP_TIME_OFFSET NK_INTEGER */ - 413, /* (162) alter_db_option ::= ENCRYPT_ALGORITHM NK_STRING */ - 409, /* (163) integer_list ::= NK_INTEGER */ - 409, /* (164) integer_list ::= integer_list NK_COMMA NK_INTEGER */ - 410, /* (165) variable_list ::= NK_VARIABLE */ - 410, /* (166) variable_list ::= variable_list NK_COMMA NK_VARIABLE */ - 411, /* (167) retention_list ::= retention */ - 411, /* (168) retention_list ::= retention_list NK_COMMA retention */ - 414, /* (169) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ - 414, /* (170) retention ::= NK_MINUS NK_COLON NK_VARIABLE */ - 406, /* (171) speed_opt ::= */ - 406, /* (172) speed_opt ::= BWLIMIT NK_INTEGER */ - 407, /* (173) start_opt ::= */ - 407, /* (174) start_opt ::= START WITH NK_INTEGER */ - 407, /* (175) start_opt ::= START WITH NK_STRING */ - 407, /* (176) start_opt ::= START WITH TIMESTAMP NK_STRING */ - 408, /* (177) end_opt ::= */ - 408, /* (178) end_opt ::= END WITH NK_INTEGER */ - 408, /* (179) end_opt ::= END WITH NK_STRING */ - 408, /* (180) end_opt ::= END WITH TIMESTAMP NK_STRING */ - 378, /* (181) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ - 378, /* (182) cmd ::= CREATE TABLE multi_create_clause */ - 378, /* (183) cmd ::= CREATE TABLE not_exists_opt USING full_table_name NK_LP tag_list_opt NK_RP FILE NK_STRING */ - 378, /* (184) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ - 378, /* (185) cmd ::= DROP TABLE multi_drop_clause */ - 378, /* (186) cmd ::= DROP STABLE exists_opt full_table_name */ - 378, /* (187) cmd ::= ALTER TABLE alter_table_clause */ - 378, /* (188) cmd ::= ALTER STABLE alter_table_clause */ - 423, /* (189) alter_table_clause ::= full_table_name alter_table_options */ - 423, /* (190) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name column_options */ - 423, /* (191) alter_table_clause ::= full_table_name DROP COLUMN column_name */ - 423, /* (192) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ - 423, /* (193) alter_table_clause ::= full_table_name MODIFY COLUMN column_name column_options */ - 423, /* (194) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ - 423, /* (195) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ - 423, /* (196) alter_table_clause ::= full_table_name DROP TAG column_name */ - 423, /* (197) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ - 423, /* (198) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ - 423, /* (199) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ tags_literal */ - 419, /* (200) multi_create_clause ::= create_subtable_clause */ - 419, /* (201) multi_create_clause ::= multi_create_clause create_subtable_clause */ - 429, /* (202) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP tags_literal_list NK_RP table_options */ - 422, /* (203) multi_drop_clause ::= drop_table_clause */ - 422, /* (204) multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ - 432, /* (205) drop_table_clause ::= exists_opt full_table_name */ - 430, /* (206) specific_cols_opt ::= */ - 430, /* (207) specific_cols_opt ::= NK_LP col_name_list NK_RP */ - 415, /* (208) full_table_name ::= table_name */ - 415, /* (209) full_table_name ::= db_name NK_DOT table_name */ - 434, /* (210) tag_def_list ::= tag_def */ - 434, /* (211) tag_def_list ::= tag_def_list NK_COMMA tag_def */ - 435, /* (212) tag_def ::= column_name type_name */ - 416, /* (213) column_def_list ::= column_def */ - 416, /* (214) column_def_list ::= column_def_list NK_COMMA column_def */ - 436, /* (215) column_def ::= column_name type_name column_options */ - 426, /* (216) type_name ::= BOOL */ - 426, /* (217) type_name ::= TINYINT */ - 426, /* (218) type_name ::= SMALLINT */ - 426, /* (219) type_name ::= INT */ - 426, /* (220) type_name ::= INTEGER */ - 426, /* (221) type_name ::= BIGINT */ - 426, /* (222) type_name ::= FLOAT */ - 426, /* (223) type_name ::= DOUBLE */ - 426, /* (224) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ - 426, /* (225) type_name ::= TIMESTAMP */ - 426, /* (226) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ - 426, /* (227) type_name ::= TINYINT UNSIGNED */ - 426, /* (228) type_name ::= SMALLINT UNSIGNED */ - 426, /* (229) type_name ::= INT UNSIGNED */ - 426, /* (230) type_name ::= BIGINT UNSIGNED */ - 426, /* (231) type_name ::= JSON */ - 426, /* (232) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ - 426, /* (233) type_name ::= MEDIUMBLOB */ - 426, /* (234) type_name ::= BLOB */ - 426, /* (235) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ - 426, /* (236) type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ - 426, /* (237) type_name ::= DECIMAL */ - 426, /* (238) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ - 426, /* (239) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - 437, /* (240) type_name_default_len ::= BINARY */ - 437, /* (241) type_name_default_len ::= NCHAR */ - 437, /* (242) type_name_default_len ::= VARCHAR */ - 437, /* (243) type_name_default_len ::= VARBINARY */ - 417, /* (244) tags_def_opt ::= */ - 417, /* (245) tags_def_opt ::= tags_def */ - 421, /* (246) tags_def ::= TAGS NK_LP tag_def_list NK_RP */ - 418, /* (247) table_options ::= */ - 418, /* (248) table_options ::= table_options COMMENT NK_STRING */ - 418, /* (249) table_options ::= table_options MAX_DELAY duration_list */ - 418, /* (250) table_options ::= table_options WATERMARK duration_list */ - 418, /* (251) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ - 418, /* (252) table_options ::= table_options TTL NK_INTEGER */ - 418, /* (253) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ - 418, /* (254) table_options ::= table_options DELETE_MARK duration_list */ - 424, /* (255) alter_table_options ::= alter_table_option */ - 424, /* (256) alter_table_options ::= alter_table_options alter_table_option */ - 440, /* (257) alter_table_option ::= COMMENT NK_STRING */ - 440, /* (258) alter_table_option ::= TTL NK_INTEGER */ - 438, /* (259) duration_list ::= duration_literal */ - 438, /* (260) duration_list ::= duration_list NK_COMMA duration_literal */ - 439, /* (261) rollup_func_list ::= rollup_func_name */ - 439, /* (262) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ - 442, /* (263) rollup_func_name ::= function_name */ - 442, /* (264) rollup_func_name ::= FIRST */ - 442, /* (265) rollup_func_name ::= LAST */ - 433, /* (266) col_name_list ::= col_name */ - 433, /* (267) col_name_list ::= col_name_list NK_COMMA col_name */ - 444, /* (268) col_name ::= column_name */ - 378, /* (269) cmd ::= SHOW DNODES */ - 378, /* (270) cmd ::= SHOW USERS */ - 378, /* (271) cmd ::= SHOW USERS FULL */ - 378, /* (272) cmd ::= SHOW USER PRIVILEGES */ - 378, /* (273) cmd ::= SHOW db_kind_opt DATABASES */ - 378, /* (274) cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */ - 378, /* (275) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ - 378, /* (276) cmd ::= SHOW db_name_cond_opt VGROUPS */ - 378, /* (277) cmd ::= SHOW MNODES */ - 378, /* (278) cmd ::= SHOW QNODES */ - 378, /* (279) cmd ::= SHOW ARBGROUPS */ - 378, /* (280) cmd ::= SHOW FUNCTIONS */ - 378, /* (281) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ - 378, /* (282) cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ - 378, /* (283) cmd ::= SHOW STREAMS */ - 378, /* (284) cmd ::= SHOW ACCOUNTS */ - 378, /* (285) cmd ::= SHOW APPS */ - 378, /* (286) cmd ::= SHOW CONNECTIONS */ - 378, /* (287) cmd ::= SHOW LICENCES */ - 378, /* (288) cmd ::= SHOW GRANTS */ - 378, /* (289) cmd ::= SHOW GRANTS FULL */ - 378, /* (290) cmd ::= SHOW GRANTS LOGS */ - 378, /* (291) cmd ::= SHOW CLUSTER MACHINES */ - 378, /* (292) cmd ::= SHOW CREATE DATABASE db_name */ - 378, /* (293) cmd ::= SHOW CREATE TABLE full_table_name */ - 378, /* (294) cmd ::= SHOW CREATE STABLE full_table_name */ - 378, /* (295) cmd ::= SHOW ENCRYPTIONS */ - 378, /* (296) cmd ::= SHOW QUERIES */ - 378, /* (297) cmd ::= SHOW SCORES */ - 378, /* (298) cmd ::= SHOW TOPICS */ - 378, /* (299) cmd ::= SHOW VARIABLES */ - 378, /* (300) cmd ::= SHOW CLUSTER VARIABLES */ - 378, /* (301) cmd ::= SHOW LOCAL VARIABLES */ - 378, /* (302) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ - 378, /* (303) cmd ::= SHOW BNODES */ - 378, /* (304) cmd ::= SHOW SNODES */ - 378, /* (305) cmd ::= SHOW CLUSTER */ - 378, /* (306) cmd ::= SHOW TRANSACTIONS */ - 378, /* (307) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ - 378, /* (308) cmd ::= SHOW CONSUMERS */ - 378, /* (309) cmd ::= SHOW SUBSCRIPTIONS */ - 378, /* (310) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ - 378, /* (311) cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ - 378, /* (312) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ - 378, /* (313) cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ - 378, /* (314) cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ - 378, /* (315) cmd ::= SHOW VNODES */ - 378, /* (316) cmd ::= SHOW db_name_cond_opt ALIVE */ - 378, /* (317) cmd ::= SHOW CLUSTER ALIVE */ - 378, /* (318) cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt */ - 378, /* (319) cmd ::= SHOW CREATE VIEW full_table_name */ - 378, /* (320) cmd ::= SHOW COMPACTS */ - 378, /* (321) cmd ::= SHOW COMPACT NK_INTEGER */ - 446, /* (322) table_kind_db_name_cond_opt ::= */ - 446, /* (323) table_kind_db_name_cond_opt ::= table_kind */ - 446, /* (324) table_kind_db_name_cond_opt ::= db_name NK_DOT */ - 446, /* (325) table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */ - 451, /* (326) table_kind ::= NORMAL */ - 451, /* (327) table_kind ::= CHILD */ - 448, /* (328) db_name_cond_opt ::= */ - 448, /* (329) db_name_cond_opt ::= db_name NK_DOT */ - 447, /* (330) like_pattern_opt ::= */ - 447, /* (331) like_pattern_opt ::= LIKE NK_STRING */ - 449, /* (332) table_name_cond ::= table_name */ - 450, /* (333) from_db_opt ::= */ - 450, /* (334) from_db_opt ::= FROM db_name */ - 420, /* (335) tag_list_opt ::= */ - 420, /* (336) tag_list_opt ::= tag_item */ - 420, /* (337) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ - 452, /* (338) tag_item ::= TBNAME */ - 452, /* (339) tag_item ::= QTAGS */ - 452, /* (340) tag_item ::= column_name */ - 452, /* (341) tag_item ::= column_name column_alias */ - 452, /* (342) tag_item ::= column_name AS column_alias */ - 445, /* (343) db_kind_opt ::= */ - 445, /* (344) db_kind_opt ::= USER */ - 445, /* (345) db_kind_opt ::= SYSTEM */ - 378, /* (346) cmd ::= CREATE TSMA not_exists_opt tsma_name ON full_table_name tsma_func_list INTERVAL NK_LP duration_literal NK_RP */ - 378, /* (347) cmd ::= CREATE RECURSIVE TSMA not_exists_opt tsma_name ON full_table_name INTERVAL NK_LP duration_literal NK_RP */ - 378, /* (348) cmd ::= DROP TSMA exists_opt full_tsma_name */ - 378, /* (349) cmd ::= SHOW db_name_cond_opt TSMAS */ - 456, /* (350) full_tsma_name ::= tsma_name */ - 456, /* (351) full_tsma_name ::= db_name NK_DOT tsma_name */ - 455, /* (352) tsma_func_list ::= FUNCTION NK_LP func_list NK_RP */ - 378, /* (353) cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */ - 378, /* (354) cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */ - 378, /* (355) cmd ::= DROP INDEX exists_opt full_index_name */ - 459, /* (356) full_index_name ::= index_name */ - 459, /* (357) full_index_name ::= db_name NK_DOT index_name */ - 458, /* (358) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ - 458, /* (359) 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 */ - 457, /* (360) func_list ::= func */ - 457, /* (361) func_list ::= func_list NK_COMMA func */ - 463, /* (362) func ::= sma_func_name NK_LP expression_list NK_RP */ - 464, /* (363) sma_func_name ::= function_name */ - 464, /* (364) sma_func_name ::= COUNT */ - 464, /* (365) sma_func_name ::= FIRST */ - 464, /* (366) sma_func_name ::= LAST */ - 464, /* (367) sma_func_name ::= LAST_ROW */ - 462, /* (368) sma_stream_opt ::= */ - 462, /* (369) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ - 462, /* (370) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ - 462, /* (371) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ - 466, /* (372) with_meta ::= AS */ - 466, /* (373) with_meta ::= WITH META AS */ - 466, /* (374) with_meta ::= ONLY META AS */ - 378, /* (375) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ - 378, /* (376) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ - 378, /* (377) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ - 378, /* (378) cmd ::= DROP TOPIC exists_opt topic_name */ - 378, /* (379) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ - 378, /* (380) cmd ::= DESC full_table_name */ - 378, /* (381) cmd ::= DESCRIBE full_table_name */ - 378, /* (382) cmd ::= RESET QUERY CACHE */ - 378, /* (383) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ - 378, /* (384) cmd ::= EXPLAIN analyze_opt explain_options insert_query */ - 470, /* (385) analyze_opt ::= */ - 470, /* (386) analyze_opt ::= ANALYZE */ - 471, /* (387) explain_options ::= */ - 471, /* (388) explain_options ::= explain_options VERBOSE NK_BOOL */ - 471, /* (389) explain_options ::= explain_options RATIO NK_FLOAT */ - 378, /* (390) cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ - 378, /* (391) cmd ::= DROP FUNCTION exists_opt function_name */ - 474, /* (392) agg_func_opt ::= */ - 474, /* (393) agg_func_opt ::= AGGREGATE */ - 475, /* (394) bufsize_opt ::= */ - 475, /* (395) bufsize_opt ::= BUFSIZE NK_INTEGER */ - 476, /* (396) language_opt ::= */ - 476, /* (397) language_opt ::= LANGUAGE NK_STRING */ - 473, /* (398) or_replace_opt ::= */ - 473, /* (399) or_replace_opt ::= OR REPLACE */ - 378, /* (400) cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */ - 378, /* (401) cmd ::= DROP VIEW exists_opt full_view_name */ - 477, /* (402) full_view_name ::= view_name */ - 477, /* (403) full_view_name ::= db_name NK_DOT view_name */ - 378, /* (404) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */ - 378, /* (405) cmd ::= DROP STREAM exists_opt stream_name */ - 378, /* (406) cmd ::= PAUSE STREAM exists_opt stream_name */ - 378, /* (407) cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ - 481, /* (408) col_list_opt ::= */ - 481, /* (409) col_list_opt ::= NK_LP column_stream_def_list NK_RP */ - 485, /* (410) column_stream_def_list ::= column_stream_def */ - 485, /* (411) column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def */ - 486, /* (412) column_stream_def ::= column_name stream_col_options */ - 487, /* (413) stream_col_options ::= */ - 487, /* (414) stream_col_options ::= stream_col_options PRIMARY KEY */ - 482, /* (415) tag_def_or_ref_opt ::= */ - 482, /* (416) tag_def_or_ref_opt ::= tags_def */ - 482, /* (417) tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP */ - 480, /* (418) stream_options ::= */ - 480, /* (419) stream_options ::= stream_options TRIGGER AT_ONCE */ - 480, /* (420) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ - 480, /* (421) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ - 480, /* (422) stream_options ::= stream_options WATERMARK duration_literal */ - 480, /* (423) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ - 480, /* (424) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ - 480, /* (425) stream_options ::= stream_options DELETE_MARK duration_literal */ - 480, /* (426) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ - 483, /* (427) subtable_opt ::= */ - 483, /* (428) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - 484, /* (429) ignore_opt ::= */ - 484, /* (430) ignore_opt ::= IGNORE UNTREATED */ - 378, /* (431) cmd ::= KILL CONNECTION NK_INTEGER */ - 378, /* (432) cmd ::= KILL QUERY NK_STRING */ - 378, /* (433) cmd ::= KILL TRANSACTION NK_INTEGER */ - 378, /* (434) cmd ::= KILL COMPACT NK_INTEGER */ - 378, /* (435) cmd ::= BALANCE VGROUP */ - 378, /* (436) cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ - 378, /* (437) cmd ::= BALANCE VGROUP LEADER DATABASE db_name */ - 378, /* (438) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ - 378, /* (439) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ - 378, /* (440) cmd ::= SPLIT VGROUP NK_INTEGER */ - 489, /* (441) on_vgroup_id ::= */ - 489, /* (442) on_vgroup_id ::= ON NK_INTEGER */ - 490, /* (443) dnode_list ::= DNODE NK_INTEGER */ - 490, /* (444) dnode_list ::= dnode_list DNODE NK_INTEGER */ - 378, /* (445) cmd ::= DELETE FROM full_table_name where_clause_opt */ - 378, /* (446) cmd ::= query_or_subquery */ - 378, /* (447) cmd ::= insert_query */ - 472, /* (448) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ - 472, /* (449) insert_query ::= INSERT INTO full_table_name query_or_subquery */ - 428, /* (450) tags_literal ::= NK_INTEGER */ - 428, /* (451) tags_literal ::= NK_INTEGER NK_PLUS duration_literal */ - 428, /* (452) tags_literal ::= NK_INTEGER NK_MINUS duration_literal */ - 428, /* (453) tags_literal ::= NK_PLUS NK_INTEGER */ - 428, /* (454) tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal */ - 428, /* (455) tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal */ - 428, /* (456) tags_literal ::= NK_MINUS NK_INTEGER */ - 428, /* (457) tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal */ - 428, /* (458) tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal */ - 428, /* (459) tags_literal ::= NK_FLOAT */ - 428, /* (460) tags_literal ::= NK_PLUS NK_FLOAT */ - 428, /* (461) tags_literal ::= NK_MINUS NK_FLOAT */ - 428, /* (462) tags_literal ::= NK_BIN */ - 428, /* (463) tags_literal ::= NK_BIN NK_PLUS duration_literal */ - 428, /* (464) tags_literal ::= NK_BIN NK_MINUS duration_literal */ - 428, /* (465) tags_literal ::= NK_PLUS NK_BIN */ - 428, /* (466) tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal */ - 428, /* (467) tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal */ - 428, /* (468) tags_literal ::= NK_MINUS NK_BIN */ - 428, /* (469) tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal */ - 428, /* (470) tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal */ - 428, /* (471) tags_literal ::= NK_HEX */ - 428, /* (472) tags_literal ::= NK_HEX NK_PLUS duration_literal */ - 428, /* (473) tags_literal ::= NK_HEX NK_MINUS duration_literal */ - 428, /* (474) tags_literal ::= NK_PLUS NK_HEX */ - 428, /* (475) tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal */ - 428, /* (476) tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal */ - 428, /* (477) tags_literal ::= NK_MINUS NK_HEX */ - 428, /* (478) tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal */ - 428, /* (479) tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal */ - 428, /* (480) tags_literal ::= NK_STRING */ - 428, /* (481) tags_literal ::= NK_STRING NK_PLUS duration_literal */ - 428, /* (482) tags_literal ::= NK_STRING NK_MINUS duration_literal */ - 428, /* (483) tags_literal ::= NK_BOOL */ - 428, /* (484) tags_literal ::= NULL */ - 428, /* (485) tags_literal ::= literal_func */ - 428, /* (486) tags_literal ::= literal_func NK_PLUS duration_literal */ - 428, /* (487) tags_literal ::= literal_func NK_MINUS duration_literal */ - 431, /* (488) tags_literal_list ::= tags_literal */ - 431, /* (489) tags_literal_list ::= tags_literal_list NK_COMMA tags_literal */ - 381, /* (490) literal ::= NK_INTEGER */ - 381, /* (491) literal ::= NK_FLOAT */ - 381, /* (492) literal ::= NK_STRING */ - 381, /* (493) literal ::= NK_BOOL */ - 381, /* (494) literal ::= TIMESTAMP NK_STRING */ - 381, /* (495) literal ::= duration_literal */ - 381, /* (496) literal ::= NULL */ - 381, /* (497) literal ::= NK_QUESTION */ - 441, /* (498) duration_literal ::= NK_VARIABLE */ - 412, /* (499) signed ::= NK_INTEGER */ - 412, /* (500) signed ::= NK_PLUS NK_INTEGER */ - 412, /* (501) signed ::= NK_MINUS NK_INTEGER */ - 412, /* (502) signed ::= NK_FLOAT */ - 412, /* (503) signed ::= NK_PLUS NK_FLOAT */ - 412, /* (504) signed ::= NK_MINUS NK_FLOAT */ - 492, /* (505) signed_literal ::= signed */ - 492, /* (506) signed_literal ::= NK_STRING */ - 492, /* (507) signed_literal ::= NK_BOOL */ - 492, /* (508) signed_literal ::= TIMESTAMP NK_STRING */ - 492, /* (509) signed_literal ::= duration_literal */ - 492, /* (510) signed_literal ::= NULL */ - 492, /* (511) signed_literal ::= literal_func */ - 492, /* (512) signed_literal ::= NK_QUESTION */ - 493, /* (513) literal_list ::= signed_literal */ - 493, /* (514) literal_list ::= literal_list NK_COMMA signed_literal */ - 395, /* (515) db_name ::= NK_ID */ - 396, /* (516) table_name ::= NK_ID */ - 425, /* (517) column_name ::= NK_ID */ - 443, /* (518) function_name ::= NK_ID */ - 478, /* (519) view_name ::= NK_ID */ - 494, /* (520) table_alias ::= NK_ID */ - 453, /* (521) column_alias ::= NK_ID */ - 453, /* (522) column_alias ::= NK_ALIAS */ - 388, /* (523) user_name ::= NK_ID */ - 397, /* (524) topic_name ::= NK_ID */ - 479, /* (525) stream_name ::= NK_ID */ - 469, /* (526) cgroup_name ::= NK_ID */ - 460, /* (527) index_name ::= NK_ID */ - 454, /* (528) tsma_name ::= NK_ID */ - 495, /* (529) expr_or_subquery ::= expression */ - 488, /* (530) expression ::= literal */ - 488, /* (531) expression ::= pseudo_column */ - 488, /* (532) expression ::= column_reference */ - 488, /* (533) expression ::= function_expression */ - 488, /* (534) expression ::= case_when_expression */ - 488, /* (535) expression ::= NK_LP expression NK_RP */ - 488, /* (536) expression ::= NK_PLUS expr_or_subquery */ - 488, /* (537) expression ::= NK_MINUS expr_or_subquery */ - 488, /* (538) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ - 488, /* (539) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ - 488, /* (540) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ - 488, /* (541) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ - 488, /* (542) expression ::= expr_or_subquery NK_REM expr_or_subquery */ - 488, /* (543) expression ::= column_reference NK_ARROW NK_STRING */ - 488, /* (544) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ - 488, /* (545) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ - 465, /* (546) expression_list ::= expr_or_subquery */ - 465, /* (547) expression_list ::= expression_list NK_COMMA expr_or_subquery */ - 497, /* (548) column_reference ::= column_name */ - 497, /* (549) column_reference ::= table_name NK_DOT column_name */ - 497, /* (550) column_reference ::= NK_ALIAS */ - 497, /* (551) column_reference ::= table_name NK_DOT NK_ALIAS */ - 496, /* (552) pseudo_column ::= ROWTS */ - 496, /* (553) pseudo_column ::= TBNAME */ - 496, /* (554) pseudo_column ::= table_name NK_DOT TBNAME */ - 496, /* (555) pseudo_column ::= QSTART */ - 496, /* (556) pseudo_column ::= QEND */ - 496, /* (557) pseudo_column ::= QDURATION */ - 496, /* (558) pseudo_column ::= WSTART */ - 496, /* (559) pseudo_column ::= WEND */ - 496, /* (560) pseudo_column ::= WDURATION */ - 496, /* (561) pseudo_column ::= IROWTS */ - 496, /* (562) pseudo_column ::= ISFILLED */ - 496, /* (563) pseudo_column ::= QTAGS */ - 498, /* (564) function_expression ::= function_name NK_LP expression_list NK_RP */ - 498, /* (565) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ - 498, /* (566) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ - 498, /* (567) function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP */ - 498, /* (568) function_expression ::= literal_func */ - 491, /* (569) literal_func ::= noarg_func NK_LP NK_RP */ - 491, /* (570) literal_func ::= NOW */ - 491, /* (571) literal_func ::= TODAY */ - 502, /* (572) noarg_func ::= NOW */ - 502, /* (573) noarg_func ::= TODAY */ - 502, /* (574) noarg_func ::= TIMEZONE */ - 502, /* (575) noarg_func ::= DATABASE */ - 502, /* (576) noarg_func ::= CLIENT_VERSION */ - 502, /* (577) noarg_func ::= SERVER_VERSION */ - 502, /* (578) noarg_func ::= SERVER_STATUS */ - 502, /* (579) noarg_func ::= CURRENT_USER */ - 502, /* (580) noarg_func ::= USER */ - 500, /* (581) star_func ::= COUNT */ - 500, /* (582) star_func ::= FIRST */ - 500, /* (583) star_func ::= LAST */ - 500, /* (584) star_func ::= LAST_ROW */ - 501, /* (585) star_func_para_list ::= NK_STAR */ - 501, /* (586) star_func_para_list ::= other_para_list */ - 503, /* (587) other_para_list ::= star_func_para */ - 503, /* (588) other_para_list ::= other_para_list NK_COMMA star_func_para */ - 504, /* (589) star_func_para ::= expr_or_subquery */ - 504, /* (590) star_func_para ::= table_name NK_DOT NK_STAR */ - 499, /* (591) case_when_expression ::= CASE when_then_list case_when_else_opt END */ - 499, /* (592) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ - 505, /* (593) when_then_list ::= when_then_expr */ - 505, /* (594) when_then_list ::= when_then_list when_then_expr */ - 508, /* (595) when_then_expr ::= WHEN common_expression THEN common_expression */ - 506, /* (596) case_when_else_opt ::= */ - 506, /* (597) case_when_else_opt ::= ELSE common_expression */ - 509, /* (598) predicate ::= expr_or_subquery compare_op expr_or_subquery */ - 509, /* (599) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ - 509, /* (600) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ - 509, /* (601) predicate ::= expr_or_subquery IS NULL */ - 509, /* (602) predicate ::= expr_or_subquery IS NOT NULL */ - 509, /* (603) predicate ::= expr_or_subquery in_op in_predicate_value */ - 510, /* (604) compare_op ::= NK_LT */ - 510, /* (605) compare_op ::= NK_GT */ - 510, /* (606) compare_op ::= NK_LE */ - 510, /* (607) compare_op ::= NK_GE */ - 510, /* (608) compare_op ::= NK_NE */ - 510, /* (609) compare_op ::= NK_EQ */ - 510, /* (610) compare_op ::= LIKE */ - 510, /* (611) compare_op ::= NOT LIKE */ - 510, /* (612) compare_op ::= MATCH */ - 510, /* (613) compare_op ::= NMATCH */ - 510, /* (614) compare_op ::= CONTAINS */ - 511, /* (615) in_op ::= IN */ - 511, /* (616) in_op ::= NOT IN */ - 512, /* (617) in_predicate_value ::= NK_LP literal_list NK_RP */ - 513, /* (618) boolean_value_expression ::= boolean_primary */ - 513, /* (619) boolean_value_expression ::= NOT boolean_primary */ - 513, /* (620) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - 513, /* (621) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - 514, /* (622) boolean_primary ::= predicate */ - 514, /* (623) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ - 507, /* (624) common_expression ::= expr_or_subquery */ - 507, /* (625) common_expression ::= boolean_value_expression */ - 515, /* (626) from_clause_opt ::= */ - 515, /* (627) from_clause_opt ::= FROM table_reference_list */ - 516, /* (628) table_reference_list ::= table_reference */ - 516, /* (629) table_reference_list ::= table_reference_list NK_COMMA table_reference */ - 517, /* (630) table_reference ::= table_primary */ - 517, /* (631) table_reference ::= joined_table */ - 518, /* (632) table_primary ::= table_name alias_opt */ - 518, /* (633) table_primary ::= db_name NK_DOT table_name alias_opt */ - 518, /* (634) table_primary ::= subquery alias_opt */ - 518, /* (635) table_primary ::= parenthesized_joined_table */ - 520, /* (636) alias_opt ::= */ - 520, /* (637) alias_opt ::= table_alias */ - 520, /* (638) alias_opt ::= AS table_alias */ - 522, /* (639) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - 522, /* (640) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ - 519, /* (641) joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt */ - 523, /* (642) join_type ::= */ - 523, /* (643) join_type ::= INNER */ - 523, /* (644) join_type ::= LEFT */ - 523, /* (645) join_type ::= RIGHT */ - 523, /* (646) join_type ::= FULL */ - 524, /* (647) join_subtype ::= */ - 524, /* (648) join_subtype ::= OUTER */ - 524, /* (649) join_subtype ::= SEMI */ - 524, /* (650) join_subtype ::= ANTI */ - 524, /* (651) join_subtype ::= ASOF */ - 524, /* (652) join_subtype ::= WINDOW */ - 525, /* (653) join_on_clause_opt ::= */ - 525, /* (654) join_on_clause_opt ::= ON search_condition */ - 526, /* (655) window_offset_clause_opt ::= */ - 526, /* (656) window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP */ - 528, /* (657) window_offset_literal ::= NK_VARIABLE */ - 528, /* (658) window_offset_literal ::= NK_MINUS NK_VARIABLE */ - 527, /* (659) jlimit_clause_opt ::= */ - 527, /* (660) jlimit_clause_opt ::= JLIMIT NK_INTEGER */ - 529, /* (661) query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_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 */ - 530, /* (662) hint_list ::= */ - 530, /* (663) hint_list ::= NK_HINT */ - 532, /* (664) tag_mode_opt ::= */ - 532, /* (665) tag_mode_opt ::= TAGS */ - 531, /* (666) set_quantifier_opt ::= */ - 531, /* (667) set_quantifier_opt ::= DISTINCT */ - 531, /* (668) set_quantifier_opt ::= ALL */ - 533, /* (669) select_list ::= select_item */ - 533, /* (670) select_list ::= select_list NK_COMMA select_item */ - 541, /* (671) select_item ::= NK_STAR */ - 541, /* (672) select_item ::= common_expression */ - 541, /* (673) select_item ::= common_expression column_alias */ - 541, /* (674) select_item ::= common_expression AS column_alias */ - 541, /* (675) select_item ::= table_name NK_DOT NK_STAR */ - 468, /* (676) where_clause_opt ::= */ - 468, /* (677) where_clause_opt ::= WHERE search_condition */ - 534, /* (678) partition_by_clause_opt ::= */ - 534, /* (679) partition_by_clause_opt ::= PARTITION BY partition_list */ - 542, /* (680) partition_list ::= partition_item */ - 542, /* (681) partition_list ::= partition_list NK_COMMA partition_item */ - 543, /* (682) partition_item ::= expr_or_subquery */ - 543, /* (683) partition_item ::= expr_or_subquery column_alias */ - 543, /* (684) partition_item ::= expr_or_subquery AS column_alias */ - 538, /* (685) twindow_clause_opt ::= */ - 538, /* (686) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ - 538, /* (687) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ - 538, /* (688) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ - 538, /* (689) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ - 538, /* (690) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ - 538, /* (691) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */ - 538, /* (692) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - 461, /* (693) sliding_opt ::= */ - 461, /* (694) sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ - 544, /* (695) interval_sliding_duration_literal ::= NK_VARIABLE */ - 544, /* (696) interval_sliding_duration_literal ::= NK_STRING */ - 544, /* (697) interval_sliding_duration_literal ::= NK_INTEGER */ - 537, /* (698) fill_opt ::= */ - 537, /* (699) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - 537, /* (700) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ - 537, /* (701) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ - 545, /* (702) fill_mode ::= NONE */ - 545, /* (703) fill_mode ::= PREV */ - 545, /* (704) fill_mode ::= NULL */ - 545, /* (705) fill_mode ::= NULL_F */ - 545, /* (706) fill_mode ::= LINEAR */ - 545, /* (707) fill_mode ::= NEXT */ - 539, /* (708) group_by_clause_opt ::= */ - 539, /* (709) group_by_clause_opt ::= GROUP BY group_by_list */ - 546, /* (710) group_by_list ::= expr_or_subquery */ - 546, /* (711) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ - 540, /* (712) having_clause_opt ::= */ - 540, /* (713) having_clause_opt ::= HAVING search_condition */ - 535, /* (714) range_opt ::= */ - 535, /* (715) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ - 535, /* (716) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ - 536, /* (717) every_opt ::= */ - 536, /* (718) every_opt ::= EVERY NK_LP duration_literal NK_RP */ - 547, /* (719) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ - 548, /* (720) query_simple ::= query_specification */ - 548, /* (721) query_simple ::= union_query_expression */ - 552, /* (722) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ - 552, /* (723) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ - 553, /* (724) query_simple_or_subquery ::= query_simple */ - 553, /* (725) query_simple_or_subquery ::= subquery */ - 467, /* (726) query_or_subquery ::= query_expression */ - 467, /* (727) query_or_subquery ::= subquery */ - 549, /* (728) order_by_clause_opt ::= */ - 549, /* (729) order_by_clause_opt ::= ORDER BY sort_specification_list */ - 550, /* (730) slimit_clause_opt ::= */ - 550, /* (731) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - 550, /* (732) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - 550, /* (733) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - 551, /* (734) limit_clause_opt ::= */ - 551, /* (735) limit_clause_opt ::= LIMIT NK_INTEGER */ - 551, /* (736) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - 551, /* (737) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - 521, /* (738) subquery ::= NK_LP query_expression NK_RP */ - 521, /* (739) subquery ::= NK_LP subquery NK_RP */ - 398, /* (740) search_condition ::= common_expression */ - 554, /* (741) sort_specification_list ::= sort_specification */ - 554, /* (742) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - 555, /* (743) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ - 556, /* (744) ordering_specification_opt ::= */ - 556, /* (745) ordering_specification_opt ::= ASC */ - 556, /* (746) ordering_specification_opt ::= DESC */ - 557, /* (747) null_ordering_opt ::= */ - 557, /* (748) null_ordering_opt ::= NULLS FIRST */ - 557, /* (749) null_ordering_opt ::= NULLS LAST */ - 427, /* (750) column_options ::= */ - 427, /* (751) column_options ::= column_options PRIMARY KEY */ - 427, /* (752) column_options ::= column_options ENCODE NK_STRING */ - 427, /* (753) column_options ::= column_options COMPRESS NK_STRING */ - 427, /* (754) column_options ::= column_options LEVEL NK_STRING */ + 386, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ + 386, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ + 387, /* (2) account_options ::= */ + 387, /* (3) account_options ::= account_options PPS literal */ + 387, /* (4) account_options ::= account_options TSERIES literal */ + 387, /* (5) account_options ::= account_options STORAGE literal */ + 387, /* (6) account_options ::= account_options STREAMS literal */ + 387, /* (7) account_options ::= account_options QTIME literal */ + 387, /* (8) account_options ::= account_options DBS literal */ + 387, /* (9) account_options ::= account_options USERS literal */ + 387, /* (10) account_options ::= account_options CONNS literal */ + 387, /* (11) account_options ::= account_options STATE literal */ + 388, /* (12) alter_account_options ::= alter_account_option */ + 388, /* (13) alter_account_options ::= alter_account_options alter_account_option */ + 390, /* (14) alter_account_option ::= PASS literal */ + 390, /* (15) alter_account_option ::= PPS literal */ + 390, /* (16) alter_account_option ::= TSERIES literal */ + 390, /* (17) alter_account_option ::= STORAGE literal */ + 390, /* (18) alter_account_option ::= STREAMS literal */ + 390, /* (19) alter_account_option ::= QTIME literal */ + 390, /* (20) alter_account_option ::= DBS literal */ + 390, /* (21) alter_account_option ::= USERS literal */ + 390, /* (22) alter_account_option ::= CONNS literal */ + 390, /* (23) alter_account_option ::= STATE literal */ + 391, /* (24) ip_range_list ::= NK_STRING */ + 391, /* (25) ip_range_list ::= ip_range_list NK_COMMA NK_STRING */ + 392, /* (26) white_list ::= HOST ip_range_list */ + 393, /* (27) white_list_opt ::= */ + 393, /* (28) white_list_opt ::= white_list */ + 394, /* (29) is_import_opt ::= */ + 394, /* (30) is_import_opt ::= IS_IMPORT NK_INTEGER */ + 395, /* (31) is_createdb_opt ::= */ + 395, /* (32) is_createdb_opt ::= CREATEDB NK_INTEGER */ + 386, /* (33) cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt is_createdb_opt is_import_opt white_list_opt */ + 386, /* (34) cmd ::= ALTER USER user_name PASS NK_STRING */ + 386, /* (35) cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ + 386, /* (36) cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ + 386, /* (37) cmd ::= ALTER USER user_name CREATEDB NK_INTEGER */ + 386, /* (38) cmd ::= ALTER USER user_name ADD white_list */ + 386, /* (39) cmd ::= ALTER USER user_name DROP white_list */ + 386, /* (40) cmd ::= DROP USER user_name */ + 397, /* (41) sysinfo_opt ::= */ + 397, /* (42) sysinfo_opt ::= SYSINFO NK_INTEGER */ + 386, /* (43) cmd ::= GRANT privileges ON priv_level with_opt TO user_name */ + 386, /* (44) cmd ::= REVOKE privileges ON priv_level with_opt FROM user_name */ + 398, /* (45) privileges ::= ALL */ + 398, /* (46) privileges ::= priv_type_list */ + 398, /* (47) privileges ::= SUBSCRIBE */ + 401, /* (48) priv_type_list ::= priv_type */ + 401, /* (49) priv_type_list ::= priv_type_list NK_COMMA priv_type */ + 402, /* (50) priv_type ::= READ */ + 402, /* (51) priv_type ::= WRITE */ + 402, /* (52) priv_type ::= ALTER */ + 399, /* (53) priv_level ::= NK_STAR NK_DOT NK_STAR */ + 399, /* (54) priv_level ::= db_name NK_DOT NK_STAR */ + 399, /* (55) priv_level ::= db_name NK_DOT table_name */ + 399, /* (56) priv_level ::= topic_name */ + 400, /* (57) with_opt ::= */ + 400, /* (58) with_opt ::= WITH search_condition */ + 386, /* (59) cmd ::= CREATE ENCRYPT_KEY NK_STRING */ + 386, /* (60) cmd ::= CREATE DNODE dnode_endpoint */ + 386, /* (61) cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ + 386, /* (62) cmd ::= DROP DNODE NK_INTEGER force_opt */ + 386, /* (63) cmd ::= DROP DNODE dnode_endpoint force_opt */ + 386, /* (64) cmd ::= DROP DNODE NK_INTEGER unsafe_opt */ + 386, /* (65) cmd ::= DROP DNODE dnode_endpoint unsafe_opt */ + 386, /* (66) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ + 386, /* (67) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ + 386, /* (68) cmd ::= ALTER ALL DNODES NK_STRING */ + 386, /* (69) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ + 386, /* (70) cmd ::= RESTORE DNODE NK_INTEGER */ + 407, /* (71) dnode_endpoint ::= NK_STRING */ + 407, /* (72) dnode_endpoint ::= NK_ID */ + 407, /* (73) dnode_endpoint ::= NK_IPTOKEN */ + 408, /* (74) force_opt ::= */ + 408, /* (75) force_opt ::= FORCE */ + 409, /* (76) unsafe_opt ::= UNSAFE */ + 386, /* (77) cmd ::= ALTER CLUSTER NK_STRING */ + 386, /* (78) cmd ::= ALTER CLUSTER NK_STRING NK_STRING */ + 386, /* (79) cmd ::= ALTER LOCAL NK_STRING */ + 386, /* (80) cmd ::= ALTER LOCAL NK_STRING NK_STRING */ + 386, /* (81) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ + 386, /* (82) cmd ::= DROP QNODE ON DNODE NK_INTEGER */ + 386, /* (83) cmd ::= RESTORE QNODE ON DNODE NK_INTEGER */ + 386, /* (84) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ + 386, /* (85) cmd ::= DROP BNODE ON DNODE NK_INTEGER */ + 386, /* (86) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ + 386, /* (87) cmd ::= DROP SNODE ON DNODE NK_INTEGER */ + 386, /* (88) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ + 386, /* (89) cmd ::= DROP MNODE ON DNODE NK_INTEGER */ + 386, /* (90) cmd ::= RESTORE MNODE ON DNODE NK_INTEGER */ + 386, /* (91) cmd ::= RESTORE VNODE ON DNODE NK_INTEGER */ + 386, /* (92) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ + 386, /* (93) cmd ::= DROP DATABASE exists_opt db_name */ + 386, /* (94) cmd ::= USE db_name */ + 386, /* (95) cmd ::= ALTER DATABASE db_name alter_db_options */ + 386, /* (96) cmd ::= FLUSH DATABASE db_name */ + 386, /* (97) cmd ::= TRIM DATABASE db_name speed_opt */ + 386, /* (98) cmd ::= S3MIGRATE DATABASE db_name */ + 386, /* (99) cmd ::= COMPACT DATABASE db_name start_opt end_opt */ + 410, /* (100) not_exists_opt ::= IF NOT EXISTS */ + 410, /* (101) not_exists_opt ::= */ + 412, /* (102) exists_opt ::= IF EXISTS */ + 412, /* (103) exists_opt ::= */ + 411, /* (104) db_options ::= */ + 411, /* (105) db_options ::= db_options BUFFER NK_INTEGER */ + 411, /* (106) db_options ::= db_options CACHEMODEL NK_STRING */ + 411, /* (107) db_options ::= db_options CACHESIZE NK_INTEGER */ + 411, /* (108) db_options ::= db_options COMP NK_INTEGER */ + 411, /* (109) db_options ::= db_options DURATION NK_INTEGER */ + 411, /* (110) db_options ::= db_options DURATION NK_VARIABLE */ + 411, /* (111) db_options ::= db_options MAXROWS NK_INTEGER */ + 411, /* (112) db_options ::= db_options MINROWS NK_INTEGER */ + 411, /* (113) db_options ::= db_options KEEP integer_list */ + 411, /* (114) db_options ::= db_options KEEP variable_list */ + 411, /* (115) db_options ::= db_options PAGES NK_INTEGER */ + 411, /* (116) db_options ::= db_options PAGESIZE NK_INTEGER */ + 411, /* (117) db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ + 411, /* (118) db_options ::= db_options PRECISION NK_STRING */ + 411, /* (119) db_options ::= db_options REPLICA NK_INTEGER */ + 411, /* (120) db_options ::= db_options VGROUPS NK_INTEGER */ + 411, /* (121) db_options ::= db_options SINGLE_STABLE NK_INTEGER */ + 411, /* (122) db_options ::= db_options RETENTIONS retention_list */ + 411, /* (123) db_options ::= db_options SCHEMALESS NK_INTEGER */ + 411, /* (124) db_options ::= db_options WAL_LEVEL NK_INTEGER */ + 411, /* (125) db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ + 411, /* (126) db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ + 411, /* (127) db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ + 411, /* (128) db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ + 411, /* (129) db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ + 411, /* (130) db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ + 411, /* (131) db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ + 411, /* (132) db_options ::= db_options STT_TRIGGER NK_INTEGER */ + 411, /* (133) db_options ::= db_options TABLE_PREFIX signed */ + 411, /* (134) db_options ::= db_options TABLE_SUFFIX signed */ + 411, /* (135) db_options ::= db_options S3_CHUNKSIZE NK_INTEGER */ + 411, /* (136) db_options ::= db_options S3_KEEPLOCAL NK_INTEGER */ + 411, /* (137) db_options ::= db_options S3_KEEPLOCAL NK_VARIABLE */ + 411, /* (138) db_options ::= db_options S3_COMPACT NK_INTEGER */ + 411, /* (139) db_options ::= db_options KEEP_TIME_OFFSET NK_INTEGER */ + 411, /* (140) db_options ::= db_options ENCRYPT_ALGORITHM NK_STRING */ + 413, /* (141) alter_db_options ::= alter_db_option */ + 413, /* (142) alter_db_options ::= alter_db_options alter_db_option */ + 421, /* (143) alter_db_option ::= BUFFER NK_INTEGER */ + 421, /* (144) alter_db_option ::= CACHEMODEL NK_STRING */ + 421, /* (145) alter_db_option ::= CACHESIZE NK_INTEGER */ + 421, /* (146) alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ + 421, /* (147) alter_db_option ::= KEEP integer_list */ + 421, /* (148) alter_db_option ::= KEEP variable_list */ + 421, /* (149) alter_db_option ::= PAGES NK_INTEGER */ + 421, /* (150) alter_db_option ::= REPLICA NK_INTEGER */ + 421, /* (151) alter_db_option ::= WAL_LEVEL NK_INTEGER */ + 421, /* (152) alter_db_option ::= STT_TRIGGER NK_INTEGER */ + 421, /* (153) alter_db_option ::= MINROWS NK_INTEGER */ + 421, /* (154) alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */ + 421, /* (155) alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ + 421, /* (156) alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */ + 421, /* (157) alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ + 421, /* (158) alter_db_option ::= S3_KEEPLOCAL NK_INTEGER */ + 421, /* (159) alter_db_option ::= S3_KEEPLOCAL NK_VARIABLE */ + 421, /* (160) alter_db_option ::= S3_COMPACT NK_INTEGER */ + 421, /* (161) alter_db_option ::= KEEP_TIME_OFFSET NK_INTEGER */ + 421, /* (162) alter_db_option ::= ENCRYPT_ALGORITHM NK_STRING */ + 417, /* (163) integer_list ::= NK_INTEGER */ + 417, /* (164) integer_list ::= integer_list NK_COMMA NK_INTEGER */ + 418, /* (165) variable_list ::= NK_VARIABLE */ + 418, /* (166) variable_list ::= variable_list NK_COMMA NK_VARIABLE */ + 419, /* (167) retention_list ::= retention */ + 419, /* (168) retention_list ::= retention_list NK_COMMA retention */ + 422, /* (169) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ + 422, /* (170) retention ::= NK_MINUS NK_COLON NK_VARIABLE */ + 414, /* (171) speed_opt ::= */ + 414, /* (172) speed_opt ::= BWLIMIT NK_INTEGER */ + 415, /* (173) start_opt ::= */ + 415, /* (174) start_opt ::= START WITH NK_INTEGER */ + 415, /* (175) start_opt ::= START WITH NK_STRING */ + 415, /* (176) start_opt ::= START WITH TIMESTAMP NK_STRING */ + 416, /* (177) end_opt ::= */ + 416, /* (178) end_opt ::= END WITH NK_INTEGER */ + 416, /* (179) end_opt ::= END WITH NK_STRING */ + 416, /* (180) end_opt ::= END WITH TIMESTAMP NK_STRING */ + 386, /* (181) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ + 386, /* (182) cmd ::= CREATE TABLE multi_create_clause */ + 386, /* (183) cmd ::= CREATE TABLE not_exists_opt USING full_table_name NK_LP tag_list_opt NK_RP FILE NK_STRING */ + 386, /* (184) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ + 386, /* (185) cmd ::= DROP TABLE multi_drop_clause */ + 386, /* (186) cmd ::= DROP STABLE exists_opt full_table_name */ + 386, /* (187) cmd ::= ALTER TABLE alter_table_clause */ + 386, /* (188) cmd ::= ALTER STABLE alter_table_clause */ + 431, /* (189) alter_table_clause ::= full_table_name alter_table_options */ + 431, /* (190) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name column_options */ + 431, /* (191) alter_table_clause ::= full_table_name DROP COLUMN column_name */ + 431, /* (192) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ + 431, /* (193) alter_table_clause ::= full_table_name MODIFY COLUMN column_name column_options */ + 431, /* (194) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ + 431, /* (195) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ + 431, /* (196) alter_table_clause ::= full_table_name DROP TAG column_name */ + 431, /* (197) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ + 431, /* (198) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ + 431, /* (199) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ tags_literal */ + 427, /* (200) multi_create_clause ::= create_subtable_clause */ + 427, /* (201) multi_create_clause ::= multi_create_clause create_subtable_clause */ + 437, /* (202) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP tags_literal_list NK_RP table_options */ + 430, /* (203) multi_drop_clause ::= drop_table_clause */ + 430, /* (204) multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ + 440, /* (205) drop_table_clause ::= exists_opt full_table_name */ + 438, /* (206) specific_cols_opt ::= */ + 438, /* (207) specific_cols_opt ::= NK_LP col_name_list NK_RP */ + 423, /* (208) full_table_name ::= table_name */ + 423, /* (209) full_table_name ::= db_name NK_DOT table_name */ + 442, /* (210) tag_def_list ::= tag_def */ + 442, /* (211) tag_def_list ::= tag_def_list NK_COMMA tag_def */ + 443, /* (212) tag_def ::= column_name type_name */ + 424, /* (213) column_def_list ::= column_def */ + 424, /* (214) column_def_list ::= column_def_list NK_COMMA column_def */ + 444, /* (215) column_def ::= column_name type_name column_options */ + 434, /* (216) type_name ::= BOOL */ + 434, /* (217) type_name ::= TINYINT */ + 434, /* (218) type_name ::= SMALLINT */ + 434, /* (219) type_name ::= INT */ + 434, /* (220) type_name ::= INTEGER */ + 434, /* (221) type_name ::= BIGINT */ + 434, /* (222) type_name ::= FLOAT */ + 434, /* (223) type_name ::= DOUBLE */ + 434, /* (224) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ + 434, /* (225) type_name ::= TIMESTAMP */ + 434, /* (226) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ + 434, /* (227) type_name ::= TINYINT UNSIGNED */ + 434, /* (228) type_name ::= SMALLINT UNSIGNED */ + 434, /* (229) type_name ::= INT UNSIGNED */ + 434, /* (230) type_name ::= BIGINT UNSIGNED */ + 434, /* (231) type_name ::= JSON */ + 434, /* (232) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ + 434, /* (233) type_name ::= MEDIUMBLOB */ + 434, /* (234) type_name ::= BLOB */ + 434, /* (235) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ + 434, /* (236) type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ + 434, /* (237) type_name ::= DECIMAL */ + 434, /* (238) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ + 434, /* (239) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + 445, /* (240) type_name_default_len ::= BINARY */ + 445, /* (241) type_name_default_len ::= NCHAR */ + 445, /* (242) type_name_default_len ::= VARCHAR */ + 445, /* (243) type_name_default_len ::= VARBINARY */ + 425, /* (244) tags_def_opt ::= */ + 425, /* (245) tags_def_opt ::= tags_def */ + 429, /* (246) tags_def ::= TAGS NK_LP tag_def_list NK_RP */ + 426, /* (247) table_options ::= */ + 426, /* (248) table_options ::= table_options COMMENT NK_STRING */ + 426, /* (249) table_options ::= table_options MAX_DELAY duration_list */ + 426, /* (250) table_options ::= table_options WATERMARK duration_list */ + 426, /* (251) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ + 426, /* (252) table_options ::= table_options TTL NK_INTEGER */ + 426, /* (253) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ + 426, /* (254) table_options ::= table_options DELETE_MARK duration_list */ + 432, /* (255) alter_table_options ::= alter_table_option */ + 432, /* (256) alter_table_options ::= alter_table_options alter_table_option */ + 448, /* (257) alter_table_option ::= COMMENT NK_STRING */ + 448, /* (258) alter_table_option ::= TTL NK_INTEGER */ + 446, /* (259) duration_list ::= duration_literal */ + 446, /* (260) duration_list ::= duration_list NK_COMMA duration_literal */ + 447, /* (261) rollup_func_list ::= rollup_func_name */ + 447, /* (262) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ + 450, /* (263) rollup_func_name ::= function_name */ + 450, /* (264) rollup_func_name ::= FIRST */ + 450, /* (265) rollup_func_name ::= LAST */ + 441, /* (266) col_name_list ::= col_name */ + 441, /* (267) col_name_list ::= col_name_list NK_COMMA col_name */ + 452, /* (268) col_name ::= column_name */ + 386, /* (269) cmd ::= SHOW DNODES */ + 386, /* (270) cmd ::= SHOW USERS */ + 386, /* (271) cmd ::= SHOW USERS FULL */ + 386, /* (272) cmd ::= SHOW USER PRIVILEGES */ + 386, /* (273) cmd ::= SHOW db_kind_opt DATABASES */ + 386, /* (274) cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */ + 386, /* (275) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ + 386, /* (276) cmd ::= SHOW db_name_cond_opt VGROUPS */ + 386, /* (277) cmd ::= SHOW MNODES */ + 386, /* (278) cmd ::= SHOW QNODES */ + 386, /* (279) cmd ::= SHOW ARBGROUPS */ + 386, /* (280) cmd ::= SHOW FUNCTIONS */ + 386, /* (281) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ + 386, /* (282) cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ + 386, /* (283) cmd ::= SHOW STREAMS */ + 386, /* (284) cmd ::= SHOW ACCOUNTS */ + 386, /* (285) cmd ::= SHOW APPS */ + 386, /* (286) cmd ::= SHOW CONNECTIONS */ + 386, /* (287) cmd ::= SHOW LICENCES */ + 386, /* (288) cmd ::= SHOW GRANTS */ + 386, /* (289) cmd ::= SHOW GRANTS FULL */ + 386, /* (290) cmd ::= SHOW GRANTS LOGS */ + 386, /* (291) cmd ::= SHOW CLUSTER MACHINES */ + 386, /* (292) cmd ::= SHOW CREATE DATABASE db_name */ + 386, /* (293) cmd ::= SHOW CREATE TABLE full_table_name */ + 386, /* (294) cmd ::= SHOW CREATE STABLE full_table_name */ + 386, /* (295) cmd ::= SHOW ENCRYPTIONS */ + 386, /* (296) cmd ::= SHOW QUERIES */ + 386, /* (297) cmd ::= SHOW SCORES */ + 386, /* (298) cmd ::= SHOW TOPICS */ + 386, /* (299) cmd ::= SHOW VARIABLES */ + 386, /* (300) cmd ::= SHOW CLUSTER VARIABLES */ + 386, /* (301) cmd ::= SHOW LOCAL VARIABLES */ + 386, /* (302) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ + 386, /* (303) cmd ::= SHOW BNODES */ + 386, /* (304) cmd ::= SHOW SNODES */ + 386, /* (305) cmd ::= SHOW CLUSTER */ + 386, /* (306) cmd ::= SHOW TRANSACTIONS */ + 386, /* (307) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ + 386, /* (308) cmd ::= SHOW CONSUMERS */ + 386, /* (309) cmd ::= SHOW SUBSCRIPTIONS */ + 386, /* (310) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ + 386, /* (311) cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ + 386, /* (312) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ + 386, /* (313) cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ + 386, /* (314) cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ + 386, /* (315) cmd ::= SHOW VNODES */ + 386, /* (316) cmd ::= SHOW db_name_cond_opt ALIVE */ + 386, /* (317) cmd ::= SHOW CLUSTER ALIVE */ + 386, /* (318) cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt */ + 386, /* (319) cmd ::= SHOW CREATE VIEW full_table_name */ + 386, /* (320) cmd ::= SHOW COMPACTS */ + 386, /* (321) cmd ::= SHOW COMPACT NK_INTEGER */ + 454, /* (322) table_kind_db_name_cond_opt ::= */ + 454, /* (323) table_kind_db_name_cond_opt ::= table_kind */ + 454, /* (324) table_kind_db_name_cond_opt ::= db_name NK_DOT */ + 454, /* (325) table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */ + 459, /* (326) table_kind ::= NORMAL */ + 459, /* (327) table_kind ::= CHILD */ + 456, /* (328) db_name_cond_opt ::= */ + 456, /* (329) db_name_cond_opt ::= db_name NK_DOT */ + 455, /* (330) like_pattern_opt ::= */ + 455, /* (331) like_pattern_opt ::= LIKE NK_STRING */ + 457, /* (332) table_name_cond ::= table_name */ + 458, /* (333) from_db_opt ::= */ + 458, /* (334) from_db_opt ::= FROM db_name */ + 428, /* (335) tag_list_opt ::= */ + 428, /* (336) tag_list_opt ::= tag_item */ + 428, /* (337) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ + 460, /* (338) tag_item ::= TBNAME */ + 460, /* (339) tag_item ::= QTAGS */ + 460, /* (340) tag_item ::= column_name */ + 460, /* (341) tag_item ::= column_name column_alias */ + 460, /* (342) tag_item ::= column_name AS column_alias */ + 453, /* (343) db_kind_opt ::= */ + 453, /* (344) db_kind_opt ::= USER */ + 453, /* (345) db_kind_opt ::= SYSTEM */ + 386, /* (346) cmd ::= CREATE TSMA not_exists_opt tsma_name ON full_table_name tsma_func_list INTERVAL NK_LP duration_literal NK_RP */ + 386, /* (347) cmd ::= CREATE RECURSIVE TSMA not_exists_opt tsma_name ON full_table_name INTERVAL NK_LP duration_literal NK_RP */ + 386, /* (348) cmd ::= DROP TSMA exists_opt full_tsma_name */ + 386, /* (349) cmd ::= SHOW db_name_cond_opt TSMAS */ + 464, /* (350) full_tsma_name ::= tsma_name */ + 464, /* (351) full_tsma_name ::= db_name NK_DOT tsma_name */ + 463, /* (352) tsma_func_list ::= FUNCTION NK_LP func_list NK_RP */ + 386, /* (353) cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */ + 386, /* (354) cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */ + 386, /* (355) cmd ::= DROP INDEX exists_opt full_index_name */ + 467, /* (356) full_index_name ::= index_name */ + 467, /* (357) full_index_name ::= db_name NK_DOT index_name */ + 466, /* (358) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ + 466, /* (359) 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 */ + 465, /* (360) func_list ::= func */ + 465, /* (361) func_list ::= func_list NK_COMMA func */ + 471, /* (362) func ::= sma_func_name NK_LP expression_list NK_RP */ + 472, /* (363) sma_func_name ::= function_name */ + 472, /* (364) sma_func_name ::= COUNT */ + 472, /* (365) sma_func_name ::= FIRST */ + 472, /* (366) sma_func_name ::= LAST */ + 472, /* (367) sma_func_name ::= LAST_ROW */ + 470, /* (368) sma_stream_opt ::= */ + 470, /* (369) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ + 470, /* (370) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ + 470, /* (371) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ + 474, /* (372) with_meta ::= AS */ + 474, /* (373) with_meta ::= WITH META AS */ + 474, /* (374) with_meta ::= ONLY META AS */ + 386, /* (375) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ + 386, /* (376) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ + 386, /* (377) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ + 386, /* (378) cmd ::= DROP TOPIC exists_opt topic_name */ + 386, /* (379) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ + 386, /* (380) cmd ::= DESC full_table_name */ + 386, /* (381) cmd ::= DESCRIBE full_table_name */ + 386, /* (382) cmd ::= RESET QUERY CACHE */ + 386, /* (383) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ + 386, /* (384) cmd ::= EXPLAIN analyze_opt explain_options insert_query */ + 478, /* (385) analyze_opt ::= */ + 478, /* (386) analyze_opt ::= ANALYZE */ + 479, /* (387) explain_options ::= */ + 479, /* (388) explain_options ::= explain_options VERBOSE NK_BOOL */ + 479, /* (389) explain_options ::= explain_options RATIO NK_FLOAT */ + 386, /* (390) cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ + 386, /* (391) cmd ::= DROP FUNCTION exists_opt function_name */ + 482, /* (392) agg_func_opt ::= */ + 482, /* (393) agg_func_opt ::= AGGREGATE */ + 483, /* (394) bufsize_opt ::= */ + 483, /* (395) bufsize_opt ::= BUFSIZE NK_INTEGER */ + 484, /* (396) language_opt ::= */ + 484, /* (397) language_opt ::= LANGUAGE NK_STRING */ + 481, /* (398) or_replace_opt ::= */ + 481, /* (399) or_replace_opt ::= OR REPLACE */ + 386, /* (400) cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */ + 386, /* (401) cmd ::= DROP VIEW exists_opt full_view_name */ + 485, /* (402) full_view_name ::= view_name */ + 485, /* (403) full_view_name ::= db_name NK_DOT view_name */ + 386, /* (404) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */ + 386, /* (405) cmd ::= DROP STREAM exists_opt stream_name */ + 386, /* (406) cmd ::= PAUSE STREAM exists_opt stream_name */ + 386, /* (407) cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ + 489, /* (408) col_list_opt ::= */ + 489, /* (409) col_list_opt ::= NK_LP column_stream_def_list NK_RP */ + 493, /* (410) column_stream_def_list ::= column_stream_def */ + 493, /* (411) column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def */ + 494, /* (412) column_stream_def ::= column_name stream_col_options */ + 495, /* (413) stream_col_options ::= */ + 495, /* (414) stream_col_options ::= stream_col_options PRIMARY KEY */ + 490, /* (415) tag_def_or_ref_opt ::= */ + 490, /* (416) tag_def_or_ref_opt ::= tags_def */ + 490, /* (417) tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP */ + 488, /* (418) stream_options ::= */ + 488, /* (419) stream_options ::= stream_options TRIGGER AT_ONCE */ + 488, /* (420) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ + 488, /* (421) stream_options ::= stream_options TRIGGER FORCE_WINDOW_CLOSE */ + 488, /* (422) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ + 488, /* (423) stream_options ::= stream_options WATERMARK duration_literal */ + 488, /* (424) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ + 488, /* (425) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ + 488, /* (426) stream_options ::= stream_options DELETE_MARK duration_literal */ + 488, /* (427) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ + 491, /* (428) subtable_opt ::= */ + 491, /* (429) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + 492, /* (430) ignore_opt ::= */ + 492, /* (431) ignore_opt ::= IGNORE UNTREATED */ + 386, /* (432) cmd ::= KILL CONNECTION NK_INTEGER */ + 386, /* (433) cmd ::= KILL QUERY NK_STRING */ + 386, /* (434) cmd ::= KILL TRANSACTION NK_INTEGER */ + 386, /* (435) cmd ::= KILL COMPACT NK_INTEGER */ + 386, /* (436) cmd ::= BALANCE VGROUP */ + 386, /* (437) cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ + 386, /* (438) cmd ::= BALANCE VGROUP LEADER DATABASE db_name */ + 386, /* (439) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + 386, /* (440) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ + 386, /* (441) cmd ::= SPLIT VGROUP NK_INTEGER */ + 497, /* (442) on_vgroup_id ::= */ + 497, /* (443) on_vgroup_id ::= ON NK_INTEGER */ + 498, /* (444) dnode_list ::= DNODE NK_INTEGER */ + 498, /* (445) dnode_list ::= dnode_list DNODE NK_INTEGER */ + 386, /* (446) cmd ::= DELETE FROM full_table_name where_clause_opt */ + 386, /* (447) cmd ::= query_or_subquery */ + 386, /* (448) cmd ::= insert_query */ + 480, /* (449) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ + 480, /* (450) insert_query ::= INSERT INTO full_table_name query_or_subquery */ + 436, /* (451) tags_literal ::= NK_INTEGER */ + 436, /* (452) tags_literal ::= NK_INTEGER NK_PLUS duration_literal */ + 436, /* (453) tags_literal ::= NK_INTEGER NK_MINUS duration_literal */ + 436, /* (454) tags_literal ::= NK_PLUS NK_INTEGER */ + 436, /* (455) tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal */ + 436, /* (456) tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal */ + 436, /* (457) tags_literal ::= NK_MINUS NK_INTEGER */ + 436, /* (458) tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal */ + 436, /* (459) tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal */ + 436, /* (460) tags_literal ::= NK_FLOAT */ + 436, /* (461) tags_literal ::= NK_PLUS NK_FLOAT */ + 436, /* (462) tags_literal ::= NK_MINUS NK_FLOAT */ + 436, /* (463) tags_literal ::= NK_BIN */ + 436, /* (464) tags_literal ::= NK_BIN NK_PLUS duration_literal */ + 436, /* (465) tags_literal ::= NK_BIN NK_MINUS duration_literal */ + 436, /* (466) tags_literal ::= NK_PLUS NK_BIN */ + 436, /* (467) tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal */ + 436, /* (468) tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal */ + 436, /* (469) tags_literal ::= NK_MINUS NK_BIN */ + 436, /* (470) tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal */ + 436, /* (471) tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal */ + 436, /* (472) tags_literal ::= NK_HEX */ + 436, /* (473) tags_literal ::= NK_HEX NK_PLUS duration_literal */ + 436, /* (474) tags_literal ::= NK_HEX NK_MINUS duration_literal */ + 436, /* (475) tags_literal ::= NK_PLUS NK_HEX */ + 436, /* (476) tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal */ + 436, /* (477) tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal */ + 436, /* (478) tags_literal ::= NK_MINUS NK_HEX */ + 436, /* (479) tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal */ + 436, /* (480) tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal */ + 436, /* (481) tags_literal ::= NK_STRING */ + 436, /* (482) tags_literal ::= NK_STRING NK_PLUS duration_literal */ + 436, /* (483) tags_literal ::= NK_STRING NK_MINUS duration_literal */ + 436, /* (484) tags_literal ::= NK_BOOL */ + 436, /* (485) tags_literal ::= NULL */ + 436, /* (486) tags_literal ::= literal_func */ + 436, /* (487) tags_literal ::= literal_func NK_PLUS duration_literal */ + 436, /* (488) tags_literal ::= literal_func NK_MINUS duration_literal */ + 439, /* (489) tags_literal_list ::= tags_literal */ + 439, /* (490) tags_literal_list ::= tags_literal_list NK_COMMA tags_literal */ + 389, /* (491) literal ::= NK_INTEGER */ + 389, /* (492) literal ::= NK_FLOAT */ + 389, /* (493) literal ::= NK_STRING */ + 389, /* (494) literal ::= NK_BOOL */ + 389, /* (495) literal ::= TIMESTAMP NK_STRING */ + 389, /* (496) literal ::= duration_literal */ + 389, /* (497) literal ::= NULL */ + 389, /* (498) literal ::= NK_QUESTION */ + 449, /* (499) duration_literal ::= NK_VARIABLE */ + 420, /* (500) signed ::= NK_INTEGER */ + 420, /* (501) signed ::= NK_PLUS NK_INTEGER */ + 420, /* (502) signed ::= NK_MINUS NK_INTEGER */ + 420, /* (503) signed ::= NK_FLOAT */ + 420, /* (504) signed ::= NK_PLUS NK_FLOAT */ + 420, /* (505) signed ::= NK_MINUS NK_FLOAT */ + 500, /* (506) signed_literal ::= signed */ + 500, /* (507) signed_literal ::= NK_STRING */ + 500, /* (508) signed_literal ::= NK_BOOL */ + 500, /* (509) signed_literal ::= TIMESTAMP NK_STRING */ + 500, /* (510) signed_literal ::= duration_literal */ + 500, /* (511) signed_literal ::= NULL */ + 500, /* (512) signed_literal ::= literal_func */ + 500, /* (513) signed_literal ::= NK_QUESTION */ + 501, /* (514) literal_list ::= signed_literal */ + 501, /* (515) literal_list ::= literal_list NK_COMMA signed_literal */ + 403, /* (516) db_name ::= NK_ID */ + 404, /* (517) table_name ::= NK_ID */ + 433, /* (518) column_name ::= NK_ID */ + 451, /* (519) function_name ::= NK_ID */ + 486, /* (520) view_name ::= NK_ID */ + 502, /* (521) table_alias ::= NK_ID */ + 461, /* (522) column_alias ::= NK_ID */ + 461, /* (523) column_alias ::= NK_ALIAS */ + 396, /* (524) user_name ::= NK_ID */ + 405, /* (525) topic_name ::= NK_ID */ + 487, /* (526) stream_name ::= NK_ID */ + 477, /* (527) cgroup_name ::= NK_ID */ + 468, /* (528) index_name ::= NK_ID */ + 462, /* (529) tsma_name ::= NK_ID */ + 503, /* (530) expr_or_subquery ::= expression */ + 496, /* (531) expression ::= literal */ + 496, /* (532) expression ::= pseudo_column */ + 496, /* (533) expression ::= column_reference */ + 496, /* (534) expression ::= function_expression */ + 496, /* (535) expression ::= case_when_expression */ + 496, /* (536) expression ::= NK_LP expression NK_RP */ + 496, /* (537) expression ::= NK_PLUS expr_or_subquery */ + 496, /* (538) expression ::= NK_MINUS expr_or_subquery */ + 496, /* (539) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ + 496, /* (540) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ + 496, /* (541) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ + 496, /* (542) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ + 496, /* (543) expression ::= expr_or_subquery NK_REM expr_or_subquery */ + 496, /* (544) expression ::= column_reference NK_ARROW NK_STRING */ + 496, /* (545) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ + 496, /* (546) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ + 473, /* (547) expression_list ::= expr_or_subquery */ + 473, /* (548) expression_list ::= expression_list NK_COMMA expr_or_subquery */ + 505, /* (549) column_reference ::= column_name */ + 505, /* (550) column_reference ::= table_name NK_DOT column_name */ + 505, /* (551) column_reference ::= NK_ALIAS */ + 505, /* (552) column_reference ::= table_name NK_DOT NK_ALIAS */ + 504, /* (553) pseudo_column ::= ROWTS */ + 504, /* (554) pseudo_column ::= TBNAME */ + 504, /* (555) pseudo_column ::= table_name NK_DOT TBNAME */ + 504, /* (556) pseudo_column ::= QSTART */ + 504, /* (557) pseudo_column ::= QEND */ + 504, /* (558) pseudo_column ::= QDURATION */ + 504, /* (559) pseudo_column ::= WSTART */ + 504, /* (560) pseudo_column ::= WEND */ + 504, /* (561) pseudo_column ::= WDURATION */ + 504, /* (562) pseudo_column ::= IROWTS */ + 504, /* (563) pseudo_column ::= ISFILLED */ + 504, /* (564) pseudo_column ::= QTAGS */ + 506, /* (565) function_expression ::= function_name NK_LP expression_list NK_RP */ + 506, /* (566) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ + 506, /* (567) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ + 506, /* (568) function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP */ + 506, /* (569) function_expression ::= POSITION NK_LP expr_or_subquery IN expr_or_subquery NK_RP */ + 506, /* (570) function_expression ::= TRIM NK_LP expr_or_subquery NK_RP */ + 506, /* (571) function_expression ::= TRIM NK_LP trim_specification_type FROM expr_or_subquery NK_RP */ + 506, /* (572) function_expression ::= TRIM NK_LP trim_specification_type expr_or_subquery FROM expr_or_subquery NK_RP */ + 506, /* (573) function_expression ::= substr_func NK_LP expression_list NK_RP */ + 506, /* (574) function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery NK_RP */ + 506, /* (575) function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery FOR expr_or_subquery NK_RP */ + 506, /* (576) function_expression ::= REPLACE NK_LP expression_list NK_RP */ + 506, /* (577) function_expression ::= literal_func */ + 499, /* (578) literal_func ::= noarg_func NK_LP NK_RP */ + 499, /* (579) literal_func ::= NOW */ + 499, /* (580) literal_func ::= TODAY */ + 511, /* (581) substr_func ::= SUBSTR */ + 511, /* (582) substr_func ::= SUBSTRING */ + 510, /* (583) trim_specification_type ::= */ + 510, /* (584) trim_specification_type ::= BOTH */ + 510, /* (585) trim_specification_type ::= TRAILING */ + 510, /* (586) trim_specification_type ::= LEADING */ + 512, /* (587) noarg_func ::= NOW */ + 512, /* (588) noarg_func ::= TODAY */ + 512, /* (589) noarg_func ::= TIMEZONE */ + 512, /* (590) noarg_func ::= DATABASE */ + 512, /* (591) noarg_func ::= CLIENT_VERSION */ + 512, /* (592) noarg_func ::= SERVER_VERSION */ + 512, /* (593) noarg_func ::= SERVER_STATUS */ + 512, /* (594) noarg_func ::= CURRENT_USER */ + 512, /* (595) noarg_func ::= USER */ + 512, /* (596) noarg_func ::= PI */ + 508, /* (597) star_func ::= COUNT */ + 508, /* (598) star_func ::= FIRST */ + 508, /* (599) star_func ::= LAST */ + 508, /* (600) star_func ::= LAST_ROW */ + 509, /* (601) star_func_para_list ::= NK_STAR */ + 509, /* (602) star_func_para_list ::= other_para_list */ + 513, /* (603) other_para_list ::= star_func_para */ + 513, /* (604) other_para_list ::= other_para_list NK_COMMA star_func_para */ + 514, /* (605) star_func_para ::= expr_or_subquery */ + 514, /* (606) star_func_para ::= table_name NK_DOT NK_STAR */ + 507, /* (607) case_when_expression ::= CASE when_then_list case_when_else_opt END */ + 507, /* (608) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ + 515, /* (609) when_then_list ::= when_then_expr */ + 515, /* (610) when_then_list ::= when_then_list when_then_expr */ + 518, /* (611) when_then_expr ::= WHEN common_expression THEN common_expression */ + 516, /* (612) case_when_else_opt ::= */ + 516, /* (613) case_when_else_opt ::= ELSE common_expression */ + 519, /* (614) predicate ::= expr_or_subquery compare_op expr_or_subquery */ + 519, /* (615) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ + 519, /* (616) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ + 519, /* (617) predicate ::= expr_or_subquery IS NULL */ + 519, /* (618) predicate ::= expr_or_subquery IS NOT NULL */ + 519, /* (619) predicate ::= expr_or_subquery in_op in_predicate_value */ + 520, /* (620) compare_op ::= NK_LT */ + 520, /* (621) compare_op ::= NK_GT */ + 520, /* (622) compare_op ::= NK_LE */ + 520, /* (623) compare_op ::= NK_GE */ + 520, /* (624) compare_op ::= NK_NE */ + 520, /* (625) compare_op ::= NK_EQ */ + 520, /* (626) compare_op ::= LIKE */ + 520, /* (627) compare_op ::= NOT LIKE */ + 520, /* (628) compare_op ::= MATCH */ + 520, /* (629) compare_op ::= NMATCH */ + 520, /* (630) compare_op ::= CONTAINS */ + 521, /* (631) in_op ::= IN */ + 521, /* (632) in_op ::= NOT IN */ + 522, /* (633) in_predicate_value ::= NK_LP literal_list NK_RP */ + 523, /* (634) boolean_value_expression ::= boolean_primary */ + 523, /* (635) boolean_value_expression ::= NOT boolean_primary */ + 523, /* (636) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + 523, /* (637) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + 524, /* (638) boolean_primary ::= predicate */ + 524, /* (639) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ + 517, /* (640) common_expression ::= expr_or_subquery */ + 517, /* (641) common_expression ::= boolean_value_expression */ + 525, /* (642) from_clause_opt ::= */ + 525, /* (643) from_clause_opt ::= FROM table_reference_list */ + 526, /* (644) table_reference_list ::= table_reference */ + 526, /* (645) table_reference_list ::= table_reference_list NK_COMMA table_reference */ + 527, /* (646) table_reference ::= table_primary */ + 527, /* (647) table_reference ::= joined_table */ + 528, /* (648) table_primary ::= table_name alias_opt */ + 528, /* (649) table_primary ::= db_name NK_DOT table_name alias_opt */ + 528, /* (650) table_primary ::= subquery alias_opt */ + 528, /* (651) table_primary ::= parenthesized_joined_table */ + 530, /* (652) alias_opt ::= */ + 530, /* (653) alias_opt ::= table_alias */ + 530, /* (654) alias_opt ::= AS table_alias */ + 532, /* (655) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + 532, /* (656) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ + 529, /* (657) joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt */ + 533, /* (658) join_type ::= */ + 533, /* (659) join_type ::= INNER */ + 533, /* (660) join_type ::= LEFT */ + 533, /* (661) join_type ::= RIGHT */ + 533, /* (662) join_type ::= FULL */ + 534, /* (663) join_subtype ::= */ + 534, /* (664) join_subtype ::= OUTER */ + 534, /* (665) join_subtype ::= SEMI */ + 534, /* (666) join_subtype ::= ANTI */ + 534, /* (667) join_subtype ::= ASOF */ + 534, /* (668) join_subtype ::= WINDOW */ + 535, /* (669) join_on_clause_opt ::= */ + 535, /* (670) join_on_clause_opt ::= ON search_condition */ + 536, /* (671) window_offset_clause_opt ::= */ + 536, /* (672) window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP */ + 538, /* (673) window_offset_literal ::= NK_VARIABLE */ + 538, /* (674) window_offset_literal ::= NK_MINUS NK_VARIABLE */ + 537, /* (675) jlimit_clause_opt ::= */ + 537, /* (676) jlimit_clause_opt ::= JLIMIT NK_INTEGER */ + 539, /* (677) query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_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 */ + 540, /* (678) hint_list ::= */ + 540, /* (679) hint_list ::= NK_HINT */ + 542, /* (680) tag_mode_opt ::= */ + 542, /* (681) tag_mode_opt ::= TAGS */ + 541, /* (682) set_quantifier_opt ::= */ + 541, /* (683) set_quantifier_opt ::= DISTINCT */ + 541, /* (684) set_quantifier_opt ::= ALL */ + 543, /* (685) select_list ::= select_item */ + 543, /* (686) select_list ::= select_list NK_COMMA select_item */ + 551, /* (687) select_item ::= NK_STAR */ + 551, /* (688) select_item ::= common_expression */ + 551, /* (689) select_item ::= common_expression column_alias */ + 551, /* (690) select_item ::= common_expression AS column_alias */ + 551, /* (691) select_item ::= table_name NK_DOT NK_STAR */ + 476, /* (692) where_clause_opt ::= */ + 476, /* (693) where_clause_opt ::= WHERE search_condition */ + 544, /* (694) partition_by_clause_opt ::= */ + 544, /* (695) partition_by_clause_opt ::= PARTITION BY partition_list */ + 552, /* (696) partition_list ::= partition_item */ + 552, /* (697) partition_list ::= partition_list NK_COMMA partition_item */ + 553, /* (698) partition_item ::= expr_or_subquery */ + 553, /* (699) partition_item ::= expr_or_subquery column_alias */ + 553, /* (700) partition_item ::= expr_or_subquery AS column_alias */ + 548, /* (701) twindow_clause_opt ::= */ + 548, /* (702) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ + 548, /* (703) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ + 548, /* (704) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ + 548, /* (705) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ + 548, /* (706) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ + 548, /* (707) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */ + 548, /* (708) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + 469, /* (709) sliding_opt ::= */ + 469, /* (710) sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ + 554, /* (711) interval_sliding_duration_literal ::= NK_VARIABLE */ + 554, /* (712) interval_sliding_duration_literal ::= NK_STRING */ + 554, /* (713) interval_sliding_duration_literal ::= NK_INTEGER */ + 547, /* (714) fill_opt ::= */ + 547, /* (715) fill_opt ::= FILL NK_LP fill_mode NK_RP */ + 547, /* (716) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ + 547, /* (717) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ + 555, /* (718) fill_mode ::= NONE */ + 555, /* (719) fill_mode ::= PREV */ + 555, /* (720) fill_mode ::= NULL */ + 555, /* (721) fill_mode ::= NULL_F */ + 555, /* (722) fill_mode ::= LINEAR */ + 555, /* (723) fill_mode ::= NEXT */ + 549, /* (724) group_by_clause_opt ::= */ + 549, /* (725) group_by_clause_opt ::= GROUP BY group_by_list */ + 556, /* (726) group_by_list ::= expr_or_subquery */ + 556, /* (727) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ + 550, /* (728) having_clause_opt ::= */ + 550, /* (729) having_clause_opt ::= HAVING search_condition */ + 545, /* (730) range_opt ::= */ + 545, /* (731) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ + 545, /* (732) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ + 546, /* (733) every_opt ::= */ + 546, /* (734) every_opt ::= EVERY NK_LP duration_literal NK_RP */ + 557, /* (735) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ + 558, /* (736) query_simple ::= query_specification */ + 558, /* (737) query_simple ::= union_query_expression */ + 562, /* (738) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ + 562, /* (739) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ + 563, /* (740) query_simple_or_subquery ::= query_simple */ + 563, /* (741) query_simple_or_subquery ::= subquery */ + 475, /* (742) query_or_subquery ::= query_expression */ + 475, /* (743) query_or_subquery ::= subquery */ + 559, /* (744) order_by_clause_opt ::= */ + 559, /* (745) order_by_clause_opt ::= ORDER BY sort_specification_list */ + 560, /* (746) slimit_clause_opt ::= */ + 560, /* (747) slimit_clause_opt ::= SLIMIT NK_INTEGER */ + 560, /* (748) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + 560, /* (749) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + 561, /* (750) limit_clause_opt ::= */ + 561, /* (751) limit_clause_opt ::= LIMIT NK_INTEGER */ + 561, /* (752) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ + 561, /* (753) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + 531, /* (754) subquery ::= NK_LP query_expression NK_RP */ + 531, /* (755) subquery ::= NK_LP subquery NK_RP */ + 406, /* (756) search_condition ::= common_expression */ + 564, /* (757) sort_specification_list ::= sort_specification */ + 564, /* (758) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ + 565, /* (759) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ + 566, /* (760) ordering_specification_opt ::= */ + 566, /* (761) ordering_specification_opt ::= ASC */ + 566, /* (762) ordering_specification_opt ::= DESC */ + 567, /* (763) null_ordering_opt ::= */ + 567, /* (764) null_ordering_opt ::= NULLS FIRST */ + 567, /* (765) null_ordering_opt ::= NULLS LAST */ + 435, /* (766) column_options ::= */ + 435, /* (767) column_options ::= column_options PRIMARY KEY */ + 435, /* (768) column_options ::= column_options ENCODE NK_STRING */ + 435, /* (769) column_options ::= column_options COMPRESS NK_STRING */ + 435, /* (770) column_options ::= column_options LEVEL NK_STRING */ }; /* For rule J, yyRuleInfoNRhs[J] contains the negative of the number ** of symbols on the right-hand side of that rule. */ static const signed char yyRuleInfoNRhs[] = { - -6, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ - -4, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ + -6, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ + -4, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ 0, /* (2) account_options ::= */ - -3, /* (3) account_options ::= account_options PPS literal */ - -3, /* (4) account_options ::= account_options TSERIES literal */ - -3, /* (5) account_options ::= account_options STORAGE literal */ - -3, /* (6) account_options ::= account_options STREAMS literal */ - -3, /* (7) account_options ::= account_options QTIME literal */ - -3, /* (8) account_options ::= account_options DBS literal */ - -3, /* (9) account_options ::= account_options USERS literal */ - -3, /* (10) account_options ::= account_options CONNS literal */ - -3, /* (11) account_options ::= account_options STATE literal */ - -1, /* (12) alter_account_options ::= alter_account_option */ - -2, /* (13) alter_account_options ::= alter_account_options alter_account_option */ - -2, /* (14) alter_account_option ::= PASS literal */ - -2, /* (15) alter_account_option ::= PPS literal */ - -2, /* (16) alter_account_option ::= TSERIES literal */ - -2, /* (17) alter_account_option ::= STORAGE literal */ - -2, /* (18) alter_account_option ::= STREAMS literal */ - -2, /* (19) alter_account_option ::= QTIME literal */ - -2, /* (20) alter_account_option ::= DBS literal */ - -2, /* (21) alter_account_option ::= USERS literal */ - -2, /* (22) alter_account_option ::= CONNS literal */ - -2, /* (23) alter_account_option ::= STATE literal */ - -1, /* (24) ip_range_list ::= NK_STRING */ - -3, /* (25) ip_range_list ::= ip_range_list NK_COMMA NK_STRING */ - -2, /* (26) white_list ::= HOST ip_range_list */ + -3, /* (3) account_options ::= account_options PPS literal */ + -3, /* (4) account_options ::= account_options TSERIES literal */ + -3, /* (5) account_options ::= account_options STORAGE literal */ + -3, /* (6) account_options ::= account_options STREAMS literal */ + -3, /* (7) account_options ::= account_options QTIME literal */ + -3, /* (8) account_options ::= account_options DBS literal */ + -3, /* (9) account_options ::= account_options USERS literal */ + -3, /* (10) account_options ::= account_options CONNS literal */ + -3, /* (11) account_options ::= account_options STATE literal */ + -1, /* (12) alter_account_options ::= alter_account_option */ + -2, /* (13) alter_account_options ::= alter_account_options alter_account_option */ + -2, /* (14) alter_account_option ::= PASS literal */ + -2, /* (15) alter_account_option ::= PPS literal */ + -2, /* (16) alter_account_option ::= TSERIES literal */ + -2, /* (17) alter_account_option ::= STORAGE literal */ + -2, /* (18) alter_account_option ::= STREAMS literal */ + -2, /* (19) alter_account_option ::= QTIME literal */ + -2, /* (20) alter_account_option ::= DBS literal */ + -2, /* (21) alter_account_option ::= USERS literal */ + -2, /* (22) alter_account_option ::= CONNS literal */ + -2, /* (23) alter_account_option ::= STATE literal */ + -1, /* (24) ip_range_list ::= NK_STRING */ + -3, /* (25) ip_range_list ::= ip_range_list NK_COMMA NK_STRING */ + -2, /* (26) white_list ::= HOST ip_range_list */ 0, /* (27) white_list_opt ::= */ - -1, /* (28) white_list_opt ::= white_list */ + -1, /* (28) white_list_opt ::= white_list */ 0, /* (29) is_import_opt ::= */ - -2, /* (30) is_import_opt ::= IS_IMPORT NK_INTEGER */ + -2, /* (30) is_import_opt ::= IS_IMPORT NK_INTEGER */ 0, /* (31) is_createdb_opt ::= */ - -2, /* (32) is_createdb_opt ::= CREATEDB NK_INTEGER */ - -9, /* (33) cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt is_createdb_opt is_import_opt white_list_opt */ - -5, /* (34) cmd ::= ALTER USER user_name PASS NK_STRING */ - -5, /* (35) cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ - -5, /* (36) cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ - -5, /* (37) cmd ::= ALTER USER user_name CREATEDB NK_INTEGER */ - -5, /* (38) cmd ::= ALTER USER user_name ADD white_list */ - -5, /* (39) cmd ::= ALTER USER user_name DROP white_list */ - -3, /* (40) cmd ::= DROP USER user_name */ + -2, /* (32) is_createdb_opt ::= CREATEDB NK_INTEGER */ + -9, /* (33) cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt is_createdb_opt is_import_opt white_list_opt */ + -5, /* (34) cmd ::= ALTER USER user_name PASS NK_STRING */ + -5, /* (35) cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ + -5, /* (36) cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ + -5, /* (37) cmd ::= ALTER USER user_name CREATEDB NK_INTEGER */ + -5, /* (38) cmd ::= ALTER USER user_name ADD white_list */ + -5, /* (39) cmd ::= ALTER USER user_name DROP white_list */ + -3, /* (40) cmd ::= DROP USER user_name */ 0, /* (41) sysinfo_opt ::= */ - -2, /* (42) sysinfo_opt ::= SYSINFO NK_INTEGER */ - -7, /* (43) cmd ::= GRANT privileges ON priv_level with_opt TO user_name */ - -7, /* (44) cmd ::= REVOKE privileges ON priv_level with_opt FROM user_name */ - -1, /* (45) privileges ::= ALL */ - -1, /* (46) privileges ::= priv_type_list */ - -1, /* (47) privileges ::= SUBSCRIBE */ - -1, /* (48) priv_type_list ::= priv_type */ - -3, /* (49) priv_type_list ::= priv_type_list NK_COMMA priv_type */ - -1, /* (50) priv_type ::= READ */ - -1, /* (51) priv_type ::= WRITE */ - -1, /* (52) priv_type ::= ALTER */ - -3, /* (53) priv_level ::= NK_STAR NK_DOT NK_STAR */ - -3, /* (54) priv_level ::= db_name NK_DOT NK_STAR */ - -3, /* (55) priv_level ::= db_name NK_DOT table_name */ - -1, /* (56) priv_level ::= topic_name */ + -2, /* (42) sysinfo_opt ::= SYSINFO NK_INTEGER */ + -7, /* (43) cmd ::= GRANT privileges ON priv_level with_opt TO user_name */ + -7, /* (44) cmd ::= REVOKE privileges ON priv_level with_opt FROM user_name */ + -1, /* (45) privileges ::= ALL */ + -1, /* (46) privileges ::= priv_type_list */ + -1, /* (47) privileges ::= SUBSCRIBE */ + -1, /* (48) priv_type_list ::= priv_type */ + -3, /* (49) priv_type_list ::= priv_type_list NK_COMMA priv_type */ + -1, /* (50) priv_type ::= READ */ + -1, /* (51) priv_type ::= WRITE */ + -1, /* (52) priv_type ::= ALTER */ + -3, /* (53) priv_level ::= NK_STAR NK_DOT NK_STAR */ + -3, /* (54) priv_level ::= db_name NK_DOT NK_STAR */ + -3, /* (55) priv_level ::= db_name NK_DOT table_name */ + -1, /* (56) priv_level ::= topic_name */ 0, /* (57) with_opt ::= */ - -2, /* (58) with_opt ::= WITH search_condition */ - -3, /* (59) cmd ::= CREATE ENCRYPT_KEY NK_STRING */ - -3, /* (60) cmd ::= CREATE DNODE dnode_endpoint */ - -5, /* (61) cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ - -4, /* (62) cmd ::= DROP DNODE NK_INTEGER force_opt */ - -4, /* (63) cmd ::= DROP DNODE dnode_endpoint force_opt */ - -4, /* (64) cmd ::= DROP DNODE NK_INTEGER unsafe_opt */ - -4, /* (65) cmd ::= DROP DNODE dnode_endpoint unsafe_opt */ - -4, /* (66) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ - -5, /* (67) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ - -4, /* (68) cmd ::= ALTER ALL DNODES NK_STRING */ - -5, /* (69) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ - -3, /* (70) cmd ::= RESTORE DNODE NK_INTEGER */ - -1, /* (71) dnode_endpoint ::= NK_STRING */ - -1, /* (72) dnode_endpoint ::= NK_ID */ - -1, /* (73) dnode_endpoint ::= NK_IPTOKEN */ + -2, /* (58) with_opt ::= WITH search_condition */ + -3, /* (59) cmd ::= CREATE ENCRYPT_KEY NK_STRING */ + -3, /* (60) cmd ::= CREATE DNODE dnode_endpoint */ + -5, /* (61) cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ + -4, /* (62) cmd ::= DROP DNODE NK_INTEGER force_opt */ + -4, /* (63) cmd ::= DROP DNODE dnode_endpoint force_opt */ + -4, /* (64) cmd ::= DROP DNODE NK_INTEGER unsafe_opt */ + -4, /* (65) cmd ::= DROP DNODE dnode_endpoint unsafe_opt */ + -4, /* (66) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ + -5, /* (67) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ + -4, /* (68) cmd ::= ALTER ALL DNODES NK_STRING */ + -5, /* (69) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ + -3, /* (70) cmd ::= RESTORE DNODE NK_INTEGER */ + -1, /* (71) dnode_endpoint ::= NK_STRING */ + -1, /* (72) dnode_endpoint ::= NK_ID */ + -1, /* (73) dnode_endpoint ::= NK_IPTOKEN */ 0, /* (74) force_opt ::= */ - -1, /* (75) force_opt ::= FORCE */ - -1, /* (76) unsafe_opt ::= UNSAFE */ - -3, /* (77) cmd ::= ALTER CLUSTER NK_STRING */ - -4, /* (78) cmd ::= ALTER CLUSTER NK_STRING NK_STRING */ - -3, /* (79) cmd ::= ALTER LOCAL NK_STRING */ - -4, /* (80) cmd ::= ALTER LOCAL NK_STRING NK_STRING */ - -5, /* (81) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ - -5, /* (82) cmd ::= DROP QNODE ON DNODE NK_INTEGER */ - -5, /* (83) cmd ::= RESTORE QNODE ON DNODE NK_INTEGER */ - -5, /* (84) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ - -5, /* (85) cmd ::= DROP BNODE ON DNODE NK_INTEGER */ - -5, /* (86) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ - -5, /* (87) cmd ::= DROP SNODE ON DNODE NK_INTEGER */ - -5, /* (88) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ - -5, /* (89) cmd ::= DROP MNODE ON DNODE NK_INTEGER */ - -5, /* (90) cmd ::= RESTORE MNODE ON DNODE NK_INTEGER */ - -5, /* (91) cmd ::= RESTORE VNODE ON DNODE NK_INTEGER */ - -5, /* (92) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ - -4, /* (93) cmd ::= DROP DATABASE exists_opt db_name */ - -2, /* (94) cmd ::= USE db_name */ - -4, /* (95) cmd ::= ALTER DATABASE db_name alter_db_options */ - -3, /* (96) cmd ::= FLUSH DATABASE db_name */ - -4, /* (97) cmd ::= TRIM DATABASE db_name speed_opt */ - -3, /* (98) cmd ::= S3MIGRATE DATABASE db_name */ - -5, /* (99) cmd ::= COMPACT DATABASE db_name start_opt end_opt */ - -3, /* (100) not_exists_opt ::= IF NOT EXISTS */ + -1, /* (75) force_opt ::= FORCE */ + -1, /* (76) unsafe_opt ::= UNSAFE */ + -3, /* (77) cmd ::= ALTER CLUSTER NK_STRING */ + -4, /* (78) cmd ::= ALTER CLUSTER NK_STRING NK_STRING */ + -3, /* (79) cmd ::= ALTER LOCAL NK_STRING */ + -4, /* (80) cmd ::= ALTER LOCAL NK_STRING NK_STRING */ + -5, /* (81) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ + -5, /* (82) cmd ::= DROP QNODE ON DNODE NK_INTEGER */ + -5, /* (83) cmd ::= RESTORE QNODE ON DNODE NK_INTEGER */ + -5, /* (84) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ + -5, /* (85) cmd ::= DROP BNODE ON DNODE NK_INTEGER */ + -5, /* (86) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ + -5, /* (87) cmd ::= DROP SNODE ON DNODE NK_INTEGER */ + -5, /* (88) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ + -5, /* (89) cmd ::= DROP MNODE ON DNODE NK_INTEGER */ + -5, /* (90) cmd ::= RESTORE MNODE ON DNODE NK_INTEGER */ + -5, /* (91) cmd ::= RESTORE VNODE ON DNODE NK_INTEGER */ + -5, /* (92) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ + -4, /* (93) cmd ::= DROP DATABASE exists_opt db_name */ + -2, /* (94) cmd ::= USE db_name */ + -4, /* (95) cmd ::= ALTER DATABASE db_name alter_db_options */ + -3, /* (96) cmd ::= FLUSH DATABASE db_name */ + -4, /* (97) cmd ::= TRIM DATABASE db_name speed_opt */ + -3, /* (98) cmd ::= S3MIGRATE DATABASE db_name */ + -5, /* (99) cmd ::= COMPACT DATABASE db_name start_opt end_opt */ + -3, /* (100) not_exists_opt ::= IF NOT EXISTS */ 0, /* (101) not_exists_opt ::= */ - -2, /* (102) exists_opt ::= IF EXISTS */ + -2, /* (102) exists_opt ::= IF EXISTS */ 0, /* (103) exists_opt ::= */ 0, /* (104) db_options ::= */ - -3, /* (105) db_options ::= db_options BUFFER NK_INTEGER */ - -3, /* (106) db_options ::= db_options CACHEMODEL NK_STRING */ - -3, /* (107) db_options ::= db_options CACHESIZE NK_INTEGER */ - -3, /* (108) db_options ::= db_options COMP NK_INTEGER */ - -3, /* (109) db_options ::= db_options DURATION NK_INTEGER */ - -3, /* (110) db_options ::= db_options DURATION NK_VARIABLE */ - -3, /* (111) db_options ::= db_options MAXROWS NK_INTEGER */ - -3, /* (112) db_options ::= db_options MINROWS NK_INTEGER */ - -3, /* (113) db_options ::= db_options KEEP integer_list */ - -3, /* (114) db_options ::= db_options KEEP variable_list */ - -3, /* (115) db_options ::= db_options PAGES NK_INTEGER */ - -3, /* (116) db_options ::= db_options PAGESIZE NK_INTEGER */ - -3, /* (117) db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ - -3, /* (118) db_options ::= db_options PRECISION NK_STRING */ - -3, /* (119) db_options ::= db_options REPLICA NK_INTEGER */ - -3, /* (120) db_options ::= db_options VGROUPS NK_INTEGER */ - -3, /* (121) db_options ::= db_options SINGLE_STABLE NK_INTEGER */ - -3, /* (122) db_options ::= db_options RETENTIONS retention_list */ - -3, /* (123) db_options ::= db_options SCHEMALESS NK_INTEGER */ - -3, /* (124) db_options ::= db_options WAL_LEVEL NK_INTEGER */ - -3, /* (125) db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ - -3, /* (126) db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ - -4, /* (127) db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ - -3, /* (128) db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ - -4, /* (129) db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ - -3, /* (130) db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ - -3, /* (131) db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ - -3, /* (132) db_options ::= db_options STT_TRIGGER NK_INTEGER */ - -3, /* (133) db_options ::= db_options TABLE_PREFIX signed */ - -3, /* (134) db_options ::= db_options TABLE_SUFFIX signed */ - -3, /* (135) db_options ::= db_options S3_CHUNKSIZE NK_INTEGER */ - -3, /* (136) db_options ::= db_options S3_KEEPLOCAL NK_INTEGER */ - -3, /* (137) db_options ::= db_options S3_KEEPLOCAL NK_VARIABLE */ - -3, /* (138) db_options ::= db_options S3_COMPACT NK_INTEGER */ - -3, /* (139) db_options ::= db_options KEEP_TIME_OFFSET NK_INTEGER */ - -3, /* (140) db_options ::= db_options ENCRYPT_ALGORITHM NK_STRING */ - -1, /* (141) alter_db_options ::= alter_db_option */ - -2, /* (142) alter_db_options ::= alter_db_options alter_db_option */ - -2, /* (143) alter_db_option ::= BUFFER NK_INTEGER */ - -2, /* (144) alter_db_option ::= CACHEMODEL NK_STRING */ - -2, /* (145) alter_db_option ::= CACHESIZE NK_INTEGER */ - -2, /* (146) alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ - -2, /* (147) alter_db_option ::= KEEP integer_list */ - -2, /* (148) alter_db_option ::= KEEP variable_list */ - -2, /* (149) alter_db_option ::= PAGES NK_INTEGER */ - -2, /* (150) alter_db_option ::= REPLICA NK_INTEGER */ - -2, /* (151) alter_db_option ::= WAL_LEVEL NK_INTEGER */ - -2, /* (152) alter_db_option ::= STT_TRIGGER NK_INTEGER */ - -2, /* (153) alter_db_option ::= MINROWS NK_INTEGER */ - -2, /* (154) alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */ - -3, /* (155) alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ - -2, /* (156) alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */ - -3, /* (157) alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ - -2, /* (158) alter_db_option ::= S3_KEEPLOCAL NK_INTEGER */ - -2, /* (159) alter_db_option ::= S3_KEEPLOCAL NK_VARIABLE */ - -2, /* (160) alter_db_option ::= S3_COMPACT NK_INTEGER */ - -2, /* (161) alter_db_option ::= KEEP_TIME_OFFSET NK_INTEGER */ - -2, /* (162) alter_db_option ::= ENCRYPT_ALGORITHM NK_STRING */ - -1, /* (163) integer_list ::= NK_INTEGER */ - -3, /* (164) integer_list ::= integer_list NK_COMMA NK_INTEGER */ - -1, /* (165) variable_list ::= NK_VARIABLE */ - -3, /* (166) variable_list ::= variable_list NK_COMMA NK_VARIABLE */ - -1, /* (167) retention_list ::= retention */ - -3, /* (168) retention_list ::= retention_list NK_COMMA retention */ - -3, /* (169) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ - -3, /* (170) retention ::= NK_MINUS NK_COLON NK_VARIABLE */ + -3, /* (105) db_options ::= db_options BUFFER NK_INTEGER */ + -3, /* (106) db_options ::= db_options CACHEMODEL NK_STRING */ + -3, /* (107) db_options ::= db_options CACHESIZE NK_INTEGER */ + -3, /* (108) db_options ::= db_options COMP NK_INTEGER */ + -3, /* (109) db_options ::= db_options DURATION NK_INTEGER */ + -3, /* (110) db_options ::= db_options DURATION NK_VARIABLE */ + -3, /* (111) db_options ::= db_options MAXROWS NK_INTEGER */ + -3, /* (112) db_options ::= db_options MINROWS NK_INTEGER */ + -3, /* (113) db_options ::= db_options KEEP integer_list */ + -3, /* (114) db_options ::= db_options KEEP variable_list */ + -3, /* (115) db_options ::= db_options PAGES NK_INTEGER */ + -3, /* (116) db_options ::= db_options PAGESIZE NK_INTEGER */ + -3, /* (117) db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ + -3, /* (118) db_options ::= db_options PRECISION NK_STRING */ + -3, /* (119) db_options ::= db_options REPLICA NK_INTEGER */ + -3, /* (120) db_options ::= db_options VGROUPS NK_INTEGER */ + -3, /* (121) db_options ::= db_options SINGLE_STABLE NK_INTEGER */ + -3, /* (122) db_options ::= db_options RETENTIONS retention_list */ + -3, /* (123) db_options ::= db_options SCHEMALESS NK_INTEGER */ + -3, /* (124) db_options ::= db_options WAL_LEVEL NK_INTEGER */ + -3, /* (125) db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ + -3, /* (126) db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ + -4, /* (127) db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ + -3, /* (128) db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ + -4, /* (129) db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ + -3, /* (130) db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ + -3, /* (131) db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ + -3, /* (132) db_options ::= db_options STT_TRIGGER NK_INTEGER */ + -3, /* (133) db_options ::= db_options TABLE_PREFIX signed */ + -3, /* (134) db_options ::= db_options TABLE_SUFFIX signed */ + -3, /* (135) db_options ::= db_options S3_CHUNKSIZE NK_INTEGER */ + -3, /* (136) db_options ::= db_options S3_KEEPLOCAL NK_INTEGER */ + -3, /* (137) db_options ::= db_options S3_KEEPLOCAL NK_VARIABLE */ + -3, /* (138) db_options ::= db_options S3_COMPACT NK_INTEGER */ + -3, /* (139) db_options ::= db_options KEEP_TIME_OFFSET NK_INTEGER */ + -3, /* (140) db_options ::= db_options ENCRYPT_ALGORITHM NK_STRING */ + -1, /* (141) alter_db_options ::= alter_db_option */ + -2, /* (142) alter_db_options ::= alter_db_options alter_db_option */ + -2, /* (143) alter_db_option ::= BUFFER NK_INTEGER */ + -2, /* (144) alter_db_option ::= CACHEMODEL NK_STRING */ + -2, /* (145) alter_db_option ::= CACHESIZE NK_INTEGER */ + -2, /* (146) alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ + -2, /* (147) alter_db_option ::= KEEP integer_list */ + -2, /* (148) alter_db_option ::= KEEP variable_list */ + -2, /* (149) alter_db_option ::= PAGES NK_INTEGER */ + -2, /* (150) alter_db_option ::= REPLICA NK_INTEGER */ + -2, /* (151) alter_db_option ::= WAL_LEVEL NK_INTEGER */ + -2, /* (152) alter_db_option ::= STT_TRIGGER NK_INTEGER */ + -2, /* (153) alter_db_option ::= MINROWS NK_INTEGER */ + -2, /* (154) alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */ + -3, /* (155) alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ + -2, /* (156) alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */ + -3, /* (157) alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ + -2, /* (158) alter_db_option ::= S3_KEEPLOCAL NK_INTEGER */ + -2, /* (159) alter_db_option ::= S3_KEEPLOCAL NK_VARIABLE */ + -2, /* (160) alter_db_option ::= S3_COMPACT NK_INTEGER */ + -2, /* (161) alter_db_option ::= KEEP_TIME_OFFSET NK_INTEGER */ + -2, /* (162) alter_db_option ::= ENCRYPT_ALGORITHM NK_STRING */ + -1, /* (163) integer_list ::= NK_INTEGER */ + -3, /* (164) integer_list ::= integer_list NK_COMMA NK_INTEGER */ + -1, /* (165) variable_list ::= NK_VARIABLE */ + -3, /* (166) variable_list ::= variable_list NK_COMMA NK_VARIABLE */ + -1, /* (167) retention_list ::= retention */ + -3, /* (168) retention_list ::= retention_list NK_COMMA retention */ + -3, /* (169) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ + -3, /* (170) retention ::= NK_MINUS NK_COLON NK_VARIABLE */ 0, /* (171) speed_opt ::= */ - -2, /* (172) speed_opt ::= BWLIMIT NK_INTEGER */ + -2, /* (172) speed_opt ::= BWLIMIT NK_INTEGER */ 0, /* (173) start_opt ::= */ - -3, /* (174) start_opt ::= START WITH NK_INTEGER */ - -3, /* (175) start_opt ::= START WITH NK_STRING */ - -4, /* (176) start_opt ::= START WITH TIMESTAMP NK_STRING */ + -3, /* (174) start_opt ::= START WITH NK_INTEGER */ + -3, /* (175) start_opt ::= START WITH NK_STRING */ + -4, /* (176) start_opt ::= START WITH TIMESTAMP NK_STRING */ 0, /* (177) end_opt ::= */ - -3, /* (178) end_opt ::= END WITH NK_INTEGER */ - -3, /* (179) end_opt ::= END WITH NK_STRING */ - -4, /* (180) end_opt ::= END WITH TIMESTAMP NK_STRING */ - -9, /* (181) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ - -3, /* (182) cmd ::= CREATE TABLE multi_create_clause */ - -10, /* (183) cmd ::= CREATE TABLE not_exists_opt USING full_table_name NK_LP tag_list_opt NK_RP FILE NK_STRING */ - -9, /* (184) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ - -3, /* (185) cmd ::= DROP TABLE multi_drop_clause */ - -4, /* (186) cmd ::= DROP STABLE exists_opt full_table_name */ - -3, /* (187) cmd ::= ALTER TABLE alter_table_clause */ - -3, /* (188) cmd ::= ALTER STABLE alter_table_clause */ - -2, /* (189) alter_table_clause ::= full_table_name alter_table_options */ - -6, /* (190) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name column_options */ - -4, /* (191) alter_table_clause ::= full_table_name DROP COLUMN column_name */ - -5, /* (192) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ - -5, /* (193) alter_table_clause ::= full_table_name MODIFY COLUMN column_name column_options */ - -5, /* (194) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ - -5, /* (195) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ - -4, /* (196) alter_table_clause ::= full_table_name DROP TAG column_name */ - -5, /* (197) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ - -5, /* (198) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ - -6, /* (199) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ tags_literal */ - -1, /* (200) multi_create_clause ::= create_subtable_clause */ - -2, /* (201) multi_create_clause ::= multi_create_clause create_subtable_clause */ - -10, /* (202) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP tags_literal_list NK_RP table_options */ - -1, /* (203) multi_drop_clause ::= drop_table_clause */ - -3, /* (204) multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ - -2, /* (205) drop_table_clause ::= exists_opt full_table_name */ + -3, /* (178) end_opt ::= END WITH NK_INTEGER */ + -3, /* (179) end_opt ::= END WITH NK_STRING */ + -4, /* (180) end_opt ::= END WITH TIMESTAMP NK_STRING */ + -9, /* (181) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ + -3, /* (182) cmd ::= CREATE TABLE multi_create_clause */ + -10, /* (183) cmd ::= CREATE TABLE not_exists_opt USING full_table_name NK_LP tag_list_opt NK_RP FILE NK_STRING */ + -9, /* (184) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ + -3, /* (185) cmd ::= DROP TABLE multi_drop_clause */ + -4, /* (186) cmd ::= DROP STABLE exists_opt full_table_name */ + -3, /* (187) cmd ::= ALTER TABLE alter_table_clause */ + -3, /* (188) cmd ::= ALTER STABLE alter_table_clause */ + -2, /* (189) alter_table_clause ::= full_table_name alter_table_options */ + -6, /* (190) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name column_options */ + -4, /* (191) alter_table_clause ::= full_table_name DROP COLUMN column_name */ + -5, /* (192) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ + -5, /* (193) alter_table_clause ::= full_table_name MODIFY COLUMN column_name column_options */ + -5, /* (194) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ + -5, /* (195) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ + -4, /* (196) alter_table_clause ::= full_table_name DROP TAG column_name */ + -5, /* (197) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ + -5, /* (198) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ + -6, /* (199) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ tags_literal */ + -1, /* (200) multi_create_clause ::= create_subtable_clause */ + -2, /* (201) multi_create_clause ::= multi_create_clause create_subtable_clause */ + -10, /* (202) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP tags_literal_list NK_RP table_options */ + -1, /* (203) multi_drop_clause ::= drop_table_clause */ + -3, /* (204) multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ + -2, /* (205) drop_table_clause ::= exists_opt full_table_name */ 0, /* (206) specific_cols_opt ::= */ - -3, /* (207) specific_cols_opt ::= NK_LP col_name_list NK_RP */ - -1, /* (208) full_table_name ::= table_name */ - -3, /* (209) full_table_name ::= db_name NK_DOT table_name */ - -1, /* (210) tag_def_list ::= tag_def */ - -3, /* (211) tag_def_list ::= tag_def_list NK_COMMA tag_def */ - -2, /* (212) tag_def ::= column_name type_name */ - -1, /* (213) column_def_list ::= column_def */ - -3, /* (214) column_def_list ::= column_def_list NK_COMMA column_def */ - -3, /* (215) column_def ::= column_name type_name column_options */ - -1, /* (216) type_name ::= BOOL */ - -1, /* (217) type_name ::= TINYINT */ - -1, /* (218) type_name ::= SMALLINT */ - -1, /* (219) type_name ::= INT */ - -1, /* (220) type_name ::= INTEGER */ - -1, /* (221) type_name ::= BIGINT */ - -1, /* (222) type_name ::= FLOAT */ - -1, /* (223) type_name ::= DOUBLE */ - -4, /* (224) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ - -1, /* (225) type_name ::= TIMESTAMP */ - -4, /* (226) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ - -2, /* (227) type_name ::= TINYINT UNSIGNED */ - -2, /* (228) type_name ::= SMALLINT UNSIGNED */ - -2, /* (229) type_name ::= INT UNSIGNED */ - -2, /* (230) type_name ::= BIGINT UNSIGNED */ - -1, /* (231) type_name ::= JSON */ - -4, /* (232) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ - -1, /* (233) type_name ::= MEDIUMBLOB */ - -1, /* (234) type_name ::= BLOB */ - -4, /* (235) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ - -4, /* (236) type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ - -1, /* (237) type_name ::= DECIMAL */ - -4, /* (238) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ - -6, /* (239) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - -1, /* (240) type_name_default_len ::= BINARY */ - -1, /* (241) type_name_default_len ::= NCHAR */ - -1, /* (242) type_name_default_len ::= VARCHAR */ - -1, /* (243) type_name_default_len ::= VARBINARY */ + -3, /* (207) specific_cols_opt ::= NK_LP col_name_list NK_RP */ + -1, /* (208) full_table_name ::= table_name */ + -3, /* (209) full_table_name ::= db_name NK_DOT table_name */ + -1, /* (210) tag_def_list ::= tag_def */ + -3, /* (211) tag_def_list ::= tag_def_list NK_COMMA tag_def */ + -2, /* (212) tag_def ::= column_name type_name */ + -1, /* (213) column_def_list ::= column_def */ + -3, /* (214) column_def_list ::= column_def_list NK_COMMA column_def */ + -3, /* (215) column_def ::= column_name type_name column_options */ + -1, /* (216) type_name ::= BOOL */ + -1, /* (217) type_name ::= TINYINT */ + -1, /* (218) type_name ::= SMALLINT */ + -1, /* (219) type_name ::= INT */ + -1, /* (220) type_name ::= INTEGER */ + -1, /* (221) type_name ::= BIGINT */ + -1, /* (222) type_name ::= FLOAT */ + -1, /* (223) type_name ::= DOUBLE */ + -4, /* (224) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ + -1, /* (225) type_name ::= TIMESTAMP */ + -4, /* (226) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ + -2, /* (227) type_name ::= TINYINT UNSIGNED */ + -2, /* (228) type_name ::= SMALLINT UNSIGNED */ + -2, /* (229) type_name ::= INT UNSIGNED */ + -2, /* (230) type_name ::= BIGINT UNSIGNED */ + -1, /* (231) type_name ::= JSON */ + -4, /* (232) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ + -1, /* (233) type_name ::= MEDIUMBLOB */ + -1, /* (234) type_name ::= BLOB */ + -4, /* (235) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ + -4, /* (236) type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ + -1, /* (237) type_name ::= DECIMAL */ + -4, /* (238) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ + -6, /* (239) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + -1, /* (240) type_name_default_len ::= BINARY */ + -1, /* (241) type_name_default_len ::= NCHAR */ + -1, /* (242) type_name_default_len ::= VARCHAR */ + -1, /* (243) type_name_default_len ::= VARBINARY */ 0, /* (244) tags_def_opt ::= */ - -1, /* (245) tags_def_opt ::= tags_def */ - -4, /* (246) tags_def ::= TAGS NK_LP tag_def_list NK_RP */ + -1, /* (245) tags_def_opt ::= tags_def */ + -4, /* (246) tags_def ::= TAGS NK_LP tag_def_list NK_RP */ 0, /* (247) table_options ::= */ - -3, /* (248) table_options ::= table_options COMMENT NK_STRING */ - -3, /* (249) table_options ::= table_options MAX_DELAY duration_list */ - -3, /* (250) table_options ::= table_options WATERMARK duration_list */ - -5, /* (251) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ - -3, /* (252) table_options ::= table_options TTL NK_INTEGER */ - -5, /* (253) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ - -3, /* (254) table_options ::= table_options DELETE_MARK duration_list */ - -1, /* (255) alter_table_options ::= alter_table_option */ - -2, /* (256) alter_table_options ::= alter_table_options alter_table_option */ - -2, /* (257) alter_table_option ::= COMMENT NK_STRING */ - -2, /* (258) alter_table_option ::= TTL NK_INTEGER */ - -1, /* (259) duration_list ::= duration_literal */ - -3, /* (260) duration_list ::= duration_list NK_COMMA duration_literal */ - -1, /* (261) rollup_func_list ::= rollup_func_name */ - -3, /* (262) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ - -1, /* (263) rollup_func_name ::= function_name */ - -1, /* (264) rollup_func_name ::= FIRST */ - -1, /* (265) rollup_func_name ::= LAST */ - -1, /* (266) col_name_list ::= col_name */ - -3, /* (267) col_name_list ::= col_name_list NK_COMMA col_name */ - -1, /* (268) col_name ::= column_name */ - -2, /* (269) cmd ::= SHOW DNODES */ - -2, /* (270) cmd ::= SHOW USERS */ - -3, /* (271) cmd ::= SHOW USERS FULL */ - -3, /* (272) cmd ::= SHOW USER PRIVILEGES */ - -3, /* (273) cmd ::= SHOW db_kind_opt DATABASES */ - -4, /* (274) cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */ - -4, /* (275) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ - -3, /* (276) cmd ::= SHOW db_name_cond_opt VGROUPS */ - -2, /* (277) cmd ::= SHOW MNODES */ - -2, /* (278) cmd ::= SHOW QNODES */ - -2, /* (279) cmd ::= SHOW ARBGROUPS */ - -2, /* (280) cmd ::= SHOW FUNCTIONS */ - -5, /* (281) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ - -6, /* (282) cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ - -2, /* (283) cmd ::= SHOW STREAMS */ - -2, /* (284) cmd ::= SHOW ACCOUNTS */ - -2, /* (285) cmd ::= SHOW APPS */ - -2, /* (286) cmd ::= SHOW CONNECTIONS */ - -2, /* (287) cmd ::= SHOW LICENCES */ - -2, /* (288) cmd ::= SHOW GRANTS */ - -3, /* (289) cmd ::= SHOW GRANTS FULL */ - -3, /* (290) cmd ::= SHOW GRANTS LOGS */ - -3, /* (291) cmd ::= SHOW CLUSTER MACHINES */ - -4, /* (292) cmd ::= SHOW CREATE DATABASE db_name */ - -4, /* (293) cmd ::= SHOW CREATE TABLE full_table_name */ - -4, /* (294) cmd ::= SHOW CREATE STABLE full_table_name */ - -2, /* (295) cmd ::= SHOW ENCRYPTIONS */ - -2, /* (296) cmd ::= SHOW QUERIES */ - -2, /* (297) cmd ::= SHOW SCORES */ - -2, /* (298) cmd ::= SHOW TOPICS */ - -2, /* (299) cmd ::= SHOW VARIABLES */ - -3, /* (300) cmd ::= SHOW CLUSTER VARIABLES */ - -3, /* (301) cmd ::= SHOW LOCAL VARIABLES */ - -5, /* (302) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ - -2, /* (303) cmd ::= SHOW BNODES */ - -2, /* (304) cmd ::= SHOW SNODES */ - -2, /* (305) cmd ::= SHOW CLUSTER */ - -2, /* (306) cmd ::= SHOW TRANSACTIONS */ - -4, /* (307) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ - -2, /* (308) cmd ::= SHOW CONSUMERS */ - -2, /* (309) cmd ::= SHOW SUBSCRIPTIONS */ - -5, /* (310) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ - -6, /* (311) cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ - -7, /* (312) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ - -8, /* (313) cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ - -5, /* (314) cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ - -2, /* (315) cmd ::= SHOW VNODES */ - -3, /* (316) cmd ::= SHOW db_name_cond_opt ALIVE */ - -3, /* (317) cmd ::= SHOW CLUSTER ALIVE */ - -4, /* (318) cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt */ - -4, /* (319) cmd ::= SHOW CREATE VIEW full_table_name */ - -2, /* (320) cmd ::= SHOW COMPACTS */ - -3, /* (321) cmd ::= SHOW COMPACT NK_INTEGER */ + -3, /* (248) table_options ::= table_options COMMENT NK_STRING */ + -3, /* (249) table_options ::= table_options MAX_DELAY duration_list */ + -3, /* (250) table_options ::= table_options WATERMARK duration_list */ + -5, /* (251) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ + -3, /* (252) table_options ::= table_options TTL NK_INTEGER */ + -5, /* (253) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ + -3, /* (254) table_options ::= table_options DELETE_MARK duration_list */ + -1, /* (255) alter_table_options ::= alter_table_option */ + -2, /* (256) alter_table_options ::= alter_table_options alter_table_option */ + -2, /* (257) alter_table_option ::= COMMENT NK_STRING */ + -2, /* (258) alter_table_option ::= TTL NK_INTEGER */ + -1, /* (259) duration_list ::= duration_literal */ + -3, /* (260) duration_list ::= duration_list NK_COMMA duration_literal */ + -1, /* (261) rollup_func_list ::= rollup_func_name */ + -3, /* (262) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ + -1, /* (263) rollup_func_name ::= function_name */ + -1, /* (264) rollup_func_name ::= FIRST */ + -1, /* (265) rollup_func_name ::= LAST */ + -1, /* (266) col_name_list ::= col_name */ + -3, /* (267) col_name_list ::= col_name_list NK_COMMA col_name */ + -1, /* (268) col_name ::= column_name */ + -2, /* (269) cmd ::= SHOW DNODES */ + -2, /* (270) cmd ::= SHOW USERS */ + -3, /* (271) cmd ::= SHOW USERS FULL */ + -3, /* (272) cmd ::= SHOW USER PRIVILEGES */ + -3, /* (273) cmd ::= SHOW db_kind_opt DATABASES */ + -4, /* (274) cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */ + -4, /* (275) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ + -3, /* (276) cmd ::= SHOW db_name_cond_opt VGROUPS */ + -2, /* (277) cmd ::= SHOW MNODES */ + -2, /* (278) cmd ::= SHOW QNODES */ + -2, /* (279) cmd ::= SHOW ARBGROUPS */ + -2, /* (280) cmd ::= SHOW FUNCTIONS */ + -5, /* (281) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ + -6, /* (282) cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ + -2, /* (283) cmd ::= SHOW STREAMS */ + -2, /* (284) cmd ::= SHOW ACCOUNTS */ + -2, /* (285) cmd ::= SHOW APPS */ + -2, /* (286) cmd ::= SHOW CONNECTIONS */ + -2, /* (287) cmd ::= SHOW LICENCES */ + -2, /* (288) cmd ::= SHOW GRANTS */ + -3, /* (289) cmd ::= SHOW GRANTS FULL */ + -3, /* (290) cmd ::= SHOW GRANTS LOGS */ + -3, /* (291) cmd ::= SHOW CLUSTER MACHINES */ + -4, /* (292) cmd ::= SHOW CREATE DATABASE db_name */ + -4, /* (293) cmd ::= SHOW CREATE TABLE full_table_name */ + -4, /* (294) cmd ::= SHOW CREATE STABLE full_table_name */ + -2, /* (295) cmd ::= SHOW ENCRYPTIONS */ + -2, /* (296) cmd ::= SHOW QUERIES */ + -2, /* (297) cmd ::= SHOW SCORES */ + -2, /* (298) cmd ::= SHOW TOPICS */ + -2, /* (299) cmd ::= SHOW VARIABLES */ + -3, /* (300) cmd ::= SHOW CLUSTER VARIABLES */ + -3, /* (301) cmd ::= SHOW LOCAL VARIABLES */ + -5, /* (302) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ + -2, /* (303) cmd ::= SHOW BNODES */ + -2, /* (304) cmd ::= SHOW SNODES */ + -2, /* (305) cmd ::= SHOW CLUSTER */ + -2, /* (306) cmd ::= SHOW TRANSACTIONS */ + -4, /* (307) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ + -2, /* (308) cmd ::= SHOW CONSUMERS */ + -2, /* (309) cmd ::= SHOW SUBSCRIPTIONS */ + -5, /* (310) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ + -6, /* (311) cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ + -7, /* (312) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ + -8, /* (313) cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ + -5, /* (314) cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ + -2, /* (315) cmd ::= SHOW VNODES */ + -3, /* (316) cmd ::= SHOW db_name_cond_opt ALIVE */ + -3, /* (317) cmd ::= SHOW CLUSTER ALIVE */ + -4, /* (318) cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt */ + -4, /* (319) cmd ::= SHOW CREATE VIEW full_table_name */ + -2, /* (320) cmd ::= SHOW COMPACTS */ + -3, /* (321) cmd ::= SHOW COMPACT NK_INTEGER */ 0, /* (322) table_kind_db_name_cond_opt ::= */ - -1, /* (323) table_kind_db_name_cond_opt ::= table_kind */ - -2, /* (324) table_kind_db_name_cond_opt ::= db_name NK_DOT */ - -3, /* (325) table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */ - -1, /* (326) table_kind ::= NORMAL */ - -1, /* (327) table_kind ::= CHILD */ + -1, /* (323) table_kind_db_name_cond_opt ::= table_kind */ + -2, /* (324) table_kind_db_name_cond_opt ::= db_name NK_DOT */ + -3, /* (325) table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */ + -1, /* (326) table_kind ::= NORMAL */ + -1, /* (327) table_kind ::= CHILD */ 0, /* (328) db_name_cond_opt ::= */ - -2, /* (329) db_name_cond_opt ::= db_name NK_DOT */ + -2, /* (329) db_name_cond_opt ::= db_name NK_DOT */ 0, /* (330) like_pattern_opt ::= */ - -2, /* (331) like_pattern_opt ::= LIKE NK_STRING */ - -1, /* (332) table_name_cond ::= table_name */ + -2, /* (331) like_pattern_opt ::= LIKE NK_STRING */ + -1, /* (332) table_name_cond ::= table_name */ 0, /* (333) from_db_opt ::= */ - -2, /* (334) from_db_opt ::= FROM db_name */ + -2, /* (334) from_db_opt ::= FROM db_name */ 0, /* (335) tag_list_opt ::= */ - -1, /* (336) tag_list_opt ::= tag_item */ - -3, /* (337) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ - -1, /* (338) tag_item ::= TBNAME */ - -1, /* (339) tag_item ::= QTAGS */ - -1, /* (340) tag_item ::= column_name */ - -2, /* (341) tag_item ::= column_name column_alias */ - -3, /* (342) tag_item ::= column_name AS column_alias */ + -1, /* (336) tag_list_opt ::= tag_item */ + -3, /* (337) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ + -1, /* (338) tag_item ::= TBNAME */ + -1, /* (339) tag_item ::= QTAGS */ + -1, /* (340) tag_item ::= column_name */ + -2, /* (341) tag_item ::= column_name column_alias */ + -3, /* (342) tag_item ::= column_name AS column_alias */ 0, /* (343) db_kind_opt ::= */ - -1, /* (344) db_kind_opt ::= USER */ - -1, /* (345) db_kind_opt ::= SYSTEM */ - -11, /* (346) cmd ::= CREATE TSMA not_exists_opt tsma_name ON full_table_name tsma_func_list INTERVAL NK_LP duration_literal NK_RP */ - -11, /* (347) cmd ::= CREATE RECURSIVE TSMA not_exists_opt tsma_name ON full_table_name INTERVAL NK_LP duration_literal NK_RP */ - -4, /* (348) cmd ::= DROP TSMA exists_opt full_tsma_name */ - -3, /* (349) cmd ::= SHOW db_name_cond_opt TSMAS */ - -1, /* (350) full_tsma_name ::= tsma_name */ - -3, /* (351) full_tsma_name ::= db_name NK_DOT tsma_name */ - -4, /* (352) tsma_func_list ::= FUNCTION NK_LP func_list NK_RP */ - -8, /* (353) cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */ - -9, /* (354) cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */ - -4, /* (355) cmd ::= DROP INDEX exists_opt full_index_name */ - -1, /* (356) full_index_name ::= index_name */ - -3, /* (357) full_index_name ::= db_name NK_DOT index_name */ - -10, /* (358) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ - -12, /* (359) 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 */ - -1, /* (360) func_list ::= func */ - -3, /* (361) func_list ::= func_list NK_COMMA func */ - -4, /* (362) func ::= sma_func_name NK_LP expression_list NK_RP */ - -1, /* (363) sma_func_name ::= function_name */ - -1, /* (364) sma_func_name ::= COUNT */ - -1, /* (365) sma_func_name ::= FIRST */ - -1, /* (366) sma_func_name ::= LAST */ - -1, /* (367) sma_func_name ::= LAST_ROW */ + -1, /* (344) db_kind_opt ::= USER */ + -1, /* (345) db_kind_opt ::= SYSTEM */ + -11, /* (346) cmd ::= CREATE TSMA not_exists_opt tsma_name ON full_table_name tsma_func_list INTERVAL NK_LP duration_literal NK_RP */ + -11, /* (347) cmd ::= CREATE RECURSIVE TSMA not_exists_opt tsma_name ON full_table_name INTERVAL NK_LP duration_literal NK_RP */ + -4, /* (348) cmd ::= DROP TSMA exists_opt full_tsma_name */ + -3, /* (349) cmd ::= SHOW db_name_cond_opt TSMAS */ + -1, /* (350) full_tsma_name ::= tsma_name */ + -3, /* (351) full_tsma_name ::= db_name NK_DOT tsma_name */ + -4, /* (352) tsma_func_list ::= FUNCTION NK_LP func_list NK_RP */ + -8, /* (353) cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */ + -9, /* (354) cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */ + -4, /* (355) cmd ::= DROP INDEX exists_opt full_index_name */ + -1, /* (356) full_index_name ::= index_name */ + -3, /* (357) full_index_name ::= db_name NK_DOT index_name */ + -10, /* (358) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ + -12, /* (359) 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 */ + -1, /* (360) func_list ::= func */ + -3, /* (361) func_list ::= func_list NK_COMMA func */ + -4, /* (362) func ::= sma_func_name NK_LP expression_list NK_RP */ + -1, /* (363) sma_func_name ::= function_name */ + -1, /* (364) sma_func_name ::= COUNT */ + -1, /* (365) sma_func_name ::= FIRST */ + -1, /* (366) sma_func_name ::= LAST */ + -1, /* (367) sma_func_name ::= LAST_ROW */ 0, /* (368) sma_stream_opt ::= */ - -3, /* (369) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ - -3, /* (370) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ - -3, /* (371) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ - -1, /* (372) with_meta ::= AS */ - -3, /* (373) with_meta ::= WITH META AS */ - -3, /* (374) with_meta ::= ONLY META AS */ - -6, /* (375) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ - -7, /* (376) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ - -8, /* (377) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ - -4, /* (378) cmd ::= DROP TOPIC exists_opt topic_name */ - -7, /* (379) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ - -2, /* (380) cmd ::= DESC full_table_name */ - -2, /* (381) cmd ::= DESCRIBE full_table_name */ - -3, /* (382) cmd ::= RESET QUERY CACHE */ - -4, /* (383) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ - -4, /* (384) cmd ::= EXPLAIN analyze_opt explain_options insert_query */ + -3, /* (369) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ + -3, /* (370) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ + -3, /* (371) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ + -1, /* (372) with_meta ::= AS */ + -3, /* (373) with_meta ::= WITH META AS */ + -3, /* (374) with_meta ::= ONLY META AS */ + -6, /* (375) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ + -7, /* (376) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ + -8, /* (377) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ + -4, /* (378) cmd ::= DROP TOPIC exists_opt topic_name */ + -7, /* (379) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ + -2, /* (380) cmd ::= DESC full_table_name */ + -2, /* (381) cmd ::= DESCRIBE full_table_name */ + -3, /* (382) cmd ::= RESET QUERY CACHE */ + -4, /* (383) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ + -4, /* (384) cmd ::= EXPLAIN analyze_opt explain_options insert_query */ 0, /* (385) analyze_opt ::= */ - -1, /* (386) analyze_opt ::= ANALYZE */ + -1, /* (386) analyze_opt ::= ANALYZE */ 0, /* (387) explain_options ::= */ - -3, /* (388) explain_options ::= explain_options VERBOSE NK_BOOL */ - -3, /* (389) explain_options ::= explain_options RATIO NK_FLOAT */ - -12, /* (390) cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ - -4, /* (391) cmd ::= DROP FUNCTION exists_opt function_name */ + -3, /* (388) explain_options ::= explain_options VERBOSE NK_BOOL */ + -3, /* (389) explain_options ::= explain_options RATIO NK_FLOAT */ + -12, /* (390) cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ + -4, /* (391) cmd ::= DROP FUNCTION exists_opt function_name */ 0, /* (392) agg_func_opt ::= */ - -1, /* (393) agg_func_opt ::= AGGREGATE */ + -1, /* (393) agg_func_opt ::= AGGREGATE */ 0, /* (394) bufsize_opt ::= */ - -2, /* (395) bufsize_opt ::= BUFSIZE NK_INTEGER */ + -2, /* (395) bufsize_opt ::= BUFSIZE NK_INTEGER */ 0, /* (396) language_opt ::= */ - -2, /* (397) language_opt ::= LANGUAGE NK_STRING */ + -2, /* (397) language_opt ::= LANGUAGE NK_STRING */ 0, /* (398) or_replace_opt ::= */ - -2, /* (399) or_replace_opt ::= OR REPLACE */ - -6, /* (400) cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */ - -4, /* (401) cmd ::= DROP VIEW exists_opt full_view_name */ - -1, /* (402) full_view_name ::= view_name */ - -3, /* (403) full_view_name ::= db_name NK_DOT view_name */ - -12, /* (404) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */ - -4, /* (405) cmd ::= DROP STREAM exists_opt stream_name */ - -4, /* (406) cmd ::= PAUSE STREAM exists_opt stream_name */ - -5, /* (407) cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ + -2, /* (399) or_replace_opt ::= OR REPLACE */ + -6, /* (400) cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */ + -4, /* (401) cmd ::= DROP VIEW exists_opt full_view_name */ + -1, /* (402) full_view_name ::= view_name */ + -3, /* (403) full_view_name ::= db_name NK_DOT view_name */ + -12, /* (404) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */ + -4, /* (405) cmd ::= DROP STREAM exists_opt stream_name */ + -4, /* (406) cmd ::= PAUSE STREAM exists_opt stream_name */ + -5, /* (407) cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ 0, /* (408) col_list_opt ::= */ - -3, /* (409) col_list_opt ::= NK_LP column_stream_def_list NK_RP */ - -1, /* (410) column_stream_def_list ::= column_stream_def */ - -3, /* (411) column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def */ - -2, /* (412) column_stream_def ::= column_name stream_col_options */ + -3, /* (409) col_list_opt ::= NK_LP column_stream_def_list NK_RP */ + -1, /* (410) column_stream_def_list ::= column_stream_def */ + -3, /* (411) column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def */ + -2, /* (412) column_stream_def ::= column_name stream_col_options */ 0, /* (413) stream_col_options ::= */ - -3, /* (414) stream_col_options ::= stream_col_options PRIMARY KEY */ + -3, /* (414) stream_col_options ::= stream_col_options PRIMARY KEY */ 0, /* (415) tag_def_or_ref_opt ::= */ - -1, /* (416) tag_def_or_ref_opt ::= tags_def */ - -4, /* (417) tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP */ + -1, /* (416) tag_def_or_ref_opt ::= tags_def */ + -4, /* (417) tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP */ 0, /* (418) stream_options ::= */ -3, /* (419) stream_options ::= stream_options TRIGGER AT_ONCE */ -3, /* (420) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ - -4, /* (421) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ - -3, /* (422) stream_options ::= stream_options WATERMARK duration_literal */ - -4, /* (423) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ - -3, /* (424) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ - -3, /* (425) stream_options ::= stream_options DELETE_MARK duration_literal */ - -4, /* (426) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ - 0, /* (427) subtable_opt ::= */ - -4, /* (428) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - 0, /* (429) ignore_opt ::= */ - -2, /* (430) ignore_opt ::= IGNORE UNTREATED */ - -3, /* (431) cmd ::= KILL CONNECTION NK_INTEGER */ - -3, /* (432) cmd ::= KILL QUERY NK_STRING */ - -3, /* (433) cmd ::= KILL TRANSACTION NK_INTEGER */ - -3, /* (434) cmd ::= KILL COMPACT NK_INTEGER */ - -2, /* (435) cmd ::= BALANCE VGROUP */ - -4, /* (436) cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ - -5, /* (437) cmd ::= BALANCE VGROUP LEADER DATABASE db_name */ - -4, /* (438) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ - -4, /* (439) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ - -3, /* (440) cmd ::= SPLIT VGROUP NK_INTEGER */ - 0, /* (441) on_vgroup_id ::= */ - -2, /* (442) on_vgroup_id ::= ON NK_INTEGER */ - -2, /* (443) dnode_list ::= DNODE NK_INTEGER */ - -3, /* (444) dnode_list ::= dnode_list DNODE NK_INTEGER */ - -4, /* (445) cmd ::= DELETE FROM full_table_name where_clause_opt */ - -1, /* (446) cmd ::= query_or_subquery */ - -1, /* (447) cmd ::= insert_query */ - -7, /* (448) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ - -4, /* (449) insert_query ::= INSERT INTO full_table_name query_or_subquery */ - -1, /* (450) tags_literal ::= NK_INTEGER */ - -3, /* (451) tags_literal ::= NK_INTEGER NK_PLUS duration_literal */ - -3, /* (452) tags_literal ::= NK_INTEGER NK_MINUS duration_literal */ - -2, /* (453) tags_literal ::= NK_PLUS NK_INTEGER */ - -4, /* (454) tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal */ - -4, /* (455) tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal */ - -2, /* (456) tags_literal ::= NK_MINUS NK_INTEGER */ - -4, /* (457) tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal */ - -4, /* (458) tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal */ - -1, /* (459) tags_literal ::= NK_FLOAT */ - -2, /* (460) tags_literal ::= NK_PLUS NK_FLOAT */ - -2, /* (461) tags_literal ::= NK_MINUS NK_FLOAT */ - -1, /* (462) tags_literal ::= NK_BIN */ - -3, /* (463) tags_literal ::= NK_BIN NK_PLUS duration_literal */ - -3, /* (464) tags_literal ::= NK_BIN NK_MINUS duration_literal */ - -2, /* (465) tags_literal ::= NK_PLUS NK_BIN */ - -4, /* (466) tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal */ - -4, /* (467) tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal */ - -2, /* (468) tags_literal ::= NK_MINUS NK_BIN */ - -4, /* (469) tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal */ - -4, /* (470) tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal */ - -1, /* (471) tags_literal ::= NK_HEX */ - -3, /* (472) tags_literal ::= NK_HEX NK_PLUS duration_literal */ - -3, /* (473) tags_literal ::= NK_HEX NK_MINUS duration_literal */ - -2, /* (474) tags_literal ::= NK_PLUS NK_HEX */ - -4, /* (475) tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal */ - -4, /* (476) tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal */ - -2, /* (477) tags_literal ::= NK_MINUS NK_HEX */ - -4, /* (478) tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal */ - -4, /* (479) tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal */ - -1, /* (480) tags_literal ::= NK_STRING */ - -3, /* (481) tags_literal ::= NK_STRING NK_PLUS duration_literal */ - -3, /* (482) tags_literal ::= NK_STRING NK_MINUS duration_literal */ - -1, /* (483) tags_literal ::= NK_BOOL */ - -1, /* (484) tags_literal ::= NULL */ - -1, /* (485) tags_literal ::= literal_func */ - -3, /* (486) tags_literal ::= literal_func NK_PLUS duration_literal */ - -3, /* (487) tags_literal ::= literal_func NK_MINUS duration_literal */ - -1, /* (488) tags_literal_list ::= tags_literal */ - -3, /* (489) tags_literal_list ::= tags_literal_list NK_COMMA tags_literal */ - -1, /* (490) literal ::= NK_INTEGER */ - -1, /* (491) literal ::= NK_FLOAT */ - -1, /* (492) literal ::= NK_STRING */ - -1, /* (493) literal ::= NK_BOOL */ - -2, /* (494) literal ::= TIMESTAMP NK_STRING */ - -1, /* (495) literal ::= duration_literal */ - -1, /* (496) literal ::= NULL */ - -1, /* (497) literal ::= NK_QUESTION */ - -1, /* (498) duration_literal ::= NK_VARIABLE */ - -1, /* (499) signed ::= NK_INTEGER */ - -2, /* (500) signed ::= NK_PLUS NK_INTEGER */ - -2, /* (501) signed ::= NK_MINUS NK_INTEGER */ - -1, /* (502) signed ::= NK_FLOAT */ - -2, /* (503) signed ::= NK_PLUS NK_FLOAT */ - -2, /* (504) signed ::= NK_MINUS NK_FLOAT */ - -1, /* (505) signed_literal ::= signed */ - -1, /* (506) signed_literal ::= NK_STRING */ - -1, /* (507) signed_literal ::= NK_BOOL */ - -2, /* (508) signed_literal ::= TIMESTAMP NK_STRING */ - -1, /* (509) signed_literal ::= duration_literal */ - -1, /* (510) signed_literal ::= NULL */ - -1, /* (511) signed_literal ::= literal_func */ - -1, /* (512) signed_literal ::= NK_QUESTION */ - -1, /* (513) literal_list ::= signed_literal */ - -3, /* (514) literal_list ::= literal_list NK_COMMA signed_literal */ - -1, /* (515) db_name ::= NK_ID */ - -1, /* (516) table_name ::= NK_ID */ - -1, /* (517) column_name ::= NK_ID */ - -1, /* (518) function_name ::= NK_ID */ - -1, /* (519) view_name ::= NK_ID */ - -1, /* (520) table_alias ::= NK_ID */ - -1, /* (521) column_alias ::= NK_ID */ - -1, /* (522) column_alias ::= NK_ALIAS */ - -1, /* (523) user_name ::= NK_ID */ - -1, /* (524) topic_name ::= NK_ID */ - -1, /* (525) stream_name ::= NK_ID */ - -1, /* (526) cgroup_name ::= NK_ID */ - -1, /* (527) index_name ::= NK_ID */ - -1, /* (528) tsma_name ::= NK_ID */ - -1, /* (529) expr_or_subquery ::= expression */ - -1, /* (530) expression ::= literal */ - -1, /* (531) expression ::= pseudo_column */ - -1, /* (532) expression ::= column_reference */ - -1, /* (533) expression ::= function_expression */ - -1, /* (534) expression ::= case_when_expression */ - -3, /* (535) expression ::= NK_LP expression NK_RP */ - -2, /* (536) expression ::= NK_PLUS expr_or_subquery */ - -2, /* (537) expression ::= NK_MINUS expr_or_subquery */ - -3, /* (538) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ - -3, /* (539) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ - -3, /* (540) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ - -3, /* (541) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ - -3, /* (542) expression ::= expr_or_subquery NK_REM expr_or_subquery */ - -3, /* (543) expression ::= column_reference NK_ARROW NK_STRING */ - -3, /* (544) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ - -3, /* (545) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ - -1, /* (546) expression_list ::= expr_or_subquery */ - -3, /* (547) expression_list ::= expression_list NK_COMMA expr_or_subquery */ - -1, /* (548) column_reference ::= column_name */ - -3, /* (549) column_reference ::= table_name NK_DOT column_name */ - -1, /* (550) column_reference ::= NK_ALIAS */ - -3, /* (551) column_reference ::= table_name NK_DOT NK_ALIAS */ - -1, /* (552) pseudo_column ::= ROWTS */ - -1, /* (553) pseudo_column ::= TBNAME */ - -3, /* (554) pseudo_column ::= table_name NK_DOT TBNAME */ - -1, /* (555) pseudo_column ::= QSTART */ - -1, /* (556) pseudo_column ::= QEND */ - -1, /* (557) pseudo_column ::= QDURATION */ - -1, /* (558) pseudo_column ::= WSTART */ - -1, /* (559) pseudo_column ::= WEND */ - -1, /* (560) pseudo_column ::= WDURATION */ - -1, /* (561) pseudo_column ::= IROWTS */ - -1, /* (562) pseudo_column ::= ISFILLED */ - -1, /* (563) pseudo_column ::= QTAGS */ - -4, /* (564) function_expression ::= function_name NK_LP expression_list NK_RP */ - -4, /* (565) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ - -6, /* (566) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ - -6, /* (567) function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP */ - -1, /* (568) function_expression ::= literal_func */ - -3, /* (569) literal_func ::= noarg_func NK_LP NK_RP */ - -1, /* (570) literal_func ::= NOW */ - -1, /* (571) literal_func ::= TODAY */ - -1, /* (572) noarg_func ::= NOW */ - -1, /* (573) noarg_func ::= TODAY */ - -1, /* (574) noarg_func ::= TIMEZONE */ - -1, /* (575) noarg_func ::= DATABASE */ - -1, /* (576) noarg_func ::= CLIENT_VERSION */ - -1, /* (577) noarg_func ::= SERVER_VERSION */ - -1, /* (578) noarg_func ::= SERVER_STATUS */ - -1, /* (579) noarg_func ::= CURRENT_USER */ - -1, /* (580) noarg_func ::= USER */ - -1, /* (581) star_func ::= COUNT */ - -1, /* (582) star_func ::= FIRST */ - -1, /* (583) star_func ::= LAST */ - -1, /* (584) star_func ::= LAST_ROW */ - -1, /* (585) star_func_para_list ::= NK_STAR */ - -1, /* (586) star_func_para_list ::= other_para_list */ - -1, /* (587) other_para_list ::= star_func_para */ - -3, /* (588) other_para_list ::= other_para_list NK_COMMA star_func_para */ - -1, /* (589) star_func_para ::= expr_or_subquery */ - -3, /* (590) star_func_para ::= table_name NK_DOT NK_STAR */ - -4, /* (591) case_when_expression ::= CASE when_then_list case_when_else_opt END */ - -5, /* (592) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ - -1, /* (593) when_then_list ::= when_then_expr */ - -2, /* (594) when_then_list ::= when_then_list when_then_expr */ - -4, /* (595) when_then_expr ::= WHEN common_expression THEN common_expression */ - 0, /* (596) case_when_else_opt ::= */ - -2, /* (597) case_when_else_opt ::= ELSE common_expression */ - -3, /* (598) predicate ::= expr_or_subquery compare_op expr_or_subquery */ - -5, /* (599) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ - -6, /* (600) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ - -3, /* (601) predicate ::= expr_or_subquery IS NULL */ - -4, /* (602) predicate ::= expr_or_subquery IS NOT NULL */ - -3, /* (603) predicate ::= expr_or_subquery in_op in_predicate_value */ - -1, /* (604) compare_op ::= NK_LT */ - -1, /* (605) compare_op ::= NK_GT */ - -1, /* (606) compare_op ::= NK_LE */ - -1, /* (607) compare_op ::= NK_GE */ - -1, /* (608) compare_op ::= NK_NE */ - -1, /* (609) compare_op ::= NK_EQ */ - -1, /* (610) compare_op ::= LIKE */ - -2, /* (611) compare_op ::= NOT LIKE */ - -1, /* (612) compare_op ::= MATCH */ - -1, /* (613) compare_op ::= NMATCH */ - -1, /* (614) compare_op ::= CONTAINS */ - -1, /* (615) in_op ::= IN */ - -2, /* (616) in_op ::= NOT IN */ - -3, /* (617) in_predicate_value ::= NK_LP literal_list NK_RP */ - -1, /* (618) boolean_value_expression ::= boolean_primary */ - -2, /* (619) boolean_value_expression ::= NOT boolean_primary */ - -3, /* (620) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - -3, /* (621) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - -1, /* (622) boolean_primary ::= predicate */ - -3, /* (623) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ - -1, /* (624) common_expression ::= expr_or_subquery */ - -1, /* (625) common_expression ::= boolean_value_expression */ - 0, /* (626) from_clause_opt ::= */ - -2, /* (627) from_clause_opt ::= FROM table_reference_list */ - -1, /* (628) table_reference_list ::= table_reference */ - -3, /* (629) table_reference_list ::= table_reference_list NK_COMMA table_reference */ - -1, /* (630) table_reference ::= table_primary */ - -1, /* (631) table_reference ::= joined_table */ - -2, /* (632) table_primary ::= table_name alias_opt */ - -4, /* (633) table_primary ::= db_name NK_DOT table_name alias_opt */ - -2, /* (634) table_primary ::= subquery alias_opt */ - -1, /* (635) table_primary ::= parenthesized_joined_table */ - 0, /* (636) alias_opt ::= */ - -1, /* (637) alias_opt ::= table_alias */ - -2, /* (638) alias_opt ::= AS table_alias */ - -3, /* (639) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - -3, /* (640) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ - -8, /* (641) joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt */ - 0, /* (642) join_type ::= */ - -1, /* (643) join_type ::= INNER */ - -1, /* (644) join_type ::= LEFT */ - -1, /* (645) join_type ::= RIGHT */ - -1, /* (646) join_type ::= FULL */ - 0, /* (647) join_subtype ::= */ - -1, /* (648) join_subtype ::= OUTER */ - -1, /* (649) join_subtype ::= SEMI */ - -1, /* (650) join_subtype ::= ANTI */ - -1, /* (651) join_subtype ::= ASOF */ - -1, /* (652) join_subtype ::= WINDOW */ - 0, /* (653) join_on_clause_opt ::= */ - -2, /* (654) join_on_clause_opt ::= ON search_condition */ - 0, /* (655) window_offset_clause_opt ::= */ - -6, /* (656) window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP */ - -1, /* (657) window_offset_literal ::= NK_VARIABLE */ - -2, /* (658) window_offset_literal ::= NK_MINUS NK_VARIABLE */ - 0, /* (659) jlimit_clause_opt ::= */ - -2, /* (660) jlimit_clause_opt ::= JLIMIT NK_INTEGER */ - -14, /* (661) query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_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 */ - 0, /* (662) hint_list ::= */ - -1, /* (663) hint_list ::= NK_HINT */ - 0, /* (664) tag_mode_opt ::= */ - -1, /* (665) tag_mode_opt ::= TAGS */ - 0, /* (666) set_quantifier_opt ::= */ - -1, /* (667) set_quantifier_opt ::= DISTINCT */ - -1, /* (668) set_quantifier_opt ::= ALL */ - -1, /* (669) select_list ::= select_item */ - -3, /* (670) select_list ::= select_list NK_COMMA select_item */ - -1, /* (671) select_item ::= NK_STAR */ - -1, /* (672) select_item ::= common_expression */ - -2, /* (673) select_item ::= common_expression column_alias */ - -3, /* (674) select_item ::= common_expression AS column_alias */ - -3, /* (675) select_item ::= table_name NK_DOT NK_STAR */ - 0, /* (676) where_clause_opt ::= */ - -2, /* (677) where_clause_opt ::= WHERE search_condition */ - 0, /* (678) partition_by_clause_opt ::= */ - -3, /* (679) partition_by_clause_opt ::= PARTITION BY partition_list */ - -1, /* (680) partition_list ::= partition_item */ - -3, /* (681) partition_list ::= partition_list NK_COMMA partition_item */ - -1, /* (682) partition_item ::= expr_or_subquery */ - -2, /* (683) partition_item ::= expr_or_subquery column_alias */ - -3, /* (684) partition_item ::= expr_or_subquery AS column_alias */ - 0, /* (685) twindow_clause_opt ::= */ - -6, /* (686) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ - -4, /* (687) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ - -6, /* (688) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ - -8, /* (689) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ - -7, /* (690) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ - -4, /* (691) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */ - -6, /* (692) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - 0, /* (693) sliding_opt ::= */ - -4, /* (694) sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ - -1, /* (695) interval_sliding_duration_literal ::= NK_VARIABLE */ - -1, /* (696) interval_sliding_duration_literal ::= NK_STRING */ - -1, /* (697) interval_sliding_duration_literal ::= NK_INTEGER */ - 0, /* (698) fill_opt ::= */ - -4, /* (699) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - -6, /* (700) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ - -6, /* (701) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ - -1, /* (702) fill_mode ::= NONE */ - -1, /* (703) fill_mode ::= PREV */ - -1, /* (704) fill_mode ::= NULL */ - -1, /* (705) fill_mode ::= NULL_F */ - -1, /* (706) fill_mode ::= LINEAR */ - -1, /* (707) fill_mode ::= NEXT */ - 0, /* (708) group_by_clause_opt ::= */ - -3, /* (709) group_by_clause_opt ::= GROUP BY group_by_list */ - -1, /* (710) group_by_list ::= expr_or_subquery */ - -3, /* (711) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ - 0, /* (712) having_clause_opt ::= */ - -2, /* (713) having_clause_opt ::= HAVING search_condition */ - 0, /* (714) range_opt ::= */ - -6, /* (715) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ - -4, /* (716) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ - 0, /* (717) every_opt ::= */ - -4, /* (718) every_opt ::= EVERY NK_LP duration_literal NK_RP */ - -4, /* (719) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ - -1, /* (720) query_simple ::= query_specification */ - -1, /* (721) query_simple ::= union_query_expression */ - -4, /* (722) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ - -3, /* (723) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ - -1, /* (724) query_simple_or_subquery ::= query_simple */ - -1, /* (725) query_simple_or_subquery ::= subquery */ - -1, /* (726) query_or_subquery ::= query_expression */ - -1, /* (727) query_or_subquery ::= subquery */ - 0, /* (728) order_by_clause_opt ::= */ - -3, /* (729) order_by_clause_opt ::= ORDER BY sort_specification_list */ - 0, /* (730) slimit_clause_opt ::= */ - -2, /* (731) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - -4, /* (732) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - -4, /* (733) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - 0, /* (734) limit_clause_opt ::= */ - -2, /* (735) limit_clause_opt ::= LIMIT NK_INTEGER */ - -4, /* (736) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - -4, /* (737) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - -3, /* (738) subquery ::= NK_LP query_expression NK_RP */ - -3, /* (739) subquery ::= NK_LP subquery NK_RP */ - -1, /* (740) search_condition ::= common_expression */ - -1, /* (741) sort_specification_list ::= sort_specification */ - -3, /* (742) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - -3, /* (743) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ - 0, /* (744) ordering_specification_opt ::= */ - -1, /* (745) ordering_specification_opt ::= ASC */ - -1, /* (746) ordering_specification_opt ::= DESC */ - 0, /* (747) null_ordering_opt ::= */ - -2, /* (748) null_ordering_opt ::= NULLS FIRST */ - -2, /* (749) null_ordering_opt ::= NULLS LAST */ - 0, /* (750) column_options ::= */ - -3, /* (751) column_options ::= column_options PRIMARY KEY */ - -3, /* (752) column_options ::= column_options ENCODE NK_STRING */ - -3, /* (753) column_options ::= column_options COMPRESS NK_STRING */ - -3, /* (754) column_options ::= column_options LEVEL NK_STRING */ + -3, /* (421) stream_options ::= stream_options TRIGGER FORCE_WINDOW_CLOSE */ + -4, /* (422) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ + -3, /* (423) stream_options ::= stream_options WATERMARK duration_literal */ + -4, /* (424) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ + -3, /* (425) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ + -3, /* (426) stream_options ::= stream_options DELETE_MARK duration_literal */ + -4, /* (427) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ + 0, /* (428) subtable_opt ::= */ + -4, /* (429) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + 0, /* (430) ignore_opt ::= */ + -2, /* (431) ignore_opt ::= IGNORE UNTREATED */ + -3, /* (432) cmd ::= KILL CONNECTION NK_INTEGER */ + -3, /* (433) cmd ::= KILL QUERY NK_STRING */ + -3, /* (434) cmd ::= KILL TRANSACTION NK_INTEGER */ + -3, /* (435) cmd ::= KILL COMPACT NK_INTEGER */ + -2, /* (436) cmd ::= BALANCE VGROUP */ + -4, /* (437) cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ + -5, /* (438) cmd ::= BALANCE VGROUP LEADER DATABASE db_name */ + -4, /* (439) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + -4, /* (440) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ + -3, /* (441) cmd ::= SPLIT VGROUP NK_INTEGER */ + 0, /* (442) on_vgroup_id ::= */ + -2, /* (443) on_vgroup_id ::= ON NK_INTEGER */ + -2, /* (444) dnode_list ::= DNODE NK_INTEGER */ + -3, /* (445) dnode_list ::= dnode_list DNODE NK_INTEGER */ + -4, /* (446) cmd ::= DELETE FROM full_table_name where_clause_opt */ + -1, /* (447) cmd ::= query_or_subquery */ + -1, /* (448) cmd ::= insert_query */ + -7, /* (449) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ + -4, /* (450) insert_query ::= INSERT INTO full_table_name query_or_subquery */ + -1, /* (451) tags_literal ::= NK_INTEGER */ + -3, /* (452) tags_literal ::= NK_INTEGER NK_PLUS duration_literal */ + -3, /* (453) tags_literal ::= NK_INTEGER NK_MINUS duration_literal */ + -2, /* (454) tags_literal ::= NK_PLUS NK_INTEGER */ + -4, /* (455) tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal */ + -4, /* (456) tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal */ + -2, /* (457) tags_literal ::= NK_MINUS NK_INTEGER */ + -4, /* (458) tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal */ + -4, /* (459) tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal */ + -1, /* (460) tags_literal ::= NK_FLOAT */ + -2, /* (461) tags_literal ::= NK_PLUS NK_FLOAT */ + -2, /* (462) tags_literal ::= NK_MINUS NK_FLOAT */ + -1, /* (463) tags_literal ::= NK_BIN */ + -3, /* (464) tags_literal ::= NK_BIN NK_PLUS duration_literal */ + -3, /* (465) tags_literal ::= NK_BIN NK_MINUS duration_literal */ + -2, /* (466) tags_literal ::= NK_PLUS NK_BIN */ + -4, /* (467) tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal */ + -4, /* (468) tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal */ + -2, /* (469) tags_literal ::= NK_MINUS NK_BIN */ + -4, /* (470) tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal */ + -4, /* (471) tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal */ + -1, /* (472) tags_literal ::= NK_HEX */ + -3, /* (473) tags_literal ::= NK_HEX NK_PLUS duration_literal */ + -3, /* (474) tags_literal ::= NK_HEX NK_MINUS duration_literal */ + -2, /* (475) tags_literal ::= NK_PLUS NK_HEX */ + -4, /* (476) tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal */ + -4, /* (477) tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal */ + -2, /* (478) tags_literal ::= NK_MINUS NK_HEX */ + -4, /* (479) tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal */ + -4, /* (480) tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal */ + -1, /* (481) tags_literal ::= NK_STRING */ + -3, /* (482) tags_literal ::= NK_STRING NK_PLUS duration_literal */ + -3, /* (483) tags_literal ::= NK_STRING NK_MINUS duration_literal */ + -1, /* (484) tags_literal ::= NK_BOOL */ + -1, /* (485) tags_literal ::= NULL */ + -1, /* (486) tags_literal ::= literal_func */ + -3, /* (487) tags_literal ::= literal_func NK_PLUS duration_literal */ + -3, /* (488) tags_literal ::= literal_func NK_MINUS duration_literal */ + -1, /* (489) tags_literal_list ::= tags_literal */ + -3, /* (490) tags_literal_list ::= tags_literal_list NK_COMMA tags_literal */ + -1, /* (491) literal ::= NK_INTEGER */ + -1, /* (492) literal ::= NK_FLOAT */ + -1, /* (493) literal ::= NK_STRING */ + -1, /* (494) literal ::= NK_BOOL */ + -2, /* (495) literal ::= TIMESTAMP NK_STRING */ + -1, /* (496) literal ::= duration_literal */ + -1, /* (497) literal ::= NULL */ + -1, /* (498) literal ::= NK_QUESTION */ + -1, /* (499) duration_literal ::= NK_VARIABLE */ + -1, /* (500) signed ::= NK_INTEGER */ + -2, /* (501) signed ::= NK_PLUS NK_INTEGER */ + -2, /* (502) signed ::= NK_MINUS NK_INTEGER */ + -1, /* (503) signed ::= NK_FLOAT */ + -2, /* (504) signed ::= NK_PLUS NK_FLOAT */ + -2, /* (505) signed ::= NK_MINUS NK_FLOAT */ + -1, /* (506) signed_literal ::= signed */ + -1, /* (507) signed_literal ::= NK_STRING */ + -1, /* (508) signed_literal ::= NK_BOOL */ + -2, /* (509) signed_literal ::= TIMESTAMP NK_STRING */ + -1, /* (510) signed_literal ::= duration_literal */ + -1, /* (511) signed_literal ::= NULL */ + -1, /* (512) signed_literal ::= literal_func */ + -1, /* (513) signed_literal ::= NK_QUESTION */ + -1, /* (514) literal_list ::= signed_literal */ + -3, /* (515) literal_list ::= literal_list NK_COMMA signed_literal */ + -1, /* (516) db_name ::= NK_ID */ + -1, /* (517) table_name ::= NK_ID */ + -1, /* (518) column_name ::= NK_ID */ + -1, /* (519) function_name ::= NK_ID */ + -1, /* (520) view_name ::= NK_ID */ + -1, /* (521) table_alias ::= NK_ID */ + -1, /* (522) column_alias ::= NK_ID */ + -1, /* (523) column_alias ::= NK_ALIAS */ + -1, /* (524) user_name ::= NK_ID */ + -1, /* (525) topic_name ::= NK_ID */ + -1, /* (526) stream_name ::= NK_ID */ + -1, /* (527) cgroup_name ::= NK_ID */ + -1, /* (528) index_name ::= NK_ID */ + -1, /* (529) tsma_name ::= NK_ID */ + -1, /* (530) expr_or_subquery ::= expression */ + -1, /* (531) expression ::= literal */ + -1, /* (532) expression ::= pseudo_column */ + -1, /* (533) expression ::= column_reference */ + -1, /* (534) expression ::= function_expression */ + -1, /* (535) expression ::= case_when_expression */ + -3, /* (536) expression ::= NK_LP expression NK_RP */ + -2, /* (537) expression ::= NK_PLUS expr_or_subquery */ + -2, /* (538) expression ::= NK_MINUS expr_or_subquery */ + -3, /* (539) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ + -3, /* (540) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ + -3, /* (541) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ + -3, /* (542) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ + -3, /* (543) expression ::= expr_or_subquery NK_REM expr_or_subquery */ + -3, /* (544) expression ::= column_reference NK_ARROW NK_STRING */ + -3, /* (545) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ + -3, /* (546) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ + -1, /* (547) expression_list ::= expr_or_subquery */ + -3, /* (548) expression_list ::= expression_list NK_COMMA expr_or_subquery */ + -1, /* (549) column_reference ::= column_name */ + -3, /* (550) column_reference ::= table_name NK_DOT column_name */ + -1, /* (551) column_reference ::= NK_ALIAS */ + -3, /* (552) column_reference ::= table_name NK_DOT NK_ALIAS */ + -1, /* (553) pseudo_column ::= ROWTS */ + -1, /* (554) pseudo_column ::= TBNAME */ + -3, /* (555) pseudo_column ::= table_name NK_DOT TBNAME */ + -1, /* (556) pseudo_column ::= QSTART */ + -1, /* (557) pseudo_column ::= QEND */ + -1, /* (558) pseudo_column ::= QDURATION */ + -1, /* (559) pseudo_column ::= WSTART */ + -1, /* (560) pseudo_column ::= WEND */ + -1, /* (561) pseudo_column ::= WDURATION */ + -1, /* (562) pseudo_column ::= IROWTS */ + -1, /* (563) pseudo_column ::= ISFILLED */ + -1, /* (564) pseudo_column ::= QTAGS */ + -4, /* (565) function_expression ::= function_name NK_LP expression_list NK_RP */ + -4, /* (566) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ + -6, /* (567) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ + -6, /* (568) function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP */ + -6, /* (569) function_expression ::= POSITION NK_LP expr_or_subquery IN expr_or_subquery NK_RP */ + -4, /* (570) function_expression ::= TRIM NK_LP expr_or_subquery NK_RP */ + -6, /* (571) function_expression ::= TRIM NK_LP trim_specification_type FROM expr_or_subquery NK_RP */ + -7, /* (572) function_expression ::= TRIM NK_LP trim_specification_type expr_or_subquery FROM expr_or_subquery NK_RP */ + -4, /* (573) function_expression ::= substr_func NK_LP expression_list NK_RP */ + -6, /* (574) function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery NK_RP */ + -8, /* (575) function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery FOR expr_or_subquery NK_RP */ + -4, /* (576) function_expression ::= REPLACE NK_LP expression_list NK_RP */ + -1, /* (577) function_expression ::= literal_func */ + -3, /* (578) literal_func ::= noarg_func NK_LP NK_RP */ + -1, /* (579) literal_func ::= NOW */ + -1, /* (580) literal_func ::= TODAY */ + -1, /* (581) substr_func ::= SUBSTR */ + -1, /* (582) substr_func ::= SUBSTRING */ + 0, /* (583) trim_specification_type ::= */ + -1, /* (584) trim_specification_type ::= BOTH */ + -1, /* (585) trim_specification_type ::= TRAILING */ + -1, /* (586) trim_specification_type ::= LEADING */ + -1, /* (587) noarg_func ::= NOW */ + -1, /* (588) noarg_func ::= TODAY */ + -1, /* (589) noarg_func ::= TIMEZONE */ + -1, /* (590) noarg_func ::= DATABASE */ + -1, /* (591) noarg_func ::= CLIENT_VERSION */ + -1, /* (592) noarg_func ::= SERVER_VERSION */ + -1, /* (593) noarg_func ::= SERVER_STATUS */ + -1, /* (594) noarg_func ::= CURRENT_USER */ + -1, /* (595) noarg_func ::= USER */ + -1, /* (596) noarg_func ::= PI */ + -1, /* (597) star_func ::= COUNT */ + -1, /* (598) star_func ::= FIRST */ + -1, /* (599) star_func ::= LAST */ + -1, /* (600) star_func ::= LAST_ROW */ + -1, /* (601) star_func_para_list ::= NK_STAR */ + -1, /* (602) star_func_para_list ::= other_para_list */ + -1, /* (603) other_para_list ::= star_func_para */ + -3, /* (604) other_para_list ::= other_para_list NK_COMMA star_func_para */ + -1, /* (605) star_func_para ::= expr_or_subquery */ + -3, /* (606) star_func_para ::= table_name NK_DOT NK_STAR */ + -4, /* (607) case_when_expression ::= CASE when_then_list case_when_else_opt END */ + -5, /* (608) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ + -1, /* (609) when_then_list ::= when_then_expr */ + -2, /* (610) when_then_list ::= when_then_list when_then_expr */ + -4, /* (611) when_then_expr ::= WHEN common_expression THEN common_expression */ + 0, /* (612) case_when_else_opt ::= */ + -2, /* (613) case_when_else_opt ::= ELSE common_expression */ + -3, /* (614) predicate ::= expr_or_subquery compare_op expr_or_subquery */ + -5, /* (615) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ + -6, /* (616) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ + -3, /* (617) predicate ::= expr_or_subquery IS NULL */ + -4, /* (618) predicate ::= expr_or_subquery IS NOT NULL */ + -3, /* (619) predicate ::= expr_or_subquery in_op in_predicate_value */ + -1, /* (620) compare_op ::= NK_LT */ + -1, /* (621) compare_op ::= NK_GT */ + -1, /* (622) compare_op ::= NK_LE */ + -1, /* (623) compare_op ::= NK_GE */ + -1, /* (624) compare_op ::= NK_NE */ + -1, /* (625) compare_op ::= NK_EQ */ + -1, /* (626) compare_op ::= LIKE */ + -2, /* (627) compare_op ::= NOT LIKE */ + -1, /* (628) compare_op ::= MATCH */ + -1, /* (629) compare_op ::= NMATCH */ + -1, /* (630) compare_op ::= CONTAINS */ + -1, /* (631) in_op ::= IN */ + -2, /* (632) in_op ::= NOT IN */ + -3, /* (633) in_predicate_value ::= NK_LP literal_list NK_RP */ + -1, /* (634) boolean_value_expression ::= boolean_primary */ + -2, /* (635) boolean_value_expression ::= NOT boolean_primary */ + -3, /* (636) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + -3, /* (637) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + -1, /* (638) boolean_primary ::= predicate */ + -3, /* (639) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ + -1, /* (640) common_expression ::= expr_or_subquery */ + -1, /* (641) common_expression ::= boolean_value_expression */ + 0, /* (642) from_clause_opt ::= */ + -2, /* (643) from_clause_opt ::= FROM table_reference_list */ + -1, /* (644) table_reference_list ::= table_reference */ + -3, /* (645) table_reference_list ::= table_reference_list NK_COMMA table_reference */ + -1, /* (646) table_reference ::= table_primary */ + -1, /* (647) table_reference ::= joined_table */ + -2, /* (648) table_primary ::= table_name alias_opt */ + -4, /* (649) table_primary ::= db_name NK_DOT table_name alias_opt */ + -2, /* (650) table_primary ::= subquery alias_opt */ + -1, /* (651) table_primary ::= parenthesized_joined_table */ + 0, /* (652) alias_opt ::= */ + -1, /* (653) alias_opt ::= table_alias */ + -2, /* (654) alias_opt ::= AS table_alias */ + -3, /* (655) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + -3, /* (656) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ + -8, /* (657) joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt */ + 0, /* (658) join_type ::= */ + -1, /* (659) join_type ::= INNER */ + -1, /* (660) join_type ::= LEFT */ + -1, /* (661) join_type ::= RIGHT */ + -1, /* (662) join_type ::= FULL */ + 0, /* (663) join_subtype ::= */ + -1, /* (664) join_subtype ::= OUTER */ + -1, /* (665) join_subtype ::= SEMI */ + -1, /* (666) join_subtype ::= ANTI */ + -1, /* (667) join_subtype ::= ASOF */ + -1, /* (668) join_subtype ::= WINDOW */ + 0, /* (669) join_on_clause_opt ::= */ + -2, /* (670) join_on_clause_opt ::= ON search_condition */ + 0, /* (671) window_offset_clause_opt ::= */ + -6, /* (672) window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP */ + -1, /* (673) window_offset_literal ::= NK_VARIABLE */ + -2, /* (674) window_offset_literal ::= NK_MINUS NK_VARIABLE */ + 0, /* (675) jlimit_clause_opt ::= */ + -2, /* (676) jlimit_clause_opt ::= JLIMIT NK_INTEGER */ + -14, /* (677) query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_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 */ + 0, /* (678) hint_list ::= */ + -1, /* (679) hint_list ::= NK_HINT */ + 0, /* (680) tag_mode_opt ::= */ + -1, /* (681) tag_mode_opt ::= TAGS */ + 0, /* (682) set_quantifier_opt ::= */ + -1, /* (683) set_quantifier_opt ::= DISTINCT */ + -1, /* (684) set_quantifier_opt ::= ALL */ + -1, /* (685) select_list ::= select_item */ + -3, /* (686) select_list ::= select_list NK_COMMA select_item */ + -1, /* (687) select_item ::= NK_STAR */ + -1, /* (688) select_item ::= common_expression */ + -2, /* (689) select_item ::= common_expression column_alias */ + -3, /* (690) select_item ::= common_expression AS column_alias */ + -3, /* (691) select_item ::= table_name NK_DOT NK_STAR */ + 0, /* (692) where_clause_opt ::= */ + -2, /* (693) where_clause_opt ::= WHERE search_condition */ + 0, /* (694) partition_by_clause_opt ::= */ + -3, /* (695) partition_by_clause_opt ::= PARTITION BY partition_list */ + -1, /* (696) partition_list ::= partition_item */ + -3, /* (697) partition_list ::= partition_list NK_COMMA partition_item */ + -1, /* (698) partition_item ::= expr_or_subquery */ + -2, /* (699) partition_item ::= expr_or_subquery column_alias */ + -3, /* (700) partition_item ::= expr_or_subquery AS column_alias */ + 0, /* (701) twindow_clause_opt ::= */ + -6, /* (702) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ + -4, /* (703) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ + -6, /* (704) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ + -8, /* (705) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ + -7, /* (706) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ + -4, /* (707) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */ + -6, /* (708) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + 0, /* (709) sliding_opt ::= */ + -4, /* (710) sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ + -1, /* (711) interval_sliding_duration_literal ::= NK_VARIABLE */ + -1, /* (712) interval_sliding_duration_literal ::= NK_STRING */ + -1, /* (713) interval_sliding_duration_literal ::= NK_INTEGER */ + 0, /* (714) fill_opt ::= */ + -4, /* (715) fill_opt ::= FILL NK_LP fill_mode NK_RP */ + -6, /* (716) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ + -6, /* (717) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ + -1, /* (718) fill_mode ::= NONE */ + -1, /* (719) fill_mode ::= PREV */ + -1, /* (720) fill_mode ::= NULL */ + -1, /* (721) fill_mode ::= NULL_F */ + -1, /* (722) fill_mode ::= LINEAR */ + -1, /* (723) fill_mode ::= NEXT */ + 0, /* (724) group_by_clause_opt ::= */ + -3, /* (725) group_by_clause_opt ::= GROUP BY group_by_list */ + -1, /* (726) group_by_list ::= expr_or_subquery */ + -3, /* (727) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ + 0, /* (728) having_clause_opt ::= */ + -2, /* (729) having_clause_opt ::= HAVING search_condition */ + 0, /* (730) range_opt ::= */ + -6, /* (731) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ + -4, /* (732) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ + 0, /* (733) every_opt ::= */ + -4, /* (734) every_opt ::= EVERY NK_LP duration_literal NK_RP */ + -4, /* (735) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ + -1, /* (736) query_simple ::= query_specification */ + -1, /* (737) query_simple ::= union_query_expression */ + -4, /* (738) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ + -3, /* (739) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ + -1, /* (740) query_simple_or_subquery ::= query_simple */ + -1, /* (741) query_simple_or_subquery ::= subquery */ + -1, /* (742) query_or_subquery ::= query_expression */ + -1, /* (743) query_or_subquery ::= subquery */ + 0, /* (744) order_by_clause_opt ::= */ + -3, /* (745) order_by_clause_opt ::= ORDER BY sort_specification_list */ + 0, /* (746) slimit_clause_opt ::= */ + -2, /* (747) slimit_clause_opt ::= SLIMIT NK_INTEGER */ + -4, /* (748) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + -4, /* (749) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + 0, /* (750) limit_clause_opt ::= */ + -2, /* (751) limit_clause_opt ::= LIMIT NK_INTEGER */ + -4, /* (752) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ + -4, /* (753) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + -3, /* (754) subquery ::= NK_LP query_expression NK_RP */ + -3, /* (755) subquery ::= NK_LP subquery NK_RP */ + -1, /* (756) search_condition ::= common_expression */ + -1, /* (757) sort_specification_list ::= sort_specification */ + -3, /* (758) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ + -3, /* (759) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ + 0, /* (760) ordering_specification_opt ::= */ + -1, /* (761) ordering_specification_opt ::= ASC */ + -1, /* (762) ordering_specification_opt ::= DESC */ + 0, /* (763) null_ordering_opt ::= */ + -2, /* (764) null_ordering_opt ::= NULLS FIRST */ + -2, /* (765) null_ordering_opt ::= NULLS LAST */ + 0, /* (766) column_options ::= */ + -3, /* (767) column_options ::= column_options PRIMARY KEY */ + -3, /* (768) column_options ::= column_options ENCODE NK_STRING */ + -3, /* (769) column_options ::= column_options COMPRESS NK_STRING */ + -3, /* (770) column_options ::= column_options LEVEL NK_STRING */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -5570,23 +5823,23 @@ static void yy_accept(yyParser*); /* Forward Declaration */ ** means that the extra parameters have no performance impact. */ static YYACTIONTYPE yy_reduce( - yyParser *yypParser, /* The parser */ - unsigned int yyruleno, /* Number of the rule by which to reduce */ - int yyLookahead, /* Lookahead token, or YYNOCODE if none */ - ParseTOKENTYPE yyLookaheadToken /* Value of the lookahead token */ - ParseCTX_PDECL /* %extra_context */ + yyParser *yypParser, /* The parser */ + unsigned int yyruleno, /* Number of the rule by which to reduce */ + int yyLookahead, /* Lookahead token, or YYNOCODE if none */ + ParseTOKENTYPE yyLookaheadToken /* Value of the lookahead token */ + ParseCTX_PDECL /* %extra_context */ ){ int yygoto; /* The next state */ YYACTIONTYPE yyact; /* The next action */ yyStackEntry *yymsp; /* The top of the parser's stack */ int yysize; /* Amount to pop the stack */ ParseARG_FETCH - (void)yyLookahead; + (void)yyLookahead; (void)yyLookaheadToken; yymsp = yypParser->yytos; switch( yyruleno ){ - /* Beginning here are the reduction cases. A typical example + /* Beginning here are the reduction cases. A typical example ** follows: ** case 0: ** #line @@ -5597,21 +5850,15 @@ static YYACTIONTYPE yy_reduce( /********** Begin reduce actions **********************************************/ YYMINORTYPE yylhsminor; case 0: /* cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ -#line 50 "sql.y" { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } -#line 5567 "sql.c" - yy_destructor(yypParser,379,&yymsp[0].minor); + yy_destructor(yypParser,387,&yymsp[0].minor); break; case 1: /* cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ -#line 51 "sql.y" { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } -#line 5573 "sql.c" - yy_destructor(yypParser,380,&yymsp[0].minor); + yy_destructor(yypParser,388,&yymsp[0].minor); break; case 2: /* account_options ::= */ -#line 55 "sql.y" { } -#line 5579 "sql.c" break; case 3: /* account_options ::= account_options PPS literal */ case 4: /* account_options ::= account_options TSERIES literal */ yytestcase(yyruleno==4); @@ -5622,26 +5869,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,379,&yymsp[-2].minor); -#line 56 "sql.y" +{ yy_destructor(yypParser,387,&yymsp[-2].minor); { } -#line 5593 "sql.c" - yy_destructor(yypParser,381,&yymsp[0].minor); + yy_destructor(yypParser,389,&yymsp[0].minor); } break; case 12: /* alter_account_options ::= alter_account_option */ -{ yy_destructor(yypParser,382,&yymsp[0].minor); -#line 68 "sql.y" +{ yy_destructor(yypParser,390,&yymsp[0].minor); { } -#line 5601 "sql.c" } break; case 13: /* alter_account_options ::= alter_account_options alter_account_option */ -{ yy_destructor(yypParser,380,&yymsp[-1].minor); -#line 69 "sql.y" +{ yy_destructor(yypParser,388,&yymsp[-1].minor); { } -#line 5608 "sql.c" - yy_destructor(yypParser,382,&yymsp[0].minor); + yy_destructor(yypParser,390,&yymsp[0].minor); } break; case 14: /* alter_account_option ::= PASS literal */ @@ -5654,27 +5895,19 @@ static YYACTIONTYPE yy_reduce( case 21: /* alter_account_option ::= USERS literal */ yytestcase(yyruleno==21); case 22: /* alter_account_option ::= CONNS literal */ yytestcase(yyruleno==22); case 23: /* alter_account_option ::= STATE literal */ yytestcase(yyruleno==23); -#line 73 "sql.y" { } -#line 5624 "sql.c" - yy_destructor(yypParser,381,&yymsp[0].minor); + yy_destructor(yypParser,389,&yymsp[0].minor); break; case 24: /* ip_range_list ::= NK_STRING */ -#line 86 "sql.y" -{ yylhsminor.yy316 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } -#line 5630 "sql.c" - yymsp[0].minor.yy316 = yylhsminor.yy316; +{ yylhsminor.yy456 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy456 = yylhsminor.yy456; break; case 25: /* ip_range_list ::= ip_range_list NK_COMMA NK_STRING */ -#line 87 "sql.y" -{ yylhsminor.yy316 = addNodeToList(pCxt, yymsp[-2].minor.yy316, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } -#line 5636 "sql.c" - yymsp[-2].minor.yy316 = yylhsminor.yy316; +{ yylhsminor.yy456 = addNodeToList(pCxt, yymsp[-2].minor.yy456, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy456 = yylhsminor.yy456; break; case 26: /* white_list ::= HOST ip_range_list */ -#line 91 "sql.y" -{ yymsp[-1].minor.yy316 = yymsp[0].minor.yy316; } -#line 5642 "sql.c" +{ yymsp[-1].minor.yy456 = yymsp[0].minor.yy456; } break; case 27: /* white_list_opt ::= */ case 206: /* specific_cols_opt ::= */ yytestcase(yyruleno==206); @@ -5682,246 +5915,166 @@ static YYACTIONTYPE yy_reduce( case 335: /* tag_list_opt ::= */ yytestcase(yyruleno==335); case 408: /* col_list_opt ::= */ yytestcase(yyruleno==408); case 415: /* tag_def_or_ref_opt ::= */ yytestcase(yyruleno==415); - case 678: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==678); - case 708: /* group_by_clause_opt ::= */ yytestcase(yyruleno==708); - case 728: /* order_by_clause_opt ::= */ yytestcase(yyruleno==728); -#line 95 "sql.y" -{ yymsp[1].minor.yy316 = NULL; } -#line 5655 "sql.c" + case 694: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==694); + case 724: /* group_by_clause_opt ::= */ yytestcase(yyruleno==724); + case 744: /* order_by_clause_opt ::= */ yytestcase(yyruleno==744); +{ yymsp[1].minor.yy456 = NULL; } break; case 28: /* white_list_opt ::= white_list */ case 245: /* tags_def_opt ::= tags_def */ yytestcase(yyruleno==245); case 416: /* tag_def_or_ref_opt ::= tags_def */ yytestcase(yyruleno==416); - case 586: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==586); -#line 96 "sql.y" -{ yylhsminor.yy316 = yymsp[0].minor.yy316; } -#line 5663 "sql.c" - yymsp[0].minor.yy316 = yylhsminor.yy316; + case 602: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==602); +{ yylhsminor.yy456 = yymsp[0].minor.yy456; } + yymsp[0].minor.yy456 = yylhsminor.yy456; break; case 29: /* is_import_opt ::= */ case 31: /* is_createdb_opt ::= */ yytestcase(yyruleno==31); -#line 100 "sql.y" -{ yymsp[1].minor.yy1043 = 0; } -#line 5670 "sql.c" +{ yymsp[1].minor.yy343 = 0; } break; case 30: /* is_import_opt ::= IS_IMPORT NK_INTEGER */ case 32: /* is_createdb_opt ::= CREATEDB NK_INTEGER */ yytestcase(yyruleno==32); case 42: /* sysinfo_opt ::= SYSINFO NK_INTEGER */ yytestcase(yyruleno==42); -#line 101 "sql.y" -{ yymsp[-1].minor.yy1043 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); } -#line 5677 "sql.c" +{ yymsp[-1].minor.yy343 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); } break; case 33: /* cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt is_createdb_opt is_import_opt white_list_opt */ -#line 109 "sql.y" { - pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-6].minor.yy1109, &yymsp[-4].minor.yy0, yymsp[-3].minor.yy1043, yymsp[-1].minor.yy1043, yymsp[-2].minor.yy1043); - pCxt->pRootNode = addCreateUserStmtWhiteList(pCxt, pCxt->pRootNode, yymsp[0].minor.yy316); + pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-6].minor.yy209, &yymsp[-4].minor.yy0, yymsp[-3].minor.yy343, yymsp[-1].minor.yy343, yymsp[-2].minor.yy343); + pCxt->pRootNode = addCreateUserStmtWhiteList(pCxt, pCxt->pRootNode, yymsp[0].minor.yy456); } -#line 5685 "sql.c" break; case 34: /* cmd ::= ALTER USER user_name PASS NK_STRING */ -#line 113 "sql.y" -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy1109, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } -#line 5690 "sql.c" +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy209, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } break; case 35: /* cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ -#line 114 "sql.y" -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy1109, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); } -#line 5695 "sql.c" +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy209, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); } break; case 36: /* cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ -#line 115 "sql.y" -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy1109, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); } -#line 5700 "sql.c" +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy209, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); } break; case 37: /* cmd ::= ALTER USER user_name CREATEDB NK_INTEGER */ -#line 116 "sql.y" -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy1109, TSDB_ALTER_USER_CREATEDB, &yymsp[0].minor.yy0); } -#line 5705 "sql.c" +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy209, TSDB_ALTER_USER_CREATEDB, &yymsp[0].minor.yy0); } break; case 38: /* cmd ::= ALTER USER user_name ADD white_list */ -#line 117 "sql.y" -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy1109, TSDB_ALTER_USER_ADD_WHITE_LIST, yymsp[0].minor.yy316); } -#line 5710 "sql.c" +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy209, TSDB_ALTER_USER_ADD_WHITE_LIST, yymsp[0].minor.yy456); } break; case 39: /* cmd ::= ALTER USER user_name DROP white_list */ -#line 118 "sql.y" -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy1109, TSDB_ALTER_USER_DROP_WHITE_LIST, yymsp[0].minor.yy316); } -#line 5715 "sql.c" +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy209, TSDB_ALTER_USER_DROP_WHITE_LIST, yymsp[0].minor.yy456); } break; case 40: /* cmd ::= DROP USER user_name */ -#line 119 "sql.y" -{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy1109); } -#line 5720 "sql.c" +{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy209); } break; case 41: /* sysinfo_opt ::= */ -#line 123 "sql.y" -{ yymsp[1].minor.yy1043 = 1; } -#line 5725 "sql.c" +{ yymsp[1].minor.yy343 = 1; } break; case 43: /* cmd ::= GRANT privileges ON priv_level with_opt TO user_name */ -#line 127 "sql.y" -{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-5].minor.yy1089, &yymsp[-3].minor.yy849, &yymsp[0].minor.yy1109, yymsp[-2].minor.yy416); } -#line 5730 "sql.c" +{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-5].minor.yy637, &yymsp[-3].minor.yy1065, &yymsp[0].minor.yy209, yymsp[-2].minor.yy840); } break; case 44: /* cmd ::= REVOKE privileges ON priv_level with_opt FROM user_name */ -#line 128 "sql.y" -{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-5].minor.yy1089, &yymsp[-3].minor.yy849, &yymsp[0].minor.yy1109, yymsp[-2].minor.yy416); } -#line 5735 "sql.c" +{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-5].minor.yy637, &yymsp[-3].minor.yy1065, &yymsp[0].minor.yy209, yymsp[-2].minor.yy840); } break; case 45: /* privileges ::= ALL */ -#line 132 "sql.y" -{ yymsp[0].minor.yy1089 = PRIVILEGE_TYPE_ALL; } -#line 5740 "sql.c" +{ yymsp[0].minor.yy637 = PRIVILEGE_TYPE_ALL; } break; case 46: /* privileges ::= priv_type_list */ case 48: /* priv_type_list ::= priv_type */ yytestcase(yyruleno==48); -#line 133 "sql.y" -{ yylhsminor.yy1089 = yymsp[0].minor.yy1089; } -#line 5746 "sql.c" - yymsp[0].minor.yy1089 = yylhsminor.yy1089; +{ yylhsminor.yy637 = yymsp[0].minor.yy637; } + yymsp[0].minor.yy637 = yylhsminor.yy637; break; case 47: /* privileges ::= SUBSCRIBE */ -#line 134 "sql.y" -{ yymsp[0].minor.yy1089 = PRIVILEGE_TYPE_SUBSCRIBE; } -#line 5752 "sql.c" +{ yymsp[0].minor.yy637 = PRIVILEGE_TYPE_SUBSCRIBE; } break; case 49: /* priv_type_list ::= priv_type_list NK_COMMA priv_type */ -#line 139 "sql.y" -{ yylhsminor.yy1089 = yymsp[-2].minor.yy1089 | yymsp[0].minor.yy1089; } -#line 5757 "sql.c" - yymsp[-2].minor.yy1089 = yylhsminor.yy1089; +{ yylhsminor.yy637 = yymsp[-2].minor.yy637 | yymsp[0].minor.yy637; } + yymsp[-2].minor.yy637 = yylhsminor.yy637; break; case 50: /* priv_type ::= READ */ -#line 143 "sql.y" -{ yymsp[0].minor.yy1089 = PRIVILEGE_TYPE_READ; } -#line 5763 "sql.c" +{ yymsp[0].minor.yy637 = PRIVILEGE_TYPE_READ; } break; case 51: /* priv_type ::= WRITE */ -#line 144 "sql.y" -{ yymsp[0].minor.yy1089 = PRIVILEGE_TYPE_WRITE; } -#line 5768 "sql.c" +{ yymsp[0].minor.yy637 = PRIVILEGE_TYPE_WRITE; } break; case 52: /* priv_type ::= ALTER */ -#line 145 "sql.y" -{ yymsp[0].minor.yy1089 = PRIVILEGE_TYPE_ALTER; } -#line 5773 "sql.c" +{ yymsp[0].minor.yy637 = PRIVILEGE_TYPE_ALTER; } break; case 53: /* priv_level ::= NK_STAR NK_DOT NK_STAR */ -#line 149 "sql.y" -{ yylhsminor.yy849.first = yymsp[-2].minor.yy0; yylhsminor.yy849.second = yymsp[0].minor.yy0; } -#line 5778 "sql.c" - yymsp[-2].minor.yy849 = yylhsminor.yy849; +{ yylhsminor.yy1065.first = yymsp[-2].minor.yy0; yylhsminor.yy1065.second = yymsp[0].minor.yy0; } + yymsp[-2].minor.yy1065 = yylhsminor.yy1065; break; case 54: /* priv_level ::= db_name NK_DOT NK_STAR */ -#line 150 "sql.y" -{ yylhsminor.yy849.first = yymsp[-2].minor.yy1109; yylhsminor.yy849.second = yymsp[0].minor.yy0; } -#line 5784 "sql.c" - yymsp[-2].minor.yy849 = yylhsminor.yy849; +{ yylhsminor.yy1065.first = yymsp[-2].minor.yy209; yylhsminor.yy1065.second = yymsp[0].minor.yy0; } + yymsp[-2].minor.yy1065 = yylhsminor.yy1065; break; case 55: /* priv_level ::= db_name NK_DOT table_name */ -#line 151 "sql.y" -{ yylhsminor.yy849.first = yymsp[-2].minor.yy1109; yylhsminor.yy849.second = yymsp[0].minor.yy1109; } -#line 5790 "sql.c" - yymsp[-2].minor.yy849 = yylhsminor.yy849; +{ yylhsminor.yy1065.first = yymsp[-2].minor.yy209; yylhsminor.yy1065.second = yymsp[0].minor.yy209; } + yymsp[-2].minor.yy1065 = yylhsminor.yy1065; break; case 56: /* priv_level ::= topic_name */ -#line 152 "sql.y" -{ yylhsminor.yy849.first = yymsp[0].minor.yy1109; yylhsminor.yy849.second = nil_token; } -#line 5796 "sql.c" - yymsp[0].minor.yy849 = yylhsminor.yy849; +{ yylhsminor.yy1065.first = yymsp[0].minor.yy209; yylhsminor.yy1065.second = nil_token; } + yymsp[0].minor.yy1065 = yylhsminor.yy1065; break; case 57: /* with_opt ::= */ case 173: /* start_opt ::= */ yytestcase(yyruleno==173); case 177: /* end_opt ::= */ yytestcase(yyruleno==177); case 330: /* like_pattern_opt ::= */ yytestcase(yyruleno==330); - case 427: /* subtable_opt ::= */ yytestcase(yyruleno==427); - case 596: /* case_when_else_opt ::= */ yytestcase(yyruleno==596); - case 626: /* from_clause_opt ::= */ yytestcase(yyruleno==626); - case 653: /* join_on_clause_opt ::= */ yytestcase(yyruleno==653); - case 655: /* window_offset_clause_opt ::= */ yytestcase(yyruleno==655); - case 659: /* jlimit_clause_opt ::= */ yytestcase(yyruleno==659); - case 676: /* where_clause_opt ::= */ yytestcase(yyruleno==676); - case 685: /* twindow_clause_opt ::= */ yytestcase(yyruleno==685); - case 693: /* sliding_opt ::= */ yytestcase(yyruleno==693); - case 698: /* fill_opt ::= */ yytestcase(yyruleno==698); - case 712: /* having_clause_opt ::= */ yytestcase(yyruleno==712); - case 714: /* range_opt ::= */ yytestcase(yyruleno==714); - case 717: /* every_opt ::= */ yytestcase(yyruleno==717); - case 730: /* slimit_clause_opt ::= */ yytestcase(yyruleno==730); - case 734: /* limit_clause_opt ::= */ yytestcase(yyruleno==734); -#line 154 "sql.y" -{ yymsp[1].minor.yy416 = NULL; } -#line 5820 "sql.c" + case 428: /* subtable_opt ::= */ yytestcase(yyruleno==428); + case 612: /* case_when_else_opt ::= */ yytestcase(yyruleno==612); + case 642: /* from_clause_opt ::= */ yytestcase(yyruleno==642); + case 669: /* join_on_clause_opt ::= */ yytestcase(yyruleno==669); + case 671: /* window_offset_clause_opt ::= */ yytestcase(yyruleno==671); + case 675: /* jlimit_clause_opt ::= */ yytestcase(yyruleno==675); + case 692: /* where_clause_opt ::= */ yytestcase(yyruleno==692); + case 701: /* twindow_clause_opt ::= */ yytestcase(yyruleno==701); + case 709: /* sliding_opt ::= */ yytestcase(yyruleno==709); + case 714: /* fill_opt ::= */ yytestcase(yyruleno==714); + case 728: /* having_clause_opt ::= */ yytestcase(yyruleno==728); + case 730: /* range_opt ::= */ yytestcase(yyruleno==730); + case 733: /* every_opt ::= */ yytestcase(yyruleno==733); + case 746: /* slimit_clause_opt ::= */ yytestcase(yyruleno==746); + case 750: /* limit_clause_opt ::= */ yytestcase(yyruleno==750); +{ yymsp[1].minor.yy840 = NULL; } break; case 58: /* with_opt ::= WITH search_condition */ - case 627: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==627); - case 654: /* join_on_clause_opt ::= ON search_condition */ yytestcase(yyruleno==654); - case 677: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==677); - case 713: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==713); -#line 155 "sql.y" -{ yymsp[-1].minor.yy416 = yymsp[0].minor.yy416; } -#line 5829 "sql.c" + case 643: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==643); + case 670: /* join_on_clause_opt ::= ON search_condition */ yytestcase(yyruleno==670); + case 693: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==693); + case 729: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==729); +{ yymsp[-1].minor.yy840 = yymsp[0].minor.yy840; } break; case 59: /* cmd ::= CREATE ENCRYPT_KEY NK_STRING */ -#line 158 "sql.y" { pCxt->pRootNode = createEncryptKeyStmt(pCxt, &yymsp[0].minor.yy0); } -#line 5834 "sql.c" break; case 60: /* cmd ::= CREATE DNODE dnode_endpoint */ -#line 161 "sql.y" -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy1109, NULL); } -#line 5839 "sql.c" +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy209, NULL); } break; case 61: /* cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ -#line 162 "sql.y" -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy1109, &yymsp[0].minor.yy0); } -#line 5844 "sql.c" +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy209, &yymsp[0].minor.yy0); } break; case 62: /* cmd ::= DROP DNODE NK_INTEGER force_opt */ -#line 163 "sql.y" -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy209, false); } -#line 5849 "sql.c" +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy9, false); } break; case 63: /* cmd ::= DROP DNODE dnode_endpoint force_opt */ -#line 164 "sql.y" -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy1109, yymsp[0].minor.yy209, false); } -#line 5854 "sql.c" +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy209, yymsp[0].minor.yy9, false); } break; case 64: /* cmd ::= DROP DNODE NK_INTEGER unsafe_opt */ -#line 165 "sql.y" -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, false, yymsp[0].minor.yy209); } -#line 5859 "sql.c" +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, false, yymsp[0].minor.yy9); } break; case 65: /* cmd ::= DROP DNODE dnode_endpoint unsafe_opt */ -#line 166 "sql.y" -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy1109, false, yymsp[0].minor.yy209); } -#line 5864 "sql.c" +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy209, false, yymsp[0].minor.yy9); } break; case 66: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ -#line 167 "sql.y" { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, NULL); } -#line 5869 "sql.c" break; case 67: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ -#line 168 "sql.y" { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-2].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } -#line 5874 "sql.c" break; case 68: /* cmd ::= ALTER ALL DNODES NK_STRING */ -#line 169 "sql.y" { pCxt->pRootNode = createAlterDnodeStmt(pCxt, NULL, &yymsp[0].minor.yy0, NULL); } -#line 5879 "sql.c" break; case 69: /* cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ -#line 170 "sql.y" { pCxt->pRootNode = createAlterDnodeStmt(pCxt, NULL, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } -#line 5884 "sql.c" break; case 70: /* cmd ::= RESTORE DNODE NK_INTEGER */ -#line 171 "sql.y" { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_DNODE_STMT, &yymsp[0].minor.yy0); } -#line 5889 "sql.c" break; case 71: /* dnode_endpoint ::= NK_STRING */ case 72: /* dnode_endpoint ::= NK_ID */ yytestcase(yyruleno==72); @@ -5930,37 +6083,38 @@ static YYACTIONTYPE yy_reduce( case 365: /* sma_func_name ::= FIRST */ yytestcase(yyruleno==365); case 366: /* sma_func_name ::= LAST */ yytestcase(yyruleno==366); case 367: /* sma_func_name ::= LAST_ROW */ yytestcase(yyruleno==367); - case 515: /* db_name ::= NK_ID */ yytestcase(yyruleno==515); - case 516: /* table_name ::= NK_ID */ yytestcase(yyruleno==516); - case 517: /* column_name ::= NK_ID */ yytestcase(yyruleno==517); - case 518: /* function_name ::= NK_ID */ yytestcase(yyruleno==518); - case 519: /* view_name ::= NK_ID */ yytestcase(yyruleno==519); - case 520: /* table_alias ::= NK_ID */ yytestcase(yyruleno==520); - case 521: /* column_alias ::= NK_ID */ yytestcase(yyruleno==521); - case 522: /* column_alias ::= NK_ALIAS */ yytestcase(yyruleno==522); - case 523: /* user_name ::= NK_ID */ yytestcase(yyruleno==523); - case 524: /* topic_name ::= NK_ID */ yytestcase(yyruleno==524); - case 525: /* stream_name ::= NK_ID */ yytestcase(yyruleno==525); - case 526: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==526); - case 527: /* index_name ::= NK_ID */ yytestcase(yyruleno==527); - case 528: /* tsma_name ::= NK_ID */ yytestcase(yyruleno==528); - case 572: /* noarg_func ::= NOW */ yytestcase(yyruleno==572); - case 573: /* noarg_func ::= TODAY */ yytestcase(yyruleno==573); - case 574: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==574); - case 575: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==575); - case 576: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==576); - case 577: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==577); - case 578: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==578); - case 579: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==579); - case 580: /* noarg_func ::= USER */ yytestcase(yyruleno==580); - case 581: /* star_func ::= COUNT */ yytestcase(yyruleno==581); - case 582: /* star_func ::= FIRST */ yytestcase(yyruleno==582); - case 583: /* star_func ::= LAST */ yytestcase(yyruleno==583); - case 584: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==584); -#line 175 "sql.y" -{ yylhsminor.yy1109 = yymsp[0].minor.yy0; } -#line 5927 "sql.c" - yymsp[0].minor.yy1109 = yylhsminor.yy1109; + case 516: /* db_name ::= NK_ID */ yytestcase(yyruleno==516); + case 517: /* table_name ::= NK_ID */ yytestcase(yyruleno==517); + case 518: /* column_name ::= NK_ID */ yytestcase(yyruleno==518); + case 519: /* function_name ::= NK_ID */ yytestcase(yyruleno==519); + case 520: /* view_name ::= NK_ID */ yytestcase(yyruleno==520); + case 521: /* table_alias ::= NK_ID */ yytestcase(yyruleno==521); + case 522: /* column_alias ::= NK_ID */ yytestcase(yyruleno==522); + case 523: /* column_alias ::= NK_ALIAS */ yytestcase(yyruleno==523); + case 524: /* user_name ::= NK_ID */ yytestcase(yyruleno==524); + case 525: /* topic_name ::= NK_ID */ yytestcase(yyruleno==525); + case 526: /* stream_name ::= NK_ID */ yytestcase(yyruleno==526); + case 527: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==527); + case 528: /* index_name ::= NK_ID */ yytestcase(yyruleno==528); + case 529: /* tsma_name ::= NK_ID */ yytestcase(yyruleno==529); + case 581: /* substr_func ::= SUBSTR */ yytestcase(yyruleno==581); + case 582: /* substr_func ::= SUBSTRING */ yytestcase(yyruleno==582); + case 587: /* noarg_func ::= NOW */ yytestcase(yyruleno==587); + case 588: /* noarg_func ::= TODAY */ yytestcase(yyruleno==588); + case 589: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==589); + case 590: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==590); + case 591: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==591); + case 592: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==592); + case 593: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==593); + case 594: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==594); + case 595: /* noarg_func ::= USER */ yytestcase(yyruleno==595); + case 596: /* noarg_func ::= PI */ yytestcase(yyruleno==596); + case 597: /* star_func ::= COUNT */ yytestcase(yyruleno==597); + case 598: /* star_func ::= FIRST */ yytestcase(yyruleno==598); + case 599: /* star_func ::= LAST */ yytestcase(yyruleno==599); + case 600: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==600); +{ yylhsminor.yy209 = yymsp[0].minor.yy0; } + yymsp[0].minor.yy209 = yylhsminor.yy209; break; case 74: /* force_opt ::= */ case 101: /* not_exists_opt ::= */ yytestcase(yyruleno==101); @@ -5968,500 +6122,330 @@ static YYACTIONTYPE yy_reduce( case 385: /* analyze_opt ::= */ yytestcase(yyruleno==385); case 392: /* agg_func_opt ::= */ yytestcase(yyruleno==392); case 398: /* or_replace_opt ::= */ yytestcase(yyruleno==398); - case 429: /* ignore_opt ::= */ yytestcase(yyruleno==429); - case 664: /* tag_mode_opt ::= */ yytestcase(yyruleno==664); - case 666: /* set_quantifier_opt ::= */ yytestcase(yyruleno==666); -#line 181 "sql.y" -{ yymsp[1].minor.yy209 = false; } -#line 5941 "sql.c" + case 430: /* ignore_opt ::= */ yytestcase(yyruleno==430); + case 680: /* tag_mode_opt ::= */ yytestcase(yyruleno==680); + case 682: /* set_quantifier_opt ::= */ yytestcase(yyruleno==682); +{ yymsp[1].minor.yy9 = false; } break; case 75: /* force_opt ::= FORCE */ case 76: /* unsafe_opt ::= UNSAFE */ yytestcase(yyruleno==76); case 386: /* analyze_opt ::= ANALYZE */ yytestcase(yyruleno==386); case 393: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==393); - case 665: /* tag_mode_opt ::= TAGS */ yytestcase(yyruleno==665); - case 667: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==667); -#line 182 "sql.y" -{ yymsp[0].minor.yy209 = true; } -#line 5951 "sql.c" + case 681: /* tag_mode_opt ::= TAGS */ yytestcase(yyruleno==681); + case 683: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==683); +{ yymsp[0].minor.yy9 = true; } break; case 77: /* cmd ::= ALTER CLUSTER NK_STRING */ -#line 189 "sql.y" { pCxt->pRootNode = createAlterClusterStmt(pCxt, &yymsp[0].minor.yy0, NULL); } -#line 5956 "sql.c" break; case 78: /* cmd ::= ALTER CLUSTER NK_STRING NK_STRING */ -#line 190 "sql.y" { pCxt->pRootNode = createAlterClusterStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } -#line 5961 "sql.c" break; case 79: /* cmd ::= ALTER LOCAL NK_STRING */ -#line 193 "sql.y" { pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[0].minor.yy0, NULL); } -#line 5966 "sql.c" break; case 80: /* cmd ::= ALTER LOCAL NK_STRING NK_STRING */ -#line 194 "sql.y" { pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } -#line 5971 "sql.c" break; case 81: /* cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ -#line 197 "sql.y" { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_QNODE_STMT, &yymsp[0].minor.yy0); } -#line 5976 "sql.c" break; case 82: /* cmd ::= DROP QNODE ON DNODE NK_INTEGER */ -#line 198 "sql.y" { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_QNODE_STMT, &yymsp[0].minor.yy0); } -#line 5981 "sql.c" break; case 83: /* cmd ::= RESTORE QNODE ON DNODE NK_INTEGER */ -#line 199 "sql.y" { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_QNODE_STMT, &yymsp[0].minor.yy0); } -#line 5986 "sql.c" break; case 84: /* cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ -#line 202 "sql.y" { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_BNODE_STMT, &yymsp[0].minor.yy0); } -#line 5991 "sql.c" break; case 85: /* cmd ::= DROP BNODE ON DNODE NK_INTEGER */ -#line 203 "sql.y" { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_BNODE_STMT, &yymsp[0].minor.yy0); } -#line 5996 "sql.c" break; case 86: /* cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ -#line 206 "sql.y" { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_SNODE_STMT, &yymsp[0].minor.yy0); } -#line 6001 "sql.c" break; case 87: /* cmd ::= DROP SNODE ON DNODE NK_INTEGER */ -#line 207 "sql.y" { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_SNODE_STMT, &yymsp[0].minor.yy0); } -#line 6006 "sql.c" break; case 88: /* cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ -#line 210 "sql.y" { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_MNODE_STMT, &yymsp[0].minor.yy0); } -#line 6011 "sql.c" break; case 89: /* cmd ::= DROP MNODE ON DNODE NK_INTEGER */ -#line 211 "sql.y" { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_MNODE_STMT, &yymsp[0].minor.yy0); } -#line 6016 "sql.c" break; case 90: /* cmd ::= RESTORE MNODE ON DNODE NK_INTEGER */ -#line 212 "sql.y" { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_MNODE_STMT, &yymsp[0].minor.yy0); } -#line 6021 "sql.c" break; case 91: /* cmd ::= RESTORE VNODE ON DNODE NK_INTEGER */ -#line 215 "sql.y" { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_VNODE_STMT, &yymsp[0].minor.yy0); } -#line 6026 "sql.c" break; case 92: /* cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ -#line 218 "sql.y" -{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy209, &yymsp[-1].minor.yy1109, yymsp[0].minor.yy416); } -#line 6031 "sql.c" +{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy9, &yymsp[-1].minor.yy209, yymsp[0].minor.yy840); } break; case 93: /* cmd ::= DROP DATABASE exists_opt db_name */ -#line 219 "sql.y" -{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy209, &yymsp[0].minor.yy1109); } -#line 6036 "sql.c" +{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy9, &yymsp[0].minor.yy209); } break; case 94: /* cmd ::= USE db_name */ -#line 220 "sql.y" -{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy1109); } -#line 6041 "sql.c" +{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy209); } break; case 95: /* cmd ::= ALTER DATABASE db_name alter_db_options */ -#line 221 "sql.y" -{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy1109, yymsp[0].minor.yy416); } -#line 6046 "sql.c" +{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy209, yymsp[0].minor.yy840); } break; case 96: /* cmd ::= FLUSH DATABASE db_name */ -#line 222 "sql.y" -{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy1109); } -#line 6051 "sql.c" +{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy209); } break; case 97: /* cmd ::= TRIM DATABASE db_name speed_opt */ -#line 223 "sql.y" -{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy1109, yymsp[0].minor.yy820); } -#line 6056 "sql.c" +{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy209, yymsp[0].minor.yy516); } break; case 98: /* cmd ::= S3MIGRATE DATABASE db_name */ -#line 224 "sql.y" -{ pCxt->pRootNode = createS3MigrateDatabaseStmt(pCxt, &yymsp[0].minor.yy1109); } -#line 6061 "sql.c" +{ pCxt->pRootNode = createS3MigrateDatabaseStmt(pCxt, &yymsp[0].minor.yy209); } break; case 99: /* cmd ::= COMPACT DATABASE db_name start_opt end_opt */ -#line 225 "sql.y" -{ pCxt->pRootNode = createCompactStmt(pCxt, &yymsp[-2].minor.yy1109, yymsp[-1].minor.yy416, yymsp[0].minor.yy416); } -#line 6066 "sql.c" +{ pCxt->pRootNode = createCompactStmt(pCxt, &yymsp[-2].minor.yy209, yymsp[-1].minor.yy840, yymsp[0].minor.yy840); } break; case 100: /* not_exists_opt ::= IF NOT EXISTS */ -#line 229 "sql.y" -{ yymsp[-2].minor.yy209 = true; } -#line 6071 "sql.c" +{ yymsp[-2].minor.yy9 = true; } break; case 102: /* exists_opt ::= IF EXISTS */ case 399: /* or_replace_opt ::= OR REPLACE */ yytestcase(yyruleno==399); - case 430: /* ignore_opt ::= IGNORE UNTREATED */ yytestcase(yyruleno==430); -#line 234 "sql.y" -{ yymsp[-1].minor.yy209 = true; } -#line 6078 "sql.c" + case 431: /* ignore_opt ::= IGNORE UNTREATED */ yytestcase(yyruleno==431); +{ yymsp[-1].minor.yy9 = true; } break; case 104: /* db_options ::= */ -#line 237 "sql.y" -{ yymsp[1].minor.yy416 = createDefaultDatabaseOptions(pCxt); } -#line 6083 "sql.c" +{ yymsp[1].minor.yy840 = createDefaultDatabaseOptions(pCxt); } break; case 105: /* db_options ::= db_options BUFFER NK_INTEGER */ -#line 238 "sql.y" -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } -#line 6088 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 106: /* db_options ::= db_options CACHEMODEL NK_STRING */ -#line 239 "sql.y" -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); } -#line 6094 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 107: /* db_options ::= db_options CACHESIZE NK_INTEGER */ -#line 240 "sql.y" -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); } -#line 6100 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 108: /* db_options ::= db_options COMP NK_INTEGER */ -#line 241 "sql.y" -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_COMP, &yymsp[0].minor.yy0); } -#line 6106 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_COMP, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 109: /* db_options ::= db_options DURATION NK_INTEGER */ case 110: /* db_options ::= db_options DURATION NK_VARIABLE */ yytestcase(yyruleno==110); -#line 242 "sql.y" -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } -#line 6113 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 111: /* db_options ::= db_options MAXROWS NK_INTEGER */ -#line 244 "sql.y" -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } -#line 6119 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 112: /* db_options ::= db_options MINROWS NK_INTEGER */ -#line 245 "sql.y" -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } -#line 6125 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 113: /* db_options ::= db_options KEEP integer_list */ case 114: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==114); -#line 246 "sql.y" -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_KEEP, yymsp[0].minor.yy316); } -#line 6132 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_KEEP, yymsp[0].minor.yy456); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 115: /* db_options ::= db_options PAGES NK_INTEGER */ -#line 248 "sql.y" -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } -#line 6138 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 116: /* db_options ::= db_options PAGESIZE NK_INTEGER */ -#line 249 "sql.y" -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } -#line 6144 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 117: /* db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ -#line 250 "sql.y" -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); } -#line 6150 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 118: /* db_options ::= db_options PRECISION NK_STRING */ -#line 251 "sql.y" -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } -#line 6156 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 119: /* db_options ::= db_options REPLICA NK_INTEGER */ -#line 252 "sql.y" -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } -#line 6162 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 120: /* db_options ::= db_options VGROUPS NK_INTEGER */ -#line 254 "sql.y" -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } -#line 6168 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 121: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */ -#line 255 "sql.y" -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } -#line 6174 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 122: /* db_options ::= db_options RETENTIONS retention_list */ -#line 256 "sql.y" -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_RETENTIONS, yymsp[0].minor.yy316); } -#line 6180 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_RETENTIONS, yymsp[0].minor.yy456); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 123: /* db_options ::= db_options SCHEMALESS NK_INTEGER */ -#line 257 "sql.y" -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } -#line 6186 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 124: /* db_options ::= db_options WAL_LEVEL NK_INTEGER */ -#line 258 "sql.y" -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_WAL, &yymsp[0].minor.yy0); } -#line 6192 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_WAL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 125: /* db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ -#line 259 "sql.y" -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } -#line 6198 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 126: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ -#line 260 "sql.y" -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); } -#line 6204 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 127: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ -#line 261 "sql.y" { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-3].minor.yy416, DB_OPTION_WAL_RETENTION_PERIOD, &t); + yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-3].minor.yy840, DB_OPTION_WAL_RETENTION_PERIOD, &t); } -#line 6214 "sql.c" - yymsp[-3].minor.yy416 = yylhsminor.yy416; + yymsp[-3].minor.yy840 = yylhsminor.yy840; break; case 128: /* db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ -#line 266 "sql.y" -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); } -#line 6220 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 129: /* db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ -#line 267 "sql.y" { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-3].minor.yy416, DB_OPTION_WAL_RETENTION_SIZE, &t); + yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-3].minor.yy840, DB_OPTION_WAL_RETENTION_SIZE, &t); } -#line 6230 "sql.c" - yymsp[-3].minor.yy416 = yylhsminor.yy416; + yymsp[-3].minor.yy840 = yylhsminor.yy840; break; case 130: /* db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ -#line 272 "sql.y" -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); } -#line 6236 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 131: /* db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ -#line 273 "sql.y" -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); } -#line 6242 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 132: /* db_options ::= db_options STT_TRIGGER NK_INTEGER */ -#line 274 "sql.y" -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); } -#line 6248 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 133: /* db_options ::= db_options TABLE_PREFIX signed */ -#line 275 "sql.y" -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_TABLE_PREFIX, yymsp[0].minor.yy416); } -#line 6254 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_TABLE_PREFIX, yymsp[0].minor.yy840); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 134: /* db_options ::= db_options TABLE_SUFFIX signed */ -#line 276 "sql.y" -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_TABLE_SUFFIX, yymsp[0].minor.yy416); } -#line 6260 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_TABLE_SUFFIX, yymsp[0].minor.yy840); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 135: /* db_options ::= db_options S3_CHUNKSIZE NK_INTEGER */ -#line 277 "sql.y" -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_S3_CHUNKSIZE, &yymsp[0].minor.yy0); } -#line 6266 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_S3_CHUNKSIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 136: /* db_options ::= db_options S3_KEEPLOCAL NK_INTEGER */ case 137: /* db_options ::= db_options S3_KEEPLOCAL NK_VARIABLE */ yytestcase(yyruleno==137); -#line 278 "sql.y" -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_S3_KEEPLOCAL, &yymsp[0].minor.yy0); } -#line 6273 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_S3_KEEPLOCAL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 138: /* db_options ::= db_options S3_COMPACT NK_INTEGER */ -#line 280 "sql.y" -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_S3_COMPACT, &yymsp[0].minor.yy0); } -#line 6279 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_S3_COMPACT, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 139: /* db_options ::= db_options KEEP_TIME_OFFSET NK_INTEGER */ -#line 281 "sql.y" -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_KEEP_TIME_OFFSET, &yymsp[0].minor.yy0); } -#line 6285 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_KEEP_TIME_OFFSET, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 140: /* db_options ::= db_options ENCRYPT_ALGORITHM NK_STRING */ -#line 282 "sql.y" -{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_ENCRYPT_ALGORITHM, &yymsp[0].minor.yy0); } -#line 6291 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_ENCRYPT_ALGORITHM, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 141: /* alter_db_options ::= alter_db_option */ -#line 284 "sql.y" -{ yylhsminor.yy416 = createAlterDatabaseOptions(pCxt); yylhsminor.yy416 = setAlterDatabaseOption(pCxt, yylhsminor.yy416, &yymsp[0].minor.yy101); } -#line 6297 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = createAlterDatabaseOptions(pCxt); yylhsminor.yy840 = setAlterDatabaseOption(pCxt, yylhsminor.yy840, &yymsp[0].minor.yy573); } + yymsp[0].minor.yy840 = yylhsminor.yy840; break; case 142: /* alter_db_options ::= alter_db_options alter_db_option */ -#line 285 "sql.y" -{ yylhsminor.yy416 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy416, &yymsp[0].minor.yy101); } -#line 6303 "sql.c" - yymsp[-1].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy840, &yymsp[0].minor.yy573); } + yymsp[-1].minor.yy840 = yylhsminor.yy840; break; case 143: /* alter_db_option ::= BUFFER NK_INTEGER */ -#line 289 "sql.y" -{ yymsp[-1].minor.yy101.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } -#line 6309 "sql.c" +{ yymsp[-1].minor.yy573.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy573.val = yymsp[0].minor.yy0; } break; case 144: /* alter_db_option ::= CACHEMODEL NK_STRING */ -#line 290 "sql.y" -{ yymsp[-1].minor.yy101.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } -#line 6314 "sql.c" +{ yymsp[-1].minor.yy573.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy573.val = yymsp[0].minor.yy0; } break; case 145: /* alter_db_option ::= CACHESIZE NK_INTEGER */ -#line 291 "sql.y" -{ yymsp[-1].minor.yy101.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } -#line 6319 "sql.c" +{ yymsp[-1].minor.yy573.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy573.val = yymsp[0].minor.yy0; } break; case 146: /* alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ -#line 292 "sql.y" -{ yymsp[-1].minor.yy101.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } -#line 6324 "sql.c" +{ yymsp[-1].minor.yy573.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy573.val = yymsp[0].minor.yy0; } break; case 147: /* alter_db_option ::= KEEP integer_list */ case 148: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==148); -#line 293 "sql.y" -{ yymsp[-1].minor.yy101.type = DB_OPTION_KEEP; yymsp[-1].minor.yy101.pList = yymsp[0].minor.yy316; } -#line 6330 "sql.c" +{ yymsp[-1].minor.yy573.type = DB_OPTION_KEEP; yymsp[-1].minor.yy573.pList = yymsp[0].minor.yy456; } break; case 149: /* alter_db_option ::= PAGES NK_INTEGER */ -#line 295 "sql.y" -{ yymsp[-1].minor.yy101.type = DB_OPTION_PAGES; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } -#line 6335 "sql.c" +{ yymsp[-1].minor.yy573.type = DB_OPTION_PAGES; yymsp[-1].minor.yy573.val = yymsp[0].minor.yy0; } break; case 150: /* alter_db_option ::= REPLICA NK_INTEGER */ -#line 296 "sql.y" -{ yymsp[-1].minor.yy101.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } -#line 6340 "sql.c" +{ yymsp[-1].minor.yy573.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy573.val = yymsp[0].minor.yy0; } break; case 151: /* alter_db_option ::= WAL_LEVEL NK_INTEGER */ -#line 298 "sql.y" -{ yymsp[-1].minor.yy101.type = DB_OPTION_WAL; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } -#line 6345 "sql.c" +{ yymsp[-1].minor.yy573.type = DB_OPTION_WAL; yymsp[-1].minor.yy573.val = yymsp[0].minor.yy0; } break; case 152: /* alter_db_option ::= STT_TRIGGER NK_INTEGER */ -#line 299 "sql.y" -{ yymsp[-1].minor.yy101.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } -#line 6350 "sql.c" +{ yymsp[-1].minor.yy573.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy573.val = yymsp[0].minor.yy0; } break; case 153: /* alter_db_option ::= MINROWS NK_INTEGER */ -#line 300 "sql.y" -{ yymsp[-1].minor.yy101.type = DB_OPTION_MINROWS; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } -#line 6355 "sql.c" +{ yymsp[-1].minor.yy573.type = DB_OPTION_MINROWS; yymsp[-1].minor.yy573.val = yymsp[0].minor.yy0; } break; case 154: /* alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */ -#line 301 "sql.y" -{ yymsp[-1].minor.yy101.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } -#line 6360 "sql.c" +{ yymsp[-1].minor.yy573.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-1].minor.yy573.val = yymsp[0].minor.yy0; } break; case 155: /* alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ -#line 302 "sql.y" { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yymsp[-2].minor.yy101.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-2].minor.yy101.val = t; + yymsp[-2].minor.yy573.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-2].minor.yy573.val = t; } -#line 6369 "sql.c" break; case 156: /* alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */ -#line 307 "sql.y" -{ yymsp[-1].minor.yy101.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } -#line 6374 "sql.c" +{ yymsp[-1].minor.yy573.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-1].minor.yy573.val = yymsp[0].minor.yy0; } break; case 157: /* alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ -#line 308 "sql.y" { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yymsp[-2].minor.yy101.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-2].minor.yy101.val = t; + yymsp[-2].minor.yy573.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-2].minor.yy573.val = t; } -#line 6383 "sql.c" break; case 158: /* alter_db_option ::= S3_KEEPLOCAL NK_INTEGER */ case 159: /* alter_db_option ::= S3_KEEPLOCAL NK_VARIABLE */ yytestcase(yyruleno==159); -#line 313 "sql.y" -{ yymsp[-1].minor.yy101.type = DB_OPTION_S3_KEEPLOCAL; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } -#line 6389 "sql.c" +{ yymsp[-1].minor.yy573.type = DB_OPTION_S3_KEEPLOCAL; yymsp[-1].minor.yy573.val = yymsp[0].minor.yy0; } break; case 160: /* alter_db_option ::= S3_COMPACT NK_INTEGER */ -#line 315 "sql.y" -{ yymsp[-1].minor.yy101.type = DB_OPTION_S3_COMPACT, yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } -#line 6394 "sql.c" +{ yymsp[-1].minor.yy573.type = DB_OPTION_S3_COMPACT, yymsp[-1].minor.yy573.val = yymsp[0].minor.yy0; } break; case 161: /* alter_db_option ::= KEEP_TIME_OFFSET NK_INTEGER */ -#line 316 "sql.y" -{ yymsp[-1].minor.yy101.type = DB_OPTION_KEEP_TIME_OFFSET; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } -#line 6399 "sql.c" +{ yymsp[-1].minor.yy573.type = DB_OPTION_KEEP_TIME_OFFSET; yymsp[-1].minor.yy573.val = yymsp[0].minor.yy0; } break; case 162: /* alter_db_option ::= ENCRYPT_ALGORITHM NK_STRING */ -#line 317 "sql.y" -{ yymsp[-1].minor.yy101.type = DB_OPTION_ENCRYPT_ALGORITHM; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } -#line 6404 "sql.c" +{ yymsp[-1].minor.yy573.type = DB_OPTION_ENCRYPT_ALGORITHM; yymsp[-1].minor.yy573.val = yymsp[0].minor.yy0; } break; case 163: /* integer_list ::= NK_INTEGER */ -#line 321 "sql.y" -{ yylhsminor.yy316 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } -#line 6409 "sql.c" - yymsp[0].minor.yy316 = yylhsminor.yy316; +{ yylhsminor.yy456 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy456 = yylhsminor.yy456; break; case 164: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */ - case 444: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==444); -#line 322 "sql.y" -{ yylhsminor.yy316 = addNodeToList(pCxt, yymsp[-2].minor.yy316, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } -#line 6416 "sql.c" - yymsp[-2].minor.yy316 = yylhsminor.yy316; + case 445: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==445); +{ yylhsminor.yy456 = addNodeToList(pCxt, yymsp[-2].minor.yy456, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy456 = yylhsminor.yy456; break; case 165: /* variable_list ::= NK_VARIABLE */ -#line 326 "sql.y" -{ yylhsminor.yy316 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } -#line 6422 "sql.c" - yymsp[0].minor.yy316 = yylhsminor.yy316; +{ yylhsminor.yy456 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy456 = yylhsminor.yy456; break; case 166: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */ -#line 327 "sql.y" -{ yylhsminor.yy316 = addNodeToList(pCxt, yymsp[-2].minor.yy316, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } -#line 6428 "sql.c" - yymsp[-2].minor.yy316 = yylhsminor.yy316; +{ yylhsminor.yy456 = addNodeToList(pCxt, yymsp[-2].minor.yy456, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy456 = yylhsminor.yy456; break; case 167: /* retention_list ::= retention */ case 200: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==200); @@ -6473,17 +6457,15 @@ static YYACTIONTYPE yy_reduce( case 336: /* tag_list_opt ::= tag_item */ yytestcase(yyruleno==336); case 360: /* func_list ::= func */ yytestcase(yyruleno==360); case 410: /* column_stream_def_list ::= column_stream_def */ yytestcase(yyruleno==410); - case 488: /* tags_literal_list ::= tags_literal */ yytestcase(yyruleno==488); - case 513: /* literal_list ::= signed_literal */ yytestcase(yyruleno==513); - case 587: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==587); - case 593: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==593); - case 669: /* select_list ::= select_item */ yytestcase(yyruleno==669); - case 680: /* partition_list ::= partition_item */ yytestcase(yyruleno==680); - case 741: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==741); -#line 331 "sql.y" -{ yylhsminor.yy316 = createNodeList(pCxt, yymsp[0].minor.yy416); } -#line 6450 "sql.c" - yymsp[0].minor.yy316 = yylhsminor.yy316; + case 489: /* tags_literal_list ::= tags_literal */ yytestcase(yyruleno==489); + case 514: /* literal_list ::= signed_literal */ yytestcase(yyruleno==514); + case 603: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==603); + case 609: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==609); + case 685: /* select_list ::= select_item */ yytestcase(yyruleno==685); + case 696: /* partition_list ::= partition_item */ yytestcase(yyruleno==696); + case 757: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==757); +{ yylhsminor.yy456 = createNodeList(pCxt, yymsp[0].minor.yy840); } + yymsp[0].minor.yy456 = yylhsminor.yy456; break; case 168: /* retention_list ::= retention_list NK_COMMA retention */ case 204: /* multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ yytestcase(yyruleno==204); @@ -6494,2214 +6476,1530 @@ static YYACTIONTYPE yy_reduce( case 337: /* tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ yytestcase(yyruleno==337); case 361: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==361); case 411: /* column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def */ yytestcase(yyruleno==411); - case 489: /* tags_literal_list ::= tags_literal_list NK_COMMA tags_literal */ yytestcase(yyruleno==489); - case 514: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==514); - case 588: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==588); - case 670: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==670); - case 681: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==681); - case 742: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==742); -#line 332 "sql.y" -{ yylhsminor.yy316 = addNodeToList(pCxt, yymsp[-2].minor.yy316, yymsp[0].minor.yy416); } -#line 6470 "sql.c" - yymsp[-2].minor.yy316 = yylhsminor.yy316; + case 490: /* tags_literal_list ::= tags_literal_list NK_COMMA tags_literal */ yytestcase(yyruleno==490); + case 515: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==515); + case 604: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==604); + case 686: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==686); + case 697: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==697); + case 758: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==758); +{ yylhsminor.yy456 = addNodeToList(pCxt, yymsp[-2].minor.yy456, yymsp[0].minor.yy840); } + yymsp[-2].minor.yy456 = yylhsminor.yy456; break; case 169: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ case 170: /* retention ::= NK_MINUS NK_COLON NK_VARIABLE */ yytestcase(yyruleno==170); -#line 334 "sql.y" -{ yylhsminor.yy416 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } -#line 6477 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 171: /* speed_opt ::= */ case 394: /* bufsize_opt ::= */ yytestcase(yyruleno==394); -#line 339 "sql.y" -{ yymsp[1].minor.yy820 = 0; } -#line 6484 "sql.c" +{ yymsp[1].minor.yy516 = 0; } break; case 172: /* speed_opt ::= BWLIMIT NK_INTEGER */ case 395: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==395); -#line 340 "sql.y" -{ yymsp[-1].minor.yy820 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } -#line 6490 "sql.c" +{ yymsp[-1].minor.yy516 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } break; case 174: /* start_opt ::= START WITH NK_INTEGER */ case 178: /* end_opt ::= END WITH NK_INTEGER */ yytestcase(yyruleno==178); -#line 343 "sql.y" -{ yymsp[-2].minor.yy416 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } -#line 6496 "sql.c" +{ yymsp[-2].minor.yy840 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } break; case 175: /* start_opt ::= START WITH NK_STRING */ case 179: /* end_opt ::= END WITH NK_STRING */ yytestcase(yyruleno==179); -#line 344 "sql.y" -{ yymsp[-2].minor.yy416 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } -#line 6502 "sql.c" +{ yymsp[-2].minor.yy840 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } break; case 176: /* start_opt ::= START WITH TIMESTAMP NK_STRING */ case 180: /* end_opt ::= END WITH TIMESTAMP NK_STRING */ yytestcase(yyruleno==180); -#line 345 "sql.y" -{ yymsp[-3].minor.yy416 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } -#line 6508 "sql.c" +{ yymsp[-3].minor.yy840 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } break; case 181: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ case 184: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==184); -#line 354 "sql.y" -{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy209, yymsp[-5].minor.yy416, yymsp[-3].minor.yy316, yymsp[-1].minor.yy316, yymsp[0].minor.yy416); } -#line 6514 "sql.c" +{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy9, yymsp[-5].minor.yy840, yymsp[-3].minor.yy456, yymsp[-1].minor.yy456, yymsp[0].minor.yy840); } break; case 182: /* cmd ::= CREATE TABLE multi_create_clause */ -#line 355 "sql.y" -{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy316); } -#line 6519 "sql.c" +{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy456); } break; case 183: /* cmd ::= CREATE TABLE not_exists_opt USING full_table_name NK_LP tag_list_opt NK_RP FILE NK_STRING */ -#line 357 "sql.y" -{ pCxt->pRootNode = createCreateSubTableFromFileClause(pCxt, yymsp[-7].minor.yy209, yymsp[-5].minor.yy416, yymsp[-3].minor.yy316, &yymsp[0].minor.yy0); } -#line 6524 "sql.c" +{ pCxt->pRootNode = createCreateSubTableFromFileClause(pCxt, yymsp[-7].minor.yy9, yymsp[-5].minor.yy840, yymsp[-3].minor.yy456, &yymsp[0].minor.yy0); } break; case 185: /* cmd ::= DROP TABLE multi_drop_clause */ -#line 360 "sql.y" -{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy316); } -#line 6529 "sql.c" +{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy456); } break; case 186: /* cmd ::= DROP STABLE exists_opt full_table_name */ -#line 361 "sql.y" -{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy209, yymsp[0].minor.yy416); } -#line 6534 "sql.c" +{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy9, yymsp[0].minor.yy840); } break; case 187: /* cmd ::= ALTER TABLE alter_table_clause */ - case 446: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==446); - case 447: /* cmd ::= insert_query */ yytestcase(yyruleno==447); -#line 363 "sql.y" -{ pCxt->pRootNode = yymsp[0].minor.yy416; } -#line 6541 "sql.c" + case 447: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==447); + case 448: /* cmd ::= insert_query */ yytestcase(yyruleno==448); +{ pCxt->pRootNode = yymsp[0].minor.yy840; } break; case 188: /* cmd ::= ALTER STABLE alter_table_clause */ -#line 364 "sql.y" -{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy416); } -#line 6546 "sql.c" +{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy840); } break; case 189: /* alter_table_clause ::= full_table_name alter_table_options */ -#line 366 "sql.y" -{ yylhsminor.yy416 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy416, yymsp[0].minor.yy416); } -#line 6551 "sql.c" - yymsp[-1].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy840, yymsp[0].minor.yy840); } + yymsp[-1].minor.yy840 = yylhsminor.yy840; break; case 190: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name column_options */ -#line 368 "sql.y" -{ yylhsminor.yy416 = createAlterTableAddModifyColOptions2(pCxt, yymsp[-5].minor.yy416, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-2].minor.yy1109, yymsp[-1].minor.yy952, yymsp[0].minor.yy416); } -#line 6557 "sql.c" - yymsp[-5].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = createAlterTableAddModifyColOptions2(pCxt, yymsp[-5].minor.yy840, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-2].minor.yy209, yymsp[-1].minor.yy48, yymsp[0].minor.yy840); } + yymsp[-5].minor.yy840 = yylhsminor.yy840; break; case 191: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ -#line 369 "sql.y" -{ yylhsminor.yy416 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy416, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy1109); } -#line 6563 "sql.c" - yymsp[-3].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy840, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy209); } + yymsp[-3].minor.yy840 = yylhsminor.yy840; break; case 192: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ -#line 371 "sql.y" -{ yylhsminor.yy416 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy416, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy1109, yymsp[0].minor.yy952); } -#line 6569 "sql.c" - yymsp[-4].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy840, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy209, yymsp[0].minor.yy48); } + yymsp[-4].minor.yy840 = yylhsminor.yy840; break; case 193: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name column_options */ -#line 373 "sql.y" -{ yylhsminor.yy416 = createAlterTableAddModifyColOptions(pCxt, yymsp[-4].minor.yy416, TSDB_ALTER_TABLE_UPDATE_COLUMN_COMPRESS, &yymsp[-1].minor.yy1109, yymsp[0].minor.yy416); } -#line 6575 "sql.c" - yymsp[-4].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = createAlterTableAddModifyColOptions(pCxt, yymsp[-4].minor.yy840, TSDB_ALTER_TABLE_UPDATE_COLUMN_COMPRESS, &yymsp[-1].minor.yy209, yymsp[0].minor.yy840); } + yymsp[-4].minor.yy840 = yylhsminor.yy840; break; case 194: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ -#line 375 "sql.y" -{ yylhsminor.yy416 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy416, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy1109, &yymsp[0].minor.yy1109); } -#line 6581 "sql.c" - yymsp[-4].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy840, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy209, &yymsp[0].minor.yy209); } + yymsp[-4].minor.yy840 = yylhsminor.yy840; break; case 195: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ -#line 377 "sql.y" -{ yylhsminor.yy416 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy416, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy1109, yymsp[0].minor.yy952); } -#line 6587 "sql.c" - yymsp[-4].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy840, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy209, yymsp[0].minor.yy48); } + yymsp[-4].minor.yy840 = yylhsminor.yy840; break; case 196: /* alter_table_clause ::= full_table_name DROP TAG column_name */ -#line 378 "sql.y" -{ yylhsminor.yy416 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy416, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy1109); } -#line 6593 "sql.c" - yymsp[-3].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy840, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy209); } + yymsp[-3].minor.yy840 = yylhsminor.yy840; break; case 197: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ -#line 380 "sql.y" -{ yylhsminor.yy416 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy416, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy1109, yymsp[0].minor.yy952); } -#line 6599 "sql.c" - yymsp[-4].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy840, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy209, yymsp[0].minor.yy48); } + yymsp[-4].minor.yy840 = yylhsminor.yy840; break; case 198: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ -#line 382 "sql.y" -{ yylhsminor.yy416 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy416, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy1109, &yymsp[0].minor.yy1109); } -#line 6605 "sql.c" - yymsp[-4].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy840, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy209, &yymsp[0].minor.yy209); } + yymsp[-4].minor.yy840 = yylhsminor.yy840; break; case 199: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ tags_literal */ -#line 384 "sql.y" -{ yylhsminor.yy416 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy416, &yymsp[-2].minor.yy1109, yymsp[0].minor.yy416); } -#line 6611 "sql.c" - yymsp[-5].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy840, &yymsp[-2].minor.yy209, yymsp[0].minor.yy840); } + yymsp[-5].minor.yy840 = yylhsminor.yy840; break; case 201: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ - case 594: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==594); -#line 389 "sql.y" -{ yylhsminor.yy316 = addNodeToList(pCxt, yymsp[-1].minor.yy316, yymsp[0].minor.yy416); } -#line 6618 "sql.c" - yymsp[-1].minor.yy316 = yylhsminor.yy316; + case 610: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==610); +{ yylhsminor.yy456 = addNodeToList(pCxt, yymsp[-1].minor.yy456, yymsp[0].minor.yy840); } + yymsp[-1].minor.yy456 = yylhsminor.yy456; break; case 202: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP tags_literal_list NK_RP table_options */ -#line 393 "sql.y" -{ yylhsminor.yy416 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy209, yymsp[-8].minor.yy416, yymsp[-6].minor.yy416, yymsp[-5].minor.yy316, yymsp[-2].minor.yy316, yymsp[0].minor.yy416); } -#line 6624 "sql.c" - yymsp[-9].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy9, yymsp[-8].minor.yy840, yymsp[-6].minor.yy840, yymsp[-5].minor.yy456, yymsp[-2].minor.yy456, yymsp[0].minor.yy840); } + yymsp[-9].minor.yy840 = yylhsminor.yy840; break; case 205: /* drop_table_clause ::= exists_opt full_table_name */ -#line 400 "sql.y" -{ yylhsminor.yy416 = createDropTableClause(pCxt, yymsp[-1].minor.yy209, yymsp[0].minor.yy416); } -#line 6630 "sql.c" - yymsp[-1].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = createDropTableClause(pCxt, yymsp[-1].minor.yy9, yymsp[0].minor.yy840); } + yymsp[-1].minor.yy840 = yylhsminor.yy840; break; case 207: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */ case 409: /* col_list_opt ::= NK_LP column_stream_def_list NK_RP */ yytestcase(yyruleno==409); -#line 405 "sql.y" -{ yymsp[-2].minor.yy316 = yymsp[-1].minor.yy316; } -#line 6637 "sql.c" +{ yymsp[-2].minor.yy456 = yymsp[-1].minor.yy456; } break; case 208: /* full_table_name ::= table_name */ case 350: /* full_tsma_name ::= tsma_name */ yytestcase(yyruleno==350); -#line 407 "sql.y" -{ yylhsminor.yy416 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy1109, NULL); } -#line 6643 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy209, NULL); } + yymsp[0].minor.yy840 = yylhsminor.yy840; break; case 209: /* full_table_name ::= db_name NK_DOT table_name */ case 351: /* full_tsma_name ::= db_name NK_DOT tsma_name */ yytestcase(yyruleno==351); -#line 408 "sql.y" -{ yylhsminor.yy416 = createRealTableNode(pCxt, &yymsp[-2].minor.yy1109, &yymsp[0].minor.yy1109, NULL); } -#line 6650 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = createRealTableNode(pCxt, &yymsp[-2].minor.yy209, &yymsp[0].minor.yy209, NULL); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 212: /* tag_def ::= column_name type_name */ -#line 414 "sql.y" -{ yylhsminor.yy416 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy1109, yymsp[0].minor.yy952, NULL); } -#line 6656 "sql.c" - yymsp[-1].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy209, yymsp[0].minor.yy48, NULL); } + yymsp[-1].minor.yy840 = yylhsminor.yy840; break; case 215: /* column_def ::= column_name type_name column_options */ -#line 422 "sql.y" -{ yylhsminor.yy416 = createColumnDefNode(pCxt, &yymsp[-2].minor.yy1109, yymsp[-1].minor.yy952, yymsp[0].minor.yy416); } -#line 6662 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = createColumnDefNode(pCxt, &yymsp[-2].minor.yy209, yymsp[-1].minor.yy48, yymsp[0].minor.yy840); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 216: /* type_name ::= BOOL */ -#line 426 "sql.y" -{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_BOOL); } -#line 6668 "sql.c" +{ yymsp[0].minor.yy48 = createDataType(TSDB_DATA_TYPE_BOOL); } break; case 217: /* type_name ::= TINYINT */ -#line 427 "sql.y" -{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_TINYINT); } -#line 6673 "sql.c" +{ yymsp[0].minor.yy48 = createDataType(TSDB_DATA_TYPE_TINYINT); } break; case 218: /* type_name ::= SMALLINT */ -#line 428 "sql.y" -{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_SMALLINT); } -#line 6678 "sql.c" +{ yymsp[0].minor.yy48 = createDataType(TSDB_DATA_TYPE_SMALLINT); } break; case 219: /* type_name ::= INT */ case 220: /* type_name ::= INTEGER */ yytestcase(yyruleno==220); -#line 429 "sql.y" -{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_INT); } -#line 6684 "sql.c" +{ yymsp[0].minor.yy48 = createDataType(TSDB_DATA_TYPE_INT); } break; case 221: /* type_name ::= BIGINT */ -#line 431 "sql.y" -{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_BIGINT); } -#line 6689 "sql.c" +{ yymsp[0].minor.yy48 = createDataType(TSDB_DATA_TYPE_BIGINT); } break; case 222: /* type_name ::= FLOAT */ -#line 432 "sql.y" -{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_FLOAT); } -#line 6694 "sql.c" +{ yymsp[0].minor.yy48 = createDataType(TSDB_DATA_TYPE_FLOAT); } break; case 223: /* type_name ::= DOUBLE */ -#line 433 "sql.y" -{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_DOUBLE); } -#line 6699 "sql.c" +{ yymsp[0].minor.yy48 = createDataType(TSDB_DATA_TYPE_DOUBLE); } break; case 224: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ -#line 434 "sql.y" -{ yymsp[-3].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } -#line 6704 "sql.c" +{ yymsp[-3].minor.yy48 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } break; case 225: /* type_name ::= TIMESTAMP */ -#line 435 "sql.y" -{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } -#line 6709 "sql.c" +{ yymsp[0].minor.yy48 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } break; case 226: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ -#line 436 "sql.y" -{ yymsp[-3].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } -#line 6714 "sql.c" +{ yymsp[-3].minor.yy48 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } break; case 227: /* type_name ::= TINYINT UNSIGNED */ -#line 437 "sql.y" -{ yymsp[-1].minor.yy952 = createDataType(TSDB_DATA_TYPE_UTINYINT); } -#line 6719 "sql.c" +{ yymsp[-1].minor.yy48 = createDataType(TSDB_DATA_TYPE_UTINYINT); } break; case 228: /* type_name ::= SMALLINT UNSIGNED */ -#line 438 "sql.y" -{ yymsp[-1].minor.yy952 = createDataType(TSDB_DATA_TYPE_USMALLINT); } -#line 6724 "sql.c" +{ yymsp[-1].minor.yy48 = createDataType(TSDB_DATA_TYPE_USMALLINT); } break; case 229: /* type_name ::= INT UNSIGNED */ -#line 439 "sql.y" -{ yymsp[-1].minor.yy952 = createDataType(TSDB_DATA_TYPE_UINT); } -#line 6729 "sql.c" +{ yymsp[-1].minor.yy48 = createDataType(TSDB_DATA_TYPE_UINT); } break; case 230: /* type_name ::= BIGINT UNSIGNED */ -#line 440 "sql.y" -{ yymsp[-1].minor.yy952 = createDataType(TSDB_DATA_TYPE_UBIGINT); } -#line 6734 "sql.c" +{ yymsp[-1].minor.yy48 = createDataType(TSDB_DATA_TYPE_UBIGINT); } break; case 231: /* type_name ::= JSON */ -#line 441 "sql.y" -{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_JSON); } -#line 6739 "sql.c" +{ yymsp[0].minor.yy48 = createDataType(TSDB_DATA_TYPE_JSON); } break; case 232: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ -#line 442 "sql.y" -{ yymsp[-3].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } -#line 6744 "sql.c" +{ yymsp[-3].minor.yy48 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } break; case 233: /* type_name ::= MEDIUMBLOB */ -#line 443 "sql.y" -{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } -#line 6749 "sql.c" +{ yymsp[0].minor.yy48 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } break; case 234: /* type_name ::= BLOB */ -#line 444 "sql.y" -{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_BLOB); } -#line 6754 "sql.c" +{ yymsp[0].minor.yy48 = createDataType(TSDB_DATA_TYPE_BLOB); } break; case 235: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ -#line 445 "sql.y" -{ yymsp[-3].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } -#line 6759 "sql.c" +{ yymsp[-3].minor.yy48 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } break; case 236: /* type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ -#line 446 "sql.y" -{ yymsp[-3].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_GEOMETRY, &yymsp[-1].minor.yy0); } -#line 6764 "sql.c" +{ yymsp[-3].minor.yy48 = createVarLenDataType(TSDB_DATA_TYPE_GEOMETRY, &yymsp[-1].minor.yy0); } break; case 237: /* type_name ::= DECIMAL */ -#line 447 "sql.y" -{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_DECIMAL); } -#line 6769 "sql.c" +{ yymsp[0].minor.yy48 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 238: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ -#line 448 "sql.y" -{ yymsp[-3].minor.yy952 = createDataType(TSDB_DATA_TYPE_DECIMAL); } -#line 6774 "sql.c" +{ yymsp[-3].minor.yy48 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 239: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ -#line 449 "sql.y" -{ yymsp[-5].minor.yy952 = createDataType(TSDB_DATA_TYPE_DECIMAL); } -#line 6779 "sql.c" +{ yymsp[-5].minor.yy48 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 240: /* type_name_default_len ::= BINARY */ -#line 453 "sql.y" -{ yymsp[0].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, NULL); } -#line 6784 "sql.c" +{ yymsp[0].minor.yy48 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, NULL); } break; case 241: /* type_name_default_len ::= NCHAR */ -#line 454 "sql.y" -{ yymsp[0].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, NULL); } -#line 6789 "sql.c" +{ yymsp[0].minor.yy48 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, NULL); } break; case 242: /* type_name_default_len ::= VARCHAR */ -#line 455 "sql.y" -{ yymsp[0].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, NULL); } -#line 6794 "sql.c" +{ yymsp[0].minor.yy48 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, NULL); } break; case 243: /* type_name_default_len ::= VARBINARY */ -#line 456 "sql.y" -{ yymsp[0].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, NULL); } -#line 6799 "sql.c" +{ yymsp[0].minor.yy48 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, NULL); } break; case 246: /* tags_def ::= TAGS NK_LP tag_def_list NK_RP */ case 417: /* tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP */ yytestcase(yyruleno==417); -#line 465 "sql.y" -{ yymsp[-3].minor.yy316 = yymsp[-1].minor.yy316; } -#line 6805 "sql.c" +{ yymsp[-3].minor.yy456 = yymsp[-1].minor.yy456; } break; case 247: /* table_options ::= */ -#line 467 "sql.y" -{ yymsp[1].minor.yy416 = createDefaultTableOptions(pCxt); } -#line 6810 "sql.c" +{ yymsp[1].minor.yy840 = createDefaultTableOptions(pCxt); } break; case 248: /* table_options ::= table_options COMMENT NK_STRING */ -#line 468 "sql.y" -{ yylhsminor.yy416 = setTableOption(pCxt, yymsp[-2].minor.yy416, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } -#line 6815 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = setTableOption(pCxt, yymsp[-2].minor.yy840, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 249: /* table_options ::= table_options MAX_DELAY duration_list */ -#line 469 "sql.y" -{ yylhsminor.yy416 = setTableOption(pCxt, yymsp[-2].minor.yy416, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy316); } -#line 6821 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = setTableOption(pCxt, yymsp[-2].minor.yy840, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy456); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 250: /* table_options ::= table_options WATERMARK duration_list */ -#line 470 "sql.y" -{ yylhsminor.yy416 = setTableOption(pCxt, yymsp[-2].minor.yy416, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy316); } -#line 6827 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = setTableOption(pCxt, yymsp[-2].minor.yy840, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy456); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 251: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ -#line 471 "sql.y" -{ yylhsminor.yy416 = setTableOption(pCxt, yymsp[-4].minor.yy416, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy316); } -#line 6833 "sql.c" - yymsp[-4].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = setTableOption(pCxt, yymsp[-4].minor.yy840, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy456); } + yymsp[-4].minor.yy840 = yylhsminor.yy840; break; case 252: /* table_options ::= table_options TTL NK_INTEGER */ -#line 472 "sql.y" -{ yylhsminor.yy416 = setTableOption(pCxt, yymsp[-2].minor.yy416, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } -#line 6839 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = setTableOption(pCxt, yymsp[-2].minor.yy840, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 253: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ -#line 473 "sql.y" -{ yylhsminor.yy416 = setTableOption(pCxt, yymsp[-4].minor.yy416, TABLE_OPTION_SMA, yymsp[-1].minor.yy316); } -#line 6845 "sql.c" - yymsp[-4].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = setTableOption(pCxt, yymsp[-4].minor.yy840, TABLE_OPTION_SMA, yymsp[-1].minor.yy456); } + yymsp[-4].minor.yy840 = yylhsminor.yy840; break; case 254: /* table_options ::= table_options DELETE_MARK duration_list */ -#line 474 "sql.y" -{ yylhsminor.yy416 = setTableOption(pCxt, yymsp[-2].minor.yy416, TABLE_OPTION_DELETE_MARK, yymsp[0].minor.yy316); } -#line 6851 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = setTableOption(pCxt, yymsp[-2].minor.yy840, TABLE_OPTION_DELETE_MARK, yymsp[0].minor.yy456); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 255: /* alter_table_options ::= alter_table_option */ -#line 476 "sql.y" -{ yylhsminor.yy416 = createAlterTableOptions(pCxt); yylhsminor.yy416 = setTableOption(pCxt, yylhsminor.yy416, yymsp[0].minor.yy101.type, &yymsp[0].minor.yy101.val); } -#line 6857 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = createAlterTableOptions(pCxt); yylhsminor.yy840 = setTableOption(pCxt, yylhsminor.yy840, yymsp[0].minor.yy573.type, &yymsp[0].minor.yy573.val); } + yymsp[0].minor.yy840 = yylhsminor.yy840; break; case 256: /* alter_table_options ::= alter_table_options alter_table_option */ -#line 477 "sql.y" -{ yylhsminor.yy416 = setTableOption(pCxt, yymsp[-1].minor.yy416, yymsp[0].minor.yy101.type, &yymsp[0].minor.yy101.val); } -#line 6863 "sql.c" - yymsp[-1].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = setTableOption(pCxt, yymsp[-1].minor.yy840, yymsp[0].minor.yy573.type, &yymsp[0].minor.yy573.val); } + yymsp[-1].minor.yy840 = yylhsminor.yy840; break; case 257: /* alter_table_option ::= COMMENT NK_STRING */ -#line 481 "sql.y" -{ yymsp[-1].minor.yy101.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } -#line 6869 "sql.c" +{ yymsp[-1].minor.yy573.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy573.val = yymsp[0].minor.yy0; } break; case 258: /* alter_table_option ::= TTL NK_INTEGER */ -#line 482 "sql.y" -{ yymsp[-1].minor.yy101.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } -#line 6874 "sql.c" +{ yymsp[-1].minor.yy573.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy573.val = yymsp[0].minor.yy0; } break; case 259: /* duration_list ::= duration_literal */ - case 546: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==546); -#line 486 "sql.y" -{ yylhsminor.yy316 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy416)); } -#line 6880 "sql.c" - yymsp[0].minor.yy316 = yylhsminor.yy316; + case 547: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==547); +{ yylhsminor.yy456 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy840)); } + yymsp[0].minor.yy456 = yylhsminor.yy456; break; case 260: /* duration_list ::= duration_list NK_COMMA duration_literal */ - case 547: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==547); -#line 487 "sql.y" -{ yylhsminor.yy316 = addNodeToList(pCxt, yymsp[-2].minor.yy316, releaseRawExprNode(pCxt, yymsp[0].minor.yy416)); } -#line 6887 "sql.c" - yymsp[-2].minor.yy316 = yylhsminor.yy316; + case 548: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==548); +{ yylhsminor.yy456 = addNodeToList(pCxt, yymsp[-2].minor.yy456, releaseRawExprNode(pCxt, yymsp[0].minor.yy840)); } + yymsp[-2].minor.yy456 = yylhsminor.yy456; break; case 263: /* rollup_func_name ::= function_name */ -#line 494 "sql.y" -{ yylhsminor.yy416 = createFunctionNode(pCxt, &yymsp[0].minor.yy1109, NULL); } -#line 6893 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = createFunctionNode(pCxt, &yymsp[0].minor.yy209, NULL); } + yymsp[0].minor.yy840 = yylhsminor.yy840; break; case 264: /* rollup_func_name ::= FIRST */ case 265: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==265); case 339: /* tag_item ::= QTAGS */ yytestcase(yyruleno==339); -#line 495 "sql.y" -{ yylhsminor.yy416 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } -#line 6901 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } + yymsp[0].minor.yy840 = yylhsminor.yy840; break; case 268: /* col_name ::= column_name */ case 340: /* tag_item ::= column_name */ yytestcase(yyruleno==340); -#line 503 "sql.y" -{ yylhsminor.yy416 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy1109); } -#line 6908 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy209); } + yymsp[0].minor.yy840 = yylhsminor.yy840; break; case 269: /* cmd ::= SHOW DNODES */ -#line 506 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT); } -#line 6914 "sql.c" break; case 270: /* cmd ::= SHOW USERS */ -#line 507 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USERS_STMT); } -#line 6919 "sql.c" break; case 271: /* cmd ::= SHOW USERS FULL */ -#line 508 "sql.y" { pCxt->pRootNode = createShowStmtWithFull(pCxt, QUERY_NODE_SHOW_USERS_FULL_STMT); } -#line 6924 "sql.c" break; case 272: /* cmd ::= SHOW USER PRIVILEGES */ -#line 509 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USER_PRIVILEGES_STMT); } -#line 6929 "sql.c" break; case 273: /* cmd ::= SHOW db_kind_opt DATABASES */ -#line 510 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT); - setShowKind(pCxt, pCxt->pRootNode, yymsp[-1].minor.yy681); + (void)setShowKind(pCxt, pCxt->pRootNode, yymsp[-1].minor.yy881); } -#line 6937 "sql.c" break; case 274: /* cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */ -#line 514 "sql.y" { - pCxt->pRootNode = createShowTablesStmt(pCxt, yymsp[-2].minor.yy925, yymsp[0].minor.yy416, OP_TYPE_LIKE); + pCxt->pRootNode = createShowTablesStmt(pCxt, yymsp[-2].minor.yy13, yymsp[0].minor.yy840, OP_TYPE_LIKE); } -#line 6944 "sql.c" break; case 275: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ -#line 517 "sql.y" -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy416, yymsp[0].minor.yy416, OP_TYPE_LIKE); } -#line 6949 "sql.c" +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy840, yymsp[0].minor.yy840, OP_TYPE_LIKE); } break; case 276: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ -#line 518 "sql.y" -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy416, NULL, OP_TYPE_LIKE); } -#line 6954 "sql.c" +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy840, NULL, OP_TYPE_LIKE); } break; case 277: /* cmd ::= SHOW MNODES */ -#line 519 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT); } -#line 6959 "sql.c" break; case 278: /* cmd ::= SHOW QNODES */ -#line 521 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QNODES_STMT); } -#line 6964 "sql.c" break; case 279: /* cmd ::= SHOW ARBGROUPS */ -#line 522 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_ARBGROUPS_STMT); } -#line 6969 "sql.c" break; case 280: /* cmd ::= SHOW FUNCTIONS */ -#line 523 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT); } -#line 6974 "sql.c" break; case 281: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ -#line 524 "sql.y" -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy416, yymsp[-1].minor.yy416, OP_TYPE_EQUAL); } -#line 6979 "sql.c" +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy840, yymsp[-1].minor.yy840, OP_TYPE_EQUAL); } break; case 282: /* cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ -#line 525 "sql.y" -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy1109), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy1109), OP_TYPE_EQUAL); } -#line 6984 "sql.c" +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy209), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy209), OP_TYPE_EQUAL); } break; case 283: /* cmd ::= SHOW STREAMS */ -#line 526 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT); } -#line 6989 "sql.c" break; case 284: /* cmd ::= SHOW ACCOUNTS */ -#line 527 "sql.y" { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } -#line 6994 "sql.c" break; case 285: /* cmd ::= SHOW APPS */ -#line 528 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_APPS_STMT); } -#line 6999 "sql.c" break; case 286: /* cmd ::= SHOW CONNECTIONS */ -#line 529 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONNECTIONS_STMT); } -#line 7004 "sql.c" break; case 287: /* cmd ::= SHOW LICENCES */ case 288: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==288); -#line 530 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LICENCES_STMT); } -#line 7010 "sql.c" break; case 289: /* cmd ::= SHOW GRANTS FULL */ -#line 532 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_GRANTS_FULL_STMT); } -#line 7015 "sql.c" break; case 290: /* cmd ::= SHOW GRANTS LOGS */ -#line 533 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_GRANTS_LOGS_STMT); } -#line 7020 "sql.c" break; case 291: /* cmd ::= SHOW CLUSTER MACHINES */ -#line 534 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_MACHINES_STMT); } -#line 7025 "sql.c" break; case 292: /* cmd ::= SHOW CREATE DATABASE db_name */ -#line 535 "sql.y" -{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy1109); } -#line 7030 "sql.c" +{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy209); } break; case 293: /* cmd ::= SHOW CREATE TABLE full_table_name */ -#line 536 "sql.y" -{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy416); } -#line 7035 "sql.c" +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy840); } break; case 294: /* cmd ::= SHOW CREATE STABLE full_table_name */ -#line 537 "sql.y" { pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, -yymsp[0].minor.yy416); } -#line 7041 "sql.c" +yymsp[0].minor.yy840); } break; case 295: /* cmd ::= SHOW ENCRYPTIONS */ -#line 539 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_ENCRYPTIONS_STMT); } -#line 7046 "sql.c" break; case 296: /* cmd ::= SHOW QUERIES */ -#line 540 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT); } -#line 7051 "sql.c" break; case 297: /* cmd ::= SHOW SCORES */ -#line 541 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SCORES_STMT); } -#line 7056 "sql.c" break; case 298: /* cmd ::= SHOW TOPICS */ -#line 542 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TOPICS_STMT); } -#line 7061 "sql.c" break; case 299: /* cmd ::= SHOW VARIABLES */ case 300: /* cmd ::= SHOW CLUSTER VARIABLES */ yytestcase(yyruleno==300); -#line 543 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VARIABLES_STMT); } -#line 7067 "sql.c" break; case 301: /* cmd ::= SHOW LOCAL VARIABLES */ -#line 545 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT); } -#line 7072 "sql.c" break; case 302: /* cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ -#line 546 "sql.y" -{ pCxt->pRootNode = createShowDnodeVariablesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[-2].minor.yy0), yymsp[0].minor.yy416); } -#line 7077 "sql.c" +{ pCxt->pRootNode = createShowDnodeVariablesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[-2].minor.yy0), yymsp[0].minor.yy840); } break; case 303: /* cmd ::= SHOW BNODES */ -#line 547 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_BNODES_STMT); } -#line 7082 "sql.c" break; case 304: /* cmd ::= SHOW SNODES */ -#line 548 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SNODES_STMT); } -#line 7087 "sql.c" break; case 305: /* cmd ::= SHOW CLUSTER */ -#line 549 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_STMT); } -#line 7092 "sql.c" break; case 306: /* cmd ::= SHOW TRANSACTIONS */ -#line 550 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TRANSACTIONS_STMT); } -#line 7097 "sql.c" break; case 307: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ -#line 551 "sql.y" -{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy416); } -#line 7102 "sql.c" +{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy840); } break; case 308: /* cmd ::= SHOW CONSUMERS */ -#line 552 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONSUMERS_STMT); } -#line 7107 "sql.c" break; case 309: /* cmd ::= SHOW SUBSCRIPTIONS */ -#line 553 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT); } -#line 7112 "sql.c" break; case 310: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ -#line 554 "sql.y" -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy416, yymsp[-1].minor.yy416, OP_TYPE_EQUAL); } -#line 7117 "sql.c" +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy840, yymsp[-1].minor.yy840, OP_TYPE_EQUAL); } break; case 311: /* cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ -#line 555 "sql.y" -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy1109), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy1109), OP_TYPE_EQUAL); } -#line 7122 "sql.c" +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy209), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy209), OP_TYPE_EQUAL); } break; case 312: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ -#line 556 "sql.y" -{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, yymsp[-1].minor.yy416, yymsp[0].minor.yy416, yymsp[-3].minor.yy316); } -#line 7127 "sql.c" +{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, yymsp[-1].minor.yy840, yymsp[0].minor.yy840, yymsp[-3].minor.yy456); } break; case 313: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ -#line 557 "sql.y" -{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, createIdentifierValueNode(pCxt, &yymsp[0].minor.yy1109), createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy1109), yymsp[-4].minor.yy316); } -#line 7132 "sql.c" +{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, createIdentifierValueNode(pCxt, &yymsp[0].minor.yy209), createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy209), yymsp[-4].minor.yy456); } break; case 314: /* cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ -#line 558 "sql.y" { pCxt->pRootNode = createShowVnodesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0), NULL); } -#line 7137 "sql.c" break; case 315: /* cmd ::= SHOW VNODES */ -#line 559 "sql.y" { pCxt->pRootNode = createShowVnodesStmt(pCxt, NULL, NULL); } -#line 7142 "sql.c" break; case 316: /* cmd ::= SHOW db_name_cond_opt ALIVE */ -#line 561 "sql.y" -{ pCxt->pRootNode = createShowAliveStmt(pCxt, yymsp[-1].minor.yy416, QUERY_NODE_SHOW_DB_ALIVE_STMT); } -#line 7147 "sql.c" +{ pCxt->pRootNode = createShowAliveStmt(pCxt, yymsp[-1].minor.yy840, QUERY_NODE_SHOW_DB_ALIVE_STMT); } break; case 317: /* cmd ::= SHOW CLUSTER ALIVE */ -#line 562 "sql.y" { pCxt->pRootNode = createShowAliveStmt(pCxt, NULL, QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT); } -#line 7152 "sql.c" break; case 318: /* cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt */ -#line 563 "sql.y" -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VIEWS_STMT, yymsp[-2].minor.yy416, yymsp[0].minor.yy416, OP_TYPE_LIKE); } -#line 7157 "sql.c" +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VIEWS_STMT, yymsp[-2].minor.yy840, yymsp[0].minor.yy840, OP_TYPE_LIKE); } break; case 319: /* cmd ::= SHOW CREATE VIEW full_table_name */ -#line 564 "sql.y" -{ pCxt->pRootNode = createShowCreateViewStmt(pCxt, QUERY_NODE_SHOW_CREATE_VIEW_STMT, yymsp[0].minor.yy416); } -#line 7162 "sql.c" +{ pCxt->pRootNode = createShowCreateViewStmt(pCxt, QUERY_NODE_SHOW_CREATE_VIEW_STMT, yymsp[0].minor.yy840); } break; case 320: /* cmd ::= SHOW COMPACTS */ -#line 565 "sql.y" { pCxt->pRootNode = createShowCompactsStmt(pCxt, QUERY_NODE_SHOW_COMPACTS_STMT); } -#line 7167 "sql.c" break; case 321: /* cmd ::= SHOW COMPACT NK_INTEGER */ -#line 566 "sql.y" { pCxt->pRootNode = createShowCompactDetailsStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } -#line 7172 "sql.c" break; case 322: /* table_kind_db_name_cond_opt ::= */ -#line 570 "sql.y" -{ yymsp[1].minor.yy925.kind = SHOW_KIND_ALL; yymsp[1].minor.yy925.dbName = nil_token; } -#line 7177 "sql.c" +{ yymsp[1].minor.yy13.kind = SHOW_KIND_ALL; yymsp[1].minor.yy13.dbName = nil_token; } break; case 323: /* table_kind_db_name_cond_opt ::= table_kind */ -#line 571 "sql.y" -{ yylhsminor.yy925.kind = yymsp[0].minor.yy681; yylhsminor.yy925.dbName = nil_token; } -#line 7182 "sql.c" - yymsp[0].minor.yy925 = yylhsminor.yy925; +{ yylhsminor.yy13.kind = yymsp[0].minor.yy881; yylhsminor.yy13.dbName = nil_token; } + yymsp[0].minor.yy13 = yylhsminor.yy13; break; case 324: /* table_kind_db_name_cond_opt ::= db_name NK_DOT */ -#line 572 "sql.y" -{ yylhsminor.yy925.kind = SHOW_KIND_ALL; yylhsminor.yy925.dbName = yymsp[-1].minor.yy1109; } -#line 7188 "sql.c" - yymsp[-1].minor.yy925 = yylhsminor.yy925; +{ yylhsminor.yy13.kind = SHOW_KIND_ALL; yylhsminor.yy13.dbName = yymsp[-1].minor.yy209; } + yymsp[-1].minor.yy13 = yylhsminor.yy13; break; case 325: /* table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */ -#line 573 "sql.y" -{ yylhsminor.yy925.kind = yymsp[-2].minor.yy681; yylhsminor.yy925.dbName = yymsp[-1].minor.yy1109; } -#line 7194 "sql.c" - yymsp[-2].minor.yy925 = yylhsminor.yy925; +{ yylhsminor.yy13.kind = yymsp[-2].minor.yy881; yylhsminor.yy13.dbName = yymsp[-1].minor.yy209; } + yymsp[-2].minor.yy13 = yylhsminor.yy13; break; case 326: /* table_kind ::= NORMAL */ -#line 577 "sql.y" -{ yymsp[0].minor.yy681 = SHOW_KIND_TABLES_NORMAL; } -#line 7200 "sql.c" +{ yymsp[0].minor.yy881 = SHOW_KIND_TABLES_NORMAL; } break; case 327: /* table_kind ::= CHILD */ -#line 578 "sql.y" -{ yymsp[0].minor.yy681 = SHOW_KIND_TABLES_CHILD; } -#line 7205 "sql.c" +{ yymsp[0].minor.yy881 = SHOW_KIND_TABLES_CHILD; } break; case 328: /* db_name_cond_opt ::= */ case 333: /* from_db_opt ::= */ yytestcase(yyruleno==333); -#line 580 "sql.y" -{ yymsp[1].minor.yy416 = createDefaultDatabaseCondValue(pCxt); } -#line 7211 "sql.c" +{ yymsp[1].minor.yy840 = createDefaultDatabaseCondValue(pCxt); } break; case 329: /* db_name_cond_opt ::= db_name NK_DOT */ -#line 581 "sql.y" -{ yylhsminor.yy416 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy1109); } -#line 7216 "sql.c" - yymsp[-1].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy209); } + yymsp[-1].minor.yy840 = yylhsminor.yy840; break; case 331: /* like_pattern_opt ::= LIKE NK_STRING */ -#line 584 "sql.y" -{ yymsp[-1].minor.yy416 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } -#line 7222 "sql.c" +{ yymsp[-1].minor.yy840 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } break; case 332: /* table_name_cond ::= table_name */ -#line 586 "sql.y" -{ yylhsminor.yy416 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy1109); } -#line 7227 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy209); } + yymsp[0].minor.yy840 = yylhsminor.yy840; break; case 334: /* from_db_opt ::= FROM db_name */ -#line 589 "sql.y" -{ yymsp[-1].minor.yy416 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy1109); } -#line 7233 "sql.c" +{ yymsp[-1].minor.yy840 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy209); } break; case 338: /* tag_item ::= TBNAME */ -#line 597 "sql.y" -{ yylhsminor.yy416 = setProjectionAlias(pCxt, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL), &yymsp[0].minor.yy0); } -#line 7238 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = setProjectionAlias(pCxt, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL), &yymsp[0].minor.yy0); } + yymsp[0].minor.yy840 = yylhsminor.yy840; break; case 341: /* tag_item ::= column_name column_alias */ -#line 600 "sql.y" -{ yylhsminor.yy416 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy1109), &yymsp[0].minor.yy1109); } -#line 7244 "sql.c" - yymsp[-1].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy209), &yymsp[0].minor.yy209); } + yymsp[-1].minor.yy840 = yylhsminor.yy840; break; case 342: /* tag_item ::= column_name AS column_alias */ -#line 601 "sql.y" -{ yylhsminor.yy416 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-2].minor.yy1109), &yymsp[0].minor.yy1109); } -#line 7250 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-2].minor.yy209), &yymsp[0].minor.yy209); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 343: /* db_kind_opt ::= */ -#line 605 "sql.y" -{ yymsp[1].minor.yy681 = SHOW_KIND_ALL; } -#line 7256 "sql.c" +{ yymsp[1].minor.yy881 = SHOW_KIND_ALL; } break; case 344: /* db_kind_opt ::= USER */ -#line 606 "sql.y" -{ yymsp[0].minor.yy681 = SHOW_KIND_DATABASES_USER; } -#line 7261 "sql.c" +{ yymsp[0].minor.yy881 = SHOW_KIND_DATABASES_USER; } break; case 345: /* db_kind_opt ::= SYSTEM */ -#line 607 "sql.y" -{ yymsp[0].minor.yy681 = SHOW_KIND_DATABASES_SYSTEM; } -#line 7266 "sql.c" +{ yymsp[0].minor.yy881 = SHOW_KIND_DATABASES_SYSTEM; } break; case 346: /* cmd ::= CREATE TSMA not_exists_opt tsma_name ON full_table_name tsma_func_list INTERVAL NK_LP duration_literal NK_RP */ -#line 613 "sql.y" -{ pCxt->pRootNode = createCreateTSMAStmt(pCxt, yymsp[-8].minor.yy209, &yymsp[-7].minor.yy1109, yymsp[-4].minor.yy416, yymsp[-5].minor.yy416, releaseRawExprNode(pCxt, yymsp[-1].minor.yy416)); } -#line 7271 "sql.c" +{ pCxt->pRootNode = createCreateTSMAStmt(pCxt, yymsp[-8].minor.yy9, &yymsp[-7].minor.yy209, yymsp[-4].minor.yy840, yymsp[-5].minor.yy840, releaseRawExprNode(pCxt, yymsp[-1].minor.yy840)); } break; case 347: /* cmd ::= CREATE RECURSIVE TSMA not_exists_opt tsma_name ON full_table_name INTERVAL NK_LP duration_literal NK_RP */ -#line 615 "sql.y" -{ pCxt->pRootNode = createCreateTSMAStmt(pCxt, yymsp[-7].minor.yy209, &yymsp[-6].minor.yy1109, NULL, yymsp[-4].minor.yy416, releaseRawExprNode(pCxt, yymsp[-1].minor.yy416)); } -#line 7276 "sql.c" +{ pCxt->pRootNode = createCreateTSMAStmt(pCxt, yymsp[-7].minor.yy9, &yymsp[-6].minor.yy209, NULL, yymsp[-4].minor.yy840, releaseRawExprNode(pCxt, yymsp[-1].minor.yy840)); } break; case 348: /* cmd ::= DROP TSMA exists_opt full_tsma_name */ -#line 616 "sql.y" -{ pCxt->pRootNode = createDropTSMAStmt(pCxt, yymsp[-1].minor.yy209, yymsp[0].minor.yy416); } -#line 7281 "sql.c" +{ pCxt->pRootNode = createDropTSMAStmt(pCxt, yymsp[-1].minor.yy9, yymsp[0].minor.yy840); } break; case 349: /* cmd ::= SHOW db_name_cond_opt TSMAS */ -#line 617 "sql.y" -{ pCxt->pRootNode = createShowTSMASStmt(pCxt, yymsp[-1].minor.yy416); } -#line 7286 "sql.c" +{ pCxt->pRootNode = createShowTSMASStmt(pCxt, yymsp[-1].minor.yy840); } break; case 352: /* tsma_func_list ::= FUNCTION NK_LP func_list NK_RP */ -#line 624 "sql.y" -{ yymsp[-3].minor.yy416 = createTSMAOptions(pCxt, yymsp[-1].minor.yy316); } -#line 7291 "sql.c" +{ yymsp[-3].minor.yy840 = createTSMAOptions(pCxt, yymsp[-1].minor.yy456); } break; case 353: /* cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */ -#line 628 "sql.y" -{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy209, yymsp[-3].minor.yy416, yymsp[-1].minor.yy416, NULL, yymsp[0].minor.yy416); } -#line 7296 "sql.c" +{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy9, yymsp[-3].minor.yy840, yymsp[-1].minor.yy840, NULL, yymsp[0].minor.yy840); } break; case 354: /* cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */ -#line 630 "sql.y" -{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_NORMAL, yymsp[-6].minor.yy209, yymsp[-5].minor.yy416, yymsp[-3].minor.yy416, yymsp[-1].minor.yy316, NULL); } -#line 7301 "sql.c" +{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_NORMAL, yymsp[-6].minor.yy9, yymsp[-5].minor.yy840, yymsp[-3].minor.yy840, yymsp[-1].minor.yy456, NULL); } break; case 355: /* cmd ::= DROP INDEX exists_opt full_index_name */ -#line 631 "sql.y" -{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy209, yymsp[0].minor.yy416); } -#line 7306 "sql.c" +{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy9, yymsp[0].minor.yy840); } break; case 356: /* full_index_name ::= index_name */ -#line 633 "sql.y" -{ yylhsminor.yy416 = createRealTableNodeForIndexName(pCxt, NULL, &yymsp[0].minor.yy1109); } -#line 7311 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = createRealTableNodeForIndexName(pCxt, NULL, &yymsp[0].minor.yy209); } + yymsp[0].minor.yy840 = yylhsminor.yy840; break; case 357: /* full_index_name ::= db_name NK_DOT index_name */ -#line 634 "sql.y" -{ yylhsminor.yy416 = createRealTableNodeForIndexName(pCxt, &yymsp[-2].minor.yy1109, &yymsp[0].minor.yy1109); } -#line 7317 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = createRealTableNodeForIndexName(pCxt, &yymsp[-2].minor.yy209, &yymsp[0].minor.yy209); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 358: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ -#line 637 "sql.y" -{ yymsp[-9].minor.yy416 = createIndexOption(pCxt, yymsp[-7].minor.yy316, releaseRawExprNode(pCxt, yymsp[-3].minor.yy416), NULL, yymsp[-1].minor.yy416, yymsp[0].minor.yy416); } -#line 7323 "sql.c" +{ yymsp[-9].minor.yy840 = createIndexOption(pCxt, yymsp[-7].minor.yy456, releaseRawExprNode(pCxt, yymsp[-3].minor.yy840), NULL, yymsp[-1].minor.yy840, yymsp[0].minor.yy840); } break; case 359: /* 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 */ -#line 640 "sql.y" -{ yymsp[-11].minor.yy416 = createIndexOption(pCxt, yymsp[-9].minor.yy316, releaseRawExprNode(pCxt, yymsp[-5].minor.yy416), releaseRawExprNode(pCxt, yymsp[-3].minor.yy416), yymsp[-1].minor.yy416, yymsp[0].minor.yy416); } -#line 7328 "sql.c" +{ yymsp[-11].minor.yy840 = createIndexOption(pCxt, yymsp[-9].minor.yy456, releaseRawExprNode(pCxt, yymsp[-5].minor.yy840), releaseRawExprNode(pCxt, yymsp[-3].minor.yy840), yymsp[-1].minor.yy840, yymsp[0].minor.yy840); } break; case 362: /* func ::= sma_func_name NK_LP expression_list NK_RP */ -#line 647 "sql.y" -{ yylhsminor.yy416 = createFunctionNode(pCxt, &yymsp[-3].minor.yy1109, yymsp[-1].minor.yy316); } -#line 7333 "sql.c" - yymsp[-3].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = createFunctionNode(pCxt, &yymsp[-3].minor.yy209, yymsp[-1].minor.yy456); } + yymsp[-3].minor.yy840 = yylhsminor.yy840; break; case 363: /* sma_func_name ::= function_name */ - case 637: /* alias_opt ::= table_alias */ yytestcase(yyruleno==637); -#line 651 "sql.y" -{ yylhsminor.yy1109 = yymsp[0].minor.yy1109; } -#line 7340 "sql.c" - yymsp[0].minor.yy1109 = yylhsminor.yy1109; + case 653: /* alias_opt ::= table_alias */ yytestcase(yyruleno==653); +{ yylhsminor.yy209 = yymsp[0].minor.yy209; } + yymsp[0].minor.yy209 = yylhsminor.yy209; break; case 368: /* sma_stream_opt ::= */ case 418: /* stream_options ::= */ yytestcase(yyruleno==418); -#line 657 "sql.y" -{ yymsp[1].minor.yy416 = createStreamOptions(pCxt); } -#line 7347 "sql.c" +{ yymsp[1].minor.yy840 = createStreamOptions(pCxt); } break; case 369: /* sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ -#line 658 "sql.y" -{ ((SStreamOptions*)yymsp[-2].minor.yy416)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy416); yylhsminor.yy416 = yymsp[-2].minor.yy416; } -#line 7352 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ ((SStreamOptions*)yymsp[-2].minor.yy840)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy840); yylhsminor.yy840 = yymsp[-2].minor.yy840; } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 370: /* sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ -#line 659 "sql.y" -{ ((SStreamOptions*)yymsp[-2].minor.yy416)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy416); yylhsminor.yy416 = yymsp[-2].minor.yy416; } -#line 7358 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ ((SStreamOptions*)yymsp[-2].minor.yy840)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy840); yylhsminor.yy840 = yymsp[-2].minor.yy840; } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 371: /* sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ -#line 660 "sql.y" -{ ((SStreamOptions*)yymsp[-2].minor.yy416)->pDeleteMark = releaseRawExprNode(pCxt, yymsp[0].minor.yy416); yylhsminor.yy416 = yymsp[-2].minor.yy416; } -#line 7364 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ ((SStreamOptions*)yymsp[-2].minor.yy840)->pDeleteMark = releaseRawExprNode(pCxt, yymsp[0].minor.yy840); yylhsminor.yy840 = yymsp[-2].minor.yy840; } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 372: /* with_meta ::= AS */ -#line 665 "sql.y" -{ yymsp[0].minor.yy820 = 0; } -#line 7370 "sql.c" +{ yymsp[0].minor.yy516 = 0; } break; case 373: /* with_meta ::= WITH META AS */ -#line 666 "sql.y" -{ yymsp[-2].minor.yy820 = 1; } -#line 7375 "sql.c" +{ yymsp[-2].minor.yy516 = 1; } break; case 374: /* with_meta ::= ONLY META AS */ -#line 667 "sql.y" -{ yymsp[-2].minor.yy820 = 2; } -#line 7380 "sql.c" +{ yymsp[-2].minor.yy516 = 2; } break; case 375: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ -#line 669 "sql.y" -{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy209, &yymsp[-2].minor.yy1109, yymsp[0].minor.yy416); } -#line 7385 "sql.c" +{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy9, &yymsp[-2].minor.yy209, yymsp[0].minor.yy840); } break; case 376: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ -#line 671 "sql.y" -{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy209, &yymsp[-3].minor.yy1109, &yymsp[0].minor.yy1109, yymsp[-2].minor.yy820); } -#line 7390 "sql.c" +{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy9, &yymsp[-3].minor.yy209, &yymsp[0].minor.yy209, yymsp[-2].minor.yy516); } break; case 377: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ -#line 673 "sql.y" -{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-5].minor.yy209, &yymsp[-4].minor.yy1109, yymsp[-1].minor.yy416, yymsp[-3].minor.yy820, yymsp[0].minor.yy416); } -#line 7395 "sql.c" +{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-5].minor.yy9, &yymsp[-4].minor.yy209, yymsp[-1].minor.yy840, yymsp[-3].minor.yy516, yymsp[0].minor.yy840); } break; case 378: /* cmd ::= DROP TOPIC exists_opt topic_name */ -#line 675 "sql.y" -{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy209, &yymsp[0].minor.yy1109); } -#line 7400 "sql.c" +{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy9, &yymsp[0].minor.yy209); } break; case 379: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ -#line 676 "sql.y" -{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy209, &yymsp[-2].minor.yy1109, &yymsp[0].minor.yy1109); } -#line 7405 "sql.c" +{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy9, &yymsp[-2].minor.yy209, &yymsp[0].minor.yy209); } break; case 380: /* cmd ::= DESC full_table_name */ case 381: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==381); -#line 679 "sql.y" -{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy416); } -#line 7411 "sql.c" +{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy840); } break; case 382: /* cmd ::= RESET QUERY CACHE */ -#line 683 "sql.y" { pCxt->pRootNode = createResetQueryCacheStmt(pCxt); } -#line 7416 "sql.c" break; case 383: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ case 384: /* cmd ::= EXPLAIN analyze_opt explain_options insert_query */ yytestcase(yyruleno==384); -#line 686 "sql.y" -{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy209, yymsp[-1].minor.yy416, yymsp[0].minor.yy416); } -#line 7422 "sql.c" +{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy9, yymsp[-1].minor.yy840, yymsp[0].minor.yy840); } break; case 387: /* explain_options ::= */ -#line 694 "sql.y" -{ yymsp[1].minor.yy416 = createDefaultExplainOptions(pCxt); } -#line 7427 "sql.c" +{ yymsp[1].minor.yy840 = createDefaultExplainOptions(pCxt); } break; case 388: /* explain_options ::= explain_options VERBOSE NK_BOOL */ -#line 695 "sql.y" -{ yylhsminor.yy416 = setExplainVerbose(pCxt, yymsp[-2].minor.yy416, &yymsp[0].minor.yy0); } -#line 7432 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = setExplainVerbose(pCxt, yymsp[-2].minor.yy840, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 389: /* explain_options ::= explain_options RATIO NK_FLOAT */ -#line 696 "sql.y" -{ yylhsminor.yy416 = setExplainRatio(pCxt, yymsp[-2].minor.yy416, &yymsp[0].minor.yy0); } -#line 7438 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = setExplainRatio(pCxt, yymsp[-2].minor.yy840, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 390: /* cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ -#line 701 "sql.y" -{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-7].minor.yy209, yymsp[-9].minor.yy209, &yymsp[-6].minor.yy1109, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy952, yymsp[-1].minor.yy820, &yymsp[0].minor.yy1109, yymsp[-10].minor.yy209); } -#line 7444 "sql.c" +{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-7].minor.yy9, yymsp[-9].minor.yy9, &yymsp[-6].minor.yy209, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy48, yymsp[-1].minor.yy516, &yymsp[0].minor.yy209, yymsp[-10].minor.yy9); } break; case 391: /* cmd ::= DROP FUNCTION exists_opt function_name */ -#line 702 "sql.y" -{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy209, &yymsp[0].minor.yy1109); } -#line 7449 "sql.c" +{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy9, &yymsp[0].minor.yy209); } break; case 396: /* language_opt ::= */ - case 441: /* on_vgroup_id ::= */ yytestcase(yyruleno==441); -#line 716 "sql.y" -{ yymsp[1].minor.yy1109 = nil_token; } -#line 7455 "sql.c" + case 442: /* on_vgroup_id ::= */ yytestcase(yyruleno==442); +{ yymsp[1].minor.yy209 = nil_token; } break; case 397: /* language_opt ::= LANGUAGE NK_STRING */ - case 442: /* on_vgroup_id ::= ON NK_INTEGER */ yytestcase(yyruleno==442); -#line 717 "sql.y" -{ yymsp[-1].minor.yy1109 = yymsp[0].minor.yy0; } -#line 7461 "sql.c" + case 443: /* on_vgroup_id ::= ON NK_INTEGER */ yytestcase(yyruleno==443); +{ yymsp[-1].minor.yy209 = yymsp[0].minor.yy0; } break; case 400: /* cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */ -#line 726 "sql.y" -{ pCxt->pRootNode = createCreateViewStmt(pCxt, yymsp[-4].minor.yy209, yymsp[-2].minor.yy416, &yymsp[-1].minor.yy0, yymsp[0].minor.yy416); } -#line 7466 "sql.c" +{ pCxt->pRootNode = createCreateViewStmt(pCxt, yymsp[-4].minor.yy9, yymsp[-2].minor.yy840, &yymsp[-1].minor.yy0, yymsp[0].minor.yy840); } break; case 401: /* cmd ::= DROP VIEW exists_opt full_view_name */ -#line 727 "sql.y" -{ pCxt->pRootNode = createDropViewStmt(pCxt, yymsp[-1].minor.yy209, yymsp[0].minor.yy416); } -#line 7471 "sql.c" +{ pCxt->pRootNode = createDropViewStmt(pCxt, yymsp[-1].minor.yy9, yymsp[0].minor.yy840); } break; case 402: /* full_view_name ::= view_name */ -#line 729 "sql.y" -{ yylhsminor.yy416 = createViewNode(pCxt, NULL, &yymsp[0].minor.yy1109); } -#line 7476 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = createViewNode(pCxt, NULL, &yymsp[0].minor.yy209); } + yymsp[0].minor.yy840 = yylhsminor.yy840; break; case 403: /* full_view_name ::= db_name NK_DOT view_name */ -#line 730 "sql.y" -{ yylhsminor.yy416 = createViewNode(pCxt, &yymsp[-2].minor.yy1109, &yymsp[0].minor.yy1109); } -#line 7482 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = createViewNode(pCxt, &yymsp[-2].minor.yy209, &yymsp[0].minor.yy209); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 404: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */ -#line 735 "sql.y" -{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-9].minor.yy209, &yymsp[-8].minor.yy1109, yymsp[-5].minor.yy416, yymsp[-7].minor.yy416, yymsp[-3].minor.yy316, yymsp[-2].minor.yy416, yymsp[0].minor.yy416, yymsp[-4].minor.yy316); } -#line 7488 "sql.c" +{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-9].minor.yy9, &yymsp[-8].minor.yy209, yymsp[-5].minor.yy840, yymsp[-7].minor.yy840, yymsp[-3].minor.yy456, yymsp[-2].minor.yy840, yymsp[0].minor.yy840, yymsp[-4].minor.yy456); } break; case 405: /* cmd ::= DROP STREAM exists_opt stream_name */ -#line 736 "sql.y" -{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy209, &yymsp[0].minor.yy1109); } -#line 7493 "sql.c" +{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy9, &yymsp[0].minor.yy209); } break; case 406: /* cmd ::= PAUSE STREAM exists_opt stream_name */ -#line 737 "sql.y" -{ pCxt->pRootNode = createPauseStreamStmt(pCxt, yymsp[-1].minor.yy209, &yymsp[0].minor.yy1109); } -#line 7498 "sql.c" +{ pCxt->pRootNode = createPauseStreamStmt(pCxt, yymsp[-1].minor.yy9, &yymsp[0].minor.yy209); } break; case 407: /* cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ -#line 738 "sql.y" -{ pCxt->pRootNode = createResumeStreamStmt(pCxt, yymsp[-2].minor.yy209, yymsp[-1].minor.yy209, &yymsp[0].minor.yy1109); } -#line 7503 "sql.c" +{ pCxt->pRootNode = createResumeStreamStmt(pCxt, yymsp[-2].minor.yy9, yymsp[-1].minor.yy9, &yymsp[0].minor.yy209); } break; case 412: /* column_stream_def ::= column_name stream_col_options */ -#line 751 "sql.y" -{ yylhsminor.yy416 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy1109, createDataType(TSDB_DATA_TYPE_NULL), yymsp[0].minor.yy416); } -#line 7508 "sql.c" - yymsp[-1].minor.yy416 = yylhsminor.yy416; +{ yylhsminor.yy840 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy209, createDataType(TSDB_DATA_TYPE_NULL), yymsp[0].minor.yy840); } + yymsp[-1].minor.yy840 = yylhsminor.yy840; break; case 413: /* stream_col_options ::= */ - case 750: /* column_options ::= */ yytestcase(yyruleno==750); -#line 752 "sql.y" -{ yymsp[1].minor.yy416 = createDefaultColumnOptions(pCxt); } -#line 7515 "sql.c" + case 766: /* column_options ::= */ yytestcase(yyruleno==766); +{ yymsp[1].minor.yy840 = createDefaultColumnOptions(pCxt); } break; case 414: /* stream_col_options ::= stream_col_options PRIMARY KEY */ - case 751: /* column_options ::= column_options PRIMARY KEY */ yytestcase(yyruleno==751); -#line 753 "sql.y" -{ yylhsminor.yy416 = setColumnOptions(pCxt, yymsp[-2].minor.yy416, COLUMN_OPTION_PRIMARYKEY, NULL); } -#line 7521 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; + case 767: /* column_options ::= column_options PRIMARY KEY */ yytestcase(yyruleno==767); +{ yylhsminor.yy840 = setColumnOptions(pCxt, yymsp[-2].minor.yy840, COLUMN_OPTION_PRIMARYKEY, NULL); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 419: /* stream_options ::= stream_options TRIGGER AT_ONCE */ case 420: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ yytestcase(yyruleno==420); -#line 763 "sql.y" -{ yylhsminor.yy416 = setStreamOptions(pCxt, yymsp[-2].minor.yy416, SOPT_TRIGGER_TYPE_SET, &yymsp[0].minor.yy0, NULL); } -#line 7528 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; - break; - case 421: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ -#line 765 "sql.y" -{ yylhsminor.yy416 = setStreamOptions(pCxt, yymsp[-3].minor.yy416, SOPT_TRIGGER_TYPE_SET, &yymsp[-1].minor.yy0, releaseRawExprNode(pCxt, yymsp[0].minor.yy416)); } -#line 7534 "sql.c" - yymsp[-3].minor.yy416 = yylhsminor.yy416; - break; - case 422: /* stream_options ::= stream_options WATERMARK duration_literal */ -#line 766 "sql.y" -{ yylhsminor.yy416 = setStreamOptions(pCxt, yymsp[-2].minor.yy416, SOPT_WATERMARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy416)); } -#line 7540 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; - break; - case 423: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ -#line 767 "sql.y" -{ yylhsminor.yy416 = setStreamOptions(pCxt, yymsp[-3].minor.yy416, SOPT_IGNORE_EXPIRED_SET, &yymsp[0].minor.yy0, NULL); } -#line 7546 "sql.c" - yymsp[-3].minor.yy416 = yylhsminor.yy416; - break; - case 424: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ -#line 768 "sql.y" -{ yylhsminor.yy416 = setStreamOptions(pCxt, yymsp[-2].minor.yy416, SOPT_FILL_HISTORY_SET, &yymsp[0].minor.yy0, NULL); } -#line 7552 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; - break; - case 425: /* stream_options ::= stream_options DELETE_MARK duration_literal */ -#line 769 "sql.y" -{ yylhsminor.yy416 = setStreamOptions(pCxt, yymsp[-2].minor.yy416, SOPT_DELETE_MARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy416)); } -#line 7558 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; - break; - case 426: /* stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ -#line 770 "sql.y" -{ yylhsminor.yy416 = setStreamOptions(pCxt, yymsp[-3].minor.yy416, SOPT_IGNORE_UPDATE_SET, &yymsp[0].minor.yy0, NULL); } -#line 7564 "sql.c" - yymsp[-3].minor.yy416 = yylhsminor.yy416; - break; - case 428: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - case 694: /* sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ yytestcase(yyruleno==694); - case 718: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==718); -#line 773 "sql.y" -{ yymsp[-3].minor.yy416 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy416); } -#line 7572 "sql.c" - break; - case 431: /* cmd ::= KILL CONNECTION NK_INTEGER */ -#line 781 "sql.y" + case 421: /* stream_options ::= stream_options TRIGGER FORCE_WINDOW_CLOSE */ yytestcase(yyruleno==421); +{ yylhsminor.yy840 = setStreamOptions(pCxt, yymsp[-2].minor.yy840, SOPT_TRIGGER_TYPE_SET, &yymsp[0].minor.yy0, NULL); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; + break; + case 422: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ +{ yylhsminor.yy840 = setStreamOptions(pCxt, yymsp[-3].minor.yy840, SOPT_TRIGGER_TYPE_SET, &yymsp[-1].minor.yy0, releaseRawExprNode(pCxt, yymsp[0].minor.yy840)); } + yymsp[-3].minor.yy840 = yylhsminor.yy840; + break; + case 423: /* stream_options ::= stream_options WATERMARK duration_literal */ +{ yylhsminor.yy840 = setStreamOptions(pCxt, yymsp[-2].minor.yy840, SOPT_WATERMARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy840)); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; + break; + case 424: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ +{ yylhsminor.yy840 = setStreamOptions(pCxt, yymsp[-3].minor.yy840, SOPT_IGNORE_EXPIRED_SET, &yymsp[0].minor.yy0, NULL); } + yymsp[-3].minor.yy840 = yylhsminor.yy840; + break; + case 425: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ +{ yylhsminor.yy840 = setStreamOptions(pCxt, yymsp[-2].minor.yy840, SOPT_FILL_HISTORY_SET, &yymsp[0].minor.yy0, NULL); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; + break; + case 426: /* stream_options ::= stream_options DELETE_MARK duration_literal */ +{ yylhsminor.yy840 = setStreamOptions(pCxt, yymsp[-2].minor.yy840, SOPT_DELETE_MARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy840)); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; + break; + case 427: /* stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ +{ yylhsminor.yy840 = setStreamOptions(pCxt, yymsp[-3].minor.yy840, SOPT_IGNORE_UPDATE_SET, &yymsp[0].minor.yy0, NULL); } + yymsp[-3].minor.yy840 = yylhsminor.yy840; + break; + case 429: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + case 710: /* sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ yytestcase(yyruleno==710); + case 734: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==734); +{ yymsp[-3].minor.yy840 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy840); } + break; + case 432: /* cmd ::= KILL CONNECTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); } -#line 7577 "sql.c" break; - case 432: /* cmd ::= KILL QUERY NK_STRING */ -#line 782 "sql.y" + case 433: /* cmd ::= KILL QUERY NK_STRING */ { pCxt->pRootNode = createKillQueryStmt(pCxt, &yymsp[0].minor.yy0); } -#line 7582 "sql.c" break; - case 433: /* cmd ::= KILL TRANSACTION NK_INTEGER */ -#line 783 "sql.y" + case 434: /* cmd ::= KILL TRANSACTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_TRANSACTION_STMT, &yymsp[0].minor.yy0); } -#line 7587 "sql.c" break; - case 434: /* cmd ::= KILL COMPACT NK_INTEGER */ -#line 784 "sql.y" + case 435: /* cmd ::= KILL COMPACT NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_COMPACT_STMT, &yymsp[0].minor.yy0); } -#line 7592 "sql.c" break; - case 435: /* cmd ::= BALANCE VGROUP */ -#line 787 "sql.y" + case 436: /* cmd ::= BALANCE VGROUP */ { pCxt->pRootNode = createBalanceVgroupStmt(pCxt); } -#line 7597 "sql.c" break; - case 436: /* cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ -#line 788 "sql.y" -{ pCxt->pRootNode = createBalanceVgroupLeaderStmt(pCxt, &yymsp[0].minor.yy1109); } -#line 7602 "sql.c" + case 437: /* cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ +{ pCxt->pRootNode = createBalanceVgroupLeaderStmt(pCxt, &yymsp[0].minor.yy209); } break; - case 437: /* cmd ::= BALANCE VGROUP LEADER DATABASE db_name */ -#line 789 "sql.y" -{ pCxt->pRootNode = createBalanceVgroupLeaderDBNameStmt(pCxt, &yymsp[0].minor.yy1109); } -#line 7607 "sql.c" + case 438: /* cmd ::= BALANCE VGROUP LEADER DATABASE db_name */ +{ pCxt->pRootNode = createBalanceVgroupLeaderDBNameStmt(pCxt, &yymsp[0].minor.yy209); } break; - case 438: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ -#line 790 "sql.y" + case 439: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ { pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } -#line 7612 "sql.c" break; - case 439: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ -#line 791 "sql.y" -{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy316); } -#line 7617 "sql.c" + case 440: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ +{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy456); } break; - case 440: /* cmd ::= SPLIT VGROUP NK_INTEGER */ -#line 792 "sql.y" + case 441: /* cmd ::= SPLIT VGROUP NK_INTEGER */ { pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); } -#line 7622 "sql.c" - break; - case 443: /* dnode_list ::= DNODE NK_INTEGER */ -#line 801 "sql.y" -{ yymsp[-1].minor.yy316 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } -#line 7627 "sql.c" - break; - case 445: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ -#line 808 "sql.y" -{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy416, yymsp[0].minor.yy416); } -#line 7632 "sql.c" - break; - case 448: /* insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ -#line 817 "sql.y" -{ yymsp[-6].minor.yy416 = createInsertStmt(pCxt, yymsp[-4].minor.yy416, yymsp[-2].minor.yy316, yymsp[0].minor.yy416); } -#line 7637 "sql.c" - break; - case 449: /* insert_query ::= INSERT INTO full_table_name query_or_subquery */ -#line 818 "sql.y" -{ yymsp[-3].minor.yy416 = createInsertStmt(pCxt, yymsp[-1].minor.yy416, NULL, yymsp[0].minor.yy416); } -#line 7642 "sql.c" - break; - case 450: /* tags_literal ::= NK_INTEGER */ - case 462: /* tags_literal ::= NK_BIN */ yytestcase(yyruleno==462); - case 471: /* tags_literal ::= NK_HEX */ yytestcase(yyruleno==471); -#line 821 "sql.y" -{ yylhsminor.yy416 = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0, NULL); } -#line 7649 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 451: /* tags_literal ::= NK_INTEGER NK_PLUS duration_literal */ - case 452: /* tags_literal ::= NK_INTEGER NK_MINUS duration_literal */ yytestcase(yyruleno==452); - case 463: /* tags_literal ::= NK_BIN NK_PLUS duration_literal */ yytestcase(yyruleno==463); - case 464: /* tags_literal ::= NK_BIN NK_MINUS duration_literal */ yytestcase(yyruleno==464); - case 472: /* tags_literal ::= NK_HEX NK_PLUS duration_literal */ yytestcase(yyruleno==472); - case 473: /* tags_literal ::= NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==473); - case 481: /* tags_literal ::= NK_STRING NK_PLUS duration_literal */ yytestcase(yyruleno==481); - case 482: /* tags_literal ::= NK_STRING NK_MINUS duration_literal */ yytestcase(yyruleno==482); -#line 822 "sql.y" + break; + case 444: /* dnode_list ::= DNODE NK_INTEGER */ +{ yymsp[-1].minor.yy456 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + break; + case 446: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ +{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy840, yymsp[0].minor.yy840); } + break; + case 449: /* insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ +{ yymsp[-6].minor.yy840 = createInsertStmt(pCxt, yymsp[-4].minor.yy840, yymsp[-2].minor.yy456, yymsp[0].minor.yy840); } + break; + case 450: /* insert_query ::= INSERT INTO full_table_name query_or_subquery */ +{ yymsp[-3].minor.yy840 = createInsertStmt(pCxt, yymsp[-1].minor.yy840, NULL, yymsp[0].minor.yy840); } + break; + case 451: /* tags_literal ::= NK_INTEGER */ + case 463: /* tags_literal ::= NK_BIN */ yytestcase(yyruleno==463); + case 472: /* tags_literal ::= NK_HEX */ yytestcase(yyruleno==472); +{ yylhsminor.yy840 = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0, NULL); } + yymsp[0].minor.yy840 = yylhsminor.yy840; + break; + case 452: /* tags_literal ::= NK_INTEGER NK_PLUS duration_literal */ + case 453: /* tags_literal ::= NK_INTEGER NK_MINUS duration_literal */ yytestcase(yyruleno==453); + case 464: /* tags_literal ::= NK_BIN NK_PLUS duration_literal */ yytestcase(yyruleno==464); + case 465: /* tags_literal ::= NK_BIN NK_MINUS duration_literal */ yytestcase(yyruleno==465); + case 473: /* tags_literal ::= NK_HEX NK_PLUS duration_literal */ yytestcase(yyruleno==473); + case 474: /* tags_literal ::= NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==474); + case 482: /* tags_literal ::= NK_STRING NK_PLUS duration_literal */ yytestcase(yyruleno==482); + case 483: /* tags_literal ::= NK_STRING NK_MINUS duration_literal */ yytestcase(yyruleno==483); { SToken l = yymsp[-2].minor.yy0; - SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); + SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy840); l.n = (r.z + r.n) - l.z; - yylhsminor.yy416 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, yymsp[0].minor.yy416); + yylhsminor.yy840 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, yymsp[0].minor.yy840); } -#line 7667 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; - break; - case 453: /* tags_literal ::= NK_PLUS NK_INTEGER */ - case 456: /* tags_literal ::= NK_MINUS NK_INTEGER */ yytestcase(yyruleno==456); - case 465: /* tags_literal ::= NK_PLUS NK_BIN */ yytestcase(yyruleno==465); - case 468: /* tags_literal ::= NK_MINUS NK_BIN */ yytestcase(yyruleno==468); - case 474: /* tags_literal ::= NK_PLUS NK_HEX */ yytestcase(yyruleno==474); - case 477: /* tags_literal ::= NK_MINUS NK_HEX */ yytestcase(yyruleno==477); -#line 834 "sql.y" + yymsp[-2].minor.yy840 = yylhsminor.yy840; + break; + case 454: /* tags_literal ::= NK_PLUS NK_INTEGER */ + case 457: /* tags_literal ::= NK_MINUS NK_INTEGER */ yytestcase(yyruleno==457); + case 466: /* tags_literal ::= NK_PLUS NK_BIN */ yytestcase(yyruleno==466); + case 469: /* tags_literal ::= NK_MINUS NK_BIN */ yytestcase(yyruleno==469); + case 475: /* tags_literal ::= NK_PLUS NK_HEX */ yytestcase(yyruleno==475); + case 478: /* tags_literal ::= NK_MINUS NK_HEX */ yytestcase(yyruleno==478); { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy416 = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &t, NULL); + yylhsminor.yy840 = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &t, NULL); } -#line 7682 "sql.c" - yymsp[-1].minor.yy416 = yylhsminor.yy416; - break; - case 454: /* tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal */ - case 455: /* tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal */ yytestcase(yyruleno==455); - case 457: /* tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal */ yytestcase(yyruleno==457); - case 458: /* tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal */ yytestcase(yyruleno==458); - case 466: /* tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal */ yytestcase(yyruleno==466); - case 467: /* tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal */ yytestcase(yyruleno==467); - case 469: /* tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal */ yytestcase(yyruleno==469); - case 470: /* tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal */ yytestcase(yyruleno==470); - case 475: /* tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal */ yytestcase(yyruleno==475); - case 476: /* tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==476); - case 478: /* tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal */ yytestcase(yyruleno==478); - case 479: /* tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==479); -#line 839 "sql.y" + yymsp[-1].minor.yy840 = yylhsminor.yy840; + break; + case 455: /* tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal */ + case 456: /* tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal */ yytestcase(yyruleno==456); + case 458: /* tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal */ yytestcase(yyruleno==458); + case 459: /* tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal */ yytestcase(yyruleno==459); + case 467: /* tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal */ yytestcase(yyruleno==467); + case 468: /* tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal */ yytestcase(yyruleno==468); + case 470: /* tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal */ yytestcase(yyruleno==470); + case 471: /* tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal */ yytestcase(yyruleno==471); + case 476: /* tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal */ yytestcase(yyruleno==476); + case 477: /* tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==477); + case 479: /* tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal */ yytestcase(yyruleno==479); + case 480: /* tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==480); { SToken l = yymsp[-3].minor.yy0; - SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); + SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy840); l.n = (r.z + r.n) - l.z; - yylhsminor.yy416 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, yymsp[0].minor.yy416); + yylhsminor.yy840 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, yymsp[0].minor.yy840); } -#line 7704 "sql.c" - yymsp[-3].minor.yy416 = yylhsminor.yy416; - break; - case 459: /* tags_literal ::= NK_FLOAT */ -#line 868 "sql.y" -{ yylhsminor.yy416 = createRawValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0, NULL); } -#line 7710 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 460: /* tags_literal ::= NK_PLUS NK_FLOAT */ - case 461: /* tags_literal ::= NK_MINUS NK_FLOAT */ yytestcase(yyruleno==461); -#line 869 "sql.y" + yymsp[-3].minor.yy840 = yylhsminor.yy840; + break; + case 460: /* tags_literal ::= NK_FLOAT */ +{ yylhsminor.yy840 = createRawValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0, NULL); } + yymsp[0].minor.yy840 = yylhsminor.yy840; + break; + case 461: /* tags_literal ::= NK_PLUS NK_FLOAT */ + case 462: /* tags_literal ::= NK_MINUS NK_FLOAT */ yytestcase(yyruleno==462); { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy416 = createRawValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t, NULL); + yylhsminor.yy840 = createRawValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t, NULL); } -#line 7721 "sql.c" - yymsp[-1].minor.yy416 = yylhsminor.yy416; - break; - case 480: /* tags_literal ::= NK_STRING */ -#line 975 "sql.y" -{ yylhsminor.yy416 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0, NULL); } -#line 7727 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 483: /* tags_literal ::= NK_BOOL */ -#line 988 "sql.y" -{ yylhsminor.yy416 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0, NULL); } -#line 7733 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 484: /* tags_literal ::= NULL */ -#line 989 "sql.y" -{ yylhsminor.yy416 = createRawValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0, NULL); } -#line 7739 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 485: /* tags_literal ::= literal_func */ -#line 991 "sql.y" -{ yylhsminor.yy416 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BINARY, NULL, yymsp[0].minor.yy416); } -#line 7745 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 486: /* tags_literal ::= literal_func NK_PLUS duration_literal */ - case 487: /* tags_literal ::= literal_func NK_MINUS duration_literal */ yytestcase(yyruleno==487); -#line 992 "sql.y" + yymsp[-1].minor.yy840 = yylhsminor.yy840; + break; + case 481: /* tags_literal ::= NK_STRING */ +{ yylhsminor.yy840 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0, NULL); } + yymsp[0].minor.yy840 = yylhsminor.yy840; + break; + case 484: /* tags_literal ::= NK_BOOL */ +{ yylhsminor.yy840 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0, NULL); } + yymsp[0].minor.yy840 = yylhsminor.yy840; + break; + case 485: /* tags_literal ::= NULL */ +{ yylhsminor.yy840 = createRawValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0, NULL); } + yymsp[0].minor.yy840 = yylhsminor.yy840; + break; + case 486: /* tags_literal ::= literal_func */ +{ yylhsminor.yy840 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BINARY, NULL, yymsp[0].minor.yy840); } + yymsp[0].minor.yy840 = yylhsminor.yy840; + break; + case 487: /* tags_literal ::= literal_func NK_PLUS duration_literal */ + case 488: /* tags_literal ::= literal_func NK_MINUS duration_literal */ yytestcase(yyruleno==488); { - SToken l = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy416); - SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); + SToken l = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy840); + SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy840); l.n = (r.z + r.n) - l.z; - yylhsminor.yy416 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, yymsp[-2].minor.yy416, yymsp[0].minor.yy416); + yylhsminor.yy840 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, yymsp[-2].minor.yy840, yymsp[0].minor.yy840); } -#line 7757 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; - break; - case 490: /* literal ::= NK_INTEGER */ -#line 1011 "sql.y" -{ yylhsminor.yy416 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); } -#line 7763 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 491: /* literal ::= NK_FLOAT */ -#line 1012 "sql.y" -{ yylhsminor.yy416 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } -#line 7769 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 492: /* literal ::= NK_STRING */ -#line 1013 "sql.y" -{ yylhsminor.yy416 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } -#line 7775 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 493: /* literal ::= NK_BOOL */ -#line 1014 "sql.y" -{ yylhsminor.yy416 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } -#line 7781 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 494: /* literal ::= TIMESTAMP NK_STRING */ -#line 1015 "sql.y" -{ yylhsminor.yy416 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } -#line 7787 "sql.c" - yymsp[-1].minor.yy416 = yylhsminor.yy416; - break; - case 495: /* literal ::= duration_literal */ - case 505: /* signed_literal ::= signed */ yytestcase(yyruleno==505); - case 529: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==529); - case 530: /* expression ::= literal */ yytestcase(yyruleno==530); - case 532: /* expression ::= column_reference */ yytestcase(yyruleno==532); - case 533: /* expression ::= function_expression */ yytestcase(yyruleno==533); - case 534: /* expression ::= case_when_expression */ yytestcase(yyruleno==534); - case 568: /* function_expression ::= literal_func */ yytestcase(yyruleno==568); - case 618: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==618); - case 622: /* boolean_primary ::= predicate */ yytestcase(yyruleno==622); - case 624: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==624); - case 625: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==625); - case 628: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==628); - case 630: /* table_reference ::= table_primary */ yytestcase(yyruleno==630); - case 631: /* table_reference ::= joined_table */ yytestcase(yyruleno==631); - case 635: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==635); - case 720: /* query_simple ::= query_specification */ yytestcase(yyruleno==720); - case 721: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==721); - case 724: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==724); - case 726: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==726); -#line 1016 "sql.y" -{ yylhsminor.yy416 = yymsp[0].minor.yy416; } -#line 7812 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 496: /* literal ::= NULL */ -#line 1017 "sql.y" -{ yylhsminor.yy416 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } -#line 7818 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 497: /* literal ::= NK_QUESTION */ -#line 1018 "sql.y" -{ yylhsminor.yy416 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } -#line 7824 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 498: /* duration_literal ::= NK_VARIABLE */ - case 695: /* interval_sliding_duration_literal ::= NK_VARIABLE */ yytestcase(yyruleno==695); - case 696: /* interval_sliding_duration_literal ::= NK_STRING */ yytestcase(yyruleno==696); - case 697: /* interval_sliding_duration_literal ::= NK_INTEGER */ yytestcase(yyruleno==697); -#line 1020 "sql.y" -{ yylhsminor.yy416 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } -#line 7833 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 499: /* signed ::= NK_INTEGER */ -#line 1022 "sql.y" -{ yylhsminor.yy416 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } -#line 7839 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 500: /* signed ::= NK_PLUS NK_INTEGER */ -#line 1023 "sql.y" -{ yymsp[-1].minor.yy416 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } -#line 7845 "sql.c" - break; - case 501: /* signed ::= NK_MINUS NK_INTEGER */ -#line 1024 "sql.y" + yymsp[-2].minor.yy840 = yylhsminor.yy840; + break; + case 491: /* literal ::= NK_INTEGER */ +{ yylhsminor.yy840 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy840 = yylhsminor.yy840; + break; + case 492: /* literal ::= NK_FLOAT */ +{ yylhsminor.yy840 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy840 = yylhsminor.yy840; + break; + case 493: /* literal ::= NK_STRING */ +{ yylhsminor.yy840 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy840 = yylhsminor.yy840; + break; + case 494: /* literal ::= NK_BOOL */ +{ yylhsminor.yy840 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy840 = yylhsminor.yy840; + break; + case 495: /* literal ::= TIMESTAMP NK_STRING */ +{ yylhsminor.yy840 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } + yymsp[-1].minor.yy840 = yylhsminor.yy840; + break; + case 496: /* literal ::= duration_literal */ + case 506: /* signed_literal ::= signed */ yytestcase(yyruleno==506); + case 530: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==530); + case 531: /* expression ::= literal */ yytestcase(yyruleno==531); + case 533: /* expression ::= column_reference */ yytestcase(yyruleno==533); + case 534: /* expression ::= function_expression */ yytestcase(yyruleno==534); + case 535: /* expression ::= case_when_expression */ yytestcase(yyruleno==535); + case 577: /* function_expression ::= literal_func */ yytestcase(yyruleno==577); + case 634: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==634); + case 638: /* boolean_primary ::= predicate */ yytestcase(yyruleno==638); + case 640: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==640); + case 641: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==641); + case 644: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==644); + case 646: /* table_reference ::= table_primary */ yytestcase(yyruleno==646); + case 647: /* table_reference ::= joined_table */ yytestcase(yyruleno==647); + case 651: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==651); + case 736: /* query_simple ::= query_specification */ yytestcase(yyruleno==736); + case 737: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==737); + case 740: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==740); + case 742: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==742); +{ yylhsminor.yy840 = yymsp[0].minor.yy840; } + yymsp[0].minor.yy840 = yylhsminor.yy840; + break; + case 497: /* literal ::= NULL */ +{ yylhsminor.yy840 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy840 = yylhsminor.yy840; + break; + case 498: /* literal ::= NK_QUESTION */ +{ yylhsminor.yy840 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy840 = yylhsminor.yy840; + break; + case 499: /* duration_literal ::= NK_VARIABLE */ + case 711: /* interval_sliding_duration_literal ::= NK_VARIABLE */ yytestcase(yyruleno==711); + case 712: /* interval_sliding_duration_literal ::= NK_STRING */ yytestcase(yyruleno==712); + case 713: /* interval_sliding_duration_literal ::= NK_INTEGER */ yytestcase(yyruleno==713); +{ yylhsminor.yy840 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy840 = yylhsminor.yy840; + break; + case 500: /* signed ::= NK_INTEGER */ +{ yylhsminor.yy840 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy840 = yylhsminor.yy840; + break; + case 501: /* signed ::= NK_PLUS NK_INTEGER */ +{ yymsp[-1].minor.yy840 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } + break; + case 502: /* 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.yy416 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); + yylhsminor.yy840 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); } -#line 7854 "sql.c" - yymsp[-1].minor.yy416 = yylhsminor.yy416; - break; - case 502: /* signed ::= NK_FLOAT */ -#line 1029 "sql.y" -{ yylhsminor.yy416 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } -#line 7860 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 503: /* signed ::= NK_PLUS NK_FLOAT */ -#line 1030 "sql.y" -{ yymsp[-1].minor.yy416 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } -#line 7866 "sql.c" - break; - case 504: /* signed ::= NK_MINUS NK_FLOAT */ -#line 1031 "sql.y" + yymsp[-1].minor.yy840 = yylhsminor.yy840; + break; + case 503: /* signed ::= NK_FLOAT */ +{ yylhsminor.yy840 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy840 = yylhsminor.yy840; + break; + case 504: /* signed ::= NK_PLUS NK_FLOAT */ +{ yymsp[-1].minor.yy840 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + break; + case 505: /* 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.yy416 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); + yylhsminor.yy840 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); } -#line 7875 "sql.c" - yymsp[-1].minor.yy416 = yylhsminor.yy416; - break; - case 506: /* signed_literal ::= NK_STRING */ -#line 1038 "sql.y" -{ yylhsminor.yy416 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } -#line 7881 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 507: /* signed_literal ::= NK_BOOL */ -#line 1039 "sql.y" -{ yylhsminor.yy416 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } -#line 7887 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 508: /* signed_literal ::= TIMESTAMP NK_STRING */ -#line 1040 "sql.y" -{ yymsp[-1].minor.yy416 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } -#line 7893 "sql.c" - break; - case 509: /* signed_literal ::= duration_literal */ - case 511: /* signed_literal ::= literal_func */ yytestcase(yyruleno==511); - case 589: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==589); - case 672: /* select_item ::= common_expression */ yytestcase(yyruleno==672); - case 682: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==682); - case 725: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==725); - case 727: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==727); - case 740: /* search_condition ::= common_expression */ yytestcase(yyruleno==740); -#line 1041 "sql.y" -{ yylhsminor.yy416 = releaseRawExprNode(pCxt, yymsp[0].minor.yy416); } -#line 7905 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 510: /* signed_literal ::= NULL */ -#line 1042 "sql.y" -{ yylhsminor.yy416 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } -#line 7911 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 512: /* signed_literal ::= NK_QUESTION */ -#line 1044 "sql.y" -{ yylhsminor.yy416 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); } -#line 7917 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 531: /* expression ::= pseudo_column */ -#line 1110 "sql.y" -{ yylhsminor.yy416 = yymsp[0].minor.yy416; setRawExprNodeIsPseudoColumn(pCxt, yylhsminor.yy416, true); } -#line 7923 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 535: /* expression ::= NK_LP expression NK_RP */ - case 623: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==623); - case 739: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==739); -#line 1114 "sql.y" -{ yylhsminor.yy416 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy416)); } -#line 7931 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; - break; - case 536: /* expression ::= NK_PLUS expr_or_subquery */ -#line 1115 "sql.y" + yymsp[-1].minor.yy840 = yylhsminor.yy840; + break; + case 507: /* signed_literal ::= NK_STRING */ +{ yylhsminor.yy840 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy840 = yylhsminor.yy840; + break; + case 508: /* signed_literal ::= NK_BOOL */ +{ yylhsminor.yy840 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy840 = yylhsminor.yy840; + break; + case 509: /* signed_literal ::= TIMESTAMP NK_STRING */ +{ yymsp[-1].minor.yy840 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } + break; + case 510: /* signed_literal ::= duration_literal */ + case 512: /* signed_literal ::= literal_func */ yytestcase(yyruleno==512); + case 605: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==605); + case 688: /* select_item ::= common_expression */ yytestcase(yyruleno==688); + case 698: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==698); + case 741: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==741); + case 743: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==743); + case 756: /* search_condition ::= common_expression */ yytestcase(yyruleno==756); +{ yylhsminor.yy840 = releaseRawExprNode(pCxt, yymsp[0].minor.yy840); } + yymsp[0].minor.yy840 = yylhsminor.yy840; + break; + case 511: /* signed_literal ::= NULL */ +{ yylhsminor.yy840 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy840 = yylhsminor.yy840; + break; + case 513: /* signed_literal ::= NK_QUESTION */ +{ yylhsminor.yy840 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy840 = yylhsminor.yy840; + break; + case 532: /* expression ::= pseudo_column */ +{ yylhsminor.yy840 = yymsp[0].minor.yy840; (void)setRawExprNodeIsPseudoColumn(pCxt, yylhsminor.yy840, true); } + yymsp[0].minor.yy840 = yylhsminor.yy840; + break; + case 536: /* expression ::= NK_LP expression NK_RP */ + case 639: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==639); + case 755: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==755); +{ yylhsminor.yy840 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy840)); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; + break; + case 537: /* expression ::= NK_PLUS expr_or_subquery */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); - yylhsminor.yy416 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy416)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy840); + yylhsminor.yy840 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy840)); } -#line 7940 "sql.c" - yymsp[-1].minor.yy416 = yylhsminor.yy416; + yymsp[-1].minor.yy840 = yylhsminor.yy840; break; - case 537: /* expression ::= NK_MINUS expr_or_subquery */ -#line 1119 "sql.y" + case 538: /* expression ::= NK_MINUS expr_or_subquery */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); - yylhsminor.yy416 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy416), NULL)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy840); + yylhsminor.yy840 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy840), NULL)); } -#line 7949 "sql.c" - yymsp[-1].minor.yy416 = yylhsminor.yy416; + yymsp[-1].minor.yy840 = yylhsminor.yy840; break; - case 538: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ -#line 1123 "sql.y" + case 539: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy416); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); - yylhsminor.yy416 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), releaseRawExprNode(pCxt, yymsp[0].minor.yy416))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy840); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy840); + yylhsminor.yy840 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy840), releaseRawExprNode(pCxt, yymsp[0].minor.yy840))); } -#line 7959 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; - case 539: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ -#line 1128 "sql.y" + case 540: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy416); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); - yylhsminor.yy416 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), releaseRawExprNode(pCxt, yymsp[0].minor.yy416))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy840); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy840); + yylhsminor.yy840 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy840), releaseRawExprNode(pCxt, yymsp[0].minor.yy840))); } -#line 7969 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; - case 540: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */ -#line 1133 "sql.y" + case 541: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy416); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); - yylhsminor.yy416 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), releaseRawExprNode(pCxt, yymsp[0].minor.yy416))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy840); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy840); + yylhsminor.yy840 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy840), releaseRawExprNode(pCxt, yymsp[0].minor.yy840))); } -#line 7979 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; - case 541: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ -#line 1138 "sql.y" + case 542: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy416); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); - yylhsminor.yy416 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), releaseRawExprNode(pCxt, yymsp[0].minor.yy416))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy840); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy840); + yylhsminor.yy840 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy840), releaseRawExprNode(pCxt, yymsp[0].minor.yy840))); } -#line 7989 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; - case 542: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */ -#line 1143 "sql.y" + case 543: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy416); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); - yylhsminor.yy416 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), releaseRawExprNode(pCxt, yymsp[0].minor.yy416))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy840); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy840); + yylhsminor.yy840 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy840), releaseRawExprNode(pCxt, yymsp[0].minor.yy840))); } -#line 7999 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; - case 543: /* expression ::= column_reference NK_ARROW NK_STRING */ -#line 1148 "sql.y" + case 544: /* expression ::= column_reference NK_ARROW NK_STRING */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy416); - yylhsminor.yy416 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy840); + yylhsminor.yy840 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy840), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); } -#line 8008 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; - case 544: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ -#line 1152 "sql.y" + case 545: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy416); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); - yylhsminor.yy416 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), releaseRawExprNode(pCxt, yymsp[0].minor.yy416))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy840); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy840); + yylhsminor.yy840 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy840), releaseRawExprNode(pCxt, yymsp[0].minor.yy840))); } -#line 8018 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; - case 545: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ -#line 1157 "sql.y" + case 546: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy416); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); - yylhsminor.yy416 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), releaseRawExprNode(pCxt, yymsp[0].minor.yy416))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy840); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy840); + yylhsminor.yy840 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy840), releaseRawExprNode(pCxt, yymsp[0].minor.yy840))); } -#line 8028 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; - break; - case 548: /* column_reference ::= column_name */ -#line 1168 "sql.y" -{ yylhsminor.yy416 = createRawExprNode(pCxt, &yymsp[0].minor.yy1109, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy1109)); } -#line 8034 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 549: /* column_reference ::= table_name NK_DOT column_name */ -#line 1169 "sql.y" -{ yylhsminor.yy416 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy1109, &yymsp[0].minor.yy1109, createColumnNode(pCxt, &yymsp[-2].minor.yy1109, &yymsp[0].minor.yy1109)); } -#line 8040 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; - break; - case 550: /* column_reference ::= NK_ALIAS */ -#line 1170 "sql.y" -{ yylhsminor.yy416 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } -#line 8046 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 551: /* column_reference ::= table_name NK_DOT NK_ALIAS */ -#line 1171 "sql.y" -{ yylhsminor.yy416 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy1109, &yymsp[0].minor.yy0, createColumnNode(pCxt, &yymsp[-2].minor.yy1109, &yymsp[0].minor.yy0)); } -#line 8052 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; - break; - case 552: /* pseudo_column ::= ROWTS */ - case 553: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==553); - case 555: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==555); - case 556: /* pseudo_column ::= QEND */ yytestcase(yyruleno==556); - case 557: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==557); - case 558: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==558); - case 559: /* pseudo_column ::= WEND */ yytestcase(yyruleno==559); - case 560: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==560); - case 561: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==561); - case 562: /* pseudo_column ::= ISFILLED */ yytestcase(yyruleno==562); - case 563: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==563); - case 570: /* literal_func ::= NOW */ yytestcase(yyruleno==570); - case 571: /* literal_func ::= TODAY */ yytestcase(yyruleno==571); -#line 1173 "sql.y" -{ yylhsminor.yy416 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } -#line 8070 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 554: /* pseudo_column ::= table_name NK_DOT TBNAME */ -#line 1175 "sql.y" -{ yylhsminor.yy416 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy1109, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy1109)))); } -#line 8076 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; - break; - case 564: /* function_expression ::= function_name NK_LP expression_list NK_RP */ - case 565: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==565); -#line 1186 "sql.y" -{ yylhsminor.yy416 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy1109, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy1109, yymsp[-1].minor.yy316)); } -#line 8083 "sql.c" - yymsp[-3].minor.yy416 = yylhsminor.yy416; - break; - case 566: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ - case 567: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP */ yytestcase(yyruleno==567); -#line 1189 "sql.y" -{ yylhsminor.yy416 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy416), yymsp[-1].minor.yy952)); } -#line 8090 "sql.c" - yymsp[-5].minor.yy416 = yylhsminor.yy416; - break; - case 569: /* literal_func ::= noarg_func NK_LP NK_RP */ -#line 1195 "sql.y" -{ yylhsminor.yy416 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy1109, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy1109, NULL)); } -#line 8096 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; - break; - case 585: /* star_func_para_list ::= NK_STAR */ -#line 1220 "sql.y" -{ yylhsminor.yy316 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } -#line 8102 "sql.c" - yymsp[0].minor.yy316 = yylhsminor.yy316; - break; - case 590: /* star_func_para ::= table_name NK_DOT NK_STAR */ - case 675: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==675); -#line 1229 "sql.y" -{ yylhsminor.yy416 = createColumnNode(pCxt, &yymsp[-2].minor.yy1109, &yymsp[0].minor.yy0); } -#line 8109 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; - break; - case 591: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */ -#line 1232 "sql.y" -{ yylhsminor.yy416 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy316, yymsp[-1].minor.yy416)); } -#line 8115 "sql.c" - yymsp[-3].minor.yy416 = yylhsminor.yy416; - break; - case 592: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ -#line 1234 "sql.y" -{ yylhsminor.yy416 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy416), yymsp[-2].minor.yy316, yymsp[-1].minor.yy416)); } -#line 8121 "sql.c" - yymsp[-4].minor.yy416 = yylhsminor.yy416; - break; - case 595: /* when_then_expr ::= WHEN common_expression THEN common_expression */ -#line 1241 "sql.y" -{ yymsp[-3].minor.yy416 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), releaseRawExprNode(pCxt, yymsp[0].minor.yy416)); } -#line 8127 "sql.c" - break; - case 597: /* case_when_else_opt ::= ELSE common_expression */ -#line 1244 "sql.y" -{ yymsp[-1].minor.yy416 = releaseRawExprNode(pCxt, yymsp[0].minor.yy416); } -#line 8132 "sql.c" - break; - case 598: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */ - case 603: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==603); -#line 1247 "sql.y" + yymsp[-2].minor.yy840 = yylhsminor.yy840; + break; + case 549: /* column_reference ::= column_name */ +{ yylhsminor.yy840 = createRawExprNode(pCxt, &yymsp[0].minor.yy209, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy209)); } + yymsp[0].minor.yy840 = yylhsminor.yy840; + break; + case 550: /* column_reference ::= table_name NK_DOT column_name */ +{ yylhsminor.yy840 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy209, &yymsp[0].minor.yy209, createColumnNode(pCxt, &yymsp[-2].minor.yy209, &yymsp[0].minor.yy209)); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; + break; + case 551: /* column_reference ::= NK_ALIAS */ +{ yylhsminor.yy840 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy840 = yylhsminor.yy840; + break; + case 552: /* column_reference ::= table_name NK_DOT NK_ALIAS */ +{ yylhsminor.yy840 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy209, &yymsp[0].minor.yy0, createColumnNode(pCxt, &yymsp[-2].minor.yy209, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; + break; + case 553: /* pseudo_column ::= ROWTS */ + case 554: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==554); + case 556: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==556); + case 557: /* pseudo_column ::= QEND */ yytestcase(yyruleno==557); + case 558: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==558); + case 559: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==559); + case 560: /* pseudo_column ::= WEND */ yytestcase(yyruleno==560); + case 561: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==561); + case 562: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==562); + case 563: /* pseudo_column ::= ISFILLED */ yytestcase(yyruleno==563); + case 564: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==564); + case 579: /* literal_func ::= NOW */ yytestcase(yyruleno==579); + case 580: /* literal_func ::= TODAY */ yytestcase(yyruleno==580); +{ yylhsminor.yy840 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } + yymsp[0].minor.yy840 = yylhsminor.yy840; + break; + case 555: /* pseudo_column ::= table_name NK_DOT TBNAME */ +{ yylhsminor.yy840 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy209, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy209)))); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; + break; + case 565: /* function_expression ::= function_name NK_LP expression_list NK_RP */ + case 566: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==566); + case 573: /* function_expression ::= substr_func NK_LP expression_list NK_RP */ yytestcase(yyruleno==573); +{ yylhsminor.yy840 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy209, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy209, yymsp[-1].minor.yy456)); } + yymsp[-3].minor.yy840 = yylhsminor.yy840; + break; + case 567: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ + case 568: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP */ yytestcase(yyruleno==568); +{ yylhsminor.yy840 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy840), yymsp[-1].minor.yy48)); } + yymsp[-5].minor.yy840 = yylhsminor.yy840; + break; + case 569: /* function_expression ::= POSITION NK_LP expr_or_subquery IN expr_or_subquery NK_RP */ +{ yylhsminor.yy840 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createPositionFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy840), releaseRawExprNode(pCxt, yymsp[-1].minor.yy840))); } + yymsp[-5].minor.yy840 = yylhsminor.yy840; + break; + case 570: /* function_expression ::= TRIM NK_LP expr_or_subquery NK_RP */ +{ yylhsminor.yy840 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createTrimFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy840), TRIM_TYPE_BOTH)); } + yymsp[-3].minor.yy840 = yylhsminor.yy840; + break; + case 571: /* function_expression ::= TRIM NK_LP trim_specification_type FROM expr_or_subquery NK_RP */ +{ yylhsminor.yy840 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createTrimFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy840), yymsp[-3].minor.yy512)); } + yymsp[-5].minor.yy840 = yylhsminor.yy840; + break; + case 572: /* function_expression ::= TRIM NK_LP trim_specification_type expr_or_subquery FROM expr_or_subquery NK_RP */ +{ yylhsminor.yy840 = createRawExprNodeExt(pCxt, &yymsp[-6].minor.yy0, &yymsp[0].minor.yy0, createTrimFunctionNodeExt(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy840), releaseRawExprNode(pCxt, yymsp[-1].minor.yy840), yymsp[-4].minor.yy512)); } + yymsp[-6].minor.yy840 = yylhsminor.yy840; + break; + case 574: /* function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery NK_RP */ +{ yylhsminor.yy840 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy209, &yymsp[0].minor.yy0, createSubstrFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy840), releaseRawExprNode(pCxt, yymsp[-1].minor.yy840))); } + yymsp[-5].minor.yy840 = yylhsminor.yy840; + break; + case 575: /* function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery FOR expr_or_subquery NK_RP */ +{ yylhsminor.yy840 = createRawExprNodeExt(pCxt, &yymsp[-7].minor.yy209, &yymsp[0].minor.yy0, createSubstrFunctionNodeExt(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy840), releaseRawExprNode(pCxt, yymsp[-3].minor.yy840), releaseRawExprNode(pCxt, yymsp[-1].minor.yy840))); } + yymsp[-7].minor.yy840 = yylhsminor.yy840; + break; + case 576: /* function_expression ::= REPLACE NK_LP expression_list NK_RP */ +{ yylhsminor.yy840 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy456)); } + yymsp[-3].minor.yy840 = yylhsminor.yy840; + break; + case 578: /* literal_func ::= noarg_func NK_LP NK_RP */ +{ yylhsminor.yy840 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy209, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy209, NULL)); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; + break; + case 583: /* trim_specification_type ::= */ +{ yymsp[1].minor.yy512 = TRIM_TYPE_BOTH; } + break; + case 584: /* trim_specification_type ::= BOTH */ +{ yymsp[0].minor.yy512 = TRIM_TYPE_BOTH; } + break; + case 585: /* trim_specification_type ::= TRAILING */ +{ yymsp[0].minor.yy512 = TRIM_TYPE_TRAILING; } + break; + case 586: /* trim_specification_type ::= LEADING */ +{ yymsp[0].minor.yy512 = TRIM_TYPE_LEADING; } + break; + case 601: /* star_func_para_list ::= NK_STAR */ +{ yylhsminor.yy456 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy456 = yylhsminor.yy456; + break; + case 606: /* star_func_para ::= table_name NK_DOT NK_STAR */ + case 691: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==691); +{ yylhsminor.yy840 = createColumnNode(pCxt, &yymsp[-2].minor.yy209, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; + break; + case 607: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */ +{ yylhsminor.yy840 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy456, yymsp[-1].minor.yy840)); } + yymsp[-3].minor.yy840 = yylhsminor.yy840; + break; + case 608: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ +{ yylhsminor.yy840 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy840), yymsp[-2].minor.yy456, yymsp[-1].minor.yy840)); } + yymsp[-4].minor.yy840 = yylhsminor.yy840; + break; + case 611: /* when_then_expr ::= WHEN common_expression THEN common_expression */ +{ yymsp[-3].minor.yy840 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy840), releaseRawExprNode(pCxt, yymsp[0].minor.yy840)); } + break; + case 613: /* case_when_else_opt ::= ELSE common_expression */ +{ yymsp[-1].minor.yy840 = releaseRawExprNode(pCxt, yymsp[0].minor.yy840); } + break; + case 614: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */ + case 619: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==619); { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy416); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); - yylhsminor.yy416 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy848, releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), releaseRawExprNode(pCxt, yymsp[0].minor.yy416))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy840); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy840); + yylhsminor.yy840 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy108, releaseRawExprNode(pCxt, yymsp[-2].minor.yy840), releaseRawExprNode(pCxt, yymsp[0].minor.yy840))); } -#line 8142 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; - case 599: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ -#line 1254 "sql.y" + case 615: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy416); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); - yylhsminor.yy416 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy416), releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), releaseRawExprNode(pCxt, yymsp[0].minor.yy416))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy840); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy840); + yylhsminor.yy840 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy840), releaseRawExprNode(pCxt, yymsp[-2].minor.yy840), releaseRawExprNode(pCxt, yymsp[0].minor.yy840))); } -#line 8152 "sql.c" - yymsp[-4].minor.yy416 = yylhsminor.yy416; + yymsp[-4].minor.yy840 = yylhsminor.yy840; break; - case 600: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ -#line 1260 "sql.y" + case 616: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy416); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); - yylhsminor.yy416 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy416), releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), releaseRawExprNode(pCxt, yymsp[0].minor.yy416))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy840); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy840); + yylhsminor.yy840 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy840), releaseRawExprNode(pCxt, yymsp[-2].minor.yy840), releaseRawExprNode(pCxt, yymsp[0].minor.yy840))); } -#line 8162 "sql.c" - yymsp[-5].minor.yy416 = yylhsminor.yy416; + yymsp[-5].minor.yy840 = yylhsminor.yy840; break; - case 601: /* predicate ::= expr_or_subquery IS NULL */ -#line 1265 "sql.y" + case 617: /* predicate ::= expr_or_subquery IS NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy416); - yylhsminor.yy416 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy840); + yylhsminor.yy840 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy840), NULL)); } -#line 8171 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; - case 602: /* predicate ::= expr_or_subquery IS NOT NULL */ -#line 1269 "sql.y" + case 618: /* predicate ::= expr_or_subquery IS NOT NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy416); - yylhsminor.yy416 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy416), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy840); + yylhsminor.yy840 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy840), NULL)); } -#line 8180 "sql.c" - yymsp[-3].minor.yy416 = yylhsminor.yy416; - break; - case 604: /* compare_op ::= NK_LT */ -#line 1281 "sql.y" -{ yymsp[0].minor.yy848 = OP_TYPE_LOWER_THAN; } -#line 8186 "sql.c" - break; - case 605: /* compare_op ::= NK_GT */ -#line 1282 "sql.y" -{ yymsp[0].minor.yy848 = OP_TYPE_GREATER_THAN; } -#line 8191 "sql.c" - break; - case 606: /* compare_op ::= NK_LE */ -#line 1283 "sql.y" -{ yymsp[0].minor.yy848 = OP_TYPE_LOWER_EQUAL; } -#line 8196 "sql.c" - break; - case 607: /* compare_op ::= NK_GE */ -#line 1284 "sql.y" -{ yymsp[0].minor.yy848 = OP_TYPE_GREATER_EQUAL; } -#line 8201 "sql.c" - break; - case 608: /* compare_op ::= NK_NE */ -#line 1285 "sql.y" -{ yymsp[0].minor.yy848 = OP_TYPE_NOT_EQUAL; } -#line 8206 "sql.c" - break; - case 609: /* compare_op ::= NK_EQ */ -#line 1286 "sql.y" -{ yymsp[0].minor.yy848 = OP_TYPE_EQUAL; } -#line 8211 "sql.c" - break; - case 610: /* compare_op ::= LIKE */ -#line 1287 "sql.y" -{ yymsp[0].minor.yy848 = OP_TYPE_LIKE; } -#line 8216 "sql.c" - break; - case 611: /* compare_op ::= NOT LIKE */ -#line 1288 "sql.y" -{ yymsp[-1].minor.yy848 = OP_TYPE_NOT_LIKE; } -#line 8221 "sql.c" - break; - case 612: /* compare_op ::= MATCH */ -#line 1289 "sql.y" -{ yymsp[0].minor.yy848 = OP_TYPE_MATCH; } -#line 8226 "sql.c" - break; - case 613: /* compare_op ::= NMATCH */ -#line 1290 "sql.y" -{ yymsp[0].minor.yy848 = OP_TYPE_NMATCH; } -#line 8231 "sql.c" - break; - case 614: /* compare_op ::= CONTAINS */ -#line 1291 "sql.y" -{ yymsp[0].minor.yy848 = OP_TYPE_JSON_CONTAINS; } -#line 8236 "sql.c" - break; - case 615: /* in_op ::= IN */ -#line 1295 "sql.y" -{ yymsp[0].minor.yy848 = OP_TYPE_IN; } -#line 8241 "sql.c" - break; - case 616: /* in_op ::= NOT IN */ -#line 1296 "sql.y" -{ yymsp[-1].minor.yy848 = OP_TYPE_NOT_IN; } -#line 8246 "sql.c" - break; - case 617: /* in_predicate_value ::= NK_LP literal_list NK_RP */ -#line 1298 "sql.y" -{ yylhsminor.yy416 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy316)); } -#line 8251 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; - break; - case 619: /* boolean_value_expression ::= NOT boolean_primary */ -#line 1302 "sql.y" + yymsp[-3].minor.yy840 = yylhsminor.yy840; + break; + case 620: /* compare_op ::= NK_LT */ +{ yymsp[0].minor.yy108 = OP_TYPE_LOWER_THAN; } + break; + case 621: /* compare_op ::= NK_GT */ +{ yymsp[0].minor.yy108 = OP_TYPE_GREATER_THAN; } + break; + case 622: /* compare_op ::= NK_LE */ +{ yymsp[0].minor.yy108 = OP_TYPE_LOWER_EQUAL; } + break; + case 623: /* compare_op ::= NK_GE */ +{ yymsp[0].minor.yy108 = OP_TYPE_GREATER_EQUAL; } + break; + case 624: /* compare_op ::= NK_NE */ +{ yymsp[0].minor.yy108 = OP_TYPE_NOT_EQUAL; } + break; + case 625: /* compare_op ::= NK_EQ */ +{ yymsp[0].minor.yy108 = OP_TYPE_EQUAL; } + break; + case 626: /* compare_op ::= LIKE */ +{ yymsp[0].minor.yy108 = OP_TYPE_LIKE; } + break; + case 627: /* compare_op ::= NOT LIKE */ +{ yymsp[-1].minor.yy108 = OP_TYPE_NOT_LIKE; } + break; + case 628: /* compare_op ::= MATCH */ +{ yymsp[0].minor.yy108 = OP_TYPE_MATCH; } + break; + case 629: /* compare_op ::= NMATCH */ +{ yymsp[0].minor.yy108 = OP_TYPE_NMATCH; } + break; + case 630: /* compare_op ::= CONTAINS */ +{ yymsp[0].minor.yy108 = OP_TYPE_JSON_CONTAINS; } + break; + case 631: /* in_op ::= IN */ +{ yymsp[0].minor.yy108 = OP_TYPE_IN; } + break; + case 632: /* in_op ::= NOT IN */ +{ yymsp[-1].minor.yy108 = OP_TYPE_NOT_IN; } + break; + case 633: /* in_predicate_value ::= NK_LP literal_list NK_RP */ +{ yylhsminor.yy840 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy456)); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; + break; + case 635: /* boolean_value_expression ::= NOT boolean_primary */ { - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); - yylhsminor.yy416 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy416), NULL)); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy840); + yylhsminor.yy840 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy840), NULL)); } -#line 8260 "sql.c" - yymsp[-1].minor.yy416 = yylhsminor.yy416; + yymsp[-1].minor.yy840 = yylhsminor.yy840; break; - case 620: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ -#line 1307 "sql.y" + case 636: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy416); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); - yylhsminor.yy416 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), releaseRawExprNode(pCxt, yymsp[0].minor.yy416))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy840); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy840); + yylhsminor.yy840 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy840), releaseRawExprNode(pCxt, yymsp[0].minor.yy840))); } -#line 8270 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; - case 621: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ -#line 1313 "sql.y" + case 637: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy416); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); - yylhsminor.yy416 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), releaseRawExprNode(pCxt, yymsp[0].minor.yy416))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy840); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy840); + yylhsminor.yy840 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy840), releaseRawExprNode(pCxt, yymsp[0].minor.yy840))); } -#line 8280 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; - break; - case 629: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ -#line 1331 "sql.y" -{ yylhsminor.yy416 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, JOIN_STYPE_NONE, yymsp[-2].minor.yy416, yymsp[0].minor.yy416, NULL); } -#line 8286 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; - break; - case 632: /* table_primary ::= table_name alias_opt */ -#line 1337 "sql.y" -{ yylhsminor.yy416 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy1109, &yymsp[0].minor.yy1109); } -#line 8292 "sql.c" - yymsp[-1].minor.yy416 = yylhsminor.yy416; - break; - case 633: /* table_primary ::= db_name NK_DOT table_name alias_opt */ -#line 1338 "sql.y" -{ yylhsminor.yy416 = createRealTableNode(pCxt, &yymsp[-3].minor.yy1109, &yymsp[-1].minor.yy1109, &yymsp[0].minor.yy1109); } -#line 8298 "sql.c" - yymsp[-3].minor.yy416 = yylhsminor.yy416; - break; - case 634: /* table_primary ::= subquery alias_opt */ -#line 1339 "sql.y" -{ yylhsminor.yy416 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy416), &yymsp[0].minor.yy1109); } -#line 8304 "sql.c" - yymsp[-1].minor.yy416 = yylhsminor.yy416; - break; - case 636: /* alias_opt ::= */ -#line 1344 "sql.y" -{ yymsp[1].minor.yy1109 = nil_token; } -#line 8310 "sql.c" - break; - case 638: /* alias_opt ::= AS table_alias */ -#line 1346 "sql.y" -{ yymsp[-1].minor.yy1109 = yymsp[0].minor.yy1109; } -#line 8315 "sql.c" - break; - case 639: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - case 640: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==640); -#line 1348 "sql.y" -{ yymsp[-2].minor.yy416 = yymsp[-1].minor.yy416; } -#line 8321 "sql.c" - break; - case 641: /* joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt */ -#line 1354 "sql.y" + yymsp[-2].minor.yy840 = yylhsminor.yy840; + break; + case 645: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ +{ yylhsminor.yy840 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, JOIN_STYPE_NONE, yymsp[-2].minor.yy840, yymsp[0].minor.yy840, NULL); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; + break; + case 648: /* table_primary ::= table_name alias_opt */ +{ yylhsminor.yy840 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy209, &yymsp[0].minor.yy209); } + yymsp[-1].minor.yy840 = yylhsminor.yy840; + break; + case 649: /* table_primary ::= db_name NK_DOT table_name alias_opt */ +{ yylhsminor.yy840 = createRealTableNode(pCxt, &yymsp[-3].minor.yy209, &yymsp[-1].minor.yy209, &yymsp[0].minor.yy209); } + yymsp[-3].minor.yy840 = yylhsminor.yy840; + break; + case 650: /* table_primary ::= subquery alias_opt */ +{ yylhsminor.yy840 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy840), &yymsp[0].minor.yy209); } + yymsp[-1].minor.yy840 = yylhsminor.yy840; + break; + case 652: /* alias_opt ::= */ +{ yymsp[1].minor.yy209 = nil_token; } + break; + case 654: /* alias_opt ::= AS table_alias */ +{ yymsp[-1].minor.yy209 = yymsp[0].minor.yy209; } + break; + case 655: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + case 656: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==656); +{ yymsp[-2].minor.yy840 = yymsp[-1].minor.yy840; } + break; + case 657: /* joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt */ { - yylhsminor.yy416 = createJoinTableNode(pCxt, yymsp[-6].minor.yy972, yymsp[-5].minor.yy630, yymsp[-7].minor.yy416, yymsp[-3].minor.yy416, yymsp[-2].minor.yy416); - yylhsminor.yy416 = addWindowOffsetClause(pCxt, yylhsminor.yy416, yymsp[-1].minor.yy416); - yylhsminor.yy416 = addJLimitClause(pCxt, yylhsminor.yy416, yymsp[0].minor.yy416); + yylhsminor.yy840 = createJoinTableNode(pCxt, yymsp[-6].minor.yy724, yymsp[-5].minor.yy278, yymsp[-7].minor.yy840, yymsp[-3].minor.yy840, yymsp[-2].minor.yy840); + yylhsminor.yy840 = addWindowOffsetClause(pCxt, yylhsminor.yy840, yymsp[-1].minor.yy840); + yylhsminor.yy840 = addJLimitClause(pCxt, yylhsminor.yy840, yymsp[0].minor.yy840); } -#line 8330 "sql.c" - yymsp[-7].minor.yy416 = yylhsminor.yy416; - break; - case 642: /* join_type ::= */ -#line 1362 "sql.y" -{ yymsp[1].minor.yy972 = JOIN_TYPE_INNER; } -#line 8336 "sql.c" - break; - case 643: /* join_type ::= INNER */ -#line 1363 "sql.y" -{ yymsp[0].minor.yy972 = JOIN_TYPE_INNER; } -#line 8341 "sql.c" - break; - case 644: /* join_type ::= LEFT */ -#line 1364 "sql.y" -{ yymsp[0].minor.yy972 = JOIN_TYPE_LEFT; } -#line 8346 "sql.c" - break; - case 645: /* join_type ::= RIGHT */ -#line 1365 "sql.y" -{ yymsp[0].minor.yy972 = JOIN_TYPE_RIGHT; } -#line 8351 "sql.c" - break; - case 646: /* join_type ::= FULL */ -#line 1366 "sql.y" -{ yymsp[0].minor.yy972 = JOIN_TYPE_FULL; } -#line 8356 "sql.c" - break; - case 647: /* join_subtype ::= */ -#line 1370 "sql.y" -{ yymsp[1].minor.yy630 = JOIN_STYPE_NONE; } -#line 8361 "sql.c" - break; - case 648: /* join_subtype ::= OUTER */ -#line 1371 "sql.y" -{ yymsp[0].minor.yy630 = JOIN_STYPE_OUTER; } -#line 8366 "sql.c" - break; - case 649: /* join_subtype ::= SEMI */ -#line 1372 "sql.y" -{ yymsp[0].minor.yy630 = JOIN_STYPE_SEMI; } -#line 8371 "sql.c" - break; - case 650: /* join_subtype ::= ANTI */ -#line 1373 "sql.y" -{ yymsp[0].minor.yy630 = JOIN_STYPE_ANTI; } -#line 8376 "sql.c" - break; - case 651: /* join_subtype ::= ASOF */ -#line 1374 "sql.y" -{ yymsp[0].minor.yy630 = JOIN_STYPE_ASOF; } -#line 8381 "sql.c" - break; - case 652: /* join_subtype ::= WINDOW */ -#line 1375 "sql.y" -{ yymsp[0].minor.yy630 = JOIN_STYPE_WIN; } -#line 8386 "sql.c" - break; - case 656: /* window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP */ -#line 1382 "sql.y" -{ yymsp[-5].minor.yy416 = createWindowOffsetNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy416), releaseRawExprNode(pCxt, yymsp[-1].minor.yy416)); } -#line 8391 "sql.c" - break; - case 657: /* window_offset_literal ::= NK_VARIABLE */ -#line 1384 "sql.y" -{ yylhsminor.yy416 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createTimeOffsetValueNode(pCxt, &yymsp[0].minor.yy0)); } -#line 8396 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 658: /* window_offset_literal ::= NK_MINUS NK_VARIABLE */ -#line 1385 "sql.y" + yymsp[-7].minor.yy840 = yylhsminor.yy840; + break; + case 658: /* join_type ::= */ +{ yymsp[1].minor.yy724 = JOIN_TYPE_INNER; } + break; + case 659: /* join_type ::= INNER */ +{ yymsp[0].minor.yy724 = JOIN_TYPE_INNER; } + break; + case 660: /* join_type ::= LEFT */ +{ yymsp[0].minor.yy724 = JOIN_TYPE_LEFT; } + break; + case 661: /* join_type ::= RIGHT */ +{ yymsp[0].minor.yy724 = JOIN_TYPE_RIGHT; } + break; + case 662: /* join_type ::= FULL */ +{ yymsp[0].minor.yy724 = JOIN_TYPE_FULL; } + break; + case 663: /* join_subtype ::= */ +{ yymsp[1].minor.yy278 = JOIN_STYPE_NONE; } + break; + case 664: /* join_subtype ::= OUTER */ +{ yymsp[0].minor.yy278 = JOIN_STYPE_OUTER; } + break; + case 665: /* join_subtype ::= SEMI */ +{ yymsp[0].minor.yy278 = JOIN_STYPE_SEMI; } + break; + case 666: /* join_subtype ::= ANTI */ +{ yymsp[0].minor.yy278 = JOIN_STYPE_ANTI; } + break; + case 667: /* join_subtype ::= ASOF */ +{ yymsp[0].minor.yy278 = JOIN_STYPE_ASOF; } + break; + case 668: /* join_subtype ::= WINDOW */ +{ yymsp[0].minor.yy278 = JOIN_STYPE_WIN; } + break; + case 672: /* window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP */ +{ yymsp[-5].minor.yy840 = createWindowOffsetNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy840), releaseRawExprNode(pCxt, yymsp[-1].minor.yy840)); } + break; + case 673: /* window_offset_literal ::= NK_VARIABLE */ +{ yylhsminor.yy840 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createTimeOffsetValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy840 = yylhsminor.yy840; + break; + case 674: /* window_offset_literal ::= NK_MINUS NK_VARIABLE */ { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy416 = createRawExprNode(pCxt, &t, createTimeOffsetValueNode(pCxt, &t)); + yylhsminor.yy840 = createRawExprNode(pCxt, &t, createTimeOffsetValueNode(pCxt, &t)); } -#line 8406 "sql.c" - yymsp[-1].minor.yy416 = yylhsminor.yy416; - break; - case 660: /* jlimit_clause_opt ::= JLIMIT NK_INTEGER */ - case 731: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ yytestcase(yyruleno==731); - case 735: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==735); -#line 1392 "sql.y" -{ yymsp[-1].minor.yy416 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } -#line 8414 "sql.c" - break; - case 661: /* query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_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 */ -#line 1398 "sql.y" + yymsp[-1].minor.yy840 = yylhsminor.yy840; + break; + case 676: /* jlimit_clause_opt ::= JLIMIT NK_INTEGER */ + case 747: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ yytestcase(yyruleno==747); + case 751: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==751); +{ yymsp[-1].minor.yy840 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } + break; + case 677: /* query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_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[-13].minor.yy416 = createSelectStmt(pCxt, yymsp[-11].minor.yy209, yymsp[-9].minor.yy316, yymsp[-8].minor.yy416, yymsp[-12].minor.yy316); - yymsp[-13].minor.yy416 = setSelectStmtTagMode(pCxt, yymsp[-13].minor.yy416, yymsp[-10].minor.yy209); - yymsp[-13].minor.yy416 = addWhereClause(pCxt, yymsp[-13].minor.yy416, yymsp[-7].minor.yy416); - yymsp[-13].minor.yy416 = addPartitionByClause(pCxt, yymsp[-13].minor.yy416, yymsp[-6].minor.yy316); - yymsp[-13].minor.yy416 = addWindowClauseClause(pCxt, yymsp[-13].minor.yy416, yymsp[-2].minor.yy416); - yymsp[-13].minor.yy416 = addGroupByClause(pCxt, yymsp[-13].minor.yy416, yymsp[-1].minor.yy316); - yymsp[-13].minor.yy416 = addHavingClause(pCxt, yymsp[-13].minor.yy416, yymsp[0].minor.yy416); - yymsp[-13].minor.yy416 = addRangeClause(pCxt, yymsp[-13].minor.yy416, yymsp[-5].minor.yy416); - yymsp[-13].minor.yy416 = addEveryClause(pCxt, yymsp[-13].minor.yy416, yymsp[-4].minor.yy416); - yymsp[-13].minor.yy416 = addFillClause(pCxt, yymsp[-13].minor.yy416, yymsp[-3].minor.yy416); + yymsp[-13].minor.yy840 = createSelectStmt(pCxt, yymsp[-11].minor.yy9, yymsp[-9].minor.yy456, yymsp[-8].minor.yy840, yymsp[-12].minor.yy456); + yymsp[-13].minor.yy840 = setSelectStmtTagMode(pCxt, yymsp[-13].minor.yy840, yymsp[-10].minor.yy9); + yymsp[-13].minor.yy840 = addWhereClause(pCxt, yymsp[-13].minor.yy840, yymsp[-7].minor.yy840); + yymsp[-13].minor.yy840 = addPartitionByClause(pCxt, yymsp[-13].minor.yy840, yymsp[-6].minor.yy456); + yymsp[-13].minor.yy840 = addWindowClauseClause(pCxt, yymsp[-13].minor.yy840, yymsp[-2].minor.yy840); + yymsp[-13].minor.yy840 = addGroupByClause(pCxt, yymsp[-13].minor.yy840, yymsp[-1].minor.yy456); + yymsp[-13].minor.yy840 = addHavingClause(pCxt, yymsp[-13].minor.yy840, yymsp[0].minor.yy840); + yymsp[-13].minor.yy840 = addRangeClause(pCxt, yymsp[-13].minor.yy840, yymsp[-5].minor.yy840); + yymsp[-13].minor.yy840 = addEveryClause(pCxt, yymsp[-13].minor.yy840, yymsp[-4].minor.yy840); + yymsp[-13].minor.yy840 = addFillClause(pCxt, yymsp[-13].minor.yy840, yymsp[-3].minor.yy840); } -#line 8430 "sql.c" - break; - case 662: /* hint_list ::= */ -#line 1413 "sql.y" -{ yymsp[1].minor.yy316 = createHintNodeList(pCxt, NULL); } -#line 8435 "sql.c" - break; - case 663: /* hint_list ::= NK_HINT */ -#line 1414 "sql.y" -{ yylhsminor.yy316 = createHintNodeList(pCxt, &yymsp[0].minor.yy0); } -#line 8440 "sql.c" - yymsp[0].minor.yy316 = yylhsminor.yy316; - break; - case 668: /* set_quantifier_opt ::= ALL */ -#line 1425 "sql.y" -{ yymsp[0].minor.yy209 = false; } -#line 8446 "sql.c" - break; - case 671: /* select_item ::= NK_STAR */ -#line 1432 "sql.y" -{ yylhsminor.yy416 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } -#line 8451 "sql.c" - yymsp[0].minor.yy416 = yylhsminor.yy416; - break; - case 673: /* select_item ::= common_expression column_alias */ - case 683: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==683); -#line 1434 "sql.y" -{ yylhsminor.yy416 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy416), &yymsp[0].minor.yy1109); } -#line 8458 "sql.c" - yymsp[-1].minor.yy416 = yylhsminor.yy416; - break; - case 674: /* select_item ::= common_expression AS column_alias */ - case 684: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==684); -#line 1435 "sql.y" -{ yylhsminor.yy416 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), &yymsp[0].minor.yy1109); } -#line 8465 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; - break; - case 679: /* partition_by_clause_opt ::= PARTITION BY partition_list */ - case 709: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==709); - case 729: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==729); -#line 1444 "sql.y" -{ yymsp[-2].minor.yy316 = yymsp[0].minor.yy316; } -#line 8473 "sql.c" - break; - case 686: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ -#line 1457 "sql.y" -{ yymsp[-5].minor.yy416 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy416), releaseRawExprNode(pCxt, yymsp[-1].minor.yy416)); } -#line 8478 "sql.c" - break; - case 687: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ -#line 1458 "sql.y" -{ yymsp[-3].minor.yy416 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy416)); } -#line 8483 "sql.c" - break; - case 688: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ -#line 1460 "sql.y" -{ yymsp[-5].minor.yy416 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy416), NULL, yymsp[-1].minor.yy416, yymsp[0].minor.yy416); } -#line 8488 "sql.c" - break; - case 689: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ -#line 1464 "sql.y" -{ yymsp[-7].minor.yy416 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy416), releaseRawExprNode(pCxt, yymsp[-3].minor.yy416), yymsp[-1].minor.yy416, yymsp[0].minor.yy416); } -#line 8493 "sql.c" - break; - case 690: /* twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ -#line 1466 "sql.y" -{ yymsp[-6].minor.yy416 = createEventWindowNode(pCxt, yymsp[-3].minor.yy416, yymsp[0].minor.yy416); } -#line 8498 "sql.c" - break; - case 691: /* twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */ -#line 1468 "sql.y" -{ yymsp[-3].minor.yy416 = createCountWindowNode(pCxt, &yymsp[-1].minor.yy0, &yymsp[-1].minor.yy0); } -#line 8503 "sql.c" - break; - case 692: /* twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ -#line 1470 "sql.y" -{ yymsp[-5].minor.yy416 = createCountWindowNode(pCxt, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0); } -#line 8508 "sql.c" - break; - case 699: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ -#line 1480 "sql.y" -{ yymsp[-3].minor.yy416 = createFillNode(pCxt, yymsp[-1].minor.yy882, NULL); } -#line 8513 "sql.c" - break; - case 700: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ -#line 1481 "sql.y" -{ yymsp[-5].minor.yy416 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy316)); } -#line 8518 "sql.c" - break; - case 701: /* fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ -#line 1482 "sql.y" -{ yymsp[-5].minor.yy416 = createFillNode(pCxt, FILL_MODE_VALUE_F, createNodeListNode(pCxt, yymsp[-1].minor.yy316)); } -#line 8523 "sql.c" - break; - case 702: /* fill_mode ::= NONE */ -#line 1486 "sql.y" -{ yymsp[0].minor.yy882 = FILL_MODE_NONE; } -#line 8528 "sql.c" - break; - case 703: /* fill_mode ::= PREV */ -#line 1487 "sql.y" -{ yymsp[0].minor.yy882 = FILL_MODE_PREV; } -#line 8533 "sql.c" - break; - case 704: /* fill_mode ::= NULL */ -#line 1488 "sql.y" -{ yymsp[0].minor.yy882 = FILL_MODE_NULL; } -#line 8538 "sql.c" - break; - case 705: /* fill_mode ::= NULL_F */ -#line 1489 "sql.y" -{ yymsp[0].minor.yy882 = FILL_MODE_NULL_F; } -#line 8543 "sql.c" - break; - case 706: /* fill_mode ::= LINEAR */ -#line 1490 "sql.y" -{ yymsp[0].minor.yy882 = FILL_MODE_LINEAR; } -#line 8548 "sql.c" - break; - case 707: /* fill_mode ::= NEXT */ -#line 1491 "sql.y" -{ yymsp[0].minor.yy882 = FILL_MODE_NEXT; } -#line 8553 "sql.c" - break; - case 710: /* group_by_list ::= expr_or_subquery */ -#line 1500 "sql.y" -{ yylhsminor.yy316 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy416))); } -#line 8558 "sql.c" - yymsp[0].minor.yy316 = yylhsminor.yy316; - break; - case 711: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ -#line 1501 "sql.y" -{ yylhsminor.yy316 = addNodeToList(pCxt, yymsp[-2].minor.yy316, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy416))); } -#line 8564 "sql.c" - yymsp[-2].minor.yy316 = yylhsminor.yy316; - break; - case 715: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ -#line 1508 "sql.y" -{ yymsp[-5].minor.yy416 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy416), releaseRawExprNode(pCxt, yymsp[-1].minor.yy416)); } -#line 8570 "sql.c" - break; - case 716: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ -#line 1510 "sql.y" -{ yymsp[-3].minor.yy416 = createInterpTimePoint(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy416)); } -#line 8575 "sql.c" - break; - case 719: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ -#line 1517 "sql.y" + break; + case 678: /* hint_list ::= */ +{ yymsp[1].minor.yy456 = createHintNodeList(pCxt, NULL); } + break; + case 679: /* hint_list ::= NK_HINT */ +{ yylhsminor.yy456 = createHintNodeList(pCxt, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy456 = yylhsminor.yy456; + break; + case 684: /* set_quantifier_opt ::= ALL */ +{ yymsp[0].minor.yy9 = false; } + break; + case 687: /* select_item ::= NK_STAR */ +{ yylhsminor.yy840 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy840 = yylhsminor.yy840; + break; + case 689: /* select_item ::= common_expression column_alias */ + case 699: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==699); +{ yylhsminor.yy840 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy840), &yymsp[0].minor.yy209); } + yymsp[-1].minor.yy840 = yylhsminor.yy840; + break; + case 690: /* select_item ::= common_expression AS column_alias */ + case 700: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==700); +{ yylhsminor.yy840 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy840), &yymsp[0].minor.yy209); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; + break; + case 695: /* partition_by_clause_opt ::= PARTITION BY partition_list */ + case 725: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==725); + case 745: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==745); +{ yymsp[-2].minor.yy456 = yymsp[0].minor.yy456; } + break; + case 702: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ +{ yymsp[-5].minor.yy840 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy840), releaseRawExprNode(pCxt, yymsp[-1].minor.yy840)); } + break; + case 703: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ +{ yymsp[-3].minor.yy840 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy840)); } + break; + case 704: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-5].minor.yy840 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy840), NULL, yymsp[-1].minor.yy840, yymsp[0].minor.yy840); } + break; + case 705: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-7].minor.yy840 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy840), releaseRawExprNode(pCxt, yymsp[-3].minor.yy840), yymsp[-1].minor.yy840, yymsp[0].minor.yy840); } + break; + case 706: /* twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ +{ yymsp[-6].minor.yy840 = createEventWindowNode(pCxt, yymsp[-3].minor.yy840, yymsp[0].minor.yy840); } + break; + case 707: /* twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy840 = createCountWindowNode(pCxt, &yymsp[-1].minor.yy0, &yymsp[-1].minor.yy0); } + break; + case 708: /* twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ +{ yymsp[-5].minor.yy840 = createCountWindowNode(pCxt, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0); } + break; + case 715: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ +{ yymsp[-3].minor.yy840 = createFillNode(pCxt, yymsp[-1].minor.yy470, NULL); } + break; + case 716: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ +{ yymsp[-5].minor.yy840 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy456)); } + break; + case 717: /* fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ +{ yymsp[-5].minor.yy840 = createFillNode(pCxt, FILL_MODE_VALUE_F, createNodeListNode(pCxt, yymsp[-1].minor.yy456)); } + break; + case 718: /* fill_mode ::= NONE */ +{ yymsp[0].minor.yy470 = FILL_MODE_NONE; } + break; + case 719: /* fill_mode ::= PREV */ +{ yymsp[0].minor.yy470 = FILL_MODE_PREV; } + break; + case 720: /* fill_mode ::= NULL */ +{ yymsp[0].minor.yy470 = FILL_MODE_NULL; } + break; + case 721: /* fill_mode ::= NULL_F */ +{ yymsp[0].minor.yy470 = FILL_MODE_NULL_F; } + break; + case 722: /* fill_mode ::= LINEAR */ +{ yymsp[0].minor.yy470 = FILL_MODE_LINEAR; } + break; + case 723: /* fill_mode ::= NEXT */ +{ yymsp[0].minor.yy470 = FILL_MODE_NEXT; } + break; + case 726: /* group_by_list ::= expr_or_subquery */ +{ yylhsminor.yy456 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy840))); } + yymsp[0].minor.yy456 = yylhsminor.yy456; + break; + case 727: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ +{ yylhsminor.yy456 = addNodeToList(pCxt, yymsp[-2].minor.yy456, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy840))); } + yymsp[-2].minor.yy456 = yylhsminor.yy456; + break; + case 731: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ +{ yymsp[-5].minor.yy840 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy840), releaseRawExprNode(pCxt, yymsp[-1].minor.yy840)); } + break; + case 732: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ +{ yymsp[-3].minor.yy840 = createInterpTimePoint(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy840)); } + break; + case 735: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ { - yylhsminor.yy416 = addOrderByClause(pCxt, yymsp[-3].minor.yy416, yymsp[-2].minor.yy316); - yylhsminor.yy416 = addSlimitClause(pCxt, yylhsminor.yy416, yymsp[-1].minor.yy416); - yylhsminor.yy416 = addLimitClause(pCxt, yylhsminor.yy416, yymsp[0].minor.yy416); + yylhsminor.yy840 = addOrderByClause(pCxt, yymsp[-3].minor.yy840, yymsp[-2].minor.yy456); + yylhsminor.yy840 = addSlimitClause(pCxt, yylhsminor.yy840, yymsp[-1].minor.yy840); + yylhsminor.yy840 = addLimitClause(pCxt, yylhsminor.yy840, yymsp[0].minor.yy840); } -#line 8584 "sql.c" - yymsp[-3].minor.yy416 = yylhsminor.yy416; - break; - case 722: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ -#line 1527 "sql.y" -{ yylhsminor.yy416 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy416, yymsp[0].minor.yy416); } -#line 8590 "sql.c" - yymsp[-3].minor.yy416 = yylhsminor.yy416; - break; - case 723: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ -#line 1529 "sql.y" -{ yylhsminor.yy416 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy416, yymsp[0].minor.yy416); } -#line 8596 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; - break; - case 732: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - case 736: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==736); -#line 1544 "sql.y" -{ yymsp[-3].minor.yy416 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } -#line 8603 "sql.c" - break; - case 733: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - case 737: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==737); -#line 1545 "sql.y" -{ yymsp[-3].minor.yy416 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } -#line 8609 "sql.c" - break; - case 738: /* subquery ::= NK_LP query_expression NK_RP */ -#line 1553 "sql.y" -{ yylhsminor.yy416 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy416); } -#line 8614 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; - break; - case 743: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ -#line 1567 "sql.y" -{ yylhsminor.yy416 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), yymsp[-1].minor.yy506, yymsp[0].minor.yy1045); } -#line 8620 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; - break; - case 744: /* ordering_specification_opt ::= */ -#line 1571 "sql.y" -{ yymsp[1].minor.yy506 = ORDER_ASC; } -#line 8626 "sql.c" - break; - case 745: /* ordering_specification_opt ::= ASC */ -#line 1572 "sql.y" -{ yymsp[0].minor.yy506 = ORDER_ASC; } -#line 8631 "sql.c" - break; - case 746: /* ordering_specification_opt ::= DESC */ -#line 1573 "sql.y" -{ yymsp[0].minor.yy506 = ORDER_DESC; } -#line 8636 "sql.c" - break; - case 747: /* null_ordering_opt ::= */ -#line 1577 "sql.y" -{ yymsp[1].minor.yy1045 = NULL_ORDER_DEFAULT; } -#line 8641 "sql.c" - break; - case 748: /* null_ordering_opt ::= NULLS FIRST */ -#line 1578 "sql.y" -{ yymsp[-1].minor.yy1045 = NULL_ORDER_FIRST; } -#line 8646 "sql.c" - break; - case 749: /* null_ordering_opt ::= NULLS LAST */ -#line 1579 "sql.y" -{ yymsp[-1].minor.yy1045 = NULL_ORDER_LAST; } -#line 8651 "sql.c" - break; - case 752: /* column_options ::= column_options ENCODE NK_STRING */ -#line 1587 "sql.y" -{ yylhsminor.yy416 = setColumnOptions(pCxt, yymsp[-2].minor.yy416, COLUMN_OPTION_ENCODE, &yymsp[0].minor.yy0); } -#line 8656 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; - break; - case 753: /* column_options ::= column_options COMPRESS NK_STRING */ -#line 1588 "sql.y" -{ yylhsminor.yy416 = setColumnOptions(pCxt, yymsp[-2].minor.yy416, COLUMN_OPTION_COMPRESS, &yymsp[0].minor.yy0); } -#line 8662 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; - break; - case 754: /* column_options ::= column_options LEVEL NK_STRING */ -#line 1589 "sql.y" -{ yylhsminor.yy416 = setColumnOptions(pCxt, yymsp[-2].minor.yy416, COLUMN_OPTION_LEVEL, &yymsp[0].minor.yy0); } -#line 8668 "sql.c" - yymsp[-2].minor.yy416 = yylhsminor.yy416; + yymsp[-3].minor.yy840 = yylhsminor.yy840; + break; + case 738: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ +{ yylhsminor.yy840 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy840, yymsp[0].minor.yy840); } + yymsp[-3].minor.yy840 = yylhsminor.yy840; + break; + case 739: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ +{ yylhsminor.yy840 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy840, yymsp[0].minor.yy840); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; + break; + case 748: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + case 752: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==752); +{ yymsp[-3].minor.yy840 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } + break; + case 749: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + case 753: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==753); +{ yymsp[-3].minor.yy840 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } + break; + case 754: /* subquery ::= NK_LP query_expression NK_RP */ +{ yylhsminor.yy840 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy840); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; + break; + case 759: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ +{ yylhsminor.yy840 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy840), yymsp[-1].minor.yy818, yymsp[0].minor.yy777); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; + break; + case 760: /* ordering_specification_opt ::= */ +{ yymsp[1].minor.yy818 = ORDER_ASC; } + break; + case 761: /* ordering_specification_opt ::= ASC */ +{ yymsp[0].minor.yy818 = ORDER_ASC; } + break; + case 762: /* ordering_specification_opt ::= DESC */ +{ yymsp[0].minor.yy818 = ORDER_DESC; } + break; + case 763: /* null_ordering_opt ::= */ +{ yymsp[1].minor.yy777 = NULL_ORDER_DEFAULT; } + break; + case 764: /* null_ordering_opt ::= NULLS FIRST */ +{ yymsp[-1].minor.yy777 = NULL_ORDER_FIRST; } + break; + case 765: /* null_ordering_opt ::= NULLS LAST */ +{ yymsp[-1].minor.yy777 = NULL_ORDER_LAST; } + break; + case 768: /* column_options ::= column_options ENCODE NK_STRING */ +{ yylhsminor.yy840 = setColumnOptions(pCxt, yymsp[-2].minor.yy840, COLUMN_OPTION_ENCODE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; + break; + case 769: /* column_options ::= column_options COMPRESS NK_STRING */ +{ yylhsminor.yy840 = setColumnOptions(pCxt, yymsp[-2].minor.yy840, COLUMN_OPTION_COMPRESS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; + break; + case 770: /* column_options ::= column_options LEVEL NK_STRING */ +{ yylhsminor.yy840 = setColumnOptions(pCxt, yymsp[-2].minor.yy840, COLUMN_OPTION_LEVEL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; default: break; @@ -8732,22 +8030,22 @@ yymsp[0].minor.yy416); } */ #ifndef YYNOERRORRECOVERY static void yy_parse_failed( - yyParser *yypParser /* The parser */ + yyParser *yypParser /* The parser */ ){ ParseARG_FETCH - ParseCTX_FETCH + ParseCTX_FETCH #ifndef NDEBUG - if( yyTraceFILE ){ + if( yyTraceFILE ){ fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt); } #endif while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser); /* Here code is inserted which will be executed whenever the ** parser fails */ - /************ Begin %parse_failure code ***************************************/ - /************ End %parse_failure code *****************************************/ +/************ Begin %parse_failure code ***************************************/ +/************ End %parse_failure code *****************************************/ ParseARG_STORE /* Suppress warning about unused %extra_argument variable */ - ParseCTX_STORE + ParseCTX_STORE } #endif /* YYNOERRORRECOVERY */ @@ -8755,17 +8053,16 @@ static void yy_parse_failed( ** The following code executes when a syntax error first occurs. */ static void yy_syntax_error( - yyParser *yypParser, /* The parser */ - int yymajor, /* The major type of the error token */ - ParseTOKENTYPE yyminor /* The minor type of the error token */ + yyParser *yypParser, /* The parser */ + int yymajor, /* The major type of the error token */ + ParseTOKENTYPE yyminor /* The minor type of the error token */ ){ ParseARG_FETCH - ParseCTX_FETCH + ParseCTX_FETCH #define TOKEN yyminor /************ Begin %syntax_error code ****************************************/ -#line 29 "sql.y" - if (TSDB_CODE_SUCCESS == pCxt->errCode) { + if (TSDB_CODE_SUCCESS == pCxt->errCode) { if(TOKEN.z) { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_SYNTAX_ERROR, TOKEN.z); } else { @@ -8774,22 +8071,21 @@ static void yy_syntax_error( } else if (TSDB_CODE_PAR_DB_NOT_SPECIFIED == pCxt->errCode && TK_NK_FLOAT == TOKEN.type) { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_SYNTAX_ERROR, TOKEN.z); } -#line 8742 "sql.c" /************ End %syntax_error code ******************************************/ ParseARG_STORE /* Suppress warning about unused %extra_argument variable */ - ParseCTX_STORE + ParseCTX_STORE } /* ** The following is executed when the parser accepts */ static void yy_accept( - yyParser *yypParser /* The parser */ + yyParser *yypParser /* The parser */ ){ ParseARG_FETCH - ParseCTX_FETCH + ParseCTX_FETCH #ifndef NDEBUG - if( yyTraceFILE ){ + if( yyTraceFILE ){ fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt); } #endif @@ -8799,10 +8095,10 @@ static void yy_accept( assert( yypParser->yytos==yypParser->yystack ); /* Here code is inserted which will be executed whenever the ** parser accepts */ - /*********** Begin %parse_accept code *****************************************/ - /*********** End %parse_accept code *******************************************/ +/*********** Begin %parse_accept code *****************************************/ +/*********** End %parse_accept code *******************************************/ ParseARG_STORE /* Suppress warning about unused %extra_argument variable */ - ParseCTX_STORE + ParseCTX_STORE } /* The main parser program. @@ -8825,10 +8121,10 @@ static void yy_accept( ** None. */ void Parse( - void *yyp, /* The parser */ - int yymajor, /* The major token code number */ - ParseTOKENTYPE yyminor /* The value for the token */ - ParseARG_PDECL /* Optional %extra_argument parameter */ + void *yyp, /* The parser */ + int yymajor, /* The major token code number */ + ParseTOKENTYPE yyminor /* The value for the token */ + ParseARG_PDECL /* Optional %extra_argument parameter */ ){ YYMINORTYPE yyminorunion; YYACTIONTYPE yyact; /* The parser action. */ @@ -8840,9 +8136,9 @@ void Parse( #endif yyParser *yypParser = (yyParser*)yyp; /* The parser */ ParseCTX_FETCH - ParseARG_STORE + ParseARG_STORE - assert( yypParser->yytos!=0 ); + assert( yypParser->yytos!=0 ); #if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY) yyendofinput = (yymajor==0); #endif @@ -8872,14 +8168,14 @@ void Parse( int yysize = yyRuleInfoNRhs[yyruleno]; if( yysize ){ fprintf(yyTraceFILE, "%sReduce %d [%s]%s, pop back to state %d.\n", - yyTracePrompt, - yyruleno, yyRuleName[yyruleno], - yyrulenoyytos[yysize].stateno); + yyTracePrompt, + yyruleno, yyRuleName[yyruleno], + yyrulenoyytos[yysize].stateno); }else{ fprintf(yyTraceFILE, "%sReduce %d [%s]%s.\n", - yyTracePrompt, yyruleno, yyRuleName[yyruleno], - yyrulenoyytos - yypParser->yystack)>yypParser->yyhwm ){ yypParser->yyhwm++; assert( yypParser->yyhwm == - (int)(yypParser->yytos - yypParser->yystack)); + (int)(yypParser->yytos - yypParser->yystack)); } #endif +#if YYSTACKDEPTH>0 if( yypParser->yytos>=yypParser->yystackEnd ){ + yyStackOverflow(yypParser); + break; + } +#else + if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz-1] ){ if( yyGrowStack(yypParser) ){ yyStackOverflow(yypParser); break; } } +#endif } yyact = yy_reduce(yypParser,yyruleno,yymajor,yyminor ParseCTX_PARAM); }else if( yyact <= YY_MAX_SHIFTREDUCE ){ @@ -8927,7 +8230,7 @@ void Parse( #ifdef YYERRORSYMBOL /* A syntax error has occurred. ** The response to an error depends upon whether or not the - ** grammar defines an error token "ERROR". + ** grammar defines an error token "ERROR". ** ** This is what we do if the grammar does define ERROR: ** @@ -8952,7 +8255,7 @@ void Parse( #ifndef NDEBUG if( yyTraceFILE ){ fprintf(yyTraceFILE,"%sDiscard input token %s\n", - yyTracePrompt,yyTokenName[yymajor]); + yyTracePrompt,yyTokenName[yymajor]); } #endif yy_destructor(yypParser, (YYCODETYPE)yymajor, &yyminorunion); From 6ab21a0d1761488b76de34aed5251c9ee49d30fe Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Thu, 15 Aug 2024 13:20:42 +0800 Subject: [PATCH 031/695] fix issue --- source/libs/executor/inc/executorInt.h | 1 - source/libs/executor/inc/tfill.h | 2 + source/libs/executor/src/streamfilloperator.c | 1 + .../executor/src/streamtimesliceoperator.c | 141 ++++++++++++------ source/libs/stream/src/streamSliceState.c | 45 +++--- 5 files changed, 122 insertions(+), 68 deletions(-) diff --git a/source/libs/executor/inc/executorInt.h b/source/libs/executor/inc/executorInt.h index 46a348479af7..54c8d092d387 100644 --- a/source/libs/executor/inc/executorInt.h +++ b/source/libs/executor/inc/executorInt.h @@ -841,7 +841,6 @@ typedef struct SStreamTimeSliceOperatorInfo { SGroupResInfo groupResInfo; bool ignoreNull; bool isHistoryOp; - bool isReloadState; } SStreamTimeSliceOperatorInfo; #define OPTR_IS_OPENED(_optr) (((_optr)->status & OP_OPENED) == OP_OPENED) diff --git a/source/libs/executor/inc/tfill.h b/source/libs/executor/inc/tfill.h index a8ebc6bb1706..d5284cd3fc51 100644 --- a/source/libs/executor/inc/tfill.h +++ b/source/libs/executor/inc/tfill.h @@ -106,6 +106,7 @@ typedef struct SStreamFillInfo { TSKEY end; // endKey for fill TSKEY current; // current Key for fill TSKEY preRowKey; + TSKEY prePointKey; TSKEY nextRowKey; TSKEY nextPointKey; TSKEY nextNextRowKey; @@ -118,6 +119,7 @@ typedef struct SStreamFillInfo { SArray* delRanges; int32_t delIndex; uint64_t curGroupId; + bool hasNext; } SStreamFillInfo; int64_t getNumOfResultsAfterFillGap(SFillInfo* pFillInfo, int64_t ekey, int32_t maxNumOfRows); diff --git a/source/libs/executor/src/streamfilloperator.c b/source/libs/executor/src/streamfilloperator.c index 75d072a828a4..8c0bfd028252 100644 --- a/source/libs/executor/src/streamfilloperator.c +++ b/source/libs/executor/src/streamfilloperator.c @@ -1335,6 +1335,7 @@ SStreamFillInfo* initStreamFillInfo(SStreamFillSupporter* pFillSup, SSDataBlock* pFillInfo->delIndex = 0; pFillInfo->curGroupId = 0; + pFillInfo->hasNext = false; return pFillInfo; _end: diff --git a/source/libs/executor/src/streamtimesliceoperator.c b/source/libs/executor/src/streamtimesliceoperator.c index e1d91de54e69..ee7ca4d64d98 100644 --- a/source/libs/executor/src/streamtimesliceoperator.c +++ b/source/libs/executor/src/streamtimesliceoperator.c @@ -88,6 +88,7 @@ void streamTimeSliceReloadState(SOperatorInfo* pOperator) { SStreamTimeSliceOperatorInfo* pInfo = pOperator->info; SStreamAggSupporter* pAggSup = &pInfo->streamAggSup; SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; + SStreamFillSupporter* pFillSup = pInfo->pFillSup; resetWinRange(&pAggSup->winRange); int32_t size = 0; @@ -111,11 +112,23 @@ void streamTimeSliceReloadState(SOperatorInfo* pOperator) { QUERY_CHECK_NULL(pInfo->pUpdatedMap, code, lino, _end, terrno); } + int32_t tmpRes = TSDB_CODE_SUCCESS; for (int32_t i = 0; i < num; i++) { SWinKey* pKey = pKeyBuf + i; - qDebug("===stream=== reload state. try process result %" PRId64 ", %" PRIu64 ", index:%d", pKey->ts, pKey->groupId, - i); - code = saveTimeSliceWinResult(pKey, pInfo->pUpdatedMap); + SWinKey resKey = {.groupId = pKey->groupId}; + if (pFillSup->type != TSDB_FILL_PREV && pFillSup->type != TSDB_FILL_LINEAR) { + code = pAggSup->stateStore.streamStateFillGetNext(pAggSup->pState, pKey, &resKey, NULL, NULL, &tmpRes); + QUERY_CHECK_CODE(code, lino, _end); + + if (tmpRes != TSDB_CODE_SUCCESS) { + continue; + } + } else { + resKey = *pKey; + } + qDebug("===stream=== reload state. try process result %" PRId64 ", %" PRIu64 ", index:%d", resKey.ts, + resKey.groupId, i); + code = saveTimeSliceWinResult(&resKey, pInfo->pUpdatedMap); QUERY_CHECK_CODE(code, lino, _end); } taosMemoryFree(pBuf); @@ -125,7 +138,6 @@ void streamTimeSliceReloadState(SOperatorInfo* pOperator) { downstream->fpSet.reloadStreamStateFn(downstream); } reloadAggSupFromDownStream(downstream, &pInfo->streamAggSup); - pInfo->isReloadState = true; _end: if (code != TSDB_CODE_SUCCESS) { @@ -494,6 +506,20 @@ static void setFillKeyInfo(TSKEY start, TSKEY end, SInterval* pInterval, SStream pFillInfo->end = end; } +static TSKEY adustPrevTsKey(TSKEY pointTs, TSKEY rowTs, SInterval* pInterval) { + if (rowTs >= pointTs) { + pointTs = taosTimeAdd(pointTs, pInterval->sliding, pInterval->slidingUnit, pInterval->precision); + } + return pointTs; +} + +static TSKEY adustEndTsKey(TSKEY pointTs, TSKEY rowTs, SInterval* pInterval) { + if (rowTs <= pointTs) { + pointTs = taosTimeAdd(pointTs, pInterval->sliding * -1, pInterval->slidingUnit, pInterval->precision); + } + return pointTs; +} + static void doStreamFillRange(SStreamFillSupporter* pFillSup, SStreamFillInfo* pFillInfo, SSDataBlock* pRes) { int32_t code = TSDB_CODE_SUCCESS; int32_t lino = 0; @@ -513,6 +539,22 @@ static void doStreamFillRange(SStreamFillSupporter* pFillSup, SStreamFillInfo* p } if (pFillInfo->type != TSDB_FILL_LINEAR) { fillNormalRange(pFillSup, pFillInfo, pRes); + + if (pFillInfo->pos == FILL_POS_MID) { + code = fillPointResult(pFillSup, &pFillSup->cur, pFillSup->cur.key, pRes, &res, false); + QUERY_CHECK_CODE(code, lino, _end); + if (res) { + pFillInfo->pos = FILL_POS_INVALID; + } + } + if (pFillInfo->current > pFillInfo->end && pFillInfo->hasNext) { + pFillInfo->hasNext = false; + TSKEY startTs = adustPrevTsKey(pFillInfo->current, pFillSup->cur.key, &pFillSup->interval); + setFillKeyInfo(startTs, pFillSup->next.key, &pFillSup->interval, pFillInfo); + pFillInfo->pResRow = &pFillSup->cur; + fillNormalRange(pFillSup, pFillInfo, pRes); + } + } else { fillLinearRange(pFillSup, pFillInfo, pRes); @@ -597,19 +639,6 @@ static void setPointBuff(SSlicePoint* pPoint, SStreamFillSupporter* pFillSup) { } } -static TSKEY adustPrevTsKey(TSKEY pointTs, TSKEY rowTs, SInterval* pInterval) { - if (rowTs >= pointTs) { - pointTs = taosTimeAdd(pointTs, pInterval->sliding, pInterval->slidingUnit, pInterval->precision); - } - return pointTs; -} - -static TSKEY adustEndTsKey(TSKEY pointTs, TSKEY rowTs, SInterval* pInterval) { - if (rowTs <= pointTs) { - pointTs = taosTimeAdd(pointTs, pInterval->sliding * -1, pInterval->slidingUnit, pInterval->precision); - } - return pointTs; -} static int32_t getLinearResultInfoFromState(SStreamAggSupporter* pAggSup, SStreamFillSupporter* pFillSup, TSKEY ts, int64_t groupId, SSlicePoint* pCurPoint, SSlicePoint* pPrevPoint, SSlicePoint* pNextPoint) { @@ -755,15 +784,17 @@ static int32_t getResultInfoFromState(SStreamAggSupporter* pAggSup, SStreamFillS } pFillSup->next.key = adustEndTsKey(pNextPoint->key.ts, pFillSup->next.key, &pFillSup->interval); - int32_t nextNextVLen = 0; - int32_t tmpWinCode = TSDB_CODE_SUCCESS; - SSlicePoint nextNextPoint = {.key.groupId = pNextPoint->key.groupId}; - code = - pAggSup->stateStore.streamStateFillGetNext(pState, &pNextPoint->key, &nextNextPoint.key, NULL, NULL, &tmpWinCode); - if (tmpWinCode == TSDB_CODE_SUCCESS) { - pFillSup->nextNext.key = nextNextPoint.key.ts; + if (pFillSup->type == TSDB_FILL_PREV) { + int32_t nextNextVLen = 0; + int32_t tmpWinCode = TSDB_CODE_SUCCESS; + SSlicePoint nextNextPoint = {.key.groupId = pNextPoint->key.groupId}; + code = pAggSup->stateStore.streamStateFillGetNext(pState, &pNextPoint->key, &nextNextPoint.key, NULL, NULL, + &tmpWinCode); + QUERY_CHECK_CODE(code, lino, _end); + if (tmpWinCode == TSDB_CODE_SUCCESS) { + pFillSup->nextNext.key = nextNextPoint.key.ts; + } } - QUERY_CHECK_CODE(code, lino, _end); } _end: @@ -907,9 +938,8 @@ static void copyCalcRowDeltaData(SResultRowData* pEndRow, SArray* pEndPoins, SFi } } -static void setTimeSliceFillRule(SStreamFillSupporter* pFillSup, SStreamFillInfo* pFillInfo, TSKEY ts, bool isReloadState) { - qDebug("set stream interp fill rule, isReloadState:%d", isReloadState); - if (!hasNextWindow(pFillSup) && (!hasPrevWindow(pFillSup) || isReloadState) ) { +static void setTimeSliceFillRule(SStreamFillSupporter* pFillSup, SStreamFillInfo* pFillInfo, TSKEY ts) { + if (!hasNextWindow(pFillSup) && !hasPrevWindow(pFillSup)) { pFillInfo->needFill = false; pFillInfo->pos = FILL_POS_START; goto _end; @@ -933,7 +963,7 @@ static void setTimeSliceFillRule(SStreamFillSupporter* pFillSup, SStreamFillInfo case TSDB_FILL_NULL_F: case TSDB_FILL_SET_VALUE: case TSDB_FILL_SET_VALUE_F: { - if (hasPrevWindow(pFillSup) && !isReloadState) { + if (hasPrevWindow(pFillSup)) { setFillKeyInfo(prevWKey, endTs, &pFillSup->interval, pFillInfo); pFillInfo->pos = FILL_POS_END; } else { @@ -944,10 +974,11 @@ static void setTimeSliceFillRule(SStreamFillSupporter* pFillSup, SStreamFillInfo pFillInfo->pResRow->key = ts; } break; case TSDB_FILL_PREV: { - if (hasPrevWindow(pFillSup) && hasNextWindow(pFillSup) && pFillInfo->nextRowKey == pFillInfo->nextPointKey && - (!hasNextNextWindow(pFillSup) || pFillInfo->nextNextRowKey == pFillInfo->nextNextPointKey) && !isReloadState ) { + if (hasPrevWindow(pFillSup) && hasNextWindow(pFillSup) && pFillInfo->preRowKey != pFillInfo->prePointKey && + pFillInfo->nextRowKey == pFillInfo->nextPointKey) { setFillKeyInfo(prevWKey, endTs, &pFillSup->interval, pFillInfo); - pFillInfo->pos = FILL_POS_END; + pFillInfo->pos = FILL_POS_MID; + pFillInfo->hasNext = true; } else if (hasNextWindow(pFillSup)) { setFillKeyInfo(startTs, nextWKey, &pFillSup->interval, pFillInfo); pFillInfo->pos = FILL_POS_START; @@ -962,7 +993,7 @@ static void setTimeSliceFillRule(SStreamFillSupporter* pFillSup, SStreamFillInfo pFillInfo->pResRow = &pFillSup->prev; } break; case TSDB_FILL_NEXT: { - if (hasPrevWindow(pFillSup) && !isReloadState) { + if (hasPrevWindow(pFillSup)) { setFillKeyInfo(prevWKey, endTs, &pFillSup->interval, pFillInfo); pFillInfo->pos = FILL_POS_END; resetFillWindow(&pFillSup->next); @@ -1233,8 +1264,20 @@ void getNextResKey(int64_t curGroupId, SArray* pKeyArray, int32_t curIndex, TSKE *pNextKey = INT64_MIN; } +void getPrevResKey(int64_t curGroupId, SArray* pKeyArray, int32_t curIndex, TSKEY* pNextKey) { + int32_t prevIndex = curIndex - 1; + if (prevIndex >= 0) { + SWinKey* pKey = (SWinKey*)taosArrayGet(pKeyArray, prevIndex); + if (pKey->groupId == curGroupId) { + *pNextKey = pKey->ts; + return; + } + } + *pNextKey = INT64_MIN; +} + void doBuildTimeSlicePointResult(SStreamAggSupporter* pAggSup, SStreamFillSupporter* pFillSup, - SStreamFillInfo* pFillInfo, SSDataBlock* pBlock, SGroupResInfo* pGroupResInfo, bool isReloadState) { + SStreamFillInfo* pFillInfo, SSDataBlock* pBlock, SGroupResInfo* pGroupResInfo) { int32_t code = TSDB_CODE_SUCCESS; int32_t lino = 0; blockDataCleanup(pBlock); @@ -1263,15 +1306,24 @@ void doBuildTimeSlicePointResult(SStreamAggSupporter* pAggSup, SStreamFillSuppor } QUERY_CHECK_CODE(code, lino, _end); - getNextResKey(pKey->groupId, pGroupResInfo->pRows, pGroupResInfo->index, &pFillInfo->nextRowKey); - if (hasNextWindow(pFillSup)) { - pFillInfo->nextPointKey = nextPoint.key.ts; - } - getNextResKey(pKey->groupId, pGroupResInfo->pRows, pGroupResInfo->index + 1, &pFillInfo->nextNextRowKey); - if (hasNextNextWindow(pFillSup)) { - pFillInfo->nextNextPointKey = pFillSup->nextNext.key; + if (pFillSup->type == TSDB_FILL_PREV) { + getPrevResKey(pKey->groupId, pGroupResInfo->pRows, pGroupResInfo->index, &pFillInfo->preRowKey); + if (hasPrevWindow(pFillSup)) { + pFillInfo->prePointKey = prevPoint.key.ts; + } + + getNextResKey(pKey->groupId, pGroupResInfo->pRows, pGroupResInfo->index, &pFillInfo->nextRowKey); + if (hasNextWindow(pFillSup)) { + pFillInfo->nextPointKey = nextPoint.key.ts; + } + + getNextResKey(pKey->groupId, pGroupResInfo->pRows, pGroupResInfo->index + 1, &pFillInfo->nextNextRowKey); + if (hasNextNextWindow(pFillSup)) { + pFillInfo->nextNextPointKey = pFillSup->nextNext.key; + } } - setTimeSliceFillRule(pFillSup, pFillInfo, pKey->ts, isReloadState); + + setTimeSliceFillRule(pFillSup, pFillInfo, pKey->ts); doStreamFillRange(pFillSup, pFillInfo, pBlock); releaseOutputBuf(pAggSup->pState, curPoint.pResPos, &pAggSup->stateStore); releaseOutputBuf(pAggSup->pState, prevPoint.pResPos, &pAggSup->stateStore); @@ -1300,7 +1352,7 @@ static int32_t buildTimeSliceResult(SOperatorInfo* pOperator, SSDataBlock** ppRe goto _end; } - doBuildTimeSlicePointResult(pAggSup, pInfo->pFillSup, pInfo->pFillInfo, pInfo->pRes, &pInfo->groupResInfo, pInfo->isReloadState); + doBuildTimeSlicePointResult(pAggSup, pInfo->pFillSup, pInfo->pFillInfo, pInfo->pRes, &pInfo->groupResInfo); if (pInfo->pRes->info.rows != 0) { printDataBlock(pInfo->pRes, getStreamOpName(opType), GET_TASKID(pTaskInfo)); (*ppRes) = pInfo->pRes; @@ -1452,7 +1504,6 @@ static int32_t doStreamTimeSliceNext(SOperatorInfo* pOperator, SSDataBlock** ppR goto _end; } - pInfo->isReloadState = false; setStreamOperatorCompleted(pOperator); resetStreamFillSup(pInfo->pFillSup); (*ppRes) = NULL; @@ -1544,7 +1595,6 @@ static int32_t doStreamTimeSliceNext(SOperatorInfo* pOperator, SSDataBlock** ppR QUERY_CHECK_CODE(code, lino, _end); if (!(*ppRes)) { - pInfo->isReloadState = false; setStreamOperatorCompleted(pOperator); resetStreamFillSup(pInfo->pFillSup); } @@ -1719,7 +1769,6 @@ int32_t createStreamTimeSliceOperatorInfo(SOperatorInfo* downstream, SPhysiNode* if (pHandle) { pInfo->isHistoryOp = pHandle->fillHistory; } - pInfo->isReloadState = false; pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERP_FUNC; setOperatorInfo(pOperator, getStreamOpName(pOperator->operatorType), QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERP_FUNC, diff --git a/source/libs/stream/src/streamSliceState.c b/source/libs/stream/src/streamSliceState.c index f5589f53aea2..4ad60daec829 100644 --- a/source/libs/stream/src/streamSliceState.c +++ b/source/libs/stream/src/streamSliceState.c @@ -183,32 +183,35 @@ int32_t getHashSortNextRow(SStreamFileState* pFileState, const SWinKey* pKey, SW void* tmpVal = NULL; int32_t len = 0; (*pWinCode) = streamStateGetGroupKVByCur_rocksdb(pCur, pResKey, (const void**)&tmpVal, &len); - if ((*pWinCode) == TSDB_CODE_SUCCESS && ppVal != NULL) { - SRowBuffPos* pNewPos = getNewRowPosForWrite(pFileState); - if (!pNewPos || !pNewPos->pRowBuff) { - code = TSDB_CODE_OUT_OF_MEMORY; - QUERY_CHECK_CODE(code, lino, _end); + if ((*pWinCode) == TSDB_CODE_SUCCESS) { + if (ppVal != NULL) { + SRowBuffPos* pNewPos = getNewRowPosForWrite(pFileState); + if (!pNewPos || !pNewPos->pRowBuff) { + code = TSDB_CODE_OUT_OF_MEMORY; + QUERY_CHECK_CODE(code, lino, _end); + } + memcpy(pNewPos->pRowBuff, tmpVal, len); + *pVLen = getRowStateRowSize(pFileState); + (*ppVal) = pNewPos; } - memcpy(pNewPos->pRowBuff, tmpVal, len); - *pVLen = getRowStateRowSize(pFileState); - (*ppVal) = pNewPos; + taosMemoryFreeClear(tmpVal); + streamStateFreeCur(pCur); + return code; } - taosMemoryFreeClear(tmpVal); streamStateFreeCur(pCur); + } + + if (index == size - 1) { + (*pWinCode) = TSDB_CODE_FAILED; return code; - } else { - if (index == size - 1) { - (*pWinCode) = TSDB_CODE_FAILED; - return code; - } - SWinKey* pNext = taosArrayGet(pWinStates, index + 1); - *pResKey = *pNext; - if (ppVal == NULL) { - return code; - } - return getHashSortRowBuff(pFileState, pResKey, ppVal, pVLen, pWinCode); } - (*pWinCode) = TSDB_CODE_FAILED; + SWinKey* pNext = taosArrayGet(pWinStates, index + 1); + *pResKey = *pNext; + if (ppVal == NULL) { + (*pWinCode) = TSDB_CODE_SUCCESS; + return code; + } + return getHashSortRowBuff(pFileState, pResKey, ppVal, pVLen, pWinCode); _end: if (code != TSDB_CODE_SUCCESS) { From 16d7073a1b3038db342ecb34b7b242d5cbee2cbf Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Thu, 15 Aug 2024 13:33:06 +0800 Subject: [PATCH 032/695] adj ci --- tests/script/tsim/stream/streamInterpHistory.sim | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/script/tsim/stream/streamInterpHistory.sim b/tests/script/tsim/stream/streamInterpHistory.sim index 6e6e99f98b61..beb81ec04b7a 100644 --- a/tests/script/tsim/stream/streamInterpHistory.sim +++ b/tests/script/tsim/stream/streamInterpHistory.sim @@ -17,7 +17,7 @@ sql insert into t1 values(1648791212000,1,1,1,1.0); sql insert into t1 values(1648791215001,2,1,1,1.0); sql insert into t2 values(1648791212000,31,1,1,1.0); -sql insert into t2 values(1648791215001,41,1,1,1.0); +sql insert into t2 values(1648791216001,41,1,1,1.0); sql create stream streams1 trigger at_once FILL_HISTORY 1 IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _irowts, _isfilled as a1, interp(a) as a2 from st partition by tbname every(1s) fill(prev); @@ -152,7 +152,7 @@ if $data32 != 31 then goto loop0_1 endi -if $data42 != 41 then +if $data42 != 31 then print ======data42=$data42 goto loop0_1 endi @@ -260,7 +260,7 @@ sql insert into t1 values(1648791212000,1,1,1,1.0); sql insert into t1 values(1648791215001,2,1,1,1.0); sql insert into t2 values(1648791212000,31,1,1,1.0); -sql insert into t2 values(1648791215001,41,1,1,1.0); +sql insert into t2 values(1648791216001,41,1,1,1.0); sql create stream streams2 trigger at_once FILL_HISTORY 1 IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _irowts, _isfilled as a1, interp(a) as a2 from st partition by tbname every(1s) fill(next); @@ -395,7 +395,7 @@ if $data32 != 41 then goto loop2_1 endi -if $data42 != 61 then +if $data42 != 41 then print ======data42=$data42 goto loop2_1 endi From e0178f28716dc6241a01be1c9630b7cfa5118ec1 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Thu, 15 Aug 2024 14:16:40 +0800 Subject: [PATCH 033/695] add ci --- .../executor/src/streamtimesliceoperator.c | 2 +- .../script/tsim/stream/streamInterpUpdate.sim | 551 ++++++++++++++++++ .../tsim/stream/streamInterpUpdate1.sim | 551 ++++++++++++++++++ .../tsim/stream/streamInterpUpdate2.sim | 279 +++++++++ 4 files changed, 1382 insertions(+), 1 deletion(-) create mode 100644 tests/script/tsim/stream/streamInterpUpdate.sim create mode 100644 tests/script/tsim/stream/streamInterpUpdate1.sim create mode 100644 tests/script/tsim/stream/streamInterpUpdate2.sim diff --git a/source/libs/executor/src/streamtimesliceoperator.c b/source/libs/executor/src/streamtimesliceoperator.c index ee7ca4d64d98..72a75b9ebf0e 100644 --- a/source/libs/executor/src/streamtimesliceoperator.c +++ b/source/libs/executor/src/streamtimesliceoperator.c @@ -1060,7 +1060,7 @@ static bool needAdjustValue(SSlicePoint* pPoint, TSKEY ts, bool isLeft, int32_t case TSDB_FILL_NULL_F: case TSDB_FILL_SET_VALUE: case TSDB_FILL_SET_VALUE_F: { - if (!isLeft && HAS_NON_ROW_DATA(pPoint->pRightRow)) { + if (!isLeft && (HAS_NON_ROW_DATA(pPoint->pRightRow) || pPoint->key.ts == ts) ) { return true; } } break; diff --git a/tests/script/tsim/stream/streamInterpUpdate.sim b/tests/script/tsim/stream/streamInterpUpdate.sim new file mode 100644 index 000000000000..59a188c2a6c4 --- /dev/null +++ b/tests/script/tsim/stream/streamInterpUpdate.sim @@ -0,0 +1,551 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sleep 50 +sql connect + +print step1 +print =============== create database +sql create database test vgroups 1; +sql use test; + +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 every(1s) fill(prev); + +run tsim/stream/checkTaskStatus.sim + + +sql insert into t1 values(1648791212001,1,1,1,1.0) (1648791215000,10,1,1,1.0) (1648791217001,4,1,1,1.0) + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(prev); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(prev); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 + +loop0: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows != 5 then + print ======rows=$rows + goto loop0 +endi + +# row 0 +if $data01 != 1 then + print ======data01=$data01 + goto loop0 +endi + +if $data11 != 1 then + print ======data11=$data11 + goto loop0 +endi + +if $data21 != 10 then + print ======data21=$data21 + goto loop0 +endi + +if $data31 != 10 then + print ======data31=$data31 + goto loop0 +endi + +if $data41 != 10 then + print ======data41=$data41 + goto loop0 +endi + +sql insert into t1 values(1648791212001,2,2,2,2.1); + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(prev); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(prev); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 + +loop1: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows != 5 then + print ======rows=$rows + goto loop1 +endi + +# row 0 +if $data01 != 2 then + print ======data01=$data01 + goto loop1 +endi + +if $data11 != 2 then + print ======data11=$data11 + goto loop1 +endi + +if $data21 != 10 then + print ======data21=$data21 + goto loop1 +endi + +if $data31 != 10 then + print ======data31=$data31 + goto loop1 +endi + +if $data41 != 10 then + print ======data41=$data41 + goto loop1 +endi + + +sql insert into t1 values(1648791215000,20,20,20,20.1); + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(prev); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(prev); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 + +loop2: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows != 5 then + print ======rows=$rows + goto loop2 +endi + +# row 0 +if $data01 != 2 then + print ======data01=$data01 + goto loop2 +endi + +if $data11 != 2 then + print ======data11=$data11 + goto loop2 +endi + +if $data21 != 20 then + print ======data21=$data21 + goto loop2 +endi + +if $data31 != 20 then + print ======data31=$data31 + goto loop2 +endi + +if $data41 != 20 then + print ======data41=$data41 + goto loop2 +endi + +sql insert into t1 values(1648791217001,8,8,8,8.1); + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(prev); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(prev); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 + +loop3: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows != 5 then + print ======rows=$rows + goto loop3 +endi + +# row 0 +if $data01 != 2 then + print ======data01=$data01 + goto loop3 +endi + +if $data11 != 2 then + print ======data11=$data11 + goto loop3 +endi + +if $data21 != 20 then + print ======data21=$data21 + goto loop3 +endi + +if $data31 != 20 then + print ======data31=$data31 + goto loop3 +endi + +if $data41 != 20 then + print ======data41=$data41 + goto loop3 +endi + +print step2 +print =============== create database +sql create database test2 vgroups 1; +sql use test2; + +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 every(1s) fill(next); + +run tsim/stream/checkTaskStatus.sim + + +sql insert into t1 values(1648791212001,1,1,1,1.0) (1648791215000,10,1,1,1.0) (1648791217001,4,1,1,1.0) + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(next); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(next); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 + +loop4: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows != 5 then + print ======rows=$rows + goto loop4 +endi + +# row 0 +if $data01 != 10 then + print ======data01=$data01 + goto loop4 +endi + +if $data11 != 10 then + print ======data11=$data11 + goto loop4 +endi + +if $data21 != 10 then + print ======data21=$data21 + goto loop4 +endi + +if $data31 != 4 then + print ======data31=$data31 + goto loop4 +endi + +if $data41 != 4 then + print ======data41=$data41 + goto loop4 +endi + +sql insert into t1 values(1648791212001,2,2,2,2.1); + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(next); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(next); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 + +loop5: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows != 5 then + print ======rows=$rows + goto loop5 +endi + +# row 0 +if $data01 != 10 then + print ======data01=$data01 + goto loop5 +endi + +if $data11 != 10 then + print ======data11=$data11 + goto loop5 +endi + +if $data21 != 10 then + print ======data21=$data21 + goto loop5 +endi + +if $data31 != 4 then + print ======data31=$data31 + goto loop5 +endi + +if $data41 != 4 then + print ======data41=$data41 + goto loop5 +endi + + +sql insert into t1 values(1648791215000,20,20,20,20.1); + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(next); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(next); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 + +loop6: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows != 5 then + print ======rows=$rows + goto loop6 +endi + +# row 0 +if $data01 != 20 then + print ======data01=$data01 + goto loop6 +endi + +if $data11 != 20 then + print ======data11=$data11 + goto loop6 +endi + +if $data21 != 20 then + print ======data21=$data21 + goto loop6 +endi + +if $data31 != 4 then + print ======data31=$data31 + goto loop6 +endi + +if $data41 != 4 then + print ======data41=$data41 + goto loop6 +endi + +sql insert into t1 values(1648791217001,8,8,8,8.1); + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(next); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(next); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 + +loop7: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows != 5 then + print ======rows=$rows + goto loop7 +endi + +# row 0 +if $data01 != 20 then + print ======data01=$data01 + goto loop7 +endi + +if $data11 != 20 then + print ======data11=$data11 + goto loop7 +endi + +if $data21 != 20 then + print ======data21=$data21 + goto loop7 +endi + +if $data31 != 8 then + print ======data31=$data31 + goto loop7 +endi + +if $data41 != 8 then + print ======data41=$data41 + goto loop7 +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/stream/streamInterpUpdate1.sim b/tests/script/tsim/stream/streamInterpUpdate1.sim new file mode 100644 index 000000000000..45f16af35de7 --- /dev/null +++ b/tests/script/tsim/stream/streamInterpUpdate1.sim @@ -0,0 +1,551 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sleep 50 +sql connect + +print step1 +print =============== create database +sql create database test vgroups 1; +sql use test; + +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 every(1s) fill(NULL); + +run tsim/stream/checkTaskStatus.sim + + +sql insert into t1 values(1648791212001,1,1,1,1.0) (1648791215000,10,1,1,1.0) (1648791217001,4,1,1,1.0) + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(NULL); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(NULL); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 + +loop0: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows != 5 then + print ======rows=$rows + goto loop0 +endi + +# row 0 +if $data01 != NULL then + print ======data01=$data01 + goto loop0 +endi + +if $data11 != NULL then + print ======data11=$data11 + goto loop0 +endi + +if $data21 != 10 then + print ======data21=$data21 + goto loop0 +endi + +if $data31 != NULL then + print ======data31=$data31 + goto loop0 +endi + +if $data41 != NULL then + print ======data41=$data41 + goto loop0 +endi + +sql insert into t1 values(1648791212001,2,2,2,2.1); + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(NULL); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(NULL); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 + +loop1: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows != 5 then + print ======rows=$rows + goto loop1 +endi + +# row 0 +if $data01 != NULL then + print ======data01=$data01 + goto loop1 +endi + +if $data11 != NULL then + print ======data11=$data11 + goto loop1 +endi + +if $data21 != 10 then + print ======data21=$data21 + goto loop1 +endi + +if $data31 != NULL then + print ======data31=$data31 + goto loop1 +endi + +if $data41 != NULL then + print ======data41=$data41 + goto loop1 +endi + + +sql insert into t1 values(1648791215000,20,20,20,20.1); + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(NULL); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(NULL); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 + +loop2: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows != 5 then + print ======rows=$rows + goto loop2 +endi + +# row 0 +if $data01 != NULL then + print ======data01=$data01 + goto loop2 +endi + +if $data11 != NULL then + print ======data11=$data11 + goto loop2 +endi + +if $data21 != 20 then + print ======data21=$data21 + goto loop2 +endi + +if $data31 != NULL then + print ======data31=$data31 + goto loop2 +endi + +if $data41 != NULL then + print ======data41=$data41 + goto loop2 +endi + +sql insert into t1 values(1648791217001,8,8,8,8.1); + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(prev); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(prev); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 + +loop3: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows != 5 then + print ======rows=$rows + goto loop3 +endi + +# row 0 +if $data01 != NULL then + print ======data01=$data01 + goto loop3 +endi + +if $data11 != NULL then + print ======data11=$data11 + goto loop3 +endi + +if $data21 != 20 then + print ======data21=$data21 + goto loop3 +endi + +if $data31 != NULL then + print ======data31=$data31 + goto loop3 +endi + +if $data41 != NULL then + print ======data41=$data41 + goto loop3 +endi + +print step2 +print =============== create database +sql create database test2 vgroups 1; +sql use test2; + +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 every(1s) fill(value, 100, 200, 300, 400); + +run tsim/stream/checkTaskStatus.sim + + +sql insert into t1 values(1648791212001,1,1,1,1.0) (1648791215000,10,1,1,1.0) (1648791217001,4,1,1,1.0) + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(value, 100, 200, 300, 400); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(value, 100, 200, 300, 400); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 + +loop4: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows != 5 then + print ======rows=$rows + goto loop4 +endi + +# row 0 +if $data01 != 100 then + print ======data01=$data01 + goto loop4 +endi + +if $data11 != 100 then + print ======data11=$data11 + goto loop4 +endi + +if $data21 != 10 then + print ======data21=$data21 + goto loop4 +endi + +if $data31 != 100 then + print ======data31=$data31 + goto loop4 +endi + +if $data41 != 100 then + print ======data41=$data41 + goto loop4 +endi + +sql insert into t1 values(1648791212001,2,2,2,2.1); + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(value, 100, 200, 300, 400); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(value, 100, 200, 300, 400); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 + +loop5: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows != 5 then + print ======rows=$rows + goto loop5 +endi + +# row 0 +if $data01 != 100 then + print ======data01=$data01 + goto loop5 +endi + +if $data11 != 100 then + print ======data11=$data11 + goto loop5 +endi + +if $data21 != 10 then + print ======data21=$data21 + goto loop5 +endi + +if $data31 != 100 then + print ======data31=$data31 + goto loop5 +endi + +if $data41 != 100 then + print ======data41=$data41 + goto loop5 +endi + + +sql insert into t1 values(1648791215000,20,20,20,20.1); + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(value, 100, 200, 300, 400); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(value, 100, 200, 300, 400); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 + +loop6: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows != 5 then + print ======rows=$rows + goto loop6 +endi + +# row 0 +if $data01 != 100 then + print ======data01=$data01 + goto loop6 +endi + +if $data11 != 100 then + print ======data11=$data11 + goto loop6 +endi + +if $data21 != 20 then + print ======data21=$data21 + goto loop6 +endi + +if $data31 != 100 then + print ======data31=$data31 + goto loop6 +endi + +if $data41 != 100 then + print ======data41=$data41 + goto loop6 +endi + +sql insert into t1 values(1648791217001,8,8,8,8.1); + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(value, 100, 200, 300, 400); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(value, 100, 200, 300, 400); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 + +loop7: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows != 5 then + print ======rows=$rows + goto loop7 +endi + +# row 0 +if $data01 != 100 then + print ======data01=$data01 + goto loop7 +endi + +if $data11 != 100 then + print ======data11=$data11 + goto loop7 +endi + +if $data21 != 20 then + print ======data21=$data21 + goto loop7 +endi + +if $data31 != 100 then + print ======data31=$data31 + goto loop7 +endi + +if $data41 != 100 then + print ======data41=$data41 + goto loop7 +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/stream/streamInterpUpdate2.sim b/tests/script/tsim/stream/streamInterpUpdate2.sim new file mode 100644 index 000000000000..2a71474dd78b --- /dev/null +++ b/tests/script/tsim/stream/streamInterpUpdate2.sim @@ -0,0 +1,279 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sleep 50 +sql connect + +print step1 +print =============== create database +sql create database test vgroups 1; +sql use test; + +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 every(1s) fill(linear); + +run tsim/stream/checkTaskStatus.sim + + +sql insert into t1 values(1648791212001,1,1,1,1.0) (1648791215000,10,1,1,1.0) (1648791217001,4,1,1,1.0) + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(linear); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(linear); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 + +loop0: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows != 5 then + print ======rows=$rows + goto loop0 +endi + +# row 0 +if $data01 != 3 then + print ======data01=$data01 + goto loop0 +endi + +if $data11 != 6 then + print ======data11=$data11 + goto loop0 +endi + +if $data21 != 10 then + print ======data21=$data21 + goto loop0 +endi + +if $data31 != 7 then + print ======data31=$data31 + goto loop0 +endi + +if $data41 != 4 then + print ======data41=$data41 + goto loop0 +endi + +sql insert into t1 values(1648791212001,2,2,2,2.1); + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(linear); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(linear); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 + +loop1: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows != 5 then + print ======rows=$rows + goto loop1 +endi + +# row 0 +if $data01 != 4 then + print ======data01=$data01 + goto loop1 +endi + +if $data11 != 7 then + print ======data11=$data11 + goto loop1 +endi + +if $data21 != 10 then + print ======data21=$data21 + goto loop1 +endi + +if $data31 != 7 then + print ======data31=$data31 + goto loop1 +endi + +if $data41 != 4 then + print ======data41=$data41 + goto loop1 +endi + + +sql insert into t1 values(1648791215000,20,20,20,20.1); + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(linear); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(linear); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 + +loop2: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows != 5 then + print ======rows=$rows + goto loop2 +endi + +# row 0 +if $data01 != 7 then + print ======data01=$data01 + goto loop2 +endi + +if $data11 != 13 then + print ======data11=$data11 + goto loop2 +endi + +if $data21 != 20 then + print ======data21=$data21 + goto loop2 +endi + +if $data31 != 12 then + print ======data31=$data31 + goto loop2 +endi + +if $data41 != 4 then + print ======data41=$data41 + goto loop2 +endi + +sql insert into t1 values(1648791217001,8,8,8,8.1); + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(linear); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(linear); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 + +loop3: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows != 5 then + print ======rows=$rows + goto loop3 +endi + +# row 0 +if $data01 != 7 then + print ======data01=$data01 + goto loop3 +endi + +if $data11 != 13 then + print ======data11=$data11 + goto loop3 +endi + +if $data21 != 20 then + print ======data21=$data21 + goto loop3 +endi + +if $data31 != 14 then + print ======data31=$data31 + goto loop3 +endi + +if $data41 != 8 then + print ======data41=$data41 + goto loop3 +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT From d59eb19c3740635ab07d16260f8982126d7ffb84 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Fri, 16 Aug 2024 10:54:52 +0800 Subject: [PATCH 034/695] add ci --- source/libs/executor/inc/executorInt.h | 43 +- source/libs/executor/inc/streamexecutorInt.h | 16 + source/libs/executor/src/scanoperator.c | 74 ++- .../executor/src/streamtimesliceoperator.c | 103 ++-- source/libs/stream/src/streamSliceState.c | 1 - source/libs/stream/src/streamState.c | 4 - source/libs/stream/src/tstreamFileState.c | 16 +- .../tsim/stream/streamInterpDelete0.sim | 507 +++++++++++++++++ .../tsim/stream/streamInterpDelete1.sim | 508 ++++++++++++++++++ .../tsim/stream/streamInterpDelete2.sim | 258 +++++++++ 10 files changed, 1439 insertions(+), 91 deletions(-) create mode 100644 tests/script/tsim/stream/streamInterpDelete0.sim create mode 100644 tests/script/tsim/stream/streamInterpDelete1.sim create mode 100644 tests/script/tsim/stream/streamInterpDelete2.sim diff --git a/source/libs/executor/inc/executorInt.h b/source/libs/executor/inc/executorInt.h index 54c8d092d387..51b3c511dda7 100644 --- a/source/libs/executor/inc/executorInt.h +++ b/source/libs/executor/inc/executorInt.h @@ -454,6 +454,27 @@ typedef struct SSteamOpBasicInfo { bool updateOperatorInfo; } SSteamOpBasicInfo; +typedef struct SStreamFillSupporter { + int32_t type; // fill type + SInterval interval; + SResultRowData prev; + TSKEY prevOriginKey; + SResultRowData cur; + SResultRowData next; + TSKEY nextOriginKey; + SResultRowData nextNext; + SFillColInfo* pAllColInfo; // fill exprs and not fill exprs + SExprSupp notFillExprSup; + int32_t numOfAllCols; // number of all exprs, including the tags columns + int32_t numOfFillCols; + int32_t numOfNotFillCols; + int32_t rowSize; + SSHashObj* pResMap; + bool hasDelete; + SStorageAPI* pAPI; + STimeWindow winRange; +} SStreamFillSupporter; + typedef struct SStreamScanInfo { SSteamOpBasicInfo basic; SExprInfo* pPseudoExpr; @@ -494,6 +515,7 @@ typedef struct SStreamScanInfo { STimeWindow updateWin; STimeWindowAggSupp twAggSup; SSDataBlock* pUpdateDataRes; + SStreamFillSupporter* pFillSup; // status for tmq SNodeList* pGroupTags; SNode* pTagCond; @@ -775,27 +797,6 @@ typedef struct SStreamPartitionOperatorInfo { SSDataBlock* pCreateTbRes; } SStreamPartitionOperatorInfo; -typedef struct SStreamFillSupporter { - int32_t type; // fill type - SInterval interval; - SResultRowData prev; - TSKEY prevOriginKey; - SResultRowData cur; - SResultRowData next; - TSKEY nextOriginKey; - SResultRowData nextNext; - SFillColInfo* pAllColInfo; // fill exprs and not fill exprs - SExprSupp notFillExprSup; - int32_t numOfAllCols; // number of all exprs, including the tags columns - int32_t numOfFillCols; - int32_t numOfNotFillCols; - int32_t rowSize; - SSHashObj* pResMap; - bool hasDelete; - SStorageAPI* pAPI; - STimeWindow winRange; -} SStreamFillSupporter; - typedef struct SStreamFillOperatorInfo { SSteamOpBasicInfo basic; SStreamFillSupporter* pFillSup; diff --git a/source/libs/executor/inc/streamexecutorInt.h b/source/libs/executor/inc/streamexecutorInt.h index f4b5030d3a72..744d95f1cfae 100644 --- a/source/libs/executor/inc/streamexecutorInt.h +++ b/source/libs/executor/inc/streamexecutorInt.h @@ -27,6 +27,21 @@ extern "C" { #define FILL_POS_MID 2 #define FILL_POS_END 3 +#define HAS_NON_ROW_DATA(pRowData) (pRowData->key == INT64_MIN) +#define HAS_ROW_DATA(pRowData) (pRowData && pRowData->key != INT64_MIN) + +typedef struct SSliceRowData { + TSKEY key; + SResultCellData pRowVal[]; +} SSliceRowData; + +typedef struct SSlicePoint { + SWinKey key; + SSliceRowData* pLeftRow; + SSliceRowData* pRightRow; + SRowBuffPos* pResPos; +} SSlicePoint; + void setStreamOperatorState(SSteamOpBasicInfo* pBasicInfo, EStreamType type); bool needSaveStreamOperatorInfo(SSteamOpBasicInfo* pBasicInfo); void saveStreamOperatorStateComplete(SSteamOpBasicInfo* pBasicInfo); @@ -56,6 +71,7 @@ void destroySPoint(void* ptr); void destroyStreamFillInfo(SStreamFillInfo* pFillInfo); int32_t checkResult(SStreamFillSupporter* pFillSup, TSKEY ts, uint64_t groupId, bool* pRes); void resetStreamFillSup(SStreamFillSupporter* pFillSup); +void setPointBuff(SSlicePoint* pPoint, SStreamFillSupporter* pFillSup); int winPosCmprImpl(const void* pKey1, const void* pKey2); diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 93facbf396b1..18648e3b5702 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -2184,8 +2184,38 @@ static int32_t generateCountScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSrcB return code; } -int32_t getTimeSliceWinRange(SStreamAggSupporter* pAggSup, SInterval* pInterval, TSKEY start, TSKEY end, - int64_t groupId, STimeWindow* pScanRange, STimeWindow* pDelRange) { +static int32_t setDelRangeEndKey(SStreamAggSupporter* pAggSup, SStreamFillSupporter* pFillSup, SWinKey* pEndKey, STimeWindow* pScanRange, bool* pRes) { + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; + SSlicePoint nextPoint = {.key.groupId = pEndKey->groupId}; + int32_t vLen = 0; + int32_t winCode = TSDB_CODE_SUCCESS; + code = pAggSup->stateStore.streamStateFillGetNext(pAggSup->pState, pEndKey, &nextPoint.key, (void**)&nextPoint.pResPos, &vLen, &winCode); + QUERY_CHECK_CODE(code, lino, _end); + if (winCode == TSDB_CODE_SUCCESS) { + setPointBuff(&nextPoint, pFillSup); + if (HAS_ROW_DATA(nextPoint.pLeftRow) && pEndKey->ts < nextPoint.pLeftRow->key) { + pScanRange->ekey = nextPoint.pLeftRow->key; + *pRes = true; + } else if (pEndKey->ts < nextPoint.pRightRow->key) { + pScanRange->ekey = nextPoint.pRightRow->key; + *pRes = true; + } else { + *pEndKey = nextPoint.key; + pScanRange->ekey = TMAX(nextPoint.pRightRow->key, nextPoint.key.ts); + *pRes = false; + } + } + +_end: + if (code != TSDB_CODE_SUCCESS) { + qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } + return code; +} + +int32_t getTimeSliceWinRange(SStreamAggSupporter* pAggSup, SStreamFillSupporter* pFillSup, SInterval* pInterval, TSKEY start, TSKEY end, + int64_t groupId, STimeWindow* pScanRange) { int32_t code = TSDB_CODE_SUCCESS; int32_t lino = 0; int32_t winCode = TSDB_CODE_SUCCESS; @@ -2193,28 +2223,36 @@ int32_t getTimeSliceWinRange(SStreamAggSupporter* pAggSup, SInterval* pInterval, dumyInfo.cur.pageId = -1; STimeWindow sWin = getActiveTimeWindow(NULL, &dumyInfo, start, pInterval, TSDB_ORDER_ASC); SWinKey startKey = {.groupId = groupId, .ts = sWin.skey}; - pDelRange->skey = sWin.skey; sWin = getActiveTimeWindow(NULL, &dumyInfo, end, pInterval, TSDB_ORDER_ASC); SWinKey endKey = {.groupId = groupId, .ts = sWin.ekey}; - pDelRange->ekey = sWin.ekey; - SWinKey preKey = {.groupId = groupId}; - code = pAggSup->stateStore.streamStateFillGetPrev(pAggSup->pState, &startKey, &preKey, NULL, NULL, &winCode); + SSlicePoint prevPoint = {.key.groupId = groupId}; + SSlicePoint nextPoint = {.key.groupId = groupId}; + int32_t vLen = 0; + code = pAggSup->stateStore.streamStateFillGetPrev(pAggSup->pState, &startKey, &prevPoint.key, (void**)&prevPoint.pResPos, &vLen, &winCode); QUERY_CHECK_CODE(code, lino, _end); if (winCode == TSDB_CODE_SUCCESS) { - pScanRange->skey = preKey.ts; + setPointBuff(&prevPoint, pFillSup); + if (HAS_ROW_DATA(prevPoint.pRightRow)) { + pScanRange->skey = prevPoint.pRightRow->key; + } else { + pScanRange->skey = prevPoint.pLeftRow->key; + } } else { pScanRange->skey = startKey.ts; } - SWinKey nextKey = {.groupId = groupId}; - code = pAggSup->stateStore.streamStateFillGetNext(pAggSup->pState, &endKey, &nextKey, NULL, NULL, &winCode); + bool res = false; + SWinKey curKey = endKey; + code = setDelRangeEndKey(pAggSup, pFillSup, &curKey, pScanRange, &res); QUERY_CHECK_CODE(code, lino, _end); - if (winCode == TSDB_CODE_SUCCESS) { - pScanRange->ekey = nextKey.ts; - } else { - pScanRange->ekey = endKey.ts; + if (res == false) { + code = setDelRangeEndKey(pAggSup, pFillSup, &curKey, pScanRange, &res); + QUERY_CHECK_CODE(code, lino, _end); + } + if (res == false) { + pScanRange->ekey = TMAX(endKey.ts, pScanRange->ekey); } _end: @@ -2277,10 +2315,9 @@ static int32_t generateTimeSliceScanRange(SStreamScanInfo* pInfo, SSDataBlock* p } STimeWindow scanRange = {0}; - STimeWindow delRange = {0}; ASSERT(mode == STREAM_DELETE_RESULT || mode == STREAM_DELETE_DATA); - code = getTimeSliceWinRange(pInfo->windowSup.pStreamAggSup, &pInfo->interval, startData[i], endData[i], groupId, - &scanRange, &delRange); + code = getTimeSliceWinRange(pInfo->windowSup.pStreamAggSup, pInfo->pFillSup, &pInfo->interval, startData[i], endData[i], groupId, + &scanRange); QUERY_CHECK_CODE(code, lino, _end); code = colDataSetVal(pDestStartCol, i, (const char*)&scanRange.skey, false); @@ -2293,10 +2330,10 @@ static int32_t generateTimeSliceScanRange(SStreamScanInfo* pInfo, SSDataBlock* p code = colDataSetVal(pDestGpCol, i, (const char*)&groupId, false); QUERY_CHECK_CODE(code, lino, _end); - code = colDataSetVal(pDestCalStartTsCol, i, (const char*)&delRange.skey, false); + code = colDataSetVal(pDestCalStartTsCol, i, (const char*)&scanRange.skey, false); QUERY_CHECK_CODE(code, lino, _end); - code = colDataSetVal(pDestCalEndTsCol, i, (const char*)&delRange.ekey, false); + code = colDataSetVal(pDestCalEndTsCol, i, (const char*)&scanRange.ekey, false); QUERY_CHECK_CODE(code, lino, _end); pDestBlock->info.rows++; @@ -4330,6 +4367,7 @@ int32_t createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhysiNode* pInfo->pState = pTaskInfo->streamInfo.pState; pInfo->stateStore = pTaskInfo->storageAPI.stateStore; pInfo->readerFn = pTaskInfo->storageAPI.tqReaderFn; + pInfo->pFillSup = NULL; code = createSpecialDataBlock(STREAM_CHECKPOINT, &pInfo->pCheckpointRes); QUERY_CHECK_CODE(code, lino, _error); diff --git a/source/libs/executor/src/streamtimesliceoperator.c b/source/libs/executor/src/streamtimesliceoperator.c index 72a75b9ebf0e..17840f8790fc 100644 --- a/source/libs/executor/src/streamtimesliceoperator.c +++ b/source/libs/executor/src/streamtimesliceoperator.c @@ -29,23 +29,9 @@ #define STREAM_TIME_SLICE_OP_STATE_NAME "StreamTimeSliceHistoryState" #define STREAM_TIME_SLICE_OP_CHECKPOINT_NAME "StreamTimeSliceOperator_Checkpoint" -#define HAS_NON_ROW_DATA(pRowData) (pRowData->key == INT64_MIN) -#define HAS_ROW_DATA(pRowData) (pRowData && pRowData->key != INT64_MIN) #define IS_INVALID_WIN_KEY(ts) ((ts) == INT64_MIN) #define SET_WIN_KEY_INVALID(ts) ((ts) = INT64_MIN) -typedef struct SSliceRowData { - TSKEY key; - SResultCellData pRowVal[]; -} SSliceRowData; - -typedef struct SSlicePoint { - SWinKey key; - SSliceRowData* pLeftRow; - SSliceRowData* pRightRow; - SRowBuffPos* pResPos; -} SSlicePoint; - int32_t saveTimeSliceWinResult(SWinKey* pKey, SSHashObj* pUpdatedMap) { return tSimpleHashPut(pUpdatedMap, pKey, sizeof(SWinKey), NULL, 0); } @@ -628,7 +614,7 @@ static int32_t getQualifiedRowNumDesc(SExprSupp* pExprSup, SSDataBlock* pBlock, static void setResultRowData(SSliceRowData** ppRowData, void* pBuff) { (*ppRowData) = (SSliceRowData*)pBuff; } -static void setPointBuff(SSlicePoint* pPoint, SStreamFillSupporter* pFillSup) { +void setPointBuff(SSlicePoint* pPoint, SStreamFillSupporter* pFillSup) { if (pFillSup->type != TSDB_FILL_LINEAR) { setResultRowData(&pPoint->pRightRow, pPoint->pResPos->pRowBuff); pPoint->pLeftRow = pPoint->pRightRow; @@ -1344,14 +1330,6 @@ static int32_t buildTimeSliceResult(SOperatorInfo* pOperator, SSDataBlock** ppRe uint16_t opType = pOperator->operatorType; SStreamAggSupporter* pAggSup = &pInfo->streamAggSup; - doBuildDeleteResultImpl(&pAggSup->stateStore, pAggSup->pState, pInfo->pDelWins, &pInfo->delIndex, pInfo->pDelRes); - if (pInfo->pDelRes->info.rows != 0) { - // process the rest of the data - printDataBlock(pInfo->pDelRes, getStreamOpName(opType), GET_TASKID(pTaskInfo)); - (*ppRes) = pInfo->pDelRes; - goto _end; - } - doBuildTimeSlicePointResult(pAggSup, pInfo->pFillSup, pInfo->pFillInfo, pInfo->pRes, &pInfo->groupResInfo); if (pInfo->pRes->info.rows != 0) { printDataBlock(pInfo->pRes, getStreamOpName(opType), GET_TASKID(pTaskInfo)); @@ -1407,16 +1385,16 @@ static int32_t doDeleteTimeSliceResult(SStreamAggSupporter* pAggSup, SSDataBlock SColumnInfoData* pGroupCol = taosArrayGet(pBlock->pDataBlock, GROUPID_COLUMN_INDEX); uint64_t* groupIds = (uint64_t*)pGroupCol->pData; - SColumnInfoData* pCalStartCol = taosArrayGet(pBlock->pDataBlock, CALCULATE_START_TS_COLUMN_INDEX); - TSKEY* tsCalStarts = (TSKEY*)pCalStartCol->pData; - SColumnInfoData* pCalEndCol = taosArrayGet(pBlock->pDataBlock, CALCULATE_END_TS_COLUMN_INDEX); - TSKEY* tsCalEnds = (TSKEY*)pCalEndCol->pData; + SColumnInfoData* pStartCol = taosArrayGet(pBlock->pDataBlock, START_TS_COLUMN_INDEX); + TSKEY* tsStarts = (TSKEY*)pStartCol->pData; + SColumnInfoData* pEndCol = taosArrayGet(pBlock->pDataBlock, END_TS_COLUMN_INDEX); + TSKEY* tsEnds = (TSKEY*)pEndCol->pData; for (int32_t i = 0; i < pBlock->info.rows; i++) { + TSKEY ts = tsStarts[i]; + TSKEY endCalTs = tsEnds[i]; + uint64_t groupId = groupIds[i]; + SWinKey key = {.ts = ts, .groupId = groupId}; while (1) { - TSKEY ts = tsCalStarts[i]; - TSKEY endCalTs = tsCalEnds[i]; - uint64_t groupId = groupIds[i]; - SWinKey key = {.ts = ts, .groupId = groupId}; SWinKey nextKey = {.groupId = groupId}; code = pAggSup->stateStore.streamStateFillGetNext(pAggSup->pState, &key, &nextKey, NULL, NULL, &winCode); QUERY_CHECK_CODE(code, lino, _end); @@ -1424,8 +1402,6 @@ static int32_t doDeleteTimeSliceResult(SStreamAggSupporter* pAggSup, SSDataBlock break; } (void)tSimpleHashRemove(pUpdatedMap, &key, sizeof(SWinKey)); - void* tmp = taosArrayPush(pDelWins, &key); - QUERY_CHECK_NULL(tmp, code, lino, _end, terrno); pAggSup->stateStore.streamStateDel(pAggSup->pState, &key); if (winCode != TSDB_CODE_SUCCESS) { @@ -1526,9 +1502,15 @@ static int32_t doStreamTimeSliceNext(SOperatorInfo* pOperator, SSDataBlock** ppR setStreamOperatorState(&pInfo->basic, pBlock->info.type); switch (pBlock->info.type) { - case STREAM_DELETE_RESULT: { + case STREAM_DELETE_RESULT: + case STREAM_DELETE_DATA: { code = doDeleteTimeSliceResult(pAggSup, pBlock, pInfo->pUpdatedMap, pInfo->pDelWins); QUERY_CHECK_CODE(code, lino, _end); + copyDataBlock(pInfo->pDelRes, pBlock); + pInfo->pDelRes->info.type = STREAM_DELETE_RESULT; + (*ppRes) = pInfo->pDelRes; + printDataBlock((*ppRes), getStreamOpName(pOperator->operatorType), GET_TASKID(pTaskInfo)); + goto _end; } break; case STREAM_NORMAL: case STREAM_INVALID: { @@ -1560,9 +1542,7 @@ static int32_t doStreamTimeSliceNext(SOperatorInfo* pOperator, SSDataBlock** ppR doStreamTimeSliceImpl(pOperator, pBlock); } - if (!pInfo->destHasPrimaryKey) { - removeDeleteResults(pInfo->pUpdatedMap, pInfo->pDelWins); - } else { + if (pInfo->destHasPrimaryKey) { copyIntervalDeleteKey(pInfo->pDeletedMap, pInfo->pDelWins); } @@ -1665,6 +1645,44 @@ int32_t getDownstreamRes(SOperatorInfo* downstream, SSDataBlock** ppRes) { return TSDB_CODE_FAILED; } +int32_t initTimeSliceDownStream(SOperatorInfo* downstream, SStreamAggSupporter* pAggSup, uint16_t type, + int32_t tsColIndex, STimeWindowAggSupp* pTwSup, struct SSteamOpBasicInfo* pBasic, + SStreamFillSupporter* pFillSup) { + SExecTaskInfo* pTaskInfo = downstream->pTaskInfo; + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; + if (downstream->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_PARTITION) { + SStreamPartitionOperatorInfo* pScanInfo = downstream->info; + pScanInfo->tsColIndex = tsColIndex; + } + + if (downstream->operatorType != QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN) { + code = initTimeSliceDownStream(downstream->pDownstream[0], pAggSup, type, tsColIndex, pTwSup, pBasic, pFillSup); + return code; + } + SStreamScanInfo* pScanInfo = downstream->info; + pScanInfo->igCheckUpdate = true; + pScanInfo->windowSup = (SWindowSupporter){.pStreamAggSup = pAggSup, .gap = pAggSup->gap, .parentType = type}; + pScanInfo->pState = pAggSup->pState; + if (!pScanInfo->pUpdateInfo) { + code = pAggSup->stateStore.updateInfoInit(60000, TSDB_TIME_PRECISION_MILLI, pTwSup->waterMark, + pScanInfo->igCheckUpdate, pScanInfo->pkColType, pScanInfo->pkColLen, + &pScanInfo->pUpdateInfo); + QUERY_CHECK_CODE(code, lino, _end); + } + pScanInfo->twAggSup = *pTwSup; + pScanInfo->pFillSup = pFillSup; + pScanInfo->interval = pFillSup->interval; + pAggSup->pUpdateInfo = pScanInfo->pUpdateInfo; + pBasic->primaryPkIndex = pScanInfo->primaryKeyIndex; + +_end: + if (code != TSDB_CODE_SUCCESS) { + qError("%s failed at line %d since %s. task:%s", __func__, lino, tstrerror(code), GET_TASKID(pTaskInfo)); + } + return code; +} + int32_t createStreamTimeSliceOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo, SReadHandle* pHandle, SOperatorInfo** ppOptInfo) { int32_t code = TSDB_CODE_SUCCESS; @@ -1789,13 +1807,12 @@ int32_t createStreamTimeSliceOperatorInfo(SOperatorInfo* downstream, SPhysiNode* setOperatorStreamStateFn(pOperator, streamTimeSliceReleaseState, streamTimeSliceReloadState); if (downstream) { - if (downstream->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN) { - SStreamScanInfo* pScanInfo = downstream->info; - pScanInfo->igCheckUpdate = true; - } - initDownStream(downstream, &pInfo->streamAggSup, pOperator->operatorType, pInfo->primaryTsIndex, &pInfo->twAggSup, - &pInfo->basic); + code = initTimeSliceDownStream(downstream, &pInfo->streamAggSup, pOperator->operatorType, pInfo->primaryTsIndex, + &pInfo->twAggSup, &pInfo->basic, pInfo->pFillSup); + QUERY_CHECK_CODE(code, lino, _error); + code = appendDownstream(pOperator, &downstream, 1); + QUERY_CHECK_CODE(code, lino, _error); } (*ppOptInfo) = pOperator; return code; diff --git a/source/libs/stream/src/streamSliceState.c b/source/libs/stream/src/streamSliceState.c index 4ad60daec829..82d204c634ac 100644 --- a/source/libs/stream/src/streamSliceState.c +++ b/source/libs/stream/src/streamSliceState.c @@ -284,7 +284,6 @@ int32_t getHashSortPrevRow(SStreamFileState* pFileState, const SWinKey* pKey, SW } void deleteHashSortRowBuff(SStreamFileState* pFileState, const SWinKey* pKey) { - deleteRowBuff(pFileState, pKey, sizeof(SWinKey)); SSHashObj* pSearchBuff = getSearchBuff(pFileState); void** ppBuff = tSimpleHashGet(pSearchBuff, &pKey->groupId, sizeof(uint64_t)); if (!ppBuff) { diff --git a/source/libs/stream/src/streamState.c b/source/libs/stream/src/streamState.c index ed4c639aaaf2..259d89b6bd1b 100644 --- a/source/libs/stream/src/streamState.c +++ b/source/libs/stream/src/streamState.c @@ -246,10 +246,6 @@ int32_t streamStateFillGetPrev(SStreamState* pState, const SWinKey* pKey, SWinKe } void streamStateFillDel(SStreamState* pState, const SWinKey* key) { - if (pState->pFileState) { - deleteHashSortRowBuff(pState->pFileState, key); - return; - } int32_t code = streamStateFillDel_rocksdb(pState, key); qTrace("%s at line %d res %d", __func__, __LINE__, code); } diff --git a/source/libs/stream/src/tstreamFileState.c b/source/libs/stream/src/tstreamFileState.c index 522f911f6452..af8b1bfc183a 100644 --- a/source/libs/stream/src/tstreamFileState.c +++ b/source/libs/stream/src/tstreamFileState.c @@ -569,10 +569,12 @@ int32_t addRowBuffIfNotExist(SStreamFileState* pFileState, void* pKey, int32_t k pFileState->maxTs = TMAX(pFileState->maxTs, pFileState->getTs(pKey)); SRowBuffPos** pos = tSimpleHashGet(pFileState->rowStateBuff, pKey, keyLen); if (pos) { - *pVLen = pFileState->rowSize; - *pVal = *pos; - (*pos)->beUsed = true; - (*pos)->beFlushed = false; + if (pVal != NULL) { + *pVLen = pFileState->rowSize; + *pVal = *pos; + (*pos)->beUsed = true; + (*pos)->beFlushed = false; + } goto _end; } SRowBuffPos* pNewPos = getNewRowPosForWrite(pFileState); @@ -616,11 +618,17 @@ void deleteRowBuff(SStreamFileState* pFileState, const void* pKey, int32_t keyLe qTrace("%s at line %d res:%d", __func__, __LINE__, code_buff); int32_t code_file = pFileState->stateFileRemoveFn(pFileState, pKey); qTrace("%s at line %d res:%d", __func__, __LINE__, code_file); + if (pFileState->searchBuff != NULL) { + deleteHashSortRowBuff(pFileState, pKey); + } } int32_t resetRowBuff(SStreamFileState* pFileState, const void* pKey, int32_t keyLen) { int32_t code_buff = pFileState->stateBuffRemoveFn(pFileState->rowStateBuff, pKey, keyLen); int32_t code_file = pFileState->stateFileRemoveFn(pFileState, pKey); + if (pFileState->searchBuff != NULL) { + deleteHashSortRowBuff(pFileState, pKey); + } if (code_buff == TSDB_CODE_SUCCESS || code_file == TSDB_CODE_SUCCESS) { return TSDB_CODE_SUCCESS; } diff --git a/tests/script/tsim/stream/streamInterpDelete0.sim b/tests/script/tsim/stream/streamInterpDelete0.sim new file mode 100644 index 000000000000..21bac13e4a7c --- /dev/null +++ b/tests/script/tsim/stream/streamInterpDelete0.sim @@ -0,0 +1,507 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sleep 50 +sql connect + +print step1 +print =============== create database +sql create database test vgroups 1; +sql use test; + +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 every(1s) fill(prev); + +run tsim/stream/checkTaskStatus.sim + + +sql insert into t1 values(1648791212001,1,1,1,1.0) (1648791214000,8,1,1,1.0) (1648791215000,10,1,1,1.0) (1648791215009,15,1,1,1.0) (1648791217001,4,1,1,1.0); + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(prev); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(prev); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 + +loop0: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows != 5 then + print ======rows=$rows + goto loop0 +endi + +# row 0 +if $data01 != 1 then + print ======data01=$data01 + goto loop0 +endi + +if $data11 != 8 then + print ======data11=$data11 + goto loop0 +endi + +if $data21 != 10 then + print ======data21=$data21 + goto loop0 +endi + +if $data31 != 15 then + print ======data31=$data31 + goto loop0 +endi + +if $data41 != 15 then + print ======data41=$data41 + goto loop0 +endi + +print 1 sql delete from t1 where ts >= 1648791215000 and ts <= 1648791216000; +sql delete from t1 where ts >= 1648791215000 and ts <= 1648791216000; + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(prev); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(prev); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 + +loop1: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows != 5 then + print ======rows=$rows + goto loop1 +endi + +# row 0 +if $data01 != 1 then + print ======data01=$data01 + goto loop1 +endi + +if $data11 != 8 then + print ======data11=$data11 + goto loop1 +endi + +if $data21 != 8 then + print ======data21=$data21 + goto loop1 +endi + +if $data31 != 8 then + print ======data31=$data31 + goto loop1 +endi + +if $data41 != 8 then + print ======data41=$data41 + goto loop1 +endi + + +print 2 sql delete from t1 where ts >= 1648791212000 and ts <= 1648791213000; +sql delete from t1 where ts >= 1648791212000 and ts <= 1648791213000; + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(prev); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(prev); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 + +loop2: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows != 4 then + print ======rows=$rows + goto loop2 +endi + +# row 0 +if $data01 != 8 then + print ======data01=$data01 + goto loop2 +endi + +if $data11 != 8 then + print ======data11=$data11 + goto loop2 +endi + +if $data21 != 8 then + print ======data21=$data21 + goto loop2 +endi + +if $data31 != 8 then + print ======data31=$data31 + goto loop2 +endi + +print 3 sql delete from t1 where ts >= 1648791217000 and ts <= 1648791218000; +sql delete from t1 where ts >= 1648791217000 and ts <= 1648791218000 + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(prev); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(prev); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 + +loop3: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows != 1 then + print ======rows=$rows + goto loop3 +endi + +# row 0 +if $data01 != 8 then + print ======data01=$data01 + goto loop3 +endi + + +print step2 +print =============== create database +sql create database test2 vgroups 1; +sql use test2; + +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 every(1s) fill(next); + +run tsim/stream/checkTaskStatus.sim + +sql insert into t1 values(1648791212001,1,1,1,1.0) (1648791214000,8,1,1,1.0) (1648791215000,10,1,1,1.0) (1648791215009,15,1,1,1.0) (1648791217001,4,1,1,1.0); + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(next); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(next); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 + +loop4: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows != 5 then + print ======rows=$rows + goto loop4 +endi + +# row 0 +if $data01 != 8 then + print ======data01=$data01 + goto loop4 +endi + +if $data11 != 8 then + print ======data11=$data11 + goto loop4 +endi + +if $data21 != 10 then + print ======data21=$data21 + goto loop4 +endi + +if $data31 != 4 then + print ======data31=$data31 + goto loop4 +endi + +if $data41 != 4 then + print ======data41=$data41 + goto loop4 +endi + +print 1 sql delete from t1 where ts >= 1648791215000 and ts <= 1648791216000; +sql delete from t1 where ts >= 1648791215000 and ts <= 1648791216000; + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(next); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(next); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 + +loop5: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows != 5 then + print ======rows=$rows + goto loop5 +endi + +# row 0 +if $data01 != 8 then + print ======data01=$data01 + goto loop5 +endi + +if $data11 != 8 then + print ======data11=$data11 + goto loop5 +endi + +if $data21 != 4 then + print ======data21=$data21 + goto loop5 +endi + +if $data31 != 4 then + print ======data31=$data31 + goto loop5 +endi + +if $data41 != 4 then + print ======data41=$data41 + goto loop5 +endi + + +print 2 sql delete from t1 where ts >= 1648791212000 and ts <= 1648791213000; +sql delete from t1 where ts >= 1648791212000 and ts <= 1648791213000; + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(next); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(next); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 + +loop6: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows != 4 then + print ======rows=$rows + goto loop6 +endi + +# row 0 +if $data01 != 8 then + print ======data01=$data01 + goto loop6 +endi + +if $data11 != 4 then + print ======data11=$data11 + goto loop6 +endi + +if $data21 != 4 then + print ======data21=$data21 + goto loop6 +endi + +if $data31 != 4 then + print ======data31=$data31 + goto loop6 +endi + +print 3 sql delete from t1 where ts >= 1648791217000 and ts <= 1648791218000; +sql delete from t1 where ts >= 1648791217000 and ts <= 1648791218000 + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(next); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(next); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 + +loop7: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows != 1 then + print ======rows=$rows + goto loop7 +endi + +# row 0 +if $data01 != 8 then + print ======data01=$data01 + goto loop7 +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/stream/streamInterpDelete1.sim b/tests/script/tsim/stream/streamInterpDelete1.sim new file mode 100644 index 000000000000..162da175e8be --- /dev/null +++ b/tests/script/tsim/stream/streamInterpDelete1.sim @@ -0,0 +1,508 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sleep 50 +sql connect + +print step1 +print =============== create database +sql create database test vgroups 1; +sql use test; + +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 every(1s) fill(NULL); + +run tsim/stream/checkTaskStatus.sim + + +sql insert into t1 values(1648791212001,1,1,1,1.0) (1648791214000,8,1,1,1.0) (1648791215000,10,1,1,1.0) (1648791215009,15,1,1,1.0) (1648791217001,4,1,1,1.0); + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(NULL); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(NULL); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 + +loop0: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows != 5 then + print ======rows=$rows + goto loop0 +endi + +# row 0 +if $data01 != NULL then + print ======data01=$data01 + goto loop0 +endi + +if $data11 != 8 then + print ======data11=$data11 + goto loop0 +endi + +if $data21 != 10 then + print ======data21=$data21 + goto loop0 +endi + +if $data31 != NULL then + print ======data31=$data31 + goto loop0 +endi + +if $data41 != NULL then + print ======data41=$data41 + goto loop0 +endi + +print 1 sql delete from t1 where ts >= 1648791215000 and ts <= 1648791216000; +sql delete from t1 where ts >= 1648791215000 and ts <= 1648791216000; + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(NULL); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(NULL); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 + +loop1: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows != 5 then + print ======rows=$rows + goto loop1 +endi + +# row 0 +if $data01 != NULL then + print ======data01=$data01 + goto loop1 +endi + +if $data11 != 8 then + print ======data11=$data11 + goto loop1 +endi + +if $data21 != NULL then + print ======data21=$data21 + goto loop1 +endi + +if $data31 != NULL then + print ======data31=$data31 + goto loop1 +endi + +if $data41 != NULL then + print ======data41=$data41 + goto loop1 +endi + + +print 2 sql delete from t1 where ts >= 1648791212000 and ts <= 1648791213000; +sql delete from t1 where ts >= 1648791212000 and ts <= 1648791213000; + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(NULL); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(NULL); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 + +loop2: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows != 4 then + print ======rows=$rows + goto loop2 +endi + +# row 0 +if $data01 != 8 then + print ======data01=$data01 + goto loop2 +endi + +if $data11 != NULL then + print ======data11=$data11 + goto loop2 +endi + +if $data21 != NULL then + print ======data21=$data21 + goto loop2 +endi + +if $data31 != NULL then + print ======data31=$data31 + goto loop2 +endi + +print 3 sql delete from t1 where ts >= 1648791217000 and ts <= 1648791218000; +sql delete from t1 where ts >= 1648791217000 and ts <= 1648791218000 + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(NULL); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(NULL); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 + +loop3: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows != 1 then + print ======rows=$rows + goto loop3 +endi + +# row 0 +if $data01 != 8 then + print ======data01=$data01 + goto loop3 +endi + + +print step2 +print =============== create database +sql create database test2 vgroups 1; +sql use test2; + +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 every(1s) fill(value,100,200,300,400); + +run tsim/stream/checkTaskStatus.sim + +sql insert into t1 values(1648791212001,1,1,1,1.0) (1648791214000,8,1,1,1.0) (1648791215000,10,1,1,1.0) (1648791215009,15,1,1,1.0) (1648791217001,4,1,1,1.0); + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(value,100,200,300,400); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(value,100,200,300,400); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 + +loop4: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows != 5 then + print ======rows=$rows + goto loop4 +endi + +# row 0 +if $data01 != 100 then + print ======data01=$data01 + goto loop4 +endi + +if $data11 != 8 then + print ======data11=$data11 + goto loop4 +endi + +if $data21 != 10 then + print ======data21=$data21 + goto loop4 +endi + +if $data31 != 100 then + print ======data31=$data31 + goto loop4 +endi + +if $data41 != 100 then + print ======data41=$data41 + goto loop4 +endi + +print 1 sql delete from t1 where ts >= 1648791215000 and ts <= 1648791216000; +sql delete from t1 where ts >= 1648791215000 and ts <= 1648791216000; + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(value,100,200,300,400); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(value,100,200,300,400); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 + +loop5: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows != 5 then + print ======rows=$rows + goto loop5 +endi + +# row 0 +if $data01 != 100 then + print ======data01=$data01 + goto loop5 +endi + +if $data11 != 8 then + print ======data11=$data11 + goto loop5 +endi + +if $data21 != 100 then + print ======data21=$data21 + goto loop5 +endi + +if $data31 != 100 then + print ======data31=$data31 + goto loop5 +endi + +if $data41 != 100 then + print ======data41=$data41 + goto loop5 +endi + + +print 2 sql delete from t1 where ts >= 1648791212000 and ts <= 1648791213000; +sql delete from t1 where ts >= 1648791212000 and ts <= 1648791213000; + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(value,100,200,300,400); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(value,100,200,300,400); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 + +loop6: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows != 4 then + print ======rows=$rows + goto loop6 +endi + +# row 0 +if $data01 != 8 then + print ======data01=$data01 + goto loop6 +endi + +if $data11 != 100 then + print ======data11=$data11 + goto loop6 +endi + +if $data21 != 100 then + print ======data21=$data21 + goto loop6 +endi + +if $data31 != 100 then + print ======data31=$data31 + goto loop6 +endi + +print 3 sql delete from t1 where ts >= 1648791217000 and ts <= 1648791218000; +sql delete from t1 where ts >= 1648791217000 and ts <= 1648791218000 + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(value,100,200,300,400); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(value,100,200,300,400); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 + +loop7: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows != 1 then + print ======rows=$rows + goto loop7 +endi + +# row 0 +if $data01 != 8 then + print ======data01=$data01 + goto loop7 +endi + + +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/stream/streamInterpDelete2.sim b/tests/script/tsim/stream/streamInterpDelete2.sim new file mode 100644 index 000000000000..be27dcda492b --- /dev/null +++ b/tests/script/tsim/stream/streamInterpDelete2.sim @@ -0,0 +1,258 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sleep 50 +sql connect + +print step1 +print =============== create database +sql create database test vgroups 1; +sql use test; + +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 every(1s) fill(linear); + +run tsim/stream/checkTaskStatus.sim + + +sql insert into t1 values(1648791212001,1,1,1,1.0) (1648791214000,8,1,1,1.0) (1648791215000,10,1,1,1.0) (1648791215009,15,1,1,1.0) (1648791217001,4,1,1,1.0); + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(linera); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(linear); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 + +loop0: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows != 5 then + print ======rows=$rows + goto loop0 +endi + +# row 0 +if $data01 != 4 then + print ======data01=$data01 + goto loop0 +endi + +if $data11 != 8 then + print ======data11=$data11 + goto loop0 +endi + +if $data21 != 10 then + print ======data21=$data21 + goto loop0 +endi + +if $data31 != 9 then + print ======data31=$data31 + goto loop0 +endi + +if $data41 != 4 then + print ======data41=$data41 + goto loop0 +endi + +print 1 sql delete from t1 where ts >= 1648791215000 and ts <= 1648791216000; +sql delete from t1 where ts >= 1648791215000 and ts <= 1648791216000; + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(linear); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(linear); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 + +loop1: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows != 5 then + print ======rows=$rows + goto loop1 +endi + +# row 0 +if $data01 != 4 then + print ======data01=$data01 + goto loop1 +endi + +if $data11 != 8 then + print ======data11=$data11 + goto loop1 +endi + +if $data21 != 6 then + print ======data21=$data21 + goto loop1 +endi + +if $data31 != 5 then + print ======data31=$data31 + goto loop1 +endi + +if $data41 != 4 then + print ======data41=$data41 + goto loop1 +endi + + +print 2 sql delete from t1 where ts >= 1648791212000 and ts <= 1648791213000; +sql delete from t1 where ts >= 1648791212000 and ts <= 1648791213000; + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(linear); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(linear); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 + +loop2: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows != 4 then + print ======rows=$rows + goto loop2 +endi + +# row 0 +if $data01 != 8 then + print ======data01=$data01 + goto loop2 +endi + +if $data11 != 6 then + print ======data11=$data11 + goto loop2 +endi + +if $data21 != 5 then + print ======data21=$data21 + goto loop2 +endi + +if $data31 != 4 then + print ======data31=$data31 + goto loop2 +endi + +print 3 sql delete from t1 where ts >= 1648791217000 and ts <= 1648791218000; +sql delete from t1 where ts >= 1648791217000 and ts <= 1648791218000 + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(linear); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(linear); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 + +loop3: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows != 1 then + print ======rows=$rows + goto loop3 +endi + +# row 0 +if $data01 != 8 then + print ======data01=$data01 + goto loop3 +endi + + +system sh/exec.sh -n dnode1 -s stop -x SIGINT From 1c1ae93771148af8366693204870eb6dd74c90c3 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Fri, 16 Aug 2024 11:12:59 +0800 Subject: [PATCH 035/695] add ci --- .../tsim/stream/streamInterpLinear1.sim | 239 ++++++++++++++++++ .../script/tsim/stream/streamInterpNext1.sim | 239 ++++++++++++++++++ 2 files changed, 478 insertions(+) create mode 100644 tests/script/tsim/stream/streamInterpLinear1.sim create mode 100644 tests/script/tsim/stream/streamInterpNext1.sim diff --git a/tests/script/tsim/stream/streamInterpLinear1.sim b/tests/script/tsim/stream/streamInterpLinear1.sim new file mode 100644 index 000000000000..5151c47f62b9 --- /dev/null +++ b/tests/script/tsim/stream/streamInterpLinear1.sim @@ -0,0 +1,239 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sleep 50 +sql connect + +print step1 +print =============== create database +sql create database test vgroups 1; +sql use test; + +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 every(1s) fill(linear); + +run tsim/stream/checkTaskStatus.sim + + +sql insert into t1 values(1648791213000,1,1,1,1.0); + +$loop_count = 0 + +loop0: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 +print $data10 $data11 $data12 $data13 + +# row 0 +if $rows != 1 then + print ======rows=$rows + goto loop0 +endi + +# row 0 +if $data01 != 1 then + print ======data01=$data01 + goto loop0 +endi + + +sql insert into t1 values(1648791213009,30,3,3,1.0) (1648791217001,4,4,4,4.1); + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791213000, 1648791217001) every(1s) fill(linear); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791213000, 1648791217001) every(1s) fill(linear); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +$loop_count = 0 +loop2: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 2 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +# row 0 +if $rows != 5 then + print ======rows=$rows + goto loop2 +endi + +# row 0 +if $data01 != 1 then + print ======data01=$data01 + goto loop2 +endi + +if $data11 != 23 then + print ======data11=$data11 + goto loop2 +endi + +if $data21 != 17 then + print ======data21=$data21 + goto loop2 +endi + +if $data31 != 10 then + print ======data31=$data31 + goto loop2 +endi + +if $data41 != 4 then + print ======data41=$data41 + goto loop2 +endi + + +print step2 + +sql create database test2 vgroups 1; +sql use test2; + +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 every(1s) fill(linear); + +run tsim/stream/checkTaskStatus.sim + +sql insert into t1 values(1648791213000,1,1,1,1.0); + + +$loop_count = 0 + +loop3: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 +print $data10 $data11 $data12 $data13 + +# row 0 +if $rows != 1 then + print ======rows=$rows + goto loop3 +endi + +# row 0 +if $data01 != 1 then + print ======data01=$data01 + goto loop3 +endi + + +sql insert into t1 values(1648791213009,30,3,3,1.0) (1648791217001,4,4,4,4.1) (1648791219000,50,5,5,5.1); + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791213000, 1648791219000) every(1s) fill(linear); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791213000, 1648791219000) every(1s) fill(linear); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 +print $data60 $data61 $data62 $data63 $data64 +print $data70 $data71 $data72 $data73 $data74 + + +$loop_count = 0 +loop4: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 2 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 +print $data60 $data61 $data62 $data63 $data64 +print $data70 $data71 $data72 $data73 $data74 + +# row 0 +if $rows != 7 then + print ======rows=$rows + goto loop4 +endi + +# row 0 +if $data01 != 1 then + print ======data01=$data01 + goto loop4 +endi + +if $data11 != 23 then + print ======data11=$data11 + goto loop4 +endi + +if $data21 != 17 then + print ======data21=$data21 + goto loop4 +endi + +if $data31 != 10 then + print ======data31=$data31 + goto loop4 +endi + +if $data41 != 4 then + print ======data41=$data41 + goto loop4 +endi + +if $data51 != 26 then + print ======data51=$data51 + goto loop4 +endi + +if $data61 != 50 then + print ======data61=$data61 + goto loop4 +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/stream/streamInterpNext1.sim b/tests/script/tsim/stream/streamInterpNext1.sim new file mode 100644 index 000000000000..9d86ba51354d --- /dev/null +++ b/tests/script/tsim/stream/streamInterpNext1.sim @@ -0,0 +1,239 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sleep 50 +sql connect + +print step1 +print =============== create database +sql create database test vgroups 1; +sql use test; + +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 every(1s) fill(next); + +run tsim/stream/checkTaskStatus.sim + + +sql insert into t1 values(1648791213000,1,1,1,1.0); + +$loop_count = 0 + +loop0: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 +print $data10 $data11 $data12 $data13 + +# row 0 +if $rows != 1 then + print ======rows=$rows + goto loop0 +endi + +# row 0 +if $data01 != 1 then + print ======data01=$data01 + goto loop0 +endi + + +sql insert into t1 values(1648791213009,3,3,3,1.0) (1648791217001,4,4,4,4.1); + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791213000, 1648791217001) every(1s) fill(next); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791213000, 1648791217001) every(1s) fill(next); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +$loop_count = 0 +loop2: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 2 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +# row 0 +if $rows != 5 then + print ======rows=$rows + goto loop2 +endi + +# row 0 +if $data01 != 1 then + print ======data01=$data01 + goto loop2 +endi + +if $data11 != 4 then + print ======data11=$data11 + goto loop2 +endi + +if $data21 != 4 then + print ======data21=$data21 + goto loop2 +endi + +if $data31 != 4 then + print ======data31=$data31 + goto loop2 +endi + +if $data41 != 4 then + print ======data41=$data41 + goto loop2 +endi + + +print step2 + +sql create database test2 vgroups 1; +sql use test2; + +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 every(1s) fill(next); + +run tsim/stream/checkTaskStatus.sim + +sql insert into t1 values(1648791213000,1,1,1,1.0); + + +$loop_count = 0 + +loop3: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 +print $data10 $data11 $data12 $data13 + +# row 0 +if $rows != 1 then + print ======rows=$rows + goto loop3 +endi + +# row 0 +if $data01 != 1 then + print ======data01=$data01 + goto loop3 +endi + + +sql insert into t1 values(1648791213009,3,3,3,1.0) (1648791217001,4,4,4,4.1) (1648791219000,5,5,5,5.1); + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791213000, 1648791219000) every(1s) fill(next); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791213000, 1648791219000) every(1s) fill(next); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 +print $data60 $data61 $data62 $data63 $data64 +print $data70 $data71 $data72 $data73 $data74 + + +$loop_count = 0 +loop4: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 2 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 +print $data60 $data61 $data62 $data63 $data64 +print $data70 $data71 $data72 $data73 $data74 + +# row 0 +if $rows != 7 then + print ======rows=$rows + goto loop4 +endi + +# row 0 +if $data01 != 1 then + print ======data01=$data01 + goto loop4 +endi + +if $data11 != 4 then + print ======data11=$data11 + goto loop4 +endi + +if $data21 != 4 then + print ======data21=$data21 + goto loop4 +endi + +if $data31 != 4 then + print ======data31=$data31 + goto loop4 +endi + +if $data41 != 4 then + print ======data41=$data41 + goto loop4 +endi + +if $data51 != 5 then + print ======data51=$data51 + goto loop4 +endi + +if $data61 != 5 then + print ======data61=$data61 + goto loop4 +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT From ab5848f29c17420b85be64877fbc2fc33f3cd79a Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Fri, 16 Aug 2024 11:29:27 +0800 Subject: [PATCH 036/695] add ci --- .../script/tsim/stream/streamInterpNext0.sim | 36 ++++++++++----- .../script/tsim/stream/streamInterpPrev0.sim | 36 ++++++++++----- .../script/tsim/stream/streamInterpValue0.sim | 46 +++++++++++++------ 3 files changed, 83 insertions(+), 35 deletions(-) diff --git a/tests/script/tsim/stream/streamInterpNext0.sim b/tests/script/tsim/stream/streamInterpNext0.sim index da76354e073e..605144378e3c 100644 --- a/tests/script/tsim/stream/streamInterpNext0.sim +++ b/tests/script/tsim/stream/streamInterpNext0.sim @@ -306,11 +306,11 @@ sql create stream streams3 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into run tsim/stream/checkTaskStatus.sim -sql insert into t1 values(1648791212001,0,0,0,0.0) (1648791217001,4,4,4,4.1); +sql insert into t1 values(1648791210001,0,0,0,0.0) (1648791217001,4,4,4,4.1); -print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217000) every(1s) fill(next); -sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217000) every(1s) fill(next); +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791211000, 1648791217000) every(1s) fill(next); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791211000, 1648791217000) every(1s) fill(next); print $data00 $data01 $data02 $data03 $data04 print $data10 $data11 $data12 $data13 $data14 @@ -318,6 +318,7 @@ print $data20 $data21 $data22 $data23 $data24 print $data30 $data31 $data32 $data33 $data34 print $data40 $data41 $data42 $data43 $data44 print $data50 $data51 $data52 $data53 $data54 +print $data60 $data61 $data62 $data63 $data64 $loop_count = 0 loop5: @@ -338,18 +339,19 @@ print $data20 $data21 $data22 $data23 $data24 print $data30 $data31 $data32 $data33 $data34 print $data40 $data41 $data42 $data43 $data44 print $data50 $data51 $data52 $data53 $data54 +print $data60 $data61 $data62 $data63 $data64 # row 0 -if $rows != 5 then +if $rows != 7 then print ======rows=$rows goto loop5 endi sql insert into t1 values(1648791213001,1,1,1,1.0) (1648791213009,2,2,2,1.1) (1648791215001,5,5,5,5.1) -print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(next); -sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(next); +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791211000, 1648791217001) every(1s) fill(next); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791211000, 1648791217001) every(1s) fill(next); print $data00 $data01 $data02 $data03 $data04 print $data10 $data11 $data12 $data13 $data14 @@ -357,6 +359,7 @@ print $data20 $data21 $data22 $data23 $data24 print $data30 $data31 $data32 $data33 $data34 print $data40 $data41 $data42 $data43 $data44 print $data50 $data51 $data52 $data53 $data54 +print $data60 $data61 $data62 $data63 $data64 $loop_count = 0 loop6: @@ -377,10 +380,11 @@ print $data20 $data21 $data22 $data23 $data24 print $data30 $data31 $data32 $data33 $data34 print $data40 $data41 $data42 $data43 $data44 print $data50 $data51 $data52 $data53 $data54 +print $data60 $data61 $data62 $data63 $data64 # row 0 -if $rows != 5 then +if $rows != 7 then print ======rows=$rows goto loop6 endi @@ -391,25 +395,35 @@ if $data01 != 1 then goto loop6 endi -if $data11 != 5 then +if $data11 != 1 then print ======data11=$data11 goto loop6 endi -if $data21 != 5 then +if $data21 != 1 then print ======data21=$data21 goto loop6 endi -if $data31 != 4 then +if $data31 != 5 then print ======data31=$data31 goto loop6 endi -if $data41 != 4 then +if $data41 != 5 then print ======data41=$data41 goto loop6 endi +if $data51 != 4 then + print ======data51=$data51 + goto loop6 +endi + +if $data61 != 4 then + print ======data61=$data61 + goto loop6 +endi + print end system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/stream/streamInterpPrev0.sim b/tests/script/tsim/stream/streamInterpPrev0.sim index 9ff18d4a7141..a326fd87f14f 100644 --- a/tests/script/tsim/stream/streamInterpPrev0.sim +++ b/tests/script/tsim/stream/streamInterpPrev0.sim @@ -304,11 +304,11 @@ sql create stream streams3 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into run tsim/stream/checkTaskStatus.sim -sql insert into t1 values(1648791212001,0,0,0,0.0) (1648791217001,4,4,4,4.1); +sql insert into t1 values(1648791210001,0,0,0,0.0) (1648791217001,4,4,4,4.1); -print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217000) every(1s) fill(prev); -sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217000) every(1s) fill(prev); +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791210000, 1648791217000) every(1s) fill(prev); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791210000, 1648791217000) every(1s) fill(prev); print $data00 $data01 $data02 $data03 $data04 print $data10 $data11 $data12 $data13 $data14 @@ -316,6 +316,7 @@ print $data20 $data21 $data22 $data23 $data24 print $data30 $data31 $data32 $data33 $data34 print $data40 $data41 $data42 $data43 $data44 print $data50 $data51 $data52 $data53 $data54 +print $data60 $data61 $data62 $data63 $data64 $loop_count = 0 loop5: @@ -336,18 +337,19 @@ print $data20 $data21 $data22 $data23 $data24 print $data30 $data31 $data32 $data33 $data34 print $data40 $data41 $data42 $data43 $data44 print $data50 $data51 $data52 $data53 $data54 +print $data60 $data61 $data62 $data63 $data64 # row 0 -if $rows != 5 then +if $rows != 7 then print ======rows=$rows goto loop5 endi sql insert into t1 values(1648791213001,1,1,1,1.0) (1648791213009,2,2,2,1.1) (1648791215001,5,5,5,5.1) -print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(prev); -sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(prev); +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791210000, 1648791217001) every(1s) fill(prev); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791210000, 1648791217001) every(1s) fill(prev); print $data00 $data01 $data02 $data03 $data04 print $data10 $data11 $data12 $data13 $data14 @@ -355,6 +357,7 @@ print $data20 $data21 $data22 $data23 $data24 print $data30 $data31 $data32 $data33 $data34 print $data40 $data41 $data42 $data43 $data44 print $data50 $data51 $data52 $data53 $data54 +print $data60 $data61 $data62 $data63 $data64 $loop_count = 0 loop6: @@ -375,10 +378,11 @@ print $data20 $data21 $data22 $data23 $data24 print $data30 $data31 $data32 $data33 $data34 print $data40 $data41 $data42 $data43 $data44 print $data50 $data51 $data52 $data53 $data54 +print $data60 $data61 $data62 $data63 $data64 # row 0 -if $rows != 5 then +if $rows != 7 then print ======rows=$rows goto loop6 endi @@ -389,24 +393,34 @@ if $data01 != 0 then goto loop6 endi -if $data11 != 2 then +if $data11 != 0 then print ======data11=$data11 goto loop6 endi -if $data21 != 2 then +if $data21 != 0 then print ======data21=$data21 goto loop6 endi -if $data31 != 5 then +if $data31 != 2 then print ======data31=$data31 goto loop6 endi -if $data41 != 5 then +if $data41 != 2 then print ======data41=$data41 goto loop6 endi +if $data51 != 5 then + print ======data51=$data51 + goto loop6 +endi + +if $data61 != 5 then + print ======data61=$data61 + goto loop6 +endi + system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/stream/streamInterpValue0.sim b/tests/script/tsim/stream/streamInterpValue0.sim index 1d79d2ec1cde..bce7f0ece664 100644 --- a/tests/script/tsim/stream/streamInterpValue0.sim +++ b/tests/script/tsim/stream/streamInterpValue0.sim @@ -524,11 +524,11 @@ sql create stream streams3_2 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 in run tsim/stream/checkTaskStatus.sim -sql insert into t1 values(1648791212001,0,0,0,0.0) (1648791217001,4,4,4,4.1); +sql insert into t1 values(1648791210001,0,0,0,0.0) (1648791217001,4,4,4,4.1); -print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217000) every(1s) fill(NULL); -sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217000) every(1s) fill(NULL); +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791211000, 1648791217000) every(1s) fill(NULL); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791211000, 1648791217000) every(1s) fill(NULL); print $data00 $data01 $data02 $data03 $data04 print $data10 $data11 $data12 $data13 $data14 @@ -559,13 +559,13 @@ print $data50 $data51 $data52 $data53 $data54 # row 0 -if $rows != 5 then +if $rows != 7 then print ======rows=$rows goto loop5 endi -print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217000) every(1s) fill(value, 10,20,30,40); -sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217000) every(1s) fill(value, 10,20,30,40); +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791211000, 1648791217000) every(1s) fill(value, 10,20,30,40); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791211000, 1648791217000) every(1s) fill(value, 10,20,30,40); print $data00 $data01 $data02 $data03 $data04 print $data10 $data11 $data12 $data13 $data14 @@ -596,15 +596,15 @@ print $data50 $data51 $data52 $data53 $data54 # row 0 -if $rows != 5 then +if $rows != 7 then print ======rows=$rows goto loop5_1 endi sql insert into t1 values(1648791213001,1,1,1,1.0) (1648791213009,2,2,2,1.1) (1648791215001,5,5,5,5.1) -print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(NULL); -sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(NULL); +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791211000, 1648791217001) every(1s) fill(NULL); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791211000, 1648791217001) every(1s) fill(NULL); print $data00 $data01 $data02 $data03 $data04 print $data10 $data11 $data12 $data13 $data14 @@ -635,7 +635,7 @@ print $data50 $data51 $data52 $data53 $data54 # row 0 -if $rows != 5 then +if $rows != 7 then print ======rows=$rows goto loop6 endi @@ -666,9 +666,19 @@ if $data41 != NULL then goto loop6 endi +if $data51 != NULL then + print ======data51=$data51 + goto loop6 +endi -print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(value, 10,20,30,40); -sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791212000, 1648791217001) every(1s) fill(value, 10,20,30,40); +if $data61 != NULL then + print ======data61=$data61 + goto loop6 +endi + + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791211000, 1648791217001) every(1s) fill(value, 10,20,30,40); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791211000, 1648791217001) every(1s) fill(value, 10,20,30,40); print $data00 $data01 $data02 $data03 $data04 print $data10 $data11 $data12 $data13 $data14 @@ -699,7 +709,7 @@ print $data50 $data51 $data52 $data53 $data54 # row 0 -if $rows != 5 then +if $rows != 7 then print ======rows=$rows goto loop6_1 endi @@ -730,5 +740,15 @@ if $data41 != 10 then goto loop6_1 endi +if $data51 != 10 then + print ======data51=$data51 + goto loop6_1 +endi + +if $data61 != 10 then + print ======data61=$data61 + goto loop6_1 +endi + print end system sh/exec.sh -n dnode1 -s stop -x SIGINT From 2a66a89adcdb796efb83cdcc1b59e502774a8448 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Fri, 16 Aug 2024 16:54:45 +0800 Subject: [PATCH 037/695] add ci --- .../executor/src/streamtimesliceoperator.c | 10 +- .../script/tsim/stream/streamInterpLarge.sim | 188 ++++++++++++++ .../script/tsim/stream/streamInterpNext0.sim | 16 +- .../script/tsim/stream/streamInterpNext1.sim | 16 +- .../script/tsim/stream/streamInterpOther.sim | 245 ++++++++++++++++++ .../script/tsim/stream/streamInterpOther1.sim | 11 + .../script/tsim/stream/streamInterpPrev0.sim | 16 +- .../script/tsim/stream/streamInterpPrev1.sim | 16 +- 8 files changed, 500 insertions(+), 18 deletions(-) create mode 100644 tests/script/tsim/stream/streamInterpLarge.sim diff --git a/source/libs/executor/src/streamtimesliceoperator.c b/source/libs/executor/src/streamtimesliceoperator.c index 17840f8790fc..6cb53a36adcb 100644 --- a/source/libs/executor/src/streamtimesliceoperator.c +++ b/source/libs/executor/src/streamtimesliceoperator.c @@ -583,8 +583,8 @@ static int32_t getQualifiedRowNumAsc(SExprSupp* pExprSup, SSDataBlock* pBlock, i return rowId; } - for (int32_t i = rowId; rowId < pBlock->info.rows; i++) { - if (!checkNullRow(pExprSup, pBlock, rowId, ignoreNull)) { + for (int32_t i = rowId; i < pBlock->info.rows; i++) { + if (!checkNullRow(pExprSup, pBlock, i, ignoreNull)) { return i; } } @@ -1201,6 +1201,7 @@ static void doStreamTimeSliceImpl(SOperatorInfo* pOperator, SSDataBlock* pBlock) TSDB_ORDER_ASC); startPos += numOfWin; int32_t leftRowId = getQualifiedRowNumDesc(pExprSup, pBlock, tsCols, startPos - 1, pInfo->ignoreNull); + ASSERT(leftRowId >= 0); left = needAdjustValue(&nextPoint, tsCols[leftRowId], true, pFillSup->type); if (left) { transBlockToResultRow(pBlock, leftRowId, tsCols[leftRowId], nextPoint.pLeftRow); @@ -1314,6 +1315,10 @@ void doBuildTimeSlicePointResult(SStreamAggSupporter* pAggSup, SStreamFillSuppor releaseOutputBuf(pAggSup->pState, curPoint.pResPos, &pAggSup->stateStore); releaseOutputBuf(pAggSup->pState, prevPoint.pResPos, &pAggSup->stateStore); releaseOutputBuf(pAggSup->pState, nextPoint.pResPos, &pAggSup->stateStore); + if (pBlock->info.rows >= pBlock->info.capacity) { + pGroupResInfo->index++; + break; + } } _end: @@ -1540,6 +1545,7 @@ static int32_t doStreamTimeSliceNext(SOperatorInfo* pOperator, SSDataBlock** ppR } doStreamTimeSliceImpl(pOperator, pBlock); + pInfo->twAggSup.maxTs = TMAX(pInfo->twAggSup.maxTs, pBlock->info.window.ekey); } if (pInfo->destHasPrimaryKey) { diff --git a/tests/script/tsim/stream/streamInterpLarge.sim b/tests/script/tsim/stream/streamInterpLarge.sim new file mode 100644 index 000000000000..85203d2d9e33 --- /dev/null +++ b/tests/script/tsim/stream/streamInterpLarge.sim @@ -0,0 +1,188 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sleep 50 +sql connect + +print step1 +print =============== create database +sql create database test vgroups 1; +sql use test; + +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 every(1s) fill(prev); + +run tsim/stream/checkTaskStatus.sim + + +sql insert into t1 values(1648700000000,1,1,1,1.0) (1648710000000,100,100,100,100.0) (1648720000000,10,10,10,10.0); + +$loop_count = 0 + +loop0: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 30 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 +print $data10 $data11 $data12 $data13 + +# row 0 +if $rows != 20001 then + print ======rows=$rows + goto loop0 +endi + +print step2 +print =============== create database +sql create database test2 vgroups 1; +sql use test2; + +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 every(1s) fill(next); + +run tsim/stream/checkTaskStatus.sim + + +sql insert into t1 values(1648700000000,1,1,1,1.0) (1648710000000,100,100,100,100.0) (1648720000000,10,10,10,10.0); + +$loop_count = 0 + +loop2: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 30 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 +print $data10 $data11 $data12 $data13 + +# row 0 +if $rows != 20001 then + print ======rows=$rows + goto loop2 +endi + +print step3 +print =============== create database +sql create database test3 vgroups 1; +sql use test3; + +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stream streams3 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 every(1s) fill(NULL); + +run tsim/stream/checkTaskStatus.sim + + +sql insert into t1 values(1648700000000,1,1,1,1.0) (1648710000000,100,100,100,100.0) (1648720000000,10,10,10,10.0); + +$loop_count = 0 + +loop3: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 30 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 +print $data10 $data11 $data12 $data13 + +# row 0 +if $rows != 20001 then + print ======rows=$rows + goto loop3 +endi + +print step4 +print =============== create database +sql create database test4 vgroups 1; +sql use test4; + +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stream streams4 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 every(1s) fill(value, 1,2,3,4); + +run tsim/stream/checkTaskStatus.sim + + +sql insert into t1 values(1648700000000,1,1,1,1.0) (1648710000000,100,100,100,100.0) (1648720000000,10,10,10,10.0); + +$loop_count = 0 + +loop4: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 30 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 +print $data10 $data11 $data12 $data13 + +# row 0 +if $rows != 20001 then + print ======rows=$rows + goto loop4 +endi + +print step5 +print =============== create database +sql create database test5 vgroups 1; +sql use test5; + +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stream streams5 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 every(1s) fill(linear); + +run tsim/stream/checkTaskStatus.sim + + +sql insert into t1 values(1648700000000,1,1,1,1.0) (1648710000000,100,100,100,100.0) (1648720000000,10,10,10,10.0); + +$loop_count = 0 + +loop5: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 30 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 +print $data10 $data11 $data12 $data13 + +# row 0 +if $rows != 20001 then + print ======rows=$rows + goto loop5 +endi + + +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/stream/streamInterpNext0.sim b/tests/script/tsim/stream/streamInterpNext0.sim index 605144378e3c..abdbeda63495 100644 --- a/tests/script/tsim/stream/streamInterpNext0.sim +++ b/tests/script/tsim/stream/streamInterpNext0.sim @@ -31,8 +31,12 @@ endi print 0 sql select * from streamt; sql select * from streamt; -print $data00 $data01 $data02 $data03 -print $data10 $data11 $data12 $data13 +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 # row 0 if $rows != 1 then @@ -64,8 +68,12 @@ endi print 1 sql select * from streamt; sql select * from streamt; -print $data00 $data01 $data02 $data03 -print $data10 $data11 $data12 $data13 +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 # row 0 if $rows != 1 then diff --git a/tests/script/tsim/stream/streamInterpNext1.sim b/tests/script/tsim/stream/streamInterpNext1.sim index 9d86ba51354d..d924c82a502a 100644 --- a/tests/script/tsim/stream/streamInterpNext1.sim +++ b/tests/script/tsim/stream/streamInterpNext1.sim @@ -31,8 +31,12 @@ endi print 0 sql select * from streamt; sql select * from streamt; -print $data00 $data01 $data02 $data03 -print $data10 $data11 $data12 $data13 +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 # row 0 if $rows != 1 then @@ -141,8 +145,12 @@ endi print 0 sql select * from streamt; sql select * from streamt; -print $data00 $data01 $data02 $data03 -print $data10 $data11 $data12 $data13 +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 # row 0 if $rows != 1 then diff --git a/tests/script/tsim/stream/streamInterpOther.sim b/tests/script/tsim/stream/streamInterpOther.sim index 8af1274bb6e4..8553e67ec877 100644 --- a/tests/script/tsim/stream/streamInterpOther.sim +++ b/tests/script/tsim/stream/streamInterpOther.sim @@ -360,4 +360,249 @@ if $rows != 0 then goto loop3 endi + +print step4 +print =============== create database +sql drop database if exists test4; +sql create database test4 vgroups 4; +sql use test4; + +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stream streams4_1 trigger at_once watermark 10s IGNORE EXPIRED 1 IGNORE UPDATE 0 into streamt4_1 as select interp(a, 1), _isfilled as a1 from t1 every(1s) fill(prev); +sql create stream streams4_2 trigger at_once watermark 10s IGNORE EXPIRED 1 IGNORE UPDATE 0 into streamt4_2 as select interp(a, 1), _isfilled as a1 from t1 every(1s) fill(next); +sql create stream streams4_3 trigger at_once watermark 10s IGNORE EXPIRED 1 IGNORE UPDATE 0 into streamt4_3 as select interp(a, 1), _isfilled as a1 from t1 every(1s) fill(linear); +sql create stream streams4_4 trigger at_once watermark 10s IGNORE EXPIRED 1 IGNORE UPDATE 0 into streamt4_4 as select interp(a, 1), _isfilled as a1 from t1 every(1s) fill(NULL); +sql create stream streams4_5 trigger at_once watermark 10s IGNORE EXPIRED 1 IGNORE UPDATE 0 into streamt4_5 as select interp(a, 1), _isfilled as a1 from t1 every(1s) fill(value,11); + +run tsim/stream/checkTaskStatus.sim + +sql insert into t1 values(1648791275000,NULL,0,0,0.0); + +sleep 500 + +sql insert into t1 values(1648791276000,NULL,1,0,0.0) (1648791277000,NULL,2,0,0.0) (1648791275000,NULL,3,0,0.0); + +$loop_count = 0 +loop4: + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +sleep 300 + +print sql select * from streamt4_1; +sql select * from streamt4_1; + +if $rows != 0 then + print ======rows=$rows + goto loop4 +endi + +print sql select * from streamt4_2; +sql select * from streamt4_2; + +if $rows != 0 then + print ======rows=$rows + goto loop4 +endi + +print sql select * from streamt4_3; +sql select * from streamt4_3; + +if $rows != 0 then + print ======rows=$rows + goto loop4 +endi + +print sql select * from streamt4_4; +sql select * from streamt4_4; + +if $rows != 0 then + print ======rows=$rows + goto loop4 +endi + +print sql select * from streamt4_5; +sql select * from streamt4_5; + +if $rows != 0 then + print ======rows=$rows + goto loop4 +endi + +print step4_2 + +print sql insert into t1 values(1648791215000,1,0,0,0.0); +sql insert into t1 values(1648791215000,1,0,0,0.0); +sleep 500 + +sql insert into t1 values(1648791216000,2,1,0,0.0) (1648791217000,3,2,0,0.0) (1648791215000,4,3,0,0.0); + +$loop_count = 0 +loop5: + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +sleep 300 + +print sql select * from streamt4_1; +sql select * from streamt4_1; + +if $rows != 0 then + print ======rows=$rows + goto loop5 +endi + +print sql select * from streamt4_2; +sql select * from streamt4_2; + +if $rows != 0 then + print ======rows=$rows + goto loop5 +endi + +print sql select * from streamt4_3; +sql select * from streamt4_3; + +if $rows != 0 then + print ======rows=$rows + goto loop5 +endi + +print sql select * from streamt4_4; +sql select * from streamt4_4; + +if $rows != 0 then + print ======rows=$rows + goto loop5 +endi + +print sql select * from streamt4_5; +sql select * from streamt4_5; + +if $rows != 0 then + print ======rows=$rows + goto loop5 +endi + +print step4_3 + +print sql insert into t1 values(1648791278000,NULL,2,0,0.0) (1648791278001,NULL,2,0,0.0) (1648791279000,1,2,0,0.0) (1648791279001,NULL,2,0,0.0) (1648791280000,NULL,2,0,0.0)(1648791280001,NULL,2,0,0.0)(1648791281000,20,2,0,0.0) (1648791281001,NULL,2,0,0.0)(1648791281002,NULL,2,0,0.0) (1648791282000,NULL,2,0,0.0); +sql insert into t1 values(1648791278000,NULL,2,0,0.0) (1648791278001,NULL,2,0,0.0) (1648791279000,1,2,0,0.0) (1648791279001,NULL,2,0,0.0) (1648791280000,NULL,2,0,0.0)(1648791280001,NULL,2,0,0.0)(1648791281000,20,2,0,0.0) (1648791281001,NULL,2,0,0.0)(1648791281002,NULL,2,0,0.0) (1648791282000,NULL,2,0,0.0); + +$loop_count = 0 +loop6: + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +sleep 300 + +print sql select * from streamt4_1; +sql select * from streamt4_1; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +if $rows != 3 then + print ======rows=$rows + goto loop6 +endi + +if $data12 != 1 then + print ======data12=$data12 + goto loop6 +endi + +print sql select * from streamt4_2; +sql select * from streamt4_2; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +if $rows != 3 then + print ======rows=$rows + goto loop6 +endi + +if $data12 != 1 then + print ======data12=$data12 + goto loop6 +endi + +print sql select * from streamt4_3; +sql select * from streamt4_3; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +if $rows != 3 then + print ======rows=$rows + goto loop6 +endi + +if $data12 != 1 then + print ======data12=$data12 + goto loop6 +endi + +print sql select * from streamt4_4; +sql select * from streamt4_4; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +if $rows != 3 then + print ======rows=$rows + goto loop6 +endi + +if $data12 != 1 then + print ======data12=$data12 + goto loop6 +endi + +print sql select * from streamt4_5; +sql select * from streamt4_5; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +if $rows != 3 then + print ======rows=$rows + goto loop6 +endi + +if $data12 != 1 then + print ======data12=$data12 + goto loop6 +endi + system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/stream/streamInterpOther1.sim b/tests/script/tsim/stream/streamInterpOther1.sim index 045da1ce84c7..5f78bcbcc6c3 100644 --- a/tests/script/tsim/stream/streamInterpOther1.sim +++ b/tests/script/tsim/stream/streamInterpOther1.sim @@ -77,6 +77,8 @@ if $data51 != 32 then goto loop4_1 endi +print step4_2 + sql create database test4_2 vgroups 4; sql use test4_2; @@ -141,6 +143,8 @@ if $data51 != 32 then goto loop4_2 endi +print step4_3 + sql create database test4_3 vgroups 4; sql use test4_3; @@ -205,6 +209,8 @@ if $data51 != 32 then goto loop4_3 endi +print step4_4 + sql create database test4_4 vgroups 4; sql use test4_4; @@ -269,6 +275,8 @@ if $data51 != 32 then goto loop4_4 endi +print step4_5 + sql create database test4_5 vgroups 4; sql use test4_5; @@ -332,4 +340,7 @@ if $data51 != 32 then print ======data51=$data51 goto loop4_5 endi + + + system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/stream/streamInterpPrev0.sim b/tests/script/tsim/stream/streamInterpPrev0.sim index a326fd87f14f..86f7f95a5fb2 100644 --- a/tests/script/tsim/stream/streamInterpPrev0.sim +++ b/tests/script/tsim/stream/streamInterpPrev0.sim @@ -31,8 +31,12 @@ endi print 0 sql select * from streamt; sql select * from streamt; -print $data00 $data01 $data02 $data03 -print $data10 $data11 $data12 $data13 +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 # row 0 if $rows != 1 then @@ -64,8 +68,12 @@ endi print 1 sql select * from streamt; sql select * from streamt; -print $data00 $data01 $data02 $data03 -print $data10 $data11 $data12 $data13 +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 # row 0 if $rows != 1 then diff --git a/tests/script/tsim/stream/streamInterpPrev1.sim b/tests/script/tsim/stream/streamInterpPrev1.sim index 5d40d0a11f3e..be8b129a4bb7 100644 --- a/tests/script/tsim/stream/streamInterpPrev1.sim +++ b/tests/script/tsim/stream/streamInterpPrev1.sim @@ -31,8 +31,12 @@ endi print 0 sql select * from streamt; sql select * from streamt; -print $data00 $data01 $data02 $data03 -print $data10 $data11 $data12 $data13 +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 # row 0 if $rows != 1 then @@ -141,8 +145,12 @@ endi print 0 sql select * from streamt; sql select * from streamt; -print $data00 $data01 $data02 $data03 -print $data10 $data11 $data12 $data13 +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 # row 0 if $rows != 1 then From 4fe68034cfcf89ba674c38daced325693aca4345 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Fri, 16 Aug 2024 17:46:14 +0800 Subject: [PATCH 038/695] fix issue --- source/libs/executor/inc/streamexecutorInt.h | 1 - source/libs/executor/inc/tfill.h | 2 - source/libs/executor/src/streamfilloperator.c | 2 +- .../executor/src/streamtimesliceoperator.c | 5 - .../script/tsim/stream/streamInterpOther1.sim | 166 +++++++++++++++++- 5 files changed, 166 insertions(+), 10 deletions(-) diff --git a/source/libs/executor/inc/streamexecutorInt.h b/source/libs/executor/inc/streamexecutorInt.h index 744d95f1cfae..ed4e6d4549b2 100644 --- a/source/libs/executor/inc/streamexecutorInt.h +++ b/source/libs/executor/inc/streamexecutorInt.h @@ -63,7 +63,6 @@ void destroyStreamFillSupporter(SStreamFillSupporter* pFillSup); bool hasCurWindow(SStreamFillSupporter* pFillSup); bool hasPrevWindow(SStreamFillSupporter* pFillSup); bool hasNextWindow(SStreamFillSupporter* pFillSup); -bool hasNextNextWindow(SStreamFillSupporter* pFillSup); void copyNotFillExpData(SStreamFillSupporter* pFillSup, SStreamFillInfo* pFillInfo); int32_t setRowCell(SColumnInfoData* pCol, int32_t rowId, const SResultCellData* pCell); bool hasRemainCalc(SStreamFillInfo* pFillInfo); diff --git a/source/libs/executor/inc/tfill.h b/source/libs/executor/inc/tfill.h index 0a80cc817d20..2c1f574419b0 100644 --- a/source/libs/executor/inc/tfill.h +++ b/source/libs/executor/inc/tfill.h @@ -109,8 +109,6 @@ typedef struct SStreamFillInfo { TSKEY prePointKey; TSKEY nextRowKey; TSKEY nextPointKey; - TSKEY nextNextRowKey; - TSKEY nextNextPointKey; SResultRowData* pResRow; SStreamFillLinearInfo* pLinearInfo; bool needFill; diff --git a/source/libs/executor/src/streamfilloperator.c b/source/libs/executor/src/streamfilloperator.c index 8c0bfd028252..f7674d65867b 100644 --- a/source/libs/executor/src/streamfilloperator.c +++ b/source/libs/executor/src/streamfilloperator.c @@ -235,7 +235,7 @@ void getWindowFromDiscBuf(SOperatorInfo* pOperator, TSKEY ts, uint64_t groupId, bool hasCurWindow(SStreamFillSupporter* pFillSup) { return pFillSup->cur.key != INT64_MIN; } bool hasPrevWindow(SStreamFillSupporter* pFillSup) { return pFillSup->prev.key != INT64_MIN; } bool hasNextWindow(SStreamFillSupporter* pFillSup) { return pFillSup->next.key != INT64_MIN; } -bool hasNextNextWindow(SStreamFillSupporter* pFillSup) { return pFillSup->nextNext.key != INT64_MIN; } +static bool hasNextNextWindow(SStreamFillSupporter* pFillSup) { return pFillSup->nextNext.key != INT64_MIN; } static void transBlockToResultRow(const SSDataBlock* pBlock, int32_t rowId, TSKEY ts, SResultRowData* pRowVal) { int32_t numOfCols = taosArrayGetSize(pBlock->pDataBlock); diff --git a/source/libs/executor/src/streamtimesliceoperator.c b/source/libs/executor/src/streamtimesliceoperator.c index 6cb53a36adcb..b182752d33dd 100644 --- a/source/libs/executor/src/streamtimesliceoperator.c +++ b/source/libs/executor/src/streamtimesliceoperator.c @@ -1303,11 +1303,6 @@ void doBuildTimeSlicePointResult(SStreamAggSupporter* pAggSup, SStreamFillSuppor if (hasNextWindow(pFillSup)) { pFillInfo->nextPointKey = nextPoint.key.ts; } - - getNextResKey(pKey->groupId, pGroupResInfo->pRows, pGroupResInfo->index + 1, &pFillInfo->nextNextRowKey); - if (hasNextNextWindow(pFillSup)) { - pFillInfo->nextNextPointKey = pFillSup->nextNext.key; - } } setTimeSliceFillRule(pFillSup, pFillInfo, pKey->ts); diff --git a/tests/script/tsim/stream/streamInterpOther1.sim b/tests/script/tsim/stream/streamInterpOther1.sim index 5f78bcbcc6c3..4a2ea56a8f43 100644 --- a/tests/script/tsim/stream/streamInterpOther1.sim +++ b/tests/script/tsim/stream/streamInterpOther1.sim @@ -33,7 +33,7 @@ $loop_count = 0 loop4_1: $loop_count = $loop_count + 1 -if $loop_count == 10 then +if $loop_count == 20 then return -1 endi @@ -105,6 +105,13 @@ sql insert into t1 values(1648791215001,20,2,3); $loop_count = 0 loop4_2: +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +sleep 300 + print sql select a,b from streamt4_2; sql select a,b from streamt4_2; @@ -171,6 +178,13 @@ sql insert into t1 values(1648791215001,20,2,3); $loop_count = 0 loop4_3: +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +sleep 300 + print sql select a,b from streamt4_3; sql select a,b from streamt4_3; @@ -237,6 +251,13 @@ sql insert into t1 values(1648791215001,20,2,3); $loop_count = 0 loop4_4: +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +sleep 300 + print sql select a,b from streamt4_4; sql select a,b from streamt4_4; @@ -303,6 +324,13 @@ sql insert into t1 values(1648791215001,20,2,3); $loop_count = 0 loop4_5: +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +sleep 300 + print sql select a,b from streamt4_5; sql select a,b from streamt4_5; @@ -341,6 +369,142 @@ if $data51 != 32 then goto loop4_5 endi +print step5 +print =============== create database +sql drop database if exists test5; +sql create database test5 vgroups 4 precision 'us'; +sql use test5; + +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stream streams5 trigger at_once watermark 10s IGNORE EXPIRED 1 IGNORE UPDATE 0 into streamt as select interp(a), _isfilled as a1 from t1 every(1s) fill(prev); + +run tsim/stream/checkTaskStatus.sim + +sql insert into t1 values(1648791213000001,1,1,1,1.0) (1648791215000001,20,1,1,1.0) (1648791216000000,3,1,1,1.0); + +$loop_count = 0 +loop5: + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +sleep 300 + +print sql select cast(`_irowts` as bigint) from streamt order by 1; +sql select cast(`_irowts` as bigint) from streamt order by 1; + +if $rows != 3 then + print ======rows=$rows + goto loop5 +endi + +if $data00 != 1648791214000000 then + print ======data00=$data00 + goto loop5 +endi + +if $data10 != 1648791215000000 then + print ======data01=$data01 + goto loop5 +endi + +if $data20 != 1648791216000000 then + print ======data01=$data01 + goto loop5 +endi + +print step6 +print =============== create database +sql drop database if exists test6; +sql create database test6 vgroups 4 precision 'us'; +sql use test6; +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stream streams6 trigger at_once watermark 10s IGNORE EXPIRED 1 IGNORE UPDATE 0 into streamt as select interp(a), _isfilled as a1 from t1 every(1s) fill(next); + +run tsim/stream/checkTaskStatus.sim + +sql insert into t1 values(1648791213000001,1,1,1,1.0) (1648791215000001,20,1,1,1.0) (1648791216000000,3,1,1,1.0); + +$loop_count = 0 +loop6: + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +sleep 300 + +print sql select cast(`_irowts` as bigint) from streamt order by 1; +sql select cast(`_irowts` as bigint) from streamt order by 1; + +if $rows != 3 then + print ======rows=$rows + goto loop6 +endi + +if $data00 != 1648791214000000 then + print ======data00=$data00 + goto loop6 +endi + +if $data10 != 1648791215000000 then + print ======data01=$data01 + goto loop6 +endi + +if $data20 != 1648791216000000 then + print ======data01=$data01 + goto loop6 +endi + +print step7 +print =============== create database +sql drop database if exists test7; +sql create database test7 vgroups 4 precision 'us'; +sql use test7; + +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stream streams7 trigger at_once watermark 10s IGNORE EXPIRED 1 IGNORE UPDATE 0 into streamt as select interp(a), _isfilled as a1 from t1 every(1s) fill(linear); + +run tsim/stream/checkTaskStatus.sim + +sql insert into t1 values(1648791213000001,1,1,1,1.0) (1648791215000001,20,1,1,1.0) (1648791216000000,3,1,1,1.0); + +$loop_count = 0 +loop7: + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +sleep 300 + +print sql select cast(`_irowts` as bigint) from streamt order by 1; +sql select cast(`_irowts` as bigint) from streamt order by 1; + +if $rows != 3 then + print ======rows=$rows + goto loop7 +endi + +if $data00 != 1648791214000000 then + print ======data00=$data00 + goto loop7 +endi + +if $data10 != 1648791215000000 then + print ======data01=$data01 + goto loop7 +endi + +if $data20 != 1648791216000000 then + print ======data01=$data01 + goto loop7 +endi system sh/exec.sh -n dnode1 -s stop -x SIGINT From 6f2a78a4bbd52de74d79b629a75924eadb8a8cb7 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Mon, 19 Aug 2024 13:23:09 +0800 Subject: [PATCH 039/695] fix issue --- .../executor/src/streamtimesliceoperator.c | 67 +++++++++++++++++-- 1 file changed, 62 insertions(+), 5 deletions(-) diff --git a/source/libs/executor/src/streamtimesliceoperator.c b/source/libs/executor/src/streamtimesliceoperator.c index b182752d33dd..0607250ca488 100644 --- a/source/libs/executor/src/streamtimesliceoperator.c +++ b/source/libs/executor/src/streamtimesliceoperator.c @@ -924,6 +924,60 @@ static void copyCalcRowDeltaData(SResultRowData* pEndRow, SArray* pEndPoins, SFi } } +static void setForceWindowCloseFillRule(SStreamFillSupporter* pFillSup, SStreamFillInfo* pFillInfo, TSKEY ts) { + TSKEY prevWKey = INT64_MIN; + TSKEY nextWKey = INT64_MIN; + if (hasPrevWindow(pFillSup)) { + prevWKey = pFillSup->prev.key; + } + if (hasNextWindow(pFillSup)) { + nextWKey = pFillSup->next.key; + } + TSKEY endTs = adustEndTsKey(ts, pFillSup->cur.key, &pFillSup->interval); + TSKEY startTs = adustPrevTsKey(ts, pFillSup->cur.key, &pFillSup->interval); + + pFillInfo->needFill = true; + pFillInfo->pos = FILL_POS_INVALID; + switch (pFillInfo->type) { + case TSDB_FILL_NULL: + case TSDB_FILL_NULL_F: + case TSDB_FILL_SET_VALUE: + case TSDB_FILL_SET_VALUE_F: { + if (ts != pFillSup->cur.key) { + pFillInfo->pos = FILL_POS_INVALID; + setFillKeyInfo(ts, ts + 1, &pFillSup->interval, pFillInfo); + } else { + pFillInfo->needFill = false; + pFillInfo->pos = FILL_POS_START; + goto _end; + } + copyNonFillValueInfo(pFillSup, pFillInfo); + } break; + case TSDB_FILL_PREV: { + if (ts != pFillSup->cur.key) { + pFillInfo->pos = FILL_POS_INVALID; + setFillKeyInfo(ts, ts + 1, &pFillSup->interval, pFillInfo); + } else if (hasPrevWindow(pFillSup)) { + pFillInfo->pos = FILL_POS_INVALID; + setFillKeyInfo(ts, ts + 1, &pFillSup->interval, pFillInfo); + } else { + pFillInfo->needFill = false; + pFillInfo->pos = FILL_POS_START; + goto _end; + } + pFillInfo->pResRow = &pFillSup->prev; + } break; + default: + ASSERT(0); + break; + } + +_end: + if (ts != pFillSup->cur.key) { + pFillInfo->pos = FILL_POS_INVALID; + } +} + static void setTimeSliceFillRule(SStreamFillSupporter* pFillSup, SStreamFillInfo* pFillInfo, TSKEY ts) { if (!hasNextWindow(pFillSup) && !hasPrevWindow(pFillSup)) { pFillInfo->needFill = false; @@ -957,7 +1011,6 @@ static void setTimeSliceFillRule(SStreamFillSupporter* pFillSup, SStreamFillInfo pFillInfo->pos = FILL_POS_START; } copyNonFillValueInfo(pFillSup, pFillInfo); - pFillInfo->pResRow->key = ts; } break; case TSDB_FILL_PREV: { if (hasPrevWindow(pFillSup) && hasNextWindow(pFillSup) && pFillInfo->preRowKey != pFillInfo->prePointKey && @@ -1263,7 +1316,7 @@ void getPrevResKey(int64_t curGroupId, SArray* pKeyArray, int32_t curIndex, TSKE *pNextKey = INT64_MIN; } -void doBuildTimeSlicePointResult(SStreamAggSupporter* pAggSup, SStreamFillSupporter* pFillSup, +void doBuildTimeSlicePointResult(SStreamAggSupporter* pAggSup, STimeWindowAggSupp* pTwSup, SStreamFillSupporter* pFillSup, SStreamFillInfo* pFillInfo, SSDataBlock* pBlock, SGroupResInfo* pGroupResInfo) { int32_t code = TSDB_CODE_SUCCESS; int32_t lino = 0; @@ -1304,8 +1357,12 @@ void doBuildTimeSlicePointResult(SStreamAggSupporter* pAggSup, SStreamFillSuppor pFillInfo->nextPointKey = nextPoint.key.ts; } } - - setTimeSliceFillRule(pFillSup, pFillInfo, pKey->ts); + + if (pTwSup->calTrigger == STREAM_TRIGGER_FORCE_WINDOW_CLOSE) { + setForceWindowCloseFillRule(pFillSup, pFillInfo, pKey->ts); + } else { + setTimeSliceFillRule(pFillSup, pFillInfo, pKey->ts); + } doStreamFillRange(pFillSup, pFillInfo, pBlock); releaseOutputBuf(pAggSup->pState, curPoint.pResPos, &pAggSup->stateStore); releaseOutputBuf(pAggSup->pState, prevPoint.pResPos, &pAggSup->stateStore); @@ -1330,7 +1387,7 @@ static int32_t buildTimeSliceResult(SOperatorInfo* pOperator, SSDataBlock** ppRe uint16_t opType = pOperator->operatorType; SStreamAggSupporter* pAggSup = &pInfo->streamAggSup; - doBuildTimeSlicePointResult(pAggSup, pInfo->pFillSup, pInfo->pFillInfo, pInfo->pRes, &pInfo->groupResInfo); + doBuildTimeSlicePointResult(pAggSup, &pInfo->twAggSup, pInfo->pFillSup, pInfo->pFillInfo, pInfo->pRes, &pInfo->groupResInfo); if (pInfo->pRes->info.rows != 0) { printDataBlock(pInfo->pRes, getStreamOpName(opType), GET_TASKID(pTaskInfo)); (*ppRes) = pInfo->pRes; From 1ce2109fa4d567c087ef689077a47dc2a98b2849 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Mon, 19 Aug 2024 13:42:44 +0800 Subject: [PATCH 040/695] add check --- source/libs/parser/src/parTranslater.c | 17 +++++++++++++--- .../script/tsim/stream/streamInterpError.sim | 20 +++++++++++++++++++ 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 94398aeeefde..244bb9df378d 100755 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -10385,9 +10385,20 @@ static int32_t checkStreamQuery(STranslateContext* pCxt, SCreateStreamStmt* pStm } if (pSelect->hasInterpFunc) { - if (pStmt->pOptions->fillHistory && pStmt->pOptions->triggerType == STREAM_TRIGGER_FORCE_WINDOW_CLOSE) { - return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY, - "When trigger was force window close, Stream interp unsupported Fill history"); + if (pStmt->pOptions->triggerType == STREAM_TRIGGER_FORCE_WINDOW_CLOSE) { + if (pStmt->pOptions->fillHistory) { + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY, + "When trigger was force window close, Stream interp unsupported Fill history"); + } else if (pSelect->pFill != NULL) { + EFillMode mode = ((SFillNode*)(pSelect->pFill))->mode; + if (mode == FILL_MODE_NEXT) { + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY, + "When trigger was force window close, Stream interp unsupported Fill(Next)"); + } else if (mode == FILL_MODE_LINEAR) { + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY, + "When trigger was force window close, Stream interp unsupported Fill(Linear)"); + } + } } if (pStmt->pOptions->triggerType == STREAM_TRIGGER_WINDOW_CLOSE) { diff --git a/tests/script/tsim/stream/streamInterpError.sim b/tests/script/tsim/stream/streamInterpError.sim index 49366dc9ee0a..39abc0aa2adc 100644 --- a/tests/script/tsim/stream/streamInterpError.sim +++ b/tests/script/tsim/stream/streamInterpError.sim @@ -75,6 +75,26 @@ sql_error create stream streams2_6_8 trigger force_window_close FILL_HISTORY 1 I sql_error create stream streams2_6_9 trigger force_window_close FILL_HISTORY 1 IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_6_9 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(NULL); sql_error create stream streams2_6_10 trigger force_window_close FILL_HISTORY 1 IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_6_10 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(value,11,22,33,44); + + +print step3 + +sql create database test3 vgroups 1; +sql use test3; + +sql create stable st(ts timestamp,a int,b int,c int, d double) tags(ta int,tb int,tc int); +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); + +print step3_0 + +sql create stream streams3_0_1 trigger at_once FILL_HISTORY 1 IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt3_0_1 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(prev); +sql_error create stream streams3_0_2 trigger at_once FILL_HISTORY 1 IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt3_0_2 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(next); +sql_error create stream streams3_0_3 trigger at_once FILL_HISTORY 1 IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt3_0_3 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(linear); +sql create stream streams3_0_4 trigger at_once FILL_HISTORY 1 IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt3_0_4 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(NULL); +sql create stream streams3_0_5 trigger at_once FILL_HISTORY 1 IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt3_0_5 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(value,11,22,33,44); + + run tsim/stream/checkTaskStatus.sim run tsim/stream/checkTaskStatus.sim From af38c140696a6d06eb3e43eff6d87a6cd94d61b1 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Thu, 22 Aug 2024 14:48:29 +0800 Subject: [PATCH 041/695] adj sql.c --- source/libs/parser/src/sql.c | 7168 +++++----------------------------- 1 file changed, 1006 insertions(+), 6162 deletions(-) diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c index 0f5bfca20764..b1f28993abb3 100644 --- a/source/libs/parser/src/sql.c +++ b/source/libs/parser/src/sql.c @@ -528,35 +528,18 @@ typedef union { #define ParseCTX_FETCH #define ParseCTX_STORE #define YYFALLBACK 1 -<<<<<<< HEAD -#define YYNSTATE 1004 +#define YYNSTATE 1006 #define YYNRULE 771 #define YYNRULE_WITH_ACTION 771 #define YYNTOKEN 386 -#define YY_MAX_SHIFT 1003 -#define YY_MIN_SHIFTREDUCE 1488 -#define YY_MAX_SHIFTREDUCE 2258 -#define YY_ERROR_ACTION 2259 -#define YY_ACCEPT_ACTION 2260 -#define YY_NO_ACTION 2261 -#define YY_MIN_REDUCE 2262 -#define YY_MAX_REDUCE 3032 -======= -#define YYNSTATE 1006 -#define YYNRULE 770 -#define YYNRULE_WITH_ACTION 770 -#define YYNTOKEN 385 #define YY_MAX_SHIFT 1005 -#define YY_MIN_SHIFTREDUCE 1490 -#define YY_MAX_SHIFTREDUCE 2259 -#define YY_ERROR_ACTION 2260 -#define YY_ACCEPT_ACTION 2261 -#define YY_NO_ACTION 2262 -#define YY_MIN_REDUCE 2263 -#define YY_MAX_REDUCE 3032 -#define YY_MIN_DSTRCTR 386 -#define YY_MAX_DSTRCTR 566 ->>>>>>> f143f5f1bcee3e814ef83fc3d942a3eab3c2417b +#define YY_MIN_SHIFTREDUCE 1491 +#define YY_MAX_SHIFTREDUCE 2261 +#define YY_ERROR_ACTION 2262 +#define YY_ACCEPT_ACTION 2263 +#define YY_NO_ACTION 2264 +#define YY_MIN_REDUCE 2265 +#define YY_MAX_REDUCE 3035 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -623,724 +606,730 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -<<<<<<< HEAD -#define YY_ACTTAB_COUNT (4218) +#define YY_ACTTAB_COUNT (4286) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 2751, 564, 2459, 514, 38, 685, 563, 2625, 571, 2567, - /* 10 */ 50, 49, 57, 55, 56, 54, 53, 52, 51, 40, - /* 20 */ 497, 490, 1981, 2711, 2625, 50, 49, 2622, 880, 56, - /* 30 */ 54, 53, 52, 51, 2006, 462, 1979, 2285, 2083, 2354, - /* 40 */ 217, 2793, 50, 49, 2623, 880, 56, 54, 53, 52, - /* 50 */ 51, 866, 2625, 831, 167, 2006, 834, 785, 633, 631, - /* 60 */ 809, 434, 865, 503, 242, 2998, 499, 2598, 2078, 686, - /* 70 */ 2618, 863, 2622, 880, 668, 755, 898, 669, 2310, 785, - /* 80 */ 894, 2470, 1987, 3004, 228, 2811, 673, 2998, 2999, 820, - /* 90 */ 2530, 749, 670, 753, 751, 298, 297, 2758, 460, 194, - /* 100 */ 158, 2758, 202, 875, 327, 3004, 228, 2403, 714, 2528, - /* 110 */ 2999, 820, 1000, 831, 167, 58, 971, 970, 969, 968, - /* 120 */ 526, 2447, 967, 966, 172, 961, 960, 959, 958, 957, - /* 130 */ 956, 955, 171, 949, 948, 947, 525, 524, 944, 943, - /* 140 */ 942, 208, 207, 941, 521, 940, 939, 938, 2792, 893, - /* 150 */ 2063, 2839, 2086, 2087, 173, 131, 2794, 879, 2796, 2797, - /* 160 */ 874, 302, 2322, 862, 898, 1533, 894, 2470, 2179, 210, - /* 170 */ 94, 2900, 580, 2594, 2006, 492, 2896, 204, 2908, 830, - /* 180 */ 608, 159, 829, 2793, 1540, 607, 158, 170, 819, 2998, - /* 190 */ 134, 2042, 2052, 606, 719, 229, 2998, 2462, 876, 516, - /* 200 */ 2472, 2085, 2088, 2947, 2263, 1826, 1827, 818, 228, 1535, - /* 210 */ 1538, 1539, 2999, 820, 818, 228, 1982, 989, 1980, 2999, - /* 220 */ 820, 2915, 9, 861, 221, 148, 244, 2811, 147, 146, - /* 230 */ 145, 144, 143, 142, 141, 140, 139, 137, 2908, 2909, - /* 240 */ 2517, 165, 2913, 2758, 60, 875, 1907, 1908, 1909, 2912, - /* 250 */ 479, 2672, 766, 1985, 1986, 2039, 2150, 2041, 2044, 2045, - /* 260 */ 2046, 2047, 2048, 2049, 2050, 2051, 871, 864, 42, 350, - /* 270 */ 896, 895, 2069, 2070, 2072, 2073, 2074, 2077, 2079, 2080, - /* 280 */ 2081, 2082, 2084, 2, 57, 55, 2175, 500, 2793, 195, - /* 290 */ 2792, 2274, 497, 2839, 1981, 2039, 191, 131, 2794, 879, - /* 300 */ 2796, 2797, 874, 873, 893, 862, 898, 2475, 1979, 169, - /* 310 */ 2083, 178, 2871, 2900, 2550, 50, 49, 492, 2896, 56, - /* 320 */ 54, 53, 52, 51, 676, 2200, 2793, 669, 2310, 217, - /* 330 */ 50, 49, 2811, 2150, 56, 54, 53, 52, 51, 2201, - /* 340 */ 2078, 876, 2702, 863, 2915, 2043, 904, 19, 2758, 3003, - /* 350 */ 875, 1560, 2461, 1559, 1987, 148, 2599, 2998, 147, 146, - /* 360 */ 145, 144, 143, 142, 141, 140, 139, 57, 55, 44, - /* 370 */ 2811, 2752, 2911, 523, 522, 497, 3002, 1981, 627, 301, - /* 380 */ 2999, 3001, 454, 300, 1000, 2199, 2758, 15, 875, 1561, - /* 390 */ 548, 1979, 893, 2083, 2474, 2792, 536, 1988, 2839, 2147, - /* 400 */ 2148, 2149, 429, 2794, 879, 2796, 2797, 874, 872, 2040, - /* 410 */ 862, 898, 854, 2865, 2357, 503, 935, 184, 183, 932, - /* 420 */ 931, 930, 181, 2078, 2086, 2087, 863, 2284, 898, 2341, - /* 430 */ 19, 2530, 2113, 2792, 503, 543, 2839, 1987, 2150, 488, - /* 440 */ 131, 2794, 879, 2796, 2797, 874, 253, 898, 862, 898, - /* 450 */ 2528, 736, 2094, 893, 2875, 765, 2900, 113, 2006, 235, - /* 460 */ 492, 2896, 443, 2042, 2052, 76, 477, 1000, 757, 610, - /* 470 */ 15, 626, 252, 2085, 2088, 2920, 2147, 2148, 2149, 2920, - /* 480 */ 2920, 2920, 2920, 2920, 609, 624, 3003, 2758, 1982, 124, - /* 490 */ 1980, 735, 734, 733, 2998, 861, 2006, 2114, 725, 164, - /* 500 */ 729, 903, 902, 901, 728, 72, 768, 2086, 2087, 727, - /* 510 */ 732, 472, 471, 3002, 2007, 726, 61, 2999, 3000, 470, - /* 520 */ 722, 721, 720, 586, 2594, 1985, 1986, 2039, 552, 2041, - /* 530 */ 2044, 2045, 2046, 2047, 2048, 2049, 2050, 2051, 871, 864, - /* 540 */ 804, 684, 896, 895, 2069, 2070, 2042, 2052, 60, 2077, - /* 550 */ 2079, 2080, 2081, 2082, 2084, 2, 2085, 2088, 554, 550, - /* 560 */ 50, 49, 2915, 2768, 56, 54, 53, 52, 51, 894, - /* 570 */ 2470, 1982, 2010, 1980, 2530, 2119, 72, 246, 861, 1991, - /* 580 */ 2920, 2147, 2148, 2149, 2920, 2920, 2920, 2920, 2920, 520, - /* 590 */ 2910, 72, 2772, 838, 41, 494, 2108, 2109, 2110, 2111, - /* 600 */ 2112, 2116, 2117, 2118, 894, 2470, 2454, 441, 1985, 1986, - /* 610 */ 2039, 687, 2041, 2044, 2045, 2046, 2047, 2048, 2049, 2050, - /* 620 */ 2051, 871, 864, 691, 233, 896, 895, 2069, 2070, 2043, - /* 630 */ 769, 114, 2077, 2079, 2080, 2081, 2082, 2084, 2, 12, - /* 640 */ 57, 55, 2774, 2776, 493, 688, 1752, 1753, 497, 518, - /* 650 */ 1981, 2283, 2523, 2525, 248, 898, 509, 1713, 810, 805, - /* 660 */ 798, 794, 831, 167, 1979, 1881, 2083, 2152, 2153, 2154, - /* 670 */ 2155, 2156, 1704, 927, 926, 925, 1708, 924, 1710, 1711, - /* 680 */ 923, 920, 2793, 1719, 917, 1721, 1722, 914, 911, 908, - /* 690 */ 2262, 951, 1560, 2040, 1559, 2007, 2078, 876, 334, 863, - /* 700 */ 104, 2010, 501, 19, 2612, 103, 689, 217, 163, 334, - /* 710 */ 1987, 2758, 678, 2664, 157, 156, 155, 154, 153, 152, - /* 720 */ 151, 150, 149, 57, 55, 2089, 2811, 192, 469, 468, - /* 730 */ 1561, 497, 512, 1981, 2598, 1713, 516, 2472, 2524, 2525, - /* 740 */ 1000, 334, 2758, 15, 875, 224, 123, 1979, 1651, 2083, - /* 750 */ 1704, 927, 926, 925, 1708, 924, 1710, 1711, 870, 869, - /* 760 */ 953, 1719, 868, 1721, 1722, 867, 911, 908, 937, 334, - /* 770 */ 50, 49, 102, 2463, 56, 54, 53, 52, 51, 2078, - /* 780 */ 2086, 2087, 863, 2530, 334, 2260, 198, 2908, 2909, 2792, - /* 790 */ 165, 2913, 2839, 1987, 1653, 33, 131, 2794, 879, 2796, - /* 800 */ 2797, 874, 846, 767, 862, 898, 2010, 2011, 467, 466, - /* 810 */ 2873, 716, 2900, 2282, 769, 72, 492, 2896, 313, 2042, - /* 820 */ 2052, 1003, 665, 1000, 1563, 1564, 58, 1853, 1854, 2085, - /* 830 */ 2088, 663, 718, 3003, 659, 655, 717, 12, 1950, 10, - /* 840 */ 388, 264, 894, 2470, 1982, 671, 1980, 2318, 14, 13, - /* 850 */ 2009, 861, 2010, 50, 49, 991, 218, 56, 54, 53, - /* 860 */ 52, 51, 65, 2086, 2087, 987, 983, 979, 975, 115, - /* 870 */ 383, 508, 507, 2758, 529, 2768, 1852, 1855, 2220, 528, - /* 880 */ 2172, 1985, 1986, 2039, 2006, 2041, 2044, 2045, 2046, 2047, - /* 890 */ 2048, 2049, 2050, 2051, 871, 864, 771, 2664, 896, 895, - /* 900 */ 2069, 2070, 2042, 2052, 2772, 2077, 2079, 2080, 2081, 2082, - /* 910 */ 2084, 2, 2085, 2088, 1949, 562, 130, 561, 50, 49, - /* 920 */ 2009, 356, 56, 54, 53, 52, 51, 1982, 860, 1980, - /* 930 */ 785, 266, 2444, 519, 861, 671, 2011, 2318, 2998, 894, - /* 940 */ 2470, 2530, 191, 831, 167, 12, 2243, 511, 510, 502, - /* 950 */ 560, 808, 847, 2475, 2774, 2777, 3004, 228, 384, 568, - /* 960 */ 2528, 2999, 820, 2127, 1985, 1986, 2039, 898, 2041, 2044, - /* 970 */ 2045, 2046, 2047, 2048, 2049, 2050, 2051, 871, 864, 223, - /* 980 */ 2811, 896, 895, 2069, 2070, 855, 742, 2872, 2077, 2079, - /* 990 */ 2080, 2081, 2082, 2084, 2, 57, 55, 354, 2793, 853, - /* 1000 */ 391, 756, 337, 497, 2281, 1981, 937, 336, 334, 954, - /* 1010 */ 50, 49, 2429, 834, 56, 54, 53, 52, 51, 1979, - /* 1020 */ 299, 2083, 1540, 332, 2678, 231, 306, 50, 49, 391, - /* 1030 */ 37, 56, 54, 53, 52, 51, 745, 894, 2470, 894, - /* 1040 */ 2470, 2011, 2811, 739, 737, 617, 2594, 2793, 1538, 1539, - /* 1050 */ 296, 2078, 807, 2250, 863, 2043, 2006, 569, 2758, 588, - /* 1060 */ 875, 2673, 876, 1663, 2758, 1987, 833, 197, 2908, 2909, - /* 1070 */ 1542, 165, 2913, 2208, 894, 2470, 2005, 1662, 57, 55, - /* 1080 */ 56, 54, 53, 52, 51, 303, 497, 2011, 1981, 478, - /* 1090 */ 2672, 2811, 2530, 332, 602, 1000, 82, 110, 58, 251, - /* 1100 */ 517, 81, 1979, 135, 2083, 2792, 2105, 2758, 2839, 875, - /* 1110 */ 1667, 2528, 131, 2794, 879, 2796, 2797, 874, 2062, 2040, - /* 1120 */ 862, 898, 341, 342, 1666, 2466, 210, 340, 2900, 894, - /* 1130 */ 2470, 784, 492, 2896, 2078, 2086, 2087, 863, 894, 2470, - /* 1140 */ 801, 800, 2206, 2207, 2209, 2210, 2211, 3002, 1987, 603, - /* 1150 */ 53, 52, 51, 638, 2792, 110, 168, 2839, 604, 2871, - /* 1160 */ 2948, 196, 2794, 879, 2796, 2797, 874, 710, 709, 862, - /* 1170 */ 898, 819, 192, 465, 2042, 2052, 894, 2470, 1000, 2998, - /* 1180 */ 2249, 58, 2473, 2465, 2085, 2088, 2171, 50, 49, 712, - /* 1190 */ 711, 56, 54, 53, 52, 51, 690, 818, 228, 1982, - /* 1200 */ 640, 1980, 2999, 820, 894, 2470, 861, 2115, 50, 49, - /* 1210 */ 786, 2958, 56, 54, 53, 52, 51, 929, 2086, 2087, - /* 1220 */ 2521, 731, 730, 857, 2467, 2872, 933, 50, 49, 2521, - /* 1230 */ 2280, 56, 54, 53, 52, 51, 1985, 1986, 2039, 2446, - /* 1240 */ 2041, 2044, 2045, 2046, 2047, 2048, 2049, 2050, 2051, 871, - /* 1250 */ 864, 2279, 2278, 896, 895, 2069, 2070, 2042, 2052, 2530, - /* 1260 */ 2077, 2079, 2080, 2081, 2082, 2084, 2, 2085, 2088, 50, - /* 1270 */ 49, 43, 70, 56, 54, 53, 52, 51, 2529, 735, - /* 1280 */ 734, 733, 1982, 782, 1980, 2120, 725, 164, 729, 861, - /* 1290 */ 2758, 2040, 728, 894, 2470, 2219, 2277, 727, 732, 472, - /* 1300 */ 471, 2532, 2276, 726, 39, 2273, 191, 470, 722, 721, - /* 1310 */ 720, 2758, 2758, 304, 894, 2470, 2191, 2476, 398, 1985, - /* 1320 */ 1986, 2039, 2507, 2041, 2044, 2045, 2046, 2047, 2048, 2049, - /* 1330 */ 2050, 2051, 871, 864, 312, 2059, 896, 895, 2069, 2070, - /* 1340 */ 3, 894, 2470, 2077, 2079, 2080, 2081, 2082, 2084, 2, - /* 1350 */ 57, 55, 1981, 2272, 63, 438, 2758, 2004, 497, 823, - /* 1360 */ 1981, 837, 2758, 2793, 615, 2758, 1979, 464, 965, 963, - /* 1370 */ 2290, 993, 894, 2470, 1979, 635, 2083, 2060, 876, 2698, - /* 1380 */ 894, 2470, 894, 2470, 935, 184, 183, 932, 931, 930, - /* 1390 */ 181, 594, 345, 637, 894, 2470, 894, 2470, 439, 596, - /* 1400 */ 851, 934, 352, 813, 2521, 2271, 2078, 2811, 2577, 863, - /* 1410 */ 574, 2270, 1987, 2758, 887, 2269, 888, 826, 894, 2470, - /* 1420 */ 1987, 894, 2470, 2758, 182, 875, 1987, 718, 2268, 50, - /* 1430 */ 49, 717, 2267, 56, 54, 53, 52, 51, 892, 50, - /* 1440 */ 49, 380, 1000, 56, 54, 53, 52, 51, 2266, 928, - /* 1450 */ 1000, 463, 578, 15, 50, 49, 636, 2457, 56, 54, - /* 1460 */ 53, 52, 51, 582, 759, 2758, 758, 2265, 45, 160, - /* 1470 */ 2792, 2758, 2161, 2839, 822, 2758, 1646, 416, 2794, 879, - /* 1480 */ 2796, 2797, 874, 100, 31, 862, 898, 2443, 2758, 88, - /* 1490 */ 2086, 2087, 2758, 289, 2605, 2584, 287, 623, 622, 621, - /* 1500 */ 620, 619, 614, 613, 612, 611, 447, 64, 2758, 601, - /* 1510 */ 600, 599, 598, 597, 591, 590, 589, 2779, 584, 583, - /* 1520 */ 461, 723, 1647, 2339, 575, 1814, 1815, 2758, 724, 2042, - /* 1530 */ 2052, 1833, 291, 293, 295, 290, 292, 294, 2330, 2085, - /* 1540 */ 2088, 2252, 2253, 101, 1644, 738, 1982, 2058, 1980, 284, - /* 1550 */ 2328, 1642, 14, 13, 1982, 390, 1980, 174, 309, 174, - /* 1560 */ 740, 861, 2057, 50, 49, 203, 792, 56, 54, 53, - /* 1570 */ 52, 51, 743, 59, 708, 704, 700, 696, 222, 283, - /* 1580 */ 59, 2781, 211, 1985, 1986, 182, 397, 359, 358, 361, - /* 1590 */ 360, 1985, 1986, 2039, 2474, 2041, 2044, 2045, 2046, 2047, - /* 1600 */ 2048, 2049, 2050, 2051, 871, 864, 339, 87, 896, 895, - /* 1610 */ 2069, 2070, 363, 362, 1624, 2077, 2079, 2080, 2081, 2082, - /* 1620 */ 2084, 2, 193, 2275, 219, 111, 2793, 404, 365, 364, - /* 1630 */ 281, 2404, 935, 184, 183, 932, 931, 930, 181, 2712, - /* 1640 */ 1897, 876, 1905, 2320, 2961, 1990, 402, 86, 202, 2195, - /* 1650 */ 85, 59, 2793, 1989, 74, 59, 2205, 129, 824, 126, - /* 1660 */ 1625, 440, 328, 2204, 762, 318, 802, 876, 836, 2955, - /* 1670 */ 2811, 367, 366, 262, 650, 648, 645, 643, 369, 368, - /* 1680 */ 59, 320, 371, 370, 373, 372, 2758, 832, 875, 343, - /* 1690 */ 843, 375, 374, 377, 376, 785, 2811, 269, 379, 378, - /* 1700 */ 162, 59, 87, 2998, 2812, 2396, 280, 179, 945, 770, - /* 1710 */ 271, 278, 2758, 2311, 875, 2395, 276, 682, 827, 72, - /* 1720 */ 785, 3004, 228, 160, 182, 2951, 2999, 820, 2998, 799, - /* 1730 */ 484, 1616, 84, 2792, 2061, 268, 2839, 2121, 2064, 806, - /* 1740 */ 131, 2794, 879, 2796, 2797, 874, 3004, 228, 862, 898, - /* 1750 */ 906, 2999, 820, 480, 3018, 835, 2900, 1597, 73, 2792, - /* 1760 */ 492, 2896, 2839, 2053, 2793, 785, 131, 2794, 879, 2796, - /* 1770 */ 2797, 874, 946, 2998, 862, 898, 180, 182, 161, 876, - /* 1780 */ 3018, 2968, 2900, 179, 1850, 1840, 492, 2896, 2603, 840, - /* 1790 */ 355, 3004, 228, 527, 545, 1614, 2999, 820, 2317, 2518, - /* 1800 */ 778, 2952, 2962, 1598, 814, 815, 891, 1695, 2811, 330, - /* 1810 */ 333, 785, 98, 97, 567, 396, 325, 241, 2604, 2998, - /* 1820 */ 2430, 5, 530, 46, 2758, 535, 875, 1993, 2004, 458, - /* 1830 */ 559, 557, 544, 1726, 2014, 1992, 556, 3004, 228, 555, - /* 1840 */ 2793, 558, 2999, 820, 437, 236, 237, 546, 1874, 239, - /* 1850 */ 542, 538, 534, 531, 560, 876, 389, 796, 572, 1734, - /* 1860 */ 1741, 1739, 2005, 579, 250, 581, 185, 585, 587, 616, - /* 1870 */ 629, 2792, 592, 605, 2839, 2596, 618, 625, 131, 2794, - /* 1880 */ 879, 2796, 2797, 874, 2811, 628, 862, 898, 630, 2793, - /* 1890 */ 641, 642, 3018, 639, 2900, 255, 256, 644, 492, 2896, - /* 1900 */ 2758, 646, 875, 647, 876, 259, 2991, 649, 651, 2012, - /* 1910 */ 666, 4, 334, 667, 674, 523, 522, 675, 267, 677, - /* 1920 */ 2793, 106, 2007, 2613, 679, 1995, 2013, 680, 270, 2015, - /* 1930 */ 681, 273, 683, 2811, 2016, 876, 2619, 2932, 2017, 1988, - /* 1940 */ 275, 2083, 107, 761, 108, 715, 109, 2792, 692, 2758, - /* 1950 */ 2839, 875, 713, 282, 131, 2794, 879, 2796, 2797, 874, - /* 1960 */ 746, 747, 862, 898, 2811, 136, 432, 763, 3018, 2460, - /* 1970 */ 2900, 2078, 286, 112, 492, 2896, 2456, 288, 2688, 187, - /* 1980 */ 2758, 133, 875, 392, 2685, 1987, 2458, 2453, 175, 305, - /* 1990 */ 188, 189, 2008, 2665, 773, 772, 2792, 310, 780, 2839, - /* 2000 */ 841, 779, 803, 131, 2794, 879, 2796, 2797, 874, 2684, - /* 2010 */ 777, 862, 898, 789, 2967, 859, 2793, 3018, 2966, 2900, - /* 2020 */ 8, 774, 812, 492, 2896, 790, 319, 2792, 2939, 201, - /* 2030 */ 2839, 876, 315, 322, 131, 2794, 879, 2796, 2797, 874, - /* 2040 */ 317, 321, 862, 898, 308, 787, 788, 323, 3018, 817, - /* 2050 */ 2900, 445, 444, 816, 492, 2896, 324, 2919, 485, 3021, - /* 2060 */ 2811, 504, 828, 825, 166, 2009, 2169, 2167, 2916, 214, - /* 2070 */ 393, 335, 176, 839, 2633, 513, 2758, 2083, 875, 2632, - /* 2080 */ 2631, 394, 2997, 844, 489, 845, 177, 849, 852, 71, - /* 2090 */ 883, 881, 885, 2471, 348, 886, 395, 353, 122, 2750, - /* 2100 */ 2749, 326, 2745, 2881, 2744, 2736, 2735, 2078, 125, 2793, - /* 2110 */ 399, 382, 2727, 900, 1, 1512, 230, 995, 996, 1996, - /* 2120 */ 2726, 1991, 2742, 2792, 876, 186, 2839, 329, 997, 385, - /* 2130 */ 131, 2794, 879, 2796, 2797, 874, 992, 386, 862, 898, - /* 2140 */ 765, 2741, 999, 2733, 856, 2710, 2900, 2732, 401, 2793, - /* 2150 */ 492, 2896, 2721, 2811, 420, 2720, 1999, 2001, 2739, 2738, - /* 2160 */ 2730, 2729, 2718, 2717, 876, 2715, 433, 431, 2714, 2758, - /* 2170 */ 442, 875, 2522, 896, 895, 421, 62, 403, 450, 2709, - /* 2180 */ 2077, 2079, 2080, 2081, 2082, 2084, 446, 2708, 95, 2703, - /* 2190 */ 532, 533, 1932, 2811, 451, 1933, 234, 537, 2701, 539, - /* 2200 */ 540, 1931, 541, 2700, 2699, 459, 2697, 547, 2696, 2758, - /* 2210 */ 549, 875, 551, 2694, 553, 1919, 2792, 2695, 2669, 2839, - /* 2220 */ 238, 2668, 240, 132, 2794, 879, 2796, 2797, 874, 96, - /* 2230 */ 1877, 862, 898, 1876, 2793, 2646, 2645, 2644, 565, 2900, - /* 2240 */ 566, 2643, 2642, 2899, 2896, 2586, 570, 1813, 2583, 876, - /* 2250 */ 573, 2582, 2576, 577, 2573, 1972, 2792, 1948, 576, 2839, - /* 2260 */ 243, 2572, 99, 132, 2794, 879, 2796, 2797, 874, 2571, - /* 2270 */ 2793, 862, 898, 2570, 2575, 245, 2574, 2569, 2811, 2900, - /* 2280 */ 2568, 2566, 2565, 858, 2896, 876, 2564, 247, 2563, 593, - /* 2290 */ 506, 505, 1973, 595, 2758, 2561, 875, 2560, 2559, 2558, - /* 2300 */ 2557, 2581, 2556, 2555, 2554, 2579, 2562, 2553, 2552, 896, - /* 2310 */ 895, 2551, 2549, 2548, 2811, 2547, 2077, 2079, 2080, 2081, - /* 2320 */ 2082, 2084, 2546, 2545, 2544, 2543, 249, 2542, 2541, 2540, - /* 2330 */ 2758, 105, 875, 2539, 2611, 2580, 2578, 2538, 2537, 2536, - /* 2340 */ 1819, 877, 254, 2535, 2839, 632, 2793, 2534, 132, 2794, - /* 2350 */ 879, 2796, 2797, 874, 2533, 2531, 862, 898, 634, 2361, - /* 2360 */ 257, 876, 1664, 1668, 2900, 2360, 448, 1660, 453, 2896, - /* 2370 */ 2359, 449, 2358, 2356, 2353, 653, 654, 2792, 258, 2352, - /* 2380 */ 2839, 83, 652, 2345, 199, 2794, 879, 2796, 2797, 874, - /* 2390 */ 2811, 2332, 862, 898, 260, 2793, 656, 658, 261, 660, - /* 2400 */ 662, 2306, 657, 661, 664, 263, 2758, 1541, 875, 209, - /* 2410 */ 876, 91, 2778, 220, 2305, 672, 265, 2667, 2663, 92, - /* 2420 */ 2653, 2641, 272, 274, 2640, 2617, 2610, 2793, 277, 2448, - /* 2430 */ 2355, 279, 2351, 1590, 693, 2349, 695, 2347, 694, 2811, - /* 2440 */ 697, 698, 876, 699, 701, 821, 3019, 703, 702, 2344, - /* 2450 */ 706, 705, 2327, 2792, 707, 2758, 2839, 875, 2325, 2326, - /* 2460 */ 132, 2794, 879, 2796, 2797, 874, 2324, 2302, 862, 898, - /* 2470 */ 2450, 2811, 1746, 285, 2449, 1745, 2900, 1650, 1649, 1648, - /* 2480 */ 1645, 2897, 1643, 1641, 1640, 2342, 1639, 2758, 2340, 875, - /* 2490 */ 1638, 1632, 1637, 962, 964, 473, 2331, 474, 1634, 1633, - /* 2500 */ 1631, 475, 2792, 2329, 476, 2839, 2301, 741, 744, 196, - /* 2510 */ 2794, 879, 2796, 2797, 874, 2300, 2793, 862, 898, 2299, - /* 2520 */ 748, 2298, 750, 2297, 2296, 752, 754, 138, 1913, 1915, - /* 2530 */ 1912, 876, 1917, 2666, 2792, 66, 2793, 2839, 32, 1887, - /* 2540 */ 2662, 423, 2794, 879, 2796, 2797, 874, 1883, 764, 862, - /* 2550 */ 898, 876, 307, 77, 1885, 2652, 775, 2639, 2638, 2959, - /* 2560 */ 2811, 21, 67, 3003, 6, 311, 791, 481, 17, 7, - /* 2570 */ 190, 22, 23, 1902, 213, 776, 2758, 225, 875, 1862, - /* 2580 */ 2811, 1861, 36, 34, 24, 226, 2779, 2222, 781, 2164, - /* 2590 */ 2162, 314, 783, 793, 811, 200, 2758, 2196, 875, 316, - /* 2600 */ 482, 2793, 797, 795, 75, 25, 18, 2237, 69, 2236, - /* 2610 */ 486, 2203, 212, 35, 2241, 2190, 876, 93, 2240, 487, - /* 2620 */ 483, 2793, 346, 2792, 2637, 2160, 2839, 331, 227, 2616, - /* 2630 */ 430, 2794, 879, 2796, 2797, 874, 873, 205, 862, 898, - /* 2640 */ 117, 2242, 116, 2792, 215, 2811, 2839, 2615, 118, 68, - /* 2650 */ 430, 2794, 879, 2796, 2797, 874, 2609, 119, 862, 898, - /* 2660 */ 2243, 2758, 2144, 875, 2143, 2811, 338, 2198, 26, 344, - /* 2670 */ 13, 79, 1997, 2032, 206, 848, 347, 2096, 2095, 2056, - /* 2680 */ 11, 2758, 349, 875, 2106, 27, 2608, 120, 216, 878, - /* 2690 */ 2445, 889, 28, 357, 20, 47, 842, 2055, 2258, 913, - /* 2700 */ 916, 850, 919, 922, 48, 16, 2793, 2054, 2792, 29, - /* 2710 */ 30, 2839, 884, 2024, 80, 199, 2794, 879, 2796, 2797, - /* 2720 */ 874, 876, 882, 862, 898, 351, 121, 890, 2792, 126, - /* 2730 */ 89, 2839, 2850, 2849, 2793, 429, 2794, 879, 2796, 2797, - /* 2740 */ 874, 2066, 897, 862, 898, 78, 2866, 899, 2257, 876, - /* 2750 */ 2811, 2256, 905, 515, 1727, 907, 909, 1724, 912, 910, - /* 2760 */ 915, 1723, 1720, 918, 1714, 2255, 2758, 921, 875, 1718, - /* 2770 */ 2793, 1712, 127, 381, 128, 1740, 1717, 3020, 2811, 90, - /* 2780 */ 1736, 1588, 936, 1628, 1627, 876, 1716, 1626, 1623, 1715, - /* 2790 */ 495, 1620, 1619, 1618, 2758, 1617, 875, 1658, 1615, 1613, - /* 2800 */ 1612, 1611, 950, 1657, 952, 232, 1609, 1608, 2350, 1607, - /* 2810 */ 1606, 1605, 1604, 2792, 2811, 1603, 2839, 1654, 491, 1652, - /* 2820 */ 430, 2794, 879, 2796, 2797, 874, 1600, 1599, 862, 898, - /* 2830 */ 2758, 1596, 875, 1595, 1594, 1593, 972, 974, 973, 2348, - /* 2840 */ 976, 2792, 978, 977, 2839, 2346, 2793, 980, 413, 2794, - /* 2850 */ 879, 2796, 2797, 874, 496, 981, 862, 898, 2343, 982, - /* 2860 */ 984, 876, 986, 985, 2323, 988, 2793, 2321, 990, 1530, - /* 2870 */ 2295, 1513, 1518, 994, 1520, 387, 998, 2792, 1983, 400, - /* 2880 */ 2839, 876, 1001, 1002, 430, 2794, 879, 2796, 2797, 874, - /* 2890 */ 2811, 2261, 862, 898, 2261, 2261, 2261, 2261, 2261, 2261, - /* 2900 */ 2261, 2261, 2261, 2261, 2261, 2261, 2758, 2261, 875, 2261, - /* 2910 */ 2811, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, - /* 2920 */ 2261, 2261, 2261, 2261, 2261, 2261, 2758, 2261, 875, 2261, - /* 2930 */ 498, 2793, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, - /* 2940 */ 2261, 2261, 2261, 2261, 2261, 2261, 876, 2261, 2261, 2261, - /* 2950 */ 2261, 2261, 2261, 2792, 2261, 2261, 2839, 2261, 2261, 2261, - /* 2960 */ 430, 2794, 879, 2796, 2797, 874, 2261, 2261, 862, 898, - /* 2970 */ 2261, 2261, 2261, 2792, 2261, 2811, 2839, 2261, 2261, 2261, - /* 2980 */ 415, 2794, 879, 2796, 2797, 874, 2261, 2261, 862, 898, - /* 2990 */ 2261, 2758, 2261, 875, 2261, 2261, 2261, 2261, 2261, 2261, - /* 3000 */ 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, - /* 3010 */ 2261, 2793, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, - /* 3020 */ 2261, 2261, 2261, 2261, 2261, 2793, 876, 2261, 2261, 2261, - /* 3030 */ 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 760, 2261, - /* 3040 */ 876, 2839, 2793, 2261, 2261, 425, 2794, 879, 2796, 2797, - /* 3050 */ 874, 2261, 2261, 862, 898, 2811, 2261, 876, 2261, 2261, - /* 3060 */ 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2811, - /* 3070 */ 2261, 2758, 2261, 875, 2261, 2261, 2261, 2261, 2261, 2261, - /* 3080 */ 2261, 2261, 2261, 2261, 2261, 2758, 2811, 875, 2261, 2261, - /* 3090 */ 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, - /* 3100 */ 2261, 2261, 2758, 2261, 875, 2261, 2261, 2793, 2261, 2261, - /* 3110 */ 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2792, 2261, - /* 3120 */ 2261, 2839, 876, 2261, 2261, 407, 2794, 879, 2796, 2797, - /* 3130 */ 874, 2261, 2792, 862, 898, 2839, 2261, 2261, 2261, 405, - /* 3140 */ 2794, 879, 2796, 2797, 874, 2261, 2261, 862, 898, 2792, - /* 3150 */ 2261, 2811, 2839, 2261, 2261, 2261, 408, 2794, 879, 2796, - /* 3160 */ 2797, 874, 2261, 2261, 862, 898, 2261, 2758, 2261, 875, - /* 3170 */ 2261, 2261, 2261, 2261, 2261, 2793, 2261, 2261, 2261, 2261, - /* 3180 */ 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, - /* 3190 */ 876, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, - /* 3200 */ 2261, 2261, 2261, 2793, 2261, 2261, 2261, 2261, 2261, 2261, - /* 3210 */ 2261, 2261, 2261, 2261, 2792, 2261, 2261, 2839, 876, 2811, - /* 3220 */ 2261, 422, 2794, 879, 2796, 2797, 874, 2261, 2261, 862, - /* 3230 */ 898, 2261, 2261, 2261, 2261, 2758, 2261, 875, 2261, 2793, - /* 3240 */ 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2811, 2261, 2261, - /* 3250 */ 2261, 2261, 2261, 2261, 876, 2261, 2261, 2261, 2261, 2261, - /* 3260 */ 2261, 2261, 2261, 2758, 2261, 875, 2261, 2261, 2261, 2261, - /* 3270 */ 2261, 2793, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, - /* 3280 */ 2261, 2261, 2792, 2811, 2261, 2839, 876, 2261, 2261, 409, - /* 3290 */ 2794, 879, 2796, 2797, 874, 2261, 2261, 862, 898, 2758, - /* 3300 */ 2261, 875, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, - /* 3310 */ 2792, 2261, 2261, 2839, 2261, 2811, 2261, 426, 2794, 879, - /* 3320 */ 2796, 2797, 874, 2261, 2261, 862, 898, 2261, 2261, 2261, - /* 3330 */ 2261, 2758, 2261, 875, 2261, 2261, 2793, 2261, 2261, 2261, - /* 3340 */ 2261, 2261, 2261, 2261, 2261, 2261, 2792, 2261, 2261, 2839, - /* 3350 */ 2261, 876, 2261, 410, 2794, 879, 2796, 2797, 874, 2793, - /* 3360 */ 2261, 862, 898, 2261, 2261, 2261, 2261, 2261, 2261, 2261, - /* 3370 */ 2261, 2261, 2261, 2261, 876, 2261, 2261, 2261, 2792, 2261, - /* 3380 */ 2811, 2839, 2261, 2261, 2261, 427, 2794, 879, 2796, 2797, - /* 3390 */ 874, 2261, 2261, 862, 898, 2261, 2758, 2261, 875, 2261, - /* 3400 */ 2261, 2793, 2261, 2811, 2261, 2261, 2261, 2261, 2261, 2261, - /* 3410 */ 2261, 2261, 2261, 2261, 2261, 2261, 876, 2261, 2261, 2758, - /* 3420 */ 2261, 875, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, - /* 3430 */ 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, - /* 3440 */ 2261, 2261, 2261, 2792, 2261, 2811, 2839, 2793, 2261, 2261, - /* 3450 */ 411, 2794, 879, 2796, 2797, 874, 2261, 2261, 862, 898, - /* 3460 */ 2261, 2758, 876, 875, 2261, 2261, 2792, 2261, 2261, 2839, - /* 3470 */ 2261, 2261, 2261, 428, 2794, 879, 2796, 2797, 874, 2261, - /* 3480 */ 2261, 862, 898, 2261, 2261, 2261, 2261, 2261, 2261, 2261, - /* 3490 */ 2261, 2811, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, - /* 3500 */ 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2758, 2792, 875, - /* 3510 */ 2261, 2839, 2793, 2261, 2261, 412, 2794, 879, 2796, 2797, - /* 3520 */ 874, 2261, 2261, 862, 898, 2261, 2261, 876, 2261, 2793, - /* 3530 */ 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, - /* 3540 */ 2261, 2261, 2261, 2261, 876, 2261, 2261, 2261, 2261, 2261, - /* 3550 */ 2261, 2261, 2261, 2261, 2792, 2261, 2811, 2839, 2261, 2261, - /* 3560 */ 2261, 406, 2794, 879, 2796, 2797, 874, 2261, 2261, 862, - /* 3570 */ 898, 2261, 2758, 2811, 875, 2261, 2261, 2261, 2261, 2261, - /* 3580 */ 2793, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2758, - /* 3590 */ 2261, 875, 2261, 2261, 2261, 876, 2261, 2261, 2261, 2261, - /* 3600 */ 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, - /* 3610 */ 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2792, - /* 3620 */ 2261, 2261, 2839, 2261, 2811, 2261, 414, 2794, 879, 2796, - /* 3630 */ 2797, 874, 2261, 2261, 862, 898, 2792, 2261, 2261, 2839, - /* 3640 */ 2758, 2261, 875, 417, 2794, 879, 2796, 2797, 874, 2261, - /* 3650 */ 2261, 862, 898, 2261, 2261, 2261, 2261, 2261, 2261, 2261, - /* 3660 */ 2261, 2793, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, - /* 3670 */ 2261, 2261, 2261, 2261, 2261, 2261, 876, 2261, 2261, 2261, - /* 3680 */ 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2792, 2261, 2793, - /* 3690 */ 2839, 2261, 2261, 2261, 418, 2794, 879, 2796, 2797, 874, - /* 3700 */ 2261, 2261, 862, 898, 876, 2811, 2261, 2261, 2261, 2261, - /* 3710 */ 2793, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, - /* 3720 */ 2261, 2758, 2261, 875, 2261, 876, 2261, 2261, 2261, 2261, - /* 3730 */ 2261, 2261, 2261, 2811, 2261, 2261, 2261, 2261, 2261, 2261, - /* 3740 */ 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2758, - /* 3750 */ 2261, 875, 2261, 2261, 2811, 2261, 2261, 2261, 2261, 2261, - /* 3760 */ 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2792, 2261, - /* 3770 */ 2758, 2839, 875, 2261, 2261, 419, 2794, 879, 2796, 2797, - /* 3780 */ 874, 2261, 2261, 862, 898, 2261, 2793, 2261, 2261, 2261, - /* 3790 */ 2261, 2261, 2261, 2261, 2261, 2261, 2792, 2261, 2261, 2839, - /* 3800 */ 2261, 876, 2261, 435, 2794, 879, 2796, 2797, 874, 2261, - /* 3810 */ 2261, 862, 898, 2261, 2261, 2261, 2261, 2792, 2261, 2261, - /* 3820 */ 2839, 2261, 2261, 2261, 436, 2794, 879, 2796, 2797, 874, - /* 3830 */ 2811, 2261, 862, 898, 2261, 2793, 2261, 2261, 2261, 2261, - /* 3840 */ 2261, 2261, 2261, 2261, 2261, 2261, 2758, 2261, 875, 2261, - /* 3850 */ 876, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, - /* 3860 */ 2261, 2261, 2261, 2793, 2261, 2261, 2261, 2261, 2261, 2261, - /* 3870 */ 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 876, 2811, - /* 3880 */ 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, - /* 3890 */ 2261, 2261, 2261, 2792, 2261, 2758, 2839, 875, 2261, 2793, - /* 3900 */ 2805, 2794, 879, 2796, 2797, 874, 2261, 2811, 862, 898, - /* 3910 */ 2261, 2261, 2261, 2261, 876, 2261, 2261, 2261, 2261, 2261, - /* 3920 */ 2261, 2261, 2261, 2758, 2261, 875, 2261, 2261, 2261, 2261, - /* 3930 */ 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, - /* 3940 */ 2261, 2261, 2792, 2811, 2261, 2839, 2261, 2261, 2261, 2804, - /* 3950 */ 2794, 879, 2796, 2797, 874, 2261, 2261, 862, 898, 2758, - /* 3960 */ 2261, 875, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, - /* 3970 */ 2792, 2261, 2261, 2839, 2261, 2261, 2261, 2803, 2794, 879, - /* 3980 */ 2796, 2797, 874, 2261, 2261, 862, 898, 2261, 2261, 2261, - /* 3990 */ 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, - /* 4000 */ 2261, 2261, 2261, 2261, 2261, 2261, 2792, 2261, 2261, 2839, - /* 4010 */ 2261, 2261, 2793, 455, 2794, 879, 2796, 2797, 874, 2261, - /* 4020 */ 2261, 862, 898, 2261, 2261, 2261, 2793, 876, 2261, 2261, - /* 4030 */ 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, - /* 4040 */ 2261, 876, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, - /* 4050 */ 2261, 2793, 2261, 2261, 2261, 2261, 2811, 2261, 2261, 2261, - /* 4060 */ 2261, 2261, 2261, 2261, 2261, 2261, 876, 2261, 2261, 2261, - /* 4070 */ 2811, 2261, 2758, 2261, 875, 2261, 2261, 2793, 2261, 2261, - /* 4080 */ 2261, 2261, 2261, 2261, 2261, 2261, 2758, 2261, 875, 2261, - /* 4090 */ 2261, 2261, 876, 2261, 2793, 2811, 2261, 2261, 2261, 2261, - /* 4100 */ 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 876, - /* 4110 */ 2261, 2758, 2261, 875, 2261, 2261, 2261, 2261, 2261, 2792, - /* 4120 */ 2261, 2811, 2839, 2261, 2261, 2261, 456, 2794, 879, 2796, - /* 4130 */ 2797, 874, 2261, 2792, 862, 898, 2839, 2758, 2811, 875, - /* 4140 */ 452, 2794, 879, 2796, 2797, 874, 2261, 2261, 862, 898, - /* 4150 */ 2261, 2261, 2261, 2261, 2758, 2261, 875, 2261, 2792, 2261, - /* 4160 */ 2261, 2839, 2261, 2261, 2261, 457, 2794, 879, 2796, 2797, - /* 4170 */ 874, 2261, 2261, 862, 898, 2261, 2261, 2261, 2261, 2261, - /* 4180 */ 2261, 2261, 2261, 2261, 877, 2261, 2261, 2839, 2261, 2261, - /* 4190 */ 2261, 425, 2794, 879, 2796, 2797, 874, 2261, 2261, 862, - /* 4200 */ 898, 2792, 2261, 2261, 2839, 2261, 2261, 2261, 424, 2794, - /* 4210 */ 879, 2796, 2797, 874, 2261, 2261, 862, 898, + /* 0 */ 2754, 566, 203, 516, 328, 670, 565, 2628, 671, 2313, + /* 10 */ 51, 50, 58, 56, 57, 55, 54, 53, 52, 39, + /* 20 */ 499, 492, 1984, 2714, 222, 51, 50, 2625, 882, 57, + /* 30 */ 55, 54, 53, 52, 2009, 821, 1982, 725, 2086, 2357, + /* 40 */ 2520, 2796, 3006, 3001, 57, 55, 54, 53, 52, 38, + /* 50 */ 3001, 43, 351, 833, 168, 895, 836, 787, 896, 2473, + /* 60 */ 1647, 820, 229, 505, 675, 3001, 3002, 822, 2081, 3005, + /* 70 */ 672, 865, 464, 3002, 3004, 757, 900, 218, 159, 787, + /* 80 */ 896, 2473, 1990, 3007, 229, 2814, 716, 3001, 3002, 822, + /* 90 */ 2533, 751, 193, 755, 753, 299, 298, 196, 462, 2277, + /* 100 */ 159, 2761, 2476, 877, 2601, 3007, 229, 2203, 721, 2531, + /* 110 */ 3002, 822, 1002, 833, 168, 59, 973, 972, 971, 970, + /* 120 */ 528, 2204, 969, 968, 173, 963, 962, 961, 960, 959, + /* 130 */ 958, 957, 172, 951, 950, 949, 527, 526, 946, 945, + /* 140 */ 944, 209, 208, 943, 523, 942, 941, 940, 2795, 2009, + /* 150 */ 61, 2843, 2089, 2090, 895, 132, 2797, 881, 2799, 2800, + /* 160 */ 876, 303, 811, 864, 900, 1536, 2628, 2202, 2182, 211, + /* 170 */ 218, 2903, 2553, 2628, 2009, 494, 2899, 205, 2911, 832, + /* 180 */ 501, 160, 831, 2796, 1543, 77, 2625, 882, 821, 3001, + /* 190 */ 135, 2045, 2055, 2626, 882, 230, 3001, 2602, 878, 518, + /* 200 */ 2475, 2088, 2091, 2950, 2266, 1829, 1830, 820, 229, 1538, + /* 210 */ 1541, 1542, 3002, 822, 820, 229, 1985, 770, 1983, 3002, + /* 220 */ 822, 2918, 9, 863, 857, 149, 2875, 2814, 148, 147, + /* 230 */ 146, 145, 144, 143, 142, 141, 140, 138, 2911, 2912, + /* 240 */ 2918, 166, 2916, 2761, 195, 877, 1910, 1911, 1912, 2915, + /* 250 */ 481, 2675, 2406, 1988, 1989, 2042, 2153, 2044, 2047, 2048, + /* 260 */ 2049, 2050, 2051, 2052, 2053, 2054, 873, 866, 2914, 771, + /* 270 */ 898, 897, 2073, 2074, 2075, 2076, 2077, 2080, 2082, 2083, + /* 280 */ 2084, 2085, 2087, 2, 58, 56, 2178, 95, 2796, 686, + /* 290 */ 2795, 302, 499, 2843, 1984, 301, 73, 132, 2797, 881, + /* 300 */ 2799, 2800, 876, 875, 171, 864, 900, 689, 1982, 170, + /* 310 */ 2086, 179, 2874, 2903, 2465, 51, 50, 494, 2899, 57, + /* 320 */ 55, 54, 53, 52, 41, 678, 2796, 612, 671, 2313, + /* 330 */ 51, 50, 2814, 2153, 57, 55, 54, 53, 52, 693, + /* 340 */ 2081, 878, 611, 865, 503, 2046, 906, 19, 2761, 218, + /* 350 */ 877, 680, 2667, 520, 1990, 149, 2526, 2528, 148, 147, + /* 360 */ 146, 145, 144, 143, 142, 141, 140, 58, 56, 114, + /* 370 */ 2814, 2464, 3006, 2533, 445, 499, 2601, 1984, 479, 265, + /* 380 */ 759, 490, 456, 673, 1002, 2321, 2761, 15, 877, 2012, + /* 390 */ 550, 1982, 2531, 2086, 392, 2795, 2755, 2042, 2843, 2150, + /* 400 */ 2151, 2152, 431, 2797, 881, 2799, 2800, 876, 874, 2043, + /* 410 */ 864, 900, 856, 2868, 2360, 573, 937, 185, 184, 934, + /* 420 */ 933, 932, 182, 2081, 2089, 2090, 865, 54, 53, 52, + /* 430 */ 19, 2533, 2116, 2795, 505, 124, 2843, 1990, 2153, 504, + /* 440 */ 132, 2797, 881, 2799, 2800, 876, 895, 900, 864, 900, + /* 450 */ 2531, 2325, 2097, 2009, 2878, 2676, 2903, 2010, 2009, 505, + /* 460 */ 494, 2899, 2466, 2045, 2055, 635, 633, 1002, 436, 2013, + /* 470 */ 15, 243, 900, 2088, 2091, 2923, 2150, 2151, 2152, 2923, + /* 480 */ 2923, 2923, 2923, 2923, 956, 2246, 3006, 2432, 1985, 335, + /* 490 */ 1983, 737, 736, 735, 3001, 863, 502, 2117, 727, 165, + /* 500 */ 731, 905, 904, 903, 730, 192, 991, 2089, 2090, 729, + /* 510 */ 734, 474, 473, 3005, 2288, 728, 2478, 3002, 3003, 472, + /* 520 */ 724, 723, 722, 582, 2597, 1988, 1989, 2042, 554, 2044, + /* 530 */ 2047, 2048, 2049, 2050, 2051, 2052, 2053, 2054, 873, 866, + /* 540 */ 806, 61, 898, 897, 2073, 2074, 2045, 2055, 73, 2080, + /* 550 */ 2082, 2083, 2084, 2085, 2087, 2, 2088, 2091, 556, 552, + /* 560 */ 51, 50, 333, 2771, 57, 55, 54, 53, 52, 588, + /* 570 */ 2597, 1985, 2013, 1983, 2761, 2122, 73, 245, 863, 828, + /* 580 */ 2923, 2150, 2151, 2152, 2923, 2923, 2923, 2923, 2923, 1755, + /* 590 */ 1756, 859, 2775, 2875, 42, 496, 2111, 2112, 2113, 2114, + /* 600 */ 2115, 2119, 2120, 2121, 896, 2473, 342, 343, 1988, 1989, + /* 610 */ 2042, 341, 2044, 2047, 2048, 2049, 2050, 2051, 2052, 2053, + /* 620 */ 2054, 873, 866, 247, 522, 898, 897, 2073, 2074, 2046, + /* 630 */ 895, 62, 2080, 2082, 2083, 2084, 2085, 2087, 2, 12, + /* 640 */ 58, 56, 2777, 2779, 495, 267, 2477, 687, 499, 673, + /* 650 */ 1984, 2321, 619, 2597, 249, 900, 511, 1716, 812, 807, + /* 660 */ 800, 796, 833, 168, 1982, 939, 2086, 2155, 2156, 2157, + /* 670 */ 2158, 2159, 1707, 929, 928, 927, 1711, 926, 1713, 1714, + /* 680 */ 925, 922, 2796, 1722, 919, 1724, 1725, 916, 913, 910, + /* 690 */ 2265, 768, 1563, 2043, 1562, 2010, 2081, 878, 868, 865, + /* 700 */ 105, 771, 2009, 19, 2014, 104, 252, 767, 164, 867, + /* 710 */ 1990, 688, 2621, 2287, 158, 157, 156, 155, 154, 153, + /* 720 */ 152, 151, 150, 58, 56, 2092, 2814, 125, 471, 470, + /* 730 */ 1564, 499, 514, 1984, 335, 1716, 525, 524, 2457, 443, + /* 740 */ 1002, 335, 2761, 15, 877, 225, 12, 1982, 1654, 2086, + /* 750 */ 1707, 929, 928, 927, 1711, 926, 1713, 1714, 872, 871, + /* 760 */ 1991, 1722, 870, 1724, 1725, 869, 913, 910, 115, 335, + /* 770 */ 51, 50, 103, 2761, 57, 55, 54, 53, 52, 2081, + /* 780 */ 2089, 2090, 865, 773, 2667, 2263, 199, 2911, 2912, 2795, + /* 790 */ 166, 2916, 2843, 1990, 1656, 33, 132, 2797, 881, 2799, + /* 800 */ 2800, 876, 1884, 769, 864, 900, 2013, 2014, 469, 468, + /* 810 */ 2876, 718, 2903, 896, 2473, 73, 494, 2899, 1990, 2045, + /* 820 */ 2055, 1005, 667, 1002, 335, 2701, 59, 1856, 1857, 2088, + /* 830 */ 2091, 665, 720, 234, 661, 657, 719, 2286, 1953, 12, + /* 840 */ 389, 10, 896, 2473, 1985, 183, 1983, 2527, 2528, 896, + /* 850 */ 2473, 863, 2013, 51, 50, 993, 219, 57, 55, 54, + /* 860 */ 53, 52, 66, 2089, 2090, 989, 985, 981, 977, 570, + /* 870 */ 384, 510, 509, 2046, 531, 2771, 1855, 1858, 2223, 530, + /* 880 */ 829, 1988, 1989, 2042, 2447, 2044, 2047, 2048, 2049, 2050, + /* 890 */ 2051, 2052, 2053, 2054, 873, 866, 545, 2761, 898, 897, + /* 900 */ 2073, 2074, 2045, 2055, 2775, 2080, 2082, 2083, 2084, 2085, + /* 910 */ 2087, 2, 2088, 2091, 1952, 564, 131, 563, 51, 50, + /* 920 */ 236, 357, 57, 55, 54, 53, 52, 1985, 65, 1983, + /* 930 */ 787, 14, 13, 169, 863, 2570, 2874, 2043, 3001, 896, + /* 940 */ 2473, 2533, 1994, 833, 168, 690, 385, 513, 512, 519, + /* 950 */ 562, 810, 849, 930, 2777, 2780, 3007, 229, 939, 571, + /* 960 */ 2531, 3002, 822, 392, 1988, 1989, 2042, 900, 2044, 2047, + /* 970 */ 2048, 2049, 2050, 2051, 2052, 2053, 2054, 873, 866, 224, + /* 980 */ 2814, 898, 897, 2073, 2074, 2285, 744, 629, 2080, 2082, + /* 990 */ 2083, 2084, 2085, 2087, 2, 58, 56, 355, 2796, 855, + /* 1000 */ 2681, 758, 338, 499, 2615, 1984, 691, 337, 335, 931, + /* 1010 */ 51, 50, 2524, 836, 57, 55, 54, 53, 52, 1982, + /* 1020 */ 300, 2086, 1543, 480, 2675, 232, 307, 51, 50, 2284, + /* 1030 */ 37, 57, 55, 54, 53, 52, 747, 896, 2473, 896, + /* 1040 */ 2473, 2014, 2814, 741, 739, 2761, 2130, 2796, 1541, 1542, + /* 1050 */ 297, 2081, 809, 2253, 865, 254, 111, 590, 2761, 604, + /* 1060 */ 877, 304, 878, 896, 2473, 1990, 835, 198, 2911, 2912, + /* 1070 */ 220, 166, 2916, 2211, 467, 2462, 1566, 1567, 58, 56, + /* 1080 */ 628, 253, 290, 605, 2468, 288, 499, 2014, 1984, 2761, + /* 1090 */ 193, 2814, 223, 2283, 626, 1002, 83, 2918, 59, 518, + /* 1100 */ 2475, 82, 1982, 136, 2086, 2795, 610, 2761, 2843, 877, + /* 1110 */ 1666, 609, 132, 2797, 881, 2799, 2800, 876, 2066, 608, + /* 1120 */ 864, 900, 712, 711, 1665, 2913, 211, 726, 2903, 896, + /* 1130 */ 2473, 786, 494, 2899, 2081, 2089, 2090, 865, 896, 2473, + /* 1140 */ 803, 802, 2209, 2210, 2212, 2213, 2214, 521, 1990, 606, + /* 1150 */ 1645, 896, 2473, 2761, 2795, 953, 192, 2843, 692, 1649, + /* 1160 */ 2951, 197, 2797, 881, 2799, 2800, 876, 2478, 2175, 864, + /* 1170 */ 900, 2470, 714, 713, 2045, 2055, 896, 2473, 1002, 111, + /* 1180 */ 2252, 59, 896, 2473, 2088, 2091, 2012, 51, 50, 733, + /* 1190 */ 732, 57, 55, 54, 53, 52, 305, 896, 2473, 1985, + /* 1200 */ 640, 1983, 313, 896, 2473, 1650, 863, 2469, 51, 50, + /* 1210 */ 788, 2961, 57, 55, 54, 53, 52, 839, 2089, 2090, + /* 1220 */ 2407, 967, 965, 346, 955, 2282, 46, 51, 50, 825, + /* 1230 */ 2281, 57, 55, 54, 53, 52, 1988, 1989, 2042, 2449, + /* 1240 */ 2044, 2047, 2048, 2049, 2050, 2051, 2052, 2053, 2054, 873, + /* 1250 */ 866, 2280, 2279, 898, 897, 2073, 2074, 2045, 2055, 3005, + /* 1260 */ 2080, 2082, 2083, 2084, 2085, 2087, 2, 2088, 2091, 51, + /* 1270 */ 50, 44, 71, 57, 55, 54, 53, 52, 2460, 737, + /* 1280 */ 736, 735, 1985, 784, 1983, 2761, 727, 165, 731, 863, + /* 1290 */ 2761, 391, 730, 896, 2473, 2061, 2344, 729, 734, 474, + /* 1300 */ 473, 2009, 1563, 728, 1562, 2276, 192, 472, 724, 723, + /* 1310 */ 722, 2761, 2761, 853, 896, 2473, 2222, 2479, 738, 1988, + /* 1320 */ 1989, 2042, 2118, 2044, 2047, 2048, 2049, 2050, 2051, 2052, + /* 1330 */ 2053, 2054, 873, 866, 353, 2194, 898, 897, 2073, 2074, + /* 1340 */ 1564, 2275, 1670, 2080, 2082, 2083, 2084, 2085, 2087, 2, + /* 1350 */ 58, 56, 1984, 2274, 310, 440, 1669, 2007, 499, 333, + /* 1360 */ 1984, 896, 2473, 2796, 617, 2761, 1982, 466, 935, 2293, + /* 1370 */ 995, 2524, 896, 2473, 1982, 637, 2086, 2062, 878, 2535, + /* 1380 */ 815, 889, 896, 2473, 937, 185, 184, 934, 933, 932, + /* 1390 */ 182, 596, 890, 639, 896, 2473, 2273, 2272, 441, 598, + /* 1400 */ 2123, 2761, 894, 2533, 2271, 2270, 2081, 2814, 2533, 865, + /* 1410 */ 576, 2269, 1990, 2761, 381, 2268, 862, 3, 936, 40, + /* 1420 */ 1990, 2524, 840, 2761, 161, 877, 761, 848, 760, 51, + /* 1430 */ 50, 64, 642, 57, 55, 54, 53, 52, 101, 51, + /* 1440 */ 50, 2278, 1002, 57, 55, 54, 53, 52, 399, 2164, + /* 1450 */ 1002, 465, 2510, 15, 51, 50, 2761, 2761, 57, 55, + /* 1460 */ 54, 53, 52, 584, 2761, 2761, 1545, 2705, 2533, 175, + /* 1470 */ 2795, 2761, 2008, 2843, 2174, 2761, 175, 408, 2797, 881, + /* 1480 */ 2799, 2800, 876, 2580, 31, 864, 900, 2532, 720, 89, + /* 1490 */ 2089, 2090, 719, 45, 2608, 2587, 2782, 625, 624, 623, + /* 1500 */ 622, 621, 616, 615, 614, 613, 449, 314, 398, 603, + /* 1510 */ 602, 601, 600, 599, 593, 592, 591, 2450, 586, 585, + /* 1520 */ 463, 538, 2342, 794, 577, 1817, 1818, 580, 826, 2045, + /* 1530 */ 2055, 1836, 292, 2333, 638, 291, 2043, 2064, 294, 2088, + /* 1540 */ 2091, 293, 296, 102, 740, 295, 1985, 2067, 1983, 285, + /* 1550 */ 174, 2331, 1900, 2477, 1985, 742, 1983, 60, 116, 1908, + /* 1560 */ 2784, 863, 183, 51, 50, 204, 2964, 57, 55, 54, + /* 1570 */ 53, 52, 60, 745, 710, 706, 702, 698, 203, 284, + /* 1580 */ 212, 2255, 2256, 1988, 1989, 340, 824, 14, 13, 88, + /* 1590 */ 329, 1988, 1989, 2042, 2108, 2044, 2047, 2048, 2049, 2050, + /* 1600 */ 2051, 2052, 2053, 2054, 873, 866, 2198, 60, 898, 897, + /* 1610 */ 2073, 2074, 360, 359, 804, 2080, 2082, 2083, 2084, 2085, + /* 1620 */ 2087, 2, 194, 362, 361, 112, 2796, 405, 321, 834, + /* 1630 */ 282, 51, 50, 1993, 1992, 57, 55, 54, 53, 52, + /* 1640 */ 2208, 878, 163, 2323, 2446, 838, 403, 87, 2815, 75, + /* 1650 */ 86, 60, 2796, 2399, 60, 2207, 2398, 364, 363, 2314, + /* 1660 */ 130, 442, 127, 319, 60, 366, 365, 878, 344, 2958, + /* 1670 */ 2814, 2063, 845, 263, 652, 650, 647, 645, 368, 367, + /* 1680 */ 88, 370, 369, 372, 371, 2954, 2761, 801, 877, 180, + /* 1690 */ 2065, 374, 373, 376, 375, 161, 2814, 270, 486, 378, + /* 1700 */ 377, 183, 380, 379, 808, 85, 281, 842, 947, 2606, + /* 1710 */ 272, 279, 2761, 908, 877, 181, 277, 684, 183, 73, + /* 1720 */ 482, 51, 50, 529, 162, 57, 55, 54, 53, 52, + /* 1730 */ 1627, 1619, 2124, 2795, 2068, 269, 2843, 2056, 547, 2060, + /* 1740 */ 132, 2797, 881, 2799, 2800, 876, 2715, 1853, 864, 900, + /* 1750 */ 948, 1600, 180, 2320, 3021, 764, 2903, 2521, 74, 2795, + /* 1760 */ 494, 2899, 2843, 1843, 2796, 780, 132, 2797, 881, 2799, + /* 1770 */ 2800, 876, 356, 1617, 864, 900, 1628, 331, 893, 878, + /* 1780 */ 3021, 2971, 2903, 2955, 1698, 772, 494, 2899, 397, 937, + /* 1790 */ 185, 184, 934, 933, 932, 182, 1729, 1601, 1737, 326, + /* 1800 */ 2965, 1744, 787, 816, 817, 334, 2607, 1742, 2814, 2433, + /* 1810 */ 3001, 787, 99, 98, 569, 1996, 1995, 242, 5, 3001, + /* 1820 */ 532, 537, 460, 2007, 2761, 2017, 877, 546, 3007, 229, + /* 1830 */ 561, 559, 237, 3002, 822, 186, 557, 3007, 229, 837, + /* 1840 */ 2796, 787, 3002, 822, 439, 558, 238, 548, 560, 3001, + /* 1850 */ 544, 540, 536, 533, 562, 878, 240, 798, 390, 574, + /* 1860 */ 1877, 2008, 581, 251, 583, 587, 589, 3007, 229, 594, + /* 1870 */ 618, 2795, 3002, 822, 2843, 607, 631, 2599, 132, 2797, + /* 1880 */ 881, 2799, 2800, 876, 2814, 620, 864, 900, 627, 2796, + /* 1890 */ 630, 643, 3021, 632, 2903, 787, 644, 641, 494, 2899, + /* 1900 */ 2761, 256, 877, 3001, 878, 257, 2994, 646, 648, 649, + /* 1910 */ 2015, 260, 335, 651, 668, 525, 524, 653, 4, 669, + /* 1920 */ 2796, 3007, 229, 676, 679, 1998, 3002, 822, 677, 2010, + /* 1930 */ 681, 2016, 268, 2814, 2018, 878, 683, 2935, 107, 1991, + /* 1940 */ 682, 2086, 271, 685, 274, 2019, 276, 2795, 108, 2761, + /* 1950 */ 2843, 877, 2622, 2020, 132, 2797, 881, 2799, 2800, 876, + /* 1960 */ 2616, 109, 864, 900, 2814, 110, 694, 715, 3021, 283, + /* 1970 */ 2903, 2081, 137, 717, 494, 2899, 2463, 287, 434, 2459, + /* 1980 */ 2761, 47, 877, 289, 748, 1990, 749, 188, 763, 113, + /* 1990 */ 2691, 134, 2461, 2456, 189, 190, 2795, 2688, 306, 2843, + /* 2000 */ 765, 176, 393, 132, 2797, 881, 2799, 2800, 876, 2011, + /* 2010 */ 775, 864, 900, 2687, 774, 861, 2796, 3021, 779, 2903, + /* 2020 */ 311, 776, 782, 494, 2899, 791, 805, 2795, 2668, 2970, + /* 2030 */ 2843, 878, 843, 8, 132, 2797, 881, 2799, 2800, 876, + /* 2040 */ 2969, 781, 864, 900, 316, 814, 318, 2942, 3021, 309, + /* 2050 */ 2903, 447, 446, 202, 494, 2899, 792, 790, 789, 325, + /* 2060 */ 2814, 506, 320, 819, 818, 830, 487, 322, 323, 324, + /* 2070 */ 3024, 827, 2012, 2172, 167, 515, 2761, 2086, 877, 2170, + /* 2080 */ 2919, 215, 394, 336, 177, 841, 2636, 2635, 2634, 395, + /* 2090 */ 491, 846, 847, 178, 854, 72, 883, 851, 349, 885, + /* 2100 */ 2474, 2753, 2884, 887, 888, 2922, 327, 2081, 354, 2796, + /* 2110 */ 123, 126, 2752, 231, 1, 902, 2748, 1515, 396, 1999, + /* 2120 */ 998, 1994, 997, 2795, 878, 400, 2843, 2747, 187, 999, + /* 2130 */ 132, 2797, 881, 2799, 2800, 876, 994, 63, 864, 900, + /* 2140 */ 3000, 330, 2739, 383, 858, 387, 2903, 386, 2738, 2796, + /* 2150 */ 494, 2899, 2730, 2814, 2729, 1001, 2002, 2004, 2745, 2744, + /* 2160 */ 2736, 2735, 452, 435, 878, 2724, 2723, 2742, 402, 2761, + /* 2170 */ 2741, 877, 2733, 898, 897, 2732, 404, 2721, 444, 767, + /* 2180 */ 2080, 2082, 2083, 2084, 2085, 2087, 448, 2720, 2718, 422, + /* 2190 */ 2717, 2525, 433, 2814, 453, 423, 2713, 2712, 2711, 96, + /* 2200 */ 2706, 534, 535, 1935, 1936, 235, 539, 2704, 541, 2761, + /* 2210 */ 542, 877, 543, 1934, 2703, 2702, 2795, 461, 2700, 2843, + /* 2220 */ 549, 2699, 551, 133, 2797, 881, 2799, 2800, 876, 2698, + /* 2230 */ 553, 864, 900, 2697, 2796, 555, 1922, 2672, 239, 2903, + /* 2240 */ 2671, 241, 1880, 2902, 2899, 97, 1879, 2649, 2648, 878, + /* 2250 */ 2647, 2646, 567, 568, 2645, 1975, 2795, 1951, 2589, 2843, + /* 2260 */ 572, 1816, 2586, 133, 2797, 881, 2799, 2800, 876, 2585, + /* 2270 */ 2796, 864, 900, 2579, 575, 578, 579, 2576, 2814, 2903, + /* 2280 */ 2575, 244, 100, 860, 2899, 878, 2574, 2573, 2578, 2577, + /* 2290 */ 508, 507, 1976, 246, 2761, 2572, 877, 2571, 2569, 2568, + /* 2300 */ 2567, 248, 595, 2566, 597, 2564, 2563, 2562, 2561, 898, + /* 2310 */ 897, 2560, 2584, 2559, 2814, 2558, 2080, 2082, 2083, 2084, + /* 2320 */ 2085, 2087, 2557, 2582, 2565, 2556, 2555, 2554, 2552, 2551, + /* 2330 */ 2761, 2550, 877, 2549, 2548, 2547, 250, 2546, 106, 2545, + /* 2340 */ 2544, 879, 2543, 2542, 2843, 255, 2796, 2614, 133, 2797, + /* 2350 */ 881, 2799, 2800, 876, 2583, 2581, 864, 900, 2541, 2540, + /* 2360 */ 1822, 878, 2539, 2538, 2903, 2537, 2536, 636, 455, 2899, + /* 2370 */ 634, 2534, 1667, 450, 1671, 2364, 2363, 2795, 258, 2362, + /* 2380 */ 2843, 84, 451, 2361, 200, 2797, 881, 2799, 2800, 876, + /* 2390 */ 2814, 2359, 864, 900, 2356, 2796, 1663, 654, 655, 2355, + /* 2400 */ 259, 656, 659, 658, 261, 2348, 2761, 663, 877, 262, + /* 2410 */ 878, 2335, 660, 662, 664, 2309, 666, 92, 210, 264, + /* 2420 */ 2781, 1544, 2308, 2670, 2666, 221, 2656, 2796, 93, 674, + /* 2430 */ 2644, 266, 273, 275, 2643, 2620, 2613, 2451, 278, 2814, + /* 2440 */ 280, 2358, 878, 2354, 695, 823, 3022, 696, 697, 2352, + /* 2450 */ 699, 700, 2350, 2795, 701, 2761, 2843, 877, 2347, 2330, + /* 2460 */ 133, 2797, 881, 2799, 2800, 876, 1593, 703, 864, 900, + /* 2470 */ 704, 2814, 705, 708, 707, 2328, 2903, 709, 2329, 2327, + /* 2480 */ 2305, 2900, 2453, 1749, 1748, 2452, 1653, 2761, 1635, 877, + /* 2490 */ 1652, 1651, 1648, 2345, 2343, 2334, 1646, 1644, 475, 1643, + /* 2500 */ 743, 1642, 2795, 1641, 1640, 2843, 964, 966, 1637, 197, + /* 2510 */ 2797, 881, 2799, 2800, 876, 286, 2796, 864, 900, 1636, + /* 2520 */ 1634, 476, 477, 2332, 478, 746, 2304, 2303, 2302, 2301, + /* 2530 */ 2300, 878, 750, 752, 2795, 2299, 2796, 2843, 756, 754, + /* 2540 */ 139, 425, 2797, 881, 2799, 2800, 876, 1916, 1918, 864, + /* 2550 */ 900, 878, 2669, 1915, 2665, 1920, 308, 32, 1886, 2962, + /* 2560 */ 2814, 78, 1888, 2655, 2642, 777, 2641, 783, 3006, 21, + /* 2570 */ 191, 17, 1890, 793, 766, 67, 2761, 483, 877, 22, + /* 2580 */ 2814, 23, 214, 6, 34, 1905, 2225, 2199, 68, 778, + /* 2590 */ 7, 24, 799, 1865, 813, 1864, 2761, 312, 877, 797, + /* 2600 */ 484, 2796, 315, 795, 785, 36, 317, 2206, 2193, 226, + /* 2610 */ 2782, 227, 2167, 201, 2165, 76, 878, 2163, 25, 213, + /* 2620 */ 485, 2796, 35, 2795, 94, 228, 2843, 18, 2240, 2245, + /* 2630 */ 432, 2797, 881, 2799, 2800, 876, 875, 2246, 864, 900, + /* 2640 */ 2239, 488, 2244, 2795, 2243, 2814, 2843, 489, 332, 2147, + /* 2650 */ 432, 2797, 881, 2799, 2800, 876, 70, 2640, 864, 900, + /* 2660 */ 2146, 2761, 2619, 877, 206, 2814, 117, 2618, 118, 339, + /* 2670 */ 119, 2201, 216, 2612, 120, 345, 80, 26, 850, 13, + /* 2680 */ 2000, 2761, 348, 877, 2099, 2109, 2098, 2035, 207, 27, + /* 2690 */ 28, 11, 20, 217, 48, 2611, 2059, 2058, 915, 918, + /* 2700 */ 69, 921, 844, 924, 852, 49, 2796, 2057, 2795, 16, + /* 2710 */ 350, 2843, 2027, 29, 347, 200, 2797, 881, 2799, 2800, + /* 2720 */ 876, 878, 30, 864, 900, 81, 121, 2448, 2795, 891, + /* 2730 */ 884, 2843, 352, 122, 2796, 431, 2797, 881, 2799, 2800, + /* 2740 */ 876, 886, 127, 864, 900, 892, 2869, 90, 358, 878, + /* 2750 */ 2814, 2070, 2261, 2853, 2852, 899, 79, 901, 2260, 2259, + /* 2760 */ 907, 1730, 517, 2258, 909, 911, 2761, 1727, 877, 912, + /* 2770 */ 2796, 1726, 1723, 1739, 880, 914, 917, 3023, 2814, 1717, + /* 2780 */ 920, 923, 1715, 1721, 1720, 878, 128, 1719, 382, 1718, + /* 2790 */ 497, 129, 1743, 91, 2761, 1591, 877, 938, 1631, 1630, + /* 2800 */ 1629, 1626, 1623, 1622, 1621, 1620, 1618, 1616, 1615, 1614, + /* 2810 */ 1661, 952, 954, 2795, 2814, 1660, 2843, 233, 493, 1612, + /* 2820 */ 432, 2797, 881, 2799, 2800, 876, 1611, 1610, 864, 900, + /* 2830 */ 2761, 1609, 877, 1608, 1607, 1606, 1657, 1655, 1603, 1602, + /* 2840 */ 1599, 2795, 1598, 1597, 2843, 2353, 2796, 1596, 417, 2797, + /* 2850 */ 881, 2799, 2800, 876, 498, 974, 864, 900, 2351, 975, + /* 2860 */ 976, 878, 978, 2349, 979, 982, 2796, 980, 984, 983, + /* 2870 */ 2346, 986, 987, 2326, 988, 990, 2324, 2795, 992, 1533, + /* 2880 */ 2843, 878, 1516, 1521, 432, 2797, 881, 2799, 2800, 876, + /* 2890 */ 2814, 2298, 864, 900, 996, 1523, 388, 1986, 1000, 1004, + /* 2900 */ 401, 1003, 2264, 2264, 2264, 2264, 2761, 2264, 877, 2264, + /* 2910 */ 2814, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, + /* 2920 */ 2264, 2264, 2264, 2264, 2264, 2264, 2761, 2264, 877, 2264, + /* 2930 */ 500, 2796, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, + /* 2940 */ 2264, 2264, 2264, 2264, 2264, 2264, 878, 2264, 2264, 2264, + /* 2950 */ 2264, 2264, 2264, 2795, 2264, 2264, 2843, 2264, 2264, 2264, + /* 2960 */ 432, 2797, 881, 2799, 2800, 876, 2264, 2264, 864, 900, + /* 2970 */ 2264, 2264, 2264, 2795, 2264, 2814, 2843, 2264, 2264, 2264, + /* 2980 */ 413, 2797, 881, 2799, 2800, 876, 2264, 2264, 864, 900, + /* 2990 */ 2264, 2761, 2264, 877, 2264, 2264, 2264, 2264, 2264, 2264, + /* 3000 */ 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, + /* 3010 */ 2264, 2796, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, + /* 3020 */ 2264, 2264, 2264, 2264, 2264, 2796, 878, 2264, 2264, 2264, + /* 3030 */ 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 762, 2264, + /* 3040 */ 878, 2843, 2796, 2264, 2264, 427, 2797, 881, 2799, 2800, + /* 3050 */ 876, 2264, 2264, 864, 900, 2814, 2264, 878, 2264, 2264, + /* 3060 */ 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2814, + /* 3070 */ 2264, 2761, 2264, 877, 2264, 2264, 2264, 2264, 2264, 2264, + /* 3080 */ 2264, 2264, 2264, 2264, 2264, 2761, 2814, 877, 2264, 2264, + /* 3090 */ 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, + /* 3100 */ 2264, 2264, 2761, 2264, 877, 2264, 2264, 2796, 2264, 2264, + /* 3110 */ 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2795, 2264, + /* 3120 */ 2264, 2843, 878, 2264, 2264, 409, 2797, 881, 2799, 2800, + /* 3130 */ 876, 2264, 2795, 864, 900, 2843, 2264, 2264, 2264, 406, + /* 3140 */ 2797, 881, 2799, 2800, 876, 2264, 2264, 864, 900, 2795, + /* 3150 */ 2264, 2814, 2843, 2264, 2264, 2264, 410, 2797, 881, 2799, + /* 3160 */ 2800, 876, 2264, 2264, 864, 900, 2264, 2761, 2264, 877, + /* 3170 */ 2264, 2264, 2264, 2264, 2264, 2796, 2264, 2264, 2264, 2264, + /* 3180 */ 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, + /* 3190 */ 878, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, + /* 3200 */ 2264, 2264, 2264, 2796, 2264, 2264, 2264, 2264, 2264, 2264, + /* 3210 */ 2264, 2264, 2264, 2264, 2795, 2264, 2264, 2843, 878, 2814, + /* 3220 */ 2264, 424, 2797, 881, 2799, 2800, 876, 2264, 2264, 864, + /* 3230 */ 900, 2264, 2264, 2264, 2264, 2761, 2264, 877, 2264, 2796, + /* 3240 */ 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2814, 2264, 2264, + /* 3250 */ 2264, 2264, 2264, 2264, 878, 2264, 2264, 2264, 2264, 2264, + /* 3260 */ 2264, 2264, 2264, 2761, 2264, 877, 2264, 2264, 2264, 2264, + /* 3270 */ 2264, 2796, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, + /* 3280 */ 2264, 2264, 2795, 2814, 2264, 2843, 878, 2264, 2264, 411, + /* 3290 */ 2797, 881, 2799, 2800, 876, 2264, 2264, 864, 900, 2761, + /* 3300 */ 2264, 877, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, + /* 3310 */ 2795, 2264, 2264, 2843, 2264, 2814, 2264, 412, 2797, 881, + /* 3320 */ 2799, 2800, 876, 2264, 2264, 864, 900, 2264, 2264, 2264, + /* 3330 */ 2264, 2761, 2264, 877, 2264, 2264, 2796, 2264, 2264, 2264, + /* 3340 */ 2264, 2264, 2264, 2264, 2264, 2264, 2795, 2264, 2264, 2843, + /* 3350 */ 2264, 878, 2264, 428, 2797, 881, 2799, 2800, 876, 2796, + /* 3360 */ 2264, 864, 900, 2264, 2264, 2264, 2264, 2264, 2264, 2264, + /* 3370 */ 2264, 2264, 2264, 2264, 878, 2264, 2264, 2264, 2795, 2264, + /* 3380 */ 2814, 2843, 2264, 2264, 2264, 414, 2797, 881, 2799, 2800, + /* 3390 */ 876, 2264, 2264, 864, 900, 2264, 2761, 2264, 877, 2264, + /* 3400 */ 2264, 2796, 2264, 2814, 2264, 2264, 2264, 2264, 2264, 2264, + /* 3410 */ 2264, 2264, 2264, 2264, 2264, 2264, 878, 2264, 2264, 2761, + /* 3420 */ 2264, 877, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, + /* 3430 */ 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, + /* 3440 */ 2264, 2264, 2264, 2795, 2264, 2814, 2843, 2796, 2264, 2264, + /* 3450 */ 429, 2797, 881, 2799, 2800, 876, 2264, 2264, 864, 900, + /* 3460 */ 2264, 2761, 878, 877, 2264, 2264, 2795, 2264, 2264, 2843, + /* 3470 */ 2264, 2264, 2264, 415, 2797, 881, 2799, 2800, 876, 2264, + /* 3480 */ 2264, 864, 900, 2264, 2264, 2264, 2264, 2264, 2264, 2264, + /* 3490 */ 2264, 2814, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, + /* 3500 */ 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2761, 2795, 877, + /* 3510 */ 2264, 2843, 2796, 2264, 2264, 430, 2797, 881, 2799, 2800, + /* 3520 */ 876, 2264, 2264, 864, 900, 2264, 2264, 878, 2264, 2796, + /* 3530 */ 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, + /* 3540 */ 2264, 2264, 2264, 2264, 878, 2264, 2264, 2264, 2264, 2264, + /* 3550 */ 2264, 2264, 2264, 2264, 2795, 2264, 2814, 2843, 2264, 2264, + /* 3560 */ 2264, 416, 2797, 881, 2799, 2800, 876, 2264, 2264, 864, + /* 3570 */ 900, 2264, 2761, 2814, 877, 2264, 2264, 2264, 2264, 2264, + /* 3580 */ 2796, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2761, + /* 3590 */ 2264, 877, 2264, 2264, 2264, 878, 2264, 2264, 2264, 2264, + /* 3600 */ 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, + /* 3610 */ 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2795, + /* 3620 */ 2264, 2264, 2843, 2264, 2814, 2264, 407, 2797, 881, 2799, + /* 3630 */ 2800, 876, 2264, 2264, 864, 900, 2795, 2264, 2264, 2843, + /* 3640 */ 2761, 2264, 877, 418, 2797, 881, 2799, 2800, 876, 2264, + /* 3650 */ 2264, 864, 900, 2264, 2264, 2264, 2264, 2264, 2264, 2264, + /* 3660 */ 2264, 2796, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, + /* 3670 */ 2264, 2264, 2264, 2264, 2264, 2264, 878, 2264, 2264, 2264, + /* 3680 */ 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2795, 2264, 2796, + /* 3690 */ 2843, 2264, 2264, 2264, 419, 2797, 881, 2799, 2800, 876, + /* 3700 */ 2264, 2264, 864, 900, 878, 2814, 2264, 2264, 2264, 2264, + /* 3710 */ 2796, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, + /* 3720 */ 2264, 2761, 2264, 877, 2264, 878, 2264, 2264, 2264, 2264, + /* 3730 */ 2264, 2264, 2264, 2814, 2264, 2264, 2264, 2264, 2264, 2264, + /* 3740 */ 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2761, + /* 3750 */ 2264, 877, 2264, 2264, 2814, 2264, 2264, 2264, 2264, 2264, + /* 3760 */ 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2795, 2264, + /* 3770 */ 2761, 2843, 877, 2264, 2264, 420, 2797, 881, 2799, 2800, + /* 3780 */ 876, 2264, 2264, 864, 900, 2264, 2796, 2264, 2264, 2264, + /* 3790 */ 2264, 2264, 2264, 2264, 2264, 2264, 2795, 2264, 2264, 2843, + /* 3800 */ 2264, 878, 2264, 421, 2797, 881, 2799, 2800, 876, 2264, + /* 3810 */ 2264, 864, 900, 2264, 2264, 2264, 2264, 2795, 2264, 2264, + /* 3820 */ 2843, 2264, 2264, 2264, 437, 2797, 881, 2799, 2800, 876, + /* 3830 */ 2814, 2264, 864, 900, 2264, 2796, 2264, 2264, 2264, 2264, + /* 3840 */ 2264, 2264, 2264, 2264, 2264, 2264, 2761, 2264, 877, 2264, + /* 3850 */ 878, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, + /* 3860 */ 2264, 2264, 2264, 2796, 2264, 2264, 2264, 2264, 2264, 2264, + /* 3870 */ 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 878, 2814, + /* 3880 */ 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, + /* 3890 */ 2264, 2264, 2264, 2795, 2264, 2761, 2843, 877, 2264, 2796, + /* 3900 */ 438, 2797, 881, 2799, 2800, 876, 2264, 2814, 864, 900, + /* 3910 */ 2264, 2264, 2264, 2264, 878, 2264, 2264, 2264, 2264, 2264, + /* 3920 */ 2264, 2264, 2264, 2761, 2264, 877, 2264, 2264, 2264, 2264, + /* 3930 */ 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, + /* 3940 */ 2264, 2264, 2795, 2814, 2264, 2843, 2264, 2264, 2264, 2808, + /* 3950 */ 2797, 881, 2799, 2800, 876, 2264, 2264, 864, 900, 2761, + /* 3960 */ 2264, 877, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, + /* 3970 */ 2795, 2264, 2264, 2843, 2264, 2264, 2264, 2807, 2797, 881, + /* 3980 */ 2799, 2800, 876, 2264, 2264, 864, 900, 2264, 2264, 2264, + /* 3990 */ 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, + /* 4000 */ 2264, 2264, 2264, 2264, 2264, 2264, 2795, 2264, 2264, 2843, + /* 4010 */ 2264, 2264, 2796, 2806, 2797, 881, 2799, 2800, 876, 2264, + /* 4020 */ 2264, 864, 900, 2264, 2264, 2264, 2796, 878, 2264, 2264, + /* 4030 */ 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, + /* 4040 */ 2264, 878, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, + /* 4050 */ 2264, 2796, 2264, 2264, 2264, 2264, 2814, 2264, 2264, 2264, + /* 4060 */ 2264, 2264, 2264, 2264, 2264, 2264, 878, 2264, 2264, 2264, + /* 4070 */ 2814, 2264, 2761, 2264, 877, 2264, 2264, 2796, 2264, 2264, + /* 4080 */ 2264, 2264, 2264, 2264, 2264, 2264, 2761, 2264, 877, 2264, + /* 4090 */ 2264, 2264, 878, 2264, 2796, 2814, 2264, 2264, 2264, 2264, + /* 4100 */ 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 878, + /* 4110 */ 2264, 2761, 2264, 877, 2264, 2264, 2264, 2264, 2264, 2795, + /* 4120 */ 2264, 2814, 2843, 2264, 2264, 2264, 457, 2797, 881, 2799, + /* 4130 */ 2800, 876, 2264, 2795, 864, 900, 2843, 2761, 2814, 877, + /* 4140 */ 458, 2797, 881, 2799, 2800, 876, 2264, 2264, 864, 900, + /* 4150 */ 2264, 2264, 2264, 2264, 2761, 2264, 877, 2264, 2795, 2264, + /* 4160 */ 2264, 2843, 2796, 2264, 2264, 454, 2797, 881, 2799, 2800, + /* 4170 */ 876, 2264, 2264, 864, 900, 2264, 2264, 878, 2264, 2264, + /* 4180 */ 2264, 2264, 2264, 2264, 2795, 2264, 2264, 2843, 2264, 2264, + /* 4190 */ 2264, 459, 2797, 881, 2799, 2800, 876, 2264, 2264, 864, + /* 4200 */ 900, 879, 2264, 2264, 2843, 2264, 2814, 2264, 427, 2797, + /* 4210 */ 881, 2799, 2800, 876, 2264, 2264, 864, 900, 2264, 2264, + /* 4220 */ 2264, 2264, 2761, 2264, 877, 2264, 2264, 2264, 2264, 2264, + /* 4230 */ 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, + /* 4240 */ 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, + /* 4250 */ 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, + /* 4260 */ 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2795, + /* 4270 */ 2264, 2264, 2843, 2264, 2264, 2264, 426, 2797, 881, 2799, + /* 4280 */ 2800, 876, 2264, 2264, 864, 900, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 436, 475, 434, 439, 2, 403, 480, 451, 403, 0, + /* 0 */ 436, 475, 533, 439, 535, 398, 480, 451, 401, 402, /* 10 */ 8, 9, 12, 13, 12, 13, 14, 15, 16, 2, - /* 20 */ 20, 465, 22, 475, 451, 8, 9, 471, 472, 12, - /* 30 */ 13, 14, 15, 16, 20, 428, 36, 389, 38, 0, - /* 40 */ 433, 389, 8, 9, 471, 472, 12, 13, 14, 15, - /* 50 */ 16, 434, 451, 403, 404, 20, 404, 531, 453, 454, - /* 60 */ 20, 456, 445, 499, 459, 539, 465, 460, 68, 467, - /* 70 */ 468, 71, 471, 472, 398, 21, 512, 401, 402, 531, - /* 80 */ 403, 404, 82, 557, 558, 433, 14, 539, 562, 563, - /* 90 */ 433, 37, 20, 39, 40, 41, 42, 449, 441, 413, - /* 100 */ 423, 449, 533, 451, 535, 557, 558, 421, 431, 452, + /* 20 */ 20, 465, 22, 475, 432, 8, 9, 471, 472, 12, + /* 30 */ 13, 14, 15, 16, 20, 531, 36, 13, 38, 0, + /* 40 */ 448, 389, 531, 539, 12, 13, 14, 15, 16, 47, + /* 50 */ 539, 520, 521, 403, 404, 20, 404, 531, 403, 404, + /* 60 */ 36, 557, 558, 499, 14, 539, 562, 563, 68, 558, + /* 70 */ 20, 71, 428, 562, 563, 21, 512, 433, 423, 531, + /* 80 */ 403, 404, 82, 557, 558, 433, 431, 539, 562, 563, + /* 90 */ 433, 37, 433, 39, 40, 41, 42, 388, 441, 390, + /* 100 */ 423, 449, 443, 451, 460, 557, 558, 22, 431, 452, /* 110 */ 562, 563, 112, 403, 404, 115, 77, 78, 79, 80, - /* 120 */ 81, 0, 83, 84, 85, 86, 87, 88, 89, 90, + /* 120 */ 81, 36, 83, 84, 85, 86, 87, 88, 89, 90, /* 130 */ 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, /* 140 */ 101, 102, 103, 104, 105, 106, 107, 108, 496, 20, - /* 150 */ 116, 499, 152, 153, 33, 503, 504, 505, 506, 507, - /* 160 */ 508, 146, 0, 511, 512, 4, 403, 404, 14, 517, - /* 170 */ 410, 519, 403, 404, 20, 523, 524, 527, 528, 529, - /* 180 */ 171, 531, 532, 389, 23, 176, 423, 427, 531, 539, - /* 190 */ 433, 191, 192, 184, 431, 543, 539, 437, 404, 442, + /* 150 */ 115, 499, 152, 153, 20, 503, 504, 505, 506, 507, + /* 160 */ 508, 146, 20, 511, 512, 4, 451, 82, 14, 517, + /* 170 */ 433, 519, 0, 451, 20, 523, 524, 527, 528, 529, + /* 180 */ 465, 531, 532, 389, 23, 4, 471, 472, 531, 539, + /* 190 */ 433, 191, 192, 471, 472, 543, 539, 460, 404, 442, /* 200 */ 443, 201, 202, 551, 0, 191, 192, 557, 558, 48, - /* 210 */ 49, 50, 562, 563, 557, 558, 216, 55, 218, 562, - /* 220 */ 563, 502, 44, 223, 432, 21, 457, 433, 24, 25, + /* 210 */ 49, 50, 562, 563, 557, 558, 216, 20, 218, 562, + /* 220 */ 563, 502, 44, 223, 516, 21, 518, 433, 24, 25, /* 230 */ 26, 27, 28, 29, 30, 31, 32, 527, 528, 529, - /* 240 */ 448, 531, 532, 449, 115, 451, 231, 232, 233, 530, - /* 250 */ 493, 494, 126, 253, 254, 255, 155, 257, 258, 259, - /* 260 */ 260, 261, 262, 263, 264, 265, 266, 267, 520, 521, + /* 240 */ 502, 531, 532, 449, 413, 451, 231, 232, 233, 530, + /* 250 */ 493, 494, 421, 253, 254, 255, 155, 257, 258, 259, + /* 260 */ 260, 261, 262, 263, 264, 265, 266, 267, 530, 403, /* 270 */ 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, - /* 280 */ 280, 281, 282, 283, 12, 13, 14, 424, 389, 388, - /* 290 */ 496, 390, 20, 499, 22, 255, 433, 503, 504, 505, - /* 300 */ 506, 507, 508, 404, 20, 511, 512, 444, 36, 515, - /* 310 */ 38, 517, 518, 519, 0, 8, 9, 523, 524, 12, - /* 320 */ 13, 14, 15, 16, 398, 22, 389, 401, 402, 433, - /* 330 */ 8, 9, 433, 155, 12, 13, 14, 15, 16, 36, - /* 340 */ 68, 404, 0, 71, 502, 191, 228, 75, 449, 531, - /* 350 */ 451, 20, 436, 22, 82, 21, 460, 539, 24, 25, - /* 360 */ 26, 27, 28, 29, 30, 31, 32, 12, 13, 47, - /* 370 */ 433, 436, 530, 12, 13, 20, 558, 22, 91, 147, - /* 380 */ 562, 563, 75, 151, 112, 82, 449, 115, 451, 58, - /* 390 */ 73, 36, 20, 38, 434, 496, 54, 36, 499, 298, + /* 280 */ 280, 281, 282, 283, 12, 13, 14, 410, 389, 20, + /* 290 */ 496, 147, 20, 499, 22, 151, 115, 503, 504, 505, + /* 300 */ 506, 507, 508, 404, 427, 511, 512, 20, 36, 515, + /* 310 */ 38, 517, 518, 519, 437, 8, 9, 523, 524, 12, + /* 320 */ 13, 14, 15, 16, 2, 398, 389, 155, 401, 402, + /* 330 */ 8, 9, 433, 155, 12, 13, 14, 15, 16, 74, + /* 340 */ 68, 404, 170, 71, 428, 191, 228, 75, 449, 433, + /* 350 */ 451, 485, 486, 447, 82, 21, 450, 451, 24, 25, + /* 360 */ 26, 27, 28, 29, 30, 31, 32, 12, 13, 225, + /* 370 */ 433, 436, 3, 433, 230, 20, 460, 22, 234, 399, + /* 380 */ 236, 441, 75, 403, 112, 405, 449, 115, 451, 20, + /* 390 */ 73, 36, 452, 38, 433, 496, 436, 255, 499, 298, /* 400 */ 299, 300, 503, 504, 505, 506, 507, 508, 509, 255, - /* 410 */ 511, 512, 513, 514, 0, 499, 145, 146, 147, 148, - /* 420 */ 149, 150, 151, 68, 152, 153, 71, 389, 512, 0, - /* 430 */ 75, 433, 125, 496, 499, 44, 499, 82, 155, 441, - /* 440 */ 503, 504, 505, 506, 507, 508, 159, 512, 511, 512, - /* 450 */ 452, 22, 14, 20, 517, 495, 519, 225, 20, 68, - /* 460 */ 523, 524, 230, 191, 192, 4, 234, 112, 236, 155, - /* 470 */ 115, 184, 185, 201, 202, 297, 298, 299, 300, 301, - /* 480 */ 302, 303, 304, 305, 170, 198, 531, 449, 216, 117, - /* 490 */ 218, 77, 78, 79, 539, 223, 20, 190, 84, 85, - /* 500 */ 86, 383, 384, 385, 90, 115, 20, 152, 153, 95, - /* 510 */ 96, 97, 98, 558, 20, 101, 115, 562, 563, 105, + /* 410 */ 511, 512, 513, 514, 0, 403, 145, 146, 147, 148, + /* 420 */ 149, 150, 151, 68, 152, 153, 71, 14, 15, 16, + /* 430 */ 75, 433, 125, 496, 499, 410, 499, 82, 155, 441, + /* 440 */ 503, 504, 505, 506, 507, 508, 20, 512, 511, 512, + /* 450 */ 452, 0, 14, 20, 517, 494, 519, 20, 20, 499, + /* 460 */ 523, 524, 437, 191, 192, 453, 454, 112, 456, 20, + /* 470 */ 115, 459, 512, 201, 202, 297, 298, 299, 300, 301, + /* 480 */ 302, 303, 304, 305, 419, 116, 531, 422, 216, 308, + /* 490 */ 218, 77, 78, 79, 539, 223, 424, 190, 84, 85, + /* 500 */ 86, 383, 384, 385, 90, 433, 55, 152, 153, 95, + /* 510 */ 96, 97, 98, 558, 389, 101, 444, 562, 563, 105, /* 520 */ 106, 107, 108, 403, 404, 253, 254, 255, 211, 257, /* 530 */ 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, - /* 540 */ 196, 20, 270, 271, 272, 273, 191, 192, 115, 277, + /* 540 */ 196, 115, 270, 271, 272, 273, 191, 192, 115, 277, /* 550 */ 278, 279, 280, 281, 282, 283, 201, 202, 241, 242, - /* 560 */ 8, 9, 502, 420, 12, 13, 14, 15, 16, 403, - /* 570 */ 404, 216, 20, 218, 433, 268, 115, 457, 223, 218, - /* 580 */ 297, 298, 299, 300, 301, 302, 303, 304, 305, 423, - /* 590 */ 530, 115, 449, 452, 287, 288, 289, 290, 291, 292, - /* 600 */ 293, 294, 295, 296, 403, 404, 434, 435, 253, 254, - /* 610 */ 255, 20, 257, 258, 259, 260, 261, 262, 263, 264, - /* 620 */ 265, 266, 267, 74, 423, 270, 271, 272, 273, 191, - /* 630 */ 403, 186, 277, 278, 279, 280, 281, 282, 283, 284, - /* 640 */ 12, 13, 499, 500, 501, 403, 152, 153, 20, 447, - /* 650 */ 22, 389, 450, 451, 68, 512, 36, 112, 314, 315, - /* 660 */ 316, 317, 403, 404, 36, 220, 38, 301, 302, 303, + /* 560 */ 8, 9, 193, 420, 12, 13, 14, 15, 16, 403, + /* 570 */ 404, 216, 20, 218, 449, 268, 115, 457, 223, 33, + /* 580 */ 297, 298, 299, 300, 301, 302, 303, 304, 305, 152, + /* 590 */ 153, 516, 449, 518, 287, 288, 289, 290, 291, 292, + /* 600 */ 293, 294, 295, 296, 403, 404, 146, 147, 253, 254, + /* 610 */ 255, 151, 257, 258, 259, 260, 261, 262, 263, 264, + /* 620 */ 265, 266, 267, 457, 423, 270, 271, 272, 273, 191, + /* 630 */ 20, 115, 277, 278, 279, 280, 281, 282, 283, 284, + /* 640 */ 12, 13, 499, 500, 501, 399, 434, 403, 20, 403, + /* 650 */ 22, 405, 403, 404, 68, 512, 36, 112, 314, 315, + /* 660 */ 316, 317, 403, 404, 36, 74, 38, 301, 302, 303, /* 670 */ 304, 305, 127, 128, 129, 130, 131, 132, 133, 134, /* 680 */ 135, 136, 389, 138, 139, 140, 141, 142, 143, 144, - /* 690 */ 0, 13, 20, 255, 22, 20, 68, 404, 308, 71, - /* 700 */ 114, 20, 428, 75, 462, 119, 464, 433, 36, 308, - /* 710 */ 82, 449, 485, 486, 24, 25, 26, 27, 28, 29, - /* 720 */ 30, 31, 32, 12, 13, 14, 433, 433, 41, 42, - /* 730 */ 58, 20, 36, 22, 460, 112, 442, 443, 450, 451, - /* 740 */ 112, 308, 449, 115, 451, 193, 410, 36, 36, 38, + /* 690 */ 0, 126, 20, 255, 22, 20, 68, 404, 434, 71, + /* 700 */ 114, 403, 20, 75, 255, 119, 457, 495, 36, 445, + /* 710 */ 82, 467, 468, 389, 24, 25, 26, 27, 28, 29, + /* 720 */ 30, 31, 32, 12, 13, 14, 433, 117, 41, 42, + /* 730 */ 58, 20, 36, 22, 308, 112, 12, 13, 434, 435, + /* 740 */ 112, 308, 449, 115, 451, 193, 284, 36, 36, 38, /* 750 */ 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, - /* 760 */ 82, 138, 139, 140, 141, 142, 143, 144, 74, 308, - /* 770 */ 8, 9, 186, 437, 12, 13, 14, 15, 16, 68, - /* 780 */ 152, 153, 71, 433, 308, 386, 527, 528, 529, 496, + /* 760 */ 36, 138, 139, 140, 141, 142, 143, 144, 186, 308, + /* 770 */ 8, 9, 186, 449, 12, 13, 14, 15, 16, 68, + /* 780 */ 152, 153, 71, 485, 486, 386, 527, 528, 529, 496, /* 790 */ 531, 532, 499, 82, 82, 33, 503, 504, 505, 506, - /* 800 */ 507, 508, 452, 1, 511, 512, 20, 255, 121, 122, - /* 810 */ 517, 124, 519, 389, 403, 115, 523, 524, 68, 191, - /* 820 */ 192, 19, 54, 112, 59, 60, 115, 152, 153, 201, - /* 830 */ 202, 63, 145, 3, 66, 67, 149, 284, 218, 286, - /* 840 */ 38, 399, 403, 404, 216, 403, 218, 405, 1, 2, - /* 850 */ 20, 223, 20, 8, 9, 53, 54, 12, 13, 14, - /* 860 */ 15, 16, 423, 152, 153, 63, 64, 65, 66, 119, - /* 870 */ 68, 251, 252, 449, 475, 420, 201, 202, 116, 480, - /* 880 */ 4, 253, 254, 255, 20, 257, 258, 259, 260, 261, - /* 890 */ 262, 263, 264, 265, 266, 267, 485, 486, 270, 271, + /* 800 */ 507, 508, 220, 1, 511, 512, 20, 255, 121, 122, + /* 810 */ 517, 124, 519, 403, 404, 115, 523, 524, 82, 191, + /* 820 */ 192, 19, 54, 112, 308, 0, 115, 152, 153, 201, + /* 830 */ 202, 63, 145, 423, 66, 67, 149, 389, 218, 284, + /* 840 */ 38, 286, 403, 404, 216, 33, 218, 450, 451, 403, + /* 850 */ 404, 223, 20, 8, 9, 53, 54, 12, 13, 14, + /* 860 */ 15, 16, 423, 152, 153, 63, 64, 65, 66, 423, + /* 870 */ 68, 251, 252, 191, 475, 420, 201, 202, 116, 480, + /* 880 */ 334, 253, 254, 255, 0, 257, 258, 259, 260, 261, + /* 890 */ 262, 263, 264, 265, 266, 267, 44, 449, 270, 271, /* 900 */ 272, 273, 191, 192, 449, 277, 278, 279, 280, 281, /* 910 */ 282, 283, 201, 202, 218, 215, 114, 217, 8, 9, - /* 920 */ 20, 119, 12, 13, 14, 15, 16, 216, 75, 218, - /* 930 */ 531, 399, 0, 424, 223, 403, 255, 405, 539, 403, - /* 940 */ 404, 433, 433, 403, 404, 284, 116, 251, 252, 441, - /* 950 */ 250, 404, 150, 444, 499, 500, 557, 558, 34, 423, - /* 960 */ 452, 562, 563, 116, 253, 254, 255, 512, 257, 258, + /* 920 */ 68, 119, 12, 13, 14, 15, 16, 216, 116, 218, + /* 930 */ 531, 1, 2, 515, 223, 0, 518, 255, 539, 403, + /* 940 */ 404, 433, 218, 403, 404, 403, 34, 251, 252, 441, + /* 950 */ 250, 404, 150, 126, 499, 500, 557, 558, 74, 423, + /* 960 */ 452, 562, 563, 433, 253, 254, 255, 512, 257, 258, /* 970 */ 259, 260, 261, 262, 263, 264, 265, 266, 267, 193, - /* 980 */ 433, 270, 271, 272, 273, 516, 4, 518, 277, 278, + /* 980 */ 433, 270, 271, 272, 273, 389, 4, 91, 277, 278, /* 990 */ 279, 280, 281, 282, 283, 12, 13, 195, 389, 197, - /* 1000 */ 433, 19, 200, 20, 389, 22, 74, 205, 308, 419, - /* 1010 */ 8, 9, 422, 404, 12, 13, 14, 15, 16, 36, - /* 1020 */ 38, 38, 23, 193, 429, 193, 224, 8, 9, 433, + /* 1000 */ 429, 19, 200, 20, 462, 22, 464, 205, 308, 446, + /* 1010 */ 8, 9, 449, 404, 12, 13, 14, 15, 16, 36, + /* 1020 */ 38, 38, 23, 493, 494, 193, 224, 8, 9, 389, /* 1030 */ 47, 12, 13, 14, 15, 16, 54, 403, 404, 403, - /* 1040 */ 404, 255, 433, 61, 62, 403, 404, 389, 49, 50, - /* 1050 */ 68, 68, 505, 208, 71, 191, 20, 423, 449, 423, - /* 1060 */ 451, 494, 404, 22, 449, 82, 526, 527, 528, 529, - /* 1070 */ 14, 531, 532, 253, 403, 404, 20, 36, 12, 13, - /* 1080 */ 12, 13, 14, 15, 16, 490, 20, 255, 22, 493, - /* 1090 */ 494, 433, 433, 193, 423, 112, 114, 412, 115, 457, - /* 1100 */ 441, 119, 36, 193, 38, 496, 253, 449, 499, 451, - /* 1110 */ 22, 452, 503, 504, 505, 506, 507, 508, 116, 255, - /* 1120 */ 511, 512, 146, 147, 36, 440, 517, 151, 519, 403, + /* 1040 */ 404, 255, 433, 61, 62, 449, 116, 389, 49, 50, + /* 1050 */ 68, 68, 505, 208, 71, 159, 412, 423, 449, 423, + /* 1060 */ 451, 490, 404, 403, 404, 82, 526, 527, 528, 529, + /* 1070 */ 245, 531, 532, 253, 430, 434, 59, 60, 12, 13, + /* 1080 */ 184, 185, 120, 423, 440, 123, 20, 255, 22, 449, + /* 1090 */ 433, 433, 481, 389, 198, 112, 114, 502, 115, 442, + /* 1100 */ 443, 119, 36, 193, 38, 496, 171, 449, 499, 451, + /* 1110 */ 22, 176, 503, 504, 505, 506, 507, 508, 116, 184, + /* 1120 */ 511, 512, 408, 409, 36, 530, 517, 13, 519, 403, /* 1130 */ 404, 52, 523, 524, 68, 152, 153, 71, 403, 404, - /* 1140 */ 320, 321, 322, 323, 324, 325, 326, 3, 82, 423, - /* 1150 */ 14, 15, 16, 112, 496, 412, 515, 499, 423, 518, - /* 1160 */ 551, 503, 504, 505, 506, 507, 508, 408, 409, 511, - /* 1170 */ 512, 531, 433, 430, 191, 192, 403, 404, 112, 539, - /* 1180 */ 335, 115, 443, 440, 201, 202, 310, 8, 9, 408, - /* 1190 */ 409, 12, 13, 14, 15, 16, 423, 557, 558, 216, - /* 1200 */ 112, 218, 562, 563, 403, 404, 223, 190, 8, 9, - /* 1210 */ 552, 553, 12, 13, 14, 15, 16, 446, 152, 153, - /* 1220 */ 449, 417, 418, 516, 423, 518, 446, 8, 9, 449, + /* 1140 */ 320, 321, 322, 323, 324, 325, 326, 424, 82, 423, + /* 1150 */ 36, 403, 404, 449, 496, 13, 433, 499, 423, 36, + /* 1160 */ 551, 503, 504, 505, 506, 507, 508, 444, 4, 511, + /* 1170 */ 512, 423, 408, 409, 191, 192, 403, 404, 112, 412, + /* 1180 */ 335, 115, 403, 404, 201, 202, 20, 8, 9, 417, + /* 1190 */ 418, 12, 13, 14, 15, 16, 423, 403, 404, 216, + /* 1200 */ 112, 218, 423, 403, 404, 82, 223, 440, 8, 9, + /* 1210 */ 552, 553, 12, 13, 14, 15, 16, 423, 152, 153, + /* 1220 */ 421, 417, 418, 423, 82, 389, 47, 8, 9, 33, /* 1230 */ 389, 12, 13, 14, 15, 16, 253, 254, 255, 0, /* 1240 */ 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, - /* 1250 */ 267, 389, 389, 270, 271, 272, 273, 191, 192, 433, + /* 1250 */ 267, 389, 389, 270, 271, 272, 273, 191, 192, 3, /* 1260 */ 277, 278, 279, 280, 281, 282, 283, 201, 202, 8, - /* 1270 */ 9, 269, 193, 12, 13, 14, 15, 16, 452, 77, - /* 1280 */ 78, 79, 216, 204, 218, 268, 84, 85, 86, 223, - /* 1290 */ 449, 255, 90, 403, 404, 116, 389, 95, 96, 97, - /* 1300 */ 98, 0, 389, 101, 287, 389, 433, 105, 106, 107, - /* 1310 */ 108, 449, 449, 423, 403, 404, 116, 444, 425, 253, - /* 1320 */ 254, 255, 429, 257, 258, 259, 260, 261, 262, 263, + /* 1270 */ 9, 269, 193, 12, 13, 14, 15, 16, 434, 77, + /* 1280 */ 78, 79, 216, 204, 218, 449, 84, 85, 86, 223, + /* 1290 */ 449, 434, 90, 403, 404, 116, 0, 95, 96, 97, + /* 1300 */ 98, 20, 20, 101, 22, 389, 433, 105, 106, 107, + /* 1310 */ 108, 449, 449, 423, 403, 404, 116, 444, 22, 253, + /* 1320 */ 254, 255, 190, 257, 258, 259, 260, 261, 262, 263, /* 1330 */ 264, 265, 266, 267, 423, 116, 270, 271, 272, 273, - /* 1340 */ 33, 403, 404, 277, 278, 279, 280, 281, 282, 283, - /* 1350 */ 12, 13, 22, 389, 47, 18, 449, 20, 20, 33, - /* 1360 */ 22, 423, 449, 389, 27, 449, 36, 30, 417, 418, - /* 1370 */ 392, 393, 403, 404, 36, 38, 38, 116, 404, 0, - /* 1380 */ 403, 404, 403, 404, 145, 146, 147, 148, 149, 150, - /* 1390 */ 151, 54, 423, 56, 403, 404, 403, 404, 61, 62, - /* 1400 */ 423, 446, 423, 13, 449, 389, 68, 433, 0, 71, - /* 1410 */ 73, 389, 82, 449, 423, 389, 423, 33, 403, 404, - /* 1420 */ 82, 403, 404, 449, 33, 451, 82, 145, 389, 8, - /* 1430 */ 9, 149, 389, 12, 13, 14, 15, 16, 423, 8, - /* 1440 */ 9, 423, 112, 12, 13, 14, 15, 16, 389, 126, - /* 1450 */ 112, 114, 44, 115, 8, 9, 155, 434, 12, 13, - /* 1460 */ 14, 15, 16, 126, 235, 449, 237, 389, 47, 33, - /* 1470 */ 496, 449, 82, 499, 330, 449, 36, 503, 504, 505, - /* 1480 */ 506, 507, 508, 47, 510, 511, 512, 0, 449, 126, - /* 1490 */ 152, 153, 449, 120, 157, 158, 123, 160, 161, 162, - /* 1500 */ 163, 164, 165, 166, 167, 168, 169, 116, 449, 172, - /* 1510 */ 173, 174, 175, 176, 177, 178, 179, 51, 181, 182, - /* 1520 */ 183, 13, 82, 0, 187, 188, 189, 449, 13, 191, - /* 1530 */ 192, 194, 120, 120, 120, 123, 123, 123, 0, 201, - /* 1540 */ 202, 152, 153, 180, 36, 22, 216, 116, 218, 38, - /* 1550 */ 0, 36, 1, 2, 216, 434, 218, 33, 434, 33, - /* 1560 */ 22, 223, 116, 8, 9, 54, 33, 12, 13, 14, - /* 1570 */ 15, 16, 22, 33, 63, 64, 65, 66, 481, 68, - /* 1580 */ 33, 115, 33, 253, 254, 33, 434, 12, 13, 12, - /* 1590 */ 13, 253, 254, 255, 434, 257, 258, 259, 260, 261, - /* 1600 */ 262, 263, 264, 265, 266, 267, 33, 33, 270, 271, - /* 1610 */ 272, 273, 12, 13, 36, 277, 278, 279, 280, 281, - /* 1620 */ 282, 283, 18, 390, 245, 114, 389, 23, 12, 13, - /* 1630 */ 119, 421, 145, 146, 147, 148, 149, 150, 151, 475, - /* 1640 */ 116, 404, 116, 406, 461, 36, 42, 43, 533, 116, - /* 1650 */ 46, 33, 389, 36, 33, 33, 116, 115, 332, 117, - /* 1660 */ 82, 57, 566, 116, 475, 116, 555, 404, 116, 406, - /* 1670 */ 433, 12, 13, 69, 70, 71, 72, 73, 12, 13, - /* 1680 */ 33, 548, 12, 13, 12, 13, 449, 534, 451, 116, - /* 1690 */ 116, 12, 13, 12, 13, 531, 433, 186, 12, 13, - /* 1700 */ 407, 33, 33, 539, 433, 420, 195, 33, 13, 475, - /* 1710 */ 199, 200, 449, 402, 451, 420, 205, 206, 334, 115, - /* 1720 */ 531, 557, 558, 33, 33, 461, 562, 563, 539, 554, - /* 1730 */ 554, 36, 33, 496, 116, 224, 499, 116, 116, 554, - /* 1740 */ 503, 504, 505, 506, 507, 508, 557, 558, 511, 512, - /* 1750 */ 33, 562, 563, 474, 517, 475, 519, 36, 154, 496, - /* 1760 */ 523, 524, 499, 116, 389, 531, 503, 504, 505, 506, - /* 1770 */ 507, 508, 13, 539, 511, 512, 33, 33, 33, 404, - /* 1780 */ 517, 406, 519, 33, 116, 116, 523, 524, 461, 554, - /* 1790 */ 116, 557, 558, 407, 497, 36, 562, 563, 404, 448, - /* 1800 */ 482, 461, 461, 82, 538, 538, 116, 116, 433, 559, - /* 1810 */ 541, 531, 208, 209, 210, 116, 525, 213, 461, 539, - /* 1820 */ 422, 311, 476, 268, 449, 54, 451, 218, 20, 498, - /* 1830 */ 226, 227, 403, 116, 20, 218, 487, 557, 558, 234, - /* 1840 */ 389, 487, 562, 563, 240, 492, 412, 243, 214, 412, - /* 1850 */ 246, 247, 248, 249, 250, 404, 478, 406, 403, 116, - /* 1860 */ 116, 116, 20, 404, 47, 458, 116, 404, 458, 404, - /* 1870 */ 190, 496, 455, 403, 499, 403, 458, 455, 503, 504, - /* 1880 */ 505, 506, 507, 508, 433, 455, 511, 512, 455, 389, - /* 1890 */ 113, 416, 517, 111, 519, 415, 403, 403, 523, 524, - /* 1900 */ 449, 110, 451, 414, 404, 403, 406, 403, 403, 20, - /* 1910 */ 396, 52, 308, 400, 396, 12, 13, 400, 412, 487, - /* 1920 */ 389, 412, 20, 462, 451, 22, 20, 405, 412, 20, - /* 1930 */ 477, 412, 405, 433, 20, 404, 468, 406, 20, 36, - /* 1940 */ 412, 38, 412, 238, 412, 433, 412, 496, 403, 449, - /* 1950 */ 499, 451, 396, 412, 503, 504, 505, 506, 507, 508, - /* 1960 */ 392, 392, 511, 512, 433, 403, 396, 491, 517, 433, - /* 1970 */ 519, 68, 433, 115, 523, 524, 433, 433, 449, 433, - /* 1980 */ 449, 433, 451, 487, 449, 82, 433, 433, 489, 410, - /* 1990 */ 433, 433, 20, 486, 222, 221, 496, 410, 403, 499, - /* 2000 */ 318, 476, 319, 503, 504, 505, 506, 507, 508, 449, - /* 2010 */ 451, 511, 512, 449, 547, 112, 389, 517, 547, 519, - /* 2020 */ 327, 484, 207, 523, 524, 329, 549, 496, 550, 547, - /* 2030 */ 499, 404, 469, 545, 503, 504, 505, 506, 507, 508, - /* 2040 */ 469, 546, 511, 512, 483, 312, 328, 544, 517, 307, - /* 2050 */ 519, 12, 13, 306, 523, 524, 476, 537, 336, 567, - /* 2060 */ 433, 22, 333, 331, 404, 20, 126, 309, 502, 405, - /* 2070 */ 469, 410, 410, 449, 449, 36, 449, 38, 451, 449, - /* 2080 */ 449, 469, 561, 199, 449, 466, 410, 449, 462, 115, - /* 2090 */ 449, 199, 463, 404, 410, 462, 429, 410, 410, 449, - /* 2100 */ 449, 536, 449, 522, 449, 449, 449, 68, 115, 389, - /* 2110 */ 403, 410, 449, 438, 542, 22, 540, 391, 35, 216, - /* 2120 */ 449, 218, 449, 496, 404, 394, 499, 560, 37, 395, - /* 2130 */ 503, 504, 505, 506, 507, 508, 40, 397, 511, 512, - /* 2140 */ 495, 449, 396, 449, 517, 0, 519, 449, 411, 389, - /* 2150 */ 523, 524, 449, 433, 426, 449, 253, 254, 449, 449, - /* 2160 */ 449, 449, 449, 449, 404, 449, 488, 426, 449, 449, - /* 2170 */ 435, 451, 449, 270, 271, 426, 479, 387, 470, 0, - /* 2180 */ 277, 278, 279, 280, 281, 282, 435, 0, 47, 0, - /* 2190 */ 36, 244, 36, 433, 470, 36, 36, 244, 0, 36, - /* 2200 */ 36, 36, 244, 0, 0, 244, 0, 36, 0, 449, - /* 2210 */ 36, 451, 22, 0, 36, 239, 496, 0, 0, 499, - /* 2220 */ 224, 0, 224, 503, 504, 505, 506, 507, 508, 225, - /* 2230 */ 218, 511, 512, 216, 389, 0, 0, 0, 212, 519, - /* 2240 */ 211, 0, 0, 523, 524, 158, 51, 51, 0, 404, - /* 2250 */ 36, 0, 0, 54, 0, 216, 496, 218, 36, 499, - /* 2260 */ 51, 0, 47, 503, 504, 505, 506, 507, 508, 0, - /* 2270 */ 389, 511, 512, 0, 0, 51, 0, 0, 433, 519, - /* 2280 */ 0, 0, 0, 523, 524, 404, 0, 176, 0, 36, - /* 2290 */ 251, 252, 253, 176, 449, 0, 451, 0, 0, 0, - /* 2300 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 270, + /* 1340 */ 58, 389, 22, 277, 278, 279, 280, 281, 282, 283, + /* 1350 */ 12, 13, 22, 389, 434, 18, 36, 20, 20, 193, + /* 1360 */ 22, 403, 404, 389, 27, 449, 36, 30, 446, 392, + /* 1370 */ 393, 449, 403, 404, 36, 38, 38, 116, 404, 0, + /* 1380 */ 13, 423, 403, 404, 145, 146, 147, 148, 149, 150, + /* 1390 */ 151, 54, 423, 56, 403, 404, 389, 389, 61, 62, + /* 1400 */ 268, 449, 423, 433, 389, 389, 68, 433, 433, 71, + /* 1410 */ 73, 389, 82, 449, 423, 389, 75, 33, 446, 287, + /* 1420 */ 82, 449, 452, 449, 33, 451, 235, 452, 237, 8, + /* 1430 */ 9, 47, 112, 12, 13, 14, 15, 16, 47, 8, + /* 1440 */ 9, 390, 112, 12, 13, 14, 15, 16, 425, 82, + /* 1450 */ 112, 114, 429, 115, 8, 9, 449, 449, 12, 13, + /* 1460 */ 14, 15, 16, 126, 449, 449, 14, 0, 433, 33, + /* 1470 */ 496, 449, 20, 499, 310, 449, 33, 503, 504, 505, + /* 1480 */ 506, 507, 508, 0, 510, 511, 512, 452, 145, 126, + /* 1490 */ 152, 153, 149, 47, 157, 158, 51, 160, 161, 162, + /* 1500 */ 163, 164, 165, 166, 167, 168, 169, 68, 434, 172, + /* 1510 */ 173, 174, 175, 176, 177, 178, 179, 0, 181, 182, + /* 1520 */ 183, 54, 0, 33, 187, 188, 189, 44, 332, 191, + /* 1530 */ 192, 194, 120, 0, 155, 123, 255, 116, 120, 201, + /* 1540 */ 202, 123, 120, 180, 22, 123, 216, 116, 218, 38, + /* 1550 */ 33, 0, 116, 434, 216, 22, 218, 33, 119, 116, + /* 1560 */ 115, 223, 33, 8, 9, 54, 461, 12, 13, 14, + /* 1570 */ 15, 16, 33, 22, 63, 64, 65, 66, 533, 68, + /* 1580 */ 33, 152, 153, 253, 254, 33, 330, 1, 2, 33, + /* 1590 */ 566, 253, 254, 255, 253, 257, 258, 259, 260, 261, + /* 1600 */ 262, 263, 264, 265, 266, 267, 116, 33, 270, 271, + /* 1610 */ 272, 273, 12, 13, 555, 277, 278, 279, 280, 281, + /* 1620 */ 282, 283, 18, 12, 13, 114, 389, 23, 548, 534, + /* 1630 */ 119, 8, 9, 36, 36, 12, 13, 14, 15, 16, + /* 1640 */ 116, 404, 407, 406, 0, 116, 42, 43, 433, 33, + /* 1650 */ 46, 33, 389, 420, 33, 116, 420, 12, 13, 402, + /* 1660 */ 115, 57, 117, 116, 33, 12, 13, 404, 116, 406, + /* 1670 */ 433, 116, 116, 69, 70, 71, 72, 73, 12, 13, + /* 1680 */ 33, 12, 13, 12, 13, 461, 449, 554, 451, 33, + /* 1690 */ 116, 12, 13, 12, 13, 33, 433, 186, 554, 12, + /* 1700 */ 13, 33, 12, 13, 554, 33, 195, 554, 13, 461, + /* 1710 */ 199, 200, 449, 33, 451, 33, 205, 206, 33, 115, + /* 1720 */ 474, 8, 9, 407, 33, 12, 13, 14, 15, 16, + /* 1730 */ 36, 36, 116, 496, 116, 224, 499, 116, 497, 116, + /* 1740 */ 503, 504, 505, 506, 507, 508, 475, 116, 511, 512, + /* 1750 */ 13, 36, 33, 404, 517, 475, 519, 448, 154, 496, + /* 1760 */ 523, 524, 499, 116, 389, 482, 503, 504, 505, 506, + /* 1770 */ 507, 508, 116, 36, 511, 512, 82, 559, 116, 404, + /* 1780 */ 517, 406, 519, 461, 116, 475, 523, 524, 116, 145, + /* 1790 */ 146, 147, 148, 149, 150, 151, 116, 82, 116, 525, + /* 1800 */ 461, 116, 531, 538, 538, 541, 461, 116, 433, 422, + /* 1810 */ 539, 531, 208, 209, 210, 218, 218, 213, 311, 539, + /* 1820 */ 476, 54, 498, 20, 449, 20, 451, 403, 557, 558, + /* 1830 */ 226, 227, 492, 562, 563, 116, 234, 557, 558, 475, + /* 1840 */ 389, 531, 562, 563, 240, 487, 412, 243, 487, 539, + /* 1850 */ 246, 247, 248, 249, 250, 404, 412, 406, 478, 403, + /* 1860 */ 214, 20, 404, 47, 458, 404, 458, 557, 558, 455, + /* 1870 */ 404, 496, 562, 563, 499, 403, 190, 403, 503, 504, + /* 1880 */ 505, 506, 507, 508, 433, 458, 511, 512, 455, 389, + /* 1890 */ 455, 113, 517, 455, 519, 531, 416, 111, 523, 524, + /* 1900 */ 449, 415, 451, 539, 404, 403, 406, 403, 110, 414, + /* 1910 */ 20, 403, 308, 403, 396, 12, 13, 403, 52, 400, + /* 1920 */ 389, 557, 558, 396, 487, 22, 562, 563, 400, 20, + /* 1930 */ 451, 20, 412, 433, 20, 404, 477, 406, 412, 36, + /* 1940 */ 405, 38, 412, 405, 412, 20, 412, 496, 412, 449, + /* 1950 */ 499, 451, 468, 20, 503, 504, 505, 506, 507, 508, + /* 1960 */ 462, 412, 511, 512, 433, 412, 403, 396, 517, 412, + /* 1970 */ 519, 68, 403, 433, 523, 524, 433, 433, 396, 433, + /* 1980 */ 449, 268, 451, 433, 392, 82, 392, 433, 238, 115, + /* 1990 */ 449, 433, 433, 433, 433, 433, 496, 449, 410, 499, + /* 2000 */ 491, 489, 487, 503, 504, 505, 506, 507, 508, 20, + /* 2010 */ 222, 511, 512, 449, 221, 112, 389, 517, 451, 519, + /* 2020 */ 410, 484, 403, 523, 524, 449, 319, 496, 486, 547, + /* 2030 */ 499, 404, 318, 327, 503, 504, 505, 506, 507, 508, + /* 2040 */ 547, 476, 511, 512, 469, 207, 469, 550, 517, 483, + /* 2050 */ 519, 12, 13, 547, 523, 524, 329, 328, 312, 476, + /* 2060 */ 433, 22, 549, 307, 306, 333, 336, 546, 545, 544, + /* 2070 */ 567, 331, 20, 126, 404, 36, 449, 38, 451, 309, + /* 2080 */ 502, 405, 469, 410, 410, 449, 449, 449, 449, 469, + /* 2090 */ 449, 199, 466, 410, 462, 115, 199, 449, 410, 449, + /* 2100 */ 404, 449, 522, 463, 462, 537, 536, 68, 410, 389, + /* 2110 */ 410, 115, 449, 540, 542, 438, 449, 22, 429, 216, + /* 2120 */ 35, 218, 391, 496, 404, 403, 499, 449, 394, 37, + /* 2130 */ 503, 504, 505, 506, 507, 508, 40, 479, 511, 512, + /* 2140 */ 561, 560, 449, 410, 517, 397, 519, 395, 449, 389, + /* 2150 */ 523, 524, 449, 433, 449, 396, 253, 254, 449, 449, + /* 2160 */ 449, 449, 470, 488, 404, 449, 449, 449, 411, 449, + /* 2170 */ 449, 451, 449, 270, 271, 449, 387, 449, 435, 495, + /* 2180 */ 277, 278, 279, 280, 281, 282, 435, 449, 449, 426, + /* 2190 */ 449, 449, 426, 433, 470, 426, 0, 0, 0, 47, + /* 2200 */ 0, 36, 244, 36, 36, 36, 244, 0, 36, 449, + /* 2210 */ 36, 451, 244, 36, 0, 0, 496, 244, 0, 499, + /* 2220 */ 36, 0, 36, 503, 504, 505, 506, 507, 508, 0, + /* 2230 */ 22, 511, 512, 0, 389, 36, 239, 0, 224, 519, + /* 2240 */ 0, 224, 218, 523, 524, 225, 216, 0, 0, 404, + /* 2250 */ 0, 0, 212, 211, 0, 216, 496, 218, 158, 499, + /* 2260 */ 51, 51, 0, 503, 504, 505, 506, 507, 508, 0, + /* 2270 */ 389, 511, 512, 0, 36, 36, 54, 0, 433, 519, + /* 2280 */ 0, 51, 47, 523, 524, 404, 0, 0, 0, 0, + /* 2290 */ 251, 252, 253, 51, 449, 0, 451, 0, 0, 0, + /* 2300 */ 0, 176, 36, 0, 176, 0, 0, 0, 0, 270, /* 2310 */ 271, 0, 0, 0, 433, 0, 277, 278, 279, 280, - /* 2320 */ 281, 282, 0, 0, 0, 0, 51, 0, 0, 0, - /* 2330 */ 449, 47, 451, 0, 0, 0, 0, 0, 0, 0, - /* 2340 */ 22, 496, 158, 0, 499, 157, 389, 0, 503, 504, - /* 2350 */ 505, 506, 507, 508, 0, 0, 511, 512, 156, 0, - /* 2360 */ 68, 404, 22, 22, 519, 0, 52, 36, 523, 524, - /* 2370 */ 0, 52, 0, 0, 0, 54, 44, 496, 68, 0, - /* 2380 */ 499, 125, 36, 0, 503, 504, 505, 506, 507, 508, - /* 2390 */ 433, 0, 511, 512, 68, 389, 36, 44, 68, 36, - /* 2400 */ 44, 0, 54, 54, 36, 47, 449, 14, 451, 33, - /* 2410 */ 404, 44, 51, 51, 0, 51, 45, 0, 0, 44, - /* 2420 */ 0, 0, 44, 207, 0, 0, 0, 389, 51, 0, - /* 2430 */ 0, 51, 0, 76, 36, 0, 44, 0, 54, 433, - /* 2440 */ 36, 54, 404, 44, 36, 564, 565, 44, 54, 0, - /* 2450 */ 54, 36, 0, 496, 44, 449, 499, 451, 0, 0, - /* 2460 */ 503, 504, 505, 506, 507, 508, 0, 0, 511, 512, - /* 2470 */ 0, 433, 36, 123, 0, 22, 519, 22, 36, 36, - /* 2480 */ 36, 524, 36, 36, 36, 0, 36, 449, 0, 451, - /* 2490 */ 36, 22, 36, 33, 33, 22, 0, 22, 36, 36, - /* 2500 */ 36, 22, 496, 0, 22, 499, 0, 56, 36, 503, - /* 2510 */ 504, 505, 506, 507, 508, 0, 389, 511, 512, 0, - /* 2520 */ 36, 0, 36, 0, 0, 36, 22, 20, 36, 36, - /* 2530 */ 36, 404, 116, 0, 496, 193, 389, 499, 115, 223, - /* 2540 */ 0, 503, 504, 505, 506, 507, 508, 36, 228, 511, - /* 2550 */ 512, 404, 51, 115, 22, 0, 22, 0, 0, 553, - /* 2560 */ 433, 33, 193, 3, 52, 199, 36, 36, 313, 52, - /* 2570 */ 219, 33, 33, 229, 33, 193, 449, 51, 451, 193, - /* 2580 */ 433, 193, 33, 115, 313, 33, 51, 116, 203, 36, - /* 2590 */ 82, 115, 203, 115, 556, 115, 449, 116, 451, 116, - /* 2600 */ 473, 389, 111, 113, 3, 33, 313, 36, 33, 36, - /* 2610 */ 36, 116, 115, 115, 36, 116, 404, 115, 36, 36, - /* 2620 */ 473, 389, 200, 496, 0, 116, 499, 51, 115, 0, - /* 2630 */ 503, 504, 505, 506, 507, 508, 404, 51, 511, 512, - /* 2640 */ 44, 116, 115, 496, 115, 433, 499, 0, 44, 297, - /* 2650 */ 503, 504, 505, 506, 507, 508, 0, 44, 511, 512, - /* 2660 */ 116, 449, 116, 451, 116, 433, 116, 116, 33, 115, - /* 2670 */ 2, 115, 22, 22, 51, 116, 115, 113, 113, 116, - /* 2680 */ 285, 449, 195, 451, 253, 115, 0, 44, 51, 256, - /* 2690 */ 0, 22, 115, 51, 115, 115, 196, 116, 22, 115, - /* 2700 */ 115, 196, 115, 115, 115, 115, 389, 116, 496, 115, - /* 2710 */ 115, 499, 196, 116, 115, 503, 504, 505, 506, 507, - /* 2720 */ 508, 404, 116, 511, 512, 115, 115, 118, 496, 117, - /* 2730 */ 115, 499, 115, 115, 389, 503, 504, 505, 506, 507, - /* 2740 */ 508, 116, 115, 511, 512, 115, 514, 126, 22, 404, - /* 2750 */ 433, 22, 36, 36, 116, 115, 36, 116, 36, 115, - /* 2760 */ 36, 116, 116, 36, 116, 229, 449, 36, 451, 137, - /* 2770 */ 389, 116, 115, 33, 115, 36, 137, 565, 433, 115, - /* 2780 */ 22, 76, 75, 22, 36, 404, 137, 36, 36, 137, - /* 2790 */ 473, 36, 36, 36, 449, 36, 451, 82, 36, 36, - /* 2800 */ 36, 36, 109, 82, 109, 33, 36, 36, 0, 36, - /* 2810 */ 22, 36, 36, 496, 433, 36, 499, 82, 473, 36, + /* 2320 */ 281, 282, 0, 0, 0, 0, 0, 0, 0, 0, + /* 2330 */ 449, 0, 451, 0, 0, 0, 51, 0, 47, 0, + /* 2340 */ 0, 496, 0, 0, 499, 158, 389, 0, 503, 504, + /* 2350 */ 505, 506, 507, 508, 0, 0, 511, 512, 0, 0, + /* 2360 */ 22, 404, 0, 0, 519, 0, 0, 156, 523, 524, + /* 2370 */ 157, 0, 22, 52, 22, 0, 0, 496, 68, 0, + /* 2380 */ 499, 125, 52, 0, 503, 504, 505, 506, 507, 508, + /* 2390 */ 433, 0, 511, 512, 0, 389, 36, 36, 54, 0, + /* 2400 */ 68, 44, 54, 36, 68, 0, 449, 54, 451, 68, + /* 2410 */ 404, 0, 44, 36, 44, 0, 36, 44, 33, 47, + /* 2420 */ 51, 14, 0, 0, 0, 51, 0, 389, 44, 51, + /* 2430 */ 0, 45, 44, 207, 0, 0, 0, 0, 51, 433, + /* 2440 */ 51, 0, 404, 0, 36, 564, 565, 54, 44, 0, + /* 2450 */ 36, 54, 0, 496, 44, 449, 499, 451, 0, 0, + /* 2460 */ 503, 504, 505, 506, 507, 508, 76, 36, 511, 512, + /* 2470 */ 54, 433, 44, 54, 36, 0, 519, 44, 0, 0, + /* 2480 */ 0, 524, 0, 36, 22, 0, 22, 449, 22, 451, + /* 2490 */ 36, 36, 36, 0, 0, 0, 36, 36, 22, 36, + /* 2500 */ 56, 36, 496, 36, 36, 499, 33, 33, 36, 503, + /* 2510 */ 504, 505, 506, 507, 508, 123, 389, 511, 512, 36, + /* 2520 */ 36, 22, 22, 0, 22, 36, 0, 0, 0, 0, + /* 2530 */ 0, 404, 36, 36, 496, 0, 389, 499, 22, 36, + /* 2540 */ 20, 503, 504, 505, 506, 507, 508, 36, 36, 511, + /* 2550 */ 512, 404, 0, 36, 0, 116, 51, 115, 36, 553, + /* 2560 */ 433, 115, 22, 0, 0, 22, 0, 203, 3, 33, + /* 2570 */ 219, 313, 223, 36, 228, 193, 449, 36, 451, 33, + /* 2580 */ 433, 33, 33, 52, 115, 229, 116, 116, 193, 193, + /* 2590 */ 52, 313, 111, 193, 556, 193, 449, 199, 451, 113, + /* 2600 */ 473, 389, 115, 115, 203, 33, 116, 116, 116, 51, + /* 2610 */ 51, 33, 36, 115, 82, 3, 404, 116, 33, 115, + /* 2620 */ 473, 389, 115, 496, 115, 115, 499, 313, 36, 116, + /* 2630 */ 503, 504, 505, 506, 507, 508, 404, 116, 511, 512, + /* 2640 */ 36, 36, 36, 496, 36, 433, 499, 36, 51, 116, + /* 2650 */ 503, 504, 505, 506, 507, 508, 33, 0, 511, 512, + /* 2660 */ 116, 449, 0, 451, 51, 433, 115, 0, 44, 116, + /* 2670 */ 44, 116, 115, 0, 44, 115, 115, 33, 116, 2, + /* 2680 */ 22, 449, 115, 451, 113, 253, 113, 22, 51, 115, + /* 2690 */ 115, 285, 115, 51, 115, 0, 116, 116, 115, 115, + /* 2700 */ 297, 115, 196, 115, 196, 115, 389, 116, 496, 115, + /* 2710 */ 195, 499, 116, 115, 200, 503, 504, 505, 506, 507, + /* 2720 */ 508, 404, 115, 511, 512, 115, 44, 0, 496, 22, + /* 2730 */ 116, 499, 115, 115, 389, 503, 504, 505, 506, 507, + /* 2740 */ 508, 196, 117, 511, 512, 118, 514, 115, 51, 404, + /* 2750 */ 433, 116, 22, 115, 115, 115, 115, 126, 22, 22, + /* 2760 */ 36, 116, 36, 229, 115, 36, 449, 116, 451, 115, + /* 2770 */ 389, 116, 116, 22, 256, 36, 36, 565, 433, 116, + /* 2780 */ 36, 36, 116, 137, 137, 404, 115, 137, 33, 137, + /* 2790 */ 473, 115, 36, 115, 449, 76, 451, 75, 22, 36, + /* 2800 */ 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, + /* 2810 */ 82, 109, 109, 496, 433, 82, 499, 33, 473, 36, /* 2820 */ 503, 504, 505, 506, 507, 508, 36, 36, 511, 512, - /* 2830 */ 449, 36, 451, 36, 22, 36, 36, 44, 54, 0, - /* 2840 */ 36, 496, 44, 54, 499, 0, 389, 36, 503, 504, - /* 2850 */ 505, 506, 507, 508, 473, 54, 511, 512, 0, 44, - /* 2860 */ 36, 404, 44, 54, 0, 36, 389, 0, 22, 36, - /* 2870 */ 0, 22, 36, 33, 36, 22, 21, 496, 22, 22, - /* 2880 */ 499, 404, 21, 20, 503, 504, 505, 506, 507, 508, - /* 2890 */ 433, 568, 511, 512, 568, 568, 568, 568, 568, 568, - /* 2900 */ 568, 568, 568, 568, 568, 568, 449, 568, 451, 568, + /* 2830 */ 449, 22, 451, 36, 36, 36, 82, 36, 36, 36, + /* 2840 */ 36, 496, 36, 22, 499, 0, 389, 36, 503, 504, + /* 2850 */ 505, 506, 507, 508, 473, 36, 511, 512, 0, 54, + /* 2860 */ 44, 404, 36, 0, 54, 36, 389, 44, 44, 54, + /* 2870 */ 0, 36, 54, 0, 44, 36, 0, 496, 22, 36, + /* 2880 */ 499, 404, 22, 36, 503, 504, 505, 506, 507, 508, + /* 2890 */ 433, 0, 511, 512, 33, 36, 22, 22, 21, 20, + /* 2900 */ 22, 21, 568, 568, 568, 568, 449, 568, 451, 568, /* 2910 */ 433, 568, 568, 568, 568, 568, 568, 568, 568, 568, /* 2920 */ 568, 568, 568, 568, 568, 568, 449, 568, 451, 568, /* 2930 */ 473, 389, 568, 568, 568, 568, 568, 568, 568, 568, @@ -1466,19 +1455,19 @@ static const YYCODETYPE yy_lookahead[] = { /* 4130 */ 507, 508, 568, 496, 511, 512, 499, 449, 433, 451, /* 4140 */ 503, 504, 505, 506, 507, 508, 568, 568, 511, 512, /* 4150 */ 568, 568, 568, 568, 449, 568, 451, 568, 496, 568, - /* 4160 */ 568, 499, 568, 568, 568, 503, 504, 505, 506, 507, - /* 4170 */ 508, 568, 568, 511, 512, 568, 568, 568, 568, 568, + /* 4160 */ 568, 499, 389, 568, 568, 503, 504, 505, 506, 507, + /* 4170 */ 508, 568, 568, 511, 512, 568, 568, 404, 568, 568, /* 4180 */ 568, 568, 568, 568, 496, 568, 568, 499, 568, 568, /* 4190 */ 568, 503, 504, 505, 506, 507, 508, 568, 568, 511, - /* 4200 */ 512, 496, 568, 568, 499, 568, 568, 568, 503, 504, - /* 4210 */ 505, 506, 507, 508, 568, 568, 511, 512, 386, 386, - /* 4220 */ 386, 386, 386, 386, 386, 386, 386, 386, 386, 386, - /* 4230 */ 386, 386, 386, 386, 386, 386, 386, 386, 386, 386, - /* 4240 */ 386, 386, 386, 386, 386, 386, 386, 386, 386, 386, - /* 4250 */ 386, 386, 386, 386, 386, 386, 386, 386, 386, 386, - /* 4260 */ 386, 386, 386, 386, 386, 386, 386, 386, 386, 386, - /* 4270 */ 386, 386, 386, 386, 386, 386, 386, 386, 386, 386, - /* 4280 */ 386, 386, 386, 386, 386, 386, 386, 386, 386, 386, + /* 4200 */ 512, 496, 568, 568, 499, 568, 433, 568, 503, 504, + /* 4210 */ 505, 506, 507, 508, 568, 568, 511, 512, 568, 568, + /* 4220 */ 568, 568, 449, 568, 451, 568, 568, 568, 568, 568, + /* 4230 */ 568, 568, 568, 568, 568, 568, 568, 568, 568, 568, + /* 4240 */ 568, 568, 568, 568, 568, 568, 568, 568, 568, 568, + /* 4250 */ 568, 568, 568, 568, 568, 568, 568, 568, 568, 568, + /* 4260 */ 568, 568, 568, 568, 568, 568, 568, 568, 568, 496, + /* 4270 */ 568, 568, 499, 568, 568, 568, 503, 504, 505, 506, + /* 4280 */ 507, 508, 568, 568, 511, 512, 386, 386, 386, 386, /* 4290 */ 386, 386, 386, 386, 386, 386, 386, 386, 386, 386, /* 4300 */ 386, 386, 386, 386, 386, 386, 386, 386, 386, 386, /* 4310 */ 386, 386, 386, 386, 386, 386, 386, 386, 386, 386, @@ -1510,849 +1499,18 @@ static const YYCODETYPE yy_lookahead[] = { /* 4570 */ 386, 386, 386, 386, 386, 386, 386, 386, 386, 386, /* 4580 */ 386, 386, 386, 386, 386, 386, 386, 386, 386, 386, /* 4590 */ 386, 386, 386, 386, 386, 386, 386, 386, 386, 386, - /* 4600 */ 386, 386, 386, 386, -======= -#define YY_ACTTAB_COUNT (3956) -static const YYACTIONTYPE yy_action[] = { - /* 0 */ 821, 670, 3003, 678, 671, 2311, 671, 2311, 2998, 2475, - /* 10 */ 2998, 956, 58, 56, 2430, 57, 55, 54, 53, 52, - /* 20 */ 499, 2264, 1982, 2626, 2007, 464, 820, 229, 771, 3002, - /* 30 */ 218, 2999, 822, 2999, 3001, 503, 1980, 492, 2084, 2355, - /* 40 */ 218, 2793, 149, 2623, 882, 148, 147, 146, 145, 144, - /* 50 */ 143, 142, 141, 140, 582, 2595, 836, 2599, 51, 50, - /* 60 */ 833, 168, 57, 55, 54, 53, 52, 2599, 2079, 149, - /* 70 */ 767, 865, 148, 147, 146, 145, 144, 143, 142, 141, - /* 80 */ 140, 895, 1988, 51, 50, 2811, 757, 57, 55, 54, - /* 90 */ 53, 52, 51, 50, 2698, 2011, 57, 55, 54, 53, - /* 100 */ 52, 2758, 751, 877, 755, 753, 299, 298, 245, 690, - /* 110 */ 680, 2665, 1002, 895, 693, 59, 973, 972, 971, 970, - /* 120 */ 528, 249, 969, 968, 173, 963, 962, 961, 960, 959, - /* 130 */ 958, 957, 172, 951, 950, 949, 527, 526, 946, 945, - /* 140 */ 944, 209, 208, 943, 523, 942, 941, 940, 2792, 43, - /* 150 */ 351, 2840, 2087, 2088, 810, 132, 2794, 881, 2796, 2797, - /* 160 */ 876, 2462, 2751, 864, 900, 516, 2220, 105, 2613, 211, - /* 170 */ 691, 2900, 104, 51, 50, 494, 2896, 57, 55, 54, - /* 180 */ 53, 52, 2793, 2811, 205, 2908, 832, 770, 160, 831, - /* 190 */ 3003, 2043, 2053, 342, 343, 230, 2998, 878, 341, 768, - /* 200 */ 2064, 2086, 2089, 2947, 2263, 51, 50, 2010, 61, 57, - /* 210 */ 55, 54, 53, 52, 820, 229, 1983, 2173, 1981, 2999, - /* 220 */ 822, 2180, 9, 863, 505, 505, 2811, 2007, 158, 157, - /* 230 */ 156, 155, 154, 153, 152, 151, 150, 900, 900, 103, - /* 240 */ 456, 895, 2758, 2261, 877, 937, 185, 184, 934, 933, - /* 250 */ 932, 182, 1986, 1987, 2040, 809, 2042, 2045, 2046, 2047, - /* 260 */ 2048, 2049, 2050, 2051, 2052, 873, 866, 2007, 225, 898, - /* 270 */ 897, 2071, 2072, 2073, 2074, 2075, 2078, 2080, 2081, 2082, - /* 280 */ 2083, 2085, 2, 58, 56, 2176, 686, 2793, 675, 2792, - /* 290 */ 2114, 499, 2840, 1982, 672, 689, 132, 2794, 881, 2796, - /* 300 */ 2797, 876, 875, 2244, 864, 900, 744, 1980, 170, 2084, - /* 310 */ 179, 2871, 2900, 2192, 833, 168, 494, 2896, 51, 50, - /* 320 */ 895, 758, 57, 55, 54, 53, 52, 3003, 573, 2012, - /* 330 */ 2626, 2811, 531, 2151, 73, 2998, 61, 530, 220, 2079, - /* 340 */ 300, 2151, 865, 33, 501, 2007, 19, 2758, 667, 877, - /* 350 */ 2623, 882, 44, 1988, 3002, 2115, 747, 665, 2999, 3000, - /* 360 */ 661, 657, 73, 741, 739, 2752, 58, 56, 73, 265, - /* 370 */ 297, 896, 2471, 673, 499, 2319, 1982, 2209, 635, 633, - /* 380 */ 333, 436, 771, 1002, 243, 77, 15, 2568, 787, 1535, - /* 390 */ 1980, 159, 2084, 203, 2792, 328, 2998, 2840, 2044, 716, - /* 400 */ 335, 431, 2794, 881, 2796, 2797, 876, 874, 1542, 864, - /* 410 */ 900, 856, 2865, 2358, 3004, 229, 83, 125, 12, 2999, - /* 420 */ 822, 82, 2079, 2087, 2088, 865, 2221, 520, 505, 19, - /* 430 */ 2524, 2526, 2120, 1537, 1540, 1541, 1988, 835, 198, 2908, - /* 440 */ 2909, 900, 166, 2913, 803, 802, 2207, 2208, 2210, 2211, - /* 450 */ 2212, 42, 496, 2109, 2110, 2111, 2112, 2113, 2117, 2118, - /* 460 */ 2119, 2041, 2043, 2053, 773, 2665, 1002, 2008, 564, 15, - /* 470 */ 563, 62, 2086, 2089, 2920, 2148, 2149, 2150, 2920, 2920, - /* 480 */ 2920, 2920, 2920, 2148, 2149, 2150, 2768, 1983, 1988, 1981, - /* 490 */ 737, 736, 735, 195, 863, 193, 73, 727, 165, 731, - /* 500 */ 811, 2404, 562, 730, 518, 2473, 2087, 2088, 729, 734, - /* 510 */ 474, 473, 906, 1653, 728, 2772, 1828, 1829, 472, 724, - /* 520 */ 723, 722, 2172, 1986, 1987, 2040, 335, 2042, 2045, 2046, - /* 530 */ 2047, 2048, 2049, 2050, 2051, 2052, 873, 866, 2455, 443, - /* 540 */ 898, 897, 2071, 2072, 183, 2043, 2053, 2078, 2080, 2081, - /* 550 */ 2082, 2083, 2085, 2, 335, 2086, 2089, 687, 610, 1655, - /* 560 */ 335, 471, 470, 609, 1715, 2774, 2776, 495, 303, 2151, - /* 570 */ 1983, 608, 1981, 222, 833, 168, 2010, 863, 900, 1706, - /* 580 */ 929, 928, 927, 1710, 926, 1712, 1713, 925, 922, 2518, - /* 590 */ 1721, 919, 1723, 1724, 916, 913, 910, 51, 50, 1754, - /* 600 */ 1755, 57, 55, 54, 53, 52, 1986, 1987, 2040, 930, - /* 610 */ 2042, 2045, 2046, 2047, 2048, 2049, 2050, 2051, 2052, 873, - /* 620 */ 866, 688, 2619, 898, 897, 2071, 2072, 65, 2915, 2626, - /* 630 */ 2078, 2080, 2081, 2082, 2083, 2085, 2, 12, 58, 56, - /* 640 */ 511, 469, 468, 392, 718, 2793, 499, 302, 1982, 2624, - /* 650 */ 882, 301, 806, 1909, 1910, 1715, 2912, 833, 168, 196, - /* 660 */ 878, 2275, 1980, 335, 2084, 720, 905, 904, 903, 719, - /* 670 */ 1706, 929, 928, 927, 1710, 926, 1712, 1713, 872, 871, - /* 680 */ 2793, 1721, 870, 1723, 1724, 869, 913, 910, 335, 2811, - /* 690 */ 1562, 2286, 1561, 2008, 2079, 878, 2551, 865, 138, 2908, - /* 700 */ 2909, 19, 166, 2913, 2674, 2758, 164, 877, 1988, 218, - /* 710 */ 2920, 2148, 2149, 2150, 2920, 2920, 2920, 2920, 2920, 896, - /* 720 */ 2471, 58, 56, 2090, 2811, 114, 550, 2768, 1563, 499, - /* 730 */ 451, 1982, 2285, 479, 2040, 759, 2600, 2095, 1002, 522, - /* 740 */ 2758, 15, 877, 2007, 135, 1980, 1562, 2084, 1561, 333, - /* 750 */ 2011, 2758, 2792, 518, 2473, 2840, 2772, 588, 2595, 408, - /* 760 */ 2794, 881, 2796, 2797, 876, 725, 31, 864, 900, 812, - /* 770 */ 807, 800, 796, 896, 2471, 619, 2595, 2079, 2087, 2088, - /* 780 */ 865, 199, 2908, 2909, 1563, 166, 2913, 2792, 1646, 2711, - /* 790 */ 2840, 1988, 2758, 159, 132, 2794, 881, 2796, 2797, 876, - /* 800 */ 502, 721, 864, 900, 481, 2673, 2774, 2777, 2875, 192, - /* 810 */ 2900, 247, 896, 2471, 494, 2896, 95, 2043, 2053, 900, - /* 820 */ 2476, 1002, 1951, 939, 59, 1855, 1856, 2086, 2089, 252, - /* 830 */ 51, 50, 234, 171, 57, 55, 54, 53, 52, 737, - /* 840 */ 736, 735, 1983, 2463, 1981, 787, 727, 165, 731, 863, - /* 850 */ 2445, 612, 730, 2998, 510, 509, 47, 729, 734, 474, - /* 860 */ 473, 2087, 2088, 728, 554, 2712, 611, 472, 724, 723, - /* 870 */ 722, 3004, 229, 2011, 1854, 1857, 2999, 822, 1986, 1987, - /* 880 */ 2040, 111, 2042, 2045, 2046, 2047, 2048, 2049, 2050, 2051, - /* 890 */ 2052, 873, 866, 556, 552, 898, 897, 2071, 2072, 467, - /* 900 */ 2043, 2053, 2078, 2080, 2081, 2082, 2083, 2085, 2, 2466, - /* 910 */ 2086, 2089, 51, 50, 2044, 868, 57, 55, 54, 53, - /* 920 */ 52, 787, 392, 224, 939, 1983, 867, 1981, 629, 2998, - /* 930 */ 896, 2471, 863, 267, 525, 524, 2531, 673, 514, 2319, - /* 940 */ 521, 566, 1665, 1982, 462, 2531, 565, 3004, 229, 192, - /* 950 */ 66, 46, 2999, 822, 2342, 2529, 1664, 1980, 1989, 2284, - /* 960 */ 2476, 1986, 1987, 2040, 840, 2042, 2045, 2046, 2047, 2048, - /* 970 */ 2049, 2050, 2051, 2052, 873, 866, 738, 2041, 898, 897, - /* 980 */ 2071, 2072, 480, 2673, 2012, 2078, 2080, 2081, 2082, 2083, - /* 990 */ 2085, 2, 58, 56, 2201, 2793, 254, 787, 2531, 12, - /* 1000 */ 499, 10, 1982, 1988, 2283, 2998, 490, 2116, 2202, 115, - /* 1010 */ 836, 2153, 2154, 2155, 2156, 2157, 1980, 2529, 2084, 2758, - /* 1020 */ 2059, 628, 253, 3004, 229, 896, 2471, 37, 2999, 822, - /* 1030 */ 2251, 2282, 640, 1002, 821, 626, 896, 2471, 314, 2811, - /* 1040 */ 2525, 2526, 2998, 1883, 2793, 692, 232, 2679, 2079, 896, - /* 1050 */ 2471, 865, 896, 2471, 2200, 2758, 570, 877, 2915, 878, - /* 1060 */ 820, 229, 1988, 2531, 2758, 2999, 822, 896, 2471, 571, - /* 1070 */ 896, 2471, 590, 896, 2471, 58, 56, 896, 2471, 385, - /* 1080 */ 896, 2471, 848, 499, 2121, 1982, 2911, 604, 2811, 116, - /* 1090 */ 605, 2758, 1002, 606, 720, 59, 2915, 2468, 719, 1980, - /* 1100 */ 305, 2084, 2792, 40, 2758, 2840, 877, 2012, 304, 132, - /* 1110 */ 2794, 881, 2796, 2797, 876, 896, 2471, 864, 900, 2531, - /* 1120 */ 1950, 896, 2471, 211, 2910, 2900, 2281, 504, 953, 494, - /* 1130 */ 2896, 2079, 2087, 2088, 865, 313, 39, 1983, 2529, 1981, - /* 1140 */ 1992, 839, 51, 50, 192, 1988, 57, 55, 54, 53, - /* 1150 */ 52, 2792, 513, 512, 2840, 2477, 2250, 2948, 197, 2794, - /* 1160 */ 881, 2796, 2797, 876, 1565, 1566, 864, 900, 54, 53, - /* 1170 */ 52, 2043, 2053, 1986, 1987, 1002, 2460, 2007, 59, 896, - /* 1180 */ 2471, 2086, 2089, 51, 50, 2531, 2758, 57, 55, 54, - /* 1190 */ 53, 52, 124, 519, 712, 711, 1983, 955, 1981, 346, - /* 1200 */ 714, 713, 2458, 863, 2529, 51, 50, 788, 2958, 57, - /* 1210 */ 55, 54, 53, 52, 41, 2087, 2088, 2280, 2279, 2464, - /* 1220 */ 51, 50, 14, 13, 57, 55, 54, 53, 52, 733, - /* 1230 */ 732, 399, 1986, 1987, 2040, 2508, 2042, 2045, 2046, 2047, - /* 1240 */ 2048, 2049, 2050, 2051, 2052, 873, 866, 111, 2278, 898, - /* 1250 */ 897, 2071, 2072, 175, 2043, 2053, 2078, 2080, 2081, 2082, - /* 1260 */ 2083, 2085, 2, 786, 2086, 2089, 51, 50, 896, 2471, - /* 1270 */ 57, 55, 54, 53, 52, 2467, 285, 2758, 2758, 1983, - /* 1280 */ 2447, 1981, 857, 859, 2872, 2872, 863, 825, 853, 51, - /* 1290 */ 50, 2060, 204, 57, 55, 54, 53, 52, 896, 2471, - /* 1300 */ 391, 710, 706, 702, 698, 38, 284, 2444, 2758, 169, - /* 1310 */ 896, 2471, 2871, 2062, 2011, 1986, 1987, 2040, 353, 2042, - /* 1320 */ 2045, 2046, 2047, 2048, 2049, 2050, 2051, 2052, 873, 866, - /* 1330 */ 889, 2007, 898, 897, 2071, 2072, 1899, 2128, 2277, 2078, - /* 1340 */ 2080, 2081, 2082, 2083, 2085, 2, 58, 56, 2044, 2274, - /* 1350 */ 1669, 440, 112, 2005, 499, 769, 1982, 282, 3002, 1542, - /* 1360 */ 617, 51, 50, 466, 1668, 57, 55, 54, 53, 52, - /* 1370 */ 1980, 637, 2084, 1005, 51, 50, 896, 2471, 57, 55, - /* 1380 */ 54, 53, 52, 896, 2471, 1540, 1541, 596, 545, 639, - /* 1390 */ 896, 2471, 389, 1544, 441, 598, 890, 815, 2758, 2006, - /* 1400 */ 2273, 2272, 2079, 894, 71, 865, 576, 993, 219, 2758, - /* 1410 */ 381, 2041, 236, 45, 2271, 784, 1988, 989, 985, 981, - /* 1420 */ 977, 2270, 384, 2269, 270, 937, 185, 184, 934, 933, - /* 1430 */ 932, 182, 193, 281, 967, 965, 931, 272, 279, 2522, - /* 1440 */ 642, 310, 2474, 277, 684, 828, 1002, 465, 2531, 15, - /* 1450 */ 2291, 995, 937, 185, 184, 934, 933, 932, 182, 584, - /* 1460 */ 2758, 2758, 269, 2268, 2267, 2702, 2162, 2530, 131, 2065, - /* 1470 */ 2266, 51, 50, 357, 2758, 57, 55, 54, 53, 52, - /* 1480 */ 2533, 2758, 935, 2758, 89, 2522, 2087, 2088, 2578, 3, - /* 1490 */ 2606, 2585, 175, 625, 624, 623, 622, 621, 616, 615, - /* 1500 */ 614, 613, 448, 64, 849, 603, 602, 601, 600, 599, - /* 1510 */ 593, 592, 591, 2448, 586, 585, 463, 1648, 2340, 538, - /* 1520 */ 577, 1816, 1817, 2758, 2758, 2043, 2053, 1835, 936, 161, - /* 1530 */ 2758, 2522, 580, 2331, 290, 2086, 2089, 288, 102, 292, - /* 1540 */ 740, 294, 291, 101, 293, 726, 174, 2329, 2012, 355, - /* 1550 */ 1983, 855, 1981, 296, 338, 742, 295, 863, 761, 337, - /* 1560 */ 760, 794, 1626, 1649, 398, 2041, 51, 50, 1644, 745, - /* 1570 */ 57, 55, 54, 53, 52, 1907, 2779, 60, 307, 2061, - /* 1580 */ 2253, 2254, 2475, 60, 212, 826, 1986, 1987, 2040, 223, - /* 1590 */ 2042, 2045, 2046, 2047, 2048, 2049, 2050, 2051, 2052, 873, - /* 1600 */ 866, 14, 13, 898, 897, 2071, 2072, 183, 1627, 340, - /* 1610 */ 2078, 2080, 2081, 2082, 2083, 2085, 2, 194, 88, 51, - /* 1620 */ 50, 2793, 405, 57, 55, 54, 53, 52, 2405, 764, - /* 1630 */ 60, 360, 359, 2276, 862, 638, 878, 75, 2321, 60, - /* 1640 */ 2781, 403, 87, 60, 2196, 86, 60, 2793, 1991, 88, - /* 1650 */ 180, 161, 362, 361, 2961, 203, 442, 364, 363, 772, - /* 1660 */ 2206, 130, 878, 127, 2955, 2811, 2205, 319, 263, 652, - /* 1670 */ 650, 647, 645, 329, 2058, 183, 947, 366, 365, 368, - /* 1680 */ 367, 2758, 1990, 877, 824, 787, 804, 370, 369, 321, - /* 1690 */ 838, 2811, 344, 2998, 372, 371, 837, 374, 373, 1618, - /* 1700 */ 834, 845, 85, 376, 375, 378, 377, 2758, 163, 877, - /* 1710 */ 2812, 3004, 229, 2063, 73, 787, 2999, 822, 380, 379, - /* 1720 */ 2122, 2312, 2066, 2998, 2397, 2396, 2054, 908, 2792, 1852, - /* 1730 */ 181, 2840, 1842, 356, 893, 132, 2794, 881, 2796, 2797, - /* 1740 */ 876, 3004, 229, 864, 900, 829, 2999, 822, 183, 3018, - /* 1750 */ 948, 2900, 787, 74, 2792, 494, 2896, 2840, 1697, 2793, - /* 1760 */ 2998, 132, 2794, 881, 2796, 2797, 876, 801, 162, 864, - /* 1770 */ 900, 180, 1599, 1616, 878, 3018, 2968, 2900, 3004, 229, - /* 1780 */ 486, 494, 2896, 2999, 822, 397, 2951, 808, 482, 842, - /* 1790 */ 2604, 529, 547, 2318, 2519, 780, 326, 2952, 2962, 816, - /* 1800 */ 817, 331, 2605, 2811, 136, 2793, 2323, 99, 98, 569, - /* 1810 */ 1728, 2106, 242, 1736, 334, 2431, 5, 537, 1600, 2758, - /* 1820 */ 878, 877, 798, 532, 460, 561, 559, 2005, 546, 2015, - /* 1830 */ 1994, 1743, 525, 524, 557, 2793, 558, 237, 439, 1876, - /* 1840 */ 238, 548, 1996, 560, 544, 540, 536, 533, 562, 2811, - /* 1850 */ 878, 1741, 2991, 240, 186, 390, 1989, 574, 2084, 2006, - /* 1860 */ 581, 991, 251, 583, 1993, 2758, 2792, 877, 589, 2840, - /* 1870 */ 587, 631, 594, 132, 2794, 881, 2796, 2797, 876, 2811, - /* 1880 */ 607, 864, 900, 643, 620, 618, 2793, 3018, 2079, 2900, - /* 1890 */ 627, 2597, 630, 494, 2896, 2758, 641, 877, 632, 644, - /* 1900 */ 256, 878, 1988, 2932, 257, 646, 335, 648, 649, 260, - /* 1910 */ 651, 653, 2792, 2013, 668, 2840, 4, 676, 679, 132, - /* 1920 */ 2794, 881, 2796, 2797, 876, 268, 669, 864, 900, 677, - /* 1930 */ 2811, 107, 861, 3018, 2008, 2900, 2014, 681, 682, 494, - /* 1940 */ 2896, 2016, 2792, 685, 683, 2840, 2758, 271, 877, 132, - /* 1950 */ 2794, 881, 2796, 2797, 876, 2017, 274, 864, 900, 276, - /* 1960 */ 2620, 446, 445, 3018, 108, 2900, 2018, 109, 110, 494, - /* 1970 */ 2896, 506, 2614, 694, 283, 715, 763, 748, 749, 137, - /* 1980 */ 765, 717, 113, 434, 2461, 515, 287, 2084, 2688, 2685, - /* 1990 */ 2684, 393, 2457, 2792, 289, 2793, 2840, 188, 134, 2459, - /* 2000 */ 132, 2794, 881, 2796, 2797, 876, 2009, 2454, 864, 900, - /* 2010 */ 878, 189, 176, 190, 3018, 775, 2900, 2079, 306, 774, - /* 2020 */ 494, 2896, 2666, 779, 311, 2793, 776, 805, 782, 2967, - /* 2030 */ 791, 843, 316, 8, 2939, 814, 1997, 309, 1992, 2811, - /* 2040 */ 878, 792, 320, 781, 790, 2966, 318, 202, 819, 322, - /* 2050 */ 818, 789, 2919, 487, 323, 2758, 327, 877, 324, 2793, - /* 2060 */ 830, 827, 167, 3021, 325, 2010, 2170, 2168, 231, 2811, - /* 2070 */ 2916, 330, 2000, 2002, 878, 336, 1, 2997, 215, 177, - /* 2080 */ 841, 2634, 394, 2633, 2632, 2758, 491, 877, 395, 898, - /* 2090 */ 897, 846, 847, 178, 72, 851, 2078, 2080, 2081, 2082, - /* 2100 */ 2083, 2085, 2792, 2811, 854, 2840, 885, 349, 883, 132, - /* 2110 */ 2794, 881, 2796, 2797, 876, 2881, 887, 864, 900, 2758, - /* 2120 */ 354, 877, 888, 2873, 396, 2900, 2472, 2750, 123, 494, - /* 2130 */ 2896, 2749, 2792, 126, 2745, 2840, 2744, 2736, 2735, 132, - /* 2140 */ 2794, 881, 2796, 2797, 876, 1514, 2793, 864, 900, 2727, - /* 2150 */ 2726, 2742, 2741, 858, 400, 2900, 2733, 997, 2732, 494, - /* 2160 */ 2896, 878, 902, 998, 2721, 1973, 2792, 1949, 2720, 2840, - /* 2170 */ 2739, 383, 2738, 133, 2794, 881, 2796, 2797, 876, 187, - /* 2180 */ 2730, 864, 900, 999, 386, 994, 767, 387, 402, 2900, - /* 2190 */ 2811, 2729, 2793, 2899, 2896, 2718, 2717, 2715, 2714, 508, - /* 2200 */ 507, 1974, 2523, 1001, 63, 444, 2758, 878, 877, 422, - /* 2210 */ 452, 447, 433, 453, 435, 404, 2710, 423, 898, 897, - /* 2220 */ 2709, 2708, 2793, 96, 2703, 2078, 2080, 2081, 2082, 2083, - /* 2230 */ 2085, 534, 535, 1933, 1934, 235, 2811, 878, 539, 2701, - /* 2240 */ 541, 542, 543, 1932, 2700, 2699, 461, 2697, 549, 2696, - /* 2250 */ 551, 2695, 2758, 2792, 877, 553, 2840, 1920, 555, 2670, - /* 2260 */ 133, 2794, 881, 2796, 2797, 876, 2811, 2694, 864, 900, - /* 2270 */ 239, 2669, 241, 1879, 97, 1878, 2900, 2647, 2646, 2645, - /* 2280 */ 860, 2896, 2758, 567, 877, 568, 2793, 2644, 2643, 2587, - /* 2290 */ 2584, 572, 1815, 2583, 575, 2577, 578, 579, 2574, 879, - /* 2300 */ 2573, 878, 2840, 244, 2572, 2571, 133, 2794, 881, 2796, - /* 2310 */ 2797, 876, 100, 2793, 864, 900, 2576, 246, 2575, 2570, - /* 2320 */ 2569, 2567, 2900, 2566, 2565, 248, 455, 2896, 878, 2792, - /* 2330 */ 2811, 2564, 2840, 595, 597, 2562, 200, 2794, 881, 2796, - /* 2340 */ 2797, 876, 2561, 2560, 864, 900, 2758, 2559, 877, 2558, - /* 2350 */ 2793, 2582, 2557, 2556, 2555, 2580, 2563, 2811, 2554, 2553, - /* 2360 */ 2552, 2550, 2549, 2548, 2547, 878, 250, 2544, 2543, 106, - /* 2370 */ 2542, 2541, 2540, 2758, 2546, 877, 2545, 2612, 2581, 2579, - /* 2380 */ 2539, 2538, 2537, 255, 2536, 634, 2535, 1821, 636, 2534, - /* 2390 */ 2532, 1666, 449, 2792, 2811, 1670, 2840, 823, 3019, 2793, - /* 2400 */ 133, 2794, 881, 2796, 2797, 876, 2362, 258, 864, 900, - /* 2410 */ 2758, 2361, 877, 259, 878, 2360, 2900, 2359, 261, 1662, - /* 2420 */ 2792, 2897, 2357, 2840, 2354, 262, 2353, 197, 2794, 881, - /* 2430 */ 2796, 2797, 876, 654, 484, 864, 900, 450, 656, 658, - /* 2440 */ 660, 655, 659, 2811, 2346, 662, 663, 2333, 2793, 664, - /* 2450 */ 666, 2307, 92, 210, 264, 2778, 1543, 2792, 2306, 2758, - /* 2460 */ 2840, 877, 93, 878, 432, 2794, 881, 2796, 2797, 876, - /* 2470 */ 221, 2668, 864, 900, 674, 266, 2793, 2959, 273, 275, - /* 2480 */ 2641, 2618, 278, 485, 2664, 2654, 2642, 280, 2611, 2449, - /* 2490 */ 2793, 878, 2811, 2356, 2352, 695, 697, 1592, 2350, 696, - /* 2500 */ 699, 701, 700, 2348, 703, 878, 2792, 704, 2758, 2840, - /* 2510 */ 877, 705, 2793, 432, 2794, 881, 2796, 2797, 876, 2345, - /* 2520 */ 2811, 864, 900, 707, 708, 2328, 709, 875, 2326, 2327, - /* 2530 */ 2325, 2303, 2451, 1748, 2811, 84, 2758, 1747, 877, 286, - /* 2540 */ 2450, 1651, 1652, 1650, 1647, 1645, 1643, 964, 1642, 1641, - /* 2550 */ 2758, 2343, 877, 1640, 1639, 2792, 2811, 966, 2840, 1636, - /* 2560 */ 1634, 475, 425, 2794, 881, 2796, 2797, 876, 2341, 1635, - /* 2570 */ 864, 900, 2758, 1633, 877, 476, 2332, 477, 743, 2330, - /* 2580 */ 478, 2793, 746, 2792, 2302, 2301, 2840, 2300, 750, 2299, - /* 2590 */ 200, 2794, 881, 2796, 2797, 876, 878, 2792, 864, 900, - /* 2600 */ 2840, 752, 2298, 754, 413, 2794, 881, 2796, 2797, 876, - /* 2610 */ 2297, 139, 864, 900, 756, 813, 1914, 2793, 1916, 2792, - /* 2620 */ 1918, 32, 2840, 2667, 1913, 2811, 431, 2794, 881, 2796, - /* 2630 */ 2797, 876, 878, 67, 864, 900, 78, 2866, 2663, 68, - /* 2640 */ 766, 2758, 1904, 877, 308, 2793, 1887, 1885, 1889, 2653, - /* 2650 */ 777, 191, 3020, 778, 312, 2640, 2639, 783, 1864, 1863, - /* 2660 */ 878, 2811, 3003, 21, 785, 497, 2223, 793, 483, 34, - /* 2670 */ 6, 315, 7, 2197, 795, 797, 317, 2758, 22, 877, - /* 2680 */ 799, 23, 2204, 214, 226, 201, 213, 17, 2792, 2811, - /* 2690 */ 2191, 2840, 35, 2779, 36, 432, 2794, 881, 2796, 2797, - /* 2700 */ 876, 493, 2161, 864, 900, 2758, 227, 877, 2163, 94, - /* 2710 */ 24, 228, 2165, 2243, 76, 2244, 25, 2238, 2237, 2145, - /* 2720 */ 488, 2242, 2241, 489, 2792, 2144, 2793, 2840, 332, 498, - /* 2730 */ 70, 417, 2794, 881, 2796, 2797, 876, 69, 2638, 864, - /* 2740 */ 900, 878, 206, 2617, 117, 18, 118, 2616, 119, 347, - /* 2750 */ 339, 2199, 2792, 2610, 2793, 2840, 216, 844, 345, 432, - /* 2760 */ 2794, 881, 2796, 2797, 876, 120, 80, 864, 900, 878, - /* 2770 */ 2811, 2097, 26, 850, 852, 348, 350, 2096, 13, 11, - /* 2780 */ 1998, 2057, 27, 28, 20, 48, 2758, 2107, 877, 915, - /* 2790 */ 2793, 2056, 207, 918, 921, 217, 2033, 880, 2811, 2609, - /* 2800 */ 886, 121, 2446, 924, 49, 878, 2055, 16, 29, 30, - /* 2810 */ 500, 2025, 884, 81, 2758, 352, 877, 891, 122, 892, - /* 2820 */ 358, 90, 127, 2793, 2850, 2849, 2259, 2258, 2068, 899, - /* 2830 */ 79, 2257, 1729, 2792, 2811, 2256, 2840, 907, 878, 901, - /* 2840 */ 432, 2794, 881, 2796, 2797, 876, 517, 909, 864, 900, - /* 2850 */ 2758, 1726, 877, 911, 914, 912, 917, 920, 1725, 923, - /* 2860 */ 1720, 762, 1722, 1719, 2840, 1716, 2793, 2811, 427, 2794, - /* 2870 */ 881, 2796, 2797, 876, 1718, 1714, 864, 900, 128, 382, - /* 2880 */ 129, 878, 1717, 2758, 1742, 877, 91, 1738, 1590, 938, - /* 2890 */ 1630, 1629, 1628, 1625, 1622, 1621, 1620, 2792, 1619, 2793, - /* 2900 */ 2840, 1660, 1617, 952, 409, 2794, 881, 2796, 2797, 876, - /* 2910 */ 2811, 1615, 864, 900, 878, 1614, 1613, 1659, 233, 1611, - /* 2920 */ 954, 1608, 1610, 1609, 1607, 1606, 2758, 1605, 877, 1656, - /* 2930 */ 2792, 1654, 1602, 2840, 1601, 1596, 2351, 406, 2794, 881, - /* 2940 */ 2796, 2797, 876, 2811, 1598, 864, 900, 1597, 1595, 976, - /* 2950 */ 974, 975, 2349, 978, 980, 979, 2347, 982, 983, 2758, - /* 2960 */ 984, 877, 2344, 2793, 986, 2324, 988, 990, 2322, 987, - /* 2970 */ 992, 1532, 2296, 2792, 996, 1515, 2840, 388, 878, 1520, - /* 2980 */ 410, 2794, 881, 2796, 2797, 876, 2793, 1522, 864, 900, - /* 2990 */ 1000, 2262, 1984, 401, 1003, 1004, 2262, 2262, 2262, 2262, - /* 3000 */ 2262, 878, 2262, 2262, 2262, 2262, 2792, 2811, 2262, 2840, - /* 3010 */ 2262, 2262, 2262, 424, 2794, 881, 2796, 2797, 876, 2262, - /* 3020 */ 2262, 864, 900, 2758, 2262, 877, 2262, 2262, 2262, 2262, - /* 3030 */ 2811, 2262, 2793, 2262, 2262, 2262, 2262, 2262, 2262, 2262, - /* 3040 */ 2262, 2262, 2262, 2262, 2262, 2262, 2758, 878, 877, 2262, - /* 3050 */ 2262, 2262, 2262, 2262, 2793, 2262, 2262, 2262, 2262, 2262, - /* 3060 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2793, 878, - /* 3070 */ 2792, 2262, 2262, 2840, 2262, 2262, 2811, 411, 2794, 881, - /* 3080 */ 2796, 2797, 876, 878, 2262, 864, 900, 2262, 2262, 2262, - /* 3090 */ 2262, 2262, 2758, 2792, 877, 2262, 2840, 2262, 2811, 2262, - /* 3100 */ 412, 2794, 881, 2796, 2797, 876, 2262, 2262, 864, 900, - /* 3110 */ 2262, 2262, 2811, 2262, 2758, 2262, 877, 2262, 2262, 2262, - /* 3120 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2758, 2262, - /* 3130 */ 877, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2792, - /* 3140 */ 2262, 2262, 2840, 2262, 2793, 2262, 428, 2794, 881, 2796, - /* 3150 */ 2797, 876, 2262, 2262, 864, 900, 2262, 2262, 2262, 878, - /* 3160 */ 2262, 2792, 2262, 2262, 2840, 2262, 2262, 2262, 414, 2794, - /* 3170 */ 881, 2796, 2797, 876, 2262, 2792, 864, 900, 2840, 2793, - /* 3180 */ 2262, 2262, 429, 2794, 881, 2796, 2797, 876, 2811, 2262, - /* 3190 */ 864, 900, 2262, 2262, 878, 2262, 2262, 2262, 2262, 2262, - /* 3200 */ 2262, 2262, 2262, 2262, 2758, 2262, 877, 2262, 2262, 2262, - /* 3210 */ 2262, 2262, 2793, 2262, 2262, 2262, 2262, 2262, 2262, 2262, - /* 3220 */ 2262, 2262, 2262, 2811, 2262, 2262, 2262, 878, 2262, 2262, - /* 3230 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2758, - /* 3240 */ 2262, 877, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, - /* 3250 */ 2262, 2792, 2262, 2262, 2840, 2793, 2811, 2262, 415, 2794, - /* 3260 */ 881, 2796, 2797, 876, 2262, 2262, 864, 900, 2262, 2262, - /* 3270 */ 878, 2262, 2758, 2262, 877, 2262, 2262, 2262, 2262, 2262, - /* 3280 */ 2262, 2262, 2262, 2262, 2262, 2262, 2792, 2262, 2793, 2840, - /* 3290 */ 2262, 2262, 2262, 430, 2794, 881, 2796, 2797, 876, 2811, - /* 3300 */ 2262, 864, 900, 878, 2262, 2262, 2262, 2262, 2262, 2262, - /* 3310 */ 2262, 2262, 2262, 2262, 2262, 2758, 2262, 877, 2262, 2792, - /* 3320 */ 2262, 2262, 2840, 2262, 2262, 2262, 416, 2794, 881, 2796, - /* 3330 */ 2797, 876, 2811, 2262, 864, 900, 2262, 2262, 2262, 2262, - /* 3340 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2758, 2262, - /* 3350 */ 877, 2262, 2793, 2262, 2262, 2262, 2262, 2262, 2262, 2262, - /* 3360 */ 2262, 2262, 2792, 2262, 2262, 2840, 2262, 878, 2262, 407, - /* 3370 */ 2794, 881, 2796, 2797, 876, 2793, 2262, 864, 900, 2262, - /* 3380 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, - /* 3390 */ 878, 2262, 2262, 2262, 2262, 2792, 2811, 2262, 2840, 2262, - /* 3400 */ 2262, 2262, 418, 2794, 881, 2796, 2797, 876, 2262, 2262, - /* 3410 */ 864, 900, 2758, 2262, 877, 2262, 2262, 2262, 2262, 2811, - /* 3420 */ 2262, 2793, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, - /* 3430 */ 2262, 2262, 2262, 2262, 2262, 2758, 878, 877, 2262, 2262, - /* 3440 */ 2262, 2262, 2262, 2793, 2262, 2262, 2262, 2262, 2262, 2262, - /* 3450 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2793, 878, 2792, - /* 3460 */ 2262, 2262, 2840, 2262, 2262, 2811, 419, 2794, 881, 2796, - /* 3470 */ 2797, 876, 878, 2262, 864, 900, 2262, 2262, 2262, 2262, - /* 3480 */ 2262, 2758, 2792, 877, 2262, 2840, 2262, 2811, 2262, 420, - /* 3490 */ 2794, 881, 2796, 2797, 876, 2262, 2262, 864, 900, 2262, - /* 3500 */ 2262, 2811, 2262, 2758, 2262, 877, 2262, 2262, 2262, 2262, - /* 3510 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2758, 2262, 877, - /* 3520 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2792, 2262, - /* 3530 */ 2262, 2840, 2262, 2793, 2262, 421, 2794, 881, 2796, 2797, - /* 3540 */ 876, 2262, 2262, 864, 900, 2262, 2262, 2262, 878, 2262, - /* 3550 */ 2792, 2262, 2262, 2840, 2262, 2262, 2262, 437, 2794, 881, - /* 3560 */ 2796, 2797, 876, 2262, 2792, 864, 900, 2840, 2793, 2262, - /* 3570 */ 2262, 438, 2794, 881, 2796, 2797, 876, 2811, 2262, 864, - /* 3580 */ 900, 2262, 2262, 878, 2262, 2262, 2262, 2262, 2262, 2262, - /* 3590 */ 2262, 2262, 2262, 2758, 2262, 877, 2262, 2262, 2262, 2262, - /* 3600 */ 2262, 2793, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, - /* 3610 */ 2262, 2262, 2811, 2262, 2262, 2262, 878, 2262, 2262, 2262, - /* 3620 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2758, 2262, - /* 3630 */ 877, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, - /* 3640 */ 2792, 2262, 2262, 2840, 2793, 2811, 2262, 2805, 2794, 881, - /* 3650 */ 2796, 2797, 876, 2262, 2262, 864, 900, 2262, 2262, 878, - /* 3660 */ 2262, 2758, 2262, 877, 2262, 2262, 2262, 2262, 2262, 2262, - /* 3670 */ 2262, 2262, 2262, 2262, 2262, 2792, 2262, 2793, 2840, 2262, - /* 3680 */ 2262, 2262, 2804, 2794, 881, 2796, 2797, 876, 2811, 2262, - /* 3690 */ 864, 900, 878, 2262, 2262, 2262, 2262, 2262, 2262, 2262, - /* 3700 */ 2262, 2262, 2262, 2262, 2758, 2262, 877, 2262, 2792, 2262, - /* 3710 */ 2262, 2840, 2262, 2262, 2262, 2803, 2794, 881, 2796, 2797, - /* 3720 */ 876, 2811, 2262, 864, 900, 2262, 2262, 2262, 2262, 2262, - /* 3730 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2758, 2262, 877, - /* 3740 */ 2262, 2793, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, - /* 3750 */ 2262, 2792, 2262, 2262, 2840, 2262, 878, 2262, 457, 2794, - /* 3760 */ 881, 2796, 2797, 876, 2793, 2262, 864, 900, 2262, 2262, - /* 3770 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 878, - /* 3780 */ 2262, 2262, 2262, 2262, 2792, 2811, 2262, 2840, 2262, 2262, - /* 3790 */ 2262, 458, 2794, 881, 2796, 2797, 876, 2262, 2262, 864, - /* 3800 */ 900, 2758, 2262, 877, 2262, 2262, 2262, 2262, 2811, 2262, - /* 3810 */ 2793, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, - /* 3820 */ 2262, 2262, 2262, 2262, 2758, 878, 877, 2262, 2262, 2262, - /* 3830 */ 2262, 2262, 2793, 2262, 2262, 2262, 2262, 2262, 2262, 2262, - /* 3840 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 878, 2792, 2262, - /* 3850 */ 2262, 2840, 2262, 2262, 2811, 454, 2794, 881, 2796, 2797, - /* 3860 */ 876, 2262, 2262, 864, 900, 2262, 2262, 2262, 2262, 2262, - /* 3870 */ 2758, 2792, 877, 2262, 2840, 2262, 2811, 2262, 459, 2794, - /* 3880 */ 881, 2796, 2797, 876, 2262, 2262, 864, 900, 2262, 2262, - /* 3890 */ 2262, 2262, 2758, 2262, 877, 2262, 2262, 2262, 2262, 2262, - /* 3900 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, - /* 3910 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 879, 2262, 2262, - /* 3920 */ 2840, 2262, 2262, 2262, 427, 2794, 881, 2796, 2797, 876, - /* 3930 */ 2262, 2262, 864, 900, 2262, 2262, 2262, 2262, 2262, 2792, - /* 3940 */ 2262, 2262, 2840, 2262, 2262, 2262, 426, 2794, 881, 2796, - /* 3950 */ 2797, 876, 2262, 2262, 864, 900, -}; -static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 530, 397, 530, 397, 400, 401, 400, 401, 538, 433, - /* 10 */ 538, 418, 12, 13, 421, 12, 13, 14, 15, 16, - /* 20 */ 20, 0, 22, 450, 20, 427, 556, 557, 402, 557, - /* 30 */ 432, 561, 562, 561, 562, 427, 36, 464, 38, 0, - /* 40 */ 432, 388, 21, 470, 471, 24, 25, 26, 27, 28, - /* 50 */ 29, 30, 31, 32, 402, 403, 403, 459, 8, 9, - /* 60 */ 402, 403, 12, 13, 14, 15, 16, 459, 68, 21, - /* 70 */ 494, 71, 24, 25, 26, 27, 28, 29, 30, 31, - /* 80 */ 32, 20, 82, 8, 9, 432, 21, 12, 13, 14, - /* 90 */ 15, 16, 8, 9, 0, 20, 12, 13, 14, 15, - /* 100 */ 16, 448, 37, 450, 39, 40, 41, 42, 456, 402, - /* 110 */ 484, 485, 112, 20, 74, 115, 77, 78, 79, 80, - /* 120 */ 81, 68, 83, 84, 85, 86, 87, 88, 89, 90, - /* 130 */ 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, - /* 140 */ 101, 102, 103, 104, 105, 106, 107, 108, 495, 519, - /* 150 */ 520, 498, 152, 153, 403, 502, 503, 504, 505, 506, - /* 160 */ 507, 435, 435, 510, 511, 438, 116, 114, 461, 516, - /* 170 */ 463, 518, 119, 8, 9, 522, 523, 12, 13, 14, - /* 180 */ 15, 16, 388, 432, 526, 527, 528, 20, 530, 531, - /* 190 */ 3, 191, 192, 146, 147, 542, 538, 403, 151, 126, - /* 200 */ 116, 201, 202, 550, 0, 8, 9, 20, 115, 12, - /* 210 */ 13, 14, 15, 16, 556, 557, 216, 4, 218, 561, - /* 220 */ 562, 14, 44, 223, 498, 498, 432, 20, 24, 25, - /* 230 */ 26, 27, 28, 29, 30, 31, 32, 511, 511, 186, - /* 240 */ 75, 20, 448, 385, 450, 145, 146, 147, 148, 149, - /* 250 */ 150, 151, 252, 253, 254, 504, 256, 257, 258, 259, - /* 260 */ 260, 261, 262, 263, 264, 265, 266, 20, 193, 269, - /* 270 */ 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, - /* 280 */ 280, 281, 282, 12, 13, 14, 20, 388, 14, 495, - /* 290 */ 125, 20, 498, 22, 20, 20, 502, 503, 504, 505, - /* 300 */ 506, 507, 403, 116, 510, 511, 4, 36, 514, 38, - /* 310 */ 516, 517, 518, 116, 402, 403, 522, 523, 8, 9, - /* 320 */ 20, 19, 12, 13, 14, 15, 16, 530, 402, 254, - /* 330 */ 450, 432, 474, 155, 115, 538, 115, 479, 244, 68, - /* 340 */ 38, 155, 71, 33, 464, 20, 75, 448, 54, 450, - /* 350 */ 470, 471, 268, 82, 557, 190, 54, 63, 561, 562, - /* 360 */ 66, 67, 115, 61, 62, 435, 12, 13, 115, 398, - /* 370 */ 68, 402, 403, 402, 20, 404, 22, 252, 452, 453, - /* 380 */ 193, 455, 402, 112, 458, 4, 115, 0, 530, 4, - /* 390 */ 36, 422, 38, 532, 495, 534, 538, 498, 191, 430, - /* 400 */ 307, 502, 503, 504, 505, 506, 507, 508, 23, 510, - /* 410 */ 511, 512, 513, 0, 556, 557, 114, 117, 283, 561, - /* 420 */ 562, 119, 68, 152, 153, 71, 116, 446, 498, 75, - /* 430 */ 449, 450, 267, 48, 49, 50, 82, 525, 526, 527, - /* 440 */ 528, 511, 530, 531, 319, 320, 321, 322, 323, 324, - /* 450 */ 325, 286, 287, 288, 289, 290, 291, 292, 293, 294, - /* 460 */ 295, 254, 191, 192, 484, 485, 112, 20, 215, 115, - /* 470 */ 217, 115, 201, 202, 296, 297, 298, 299, 300, 301, - /* 480 */ 302, 303, 304, 297, 298, 299, 419, 216, 82, 218, - /* 490 */ 77, 78, 79, 412, 223, 432, 115, 84, 85, 86, - /* 500 */ 20, 420, 249, 90, 441, 442, 152, 153, 95, 96, - /* 510 */ 97, 98, 228, 36, 101, 448, 191, 192, 105, 106, - /* 520 */ 107, 108, 309, 252, 253, 254, 307, 256, 257, 258, - /* 530 */ 259, 260, 261, 262, 263, 264, 265, 266, 433, 434, - /* 540 */ 269, 270, 271, 272, 33, 191, 192, 276, 277, 278, - /* 550 */ 279, 280, 281, 282, 307, 201, 202, 402, 171, 82, - /* 560 */ 307, 41, 42, 176, 112, 498, 499, 500, 146, 155, - /* 570 */ 216, 184, 218, 431, 402, 403, 20, 223, 511, 127, - /* 580 */ 128, 129, 130, 131, 132, 133, 134, 135, 136, 447, - /* 590 */ 138, 139, 140, 141, 142, 143, 144, 8, 9, 152, - /* 600 */ 153, 12, 13, 14, 15, 16, 252, 253, 254, 126, - /* 610 */ 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, - /* 620 */ 266, 466, 467, 269, 270, 271, 272, 116, 501, 450, - /* 630 */ 276, 277, 278, 279, 280, 281, 282, 283, 12, 13, - /* 640 */ 36, 121, 122, 432, 124, 388, 20, 147, 22, 470, - /* 650 */ 471, 151, 196, 231, 232, 112, 529, 402, 403, 387, - /* 660 */ 403, 389, 36, 307, 38, 145, 382, 383, 384, 149, - /* 670 */ 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, - /* 680 */ 388, 138, 139, 140, 141, 142, 143, 144, 307, 432, - /* 690 */ 20, 388, 22, 20, 68, 403, 0, 71, 526, 527, - /* 700 */ 528, 75, 530, 531, 493, 448, 36, 450, 82, 432, - /* 710 */ 296, 297, 298, 299, 300, 301, 302, 303, 304, 402, - /* 720 */ 403, 12, 13, 14, 432, 225, 73, 419, 58, 20, - /* 730 */ 230, 22, 388, 233, 254, 235, 459, 14, 112, 422, - /* 740 */ 448, 115, 450, 20, 432, 36, 20, 38, 22, 193, - /* 750 */ 20, 448, 495, 441, 442, 498, 448, 402, 403, 502, - /* 760 */ 503, 504, 505, 506, 507, 13, 509, 510, 511, 313, - /* 770 */ 314, 315, 316, 402, 403, 402, 403, 68, 152, 153, - /* 780 */ 71, 526, 527, 528, 58, 530, 531, 495, 36, 474, - /* 790 */ 498, 82, 448, 422, 502, 503, 504, 505, 506, 507, - /* 800 */ 423, 430, 510, 511, 492, 493, 498, 499, 516, 432, - /* 810 */ 518, 456, 402, 403, 522, 523, 409, 191, 192, 511, - /* 820 */ 443, 112, 218, 74, 115, 152, 153, 201, 202, 456, - /* 830 */ 8, 9, 422, 426, 12, 13, 14, 15, 16, 77, - /* 840 */ 78, 79, 216, 436, 218, 530, 84, 85, 86, 223, - /* 850 */ 0, 155, 90, 538, 250, 251, 267, 95, 96, 97, - /* 860 */ 98, 152, 153, 101, 211, 474, 170, 105, 106, 107, - /* 870 */ 108, 556, 557, 20, 201, 202, 561, 562, 252, 253, - /* 880 */ 254, 411, 256, 257, 258, 259, 260, 261, 262, 263, - /* 890 */ 264, 265, 266, 240, 241, 269, 270, 271, 272, 429, - /* 900 */ 191, 192, 276, 277, 278, 279, 280, 281, 282, 439, - /* 910 */ 201, 202, 8, 9, 191, 433, 12, 13, 14, 15, - /* 920 */ 16, 530, 432, 193, 74, 216, 444, 218, 91, 538, - /* 930 */ 402, 403, 223, 398, 12, 13, 432, 402, 36, 404, - /* 940 */ 423, 474, 22, 22, 440, 432, 479, 556, 557, 432, - /* 950 */ 422, 47, 561, 562, 0, 451, 36, 36, 36, 388, - /* 960 */ 443, 252, 253, 254, 451, 256, 257, 258, 259, 260, - /* 970 */ 261, 262, 263, 264, 265, 266, 22, 254, 269, 270, - /* 980 */ 271, 272, 492, 493, 254, 276, 277, 278, 279, 280, - /* 990 */ 281, 282, 12, 13, 22, 388, 159, 530, 432, 283, - /* 1000 */ 20, 285, 22, 82, 388, 538, 440, 190, 36, 186, - /* 1010 */ 403, 300, 301, 302, 303, 304, 36, 451, 38, 448, - /* 1020 */ 116, 184, 185, 556, 557, 402, 403, 47, 561, 562, - /* 1030 */ 208, 388, 112, 112, 530, 198, 402, 403, 68, 432, - /* 1040 */ 449, 450, 538, 220, 388, 422, 193, 428, 68, 402, - /* 1050 */ 403, 71, 402, 403, 82, 448, 422, 450, 501, 403, - /* 1060 */ 556, 557, 82, 432, 448, 561, 562, 402, 403, 422, - /* 1070 */ 402, 403, 422, 402, 403, 12, 13, 402, 403, 34, - /* 1080 */ 402, 403, 451, 20, 267, 22, 529, 422, 432, 119, - /* 1090 */ 422, 448, 112, 422, 145, 115, 501, 422, 149, 36, - /* 1100 */ 422, 38, 495, 286, 448, 498, 450, 254, 489, 502, - /* 1110 */ 503, 504, 505, 506, 507, 402, 403, 510, 511, 432, - /* 1120 */ 218, 402, 403, 516, 529, 518, 388, 440, 13, 522, - /* 1130 */ 523, 68, 152, 153, 71, 422, 2, 216, 451, 218, - /* 1140 */ 218, 422, 8, 9, 432, 82, 12, 13, 14, 15, - /* 1150 */ 16, 495, 250, 251, 498, 443, 334, 550, 502, 503, - /* 1160 */ 504, 505, 506, 507, 59, 60, 510, 511, 14, 15, - /* 1170 */ 16, 191, 192, 252, 253, 112, 433, 20, 115, 402, - /* 1180 */ 403, 201, 202, 8, 9, 432, 448, 12, 13, 14, - /* 1190 */ 15, 16, 409, 440, 407, 408, 216, 82, 218, 422, - /* 1200 */ 407, 408, 433, 223, 451, 8, 9, 551, 552, 12, - /* 1210 */ 13, 14, 15, 16, 2, 152, 153, 388, 388, 436, - /* 1220 */ 8, 9, 1, 2, 12, 13, 14, 15, 16, 416, - /* 1230 */ 417, 424, 252, 253, 254, 428, 256, 257, 258, 259, - /* 1240 */ 260, 261, 262, 263, 264, 265, 266, 411, 388, 269, - /* 1250 */ 270, 271, 272, 33, 191, 192, 276, 277, 278, 279, - /* 1260 */ 280, 281, 282, 52, 201, 202, 8, 9, 402, 403, - /* 1270 */ 12, 13, 14, 15, 16, 439, 38, 448, 448, 216, - /* 1280 */ 0, 218, 515, 515, 517, 517, 223, 33, 422, 8, - /* 1290 */ 9, 116, 54, 12, 13, 14, 15, 16, 402, 403, - /* 1300 */ 433, 63, 64, 65, 66, 47, 68, 0, 448, 514, - /* 1310 */ 402, 403, 517, 116, 20, 252, 253, 254, 422, 256, - /* 1320 */ 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, - /* 1330 */ 422, 20, 269, 270, 271, 272, 116, 116, 388, 276, - /* 1340 */ 277, 278, 279, 280, 281, 282, 12, 13, 191, 388, - /* 1350 */ 22, 18, 114, 20, 20, 1, 22, 119, 3, 23, - /* 1360 */ 27, 8, 9, 30, 36, 12, 13, 14, 15, 16, - /* 1370 */ 36, 38, 38, 19, 8, 9, 402, 403, 12, 13, - /* 1380 */ 14, 15, 16, 402, 403, 49, 50, 54, 44, 56, - /* 1390 */ 402, 403, 38, 14, 61, 62, 422, 13, 448, 20, - /* 1400 */ 388, 388, 68, 422, 193, 71, 73, 53, 54, 448, - /* 1410 */ 422, 254, 68, 47, 388, 204, 82, 63, 64, 65, - /* 1420 */ 66, 388, 68, 388, 186, 145, 146, 147, 148, 149, - /* 1430 */ 150, 151, 432, 195, 416, 417, 445, 199, 200, 448, - /* 1440 */ 112, 433, 442, 205, 206, 33, 112, 114, 432, 115, - /* 1450 */ 391, 392, 145, 146, 147, 148, 149, 150, 151, 126, - /* 1460 */ 448, 448, 224, 388, 388, 0, 82, 451, 114, 116, - /* 1470 */ 388, 8, 9, 119, 448, 12, 13, 14, 15, 16, - /* 1480 */ 0, 448, 445, 448, 126, 448, 152, 153, 0, 33, - /* 1490 */ 157, 158, 33, 160, 161, 162, 163, 164, 165, 166, - /* 1500 */ 167, 168, 169, 47, 150, 172, 173, 174, 175, 176, - /* 1510 */ 177, 178, 179, 0, 181, 182, 183, 36, 0, 54, - /* 1520 */ 187, 188, 189, 448, 448, 191, 192, 194, 445, 33, - /* 1530 */ 448, 448, 44, 0, 120, 201, 202, 123, 180, 120, - /* 1540 */ 22, 120, 123, 47, 123, 13, 33, 0, 254, 195, - /* 1550 */ 216, 197, 218, 120, 200, 22, 123, 223, 234, 205, - /* 1560 */ 236, 33, 36, 82, 433, 254, 8, 9, 36, 22, - /* 1570 */ 12, 13, 14, 15, 16, 116, 51, 33, 224, 116, - /* 1580 */ 152, 153, 433, 33, 33, 331, 252, 253, 254, 480, - /* 1590 */ 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, - /* 1600 */ 266, 1, 2, 269, 270, 271, 272, 33, 82, 33, - /* 1610 */ 276, 277, 278, 279, 280, 281, 282, 18, 33, 8, - /* 1620 */ 9, 388, 23, 12, 13, 14, 15, 16, 420, 474, - /* 1630 */ 33, 12, 13, 389, 75, 155, 403, 33, 405, 33, - /* 1640 */ 115, 42, 43, 33, 116, 46, 33, 388, 36, 33, - /* 1650 */ 33, 33, 12, 13, 460, 532, 57, 12, 13, 474, - /* 1660 */ 116, 115, 403, 117, 405, 432, 116, 116, 69, 70, - /* 1670 */ 71, 72, 73, 565, 116, 33, 13, 12, 13, 12, - /* 1680 */ 13, 448, 36, 450, 329, 530, 554, 12, 13, 547, - /* 1690 */ 116, 432, 116, 538, 12, 13, 474, 12, 13, 36, - /* 1700 */ 533, 116, 33, 12, 13, 12, 13, 448, 406, 450, - /* 1710 */ 432, 556, 557, 116, 115, 530, 561, 562, 12, 13, - /* 1720 */ 116, 401, 116, 538, 419, 419, 116, 33, 495, 116, - /* 1730 */ 33, 498, 116, 116, 116, 502, 503, 504, 505, 506, - /* 1740 */ 507, 556, 557, 510, 511, 333, 561, 562, 33, 516, - /* 1750 */ 13, 518, 530, 154, 495, 522, 523, 498, 116, 388, - /* 1760 */ 538, 502, 503, 504, 505, 506, 507, 553, 33, 510, - /* 1770 */ 511, 33, 36, 36, 403, 516, 405, 518, 556, 557, - /* 1780 */ 553, 522, 523, 561, 562, 116, 460, 553, 473, 553, - /* 1790 */ 460, 406, 496, 403, 447, 481, 524, 460, 460, 537, - /* 1800 */ 537, 558, 460, 432, 193, 388, 0, 208, 209, 210, - /* 1810 */ 116, 252, 213, 116, 540, 421, 310, 54, 82, 448, - /* 1820 */ 403, 450, 405, 475, 497, 226, 227, 20, 402, 20, - /* 1830 */ 218, 116, 12, 13, 233, 388, 486, 491, 239, 214, - /* 1840 */ 411, 242, 22, 486, 245, 246, 247, 248, 249, 432, - /* 1850 */ 403, 116, 405, 411, 116, 477, 36, 402, 38, 20, - /* 1860 */ 403, 55, 47, 457, 218, 448, 495, 450, 457, 498, - /* 1870 */ 403, 190, 454, 502, 503, 504, 505, 506, 507, 432, - /* 1880 */ 402, 510, 511, 113, 457, 403, 388, 516, 68, 518, - /* 1890 */ 454, 402, 454, 522, 523, 448, 111, 450, 454, 415, - /* 1900 */ 414, 403, 82, 405, 402, 402, 307, 110, 413, 402, - /* 1910 */ 402, 402, 495, 20, 395, 498, 52, 395, 486, 502, - /* 1920 */ 503, 504, 505, 506, 507, 411, 399, 510, 511, 399, - /* 1930 */ 432, 411, 112, 516, 20, 518, 20, 450, 404, 522, - /* 1940 */ 523, 20, 495, 404, 476, 498, 448, 411, 450, 502, - /* 1950 */ 503, 504, 505, 506, 507, 20, 411, 510, 511, 411, - /* 1960 */ 467, 12, 13, 516, 411, 518, 20, 411, 411, 522, - /* 1970 */ 523, 22, 461, 402, 411, 395, 237, 391, 391, 402, - /* 1980 */ 490, 432, 115, 395, 432, 36, 432, 38, 448, 448, - /* 1990 */ 448, 486, 432, 495, 432, 388, 498, 432, 432, 432, - /* 2000 */ 502, 503, 504, 505, 506, 507, 20, 432, 510, 511, - /* 2010 */ 403, 432, 488, 432, 516, 222, 518, 68, 409, 221, - /* 2020 */ 522, 523, 485, 450, 409, 388, 483, 318, 402, 546, - /* 2030 */ 448, 317, 468, 326, 549, 207, 216, 482, 218, 432, - /* 2040 */ 403, 328, 548, 475, 327, 546, 468, 546, 306, 545, - /* 2050 */ 305, 311, 536, 335, 544, 448, 535, 450, 543, 388, - /* 2060 */ 332, 330, 403, 566, 475, 20, 126, 308, 539, 432, - /* 2070 */ 501, 559, 252, 253, 403, 409, 541, 560, 404, 409, - /* 2080 */ 448, 448, 468, 448, 448, 448, 448, 450, 468, 269, - /* 2090 */ 270, 199, 465, 409, 115, 448, 276, 277, 278, 279, - /* 2100 */ 280, 281, 495, 432, 461, 498, 448, 409, 199, 502, - /* 2110 */ 503, 504, 505, 506, 507, 521, 462, 510, 511, 448, - /* 2120 */ 409, 450, 461, 516, 428, 518, 403, 448, 409, 522, - /* 2130 */ 523, 448, 495, 115, 448, 498, 448, 448, 448, 502, - /* 2140 */ 503, 504, 505, 506, 507, 22, 388, 510, 511, 448, - /* 2150 */ 448, 448, 448, 516, 402, 518, 448, 390, 448, 522, - /* 2160 */ 523, 403, 437, 35, 448, 216, 495, 218, 448, 498, - /* 2170 */ 448, 409, 448, 502, 503, 504, 505, 506, 507, 393, - /* 2180 */ 448, 510, 511, 37, 394, 40, 494, 396, 410, 518, - /* 2190 */ 432, 448, 388, 522, 523, 448, 448, 448, 448, 250, - /* 2200 */ 251, 252, 448, 395, 478, 434, 448, 403, 450, 425, - /* 2210 */ 469, 434, 425, 469, 487, 386, 0, 425, 269, 270, - /* 2220 */ 0, 0, 388, 47, 0, 276, 277, 278, 279, 280, - /* 2230 */ 281, 36, 243, 36, 36, 36, 432, 403, 243, 0, - /* 2240 */ 36, 36, 243, 36, 0, 0, 243, 0, 36, 0, - /* 2250 */ 36, 0, 448, 495, 450, 22, 498, 238, 36, 0, - /* 2260 */ 502, 503, 504, 505, 506, 507, 432, 0, 510, 511, - /* 2270 */ 224, 0, 224, 218, 225, 216, 518, 0, 0, 0, - /* 2280 */ 522, 523, 448, 212, 450, 211, 388, 0, 0, 158, - /* 2290 */ 0, 51, 51, 0, 36, 0, 36, 54, 0, 495, - /* 2300 */ 0, 403, 498, 51, 0, 0, 502, 503, 504, 505, - /* 2310 */ 506, 507, 47, 388, 510, 511, 0, 51, 0, 0, - /* 2320 */ 0, 0, 518, 0, 0, 176, 522, 523, 403, 495, - /* 2330 */ 432, 0, 498, 36, 176, 0, 502, 503, 504, 505, - /* 2340 */ 506, 507, 0, 0, 510, 511, 448, 0, 450, 0, - /* 2350 */ 388, 0, 0, 0, 0, 0, 0, 432, 0, 0, - /* 2360 */ 0, 0, 0, 0, 0, 403, 51, 0, 0, 47, - /* 2370 */ 0, 0, 0, 448, 0, 450, 0, 0, 0, 0, - /* 2380 */ 0, 0, 0, 158, 0, 157, 0, 22, 156, 0, - /* 2390 */ 0, 22, 52, 495, 432, 22, 498, 563, 564, 388, - /* 2400 */ 502, 503, 504, 505, 506, 507, 0, 68, 510, 511, - /* 2410 */ 448, 0, 450, 68, 403, 0, 518, 0, 68, 36, - /* 2420 */ 495, 523, 0, 498, 0, 68, 0, 502, 503, 504, - /* 2430 */ 505, 506, 507, 36, 472, 510, 511, 52, 44, 36, - /* 2440 */ 44, 54, 54, 432, 0, 36, 54, 0, 388, 44, - /* 2450 */ 36, 0, 44, 33, 47, 51, 14, 495, 0, 448, - /* 2460 */ 498, 450, 44, 403, 502, 503, 504, 505, 506, 507, - /* 2470 */ 51, 0, 510, 511, 51, 45, 388, 552, 44, 207, - /* 2480 */ 0, 0, 51, 472, 0, 0, 0, 51, 0, 0, - /* 2490 */ 388, 403, 432, 0, 0, 36, 44, 76, 0, 54, - /* 2500 */ 36, 44, 54, 0, 36, 403, 495, 54, 448, 498, - /* 2510 */ 450, 44, 388, 502, 503, 504, 505, 506, 507, 0, - /* 2520 */ 432, 510, 511, 36, 54, 0, 44, 403, 0, 0, - /* 2530 */ 0, 0, 0, 36, 432, 125, 448, 22, 450, 123, - /* 2540 */ 0, 36, 22, 36, 36, 36, 36, 33, 36, 36, - /* 2550 */ 448, 0, 450, 36, 36, 495, 432, 33, 498, 36, - /* 2560 */ 22, 22, 502, 503, 504, 505, 506, 507, 0, 36, - /* 2570 */ 510, 511, 448, 36, 450, 22, 0, 22, 56, 0, - /* 2580 */ 22, 388, 36, 495, 0, 0, 498, 0, 36, 0, - /* 2590 */ 502, 503, 504, 505, 506, 507, 403, 495, 510, 511, - /* 2600 */ 498, 36, 0, 36, 502, 503, 504, 505, 506, 507, - /* 2610 */ 0, 20, 510, 511, 22, 555, 36, 388, 36, 495, - /* 2620 */ 116, 115, 498, 0, 36, 432, 502, 503, 504, 505, - /* 2630 */ 506, 507, 403, 193, 510, 511, 115, 513, 0, 193, - /* 2640 */ 228, 448, 229, 450, 51, 388, 22, 36, 223, 0, - /* 2650 */ 22, 219, 564, 193, 199, 0, 0, 203, 193, 193, - /* 2660 */ 403, 432, 3, 33, 203, 472, 116, 36, 36, 115, - /* 2670 */ 52, 115, 52, 116, 115, 113, 116, 448, 33, 450, - /* 2680 */ 111, 33, 116, 33, 51, 115, 115, 312, 495, 432, - /* 2690 */ 116, 498, 115, 51, 33, 502, 503, 504, 505, 506, - /* 2700 */ 507, 472, 116, 510, 511, 448, 33, 450, 82, 115, - /* 2710 */ 312, 115, 36, 116, 3, 116, 33, 36, 36, 116, - /* 2720 */ 36, 36, 36, 36, 495, 116, 388, 498, 51, 472, - /* 2730 */ 33, 502, 503, 504, 505, 506, 507, 296, 0, 510, - /* 2740 */ 511, 403, 51, 0, 115, 312, 44, 0, 44, 200, - /* 2750 */ 116, 116, 495, 0, 388, 498, 115, 196, 115, 502, - /* 2760 */ 503, 504, 505, 506, 507, 44, 115, 510, 511, 403, - /* 2770 */ 432, 113, 33, 116, 196, 115, 195, 113, 2, 284, - /* 2780 */ 22, 116, 115, 115, 115, 115, 448, 252, 450, 115, - /* 2790 */ 388, 116, 51, 115, 115, 51, 22, 255, 432, 0, - /* 2800 */ 196, 44, 0, 115, 115, 403, 116, 115, 115, 115, - /* 2810 */ 472, 116, 116, 115, 448, 115, 450, 22, 115, 118, - /* 2820 */ 51, 115, 117, 388, 115, 115, 22, 22, 116, 115, - /* 2830 */ 115, 22, 116, 495, 432, 229, 498, 36, 403, 126, - /* 2840 */ 502, 503, 504, 505, 506, 507, 36, 115, 510, 511, - /* 2850 */ 448, 116, 450, 36, 36, 115, 36, 36, 116, 36, - /* 2860 */ 137, 495, 116, 137, 498, 116, 388, 432, 502, 503, - /* 2870 */ 504, 505, 506, 507, 137, 116, 510, 511, 115, 33, - /* 2880 */ 115, 403, 137, 448, 36, 450, 115, 22, 76, 75, - /* 2890 */ 22, 36, 36, 36, 36, 36, 36, 495, 36, 388, - /* 2900 */ 498, 82, 36, 109, 502, 503, 504, 505, 506, 507, - /* 2910 */ 432, 36, 510, 511, 403, 36, 36, 82, 33, 36, - /* 2920 */ 109, 22, 36, 36, 36, 36, 448, 36, 450, 82, - /* 2930 */ 495, 36, 36, 498, 36, 22, 0, 502, 503, 504, - /* 2940 */ 505, 506, 507, 432, 36, 510, 511, 36, 36, 44, - /* 2950 */ 36, 54, 0, 36, 44, 54, 0, 36, 54, 448, - /* 2960 */ 44, 450, 0, 388, 36, 0, 44, 36, 0, 54, - /* 2970 */ 22, 36, 0, 495, 33, 22, 498, 22, 403, 36, - /* 2980 */ 502, 503, 504, 505, 506, 507, 388, 36, 510, 511, - /* 2990 */ 21, 567, 22, 22, 21, 20, 567, 567, 567, 567, - /* 3000 */ 567, 403, 567, 567, 567, 567, 495, 432, 567, 498, - /* 3010 */ 567, 567, 567, 502, 503, 504, 505, 506, 507, 567, - /* 3020 */ 567, 510, 511, 448, 567, 450, 567, 567, 567, 567, - /* 3030 */ 432, 567, 388, 567, 567, 567, 567, 567, 567, 567, - /* 3040 */ 567, 567, 567, 567, 567, 567, 448, 403, 450, 567, - /* 3050 */ 567, 567, 567, 567, 388, 567, 567, 567, 567, 567, - /* 3060 */ 567, 567, 567, 567, 567, 567, 567, 567, 388, 403, - /* 3070 */ 495, 567, 567, 498, 567, 567, 432, 502, 503, 504, - /* 3080 */ 505, 506, 507, 403, 567, 510, 511, 567, 567, 567, - /* 3090 */ 567, 567, 448, 495, 450, 567, 498, 567, 432, 567, - /* 3100 */ 502, 503, 504, 505, 506, 507, 567, 567, 510, 511, - /* 3110 */ 567, 567, 432, 567, 448, 567, 450, 567, 567, 567, - /* 3120 */ 567, 567, 567, 567, 567, 567, 567, 567, 448, 567, - /* 3130 */ 450, 567, 567, 567, 567, 567, 567, 567, 567, 495, - /* 3140 */ 567, 567, 498, 567, 388, 567, 502, 503, 504, 505, - /* 3150 */ 506, 507, 567, 567, 510, 511, 567, 567, 567, 403, - /* 3160 */ 567, 495, 567, 567, 498, 567, 567, 567, 502, 503, - /* 3170 */ 504, 505, 506, 507, 567, 495, 510, 511, 498, 388, - /* 3180 */ 567, 567, 502, 503, 504, 505, 506, 507, 432, 567, - /* 3190 */ 510, 511, 567, 567, 403, 567, 567, 567, 567, 567, - /* 3200 */ 567, 567, 567, 567, 448, 567, 450, 567, 567, 567, - /* 3210 */ 567, 567, 388, 567, 567, 567, 567, 567, 567, 567, - /* 3220 */ 567, 567, 567, 432, 567, 567, 567, 403, 567, 567, - /* 3230 */ 567, 567, 567, 567, 567, 567, 567, 567, 567, 448, - /* 3240 */ 567, 450, 567, 567, 567, 567, 567, 567, 567, 567, - /* 3250 */ 567, 495, 567, 567, 498, 388, 432, 567, 502, 503, - /* 3260 */ 504, 505, 506, 507, 567, 567, 510, 511, 567, 567, - /* 3270 */ 403, 567, 448, 567, 450, 567, 567, 567, 567, 567, - /* 3280 */ 567, 567, 567, 567, 567, 567, 495, 567, 388, 498, - /* 3290 */ 567, 567, 567, 502, 503, 504, 505, 506, 507, 432, - /* 3300 */ 567, 510, 511, 403, 567, 567, 567, 567, 567, 567, - /* 3310 */ 567, 567, 567, 567, 567, 448, 567, 450, 567, 495, - /* 3320 */ 567, 567, 498, 567, 567, 567, 502, 503, 504, 505, - /* 3330 */ 506, 507, 432, 567, 510, 511, 567, 567, 567, 567, - /* 3340 */ 567, 567, 567, 567, 567, 567, 567, 567, 448, 567, - /* 3350 */ 450, 567, 388, 567, 567, 567, 567, 567, 567, 567, - /* 3360 */ 567, 567, 495, 567, 567, 498, 567, 403, 567, 502, - /* 3370 */ 503, 504, 505, 506, 507, 388, 567, 510, 511, 567, - /* 3380 */ 567, 567, 567, 567, 567, 567, 567, 567, 567, 567, - /* 3390 */ 403, 567, 567, 567, 567, 495, 432, 567, 498, 567, - /* 3400 */ 567, 567, 502, 503, 504, 505, 506, 507, 567, 567, - /* 3410 */ 510, 511, 448, 567, 450, 567, 567, 567, 567, 432, - /* 3420 */ 567, 388, 567, 567, 567, 567, 567, 567, 567, 567, - /* 3430 */ 567, 567, 567, 567, 567, 448, 403, 450, 567, 567, - /* 3440 */ 567, 567, 567, 388, 567, 567, 567, 567, 567, 567, - /* 3450 */ 567, 567, 567, 567, 567, 567, 567, 388, 403, 495, - /* 3460 */ 567, 567, 498, 567, 567, 432, 502, 503, 504, 505, - /* 3470 */ 506, 507, 403, 567, 510, 511, 567, 567, 567, 567, - /* 3480 */ 567, 448, 495, 450, 567, 498, 567, 432, 567, 502, - /* 3490 */ 503, 504, 505, 506, 507, 567, 567, 510, 511, 567, - /* 3500 */ 567, 432, 567, 448, 567, 450, 567, 567, 567, 567, - /* 3510 */ 567, 567, 567, 567, 567, 567, 567, 448, 567, 450, - /* 3520 */ 567, 567, 567, 567, 567, 567, 567, 567, 495, 567, - /* 3530 */ 567, 498, 567, 388, 567, 502, 503, 504, 505, 506, - /* 3540 */ 507, 567, 567, 510, 511, 567, 567, 567, 403, 567, - /* 3550 */ 495, 567, 567, 498, 567, 567, 567, 502, 503, 504, - /* 3560 */ 505, 506, 507, 567, 495, 510, 511, 498, 388, 567, - /* 3570 */ 567, 502, 503, 504, 505, 506, 507, 432, 567, 510, - /* 3580 */ 511, 567, 567, 403, 567, 567, 567, 567, 567, 567, - /* 3590 */ 567, 567, 567, 448, 567, 450, 567, 567, 567, 567, - /* 3600 */ 567, 388, 567, 567, 567, 567, 567, 567, 567, 567, - /* 3610 */ 567, 567, 432, 567, 567, 567, 403, 567, 567, 567, - /* 3620 */ 567, 567, 567, 567, 567, 567, 567, 567, 448, 567, - /* 3630 */ 450, 567, 567, 567, 567, 567, 567, 567, 567, 567, - /* 3640 */ 495, 567, 567, 498, 388, 432, 567, 502, 503, 504, - /* 3650 */ 505, 506, 507, 567, 567, 510, 511, 567, 567, 403, - /* 3660 */ 567, 448, 567, 450, 567, 567, 567, 567, 567, 567, - /* 3670 */ 567, 567, 567, 567, 567, 495, 567, 388, 498, 567, - /* 3680 */ 567, 567, 502, 503, 504, 505, 506, 507, 432, 567, - /* 3690 */ 510, 511, 403, 567, 567, 567, 567, 567, 567, 567, - /* 3700 */ 567, 567, 567, 567, 448, 567, 450, 567, 495, 567, - /* 3710 */ 567, 498, 567, 567, 567, 502, 503, 504, 505, 506, - /* 3720 */ 507, 432, 567, 510, 511, 567, 567, 567, 567, 567, - /* 3730 */ 567, 567, 567, 567, 567, 567, 567, 448, 567, 450, - /* 3740 */ 567, 388, 567, 567, 567, 567, 567, 567, 567, 567, - /* 3750 */ 567, 495, 567, 567, 498, 567, 403, 567, 502, 503, - /* 3760 */ 504, 505, 506, 507, 388, 567, 510, 511, 567, 567, - /* 3770 */ 567, 567, 567, 567, 567, 567, 567, 567, 567, 403, - /* 3780 */ 567, 567, 567, 567, 495, 432, 567, 498, 567, 567, - /* 3790 */ 567, 502, 503, 504, 505, 506, 507, 567, 567, 510, - /* 3800 */ 511, 448, 567, 450, 567, 567, 567, 567, 432, 567, - /* 3810 */ 388, 567, 567, 567, 567, 567, 567, 567, 567, 567, - /* 3820 */ 567, 567, 567, 567, 448, 403, 450, 567, 567, 567, - /* 3830 */ 567, 567, 388, 567, 567, 567, 567, 567, 567, 567, - /* 3840 */ 567, 567, 567, 567, 567, 567, 567, 403, 495, 567, - /* 3850 */ 567, 498, 567, 567, 432, 502, 503, 504, 505, 506, - /* 3860 */ 507, 567, 567, 510, 511, 567, 567, 567, 567, 567, - /* 3870 */ 448, 495, 450, 567, 498, 567, 432, 567, 502, 503, - /* 3880 */ 504, 505, 506, 507, 567, 567, 510, 511, 567, 567, - /* 3890 */ 567, 567, 448, 567, 450, 567, 567, 567, 567, 567, - /* 3900 */ 567, 567, 567, 567, 567, 567, 567, 567, 567, 567, - /* 3910 */ 567, 567, 567, 567, 567, 567, 567, 495, 567, 567, - /* 3920 */ 498, 567, 567, 567, 502, 503, 504, 505, 506, 507, - /* 3930 */ 567, 567, 510, 511, 567, 567, 567, 567, 567, 495, - /* 3940 */ 567, 567, 498, 567, 567, 567, 502, 503, 504, 505, - /* 3950 */ 506, 507, 567, 567, 510, 511, 385, 385, 385, 385, - /* 3960 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 3970 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 3980 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 3990 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4000 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4010 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4020 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4030 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4040 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4050 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4060 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4070 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4080 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4090 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4100 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4110 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4120 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4130 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4140 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4150 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4160 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4170 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4180 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4190 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4200 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4210 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4220 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4230 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4240 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4250 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4260 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4270 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4280 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4290 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4300 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4310 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4320 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4330 */ 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, - /* 4340 */ 385, ->>>>>>> f143f5f1bcee3e814ef83fc3d942a3eab3c2417b + /* 4600 */ 386, 386, 386, 386, 386, 386, 386, 386, 386, 386, + /* 4610 */ 386, 386, 386, 386, 386, 386, 386, 386, 386, 386, + /* 4620 */ 386, 386, 386, 386, 386, 386, 386, 386, 386, 386, + /* 4630 */ 386, 386, 386, 386, 386, 386, 386, 386, 386, 386, + /* 4640 */ 386, 386, 386, 386, 386, 386, 386, 386, 386, 386, + /* 4650 */ 386, 386, 386, 386, 386, 386, 386, 386, 386, 386, + /* 4660 */ 386, 386, 386, 386, 386, 386, 386, 386, 386, 386, + /* 4670 */ 386, 386, }; #define YY_SHIFT_COUNT (1005) #define YY_SHIFT_MIN (0) -<<<<<<< HEAD -#define YY_SHIFT_MAX (2870) +#define YY_SHIFT_MAX (2891) static const unsigned short int yy_shift_ofst[] = { /* 0 */ 1604, 272, 355, 272, 628, 628, 628, 628, 628, 628, /* 10 */ 628, 628, 628, 628, 628, 628, 711, 1066, 1066, 1338, @@ -2360,105 +1518,105 @@ static const unsigned short int yy_shift_ofst[] = { /* 30 */ 1066, 983, 1066, 1066, 1066, 1066, 1066, 1066, 1066, 1066, /* 40 */ 1066, 1066, 1066, 1066, 1066, 1066, 1066, 1066, 1066, 1066, /* 50 */ 1066, 1066, 1066, 1066, 1066, 1066, 1066, 1066, 1066, 1066, - /* 60 */ 433, 476, 700, 129, 390, 401, 390, 390, 129, 129, - /* 70 */ 390, 1903, 390, 1337, 1903, 461, 390, 35, 2039, 675, - /* 80 */ 675, 284, 284, 2039, 2039, 161, 161, 675, 14, 14, - /* 90 */ 494, 72, 72, 40, 372, 284, 284, 284, 284, 284, - /* 100 */ 284, 284, 284, 284, 284, 284, 486, 521, 591, 284, - /* 110 */ 284, 549, 35, 284, 486, 284, 35, 284, 284, 284, - /* 120 */ 284, 35, 284, 284, 284, 35, 284, 35, 35, 35, - /* 130 */ 694, 307, 307, 545, 545, 623, 1202, 178, 334, 1330, + /* 60 */ 1066, 426, 433, 700, 35, 461, 516, 461, 461, 35, + /* 70 */ 35, 461, 1903, 461, 1337, 1903, 181, 461, 129, 2039, + /* 80 */ 675, 675, 134, 134, 2039, 2039, 161, 161, 675, 14, + /* 90 */ 14, 437, 50, 50, 142, 610, 134, 134, 134, 134, + /* 100 */ 134, 134, 134, 134, 134, 134, 134, 197, 269, 287, + /* 110 */ 134, 134, 265, 129, 134, 197, 134, 129, 134, 134, + /* 120 */ 134, 134, 129, 134, 134, 134, 129, 134, 129, 129, + /* 130 */ 129, 591, 307, 307, 545, 545, 623, 1202, 178, 334, /* 140 */ 1330, 1330, 1330, 1330, 1330, 1330, 1330, 1330, 1330, 1330, - /* 150 */ 1330, 1330, 1330, 1330, 1330, 1330, 1330, 1330, 687, 830, - /* 160 */ 14, 494, 765, 765, 712, 900, 900, 900, 553, 553, - /* 170 */ 932, 678, 712, 549, 35, 126, 35, 35, 661, 35, - /* 180 */ 35, 1344, 35, 1344, 1344, 1323, 924, 545, 545, 545, - /* 190 */ 545, 545, 545, 802, 414, 204, 552, 283, 283, 845, - /* 200 */ 820, 344, 366, 672, 101, 154, 438, 361, 361, 999, - /* 210 */ 786, 303, 303, 303, 1079, 303, 864, 832, 331, 391, - /* 220 */ 1056, 1282, 445, 681, 681, 1036, 1390, 1390, 1144, 1307, - /* 230 */ 876, 681, 678, 1510, 1771, 1808, 1814, 1605, 549, 1814, - /* 240 */ 549, 1634, 1808, 1842, 1817, 1842, 1817, 1680, 1808, 1842, - /* 250 */ 1808, 1817, 1680, 1680, 1680, 1777, 1782, 1808, 1808, 1791, - /* 260 */ 1808, 1808, 1808, 1889, 1859, 1889, 1859, 1814, 549, 549, - /* 270 */ 1902, 549, 1906, 1909, 549, 1906, 549, 1914, 549, 1918, - /* 280 */ 549, 549, 1808, 549, 1889, 35, 35, 35, 35, 35, - /* 290 */ 35, 35, 35, 35, 35, 35, 1808, 924, 924, 1889, - /* 300 */ 1344, 1344, 1344, 1705, 1858, 1814, 694, 1972, 1772, 1774, - /* 310 */ 1902, 694, 1510, 1808, 1344, 1683, 1682, 1683, 1682, 1693, - /* 320 */ 1815, 1683, 1696, 1718, 1733, 1510, 1742, 1747, 1722, 1729, - /* 330 */ 1732, 1842, 2045, 1940, 1758, 1906, 694, 694, 1682, 1344, - /* 340 */ 1344, 1344, 1344, 1682, 1344, 1884, 694, 1344, 1918, 694, - /* 350 */ 1974, 1344, 1892, 1918, 694, 1323, 694, 1842, 1344, 1344, - /* 360 */ 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - /* 370 */ 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - /* 380 */ 1993, 1344, 1808, 694, 2093, 2083, 2091, 2096, 1889, 4218, - /* 390 */ 4218, 4218, 4218, 4218, 4218, 4218, 4218, 4218, 4218, 4218, - /* 400 */ 4218, 39, 1511, 690, 982, 762, 1002, 1179, 1200, 1219, - /* 410 */ 2, 17, 34, 322, 1261, 1421, 1431, 1446, 1555, 910, - /* 420 */ 1239, 1487, 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, - /* 430 */ 1019, 271, 54, 232, 287, 1068, 1068, 317, 586, 9, - /* 440 */ 768, 118, 118, 15, 620, 696, 118, 314, 1041, 1088, - /* 450 */ 976, 976, 1136, 847, 1017, 1136, 1136, 1136, 342, 1379, - /* 460 */ 1391, 1408, 1436, 1363, 1301, 121, 1373, 1412, 1413, 1414, - /* 470 */ 1440, 1508, 1515, 429, 1523, 1538, 1550, 1229, 1524, 1526, - /* 480 */ 750, 1533, 1540, 1547, 1549, 1389, 1326, 1384, 1552, 1573, - /* 490 */ 1574, 1618, 1551, 1621, 853, 1622, 1647, 1466, 1668, 1669, - /* 500 */ 1674, 1690, 1691, 1575, 1577, 1600, 1616, 1659, 1666, 1670, - /* 510 */ 1672, 1679, 1681, 1686, 1699, 1717, 1743, 1744, 1745, 1750, - /* 520 */ 1542, 1578, 1609, 1617, 1695, 1759, 1721, 162, 2145, 2179, - /* 530 */ 2187, 2141, 2189, 2154, 1947, 2156, 2159, 2160, 1953, 2198, - /* 540 */ 2163, 2164, 1958, 2165, 2203, 2204, 1961, 2206, 2171, 2208, - /* 550 */ 2174, 2217, 2190, 2213, 2178, 1976, 2218, 1996, 2221, 1998, - /* 560 */ 2004, 2012, 2017, 2235, 2236, 2237, 2026, 2029, 2241, 2242, - /* 570 */ 2087, 2195, 2196, 2248, 2214, 2251, 2252, 2222, 2199, 2254, - /* 580 */ 2209, 2261, 2215, 2269, 2273, 2274, 2224, 2276, 2277, 2280, - /* 590 */ 2281, 2282, 2286, 2111, 2253, 2288, 2117, 2295, 2297, 2298, - /* 600 */ 2299, 2300, 2301, 2302, 2303, 2304, 2305, 2306, 2307, 2308, - /* 610 */ 2311, 2312, 2313, 2315, 2322, 2323, 2324, 2275, 2325, 2284, - /* 620 */ 2327, 2328, 2329, 2333, 2334, 2335, 2336, 2337, 2338, 2318, - /* 630 */ 2339, 2184, 2343, 2188, 2347, 2202, 2354, 2355, 2340, 2314, - /* 640 */ 2341, 2319, 2359, 2292, 2365, 2310, 2331, 2370, 2326, 2372, - /* 650 */ 2330, 2373, 2374, 2346, 2321, 2332, 2379, 2360, 2348, 2353, - /* 660 */ 2383, 2363, 2349, 2356, 2391, 2368, 2401, 2358, 2367, 2376, - /* 670 */ 2361, 2362, 2393, 2364, 2414, 2371, 2375, 2417, 2418, 2420, - /* 680 */ 2421, 2378, 2216, 2424, 2361, 2377, 2425, 2361, 2380, 2426, - /* 690 */ 2429, 2357, 2430, 2432, 2398, 2384, 2392, 2435, 2404, 2387, - /* 700 */ 2399, 2437, 2408, 2394, 2403, 2449, 2415, 2396, 2410, 2452, - /* 710 */ 2458, 2459, 2466, 2467, 2470, 2256, 2350, 2436, 2453, 2474, - /* 720 */ 2455, 2442, 2443, 2444, 2446, 2447, 2448, 2450, 2454, 2456, - /* 730 */ 2460, 2461, 2462, 2463, 2469, 2464, 2485, 2473, 2488, 2475, - /* 740 */ 2496, 2479, 2451, 2503, 2482, 2472, 2506, 2515, 2519, 2484, - /* 750 */ 2521, 2486, 2523, 2489, 2524, 2504, 2507, 2492, 2493, 2494, - /* 760 */ 2416, 2423, 2533, 2342, 2344, 2320, 2438, 2316, 2361, 2501, - /* 770 */ 2540, 2369, 2511, 2532, 2555, 2351, 2534, 2382, 2366, 2557, - /* 780 */ 2558, 2386, 2385, 2388, 2389, 2560, 2528, 2255, 2468, 2471, - /* 790 */ 2476, 2481, 2530, 2531, 2478, 2512, 2490, 2517, 2491, 2483, - /* 800 */ 2538, 2539, 2495, 2480, 2497, 2498, 2499, 2541, 2526, 2535, - /* 810 */ 2502, 2549, 2271, 2508, 2509, 2552, 2513, 2553, 2525, 2544, - /* 820 */ 2601, 2572, 2293, 2571, 2573, 2574, 2578, 2582, 2583, 2546, - /* 830 */ 2548, 2576, 2352, 2575, 2586, 2624, 2629, 2527, 2596, 2550, - /* 840 */ 2551, 2529, 2554, 2500, 2556, 2647, 2604, 2422, 2656, 2559, - /* 850 */ 2561, 2505, 2613, 2487, 2635, 2564, 2395, 2565, 2668, 2650, - /* 860 */ 2431, 2570, 2577, 2579, 2580, 2563, 2581, 2584, 2585, 2587, - /* 870 */ 2588, 2589, 2591, 2623, 2590, 2594, 2637, 2597, 2651, 2433, - /* 880 */ 2595, 2599, 2686, 2606, 2610, 2516, 2643, 2611, 2612, 2690, - /* 890 */ 2669, 2609, 2615, 2361, 2642, 2617, 2618, 2625, 2627, 2630, - /* 900 */ 2621, 2676, 2726, 2729, 2536, 2638, 2716, 2717, 2640, 2641, - /* 910 */ 2720, 2644, 2645, 2722, 2584, 2646, 2724, 2585, 2648, 2727, - /* 920 */ 2587, 2655, 2731, 2588, 2632, 2639, 2649, 2652, 2657, 2740, - /* 930 */ 2659, 2739, 2664, 2740, 2740, 2758, 2705, 2707, 2761, 2748, - /* 940 */ 2751, 2752, 2755, 2756, 2757, 2759, 2762, 2763, 2764, 2765, - /* 950 */ 2715, 2693, 2721, 2695, 2772, 2770, 2771, 2773, 2788, 2775, - /* 960 */ 2776, 2779, 2735, 2460, 2783, 2461, 2790, 2791, 2795, 2797, - /* 970 */ 2812, 2799, 2808, 2800, 2784, 2793, 2839, 2804, 2789, 2798, - /* 980 */ 2845, 2811, 2801, 2815, 2858, 2824, 2809, 2818, 2864, 2829, - /* 990 */ 2867, 2846, 2833, 2870, 2849, 2840, 2836, 2838, 2853, 2855, - /* 1000 */ 2856, 2857, 2861, 2863, + /* 150 */ 1330, 1330, 1330, 1330, 1330, 1330, 1330, 1330, 1330, 687, + /* 160 */ 369, 14, 437, 1017, 1017, 712, 1166, 1166, 1166, 555, + /* 170 */ 555, 884, 1142, 712, 265, 129, 565, 129, 129, 462, + /* 180 */ 129, 129, 736, 129, 736, 736, 827, 912, 545, 545, + /* 190 */ 545, 545, 545, 545, 802, 414, 204, 552, 283, 283, + /* 200 */ 845, 820, 344, 366, 672, 101, 154, 438, 724, 724, + /* 210 */ 999, 786, 85, 85, 85, 1079, 85, 682, 832, 1282, + /* 220 */ 852, 1452, 1343, 582, 449, 449, 1281, 1367, 1367, 1256, + /* 230 */ 1384, 1164, 449, 1142, 1507, 1767, 1803, 1805, 1602, 265, + /* 240 */ 1805, 265, 1646, 1803, 1841, 1816, 1841, 1816, 1686, 1803, + /* 250 */ 1841, 1803, 1816, 1686, 1686, 1686, 1778, 1786, 1803, 1803, + /* 260 */ 1798, 1803, 1803, 1803, 1890, 1866, 1890, 1866, 1805, 265, + /* 270 */ 265, 1909, 265, 1911, 1914, 265, 1911, 265, 1925, 265, + /* 280 */ 1933, 265, 265, 1803, 265, 1890, 129, 129, 129, 129, + /* 290 */ 129, 129, 129, 129, 129, 129, 129, 1803, 912, 912, + /* 300 */ 1890, 736, 736, 736, 1750, 1874, 1805, 591, 1989, 1788, + /* 310 */ 1793, 1909, 591, 1507, 1803, 736, 1707, 1714, 1707, 1714, + /* 320 */ 1706, 1838, 1707, 1727, 1729, 1746, 1507, 1756, 1758, 1730, + /* 330 */ 1732, 1740, 1841, 2052, 1947, 1770, 1911, 591, 591, 1714, + /* 340 */ 736, 736, 736, 736, 1714, 736, 1892, 591, 736, 1933, + /* 350 */ 591, 1980, 736, 1897, 1933, 591, 827, 591, 1841, 736, + /* 360 */ 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, + /* 370 */ 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, + /* 380 */ 736, 1996, 736, 1803, 591, 2095, 2085, 2092, 2096, 1890, + /* 390 */ 4286, 4286, 4286, 4286, 4286, 4286, 4286, 4286, 4286, 4286, + /* 400 */ 4286, 4286, 39, 1511, 690, 982, 762, 1002, 1179, 1200, + /* 410 */ 1219, 1261, 1421, 2, 17, 322, 1431, 1446, 1555, 1623, + /* 420 */ 1713, 910, 1239, 1644, 1019, 1019, 1019, 1019, 1019, 1019, + /* 430 */ 1019, 1019, 1019, 271, 54, 144, 896, 32, 32, 317, + /* 440 */ 586, 935, 768, 118, 118, 15, 620, 696, 118, 172, + /* 450 */ 1088, 1320, 460, 460, 413, 930, 1132, 413, 413, 413, + /* 460 */ 1467, 825, 812, 1483, 1391, 1363, 1379, 1517, 962, 1412, + /* 470 */ 1418, 1422, 1123, 24, 1114, 1296, 1522, 1533, 1551, 1191, + /* 480 */ 1436, 1443, 1439, 1490, 1524, 1539, 1547, 1429, 1196, 546, + /* 490 */ 1529, 1552, 1556, 1574, 1586, 1616, 1341, 1618, 1621, 1445, + /* 500 */ 1631, 1647, 1656, 1662, 1668, 1600, 1611, 1645, 1653, 1666, + /* 510 */ 1669, 1671, 1679, 1681, 1687, 1690, 1672, 1680, 1682, 1685, + /* 520 */ 1691, 1719, 1545, 1694, 1597, 1598, 1695, 1737, 1715, 451, + /* 530 */ 2196, 2197, 2198, 2152, 2200, 2165, 1958, 2167, 2168, 2169, + /* 540 */ 1962, 2207, 2172, 2174, 1968, 2177, 2214, 2215, 1973, 2218, + /* 550 */ 2184, 2221, 2186, 2229, 2208, 2233, 2199, 1997, 2237, 2014, + /* 560 */ 2240, 2017, 2020, 2024, 2030, 2247, 2248, 2250, 2040, 2042, + /* 570 */ 2251, 2254, 2100, 2209, 2210, 2262, 2238, 2269, 2273, 2239, + /* 580 */ 2222, 2277, 2230, 2280, 2235, 2286, 2287, 2288, 2242, 2289, + /* 590 */ 2295, 2297, 2298, 2299, 2300, 2125, 2266, 2303, 2128, 2305, + /* 600 */ 2306, 2307, 2308, 2311, 2312, 2313, 2315, 2322, 2323, 2324, + /* 610 */ 2325, 2326, 2327, 2328, 2329, 2331, 2333, 2334, 2335, 2285, + /* 620 */ 2337, 2291, 2339, 2340, 2342, 2343, 2347, 2354, 2355, 2358, + /* 630 */ 2359, 2338, 2362, 2187, 2363, 2213, 2365, 2211, 2366, 2371, + /* 640 */ 2350, 2321, 2352, 2330, 2375, 2310, 2376, 2332, 2360, 2379, + /* 650 */ 2336, 2383, 2341, 2391, 2394, 2361, 2344, 2357, 2399, 2367, + /* 660 */ 2348, 2368, 2405, 2377, 2353, 2370, 2411, 2380, 2415, 2372, + /* 670 */ 2373, 2385, 2369, 2374, 2407, 2378, 2422, 2386, 2384, 2423, + /* 680 */ 2424, 2426, 2430, 2388, 2226, 2434, 2369, 2387, 2435, 2369, + /* 690 */ 2389, 2436, 2437, 2390, 2441, 2443, 2408, 2393, 2404, 2449, + /* 700 */ 2414, 2397, 2410, 2452, 2431, 2416, 2428, 2458, 2438, 2419, + /* 710 */ 2433, 2459, 2475, 2478, 2479, 2480, 2482, 2256, 2392, 2447, + /* 720 */ 2462, 2485, 2464, 2454, 2455, 2456, 2460, 2461, 2463, 2465, + /* 730 */ 2467, 2468, 2473, 2474, 2472, 2483, 2466, 2484, 2493, 2476, + /* 740 */ 2494, 2499, 2495, 2500, 2444, 2523, 2502, 2489, 2526, 2527, + /* 750 */ 2528, 2496, 2529, 2497, 2530, 2503, 2535, 2516, 2520, 2511, + /* 760 */ 2512, 2517, 2439, 2442, 2552, 2382, 2356, 2346, 2446, 2349, + /* 770 */ 2369, 2505, 2554, 2395, 2522, 2540, 2563, 2351, 2543, 2396, + /* 780 */ 2398, 2564, 2566, 2400, 2364, 2402, 2401, 2565, 2536, 2258, + /* 790 */ 2469, 2470, 2487, 2471, 2537, 2541, 2488, 2531, 2486, 2538, + /* 800 */ 2481, 2490, 2546, 2548, 2491, 2498, 2504, 2507, 2492, 2549, + /* 810 */ 2558, 2559, 2509, 2572, 2278, 2532, 2501, 2578, 2510, 2576, + /* 820 */ 2513, 2521, 2612, 2585, 2314, 2592, 2604, 2605, 2606, 2608, + /* 830 */ 2611, 2533, 2544, 2597, 2403, 2623, 2613, 2657, 2662, 2551, + /* 840 */ 2624, 2553, 2555, 2557, 2560, 2506, 2561, 2667, 2626, 2514, + /* 850 */ 2673, 2562, 2567, 2508, 2630, 2515, 2644, 2571, 2406, 2573, + /* 860 */ 2677, 2658, 2432, 2574, 2575, 2577, 2579, 2580, 2581, 2583, + /* 870 */ 2584, 2586, 2588, 2590, 2591, 2637, 2594, 2598, 2642, 2596, + /* 880 */ 2665, 2518, 2607, 2610, 2695, 2614, 2617, 2545, 2682, 2618, + /* 890 */ 2625, 2727, 2707, 2627, 2632, 2369, 2697, 2638, 2639, 2635, + /* 900 */ 2640, 2641, 2631, 2730, 2736, 2737, 2534, 2645, 2724, 2726, + /* 910 */ 2649, 2651, 2729, 2654, 2655, 2739, 2583, 2656, 2740, 2584, + /* 920 */ 2663, 2744, 2586, 2666, 2745, 2588, 2646, 2647, 2650, 2652, + /* 930 */ 2671, 2755, 2676, 2756, 2678, 2755, 2755, 2751, 2719, 2722, + /* 940 */ 2776, 2763, 2764, 2765, 2766, 2767, 2768, 2769, 2770, 2771, + /* 950 */ 2772, 2773, 2728, 2702, 2733, 2703, 2784, 2783, 2790, 2791, + /* 960 */ 2809, 2797, 2798, 2799, 2754, 2473, 2801, 2474, 2802, 2803, + /* 970 */ 2804, 2806, 2821, 2811, 2845, 2819, 2805, 2816, 2858, 2826, + /* 980 */ 2810, 2823, 2863, 2829, 2815, 2824, 2870, 2835, 2818, 2830, + /* 990 */ 2873, 2839, 2876, 2856, 2843, 2891, 2860, 2861, 2847, 2859, + /* 1000 */ 2874, 2877, 2875, 2878, 2880, 2879, }; -#define YY_REDUCE_COUNT (400) -#define YY_REDUCE_MIN (-474) -#define YY_REDUCE_MAX (3705) +#define YY_REDUCE_COUNT (401) +#define YY_REDUCE_MIN (-531) +#define YY_REDUCE_MAX (3773) static const short yy_reduce_ofst[] = { /* 0 */ 399, -348, -206, 609, 1237, 1263, 1375, 1451, 1500, 1531, /* 10 */ -63, 293, 1627, 1720, 1760, 1845, -101, 658, 1881, 1957, @@ -2466,398 +1624,144 @@ static const short yy_reduce_ofst[] = { /* 30 */ 2457, 2477, 2542, 2622, 2636, 2653, 2718, 2786, 2814, 2850, /* 40 */ 2882, 2947, 2970, 3012, 3058, 3123, 3140, 3191, 3272, 3300, /* 50 */ 3321, 3397, 3446, 3474, 3510, 3623, 3637, 3662, 3688, 3705, - /* 60 */ -350, -343, -474, 540, -452, 1164, 1189, 1234, -290, 259, - /* 70 */ 1280, 143, 640, -395, 455, -182, -45, -243, -436, -444, - /* 80 */ -399, -323, -237, -84, -65, -324, -74, -427, -393, 274, - /* 90 */ 202, 442, 532, 547, 166, 201, 439, 536, 634, -231, - /* 100 */ 120, 636, 671, 726, 735, 642, 227, -398, 242, 773, - /* 110 */ 801, 743, 596, 890, 411, 911, -2, 938, 969, 977, - /* 120 */ 979, -137, 991, 993, 1015, 508, 1018, 294, 659, 509, - /* 130 */ -240, -252, -252, 172, -40, -383, -314, -431, -99, -352, - /* 140 */ 38, 262, 424, 615, 841, 862, 863, 907, 913, 916, - /* 150 */ 964, 1016, 1022, 1026, 1039, 1043, 1059, 1078, -208, -281, - /* 160 */ -104, 288, 759, 781, 804, -281, -158, 60, 469, 707, - /* 170 */ 336, 590, 951, 685, 567, 595, 141, 350, 641, 873, - /* 180 */ 739, 771, 826, 780, 955, 893, 978, -432, 1023, 1121, - /* 190 */ 1124, 1152, 1160, 1097, 1210, 1233, 1183, 1115, 1115, 1096, - /* 200 */ 1111, 1133, 1153, 1293, 1115, 1271, 1271, 1285, 1295, 1311, - /* 210 */ 1264, 1175, 1176, 1185, 1279, 1235, 1271, 1327, 1386, 1297, - /* 220 */ 1394, 1351, 1318, 1340, 1341, 1271, 1266, 1267, 1250, 1291, - /* 230 */ 1269, 1357, 1398, 1346, 1331, 1429, 1349, 1353, 1434, 1354, - /* 240 */ 1437, 1378, 1455, 1459, 1407, 1463, 1410, 1417, 1470, 1465, - /* 250 */ 1472, 1418, 1422, 1430, 1433, 1475, 1480, 1493, 1494, 1489, - /* 260 */ 1502, 1504, 1505, 1514, 1513, 1518, 1517, 1432, 1506, 1509, - /* 270 */ 1473, 1516, 1522, 1453, 1519, 1527, 1528, 1468, 1530, 1461, - /* 280 */ 1532, 1534, 1545, 1541, 1556, 1512, 1536, 1539, 1543, 1544, - /* 290 */ 1546, 1548, 1553, 1554, 1557, 1558, 1562, 1568, 1569, 1570, - /* 300 */ 1529, 1535, 1560, 1476, 1499, 1496, 1579, 1507, 1537, 1561, - /* 310 */ 1559, 1587, 1525, 1595, 1564, 1467, 1563, 1471, 1571, 1478, - /* 320 */ 1477, 1482, 1495, 1488, 1503, 1580, 1520, 1565, 1492, 1521, - /* 330 */ 1567, 1660, 1566, 1572, 1576, 1664, 1661, 1662, 1601, 1624, - /* 340 */ 1625, 1630, 1631, 1612, 1635, 1619, 1676, 1638, 1626, 1684, - /* 350 */ 1581, 1641, 1629, 1633, 1687, 1667, 1688, 1689, 1650, 1651, - /* 360 */ 1653, 1655, 1656, 1657, 1663, 1671, 1673, 1692, 1694, 1698, - /* 370 */ 1703, 1706, 1709, 1710, 1711, 1712, 1713, 1714, 1716, 1719, - /* 380 */ 1675, 1723, 1707, 1701, 1726, 1731, 1734, 1740, 1746, 1697, - /* 390 */ 1735, 1645, 1678, 1708, 1724, 1728, 1741, 1751, 1749, 1737, - /* 400 */ 1790, -}; -static const YYACTIONTYPE yy_default[] = { - /* 0 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, - /* 10 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, - /* 20 */ 2845, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, - /* 30 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, - /* 40 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, - /* 50 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, - /* 60 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, - /* 70 */ 2634, 2259, 2259, 2590, 2259, 2259, 2259, 2259, 2259, 2259, - /* 80 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2597, 2597, - /* 90 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, - /* 100 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, - /* 110 */ 2259, 2365, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, - /* 120 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, - /* 130 */ 2363, 2902, 2259, 3028, 2675, 2259, 2259, 2931, 2259, 2259, - /* 140 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, - /* 150 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2914, - /* 160 */ 2259, 2259, 2336, 2336, 2259, 2914, 2914, 2914, 2874, 2874, - /* 170 */ 2363, 2259, 2259, 2365, 2259, 2677, 2259, 2259, 2259, 2259, - /* 180 */ 2259, 2259, 2259, 2259, 2259, 2506, 2289, 2259, 2259, 2259, - /* 190 */ 2259, 2259, 2259, 2660, 2259, 2259, 2960, 2906, 2907, 3022, - /* 200 */ 2259, 2963, 2925, 2259, 2920, 2259, 2259, 2259, 2259, 2259, - /* 210 */ 2950, 2259, 2259, 2259, 2259, 2259, 2259, 2602, 2259, 2704, - /* 220 */ 2259, 2451, 2654, 2259, 2259, 2259, 2259, 2259, 3006, 2904, - /* 230 */ 2944, 2259, 2259, 2954, 2259, 2259, 2259, 2692, 2365, 2259, - /* 240 */ 2365, 2647, 2585, 2259, 2595, 2259, 2595, 2592, 2259, 2259, - /* 250 */ 2259, 2595, 2592, 2592, 2592, 2439, 2435, 2259, 2259, 2433, - /* 260 */ 2259, 2259, 2259, 2259, 2319, 2259, 2319, 2259, 2365, 2365, - /* 270 */ 2259, 2365, 2259, 2259, 2365, 2259, 2365, 2259, 2365, 2259, - /* 280 */ 2365, 2365, 2259, 2365, 2259, 2259, 2259, 2259, 2259, 2259, - /* 290 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, - /* 300 */ 2259, 2259, 2259, 2690, 2670, 2259, 2363, 2259, 2658, 2656, - /* 310 */ 2259, 2363, 2954, 2259, 2259, 2976, 2971, 2976, 2971, 2990, - /* 320 */ 2986, 2976, 2995, 2992, 2956, 2954, 2937, 2933, 3025, 3012, - /* 330 */ 3008, 2259, 2259, 2942, 2940, 2259, 2363, 2363, 2971, 2259, - /* 340 */ 2259, 2259, 2259, 2971, 2259, 2259, 2363, 2259, 2259, 2363, - /* 350 */ 2259, 2259, 2259, 2259, 2363, 2259, 2363, 2259, 2259, 2259, - /* 360 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, - /* 370 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, - /* 380 */ 2468, 2259, 2259, 2363, 2259, 2291, 2293, 2303, 2259, 2649, - /* 390 */ 3028, 2675, 2680, 2630, 2630, 2509, 2509, 3028, 2509, 2366, - /* 400 */ 2264, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, - /* 410 */ 2259, 2259, 2259, 2809, 2259, 2259, 2259, 2259, 2259, 2259, - /* 420 */ 2259, 2259, 2989, 2988, 2810, 2259, 2878, 2877, 2876, 2867, - /* 430 */ 2809, 2464, 2259, 2259, 2259, 2808, 2807, 2259, 2259, 2259, - /* 440 */ 2259, 2455, 2452, 2259, 2259, 2259, 2477, 2259, 2259, 2259, - /* 450 */ 2621, 2620, 2801, 2259, 2259, 2802, 2800, 2799, 2259, 2259, - /* 460 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, - /* 470 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, - /* 480 */ 2259, 2259, 2259, 2259, 2259, 2259, 3009, 3013, 2259, 2259, - /* 490 */ 2259, 2259, 2903, 2259, 2259, 2259, 2259, 2780, 2259, 2259, - /* 500 */ 2259, 2259, 2259, 2748, 2743, 2734, 2725, 2740, 2731, 2719, - /* 510 */ 2737, 2728, 2716, 2713, 2259, 2259, 2259, 2259, 2259, 2259, - /* 520 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, - /* 530 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, - /* 540 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, - /* 550 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, - /* 560 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, - /* 570 */ 2591, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, - /* 580 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, - /* 590 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, - /* 600 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, - /* 610 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, - /* 620 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, - /* 630 */ 2259, 2259, 2259, 2259, 2259, 2606, 2259, 2259, 2259, 2259, - /* 640 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, - /* 650 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, - /* 660 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2308, - /* 670 */ 2787, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, - /* 680 */ 2259, 2259, 2259, 2259, 2790, 2259, 2259, 2791, 2259, 2259, - /* 690 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, - /* 700 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, - /* 710 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, - /* 720 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, - /* 730 */ 2410, 2409, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, - /* 740 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, - /* 750 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, - /* 760 */ 2792, 2259, 2259, 2259, 2259, 2674, 2259, 2259, 2782, 2259, - /* 770 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, - /* 780 */ 2259, 2259, 2259, 2259, 2259, 3005, 2957, 2259, 2259, 2259, - /* 790 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, - /* 800 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2780, - /* 810 */ 2259, 2987, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 3003, - /* 820 */ 2259, 3007, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2913, - /* 830 */ 2909, 2259, 2259, 2905, 2259, 2259, 2259, 2259, 2259, 2259, - /* 840 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, - /* 850 */ 2259, 2259, 2259, 2259, 2864, 2259, 2259, 2259, 2898, 2259, - /* 860 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2505, 2504, 2503, - /* 870 */ 2502, 2259, 2259, 2259, 2259, 2259, 2259, 2792, 2259, 2795, - /* 880 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, - /* 890 */ 2259, 2259, 2259, 2779, 2259, 2842, 2841, 2259, 2259, 2259, - /* 900 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2499, 2259, - /* 910 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, - /* 920 */ 2259, 2259, 2259, 2259, 2483, 2481, 2480, 2479, 2259, 2516, - /* 930 */ 2259, 2259, 2259, 2512, 2511, 2259, 2259, 2259, 2259, 2259, - /* 940 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, - /* 950 */ 2259, 2259, 2259, 2259, 2384, 2259, 2259, 2259, 2259, 2259, - /* 960 */ 2259, 2259, 2259, 2376, 2259, 2375, 2259, 2259, 2259, 2259, - /* 970 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, - /* 980 */ 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, - /* 990 */ 2259, 2259, 2259, 2259, 2259, 2288, 2259, 2259, 2259, 2259, - /* 1000 */ 2259, 2259, 2259, 2259, -======= -#define YY_SHIFT_MAX (2975) -static const unsigned short int yy_shift_ofst[] = { - /* 0 */ 1599, 271, 354, 271, 626, 626, 626, 626, 626, 626, - /* 10 */ 626, 626, 626, 626, 626, 626, 709, 1063, 1063, 1334, - /* 20 */ 0, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, - /* 30 */ 1063, 980, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, - /* 40 */ 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, - /* 50 */ 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, - /* 60 */ 1063, 93, 247, 253, 221, 219, 356, 219, 219, 221, - /* 70 */ 221, 219, 1820, 219, 1333, 1820, 381, 219, 4, 1949, - /* 80 */ 673, 673, 61, 61, 1949, 1949, 385, 385, 673, 325, - /* 90 */ 325, 447, 274, 274, 480, 300, 61, 61, 61, 61, - /* 100 */ 61, 61, 61, 61, 61, 61, 61, 167, 266, 275, - /* 110 */ 61, 61, 40, 4, 61, 167, 61, 4, 61, 61, - /* 120 */ 61, 61, 4, 61, 61, 61, 4, 61, 4, 4, - /* 130 */ 4, 749, 165, 165, 452, 452, 543, 762, 178, 48, - /* 140 */ 921, 921, 921, 921, 921, 921, 921, 921, 921, 921, - /* 150 */ 921, 921, 921, 921, 921, 921, 921, 921, 921, 520, - /* 160 */ 187, 325, 447, 1105, 1105, 477, 556, 556, 556, 716, - /* 170 */ 716, 850, 1115, 477, 40, 4, 73, 4, 4, 135, - /* 180 */ 4, 4, 406, 4, 406, 406, 483, 1045, 452, 452, - /* 190 */ 452, 452, 452, 452, 1354, 413, 21, 75, 414, 414, - /* 200 */ 822, 125, 456, 711, 670, 186, 207, 723, 922, 922, - /* 210 */ 1336, 730, 972, 972, 972, 1211, 972, 1157, 853, 726, - /* 220 */ 1344, 1379, 949, 823, 1294, 1294, 1311, 1384, 1384, 1355, - /* 230 */ 1456, 213, 1294, 1115, 1506, 1763, 1807, 1809, 1601, 40, - /* 240 */ 1809, 40, 1625, 1807, 1839, 1815, 1839, 1815, 1681, 1807, - /* 250 */ 1839, 1807, 1815, 1681, 1681, 1681, 1770, 1785, 1807, 1807, - /* 260 */ 1797, 1807, 1807, 1807, 1893, 1864, 1893, 1864, 1809, 40, - /* 270 */ 40, 1914, 40, 1916, 1921, 40, 1916, 40, 1935, 40, - /* 280 */ 1946, 40, 40, 1807, 40, 1893, 4, 4, 4, 4, - /* 290 */ 4, 4, 4, 4, 4, 4, 4, 1807, 1045, 1045, - /* 300 */ 1893, 406, 406, 406, 1739, 1867, 1809, 749, 1986, 1793, - /* 310 */ 1798, 1914, 749, 1506, 1807, 406, 1709, 1714, 1709, 1714, - /* 320 */ 1707, 1828, 1709, 1713, 1717, 1740, 1506, 1742, 1745, 1718, - /* 330 */ 1728, 1731, 1839, 2045, 1940, 1759, 1916, 749, 749, 1714, - /* 340 */ 406, 406, 406, 406, 1714, 406, 1892, 749, 406, 1946, - /* 350 */ 749, 1979, 406, 1909, 1946, 749, 483, 749, 1839, 406, - /* 360 */ 406, 406, 406, 406, 406, 406, 406, 406, 406, 406, - /* 370 */ 406, 406, 406, 406, 406, 406, 406, 406, 406, 406, - /* 380 */ 406, 2018, 406, 1807, 749, 2123, 2128, 2146, 2145, 1893, - /* 390 */ 3956, 3956, 3956, 3956, 3956, 3956, 3956, 3956, 3956, 3956, - /* 400 */ 3956, 3956, 39, 1238, 204, 302, 310, 84, 904, 50, - /* 410 */ 197, 1175, 1197, 1258, 1134, 1212, 1353, 1366, 1463, 1558, - /* 420 */ 589, 1611, 1280, 1307, 1281, 1281, 1281, 1281, 1281, 1281, - /* 430 */ 1281, 1281, 1281, 100, 65, 500, 837, 3, 3, 653, - /* 440 */ 53, 387, 294, 284, 284, 604, 902, 284, 696, 920, - /* 450 */ 1328, 422, 47, 47, 1154, 1221, 817, 1154, 1154, 1154, - /* 460 */ 1465, 94, 511, 1488, 1496, 1358, 1480, 1513, 1414, 1419, - /* 470 */ 1421, 1433, 1481, 752, 1532, 954, 1518, 1533, 1547, 1324, - /* 480 */ 1220, 1459, 970, 1528, 1544, 1550, 1551, 1428, 1254, 1412, - /* 490 */ 1574, 1576, 1585, 1597, 1600, 1604, 1559, 1606, 1610, 1525, - /* 500 */ 1613, 1616, 1617, 1618, 1642, 1619, 1640, 1645, 1665, 1667, - /* 510 */ 1675, 1682, 1685, 1691, 1693, 1706, 1669, 1694, 1697, 1715, - /* 520 */ 1735, 1738, 1546, 1526, 1612, 1646, 1663, 1737, 1736, 1806, - /* 530 */ 2216, 2220, 2221, 2176, 2224, 2195, 1989, 2197, 2198, 2199, - /* 540 */ 1995, 2239, 2204, 2205, 1999, 2207, 2244, 2245, 2003, 2247, - /* 550 */ 2212, 2249, 2214, 2251, 2233, 2267, 2222, 2019, 2259, 2046, - /* 560 */ 2271, 2048, 2049, 2055, 2059, 2277, 2278, 2279, 2071, 2074, - /* 570 */ 2287, 2288, 2131, 2240, 2241, 2290, 2258, 2293, 2295, 2260, - /* 580 */ 2243, 2298, 2252, 2300, 2265, 2304, 2305, 2316, 2266, 2318, - /* 590 */ 2319, 2320, 2321, 2323, 2324, 2149, 2297, 2331, 2158, 2335, - /* 600 */ 2342, 2343, 2347, 2349, 2351, 2352, 2353, 2354, 2355, 2356, - /* 610 */ 2358, 2359, 2360, 2361, 2362, 2363, 2364, 2374, 2376, 2315, - /* 620 */ 2367, 2322, 2368, 2370, 2371, 2372, 2377, 2378, 2379, 2380, - /* 630 */ 2381, 2365, 2382, 2225, 2384, 2228, 2386, 2232, 2389, 2390, - /* 640 */ 2369, 2340, 2373, 2385, 2406, 2339, 2411, 2345, 2383, 2415, - /* 650 */ 2350, 2417, 2357, 2422, 2424, 2397, 2387, 2394, 2426, 2403, - /* 660 */ 2388, 2396, 2444, 2409, 2392, 2405, 2447, 2414, 2451, 2407, - /* 670 */ 2408, 2420, 2404, 2419, 2442, 2423, 2458, 2430, 2418, 2471, - /* 680 */ 2484, 2485, 2486, 2434, 2272, 2480, 2404, 2431, 2481, 2404, - /* 690 */ 2436, 2488, 2489, 2421, 2493, 2494, 2459, 2445, 2452, 2498, - /* 700 */ 2464, 2448, 2457, 2503, 2468, 2453, 2467, 2519, 2487, 2470, - /* 710 */ 2482, 2525, 2528, 2529, 2530, 2531, 2532, 2410, 2416, 2497, - /* 720 */ 2515, 2540, 2520, 2505, 2507, 2508, 2509, 2510, 2512, 2513, - /* 730 */ 2517, 2518, 2514, 2524, 2523, 2533, 2538, 2537, 2551, 2539, - /* 740 */ 2568, 2553, 2576, 2555, 2522, 2579, 2558, 2546, 2584, 2585, - /* 750 */ 2587, 2552, 2589, 2565, 2602, 2567, 2610, 2592, 2591, 2580, - /* 760 */ 2582, 2588, 2504, 2506, 2623, 2440, 2413, 2412, 2521, 2425, - /* 770 */ 2404, 2593, 2638, 2446, 2611, 2624, 2649, 2432, 2628, 2460, - /* 780 */ 2455, 2655, 2656, 2465, 2454, 2466, 2461, 2659, 2630, 2375, - /* 790 */ 2554, 2550, 2556, 2557, 2631, 2632, 2559, 2618, 2562, 2620, - /* 800 */ 2569, 2560, 2645, 2648, 2566, 2570, 2571, 2577, 2574, 2650, - /* 810 */ 2633, 2642, 2594, 2661, 2398, 2626, 2586, 2673, 2596, 2676, - /* 820 */ 2597, 2599, 2711, 2683, 2433, 2681, 2682, 2684, 2685, 2686, - /* 830 */ 2687, 2603, 2609, 2677, 2441, 2697, 2691, 2738, 2743, 2629, - /* 840 */ 2702, 2634, 2635, 2641, 2643, 2561, 2651, 2747, 2704, 2549, - /* 850 */ 2753, 2657, 2660, 2578, 2721, 2581, 2739, 2658, 2495, 2664, - /* 860 */ 2776, 2758, 2535, 2667, 2668, 2669, 2670, 2665, 2675, 2674, - /* 870 */ 2678, 2679, 2688, 2689, 2690, 2741, 2692, 2693, 2744, 2695, - /* 880 */ 2774, 2542, 2694, 2698, 2799, 2696, 2700, 2604, 2757, 2703, - /* 890 */ 2705, 2802, 2795, 2701, 2706, 2404, 2769, 2709, 2710, 2712, - /* 900 */ 2714, 2715, 2713, 2804, 2805, 2809, 2606, 2716, 2801, 2810, - /* 910 */ 2732, 2735, 2817, 2740, 2742, 2818, 2674, 2746, 2820, 2678, - /* 920 */ 2749, 2821, 2679, 2759, 2823, 2688, 2723, 2726, 2737, 2745, - /* 930 */ 2763, 2846, 2765, 2848, 2771, 2846, 2846, 2865, 2812, 2814, - /* 940 */ 2868, 2855, 2856, 2857, 2858, 2859, 2860, 2862, 2866, 2875, - /* 950 */ 2879, 2880, 2819, 2794, 2835, 2811, 2885, 2883, 2886, 2887, - /* 960 */ 2899, 2888, 2889, 2891, 2847, 2514, 2895, 2524, 2896, 2898, - /* 970 */ 2908, 2911, 2913, 2912, 2936, 2914, 2897, 2905, 2952, 2917, - /* 980 */ 2901, 2910, 2956, 2921, 2904, 2916, 2962, 2928, 2915, 2922, - /* 990 */ 2965, 2931, 2968, 2948, 2935, 2972, 2953, 2941, 2943, 2951, - /* 1000 */ 2955, 2969, 2970, 2971, 2973, 2975, -}; -#define YY_REDUCE_COUNT (401) -#define YY_REDUCE_MIN (-530) -#define YY_REDUCE_MAX (3444) -static const short yy_reduce_ofst[] = { - /* 0 */ -142, -347, -206, 607, 1233, 1259, 1371, 1417, 1447, 1498, - /* 10 */ 292, 1607, 1637, 1671, 1758, 1804, -101, 656, 1834, 1898, - /* 20 */ 257, 1925, 1962, 2011, 2060, 2088, 2124, 2193, 2229, 2257, - /* 30 */ 2338, 2102, 2366, 2402, 2435, 2478, 2511, 2575, 2598, 2644, - /* 40 */ 2666, 2680, 2756, 2791, 2824, 2867, 2900, 2964, 2987, 3033, - /* 50 */ 3055, 3069, 3145, 3180, 3213, 3256, 3289, 3353, 3376, 3422, - /* 60 */ 3444, -342, 504, 467, -88, 315, 391, 1155, 1185, 172, - /* 70 */ 255, 1222, 67, -530, -74, 308, -528, -203, 312, -273, - /* 80 */ -427, -120, -31, 371, -274, -70, -396, -394, 179, -402, - /* 90 */ -392, -19, -29, 535, -249, 317, 410, 528, 634, 647, - /* 100 */ -348, 355, 650, 665, 668, 671, 373, -374, 155, -293, - /* 110 */ 623, 675, 470, 490, 678, -20, 713, 566, 719, 777, - /* 120 */ 866, 896, 377, 908, 974, 981, 687, 988, 63, 753, - /* 130 */ 517, 407, -370, -370, 105, -424, 482, 81, -139, 272, - /* 140 */ 303, 344, 571, 616, 643, 738, 829, 830, 860, 950, - /* 150 */ 961, 1012, 1013, 1026, 1033, 1035, 1075, 1076, 1082, 142, - /* 160 */ 127, 277, 591, 787, 793, 813, 127, 557, 595, 767, - /* 170 */ 768, 783, -407, 1018, 836, 211, 619, 513, 631, 795, - /* 180 */ 712, 1000, 991, 1016, 1037, 1083, 807, 1059, 743, 769, - /* 190 */ 867, 1008, 1131, 1149, 1109, 1208, 1244, 1194, 1123, 1123, - /* 200 */ 1108, 1132, 1142, 1167, 1302, 1123, 1278, 1278, 1305, 1306, - /* 210 */ 1320, 1326, 1214, 1227, 1234, 1315, 1236, 1278, 1330, 1385, - /* 220 */ 1296, 1390, 1347, 1314, 1337, 1338, 1278, 1262, 1263, 1243, - /* 230 */ 1272, 1274, 1342, 1394, 1348, 1327, 1426, 1350, 1346, 1429, - /* 240 */ 1357, 1442, 1378, 1455, 1457, 1406, 1467, 1411, 1418, 1478, - /* 250 */ 1482, 1489, 1427, 1436, 1438, 1444, 1484, 1486, 1502, 1503, - /* 260 */ 1495, 1507, 1508, 1509, 1519, 1527, 1522, 1530, 1432, 1514, - /* 270 */ 1520, 1487, 1536, 1534, 1468, 1545, 1539, 1548, 1493, 1553, - /* 280 */ 1511, 1556, 1557, 1571, 1563, 1580, 1549, 1552, 1554, 1560, - /* 290 */ 1562, 1565, 1566, 1567, 1575, 1579, 1581, 1577, 1586, 1587, - /* 300 */ 1588, 1540, 1541, 1542, 1490, 1524, 1505, 1609, 1537, 1543, - /* 310 */ 1555, 1573, 1615, 1568, 1626, 1582, 1483, 1564, 1499, 1578, - /* 320 */ 1485, 1494, 1501, 1504, 1510, 1515, 1589, 1516, 1521, 1497, - /* 330 */ 1517, 1512, 1659, 1569, 1535, 1529, 1674, 1666, 1670, 1614, - /* 340 */ 1632, 1633, 1635, 1636, 1620, 1638, 1627, 1684, 1647, 1643, - /* 350 */ 1698, 1594, 1658, 1654, 1661, 1711, 1696, 1719, 1723, 1679, - /* 360 */ 1683, 1686, 1688, 1689, 1690, 1701, 1702, 1703, 1704, 1708, - /* 370 */ 1710, 1716, 1720, 1722, 1724, 1732, 1743, 1747, 1748, 1749, - /* 380 */ 1750, 1725, 1754, 1752, 1762, 1767, 1786, 1790, 1791, 1808, - /* 390 */ 1726, 1771, 1692, 1727, 1741, 1744, 1784, 1787, 1777, 1792, - /* 400 */ 1778, 1829, + /* 60 */ 3773, -350, -343, -474, 540, -452, 1271, 1280, 1310, -290, + /* 70 */ 259, 1364, 143, -496, 12, 455, -489, -45, -243, -436, + /* 80 */ -444, -285, -345, -323, -65, -40, -393, -73, -278, -356, + /* 90 */ -84, -94, -20, 246, 547, 201, 410, 439, 446, 536, + /* 100 */ 120, 166, 634, 636, 660, 726, 249, -134, 244, 542, + /* 110 */ 735, 748, 644, 530, 773, 298, 779, -60, 794, 800, + /* 120 */ 890, 911, 72, 958, 969, 979, -2, 991, 657, 508, + /* 130 */ 723, -123, -469, -469, 304, 212, 264, -169, -531, -291, + /* 140 */ 125, 324, 448, 596, 640, 704, 836, 841, 862, 863, + /* 150 */ 916, 952, 964, 1007, 1008, 1015, 1016, 1022, 1026, -408, + /* 160 */ -281, -263, 397, 714, 764, 772, -281, -262, 595, -292, + /* 170 */ 75, 25, 65, 804, 767, -39, 571, 970, 975, 418, + /* 180 */ 873, -341, 563, 1035, 922, 972, 1023, 977, 641, 844, + /* 190 */ 857, 920, 1074, 1119, 611, 799, 1051, 1105, 1045, 1045, + /* 200 */ 1024, 1059, 1080, 1095, 1235, 1045, 1215, 1215, 1233, 1236, + /* 210 */ 1257, 1224, 1133, 1144, 1150, 1246, 1153, 1215, 1248, 1316, + /* 220 */ 1241, 1349, 1309, 1283, 1322, 1339, 1215, 1265, 1266, 1218, + /* 230 */ 1274, 1264, 1345, 1387, 1344, 1324, 1424, 1358, 1340, 1434, + /* 240 */ 1361, 1444, 1380, 1456, 1458, 1406, 1461, 1408, 1414, 1472, + /* 250 */ 1466, 1474, 1427, 1433, 1435, 1438, 1480, 1486, 1502, 1504, + /* 260 */ 1495, 1508, 1510, 1514, 1518, 1519, 1527, 1528, 1437, 1520, + /* 270 */ 1526, 1479, 1530, 1535, 1459, 1532, 1538, 1534, 1484, 1536, + /* 280 */ 1498, 1549, 1553, 1563, 1557, 1571, 1540, 1543, 1544, 1546, + /* 290 */ 1550, 1554, 1558, 1559, 1560, 1561, 1562, 1569, 1592, 1594, + /* 300 */ 1582, 1541, 1548, 1564, 1509, 1512, 1515, 1588, 1542, 1537, + /* 310 */ 1566, 1567, 1610, 1565, 1619, 1576, 1482, 1575, 1493, 1577, + /* 320 */ 1497, 1513, 1506, 1521, 1523, 1525, 1583, 1568, 1570, 1503, + /* 330 */ 1579, 1581, 1670, 1578, 1572, 1573, 1676, 1673, 1674, 1613, + /* 340 */ 1636, 1637, 1638, 1639, 1620, 1641, 1626, 1683, 1648, 1632, + /* 350 */ 1688, 1580, 1650, 1640, 1642, 1698, 1689, 1700, 1696, 1652, + /* 360 */ 1663, 1667, 1678, 1693, 1699, 1703, 1705, 1709, 1710, 1711, + /* 370 */ 1712, 1716, 1717, 1718, 1721, 1723, 1726, 1728, 1738, 1739, + /* 380 */ 1741, 1677, 1742, 1722, 1733, 1731, 1734, 1752, 1748, 1759, + /* 390 */ 1658, 1743, 1684, 1675, 1692, 1724, 1763, 1766, 1751, 1769, + /* 400 */ 1757, 1789, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 10 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 20 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 30 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 40 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 50 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 60 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 70 */ 2260, 2635, 2260, 2260, 2591, 2260, 2260, 2260, 2260, 2260, - /* 80 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2598, - /* 90 */ 2598, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 100 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 110 */ 2260, 2260, 2366, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 120 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 130 */ 2260, 2364, 2902, 2260, 3028, 2676, 2260, 2260, 2931, 2260, - /* 140 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 150 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 160 */ 2914, 2260, 2260, 2337, 2337, 2260, 2914, 2914, 2914, 2874, - /* 170 */ 2874, 2364, 2260, 2260, 2366, 2260, 2678, 2260, 2260, 2260, - /* 180 */ 2260, 2260, 2260, 2260, 2260, 2260, 2507, 2290, 2260, 2260, - /* 190 */ 2260, 2260, 2260, 2260, 2661, 2260, 2260, 2960, 2906, 2907, - /* 200 */ 3022, 2260, 2963, 2925, 2260, 2920, 2260, 2260, 2260, 2260, - /* 210 */ 2260, 2950, 2260, 2260, 2260, 2260, 2260, 2260, 2603, 2260, - /* 220 */ 2704, 2260, 2452, 2655, 2260, 2260, 2260, 2260, 2260, 3006, - /* 230 */ 2904, 2944, 2260, 2260, 2954, 2260, 2260, 2260, 2692, 2366, - /* 240 */ 2260, 2366, 2648, 2586, 2260, 2596, 2260, 2596, 2593, 2260, - /* 250 */ 2260, 2260, 2596, 2593, 2593, 2593, 2440, 2436, 2260, 2260, - /* 260 */ 2434, 2260, 2260, 2260, 2260, 2320, 2260, 2320, 2260, 2366, - /* 270 */ 2366, 2260, 2366, 2260, 2260, 2366, 2260, 2366, 2260, 2366, - /* 280 */ 2260, 2366, 2366, 2260, 2366, 2260, 2260, 2260, 2260, 2260, - /* 290 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 300 */ 2260, 2260, 2260, 2260, 2690, 2671, 2260, 2364, 2260, 2659, - /* 310 */ 2657, 2260, 2364, 2954, 2260, 2260, 2976, 2971, 2976, 2971, - /* 320 */ 2990, 2986, 2976, 2995, 2992, 2956, 2954, 2937, 2933, 3025, - /* 330 */ 3012, 3008, 2260, 2260, 2942, 2940, 2260, 2364, 2364, 2971, - /* 340 */ 2260, 2260, 2260, 2260, 2971, 2260, 2260, 2364, 2260, 2260, - /* 350 */ 2364, 2260, 2260, 2260, 2260, 2364, 2260, 2364, 2260, 2260, - /* 360 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 370 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 380 */ 2260, 2469, 2260, 2260, 2364, 2260, 2292, 2294, 2304, 2260, - /* 390 */ 2650, 3028, 2676, 2681, 2631, 2631, 2510, 2510, 3028, 2510, - /* 400 */ 2367, 2265, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 410 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2809, 2260, 2260, - /* 420 */ 2260, 2260, 2260, 2260, 2989, 2988, 2810, 2260, 2878, 2877, - /* 430 */ 2876, 2867, 2809, 2465, 2260, 2260, 2260, 2808, 2807, 2260, - /* 440 */ 2260, 2260, 2260, 2456, 2453, 2260, 2260, 2478, 2260, 2260, - /* 450 */ 2260, 2260, 2622, 2621, 2801, 2260, 2260, 2802, 2800, 2799, - /* 460 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 470 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 480 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 3009, 3013, - /* 490 */ 2260, 2260, 2260, 2260, 2903, 2260, 2260, 2260, 2260, 2780, - /* 500 */ 2260, 2260, 2260, 2260, 2260, 2748, 2743, 2734, 2725, 2740, - /* 510 */ 2731, 2719, 2737, 2728, 2716, 2713, 2260, 2260, 2260, 2260, - /* 520 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 530 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 540 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 550 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 560 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 570 */ 2260, 2260, 2592, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 580 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 590 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 600 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 610 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 620 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 630 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2607, 2260, 2260, - /* 640 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 650 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 660 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 670 */ 2260, 2309, 2787, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 680 */ 2260, 2260, 2260, 2260, 2260, 2260, 2790, 2260, 2260, 2791, - /* 690 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 700 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 710 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 720 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 730 */ 2260, 2260, 2411, 2410, 2260, 2260, 2260, 2260, 2260, 2260, - /* 740 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 750 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 760 */ 2260, 2260, 2792, 2260, 2260, 2260, 2260, 2675, 2260, 2260, - /* 770 */ 2782, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 780 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 3005, 2957, 2260, - /* 790 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 800 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 810 */ 2260, 2780, 2260, 2987, 2260, 2260, 2260, 2260, 2260, 2260, - /* 820 */ 2260, 3003, 2260, 3007, 2260, 2260, 2260, 2260, 2260, 2260, - /* 830 */ 2260, 2913, 2909, 2260, 2260, 2905, 2260, 2260, 2260, 2260, - /* 840 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 850 */ 2260, 2260, 2260, 2260, 2260, 2260, 2864, 2260, 2260, 2260, - /* 860 */ 2898, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2506, - /* 870 */ 2505, 2504, 2503, 2260, 2260, 2260, 2260, 2260, 2260, 2792, - /* 880 */ 2260, 2795, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 890 */ 2260, 2260, 2260, 2260, 2260, 2779, 2260, 2843, 2842, 2260, - /* 900 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 910 */ 2500, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 920 */ 2260, 2260, 2260, 2260, 2260, 2260, 2484, 2482, 2481, 2480, - /* 930 */ 2260, 2517, 2260, 2260, 2260, 2513, 2512, 2260, 2260, 2260, - /* 940 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 950 */ 2260, 2260, 2260, 2260, 2260, 2260, 2385, 2260, 2260, 2260, - /* 960 */ 2260, 2260, 2260, 2260, 2260, 2377, 2260, 2376, 2260, 2260, - /* 970 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 980 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, - /* 990 */ 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2289, 2260, 2260, - /* 1000 */ 2260, 2260, 2260, 2260, 2260, 2260, ->>>>>>> f143f5f1bcee3e814ef83fc3d942a3eab3c2417b + /* 0 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, + /* 10 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, + /* 20 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, + /* 30 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, + /* 40 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, + /* 50 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, + /* 60 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, + /* 70 */ 2262, 2637, 2262, 2262, 2593, 2262, 2262, 2262, 2262, 2262, + /* 80 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2600, + /* 90 */ 2600, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, + /* 100 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, + /* 110 */ 2262, 2262, 2368, 2262, 2262, 2262, 2262, 2262, 2262, 2262, + /* 120 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, + /* 130 */ 2262, 2366, 2905, 2262, 3031, 2678, 2262, 2262, 2934, 2262, + /* 140 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, + /* 150 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, + /* 160 */ 2917, 2262, 2262, 2339, 2339, 2262, 2917, 2917, 2917, 2877, + /* 170 */ 2877, 2366, 2262, 2262, 2368, 2262, 2680, 2262, 2262, 2262, + /* 180 */ 2262, 2262, 2262, 2262, 2262, 2262, 2509, 2292, 2262, 2262, + /* 190 */ 2262, 2262, 2262, 2262, 2663, 2262, 2262, 2963, 2909, 2910, + /* 200 */ 3025, 2262, 2966, 2928, 2262, 2923, 2262, 2262, 2262, 2262, + /* 210 */ 2262, 2953, 2262, 2262, 2262, 2262, 2262, 2262, 2605, 2262, + /* 220 */ 2707, 2262, 2454, 2657, 2262, 2262, 2262, 2262, 2262, 3009, + /* 230 */ 2907, 2947, 2262, 2262, 2957, 2262, 2262, 2262, 2695, 2368, + /* 240 */ 2262, 2368, 2650, 2588, 2262, 2598, 2262, 2598, 2595, 2262, + /* 250 */ 2262, 2262, 2598, 2595, 2595, 2595, 2442, 2438, 2262, 2262, + /* 260 */ 2436, 2262, 2262, 2262, 2262, 2322, 2262, 2322, 2262, 2368, + /* 270 */ 2368, 2262, 2368, 2262, 2262, 2368, 2262, 2368, 2262, 2368, + /* 280 */ 2262, 2368, 2368, 2262, 2368, 2262, 2262, 2262, 2262, 2262, + /* 290 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, + /* 300 */ 2262, 2262, 2262, 2262, 2693, 2673, 2262, 2366, 2262, 2661, + /* 310 */ 2659, 2262, 2366, 2957, 2262, 2262, 2979, 2974, 2979, 2974, + /* 320 */ 2993, 2989, 2979, 2998, 2995, 2959, 2957, 2940, 2936, 3028, + /* 330 */ 3015, 3011, 2262, 2262, 2945, 2943, 2262, 2366, 2366, 2974, + /* 340 */ 2262, 2262, 2262, 2262, 2974, 2262, 2262, 2366, 2262, 2262, + /* 350 */ 2366, 2262, 2262, 2262, 2262, 2366, 2262, 2366, 2262, 2262, + /* 360 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, + /* 370 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, + /* 380 */ 2262, 2471, 2262, 2262, 2366, 2262, 2294, 2296, 2306, 2262, + /* 390 */ 2652, 3031, 2678, 2683, 2633, 2633, 2512, 2512, 3031, 2512, + /* 400 */ 2369, 2267, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, + /* 410 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2812, 2262, 2262, + /* 420 */ 2262, 2262, 2262, 2262, 2992, 2991, 2813, 2262, 2881, 2880, + /* 430 */ 2879, 2870, 2812, 2467, 2262, 2262, 2262, 2811, 2810, 2262, + /* 440 */ 2262, 2262, 2262, 2458, 2455, 2262, 2262, 2262, 2480, 2262, + /* 450 */ 2262, 2262, 2624, 2623, 2804, 2262, 2262, 2805, 2803, 2802, + /* 460 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, + /* 470 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, + /* 480 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 3012, 3016, + /* 490 */ 2262, 2262, 2262, 2262, 2906, 2262, 2262, 2262, 2262, 2783, + /* 500 */ 2262, 2262, 2262, 2262, 2262, 2751, 2746, 2737, 2728, 2743, + /* 510 */ 2734, 2722, 2740, 2731, 2719, 2716, 2262, 2262, 2262, 2262, + /* 520 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, + /* 530 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, + /* 540 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, + /* 550 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, + /* 560 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, + /* 570 */ 2262, 2262, 2594, 2262, 2262, 2262, 2262, 2262, 2262, 2262, + /* 580 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, + /* 590 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, + /* 600 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, + /* 610 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, + /* 620 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, + /* 630 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2609, 2262, 2262, + /* 640 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, + /* 650 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, + /* 660 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, + /* 670 */ 2262, 2311, 2790, 2262, 2262, 2262, 2262, 2262, 2262, 2262, + /* 680 */ 2262, 2262, 2262, 2262, 2262, 2262, 2793, 2262, 2262, 2794, + /* 690 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, + /* 700 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, + /* 710 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, + /* 720 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, + /* 730 */ 2262, 2262, 2413, 2412, 2262, 2262, 2262, 2262, 2262, 2262, + /* 740 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, + /* 750 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, + /* 760 */ 2262, 2262, 2795, 2262, 2262, 2262, 2262, 2677, 2262, 2262, + /* 770 */ 2785, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, + /* 780 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 3008, 2960, 2262, + /* 790 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, + /* 800 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, + /* 810 */ 2262, 2783, 2262, 2990, 2262, 2262, 2262, 2262, 2262, 2262, + /* 820 */ 2262, 3006, 2262, 3010, 2262, 2262, 2262, 2262, 2262, 2262, + /* 830 */ 2262, 2916, 2912, 2262, 2262, 2908, 2262, 2262, 2262, 2262, + /* 840 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, + /* 850 */ 2262, 2262, 2262, 2262, 2262, 2262, 2867, 2262, 2262, 2262, + /* 860 */ 2901, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2508, + /* 870 */ 2507, 2506, 2505, 2262, 2262, 2262, 2262, 2262, 2262, 2795, + /* 880 */ 2262, 2798, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, + /* 890 */ 2262, 2262, 2262, 2262, 2262, 2782, 2262, 2846, 2845, 2262, + /* 900 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, + /* 910 */ 2502, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, + /* 920 */ 2262, 2262, 2262, 2262, 2262, 2262, 2486, 2484, 2483, 2482, + /* 930 */ 2262, 2519, 2262, 2262, 2262, 2515, 2514, 2262, 2262, 2262, + /* 940 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, + /* 950 */ 2262, 2262, 2262, 2262, 2262, 2262, 2387, 2262, 2262, 2262, + /* 960 */ 2262, 2262, 2262, 2262, 2262, 2379, 2262, 2378, 2262, 2262, + /* 970 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, + /* 980 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2262, + /* 990 */ 2262, 2262, 2262, 2262, 2262, 2262, 2262, 2291, 2262, 2262, + /* 1000 */ 2262, 2262, 2262, 2262, 2262, 2262, }; /********** End of lemon-generated parsing tables *****************************/ @@ -3926,7 +2830,6 @@ static const char *const yyTokenName[] = { /* For tracing reduce actions, the names of all rules are required. */ static const char *const yyRuleName[] = { -<<<<<<< HEAD /* 0 */ "cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options", /* 1 */ "cmd ::= ALTER ACCOUNT NK_ID alter_account_options", /* 2 */ "account_options ::=", @@ -4499,18 +3402,18 @@ static const char *const yyRuleName[] = { /* 569 */ "function_expression ::= POSITION NK_LP expr_or_subquery IN expr_or_subquery NK_RP", /* 570 */ "function_expression ::= TRIM NK_LP expr_or_subquery NK_RP", /* 571 */ "function_expression ::= TRIM NK_LP trim_specification_type FROM expr_or_subquery NK_RP", - /* 572 */ "function_expression ::= TRIM NK_LP trim_specification_type expr_or_subquery FROM expr_or_subquery NK_RP", - /* 573 */ "function_expression ::= substr_func NK_LP expression_list NK_RP", - /* 574 */ "function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery NK_RP", - /* 575 */ "function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery FOR expr_or_subquery NK_RP", - /* 576 */ "function_expression ::= REPLACE NK_LP expression_list NK_RP", - /* 577 */ "function_expression ::= literal_func", - /* 578 */ "literal_func ::= noarg_func NK_LP NK_RP", - /* 579 */ "literal_func ::= NOW", - /* 580 */ "literal_func ::= TODAY", - /* 581 */ "substr_func ::= SUBSTR", - /* 582 */ "substr_func ::= SUBSTRING", - /* 583 */ "trim_specification_type ::=", + /* 572 */ "function_expression ::= TRIM NK_LP expr_or_subquery FROM expr_or_subquery NK_RP", + /* 573 */ "function_expression ::= TRIM NK_LP trim_specification_type expr_or_subquery FROM expr_or_subquery NK_RP", + /* 574 */ "function_expression ::= substr_func NK_LP expression_list NK_RP", + /* 575 */ "function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery NK_RP", + /* 576 */ "function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery FOR expr_or_subquery NK_RP", + /* 577 */ "function_expression ::= REPLACE NK_LP expression_list NK_RP", + /* 578 */ "function_expression ::= literal_func", + /* 579 */ "literal_func ::= noarg_func NK_LP NK_RP", + /* 580 */ "literal_func ::= NOW", + /* 581 */ "literal_func ::= TODAY", + /* 582 */ "substr_func ::= SUBSTR", + /* 583 */ "substr_func ::= SUBSTRING", /* 584 */ "trim_specification_type ::= BOTH", /* 585 */ "trim_specification_type ::= TRAILING", /* 586 */ "trim_specification_type ::= LEADING", @@ -4698,778 +3601,6 @@ static const char *const yyRuleName[] = { /* 768 */ "column_options ::= column_options ENCODE NK_STRING", /* 769 */ "column_options ::= column_options COMPRESS NK_STRING", /* 770 */ "column_options ::= column_options LEVEL NK_STRING", -======= - /* 0 */ "cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options", - /* 1 */ "cmd ::= ALTER ACCOUNT NK_ID alter_account_options", - /* 2 */ "account_options ::=", - /* 3 */ "account_options ::= account_options PPS literal", - /* 4 */ "account_options ::= account_options TSERIES literal", - /* 5 */ "account_options ::= account_options STORAGE literal", - /* 6 */ "account_options ::= account_options STREAMS literal", - /* 7 */ "account_options ::= account_options QTIME literal", - /* 8 */ "account_options ::= account_options DBS literal", - /* 9 */ "account_options ::= account_options USERS literal", - /* 10 */ "account_options ::= account_options CONNS literal", - /* 11 */ "account_options ::= account_options STATE literal", - /* 12 */ "alter_account_options ::= alter_account_option", - /* 13 */ "alter_account_options ::= alter_account_options alter_account_option", - /* 14 */ "alter_account_option ::= PASS literal", - /* 15 */ "alter_account_option ::= PPS literal", - /* 16 */ "alter_account_option ::= TSERIES literal", - /* 17 */ "alter_account_option ::= STORAGE literal", - /* 18 */ "alter_account_option ::= STREAMS literal", - /* 19 */ "alter_account_option ::= QTIME literal", - /* 20 */ "alter_account_option ::= DBS literal", - /* 21 */ "alter_account_option ::= USERS literal", - /* 22 */ "alter_account_option ::= CONNS literal", - /* 23 */ "alter_account_option ::= STATE literal", - /* 24 */ "ip_range_list ::= NK_STRING", - /* 25 */ "ip_range_list ::= ip_range_list NK_COMMA NK_STRING", - /* 26 */ "white_list ::= HOST ip_range_list", - /* 27 */ "white_list_opt ::=", - /* 28 */ "white_list_opt ::= white_list", - /* 29 */ "is_import_opt ::=", - /* 30 */ "is_import_opt ::= IS_IMPORT NK_INTEGER", - /* 31 */ "is_createdb_opt ::=", - /* 32 */ "is_createdb_opt ::= CREATEDB NK_INTEGER", - /* 33 */ "cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt is_createdb_opt is_import_opt white_list_opt", - /* 34 */ "cmd ::= ALTER USER user_name PASS NK_STRING", - /* 35 */ "cmd ::= ALTER USER user_name ENABLE NK_INTEGER", - /* 36 */ "cmd ::= ALTER USER user_name SYSINFO NK_INTEGER", - /* 37 */ "cmd ::= ALTER USER user_name CREATEDB NK_INTEGER", - /* 38 */ "cmd ::= ALTER USER user_name ADD white_list", - /* 39 */ "cmd ::= ALTER USER user_name DROP white_list", - /* 40 */ "cmd ::= DROP USER user_name", - /* 41 */ "sysinfo_opt ::=", - /* 42 */ "sysinfo_opt ::= SYSINFO NK_INTEGER", - /* 43 */ "cmd ::= GRANT privileges ON priv_level with_opt TO user_name", - /* 44 */ "cmd ::= REVOKE privileges ON priv_level with_opt FROM user_name", - /* 45 */ "privileges ::= ALL", - /* 46 */ "privileges ::= priv_type_list", - /* 47 */ "privileges ::= SUBSCRIBE", - /* 48 */ "priv_type_list ::= priv_type", - /* 49 */ "priv_type_list ::= priv_type_list NK_COMMA priv_type", - /* 50 */ "priv_type ::= READ", - /* 51 */ "priv_type ::= WRITE", - /* 52 */ "priv_type ::= ALTER", - /* 53 */ "priv_level ::= NK_STAR NK_DOT NK_STAR", - /* 54 */ "priv_level ::= db_name NK_DOT NK_STAR", - /* 55 */ "priv_level ::= db_name NK_DOT table_name", - /* 56 */ "priv_level ::= topic_name", - /* 57 */ "with_opt ::=", - /* 58 */ "with_opt ::= WITH search_condition", - /* 59 */ "cmd ::= CREATE ENCRYPT_KEY NK_STRING", - /* 60 */ "cmd ::= CREATE DNODE dnode_endpoint", - /* 61 */ "cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER", - /* 62 */ "cmd ::= DROP DNODE NK_INTEGER force_opt", - /* 63 */ "cmd ::= DROP DNODE dnode_endpoint force_opt", - /* 64 */ "cmd ::= DROP DNODE NK_INTEGER unsafe_opt", - /* 65 */ "cmd ::= DROP DNODE dnode_endpoint unsafe_opt", - /* 66 */ "cmd ::= ALTER DNODE NK_INTEGER NK_STRING", - /* 67 */ "cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING", - /* 68 */ "cmd ::= ALTER ALL DNODES NK_STRING", - /* 69 */ "cmd ::= ALTER ALL DNODES NK_STRING NK_STRING", - /* 70 */ "cmd ::= RESTORE DNODE NK_INTEGER", - /* 71 */ "dnode_endpoint ::= NK_STRING", - /* 72 */ "dnode_endpoint ::= NK_ID", - /* 73 */ "dnode_endpoint ::= NK_IPTOKEN", - /* 74 */ "force_opt ::=", - /* 75 */ "force_opt ::= FORCE", - /* 76 */ "unsafe_opt ::= UNSAFE", - /* 77 */ "cmd ::= ALTER CLUSTER NK_STRING", - /* 78 */ "cmd ::= ALTER CLUSTER NK_STRING NK_STRING", - /* 79 */ "cmd ::= ALTER LOCAL NK_STRING", - /* 80 */ "cmd ::= ALTER LOCAL NK_STRING NK_STRING", - /* 81 */ "cmd ::= CREATE QNODE ON DNODE NK_INTEGER", - /* 82 */ "cmd ::= DROP QNODE ON DNODE NK_INTEGER", - /* 83 */ "cmd ::= RESTORE QNODE ON DNODE NK_INTEGER", - /* 84 */ "cmd ::= CREATE BNODE ON DNODE NK_INTEGER", - /* 85 */ "cmd ::= DROP BNODE ON DNODE NK_INTEGER", - /* 86 */ "cmd ::= CREATE SNODE ON DNODE NK_INTEGER", - /* 87 */ "cmd ::= DROP SNODE ON DNODE NK_INTEGER", - /* 88 */ "cmd ::= CREATE MNODE ON DNODE NK_INTEGER", - /* 89 */ "cmd ::= DROP MNODE ON DNODE NK_INTEGER", - /* 90 */ "cmd ::= RESTORE MNODE ON DNODE NK_INTEGER", - /* 91 */ "cmd ::= RESTORE VNODE ON DNODE NK_INTEGER", - /* 92 */ "cmd ::= CREATE DATABASE not_exists_opt db_name db_options", - /* 93 */ "cmd ::= DROP DATABASE exists_opt db_name", - /* 94 */ "cmd ::= USE db_name", - /* 95 */ "cmd ::= ALTER DATABASE db_name alter_db_options", - /* 96 */ "cmd ::= FLUSH DATABASE db_name", - /* 97 */ "cmd ::= TRIM DATABASE db_name speed_opt", - /* 98 */ "cmd ::= S3MIGRATE DATABASE db_name", - /* 99 */ "cmd ::= COMPACT DATABASE db_name start_opt end_opt", - /* 100 */ "not_exists_opt ::= IF NOT EXISTS", - /* 101 */ "not_exists_opt ::=", - /* 102 */ "exists_opt ::= IF EXISTS", - /* 103 */ "exists_opt ::=", - /* 104 */ "db_options ::=", - /* 105 */ "db_options ::= db_options BUFFER NK_INTEGER", - /* 106 */ "db_options ::= db_options CACHEMODEL NK_STRING", - /* 107 */ "db_options ::= db_options CACHESIZE NK_INTEGER", - /* 108 */ "db_options ::= db_options COMP NK_INTEGER", - /* 109 */ "db_options ::= db_options DURATION NK_INTEGER", - /* 110 */ "db_options ::= db_options DURATION NK_VARIABLE", - /* 111 */ "db_options ::= db_options MAXROWS NK_INTEGER", - /* 112 */ "db_options ::= db_options MINROWS NK_INTEGER", - /* 113 */ "db_options ::= db_options KEEP integer_list", - /* 114 */ "db_options ::= db_options KEEP variable_list", - /* 115 */ "db_options ::= db_options PAGES NK_INTEGER", - /* 116 */ "db_options ::= db_options PAGESIZE NK_INTEGER", - /* 117 */ "db_options ::= db_options TSDB_PAGESIZE NK_INTEGER", - /* 118 */ "db_options ::= db_options PRECISION NK_STRING", - /* 119 */ "db_options ::= db_options REPLICA NK_INTEGER", - /* 120 */ "db_options ::= db_options VGROUPS NK_INTEGER", - /* 121 */ "db_options ::= db_options SINGLE_STABLE NK_INTEGER", - /* 122 */ "db_options ::= db_options RETENTIONS retention_list", - /* 123 */ "db_options ::= db_options SCHEMALESS NK_INTEGER", - /* 124 */ "db_options ::= db_options WAL_LEVEL NK_INTEGER", - /* 125 */ "db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER", - /* 126 */ "db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER", - /* 127 */ "db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER", - /* 128 */ "db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER", - /* 129 */ "db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER", - /* 130 */ "db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER", - /* 131 */ "db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER", - /* 132 */ "db_options ::= db_options STT_TRIGGER NK_INTEGER", - /* 133 */ "db_options ::= db_options TABLE_PREFIX signed", - /* 134 */ "db_options ::= db_options TABLE_SUFFIX signed", - /* 135 */ "db_options ::= db_options S3_CHUNKSIZE NK_INTEGER", - /* 136 */ "db_options ::= db_options S3_KEEPLOCAL NK_INTEGER", - /* 137 */ "db_options ::= db_options S3_KEEPLOCAL NK_VARIABLE", - /* 138 */ "db_options ::= db_options S3_COMPACT NK_INTEGER", - /* 139 */ "db_options ::= db_options KEEP_TIME_OFFSET NK_INTEGER", - /* 140 */ "db_options ::= db_options ENCRYPT_ALGORITHM NK_STRING", - /* 141 */ "alter_db_options ::= alter_db_option", - /* 142 */ "alter_db_options ::= alter_db_options alter_db_option", - /* 143 */ "alter_db_option ::= BUFFER NK_INTEGER", - /* 144 */ "alter_db_option ::= CACHEMODEL NK_STRING", - /* 145 */ "alter_db_option ::= CACHESIZE NK_INTEGER", - /* 146 */ "alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER", - /* 147 */ "alter_db_option ::= KEEP integer_list", - /* 148 */ "alter_db_option ::= KEEP variable_list", - /* 149 */ "alter_db_option ::= PAGES NK_INTEGER", - /* 150 */ "alter_db_option ::= REPLICA NK_INTEGER", - /* 151 */ "alter_db_option ::= WAL_LEVEL NK_INTEGER", - /* 152 */ "alter_db_option ::= STT_TRIGGER NK_INTEGER", - /* 153 */ "alter_db_option ::= MINROWS NK_INTEGER", - /* 154 */ "alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER", - /* 155 */ "alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER", - /* 156 */ "alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER", - /* 157 */ "alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER", - /* 158 */ "alter_db_option ::= S3_KEEPLOCAL NK_INTEGER", - /* 159 */ "alter_db_option ::= S3_KEEPLOCAL NK_VARIABLE", - /* 160 */ "alter_db_option ::= S3_COMPACT NK_INTEGER", - /* 161 */ "alter_db_option ::= KEEP_TIME_OFFSET NK_INTEGER", - /* 162 */ "alter_db_option ::= ENCRYPT_ALGORITHM NK_STRING", - /* 163 */ "integer_list ::= NK_INTEGER", - /* 164 */ "integer_list ::= integer_list NK_COMMA NK_INTEGER", - /* 165 */ "variable_list ::= NK_VARIABLE", - /* 166 */ "variable_list ::= variable_list NK_COMMA NK_VARIABLE", - /* 167 */ "retention_list ::= retention", - /* 168 */ "retention_list ::= retention_list NK_COMMA retention", - /* 169 */ "retention ::= NK_VARIABLE NK_COLON NK_VARIABLE", - /* 170 */ "retention ::= NK_MINUS NK_COLON NK_VARIABLE", - /* 171 */ "speed_opt ::=", - /* 172 */ "speed_opt ::= BWLIMIT NK_INTEGER", - /* 173 */ "start_opt ::=", - /* 174 */ "start_opt ::= START WITH NK_INTEGER", - /* 175 */ "start_opt ::= START WITH NK_STRING", - /* 176 */ "start_opt ::= START WITH TIMESTAMP NK_STRING", - /* 177 */ "end_opt ::=", - /* 178 */ "end_opt ::= END WITH NK_INTEGER", - /* 179 */ "end_opt ::= END WITH NK_STRING", - /* 180 */ "end_opt ::= END WITH TIMESTAMP NK_STRING", - /* 181 */ "cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options", - /* 182 */ "cmd ::= CREATE TABLE multi_create_clause", - /* 183 */ "cmd ::= CREATE TABLE not_exists_opt USING full_table_name NK_LP tag_list_opt NK_RP FILE NK_STRING", - /* 184 */ "cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options", - /* 185 */ "cmd ::= DROP TABLE multi_drop_clause", - /* 186 */ "cmd ::= DROP STABLE exists_opt full_table_name", - /* 187 */ "cmd ::= ALTER TABLE alter_table_clause", - /* 188 */ "cmd ::= ALTER STABLE alter_table_clause", - /* 189 */ "alter_table_clause ::= full_table_name alter_table_options", - /* 190 */ "alter_table_clause ::= full_table_name ADD COLUMN column_name type_name column_options", - /* 191 */ "alter_table_clause ::= full_table_name DROP COLUMN column_name", - /* 192 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name", - /* 193 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name column_options", - /* 194 */ "alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name", - /* 195 */ "alter_table_clause ::= full_table_name ADD TAG column_name type_name", - /* 196 */ "alter_table_clause ::= full_table_name DROP TAG column_name", - /* 197 */ "alter_table_clause ::= full_table_name MODIFY TAG column_name type_name", - /* 198 */ "alter_table_clause ::= full_table_name RENAME TAG column_name column_name", - /* 199 */ "alter_table_clause ::= full_table_name SET TAG column_name NK_EQ tags_literal", - /* 200 */ "multi_create_clause ::= create_subtable_clause", - /* 201 */ "multi_create_clause ::= multi_create_clause create_subtable_clause", - /* 202 */ "create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP tags_literal_list NK_RP table_options", - /* 203 */ "multi_drop_clause ::= drop_table_clause", - /* 204 */ "multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause", - /* 205 */ "drop_table_clause ::= exists_opt full_table_name", - /* 206 */ "specific_cols_opt ::=", - /* 207 */ "specific_cols_opt ::= NK_LP col_name_list NK_RP", - /* 208 */ "full_table_name ::= table_name", - /* 209 */ "full_table_name ::= db_name NK_DOT table_name", - /* 210 */ "tag_def_list ::= tag_def", - /* 211 */ "tag_def_list ::= tag_def_list NK_COMMA tag_def", - /* 212 */ "tag_def ::= column_name type_name", - /* 213 */ "column_def_list ::= column_def", - /* 214 */ "column_def_list ::= column_def_list NK_COMMA column_def", - /* 215 */ "column_def ::= column_name type_name column_options", - /* 216 */ "type_name ::= BOOL", - /* 217 */ "type_name ::= TINYINT", - /* 218 */ "type_name ::= SMALLINT", - /* 219 */ "type_name ::= INT", - /* 220 */ "type_name ::= INTEGER", - /* 221 */ "type_name ::= BIGINT", - /* 222 */ "type_name ::= FLOAT", - /* 223 */ "type_name ::= DOUBLE", - /* 224 */ "type_name ::= BINARY NK_LP NK_INTEGER NK_RP", - /* 225 */ "type_name ::= TIMESTAMP", - /* 226 */ "type_name ::= NCHAR NK_LP NK_INTEGER NK_RP", - /* 227 */ "type_name ::= TINYINT UNSIGNED", - /* 228 */ "type_name ::= SMALLINT UNSIGNED", - /* 229 */ "type_name ::= INT UNSIGNED", - /* 230 */ "type_name ::= BIGINT UNSIGNED", - /* 231 */ "type_name ::= JSON", - /* 232 */ "type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP", - /* 233 */ "type_name ::= MEDIUMBLOB", - /* 234 */ "type_name ::= BLOB", - /* 235 */ "type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP", - /* 236 */ "type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP", - /* 237 */ "type_name ::= DECIMAL", - /* 238 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP", - /* 239 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", - /* 240 */ "type_name_default_len ::= BINARY", - /* 241 */ "type_name_default_len ::= NCHAR", - /* 242 */ "type_name_default_len ::= VARCHAR", - /* 243 */ "type_name_default_len ::= VARBINARY", - /* 244 */ "tags_def_opt ::=", - /* 245 */ "tags_def_opt ::= tags_def", - /* 246 */ "tags_def ::= TAGS NK_LP tag_def_list NK_RP", - /* 247 */ "table_options ::=", - /* 248 */ "table_options ::= table_options COMMENT NK_STRING", - /* 249 */ "table_options ::= table_options MAX_DELAY duration_list", - /* 250 */ "table_options ::= table_options WATERMARK duration_list", - /* 251 */ "table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP", - /* 252 */ "table_options ::= table_options TTL NK_INTEGER", - /* 253 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP", - /* 254 */ "table_options ::= table_options DELETE_MARK duration_list", - /* 255 */ "alter_table_options ::= alter_table_option", - /* 256 */ "alter_table_options ::= alter_table_options alter_table_option", - /* 257 */ "alter_table_option ::= COMMENT NK_STRING", - /* 258 */ "alter_table_option ::= TTL NK_INTEGER", - /* 259 */ "duration_list ::= duration_literal", - /* 260 */ "duration_list ::= duration_list NK_COMMA duration_literal", - /* 261 */ "rollup_func_list ::= rollup_func_name", - /* 262 */ "rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name", - /* 263 */ "rollup_func_name ::= function_name", - /* 264 */ "rollup_func_name ::= FIRST", - /* 265 */ "rollup_func_name ::= LAST", - /* 266 */ "col_name_list ::= col_name", - /* 267 */ "col_name_list ::= col_name_list NK_COMMA col_name", - /* 268 */ "col_name ::= column_name", - /* 269 */ "cmd ::= SHOW DNODES", - /* 270 */ "cmd ::= SHOW USERS", - /* 271 */ "cmd ::= SHOW USERS FULL", - /* 272 */ "cmd ::= SHOW USER PRIVILEGES", - /* 273 */ "cmd ::= SHOW db_kind_opt DATABASES", - /* 274 */ "cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt", - /* 275 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt", - /* 276 */ "cmd ::= SHOW db_name_cond_opt VGROUPS", - /* 277 */ "cmd ::= SHOW MNODES", - /* 278 */ "cmd ::= SHOW QNODES", - /* 279 */ "cmd ::= SHOW ARBGROUPS", - /* 280 */ "cmd ::= SHOW FUNCTIONS", - /* 281 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt", - /* 282 */ "cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name", - /* 283 */ "cmd ::= SHOW STREAMS", - /* 284 */ "cmd ::= SHOW ACCOUNTS", - /* 285 */ "cmd ::= SHOW APPS", - /* 286 */ "cmd ::= SHOW CONNECTIONS", - /* 287 */ "cmd ::= SHOW LICENCES", - /* 288 */ "cmd ::= SHOW GRANTS", - /* 289 */ "cmd ::= SHOW GRANTS FULL", - /* 290 */ "cmd ::= SHOW GRANTS LOGS", - /* 291 */ "cmd ::= SHOW CLUSTER MACHINES", - /* 292 */ "cmd ::= SHOW CREATE DATABASE db_name", - /* 293 */ "cmd ::= SHOW CREATE TABLE full_table_name", - /* 294 */ "cmd ::= SHOW CREATE STABLE full_table_name", - /* 295 */ "cmd ::= SHOW ENCRYPTIONS", - /* 296 */ "cmd ::= SHOW QUERIES", - /* 297 */ "cmd ::= SHOW SCORES", - /* 298 */ "cmd ::= SHOW TOPICS", - /* 299 */ "cmd ::= SHOW VARIABLES", - /* 300 */ "cmd ::= SHOW CLUSTER VARIABLES", - /* 301 */ "cmd ::= SHOW LOCAL VARIABLES", - /* 302 */ "cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt", - /* 303 */ "cmd ::= SHOW BNODES", - /* 304 */ "cmd ::= SHOW SNODES", - /* 305 */ "cmd ::= SHOW CLUSTER", - /* 306 */ "cmd ::= SHOW TRANSACTIONS", - /* 307 */ "cmd ::= SHOW TABLE DISTRIBUTED full_table_name", - /* 308 */ "cmd ::= SHOW CONSUMERS", - /* 309 */ "cmd ::= SHOW SUBSCRIPTIONS", - /* 310 */ "cmd ::= SHOW TAGS FROM table_name_cond from_db_opt", - /* 311 */ "cmd ::= SHOW TAGS FROM db_name NK_DOT table_name", - /* 312 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt", - /* 313 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name", - /* 314 */ "cmd ::= SHOW VNODES ON DNODE NK_INTEGER", - /* 315 */ "cmd ::= SHOW VNODES", - /* 316 */ "cmd ::= SHOW db_name_cond_opt ALIVE", - /* 317 */ "cmd ::= SHOW CLUSTER ALIVE", - /* 318 */ "cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt", - /* 319 */ "cmd ::= SHOW CREATE VIEW full_table_name", - /* 320 */ "cmd ::= SHOW COMPACTS", - /* 321 */ "cmd ::= SHOW COMPACT NK_INTEGER", - /* 322 */ "table_kind_db_name_cond_opt ::=", - /* 323 */ "table_kind_db_name_cond_opt ::= table_kind", - /* 324 */ "table_kind_db_name_cond_opt ::= db_name NK_DOT", - /* 325 */ "table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT", - /* 326 */ "table_kind ::= NORMAL", - /* 327 */ "table_kind ::= CHILD", - /* 328 */ "db_name_cond_opt ::=", - /* 329 */ "db_name_cond_opt ::= db_name NK_DOT", - /* 330 */ "like_pattern_opt ::=", - /* 331 */ "like_pattern_opt ::= LIKE NK_STRING", - /* 332 */ "table_name_cond ::= table_name", - /* 333 */ "from_db_opt ::=", - /* 334 */ "from_db_opt ::= FROM db_name", - /* 335 */ "tag_list_opt ::=", - /* 336 */ "tag_list_opt ::= tag_item", - /* 337 */ "tag_list_opt ::= tag_list_opt NK_COMMA tag_item", - /* 338 */ "tag_item ::= TBNAME", - /* 339 */ "tag_item ::= QTAGS", - /* 340 */ "tag_item ::= column_name", - /* 341 */ "tag_item ::= column_name column_alias", - /* 342 */ "tag_item ::= column_name AS column_alias", - /* 343 */ "db_kind_opt ::=", - /* 344 */ "db_kind_opt ::= USER", - /* 345 */ "db_kind_opt ::= SYSTEM", - /* 346 */ "cmd ::= CREATE TSMA not_exists_opt tsma_name ON full_table_name tsma_func_list INTERVAL NK_LP duration_literal NK_RP", - /* 347 */ "cmd ::= CREATE RECURSIVE TSMA not_exists_opt tsma_name ON full_table_name INTERVAL NK_LP duration_literal NK_RP", - /* 348 */ "cmd ::= DROP TSMA exists_opt full_tsma_name", - /* 349 */ "cmd ::= SHOW db_name_cond_opt TSMAS", - /* 350 */ "full_tsma_name ::= tsma_name", - /* 351 */ "full_tsma_name ::= db_name NK_DOT tsma_name", - /* 352 */ "tsma_func_list ::= FUNCTION NK_LP func_list NK_RP", - /* 353 */ "cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options", - /* 354 */ "cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP", - /* 355 */ "cmd ::= DROP INDEX exists_opt full_index_name", - /* 356 */ "full_index_name ::= index_name", - /* 357 */ "full_index_name ::= db_name NK_DOT index_name", - /* 358 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt", - /* 359 */ "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", - /* 360 */ "func_list ::= func", - /* 361 */ "func_list ::= func_list NK_COMMA func", - /* 362 */ "func ::= sma_func_name NK_LP expression_list NK_RP", - /* 363 */ "sma_func_name ::= function_name", - /* 364 */ "sma_func_name ::= COUNT", - /* 365 */ "sma_func_name ::= FIRST", - /* 366 */ "sma_func_name ::= LAST", - /* 367 */ "sma_func_name ::= LAST_ROW", - /* 368 */ "sma_stream_opt ::=", - /* 369 */ "sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal", - /* 370 */ "sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal", - /* 371 */ "sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal", - /* 372 */ "with_meta ::= AS", - /* 373 */ "with_meta ::= WITH META AS", - /* 374 */ "with_meta ::= ONLY META AS", - /* 375 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery", - /* 376 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name", - /* 377 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt", - /* 378 */ "cmd ::= DROP TOPIC exists_opt topic_name", - /* 379 */ "cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name", - /* 380 */ "cmd ::= DESC full_table_name", - /* 381 */ "cmd ::= DESCRIBE full_table_name", - /* 382 */ "cmd ::= RESET QUERY CACHE", - /* 383 */ "cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery", - /* 384 */ "cmd ::= EXPLAIN analyze_opt explain_options insert_query", - /* 385 */ "analyze_opt ::=", - /* 386 */ "analyze_opt ::= ANALYZE", - /* 387 */ "explain_options ::=", - /* 388 */ "explain_options ::= explain_options VERBOSE NK_BOOL", - /* 389 */ "explain_options ::= explain_options RATIO NK_FLOAT", - /* 390 */ "cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt", - /* 391 */ "cmd ::= DROP FUNCTION exists_opt function_name", - /* 392 */ "agg_func_opt ::=", - /* 393 */ "agg_func_opt ::= AGGREGATE", - /* 394 */ "bufsize_opt ::=", - /* 395 */ "bufsize_opt ::= BUFSIZE NK_INTEGER", - /* 396 */ "language_opt ::=", - /* 397 */ "language_opt ::= LANGUAGE NK_STRING", - /* 398 */ "or_replace_opt ::=", - /* 399 */ "or_replace_opt ::= OR REPLACE", - /* 400 */ "cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery", - /* 401 */ "cmd ::= DROP VIEW exists_opt full_view_name", - /* 402 */ "full_view_name ::= view_name", - /* 403 */ "full_view_name ::= db_name NK_DOT view_name", - /* 404 */ "cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery", - /* 405 */ "cmd ::= DROP STREAM exists_opt stream_name", - /* 406 */ "cmd ::= PAUSE STREAM exists_opt stream_name", - /* 407 */ "cmd ::= RESUME STREAM exists_opt ignore_opt stream_name", - /* 408 */ "col_list_opt ::=", - /* 409 */ "col_list_opt ::= NK_LP column_stream_def_list NK_RP", - /* 410 */ "column_stream_def_list ::= column_stream_def", - /* 411 */ "column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def", - /* 412 */ "column_stream_def ::= column_name stream_col_options", - /* 413 */ "stream_col_options ::=", - /* 414 */ "stream_col_options ::= stream_col_options PRIMARY KEY", - /* 415 */ "tag_def_or_ref_opt ::=", - /* 416 */ "tag_def_or_ref_opt ::= tags_def", - /* 417 */ "tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP", - /* 418 */ "stream_options ::=", - /* 419 */ "stream_options ::= stream_options TRIGGER AT_ONCE", - /* 420 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE", - /* 421 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal", - /* 422 */ "stream_options ::= stream_options WATERMARK duration_literal", - /* 423 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER", - /* 424 */ "stream_options ::= stream_options FILL_HISTORY NK_INTEGER", - /* 425 */ "stream_options ::= stream_options DELETE_MARK duration_literal", - /* 426 */ "stream_options ::= stream_options IGNORE UPDATE NK_INTEGER", - /* 427 */ "subtable_opt ::=", - /* 428 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP", - /* 429 */ "ignore_opt ::=", - /* 430 */ "ignore_opt ::= IGNORE UNTREATED", - /* 431 */ "cmd ::= KILL CONNECTION NK_INTEGER", - /* 432 */ "cmd ::= KILL QUERY NK_STRING", - /* 433 */ "cmd ::= KILL TRANSACTION NK_INTEGER", - /* 434 */ "cmd ::= KILL COMPACT NK_INTEGER", - /* 435 */ "cmd ::= BALANCE VGROUP", - /* 436 */ "cmd ::= BALANCE VGROUP LEADER on_vgroup_id", - /* 437 */ "cmd ::= BALANCE VGROUP LEADER DATABASE db_name", - /* 438 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", - /* 439 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", - /* 440 */ "cmd ::= SPLIT VGROUP NK_INTEGER", - /* 441 */ "on_vgroup_id ::=", - /* 442 */ "on_vgroup_id ::= ON NK_INTEGER", - /* 443 */ "dnode_list ::= DNODE NK_INTEGER", - /* 444 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", - /* 445 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", - /* 446 */ "cmd ::= query_or_subquery", - /* 447 */ "cmd ::= insert_query", - /* 448 */ "insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery", - /* 449 */ "insert_query ::= INSERT INTO full_table_name query_or_subquery", - /* 450 */ "tags_literal ::= NK_INTEGER", - /* 451 */ "tags_literal ::= NK_INTEGER NK_PLUS duration_literal", - /* 452 */ "tags_literal ::= NK_INTEGER NK_MINUS duration_literal", - /* 453 */ "tags_literal ::= NK_PLUS NK_INTEGER", - /* 454 */ "tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal", - /* 455 */ "tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal", - /* 456 */ "tags_literal ::= NK_MINUS NK_INTEGER", - /* 457 */ "tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal", - /* 458 */ "tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal", - /* 459 */ "tags_literal ::= NK_FLOAT", - /* 460 */ "tags_literal ::= NK_PLUS NK_FLOAT", - /* 461 */ "tags_literal ::= NK_MINUS NK_FLOAT", - /* 462 */ "tags_literal ::= NK_BIN", - /* 463 */ "tags_literal ::= NK_BIN NK_PLUS duration_literal", - /* 464 */ "tags_literal ::= NK_BIN NK_MINUS duration_literal", - /* 465 */ "tags_literal ::= NK_PLUS NK_BIN", - /* 466 */ "tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal", - /* 467 */ "tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal", - /* 468 */ "tags_literal ::= NK_MINUS NK_BIN", - /* 469 */ "tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal", - /* 470 */ "tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal", - /* 471 */ "tags_literal ::= NK_HEX", - /* 472 */ "tags_literal ::= NK_HEX NK_PLUS duration_literal", - /* 473 */ "tags_literal ::= NK_HEX NK_MINUS duration_literal", - /* 474 */ "tags_literal ::= NK_PLUS NK_HEX", - /* 475 */ "tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal", - /* 476 */ "tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal", - /* 477 */ "tags_literal ::= NK_MINUS NK_HEX", - /* 478 */ "tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal", - /* 479 */ "tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal", - /* 480 */ "tags_literal ::= NK_STRING", - /* 481 */ "tags_literal ::= NK_STRING NK_PLUS duration_literal", - /* 482 */ "tags_literal ::= NK_STRING NK_MINUS duration_literal", - /* 483 */ "tags_literal ::= NK_BOOL", - /* 484 */ "tags_literal ::= NULL", - /* 485 */ "tags_literal ::= literal_func", - /* 486 */ "tags_literal ::= literal_func NK_PLUS duration_literal", - /* 487 */ "tags_literal ::= literal_func NK_MINUS duration_literal", - /* 488 */ "tags_literal_list ::= tags_literal", - /* 489 */ "tags_literal_list ::= tags_literal_list NK_COMMA tags_literal", - /* 490 */ "literal ::= NK_INTEGER", - /* 491 */ "literal ::= NK_FLOAT", - /* 492 */ "literal ::= NK_STRING", - /* 493 */ "literal ::= NK_BOOL", - /* 494 */ "literal ::= TIMESTAMP NK_STRING", - /* 495 */ "literal ::= duration_literal", - /* 496 */ "literal ::= NULL", - /* 497 */ "literal ::= NK_QUESTION", - /* 498 */ "duration_literal ::= NK_VARIABLE", - /* 499 */ "signed ::= NK_INTEGER", - /* 500 */ "signed ::= NK_PLUS NK_INTEGER", - /* 501 */ "signed ::= NK_MINUS NK_INTEGER", - /* 502 */ "signed ::= NK_FLOAT", - /* 503 */ "signed ::= NK_PLUS NK_FLOAT", - /* 504 */ "signed ::= NK_MINUS NK_FLOAT", - /* 505 */ "signed_literal ::= signed", - /* 506 */ "signed_literal ::= NK_STRING", - /* 507 */ "signed_literal ::= NK_BOOL", - /* 508 */ "signed_literal ::= TIMESTAMP NK_STRING", - /* 509 */ "signed_literal ::= duration_literal", - /* 510 */ "signed_literal ::= NULL", - /* 511 */ "signed_literal ::= literal_func", - /* 512 */ "signed_literal ::= NK_QUESTION", - /* 513 */ "literal_list ::= signed_literal", - /* 514 */ "literal_list ::= literal_list NK_COMMA signed_literal", - /* 515 */ "db_name ::= NK_ID", - /* 516 */ "table_name ::= NK_ID", - /* 517 */ "column_name ::= NK_ID", - /* 518 */ "function_name ::= NK_ID", - /* 519 */ "view_name ::= NK_ID", - /* 520 */ "table_alias ::= NK_ID", - /* 521 */ "column_alias ::= NK_ID", - /* 522 */ "column_alias ::= NK_ALIAS", - /* 523 */ "user_name ::= NK_ID", - /* 524 */ "topic_name ::= NK_ID", - /* 525 */ "stream_name ::= NK_ID", - /* 526 */ "cgroup_name ::= NK_ID", - /* 527 */ "index_name ::= NK_ID", - /* 528 */ "tsma_name ::= NK_ID", - /* 529 */ "expr_or_subquery ::= expression", - /* 530 */ "expression ::= literal", - /* 531 */ "expression ::= pseudo_column", - /* 532 */ "expression ::= column_reference", - /* 533 */ "expression ::= function_expression", - /* 534 */ "expression ::= case_when_expression", - /* 535 */ "expression ::= NK_LP expression NK_RP", - /* 536 */ "expression ::= NK_PLUS expr_or_subquery", - /* 537 */ "expression ::= NK_MINUS expr_or_subquery", - /* 538 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery", - /* 539 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery", - /* 540 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery", - /* 541 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery", - /* 542 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery", - /* 543 */ "expression ::= column_reference NK_ARROW NK_STRING", - /* 544 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery", - /* 545 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery", - /* 546 */ "expression_list ::= expr_or_subquery", - /* 547 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery", - /* 548 */ "column_reference ::= column_name", - /* 549 */ "column_reference ::= table_name NK_DOT column_name", - /* 550 */ "column_reference ::= NK_ALIAS", - /* 551 */ "column_reference ::= table_name NK_DOT NK_ALIAS", - /* 552 */ "pseudo_column ::= ROWTS", - /* 553 */ "pseudo_column ::= TBNAME", - /* 554 */ "pseudo_column ::= table_name NK_DOT TBNAME", - /* 555 */ "pseudo_column ::= QSTART", - /* 556 */ "pseudo_column ::= QEND", - /* 557 */ "pseudo_column ::= QDURATION", - /* 558 */ "pseudo_column ::= WSTART", - /* 559 */ "pseudo_column ::= WEND", - /* 560 */ "pseudo_column ::= WDURATION", - /* 561 */ "pseudo_column ::= IROWTS", - /* 562 */ "pseudo_column ::= ISFILLED", - /* 563 */ "pseudo_column ::= QTAGS", - /* 564 */ "function_expression ::= function_name NK_LP expression_list NK_RP", - /* 565 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", - /* 566 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP", - /* 567 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP", - /* 568 */ "function_expression ::= POSITION NK_LP expr_or_subquery IN expr_or_subquery NK_RP", - /* 569 */ "function_expression ::= TRIM NK_LP expr_or_subquery NK_RP", - /* 570 */ "function_expression ::= TRIM NK_LP trim_specification_type FROM expr_or_subquery NK_RP", - /* 571 */ "function_expression ::= TRIM NK_LP expr_or_subquery FROM expr_or_subquery NK_RP", - /* 572 */ "function_expression ::= TRIM NK_LP trim_specification_type expr_or_subquery FROM expr_or_subquery NK_RP", - /* 573 */ "function_expression ::= substr_func NK_LP expression_list NK_RP", - /* 574 */ "function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery NK_RP", - /* 575 */ "function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery FOR expr_or_subquery NK_RP", - /* 576 */ "function_expression ::= REPLACE NK_LP expression_list NK_RP", - /* 577 */ "function_expression ::= literal_func", - /* 578 */ "literal_func ::= noarg_func NK_LP NK_RP", - /* 579 */ "literal_func ::= NOW", - /* 580 */ "literal_func ::= TODAY", - /* 581 */ "substr_func ::= SUBSTR", - /* 582 */ "substr_func ::= SUBSTRING", - /* 583 */ "trim_specification_type ::= BOTH", - /* 584 */ "trim_specification_type ::= TRAILING", - /* 585 */ "trim_specification_type ::= LEADING", - /* 586 */ "noarg_func ::= NOW", - /* 587 */ "noarg_func ::= TODAY", - /* 588 */ "noarg_func ::= TIMEZONE", - /* 589 */ "noarg_func ::= DATABASE", - /* 590 */ "noarg_func ::= CLIENT_VERSION", - /* 591 */ "noarg_func ::= SERVER_VERSION", - /* 592 */ "noarg_func ::= SERVER_STATUS", - /* 593 */ "noarg_func ::= CURRENT_USER", - /* 594 */ "noarg_func ::= USER", - /* 595 */ "noarg_func ::= PI", - /* 596 */ "star_func ::= COUNT", - /* 597 */ "star_func ::= FIRST", - /* 598 */ "star_func ::= LAST", - /* 599 */ "star_func ::= LAST_ROW", - /* 600 */ "star_func_para_list ::= NK_STAR", - /* 601 */ "star_func_para_list ::= other_para_list", - /* 602 */ "other_para_list ::= star_func_para", - /* 603 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", - /* 604 */ "star_func_para ::= expr_or_subquery", - /* 605 */ "star_func_para ::= table_name NK_DOT NK_STAR", - /* 606 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END", - /* 607 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END", - /* 608 */ "when_then_list ::= when_then_expr", - /* 609 */ "when_then_list ::= when_then_list when_then_expr", - /* 610 */ "when_then_expr ::= WHEN common_expression THEN common_expression", - /* 611 */ "case_when_else_opt ::=", - /* 612 */ "case_when_else_opt ::= ELSE common_expression", - /* 613 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery", - /* 614 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery", - /* 615 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery", - /* 616 */ "predicate ::= expr_or_subquery IS NULL", - /* 617 */ "predicate ::= expr_or_subquery IS NOT NULL", - /* 618 */ "predicate ::= expr_or_subquery in_op in_predicate_value", - /* 619 */ "compare_op ::= NK_LT", - /* 620 */ "compare_op ::= NK_GT", - /* 621 */ "compare_op ::= NK_LE", - /* 622 */ "compare_op ::= NK_GE", - /* 623 */ "compare_op ::= NK_NE", - /* 624 */ "compare_op ::= NK_EQ", - /* 625 */ "compare_op ::= LIKE", - /* 626 */ "compare_op ::= NOT LIKE", - /* 627 */ "compare_op ::= MATCH", - /* 628 */ "compare_op ::= NMATCH", - /* 629 */ "compare_op ::= CONTAINS", - /* 630 */ "in_op ::= IN", - /* 631 */ "in_op ::= NOT IN", - /* 632 */ "in_predicate_value ::= NK_LP literal_list NK_RP", - /* 633 */ "boolean_value_expression ::= boolean_primary", - /* 634 */ "boolean_value_expression ::= NOT boolean_primary", - /* 635 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", - /* 636 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", - /* 637 */ "boolean_primary ::= predicate", - /* 638 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", - /* 639 */ "common_expression ::= expr_or_subquery", - /* 640 */ "common_expression ::= boolean_value_expression", - /* 641 */ "from_clause_opt ::=", - /* 642 */ "from_clause_opt ::= FROM table_reference_list", - /* 643 */ "table_reference_list ::= table_reference", - /* 644 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", - /* 645 */ "table_reference ::= table_primary", - /* 646 */ "table_reference ::= joined_table", - /* 647 */ "table_primary ::= table_name alias_opt", - /* 648 */ "table_primary ::= db_name NK_DOT table_name alias_opt", - /* 649 */ "table_primary ::= subquery alias_opt", - /* 650 */ "table_primary ::= parenthesized_joined_table", - /* 651 */ "alias_opt ::=", - /* 652 */ "alias_opt ::= table_alias", - /* 653 */ "alias_opt ::= AS table_alias", - /* 654 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", - /* 655 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", - /* 656 */ "joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt", - /* 657 */ "join_type ::=", - /* 658 */ "join_type ::= INNER", - /* 659 */ "join_type ::= LEFT", - /* 660 */ "join_type ::= RIGHT", - /* 661 */ "join_type ::= FULL", - /* 662 */ "join_subtype ::=", - /* 663 */ "join_subtype ::= OUTER", - /* 664 */ "join_subtype ::= SEMI", - /* 665 */ "join_subtype ::= ANTI", - /* 666 */ "join_subtype ::= ASOF", - /* 667 */ "join_subtype ::= WINDOW", - /* 668 */ "join_on_clause_opt ::=", - /* 669 */ "join_on_clause_opt ::= ON search_condition", - /* 670 */ "window_offset_clause_opt ::=", - /* 671 */ "window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP", - /* 672 */ "window_offset_literal ::= NK_VARIABLE", - /* 673 */ "window_offset_literal ::= NK_MINUS NK_VARIABLE", - /* 674 */ "jlimit_clause_opt ::=", - /* 675 */ "jlimit_clause_opt ::= JLIMIT NK_INTEGER", - /* 676 */ "query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_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", - /* 677 */ "hint_list ::=", - /* 678 */ "hint_list ::= NK_HINT", - /* 679 */ "tag_mode_opt ::=", - /* 680 */ "tag_mode_opt ::= TAGS", - /* 681 */ "set_quantifier_opt ::=", - /* 682 */ "set_quantifier_opt ::= DISTINCT", - /* 683 */ "set_quantifier_opt ::= ALL", - /* 684 */ "select_list ::= select_item", - /* 685 */ "select_list ::= select_list NK_COMMA select_item", - /* 686 */ "select_item ::= NK_STAR", - /* 687 */ "select_item ::= common_expression", - /* 688 */ "select_item ::= common_expression column_alias", - /* 689 */ "select_item ::= common_expression AS column_alias", - /* 690 */ "select_item ::= table_name NK_DOT NK_STAR", - /* 691 */ "where_clause_opt ::=", - /* 692 */ "where_clause_opt ::= WHERE search_condition", - /* 693 */ "partition_by_clause_opt ::=", - /* 694 */ "partition_by_clause_opt ::= PARTITION BY partition_list", - /* 695 */ "partition_list ::= partition_item", - /* 696 */ "partition_list ::= partition_list NK_COMMA partition_item", - /* 697 */ "partition_item ::= expr_or_subquery", - /* 698 */ "partition_item ::= expr_or_subquery column_alias", - /* 699 */ "partition_item ::= expr_or_subquery AS column_alias", - /* 700 */ "twindow_clause_opt ::=", - /* 701 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP", - /* 702 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP", - /* 703 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt", - /* 704 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt", - /* 705 */ "twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition", - /* 706 */ "twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP", - /* 707 */ "twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", - /* 708 */ "sliding_opt ::=", - /* 709 */ "sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP", - /* 710 */ "interval_sliding_duration_literal ::= NK_VARIABLE", - /* 711 */ "interval_sliding_duration_literal ::= NK_STRING", - /* 712 */ "interval_sliding_duration_literal ::= NK_INTEGER", - /* 713 */ "fill_opt ::=", - /* 714 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", - /* 715 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP", - /* 716 */ "fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP", - /* 717 */ "fill_mode ::= NONE", - /* 718 */ "fill_mode ::= PREV", - /* 719 */ "fill_mode ::= NULL", - /* 720 */ "fill_mode ::= NULL_F", - /* 721 */ "fill_mode ::= LINEAR", - /* 722 */ "fill_mode ::= NEXT", - /* 723 */ "group_by_clause_opt ::=", - /* 724 */ "group_by_clause_opt ::= GROUP BY group_by_list", - /* 725 */ "group_by_list ::= expr_or_subquery", - /* 726 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery", - /* 727 */ "having_clause_opt ::=", - /* 728 */ "having_clause_opt ::= HAVING search_condition", - /* 729 */ "range_opt ::=", - /* 730 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP", - /* 731 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_RP", - /* 732 */ "every_opt ::=", - /* 733 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", - /* 734 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt", - /* 735 */ "query_simple ::= query_specification", - /* 736 */ "query_simple ::= union_query_expression", - /* 737 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery", - /* 738 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery", - /* 739 */ "query_simple_or_subquery ::= query_simple", - /* 740 */ "query_simple_or_subquery ::= subquery", - /* 741 */ "query_or_subquery ::= query_expression", - /* 742 */ "query_or_subquery ::= subquery", - /* 743 */ "order_by_clause_opt ::=", - /* 744 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", - /* 745 */ "slimit_clause_opt ::=", - /* 746 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", - /* 747 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", - /* 748 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 749 */ "limit_clause_opt ::=", - /* 750 */ "limit_clause_opt ::= LIMIT NK_INTEGER", - /* 751 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", - /* 752 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 753 */ "subquery ::= NK_LP query_expression NK_RP", - /* 754 */ "subquery ::= NK_LP subquery NK_RP", - /* 755 */ "search_condition ::= common_expression", - /* 756 */ "sort_specification_list ::= sort_specification", - /* 757 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", - /* 758 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt", - /* 759 */ "ordering_specification_opt ::=", - /* 760 */ "ordering_specification_opt ::= ASC", - /* 761 */ "ordering_specification_opt ::= DESC", - /* 762 */ "null_ordering_opt ::=", - /* 763 */ "null_ordering_opt ::= NULLS FIRST", - /* 764 */ "null_ordering_opt ::= NULLS LAST", - /* 765 */ "column_options ::=", - /* 766 */ "column_options ::= column_options PRIMARY KEY", - /* 767 */ "column_options ::= column_options ENCODE NK_STRING", - /* 768 */ "column_options ::= column_options COMPRESS NK_STRING", - /* 769 */ "column_options ::= column_options LEVEL NK_STRING", ->>>>>>> f143f5f1bcee3e814ef83fc3d942a3eab3c2417b }; #endif /* NDEBUG */ @@ -6144,7 +4275,6 @@ static void yy_shift( /* For rule J, yyRuleInfoLhs[J] contains the symbol on the left-hand side ** of that rule */ static const YYCODETYPE yyRuleInfoLhs[] = { -<<<<<<< HEAD 386, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ 386, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ 387, /* (2) account_options ::= */ @@ -6717,18 +4847,18 @@ static const YYCODETYPE yyRuleInfoLhs[] = { 506, /* (569) function_expression ::= POSITION NK_LP expr_or_subquery IN expr_or_subquery NK_RP */ 506, /* (570) function_expression ::= TRIM NK_LP expr_or_subquery NK_RP */ 506, /* (571) function_expression ::= TRIM NK_LP trim_specification_type FROM expr_or_subquery NK_RP */ - 506, /* (572) function_expression ::= TRIM NK_LP trim_specification_type expr_or_subquery FROM expr_or_subquery NK_RP */ - 506, /* (573) function_expression ::= substr_func NK_LP expression_list NK_RP */ - 506, /* (574) function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery NK_RP */ - 506, /* (575) function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery FOR expr_or_subquery NK_RP */ - 506, /* (576) function_expression ::= REPLACE NK_LP expression_list NK_RP */ - 506, /* (577) function_expression ::= literal_func */ - 499, /* (578) literal_func ::= noarg_func NK_LP NK_RP */ - 499, /* (579) literal_func ::= NOW */ - 499, /* (580) literal_func ::= TODAY */ - 511, /* (581) substr_func ::= SUBSTR */ - 511, /* (582) substr_func ::= SUBSTRING */ - 510, /* (583) trim_specification_type ::= */ + 506, /* (572) function_expression ::= TRIM NK_LP expr_or_subquery FROM expr_or_subquery NK_RP */ + 506, /* (573) function_expression ::= TRIM NK_LP trim_specification_type expr_or_subquery FROM expr_or_subquery NK_RP */ + 506, /* (574) function_expression ::= substr_func NK_LP expression_list NK_RP */ + 506, /* (575) function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery NK_RP */ + 506, /* (576) function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery FOR expr_or_subquery NK_RP */ + 506, /* (577) function_expression ::= REPLACE NK_LP expression_list NK_RP */ + 506, /* (578) function_expression ::= literal_func */ + 499, /* (579) literal_func ::= noarg_func NK_LP NK_RP */ + 499, /* (580) literal_func ::= NOW */ + 499, /* (581) literal_func ::= TODAY */ + 511, /* (582) substr_func ::= SUBSTR */ + 511, /* (583) substr_func ::= SUBSTRING */ 510, /* (584) trim_specification_type ::= BOTH */ 510, /* (585) trim_specification_type ::= TRAILING */ 510, /* (586) trim_specification_type ::= LEADING */ @@ -6916,778 +5046,6 @@ static const YYCODETYPE yyRuleInfoLhs[] = { 435, /* (768) column_options ::= column_options ENCODE NK_STRING */ 435, /* (769) column_options ::= column_options COMPRESS NK_STRING */ 435, /* (770) column_options ::= column_options LEVEL NK_STRING */ -======= - 385, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ - 385, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ - 386, /* (2) account_options ::= */ - 386, /* (3) account_options ::= account_options PPS literal */ - 386, /* (4) account_options ::= account_options TSERIES literal */ - 386, /* (5) account_options ::= account_options STORAGE literal */ - 386, /* (6) account_options ::= account_options STREAMS literal */ - 386, /* (7) account_options ::= account_options QTIME literal */ - 386, /* (8) account_options ::= account_options DBS literal */ - 386, /* (9) account_options ::= account_options USERS literal */ - 386, /* (10) account_options ::= account_options CONNS literal */ - 386, /* (11) account_options ::= account_options STATE literal */ - 387, /* (12) alter_account_options ::= alter_account_option */ - 387, /* (13) alter_account_options ::= alter_account_options alter_account_option */ - 389, /* (14) alter_account_option ::= PASS literal */ - 389, /* (15) alter_account_option ::= PPS literal */ - 389, /* (16) alter_account_option ::= TSERIES literal */ - 389, /* (17) alter_account_option ::= STORAGE literal */ - 389, /* (18) alter_account_option ::= STREAMS literal */ - 389, /* (19) alter_account_option ::= QTIME literal */ - 389, /* (20) alter_account_option ::= DBS literal */ - 389, /* (21) alter_account_option ::= USERS literal */ - 389, /* (22) alter_account_option ::= CONNS literal */ - 389, /* (23) alter_account_option ::= STATE literal */ - 390, /* (24) ip_range_list ::= NK_STRING */ - 390, /* (25) ip_range_list ::= ip_range_list NK_COMMA NK_STRING */ - 391, /* (26) white_list ::= HOST ip_range_list */ - 392, /* (27) white_list_opt ::= */ - 392, /* (28) white_list_opt ::= white_list */ - 393, /* (29) is_import_opt ::= */ - 393, /* (30) is_import_opt ::= IS_IMPORT NK_INTEGER */ - 394, /* (31) is_createdb_opt ::= */ - 394, /* (32) is_createdb_opt ::= CREATEDB NK_INTEGER */ - 385, /* (33) cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt is_createdb_opt is_import_opt white_list_opt */ - 385, /* (34) cmd ::= ALTER USER user_name PASS NK_STRING */ - 385, /* (35) cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ - 385, /* (36) cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ - 385, /* (37) cmd ::= ALTER USER user_name CREATEDB NK_INTEGER */ - 385, /* (38) cmd ::= ALTER USER user_name ADD white_list */ - 385, /* (39) cmd ::= ALTER USER user_name DROP white_list */ - 385, /* (40) cmd ::= DROP USER user_name */ - 396, /* (41) sysinfo_opt ::= */ - 396, /* (42) sysinfo_opt ::= SYSINFO NK_INTEGER */ - 385, /* (43) cmd ::= GRANT privileges ON priv_level with_opt TO user_name */ - 385, /* (44) cmd ::= REVOKE privileges ON priv_level with_opt FROM user_name */ - 397, /* (45) privileges ::= ALL */ - 397, /* (46) privileges ::= priv_type_list */ - 397, /* (47) privileges ::= SUBSCRIBE */ - 400, /* (48) priv_type_list ::= priv_type */ - 400, /* (49) priv_type_list ::= priv_type_list NK_COMMA priv_type */ - 401, /* (50) priv_type ::= READ */ - 401, /* (51) priv_type ::= WRITE */ - 401, /* (52) priv_type ::= ALTER */ - 398, /* (53) priv_level ::= NK_STAR NK_DOT NK_STAR */ - 398, /* (54) priv_level ::= db_name NK_DOT NK_STAR */ - 398, /* (55) priv_level ::= db_name NK_DOT table_name */ - 398, /* (56) priv_level ::= topic_name */ - 399, /* (57) with_opt ::= */ - 399, /* (58) with_opt ::= WITH search_condition */ - 385, /* (59) cmd ::= CREATE ENCRYPT_KEY NK_STRING */ - 385, /* (60) cmd ::= CREATE DNODE dnode_endpoint */ - 385, /* (61) cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ - 385, /* (62) cmd ::= DROP DNODE NK_INTEGER force_opt */ - 385, /* (63) cmd ::= DROP DNODE dnode_endpoint force_opt */ - 385, /* (64) cmd ::= DROP DNODE NK_INTEGER unsafe_opt */ - 385, /* (65) cmd ::= DROP DNODE dnode_endpoint unsafe_opt */ - 385, /* (66) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ - 385, /* (67) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ - 385, /* (68) cmd ::= ALTER ALL DNODES NK_STRING */ - 385, /* (69) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ - 385, /* (70) cmd ::= RESTORE DNODE NK_INTEGER */ - 406, /* (71) dnode_endpoint ::= NK_STRING */ - 406, /* (72) dnode_endpoint ::= NK_ID */ - 406, /* (73) dnode_endpoint ::= NK_IPTOKEN */ - 407, /* (74) force_opt ::= */ - 407, /* (75) force_opt ::= FORCE */ - 408, /* (76) unsafe_opt ::= UNSAFE */ - 385, /* (77) cmd ::= ALTER CLUSTER NK_STRING */ - 385, /* (78) cmd ::= ALTER CLUSTER NK_STRING NK_STRING */ - 385, /* (79) cmd ::= ALTER LOCAL NK_STRING */ - 385, /* (80) cmd ::= ALTER LOCAL NK_STRING NK_STRING */ - 385, /* (81) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ - 385, /* (82) cmd ::= DROP QNODE ON DNODE NK_INTEGER */ - 385, /* (83) cmd ::= RESTORE QNODE ON DNODE NK_INTEGER */ - 385, /* (84) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ - 385, /* (85) cmd ::= DROP BNODE ON DNODE NK_INTEGER */ - 385, /* (86) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ - 385, /* (87) cmd ::= DROP SNODE ON DNODE NK_INTEGER */ - 385, /* (88) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ - 385, /* (89) cmd ::= DROP MNODE ON DNODE NK_INTEGER */ - 385, /* (90) cmd ::= RESTORE MNODE ON DNODE NK_INTEGER */ - 385, /* (91) cmd ::= RESTORE VNODE ON DNODE NK_INTEGER */ - 385, /* (92) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ - 385, /* (93) cmd ::= DROP DATABASE exists_opt db_name */ - 385, /* (94) cmd ::= USE db_name */ - 385, /* (95) cmd ::= ALTER DATABASE db_name alter_db_options */ - 385, /* (96) cmd ::= FLUSH DATABASE db_name */ - 385, /* (97) cmd ::= TRIM DATABASE db_name speed_opt */ - 385, /* (98) cmd ::= S3MIGRATE DATABASE db_name */ - 385, /* (99) cmd ::= COMPACT DATABASE db_name start_opt end_opt */ - 409, /* (100) not_exists_opt ::= IF NOT EXISTS */ - 409, /* (101) not_exists_opt ::= */ - 411, /* (102) exists_opt ::= IF EXISTS */ - 411, /* (103) exists_opt ::= */ - 410, /* (104) db_options ::= */ - 410, /* (105) db_options ::= db_options BUFFER NK_INTEGER */ - 410, /* (106) db_options ::= db_options CACHEMODEL NK_STRING */ - 410, /* (107) db_options ::= db_options CACHESIZE NK_INTEGER */ - 410, /* (108) db_options ::= db_options COMP NK_INTEGER */ - 410, /* (109) db_options ::= db_options DURATION NK_INTEGER */ - 410, /* (110) db_options ::= db_options DURATION NK_VARIABLE */ - 410, /* (111) db_options ::= db_options MAXROWS NK_INTEGER */ - 410, /* (112) db_options ::= db_options MINROWS NK_INTEGER */ - 410, /* (113) db_options ::= db_options KEEP integer_list */ - 410, /* (114) db_options ::= db_options KEEP variable_list */ - 410, /* (115) db_options ::= db_options PAGES NK_INTEGER */ - 410, /* (116) db_options ::= db_options PAGESIZE NK_INTEGER */ - 410, /* (117) db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ - 410, /* (118) db_options ::= db_options PRECISION NK_STRING */ - 410, /* (119) db_options ::= db_options REPLICA NK_INTEGER */ - 410, /* (120) db_options ::= db_options VGROUPS NK_INTEGER */ - 410, /* (121) db_options ::= db_options SINGLE_STABLE NK_INTEGER */ - 410, /* (122) db_options ::= db_options RETENTIONS retention_list */ - 410, /* (123) db_options ::= db_options SCHEMALESS NK_INTEGER */ - 410, /* (124) db_options ::= db_options WAL_LEVEL NK_INTEGER */ - 410, /* (125) db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ - 410, /* (126) db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ - 410, /* (127) db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ - 410, /* (128) db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ - 410, /* (129) db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ - 410, /* (130) db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ - 410, /* (131) db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ - 410, /* (132) db_options ::= db_options STT_TRIGGER NK_INTEGER */ - 410, /* (133) db_options ::= db_options TABLE_PREFIX signed */ - 410, /* (134) db_options ::= db_options TABLE_SUFFIX signed */ - 410, /* (135) db_options ::= db_options S3_CHUNKSIZE NK_INTEGER */ - 410, /* (136) db_options ::= db_options S3_KEEPLOCAL NK_INTEGER */ - 410, /* (137) db_options ::= db_options S3_KEEPLOCAL NK_VARIABLE */ - 410, /* (138) db_options ::= db_options S3_COMPACT NK_INTEGER */ - 410, /* (139) db_options ::= db_options KEEP_TIME_OFFSET NK_INTEGER */ - 410, /* (140) db_options ::= db_options ENCRYPT_ALGORITHM NK_STRING */ - 412, /* (141) alter_db_options ::= alter_db_option */ - 412, /* (142) alter_db_options ::= alter_db_options alter_db_option */ - 420, /* (143) alter_db_option ::= BUFFER NK_INTEGER */ - 420, /* (144) alter_db_option ::= CACHEMODEL NK_STRING */ - 420, /* (145) alter_db_option ::= CACHESIZE NK_INTEGER */ - 420, /* (146) alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ - 420, /* (147) alter_db_option ::= KEEP integer_list */ - 420, /* (148) alter_db_option ::= KEEP variable_list */ - 420, /* (149) alter_db_option ::= PAGES NK_INTEGER */ - 420, /* (150) alter_db_option ::= REPLICA NK_INTEGER */ - 420, /* (151) alter_db_option ::= WAL_LEVEL NK_INTEGER */ - 420, /* (152) alter_db_option ::= STT_TRIGGER NK_INTEGER */ - 420, /* (153) alter_db_option ::= MINROWS NK_INTEGER */ - 420, /* (154) alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */ - 420, /* (155) alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ - 420, /* (156) alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */ - 420, /* (157) alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ - 420, /* (158) alter_db_option ::= S3_KEEPLOCAL NK_INTEGER */ - 420, /* (159) alter_db_option ::= S3_KEEPLOCAL NK_VARIABLE */ - 420, /* (160) alter_db_option ::= S3_COMPACT NK_INTEGER */ - 420, /* (161) alter_db_option ::= KEEP_TIME_OFFSET NK_INTEGER */ - 420, /* (162) alter_db_option ::= ENCRYPT_ALGORITHM NK_STRING */ - 416, /* (163) integer_list ::= NK_INTEGER */ - 416, /* (164) integer_list ::= integer_list NK_COMMA NK_INTEGER */ - 417, /* (165) variable_list ::= NK_VARIABLE */ - 417, /* (166) variable_list ::= variable_list NK_COMMA NK_VARIABLE */ - 418, /* (167) retention_list ::= retention */ - 418, /* (168) retention_list ::= retention_list NK_COMMA retention */ - 421, /* (169) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ - 421, /* (170) retention ::= NK_MINUS NK_COLON NK_VARIABLE */ - 413, /* (171) speed_opt ::= */ - 413, /* (172) speed_opt ::= BWLIMIT NK_INTEGER */ - 414, /* (173) start_opt ::= */ - 414, /* (174) start_opt ::= START WITH NK_INTEGER */ - 414, /* (175) start_opt ::= START WITH NK_STRING */ - 414, /* (176) start_opt ::= START WITH TIMESTAMP NK_STRING */ - 415, /* (177) end_opt ::= */ - 415, /* (178) end_opt ::= END WITH NK_INTEGER */ - 415, /* (179) end_opt ::= END WITH NK_STRING */ - 415, /* (180) end_opt ::= END WITH TIMESTAMP NK_STRING */ - 385, /* (181) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ - 385, /* (182) cmd ::= CREATE TABLE multi_create_clause */ - 385, /* (183) cmd ::= CREATE TABLE not_exists_opt USING full_table_name NK_LP tag_list_opt NK_RP FILE NK_STRING */ - 385, /* (184) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ - 385, /* (185) cmd ::= DROP TABLE multi_drop_clause */ - 385, /* (186) cmd ::= DROP STABLE exists_opt full_table_name */ - 385, /* (187) cmd ::= ALTER TABLE alter_table_clause */ - 385, /* (188) cmd ::= ALTER STABLE alter_table_clause */ - 430, /* (189) alter_table_clause ::= full_table_name alter_table_options */ - 430, /* (190) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name column_options */ - 430, /* (191) alter_table_clause ::= full_table_name DROP COLUMN column_name */ - 430, /* (192) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ - 430, /* (193) alter_table_clause ::= full_table_name MODIFY COLUMN column_name column_options */ - 430, /* (194) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ - 430, /* (195) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ - 430, /* (196) alter_table_clause ::= full_table_name DROP TAG column_name */ - 430, /* (197) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ - 430, /* (198) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ - 430, /* (199) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ tags_literal */ - 426, /* (200) multi_create_clause ::= create_subtable_clause */ - 426, /* (201) multi_create_clause ::= multi_create_clause create_subtable_clause */ - 436, /* (202) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP tags_literal_list NK_RP table_options */ - 429, /* (203) multi_drop_clause ::= drop_table_clause */ - 429, /* (204) multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ - 439, /* (205) drop_table_clause ::= exists_opt full_table_name */ - 437, /* (206) specific_cols_opt ::= */ - 437, /* (207) specific_cols_opt ::= NK_LP col_name_list NK_RP */ - 422, /* (208) full_table_name ::= table_name */ - 422, /* (209) full_table_name ::= db_name NK_DOT table_name */ - 441, /* (210) tag_def_list ::= tag_def */ - 441, /* (211) tag_def_list ::= tag_def_list NK_COMMA tag_def */ - 442, /* (212) tag_def ::= column_name type_name */ - 423, /* (213) column_def_list ::= column_def */ - 423, /* (214) column_def_list ::= column_def_list NK_COMMA column_def */ - 443, /* (215) column_def ::= column_name type_name column_options */ - 433, /* (216) type_name ::= BOOL */ - 433, /* (217) type_name ::= TINYINT */ - 433, /* (218) type_name ::= SMALLINT */ - 433, /* (219) type_name ::= INT */ - 433, /* (220) type_name ::= INTEGER */ - 433, /* (221) type_name ::= BIGINT */ - 433, /* (222) type_name ::= FLOAT */ - 433, /* (223) type_name ::= DOUBLE */ - 433, /* (224) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ - 433, /* (225) type_name ::= TIMESTAMP */ - 433, /* (226) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ - 433, /* (227) type_name ::= TINYINT UNSIGNED */ - 433, /* (228) type_name ::= SMALLINT UNSIGNED */ - 433, /* (229) type_name ::= INT UNSIGNED */ - 433, /* (230) type_name ::= BIGINT UNSIGNED */ - 433, /* (231) type_name ::= JSON */ - 433, /* (232) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ - 433, /* (233) type_name ::= MEDIUMBLOB */ - 433, /* (234) type_name ::= BLOB */ - 433, /* (235) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ - 433, /* (236) type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ - 433, /* (237) type_name ::= DECIMAL */ - 433, /* (238) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ - 433, /* (239) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - 444, /* (240) type_name_default_len ::= BINARY */ - 444, /* (241) type_name_default_len ::= NCHAR */ - 444, /* (242) type_name_default_len ::= VARCHAR */ - 444, /* (243) type_name_default_len ::= VARBINARY */ - 424, /* (244) tags_def_opt ::= */ - 424, /* (245) tags_def_opt ::= tags_def */ - 428, /* (246) tags_def ::= TAGS NK_LP tag_def_list NK_RP */ - 425, /* (247) table_options ::= */ - 425, /* (248) table_options ::= table_options COMMENT NK_STRING */ - 425, /* (249) table_options ::= table_options MAX_DELAY duration_list */ - 425, /* (250) table_options ::= table_options WATERMARK duration_list */ - 425, /* (251) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ - 425, /* (252) table_options ::= table_options TTL NK_INTEGER */ - 425, /* (253) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ - 425, /* (254) table_options ::= table_options DELETE_MARK duration_list */ - 431, /* (255) alter_table_options ::= alter_table_option */ - 431, /* (256) alter_table_options ::= alter_table_options alter_table_option */ - 447, /* (257) alter_table_option ::= COMMENT NK_STRING */ - 447, /* (258) alter_table_option ::= TTL NK_INTEGER */ - 445, /* (259) duration_list ::= duration_literal */ - 445, /* (260) duration_list ::= duration_list NK_COMMA duration_literal */ - 446, /* (261) rollup_func_list ::= rollup_func_name */ - 446, /* (262) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ - 449, /* (263) rollup_func_name ::= function_name */ - 449, /* (264) rollup_func_name ::= FIRST */ - 449, /* (265) rollup_func_name ::= LAST */ - 440, /* (266) col_name_list ::= col_name */ - 440, /* (267) col_name_list ::= col_name_list NK_COMMA col_name */ - 451, /* (268) col_name ::= column_name */ - 385, /* (269) cmd ::= SHOW DNODES */ - 385, /* (270) cmd ::= SHOW USERS */ - 385, /* (271) cmd ::= SHOW USERS FULL */ - 385, /* (272) cmd ::= SHOW USER PRIVILEGES */ - 385, /* (273) cmd ::= SHOW db_kind_opt DATABASES */ - 385, /* (274) cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */ - 385, /* (275) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ - 385, /* (276) cmd ::= SHOW db_name_cond_opt VGROUPS */ - 385, /* (277) cmd ::= SHOW MNODES */ - 385, /* (278) cmd ::= SHOW QNODES */ - 385, /* (279) cmd ::= SHOW ARBGROUPS */ - 385, /* (280) cmd ::= SHOW FUNCTIONS */ - 385, /* (281) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ - 385, /* (282) cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ - 385, /* (283) cmd ::= SHOW STREAMS */ - 385, /* (284) cmd ::= SHOW ACCOUNTS */ - 385, /* (285) cmd ::= SHOW APPS */ - 385, /* (286) cmd ::= SHOW CONNECTIONS */ - 385, /* (287) cmd ::= SHOW LICENCES */ - 385, /* (288) cmd ::= SHOW GRANTS */ - 385, /* (289) cmd ::= SHOW GRANTS FULL */ - 385, /* (290) cmd ::= SHOW GRANTS LOGS */ - 385, /* (291) cmd ::= SHOW CLUSTER MACHINES */ - 385, /* (292) cmd ::= SHOW CREATE DATABASE db_name */ - 385, /* (293) cmd ::= SHOW CREATE TABLE full_table_name */ - 385, /* (294) cmd ::= SHOW CREATE STABLE full_table_name */ - 385, /* (295) cmd ::= SHOW ENCRYPTIONS */ - 385, /* (296) cmd ::= SHOW QUERIES */ - 385, /* (297) cmd ::= SHOW SCORES */ - 385, /* (298) cmd ::= SHOW TOPICS */ - 385, /* (299) cmd ::= SHOW VARIABLES */ - 385, /* (300) cmd ::= SHOW CLUSTER VARIABLES */ - 385, /* (301) cmd ::= SHOW LOCAL VARIABLES */ - 385, /* (302) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ - 385, /* (303) cmd ::= SHOW BNODES */ - 385, /* (304) cmd ::= SHOW SNODES */ - 385, /* (305) cmd ::= SHOW CLUSTER */ - 385, /* (306) cmd ::= SHOW TRANSACTIONS */ - 385, /* (307) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ - 385, /* (308) cmd ::= SHOW CONSUMERS */ - 385, /* (309) cmd ::= SHOW SUBSCRIPTIONS */ - 385, /* (310) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ - 385, /* (311) cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ - 385, /* (312) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ - 385, /* (313) cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ - 385, /* (314) cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ - 385, /* (315) cmd ::= SHOW VNODES */ - 385, /* (316) cmd ::= SHOW db_name_cond_opt ALIVE */ - 385, /* (317) cmd ::= SHOW CLUSTER ALIVE */ - 385, /* (318) cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt */ - 385, /* (319) cmd ::= SHOW CREATE VIEW full_table_name */ - 385, /* (320) cmd ::= SHOW COMPACTS */ - 385, /* (321) cmd ::= SHOW COMPACT NK_INTEGER */ - 453, /* (322) table_kind_db_name_cond_opt ::= */ - 453, /* (323) table_kind_db_name_cond_opt ::= table_kind */ - 453, /* (324) table_kind_db_name_cond_opt ::= db_name NK_DOT */ - 453, /* (325) table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */ - 458, /* (326) table_kind ::= NORMAL */ - 458, /* (327) table_kind ::= CHILD */ - 455, /* (328) db_name_cond_opt ::= */ - 455, /* (329) db_name_cond_opt ::= db_name NK_DOT */ - 454, /* (330) like_pattern_opt ::= */ - 454, /* (331) like_pattern_opt ::= LIKE NK_STRING */ - 456, /* (332) table_name_cond ::= table_name */ - 457, /* (333) from_db_opt ::= */ - 457, /* (334) from_db_opt ::= FROM db_name */ - 427, /* (335) tag_list_opt ::= */ - 427, /* (336) tag_list_opt ::= tag_item */ - 427, /* (337) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ - 459, /* (338) tag_item ::= TBNAME */ - 459, /* (339) tag_item ::= QTAGS */ - 459, /* (340) tag_item ::= column_name */ - 459, /* (341) tag_item ::= column_name column_alias */ - 459, /* (342) tag_item ::= column_name AS column_alias */ - 452, /* (343) db_kind_opt ::= */ - 452, /* (344) db_kind_opt ::= USER */ - 452, /* (345) db_kind_opt ::= SYSTEM */ - 385, /* (346) cmd ::= CREATE TSMA not_exists_opt tsma_name ON full_table_name tsma_func_list INTERVAL NK_LP duration_literal NK_RP */ - 385, /* (347) cmd ::= CREATE RECURSIVE TSMA not_exists_opt tsma_name ON full_table_name INTERVAL NK_LP duration_literal NK_RP */ - 385, /* (348) cmd ::= DROP TSMA exists_opt full_tsma_name */ - 385, /* (349) cmd ::= SHOW db_name_cond_opt TSMAS */ - 463, /* (350) full_tsma_name ::= tsma_name */ - 463, /* (351) full_tsma_name ::= db_name NK_DOT tsma_name */ - 462, /* (352) tsma_func_list ::= FUNCTION NK_LP func_list NK_RP */ - 385, /* (353) cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */ - 385, /* (354) cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */ - 385, /* (355) cmd ::= DROP INDEX exists_opt full_index_name */ - 466, /* (356) full_index_name ::= index_name */ - 466, /* (357) full_index_name ::= db_name NK_DOT index_name */ - 465, /* (358) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ - 465, /* (359) 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 */ - 464, /* (360) func_list ::= func */ - 464, /* (361) func_list ::= func_list NK_COMMA func */ - 470, /* (362) func ::= sma_func_name NK_LP expression_list NK_RP */ - 471, /* (363) sma_func_name ::= function_name */ - 471, /* (364) sma_func_name ::= COUNT */ - 471, /* (365) sma_func_name ::= FIRST */ - 471, /* (366) sma_func_name ::= LAST */ - 471, /* (367) sma_func_name ::= LAST_ROW */ - 469, /* (368) sma_stream_opt ::= */ - 469, /* (369) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ - 469, /* (370) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ - 469, /* (371) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ - 473, /* (372) with_meta ::= AS */ - 473, /* (373) with_meta ::= WITH META AS */ - 473, /* (374) with_meta ::= ONLY META AS */ - 385, /* (375) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ - 385, /* (376) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ - 385, /* (377) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ - 385, /* (378) cmd ::= DROP TOPIC exists_opt topic_name */ - 385, /* (379) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ - 385, /* (380) cmd ::= DESC full_table_name */ - 385, /* (381) cmd ::= DESCRIBE full_table_name */ - 385, /* (382) cmd ::= RESET QUERY CACHE */ - 385, /* (383) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ - 385, /* (384) cmd ::= EXPLAIN analyze_opt explain_options insert_query */ - 477, /* (385) analyze_opt ::= */ - 477, /* (386) analyze_opt ::= ANALYZE */ - 478, /* (387) explain_options ::= */ - 478, /* (388) explain_options ::= explain_options VERBOSE NK_BOOL */ - 478, /* (389) explain_options ::= explain_options RATIO NK_FLOAT */ - 385, /* (390) cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ - 385, /* (391) cmd ::= DROP FUNCTION exists_opt function_name */ - 481, /* (392) agg_func_opt ::= */ - 481, /* (393) agg_func_opt ::= AGGREGATE */ - 482, /* (394) bufsize_opt ::= */ - 482, /* (395) bufsize_opt ::= BUFSIZE NK_INTEGER */ - 483, /* (396) language_opt ::= */ - 483, /* (397) language_opt ::= LANGUAGE NK_STRING */ - 480, /* (398) or_replace_opt ::= */ - 480, /* (399) or_replace_opt ::= OR REPLACE */ - 385, /* (400) cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */ - 385, /* (401) cmd ::= DROP VIEW exists_opt full_view_name */ - 484, /* (402) full_view_name ::= view_name */ - 484, /* (403) full_view_name ::= db_name NK_DOT view_name */ - 385, /* (404) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */ - 385, /* (405) cmd ::= DROP STREAM exists_opt stream_name */ - 385, /* (406) cmd ::= PAUSE STREAM exists_opt stream_name */ - 385, /* (407) cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ - 488, /* (408) col_list_opt ::= */ - 488, /* (409) col_list_opt ::= NK_LP column_stream_def_list NK_RP */ - 492, /* (410) column_stream_def_list ::= column_stream_def */ - 492, /* (411) column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def */ - 493, /* (412) column_stream_def ::= column_name stream_col_options */ - 494, /* (413) stream_col_options ::= */ - 494, /* (414) stream_col_options ::= stream_col_options PRIMARY KEY */ - 489, /* (415) tag_def_or_ref_opt ::= */ - 489, /* (416) tag_def_or_ref_opt ::= tags_def */ - 489, /* (417) tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP */ - 487, /* (418) stream_options ::= */ - 487, /* (419) stream_options ::= stream_options TRIGGER AT_ONCE */ - 487, /* (420) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ - 487, /* (421) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ - 487, /* (422) stream_options ::= stream_options WATERMARK duration_literal */ - 487, /* (423) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ - 487, /* (424) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ - 487, /* (425) stream_options ::= stream_options DELETE_MARK duration_literal */ - 487, /* (426) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ - 490, /* (427) subtable_opt ::= */ - 490, /* (428) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - 491, /* (429) ignore_opt ::= */ - 491, /* (430) ignore_opt ::= IGNORE UNTREATED */ - 385, /* (431) cmd ::= KILL CONNECTION NK_INTEGER */ - 385, /* (432) cmd ::= KILL QUERY NK_STRING */ - 385, /* (433) cmd ::= KILL TRANSACTION NK_INTEGER */ - 385, /* (434) cmd ::= KILL COMPACT NK_INTEGER */ - 385, /* (435) cmd ::= BALANCE VGROUP */ - 385, /* (436) cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ - 385, /* (437) cmd ::= BALANCE VGROUP LEADER DATABASE db_name */ - 385, /* (438) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ - 385, /* (439) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ - 385, /* (440) cmd ::= SPLIT VGROUP NK_INTEGER */ - 496, /* (441) on_vgroup_id ::= */ - 496, /* (442) on_vgroup_id ::= ON NK_INTEGER */ - 497, /* (443) dnode_list ::= DNODE NK_INTEGER */ - 497, /* (444) dnode_list ::= dnode_list DNODE NK_INTEGER */ - 385, /* (445) cmd ::= DELETE FROM full_table_name where_clause_opt */ - 385, /* (446) cmd ::= query_or_subquery */ - 385, /* (447) cmd ::= insert_query */ - 479, /* (448) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ - 479, /* (449) insert_query ::= INSERT INTO full_table_name query_or_subquery */ - 435, /* (450) tags_literal ::= NK_INTEGER */ - 435, /* (451) tags_literal ::= NK_INTEGER NK_PLUS duration_literal */ - 435, /* (452) tags_literal ::= NK_INTEGER NK_MINUS duration_literal */ - 435, /* (453) tags_literal ::= NK_PLUS NK_INTEGER */ - 435, /* (454) tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal */ - 435, /* (455) tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal */ - 435, /* (456) tags_literal ::= NK_MINUS NK_INTEGER */ - 435, /* (457) tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal */ - 435, /* (458) tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal */ - 435, /* (459) tags_literal ::= NK_FLOAT */ - 435, /* (460) tags_literal ::= NK_PLUS NK_FLOAT */ - 435, /* (461) tags_literal ::= NK_MINUS NK_FLOAT */ - 435, /* (462) tags_literal ::= NK_BIN */ - 435, /* (463) tags_literal ::= NK_BIN NK_PLUS duration_literal */ - 435, /* (464) tags_literal ::= NK_BIN NK_MINUS duration_literal */ - 435, /* (465) tags_literal ::= NK_PLUS NK_BIN */ - 435, /* (466) tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal */ - 435, /* (467) tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal */ - 435, /* (468) tags_literal ::= NK_MINUS NK_BIN */ - 435, /* (469) tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal */ - 435, /* (470) tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal */ - 435, /* (471) tags_literal ::= NK_HEX */ - 435, /* (472) tags_literal ::= NK_HEX NK_PLUS duration_literal */ - 435, /* (473) tags_literal ::= NK_HEX NK_MINUS duration_literal */ - 435, /* (474) tags_literal ::= NK_PLUS NK_HEX */ - 435, /* (475) tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal */ - 435, /* (476) tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal */ - 435, /* (477) tags_literal ::= NK_MINUS NK_HEX */ - 435, /* (478) tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal */ - 435, /* (479) tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal */ - 435, /* (480) tags_literal ::= NK_STRING */ - 435, /* (481) tags_literal ::= NK_STRING NK_PLUS duration_literal */ - 435, /* (482) tags_literal ::= NK_STRING NK_MINUS duration_literal */ - 435, /* (483) tags_literal ::= NK_BOOL */ - 435, /* (484) tags_literal ::= NULL */ - 435, /* (485) tags_literal ::= literal_func */ - 435, /* (486) tags_literal ::= literal_func NK_PLUS duration_literal */ - 435, /* (487) tags_literal ::= literal_func NK_MINUS duration_literal */ - 438, /* (488) tags_literal_list ::= tags_literal */ - 438, /* (489) tags_literal_list ::= tags_literal_list NK_COMMA tags_literal */ - 388, /* (490) literal ::= NK_INTEGER */ - 388, /* (491) literal ::= NK_FLOAT */ - 388, /* (492) literal ::= NK_STRING */ - 388, /* (493) literal ::= NK_BOOL */ - 388, /* (494) literal ::= TIMESTAMP NK_STRING */ - 388, /* (495) literal ::= duration_literal */ - 388, /* (496) literal ::= NULL */ - 388, /* (497) literal ::= NK_QUESTION */ - 448, /* (498) duration_literal ::= NK_VARIABLE */ - 419, /* (499) signed ::= NK_INTEGER */ - 419, /* (500) signed ::= NK_PLUS NK_INTEGER */ - 419, /* (501) signed ::= NK_MINUS NK_INTEGER */ - 419, /* (502) signed ::= NK_FLOAT */ - 419, /* (503) signed ::= NK_PLUS NK_FLOAT */ - 419, /* (504) signed ::= NK_MINUS NK_FLOAT */ - 499, /* (505) signed_literal ::= signed */ - 499, /* (506) signed_literal ::= NK_STRING */ - 499, /* (507) signed_literal ::= NK_BOOL */ - 499, /* (508) signed_literal ::= TIMESTAMP NK_STRING */ - 499, /* (509) signed_literal ::= duration_literal */ - 499, /* (510) signed_literal ::= NULL */ - 499, /* (511) signed_literal ::= literal_func */ - 499, /* (512) signed_literal ::= NK_QUESTION */ - 500, /* (513) literal_list ::= signed_literal */ - 500, /* (514) literal_list ::= literal_list NK_COMMA signed_literal */ - 402, /* (515) db_name ::= NK_ID */ - 403, /* (516) table_name ::= NK_ID */ - 432, /* (517) column_name ::= NK_ID */ - 450, /* (518) function_name ::= NK_ID */ - 485, /* (519) view_name ::= NK_ID */ - 501, /* (520) table_alias ::= NK_ID */ - 460, /* (521) column_alias ::= NK_ID */ - 460, /* (522) column_alias ::= NK_ALIAS */ - 395, /* (523) user_name ::= NK_ID */ - 404, /* (524) topic_name ::= NK_ID */ - 486, /* (525) stream_name ::= NK_ID */ - 476, /* (526) cgroup_name ::= NK_ID */ - 467, /* (527) index_name ::= NK_ID */ - 461, /* (528) tsma_name ::= NK_ID */ - 502, /* (529) expr_or_subquery ::= expression */ - 495, /* (530) expression ::= literal */ - 495, /* (531) expression ::= pseudo_column */ - 495, /* (532) expression ::= column_reference */ - 495, /* (533) expression ::= function_expression */ - 495, /* (534) expression ::= case_when_expression */ - 495, /* (535) expression ::= NK_LP expression NK_RP */ - 495, /* (536) expression ::= NK_PLUS expr_or_subquery */ - 495, /* (537) expression ::= NK_MINUS expr_or_subquery */ - 495, /* (538) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ - 495, /* (539) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ - 495, /* (540) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ - 495, /* (541) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ - 495, /* (542) expression ::= expr_or_subquery NK_REM expr_or_subquery */ - 495, /* (543) expression ::= column_reference NK_ARROW NK_STRING */ - 495, /* (544) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ - 495, /* (545) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ - 472, /* (546) expression_list ::= expr_or_subquery */ - 472, /* (547) expression_list ::= expression_list NK_COMMA expr_or_subquery */ - 504, /* (548) column_reference ::= column_name */ - 504, /* (549) column_reference ::= table_name NK_DOT column_name */ - 504, /* (550) column_reference ::= NK_ALIAS */ - 504, /* (551) column_reference ::= table_name NK_DOT NK_ALIAS */ - 503, /* (552) pseudo_column ::= ROWTS */ - 503, /* (553) pseudo_column ::= TBNAME */ - 503, /* (554) pseudo_column ::= table_name NK_DOT TBNAME */ - 503, /* (555) pseudo_column ::= QSTART */ - 503, /* (556) pseudo_column ::= QEND */ - 503, /* (557) pseudo_column ::= QDURATION */ - 503, /* (558) pseudo_column ::= WSTART */ - 503, /* (559) pseudo_column ::= WEND */ - 503, /* (560) pseudo_column ::= WDURATION */ - 503, /* (561) pseudo_column ::= IROWTS */ - 503, /* (562) pseudo_column ::= ISFILLED */ - 503, /* (563) pseudo_column ::= QTAGS */ - 505, /* (564) function_expression ::= function_name NK_LP expression_list NK_RP */ - 505, /* (565) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ - 505, /* (566) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ - 505, /* (567) function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP */ - 505, /* (568) function_expression ::= POSITION NK_LP expr_or_subquery IN expr_or_subquery NK_RP */ - 505, /* (569) function_expression ::= TRIM NK_LP expr_or_subquery NK_RP */ - 505, /* (570) function_expression ::= TRIM NK_LP trim_specification_type FROM expr_or_subquery NK_RP */ - 505, /* (571) function_expression ::= TRIM NK_LP expr_or_subquery FROM expr_or_subquery NK_RP */ - 505, /* (572) function_expression ::= TRIM NK_LP trim_specification_type expr_or_subquery FROM expr_or_subquery NK_RP */ - 505, /* (573) function_expression ::= substr_func NK_LP expression_list NK_RP */ - 505, /* (574) function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery NK_RP */ - 505, /* (575) function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery FOR expr_or_subquery NK_RP */ - 505, /* (576) function_expression ::= REPLACE NK_LP expression_list NK_RP */ - 505, /* (577) function_expression ::= literal_func */ - 498, /* (578) literal_func ::= noarg_func NK_LP NK_RP */ - 498, /* (579) literal_func ::= NOW */ - 498, /* (580) literal_func ::= TODAY */ - 510, /* (581) substr_func ::= SUBSTR */ - 510, /* (582) substr_func ::= SUBSTRING */ - 509, /* (583) trim_specification_type ::= BOTH */ - 509, /* (584) trim_specification_type ::= TRAILING */ - 509, /* (585) trim_specification_type ::= LEADING */ - 511, /* (586) noarg_func ::= NOW */ - 511, /* (587) noarg_func ::= TODAY */ - 511, /* (588) noarg_func ::= TIMEZONE */ - 511, /* (589) noarg_func ::= DATABASE */ - 511, /* (590) noarg_func ::= CLIENT_VERSION */ - 511, /* (591) noarg_func ::= SERVER_VERSION */ - 511, /* (592) noarg_func ::= SERVER_STATUS */ - 511, /* (593) noarg_func ::= CURRENT_USER */ - 511, /* (594) noarg_func ::= USER */ - 511, /* (595) noarg_func ::= PI */ - 507, /* (596) star_func ::= COUNT */ - 507, /* (597) star_func ::= FIRST */ - 507, /* (598) star_func ::= LAST */ - 507, /* (599) star_func ::= LAST_ROW */ - 508, /* (600) star_func_para_list ::= NK_STAR */ - 508, /* (601) star_func_para_list ::= other_para_list */ - 512, /* (602) other_para_list ::= star_func_para */ - 512, /* (603) other_para_list ::= other_para_list NK_COMMA star_func_para */ - 513, /* (604) star_func_para ::= expr_or_subquery */ - 513, /* (605) star_func_para ::= table_name NK_DOT NK_STAR */ - 506, /* (606) case_when_expression ::= CASE when_then_list case_when_else_opt END */ - 506, /* (607) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ - 514, /* (608) when_then_list ::= when_then_expr */ - 514, /* (609) when_then_list ::= when_then_list when_then_expr */ - 517, /* (610) when_then_expr ::= WHEN common_expression THEN common_expression */ - 515, /* (611) case_when_else_opt ::= */ - 515, /* (612) case_when_else_opt ::= ELSE common_expression */ - 518, /* (613) predicate ::= expr_or_subquery compare_op expr_or_subquery */ - 518, /* (614) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ - 518, /* (615) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ - 518, /* (616) predicate ::= expr_or_subquery IS NULL */ - 518, /* (617) predicate ::= expr_or_subquery IS NOT NULL */ - 518, /* (618) predicate ::= expr_or_subquery in_op in_predicate_value */ - 519, /* (619) compare_op ::= NK_LT */ - 519, /* (620) compare_op ::= NK_GT */ - 519, /* (621) compare_op ::= NK_LE */ - 519, /* (622) compare_op ::= NK_GE */ - 519, /* (623) compare_op ::= NK_NE */ - 519, /* (624) compare_op ::= NK_EQ */ - 519, /* (625) compare_op ::= LIKE */ - 519, /* (626) compare_op ::= NOT LIKE */ - 519, /* (627) compare_op ::= MATCH */ - 519, /* (628) compare_op ::= NMATCH */ - 519, /* (629) compare_op ::= CONTAINS */ - 520, /* (630) in_op ::= IN */ - 520, /* (631) in_op ::= NOT IN */ - 521, /* (632) in_predicate_value ::= NK_LP literal_list NK_RP */ - 522, /* (633) boolean_value_expression ::= boolean_primary */ - 522, /* (634) boolean_value_expression ::= NOT boolean_primary */ - 522, /* (635) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - 522, /* (636) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - 523, /* (637) boolean_primary ::= predicate */ - 523, /* (638) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ - 516, /* (639) common_expression ::= expr_or_subquery */ - 516, /* (640) common_expression ::= boolean_value_expression */ - 524, /* (641) from_clause_opt ::= */ - 524, /* (642) from_clause_opt ::= FROM table_reference_list */ - 525, /* (643) table_reference_list ::= table_reference */ - 525, /* (644) table_reference_list ::= table_reference_list NK_COMMA table_reference */ - 526, /* (645) table_reference ::= table_primary */ - 526, /* (646) table_reference ::= joined_table */ - 527, /* (647) table_primary ::= table_name alias_opt */ - 527, /* (648) table_primary ::= db_name NK_DOT table_name alias_opt */ - 527, /* (649) table_primary ::= subquery alias_opt */ - 527, /* (650) table_primary ::= parenthesized_joined_table */ - 529, /* (651) alias_opt ::= */ - 529, /* (652) alias_opt ::= table_alias */ - 529, /* (653) alias_opt ::= AS table_alias */ - 531, /* (654) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - 531, /* (655) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ - 528, /* (656) joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt */ - 532, /* (657) join_type ::= */ - 532, /* (658) join_type ::= INNER */ - 532, /* (659) join_type ::= LEFT */ - 532, /* (660) join_type ::= RIGHT */ - 532, /* (661) join_type ::= FULL */ - 533, /* (662) join_subtype ::= */ - 533, /* (663) join_subtype ::= OUTER */ - 533, /* (664) join_subtype ::= SEMI */ - 533, /* (665) join_subtype ::= ANTI */ - 533, /* (666) join_subtype ::= ASOF */ - 533, /* (667) join_subtype ::= WINDOW */ - 534, /* (668) join_on_clause_opt ::= */ - 534, /* (669) join_on_clause_opt ::= ON search_condition */ - 535, /* (670) window_offset_clause_opt ::= */ - 535, /* (671) window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP */ - 537, /* (672) window_offset_literal ::= NK_VARIABLE */ - 537, /* (673) window_offset_literal ::= NK_MINUS NK_VARIABLE */ - 536, /* (674) jlimit_clause_opt ::= */ - 536, /* (675) jlimit_clause_opt ::= JLIMIT NK_INTEGER */ - 538, /* (676) query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_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 */ - 539, /* (677) hint_list ::= */ - 539, /* (678) hint_list ::= NK_HINT */ - 541, /* (679) tag_mode_opt ::= */ - 541, /* (680) tag_mode_opt ::= TAGS */ - 540, /* (681) set_quantifier_opt ::= */ - 540, /* (682) set_quantifier_opt ::= DISTINCT */ - 540, /* (683) set_quantifier_opt ::= ALL */ - 542, /* (684) select_list ::= select_item */ - 542, /* (685) select_list ::= select_list NK_COMMA select_item */ - 550, /* (686) select_item ::= NK_STAR */ - 550, /* (687) select_item ::= common_expression */ - 550, /* (688) select_item ::= common_expression column_alias */ - 550, /* (689) select_item ::= common_expression AS column_alias */ - 550, /* (690) select_item ::= table_name NK_DOT NK_STAR */ - 475, /* (691) where_clause_opt ::= */ - 475, /* (692) where_clause_opt ::= WHERE search_condition */ - 543, /* (693) partition_by_clause_opt ::= */ - 543, /* (694) partition_by_clause_opt ::= PARTITION BY partition_list */ - 551, /* (695) partition_list ::= partition_item */ - 551, /* (696) partition_list ::= partition_list NK_COMMA partition_item */ - 552, /* (697) partition_item ::= expr_or_subquery */ - 552, /* (698) partition_item ::= expr_or_subquery column_alias */ - 552, /* (699) partition_item ::= expr_or_subquery AS column_alias */ - 547, /* (700) twindow_clause_opt ::= */ - 547, /* (701) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ - 547, /* (702) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ - 547, /* (703) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ - 547, /* (704) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ - 547, /* (705) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ - 547, /* (706) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */ - 547, /* (707) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - 468, /* (708) sliding_opt ::= */ - 468, /* (709) sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ - 553, /* (710) interval_sliding_duration_literal ::= NK_VARIABLE */ - 553, /* (711) interval_sliding_duration_literal ::= NK_STRING */ - 553, /* (712) interval_sliding_duration_literal ::= NK_INTEGER */ - 546, /* (713) fill_opt ::= */ - 546, /* (714) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - 546, /* (715) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ - 546, /* (716) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ - 554, /* (717) fill_mode ::= NONE */ - 554, /* (718) fill_mode ::= PREV */ - 554, /* (719) fill_mode ::= NULL */ - 554, /* (720) fill_mode ::= NULL_F */ - 554, /* (721) fill_mode ::= LINEAR */ - 554, /* (722) fill_mode ::= NEXT */ - 548, /* (723) group_by_clause_opt ::= */ - 548, /* (724) group_by_clause_opt ::= GROUP BY group_by_list */ - 555, /* (725) group_by_list ::= expr_or_subquery */ - 555, /* (726) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ - 549, /* (727) having_clause_opt ::= */ - 549, /* (728) having_clause_opt ::= HAVING search_condition */ - 544, /* (729) range_opt ::= */ - 544, /* (730) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ - 544, /* (731) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ - 545, /* (732) every_opt ::= */ - 545, /* (733) every_opt ::= EVERY NK_LP duration_literal NK_RP */ - 556, /* (734) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ - 557, /* (735) query_simple ::= query_specification */ - 557, /* (736) query_simple ::= union_query_expression */ - 561, /* (737) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ - 561, /* (738) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ - 562, /* (739) query_simple_or_subquery ::= query_simple */ - 562, /* (740) query_simple_or_subquery ::= subquery */ - 474, /* (741) query_or_subquery ::= query_expression */ - 474, /* (742) query_or_subquery ::= subquery */ - 558, /* (743) order_by_clause_opt ::= */ - 558, /* (744) order_by_clause_opt ::= ORDER BY sort_specification_list */ - 559, /* (745) slimit_clause_opt ::= */ - 559, /* (746) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - 559, /* (747) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - 559, /* (748) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - 560, /* (749) limit_clause_opt ::= */ - 560, /* (750) limit_clause_opt ::= LIMIT NK_INTEGER */ - 560, /* (751) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - 560, /* (752) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - 530, /* (753) subquery ::= NK_LP query_expression NK_RP */ - 530, /* (754) subquery ::= NK_LP subquery NK_RP */ - 405, /* (755) search_condition ::= common_expression */ - 563, /* (756) sort_specification_list ::= sort_specification */ - 563, /* (757) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - 564, /* (758) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ - 565, /* (759) ordering_specification_opt ::= */ - 565, /* (760) ordering_specification_opt ::= ASC */ - 565, /* (761) ordering_specification_opt ::= DESC */ - 566, /* (762) null_ordering_opt ::= */ - 566, /* (763) null_ordering_opt ::= NULLS FIRST */ - 566, /* (764) null_ordering_opt ::= NULLS LAST */ - 434, /* (765) column_options ::= */ - 434, /* (766) column_options ::= column_options PRIMARY KEY */ - 434, /* (767) column_options ::= column_options ENCODE NK_STRING */ - 434, /* (768) column_options ::= column_options COMPRESS NK_STRING */ - 434, /* (769) column_options ::= column_options LEVEL NK_STRING */ ->>>>>>> f143f5f1bcee3e814ef83fc3d942a3eab3c2417b }; /* For rule J, yyRuleInfoNRhs[J] contains the negative of the number @@ -8112,7 +5470,6 @@ static const signed char yyRuleInfoNRhs[] = { -1, /* (416) tag_def_or_ref_opt ::= tags_def */ -4, /* (417) tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP */ 0, /* (418) stream_options ::= */ -<<<<<<< HEAD -3, /* (419) stream_options ::= stream_options TRIGGER AT_ONCE */ -3, /* (420) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ -3, /* (421) stream_options ::= stream_options TRIGGER FORCE_WINDOW_CLOSE */ @@ -8266,18 +5623,18 @@ static const signed char yyRuleInfoNRhs[] = { -6, /* (569) function_expression ::= POSITION NK_LP expr_or_subquery IN expr_or_subquery NK_RP */ -4, /* (570) function_expression ::= TRIM NK_LP expr_or_subquery NK_RP */ -6, /* (571) function_expression ::= TRIM NK_LP trim_specification_type FROM expr_or_subquery NK_RP */ - -7, /* (572) function_expression ::= TRIM NK_LP trim_specification_type expr_or_subquery FROM expr_or_subquery NK_RP */ - -4, /* (573) function_expression ::= substr_func NK_LP expression_list NK_RP */ - -6, /* (574) function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery NK_RP */ - -8, /* (575) function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery FOR expr_or_subquery NK_RP */ - -4, /* (576) function_expression ::= REPLACE NK_LP expression_list NK_RP */ - -1, /* (577) function_expression ::= literal_func */ - -3, /* (578) literal_func ::= noarg_func NK_LP NK_RP */ - -1, /* (579) literal_func ::= NOW */ - -1, /* (580) literal_func ::= TODAY */ - -1, /* (581) substr_func ::= SUBSTR */ - -1, /* (582) substr_func ::= SUBSTRING */ - 0, /* (583) trim_specification_type ::= */ + -6, /* (572) function_expression ::= TRIM NK_LP expr_or_subquery FROM expr_or_subquery NK_RP */ + -7, /* (573) function_expression ::= TRIM NK_LP trim_specification_type expr_or_subquery FROM expr_or_subquery NK_RP */ + -4, /* (574) function_expression ::= substr_func NK_LP expression_list NK_RP */ + -6, /* (575) function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery NK_RP */ + -8, /* (576) function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery FOR expr_or_subquery NK_RP */ + -4, /* (577) function_expression ::= REPLACE NK_LP expression_list NK_RP */ + -1, /* (578) function_expression ::= literal_func */ + -3, /* (579) literal_func ::= noarg_func NK_LP NK_RP */ + -1, /* (580) literal_func ::= NOW */ + -1, /* (581) literal_func ::= TODAY */ + -1, /* (582) substr_func ::= SUBSTR */ + -1, /* (583) substr_func ::= SUBSTRING */ -1, /* (584) trim_specification_type ::= BOTH */ -1, /* (585) trim_specification_type ::= TRAILING */ -1, /* (586) trim_specification_type ::= LEADING */ @@ -8465,359 +5822,6 @@ static const signed char yyRuleInfoNRhs[] = { -3, /* (768) column_options ::= column_options ENCODE NK_STRING */ -3, /* (769) column_options ::= column_options COMPRESS NK_STRING */ -3, /* (770) column_options ::= column_options LEVEL NK_STRING */ -======= - -3, /* (419) stream_options ::= stream_options TRIGGER AT_ONCE */ - -3, /* (420) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ - -4, /* (421) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ - -3, /* (422) stream_options ::= stream_options WATERMARK duration_literal */ - -4, /* (423) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ - -3, /* (424) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ - -3, /* (425) stream_options ::= stream_options DELETE_MARK duration_literal */ - -4, /* (426) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ - 0, /* (427) subtable_opt ::= */ - -4, /* (428) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - 0, /* (429) ignore_opt ::= */ - -2, /* (430) ignore_opt ::= IGNORE UNTREATED */ - -3, /* (431) cmd ::= KILL CONNECTION NK_INTEGER */ - -3, /* (432) cmd ::= KILL QUERY NK_STRING */ - -3, /* (433) cmd ::= KILL TRANSACTION NK_INTEGER */ - -3, /* (434) cmd ::= KILL COMPACT NK_INTEGER */ - -2, /* (435) cmd ::= BALANCE VGROUP */ - -4, /* (436) cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ - -5, /* (437) cmd ::= BALANCE VGROUP LEADER DATABASE db_name */ - -4, /* (438) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ - -4, /* (439) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ - -3, /* (440) cmd ::= SPLIT VGROUP NK_INTEGER */ - 0, /* (441) on_vgroup_id ::= */ - -2, /* (442) on_vgroup_id ::= ON NK_INTEGER */ - -2, /* (443) dnode_list ::= DNODE NK_INTEGER */ - -3, /* (444) dnode_list ::= dnode_list DNODE NK_INTEGER */ - -4, /* (445) cmd ::= DELETE FROM full_table_name where_clause_opt */ - -1, /* (446) cmd ::= query_or_subquery */ - -1, /* (447) cmd ::= insert_query */ - -7, /* (448) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ - -4, /* (449) insert_query ::= INSERT INTO full_table_name query_or_subquery */ - -1, /* (450) tags_literal ::= NK_INTEGER */ - -3, /* (451) tags_literal ::= NK_INTEGER NK_PLUS duration_literal */ - -3, /* (452) tags_literal ::= NK_INTEGER NK_MINUS duration_literal */ - -2, /* (453) tags_literal ::= NK_PLUS NK_INTEGER */ - -4, /* (454) tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal */ - -4, /* (455) tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal */ - -2, /* (456) tags_literal ::= NK_MINUS NK_INTEGER */ - -4, /* (457) tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal */ - -4, /* (458) tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal */ - -1, /* (459) tags_literal ::= NK_FLOAT */ - -2, /* (460) tags_literal ::= NK_PLUS NK_FLOAT */ - -2, /* (461) tags_literal ::= NK_MINUS NK_FLOAT */ - -1, /* (462) tags_literal ::= NK_BIN */ - -3, /* (463) tags_literal ::= NK_BIN NK_PLUS duration_literal */ - -3, /* (464) tags_literal ::= NK_BIN NK_MINUS duration_literal */ - -2, /* (465) tags_literal ::= NK_PLUS NK_BIN */ - -4, /* (466) tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal */ - -4, /* (467) tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal */ - -2, /* (468) tags_literal ::= NK_MINUS NK_BIN */ - -4, /* (469) tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal */ - -4, /* (470) tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal */ - -1, /* (471) tags_literal ::= NK_HEX */ - -3, /* (472) tags_literal ::= NK_HEX NK_PLUS duration_literal */ - -3, /* (473) tags_literal ::= NK_HEX NK_MINUS duration_literal */ - -2, /* (474) tags_literal ::= NK_PLUS NK_HEX */ - -4, /* (475) tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal */ - -4, /* (476) tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal */ - -2, /* (477) tags_literal ::= NK_MINUS NK_HEX */ - -4, /* (478) tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal */ - -4, /* (479) tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal */ - -1, /* (480) tags_literal ::= NK_STRING */ - -3, /* (481) tags_literal ::= NK_STRING NK_PLUS duration_literal */ - -3, /* (482) tags_literal ::= NK_STRING NK_MINUS duration_literal */ - -1, /* (483) tags_literal ::= NK_BOOL */ - -1, /* (484) tags_literal ::= NULL */ - -1, /* (485) tags_literal ::= literal_func */ - -3, /* (486) tags_literal ::= literal_func NK_PLUS duration_literal */ - -3, /* (487) tags_literal ::= literal_func NK_MINUS duration_literal */ - -1, /* (488) tags_literal_list ::= tags_literal */ - -3, /* (489) tags_literal_list ::= tags_literal_list NK_COMMA tags_literal */ - -1, /* (490) literal ::= NK_INTEGER */ - -1, /* (491) literal ::= NK_FLOAT */ - -1, /* (492) literal ::= NK_STRING */ - -1, /* (493) literal ::= NK_BOOL */ - -2, /* (494) literal ::= TIMESTAMP NK_STRING */ - -1, /* (495) literal ::= duration_literal */ - -1, /* (496) literal ::= NULL */ - -1, /* (497) literal ::= NK_QUESTION */ - -1, /* (498) duration_literal ::= NK_VARIABLE */ - -1, /* (499) signed ::= NK_INTEGER */ - -2, /* (500) signed ::= NK_PLUS NK_INTEGER */ - -2, /* (501) signed ::= NK_MINUS NK_INTEGER */ - -1, /* (502) signed ::= NK_FLOAT */ - -2, /* (503) signed ::= NK_PLUS NK_FLOAT */ - -2, /* (504) signed ::= NK_MINUS NK_FLOAT */ - -1, /* (505) signed_literal ::= signed */ - -1, /* (506) signed_literal ::= NK_STRING */ - -1, /* (507) signed_literal ::= NK_BOOL */ - -2, /* (508) signed_literal ::= TIMESTAMP NK_STRING */ - -1, /* (509) signed_literal ::= duration_literal */ - -1, /* (510) signed_literal ::= NULL */ - -1, /* (511) signed_literal ::= literal_func */ - -1, /* (512) signed_literal ::= NK_QUESTION */ - -1, /* (513) literal_list ::= signed_literal */ - -3, /* (514) literal_list ::= literal_list NK_COMMA signed_literal */ - -1, /* (515) db_name ::= NK_ID */ - -1, /* (516) table_name ::= NK_ID */ - -1, /* (517) column_name ::= NK_ID */ - -1, /* (518) function_name ::= NK_ID */ - -1, /* (519) view_name ::= NK_ID */ - -1, /* (520) table_alias ::= NK_ID */ - -1, /* (521) column_alias ::= NK_ID */ - -1, /* (522) column_alias ::= NK_ALIAS */ - -1, /* (523) user_name ::= NK_ID */ - -1, /* (524) topic_name ::= NK_ID */ - -1, /* (525) stream_name ::= NK_ID */ - -1, /* (526) cgroup_name ::= NK_ID */ - -1, /* (527) index_name ::= NK_ID */ - -1, /* (528) tsma_name ::= NK_ID */ - -1, /* (529) expr_or_subquery ::= expression */ - -1, /* (530) expression ::= literal */ - -1, /* (531) expression ::= pseudo_column */ - -1, /* (532) expression ::= column_reference */ - -1, /* (533) expression ::= function_expression */ - -1, /* (534) expression ::= case_when_expression */ - -3, /* (535) expression ::= NK_LP expression NK_RP */ - -2, /* (536) expression ::= NK_PLUS expr_or_subquery */ - -2, /* (537) expression ::= NK_MINUS expr_or_subquery */ - -3, /* (538) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ - -3, /* (539) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ - -3, /* (540) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ - -3, /* (541) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ - -3, /* (542) expression ::= expr_or_subquery NK_REM expr_or_subquery */ - -3, /* (543) expression ::= column_reference NK_ARROW NK_STRING */ - -3, /* (544) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ - -3, /* (545) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ - -1, /* (546) expression_list ::= expr_or_subquery */ - -3, /* (547) expression_list ::= expression_list NK_COMMA expr_or_subquery */ - -1, /* (548) column_reference ::= column_name */ - -3, /* (549) column_reference ::= table_name NK_DOT column_name */ - -1, /* (550) column_reference ::= NK_ALIAS */ - -3, /* (551) column_reference ::= table_name NK_DOT NK_ALIAS */ - -1, /* (552) pseudo_column ::= ROWTS */ - -1, /* (553) pseudo_column ::= TBNAME */ - -3, /* (554) pseudo_column ::= table_name NK_DOT TBNAME */ - -1, /* (555) pseudo_column ::= QSTART */ - -1, /* (556) pseudo_column ::= QEND */ - -1, /* (557) pseudo_column ::= QDURATION */ - -1, /* (558) pseudo_column ::= WSTART */ - -1, /* (559) pseudo_column ::= WEND */ - -1, /* (560) pseudo_column ::= WDURATION */ - -1, /* (561) pseudo_column ::= IROWTS */ - -1, /* (562) pseudo_column ::= ISFILLED */ - -1, /* (563) pseudo_column ::= QTAGS */ - -4, /* (564) function_expression ::= function_name NK_LP expression_list NK_RP */ - -4, /* (565) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ - -6, /* (566) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ - -6, /* (567) function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP */ - -6, /* (568) function_expression ::= POSITION NK_LP expr_or_subquery IN expr_or_subquery NK_RP */ - -4, /* (569) function_expression ::= TRIM NK_LP expr_or_subquery NK_RP */ - -6, /* (570) function_expression ::= TRIM NK_LP trim_specification_type FROM expr_or_subquery NK_RP */ - -6, /* (571) function_expression ::= TRIM NK_LP expr_or_subquery FROM expr_or_subquery NK_RP */ - -7, /* (572) function_expression ::= TRIM NK_LP trim_specification_type expr_or_subquery FROM expr_or_subquery NK_RP */ - -4, /* (573) function_expression ::= substr_func NK_LP expression_list NK_RP */ - -6, /* (574) function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery NK_RP */ - -8, /* (575) function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery FOR expr_or_subquery NK_RP */ - -4, /* (576) function_expression ::= REPLACE NK_LP expression_list NK_RP */ - -1, /* (577) function_expression ::= literal_func */ - -3, /* (578) literal_func ::= noarg_func NK_LP NK_RP */ - -1, /* (579) literal_func ::= NOW */ - -1, /* (580) literal_func ::= TODAY */ - -1, /* (581) substr_func ::= SUBSTR */ - -1, /* (582) substr_func ::= SUBSTRING */ - -1, /* (583) trim_specification_type ::= BOTH */ - -1, /* (584) trim_specification_type ::= TRAILING */ - -1, /* (585) trim_specification_type ::= LEADING */ - -1, /* (586) noarg_func ::= NOW */ - -1, /* (587) noarg_func ::= TODAY */ - -1, /* (588) noarg_func ::= TIMEZONE */ - -1, /* (589) noarg_func ::= DATABASE */ - -1, /* (590) noarg_func ::= CLIENT_VERSION */ - -1, /* (591) noarg_func ::= SERVER_VERSION */ - -1, /* (592) noarg_func ::= SERVER_STATUS */ - -1, /* (593) noarg_func ::= CURRENT_USER */ - -1, /* (594) noarg_func ::= USER */ - -1, /* (595) noarg_func ::= PI */ - -1, /* (596) star_func ::= COUNT */ - -1, /* (597) star_func ::= FIRST */ - -1, /* (598) star_func ::= LAST */ - -1, /* (599) star_func ::= LAST_ROW */ - -1, /* (600) star_func_para_list ::= NK_STAR */ - -1, /* (601) star_func_para_list ::= other_para_list */ - -1, /* (602) other_para_list ::= star_func_para */ - -3, /* (603) other_para_list ::= other_para_list NK_COMMA star_func_para */ - -1, /* (604) star_func_para ::= expr_or_subquery */ - -3, /* (605) star_func_para ::= table_name NK_DOT NK_STAR */ - -4, /* (606) case_when_expression ::= CASE when_then_list case_when_else_opt END */ - -5, /* (607) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ - -1, /* (608) when_then_list ::= when_then_expr */ - -2, /* (609) when_then_list ::= when_then_list when_then_expr */ - -4, /* (610) when_then_expr ::= WHEN common_expression THEN common_expression */ - 0, /* (611) case_when_else_opt ::= */ - -2, /* (612) case_when_else_opt ::= ELSE common_expression */ - -3, /* (613) predicate ::= expr_or_subquery compare_op expr_or_subquery */ - -5, /* (614) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ - -6, /* (615) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ - -3, /* (616) predicate ::= expr_or_subquery IS NULL */ - -4, /* (617) predicate ::= expr_or_subquery IS NOT NULL */ - -3, /* (618) predicate ::= expr_or_subquery in_op in_predicate_value */ - -1, /* (619) compare_op ::= NK_LT */ - -1, /* (620) compare_op ::= NK_GT */ - -1, /* (621) compare_op ::= NK_LE */ - -1, /* (622) compare_op ::= NK_GE */ - -1, /* (623) compare_op ::= NK_NE */ - -1, /* (624) compare_op ::= NK_EQ */ - -1, /* (625) compare_op ::= LIKE */ - -2, /* (626) compare_op ::= NOT LIKE */ - -1, /* (627) compare_op ::= MATCH */ - -1, /* (628) compare_op ::= NMATCH */ - -1, /* (629) compare_op ::= CONTAINS */ - -1, /* (630) in_op ::= IN */ - -2, /* (631) in_op ::= NOT IN */ - -3, /* (632) in_predicate_value ::= NK_LP literal_list NK_RP */ - -1, /* (633) boolean_value_expression ::= boolean_primary */ - -2, /* (634) boolean_value_expression ::= NOT boolean_primary */ - -3, /* (635) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - -3, /* (636) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - -1, /* (637) boolean_primary ::= predicate */ - -3, /* (638) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ - -1, /* (639) common_expression ::= expr_or_subquery */ - -1, /* (640) common_expression ::= boolean_value_expression */ - 0, /* (641) from_clause_opt ::= */ - -2, /* (642) from_clause_opt ::= FROM table_reference_list */ - -1, /* (643) table_reference_list ::= table_reference */ - -3, /* (644) table_reference_list ::= table_reference_list NK_COMMA table_reference */ - -1, /* (645) table_reference ::= table_primary */ - -1, /* (646) table_reference ::= joined_table */ - -2, /* (647) table_primary ::= table_name alias_opt */ - -4, /* (648) table_primary ::= db_name NK_DOT table_name alias_opt */ - -2, /* (649) table_primary ::= subquery alias_opt */ - -1, /* (650) table_primary ::= parenthesized_joined_table */ - 0, /* (651) alias_opt ::= */ - -1, /* (652) alias_opt ::= table_alias */ - -2, /* (653) alias_opt ::= AS table_alias */ - -3, /* (654) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - -3, /* (655) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ - -8, /* (656) joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt */ - 0, /* (657) join_type ::= */ - -1, /* (658) join_type ::= INNER */ - -1, /* (659) join_type ::= LEFT */ - -1, /* (660) join_type ::= RIGHT */ - -1, /* (661) join_type ::= FULL */ - 0, /* (662) join_subtype ::= */ - -1, /* (663) join_subtype ::= OUTER */ - -1, /* (664) join_subtype ::= SEMI */ - -1, /* (665) join_subtype ::= ANTI */ - -1, /* (666) join_subtype ::= ASOF */ - -1, /* (667) join_subtype ::= WINDOW */ - 0, /* (668) join_on_clause_opt ::= */ - -2, /* (669) join_on_clause_opt ::= ON search_condition */ - 0, /* (670) window_offset_clause_opt ::= */ - -6, /* (671) window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP */ - -1, /* (672) window_offset_literal ::= NK_VARIABLE */ - -2, /* (673) window_offset_literal ::= NK_MINUS NK_VARIABLE */ - 0, /* (674) jlimit_clause_opt ::= */ - -2, /* (675) jlimit_clause_opt ::= JLIMIT NK_INTEGER */ - -14, /* (676) query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_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 */ - 0, /* (677) hint_list ::= */ - -1, /* (678) hint_list ::= NK_HINT */ - 0, /* (679) tag_mode_opt ::= */ - -1, /* (680) tag_mode_opt ::= TAGS */ - 0, /* (681) set_quantifier_opt ::= */ - -1, /* (682) set_quantifier_opt ::= DISTINCT */ - -1, /* (683) set_quantifier_opt ::= ALL */ - -1, /* (684) select_list ::= select_item */ - -3, /* (685) select_list ::= select_list NK_COMMA select_item */ - -1, /* (686) select_item ::= NK_STAR */ - -1, /* (687) select_item ::= common_expression */ - -2, /* (688) select_item ::= common_expression column_alias */ - -3, /* (689) select_item ::= common_expression AS column_alias */ - -3, /* (690) select_item ::= table_name NK_DOT NK_STAR */ - 0, /* (691) where_clause_opt ::= */ - -2, /* (692) where_clause_opt ::= WHERE search_condition */ - 0, /* (693) partition_by_clause_opt ::= */ - -3, /* (694) partition_by_clause_opt ::= PARTITION BY partition_list */ - -1, /* (695) partition_list ::= partition_item */ - -3, /* (696) partition_list ::= partition_list NK_COMMA partition_item */ - -1, /* (697) partition_item ::= expr_or_subquery */ - -2, /* (698) partition_item ::= expr_or_subquery column_alias */ - -3, /* (699) partition_item ::= expr_or_subquery AS column_alias */ - 0, /* (700) twindow_clause_opt ::= */ - -6, /* (701) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ - -4, /* (702) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ - -6, /* (703) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ - -8, /* (704) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ - -7, /* (705) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ - -4, /* (706) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */ - -6, /* (707) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - 0, /* (708) sliding_opt ::= */ - -4, /* (709) sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ - -1, /* (710) interval_sliding_duration_literal ::= NK_VARIABLE */ - -1, /* (711) interval_sliding_duration_literal ::= NK_STRING */ - -1, /* (712) interval_sliding_duration_literal ::= NK_INTEGER */ - 0, /* (713) fill_opt ::= */ - -4, /* (714) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - -6, /* (715) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ - -6, /* (716) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ - -1, /* (717) fill_mode ::= NONE */ - -1, /* (718) fill_mode ::= PREV */ - -1, /* (719) fill_mode ::= NULL */ - -1, /* (720) fill_mode ::= NULL_F */ - -1, /* (721) fill_mode ::= LINEAR */ - -1, /* (722) fill_mode ::= NEXT */ - 0, /* (723) group_by_clause_opt ::= */ - -3, /* (724) group_by_clause_opt ::= GROUP BY group_by_list */ - -1, /* (725) group_by_list ::= expr_or_subquery */ - -3, /* (726) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ - 0, /* (727) having_clause_opt ::= */ - -2, /* (728) having_clause_opt ::= HAVING search_condition */ - 0, /* (729) range_opt ::= */ - -6, /* (730) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ - -4, /* (731) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ - 0, /* (732) every_opt ::= */ - -4, /* (733) every_opt ::= EVERY NK_LP duration_literal NK_RP */ - -4, /* (734) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ - -1, /* (735) query_simple ::= query_specification */ - -1, /* (736) query_simple ::= union_query_expression */ - -4, /* (737) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ - -3, /* (738) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ - -1, /* (739) query_simple_or_subquery ::= query_simple */ - -1, /* (740) query_simple_or_subquery ::= subquery */ - -1, /* (741) query_or_subquery ::= query_expression */ - -1, /* (742) query_or_subquery ::= subquery */ - 0, /* (743) order_by_clause_opt ::= */ - -3, /* (744) order_by_clause_opt ::= ORDER BY sort_specification_list */ - 0, /* (745) slimit_clause_opt ::= */ - -2, /* (746) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - -4, /* (747) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - -4, /* (748) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - 0, /* (749) limit_clause_opt ::= */ - -2, /* (750) limit_clause_opt ::= LIMIT NK_INTEGER */ - -4, /* (751) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - -4, /* (752) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - -3, /* (753) subquery ::= NK_LP query_expression NK_RP */ - -3, /* (754) subquery ::= NK_LP subquery NK_RP */ - -1, /* (755) search_condition ::= common_expression */ - -1, /* (756) sort_specification_list ::= sort_specification */ - -3, /* (757) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - -3, /* (758) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ - 0, /* (759) ordering_specification_opt ::= */ - -1, /* (760) ordering_specification_opt ::= ASC */ - -1, /* (761) ordering_specification_opt ::= DESC */ - 0, /* (762) null_ordering_opt ::= */ - -2, /* (763) null_ordering_opt ::= NULLS FIRST */ - -2, /* (764) null_ordering_opt ::= NULLS LAST */ - 0, /* (765) column_options ::= */ - -3, /* (766) column_options ::= column_options PRIMARY KEY */ - -3, /* (767) column_options ::= column_options ENCODE NK_STRING */ - -3, /* (768) column_options ::= column_options COMPRESS NK_STRING */ - -3, /* (769) column_options ::= column_options LEVEL NK_STRING */ ->>>>>>> f143f5f1bcee3e814ef83fc3d942a3eab3c2417b }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -8856,7 +5860,6 @@ static YYACTIONTYPE yy_reduce( ** { ... } // User supplied code ** #line ** break; -<<<<<<< HEAD */ /********** Begin reduce actions **********************************************/ YYMINORTYPE yylhsminor; @@ -9108,8 +6111,8 @@ static YYACTIONTYPE yy_reduce( case 527: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==527); case 528: /* index_name ::= NK_ID */ yytestcase(yyruleno==528); case 529: /* tsma_name ::= NK_ID */ yytestcase(yyruleno==529); - case 581: /* substr_func ::= SUBSTR */ yytestcase(yyruleno==581); - case 582: /* substr_func ::= SUBSTRING */ yytestcase(yyruleno==582); + case 582: /* substr_func ::= SUBSTR */ yytestcase(yyruleno==582); + case 583: /* substr_func ::= SUBSTRING */ yytestcase(yyruleno==583); case 587: /* noarg_func ::= NOW */ yytestcase(yyruleno==587); case 588: /* noarg_func ::= TODAY */ yytestcase(yyruleno==588); case 589: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==589); @@ -10361,7 +7364,7 @@ yymsp[0].minor.yy840); } case 533: /* expression ::= column_reference */ yytestcase(yyruleno==533); case 534: /* expression ::= function_expression */ yytestcase(yyruleno==534); case 535: /* expression ::= case_when_expression */ yytestcase(yyruleno==535); - case 577: /* function_expression ::= literal_func */ yytestcase(yyruleno==577); + case 578: /* function_expression ::= literal_func */ yytestcase(yyruleno==578); case 634: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==634); case 638: /* boolean_primary ::= predicate */ yytestcase(yyruleno==638); case 640: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==640); @@ -10566,8 +7569,8 @@ yymsp[0].minor.yy840); } case 562: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==562); case 563: /* pseudo_column ::= ISFILLED */ yytestcase(yyruleno==563); case 564: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==564); - case 579: /* literal_func ::= NOW */ yytestcase(yyruleno==579); - case 580: /* literal_func ::= TODAY */ yytestcase(yyruleno==580); + case 580: /* literal_func ::= NOW */ yytestcase(yyruleno==580); + case 581: /* literal_func ::= TODAY */ yytestcase(yyruleno==581); { yylhsminor.yy840 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } yymsp[0].minor.yy840 = yylhsminor.yy840; break; @@ -10577,7 +7580,7 @@ yymsp[0].minor.yy840); } break; case 565: /* function_expression ::= function_name NK_LP expression_list NK_RP */ case 566: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==566); - case 573: /* function_expression ::= substr_func NK_LP expression_list NK_RP */ yytestcase(yyruleno==573); + case 574: /* function_expression ::= substr_func NK_LP expression_list NK_RP */ yytestcase(yyruleno==574); { yylhsminor.yy840 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy209, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy209, yymsp[-1].minor.yy456)); } yymsp[-3].minor.yy840 = yylhsminor.yy840; break; @@ -10598,29 +7601,30 @@ yymsp[0].minor.yy840); } { yylhsminor.yy840 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createTrimFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy840), yymsp[-3].minor.yy512)); } yymsp[-5].minor.yy840 = yylhsminor.yy840; break; - case 572: /* function_expression ::= TRIM NK_LP trim_specification_type expr_or_subquery FROM expr_or_subquery NK_RP */ + case 572: /* function_expression ::= TRIM NK_LP expr_or_subquery FROM expr_or_subquery NK_RP */ +{ yylhsminor.yy840 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createTrimFunctionNodeExt(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy840), releaseRawExprNode(pCxt, yymsp[-1].minor.yy840), TRIM_TYPE_BOTH)); } + yymsp[-5].minor.yy840 = yylhsminor.yy840; + break; + case 573: /* function_expression ::= TRIM NK_LP trim_specification_type expr_or_subquery FROM expr_or_subquery NK_RP */ { yylhsminor.yy840 = createRawExprNodeExt(pCxt, &yymsp[-6].minor.yy0, &yymsp[0].minor.yy0, createTrimFunctionNodeExt(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy840), releaseRawExprNode(pCxt, yymsp[-1].minor.yy840), yymsp[-4].minor.yy512)); } yymsp[-6].minor.yy840 = yylhsminor.yy840; break; - case 574: /* function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery NK_RP */ + case 575: /* function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery NK_RP */ { yylhsminor.yy840 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy209, &yymsp[0].minor.yy0, createSubstrFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy840), releaseRawExprNode(pCxt, yymsp[-1].minor.yy840))); } yymsp[-5].minor.yy840 = yylhsminor.yy840; break; - case 575: /* function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery FOR expr_or_subquery NK_RP */ + case 576: /* function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery FOR expr_or_subquery NK_RP */ { yylhsminor.yy840 = createRawExprNodeExt(pCxt, &yymsp[-7].minor.yy209, &yymsp[0].minor.yy0, createSubstrFunctionNodeExt(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy840), releaseRawExprNode(pCxt, yymsp[-3].minor.yy840), releaseRawExprNode(pCxt, yymsp[-1].minor.yy840))); } yymsp[-7].minor.yy840 = yylhsminor.yy840; break; - case 576: /* function_expression ::= REPLACE NK_LP expression_list NK_RP */ + case 577: /* function_expression ::= REPLACE NK_LP expression_list NK_RP */ { yylhsminor.yy840 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy456)); } yymsp[-3].minor.yy840 = yylhsminor.yy840; break; - case 578: /* literal_func ::= noarg_func NK_LP NK_RP */ + case 579: /* literal_func ::= noarg_func NK_LP NK_RP */ { yylhsminor.yy840 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy209, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy209, NULL)); } yymsp[-2].minor.yy840 = yylhsminor.yy840; break; - case 583: /* trim_specification_type ::= */ -{ yymsp[1].minor.yy512 = TRIM_TYPE_BOTH; } - break; case 584: /* trim_specification_type ::= BOTH */ { yymsp[0].minor.yy512 = TRIM_TYPE_BOTH; } break; @@ -11015,2166 +8019,6 @@ yymsp[0].minor.yy840); } default: break; /********** End reduce actions ************************************************/ -======= - */ - /********** Begin reduce actions **********************************************/ - 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,386,&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,387,&yymsp[0].minor); - break; - case 2: /* account_options ::= */ - { } - break; - case 3: /* account_options ::= account_options PPS literal */ - case 4: /* account_options ::= account_options TSERIES literal */ yytestcase(yyruleno==4); - case 5: /* account_options ::= account_options STORAGE literal */ yytestcase(yyruleno==5); - case 6: /* account_options ::= account_options STREAMS literal */ yytestcase(yyruleno==6); - case 7: /* account_options ::= account_options QTIME literal */ yytestcase(yyruleno==7); - case 8: /* account_options ::= account_options DBS literal */ yytestcase(yyruleno==8); - 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,386,&yymsp[-2].minor); - { } - yy_destructor(yypParser,388,&yymsp[0].minor); - } - break; - case 12: /* alter_account_options ::= alter_account_option */ - { yy_destructor(yypParser,389,&yymsp[0].minor); - { } - } - break; - case 13: /* alter_account_options ::= alter_account_options alter_account_option */ - { yy_destructor(yypParser,387,&yymsp[-1].minor); - { } - yy_destructor(yypParser,389,&yymsp[0].minor); - } - break; - case 14: /* alter_account_option ::= PASS literal */ - case 15: /* alter_account_option ::= PPS literal */ yytestcase(yyruleno==15); - case 16: /* alter_account_option ::= TSERIES literal */ yytestcase(yyruleno==16); - case 17: /* alter_account_option ::= STORAGE literal */ yytestcase(yyruleno==17); - case 18: /* alter_account_option ::= STREAMS literal */ yytestcase(yyruleno==18); - case 19: /* alter_account_option ::= QTIME literal */ yytestcase(yyruleno==19); - case 20: /* alter_account_option ::= DBS literal */ yytestcase(yyruleno==20); - case 21: /* alter_account_option ::= USERS literal */ yytestcase(yyruleno==21); - case 22: /* alter_account_option ::= CONNS literal */ yytestcase(yyruleno==22); - case 23: /* alter_account_option ::= STATE literal */ yytestcase(yyruleno==23); - { } - yy_destructor(yypParser,388,&yymsp[0].minor); - break; - case 24: /* ip_range_list ::= NK_STRING */ - { yylhsminor.yy334 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy334 = yylhsminor.yy334; - break; - case 25: /* ip_range_list ::= ip_range_list NK_COMMA NK_STRING */ - { yylhsminor.yy334 = addNodeToList(pCxt, yymsp[-2].minor.yy334, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy334 = yylhsminor.yy334; - break; - case 26: /* white_list ::= HOST ip_range_list */ - { yymsp[-1].minor.yy334 = yymsp[0].minor.yy334; } - break; - case 27: /* white_list_opt ::= */ - case 206: /* specific_cols_opt ::= */ yytestcase(yyruleno==206); - case 244: /* tags_def_opt ::= */ yytestcase(yyruleno==244); - case 335: /* tag_list_opt ::= */ yytestcase(yyruleno==335); - case 408: /* col_list_opt ::= */ yytestcase(yyruleno==408); - case 415: /* tag_def_or_ref_opt ::= */ yytestcase(yyruleno==415); - case 693: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==693); - case 723: /* group_by_clause_opt ::= */ yytestcase(yyruleno==723); - case 743: /* order_by_clause_opt ::= */ yytestcase(yyruleno==743); - { yymsp[1].minor.yy334 = NULL; } - break; - case 28: /* white_list_opt ::= white_list */ - case 245: /* tags_def_opt ::= tags_def */ yytestcase(yyruleno==245); - case 416: /* tag_def_or_ref_opt ::= tags_def */ yytestcase(yyruleno==416); - case 601: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==601); - { yylhsminor.yy334 = yymsp[0].minor.yy334; } - yymsp[0].minor.yy334 = yylhsminor.yy334; - break; - case 29: /* is_import_opt ::= */ - case 31: /* is_createdb_opt ::= */ yytestcase(yyruleno==31); - { yymsp[1].minor.yy719 = 0; } - break; - case 30: /* is_import_opt ::= IS_IMPORT NK_INTEGER */ - case 32: /* is_createdb_opt ::= CREATEDB NK_INTEGER */ yytestcase(yyruleno==32); - case 42: /* sysinfo_opt ::= SYSINFO NK_INTEGER */ yytestcase(yyruleno==42); - { yymsp[-1].minor.yy719 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); } - break; - case 33: /* cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt is_createdb_opt is_import_opt white_list_opt */ - { - pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-6].minor.yy533, &yymsp[-4].minor.yy0, yymsp[-3].minor.yy719, yymsp[-1].minor.yy719, yymsp[-2].minor.yy719); - pCxt->pRootNode = addCreateUserStmtWhiteList(pCxt, pCxt->pRootNode, yymsp[0].minor.yy334); - } - break; - case 34: /* cmd ::= ALTER USER user_name PASS NK_STRING */ - { pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy533, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } - break; - case 35: /* cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ - { pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy533, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); } - break; - case 36: /* cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ - { pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy533, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); } - break; - case 37: /* cmd ::= ALTER USER user_name CREATEDB NK_INTEGER */ - { pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy533, TSDB_ALTER_USER_CREATEDB, &yymsp[0].minor.yy0); } - break; - case 38: /* cmd ::= ALTER USER user_name ADD white_list */ - { pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy533, TSDB_ALTER_USER_ADD_WHITE_LIST, yymsp[0].minor.yy334); } - break; - case 39: /* cmd ::= ALTER USER user_name DROP white_list */ - { pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy533, TSDB_ALTER_USER_DROP_WHITE_LIST, yymsp[0].minor.yy334); } - break; - case 40: /* cmd ::= DROP USER user_name */ - { pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy533); } - break; - case 41: /* sysinfo_opt ::= */ - { yymsp[1].minor.yy719 = 1; } - break; - case 43: /* cmd ::= GRANT privileges ON priv_level with_opt TO user_name */ - { pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-5].minor.yy585, &yymsp[-3].minor.yy399, &yymsp[0].minor.yy533, yymsp[-2].minor.yy560); } - break; - case 44: /* cmd ::= REVOKE privileges ON priv_level with_opt FROM user_name */ - { pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-5].minor.yy585, &yymsp[-3].minor.yy399, &yymsp[0].minor.yy533, yymsp[-2].minor.yy560); } - break; - case 45: /* privileges ::= ALL */ - { yymsp[0].minor.yy585 = PRIVILEGE_TYPE_ALL; } - break; - case 46: /* privileges ::= priv_type_list */ - case 48: /* priv_type_list ::= priv_type */ yytestcase(yyruleno==48); - { yylhsminor.yy585 = yymsp[0].minor.yy585; } - yymsp[0].minor.yy585 = yylhsminor.yy585; - break; - case 47: /* privileges ::= SUBSCRIBE */ - { yymsp[0].minor.yy585 = PRIVILEGE_TYPE_SUBSCRIBE; } - break; - case 49: /* priv_type_list ::= priv_type_list NK_COMMA priv_type */ - { yylhsminor.yy585 = yymsp[-2].minor.yy585 | yymsp[0].minor.yy585; } - yymsp[-2].minor.yy585 = yylhsminor.yy585; - break; - case 50: /* priv_type ::= READ */ - { yymsp[0].minor.yy585 = PRIVILEGE_TYPE_READ; } - break; - case 51: /* priv_type ::= WRITE */ - { yymsp[0].minor.yy585 = PRIVILEGE_TYPE_WRITE; } - break; - case 52: /* priv_type ::= ALTER */ - { yymsp[0].minor.yy585 = PRIVILEGE_TYPE_ALTER; } - break; - case 53: /* priv_level ::= NK_STAR NK_DOT NK_STAR */ - { yylhsminor.yy399.first = yymsp[-2].minor.yy0; yylhsminor.yy399.second = yymsp[0].minor.yy0; } - yymsp[-2].minor.yy399 = yylhsminor.yy399; - break; - case 54: /* priv_level ::= db_name NK_DOT NK_STAR */ - { yylhsminor.yy399.first = yymsp[-2].minor.yy533; yylhsminor.yy399.second = yymsp[0].minor.yy0; } - yymsp[-2].minor.yy399 = yylhsminor.yy399; - break; - case 55: /* priv_level ::= db_name NK_DOT table_name */ - { yylhsminor.yy399.first = yymsp[-2].minor.yy533; yylhsminor.yy399.second = yymsp[0].minor.yy533; } - yymsp[-2].minor.yy399 = yylhsminor.yy399; - break; - case 56: /* priv_level ::= topic_name */ - { yylhsminor.yy399.first = yymsp[0].minor.yy533; yylhsminor.yy399.second = nil_token; } - yymsp[0].minor.yy399 = yylhsminor.yy399; - break; - case 57: /* with_opt ::= */ - case 173: /* start_opt ::= */ yytestcase(yyruleno==173); - case 177: /* end_opt ::= */ yytestcase(yyruleno==177); - case 330: /* like_pattern_opt ::= */ yytestcase(yyruleno==330); - case 427: /* subtable_opt ::= */ yytestcase(yyruleno==427); - case 611: /* case_when_else_opt ::= */ yytestcase(yyruleno==611); - case 641: /* from_clause_opt ::= */ yytestcase(yyruleno==641); - case 668: /* join_on_clause_opt ::= */ yytestcase(yyruleno==668); - case 670: /* window_offset_clause_opt ::= */ yytestcase(yyruleno==670); - case 674: /* jlimit_clause_opt ::= */ yytestcase(yyruleno==674); - case 691: /* where_clause_opt ::= */ yytestcase(yyruleno==691); - case 700: /* twindow_clause_opt ::= */ yytestcase(yyruleno==700); - case 708: /* sliding_opt ::= */ yytestcase(yyruleno==708); - case 713: /* fill_opt ::= */ yytestcase(yyruleno==713); - case 727: /* having_clause_opt ::= */ yytestcase(yyruleno==727); - case 729: /* range_opt ::= */ yytestcase(yyruleno==729); - case 732: /* every_opt ::= */ yytestcase(yyruleno==732); - case 745: /* slimit_clause_opt ::= */ yytestcase(yyruleno==745); - case 749: /* limit_clause_opt ::= */ yytestcase(yyruleno==749); - { yymsp[1].minor.yy560 = NULL; } - break; - case 58: /* with_opt ::= WITH search_condition */ - case 642: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==642); - case 669: /* join_on_clause_opt ::= ON search_condition */ yytestcase(yyruleno==669); - case 692: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==692); - case 728: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==728); - { yymsp[-1].minor.yy560 = yymsp[0].minor.yy560; } - break; - case 59: /* cmd ::= CREATE ENCRYPT_KEY NK_STRING */ - { pCxt->pRootNode = createEncryptKeyStmt(pCxt, &yymsp[0].minor.yy0); } - break; - case 60: /* cmd ::= CREATE DNODE dnode_endpoint */ - { pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy533, NULL); } - break; - case 61: /* cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ - { pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy533, &yymsp[0].minor.yy0); } - break; - case 62: /* cmd ::= DROP DNODE NK_INTEGER force_opt */ - { pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy173, false); } - break; - case 63: /* cmd ::= DROP DNODE dnode_endpoint force_opt */ - { pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy533, yymsp[0].minor.yy173, false); } - break; - case 64: /* cmd ::= DROP DNODE NK_INTEGER unsafe_opt */ - { pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, false, yymsp[0].minor.yy173); } - break; - case 65: /* cmd ::= DROP DNODE dnode_endpoint unsafe_opt */ - { pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy533, false, yymsp[0].minor.yy173); } - break; - case 66: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ - { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, NULL); } - break; - case 67: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ - { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-2].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } - break; - case 68: /* cmd ::= ALTER ALL DNODES NK_STRING */ - { pCxt->pRootNode = createAlterDnodeStmt(pCxt, NULL, &yymsp[0].minor.yy0, NULL); } - break; - case 69: /* cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ - { pCxt->pRootNode = createAlterDnodeStmt(pCxt, NULL, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } - break; - case 70: /* cmd ::= RESTORE DNODE NK_INTEGER */ - { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_DNODE_STMT, &yymsp[0].minor.yy0); } - break; - case 71: /* dnode_endpoint ::= NK_STRING */ - case 72: /* dnode_endpoint ::= NK_ID */ yytestcase(yyruleno==72); - case 73: /* dnode_endpoint ::= NK_IPTOKEN */ yytestcase(yyruleno==73); - case 364: /* sma_func_name ::= COUNT */ yytestcase(yyruleno==364); - case 365: /* sma_func_name ::= FIRST */ yytestcase(yyruleno==365); - case 366: /* sma_func_name ::= LAST */ yytestcase(yyruleno==366); - case 367: /* sma_func_name ::= LAST_ROW */ yytestcase(yyruleno==367); - case 515: /* db_name ::= NK_ID */ yytestcase(yyruleno==515); - case 516: /* table_name ::= NK_ID */ yytestcase(yyruleno==516); - case 517: /* column_name ::= NK_ID */ yytestcase(yyruleno==517); - case 518: /* function_name ::= NK_ID */ yytestcase(yyruleno==518); - case 519: /* view_name ::= NK_ID */ yytestcase(yyruleno==519); - case 520: /* table_alias ::= NK_ID */ yytestcase(yyruleno==520); - case 521: /* column_alias ::= NK_ID */ yytestcase(yyruleno==521); - case 522: /* column_alias ::= NK_ALIAS */ yytestcase(yyruleno==522); - case 523: /* user_name ::= NK_ID */ yytestcase(yyruleno==523); - case 524: /* topic_name ::= NK_ID */ yytestcase(yyruleno==524); - case 525: /* stream_name ::= NK_ID */ yytestcase(yyruleno==525); - case 526: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==526); - case 527: /* index_name ::= NK_ID */ yytestcase(yyruleno==527); - case 528: /* tsma_name ::= NK_ID */ yytestcase(yyruleno==528); - case 581: /* substr_func ::= SUBSTR */ yytestcase(yyruleno==581); - case 582: /* substr_func ::= SUBSTRING */ yytestcase(yyruleno==582); - case 586: /* noarg_func ::= NOW */ yytestcase(yyruleno==586); - case 587: /* noarg_func ::= TODAY */ yytestcase(yyruleno==587); - case 588: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==588); - case 589: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==589); - case 590: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==590); - case 591: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==591); - case 592: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==592); - case 593: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==593); - case 594: /* noarg_func ::= USER */ yytestcase(yyruleno==594); - case 595: /* noarg_func ::= PI */ yytestcase(yyruleno==595); - case 596: /* star_func ::= COUNT */ yytestcase(yyruleno==596); - case 597: /* star_func ::= FIRST */ yytestcase(yyruleno==597); - case 598: /* star_func ::= LAST */ yytestcase(yyruleno==598); - case 599: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==599); - { yylhsminor.yy533 = yymsp[0].minor.yy0; } - yymsp[0].minor.yy533 = yylhsminor.yy533; - break; - case 74: /* force_opt ::= */ - case 101: /* not_exists_opt ::= */ yytestcase(yyruleno==101); - case 103: /* exists_opt ::= */ yytestcase(yyruleno==103); - case 385: /* analyze_opt ::= */ yytestcase(yyruleno==385); - case 392: /* agg_func_opt ::= */ yytestcase(yyruleno==392); - case 398: /* or_replace_opt ::= */ yytestcase(yyruleno==398); - case 429: /* ignore_opt ::= */ yytestcase(yyruleno==429); - case 679: /* tag_mode_opt ::= */ yytestcase(yyruleno==679); - case 681: /* set_quantifier_opt ::= */ yytestcase(yyruleno==681); - { yymsp[1].minor.yy173 = false; } - break; - case 75: /* force_opt ::= FORCE */ - case 76: /* unsafe_opt ::= UNSAFE */ yytestcase(yyruleno==76); - case 386: /* analyze_opt ::= ANALYZE */ yytestcase(yyruleno==386); - case 393: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==393); - case 680: /* tag_mode_opt ::= TAGS */ yytestcase(yyruleno==680); - case 682: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==682); - { yymsp[0].minor.yy173 = true; } - break; - case 77: /* cmd ::= ALTER CLUSTER NK_STRING */ - { pCxt->pRootNode = createAlterClusterStmt(pCxt, &yymsp[0].minor.yy0, NULL); } - break; - case 78: /* cmd ::= ALTER CLUSTER NK_STRING NK_STRING */ - { pCxt->pRootNode = createAlterClusterStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } - break; - case 79: /* cmd ::= ALTER LOCAL NK_STRING */ - { pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[0].minor.yy0, NULL); } - break; - case 80: /* cmd ::= ALTER LOCAL NK_STRING NK_STRING */ - { pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } - break; - case 81: /* cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ - { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_QNODE_STMT, &yymsp[0].minor.yy0); } - break; - case 82: /* cmd ::= DROP QNODE ON DNODE NK_INTEGER */ - { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_QNODE_STMT, &yymsp[0].minor.yy0); } - break; - case 83: /* cmd ::= RESTORE QNODE ON DNODE NK_INTEGER */ - { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_QNODE_STMT, &yymsp[0].minor.yy0); } - break; - case 84: /* cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ - { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_BNODE_STMT, &yymsp[0].minor.yy0); } - break; - case 85: /* cmd ::= DROP BNODE ON DNODE NK_INTEGER */ - { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_BNODE_STMT, &yymsp[0].minor.yy0); } - break; - case 86: /* cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ - { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_SNODE_STMT, &yymsp[0].minor.yy0); } - break; - case 87: /* cmd ::= DROP SNODE ON DNODE NK_INTEGER */ - { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_SNODE_STMT, &yymsp[0].minor.yy0); } - break; - case 88: /* cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ - { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_MNODE_STMT, &yymsp[0].minor.yy0); } - break; - case 89: /* cmd ::= DROP MNODE ON DNODE NK_INTEGER */ - { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_MNODE_STMT, &yymsp[0].minor.yy0); } - break; - case 90: /* cmd ::= RESTORE MNODE ON DNODE NK_INTEGER */ - { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_MNODE_STMT, &yymsp[0].minor.yy0); } - break; - case 91: /* cmd ::= RESTORE VNODE ON DNODE NK_INTEGER */ - { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_VNODE_STMT, &yymsp[0].minor.yy0); } - break; - case 92: /* cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ - { pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy173, &yymsp[-1].minor.yy533, yymsp[0].minor.yy560); } - break; - case 93: /* cmd ::= DROP DATABASE exists_opt db_name */ - { pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy173, &yymsp[0].minor.yy533); } - break; - case 94: /* cmd ::= USE db_name */ - { pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy533); } - break; - case 95: /* cmd ::= ALTER DATABASE db_name alter_db_options */ - { pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy533, yymsp[0].minor.yy560); } - break; - case 96: /* cmd ::= FLUSH DATABASE db_name */ - { pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy533); } - break; - case 97: /* cmd ::= TRIM DATABASE db_name speed_opt */ - { pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy533, yymsp[0].minor.yy802); } - break; - case 98: /* cmd ::= S3MIGRATE DATABASE db_name */ - { pCxt->pRootNode = createS3MigrateDatabaseStmt(pCxt, &yymsp[0].minor.yy533); } - break; - case 99: /* cmd ::= COMPACT DATABASE db_name start_opt end_opt */ - { pCxt->pRootNode = createCompactStmt(pCxt, &yymsp[-2].minor.yy533, yymsp[-1].minor.yy560, yymsp[0].minor.yy560); } - break; - case 100: /* not_exists_opt ::= IF NOT EXISTS */ - { yymsp[-2].minor.yy173 = true; } - break; - case 102: /* exists_opt ::= IF EXISTS */ - case 399: /* or_replace_opt ::= OR REPLACE */ yytestcase(yyruleno==399); - case 430: /* ignore_opt ::= IGNORE UNTREATED */ yytestcase(yyruleno==430); - { yymsp[-1].minor.yy173 = true; } - break; - case 104: /* db_options ::= */ - { yymsp[1].minor.yy560 = createDefaultDatabaseOptions(pCxt); } - break; - case 105: /* db_options ::= db_options BUFFER NK_INTEGER */ - { yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 106: /* db_options ::= db_options CACHEMODEL NK_STRING */ - { yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 107: /* db_options ::= db_options CACHESIZE NK_INTEGER */ - { yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 108: /* db_options ::= db_options COMP NK_INTEGER */ - { yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_COMP, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 109: /* db_options ::= db_options DURATION NK_INTEGER */ - case 110: /* db_options ::= db_options DURATION NK_VARIABLE */ yytestcase(yyruleno==110); - { yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 111: /* db_options ::= db_options MAXROWS NK_INTEGER */ - { yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 112: /* db_options ::= db_options MINROWS NK_INTEGER */ - { yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 113: /* db_options ::= db_options KEEP integer_list */ - case 114: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==114); - { yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_KEEP, yymsp[0].minor.yy334); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 115: /* db_options ::= db_options PAGES NK_INTEGER */ - { yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 116: /* db_options ::= db_options PAGESIZE NK_INTEGER */ - { yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 117: /* db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ - { yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 118: /* db_options ::= db_options PRECISION NK_STRING */ - { yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 119: /* db_options ::= db_options REPLICA NK_INTEGER */ - { yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 120: /* db_options ::= db_options VGROUPS NK_INTEGER */ - { yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 121: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */ - { yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 122: /* db_options ::= db_options RETENTIONS retention_list */ - { yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_RETENTIONS, yymsp[0].minor.yy334); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 123: /* db_options ::= db_options SCHEMALESS NK_INTEGER */ - { yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 124: /* db_options ::= db_options WAL_LEVEL NK_INTEGER */ - { yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_WAL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 125: /* db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ - { yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 126: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ - { yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 127: /* 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.yy560 = setDatabaseOption(pCxt, yymsp[-3].minor.yy560, DB_OPTION_WAL_RETENTION_PERIOD, &t); - } - yymsp[-3].minor.yy560 = yylhsminor.yy560; - break; - case 128: /* db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ - { yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 129: /* 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.yy560 = setDatabaseOption(pCxt, yymsp[-3].minor.yy560, DB_OPTION_WAL_RETENTION_SIZE, &t); - } - yymsp[-3].minor.yy560 = yylhsminor.yy560; - break; - case 130: /* db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ - { yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 131: /* db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ - { yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 132: /* db_options ::= db_options STT_TRIGGER NK_INTEGER */ - { yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 133: /* db_options ::= db_options TABLE_PREFIX signed */ - { yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_TABLE_PREFIX, yymsp[0].minor.yy560); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 134: /* db_options ::= db_options TABLE_SUFFIX signed */ - { yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_TABLE_SUFFIX, yymsp[0].minor.yy560); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 135: /* db_options ::= db_options S3_CHUNKSIZE NK_INTEGER */ - { yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_S3_CHUNKSIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 136: /* db_options ::= db_options S3_KEEPLOCAL NK_INTEGER */ - case 137: /* db_options ::= db_options S3_KEEPLOCAL NK_VARIABLE */ yytestcase(yyruleno==137); - { yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_S3_KEEPLOCAL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 138: /* db_options ::= db_options S3_COMPACT NK_INTEGER */ - { yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_S3_COMPACT, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 139: /* db_options ::= db_options KEEP_TIME_OFFSET NK_INTEGER */ - { yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_KEEP_TIME_OFFSET, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 140: /* db_options ::= db_options ENCRYPT_ALGORITHM NK_STRING */ - { yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_ENCRYPT_ALGORITHM, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 141: /* alter_db_options ::= alter_db_option */ - { yylhsminor.yy560 = createAlterDatabaseOptions(pCxt); yylhsminor.yy560 = setAlterDatabaseOption(pCxt, yylhsminor.yy560, &yymsp[0].minor.yy389); } - yymsp[0].minor.yy560 = yylhsminor.yy560; - break; - case 142: /* alter_db_options ::= alter_db_options alter_db_option */ - { yylhsminor.yy560 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy560, &yymsp[0].minor.yy389); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; - break; - case 143: /* alter_db_option ::= BUFFER NK_INTEGER */ - { yymsp[-1].minor.yy389.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; } - break; - case 144: /* alter_db_option ::= CACHEMODEL NK_STRING */ - { yymsp[-1].minor.yy389.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; } - break; - case 145: /* alter_db_option ::= CACHESIZE NK_INTEGER */ - { yymsp[-1].minor.yy389.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; } - break; - case 146: /* alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ - { yymsp[-1].minor.yy389.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; } - break; - case 147: /* alter_db_option ::= KEEP integer_list */ - case 148: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==148); - { yymsp[-1].minor.yy389.type = DB_OPTION_KEEP; yymsp[-1].minor.yy389.pList = yymsp[0].minor.yy334; } - break; - case 149: /* alter_db_option ::= PAGES NK_INTEGER */ - { yymsp[-1].minor.yy389.type = DB_OPTION_PAGES; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; } - break; - case 150: /* alter_db_option ::= REPLICA NK_INTEGER */ - { yymsp[-1].minor.yy389.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; } - break; - case 151: /* alter_db_option ::= WAL_LEVEL NK_INTEGER */ - { yymsp[-1].minor.yy389.type = DB_OPTION_WAL; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; } - break; - case 152: /* alter_db_option ::= STT_TRIGGER NK_INTEGER */ - { yymsp[-1].minor.yy389.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; } - break; - case 153: /* alter_db_option ::= MINROWS NK_INTEGER */ - { yymsp[-1].minor.yy389.type = DB_OPTION_MINROWS; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; } - break; - case 154: /* alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */ - { yymsp[-1].minor.yy389.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; } - break; - case 155: /* alter_db_option ::= 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; - yymsp[-2].minor.yy389.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-2].minor.yy389.val = t; - } - break; - case 156: /* alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */ - { yymsp[-1].minor.yy389.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; } - break; - case 157: /* alter_db_option ::= 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; - yymsp[-2].minor.yy389.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-2].minor.yy389.val = t; - } - break; - case 158: /* alter_db_option ::= S3_KEEPLOCAL NK_INTEGER */ - case 159: /* alter_db_option ::= S3_KEEPLOCAL NK_VARIABLE */ yytestcase(yyruleno==159); - { yymsp[-1].minor.yy389.type = DB_OPTION_S3_KEEPLOCAL; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; } - break; - case 160: /* alter_db_option ::= S3_COMPACT NK_INTEGER */ - { yymsp[-1].minor.yy389.type = DB_OPTION_S3_COMPACT, yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; } - break; - case 161: /* alter_db_option ::= KEEP_TIME_OFFSET NK_INTEGER */ - { yymsp[-1].minor.yy389.type = DB_OPTION_KEEP_TIME_OFFSET; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; } - break; - case 162: /* alter_db_option ::= ENCRYPT_ALGORITHM NK_STRING */ - { yymsp[-1].minor.yy389.type = DB_OPTION_ENCRYPT_ALGORITHM; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; } - break; - case 163: /* integer_list ::= NK_INTEGER */ - { yylhsminor.yy334 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy334 = yylhsminor.yy334; - break; - case 164: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */ - case 444: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==444); - { yylhsminor.yy334 = addNodeToList(pCxt, yymsp[-2].minor.yy334, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy334 = yylhsminor.yy334; - break; - case 165: /* variable_list ::= NK_VARIABLE */ - { yylhsminor.yy334 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy334 = yylhsminor.yy334; - break; - case 166: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */ - { yylhsminor.yy334 = addNodeToList(pCxt, yymsp[-2].minor.yy334, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy334 = yylhsminor.yy334; - break; - case 167: /* retention_list ::= retention */ - case 200: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==200); - case 203: /* multi_drop_clause ::= drop_table_clause */ yytestcase(yyruleno==203); - case 210: /* tag_def_list ::= tag_def */ yytestcase(yyruleno==210); - case 213: /* column_def_list ::= column_def */ yytestcase(yyruleno==213); - case 261: /* rollup_func_list ::= rollup_func_name */ yytestcase(yyruleno==261); - case 266: /* col_name_list ::= col_name */ yytestcase(yyruleno==266); - case 336: /* tag_list_opt ::= tag_item */ yytestcase(yyruleno==336); - case 360: /* func_list ::= func */ yytestcase(yyruleno==360); - case 410: /* column_stream_def_list ::= column_stream_def */ yytestcase(yyruleno==410); - case 488: /* tags_literal_list ::= tags_literal */ yytestcase(yyruleno==488); - case 513: /* literal_list ::= signed_literal */ yytestcase(yyruleno==513); - case 602: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==602); - case 608: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==608); - case 684: /* select_list ::= select_item */ yytestcase(yyruleno==684); - case 695: /* partition_list ::= partition_item */ yytestcase(yyruleno==695); - case 756: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==756); - { yylhsminor.yy334 = createNodeList(pCxt, yymsp[0].minor.yy560); } - yymsp[0].minor.yy334 = yylhsminor.yy334; - break; - case 168: /* retention_list ::= retention_list NK_COMMA retention */ - case 204: /* multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ yytestcase(yyruleno==204); - case 211: /* tag_def_list ::= tag_def_list NK_COMMA tag_def */ yytestcase(yyruleno==211); - case 214: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==214); - case 262: /* rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ yytestcase(yyruleno==262); - case 267: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==267); - case 337: /* tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ yytestcase(yyruleno==337); - case 361: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==361); - case 411: /* column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def */ yytestcase(yyruleno==411); - case 489: /* tags_literal_list ::= tags_literal_list NK_COMMA tags_literal */ yytestcase(yyruleno==489); - case 514: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==514); - case 603: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==603); - case 685: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==685); - case 696: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==696); - case 757: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==757); - { yylhsminor.yy334 = addNodeToList(pCxt, yymsp[-2].minor.yy334, yymsp[0].minor.yy560); } - yymsp[-2].minor.yy334 = yylhsminor.yy334; - break; - case 169: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ - case 170: /* retention ::= NK_MINUS NK_COLON NK_VARIABLE */ yytestcase(yyruleno==170); - { yylhsminor.yy560 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 171: /* speed_opt ::= */ - case 394: /* bufsize_opt ::= */ yytestcase(yyruleno==394); - { yymsp[1].minor.yy802 = 0; } - break; - case 172: /* speed_opt ::= BWLIMIT NK_INTEGER */ - case 395: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==395); - { yymsp[-1].minor.yy802 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } - break; - case 174: /* start_opt ::= START WITH NK_INTEGER */ - case 178: /* end_opt ::= END WITH NK_INTEGER */ yytestcase(yyruleno==178); - { yymsp[-2].minor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } - break; - case 175: /* start_opt ::= START WITH NK_STRING */ - case 179: /* end_opt ::= END WITH NK_STRING */ yytestcase(yyruleno==179); - { yymsp[-2].minor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } - break; - case 176: /* start_opt ::= START WITH TIMESTAMP NK_STRING */ - case 180: /* end_opt ::= END WITH TIMESTAMP NK_STRING */ yytestcase(yyruleno==180); - { yymsp[-3].minor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } - break; - case 181: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ - case 184: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==184); - { pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy173, yymsp[-5].minor.yy560, yymsp[-3].minor.yy334, yymsp[-1].minor.yy334, yymsp[0].minor.yy560); } - break; - case 182: /* cmd ::= CREATE TABLE multi_create_clause */ - { pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy334); } - break; - case 183: /* cmd ::= CREATE TABLE not_exists_opt USING full_table_name NK_LP tag_list_opt NK_RP FILE NK_STRING */ - { pCxt->pRootNode = createCreateSubTableFromFileClause(pCxt, yymsp[-7].minor.yy173, yymsp[-5].minor.yy560, yymsp[-3].minor.yy334, &yymsp[0].minor.yy0); } - break; - case 185: /* cmd ::= DROP TABLE multi_drop_clause */ - { pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy334); } - break; - case 186: /* cmd ::= DROP STABLE exists_opt full_table_name */ - { pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy173, yymsp[0].minor.yy560); } - break; - case 187: /* cmd ::= ALTER TABLE alter_table_clause */ - case 446: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==446); - case 447: /* cmd ::= insert_query */ yytestcase(yyruleno==447); - { pCxt->pRootNode = yymsp[0].minor.yy560; } - break; - case 188: /* cmd ::= ALTER STABLE alter_table_clause */ - { pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy560); } - break; - case 189: /* alter_table_clause ::= full_table_name alter_table_options */ - { yylhsminor.yy560 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy560, yymsp[0].minor.yy560); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; - break; - case 190: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name column_options */ - { yylhsminor.yy560 = createAlterTableAddModifyColOptions2(pCxt, yymsp[-5].minor.yy560, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-2].minor.yy533, yymsp[-1].minor.yy952, yymsp[0].minor.yy560); } - yymsp[-5].minor.yy560 = yylhsminor.yy560; - break; - case 191: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ - { yylhsminor.yy560 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy560, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy533); } - yymsp[-3].minor.yy560 = yylhsminor.yy560; - break; - case 192: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ - { yylhsminor.yy560 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy560, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy533, yymsp[0].minor.yy952); } - yymsp[-4].minor.yy560 = yylhsminor.yy560; - break; - case 193: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name column_options */ - { yylhsminor.yy560 = createAlterTableAddModifyColOptions(pCxt, yymsp[-4].minor.yy560, TSDB_ALTER_TABLE_UPDATE_COLUMN_COMPRESS, &yymsp[-1].minor.yy533, yymsp[0].minor.yy560); } - yymsp[-4].minor.yy560 = yylhsminor.yy560; - break; - case 194: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ - { yylhsminor.yy560 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy560, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy533, &yymsp[0].minor.yy533); } - yymsp[-4].minor.yy560 = yylhsminor.yy560; - break; - case 195: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ - { yylhsminor.yy560 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy560, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy533, yymsp[0].minor.yy952); } - yymsp[-4].minor.yy560 = yylhsminor.yy560; - break; - case 196: /* alter_table_clause ::= full_table_name DROP TAG column_name */ - { yylhsminor.yy560 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy560, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy533); } - yymsp[-3].minor.yy560 = yylhsminor.yy560; - break; - case 197: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ - { yylhsminor.yy560 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy560, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy533, yymsp[0].minor.yy952); } - yymsp[-4].minor.yy560 = yylhsminor.yy560; - break; - case 198: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ - { yylhsminor.yy560 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy560, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy533, &yymsp[0].minor.yy533); } - yymsp[-4].minor.yy560 = yylhsminor.yy560; - break; - case 199: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ tags_literal */ - { yylhsminor.yy560 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy560, &yymsp[-2].minor.yy533, yymsp[0].minor.yy560); } - yymsp[-5].minor.yy560 = yylhsminor.yy560; - break; - case 201: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ - case 609: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==609); - { yylhsminor.yy334 = addNodeToList(pCxt, yymsp[-1].minor.yy334, yymsp[0].minor.yy560); } - yymsp[-1].minor.yy334 = yylhsminor.yy334; - break; - case 202: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP tags_literal_list NK_RP table_options */ - { yylhsminor.yy560 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy173, yymsp[-8].minor.yy560, yymsp[-6].minor.yy560, yymsp[-5].minor.yy334, yymsp[-2].minor.yy334, yymsp[0].minor.yy560); } - yymsp[-9].minor.yy560 = yylhsminor.yy560; - break; - case 205: /* drop_table_clause ::= exists_opt full_table_name */ - { yylhsminor.yy560 = createDropTableClause(pCxt, yymsp[-1].minor.yy173, yymsp[0].minor.yy560); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; - break; - case 207: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */ - case 409: /* col_list_opt ::= NK_LP column_stream_def_list NK_RP */ yytestcase(yyruleno==409); - { yymsp[-2].minor.yy334 = yymsp[-1].minor.yy334; } - break; - case 208: /* full_table_name ::= table_name */ - case 350: /* full_tsma_name ::= tsma_name */ yytestcase(yyruleno==350); - { yylhsminor.yy560 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy533, NULL); } - yymsp[0].minor.yy560 = yylhsminor.yy560; - break; - case 209: /* full_table_name ::= db_name NK_DOT table_name */ - case 351: /* full_tsma_name ::= db_name NK_DOT tsma_name */ yytestcase(yyruleno==351); - { yylhsminor.yy560 = createRealTableNode(pCxt, &yymsp[-2].minor.yy533, &yymsp[0].minor.yy533, NULL); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 212: /* tag_def ::= column_name type_name */ - { yylhsminor.yy560 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy533, yymsp[0].minor.yy952, NULL); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; - break; - case 215: /* column_def ::= column_name type_name column_options */ - { yylhsminor.yy560 = createColumnDefNode(pCxt, &yymsp[-2].minor.yy533, yymsp[-1].minor.yy952, yymsp[0].minor.yy560); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 216: /* type_name ::= BOOL */ - { yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_BOOL); } - break; - case 217: /* type_name ::= TINYINT */ - { yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_TINYINT); } - break; - case 218: /* type_name ::= SMALLINT */ - { yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_SMALLINT); } - break; - case 219: /* type_name ::= INT */ - case 220: /* type_name ::= INTEGER */ yytestcase(yyruleno==220); - { yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_INT); } - break; - case 221: /* type_name ::= BIGINT */ - { yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_BIGINT); } - break; - case 222: /* type_name ::= FLOAT */ - { yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_FLOAT); } - break; - case 223: /* type_name ::= DOUBLE */ - { yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_DOUBLE); } - break; - case 224: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ - { yymsp[-3].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } - break; - case 225: /* type_name ::= TIMESTAMP */ - { yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } - break; - case 226: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ - { yymsp[-3].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } - break; - case 227: /* type_name ::= TINYINT UNSIGNED */ - { yymsp[-1].minor.yy952 = createDataType(TSDB_DATA_TYPE_UTINYINT); } - break; - case 228: /* type_name ::= SMALLINT UNSIGNED */ - { yymsp[-1].minor.yy952 = createDataType(TSDB_DATA_TYPE_USMALLINT); } - break; - case 229: /* type_name ::= INT UNSIGNED */ - { yymsp[-1].minor.yy952 = createDataType(TSDB_DATA_TYPE_UINT); } - break; - case 230: /* type_name ::= BIGINT UNSIGNED */ - { yymsp[-1].minor.yy952 = createDataType(TSDB_DATA_TYPE_UBIGINT); } - break; - case 231: /* type_name ::= JSON */ - { yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_JSON); } - break; - case 232: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ - { yymsp[-3].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } - break; - case 233: /* type_name ::= MEDIUMBLOB */ - { yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } - break; - case 234: /* type_name ::= BLOB */ - { yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_BLOB); } - break; - case 235: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ - { yymsp[-3].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } - break; - case 236: /* type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ - { yymsp[-3].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_GEOMETRY, &yymsp[-1].minor.yy0); } - break; - case 237: /* type_name ::= DECIMAL */ - { yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_DECIMAL); } - break; - case 238: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ - { yymsp[-3].minor.yy952 = createDataType(TSDB_DATA_TYPE_DECIMAL); } - break; - case 239: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - { yymsp[-5].minor.yy952 = createDataType(TSDB_DATA_TYPE_DECIMAL); } - break; - case 240: /* type_name_default_len ::= BINARY */ - { yymsp[0].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, NULL); } - break; - case 241: /* type_name_default_len ::= NCHAR */ - { yymsp[0].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, NULL); } - break; - case 242: /* type_name_default_len ::= VARCHAR */ - { yymsp[0].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, NULL); } - break; - case 243: /* type_name_default_len ::= VARBINARY */ - { yymsp[0].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, NULL); } - break; - case 246: /* tags_def ::= TAGS NK_LP tag_def_list NK_RP */ - case 417: /* tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP */ yytestcase(yyruleno==417); - { yymsp[-3].minor.yy334 = yymsp[-1].minor.yy334; } - break; - case 247: /* table_options ::= */ - { yymsp[1].minor.yy560 = createDefaultTableOptions(pCxt); } - break; - case 248: /* table_options ::= table_options COMMENT NK_STRING */ - { yylhsminor.yy560 = setTableOption(pCxt, yymsp[-2].minor.yy560, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 249: /* table_options ::= table_options MAX_DELAY duration_list */ - { yylhsminor.yy560 = setTableOption(pCxt, yymsp[-2].minor.yy560, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy334); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 250: /* table_options ::= table_options WATERMARK duration_list */ - { yylhsminor.yy560 = setTableOption(pCxt, yymsp[-2].minor.yy560, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy334); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 251: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ - { yylhsminor.yy560 = setTableOption(pCxt, yymsp[-4].minor.yy560, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy334); } - yymsp[-4].minor.yy560 = yylhsminor.yy560; - break; - case 252: /* table_options ::= table_options TTL NK_INTEGER */ - { yylhsminor.yy560 = setTableOption(pCxt, yymsp[-2].minor.yy560, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 253: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ - { yylhsminor.yy560 = setTableOption(pCxt, yymsp[-4].minor.yy560, TABLE_OPTION_SMA, yymsp[-1].minor.yy334); } - yymsp[-4].minor.yy560 = yylhsminor.yy560; - break; - case 254: /* table_options ::= table_options DELETE_MARK duration_list */ - { yylhsminor.yy560 = setTableOption(pCxt, yymsp[-2].minor.yy560, TABLE_OPTION_DELETE_MARK, yymsp[0].minor.yy334); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 255: /* alter_table_options ::= alter_table_option */ - { yylhsminor.yy560 = createAlterTableOptions(pCxt); yylhsminor.yy560 = setTableOption(pCxt, yylhsminor.yy560, yymsp[0].minor.yy389.type, &yymsp[0].minor.yy389.val); } - yymsp[0].minor.yy560 = yylhsminor.yy560; - break; - case 256: /* alter_table_options ::= alter_table_options alter_table_option */ - { yylhsminor.yy560 = setTableOption(pCxt, yymsp[-1].minor.yy560, yymsp[0].minor.yy389.type, &yymsp[0].minor.yy389.val); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; - break; - case 257: /* alter_table_option ::= COMMENT NK_STRING */ - { yymsp[-1].minor.yy389.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; } - break; - case 258: /* alter_table_option ::= TTL NK_INTEGER */ - { yymsp[-1].minor.yy389.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; } - break; - case 259: /* duration_list ::= duration_literal */ - case 546: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==546); - { yylhsminor.yy334 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy560)); } - yymsp[0].minor.yy334 = yylhsminor.yy334; - break; - case 260: /* duration_list ::= duration_list NK_COMMA duration_literal */ - case 547: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==547); - { yylhsminor.yy334 = addNodeToList(pCxt, yymsp[-2].minor.yy334, releaseRawExprNode(pCxt, yymsp[0].minor.yy560)); } - yymsp[-2].minor.yy334 = yylhsminor.yy334; - break; - case 263: /* rollup_func_name ::= function_name */ - { yylhsminor.yy560 = createFunctionNode(pCxt, &yymsp[0].minor.yy533, NULL); } - yymsp[0].minor.yy560 = yylhsminor.yy560; - break; - case 264: /* rollup_func_name ::= FIRST */ - case 265: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==265); - case 339: /* tag_item ::= QTAGS */ yytestcase(yyruleno==339); - { yylhsminor.yy560 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } - yymsp[0].minor.yy560 = yylhsminor.yy560; - break; - case 268: /* col_name ::= column_name */ - case 340: /* tag_item ::= column_name */ yytestcase(yyruleno==340); - { yylhsminor.yy560 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy533); } - yymsp[0].minor.yy560 = yylhsminor.yy560; - break; - case 269: /* cmd ::= SHOW DNODES */ - { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT); } - break; - case 270: /* cmd ::= SHOW USERS */ - { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USERS_STMT); } - break; - case 271: /* cmd ::= SHOW USERS FULL */ - { pCxt->pRootNode = createShowStmtWithFull(pCxt, QUERY_NODE_SHOW_USERS_FULL_STMT); } - break; - case 272: /* cmd ::= SHOW USER PRIVILEGES */ - { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USER_PRIVILEGES_STMT); } - break; - case 273: /* cmd ::= SHOW db_kind_opt DATABASES */ - { - pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT); - (void)setShowKind(pCxt, pCxt->pRootNode, yymsp[-1].minor.yy537); - } - break; - case 274: /* cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */ - { - pCxt->pRootNode = createShowTablesStmt(pCxt, yymsp[-2].minor.yy709, yymsp[0].minor.yy560, OP_TYPE_LIKE); - } - break; - case 275: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ - { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy560, yymsp[0].minor.yy560, OP_TYPE_LIKE); } - break; - case 276: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ - { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy560, NULL, OP_TYPE_LIKE); } - break; - case 277: /* cmd ::= SHOW MNODES */ - { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT); } - break; - case 278: /* cmd ::= SHOW QNODES */ - { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QNODES_STMT); } - break; - case 279: /* cmd ::= SHOW ARBGROUPS */ - { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_ARBGROUPS_STMT); } - break; - case 280: /* cmd ::= SHOW FUNCTIONS */ - { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT); } - break; - case 281: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ - { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy560, yymsp[-1].minor.yy560, OP_TYPE_EQUAL); } - break; - case 282: /* cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ - { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy533), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy533), OP_TYPE_EQUAL); } - break; - case 283: /* cmd ::= SHOW STREAMS */ - { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT); } - break; - case 284: /* cmd ::= SHOW ACCOUNTS */ - { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } - break; - case 285: /* cmd ::= SHOW APPS */ - { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_APPS_STMT); } - break; - case 286: /* cmd ::= SHOW CONNECTIONS */ - { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONNECTIONS_STMT); } - break; - case 287: /* cmd ::= SHOW LICENCES */ - case 288: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==288); - { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LICENCES_STMT); } - break; - case 289: /* cmd ::= SHOW GRANTS FULL */ - { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_GRANTS_FULL_STMT); } - break; - case 290: /* cmd ::= SHOW GRANTS LOGS */ - { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_GRANTS_LOGS_STMT); } - break; - case 291: /* cmd ::= SHOW CLUSTER MACHINES */ - { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_MACHINES_STMT); } - break; - case 292: /* cmd ::= SHOW CREATE DATABASE db_name */ - { pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy533); } - break; - case 293: /* cmd ::= SHOW CREATE TABLE full_table_name */ - { pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy560); } - break; - case 294: /* cmd ::= SHOW CREATE STABLE full_table_name */ - { pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, - yymsp[0].minor.yy560); } - break; - case 295: /* cmd ::= SHOW ENCRYPTIONS */ - { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_ENCRYPTIONS_STMT); } - break; - case 296: /* cmd ::= SHOW QUERIES */ - { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT); } - break; - case 297: /* cmd ::= SHOW SCORES */ - { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SCORES_STMT); } - break; - case 298: /* cmd ::= SHOW TOPICS */ - { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TOPICS_STMT); } - break; - case 299: /* cmd ::= SHOW VARIABLES */ - case 300: /* cmd ::= SHOW CLUSTER VARIABLES */ yytestcase(yyruleno==300); - { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VARIABLES_STMT); } - break; - case 301: /* cmd ::= SHOW LOCAL VARIABLES */ - { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT); } - break; - case 302: /* cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ - { pCxt->pRootNode = createShowDnodeVariablesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[-2].minor.yy0), yymsp[0].minor.yy560); } - break; - case 303: /* cmd ::= SHOW BNODES */ - { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_BNODES_STMT); } - break; - case 304: /* cmd ::= SHOW SNODES */ - { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SNODES_STMT); } - break; - case 305: /* cmd ::= SHOW CLUSTER */ - { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_STMT); } - break; - case 306: /* cmd ::= SHOW TRANSACTIONS */ - { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TRANSACTIONS_STMT); } - break; - case 307: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ - { pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy560); } - break; - case 308: /* cmd ::= SHOW CONSUMERS */ - { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONSUMERS_STMT); } - break; - case 309: /* cmd ::= SHOW SUBSCRIPTIONS */ - { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT); } - break; - case 310: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ - { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy560, yymsp[-1].minor.yy560, OP_TYPE_EQUAL); } - break; - case 311: /* cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ - { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy533), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy533), OP_TYPE_EQUAL); } - break; - case 312: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ - { pCxt->pRootNode = createShowTableTagsStmt(pCxt, yymsp[-1].minor.yy560, yymsp[0].minor.yy560, yymsp[-3].minor.yy334); } - break; - case 313: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ - { pCxt->pRootNode = createShowTableTagsStmt(pCxt, createIdentifierValueNode(pCxt, &yymsp[0].minor.yy533), createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy533), yymsp[-4].minor.yy334); } - break; - case 314: /* cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ - { pCxt->pRootNode = createShowVnodesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0), NULL); } - break; - case 315: /* cmd ::= SHOW VNODES */ - { pCxt->pRootNode = createShowVnodesStmt(pCxt, NULL, NULL); } - break; - case 316: /* cmd ::= SHOW db_name_cond_opt ALIVE */ - { pCxt->pRootNode = createShowAliveStmt(pCxt, yymsp[-1].minor.yy560, QUERY_NODE_SHOW_DB_ALIVE_STMT); } - break; - case 317: /* cmd ::= SHOW CLUSTER ALIVE */ - { pCxt->pRootNode = createShowAliveStmt(pCxt, NULL, QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT); } - break; - case 318: /* cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt */ - { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VIEWS_STMT, yymsp[-2].minor.yy560, yymsp[0].minor.yy560, OP_TYPE_LIKE); } - break; - case 319: /* cmd ::= SHOW CREATE VIEW full_table_name */ - { pCxt->pRootNode = createShowCreateViewStmt(pCxt, QUERY_NODE_SHOW_CREATE_VIEW_STMT, yymsp[0].minor.yy560); } - break; - case 320: /* cmd ::= SHOW COMPACTS */ - { pCxt->pRootNode = createShowCompactsStmt(pCxt, QUERY_NODE_SHOW_COMPACTS_STMT); } - break; - case 321: /* cmd ::= SHOW COMPACT NK_INTEGER */ - { pCxt->pRootNode = createShowCompactDetailsStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - break; - case 322: /* table_kind_db_name_cond_opt ::= */ - { yymsp[1].minor.yy709.kind = SHOW_KIND_ALL; yymsp[1].minor.yy709.dbName = nil_token; } - break; - case 323: /* table_kind_db_name_cond_opt ::= table_kind */ - { yylhsminor.yy709.kind = yymsp[0].minor.yy537; yylhsminor.yy709.dbName = nil_token; } - yymsp[0].minor.yy709 = yylhsminor.yy709; - break; - case 324: /* table_kind_db_name_cond_opt ::= db_name NK_DOT */ - { yylhsminor.yy709.kind = SHOW_KIND_ALL; yylhsminor.yy709.dbName = yymsp[-1].minor.yy533; } - yymsp[-1].minor.yy709 = yylhsminor.yy709; - break; - case 325: /* table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */ - { yylhsminor.yy709.kind = yymsp[-2].minor.yy537; yylhsminor.yy709.dbName = yymsp[-1].minor.yy533; } - yymsp[-2].minor.yy709 = yylhsminor.yy709; - break; - case 326: /* table_kind ::= NORMAL */ - { yymsp[0].minor.yy537 = SHOW_KIND_TABLES_NORMAL; } - break; - case 327: /* table_kind ::= CHILD */ - { yymsp[0].minor.yy537 = SHOW_KIND_TABLES_CHILD; } - break; - case 328: /* db_name_cond_opt ::= */ - case 333: /* from_db_opt ::= */ yytestcase(yyruleno==333); - { yymsp[1].minor.yy560 = createDefaultDatabaseCondValue(pCxt); } - break; - case 329: /* db_name_cond_opt ::= db_name NK_DOT */ - { yylhsminor.yy560 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy533); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; - break; - case 331: /* like_pattern_opt ::= LIKE NK_STRING */ - { yymsp[-1].minor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } - break; - case 332: /* table_name_cond ::= table_name */ - { yylhsminor.yy560 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy533); } - yymsp[0].minor.yy560 = yylhsminor.yy560; - break; - case 334: /* from_db_opt ::= FROM db_name */ - { yymsp[-1].minor.yy560 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy533); } - break; - case 338: /* tag_item ::= TBNAME */ - { yylhsminor.yy560 = setProjectionAlias(pCxt, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL), &yymsp[0].minor.yy0); } - yymsp[0].minor.yy560 = yylhsminor.yy560; - break; - case 341: /* tag_item ::= column_name column_alias */ - { yylhsminor.yy560 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy533), &yymsp[0].minor.yy533); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; - break; - case 342: /* tag_item ::= column_name AS column_alias */ - { yylhsminor.yy560 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-2].minor.yy533), &yymsp[0].minor.yy533); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 343: /* db_kind_opt ::= */ - { yymsp[1].minor.yy537 = SHOW_KIND_ALL; } - break; - case 344: /* db_kind_opt ::= USER */ - { yymsp[0].minor.yy537 = SHOW_KIND_DATABASES_USER; } - break; - case 345: /* db_kind_opt ::= SYSTEM */ - { yymsp[0].minor.yy537 = SHOW_KIND_DATABASES_SYSTEM; } - break; - case 346: /* cmd ::= CREATE TSMA not_exists_opt tsma_name ON full_table_name tsma_func_list INTERVAL NK_LP duration_literal NK_RP */ - { pCxt->pRootNode = createCreateTSMAStmt(pCxt, yymsp[-8].minor.yy173, &yymsp[-7].minor.yy533, yymsp[-4].minor.yy560, yymsp[-5].minor.yy560, releaseRawExprNode(pCxt, yymsp[-1].minor.yy560)); } - break; - case 347: /* cmd ::= CREATE RECURSIVE TSMA not_exists_opt tsma_name ON full_table_name INTERVAL NK_LP duration_literal NK_RP */ - { pCxt->pRootNode = createCreateTSMAStmt(pCxt, yymsp[-7].minor.yy173, &yymsp[-6].minor.yy533, NULL, yymsp[-4].minor.yy560, releaseRawExprNode(pCxt, yymsp[-1].minor.yy560)); } - break; - case 348: /* cmd ::= DROP TSMA exists_opt full_tsma_name */ - { pCxt->pRootNode = createDropTSMAStmt(pCxt, yymsp[-1].minor.yy173, yymsp[0].minor.yy560); } - break; - case 349: /* cmd ::= SHOW db_name_cond_opt TSMAS */ - { pCxt->pRootNode = createShowTSMASStmt(pCxt, yymsp[-1].minor.yy560); } - break; - case 352: /* tsma_func_list ::= FUNCTION NK_LP func_list NK_RP */ - { yymsp[-3].minor.yy560 = createTSMAOptions(pCxt, yymsp[-1].minor.yy334); } - break; - case 353: /* cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */ - { pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy173, yymsp[-3].minor.yy560, yymsp[-1].minor.yy560, NULL, yymsp[0].minor.yy560); } - break; - case 354: /* cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */ - { pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_NORMAL, yymsp[-6].minor.yy173, yymsp[-5].minor.yy560, yymsp[-3].minor.yy560, yymsp[-1].minor.yy334, NULL); } - break; - case 355: /* cmd ::= DROP INDEX exists_opt full_index_name */ - { pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy173, yymsp[0].minor.yy560); } - break; - case 356: /* full_index_name ::= index_name */ - { yylhsminor.yy560 = createRealTableNodeForIndexName(pCxt, NULL, &yymsp[0].minor.yy533); } - yymsp[0].minor.yy560 = yylhsminor.yy560; - break; - case 357: /* full_index_name ::= db_name NK_DOT index_name */ - { yylhsminor.yy560 = createRealTableNodeForIndexName(pCxt, &yymsp[-2].minor.yy533, &yymsp[0].minor.yy533); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 358: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ - { yymsp[-9].minor.yy560 = createIndexOption(pCxt, yymsp[-7].minor.yy334, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), NULL, yymsp[-1].minor.yy560, yymsp[0].minor.yy560); } - break; - case 359: /* 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.yy560 = createIndexOption(pCxt, yymsp[-9].minor.yy334, releaseRawExprNode(pCxt, yymsp[-5].minor.yy560), releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), yymsp[-1].minor.yy560, yymsp[0].minor.yy560); } - break; - case 362: /* func ::= sma_func_name NK_LP expression_list NK_RP */ - { yylhsminor.yy560 = createFunctionNode(pCxt, &yymsp[-3].minor.yy533, yymsp[-1].minor.yy334); } - yymsp[-3].minor.yy560 = yylhsminor.yy560; - break; - case 363: /* sma_func_name ::= function_name */ - case 652: /* alias_opt ::= table_alias */ yytestcase(yyruleno==652); - { yylhsminor.yy533 = yymsp[0].minor.yy533; } - yymsp[0].minor.yy533 = yylhsminor.yy533; - break; - case 368: /* sma_stream_opt ::= */ - case 418: /* stream_options ::= */ yytestcase(yyruleno==418); - { yymsp[1].minor.yy560 = createStreamOptions(pCxt); } - break; - case 369: /* sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ - { ((SStreamOptions*)yymsp[-2].minor.yy560)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy560); yylhsminor.yy560 = yymsp[-2].minor.yy560; } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 370: /* sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ - { ((SStreamOptions*)yymsp[-2].minor.yy560)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy560); yylhsminor.yy560 = yymsp[-2].minor.yy560; } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 371: /* sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ - { ((SStreamOptions*)yymsp[-2].minor.yy560)->pDeleteMark = releaseRawExprNode(pCxt, yymsp[0].minor.yy560); yylhsminor.yy560 = yymsp[-2].minor.yy560; } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 372: /* with_meta ::= AS */ - { yymsp[0].minor.yy802 = 0; } - break; - case 373: /* with_meta ::= WITH META AS */ - { yymsp[-2].minor.yy802 = 1; } - break; - case 374: /* with_meta ::= ONLY META AS */ - { yymsp[-2].minor.yy802 = 2; } - break; - case 375: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ - { pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy173, &yymsp[-2].minor.yy533, yymsp[0].minor.yy560); } - break; - case 376: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ - { pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy173, &yymsp[-3].minor.yy533, &yymsp[0].minor.yy533, yymsp[-2].minor.yy802); } - break; - case 377: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ - { pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-5].minor.yy173, &yymsp[-4].minor.yy533, yymsp[-1].minor.yy560, yymsp[-3].minor.yy802, yymsp[0].minor.yy560); } - break; - case 378: /* cmd ::= DROP TOPIC exists_opt topic_name */ - { pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy173, &yymsp[0].minor.yy533); } - break; - case 379: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ - { pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy173, &yymsp[-2].minor.yy533, &yymsp[0].minor.yy533); } - break; - case 380: /* cmd ::= DESC full_table_name */ - case 381: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==381); - { pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy560); } - break; - case 382: /* cmd ::= RESET QUERY CACHE */ - { pCxt->pRootNode = createResetQueryCacheStmt(pCxt); } - break; - case 383: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ - case 384: /* cmd ::= EXPLAIN analyze_opt explain_options insert_query */ yytestcase(yyruleno==384); - { pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy173, yymsp[-1].minor.yy560, yymsp[0].minor.yy560); } - break; - case 387: /* explain_options ::= */ - { yymsp[1].minor.yy560 = createDefaultExplainOptions(pCxt); } - break; - case 388: /* explain_options ::= explain_options VERBOSE NK_BOOL */ - { yylhsminor.yy560 = setExplainVerbose(pCxt, yymsp[-2].minor.yy560, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 389: /* explain_options ::= explain_options RATIO NK_FLOAT */ - { yylhsminor.yy560 = setExplainRatio(pCxt, yymsp[-2].minor.yy560, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 390: /* cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ - { pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-7].minor.yy173, yymsp[-9].minor.yy173, &yymsp[-6].minor.yy533, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy952, yymsp[-1].minor.yy802, &yymsp[0].minor.yy533, yymsp[-10].minor.yy173); } - break; - case 391: /* cmd ::= DROP FUNCTION exists_opt function_name */ - { pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy173, &yymsp[0].minor.yy533); } - break; - case 396: /* language_opt ::= */ - case 441: /* on_vgroup_id ::= */ yytestcase(yyruleno==441); - { yymsp[1].minor.yy533 = nil_token; } - break; - case 397: /* language_opt ::= LANGUAGE NK_STRING */ - case 442: /* on_vgroup_id ::= ON NK_INTEGER */ yytestcase(yyruleno==442); - { yymsp[-1].minor.yy533 = yymsp[0].minor.yy0; } - break; - case 400: /* cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */ - { pCxt->pRootNode = createCreateViewStmt(pCxt, yymsp[-4].minor.yy173, yymsp[-2].minor.yy560, &yymsp[-1].minor.yy0, yymsp[0].minor.yy560); } - break; - case 401: /* cmd ::= DROP VIEW exists_opt full_view_name */ - { pCxt->pRootNode = createDropViewStmt(pCxt, yymsp[-1].minor.yy173, yymsp[0].minor.yy560); } - break; - case 402: /* full_view_name ::= view_name */ - { yylhsminor.yy560 = createViewNode(pCxt, NULL, &yymsp[0].minor.yy533); } - yymsp[0].minor.yy560 = yylhsminor.yy560; - break; - case 403: /* full_view_name ::= db_name NK_DOT view_name */ - { yylhsminor.yy560 = createViewNode(pCxt, &yymsp[-2].minor.yy533, &yymsp[0].minor.yy533); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 404: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */ - { pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-9].minor.yy173, &yymsp[-8].minor.yy533, yymsp[-5].minor.yy560, yymsp[-7].minor.yy560, yymsp[-3].minor.yy334, yymsp[-2].minor.yy560, yymsp[0].minor.yy560, yymsp[-4].minor.yy334); } - break; - case 405: /* cmd ::= DROP STREAM exists_opt stream_name */ - { pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy173, &yymsp[0].minor.yy533); } - break; - case 406: /* cmd ::= PAUSE STREAM exists_opt stream_name */ - { pCxt->pRootNode = createPauseStreamStmt(pCxt, yymsp[-1].minor.yy173, &yymsp[0].minor.yy533); } - break; - case 407: /* cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ - { pCxt->pRootNode = createResumeStreamStmt(pCxt, yymsp[-2].minor.yy173, yymsp[-1].minor.yy173, &yymsp[0].minor.yy533); } - break; - case 412: /* column_stream_def ::= column_name stream_col_options */ - { yylhsminor.yy560 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy533, createDataType(TSDB_DATA_TYPE_NULL), yymsp[0].minor.yy560); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; - break; - case 413: /* stream_col_options ::= */ - case 765: /* column_options ::= */ yytestcase(yyruleno==765); - { yymsp[1].minor.yy560 = createDefaultColumnOptions(pCxt); } - break; - case 414: /* stream_col_options ::= stream_col_options PRIMARY KEY */ - case 766: /* column_options ::= column_options PRIMARY KEY */ yytestcase(yyruleno==766); - { yylhsminor.yy560 = setColumnOptions(pCxt, yymsp[-2].minor.yy560, COLUMN_OPTION_PRIMARYKEY, NULL); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 419: /* stream_options ::= stream_options TRIGGER AT_ONCE */ - case 420: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ yytestcase(yyruleno==420); - { yylhsminor.yy560 = setStreamOptions(pCxt, yymsp[-2].minor.yy560, SOPT_TRIGGER_TYPE_SET, &yymsp[0].minor.yy0, NULL); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 421: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ - { yylhsminor.yy560 = setStreamOptions(pCxt, yymsp[-3].minor.yy560, SOPT_TRIGGER_TYPE_SET, &yymsp[-1].minor.yy0, releaseRawExprNode(pCxt, yymsp[0].minor.yy560)); } - yymsp[-3].minor.yy560 = yylhsminor.yy560; - break; - case 422: /* stream_options ::= stream_options WATERMARK duration_literal */ - { yylhsminor.yy560 = setStreamOptions(pCxt, yymsp[-2].minor.yy560, SOPT_WATERMARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy560)); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 423: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ - { yylhsminor.yy560 = setStreamOptions(pCxt, yymsp[-3].minor.yy560, SOPT_IGNORE_EXPIRED_SET, &yymsp[0].minor.yy0, NULL); } - yymsp[-3].minor.yy560 = yylhsminor.yy560; - break; - case 424: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ - { yylhsminor.yy560 = setStreamOptions(pCxt, yymsp[-2].minor.yy560, SOPT_FILL_HISTORY_SET, &yymsp[0].minor.yy0, NULL); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 425: /* stream_options ::= stream_options DELETE_MARK duration_literal */ - { yylhsminor.yy560 = setStreamOptions(pCxt, yymsp[-2].minor.yy560, SOPT_DELETE_MARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy560)); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 426: /* stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ - { yylhsminor.yy560 = setStreamOptions(pCxt, yymsp[-3].minor.yy560, SOPT_IGNORE_UPDATE_SET, &yymsp[0].minor.yy0, NULL); } - yymsp[-3].minor.yy560 = yylhsminor.yy560; - break; - case 428: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - case 709: /* sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ yytestcase(yyruleno==709); - case 733: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==733); - { yymsp[-3].minor.yy560 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy560); } - break; - case 431: /* cmd ::= KILL CONNECTION NK_INTEGER */ - { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); } - break; - case 432: /* cmd ::= KILL QUERY NK_STRING */ - { pCxt->pRootNode = createKillQueryStmt(pCxt, &yymsp[0].minor.yy0); } - break; - case 433: /* cmd ::= KILL TRANSACTION NK_INTEGER */ - { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_TRANSACTION_STMT, &yymsp[0].minor.yy0); } - break; - case 434: /* cmd ::= KILL COMPACT NK_INTEGER */ - { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_COMPACT_STMT, &yymsp[0].minor.yy0); } - break; - case 435: /* cmd ::= BALANCE VGROUP */ - { pCxt->pRootNode = createBalanceVgroupStmt(pCxt); } - break; - case 436: /* cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ - { pCxt->pRootNode = createBalanceVgroupLeaderStmt(pCxt, &yymsp[0].minor.yy533); } - break; - case 437: /* cmd ::= BALANCE VGROUP LEADER DATABASE db_name */ - { pCxt->pRootNode = createBalanceVgroupLeaderDBNameStmt(pCxt, &yymsp[0].minor.yy533); } - break; - case 438: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ - { pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } - break; - case 439: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ - { pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy334); } - break; - case 440: /* cmd ::= SPLIT VGROUP NK_INTEGER */ - { pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); } - break; - case 443: /* dnode_list ::= DNODE NK_INTEGER */ - { yymsp[-1].minor.yy334 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - break; - case 445: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ - { pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy560, yymsp[0].minor.yy560); } - break; - case 448: /* insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ - { yymsp[-6].minor.yy560 = createInsertStmt(pCxt, yymsp[-4].minor.yy560, yymsp[-2].minor.yy334, yymsp[0].minor.yy560); } - break; - case 449: /* insert_query ::= INSERT INTO full_table_name query_or_subquery */ - { yymsp[-3].minor.yy560 = createInsertStmt(pCxt, yymsp[-1].minor.yy560, NULL, yymsp[0].minor.yy560); } - break; - case 450: /* tags_literal ::= NK_INTEGER */ - case 462: /* tags_literal ::= NK_BIN */ yytestcase(yyruleno==462); - case 471: /* tags_literal ::= NK_HEX */ yytestcase(yyruleno==471); - { yylhsminor.yy560 = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0, NULL); } - yymsp[0].minor.yy560 = yylhsminor.yy560; - break; - case 451: /* tags_literal ::= NK_INTEGER NK_PLUS duration_literal */ - case 452: /* tags_literal ::= NK_INTEGER NK_MINUS duration_literal */ yytestcase(yyruleno==452); - case 463: /* tags_literal ::= NK_BIN NK_PLUS duration_literal */ yytestcase(yyruleno==463); - case 464: /* tags_literal ::= NK_BIN NK_MINUS duration_literal */ yytestcase(yyruleno==464); - case 472: /* tags_literal ::= NK_HEX NK_PLUS duration_literal */ yytestcase(yyruleno==472); - case 473: /* tags_literal ::= NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==473); - case 481: /* tags_literal ::= NK_STRING NK_PLUS duration_literal */ yytestcase(yyruleno==481); - case 482: /* tags_literal ::= NK_STRING NK_MINUS duration_literal */ yytestcase(yyruleno==482); - { - SToken l = yymsp[-2].minor.yy0; - SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - l.n = (r.z + r.n) - l.z; - yylhsminor.yy560 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, yymsp[0].minor.yy560); - } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 453: /* tags_literal ::= NK_PLUS NK_INTEGER */ - case 456: /* tags_literal ::= NK_MINUS NK_INTEGER */ yytestcase(yyruleno==456); - case 465: /* tags_literal ::= NK_PLUS NK_BIN */ yytestcase(yyruleno==465); - case 468: /* tags_literal ::= NK_MINUS NK_BIN */ yytestcase(yyruleno==468); - case 474: /* tags_literal ::= NK_PLUS NK_HEX */ yytestcase(yyruleno==474); - case 477: /* tags_literal ::= NK_MINUS NK_HEX */ yytestcase(yyruleno==477); - { - SToken t = yymsp[-1].minor.yy0; - t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy560 = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &t, NULL); - } - yymsp[-1].minor.yy560 = yylhsminor.yy560; - break; - case 454: /* tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal */ - case 455: /* tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal */ yytestcase(yyruleno==455); - case 457: /* tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal */ yytestcase(yyruleno==457); - case 458: /* tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal */ yytestcase(yyruleno==458); - case 466: /* tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal */ yytestcase(yyruleno==466); - case 467: /* tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal */ yytestcase(yyruleno==467); - case 469: /* tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal */ yytestcase(yyruleno==469); - case 470: /* tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal */ yytestcase(yyruleno==470); - case 475: /* tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal */ yytestcase(yyruleno==475); - case 476: /* tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==476); - case 478: /* tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal */ yytestcase(yyruleno==478); - case 479: /* tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==479); - { - SToken l = yymsp[-3].minor.yy0; - SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - l.n = (r.z + r.n) - l.z; - yylhsminor.yy560 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, yymsp[0].minor.yy560); - } - yymsp[-3].minor.yy560 = yylhsminor.yy560; - break; - case 459: /* tags_literal ::= NK_FLOAT */ - { yylhsminor.yy560 = createRawValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0, NULL); } - yymsp[0].minor.yy560 = yylhsminor.yy560; - break; - case 460: /* tags_literal ::= NK_PLUS NK_FLOAT */ - case 461: /* tags_literal ::= NK_MINUS NK_FLOAT */ yytestcase(yyruleno==461); - { - SToken t = yymsp[-1].minor.yy0; - t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy560 = createRawValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t, NULL); - } - yymsp[-1].minor.yy560 = yylhsminor.yy560; - break; - case 480: /* tags_literal ::= NK_STRING */ - { yylhsminor.yy560 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0, NULL); } - yymsp[0].minor.yy560 = yylhsminor.yy560; - break; - case 483: /* tags_literal ::= NK_BOOL */ - { yylhsminor.yy560 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0, NULL); } - yymsp[0].minor.yy560 = yylhsminor.yy560; - break; - case 484: /* tags_literal ::= NULL */ - { yylhsminor.yy560 = createRawValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0, NULL); } - yymsp[0].minor.yy560 = yylhsminor.yy560; - break; - case 485: /* tags_literal ::= literal_func */ - { yylhsminor.yy560 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BINARY, NULL, yymsp[0].minor.yy560); } - yymsp[0].minor.yy560 = yylhsminor.yy560; - break; - case 486: /* tags_literal ::= literal_func NK_PLUS duration_literal */ - case 487: /* tags_literal ::= literal_func NK_MINUS duration_literal */ yytestcase(yyruleno==487); - { - SToken l = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - l.n = (r.z + r.n) - l.z; - yylhsminor.yy560 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, yymsp[-2].minor.yy560, yymsp[0].minor.yy560); - } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 490: /* literal ::= NK_INTEGER */ - { yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy560 = yylhsminor.yy560; - break; - case 491: /* literal ::= NK_FLOAT */ - { yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy560 = yylhsminor.yy560; - break; - case 492: /* literal ::= NK_STRING */ - { yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy560 = yylhsminor.yy560; - break; - case 493: /* literal ::= NK_BOOL */ - { yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy560 = yylhsminor.yy560; - break; - case 494: /* literal ::= TIMESTAMP NK_STRING */ - { yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; - break; - case 495: /* literal ::= duration_literal */ - case 505: /* signed_literal ::= signed */ yytestcase(yyruleno==505); - case 529: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==529); - case 530: /* expression ::= literal */ yytestcase(yyruleno==530); - case 532: /* expression ::= column_reference */ yytestcase(yyruleno==532); - case 533: /* expression ::= function_expression */ yytestcase(yyruleno==533); - case 534: /* expression ::= case_when_expression */ yytestcase(yyruleno==534); - case 577: /* function_expression ::= literal_func */ yytestcase(yyruleno==577); - case 633: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==633); - case 637: /* boolean_primary ::= predicate */ yytestcase(yyruleno==637); - case 639: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==639); - case 640: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==640); - case 643: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==643); - case 645: /* table_reference ::= table_primary */ yytestcase(yyruleno==645); - case 646: /* table_reference ::= joined_table */ yytestcase(yyruleno==646); - case 650: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==650); - case 735: /* query_simple ::= query_specification */ yytestcase(yyruleno==735); - case 736: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==736); - case 739: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==739); - case 741: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==741); - { yylhsminor.yy560 = yymsp[0].minor.yy560; } - yymsp[0].minor.yy560 = yylhsminor.yy560; - break; - case 496: /* literal ::= NULL */ - { yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy560 = yylhsminor.yy560; - break; - case 497: /* literal ::= NK_QUESTION */ - { yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy560 = yylhsminor.yy560; - break; - case 498: /* duration_literal ::= NK_VARIABLE */ - case 710: /* interval_sliding_duration_literal ::= NK_VARIABLE */ yytestcase(yyruleno==710); - case 711: /* interval_sliding_duration_literal ::= NK_STRING */ yytestcase(yyruleno==711); - case 712: /* interval_sliding_duration_literal ::= NK_INTEGER */ yytestcase(yyruleno==712); - { yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy560 = yylhsminor.yy560; - break; - case 499: /* signed ::= NK_INTEGER */ - { yylhsminor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy560 = yylhsminor.yy560; - break; - case 500: /* signed ::= NK_PLUS NK_INTEGER */ - { yymsp[-1].minor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } - break; - case 501: /* 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.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); - } - yymsp[-1].minor.yy560 = yylhsminor.yy560; - break; - case 502: /* signed ::= NK_FLOAT */ - { yylhsminor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy560 = yylhsminor.yy560; - break; - case 503: /* signed ::= NK_PLUS NK_FLOAT */ - { yymsp[-1].minor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } - break; - case 504: /* 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.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); - } - yymsp[-1].minor.yy560 = yylhsminor.yy560; - break; - case 506: /* signed_literal ::= NK_STRING */ - { yylhsminor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy560 = yylhsminor.yy560; - break; - case 507: /* signed_literal ::= NK_BOOL */ - { yylhsminor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy560 = yylhsminor.yy560; - break; - case 508: /* signed_literal ::= TIMESTAMP NK_STRING */ - { yymsp[-1].minor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } - break; - case 509: /* signed_literal ::= duration_literal */ - case 511: /* signed_literal ::= literal_func */ yytestcase(yyruleno==511); - case 604: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==604); - case 687: /* select_item ::= common_expression */ yytestcase(yyruleno==687); - case 697: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==697); - case 740: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==740); - case 742: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==742); - case 755: /* search_condition ::= common_expression */ yytestcase(yyruleno==755); - { yylhsminor.yy560 = releaseRawExprNode(pCxt, yymsp[0].minor.yy560); } - yymsp[0].minor.yy560 = yylhsminor.yy560; - break; - case 510: /* signed_literal ::= NULL */ - { yylhsminor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy560 = yylhsminor.yy560; - break; - case 512: /* signed_literal ::= NK_QUESTION */ - { yylhsminor.yy560 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy560 = yylhsminor.yy560; - break; - case 531: /* expression ::= pseudo_column */ - { yylhsminor.yy560 = yymsp[0].minor.yy560; (void)setRawExprNodeIsPseudoColumn(pCxt, yylhsminor.yy560, true); } - yymsp[0].minor.yy560 = yylhsminor.yy560; - break; - case 535: /* expression ::= NK_LP expression NK_RP */ - case 638: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==638); - case 754: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==754); - { yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy560)); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 536: /* expression ::= NK_PLUS expr_or_subquery */ - { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy560)); - } - yymsp[-1].minor.yy560 = yylhsminor.yy560; - break; - case 537: /* expression ::= NK_MINUS expr_or_subquery */ - { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy560), NULL)); - } - yymsp[-1].minor.yy560 = yylhsminor.yy560; - break; - case 538: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ - { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); - } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 539: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ - { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); - } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 540: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */ - { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); - } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 541: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ - { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); - } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 542: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */ - { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); - } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 543: /* expression ::= column_reference NK_ARROW NK_STRING */ - { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); - } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 544: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ - { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); - } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 545: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ - { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); - } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 548: /* column_reference ::= column_name */ - { yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy533, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy533)); } - yymsp[0].minor.yy560 = yylhsminor.yy560; - break; - case 549: /* column_reference ::= table_name NK_DOT column_name */ - { yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy533, &yymsp[0].minor.yy533, createColumnNode(pCxt, &yymsp[-2].minor.yy533, &yymsp[0].minor.yy533)); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 550: /* column_reference ::= NK_ALIAS */ - { yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy560 = yylhsminor.yy560; - break; - case 551: /* column_reference ::= table_name NK_DOT NK_ALIAS */ - { yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy533, &yymsp[0].minor.yy0, createColumnNode(pCxt, &yymsp[-2].minor.yy533, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 552: /* pseudo_column ::= ROWTS */ - case 553: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==553); - case 555: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==555); - case 556: /* pseudo_column ::= QEND */ yytestcase(yyruleno==556); - case 557: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==557); - case 558: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==558); - case 559: /* pseudo_column ::= WEND */ yytestcase(yyruleno==559); - case 560: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==560); - case 561: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==561); - case 562: /* pseudo_column ::= ISFILLED */ yytestcase(yyruleno==562); - case 563: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==563); - case 579: /* literal_func ::= NOW */ yytestcase(yyruleno==579); - case 580: /* literal_func ::= TODAY */ yytestcase(yyruleno==580); - { yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } - yymsp[0].minor.yy560 = yylhsminor.yy560; - break; - case 554: /* pseudo_column ::= table_name NK_DOT TBNAME */ - { yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy533, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy533)))); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 564: /* function_expression ::= function_name NK_LP expression_list NK_RP */ - case 565: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==565); - case 573: /* function_expression ::= substr_func NK_LP expression_list NK_RP */ yytestcase(yyruleno==573); - { yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy533, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy533, yymsp[-1].minor.yy334)); } - yymsp[-3].minor.yy560 = yylhsminor.yy560; - break; - case 566: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ - case 567: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP */ yytestcase(yyruleno==567); - { yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), yymsp[-1].minor.yy952)); } - yymsp[-5].minor.yy560 = yylhsminor.yy560; - break; - case 568: /* function_expression ::= POSITION NK_LP expr_or_subquery IN expr_or_subquery NK_RP */ - { yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createPositionFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), releaseRawExprNode(pCxt, yymsp[-1].minor.yy560))); } - yymsp[-5].minor.yy560 = yylhsminor.yy560; - break; - case 569: /* function_expression ::= TRIM NK_LP expr_or_subquery NK_RP */ - { yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createTrimFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy560), TRIM_TYPE_BOTH)); } - yymsp[-3].minor.yy560 = yylhsminor.yy560; - break; - case 570: /* function_expression ::= TRIM NK_LP trim_specification_type FROM expr_or_subquery NK_RP */ - { yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createTrimFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy560), yymsp[-3].minor.yy672)); } - yymsp[-5].minor.yy560 = yylhsminor.yy560; - break; - case 571: /* function_expression ::= TRIM NK_LP expr_or_subquery FROM expr_or_subquery NK_RP */ - { yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createTrimFunctionNodeExt(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), releaseRawExprNode(pCxt, yymsp[-1].minor.yy560), TRIM_TYPE_BOTH)); } - yymsp[-5].minor.yy560 = yylhsminor.yy560; - break; - case 572: /* function_expression ::= TRIM NK_LP trim_specification_type expr_or_subquery FROM expr_or_subquery NK_RP */ - { yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-6].minor.yy0, &yymsp[0].minor.yy0, createTrimFunctionNodeExt(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), releaseRawExprNode(pCxt, yymsp[-1].minor.yy560), yymsp[-4].minor.yy672)); } - yymsp[-6].minor.yy560 = yylhsminor.yy560; - break; - case 574: /* function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery NK_RP */ - { yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy533, &yymsp[0].minor.yy0, createSubstrFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), releaseRawExprNode(pCxt, yymsp[-1].minor.yy560))); } - yymsp[-5].minor.yy560 = yylhsminor.yy560; - break; - case 575: /* function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery FOR expr_or_subquery NK_RP */ - { yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-7].minor.yy533, &yymsp[0].minor.yy0, createSubstrFunctionNodeExt(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy560), releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), releaseRawExprNode(pCxt, yymsp[-1].minor.yy560))); } - yymsp[-7].minor.yy560 = yylhsminor.yy560; - break; - case 576: /* function_expression ::= REPLACE NK_LP expression_list NK_RP */ - { yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy334)); } - yymsp[-3].minor.yy560 = yylhsminor.yy560; - break; - case 578: /* literal_func ::= noarg_func NK_LP NK_RP */ - { yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy533, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy533, NULL)); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 583: /* trim_specification_type ::= BOTH */ - { yymsp[0].minor.yy672 = TRIM_TYPE_BOTH; } - break; - case 584: /* trim_specification_type ::= TRAILING */ - { yymsp[0].minor.yy672 = TRIM_TYPE_TRAILING; } - break; - case 585: /* trim_specification_type ::= LEADING */ - { yymsp[0].minor.yy672 = TRIM_TYPE_LEADING; } - break; - case 600: /* star_func_para_list ::= NK_STAR */ - { yylhsminor.yy334 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy334 = yylhsminor.yy334; - break; - case 605: /* star_func_para ::= table_name NK_DOT NK_STAR */ - case 690: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==690); - { yylhsminor.yy560 = createColumnNode(pCxt, &yymsp[-2].minor.yy533, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 606: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */ - { yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy334, yymsp[-1].minor.yy560)); } - yymsp[-3].minor.yy560 = yylhsminor.yy560; - break; - case 607: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ - { yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), yymsp[-2].minor.yy334, yymsp[-1].minor.yy560)); } - yymsp[-4].minor.yy560 = yylhsminor.yy560; - break; - case 610: /* when_then_expr ::= WHEN common_expression THEN common_expression */ - { yymsp[-3].minor.yy560 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560)); } - break; - case 612: /* case_when_else_opt ::= ELSE common_expression */ - { yymsp[-1].minor.yy560 = releaseRawExprNode(pCxt, yymsp[0].minor.yy560); } - break; - case 613: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */ - case 618: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==618); - { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy506, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); - } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 614: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ - { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy560), releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); - } - yymsp[-4].minor.yy560 = yylhsminor.yy560; - break; - case 615: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ - { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy560), releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); - } - yymsp[-5].minor.yy560 = yylhsminor.yy560; - break; - case 616: /* predicate ::= expr_or_subquery IS NULL */ - { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), NULL)); - } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 617: /* predicate ::= expr_or_subquery IS NOT NULL */ - { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), NULL)); - } - yymsp[-3].minor.yy560 = yylhsminor.yy560; - break; - case 619: /* compare_op ::= NK_LT */ - { yymsp[0].minor.yy506 = OP_TYPE_LOWER_THAN; } - break; - case 620: /* compare_op ::= NK_GT */ - { yymsp[0].minor.yy506 = OP_TYPE_GREATER_THAN; } - break; - case 621: /* compare_op ::= NK_LE */ - { yymsp[0].minor.yy506 = OP_TYPE_LOWER_EQUAL; } - break; - case 622: /* compare_op ::= NK_GE */ - { yymsp[0].minor.yy506 = OP_TYPE_GREATER_EQUAL; } - break; - case 623: /* compare_op ::= NK_NE */ - { yymsp[0].minor.yy506 = OP_TYPE_NOT_EQUAL; } - break; - case 624: /* compare_op ::= NK_EQ */ - { yymsp[0].minor.yy506 = OP_TYPE_EQUAL; } - break; - case 625: /* compare_op ::= LIKE */ - { yymsp[0].minor.yy506 = OP_TYPE_LIKE; } - break; - case 626: /* compare_op ::= NOT LIKE */ - { yymsp[-1].minor.yy506 = OP_TYPE_NOT_LIKE; } - break; - case 627: /* compare_op ::= MATCH */ - { yymsp[0].minor.yy506 = OP_TYPE_MATCH; } - break; - case 628: /* compare_op ::= NMATCH */ - { yymsp[0].minor.yy506 = OP_TYPE_NMATCH; } - break; - case 629: /* compare_op ::= CONTAINS */ - { yymsp[0].minor.yy506 = OP_TYPE_JSON_CONTAINS; } - break; - case 630: /* in_op ::= IN */ - { yymsp[0].minor.yy506 = OP_TYPE_IN; } - break; - case 631: /* in_op ::= NOT IN */ - { yymsp[-1].minor.yy506 = OP_TYPE_NOT_IN; } - break; - case 632: /* in_predicate_value ::= NK_LP literal_list NK_RP */ - { yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy334)); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 634: /* boolean_value_expression ::= NOT boolean_primary */ - { - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy560), NULL)); - } - yymsp[-1].minor.yy560 = yylhsminor.yy560; - break; - case 635: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); - } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 636: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); - } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 644: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ - { yylhsminor.yy560 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, JOIN_STYPE_NONE, yymsp[-2].minor.yy560, yymsp[0].minor.yy560, NULL); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 647: /* table_primary ::= table_name alias_opt */ - { yylhsminor.yy560 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy533, &yymsp[0].minor.yy533); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; - break; - case 648: /* table_primary ::= db_name NK_DOT table_name alias_opt */ - { yylhsminor.yy560 = createRealTableNode(pCxt, &yymsp[-3].minor.yy533, &yymsp[-1].minor.yy533, &yymsp[0].minor.yy533); } - yymsp[-3].minor.yy560 = yylhsminor.yy560; - break; - case 649: /* table_primary ::= subquery alias_opt */ - { yylhsminor.yy560 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy560), &yymsp[0].minor.yy533); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; - break; - case 651: /* alias_opt ::= */ - { yymsp[1].minor.yy533 = nil_token; } - break; - case 653: /* alias_opt ::= AS table_alias */ - { yymsp[-1].minor.yy533 = yymsp[0].minor.yy533; } - break; - case 654: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - case 655: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==655); - { yymsp[-2].minor.yy560 = yymsp[-1].minor.yy560; } - break; - case 656: /* joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt */ - { - yylhsminor.yy560 = createJoinTableNode(pCxt, yymsp[-6].minor.yy36, yymsp[-5].minor.yy648, yymsp[-7].minor.yy560, yymsp[-3].minor.yy560, yymsp[-2].minor.yy560); - yylhsminor.yy560 = addWindowOffsetClause(pCxt, yylhsminor.yy560, yymsp[-1].minor.yy560); - yylhsminor.yy560 = addJLimitClause(pCxt, yylhsminor.yy560, yymsp[0].minor.yy560); - } - yymsp[-7].minor.yy560 = yylhsminor.yy560; - break; - case 657: /* join_type ::= */ - { yymsp[1].minor.yy36 = JOIN_TYPE_INNER; } - break; - case 658: /* join_type ::= INNER */ - { yymsp[0].minor.yy36 = JOIN_TYPE_INNER; } - break; - case 659: /* join_type ::= LEFT */ - { yymsp[0].minor.yy36 = JOIN_TYPE_LEFT; } - break; - case 660: /* join_type ::= RIGHT */ - { yymsp[0].minor.yy36 = JOIN_TYPE_RIGHT; } - break; - case 661: /* join_type ::= FULL */ - { yymsp[0].minor.yy36 = JOIN_TYPE_FULL; } - break; - case 662: /* join_subtype ::= */ - { yymsp[1].minor.yy648 = JOIN_STYPE_NONE; } - break; - case 663: /* join_subtype ::= OUTER */ - { yymsp[0].minor.yy648 = JOIN_STYPE_OUTER; } - break; - case 664: /* join_subtype ::= SEMI */ - { yymsp[0].minor.yy648 = JOIN_STYPE_SEMI; } - break; - case 665: /* join_subtype ::= ANTI */ - { yymsp[0].minor.yy648 = JOIN_STYPE_ANTI; } - break; - case 666: /* join_subtype ::= ASOF */ - { yymsp[0].minor.yy648 = JOIN_STYPE_ASOF; } - break; - case 667: /* join_subtype ::= WINDOW */ - { yymsp[0].minor.yy648 = JOIN_STYPE_WIN; } - break; - case 671: /* window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP */ - { yymsp[-5].minor.yy560 = createWindowOffsetNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), releaseRawExprNode(pCxt, yymsp[-1].minor.yy560)); } - break; - case 672: /* window_offset_literal ::= NK_VARIABLE */ - { yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createTimeOffsetValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy560 = yylhsminor.yy560; - break; - case 673: /* window_offset_literal ::= NK_MINUS NK_VARIABLE */ - { - SToken t = yymsp[-1].minor.yy0; - t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy560 = createRawExprNode(pCxt, &t, createTimeOffsetValueNode(pCxt, &t)); - } - yymsp[-1].minor.yy560 = yylhsminor.yy560; - break; - case 675: /* jlimit_clause_opt ::= JLIMIT NK_INTEGER */ - case 746: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ yytestcase(yyruleno==746); - case 750: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==750); - { yymsp[-1].minor.yy560 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } - break; - case 676: /* query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_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[-13].minor.yy560 = createSelectStmt(pCxt, yymsp[-11].minor.yy173, yymsp[-9].minor.yy334, yymsp[-8].minor.yy560, yymsp[-12].minor.yy334); - yymsp[-13].minor.yy560 = setSelectStmtTagMode(pCxt, yymsp[-13].minor.yy560, yymsp[-10].minor.yy173); - yymsp[-13].minor.yy560 = addWhereClause(pCxt, yymsp[-13].minor.yy560, yymsp[-7].minor.yy560); - yymsp[-13].minor.yy560 = addPartitionByClause(pCxt, yymsp[-13].minor.yy560, yymsp[-6].minor.yy334); - yymsp[-13].minor.yy560 = addWindowClauseClause(pCxt, yymsp[-13].minor.yy560, yymsp[-2].minor.yy560); - yymsp[-13].minor.yy560 = addGroupByClause(pCxt, yymsp[-13].minor.yy560, yymsp[-1].minor.yy334); - yymsp[-13].minor.yy560 = addHavingClause(pCxt, yymsp[-13].minor.yy560, yymsp[0].minor.yy560); - yymsp[-13].minor.yy560 = addRangeClause(pCxt, yymsp[-13].minor.yy560, yymsp[-5].minor.yy560); - yymsp[-13].minor.yy560 = addEveryClause(pCxt, yymsp[-13].minor.yy560, yymsp[-4].minor.yy560); - yymsp[-13].minor.yy560 = addFillClause(pCxt, yymsp[-13].minor.yy560, yymsp[-3].minor.yy560); - } - break; - case 677: /* hint_list ::= */ - { yymsp[1].minor.yy334 = createHintNodeList(pCxt, NULL); } - break; - case 678: /* hint_list ::= NK_HINT */ - { yylhsminor.yy334 = createHintNodeList(pCxt, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy334 = yylhsminor.yy334; - break; - case 683: /* set_quantifier_opt ::= ALL */ - { yymsp[0].minor.yy173 = false; } - break; - case 686: /* select_item ::= NK_STAR */ - { yylhsminor.yy560 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy560 = yylhsminor.yy560; - break; - case 688: /* select_item ::= common_expression column_alias */ - case 698: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==698); - { yylhsminor.yy560 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy560), &yymsp[0].minor.yy533); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; - break; - case 689: /* select_item ::= common_expression AS column_alias */ - case 699: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==699); - { yylhsminor.yy560 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), &yymsp[0].minor.yy533); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 694: /* partition_by_clause_opt ::= PARTITION BY partition_list */ - case 724: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==724); - case 744: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==744); - { yymsp[-2].minor.yy334 = yymsp[0].minor.yy334; } - break; - case 701: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ - { yymsp[-5].minor.yy560 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), releaseRawExprNode(pCxt, yymsp[-1].minor.yy560)); } - break; - case 702: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ - { yymsp[-3].minor.yy560 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy560)); } - break; - case 703: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ - { yymsp[-5].minor.yy560 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), NULL, yymsp[-1].minor.yy560, yymsp[0].minor.yy560); } - break; - case 704: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ - { yymsp[-7].minor.yy560 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy560), releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), yymsp[-1].minor.yy560, yymsp[0].minor.yy560); } - break; - case 705: /* twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ - { yymsp[-6].minor.yy560 = createEventWindowNode(pCxt, yymsp[-3].minor.yy560, yymsp[0].minor.yy560); } - break; - case 706: /* twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */ - { yymsp[-3].minor.yy560 = createCountWindowNode(pCxt, &yymsp[-1].minor.yy0, &yymsp[-1].minor.yy0); } - break; - case 707: /* twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - { yymsp[-5].minor.yy560 = createCountWindowNode(pCxt, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0); } - break; - case 714: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ - { yymsp[-3].minor.yy560 = createFillNode(pCxt, yymsp[-1].minor.yy18, NULL); } - break; - case 715: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ - { yymsp[-5].minor.yy560 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy334)); } - break; - case 716: /* fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ - { yymsp[-5].minor.yy560 = createFillNode(pCxt, FILL_MODE_VALUE_F, createNodeListNode(pCxt, yymsp[-1].minor.yy334)); } - break; - case 717: /* fill_mode ::= NONE */ - { yymsp[0].minor.yy18 = FILL_MODE_NONE; } - break; - case 718: /* fill_mode ::= PREV */ - { yymsp[0].minor.yy18 = FILL_MODE_PREV; } - break; - case 719: /* fill_mode ::= NULL */ - { yymsp[0].minor.yy18 = FILL_MODE_NULL; } - break; - case 720: /* fill_mode ::= NULL_F */ - { yymsp[0].minor.yy18 = FILL_MODE_NULL_F; } - break; - case 721: /* fill_mode ::= LINEAR */ - { yymsp[0].minor.yy18 = FILL_MODE_LINEAR; } - break; - case 722: /* fill_mode ::= NEXT */ - { yymsp[0].minor.yy18 = FILL_MODE_NEXT; } - break; - case 725: /* group_by_list ::= expr_or_subquery */ - { yylhsminor.yy334 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); } - yymsp[0].minor.yy334 = yylhsminor.yy334; - break; - case 726: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ - { yylhsminor.yy334 = addNodeToList(pCxt, yymsp[-2].minor.yy334, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); } - yymsp[-2].minor.yy334 = yylhsminor.yy334; - break; - case 730: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ - { yymsp[-5].minor.yy560 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), releaseRawExprNode(pCxt, yymsp[-1].minor.yy560)); } - break; - case 731: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ - { yymsp[-3].minor.yy560 = createInterpTimePoint(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy560)); } - break; - case 734: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ - { - yylhsminor.yy560 = addOrderByClause(pCxt, yymsp[-3].minor.yy560, yymsp[-2].minor.yy334); - yylhsminor.yy560 = addSlimitClause(pCxt, yylhsminor.yy560, yymsp[-1].minor.yy560); - yylhsminor.yy560 = addLimitClause(pCxt, yylhsminor.yy560, yymsp[0].minor.yy560); - } - yymsp[-3].minor.yy560 = yylhsminor.yy560; - break; - case 737: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ - { yylhsminor.yy560 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy560, yymsp[0].minor.yy560); } - yymsp[-3].minor.yy560 = yylhsminor.yy560; - break; - case 738: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ - { yylhsminor.yy560 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy560, yymsp[0].minor.yy560); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 747: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - case 751: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==751); - { yymsp[-3].minor.yy560 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } - break; - case 748: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - case 752: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==752); - { yymsp[-3].minor.yy560 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } - break; - case 753: /* subquery ::= NK_LP query_expression NK_RP */ - { yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy560); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 758: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ - { yylhsminor.yy560 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), yymsp[-1].minor.yy974, yymsp[0].minor.yy109); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 759: /* ordering_specification_opt ::= */ - { yymsp[1].minor.yy974 = ORDER_ASC; } - break; - case 760: /* ordering_specification_opt ::= ASC */ - { yymsp[0].minor.yy974 = ORDER_ASC; } - break; - case 761: /* ordering_specification_opt ::= DESC */ - { yymsp[0].minor.yy974 = ORDER_DESC; } - break; - case 762: /* null_ordering_opt ::= */ - { yymsp[1].minor.yy109 = NULL_ORDER_DEFAULT; } - break; - case 763: /* null_ordering_opt ::= NULLS FIRST */ - { yymsp[-1].minor.yy109 = NULL_ORDER_FIRST; } - break; - case 764: /* null_ordering_opt ::= NULLS LAST */ - { yymsp[-1].minor.yy109 = NULL_ORDER_LAST; } - break; - case 767: /* column_options ::= column_options ENCODE NK_STRING */ - { yylhsminor.yy560 = setColumnOptions(pCxt, yymsp[-2].minor.yy560, COLUMN_OPTION_ENCODE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 768: /* column_options ::= column_options COMPRESS NK_STRING */ - { yylhsminor.yy560 = setColumnOptions(pCxt, yymsp[-2].minor.yy560, COLUMN_OPTION_COMPRESS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 769: /* column_options ::= column_options LEVEL NK_STRING */ - { yylhsminor.yy560 = setColumnOptions(pCxt, yymsp[-2].minor.yy560, COLUMN_OPTION_LEVEL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - default: - break; - /********** End reduce actions ************************************************/ ->>>>>>> f143f5f1bcee3e814ef83fc3d942a3eab3c2417b }; assert( yyruleno Date: Thu, 22 Aug 2024 15:59:42 +0800 Subject: [PATCH 042/695] adj state cache --- source/libs/executor/src/streamfilloperator.c | 14 -------------- source/libs/stream/src/streamSliceState.c | 14 ++++++++++---- source/libs/stream/src/tstreamFileState.c | 6 +++--- 3 files changed, 13 insertions(+), 21 deletions(-) diff --git a/source/libs/executor/src/streamfilloperator.c b/source/libs/executor/src/streamfilloperator.c index b35c1e738545..cb7d1cd20a5d 100644 --- a/source/libs/executor/src/streamfilloperator.c +++ b/source/libs/executor/src/streamfilloperator.c @@ -156,20 +156,6 @@ static void resetPrevAndNextWindow(SStreamFillSupporter* pFillSup) { resetFillWindow(&pFillSup->nextNext); } -void getCurWindowFromDiscBuf(SOperatorInfo* pOperator, TSKEY ts, uint64_t groupId, SStreamFillSupporter* pFillSup) { - SStorageAPI* pAPI = &pOperator->pTaskInfo->storageAPI; - - void* pState = pOperator->pTaskInfo->streamInfo.pState; - resetPrevAndNextWindow(pFillSup); - - SWinKey key = {.ts = ts, .groupId = groupId}; - int32_t curVLen = 0; - - int32_t code = pAPI->stateStore.streamStateFillGet(pState, &key, (void**)&pFillSup->cur.pRowVal, &curVLen, NULL); - ASSERT(code == TSDB_CODE_SUCCESS); - pFillSup->cur.key = key.ts; -} - void getWindowFromDiscBuf(SOperatorInfo* pOperator, TSKEY ts, uint64_t groupId, SStreamFillSupporter* pFillSup) { SStorageAPI* pAPI = &pOperator->pTaskInfo->storageAPI; void* pState = pOperator->pTaskInfo->streamInfo.pState; diff --git a/source/libs/stream/src/streamSliceState.c b/source/libs/stream/src/streamSliceState.c index 82d204c634ac..117d9621e101 100644 --- a/source/libs/stream/src/streamSliceState.c +++ b/source/libs/stream/src/streamSliceState.c @@ -20,7 +20,8 @@ #include "tcommon.h" #include "tsimplehash.h" -#define NUM_OF_FLUSED_WIN 64 +#define NUM_OF_CACHE_WIN 64 +#define MAX_NUM_OF_CACHE_WIN 128 int fillStateKeyCompare(const void* pWin1, const void* pDatas, int pos) { SWinKey* pWin2 = taosArrayGet(pDatas, pos); @@ -54,7 +55,7 @@ int32_t getHashSortRowBuff(SStreamFileState* pFileState, const SWinKey* pKey, vo SWinKey start = {.groupId = pKey->groupId, .ts = INT64_MAX}; void* pState = getStateFileStore(pFileState); SStreamStateCur* pCur = streamStateFillSeekKeyPrev_rocksdb(pState, &start); - for (int32_t i = 0; i < NUM_OF_FLUSED_WIN; i++) { + for (int32_t i = 0; i < NUM_OF_CACHE_WIN; i++) { SWinKey tmpKey = {.groupId = pKey->groupId}; int32_t tmpRes = streamStateGetGroupKVByCur_rocksdb(pCur, &tmpKey, NULL, 0); if (tmpRes != TSDB_CODE_SUCCESS) { @@ -83,6 +84,11 @@ int32_t getHashSortRowBuff(SStreamFileState* pFileState, const SWinKey* pKey, vo QUERY_CHECK_NULL(tmp, code, lino, _end, terrno); } + if (size >= MAX_NUM_OF_CACHE_WIN) { + int32_t num = size - NUM_OF_CACHE_WIN; + taosArrayRemoveBatch(pWinStates, 0, num, NULL); + } + _end: if (code != TSDB_CODE_SUCCESS) { qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); @@ -115,8 +121,8 @@ void clearSearchBuff(SStreamFileState* pFileState) { int64_t gpId = *(int64_t*)tSimpleHashGetKey(pIte, NULL); SWinKey key = {.ts = flushMark, .groupId = gpId}; int32_t num = binarySearch(pWinStates, size, &key, fillStateKeyCompare); - if (size > NUM_OF_FLUSED_WIN) { - num = TMIN(num, size - NUM_OF_FLUSED_WIN); + if (size > NUM_OF_CACHE_WIN) { + num = TMIN(num, size - NUM_OF_CACHE_WIN); taosArrayRemoveBatch(pWinStates, 0, num, NULL); } } diff --git a/source/libs/stream/src/tstreamFileState.c b/source/libs/stream/src/tstreamFileState.c index c97a93f50d54..60be901ac9d3 100644 --- a/source/libs/stream/src/tstreamFileState.c +++ b/source/libs/stream/src/tstreamFileState.c @@ -151,10 +151,10 @@ SStreamFileState* streamFileStateInit(int64_t memSize, uint32_t keySize, uint32_ rowSize += selectRowSize; pFileState->maxRowCount = TMAX((uint64_t)memSize / rowSize, FLUSH_NUM * 2); pFileState->usedBuffs = tdListNew(POINTER_BYTES); - QUERY_CHECK_NULL(pFileState->usedBuffs, code, lino, _error, terrno); + QUERY_CHECK_NULL(pFileState->usedBuffs, code, lino, _end, terrno); pFileState->freeBuffs = tdListNew(POINTER_BYTES); - QUERY_CHECK_NULL(pFileState->freeBuffs, code, lino, _error, terrno); + QUERY_CHECK_NULL(pFileState->freeBuffs, code, lino, _end, terrno); _hash_fn_t hashFn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY); int32_t cap = TMIN(MIN_NUM_OF_ROW_BUFF, pFileState->maxRowCount); @@ -230,7 +230,7 @@ SStreamFileState* streamFileStateInit(int64_t memSize, uint32_t keySize, uint32_ int32_t len = 0; int32_t tmpRes = streamDefaultGet_rocksdb(pFileState->pFileStore, STREAM_STATE_INFO_NAME, &valBuf, &len); if (tmpRes == TSDB_CODE_SUCCESS) { - QUERY_CHECK_CONDITION((len == sizeof(TSKEY)), code, lino, _error, TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR); + QUERY_CHECK_CONDITION((len == sizeof(TSKEY)), code, lino, _end, TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR); streamFileStateDecode(&pFileState->flushMark, valBuf, len); qDebug("===stream===flushMark read:%" PRId64, pFileState->flushMark); } From 7361d95516dbad5c8e84f7420b92586290cd4fac Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Wed, 28 Aug 2024 14:07:55 +0800 Subject: [PATCH 043/695] adj error code --- .../executor/src/streamtimesliceoperator.c | 33 ++++++++++++------- 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/source/libs/executor/src/streamtimesliceoperator.c b/source/libs/executor/src/streamtimesliceoperator.c index 0607250ca488..80cf2d8d00b6 100644 --- a/source/libs/executor/src/streamtimesliceoperator.c +++ b/source/libs/executor/src/streamtimesliceoperator.c @@ -1244,8 +1244,9 @@ static void doStreamTimeSliceImpl(SOperatorInfo* pOperator, SSDataBlock* pBlock) if (right) { transBlockToResultRow(pBlock, startPos, tsCols[startPos], curPoint.pRightRow); bool needDel = pInfo->destHasPrimaryKey && winCode == TSDB_CODE_SUCCESS; - saveTimeSliceWinResultInfo(pAggSup, pInfo->twAggSup.calTrigger, &curPoint.key, pInfo->pUpdatedMap, needDel, - pInfo->pDeletedMap); + code = saveTimeSliceWinResultInfo(pAggSup, pInfo->twAggSup.calTrigger, &curPoint.key, pInfo->pUpdatedMap, needDel, + pInfo->pDeletedMap); + QUERY_CHECK_CODE(code, lino, _end); } releaseOutputBuf(pAggSup->pState, curPoint.pResPos, &pAggSup->stateStore); @@ -1259,8 +1260,9 @@ static void doStreamTimeSliceImpl(SOperatorInfo* pOperator, SSDataBlock* pBlock) if (left) { transBlockToResultRow(pBlock, leftRowId, tsCols[leftRowId], nextPoint.pLeftRow); bool needDel = pInfo->destHasPrimaryKey && winCode == TSDB_CODE_SUCCESS; - saveTimeSliceWinResultInfo(pAggSup, pInfo->twAggSup.calTrigger, &nextPoint.key, pInfo->pUpdatedMap, needDel, - pInfo->pDeletedMap); + code = saveTimeSliceWinResultInfo(pAggSup, pInfo->twAggSup.calTrigger, &nextPoint.key, pInfo->pUpdatedMap, + needDel, pInfo->pDeletedMap); + QUERY_CHECK_CODE(code, lino, _end); } releaseOutputBuf(pAggSup->pState, nextPoint.pResPos, &pAggSup->stateStore); @@ -1280,8 +1282,9 @@ static void doStreamTimeSliceImpl(SOperatorInfo* pOperator, SSDataBlock* pBlock) if (right) { transBlockToResultRow(pBlock, startPos, tsCols[startPos], curPoint.pRightRow); bool needDel = pInfo->destHasPrimaryKey && winCode == TSDB_CODE_SUCCESS; - saveTimeSliceWinResultInfo(pAggSup, pInfo->twAggSup.calTrigger, &curPoint.key, pInfo->pUpdatedMap, needDel, - pInfo->pDeletedMap); + code = saveTimeSliceWinResultInfo(pAggSup, pInfo->twAggSup.calTrigger, &curPoint.key, pInfo->pUpdatedMap, needDel, + pInfo->pDeletedMap); + QUERY_CHECK_CODE(code, lino, _end); } releaseOutputBuf(pAggSup->pState, curPoint.pResPos, &pAggSup->stateStore); } @@ -1563,7 +1566,8 @@ static int32_t doStreamTimeSliceNext(SOperatorInfo* pOperator, SSDataBlock** ppR case STREAM_DELETE_DATA: { code = doDeleteTimeSliceResult(pAggSup, pBlock, pInfo->pUpdatedMap, pInfo->pDelWins); QUERY_CHECK_CODE(code, lino, _end); - copyDataBlock(pInfo->pDelRes, pBlock); + code = copyDataBlock(pInfo->pDelRes, pBlock); + QUERY_CHECK_CODE(code, lino, _end); pInfo->pDelRes->info.type = STREAM_DELETE_RESULT; (*ppRes) = pInfo->pDelRes; printDataBlock((*ppRes), getStreamOpName(pOperator->operatorType), GET_TASKID(pTaskInfo)); @@ -1573,7 +1577,8 @@ static int32_t doStreamTimeSliceNext(SOperatorInfo* pOperator, SSDataBlock** ppR case STREAM_INVALID: { SExprSupp* pExprSup = &pInfo->scalarSup; if (pExprSup->pExprInfo != NULL) { - projectApplyFunctions(pExprSup->pExprInfo, pBlock, pBlock, pExprSup->pCtx, pExprSup->numOfExprs, NULL); + code = projectApplyFunctions(pExprSup->pExprInfo, pBlock, pBlock, pExprSup->pCtx, pExprSup->numOfExprs, NULL); + QUERY_CHECK_CODE(code, lino, _end); } } break; case STREAM_CHECKPOINT: { @@ -1581,7 +1586,8 @@ static int32_t doStreamTimeSliceNext(SOperatorInfo* pOperator, SSDataBlock** ppR pAggSup->stateStore.streamStateCommit(pAggSup->pState); doStreamTimeSliceSaveCheckpoint(pOperator); pInfo->recvCkBlock = true; - copyDataBlock(pInfo->pCheckpointRes, pBlock); + code = copyDataBlock(pInfo->pCheckpointRes, pBlock); + QUERY_CHECK_CODE(code, lino, _end); continue; } break; case STREAM_CREATE_CHILD_TABLE: { @@ -1589,7 +1595,8 @@ static int32_t doStreamTimeSliceNext(SOperatorInfo* pOperator, SSDataBlock** ppR goto _end; } break; case STREAM_GET_RESULT: { - setAllResultKey(pAggSup, pBlock->info.window.skey, pInfo->pUpdatedMap); + code = setAllResultKey(pAggSup, pBlock->info.window.skey, pInfo->pUpdatedMap); + QUERY_CHECK_CODE(code, lino, _end); continue; } default: @@ -1601,7 +1608,8 @@ static int32_t doStreamTimeSliceNext(SOperatorInfo* pOperator, SSDataBlock** ppR } if (pInfo->destHasPrimaryKey) { - copyIntervalDeleteKey(pInfo->pDeletedMap, pInfo->pDelWins); + code = copyIntervalDeleteKey(pInfo->pDeletedMap, pInfo->pDelWins); + QUERY_CHECK_CODE(code, lino, _end); } void* pIte = NULL; @@ -1801,7 +1809,8 @@ int32_t createStreamTimeSliceOperatorInfo(SOperatorInfo* downstream, SPhysiNode* &pTaskInfo->storageAPI, pInfo->primaryTsIndex, STREAM_STATE_BUFF_HASH_SORT, ratio); QUERY_CHECK_CODE(code, lino, _error); - initExecTimeWindowInfo(&pInfo->twAggSup.timeWindowData, &pTaskInfo->window); + code = initExecTimeWindowInfo(&pInfo->twAggSup.timeWindowData, &pTaskInfo->window); + QUERY_CHECK_CODE(code, lino, _error); pInfo->pRes = createDataBlockFromDescNode(pPhyNode->pOutputDataBlockDesc); pInfo->delIndex = 0; From 73c3035a00c8a834f912371e94553e3dc26a5e1b Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Thu, 29 Aug 2024 13:50:07 +0800 Subject: [PATCH 044/695] add test --- tests/parallel_test/cases.task | 17 +++++++++++++++++ tests/script/tsim/stream/checkTaskStatus.sim | 1 + 2 files changed, 18 insertions(+) diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 3ec1d7c428ba..24b45079b807 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -1350,6 +1350,23 @@ ,,y,script,./test.sh -f tsim/stream/sliding.sim ,,y,script,./test.sh -f tsim/stream/state0.sim ,,y,script,./test.sh -f tsim/stream/state1.sim +,,y,script,./test.sh -f tsim/stream/streamInterpDelete0.sim +,,y,script,./test.sh -f tsim/stream/streamInterpDelete1.sim +,,y,script,./test.sh -f tsim/stream/streamInterpDelete2.sim +,,y,script,./test.sh -f tsim/stream/streamInterpError.sim +,,y,script,./test.sh -f tsim/stream/streamInterpHistory.sim +,,y,script,./test.sh -f tsim/stream/streamInterpHistory1.sim +,,y,script,./test.sh -f tsim/stream/streamInterpLarge.sim +,,y,script,./test.sh -f tsim/stream/streamInterpLinear0.sim +,,y,script,./test.sh -f tsim/stream/streamInterpNext0.sim +,,y,script,./test.sh -f tsim/stream/streamInterpOther.sim +,,y,script,./test.sh -f tsim/stream/streamInterpOther1.sim +,,y,script,./test.sh -f tsim/stream/streamInterpPartitionBy0.sim +,,y,script,./test.sh -f tsim/stream/streamInterpPrev0.sim +,,y,script,./test.sh -f tsim/stream/streamInterpPrev1.sim +,,y,script,./test.sh -f tsim/stream/streamInterpUpdate.sim +,,y,script,./test.sh -f tsim/stream/streamInterpUpdate1.sim +,,y,script,./test.sh -f tsim/stream/streamInterpValue0.sim ,,y,script,./test.sh -f tsim/stream/streamPrimaryKey0.sim ,,y,script,./test.sh -f tsim/stream/streamPrimaryKey1.sim ,,y,script,./test.sh -f tsim/stream/streamPrimaryKey2.sim diff --git a/tests/script/tsim/stream/checkTaskStatus.sim b/tests/script/tsim/stream/checkTaskStatus.sim index 8b30d27841eb..0e171b3059f2 100644 --- a/tests/script/tsim/stream/checkTaskStatus.sim +++ b/tests/script/tsim/stream/checkTaskStatus.sim @@ -9,6 +9,7 @@ sleep 1000 $loop_count = $loop_count + 1 if $loop_count == 60 then + print check task status failed return 1 endi From d7731b2a73eac219696cc73917ce509ee097915e Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Mon, 2 Sep 2024 13:16:59 +0800 Subject: [PATCH 045/695] adj test case --- tests/script/tsim/stream/streamInterpError.sim | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/tests/script/tsim/stream/streamInterpError.sim b/tests/script/tsim/stream/streamInterpError.sim index 39abc0aa2adc..710d10c44183 100644 --- a/tests/script/tsim/stream/streamInterpError.sim +++ b/tests/script/tsim/stream/streamInterpError.sim @@ -88,11 +88,17 @@ sql create table t2 using st tags(2,2,2); print step3_0 -sql create stream streams3_0_1 trigger at_once FILL_HISTORY 1 IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt3_0_1 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(prev); -sql_error create stream streams3_0_2 trigger at_once FILL_HISTORY 1 IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt3_0_2 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(next); -sql_error create stream streams3_0_3 trigger at_once FILL_HISTORY 1 IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt3_0_3 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(linear); -sql create stream streams3_0_4 trigger at_once FILL_HISTORY 1 IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt3_0_4 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(NULL); -sql create stream streams3_0_5 trigger at_once FILL_HISTORY 1 IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt3_0_5 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(value,11,22,33,44); +sql create stream streams3_0_1 trigger force_window_close FILL_HISTORY 0 IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt3_0_1 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(prev); + +sleep 5000 + +sql_error create stream streams3_0_2 trigger force_window_close FILL_HISTORY 0 IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt3_0_2 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(next); +sql_error create stream streams3_0_3 trigger force_window_close FILL_HISTORY 0 IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt3_0_3 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(linear); +sql create stream streams3_0_4 trigger force_window_close FILL_HISTORY 0 IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt3_0_4 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(NULL); + +sleep 5000 + +sql create stream streams3_0_5 trigger force_window_close FILL_HISTORY 0 IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt3_0_5 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(value,11,22,33,44); run tsim/stream/checkTaskStatus.sim From 952f5f3f6bc1fdaceca7479b06640c677c595cfd Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Mon, 2 Sep 2024 16:31:43 +0800 Subject: [PATCH 046/695] fis issue --- source/libs/stream/src/streamSliceState.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/stream/src/streamSliceState.c b/source/libs/stream/src/streamSliceState.c index 117d9621e101..c4d550e6f4a7 100644 --- a/source/libs/stream/src/streamSliceState.c +++ b/source/libs/stream/src/streamSliceState.c @@ -61,7 +61,7 @@ int32_t getHashSortRowBuff(SStreamFileState* pFileState, const SWinKey* pKey, vo if (tmpRes != TSDB_CODE_SUCCESS) { break; } - void* tmp = taosArrayPush(pWinStates, &tmp); + void* tmp = taosArrayPush(pWinStates, &tmpKey); QUERY_CHECK_NULL(tmp, code, lino, _end, terrno); streamStateCurPrev_rocksdb(pCur); } From a0a1414af56ac0701299e403cf667faa6aee1bef Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Tue, 3 Sep 2024 09:23:42 +0800 Subject: [PATCH 047/695] fix issue --- source/libs/executor/src/streamtimesliceoperator.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/source/libs/executor/src/streamtimesliceoperator.c b/source/libs/executor/src/streamtimesliceoperator.c index e4db77b43f8c..eed49032a6df 100644 --- a/source/libs/executor/src/streamtimesliceoperator.c +++ b/source/libs/executor/src/streamtimesliceoperator.c @@ -1152,22 +1152,23 @@ static void transBlockToResultRow(const SSDataBlock* pBlock, int32_t rowId, TSKE pRowVal->key = ts; } -static int32_t saveTimeSliceWinResultInfo(SStreamAggSupporter* pAggSup, int8_t trigger, SWinKey* pKey, +static int32_t saveTimeSliceWinResultInfo(SStreamAggSupporter* pAggSup, STimeWindowAggSupp* pTwAggSup, SWinKey* pKey, SSHashObj* pUpdatedMap, bool needDel, SSHashObj* pDeletedMap) { int32_t code = TSDB_CODE_SUCCESS; int32_t lino = 0; - if (trigger == STREAM_TRIGGER_AT_ONCE) { + if (pTwAggSup->calTrigger == STREAM_TRIGGER_AT_ONCE) { code = saveTimeSliceWinResult(pKey, pUpdatedMap); QUERY_CHECK_CODE(code, lino, _end); if (needDel) { code = saveTimeSliceWinResult(pKey, pDeletedMap); QUERY_CHECK_CODE(code, lino, _end); } - } else if (trigger == STREAM_TRIGGER_FORCE_WINDOW_CLOSE) { + } else if (pTwAggSup->calTrigger == STREAM_TRIGGER_FORCE_WINDOW_CLOSE) { code = pAggSup->stateStore.streamStateGroupPut(pAggSup->pState, pKey->groupId, NULL, 0); QUERY_CHECK_CODE(code, lino, _end); } + pTwAggSup->maxTs = TMAX(pTwAggSup->maxTs, pKey->ts); _end: if (code != TSDB_CODE_SUCCESS) { @@ -1244,7 +1245,7 @@ static void doStreamTimeSliceImpl(SOperatorInfo* pOperator, SSDataBlock* pBlock) if (right) { transBlockToResultRow(pBlock, startPos, tsCols[startPos], curPoint.pRightRow); bool needDel = pInfo->destHasPrimaryKey && winCode == TSDB_CODE_SUCCESS; - code = saveTimeSliceWinResultInfo(pAggSup, pInfo->twAggSup.calTrigger, &curPoint.key, pInfo->pUpdatedMap, needDel, + code = saveTimeSliceWinResultInfo(pAggSup, &pInfo->twAggSup, &curPoint.key, pInfo->pUpdatedMap, needDel, pInfo->pDeletedMap); QUERY_CHECK_CODE(code, lino, _end); } @@ -1260,7 +1261,7 @@ static void doStreamTimeSliceImpl(SOperatorInfo* pOperator, SSDataBlock* pBlock) if (left) { transBlockToResultRow(pBlock, leftRowId, tsCols[leftRowId], nextPoint.pLeftRow); bool needDel = pInfo->destHasPrimaryKey && winCode == TSDB_CODE_SUCCESS; - code = saveTimeSliceWinResultInfo(pAggSup, pInfo->twAggSup.calTrigger, &nextPoint.key, pInfo->pUpdatedMap, + code = saveTimeSliceWinResultInfo(pAggSup, &pInfo->twAggSup, &nextPoint.key, pInfo->pUpdatedMap, needDel, pInfo->pDeletedMap); QUERY_CHECK_CODE(code, lino, _end); } @@ -1282,7 +1283,7 @@ static void doStreamTimeSliceImpl(SOperatorInfo* pOperator, SSDataBlock* pBlock) if (right) { transBlockToResultRow(pBlock, startPos, tsCols[startPos], curPoint.pRightRow); bool needDel = pInfo->destHasPrimaryKey && winCode == TSDB_CODE_SUCCESS; - code = saveTimeSliceWinResultInfo(pAggSup, pInfo->twAggSup.calTrigger, &curPoint.key, pInfo->pUpdatedMap, needDel, + code = saveTimeSliceWinResultInfo(pAggSup, &pInfo->twAggSup, &curPoint.key, pInfo->pUpdatedMap, needDel, pInfo->pDeletedMap); QUERY_CHECK_CODE(code, lino, _end); } From 54f81fa1f891886e4accd8b8356a77feedb7c8fc Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Tue, 3 Sep 2024 09:49:37 +0800 Subject: [PATCH 048/695] add log --- source/libs/executor/src/streamtimesliceoperator.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source/libs/executor/src/streamtimesliceoperator.c b/source/libs/executor/src/streamtimesliceoperator.c index eed49032a6df..617ee7c52698 100644 --- a/source/libs/executor/src/streamtimesliceoperator.c +++ b/source/libs/executor/src/streamtimesliceoperator.c @@ -91,6 +91,7 @@ void streamTimeSliceReloadState(SOperatorInfo* pOperator) { TSKEY ts = *(TSKEY*)((char*)pBuf + size - sizeof(TSKEY)); pInfo->twAggSup.maxTs = TMAX(pInfo->twAggSup.maxTs, ts); pAggSup->stateStore.streamStateReloadInfo(pAggSup->pState, ts); + qDebug("===stream=== reload state. reload ts:%" PRId64, ts); if (!pInfo->pUpdatedMap && num > 0) { _hash_fn_t hashFn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY); From 26c74603f3a223403b826a405863be32c10062b5 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Tue, 3 Sep 2024 15:15:30 +0800 Subject: [PATCH 049/695] add ci --- .../script/tsim/stream/streamInterpNext1.sim | 157 ++++++++++++++++++ .../script/tsim/stream/streamInterpPrev1.sim | 157 ++++++++++++++++++ 2 files changed, 314 insertions(+) diff --git a/tests/script/tsim/stream/streamInterpNext1.sim b/tests/script/tsim/stream/streamInterpNext1.sim index d924c82a502a..9631ce8ecebd 100644 --- a/tests/script/tsim/stream/streamInterpNext1.sim +++ b/tests/script/tsim/stream/streamInterpNext1.sim @@ -244,4 +244,161 @@ if $data61 != 5 then goto loop4 endi +print step3 + +sql create database test3 vgroups 1; +sql use test3; + +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stream streams3 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 every(1s) fill(next); + +run tsim/stream/checkTaskStatus.sim + +sql insert into t1 values(1648791213001,1,1,1,1.0) (1648791219001,2,2,2,2.1) (1648791229001,3,3,3,3.1); + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791213000, 1648791229001) every(1s) fill(next); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791213000, 1648791229001) every(1s) fill(next); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 +print $data60 $data61 $data62 $data63 $data64 +print $data70 $data71 $data72 $data73 $data74 + + +$loop_count = 0 +loop5: + +sleep 300 + +print sql select * from streamt order by 1; +sql select * from streamt order by 1; + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +if $rows != 16 then + print =====rows=$rows + goto loop5 +endi + +sql insert into t1 values(1648791215001,4,4,4,4.0) (1648791217001,5,5,5,5.1) (1648791222000,6,6,6,6.1) (1648791226000,7,7,7,7.1); + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791213000, 1648791229001) every(1s) fill(next); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791213000, 1648791229001) every(1s) fill(next); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 +print $data60 $data61 $data62 $data63 $data64 +print $data70 $data71 $data72 $data73 $data74 + + +$loop_count = 0 +loop6: + +sleep 300 + +print sql select * from streamt order by 1; +sql select * from streamt order by 1; + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +if $rows != 16 then + goto loop6 +endi + +if $data01 != 4 then + print =====data01=$data01 + goto loop6 +endi + +if $data11 != 4 then + print =====data11=$data11 + goto loop6 +endi + +if $data21 != 5 then + print =====data21=$data21 + goto loop6 +endi + +if $data31 != 5 then + print =====data31=$data31 + goto loop6 +endi + +if $data41 != 2 then + print =====data41=$data41 + goto loop6 +endi + +if $data51 != 2 then + print =====data51=$data51 + goto loop6 +endi + +if $data61 != 6 then + print =====data61=$data61 + goto loop6 +endi + +if $data71 != 6 then + print =====data71=$data71 + goto loop6 +endi + +if $data81 != 6 then + print =====data81=$data81 + goto loop6 +endi + +if $data91 != 7 then + print =====data91=$data91 + goto loop6 +endi + +if $data[10][1] != 7 then + print =====data[10][1]=$data[10][1] + goto loop6 +endi + +if $data[11][1] != 7 then + print =====data[11][1]=$data[11][1] + goto loop6 +endi + +if $data[12][1] != 7 then + print =====data[12][1]=$data[12][1] + goto loop6 +endi + +if $data[13][1] != 3 then + print =====data[13][1]=$data[13][1] + goto loop6 +endi + +if $data[14][1] != 3 then + print =====data[14][1]=$data[14][1] + goto loop6 +endi + +if $data[15][1] != 3 then + print =====data[15][1]=$data[15][1] + goto loop6 +endi + +print end + system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/stream/streamInterpPrev1.sim b/tests/script/tsim/stream/streamInterpPrev1.sim index be8b129a4bb7..0beeb3e9a764 100644 --- a/tests/script/tsim/stream/streamInterpPrev1.sim +++ b/tests/script/tsim/stream/streamInterpPrev1.sim @@ -244,4 +244,161 @@ if $data61 != 5 then goto loop4 endi +print step3 + +sql create database test3 vgroups 1; +sql use test3; + +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stream streams3 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 every(1s) fill(prev); + +run tsim/stream/checkTaskStatus.sim + +sql insert into t1 values(1648791213001,1,1,1,1.0) (1648791219001,2,2,2,2.1) (1648791229001,3,3,3,3.1); + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791213000, 1648791229001) every(1s) fill(prev); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791213000, 1648791229001) every(1s) fill(prev); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 +print $data60 $data61 $data62 $data63 $data64 +print $data70 $data71 $data72 $data73 $data74 + + +$loop_count = 0 +loop5: + +sleep 300 + +print sql select * from streamt order by 1; +sql select * from streamt order by 1; + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +if $rows != 16 then + print =====rows=$rows + goto loop5 +endi + +sql insert into t1 values(1648791215001,4,4,4,4.0) (1648791217001,5,5,5,5.1) (1648791222000,6,6,6,6.1) (1648791226000,7,7,7,7.1); + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791213000, 1648791229001) every(1s) fill(prev); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791213000, 1648791229001) every(1s) fill(prev); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 +print $data60 $data61 $data62 $data63 $data64 +print $data70 $data71 $data72 $data73 $data74 + + +$loop_count = 0 +loop6: + +sleep 300 + +print sql select * from streamt order by 1; +sql select * from streamt order by 1; + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +if $rows != 16 then + goto loop6 +endi + +if $data01 != 1 then + print =====data01=$data01 + goto loop6 +endi + +if $data11 != 1 then + print =====data11=$data11 + goto loop6 +endi + +if $data21 != 4 then + print =====data21=$data21 + goto loop6 +endi + +if $data31 != 4 then + print =====data31=$data31 + goto loop6 +endi + +if $data41 != 5 then + print =====data41=$data41 + goto loop6 +endi + +if $data51 != 5 then + print =====data51=$data51 + goto loop6 +endi + +if $data61 != 2 then + print =====data61=$data61 + goto loop6 +endi + +if $data71 != 2 then + print =====data71=$data71 + goto loop6 +endi + +if $data81 != 6 then + print =====data81=$data81 + goto loop6 +endi + +if $data91 != 6 then + print =====data91=$data91 + goto loop6 +endi + +if $data[10][1] != 6 then + print =====data[10][1]=$data[10][1] + goto loop6 +endi + +if $data[11][1] != 6 then + print =====data[11][1]=$data[11][1] + goto loop6 +endi + +if $data[12][1] != 7 then + print =====data[12][1]=$data[12][1] + goto loop6 +endi + +if $data[13][1] != 7 then + print =====data[13][1]=$data[13][1] + goto loop6 +endi + +if $data[14][1] != 7 then + print =====data[14][1]=$data[14][1] + goto loop6 +endi + +if $data[15][1] != 7 then + print =====data[15][1]=$data[15][1] + goto loop6 +endi + +print end + system sh/exec.sh -n dnode1 -s stop -x SIGINT From 2b6dc42d0ededa028b40d2824cf90e7dc6edd8d3 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Tue, 3 Sep 2024 17:54:07 +0800 Subject: [PATCH 050/695] fix fill next's issue --- .../executor/src/streamtimesliceoperator.c | 31 +- .../script/tsim/stream/streamInterpNext1.sim | 73 +++ .../script/tsim/stream/streamInterpOther1.sim | 20 +- .../script/tsim/stream/streamInterpValue1.sim | 477 ++++++++++++++++++ 4 files changed, 585 insertions(+), 16 deletions(-) create mode 100644 tests/script/tsim/stream/streamInterpValue1.sim diff --git a/source/libs/executor/src/streamtimesliceoperator.c b/source/libs/executor/src/streamtimesliceoperator.c index 617ee7c52698..87a0afa917da 100644 --- a/source/libs/executor/src/streamtimesliceoperator.c +++ b/source/libs/executor/src/streamtimesliceoperator.c @@ -507,6 +507,14 @@ static TSKEY adustEndTsKey(TSKEY pointTs, TSKEY rowTs, SInterval* pInterval) { return pointTs; } +static void adjustFillResRow(SResultRowData** ppResRow, SStreamFillSupporter* pFillSup) { + if (pFillSup->type == TSDB_FILL_PREV) { + (*ppResRow) = &pFillSup->cur; + } else if (pFillSup->type == TSDB_FILL_NEXT){ + (*ppResRow) = &pFillSup->next; + } +} + static void doStreamFillRange(SStreamFillSupporter* pFillSup, SStreamFillInfo* pFillInfo, SSDataBlock* pRes) { int32_t code = TSDB_CODE_SUCCESS; int32_t lino = 0; @@ -538,7 +546,7 @@ static void doStreamFillRange(SStreamFillSupporter* pFillSup, SStreamFillInfo* p pFillInfo->hasNext = false; TSKEY startTs = adustPrevTsKey(pFillInfo->current, pFillSup->cur.key, &pFillSup->interval); setFillKeyInfo(startTs, pFillSup->next.key, &pFillSup->interval, pFillInfo); - pFillInfo->pResRow = &pFillSup->cur; + adjustFillResRow(&pFillInfo->pResRow, pFillSup); fillNormalRange(pFillSup, pFillInfo, pRes); } @@ -1004,7 +1012,12 @@ static void setTimeSliceFillRule(SStreamFillSupporter* pFillSup, SStreamFillInfo case TSDB_FILL_NULL_F: case TSDB_FILL_SET_VALUE: case TSDB_FILL_SET_VALUE_F: { - if (hasPrevWindow(pFillSup)) { + if (hasPrevWindow(pFillSup) && hasNextWindow(pFillSup) && pFillInfo->preRowKey == pFillInfo->prePointKey && + pFillInfo->nextRowKey != pFillInfo->nextPointKey) { + setFillKeyInfo(prevWKey, endTs, &pFillSup->interval, pFillInfo); + pFillInfo->pos = FILL_POS_MID; + pFillInfo->hasNext = true; + } else if (hasPrevWindow(pFillSup)) { setFillKeyInfo(prevWKey, endTs, &pFillSup->interval, pFillInfo); pFillInfo->pos = FILL_POS_END; } else { @@ -1033,19 +1046,25 @@ static void setTimeSliceFillRule(SStreamFillSupporter* pFillSup, SStreamFillInfo pFillInfo->pResRow = &pFillSup->prev; } break; case TSDB_FILL_NEXT: { - if (hasPrevWindow(pFillSup)) { + if (hasPrevWindow(pFillSup) && hasNextWindow(pFillSup) && pFillInfo->preRowKey == pFillInfo->prePointKey && + pFillInfo->nextRowKey != pFillInfo->nextPointKey) { + setFillKeyInfo(prevWKey, endTs, &pFillSup->interval, pFillInfo); + pFillInfo->pos = FILL_POS_MID; + pFillInfo->hasNext = true; + pFillInfo->pResRow = &pFillSup->cur; + } else if (hasPrevWindow(pFillSup)) { setFillKeyInfo(prevWKey, endTs, &pFillSup->interval, pFillInfo); pFillInfo->pos = FILL_POS_END; resetFillWindow(&pFillSup->next); pFillSup->next.key = ts; pFillSup->next.pRowVal = pFillSup->cur.pRowVal; + pFillInfo->pResRow = &pFillSup->next; } else { - ASSERT(hasNextWindow(pFillSup)); setFillKeyInfo(startTs, nextWKey, &pFillSup->interval, pFillInfo); pFillInfo->pos = FILL_POS_START; resetFillWindow(&pFillSup->prev); + pFillInfo->pResRow = &pFillSup->next; } - pFillInfo->pResRow = &pFillSup->next; } break; case TSDB_FILL_LINEAR: { if (hasPrevWindow(pFillSup) && hasNextWindow(pFillSup)) { @@ -1351,7 +1370,7 @@ void doBuildTimeSlicePointResult(SStreamAggSupporter* pAggSup, STimeWindowAggSup } QUERY_CHECK_CODE(code, lino, _end); - if (pFillSup->type == TSDB_FILL_PREV) { + if (pFillSup->type != TSDB_FILL_LINEAR) { getPrevResKey(pKey->groupId, pGroupResInfo->pRows, pGroupResInfo->index, &pFillInfo->preRowKey); if (hasPrevWindow(pFillSup)) { pFillInfo->prePointKey = prevPoint.key.ts; diff --git a/tests/script/tsim/stream/streamInterpNext1.sim b/tests/script/tsim/stream/streamInterpNext1.sim index 9631ce8ecebd..f74863d7a36c 100644 --- a/tests/script/tsim/stream/streamInterpNext1.sim +++ b/tests/script/tsim/stream/streamInterpNext1.sim @@ -399,6 +399,79 @@ if $data[15][1] != 3 then goto loop6 endi + +print step4 + +sql create database test4 vgroups 1; +sql use test4; + +sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int); +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); + +sql create stream streams4 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt4 as select _irowts, interp(a) as b, _isfilled as a from st partition by tbname, b as cc every(1s) fill(next); + +run tsim/stream/checkTaskStatus.sim + +sql insert into t1 values(1648791217000,20000,2,3); + +sleep 2000 + +sql insert into t1 values(1648791212000,10000,2,3) (1648791215001,20,2,3); + +$loop_count = 0 +loop7: + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +sleep 300 + +print sql select a,b from streamt4; +sql select a,b from streamt4; + +if $rows != 6 then + print ======rows=$rows + goto loop7 +endi + +if $data00 != 0 then + print ======data00=$data00 + goto loop7 +endi + +if $data01 != 10000 then + print ======data01=$data01 + goto loop7 +endi + +if $data10 != 1 then + print ======data10=$data10 + goto loop7 +endi + +if $data20 != 1 then + print ======data20=$data20 + goto loop7 +endi + +if $data41 != 20000 then + print ======data41=$data41 + goto loop7 +endi + +if $data50 != 0 then + print ======data50=$data50 + goto loop7 +endi + +if $data51 != 20000 then + print ======data51=$data51 + goto loop7 +endi + print end system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/stream/streamInterpOther1.sim b/tests/script/tsim/stream/streamInterpOther1.sim index 4a2ea56a8f43..941b3e18f037 100644 --- a/tests/script/tsim/stream/streamInterpOther1.sim +++ b/tests/script/tsim/stream/streamInterpOther1.sim @@ -21,11 +21,11 @@ run tsim/stream/checkTaskStatus.sim sql insert into t1 values(1648791217000,20000,2,3); -sleep 500 +sleep 2000 sql insert into t1 values(1648791212000,10000,2,3); -sleep 500 +sleep 2000 sql insert into t1 values(1648791215001,20,2,3); @@ -94,11 +94,11 @@ run tsim/stream/checkTaskStatus.sim sql insert into t1 values(1648791217000,20000,2,3); -sleep 500 +sleep 2000 sql insert into t1 values(1648791212000,10000,2,3); -sleep 500 +sleep 2000 sql insert into t1 values(1648791215001,20,2,3); @@ -167,11 +167,11 @@ run tsim/stream/checkTaskStatus.sim sql insert into t1 values(1648791217000,20000,2,3); -sleep 500 +sleep 2000 sql insert into t1 values(1648791212000,10000,2,3); -sleep 500 +sleep 2000 sql insert into t1 values(1648791215001,20,2,3); @@ -240,11 +240,11 @@ run tsim/stream/checkTaskStatus.sim sql insert into t1 values(1648791217000,20000,2,3); -sleep 500 +sleep 2000 sql insert into t1 values(1648791212000,10000,2,3); -sleep 500 +sleep 2000 sql insert into t1 values(1648791215001,20,2,3); @@ -313,11 +313,11 @@ run tsim/stream/checkTaskStatus.sim sql insert into t1 values(1648791217000,20000,2,3); -sleep 500 +sleep 2000 sql insert into t1 values(1648791212000,10000,2,3); -sleep 500 +sleep 2000 sql insert into t1 values(1648791215001,20,2,3); diff --git a/tests/script/tsim/stream/streamInterpValue1.sim b/tests/script/tsim/stream/streamInterpValue1.sim new file mode 100644 index 000000000000..84a0e28300c0 --- /dev/null +++ b/tests/script/tsim/stream/streamInterpValue1.sim @@ -0,0 +1,477 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sleep 50 +sql connect + +print step1 +print =============== create database +sql create database test vgroups 1; +sql use test; + +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 every(1s) fill(NULL); + +run tsim/stream/checkTaskStatus.sim + + +sql insert into t1 values(1648791213000,1,1,1,1.0); + +$loop_count = 0 + +loop0: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows != 1 then + print ======rows=$rows + goto loop0 +endi + +# row 0 +if $data01 != 1 then + print ======data01=$data01 + goto loop0 +endi + + +sql insert into t1 values(1648791213009,3,3,3,1.0) (1648791217001,4,4,4,4.1); + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791213000, 1648791217001) every(1s) fill(NULL); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791213000, 1648791217001) every(1s) fill(NULL); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +$loop_count = 0 +loop2: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 2 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +# row 0 +if $rows != 5 then + print ======rows=$rows + goto loop2 +endi + +# row 0 +if $data01 != 1 then + print ======data01=$data01 + goto loop2 +endi + +if $data11 != NULL then + print ======data11=$data11 + goto loop2 +endi + +if $data21 != NULL then + print ======data21=$data21 + goto loop2 +endi + +if $data31 != NULL then + print ======data31=$data31 + goto loop2 +endi + +if $data41 != NULL then + print ======data41=$data41 + goto loop2 +endi + + +print step2 + +sql create database test2 vgroups 1; +sql use test2; + +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 every(1s) fill(NULL); + +run tsim/stream/checkTaskStatus.sim + +sql insert into t1 values(1648791213000,1,1,1,1.0); + + +$loop_count = 0 + +loop3: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows != 1 then + print ======rows=$rows + goto loop3 +endi + +# row 0 +if $data01 != 1 then + print ======data01=$data01 + goto loop3 +endi + + +sql insert into t1 values(1648791213009,3,3,3,1.0) (1648791217001,4,4,4,4.1) (1648791219000,5,5,5,5.1); + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791213000, 1648791219000) every(1s) fill(NULL); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791213000, 1648791219000) every(1s) fill(NULL); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 +print $data60 $data61 $data62 $data63 $data64 +print $data70 $data71 $data72 $data73 $data74 + + +$loop_count = 0 +loop4: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 2 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 +print $data60 $data61 $data62 $data63 $data64 +print $data70 $data71 $data72 $data73 $data74 + +# row 0 +if $rows != 7 then + print ======rows=$rows + goto loop4 +endi + +# row 0 +if $data01 != 1 then + print ======data01=$data01 + goto loop4 +endi + +if $data11 != NULL then + print ======data11=$data11 + goto loop4 +endi + +if $data21 != NULL then + print ======data21=$data21 + goto loop4 +endi + +if $data31 != NULL then + print ======data31=$data31 + goto loop4 +endi + +if $data41 != NULL then + print ======data41=$data41 + goto loop4 +endi + +if $data51 != NULL then + print ======data51=$data51 + goto loop4 +endi + +if $data61 != 5 then + print ======data61=$data61 + goto loop4 +endi + +print step3 + +sql create database test3 vgroups 1; +sql use test3; + +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stream streams3 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 every(1s) fill(NULL); + +run tsim/stream/checkTaskStatus.sim + +sql insert into t1 values(1648791213001,1,1,1,1.0) (1648791219001,2,2,2,2.1) (1648791229001,3,3,3,3.1); + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791213000, 1648791229001) every(1s) fill(NULL); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791213000, 1648791229001) every(1s) fill(NULL); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 +print $data60 $data61 $data62 $data63 $data64 +print $data70 $data71 $data72 $data73 $data74 + + +$loop_count = 0 +loop5: + +sleep 300 + +print sql select * from streamt order by 1; +sql select * from streamt order by 1; + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +if $rows != 16 then + print =====rows=$rows + goto loop5 +endi + +sql insert into t1 values(1648791215001,4,4,4,4.0) (1648791217001,5,5,5,5.1) (1648791222000,6,6,6,6.1) (1648791226000,7,7,7,7.1); + +print sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791213000, 1648791229001) every(1s) fill(NULL); +sql select _irowts, interp(a), interp(b), interp(c), interp(d) from t1 range(1648791213000, 1648791229001) every(1s) fill(NULL); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 +print $data60 $data61 $data62 $data63 $data64 +print $data70 $data71 $data72 $data73 $data74 + + +$loop_count = 0 +loop6: + +sleep 300 + +print sql select * from streamt order by 1; +sql select * from streamt order by 1; + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +if $rows != 16 then + goto loop6 +endi + +if $data01 != NULL then + print =====data01=$data01 + goto loop6 +endi + +if $data11 != NULL then + print =====data11=$data11 + goto loop6 +endi + +if $data21 != NULL then + print =====data21=$data21 + goto loop6 +endi + +if $data31 != NULL then + print =====data31=$data31 + goto loop6 +endi + +if $data41 != NULL then + print =====data41=$data41 + goto loop6 +endi + +if $data51 != NULL then + print =====data51=$data51 + goto loop6 +endi + +if $data61 != NULL then + print =====data61=$data61 + goto loop6 +endi + +if $data71 != NULL then + print =====data71=$data71 + goto loop6 +endi + +if $data81 != 6 then + print =====data81=$data81 + goto loop6 +endi + +if $data91 != NULL then + print =====data91=$data91 + goto loop6 +endi + +if $data[10][1] != NULL then + print =====data[10][1]=$data[10][1] + goto loop6 +endi + +if $data[11][1] != NULL then + print =====data[11][1]=$data[11][1] + goto loop6 +endi + +if $data[12][1] != 7 then + print =====data[12][1]=$data[12][1] + goto loop6 +endi + +if $data[13][1] != NULL then + print =====data[13][1]=$data[13][1] + goto loop6 +endi + +if $data[14][1] != NULL then + print =====data[14][1]=$data[14][1] + goto loop6 +endi + +if $data[15][1] != NULL then + print =====data[15][1]=$data[15][1] + goto loop6 +endi + + +print step4 + +sql create database test4 vgroups 1; +sql use test4; + +sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int); +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); + +sql create stream streams4 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt4 as select _irowts, interp(a) as b, _isfilled as a from st partition by tbname, b as cc every(1s) fill(NULL); + +run tsim/stream/checkTaskStatus.sim + +sql insert into t1 values(1648791217000,20000,2,3); + +sleep 2000 + +sql insert into t1 values(1648791212000,10000,2,3) (1648791215001,20,2,3); + +$loop_count = 0 +loop7: + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +sleep 300 + +print sql select a,b from streamt4; +sql select a,b from streamt4; + +if $rows != 6 then + print ======rows=$rows + goto loop7 +endi + +if $data00 != 0 then + print ======data00=$data00 + goto loop7 +endi + +if $data01 != 10000 then + print ======data01=$data01 + goto loop7 +endi + +if $data10 != 1 then + print ======data10=$data10 + goto loop7 +endi + +if $data20 != 1 then + print ======data20=$data20 + goto loop7 +endi + +if $data41 != NULL then + print ======data41=$data41 + goto loop7 +endi + +if $data50 != 0 then + print ======data50=$data50 + goto loop7 +endi + +if $data51 != 20000 then + print ======data51=$data51 + goto loop7 +endi + +print end + +system sh/exec.sh -n dnode1 -s stop -x SIGINT From 9368244f43f4eb3bf6aca06c68f00fc40853e53f Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Wed, 4 Sep 2024 15:34:14 +0800 Subject: [PATCH 051/695] fix issue for fill history --- source/libs/stream/src/streamSliceState.c | 10 +- source/libs/stream/src/tstreamFileState.c | 1 + .../tsim/stream/streamInterpHistory.sim | 163 ++++++++++++++++++ 3 files changed, 172 insertions(+), 2 deletions(-) diff --git a/source/libs/stream/src/streamSliceState.c b/source/libs/stream/src/streamSliceState.c index c4d550e6f4a7..6f4eea06ee18 100644 --- a/source/libs/stream/src/streamSliceState.c +++ b/source/libs/stream/src/streamSliceState.c @@ -70,9 +70,9 @@ int32_t getHashSortRowBuff(SStreamFileState* pFileState, const SWinKey* pKey, vo } int32_t size = taosArrayGetSize(pWinStates); - if (!isFlushedState(pFileState, pKey->ts, 0)) { + int32_t index = binarySearch(pWinStates, size, pKey, fillStateKeyCompare); + if (!isFlushedState(pFileState, pKey->ts, 0)|| index >= 0) { // find the first position which is smaller than the pKey - int32_t index = binarySearch(pWinStates, size, pKey, fillStateKeyCompare); if (index >= 0) { SWinKey* pTmpKey = taosArrayGet(pWinStates, index); if (winKeyCmprImpl(pTmpKey, pKey) == 0) { @@ -277,6 +277,12 @@ int32_t getHashSortPrevRow(SStreamFileState* pFileState, const SWinKey* pKey, SW return code; } else { SWinKey* pNext = taosArrayGet(pWinStates, index - 1); + if (qDebugFlag & DEBUG_DEBUG) { + SWinKey* pTmp = taosArrayGet(pWinStates, index); + if (winKeyCmprImpl(pTmp, pKey) != 0) { + qError("%s failed at line %d since do not find cur SWinKey", __func__, lino); + } + } *pResKey = *pNext; return getHashSortRowBuff(pFileState, pResKey, ppVal, pVLen, pWinCode); } diff --git a/source/libs/stream/src/tstreamFileState.c b/source/libs/stream/src/tstreamFileState.c index 60be901ac9d3..529ff78cae6f 100644 --- a/source/libs/stream/src/tstreamFileState.c +++ b/source/libs/stream/src/tstreamFileState.c @@ -1033,6 +1033,7 @@ int32_t getRowBuff(SStreamFileState* pFileState, void* pKey, int32_t keyLen, voi (*pos)->beUsed = true; (*pos)->beFlushed = false; (*pWinCode) = TSDB_CODE_SUCCESS; + goto _end; } TSKEY ts = pFileState->getTs(pKey); if (!isDeteled(pFileState, ts) && isFlushedState(pFileState, ts, 0)) { diff --git a/tests/script/tsim/stream/streamInterpHistory.sim b/tests/script/tsim/stream/streamInterpHistory.sim index beb81ec04b7a..b9685ebf05bf 100644 --- a/tests/script/tsim/stream/streamInterpHistory.sim +++ b/tests/script/tsim/stream/streamInterpHistory.sim @@ -489,4 +489,167 @@ if $rows != 8 then print ======rows=$rows goto loop3_1 endi + +print step3 + +print =============== create database +sql create database test3 vgroups 1; +sql use test3; + +sql create stable st(ts timestamp,a int,b int,c int, d double) tags(ta int,tb int,tc int); +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); + +sql insert into t1 values(1648791212000,1,1,1,1.0); +sql insert into t1 values(1648791215001,2,1,1,1.0); + +sql insert into t2 values(1648791212000,31,1,1,1.0); +sql insert into t2 values(1648791216001,41,1,1,1.0); + +sql create stream streams3 trigger at_once FILL_HISTORY 1 IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _irowts, _isfilled as a1, interp(a) as a2 from st partition by tbname every(1s) fill(prev); + +run tsim/stream/checkTaskStatus.sim + +sql insert into t1 values(1648791217000,5,1,1,1.0); +sql insert into t2 values(1648791217000,61,1,1,1.0); + +print sql select _irowts, _isfilled as a1, interp(a) as a2 from t1 partition by tbname range(1648791212000, 1648791217000) every(1s) fill(prev) order by 3, 1; +sql select _irowts, _isfilled as a1, interp(a) as a2 from t1 partition by tbname range(1648791212000, 1648791217000) every(1s) fill(prev) order by 3, 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 + + +$loop_count = 0 + +loop4: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 0 sql select * from streamt where a2 <= 10 order by 1; +sql select * from streamt where a2 < 10 order by 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 + +# row 0 +if $rows != 6 then + print ======rows=$rows + goto loop4 +endi + +# row 0 +if $data02 != 1 then + print ======data02=$data02 + goto loop4 +endi + +if $data12 != 1 then + print ======data12=$data12 + goto loop4 +endi + +if $data22 != 1 then + print ======data22=$data22 + goto loop4 +endi + +if $data32 != 1 then + print ======data32=$data32 + goto loop4 +endi + +if $data42 != 2 then + print ======data42=$data42 + goto loop4 +endi + +if $data52 != 5 then + print ======data52=$data52 + goto loop4 +endi + + +print sql select _irowts, _isfilled as a1, interp(a) as a2 from t2 partition by tbname range(1648791212000, 1648791217000) every(1s) fill(prev) order by 3, 1; +sql select _irowts, _isfilled as a1, interp(a) as a2 from t2 partition by tbname range(1648791212000, 1648791217000) every(1s) fill(prev) order by 3, 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 + +$loop_count = 0 + +loop5: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 0 sql select * from streamt where a2 > 10 order by 1; +sql select * from streamt where a2 > 10 order by 1; + +print $data00 $data01 $data02 $data03 $data04 $data05 +print $data10 $data11 $data12 $data13 $data14 $data15 +print $data20 $data21 $data22 $data23 $data24 $data25 +print $data30 $data31 $data32 $data33 $data34 $data35 +print $data40 $data41 $data42 $data43 $data44 $data45 +print $data50 $data51 $data52 $data53 $data54 $data55 + +# row 0 +if $rows != 6 then + print ======rows=$rows + goto loop5 +endi + +if $data02 != 31 then + print ======data02=$data02 + goto loop5 +endi + +if $data12 != 31 then + print ======data12=$data12 + goto loop5 +endi + +if $data22 != 31 then + print ======data22=$data22 + goto loop5 +endi + +if $data32 != 31 then + print ======data32=$data32 + goto loop5 +endi + +if $data42 != 31 then + print ======data42=$data42 + goto loop5 +endi + +if $data52 != 61 then + print ======data52=$data52 + goto loop5 +endi + +print end + system sh/exec.sh -n dnode1 -s stop -x SIGINT From 9c4d34ede15d5b1051a0faa12dd5c5fbf476645a Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Thu, 5 Sep 2024 09:27:36 +0800 Subject: [PATCH 052/695] fix file state issue --- source/libs/stream/src/tstreamFileState.c | 45 +++++++++++++++-------- 1 file changed, 30 insertions(+), 15 deletions(-) diff --git a/source/libs/stream/src/tstreamFileState.c b/source/libs/stream/src/tstreamFileState.c index 529ff78cae6f..1fe7bd46eb3f 100644 --- a/source/libs/stream/src/tstreamFileState.c +++ b/source/libs/stream/src/tstreamFileState.c @@ -655,18 +655,9 @@ static int32_t recoverSessionRowBuff(SStreamFileState* pFileState, SRowBuffPos* return code; } -int32_t getRowBuffByPos(SStreamFileState* pFileState, SRowBuffPos* pPos, void** pVal) { +static int32_t recoverStateRowBuff(SStreamFileState* pFileState, SRowBuffPos* pPos) { int32_t code = TSDB_CODE_SUCCESS; int32_t lino = 0; - if (pPos->pRowBuff) { - if (pPos->needFree) { - code = recoverSessionRowBuff(pFileState, pPos); - QUERY_CHECK_CODE(code, lino, _end); - } - (*pVal) = pPos->pRowBuff; - goto _end; - } - pPos->pRowBuff = getFreeBuff(pFileState); if (!pPos->pRowBuff) { if (pFileState->curRowCount < pFileState->maxRowCount) { @@ -687,6 +678,27 @@ int32_t getRowBuffByPos(SStreamFileState* pFileState, SRowBuffPos* pPos, void** code = recoverSessionRowBuff(pFileState, pPos); QUERY_CHECK_CODE(code, lino, _end); +_end: + if (code != TSDB_CODE_SUCCESS) { + qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } + return code; +} + +int32_t getRowBuffByPos(SStreamFileState* pFileState, SRowBuffPos* pPos, void** pVal) { + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; + if (pPos->pRowBuff) { + if (pPos->needFree) { + code = recoverSessionRowBuff(pFileState, pPos); + QUERY_CHECK_CODE(code, lino, _end); + } + (*pVal) = pPos->pRowBuff; + goto _end; + } + + recoverStateRowBuff(pFileState, pPos); + (*pVal) = pPos->pRowBuff; if (!pPos->needFree) { code = tdListPrepend(pFileState->usedBuffs, &pPos); @@ -1026,13 +1038,16 @@ int32_t getRowBuff(SStreamFileState* pFileState, void* pKey, int32_t keyLen, voi int32_t lino = 0; (*pWinCode) = TSDB_CODE_FAILED; pFileState->maxTs = TMAX(pFileState->maxTs, pFileState->getTs(pKey)); - SRowBuffPos** pos = tSimpleHashGet(pFileState->rowStateBuff, pKey, keyLen); - if (pos) { + SRowBuffPos** ppPos = tSimpleHashGet(pFileState->rowStateBuff, pKey, keyLen); + if (ppPos) { *pVLen = pFileState->rowSize; - *pVal = *pos; - (*pos)->beUsed = true; - (*pos)->beFlushed = false; + *pVal = *ppPos; + (*ppPos)->beUsed = true; + (*ppPos)->beFlushed = false; (*pWinCode) = TSDB_CODE_SUCCESS; + if ((*ppPos)->pRowBuff == NULL) { + recoverStateRowBuff(pFileState, *ppPos); + } goto _end; } TSKEY ts = pFileState->getTs(pKey); From 7eef4f971296aa40b1f9482b01e6399551f88d78 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Mon, 9 Sep 2024 16:58:29 +0800 Subject: [PATCH 053/695] add test --- .../script/tsim/stream/streamInterpScalar.sim | 417 ++++++++++++++++++ 1 file changed, 417 insertions(+) create mode 100644 tests/script/tsim/stream/streamInterpScalar.sim diff --git a/tests/script/tsim/stream/streamInterpScalar.sim b/tests/script/tsim/stream/streamInterpScalar.sim new file mode 100644 index 000000000000..e4e280138b44 --- /dev/null +++ b/tests/script/tsim/stream/streamInterpScalar.sim @@ -0,0 +1,417 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sleep 50 +sql connect + +print step1 +print =============== create database +sql create database test vgroups 1; +sql use test; + +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _irowts, now, floor(interp(d)), interp(floor(d)), a from t1 partition by tbname, a every(1s) fill(prev); + +run tsim/stream/checkTaskStatus.sim + + +sql insert into t1 values(1648791217001,1,1,1,1.1); + +sleep 2000 + +sql insert into t1 values(1648791212009,1,3,3,3.3) (1648791214001,1,4,4,4.4) (1648791219001,1,5,5,5.5) (1648791220001,1,6,6,6.6); + +print sql select _irowts, now, floor(interp(d)), interp(floor(d)), a from t1 partition by tbname, a range(1648791213000, 1648791220001) every(1s) fill(prev); +sql select _irowts, now, floor(interp(d)), interp(floor(d)), a from t1 partition by tbname, a range(1648791213000, 1648791220001) every(1s) fill(prev); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +$loop_count = 0 +loop0: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 2 sql select * from streamt order by 1; +sql select * from streamt order by 1; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +# row 0 +if $rows != 8 then + print ======rows=$rows + goto loop0 +endi + +# row 0 +if $data02 != 3.000000000 then + print ======data02=$data02 + goto loop0 +endi + +if $data03 != 3.000000000 then + print ======data03=$data03 + goto loop0 +endi + +if $data12 != 3.000000000 then + print ======data12=$data12 + goto loop0 +endi + +if $data13 != 3.000000000 then + print ======data13=$data13 + goto loop0 +endi + +if $data22 != 4.000000000 then + print ======data22=$data22 + goto loop0 +endi + +if $data23 != 4.000000000 then + print ======data23=$data23 + goto loop0 +endi + +if $data32 != 4.000000000 then + print ======data32=$data32 + goto loop0 +endi + +if $data33 != 4.000000000 then + print ======data33=$data33 + goto loop0 +endi + +if $data42 != 4.000000000 then + print ======data42=$data42 + goto loop0 +endi + +if $data43 != 4.000000000 then + print ======data43=$data43 + goto loop0 +endi + +if $data52 != 1.000000000 then + print ======data52=$data52 + goto loop0 +endi + +if $data53 != 1.000000000 then + print ======data53=$data53 + goto loop0 +endi + +if $data62 != 1.000000000 then + print ======data62=$data62 + goto loop0 +endi + +if $data63 != 1.000000000 then + print ======data63=$data63 + goto loop0 +endi + +if $data72 != 5.000000000 then + print ======data72=$data72 + goto loop0 +endi + +if $data73 != 5.000000000 then + print ======data73=$data73 + goto loop0 +endi + +print step2 +print =============== create database +sql create database test2 vgroups 1; +sql use test2; + +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _irowts, now, floor(interp(d)), interp(floor(d)), a from t1 partition by tbname, a every(1s) fill(next); + +run tsim/stream/checkTaskStatus.sim + + +sql insert into t1 values(1648791217001,1,1,1,1.1); + +sleep 2000 + +sql insert into t1 values(1648791212009,1,3,3,3.3) (1648791214001,1,4,4,4.4) (1648791219001,1,5,5,5.5) (1648791220001,1,6,6,6.6); + +print sql select _irowts, now, floor(interp(d)), interp(floor(d)), a from t1 partition by tbname, a range(1648791213000, 1648791220001) every(1s) fill(next); +sql select _irowts, now, floor(interp(d)), interp(floor(d)), a from t1 partition by tbname, a range(1648791213000, 1648791220001) every(1s) fill(next); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +$loop_count = 0 +loop1: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 2 sql select * from streamt order by 1; +sql select * from streamt order by 1; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +# row 0 +if $rows != 8 then + print ======rows=$rows + goto loop1 +endi + +# row 0 +if $data02 != 4.000000000 then + print ======data02=$data02 + goto loop1 +endi + +if $data03 != 4.000000000 then + print ======data03=$data03 + goto loop1 +endi + +if $data12 != 4.000000000 then + print ======data12=$data12 + goto loop1 +endi + +if $data13 != 4.000000000 then + print ======data13=$data13 + goto loop1 +endi + +if $data22 != 1.000000000 then + print ======data22=$data22 + goto loop1 +endi + +if $data23 != 1.000000000 then + print ======data23=$data23 + goto loop1 +endi + +if $data32 != 1.000000000 then + print ======data32=$data32 + goto loop1 +endi + +if $data33 != 1.000000000 then + print ======data33=$data33 + goto loop1 +endi + +if $data42 != 1.000000000 then + print ======data42=$data42 + goto loop1 +endi + +if $data43 != 1.000000000 then + print ======data43=$data43 + goto loop1 +endi + +if $data52 != 5.000000000 then + print ======data52=$data52 + goto loop1 +endi + +if $data53 != 5.000000000 then + print ======data53=$data53 + goto loop1 +endi + +if $data62 != 5.000000000 then + print ======data62=$data62 + goto loop1 +endi + +if $data63 != 5.000000000 then + print ======data63=$data63 + goto loop1 +endi + +if $data72 != 6.000000000 then + print ======data72=$data72 + goto loop1 +endi + +if $data73 != 6.000000000 then + print ======data73=$data73 + goto loop1 +endi + +print step3 +print =============== create database +sql create database test3 vgroups 1; +sql use test3; + +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stream streams3 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _irowts, now, floor(interp(d)), interp(floor(d)), a from t1 partition by tbname, a every(1s) fill(value, 100, 200); + +run tsim/stream/checkTaskStatus.sim + + +sql insert into t1 values(1648791217001,1,1,1,1.1); + +sleep 2000 + +sql insert into t1 values(1648791212009,1,3,3,3.3) (1648791214001,1,4,4,4.4) (1648791219001,1,5,5,5.5) (1648791220001,1,6,6,6.6); + +print sql select _irowts, now, floor(interp(d)), interp(floor(d)), a from t1 partition by tbname, a range(1648791213000, 1648791220001) every(1s) fill(value, 100, 200); +sql select _irowts, now, floor(interp(d)), interp(floor(d)), a from t1 partition by tbname, a range(1648791213000, 1648791220001) every(1s) fill(value, 100, 200); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +$loop_count = 0 +loop2: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 2 sql select * from streamt order by 1; +sql select * from streamt order by 1; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +# row 0 +if $rows != 8 then + print ======rows=$rows + goto loop2 +endi + +# row 0 +if $data02 != 100.000000000 then + print ======data02=$data02 + goto loop2 +endi + +if $data03 != 200.000000000 then + print ======data03=$data03 + goto loop2 +endi + +if $data12 != 100.000000000 then + print ======data12=$data12 + goto loop2 +endi + +if $data13 != 200.000000000 then + print ======data13=$data13 + goto loop2 +endi + +if $data22 != 100.000000000 then + print ======data22=$data22 + goto loop2 +endi + +if $data23 != 200.000000000 then + print ======data23=$data23 + goto loop2 +endi + +if $data32 != 100.000000000 then + print ======data32=$data32 + goto loop2 +endi + +if $data33 != 200.000000000 then + print ======data33=$data33 + goto loop2 +endi + +if $data42 != 100.000000000 then + print ======data42=$data42 + goto loop2 +endi + +if $data43 != 200.000000000 then + print ======data43=$data43 + goto loop2 +endi + +if $data52 != 100.000000000 then + print ======data52=$data52 + goto loop2 +endi + +if $data53 != 200.000000000 then + print ======data53=$data53 + goto loop2 +endi + +if $data62 != 100.000000000 then + print ======data62=$data62 + goto loop2 +endi + +if $data63 != 200.000000000 then + print ======data63=$data63 + goto loop2 +endi + +if $data72 != 100.000000000 then + print ======data72=$data72 + goto loop2 +endi + +if $data73 != 200.000000000 then + print ======data73=$data73 + goto loop2 +endi + +print end + +system sh/exec.sh -n dnode1 -s stop -x SIGINT From 75727e47b572c660a195e91a964dcbf72662c283 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Mon, 9 Sep 2024 17:58:40 +0800 Subject: [PATCH 054/695] remove assert --- source/libs/executor/src/executor.c | 3 --- .../executor/src/streamtimesliceoperator.c | 27 +++++++++++-------- source/libs/stream/src/tstreamFileState.c | 2 +- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/source/libs/executor/src/executor.c b/source/libs/executor/src/executor.c index cc2ddf4225b8..0191f68a850f 100644 --- a/source/libs/executor/src/executor.c +++ b/source/libs/executor/src/executor.c @@ -1156,9 +1156,6 @@ int32_t qSetStreamOperatorOptionForScanHistory(qTaskInfo_t tinfo) { SStreamTimeSliceOperatorInfo* pInfo = pOperator->info; STimeWindowAggSupp* pSup = &pInfo->twAggSup; - ASSERT(pSup->calTrigger == STREAM_TRIGGER_AT_ONCE || pSup->calTrigger == STREAM_TRIGGER_WINDOW_CLOSE); - ASSERT(pSup->calTriggerSaved == 0 && pSup->deleteMarkSaved == 0); - qInfo("save stream param for state: %d, %" PRId64, pSup->calTrigger, pSup->deleteMark); pSup->calTriggerSaved = pSup->calTrigger; diff --git a/source/libs/executor/src/streamtimesliceoperator.c b/source/libs/executor/src/streamtimesliceoperator.c index 87a0afa917da..ba7e4cfcd405 100644 --- a/source/libs/executor/src/streamtimesliceoperator.c +++ b/source/libs/executor/src/streamtimesliceoperator.c @@ -86,7 +86,7 @@ void streamTimeSliceReloadState(SOperatorInfo* pOperator) { int32_t num = (size - sizeof(TSKEY)) / sizeof(SWinKey); qDebug("===stream=== time slice operator reload state. get result count:%d", num); SWinKey* pKeyBuf = (SWinKey*)pBuf; - ASSERT(size == num * sizeof(SWinKey) + sizeof(TSKEY)); + QUERY_CHECK_CONDITION(size == num * sizeof(SWinKey) + sizeof(TSKEY), code, lino, _end, TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR); TSKEY ts = *(TSKEY*)((char*)pBuf + size - sizeof(TSKEY)); pInfo->twAggSup.maxTs = TMAX(pInfo->twAggSup.maxTs, ts); @@ -665,7 +665,7 @@ static int32_t getLinearResultInfoFromState(SStreamAggSupporter* pAggSup, SStrea (void**)&pPrevPoint->pResPos, &preVLen, &tmpRes); QUERY_CHECK_CODE(code, lino, _end); if (tmpRes == TSDB_CODE_SUCCESS) { - ASSERT(!IS_INVALID_WIN_KEY(pPrevPoint->key.ts)); + QUERY_CHECK_CONDITION(!IS_INVALID_WIN_KEY(pPrevPoint->key.ts), code, lino, _end, TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR); setPointBuff(pPrevPoint, pFillSup); if (HAS_ROW_DATA(pPrevPoint->pRightRow)) { pFillSup->prev.key = pPrevPoint->pRightRow->key; @@ -693,7 +693,7 @@ static int32_t getLinearResultInfoFromState(SStreamAggSupporter* pAggSup, SStrea (void**)&pNextPoint->pResPos, &nextVLen, &tmpRes); QUERY_CHECK_CODE(code, lino, _end); if (tmpRes == TSDB_CODE_SUCCESS) { - ASSERT(!IS_INVALID_WIN_KEY(pNextPoint->key.ts)); + QUERY_CHECK_CONDITION(!IS_INVALID_WIN_KEY(pNextPoint->key.ts), code, lino, _end, TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR); setPointBuff(pNextPoint, pFillSup); if (HAS_ROW_DATA(pNextPoint->pLeftRow)) { pFillSup->next.key = pNextPoint->pLeftRow->key; @@ -750,7 +750,7 @@ static int32_t getResultInfoFromState(SStreamAggSupporter* pAggSup, SStreamFillS (void**)&pPrevPoint->pResPos, &preVLen, &tmpRes); QUERY_CHECK_CODE(code, lino, _end); if (tmpRes == TSDB_CODE_SUCCESS) { - ASSERT(!IS_INVALID_WIN_KEY(pPrevPoint->key.ts)); + QUERY_CHECK_CONDITION(!IS_INVALID_WIN_KEY(pPrevPoint->key.ts), code, lino, _end, TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR); setPointBuff(pPrevPoint, pFillSup); if (HAS_ROW_DATA(pPrevPoint->pRightRow)) { pFillSup->prev.key = pPrevPoint->pRightRow->key; @@ -768,7 +768,7 @@ static int32_t getResultInfoFromState(SStreamAggSupporter* pAggSup, SStreamFillS (void**)&pNextPoint->pResPos, &nextVLen, &tmpRes); QUERY_CHECK_CODE(code, lino, _end); if (tmpRes == TSDB_CODE_SUCCESS) { - ASSERT(!IS_INVALID_WIN_KEY(pNextPoint->key.ts)); + QUERY_CHECK_CONDITION(!IS_INVALID_WIN_KEY(pNextPoint->key.ts), code, lino, _end, TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR); setPointBuff(pNextPoint, pFillSup); if (HAS_ROW_DATA(pNextPoint->pLeftRow)) { pFillSup->next.key = pNextPoint->pLeftRow->key; @@ -977,7 +977,7 @@ static void setForceWindowCloseFillRule(SStreamFillSupporter* pFillSup, SStreamF pFillInfo->pResRow = &pFillSup->prev; } break; default: - ASSERT(0); + qError("%s failed at line %d since invalid fill type", __func__, __LINE__); break; } @@ -988,6 +988,8 @@ static void setForceWindowCloseFillRule(SStreamFillSupporter* pFillSup, SStreamF } static void setTimeSliceFillRule(SStreamFillSupporter* pFillSup, SStreamFillInfo* pFillInfo, TSKEY ts) { + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; if (!hasNextWindow(pFillSup) && !hasPrevWindow(pFillSup)) { pFillInfo->needFill = false; pFillInfo->pos = FILL_POS_START; @@ -1039,7 +1041,7 @@ static void setTimeSliceFillRule(SStreamFillSupporter* pFillSup, SStreamFillInfo pFillSup->prev.key = ts; pFillSup->prev.pRowVal = pFillSup->cur.pRowVal; } else { - ASSERT(hasPrevWindow(pFillSup)); + QUERY_CHECK_CONDITION(hasPrevWindow(pFillSup), code, lino, _end, TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR); setFillKeyInfo(prevWKey, endTs, &pFillSup->interval, pFillInfo); pFillInfo->pos = FILL_POS_END; } @@ -1087,7 +1089,7 @@ static void setTimeSliceFillRule(SStreamFillSupporter* pFillSup, SStreamFillInfo pFillInfo->pResRow = &pFillSup->prev; pFillInfo->pLinearInfo->hasNext = false; } else { - ASSERT(hasNextWindow(pFillSup)); + QUERY_CHECK_CONDITION(hasNextWindow(pFillSup), code, lino, _end, TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR); setFillKeyInfo(startTs, nextWKey, &pFillSup->interval, pFillInfo); pFillInfo->pos = FILL_POS_START; SET_WIN_KEY_INVALID(pFillInfo->pLinearInfo->nextEnd); @@ -1099,7 +1101,7 @@ static void setTimeSliceFillRule(SStreamFillSupporter* pFillSup, SStreamFillInfo } } break; default: - ASSERT(0); + qError("%s failed at line %d since invalid fill type", __func__, __LINE__); break; } @@ -1107,6 +1109,9 @@ static void setTimeSliceFillRule(SStreamFillSupporter* pFillSup, SStreamFillInfo if (ts != pFillSup->cur.key) { pFillInfo->pos = FILL_POS_INVALID; } + if (code != TSDB_CODE_SUCCESS) { + qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } } static bool needAdjustValue(SSlicePoint* pPoint, TSKEY ts, bool isLeft, int32_t fillType) { @@ -1145,7 +1150,7 @@ static bool needAdjustValue(SSlicePoint* pPoint, TSKEY ts, bool isLeft, int32_t } } break; default: - ASSERT(0); + qError("%s failed at line %d since invalid fill type", __func__, __LINE__); } return false; } @@ -1276,7 +1281,7 @@ static void doStreamTimeSliceImpl(SOperatorInfo* pOperator, SSDataBlock* pBlock) TSDB_ORDER_ASC); startPos += numOfWin; int32_t leftRowId = getQualifiedRowNumDesc(pExprSup, pBlock, tsCols, startPos - 1, pInfo->ignoreNull); - ASSERT(leftRowId >= 0); + QUERY_CHECK_CONDITION((leftRowId >= 0), code, lino, _end, TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR); left = needAdjustValue(&nextPoint, tsCols[leftRowId], true, pFillSup->type); if (left) { transBlockToResultRow(pBlock, leftRowId, tsCols[leftRowId], nextPoint.pLeftRow); diff --git a/source/libs/stream/src/tstreamFileState.c b/source/libs/stream/src/tstreamFileState.c index 1fe7bd46eb3f..aaa0f0242d8e 100644 --- a/source/libs/stream/src/tstreamFileState.c +++ b/source/libs/stream/src/tstreamFileState.c @@ -1016,7 +1016,7 @@ int32_t recoverFillSnapshot(SStreamFileState* pFileState, int64_t ckId) { taosMemoryFreeClear(pVal); break; } - ASSERT(vlen == pFileState->rowSize); + memcpy(pNewPos->pRowBuff, pVal, vlen); taosMemoryFreeClear(pVal); pNewPos->beFlushed = true; From dc0b2fb61472ee9cdb8fc7c1b50379de993152da Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Mon, 9 Sep 2024 18:00:55 +0800 Subject: [PATCH 055/695] remove assert --- source/libs/executor/src/streamtimesliceoperator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/executor/src/streamtimesliceoperator.c b/source/libs/executor/src/streamtimesliceoperator.c index ba7e4cfcd405..d6ae6849ade1 100644 --- a/source/libs/executor/src/streamtimesliceoperator.c +++ b/source/libs/executor/src/streamtimesliceoperator.c @@ -86,7 +86,7 @@ void streamTimeSliceReloadState(SOperatorInfo* pOperator) { int32_t num = (size - sizeof(TSKEY)) / sizeof(SWinKey); qDebug("===stream=== time slice operator reload state. get result count:%d", num); SWinKey* pKeyBuf = (SWinKey*)pBuf; - QUERY_CHECK_CONDITION(size == num * sizeof(SWinKey) + sizeof(TSKEY), code, lino, _end, TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR); + QUERY_CHECK_CONDITION((size == num * sizeof(SWinKey) + sizeof(TSKEY)), code, lino, _end, TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR); TSKEY ts = *(TSKEY*)((char*)pBuf + size - sizeof(TSKEY)); pInfo->twAggSup.maxTs = TMAX(pInfo->twAggSup.maxTs, ts); From d9bb710e96027b0fdbf957a7781f3f0838f95b51 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Fri, 13 Sep 2024 11:12:49 +0800 Subject: [PATCH 056/695] add test --- source/libs/parser/src/parTranslater.c | 5 +++++ tests/script/tsim/stream/streamInterpError.sim | 13 +++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 082124c9a6b4..b6a8fa318d54 100755 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -10546,6 +10546,11 @@ static int32_t checkStreamQuery(STranslateContext* pCxt, SCreateStreamStmt* pStm "Stream interp unsupported window close"); } + if (pStmt->pOptions->triggerType == STREAM_TRIGGER_MAX_DELAY) { + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY, + "Stream interp unsupported max delay"); + } + if ((SRealTableNode*)pSelect->pFromTable && ((SRealTableNode*)pSelect->pFromTable)->pMeta && TSDB_SUPER_TABLE == ((SRealTableNode*)pSelect->pFromTable)->pMeta->tableType && !hasTbnameFunction(pSelect->pPartitionByList)) { diff --git a/tests/script/tsim/stream/streamInterpError.sim b/tests/script/tsim/stream/streamInterpError.sim index 710d10c44183..e32f537c7b00 100644 --- a/tests/script/tsim/stream/streamInterpError.sim +++ b/tests/script/tsim/stream/streamInterpError.sim @@ -61,6 +61,8 @@ sql_error create stream streams2_5_3 trigger window_close IGNORE EXPIRED 0 IGNOR sql_error create stream streams2_5_4 trigger window_close IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_5_4 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(NULL); sql_error create stream streams2_5_5 trigger window_close IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_5_5 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(value,11,22,33,44); +run tsim/stream/checkTaskStatus.sim + print step2_6 sql create stream streams2_6_1 trigger at_once FILL_HISTORY 1 IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_6_1 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(prev); @@ -75,7 +77,7 @@ sql_error create stream streams2_6_8 trigger force_window_close FILL_HISTORY 1 I sql_error create stream streams2_6_9 trigger force_window_close FILL_HISTORY 1 IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_6_9 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(NULL); sql_error create stream streams2_6_10 trigger force_window_close FILL_HISTORY 1 IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_6_10 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(value,11,22,33,44); - +run tsim/stream/checkTaskStatus.sim print step3 @@ -103,6 +105,13 @@ sql create stream streams3_0_5 trigger force_window_close FILL_HISTORY 0 IGNORE run tsim/stream/checkTaskStatus.sim -run tsim/stream/checkTaskStatus.sim +print step4 + +sql_error create stream streams4_1 trigger max_delay 1s FILL_HISTORY 0 IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt4_1 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(prev); +sql_error create stream streams4_2 trigger max_delay 1s FILL_HISTORY 0 IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt4_2 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(next); +sql_error create stream streams4_3 trigger max_delay 1s FILL_HISTORY 0 IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt4_3 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(linear); +sql_error create stream streams4_4 trigger max_delay 1s FILL_HISTORY 0 IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt4_4 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(NULL); +sql_error create stream streams4_5 trigger max_delay 1s FILL_HISTORY 0 IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt4_5 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(value,11,22,33,44); + system sh/exec.sh -n dnode1 -s stop -x SIGINT From b8cd7393832641fb34e8f7f7b41a23f40d4b13d0 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Wed, 18 Sep 2024 11:08:47 +0800 Subject: [PATCH 057/695] add ci and fix issue --- source/libs/executor/inc/executorInt.h | 2 + source/libs/executor/inc/streamexecutorInt.h | 1 + source/libs/executor/src/groupoperator.c | 10 +- source/libs/executor/src/scanoperator.c | 2 + source/libs/executor/src/streamexecutorInt.c | 5 + .../executor/src/streamtimesliceoperator.c | 274 +++++++++-- source/libs/parser/src/parTranslater.c | 2 +- source/libs/stream/src/streamUpdate.c | 1 - tests/parallel_test/cases.task | 4 + .../tsim/stream/streamInterpPrimaryKey0.sim | 452 +++++++++++++++++ .../tsim/stream/streamInterpPrimaryKey1.sim | 458 ++++++++++++++++++ .../tsim/stream/streamInterpPrimaryKey2.sim | 452 +++++++++++++++++ .../tsim/stream/streamInterpPrimaryKey3.sim | 452 +++++++++++++++++ 13 files changed, 2068 insertions(+), 47 deletions(-) create mode 100644 tests/script/tsim/stream/streamInterpPrimaryKey0.sim create mode 100644 tests/script/tsim/stream/streamInterpPrimaryKey1.sim create mode 100644 tests/script/tsim/stream/streamInterpPrimaryKey2.sim create mode 100644 tests/script/tsim/stream/streamInterpPrimaryKey3.sim diff --git a/source/libs/executor/inc/executorInt.h b/source/libs/executor/inc/executorInt.h index e28a24e25c01..c77f5456f319 100644 --- a/source/libs/executor/inc/executorInt.h +++ b/source/libs/executor/inc/executorInt.h @@ -473,6 +473,8 @@ typedef struct SStreamFillSupporter { bool hasDelete; SStorageAPI* pAPI; STimeWindow winRange; + int32_t pkColBytes; + __compar_fn_t comparePkColFn; } SStreamFillSupporter; typedef struct SStreamScanInfo { diff --git a/source/libs/executor/inc/streamexecutorInt.h b/source/libs/executor/inc/streamexecutorInt.h index ed4e6d4549b2..bcfe5d5479fb 100644 --- a/source/libs/executor/inc/streamexecutorInt.h +++ b/source/libs/executor/inc/streamexecutorInt.h @@ -45,6 +45,7 @@ typedef struct SSlicePoint { void setStreamOperatorState(SSteamOpBasicInfo* pBasicInfo, EStreamType type); bool needSaveStreamOperatorInfo(SSteamOpBasicInfo* pBasicInfo); void saveStreamOperatorStateComplete(SSteamOpBasicInfo* pBasicInfo); +void initStreamBasicInfo(SSteamOpBasicInfo* pBasicInfo); int64_t getDeleteMarkFromOption(SStreamNodeOption* pOption); void removeDeleteResults(SSHashObj* pUpdatedMap, SArray* pDelWins); diff --git a/source/libs/executor/src/groupoperator.c b/source/libs/executor/src/groupoperator.c index e4ace6b83ac0..6c52dbaed05f 100644 --- a/source/libs/executor/src/groupoperator.c +++ b/source/libs/executor/src/groupoperator.c @@ -1555,7 +1555,7 @@ static void destroyStreamPartitionOperatorInfo(void* param) { } int32_t initParDownStream(SOperatorInfo* downstream, SPartitionBySupporter* pParSup, SExprSupp* pExpr, - SExprSupp* pTbnameExpr) { + SExprSupp* pTbnameExpr, SExprSupp* pResExprSupp, int32_t* pPkColIndex) { int32_t code = TSDB_CODE_SUCCESS; int32_t lino = 0; SStorageAPI* pAPI = &downstream->pTaskInfo->storageAPI; @@ -1568,6 +1568,11 @@ int32_t initParDownStream(SOperatorInfo* downstream, SPartitionBySupporter* pPar pScanInfo->partitionSup = *pParSup; pScanInfo->pPartScalarSup = pExpr; pScanInfo->pPartTbnameSup = pTbnameExpr; + for (int32_t j = 0; j < pResExprSupp->numOfExprs; j++) { + if (pScanInfo->primaryKeyIndex == pResExprSupp->pExprInfo[j].base.pParam[0].pCol->slotId) { + *pPkColIndex = j; + } + } if (!pScanInfo->pUpdateInfo) { code = pAPI->stateStore.updateInfoInit(60000, TSDB_TIME_PRECISION_MILLI, 0, pScanInfo->igCheckUpdate, pScanInfo->pkColType, pScanInfo->pkColLen, &pScanInfo->pUpdateInfo); @@ -1729,7 +1734,8 @@ int32_t createStreamPartitionOperatorInfo(SOperatorInfo* downstream, SStreamPart optrDefaultBufFn, NULL, optrDefaultGetNextExtFn, NULL); setOperatorStreamStateFn(pOperator, streamOpReleaseState, streamOpReloadState); - code = initParDownStream(downstream, &pInfo->partitionSup, &pInfo->scalarSup, &pInfo->tbnameCalSup); + pInfo->basic.primaryPkIndex = -1; + code = initParDownStream(downstream, &pInfo->partitionSup, &pInfo->scalarSup, &pInfo->tbnameCalSup, &pOperator->exprSupp, &pInfo->basic.primaryPkIndex); QUERY_CHECK_CODE(code, lino, _error); code = appendDownstream(pOperator, &downstream, 1); diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index ad1164d7e14f..32967c4a56f4 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -4275,6 +4275,7 @@ int32_t createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhysiNode* SDataType pkType = {0}; pInfo->primaryKeyIndex = -1; + pInfo->basic.primaryPkIndex = -1; int32_t numOfOutput = taosArrayGetSize(pInfo->matchInfo.pList); pColIds = taosArrayInit(numOfOutput, sizeof(int16_t)); QUERY_CHECK_NULL(pColIds, code, lino, _error, terrno); @@ -4292,6 +4293,7 @@ int32_t createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhysiNode* } if (id->isPk) { pInfo->primaryKeyIndex = id->dstSlotId; + pInfo->basic.primaryPkIndex = id->dstSlotId; pkType = id->dataType; } } diff --git a/source/libs/executor/src/streamexecutorInt.c b/source/libs/executor/src/streamexecutorInt.c index 875ae0035087..b94798934c52 100644 --- a/source/libs/executor/src/streamexecutorInt.c +++ b/source/libs/executor/src/streamexecutorInt.c @@ -28,3 +28,8 @@ bool needSaveStreamOperatorInfo(SSteamOpBasicInfo* pBasicInfo) { void saveStreamOperatorStateComplete(SSteamOpBasicInfo* pBasicInfo) { pBasicInfo->updateOperatorInfo = false; } + +void initStreamBasicInfo(SSteamOpBasicInfo* pBasicInfo) { + pBasicInfo->primaryPkIndex = -1; + pBasicInfo->updateOperatorInfo = false; +} diff --git a/source/libs/executor/src/streamtimesliceoperator.c b/source/libs/executor/src/streamtimesliceoperator.c index d6ae6849ade1..20687964d430 100644 --- a/source/libs/executor/src/streamtimesliceoperator.c +++ b/source/libs/executor/src/streamtimesliceoperator.c @@ -275,7 +275,7 @@ static int32_t initTimeSliceResultBuf(SStreamFillSupporter* pFillSup, SExprSupp* return TSDB_CODE_SUCCESS; } -static int32_t initTimeSliceFillSup(SStreamInterpFuncPhysiNode* pPhyFillNode, SExprSupp* pExprSup, int32_t numOfExprs, +static int32_t initTimeSliceFillSup(SStreamInterpFuncPhysiNode* pPhyFillNode, SExprSupp* pExprSup, int32_t numOfExprs, SColumnInfo* pPkCol, SStreamFillSupporter** ppResFillSup) { int32_t code = TSDB_CODE_SUCCESS; int32_t lino = 0; @@ -306,6 +306,14 @@ static int32_t initTimeSliceFillSup(SStreamInterpFuncPhysiNode* pPhyFillNode, SE QUERY_CHECK_CODE(code, lino, _end); pFillSup->hasDelete = false; + if (pPkCol != NULL) { + pFillSup->pkColBytes = pPkCol->bytes; + pFillSup->comparePkColFn = getKeyComparFunc(pPkCol->type, TSDB_ORDER_ASC); + } else { + pFillSup->pkColBytes = 0; + pFillSup->comparePkColFn = NULL; + } + (*ppResFillSup) = pFillSup; _end: @@ -629,7 +637,7 @@ void setPointBuff(SSlicePoint* pPoint, SStreamFillSupporter* pFillSup) { pPoint->pLeftRow = pPoint->pRightRow; } else { setResultRowData(&pPoint->pLeftRow, pPoint->pResPos->pRowBuff); - void* pBuff = POINTER_SHIFT(pPoint->pResPos->pRowBuff, pFillSup->rowSize); + void* pBuff = POINTER_SHIFT(pPoint->pResPos->pRowBuff, pFillSup->rowSize + pFillSup->pkColBytes); setResultRowData(&pPoint->pRightRow, pBuff); } } @@ -1114,7 +1122,13 @@ static void setTimeSliceFillRule(SStreamFillSupporter* pFillSup, SStreamFillInfo } } -static bool needAdjustValue(SSlicePoint* pPoint, TSKEY ts, bool isLeft, int32_t fillType) { +static int32_t comparePkVal(void* pLeft, void* pRight, SStreamFillSupporter* pFillSup) { + void* pTmpVal = POINTER_SHIFT(pLeft, pFillSup->rowSize); + return pFillSup->comparePkColFn(pTmpVal, pRight); +} + +static bool needAdjustValue(SSlicePoint* pPoint, TSKEY ts, void* pPkVal, SStreamFillSupporter* pFillSup, bool isLeft, + int32_t fillType) { if (IS_INVALID_WIN_KEY(pPoint->key.ts)) { return false; } @@ -1124,29 +1138,83 @@ static bool needAdjustValue(SSlicePoint* pPoint, TSKEY ts, bool isLeft, int32_t case TSDB_FILL_NULL_F: case TSDB_FILL_SET_VALUE: case TSDB_FILL_SET_VALUE_F: { - if (!isLeft && (HAS_NON_ROW_DATA(pPoint->pRightRow) || pPoint->key.ts == ts) ) { - return true; + if (!isLeft) { + if (HAS_NON_ROW_DATA(pPoint->pRightRow)) { + return true; + } else { + if (pPoint->key.ts == ts) { + if (pFillSup->comparePkColFn == NULL || + comparePkVal(pPoint->pRightRow, pPkVal, pFillSup) >= 0) { + return true; + } + } + } } } break; case TSDB_FILL_PREV: { - if (isLeft && (HAS_NON_ROW_DATA(pPoint->pLeftRow) || pPoint->pLeftRow->key <= ts)) { - return true; + if (isLeft) { + if (HAS_NON_ROW_DATA(pPoint->pLeftRow)) { + return true; + } else { + if (pPoint->pLeftRow->key < ts) { + return true; + } else if (pPoint->pLeftRow->key == ts) { + if (pFillSup->comparePkColFn == NULL || comparePkVal(pPoint->pLeftRow, pPkVal, pFillSup) >= 0) { + return true; + } + } + } } if (!isLeft && pPoint->key.ts == ts) { - return true; + if (HAS_NON_ROW_DATA(pPoint->pLeftRow) || pFillSup->comparePkColFn == NULL || + comparePkVal(pPoint->pLeftRow, pPkVal, pFillSup) >= 0) { + return true; + } } } break; case TSDB_FILL_NEXT: { - if (!isLeft && (HAS_NON_ROW_DATA(pPoint->pRightRow) || pPoint->pRightRow->key >= ts)) { - return true; + if (!isLeft) { + if (HAS_NON_ROW_DATA(pPoint->pRightRow)) { + return true; + } else { + if (pPoint->pRightRow->key > ts) { + return true; + } else if (pPoint->pRightRow->key == ts) { + if (pFillSup->comparePkColFn == NULL || + comparePkVal(pPoint->pRightRow, pPkVal, pFillSup) >= 0) { + return true; + } + } + } } } break; case TSDB_FILL_LINEAR: { - if (isLeft && (HAS_NON_ROW_DATA(pPoint->pLeftRow) || pPoint->pLeftRow->key <= ts)) { - return true; - } else if (!isLeft && (HAS_NON_ROW_DATA(pPoint->pRightRow) || pPoint->pRightRow->key >= ts)) { - return true; + if (isLeft) { + if (HAS_NON_ROW_DATA(pPoint->pLeftRow)) { + return true; + } else { + if (pPoint->pLeftRow->key < ts) { + return true; + } else if (pPoint->pLeftRow->key == ts) { + if (pFillSup->comparePkColFn == NULL || comparePkVal(pPoint->pLeftRow, pPkVal, pFillSup) >= 0) { + return true; + } + } + } + } else { + if (HAS_NON_ROW_DATA(pPoint->pRightRow)) { + return true; + } else { + if (pPoint->pRightRow->key > ts) { + return true; + } else if (pPoint->pRightRow->key == ts) { + if (pFillSup->comparePkColFn == NULL || + comparePkVal(pPoint->pRightRow, pPkVal, pFillSup) >= 0) { + return true; + } + } + } } } break; default: @@ -1155,7 +1223,8 @@ static bool needAdjustValue(SSlicePoint* pPoint, TSKEY ts, bool isLeft, int32_t return false; } -static void transBlockToResultRow(const SSDataBlock* pBlock, int32_t rowId, TSKEY ts, SSliceRowData* pRowVal) { +static void transBlockToResultRow(const SSDataBlock* pBlock, int32_t rowId, TSKEY ts, SSliceRowData* pRowVal, + int32_t rowSize, void* pPkData, SColumnInfoData* pPkCol) { int32_t numOfCols = taosArrayGetSize(pBlock->pDataBlock); for (int32_t i = 0; i < numOfCols; ++i) { SColumnInfoData* pColData = taosArrayGet(pBlock->pDataBlock, i); @@ -1175,6 +1244,14 @@ static void transBlockToResultRow(const SSDataBlock* pBlock, int32_t rowId, TSKE } } pRowVal->key = ts; + if (pPkData != NULL) { + void* pPkVal = POINTER_SHIFT(pRowVal, rowSize); + if (IS_VAR_DATA_TYPE(pPkCol->info.type)) { + memcpy(pPkVal, pPkData, varDataTLen(pPkData)); + } else { + memcpy(pPkVal, pPkData, pPkCol->info.bytes); + } + } } static int32_t saveTimeSliceWinResultInfo(SStreamAggSupporter* pAggSup, STimeWindowAggSupp* pTwAggSup, SWinKey* pKey, @@ -1266,9 +1343,12 @@ static void doStreamTimeSliceImpl(SOperatorInfo* pOperator, SSDataBlock* pBlock) } QUERY_CHECK_CODE(code, lino, _end); - right = needAdjustValue(&curPoint, tsCols[startPos], false, pFillSup->type); + if (hasSrcPrimaryKeyCol(&pInfo->basic)) { + pPkVal = colDataGetData(pPkColDataInfo, startPos); + } + right = needAdjustValue(&curPoint, tsCols[startPos], pPkVal, pFillSup, false, pFillSup->type); if (right) { - transBlockToResultRow(pBlock, startPos, tsCols[startPos], curPoint.pRightRow); + transBlockToResultRow(pBlock, startPos, tsCols[startPos], curPoint.pRightRow, pFillSup->rowSize, pPkVal, pPkColDataInfo); bool needDel = pInfo->destHasPrimaryKey && winCode == TSDB_CODE_SUCCESS; code = saveTimeSliceWinResultInfo(pAggSup, &pInfo->twAggSup, &curPoint.key, pInfo->pUpdatedMap, needDel, pInfo->pDeletedMap); @@ -1282,9 +1362,12 @@ static void doStreamTimeSliceImpl(SOperatorInfo* pOperator, SSDataBlock* pBlock) startPos += numOfWin; int32_t leftRowId = getQualifiedRowNumDesc(pExprSup, pBlock, tsCols, startPos - 1, pInfo->ignoreNull); QUERY_CHECK_CONDITION((leftRowId >= 0), code, lino, _end, TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR); - left = needAdjustValue(&nextPoint, tsCols[leftRowId], true, pFillSup->type); + if (hasSrcPrimaryKeyCol(&pInfo->basic)) { + pPkVal = colDataGetData(pPkColDataInfo, leftRowId); + } + left = needAdjustValue(&nextPoint, tsCols[leftRowId], pPkVal, pFillSup, true, pFillSup->type); if (left) { - transBlockToResultRow(pBlock, leftRowId, tsCols[leftRowId], nextPoint.pLeftRow); + transBlockToResultRow(pBlock, leftRowId, tsCols[leftRowId], nextPoint.pLeftRow, pFillSup->rowSize, pPkVal, pPkColDataInfo); bool needDel = pInfo->destHasPrimaryKey && winCode == TSDB_CODE_SUCCESS; code = saveTimeSliceWinResultInfo(pAggSup, &pInfo->twAggSup, &nextPoint.key, pInfo->pUpdatedMap, needDel, pInfo->pDeletedMap); @@ -1304,9 +1387,12 @@ static void doStreamTimeSliceImpl(SOperatorInfo* pOperator, SSDataBlock* pBlock) } QUERY_CHECK_CODE(code, lino, _end); - right = needAdjustValue(&curPoint, tsCols[startPos], false, pFillSup->type); + if (hasSrcPrimaryKeyCol(&pInfo->basic)) { + pPkVal = colDataGetData(pPkColDataInfo, startPos); + } + right = needAdjustValue(&curPoint, tsCols[startPos], pPkVal, pFillSup, false, pFillSup->type); if (right) { - transBlockToResultRow(pBlock, startPos, tsCols[startPos], curPoint.pRightRow); + transBlockToResultRow(pBlock, startPos, tsCols[startPos], curPoint.pRightRow, pFillSup->rowSize, pPkVal, pPkColDataInfo); bool needDel = pInfo->destHasPrimaryKey && winCode == TSDB_CODE_SUCCESS; code = saveTimeSliceWinResultInfo(pAggSup, &pInfo->twAggSup, &curPoint.key, pInfo->pUpdatedMap, needDel, pInfo->pDeletedMap); @@ -1408,6 +1494,90 @@ void doBuildTimeSlicePointResult(SStreamAggSupporter* pAggSup, STimeWindowAggSup } } +static void doBuildTimeSliceDeleteResult(SStreamAggSupporter* pAggSup, SStreamFillSupporter* pFillSup, SArray* pWins, int32_t* index, SSDataBlock* pBlock) { + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; + blockDataCleanup(pBlock); + int32_t size = taosArrayGetSize(pWins); + if (*index == size) { + *index = 0; + taosArrayClear(pWins); + goto _end; + } + code = blockDataEnsureCapacity(pBlock, size - *index); + QUERY_CHECK_CODE(code, lino, _end); + + uint64_t uid = 0; + for (int32_t i = *index; i < size; i++) { + SWinKey* pKey = taosArrayGet(pWins, i); + SSlicePoint curPoint = {.key.ts = pKey->ts, .key.groupId = pKey->groupId}; + SSlicePoint prevPoint = {0}; + SSlicePoint nextPoint = {0}; + STimeWindow tw = {0}; + if (pFillSup->type != TSDB_FILL_LINEAR) { + code = getResultInfoFromState(pAggSup, pFillSup, pKey->ts, pKey->groupId, &curPoint, &prevPoint, &nextPoint); + } else { + code = + getLinearResultInfoFromState(pAggSup, pFillSup, pKey->ts, pKey->groupId, &curPoint, &prevPoint, &nextPoint); + } + QUERY_CHECK_CODE(code, lino, _end); + + if (pFillSup->type == TSDB_FILL_PREV && hasNextWindow(pFillSup)) { + tw.skey = pFillSup->cur.key; + tw.ekey = pFillSup->next.key; + } else if (pFillSup->type == TSDB_FILL_NEXT && hasPrevWindow(pFillSup)) { + tw.skey = pFillSup->prev.key; + tw.ekey = pFillSup->cur.key; + } else if (pFillSup->type == TSDB_FILL_LINEAR) { + if (hasPrevWindow(pFillSup)) { + tw.skey = pFillSup->prev.key; + } else { + tw.skey = pFillSup->cur.key; + } + if (hasNextWindow(pFillSup)) { + tw.ekey = pFillSup->next.key; + } else { + tw.ekey = pFillSup->cur.key; + } + } else { + tw.skey = pFillSup->cur.key; + tw.ekey = pFillSup->cur.key; + } + + if (tw.skey == INT64_MIN || tw.ekey == INT64_MIN) { + continue; + } + + releaseOutputBuf(pAggSup->pState, curPoint.pResPos, &pAggSup->stateStore); + releaseOutputBuf(pAggSup->pState, prevPoint.pResPos, &pAggSup->stateStore); + releaseOutputBuf(pAggSup->pState, nextPoint.pResPos, &pAggSup->stateStore); + + void* tbname = NULL; + int32_t winCode = TSDB_CODE_SUCCESS; + + code = pAggSup->stateStore.streamStateGetParName(pAggSup->pState, pKey->groupId, &tbname, false, &winCode); + QUERY_CHECK_CODE(code, lino, _end); + + if (winCode != TSDB_CODE_SUCCESS) { + code = appendDataToSpecialBlock(pBlock, &tw.skey, &tw.ekey, &uid, &pKey->groupId, NULL); + QUERY_CHECK_CODE(code, lino, _end); + } else { + QUERY_CHECK_CONDITION((tbname), code, lino, _end, TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR); + char parTbName[VARSTR_HEADER_SIZE + TSDB_TABLE_NAME_LEN]; + STR_WITH_MAXSIZE_TO_VARSTR(parTbName, tbname, sizeof(parTbName)); + code = appendDataToSpecialBlock(pBlock, &tw.skey, &tw.ekey, &uid, &pKey->groupId, parTbName); + QUERY_CHECK_CODE(code, lino, _end); + } + pAggSup->stateStore.streamStateFreeVal(tbname); + (*index)++; + } + +_end: + if (code != TSDB_CODE_SUCCESS) { + qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } +} + static int32_t buildTimeSliceResult(SOperatorInfo* pOperator, SSDataBlock** ppRes) { int32_t code = TSDB_CODE_SUCCESS; int32_t lino = 0; @@ -1416,6 +1586,15 @@ static int32_t buildTimeSliceResult(SOperatorInfo* pOperator, SSDataBlock** ppRe uint16_t opType = pOperator->operatorType; SStreamAggSupporter* pAggSup = &pInfo->streamAggSup; + + doBuildTimeSliceDeleteResult(pAggSup, pInfo->pFillSup, pInfo->pDelWins, &pInfo->delIndex, pInfo->pDelRes); + if (pInfo->pDelRes->info.rows != 0) { + // process the rest of the data + printDataBlock(pInfo->pDelRes, getStreamOpName(opType), GET_TASKID(pTaskInfo)); + (*ppRes) = pInfo->pDelRes; + goto _end; + } + doBuildTimeSlicePointResult(pAggSup, &pInfo->twAggSup, pInfo->pFillSup, pInfo->pFillInfo, pInfo->pRes, &pInfo->groupResInfo); if (pInfo->pRes->info.rows != 0) { printDataBlock(pInfo->pRes, getStreamOpName(opType), GET_TASKID(pTaskInfo)); @@ -1463,8 +1642,7 @@ int32_t getSliceMaxTsWins(const SArray* pAllWins, SArray* pMaxWins) { return code; } -static int32_t doDeleteTimeSliceResult(SStreamAggSupporter* pAggSup, SSDataBlock* pBlock, SSHashObj* pUpdatedMap, - SArray* pDelWins) { +static int32_t doDeleteTimeSliceResult(SStreamAggSupporter* pAggSup, SSDataBlock* pBlock, SSHashObj* pUpdatedMap) { int32_t code = TSDB_CODE_SUCCESS; int32_t lino = 0; int32_t winCode = TSDB_CODE_SUCCESS; @@ -1590,7 +1768,7 @@ static int32_t doStreamTimeSliceNext(SOperatorInfo* pOperator, SSDataBlock** ppR switch (pBlock->info.type) { case STREAM_DELETE_RESULT: case STREAM_DELETE_DATA: { - code = doDeleteTimeSliceResult(pAggSup, pBlock, pInfo->pUpdatedMap, pInfo->pDelWins); + code = doDeleteTimeSliceResult(pAggSup, pBlock, pInfo->pUpdatedMap); QUERY_CHECK_CODE(code, lino, _end); code = copyDataBlock(pInfo->pDelRes, pBlock); QUERY_CHECK_CODE(code, lino, _end); @@ -1678,12 +1856,6 @@ static int32_t doStreamTimeSliceNext(SOperatorInfo* pOperator, SSDataBlock** ppR return code; } -static SSDataBlock* doStreamTimeSlice(SOperatorInfo* pOperator) { - SSDataBlock* pRes = NULL; - (void)doStreamTimeSliceNext(pOperator, &pRes); - return pRes; -} - static void copyFillValueInfo(SStreamFillSupporter* pFillSup, SStreamFillInfo* pFillInfo) { if (pFillInfo->type == TSDB_FILL_SET_VALUE || pFillInfo->type == TSDB_FILL_SET_VALUE_F) { int32_t valueIndex = 0; @@ -1723,14 +1895,22 @@ static void copyFillValueInfo(SStreamFillSupporter* pFillSup, SStreamFillInfo* p } } -int32_t getDownstreamRes(SOperatorInfo* downstream, SSDataBlock** ppRes) { +int32_t getDownstreamRes(SOperatorInfo* downstream, SSDataBlock** ppRes, SColumnInfo** ppPkCol) { if (downstream->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN) { SStreamScanInfo* pInfo = (SStreamScanInfo*)downstream->info; *ppRes = pInfo->pRes; + if (hasSrcPrimaryKeyCol(&pInfo->basic)) { + SColumnInfoData* pPkColInfo = taosArrayGet(pInfo->pRes->pDataBlock, pInfo->basic.primaryPkIndex); + (*ppPkCol) = &pPkColInfo->info; + } return TSDB_CODE_SUCCESS; } else if (downstream->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_PARTITION) { SStreamPartitionOperatorInfo* pInfo = (SStreamPartitionOperatorInfo*)downstream->info; *ppRes = pInfo->binfo.pRes; + if (hasSrcPrimaryKeyCol(&pInfo->basic)) { + SColumnInfoData* pPkColInfo = taosArrayGet(pInfo->binfo.pRes->pDataBlock, pInfo->basic.primaryPkIndex); + (*ppPkCol) = &pPkColInfo->info; + } return TSDB_CODE_SUCCESS; } qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(TSDB_CODE_FAILED)); @@ -1744,8 +1924,9 @@ int32_t initTimeSliceDownStream(SOperatorInfo* downstream, SStreamAggSupporter* int32_t code = TSDB_CODE_SUCCESS; int32_t lino = 0; if (downstream->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_PARTITION) { - SStreamPartitionOperatorInfo* pScanInfo = downstream->info; - pScanInfo->tsColIndex = tsColIndex; + SStreamPartitionOperatorInfo* pPartionInfo = downstream->info; + pPartionInfo->tsColIndex = tsColIndex; + pBasic->primaryPkIndex = pPartionInfo->basic.primaryPkIndex; } if (downstream->operatorType != QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN) { @@ -1766,7 +1947,9 @@ int32_t initTimeSliceDownStream(SOperatorInfo* downstream, SStreamAggSupporter* pScanInfo->pFillSup = pFillSup; pScanInfo->interval = pFillSup->interval; pAggSup->pUpdateInfo = pScanInfo->pUpdateInfo; - pBasic->primaryPkIndex = pScanInfo->primaryKeyIndex; + if (!hasSrcPrimaryKeyCol(pBasic)) { + pBasic->primaryPkIndex = pScanInfo->basic.primaryPkIndex; + } _end: if (code != TSDB_CODE_SUCCESS) { @@ -1820,8 +2003,13 @@ int32_t createStreamTimeSliceOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pInfo->primaryTsIndex = ((SColumnNode*)pInterpPhyNode->pTimeSeries)->slotId; + SSDataBlock* pDownRes = NULL; + SColumnInfo* pPkCol = NULL; + code = getDownstreamRes(downstream, &pDownRes, &pPkCol); + QUERY_CHECK_CODE(code, lino, _error); + pInfo->pFillSup = NULL; - code = initTimeSliceFillSup(pInterpPhyNode, pExpSup, numOfExprs, &pInfo->pFillSup); + code = initTimeSliceFillSup(pInterpPhyNode, pExpSup, numOfExprs, pPkCol, &pInfo->pFillSup); QUERY_CHECK_CODE(code, lino, _error); int32_t ratio = 1; @@ -1829,10 +2017,13 @@ int32_t createStreamTimeSliceOperatorInfo(SOperatorInfo* downstream, SPhysiNode* ratio = 2; } - code = - initStreamAggSupporter(&pInfo->streamAggSup, pExpSup, numOfExprs, 0, pTaskInfo->streamInfo.pState, sizeof(TSKEY), - 0, &pTaskInfo->storageAPI.stateStore, pHandle, &pInfo->twAggSup, GET_TASKID(pTaskInfo), - &pTaskInfo->storageAPI, pInfo->primaryTsIndex, STREAM_STATE_BUFF_HASH_SORT, ratio); + int32_t keyBytes = sizeof(TSKEY); + if (pPkCol) { + keyBytes += pPkCol->bytes; + } + code = initStreamAggSupporter(&pInfo->streamAggSup, pExpSup, numOfExprs, 0, pTaskInfo->streamInfo.pState, keyBytes, 0, + &pTaskInfo->storageAPI.stateStore, pHandle, &pInfo->twAggSup, GET_TASKID(pTaskInfo), + &pTaskInfo->storageAPI, pInfo->primaryTsIndex, STREAM_STATE_BUFF_HASH_SORT, ratio); QUERY_CHECK_CODE(code, lino, _error); code = initExecTimeWindowInfo(&pInfo->twAggSup.timeWindowData, &pTaskInfo->window); @@ -1866,10 +2057,6 @@ int32_t createStreamTimeSliceOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pInfo->destHasPrimaryKey = pInterpPhyNode->streamNodeOption.destHasPrimaryKey; pInfo->numOfDatapack = 0; - SSDataBlock* pDownRes = NULL; - code = getDownstreamRes(downstream, &pDownRes); - QUERY_CHECK_CODE(code, lino, _error); - pInfo->pFillInfo = initStreamFillInfo(pInfo->pFillSup, pDownRes); copyFillValueInfo(pInfo->pFillSup, pInfo->pFillInfo); pInfo->ignoreNull = getIgoreNullRes(pExpSup); @@ -1899,6 +2086,7 @@ int32_t createStreamTimeSliceOperatorInfo(SOperatorInfo* downstream, SPhysiNode* optrDefaultBufFn, NULL, optrDefaultGetNextExtFn, NULL); setOperatorStreamStateFn(pOperator, streamTimeSliceReleaseState, streamTimeSliceReloadState); + initStreamBasicInfo(&pInfo->basic); if (downstream) { code = initTimeSliceDownStream(downstream, &pInfo->streamAggSup, pOperator->operatorType, pInfo->primaryTsIndex, &pInfo->twAggSup, &pInfo->basic, pInfo->pFillSup); diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 5200de0ab76e..97e10d0d2f8c 100755 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -11108,7 +11108,7 @@ static int32_t checkAndAdjStreamDestTableSchema(STranslateContext* pCxt, SCreate .bytes = tDataTypes[TSDB_DATA_TYPE_TIMESTAMP].bytes}; } int32_t code = checkTableSchemaImpl(pCxt, pStmt->pTags, pStmt->pCols, NULL); - if (TSDB_CODE_SUCCESS == code && NULL == pSelect->pWindow && + if (TSDB_CODE_SUCCESS == code && NULL == pSelect->pWindow && !pSelect->hasInterpFunc && ((SRealTableNode*)pSelect->pFromTable && hasPkInTable(((SRealTableNode*)pSelect->pFromTable)->pMeta))) { if (1 >= LIST_LENGTH(pStmt->pCols) || 1 >= LIST_LENGTH(pSelect->pProjectionList)) { return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY); diff --git a/source/libs/stream/src/streamUpdate.c b/source/libs/stream/src/streamUpdate.c index 9a1a30ac7bc2..e1472aa9dded 100644 --- a/source/libs/stream/src/streamUpdate.c +++ b/source/libs/stream/src/streamUpdate.c @@ -214,7 +214,6 @@ int32_t updateInfoInit(int64_t interval, int32_t precision, int64_t watermark, b if (pkLen != 0) { pInfo->comparePkRowFn = compareKeyTsAndPk; pInfo->comparePkCol = getKeyComparFunc(pkType, TSDB_ORDER_ASC); - ; } else { pInfo->comparePkRowFn = compareKeyTs; pInfo->comparePkCol = NULL; diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index c432f6762347..ed7a09f64840 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -1369,6 +1369,10 @@ ,,y,script,./test.sh -f tsim/stream/streamInterpPartitionBy0.sim ,,y,script,./test.sh -f tsim/stream/streamInterpPrev0.sim ,,y,script,./test.sh -f tsim/stream/streamInterpPrev1.sim +,,y,script,./test.sh -f tsim/stream/streamInterpPrimaryKey0.sim +,,y,script,./test.sh -f tsim/stream/streamInterpPrimaryKey1.sim +,,y,script,./test.sh -f tsim/stream/streamInterpPrimaryKey2.sim +,,y,script,./test.sh -f tsim/stream/streamInterpPrimaryKey3.sim ,,y,script,./test.sh -f tsim/stream/streamInterpUpdate.sim ,,y,script,./test.sh -f tsim/stream/streamInterpUpdate1.sim ,,y,script,./test.sh -f tsim/stream/streamInterpValue0.sim diff --git a/tests/script/tsim/stream/streamInterpPrimaryKey0.sim b/tests/script/tsim/stream/streamInterpPrimaryKey0.sim new file mode 100644 index 000000000000..9edddff6dbf8 --- /dev/null +++ b/tests/script/tsim/stream/streamInterpPrimaryKey0.sim @@ -0,0 +1,452 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sleep 50 +sql connect + +print step1 +print =============== create database +sql create database test vgroups 1; +sql use test; + +sql create stable st(ts timestamp,a int primary key,b int,c int, d double) tags(ta int,tb int,tc int); +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _irowts, interp(b) from st partition by tbname every(1s) fill(prev); + +run tsim/stream/checkTaskStatus.sim + + +sql insert into t1 values(1648791213000,9,9,9,9.0); + +$loop_count = 0 + +loop0: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows != 1 then + print ======rows=$rows + goto loop0 +endi + + +sql insert into t1 values(1648791213000,10,10,10,10.0); +sql insert into t1 values(1648791213009,30,30,30,30.0); + +$loop_count = 0 + +loop1: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 1 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows != 1 then + print ======rows=$rows + goto loop1 +endi + +# row 0 +if $data01 != 9 then + print ======data01=$data01 + goto loop1 +endi + + +sql insert into t1 values(1648791213009,20,20,20,20.0) (1648791217001,4,4,4,4.1); + +print sql select _irowts, interp(b) from t1 range(1648791212000, 1648791217001) every(1s) fill(prev); +sql select _irowts, interp(b) from t1 range(1648791212000, 1648791217001) every(1s) fill(prev); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +$loop_count = 0 +loop2: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 2 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +# row 0 +if $rows != 5 then + print ======rows=$rows + goto loop2 +endi + +# row 0 +if $data01 != 9 then + print ======data01=$data01 + goto loop2 +endi + +if $data11 != 20 then + print ======data11=$data11 + goto loop2 +endi + +if $data21 != 20 then + print ======data21=$data21 + goto loop2 +endi + +if $data31 != 20 then + print ======data31=$data31 + goto loop2 +endi + +if $data41 != 20 then + print ======data41=$data41 + goto loop2 +endi + +print step2 +print =============== create database +sql create database test2 vgroups 1; +sql use test2; + +sql create stable st(ts timestamp,a int ,b int,c int, d double) tags(ta int,tb int,tc int); +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt(ts, b primary key) as select _irowts, interp(b) from st partition by tbname every(1s) fill(prev); + +run tsim/stream/checkTaskStatus.sim + + +sql insert into t1 values(1648791213000,9,9,9,9.0); + +$loop_count = 0 + +loop3: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows != 1 then + print ======rows=$rows + goto loop3 +endi + +sql insert into t1 values(1648791213000,10,10,10,10.0); + +sql insert into t1 values(1648791213009,30,30,30,30.0); + +$loop_count = 0 + +loop4: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 1 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows != 1 then + print ======rows=$rows + goto loop4 +endi + +# row 0 +if $data01 != 10 then + print ======data01=$data01 + goto loop4 +endi + +sql insert into t1 values(1648791217001,4,4,10,4.1); + +sleep 2000 + +sql insert into t1 values(1648791213009,20,20,10,20.0); + +print sql select _irowts, interp(b) from t1 range(1648791212000, 1648791217001) every(1s) fill(prev); +sql select _irowts, interp(b) from t1 range(1648791212000, 1648791217001) every(1s) fill(prev); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +$loop_count = 0 +loop5: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 2 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +# row 0 +if $rows != 5 then + print ======rows=$rows + goto loop5 +endi + +# row 0 +if $data01 != 10 then + print ======data01=$data01 + goto loop5 +endi + +if $data11 != 20 then + print ======data11=$data11 + goto loop5 +endi + +if $data21 != 20 then + print ======data21=$data21 + goto loop5 +endi + +if $data31 != 20 then + print ======data31=$data31 + goto loop5 +endi + +if $data41 != 20 then + print ======data41=$data41 + goto loop5 +endi + +print step3 +print =============== create database +sql create database test3 vgroups 1; +sql use test3; + +sql create stable st(ts timestamp,a int primary key, b int,c int, d double) tags(ta int,tb int,tc int); +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); +sql create stream streams3 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt(ts, b primary key) as select _irowts, interp(b) from st partition by tbname, c every(1s) fill(prev); + +run tsim/stream/checkTaskStatus.sim + + +sql insert into t1 values(1648791213000,9,9,10,9.0); + +$loop_count = 0 + +loop6: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows != 1 then + print ======rows=$rows + goto loop6 +endi + + +sql insert into t1 values(1648791213000,10,10,10,10.0); +sql insert into t1 values(1648791213009,30,30,10,30.0); + +$loop_count = 0 + +loop7: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 1 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows != 1 then + print ======rows=$rows + goto loop7 +endi + +# row 0 +if $data01 != 9 then + print ======data01=$data01 + goto loop7 +endi + + +sql insert into t1 values(1648791217001,4,4,10,4.1); + +sleep 2000 + +sql insert into t1 values(1648791213009,20,20,10,20.0); + +print sql select _irowts, interp(b) from t1 range(1648791212000, 1648791217001) every(1s) fill(prev); +sql select _irowts, interp(b) from t1 range(1648791212000, 1648791217001) every(1s) fill(prev); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +$loop_count = 0 +loop8: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 2 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +# row 0 +if $rows != 5 then + print ======rows=$rows + goto loop8 +endi + +# row 0 +if $data01 != 9 then + print ======data01=$data01 + goto loop8 +endi + +if $data11 != 20 then + print ======data11=$data11 + goto loop8 +endi + +if $data21 != 20 then + print ======data21=$data21 + goto loop8 +endi + +if $data31 != 20 then + print ======data31=$data31 + goto loop8 +endi + +if $data41 != 20 then + print ======data41=$data41 + goto loop8 +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/stream/streamInterpPrimaryKey1.sim b/tests/script/tsim/stream/streamInterpPrimaryKey1.sim new file mode 100644 index 000000000000..25d1480917ae --- /dev/null +++ b/tests/script/tsim/stream/streamInterpPrimaryKey1.sim @@ -0,0 +1,458 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sleep 50 +sql connect + +print step1 +print =============== create database +sql create database test vgroups 1; +sql use test; + +sql create stable st(ts timestamp,a int primary key,b int,c int, d double) tags(ta int,tb int,tc int); +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _irowts, interp(b) from st partition by tbname every(1s) fill(next); + +run tsim/stream/checkTaskStatus.sim + + +sql insert into t1 values(1648791213000,10,10,10,10.0); + +$loop_count = 0 + +loop0: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows != 1 then + print ======rows=$rows + goto loop0 +endi + + +sql insert into t1 values(1648791213000,9,9,9,9.0); +sql insert into t1 values(1648791213009,30,30,30,30.0); + +$loop_count = 0 + +loop1: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 1 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows != 1 then + print ======rows=$rows + goto loop1 +endi + +# row 0 +if $data01 != 9 then + print ======data01=$data01 + goto loop1 +endi + + +sql insert into t1 values(1648791213009,20,20,20,20.0) (1648791217001,40,40,40,40.1); + +sleep 2000 + +sql insert into t1 values(1648791217001,4,4,4,4.1); + +print sql select _irowts, interp(b) from t1 range(1648791212000, 1648791217001) every(1s) fill(next); +sql select _irowts, interp(b) from t1 range(1648791212000, 1648791217001) every(1s) fill(next); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +$loop_count = 0 +loop2: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 2 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +# row 0 +if $rows != 5 then + print ======rows=$rows + goto loop2 +endi + +# row 0 +if $data01 != 9 then + print ======data01=$data01 + goto loop2 +endi + +if $data11 != 4 then + print ======data11=$data11 + goto loop2 +endi + +if $data21 != 4 then + print ======data21=$data21 + goto loop2 +endi + +if $data31 != 4 then + print ======data31=$data31 + goto loop2 +endi + +if $data41 != 4 then + print ======data41=$data41 + goto loop2 +endi + +print step2 +print =============== create database +sql create database test2 vgroups 1; +sql use test2; + +sql create stable st(ts timestamp,a int ,b int,c int, d double) tags(ta int,tb int,tc int); +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt(ts, b primary key) as select _irowts, interp(b) from st partition by tbname every(1s) fill(next); + +run tsim/stream/checkTaskStatus.sim + + +sql insert into t1 values(1648791213000,10,10,10,10.0); + +$loop_count = 0 + +loop3: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows != 1 then + print ======rows=$rows + goto loop3 +endi + + +sql insert into t1 values(1648791213000,9,9,9,9.0); +sql insert into t1 values(1648791213009,30,30,30,30.0); + +$loop_count = 0 + +loop4: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 1 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows != 1 then + print ======rows=$rows + goto loop4 +endi + +# row 0 +if $data01 != 9 then + print ======data01=$data01 + goto loop4 +endi + + +sql insert into t1 values(1648791213009,20,20,20,20.0) (1648791217001,40,40,40,40.1); + +sleep 2000 + +sql insert into t1 values(1648791217001,4,4,4,4.1); + +print sql select _irowts, interp(b) from t1 range(1648791212000, 1648791217001) every(1s) fill(next); +sql select _irowts, interp(b) from t1 range(1648791212000, 1648791217001) every(1s) fill(next); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +$loop_count = 0 +loop5: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 2 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +# row 0 +if $rows != 5 then + print ======rows=$rows + goto loop5 +endi + +# row 0 +if $data01 != 9 then + print ======data01=$data01 + goto loop5 +endi + +if $data11 != 4 then + print ======data11=$data11 + goto loop5 +endi + +if $data21 != 4 then + print ======data21=$data21 + goto loop5 +endi + +if $data31 != 4 then + print ======data31=$data31 + goto loop5 +endi + +if $data41 != 4 then + print ======data41=$data41 + goto loop5 +endi + +print step3 +print =============== create database +sql create database test3 vgroups 1; +sql use test3; + +sql create stable st(ts timestamp,a int primary key, b int,c int, d double) tags(ta int,tb int,tc int); +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); +sql create stream streams3 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt(ts, b primary key) as select _irowts, interp(b) from st partition by tbname, c every(1s) fill(next); + +run tsim/stream/checkTaskStatus.sim + +sql insert into t1 values(1648791213000,10,10,10,10.0); + +$loop_count = 0 + +loop6: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows != 1 then + print ======rows=$rows + goto loop6 +endi + + +sql insert into t1 values(1648791213000,9,9,10,9.0); +sql insert into t1 values(1648791213009,30,30,10,30.0); + +$loop_count = 0 + +loop7: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 1 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows != 1 then + print ======rows=$rows + goto loop7 +endi + +# row 0 +if $data01 != 9 then + print ======data01=$data01 + goto loop7 +endi + + +sql insert into t1 values(1648791213009,20,20,10,20.0) (1648791217001,40,40,10,40.1); + +sleep 1000 + +sql insert into t1 values(1648791217001,4,4,10,4.1); + +print sql select _irowts, interp(b) from t1 range(1648791212000, 1648791217001) every(1s) fill(next); +sql select _irowts, interp(b) from t1 range(1648791212000, 1648791217001) every(1s) fill(next); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 +print $data60 $data61 $data62 $data63 $data64 + + +$loop_count = 0 +loop8: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 2 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +# row 0 +if $rows != 5 then + print ======rows=$rows + goto loop8 +endi + +# row 0 +if $data01 != 9 then + print ======data01=$data01 + goto loop8 +endi + +if $data11 != 4 then + print ======data11=$data11 + goto loop8 +endi + +if $data21 != 4 then + print ======data21=$data21 + goto loop8 +endi + +if $data31 != 4 then + print ======data31=$data31 + goto loop8 +endi + +if $data41 != 4 then + print ======data41=$data41 + goto loop8 +endi + + +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/stream/streamInterpPrimaryKey2.sim b/tests/script/tsim/stream/streamInterpPrimaryKey2.sim new file mode 100644 index 000000000000..f06e1ecd0349 --- /dev/null +++ b/tests/script/tsim/stream/streamInterpPrimaryKey2.sim @@ -0,0 +1,452 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sleep 50 +sql connect + +print step1 +print =============== create database +sql create database test vgroups 1; +sql use test; + +sql create stable st(ts timestamp,a int primary key,b int,c int, d double) tags(ta int,tb int,tc int); +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _irowts, interp(b) from st partition by tbname every(1s) fill(linear); + +run tsim/stream/checkTaskStatus.sim + + +sql insert into t1 values(1648791213000,9,9,9,9.0); + +$loop_count = 0 + +loop0: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows != 1 then + print ======rows=$rows + goto loop0 +endi + + +sql insert into t1 values(1648791213000,10,10,10,10.0); +sql insert into t1 values(1648791213009,30,30,30,30.0); + +$loop_count = 0 + +loop1: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 1 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows != 1 then + print ======rows=$rows + goto loop1 +endi + +# row 0 +if $data01 != 9 then + print ======data01=$data01 + goto loop1 +endi + + +sql insert into t1 values(1648791213009,20,20,20,20.0) (1648791217001,4,4,4,4.1); + +print sql select _irowts, interp(b) from t1 range(1648791212000, 1648791217001) every(1s) fill(linear); +sql select _irowts, interp(b) from t1 range(1648791212000, 1648791217001) every(1s) fill(linear); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +$loop_count = 0 +loop2: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 2 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +# row 0 +if $rows != 5 then + print ======rows=$rows + goto loop2 +endi + +# row 0 +if $data01 != 9 then + print ======data01=$data01 + goto loop2 +endi + +if $data11 != 16 then + print ======data11=$data11 + goto loop2 +endi + +if $data21 != 12 then + print ======data21=$data21 + goto loop2 +endi + +if $data31 != 8 then + print ======data31=$data31 + goto loop2 +endi + +if $data41 != 4 then + print ======data41=$data41 + goto loop2 +endi + +print step2 +print =============== create database +sql create database test2 vgroups 1; +sql use test2; + +sql create stable st(ts timestamp,a int ,b int,c int, d double) tags(ta int,tb int,tc int); +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt(ts, b primary key) as select _irowts, interp(b) from st partition by tbname every(1s) fill(linear); + +run tsim/stream/checkTaskStatus.sim + + +sql insert into t1 values(1648791213000,9,9,9,9.0); + +$loop_count = 0 + +loop3: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows != 1 then + print ======rows=$rows + goto loop3 +endi + +sql insert into t1 values(1648791213000,10,10,10,10.0); + +sql insert into t1 values(1648791213009,30,30,30,30.0); + +$loop_count = 0 + +loop4: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 1 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows != 1 then + print ======rows=$rows + goto loop4 +endi + +# row 0 +if $data01 != 10 then + print ======data01=$data01 + goto loop4 +endi + +sql insert into t1 values(1648791217001,4,4,10,4.1); + +sleep 2000 + +sql insert into t1 values(1648791213009,20,20,10,20.0); + +print sql select _irowts, interp(b) from t1 range(1648791212000, 1648791217001) every(1s) fill(linear); +sql select _irowts, interp(b) from t1 range(1648791212000, 1648791217001) every(1s) fill(linear); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +$loop_count = 0 +loop5: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 2 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +# row 0 +if $rows != 5 then + print ======rows=$rows + goto loop5 +endi + +# row 0 +if $data01 != 10 then + print ======data01=$data01 + goto loop5 +endi + +if $data11 != 16 then + print ======data11=$data11 + goto loop5 +endi + +if $data21 != 12 then + print ======data21=$data21 + goto loop5 +endi + +if $data31 != 8 then + print ======data31=$data31 + goto loop5 +endi + +if $data41 != 4 then + print ======data41=$data41 + goto loop5 +endi + +print step3 +print =============== create database +sql create database test3 vgroups 1; +sql use test3; + +sql create stable st(ts timestamp,a int primary key, b int,c int, d double) tags(ta int,tb int,tc int); +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); +sql create stream streams3 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt(ts, b primary key) as select _irowts, interp(b) from st partition by tbname, c every(1s) fill(linear); + +run tsim/stream/checkTaskStatus.sim + + +sql insert into t1 values(1648791213000,9,9,10,9.0); + +$loop_count = 0 + +loop6: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows != 1 then + print ======rows=$rows + goto loop6 +endi + + +sql insert into t1 values(1648791213000,10,10,10,10.0); +sql insert into t1 values(1648791213009,30,30,10,30.0); + +$loop_count = 0 + +loop7: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 1 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows != 1 then + print ======rows=$rows + goto loop7 +endi + +# row 0 +if $data01 != 9 then + print ======data01=$data01 + goto loop7 +endi + + +sql insert into t1 values(1648791217001,4,4,10,4.1); + +sleep 2000 + +sql insert into t1 values(1648791213009,20,20,10,20.0); + +print sql select _irowts, interp(b) from t1 range(1648791212000, 1648791217001) every(1s) fill(linear); +sql select _irowts, interp(b) from t1 range(1648791212000, 1648791217001) every(1s) fill(linear); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +$loop_count = 0 +loop8: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 2 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +# row 0 +if $rows != 5 then + print ======rows=$rows + goto loop8 +endi + +# row 0 +if $data01 != 9 then + print ======data01=$data01 + goto loop8 +endi + +if $data11 != 16 then + print ======data11=$data11 + goto loop8 +endi + +if $data21 != 12 then + print ======data21=$data21 + goto loop8 +endi + +if $data31 != 8 then + print ======data31=$data31 + goto loop8 +endi + +if $data41 != 4 then + print ======data41=$data41 + goto loop8 +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/stream/streamInterpPrimaryKey3.sim b/tests/script/tsim/stream/streamInterpPrimaryKey3.sim new file mode 100644 index 000000000000..725cf8d8503b --- /dev/null +++ b/tests/script/tsim/stream/streamInterpPrimaryKey3.sim @@ -0,0 +1,452 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sleep 50 +sql connect + +print step1 +print =============== create database +sql create database test vgroups 1; +sql use test; + +sql create stable st(ts timestamp,a int primary key,b int,c int, d double) tags(ta int,tb int,tc int); +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _irowts, interp(b) from st partition by tbname every(1s) fill(value,100); + +run tsim/stream/checkTaskStatus.sim + + +sql insert into t1 values(1648791213000,9,9,9,9.0); + +$loop_count = 0 + +loop0: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows != 1 then + print ======rows=$rows + goto loop0 +endi + + +sql insert into t1 values(1648791213000,10,10,10,10.0); +sql insert into t1 values(1648791213009,30,30,30,30.0); + +$loop_count = 0 + +loop1: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 1 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows != 1 then + print ======rows=$rows + goto loop1 +endi + +# row 0 +if $data01 != 9 then + print ======data01=$data01 + goto loop1 +endi + + +sql insert into t1 values(1648791213009,20,20,20,20.0) (1648791217001,4,4,4,4.1); + +print sql select _irowts, interp(b) from t1 range(1648791212000, 1648791217001) every(1s) fill(value,100); +sql select _irowts, interp(b) from t1 range(1648791212000, 1648791217001) every(1s) fill(value,100); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +$loop_count = 0 +loop2: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 2 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +# row 0 +if $rows != 5 then + print ======rows=$rows + goto loop2 +endi + +# row 0 +if $data01 != 9 then + print ======data01=$data01 + goto loop2 +endi + +if $data11 != 100 then + print ======data11=$data11 + goto loop2 +endi + +if $data21 != 100 then + print ======data21=$data21 + goto loop2 +endi + +if $data31 != 100 then + print ======data31=$data31 + goto loop2 +endi + +if $data41 != 100 then + print ======data41=$data41 + goto loop2 +endi + +print step2 +print =============== create database +sql create database test2 vgroups 1; +sql use test2; + +sql create stable st(ts timestamp,a int ,b int,c int, d double) tags(ta int,tb int,tc int); +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt(ts, b primary key) as select _irowts, interp(b) from st partition by tbname every(1s) fill(value,100); + +run tsim/stream/checkTaskStatus.sim + + +sql insert into t1 values(1648791213000,9,9,9,9.0); + +$loop_count = 0 + +loop3: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows != 1 then + print ======rows=$rows + goto loop3 +endi + +sql insert into t1 values(1648791213000,10,10,10,10.0); + +sql insert into t1 values(1648791213009,30,30,30,30.0); + +$loop_count = 0 + +loop4: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 1 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows != 1 then + print ======rows=$rows + goto loop4 +endi + +# row 0 +if $data01 != 10 then + print ======data01=$data01 + goto loop4 +endi + +sql insert into t1 values(1648791217001,4,4,10,4.1); + +sleep 2000 + +sql insert into t1 values(1648791213009,20,20,10,20.0); + +print sql select _irowts, interp(b) from t1 range(1648791212000, 1648791217001) every(1s) fill(value,100); +sql select _irowts, interp(b) from t1 range(1648791212000, 1648791217001) every(1s) fill(value,100); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +$loop_count = 0 +loop5: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 2 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +# row 0 +if $rows != 5 then + print ======rows=$rows + goto loop5 +endi + +# row 0 +if $data01 != 10 then + print ======data01=$data01 + goto loop5 +endi + +if $data11 != 100 then + print ======data11=$data11 + goto loop5 +endi + +if $data21 != 100 then + print ======data21=$data21 + goto loop5 +endi + +if $data31 != 100 then + print ======data31=$data31 + goto loop5 +endi + +if $data41 != 100 then + print ======data41=$data41 + goto loop5 +endi + +print step3 +print =============== create database +sql create database test3 vgroups 1; +sql use test3; + +sql create stable st(ts timestamp,a int primary key, b int,c int, d double) tags(ta int,tb int,tc int); +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); +sql create stream streams3 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt(ts, b primary key) as select _irowts, interp(b) from st partition by tbname, c every(1s) fill(value,100); + +run tsim/stream/checkTaskStatus.sim + + +sql insert into t1 values(1648791213000,9,9,10,9.0); + +$loop_count = 0 + +loop6: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 0 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows != 1 then + print ======rows=$rows + goto loop6 +endi + + +sql insert into t1 values(1648791213000,10,10,10,10.0); +sql insert into t1 values(1648791213009,30,30,10,30.0); + +$loop_count = 0 + +loop7: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 1 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows != 1 then + print ======rows=$rows + goto loop7 +endi + +# row 0 +if $data01 != 9 then + print ======data01=$data01 + goto loop7 +endi + + +sql insert into t1 values(1648791217001,4,4,10,4.1); + +sleep 2000 + +sql insert into t1 values(1648791213009,20,20,10,20.0); + +print sql select _irowts,interp(b) from t1 range(1648791212000, 1648791217001) every(1s) fill(value,100); +sql select _irowts, interp(b) from t1 range(1648791212000, 1648791217001) every(1s) fill(value,100); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +$loop_count = 0 +loop8: + +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print 2 sql select * from streamt; +sql select * from streamt; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +# row 0 +if $rows != 5 then + print ======rows=$rows + goto loop8 +endi + +# row 0 +if $data01 != 9 then + print ======data01=$data01 + goto loop8 +endi + +if $data11 != 100 then + print ======data11=$data11 + goto loop8 +endi + +if $data21 != 100 then + print ======data21=$data21 + goto loop8 +endi + +if $data31 != 100 then + print ======data31=$data31 + goto loop8 +endi + +if $data41 != 100 then + print ======data41=$data41 + goto loop8 +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT From f6174d0b095c2a1c6b6d8e3e7b1529085ce3817c Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Wed, 18 Sep 2024 17:00:38 +0800 Subject: [PATCH 058/695] adjust stream slice res --- source/libs/stream/src/tstreamFileState.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/source/libs/stream/src/tstreamFileState.c b/source/libs/stream/src/tstreamFileState.c index 7cd9fb7ea396..923aaa945bd3 100644 --- a/source/libs/stream/src/tstreamFileState.c +++ b/source/libs/stream/src/tstreamFileState.c @@ -1013,10 +1013,11 @@ int32_t recoverFillSnapshot(SStreamFileState* pFileState, int64_t ckId) { SStreamStateCur* pCur = streamStateFillSeekToLast_rocksdb(pFileState->pFileStore); if (pCur == NULL) { - return -1; + return code; } int32_t recoverNum = TMIN(MIN_NUM_OF_RECOVER_ROW_BUFF, pFileState->maxRowCount); - while (code == TSDB_CODE_SUCCESS) { + int32_t winRes = TSDB_CODE_SUCCESS; + while (winRes == TSDB_CODE_SUCCESS) { if (pFileState->curRowCount >= recoverNum) { break; } @@ -1024,8 +1025,8 @@ int32_t recoverFillSnapshot(SStreamFileState* pFileState, int64_t ckId) { void* pVal = NULL; int32_t vlen = 0; SRowBuffPos* pNewPos = getNewRowPosForWrite(pFileState); - code = streamStateFillGetKVByCur_rocksdb(pCur, pNewPos->pKey, (const void**)&pVal, &vlen); - if (code != TSDB_CODE_SUCCESS || isFlushedState(pFileState, pFileState->getTs(pNewPos->pKey), 0)) { + winRes = streamStateFillGetKVByCur_rocksdb(pCur, pNewPos->pKey, (const void**)&pVal, &vlen); + if (winRes != TSDB_CODE_SUCCESS || isFlushedState(pFileState, pFileState->getTs(pNewPos->pKey), 0)) { destroyRowBuffPos(pNewPos); SListNode* pNode = tdListPopTail(pFileState->usedBuffs); taosMemoryFreeClear(pNode); @@ -1036,8 +1037,8 @@ int32_t recoverFillSnapshot(SStreamFileState* pFileState, int64_t ckId) { memcpy(pNewPos->pRowBuff, pVal, vlen); taosMemoryFreeClear(pVal); pNewPos->beFlushed = true; - code = tSimpleHashPut(pFileState->rowStateBuff, pNewPos->pKey, pFileState->keyLen, &pNewPos, POINTER_BYTES); - if (code != TSDB_CODE_SUCCESS) { + winRes = tSimpleHashPut(pFileState->rowStateBuff, pNewPos->pKey, pFileState->keyLen, &pNewPos, POINTER_BYTES); + if (winRes != TSDB_CODE_SUCCESS) { destroyRowBuffPos(pNewPos); break; } @@ -1045,7 +1046,7 @@ int32_t recoverFillSnapshot(SStreamFileState* pFileState, int64_t ckId) { } streamStateFreeCur(pCur); - return TSDB_CODE_SUCCESS; + return code; } int32_t getRowBuff(SStreamFileState* pFileState, void* pKey, int32_t keyLen, void** pVal, int32_t* pVLen, From 442bf96b87e6682e5e68237034c1a344a1220a64 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Wed, 18 Sep 2024 17:24:00 +0800 Subject: [PATCH 059/695] add check --- source/libs/executor/src/streamfilloperator.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/libs/executor/src/streamfilloperator.c b/source/libs/executor/src/streamfilloperator.c index 3fcba5fb6ca0..c178f22784bb 100644 --- a/source/libs/executor/src/streamfilloperator.c +++ b/source/libs/executor/src/streamfilloperator.c @@ -112,6 +112,9 @@ void destroyStreamFillLinearInfo(SStreamFillLinearInfo* pFillLinear) { } void destroyStreamFillInfo(SStreamFillInfo* pFillInfo) { + if (pFillInfo == NULL) { + return; + } if (pFillInfo->type == TSDB_FILL_SET_VALUE || pFillInfo->type == TSDB_FILL_SET_VALUE_F || pFillInfo->type == TSDB_FILL_NULL || pFillInfo->type == TSDB_FILL_NULL_F) { taosMemoryFreeClear(pFillInfo->pResRow->pRowVal); From e1d8e98b11c00ca7040186f1018031fe99fe9924 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Thu, 19 Sep 2024 16:23:51 +0800 Subject: [PATCH 060/695] feat(stream): support the force_window_close trigger. --- include/common/tcommon.h | 1 - include/libs/executor/executor.h | 4 +- include/libs/stream/tstream.h | 23 +++-- source/dnode/mnode/impl/src/mndScheduler.c | 37 ++++---- source/dnode/mnode/impl/src/mndStream.c | 5 +- source/dnode/snode/src/snode.c | 1 - source/dnode/vnode/src/tq/tq.c | 26 ++--- source/dnode/vnode/src/tq/tqStreamTask.c | 17 ++-- source/dnode/vnode/src/tqCommon/tqCommon.c | 4 +- source/dnode/vnode/src/vnd/vnodeSvr.c | 4 +- source/libs/executor/src/executor.c | 6 +- source/libs/stream/inc/streamInt.h | 2 +- source/libs/stream/src/streamData.c | 105 ++++++++++++++------- source/libs/stream/src/streamExec.c | 2 +- source/libs/stream/src/streamMeta.c | 2 +- source/libs/stream/src/streamMsg.c | 4 +- source/libs/stream/src/streamSched.c | 63 ++++++++----- source/libs/stream/src/streamTask.c | 6 +- 18 files changed, 187 insertions(+), 125 deletions(-) diff --git a/include/common/tcommon.h b/include/common/tcommon.h index 0ecb50367b15..49a58c13337e 100644 --- a/include/common/tcommon.h +++ b/include/common/tcommon.h @@ -153,7 +153,6 @@ enum { STREAM_INPUT__DATA_SUBMIT = 1, STREAM_INPUT__DATA_BLOCK, STREAM_INPUT__MERGED_SUBMIT, - STREAM_INPUT__TQ_SCAN, STREAM_INPUT__DATA_RETRIEVE, STREAM_INPUT__GET_RES, STREAM_INPUT__CHECKPOINT, diff --git a/include/libs/executor/executor.h b/include/libs/executor/executor.h index ed56b7e6b2d4..64cc7bca95bb 100644 --- a/include/libs/executor/executor.h +++ b/include/libs/executor/executor.h @@ -221,8 +221,8 @@ int32_t qStreamSourceScanParamForHistoryScanStep2(qTaskInfo_t tinfo, SVersionRan int32_t qStreamRecoverFinish(qTaskInfo_t tinfo); bool qStreamScanhistoryFinished(qTaskInfo_t tinfo); int32_t qStreamInfoResetTimewindowFilter(qTaskInfo_t tinfo); -void resetTaskInfo(qTaskInfo_t tinfo); - +void qResetTaskInfoCode(qTaskInfo_t tinfo); +int32_t qGetStreamIntervalExecInfo(qTaskInfo_t tinfo, int64_t* pWaterMark, SInterval* pInterval); int32_t qStreamOperatorReleaseState(qTaskInfo_t tInfo); int32_t qStreamOperatorReloadState(qTaskInfo_t tInfo); diff --git a/include/libs/stream/tstream.h b/include/libs/stream/tstream.h index e71a6c4dce0d..ee8f0450a487 100644 --- a/include/libs/stream/tstream.h +++ b/include/libs/stream/tstream.h @@ -309,14 +309,16 @@ typedef struct SDataRange { } SDataRange; typedef struct SSTaskBasicInfo { - int32_t nodeId; // vgroup id or snode id - SEpSet epSet; - SEpSet mnodeEpset; // mnode epset for send heartbeat - int32_t selfChildId; - int32_t totalLevel; - int8_t taskLevel; - int8_t fillHistory; // is fill history task or not - int64_t delaySchedParam; // in msec + int32_t nodeId; // vgroup id or snode id + SEpSet epSet; + SEpSet mnodeEpset; // mnode epset for send heartbeat + int32_t selfChildId; + int32_t trigger; + int8_t taskLevel; + int8_t fillHistory; // is fill history task or not + int64_t delaySchedParam; // in msec + int64_t watermark; // extracted from operators + SInterval interval; } SSTaskBasicInfo; typedef struct SStreamRetrieveReq SStreamRetrieveReq; @@ -541,8 +543,9 @@ typedef struct STaskUpdateEntry { typedef int32_t (*__state_trans_user_fn)(SStreamTask*, void* param); -int32_t tNewStreamTask(int64_t streamId, int8_t taskLevel, SEpSet* pEpset, bool fillHistory, int64_t triggerParam, - SArray* pTaskList, bool hasFillhistory, int8_t subtableWithoutMd5, SStreamTask** pTask); +int32_t tNewStreamTask(int64_t streamId, int8_t taskLevel, SEpSet* pEpset, bool fillHistory, int32_t trigger, + int64_t triggerParam, SArray* pTaskList, bool hasFillhistory, int8_t subtableWithoutMd5, + SStreamTask** pTask); void tFreeStreamTask(SStreamTask* pTask); int32_t tEncodeStreamTask(SEncoder* pEncoder, const SStreamTask* pTask); int32_t tDecodeStreamTask(SDecoder* pDecoder, SStreamTask* pTask); diff --git a/source/dnode/mnode/impl/src/mndScheduler.c b/source/dnode/mnode/impl/src/mndScheduler.c index 4f72b26a5efd..490f07d40104 100644 --- a/source/dnode/mnode/impl/src/mndScheduler.c +++ b/source/dnode/mnode/impl/src/mndScheduler.c @@ -242,7 +242,7 @@ static int32_t doAddSinkTask(SStreamObj* pStream, SMnode* pMnode, SVgObj* pVgrou SArray** pTaskList = (isFillhistory) ? taosArrayGetLast(pStream->pHTasksList) : taosArrayGetLast(pStream->tasks); SStreamTask* pTask = NULL; - int32_t code = tNewStreamTask(uid, TASK_LEVEL__SINK, pEpset, isFillhistory, 0, *pTaskList, pStream->conf.fillHistory, + int32_t code = tNewStreamTask(uid, TASK_LEVEL__SINK, pEpset, isFillhistory, 0, 0, *pTaskList, pStream->conf.fillHistory, pStream->subTableWithoutMd5, &pTask); if (code != 0) { return code; @@ -356,8 +356,9 @@ static int32_t buildSourceTask(SStreamObj* pStream, SEpSet* pEpset, bool isFillh uint64_t uid = (isFillhistory) ? pStream->hTaskUid : pStream->uid; SArray** pTaskList = (isFillhistory) ? taosArrayGetLast(pStream->pHTasksList) : taosArrayGetLast(pStream->tasks); - int32_t code = tNewStreamTask(uid, TASK_LEVEL__SOURCE, pEpset, isFillhistory, useTriggerParam ? pStream->conf.triggerParam : 0, - *pTaskList, pStream->conf.fillHistory, pStream->subTableWithoutMd5, pTask); + int32_t code = tNewStreamTask(uid, TASK_LEVEL__SOURCE, pEpset, isFillhistory, pStream->conf.trigger, + useTriggerParam ? pStream->conf.triggerParam : 0, *pTaskList, pStream->conf.fillHistory, + pStream->subTableWithoutMd5, pTask); return code; } @@ -395,17 +396,17 @@ static void setHTasksId(SStreamObj* pStream) { } static int32_t doAddSourceTask(SMnode* pMnode, SSubplan* plan, SStreamObj* pStream, SEpSet* pEpset, int64_t skey, - SArray* pVerList, SVgObj* pVgroup, bool isFillhistory, bool useTriggerParam) { + SArray* pVerList, SVgObj* pVgroup, bool isHistoryTask, bool useTriggerParam) { SStreamTask* pTask = NULL; - int32_t code = buildSourceTask(pStream, pEpset, isFillhistory, useTriggerParam, &pTask); + int32_t code = buildSourceTask(pStream, pEpset, isHistoryTask, useTriggerParam, &pTask); if (code != TSDB_CODE_SUCCESS) { return code; } - mDebug("doAddSourceTask taskId:%s, vgId:%d, isFillHistory:%d", pTask->id.idStr, pVgroup->vgId, isFillhistory); + mDebug("doAddSourceTask taskId:%s, vgId:%d, isFillHistory:%d", pTask->id.idStr, pVgroup->vgId, isHistoryTask); if (pStream->conf.fillHistory) { - haltInitialTaskStatus(pTask, plan, isFillhistory); + haltInitialTaskStatus(pTask, plan, isHistoryTask); } streamTaskSetDataRange(pTask, skey, pVerList, pVgroup->vgId); @@ -451,10 +452,12 @@ static SSubplan* getAggSubPlan(const SQueryPlan* pPlan, int index) { static int32_t addSourceTask(SMnode* pMnode, SSubplan* plan, SStreamObj* pStream, SEpSet* pEpset, int64_t nextWindowSkey, SArray* pVerList, bool useTriggerParam) { + void* pIter = NULL; + int32_t code = 0; + SSdb* pSdb = pMnode->pSdb; + addNewTaskList(pStream); - void* pIter = NULL; - SSdb* pSdb = pMnode->pSdb; while (1) { SVgObj* pVgroup; pIter = sdbFetch(pSdb, SDB_VGROUP, pIter, (void**)&pVgroup); @@ -467,10 +470,9 @@ static int32_t addSourceTask(SMnode* pMnode, SSubplan* plan, SStreamObj* pStream continue; } - int code = - doAddSourceTask(pMnode, plan, pStream, pEpset, nextWindowSkey, pVerList, pVgroup, false, useTriggerParam); + code = doAddSourceTask(pMnode, plan, pStream, pEpset, nextWindowSkey, pVerList, pVgroup, false, useTriggerParam); if (code != 0) { - mError("create stream task, code:%s", tstrerror(code)); + mError("failed to create stream task, code:%s", tstrerror(code)); // todo drop the added source tasks. sdbRelease(pSdb, pVgroup); @@ -502,9 +504,9 @@ static int32_t buildAggTask(SStreamObj* pStream, SEpSet* pEpset, bool isFillhist uint64_t uid = (isFillhistory) ? pStream->hTaskUid : pStream->uid; SArray** pTaskList = (isFillhistory) ? taosArrayGetLast(pStream->pHTasksList) : taosArrayGetLast(pStream->tasks); - int32_t code = - tNewStreamTask(uid, TASK_LEVEL__AGG, pEpset, isFillhistory, useTriggerParam ? pStream->conf.triggerParam : 0, - *pTaskList, pStream->conf.fillHistory, pStream->subTableWithoutMd5, pAggTask); + int32_t code = tNewStreamTask(uid, TASK_LEVEL__AGG, pEpset, isFillhistory, pStream->conf.trigger, + useTriggerParam ? pStream->conf.triggerParam : 0, *pTaskList, pStream->conf.fillHistory, + pStream->subTableWithoutMd5, pAggTask); return code; } @@ -678,7 +680,7 @@ static int32_t doScheduleStream(SStreamObj* pStream, SMnode* pMnode, SQueryPlan* if (numOfPlanLevel > 1 || externalTargetDB || multiTarget || pStream->fixedSinkVgId) { // add extra sink hasExtraSink = true; - int32_t code = addSinkTask(pMnode, pStream, pEpset); + code = addSinkTask(pMnode, pStream, pEpset); if (code != TSDB_CODE_SUCCESS) { return code; } @@ -692,7 +694,8 @@ static int32_t doScheduleStream(SStreamObj* pStream, SMnode* pMnode, SQueryPlan* if (terrno != 0) code = terrno; TAOS_RETURN(code); } - code = addSourceTask(pMnode, plan, pStream, pEpset, skey, pVerList, numOfPlanLevel == 1); + + code = addSourceTask(pMnode, plan, pStream, pEpset, skey, pVerList, (numOfPlanLevel == 1)); if (code != TSDB_CODE_SUCCESS) { return code; } diff --git a/source/dnode/mnode/impl/src/mndStream.c b/source/dnode/mnode/impl/src/mndStream.c index cbe631912c1f..672d7aca3e52 100644 --- a/source/dnode/mnode/impl/src/mndStream.c +++ b/source/dnode/mnode/impl/src/mndStream.c @@ -461,17 +461,16 @@ static int32_t mndBuildStreamObjFromCreateReq(SMnode *pMnode, SStreamObj *pObj, pObj->outputSchema.pSchema = pFullSchema; } - bool hasKey = hasDestPrimaryKey(&pObj->outputSchema); SPlanContext cxt = { .pAstRoot = pAst, .topicQuery = false, .streamQuery = true, - .triggerType = pObj->conf.trigger == STREAM_TRIGGER_MAX_DELAY ? STREAM_TRIGGER_WINDOW_CLOSE : pObj->conf.trigger, + .triggerType = (pObj->conf.trigger == STREAM_TRIGGER_MAX_DELAY)? STREAM_TRIGGER_WINDOW_CLOSE : pObj->conf.trigger, .watermark = pObj->conf.watermark, .igExpired = pObj->conf.igExpired, .deleteMark = pObj->deleteMark, .igCheckUpdate = pObj->igCheckUpdate, - .destHasPrimaryKey = hasKey, + .destHasPrimaryKey = hasDestPrimaryKey(&pObj->outputSchema), }; // using ast and param to build physical plan diff --git a/source/dnode/snode/src/snode.c b/source/dnode/snode/src/snode.c index 7fc079677b6e..cf18b9cd82fe 100644 --- a/source/dnode/snode/src/snode.c +++ b/source/dnode/snode/src/snode.c @@ -38,7 +38,6 @@ int32_t sndBuildStreamTask(SSnode *pSnode, SStreamTask *pTask, int64_t nextProce streamTaskOpenAllUpstreamInput(pTask); streamTaskResetUpstreamStageInfo(pTask); - (void)streamSetupScheduleTrigger(pTask); SCheckpointInfo *pChkInfo = &pTask->chkInfo; tqSetRestoreVersionInfo(pTask); diff --git a/source/dnode/vnode/src/tq/tq.c b/source/dnode/vnode/src/tq/tq.c index c865e3ec6e9e..8448d305a2c3 100644 --- a/source/dnode/vnode/src/tq/tq.c +++ b/source/dnode/vnode/src/tq/tq.c @@ -708,9 +708,10 @@ int32_t tqProcessSubscribeReq(STQ* pTq, int64_t sversion, char* msg, int32_t msg static void freePtr(void* ptr) { taosMemoryFree(*(void**)ptr); } int32_t tqBuildStreamTask(void* pTqObj, SStreamTask* pTask, int64_t nextProcessVer) { - STQ* pTq = (STQ*)pTqObj; + STQ* pTq = (STQ*)pTqObj; + int32_t vgId = TD_VID(pTq->pVnode); + SCheckpointInfo* pChkInfo = NULL; - int32_t vgId = TD_VID(pTq->pVnode); tqDebug("s-task:0x%x start to build task", pTask->id.taskId); int32_t code = streamTaskInit(pTask, pTq->pStreamMeta, &pTq->pVnode->msgCb, nextProcessVer); @@ -752,9 +753,8 @@ int32_t tqBuildStreamTask(void* pTqObj, SStreamTask* pTask, int64_t nextProcessV } streamTaskResetUpstreamStageInfo(pTask); - streamSetupScheduleTrigger(pTask); - SCheckpointInfo* pChkInfo = &pTask->chkInfo; + pChkInfo = &pTask->chkInfo; tqSetRestoreVersionInfo(pTask); char* p = streamTaskGetStatus(pTask).name; @@ -874,13 +874,14 @@ int32_t tqProcessTaskScanHistory(STQ* pTq, SRpcMsg* pMsg) { SStreamScanHistoryReq* pReq = (SStreamScanHistoryReq*)pMsg->pCont; SStreamMeta* pMeta = pTq->pStreamMeta; int32_t code = TSDB_CODE_SUCCESS; + SStreamTask* pTask = NULL; + SStreamTask* pStreamTask = NULL; - SStreamTask* pTask = NULL; code = streamMetaAcquireTask(pMeta, pReq->streamId, pReq->taskId, &pTask); if (pTask == NULL) { tqError("vgId:%d failed to acquire stream task:0x%x during scan history data, task may have been destroyed", pMeta->vgId, pReq->taskId); - return -1; + return code; } // do recovery step1 @@ -945,11 +946,11 @@ int32_t tqProcessTaskScanHistory(STQ* pTq, SRpcMsg* pMsg) { ETaskStatus s = p.state; if (s == TASK_STATUS__PAUSE) { - tqDebug("s-task:%s is paused in the step1, elapsed time:%.2fs total:%.2fs, sched-status:%d", pTask->id.idStr, - el, pTask->execInfo.step1El, status); + tqDebug("s-task:%s is paused in the step1, elapsed time:%.2fs total:%.2fs, sched-status:%d", id, el, + pTask->execInfo.step1El, status); } else if (s == TASK_STATUS__STOP || s == TASK_STATUS__DROPPING) { - tqDebug("s-task:%s status:%p not continue scan-history data, total elapsed time:%.2fs quit", pTask->id.idStr, - p.name, pTask->execInfo.step1El); + tqDebug("s-task:%s status:%p not continue scan-history data, total elapsed time:%.2fs quit", id, p.name, + pTask->execInfo.step1El); } } @@ -966,7 +967,6 @@ int32_t tqProcessTaskScanHistory(STQ* pTq, SRpcMsg* pMsg) { } // 1. get the related stream task - SStreamTask* pStreamTask = NULL; code = streamMetaAcquireTask(pMeta, pTask->streamTaskId.streamId, pTask->streamTaskId.taskId, &pStreamTask); if (pStreamTask == NULL) { tqError("failed to find s-task:0x%" PRIx64 ", it may have been destroyed, drop related fill-history task:%s", @@ -977,15 +977,15 @@ int32_t tqProcessTaskScanHistory(STQ* pTq, SRpcMsg* pMsg) { atomic_store_32(&pTask->status.inScanHistorySentinel, 0); streamMetaReleaseTask(pMeta, pTask); - return code; // todo: handle failure + return code; } if (pStreamTask->info.taskLevel != TASK_LEVEL__SOURCE) { tqError("s-task:%s fill-history task related stream task level:%d, unexpected", id, pStreamTask->info.taskLevel); return TSDB_CODE_STREAM_INTERNAL_ERROR; } - code = streamTaskHandleEventAsync(pStreamTask->status.pSM, TASK_EVENT_HALT, handleStep2Async, pTq); + code = streamTaskHandleEventAsync(pStreamTask->status.pSM, TASK_EVENT_HALT, handleStep2Async, pTq); streamMetaReleaseTask(pMeta, pStreamTask); atomic_store_32(&pTask->status.inScanHistorySentinel, 0); diff --git a/source/dnode/vnode/src/tq/tqStreamTask.c b/source/dnode/vnode/src/tq/tqStreamTask.c index 6463a59dfbf5..a6f3a60563aa 100644 --- a/source/dnode/vnode/src/tq/tqStreamTask.c +++ b/source/dnode/vnode/src/tq/tqStreamTask.c @@ -259,7 +259,12 @@ bool handleFillhistoryScanComplete(SStreamTask* pTask, int64_t ver) { bool taskReadyForDataFromWal(SStreamTask* pTask) { // non-source or fill-history tasks don't need to response the WAL scan action. - if ((pTask->info.taskLevel != TASK_LEVEL__SOURCE) || (pTask->status.downstreamReady == 0)) { + SSTaskBasicInfo* pInfo = &pTask->info; + if ((pInfo->taskLevel != TASK_LEVEL__SOURCE) || (pTask->status.downstreamReady == 0)) { + return false; + } + + if (pInfo->taskLevel == TASK_LEVEL__SOURCE && pInfo->trigger == STREAM_TRIGGER_FORCE_WINDOW_CLOSE) { return false; } @@ -271,7 +276,7 @@ bool taskReadyForDataFromWal(SStreamTask* pTask) { } // fill-history task has entered into the last phase, no need to anything - if ((pTask->info.fillHistory == 1) && pTask->status.appendTranstateBlock) { + if ((pInfo->fillHistory == 1) && pTask->status.appendTranstateBlock) { // the maximum version of data in the WAL has reached already, the step2 is done tqDebug("s-task:%s fill-history reach the maximum ver:%" PRId64 ", not scan wal anymore", pTask->id.idStr, pTask->dataRange.range.maxVer); @@ -367,7 +372,7 @@ int32_t doScanWalForAllTasks(SStreamMeta* pStreamMeta, bool* pScanIdle) { numOfTasks = taosArrayGetSize(pTaskList); for (int32_t i = 0; i < numOfTasks; ++i) { - STaskId* pTaskId = taosArrayGet(pTaskList, i); + STaskId* pTaskId = taosArrayGet(pTaskList, i); if (pTaskId == NULL) { continue; } @@ -397,9 +402,9 @@ int32_t doScanWalForAllTasks(SStreamMeta* pStreamMeta, bool* pScanIdle) { streamMutexLock(&pTask->lock); - SStreamTaskState pState = streamTaskGetStatus(pTask); - if (pState.state != TASK_STATUS__READY) { - tqDebug("s-task:%s not ready for submit block from wal, status:%s", pTask->id.idStr, pState.name); + SStreamTaskState state = streamTaskGetStatus(pTask); + if (state.state != TASK_STATUS__READY) { + tqDebug("s-task:%s not ready for submit block from wal, status:%s", pTask->id.idStr, state.name); streamMutexUnlock(&pTask->lock); streamMetaReleaseTask(pStreamMeta, pTask); continue; diff --git a/source/dnode/vnode/src/tqCommon/tqCommon.c b/source/dnode/vnode/src/tqCommon/tqCommon.c index 83cbb4d3b9f6..a11cf770fcdb 100644 --- a/source/dnode/vnode/src/tqCommon/tqCommon.c +++ b/source/dnode/vnode/src/tqCommon/tqCommon.c @@ -83,6 +83,8 @@ int32_t tqExpandStreamTask(SStreamTask* pTask) { qSetTaskId(pTask->exec.pExecutor, pTask->id.taskId, pTask->id.streamId); } + streamSetupScheduleTrigger(pTask); + double el = (taosGetTimestampMs() - st) / 1000.0; tqDebug("s-task:%s vgId:%d expand stream task completed, elapsed time:%.2fsec", pTask->id.idStr, vgId, el); @@ -590,6 +592,7 @@ int32_t tqStreamTaskProcessDeployReq(SStreamMeta* pMeta, SMsgCb* cb, int64_t sve int32_t taskId = -1; int64_t streamId = -1; bool added = false; + int32_t size = sizeof(SStreamTask); if (tsDisableStream) { tqInfo("vgId:%d stream disabled, not deploy stream tasks", vgId); @@ -599,7 +602,6 @@ int32_t tqStreamTaskProcessDeployReq(SStreamMeta* pMeta, SMsgCb* cb, int64_t sve tqDebug("vgId:%d receive new stream task deploy msg, start to build stream task", vgId); // 1.deserialize msg and build task - int32_t size = sizeof(SStreamTask); SStreamTask* pTask = taosMemoryCalloc(1, size); if (pTask == NULL) { tqError("vgId:%d failed to create stream task due to out of memory, alloc size:%d", vgId, size); diff --git a/source/dnode/vnode/src/vnd/vnodeSvr.c b/source/dnode/vnode/src/vnd/vnodeSvr.c index 2604e2262f4c..55c26acba639 100644 --- a/source/dnode/vnode/src/vnd/vnodeSvr.c +++ b/source/dnode/vnode/src/vnd/vnodeSvr.c @@ -625,9 +625,7 @@ int32_t vnodeProcessWriteMsg(SVnode *pVnode, SRpcMsg *pMsg, int64_t ver, SRpcMsg } break; case TDMT_STREAM_TASK_DEPLOY: { - int32_t code = tqProcessTaskDeployReq(pVnode->pTq, ver, pReq, len); - if (code != TSDB_CODE_SUCCESS) { - terrno = code; + if ((code = tqProcessTaskDeployReq(pVnode->pTq, ver, pReq, len)) != 0) { goto _err; } } break; diff --git a/source/libs/executor/src/executor.c b/source/libs/executor/src/executor.c index 9c38db1cb105..162a16b78a36 100644 --- a/source/libs/executor/src/executor.c +++ b/source/libs/executor/src/executor.c @@ -131,7 +131,7 @@ static void clearStreamBlock(SOperatorInfo* pOperator) { } } -void resetTaskInfo(qTaskInfo_t tinfo) { +void qResetTaskInfoCode(qTaskInfo_t tinfo) { SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo; pTaskInfo->code = 0; clearStreamBlock(pTaskInfo->pRoot); @@ -1085,6 +1085,10 @@ int32_t qStreamRecoverFinish(qTaskInfo_t tinfo) { return code; } +int32_t qGetStreamIntervalExecInfo(qTaskInfo_t tinfo, int64_t* pWaterMark, SInterval* pInterval) { + return 0; +} + int32_t qSetStreamOperatorOptionForScanHistory(qTaskInfo_t tinfo) { SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo; SOperatorInfo* pOperator = pTaskInfo->pRoot; diff --git a/source/libs/stream/inc/streamInt.h b/source/libs/stream/inc/streamInt.h index 350bd354906a..3799c5a62b5e 100644 --- a/source/libs/stream/inc/streamInt.h +++ b/source/libs/stream/inc/streamInt.h @@ -239,7 +239,7 @@ int32_t initCheckpointReadyMsg(SStreamTask* pTask, int32_t upstreamNodeId, int32 int64_t checkpointId, SRpcMsg* pMsg); void flushStateDataInExecutor(SStreamTask* pTask, SStreamQueueItem* pCheckpointBlock); - +int32_t streamCreateSinkResTrigger(SStreamTrigger** pTrigger, int32_t triggerType, int32_t trigger); #ifdef __cplusplus } diff --git a/source/libs/stream/src/streamData.c b/source/libs/stream/src/streamData.c index d85435d21c98..be8d798a3a2d 100644 --- a/source/libs/stream/src/streamData.c +++ b/source/libs/stream/src/streamData.c @@ -15,6 +15,42 @@ #include "streamInt.h" +static int32_t streamMergedSubmitNew(SStreamMergedSubmit** pSubmit) { + *pSubmit = NULL; + + int32_t code = taosAllocateQitem(sizeof(SStreamMergedSubmit), DEF_QITEM, 0, (void**)pSubmit); + if (code) { + return TSDB_CODE_OUT_OF_MEMORY; + } + + (*pSubmit)->submits = taosArrayInit(0, sizeof(SPackedData)); + if ((*pSubmit)->submits == NULL) { + taosFreeQitem(*pSubmit); + *pSubmit = NULL; + return TSDB_CODE_OUT_OF_MEMORY; + } + + (*pSubmit)->type = STREAM_INPUT__MERGED_SUBMIT; + return TSDB_CODE_SUCCESS; +} + +static int32_t streamMergeSubmit(SStreamMergedSubmit* pMerged, SStreamDataSubmit* pSubmit) { + void* p = taosArrayPush(pMerged->submits, &pSubmit->submit); + if (p == NULL) { + return terrno; + } + + if (pSubmit->ver > pMerged->ver) { + pMerged->ver = pSubmit->ver; + } + return 0; +} + +static void freeItems(void* param) { + SSDataBlock* pBlock = param; + taosArrayDestroy(pBlock->pDataBlock); +} + int32_t createStreamBlockFromDispatchMsg(const SStreamDispatchReq* pReq, int32_t blockType, int32_t srcVg, SStreamDataBlock** pRes) { SStreamDataBlock* pData = NULL; int32_t code = taosAllocateQitem(sizeof(SStreamDataBlock), DEF_QITEM, pReq->totalLen, (void**)&pData); @@ -179,37 +215,6 @@ void streamDataSubmitDestroy(SStreamDataSubmit* pDataSubmit) { } } -int32_t streamMergedSubmitNew(SStreamMergedSubmit** pSubmit) { - *pSubmit = NULL; - - int32_t code = taosAllocateQitem(sizeof(SStreamMergedSubmit), DEF_QITEM, 0, (void**)pSubmit); - if (code) { - return TSDB_CODE_OUT_OF_MEMORY; - } - - (*pSubmit)->submits = taosArrayInit(0, sizeof(SPackedData)); - if ((*pSubmit)->submits == NULL) { - taosFreeQitem(*pSubmit); - *pSubmit = NULL; - return TSDB_CODE_OUT_OF_MEMORY; - } - - (*pSubmit)->type = STREAM_INPUT__MERGED_SUBMIT; - return TSDB_CODE_SUCCESS; -} - -int32_t streamMergeSubmit(SStreamMergedSubmit* pMerged, SStreamDataSubmit* pSubmit) { - void* p = taosArrayPush(pMerged->submits, &pSubmit->submit); - if (p == NULL) { - return terrno; - } - - if (pSubmit->ver > pMerged->ver) { - pMerged->ver = pSubmit->ver; - } - return 0; -} - // todo handle memory error int32_t streamQueueMergeQueueItem(SStreamQueueItem* dst, SStreamQueueItem* pElem, SStreamQueueItem** pRes) { *pRes = NULL; @@ -267,11 +272,6 @@ int32_t streamQueueMergeQueueItem(SStreamQueueItem* dst, SStreamQueueItem* pElem } } -static void freeItems(void* param) { - SSDataBlock* pBlock = param; - taosArrayDestroy(pBlock->pDataBlock); -} - void streamFreeQitem(SStreamQueueItem* data) { int8_t type = data->type; if (type == STREAM_INPUT__GET_RES) { @@ -306,3 +306,36 @@ void streamFreeQitem(SStreamQueueItem* data) { taosFreeQitem(pBlock); } } + +int32_t streamCreateSinkResTrigger(SStreamTrigger** pTrigger, int32_t triggerType, int32_t trigger) { + QRY_PARAM_CHECK(pTrigger); + SStreamTrigger* p = NULL; + + int32_t code = taosAllocateQitem(sizeof(SStreamTrigger), DEF_QITEM, 0, (void**)&p); + if (code) { + return code; + } + + p->type = STREAM_INPUT__GET_RES; + p->pBlock = taosMemoryCalloc(1, sizeof(SSDataBlock)); + if (p->pBlock == NULL) { + taosFreeQitem(p); + return terrno; + } + + p->pBlock->info.type = STREAM_GET_ALL; + + // let's calculate the previous time window + // todo get the time precision for ts + if (triggerType == STREAM_TRIGGER_FORCE_WINDOW_CLOSE) { + SInterval interval = {.interval = trigger, .sliding = trigger, .intervalUnit = 'a', .slidingUnit = 'a'}; + int64_t now = taosGetTimestampMs(); + + STimeWindow window = getAlignQueryTimeWindow(&interval, now - trigger); + p->pBlock->info.window = window; + } + + *pTrigger = p; + + return code; +} \ No newline at end of file diff --git a/source/libs/stream/src/streamExec.c b/source/libs/stream/src/streamExec.c index f3279a0f01bb..5f462f62f9cf 100644 --- a/source/libs/stream/src/streamExec.c +++ b/source/libs/stream/src/streamExec.c @@ -119,7 +119,7 @@ void streamTaskExecImpl(SStreamTask* pTask, SStreamQueueItem* pItem, int64_t* to uint64_t ts = 0; if ((code = qExecTask(pExecutor, &output, &ts)) < 0) { if (code == TSDB_CODE_QRY_IN_EXEC) { - resetTaskInfo(pExecutor); + qResetTaskInfoCode(pExecutor); } stError("unexpected stream execution, s-task:%s since %s", pTask->id.idStr, tstrerror(code)); diff --git a/source/libs/stream/src/streamMeta.c b/source/libs/stream/src/streamMeta.c index 0417fb218221..a5cd9bf40484 100644 --- a/source/libs/stream/src/streamMeta.c +++ b/source/libs/stream/src/streamMeta.c @@ -750,7 +750,7 @@ int32_t streamMetaRegisterTask(SStreamMeta* pMeta, int64_t ver, SStreamTask* pTa } code = taosHashPut(pMeta->pTasksMap, &id, sizeof(id), &pTask, POINTER_BYTES); - if (code) { + if (code) { // todo remove it from task list stError("s-task:0x%" PRIx64 " failed to register task into meta-list, code: out of memory", id.taskId); return code; } diff --git a/source/libs/stream/src/streamMsg.c b/source/libs/stream/src/streamMsg.c index 1c512888e705..193daa0cc47f 100644 --- a/source/libs/stream/src/streamMsg.c +++ b/source/libs/stream/src/streamMsg.c @@ -613,7 +613,7 @@ int32_t tEncodeStreamTask(SEncoder* pEncoder, const SStreamTask* pTask) { TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pTask->ver)); TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pTask->id.streamId)); TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pTask->id.taskId)); - TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pTask->info.totalLevel)); + TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pTask->info.trigger)); TAOS_CHECK_EXIT(tEncodeI8(pEncoder, pTask->info.taskLevel)); TAOS_CHECK_EXIT(tEncodeI8(pEncoder, pTask->outputInfo.type)); TAOS_CHECK_EXIT(tEncodeI16(pEncoder, pTask->msgInfo.msgType)); @@ -692,7 +692,7 @@ int32_t tDecodeStreamTask(SDecoder* pDecoder, SStreamTask* pTask) { TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pTask->id.streamId)); TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pTask->id.taskId)); - TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pTask->info.totalLevel)); + TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pTask->info.trigger)); TAOS_CHECK_EXIT(tDecodeI8(pDecoder, &pTask->info.taskLevel)); TAOS_CHECK_EXIT(tDecodeI8(pDecoder, &pTask->outputInfo.type)); TAOS_CHECK_EXIT(tDecodeI16(pDecoder, &pTask->msgInfo.msgType)); diff --git a/source/libs/stream/src/streamSched.c b/source/libs/stream/src/streamSched.c index 2d54547aa2a7..f5b552402629 100644 --- a/source/libs/stream/src/streamSched.c +++ b/source/libs/stream/src/streamSched.c @@ -20,15 +20,40 @@ static void streamTaskResumeHelper(void* param, void* tmrId); static void streamTaskSchedHelper(void* param, void* tmrId); void streamSetupScheduleTrigger(SStreamTask* pTask) { - if (pTask->info.delaySchedParam != 0 && pTask->info.fillHistory == 0) { - int32_t ref = atomic_add_fetch_32(&pTask->refCnt, 1); - stDebug("s-task:%s setup scheduler trigger, ref:%d delay:%" PRId64 " ms", pTask->id.idStr, ref, - pTask->info.delaySchedParam); - - pTask->schedInfo.pDelayTimer = - taosTmrStart(streamTaskSchedHelper, (int32_t)pTask->info.delaySchedParam, pTask, streamTimer); - pTask->schedInfo.status = TASK_TRIGGER_STATUS__INACTIVE; + int64_t delay = 0; + int32_t code = 0; + const char* id = pTask->id.idStr; + if (pTask->info.fillHistory == 1) { + return; + } + + // dynamic set the trigger & triggerParam for STREAM_TRIGGER_FORCE_WINDOW_CLOSE + if ((pTask->info.trigger == STREAM_TRIGGER_FORCE_WINDOW_CLOSE) && (pTask->info.taskLevel == TASK_LEVEL__SOURCE)) { + int64_t waterMark = 0; + SInterval interval = {0}; + code = qGetStreamIntervalExecInfo(pTask->exec.pExecutor, &waterMark, &interval); + if (code == 0) { + pTask->info.delaySchedParam = interval.sliding; + pTask->info.watermark = waterMark; + pTask->info.interval = interval; + } + + // todo: calculate the correct start delay time for force_window_close + delay = pTask->info.delaySchedParam; + stInfo("s-task:%s extract interval info from executor, wm:%" PRId64 " interval:%" PRId64 " unit:%c sliding:%" PRId64 + " unit:%c ", + id, waterMark, interval.interval, interval.intervalUnit, interval.sliding, interval.slidingUnit); + } + + if (delay == 0) { + return; } + + int32_t ref = atomic_add_fetch_32(&pTask->refCnt, 1); + stDebug("s-task:%s setup scheduler trigger, ref:%d delay:%" PRId64 " ms", id, ref, pTask->info.delaySchedParam); + + pTask->schedInfo.pDelayTimer = taosTmrStart(streamTaskSchedHelper, (int32_t)delay, pTask, streamTimer); + pTask->schedInfo.status = TASK_TRIGGER_STATUS__INACTIVE; } int32_t streamTrySchedExec(SStreamTask* pTask) { @@ -135,32 +160,22 @@ void streamTaskSchedHelper(void* param, void* tmrId) { if (status == TASK_TRIGGER_STATUS__ACTIVE) { SStreamTrigger* pTrigger; - int32_t code = taosAllocateQitem(sizeof(SStreamTrigger), DEF_QITEM, 0, (void**)&pTrigger); + int32_t code = streamCreateSinkResTrigger(&pTrigger, pTask->info.trigger, pTask->info.delaySchedParam); if (code) { - stError("s-task:%s failed to prepare retrieve data trigger, code:%s, try again in %dms", id, "out of memory", + stError("s-task:%s failed to prepare retrieve data trigger, code:%s, try again in %dms", id, tstrerror(code), nextTrigger); - streamTmrReset(streamTaskSchedHelper, nextTrigger, pTask, streamTimer, &pTask->schedInfo.pDelayTimer, vgId, "sched-run-tmr"); + streamTmrReset(streamTaskSchedHelper, nextTrigger, pTask, streamTimer, &pTask->schedInfo.pDelayTimer, vgId, + "sched-run-tmr"); terrno = code; return; } - pTrigger->type = STREAM_INPUT__GET_RES; - pTrigger->pBlock = taosMemoryCalloc(1, sizeof(SSDataBlock)); - if (pTrigger->pBlock == NULL) { - taosFreeQitem(pTrigger); - - stError("s-task:%s failed to prepare retrieve data trigger, code:%s, try again in %dms", id, "out of memory", - nextTrigger); - streamTmrReset(streamTaskSchedHelper, nextTrigger, pTask, streamTimer, &pTask->schedInfo.pDelayTimer, vgId, "sched-run-tmr"); - return; - } - atomic_store_8(&pTask->schedInfo.status, TASK_TRIGGER_STATUS__INACTIVE); - pTrigger->pBlock->info.type = STREAM_GET_ALL; code = streamTaskPutDataIntoInputQ(pTask, (SStreamQueueItem*)pTrigger); if (code != TSDB_CODE_SUCCESS) { - streamTmrReset(streamTaskSchedHelper, nextTrigger, pTask, streamTimer, &pTask->schedInfo.pDelayTimer, vgId, "sched-run-tmr"); + streamTmrReset(streamTaskSchedHelper, nextTrigger, pTask, streamTimer, &pTask->schedInfo.pDelayTimer, vgId, + "sched-run-tmr"); return; } diff --git a/source/libs/stream/src/streamTask.c b/source/libs/stream/src/streamTask.c index fb2456e1cd07..244c4aaf88d8 100644 --- a/source/libs/stream/src/streamTask.c +++ b/source/libs/stream/src/streamTask.c @@ -103,8 +103,9 @@ static SStreamUpstreamEpInfo* createStreamTaskEpInfo(const SStreamTask* pTask) { return pEpInfo; } -int32_t tNewStreamTask(int64_t streamId, int8_t taskLevel, SEpSet* pEpset, bool fillHistory, int64_t triggerParam, - SArray* pTaskList, bool hasFillhistory, int8_t subtableWithoutMd5, SStreamTask** p) { +int32_t tNewStreamTask(int64_t streamId, int8_t taskLevel, SEpSet* pEpset, bool fillHistory, int32_t trigger, + int64_t triggerParam, SArray* pTaskList, bool hasFillhistory, int8_t subtableWithoutMd5, + SStreamTask** p) { *p = NULL; SStreamTask* pTask = (SStreamTask*)taosMemoryCalloc(1, sizeof(SStreamTask)); @@ -120,6 +121,7 @@ int32_t tNewStreamTask(int64_t streamId, int8_t taskLevel, SEpSet* pEpset, bool pTask->info.taskLevel = taskLevel; pTask->info.fillHistory = fillHistory; + pTask->info.trigger = trigger; pTask->info.delaySchedParam = triggerParam; pTask->subtableWithoutMd5 = subtableWithoutMd5; From 8b6771bc96f2d59364dc458b0b10598e01b9493a Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Thu, 19 Sep 2024 16:53:37 +0800 Subject: [PATCH 061/695] other: merge new pr. --- source/libs/stream/src/streamSched.c | 1 - 1 file changed, 1 deletion(-) diff --git a/source/libs/stream/src/streamSched.c b/source/libs/stream/src/streamSched.c index bc5501919798..9b097696c591 100644 --- a/source/libs/stream/src/streamSched.c +++ b/source/libs/stream/src/streamSched.c @@ -55,7 +55,6 @@ void streamSetupScheduleTrigger(SStreamTask* pTask) { streamTmrStart(streamTaskSchedHelper, delay, pTask, streamTimer, &pTask->schedInfo.pDelayTimer, pTask->pMeta->vgId, "sched-tmr"); pTask->schedInfo.status = TASK_TRIGGER_STATUS__INACTIVE; - } } int32_t streamTrySchedExec(SStreamTask* pTask) { From 7bbe197e47331f6ee7346d8ff98c1181d6619d35 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Fri, 20 Sep 2024 08:49:02 +0800 Subject: [PATCH 062/695] enh: add query plan test --- source/libs/executor/test/CMakeLists.txt | 12 + source/libs/executor/test/queryPlanTests.cpp | 3780 ++++++++++++++++++ 2 files changed, 3792 insertions(+) create mode 100755 source/libs/executor/test/queryPlanTests.cpp diff --git a/source/libs/executor/test/CMakeLists.txt b/source/libs/executor/test/CMakeLists.txt index ebf7131aa5ea..a3c22cdd575e 100644 --- a/source/libs/executor/test/CMakeLists.txt +++ b/source/libs/executor/test/CMakeLists.txt @@ -33,3 +33,15 @@ TARGET_INCLUDE_DIRECTORIES( PUBLIC "${TD_SOURCE_DIR}/include/common" PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../inc" ) + +ADD_EXECUTABLE(queryPlanTests queryPlanTests.cpp) +TARGET_LINK_LIBRARIES( + queryPlanTests + PRIVATE os util common executor gtest_main qcom function planner scalar nodes vnode +) + +TARGET_INCLUDE_DIRECTORIES( + queryPlanTests + PUBLIC "${TD_SOURCE_DIR}/include/common" + PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../inc" +) diff --git a/source/libs/executor/test/queryPlanTests.cpp b/source/libs/executor/test/queryPlanTests.cpp new file mode 100755 index 000000000000..6dd42c3a93a6 --- /dev/null +++ b/source/libs/executor/test/queryPlanTests.cpp @@ -0,0 +1,3780 @@ +/* + * 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 + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wwrite-strings" +#pragma GCC diagnostic ignored "-Wunused-function" +#pragma GCC diagnostic ignored "-Wunused-variable" +#pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wformat" +#include + + +#ifdef WINDOWS +#define TD_USE_WINSOCK +#endif + +#include "os.h" + +#include "executor.h" +#include "executorInt.h" +#include "function.h" +#include "operator.h" +#include "taos.h" +#include "tdatablock.h" +#include "tdef.h" +#include "tvariant.h" +#include "stub.h" +#include "querytask.h" + + +namespace { + +typedef struct { + bool succeed; + int32_t blkNum; + int32_t rowNum; + int32_t addRowNum; + int32_t subRowNum; + int32_t matchNum; +} SJoinTestResInfo; + +typedef struct { + int32_t maxResRows; + int32_t maxResBlkRows; + int64_t totalResRows; + int64_t useMSecs; + SArray* pHistory; +} SJoinTestStat; + + +enum { + TEST_NO_COND = 1, + TEST_EQ_COND, + TEST_ON_COND, + TEST_FULL_COND +}; + +#define JT_PRINTF (void)printf + +#define COL_DISPLAY_WIDTH 18 +#define JT_MAX_LOOP 1000 + +#define LEFT_BLK_ID 0 +#define RIGHT_BLK_ID 1 +#define RES_BLK_ID 2 +#define MAX_SLOT_NUM 4 + +#define LEFT_TABLE_COLS 0x1 +#define RIGHT_TABLE_COLS 0x2 +#define ALL_TABLE_COLS (LEFT_TABLE_COLS | RIGHT_TABLE_COLS) + +#define JT_MAX_JLIMIT 20 +#define JT_MAX_WINDOW_OFFSET 5 +#define JT_KEY_SOLT_ID (MAX_SLOT_NUM - 1) +#define JT_PRIM_TS_SLOT_ID 0 +int32_t jtInputColType[MAX_SLOT_NUM] = {TSDB_DATA_TYPE_TIMESTAMP, TSDB_DATA_TYPE_INT, TSDB_DATA_TYPE_INT, TSDB_DATA_TYPE_BIGINT}; + +char* jtColCondStr[] = {"", "NO COND", "EQ COND", "ON COND", "FULL COND"}; +char* jtJoinTypeStr[] = {"INNER", "LEFT", "RIGHT", "FULL"}; +char* jtSubTypeStr[] = {"", "OUTER", "SEMI", "ANTI", "ASOF", "WINDOW"}; + +int64_t TIMESTAMP_FILTER_VALUE = 10000000000; +int32_t INT_FILTER_VALUE = 200000000; +int64_t BIGINT_FILTER_VALUE = 3000000000000000; + +int64_t jtFilterValue[] = {TIMESTAMP_FILTER_VALUE, INT_FILTER_VALUE, INT_FILTER_VALUE, BIGINT_FILTER_VALUE}; + +bool jtErrorRerun = false; +bool jtInRerun = false; + +typedef struct { + bool printTestInfo; + bool printInputRow; + bool printResRow; + bool logHistory; + bool noKeepResRows; +} SJoinTestCtrl; + + +typedef struct { + bool filter; + bool asc; + bool grpJoin; + int32_t leftMaxRows; + int32_t leftMaxGrpRows; + int32_t rightMaxRows; + int32_t rightMaxGrpRows; + int32_t blkRows; + int32_t colCond; + int32_t joinType; + int32_t subType; + int32_t asofOpType; + int64_t jLimit; + int64_t winStartOffset; + int64_t winEndOffset; + int64_t inGrpId; + + int32_t leftTotalRows; + int32_t rightTotalRows; + int32_t blkRowSize; + int32_t inputStat; + + int32_t colEqNum; + int32_t colEqList[MAX_SLOT_NUM]; + + int32_t colOnNum; + int32_t colOnList[MAX_SLOT_NUM]; + + int32_t leftFilterNum; + int32_t leftFilterColList[MAX_SLOT_NUM]; + + int32_t rightFilterNum; + int32_t rightFilterColList[MAX_SLOT_NUM]; + + int32_t keyInSlotIdx; + int32_t keyOutSlotIdx; + int32_t keyColOffset; + + int32_t resColNum; + int32_t resColInSlot[MAX_SLOT_NUM * 2]; + int32_t resColList[MAX_SLOT_NUM * 2]; + int32_t resColOffset[MAX_SLOT_NUM * 2]; + int32_t resColSize; + char* resColBuf; + + int32_t colRowDataBufSize; + char* colRowDataBuf; + int32_t colRowOffset[MAX_SLOT_NUM]; + + int64_t curTs; + int64_t curKeyOffset; + int32_t grpOffset[MAX_SLOT_NUM]; + + int32_t leftBlkReadIdx; + SArray* leftBlkList; + int32_t rightBlkReadIdx; + SArray* rightBlkList; + + int64_t resRows; + bool leftColOnly; + bool rightColOnly; + SSHashObj* jtResRows; + + SOperatorInfo* pJoinOp; + + int32_t loopIdx; + + int32_t rightFinMatchNum; + bool* rightFinMatch; + + int32_t inColOffset[MAX_SLOT_NUM]; + int32_t inColSize; + char* inColBuf; + SArray* leftRowsList; + SArray* rightRowsList; + SArray* rightFilterOut; + + int64_t startTsUs; +} SJoinTestCtx; + +typedef struct { + SJoinTestResInfo res; + SJoinTestCtx ctx; +} SJoinTestHistory; + +typedef struct { + EJoinType joinType; + EJoinSubType subType; + int32_t asofOp; + int64_t jLimit; + int32_t cond; + bool filter; + bool asc; + bool grpJoin; + bool timetruncate; + SExecTaskInfo* pTask; +} SJoinTestParam; + + +SJoinTestCtx jtCtx = {0}; +SJoinTestCtrl jtCtrl = {0, 0, 0, 0, 0}; +SJoinTestStat jtStat = {0}; +SJoinTestResInfo jtRes = {0}; + + + +void printResRow(char* value, int32_t type) { + if (!jtCtrl.printResRow) { + return; + } + + JT_PRINTF(" "); + for (int32_t i = 0; i < jtCtx.resColNum; ++i) { + int32_t slot = jtCtx.resColInSlot[i]; + if (0 == type && ((jtCtx.leftColOnly && slot >= MAX_SLOT_NUM) || + (jtCtx.rightColOnly && slot < MAX_SLOT_NUM))) { + ("%18s", " "); + continue; + } + + if (*(bool*)(value + slot)) { + JT_PRINTF("%18s", " NULL"); + continue; + } + + switch (jtInputColType[slot % MAX_SLOT_NUM]) { + case TSDB_DATA_TYPE_TIMESTAMP: + JT_PRINTF("%18" PRId64 , *(int64_t*)(value + jtCtx.resColOffset[slot])); + break; + case TSDB_DATA_TYPE_INT: + JT_PRINTF("%18d", *(int32_t*)(value + jtCtx.resColOffset[slot])); + break; + case TSDB_DATA_TYPE_BIGINT: + JT_PRINTF("%18" PRId64, *(int64_t*)(value + jtCtx.resColOffset[slot])); + break; + } + } + JT_PRINTF("\t %s\n", 0 == type ? "-" : (1 == type ? "+" : "")); +} + +void pushResRow(char* buf, int32_t size) { + jtCtx.resRows++; + + if (!jtCtrl.noKeepResRows) { + int32_t* rows = (int32_t*)tSimpleHashGet(jtCtx.jtResRows, buf, size); + if (rows) { + (*rows)++; + } else { + int32_t n = 1; + assert(0 == tSimpleHashPut(jtCtx.jtResRows, buf, size, &n, sizeof(n))); + } + } +} + +void rmResRow() { + int32_t* rows = (int32_t*)tSimpleHashGet(jtCtx.jtResRows, jtCtx.resColBuf, jtCtx.resColSize); + if (rows) { + (*rows)--; + if ((*rows) == 0) { + (void)tSimpleHashRemove(jtCtx.jtResRows, jtCtx.resColBuf, jtCtx.resColSize); + } + } else { + assert(0); + } +} + +static int32_t jtMergeEqCond(SNode** ppDst, SNode** ppSrc) { + if (NULL == *ppSrc) { + return TSDB_CODE_SUCCESS; + } + if (NULL == *ppDst) { + *ppDst = *ppSrc; + *ppSrc = NULL; + return TSDB_CODE_SUCCESS; + } + if (QUERY_NODE_LOGIC_CONDITION == nodeType(*ppSrc)) { + TSWAP(*ppDst, *ppSrc); + } + if (QUERY_NODE_LOGIC_CONDITION == nodeType(*ppDst)) { + SLogicConditionNode* pLogic = (SLogicConditionNode*)*ppDst; + if (QUERY_NODE_LOGIC_CONDITION == nodeType(*ppSrc)) { + assert(0 == nodesListStrictAppendList(pLogic->pParameterList, ((SLogicConditionNode*)(*ppSrc))->pParameterList)); + ((SLogicConditionNode*)(*ppSrc))->pParameterList = NULL; + } else { + assert(0 == nodesListStrictAppend(pLogic->pParameterList, *ppSrc)); + *ppSrc = NULL; + } + nodesDestroyNode(*ppSrc); + *ppSrc = NULL; + return TSDB_CODE_SUCCESS; + } + + SLogicConditionNode* pLogicCond = NULL; + int32_t code = nodesMakeNode(QUERY_NODE_LOGIC_CONDITION, (SNode**)&pLogicCond); + if (NULL == pLogicCond) { + return code; + } + pLogicCond->node.resType.type = TSDB_DATA_TYPE_BOOL; + pLogicCond->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_BOOL].bytes; + pLogicCond->condType = LOGIC_COND_TYPE_AND; + pLogicCond->pParameterList = NULL; + code = nodesMakeList(&pLogicCond->pParameterList); + assert(0 == nodesListStrictAppend(pLogicCond->pParameterList, *ppSrc)); + assert(0 == nodesListStrictAppend(pLogicCond->pParameterList, *ppDst)); + + *ppDst = (SNode*)pLogicCond; + *ppSrc = NULL; + + return TSDB_CODE_SUCCESS; +} + + +void createDummyDownstreamOperators(int32_t num, SOperatorInfo** ppRes) { + for (int32_t i = 0; i < num; ++i) { + SOperatorInfo* p = (SOperatorInfo*)taosMemoryCalloc(1, sizeof(SOperatorInfo)); + assert(NULL != p); + p->resultDataBlockId = i; + ppRes[i] = p; + } +} + +void createTargetSlotList(SSortMergeJoinPhysiNode* p) { + jtCtx.resColNum = 0; + TAOS_MEMSET(jtCtx.resColList, 0, sizeof(jtCtx.resColList)); + jtCtx.resColSize = MAX_SLOT_NUM * 2 * sizeof(bool); + jtCtx.keyInSlotIdx = -1; + + for (int32_t i = 0; i < MAX_SLOT_NUM; ++i) { + if (jtCtx.colOnList[i] || jtCtx.colEqList[i] || jtCtx.leftFilterColList[i]) { + jtCtx.resColList[i] = 1; + } + } + + for (int32_t i = 0; i < MAX_SLOT_NUM; ++i) { + if (jtCtx.colOnList[i] || jtCtx.colEqList[i] || jtCtx.rightFilterColList[i]) { + jtCtx.resColList[MAX_SLOT_NUM + i] = 1; + } + } + + for (int32_t i = 0; i < MAX_SLOT_NUM; ++i) { + if (0 == jtCtx.resColList[i]) { + jtCtx.resColList[i]= taosRand() % 2; + } + + if ((jtCtx.joinType == JOIN_TYPE_LEFT || jtCtx.joinType == JOIN_TYPE_FULL) && (i == JT_KEY_SOLT_ID)) { + jtCtx.resColList[i] = 1; + } + + if (jtCtx.resColList[i] && i == JT_KEY_SOLT_ID && (jtCtx.joinType == JOIN_TYPE_LEFT || jtCtx.joinType == JOIN_TYPE_FULL)) { + jtCtx.keyInSlotIdx = JT_KEY_SOLT_ID; + } + } + + if (jtCtx.keyInSlotIdx < 0 || ((jtCtx.joinType == JOIN_TYPE_RIGHT || jtCtx.joinType == JOIN_TYPE_FULL))) { + jtCtx.resColList[MAX_SLOT_NUM + JT_KEY_SOLT_ID]= 1; + jtCtx.keyInSlotIdx = JT_KEY_SOLT_ID + MAX_SLOT_NUM; + } + + for (int32_t i = 0; i < MAX_SLOT_NUM; ++i) { + if (0 == jtCtx.resColList[MAX_SLOT_NUM + i]) { + jtCtx.resColList[MAX_SLOT_NUM + i]= taosRand() % 2; + } + } + + int32_t idx = 0; + int32_t dstIdx = 0; + int32_t dstOffset = jtCtx.resColSize; + + for (int32_t i = 0; i < MAX_SLOT_NUM; ++i) { + if (jtCtx.resColList[i]) { + jtCtx.resColOffset[i] = dstOffset; + jtCtx.resColInSlot[dstIdx] = i; + if (jtCtx.keyInSlotIdx == i) { + jtCtx.keyColOffset = dstOffset; + } + + STargetNode* pTarget = NULL; + int32_t code = nodesMakeNode(QUERY_NODE_TARGET, (SNode**)&pTarget); + SColumnNode* pCol = NULL; + code = nodesMakeNode(QUERY_NODE_COLUMN, (SNode**)&pCol); + assert(NULL != pTarget && NULL != pCol); + pCol->dataBlockId = LEFT_BLK_ID; + pCol->slotId = i; + pTarget->dataBlockId = RES_BLK_ID; + pTarget->slotId = dstIdx++; + pTarget->pExpr = (SNode*)pCol; + dstOffset += tDataTypes[jtInputColType[i]].bytes; + jtCtx.resColSize += tDataTypes[jtInputColType[i]].bytes; + + assert(0 == nodesListMakeStrictAppend(&p->pTargets, (SNode*)pTarget)); + + jtCtx.resColNum++; + } + } + + for (int32_t i = 0; i < MAX_SLOT_NUM; ++i) { + if (jtCtx.resColList[MAX_SLOT_NUM + i]) { + jtCtx.resColOffset[MAX_SLOT_NUM + i] = dstOffset; + jtCtx.resColInSlot[dstIdx] = i + MAX_SLOT_NUM; + if (jtCtx.keyInSlotIdx == (i + MAX_SLOT_NUM)) { + jtCtx.keyColOffset = dstOffset; + } + + STargetNode* pTarget = NULL; + int32_t code = nodesMakeNode(QUERY_NODE_TARGET, (SNode**)&pTarget); + SColumnNode* pCol = NULL; + code = nodesMakeNode(QUERY_NODE_COLUMN, (SNode**)&pCol); + assert(NULL != pTarget && NULL != pCol); + pCol->dataBlockId = RIGHT_BLK_ID; + pCol->slotId = i; + pTarget->dataBlockId = RES_BLK_ID; + pTarget->slotId = dstIdx++; + pTarget->pExpr = (SNode*)pCol; + dstOffset += tDataTypes[jtInputColType[i]].bytes; + jtCtx.resColSize += tDataTypes[jtInputColType[i]].bytes; + + assert(0 == nodesListMakeStrictAppend(&p->pTargets, (SNode*)pTarget)); + jtCtx.resColNum++; + } + } + + jtCtx.resColBuf = (char*)taosMemoryRealloc(jtCtx.resColBuf, jtCtx.resColSize); + assert(NULL != jtCtx.resColBuf); +} + +void createColEqCondStart(SSortMergeJoinPhysiNode* p) { + jtCtx.colEqNum = 0; + do { + jtCtx.colEqNum = taosRand() % MAX_SLOT_NUM; // except TIMESTAMP + } while (0 == jtCtx.colEqNum); + + int32_t idx = 0; + TAOS_MEMSET(jtCtx.colEqList, 0, sizeof(jtCtx.colEqList)); + for (int32_t i = 0; i < jtCtx.colEqNum; ) { + idx = taosRand() % MAX_SLOT_NUM; + if (jtCtx.colEqList[idx]) { + continue; + } + if (TSDB_DATA_TYPE_TIMESTAMP == jtInputColType[idx]) { + continue; + } + jtCtx.colEqList[idx] = 1; + ++i; + } + + for (int32_t i = 0; i < MAX_SLOT_NUM; ++i) { + if (jtCtx.colEqList[i]) { + SColumnNode* pCol1 = NULL; + int32_t code = nodesMakeNode(QUERY_NODE_COLUMN, (SNode**)&pCol1); + assert(pCol1); + pCol1->dataBlockId = LEFT_BLK_ID; + pCol1->slotId = i; + pCol1->node.resType.type = jtInputColType[i]; + pCol1->node.resType.bytes = tDataTypes[jtInputColType[i]].bytes; + + assert(0 == nodesListMakeStrictAppend(&p->pEqLeft, (SNode*)pCol1)); + + SColumnNode* pCol2 = NULL; + code = nodesMakeNode(QUERY_NODE_COLUMN, (SNode**)&pCol2); + pCol2->dataBlockId = RIGHT_BLK_ID; + pCol2->slotId = i; + pCol2->node.resType.type = jtInputColType[i]; + pCol2->node.resType.bytes = tDataTypes[jtInputColType[i]].bytes; + + assert(0 == nodesListMakeStrictAppend(&p->pEqRight, (SNode*)pCol2)); + } + } +} + +void createColOnCondStart(SSortMergeJoinPhysiNode* p) { + jtCtx.colOnNum = 0; + do { + jtCtx.colOnNum = taosRand() % (MAX_SLOT_NUM + 1); + } while (0 == jtCtx.colOnNum || (jtCtx.colOnNum + jtCtx.colEqNum) > MAX_SLOT_NUM); + + int32_t idx = 0; + TAOS_MEMSET(jtCtx.colOnList, 0, sizeof(jtCtx.colOnList)); + for (int32_t i = 0; i < jtCtx.colOnNum; ) { + idx = taosRand() % MAX_SLOT_NUM; + if (jtCtx.colOnList[idx] || jtCtx.colEqList[idx]) { + continue; + } + jtCtx.colOnList[idx] = 1; + ++i; + } +} + +int32_t getDstSlotId(int32_t srcIdx) { + for (int32_t i = 0; i < jtCtx.resColNum; ++i) { + if (jtCtx.resColInSlot[i] == srcIdx) { + return i; + } + } + + return -1; +} + + +void createColEqCondEnd(SSortMergeJoinPhysiNode* p) { + if (jtCtx.colEqNum <= 0) { + return; + } + + SLogicConditionNode* pLogic = NULL; + if (jtCtx.colEqNum > 1) { + int32_t code = nodesMakeNode(QUERY_NODE_LOGIC_CONDITION, (SNode**)&pLogic); + assert(pLogic); + pLogic->node.resType.type = TSDB_DATA_TYPE_BOOL; + pLogic->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_BOOL].bytes; + pLogic->condType = LOGIC_COND_TYPE_AND; + } + + for (int32_t i = 0; i < MAX_SLOT_NUM; ++i) { + if (jtCtx.colEqList[i]) { + SColumnNode* pCol1 = NULL; + int32_t code = nodesMakeNode(QUERY_NODE_COLUMN, (SNode**)&pCol1); + assert(pCol1); + pCol1->dataBlockId = RES_BLK_ID; + pCol1->slotId = getDstSlotId(i); + pCol1->node.resType.type = jtInputColType[i]; + pCol1->node.resType.bytes = tDataTypes[jtInputColType[i]].bytes; + + SColumnNode* pCol2 = NULL; + code = nodesMakeNode(QUERY_NODE_COLUMN, (SNode**)&pCol2); + assert(pCol2); + pCol2->dataBlockId = RES_BLK_ID; + pCol2->slotId = getDstSlotId(MAX_SLOT_NUM + i); + pCol2->node.resType.type = jtInputColType[i]; + pCol2->node.resType.bytes = tDataTypes[jtInputColType[i]].bytes; + + SOperatorNode* pOp = NULL; + code = nodesMakeNode(QUERY_NODE_OPERATOR, (SNode**)&pOp); + assert(pOp); + pOp->opType = OP_TYPE_EQUAL; + pOp->node.resType.type = TSDB_DATA_TYPE_BOOL; + pOp->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_BOOL].bytes; + pOp->pLeft = (SNode*)pCol1; + pOp->pRight = (SNode*)pCol2; + + if (jtCtx.colEqNum > 1) { + assert(0 == nodesListMakeStrictAppend(&pLogic->pParameterList, (SNode*)pOp)); + } else { + p->pFullOnCond = (SNode*)pOp; + break; + } + } + } + + if (jtCtx.colEqNum > 1) { + p->pFullOnCond = (SNode*)pLogic; + } +} + +void createColOnCondEnd(SSortMergeJoinPhysiNode* p) { + if (jtCtx.colOnNum <= 0) { + return; + } + + SLogicConditionNode* pLogic = NULL; + if (jtCtx.colOnNum > 1) { + int32_t code = nodesMakeNode(QUERY_NODE_LOGIC_CONDITION, (SNode**)&pLogic); + assert(pLogic); + pLogic->node.resType.type = TSDB_DATA_TYPE_BOOL; + pLogic->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_BOOL].bytes; + pLogic->condType = LOGIC_COND_TYPE_AND; + } + + for (int32_t i = 0; i < MAX_SLOT_NUM; ++i) { + if (jtCtx.colOnList[i]) { + SColumnNode* pCol1 = NULL; + int32_t code = nodesMakeNode(QUERY_NODE_COLUMN, (SNode**)&pCol1); + assert(pCol1); + pCol1->dataBlockId = RES_BLK_ID; + pCol1->slotId = getDstSlotId(i); + pCol1->node.resType.type = jtInputColType[i]; + pCol1->node.resType.bytes = tDataTypes[jtInputColType[i]].bytes; + + SColumnNode* pCol2 = NULL; + code = nodesMakeNode(QUERY_NODE_COLUMN, (SNode**)&pCol2); + assert(pCol2); + pCol2->dataBlockId = RES_BLK_ID; + pCol2->slotId = getDstSlotId(MAX_SLOT_NUM + i); + pCol2->node.resType.type = jtInputColType[i]; + pCol2->node.resType.bytes = tDataTypes[jtInputColType[i]].bytes; + + SOperatorNode* pOp = NULL; + code = nodesMakeNode(QUERY_NODE_OPERATOR, (SNode**)&pOp); + assert(pOp); + pOp->opType = OP_TYPE_GREATER_THAN; + pOp->node.resType.type = TSDB_DATA_TYPE_BOOL; + pOp->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_BOOL].bytes; + pOp->pLeft = (SNode*)pCol1; + pOp->pRight = (SNode*)pCol2; + + if (jtCtx.colOnNum > 1) { + assert(0 == nodesListMakeStrictAppend(&pLogic->pParameterList, (SNode*)pOp)); + } else { + p->pColOnCond = (SNode*)pOp; + break; + } + } + } + + if (jtCtx.colOnNum > 1) { + p->pColOnCond = (SNode*)pLogic; + } + + SNode* pTmp = NULL; + int32_t code = nodesCloneNode(p->pColOnCond, &pTmp); + assert(pTmp); + assert(0 == jtMergeEqCond(&p->pFullOnCond, &pTmp)); +} + + + +void createColCond(SSortMergeJoinPhysiNode* p, int32_t cond) { + jtCtx.colCond = cond; + switch (cond) { + case TEST_NO_COND: + jtCtx.colEqNum = 0; + jtCtx.colOnNum = 0; + TAOS_MEMSET(jtCtx.colEqList, 0, sizeof(jtCtx.colEqList)); + TAOS_MEMSET(jtCtx.colOnList, 0, sizeof(jtCtx.colOnList)); + break; + case TEST_EQ_COND: + createColEqCondStart(p); + jtCtx.colOnNum = 0; + TAOS_MEMSET(jtCtx.colOnList, 0, sizeof(jtCtx.colOnList)); + break; + case TEST_ON_COND: + createColOnCondStart(p); + jtCtx.colEqNum = 0; + TAOS_MEMSET(jtCtx.colEqList, 0, sizeof(jtCtx.colEqList)); + break; + case TEST_FULL_COND: + createColEqCondStart(p); + createColOnCondStart(p); + break; + default: + break; + } +} + +void* getFilterValue(int32_t type) { + switch (type) { + case TSDB_DATA_TYPE_TIMESTAMP: + return &TIMESTAMP_FILTER_VALUE; + case TSDB_DATA_TYPE_INT: + return &INT_FILTER_VALUE; + case TSDB_DATA_TYPE_BIGINT: + return &BIGINT_FILTER_VALUE; + default: + return NULL; + } +} + +void createFilterStart(SSortMergeJoinPhysiNode* p, bool filter) { + jtCtx.filter = filter; + if (!filter) { + jtCtx.leftFilterNum = 0; + jtCtx.rightFilterNum = 0; + TAOS_MEMSET(jtCtx.leftFilterColList, 0, sizeof(jtCtx.leftFilterColList)); + TAOS_MEMSET(jtCtx.rightFilterColList, 0, sizeof(jtCtx.rightFilterColList)); + return; + } + + if ((JOIN_STYPE_SEMI == jtCtx.subType || JOIN_STYPE_ANTI == jtCtx.subType) && JOIN_TYPE_LEFT == jtCtx.joinType) { + jtCtx.rightFilterNum = 0; + jtCtx.leftFilterNum = taosRand() % (MAX_SLOT_NUM + 1); + if (0 == jtCtx.leftFilterNum) { + do { + jtCtx.leftFilterNum = taosRand() % (MAX_SLOT_NUM + 1); + } while (0 == jtCtx.leftFilterNum); + } + } else if ((JOIN_STYPE_SEMI == jtCtx.subType || JOIN_STYPE_ANTI == jtCtx.subType) && JOIN_TYPE_RIGHT == jtCtx.joinType) { + jtCtx.leftFilterNum = 0; + jtCtx.rightFilterNum = taosRand() % (MAX_SLOT_NUM + 1); + if (0 == jtCtx.rightFilterNum) { + do { + jtCtx.rightFilterNum = taosRand() % (MAX_SLOT_NUM + 1); + } while (0 == jtCtx.rightFilterNum); + } + } else { + jtCtx.leftFilterNum = taosRand() % (MAX_SLOT_NUM + 1); + if (0 == jtCtx.leftFilterNum) { + do { + jtCtx.rightFilterNum = taosRand() % (MAX_SLOT_NUM + 1); + } while (0 == jtCtx.rightFilterNum); + } else { + jtCtx.rightFilterNum = taosRand() % (MAX_SLOT_NUM + 1); + } + } + + int32_t idx = 0; + TAOS_MEMSET(jtCtx.leftFilterColList, 0, sizeof(jtCtx.leftFilterColList)); + TAOS_MEMSET(jtCtx.rightFilterColList, 0, sizeof(jtCtx.rightFilterColList)); + for (int32_t i = 0; i < jtCtx.leftFilterNum; ) { + idx = taosRand() % MAX_SLOT_NUM; + if (jtCtx.leftFilterColList[idx]) { + continue; + } + jtCtx.leftFilterColList[idx] = 1; + ++i; + } + + for (int32_t i = 0; i < jtCtx.rightFilterNum; ) { + idx = taosRand() % MAX_SLOT_NUM; + if (jtCtx.rightFilterColList[idx]) { + continue; + } + jtCtx.rightFilterColList[idx] = 1; + ++i; + } +} + +void createFilterEnd(SSortMergeJoinPhysiNode* p, bool filter) { + if (!filter || (jtCtx.leftFilterNum <= 0 && jtCtx.rightFilterNum <= 0)) { + return; + } + + SLogicConditionNode* pLogic = NULL; + if ((jtCtx.leftFilterNum + jtCtx.rightFilterNum) > 1) { + int32_t code = nodesMakeNode(QUERY_NODE_LOGIC_CONDITION, (SNode**)&pLogic); + assert(pLogic); + pLogic->node.resType.type = TSDB_DATA_TYPE_BOOL; + pLogic->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_BOOL].bytes; + pLogic->condType = LOGIC_COND_TYPE_AND; + } + + for (int32_t i = 0; i < MAX_SLOT_NUM; ++i) { + if (jtCtx.leftFilterColList[i]) { + SColumnNode* pCol = NULL; + int32_t code = nodesMakeNode(QUERY_NODE_COLUMN,(SNode**)&pCol); + assert(pCol); + pCol->dataBlockId = RES_BLK_ID; + pCol->slotId = getDstSlotId(i); + pCol->node.resType.type = jtInputColType[i]; + pCol->node.resType.bytes = tDataTypes[jtInputColType[i]].bytes; + (void)sprintf(pCol->colName, "l%d", i); + + SValueNode* pVal = NULL; + code = nodesMakeNode(QUERY_NODE_VALUE, (SNode**)&pVal); + assert(pVal); + pVal->node.resType.type = jtInputColType[i]; + pVal->node.resType.bytes = tDataTypes[jtInputColType[i]].bytes; + assert(0 == nodesSetValueNodeValue(pVal, getFilterValue(jtInputColType[i]))); + + SOperatorNode* pOp = NULL; + code = nodesMakeNode(QUERY_NODE_OPERATOR, (SNode**)&pOp); + assert(pOp); + pOp->opType = OP_TYPE_GREATER_THAN; + pOp->node.resType.type = TSDB_DATA_TYPE_BOOL; + pOp->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_BOOL].bytes; + pOp->pLeft = (SNode*)pCol; + pOp->pRight = (SNode*)pVal; + + if ((jtCtx.leftFilterNum + jtCtx.rightFilterNum) > 1) { + assert(0 == nodesListMakeStrictAppend(&pLogic->pParameterList, (SNode*)pOp)); + } else { + p->node.pConditions = (SNode*)pOp; + break; + } + } + } + + for (int32_t i = 0; i < MAX_SLOT_NUM; ++i) { + if (jtCtx.rightFilterColList[i]) { + SColumnNode* pCol = NULL; + int32_t code = nodesMakeNode(QUERY_NODE_COLUMN, (SNode**)&pCol); + assert(pCol); + pCol->dataBlockId = RES_BLK_ID; + pCol->slotId = getDstSlotId(MAX_SLOT_NUM + i); + pCol->node.resType.type = jtInputColType[i]; + pCol->node.resType.bytes = tDataTypes[jtInputColType[i]].bytes; + (void)sprintf(pCol->colName, "r%d", i); + + SValueNode* pVal = NULL; + code = nodesMakeNode(QUERY_NODE_VALUE, (SNode**)&pVal); + assert(pVal); + pVal->node.resType.type = jtInputColType[i]; + pVal->node.resType.bytes = tDataTypes[jtInputColType[i]].bytes; + assert(0 == nodesSetValueNodeValue(pVal, getFilterValue(jtInputColType[i]))); + + SOperatorNode* pOp = NULL; + code = nodesMakeNode(QUERY_NODE_OPERATOR, (SNode**)&pOp); + assert(pOp); + pOp->opType = OP_TYPE_GREATER_THAN; + pOp->node.resType.type = TSDB_DATA_TYPE_BOOL; + pOp->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_BOOL].bytes; + pOp->pLeft = (SNode*)pCol; + pOp->pRight = (SNode*)pVal; + + if ((jtCtx.leftFilterNum + jtCtx.rightFilterNum) > 1) { + assert(0 == nodesListMakeStrictAppend(&pLogic->pParameterList, (SNode*)pOp)); + } else { + p->node.pConditions = (SNode*)pOp; + break; + } + } + } + + if ((jtCtx.leftFilterNum + jtCtx.rightFilterNum) > 1) { + p->node.pConditions = (SNode*)pLogic; + } +} + + +void updateColRowInfo() { + jtCtx.blkRowSize = MAX_SLOT_NUM * sizeof(bool); + + for (int32_t i = 0; i < MAX_SLOT_NUM; ++i) { + jtCtx.colRowOffset[i] = jtCtx.blkRowSize; + jtCtx.blkRowSize += tDataTypes[jtInputColType[i]].bytes; + } +} + +void createBlockDescNode(SDataBlockDescNode** ppNode) { + SDataBlockDescNode* pDesc = NULL; + int32_t code = nodesMakeNode(QUERY_NODE_DATABLOCK_DESC, (SNode**)&pDesc); + assert(pDesc); + pDesc->dataBlockId = RES_BLK_ID; + pDesc->totalRowSize = jtCtx.resColSize - MAX_SLOT_NUM * 2 * sizeof(bool); + pDesc->outputRowSize = pDesc->totalRowSize; + for (int32_t i = 0; i < jtCtx.resColNum; ++i) { + SSlotDescNode* pSlot = NULL; + int32_t code = nodesMakeNode(QUERY_NODE_SLOT_DESC, (SNode**)&pSlot); + assert(pSlot); + pSlot->slotId = i; + int32_t slotIdx = jtCtx.resColInSlot[i] >= MAX_SLOT_NUM ? jtCtx.resColInSlot[i] - MAX_SLOT_NUM : jtCtx.resColInSlot[i]; + pSlot->dataType.type = jtInputColType[slotIdx]; + pSlot->dataType.bytes = tDataTypes[pSlot->dataType.type].bytes; + + assert(0 == nodesListMakeStrictAppend(&pDesc->pSlots, (SNode *)pSlot)); + } + + *ppNode = pDesc; +} + +SSortMergeJoinPhysiNode* createDummySortMergeJoinPhysiNode(SJoinTestParam* param) { + SSortMergeJoinPhysiNode* p = NULL; + int32_t code = nodesMakeNode(QUERY_NODE_PHYSICAL_PLAN_MERGE_JOIN, (SNode**)&p); + assert(p); + p->joinType = param->joinType; + p->subType = param->subType; + p->asofOpType = param->asofOp; + p->grpJoin = param->grpJoin; + if (p->subType == JOIN_STYPE_WIN || param->jLimit > 1 || taosRand() % 2) { + SLimitNode* limitNode = NULL; + code = nodesMakeNode(QUERY_NODE_LIMIT, (SNode**)&limitNode); + assert(limitNode); + limitNode->limit = param->jLimit; + p->pJLimit = (SNode*)limitNode; + } + + p->leftPrimSlotId = JT_PRIM_TS_SLOT_ID; + p->rightPrimSlotId = JT_PRIM_TS_SLOT_ID; + p->node.inputTsOrder = param->asc ? ORDER_ASC : ORDER_DESC; + if (JOIN_STYPE_WIN == p->subType) { + SWindowOffsetNode* pOffset = NULL; + code = nodesMakeNode(QUERY_NODE_WINDOW_OFFSET, (SNode**)&pOffset); + assert(pOffset); + SValueNode* pStart = NULL; + code = nodesMakeNode(QUERY_NODE_VALUE, (SNode**)&pStart); + assert(pStart); + SValueNode* pEnd = NULL; + code = nodesMakeNode(QUERY_NODE_VALUE, (SNode**)&pEnd); + assert(pEnd); + pStart->node.resType.type = TSDB_DATA_TYPE_BIGINT; + pStart->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_BIGINT].bytes; + pStart->datum.i = (taosRand() % 2) ? (((int32_t)-1) * (int64_t)(taosRand() % JT_MAX_WINDOW_OFFSET)) : (taosRand() % JT_MAX_WINDOW_OFFSET); + pEnd->node.resType.type = TSDB_DATA_TYPE_BIGINT; + pEnd->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_BIGINT].bytes; + pEnd->datum.i = (taosRand() % 2) ? (((int32_t)-1) * (int64_t)(taosRand() % JT_MAX_WINDOW_OFFSET)) : (taosRand() % JT_MAX_WINDOW_OFFSET); + if (pStart->datum.i > pEnd->datum.i) { + TSWAP(pStart->datum.i, pEnd->datum.i); + } + pOffset->pStartOffset = (SNode*)pStart; + pOffset->pEndOffset = (SNode*)pEnd; + p->pWindowOffset = (SNode*)pOffset; + + jtCtx.winStartOffset = pStart->datum.i; + jtCtx.winEndOffset = pEnd->datum.i; + } + + jtCtx.grpJoin = param->grpJoin; + jtCtx.joinType = param->joinType; + jtCtx.subType = param->subType; + jtCtx.asc = param->asc; + jtCtx.jLimit = param->jLimit; + jtCtx.asofOpType = param->asofOp; + jtCtx.leftColOnly = (JOIN_TYPE_LEFT == param->joinType && JOIN_STYPE_SEMI == param->subType); + jtCtx.rightColOnly = (JOIN_TYPE_RIGHT == param->joinType && JOIN_STYPE_SEMI == param->subType); + jtCtx.inGrpId = 1; + + createColCond(p, param->cond); + createFilterStart(p, param->filter); + createTargetSlotList(p); + createColEqCondEnd(p); + createColOnCondEnd(p); + createFilterEnd(p, param->filter); + updateColRowInfo(); + createBlockDescNode(&p->node.pOutputDataBlockDesc); + + return p; +} + +SExecTaskInfo* createDummyTaskInfo(char* taskId) { + SExecTaskInfo* p = (SExecTaskInfo*)taosMemoryCalloc(1, sizeof(SExecTaskInfo)); + assert(p); + p->id.str = taskId; + + return p; +} + +SSDataBlock* createDummyBlock(int32_t blkId) { + SSDataBlock* p = NULL; + int32_t code = createDataBlock(&p); + assert(code == 0); + + p->info.id.blockId = blkId; + p->info.type = STREAM_INVALID; + p->info.calWin.skey = INT64_MIN; + p->info.calWin.ekey = INT64_MAX; + p->info.watermark = INT64_MIN; + + for (int32_t i = 0; i < MAX_SLOT_NUM; ++i) { + SColumnInfoData idata = + createColumnInfoData(jtInputColType[i], tDataTypes[jtInputColType[i]].bytes, i); + + assert(0 == blockDataAppendColInfo(p, &idata)); + } + + return p; +} + +void appendAsofLeftEachResGrps(char* leftInRow, int32_t rightOffset, int32_t rightRows) { + TAOS_MEMSET(jtCtx.resColBuf, 0, jtCtx.resColSize); + for (int32_t c = 0; c < MAX_SLOT_NUM; ++c) { + if (!jtCtx.resColList[c]) { + continue; + } + + if (*((bool*)leftInRow + c)) { + *(char*)(jtCtx.resColBuf + c) = true; + } else { + TAOS_MEMCPY(jtCtx.resColBuf + jtCtx.resColOffset[c], leftInRow + jtCtx.inColOffset[c], tDataTypes[jtInputColType[c]].bytes); + } + } + + int32_t endIdx = TMIN(rightRows, taosArrayGetSize(jtCtx.rightRowsList) - rightOffset) + rightOffset; + for (int32_t r = rightOffset; r < endIdx; ++r) { + bool* rightFilterOut = (bool*)taosArrayGet(jtCtx.rightFilterOut, r); + if (*rightFilterOut) { + continue; + } + + char* rightResRows = (char*)taosArrayGet(jtCtx.rightRowsList, r); + for (int32_t c = 0; c < MAX_SLOT_NUM; ++c) { + if (jtCtx.resColList[MAX_SLOT_NUM + c]) { + if (*(bool*)(rightResRows + c)) { + *(bool*)(jtCtx.resColBuf + MAX_SLOT_NUM + c) = true; + TAOS_MEMSET(jtCtx.resColBuf + jtCtx.resColOffset[MAX_SLOT_NUM + c], 0, tDataTypes[jtInputColType[c]].bytes); + } else { + *(bool*)(jtCtx.resColBuf + MAX_SLOT_NUM + c) = false; + TAOS_MEMCPY(jtCtx.resColBuf + jtCtx.resColOffset[MAX_SLOT_NUM + c], rightResRows + jtCtx.inColOffset[c], tDataTypes[jtInputColType[c]].bytes); + } + } + } + + pushResRow(jtCtx.resColBuf, jtCtx.resColSize); + } +} + +void appendLeftNonMatchGrp(char* leftInRow) { + if (!jtCtrl.noKeepResRows) { + TAOS_MEMSET(jtCtx.resColBuf, 0, jtCtx.resColSize); + for (int32_t c = 0; c < MAX_SLOT_NUM; ++c) { + if (!jtCtx.resColList[c]) { + continue; + } + + if (*((bool*)leftInRow + c)) { + *(char*)(jtCtx.resColBuf + c) = true; + } else { + TAOS_MEMCPY(jtCtx.resColBuf + jtCtx.resColOffset[c], leftInRow + jtCtx.inColOffset[c], tDataTypes[jtInputColType[c]].bytes); + } + } + + for (int32_t c = 0; c < MAX_SLOT_NUM; ++c) { + if (jtCtx.resColList[MAX_SLOT_NUM + c]) { + *(char*)(jtCtx.resColBuf + MAX_SLOT_NUM + c) = true; + } + } + } + + pushResRow(jtCtx.resColBuf, jtCtx.resColSize); +} + +void appendAllAsofResRows() { + int32_t leftRows = taosArrayGetSize(jtCtx.leftRowsList); + int32_t rightRows = taosArrayGetSize(jtCtx.rightRowsList); + if (rightRows <= 0) { + if (0 == jtCtx.rightFilterNum) { + for (int32_t i = 0; i < leftRows; ++i) { + char* leftInRow = (char*)taosArrayGet(jtCtx.leftRowsList, i); + assert(leftInRow); + appendLeftNonMatchGrp(leftInRow); + } + } + } else { + assert(rightRows <= jtCtx.jLimit); + for (int32_t i = 0; i < leftRows; ++i) { + char* leftInRow = (char*)taosArrayGet(jtCtx.leftRowsList, i); + assert(leftInRow); + appendAsofLeftEachResGrps(leftInRow, 0, rightRows); + } + } + taosArrayClear(jtCtx.leftRowsList); +} + +void chkAppendAsofForwardGrpResRows(bool forceOut) { + int32_t rightRows = taosArrayGetSize(jtCtx.rightRowsList); + if (rightRows < jtCtx.jLimit && !forceOut) { + return; + } + + int32_t rightRemains = rightRows; + int32_t rightOffset = 0; + int32_t leftRows = taosArrayGetSize(jtCtx.leftRowsList); + int32_t i = 0; + for (; i < leftRows; ++i) { + char* leftRow = (char*)taosArrayGet(jtCtx.leftRowsList, i); + assert(leftRow); + int64_t* leftTs = (int64_t*)(leftRow + jtCtx.inColOffset[JT_PRIM_TS_SLOT_ID]); + bool append = false; + for (int32_t r = rightOffset; r < rightRows; ++r) { + char* rightRow = (char*)taosArrayGet(jtCtx.rightRowsList, r); + assert(rightRow); + int64_t* rightTs = (int64_t*)(rightRow + jtCtx.inColOffset[JT_PRIM_TS_SLOT_ID]); + if (((jtCtx.asc && *leftTs > *rightTs) || (!jtCtx.asc && *leftTs < *rightTs)) || (*leftTs == *rightTs && (OP_TYPE_LOWER_THAN == jtCtx.asofOpType || OP_TYPE_GREATER_THAN == jtCtx.asofOpType))) { + rightOffset++; + rightRemains--; + if (rightRemains < jtCtx.jLimit && !forceOut) { + taosArrayPopFrontBatch(jtCtx.rightRowsList, rightOffset); + taosArrayPopFrontBatch(jtCtx.rightFilterOut, rightOffset); + taosArrayPopFrontBatch(jtCtx.leftRowsList, i); + return; + } + + continue; + } + + appendAsofLeftEachResGrps(leftRow, rightOffset, jtCtx.jLimit); + append = true; + break; + } + + if (!append) { + if (!forceOut) { + break; + } + + if (0 == jtCtx.rightFilterNum) { + appendLeftNonMatchGrp(leftRow); + } + } + } + + taosArrayPopFrontBatch(jtCtx.rightRowsList, rightOffset); + taosArrayPopFrontBatch(jtCtx.rightFilterOut, rightOffset); + taosArrayPopFrontBatch(jtCtx.leftRowsList, i); +} + + +void appendWinEachResGrps(char* leftInRow, int32_t rightOffset, int32_t rightRows) { + if (rightOffset < 0) { + if (0 == jtCtx.rightFilterNum) { + appendLeftNonMatchGrp(leftInRow); + } + return; + } + + TAOS_MEMSET(jtCtx.resColBuf, 0, jtCtx.resColSize); + for (int32_t c = 0; c < MAX_SLOT_NUM; ++c) { + if (!jtCtx.resColList[c]) { + continue; + } + + if (*((bool*)leftInRow + c)) { + *(char*)(jtCtx.resColBuf + c) = true; + } else { + TAOS_MEMCPY(jtCtx.resColBuf + jtCtx.resColOffset[c], leftInRow + jtCtx.inColOffset[c], tDataTypes[jtInputColType[c]].bytes); + } + } + + int32_t endIdx = rightRows + rightOffset; + int32_t beginIdx = (!jtCtx.asc && rightRows > jtCtx.jLimit) ? (endIdx - jtCtx.jLimit) : rightOffset; + for (int32_t r = beginIdx; r < endIdx; ++r) { + bool* rightFilterOut = (bool*)taosArrayGet(jtCtx.rightFilterOut, r); + if (*rightFilterOut) { + continue; + } + + char* rightResRows = (char*)taosArrayGet(jtCtx.rightRowsList, r); + assert(rightResRows); + for (int32_t c = 0; c < MAX_SLOT_NUM; ++c) { + if (jtCtx.resColList[MAX_SLOT_NUM + c]) { + if (*(bool*)(rightResRows + c)) { + *(bool*)(jtCtx.resColBuf + MAX_SLOT_NUM + c) = true; + TAOS_MEMSET(jtCtx.resColBuf + jtCtx.resColOffset[MAX_SLOT_NUM + c], 0, tDataTypes[jtInputColType[c]].bytes); + } else { + *(bool*)(jtCtx.resColBuf + MAX_SLOT_NUM + c) = false; + TAOS_MEMCPY(jtCtx.resColBuf + jtCtx.resColOffset[MAX_SLOT_NUM + c], rightResRows + jtCtx.inColOffset[c], tDataTypes[jtInputColType[c]].bytes); + } + } + } + + pushResRow(jtCtx.resColBuf, jtCtx.resColSize); + } +} + +void chkAppendWinResRows(bool forceOut) { + int32_t rightRows = taosArrayGetSize(jtCtx.rightRowsList); + if (rightRows < jtCtx.jLimit && !forceOut) { + return; + } + + int32_t rightRemains = rightRows; + int32_t rightOffset = 0; + int32_t leftRows = taosArrayGetSize(jtCtx.leftRowsList); + int32_t i = 0; + for (; i < leftRows; ++i) { + char* leftRow = (char*)taosArrayGet(jtCtx.leftRowsList, i); + assert(leftRow); + int64_t* leftTs = (int64_t*)(leftRow + jtCtx.inColOffset[JT_PRIM_TS_SLOT_ID]); + int64_t winStart = *leftTs + jtCtx.winStartOffset; + int64_t winEnd = *leftTs + jtCtx.winEndOffset; + int32_t winBeginIdx = -1; + bool append = false; + bool winClosed = false; + for (int32_t r = rightOffset; r < rightRows; ++r) { + char* rightRow = (char*)taosArrayGet(jtCtx.rightRowsList, r); + assert(rightRow); + int64_t* rightTs = (int64_t*)(rightRow + jtCtx.inColOffset[JT_PRIM_TS_SLOT_ID]); + if ((jtCtx.asc && *rightTs < winStart) || (!jtCtx.asc && *rightTs > winEnd)) { + rightOffset++; + rightRemains--; + if (rightRemains < jtCtx.jLimit && !forceOut) { + taosArrayPopFrontBatch(jtCtx.rightRowsList, rightOffset); + taosArrayPopFrontBatch(jtCtx.rightFilterOut, rightOffset); + taosArrayPopFrontBatch(jtCtx.leftRowsList, i); + return; + } + + continue; + } else if ((jtCtx.asc && *rightTs > winEnd) || (!jtCtx.asc && *rightTs < winStart)) { + winClosed = true; + appendWinEachResGrps(leftRow, winBeginIdx, r - winBeginIdx); + append = true; + break; + } + + if (-1 == winBeginIdx) { + winBeginIdx = r; + } + + if (jtCtx.asc && (r - winBeginIdx + 1) >= jtCtx.jLimit) { + appendWinEachResGrps(leftRow, winBeginIdx, jtCtx.jLimit); + append = true; + break; + } + } + + if (!append) { + if (!forceOut) { + break; + } + + if (winBeginIdx >= 0) { + appendWinEachResGrps(leftRow, winBeginIdx, rightRows - winBeginIdx); + } else if (0 == jtCtx.rightFilterNum) { + appendLeftNonMatchGrp(leftRow); + } + } + } + + taosArrayPopFrontBatch(jtCtx.rightRowsList, rightOffset); + taosArrayPopFrontBatch(jtCtx.rightFilterOut, rightOffset); + taosArrayPopFrontBatch(jtCtx.leftRowsList, i); +} + + +void trimForAsofJlimit() { + int32_t rowNum = taosArrayGetSize(jtCtx.rightRowsList); + if (rowNum <= jtCtx.jLimit) { + return; + } + + taosArrayPopFrontBatch(jtCtx.rightRowsList, rowNum - jtCtx.jLimit); + taosArrayPopFrontBatch(jtCtx.rightFilterOut, rowNum - jtCtx.jLimit); +} + +void createGrpRows(SSDataBlock** ppBlk, int32_t blkId, int32_t grpRows) { + if (grpRows <= 0) { + return; + } + + if (NULL == *ppBlk) { + *ppBlk = createDummyBlock((blkId == LEFT_BLK_ID) ? LEFT_BLK_ID : RIGHT_BLK_ID); + assert(*ppBlk); + assert(0 == blockDataEnsureCapacity(*ppBlk, jtCtx.blkRows)); + assert(NULL != taosArrayPush((blkId == LEFT_BLK_ID) ? jtCtx.leftBlkList : jtCtx.rightBlkList, ppBlk)); + } + + if (jtCtx.grpJoin) { + (*ppBlk)->info.id.groupId = jtCtx.inGrpId; + } + + jtCtx.inputStat |= (1 << blkId); + + SArray* pTableRows = NULL; + int32_t tableOffset = 0; + int32_t peerOffset = 0; + bool keepRes = false; + bool keepInput = false; + if (blkId == LEFT_BLK_ID) { + if ((jtCtx.joinType == JOIN_TYPE_LEFT || jtCtx.joinType == JOIN_TYPE_FULL) && (jtCtx.subType != JOIN_STYPE_SEMI && jtCtx.subType != JOIN_STYPE_ASOF && jtCtx.subType != JOIN_STYPE_WIN)) { + keepRes = true; + } + peerOffset = MAX_SLOT_NUM; + } else { + if ((jtCtx.joinType == JOIN_TYPE_RIGHT || jtCtx.joinType == JOIN_TYPE_FULL) && (jtCtx.subType != JOIN_STYPE_SEMI && jtCtx.subType != JOIN_STYPE_ASOF && jtCtx.subType != JOIN_STYPE_WIN)) { + keepRes = true; + } + tableOffset = MAX_SLOT_NUM; + } + + if (JOIN_STYPE_ASOF == jtCtx.subType) { + keepInput = jtCtx.asofOpType != OP_TYPE_EQUAL ? true : (blkId == LEFT_BLK_ID); + pTableRows = (blkId == LEFT_BLK_ID) ? jtCtx.leftRowsList : jtCtx.rightRowsList; + } else if (JOIN_STYPE_WIN == jtCtx.subType) { + keepInput = true; + pTableRows = (blkId == LEFT_BLK_ID) ? jtCtx.leftRowsList : jtCtx.rightRowsList; + } + + int32_t filterNum = (blkId == LEFT_BLK_ID) ? jtCtx.leftFilterNum : jtCtx.rightFilterNum; + int32_t peerFilterNum = (blkId == LEFT_BLK_ID) ? jtCtx.rightFilterNum : jtCtx.leftFilterNum; + int32_t* filterCol = (blkId == LEFT_BLK_ID) ? jtCtx.leftFilterColList : jtCtx.rightFilterColList; + + char* pData = NULL; + int32_t tmpInt = 0; + int64_t tmpBigint = 0; + bool isNull = false; + bool filterOut = false; + bool addToRowList = false; + int32_t vRange = TMAX(grpRows / 3, 3); + for (int32_t c = 0; c < MAX_SLOT_NUM; ++c) { + jtCtx.grpOffset[c] = c * TMAX(100, grpRows); + } + + for (int32_t i = 0; i < grpRows; ++i) { + if ((*ppBlk)->info.rows >= (*ppBlk)->info.capacity) { + *ppBlk = createDummyBlock((blkId == LEFT_BLK_ID) ? LEFT_BLK_ID : RIGHT_BLK_ID); + assert(*ppBlk); + assert(0 == blockDataEnsureCapacity(*ppBlk, jtCtx.blkRows)); + assert(NULL != taosArrayPush((blkId == LEFT_BLK_ID) ? jtCtx.leftBlkList : jtCtx.rightBlkList, ppBlk)); + if (jtCtx.grpJoin) { + (*ppBlk)->info.id.groupId = jtCtx.inGrpId; + } + } + + filterOut = (peerFilterNum > 0 && (jtCtx.subType != JOIN_STYPE_ASOF && jtCtx.subType != JOIN_STYPE_WIN)) ? true : false; + if (!filterOut) { + TAOS_MEMSET(jtCtx.resColBuf, 0, jtCtx.resColSize); + if (keepInput) { + TAOS_MEMSET(jtCtx.inColBuf, 0, jtCtx.inColSize); + } + } + + addToRowList = true; + + for (int32_t c = 0; c < MAX_SLOT_NUM; ++c) { + switch (jtInputColType[c]) { + case TSDB_DATA_TYPE_TIMESTAMP: + jtCtx.asc ? ++jtCtx.curTs : --jtCtx.curTs; + pData = (char*)&jtCtx.curTs; + isNull = false; + if (!filterOut && filterNum && filterCol[c] && jtCtx.curTs <= TIMESTAMP_FILTER_VALUE) { + filterOut = true; + } + break; + case TSDB_DATA_TYPE_INT: + if (taosRand() % 10) { + tmpInt = (taosRand() % 2) ? INT_FILTER_VALUE + jtCtx.grpOffset[c] + taosRand() % vRange : INT_FILTER_VALUE - jtCtx.grpOffset[c] - taosRand() % vRange; + pData = (char*)&tmpInt; + isNull = false; + if (!filterOut && filterNum && filterCol[c] && tmpInt <= INT_FILTER_VALUE) { + filterOut = true; + } + } else { + isNull = true; + if (filterNum && filterCol[c]) { + filterOut = true; + } + } + break; + case TSDB_DATA_TYPE_BIGINT: + tmpBigint = (taosRand() % 2) ? BIGINT_FILTER_VALUE + jtCtx.curKeyOffset++ : BIGINT_FILTER_VALUE - jtCtx.curKeyOffset++; + pData = (char*)&tmpBigint; + isNull = false; + if (!filterOut && filterNum && filterCol[c] && tmpBigint <= BIGINT_FILTER_VALUE) { + filterOut = true; + } + break; + default: + break; + } + + SColumnInfoData* pCol = (SColumnInfoData*)taosArrayGet((*ppBlk)->pDataBlock, c); + assert(pCol); + assert(0 == colDataSetVal(pCol, (*ppBlk)->info.rows, pData, isNull)); + + if (keepInput) { + if (!filterOut || (blkId != LEFT_BLK_ID)) { + if (isNull) { + *(char*)(jtCtx.inColBuf + c) = true; + } else { + TAOS_MEMCPY(jtCtx.inColBuf + jtCtx.inColOffset[c], pData, tDataTypes[jtInputColType[c]].bytes); + } + } else { + addToRowList = false; + } + } else if (keepRes && !filterOut && jtCtx.resColList[tableOffset + c]) { + if (isNull) { + *(char*)(jtCtx.resColBuf + tableOffset + c) = true; + } else { + TAOS_MEMCPY(jtCtx.resColBuf + jtCtx.resColOffset[tableOffset + c], pData, tDataTypes[jtInputColType[c]].bytes); + } + } + } + + if (keepInput && addToRowList) { + assert(NULL != taosArrayPush(pTableRows, jtCtx.inColBuf)); + if (blkId == RIGHT_BLK_ID) { + bool fout = filterOut ? true : false; + assert(NULL != taosArrayPush(jtCtx.rightFilterOut, &fout)); + } + } + + if (keepRes && !filterOut) { + for (int32_t c = 0; c < MAX_SLOT_NUM; ++c) { + if (jtCtx.resColList[peerOffset + c]) { + *(char*)(jtCtx.resColBuf + peerOffset + c) = true; + } + } + + pushResRow(jtCtx.resColBuf, jtCtx.resColSize); + } + + (*ppBlk)->info.rows++; + } + + if (keepInput) { + if (JOIN_STYPE_ASOF == jtCtx.subType) { + if (((jtCtx.asc && (jtCtx.asofOpType == OP_TYPE_GREATER_EQUAL || jtCtx.asofOpType == OP_TYPE_GREATER_THAN)) || (!jtCtx.asc && (jtCtx.asofOpType == OP_TYPE_LOWER_EQUAL || jtCtx.asofOpType == OP_TYPE_LOWER_THAN)) ) || jtCtx.asofOpType == OP_TYPE_EQUAL) { + if (blkId == LEFT_BLK_ID) { + appendAllAsofResRows(); + } else { + trimForAsofJlimit(); + } + } else { + chkAppendAsofForwardGrpResRows(false); + } + } else { + chkAppendWinResRows(false); + } + } + +} + +void createRowData(SSDataBlock* pBlk, int64_t tbOffset, int32_t rowIdx, int32_t vRange) { + int32_t tmpInt = 0; + int64_t tmpBig = 0; + + for (int32_t c = 0; c < MAX_SLOT_NUM; ++c) { + SColumnInfoData* pCol = (SColumnInfoData*)taosArrayGet(pBlk->pDataBlock, c); + assert(pCol); + + int32_t rv = taosRand() % 10; + switch (jtInputColType[c]) { + case TSDB_DATA_TYPE_TIMESTAMP: + *(int64_t*)(jtCtx.colRowDataBuf + tbOffset + rowIdx * jtCtx.blkRowSize + jtCtx.colRowOffset[c]) = jtCtx.curTs; + assert(0 == colDataSetVal(pCol, pBlk->info.rows, (char*)&jtCtx.curTs, false)); + break; + case TSDB_DATA_TYPE_INT: + if (rv) { + tmpInt = (taosRand() % 2) ? INT_FILTER_VALUE + jtCtx.grpOffset[c] + taosRand() % vRange : INT_FILTER_VALUE - taosRand() % vRange; + *(int32_t*)(jtCtx.colRowDataBuf + tbOffset + rowIdx * jtCtx.blkRowSize + jtCtx.colRowOffset[c]) = tmpInt; + assert(0 == colDataSetVal(pCol, pBlk->info.rows, (char*)&tmpInt, false)); + } else { + *(bool*)(jtCtx.colRowDataBuf + tbOffset + rowIdx * jtCtx.blkRowSize + c) = true; + assert(0 == colDataSetVal(pCol, pBlk->info.rows, NULL, true)); + } + break; + case TSDB_DATA_TYPE_BIGINT: + tmpBig = (taosRand() % 2) ? BIGINT_FILTER_VALUE + jtCtx.curKeyOffset++ : BIGINT_FILTER_VALUE - jtCtx.curKeyOffset++; + *(int64_t*)(jtCtx.colRowDataBuf + tbOffset + rowIdx * jtCtx.blkRowSize + jtCtx.colRowOffset[c]) = tmpBig; + assert(0 == colDataSetVal(pCol, pBlk->info.rows, (char*)&tmpBig, false)); + break; + default: + break; + } + } + + pBlk->info.rows++; +} + +void makeAppendBlkData(SSDataBlock** ppLeft, SSDataBlock** ppRight, int32_t leftGrpRows, int32_t rightGrpRows) { + int64_t totalSize = (leftGrpRows + rightGrpRows) * jtCtx.blkRowSize; + int64_t rightOffset = leftGrpRows * jtCtx.blkRowSize; + + if (jtCtx.colRowDataBufSize < totalSize) { + jtCtx.colRowDataBuf = (char*)taosMemoryRealloc(jtCtx.colRowDataBuf, totalSize); + assert(jtCtx.colRowDataBuf); + } + + TAOS_MEMSET(jtCtx.colRowDataBuf, 0, totalSize); + + for (int32_t c = 0; c < MAX_SLOT_NUM; ++c) { + jtCtx.grpOffset[c] = c * TMAX(leftGrpRows, rightGrpRows); + } + + int32_t vRange = TMAX(leftGrpRows / 100, 3); + for (int32_t i = 0; i < leftGrpRows; ++i) { + if ((*ppLeft)->info.rows >= (*ppLeft)->info.capacity) { + *ppLeft = createDummyBlock(LEFT_BLK_ID); + assert(*ppLeft); + assert(0 == blockDataEnsureCapacity(*ppLeft, jtCtx.blkRows)); + assert(NULL != taosArrayPush(jtCtx.leftBlkList, ppLeft)); + if (jtCtx.grpJoin) { + (*ppLeft)->info.id.groupId = jtCtx.inGrpId; + } + } + + createRowData(*ppLeft, 0, i, vRange); + } + + vRange = TMAX(rightGrpRows / 100, 3); + for (int32_t i = 0; i < rightGrpRows; ++i) { + if ((*ppRight)->info.rows >= (*ppRight)->info.capacity) { + *ppRight = createDummyBlock(RIGHT_BLK_ID); + assert(*ppRight); + assert(0 == blockDataEnsureCapacity(*ppRight, jtCtx.blkRows)); + assert(NULL != taosArrayPush(jtCtx.rightBlkList, ppRight)); + if (jtCtx.grpJoin) { + (*ppRight)->info.id.groupId = jtCtx.inGrpId; + } + } + + createRowData(*ppRight, rightOffset, i, vRange); + } + +} + +void putNMatchRowToRes(char* lrow, int32_t tableOffset, int32_t peerOffset) { + if (!jtCtrl.noKeepResRows) { + TAOS_MEMSET(jtCtx.resColBuf, 0, jtCtx.resColSize); + + for (int32_t c = 0; c < MAX_SLOT_NUM; ++c) { + if (jtCtx.resColList[tableOffset + c]) { + if (*(bool*)(lrow + c)) { + *(bool*)(jtCtx.resColBuf + tableOffset + c) = true; + } else { + TAOS_MEMCPY(jtCtx.resColBuf + jtCtx.resColOffset[tableOffset + c], lrow + jtCtx.colRowOffset[c], tDataTypes[jtInputColType[c]].bytes); + } + } + } + + for (int32_t c = 0; c < MAX_SLOT_NUM; ++c) { + if (jtCtx.resColList[peerOffset + c]) { + *(bool*)(jtCtx.resColBuf + peerOffset + c) = true; + } + } + } + + pushResRow(jtCtx.resColBuf, jtCtx.resColSize); +} + +void putMatchRowToRes(char* lrow, char* rrow, int32_t cols) { + if (!jtCtrl.noKeepResRows) { + TAOS_MEMSET(jtCtx.resColBuf, 0, jtCtx.resColSize); + + if (cols & LEFT_TABLE_COLS) { + for (int32_t c = 0; c < MAX_SLOT_NUM; ++c) { + if (jtCtx.resColList[c]) { + if (*(bool*)(lrow + c)) { + *(bool*)(jtCtx.resColBuf + c) = true; + } else { + TAOS_MEMCPY(jtCtx.resColBuf + jtCtx.resColOffset[c], lrow + jtCtx.colRowOffset[c], tDataTypes[jtInputColType[c]].bytes); + } + } + } + } + + if (cols & RIGHT_TABLE_COLS) { + for (int32_t c = 0; c < MAX_SLOT_NUM; ++c) { + if (jtCtx.resColList[MAX_SLOT_NUM + c]) { + if (*(bool*)(rrow + c)) { + *(bool*)(jtCtx.resColBuf + MAX_SLOT_NUM + c) = true; + } else { + TAOS_MEMCPY(jtCtx.resColBuf + jtCtx.resColOffset[MAX_SLOT_NUM + c], rrow + jtCtx.colRowOffset[c], tDataTypes[jtInputColType[c]].bytes); + } + } + } + } + } + + pushResRow(jtCtx.resColBuf, jtCtx.resColSize); +} + + + +void innerJoinAppendEqGrpRes(int32_t leftGrpRows, int32_t rightGrpRows) { + bool leftMatch = false, rightMatch = false, filterOut = false; + void* lValue = NULL, *rValue = NULL, *filterValue = NULL; + int64_t lBig = 0, rBig = 0, fbig = 0; + int64_t rightTbOffset = jtCtx.blkRowSize * leftGrpRows; + + for (int32_t l = 0; l < leftGrpRows; ++l) { + char* lrow = jtCtx.colRowDataBuf + jtCtx.blkRowSize * l; + + filterOut = false; + leftMatch = true; + + for (int32_t c = 0; c < MAX_SLOT_NUM; ++c) { + lValue = lrow + jtCtx.colRowOffset[c]; + switch (jtInputColType[c]) { + case TSDB_DATA_TYPE_TIMESTAMP: + fbig = TIMESTAMP_FILTER_VALUE; + lBig = *(int64_t*)lValue; + break; + case TSDB_DATA_TYPE_INT: + fbig = INT_FILTER_VALUE; + lBig = *(int32_t*)lValue; + break; + case TSDB_DATA_TYPE_BIGINT: + fbig = BIGINT_FILTER_VALUE; + lBig = *(int64_t*)lValue; + break; + default: + break; + } + + if (jtCtx.leftFilterNum && jtCtx.leftFilterColList[c] && ((*(bool*)(lrow + c)) || lBig <= fbig)) { + filterOut = true; + break; + } + + if (jtCtx.colEqNum && jtCtx.colEqList[c] && (*(bool*)(lrow + c))) { + leftMatch = false; + break; + } + + if (jtCtx.colOnNum && jtCtx.colOnList[c] && (*(bool*)(lrow + c))) { + leftMatch = false; + break; + } + } + + if (filterOut || !leftMatch) { + continue; + } + + for (int32_t r = 0; r < rightGrpRows; ++r) { + char* rrow = jtCtx.colRowDataBuf + rightTbOffset + jtCtx.blkRowSize * r; + rightMatch = true; + filterOut = false; + + for (int32_t c = 0; c < MAX_SLOT_NUM; ++c) { + lValue = lrow + jtCtx.colRowOffset[c]; + + if (!*(bool*)(rrow + c)) { + rValue = rrow + jtCtx.colRowOffset[c]; + } + + switch (jtInputColType[c]) { + case TSDB_DATA_TYPE_TIMESTAMP: + fbig = TIMESTAMP_FILTER_VALUE; + lBig = *(int64_t*)lValue; + rBig = *(int64_t*)rValue; + break; + case TSDB_DATA_TYPE_INT: + fbig = INT_FILTER_VALUE; + lBig = *(int32_t*)lValue; + rBig = *(int32_t*)rValue; + break; + case TSDB_DATA_TYPE_BIGINT: + fbig = BIGINT_FILTER_VALUE; + lBig = *(int64_t*)lValue; + rBig = *(int64_t*)rValue; + break; + default: + break; + } + + if (jtCtx.colEqNum && jtCtx.colEqList[c] && ((*(bool*)(rrow + c)) || lBig != rBig)) { + rightMatch = false; + break; + } + + if (jtCtx.colOnNum && jtCtx.colOnList[c] && ((*(bool*)(rrow + c)) || lBig <= rBig)) { + rightMatch = false; + break; + } + + if (jtCtx.rightFilterNum && jtCtx.rightFilterColList[c] && ((*(bool*)(rrow + c)) || rBig <= fbig)) { + filterOut = true; + break; + } + } + + if (filterOut || !rightMatch) { + continue; + } + + putMatchRowToRes(lrow, rrow, ALL_TABLE_COLS); + } + } + + +} + + + +void leftJoinAppendEqGrpRes(int32_t leftGrpRows, int32_t rightGrpRows) { + bool leftMatch = false, rightMatch = false, filterOut = false; + void* lValue = NULL, *rValue = NULL, *filterValue = NULL; + int64_t lBig = 0, rBig = 0, fbig = 0; + int64_t rightTbOffset = jtCtx.blkRowSize * leftGrpRows; + + for (int32_t l = 0; l < leftGrpRows; ++l) { + char* lrow = jtCtx.colRowDataBuf + jtCtx.blkRowSize * l; + + filterOut = false; + leftMatch = true; + + for (int32_t c = 0; c < MAX_SLOT_NUM; ++c) { + lValue = lrow + jtCtx.colRowOffset[c]; + switch (jtInputColType[c]) { + case TSDB_DATA_TYPE_TIMESTAMP: + fbig = TIMESTAMP_FILTER_VALUE; + lBig = *(int64_t*)lValue; + break; + case TSDB_DATA_TYPE_INT: + fbig = INT_FILTER_VALUE; + lBig = *(int32_t*)lValue; + break; + case TSDB_DATA_TYPE_BIGINT: + fbig = BIGINT_FILTER_VALUE; + lBig = *(int64_t*)lValue; + break; + default: + break; + } + + if (jtCtx.leftFilterNum && jtCtx.leftFilterColList[c] && ((*(bool*)(lrow + c)) || lBig <= fbig)) { + filterOut = true; + break; + } + + if (jtCtx.colEqNum && jtCtx.colEqList[c] && (*(bool*)(lrow + c))) { + leftMatch = false; + } + + if (jtCtx.colOnNum && jtCtx.colOnList[c] && (*(bool*)(lrow + c))) { + leftMatch = false; + } + } + + if (filterOut) { + continue; + } + + if (false == leftMatch) { + if (0 == jtCtx.rightFilterNum) { + putNMatchRowToRes(lrow, 0, MAX_SLOT_NUM); + } + continue; + } + + leftMatch = false; + for (int32_t r = 0; r < rightGrpRows; ++r) { + char* rrow = jtCtx.colRowDataBuf + rightTbOffset + jtCtx.blkRowSize * r; + rightMatch = true; + filterOut = false; + + for (int32_t c = 0; c < MAX_SLOT_NUM; ++c) { + lValue = lrow + jtCtx.colRowOffset[c]; + + if (!*(bool*)(rrow + c)) { + rValue = rrow + jtCtx.colRowOffset[c]; + } + + switch (jtInputColType[c]) { + case TSDB_DATA_TYPE_TIMESTAMP: + fbig = TIMESTAMP_FILTER_VALUE; + lBig = *(int64_t*)lValue; + rBig = *(int64_t*)rValue; + break; + case TSDB_DATA_TYPE_INT: + fbig = INT_FILTER_VALUE; + lBig = *(int32_t*)lValue; + rBig = *(int32_t*)rValue; + break; + case TSDB_DATA_TYPE_BIGINT: + fbig = BIGINT_FILTER_VALUE; + lBig = *(int64_t*)lValue; + rBig = *(int64_t*)rValue; + break; + default: + break; + } + + if (jtCtx.colEqNum && jtCtx.colEqList[c] && ((*(bool*)(rrow + c)) || lBig != rBig)) { + rightMatch = false; + break; + } + + if (jtCtx.colOnNum && jtCtx.colOnList[c] && ((*(bool*)(rrow + c)) || lBig <= rBig)) { + rightMatch = false; + break; + } + + if (jtCtx.rightFilterNum && jtCtx.rightFilterColList[c] && ((*(bool*)(rrow + c)) || rBig <= fbig)) { + filterOut = true; + } + } + + if (rightMatch) { + leftMatch = true; + } + + if (filterOut) { + continue; + } + + if (rightMatch) { + putMatchRowToRes(lrow, rrow, ALL_TABLE_COLS); + } + } + + if (!leftMatch && 0 == jtCtx.rightFilterNum) { + putNMatchRowToRes(lrow, 0, MAX_SLOT_NUM); + } + } + + +} + + + +void semiJoinAppendEqGrpRes(int32_t leftGrpRows, int32_t rightGrpRows) { + bool leftMatch = false, rightMatch = false, filterOut = false; + void* lValue = NULL, *rValue = NULL, *filterValue = NULL; + int64_t lBig = 0, rBig = 0, fbig = 0; + int64_t leftTbOffset = 0; + int64_t rightTbOffset = jtCtx.blkRowSize * leftGrpRows; + char* rrow = NULL; + + for (int32_t l = 0; l < leftGrpRows; ++l) { + char* lrow = jtCtx.colRowDataBuf + leftTbOffset + jtCtx.blkRowSize * l; + + filterOut = false; + leftMatch = true; + + for (int32_t c = 0; c < MAX_SLOT_NUM; ++c) { + lValue = lrow + jtCtx.colRowOffset[c]; + switch (jtInputColType[c]) { + case TSDB_DATA_TYPE_TIMESTAMP: + fbig = TIMESTAMP_FILTER_VALUE; + lBig = *(int64_t*)lValue; + break; + case TSDB_DATA_TYPE_INT: + fbig = INT_FILTER_VALUE; + lBig = *(int32_t*)lValue; + break; + case TSDB_DATA_TYPE_BIGINT: + fbig = BIGINT_FILTER_VALUE; + lBig = *(int64_t*)lValue; + break; + default: + break; + } + + if (jtCtx.leftFilterNum && jtCtx.leftFilterColList[c] && ((*(bool*)(lrow + c)) || lBig <= fbig)) { + filterOut = true; + break; + } + + if (jtCtx.colEqNum && jtCtx.colEqList[c] && (*(bool*)(lrow + c))) { + leftMatch = false; + break; + } + + if (jtCtx.colOnNum && jtCtx.colOnList[c] && (*(bool*)(lrow + c))) { + leftMatch = false; + break; + } + } + + if (filterOut || !leftMatch) { + continue; + } + + for (int32_t r = 0; r < rightGrpRows; ++r) { + rrow = jtCtx.colRowDataBuf + rightTbOffset + jtCtx.blkRowSize * r; + rightMatch = true; + filterOut = false; + + for (int32_t c = 0; c < MAX_SLOT_NUM; ++c) { + lValue = lrow + jtCtx.colRowOffset[c]; + + if (!*(bool*)(rrow + c)) { + rValue = rrow + jtCtx.colRowOffset[c]; + } + + switch (jtInputColType[c]) { + case TSDB_DATA_TYPE_TIMESTAMP: + fbig = TIMESTAMP_FILTER_VALUE; + lBig = *(int64_t*)lValue; + rBig = *(int64_t*)rValue; + break; + case TSDB_DATA_TYPE_INT: + fbig = INT_FILTER_VALUE; + lBig = *(int32_t*)lValue; + rBig = *(int32_t*)rValue; + break; + case TSDB_DATA_TYPE_BIGINT: + fbig = BIGINT_FILTER_VALUE; + lBig = *(int64_t*)lValue; + rBig = *(int64_t*)rValue; + break; + default: + break; + } + + if (jtCtx.colEqNum && jtCtx.colEqList[c] && ((*(bool*)(rrow + c)) || lBig != rBig)) { + rightMatch = false; + break; + } + + if (jtCtx.colOnNum && jtCtx.colOnList[c] && ((*(bool*)(rrow + c)) || lBig <= rBig)) { + rightMatch = false; + break; + } + + if (jtCtx.rightFilterNum && jtCtx.rightFilterColList[c] && ((*(bool*)(rrow + c)) || rBig <= fbig)) { + filterOut = true; + break; + } + } + + if (filterOut || !rightMatch) { + continue; + } + + break; + } + + if (!filterOut && rightMatch) { + putMatchRowToRes(lrow, rrow, LEFT_TABLE_COLS); + } + } + + +} + + + + +void antiJoinAppendEqGrpRes(int32_t leftGrpRows, int32_t rightGrpRows) { + bool leftMatch = false, rightMatch = false, filterOut = false; + void* lValue = NULL, *rValue = NULL, *filterValue = NULL; + int64_t lBig = 0, rBig = 0, fbig = 0; + int64_t rightTbOffset = jtCtx.blkRowSize * leftGrpRows; + + assert(0 == jtCtx.rightFilterNum); + + for (int32_t l = 0; l < leftGrpRows; ++l) { + char* lrow = jtCtx.colRowDataBuf + jtCtx.blkRowSize * l; + + filterOut = false; + leftMatch = true; + + for (int32_t c = 0; c < MAX_SLOT_NUM; ++c) { + lValue = lrow + jtCtx.colRowOffset[c]; + switch (jtInputColType[c]) { + case TSDB_DATA_TYPE_TIMESTAMP: + fbig = TIMESTAMP_FILTER_VALUE; + lBig = *(int64_t*)lValue; + break; + case TSDB_DATA_TYPE_INT: + fbig = INT_FILTER_VALUE; + lBig = *(int32_t*)lValue; + break; + case TSDB_DATA_TYPE_BIGINT: + fbig = BIGINT_FILTER_VALUE; + lBig = *(int64_t*)lValue; + break; + default: + break; + } + + if (jtCtx.leftFilterNum && jtCtx.leftFilterColList[c] && ((*(bool*)(lrow + c)) || lBig <= fbig)) { + filterOut = true; + break; + } + + if (jtCtx.colEqNum && jtCtx.colEqList[c] && (*(bool*)(lrow + c))) { + leftMatch = false; + } + + if (jtCtx.colOnNum && jtCtx.colOnList[c] && (*(bool*)(lrow + c))) { + leftMatch = false; + } + } + + if (filterOut) { + continue; + } + + if (false == leftMatch) { + putNMatchRowToRes(lrow, 0, MAX_SLOT_NUM); + continue; + } + + leftMatch = false; + for (int32_t r = 0; r < rightGrpRows; ++r) { + char* rrow = jtCtx.colRowDataBuf + rightTbOffset + jtCtx.blkRowSize * r; + rightMatch = true; + + for (int32_t c = 0; c < MAX_SLOT_NUM; ++c) { + lValue = lrow + jtCtx.colRowOffset[c]; + + if (!*(bool*)(rrow + c)) { + rValue = rrow + jtCtx.colRowOffset[c]; + } + + switch (jtInputColType[c]) { + case TSDB_DATA_TYPE_TIMESTAMP: + fbig = TIMESTAMP_FILTER_VALUE; + lBig = *(int64_t*)lValue; + rBig = *(int64_t*)rValue; + break; + case TSDB_DATA_TYPE_INT: + fbig = INT_FILTER_VALUE; + lBig = *(int32_t*)lValue; + rBig = *(int32_t*)rValue; + break; + case TSDB_DATA_TYPE_BIGINT: + fbig = BIGINT_FILTER_VALUE; + lBig = *(int64_t*)lValue; + rBig = *(int64_t*)rValue; + break; + default: + break; + } + + if (jtCtx.colEqNum && jtCtx.colEqList[c] && ((*(bool*)(rrow + c)) || lBig != rBig)) { + rightMatch = false; + break; + } + + if (jtCtx.colOnNum && jtCtx.colOnList[c] && ((*(bool*)(rrow + c)) || lBig <= rBig)) { + rightMatch = false; + break; + } + } + + if (rightMatch) { + leftMatch = true; + break; + } + } + + if (!leftMatch) { + putNMatchRowToRes(lrow, 0, MAX_SLOT_NUM); + } + } + + +} + +void addAsofEqInRows(int32_t rowsNum, int64_t tbOffset, bool leftTable) { + bool filterOut = false; + void* cvalue = NULL; + int64_t cbig = 0, fbig = 0; + int32_t filterNum = leftTable ? jtCtx.leftFilterNum : jtCtx.rightFilterNum; + int32_t* filterCol = leftTable ? jtCtx.leftFilterColList : jtCtx.rightFilterColList; + SArray* rowList = leftTable ? jtCtx.leftRowsList : jtCtx.rightRowsList; + + if (!leftTable) { + rowsNum = TMIN(rowsNum, jtCtx.jLimit); + } + + for (int32_t l = 0; l < rowsNum; ++l) { + char* row = jtCtx.colRowDataBuf + tbOffset + jtCtx.blkRowSize * l; + + filterOut = false; + + for (int32_t c = 0; c < MAX_SLOT_NUM; ++c) { + cvalue = row + jtCtx.colRowOffset[c]; + switch (jtInputColType[c]) { + case TSDB_DATA_TYPE_TIMESTAMP: + fbig = TIMESTAMP_FILTER_VALUE; + cbig = *(int64_t*)cvalue; + break; + case TSDB_DATA_TYPE_INT: + fbig = INT_FILTER_VALUE; + cbig = *(int32_t*)cvalue; + break; + case TSDB_DATA_TYPE_BIGINT: + fbig = BIGINT_FILTER_VALUE; + cbig = *(int64_t*)cvalue; + break; + default: + break; + } + + if (filterNum && filterCol[c] && ((*(bool*)(row + c)) || cbig <= fbig)) { + filterOut = true; + break; + } + } + + if (filterOut && leftTable) { + continue; + } + + assert(NULL != taosArrayPush(rowList, row)); + if (!leftTable) { + assert(NULL != taosArrayPush(jtCtx.rightFilterOut, &filterOut)); + } + } + + if (!leftTable && ((jtCtx.asc && (jtCtx.asofOpType == OP_TYPE_GREATER_EQUAL || jtCtx.asofOpType == OP_TYPE_GREATER_THAN)) || (!jtCtx.asc && (jtCtx.asofOpType == OP_TYPE_LOWER_EQUAL || jtCtx.asofOpType == OP_TYPE_LOWER_THAN))) || jtCtx.asofOpType == OP_TYPE_EQUAL) { + trimForAsofJlimit(); + } +} + +void asofJoinAppendEqGrpRes(int32_t leftGrpRows, int32_t rightGrpRows) { + int64_t rightTbOffset = jtCtx.blkRowSize * leftGrpRows; + + if (jtCtx.asc) { + switch (jtCtx.asofOpType) { + case OP_TYPE_GREATER_THAN: + addAsofEqInRows(leftGrpRows, 0, true); + appendAllAsofResRows(); + addAsofEqInRows(rightGrpRows, rightTbOffset, false); + break; + case OP_TYPE_GREATER_EQUAL: + addAsofEqInRows(leftGrpRows, 0, true); + addAsofEqInRows(rightGrpRows, rightTbOffset, false); + appendAllAsofResRows(); + break; + case OP_TYPE_LOWER_THAN: + case OP_TYPE_LOWER_EQUAL: + addAsofEqInRows(leftGrpRows, 0, true); + addAsofEqInRows(rightGrpRows, rightTbOffset, false); + chkAppendAsofForwardGrpResRows(false); + break; + case OP_TYPE_EQUAL: + taosArrayClear(jtCtx.leftRowsList); + taosArrayClear(jtCtx.rightRowsList); + taosArrayClear(jtCtx.rightFilterOut); + addAsofEqInRows(leftGrpRows, 0, true); + addAsofEqInRows(rightGrpRows, rightTbOffset, false); + chkAppendAsofForwardGrpResRows(true); + taosArrayClear(jtCtx.leftRowsList); + taosArrayClear(jtCtx.rightRowsList); + taosArrayClear(jtCtx.rightFilterOut); + break; + default: + return; + } + + return; + } + + switch (jtCtx.asofOpType) { + case OP_TYPE_LOWER_THAN: + addAsofEqInRows(leftGrpRows, 0, true); + appendAllAsofResRows(); + addAsofEqInRows(rightGrpRows, rightTbOffset, false); + break; + case OP_TYPE_LOWER_EQUAL: + addAsofEqInRows(leftGrpRows, 0, true); + addAsofEqInRows(rightGrpRows, rightTbOffset, false); + appendAllAsofResRows(); + break; + case OP_TYPE_GREATER_THAN: + case OP_TYPE_GREATER_EQUAL: + addAsofEqInRows(leftGrpRows, 0, true); + addAsofEqInRows(rightGrpRows, rightTbOffset, false); + chkAppendAsofForwardGrpResRows(false); + break; + case OP_TYPE_EQUAL: + taosArrayClear(jtCtx.leftRowsList); + taosArrayClear(jtCtx.rightRowsList); + taosArrayClear(jtCtx.rightFilterOut); + addAsofEqInRows(leftGrpRows, 0, true); + addAsofEqInRows(rightGrpRows, rightTbOffset, false); + chkAppendAsofForwardGrpResRows(true); + taosArrayClear(jtCtx.leftRowsList); + taosArrayClear(jtCtx.rightRowsList); + taosArrayClear(jtCtx.rightFilterOut); + break; + default: + return; + } +} + + +void addWinEqInRows(int32_t rowsNum, int64_t tbOffset, bool leftTable) { + bool filterOut = false; + void* cvalue = NULL; + int64_t cbig = 0, fbig = 0; + int32_t filterNum = leftTable ? jtCtx.leftFilterNum : jtCtx.rightFilterNum; + int32_t* filterCol = leftTable ? jtCtx.leftFilterColList : jtCtx.rightFilterColList; + SArray* rowList = leftTable ? jtCtx.leftRowsList : jtCtx.rightRowsList; + + for (int32_t l = 0; l < rowsNum; ++l) { + char* row = jtCtx.colRowDataBuf + tbOffset + jtCtx.blkRowSize * l; + + filterOut = false; + + for (int32_t c = 0; c < MAX_SLOT_NUM; ++c) { + cvalue = row + jtCtx.colRowOffset[c]; + switch (jtInputColType[c]) { + case TSDB_DATA_TYPE_TIMESTAMP: + fbig = TIMESTAMP_FILTER_VALUE; + cbig = *(int64_t*)cvalue; + break; + case TSDB_DATA_TYPE_INT: + fbig = INT_FILTER_VALUE; + cbig = *(int32_t*)cvalue; + break; + case TSDB_DATA_TYPE_BIGINT: + fbig = BIGINT_FILTER_VALUE; + cbig = *(int64_t*)cvalue; + break; + default: + break; + } + + if (filterNum && filterCol[c] && ((*(bool*)(row + c)) || cbig <= fbig)) { + filterOut = true; + break; + } + } + + if (filterOut && leftTable) { + continue; + } + + assert(NULL != taosArrayPush(rowList, row)); + if (!leftTable) { + assert(NULL != taosArrayPush(jtCtx.rightFilterOut, &filterOut)); + } + } +} + + +void winJoinAppendEqGrpRes(int32_t leftGrpRows, int32_t rightGrpRows) { + int64_t rightTbOffset = jtCtx.blkRowSize * leftGrpRows; + + addWinEqInRows(leftGrpRows, 0, true); + addWinEqInRows(rightGrpRows, rightTbOffset, false); + chkAppendWinResRows(false); +} + + + +void fullJoinAppendEqGrpRes(int32_t leftGrpRows, int32_t rightGrpRows) { + bool leftMatch = false, rightMatch = false, lfilterOut = false, rfilterOut = false; + void* lValue = NULL, *rValue = NULL, *filterValue = NULL; + int64_t lBig = 0, rBig = 0, fbig = 0; + int64_t rightTbOffset = jtCtx.blkRowSize * leftGrpRows; + + TAOS_MEMSET(jtCtx.rightFinMatch, 0, rightGrpRows * sizeof(bool)); + + for (int32_t l = 0; l < leftGrpRows; ++l) { + char* lrow = jtCtx.colRowDataBuf + jtCtx.blkRowSize * l; + + lfilterOut = false; + leftMatch = false; + + for (int32_t c = 0; c < MAX_SLOT_NUM; ++c) { + lValue = lrow + jtCtx.colRowOffset[c]; + switch (jtInputColType[c]) { + case TSDB_DATA_TYPE_TIMESTAMP: + fbig = TIMESTAMP_FILTER_VALUE; + lBig = *(int64_t*)lValue; + break; + case TSDB_DATA_TYPE_INT: + fbig = INT_FILTER_VALUE; + lBig = *(int32_t*)lValue; + break; + case TSDB_DATA_TYPE_BIGINT: + fbig = BIGINT_FILTER_VALUE; + lBig = *(int64_t*)lValue; + break; + default: + break; + } + + if (jtCtx.leftFilterNum && jtCtx.leftFilterColList[c] && ((*(bool*)(lrow + c)) || lBig <= fbig)) { + lfilterOut = true; + } + } + + for (int32_t r = 0; r < rightGrpRows; ++r) { + char* rrow = jtCtx.colRowDataBuf + rightTbOffset + jtCtx.blkRowSize * r; + rightMatch = true; + rfilterOut = false; + + for (int32_t c = 0; c < MAX_SLOT_NUM; ++c) { + lValue = lrow + jtCtx.colRowOffset[c]; + + if (!*(bool*)(rrow + c)) { + rValue = rrow + jtCtx.colRowOffset[c]; + } + + switch (jtInputColType[c]) { + case TSDB_DATA_TYPE_TIMESTAMP: + fbig = TIMESTAMP_FILTER_VALUE; + lBig = *(int64_t*)lValue; + rBig = *(int64_t*)rValue; + break; + case TSDB_DATA_TYPE_INT: + fbig = INT_FILTER_VALUE; + lBig = *(int32_t*)lValue; + rBig = *(int32_t*)rValue; + break; + case TSDB_DATA_TYPE_BIGINT: + fbig = BIGINT_FILTER_VALUE; + lBig = *(int64_t*)lValue; + rBig = *(int64_t*)rValue; + break; + default: + break; + } + + if (jtCtx.colEqNum && jtCtx.colEqList[c] && ((*(bool*)(lrow + c)) || (*(bool*)(rrow + c)) || lBig != rBig)) { + rightMatch = false; + } + + if (jtCtx.colOnNum && jtCtx.colOnList[c] && ((*(bool*)(lrow + c)) || (*(bool*)(rrow + c)) || lBig <= rBig)) { + rightMatch = false; + } + + if (jtCtx.rightFilterNum && jtCtx.rightFilterColList[c] && ((*(bool*)(rrow + c)) || rBig <= fbig)) { + rfilterOut = true; + } + } + + if (rightMatch) { + jtCtx.rightFinMatch[r] = true; + } + + if (rfilterOut) { + if (!rightMatch) { + jtCtx.rightFinMatch[r] = true; + } + continue; + } + + if (!lfilterOut && rightMatch) { + putMatchRowToRes(lrow, rrow, ALL_TABLE_COLS); + leftMatch= true; + } + } + + if (!lfilterOut && !leftMatch && 0 == jtCtx.rightFilterNum) { + putNMatchRowToRes(lrow, 0, MAX_SLOT_NUM); + } + } + + if (0 == jtCtx.leftFilterNum) { + for (int32_t r = 0; r < rightGrpRows; ++r) { + if (!jtCtx.rightFinMatch[r]) { + char* rrow = jtCtx.colRowDataBuf + rightTbOffset + jtCtx.blkRowSize * r; + putNMatchRowToRes(rrow, MAX_SLOT_NUM, 0); + } + } + } +} + + +void appendEqGrpRes(int32_t leftGrpRows, int32_t rightGrpRows) { + switch (jtCtx.joinType) { + case JOIN_TYPE_INNER: + innerJoinAppendEqGrpRes(leftGrpRows, rightGrpRows); + break; + case JOIN_TYPE_LEFT: { + switch (jtCtx.subType) { + case JOIN_STYPE_OUTER: + leftJoinAppendEqGrpRes(leftGrpRows, rightGrpRows); + break; + case JOIN_STYPE_SEMI: + semiJoinAppendEqGrpRes(leftGrpRows, rightGrpRows); + break; + case JOIN_STYPE_ANTI: + antiJoinAppendEqGrpRes(leftGrpRows, rightGrpRows); + break; + case JOIN_STYPE_ASOF: + asofJoinAppendEqGrpRes(leftGrpRows, rightGrpRows); + break; + case JOIN_STYPE_WIN: + winJoinAppendEqGrpRes(leftGrpRows, rightGrpRows); + break; + default: + break; + } + break; + } + case JOIN_TYPE_FULL: + fullJoinAppendEqGrpRes(leftGrpRows, rightGrpRows); + break; + default: + break; + } +} + +void createTsEqGrpRows(SSDataBlock** ppLeft, SSDataBlock** ppRight, int32_t leftGrpRows, int32_t rightGrpRows) { + if (leftGrpRows <= 0 && rightGrpRows <= 0) { + return; + } + + if (leftGrpRows > 0 && rightGrpRows > 0) { + jtCtx.inputStat |= (1 << 2); + } + + jtCtx.asc ? ++jtCtx.curTs : --jtCtx.curTs; + + if (NULL == *ppLeft && leftGrpRows > 0) { + *ppLeft = createDummyBlock(LEFT_BLK_ID); + assert(*ppLeft); + assert(0 == blockDataEnsureCapacity(*ppLeft, jtCtx.blkRows)); + assert(NULL != taosArrayPush(jtCtx.leftBlkList, ppLeft)); + } + + if (jtCtx.grpJoin) { + (*ppLeft)->info.id.groupId = jtCtx.inGrpId; + } + + if (NULL == *ppRight && rightGrpRows > 0) { + *ppRight = createDummyBlock(RIGHT_BLK_ID); + assert(*ppRight); + assert(0 == blockDataEnsureCapacity(*ppRight, jtCtx.blkRows)); + assert(NULL != taosArrayPush(jtCtx.rightBlkList, ppRight)); + } + + if (jtCtx.grpJoin) { + (*ppRight)->info.id.groupId = jtCtx.inGrpId; + } + + + makeAppendBlkData(ppLeft, ppRight, leftGrpRows, rightGrpRows); + + appendEqGrpRes(leftGrpRows, rightGrpRows); +} + +void forceFlushResRows() { + if (JOIN_STYPE_ASOF == jtCtx.subType && taosArrayGetSize(jtCtx.leftRowsList) > 0) { + assert((jtCtx.asc && (OP_TYPE_LOWER_EQUAL == jtCtx.asofOpType || OP_TYPE_LOWER_THAN == jtCtx.asofOpType)) + || (!jtCtx.asc && (OP_TYPE_GREATER_EQUAL == jtCtx.asofOpType || OP_TYPE_GREATER_THAN == jtCtx.asofOpType))); + chkAppendAsofForwardGrpResRows(true); + } else if (JOIN_STYPE_WIN == jtCtx.subType && taosArrayGetSize(jtCtx.leftRowsList) > 0) { + chkAppendWinResRows(true); + } + + taosArrayClear(jtCtx.rightRowsList); + taosArrayClear(jtCtx.rightFilterOut); + taosArrayClear(jtCtx.leftRowsList); + +} + +void createBothBlkRowsData(void) { + SSDataBlock* pLeft = NULL; + SSDataBlock* pRight = NULL; + + jtCtx.leftTotalRows = taosRand() % jtCtx.leftMaxRows; + jtCtx.rightTotalRows = taosRand() % jtCtx.rightMaxRows; + + int32_t minTotalRows = TMIN(jtCtx.leftTotalRows, jtCtx.rightTotalRows); + int32_t maxTotalRows = TMAX(jtCtx.leftTotalRows, jtCtx.rightTotalRows); + jtCtx.curTs = jtCtx.asc ? (TIMESTAMP_FILTER_VALUE - minTotalRows / 5) : (TIMESTAMP_FILTER_VALUE + 4 * maxTotalRows / 5); + + int32_t leftTotalRows = 0, rightTotalRows = 0; + int32_t leftGrpRows = 0, rightGrpRows = 0; + int32_t grpType = 0; + while (leftTotalRows < jtCtx.leftTotalRows || rightTotalRows < jtCtx.rightTotalRows) { + if (leftTotalRows >= jtCtx.leftTotalRows) { + grpType = 1; + } else if (rightTotalRows >= jtCtx.rightTotalRows) { + grpType = 0; + } else { + grpType = taosRand() % 10; + } + + leftGrpRows = taosRand() % jtCtx.leftMaxGrpRows; + rightGrpRows = taosRand() % jtCtx.rightMaxGrpRows; + + if ((leftTotalRows + leftGrpRows) > jtCtx.leftTotalRows) { + leftGrpRows = jtCtx.leftTotalRows - leftTotalRows; + } + + if ((rightTotalRows + rightGrpRows) > jtCtx.rightTotalRows) { + rightGrpRows = jtCtx.rightTotalRows - rightTotalRows; + } + + if (0 != grpType && 1 != grpType && (leftGrpRows <= 0 || rightGrpRows <= 0)) { + if (leftGrpRows <= 0) { + grpType = 1; + } else { + grpType = 0; + } + } + + if (jtCtx.grpJoin && (0 == taosRand() % 3)) { + forceFlushResRows(); + jtCtx.inGrpId++; + pLeft = NULL; + pRight = NULL; + } + + switch (grpType) { + case 0: + createGrpRows(&pLeft, LEFT_BLK_ID, leftGrpRows); + leftTotalRows += leftGrpRows; + break; + case 1: + createGrpRows(&pRight, RIGHT_BLK_ID, rightGrpRows); + rightTotalRows += rightGrpRows; + break; + default: + createTsEqGrpRows(&pLeft, &pRight, leftGrpRows, rightGrpRows); + leftTotalRows += leftGrpRows; + rightTotalRows += rightGrpRows; + break; + } + } + + forceFlushResRows(); +} + +void createDummyBlkList(int32_t leftMaxRows, int32_t leftMaxGrpRows, int32_t rightMaxRows, int32_t rightMaxGrpRows, int32_t blkRows) { + jtCtx.leftMaxRows = leftMaxRows; + jtCtx.leftMaxGrpRows = leftMaxGrpRows; + jtCtx.rightMaxRows = rightMaxRows; + jtCtx.rightMaxGrpRows = rightMaxGrpRows; + jtCtx.blkRows = blkRows; + + int32_t maxGrpRows = TMAX(leftMaxGrpRows, rightMaxGrpRows); + if (maxGrpRows > jtCtx.rightFinMatchNum) { + jtCtx.rightFinMatchNum = maxGrpRows; + jtCtx.rightFinMatch = (bool*)taosMemoryRealloc(jtCtx.rightFinMatch, maxGrpRows * sizeof(bool)); + assert(jtCtx.rightFinMatch); + } + + taosArrayClear(jtCtx.leftRowsList); + taosArrayClear(jtCtx.rightRowsList); + taosArrayClear(jtCtx.rightFilterOut); + + createBothBlkRowsData(); +} + +void rerunBlockedHere() { + while (jtInRerun) { + taosSsleep(1); + } +} + + +SSDataBlock* getDummyInputBlock(struct SOperatorInfo* pOperator, int32_t idx) { + switch (idx) { + case LEFT_BLK_ID: + if (jtCtx.leftBlkReadIdx >= taosArrayGetSize(jtCtx.leftBlkList)) { + return NULL; + } + return (SSDataBlock*)taosArrayGetP(jtCtx.leftBlkList, jtCtx.leftBlkReadIdx++); + break; + case RIGHT_BLK_ID: + if (jtCtx.rightBlkReadIdx >= taosArrayGetSize(jtCtx.rightBlkList)) { + return NULL; + } + return (SSDataBlock*)taosArrayGetP(jtCtx.rightBlkList, jtCtx.rightBlkReadIdx++); + break; + default: + return NULL; + } +} + + +void joinTestReplaceRetrieveFp() { + static Stub stub; + stub.set(getNextBlockFromDownstreamRemain, getDummyInputBlock); + { +#ifdef WINDOWS + AddrAny any; + std::map result; + any.get_func_addr("getNextBlockFromDownstreamRemain", result); + for (const auto &f : result) { + stub.set(f.second, getDummyInputBlock); + } +#endif +#ifdef LINUX + AddrAny any("libexecutor.so"); + std::map result; + any.get_global_func_addr_dynsym("^getNextBlockFromDownstreamRemain$", result); + for (const auto &f : result) { + stub.set(f.second, getDummyInputBlock); + } +#endif + } +} + +void printColList(char* title, bool left, int32_t* colList, bool filter, char* opStr) { + bool first = true; + + JT_PRINTF("\t %s:", title); + for (int32_t i = 0; i < MAX_SLOT_NUM; ++i) { + if (colList[i]) { + if (!first) { + JT_PRINTF(" AND "); + } + first = false; + if (filter) { + JT_PRINTF("%sc%d%s%" PRId64 , left ? "l" : "r", i, opStr, jtFilterValue[i]); + } else { + JT_PRINTF("lc%d%src%d", i, opStr, i); + } + } + } + JT_PRINTF("\n"); +} + +void printInputRowData(SSDataBlock* pBlk, int32_t* rowIdx) { + if (jtCtx.grpJoin) { + JT_PRINTF("%5" PRIu64, pBlk->info.id.groupId); + } + for (int32_t c = 0; c < MAX_SLOT_NUM; ++c) { + SColumnInfoData* pCol = (SColumnInfoData*)taosArrayGet(pBlk->pDataBlock, c); + assert(pCol); + assert(pCol->info.type == jtInputColType[c]); + if (colDataIsNull_s(pCol, *rowIdx)) { + JT_PRINTF("%18s", " NULL"); + } else { + switch (jtInputColType[c]) { + case TSDB_DATA_TYPE_TIMESTAMP: + case TSDB_DATA_TYPE_BIGINT: + JT_PRINTF("%18" PRId64, *(int64_t*)colDataGetData(pCol, *rowIdx)); + break; + case TSDB_DATA_TYPE_INT: + JT_PRINTF("%18d", *(int32_t*)colDataGetData(pCol, *rowIdx)); + break; + default: + assert(0); + } + } + } + + (*rowIdx)++; +} + +void printInputData() { + int32_t leftRowIdx = 0, rightRowIdx = 0; + + JT_PRINTF("\nInput Data:\n"); + while (jtCtx.leftBlkReadIdx < taosArrayGetSize(jtCtx.leftBlkList) || jtCtx.rightBlkReadIdx < taosArrayGetSize(jtCtx.rightBlkList)) { + if (jtCtx.leftBlkReadIdx < taosArrayGetSize(jtCtx.leftBlkList)) { + while (true) { + SSDataBlock* pBlk = (SSDataBlock*)taosArrayGetP(jtCtx.leftBlkList, jtCtx.leftBlkReadIdx); + assert(pBlk); + if (leftRowIdx < pBlk->info.rows) { + printInputRowData(pBlk, &leftRowIdx); + break; + } + + JT_PRINTF("\t%*s-------------------------blk end-------------------------------", jtCtx.grpJoin ? 6 : 0, " "); + jtCtx.leftBlkReadIdx++; + leftRowIdx = 0; + break; + } + } else { + JT_PRINTF("%*s", jtCtx.grpJoin ? 77 : 72, " "); + } + + if (jtCtx.rightBlkReadIdx < taosArrayGetSize(jtCtx.rightBlkList)) { + while (true) { + SSDataBlock* pBlk = (SSDataBlock*)taosArrayGetP(jtCtx.rightBlkList, jtCtx.rightBlkReadIdx); + assert(pBlk); + if (rightRowIdx < pBlk->info.rows) { + printInputRowData(pBlk, &rightRowIdx); + break; + } + + JT_PRINTF("\t%*s--------------------------blk end----------------------------\t", jtCtx.grpJoin ? 6 : 0, " "); + jtCtx.rightBlkReadIdx++; + rightRowIdx = 0; + break; + } + } + + JT_PRINTF("\n"); + } + + jtCtx.leftBlkReadIdx = jtCtx.rightBlkReadIdx = 0; +} + +char* getInputStatStr(char* inputStat) { + if (jtCtx.inputStat & (1 << LEFT_BLK_ID)) { + TAOS_STRCAT(inputStat, "L"); + } + if (jtCtx.inputStat & (1 << RIGHT_BLK_ID)) { + TAOS_STRCAT(inputStat, "R"); + } + if (jtCtx.inputStat & (1 << 2)) { + TAOS_STRCAT(inputStat, "E"); + } + return inputStat; +} + +char* getAsofOpStr() { + switch (jtCtx.asofOpType) { + case OP_TYPE_GREATER_THAN: + return ">"; + case OP_TYPE_GREATER_EQUAL: + return ">="; + case OP_TYPE_LOWER_THAN: + return "<"; + case OP_TYPE_LOWER_EQUAL: + return "<="; + case OP_TYPE_EQUAL: + return "="; + default: + return "UNKNOWN"; + } +} + +void printBasicInfo(char* caseName) { + if (!jtCtrl.printTestInfo) { + return; + } + + char inputStat[4] = {0}; + JT_PRINTF("\n%dth TEST [%s] START\nBasic Info:\n\t asc:%d\n\t filter:%d\n\t maxRows:left-%d right-%d\n\t " + "maxGrpRows:left-%d right-%d\n\t blkRows:%d\n\t colCond:%s\n\t joinType:%s\n\t " + "subType:%s\n\t inputStat:%s\n\t groupJoin:%s\n", jtCtx.loopIdx, caseName, jtCtx.asc, jtCtx.filter, jtCtx.leftMaxRows, jtCtx.rightMaxRows, + jtCtx.leftMaxGrpRows, jtCtx.rightMaxGrpRows, jtCtx.blkRows, jtColCondStr[jtCtx.colCond], jtJoinTypeStr[jtCtx.joinType], + jtSubTypeStr[jtCtx.subType], getInputStatStr(inputStat), jtCtx.grpJoin ? "true" : "false"); + + if (JOIN_STYPE_ASOF == jtCtx.subType) { + JT_PRINTF("\t asofOp:%s\n\t JLimit:%" PRId64 "\n", getAsofOpStr(), jtCtx.jLimit); + } else if (JOIN_STYPE_WIN == jtCtx.subType) { + JT_PRINTF("\t windowOffset:[%" PRId64 ", %" PRId64 "]\n\t JLimit:%" PRId64 "\n", jtCtx.winStartOffset, jtCtx.winEndOffset, jtCtx.jLimit); + } + + JT_PRINTF("Input Info:\n\t totalBlk:left-%d right-%d\n\t totalRows:left-%d right-%d\n\t " + "blkRowSize:%d\n\t inputCols:left-%s %s %s %s right-%s %s %s %s\n", + (int32_t)taosArrayGetSize(jtCtx.leftBlkList), (int32_t)taosArrayGetSize(jtCtx.rightBlkList), + jtCtx.leftTotalRows, jtCtx.rightTotalRows, + jtCtx.blkRowSize, tDataTypes[jtInputColType[0]].name, tDataTypes[jtInputColType[1]].name, + tDataTypes[jtInputColType[2]].name, tDataTypes[jtInputColType[3]].name, tDataTypes[jtInputColType[0]].name, + tDataTypes[jtInputColType[1]].name, tDataTypes[jtInputColType[2]].name, tDataTypes[jtInputColType[3]].name); + + if (jtCtx.colEqNum) { + JT_PRINTF("\t colEqNum:%d\n", jtCtx.colEqNum); + printColList("colEqList", false, jtCtx.colEqList, false, "="); + } + + if (jtCtx.colOnNum) { + JT_PRINTF("\t colOnNum:%d\n", jtCtx.colOnNum); + printColList("colOnList", false, jtCtx.colOnList, false, ">"); + } + + if (jtCtx.leftFilterNum) { + JT_PRINTF("\t leftFilterNum:%d\n", jtCtx.leftFilterNum); + printColList("leftFilterList", true, jtCtx.leftFilterColList, true, ">"); + } + + if (jtCtx.rightFilterNum) { + JT_PRINTF("\t rightFilterNum:%d\n", jtCtx.rightFilterNum); + printColList("rightFilterList", false, jtCtx.rightFilterColList, true, ">"); + } + + JT_PRINTF("\t resColSize:%d\n\t resColNum:%d\n\t resColList:", jtCtx.resColSize, jtCtx.resColNum); + for (int32_t i = 0; i < jtCtx.resColNum; ++i) { + int32_t s = jtCtx.resColInSlot[i]; + int32_t idx = s >= MAX_SLOT_NUM ? s - MAX_SLOT_NUM : s; + JT_PRINTF("%sc%d[%s]\t", s >= MAX_SLOT_NUM ? "r" : "l", s, tDataTypes[jtInputColType[idx]].name); + } + + if (jtCtrl.printInputRow) { + printInputData(); + } +} + +void printOutputInfo() { + if (!jtCtrl.printTestInfo) { + return; + } + + JT_PRINTF("\nOutput Info:\n\t expectedRows:%d\n\t ", jtCtx.resRows); + JT_PRINTF("Actual Result:\n"); +} + +void printActualResInfo() { + if (!jtCtrl.printTestInfo) { + return; + } + + JT_PRINTF("Actual Result Summary:\n\t blkNum:%d\n\t rowNum:%d%s\n\t leftBlkRead:%d\n\t rightBlkRead:%d\n\t +rows:%d%s\n\t " + "-rows:%d%s\n\t matchRows:%d%s\n\t executionTime:%" PRId64 "us\n", + jtRes.blkNum, jtRes.rowNum, + jtRes.rowNum == jtCtx.resRows ? "" : "*", + jtCtx.leftBlkReadIdx, jtCtx.rightBlkReadIdx, + jtRes.addRowNum, jtRes.addRowNum ? "*" : "", + jtRes.subRowNum, jtRes.subRowNum ? "*" : "", + jtRes.matchNum, jtRes.matchNum == jtCtx.resRows ? "" : "*", + taosGetTimestampUs() - jtCtx.startTsUs); +} + +void printStatInfo(char* caseName) { + JT_PRINTF("\n TEST [%s] Stat:\n\t maxResRows:%d\n\t maxResBlkRows:%d\n\t totalResRows:%" PRId64 "\n\t useMSecs:%" PRId64 "\n", + caseName, jtStat.maxResRows, jtStat.maxResBlkRows, jtStat.totalResRows, jtStat.useMSecs); + +} + +void checkJoinDone(char* caseName) { + int32_t iter = 0; + void* p = NULL; + void* key = NULL; + if (!jtCtrl.noKeepResRows) { + while (NULL != (p = tSimpleHashIterate(jtCtx.jtResRows, p, &iter))) { + key = tSimpleHashGetKey(p, NULL); + jtRes.succeed = false; + jtRes.subRowNum += *(int32_t*)p; + for (int32_t i = 0; i < *(int32_t*)p; ++i) { + printResRow((char*)key, 0); + } + } + } + + printActualResInfo(); + + JT_PRINTF("\n%dth TEST [%s] Final Result: %s\n", jtCtx.loopIdx, caseName, jtRes.succeed ? "SUCCEED" : "FAILED"); +} + +void putRowToResColBuf(SSDataBlock* pBlock, int32_t r, bool ignoreTbCols) { + for (int32_t c = 0; c < jtCtx.resColNum; ++c) { + int32_t slot = jtCtx.resColInSlot[c]; + if (ignoreTbCols && ((jtCtx.leftColOnly && slot >= MAX_SLOT_NUM) || + (jtCtx.rightColOnly && slot < MAX_SLOT_NUM))) { + continue; + } + + SColumnInfoData* pCol = (SColumnInfoData*)taosArrayGet(pBlock->pDataBlock, c); + assert(pCol); + switch (jtInputColType[slot % MAX_SLOT_NUM]) { + case TSDB_DATA_TYPE_TIMESTAMP: + case TSDB_DATA_TYPE_BIGINT: + if (colDataIsNull_s(pCol, r)) { + *(bool*)(jtCtx.resColBuf + slot) = true; + } else { + *(int64_t*)(jtCtx.resColBuf + jtCtx.resColOffset[slot]) = *(int64_t*)colDataGetData(pCol, r); + } + break; + case TSDB_DATA_TYPE_INT: + if (colDataIsNull_s(pCol, r)) { + *(bool*)(jtCtx.resColBuf + slot) = true; + } else { + *(int32_t*)(jtCtx.resColBuf + jtCtx.resColOffset[slot]) = *(int32_t*)colDataGetData(pCol, r); + } + break; + default: + break; + } + } +} + +void checkJoinRes(SSDataBlock* pBlock) { + jtRes.rowNum += pBlock->info.rows; + if (jtRes.rowNum > jtStat.maxResRows) { + jtStat.maxResRows = jtRes.rowNum; + } + jtRes.blkNum++; + + if (pBlock->info.rows > jtStat.maxResBlkRows) { + jtStat.maxResBlkRows = pBlock->info.rows; + } + + jtStat.totalResRows += pBlock->info.rows; + if (jtCtrl.noKeepResRows) { + jtRes.matchNum += pBlock->info.rows; + } else { + for (int32_t r = 0; r < pBlock->info.rows; ++r) { + TAOS_MEMSET(jtCtx.resColBuf, 0, jtCtx.resColSize); + + putRowToResColBuf(pBlock, r, true); + + char* value = (char*)tSimpleHashGet(jtCtx.jtResRows, jtCtx.resColBuf, jtCtx.resColSize); + if (NULL == value) { + putRowToResColBuf(pBlock, r, false); + printResRow(jtCtx.resColBuf, 1); + jtRes.succeed = false; + jtRes.addRowNum++; + continue; + } + + rmResRow(); + + putRowToResColBuf(pBlock, r, false); + printResRow(jtCtx.resColBuf, 2); + jtRes.matchNum++; + } + } +} + +void resetForJoinRerun(int32_t dsNum, SSortMergeJoinPhysiNode* pNode, SExecTaskInfo* pTask) { + jtCtx.leftBlkReadIdx = 0; + jtCtx.rightBlkReadIdx = 0; + jtCtx.curKeyOffset = 0; + + TAOS_MEMSET(&jtRes, 0, sizeof(jtRes)); + jtRes.succeed = true; + + SOperatorInfo* pDownstreams[2]; + createDummyDownstreamOperators(2, pDownstreams); + SOperatorInfo* ppDownstreams[] = {pDownstreams[0], pDownstreams[1]}; + int32_t code = createMergeJoinOperatorInfo(ppDownstreams, 2, pNode, pTask, &jtCtx.pJoinOp); + ASSERT_TRUE(NULL != jtCtx.pJoinOp); +} + +void handleJoinDone(bool* contLoop) { + destroyOperator(jtCtx.pJoinOp); + jtCtx.pJoinOp = NULL; + + if (jtRes.succeed) { + *contLoop = false; + return; + } + + if (jtErrorRerun) { + *contLoop = false; + return; + } + + jtInRerun = true; +} + + +void jtInitLogFile() { + const char *defaultLogFileNamePrefix = "jtlog"; + const int32_t maxLogFileNum = 10; + + tsAsyncLog = 0; + qDebugFlag = 159; + TAOS_STRCPY(tsLogDir, TD_LOG_DIR_PATH); + + if (taosInitLog(defaultLogFileNamePrefix, maxLogFileNum, false) < 0) { + JT_PRINTF("failed to open log file in directory:%s\n", tsLogDir); + } +} + + + +void initJoinTest() { + jtCtx.leftBlkList = taosArrayInit(10, POINTER_BYTES); + jtCtx.rightBlkList = taosArrayInit(10, POINTER_BYTES); + assert(jtCtx.leftBlkList && jtCtx.rightBlkList); + jtCtx.jtResRows = tSimpleHashInit(10000000, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY)); + assert(jtCtx.jtResRows); + + joinTestReplaceRetrieveFp(); + + if (jtCtrl.logHistory) { + jtStat.pHistory = taosArrayInit(100000, sizeof(SJoinTestHistory)); + assert(jtStat.pHistory); + } + + int32_t offset = MAX_SLOT_NUM * sizeof(bool); + for (int32_t i = 0; i < MAX_SLOT_NUM; ++i) { + jtCtx.inColOffset[i] = offset; + offset += tDataTypes[jtInputColType[i]].bytes; + } + jtCtx.inColSize = offset; + jtCtx.inColBuf = (char*)taosMemoryMalloc(jtCtx.inColSize); + assert(jtCtx.inColBuf); + + jtCtx.leftRowsList = taosArrayInit(1024, jtCtx.inColSize); + jtCtx.rightRowsList = taosArrayInit(1024, jtCtx.inColSize); + jtCtx.rightFilterOut = taosArrayInit(1024, sizeof(bool)); + assert(jtCtx.leftRowsList && jtCtx.rightRowsList && jtCtx.rightFilterOut); + + jtInitLogFile(); +} + +void handleTestDone() { + if (jtCtrl.logHistory) { + SJoinTestHistory h; + TAOS_MEMCPY(&h.ctx, &jtCtx, sizeof(h.ctx)); + TAOS_MEMCPY(&h.res, &jtRes, sizeof(h.res)); + assert(NULL != taosArrayPush(jtStat.pHistory, &h)); + } + + int32_t blkNum = taosArrayGetSize(jtCtx.leftBlkList); + for (int32_t i = 0; i < blkNum; ++i) { + SSDataBlock* pBlk = (SSDataBlock*)taosArrayGetP(jtCtx.leftBlkList, i); + assert(pBlk); + (void)blockDataDestroy(pBlk); + } + taosArrayClear(jtCtx.leftBlkList); + + blkNum = taosArrayGetSize(jtCtx.rightBlkList); + for (int32_t i = 0; i < blkNum; ++i) { + SSDataBlock* pBlk = (SSDataBlock*)taosArrayGetP(jtCtx.rightBlkList, i); + assert(pBlk); + (void)blockDataDestroy(pBlk); + } + taosArrayClear(jtCtx.rightBlkList); + + tSimpleHashClear(jtCtx.jtResRows); + jtCtx.resRows = 0; + + jtCtx.inputStat = 0; +} + +void runSingleTest(char* caseName, SJoinTestParam* param) { + bool contLoop = true; + + SSortMergeJoinPhysiNode* pNode = createDummySortMergeJoinPhysiNode(param); + assert(pNode); + createDummyBlkList(1000, 1000, 1000, 1000, 100); + + while (contLoop) { + rerunBlockedHere(); + resetForJoinRerun(2, pNode, param->pTask); + printBasicInfo(caseName); + printOutputInfo(); + + jtCtx.startTsUs = taosGetTimestampUs(); + while (true) { + SSDataBlock* pBlock = NULL; + int32_t code = jtCtx.pJoinOp->fpSet.getNextFn(jtCtx.pJoinOp, &pBlock); + if (NULL == pBlock) { + checkJoinDone(caseName); + break; + } else { + checkJoinRes(pBlock); + } + } + + handleJoinDone(&contLoop); + } + + nodesDestroyNode((SNode*)pNode); + handleTestDone(); +} + +void handleCaseEnd() { + taosMemoryFreeClear(jtCtx.rightFinMatch); + jtCtx.rightFinMatchNum = 0; +} + +} // namespace + +#if 1 +#if 1 +TEST(innerJoin, noCondTest) { + SJoinTestParam param; + char* caseName = "innerJoin:noCondTest"; + SExecTaskInfo* pTask = createDummyTaskInfo(caseName); + assert(pTask); + + param.pTask = pTask; + param.joinType = JOIN_TYPE_INNER; + param.subType = JOIN_STYPE_NONE; + param.cond = TEST_NO_COND; + param.asc = true; + param.grpJoin = false; + + for (jtCtx.loopIdx = 0; jtCtx.loopIdx < JT_MAX_LOOP; ++jtCtx.loopIdx) { + param.asc = !param.asc; + param.filter = false; + runSingleTest(caseName, ¶m); + + param.filter = true; + runSingleTest(caseName, ¶m); + } + + printStatInfo(caseName); + taosMemoryFree(pTask); +} +#endif + +#if 1 +TEST(innerJoin, eqCondTest) { + SJoinTestParam param; + char* caseName = "innerJoin:eqCondTest"; + SExecTaskInfo* pTask = createDummyTaskInfo(caseName); + assert(pTask); + + param.pTask = pTask; + param.joinType = JOIN_TYPE_INNER; + param.subType = JOIN_STYPE_NONE; + param.cond = TEST_EQ_COND; + param.asc = true; + param.grpJoin = false; + + for (jtCtx.loopIdx = 0; jtCtx.loopIdx < JT_MAX_LOOP; ++jtCtx.loopIdx) { + param.asc = !param.asc; + param.filter = false; + runSingleTest(caseName, ¶m); + + param.filter = true; + runSingleTest(caseName, ¶m); + } + + printStatInfo(caseName); + taosMemoryFree(pTask); +} +#endif + +#if 1 +TEST(innerJoin, onCondTest) { + SJoinTestParam param; + char* caseName = "innerJoin:onCondTest"; + SExecTaskInfo* pTask = createDummyTaskInfo(caseName); + assert(pTask); + + param.pTask = pTask; + param.joinType = JOIN_TYPE_INNER; + param.subType = JOIN_STYPE_NONE; + param.cond = TEST_ON_COND; + param.asc = true; + param.grpJoin = false; + + for (jtCtx.loopIdx = 0; jtCtx.loopIdx < JT_MAX_LOOP; ++jtCtx.loopIdx) { + param.asc = !param.asc; + param.filter = false; + runSingleTest(caseName, ¶m); + + param.filter = true; + runSingleTest(caseName, ¶m); + } + + printStatInfo(caseName); + taosMemoryFree(pTask); +} +#endif + +#if 1 +TEST(innerJoin, fullCondTest) { + SJoinTestParam param; + char* caseName = "innerJoin:fullCondTest"; + SExecTaskInfo* pTask = createDummyTaskInfo(caseName); + assert(pTask); + + param.pTask = pTask; + param.joinType = JOIN_TYPE_INNER; + param.subType = JOIN_STYPE_NONE; + param.cond = TEST_FULL_COND; + param.asc = true; + param.grpJoin = false; + + for (jtCtx.loopIdx = 0; jtCtx.loopIdx < JT_MAX_LOOP; ++jtCtx.loopIdx) { + param.asc = !param.asc; + param.filter = false; + runSingleTest(caseName, ¶m); + + param.filter = true; + runSingleTest(caseName, ¶m); + } + + printStatInfo(caseName); + taosMemoryFree(pTask); +} +#endif +#endif + + +#if 1 +#if 1 +TEST(leftOuterJoin, noCondTest) { + SJoinTestParam param; + char* caseName = "leftOuterJoin:noCondTest"; + SExecTaskInfo* pTask = createDummyTaskInfo(caseName); + assert(pTask); + + param.pTask = pTask; + param.joinType = JOIN_TYPE_LEFT; + param.subType = JOIN_STYPE_OUTER; + param.cond = TEST_NO_COND; + param.asc = true; + + for (jtCtx.loopIdx = 0; jtCtx.loopIdx < JT_MAX_LOOP; ++jtCtx.loopIdx) { + param.asc = !param.asc; + param.grpJoin = taosRand() % 2 ? true : false; + param.filter = false; + runSingleTest(caseName, ¶m); + + param.grpJoin = taosRand() % 2 ? true : false; + param.filter = true; + runSingleTest(caseName, ¶m); + } + + printStatInfo(caseName); + taosMemoryFree(pTask); +} +#endif + +#if 1 +TEST(leftOuterJoin, eqCondTest) { + SJoinTestParam param; + char* caseName = "leftOuterJoin:eqCondTest"; + SExecTaskInfo* pTask = createDummyTaskInfo(caseName); + assert(pTask); + + param.pTask = pTask; + param.joinType = JOIN_TYPE_LEFT; + param.subType = JOIN_STYPE_OUTER; + param.cond = TEST_EQ_COND; + param.asc = true; + param.grpJoin = false; + + for (jtCtx.loopIdx = 0; jtCtx.loopIdx < JT_MAX_LOOP; ++jtCtx.loopIdx) { + param.asc = !param.asc; + param.filter = false; + runSingleTest(caseName, ¶m); + + param.filter = true; + runSingleTest(caseName, ¶m); + } + + printStatInfo(caseName); + taosMemoryFree(pTask); +} +#endif + +#if 1 +TEST(leftOuterJoin, onCondTest) { + SJoinTestParam param; + char* caseName = "leftOuterJoin:onCondTest"; + SExecTaskInfo* pTask = createDummyTaskInfo(caseName); + assert(pTask); + + param.pTask = pTask; + param.joinType = JOIN_TYPE_LEFT; + param.subType = JOIN_STYPE_OUTER; + param.cond = TEST_ON_COND; + param.asc = true; + param.grpJoin = false; + + for (jtCtx.loopIdx = 0; jtCtx.loopIdx < JT_MAX_LOOP; ++jtCtx.loopIdx) { + param.asc = !param.asc; + param.filter = false; + runSingleTest(caseName, ¶m); + + param.filter = true; + runSingleTest(caseName, ¶m); + } + + printStatInfo(caseName); + taosMemoryFree(pTask); +} +#endif + +#if 1 +TEST(leftOuterJoin, fullCondTest) { + SJoinTestParam param; + char* caseName = "leftOuterJoin:fullCondTest"; + SExecTaskInfo* pTask = createDummyTaskInfo(caseName); + assert(pTask); + + param.pTask = pTask; + param.joinType = JOIN_TYPE_LEFT; + param.subType = JOIN_STYPE_OUTER; + param.cond = TEST_FULL_COND; + param.asc = true; + param.grpJoin = false; + + for (jtCtx.loopIdx = 0; jtCtx.loopIdx < JT_MAX_LOOP; ++jtCtx.loopIdx) { + param.asc = !param.asc; + param.filter = false; + runSingleTest(caseName, ¶m); + + param.filter = true; + runSingleTest(caseName, ¶m); + } + + printStatInfo(caseName); + taosMemoryFree(pTask); +} +#endif +#endif + +#if 1 +#if 1 +TEST(fullOuterJoin, noCondTest) { + SJoinTestParam param; + char* caseName = "fullOuterJoin:noCondTest"; + SExecTaskInfo* pTask = createDummyTaskInfo(caseName); + assert(pTask); + + param.pTask = pTask; + param.joinType = JOIN_TYPE_FULL; + param.subType = JOIN_STYPE_OUTER; + param.cond = TEST_NO_COND; + param.asc = true; + param.grpJoin = false; + + for (jtCtx.loopIdx = 0; jtCtx.loopIdx < JT_MAX_LOOP; ++jtCtx.loopIdx) { + param.asc = !param.asc; + param.filter = false; + runSingleTest(caseName, ¶m); + + param.filter = true; + runSingleTest(caseName, ¶m); + } + + printStatInfo(caseName); + taosMemoryFree(pTask); +} +#endif + +#if 1 +TEST(fullOuterJoin, eqCondTest) { + SJoinTestParam param; + char* caseName = "fullOuterJoin:eqCondTest"; + SExecTaskInfo* pTask = createDummyTaskInfo(caseName); + assert(pTask); + + param.pTask = pTask; + param.joinType = JOIN_TYPE_FULL; + param.subType = JOIN_STYPE_OUTER; + param.cond = TEST_EQ_COND; + param.asc = true; + param.grpJoin = false; + + for (jtCtx.loopIdx = 0; jtCtx.loopIdx < JT_MAX_LOOP; ++jtCtx.loopIdx) { + param.asc = !param.asc; + param.filter = false; + runSingleTest(caseName, ¶m); + + param.filter = true; + runSingleTest(caseName, ¶m); + } + + printStatInfo(caseName); + taosMemoryFree(pTask); + handleCaseEnd(); +} +#endif + +#if 1 +TEST(fullOuterJoin, onCondTest) { + SJoinTestParam param; + char* caseName = "fullOuterJoin:onCondTest"; + SExecTaskInfo* pTask = createDummyTaskInfo(caseName); + assert(pTask); + + param.pTask = pTask; + param.joinType = JOIN_TYPE_FULL; + param.subType = JOIN_STYPE_OUTER; + param.cond = TEST_ON_COND; + param.asc = true; + param.grpJoin = false; + + for (jtCtx.loopIdx = 0; jtCtx.loopIdx < JT_MAX_LOOP; ++jtCtx.loopIdx) { + param.asc = !param.asc; + param.filter = false; + runSingleTest(caseName, ¶m); + + param.filter = true; + runSingleTest(caseName, ¶m); + } + + printStatInfo(caseName); + taosMemoryFree(pTask); +} +#endif + +#if 1 +TEST(fullOuterJoin, fullCondTest) { + SJoinTestParam param; + char* caseName = "fullOuterJoin:fullCondTest"; + SExecTaskInfo* pTask = createDummyTaskInfo(caseName); + assert(pTask); + + param.pTask = pTask; + param.joinType = JOIN_TYPE_FULL; + param.subType = JOIN_STYPE_OUTER; + param.cond = TEST_FULL_COND; + param.asc = true; + param.grpJoin = false; + + for (jtCtx.loopIdx = 0; jtCtx.loopIdx < JT_MAX_LOOP; ++jtCtx.loopIdx) { + param.asc = !param.asc; + param.filter = false; + runSingleTest(caseName, ¶m); + + param.filter = true; + runSingleTest(caseName, ¶m); + } + + printStatInfo(caseName); + taosMemoryFree(pTask); +} +#endif +#endif + +#if 1 +#if 1 +TEST(leftSemiJoin, noCondTest) { + SJoinTestParam param; + char* caseName = "leftSemiJoin:noCondTest"; + SExecTaskInfo* pTask = createDummyTaskInfo(caseName); + assert(pTask); + + param.pTask = pTask; + param.joinType = JOIN_TYPE_LEFT; + param.subType = JOIN_STYPE_SEMI; + param.cond = TEST_NO_COND; + param.asc = true; + param.grpJoin = false; + + for (jtCtx.loopIdx = 0; jtCtx.loopIdx < JT_MAX_LOOP; ++jtCtx.loopIdx) { + param.asc = !param.asc; + param.filter = false; + runSingleTest(caseName, ¶m); + + param.filter = true; + runSingleTest(caseName, ¶m); + } + + printStatInfo(caseName); + taosMemoryFree(pTask); +} +#endif + +#if 1 +TEST(leftSemiJoin, eqCondTest) { + SJoinTestParam param; + char* caseName = "leftSemiJoin:eqCondTest"; + SExecTaskInfo* pTask = createDummyTaskInfo(caseName); + assert(pTask); + + param.pTask = pTask; + param.joinType = JOIN_TYPE_LEFT; + param.subType = JOIN_STYPE_SEMI; + param.cond = TEST_EQ_COND; + param.asc = true; + param.grpJoin = false; + + for (jtCtx.loopIdx = 0; jtCtx.loopIdx < JT_MAX_LOOP; ++jtCtx.loopIdx) { + param.asc = !param.asc; + param.filter = false; + runSingleTest(caseName, ¶m); + + param.filter = true; + runSingleTest(caseName, ¶m); + } + + printStatInfo(caseName); + taosMemoryFree(pTask); + handleCaseEnd(); +} +#endif + +#if 1 +TEST(leftSemiJoin, onCondTest) { + SJoinTestParam param; + char* caseName = "leftSemiJoin:onCondTest"; + SExecTaskInfo* pTask = createDummyTaskInfo(caseName); + assert(pTask); + + param.pTask = pTask; + param.joinType = JOIN_TYPE_LEFT; + param.subType = JOIN_STYPE_SEMI; + param.cond = TEST_ON_COND; + param.asc = true; + param.grpJoin = false; + + for (jtCtx.loopIdx = 0; jtCtx.loopIdx < JT_MAX_LOOP; ++jtCtx.loopIdx) { + param.asc = !param.asc; + param.filter = false; + runSingleTest(caseName, ¶m); + + param.filter = true; + runSingleTest(caseName, ¶m); + } + + printStatInfo(caseName); + taosMemoryFree(pTask); +} +#endif + +#if 1 +TEST(leftSemiJoin, fullCondTest) { + SJoinTestParam param; + char* caseName = "leftSemiJoin:fullCondTest"; + SExecTaskInfo* pTask = createDummyTaskInfo(caseName); + assert(pTask); + + param.pTask = pTask; + param.joinType = JOIN_TYPE_LEFT; + param.subType = JOIN_STYPE_SEMI; + param.cond = TEST_FULL_COND; + param.asc = true; + param.grpJoin = false; + + for (jtCtx.loopIdx = 0; jtCtx.loopIdx < JT_MAX_LOOP; ++jtCtx.loopIdx) { + param.asc = !param.asc; + param.filter = false; + runSingleTest(caseName, ¶m); + + param.filter = true; + runSingleTest(caseName, ¶m); + } + + printStatInfo(caseName); + taosMemoryFree(pTask); +} +#endif +#endif + +#if 1 +#if 1 +TEST(leftAntiJoin, noCondTest) { + SJoinTestParam param; + char* caseName = "leftAntiJoin:noCondTest"; + SExecTaskInfo* pTask = createDummyTaskInfo(caseName); + assert(pTask); + + param.pTask = pTask; + param.joinType = JOIN_TYPE_LEFT; + param.subType = JOIN_STYPE_ANTI; + param.cond = TEST_NO_COND; + param.asc = true; + param.grpJoin = false; + + for (jtCtx.loopIdx = 0; jtCtx.loopIdx < JT_MAX_LOOP; ++jtCtx.loopIdx) { + param.asc = !param.asc; + param.filter = false; + runSingleTest(caseName, ¶m); + + param.filter = true; + runSingleTest(caseName, ¶m); + } + + printStatInfo(caseName); + taosMemoryFree(pTask); +} +#endif + +#if 1 +TEST(leftAntiJoin, eqCondTest) { + SJoinTestParam param; + char* caseName = "leftAntiJoin:eqCondTest"; + SExecTaskInfo* pTask = createDummyTaskInfo(caseName); + assert(pTask); + + param.pTask = pTask; + param.joinType = JOIN_TYPE_LEFT; + param.subType = JOIN_STYPE_ANTI; + param.cond = TEST_EQ_COND; + param.asc = true; + param.grpJoin = false; + + for (jtCtx.loopIdx = 0; jtCtx.loopIdx < JT_MAX_LOOP; ++jtCtx.loopIdx) { + param.asc = !param.asc; + param.filter = false; + runSingleTest(caseName, ¶m); + + param.filter = true; + runSingleTest(caseName, ¶m); + } + + printStatInfo(caseName); + taosMemoryFree(pTask); + handleCaseEnd(); +} +#endif + +#if 1 +TEST(leftAntiJoin, onCondTest) { + SJoinTestParam param; + char* caseName = "leftAntiJoin:onCondTest"; + SExecTaskInfo* pTask = createDummyTaskInfo(caseName); + assert(pTask); + + param.pTask = pTask; + param.joinType = JOIN_TYPE_LEFT; + param.subType = JOIN_STYPE_ANTI; + param.cond = TEST_ON_COND; + param.asc = true; + param.grpJoin = false; + + for (jtCtx.loopIdx = 0; jtCtx.loopIdx < JT_MAX_LOOP; ++jtCtx.loopIdx) { + param.asc = !param.asc; + param.filter = false; + runSingleTest(caseName, ¶m); + + param.filter = true; + runSingleTest(caseName, ¶m); + } + + printStatInfo(caseName); + taosMemoryFree(pTask); +} +#endif + +#if 1 +TEST(leftAntiJoin, fullCondTest) { + SJoinTestParam param; + char* caseName = "leftAntiJoin:fullCondTest"; + SExecTaskInfo* pTask = createDummyTaskInfo(caseName); + assert(pTask); + + param.pTask = pTask; + param.joinType = JOIN_TYPE_LEFT; + param.subType = JOIN_STYPE_ANTI; + param.cond = TEST_FULL_COND; + param.asc = true; + param.grpJoin = false; + + for (jtCtx.loopIdx = 0; jtCtx.loopIdx < JT_MAX_LOOP; ++jtCtx.loopIdx) { + param.asc = !param.asc; + param.filter = false; + runSingleTest(caseName, ¶m); + + param.filter = true; + runSingleTest(caseName, ¶m); + } + + printStatInfo(caseName); + taosMemoryFree(pTask); +} +#endif +#endif + +#if 1 +#if 1 +TEST(leftAsofJoin, noCondGreaterThanTest) { + SJoinTestParam param; + char* caseName = "leftAsofJoin:noCondGreaterThanTest"; + SExecTaskInfo* pTask = createDummyTaskInfo(caseName); + assert(pTask); + + param.pTask = pTask; + param.joinType = JOIN_TYPE_LEFT; + param.subType = JOIN_STYPE_ASOF; + param.cond = TEST_NO_COND; + param.asofOp = OP_TYPE_GREATER_THAN; + param.asc = true; + + for (jtCtx.loopIdx = 0; jtCtx.loopIdx < JT_MAX_LOOP; ++jtCtx.loopIdx) { + param.asc = !param.asc; + param.jLimit = taosRand() % 2 ? (1 + (taosRand() % JT_MAX_JLIMIT)) : 1; + + param.grpJoin = taosRand() % 2 ? true : false; + param.filter = false; + runSingleTest(caseName, ¶m); + + param.grpJoin = taosRand() % 2 ? true : false; + param.filter = true; + runSingleTest(caseName, ¶m); + } + + printStatInfo(caseName); + taosMemoryFree(pTask); +} +#endif + +#if 1 +TEST(leftAsofJoin, noCondGreaterEqTest) { + SJoinTestParam param; + char* caseName = "leftAsofJoin:noCondGreaterEqTest"; + SExecTaskInfo* pTask = createDummyTaskInfo(caseName); + assert(pTask); + + param.pTask = pTask; + param.joinType = JOIN_TYPE_LEFT; + param.subType = JOIN_STYPE_ASOF; + param.cond = TEST_NO_COND; + param.asofOp = OP_TYPE_GREATER_EQUAL; + param.asc = true; + + for (jtCtx.loopIdx = 0; jtCtx.loopIdx < JT_MAX_LOOP; ++jtCtx.loopIdx) { + param.asc = !param.asc; + param.jLimit = taosRand() % 2 ? (1 + (taosRand() % JT_MAX_JLIMIT)) : 1; + + param.grpJoin = taosRand() % 2 ? true : false; + param.filter = false; + runSingleTest(caseName, ¶m); + + param.grpJoin = taosRand() % 2 ? true : false; + param.filter = true; + runSingleTest(caseName, ¶m); + } + + printStatInfo(caseName); + taosMemoryFree(pTask); +} +#endif + +#if 1 +TEST(leftAsofJoin, noCondEqTest) { + SJoinTestParam param; + char* caseName = "leftAsofJoin:noCondEqTest"; + SExecTaskInfo* pTask = createDummyTaskInfo(caseName); + assert(pTask); + + param.pTask = pTask; + param.joinType = JOIN_TYPE_LEFT; + param.subType = JOIN_STYPE_ASOF; + param.cond = TEST_NO_COND; + param.asofOp = OP_TYPE_EQUAL; + param.asc = true; + + for (jtCtx.loopIdx = 0; jtCtx.loopIdx < JT_MAX_LOOP; ++jtCtx.loopIdx) { + param.asc = !param.asc; + param.jLimit = taosRand() % 2 ? (1 + (taosRand() % JT_MAX_JLIMIT)) : 1; + + param.grpJoin = taosRand() % 2 ? true : false; + param.filter = false; + runSingleTest(caseName, ¶m); + + param.grpJoin = taosRand() % 2 ? true : false; + param.filter = true; + runSingleTest(caseName, ¶m); + } + + printStatInfo(caseName); + taosMemoryFree(pTask); +} +#endif + +#if 1 +TEST(leftAsofJoin, noCondLowerThanTest) { + SJoinTestParam param; + char* caseName = "leftAsofJoin:noCondLowerThanTest"; + SExecTaskInfo* pTask = createDummyTaskInfo(caseName); + assert(pTask); + + param.pTask = pTask; + param.joinType = JOIN_TYPE_LEFT; + param.subType = JOIN_STYPE_ASOF; + param.cond = TEST_NO_COND; + param.asofOp = OP_TYPE_LOWER_THAN; + param.asc = true; + + for (jtCtx.loopIdx = 0; jtCtx.loopIdx < JT_MAX_LOOP; ++jtCtx.loopIdx) { + param.asc = !param.asc; + param.jLimit = taosRand() % 2 ? (1 + (taosRand() % JT_MAX_JLIMIT)) : 1; + + param.grpJoin = taosRand() % 2 ? true : false; + param.filter = false; + runSingleTest(caseName, ¶m); + + param.grpJoin = taosRand() % 2 ? true : false; + param.filter = true; + runSingleTest(caseName, ¶m); + } + + printStatInfo(caseName); + taosMemoryFree(pTask); +} +#endif + + +#if 1 +TEST(leftAsofJoin, noCondLowerEqTest) { + SJoinTestParam param; + char* caseName = "leftAsofJoin:noCondLowerEqTest"; + SExecTaskInfo* pTask = createDummyTaskInfo(caseName); + assert(pTask); + + param.pTask = pTask; + param.joinType = JOIN_TYPE_LEFT; + param.subType = JOIN_STYPE_ASOF; + param.cond = TEST_NO_COND; + param.asofOp = OP_TYPE_LOWER_EQUAL; + param.asc = true; + + for (jtCtx.loopIdx = 0; jtCtx.loopIdx < JT_MAX_LOOP; ++jtCtx.loopIdx) { + param.asc = !param.asc; + param.jLimit = taosRand() % 2 ? (1 + (taosRand() % JT_MAX_JLIMIT)) : 1; + + param.grpJoin = taosRand() % 2 ? true : false; + param.filter = false; + runSingleTest(caseName, ¶m); + + param.grpJoin = taosRand() % 2 ? true : false; + param.filter = true; + runSingleTest(caseName, ¶m); + } + + printStatInfo(caseName); + taosMemoryFree(pTask); +} +#endif + +#endif + + +#if 1 +#if 1 +TEST(leftWinJoin, noCondProjectionTest) { + SJoinTestParam param; + char* caseName = "leftWinJoin:noCondProjectionTest"; + SExecTaskInfo* pTask = createDummyTaskInfo(caseName); + assert(pTask); + + param.pTask = pTask; + param.joinType = JOIN_TYPE_LEFT; + param.subType = JOIN_STYPE_WIN; + param.cond = TEST_NO_COND; + param.asc = true; + + for (jtCtx.loopIdx = 0; jtCtx.loopIdx < JT_MAX_LOOP; ++jtCtx.loopIdx) { + param.asc = !param.asc; + param.jLimit = taosRand() % 2 ? (1 + (taosRand() % JT_MAX_JLIMIT)) : 1; + + param.grpJoin = taosRand() % 2 ? true : false; + param.filter = false; + runSingleTest(caseName, ¶m); + + param.grpJoin = taosRand() % 2 ? true : false; + param.filter = true; + runSingleTest(caseName, ¶m); + } + + printStatInfo(caseName); + taosMemoryFree(pTask); +} +#endif + + +#endif + + + +int main(int argc, char** argv) { + taosSeedRand(taosGetTimestampSec()); + initJoinTest(); + testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + + + +#pragma GCC diagnosti From ecaa66e53f8b31ae2feb21a651a2f277f6293395 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Fri, 20 Sep 2024 15:30:44 +0800 Subject: [PATCH 063/695] set watermark and interval --- source/libs/executor/src/executor.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/source/libs/executor/src/executor.c b/source/libs/executor/src/executor.c index c8180261c0f6..bfa4a56a7756 100644 --- a/source/libs/executor/src/executor.c +++ b/source/libs/executor/src/executor.c @@ -1093,8 +1093,20 @@ int32_t qStreamRecoverFinish(qTaskInfo_t tinfo) { return code; } +static int32_t getOpratorIntervalInfo(SOperatorInfo* pOperator, int64_t* pWaterMark, SInterval* pInterval) { + if (pOperator->operatorType != QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN) { + return getOpratorIntervalInfo(pOperator->pDownstream[0], pWaterMark, pInterval); + } + SStreamScanInfo* pScanOp = (SStreamScanInfo*) pOperator->info; + *pWaterMark = pScanOp->twAggSup.waterMark; + *pInterval = pScanOp->interval; + return TSDB_CODE_SUCCESS; +} + int32_t qGetStreamIntervalExecInfo(qTaskInfo_t tinfo, int64_t* pWaterMark, SInterval* pInterval) { - return 0; + SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo; + SOperatorInfo* pOperator = pTaskInfo->pRoot; + return getOpratorIntervalInfo(pOperator, pWaterMark, pInterval); } int32_t qSetStreamOperatorOptionForScanHistory(qTaskInfo_t tinfo) { From 71df0e07817695347388266aafcd96a972245ce1 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Fri, 20 Sep 2024 16:55:57 +0800 Subject: [PATCH 064/695] adjust block type --- source/libs/stream/src/streamData.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/libs/stream/src/streamData.c b/source/libs/stream/src/streamData.c index be8d798a3a2d..7150b322da49 100644 --- a/source/libs/stream/src/streamData.c +++ b/source/libs/stream/src/streamData.c @@ -323,8 +323,6 @@ int32_t streamCreateSinkResTrigger(SStreamTrigger** pTrigger, int32_t triggerTyp return terrno; } - p->pBlock->info.type = STREAM_GET_ALL; - // let's calculate the previous time window // todo get the time precision for ts if (triggerType == STREAM_TRIGGER_FORCE_WINDOW_CLOSE) { @@ -333,6 +331,9 @@ int32_t streamCreateSinkResTrigger(SStreamTrigger** pTrigger, int32_t triggerTyp STimeWindow window = getAlignQueryTimeWindow(&interval, now - trigger); p->pBlock->info.window = window; + p->pBlock->info.type = STREAM_GET_RESULT; + } else { + p->pBlock->info.type = STREAM_GET_ALL; } *pTrigger = p; From f3b42fd9d12e798321503090361b9fea99d6aa48 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Fri, 20 Sep 2024 19:18:35 +0800 Subject: [PATCH 065/695] enh(stream): generate the force_window_close trigger block. --- source/dnode/vnode/src/tqCommon/tqCommon.c | 1 - source/libs/stream/src/streamData.c | 1 + source/libs/stream/src/streamSched.c | 42 +++++++++++++--------- 3 files changed, 27 insertions(+), 17 deletions(-) diff --git a/source/dnode/vnode/src/tqCommon/tqCommon.c b/source/dnode/vnode/src/tqCommon/tqCommon.c index d22511a41ebf..05ccc2f5c37c 100644 --- a/source/dnode/vnode/src/tqCommon/tqCommon.c +++ b/source/dnode/vnode/src/tqCommon/tqCommon.c @@ -84,7 +84,6 @@ int32_t tqExpandStreamTask(SStreamTask* pTask) { code = qSetTaskId(pTask->exec.pExecutor, pTask->id.taskId, pTask->id.streamId); if (code) { - return code; } } diff --git a/source/libs/stream/src/streamData.c b/source/libs/stream/src/streamData.c index 7150b322da49..64d79d6b42bc 100644 --- a/source/libs/stream/src/streamData.c +++ b/source/libs/stream/src/streamData.c @@ -332,6 +332,7 @@ int32_t streamCreateSinkResTrigger(SStreamTrigger** pTrigger, int32_t triggerTyp STimeWindow window = getAlignQueryTimeWindow(&interval, now - trigger); p->pBlock->info.window = window; p->pBlock->info.type = STREAM_GET_RESULT; + stDebug("force_window_close trigger block generated, window range:%" PRId64 "-%" PRId64, window.skey, window.ekey); } else { p->pBlock->info.type = STREAM_GET_ALL; } diff --git a/source/libs/stream/src/streamSched.c b/source/libs/stream/src/streamSched.c index 9b097696c591..2bdd85cec6f9 100644 --- a/source/libs/stream/src/streamSched.c +++ b/source/libs/stream/src/streamSched.c @@ -13,6 +13,7 @@ * along with this program. If not, see . */ +#include "ttime.h" #include "streamInt.h" #include "ttimer.h" @@ -20,9 +21,10 @@ static void streamTaskResumeHelper(void* param, void* tmrId); static void streamTaskSchedHelper(void* param, void* tmrId); void streamSetupScheduleTrigger(SStreamTask* pTask) { - int64_t delay = 0; - int32_t code = 0; + int64_t delay = 0; + int32_t code = 0; const char* id = pTask->id.idStr; + if (pTask->info.fillHistory == 1) { return; } @@ -32,21 +34,28 @@ void streamSetupScheduleTrigger(SStreamTask* pTask) { int64_t waterMark = 0; SInterval interval = {0}; code = qGetStreamIntervalExecInfo(pTask->exec.pExecutor, &waterMark, &interval); - if (code == 0) { - pTask->info.delaySchedParam = interval.sliding; - pTask->info.watermark = waterMark; - pTask->info.interval = interval; + if (code) { + stError("s-task:%s failed to init scheduler info, code:%s", id, tstrerror(code)); + return; } - // todo: calculate the correct start delay time for force_window_close - delay = pTask->info.delaySchedParam; - stInfo("s-task:%s extract interval info from executor, wm:%" PRId64 " interval:%" PRId64 " unit:%c sliding:%" PRId64 - " unit:%c ", - id, waterMark, interval.interval, interval.intervalUnit, interval.sliding, interval.slidingUnit); - } + pTask->info.delaySchedParam = interval.sliding; + pTask->info.watermark = waterMark; + pTask->info.interval = interval; - if (delay == 0) { - return; + // calculate the first start timestamp + int64_t now = taosGetTimestamp(interval.precision); + STimeWindow curWin = getAlignQueryTimeWindow(&pTask->info.interval, now); + delay = (curWin.ekey + 1) - now + waterMark; + + stInfo("s-task:%s extract interval info from executor, wm:%" PRId64 " interval:%" PRId64 " unit:%c sliding:%" PRId64 + " unit:%c, initial start after:%" PRId64, + id, waterMark, interval.interval, interval.intervalUnit, interval.sliding, interval.slidingUnit, delay); + } else { + delay = pTask->info.delaySchedParam; + if (delay == 0) { + return; + } } int32_t ref = atomic_add_fetch_32(&pTask->refCnt, 1); @@ -153,7 +162,8 @@ void streamTaskSchedHelper(void* param, void* tmrId) { if (streamTaskGetStatus(pTask).state == TASK_STATUS__CK) { stDebug("s-task:%s in checkpoint procedure, not retrieve result, next:%dms", id, nextTrigger); } else { - if (status == TASK_TRIGGER_STATUS__ACTIVE) { + if ((status == TASK_TRIGGER_STATUS__ACTIVE) || + (pTask->info.trigger == STREAM_TRIGGER_FORCE_WINDOW_CLOSE && pTask->info.taskLevel == TASK_LEVEL__SOURCE)) { SStreamTrigger* pTrigger; int32_t code = streamCreateSinkResTrigger(&pTrigger, pTask->info.trigger, pTask->info.delaySchedParam); @@ -168,7 +178,7 @@ void streamTaskSchedHelper(void* param, void* tmrId) { code = streamTaskPutDataIntoInputQ(pTask, (SStreamQueueItem*)pTrigger); if (code != TSDB_CODE_SUCCESS) { - stError("s-task:%s failed to put retrieve block into trigger, code:%s", pTask->id.idStr, tstrerror(code)); + stError("s-task:%s failed to put retrieve aggRes block into q, code:%s", pTask->id.idStr, tstrerror(code)); goto _end; } From a0e7791e49963f697ee8edb2612e8894e2ca720d Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Mon, 23 Sep 2024 10:13:42 +0800 Subject: [PATCH 066/695] fix issue --- source/libs/executor/src/scanoperator.c | 1 + .../executor/src/streamtimesliceoperator.c | 22 ++++++++++++------- source/libs/stream/src/streamState.c | 2 +- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 8c72742a2d9f..5f6144634faa 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -3396,6 +3396,7 @@ static bool isStreamWindow(SStreamScanInfo* pInfo) { static int32_t copyGetResultBlock(SSDataBlock* dest, const SSDataBlock* src) { TSKEY start = src->info.window.skey; TSKEY end = src->info.window.ekey; + blockDataEnsureCapacity(dest, 1); return appendDataToSpecialBlock(dest, &start, &end, NULL, NULL, NULL); } diff --git a/source/libs/executor/src/streamtimesliceoperator.c b/source/libs/executor/src/streamtimesliceoperator.c index 20687964d430..d6cc178a7fdd 100644 --- a/source/libs/executor/src/streamtimesliceoperator.c +++ b/source/libs/executor/src/streamtimesliceoperator.c @@ -1687,18 +1687,24 @@ static int32_t setAllResultKey(SStreamAggSupporter* pAggSup, TSKEY ts, SSHashObj int32_t lino = 0; int64_t groupId = 0; SStreamStateCur* pCur = pAggSup->stateStore.streamStateGroupGetCur(pAggSup->pState); - int32_t winCode = pAggSup->stateStore.streamStateGroupGetKVByCur(pCur, &groupId, NULL, NULL); - if (winCode != TSDB_CODE_SUCCESS) { - goto _end; - } - SWinKey key = {.ts = ts, .groupId = groupId}; - code = saveTimeSliceWinResult(&key, pUpdatedMap); - QUERY_CHECK_CODE(code, lino, _end); + while (1) { + int32_t winCode = pAggSup->stateStore.streamStateGroupGetKVByCur(pCur, &groupId, NULL, NULL); + if (winCode != TSDB_CODE_SUCCESS) { + break; + } + SWinKey key = {.ts = ts, .groupId = groupId}; + code = saveTimeSliceWinResult(&key, pUpdatedMap); + QUERY_CHECK_CODE(code, lino, _end); - pAggSup->stateStore.streamStateGroupCurNext(pCur); + pAggSup->stateStore.streamStateGroupCurNext(pCur); + } + pAggSup->stateStore.streamStateFreeCur(pCur); + pCur = NULL; _end: if (code != TSDB_CODE_SUCCESS) { + pAggSup->stateStore.streamStateFreeCur(pCur); + pCur = NULL; qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); } return code; diff --git a/source/libs/stream/src/streamState.c b/source/libs/stream/src/streamState.c index ae19c8b42f16..fd625958c4c4 100644 --- a/source/libs/stream/src/streamState.c +++ b/source/libs/stream/src/streamState.c @@ -569,7 +569,7 @@ void streamStateGroupCurNext(SStreamStateCur* pCur) { } int32_t streamStateGroupGetKVByCur(SStreamStateCur* pCur, int64_t* pKey, void** pVal, int32_t* pVLen) { - if (pVal != NULL) { + if (pVal == NULL) { return -1; } return streamFileStateGroupGetKVByCur(pCur, pKey, pVal, pVLen); From db50c9230add75c663bcf1c88e546faca7b994b6 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Tue, 24 Sep 2024 16:58:46 +0800 Subject: [PATCH 067/695] fix issue --- include/libs/stream/tstreamFileState.h | 1 + source/libs/executor/src/scanoperator.c | 2 +- .../executor/src/streamtimesliceoperator.c | 35 ++++++------------- source/libs/stream/src/streamBackendRocksdb.c | 1 - source/libs/stream/src/streamState.c | 8 ++++- source/libs/stream/src/tstreamFileState.c | 6 ++++ 6 files changed, 25 insertions(+), 28 deletions(-) diff --git a/include/libs/stream/tstreamFileState.h b/include/libs/stream/tstreamFileState.h index 1497fb4afa6f..83463e2adb39 100644 --- a/include/libs/stream/tstreamFileState.h +++ b/include/libs/stream/tstreamFileState.h @@ -145,6 +145,7 @@ void deleteHashSortRowBuff(SStreamFileState* pFileState, const SWinKey* pKey) int32_t streamFileStateGroupPut(SStreamFileState* pFileState, int64_t groupId, void* value, int32_t vLen); void streamFileStateGroupCurNext(SStreamStateCur* pCur); int32_t streamFileStateGroupGetKVByCur(SStreamStateCur* pCur, int64_t* pKey, void** pVal, int32_t* pVLen); +SSHashObj* getGroupIdCache(SStreamFileState* pFileState); #ifdef __cplusplus } diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 5f6144634faa..502d88b26d41 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -3632,7 +3632,7 @@ static int32_t doStreamScanNext(SOperatorInfo* pOperator, SSDataBlock** ppRes) { pInfo->updateResIndex = 0; code = copyGetResultBlock(pInfo->pUpdateRes, pBlock); QUERY_CHECK_CODE(code, lino, _end); - pInfo->pUpdateInfo->maxDataVersion = pBlock->info.version; + pInfo->pUpdateInfo->maxDataVersion = -1; prepareRangeScan(pInfo, pInfo->pUpdateRes, &pInfo->updateResIndex, NULL); pInfo->scanMode = STREAM_SCAN_FROM_DATAREADER_RANGE; } break; diff --git a/source/libs/executor/src/streamtimesliceoperator.c b/source/libs/executor/src/streamtimesliceoperator.c index d6cc178a7fdd..1c19894dff62 100644 --- a/source/libs/executor/src/streamtimesliceoperator.c +++ b/source/libs/executor/src/streamtimesliceoperator.c @@ -942,14 +942,6 @@ static void copyCalcRowDeltaData(SResultRowData* pEndRow, SArray* pEndPoins, SFi } static void setForceWindowCloseFillRule(SStreamFillSupporter* pFillSup, SStreamFillInfo* pFillInfo, TSKEY ts) { - TSKEY prevWKey = INT64_MIN; - TSKEY nextWKey = INT64_MIN; - if (hasPrevWindow(pFillSup)) { - prevWKey = pFillSup->prev.key; - } - if (hasNextWindow(pFillSup)) { - nextWKey = pFillSup->next.key; - } TSKEY endTs = adustEndTsKey(ts, pFillSup->cur.key, &pFillSup->interval); TSKEY startTs = adustPrevTsKey(ts, pFillSup->cur.key, &pFillSup->interval); @@ -960,39 +952,32 @@ static void setForceWindowCloseFillRule(SStreamFillSupporter* pFillSup, SStreamF case TSDB_FILL_NULL_F: case TSDB_FILL_SET_VALUE: case TSDB_FILL_SET_VALUE_F: { - if (ts != pFillSup->cur.key) { + if (ts == pFillSup->cur.key) { + pFillInfo->pos = FILL_POS_START; + pFillInfo->needFill = false; + } else { pFillInfo->pos = FILL_POS_INVALID; setFillKeyInfo(ts, ts + 1, &pFillSup->interval, pFillInfo); - } else { - pFillInfo->needFill = false; - pFillInfo->pos = FILL_POS_START; - goto _end; + copyNonFillValueInfo(pFillSup, pFillInfo); } - copyNonFillValueInfo(pFillSup, pFillInfo); } break; case TSDB_FILL_PREV: { - if (ts != pFillSup->cur.key) { - pFillInfo->pos = FILL_POS_INVALID; - setFillKeyInfo(ts, ts + 1, &pFillSup->interval, pFillInfo); + if (ts == pFillSup->cur.key) { + pFillInfo->pos = FILL_POS_START; + pFillInfo->needFill = false; } else if (hasPrevWindow(pFillSup)) { pFillInfo->pos = FILL_POS_INVALID; setFillKeyInfo(ts, ts + 1, &pFillSup->interval, pFillInfo); + pFillInfo->pResRow = &pFillSup->prev; } else { pFillInfo->needFill = false; - pFillInfo->pos = FILL_POS_START; - goto _end; + pFillInfo->pos = FILL_POS_INVALID; } - pFillInfo->pResRow = &pFillSup->prev; } break; default: qError("%s failed at line %d since invalid fill type", __func__, __LINE__); break; } - -_end: - if (ts != pFillSup->cur.key) { - pFillInfo->pos = FILL_POS_INVALID; - } } static void setTimeSliceFillRule(SStreamFillSupporter* pFillSup, SStreamFillInfo* pFillInfo, TSKEY ts) { diff --git a/source/libs/stream/src/streamBackendRocksdb.c b/source/libs/stream/src/streamBackendRocksdb.c index dd72ba54e4ae..278b504e0930 100644 --- a/source/libs/stream/src/streamBackendRocksdb.c +++ b/source/libs/stream/src/streamBackendRocksdb.c @@ -4306,7 +4306,6 @@ void streamStateParTagSeekKeyNext_rocksdb(SStreamState* pState, const int64_t gr char buf[128] = {0}; int32_t klen = ginitDict[i].enFunc((void*)&groupId, buf); if (!streamStateIterSeekAndValid(pCur->iter, buf, klen)) { - streamStateFreeCur(pCur); return ; } // skip ttl expired data diff --git a/source/libs/stream/src/streamState.c b/source/libs/stream/src/streamState.c index fd625958c4c4..484877e37ba5 100644 --- a/source/libs/stream/src/streamState.c +++ b/source/libs/stream/src/streamState.c @@ -561,6 +561,12 @@ SStreamStateCur* streamStateGroupGetCur(SStreamState* pState) { SStreamStateCur* pCur = createStateCursor(pState->pFileState); pCur->hashIter = 0; pCur->pHashData = NULL; + SSHashObj* pMap = getGroupIdCache(pState->pFileState); + pCur->pHashData = tSimpleHashIterate(pMap, pCur->pHashData, &pCur->hashIter); + if (pCur->pHashData == NULL) { + pCur->hashIter = -1; + streamStateParTagSeekKeyNext_rocksdb(pState, INT64_MIN, pCur); + } return pCur; } @@ -569,7 +575,7 @@ void streamStateGroupCurNext(SStreamStateCur* pCur) { } int32_t streamStateGroupGetKVByCur(SStreamStateCur* pCur, int64_t* pKey, void** pVal, int32_t* pVLen) { - if (pVal == NULL) { + if (pVal != NULL) { return -1; } return streamFileStateGroupGetKVByCur(pCur, pKey, pVal, pVLen); diff --git a/source/libs/stream/src/tstreamFileState.c b/source/libs/stream/src/tstreamFileState.c index 855a42a5f838..a88ab661e63e 100644 --- a/source/libs/stream/src/tstreamFileState.c +++ b/source/libs/stream/src/tstreamFileState.c @@ -1144,6 +1144,7 @@ void streamFileStateGroupCurNext(SStreamStateCur* pCur) { SStreamFileState* pFileState = (SStreamFileState*)pCur->pStreamFileState; if (pCur->hashIter == -1) { streamStateCurNext(pFileState->pFileStore, pCur); + return; } SSHashObj* pHash = pFileState->pGroupIdMap; @@ -1151,6 +1152,7 @@ void streamFileStateGroupCurNext(SStreamStateCur* pCur) { if (!pCur->pHashData) { pCur->hashIter = -1; streamStateParTagSeekKeyNext_rocksdb(pFileState->pFileStore, pCur->minGpId, pCur); + return; } int64_t gpId = *(int64_t*)tSimpleHashGetKey(pCur->pHashData, NULL); pCur->minGpId = TMIN(pCur->minGpId, gpId); @@ -1164,3 +1166,7 @@ int32_t streamFileStateGroupGetKVByCur(SStreamStateCur* pCur, int64_t* pKey, voi } return streamStateParTagGetKVByCur_rocksdb(pCur, pKey, NULL, NULL); } + +SSHashObj* getGroupIdCache(SStreamFileState* pFileState) { + return pFileState->pGroupIdMap; +} From f84fe05a671bcde33fdcb07722752d4516a97895 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Tue, 24 Sep 2024 18:54:52 +0800 Subject: [PATCH 068/695] enh:[TS-5441] cost too long in tmq write meta data --- source/client/src/clientRawBlockWrite.c | 96 ++++++++++++++----------- 1 file changed, 55 insertions(+), 41 deletions(-) diff --git a/source/client/src/clientRawBlockWrite.c b/source/client/src/clientRawBlockWrite.c index 8a888a2a4786..efd2eec67840 100644 --- a/source/client/src/clientRawBlockWrite.c +++ b/source/client/src/clientRawBlockWrite.c @@ -26,7 +26,7 @@ #define RAW_NULL_CHECK(c) \ do { \ if (c == NULL) { \ - code = TSDB_CODE_OUT_OF_MEMORY; \ + code = terrno; \ goto end; \ } \ } while (0) @@ -1780,6 +1780,42 @@ static int32_t tmqWriteRawDataImpl(TAOS* taos, void* data, int32_t dataLen) { return code; } +static int32_t buildCreateTbMap(STaosxRsp* rsp, SHashObj* pHashObj) { + // find schema data info + int32_t code = 0; + SVCreateTbReq pCreateReq = {0}; + SDecoder decoderTmp = {0}; + + for (int j = 0; j < rsp->createTableNum; j++) { + void** dataTmp = taosArrayGet(rsp->createTableReq, j); + RAW_NULL_CHECK(dataTmp); + int32_t* lenTmp = taosArrayGet(rsp->createTableLen, j); + RAW_NULL_CHECK(dataTmp); + + tDecoderInit(&decoderTmp, *dataTmp, *lenTmp); + RAW_RETURN_CHECK (tDecodeSVCreateTbReq(&decoderTmp, &pCreateReq)); + + if (pCreateReq.type != TSDB_CHILD_TABLE) { + code = TSDB_CODE_INVALID_MSG; + goto end; + } + if (taosHashGet(pHashObj, pCreateReq.name, strlen(pCreateReq.name)) == NULL){ + RAW_RETURN_CHECK(taosHashPut(pHashObj, pCreateReq.name, strlen(pCreateReq.name), &pCreateReq, sizeof(SVCreateTbReq))); + } else{ + tDestroySVCreateTbReq(&pCreateReq, TSDB_MSG_FLG_DECODE); + pCreateReq = (SVCreateTbReq){0}; + } + + tDecoderClear(&decoderTmp); + } + return 0; + +end: + tDecoderClear(&decoderTmp); + tDestroySVCreateTbReq(&pCreateReq, TSDB_MSG_FLG_DECODE); + return code; +} + static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, int32_t dataLen) { if (taos == NULL || data == NULL) { SET_ERROR_MSG("taos:%p or data:%p is NULL", taos, data); @@ -1787,11 +1823,11 @@ static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, int32_t dataLen) } int32_t code = TSDB_CODE_SUCCESS; SHashObj* pVgHash = NULL; + SHashObj* pCreateTbHash = NULL; SQuery* pQuery = NULL; SMqTaosxRspObj rspObj = {0}; SDecoder decoder = {0}; STableMeta* pTableMeta = NULL; - SVCreateTbReq* pCreateReqDst = NULL; SRequestObj* pRequest = NULL; RAW_RETURN_CHECK(createRequest(*(int64_t*)taos, TSDB_SQL_INSERT, 0, &pRequest)); @@ -1832,6 +1868,11 @@ static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, int32_t dataLen) RAW_RETURN_CHECK(smlInitHandle(&pQuery)); pVgHash = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, HASH_NO_LOCK); RAW_NULL_CHECK(pVgHash); + pCreateTbHash = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK); + RAW_NULL_CHECK(pCreateTbHash); + taosHashSetFreeFp(pCreateTbHash, (_hash_free_fn_t)tdDestroySVCreateTbReq); + + RAW_RETURN_CHECK(buildCreateTbMap(&rspObj.rsp, pCreateTbHash)); uDebug(LOG_ID_TAG " write raw metadata block num:%d", LOG_ID_VALUE, rspObj.rsp.common.blockNum); while (++rspObj.common.resIter < rspObj.rsp.common.blockNum) { @@ -1854,40 +1895,7 @@ static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, int32_t dataLen) (void)strcpy(pName.tname, tbName); // find schema data info - for (int j = 0; j < rspObj.rsp.createTableNum; j++) { - void** dataTmp = taosArrayGet(rspObj.rsp.createTableReq, j); - RAW_NULL_CHECK(dataTmp); - int32_t* lenTmp = taosArrayGet(rspObj.rsp.createTableLen, j); - RAW_NULL_CHECK(dataTmp); - - SDecoder decoderTmp = {0}; - SVCreateTbReq pCreateReq = {0}; - tDecoderInit(&decoderTmp, *dataTmp, *lenTmp); - if (tDecodeSVCreateTbReq(&decoderTmp, &pCreateReq) < 0) { - tDecoderClear(&decoderTmp); - tDestroySVCreateTbReq(&pCreateReq, TSDB_MSG_FLG_DECODE); - code = TSDB_CODE_TMQ_INVALID_MSG; - SET_ERROR_MSG("decode create table:%s req failed", tbName); - goto end; - } - - if (pCreateReq.type != TSDB_CHILD_TABLE) { - code = TSDB_CODE_TSC_INVALID_VALUE; - tDecoderClear(&decoderTmp); - tDestroySVCreateTbReq(&pCreateReq, TSDB_MSG_FLG_DECODE); - SET_ERROR_MSG("create table req type is not child table: %s, type: %d", tbName, pCreateReq.type); - goto end; - } - if (strcmp(tbName, pCreateReq.name) == 0) { - RAW_RETURN_CHECK(cloneSVreateTbReq(&pCreateReq, &pCreateReqDst)); - tDecoderClear(&decoderTmp); - tDestroySVCreateTbReq(&pCreateReq, TSDB_MSG_FLG_DECODE); - break; - } - tDecoderClear(&decoderTmp); - tDestroySVCreateTbReq(&pCreateReq, TSDB_MSG_FLG_DECODE); - } - + SVCreateTbReq* pCreateReqDst = (SVCreateTbReq*)taosHashGet(pCreateTbHash, tbName, strlen(tbName)); SVgroupInfo vg = {0}; RAW_RETURN_CHECK(catalogGetTableHashVgroup(pCatalog, &conn, &pName, &vg)); if (pCreateReqDst) { // change stable name to get meta @@ -1920,7 +1928,15 @@ static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, int32_t dataLen) } void* rawData = getRawDataFromRes(pRetrieve); char err[ERR_MSG_LEN] = {0}; - code = rawBlockBindData(pQuery, pTableMeta, rawData, &pCreateReqDst, fields, pSW->nCols, true, err, ERR_MSG_LEN); + SVCreateTbReq* pCreateReqTmp = NULL; + if (pCreateReqDst){ + RAW_RETURN_CHECK(cloneSVreateTbReq(pCreateReqDst, &pCreateReqTmp)); + } + code = rawBlockBindData(pQuery, pTableMeta, rawData, &pCreateReqTmp, fields, pSW->nCols, true, err, ERR_MSG_LEN); + if (pCreateReqTmp != NULL) { + tdDestroySVCreateTbReq(pCreateReqTmp); + taosMemoryFree(pCreateReqTmp); + } taosMemoryFree(fields); taosMemoryFreeClear(pTableMeta); if (code != TSDB_CODE_SUCCESS) { @@ -1936,16 +1952,14 @@ static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, int32_t dataLen) end: uDebug(LOG_ID_TAG " write raw metadata return, msg:%s", LOG_ID_VALUE, tstrerror(code)); + taosHashCleanup(pCreateTbHash); tDeleteSTaosxRsp(&rspObj.rsp); tDecoderClear(&decoder); qDestroyQuery(pQuery); destroyRequest(pRequest); taosHashCleanup(pVgHash); taosMemoryFreeClear(pTableMeta); - if (pCreateReqDst) { - tdDestroySVCreateTbReq(pCreateReqDst); - taosMemoryFree(pCreateReqDst); - } + return code; } From 2d56c8f058d678e802264187374342f5e4f8a278 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Tue, 24 Sep 2024 19:34:34 +0800 Subject: [PATCH 069/695] fix issue & add log --- .../executor/src/streamtimesliceoperator.c | 19 +++++++++++++------ source/libs/stream/src/streamSliceState.c | 16 +++++++++------- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/source/libs/executor/src/streamtimesliceoperator.c b/source/libs/executor/src/streamtimesliceoperator.c index 1c19894dff62..cfebddf9a10f 100644 --- a/source/libs/executor/src/streamtimesliceoperator.c +++ b/source/libs/executor/src/streamtimesliceoperator.c @@ -827,6 +827,8 @@ static int32_t getPointInfoFromStateRight(SStreamAggSupporter* pAggSup, SStreamF &curVLen, pWinCode); QUERY_CHECK_CODE(code, lino, _end); + qDebug("===stream=== set stream interp next point buf.ts:%" PRId64 ", groupId:%" PRId64 ", res:%d", pNextPoint->key.ts, pNextPoint->key.groupId, pWinCode); + setPointBuff(pNextPoint, pFillSup); if (*pWinCode != TSDB_CODE_SUCCESS) { @@ -844,6 +846,9 @@ static int32_t getPointInfoFromStateRight(SStreamAggSupporter* pAggSup, SStreamF code = pAggSup->stateStore.streamStateFillGetPrev(pState, &pNextPoint->key, &pCurPoint->key, (void**)&pCurPoint->pResPos, &nextVLen, &tmpRes); QUERY_CHECK_CODE(code, lino, _end); + + qDebug("===stream=== set stream interp cur point buf.ts:%" PRId64 ", groupId:%" PRId64 ", res:%d", pCurPoint->key.ts, pCurPoint->key.groupId, tmpRes); + if (tmpRes == TSDB_CODE_SUCCESS) { setPointBuff(pCurPoint, pFillSup); } @@ -872,6 +877,8 @@ static int32_t getPointInfoFromState(SStreamAggSupporter* pAggSup, SStreamFillSu &curVLen, pWinCode); QUERY_CHECK_CODE(code, lino, _end); + qDebug("===stream=== set stream interp buf.ts:%" PRId64 ", groupId:%" PRId64, pCurPoint->key.ts, pCurPoint->key.groupId); + setPointBuff(pCurPoint, pFillSup); if (*pWinCode != TSDB_CODE_SUCCESS) { @@ -942,9 +949,8 @@ static void copyCalcRowDeltaData(SResultRowData* pEndRow, SArray* pEndPoins, SFi } static void setForceWindowCloseFillRule(SStreamFillSupporter* pFillSup, SStreamFillInfo* pFillInfo, TSKEY ts) { - TSKEY endTs = adustEndTsKey(ts, pFillSup->cur.key, &pFillSup->interval); - TSKEY startTs = adustPrevTsKey(ts, pFillSup->cur.key, &pFillSup->interval); - + qDebug("===stream=== set force window close rule.ts:%" PRId64 ",cur key:%" PRId64 ", has prev%d, has next:%d", ts, + pFillSup->cur.key, hasPrevWindow(pFillSup), hasNextWindow(pFillSup)); pFillInfo->needFill = true; pFillInfo->pos = FILL_POS_INVALID; switch (pFillInfo->type) { @@ -962,9 +968,9 @@ static void setForceWindowCloseFillRule(SStreamFillSupporter* pFillSup, SStreamF } } break; case TSDB_FILL_PREV: { - if (ts == pFillSup->cur.key) { - pFillInfo->pos = FILL_POS_START; - pFillInfo->needFill = false; + if (ts >= pFillSup->cur.key) { + setFillKeyInfo(ts, ts + 1, &pFillSup->interval, pFillInfo); + pFillInfo->pResRow = &pFillSup->cur; } else if (hasPrevWindow(pFillSup)) { pFillInfo->pos = FILL_POS_INVALID; setFillKeyInfo(ts, ts + 1, &pFillSup->interval, pFillInfo); @@ -1430,6 +1436,7 @@ void doBuildTimeSlicePointResult(SStreamAggSupporter* pAggSup, STimeWindowAggSup int32_t numOfRows = getNumOfTotalRes(pGroupResInfo); for (; pGroupResInfo->index < numOfRows; pGroupResInfo->index++) { SWinKey* pKey = (SWinKey*)taosArrayGet(pGroupResInfo->pRows, pGroupResInfo->index); + qDebug("===stream=== build interp res. key:%" PRId64 ",groupId:%" PRId64, pKey->ts, pKey->groupId); if (pBlock->info.id.groupId == 0) { pBlock->info.id.groupId = pKey->groupId; } else if (pBlock->info.id.groupId != pKey->groupId) { diff --git a/source/libs/stream/src/streamSliceState.c b/source/libs/stream/src/streamSliceState.c index 6f4eea06ee18..e535c2e7a332 100644 --- a/source/libs/stream/src/streamSliceState.c +++ b/source/libs/stream/src/streamSliceState.c @@ -276,14 +276,16 @@ int32_t getHashSortPrevRow(SStreamFileState* pFileState, const SWinKey* pKey, SW streamStateFreeCur(pCur); return code; } else { - SWinKey* pNext = taosArrayGet(pWinStates, index - 1); - if (qDebugFlag & DEBUG_DEBUG) { - SWinKey* pTmp = taosArrayGet(pWinStates, index); - if (winKeyCmprImpl(pTmp, pKey) != 0) { - qError("%s failed at line %d since do not find cur SWinKey", __func__, lino); - } + SWinKey* pPrevKey = NULL; + SWinKey* pCurKey = taosArrayGet(pWinStates, index); + if (winKeyCmprImpl(pCurKey, pKey) == 0) { + pPrevKey = taosArrayGet(pWinStates, index - 1); + } else { + pPrevKey = taosArrayGet(pWinStates, index); + qDebug("%s failed at line %d since do not find cur SWinKey. trigger may be force window close", __func__, __LINE__); } - *pResKey = *pNext; + + *pResKey = *pPrevKey; return getHashSortRowBuff(pFileState, pResKey, ppVal, pVLen, pWinCode); } (*pWinCode) = TSDB_CODE_FAILED; From cc3ec6108915f2bd671cb695ae80bc65e554d69b Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Wed, 25 Sep 2024 10:29:55 +0800 Subject: [PATCH 070/695] add ci and fix issue --- .../executor/src/streamtimesliceoperator.c | 2 + source/libs/stream/src/streamSliceState.c | 23 +-- .../stream/streamInterpForceWindowClose.sim | 139 ++++++++++++++++++ 3 files changed, 153 insertions(+), 11 deletions(-) create mode 100644 tests/script/tsim/stream/streamInterpForceWindowClose.sim diff --git a/source/libs/executor/src/streamtimesliceoperator.c b/source/libs/executor/src/streamtimesliceoperator.c index cfebddf9a10f..c1fedfb90661 100644 --- a/source/libs/executor/src/streamtimesliceoperator.c +++ b/source/libs/executor/src/streamtimesliceoperator.c @@ -757,6 +757,8 @@ static int32_t getResultInfoFromState(SStreamAggSupporter* pAggSup, SStreamFillS code = pAggSup->stateStore.streamStateFillGetPrev(pState, &pCurPoint->key, &pPrevPoint->key, (void**)&pPrevPoint->pResPos, &preVLen, &tmpRes); QUERY_CHECK_CODE(code, lino, _end); + qDebug("===stream=== set stream interp resutl prev buf.ts:%" PRId64 ", groupId:%" PRId64 ", res:%d", pPrevPoint->key.ts, pPrevPoint->key.groupId, tmpRes); + if (tmpRes == TSDB_CODE_SUCCESS) { QUERY_CHECK_CONDITION(!IS_INVALID_WIN_KEY(pPrevPoint->key.ts), code, lino, _end, TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR); setPointBuff(pPrevPoint, pFillSup); diff --git a/source/libs/stream/src/streamSliceState.c b/source/libs/stream/src/streamSliceState.c index e535c2e7a332..c92fac5968da 100644 --- a/source/libs/stream/src/streamSliceState.c +++ b/source/libs/stream/src/streamSliceState.c @@ -233,10 +233,11 @@ int32_t getHashSortPrevRow(SStreamFileState* pFileState, const SWinKey* pKey, SW SArray* pWinStates = NULL; SSHashObj* pSearchBuff = getSearchBuff(pFileState); void* pState = getStateFileStore(pFileState); - void** ppBuff = tSimpleHashGet(pSearchBuff, &pKey->groupId, sizeof(uint64_t)); + void** ppBuff = (void**) tSimpleHashGet(pSearchBuff, &pKey->groupId, sizeof(uint64_t)); if (ppBuff) { pWinStates = (SArray*)(*ppBuff); } else { + qTrace("===stream=== search buff is empty.group id:%" PRId64, pKey->groupId); SStreamStateCur* pCur = streamStateFillSeekKeyPrev_rocksdb(pState, pKey); void* tmpVal = NULL; int32_t len = 0; @@ -257,7 +258,15 @@ int32_t getHashSortPrevRow(SStreamFileState* pFileState, const SWinKey* pKey, SW } int32_t size = taosArrayGetSize(pWinStates); int32_t index = binarySearch(pWinStates, size, pKey, fillStateKeyCompare); - if (index == -1 || index == 0) { + if (index >= 0) { + SWinKey* pCurKey = taosArrayGet(pWinStates, index); + if (winKeyCmprImpl(pCurKey, pKey) == 0) { + index--; + } else { + qDebug("%s failed at line %d since do not find cur SWinKey. trigger may be force window close", __func__, __LINE__); + } + } + if (index == -1) { SStreamStateCur* pCur = streamStateFillSeekKeyPrev_rocksdb(pState, pKey); void* tmpVal = NULL; int32_t len = 0; @@ -276,15 +285,7 @@ int32_t getHashSortPrevRow(SStreamFileState* pFileState, const SWinKey* pKey, SW streamStateFreeCur(pCur); return code; } else { - SWinKey* pPrevKey = NULL; - SWinKey* pCurKey = taosArrayGet(pWinStates, index); - if (winKeyCmprImpl(pCurKey, pKey) == 0) { - pPrevKey = taosArrayGet(pWinStates, index - 1); - } else { - pPrevKey = taosArrayGet(pWinStates, index); - qDebug("%s failed at line %d since do not find cur SWinKey. trigger may be force window close", __func__, __LINE__); - } - + SWinKey* pPrevKey = taosArrayGet(pWinStates, index); *pResKey = *pPrevKey; return getHashSortRowBuff(pFileState, pResKey, ppVal, pVLen, pWinCode); } diff --git a/tests/script/tsim/stream/streamInterpForceWindowClose.sim b/tests/script/tsim/stream/streamInterpForceWindowClose.sim new file mode 100644 index 000000000000..4eb14abf00d3 --- /dev/null +++ b/tests/script/tsim/stream/streamInterpForceWindowClose.sim @@ -0,0 +1,139 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sleep 50 +sql connect + +print step1 +print =============== create database +sql create database test vgroups 1; +sql use test; + +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stream streams1 trigger force_window_close IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _irowts, interp(a) as a, interp(b) as b, now from t1 every(2s) fill(prev); + +run tsim/stream/checkTaskStatus.sim + + +sql insert into t1 values(now,1,1,1,1.1) (now + 10s,2,2,2,2.1) (now + 20s,3,3,3,3.1); + +print sql select * from t1; +sql select * from t1; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 +loop0: + +sleep 2000 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 2 sql select * from streamt where a == 1; +sql select * from streamt where a == 1; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +# row 0 +if $rows < 2 then + print ======rows=$rows + goto loop0 +endi + +$loop_count = 0 +loop1: + +sleep 2000 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 2 sql select * from streamt where a == 2; +sql select * from streamt where a == 2; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows < 2 then + print ======rows=$rows + goto loop1 +endi + +$loop_count = 0 +loop2: + +sleep 2000 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 2 sql select * from streamt where a == 3; +sql select * from streamt where a == 3; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows < 2 then + print ======rows=$rows + goto loop2 +endi + +sleep 4000 + +$loop_count = 0 +loop3: + +sleep 2000 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 2 sql select * from streamt where a == 3; +sql select * from streamt where a == 3; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows < 5 then + print ======rows=$rows + goto loop3 +endi + +print end + +system sh/exec.sh -n dnode1 -s stop -x SIGINT From 33cab144faa092a93f77d30dbe2ecfeba65fb34d Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Wed, 25 Sep 2024 11:13:03 +0800 Subject: [PATCH 071/695] enh:[TS-5441] cost too long in tmq write meta data --- source/client/src/clientRawBlockWrite.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/source/client/src/clientRawBlockWrite.c b/source/client/src/clientRawBlockWrite.c index efd2eec67840..a97440eed77d 100644 --- a/source/client/src/clientRawBlockWrite.c +++ b/source/client/src/clientRawBlockWrite.c @@ -1870,8 +1870,6 @@ static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, int32_t dataLen) RAW_NULL_CHECK(pVgHash); pCreateTbHash = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK); RAW_NULL_CHECK(pCreateTbHash); - taosHashSetFreeFp(pCreateTbHash, (_hash_free_fn_t)tdDestroySVCreateTbReq); - RAW_RETURN_CHECK(buildCreateTbMap(&rspObj.rsp, pCreateTbHash)); uDebug(LOG_ID_TAG " write raw metadata block num:%d", LOG_ID_VALUE, rspObj.rsp.common.blockNum); @@ -1952,7 +1950,13 @@ static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, int32_t dataLen) end: uDebug(LOG_ID_TAG " write raw metadata return, msg:%s", LOG_ID_VALUE, tstrerror(code)); + void* pIter = taosHashIterate(pCreateTbHash, NULL); + while (pIter) { + tDestroySVCreateTbReq(pIter, TSDB_MSG_FLG_DECODE); + pIter = taosHashIterate(pCreateTbHash, pIter); + } taosHashCleanup(pCreateTbHash); + tDeleteSTaosxRsp(&rspObj.rsp); tDecoderClear(&decoder); qDestroyQuery(pQuery); From f4cfe2d4a7a4962e13c0b072acafe587edb3cd82 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Wed, 25 Sep 2024 13:49:38 +0800 Subject: [PATCH 072/695] add ci --- .../stream/streamInterpForceWindowClose.sim | 96 +++++++++++++++++++ 1 file changed, 96 insertions(+) diff --git a/tests/script/tsim/stream/streamInterpForceWindowClose.sim b/tests/script/tsim/stream/streamInterpForceWindowClose.sim index 4eb14abf00d3..6580682b8d81 100644 --- a/tests/script/tsim/stream/streamInterpForceWindowClose.sim +++ b/tests/script/tsim/stream/streamInterpForceWindowClose.sim @@ -134,6 +134,102 @@ if $rows < 5 then goto loop3 endi +print step2 +print =============== create database +sql create database test2 vgroups 1; +sql use test2; + +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stream streams2 trigger force_window_close IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _irowts, interp(a) as a, interp(b) as b, now from t1 every(2s) fill(NULL); + +run tsim/stream/checkTaskStatus.sim + + +sql insert into t1 values(now,1,1,1,1.1) (now + 10s,2,2,2,2.1) (now + 20s,3,3,3,3.1); + +print sql select * from t1; +sql select * from t1; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 +loop4: + +sleep 2000 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 2 sql select * from streamt where a is null; +sql select * from streamt where a is null; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +if $rows < 5 then + print ======rows=$rows + goto loop4 +endi + +print step3 +print =============== create database +sql create database test3 vgroups 1; +sql use test3; + +sql create table t1(ts timestamp, a int, b int , c int, d double); +sql create stream streams3 trigger force_window_close IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _irowts, interp(a) as a, interp(b) as b, now from t1 every(2s) fill(value,100,200); + +run tsim/stream/checkTaskStatus.sim + + +sql insert into t1 values(now,1,1,1,1.1) (now + 10s,2,2,2,2.1) (now + 20s,3,3,3,3.1); + +print sql select * from t1; +sql select * from t1; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 +loop5: + +sleep 2000 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 2 sql select * from streamt where a == 100; +sql select * from streamt where a == 100; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +if $rows < 5 then + print ======rows=$rows + goto loop5 +endi + print end system sh/exec.sh -n dnode1 -s stop -x SIGINT From b81d3c10b7f9aae8ff5ced9bf22ddd0184d238f8 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Wed, 25 Sep 2024 15:08:15 +0800 Subject: [PATCH 073/695] add ci --- tests/parallel_test/cases.task | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 8dc4b89b8760..e66cc928e24d 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -1362,6 +1362,7 @@ ,,y,script,./test.sh -f tsim/stream/streamInterpDelete1.sim ,,y,script,./test.sh -f tsim/stream/streamInterpDelete2.sim ,,y,script,./test.sh -f tsim/stream/streamInterpError.sim +,,y,script,./test.sh -f tsim/stream/streamInterpForceWindowClose.sim ,,y,script,./test.sh -f tsim/stream/streamInterpHistory.sim ,,y,script,./test.sh -f tsim/stream/streamInterpHistory1.sim ,,y,script,./test.sh -f tsim/stream/streamInterpLarge.sim From 68b2ca0f7b22479d27c449d21b6c770d761011a6 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Wed, 25 Sep 2024 15:16:07 +0800 Subject: [PATCH 074/695] adj sql.c --- source/libs/parser/src/sql.c | 9159 +++++++++++++++++----------------- 1 file changed, 4531 insertions(+), 4628 deletions(-) diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c index a4ccd82ef213..3053d97d241f 100644 --- a/source/libs/parser/src/sql.c +++ b/source/libs/parser/src/sql.c @@ -24,10 +24,7 @@ ** The following is the concatenation of all %include directives from the ** input grammar file: */ -#include -#include /************ Begin %include sections from the grammar ************************/ - #include #include #include @@ -489,31 +486,31 @@ #endif /************* Begin control #defines *****************************************/ #define YYCODETYPE unsigned short int -#define YYNOCODE 567 +#define YYNOCODE 568 #define YYACTIONTYPE unsigned short int #define ParseTOKENTYPE SToken typedef union { int yyinit; ParseTOKENTYPE yy0; - EFillMode yy18; - EJoinType yy36; - ENullOrder yy109; - bool yy173; - SNodeList* yy334; - SAlterOption yy389; - STokenPair yy399; - EOperatorType yy506; - SToken yy533; - EShowKind yy537; - SNode* yy560; - int64_t yy585; - EJoinSubType yy648; - ETrimType yy672; - SShowTablesOption yy709; - int8_t yy719; - int32_t yy802; - SDataType yy952; - EOrder yy974; + bool yy9; + SShowTablesOption yy13; + SDataType yy48; + EOperatorType yy108; + SToken yy209; + EJoinSubType yy278; + int8_t yy343; + SNodeList* yy456; + EFillMode yy470; + ETrimType yy512; + int32_t yy516; + SAlterOption yy573; + int64_t yy637; + EJoinType yy724; + ENullOrder yy777; + EOrder yy818; + SNode* yy840; + EShowKind yy881; + STokenPair yy1065; } YYMINORTYPE; #ifndef YYSTACKDEPTH #define YYSTACKDEPTH 100 @@ -529,18 +526,18 @@ typedef union { #define ParseCTX_FETCH #define ParseCTX_STORE #define YYFALLBACK 1 -#define YYNSTATE 1007 -#define YYNRULE 772 -#define YYNRULE_WITH_ACTION 772 +#define YYNSTATE 1009 +#define YYNRULE 774 +#define YYNRULE_WITH_ACTION 774 #define YYNTOKEN 384 -#define YY_MAX_SHIFT 1006 -#define YY_MIN_SHIFTREDUCE 1493 -#define YY_MAX_SHIFTREDUCE 2264 -#define YY_ERROR_ACTION 2265 -#define YY_ACCEPT_ACTION 2266 -#define YY_NO_ACTION 2267 -#define YY_MIN_REDUCE 2268 -#define YY_MAX_REDUCE 3039 +#define YY_MAX_SHIFT 1008 +#define YY_MIN_SHIFTREDUCE 1496 +#define YY_MAX_SHIFTREDUCE 2269 +#define YY_ERROR_ACTION 2270 +#define YY_ACCEPT_ACTION 2271 +#define YY_NO_ACTION 2272 +#define YY_MIN_REDUCE 2273 +#define YY_MAX_REDUCE 3046 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -607,952 +604,923 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (4706) +#define YY_ACTTAB_COUNT (4420) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 194, 223, 672, 823, 2631, 673, 2316, 2536, 2266, 520, - /* 10 */ 2478, 3007, 59, 57, 575, 490, 773, 2523, 492, 196, - /* 20 */ 500, 2269, 1986, 136, 2628, 885, 2534, 2409, 2774, 822, - /* 30 */ 230, 2011, 520, 2478, 3008, 824, 1984, 2757, 2091, 2360, - /* 40 */ 517, 2799, 150, 44, 352, 149, 148, 147, 146, 145, - /* 50 */ 144, 143, 142, 141, 52, 51, 838, 2778, 58, 56, - /* 60 */ 55, 54, 53, 2268, 637, 635, 2015, 437, 2086, 150, - /* 70 */ 244, 868, 149, 148, 147, 146, 145, 144, 143, 142, - /* 80 */ 141, 462, 1992, 481, 2678, 2817, 219, 159, 158, 157, - /* 90 */ 156, 155, 154, 153, 152, 151, 898, 533, 682, 2670, - /* 100 */ 506, 2764, 532, 880, 677, 898, 2467, 2780, 2782, 495, - /* 110 */ 674, 2328, 1003, 2604, 903, 60, 974, 973, 972, 971, - /* 120 */ 530, 903, 970, 969, 174, 964, 963, 962, 961, 960, - /* 130 */ 959, 958, 173, 952, 951, 950, 529, 528, 947, 946, - /* 140 */ 945, 210, 209, 944, 525, 943, 942, 941, 2798, 1538, - /* 150 */ 812, 2846, 2094, 2095, 789, 133, 2800, 884, 2802, 2803, - /* 160 */ 879, 898, 3007, 867, 2847, 903, 992, 773, 1545, 506, - /* 170 */ 212, 250, 2909, 343, 344, 2012, 494, 2905, 342, 2817, - /* 180 */ 3013, 230, 2556, 903, 2012, 3008, 824, 899, 2476, 2536, - /* 190 */ 74, 2047, 2057, 1540, 1543, 1544, 231, 460, 63, 40, - /* 200 */ 62, 2093, 2096, 74, 2956, 52, 51, 160, 2534, 58, - /* 210 */ 56, 55, 54, 53, 1718, 718, 1987, 106, 1985, 772, - /* 220 */ 52, 51, 105, 866, 58, 56, 55, 54, 53, 1709, - /* 230 */ 930, 929, 928, 1713, 927, 1715, 1716, 926, 923, 226, - /* 240 */ 1724, 920, 1726, 1727, 917, 914, 911, 568, 2631, 775, - /* 250 */ 2670, 811, 567, 1990, 1991, 2044, 62, 2046, 2049, 2050, - /* 260 */ 2051, 2052, 2053, 2054, 2055, 2056, 876, 869, 2629, 885, - /* 270 */ 901, 900, 865, 2078, 2079, 2080, 2081, 2082, 2085, 2087, - /* 280 */ 2088, 2089, 2090, 2092, 2, 59, 57, 2183, 823, 104, - /* 290 */ 441, 957, 2009, 500, 2435, 1986, 3007, 688, 2799, 619, - /* 300 */ 2774, 2016, 464, 566, 789, 565, 813, 1858, 1859, 1984, - /* 310 */ 639, 2091, 3007, 878, 822, 230, 1757, 1758, 552, 3008, - /* 320 */ 824, 58, 56, 55, 54, 53, 598, 504, 641, 2778, - /* 330 */ 3013, 230, 219, 442, 600, 3008, 824, 614, 564, 2460, - /* 340 */ 467, 2086, 2817, 695, 868, 578, 1718, 680, 19, 2158, - /* 350 */ 673, 2316, 613, 835, 169, 1992, 1857, 1860, 2764, 2604, - /* 360 */ 880, 1709, 930, 929, 928, 1713, 927, 1715, 1716, 875, - /* 370 */ 874, 2291, 1724, 873, 1726, 1727, 872, 914, 911, 2780, - /* 380 */ 2783, 691, 2480, 266, 336, 1003, 463, 675, 15, 2324, - /* 390 */ 2631, 112, 336, 903, 336, 52, 51, 336, 586, 58, - /* 400 */ 56, 55, 54, 53, 502, 2798, 2011, 2450, 2846, 465, - /* 410 */ 2628, 885, 432, 2800, 884, 2802, 2803, 879, 877, 2471, - /* 420 */ 867, 2847, 903, 858, 2874, 2094, 2095, 2717, 940, 2611, - /* 430 */ 2590, 2764, 627, 626, 625, 624, 623, 618, 617, 616, - /* 440 */ 615, 447, 808, 769, 605, 604, 603, 602, 601, 595, - /* 450 */ 594, 593, 759, 588, 587, 461, 556, 899, 2476, 579, - /* 460 */ 1819, 1820, 835, 169, 2047, 2057, 1838, 204, 753, 329, - /* 470 */ 757, 755, 300, 299, 2093, 2096, 770, 160, 206, 2917, - /* 480 */ 834, 940, 161, 833, 789, 723, 558, 554, 669, 1987, - /* 490 */ 3007, 1985, 3007, 2155, 2156, 2157, 866, 667, 52, 51, - /* 500 */ 663, 659, 58, 56, 55, 54, 53, 2290, 822, 230, - /* 510 */ 3013, 230, 12, 3008, 824, 3008, 824, 52, 51, 2924, - /* 520 */ 692, 58, 56, 55, 54, 53, 1990, 1991, 2044, 512, - /* 530 */ 2046, 2049, 2050, 2051, 2052, 2053, 2054, 2055, 2056, 876, - /* 540 */ 869, 2044, 34, 901, 900, 865, 2078, 2079, 2921, 219, - /* 550 */ 2011, 2085, 2087, 2088, 2089, 2090, 2092, 2, 59, 57, - /* 560 */ 2799, 814, 809, 802, 798, 454, 500, 2764, 1986, 2160, - /* 570 */ 2161, 2162, 2163, 2164, 2187, 881, 2605, 1831, 1832, 2618, - /* 580 */ 2011, 693, 1984, 2573, 2091, 2158, 837, 199, 2917, 2918, - /* 590 */ 2799, 167, 2922, 52, 51, 2258, 898, 58, 56, 55, - /* 600 */ 54, 53, 52, 51, 2817, 838, 58, 56, 55, 54, - /* 610 */ 53, 9, 268, 1992, 2086, 2121, 675, 868, 2324, 2536, - /* 620 */ 2764, 19, 880, 116, 1565, 2228, 1564, 505, 1992, 522, - /* 630 */ 304, 78, 2529, 2531, 2817, 739, 738, 737, 2534, 1656, - /* 640 */ 165, 47, 729, 166, 733, 74, 1545, 197, 732, 2280, - /* 650 */ 2764, 503, 880, 731, 736, 474, 473, 1886, 1003, 730, - /* 660 */ 193, 15, 1566, 472, 726, 725, 724, 2798, 527, 526, - /* 670 */ 2846, 2481, 1543, 1544, 133, 2800, 884, 2802, 2803, 879, - /* 680 */ 2122, 2289, 867, 2847, 903, 1658, 1565, 171, 1564, 180, - /* 690 */ 2880, 2909, 1993, 126, 2180, 494, 2905, 2798, 2094, 2095, - /* 700 */ 2846, 2068, 2216, 931, 133, 2800, 884, 2802, 2803, 879, - /* 710 */ 2063, 1955, 867, 2847, 903, 1912, 1913, 1914, 12, 212, - /* 720 */ 10, 2909, 2158, 2257, 1566, 494, 2905, 2536, 2929, 2155, - /* 730 */ 2156, 2157, 2929, 2929, 2929, 2929, 2929, 2047, 2057, 446, - /* 740 */ 445, 2764, 74, 386, 511, 510, 842, 2093, 2096, 507, - /* 750 */ 2465, 2048, 515, 2957, 612, 471, 469, 523, 2127, 611, - /* 760 */ 835, 169, 1987, 516, 1985, 2091, 193, 610, 954, 866, - /* 770 */ 805, 804, 2214, 2215, 2217, 2218, 2219, 2481, 43, 496, - /* 780 */ 2116, 2117, 2118, 2119, 2120, 2124, 2125, 2126, 938, 186, - /* 790 */ 185, 935, 934, 933, 183, 2086, 584, 2600, 400, 1990, - /* 800 */ 1991, 2044, 2513, 2046, 2049, 2050, 2051, 2052, 2053, 2054, - /* 810 */ 2055, 2056, 876, 869, 3012, 2045, 901, 900, 865, 2078, - /* 820 */ 2079, 2363, 3007, 2924, 2085, 2087, 2088, 2089, 2090, 2092, - /* 830 */ 2, 12, 59, 57, 2799, 468, 466, 956, 720, 336, - /* 840 */ 500, 3011, 1986, 590, 2600, 3008, 3010, 2758, 393, 881, - /* 850 */ 246, 2326, 2920, 631, 45, 859, 1984, 2881, 2091, 722, - /* 860 */ 2463, 621, 2600, 721, 2123, 2929, 2155, 2156, 2157, 2929, - /* 870 */ 2929, 2929, 2929, 2929, 1996, 52, 51, 392, 2817, 58, - /* 880 */ 56, 55, 54, 53, 2452, 139, 2917, 2918, 2086, 167, - /* 890 */ 2922, 868, 899, 2476, 2764, 19, 880, 248, 739, 738, - /* 900 */ 737, 2924, 1992, 899, 2476, 729, 166, 733, 480, 2678, - /* 910 */ 506, 732, 524, 899, 2476, 253, 731, 736, 474, 473, - /* 920 */ 2449, 255, 730, 235, 903, 1651, 472, 726, 725, 724, - /* 930 */ 2919, 2102, 1003, 67, 1954, 15, 336, 2011, 112, 689, - /* 940 */ 2799, 2798, 2128, 1977, 2846, 1953, 630, 254, 133, 2800, - /* 950 */ 884, 2802, 2803, 879, 194, 881, 867, 2847, 903, 311, - /* 960 */ 628, 2015, 41, 3027, 2479, 2909, 2472, 514, 513, 494, - /* 970 */ 2905, 1652, 2094, 2095, 899, 2476, 899, 2476, 509, 508, - /* 980 */ 1978, 52, 51, 2227, 2817, 58, 56, 55, 54, 53, - /* 990 */ 55, 54, 53, 861, 572, 2881, 573, 901, 900, 224, - /* 1000 */ 2764, 2179, 880, 690, 2624, 2085, 2087, 2088, 2089, 2090, - /* 1010 */ 2092, 2047, 2057, 14, 13, 1568, 1569, 899, 2476, 52, - /* 1020 */ 51, 2093, 2096, 58, 56, 55, 54, 53, 2208, 938, - /* 1030 */ 186, 185, 935, 934, 933, 183, 1987, 592, 1985, 399, - /* 1040 */ 899, 2476, 2209, 866, 2530, 2531, 2015, 2798, 714, 713, - /* 1050 */ 2846, 2015, 899, 2476, 201, 2800, 884, 2802, 2803, 879, - /* 1060 */ 382, 746, 867, 2847, 903, 938, 186, 185, 935, 934, - /* 1070 */ 933, 183, 606, 1990, 1991, 2044, 760, 2046, 2049, 2050, - /* 1080 */ 2051, 2052, 2053, 2054, 2055, 2056, 876, 869, 2207, 2199, - /* 1090 */ 901, 900, 865, 2078, 2079, 301, 1986, 2799, 2085, 2087, - /* 1100 */ 2088, 2089, 2090, 2092, 2, 59, 57, 2097, 2048, 3012, - /* 1110 */ 1984, 749, 881, 500, 2964, 1986, 825, 3028, 743, 741, - /* 1120 */ 2288, 871, 3012, 2287, 2480, 298, 2014, 2064, 2135, 1984, - /* 1130 */ 3007, 2091, 870, 2014, 225, 899, 2476, 2799, 52, 51, - /* 1140 */ 2286, 2817, 58, 56, 55, 54, 53, 899, 2476, 3011, - /* 1150 */ 899, 2476, 881, 3008, 3009, 607, 1992, 2764, 2410, 880, - /* 1160 */ 2536, 2086, 899, 2476, 868, 2285, 788, 608, 521, 2281, - /* 1170 */ 694, 84, 2045, 899, 2476, 1992, 83, 39, 42, 2534, - /* 1180 */ 2764, 2817, 2473, 2764, 52, 51, 1003, 2536, 58, 56, - /* 1190 */ 55, 54, 53, 306, 716, 715, 2016, 2764, 2284, 880, - /* 1200 */ 2764, 735, 734, 2283, 2798, 1003, 850, 2846, 60, 899, - /* 1210 */ 2476, 133, 2800, 884, 2802, 2803, 879, 527, 526, 867, - /* 1220 */ 2847, 903, 2251, 2282, 233, 2764, 3027, 2000, 2909, 314, - /* 1230 */ 52, 51, 494, 2905, 58, 56, 55, 54, 53, 170, - /* 1240 */ 96, 1993, 2880, 2091, 2798, 2094, 2095, 2846, 968, 966, - /* 1250 */ 286, 198, 2800, 884, 2802, 2803, 879, 172, 2764, 867, - /* 1260 */ 2847, 903, 2011, 2764, 52, 51, 205, 2468, 58, 56, - /* 1270 */ 55, 54, 53, 2086, 3011, 712, 708, 704, 700, 2536, - /* 1280 */ 285, 2016, 193, 2764, 2047, 2057, 2016, 1992, 899, 2476, - /* 1290 */ 1987, 2704, 1985, 2482, 2093, 2096, 125, 547, 2535, 334, - /* 1300 */ 393, 790, 2967, 46, 899, 2476, 334, 72, 841, 1987, - /* 1310 */ 330, 1985, 899, 2476, 899, 2476, 866, 863, 786, 932, - /* 1320 */ 2279, 237, 2527, 2469, 347, 2718, 113, 1990, 1991, 899, - /* 1330 */ 2476, 283, 855, 2278, 354, 52, 51, 2277, 2066, 58, - /* 1340 */ 56, 55, 54, 53, 2970, 2276, 1990, 1991, 2044, 892, - /* 1350 */ 2046, 2049, 2050, 2051, 2052, 2053, 2054, 2055, 2056, 876, - /* 1360 */ 869, 2679, 2275, 901, 900, 865, 2078, 2079, 2274, 899, - /* 1370 */ 2476, 2085, 2087, 2088, 2089, 2090, 2092, 2, 59, 57, - /* 1380 */ 2764, 1668, 789, 899, 2476, 2799, 500, 1672, 1986, 893, - /* 1390 */ 3007, 2273, 2272, 2764, 2684, 1667, 936, 2764, 271, 2527, - /* 1400 */ 881, 1671, 1984, 897, 2091, 2764, 2271, 282, 3013, 230, - /* 1410 */ 2799, 273, 280, 3008, 824, 2296, 996, 278, 686, 2011, - /* 1420 */ 1547, 2001, 2764, 1996, 817, 881, 2010, 2977, 2764, 2817, - /* 1430 */ 3, 184, 937, 2048, 2086, 2527, 270, 868, 722, 2538, - /* 1440 */ 90, 2453, 721, 2069, 65, 2764, 2583, 880, 1992, 835, - /* 1450 */ 169, 2764, 2764, 162, 2817, 305, 52, 51, 2004, 2006, - /* 1460 */ 58, 56, 55, 54, 53, 303, 2764, 102, 827, 302, - /* 1470 */ 2764, 642, 880, 906, 175, 901, 900, 644, 1003, 864, - /* 1480 */ 315, 60, 2076, 2085, 2087, 2088, 2089, 2090, 2092, 2347, - /* 1490 */ 582, 2799, 2798, 2169, 103, 2846, 2708, 2045, 204, 134, - /* 1500 */ 2800, 884, 2802, 2803, 879, 176, 881, 867, 2847, 903, - /* 1510 */ 291, 740, 293, 289, 66, 292, 2909, 2798, 2094, 2095, - /* 1520 */ 2846, 2906, 2260, 2261, 133, 2800, 884, 2802, 2803, 879, - /* 1530 */ 830, 117, 867, 2847, 903, 2817, 221, 295, 806, 3027, - /* 1540 */ 294, 2909, 322, 115, 297, 494, 2905, 296, 444, 836, - /* 1550 */ 540, 2764, 479, 880, 761, 52, 51, 2047, 2057, 58, - /* 1560 */ 56, 55, 54, 53, 2065, 52, 51, 2093, 2096, 58, - /* 1570 */ 56, 55, 54, 53, 200, 2917, 2918, 727, 167, 2922, - /* 1580 */ 728, 763, 1987, 762, 1985, 176, 796, 61, 1902, 866, - /* 1590 */ 131, 61, 128, 213, 640, 2345, 2336, 1995, 2798, 184, - /* 1600 */ 1649, 2846, 826, 1647, 341, 409, 2800, 884, 2802, 2803, - /* 1610 */ 879, 89, 32, 867, 2847, 903, 61, 742, 744, 1990, - /* 1620 */ 1991, 2044, 76, 2046, 2049, 2050, 2051, 2052, 2053, 2054, - /* 1630 */ 2055, 2056, 876, 869, 2334, 61, 901, 900, 865, 2078, - /* 1640 */ 2079, 14, 13, 61, 2085, 2087, 2088, 2089, 2090, 2092, - /* 1650 */ 2, 59, 57, 61, 2045, 2785, 747, 2113, 766, 500, - /* 1660 */ 1994, 1986, 164, 2062, 2818, 61, 89, 2402, 1910, 2203, - /* 1670 */ 2213, 361, 360, 774, 2212, 1984, 320, 2091, 363, 362, - /* 1680 */ 181, 907, 840, 2799, 52, 51, 38, 345, 58, 56, - /* 1690 */ 55, 54, 53, 839, 847, 162, 2401, 184, 881, 2067, - /* 1700 */ 800, 365, 364, 367, 366, 2129, 86, 2086, 369, 368, - /* 1710 */ 868, 371, 370, 373, 372, 789, 375, 374, 2077, 2787, - /* 1720 */ 909, 1992, 2317, 3007, 377, 376, 2070, 2817, 379, 378, - /* 1730 */ 789, 381, 380, 182, 2960, 803, 2058, 486, 3007, 1629, - /* 1740 */ 184, 3013, 230, 2764, 163, 880, 3008, 824, 1855, 1845, - /* 1750 */ 789, 1003, 810, 181, 60, 482, 3013, 230, 3007, 844, - /* 1760 */ 2799, 3008, 824, 357, 948, 949, 2609, 1602, 828, 531, - /* 1770 */ 2323, 549, 2524, 818, 782, 881, 3013, 230, 896, 1998, - /* 1780 */ 1700, 3008, 824, 2961, 2971, 1630, 332, 1621, 1619, 398, - /* 1790 */ 2798, 2094, 2095, 2846, 327, 819, 2610, 133, 2800, 884, - /* 1800 */ 2802, 2803, 879, 1731, 2817, 867, 2847, 903, 335, 2436, - /* 1810 */ 5, 539, 3027, 1603, 2909, 534, 1739, 458, 494, 2905, - /* 1820 */ 2764, 560, 880, 1746, 2009, 48, 548, 1744, 2019, 238, - /* 1830 */ 2047, 2057, 831, 559, 562, 1879, 187, 239, 241, 391, - /* 1840 */ 2093, 2096, 1997, 576, 497, 2010, 583, 252, 633, 585, - /* 1850 */ 591, 589, 609, 596, 620, 1987, 2602, 1985, 622, 645, - /* 1860 */ 629, 632, 866, 634, 646, 643, 258, 2798, 648, 137, - /* 1870 */ 2846, 257, 650, 651, 433, 2800, 884, 2802, 2803, 879, - /* 1880 */ 261, 653, 867, 2847, 903, 655, 2017, 670, 4, 671, - /* 1890 */ 679, 269, 1990, 1991, 2044, 678, 2046, 2049, 2050, 2051, - /* 1900 */ 2052, 2053, 2054, 2055, 2056, 876, 869, 681, 2012, 901, - /* 1910 */ 900, 865, 2078, 2079, 108, 683, 2799, 2085, 2087, 2088, - /* 1920 */ 2089, 2090, 2092, 2, 59, 57, 272, 2018, 684, 2020, - /* 1930 */ 275, 881, 500, 3000, 1986, 685, 687, 277, 2021, 2625, - /* 1940 */ 109, 2022, 2619, 696, 110, 111, 284, 138, 1984, 717, - /* 1950 */ 2091, 765, 719, 2466, 288, 2462, 2799, 290, 750, 189, - /* 1960 */ 2817, 2694, 135, 2464, 751, 2691, 435, 767, 2459, 190, - /* 1970 */ 191, 881, 114, 2941, 177, 394, 2764, 2013, 880, 2671, - /* 1980 */ 2086, 307, 777, 868, 778, 776, 310, 2690, 312, 783, - /* 1990 */ 781, 784, 793, 2976, 1992, 807, 845, 8, 816, 792, - /* 2000 */ 2817, 794, 2975, 2948, 323, 321, 791, 324, 203, 820, - /* 2010 */ 317, 319, 325, 821, 832, 487, 2764, 829, 880, 2928, - /* 2020 */ 328, 168, 326, 2798, 1003, 2014, 2846, 60, 3006, 2177, - /* 2030 */ 133, 2800, 884, 2802, 2803, 879, 3030, 2175, 867, 2847, - /* 2040 */ 903, 1, 232, 337, 216, 3027, 178, 2909, 395, 2925, - /* 2050 */ 843, 494, 2905, 331, 2639, 2638, 2637, 848, 396, 491, - /* 2060 */ 179, 849, 853, 2798, 2094, 2095, 2846, 73, 350, 888, - /* 2070 */ 133, 2800, 884, 2802, 2803, 879, 856, 2890, 867, 2847, - /* 2080 */ 903, 886, 355, 397, 890, 3027, 891, 2909, 2477, 124, - /* 2090 */ 2756, 494, 2905, 2755, 127, 2751, 2750, 2742, 2741, 1517, - /* 2100 */ 2733, 2732, 2748, 2047, 2057, 999, 998, 401, 2747, 1000, - /* 2110 */ 2739, 387, 2738, 2093, 2096, 2727, 384, 188, 995, 2726, - /* 2120 */ 769, 388, 1002, 436, 905, 405, 2745, 2716, 1987, 2744, - /* 2130 */ 1985, 2736, 403, 423, 64, 866, 2715, 2735, 434, 2724, - /* 2140 */ 2714, 2723, 2721, 470, 2720, 2528, 424, 97, 518, 2709, - /* 2150 */ 536, 450, 537, 1937, 1938, 236, 2707, 541, 543, 544, - /* 2160 */ 545, 1936, 2706, 2705, 459, 1990, 1991, 2044, 2703, 2046, - /* 2170 */ 2049, 2050, 2051, 2052, 2053, 2054, 2055, 2056, 876, 869, - /* 2180 */ 551, 2702, 901, 900, 865, 2078, 2079, 553, 2799, 451, - /* 2190 */ 2085, 2087, 2088, 2089, 2090, 2092, 2, 59, 57, 2701, - /* 2200 */ 555, 2700, 557, 881, 1924, 500, 2675, 1986, 240, 2674, - /* 2210 */ 242, 1882, 98, 1881, 2652, 2651, 2650, 2649, 569, 570, - /* 2220 */ 2648, 1984, 2592, 2091, 574, 1818, 2589, 577, 2588, 2799, - /* 2230 */ 2582, 580, 2817, 581, 2579, 245, 2578, 101, 2577, 2576, - /* 2240 */ 2581, 2580, 2575, 247, 881, 2574, 2572, 2571, 2764, 2570, - /* 2250 */ 880, 249, 2569, 2086, 597, 599, 868, 2567, 2566, 2565, - /* 2260 */ 2564, 2563, 2587, 2562, 2561, 2560, 2585, 1992, 2568, 2559, - /* 2270 */ 2558, 2557, 2555, 2817, 2554, 2553, 2552, 2551, 2550, 2549, - /* 2280 */ 251, 2548, 107, 2547, 2546, 2545, 2617, 2586, 2584, 2764, - /* 2290 */ 2544, 880, 2543, 256, 2541, 2798, 2542, 1003, 2846, 636, - /* 2300 */ 15, 638, 133, 2800, 884, 2802, 2803, 879, 2540, 2539, - /* 2310 */ 867, 2847, 903, 2799, 2537, 1824, 2367, 2884, 259, 2909, - /* 2320 */ 1669, 1673, 2366, 494, 2905, 448, 2365, 1665, 881, 2364, - /* 2330 */ 2362, 2359, 449, 656, 2358, 260, 2798, 2094, 2095, 2846, - /* 2340 */ 660, 2351, 664, 133, 2800, 884, 2802, 2803, 879, 658, - /* 2350 */ 262, 867, 2847, 903, 657, 662, 661, 2817, 2882, 666, - /* 2360 */ 2909, 665, 2338, 263, 494, 2905, 2312, 265, 668, 93, - /* 2370 */ 211, 1546, 2784, 2764, 222, 880, 2047, 2057, 676, 2311, - /* 2380 */ 267, 2673, 94, 2669, 2659, 2647, 2093, 2096, 274, 276, - /* 2390 */ 2646, 279, 2623, 281, 2616, 2454, 2361, 2357, 699, 697, - /* 2400 */ 698, 1987, 2355, 1985, 1595, 701, 702, 2353, 866, 703, - /* 2410 */ 705, 707, 706, 2350, 709, 710, 711, 2333, 2331, 2332, - /* 2420 */ 2798, 2330, 2308, 2846, 2456, 1751, 287, 198, 2800, 884, - /* 2430 */ 2802, 2803, 879, 1750, 2455, 867, 2847, 903, 1990, 1991, - /* 2440 */ 2044, 1654, 2046, 2049, 2050, 2051, 2052, 2053, 2054, 2055, - /* 2450 */ 2056, 876, 869, 1655, 1637, 901, 900, 865, 2078, 2079, - /* 2460 */ 965, 85, 1653, 2085, 2087, 2088, 2089, 2090, 2092, 2, - /* 2470 */ 195, 1650, 1648, 2799, 1646, 406, 1645, 1644, 2968, 1643, - /* 2480 */ 1642, 967, 1639, 1638, 2348, 1636, 475, 2346, 881, 476, - /* 2490 */ 2337, 2335, 477, 745, 404, 88, 478, 748, 87, 2307, - /* 2500 */ 2306, 2305, 752, 2304, 754, 2303, 2302, 756, 758, 443, - /* 2510 */ 2672, 1918, 140, 1920, 1917, 1922, 2799, 2817, 33, 79, - /* 2520 */ 2668, 264, 654, 652, 649, 647, 68, 309, 2658, 1888, - /* 2530 */ 1890, 881, 69, 2764, 779, 880, 1892, 192, 780, 1907, - /* 2540 */ 768, 2645, 313, 2644, 1867, 3012, 1866, 22, 35, 795, - /* 2550 */ 785, 787, 483, 2172, 6, 2230, 7, 17, 2204, 23, - /* 2560 */ 2817, 318, 24, 215, 37, 801, 316, 74, 797, 799, - /* 2570 */ 227, 2211, 202, 214, 36, 2785, 2764, 95, 880, 2198, - /* 2580 */ 2798, 2168, 228, 2846, 77, 26, 2245, 133, 2800, 884, - /* 2590 */ 2802, 2803, 879, 2170, 229, 867, 2847, 903, 2250, 2251, - /* 2600 */ 2244, 488, 860, 25, 2909, 2249, 75, 2248, 494, 2905, - /* 2610 */ 489, 2152, 2151, 333, 207, 70, 71, 2643, 2622, 119, - /* 2620 */ 2621, 846, 118, 2798, 120, 340, 2846, 2615, 348, 121, - /* 2630 */ 134, 2800, 884, 2802, 2803, 879, 2104, 2206, 867, 2847, - /* 2640 */ 903, 852, 217, 27, 13, 11, 2114, 2909, 346, 81, - /* 2650 */ 349, 2908, 2905, 2103, 2002, 2061, 854, 208, 218, 21, - /* 2660 */ 100, 99, 571, 18, 2060, 243, 28, 351, 29, 20, - /* 2670 */ 49, 916, 919, 922, 925, 50, 2037, 2059, 563, 561, - /* 2680 */ 2614, 16, 30, 122, 2029, 883, 887, 31, 2799, 2451, - /* 2690 */ 889, 82, 440, 353, 123, 550, 894, 91, 546, 542, - /* 2700 */ 538, 535, 564, 881, 128, 2859, 895, 359, 2858, 2264, - /* 2710 */ 2073, 2799, 902, 80, 2263, 904, 1732, 908, 519, 910, - /* 2720 */ 912, 1729, 915, 913, 918, 1728, 881, 1725, 1719, 1717, - /* 2730 */ 921, 924, 2817, 1723, 129, 383, 1722, 130, 1721, 1720, - /* 2740 */ 1745, 92, 1741, 1593, 939, 1633, 1632, 1631, 2764, 1628, - /* 2750 */ 880, 1625, 1624, 1623, 1622, 2817, 953, 1620, 1618, 1663, - /* 2760 */ 1617, 336, 1616, 234, 955, 1662, 1611, 1614, 1613, 1612, - /* 2770 */ 1610, 2764, 1609, 880, 1608, 1657, 1605, 1604, 1659, 1601, - /* 2780 */ 1599, 1600, 1598, 2356, 975, 2354, 977, 979, 2352, 976, - /* 2790 */ 983, 980, 2349, 981, 985, 2798, 987, 989, 2846, 991, - /* 2800 */ 2327, 984, 134, 2800, 884, 2802, 2803, 879, 2329, 988, - /* 2810 */ 867, 2847, 903, 771, 1535, 993, 2301, 1518, 882, 2909, - /* 2820 */ 997, 2846, 1523, 862, 2905, 134, 2800, 884, 2802, 2803, - /* 2830 */ 879, 1006, 1525, 867, 2847, 903, 389, 2799, 1001, 2267, - /* 2840 */ 1988, 402, 2909, 1004, 1005, 2267, 453, 2905, 2267, 2267, - /* 2850 */ 390, 2267, 881, 2267, 2267, 2267, 2799, 2267, 2267, 2267, - /* 2860 */ 2267, 2267, 2267, 2267, 2267, 994, 220, 2267, 2267, 2267, - /* 2870 */ 2267, 881, 2267, 2267, 2267, 990, 986, 982, 978, 2267, - /* 2880 */ 385, 2817, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, - /* 2890 */ 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2764, 2267, 880, - /* 2900 */ 2817, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, - /* 2910 */ 2267, 2267, 2267, 2267, 2267, 2267, 2764, 2267, 880, 2267, - /* 2920 */ 2267, 484, 2267, 2799, 2267, 2267, 132, 2267, 2267, 2267, - /* 2930 */ 2267, 358, 2267, 2267, 2267, 2267, 2267, 2267, 881, 2267, - /* 2940 */ 485, 2267, 2267, 2267, 2798, 2267, 2267, 2846, 2267, 2267, - /* 2950 */ 2267, 433, 2800, 884, 2802, 2803, 879, 2267, 2267, 867, - /* 2960 */ 2847, 903, 851, 2798, 2267, 2267, 2846, 2817, 2267, 2267, - /* 2970 */ 433, 2800, 884, 2802, 2803, 879, 2267, 2267, 867, 2847, - /* 2980 */ 903, 2267, 2267, 2764, 2267, 880, 2267, 2267, 2267, 2267, - /* 2990 */ 2799, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, - /* 3000 */ 2267, 2267, 2267, 2267, 2267, 881, 2267, 356, 2267, 857, - /* 3010 */ 2267, 2799, 339, 2267, 2267, 2267, 2267, 338, 2267, 2267, - /* 3020 */ 2267, 2267, 2267, 2267, 2267, 2267, 878, 2267, 2267, 2267, - /* 3030 */ 2798, 2267, 2267, 2846, 2817, 2267, 308, 426, 2800, 884, - /* 3040 */ 2802, 2803, 879, 2267, 2267, 867, 2847, 903, 2267, 2267, - /* 3050 */ 2764, 2267, 880, 2267, 2267, 2817, 2267, 2267, 2267, 2267, - /* 3060 */ 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, - /* 3070 */ 2267, 2764, 2267, 880, 2267, 2267, 2267, 2267, 2267, 2267, - /* 3080 */ 2799, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, - /* 3090 */ 2267, 815, 2267, 2267, 2267, 881, 2267, 2798, 2267, 2267, - /* 3100 */ 2846, 2267, 2267, 2267, 201, 2800, 884, 2802, 2803, 879, - /* 3110 */ 2267, 2267, 867, 2847, 903, 2267, 2267, 2267, 2798, 2267, - /* 3120 */ 2267, 2846, 2267, 2267, 2817, 432, 2800, 884, 2802, 2803, - /* 3130 */ 879, 2267, 2267, 867, 2847, 903, 2267, 2875, 2267, 2267, - /* 3140 */ 2764, 2267, 880, 2267, 2267, 2267, 2267, 2267, 2267, 2267, - /* 3150 */ 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, - /* 3160 */ 2267, 2799, 2267, 2267, 498, 2267, 2267, 3029, 2267, 2267, - /* 3170 */ 2267, 2267, 2267, 2267, 2267, 2267, 881, 2267, 2267, 2267, - /* 3180 */ 2267, 2267, 2267, 2267, 2267, 2267, 2799, 2798, 2267, 2267, - /* 3190 */ 2846, 2267, 2267, 2267, 433, 2800, 884, 2802, 2803, 879, - /* 3200 */ 2267, 881, 867, 2847, 903, 2817, 2267, 2799, 2267, 2267, - /* 3210 */ 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, - /* 3220 */ 2267, 2764, 881, 880, 2267, 2267, 2267, 2267, 2267, 2267, - /* 3230 */ 2817, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, - /* 3240 */ 2267, 2267, 2267, 2267, 2267, 493, 2764, 2267, 880, 2267, - /* 3250 */ 2267, 2817, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, - /* 3260 */ 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2764, 2798, 880, - /* 3270 */ 499, 2846, 2267, 2267, 2267, 418, 2800, 884, 2802, 2803, - /* 3280 */ 879, 2267, 2267, 867, 2847, 903, 2267, 2267, 2267, 2267, - /* 3290 */ 2267, 501, 2267, 2798, 2267, 2267, 2846, 2267, 2267, 2267, - /* 3300 */ 433, 2800, 884, 2802, 2803, 879, 2267, 2267, 867, 2847, - /* 3310 */ 903, 2267, 2267, 2267, 2798, 2267, 2267, 2846, 2267, 2799, - /* 3320 */ 2267, 433, 2800, 884, 2802, 2803, 879, 2267, 2267, 867, - /* 3330 */ 2847, 903, 2267, 2267, 881, 2267, 2267, 2267, 2267, 2799, - /* 3340 */ 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, - /* 3350 */ 2267, 2267, 2267, 2267, 881, 2267, 2267, 2267, 2799, 2267, - /* 3360 */ 2267, 2267, 2267, 2817, 2267, 2267, 2267, 2267, 2267, 2267, - /* 3370 */ 2267, 2267, 2267, 881, 2267, 2267, 2267, 2267, 2267, 2764, - /* 3380 */ 2267, 880, 2267, 2817, 2267, 2267, 2267, 2267, 2267, 2267, - /* 3390 */ 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2764, - /* 3400 */ 2267, 880, 2817, 2267, 2267, 2267, 2267, 2267, 2267, 2267, - /* 3410 */ 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2764, 2267, - /* 3420 */ 880, 2267, 2267, 2267, 2267, 2799, 2798, 2267, 2267, 2846, - /* 3430 */ 2267, 2267, 2267, 414, 2800, 884, 2802, 2803, 879, 2267, - /* 3440 */ 881, 867, 2847, 903, 2267, 2267, 764, 2267, 2267, 2846, - /* 3450 */ 2267, 2267, 2267, 428, 2800, 884, 2802, 2803, 879, 2267, - /* 3460 */ 2267, 867, 2847, 903, 2267, 2798, 2267, 2267, 2846, 2817, - /* 3470 */ 2267, 2267, 410, 2800, 884, 2802, 2803, 879, 2267, 2267, - /* 3480 */ 867, 2847, 903, 2267, 2267, 2764, 2267, 880, 2267, 2267, - /* 3490 */ 2267, 2267, 2799, 2267, 2267, 2267, 2267, 2267, 2267, 2267, - /* 3500 */ 2267, 2267, 2267, 2267, 2267, 2267, 2267, 881, 2267, 2267, - /* 3510 */ 2267, 2267, 2799, 2267, 2267, 2267, 2267, 2267, 2267, 2267, - /* 3520 */ 2267, 2267, 2267, 2267, 2267, 2267, 2267, 881, 2267, 2267, - /* 3530 */ 2267, 2267, 2798, 2267, 2267, 2846, 2817, 2267, 2267, 407, - /* 3540 */ 2800, 884, 2802, 2803, 879, 2267, 2267, 867, 2847, 903, - /* 3550 */ 2267, 2267, 2764, 2267, 880, 2267, 2817, 2267, 2267, 2267, - /* 3560 */ 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, - /* 3570 */ 2267, 2267, 2764, 2267, 880, 2267, 2267, 2267, 2267, 2267, - /* 3580 */ 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2799, - /* 3590 */ 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2798, - /* 3600 */ 2267, 2267, 2846, 2267, 881, 2267, 411, 2800, 884, 2802, - /* 3610 */ 2803, 879, 2267, 2267, 867, 2847, 903, 2267, 2267, 2798, - /* 3620 */ 2267, 2267, 2846, 2267, 2267, 2267, 425, 2800, 884, 2802, - /* 3630 */ 2803, 879, 2267, 2817, 867, 2847, 903, 2267, 2267, 2267, - /* 3640 */ 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2764, - /* 3650 */ 2267, 880, 2267, 2267, 2267, 2267, 2799, 2267, 2267, 2267, - /* 3660 */ 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, - /* 3670 */ 2267, 881, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2799, - /* 3680 */ 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, - /* 3690 */ 2267, 2267, 2267, 2267, 881, 2267, 2798, 2267, 2267, 2846, - /* 3700 */ 2817, 2267, 2799, 412, 2800, 884, 2802, 2803, 879, 2267, - /* 3710 */ 2267, 867, 2847, 903, 2267, 2267, 2764, 881, 880, 2267, - /* 3720 */ 2267, 2267, 2267, 2817, 2267, 2267, 2267, 2267, 2267, 2267, - /* 3730 */ 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2764, - /* 3740 */ 2267, 880, 2267, 2267, 2267, 2267, 2817, 2267, 2267, 2267, - /* 3750 */ 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, - /* 3760 */ 2267, 2267, 2764, 2798, 880, 2267, 2846, 2799, 2267, 2267, - /* 3770 */ 413, 2800, 884, 2802, 2803, 879, 2267, 2267, 867, 2847, - /* 3780 */ 903, 2267, 881, 2267, 2267, 2267, 2798, 2267, 2267, 2846, - /* 3790 */ 2799, 2267, 2267, 429, 2800, 884, 2802, 2803, 879, 2267, - /* 3800 */ 2267, 867, 2847, 903, 2267, 881, 2267, 2267, 2267, 2798, - /* 3810 */ 2267, 2817, 2846, 2799, 2267, 2267, 415, 2800, 884, 2802, - /* 3820 */ 2803, 879, 2267, 2267, 867, 2847, 903, 2764, 881, 880, - /* 3830 */ 2267, 2267, 2267, 2267, 2817, 2267, 2267, 2267, 2267, 2267, - /* 3840 */ 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, - /* 3850 */ 2764, 2267, 880, 2267, 2267, 2267, 2267, 2817, 2267, 2267, - /* 3860 */ 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, - /* 3870 */ 2267, 2267, 2267, 2764, 2798, 880, 2267, 2846, 2267, 2267, - /* 3880 */ 2799, 430, 2800, 884, 2802, 2803, 879, 2267, 2267, 867, - /* 3890 */ 2847, 903, 2267, 2267, 2267, 881, 2267, 2798, 2267, 2267, - /* 3900 */ 2846, 2267, 2267, 2267, 416, 2800, 884, 2802, 2803, 879, - /* 3910 */ 2267, 2267, 867, 2847, 903, 2267, 2267, 2267, 2267, 2267, - /* 3920 */ 2798, 2267, 2267, 2846, 2817, 2267, 2267, 431, 2800, 884, - /* 3930 */ 2802, 2803, 879, 2267, 2267, 867, 2847, 903, 2267, 2267, - /* 3940 */ 2764, 2267, 880, 2267, 2267, 2267, 2267, 2267, 2267, 2267, - /* 3950 */ 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, - /* 3960 */ 2267, 2267, 2799, 2267, 2267, 2267, 2267, 2267, 2267, 2267, - /* 3970 */ 2267, 2267, 2267, 2267, 2267, 2267, 2267, 881, 2267, 2267, - /* 3980 */ 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2798, 2267, 2267, - /* 3990 */ 2846, 2267, 2799, 2267, 417, 2800, 884, 2802, 2803, 879, - /* 4000 */ 2267, 2267, 867, 2847, 903, 2267, 2817, 881, 2267, 2267, - /* 4010 */ 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, - /* 4020 */ 2267, 2267, 2764, 2267, 880, 2267, 2267, 2267, 2267, 2267, - /* 4030 */ 2267, 2267, 2267, 2267, 2267, 2267, 2817, 2267, 2267, 2267, - /* 4040 */ 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, - /* 4050 */ 2267, 2267, 2764, 2267, 880, 2267, 2267, 2267, 2267, 2799, - /* 4060 */ 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2798, - /* 4070 */ 2267, 2267, 2846, 2267, 881, 2267, 408, 2800, 884, 2802, - /* 4080 */ 2803, 879, 2799, 2267, 867, 2847, 903, 2267, 2267, 2267, - /* 4090 */ 2267, 2267, 2267, 2267, 2267, 2267, 2267, 881, 2267, 2798, - /* 4100 */ 2267, 2267, 2846, 2817, 2267, 2799, 419, 2800, 884, 2802, - /* 4110 */ 2803, 879, 2267, 2267, 867, 2847, 903, 2267, 2267, 2764, - /* 4120 */ 881, 880, 2267, 2267, 2267, 2267, 2817, 2267, 2267, 2267, - /* 4130 */ 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, - /* 4140 */ 2267, 2267, 2764, 2267, 880, 2267, 2267, 2267, 2267, 2817, - /* 4150 */ 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, - /* 4160 */ 2267, 2267, 2267, 2267, 2267, 2764, 2798, 880, 2267, 2846, - /* 4170 */ 2799, 2267, 2267, 420, 2800, 884, 2802, 2803, 879, 2267, - /* 4180 */ 2267, 867, 2847, 903, 2267, 881, 2267, 2267, 2267, 2798, - /* 4190 */ 2267, 2267, 2846, 2799, 2267, 2267, 421, 2800, 884, 2802, - /* 4200 */ 2803, 879, 2267, 2267, 867, 2847, 903, 2267, 881, 2267, - /* 4210 */ 2267, 2267, 2798, 2267, 2817, 2846, 2799, 2267, 2267, 422, - /* 4220 */ 2800, 884, 2802, 2803, 879, 2267, 2267, 867, 2847, 903, - /* 4230 */ 2764, 881, 880, 2267, 2267, 2267, 2267, 2817, 2267, 2267, - /* 4240 */ 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, - /* 4250 */ 2267, 2267, 2267, 2764, 2267, 880, 2267, 2267, 2267, 2267, - /* 4260 */ 2817, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, - /* 4270 */ 2267, 2267, 2267, 2267, 2267, 2267, 2764, 2798, 880, 2267, - /* 4280 */ 2846, 2267, 2267, 2799, 438, 2800, 884, 2802, 2803, 879, - /* 4290 */ 2267, 2267, 867, 2847, 903, 2267, 2267, 2267, 881, 2267, - /* 4300 */ 2798, 2267, 2267, 2846, 2267, 2267, 2267, 439, 2800, 884, - /* 4310 */ 2802, 2803, 879, 2267, 2267, 867, 2847, 903, 2267, 2267, - /* 4320 */ 2267, 2267, 2267, 2798, 2267, 2267, 2846, 2817, 2267, 2267, - /* 4330 */ 2811, 2800, 884, 2802, 2803, 879, 2267, 2267, 867, 2847, - /* 4340 */ 903, 2267, 2267, 2764, 2267, 880, 2267, 2267, 2267, 2267, - /* 4350 */ 2799, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, - /* 4360 */ 2267, 2267, 2267, 2267, 2267, 881, 2267, 2267, 2267, 2267, - /* 4370 */ 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, - /* 4380 */ 2799, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, - /* 4390 */ 2798, 2267, 2267, 2846, 2817, 881, 2267, 2810, 2800, 884, - /* 4400 */ 2802, 2803, 879, 2267, 2267, 867, 2847, 903, 2267, 2267, - /* 4410 */ 2764, 2267, 880, 2267, 2267, 2267, 2267, 2267, 2267, 2267, - /* 4420 */ 2267, 2267, 2267, 2267, 2817, 2267, 2267, 2267, 2267, 2267, - /* 4430 */ 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, - /* 4440 */ 2764, 2267, 880, 2267, 2267, 2267, 2267, 2799, 2267, 2267, - /* 4450 */ 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2798, 2267, 2267, - /* 4460 */ 2846, 2267, 881, 2267, 2809, 2800, 884, 2802, 2803, 879, - /* 4470 */ 2799, 2267, 867, 2847, 903, 2267, 2267, 2267, 2267, 2267, - /* 4480 */ 2267, 2267, 2267, 2267, 2267, 881, 2267, 2798, 2267, 2267, - /* 4490 */ 2846, 2817, 2267, 2799, 455, 2800, 884, 2802, 2803, 879, - /* 4500 */ 2267, 2267, 867, 2847, 903, 2267, 2267, 2764, 881, 880, - /* 4510 */ 2267, 2267, 2267, 2267, 2817, 2267, 2267, 2267, 2267, 2267, - /* 4520 */ 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, - /* 4530 */ 2764, 2267, 880, 2267, 2267, 2267, 2267, 2817, 2267, 2267, - /* 4540 */ 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, - /* 4550 */ 2267, 2267, 2267, 2764, 2798, 880, 2267, 2846, 2799, 2267, - /* 4560 */ 2267, 456, 2800, 884, 2802, 2803, 879, 2267, 2267, 867, - /* 4570 */ 2847, 903, 2267, 881, 2267, 2267, 2267, 2798, 2267, 2267, - /* 4580 */ 2846, 2799, 2267, 2267, 452, 2800, 884, 2802, 2803, 879, - /* 4590 */ 2267, 2267, 867, 2847, 903, 2267, 881, 2267, 2267, 2267, - /* 4600 */ 2798, 2267, 2817, 2846, 2267, 2267, 2267, 457, 2800, 884, - /* 4610 */ 2802, 2803, 879, 2267, 2267, 867, 2847, 903, 2764, 2267, - /* 4620 */ 880, 2267, 2267, 2267, 2267, 2817, 2267, 2267, 2267, 2267, - /* 4630 */ 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, - /* 4640 */ 2267, 2764, 2267, 880, 2267, 2267, 2267, 2267, 2267, 2267, - /* 4650 */ 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, 2267, - /* 4660 */ 2267, 2267, 2267, 2267, 2267, 882, 2267, 2267, 2846, 2267, - /* 4670 */ 2267, 2267, 428, 2800, 884, 2802, 2803, 879, 2267, 2267, - /* 4680 */ 867, 2847, 903, 2267, 2267, 2267, 2267, 2267, 2798, 2267, - /* 4690 */ 2267, 2846, 2267, 2267, 2267, 427, 2800, 884, 2802, 2803, - /* 4700 */ 879, 2267, 2267, 867, 2847, 903, + /* 0 */ 825, 674, 3019, 682, 675, 2321, 675, 2321, 3014, 2487, + /* 10 */ 3014, 2470, 59, 57, 873, 58, 56, 55, 54, 53, + /* 20 */ 502, 2274, 1991, 2638, 266, 872, 824, 230, 677, 3018, + /* 30 */ 2329, 3015, 826, 3015, 3017, 832, 1989, 494, 2096, 2365, + /* 40 */ 2806, 2638, 150, 2635, 887, 149, 148, 147, 146, 145, + /* 50 */ 144, 143, 142, 141, 815, 840, 2016, 577, 9, 52, + /* 60 */ 51, 2636, 887, 58, 56, 55, 54, 53, 2091, 150, + /* 70 */ 771, 870, 149, 148, 147, 146, 145, 144, 143, 142, + /* 80 */ 141, 900, 1997, 52, 51, 2824, 2543, 58, 56, 55, + /* 90 */ 54, 53, 52, 51, 492, 2020, 58, 56, 55, 54, + /* 100 */ 53, 2771, 204, 882, 331, 2541, 900, 1991, 639, 637, + /* 110 */ 2764, 439, 1005, 519, 244, 60, 976, 975, 974, 973, + /* 120 */ 532, 1989, 972, 971, 174, 966, 965, 964, 963, 962, + /* 130 */ 961, 960, 173, 954, 953, 952, 531, 530, 949, 948, + /* 140 */ 947, 210, 209, 946, 527, 945, 944, 943, 2805, 1541, + /* 150 */ 223, 2853, 2099, 2100, 2273, 133, 2807, 886, 2809, 2810, + /* 160 */ 881, 900, 671, 869, 2854, 905, 2530, 1997, 1548, 2163, + /* 170 */ 212, 669, 2916, 508, 665, 661, 496, 2912, 159, 158, + /* 180 */ 157, 156, 155, 154, 153, 152, 151, 905, 901, 2483, + /* 190 */ 196, 2052, 2062, 1543, 1546, 1547, 231, 1005, 2414, 40, + /* 200 */ 2073, 2098, 2101, 126, 2963, 52, 51, 829, 160, 58, + /* 210 */ 56, 55, 54, 53, 1723, 774, 1992, 720, 1990, 2931, + /* 220 */ 52, 51, 3019, 868, 58, 56, 55, 54, 53, 1714, + /* 230 */ 932, 931, 930, 1718, 929, 1720, 1721, 928, 925, 2019, + /* 240 */ 1729, 922, 1731, 1732, 919, 916, 913, 524, 2928, 74, + /* 250 */ 2536, 2538, 690, 1995, 1996, 2049, 62, 2051, 2054, 2055, + /* 260 */ 2056, 2057, 2058, 2059, 2060, 2061, 878, 871, 226, 112, + /* 270 */ 903, 902, 867, 2083, 2084, 2085, 2086, 2087, 2090, 2092, + /* 280 */ 2093, 2094, 2095, 2097, 2, 59, 57, 2188, 467, 2049, + /* 290 */ 443, 2806, 2014, 502, 74, 1991, 44, 354, 2476, 621, + /* 300 */ 3019, 1992, 466, 1990, 1659, 1568, 883, 1567, 3014, 1989, + /* 310 */ 641, 2096, 2936, 2160, 2161, 2162, 2936, 2936, 2936, 2936, + /* 320 */ 2936, 165, 63, 2221, 691, 402, 600, 3018, 643, 2520, + /* 330 */ 2021, 3015, 3016, 444, 602, 2256, 2824, 833, 1995, 1996, + /* 340 */ 2017, 2091, 1723, 1569, 870, 580, 693, 514, 19, 568, + /* 350 */ 1661, 567, 2771, 45, 882, 1997, 554, 1714, 932, 931, + /* 360 */ 930, 1718, 929, 1720, 1721, 877, 876, 697, 1729, 875, + /* 370 */ 1731, 1732, 874, 916, 913, 52, 51, 529, 528, 58, + /* 380 */ 56, 55, 54, 53, 566, 1005, 465, 2781, 15, 692, + /* 390 */ 2631, 807, 806, 2219, 2220, 2222, 2223, 2224, 588, 2805, + /* 400 */ 34, 1998, 2853, 96, 473, 471, 133, 2807, 886, 2809, + /* 410 */ 2810, 881, 336, 2472, 869, 2854, 905, 2785, 395, 171, + /* 420 */ 172, 180, 2887, 2916, 125, 2099, 2100, 496, 2912, 2618, + /* 430 */ 2597, 2473, 629, 628, 627, 626, 625, 620, 619, 618, + /* 440 */ 617, 449, 2580, 338, 607, 606, 605, 604, 603, 597, + /* 450 */ 596, 595, 2474, 590, 589, 463, 2806, 901, 2483, 581, + /* 460 */ 1824, 1825, 395, 306, 2052, 2062, 1843, 2787, 2789, 497, + /* 470 */ 942, 840, 1863, 1864, 2098, 2101, 508, 160, 482, 2685, + /* 480 */ 48, 905, 2458, 2233, 470, 468, 725, 722, 338, 1992, + /* 490 */ 905, 1990, 2163, 197, 558, 2285, 868, 1671, 52, 51, + /* 500 */ 136, 2824, 58, 56, 55, 54, 53, 830, 724, 522, + /* 510 */ 2485, 1670, 723, 2271, 268, 175, 338, 2771, 677, 882, + /* 520 */ 2329, 1862, 1865, 2686, 560, 556, 1995, 1996, 2049, 1960, + /* 530 */ 2051, 2054, 2055, 2056, 2057, 2058, 2059, 2060, 2061, 878, + /* 540 */ 871, 14, 13, 903, 902, 867, 2083, 2084, 1917, 1918, + /* 550 */ 1919, 2090, 2092, 2093, 2094, 2095, 2097, 2, 59, 57, + /* 560 */ 483, 2685, 513, 512, 2805, 456, 502, 2853, 1991, 2368, + /* 570 */ 78, 133, 2807, 886, 2809, 2810, 881, 900, 2931, 869, + /* 580 */ 2854, 905, 1989, 2001, 2096, 219, 212, 644, 2916, 2806, + /* 590 */ 52, 51, 496, 2912, 58, 56, 55, 54, 53, 901, + /* 600 */ 2483, 305, 2638, 535, 883, 304, 2331, 2927, 534, 772, + /* 610 */ 775, 761, 2612, 614, 2091, 2126, 504, 870, 613, 526, + /* 620 */ 2964, 19, 2635, 887, 12, 2543, 612, 755, 1997, 759, + /* 630 */ 757, 302, 301, 462, 2824, 2936, 2160, 2161, 2162, 2936, + /* 640 */ 2936, 2936, 2936, 2936, 2541, 2724, 741, 740, 739, 2931, + /* 650 */ 2771, 810, 882, 731, 166, 735, 2140, 2296, 1005, 734, + /* 660 */ 791, 15, 517, 464, 733, 738, 476, 475, 3014, 219, + /* 670 */ 732, 2213, 62, 2781, 474, 728, 727, 726, 2926, 115, + /* 680 */ 2127, 74, 2016, 2295, 446, 2214, 3020, 230, 481, 2765, + /* 690 */ 763, 3015, 826, 684, 2677, 633, 2611, 2805, 2099, 2100, + /* 700 */ 2853, 2016, 791, 2785, 133, 2807, 886, 2809, 2810, 881, + /* 710 */ 3014, 2019, 869, 2854, 905, 2465, 469, 2163, 2771, 3034, + /* 720 */ 1997, 2916, 345, 346, 825, 496, 2912, 344, 3020, 230, + /* 730 */ 2806, 2212, 3014, 3015, 826, 52, 51, 2052, 2062, 58, + /* 740 */ 56, 55, 54, 53, 2771, 883, 3, 2098, 2101, 2017, + /* 750 */ 824, 230, 508, 2787, 2790, 3015, 826, 2016, 2132, 506, + /* 760 */ 65, 694, 1992, 255, 1990, 219, 905, 905, 933, 868, + /* 770 */ 816, 811, 804, 800, 47, 2824, 388, 74, 43, 498, + /* 780 */ 2121, 2122, 2123, 2124, 2125, 2129, 2130, 2131, 632, 254, + /* 790 */ 2263, 2771, 2611, 882, 2165, 2166, 2167, 2168, 2169, 1995, + /* 800 */ 1996, 2049, 630, 2051, 2054, 2055, 2056, 2057, 2058, 2059, + /* 810 */ 2060, 2061, 878, 871, 901, 2483, 903, 902, 867, 2083, + /* 820 */ 2084, 2625, 2806, 695, 2090, 2092, 2093, 2094, 2095, 2097, + /* 830 */ 2, 12, 59, 57, 235, 837, 169, 883, 2805, 2971, + /* 840 */ 502, 2853, 1991, 2068, 1959, 411, 2807, 886, 2809, 2810, + /* 850 */ 881, 679, 32, 869, 2854, 905, 1989, 676, 2096, 2806, + /* 860 */ 570, 2160, 2161, 2162, 908, 569, 338, 2824, 250, 901, + /* 870 */ 2483, 2468, 1836, 1837, 883, 338, 2984, 516, 515, 586, + /* 880 */ 2607, 1762, 1763, 2771, 336, 882, 2537, 2538, 2091, 67, + /* 890 */ 790, 870, 52, 51, 2711, 19, 58, 56, 55, 54, + /* 900 */ 53, 861, 1997, 2888, 2824, 52, 51, 901, 2483, 58, + /* 910 */ 56, 55, 54, 53, 106, 716, 715, 791, 2262, 105, + /* 920 */ 2771, 12, 882, 10, 1548, 3014, 2294, 574, 2053, 2293, + /* 930 */ 2805, 184, 1005, 2853, 246, 15, 2725, 133, 2807, 886, + /* 940 */ 2809, 2810, 881, 3020, 230, 869, 2854, 905, 3015, 826, + /* 950 */ 1546, 1547, 3034, 394, 2916, 814, 718, 717, 496, 2912, + /* 960 */ 839, 199, 2924, 2925, 2691, 167, 2929, 2805, 1571, 1572, + /* 970 */ 2853, 338, 2099, 2100, 133, 2807, 886, 2809, 2810, 881, + /* 980 */ 737, 736, 869, 2854, 905, 2824, 104, 2771, 2192, 3034, + /* 990 */ 2771, 2916, 2050, 791, 2016, 496, 2912, 901, 2483, 2020, + /* 1000 */ 2232, 3014, 2455, 2806, 940, 186, 185, 937, 936, 935, + /* 1010 */ 183, 2052, 2062, 2204, 66, 592, 2607, 575, 883, 3020, + /* 1020 */ 230, 2098, 2101, 2107, 3015, 826, 307, 2543, 2020, 2016, + /* 1030 */ 112, 72, 741, 740, 739, 507, 1992, 505, 1990, 731, + /* 1040 */ 166, 735, 788, 868, 2457, 734, 2541, 193, 2824, 775, + /* 1050 */ 733, 738, 476, 475, 623, 2607, 732, 813, 2488, 2477, + /* 1060 */ 474, 728, 727, 726, 2771, 863, 882, 2888, 901, 2483, + /* 1070 */ 248, 2563, 909, 1995, 1996, 2049, 942, 2051, 2054, 2055, + /* 1080 */ 2056, 2057, 2058, 2059, 2060, 2061, 878, 871, 594, 313, + /* 1090 */ 903, 902, 867, 2083, 2084, 2806, 901, 2483, 2090, 2092, + /* 1100 */ 2093, 2094, 2095, 2097, 2, 59, 57, 2102, 956, 253, + /* 1110 */ 883, 2805, 802, 502, 2853, 1991, 696, 401, 198, 2807, + /* 1120 */ 886, 2809, 2810, 881, 1550, 2292, 869, 2854, 905, 1989, + /* 1130 */ 2015, 2096, 777, 2677, 901, 2483, 2806, 52, 51, 221, + /* 1140 */ 2824, 58, 56, 55, 54, 53, 224, 901, 2483, 1675, + /* 1150 */ 194, 883, 2454, 3007, 608, 193, 2771, 288, 882, 522, + /* 1160 */ 2485, 2091, 2415, 1674, 870, 2053, 2489, 609, 792, 2974, + /* 1170 */ 970, 968, 225, 205, 2291, 1997, 39, 958, 55, 54, + /* 1180 */ 53, 2824, 714, 710, 706, 702, 2771, 287, 2543, 940, + /* 1190 */ 186, 185, 937, 936, 935, 183, 523, 2771, 2487, 882, + /* 1200 */ 2053, 233, 1568, 2805, 1567, 1005, 2853, 2541, 60, 2290, + /* 1210 */ 133, 2807, 886, 2809, 2810, 881, 901, 2483, 869, 2854, + /* 1220 */ 905, 959, 901, 2483, 2440, 3034, 616, 2916, 2020, 2050, + /* 1230 */ 2286, 496, 2912, 285, 2021, 2771, 610, 2977, 284, 646, + /* 1240 */ 1569, 615, 2478, 204, 2805, 2099, 2100, 2853, 2543, 901, + /* 1250 */ 2483, 133, 2807, 886, 2809, 2810, 881, 901, 2483, 869, + /* 1260 */ 2854, 905, 2289, 2021, 2050, 3018, 3034, 844, 2916, 308, + /* 1270 */ 2771, 525, 496, 2912, 116, 170, 2806, 316, 2887, 2288, + /* 1280 */ 549, 193, 52, 51, 2052, 2062, 58, 56, 55, 54, + /* 1290 */ 53, 883, 2488, 2948, 2098, 2101, 2543, 940, 186, 185, + /* 1300 */ 937, 936, 935, 183, 237, 271, 901, 2483, 1891, 1992, + /* 1310 */ 2185, 1990, 837, 169, 282, 852, 868, 194, 273, 280, + /* 1320 */ 2287, 2824, 42, 2771, 278, 688, 843, 2486, 52, 51, + /* 1330 */ 332, 162, 58, 56, 55, 54, 53, 2771, 808, 882, + /* 1340 */ 2771, 901, 2483, 270, 2016, 102, 1995, 1996, 2049, 2128, + /* 1350 */ 2051, 2054, 2055, 2056, 2057, 2058, 2059, 2060, 2061, 878, + /* 1360 */ 871, 349, 324, 903, 902, 867, 2083, 2084, 838, 901, + /* 1370 */ 2483, 2090, 2092, 2093, 2094, 2095, 2097, 2, 59, 57, + /* 1380 */ 2284, 2771, 934, 2806, 2805, 2534, 502, 2853, 1991, 857, + /* 1390 */ 2069, 133, 2807, 886, 2809, 2810, 881, 2545, 880, 869, + /* 1400 */ 2854, 905, 1989, 164, 2096, 819, 3034, 2283, 2916, 2806, + /* 1410 */ 2825, 938, 496, 2912, 2534, 52, 51, 2301, 998, 58, + /* 1420 */ 56, 55, 54, 53, 883, 52, 51, 2133, 2824, 58, + /* 1430 */ 56, 55, 54, 53, 2091, 837, 169, 870, 139, 2924, + /* 1440 */ 2925, 2771, 167, 2929, 2771, 724, 882, 41, 1997, 723, + /* 1450 */ 2282, 901, 2483, 2590, 2824, 901, 2483, 901, 2483, 448, + /* 1460 */ 447, 2281, 2322, 2021, 46, 2543, 901, 2483, 2771, 509, + /* 1470 */ 2771, 356, 882, 2352, 2174, 894, 2280, 895, 1005, 2279, + /* 1480 */ 2000, 60, 2081, 518, 2542, 2096, 899, 2278, 2277, 2276, + /* 1490 */ 2806, 2805, 901, 2483, 2853, 742, 317, 584, 434, 2807, + /* 1500 */ 886, 2809, 2810, 881, 879, 883, 869, 2854, 905, 860, + /* 1510 */ 2881, 2771, 384, 939, 1654, 2091, 2534, 2805, 2099, 2100, + /* 1520 */ 2853, 2967, 2771, 2071, 133, 2807, 886, 2809, 2810, 881, + /* 1530 */ 866, 90, 869, 2854, 905, 2824, 2715, 2771, 1999, 2891, + /* 1540 */ 2771, 2916, 2407, 837, 169, 496, 2912, 117, 2771, 2771, + /* 1550 */ 2771, 2771, 642, 882, 2265, 2266, 293, 2052, 2062, 291, + /* 1560 */ 1655, 206, 2924, 836, 729, 161, 835, 2098, 2101, 295, + /* 1570 */ 52, 51, 294, 3014, 58, 56, 55, 54, 53, 2050, + /* 1580 */ 297, 730, 1992, 296, 1990, 103, 765, 1652, 764, 868, + /* 1590 */ 542, 824, 230, 828, 2350, 2406, 3015, 826, 2805, 299, + /* 1600 */ 2341, 2853, 298, 805, 1650, 201, 2807, 886, 2809, 2810, + /* 1610 */ 881, 950, 176, 869, 2854, 905, 744, 2184, 176, 1995, + /* 1620 */ 1996, 2049, 746, 2051, 2054, 2055, 2056, 2057, 2058, 2059, + /* 1630 */ 2060, 2061, 878, 871, 1624, 1632, 903, 902, 867, 2083, + /* 1640 */ 2084, 131, 2806, 128, 2090, 2092, 2093, 2094, 2095, 2097, + /* 1650 */ 2, 59, 57, 798, 484, 61, 61, 883, 213, 502, + /* 1660 */ 2339, 1991, 2003, 1982, 184, 1958, 343, 827, 3035, 200, + /* 1670 */ 2924, 2925, 488, 167, 2929, 1989, 1605, 2096, 2074, 2806, + /* 1680 */ 768, 1633, 749, 951, 52, 51, 38, 2824, 58, 56, + /* 1690 */ 55, 54, 53, 2333, 883, 1907, 14, 13, 511, 510, + /* 1700 */ 1983, 1915, 89, 2771, 812, 882, 1622, 2091, 2118, 2792, + /* 1710 */ 870, 363, 362, 2616, 846, 365, 364, 903, 902, 533, + /* 1720 */ 2002, 1997, 1606, 61, 2824, 2090, 2092, 2093, 2094, 2095, + /* 1730 */ 2097, 76, 2328, 551, 61, 61, 2208, 791, 2218, 2217, + /* 1740 */ 2771, 322, 882, 61, 61, 3014, 2531, 842, 994, 347, + /* 1750 */ 2805, 1005, 784, 2853, 60, 748, 2968, 133, 2807, 886, + /* 1760 */ 2809, 2810, 881, 3020, 230, 869, 2854, 905, 3015, 826, + /* 1770 */ 762, 89, 2889, 2794, 2916, 2978, 52, 51, 496, 2912, + /* 1780 */ 58, 56, 55, 54, 53, 849, 820, 2805, 181, 303, + /* 1790 */ 2853, 2099, 2100, 776, 133, 2807, 886, 2809, 2810, 881, + /* 1800 */ 367, 366, 869, 2854, 905, 751, 2072, 162, 184, 862, + /* 1810 */ 821, 2916, 745, 743, 2134, 496, 2912, 2082, 2075, 300, + /* 1820 */ 369, 368, 2806, 334, 86, 911, 1860, 2063, 52, 51, + /* 1830 */ 2052, 2062, 58, 56, 55, 54, 53, 883, 329, 2617, + /* 1840 */ 2098, 2101, 371, 370, 373, 372, 375, 374, 377, 376, + /* 1850 */ 791, 337, 182, 2441, 1850, 1992, 5, 1990, 3014, 379, + /* 1860 */ 378, 536, 868, 381, 380, 84, 184, 2824, 163, 137, + /* 1870 */ 83, 359, 383, 382, 181, 541, 3020, 230, 460, 2014, + /* 1880 */ 562, 3015, 826, 2771, 2070, 882, 550, 2024, 561, 238, + /* 1890 */ 898, 1705, 1995, 1996, 2049, 564, 2051, 2054, 2055, 2056, + /* 1900 */ 2057, 2058, 2059, 2060, 2061, 878, 871, 400, 1736, 903, + /* 1910 */ 902, 867, 2083, 2084, 841, 239, 241, 2090, 2092, 2093, + /* 1920 */ 2094, 2095, 2097, 2, 59, 57, 1884, 393, 578, 2806, + /* 1930 */ 2805, 2015, 502, 2853, 1991, 1744, 2067, 134, 2807, 886, + /* 1940 */ 2809, 2810, 881, 585, 883, 869, 2854, 905, 1989, 1751, + /* 1950 */ 2096, 1749, 252, 587, 2916, 591, 593, 187, 2915, 2912, + /* 1960 */ 635, 598, 611, 631, 648, 622, 2609, 624, 634, 636, + /* 1970 */ 647, 791, 645, 257, 2824, 258, 650, 261, 652, 3014, + /* 1980 */ 2091, 653, 655, 870, 657, 2022, 672, 4, 673, 680, + /* 1990 */ 2771, 681, 882, 2017, 1997, 685, 269, 3020, 230, 683, + /* 2000 */ 2023, 108, 3015, 826, 686, 2025, 272, 529, 528, 687, + /* 2010 */ 689, 2026, 275, 277, 499, 2632, 109, 2005, 2027, 2626, + /* 2020 */ 110, 2806, 111, 1703, 1005, 283, 286, 60, 698, 719, + /* 2030 */ 2701, 1998, 113, 2096, 752, 753, 883, 2805, 767, 138, + /* 2040 */ 2853, 721, 437, 2471, 435, 2807, 886, 2809, 2810, 881, + /* 2050 */ 290, 2467, 869, 2854, 905, 114, 292, 769, 189, 177, + /* 2060 */ 135, 2469, 2464, 2091, 2099, 2100, 2824, 309, 190, 191, + /* 2070 */ 396, 2018, 2678, 314, 779, 778, 786, 1997, 809, 2983, + /* 2080 */ 2698, 847, 2771, 319, 882, 2982, 818, 8, 780, 2697, + /* 2090 */ 312, 795, 783, 2955, 203, 323, 785, 796, 325, 326, + /* 2100 */ 794, 327, 793, 2052, 2062, 823, 822, 865, 831, 2935, + /* 2110 */ 489, 834, 2019, 2098, 2101, 321, 330, 3013, 168, 333, + /* 2120 */ 2182, 328, 3037, 2180, 216, 339, 178, 845, 1992, 2805, + /* 2130 */ 1990, 1, 2853, 2646, 397, 868, 134, 2807, 886, 2809, + /* 2140 */ 2810, 881, 2645, 850, 869, 2854, 905, 851, 2644, 398, + /* 2150 */ 2932, 179, 493, 2916, 232, 855, 352, 864, 2912, 73, + /* 2160 */ 888, 890, 357, 399, 124, 1995, 1996, 2049, 892, 2051, + /* 2170 */ 2054, 2055, 2056, 2057, 2058, 2059, 2060, 2061, 878, 871, + /* 2180 */ 858, 893, 903, 902, 867, 2083, 2084, 2484, 2763, 2897, + /* 2190 */ 2090, 2092, 2093, 2094, 2095, 2097, 2, 59, 57, 2806, + /* 2200 */ 2762, 2758, 127, 907, 386, 502, 403, 1991, 2757, 2749, + /* 2210 */ 1520, 2006, 2748, 2001, 883, 1000, 1001, 2740, 389, 188, + /* 2220 */ 2739, 1989, 997, 2096, 1002, 1004, 2755, 2754, 2746, 2745, + /* 2230 */ 2734, 2733, 2752, 390, 2751, 2743, 771, 438, 2742, 425, + /* 2240 */ 472, 2731, 2730, 2806, 2824, 2723, 2728, 436, 2009, 2011, + /* 2250 */ 2727, 2535, 520, 2091, 405, 407, 870, 2722, 883, 2721, + /* 2260 */ 2771, 426, 882, 97, 452, 903, 902, 1997, 2716, 538, + /* 2270 */ 539, 1942, 1943, 2090, 2092, 2093, 2094, 2095, 2097, 64, + /* 2280 */ 453, 543, 236, 2714, 545, 546, 547, 1941, 2824, 461, + /* 2290 */ 2710, 553, 2709, 2708, 555, 557, 2707, 1005, 2713, 2712, + /* 2300 */ 15, 559, 1929, 2682, 2771, 240, 882, 884, 2681, 242, + /* 2310 */ 2853, 98, 1887, 1886, 134, 2807, 886, 2809, 2810, 881, + /* 2320 */ 2659, 2658, 869, 2854, 905, 2657, 571, 572, 2656, 2655, + /* 2330 */ 2599, 2916, 576, 1823, 2596, 455, 2912, 2099, 2100, 2595, + /* 2340 */ 579, 2589, 582, 2586, 2585, 583, 245, 101, 2584, 2583, + /* 2350 */ 2588, 2805, 247, 2587, 2853, 2582, 2581, 2579, 134, 2807, + /* 2360 */ 886, 2809, 2810, 881, 251, 773, 869, 2854, 905, 2578, + /* 2370 */ 2577, 249, 599, 2576, 601, 2916, 2052, 2062, 2574, 2573, + /* 2380 */ 2913, 2572, 2571, 1008, 2570, 2594, 2098, 2101, 2569, 2568, + /* 2390 */ 2567, 2592, 2575, 2566, 2565, 2564, 2562, 2561, 2560, 2559, + /* 2400 */ 2558, 1992, 392, 1990, 2557, 2556, 107, 2555, 868, 2554, + /* 2410 */ 2553, 2552, 2624, 2593, 2591, 2551, 2550, 996, 220, 2549, + /* 2420 */ 256, 2548, 2547, 1829, 638, 640, 2546, 992, 988, 984, + /* 2430 */ 980, 2544, 387, 2372, 259, 450, 2371, 2370, 1995, 1996, + /* 2440 */ 2049, 2369, 2051, 2054, 2055, 2056, 2057, 2058, 2059, 2060, + /* 2450 */ 2061, 878, 871, 1668, 1672, 903, 902, 867, 2083, 2084, + /* 2460 */ 451, 1676, 2367, 2090, 2092, 2093, 2094, 2095, 2097, 2, + /* 2470 */ 195, 260, 2364, 660, 262, 408, 658, 659, 132, 2363, + /* 2480 */ 662, 663, 664, 360, 2356, 666, 668, 2343, 263, 667, + /* 2490 */ 670, 2317, 2806, 265, 406, 88, 211, 93, 87, 2791, + /* 2500 */ 1549, 222, 678, 2316, 267, 94, 2680, 883, 2676, 445, + /* 2510 */ 2666, 2654, 274, 2653, 853, 279, 276, 2806, 2630, 2623, + /* 2520 */ 2459, 264, 656, 654, 651, 649, 281, 2366, 2362, 699, + /* 2530 */ 700, 1598, 883, 701, 2360, 703, 704, 2824, 705, 2358, + /* 2540 */ 707, 709, 708, 2355, 712, 711, 713, 2338, 2336, 2337, + /* 2550 */ 2335, 2313, 2461, 2771, 1755, 882, 967, 289, 1756, 358, + /* 2560 */ 2460, 859, 2824, 1658, 341, 1657, 1656, 74, 85, 340, + /* 2570 */ 2353, 1653, 1651, 1649, 1648, 969, 1647, 1640, 2771, 2351, + /* 2580 */ 882, 1646, 1645, 477, 478, 2342, 479, 747, 310, 1642, + /* 2590 */ 1641, 2340, 2312, 1639, 480, 750, 2311, 2310, 2309, 754, + /* 2600 */ 2805, 756, 486, 2853, 2308, 758, 75, 198, 2807, 886, + /* 2610 */ 2809, 2810, 881, 2307, 140, 869, 2854, 905, 1923, 1925, + /* 2620 */ 1922, 760, 2679, 1927, 311, 2805, 2675, 33, 2853, 79, + /* 2630 */ 1895, 1912, 435, 2807, 886, 2809, 2810, 881, 68, 1893, + /* 2640 */ 869, 2854, 905, 2665, 192, 781, 315, 2652, 2806, 69, + /* 2650 */ 782, 1897, 770, 2651, 3019, 797, 17, 22, 2975, 1872, + /* 2660 */ 100, 99, 573, 883, 1871, 243, 485, 6, 787, 7, + /* 2670 */ 789, 23, 24, 35, 215, 37, 2806, 25, 565, 563, + /* 2680 */ 801, 228, 2235, 318, 227, 2792, 803, 2209, 2175, 799, + /* 2690 */ 2177, 883, 442, 2824, 320, 552, 2216, 77, 548, 544, + /* 2700 */ 540, 537, 566, 202, 214, 36, 26, 2250, 95, 2771, + /* 2710 */ 229, 882, 2249, 490, 2254, 2253, 2203, 2173, 2255, 491, + /* 2720 */ 335, 2824, 71, 2256, 2650, 2157, 2156, 2629, 119, 118, + /* 2730 */ 2628, 207, 342, 487, 2211, 217, 348, 2771, 2622, 882, + /* 2740 */ 848, 120, 81, 351, 18, 854, 121, 27, 2109, 2108, + /* 2750 */ 13, 2007, 21, 2119, 208, 28, 2805, 218, 70, 2853, + /* 2760 */ 11, 338, 2066, 435, 2807, 886, 2809, 2810, 881, 2042, + /* 2770 */ 29, 869, 2854, 905, 2806, 20, 350, 2065, 49, 918, + /* 2780 */ 921, 924, 856, 927, 2805, 50, 2621, 2853, 2064, 883, + /* 2790 */ 16, 428, 2807, 886, 2809, 2810, 881, 30, 122, 869, + /* 2800 */ 2854, 905, 2034, 31, 128, 2806, 353, 82, 891, 2456, + /* 2810 */ 361, 889, 896, 355, 123, 2269, 91, 906, 897, 2824, + /* 2820 */ 880, 2078, 2866, 2865, 904, 80, 1596, 1737, 910, 1734, + /* 2830 */ 521, 912, 914, 885, 2268, 2771, 915, 882, 1733, 917, + /* 2840 */ 920, 1730, 1724, 923, 1722, 817, 926, 129, 385, 1728, + /* 2850 */ 2824, 130, 1727, 1750, 1726, 1725, 2806, 92, 1746, 941, + /* 2860 */ 1636, 1635, 1634, 1631, 1628, 1627, 2771, 1626, 882, 1625, + /* 2870 */ 1623, 883, 955, 1621, 957, 1620, 1619, 1666, 234, 1665, + /* 2880 */ 1617, 1614, 2805, 1616, 1615, 2853, 1613, 1612, 1611, 201, + /* 2890 */ 2807, 886, 2809, 2810, 881, 1662, 1660, 869, 2854, 905, + /* 2900 */ 1608, 2824, 1607, 1604, 1603, 1602, 1601, 2361, 977, 978, + /* 2910 */ 2359, 981, 982, 2805, 2357, 979, 2853, 2771, 983, 882, + /* 2920 */ 434, 2807, 886, 2809, 2810, 881, 985, 986, 869, 2854, + /* 2930 */ 905, 987, 2882, 2354, 989, 990, 991, 2334, 993, 2332, + /* 2940 */ 995, 500, 1538, 2806, 2306, 1521, 999, 1526, 1528, 391, + /* 2950 */ 1003, 1006, 3036, 1993, 404, 1007, 2272, 2272, 883, 2272, + /* 2960 */ 2272, 2272, 2272, 2272, 2805, 2272, 2272, 2853, 2806, 2272, + /* 2970 */ 2272, 435, 2807, 886, 2809, 2810, 881, 2272, 2272, 869, + /* 2980 */ 2854, 905, 2272, 883, 2272, 2272, 2272, 2272, 2824, 2272, + /* 2990 */ 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2272, + /* 3000 */ 2272, 2272, 2272, 2272, 2771, 2272, 882, 2272, 2272, 2272, + /* 3010 */ 2272, 2272, 2272, 2824, 2272, 2272, 2272, 2272, 2272, 2272, + /* 3020 */ 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2272, 495, 2771, + /* 3030 */ 2272, 882, 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2272, + /* 3040 */ 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2806, + /* 3050 */ 2272, 2805, 2272, 501, 2853, 2272, 2272, 2272, 420, 2807, + /* 3060 */ 886, 2809, 2810, 881, 883, 2272, 869, 2854, 905, 2272, + /* 3070 */ 2272, 2272, 2272, 2272, 2272, 2272, 2805, 2272, 2272, 2853, + /* 3080 */ 2806, 2272, 2272, 435, 2807, 886, 2809, 2810, 881, 2272, + /* 3090 */ 2272, 869, 2854, 905, 2824, 883, 2272, 2272, 2272, 2272, + /* 3100 */ 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2272, + /* 3110 */ 2771, 2272, 882, 2272, 2272, 2272, 2272, 2272, 2272, 2272, + /* 3120 */ 2272, 2272, 2272, 2272, 2272, 2824, 2272, 2272, 2272, 2272, + /* 3130 */ 2272, 2272, 2272, 2272, 503, 2272, 2272, 2272, 2272, 2272, + /* 3140 */ 2272, 2771, 2272, 882, 2272, 2272, 2272, 2806, 2272, 2272, + /* 3150 */ 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2805, 2272, 2272, + /* 3160 */ 2853, 2272, 883, 2272, 435, 2807, 886, 2809, 2810, 881, + /* 3170 */ 2272, 2272, 869, 2854, 905, 2806, 2272, 2272, 2272, 2272, + /* 3180 */ 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2805, 2272, + /* 3190 */ 883, 2853, 2824, 2272, 2272, 416, 2807, 886, 2809, 2810, + /* 3200 */ 881, 2272, 2272, 869, 2854, 905, 2272, 2272, 2771, 2272, + /* 3210 */ 882, 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2272, + /* 3220 */ 2824, 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2272, + /* 3230 */ 2272, 2272, 2272, 2272, 2272, 2272, 2771, 2272, 882, 2272, + /* 3240 */ 2272, 2272, 2272, 2272, 2806, 2272, 2272, 2272, 2272, 2272, + /* 3250 */ 2272, 2272, 2272, 2272, 2272, 766, 2272, 2272, 2853, 883, + /* 3260 */ 2272, 2272, 430, 2807, 886, 2809, 2810, 881, 2272, 2272, + /* 3270 */ 869, 2854, 905, 2806, 2272, 2272, 2272, 2272, 2272, 2272, + /* 3280 */ 2272, 2272, 2272, 2805, 2272, 2272, 2853, 2272, 883, 2824, + /* 3290 */ 412, 2807, 886, 2809, 2810, 881, 2272, 2272, 869, 2854, + /* 3300 */ 905, 2272, 2272, 2272, 2272, 2771, 2272, 882, 2272, 2806, + /* 3310 */ 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2824, 2272, + /* 3320 */ 2272, 2272, 2272, 2272, 883, 2272, 2272, 2272, 2272, 2272, + /* 3330 */ 2272, 2272, 2272, 2272, 2771, 2272, 882, 2272, 2272, 2272, + /* 3340 */ 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2272, + /* 3350 */ 2272, 2272, 2805, 2272, 2824, 2853, 2272, 2272, 2272, 409, + /* 3360 */ 2807, 886, 2809, 2810, 881, 2272, 2272, 869, 2854, 905, + /* 3370 */ 2771, 2272, 882, 2272, 2272, 2272, 2272, 2272, 2272, 2272, + /* 3380 */ 2272, 2805, 2272, 2272, 2853, 2272, 2272, 2272, 413, 2807, + /* 3390 */ 886, 2809, 2810, 881, 2806, 2272, 869, 2854, 905, 2272, + /* 3400 */ 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2272, 883, + /* 3410 */ 2272, 2272, 2272, 2272, 2272, 2272, 2806, 2805, 2272, 2272, + /* 3420 */ 2853, 2272, 2272, 2272, 427, 2807, 886, 2809, 2810, 881, + /* 3430 */ 2272, 883, 869, 2854, 905, 2272, 2272, 2806, 2272, 2824, + /* 3440 */ 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2272, + /* 3450 */ 2272, 2272, 883, 2272, 2272, 2771, 2272, 882, 2272, 2272, + /* 3460 */ 2272, 2824, 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2272, + /* 3470 */ 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2771, 2272, 882, + /* 3480 */ 2272, 2806, 2824, 2272, 2272, 2272, 2272, 2272, 2272, 2272, + /* 3490 */ 2272, 2272, 2272, 2272, 2272, 2272, 883, 2272, 2771, 2272, + /* 3500 */ 882, 2272, 2805, 2272, 2272, 2853, 2272, 2272, 2272, 414, + /* 3510 */ 2807, 886, 2809, 2810, 881, 2272, 2272, 869, 2854, 905, + /* 3520 */ 2272, 2272, 2806, 2272, 2805, 2272, 2824, 2853, 2272, 2272, + /* 3530 */ 2272, 415, 2807, 886, 2809, 2810, 881, 883, 2272, 869, + /* 3540 */ 2854, 905, 2771, 2272, 882, 2805, 2272, 2272, 2853, 2272, + /* 3550 */ 2806, 2272, 431, 2807, 886, 2809, 2810, 881, 2272, 2272, + /* 3560 */ 869, 2854, 905, 2272, 2272, 883, 2272, 2824, 2272, 2272, + /* 3570 */ 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2272, + /* 3580 */ 2272, 2272, 2272, 2771, 2272, 882, 2272, 2806, 2272, 2805, + /* 3590 */ 2272, 2272, 2853, 2272, 2272, 2824, 417, 2807, 886, 2809, + /* 3600 */ 2810, 881, 883, 2272, 869, 2854, 905, 2272, 2272, 2272, + /* 3610 */ 2272, 2771, 2272, 882, 2272, 2272, 2272, 2272, 2272, 2272, + /* 3620 */ 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2272, + /* 3630 */ 2805, 2272, 2824, 2853, 2272, 2272, 2272, 432, 2807, 886, + /* 3640 */ 2809, 2810, 881, 2272, 2272, 869, 2854, 905, 2771, 2272, + /* 3650 */ 882, 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2805, 2272, + /* 3660 */ 2272, 2853, 2272, 2272, 2272, 418, 2807, 886, 2809, 2810, + /* 3670 */ 881, 2806, 2272, 869, 2854, 905, 2272, 2272, 2272, 2272, + /* 3680 */ 2272, 2272, 2272, 2272, 2272, 2272, 883, 2272, 2272, 2272, + /* 3690 */ 2272, 2272, 2272, 2806, 2272, 2805, 2272, 2272, 2853, 2272, + /* 3700 */ 2272, 2272, 433, 2807, 886, 2809, 2810, 881, 883, 2272, + /* 3710 */ 869, 2854, 905, 2272, 2272, 2272, 2824, 2272, 2272, 2272, + /* 3720 */ 2272, 2272, 2806, 2272, 2272, 2272, 2272, 2272, 2272, 2272, + /* 3730 */ 2272, 2272, 2771, 2272, 882, 2272, 2272, 883, 2824, 2272, + /* 3740 */ 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2272, + /* 3750 */ 2272, 2272, 2272, 2272, 2771, 2272, 882, 2272, 2806, 2272, + /* 3760 */ 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2824, 2272, 2272, + /* 3770 */ 2272, 2272, 2272, 883, 2272, 2272, 2272, 2272, 2272, 2805, + /* 3780 */ 2272, 2272, 2853, 2771, 2272, 882, 419, 2807, 886, 2809, + /* 3790 */ 2810, 881, 2272, 2272, 869, 2854, 905, 2272, 2272, 2272, + /* 3800 */ 2272, 2805, 2272, 2824, 2853, 2272, 2272, 2272, 410, 2807, + /* 3810 */ 886, 2809, 2810, 881, 2272, 2272, 869, 2854, 905, 2771, + /* 3820 */ 2272, 882, 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2272, + /* 3830 */ 2805, 2272, 2272, 2853, 2272, 2272, 2272, 421, 2807, 886, + /* 3840 */ 2809, 2810, 881, 2806, 2272, 869, 2854, 905, 2272, 2272, + /* 3850 */ 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2272, 883, 2272, + /* 3860 */ 2272, 2272, 2272, 2272, 2272, 2806, 2805, 2272, 2272, 2853, + /* 3870 */ 2272, 2272, 2272, 422, 2807, 886, 2809, 2810, 881, 2272, + /* 3880 */ 883, 869, 2854, 905, 2806, 2272, 2272, 2272, 2824, 2272, + /* 3890 */ 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2272, 883, + /* 3900 */ 2272, 2272, 2272, 2272, 2771, 2272, 882, 2272, 2272, 2272, + /* 3910 */ 2824, 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2272, + /* 3920 */ 2272, 2272, 2272, 2272, 2272, 2272, 2771, 2272, 882, 2824, + /* 3930 */ 2272, 2272, 2272, 2806, 2272, 2272, 2272, 2272, 2272, 2272, + /* 3940 */ 2272, 2272, 2272, 2272, 2272, 2771, 2272, 882, 883, 2272, + /* 3950 */ 2272, 2805, 2272, 2272, 2853, 2272, 2272, 2272, 423, 2807, + /* 3960 */ 886, 2809, 2810, 881, 2272, 2272, 869, 2854, 905, 2272, + /* 3970 */ 2272, 2806, 2272, 2805, 2272, 2272, 2853, 2272, 2824, 2272, + /* 3980 */ 424, 2807, 886, 2809, 2810, 881, 883, 2272, 869, 2854, + /* 3990 */ 905, 2272, 2805, 2272, 2771, 2853, 882, 2272, 2272, 440, + /* 4000 */ 2807, 886, 2809, 2810, 881, 2272, 2272, 869, 2854, 905, + /* 4010 */ 2272, 2272, 2272, 2272, 2272, 2272, 2824, 2272, 2272, 2272, + /* 4020 */ 2806, 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2272, + /* 4030 */ 2272, 2272, 2771, 2272, 882, 883, 2272, 2272, 2272, 2272, + /* 4040 */ 2272, 2805, 2272, 2272, 2853, 2272, 2272, 2272, 441, 2807, + /* 4050 */ 886, 2809, 2810, 881, 2806, 2272, 869, 2854, 905, 2272, + /* 4060 */ 2272, 2272, 2272, 2272, 2272, 2824, 2272, 2272, 2272, 883, + /* 4070 */ 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2805, + /* 4080 */ 2272, 2771, 2853, 882, 2272, 2272, 2818, 2807, 886, 2809, + /* 4090 */ 2810, 881, 2272, 2272, 869, 2854, 905, 2272, 2272, 2824, + /* 4100 */ 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2272, + /* 4110 */ 2272, 2272, 2272, 2272, 2272, 2771, 2272, 882, 2272, 2272, + /* 4120 */ 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2805, 2272, + /* 4130 */ 2272, 2853, 2272, 2272, 2272, 2817, 2807, 886, 2809, 2810, + /* 4140 */ 881, 2272, 2806, 869, 2854, 905, 2272, 2272, 2272, 2272, + /* 4150 */ 2272, 2272, 2272, 2272, 2272, 2272, 2272, 883, 2272, 2272, + /* 4160 */ 2272, 2806, 2805, 2272, 2272, 2853, 2272, 2272, 2272, 2816, + /* 4170 */ 2807, 886, 2809, 2810, 881, 2272, 883, 869, 2854, 905, + /* 4180 */ 2272, 2272, 2806, 2272, 2272, 2272, 2272, 2824, 2272, 2272, + /* 4190 */ 2272, 2272, 2272, 2272, 2272, 2272, 2272, 883, 2272, 2272, + /* 4200 */ 2272, 2272, 2272, 2771, 2272, 882, 2824, 2272, 2272, 2272, + /* 4210 */ 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2272, + /* 4220 */ 2272, 2272, 2771, 2272, 882, 2272, 2806, 2824, 2272, 2272, + /* 4230 */ 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2272, + /* 4240 */ 2272, 883, 2272, 2771, 2272, 882, 2272, 2272, 2272, 2272, + /* 4250 */ 2805, 2272, 2272, 2853, 2272, 2272, 2272, 457, 2807, 886, + /* 4260 */ 2809, 2810, 881, 2272, 2272, 869, 2854, 905, 2806, 2805, + /* 4270 */ 2272, 2824, 2853, 2272, 2272, 2272, 458, 2807, 886, 2809, + /* 4280 */ 2810, 881, 2272, 883, 869, 2854, 905, 2771, 2272, 882, + /* 4290 */ 2805, 2272, 2272, 2853, 2806, 2272, 2272, 454, 2807, 886, + /* 4300 */ 2809, 2810, 881, 2272, 2272, 869, 2854, 905, 2272, 883, + /* 4310 */ 2272, 2272, 2272, 2824, 2272, 2272, 2272, 2272, 2272, 2272, + /* 4320 */ 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2771, + /* 4330 */ 2272, 882, 2272, 2272, 2805, 2272, 2272, 2853, 2272, 2824, + /* 4340 */ 2272, 459, 2807, 886, 2809, 2810, 881, 2272, 2272, 869, + /* 4350 */ 2854, 905, 2272, 2272, 2272, 2771, 2272, 882, 2272, 2272, + /* 4360 */ 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2272, 2272, + /* 4370 */ 2272, 2272, 2272, 2272, 2272, 2272, 884, 2272, 2272, 2853, + /* 4380 */ 2272, 2272, 2272, 430, 2807, 886, 2809, 2810, 881, 2272, + /* 4390 */ 2272, 869, 2854, 905, 2272, 2272, 2272, 2272, 2272, 2272, + /* 4400 */ 2272, 2272, 2805, 2272, 2272, 2853, 2272, 2272, 2272, 429, + /* 4410 */ 2807, 886, 2809, 2810, 881, 2272, 2272, 869, 2854, 905, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 431, 430, 396, 530, 449, 399, 400, 431, 384, 440, - /* 10 */ 441, 538, 12, 13, 401, 439, 401, 446, 463, 411, - /* 20 */ 20, 0, 22, 431, 469, 470, 450, 419, 418, 556, - /* 30 */ 557, 20, 440, 441, 561, 562, 36, 434, 38, 0, - /* 40 */ 437, 387, 21, 519, 520, 24, 25, 26, 27, 28, - /* 50 */ 29, 30, 31, 32, 8, 9, 402, 447, 12, 13, - /* 60 */ 14, 15, 16, 0, 451, 452, 20, 454, 68, 21, - /* 70 */ 457, 71, 24, 25, 26, 27, 28, 29, 30, 31, - /* 80 */ 32, 426, 82, 491, 492, 431, 431, 24, 25, 26, - /* 90 */ 27, 28, 29, 30, 31, 32, 20, 473, 483, 484, - /* 100 */ 497, 447, 478, 449, 14, 20, 434, 497, 498, 499, - /* 110 */ 20, 0, 112, 458, 511, 115, 77, 78, 79, 80, - /* 120 */ 81, 511, 83, 84, 85, 86, 87, 88, 89, 90, + /* 0 */ 531, 396, 531, 396, 399, 400, 399, 400, 539, 433, + /* 10 */ 539, 433, 12, 13, 433, 12, 13, 14, 15, 16, + /* 20 */ 20, 0, 22, 450, 397, 444, 557, 558, 401, 558, + /* 30 */ 403, 562, 563, 562, 563, 33, 36, 464, 38, 0, + /* 40 */ 387, 450, 21, 470, 471, 24, 25, 26, 27, 28, + /* 50 */ 29, 30, 31, 32, 20, 402, 20, 401, 44, 8, + /* 60 */ 9, 470, 471, 12, 13, 14, 15, 16, 68, 21, + /* 70 */ 494, 71, 24, 25, 26, 27, 28, 29, 30, 31, + /* 80 */ 32, 20, 82, 8, 9, 432, 432, 12, 13, 14, + /* 90 */ 15, 16, 8, 9, 440, 20, 12, 13, 14, 15, + /* 100 */ 16, 448, 533, 450, 535, 451, 20, 22, 452, 453, + /* 110 */ 435, 455, 112, 438, 458, 115, 77, 78, 79, 80, + /* 120 */ 81, 36, 83, 84, 85, 86, 87, 88, 89, 90, /* 130 */ 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, - /* 140 */ 101, 102, 103, 104, 105, 106, 107, 108, 494, 4, - /* 150 */ 402, 497, 152, 153, 530, 501, 502, 503, 504, 505, - /* 160 */ 506, 20, 538, 509, 510, 511, 55, 401, 23, 497, - /* 170 */ 516, 68, 518, 146, 147, 20, 522, 523, 151, 431, - /* 180 */ 556, 557, 0, 511, 20, 561, 562, 401, 402, 431, - /* 190 */ 115, 191, 192, 48, 49, 50, 542, 439, 115, 2, - /* 200 */ 115, 201, 202, 115, 550, 8, 9, 421, 450, 12, - /* 210 */ 13, 14, 15, 16, 112, 429, 216, 114, 218, 20, - /* 220 */ 8, 9, 119, 223, 12, 13, 14, 15, 16, 127, - /* 230 */ 128, 129, 130, 131, 132, 133, 134, 135, 136, 193, - /* 240 */ 138, 139, 140, 141, 142, 143, 144, 473, 449, 483, - /* 250 */ 484, 503, 478, 253, 254, 255, 115, 257, 258, 259, - /* 260 */ 260, 261, 262, 263, 264, 265, 266, 267, 469, 470, + /* 140 */ 101, 102, 103, 104, 105, 106, 107, 108, 495, 4, + /* 150 */ 431, 498, 152, 153, 0, 502, 503, 504, 505, 506, + /* 160 */ 507, 20, 54, 510, 511, 512, 447, 82, 23, 155, + /* 170 */ 517, 63, 519, 498, 66, 67, 523, 524, 24, 25, + /* 180 */ 26, 27, 28, 29, 30, 31, 32, 512, 401, 402, + /* 190 */ 411, 191, 192, 48, 49, 50, 543, 112, 419, 2, + /* 200 */ 116, 201, 202, 117, 551, 8, 9, 33, 421, 12, + /* 210 */ 13, 14, 15, 16, 112, 20, 216, 430, 218, 501, + /* 220 */ 8, 9, 3, 223, 12, 13, 14, 15, 16, 127, + /* 230 */ 128, 129, 130, 131, 132, 133, 134, 135, 136, 20, + /* 240 */ 138, 139, 140, 141, 142, 143, 144, 446, 530, 115, + /* 250 */ 449, 450, 20, 253, 254, 255, 115, 257, 258, 259, + /* 260 */ 260, 261, 262, 263, 264, 265, 266, 267, 193, 410, /* 270 */ 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, - /* 280 */ 280, 281, 282, 283, 284, 12, 13, 14, 530, 186, - /* 290 */ 18, 417, 20, 20, 420, 22, 538, 20, 387, 27, - /* 300 */ 418, 255, 30, 215, 530, 217, 20, 152, 153, 36, - /* 310 */ 38, 38, 538, 402, 556, 557, 152, 153, 73, 561, - /* 320 */ 562, 12, 13, 14, 15, 16, 54, 426, 56, 447, - /* 330 */ 556, 557, 431, 61, 62, 561, 562, 155, 250, 432, - /* 340 */ 433, 68, 431, 74, 71, 73, 112, 396, 75, 155, - /* 350 */ 399, 400, 170, 401, 402, 82, 201, 202, 447, 458, - /* 360 */ 449, 127, 128, 129, 130, 131, 132, 133, 134, 135, - /* 370 */ 136, 387, 138, 139, 140, 141, 142, 143, 144, 497, - /* 380 */ 498, 20, 432, 397, 309, 112, 114, 401, 115, 403, - /* 390 */ 449, 410, 309, 511, 309, 8, 9, 309, 126, 12, - /* 400 */ 13, 14, 15, 16, 463, 494, 20, 0, 497, 428, - /* 410 */ 469, 470, 501, 502, 503, 504, 505, 506, 507, 438, - /* 420 */ 509, 510, 511, 512, 513, 152, 153, 473, 74, 157, - /* 430 */ 158, 447, 160, 161, 162, 163, 164, 165, 166, 167, - /* 440 */ 168, 169, 196, 493, 172, 173, 174, 175, 176, 177, - /* 450 */ 178, 179, 21, 181, 182, 183, 211, 401, 402, 187, - /* 460 */ 188, 189, 401, 402, 191, 192, 194, 532, 37, 534, - /* 470 */ 39, 40, 41, 42, 201, 202, 126, 421, 526, 527, - /* 480 */ 528, 74, 530, 531, 530, 429, 241, 242, 54, 216, - /* 490 */ 538, 218, 538, 299, 300, 301, 223, 63, 8, 9, - /* 500 */ 66, 67, 12, 13, 14, 15, 16, 387, 556, 557, - /* 510 */ 556, 557, 285, 561, 562, 561, 562, 8, 9, 500, - /* 520 */ 401, 12, 13, 14, 15, 16, 253, 254, 255, 36, + /* 280 */ 280, 281, 282, 283, 284, 12, 13, 14, 429, 255, + /* 290 */ 18, 387, 20, 20, 115, 22, 520, 521, 439, 27, + /* 300 */ 531, 216, 30, 218, 36, 20, 402, 22, 539, 36, + /* 310 */ 38, 38, 298, 299, 300, 301, 302, 303, 304, 305, + /* 320 */ 306, 36, 115, 253, 401, 423, 54, 558, 56, 427, + /* 330 */ 255, 562, 563, 61, 62, 116, 432, 335, 253, 254, + /* 340 */ 20, 68, 112, 58, 71, 73, 20, 36, 75, 215, + /* 350 */ 82, 217, 448, 269, 450, 82, 73, 127, 128, 129, + /* 360 */ 130, 131, 132, 133, 134, 135, 136, 74, 138, 139, + /* 370 */ 140, 141, 142, 143, 144, 8, 9, 12, 13, 12, + /* 380 */ 13, 14, 15, 16, 250, 112, 114, 418, 115, 466, + /* 390 */ 467, 321, 322, 323, 324, 325, 326, 327, 126, 495, + /* 400 */ 33, 36, 498, 408, 41, 42, 502, 503, 504, 505, + /* 410 */ 506, 507, 193, 435, 510, 511, 512, 448, 432, 515, + /* 420 */ 425, 517, 518, 519, 408, 152, 153, 523, 524, 157, + /* 430 */ 158, 436, 160, 161, 162, 163, 164, 165, 166, 167, + /* 440 */ 168, 169, 0, 309, 172, 173, 174, 175, 176, 177, + /* 450 */ 178, 179, 436, 181, 182, 183, 387, 401, 402, 187, + /* 460 */ 188, 189, 432, 146, 191, 192, 194, 498, 499, 500, + /* 470 */ 74, 402, 152, 153, 201, 202, 498, 421, 492, 493, + /* 480 */ 268, 512, 0, 116, 121, 122, 430, 124, 309, 216, + /* 490 */ 512, 218, 155, 386, 211, 388, 223, 22, 8, 9, + /* 500 */ 432, 432, 12, 13, 14, 15, 16, 333, 145, 441, + /* 510 */ 442, 36, 149, 384, 397, 33, 309, 448, 401, 450, + /* 520 */ 403, 201, 202, 493, 241, 242, 253, 254, 255, 218, /* 530 */ 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, - /* 540 */ 267, 255, 33, 270, 271, 272, 273, 274, 529, 431, - /* 550 */ 20, 278, 279, 280, 281, 282, 283, 284, 12, 13, - /* 560 */ 387, 315, 316, 317, 318, 75, 20, 447, 22, 302, - /* 570 */ 303, 304, 305, 306, 14, 402, 458, 191, 192, 460, - /* 580 */ 20, 462, 36, 0, 38, 155, 525, 526, 527, 528, - /* 590 */ 387, 530, 531, 8, 9, 208, 20, 12, 13, 14, - /* 600 */ 15, 16, 8, 9, 431, 402, 12, 13, 14, 15, - /* 610 */ 16, 44, 397, 82, 68, 125, 401, 71, 403, 431, - /* 620 */ 447, 75, 449, 186, 20, 116, 22, 439, 82, 445, - /* 630 */ 146, 4, 448, 449, 431, 77, 78, 79, 450, 36, - /* 640 */ 36, 47, 84, 85, 86, 115, 23, 386, 90, 388, - /* 650 */ 447, 422, 449, 95, 96, 97, 98, 220, 112, 101, - /* 660 */ 431, 115, 58, 105, 106, 107, 108, 494, 12, 13, - /* 670 */ 497, 442, 49, 50, 501, 502, 503, 504, 505, 506, - /* 680 */ 190, 387, 509, 510, 511, 82, 20, 514, 22, 516, - /* 690 */ 517, 518, 36, 117, 4, 522, 523, 494, 152, 153, - /* 700 */ 497, 116, 253, 126, 501, 502, 503, 504, 505, 506, - /* 710 */ 116, 218, 509, 510, 511, 231, 232, 233, 285, 516, - /* 720 */ 287, 518, 155, 336, 58, 522, 523, 431, 298, 299, - /* 730 */ 300, 301, 302, 303, 304, 305, 306, 191, 192, 12, - /* 740 */ 13, 447, 115, 34, 251, 252, 450, 201, 202, 22, - /* 750 */ 432, 191, 36, 550, 171, 41, 42, 422, 268, 176, - /* 760 */ 401, 402, 216, 36, 218, 38, 431, 184, 13, 223, - /* 770 */ 321, 322, 323, 324, 325, 326, 327, 442, 288, 289, - /* 780 */ 290, 291, 292, 293, 294, 295, 296, 297, 145, 146, - /* 790 */ 147, 148, 149, 150, 151, 68, 401, 402, 423, 253, - /* 800 */ 254, 255, 427, 257, 258, 259, 260, 261, 262, 263, - /* 810 */ 264, 265, 266, 267, 530, 255, 270, 271, 272, 273, - /* 820 */ 274, 0, 538, 500, 278, 279, 280, 281, 282, 283, - /* 830 */ 284, 285, 12, 13, 387, 121, 122, 82, 124, 309, - /* 840 */ 20, 557, 22, 401, 402, 561, 562, 434, 431, 402, - /* 850 */ 455, 404, 529, 91, 269, 515, 36, 517, 38, 145, - /* 860 */ 432, 401, 402, 149, 190, 298, 299, 300, 301, 302, - /* 870 */ 303, 304, 305, 306, 218, 8, 9, 432, 431, 12, - /* 880 */ 13, 14, 15, 16, 0, 526, 527, 528, 68, 530, - /* 890 */ 531, 71, 401, 402, 447, 75, 449, 455, 77, 78, - /* 900 */ 79, 500, 82, 401, 402, 84, 85, 86, 491, 492, - /* 910 */ 497, 90, 421, 401, 402, 455, 95, 96, 97, 98, - /* 920 */ 0, 159, 101, 421, 511, 36, 105, 106, 107, 108, - /* 930 */ 529, 14, 112, 421, 218, 115, 309, 20, 410, 401, - /* 940 */ 387, 494, 268, 216, 497, 218, 184, 185, 501, 502, - /* 950 */ 503, 504, 505, 506, 431, 402, 509, 510, 511, 432, - /* 960 */ 198, 20, 288, 516, 441, 518, 438, 251, 252, 522, - /* 970 */ 523, 82, 152, 153, 401, 402, 401, 402, 251, 252, - /* 980 */ 253, 8, 9, 116, 431, 12, 13, 14, 15, 16, - /* 990 */ 14, 15, 16, 515, 421, 517, 421, 270, 271, 479, - /* 1000 */ 447, 311, 449, 465, 466, 278, 279, 280, 281, 282, - /* 1010 */ 283, 191, 192, 1, 2, 59, 60, 401, 402, 8, - /* 1020 */ 9, 201, 202, 12, 13, 14, 15, 16, 22, 145, - /* 1030 */ 146, 147, 148, 149, 150, 151, 216, 421, 218, 432, - /* 1040 */ 401, 402, 36, 223, 448, 449, 20, 494, 406, 407, - /* 1050 */ 497, 20, 401, 402, 501, 502, 503, 504, 505, 506, - /* 1060 */ 421, 4, 509, 510, 511, 145, 146, 147, 148, 149, - /* 1070 */ 150, 151, 421, 253, 254, 255, 19, 257, 258, 259, - /* 1080 */ 260, 261, 262, 263, 264, 265, 266, 267, 82, 116, - /* 1090 */ 270, 271, 272, 273, 274, 38, 22, 387, 278, 279, - /* 1100 */ 280, 281, 282, 283, 284, 12, 13, 14, 191, 3, - /* 1110 */ 36, 54, 402, 20, 404, 22, 563, 564, 61, 62, - /* 1120 */ 387, 432, 530, 387, 432, 68, 20, 116, 116, 36, - /* 1130 */ 538, 38, 443, 20, 193, 401, 402, 387, 8, 9, - /* 1140 */ 387, 431, 12, 13, 14, 15, 16, 401, 402, 557, - /* 1150 */ 401, 402, 402, 561, 562, 421, 82, 447, 419, 449, - /* 1160 */ 431, 68, 401, 402, 71, 387, 52, 421, 439, 388, - /* 1170 */ 421, 114, 255, 401, 402, 82, 119, 47, 2, 450, - /* 1180 */ 447, 431, 421, 447, 8, 9, 112, 431, 12, 13, - /* 1190 */ 14, 15, 16, 421, 406, 407, 255, 447, 387, 449, - /* 1200 */ 447, 415, 416, 387, 494, 112, 450, 497, 115, 401, - /* 1210 */ 402, 501, 502, 503, 504, 505, 506, 12, 13, 509, - /* 1220 */ 510, 511, 116, 387, 193, 447, 516, 22, 518, 421, - /* 1230 */ 8, 9, 522, 523, 12, 13, 14, 15, 16, 514, - /* 1240 */ 408, 36, 517, 38, 494, 152, 153, 497, 415, 416, - /* 1250 */ 38, 501, 502, 503, 504, 505, 506, 425, 447, 509, - /* 1260 */ 510, 511, 20, 447, 8, 9, 54, 435, 12, 13, - /* 1270 */ 14, 15, 16, 68, 3, 63, 64, 65, 66, 431, - /* 1280 */ 68, 255, 431, 447, 191, 192, 255, 82, 401, 402, - /* 1290 */ 216, 0, 218, 442, 201, 202, 408, 44, 450, 193, - /* 1300 */ 431, 551, 552, 47, 401, 402, 193, 193, 421, 216, - /* 1310 */ 565, 218, 401, 402, 401, 402, 223, 112, 204, 444, - /* 1320 */ 387, 68, 447, 435, 421, 473, 114, 253, 254, 401, - /* 1330 */ 402, 119, 421, 387, 421, 8, 9, 387, 116, 12, - /* 1340 */ 13, 14, 15, 16, 459, 387, 253, 254, 255, 421, + /* 540 */ 267, 1, 2, 270, 271, 272, 273, 274, 231, 232, + /* 550 */ 233, 278, 279, 280, 281, 282, 283, 284, 12, 13, + /* 560 */ 492, 493, 251, 252, 495, 75, 20, 498, 22, 0, + /* 570 */ 4, 502, 503, 504, 505, 506, 507, 20, 501, 510, + /* 580 */ 511, 512, 36, 218, 38, 432, 517, 112, 519, 387, + /* 590 */ 8, 9, 523, 524, 12, 13, 14, 15, 16, 401, + /* 600 */ 402, 147, 450, 474, 402, 151, 404, 530, 479, 126, + /* 610 */ 401, 21, 459, 171, 68, 125, 464, 71, 176, 421, + /* 620 */ 551, 75, 470, 471, 285, 432, 184, 37, 82, 39, + /* 630 */ 40, 41, 42, 440, 432, 298, 299, 300, 301, 302, + /* 640 */ 303, 304, 305, 306, 451, 474, 77, 78, 79, 501, + /* 650 */ 448, 196, 450, 84, 85, 86, 116, 387, 112, 90, + /* 660 */ 531, 115, 36, 426, 95, 96, 97, 98, 539, 432, + /* 670 */ 101, 22, 115, 418, 105, 106, 107, 108, 530, 225, + /* 680 */ 190, 115, 20, 387, 230, 36, 557, 558, 234, 435, + /* 690 */ 236, 562, 563, 484, 485, 91, 459, 495, 152, 153, + /* 700 */ 498, 20, 531, 448, 502, 503, 504, 505, 506, 507, + /* 710 */ 539, 20, 510, 511, 512, 433, 434, 155, 448, 517, + /* 720 */ 82, 519, 146, 147, 531, 523, 524, 151, 557, 558, + /* 730 */ 387, 82, 539, 562, 563, 8, 9, 191, 192, 12, + /* 740 */ 13, 14, 15, 16, 448, 402, 33, 201, 202, 20, + /* 750 */ 557, 558, 498, 498, 499, 562, 563, 20, 268, 426, + /* 760 */ 47, 401, 216, 159, 218, 432, 512, 512, 126, 223, + /* 770 */ 315, 316, 317, 318, 47, 432, 34, 115, 288, 289, + /* 780 */ 290, 291, 292, 293, 294, 295, 296, 297, 184, 185, + /* 790 */ 208, 448, 459, 450, 302, 303, 304, 305, 306, 253, + /* 800 */ 254, 255, 198, 257, 258, 259, 260, 261, 262, 263, + /* 810 */ 264, 265, 266, 267, 401, 402, 270, 271, 272, 273, + /* 820 */ 274, 461, 387, 463, 278, 279, 280, 281, 282, 283, + /* 830 */ 284, 285, 12, 13, 421, 401, 402, 402, 495, 404, + /* 840 */ 20, 498, 22, 116, 218, 502, 503, 504, 505, 506, + /* 850 */ 507, 14, 509, 510, 511, 512, 36, 20, 38, 387, + /* 860 */ 474, 299, 300, 301, 20, 479, 309, 432, 68, 401, + /* 870 */ 402, 433, 191, 192, 402, 309, 404, 251, 252, 401, + /* 880 */ 402, 152, 153, 448, 193, 450, 449, 450, 68, 421, + /* 890 */ 52, 71, 8, 9, 0, 75, 12, 13, 14, 15, + /* 900 */ 16, 516, 82, 518, 432, 8, 9, 401, 402, 12, + /* 910 */ 13, 14, 15, 16, 114, 406, 407, 531, 336, 119, + /* 920 */ 448, 285, 450, 287, 23, 539, 387, 421, 191, 387, + /* 930 */ 495, 33, 112, 498, 456, 115, 474, 502, 503, 504, + /* 940 */ 505, 506, 507, 557, 558, 510, 511, 512, 562, 563, + /* 950 */ 49, 50, 517, 433, 519, 402, 406, 407, 523, 524, + /* 960 */ 526, 527, 528, 529, 427, 531, 532, 495, 59, 60, + /* 970 */ 498, 309, 152, 153, 502, 503, 504, 505, 506, 507, + /* 980 */ 415, 416, 510, 511, 512, 432, 186, 448, 14, 517, + /* 990 */ 448, 519, 255, 531, 20, 523, 524, 401, 402, 20, + /* 1000 */ 116, 539, 0, 387, 145, 146, 147, 148, 149, 150, + /* 1010 */ 151, 191, 192, 116, 116, 401, 402, 421, 402, 557, + /* 1020 */ 558, 201, 202, 14, 562, 563, 489, 432, 20, 20, + /* 1030 */ 410, 193, 77, 78, 79, 440, 216, 422, 218, 84, + /* 1040 */ 85, 86, 204, 223, 0, 90, 451, 432, 432, 401, + /* 1050 */ 95, 96, 97, 98, 401, 402, 101, 504, 443, 439, + /* 1060 */ 105, 106, 107, 108, 448, 516, 450, 518, 401, 402, + /* 1070 */ 456, 0, 228, 253, 254, 255, 74, 257, 258, 259, + /* 1080 */ 260, 261, 262, 263, 264, 265, 266, 267, 421, 433, + /* 1090 */ 270, 271, 272, 273, 274, 387, 401, 402, 278, 279, + /* 1100 */ 280, 281, 282, 283, 284, 12, 13, 14, 13, 456, + /* 1110 */ 402, 495, 404, 20, 498, 22, 421, 433, 502, 503, + /* 1120 */ 504, 505, 506, 507, 14, 387, 510, 511, 512, 36, + /* 1130 */ 20, 38, 484, 485, 401, 402, 387, 8, 9, 245, + /* 1140 */ 432, 12, 13, 14, 15, 16, 480, 401, 402, 22, + /* 1150 */ 432, 402, 0, 404, 421, 432, 448, 38, 450, 441, + /* 1160 */ 442, 68, 419, 36, 71, 191, 443, 421, 552, 553, + /* 1170 */ 415, 416, 193, 54, 387, 82, 47, 82, 14, 15, + /* 1180 */ 16, 432, 63, 64, 65, 66, 448, 68, 432, 145, + /* 1190 */ 146, 147, 148, 149, 150, 151, 440, 448, 433, 450, + /* 1200 */ 191, 193, 20, 495, 22, 112, 498, 451, 115, 387, + /* 1210 */ 502, 503, 504, 505, 506, 507, 401, 402, 510, 511, + /* 1220 */ 512, 417, 401, 402, 420, 517, 155, 519, 20, 255, + /* 1230 */ 388, 523, 524, 114, 255, 448, 421, 460, 119, 112, + /* 1240 */ 58, 170, 421, 533, 495, 152, 153, 498, 432, 401, + /* 1250 */ 402, 502, 503, 504, 505, 506, 507, 401, 402, 510, + /* 1260 */ 511, 512, 387, 255, 255, 3, 517, 451, 519, 421, + /* 1270 */ 448, 422, 523, 524, 186, 515, 387, 421, 518, 387, + /* 1280 */ 44, 432, 8, 9, 191, 192, 12, 13, 14, 15, + /* 1290 */ 16, 402, 443, 404, 201, 202, 432, 145, 146, 147, + /* 1300 */ 148, 149, 150, 151, 68, 186, 401, 402, 220, 216, + /* 1310 */ 4, 218, 401, 402, 195, 451, 223, 432, 199, 200, + /* 1320 */ 387, 432, 2, 448, 205, 206, 421, 442, 8, 9, + /* 1330 */ 566, 33, 12, 13, 14, 15, 16, 448, 555, 450, + /* 1340 */ 448, 401, 402, 224, 20, 47, 253, 254, 255, 190, /* 1350 */ 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, - /* 1360 */ 267, 492, 387, 270, 271, 272, 273, 274, 387, 401, + /* 1360 */ 267, 421, 548, 270, 271, 272, 273, 274, 534, 401, /* 1370 */ 402, 278, 279, 280, 281, 282, 283, 284, 12, 13, - /* 1380 */ 447, 22, 530, 401, 402, 387, 20, 22, 22, 421, - /* 1390 */ 538, 387, 387, 447, 427, 36, 444, 447, 186, 447, - /* 1400 */ 402, 36, 36, 421, 38, 447, 387, 195, 556, 557, - /* 1410 */ 387, 199, 200, 561, 562, 390, 391, 205, 206, 20, - /* 1420 */ 14, 216, 447, 218, 13, 402, 20, 404, 447, 431, - /* 1430 */ 33, 33, 444, 191, 68, 447, 224, 71, 145, 0, - /* 1440 */ 126, 0, 149, 116, 47, 447, 0, 449, 82, 401, - /* 1450 */ 402, 447, 447, 33, 431, 488, 8, 9, 253, 254, - /* 1460 */ 12, 13, 14, 15, 16, 147, 447, 47, 33, 151, - /* 1470 */ 447, 112, 449, 20, 33, 270, 271, 112, 112, 75, - /* 1480 */ 68, 115, 116, 278, 279, 280, 281, 282, 283, 0, - /* 1490 */ 44, 387, 494, 82, 180, 497, 0, 255, 532, 501, - /* 1500 */ 502, 503, 504, 505, 506, 33, 402, 509, 510, 511, - /* 1510 */ 120, 22, 120, 123, 116, 123, 518, 494, 152, 153, - /* 1520 */ 497, 523, 152, 153, 501, 502, 503, 504, 505, 506, - /* 1530 */ 33, 119, 509, 510, 511, 431, 245, 120, 554, 516, - /* 1540 */ 123, 518, 547, 225, 120, 522, 523, 123, 230, 533, - /* 1550 */ 54, 447, 234, 449, 236, 8, 9, 191, 192, 12, - /* 1560 */ 13, 14, 15, 16, 116, 8, 9, 201, 202, 12, - /* 1570 */ 13, 14, 15, 16, 526, 527, 528, 13, 530, 531, - /* 1580 */ 13, 235, 216, 237, 218, 33, 33, 33, 116, 223, - /* 1590 */ 115, 33, 117, 33, 155, 0, 0, 36, 494, 33, - /* 1600 */ 36, 497, 331, 36, 33, 501, 502, 503, 504, 505, - /* 1610 */ 506, 33, 508, 509, 510, 511, 33, 22, 22, 253, - /* 1620 */ 254, 255, 33, 257, 258, 259, 260, 261, 262, 263, - /* 1630 */ 264, 265, 266, 267, 0, 33, 270, 271, 272, 273, - /* 1640 */ 274, 1, 2, 33, 278, 279, 280, 281, 282, 283, - /* 1650 */ 284, 12, 13, 33, 255, 51, 22, 253, 473, 20, - /* 1660 */ 36, 22, 405, 116, 431, 33, 33, 418, 116, 116, - /* 1670 */ 116, 12, 13, 473, 116, 36, 116, 38, 12, 13, - /* 1680 */ 33, 228, 116, 387, 8, 9, 47, 116, 12, 13, - /* 1690 */ 14, 15, 16, 473, 116, 33, 418, 33, 402, 116, - /* 1700 */ 404, 12, 13, 12, 13, 116, 33, 68, 12, 13, - /* 1710 */ 71, 12, 13, 12, 13, 530, 12, 13, 116, 115, - /* 1720 */ 33, 82, 400, 538, 12, 13, 116, 431, 12, 13, - /* 1730 */ 530, 12, 13, 33, 459, 553, 116, 553, 538, 36, - /* 1740 */ 33, 556, 557, 447, 33, 449, 561, 562, 116, 116, - /* 1750 */ 530, 112, 553, 33, 115, 472, 556, 557, 538, 553, - /* 1760 */ 387, 561, 562, 116, 13, 13, 459, 36, 333, 405, - /* 1770 */ 402, 495, 446, 537, 480, 402, 556, 557, 116, 218, - /* 1780 */ 116, 561, 562, 459, 459, 82, 558, 36, 36, 116, - /* 1790 */ 494, 152, 153, 497, 524, 537, 459, 501, 502, 503, - /* 1800 */ 504, 505, 506, 116, 431, 509, 510, 511, 540, 420, - /* 1810 */ 312, 54, 516, 82, 518, 474, 116, 496, 522, 523, - /* 1820 */ 447, 485, 449, 116, 20, 268, 401, 116, 20, 490, - /* 1830 */ 191, 192, 335, 234, 485, 214, 116, 410, 410, 476, - /* 1840 */ 201, 202, 218, 401, 471, 20, 402, 47, 190, 456, - /* 1850 */ 456, 402, 401, 453, 402, 216, 401, 218, 456, 113, - /* 1860 */ 453, 453, 223, 453, 414, 111, 401, 494, 401, 193, - /* 1870 */ 497, 413, 110, 412, 501, 502, 503, 504, 505, 506, - /* 1880 */ 401, 401, 509, 510, 511, 401, 20, 394, 52, 398, - /* 1890 */ 398, 410, 253, 254, 255, 394, 257, 258, 259, 260, - /* 1900 */ 261, 262, 263, 264, 265, 266, 267, 485, 20, 270, - /* 1910 */ 271, 272, 273, 274, 410, 449, 387, 278, 279, 280, - /* 1920 */ 281, 282, 283, 284, 12, 13, 410, 20, 403, 20, - /* 1930 */ 410, 402, 20, 404, 22, 475, 403, 410, 20, 466, - /* 1940 */ 410, 20, 460, 401, 410, 410, 410, 401, 36, 394, - /* 1950 */ 38, 238, 431, 431, 431, 431, 387, 431, 390, 431, - /* 1960 */ 431, 447, 431, 431, 390, 447, 394, 489, 431, 431, - /* 1970 */ 431, 402, 115, 404, 487, 485, 447, 20, 449, 484, - /* 1980 */ 68, 408, 222, 71, 482, 221, 481, 447, 408, 474, - /* 1990 */ 449, 401, 447, 546, 82, 320, 319, 328, 207, 329, - /* 2000 */ 431, 330, 546, 549, 545, 548, 313, 544, 546, 307, - /* 2010 */ 467, 467, 543, 308, 334, 337, 447, 332, 449, 536, - /* 2020 */ 535, 402, 474, 494, 112, 20, 497, 115, 560, 126, - /* 2030 */ 501, 502, 503, 504, 505, 506, 566, 310, 509, 510, - /* 2040 */ 511, 541, 539, 408, 403, 516, 408, 518, 467, 500, - /* 2050 */ 447, 522, 523, 559, 447, 447, 447, 199, 467, 447, - /* 2060 */ 408, 464, 447, 494, 152, 153, 497, 115, 408, 447, - /* 2070 */ 501, 502, 503, 504, 505, 506, 460, 521, 509, 510, - /* 2080 */ 511, 199, 408, 427, 461, 516, 460, 518, 402, 408, - /* 2090 */ 447, 522, 523, 447, 115, 447, 447, 447, 447, 22, - /* 2100 */ 447, 447, 447, 191, 192, 35, 389, 401, 447, 37, - /* 2110 */ 447, 393, 447, 201, 202, 447, 408, 392, 40, 447, - /* 2120 */ 493, 395, 394, 486, 436, 385, 447, 0, 216, 447, - /* 2130 */ 218, 447, 409, 424, 477, 223, 0, 447, 424, 447, - /* 2140 */ 0, 447, 447, 433, 447, 447, 424, 47, 433, 0, - /* 2150 */ 36, 468, 244, 36, 36, 36, 0, 244, 36, 36, - /* 2160 */ 244, 36, 0, 0, 244, 253, 254, 255, 0, 257, + /* 1380 */ 387, 448, 445, 387, 495, 448, 20, 498, 22, 421, + /* 1390 */ 116, 502, 503, 504, 505, 506, 507, 0, 402, 510, + /* 1400 */ 511, 512, 36, 405, 38, 13, 517, 387, 519, 387, + /* 1410 */ 432, 445, 523, 524, 448, 8, 9, 390, 391, 12, + /* 1420 */ 13, 14, 15, 16, 402, 8, 9, 268, 432, 12, + /* 1430 */ 13, 14, 15, 16, 68, 401, 402, 71, 527, 528, + /* 1440 */ 529, 448, 531, 532, 448, 145, 450, 288, 82, 149, + /* 1450 */ 387, 401, 402, 0, 432, 401, 402, 401, 402, 12, + /* 1460 */ 13, 387, 400, 255, 47, 432, 401, 402, 448, 22, + /* 1470 */ 448, 421, 450, 0, 82, 421, 387, 421, 112, 387, + /* 1480 */ 36, 115, 116, 36, 451, 38, 421, 387, 387, 387, + /* 1490 */ 387, 495, 401, 402, 498, 22, 68, 44, 502, 503, + /* 1500 */ 504, 505, 506, 507, 508, 402, 510, 511, 512, 513, + /* 1510 */ 514, 448, 421, 445, 36, 68, 448, 495, 152, 153, + /* 1520 */ 498, 460, 448, 116, 502, 503, 504, 505, 506, 507, + /* 1530 */ 75, 126, 510, 511, 512, 432, 0, 448, 36, 517, + /* 1540 */ 448, 519, 418, 401, 402, 523, 524, 119, 448, 448, + /* 1550 */ 448, 448, 155, 450, 152, 153, 120, 191, 192, 123, + /* 1560 */ 82, 527, 528, 529, 13, 531, 532, 201, 202, 120, + /* 1570 */ 8, 9, 123, 539, 12, 13, 14, 15, 16, 255, + /* 1580 */ 120, 13, 216, 123, 218, 180, 235, 36, 237, 223, + /* 1590 */ 54, 557, 558, 331, 0, 418, 562, 563, 495, 120, + /* 1600 */ 0, 498, 123, 554, 36, 502, 503, 504, 505, 506, + /* 1610 */ 507, 13, 33, 510, 511, 512, 22, 311, 33, 253, + /* 1620 */ 254, 255, 22, 257, 258, 259, 260, 261, 262, 263, + /* 1630 */ 264, 265, 266, 267, 36, 36, 270, 271, 272, 273, + /* 1640 */ 274, 115, 387, 117, 278, 279, 280, 281, 282, 283, + /* 1650 */ 284, 12, 13, 33, 473, 33, 33, 402, 33, 20, + /* 1660 */ 0, 22, 218, 216, 33, 218, 33, 564, 565, 527, + /* 1670 */ 528, 529, 554, 531, 532, 36, 36, 38, 116, 387, + /* 1680 */ 474, 82, 22, 13, 8, 9, 47, 432, 12, 13, + /* 1690 */ 14, 15, 16, 0, 402, 116, 1, 2, 251, 252, + /* 1700 */ 253, 116, 33, 448, 554, 450, 36, 68, 253, 51, + /* 1710 */ 71, 12, 13, 460, 554, 12, 13, 270, 271, 405, + /* 1720 */ 218, 82, 82, 33, 432, 278, 279, 280, 281, 282, + /* 1730 */ 283, 33, 402, 496, 33, 33, 116, 531, 116, 116, + /* 1740 */ 448, 116, 450, 33, 33, 539, 447, 116, 55, 116, + /* 1750 */ 495, 112, 481, 498, 115, 4, 460, 502, 503, 504, + /* 1760 */ 505, 506, 507, 557, 558, 510, 511, 512, 562, 563, + /* 1770 */ 19, 33, 517, 115, 519, 460, 8, 9, 523, 524, + /* 1780 */ 12, 13, 14, 15, 16, 116, 538, 495, 33, 38, + /* 1790 */ 498, 152, 153, 474, 502, 503, 504, 505, 506, 507, + /* 1800 */ 12, 13, 510, 511, 512, 54, 116, 33, 33, 517, + /* 1810 */ 538, 519, 61, 62, 116, 523, 524, 116, 116, 68, + /* 1820 */ 12, 13, 387, 559, 33, 33, 116, 116, 8, 9, + /* 1830 */ 191, 192, 12, 13, 14, 15, 16, 402, 525, 460, + /* 1840 */ 201, 202, 12, 13, 12, 13, 12, 13, 12, 13, + /* 1850 */ 531, 541, 33, 420, 116, 216, 312, 218, 539, 12, + /* 1860 */ 13, 475, 223, 12, 13, 114, 33, 432, 33, 193, + /* 1870 */ 119, 116, 12, 13, 33, 54, 557, 558, 497, 20, + /* 1880 */ 486, 562, 563, 448, 116, 450, 401, 20, 234, 491, + /* 1890 */ 116, 116, 253, 254, 255, 486, 257, 258, 259, 260, + /* 1900 */ 261, 262, 263, 264, 265, 266, 267, 116, 116, 270, + /* 1910 */ 271, 272, 273, 274, 474, 410, 410, 278, 279, 280, + /* 1920 */ 281, 282, 283, 284, 12, 13, 214, 477, 401, 387, + /* 1930 */ 495, 20, 20, 498, 22, 116, 116, 502, 503, 504, + /* 1940 */ 505, 506, 507, 402, 402, 510, 511, 512, 36, 116, + /* 1950 */ 38, 116, 47, 457, 519, 402, 457, 116, 523, 524, + /* 1960 */ 190, 454, 401, 454, 414, 402, 401, 457, 454, 454, + /* 1970 */ 113, 531, 111, 413, 432, 401, 401, 401, 110, 539, + /* 1980 */ 68, 412, 401, 71, 401, 20, 394, 52, 398, 394, + /* 1990 */ 448, 398, 450, 20, 82, 450, 410, 557, 558, 486, + /* 2000 */ 20, 410, 562, 563, 403, 20, 410, 12, 13, 476, + /* 2010 */ 403, 20, 410, 410, 472, 467, 410, 22, 20, 461, + /* 2020 */ 410, 387, 410, 52, 112, 428, 410, 115, 401, 394, + /* 2030 */ 448, 36, 428, 38, 390, 390, 402, 495, 238, 401, + /* 2040 */ 498, 432, 394, 432, 502, 503, 504, 505, 506, 507, + /* 2050 */ 432, 432, 510, 511, 512, 115, 432, 490, 432, 488, + /* 2060 */ 432, 432, 432, 68, 152, 153, 432, 408, 432, 432, + /* 2070 */ 486, 20, 485, 408, 222, 221, 401, 82, 320, 547, + /* 2080 */ 448, 319, 448, 468, 450, 547, 207, 328, 483, 448, + /* 2090 */ 482, 448, 450, 550, 547, 549, 475, 330, 546, 545, + /* 2100 */ 329, 544, 313, 191, 192, 308, 307, 112, 332, 537, + /* 2110 */ 337, 334, 20, 201, 202, 468, 536, 561, 402, 560, + /* 2120 */ 126, 475, 567, 310, 403, 408, 408, 448, 216, 495, + /* 2130 */ 218, 542, 498, 448, 468, 223, 502, 503, 504, 505, + /* 2140 */ 506, 507, 448, 199, 510, 511, 512, 465, 448, 468, + /* 2150 */ 501, 408, 448, 519, 540, 448, 408, 523, 524, 115, + /* 2160 */ 199, 448, 408, 427, 408, 253, 254, 255, 462, 257, /* 2170 */ 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, - /* 2180 */ 36, 0, 270, 271, 272, 273, 274, 36, 387, 468, - /* 2190 */ 278, 279, 280, 281, 282, 283, 284, 12, 13, 0, - /* 2200 */ 22, 0, 36, 402, 239, 20, 0, 22, 224, 0, - /* 2210 */ 224, 218, 225, 216, 0, 0, 0, 0, 212, 211, - /* 2220 */ 0, 36, 158, 38, 51, 51, 0, 36, 0, 387, - /* 2230 */ 0, 36, 431, 54, 0, 51, 0, 47, 0, 0, - /* 2240 */ 0, 0, 0, 51, 402, 0, 0, 0, 447, 0, - /* 2250 */ 449, 176, 0, 68, 36, 176, 71, 0, 0, 0, - /* 2260 */ 0, 0, 0, 0, 0, 0, 0, 82, 0, 0, - /* 2270 */ 0, 0, 0, 431, 0, 0, 0, 0, 0, 0, - /* 2280 */ 51, 0, 47, 0, 0, 0, 0, 0, 0, 447, - /* 2290 */ 0, 449, 0, 158, 0, 494, 0, 112, 497, 157, - /* 2300 */ 115, 156, 501, 502, 503, 504, 505, 506, 0, 0, - /* 2310 */ 509, 510, 511, 387, 0, 22, 0, 516, 68, 518, - /* 2320 */ 22, 22, 0, 522, 523, 52, 0, 36, 402, 0, - /* 2330 */ 0, 0, 52, 36, 0, 68, 494, 152, 153, 497, - /* 2340 */ 36, 0, 36, 501, 502, 503, 504, 505, 506, 44, - /* 2350 */ 68, 509, 510, 511, 54, 44, 54, 431, 516, 44, - /* 2360 */ 518, 54, 0, 68, 522, 523, 0, 47, 36, 44, - /* 2370 */ 33, 14, 51, 447, 51, 449, 191, 192, 51, 0, - /* 2380 */ 45, 0, 44, 0, 0, 0, 201, 202, 44, 207, - /* 2390 */ 0, 51, 0, 51, 0, 0, 0, 0, 44, 36, - /* 2400 */ 54, 216, 0, 218, 76, 36, 54, 0, 223, 44, - /* 2410 */ 36, 44, 54, 0, 36, 54, 44, 0, 0, 0, - /* 2420 */ 494, 0, 0, 497, 0, 36, 123, 501, 502, 503, - /* 2430 */ 504, 505, 506, 22, 0, 509, 510, 511, 253, 254, - /* 2440 */ 255, 36, 257, 258, 259, 260, 261, 262, 263, 264, - /* 2450 */ 265, 266, 267, 22, 22, 270, 271, 272, 273, 274, - /* 2460 */ 33, 125, 36, 278, 279, 280, 281, 282, 283, 284, - /* 2470 */ 18, 36, 36, 387, 36, 23, 36, 36, 552, 36, - /* 2480 */ 36, 33, 36, 36, 0, 36, 22, 0, 402, 22, - /* 2490 */ 0, 0, 22, 56, 42, 43, 22, 36, 46, 0, - /* 2500 */ 0, 0, 36, 0, 36, 0, 0, 36, 22, 57, - /* 2510 */ 0, 36, 20, 36, 36, 116, 387, 431, 115, 115, - /* 2520 */ 0, 69, 70, 71, 72, 73, 193, 51, 0, 36, - /* 2530 */ 22, 402, 193, 447, 22, 449, 223, 219, 193, 229, - /* 2540 */ 228, 0, 199, 0, 193, 3, 193, 33, 115, 36, - /* 2550 */ 203, 203, 36, 36, 52, 116, 52, 314, 116, 33, - /* 2560 */ 431, 116, 33, 33, 33, 111, 115, 115, 115, 113, - /* 2570 */ 51, 116, 115, 115, 115, 51, 447, 115, 449, 116, - /* 2580 */ 494, 116, 33, 497, 3, 33, 36, 501, 502, 503, - /* 2590 */ 504, 505, 506, 82, 115, 509, 510, 511, 116, 116, - /* 2600 */ 36, 36, 516, 314, 518, 36, 154, 36, 522, 523, - /* 2610 */ 36, 116, 116, 51, 51, 298, 33, 0, 0, 44, - /* 2620 */ 0, 196, 115, 494, 44, 116, 497, 0, 200, 44, - /* 2630 */ 501, 502, 503, 504, 505, 506, 113, 116, 509, 510, - /* 2640 */ 511, 116, 115, 33, 2, 286, 253, 518, 115, 115, - /* 2650 */ 115, 522, 523, 113, 22, 116, 196, 51, 51, 115, - /* 2660 */ 208, 209, 210, 314, 116, 213, 115, 195, 115, 115, - /* 2670 */ 115, 115, 115, 115, 115, 115, 22, 116, 226, 227, - /* 2680 */ 0, 115, 115, 44, 116, 256, 116, 115, 387, 0, - /* 2690 */ 196, 115, 240, 115, 115, 243, 22, 115, 246, 247, - /* 2700 */ 248, 249, 250, 402, 117, 115, 118, 51, 115, 22, - /* 2710 */ 116, 387, 115, 115, 229, 126, 116, 36, 36, 115, - /* 2720 */ 36, 116, 36, 115, 36, 116, 402, 116, 116, 116, - /* 2730 */ 36, 36, 431, 137, 115, 33, 137, 115, 137, 137, - /* 2740 */ 36, 115, 22, 76, 75, 22, 36, 36, 447, 36, - /* 2750 */ 449, 36, 36, 36, 36, 431, 109, 36, 36, 82, - /* 2760 */ 36, 309, 36, 33, 109, 82, 22, 36, 36, 36, - /* 2770 */ 36, 447, 36, 449, 36, 36, 36, 36, 82, 36, - /* 2780 */ 22, 36, 36, 0, 36, 0, 44, 36, 0, 54, - /* 2790 */ 36, 54, 0, 44, 44, 494, 36, 44, 497, 36, - /* 2800 */ 0, 54, 501, 502, 503, 504, 505, 506, 0, 54, - /* 2810 */ 509, 510, 511, 1, 36, 22, 0, 22, 494, 518, - /* 2820 */ 33, 497, 36, 522, 523, 501, 502, 503, 504, 505, - /* 2830 */ 506, 19, 36, 509, 510, 511, 22, 387, 21, 567, - /* 2840 */ 22, 22, 518, 21, 20, 567, 522, 523, 567, 567, - /* 2850 */ 38, 567, 402, 567, 567, 567, 387, 567, 567, 567, - /* 2860 */ 567, 567, 567, 567, 567, 53, 54, 567, 567, 567, - /* 2870 */ 567, 402, 567, 567, 567, 63, 64, 65, 66, 567, - /* 2880 */ 68, 431, 567, 567, 567, 567, 567, 567, 567, 567, - /* 2890 */ 567, 567, 567, 567, 567, 567, 567, 447, 567, 449, - /* 2900 */ 431, 567, 567, 567, 567, 567, 567, 567, 567, 567, - /* 2910 */ 567, 567, 567, 567, 567, 567, 447, 567, 449, 567, - /* 2920 */ 567, 471, 567, 387, 567, 567, 114, 567, 567, 567, - /* 2930 */ 567, 119, 567, 567, 567, 567, 567, 567, 402, 567, - /* 2940 */ 471, 567, 567, 567, 494, 567, 567, 497, 567, 567, - /* 2950 */ 567, 501, 502, 503, 504, 505, 506, 567, 567, 509, - /* 2960 */ 510, 511, 150, 494, 567, 567, 497, 431, 567, 567, - /* 2970 */ 501, 502, 503, 504, 505, 506, 567, 567, 509, 510, - /* 2980 */ 511, 567, 567, 447, 567, 449, 567, 567, 567, 567, - /* 2990 */ 387, 567, 567, 567, 567, 567, 567, 567, 567, 567, - /* 3000 */ 567, 567, 567, 567, 567, 402, 567, 195, 567, 197, - /* 3010 */ 567, 387, 200, 567, 567, 567, 567, 205, 567, 567, - /* 3020 */ 567, 567, 567, 567, 567, 567, 402, 567, 567, 567, - /* 3030 */ 494, 567, 567, 497, 431, 567, 224, 501, 502, 503, - /* 3040 */ 504, 505, 506, 567, 567, 509, 510, 511, 567, 567, - /* 3050 */ 447, 567, 449, 567, 567, 431, 567, 567, 567, 567, - /* 3060 */ 567, 567, 567, 567, 567, 567, 567, 567, 567, 567, - /* 3070 */ 567, 447, 567, 449, 567, 567, 567, 567, 567, 567, - /* 3080 */ 387, 567, 567, 567, 567, 567, 567, 567, 567, 567, - /* 3090 */ 567, 555, 567, 567, 567, 402, 567, 494, 567, 567, - /* 3100 */ 497, 567, 567, 567, 501, 502, 503, 504, 505, 506, - /* 3110 */ 567, 567, 509, 510, 511, 567, 567, 567, 494, 567, - /* 3120 */ 567, 497, 567, 567, 431, 501, 502, 503, 504, 505, - /* 3130 */ 506, 567, 567, 509, 510, 511, 567, 513, 567, 567, - /* 3140 */ 447, 567, 449, 567, 567, 567, 567, 567, 567, 567, - /* 3150 */ 567, 567, 567, 567, 567, 567, 567, 567, 567, 567, - /* 3160 */ 567, 387, 567, 567, 471, 567, 567, 564, 567, 567, - /* 3170 */ 567, 567, 567, 567, 567, 567, 402, 567, 567, 567, - /* 3180 */ 567, 567, 567, 567, 567, 567, 387, 494, 567, 567, - /* 3190 */ 497, 567, 567, 567, 501, 502, 503, 504, 505, 506, - /* 3200 */ 567, 402, 509, 510, 511, 431, 567, 387, 567, 567, - /* 3210 */ 567, 567, 567, 567, 567, 567, 567, 567, 567, 567, - /* 3220 */ 567, 447, 402, 449, 567, 567, 567, 567, 567, 567, - /* 3230 */ 431, 567, 567, 567, 567, 567, 567, 567, 567, 567, - /* 3240 */ 567, 567, 567, 567, 567, 471, 447, 567, 449, 567, - /* 3250 */ 567, 431, 567, 567, 567, 567, 567, 567, 567, 567, - /* 3260 */ 567, 567, 567, 567, 567, 567, 567, 447, 494, 449, - /* 3270 */ 471, 497, 567, 567, 567, 501, 502, 503, 504, 505, - /* 3280 */ 506, 567, 567, 509, 510, 511, 567, 567, 567, 567, - /* 3290 */ 567, 471, 567, 494, 567, 567, 497, 567, 567, 567, - /* 3300 */ 501, 502, 503, 504, 505, 506, 567, 567, 509, 510, - /* 3310 */ 511, 567, 567, 567, 494, 567, 567, 497, 567, 387, - /* 3320 */ 567, 501, 502, 503, 504, 505, 506, 567, 567, 509, - /* 3330 */ 510, 511, 567, 567, 402, 567, 567, 567, 567, 387, - /* 3340 */ 567, 567, 567, 567, 567, 567, 567, 567, 567, 567, - /* 3350 */ 567, 567, 567, 567, 402, 567, 567, 567, 387, 567, - /* 3360 */ 567, 567, 567, 431, 567, 567, 567, 567, 567, 567, - /* 3370 */ 567, 567, 567, 402, 567, 567, 567, 567, 567, 447, - /* 3380 */ 567, 449, 567, 431, 567, 567, 567, 567, 567, 567, - /* 3390 */ 567, 567, 567, 567, 567, 567, 567, 567, 567, 447, - /* 3400 */ 567, 449, 431, 567, 567, 567, 567, 567, 567, 567, - /* 3410 */ 567, 567, 567, 567, 567, 567, 567, 567, 447, 567, - /* 3420 */ 449, 567, 567, 567, 567, 387, 494, 567, 567, 497, - /* 3430 */ 567, 567, 567, 501, 502, 503, 504, 505, 506, 567, - /* 3440 */ 402, 509, 510, 511, 567, 567, 494, 567, 567, 497, - /* 3450 */ 567, 567, 567, 501, 502, 503, 504, 505, 506, 567, - /* 3460 */ 567, 509, 510, 511, 567, 494, 567, 567, 497, 431, - /* 3470 */ 567, 567, 501, 502, 503, 504, 505, 506, 567, 567, - /* 3480 */ 509, 510, 511, 567, 567, 447, 567, 449, 567, 567, - /* 3490 */ 567, 567, 387, 567, 567, 567, 567, 567, 567, 567, - /* 3500 */ 567, 567, 567, 567, 567, 567, 567, 402, 567, 567, - /* 3510 */ 567, 567, 387, 567, 567, 567, 567, 567, 567, 567, - /* 3520 */ 567, 567, 567, 567, 567, 567, 567, 402, 567, 567, - /* 3530 */ 567, 567, 494, 567, 567, 497, 431, 567, 567, 501, - /* 3540 */ 502, 503, 504, 505, 506, 567, 567, 509, 510, 511, - /* 3550 */ 567, 567, 447, 567, 449, 567, 431, 567, 567, 567, - /* 3560 */ 567, 567, 567, 567, 567, 567, 567, 567, 567, 567, - /* 3570 */ 567, 567, 447, 567, 449, 567, 567, 567, 567, 567, - /* 3580 */ 567, 567, 567, 567, 567, 567, 567, 567, 567, 387, - /* 3590 */ 567, 567, 567, 567, 567, 567, 567, 567, 567, 494, - /* 3600 */ 567, 567, 497, 567, 402, 567, 501, 502, 503, 504, - /* 3610 */ 505, 506, 567, 567, 509, 510, 511, 567, 567, 494, - /* 3620 */ 567, 567, 497, 567, 567, 567, 501, 502, 503, 504, - /* 3630 */ 505, 506, 567, 431, 509, 510, 511, 567, 567, 567, - /* 3640 */ 567, 567, 567, 567, 567, 567, 567, 567, 567, 447, - /* 3650 */ 567, 449, 567, 567, 567, 567, 387, 567, 567, 567, - /* 3660 */ 567, 567, 567, 567, 567, 567, 567, 567, 567, 567, - /* 3670 */ 567, 402, 567, 567, 567, 567, 567, 567, 567, 387, - /* 3680 */ 567, 567, 567, 567, 567, 567, 567, 567, 567, 567, - /* 3690 */ 567, 567, 567, 567, 402, 567, 494, 567, 567, 497, - /* 3700 */ 431, 567, 387, 501, 502, 503, 504, 505, 506, 567, - /* 3710 */ 567, 509, 510, 511, 567, 567, 447, 402, 449, 567, - /* 3720 */ 567, 567, 567, 431, 567, 567, 567, 567, 567, 567, - /* 3730 */ 567, 567, 567, 567, 567, 567, 567, 567, 567, 447, - /* 3740 */ 567, 449, 567, 567, 567, 567, 431, 567, 567, 567, - /* 3750 */ 567, 567, 567, 567, 567, 567, 567, 567, 567, 567, - /* 3760 */ 567, 567, 447, 494, 449, 567, 497, 387, 567, 567, - /* 3770 */ 501, 502, 503, 504, 505, 506, 567, 567, 509, 510, - /* 3780 */ 511, 567, 402, 567, 567, 567, 494, 567, 567, 497, - /* 3790 */ 387, 567, 567, 501, 502, 503, 504, 505, 506, 567, - /* 3800 */ 567, 509, 510, 511, 567, 402, 567, 567, 567, 494, - /* 3810 */ 567, 431, 497, 387, 567, 567, 501, 502, 503, 504, - /* 3820 */ 505, 506, 567, 567, 509, 510, 511, 447, 402, 449, - /* 3830 */ 567, 567, 567, 567, 431, 567, 567, 567, 567, 567, - /* 3840 */ 567, 567, 567, 567, 567, 567, 567, 567, 567, 567, - /* 3850 */ 447, 567, 449, 567, 567, 567, 567, 431, 567, 567, - /* 3860 */ 567, 567, 567, 567, 567, 567, 567, 567, 567, 567, - /* 3870 */ 567, 567, 567, 447, 494, 449, 567, 497, 567, 567, - /* 3880 */ 387, 501, 502, 503, 504, 505, 506, 567, 567, 509, - /* 3890 */ 510, 511, 567, 567, 567, 402, 567, 494, 567, 567, - /* 3900 */ 497, 567, 567, 567, 501, 502, 503, 504, 505, 506, - /* 3910 */ 567, 567, 509, 510, 511, 567, 567, 567, 567, 567, - /* 3920 */ 494, 567, 567, 497, 431, 567, 567, 501, 502, 503, - /* 3930 */ 504, 505, 506, 567, 567, 509, 510, 511, 567, 567, - /* 3940 */ 447, 567, 449, 567, 567, 567, 567, 567, 567, 567, - /* 3950 */ 567, 567, 567, 567, 567, 567, 567, 567, 567, 567, - /* 3960 */ 567, 567, 387, 567, 567, 567, 567, 567, 567, 567, - /* 3970 */ 567, 567, 567, 567, 567, 567, 567, 402, 567, 567, - /* 3980 */ 567, 567, 567, 567, 567, 567, 567, 494, 567, 567, - /* 3990 */ 497, 567, 387, 567, 501, 502, 503, 504, 505, 506, - /* 4000 */ 567, 567, 509, 510, 511, 567, 431, 402, 567, 567, - /* 4010 */ 567, 567, 567, 567, 567, 567, 567, 567, 567, 567, - /* 4020 */ 567, 567, 447, 567, 449, 567, 567, 567, 567, 567, - /* 4030 */ 567, 567, 567, 567, 567, 567, 431, 567, 567, 567, - /* 4040 */ 567, 567, 567, 567, 567, 567, 567, 567, 567, 567, - /* 4050 */ 567, 567, 447, 567, 449, 567, 567, 567, 567, 387, - /* 4060 */ 567, 567, 567, 567, 567, 567, 567, 567, 567, 494, - /* 4070 */ 567, 567, 497, 567, 402, 567, 501, 502, 503, 504, - /* 4080 */ 505, 506, 387, 567, 509, 510, 511, 567, 567, 567, - /* 4090 */ 567, 567, 567, 567, 567, 567, 567, 402, 567, 494, - /* 4100 */ 567, 567, 497, 431, 567, 387, 501, 502, 503, 504, - /* 4110 */ 505, 506, 567, 567, 509, 510, 511, 567, 567, 447, - /* 4120 */ 402, 449, 567, 567, 567, 567, 431, 567, 567, 567, - /* 4130 */ 567, 567, 567, 567, 567, 567, 567, 567, 567, 567, - /* 4140 */ 567, 567, 447, 567, 449, 567, 567, 567, 567, 431, - /* 4150 */ 567, 567, 567, 567, 567, 567, 567, 567, 567, 567, - /* 4160 */ 567, 567, 567, 567, 567, 447, 494, 449, 567, 497, - /* 4170 */ 387, 567, 567, 501, 502, 503, 504, 505, 506, 567, - /* 4180 */ 567, 509, 510, 511, 567, 402, 567, 567, 567, 494, - /* 4190 */ 567, 567, 497, 387, 567, 567, 501, 502, 503, 504, - /* 4200 */ 505, 506, 567, 567, 509, 510, 511, 567, 402, 567, - /* 4210 */ 567, 567, 494, 567, 431, 497, 387, 567, 567, 501, - /* 4220 */ 502, 503, 504, 505, 506, 567, 567, 509, 510, 511, - /* 4230 */ 447, 402, 449, 567, 567, 567, 567, 431, 567, 567, - /* 4240 */ 567, 567, 567, 567, 567, 567, 567, 567, 567, 567, - /* 4250 */ 567, 567, 567, 447, 567, 449, 567, 567, 567, 567, - /* 4260 */ 431, 567, 567, 567, 567, 567, 567, 567, 567, 567, - /* 4270 */ 567, 567, 567, 567, 567, 567, 447, 494, 449, 567, - /* 4280 */ 497, 567, 567, 387, 501, 502, 503, 504, 505, 506, - /* 4290 */ 567, 567, 509, 510, 511, 567, 567, 567, 402, 567, - /* 4300 */ 494, 567, 567, 497, 567, 567, 567, 501, 502, 503, - /* 4310 */ 504, 505, 506, 567, 567, 509, 510, 511, 567, 567, - /* 4320 */ 567, 567, 567, 494, 567, 567, 497, 431, 567, 567, - /* 4330 */ 501, 502, 503, 504, 505, 506, 567, 567, 509, 510, - /* 4340 */ 511, 567, 567, 447, 567, 449, 567, 567, 567, 567, - /* 4350 */ 387, 567, 567, 567, 567, 567, 567, 567, 567, 567, - /* 4360 */ 567, 567, 567, 567, 567, 402, 567, 567, 567, 567, - /* 4370 */ 567, 567, 567, 567, 567, 567, 567, 567, 567, 567, - /* 4380 */ 387, 567, 567, 567, 567, 567, 567, 567, 567, 567, - /* 4390 */ 494, 567, 567, 497, 431, 402, 567, 501, 502, 503, - /* 4400 */ 504, 505, 506, 567, 567, 509, 510, 511, 567, 567, - /* 4410 */ 447, 567, 449, 567, 567, 567, 567, 567, 567, 567, - /* 4420 */ 567, 567, 567, 567, 431, 567, 567, 567, 567, 567, - /* 4430 */ 567, 567, 567, 567, 567, 567, 567, 567, 567, 567, - /* 4440 */ 447, 567, 449, 567, 567, 567, 567, 387, 567, 567, - /* 4450 */ 567, 567, 567, 567, 567, 567, 567, 494, 567, 567, - /* 4460 */ 497, 567, 402, 567, 501, 502, 503, 504, 505, 506, - /* 4470 */ 387, 567, 509, 510, 511, 567, 567, 567, 567, 567, - /* 4480 */ 567, 567, 567, 567, 567, 402, 567, 494, 567, 567, - /* 4490 */ 497, 431, 567, 387, 501, 502, 503, 504, 505, 506, - /* 4500 */ 567, 567, 509, 510, 511, 567, 567, 447, 402, 449, - /* 4510 */ 567, 567, 567, 567, 431, 567, 567, 567, 567, 567, - /* 4520 */ 567, 567, 567, 567, 567, 567, 567, 567, 567, 567, - /* 4530 */ 447, 567, 449, 567, 567, 567, 567, 431, 567, 567, - /* 4540 */ 567, 567, 567, 567, 567, 567, 567, 567, 567, 567, - /* 4550 */ 567, 567, 567, 447, 494, 449, 567, 497, 387, 567, - /* 4560 */ 567, 501, 502, 503, 504, 505, 506, 567, 567, 509, - /* 4570 */ 510, 511, 567, 402, 567, 567, 567, 494, 567, 567, - /* 4580 */ 497, 387, 567, 567, 501, 502, 503, 504, 505, 506, - /* 4590 */ 567, 567, 509, 510, 511, 567, 402, 567, 567, 567, - /* 4600 */ 494, 567, 431, 497, 567, 567, 567, 501, 502, 503, - /* 4610 */ 504, 505, 506, 567, 567, 509, 510, 511, 447, 567, - /* 4620 */ 449, 567, 567, 567, 567, 431, 567, 567, 567, 567, - /* 4630 */ 567, 567, 567, 567, 567, 567, 567, 567, 567, 567, - /* 4640 */ 567, 447, 567, 449, 567, 567, 567, 567, 567, 567, - /* 4650 */ 567, 567, 567, 567, 567, 567, 567, 567, 567, 567, - /* 4660 */ 567, 567, 567, 567, 567, 494, 567, 567, 497, 567, - /* 4670 */ 567, 567, 501, 502, 503, 504, 505, 506, 567, 567, - /* 4680 */ 509, 510, 511, 567, 567, 567, 567, 567, 494, 567, - /* 4690 */ 567, 497, 567, 567, 567, 501, 502, 503, 504, 505, - /* 4700 */ 506, 567, 567, 509, 510, 511, 384, 384, 384, 384, + /* 2180 */ 461, 461, 270, 271, 272, 273, 274, 402, 448, 522, + /* 2190 */ 278, 279, 280, 281, 282, 283, 284, 12, 13, 387, + /* 2200 */ 448, 448, 115, 437, 408, 20, 401, 22, 448, 448, + /* 2210 */ 22, 216, 448, 218, 402, 389, 35, 448, 393, 392, + /* 2220 */ 448, 36, 40, 38, 37, 394, 448, 448, 448, 448, + /* 2230 */ 448, 448, 448, 395, 448, 448, 494, 487, 448, 424, + /* 2240 */ 434, 448, 448, 387, 432, 0, 448, 424, 253, 254, + /* 2250 */ 448, 448, 434, 68, 409, 385, 71, 0, 402, 0, + /* 2260 */ 448, 424, 450, 47, 469, 270, 271, 82, 0, 36, + /* 2270 */ 244, 36, 36, 278, 279, 280, 281, 282, 283, 478, + /* 2280 */ 469, 244, 36, 0, 36, 36, 244, 36, 432, 244, + /* 2290 */ 0, 36, 0, 0, 36, 22, 0, 112, 0, 0, + /* 2300 */ 115, 36, 239, 0, 448, 224, 450, 495, 0, 224, + /* 2310 */ 498, 225, 218, 216, 502, 503, 504, 505, 506, 507, + /* 2320 */ 0, 0, 510, 511, 512, 0, 212, 211, 0, 0, + /* 2330 */ 158, 519, 51, 51, 0, 523, 524, 152, 153, 0, + /* 2340 */ 36, 0, 36, 0, 0, 54, 51, 47, 0, 0, + /* 2350 */ 0, 495, 51, 0, 498, 0, 0, 0, 502, 503, + /* 2360 */ 504, 505, 506, 507, 51, 1, 510, 511, 512, 0, + /* 2370 */ 0, 176, 36, 0, 176, 519, 191, 192, 0, 0, + /* 2380 */ 524, 0, 0, 19, 0, 0, 201, 202, 0, 0, + /* 2390 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + /* 2400 */ 0, 216, 38, 218, 0, 0, 47, 0, 223, 0, + /* 2410 */ 0, 0, 0, 0, 0, 0, 0, 53, 54, 0, + /* 2420 */ 158, 0, 0, 22, 157, 156, 0, 63, 64, 65, + /* 2430 */ 66, 0, 68, 0, 68, 52, 0, 0, 253, 254, + /* 2440 */ 255, 0, 257, 258, 259, 260, 261, 262, 263, 264, + /* 2450 */ 265, 266, 267, 36, 22, 270, 271, 272, 273, 274, + /* 2460 */ 52, 22, 0, 278, 279, 280, 281, 282, 283, 284, + /* 2470 */ 18, 68, 0, 44, 68, 23, 36, 54, 114, 0, + /* 2480 */ 36, 54, 44, 119, 0, 36, 44, 0, 68, 54, + /* 2490 */ 36, 0, 387, 47, 42, 43, 33, 44, 46, 51, + /* 2500 */ 14, 51, 51, 0, 45, 44, 0, 402, 0, 57, + /* 2510 */ 0, 0, 44, 0, 150, 51, 207, 387, 0, 0, + /* 2520 */ 0, 69, 70, 71, 72, 73, 51, 0, 0, 36, + /* 2530 */ 54, 76, 402, 44, 0, 36, 54, 432, 44, 0, + /* 2540 */ 36, 44, 54, 0, 54, 36, 44, 0, 0, 0, + /* 2550 */ 0, 0, 0, 448, 22, 450, 33, 123, 36, 195, + /* 2560 */ 0, 197, 432, 22, 200, 36, 36, 115, 125, 205, + /* 2570 */ 0, 36, 36, 36, 36, 33, 36, 22, 448, 0, + /* 2580 */ 450, 36, 36, 22, 22, 0, 22, 56, 224, 36, + /* 2590 */ 36, 0, 0, 36, 22, 36, 0, 0, 0, 36, + /* 2600 */ 495, 36, 472, 498, 0, 36, 154, 502, 503, 504, + /* 2610 */ 505, 506, 507, 0, 20, 510, 511, 512, 36, 36, + /* 2620 */ 36, 22, 0, 116, 51, 495, 0, 115, 498, 115, + /* 2630 */ 22, 229, 502, 503, 504, 505, 506, 507, 193, 36, + /* 2640 */ 510, 511, 512, 0, 219, 22, 199, 0, 387, 193, + /* 2650 */ 193, 223, 228, 0, 3, 36, 314, 33, 553, 193, + /* 2660 */ 208, 209, 210, 402, 193, 213, 36, 52, 203, 52, + /* 2670 */ 203, 33, 33, 115, 33, 33, 387, 314, 226, 227, + /* 2680 */ 113, 33, 116, 115, 51, 51, 111, 116, 82, 115, + /* 2690 */ 36, 402, 240, 432, 116, 243, 116, 3, 246, 247, + /* 2700 */ 248, 249, 250, 115, 115, 115, 33, 36, 115, 448, + /* 2710 */ 115, 450, 36, 36, 36, 36, 116, 116, 116, 36, + /* 2720 */ 51, 432, 33, 116, 0, 116, 116, 0, 44, 115, + /* 2730 */ 0, 51, 116, 472, 116, 115, 115, 448, 0, 450, + /* 2740 */ 196, 44, 115, 115, 314, 116, 44, 33, 113, 113, + /* 2750 */ 2, 22, 115, 253, 51, 115, 495, 51, 298, 498, + /* 2760 */ 286, 309, 116, 502, 503, 504, 505, 506, 507, 22, + /* 2770 */ 115, 510, 511, 512, 387, 115, 200, 116, 115, 115, + /* 2780 */ 115, 115, 196, 115, 495, 115, 0, 498, 116, 402, + /* 2790 */ 115, 502, 503, 504, 505, 506, 507, 115, 44, 510, + /* 2800 */ 511, 512, 116, 115, 117, 387, 195, 115, 196, 0, + /* 2810 */ 51, 116, 22, 115, 115, 22, 115, 126, 118, 432, + /* 2820 */ 402, 116, 115, 115, 115, 115, 76, 116, 36, 116, + /* 2830 */ 36, 115, 36, 256, 229, 448, 115, 450, 116, 36, + /* 2840 */ 36, 116, 116, 36, 116, 556, 36, 115, 33, 137, + /* 2850 */ 432, 115, 137, 36, 137, 137, 387, 115, 22, 75, + /* 2860 */ 22, 36, 36, 36, 36, 36, 448, 36, 450, 36, + /* 2870 */ 36, 402, 109, 36, 109, 36, 36, 82, 33, 82, + /* 2880 */ 36, 22, 495, 36, 36, 498, 36, 36, 36, 502, + /* 2890 */ 503, 504, 505, 506, 507, 82, 36, 510, 511, 512, + /* 2900 */ 36, 432, 36, 36, 36, 22, 36, 0, 36, 54, + /* 2910 */ 0, 36, 54, 495, 0, 44, 498, 448, 44, 450, + /* 2920 */ 502, 503, 504, 505, 506, 507, 36, 54, 510, 511, + /* 2930 */ 512, 44, 514, 0, 36, 54, 44, 0, 36, 0, + /* 2940 */ 22, 472, 36, 387, 0, 22, 33, 36, 36, 22, + /* 2950 */ 21, 21, 565, 22, 22, 20, 568, 568, 402, 568, + /* 2960 */ 568, 568, 568, 568, 495, 568, 568, 498, 387, 568, + /* 2970 */ 568, 502, 503, 504, 505, 506, 507, 568, 568, 510, + /* 2980 */ 511, 512, 568, 402, 568, 568, 568, 568, 432, 568, + /* 2990 */ 568, 568, 568, 568, 568, 568, 568, 568, 568, 568, + /* 3000 */ 568, 568, 568, 568, 448, 568, 450, 568, 568, 568, + /* 3010 */ 568, 568, 568, 432, 568, 568, 568, 568, 568, 568, + /* 3020 */ 568, 568, 568, 568, 568, 568, 568, 568, 472, 448, + /* 3030 */ 568, 450, 568, 568, 568, 568, 568, 568, 568, 568, + /* 3040 */ 568, 568, 568, 568, 568, 568, 568, 568, 568, 387, + /* 3050 */ 568, 495, 568, 472, 498, 568, 568, 568, 502, 503, + /* 3060 */ 504, 505, 506, 507, 402, 568, 510, 511, 512, 568, + /* 3070 */ 568, 568, 568, 568, 568, 568, 495, 568, 568, 498, + /* 3080 */ 387, 568, 568, 502, 503, 504, 505, 506, 507, 568, + /* 3090 */ 568, 510, 511, 512, 432, 402, 568, 568, 568, 568, + /* 3100 */ 568, 568, 568, 568, 568, 568, 568, 568, 568, 568, + /* 3110 */ 448, 568, 450, 568, 568, 568, 568, 568, 568, 568, + /* 3120 */ 568, 568, 568, 568, 568, 432, 568, 568, 568, 568, + /* 3130 */ 568, 568, 568, 568, 472, 568, 568, 568, 568, 568, + /* 3140 */ 568, 448, 568, 450, 568, 568, 568, 387, 568, 568, + /* 3150 */ 568, 568, 568, 568, 568, 568, 568, 495, 568, 568, + /* 3160 */ 498, 568, 402, 568, 502, 503, 504, 505, 506, 507, + /* 3170 */ 568, 568, 510, 511, 512, 387, 568, 568, 568, 568, + /* 3180 */ 568, 568, 568, 568, 568, 568, 568, 568, 495, 568, + /* 3190 */ 402, 498, 432, 568, 568, 502, 503, 504, 505, 506, + /* 3200 */ 507, 568, 568, 510, 511, 512, 568, 568, 448, 568, + /* 3210 */ 450, 568, 568, 568, 568, 568, 568, 568, 568, 568, + /* 3220 */ 432, 568, 568, 568, 568, 568, 568, 568, 568, 568, + /* 3230 */ 568, 568, 568, 568, 568, 568, 448, 568, 450, 568, + /* 3240 */ 568, 568, 568, 568, 387, 568, 568, 568, 568, 568, + /* 3250 */ 568, 568, 568, 568, 568, 495, 568, 568, 498, 402, + /* 3260 */ 568, 568, 502, 503, 504, 505, 506, 507, 568, 568, + /* 3270 */ 510, 511, 512, 387, 568, 568, 568, 568, 568, 568, + /* 3280 */ 568, 568, 568, 495, 568, 568, 498, 568, 402, 432, + /* 3290 */ 502, 503, 504, 505, 506, 507, 568, 568, 510, 511, + /* 3300 */ 512, 568, 568, 568, 568, 448, 568, 450, 568, 387, + /* 3310 */ 568, 568, 568, 568, 568, 568, 568, 568, 432, 568, + /* 3320 */ 568, 568, 568, 568, 402, 568, 568, 568, 568, 568, + /* 3330 */ 568, 568, 568, 568, 448, 568, 450, 568, 568, 568, + /* 3340 */ 568, 568, 568, 568, 568, 568, 568, 568, 568, 568, + /* 3350 */ 568, 568, 495, 568, 432, 498, 568, 568, 568, 502, + /* 3360 */ 503, 504, 505, 506, 507, 568, 568, 510, 511, 512, + /* 3370 */ 448, 568, 450, 568, 568, 568, 568, 568, 568, 568, + /* 3380 */ 568, 495, 568, 568, 498, 568, 568, 568, 502, 503, + /* 3390 */ 504, 505, 506, 507, 387, 568, 510, 511, 512, 568, + /* 3400 */ 568, 568, 568, 568, 568, 568, 568, 568, 568, 402, + /* 3410 */ 568, 568, 568, 568, 568, 568, 387, 495, 568, 568, + /* 3420 */ 498, 568, 568, 568, 502, 503, 504, 505, 506, 507, + /* 3430 */ 568, 402, 510, 511, 512, 568, 568, 387, 568, 432, + /* 3440 */ 568, 568, 568, 568, 568, 568, 568, 568, 568, 568, + /* 3450 */ 568, 568, 402, 568, 568, 448, 568, 450, 568, 568, + /* 3460 */ 568, 432, 568, 568, 568, 568, 568, 568, 568, 568, + /* 3470 */ 568, 568, 568, 568, 568, 568, 568, 448, 568, 450, + /* 3480 */ 568, 387, 432, 568, 568, 568, 568, 568, 568, 568, + /* 3490 */ 568, 568, 568, 568, 568, 568, 402, 568, 448, 568, + /* 3500 */ 450, 568, 495, 568, 568, 498, 568, 568, 568, 502, + /* 3510 */ 503, 504, 505, 506, 507, 568, 568, 510, 511, 512, + /* 3520 */ 568, 568, 387, 568, 495, 568, 432, 498, 568, 568, + /* 3530 */ 568, 502, 503, 504, 505, 506, 507, 402, 568, 510, + /* 3540 */ 511, 512, 448, 568, 450, 495, 568, 568, 498, 568, + /* 3550 */ 387, 568, 502, 503, 504, 505, 506, 507, 568, 568, + /* 3560 */ 510, 511, 512, 568, 568, 402, 568, 432, 568, 568, + /* 3570 */ 568, 568, 568, 568, 568, 568, 568, 568, 568, 568, + /* 3580 */ 568, 568, 568, 448, 568, 450, 568, 387, 568, 495, + /* 3590 */ 568, 568, 498, 568, 568, 432, 502, 503, 504, 505, + /* 3600 */ 506, 507, 402, 568, 510, 511, 512, 568, 568, 568, + /* 3610 */ 568, 448, 568, 450, 568, 568, 568, 568, 568, 568, + /* 3620 */ 568, 568, 568, 568, 568, 568, 568, 568, 568, 568, + /* 3630 */ 495, 568, 432, 498, 568, 568, 568, 502, 503, 504, + /* 3640 */ 505, 506, 507, 568, 568, 510, 511, 512, 448, 568, + /* 3650 */ 450, 568, 568, 568, 568, 568, 568, 568, 495, 568, + /* 3660 */ 568, 498, 568, 568, 568, 502, 503, 504, 505, 506, + /* 3670 */ 507, 387, 568, 510, 511, 512, 568, 568, 568, 568, + /* 3680 */ 568, 568, 568, 568, 568, 568, 402, 568, 568, 568, + /* 3690 */ 568, 568, 568, 387, 568, 495, 568, 568, 498, 568, + /* 3700 */ 568, 568, 502, 503, 504, 505, 506, 507, 402, 568, + /* 3710 */ 510, 511, 512, 568, 568, 568, 432, 568, 568, 568, + /* 3720 */ 568, 568, 387, 568, 568, 568, 568, 568, 568, 568, + /* 3730 */ 568, 568, 448, 568, 450, 568, 568, 402, 432, 568, + /* 3740 */ 568, 568, 568, 568, 568, 568, 568, 568, 568, 568, + /* 3750 */ 568, 568, 568, 568, 448, 568, 450, 568, 387, 568, + /* 3760 */ 568, 568, 568, 568, 568, 568, 568, 432, 568, 568, + /* 3770 */ 568, 568, 568, 402, 568, 568, 568, 568, 568, 495, + /* 3780 */ 568, 568, 498, 448, 568, 450, 502, 503, 504, 505, + /* 3790 */ 506, 507, 568, 568, 510, 511, 512, 568, 568, 568, + /* 3800 */ 568, 495, 568, 432, 498, 568, 568, 568, 502, 503, + /* 3810 */ 504, 505, 506, 507, 568, 568, 510, 511, 512, 448, + /* 3820 */ 568, 450, 568, 568, 568, 568, 568, 568, 568, 568, + /* 3830 */ 495, 568, 568, 498, 568, 568, 568, 502, 503, 504, + /* 3840 */ 505, 506, 507, 387, 568, 510, 511, 512, 568, 568, + /* 3850 */ 568, 568, 568, 568, 568, 568, 568, 568, 402, 568, + /* 3860 */ 568, 568, 568, 568, 568, 387, 495, 568, 568, 498, + /* 3870 */ 568, 568, 568, 502, 503, 504, 505, 506, 507, 568, + /* 3880 */ 402, 510, 511, 512, 387, 568, 568, 568, 432, 568, + /* 3890 */ 568, 568, 568, 568, 568, 568, 568, 568, 568, 402, + /* 3900 */ 568, 568, 568, 568, 448, 568, 450, 568, 568, 568, + /* 3910 */ 432, 568, 568, 568, 568, 568, 568, 568, 568, 568, + /* 3920 */ 568, 568, 568, 568, 568, 568, 448, 568, 450, 432, + /* 3930 */ 568, 568, 568, 387, 568, 568, 568, 568, 568, 568, + /* 3940 */ 568, 568, 568, 568, 568, 448, 568, 450, 402, 568, + /* 3950 */ 568, 495, 568, 568, 498, 568, 568, 568, 502, 503, + /* 3960 */ 504, 505, 506, 507, 568, 568, 510, 511, 512, 568, + /* 3970 */ 568, 387, 568, 495, 568, 568, 498, 568, 432, 568, + /* 3980 */ 502, 503, 504, 505, 506, 507, 402, 568, 510, 511, + /* 3990 */ 512, 568, 495, 568, 448, 498, 450, 568, 568, 502, + /* 4000 */ 503, 504, 505, 506, 507, 568, 568, 510, 511, 512, + /* 4010 */ 568, 568, 568, 568, 568, 568, 432, 568, 568, 568, + /* 4020 */ 387, 568, 568, 568, 568, 568, 568, 568, 568, 568, + /* 4030 */ 568, 568, 448, 568, 450, 402, 568, 568, 568, 568, + /* 4040 */ 568, 495, 568, 568, 498, 568, 568, 568, 502, 503, + /* 4050 */ 504, 505, 506, 507, 387, 568, 510, 511, 512, 568, + /* 4060 */ 568, 568, 568, 568, 568, 432, 568, 568, 568, 402, + /* 4070 */ 568, 568, 568, 568, 568, 568, 568, 568, 568, 495, + /* 4080 */ 568, 448, 498, 450, 568, 568, 502, 503, 504, 505, + /* 4090 */ 506, 507, 568, 568, 510, 511, 512, 568, 568, 432, + /* 4100 */ 568, 568, 568, 568, 568, 568, 568, 568, 568, 568, + /* 4110 */ 568, 568, 568, 568, 568, 448, 568, 450, 568, 568, + /* 4120 */ 568, 568, 568, 568, 568, 568, 568, 568, 495, 568, + /* 4130 */ 568, 498, 568, 568, 568, 502, 503, 504, 505, 506, + /* 4140 */ 507, 568, 387, 510, 511, 512, 568, 568, 568, 568, + /* 4150 */ 568, 568, 568, 568, 568, 568, 568, 402, 568, 568, + /* 4160 */ 568, 387, 495, 568, 568, 498, 568, 568, 568, 502, + /* 4170 */ 503, 504, 505, 506, 507, 568, 402, 510, 511, 512, + /* 4180 */ 568, 568, 387, 568, 568, 568, 568, 432, 568, 568, + /* 4190 */ 568, 568, 568, 568, 568, 568, 568, 402, 568, 568, + /* 4200 */ 568, 568, 568, 448, 568, 450, 432, 568, 568, 568, + /* 4210 */ 568, 568, 568, 568, 568, 568, 568, 568, 568, 568, + /* 4220 */ 568, 568, 448, 568, 450, 568, 387, 432, 568, 568, + /* 4230 */ 568, 568, 568, 568, 568, 568, 568, 568, 568, 568, + /* 4240 */ 568, 402, 568, 448, 568, 450, 568, 568, 568, 568, + /* 4250 */ 495, 568, 568, 498, 568, 568, 568, 502, 503, 504, + /* 4260 */ 505, 506, 507, 568, 568, 510, 511, 512, 387, 495, + /* 4270 */ 568, 432, 498, 568, 568, 568, 502, 503, 504, 505, + /* 4280 */ 506, 507, 568, 402, 510, 511, 512, 448, 568, 450, + /* 4290 */ 495, 568, 568, 498, 387, 568, 568, 502, 503, 504, + /* 4300 */ 505, 506, 507, 568, 568, 510, 511, 512, 568, 402, + /* 4310 */ 568, 568, 568, 432, 568, 568, 568, 568, 568, 568, + /* 4320 */ 568, 568, 568, 568, 568, 568, 568, 568, 568, 448, + /* 4330 */ 568, 450, 568, 568, 495, 568, 568, 498, 568, 432, + /* 4340 */ 568, 502, 503, 504, 505, 506, 507, 568, 568, 510, + /* 4350 */ 511, 512, 568, 568, 568, 448, 568, 450, 568, 568, + /* 4360 */ 568, 568, 568, 568, 568, 568, 568, 568, 568, 568, + /* 4370 */ 568, 568, 568, 568, 568, 568, 495, 568, 568, 498, + /* 4380 */ 568, 568, 568, 502, 503, 504, 505, 506, 507, 568, + /* 4390 */ 568, 510, 511, 512, 568, 568, 568, 568, 568, 568, + /* 4400 */ 568, 568, 495, 568, 568, 498, 568, 568, 568, 502, + /* 4410 */ 503, 504, 505, 506, 507, 568, 568, 510, 511, 512, + /* 4420 */ 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, + /* 4430 */ 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, + /* 4440 */ 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, + /* 4450 */ 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, + /* 4460 */ 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, + /* 4470 */ 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, + /* 4480 */ 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, + /* 4490 */ 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, + /* 4500 */ 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, + /* 4510 */ 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, + /* 4520 */ 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, + /* 4530 */ 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, + /* 4540 */ 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, + /* 4550 */ 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, + /* 4560 */ 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, + /* 4570 */ 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, + /* 4580 */ 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, + /* 4590 */ 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, + /* 4600 */ 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, + /* 4610 */ 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, + /* 4620 */ 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, + /* 4630 */ 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, + /* 4640 */ 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, + /* 4650 */ 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, + /* 4660 */ 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, + /* 4670 */ 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, + /* 4680 */ 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, + /* 4690 */ 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, + /* 4700 */ 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, /* 4710 */ 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, /* 4720 */ 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, /* 4730 */ 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, @@ -1562,39 +1530,11 @@ static const YYCODETYPE yy_lookahead[] = { /* 4770 */ 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, /* 4780 */ 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, /* 4790 */ 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, - /* 4800 */ 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, - /* 4810 */ 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, - /* 4820 */ 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, - /* 4830 */ 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, - /* 4840 */ 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, - /* 4850 */ 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, - /* 4860 */ 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, - /* 4870 */ 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, - /* 4880 */ 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, - /* 4890 */ 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, - /* 4900 */ 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, - /* 4910 */ 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, - /* 4920 */ 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, - /* 4930 */ 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, - /* 4940 */ 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, - /* 4950 */ 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, - /* 4960 */ 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, - /* 4970 */ 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, - /* 4980 */ 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, - /* 4990 */ 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, - /* 5000 */ 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, - /* 5010 */ 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, - /* 5020 */ 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, - /* 5030 */ 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, - /* 5040 */ 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, - /* 5050 */ 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, - /* 5060 */ 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, - /* 5070 */ 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, - /* 5080 */ 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, + /* 4800 */ 384, 384, 384, 384, }; #define YY_SHIFT_COUNT (1008) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (2824) +#define YY_SHIFT_MAX (2944) static const unsigned short int yy_shift_ofst[] = { /* 0 */ 2452, 273, 546, 273, 820, 820, 820, 820, 820, 820, /* 10 */ 820, 820, 820, 820, 820, 820, 1093, 1912, 1912, 2185, @@ -1602,250 +1542,250 @@ static const unsigned short int yy_shift_ofst[] = { /* 30 */ 1912, 1912, 1639, 1912, 1912, 1912, 1912, 1912, 1912, 1912, /* 40 */ 1912, 1912, 1912, 1912, 1912, 1912, 1912, 1912, 1912, 1912, /* 50 */ 1912, 1912, 1912, 1912, 1912, 1912, 1912, 1912, 1912, 1912, - /* 60 */ 1912, 1912, 85, 530, 88, 141, 75, 83, 75, 75, - /* 70 */ 141, 141, 75, 1205, 75, 272, 1205, 627, 75, 11, - /* 80 */ 727, 155, 155, 76, 76, 727, 727, 145, 145, 155, - /* 90 */ 386, 386, 164, 90, 90, 286, 576, 76, 76, 76, - /* 100 */ 76, 76, 76, 76, 76, 76, 76, 76, 199, 277, - /* 110 */ 361, 76, 76, 269, 11, 76, 199, 76, 11, 76, - /* 120 */ 76, 76, 76, 11, 76, 76, 76, 11, 76, 11, - /* 130 */ 11, 11, 354, 490, 490, 102, 102, 234, 558, 567, - /* 140 */ 48, 1074, 1074, 1074, 1074, 1074, 1074, 1074, 1074, 1074, - /* 150 */ 1074, 1074, 1074, 1074, 1074, 1074, 1074, 1074, 1074, 1074, - /* 160 */ 714, 1106, 386, 164, 956, 956, 603, 1113, 1113, 1113, - /* 170 */ 433, 433, 407, 755, 603, 269, 11, 350, 11, 11, - /* 180 */ 227, 11, 11, 531, 11, 531, 531, 577, 709, 102, - /* 190 */ 102, 102, 102, 102, 102, 2812, 821, 21, 46, 430, - /* 200 */ 430, 387, 449, 246, 267, 604, 194, 560, 917, 656, - /* 210 */ 656, 623, 941, 1006, 1006, 1006, 1114, 1006, 1242, 1031, - /* 220 */ 666, 1253, 1406, 1293, 437, 1026, 1026, 1399, 1411, 1411, - /* 230 */ 1271, 1397, 690, 1026, 755, 1498, 1757, 1804, 1808, 1599, - /* 240 */ 269, 1808, 269, 1621, 1804, 1825, 1800, 1825, 1800, 1658, - /* 250 */ 1804, 1825, 1804, 1800, 1658, 1658, 1658, 1746, 1754, 1804, - /* 260 */ 1804, 1762, 1804, 1804, 1804, 1866, 1836, 1866, 1836, 1808, - /* 270 */ 269, 269, 1888, 269, 1907, 1909, 269, 1907, 269, 1918, - /* 280 */ 269, 1921, 269, 269, 1804, 269, 1866, 11, 11, 11, - /* 290 */ 11, 11, 11, 11, 11, 11, 11, 11, 1804, 709, - /* 300 */ 709, 1866, 531, 531, 531, 1713, 1857, 1808, 354, 1957, - /* 310 */ 1760, 1764, 1888, 354, 1498, 1804, 531, 1675, 1677, 1675, - /* 320 */ 1677, 1669, 1791, 1675, 1671, 1670, 1693, 1498, 1705, 1702, - /* 330 */ 1678, 1680, 1685, 1825, 2005, 1903, 1727, 1907, 354, 354, - /* 340 */ 1677, 531, 531, 531, 531, 1677, 531, 1858, 354, 531, - /* 350 */ 1921, 354, 1952, 531, 1882, 1921, 354, 577, 354, 1825, - /* 360 */ 531, 531, 531, 531, 531, 531, 531, 531, 531, 531, - /* 370 */ 531, 531, 531, 531, 531, 531, 531, 531, 531, 531, - /* 380 */ 531, 531, 1979, 531, 1804, 354, 2077, 2070, 2072, 2078, - /* 390 */ 1866, 4706, 4706, 4706, 4706, 4706, 4706, 4706, 4706, 4706, - /* 400 */ 4706, 4706, 4706, 39, 1212, 63, 1057, 509, 585, 594, - /* 410 */ 867, 973, 1011, 1222, 1130, 197, 1176, 1327, 1256, 1448, - /* 420 */ 1547, 1557, 1676, 884, 920, 212, 212, 212, 212, 212, - /* 430 */ 212, 212, 212, 212, 643, 431, 1318, 762, 309, 309, - /* 440 */ 245, 103, 583, 434, 484, 493, 716, 182, 1359, 1365, - /* 450 */ 27, 27, 976, 1012, 674, 976, 976, 976, 1496, 1291, - /* 460 */ 1398, 1446, 1420, 1314, 1439, 1441, 1390, 1453, 1392, 1417, - /* 470 */ 1453, 1424, 889, 1564, 1567, 1489, 1595, 1596, 1634, 1346, - /* 480 */ 1472, 1552, 1412, 1553, 1554, 1558, 1560, 1370, 1435, 1497, - /* 490 */ 1566, 1571, 1578, 1583, 1640, 1589, 1404, 1602, 1610, 1620, - /* 500 */ 1604, 1632, 1633, 1647, 1662, 1664, 1659, 1666, 1689, 1691, - /* 510 */ 1696, 1699, 1701, 1704, 1712, 1716, 1719, 1673, 1453, 1687, - /* 520 */ 1700, 1707, 1711, 1720, 1475, 1703, 1561, 1624, 1751, 1752, - /* 530 */ 1731, 111, 2127, 2136, 2140, 2100, 2149, 2114, 1908, 2117, - /* 540 */ 2118, 2119, 1913, 2156, 2122, 2123, 1916, 2125, 2162, 2163, - /* 550 */ 1920, 2168, 2144, 2181, 2151, 2199, 2178, 2201, 2166, 1965, - /* 560 */ 2206, 1984, 2209, 1986, 1987, 1993, 1997, 2214, 2215, 2216, - /* 570 */ 2006, 2008, 2217, 2220, 2064, 2173, 2174, 2226, 2191, 2228, - /* 580 */ 2230, 2195, 2179, 2234, 2184, 2236, 2190, 2238, 2239, 2240, - /* 590 */ 2192, 2241, 2242, 2245, 2246, 2247, 2249, 2075, 2218, 2252, - /* 600 */ 2079, 2257, 2258, 2259, 2260, 2261, 2262, 2263, 2264, 2265, - /* 610 */ 2266, 2268, 2269, 2270, 2271, 2272, 2274, 2275, 2276, 2277, - /* 620 */ 2278, 2229, 2279, 2235, 2281, 2283, 2284, 2285, 2286, 2287, - /* 630 */ 2288, 2290, 2292, 2293, 2296, 2135, 2294, 2142, 2308, 2145, - /* 640 */ 2309, 2314, 2298, 2273, 2299, 2280, 2316, 2250, 2322, 2267, - /* 650 */ 2291, 2326, 2282, 2329, 2295, 2330, 2331, 2297, 2300, 2305, - /* 660 */ 2334, 2304, 2302, 2311, 2341, 2306, 2307, 2315, 2362, 2332, - /* 670 */ 2366, 2320, 2325, 2337, 2321, 2323, 2357, 2327, 2379, 2335, - /* 680 */ 2338, 2381, 2383, 2384, 2385, 2344, 2182, 2390, 2321, 2340, - /* 690 */ 2392, 2321, 2342, 2394, 2395, 2328, 2396, 2397, 2363, 2346, - /* 700 */ 2354, 2402, 2369, 2352, 2365, 2407, 2374, 2358, 2367, 2413, - /* 710 */ 2378, 2361, 2372, 2417, 2418, 2419, 2421, 2422, 2424, 2336, - /* 720 */ 2303, 2389, 2411, 2434, 2431, 2405, 2426, 2435, 2436, 2438, - /* 730 */ 2440, 2441, 2443, 2444, 2427, 2448, 2446, 2447, 2432, 2449, - /* 740 */ 2484, 2464, 2487, 2467, 2490, 2470, 2437, 2491, 2474, 2461, - /* 750 */ 2499, 2500, 2501, 2466, 2503, 2468, 2505, 2471, 2506, 2486, - /* 760 */ 2492, 2475, 2477, 2478, 2399, 2403, 2510, 2333, 2310, 2312, - /* 770 */ 2404, 2313, 2321, 2476, 2520, 2339, 2493, 2508, 2528, 2318, - /* 780 */ 2512, 2345, 2343, 2541, 2543, 2351, 2347, 2353, 2348, 2542, - /* 790 */ 2514, 2243, 2433, 2439, 2451, 2442, 2513, 2516, 2453, 2502, - /* 800 */ 2456, 2504, 2454, 2445, 2526, 2529, 2455, 2457, 2458, 2459, - /* 810 */ 2463, 2530, 2519, 2524, 2462, 2531, 2289, 2511, 2465, 2549, - /* 820 */ 2479, 2517, 2482, 2483, 2581, 2552, 2349, 2550, 2564, 2565, - /* 830 */ 2569, 2571, 2574, 2495, 2496, 2562, 2317, 2583, 2563, 2617, - /* 840 */ 2618, 2507, 2575, 2509, 2521, 2527, 2533, 2425, 2534, 2620, - /* 850 */ 2580, 2428, 2627, 2525, 2535, 2460, 2585, 2472, 2610, 2523, - /* 860 */ 2359, 2540, 2642, 2632, 2393, 2544, 2551, 2553, 2554, 2555, - /* 870 */ 2539, 2548, 2556, 2557, 2558, 2559, 2560, 2561, 2606, 2566, - /* 880 */ 2567, 2607, 2568, 2654, 2429, 2572, 2576, 2680, 2570, 2578, - /* 890 */ 2494, 2639, 2579, 2587, 2689, 2674, 2588, 2582, 2321, 2656, - /* 900 */ 2590, 2593, 2594, 2597, 2598, 2589, 2687, 2485, 2600, 2681, - /* 910 */ 2682, 2604, 2605, 2684, 2608, 2609, 2686, 2556, 2611, 2688, - /* 920 */ 2557, 2612, 2694, 2558, 2613, 2695, 2559, 2596, 2599, 2601, - /* 930 */ 2602, 2619, 2702, 2622, 2704, 2626, 2702, 2702, 2720, 2667, - /* 940 */ 2669, 2723, 2710, 2711, 2713, 2715, 2716, 2717, 2718, 2721, - /* 950 */ 2722, 2724, 2726, 2677, 2647, 2683, 2655, 2730, 2731, 2732, - /* 960 */ 2733, 2744, 2734, 2736, 2738, 2696, 2427, 2739, 2448, 2740, - /* 970 */ 2741, 2743, 2745, 2758, 2746, 2783, 2748, 2735, 2742, 2785, - /* 980 */ 2751, 2737, 2749, 2788, 2754, 2747, 2750, 2792, 2760, 2755, - /* 990 */ 2753, 2808, 2763, 2800, 2793, 2778, 2816, 2795, 2787, 2786, - /* 1000 */ 2796, 2814, 2817, 2818, 2819, 2822, 2824, + /* 60 */ 1912, 1912, 557, 662, 134, 141, 179, 207, 179, 179, + /* 70 */ 141, 141, 179, 1995, 179, 272, 1995, 566, 179, 36, + /* 80 */ 1447, 320, 320, 61, 61, 1447, 1447, 145, 145, 320, + /* 90 */ 681, 681, 729, 837, 837, 34, 86, 61, 61, 61, + /* 100 */ 61, 61, 61, 61, 61, 61, 61, 61, 195, 232, + /* 110 */ 326, 61, 61, 293, 36, 61, 195, 61, 36, 61, + /* 120 */ 61, 61, 61, 36, 61, 61, 61, 36, 61, 36, + /* 130 */ 36, 36, 396, 490, 490, 102, 102, 230, 955, 14, + /* 140 */ 48, 85, 85, 85, 85, 85, 85, 85, 85, 85, + /* 150 */ 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, + /* 160 */ 363, 219, 681, 729, 909, 909, 268, 691, 691, 691, + /* 170 */ 636, 636, 1002, 1095, 268, 293, 36, 483, 36, 36, + /* 180 */ 339, 36, 36, 638, 36, 638, 638, 642, 742, 102, + /* 190 */ 102, 102, 102, 102, 102, 2364, 569, 21, 75, 337, + /* 200 */ 337, 582, 70, 455, 492, 285, 562, 974, 1009, 365, + /* 210 */ 365, 901, 979, 649, 649, 649, 838, 649, 737, 1008, + /* 220 */ 1182, 1236, 1110, 1300, 1088, 1208, 1208, 1324, 1392, 1392, + /* 230 */ 1262, 713, 1306, 1208, 1095, 1544, 1821, 1859, 1867, 1654, + /* 240 */ 293, 1867, 293, 1712, 1859, 1911, 1905, 1911, 1905, 1770, + /* 250 */ 1859, 1911, 1859, 1905, 1770, 1770, 1770, 1857, 1861, 1859, + /* 260 */ 1859, 1868, 1859, 1859, 1859, 1965, 1935, 1965, 1935, 1867, + /* 270 */ 293, 293, 1973, 293, 1980, 1985, 293, 1980, 293, 1991, + /* 280 */ 293, 1998, 293, 293, 1971, 1971, 1859, 293, 1965, 36, + /* 290 */ 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, + /* 300 */ 1859, 742, 742, 1965, 638, 638, 638, 1800, 1940, 1867, + /* 310 */ 396, 2051, 1852, 1854, 1973, 396, 1544, 1859, 638, 1758, + /* 320 */ 1762, 1758, 1762, 1759, 1879, 1758, 1767, 1771, 1789, 1544, + /* 330 */ 1797, 1799, 1773, 1777, 1776, 1911, 2092, 1994, 1813, 1980, + /* 340 */ 396, 396, 1762, 638, 638, 638, 638, 1762, 638, 1944, + /* 350 */ 396, 638, 1998, 396, 2044, 638, 1961, 1998, 396, 642, + /* 360 */ 396, 1911, 638, 638, 638, 638, 638, 638, 638, 638, + /* 370 */ 638, 638, 638, 638, 638, 638, 638, 638, 638, 638, + /* 380 */ 638, 638, 638, 638, 2087, 638, 1859, 396, 2188, 2181, + /* 390 */ 2187, 2182, 1965, 4420, 4420, 4420, 4420, 4420, 4420, 4420, + /* 400 */ 4420, 4420, 4420, 4420, 4420, 39, 1119, 154, 1751, 367, + /* 410 */ 84, 727, 884, 897, 1274, 1407, 1129, 197, 1320, 1562, + /* 420 */ 1417, 1768, 1820, 212, 1676, 1044, 1152, 51, 51, 51, + /* 430 */ 51, 51, 51, 51, 51, 51, 859, 590, 454, 604, + /* 440 */ 3, 3, 283, 800, 442, 108, 317, 311, 626, 1071, + /* 450 */ 475, 1127, 576, 576, 1164, 540, 1159, 1164, 1164, 1164, + /* 460 */ 1536, 894, 898, 1453, 1298, 1405, 1397, 482, 1436, 844, + /* 470 */ 1449, 1460, 844, 1479, 1478, 1551, 1568, 1473, 1594, 1600, + /* 480 */ 1660, 1351, 1579, 1585, 1428, 1620, 1622, 1623, 1625, 1402, + /* 490 */ 174, 2, 1631, 1633, 1669, 1690, 1695, 1698, 1455, 1701, + /* 500 */ 1702, 1711, 1658, 1710, 1738, 1755, 1774, 1775, 1699, 1703, + /* 510 */ 1788, 1808, 1830, 1832, 1834, 1836, 1847, 1851, 1860, 1791, + /* 520 */ 844, 1792, 1819, 1833, 1835, 1841, 1526, 1599, 1444, 1502, + /* 530 */ 1598, 1670, 1640, 1693, 2245, 2257, 2259, 2216, 2268, 2233, + /* 540 */ 2026, 2235, 2236, 2246, 2037, 2283, 2248, 2249, 2042, 2251, + /* 550 */ 2298, 2299, 2045, 2290, 2255, 2292, 2258, 2293, 2273, 2296, + /* 560 */ 2265, 2063, 2303, 2081, 2308, 2085, 2086, 2094, 2097, 2320, + /* 570 */ 2321, 2325, 2114, 2116, 2328, 2329, 2172, 2281, 2282, 2334, + /* 580 */ 2304, 2339, 2341, 2306, 2291, 2343, 2295, 2344, 2300, 2348, + /* 590 */ 2349, 2350, 2301, 2353, 2355, 2356, 2357, 2369, 2370, 2195, + /* 600 */ 2336, 2373, 2198, 2378, 2379, 2381, 2382, 2384, 2385, 2388, + /* 610 */ 2389, 2390, 2391, 2392, 2393, 2394, 2395, 2396, 2397, 2398, + /* 620 */ 2399, 2400, 2404, 2313, 2405, 2359, 2407, 2409, 2410, 2411, + /* 630 */ 2412, 2413, 2414, 2415, 2416, 2401, 2419, 2262, 2421, 2267, + /* 640 */ 2422, 2269, 2426, 2431, 2432, 2383, 2439, 2408, 2433, 2366, + /* 650 */ 2436, 2403, 2417, 2437, 2406, 2441, 2420, 2462, 2472, 2440, + /* 660 */ 2423, 2429, 2479, 2444, 2427, 2438, 2484, 2449, 2435, 2442, + /* 670 */ 2487, 2454, 2491, 2446, 2453, 2463, 2448, 2450, 2486, 2451, + /* 680 */ 2503, 2459, 2461, 2506, 2508, 2510, 2511, 2468, 2309, 2513, + /* 690 */ 2448, 2464, 2518, 2448, 2475, 2519, 2520, 2455, 2527, 2528, + /* 700 */ 2493, 2476, 2489, 2534, 2499, 2482, 2494, 2539, 2504, 2488, + /* 710 */ 2497, 2543, 2509, 2490, 2502, 2547, 2548, 2549, 2550, 2551, + /* 720 */ 2552, 2443, 2434, 2522, 2532, 2560, 2541, 2529, 2530, 2535, + /* 730 */ 2536, 2537, 2538, 2540, 2545, 2546, 2523, 2542, 2553, 2554, + /* 740 */ 2555, 2557, 2570, 2561, 2579, 2562, 2585, 2564, 2531, 2591, + /* 750 */ 2572, 2559, 2592, 2596, 2597, 2563, 2598, 2565, 2604, 2569, + /* 760 */ 2613, 2599, 2594, 2582, 2583, 2584, 2507, 2512, 2622, 2445, + /* 770 */ 2402, 2424, 2514, 2428, 2448, 2573, 2626, 2456, 2603, 2608, + /* 780 */ 2643, 2425, 2623, 2457, 2447, 2647, 2653, 2466, 2465, 2471, + /* 790 */ 2467, 2651, 2624, 2342, 2558, 2566, 2568, 2571, 2619, 2630, + /* 800 */ 2574, 2615, 2567, 2617, 2575, 2578, 2638, 2639, 2580, 2588, + /* 810 */ 2589, 2590, 2600, 2641, 2633, 2634, 2593, 2642, 2363, 2606, + /* 820 */ 2601, 2648, 2595, 2654, 2602, 2607, 2694, 2673, 2430, 2671, + /* 830 */ 2676, 2677, 2678, 2679, 2683, 2609, 2610, 2669, 2460, 2689, + /* 840 */ 2680, 2724, 2727, 2614, 2684, 2616, 2618, 2620, 2621, 2544, + /* 850 */ 2627, 2730, 2697, 2576, 2738, 2629, 2628, 2586, 2702, 2611, + /* 860 */ 2714, 2635, 2474, 2636, 2748, 2729, 2500, 2637, 2640, 2655, + /* 870 */ 2660, 2663, 2646, 2661, 2664, 2665, 2666, 2668, 2670, 2672, + /* 880 */ 2703, 2675, 2682, 2706, 2686, 2747, 2577, 2688, 2692, 2786, + /* 890 */ 2695, 2698, 2612, 2754, 2699, 2687, 2809, 2790, 2700, 2701, + /* 900 */ 2448, 2759, 2707, 2708, 2705, 2709, 2710, 2691, 2793, 2605, + /* 910 */ 2711, 2792, 2794, 2716, 2713, 2796, 2721, 2722, 2803, 2664, + /* 920 */ 2725, 2804, 2665, 2726, 2807, 2666, 2728, 2810, 2668, 2712, + /* 930 */ 2715, 2717, 2718, 2732, 2815, 2736, 2817, 2742, 2815, 2815, + /* 940 */ 2836, 2750, 2784, 2838, 2825, 2826, 2827, 2828, 2829, 2831, + /* 950 */ 2833, 2834, 2837, 2839, 2840, 2795, 2763, 2797, 2765, 2845, + /* 960 */ 2844, 2847, 2848, 2859, 2850, 2851, 2852, 2813, 2523, 2860, + /* 970 */ 2542, 2864, 2866, 2867, 2868, 2883, 2870, 2907, 2872, 2855, + /* 980 */ 2871, 2910, 2875, 2858, 2874, 2914, 2890, 2873, 2887, 2933, + /* 990 */ 2898, 2881, 2892, 2937, 2902, 2939, 2918, 2906, 2944, 2923, + /* 1000 */ 2913, 2911, 2912, 2927, 2929, 2931, 2932, 2930, 2935, }; -#define YY_REDUCE_COUNT (402) -#define YY_REDUCE_MIN (-527) -#define YY_REDUCE_MAX (4194) +#define YY_REDUCE_COUNT (404) +#define YY_REDUCE_MIN (-531) +#define YY_REDUCE_MAX (3907) static const short yy_reduce_ofst[] = { - /* 0 */ -376, -346, 173, 203, 447, 710, 1023, 1296, 1529, 1569, - /* 10 */ 1801, 1842, 2086, 2129, 2301, 2324, -89, 750, 553, 998, - /* 20 */ 1104, 1373, 1926, 2450, 2469, 2536, 2603, 2624, 2693, 2774, - /* 30 */ 2799, 2820, 2932, 2952, 2971, 3038, 3105, 3125, 3202, 3269, - /* 40 */ 3292, 3315, 3380, 3403, 3426, 3493, 3575, 3605, 3672, 3695, - /* 50 */ 3718, 3783, 3806, 3829, 3896, 3963, 3993, 4060, 4083, 4106, - /* 60 */ 4171, 4194, -48, -242, -226, 61, -46, 852, 1185, 1200, - /* 70 */ 359, 1048, 1220, -390, -527, -387, -118, 284, 592, -408, - /* 80 */ -397, -445, -59, -214, 56, -328, 413, -394, -49, -201, - /* 90 */ -345, -99, 184, -14, 215, -252, 491, 502, 512, 573, - /* 100 */ 575, 395, 442, 616, 651, 734, 746, 460, -385, 538, - /* 110 */ 119, 749, 761, -19, 417, 772, -234, 808, -424, 887, - /* 120 */ 903, 911, 913, 229, 928, 968, 982, 188, 639, -431, - /* 130 */ 729, 335, 832, -476, -476, -93, -50, 689, -392, -65, - /* 140 */ 261, -16, 120, 294, 733, 736, 753, 778, 811, 816, - /* 150 */ 836, 933, 946, 950, 958, 975, 981, 1004, 1005, 1019, - /* 160 */ -429, 19, 118, 596, 642, 788, 786, 19, 323, 401, - /* 170 */ 340, 478, 888, -126, 833, 528, 869, 967, 296, 756, - /* 180 */ 725, 851, 523, 875, 848, 952, 988, 375, 1025, 318, - /* 190 */ 428, 445, 527, 607, 692, 520, 739, 781, 885, 966, - /* 200 */ 966, 745, 984, 995, 1016, 1257, 966, 1233, 1233, 1249, - /* 210 */ 1278, 1322, 1275, 1182, 1184, 1199, 1283, 1206, 1233, 1307, - /* 220 */ 1364, 1276, 1368, 1326, 1294, 1324, 1325, 1233, 1236, 1258, - /* 230 */ 1228, 1270, 1268, 1337, 1389, 1341, 1321, 1425, 1336, 1339, - /* 240 */ 1427, 1349, 1428, 1363, 1442, 1444, 1393, 1449, 1394, 1400, - /* 250 */ 1451, 1452, 1455, 1402, 1407, 1408, 1410, 1450, 1458, 1465, - /* 260 */ 1467, 1461, 1479, 1480, 1484, 1493, 1491, 1501, 1492, 1422, - /* 270 */ 1481, 1504, 1466, 1516, 1525, 1460, 1520, 1533, 1527, 1473, - /* 280 */ 1530, 1482, 1534, 1535, 1542, 1536, 1555, 1521, 1522, 1523, - /* 290 */ 1524, 1526, 1528, 1531, 1532, 1537, 1538, 1539, 1546, 1568, - /* 300 */ 1574, 1572, 1514, 1518, 1540, 1478, 1487, 1490, 1573, 1495, - /* 310 */ 1502, 1505, 1541, 1580, 1515, 1590, 1545, 1447, 1543, 1456, - /* 320 */ 1544, 1454, 1457, 1462, 1459, 1463, 1469, 1548, 1483, 1485, - /* 330 */ 1470, 1468, 1494, 1619, 1549, 1500, 1503, 1641, 1635, 1638, - /* 340 */ 1581, 1603, 1607, 1608, 1609, 1591, 1612, 1597, 1652, 1615, - /* 350 */ 1616, 1660, 1556, 1622, 1623, 1626, 1674, 1656, 1681, 1686, - /* 360 */ 1643, 1646, 1648, 1649, 1650, 1651, 1653, 1654, 1655, 1661, - /* 370 */ 1663, 1665, 1668, 1672, 1679, 1682, 1684, 1690, 1692, 1694, - /* 380 */ 1695, 1697, 1688, 1698, 1706, 1708, 1717, 1725, 1718, 1726, - /* 390 */ 1728, 1657, 1710, 1627, 1637, 1683, 1721, 1709, 1714, 1715, - /* 400 */ 1722, 1723, 1740, + /* 0 */ 129, -347, -96, 69, 202, 435, 472, 708, 749, 889, + /* 10 */ 1022, 1255, 1292, 1435, 1634, 1812, 996, 616, 1103, 1856, + /* 20 */ 343, 1542, 2105, 2130, 2261, 2289, 2387, 2418, 2469, 2556, + /* 30 */ 2581, 2662, 2693, 2760, 2788, 2857, 2886, 2922, 3007, 3029, + /* 40 */ 3050, 3094, 3135, 3163, 3200, 3284, 3306, 3335, 3371, 3456, + /* 50 */ 3478, 3497, 3546, 3584, 3633, 3667, 3755, 3774, 3795, 3839, + /* 60 */ 3881, 3907, 1034, 193, 386, 434, 171, 462, 1206, 1319, + /* 70 */ 911, 1142, 1440, -31, -531, -344, 255, -529, -231, 68, + /* 80 */ -325, -427, 152, -213, 56, -22, 254, -395, -393, -409, + /* 90 */ 237, 333, -199, -373, 117, 553, 198, 413, 468, 506, + /* 100 */ 596, 478, 614, 667, 733, 746, 815, 653, 209, -77, + /* 110 */ 360, 695, 821, -141, -14, 848, 648, 856, -346, 905, + /* 120 */ 940, 968, 1050, 615, 1054, 1056, 1065, 595, 1091, 718, + /* 130 */ 756, 849, -5, -224, -224, 282, -424, -419, -221, -431, + /* 140 */ 107, 270, 296, 539, 542, 738, 787, 822, 875, 892, + /* 150 */ 933, 993, 1020, 1063, 1074, 1089, 1092, 1100, 1101, 1102, + /* 160 */ -281, -282, 153, 437, 509, 550, 565, -282, 77, 148, + /* 170 */ 385, 549, 16, 804, 755, 620, 30, 537, 816, 864, + /* 180 */ 760, 723, 885, 937, 1033, 966, 1068, -98, 1027, -422, + /* 190 */ 438, 520, 656, 684, 765, 666, 743, 842, 777, 710, + /* 200 */ 710, 764, 783, 814, 834, 998, 710, 978, 978, 1124, + /* 210 */ 1177, 1062, 1061, 1049, 1118, 1150, 1181, 1160, 978, 1253, + /* 220 */ 1314, 1237, 1330, 1299, 1271, 1296, 1315, 978, 1248, 1272, + /* 230 */ 1264, 1313, 1310, 1379, 1433, 1386, 1381, 1485, 1394, 1398, + /* 240 */ 1505, 1409, 1506, 1450, 1527, 1541, 1496, 1553, 1499, 1507, + /* 250 */ 1561, 1563, 1565, 1510, 1509, 1514, 1515, 1550, 1560, 1574, + /* 260 */ 1575, 1569, 1576, 1581, 1583, 1592, 1590, 1595, 1593, 1513, + /* 270 */ 1586, 1591, 1545, 1596, 1601, 1533, 1602, 1607, 1603, 1548, + /* 280 */ 1606, 1558, 1610, 1612, 1597, 1604, 1627, 1616, 1635, 1609, + /* 290 */ 1611, 1618, 1619, 1624, 1626, 1628, 1629, 1630, 1636, 1637, + /* 300 */ 1638, 1644, 1645, 1648, 1582, 1632, 1641, 1567, 1571, 1584, + /* 310 */ 1659, 1587, 1605, 1608, 1642, 1665, 1621, 1675, 1643, 1532, + /* 320 */ 1615, 1538, 1647, 1543, 1546, 1547, 1552, 1554, 1557, 1646, + /* 330 */ 1572, 1580, 1555, 1556, 1559, 1716, 1649, 1589, 1614, 1721, + /* 340 */ 1717, 1718, 1666, 1679, 1685, 1694, 1700, 1681, 1704, 1682, + /* 350 */ 1743, 1707, 1719, 1748, 1667, 1713, 1706, 1720, 1754, 1736, + /* 360 */ 1756, 1785, 1740, 1752, 1753, 1760, 1761, 1764, 1769, 1772, + /* 370 */ 1778, 1779, 1780, 1781, 1782, 1783, 1784, 1786, 1787, 1790, + /* 380 */ 1793, 1794, 1798, 1802, 1766, 1803, 1805, 1796, 1826, 1827, + /* 390 */ 1825, 1838, 1831, 1801, 1806, 1742, 1750, 1795, 1811, 1815, + /* 400 */ 1823, 1818, 1837, 1845, 1870, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, - /* 10 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, - /* 20 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, - /* 30 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, - /* 40 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, - /* 50 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, - /* 60 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, - /* 70 */ 2265, 2265, 2640, 2265, 2265, 2596, 2265, 2265, 2265, 2265, - /* 80 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, - /* 90 */ 2603, 2603, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, - /* 100 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, - /* 110 */ 2265, 2265, 2265, 2371, 2265, 2265, 2265, 2265, 2265, 2265, - /* 120 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, - /* 130 */ 2265, 2265, 2369, 2911, 2265, 3037, 2681, 2265, 2265, 2940, - /* 140 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, - /* 150 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, - /* 160 */ 2265, 2923, 2265, 2265, 2342, 2342, 2265, 2923, 2923, 2923, - /* 170 */ 2883, 2883, 2369, 2265, 2265, 2371, 2265, 2683, 2265, 2265, - /* 180 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2512, 2295, 2265, - /* 190 */ 2265, 2265, 2265, 2265, 2265, 2666, 2265, 2265, 2969, 2915, - /* 200 */ 2916, 3031, 2265, 2972, 2934, 2265, 2929, 2265, 2265, 2265, - /* 210 */ 2265, 2265, 2959, 2265, 2265, 2265, 2265, 2265, 2265, 2608, - /* 220 */ 2265, 2710, 2265, 2457, 2660, 2265, 2265, 2265, 2265, 2265, - /* 230 */ 3015, 2913, 2953, 2265, 2265, 2963, 2265, 2265, 2265, 2698, - /* 240 */ 2371, 2265, 2371, 2653, 2591, 2265, 2601, 2265, 2601, 2598, - /* 250 */ 2265, 2265, 2265, 2601, 2598, 2598, 2598, 2445, 2441, 2265, - /* 260 */ 2265, 2439, 2265, 2265, 2265, 2265, 2325, 2265, 2325, 2265, - /* 270 */ 2371, 2371, 2265, 2371, 2265, 2265, 2371, 2265, 2371, 2265, - /* 280 */ 2371, 2265, 2371, 2371, 2265, 2371, 2265, 2265, 2265, 2265, - /* 290 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, - /* 300 */ 2265, 2265, 2265, 2265, 2265, 2696, 2676, 2265, 2369, 2265, - /* 310 */ 2664, 2662, 2265, 2369, 2963, 2265, 2265, 2985, 2980, 2985, - /* 320 */ 2980, 2999, 2995, 2985, 3004, 3001, 2965, 2963, 2946, 2942, - /* 330 */ 3034, 3021, 3017, 2265, 2265, 2951, 2949, 2265, 2369, 2369, - /* 340 */ 2980, 2265, 2265, 2265, 2265, 2980, 2265, 2265, 2369, 2265, - /* 350 */ 2265, 2369, 2265, 2265, 2265, 2265, 2369, 2265, 2369, 2265, - /* 360 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, - /* 370 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, - /* 380 */ 2265, 2265, 2474, 2265, 2265, 2369, 2265, 2297, 2299, 2309, - /* 390 */ 2265, 2655, 3037, 2681, 2686, 2636, 2636, 2515, 2515, 3037, - /* 400 */ 2515, 2372, 2270, 2265, 2265, 2265, 2265, 2265, 2265, 2265, - /* 410 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2815, 2265, - /* 420 */ 2265, 2265, 2265, 2265, 2265, 2998, 2997, 2816, 2265, 2887, - /* 430 */ 2886, 2885, 2876, 2815, 2470, 2265, 2265, 2265, 2814, 2813, - /* 440 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, - /* 450 */ 2627, 2626, 2807, 2265, 2265, 2808, 2806, 2805, 2265, 2265, - /* 460 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2461, 2265, 2265, - /* 470 */ 2458, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, - /* 480 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 3018, 3022, - /* 490 */ 2265, 2265, 2265, 2265, 2912, 2265, 2265, 2265, 2265, 2265, - /* 500 */ 2786, 2265, 2265, 2265, 2265, 2265, 2754, 2749, 2740, 2731, - /* 510 */ 2746, 2737, 2725, 2743, 2734, 2722, 2719, 2265, 2483, 2265, - /* 520 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, - /* 530 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, - /* 540 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, - /* 550 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, - /* 560 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, - /* 570 */ 2265, 2265, 2265, 2265, 2597, 2265, 2265, 2265, 2265, 2265, - /* 580 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, - /* 590 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, - /* 600 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, - /* 610 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, - /* 620 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, - /* 630 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2612, - /* 640 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, - /* 650 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, - /* 660 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, - /* 670 */ 2265, 2265, 2265, 2314, 2793, 2265, 2265, 2265, 2265, 2265, - /* 680 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2796, 2265, - /* 690 */ 2265, 2797, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, - /* 700 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, - /* 710 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, - /* 720 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, - /* 730 */ 2265, 2265, 2265, 2265, 2416, 2415, 2265, 2265, 2265, 2265, - /* 740 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, - /* 750 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, - /* 760 */ 2265, 2265, 2265, 2265, 2798, 2265, 2265, 2265, 2265, 2680, - /* 770 */ 2265, 2265, 2788, 2265, 2265, 2265, 2265, 2265, 2265, 2265, - /* 780 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 3014, - /* 790 */ 2966, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, - /* 800 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, - /* 810 */ 2265, 2265, 2265, 2786, 2265, 2996, 2265, 2265, 2265, 2265, - /* 820 */ 2265, 2265, 2265, 3012, 2265, 3016, 2265, 2265, 2265, 2265, - /* 830 */ 2265, 2265, 2265, 2922, 2918, 2265, 2265, 2914, 2265, 2265, - /* 840 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, - /* 850 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2873, 2265, - /* 860 */ 2265, 2265, 2907, 2265, 2265, 2265, 2265, 2265, 2265, 2265, - /* 870 */ 2265, 2265, 2511, 2510, 2509, 2508, 2265, 2265, 2265, 2265, - /* 880 */ 2265, 2265, 2798, 2265, 2801, 2265, 2265, 2265, 2265, 2265, - /* 890 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2785, 2265, - /* 900 */ 2850, 2849, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, - /* 910 */ 2265, 2505, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, - /* 920 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2489, 2487, 2486, - /* 930 */ 2485, 2265, 2522, 2265, 2265, 2265, 2518, 2517, 2265, 2265, - /* 940 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, - /* 950 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2390, 2265, 2265, - /* 960 */ 2265, 2265, 2265, 2265, 2265, 2265, 2382, 2265, 2381, 2265, - /* 970 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, - /* 980 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, - /* 990 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2265, 2294, 2265, - /* 1000 */ 2265, 2265, 2265, 2265, 2265, 2265, 2265, + /* 0 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, + /* 10 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, + /* 20 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, + /* 30 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, + /* 40 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, + /* 50 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, + /* 60 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, + /* 70 */ 2270, 2270, 2647, 2270, 2270, 2603, 2270, 2270, 2270, 2270, + /* 80 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, + /* 90 */ 2610, 2610, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, + /* 100 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, + /* 110 */ 2270, 2270, 2270, 2376, 2270, 2270, 2270, 2270, 2270, 2270, + /* 120 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, + /* 130 */ 2270, 2270, 2374, 2918, 2270, 3044, 2688, 2270, 2270, 2947, + /* 140 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, + /* 150 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, + /* 160 */ 2270, 2930, 2270, 2270, 2347, 2347, 2270, 2930, 2930, 2930, + /* 170 */ 2890, 2890, 2374, 2270, 2270, 2376, 2270, 2690, 2270, 2270, + /* 180 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2519, 2300, 2270, + /* 190 */ 2270, 2270, 2270, 2270, 2270, 2673, 2270, 2270, 2976, 2922, + /* 200 */ 2923, 3038, 2270, 2979, 2941, 2270, 2936, 2270, 2270, 2270, + /* 210 */ 2270, 2270, 2966, 2270, 2270, 2270, 2270, 2270, 2270, 2615, + /* 220 */ 2270, 2717, 2270, 2462, 2667, 2270, 2270, 2270, 2270, 2270, + /* 230 */ 3022, 2920, 2960, 2270, 2270, 2970, 2270, 2270, 2270, 2705, + /* 240 */ 2376, 2270, 2376, 2660, 2598, 2270, 2608, 2270, 2608, 2605, + /* 250 */ 2270, 2270, 2270, 2608, 2605, 2605, 2605, 2450, 2446, 2270, + /* 260 */ 2270, 2444, 2270, 2270, 2270, 2270, 2330, 2270, 2330, 2270, + /* 270 */ 2376, 2376, 2270, 2376, 2270, 2270, 2376, 2270, 2376, 2270, + /* 280 */ 2376, 2270, 2376, 2376, 2479, 2479, 2270, 2376, 2270, 2270, + /* 290 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, + /* 300 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2703, 2683, 2270, + /* 310 */ 2374, 2270, 2671, 2669, 2270, 2374, 2970, 2270, 2270, 2992, + /* 320 */ 2987, 2992, 2987, 3006, 3002, 2992, 3011, 3008, 2972, 2970, + /* 330 */ 2953, 2949, 3041, 3028, 3024, 2270, 2270, 2958, 2956, 2270, + /* 340 */ 2374, 2374, 2987, 2270, 2270, 2270, 2270, 2987, 2270, 2270, + /* 350 */ 2374, 2270, 2270, 2374, 2270, 2270, 2270, 2270, 2374, 2270, + /* 360 */ 2374, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, + /* 370 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, + /* 380 */ 2270, 2270, 2270, 2270, 2481, 2270, 2270, 2374, 2270, 2302, + /* 390 */ 2304, 2314, 2270, 2662, 3044, 2688, 2693, 2643, 2643, 2522, + /* 400 */ 2522, 3044, 2522, 2377, 2275, 2270, 2270, 2270, 2270, 2270, + /* 410 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, + /* 420 */ 2822, 2270, 2270, 2270, 2270, 2270, 2270, 3005, 3004, 2823, + /* 430 */ 2270, 2894, 2893, 2892, 2883, 2822, 2475, 2270, 2270, 2270, + /* 440 */ 2821, 2820, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, + /* 450 */ 2270, 2270, 2634, 2633, 2814, 2270, 2270, 2815, 2813, 2812, + /* 460 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2466, + /* 470 */ 2270, 2270, 2463, 2270, 2270, 2270, 2270, 2270, 2270, 2270, + /* 480 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, + /* 490 */ 3025, 3029, 2270, 2270, 2270, 2270, 2919, 2270, 2270, 2270, + /* 500 */ 2270, 2270, 2793, 2270, 2270, 2270, 2270, 2270, 2761, 2756, + /* 510 */ 2747, 2738, 2753, 2744, 2732, 2750, 2741, 2729, 2726, 2270, + /* 520 */ 2490, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, + /* 530 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, + /* 540 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, + /* 550 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, + /* 560 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, + /* 570 */ 2270, 2270, 2270, 2270, 2270, 2270, 2604, 2270, 2270, 2270, + /* 580 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, + /* 590 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, + /* 600 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, + /* 610 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, + /* 620 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, + /* 630 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, + /* 640 */ 2270, 2619, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, + /* 650 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, + /* 660 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, + /* 670 */ 2270, 2270, 2270, 2270, 2270, 2319, 2800, 2270, 2270, 2270, + /* 680 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, + /* 690 */ 2803, 2270, 2270, 2804, 2270, 2270, 2270, 2270, 2270, 2270, + /* 700 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, + /* 710 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, + /* 720 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, + /* 730 */ 2270, 2270, 2270, 2270, 2270, 2270, 2421, 2420, 2270, 2270, + /* 740 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, + /* 750 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, + /* 760 */ 2270, 2270, 2270, 2270, 2270, 2270, 2805, 2270, 2270, 2270, + /* 770 */ 2270, 2687, 2270, 2270, 2795, 2270, 2270, 2270, 2270, 2270, + /* 780 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, + /* 790 */ 2270, 3021, 2973, 2270, 2270, 2270, 2270, 2270, 2270, 2270, + /* 800 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, + /* 810 */ 2270, 2270, 2270, 2270, 2270, 2793, 2270, 3003, 2270, 2270, + /* 820 */ 2270, 2270, 2270, 2270, 2270, 3019, 2270, 3023, 2270, 2270, + /* 830 */ 2270, 2270, 2270, 2270, 2270, 2929, 2925, 2270, 2270, 2921, + /* 840 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, + /* 850 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, + /* 860 */ 2880, 2270, 2270, 2270, 2914, 2270, 2270, 2270, 2270, 2270, + /* 870 */ 2270, 2270, 2270, 2270, 2518, 2517, 2516, 2515, 2270, 2270, + /* 880 */ 2270, 2270, 2270, 2270, 2805, 2270, 2808, 2270, 2270, 2270, + /* 890 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, + /* 900 */ 2792, 2270, 2857, 2856, 2270, 2270, 2270, 2270, 2270, 2270, + /* 910 */ 2270, 2270, 2270, 2512, 2270, 2270, 2270, 2270, 2270, 2270, + /* 920 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2496, + /* 930 */ 2494, 2493, 2492, 2270, 2529, 2270, 2270, 2270, 2525, 2524, + /* 940 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, + /* 950 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2395, + /* 960 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2387, 2270, + /* 970 */ 2386, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, + /* 980 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, + /* 990 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, + /* 1000 */ 2299, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, }; /********** End of lemon-generated parsing tables *****************************/ @@ -2300,6 +2240,7 @@ struct yyParser { }; typedef struct yyParser yyParser; +#include #ifndef NDEBUG #include static FILE *yyTraceFILE = 0; @@ -2734,7 +2675,7 @@ static const char *const yyTokenName[] = { /* 395 */ "sysinfo_opt", /* 396 */ "privileges", /* 397 */ "priv_level", - /* 398 */ "with_opt", + /* 398 */ "with_clause_opt", /* 399 */ "priv_type_list", /* 400 */ "priv_type", /* 401 */ "db_name", @@ -2764,145 +2705,146 @@ static const char *const yyTokenName[] = { /* 425 */ "multi_create_clause", /* 426 */ "tag_list_opt", /* 427 */ "tags_def", - /* 428 */ "multi_drop_clause", - /* 429 */ "alter_table_clause", - /* 430 */ "alter_table_options", - /* 431 */ "column_name", - /* 432 */ "type_name", - /* 433 */ "column_options", - /* 434 */ "tags_literal", - /* 435 */ "create_subtable_clause", - /* 436 */ "specific_cols_opt", - /* 437 */ "tags_literal_list", - /* 438 */ "drop_table_clause", - /* 439 */ "col_name_list", - /* 440 */ "tag_def_list", - /* 441 */ "tag_def", - /* 442 */ "column_def", - /* 443 */ "type_name_default_len", - /* 444 */ "duration_list", - /* 445 */ "rollup_func_list", - /* 446 */ "alter_table_option", - /* 447 */ "duration_literal", - /* 448 */ "rollup_func_name", - /* 449 */ "function_name", - /* 450 */ "col_name", - /* 451 */ "db_kind_opt", - /* 452 */ "table_kind_db_name_cond_opt", - /* 453 */ "like_pattern_opt", - /* 454 */ "db_name_cond_opt", - /* 455 */ "table_name_cond", - /* 456 */ "from_db_opt", - /* 457 */ "table_kind", - /* 458 */ "tag_item", - /* 459 */ "column_alias", - /* 460 */ "tsma_name", - /* 461 */ "tsma_func_list", - /* 462 */ "full_tsma_name", - /* 463 */ "func_list", - /* 464 */ "index_options", - /* 465 */ "full_index_name", - /* 466 */ "index_name", - /* 467 */ "sliding_opt", - /* 468 */ "sma_stream_opt", - /* 469 */ "func", - /* 470 */ "sma_func_name", - /* 471 */ "expression_list", - /* 472 */ "with_meta", - /* 473 */ "query_or_subquery", - /* 474 */ "where_clause_opt", - /* 475 */ "cgroup_name", - /* 476 */ "analyze_opt", - /* 477 */ "explain_options", - /* 478 */ "insert_query", - /* 479 */ "or_replace_opt", - /* 480 */ "agg_func_opt", - /* 481 */ "bufsize_opt", - /* 482 */ "language_opt", - /* 483 */ "full_view_name", - /* 484 */ "view_name", - /* 485 */ "stream_name", - /* 486 */ "stream_options", - /* 487 */ "col_list_opt", - /* 488 */ "tag_def_or_ref_opt", - /* 489 */ "subtable_opt", - /* 490 */ "ignore_opt", - /* 491 */ "column_stream_def_list", - /* 492 */ "column_stream_def", - /* 493 */ "stream_col_options", - /* 494 */ "expression", - /* 495 */ "on_vgroup_id", - /* 496 */ "dnode_list", - /* 497 */ "literal_func", - /* 498 */ "signed_literal", - /* 499 */ "literal_list", - /* 500 */ "table_alias", - /* 501 */ "expr_or_subquery", - /* 502 */ "pseudo_column", - /* 503 */ "column_reference", - /* 504 */ "function_expression", - /* 505 */ "case_when_expression", - /* 506 */ "star_func", - /* 507 */ "star_func_para_list", - /* 508 */ "trim_specification_type", - /* 509 */ "substr_func", - /* 510 */ "rand_func", - /* 511 */ "noarg_func", - /* 512 */ "other_para_list", - /* 513 */ "star_func_para", - /* 514 */ "when_then_list", - /* 515 */ "case_when_else_opt", - /* 516 */ "common_expression", - /* 517 */ "when_then_expr", - /* 518 */ "predicate", - /* 519 */ "compare_op", - /* 520 */ "in_op", - /* 521 */ "in_predicate_value", - /* 522 */ "boolean_value_expression", - /* 523 */ "boolean_primary", - /* 524 */ "from_clause_opt", - /* 525 */ "table_reference_list", - /* 526 */ "table_reference", - /* 527 */ "table_primary", - /* 528 */ "joined_table", - /* 529 */ "alias_opt", - /* 530 */ "subquery", - /* 531 */ "parenthesized_joined_table", - /* 532 */ "join_type", - /* 533 */ "join_subtype", - /* 534 */ "join_on_clause_opt", - /* 535 */ "window_offset_clause_opt", - /* 536 */ "jlimit_clause_opt", - /* 537 */ "window_offset_literal", - /* 538 */ "query_specification", - /* 539 */ "hint_list", - /* 540 */ "set_quantifier_opt", - /* 541 */ "tag_mode_opt", - /* 542 */ "select_list", - /* 543 */ "partition_by_clause_opt", - /* 544 */ "range_opt", - /* 545 */ "every_opt", - /* 546 */ "fill_opt", - /* 547 */ "twindow_clause_opt", - /* 548 */ "group_by_clause_opt", - /* 549 */ "having_clause_opt", - /* 550 */ "select_item", - /* 551 */ "partition_list", - /* 552 */ "partition_item", - /* 553 */ "interval_sliding_duration_literal", - /* 554 */ "fill_mode", - /* 555 */ "group_by_list", - /* 556 */ "query_expression", - /* 557 */ "query_simple", - /* 558 */ "order_by_clause_opt", - /* 559 */ "slimit_clause_opt", - /* 560 */ "limit_clause_opt", - /* 561 */ "union_query_expression", - /* 562 */ "query_simple_or_subquery", - /* 563 */ "sort_specification_list", - /* 564 */ "sort_specification", - /* 565 */ "ordering_specification_opt", - /* 566 */ "null_ordering_opt", + /* 428 */ "with_opt", + /* 429 */ "multi_drop_clause", + /* 430 */ "alter_table_clause", + /* 431 */ "alter_table_options", + /* 432 */ "column_name", + /* 433 */ "type_name", + /* 434 */ "column_options", + /* 435 */ "tags_literal", + /* 436 */ "create_subtable_clause", + /* 437 */ "specific_cols_opt", + /* 438 */ "tags_literal_list", + /* 439 */ "drop_table_clause", + /* 440 */ "col_name_list", + /* 441 */ "tag_def_list", + /* 442 */ "tag_def", + /* 443 */ "column_def", + /* 444 */ "type_name_default_len", + /* 445 */ "duration_list", + /* 446 */ "rollup_func_list", + /* 447 */ "alter_table_option", + /* 448 */ "duration_literal", + /* 449 */ "rollup_func_name", + /* 450 */ "function_name", + /* 451 */ "col_name", + /* 452 */ "db_kind_opt", + /* 453 */ "table_kind_db_name_cond_opt", + /* 454 */ "like_pattern_opt", + /* 455 */ "db_name_cond_opt", + /* 456 */ "table_name_cond", + /* 457 */ "from_db_opt", + /* 458 */ "table_kind", + /* 459 */ "tag_item", + /* 460 */ "column_alias", + /* 461 */ "tsma_name", + /* 462 */ "tsma_func_list", + /* 463 */ "full_tsma_name", + /* 464 */ "func_list", + /* 465 */ "index_options", + /* 466 */ "full_index_name", + /* 467 */ "index_name", + /* 468 */ "sliding_opt", + /* 469 */ "sma_stream_opt", + /* 470 */ "func", + /* 471 */ "sma_func_name", + /* 472 */ "expression_list", + /* 473 */ "with_meta", + /* 474 */ "query_or_subquery", + /* 475 */ "where_clause_opt", + /* 476 */ "cgroup_name", + /* 477 */ "analyze_opt", + /* 478 */ "explain_options", + /* 479 */ "insert_query", + /* 480 */ "or_replace_opt", + /* 481 */ "agg_func_opt", + /* 482 */ "bufsize_opt", + /* 483 */ "language_opt", + /* 484 */ "full_view_name", + /* 485 */ "view_name", + /* 486 */ "stream_name", + /* 487 */ "stream_options", + /* 488 */ "col_list_opt", + /* 489 */ "tag_def_or_ref_opt", + /* 490 */ "subtable_opt", + /* 491 */ "ignore_opt", + /* 492 */ "column_stream_def_list", + /* 493 */ "column_stream_def", + /* 494 */ "stream_col_options", + /* 495 */ "expression", + /* 496 */ "on_vgroup_id", + /* 497 */ "dnode_list", + /* 498 */ "literal_func", + /* 499 */ "signed_literal", + /* 500 */ "literal_list", + /* 501 */ "table_alias", + /* 502 */ "expr_or_subquery", + /* 503 */ "pseudo_column", + /* 504 */ "column_reference", + /* 505 */ "function_expression", + /* 506 */ "case_when_expression", + /* 507 */ "star_func", + /* 508 */ "star_func_para_list", + /* 509 */ "trim_specification_type", + /* 510 */ "substr_func", + /* 511 */ "rand_func", + /* 512 */ "noarg_func", + /* 513 */ "other_para_list", + /* 514 */ "star_func_para", + /* 515 */ "when_then_list", + /* 516 */ "case_when_else_opt", + /* 517 */ "common_expression", + /* 518 */ "when_then_expr", + /* 519 */ "predicate", + /* 520 */ "compare_op", + /* 521 */ "in_op", + /* 522 */ "in_predicate_value", + /* 523 */ "boolean_value_expression", + /* 524 */ "boolean_primary", + /* 525 */ "from_clause_opt", + /* 526 */ "table_reference_list", + /* 527 */ "table_reference", + /* 528 */ "table_primary", + /* 529 */ "joined_table", + /* 530 */ "alias_opt", + /* 531 */ "subquery", + /* 532 */ "parenthesized_joined_table", + /* 533 */ "join_type", + /* 534 */ "join_subtype", + /* 535 */ "join_on_clause_opt", + /* 536 */ "window_offset_clause_opt", + /* 537 */ "jlimit_clause_opt", + /* 538 */ "window_offset_literal", + /* 539 */ "query_specification", + /* 540 */ "hint_list", + /* 541 */ "set_quantifier_opt", + /* 542 */ "tag_mode_opt", + /* 543 */ "select_list", + /* 544 */ "partition_by_clause_opt", + /* 545 */ "range_opt", + /* 546 */ "every_opt", + /* 547 */ "fill_opt", + /* 548 */ "twindow_clause_opt", + /* 549 */ "group_by_clause_opt", + /* 550 */ "having_clause_opt", + /* 551 */ "select_item", + /* 552 */ "partition_list", + /* 553 */ "partition_item", + /* 554 */ "interval_sliding_duration_literal", + /* 555 */ "fill_mode", + /* 556 */ "group_by_list", + /* 557 */ "query_expression", + /* 558 */ "query_simple", + /* 559 */ "order_by_clause_opt", + /* 560 */ "slimit_clause_opt", + /* 561 */ "limit_clause_opt", + /* 562 */ "union_query_expression", + /* 563 */ "query_simple_or_subquery", + /* 564 */ "sort_specification_list", + /* 565 */ "sort_specification", + /* 566 */ "ordering_specification_opt", + /* 567 */ "null_ordering_opt", }; #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ @@ -2953,8 +2895,8 @@ static const char *const yyRuleName[] = { /* 40 */ "cmd ::= DROP USER user_name", /* 41 */ "sysinfo_opt ::=", /* 42 */ "sysinfo_opt ::= SYSINFO NK_INTEGER", - /* 43 */ "cmd ::= GRANT privileges ON priv_level with_opt TO user_name", - /* 44 */ "cmd ::= REVOKE privileges ON priv_level with_opt FROM user_name", + /* 43 */ "cmd ::= GRANT privileges ON priv_level with_clause_opt TO user_name", + /* 44 */ "cmd ::= REVOKE privileges ON priv_level with_clause_opt FROM user_name", /* 45 */ "privileges ::= ALL", /* 46 */ "privileges ::= priv_type_list", /* 47 */ "privileges ::= SUBSCRIBE", @@ -2967,8 +2909,8 @@ static const char *const yyRuleName[] = { /* 54 */ "priv_level ::= db_name NK_DOT NK_STAR", /* 55 */ "priv_level ::= db_name NK_DOT table_name", /* 56 */ "priv_level ::= topic_name", - /* 57 */ "with_opt ::=", - /* 58 */ "with_opt ::= WITH search_condition", + /* 57 */ "with_clause_opt ::=", + /* 58 */ "with_clause_opt ::= WITH search_condition", /* 59 */ "cmd ::= CREATE ENCRYPT_KEY NK_STRING", /* 60 */ "cmd ::= CREATE DNODE dnode_endpoint", /* 61 */ "cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER", @@ -3095,8 +3037,8 @@ static const char *const yyRuleName[] = { /* 182 */ "cmd ::= CREATE TABLE multi_create_clause", /* 183 */ "cmd ::= CREATE TABLE not_exists_opt USING full_table_name NK_LP tag_list_opt NK_RP FILE NK_STRING", /* 184 */ "cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options", - /* 185 */ "cmd ::= DROP TABLE multi_drop_clause", - /* 186 */ "cmd ::= DROP STABLE exists_opt full_table_name", + /* 185 */ "cmd ::= DROP TABLE with_opt multi_drop_clause", + /* 186 */ "cmd ::= DROP STABLE with_opt exists_opt full_table_name", /* 187 */ "cmd ::= ALTER TABLE alter_table_clause", /* 188 */ "cmd ::= ALTER STABLE alter_table_clause", /* 189 */ "alter_table_clause ::= full_table_name alter_table_options", @@ -3116,572 +3058,574 @@ static const char *const yyRuleName[] = { /* 203 */ "multi_drop_clause ::= drop_table_clause", /* 204 */ "multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause", /* 205 */ "drop_table_clause ::= exists_opt full_table_name", - /* 206 */ "specific_cols_opt ::=", - /* 207 */ "specific_cols_opt ::= NK_LP col_name_list NK_RP", - /* 208 */ "full_table_name ::= table_name", - /* 209 */ "full_table_name ::= db_name NK_DOT table_name", - /* 210 */ "tag_def_list ::= tag_def", - /* 211 */ "tag_def_list ::= tag_def_list NK_COMMA tag_def", - /* 212 */ "tag_def ::= column_name type_name", - /* 213 */ "column_def_list ::= column_def", - /* 214 */ "column_def_list ::= column_def_list NK_COMMA column_def", - /* 215 */ "column_def ::= column_name type_name column_options", - /* 216 */ "type_name ::= BOOL", - /* 217 */ "type_name ::= TINYINT", - /* 218 */ "type_name ::= SMALLINT", - /* 219 */ "type_name ::= INT", - /* 220 */ "type_name ::= INTEGER", - /* 221 */ "type_name ::= BIGINT", - /* 222 */ "type_name ::= FLOAT", - /* 223 */ "type_name ::= DOUBLE", - /* 224 */ "type_name ::= BINARY NK_LP NK_INTEGER NK_RP", - /* 225 */ "type_name ::= TIMESTAMP", - /* 226 */ "type_name ::= NCHAR NK_LP NK_INTEGER NK_RP", - /* 227 */ "type_name ::= TINYINT UNSIGNED", - /* 228 */ "type_name ::= SMALLINT UNSIGNED", - /* 229 */ "type_name ::= INT UNSIGNED", - /* 230 */ "type_name ::= BIGINT UNSIGNED", - /* 231 */ "type_name ::= JSON", - /* 232 */ "type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP", - /* 233 */ "type_name ::= MEDIUMBLOB", - /* 234 */ "type_name ::= BLOB", - /* 235 */ "type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP", - /* 236 */ "type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP", - /* 237 */ "type_name ::= DECIMAL", - /* 238 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP", - /* 239 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", - /* 240 */ "type_name_default_len ::= BINARY", - /* 241 */ "type_name_default_len ::= NCHAR", - /* 242 */ "type_name_default_len ::= VARCHAR", - /* 243 */ "type_name_default_len ::= VARBINARY", - /* 244 */ "tags_def_opt ::=", - /* 245 */ "tags_def_opt ::= tags_def", - /* 246 */ "tags_def ::= TAGS NK_LP tag_def_list NK_RP", - /* 247 */ "table_options ::=", - /* 248 */ "table_options ::= table_options COMMENT NK_STRING", - /* 249 */ "table_options ::= table_options MAX_DELAY duration_list", - /* 250 */ "table_options ::= table_options WATERMARK duration_list", - /* 251 */ "table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP", - /* 252 */ "table_options ::= table_options TTL NK_INTEGER", - /* 253 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP", - /* 254 */ "table_options ::= table_options DELETE_MARK duration_list", - /* 255 */ "alter_table_options ::= alter_table_option", - /* 256 */ "alter_table_options ::= alter_table_options alter_table_option", - /* 257 */ "alter_table_option ::= COMMENT NK_STRING", - /* 258 */ "alter_table_option ::= TTL NK_INTEGER", - /* 259 */ "duration_list ::= duration_literal", - /* 260 */ "duration_list ::= duration_list NK_COMMA duration_literal", - /* 261 */ "rollup_func_list ::= rollup_func_name", - /* 262 */ "rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name", - /* 263 */ "rollup_func_name ::= function_name", - /* 264 */ "rollup_func_name ::= FIRST", - /* 265 */ "rollup_func_name ::= LAST", - /* 266 */ "col_name_list ::= col_name", - /* 267 */ "col_name_list ::= col_name_list NK_COMMA col_name", - /* 268 */ "col_name ::= column_name", - /* 269 */ "cmd ::= SHOW DNODES", - /* 270 */ "cmd ::= SHOW USERS", - /* 271 */ "cmd ::= SHOW USERS FULL", - /* 272 */ "cmd ::= SHOW USER PRIVILEGES", - /* 273 */ "cmd ::= SHOW db_kind_opt DATABASES", - /* 274 */ "cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt", - /* 275 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt", - /* 276 */ "cmd ::= SHOW db_name_cond_opt VGROUPS", - /* 277 */ "cmd ::= SHOW MNODES", - /* 278 */ "cmd ::= SHOW QNODES", - /* 279 */ "cmd ::= SHOW ARBGROUPS", - /* 280 */ "cmd ::= SHOW FUNCTIONS", - /* 281 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt", - /* 282 */ "cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name", - /* 283 */ "cmd ::= SHOW STREAMS", - /* 284 */ "cmd ::= SHOW ACCOUNTS", - /* 285 */ "cmd ::= SHOW APPS", - /* 286 */ "cmd ::= SHOW CONNECTIONS", - /* 287 */ "cmd ::= SHOW LICENCES", - /* 288 */ "cmd ::= SHOW GRANTS", - /* 289 */ "cmd ::= SHOW GRANTS FULL", - /* 290 */ "cmd ::= SHOW GRANTS LOGS", - /* 291 */ "cmd ::= SHOW CLUSTER MACHINES", - /* 292 */ "cmd ::= SHOW CREATE DATABASE db_name", - /* 293 */ "cmd ::= SHOW CREATE TABLE full_table_name", - /* 294 */ "cmd ::= SHOW CREATE STABLE full_table_name", - /* 295 */ "cmd ::= SHOW ENCRYPTIONS", - /* 296 */ "cmd ::= SHOW QUERIES", - /* 297 */ "cmd ::= SHOW SCORES", - /* 298 */ "cmd ::= SHOW TOPICS", - /* 299 */ "cmd ::= SHOW VARIABLES", - /* 300 */ "cmd ::= SHOW CLUSTER VARIABLES", - /* 301 */ "cmd ::= SHOW LOCAL VARIABLES", - /* 302 */ "cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt", - /* 303 */ "cmd ::= SHOW BNODES", - /* 304 */ "cmd ::= SHOW SNODES", - /* 305 */ "cmd ::= SHOW CLUSTER", - /* 306 */ "cmd ::= SHOW TRANSACTIONS", - /* 307 */ "cmd ::= SHOW TABLE DISTRIBUTED full_table_name", - /* 308 */ "cmd ::= SHOW CONSUMERS", - /* 309 */ "cmd ::= SHOW SUBSCRIPTIONS", - /* 310 */ "cmd ::= SHOW TAGS FROM table_name_cond from_db_opt", - /* 311 */ "cmd ::= SHOW TAGS FROM db_name NK_DOT table_name", - /* 312 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt", - /* 313 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name", - /* 314 */ "cmd ::= SHOW VNODES ON DNODE NK_INTEGER", - /* 315 */ "cmd ::= SHOW VNODES", - /* 316 */ "cmd ::= SHOW db_name_cond_opt ALIVE", - /* 317 */ "cmd ::= SHOW CLUSTER ALIVE", - /* 318 */ "cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt", - /* 319 */ "cmd ::= SHOW CREATE VIEW full_table_name", - /* 320 */ "cmd ::= SHOW COMPACTS", - /* 321 */ "cmd ::= SHOW COMPACT NK_INTEGER", - /* 322 */ "table_kind_db_name_cond_opt ::=", - /* 323 */ "table_kind_db_name_cond_opt ::= table_kind", - /* 324 */ "table_kind_db_name_cond_opt ::= db_name NK_DOT", - /* 325 */ "table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT", - /* 326 */ "table_kind ::= NORMAL", - /* 327 */ "table_kind ::= CHILD", - /* 328 */ "db_name_cond_opt ::=", - /* 329 */ "db_name_cond_opt ::= db_name NK_DOT", - /* 330 */ "like_pattern_opt ::=", - /* 331 */ "like_pattern_opt ::= LIKE NK_STRING", - /* 332 */ "table_name_cond ::= table_name", - /* 333 */ "from_db_opt ::=", - /* 334 */ "from_db_opt ::= FROM db_name", - /* 335 */ "tag_list_opt ::=", - /* 336 */ "tag_list_opt ::= tag_item", - /* 337 */ "tag_list_opt ::= tag_list_opt NK_COMMA tag_item", - /* 338 */ "tag_item ::= TBNAME", - /* 339 */ "tag_item ::= QTAGS", - /* 340 */ "tag_item ::= column_name", - /* 341 */ "tag_item ::= column_name column_alias", - /* 342 */ "tag_item ::= column_name AS column_alias", - /* 343 */ "db_kind_opt ::=", - /* 344 */ "db_kind_opt ::= USER", - /* 345 */ "db_kind_opt ::= SYSTEM", - /* 346 */ "cmd ::= CREATE TSMA not_exists_opt tsma_name ON full_table_name tsma_func_list INTERVAL NK_LP duration_literal NK_RP", - /* 347 */ "cmd ::= CREATE RECURSIVE TSMA not_exists_opt tsma_name ON full_table_name INTERVAL NK_LP duration_literal NK_RP", - /* 348 */ "cmd ::= DROP TSMA exists_opt full_tsma_name", - /* 349 */ "cmd ::= SHOW db_name_cond_opt TSMAS", - /* 350 */ "full_tsma_name ::= tsma_name", - /* 351 */ "full_tsma_name ::= db_name NK_DOT tsma_name", - /* 352 */ "tsma_func_list ::= FUNCTION NK_LP func_list NK_RP", - /* 353 */ "cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options", - /* 354 */ "cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP", - /* 355 */ "cmd ::= DROP INDEX exists_opt full_index_name", - /* 356 */ "full_index_name ::= index_name", - /* 357 */ "full_index_name ::= db_name NK_DOT index_name", - /* 358 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt", - /* 359 */ "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", - /* 360 */ "func_list ::= func", - /* 361 */ "func_list ::= func_list NK_COMMA func", - /* 362 */ "func ::= sma_func_name NK_LP expression_list NK_RP", - /* 363 */ "sma_func_name ::= function_name", - /* 364 */ "sma_func_name ::= COUNT", - /* 365 */ "sma_func_name ::= FIRST", - /* 366 */ "sma_func_name ::= LAST", - /* 367 */ "sma_func_name ::= LAST_ROW", - /* 368 */ "sma_stream_opt ::=", - /* 369 */ "sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal", - /* 370 */ "sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal", - /* 371 */ "sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal", - /* 372 */ "with_meta ::= AS", - /* 373 */ "with_meta ::= WITH META AS", - /* 374 */ "with_meta ::= ONLY META AS", - /* 375 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery", - /* 376 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name", - /* 377 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt", - /* 378 */ "cmd ::= DROP TOPIC exists_opt topic_name", - /* 379 */ "cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name", - /* 380 */ "cmd ::= DESC full_table_name", - /* 381 */ "cmd ::= DESCRIBE full_table_name", - /* 382 */ "cmd ::= RESET QUERY CACHE", - /* 383 */ "cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery", - /* 384 */ "cmd ::= EXPLAIN analyze_opt explain_options insert_query", - /* 385 */ "analyze_opt ::=", - /* 386 */ "analyze_opt ::= ANALYZE", - /* 387 */ "explain_options ::=", - /* 388 */ "explain_options ::= explain_options VERBOSE NK_BOOL", - /* 389 */ "explain_options ::= explain_options RATIO NK_FLOAT", - /* 390 */ "cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt", - /* 391 */ "cmd ::= DROP FUNCTION exists_opt function_name", - /* 392 */ "agg_func_opt ::=", - /* 393 */ "agg_func_opt ::= AGGREGATE", - /* 394 */ "bufsize_opt ::=", - /* 395 */ "bufsize_opt ::= BUFSIZE NK_INTEGER", - /* 396 */ "language_opt ::=", - /* 397 */ "language_opt ::= LANGUAGE NK_STRING", - /* 398 */ "or_replace_opt ::=", - /* 399 */ "or_replace_opt ::= OR REPLACE", - /* 400 */ "cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery", - /* 401 */ "cmd ::= DROP VIEW exists_opt full_view_name", - /* 402 */ "full_view_name ::= view_name", - /* 403 */ "full_view_name ::= db_name NK_DOT view_name", - /* 404 */ "cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery", - /* 405 */ "cmd ::= DROP STREAM exists_opt stream_name", - /* 406 */ "cmd ::= PAUSE STREAM exists_opt stream_name", - /* 407 */ "cmd ::= RESUME STREAM exists_opt ignore_opt stream_name", - /* 408 */ "col_list_opt ::=", - /* 409 */ "col_list_opt ::= NK_LP column_stream_def_list NK_RP", - /* 410 */ "column_stream_def_list ::= column_stream_def", - /* 411 */ "column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def", - /* 412 */ "column_stream_def ::= column_name stream_col_options", - /* 413 */ "stream_col_options ::=", - /* 414 */ "stream_col_options ::= stream_col_options PRIMARY KEY", - /* 415 */ "tag_def_or_ref_opt ::=", - /* 416 */ "tag_def_or_ref_opt ::= tags_def", - /* 417 */ "tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP", - /* 418 */ "stream_options ::=", - /* 419 */ "stream_options ::= stream_options TRIGGER AT_ONCE", - /* 420 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE", - /* 421 */ "stream_options ::= stream_options TRIGGER FORCE_WINDOW_CLOSE", - /* 422 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal", - /* 423 */ "stream_options ::= stream_options WATERMARK duration_literal", - /* 424 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER", - /* 425 */ "stream_options ::= stream_options FILL_HISTORY NK_INTEGER", - /* 426 */ "stream_options ::= stream_options DELETE_MARK duration_literal", - /* 427 */ "stream_options ::= stream_options IGNORE UPDATE NK_INTEGER", - /* 428 */ "subtable_opt ::=", - /* 429 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP", - /* 430 */ "ignore_opt ::=", - /* 431 */ "ignore_opt ::= IGNORE UNTREATED", - /* 432 */ "cmd ::= KILL CONNECTION NK_INTEGER", - /* 433 */ "cmd ::= KILL QUERY NK_STRING", - /* 434 */ "cmd ::= KILL TRANSACTION NK_INTEGER", - /* 435 */ "cmd ::= KILL COMPACT NK_INTEGER", - /* 436 */ "cmd ::= BALANCE VGROUP", - /* 437 */ "cmd ::= BALANCE VGROUP LEADER on_vgroup_id", - /* 438 */ "cmd ::= BALANCE VGROUP LEADER DATABASE db_name", - /* 439 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", - /* 440 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", - /* 441 */ "cmd ::= SPLIT VGROUP NK_INTEGER", - /* 442 */ "on_vgroup_id ::=", - /* 443 */ "on_vgroup_id ::= ON NK_INTEGER", - /* 444 */ "dnode_list ::= DNODE NK_INTEGER", - /* 445 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", - /* 446 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", - /* 447 */ "cmd ::= query_or_subquery", - /* 448 */ "cmd ::= insert_query", - /* 449 */ "insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery", - /* 450 */ "insert_query ::= INSERT INTO full_table_name query_or_subquery", - /* 451 */ "tags_literal ::= NK_INTEGER", - /* 452 */ "tags_literal ::= NK_INTEGER NK_PLUS duration_literal", - /* 453 */ "tags_literal ::= NK_INTEGER NK_MINUS duration_literal", - /* 454 */ "tags_literal ::= NK_PLUS NK_INTEGER", - /* 455 */ "tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal", - /* 456 */ "tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal", - /* 457 */ "tags_literal ::= NK_MINUS NK_INTEGER", - /* 458 */ "tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal", - /* 459 */ "tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal", - /* 460 */ "tags_literal ::= NK_FLOAT", - /* 461 */ "tags_literal ::= NK_PLUS NK_FLOAT", - /* 462 */ "tags_literal ::= NK_MINUS NK_FLOAT", - /* 463 */ "tags_literal ::= NK_BIN", - /* 464 */ "tags_literal ::= NK_BIN NK_PLUS duration_literal", - /* 465 */ "tags_literal ::= NK_BIN NK_MINUS duration_literal", - /* 466 */ "tags_literal ::= NK_PLUS NK_BIN", - /* 467 */ "tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal", - /* 468 */ "tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal", - /* 469 */ "tags_literal ::= NK_MINUS NK_BIN", - /* 470 */ "tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal", - /* 471 */ "tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal", - /* 472 */ "tags_literal ::= NK_HEX", - /* 473 */ "tags_literal ::= NK_HEX NK_PLUS duration_literal", - /* 474 */ "tags_literal ::= NK_HEX NK_MINUS duration_literal", - /* 475 */ "tags_literal ::= NK_PLUS NK_HEX", - /* 476 */ "tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal", - /* 477 */ "tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal", - /* 478 */ "tags_literal ::= NK_MINUS NK_HEX", - /* 479 */ "tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal", - /* 480 */ "tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal", - /* 481 */ "tags_literal ::= NK_STRING", - /* 482 */ "tags_literal ::= NK_STRING NK_PLUS duration_literal", - /* 483 */ "tags_literal ::= NK_STRING NK_MINUS duration_literal", - /* 484 */ "tags_literal ::= NK_BOOL", - /* 485 */ "tags_literal ::= NULL", - /* 486 */ "tags_literal ::= literal_func", - /* 487 */ "tags_literal ::= literal_func NK_PLUS duration_literal", - /* 488 */ "tags_literal ::= literal_func NK_MINUS duration_literal", - /* 489 */ "tags_literal_list ::= tags_literal", - /* 490 */ "tags_literal_list ::= tags_literal_list NK_COMMA tags_literal", - /* 491 */ "literal ::= NK_INTEGER", - /* 492 */ "literal ::= NK_FLOAT", - /* 493 */ "literal ::= NK_STRING", - /* 494 */ "literal ::= NK_BOOL", - /* 495 */ "literal ::= TIMESTAMP NK_STRING", - /* 496 */ "literal ::= duration_literal", - /* 497 */ "literal ::= NULL", - /* 498 */ "literal ::= NK_QUESTION", - /* 499 */ "duration_literal ::= NK_VARIABLE", - /* 500 */ "signed ::= NK_INTEGER", - /* 501 */ "signed ::= NK_PLUS NK_INTEGER", - /* 502 */ "signed ::= NK_MINUS NK_INTEGER", - /* 503 */ "signed ::= NK_FLOAT", - /* 504 */ "signed ::= NK_PLUS NK_FLOAT", - /* 505 */ "signed ::= NK_MINUS NK_FLOAT", - /* 506 */ "signed_literal ::= signed", - /* 507 */ "signed_literal ::= NK_STRING", - /* 508 */ "signed_literal ::= NK_BOOL", - /* 509 */ "signed_literal ::= TIMESTAMP NK_STRING", - /* 510 */ "signed_literal ::= duration_literal", - /* 511 */ "signed_literal ::= NULL", - /* 512 */ "signed_literal ::= literal_func", - /* 513 */ "signed_literal ::= NK_QUESTION", - /* 514 */ "literal_list ::= signed_literal", - /* 515 */ "literal_list ::= literal_list NK_COMMA signed_literal", - /* 516 */ "db_name ::= NK_ID", - /* 517 */ "table_name ::= NK_ID", - /* 518 */ "column_name ::= NK_ID", - /* 519 */ "function_name ::= NK_ID", - /* 520 */ "view_name ::= NK_ID", - /* 521 */ "table_alias ::= NK_ID", - /* 522 */ "column_alias ::= NK_ID", - /* 523 */ "column_alias ::= NK_ALIAS", - /* 524 */ "user_name ::= NK_ID", - /* 525 */ "topic_name ::= NK_ID", - /* 526 */ "stream_name ::= NK_ID", - /* 527 */ "cgroup_name ::= NK_ID", - /* 528 */ "index_name ::= NK_ID", - /* 529 */ "tsma_name ::= NK_ID", - /* 530 */ "expr_or_subquery ::= expression", - /* 531 */ "expression ::= literal", - /* 532 */ "expression ::= pseudo_column", - /* 533 */ "expression ::= column_reference", - /* 534 */ "expression ::= function_expression", - /* 535 */ "expression ::= case_when_expression", - /* 536 */ "expression ::= NK_LP expression NK_RP", - /* 537 */ "expression ::= NK_PLUS expr_or_subquery", - /* 538 */ "expression ::= NK_MINUS expr_or_subquery", - /* 539 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery", - /* 540 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery", - /* 541 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery", - /* 542 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery", - /* 543 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery", - /* 544 */ "expression ::= column_reference NK_ARROW NK_STRING", - /* 545 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery", - /* 546 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery", - /* 547 */ "expression_list ::= expr_or_subquery", - /* 548 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery", - /* 549 */ "column_reference ::= column_name", - /* 550 */ "column_reference ::= table_name NK_DOT column_name", - /* 551 */ "column_reference ::= NK_ALIAS", - /* 552 */ "column_reference ::= table_name NK_DOT NK_ALIAS", - /* 553 */ "pseudo_column ::= ROWTS", - /* 554 */ "pseudo_column ::= TBNAME", - /* 555 */ "pseudo_column ::= table_name NK_DOT TBNAME", - /* 556 */ "pseudo_column ::= QSTART", - /* 557 */ "pseudo_column ::= QEND", - /* 558 */ "pseudo_column ::= QDURATION", - /* 559 */ "pseudo_column ::= WSTART", - /* 560 */ "pseudo_column ::= WEND", - /* 561 */ "pseudo_column ::= WDURATION", - /* 562 */ "pseudo_column ::= IROWTS", - /* 563 */ "pseudo_column ::= ISFILLED", - /* 564 */ "pseudo_column ::= QTAGS", - /* 565 */ "function_expression ::= function_name NK_LP expression_list NK_RP", - /* 566 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", - /* 567 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP", - /* 568 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP", - /* 569 */ "function_expression ::= POSITION NK_LP expr_or_subquery IN expr_or_subquery NK_RP", - /* 570 */ "function_expression ::= TRIM NK_LP expr_or_subquery NK_RP", - /* 571 */ "function_expression ::= TRIM NK_LP trim_specification_type FROM expr_or_subquery NK_RP", - /* 572 */ "function_expression ::= TRIM NK_LP expr_or_subquery FROM expr_or_subquery NK_RP", - /* 573 */ "function_expression ::= TRIM NK_LP trim_specification_type expr_or_subquery FROM expr_or_subquery NK_RP", - /* 574 */ "function_expression ::= substr_func NK_LP expression_list NK_RP", - /* 575 */ "function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery NK_RP", - /* 576 */ "function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery FOR expr_or_subquery NK_RP", - /* 577 */ "function_expression ::= REPLACE NK_LP expression_list NK_RP", - /* 578 */ "function_expression ::= literal_func", - /* 579 */ "function_expression ::= rand_func", - /* 580 */ "literal_func ::= noarg_func NK_LP NK_RP", - /* 581 */ "literal_func ::= NOW", - /* 582 */ "literal_func ::= TODAY", - /* 583 */ "rand_func ::= RAND NK_LP NK_RP", - /* 584 */ "rand_func ::= RAND NK_LP expression_list NK_RP", - /* 585 */ "substr_func ::= SUBSTR", - /* 586 */ "substr_func ::= SUBSTRING", - /* 587 */ "trim_specification_type ::= BOTH", - /* 588 */ "trim_specification_type ::= TRAILING", - /* 589 */ "trim_specification_type ::= LEADING", - /* 590 */ "noarg_func ::= NOW", - /* 591 */ "noarg_func ::= TODAY", - /* 592 */ "noarg_func ::= TIMEZONE", - /* 593 */ "noarg_func ::= DATABASE", - /* 594 */ "noarg_func ::= CLIENT_VERSION", - /* 595 */ "noarg_func ::= SERVER_VERSION", - /* 596 */ "noarg_func ::= SERVER_STATUS", - /* 597 */ "noarg_func ::= CURRENT_USER", - /* 598 */ "noarg_func ::= USER", - /* 599 */ "noarg_func ::= PI", - /* 600 */ "star_func ::= COUNT", - /* 601 */ "star_func ::= FIRST", - /* 602 */ "star_func ::= LAST", - /* 603 */ "star_func ::= LAST_ROW", - /* 604 */ "star_func_para_list ::= NK_STAR", - /* 605 */ "star_func_para_list ::= other_para_list", - /* 606 */ "other_para_list ::= star_func_para", - /* 607 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", - /* 608 */ "star_func_para ::= expr_or_subquery", - /* 609 */ "star_func_para ::= table_name NK_DOT NK_STAR", - /* 610 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END", - /* 611 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END", - /* 612 */ "when_then_list ::= when_then_expr", - /* 613 */ "when_then_list ::= when_then_list when_then_expr", - /* 614 */ "when_then_expr ::= WHEN common_expression THEN common_expression", - /* 615 */ "case_when_else_opt ::=", - /* 616 */ "case_when_else_opt ::= ELSE common_expression", - /* 617 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery", - /* 618 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery", - /* 619 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery", - /* 620 */ "predicate ::= expr_or_subquery IS NULL", - /* 621 */ "predicate ::= expr_or_subquery IS NOT NULL", - /* 622 */ "predicate ::= expr_or_subquery in_op in_predicate_value", - /* 623 */ "compare_op ::= NK_LT", - /* 624 */ "compare_op ::= NK_GT", - /* 625 */ "compare_op ::= NK_LE", - /* 626 */ "compare_op ::= NK_GE", - /* 627 */ "compare_op ::= NK_NE", - /* 628 */ "compare_op ::= NK_EQ", - /* 629 */ "compare_op ::= LIKE", - /* 630 */ "compare_op ::= NOT LIKE", - /* 631 */ "compare_op ::= MATCH", - /* 632 */ "compare_op ::= NMATCH", - /* 633 */ "compare_op ::= CONTAINS", - /* 634 */ "in_op ::= IN", - /* 635 */ "in_op ::= NOT IN", - /* 636 */ "in_predicate_value ::= NK_LP literal_list NK_RP", - /* 637 */ "boolean_value_expression ::= boolean_primary", - /* 638 */ "boolean_value_expression ::= NOT boolean_primary", - /* 639 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", - /* 640 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", - /* 641 */ "boolean_primary ::= predicate", - /* 642 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", - /* 643 */ "common_expression ::= expr_or_subquery", - /* 644 */ "common_expression ::= boolean_value_expression", - /* 645 */ "from_clause_opt ::=", - /* 646 */ "from_clause_opt ::= FROM table_reference_list", - /* 647 */ "table_reference_list ::= table_reference", - /* 648 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", - /* 649 */ "table_reference ::= table_primary", - /* 650 */ "table_reference ::= joined_table", - /* 651 */ "table_primary ::= table_name alias_opt", - /* 652 */ "table_primary ::= db_name NK_DOT table_name alias_opt", - /* 653 */ "table_primary ::= subquery alias_opt", - /* 654 */ "table_primary ::= parenthesized_joined_table", - /* 655 */ "alias_opt ::=", - /* 656 */ "alias_opt ::= table_alias", - /* 657 */ "alias_opt ::= AS table_alias", - /* 658 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", - /* 659 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", - /* 660 */ "joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt", - /* 661 */ "join_type ::=", - /* 662 */ "join_type ::= INNER", - /* 663 */ "join_type ::= LEFT", - /* 664 */ "join_type ::= RIGHT", - /* 665 */ "join_type ::= FULL", - /* 666 */ "join_subtype ::=", - /* 667 */ "join_subtype ::= OUTER", - /* 668 */ "join_subtype ::= SEMI", - /* 669 */ "join_subtype ::= ANTI", - /* 670 */ "join_subtype ::= ASOF", - /* 671 */ "join_subtype ::= WINDOW", - /* 672 */ "join_on_clause_opt ::=", - /* 673 */ "join_on_clause_opt ::= ON search_condition", - /* 674 */ "window_offset_clause_opt ::=", - /* 675 */ "window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP", - /* 676 */ "window_offset_literal ::= NK_VARIABLE", - /* 677 */ "window_offset_literal ::= NK_MINUS NK_VARIABLE", - /* 678 */ "jlimit_clause_opt ::=", - /* 679 */ "jlimit_clause_opt ::= JLIMIT NK_INTEGER", - /* 680 */ "query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_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", - /* 681 */ "hint_list ::=", - /* 682 */ "hint_list ::= NK_HINT", - /* 683 */ "tag_mode_opt ::=", - /* 684 */ "tag_mode_opt ::= TAGS", - /* 685 */ "set_quantifier_opt ::=", - /* 686 */ "set_quantifier_opt ::= DISTINCT", - /* 687 */ "set_quantifier_opt ::= ALL", - /* 688 */ "select_list ::= select_item", - /* 689 */ "select_list ::= select_list NK_COMMA select_item", - /* 690 */ "select_item ::= NK_STAR", - /* 691 */ "select_item ::= common_expression", - /* 692 */ "select_item ::= common_expression column_alias", - /* 693 */ "select_item ::= common_expression AS column_alias", - /* 694 */ "select_item ::= table_name NK_DOT NK_STAR", - /* 695 */ "where_clause_opt ::=", - /* 696 */ "where_clause_opt ::= WHERE search_condition", - /* 697 */ "partition_by_clause_opt ::=", - /* 698 */ "partition_by_clause_opt ::= PARTITION BY partition_list", - /* 699 */ "partition_list ::= partition_item", - /* 700 */ "partition_list ::= partition_list NK_COMMA partition_item", - /* 701 */ "partition_item ::= expr_or_subquery", - /* 702 */ "partition_item ::= expr_or_subquery column_alias", - /* 703 */ "partition_item ::= expr_or_subquery AS column_alias", - /* 704 */ "twindow_clause_opt ::=", - /* 705 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP", - /* 706 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP", - /* 707 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt", - /* 708 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt", - /* 709 */ "twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition", - /* 710 */ "twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP", - /* 711 */ "twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", - /* 712 */ "sliding_opt ::=", - /* 713 */ "sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP", - /* 714 */ "interval_sliding_duration_literal ::= NK_VARIABLE", - /* 715 */ "interval_sliding_duration_literal ::= NK_STRING", - /* 716 */ "interval_sliding_duration_literal ::= NK_INTEGER", - /* 717 */ "fill_opt ::=", - /* 718 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", - /* 719 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP", - /* 720 */ "fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP", - /* 721 */ "fill_mode ::= NONE", - /* 722 */ "fill_mode ::= PREV", - /* 723 */ "fill_mode ::= NULL", - /* 724 */ "fill_mode ::= NULL_F", - /* 725 */ "fill_mode ::= LINEAR", - /* 726 */ "fill_mode ::= NEXT", - /* 727 */ "group_by_clause_opt ::=", - /* 728 */ "group_by_clause_opt ::= GROUP BY group_by_list", - /* 729 */ "group_by_list ::= expr_or_subquery", - /* 730 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery", - /* 731 */ "having_clause_opt ::=", - /* 732 */ "having_clause_opt ::= HAVING search_condition", - /* 733 */ "range_opt ::=", - /* 734 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP", - /* 735 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_RP", - /* 736 */ "every_opt ::=", - /* 737 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", - /* 738 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt", - /* 739 */ "query_simple ::= query_specification", - /* 740 */ "query_simple ::= union_query_expression", - /* 741 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery", - /* 742 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery", - /* 743 */ "query_simple_or_subquery ::= query_simple", - /* 744 */ "query_simple_or_subquery ::= subquery", - /* 745 */ "query_or_subquery ::= query_expression", - /* 746 */ "query_or_subquery ::= subquery", - /* 747 */ "order_by_clause_opt ::=", - /* 748 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", - /* 749 */ "slimit_clause_opt ::=", - /* 750 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", - /* 751 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", - /* 752 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 753 */ "limit_clause_opt ::=", - /* 754 */ "limit_clause_opt ::= LIMIT NK_INTEGER", - /* 755 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", - /* 756 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 757 */ "subquery ::= NK_LP query_expression NK_RP", - /* 758 */ "subquery ::= NK_LP subquery NK_RP", - /* 759 */ "search_condition ::= common_expression", - /* 760 */ "sort_specification_list ::= sort_specification", - /* 761 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", - /* 762 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt", - /* 763 */ "ordering_specification_opt ::=", - /* 764 */ "ordering_specification_opt ::= ASC", - /* 765 */ "ordering_specification_opt ::= DESC", - /* 766 */ "null_ordering_opt ::=", - /* 767 */ "null_ordering_opt ::= NULLS FIRST", - /* 768 */ "null_ordering_opt ::= NULLS LAST", - /* 769 */ "column_options ::=", - /* 770 */ "column_options ::= column_options PRIMARY KEY", - /* 771 */ "column_options ::= column_options NK_ID NK_STRING", + /* 206 */ "with_opt ::=", + /* 207 */ "with_opt ::= WITH", + /* 208 */ "specific_cols_opt ::=", + /* 209 */ "specific_cols_opt ::= NK_LP col_name_list NK_RP", + /* 210 */ "full_table_name ::= table_name", + /* 211 */ "full_table_name ::= db_name NK_DOT table_name", + /* 212 */ "tag_def_list ::= tag_def", + /* 213 */ "tag_def_list ::= tag_def_list NK_COMMA tag_def", + /* 214 */ "tag_def ::= column_name type_name", + /* 215 */ "column_def_list ::= column_def", + /* 216 */ "column_def_list ::= column_def_list NK_COMMA column_def", + /* 217 */ "column_def ::= column_name type_name column_options", + /* 218 */ "type_name ::= BOOL", + /* 219 */ "type_name ::= TINYINT", + /* 220 */ "type_name ::= SMALLINT", + /* 221 */ "type_name ::= INT", + /* 222 */ "type_name ::= INTEGER", + /* 223 */ "type_name ::= BIGINT", + /* 224 */ "type_name ::= FLOAT", + /* 225 */ "type_name ::= DOUBLE", + /* 226 */ "type_name ::= BINARY NK_LP NK_INTEGER NK_RP", + /* 227 */ "type_name ::= TIMESTAMP", + /* 228 */ "type_name ::= NCHAR NK_LP NK_INTEGER NK_RP", + /* 229 */ "type_name ::= TINYINT UNSIGNED", + /* 230 */ "type_name ::= SMALLINT UNSIGNED", + /* 231 */ "type_name ::= INT UNSIGNED", + /* 232 */ "type_name ::= BIGINT UNSIGNED", + /* 233 */ "type_name ::= JSON", + /* 234 */ "type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP", + /* 235 */ "type_name ::= MEDIUMBLOB", + /* 236 */ "type_name ::= BLOB", + /* 237 */ "type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP", + /* 238 */ "type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP", + /* 239 */ "type_name ::= DECIMAL", + /* 240 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP", + /* 241 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", + /* 242 */ "type_name_default_len ::= BINARY", + /* 243 */ "type_name_default_len ::= NCHAR", + /* 244 */ "type_name_default_len ::= VARCHAR", + /* 245 */ "type_name_default_len ::= VARBINARY", + /* 246 */ "tags_def_opt ::=", + /* 247 */ "tags_def_opt ::= tags_def", + /* 248 */ "tags_def ::= TAGS NK_LP tag_def_list NK_RP", + /* 249 */ "table_options ::=", + /* 250 */ "table_options ::= table_options COMMENT NK_STRING", + /* 251 */ "table_options ::= table_options MAX_DELAY duration_list", + /* 252 */ "table_options ::= table_options WATERMARK duration_list", + /* 253 */ "table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP", + /* 254 */ "table_options ::= table_options TTL NK_INTEGER", + /* 255 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP", + /* 256 */ "table_options ::= table_options DELETE_MARK duration_list", + /* 257 */ "alter_table_options ::= alter_table_option", + /* 258 */ "alter_table_options ::= alter_table_options alter_table_option", + /* 259 */ "alter_table_option ::= COMMENT NK_STRING", + /* 260 */ "alter_table_option ::= TTL NK_INTEGER", + /* 261 */ "duration_list ::= duration_literal", + /* 262 */ "duration_list ::= duration_list NK_COMMA duration_literal", + /* 263 */ "rollup_func_list ::= rollup_func_name", + /* 264 */ "rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name", + /* 265 */ "rollup_func_name ::= function_name", + /* 266 */ "rollup_func_name ::= FIRST", + /* 267 */ "rollup_func_name ::= LAST", + /* 268 */ "col_name_list ::= col_name", + /* 269 */ "col_name_list ::= col_name_list NK_COMMA col_name", + /* 270 */ "col_name ::= column_name", + /* 271 */ "cmd ::= SHOW DNODES", + /* 272 */ "cmd ::= SHOW USERS", + /* 273 */ "cmd ::= SHOW USERS FULL", + /* 274 */ "cmd ::= SHOW USER PRIVILEGES", + /* 275 */ "cmd ::= SHOW db_kind_opt DATABASES", + /* 276 */ "cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt", + /* 277 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt", + /* 278 */ "cmd ::= SHOW db_name_cond_opt VGROUPS", + /* 279 */ "cmd ::= SHOW MNODES", + /* 280 */ "cmd ::= SHOW QNODES", + /* 281 */ "cmd ::= SHOW ARBGROUPS", + /* 282 */ "cmd ::= SHOW FUNCTIONS", + /* 283 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt", + /* 284 */ "cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name", + /* 285 */ "cmd ::= SHOW STREAMS", + /* 286 */ "cmd ::= SHOW ACCOUNTS", + /* 287 */ "cmd ::= SHOW APPS", + /* 288 */ "cmd ::= SHOW CONNECTIONS", + /* 289 */ "cmd ::= SHOW LICENCES", + /* 290 */ "cmd ::= SHOW GRANTS", + /* 291 */ "cmd ::= SHOW GRANTS FULL", + /* 292 */ "cmd ::= SHOW GRANTS LOGS", + /* 293 */ "cmd ::= SHOW CLUSTER MACHINES", + /* 294 */ "cmd ::= SHOW CREATE DATABASE db_name", + /* 295 */ "cmd ::= SHOW CREATE TABLE full_table_name", + /* 296 */ "cmd ::= SHOW CREATE STABLE full_table_name", + /* 297 */ "cmd ::= SHOW ENCRYPTIONS", + /* 298 */ "cmd ::= SHOW QUERIES", + /* 299 */ "cmd ::= SHOW SCORES", + /* 300 */ "cmd ::= SHOW TOPICS", + /* 301 */ "cmd ::= SHOW VARIABLES", + /* 302 */ "cmd ::= SHOW CLUSTER VARIABLES", + /* 303 */ "cmd ::= SHOW LOCAL VARIABLES", + /* 304 */ "cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt", + /* 305 */ "cmd ::= SHOW BNODES", + /* 306 */ "cmd ::= SHOW SNODES", + /* 307 */ "cmd ::= SHOW CLUSTER", + /* 308 */ "cmd ::= SHOW TRANSACTIONS", + /* 309 */ "cmd ::= SHOW TABLE DISTRIBUTED full_table_name", + /* 310 */ "cmd ::= SHOW CONSUMERS", + /* 311 */ "cmd ::= SHOW SUBSCRIPTIONS", + /* 312 */ "cmd ::= SHOW TAGS FROM table_name_cond from_db_opt", + /* 313 */ "cmd ::= SHOW TAGS FROM db_name NK_DOT table_name", + /* 314 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt", + /* 315 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name", + /* 316 */ "cmd ::= SHOW VNODES ON DNODE NK_INTEGER", + /* 317 */ "cmd ::= SHOW VNODES", + /* 318 */ "cmd ::= SHOW db_name_cond_opt ALIVE", + /* 319 */ "cmd ::= SHOW CLUSTER ALIVE", + /* 320 */ "cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt", + /* 321 */ "cmd ::= SHOW CREATE VIEW full_table_name", + /* 322 */ "cmd ::= SHOW COMPACTS", + /* 323 */ "cmd ::= SHOW COMPACT NK_INTEGER", + /* 324 */ "table_kind_db_name_cond_opt ::=", + /* 325 */ "table_kind_db_name_cond_opt ::= table_kind", + /* 326 */ "table_kind_db_name_cond_opt ::= db_name NK_DOT", + /* 327 */ "table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT", + /* 328 */ "table_kind ::= NORMAL", + /* 329 */ "table_kind ::= CHILD", + /* 330 */ "db_name_cond_opt ::=", + /* 331 */ "db_name_cond_opt ::= db_name NK_DOT", + /* 332 */ "like_pattern_opt ::=", + /* 333 */ "like_pattern_opt ::= LIKE NK_STRING", + /* 334 */ "table_name_cond ::= table_name", + /* 335 */ "from_db_opt ::=", + /* 336 */ "from_db_opt ::= FROM db_name", + /* 337 */ "tag_list_opt ::=", + /* 338 */ "tag_list_opt ::= tag_item", + /* 339 */ "tag_list_opt ::= tag_list_opt NK_COMMA tag_item", + /* 340 */ "tag_item ::= TBNAME", + /* 341 */ "tag_item ::= QTAGS", + /* 342 */ "tag_item ::= column_name", + /* 343 */ "tag_item ::= column_name column_alias", + /* 344 */ "tag_item ::= column_name AS column_alias", + /* 345 */ "db_kind_opt ::=", + /* 346 */ "db_kind_opt ::= USER", + /* 347 */ "db_kind_opt ::= SYSTEM", + /* 348 */ "cmd ::= CREATE TSMA not_exists_opt tsma_name ON full_table_name tsma_func_list INTERVAL NK_LP duration_literal NK_RP", + /* 349 */ "cmd ::= CREATE RECURSIVE TSMA not_exists_opt tsma_name ON full_table_name INTERVAL NK_LP duration_literal NK_RP", + /* 350 */ "cmd ::= DROP TSMA exists_opt full_tsma_name", + /* 351 */ "cmd ::= SHOW db_name_cond_opt TSMAS", + /* 352 */ "full_tsma_name ::= tsma_name", + /* 353 */ "full_tsma_name ::= db_name NK_DOT tsma_name", + /* 354 */ "tsma_func_list ::= FUNCTION NK_LP func_list NK_RP", + /* 355 */ "cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options", + /* 356 */ "cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP", + /* 357 */ "cmd ::= DROP INDEX exists_opt full_index_name", + /* 358 */ "full_index_name ::= index_name", + /* 359 */ "full_index_name ::= db_name NK_DOT index_name", + /* 360 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt", + /* 361 */ "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", + /* 362 */ "func_list ::= func", + /* 363 */ "func_list ::= func_list NK_COMMA func", + /* 364 */ "func ::= sma_func_name NK_LP expression_list NK_RP", + /* 365 */ "sma_func_name ::= function_name", + /* 366 */ "sma_func_name ::= COUNT", + /* 367 */ "sma_func_name ::= FIRST", + /* 368 */ "sma_func_name ::= LAST", + /* 369 */ "sma_func_name ::= LAST_ROW", + /* 370 */ "sma_stream_opt ::=", + /* 371 */ "sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal", + /* 372 */ "sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal", + /* 373 */ "sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal", + /* 374 */ "with_meta ::= AS", + /* 375 */ "with_meta ::= WITH META AS", + /* 376 */ "with_meta ::= ONLY META AS", + /* 377 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery", + /* 378 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name", + /* 379 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt", + /* 380 */ "cmd ::= DROP TOPIC exists_opt topic_name", + /* 381 */ "cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name", + /* 382 */ "cmd ::= DESC full_table_name", + /* 383 */ "cmd ::= DESCRIBE full_table_name", + /* 384 */ "cmd ::= RESET QUERY CACHE", + /* 385 */ "cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery", + /* 386 */ "cmd ::= EXPLAIN analyze_opt explain_options insert_query", + /* 387 */ "analyze_opt ::=", + /* 388 */ "analyze_opt ::= ANALYZE", + /* 389 */ "explain_options ::=", + /* 390 */ "explain_options ::= explain_options VERBOSE NK_BOOL", + /* 391 */ "explain_options ::= explain_options RATIO NK_FLOAT", + /* 392 */ "cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt", + /* 393 */ "cmd ::= DROP FUNCTION exists_opt function_name", + /* 394 */ "agg_func_opt ::=", + /* 395 */ "agg_func_opt ::= AGGREGATE", + /* 396 */ "bufsize_opt ::=", + /* 397 */ "bufsize_opt ::= BUFSIZE NK_INTEGER", + /* 398 */ "language_opt ::=", + /* 399 */ "language_opt ::= LANGUAGE NK_STRING", + /* 400 */ "or_replace_opt ::=", + /* 401 */ "or_replace_opt ::= OR REPLACE", + /* 402 */ "cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery", + /* 403 */ "cmd ::= DROP VIEW exists_opt full_view_name", + /* 404 */ "full_view_name ::= view_name", + /* 405 */ "full_view_name ::= db_name NK_DOT view_name", + /* 406 */ "cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery", + /* 407 */ "cmd ::= DROP STREAM exists_opt stream_name", + /* 408 */ "cmd ::= PAUSE STREAM exists_opt stream_name", + /* 409 */ "cmd ::= RESUME STREAM exists_opt ignore_opt stream_name", + /* 410 */ "col_list_opt ::=", + /* 411 */ "col_list_opt ::= NK_LP column_stream_def_list NK_RP", + /* 412 */ "column_stream_def_list ::= column_stream_def", + /* 413 */ "column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def", + /* 414 */ "column_stream_def ::= column_name stream_col_options", + /* 415 */ "stream_col_options ::=", + /* 416 */ "stream_col_options ::= stream_col_options PRIMARY KEY", + /* 417 */ "tag_def_or_ref_opt ::=", + /* 418 */ "tag_def_or_ref_opt ::= tags_def", + /* 419 */ "tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP", + /* 420 */ "stream_options ::=", + /* 421 */ "stream_options ::= stream_options TRIGGER AT_ONCE", + /* 422 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE", + /* 423 */ "stream_options ::= stream_options TRIGGER FORCE_WINDOW_CLOSE", + /* 424 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal", + /* 425 */ "stream_options ::= stream_options WATERMARK duration_literal", + /* 426 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER", + /* 427 */ "stream_options ::= stream_options FILL_HISTORY NK_INTEGER", + /* 428 */ "stream_options ::= stream_options DELETE_MARK duration_literal", + /* 429 */ "stream_options ::= stream_options IGNORE UPDATE NK_INTEGER", + /* 430 */ "subtable_opt ::=", + /* 431 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP", + /* 432 */ "ignore_opt ::=", + /* 433 */ "ignore_opt ::= IGNORE UNTREATED", + /* 434 */ "cmd ::= KILL CONNECTION NK_INTEGER", + /* 435 */ "cmd ::= KILL QUERY NK_STRING", + /* 436 */ "cmd ::= KILL TRANSACTION NK_INTEGER", + /* 437 */ "cmd ::= KILL COMPACT NK_INTEGER", + /* 438 */ "cmd ::= BALANCE VGROUP", + /* 439 */ "cmd ::= BALANCE VGROUP LEADER on_vgroup_id", + /* 440 */ "cmd ::= BALANCE VGROUP LEADER DATABASE db_name", + /* 441 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", + /* 442 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", + /* 443 */ "cmd ::= SPLIT VGROUP NK_INTEGER", + /* 444 */ "on_vgroup_id ::=", + /* 445 */ "on_vgroup_id ::= ON NK_INTEGER", + /* 446 */ "dnode_list ::= DNODE NK_INTEGER", + /* 447 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", + /* 448 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", + /* 449 */ "cmd ::= query_or_subquery", + /* 450 */ "cmd ::= insert_query", + /* 451 */ "insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery", + /* 452 */ "insert_query ::= INSERT INTO full_table_name query_or_subquery", + /* 453 */ "tags_literal ::= NK_INTEGER", + /* 454 */ "tags_literal ::= NK_INTEGER NK_PLUS duration_literal", + /* 455 */ "tags_literal ::= NK_INTEGER NK_MINUS duration_literal", + /* 456 */ "tags_literal ::= NK_PLUS NK_INTEGER", + /* 457 */ "tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal", + /* 458 */ "tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal", + /* 459 */ "tags_literal ::= NK_MINUS NK_INTEGER", + /* 460 */ "tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal", + /* 461 */ "tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal", + /* 462 */ "tags_literal ::= NK_FLOAT", + /* 463 */ "tags_literal ::= NK_PLUS NK_FLOAT", + /* 464 */ "tags_literal ::= NK_MINUS NK_FLOAT", + /* 465 */ "tags_literal ::= NK_BIN", + /* 466 */ "tags_literal ::= NK_BIN NK_PLUS duration_literal", + /* 467 */ "tags_literal ::= NK_BIN NK_MINUS duration_literal", + /* 468 */ "tags_literal ::= NK_PLUS NK_BIN", + /* 469 */ "tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal", + /* 470 */ "tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal", + /* 471 */ "tags_literal ::= NK_MINUS NK_BIN", + /* 472 */ "tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal", + /* 473 */ "tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal", + /* 474 */ "tags_literal ::= NK_HEX", + /* 475 */ "tags_literal ::= NK_HEX NK_PLUS duration_literal", + /* 476 */ "tags_literal ::= NK_HEX NK_MINUS duration_literal", + /* 477 */ "tags_literal ::= NK_PLUS NK_HEX", + /* 478 */ "tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal", + /* 479 */ "tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal", + /* 480 */ "tags_literal ::= NK_MINUS NK_HEX", + /* 481 */ "tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal", + /* 482 */ "tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal", + /* 483 */ "tags_literal ::= NK_STRING", + /* 484 */ "tags_literal ::= NK_STRING NK_PLUS duration_literal", + /* 485 */ "tags_literal ::= NK_STRING NK_MINUS duration_literal", + /* 486 */ "tags_literal ::= NK_BOOL", + /* 487 */ "tags_literal ::= NULL", + /* 488 */ "tags_literal ::= literal_func", + /* 489 */ "tags_literal ::= literal_func NK_PLUS duration_literal", + /* 490 */ "tags_literal ::= literal_func NK_MINUS duration_literal", + /* 491 */ "tags_literal_list ::= tags_literal", + /* 492 */ "tags_literal_list ::= tags_literal_list NK_COMMA tags_literal", + /* 493 */ "literal ::= NK_INTEGER", + /* 494 */ "literal ::= NK_FLOAT", + /* 495 */ "literal ::= NK_STRING", + /* 496 */ "literal ::= NK_BOOL", + /* 497 */ "literal ::= TIMESTAMP NK_STRING", + /* 498 */ "literal ::= duration_literal", + /* 499 */ "literal ::= NULL", + /* 500 */ "literal ::= NK_QUESTION", + /* 501 */ "duration_literal ::= NK_VARIABLE", + /* 502 */ "signed ::= NK_INTEGER", + /* 503 */ "signed ::= NK_PLUS NK_INTEGER", + /* 504 */ "signed ::= NK_MINUS NK_INTEGER", + /* 505 */ "signed ::= NK_FLOAT", + /* 506 */ "signed ::= NK_PLUS NK_FLOAT", + /* 507 */ "signed ::= NK_MINUS NK_FLOAT", + /* 508 */ "signed_literal ::= signed", + /* 509 */ "signed_literal ::= NK_STRING", + /* 510 */ "signed_literal ::= NK_BOOL", + /* 511 */ "signed_literal ::= TIMESTAMP NK_STRING", + /* 512 */ "signed_literal ::= duration_literal", + /* 513 */ "signed_literal ::= NULL", + /* 514 */ "signed_literal ::= literal_func", + /* 515 */ "signed_literal ::= NK_QUESTION", + /* 516 */ "literal_list ::= signed_literal", + /* 517 */ "literal_list ::= literal_list NK_COMMA signed_literal", + /* 518 */ "db_name ::= NK_ID", + /* 519 */ "table_name ::= NK_ID", + /* 520 */ "column_name ::= NK_ID", + /* 521 */ "function_name ::= NK_ID", + /* 522 */ "view_name ::= NK_ID", + /* 523 */ "table_alias ::= NK_ID", + /* 524 */ "column_alias ::= NK_ID", + /* 525 */ "column_alias ::= NK_ALIAS", + /* 526 */ "user_name ::= NK_ID", + /* 527 */ "topic_name ::= NK_ID", + /* 528 */ "stream_name ::= NK_ID", + /* 529 */ "cgroup_name ::= NK_ID", + /* 530 */ "index_name ::= NK_ID", + /* 531 */ "tsma_name ::= NK_ID", + /* 532 */ "expr_or_subquery ::= expression", + /* 533 */ "expression ::= literal", + /* 534 */ "expression ::= pseudo_column", + /* 535 */ "expression ::= column_reference", + /* 536 */ "expression ::= function_expression", + /* 537 */ "expression ::= case_when_expression", + /* 538 */ "expression ::= NK_LP expression NK_RP", + /* 539 */ "expression ::= NK_PLUS expr_or_subquery", + /* 540 */ "expression ::= NK_MINUS expr_or_subquery", + /* 541 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery", + /* 542 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery", + /* 543 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery", + /* 544 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery", + /* 545 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery", + /* 546 */ "expression ::= column_reference NK_ARROW NK_STRING", + /* 547 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery", + /* 548 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery", + /* 549 */ "expression_list ::= expr_or_subquery", + /* 550 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery", + /* 551 */ "column_reference ::= column_name", + /* 552 */ "column_reference ::= table_name NK_DOT column_name", + /* 553 */ "column_reference ::= NK_ALIAS", + /* 554 */ "column_reference ::= table_name NK_DOT NK_ALIAS", + /* 555 */ "pseudo_column ::= ROWTS", + /* 556 */ "pseudo_column ::= TBNAME", + /* 557 */ "pseudo_column ::= table_name NK_DOT TBNAME", + /* 558 */ "pseudo_column ::= QSTART", + /* 559 */ "pseudo_column ::= QEND", + /* 560 */ "pseudo_column ::= QDURATION", + /* 561 */ "pseudo_column ::= WSTART", + /* 562 */ "pseudo_column ::= WEND", + /* 563 */ "pseudo_column ::= WDURATION", + /* 564 */ "pseudo_column ::= IROWTS", + /* 565 */ "pseudo_column ::= ISFILLED", + /* 566 */ "pseudo_column ::= QTAGS", + /* 567 */ "function_expression ::= function_name NK_LP expression_list NK_RP", + /* 568 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", + /* 569 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP", + /* 570 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP", + /* 571 */ "function_expression ::= POSITION NK_LP expr_or_subquery IN expr_or_subquery NK_RP", + /* 572 */ "function_expression ::= TRIM NK_LP expr_or_subquery NK_RP", + /* 573 */ "function_expression ::= TRIM NK_LP trim_specification_type FROM expr_or_subquery NK_RP", + /* 574 */ "function_expression ::= TRIM NK_LP expr_or_subquery FROM expr_or_subquery NK_RP", + /* 575 */ "function_expression ::= TRIM NK_LP trim_specification_type expr_or_subquery FROM expr_or_subquery NK_RP", + /* 576 */ "function_expression ::= substr_func NK_LP expression_list NK_RP", + /* 577 */ "function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery NK_RP", + /* 578 */ "function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery FOR expr_or_subquery NK_RP", + /* 579 */ "function_expression ::= REPLACE NK_LP expression_list NK_RP", + /* 580 */ "function_expression ::= literal_func", + /* 581 */ "function_expression ::= rand_func", + /* 582 */ "literal_func ::= noarg_func NK_LP NK_RP", + /* 583 */ "literal_func ::= NOW", + /* 584 */ "literal_func ::= TODAY", + /* 585 */ "rand_func ::= RAND NK_LP NK_RP", + /* 586 */ "rand_func ::= RAND NK_LP expression_list NK_RP", + /* 587 */ "substr_func ::= SUBSTR", + /* 588 */ "substr_func ::= SUBSTRING", + /* 589 */ "trim_specification_type ::= BOTH", + /* 590 */ "trim_specification_type ::= TRAILING", + /* 591 */ "trim_specification_type ::= LEADING", + /* 592 */ "noarg_func ::= NOW", + /* 593 */ "noarg_func ::= TODAY", + /* 594 */ "noarg_func ::= TIMEZONE", + /* 595 */ "noarg_func ::= DATABASE", + /* 596 */ "noarg_func ::= CLIENT_VERSION", + /* 597 */ "noarg_func ::= SERVER_VERSION", + /* 598 */ "noarg_func ::= SERVER_STATUS", + /* 599 */ "noarg_func ::= CURRENT_USER", + /* 600 */ "noarg_func ::= USER", + /* 601 */ "noarg_func ::= PI", + /* 602 */ "star_func ::= COUNT", + /* 603 */ "star_func ::= FIRST", + /* 604 */ "star_func ::= LAST", + /* 605 */ "star_func ::= LAST_ROW", + /* 606 */ "star_func_para_list ::= NK_STAR", + /* 607 */ "star_func_para_list ::= other_para_list", + /* 608 */ "other_para_list ::= star_func_para", + /* 609 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", + /* 610 */ "star_func_para ::= expr_or_subquery", + /* 611 */ "star_func_para ::= table_name NK_DOT NK_STAR", + /* 612 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END", + /* 613 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END", + /* 614 */ "when_then_list ::= when_then_expr", + /* 615 */ "when_then_list ::= when_then_list when_then_expr", + /* 616 */ "when_then_expr ::= WHEN common_expression THEN common_expression", + /* 617 */ "case_when_else_opt ::=", + /* 618 */ "case_when_else_opt ::= ELSE common_expression", + /* 619 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery", + /* 620 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery", + /* 621 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery", + /* 622 */ "predicate ::= expr_or_subquery IS NULL", + /* 623 */ "predicate ::= expr_or_subquery IS NOT NULL", + /* 624 */ "predicate ::= expr_or_subquery in_op in_predicate_value", + /* 625 */ "compare_op ::= NK_LT", + /* 626 */ "compare_op ::= NK_GT", + /* 627 */ "compare_op ::= NK_LE", + /* 628 */ "compare_op ::= NK_GE", + /* 629 */ "compare_op ::= NK_NE", + /* 630 */ "compare_op ::= NK_EQ", + /* 631 */ "compare_op ::= LIKE", + /* 632 */ "compare_op ::= NOT LIKE", + /* 633 */ "compare_op ::= MATCH", + /* 634 */ "compare_op ::= NMATCH", + /* 635 */ "compare_op ::= CONTAINS", + /* 636 */ "in_op ::= IN", + /* 637 */ "in_op ::= NOT IN", + /* 638 */ "in_predicate_value ::= NK_LP literal_list NK_RP", + /* 639 */ "boolean_value_expression ::= boolean_primary", + /* 640 */ "boolean_value_expression ::= NOT boolean_primary", + /* 641 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", + /* 642 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", + /* 643 */ "boolean_primary ::= predicate", + /* 644 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", + /* 645 */ "common_expression ::= expr_or_subquery", + /* 646 */ "common_expression ::= boolean_value_expression", + /* 647 */ "from_clause_opt ::=", + /* 648 */ "from_clause_opt ::= FROM table_reference_list", + /* 649 */ "table_reference_list ::= table_reference", + /* 650 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", + /* 651 */ "table_reference ::= table_primary", + /* 652 */ "table_reference ::= joined_table", + /* 653 */ "table_primary ::= table_name alias_opt", + /* 654 */ "table_primary ::= db_name NK_DOT table_name alias_opt", + /* 655 */ "table_primary ::= subquery alias_opt", + /* 656 */ "table_primary ::= parenthesized_joined_table", + /* 657 */ "alias_opt ::=", + /* 658 */ "alias_opt ::= table_alias", + /* 659 */ "alias_opt ::= AS table_alias", + /* 660 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", + /* 661 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", + /* 662 */ "joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt", + /* 663 */ "join_type ::=", + /* 664 */ "join_type ::= INNER", + /* 665 */ "join_type ::= LEFT", + /* 666 */ "join_type ::= RIGHT", + /* 667 */ "join_type ::= FULL", + /* 668 */ "join_subtype ::=", + /* 669 */ "join_subtype ::= OUTER", + /* 670 */ "join_subtype ::= SEMI", + /* 671 */ "join_subtype ::= ANTI", + /* 672 */ "join_subtype ::= ASOF", + /* 673 */ "join_subtype ::= WINDOW", + /* 674 */ "join_on_clause_opt ::=", + /* 675 */ "join_on_clause_opt ::= ON search_condition", + /* 676 */ "window_offset_clause_opt ::=", + /* 677 */ "window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP", + /* 678 */ "window_offset_literal ::= NK_VARIABLE", + /* 679 */ "window_offset_literal ::= NK_MINUS NK_VARIABLE", + /* 680 */ "jlimit_clause_opt ::=", + /* 681 */ "jlimit_clause_opt ::= JLIMIT NK_INTEGER", + /* 682 */ "query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_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", + /* 683 */ "hint_list ::=", + /* 684 */ "hint_list ::= NK_HINT", + /* 685 */ "tag_mode_opt ::=", + /* 686 */ "tag_mode_opt ::= TAGS", + /* 687 */ "set_quantifier_opt ::=", + /* 688 */ "set_quantifier_opt ::= DISTINCT", + /* 689 */ "set_quantifier_opt ::= ALL", + /* 690 */ "select_list ::= select_item", + /* 691 */ "select_list ::= select_list NK_COMMA select_item", + /* 692 */ "select_item ::= NK_STAR", + /* 693 */ "select_item ::= common_expression", + /* 694 */ "select_item ::= common_expression column_alias", + /* 695 */ "select_item ::= common_expression AS column_alias", + /* 696 */ "select_item ::= table_name NK_DOT NK_STAR", + /* 697 */ "where_clause_opt ::=", + /* 698 */ "where_clause_opt ::= WHERE search_condition", + /* 699 */ "partition_by_clause_opt ::=", + /* 700 */ "partition_by_clause_opt ::= PARTITION BY partition_list", + /* 701 */ "partition_list ::= partition_item", + /* 702 */ "partition_list ::= partition_list NK_COMMA partition_item", + /* 703 */ "partition_item ::= expr_or_subquery", + /* 704 */ "partition_item ::= expr_or_subquery column_alias", + /* 705 */ "partition_item ::= expr_or_subquery AS column_alias", + /* 706 */ "twindow_clause_opt ::=", + /* 707 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP", + /* 708 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP", + /* 709 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt", + /* 710 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt", + /* 711 */ "twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition", + /* 712 */ "twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP", + /* 713 */ "twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", + /* 714 */ "sliding_opt ::=", + /* 715 */ "sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP", + /* 716 */ "interval_sliding_duration_literal ::= NK_VARIABLE", + /* 717 */ "interval_sliding_duration_literal ::= NK_STRING", + /* 718 */ "interval_sliding_duration_literal ::= NK_INTEGER", + /* 719 */ "fill_opt ::=", + /* 720 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", + /* 721 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP", + /* 722 */ "fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP", + /* 723 */ "fill_mode ::= NONE", + /* 724 */ "fill_mode ::= PREV", + /* 725 */ "fill_mode ::= NULL", + /* 726 */ "fill_mode ::= NULL_F", + /* 727 */ "fill_mode ::= LINEAR", + /* 728 */ "fill_mode ::= NEXT", + /* 729 */ "group_by_clause_opt ::=", + /* 730 */ "group_by_clause_opt ::= GROUP BY group_by_list", + /* 731 */ "group_by_list ::= expr_or_subquery", + /* 732 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery", + /* 733 */ "having_clause_opt ::=", + /* 734 */ "having_clause_opt ::= HAVING search_condition", + /* 735 */ "range_opt ::=", + /* 736 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP", + /* 737 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_RP", + /* 738 */ "every_opt ::=", + /* 739 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", + /* 740 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt", + /* 741 */ "query_simple ::= query_specification", + /* 742 */ "query_simple ::= union_query_expression", + /* 743 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery", + /* 744 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery", + /* 745 */ "query_simple_or_subquery ::= query_simple", + /* 746 */ "query_simple_or_subquery ::= subquery", + /* 747 */ "query_or_subquery ::= query_expression", + /* 748 */ "query_or_subquery ::= subquery", + /* 749 */ "order_by_clause_opt ::=", + /* 750 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", + /* 751 */ "slimit_clause_opt ::=", + /* 752 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", + /* 753 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", + /* 754 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 755 */ "limit_clause_opt ::=", + /* 756 */ "limit_clause_opt ::= LIMIT NK_INTEGER", + /* 757 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", + /* 758 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 759 */ "subquery ::= NK_LP query_expression NK_RP", + /* 760 */ "subquery ::= NK_LP subquery NK_RP", + /* 761 */ "search_condition ::= common_expression", + /* 762 */ "sort_specification_list ::= sort_specification", + /* 763 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", + /* 764 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt", + /* 765 */ "ordering_specification_opt ::=", + /* 766 */ "ordering_specification_opt ::= ASC", + /* 767 */ "ordering_specification_opt ::= DESC", + /* 768 */ "null_ordering_opt ::=", + /* 769 */ "null_ordering_opt ::= NULLS FIRST", + /* 770 */ "null_ordering_opt ::= NULLS LAST", + /* 771 */ "column_options ::=", + /* 772 */ "column_options ::= column_options PRIMARY KEY", + /* 773 */ "column_options ::= column_options NK_ID NK_STRING", }; #endif /* NDEBUG */ @@ -3810,7 +3754,7 @@ static void yy_destructor( /* Default NON-TERMINAL Destructor */ case 384: /* cmd */ case 387: /* literal */ - case 398: /* with_opt */ + case 398: /* with_clause_opt */ case 404: /* search_condition */ case 409: /* db_options */ case 411: /* alter_db_options */ @@ -3820,91 +3764,91 @@ static void yy_destructor( case 420: /* retention */ case 421: /* full_table_name */ case 424: /* table_options */ - case 429: /* alter_table_clause */ - case 430: /* alter_table_options */ - case 433: /* column_options */ - case 434: /* tags_literal */ - case 435: /* create_subtable_clause */ - case 438: /* drop_table_clause */ - case 441: /* tag_def */ - case 442: /* column_def */ - case 447: /* duration_literal */ - case 448: /* rollup_func_name */ - case 450: /* col_name */ - case 453: /* like_pattern_opt */ - case 454: /* db_name_cond_opt */ - case 455: /* table_name_cond */ - case 456: /* from_db_opt */ - case 458: /* tag_item */ - case 462: /* full_tsma_name */ - case 464: /* index_options */ - case 465: /* full_index_name */ - case 467: /* sliding_opt */ - case 468: /* sma_stream_opt */ - case 469: /* func */ - case 473: /* query_or_subquery */ - case 474: /* where_clause_opt */ - case 477: /* explain_options */ - case 478: /* insert_query */ - case 483: /* full_view_name */ - case 486: /* stream_options */ - case 489: /* subtable_opt */ - case 492: /* column_stream_def */ - case 493: /* stream_col_options */ - case 494: /* expression */ - case 497: /* literal_func */ - case 498: /* signed_literal */ - case 501: /* expr_or_subquery */ - case 502: /* pseudo_column */ - case 503: /* column_reference */ - case 504: /* function_expression */ - case 505: /* case_when_expression */ - case 510: /* rand_func */ - case 513: /* star_func_para */ - case 515: /* case_when_else_opt */ - case 516: /* common_expression */ - case 517: /* when_then_expr */ - case 518: /* predicate */ - case 521: /* in_predicate_value */ - case 522: /* boolean_value_expression */ - case 523: /* boolean_primary */ - case 524: /* from_clause_opt */ - case 525: /* table_reference_list */ - case 526: /* table_reference */ - case 527: /* table_primary */ - case 528: /* joined_table */ - case 530: /* subquery */ - case 531: /* parenthesized_joined_table */ - case 534: /* join_on_clause_opt */ - case 535: /* window_offset_clause_opt */ - case 536: /* jlimit_clause_opt */ - case 537: /* window_offset_literal */ - case 538: /* query_specification */ - case 544: /* range_opt */ - case 545: /* every_opt */ - case 546: /* fill_opt */ - case 547: /* twindow_clause_opt */ - case 549: /* having_clause_opt */ - case 550: /* select_item */ - case 552: /* partition_item */ - case 553: /* interval_sliding_duration_literal */ - case 556: /* query_expression */ - case 557: /* query_simple */ - case 559: /* slimit_clause_opt */ - case 560: /* limit_clause_opt */ - case 561: /* union_query_expression */ - case 562: /* query_simple_or_subquery */ - case 564: /* sort_specification */ + case 430: /* alter_table_clause */ + case 431: /* alter_table_options */ + case 434: /* column_options */ + case 435: /* tags_literal */ + case 436: /* create_subtable_clause */ + case 439: /* drop_table_clause */ + case 442: /* tag_def */ + case 443: /* column_def */ + case 448: /* duration_literal */ + case 449: /* rollup_func_name */ + case 451: /* col_name */ + case 454: /* like_pattern_opt */ + case 455: /* db_name_cond_opt */ + case 456: /* table_name_cond */ + case 457: /* from_db_opt */ + case 459: /* tag_item */ + case 463: /* full_tsma_name */ + case 465: /* index_options */ + case 466: /* full_index_name */ + case 468: /* sliding_opt */ + case 469: /* sma_stream_opt */ + case 470: /* func */ + case 474: /* query_or_subquery */ + case 475: /* where_clause_opt */ + case 478: /* explain_options */ + case 479: /* insert_query */ + case 484: /* full_view_name */ + case 487: /* stream_options */ + case 490: /* subtable_opt */ + case 493: /* column_stream_def */ + case 494: /* stream_col_options */ + case 495: /* expression */ + case 498: /* literal_func */ + case 499: /* signed_literal */ + case 502: /* expr_or_subquery */ + case 503: /* pseudo_column */ + case 504: /* column_reference */ + case 505: /* function_expression */ + case 506: /* case_when_expression */ + case 511: /* rand_func */ + case 514: /* star_func_para */ + case 516: /* case_when_else_opt */ + case 517: /* common_expression */ + case 518: /* when_then_expr */ + case 519: /* predicate */ + case 522: /* in_predicate_value */ + case 523: /* boolean_value_expression */ + case 524: /* boolean_primary */ + case 525: /* from_clause_opt */ + case 526: /* table_reference_list */ + case 527: /* table_reference */ + case 528: /* table_primary */ + case 529: /* joined_table */ + case 531: /* subquery */ + case 532: /* parenthesized_joined_table */ + case 535: /* join_on_clause_opt */ + case 536: /* window_offset_clause_opt */ + case 537: /* jlimit_clause_opt */ + case 538: /* window_offset_literal */ + case 539: /* query_specification */ + case 545: /* range_opt */ + case 546: /* every_opt */ + case 547: /* fill_opt */ + case 548: /* twindow_clause_opt */ + case 550: /* having_clause_opt */ + case 551: /* select_item */ + case 553: /* partition_item */ + case 554: /* interval_sliding_duration_literal */ + case 557: /* query_expression */ + case 558: /* query_simple */ + case 560: /* slimit_clause_opt */ + case 561: /* limit_clause_opt */ + case 562: /* union_query_expression */ + case 563: /* query_simple_or_subquery */ + case 565: /* sort_specification */ { - nodesDestroyNode((yypminor->yy560)); + nodesDestroyNode((yypminor->yy840)); } break; case 385: /* account_options */ case 386: /* alter_account_options */ case 388: /* alter_account_option */ case 412: /* speed_opt */ - case 472: /* with_meta */ - case 481: /* bufsize_opt */ + case 473: /* with_meta */ + case 482: /* bufsize_opt */ { } @@ -3920,33 +3864,33 @@ static void yy_destructor( case 425: /* multi_create_clause */ case 426: /* tag_list_opt */ case 427: /* tags_def */ - case 428: /* multi_drop_clause */ - case 436: /* specific_cols_opt */ - case 437: /* tags_literal_list */ - case 439: /* col_name_list */ - case 440: /* tag_def_list */ - case 444: /* duration_list */ - case 445: /* rollup_func_list */ - case 463: /* func_list */ - case 471: /* expression_list */ - case 487: /* col_list_opt */ - case 488: /* tag_def_or_ref_opt */ - case 491: /* column_stream_def_list */ - case 496: /* dnode_list */ - case 499: /* literal_list */ - case 507: /* star_func_para_list */ - case 512: /* other_para_list */ - case 514: /* when_then_list */ - case 539: /* hint_list */ - case 542: /* select_list */ - case 543: /* partition_by_clause_opt */ - case 548: /* group_by_clause_opt */ - case 551: /* partition_list */ - case 555: /* group_by_list */ - case 558: /* order_by_clause_opt */ - case 563: /* sort_specification_list */ + case 429: /* multi_drop_clause */ + case 437: /* specific_cols_opt */ + case 438: /* tags_literal_list */ + case 440: /* col_name_list */ + case 441: /* tag_def_list */ + case 445: /* duration_list */ + case 446: /* rollup_func_list */ + case 464: /* func_list */ + case 472: /* expression_list */ + case 488: /* col_list_opt */ + case 489: /* tag_def_or_ref_opt */ + case 492: /* column_stream_def_list */ + case 497: /* dnode_list */ + case 500: /* literal_list */ + case 508: /* star_func_para_list */ + case 513: /* other_para_list */ + case 515: /* when_then_list */ + case 540: /* hint_list */ + case 543: /* select_list */ + case 544: /* partition_by_clause_opt */ + case 549: /* group_by_clause_opt */ + case 552: /* partition_list */ + case 556: /* group_by_list */ + case 559: /* order_by_clause_opt */ + case 564: /* sort_specification_list */ { - nodesDestroyList((yypminor->yy334)); + nodesDestroyList((yypminor->yy456)); } break; case 392: /* is_import_opt */ @@ -3961,22 +3905,22 @@ static void yy_destructor( case 402: /* table_name */ case 403: /* topic_name */ case 405: /* dnode_endpoint */ - case 431: /* column_name */ - case 449: /* function_name */ - case 459: /* column_alias */ - case 460: /* tsma_name */ - case 466: /* index_name */ - case 470: /* sma_func_name */ - case 475: /* cgroup_name */ - case 482: /* language_opt */ - case 484: /* view_name */ - case 485: /* stream_name */ - case 495: /* on_vgroup_id */ - case 500: /* table_alias */ - case 506: /* star_func */ - case 509: /* substr_func */ - case 511: /* noarg_func */ - case 529: /* alias_opt */ + case 432: /* column_name */ + case 450: /* function_name */ + case 460: /* column_alias */ + case 461: /* tsma_name */ + case 467: /* index_name */ + case 471: /* sma_func_name */ + case 476: /* cgroup_name */ + case 483: /* language_opt */ + case 485: /* view_name */ + case 486: /* stream_name */ + case 496: /* on_vgroup_id */ + case 501: /* table_alias */ + case 507: /* star_func */ + case 510: /* substr_func */ + case 512: /* noarg_func */ + case 530: /* alias_opt */ { } @@ -3997,76 +3941,77 @@ static void yy_destructor( case 407: /* unsafe_opt */ case 408: /* not_exists_opt */ case 410: /* exists_opt */ - case 476: /* analyze_opt */ - case 479: /* or_replace_opt */ - case 480: /* agg_func_opt */ - case 490: /* ignore_opt */ - case 540: /* set_quantifier_opt */ - case 541: /* tag_mode_opt */ + case 428: /* with_opt */ + case 477: /* analyze_opt */ + case 480: /* or_replace_opt */ + case 481: /* agg_func_opt */ + case 491: /* ignore_opt */ + case 541: /* set_quantifier_opt */ + case 542: /* tag_mode_opt */ { } break; case 419: /* alter_db_option */ - case 446: /* alter_table_option */ + case 447: /* alter_table_option */ { } break; - case 432: /* type_name */ - case 443: /* type_name_default_len */ + case 433: /* type_name */ + case 444: /* type_name_default_len */ { } break; - case 451: /* db_kind_opt */ - case 457: /* table_kind */ + case 452: /* db_kind_opt */ + case 458: /* table_kind */ { } break; - case 452: /* table_kind_db_name_cond_opt */ + case 453: /* table_kind_db_name_cond_opt */ { } break; - case 461: /* tsma_func_list */ + case 462: /* tsma_func_list */ { - nodesDestroyNode((yypminor->yy560)); + nodesDestroyNode((yypminor->yy840)); } break; - case 508: /* trim_specification_type */ + case 509: /* trim_specification_type */ { } break; - case 519: /* compare_op */ - case 520: /* in_op */ + case 520: /* compare_op */ + case 521: /* in_op */ { } break; - case 532: /* join_type */ + case 533: /* join_type */ { } break; - case 533: /* join_subtype */ + case 534: /* join_subtype */ { } break; - case 554: /* fill_mode */ + case 555: /* fill_mode */ { } break; - case 565: /* ordering_specification_opt */ + case 566: /* ordering_specification_opt */ { } break; - case 566: /* null_ordering_opt */ + case 567: /* null_ordering_opt */ { } @@ -4235,7 +4180,7 @@ static YYACTIONTYPE yy_find_shift_action( #endif /* YYWILDCARD */ return yy_default[stateno]; }else{ - assert( i>=0 && i=0 && i<(int)(sizeof(yy_action)/sizeof(yy_action[0])) ); return yy_action[i]; } }while(1); @@ -4400,8 +4345,8 @@ static const YYCODETYPE yyRuleInfoLhs[] = { 384, /* (40) cmd ::= DROP USER user_name */ 395, /* (41) sysinfo_opt ::= */ 395, /* (42) sysinfo_opt ::= SYSINFO NK_INTEGER */ - 384, /* (43) cmd ::= GRANT privileges ON priv_level with_opt TO user_name */ - 384, /* (44) cmd ::= REVOKE privileges ON priv_level with_opt FROM user_name */ + 384, /* (43) cmd ::= GRANT privileges ON priv_level with_clause_opt TO user_name */ + 384, /* (44) cmd ::= REVOKE privileges ON priv_level with_clause_opt FROM user_name */ 396, /* (45) privileges ::= ALL */ 396, /* (46) privileges ::= priv_type_list */ 396, /* (47) privileges ::= SUBSCRIBE */ @@ -4414,8 +4359,8 @@ static const YYCODETYPE yyRuleInfoLhs[] = { 397, /* (54) priv_level ::= db_name NK_DOT NK_STAR */ 397, /* (55) priv_level ::= db_name NK_DOT table_name */ 397, /* (56) priv_level ::= topic_name */ - 398, /* (57) with_opt ::= */ - 398, /* (58) with_opt ::= WITH search_condition */ + 398, /* (57) with_clause_opt ::= */ + 398, /* (58) with_clause_opt ::= WITH search_condition */ 384, /* (59) cmd ::= CREATE ENCRYPT_KEY NK_STRING */ 384, /* (60) cmd ::= CREATE DNODE dnode_endpoint */ 384, /* (61) cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ @@ -4542,593 +4487,595 @@ static const YYCODETYPE yyRuleInfoLhs[] = { 384, /* (182) cmd ::= CREATE TABLE multi_create_clause */ 384, /* (183) cmd ::= CREATE TABLE not_exists_opt USING full_table_name NK_LP tag_list_opt NK_RP FILE NK_STRING */ 384, /* (184) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ - 384, /* (185) cmd ::= DROP TABLE multi_drop_clause */ - 384, /* (186) cmd ::= DROP STABLE exists_opt full_table_name */ + 384, /* (185) cmd ::= DROP TABLE with_opt multi_drop_clause */ + 384, /* (186) cmd ::= DROP STABLE with_opt exists_opt full_table_name */ 384, /* (187) cmd ::= ALTER TABLE alter_table_clause */ 384, /* (188) cmd ::= ALTER STABLE alter_table_clause */ - 429, /* (189) alter_table_clause ::= full_table_name alter_table_options */ - 429, /* (190) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name column_options */ - 429, /* (191) alter_table_clause ::= full_table_name DROP COLUMN column_name */ - 429, /* (192) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ - 429, /* (193) alter_table_clause ::= full_table_name MODIFY COLUMN column_name column_options */ - 429, /* (194) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ - 429, /* (195) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ - 429, /* (196) alter_table_clause ::= full_table_name DROP TAG column_name */ - 429, /* (197) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ - 429, /* (198) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ - 429, /* (199) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ tags_literal */ + 430, /* (189) alter_table_clause ::= full_table_name alter_table_options */ + 430, /* (190) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name column_options */ + 430, /* (191) alter_table_clause ::= full_table_name DROP COLUMN column_name */ + 430, /* (192) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ + 430, /* (193) alter_table_clause ::= full_table_name MODIFY COLUMN column_name column_options */ + 430, /* (194) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ + 430, /* (195) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ + 430, /* (196) alter_table_clause ::= full_table_name DROP TAG column_name */ + 430, /* (197) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ + 430, /* (198) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ + 430, /* (199) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ tags_literal */ 425, /* (200) multi_create_clause ::= create_subtable_clause */ 425, /* (201) multi_create_clause ::= multi_create_clause create_subtable_clause */ - 435, /* (202) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP tags_literal_list NK_RP table_options */ - 428, /* (203) multi_drop_clause ::= drop_table_clause */ - 428, /* (204) multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ - 438, /* (205) drop_table_clause ::= exists_opt full_table_name */ - 436, /* (206) specific_cols_opt ::= */ - 436, /* (207) specific_cols_opt ::= NK_LP col_name_list NK_RP */ - 421, /* (208) full_table_name ::= table_name */ - 421, /* (209) full_table_name ::= db_name NK_DOT table_name */ - 440, /* (210) tag_def_list ::= tag_def */ - 440, /* (211) tag_def_list ::= tag_def_list NK_COMMA tag_def */ - 441, /* (212) tag_def ::= column_name type_name */ - 422, /* (213) column_def_list ::= column_def */ - 422, /* (214) column_def_list ::= column_def_list NK_COMMA column_def */ - 442, /* (215) column_def ::= column_name type_name column_options */ - 432, /* (216) type_name ::= BOOL */ - 432, /* (217) type_name ::= TINYINT */ - 432, /* (218) type_name ::= SMALLINT */ - 432, /* (219) type_name ::= INT */ - 432, /* (220) type_name ::= INTEGER */ - 432, /* (221) type_name ::= BIGINT */ - 432, /* (222) type_name ::= FLOAT */ - 432, /* (223) type_name ::= DOUBLE */ - 432, /* (224) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ - 432, /* (225) type_name ::= TIMESTAMP */ - 432, /* (226) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ - 432, /* (227) type_name ::= TINYINT UNSIGNED */ - 432, /* (228) type_name ::= SMALLINT UNSIGNED */ - 432, /* (229) type_name ::= INT UNSIGNED */ - 432, /* (230) type_name ::= BIGINT UNSIGNED */ - 432, /* (231) type_name ::= JSON */ - 432, /* (232) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ - 432, /* (233) type_name ::= MEDIUMBLOB */ - 432, /* (234) type_name ::= BLOB */ - 432, /* (235) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ - 432, /* (236) type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ - 432, /* (237) type_name ::= DECIMAL */ - 432, /* (238) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ - 432, /* (239) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - 443, /* (240) type_name_default_len ::= BINARY */ - 443, /* (241) type_name_default_len ::= NCHAR */ - 443, /* (242) type_name_default_len ::= VARCHAR */ - 443, /* (243) type_name_default_len ::= VARBINARY */ - 423, /* (244) tags_def_opt ::= */ - 423, /* (245) tags_def_opt ::= tags_def */ - 427, /* (246) tags_def ::= TAGS NK_LP tag_def_list NK_RP */ - 424, /* (247) table_options ::= */ - 424, /* (248) table_options ::= table_options COMMENT NK_STRING */ - 424, /* (249) table_options ::= table_options MAX_DELAY duration_list */ - 424, /* (250) table_options ::= table_options WATERMARK duration_list */ - 424, /* (251) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ - 424, /* (252) table_options ::= table_options TTL NK_INTEGER */ - 424, /* (253) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ - 424, /* (254) table_options ::= table_options DELETE_MARK duration_list */ - 430, /* (255) alter_table_options ::= alter_table_option */ - 430, /* (256) alter_table_options ::= alter_table_options alter_table_option */ - 446, /* (257) alter_table_option ::= COMMENT NK_STRING */ - 446, /* (258) alter_table_option ::= TTL NK_INTEGER */ - 444, /* (259) duration_list ::= duration_literal */ - 444, /* (260) duration_list ::= duration_list NK_COMMA duration_literal */ - 445, /* (261) rollup_func_list ::= rollup_func_name */ - 445, /* (262) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ - 448, /* (263) rollup_func_name ::= function_name */ - 448, /* (264) rollup_func_name ::= FIRST */ - 448, /* (265) rollup_func_name ::= LAST */ - 439, /* (266) col_name_list ::= col_name */ - 439, /* (267) col_name_list ::= col_name_list NK_COMMA col_name */ - 450, /* (268) col_name ::= column_name */ - 384, /* (269) cmd ::= SHOW DNODES */ - 384, /* (270) cmd ::= SHOW USERS */ - 384, /* (271) cmd ::= SHOW USERS FULL */ - 384, /* (272) cmd ::= SHOW USER PRIVILEGES */ - 384, /* (273) cmd ::= SHOW db_kind_opt DATABASES */ - 384, /* (274) cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */ - 384, /* (275) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ - 384, /* (276) cmd ::= SHOW db_name_cond_opt VGROUPS */ - 384, /* (277) cmd ::= SHOW MNODES */ - 384, /* (278) cmd ::= SHOW QNODES */ - 384, /* (279) cmd ::= SHOW ARBGROUPS */ - 384, /* (280) cmd ::= SHOW FUNCTIONS */ - 384, /* (281) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ - 384, /* (282) cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ - 384, /* (283) cmd ::= SHOW STREAMS */ - 384, /* (284) cmd ::= SHOW ACCOUNTS */ - 384, /* (285) cmd ::= SHOW APPS */ - 384, /* (286) cmd ::= SHOW CONNECTIONS */ - 384, /* (287) cmd ::= SHOW LICENCES */ - 384, /* (288) cmd ::= SHOW GRANTS */ - 384, /* (289) cmd ::= SHOW GRANTS FULL */ - 384, /* (290) cmd ::= SHOW GRANTS LOGS */ - 384, /* (291) cmd ::= SHOW CLUSTER MACHINES */ - 384, /* (292) cmd ::= SHOW CREATE DATABASE db_name */ - 384, /* (293) cmd ::= SHOW CREATE TABLE full_table_name */ - 384, /* (294) cmd ::= SHOW CREATE STABLE full_table_name */ - 384, /* (295) cmd ::= SHOW ENCRYPTIONS */ - 384, /* (296) cmd ::= SHOW QUERIES */ - 384, /* (297) cmd ::= SHOW SCORES */ - 384, /* (298) cmd ::= SHOW TOPICS */ - 384, /* (299) cmd ::= SHOW VARIABLES */ - 384, /* (300) cmd ::= SHOW CLUSTER VARIABLES */ - 384, /* (301) cmd ::= SHOW LOCAL VARIABLES */ - 384, /* (302) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ - 384, /* (303) cmd ::= SHOW BNODES */ - 384, /* (304) cmd ::= SHOW SNODES */ - 384, /* (305) cmd ::= SHOW CLUSTER */ - 384, /* (306) cmd ::= SHOW TRANSACTIONS */ - 384, /* (307) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ - 384, /* (308) cmd ::= SHOW CONSUMERS */ - 384, /* (309) cmd ::= SHOW SUBSCRIPTIONS */ - 384, /* (310) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ - 384, /* (311) cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ - 384, /* (312) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ - 384, /* (313) cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ - 384, /* (314) cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ - 384, /* (315) cmd ::= SHOW VNODES */ - 384, /* (316) cmd ::= SHOW db_name_cond_opt ALIVE */ - 384, /* (317) cmd ::= SHOW CLUSTER ALIVE */ - 384, /* (318) cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt */ - 384, /* (319) cmd ::= SHOW CREATE VIEW full_table_name */ - 384, /* (320) cmd ::= SHOW COMPACTS */ - 384, /* (321) cmd ::= SHOW COMPACT NK_INTEGER */ - 452, /* (322) table_kind_db_name_cond_opt ::= */ - 452, /* (323) table_kind_db_name_cond_opt ::= table_kind */ - 452, /* (324) table_kind_db_name_cond_opt ::= db_name NK_DOT */ - 452, /* (325) table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */ - 457, /* (326) table_kind ::= NORMAL */ - 457, /* (327) table_kind ::= CHILD */ - 454, /* (328) db_name_cond_opt ::= */ - 454, /* (329) db_name_cond_opt ::= db_name NK_DOT */ - 453, /* (330) like_pattern_opt ::= */ - 453, /* (331) like_pattern_opt ::= LIKE NK_STRING */ - 455, /* (332) table_name_cond ::= table_name */ - 456, /* (333) from_db_opt ::= */ - 456, /* (334) from_db_opt ::= FROM db_name */ - 426, /* (335) tag_list_opt ::= */ - 426, /* (336) tag_list_opt ::= tag_item */ - 426, /* (337) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ - 458, /* (338) tag_item ::= TBNAME */ - 458, /* (339) tag_item ::= QTAGS */ - 458, /* (340) tag_item ::= column_name */ - 458, /* (341) tag_item ::= column_name column_alias */ - 458, /* (342) tag_item ::= column_name AS column_alias */ - 451, /* (343) db_kind_opt ::= */ - 451, /* (344) db_kind_opt ::= USER */ - 451, /* (345) db_kind_opt ::= SYSTEM */ - 384, /* (346) cmd ::= CREATE TSMA not_exists_opt tsma_name ON full_table_name tsma_func_list INTERVAL NK_LP duration_literal NK_RP */ - 384, /* (347) cmd ::= CREATE RECURSIVE TSMA not_exists_opt tsma_name ON full_table_name INTERVAL NK_LP duration_literal NK_RP */ - 384, /* (348) cmd ::= DROP TSMA exists_opt full_tsma_name */ - 384, /* (349) cmd ::= SHOW db_name_cond_opt TSMAS */ - 462, /* (350) full_tsma_name ::= tsma_name */ - 462, /* (351) full_tsma_name ::= db_name NK_DOT tsma_name */ - 461, /* (352) tsma_func_list ::= FUNCTION NK_LP func_list NK_RP */ - 384, /* (353) cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */ - 384, /* (354) cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */ - 384, /* (355) cmd ::= DROP INDEX exists_opt full_index_name */ - 465, /* (356) full_index_name ::= index_name */ - 465, /* (357) full_index_name ::= db_name NK_DOT index_name */ - 464, /* (358) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ - 464, /* (359) 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 */ - 463, /* (360) func_list ::= func */ - 463, /* (361) func_list ::= func_list NK_COMMA func */ - 469, /* (362) func ::= sma_func_name NK_LP expression_list NK_RP */ - 470, /* (363) sma_func_name ::= function_name */ - 470, /* (364) sma_func_name ::= COUNT */ - 470, /* (365) sma_func_name ::= FIRST */ - 470, /* (366) sma_func_name ::= LAST */ - 470, /* (367) sma_func_name ::= LAST_ROW */ - 468, /* (368) sma_stream_opt ::= */ - 468, /* (369) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ - 468, /* (370) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ - 468, /* (371) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ - 472, /* (372) with_meta ::= AS */ - 472, /* (373) with_meta ::= WITH META AS */ - 472, /* (374) with_meta ::= ONLY META AS */ - 384, /* (375) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ - 384, /* (376) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ - 384, /* (377) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ - 384, /* (378) cmd ::= DROP TOPIC exists_opt topic_name */ - 384, /* (379) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ - 384, /* (380) cmd ::= DESC full_table_name */ - 384, /* (381) cmd ::= DESCRIBE full_table_name */ - 384, /* (382) cmd ::= RESET QUERY CACHE */ - 384, /* (383) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ - 384, /* (384) cmd ::= EXPLAIN analyze_opt explain_options insert_query */ - 476, /* (385) analyze_opt ::= */ - 476, /* (386) analyze_opt ::= ANALYZE */ - 477, /* (387) explain_options ::= */ - 477, /* (388) explain_options ::= explain_options VERBOSE NK_BOOL */ - 477, /* (389) explain_options ::= explain_options RATIO NK_FLOAT */ - 384, /* (390) cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ - 384, /* (391) cmd ::= DROP FUNCTION exists_opt function_name */ - 480, /* (392) agg_func_opt ::= */ - 480, /* (393) agg_func_opt ::= AGGREGATE */ - 481, /* (394) bufsize_opt ::= */ - 481, /* (395) bufsize_opt ::= BUFSIZE NK_INTEGER */ - 482, /* (396) language_opt ::= */ - 482, /* (397) language_opt ::= LANGUAGE NK_STRING */ - 479, /* (398) or_replace_opt ::= */ - 479, /* (399) or_replace_opt ::= OR REPLACE */ - 384, /* (400) cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */ - 384, /* (401) cmd ::= DROP VIEW exists_opt full_view_name */ - 483, /* (402) full_view_name ::= view_name */ - 483, /* (403) full_view_name ::= db_name NK_DOT view_name */ - 384, /* (404) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */ - 384, /* (405) cmd ::= DROP STREAM exists_opt stream_name */ - 384, /* (406) cmd ::= PAUSE STREAM exists_opt stream_name */ - 384, /* (407) cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ - 487, /* (408) col_list_opt ::= */ - 487, /* (409) col_list_opt ::= NK_LP column_stream_def_list NK_RP */ - 491, /* (410) column_stream_def_list ::= column_stream_def */ - 491, /* (411) column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def */ - 492, /* (412) column_stream_def ::= column_name stream_col_options */ - 493, /* (413) stream_col_options ::= */ - 493, /* (414) stream_col_options ::= stream_col_options PRIMARY KEY */ - 488, /* (415) tag_def_or_ref_opt ::= */ - 488, /* (416) tag_def_or_ref_opt ::= tags_def */ - 488, /* (417) tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP */ - 486, /* (418) stream_options ::= */ - 486, /* (419) stream_options ::= stream_options TRIGGER AT_ONCE */ - 486, /* (420) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ - 486, /* (421) stream_options ::= stream_options TRIGGER FORCE_WINDOW_CLOSE */ - 486, /* (422) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ - 486, /* (423) stream_options ::= stream_options WATERMARK duration_literal */ - 486, /* (424) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ - 486, /* (425) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ - 486, /* (426) stream_options ::= stream_options DELETE_MARK duration_literal */ - 486, /* (427) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ - 489, /* (428) subtable_opt ::= */ - 489, /* (429) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - 490, /* (430) ignore_opt ::= */ - 490, /* (431) ignore_opt ::= IGNORE UNTREATED */ - 384, /* (432) cmd ::= KILL CONNECTION NK_INTEGER */ - 384, /* (433) cmd ::= KILL QUERY NK_STRING */ - 384, /* (434) cmd ::= KILL TRANSACTION NK_INTEGER */ - 384, /* (435) cmd ::= KILL COMPACT NK_INTEGER */ - 384, /* (436) cmd ::= BALANCE VGROUP */ - 384, /* (437) cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ - 384, /* (438) cmd ::= BALANCE VGROUP LEADER DATABASE db_name */ - 384, /* (439) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ - 384, /* (440) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ - 384, /* (441) cmd ::= SPLIT VGROUP NK_INTEGER */ - 495, /* (442) on_vgroup_id ::= */ - 495, /* (443) on_vgroup_id ::= ON NK_INTEGER */ - 496, /* (444) dnode_list ::= DNODE NK_INTEGER */ - 496, /* (445) dnode_list ::= dnode_list DNODE NK_INTEGER */ - 384, /* (446) cmd ::= DELETE FROM full_table_name where_clause_opt */ - 384, /* (447) cmd ::= query_or_subquery */ - 384, /* (448) cmd ::= insert_query */ - 478, /* (449) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ - 478, /* (450) insert_query ::= INSERT INTO full_table_name query_or_subquery */ - 434, /* (451) tags_literal ::= NK_INTEGER */ - 434, /* (452) tags_literal ::= NK_INTEGER NK_PLUS duration_literal */ - 434, /* (453) tags_literal ::= NK_INTEGER NK_MINUS duration_literal */ - 434, /* (454) tags_literal ::= NK_PLUS NK_INTEGER */ - 434, /* (455) tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal */ - 434, /* (456) tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal */ - 434, /* (457) tags_literal ::= NK_MINUS NK_INTEGER */ - 434, /* (458) tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal */ - 434, /* (459) tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal */ - 434, /* (460) tags_literal ::= NK_FLOAT */ - 434, /* (461) tags_literal ::= NK_PLUS NK_FLOAT */ - 434, /* (462) tags_literal ::= NK_MINUS NK_FLOAT */ - 434, /* (463) tags_literal ::= NK_BIN */ - 434, /* (464) tags_literal ::= NK_BIN NK_PLUS duration_literal */ - 434, /* (465) tags_literal ::= NK_BIN NK_MINUS duration_literal */ - 434, /* (466) tags_literal ::= NK_PLUS NK_BIN */ - 434, /* (467) tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal */ - 434, /* (468) tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal */ - 434, /* (469) tags_literal ::= NK_MINUS NK_BIN */ - 434, /* (470) tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal */ - 434, /* (471) tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal */ - 434, /* (472) tags_literal ::= NK_HEX */ - 434, /* (473) tags_literal ::= NK_HEX NK_PLUS duration_literal */ - 434, /* (474) tags_literal ::= NK_HEX NK_MINUS duration_literal */ - 434, /* (475) tags_literal ::= NK_PLUS NK_HEX */ - 434, /* (476) tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal */ - 434, /* (477) tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal */ - 434, /* (478) tags_literal ::= NK_MINUS NK_HEX */ - 434, /* (479) tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal */ - 434, /* (480) tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal */ - 434, /* (481) tags_literal ::= NK_STRING */ - 434, /* (482) tags_literal ::= NK_STRING NK_PLUS duration_literal */ - 434, /* (483) tags_literal ::= NK_STRING NK_MINUS duration_literal */ - 434, /* (484) tags_literal ::= NK_BOOL */ - 434, /* (485) tags_literal ::= NULL */ - 434, /* (486) tags_literal ::= literal_func */ - 434, /* (487) tags_literal ::= literal_func NK_PLUS duration_literal */ - 434, /* (488) tags_literal ::= literal_func NK_MINUS duration_literal */ - 437, /* (489) tags_literal_list ::= tags_literal */ - 437, /* (490) tags_literal_list ::= tags_literal_list NK_COMMA tags_literal */ - 387, /* (491) literal ::= NK_INTEGER */ - 387, /* (492) literal ::= NK_FLOAT */ - 387, /* (493) literal ::= NK_STRING */ - 387, /* (494) literal ::= NK_BOOL */ - 387, /* (495) literal ::= TIMESTAMP NK_STRING */ - 387, /* (496) literal ::= duration_literal */ - 387, /* (497) literal ::= NULL */ - 387, /* (498) literal ::= NK_QUESTION */ - 447, /* (499) duration_literal ::= NK_VARIABLE */ - 418, /* (500) signed ::= NK_INTEGER */ - 418, /* (501) signed ::= NK_PLUS NK_INTEGER */ - 418, /* (502) signed ::= NK_MINUS NK_INTEGER */ - 418, /* (503) signed ::= NK_FLOAT */ - 418, /* (504) signed ::= NK_PLUS NK_FLOAT */ - 418, /* (505) signed ::= NK_MINUS NK_FLOAT */ - 498, /* (506) signed_literal ::= signed */ - 498, /* (507) signed_literal ::= NK_STRING */ - 498, /* (508) signed_literal ::= NK_BOOL */ - 498, /* (509) signed_literal ::= TIMESTAMP NK_STRING */ - 498, /* (510) signed_literal ::= duration_literal */ - 498, /* (511) signed_literal ::= NULL */ - 498, /* (512) signed_literal ::= literal_func */ - 498, /* (513) signed_literal ::= NK_QUESTION */ - 499, /* (514) literal_list ::= signed_literal */ - 499, /* (515) literal_list ::= literal_list NK_COMMA signed_literal */ - 401, /* (516) db_name ::= NK_ID */ - 402, /* (517) table_name ::= NK_ID */ - 431, /* (518) column_name ::= NK_ID */ - 449, /* (519) function_name ::= NK_ID */ - 484, /* (520) view_name ::= NK_ID */ - 500, /* (521) table_alias ::= NK_ID */ - 459, /* (522) column_alias ::= NK_ID */ - 459, /* (523) column_alias ::= NK_ALIAS */ - 394, /* (524) user_name ::= NK_ID */ - 403, /* (525) topic_name ::= NK_ID */ - 485, /* (526) stream_name ::= NK_ID */ - 475, /* (527) cgroup_name ::= NK_ID */ - 466, /* (528) index_name ::= NK_ID */ - 460, /* (529) tsma_name ::= NK_ID */ - 501, /* (530) expr_or_subquery ::= expression */ - 494, /* (531) expression ::= literal */ - 494, /* (532) expression ::= pseudo_column */ - 494, /* (533) expression ::= column_reference */ - 494, /* (534) expression ::= function_expression */ - 494, /* (535) expression ::= case_when_expression */ - 494, /* (536) expression ::= NK_LP expression NK_RP */ - 494, /* (537) expression ::= NK_PLUS expr_or_subquery */ - 494, /* (538) expression ::= NK_MINUS expr_or_subquery */ - 494, /* (539) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ - 494, /* (540) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ - 494, /* (541) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ - 494, /* (542) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ - 494, /* (543) expression ::= expr_or_subquery NK_REM expr_or_subquery */ - 494, /* (544) expression ::= column_reference NK_ARROW NK_STRING */ - 494, /* (545) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ - 494, /* (546) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ - 471, /* (547) expression_list ::= expr_or_subquery */ - 471, /* (548) expression_list ::= expression_list NK_COMMA expr_or_subquery */ - 503, /* (549) column_reference ::= column_name */ - 503, /* (550) column_reference ::= table_name NK_DOT column_name */ - 503, /* (551) column_reference ::= NK_ALIAS */ - 503, /* (552) column_reference ::= table_name NK_DOT NK_ALIAS */ - 502, /* (553) pseudo_column ::= ROWTS */ - 502, /* (554) pseudo_column ::= TBNAME */ - 502, /* (555) pseudo_column ::= table_name NK_DOT TBNAME */ - 502, /* (556) pseudo_column ::= QSTART */ - 502, /* (557) pseudo_column ::= QEND */ - 502, /* (558) pseudo_column ::= QDURATION */ - 502, /* (559) pseudo_column ::= WSTART */ - 502, /* (560) pseudo_column ::= WEND */ - 502, /* (561) pseudo_column ::= WDURATION */ - 502, /* (562) pseudo_column ::= IROWTS */ - 502, /* (563) pseudo_column ::= ISFILLED */ - 502, /* (564) pseudo_column ::= QTAGS */ - 504, /* (565) function_expression ::= function_name NK_LP expression_list NK_RP */ - 504, /* (566) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ - 504, /* (567) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ - 504, /* (568) function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP */ - 504, /* (569) function_expression ::= POSITION NK_LP expr_or_subquery IN expr_or_subquery NK_RP */ - 504, /* (570) function_expression ::= TRIM NK_LP expr_or_subquery NK_RP */ - 504, /* (571) function_expression ::= TRIM NK_LP trim_specification_type FROM expr_or_subquery NK_RP */ - 504, /* (572) function_expression ::= TRIM NK_LP expr_or_subquery FROM expr_or_subquery NK_RP */ - 504, /* (573) function_expression ::= TRIM NK_LP trim_specification_type expr_or_subquery FROM expr_or_subquery NK_RP */ - 504, /* (574) function_expression ::= substr_func NK_LP expression_list NK_RP */ - 504, /* (575) function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery NK_RP */ - 504, /* (576) function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery FOR expr_or_subquery NK_RP */ - 504, /* (577) function_expression ::= REPLACE NK_LP expression_list NK_RP */ - 504, /* (578) function_expression ::= literal_func */ - 504, /* (579) function_expression ::= rand_func */ - 497, /* (580) literal_func ::= noarg_func NK_LP NK_RP */ - 497, /* (581) literal_func ::= NOW */ - 497, /* (582) literal_func ::= TODAY */ - 510, /* (583) rand_func ::= RAND NK_LP NK_RP */ - 510, /* (584) rand_func ::= RAND NK_LP expression_list NK_RP */ - 509, /* (585) substr_func ::= SUBSTR */ - 509, /* (586) substr_func ::= SUBSTRING */ - 508, /* (587) trim_specification_type ::= BOTH */ - 508, /* (588) trim_specification_type ::= TRAILING */ - 508, /* (589) trim_specification_type ::= LEADING */ - 511, /* (590) noarg_func ::= NOW */ - 511, /* (591) noarg_func ::= TODAY */ - 511, /* (592) noarg_func ::= TIMEZONE */ - 511, /* (593) noarg_func ::= DATABASE */ - 511, /* (594) noarg_func ::= CLIENT_VERSION */ - 511, /* (595) noarg_func ::= SERVER_VERSION */ - 511, /* (596) noarg_func ::= SERVER_STATUS */ - 511, /* (597) noarg_func ::= CURRENT_USER */ - 511, /* (598) noarg_func ::= USER */ - 511, /* (599) noarg_func ::= PI */ - 506, /* (600) star_func ::= COUNT */ - 506, /* (601) star_func ::= FIRST */ - 506, /* (602) star_func ::= LAST */ - 506, /* (603) star_func ::= LAST_ROW */ - 507, /* (604) star_func_para_list ::= NK_STAR */ - 507, /* (605) star_func_para_list ::= other_para_list */ - 512, /* (606) other_para_list ::= star_func_para */ - 512, /* (607) other_para_list ::= other_para_list NK_COMMA star_func_para */ - 513, /* (608) star_func_para ::= expr_or_subquery */ - 513, /* (609) star_func_para ::= table_name NK_DOT NK_STAR */ - 505, /* (610) case_when_expression ::= CASE when_then_list case_when_else_opt END */ - 505, /* (611) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ - 514, /* (612) when_then_list ::= when_then_expr */ - 514, /* (613) when_then_list ::= when_then_list when_then_expr */ - 517, /* (614) when_then_expr ::= WHEN common_expression THEN common_expression */ - 515, /* (615) case_when_else_opt ::= */ - 515, /* (616) case_when_else_opt ::= ELSE common_expression */ - 518, /* (617) predicate ::= expr_or_subquery compare_op expr_or_subquery */ - 518, /* (618) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ - 518, /* (619) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ - 518, /* (620) predicate ::= expr_or_subquery IS NULL */ - 518, /* (621) predicate ::= expr_or_subquery IS NOT NULL */ - 518, /* (622) predicate ::= expr_or_subquery in_op in_predicate_value */ - 519, /* (623) compare_op ::= NK_LT */ - 519, /* (624) compare_op ::= NK_GT */ - 519, /* (625) compare_op ::= NK_LE */ - 519, /* (626) compare_op ::= NK_GE */ - 519, /* (627) compare_op ::= NK_NE */ - 519, /* (628) compare_op ::= NK_EQ */ - 519, /* (629) compare_op ::= LIKE */ - 519, /* (630) compare_op ::= NOT LIKE */ - 519, /* (631) compare_op ::= MATCH */ - 519, /* (632) compare_op ::= NMATCH */ - 519, /* (633) compare_op ::= CONTAINS */ - 520, /* (634) in_op ::= IN */ - 520, /* (635) in_op ::= NOT IN */ - 521, /* (636) in_predicate_value ::= NK_LP literal_list NK_RP */ - 522, /* (637) boolean_value_expression ::= boolean_primary */ - 522, /* (638) boolean_value_expression ::= NOT boolean_primary */ - 522, /* (639) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - 522, /* (640) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - 523, /* (641) boolean_primary ::= predicate */ - 523, /* (642) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ - 516, /* (643) common_expression ::= expr_or_subquery */ - 516, /* (644) common_expression ::= boolean_value_expression */ - 524, /* (645) from_clause_opt ::= */ - 524, /* (646) from_clause_opt ::= FROM table_reference_list */ - 525, /* (647) table_reference_list ::= table_reference */ - 525, /* (648) table_reference_list ::= table_reference_list NK_COMMA table_reference */ - 526, /* (649) table_reference ::= table_primary */ - 526, /* (650) table_reference ::= joined_table */ - 527, /* (651) table_primary ::= table_name alias_opt */ - 527, /* (652) table_primary ::= db_name NK_DOT table_name alias_opt */ - 527, /* (653) table_primary ::= subquery alias_opt */ - 527, /* (654) table_primary ::= parenthesized_joined_table */ - 529, /* (655) alias_opt ::= */ - 529, /* (656) alias_opt ::= table_alias */ - 529, /* (657) alias_opt ::= AS table_alias */ - 531, /* (658) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - 531, /* (659) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ - 528, /* (660) joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt */ - 532, /* (661) join_type ::= */ - 532, /* (662) join_type ::= INNER */ - 532, /* (663) join_type ::= LEFT */ - 532, /* (664) join_type ::= RIGHT */ - 532, /* (665) join_type ::= FULL */ - 533, /* (666) join_subtype ::= */ - 533, /* (667) join_subtype ::= OUTER */ - 533, /* (668) join_subtype ::= SEMI */ - 533, /* (669) join_subtype ::= ANTI */ - 533, /* (670) join_subtype ::= ASOF */ - 533, /* (671) join_subtype ::= WINDOW */ - 534, /* (672) join_on_clause_opt ::= */ - 534, /* (673) join_on_clause_opt ::= ON search_condition */ - 535, /* (674) window_offset_clause_opt ::= */ - 535, /* (675) window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP */ - 537, /* (676) window_offset_literal ::= NK_VARIABLE */ - 537, /* (677) window_offset_literal ::= NK_MINUS NK_VARIABLE */ - 536, /* (678) jlimit_clause_opt ::= */ - 536, /* (679) jlimit_clause_opt ::= JLIMIT NK_INTEGER */ - 538, /* (680) query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_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 */ - 539, /* (681) hint_list ::= */ - 539, /* (682) hint_list ::= NK_HINT */ - 541, /* (683) tag_mode_opt ::= */ - 541, /* (684) tag_mode_opt ::= TAGS */ - 540, /* (685) set_quantifier_opt ::= */ - 540, /* (686) set_quantifier_opt ::= DISTINCT */ - 540, /* (687) set_quantifier_opt ::= ALL */ - 542, /* (688) select_list ::= select_item */ - 542, /* (689) select_list ::= select_list NK_COMMA select_item */ - 550, /* (690) select_item ::= NK_STAR */ - 550, /* (691) select_item ::= common_expression */ - 550, /* (692) select_item ::= common_expression column_alias */ - 550, /* (693) select_item ::= common_expression AS column_alias */ - 550, /* (694) select_item ::= table_name NK_DOT NK_STAR */ - 474, /* (695) where_clause_opt ::= */ - 474, /* (696) where_clause_opt ::= WHERE search_condition */ - 543, /* (697) partition_by_clause_opt ::= */ - 543, /* (698) partition_by_clause_opt ::= PARTITION BY partition_list */ - 551, /* (699) partition_list ::= partition_item */ - 551, /* (700) partition_list ::= partition_list NK_COMMA partition_item */ - 552, /* (701) partition_item ::= expr_or_subquery */ - 552, /* (702) partition_item ::= expr_or_subquery column_alias */ - 552, /* (703) partition_item ::= expr_or_subquery AS column_alias */ - 547, /* (704) twindow_clause_opt ::= */ - 547, /* (705) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ - 547, /* (706) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ - 547, /* (707) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ - 547, /* (708) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ - 547, /* (709) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ - 547, /* (710) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */ - 547, /* (711) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - 467, /* (712) sliding_opt ::= */ - 467, /* (713) sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ - 553, /* (714) interval_sliding_duration_literal ::= NK_VARIABLE */ - 553, /* (715) interval_sliding_duration_literal ::= NK_STRING */ - 553, /* (716) interval_sliding_duration_literal ::= NK_INTEGER */ - 546, /* (717) fill_opt ::= */ - 546, /* (718) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - 546, /* (719) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ - 546, /* (720) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ - 554, /* (721) fill_mode ::= NONE */ - 554, /* (722) fill_mode ::= PREV */ - 554, /* (723) fill_mode ::= NULL */ - 554, /* (724) fill_mode ::= NULL_F */ - 554, /* (725) fill_mode ::= LINEAR */ - 554, /* (726) fill_mode ::= NEXT */ - 548, /* (727) group_by_clause_opt ::= */ - 548, /* (728) group_by_clause_opt ::= GROUP BY group_by_list */ - 555, /* (729) group_by_list ::= expr_or_subquery */ - 555, /* (730) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ - 549, /* (731) having_clause_opt ::= */ - 549, /* (732) having_clause_opt ::= HAVING search_condition */ - 544, /* (733) range_opt ::= */ - 544, /* (734) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ - 544, /* (735) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ - 545, /* (736) every_opt ::= */ - 545, /* (737) every_opt ::= EVERY NK_LP duration_literal NK_RP */ - 556, /* (738) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ - 557, /* (739) query_simple ::= query_specification */ - 557, /* (740) query_simple ::= union_query_expression */ - 561, /* (741) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ - 561, /* (742) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ - 562, /* (743) query_simple_or_subquery ::= query_simple */ - 562, /* (744) query_simple_or_subquery ::= subquery */ - 473, /* (745) query_or_subquery ::= query_expression */ - 473, /* (746) query_or_subquery ::= subquery */ - 558, /* (747) order_by_clause_opt ::= */ - 558, /* (748) order_by_clause_opt ::= ORDER BY sort_specification_list */ - 559, /* (749) slimit_clause_opt ::= */ - 559, /* (750) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - 559, /* (751) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - 559, /* (752) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - 560, /* (753) limit_clause_opt ::= */ - 560, /* (754) limit_clause_opt ::= LIMIT NK_INTEGER */ - 560, /* (755) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - 560, /* (756) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - 530, /* (757) subquery ::= NK_LP query_expression NK_RP */ - 530, /* (758) subquery ::= NK_LP subquery NK_RP */ - 404, /* (759) search_condition ::= common_expression */ - 563, /* (760) sort_specification_list ::= sort_specification */ - 563, /* (761) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - 564, /* (762) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ - 565, /* (763) ordering_specification_opt ::= */ - 565, /* (764) ordering_specification_opt ::= ASC */ - 565, /* (765) ordering_specification_opt ::= DESC */ - 566, /* (766) null_ordering_opt ::= */ - 566, /* (767) null_ordering_opt ::= NULLS FIRST */ - 566, /* (768) null_ordering_opt ::= NULLS LAST */ - 433, /* (769) column_options ::= */ - 433, /* (770) column_options ::= column_options PRIMARY KEY */ - 433, /* (771) column_options ::= column_options NK_ID NK_STRING */ + 436, /* (202) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP tags_literal_list NK_RP table_options */ + 429, /* (203) multi_drop_clause ::= drop_table_clause */ + 429, /* (204) multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ + 439, /* (205) drop_table_clause ::= exists_opt full_table_name */ + 428, /* (206) with_opt ::= */ + 428, /* (207) with_opt ::= WITH */ + 437, /* (208) specific_cols_opt ::= */ + 437, /* (209) specific_cols_opt ::= NK_LP col_name_list NK_RP */ + 421, /* (210) full_table_name ::= table_name */ + 421, /* (211) full_table_name ::= db_name NK_DOT table_name */ + 441, /* (212) tag_def_list ::= tag_def */ + 441, /* (213) tag_def_list ::= tag_def_list NK_COMMA tag_def */ + 442, /* (214) tag_def ::= column_name type_name */ + 422, /* (215) column_def_list ::= column_def */ + 422, /* (216) column_def_list ::= column_def_list NK_COMMA column_def */ + 443, /* (217) column_def ::= column_name type_name column_options */ + 433, /* (218) type_name ::= BOOL */ + 433, /* (219) type_name ::= TINYINT */ + 433, /* (220) type_name ::= SMALLINT */ + 433, /* (221) type_name ::= INT */ + 433, /* (222) type_name ::= INTEGER */ + 433, /* (223) type_name ::= BIGINT */ + 433, /* (224) type_name ::= FLOAT */ + 433, /* (225) type_name ::= DOUBLE */ + 433, /* (226) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ + 433, /* (227) type_name ::= TIMESTAMP */ + 433, /* (228) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ + 433, /* (229) type_name ::= TINYINT UNSIGNED */ + 433, /* (230) type_name ::= SMALLINT UNSIGNED */ + 433, /* (231) type_name ::= INT UNSIGNED */ + 433, /* (232) type_name ::= BIGINT UNSIGNED */ + 433, /* (233) type_name ::= JSON */ + 433, /* (234) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ + 433, /* (235) type_name ::= MEDIUMBLOB */ + 433, /* (236) type_name ::= BLOB */ + 433, /* (237) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ + 433, /* (238) type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ + 433, /* (239) type_name ::= DECIMAL */ + 433, /* (240) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ + 433, /* (241) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + 444, /* (242) type_name_default_len ::= BINARY */ + 444, /* (243) type_name_default_len ::= NCHAR */ + 444, /* (244) type_name_default_len ::= VARCHAR */ + 444, /* (245) type_name_default_len ::= VARBINARY */ + 423, /* (246) tags_def_opt ::= */ + 423, /* (247) tags_def_opt ::= tags_def */ + 427, /* (248) tags_def ::= TAGS NK_LP tag_def_list NK_RP */ + 424, /* (249) table_options ::= */ + 424, /* (250) table_options ::= table_options COMMENT NK_STRING */ + 424, /* (251) table_options ::= table_options MAX_DELAY duration_list */ + 424, /* (252) table_options ::= table_options WATERMARK duration_list */ + 424, /* (253) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ + 424, /* (254) table_options ::= table_options TTL NK_INTEGER */ + 424, /* (255) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ + 424, /* (256) table_options ::= table_options DELETE_MARK duration_list */ + 431, /* (257) alter_table_options ::= alter_table_option */ + 431, /* (258) alter_table_options ::= alter_table_options alter_table_option */ + 447, /* (259) alter_table_option ::= COMMENT NK_STRING */ + 447, /* (260) alter_table_option ::= TTL NK_INTEGER */ + 445, /* (261) duration_list ::= duration_literal */ + 445, /* (262) duration_list ::= duration_list NK_COMMA duration_literal */ + 446, /* (263) rollup_func_list ::= rollup_func_name */ + 446, /* (264) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ + 449, /* (265) rollup_func_name ::= function_name */ + 449, /* (266) rollup_func_name ::= FIRST */ + 449, /* (267) rollup_func_name ::= LAST */ + 440, /* (268) col_name_list ::= col_name */ + 440, /* (269) col_name_list ::= col_name_list NK_COMMA col_name */ + 451, /* (270) col_name ::= column_name */ + 384, /* (271) cmd ::= SHOW DNODES */ + 384, /* (272) cmd ::= SHOW USERS */ + 384, /* (273) cmd ::= SHOW USERS FULL */ + 384, /* (274) cmd ::= SHOW USER PRIVILEGES */ + 384, /* (275) cmd ::= SHOW db_kind_opt DATABASES */ + 384, /* (276) cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */ + 384, /* (277) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ + 384, /* (278) cmd ::= SHOW db_name_cond_opt VGROUPS */ + 384, /* (279) cmd ::= SHOW MNODES */ + 384, /* (280) cmd ::= SHOW QNODES */ + 384, /* (281) cmd ::= SHOW ARBGROUPS */ + 384, /* (282) cmd ::= SHOW FUNCTIONS */ + 384, /* (283) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ + 384, /* (284) cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ + 384, /* (285) cmd ::= SHOW STREAMS */ + 384, /* (286) cmd ::= SHOW ACCOUNTS */ + 384, /* (287) cmd ::= SHOW APPS */ + 384, /* (288) cmd ::= SHOW CONNECTIONS */ + 384, /* (289) cmd ::= SHOW LICENCES */ + 384, /* (290) cmd ::= SHOW GRANTS */ + 384, /* (291) cmd ::= SHOW GRANTS FULL */ + 384, /* (292) cmd ::= SHOW GRANTS LOGS */ + 384, /* (293) cmd ::= SHOW CLUSTER MACHINES */ + 384, /* (294) cmd ::= SHOW CREATE DATABASE db_name */ + 384, /* (295) cmd ::= SHOW CREATE TABLE full_table_name */ + 384, /* (296) cmd ::= SHOW CREATE STABLE full_table_name */ + 384, /* (297) cmd ::= SHOW ENCRYPTIONS */ + 384, /* (298) cmd ::= SHOW QUERIES */ + 384, /* (299) cmd ::= SHOW SCORES */ + 384, /* (300) cmd ::= SHOW TOPICS */ + 384, /* (301) cmd ::= SHOW VARIABLES */ + 384, /* (302) cmd ::= SHOW CLUSTER VARIABLES */ + 384, /* (303) cmd ::= SHOW LOCAL VARIABLES */ + 384, /* (304) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ + 384, /* (305) cmd ::= SHOW BNODES */ + 384, /* (306) cmd ::= SHOW SNODES */ + 384, /* (307) cmd ::= SHOW CLUSTER */ + 384, /* (308) cmd ::= SHOW TRANSACTIONS */ + 384, /* (309) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ + 384, /* (310) cmd ::= SHOW CONSUMERS */ + 384, /* (311) cmd ::= SHOW SUBSCRIPTIONS */ + 384, /* (312) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ + 384, /* (313) cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ + 384, /* (314) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ + 384, /* (315) cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ + 384, /* (316) cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ + 384, /* (317) cmd ::= SHOW VNODES */ + 384, /* (318) cmd ::= SHOW db_name_cond_opt ALIVE */ + 384, /* (319) cmd ::= SHOW CLUSTER ALIVE */ + 384, /* (320) cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt */ + 384, /* (321) cmd ::= SHOW CREATE VIEW full_table_name */ + 384, /* (322) cmd ::= SHOW COMPACTS */ + 384, /* (323) cmd ::= SHOW COMPACT NK_INTEGER */ + 453, /* (324) table_kind_db_name_cond_opt ::= */ + 453, /* (325) table_kind_db_name_cond_opt ::= table_kind */ + 453, /* (326) table_kind_db_name_cond_opt ::= db_name NK_DOT */ + 453, /* (327) table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */ + 458, /* (328) table_kind ::= NORMAL */ + 458, /* (329) table_kind ::= CHILD */ + 455, /* (330) db_name_cond_opt ::= */ + 455, /* (331) db_name_cond_opt ::= db_name NK_DOT */ + 454, /* (332) like_pattern_opt ::= */ + 454, /* (333) like_pattern_opt ::= LIKE NK_STRING */ + 456, /* (334) table_name_cond ::= table_name */ + 457, /* (335) from_db_opt ::= */ + 457, /* (336) from_db_opt ::= FROM db_name */ + 426, /* (337) tag_list_opt ::= */ + 426, /* (338) tag_list_opt ::= tag_item */ + 426, /* (339) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ + 459, /* (340) tag_item ::= TBNAME */ + 459, /* (341) tag_item ::= QTAGS */ + 459, /* (342) tag_item ::= column_name */ + 459, /* (343) tag_item ::= column_name column_alias */ + 459, /* (344) tag_item ::= column_name AS column_alias */ + 452, /* (345) db_kind_opt ::= */ + 452, /* (346) db_kind_opt ::= USER */ + 452, /* (347) db_kind_opt ::= SYSTEM */ + 384, /* (348) cmd ::= CREATE TSMA not_exists_opt tsma_name ON full_table_name tsma_func_list INTERVAL NK_LP duration_literal NK_RP */ + 384, /* (349) cmd ::= CREATE RECURSIVE TSMA not_exists_opt tsma_name ON full_table_name INTERVAL NK_LP duration_literal NK_RP */ + 384, /* (350) cmd ::= DROP TSMA exists_opt full_tsma_name */ + 384, /* (351) cmd ::= SHOW db_name_cond_opt TSMAS */ + 463, /* (352) full_tsma_name ::= tsma_name */ + 463, /* (353) full_tsma_name ::= db_name NK_DOT tsma_name */ + 462, /* (354) tsma_func_list ::= FUNCTION NK_LP func_list NK_RP */ + 384, /* (355) cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */ + 384, /* (356) cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */ + 384, /* (357) cmd ::= DROP INDEX exists_opt full_index_name */ + 466, /* (358) full_index_name ::= index_name */ + 466, /* (359) full_index_name ::= db_name NK_DOT index_name */ + 465, /* (360) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ + 465, /* (361) 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 */ + 464, /* (362) func_list ::= func */ + 464, /* (363) func_list ::= func_list NK_COMMA func */ + 470, /* (364) func ::= sma_func_name NK_LP expression_list NK_RP */ + 471, /* (365) sma_func_name ::= function_name */ + 471, /* (366) sma_func_name ::= COUNT */ + 471, /* (367) sma_func_name ::= FIRST */ + 471, /* (368) sma_func_name ::= LAST */ + 471, /* (369) sma_func_name ::= LAST_ROW */ + 469, /* (370) sma_stream_opt ::= */ + 469, /* (371) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ + 469, /* (372) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ + 469, /* (373) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ + 473, /* (374) with_meta ::= AS */ + 473, /* (375) with_meta ::= WITH META AS */ + 473, /* (376) with_meta ::= ONLY META AS */ + 384, /* (377) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ + 384, /* (378) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ + 384, /* (379) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ + 384, /* (380) cmd ::= DROP TOPIC exists_opt topic_name */ + 384, /* (381) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ + 384, /* (382) cmd ::= DESC full_table_name */ + 384, /* (383) cmd ::= DESCRIBE full_table_name */ + 384, /* (384) cmd ::= RESET QUERY CACHE */ + 384, /* (385) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ + 384, /* (386) cmd ::= EXPLAIN analyze_opt explain_options insert_query */ + 477, /* (387) analyze_opt ::= */ + 477, /* (388) analyze_opt ::= ANALYZE */ + 478, /* (389) explain_options ::= */ + 478, /* (390) explain_options ::= explain_options VERBOSE NK_BOOL */ + 478, /* (391) explain_options ::= explain_options RATIO NK_FLOAT */ + 384, /* (392) cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ + 384, /* (393) cmd ::= DROP FUNCTION exists_opt function_name */ + 481, /* (394) agg_func_opt ::= */ + 481, /* (395) agg_func_opt ::= AGGREGATE */ + 482, /* (396) bufsize_opt ::= */ + 482, /* (397) bufsize_opt ::= BUFSIZE NK_INTEGER */ + 483, /* (398) language_opt ::= */ + 483, /* (399) language_opt ::= LANGUAGE NK_STRING */ + 480, /* (400) or_replace_opt ::= */ + 480, /* (401) or_replace_opt ::= OR REPLACE */ + 384, /* (402) cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */ + 384, /* (403) cmd ::= DROP VIEW exists_opt full_view_name */ + 484, /* (404) full_view_name ::= view_name */ + 484, /* (405) full_view_name ::= db_name NK_DOT view_name */ + 384, /* (406) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */ + 384, /* (407) cmd ::= DROP STREAM exists_opt stream_name */ + 384, /* (408) cmd ::= PAUSE STREAM exists_opt stream_name */ + 384, /* (409) cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ + 488, /* (410) col_list_opt ::= */ + 488, /* (411) col_list_opt ::= NK_LP column_stream_def_list NK_RP */ + 492, /* (412) column_stream_def_list ::= column_stream_def */ + 492, /* (413) column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def */ + 493, /* (414) column_stream_def ::= column_name stream_col_options */ + 494, /* (415) stream_col_options ::= */ + 494, /* (416) stream_col_options ::= stream_col_options PRIMARY KEY */ + 489, /* (417) tag_def_or_ref_opt ::= */ + 489, /* (418) tag_def_or_ref_opt ::= tags_def */ + 489, /* (419) tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP */ + 487, /* (420) stream_options ::= */ + 487, /* (421) stream_options ::= stream_options TRIGGER AT_ONCE */ + 487, /* (422) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ + 487, /* (423) stream_options ::= stream_options TRIGGER FORCE_WINDOW_CLOSE */ + 487, /* (424) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ + 487, /* (425) stream_options ::= stream_options WATERMARK duration_literal */ + 487, /* (426) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ + 487, /* (427) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ + 487, /* (428) stream_options ::= stream_options DELETE_MARK duration_literal */ + 487, /* (429) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ + 490, /* (430) subtable_opt ::= */ + 490, /* (431) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + 491, /* (432) ignore_opt ::= */ + 491, /* (433) ignore_opt ::= IGNORE UNTREATED */ + 384, /* (434) cmd ::= KILL CONNECTION NK_INTEGER */ + 384, /* (435) cmd ::= KILL QUERY NK_STRING */ + 384, /* (436) cmd ::= KILL TRANSACTION NK_INTEGER */ + 384, /* (437) cmd ::= KILL COMPACT NK_INTEGER */ + 384, /* (438) cmd ::= BALANCE VGROUP */ + 384, /* (439) cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ + 384, /* (440) cmd ::= BALANCE VGROUP LEADER DATABASE db_name */ + 384, /* (441) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + 384, /* (442) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ + 384, /* (443) cmd ::= SPLIT VGROUP NK_INTEGER */ + 496, /* (444) on_vgroup_id ::= */ + 496, /* (445) on_vgroup_id ::= ON NK_INTEGER */ + 497, /* (446) dnode_list ::= DNODE NK_INTEGER */ + 497, /* (447) dnode_list ::= dnode_list DNODE NK_INTEGER */ + 384, /* (448) cmd ::= DELETE FROM full_table_name where_clause_opt */ + 384, /* (449) cmd ::= query_or_subquery */ + 384, /* (450) cmd ::= insert_query */ + 479, /* (451) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ + 479, /* (452) insert_query ::= INSERT INTO full_table_name query_or_subquery */ + 435, /* (453) tags_literal ::= NK_INTEGER */ + 435, /* (454) tags_literal ::= NK_INTEGER NK_PLUS duration_literal */ + 435, /* (455) tags_literal ::= NK_INTEGER NK_MINUS duration_literal */ + 435, /* (456) tags_literal ::= NK_PLUS NK_INTEGER */ + 435, /* (457) tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal */ + 435, /* (458) tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal */ + 435, /* (459) tags_literal ::= NK_MINUS NK_INTEGER */ + 435, /* (460) tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal */ + 435, /* (461) tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal */ + 435, /* (462) tags_literal ::= NK_FLOAT */ + 435, /* (463) tags_literal ::= NK_PLUS NK_FLOAT */ + 435, /* (464) tags_literal ::= NK_MINUS NK_FLOAT */ + 435, /* (465) tags_literal ::= NK_BIN */ + 435, /* (466) tags_literal ::= NK_BIN NK_PLUS duration_literal */ + 435, /* (467) tags_literal ::= NK_BIN NK_MINUS duration_literal */ + 435, /* (468) tags_literal ::= NK_PLUS NK_BIN */ + 435, /* (469) tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal */ + 435, /* (470) tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal */ + 435, /* (471) tags_literal ::= NK_MINUS NK_BIN */ + 435, /* (472) tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal */ + 435, /* (473) tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal */ + 435, /* (474) tags_literal ::= NK_HEX */ + 435, /* (475) tags_literal ::= NK_HEX NK_PLUS duration_literal */ + 435, /* (476) tags_literal ::= NK_HEX NK_MINUS duration_literal */ + 435, /* (477) tags_literal ::= NK_PLUS NK_HEX */ + 435, /* (478) tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal */ + 435, /* (479) tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal */ + 435, /* (480) tags_literal ::= NK_MINUS NK_HEX */ + 435, /* (481) tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal */ + 435, /* (482) tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal */ + 435, /* (483) tags_literal ::= NK_STRING */ + 435, /* (484) tags_literal ::= NK_STRING NK_PLUS duration_literal */ + 435, /* (485) tags_literal ::= NK_STRING NK_MINUS duration_literal */ + 435, /* (486) tags_literal ::= NK_BOOL */ + 435, /* (487) tags_literal ::= NULL */ + 435, /* (488) tags_literal ::= literal_func */ + 435, /* (489) tags_literal ::= literal_func NK_PLUS duration_literal */ + 435, /* (490) tags_literal ::= literal_func NK_MINUS duration_literal */ + 438, /* (491) tags_literal_list ::= tags_literal */ + 438, /* (492) tags_literal_list ::= tags_literal_list NK_COMMA tags_literal */ + 387, /* (493) literal ::= NK_INTEGER */ + 387, /* (494) literal ::= NK_FLOAT */ + 387, /* (495) literal ::= NK_STRING */ + 387, /* (496) literal ::= NK_BOOL */ + 387, /* (497) literal ::= TIMESTAMP NK_STRING */ + 387, /* (498) literal ::= duration_literal */ + 387, /* (499) literal ::= NULL */ + 387, /* (500) literal ::= NK_QUESTION */ + 448, /* (501) duration_literal ::= NK_VARIABLE */ + 418, /* (502) signed ::= NK_INTEGER */ + 418, /* (503) signed ::= NK_PLUS NK_INTEGER */ + 418, /* (504) signed ::= NK_MINUS NK_INTEGER */ + 418, /* (505) signed ::= NK_FLOAT */ + 418, /* (506) signed ::= NK_PLUS NK_FLOAT */ + 418, /* (507) signed ::= NK_MINUS NK_FLOAT */ + 499, /* (508) signed_literal ::= signed */ + 499, /* (509) signed_literal ::= NK_STRING */ + 499, /* (510) signed_literal ::= NK_BOOL */ + 499, /* (511) signed_literal ::= TIMESTAMP NK_STRING */ + 499, /* (512) signed_literal ::= duration_literal */ + 499, /* (513) signed_literal ::= NULL */ + 499, /* (514) signed_literal ::= literal_func */ + 499, /* (515) signed_literal ::= NK_QUESTION */ + 500, /* (516) literal_list ::= signed_literal */ + 500, /* (517) literal_list ::= literal_list NK_COMMA signed_literal */ + 401, /* (518) db_name ::= NK_ID */ + 402, /* (519) table_name ::= NK_ID */ + 432, /* (520) column_name ::= NK_ID */ + 450, /* (521) function_name ::= NK_ID */ + 485, /* (522) view_name ::= NK_ID */ + 501, /* (523) table_alias ::= NK_ID */ + 460, /* (524) column_alias ::= NK_ID */ + 460, /* (525) column_alias ::= NK_ALIAS */ + 394, /* (526) user_name ::= NK_ID */ + 403, /* (527) topic_name ::= NK_ID */ + 486, /* (528) stream_name ::= NK_ID */ + 476, /* (529) cgroup_name ::= NK_ID */ + 467, /* (530) index_name ::= NK_ID */ + 461, /* (531) tsma_name ::= NK_ID */ + 502, /* (532) expr_or_subquery ::= expression */ + 495, /* (533) expression ::= literal */ + 495, /* (534) expression ::= pseudo_column */ + 495, /* (535) expression ::= column_reference */ + 495, /* (536) expression ::= function_expression */ + 495, /* (537) expression ::= case_when_expression */ + 495, /* (538) expression ::= NK_LP expression NK_RP */ + 495, /* (539) expression ::= NK_PLUS expr_or_subquery */ + 495, /* (540) expression ::= NK_MINUS expr_or_subquery */ + 495, /* (541) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ + 495, /* (542) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ + 495, /* (543) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ + 495, /* (544) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ + 495, /* (545) expression ::= expr_or_subquery NK_REM expr_or_subquery */ + 495, /* (546) expression ::= column_reference NK_ARROW NK_STRING */ + 495, /* (547) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ + 495, /* (548) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ + 472, /* (549) expression_list ::= expr_or_subquery */ + 472, /* (550) expression_list ::= expression_list NK_COMMA expr_or_subquery */ + 504, /* (551) column_reference ::= column_name */ + 504, /* (552) column_reference ::= table_name NK_DOT column_name */ + 504, /* (553) column_reference ::= NK_ALIAS */ + 504, /* (554) column_reference ::= table_name NK_DOT NK_ALIAS */ + 503, /* (555) pseudo_column ::= ROWTS */ + 503, /* (556) pseudo_column ::= TBNAME */ + 503, /* (557) pseudo_column ::= table_name NK_DOT TBNAME */ + 503, /* (558) pseudo_column ::= QSTART */ + 503, /* (559) pseudo_column ::= QEND */ + 503, /* (560) pseudo_column ::= QDURATION */ + 503, /* (561) pseudo_column ::= WSTART */ + 503, /* (562) pseudo_column ::= WEND */ + 503, /* (563) pseudo_column ::= WDURATION */ + 503, /* (564) pseudo_column ::= IROWTS */ + 503, /* (565) pseudo_column ::= ISFILLED */ + 503, /* (566) pseudo_column ::= QTAGS */ + 505, /* (567) function_expression ::= function_name NK_LP expression_list NK_RP */ + 505, /* (568) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ + 505, /* (569) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ + 505, /* (570) function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP */ + 505, /* (571) function_expression ::= POSITION NK_LP expr_or_subquery IN expr_or_subquery NK_RP */ + 505, /* (572) function_expression ::= TRIM NK_LP expr_or_subquery NK_RP */ + 505, /* (573) function_expression ::= TRIM NK_LP trim_specification_type FROM expr_or_subquery NK_RP */ + 505, /* (574) function_expression ::= TRIM NK_LP expr_or_subquery FROM expr_or_subquery NK_RP */ + 505, /* (575) function_expression ::= TRIM NK_LP trim_specification_type expr_or_subquery FROM expr_or_subquery NK_RP */ + 505, /* (576) function_expression ::= substr_func NK_LP expression_list NK_RP */ + 505, /* (577) function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery NK_RP */ + 505, /* (578) function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery FOR expr_or_subquery NK_RP */ + 505, /* (579) function_expression ::= REPLACE NK_LP expression_list NK_RP */ + 505, /* (580) function_expression ::= literal_func */ + 505, /* (581) function_expression ::= rand_func */ + 498, /* (582) literal_func ::= noarg_func NK_LP NK_RP */ + 498, /* (583) literal_func ::= NOW */ + 498, /* (584) literal_func ::= TODAY */ + 511, /* (585) rand_func ::= RAND NK_LP NK_RP */ + 511, /* (586) rand_func ::= RAND NK_LP expression_list NK_RP */ + 510, /* (587) substr_func ::= SUBSTR */ + 510, /* (588) substr_func ::= SUBSTRING */ + 509, /* (589) trim_specification_type ::= BOTH */ + 509, /* (590) trim_specification_type ::= TRAILING */ + 509, /* (591) trim_specification_type ::= LEADING */ + 512, /* (592) noarg_func ::= NOW */ + 512, /* (593) noarg_func ::= TODAY */ + 512, /* (594) noarg_func ::= TIMEZONE */ + 512, /* (595) noarg_func ::= DATABASE */ + 512, /* (596) noarg_func ::= CLIENT_VERSION */ + 512, /* (597) noarg_func ::= SERVER_VERSION */ + 512, /* (598) noarg_func ::= SERVER_STATUS */ + 512, /* (599) noarg_func ::= CURRENT_USER */ + 512, /* (600) noarg_func ::= USER */ + 512, /* (601) noarg_func ::= PI */ + 507, /* (602) star_func ::= COUNT */ + 507, /* (603) star_func ::= FIRST */ + 507, /* (604) star_func ::= LAST */ + 507, /* (605) star_func ::= LAST_ROW */ + 508, /* (606) star_func_para_list ::= NK_STAR */ + 508, /* (607) star_func_para_list ::= other_para_list */ + 513, /* (608) other_para_list ::= star_func_para */ + 513, /* (609) other_para_list ::= other_para_list NK_COMMA star_func_para */ + 514, /* (610) star_func_para ::= expr_or_subquery */ + 514, /* (611) star_func_para ::= table_name NK_DOT NK_STAR */ + 506, /* (612) case_when_expression ::= CASE when_then_list case_when_else_opt END */ + 506, /* (613) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ + 515, /* (614) when_then_list ::= when_then_expr */ + 515, /* (615) when_then_list ::= when_then_list when_then_expr */ + 518, /* (616) when_then_expr ::= WHEN common_expression THEN common_expression */ + 516, /* (617) case_when_else_opt ::= */ + 516, /* (618) case_when_else_opt ::= ELSE common_expression */ + 519, /* (619) predicate ::= expr_or_subquery compare_op expr_or_subquery */ + 519, /* (620) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ + 519, /* (621) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ + 519, /* (622) predicate ::= expr_or_subquery IS NULL */ + 519, /* (623) predicate ::= expr_or_subquery IS NOT NULL */ + 519, /* (624) predicate ::= expr_or_subquery in_op in_predicate_value */ + 520, /* (625) compare_op ::= NK_LT */ + 520, /* (626) compare_op ::= NK_GT */ + 520, /* (627) compare_op ::= NK_LE */ + 520, /* (628) compare_op ::= NK_GE */ + 520, /* (629) compare_op ::= NK_NE */ + 520, /* (630) compare_op ::= NK_EQ */ + 520, /* (631) compare_op ::= LIKE */ + 520, /* (632) compare_op ::= NOT LIKE */ + 520, /* (633) compare_op ::= MATCH */ + 520, /* (634) compare_op ::= NMATCH */ + 520, /* (635) compare_op ::= CONTAINS */ + 521, /* (636) in_op ::= IN */ + 521, /* (637) in_op ::= NOT IN */ + 522, /* (638) in_predicate_value ::= NK_LP literal_list NK_RP */ + 523, /* (639) boolean_value_expression ::= boolean_primary */ + 523, /* (640) boolean_value_expression ::= NOT boolean_primary */ + 523, /* (641) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + 523, /* (642) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + 524, /* (643) boolean_primary ::= predicate */ + 524, /* (644) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ + 517, /* (645) common_expression ::= expr_or_subquery */ + 517, /* (646) common_expression ::= boolean_value_expression */ + 525, /* (647) from_clause_opt ::= */ + 525, /* (648) from_clause_opt ::= FROM table_reference_list */ + 526, /* (649) table_reference_list ::= table_reference */ + 526, /* (650) table_reference_list ::= table_reference_list NK_COMMA table_reference */ + 527, /* (651) table_reference ::= table_primary */ + 527, /* (652) table_reference ::= joined_table */ + 528, /* (653) table_primary ::= table_name alias_opt */ + 528, /* (654) table_primary ::= db_name NK_DOT table_name alias_opt */ + 528, /* (655) table_primary ::= subquery alias_opt */ + 528, /* (656) table_primary ::= parenthesized_joined_table */ + 530, /* (657) alias_opt ::= */ + 530, /* (658) alias_opt ::= table_alias */ + 530, /* (659) alias_opt ::= AS table_alias */ + 532, /* (660) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + 532, /* (661) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ + 529, /* (662) joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt */ + 533, /* (663) join_type ::= */ + 533, /* (664) join_type ::= INNER */ + 533, /* (665) join_type ::= LEFT */ + 533, /* (666) join_type ::= RIGHT */ + 533, /* (667) join_type ::= FULL */ + 534, /* (668) join_subtype ::= */ + 534, /* (669) join_subtype ::= OUTER */ + 534, /* (670) join_subtype ::= SEMI */ + 534, /* (671) join_subtype ::= ANTI */ + 534, /* (672) join_subtype ::= ASOF */ + 534, /* (673) join_subtype ::= WINDOW */ + 535, /* (674) join_on_clause_opt ::= */ + 535, /* (675) join_on_clause_opt ::= ON search_condition */ + 536, /* (676) window_offset_clause_opt ::= */ + 536, /* (677) window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP */ + 538, /* (678) window_offset_literal ::= NK_VARIABLE */ + 538, /* (679) window_offset_literal ::= NK_MINUS NK_VARIABLE */ + 537, /* (680) jlimit_clause_opt ::= */ + 537, /* (681) jlimit_clause_opt ::= JLIMIT NK_INTEGER */ + 539, /* (682) query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_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 */ + 540, /* (683) hint_list ::= */ + 540, /* (684) hint_list ::= NK_HINT */ + 542, /* (685) tag_mode_opt ::= */ + 542, /* (686) tag_mode_opt ::= TAGS */ + 541, /* (687) set_quantifier_opt ::= */ + 541, /* (688) set_quantifier_opt ::= DISTINCT */ + 541, /* (689) set_quantifier_opt ::= ALL */ + 543, /* (690) select_list ::= select_item */ + 543, /* (691) select_list ::= select_list NK_COMMA select_item */ + 551, /* (692) select_item ::= NK_STAR */ + 551, /* (693) select_item ::= common_expression */ + 551, /* (694) select_item ::= common_expression column_alias */ + 551, /* (695) select_item ::= common_expression AS column_alias */ + 551, /* (696) select_item ::= table_name NK_DOT NK_STAR */ + 475, /* (697) where_clause_opt ::= */ + 475, /* (698) where_clause_opt ::= WHERE search_condition */ + 544, /* (699) partition_by_clause_opt ::= */ + 544, /* (700) partition_by_clause_opt ::= PARTITION BY partition_list */ + 552, /* (701) partition_list ::= partition_item */ + 552, /* (702) partition_list ::= partition_list NK_COMMA partition_item */ + 553, /* (703) partition_item ::= expr_or_subquery */ + 553, /* (704) partition_item ::= expr_or_subquery column_alias */ + 553, /* (705) partition_item ::= expr_or_subquery AS column_alias */ + 548, /* (706) twindow_clause_opt ::= */ + 548, /* (707) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ + 548, /* (708) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ + 548, /* (709) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ + 548, /* (710) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ + 548, /* (711) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ + 548, /* (712) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */ + 548, /* (713) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + 468, /* (714) sliding_opt ::= */ + 468, /* (715) sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ + 554, /* (716) interval_sliding_duration_literal ::= NK_VARIABLE */ + 554, /* (717) interval_sliding_duration_literal ::= NK_STRING */ + 554, /* (718) interval_sliding_duration_literal ::= NK_INTEGER */ + 547, /* (719) fill_opt ::= */ + 547, /* (720) fill_opt ::= FILL NK_LP fill_mode NK_RP */ + 547, /* (721) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ + 547, /* (722) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ + 555, /* (723) fill_mode ::= NONE */ + 555, /* (724) fill_mode ::= PREV */ + 555, /* (725) fill_mode ::= NULL */ + 555, /* (726) fill_mode ::= NULL_F */ + 555, /* (727) fill_mode ::= LINEAR */ + 555, /* (728) fill_mode ::= NEXT */ + 549, /* (729) group_by_clause_opt ::= */ + 549, /* (730) group_by_clause_opt ::= GROUP BY group_by_list */ + 556, /* (731) group_by_list ::= expr_or_subquery */ + 556, /* (732) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ + 550, /* (733) having_clause_opt ::= */ + 550, /* (734) having_clause_opt ::= HAVING search_condition */ + 545, /* (735) range_opt ::= */ + 545, /* (736) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ + 545, /* (737) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ + 546, /* (738) every_opt ::= */ + 546, /* (739) every_opt ::= EVERY NK_LP duration_literal NK_RP */ + 557, /* (740) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ + 558, /* (741) query_simple ::= query_specification */ + 558, /* (742) query_simple ::= union_query_expression */ + 562, /* (743) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ + 562, /* (744) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ + 563, /* (745) query_simple_or_subquery ::= query_simple */ + 563, /* (746) query_simple_or_subquery ::= subquery */ + 474, /* (747) query_or_subquery ::= query_expression */ + 474, /* (748) query_or_subquery ::= subquery */ + 559, /* (749) order_by_clause_opt ::= */ + 559, /* (750) order_by_clause_opt ::= ORDER BY sort_specification_list */ + 560, /* (751) slimit_clause_opt ::= */ + 560, /* (752) slimit_clause_opt ::= SLIMIT NK_INTEGER */ + 560, /* (753) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + 560, /* (754) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + 561, /* (755) limit_clause_opt ::= */ + 561, /* (756) limit_clause_opt ::= LIMIT NK_INTEGER */ + 561, /* (757) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ + 561, /* (758) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + 531, /* (759) subquery ::= NK_LP query_expression NK_RP */ + 531, /* (760) subquery ::= NK_LP subquery NK_RP */ + 404, /* (761) search_condition ::= common_expression */ + 564, /* (762) sort_specification_list ::= sort_specification */ + 564, /* (763) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ + 565, /* (764) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ + 566, /* (765) ordering_specification_opt ::= */ + 566, /* (766) ordering_specification_opt ::= ASC */ + 566, /* (767) ordering_specification_opt ::= DESC */ + 567, /* (768) null_ordering_opt ::= */ + 567, /* (769) null_ordering_opt ::= NULLS FIRST */ + 567, /* (770) null_ordering_opt ::= NULLS LAST */ + 434, /* (771) column_options ::= */ + 434, /* (772) column_options ::= column_options PRIMARY KEY */ + 434, /* (773) column_options ::= column_options NK_ID NK_STRING */ }; /* For rule J, yyRuleInfoNRhs[J] contains the negative of the number @@ -5177,8 +5124,8 @@ static const signed char yyRuleInfoNRhs[] = { -3, /* (40) cmd ::= DROP USER user_name */ 0, /* (41) sysinfo_opt ::= */ -2, /* (42) sysinfo_opt ::= SYSINFO NK_INTEGER */ - -7, /* (43) cmd ::= GRANT privileges ON priv_level with_opt TO user_name */ - -7, /* (44) cmd ::= REVOKE privileges ON priv_level with_opt FROM user_name */ + -7, /* (43) cmd ::= GRANT privileges ON priv_level with_clause_opt TO user_name */ + -7, /* (44) cmd ::= REVOKE privileges ON priv_level with_clause_opt FROM user_name */ -1, /* (45) privileges ::= ALL */ -1, /* (46) privileges ::= priv_type_list */ -1, /* (47) privileges ::= SUBSCRIBE */ @@ -5191,8 +5138,8 @@ static const signed char yyRuleInfoNRhs[] = { -3, /* (54) priv_level ::= db_name NK_DOT NK_STAR */ -3, /* (55) priv_level ::= db_name NK_DOT table_name */ -1, /* (56) priv_level ::= topic_name */ - 0, /* (57) with_opt ::= */ - -2, /* (58) with_opt ::= WITH search_condition */ + 0, /* (57) with_clause_opt ::= */ + -2, /* (58) with_clause_opt ::= WITH search_condition */ -3, /* (59) cmd ::= CREATE ENCRYPT_KEY NK_STRING */ -3, /* (60) cmd ::= CREATE DNODE dnode_endpoint */ -5, /* (61) cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ @@ -5319,8 +5266,8 @@ static const signed char yyRuleInfoNRhs[] = { -3, /* (182) cmd ::= CREATE TABLE multi_create_clause */ -10, /* (183) cmd ::= CREATE TABLE not_exists_opt USING full_table_name NK_LP tag_list_opt NK_RP FILE NK_STRING */ -9, /* (184) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ - -3, /* (185) cmd ::= DROP TABLE multi_drop_clause */ - -4, /* (186) cmd ::= DROP STABLE exists_opt full_table_name */ + -4, /* (185) cmd ::= DROP TABLE with_opt multi_drop_clause */ + -5, /* (186) cmd ::= DROP STABLE with_opt exists_opt full_table_name */ -3, /* (187) cmd ::= ALTER TABLE alter_table_clause */ -3, /* (188) cmd ::= ALTER STABLE alter_table_clause */ -2, /* (189) alter_table_clause ::= full_table_name alter_table_options */ @@ -5340,572 +5287,574 @@ static const signed char yyRuleInfoNRhs[] = { -1, /* (203) multi_drop_clause ::= drop_table_clause */ -3, /* (204) multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ -2, /* (205) drop_table_clause ::= exists_opt full_table_name */ - 0, /* (206) specific_cols_opt ::= */ - -3, /* (207) specific_cols_opt ::= NK_LP col_name_list NK_RP */ - -1, /* (208) full_table_name ::= table_name */ - -3, /* (209) full_table_name ::= db_name NK_DOT table_name */ - -1, /* (210) tag_def_list ::= tag_def */ - -3, /* (211) tag_def_list ::= tag_def_list NK_COMMA tag_def */ - -2, /* (212) tag_def ::= column_name type_name */ - -1, /* (213) column_def_list ::= column_def */ - -3, /* (214) column_def_list ::= column_def_list NK_COMMA column_def */ - -3, /* (215) column_def ::= column_name type_name column_options */ - -1, /* (216) type_name ::= BOOL */ - -1, /* (217) type_name ::= TINYINT */ - -1, /* (218) type_name ::= SMALLINT */ - -1, /* (219) type_name ::= INT */ - -1, /* (220) type_name ::= INTEGER */ - -1, /* (221) type_name ::= BIGINT */ - -1, /* (222) type_name ::= FLOAT */ - -1, /* (223) type_name ::= DOUBLE */ - -4, /* (224) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ - -1, /* (225) type_name ::= TIMESTAMP */ - -4, /* (226) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ - -2, /* (227) type_name ::= TINYINT UNSIGNED */ - -2, /* (228) type_name ::= SMALLINT UNSIGNED */ - -2, /* (229) type_name ::= INT UNSIGNED */ - -2, /* (230) type_name ::= BIGINT UNSIGNED */ - -1, /* (231) type_name ::= JSON */ - -4, /* (232) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ - -1, /* (233) type_name ::= MEDIUMBLOB */ - -1, /* (234) type_name ::= BLOB */ - -4, /* (235) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ - -4, /* (236) type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ - -1, /* (237) type_name ::= DECIMAL */ - -4, /* (238) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ - -6, /* (239) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - -1, /* (240) type_name_default_len ::= BINARY */ - -1, /* (241) type_name_default_len ::= NCHAR */ - -1, /* (242) type_name_default_len ::= VARCHAR */ - -1, /* (243) type_name_default_len ::= VARBINARY */ - 0, /* (244) tags_def_opt ::= */ - -1, /* (245) tags_def_opt ::= tags_def */ - -4, /* (246) tags_def ::= TAGS NK_LP tag_def_list NK_RP */ - 0, /* (247) table_options ::= */ - -3, /* (248) table_options ::= table_options COMMENT NK_STRING */ - -3, /* (249) table_options ::= table_options MAX_DELAY duration_list */ - -3, /* (250) table_options ::= table_options WATERMARK duration_list */ - -5, /* (251) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ - -3, /* (252) table_options ::= table_options TTL NK_INTEGER */ - -5, /* (253) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ - -3, /* (254) table_options ::= table_options DELETE_MARK duration_list */ - -1, /* (255) alter_table_options ::= alter_table_option */ - -2, /* (256) alter_table_options ::= alter_table_options alter_table_option */ - -2, /* (257) alter_table_option ::= COMMENT NK_STRING */ - -2, /* (258) alter_table_option ::= TTL NK_INTEGER */ - -1, /* (259) duration_list ::= duration_literal */ - -3, /* (260) duration_list ::= duration_list NK_COMMA duration_literal */ - -1, /* (261) rollup_func_list ::= rollup_func_name */ - -3, /* (262) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ - -1, /* (263) rollup_func_name ::= function_name */ - -1, /* (264) rollup_func_name ::= FIRST */ - -1, /* (265) rollup_func_name ::= LAST */ - -1, /* (266) col_name_list ::= col_name */ - -3, /* (267) col_name_list ::= col_name_list NK_COMMA col_name */ - -1, /* (268) col_name ::= column_name */ - -2, /* (269) cmd ::= SHOW DNODES */ - -2, /* (270) cmd ::= SHOW USERS */ - -3, /* (271) cmd ::= SHOW USERS FULL */ - -3, /* (272) cmd ::= SHOW USER PRIVILEGES */ - -3, /* (273) cmd ::= SHOW db_kind_opt DATABASES */ - -4, /* (274) cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */ - -4, /* (275) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ - -3, /* (276) cmd ::= SHOW db_name_cond_opt VGROUPS */ - -2, /* (277) cmd ::= SHOW MNODES */ - -2, /* (278) cmd ::= SHOW QNODES */ - -2, /* (279) cmd ::= SHOW ARBGROUPS */ - -2, /* (280) cmd ::= SHOW FUNCTIONS */ - -5, /* (281) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ - -6, /* (282) cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ - -2, /* (283) cmd ::= SHOW STREAMS */ - -2, /* (284) cmd ::= SHOW ACCOUNTS */ - -2, /* (285) cmd ::= SHOW APPS */ - -2, /* (286) cmd ::= SHOW CONNECTIONS */ - -2, /* (287) cmd ::= SHOW LICENCES */ - -2, /* (288) cmd ::= SHOW GRANTS */ - -3, /* (289) cmd ::= SHOW GRANTS FULL */ - -3, /* (290) cmd ::= SHOW GRANTS LOGS */ - -3, /* (291) cmd ::= SHOW CLUSTER MACHINES */ - -4, /* (292) cmd ::= SHOW CREATE DATABASE db_name */ - -4, /* (293) cmd ::= SHOW CREATE TABLE full_table_name */ - -4, /* (294) cmd ::= SHOW CREATE STABLE full_table_name */ - -2, /* (295) cmd ::= SHOW ENCRYPTIONS */ - -2, /* (296) cmd ::= SHOW QUERIES */ - -2, /* (297) cmd ::= SHOW SCORES */ - -2, /* (298) cmd ::= SHOW TOPICS */ - -2, /* (299) cmd ::= SHOW VARIABLES */ - -3, /* (300) cmd ::= SHOW CLUSTER VARIABLES */ - -3, /* (301) cmd ::= SHOW LOCAL VARIABLES */ - -5, /* (302) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ - -2, /* (303) cmd ::= SHOW BNODES */ - -2, /* (304) cmd ::= SHOW SNODES */ - -2, /* (305) cmd ::= SHOW CLUSTER */ - -2, /* (306) cmd ::= SHOW TRANSACTIONS */ - -4, /* (307) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ - -2, /* (308) cmd ::= SHOW CONSUMERS */ - -2, /* (309) cmd ::= SHOW SUBSCRIPTIONS */ - -5, /* (310) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ - -6, /* (311) cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ - -7, /* (312) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ - -8, /* (313) cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ - -5, /* (314) cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ - -2, /* (315) cmd ::= SHOW VNODES */ - -3, /* (316) cmd ::= SHOW db_name_cond_opt ALIVE */ - -3, /* (317) cmd ::= SHOW CLUSTER ALIVE */ - -4, /* (318) cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt */ - -4, /* (319) cmd ::= SHOW CREATE VIEW full_table_name */ - -2, /* (320) cmd ::= SHOW COMPACTS */ - -3, /* (321) cmd ::= SHOW COMPACT NK_INTEGER */ - 0, /* (322) table_kind_db_name_cond_opt ::= */ - -1, /* (323) table_kind_db_name_cond_opt ::= table_kind */ - -2, /* (324) table_kind_db_name_cond_opt ::= db_name NK_DOT */ - -3, /* (325) table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */ - -1, /* (326) table_kind ::= NORMAL */ - -1, /* (327) table_kind ::= CHILD */ - 0, /* (328) db_name_cond_opt ::= */ - -2, /* (329) db_name_cond_opt ::= db_name NK_DOT */ - 0, /* (330) like_pattern_opt ::= */ - -2, /* (331) like_pattern_opt ::= LIKE NK_STRING */ - -1, /* (332) table_name_cond ::= table_name */ - 0, /* (333) from_db_opt ::= */ - -2, /* (334) from_db_opt ::= FROM db_name */ - 0, /* (335) tag_list_opt ::= */ - -1, /* (336) tag_list_opt ::= tag_item */ - -3, /* (337) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ - -1, /* (338) tag_item ::= TBNAME */ - -1, /* (339) tag_item ::= QTAGS */ - -1, /* (340) tag_item ::= column_name */ - -2, /* (341) tag_item ::= column_name column_alias */ - -3, /* (342) tag_item ::= column_name AS column_alias */ - 0, /* (343) db_kind_opt ::= */ - -1, /* (344) db_kind_opt ::= USER */ - -1, /* (345) db_kind_opt ::= SYSTEM */ - -11, /* (346) cmd ::= CREATE TSMA not_exists_opt tsma_name ON full_table_name tsma_func_list INTERVAL NK_LP duration_literal NK_RP */ - -11, /* (347) cmd ::= CREATE RECURSIVE TSMA not_exists_opt tsma_name ON full_table_name INTERVAL NK_LP duration_literal NK_RP */ - -4, /* (348) cmd ::= DROP TSMA exists_opt full_tsma_name */ - -3, /* (349) cmd ::= SHOW db_name_cond_opt TSMAS */ - -1, /* (350) full_tsma_name ::= tsma_name */ - -3, /* (351) full_tsma_name ::= db_name NK_DOT tsma_name */ - -4, /* (352) tsma_func_list ::= FUNCTION NK_LP func_list NK_RP */ - -8, /* (353) cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */ - -9, /* (354) cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */ - -4, /* (355) cmd ::= DROP INDEX exists_opt full_index_name */ - -1, /* (356) full_index_name ::= index_name */ - -3, /* (357) full_index_name ::= db_name NK_DOT index_name */ - -10, /* (358) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ - -12, /* (359) 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 */ - -1, /* (360) func_list ::= func */ - -3, /* (361) func_list ::= func_list NK_COMMA func */ - -4, /* (362) func ::= sma_func_name NK_LP expression_list NK_RP */ - -1, /* (363) sma_func_name ::= function_name */ - -1, /* (364) sma_func_name ::= COUNT */ - -1, /* (365) sma_func_name ::= FIRST */ - -1, /* (366) sma_func_name ::= LAST */ - -1, /* (367) sma_func_name ::= LAST_ROW */ - 0, /* (368) sma_stream_opt ::= */ - -3, /* (369) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ - -3, /* (370) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ - -3, /* (371) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ - -1, /* (372) with_meta ::= AS */ - -3, /* (373) with_meta ::= WITH META AS */ - -3, /* (374) with_meta ::= ONLY META AS */ - -6, /* (375) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ - -7, /* (376) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ - -8, /* (377) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ - -4, /* (378) cmd ::= DROP TOPIC exists_opt topic_name */ - -7, /* (379) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ - -2, /* (380) cmd ::= DESC full_table_name */ - -2, /* (381) cmd ::= DESCRIBE full_table_name */ - -3, /* (382) cmd ::= RESET QUERY CACHE */ - -4, /* (383) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ - -4, /* (384) cmd ::= EXPLAIN analyze_opt explain_options insert_query */ - 0, /* (385) analyze_opt ::= */ - -1, /* (386) analyze_opt ::= ANALYZE */ - 0, /* (387) explain_options ::= */ - -3, /* (388) explain_options ::= explain_options VERBOSE NK_BOOL */ - -3, /* (389) explain_options ::= explain_options RATIO NK_FLOAT */ - -12, /* (390) cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ - -4, /* (391) cmd ::= DROP FUNCTION exists_opt function_name */ - 0, /* (392) agg_func_opt ::= */ - -1, /* (393) agg_func_opt ::= AGGREGATE */ - 0, /* (394) bufsize_opt ::= */ - -2, /* (395) bufsize_opt ::= BUFSIZE NK_INTEGER */ - 0, /* (396) language_opt ::= */ - -2, /* (397) language_opt ::= LANGUAGE NK_STRING */ - 0, /* (398) or_replace_opt ::= */ - -2, /* (399) or_replace_opt ::= OR REPLACE */ - -6, /* (400) cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */ - -4, /* (401) cmd ::= DROP VIEW exists_opt full_view_name */ - -1, /* (402) full_view_name ::= view_name */ - -3, /* (403) full_view_name ::= db_name NK_DOT view_name */ - -12, /* (404) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */ - -4, /* (405) cmd ::= DROP STREAM exists_opt stream_name */ - -4, /* (406) cmd ::= PAUSE STREAM exists_opt stream_name */ - -5, /* (407) cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ - 0, /* (408) col_list_opt ::= */ - -3, /* (409) col_list_opt ::= NK_LP column_stream_def_list NK_RP */ - -1, /* (410) column_stream_def_list ::= column_stream_def */ - -3, /* (411) column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def */ - -2, /* (412) column_stream_def ::= column_name stream_col_options */ - 0, /* (413) stream_col_options ::= */ - -3, /* (414) stream_col_options ::= stream_col_options PRIMARY KEY */ - 0, /* (415) tag_def_or_ref_opt ::= */ - -1, /* (416) tag_def_or_ref_opt ::= tags_def */ - -4, /* (417) tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP */ - 0, /* (418) stream_options ::= */ - -3, /* (419) stream_options ::= stream_options TRIGGER AT_ONCE */ - -3, /* (420) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ - -3, /* (421) stream_options ::= stream_options TRIGGER FORCE_WINDOW_CLOSE */ - -4, /* (422) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ - -3, /* (423) stream_options ::= stream_options WATERMARK duration_literal */ - -4, /* (424) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ - -3, /* (425) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ - -3, /* (426) stream_options ::= stream_options DELETE_MARK duration_literal */ - -4, /* (427) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ - 0, /* (428) subtable_opt ::= */ - -4, /* (429) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - 0, /* (430) ignore_opt ::= */ - -2, /* (431) ignore_opt ::= IGNORE UNTREATED */ - -3, /* (432) cmd ::= KILL CONNECTION NK_INTEGER */ - -3, /* (433) cmd ::= KILL QUERY NK_STRING */ - -3, /* (434) cmd ::= KILL TRANSACTION NK_INTEGER */ - -3, /* (435) cmd ::= KILL COMPACT NK_INTEGER */ - -2, /* (436) cmd ::= BALANCE VGROUP */ - -4, /* (437) cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ - -5, /* (438) cmd ::= BALANCE VGROUP LEADER DATABASE db_name */ - -4, /* (439) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ - -4, /* (440) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ - -3, /* (441) cmd ::= SPLIT VGROUP NK_INTEGER */ - 0, /* (442) on_vgroup_id ::= */ - -2, /* (443) on_vgroup_id ::= ON NK_INTEGER */ - -2, /* (444) dnode_list ::= DNODE NK_INTEGER */ - -3, /* (445) dnode_list ::= dnode_list DNODE NK_INTEGER */ - -4, /* (446) cmd ::= DELETE FROM full_table_name where_clause_opt */ - -1, /* (447) cmd ::= query_or_subquery */ - -1, /* (448) cmd ::= insert_query */ - -7, /* (449) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ - -4, /* (450) insert_query ::= INSERT INTO full_table_name query_or_subquery */ - -1, /* (451) tags_literal ::= NK_INTEGER */ - -3, /* (452) tags_literal ::= NK_INTEGER NK_PLUS duration_literal */ - -3, /* (453) tags_literal ::= NK_INTEGER NK_MINUS duration_literal */ - -2, /* (454) tags_literal ::= NK_PLUS NK_INTEGER */ - -4, /* (455) tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal */ - -4, /* (456) tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal */ - -2, /* (457) tags_literal ::= NK_MINUS NK_INTEGER */ - -4, /* (458) tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal */ - -4, /* (459) tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal */ - -1, /* (460) tags_literal ::= NK_FLOAT */ - -2, /* (461) tags_literal ::= NK_PLUS NK_FLOAT */ - -2, /* (462) tags_literal ::= NK_MINUS NK_FLOAT */ - -1, /* (463) tags_literal ::= NK_BIN */ - -3, /* (464) tags_literal ::= NK_BIN NK_PLUS duration_literal */ - -3, /* (465) tags_literal ::= NK_BIN NK_MINUS duration_literal */ - -2, /* (466) tags_literal ::= NK_PLUS NK_BIN */ - -4, /* (467) tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal */ - -4, /* (468) tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal */ - -2, /* (469) tags_literal ::= NK_MINUS NK_BIN */ - -4, /* (470) tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal */ - -4, /* (471) tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal */ - -1, /* (472) tags_literal ::= NK_HEX */ - -3, /* (473) tags_literal ::= NK_HEX NK_PLUS duration_literal */ - -3, /* (474) tags_literal ::= NK_HEX NK_MINUS duration_literal */ - -2, /* (475) tags_literal ::= NK_PLUS NK_HEX */ - -4, /* (476) tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal */ - -4, /* (477) tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal */ - -2, /* (478) tags_literal ::= NK_MINUS NK_HEX */ - -4, /* (479) tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal */ - -4, /* (480) tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal */ - -1, /* (481) tags_literal ::= NK_STRING */ - -3, /* (482) tags_literal ::= NK_STRING NK_PLUS duration_literal */ - -3, /* (483) tags_literal ::= NK_STRING NK_MINUS duration_literal */ - -1, /* (484) tags_literal ::= NK_BOOL */ - -1, /* (485) tags_literal ::= NULL */ - -1, /* (486) tags_literal ::= literal_func */ - -3, /* (487) tags_literal ::= literal_func NK_PLUS duration_literal */ - -3, /* (488) tags_literal ::= literal_func NK_MINUS duration_literal */ - -1, /* (489) tags_literal_list ::= tags_literal */ - -3, /* (490) tags_literal_list ::= tags_literal_list NK_COMMA tags_literal */ - -1, /* (491) literal ::= NK_INTEGER */ - -1, /* (492) literal ::= NK_FLOAT */ - -1, /* (493) literal ::= NK_STRING */ - -1, /* (494) literal ::= NK_BOOL */ - -2, /* (495) literal ::= TIMESTAMP NK_STRING */ - -1, /* (496) literal ::= duration_literal */ - -1, /* (497) literal ::= NULL */ - -1, /* (498) literal ::= NK_QUESTION */ - -1, /* (499) duration_literal ::= NK_VARIABLE */ - -1, /* (500) signed ::= NK_INTEGER */ - -2, /* (501) signed ::= NK_PLUS NK_INTEGER */ - -2, /* (502) signed ::= NK_MINUS NK_INTEGER */ - -1, /* (503) signed ::= NK_FLOAT */ - -2, /* (504) signed ::= NK_PLUS NK_FLOAT */ - -2, /* (505) signed ::= NK_MINUS NK_FLOAT */ - -1, /* (506) signed_literal ::= signed */ - -1, /* (507) signed_literal ::= NK_STRING */ - -1, /* (508) signed_literal ::= NK_BOOL */ - -2, /* (509) signed_literal ::= TIMESTAMP NK_STRING */ - -1, /* (510) signed_literal ::= duration_literal */ - -1, /* (511) signed_literal ::= NULL */ - -1, /* (512) signed_literal ::= literal_func */ - -1, /* (513) signed_literal ::= NK_QUESTION */ - -1, /* (514) literal_list ::= signed_literal */ - -3, /* (515) literal_list ::= literal_list NK_COMMA signed_literal */ - -1, /* (516) db_name ::= NK_ID */ - -1, /* (517) table_name ::= NK_ID */ - -1, /* (518) column_name ::= NK_ID */ - -1, /* (519) function_name ::= NK_ID */ - -1, /* (520) view_name ::= NK_ID */ - -1, /* (521) table_alias ::= NK_ID */ - -1, /* (522) column_alias ::= NK_ID */ - -1, /* (523) column_alias ::= NK_ALIAS */ - -1, /* (524) user_name ::= NK_ID */ - -1, /* (525) topic_name ::= NK_ID */ - -1, /* (526) stream_name ::= NK_ID */ - -1, /* (527) cgroup_name ::= NK_ID */ - -1, /* (528) index_name ::= NK_ID */ - -1, /* (529) tsma_name ::= NK_ID */ - -1, /* (530) expr_or_subquery ::= expression */ - -1, /* (531) expression ::= literal */ - -1, /* (532) expression ::= pseudo_column */ - -1, /* (533) expression ::= column_reference */ - -1, /* (534) expression ::= function_expression */ - -1, /* (535) expression ::= case_when_expression */ - -3, /* (536) expression ::= NK_LP expression NK_RP */ - -2, /* (537) expression ::= NK_PLUS expr_or_subquery */ - -2, /* (538) expression ::= NK_MINUS expr_or_subquery */ - -3, /* (539) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ - -3, /* (540) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ - -3, /* (541) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ - -3, /* (542) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ - -3, /* (543) expression ::= expr_or_subquery NK_REM expr_or_subquery */ - -3, /* (544) expression ::= column_reference NK_ARROW NK_STRING */ - -3, /* (545) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ - -3, /* (546) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ - -1, /* (547) expression_list ::= expr_or_subquery */ - -3, /* (548) expression_list ::= expression_list NK_COMMA expr_or_subquery */ - -1, /* (549) column_reference ::= column_name */ - -3, /* (550) column_reference ::= table_name NK_DOT column_name */ - -1, /* (551) column_reference ::= NK_ALIAS */ - -3, /* (552) column_reference ::= table_name NK_DOT NK_ALIAS */ - -1, /* (553) pseudo_column ::= ROWTS */ - -1, /* (554) pseudo_column ::= TBNAME */ - -3, /* (555) pseudo_column ::= table_name NK_DOT TBNAME */ - -1, /* (556) pseudo_column ::= QSTART */ - -1, /* (557) pseudo_column ::= QEND */ - -1, /* (558) pseudo_column ::= QDURATION */ - -1, /* (559) pseudo_column ::= WSTART */ - -1, /* (560) pseudo_column ::= WEND */ - -1, /* (561) pseudo_column ::= WDURATION */ - -1, /* (562) pseudo_column ::= IROWTS */ - -1, /* (563) pseudo_column ::= ISFILLED */ - -1, /* (564) pseudo_column ::= QTAGS */ - -4, /* (565) function_expression ::= function_name NK_LP expression_list NK_RP */ - -4, /* (566) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ - -6, /* (567) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ - -6, /* (568) function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP */ - -6, /* (569) function_expression ::= POSITION NK_LP expr_or_subquery IN expr_or_subquery NK_RP */ - -4, /* (570) function_expression ::= TRIM NK_LP expr_or_subquery NK_RP */ - -6, /* (571) function_expression ::= TRIM NK_LP trim_specification_type FROM expr_or_subquery NK_RP */ - -6, /* (572) function_expression ::= TRIM NK_LP expr_or_subquery FROM expr_or_subquery NK_RP */ - -7, /* (573) function_expression ::= TRIM NK_LP trim_specification_type expr_or_subquery FROM expr_or_subquery NK_RP */ - -4, /* (574) function_expression ::= substr_func NK_LP expression_list NK_RP */ - -6, /* (575) function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery NK_RP */ - -8, /* (576) function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery FOR expr_or_subquery NK_RP */ - -4, /* (577) function_expression ::= REPLACE NK_LP expression_list NK_RP */ - -1, /* (578) function_expression ::= literal_func */ - -1, /* (579) function_expression ::= rand_func */ - -3, /* (580) literal_func ::= noarg_func NK_LP NK_RP */ - -1, /* (581) literal_func ::= NOW */ - -1, /* (582) literal_func ::= TODAY */ - -3, /* (583) rand_func ::= RAND NK_LP NK_RP */ - -4, /* (584) rand_func ::= RAND NK_LP expression_list NK_RP */ - -1, /* (585) substr_func ::= SUBSTR */ - -1, /* (586) substr_func ::= SUBSTRING */ - -1, /* (587) trim_specification_type ::= BOTH */ - -1, /* (588) trim_specification_type ::= TRAILING */ - -1, /* (589) trim_specification_type ::= LEADING */ - -1, /* (590) noarg_func ::= NOW */ - -1, /* (591) noarg_func ::= TODAY */ - -1, /* (592) noarg_func ::= TIMEZONE */ - -1, /* (593) noarg_func ::= DATABASE */ - -1, /* (594) noarg_func ::= CLIENT_VERSION */ - -1, /* (595) noarg_func ::= SERVER_VERSION */ - -1, /* (596) noarg_func ::= SERVER_STATUS */ - -1, /* (597) noarg_func ::= CURRENT_USER */ - -1, /* (598) noarg_func ::= USER */ - -1, /* (599) noarg_func ::= PI */ - -1, /* (600) star_func ::= COUNT */ - -1, /* (601) star_func ::= FIRST */ - -1, /* (602) star_func ::= LAST */ - -1, /* (603) star_func ::= LAST_ROW */ - -1, /* (604) star_func_para_list ::= NK_STAR */ - -1, /* (605) star_func_para_list ::= other_para_list */ - -1, /* (606) other_para_list ::= star_func_para */ - -3, /* (607) other_para_list ::= other_para_list NK_COMMA star_func_para */ - -1, /* (608) star_func_para ::= expr_or_subquery */ - -3, /* (609) star_func_para ::= table_name NK_DOT NK_STAR */ - -4, /* (610) case_when_expression ::= CASE when_then_list case_when_else_opt END */ - -5, /* (611) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ - -1, /* (612) when_then_list ::= when_then_expr */ - -2, /* (613) when_then_list ::= when_then_list when_then_expr */ - -4, /* (614) when_then_expr ::= WHEN common_expression THEN common_expression */ - 0, /* (615) case_when_else_opt ::= */ - -2, /* (616) case_when_else_opt ::= ELSE common_expression */ - -3, /* (617) predicate ::= expr_or_subquery compare_op expr_or_subquery */ - -5, /* (618) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ - -6, /* (619) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ - -3, /* (620) predicate ::= expr_or_subquery IS NULL */ - -4, /* (621) predicate ::= expr_or_subquery IS NOT NULL */ - -3, /* (622) predicate ::= expr_or_subquery in_op in_predicate_value */ - -1, /* (623) compare_op ::= NK_LT */ - -1, /* (624) compare_op ::= NK_GT */ - -1, /* (625) compare_op ::= NK_LE */ - -1, /* (626) compare_op ::= NK_GE */ - -1, /* (627) compare_op ::= NK_NE */ - -1, /* (628) compare_op ::= NK_EQ */ - -1, /* (629) compare_op ::= LIKE */ - -2, /* (630) compare_op ::= NOT LIKE */ - -1, /* (631) compare_op ::= MATCH */ - -1, /* (632) compare_op ::= NMATCH */ - -1, /* (633) compare_op ::= CONTAINS */ - -1, /* (634) in_op ::= IN */ - -2, /* (635) in_op ::= NOT IN */ - -3, /* (636) in_predicate_value ::= NK_LP literal_list NK_RP */ - -1, /* (637) boolean_value_expression ::= boolean_primary */ - -2, /* (638) boolean_value_expression ::= NOT boolean_primary */ - -3, /* (639) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - -3, /* (640) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - -1, /* (641) boolean_primary ::= predicate */ - -3, /* (642) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ - -1, /* (643) common_expression ::= expr_or_subquery */ - -1, /* (644) common_expression ::= boolean_value_expression */ - 0, /* (645) from_clause_opt ::= */ - -2, /* (646) from_clause_opt ::= FROM table_reference_list */ - -1, /* (647) table_reference_list ::= table_reference */ - -3, /* (648) table_reference_list ::= table_reference_list NK_COMMA table_reference */ - -1, /* (649) table_reference ::= table_primary */ - -1, /* (650) table_reference ::= joined_table */ - -2, /* (651) table_primary ::= table_name alias_opt */ - -4, /* (652) table_primary ::= db_name NK_DOT table_name alias_opt */ - -2, /* (653) table_primary ::= subquery alias_opt */ - -1, /* (654) table_primary ::= parenthesized_joined_table */ - 0, /* (655) alias_opt ::= */ - -1, /* (656) alias_opt ::= table_alias */ - -2, /* (657) alias_opt ::= AS table_alias */ - -3, /* (658) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - -3, /* (659) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ - -8, /* (660) joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt */ - 0, /* (661) join_type ::= */ - -1, /* (662) join_type ::= INNER */ - -1, /* (663) join_type ::= LEFT */ - -1, /* (664) join_type ::= RIGHT */ - -1, /* (665) join_type ::= FULL */ - 0, /* (666) join_subtype ::= */ - -1, /* (667) join_subtype ::= OUTER */ - -1, /* (668) join_subtype ::= SEMI */ - -1, /* (669) join_subtype ::= ANTI */ - -1, /* (670) join_subtype ::= ASOF */ - -1, /* (671) join_subtype ::= WINDOW */ - 0, /* (672) join_on_clause_opt ::= */ - -2, /* (673) join_on_clause_opt ::= ON search_condition */ - 0, /* (674) window_offset_clause_opt ::= */ - -6, /* (675) window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP */ - -1, /* (676) window_offset_literal ::= NK_VARIABLE */ - -2, /* (677) window_offset_literal ::= NK_MINUS NK_VARIABLE */ - 0, /* (678) jlimit_clause_opt ::= */ - -2, /* (679) jlimit_clause_opt ::= JLIMIT NK_INTEGER */ - -14, /* (680) query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_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 */ - 0, /* (681) hint_list ::= */ - -1, /* (682) hint_list ::= NK_HINT */ - 0, /* (683) tag_mode_opt ::= */ - -1, /* (684) tag_mode_opt ::= TAGS */ - 0, /* (685) set_quantifier_opt ::= */ - -1, /* (686) set_quantifier_opt ::= DISTINCT */ - -1, /* (687) set_quantifier_opt ::= ALL */ - -1, /* (688) select_list ::= select_item */ - -3, /* (689) select_list ::= select_list NK_COMMA select_item */ - -1, /* (690) select_item ::= NK_STAR */ - -1, /* (691) select_item ::= common_expression */ - -2, /* (692) select_item ::= common_expression column_alias */ - -3, /* (693) select_item ::= common_expression AS column_alias */ - -3, /* (694) select_item ::= table_name NK_DOT NK_STAR */ - 0, /* (695) where_clause_opt ::= */ - -2, /* (696) where_clause_opt ::= WHERE search_condition */ - 0, /* (697) partition_by_clause_opt ::= */ - -3, /* (698) partition_by_clause_opt ::= PARTITION BY partition_list */ - -1, /* (699) partition_list ::= partition_item */ - -3, /* (700) partition_list ::= partition_list NK_COMMA partition_item */ - -1, /* (701) partition_item ::= expr_or_subquery */ - -2, /* (702) partition_item ::= expr_or_subquery column_alias */ - -3, /* (703) partition_item ::= expr_or_subquery AS column_alias */ - 0, /* (704) twindow_clause_opt ::= */ - -6, /* (705) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ - -4, /* (706) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ - -6, /* (707) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ - -8, /* (708) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ - -7, /* (709) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ - -4, /* (710) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */ - -6, /* (711) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - 0, /* (712) sliding_opt ::= */ - -4, /* (713) sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ - -1, /* (714) interval_sliding_duration_literal ::= NK_VARIABLE */ - -1, /* (715) interval_sliding_duration_literal ::= NK_STRING */ - -1, /* (716) interval_sliding_duration_literal ::= NK_INTEGER */ - 0, /* (717) fill_opt ::= */ - -4, /* (718) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - -6, /* (719) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ - -6, /* (720) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ - -1, /* (721) fill_mode ::= NONE */ - -1, /* (722) fill_mode ::= PREV */ - -1, /* (723) fill_mode ::= NULL */ - -1, /* (724) fill_mode ::= NULL_F */ - -1, /* (725) fill_mode ::= LINEAR */ - -1, /* (726) fill_mode ::= NEXT */ - 0, /* (727) group_by_clause_opt ::= */ - -3, /* (728) group_by_clause_opt ::= GROUP BY group_by_list */ - -1, /* (729) group_by_list ::= expr_or_subquery */ - -3, /* (730) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ - 0, /* (731) having_clause_opt ::= */ - -2, /* (732) having_clause_opt ::= HAVING search_condition */ - 0, /* (733) range_opt ::= */ - -6, /* (734) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ - -4, /* (735) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ - 0, /* (736) every_opt ::= */ - -4, /* (737) every_opt ::= EVERY NK_LP duration_literal NK_RP */ - -4, /* (738) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ - -1, /* (739) query_simple ::= query_specification */ - -1, /* (740) query_simple ::= union_query_expression */ - -4, /* (741) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ - -3, /* (742) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ - -1, /* (743) query_simple_or_subquery ::= query_simple */ - -1, /* (744) query_simple_or_subquery ::= subquery */ - -1, /* (745) query_or_subquery ::= query_expression */ - -1, /* (746) query_or_subquery ::= subquery */ - 0, /* (747) order_by_clause_opt ::= */ - -3, /* (748) order_by_clause_opt ::= ORDER BY sort_specification_list */ - 0, /* (749) slimit_clause_opt ::= */ - -2, /* (750) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - -4, /* (751) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - -4, /* (752) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - 0, /* (753) limit_clause_opt ::= */ - -2, /* (754) limit_clause_opt ::= LIMIT NK_INTEGER */ - -4, /* (755) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - -4, /* (756) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - -3, /* (757) subquery ::= NK_LP query_expression NK_RP */ - -3, /* (758) subquery ::= NK_LP subquery NK_RP */ - -1, /* (759) search_condition ::= common_expression */ - -1, /* (760) sort_specification_list ::= sort_specification */ - -3, /* (761) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - -3, /* (762) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ - 0, /* (763) ordering_specification_opt ::= */ - -1, /* (764) ordering_specification_opt ::= ASC */ - -1, /* (765) ordering_specification_opt ::= DESC */ - 0, /* (766) null_ordering_opt ::= */ - -2, /* (767) null_ordering_opt ::= NULLS FIRST */ - -2, /* (768) null_ordering_opt ::= NULLS LAST */ - 0, /* (769) column_options ::= */ - -3, /* (770) column_options ::= column_options PRIMARY KEY */ - -3, /* (771) column_options ::= column_options NK_ID NK_STRING */ + 0, /* (206) with_opt ::= */ + -1, /* (207) with_opt ::= WITH */ + 0, /* (208) specific_cols_opt ::= */ + -3, /* (209) specific_cols_opt ::= NK_LP col_name_list NK_RP */ + -1, /* (210) full_table_name ::= table_name */ + -3, /* (211) full_table_name ::= db_name NK_DOT table_name */ + -1, /* (212) tag_def_list ::= tag_def */ + -3, /* (213) tag_def_list ::= tag_def_list NK_COMMA tag_def */ + -2, /* (214) tag_def ::= column_name type_name */ + -1, /* (215) column_def_list ::= column_def */ + -3, /* (216) column_def_list ::= column_def_list NK_COMMA column_def */ + -3, /* (217) column_def ::= column_name type_name column_options */ + -1, /* (218) type_name ::= BOOL */ + -1, /* (219) type_name ::= TINYINT */ + -1, /* (220) type_name ::= SMALLINT */ + -1, /* (221) type_name ::= INT */ + -1, /* (222) type_name ::= INTEGER */ + -1, /* (223) type_name ::= BIGINT */ + -1, /* (224) type_name ::= FLOAT */ + -1, /* (225) type_name ::= DOUBLE */ + -4, /* (226) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ + -1, /* (227) type_name ::= TIMESTAMP */ + -4, /* (228) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ + -2, /* (229) type_name ::= TINYINT UNSIGNED */ + -2, /* (230) type_name ::= SMALLINT UNSIGNED */ + -2, /* (231) type_name ::= INT UNSIGNED */ + -2, /* (232) type_name ::= BIGINT UNSIGNED */ + -1, /* (233) type_name ::= JSON */ + -4, /* (234) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ + -1, /* (235) type_name ::= MEDIUMBLOB */ + -1, /* (236) type_name ::= BLOB */ + -4, /* (237) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ + -4, /* (238) type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ + -1, /* (239) type_name ::= DECIMAL */ + -4, /* (240) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ + -6, /* (241) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + -1, /* (242) type_name_default_len ::= BINARY */ + -1, /* (243) type_name_default_len ::= NCHAR */ + -1, /* (244) type_name_default_len ::= VARCHAR */ + -1, /* (245) type_name_default_len ::= VARBINARY */ + 0, /* (246) tags_def_opt ::= */ + -1, /* (247) tags_def_opt ::= tags_def */ + -4, /* (248) tags_def ::= TAGS NK_LP tag_def_list NK_RP */ + 0, /* (249) table_options ::= */ + -3, /* (250) table_options ::= table_options COMMENT NK_STRING */ + -3, /* (251) table_options ::= table_options MAX_DELAY duration_list */ + -3, /* (252) table_options ::= table_options WATERMARK duration_list */ + -5, /* (253) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ + -3, /* (254) table_options ::= table_options TTL NK_INTEGER */ + -5, /* (255) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ + -3, /* (256) table_options ::= table_options DELETE_MARK duration_list */ + -1, /* (257) alter_table_options ::= alter_table_option */ + -2, /* (258) alter_table_options ::= alter_table_options alter_table_option */ + -2, /* (259) alter_table_option ::= COMMENT NK_STRING */ + -2, /* (260) alter_table_option ::= TTL NK_INTEGER */ + -1, /* (261) duration_list ::= duration_literal */ + -3, /* (262) duration_list ::= duration_list NK_COMMA duration_literal */ + -1, /* (263) rollup_func_list ::= rollup_func_name */ + -3, /* (264) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ + -1, /* (265) rollup_func_name ::= function_name */ + -1, /* (266) rollup_func_name ::= FIRST */ + -1, /* (267) rollup_func_name ::= LAST */ + -1, /* (268) col_name_list ::= col_name */ + -3, /* (269) col_name_list ::= col_name_list NK_COMMA col_name */ + -1, /* (270) col_name ::= column_name */ + -2, /* (271) cmd ::= SHOW DNODES */ + -2, /* (272) cmd ::= SHOW USERS */ + -3, /* (273) cmd ::= SHOW USERS FULL */ + -3, /* (274) cmd ::= SHOW USER PRIVILEGES */ + -3, /* (275) cmd ::= SHOW db_kind_opt DATABASES */ + -4, /* (276) cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */ + -4, /* (277) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ + -3, /* (278) cmd ::= SHOW db_name_cond_opt VGROUPS */ + -2, /* (279) cmd ::= SHOW MNODES */ + -2, /* (280) cmd ::= SHOW QNODES */ + -2, /* (281) cmd ::= SHOW ARBGROUPS */ + -2, /* (282) cmd ::= SHOW FUNCTIONS */ + -5, /* (283) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ + -6, /* (284) cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ + -2, /* (285) cmd ::= SHOW STREAMS */ + -2, /* (286) cmd ::= SHOW ACCOUNTS */ + -2, /* (287) cmd ::= SHOW APPS */ + -2, /* (288) cmd ::= SHOW CONNECTIONS */ + -2, /* (289) cmd ::= SHOW LICENCES */ + -2, /* (290) cmd ::= SHOW GRANTS */ + -3, /* (291) cmd ::= SHOW GRANTS FULL */ + -3, /* (292) cmd ::= SHOW GRANTS LOGS */ + -3, /* (293) cmd ::= SHOW CLUSTER MACHINES */ + -4, /* (294) cmd ::= SHOW CREATE DATABASE db_name */ + -4, /* (295) cmd ::= SHOW CREATE TABLE full_table_name */ + -4, /* (296) cmd ::= SHOW CREATE STABLE full_table_name */ + -2, /* (297) cmd ::= SHOW ENCRYPTIONS */ + -2, /* (298) cmd ::= SHOW QUERIES */ + -2, /* (299) cmd ::= SHOW SCORES */ + -2, /* (300) cmd ::= SHOW TOPICS */ + -2, /* (301) cmd ::= SHOW VARIABLES */ + -3, /* (302) cmd ::= SHOW CLUSTER VARIABLES */ + -3, /* (303) cmd ::= SHOW LOCAL VARIABLES */ + -5, /* (304) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ + -2, /* (305) cmd ::= SHOW BNODES */ + -2, /* (306) cmd ::= SHOW SNODES */ + -2, /* (307) cmd ::= SHOW CLUSTER */ + -2, /* (308) cmd ::= SHOW TRANSACTIONS */ + -4, /* (309) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ + -2, /* (310) cmd ::= SHOW CONSUMERS */ + -2, /* (311) cmd ::= SHOW SUBSCRIPTIONS */ + -5, /* (312) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ + -6, /* (313) cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ + -7, /* (314) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ + -8, /* (315) cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ + -5, /* (316) cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ + -2, /* (317) cmd ::= SHOW VNODES */ + -3, /* (318) cmd ::= SHOW db_name_cond_opt ALIVE */ + -3, /* (319) cmd ::= SHOW CLUSTER ALIVE */ + -4, /* (320) cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt */ + -4, /* (321) cmd ::= SHOW CREATE VIEW full_table_name */ + -2, /* (322) cmd ::= SHOW COMPACTS */ + -3, /* (323) cmd ::= SHOW COMPACT NK_INTEGER */ + 0, /* (324) table_kind_db_name_cond_opt ::= */ + -1, /* (325) table_kind_db_name_cond_opt ::= table_kind */ + -2, /* (326) table_kind_db_name_cond_opt ::= db_name NK_DOT */ + -3, /* (327) table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */ + -1, /* (328) table_kind ::= NORMAL */ + -1, /* (329) table_kind ::= CHILD */ + 0, /* (330) db_name_cond_opt ::= */ + -2, /* (331) db_name_cond_opt ::= db_name NK_DOT */ + 0, /* (332) like_pattern_opt ::= */ + -2, /* (333) like_pattern_opt ::= LIKE NK_STRING */ + -1, /* (334) table_name_cond ::= table_name */ + 0, /* (335) from_db_opt ::= */ + -2, /* (336) from_db_opt ::= FROM db_name */ + 0, /* (337) tag_list_opt ::= */ + -1, /* (338) tag_list_opt ::= tag_item */ + -3, /* (339) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ + -1, /* (340) tag_item ::= TBNAME */ + -1, /* (341) tag_item ::= QTAGS */ + -1, /* (342) tag_item ::= column_name */ + -2, /* (343) tag_item ::= column_name column_alias */ + -3, /* (344) tag_item ::= column_name AS column_alias */ + 0, /* (345) db_kind_opt ::= */ + -1, /* (346) db_kind_opt ::= USER */ + -1, /* (347) db_kind_opt ::= SYSTEM */ + -11, /* (348) cmd ::= CREATE TSMA not_exists_opt tsma_name ON full_table_name tsma_func_list INTERVAL NK_LP duration_literal NK_RP */ + -11, /* (349) cmd ::= CREATE RECURSIVE TSMA not_exists_opt tsma_name ON full_table_name INTERVAL NK_LP duration_literal NK_RP */ + -4, /* (350) cmd ::= DROP TSMA exists_opt full_tsma_name */ + -3, /* (351) cmd ::= SHOW db_name_cond_opt TSMAS */ + -1, /* (352) full_tsma_name ::= tsma_name */ + -3, /* (353) full_tsma_name ::= db_name NK_DOT tsma_name */ + -4, /* (354) tsma_func_list ::= FUNCTION NK_LP func_list NK_RP */ + -8, /* (355) cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */ + -9, /* (356) cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */ + -4, /* (357) cmd ::= DROP INDEX exists_opt full_index_name */ + -1, /* (358) full_index_name ::= index_name */ + -3, /* (359) full_index_name ::= db_name NK_DOT index_name */ + -10, /* (360) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ + -12, /* (361) 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 */ + -1, /* (362) func_list ::= func */ + -3, /* (363) func_list ::= func_list NK_COMMA func */ + -4, /* (364) func ::= sma_func_name NK_LP expression_list NK_RP */ + -1, /* (365) sma_func_name ::= function_name */ + -1, /* (366) sma_func_name ::= COUNT */ + -1, /* (367) sma_func_name ::= FIRST */ + -1, /* (368) sma_func_name ::= LAST */ + -1, /* (369) sma_func_name ::= LAST_ROW */ + 0, /* (370) sma_stream_opt ::= */ + -3, /* (371) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ + -3, /* (372) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ + -3, /* (373) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ + -1, /* (374) with_meta ::= AS */ + -3, /* (375) with_meta ::= WITH META AS */ + -3, /* (376) with_meta ::= ONLY META AS */ + -6, /* (377) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ + -7, /* (378) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ + -8, /* (379) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ + -4, /* (380) cmd ::= DROP TOPIC exists_opt topic_name */ + -7, /* (381) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ + -2, /* (382) cmd ::= DESC full_table_name */ + -2, /* (383) cmd ::= DESCRIBE full_table_name */ + -3, /* (384) cmd ::= RESET QUERY CACHE */ + -4, /* (385) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ + -4, /* (386) cmd ::= EXPLAIN analyze_opt explain_options insert_query */ + 0, /* (387) analyze_opt ::= */ + -1, /* (388) analyze_opt ::= ANALYZE */ + 0, /* (389) explain_options ::= */ + -3, /* (390) explain_options ::= explain_options VERBOSE NK_BOOL */ + -3, /* (391) explain_options ::= explain_options RATIO NK_FLOAT */ + -12, /* (392) cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ + -4, /* (393) cmd ::= DROP FUNCTION exists_opt function_name */ + 0, /* (394) agg_func_opt ::= */ + -1, /* (395) agg_func_opt ::= AGGREGATE */ + 0, /* (396) bufsize_opt ::= */ + -2, /* (397) bufsize_opt ::= BUFSIZE NK_INTEGER */ + 0, /* (398) language_opt ::= */ + -2, /* (399) language_opt ::= LANGUAGE NK_STRING */ + 0, /* (400) or_replace_opt ::= */ + -2, /* (401) or_replace_opt ::= OR REPLACE */ + -6, /* (402) cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */ + -4, /* (403) cmd ::= DROP VIEW exists_opt full_view_name */ + -1, /* (404) full_view_name ::= view_name */ + -3, /* (405) full_view_name ::= db_name NK_DOT view_name */ + -12, /* (406) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */ + -4, /* (407) cmd ::= DROP STREAM exists_opt stream_name */ + -4, /* (408) cmd ::= PAUSE STREAM exists_opt stream_name */ + -5, /* (409) cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ + 0, /* (410) col_list_opt ::= */ + -3, /* (411) col_list_opt ::= NK_LP column_stream_def_list NK_RP */ + -1, /* (412) column_stream_def_list ::= column_stream_def */ + -3, /* (413) column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def */ + -2, /* (414) column_stream_def ::= column_name stream_col_options */ + 0, /* (415) stream_col_options ::= */ + -3, /* (416) stream_col_options ::= stream_col_options PRIMARY KEY */ + 0, /* (417) tag_def_or_ref_opt ::= */ + -1, /* (418) tag_def_or_ref_opt ::= tags_def */ + -4, /* (419) tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP */ + 0, /* (420) stream_options ::= */ + -3, /* (421) stream_options ::= stream_options TRIGGER AT_ONCE */ + -3, /* (422) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ + -3, /* (423) stream_options ::= stream_options TRIGGER FORCE_WINDOW_CLOSE */ + -4, /* (424) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ + -3, /* (425) stream_options ::= stream_options WATERMARK duration_literal */ + -4, /* (426) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ + -3, /* (427) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ + -3, /* (428) stream_options ::= stream_options DELETE_MARK duration_literal */ + -4, /* (429) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ + 0, /* (430) subtable_opt ::= */ + -4, /* (431) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + 0, /* (432) ignore_opt ::= */ + -2, /* (433) ignore_opt ::= IGNORE UNTREATED */ + -3, /* (434) cmd ::= KILL CONNECTION NK_INTEGER */ + -3, /* (435) cmd ::= KILL QUERY NK_STRING */ + -3, /* (436) cmd ::= KILL TRANSACTION NK_INTEGER */ + -3, /* (437) cmd ::= KILL COMPACT NK_INTEGER */ + -2, /* (438) cmd ::= BALANCE VGROUP */ + -4, /* (439) cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ + -5, /* (440) cmd ::= BALANCE VGROUP LEADER DATABASE db_name */ + -4, /* (441) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + -4, /* (442) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ + -3, /* (443) cmd ::= SPLIT VGROUP NK_INTEGER */ + 0, /* (444) on_vgroup_id ::= */ + -2, /* (445) on_vgroup_id ::= ON NK_INTEGER */ + -2, /* (446) dnode_list ::= DNODE NK_INTEGER */ + -3, /* (447) dnode_list ::= dnode_list DNODE NK_INTEGER */ + -4, /* (448) cmd ::= DELETE FROM full_table_name where_clause_opt */ + -1, /* (449) cmd ::= query_or_subquery */ + -1, /* (450) cmd ::= insert_query */ + -7, /* (451) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ + -4, /* (452) insert_query ::= INSERT INTO full_table_name query_or_subquery */ + -1, /* (453) tags_literal ::= NK_INTEGER */ + -3, /* (454) tags_literal ::= NK_INTEGER NK_PLUS duration_literal */ + -3, /* (455) tags_literal ::= NK_INTEGER NK_MINUS duration_literal */ + -2, /* (456) tags_literal ::= NK_PLUS NK_INTEGER */ + -4, /* (457) tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal */ + -4, /* (458) tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal */ + -2, /* (459) tags_literal ::= NK_MINUS NK_INTEGER */ + -4, /* (460) tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal */ + -4, /* (461) tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal */ + -1, /* (462) tags_literal ::= NK_FLOAT */ + -2, /* (463) tags_literal ::= NK_PLUS NK_FLOAT */ + -2, /* (464) tags_literal ::= NK_MINUS NK_FLOAT */ + -1, /* (465) tags_literal ::= NK_BIN */ + -3, /* (466) tags_literal ::= NK_BIN NK_PLUS duration_literal */ + -3, /* (467) tags_literal ::= NK_BIN NK_MINUS duration_literal */ + -2, /* (468) tags_literal ::= NK_PLUS NK_BIN */ + -4, /* (469) tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal */ + -4, /* (470) tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal */ + -2, /* (471) tags_literal ::= NK_MINUS NK_BIN */ + -4, /* (472) tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal */ + -4, /* (473) tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal */ + -1, /* (474) tags_literal ::= NK_HEX */ + -3, /* (475) tags_literal ::= NK_HEX NK_PLUS duration_literal */ + -3, /* (476) tags_literal ::= NK_HEX NK_MINUS duration_literal */ + -2, /* (477) tags_literal ::= NK_PLUS NK_HEX */ + -4, /* (478) tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal */ + -4, /* (479) tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal */ + -2, /* (480) tags_literal ::= NK_MINUS NK_HEX */ + -4, /* (481) tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal */ + -4, /* (482) tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal */ + -1, /* (483) tags_literal ::= NK_STRING */ + -3, /* (484) tags_literal ::= NK_STRING NK_PLUS duration_literal */ + -3, /* (485) tags_literal ::= NK_STRING NK_MINUS duration_literal */ + -1, /* (486) tags_literal ::= NK_BOOL */ + -1, /* (487) tags_literal ::= NULL */ + -1, /* (488) tags_literal ::= literal_func */ + -3, /* (489) tags_literal ::= literal_func NK_PLUS duration_literal */ + -3, /* (490) tags_literal ::= literal_func NK_MINUS duration_literal */ + -1, /* (491) tags_literal_list ::= tags_literal */ + -3, /* (492) tags_literal_list ::= tags_literal_list NK_COMMA tags_literal */ + -1, /* (493) literal ::= NK_INTEGER */ + -1, /* (494) literal ::= NK_FLOAT */ + -1, /* (495) literal ::= NK_STRING */ + -1, /* (496) literal ::= NK_BOOL */ + -2, /* (497) literal ::= TIMESTAMP NK_STRING */ + -1, /* (498) literal ::= duration_literal */ + -1, /* (499) literal ::= NULL */ + -1, /* (500) literal ::= NK_QUESTION */ + -1, /* (501) duration_literal ::= NK_VARIABLE */ + -1, /* (502) signed ::= NK_INTEGER */ + -2, /* (503) signed ::= NK_PLUS NK_INTEGER */ + -2, /* (504) signed ::= NK_MINUS NK_INTEGER */ + -1, /* (505) signed ::= NK_FLOAT */ + -2, /* (506) signed ::= NK_PLUS NK_FLOAT */ + -2, /* (507) signed ::= NK_MINUS NK_FLOAT */ + -1, /* (508) signed_literal ::= signed */ + -1, /* (509) signed_literal ::= NK_STRING */ + -1, /* (510) signed_literal ::= NK_BOOL */ + -2, /* (511) signed_literal ::= TIMESTAMP NK_STRING */ + -1, /* (512) signed_literal ::= duration_literal */ + -1, /* (513) signed_literal ::= NULL */ + -1, /* (514) signed_literal ::= literal_func */ + -1, /* (515) signed_literal ::= NK_QUESTION */ + -1, /* (516) literal_list ::= signed_literal */ + -3, /* (517) literal_list ::= literal_list NK_COMMA signed_literal */ + -1, /* (518) db_name ::= NK_ID */ + -1, /* (519) table_name ::= NK_ID */ + -1, /* (520) column_name ::= NK_ID */ + -1, /* (521) function_name ::= NK_ID */ + -1, /* (522) view_name ::= NK_ID */ + -1, /* (523) table_alias ::= NK_ID */ + -1, /* (524) column_alias ::= NK_ID */ + -1, /* (525) column_alias ::= NK_ALIAS */ + -1, /* (526) user_name ::= NK_ID */ + -1, /* (527) topic_name ::= NK_ID */ + -1, /* (528) stream_name ::= NK_ID */ + -1, /* (529) cgroup_name ::= NK_ID */ + -1, /* (530) index_name ::= NK_ID */ + -1, /* (531) tsma_name ::= NK_ID */ + -1, /* (532) expr_or_subquery ::= expression */ + -1, /* (533) expression ::= literal */ + -1, /* (534) expression ::= pseudo_column */ + -1, /* (535) expression ::= column_reference */ + -1, /* (536) expression ::= function_expression */ + -1, /* (537) expression ::= case_when_expression */ + -3, /* (538) expression ::= NK_LP expression NK_RP */ + -2, /* (539) expression ::= NK_PLUS expr_or_subquery */ + -2, /* (540) expression ::= NK_MINUS expr_or_subquery */ + -3, /* (541) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ + -3, /* (542) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ + -3, /* (543) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ + -3, /* (544) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ + -3, /* (545) expression ::= expr_or_subquery NK_REM expr_or_subquery */ + -3, /* (546) expression ::= column_reference NK_ARROW NK_STRING */ + -3, /* (547) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ + -3, /* (548) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ + -1, /* (549) expression_list ::= expr_or_subquery */ + -3, /* (550) expression_list ::= expression_list NK_COMMA expr_or_subquery */ + -1, /* (551) column_reference ::= column_name */ + -3, /* (552) column_reference ::= table_name NK_DOT column_name */ + -1, /* (553) column_reference ::= NK_ALIAS */ + -3, /* (554) column_reference ::= table_name NK_DOT NK_ALIAS */ + -1, /* (555) pseudo_column ::= ROWTS */ + -1, /* (556) pseudo_column ::= TBNAME */ + -3, /* (557) pseudo_column ::= table_name NK_DOT TBNAME */ + -1, /* (558) pseudo_column ::= QSTART */ + -1, /* (559) pseudo_column ::= QEND */ + -1, /* (560) pseudo_column ::= QDURATION */ + -1, /* (561) pseudo_column ::= WSTART */ + -1, /* (562) pseudo_column ::= WEND */ + -1, /* (563) pseudo_column ::= WDURATION */ + -1, /* (564) pseudo_column ::= IROWTS */ + -1, /* (565) pseudo_column ::= ISFILLED */ + -1, /* (566) pseudo_column ::= QTAGS */ + -4, /* (567) function_expression ::= function_name NK_LP expression_list NK_RP */ + -4, /* (568) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ + -6, /* (569) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ + -6, /* (570) function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP */ + -6, /* (571) function_expression ::= POSITION NK_LP expr_or_subquery IN expr_or_subquery NK_RP */ + -4, /* (572) function_expression ::= TRIM NK_LP expr_or_subquery NK_RP */ + -6, /* (573) function_expression ::= TRIM NK_LP trim_specification_type FROM expr_or_subquery NK_RP */ + -6, /* (574) function_expression ::= TRIM NK_LP expr_or_subquery FROM expr_or_subquery NK_RP */ + -7, /* (575) function_expression ::= TRIM NK_LP trim_specification_type expr_or_subquery FROM expr_or_subquery NK_RP */ + -4, /* (576) function_expression ::= substr_func NK_LP expression_list NK_RP */ + -6, /* (577) function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery NK_RP */ + -8, /* (578) function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery FOR expr_or_subquery NK_RP */ + -4, /* (579) function_expression ::= REPLACE NK_LP expression_list NK_RP */ + -1, /* (580) function_expression ::= literal_func */ + -1, /* (581) function_expression ::= rand_func */ + -3, /* (582) literal_func ::= noarg_func NK_LP NK_RP */ + -1, /* (583) literal_func ::= NOW */ + -1, /* (584) literal_func ::= TODAY */ + -3, /* (585) rand_func ::= RAND NK_LP NK_RP */ + -4, /* (586) rand_func ::= RAND NK_LP expression_list NK_RP */ + -1, /* (587) substr_func ::= SUBSTR */ + -1, /* (588) substr_func ::= SUBSTRING */ + -1, /* (589) trim_specification_type ::= BOTH */ + -1, /* (590) trim_specification_type ::= TRAILING */ + -1, /* (591) trim_specification_type ::= LEADING */ + -1, /* (592) noarg_func ::= NOW */ + -1, /* (593) noarg_func ::= TODAY */ + -1, /* (594) noarg_func ::= TIMEZONE */ + -1, /* (595) noarg_func ::= DATABASE */ + -1, /* (596) noarg_func ::= CLIENT_VERSION */ + -1, /* (597) noarg_func ::= SERVER_VERSION */ + -1, /* (598) noarg_func ::= SERVER_STATUS */ + -1, /* (599) noarg_func ::= CURRENT_USER */ + -1, /* (600) noarg_func ::= USER */ + -1, /* (601) noarg_func ::= PI */ + -1, /* (602) star_func ::= COUNT */ + -1, /* (603) star_func ::= FIRST */ + -1, /* (604) star_func ::= LAST */ + -1, /* (605) star_func ::= LAST_ROW */ + -1, /* (606) star_func_para_list ::= NK_STAR */ + -1, /* (607) star_func_para_list ::= other_para_list */ + -1, /* (608) other_para_list ::= star_func_para */ + -3, /* (609) other_para_list ::= other_para_list NK_COMMA star_func_para */ + -1, /* (610) star_func_para ::= expr_or_subquery */ + -3, /* (611) star_func_para ::= table_name NK_DOT NK_STAR */ + -4, /* (612) case_when_expression ::= CASE when_then_list case_when_else_opt END */ + -5, /* (613) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ + -1, /* (614) when_then_list ::= when_then_expr */ + -2, /* (615) when_then_list ::= when_then_list when_then_expr */ + -4, /* (616) when_then_expr ::= WHEN common_expression THEN common_expression */ + 0, /* (617) case_when_else_opt ::= */ + -2, /* (618) case_when_else_opt ::= ELSE common_expression */ + -3, /* (619) predicate ::= expr_or_subquery compare_op expr_or_subquery */ + -5, /* (620) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ + -6, /* (621) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ + -3, /* (622) predicate ::= expr_or_subquery IS NULL */ + -4, /* (623) predicate ::= expr_or_subquery IS NOT NULL */ + -3, /* (624) predicate ::= expr_or_subquery in_op in_predicate_value */ + -1, /* (625) compare_op ::= NK_LT */ + -1, /* (626) compare_op ::= NK_GT */ + -1, /* (627) compare_op ::= NK_LE */ + -1, /* (628) compare_op ::= NK_GE */ + -1, /* (629) compare_op ::= NK_NE */ + -1, /* (630) compare_op ::= NK_EQ */ + -1, /* (631) compare_op ::= LIKE */ + -2, /* (632) compare_op ::= NOT LIKE */ + -1, /* (633) compare_op ::= MATCH */ + -1, /* (634) compare_op ::= NMATCH */ + -1, /* (635) compare_op ::= CONTAINS */ + -1, /* (636) in_op ::= IN */ + -2, /* (637) in_op ::= NOT IN */ + -3, /* (638) in_predicate_value ::= NK_LP literal_list NK_RP */ + -1, /* (639) boolean_value_expression ::= boolean_primary */ + -2, /* (640) boolean_value_expression ::= NOT boolean_primary */ + -3, /* (641) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + -3, /* (642) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + -1, /* (643) boolean_primary ::= predicate */ + -3, /* (644) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ + -1, /* (645) common_expression ::= expr_or_subquery */ + -1, /* (646) common_expression ::= boolean_value_expression */ + 0, /* (647) from_clause_opt ::= */ + -2, /* (648) from_clause_opt ::= FROM table_reference_list */ + -1, /* (649) table_reference_list ::= table_reference */ + -3, /* (650) table_reference_list ::= table_reference_list NK_COMMA table_reference */ + -1, /* (651) table_reference ::= table_primary */ + -1, /* (652) table_reference ::= joined_table */ + -2, /* (653) table_primary ::= table_name alias_opt */ + -4, /* (654) table_primary ::= db_name NK_DOT table_name alias_opt */ + -2, /* (655) table_primary ::= subquery alias_opt */ + -1, /* (656) table_primary ::= parenthesized_joined_table */ + 0, /* (657) alias_opt ::= */ + -1, /* (658) alias_opt ::= table_alias */ + -2, /* (659) alias_opt ::= AS table_alias */ + -3, /* (660) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + -3, /* (661) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ + -8, /* (662) joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt */ + 0, /* (663) join_type ::= */ + -1, /* (664) join_type ::= INNER */ + -1, /* (665) join_type ::= LEFT */ + -1, /* (666) join_type ::= RIGHT */ + -1, /* (667) join_type ::= FULL */ + 0, /* (668) join_subtype ::= */ + -1, /* (669) join_subtype ::= OUTER */ + -1, /* (670) join_subtype ::= SEMI */ + -1, /* (671) join_subtype ::= ANTI */ + -1, /* (672) join_subtype ::= ASOF */ + -1, /* (673) join_subtype ::= WINDOW */ + 0, /* (674) join_on_clause_opt ::= */ + -2, /* (675) join_on_clause_opt ::= ON search_condition */ + 0, /* (676) window_offset_clause_opt ::= */ + -6, /* (677) window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP */ + -1, /* (678) window_offset_literal ::= NK_VARIABLE */ + -2, /* (679) window_offset_literal ::= NK_MINUS NK_VARIABLE */ + 0, /* (680) jlimit_clause_opt ::= */ + -2, /* (681) jlimit_clause_opt ::= JLIMIT NK_INTEGER */ + -14, /* (682) query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_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 */ + 0, /* (683) hint_list ::= */ + -1, /* (684) hint_list ::= NK_HINT */ + 0, /* (685) tag_mode_opt ::= */ + -1, /* (686) tag_mode_opt ::= TAGS */ + 0, /* (687) set_quantifier_opt ::= */ + -1, /* (688) set_quantifier_opt ::= DISTINCT */ + -1, /* (689) set_quantifier_opt ::= ALL */ + -1, /* (690) select_list ::= select_item */ + -3, /* (691) select_list ::= select_list NK_COMMA select_item */ + -1, /* (692) select_item ::= NK_STAR */ + -1, /* (693) select_item ::= common_expression */ + -2, /* (694) select_item ::= common_expression column_alias */ + -3, /* (695) select_item ::= common_expression AS column_alias */ + -3, /* (696) select_item ::= table_name NK_DOT NK_STAR */ + 0, /* (697) where_clause_opt ::= */ + -2, /* (698) where_clause_opt ::= WHERE search_condition */ + 0, /* (699) partition_by_clause_opt ::= */ + -3, /* (700) partition_by_clause_opt ::= PARTITION BY partition_list */ + -1, /* (701) partition_list ::= partition_item */ + -3, /* (702) partition_list ::= partition_list NK_COMMA partition_item */ + -1, /* (703) partition_item ::= expr_or_subquery */ + -2, /* (704) partition_item ::= expr_or_subquery column_alias */ + -3, /* (705) partition_item ::= expr_or_subquery AS column_alias */ + 0, /* (706) twindow_clause_opt ::= */ + -6, /* (707) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ + -4, /* (708) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ + -6, /* (709) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ + -8, /* (710) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ + -7, /* (711) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ + -4, /* (712) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */ + -6, /* (713) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + 0, /* (714) sliding_opt ::= */ + -4, /* (715) sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ + -1, /* (716) interval_sliding_duration_literal ::= NK_VARIABLE */ + -1, /* (717) interval_sliding_duration_literal ::= NK_STRING */ + -1, /* (718) interval_sliding_duration_literal ::= NK_INTEGER */ + 0, /* (719) fill_opt ::= */ + -4, /* (720) fill_opt ::= FILL NK_LP fill_mode NK_RP */ + -6, /* (721) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ + -6, /* (722) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ + -1, /* (723) fill_mode ::= NONE */ + -1, /* (724) fill_mode ::= PREV */ + -1, /* (725) fill_mode ::= NULL */ + -1, /* (726) fill_mode ::= NULL_F */ + -1, /* (727) fill_mode ::= LINEAR */ + -1, /* (728) fill_mode ::= NEXT */ + 0, /* (729) group_by_clause_opt ::= */ + -3, /* (730) group_by_clause_opt ::= GROUP BY group_by_list */ + -1, /* (731) group_by_list ::= expr_or_subquery */ + -3, /* (732) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ + 0, /* (733) having_clause_opt ::= */ + -2, /* (734) having_clause_opt ::= HAVING search_condition */ + 0, /* (735) range_opt ::= */ + -6, /* (736) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ + -4, /* (737) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ + 0, /* (738) every_opt ::= */ + -4, /* (739) every_opt ::= EVERY NK_LP duration_literal NK_RP */ + -4, /* (740) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ + -1, /* (741) query_simple ::= query_specification */ + -1, /* (742) query_simple ::= union_query_expression */ + -4, /* (743) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ + -3, /* (744) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ + -1, /* (745) query_simple_or_subquery ::= query_simple */ + -1, /* (746) query_simple_or_subquery ::= subquery */ + -1, /* (747) query_or_subquery ::= query_expression */ + -1, /* (748) query_or_subquery ::= subquery */ + 0, /* (749) order_by_clause_opt ::= */ + -3, /* (750) order_by_clause_opt ::= ORDER BY sort_specification_list */ + 0, /* (751) slimit_clause_opt ::= */ + -2, /* (752) slimit_clause_opt ::= SLIMIT NK_INTEGER */ + -4, /* (753) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + -4, /* (754) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + 0, /* (755) limit_clause_opt ::= */ + -2, /* (756) limit_clause_opt ::= LIMIT NK_INTEGER */ + -4, /* (757) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ + -4, /* (758) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + -3, /* (759) subquery ::= NK_LP query_expression NK_RP */ + -3, /* (760) subquery ::= NK_LP subquery NK_RP */ + -1, /* (761) search_condition ::= common_expression */ + -1, /* (762) sort_specification_list ::= sort_specification */ + -3, /* (763) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ + -3, /* (764) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ + 0, /* (765) ordering_specification_opt ::= */ + -1, /* (766) ordering_specification_opt ::= ASC */ + -1, /* (767) ordering_specification_opt ::= DESC */ + 0, /* (768) null_ordering_opt ::= */ + -2, /* (769) null_ordering_opt ::= NULLS FIRST */ + -2, /* (770) null_ordering_opt ::= NULLS LAST */ + 0, /* (771) column_options ::= */ + -3, /* (772) column_options ::= column_options PRIMARY KEY */ + -3, /* (773) column_options ::= column_options NK_ID NK_STRING */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -5935,54 +5884,6 @@ static YYACTIONTYPE yy_reduce( (void)yyLookahead; (void)yyLookaheadToken; yymsp = yypParser->yytos; -#ifndef NDEBUG - if( yyTraceFILE && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){ - yysize = yyRuleInfoNRhs[yyruleno]; - if( yysize ){ - fprintf(yyTraceFILE, "%sReduce %d [%s]%s, pop back to state %d.\n", - yyTracePrompt, - yyruleno, yyRuleName[yyruleno], - yyrulenoyytos - yypParser->yystack)>yypParser->yyhwm ){ - yypParser->yyhwm++; - assert( yypParser->yyhwm == (int)(yypParser->yytos - yypParser->yystack)); - } -#endif -#if YYSTACKDEPTH>0 - if( yypParser->yytos>=yypParser->yystackEnd ){ - yyStackOverflow(yypParser); - /* The call to yyStackOverflow() above pops the stack until it is - ** empty, causing the main parser loop to exit. So the return value - ** is never used and does not matter. */ - return 0; - } -#else - if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz-1] ){ - if( yyGrowStack(yypParser) ){ - yyStackOverflow(yypParser); - /* The call to yyStackOverflow() above pops the stack until it is - ** empty, causing the main parser loop to exit. So the return value - ** is never used and does not matter. */ - return 0; - } - yymsp = yypParser->yytos; - } -#endif - } switch( yyruleno ){ /* Beginning here are the reduction cases. A typical example @@ -6045,167 +5946,167 @@ static YYACTIONTYPE yy_reduce( yy_destructor(yypParser,387,&yymsp[0].minor); break; case 24: /* ip_range_list ::= NK_STRING */ -{ yylhsminor.yy334 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy334 = yylhsminor.yy334; +{ yylhsminor.yy456 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy456 = yylhsminor.yy456; break; case 25: /* ip_range_list ::= ip_range_list NK_COMMA NK_STRING */ -{ yylhsminor.yy334 = addNodeToList(pCxt, yymsp[-2].minor.yy334, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy334 = yylhsminor.yy334; +{ yylhsminor.yy456 = addNodeToList(pCxt, yymsp[-2].minor.yy456, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy456 = yylhsminor.yy456; break; case 26: /* white_list ::= HOST ip_range_list */ -{ yymsp[-1].minor.yy334 = yymsp[0].minor.yy334; } +{ yymsp[-1].minor.yy456 = yymsp[0].minor.yy456; } break; case 27: /* white_list_opt ::= */ - case 206: /* specific_cols_opt ::= */ yytestcase(yyruleno==206); - case 244: /* tags_def_opt ::= */ yytestcase(yyruleno==244); - case 335: /* tag_list_opt ::= */ yytestcase(yyruleno==335); - case 408: /* col_list_opt ::= */ yytestcase(yyruleno==408); - case 415: /* tag_def_or_ref_opt ::= */ yytestcase(yyruleno==415); - case 697: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==697); - case 727: /* group_by_clause_opt ::= */ yytestcase(yyruleno==727); - case 747: /* order_by_clause_opt ::= */ yytestcase(yyruleno==747); -{ yymsp[1].minor.yy334 = NULL; } + case 208: /* specific_cols_opt ::= */ yytestcase(yyruleno==208); + case 246: /* tags_def_opt ::= */ yytestcase(yyruleno==246); + case 337: /* tag_list_opt ::= */ yytestcase(yyruleno==337); + case 410: /* col_list_opt ::= */ yytestcase(yyruleno==410); + case 417: /* tag_def_or_ref_opt ::= */ yytestcase(yyruleno==417); + case 699: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==699); + case 729: /* group_by_clause_opt ::= */ yytestcase(yyruleno==729); + case 749: /* order_by_clause_opt ::= */ yytestcase(yyruleno==749); +{ yymsp[1].minor.yy456 = NULL; } break; case 28: /* white_list_opt ::= white_list */ - case 245: /* tags_def_opt ::= tags_def */ yytestcase(yyruleno==245); - case 416: /* tag_def_or_ref_opt ::= tags_def */ yytestcase(yyruleno==416); - case 605: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==605); -{ yylhsminor.yy334 = yymsp[0].minor.yy334; } - yymsp[0].minor.yy334 = yylhsminor.yy334; + case 247: /* tags_def_opt ::= tags_def */ yytestcase(yyruleno==247); + case 418: /* tag_def_or_ref_opt ::= tags_def */ yytestcase(yyruleno==418); + case 607: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==607); +{ yylhsminor.yy456 = yymsp[0].minor.yy456; } + yymsp[0].minor.yy456 = yylhsminor.yy456; break; case 29: /* is_import_opt ::= */ case 31: /* is_createdb_opt ::= */ yytestcase(yyruleno==31); -{ yymsp[1].minor.yy719 = 0; } +{ yymsp[1].minor.yy343 = 0; } break; case 30: /* is_import_opt ::= IS_IMPORT NK_INTEGER */ case 32: /* is_createdb_opt ::= CREATEDB NK_INTEGER */ yytestcase(yyruleno==32); case 42: /* sysinfo_opt ::= SYSINFO NK_INTEGER */ yytestcase(yyruleno==42); -{ yymsp[-1].minor.yy719 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); } +{ yymsp[-1].minor.yy343 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); } break; case 33: /* cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt is_createdb_opt is_import_opt white_list_opt */ { - pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-6].minor.yy533, &yymsp[-4].minor.yy0, yymsp[-3].minor.yy719, yymsp[-1].minor.yy719, yymsp[-2].minor.yy719); - pCxt->pRootNode = addCreateUserStmtWhiteList(pCxt, pCxt->pRootNode, yymsp[0].minor.yy334); + pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-6].minor.yy209, &yymsp[-4].minor.yy0, yymsp[-3].minor.yy343, yymsp[-1].minor.yy343, yymsp[-2].minor.yy343); + pCxt->pRootNode = addCreateUserStmtWhiteList(pCxt, pCxt->pRootNode, yymsp[0].minor.yy456); } break; case 34: /* cmd ::= ALTER USER user_name PASS NK_STRING */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy533, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy209, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } break; case 35: /* cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy533, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy209, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); } break; case 36: /* cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy533, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy209, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); } break; case 37: /* cmd ::= ALTER USER user_name CREATEDB NK_INTEGER */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy533, TSDB_ALTER_USER_CREATEDB, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy209, TSDB_ALTER_USER_CREATEDB, &yymsp[0].minor.yy0); } break; case 38: /* cmd ::= ALTER USER user_name ADD white_list */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy533, TSDB_ALTER_USER_ADD_WHITE_LIST, yymsp[0].minor.yy334); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy209, TSDB_ALTER_USER_ADD_WHITE_LIST, yymsp[0].minor.yy456); } break; case 39: /* cmd ::= ALTER USER user_name DROP white_list */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy533, TSDB_ALTER_USER_DROP_WHITE_LIST, yymsp[0].minor.yy334); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy209, TSDB_ALTER_USER_DROP_WHITE_LIST, yymsp[0].minor.yy456); } break; case 40: /* cmd ::= DROP USER user_name */ -{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy533); } +{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy209); } break; case 41: /* sysinfo_opt ::= */ -{ yymsp[1].minor.yy719 = 1; } +{ yymsp[1].minor.yy343 = 1; } break; - case 43: /* cmd ::= GRANT privileges ON priv_level with_opt TO user_name */ -{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-5].minor.yy585, &yymsp[-3].minor.yy399, &yymsp[0].minor.yy533, yymsp[-2].minor.yy560); } + case 43: /* cmd ::= GRANT privileges ON priv_level with_clause_opt TO user_name */ +{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-5].minor.yy637, &yymsp[-3].minor.yy1065, &yymsp[0].minor.yy209, yymsp[-2].minor.yy840); } break; - case 44: /* cmd ::= REVOKE privileges ON priv_level with_opt FROM user_name */ -{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-5].minor.yy585, &yymsp[-3].minor.yy399, &yymsp[0].minor.yy533, yymsp[-2].minor.yy560); } + case 44: /* cmd ::= REVOKE privileges ON priv_level with_clause_opt FROM user_name */ +{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-5].minor.yy637, &yymsp[-3].minor.yy1065, &yymsp[0].minor.yy209, yymsp[-2].minor.yy840); } break; case 45: /* privileges ::= ALL */ -{ yymsp[0].minor.yy585 = PRIVILEGE_TYPE_ALL; } +{ yymsp[0].minor.yy637 = PRIVILEGE_TYPE_ALL; } break; case 46: /* privileges ::= priv_type_list */ case 48: /* priv_type_list ::= priv_type */ yytestcase(yyruleno==48); -{ yylhsminor.yy585 = yymsp[0].minor.yy585; } - yymsp[0].minor.yy585 = yylhsminor.yy585; +{ yylhsminor.yy637 = yymsp[0].minor.yy637; } + yymsp[0].minor.yy637 = yylhsminor.yy637; break; case 47: /* privileges ::= SUBSCRIBE */ -{ yymsp[0].minor.yy585 = PRIVILEGE_TYPE_SUBSCRIBE; } +{ yymsp[0].minor.yy637 = PRIVILEGE_TYPE_SUBSCRIBE; } break; case 49: /* priv_type_list ::= priv_type_list NK_COMMA priv_type */ -{ yylhsminor.yy585 = yymsp[-2].minor.yy585 | yymsp[0].minor.yy585; } - yymsp[-2].minor.yy585 = yylhsminor.yy585; +{ yylhsminor.yy637 = yymsp[-2].minor.yy637 | yymsp[0].minor.yy637; } + yymsp[-2].minor.yy637 = yylhsminor.yy637; break; case 50: /* priv_type ::= READ */ -{ yymsp[0].minor.yy585 = PRIVILEGE_TYPE_READ; } +{ yymsp[0].minor.yy637 = PRIVILEGE_TYPE_READ; } break; case 51: /* priv_type ::= WRITE */ -{ yymsp[0].minor.yy585 = PRIVILEGE_TYPE_WRITE; } +{ yymsp[0].minor.yy637 = PRIVILEGE_TYPE_WRITE; } break; case 52: /* priv_type ::= ALTER */ -{ yymsp[0].minor.yy585 = PRIVILEGE_TYPE_ALTER; } +{ yymsp[0].minor.yy637 = PRIVILEGE_TYPE_ALTER; } break; case 53: /* priv_level ::= NK_STAR NK_DOT NK_STAR */ -{ yylhsminor.yy399.first = yymsp[-2].minor.yy0; yylhsminor.yy399.second = yymsp[0].minor.yy0; } - yymsp[-2].minor.yy399 = yylhsminor.yy399; +{ yylhsminor.yy1065.first = yymsp[-2].minor.yy0; yylhsminor.yy1065.second = yymsp[0].minor.yy0; } + yymsp[-2].minor.yy1065 = yylhsminor.yy1065; break; case 54: /* priv_level ::= db_name NK_DOT NK_STAR */ -{ yylhsminor.yy399.first = yymsp[-2].minor.yy533; yylhsminor.yy399.second = yymsp[0].minor.yy0; } - yymsp[-2].minor.yy399 = yylhsminor.yy399; +{ yylhsminor.yy1065.first = yymsp[-2].minor.yy209; yylhsminor.yy1065.second = yymsp[0].minor.yy0; } + yymsp[-2].minor.yy1065 = yylhsminor.yy1065; break; case 55: /* priv_level ::= db_name NK_DOT table_name */ -{ yylhsminor.yy399.first = yymsp[-2].minor.yy533; yylhsminor.yy399.second = yymsp[0].minor.yy533; } - yymsp[-2].minor.yy399 = yylhsminor.yy399; +{ yylhsminor.yy1065.first = yymsp[-2].minor.yy209; yylhsminor.yy1065.second = yymsp[0].minor.yy209; } + yymsp[-2].minor.yy1065 = yylhsminor.yy1065; break; case 56: /* priv_level ::= topic_name */ -{ yylhsminor.yy399.first = yymsp[0].minor.yy533; yylhsminor.yy399.second = nil_token; } - yymsp[0].minor.yy399 = yylhsminor.yy399; +{ yylhsminor.yy1065.first = yymsp[0].minor.yy209; yylhsminor.yy1065.second = nil_token; } + yymsp[0].minor.yy1065 = yylhsminor.yy1065; break; - case 57: /* with_opt ::= */ + case 57: /* with_clause_opt ::= */ case 173: /* start_opt ::= */ yytestcase(yyruleno==173); case 177: /* end_opt ::= */ yytestcase(yyruleno==177); - case 330: /* like_pattern_opt ::= */ yytestcase(yyruleno==330); - case 428: /* subtable_opt ::= */ yytestcase(yyruleno==428); - case 615: /* case_when_else_opt ::= */ yytestcase(yyruleno==615); - case 645: /* from_clause_opt ::= */ yytestcase(yyruleno==645); - case 672: /* join_on_clause_opt ::= */ yytestcase(yyruleno==672); - case 674: /* window_offset_clause_opt ::= */ yytestcase(yyruleno==674); - case 678: /* jlimit_clause_opt ::= */ yytestcase(yyruleno==678); - case 695: /* where_clause_opt ::= */ yytestcase(yyruleno==695); - case 704: /* twindow_clause_opt ::= */ yytestcase(yyruleno==704); - case 712: /* sliding_opt ::= */ yytestcase(yyruleno==712); - case 717: /* fill_opt ::= */ yytestcase(yyruleno==717); - case 731: /* having_clause_opt ::= */ yytestcase(yyruleno==731); - case 733: /* range_opt ::= */ yytestcase(yyruleno==733); - case 736: /* every_opt ::= */ yytestcase(yyruleno==736); - case 749: /* slimit_clause_opt ::= */ yytestcase(yyruleno==749); - case 753: /* limit_clause_opt ::= */ yytestcase(yyruleno==753); -{ yymsp[1].minor.yy560 = NULL; } - break; - case 58: /* with_opt ::= WITH search_condition */ - case 646: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==646); - case 673: /* join_on_clause_opt ::= ON search_condition */ yytestcase(yyruleno==673); - case 696: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==696); - case 732: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==732); -{ yymsp[-1].minor.yy560 = yymsp[0].minor.yy560; } + case 332: /* like_pattern_opt ::= */ yytestcase(yyruleno==332); + case 430: /* subtable_opt ::= */ yytestcase(yyruleno==430); + case 617: /* case_when_else_opt ::= */ yytestcase(yyruleno==617); + case 647: /* from_clause_opt ::= */ yytestcase(yyruleno==647); + case 674: /* join_on_clause_opt ::= */ yytestcase(yyruleno==674); + case 676: /* window_offset_clause_opt ::= */ yytestcase(yyruleno==676); + case 680: /* jlimit_clause_opt ::= */ yytestcase(yyruleno==680); + case 697: /* where_clause_opt ::= */ yytestcase(yyruleno==697); + case 706: /* twindow_clause_opt ::= */ yytestcase(yyruleno==706); + case 714: /* sliding_opt ::= */ yytestcase(yyruleno==714); + case 719: /* fill_opt ::= */ yytestcase(yyruleno==719); + case 733: /* having_clause_opt ::= */ yytestcase(yyruleno==733); + case 735: /* range_opt ::= */ yytestcase(yyruleno==735); + case 738: /* every_opt ::= */ yytestcase(yyruleno==738); + case 751: /* slimit_clause_opt ::= */ yytestcase(yyruleno==751); + case 755: /* limit_clause_opt ::= */ yytestcase(yyruleno==755); +{ yymsp[1].minor.yy840 = NULL; } + break; + case 58: /* with_clause_opt ::= WITH search_condition */ + case 648: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==648); + case 675: /* join_on_clause_opt ::= ON search_condition */ yytestcase(yyruleno==675); + case 698: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==698); + case 734: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==734); +{ yymsp[-1].minor.yy840 = yymsp[0].minor.yy840; } break; case 59: /* cmd ::= CREATE ENCRYPT_KEY NK_STRING */ { pCxt->pRootNode = createEncryptKeyStmt(pCxt, &yymsp[0].minor.yy0); } break; case 60: /* cmd ::= CREATE DNODE dnode_endpoint */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy533, NULL); } +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy209, NULL); } break; case 61: /* cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy533, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy209, &yymsp[0].minor.yy0); } break; case 62: /* cmd ::= DROP DNODE NK_INTEGER force_opt */ -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy173, false); } +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy9, false); } break; case 63: /* cmd ::= DROP DNODE dnode_endpoint force_opt */ -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy533, yymsp[0].minor.yy173, false); } +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy209, yymsp[0].minor.yy9, false); } break; case 64: /* cmd ::= DROP DNODE NK_INTEGER unsafe_opt */ -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, false, yymsp[0].minor.yy173); } +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, false, yymsp[0].minor.yy9); } break; case 65: /* cmd ::= DROP DNODE dnode_endpoint unsafe_opt */ -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy533, false, yymsp[0].minor.yy173); } +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy209, false, yymsp[0].minor.yy9); } break; case 66: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, NULL); } @@ -6225,61 +6126,63 @@ static YYACTIONTYPE yy_reduce( case 71: /* dnode_endpoint ::= NK_STRING */ case 72: /* dnode_endpoint ::= NK_ID */ yytestcase(yyruleno==72); case 73: /* dnode_endpoint ::= NK_IPTOKEN */ yytestcase(yyruleno==73); - case 364: /* sma_func_name ::= COUNT */ yytestcase(yyruleno==364); - case 365: /* sma_func_name ::= FIRST */ yytestcase(yyruleno==365); - case 366: /* sma_func_name ::= LAST */ yytestcase(yyruleno==366); - case 367: /* sma_func_name ::= LAST_ROW */ yytestcase(yyruleno==367); - case 516: /* db_name ::= NK_ID */ yytestcase(yyruleno==516); - case 517: /* table_name ::= NK_ID */ yytestcase(yyruleno==517); - case 518: /* column_name ::= NK_ID */ yytestcase(yyruleno==518); - case 519: /* function_name ::= NK_ID */ yytestcase(yyruleno==519); - case 520: /* view_name ::= NK_ID */ yytestcase(yyruleno==520); - case 521: /* table_alias ::= NK_ID */ yytestcase(yyruleno==521); - case 522: /* column_alias ::= NK_ID */ yytestcase(yyruleno==522); - case 523: /* column_alias ::= NK_ALIAS */ yytestcase(yyruleno==523); - case 524: /* user_name ::= NK_ID */ yytestcase(yyruleno==524); - case 525: /* topic_name ::= NK_ID */ yytestcase(yyruleno==525); - case 526: /* stream_name ::= NK_ID */ yytestcase(yyruleno==526); - case 527: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==527); - case 528: /* index_name ::= NK_ID */ yytestcase(yyruleno==528); - case 529: /* tsma_name ::= NK_ID */ yytestcase(yyruleno==529); - case 585: /* substr_func ::= SUBSTR */ yytestcase(yyruleno==585); - case 586: /* substr_func ::= SUBSTRING */ yytestcase(yyruleno==586); - case 590: /* noarg_func ::= NOW */ yytestcase(yyruleno==590); - case 591: /* noarg_func ::= TODAY */ yytestcase(yyruleno==591); - case 592: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==592); - case 593: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==593); - case 594: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==594); - case 595: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==595); - case 596: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==596); - case 597: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==597); - case 598: /* noarg_func ::= USER */ yytestcase(yyruleno==598); - case 599: /* noarg_func ::= PI */ yytestcase(yyruleno==599); - case 600: /* star_func ::= COUNT */ yytestcase(yyruleno==600); - case 601: /* star_func ::= FIRST */ yytestcase(yyruleno==601); - case 602: /* star_func ::= LAST */ yytestcase(yyruleno==602); - case 603: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==603); -{ yylhsminor.yy533 = yymsp[0].minor.yy0; } - yymsp[0].minor.yy533 = yylhsminor.yy533; + case 366: /* sma_func_name ::= COUNT */ yytestcase(yyruleno==366); + case 367: /* sma_func_name ::= FIRST */ yytestcase(yyruleno==367); + case 368: /* sma_func_name ::= LAST */ yytestcase(yyruleno==368); + case 369: /* sma_func_name ::= LAST_ROW */ yytestcase(yyruleno==369); + case 518: /* db_name ::= NK_ID */ yytestcase(yyruleno==518); + case 519: /* table_name ::= NK_ID */ yytestcase(yyruleno==519); + case 520: /* column_name ::= NK_ID */ yytestcase(yyruleno==520); + case 521: /* function_name ::= NK_ID */ yytestcase(yyruleno==521); + case 522: /* view_name ::= NK_ID */ yytestcase(yyruleno==522); + case 523: /* table_alias ::= NK_ID */ yytestcase(yyruleno==523); + case 524: /* column_alias ::= NK_ID */ yytestcase(yyruleno==524); + case 525: /* column_alias ::= NK_ALIAS */ yytestcase(yyruleno==525); + case 526: /* user_name ::= NK_ID */ yytestcase(yyruleno==526); + case 527: /* topic_name ::= NK_ID */ yytestcase(yyruleno==527); + case 528: /* stream_name ::= NK_ID */ yytestcase(yyruleno==528); + case 529: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==529); + case 530: /* index_name ::= NK_ID */ yytestcase(yyruleno==530); + case 531: /* tsma_name ::= NK_ID */ yytestcase(yyruleno==531); + case 587: /* substr_func ::= SUBSTR */ yytestcase(yyruleno==587); + case 588: /* substr_func ::= SUBSTRING */ yytestcase(yyruleno==588); + case 592: /* noarg_func ::= NOW */ yytestcase(yyruleno==592); + case 593: /* noarg_func ::= TODAY */ yytestcase(yyruleno==593); + case 594: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==594); + case 595: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==595); + case 596: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==596); + case 597: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==597); + case 598: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==598); + case 599: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==599); + case 600: /* noarg_func ::= USER */ yytestcase(yyruleno==600); + case 601: /* noarg_func ::= PI */ yytestcase(yyruleno==601); + case 602: /* star_func ::= COUNT */ yytestcase(yyruleno==602); + case 603: /* star_func ::= FIRST */ yytestcase(yyruleno==603); + case 604: /* star_func ::= LAST */ yytestcase(yyruleno==604); + case 605: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==605); +{ yylhsminor.yy209 = yymsp[0].minor.yy0; } + yymsp[0].minor.yy209 = yylhsminor.yy209; break; case 74: /* force_opt ::= */ case 101: /* not_exists_opt ::= */ yytestcase(yyruleno==101); case 103: /* exists_opt ::= */ yytestcase(yyruleno==103); - case 385: /* analyze_opt ::= */ yytestcase(yyruleno==385); - case 392: /* agg_func_opt ::= */ yytestcase(yyruleno==392); - case 398: /* or_replace_opt ::= */ yytestcase(yyruleno==398); - case 430: /* ignore_opt ::= */ yytestcase(yyruleno==430); - case 683: /* tag_mode_opt ::= */ yytestcase(yyruleno==683); - case 685: /* set_quantifier_opt ::= */ yytestcase(yyruleno==685); -{ yymsp[1].minor.yy173 = false; } + case 206: /* with_opt ::= */ yytestcase(yyruleno==206); + case 387: /* analyze_opt ::= */ yytestcase(yyruleno==387); + case 394: /* agg_func_opt ::= */ yytestcase(yyruleno==394); + case 400: /* or_replace_opt ::= */ yytestcase(yyruleno==400); + case 432: /* ignore_opt ::= */ yytestcase(yyruleno==432); + case 685: /* tag_mode_opt ::= */ yytestcase(yyruleno==685); + case 687: /* set_quantifier_opt ::= */ yytestcase(yyruleno==687); +{ yymsp[1].minor.yy9 = false; } break; case 75: /* force_opt ::= FORCE */ case 76: /* unsafe_opt ::= UNSAFE */ yytestcase(yyruleno==76); - case 386: /* analyze_opt ::= ANALYZE */ yytestcase(yyruleno==386); - case 393: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==393); - case 684: /* tag_mode_opt ::= TAGS */ yytestcase(yyruleno==684); - case 686: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==686); -{ yymsp[0].minor.yy173 = true; } + case 207: /* with_opt ::= WITH */ yytestcase(yyruleno==207); + case 388: /* analyze_opt ::= ANALYZE */ yytestcase(yyruleno==388); + case 395: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==395); + case 686: /* tag_mode_opt ::= TAGS */ yytestcase(yyruleno==686); + case 688: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==688); +{ yymsp[0].minor.yy9 = true; } break; case 77: /* cmd ::= ALTER CLUSTER NK_STRING */ { pCxt->pRootNode = createAlterClusterStmt(pCxt, &yymsp[0].minor.yy0, NULL); } @@ -6327,1824 +6230,1824 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_VNODE_STMT, &yymsp[0].minor.yy0); } break; case 92: /* cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ -{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy173, &yymsp[-1].minor.yy533, yymsp[0].minor.yy560); } +{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy9, &yymsp[-1].minor.yy209, yymsp[0].minor.yy840); } break; case 93: /* cmd ::= DROP DATABASE exists_opt db_name */ -{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy173, &yymsp[0].minor.yy533); } +{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy9, &yymsp[0].minor.yy209); } break; case 94: /* cmd ::= USE db_name */ -{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy533); } +{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy209); } break; case 95: /* cmd ::= ALTER DATABASE db_name alter_db_options */ -{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy533, yymsp[0].minor.yy560); } +{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy209, yymsp[0].minor.yy840); } break; case 96: /* cmd ::= FLUSH DATABASE db_name */ -{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy533); } +{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy209); } break; case 97: /* cmd ::= TRIM DATABASE db_name speed_opt */ -{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy533, yymsp[0].minor.yy802); } +{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy209, yymsp[0].minor.yy516); } break; case 98: /* cmd ::= S3MIGRATE DATABASE db_name */ -{ pCxt->pRootNode = createS3MigrateDatabaseStmt(pCxt, &yymsp[0].minor.yy533); } +{ pCxt->pRootNode = createS3MigrateDatabaseStmt(pCxt, &yymsp[0].minor.yy209); } break; case 99: /* cmd ::= COMPACT DATABASE db_name start_opt end_opt */ -{ pCxt->pRootNode = createCompactStmt(pCxt, &yymsp[-2].minor.yy533, yymsp[-1].minor.yy560, yymsp[0].minor.yy560); } +{ pCxt->pRootNode = createCompactStmt(pCxt, &yymsp[-2].minor.yy209, yymsp[-1].minor.yy840, yymsp[0].minor.yy840); } break; case 100: /* not_exists_opt ::= IF NOT EXISTS */ -{ yymsp[-2].minor.yy173 = true; } +{ yymsp[-2].minor.yy9 = true; } break; case 102: /* exists_opt ::= IF EXISTS */ - case 399: /* or_replace_opt ::= OR REPLACE */ yytestcase(yyruleno==399); - case 431: /* ignore_opt ::= IGNORE UNTREATED */ yytestcase(yyruleno==431); -{ yymsp[-1].minor.yy173 = true; } + case 401: /* or_replace_opt ::= OR REPLACE */ yytestcase(yyruleno==401); + case 433: /* ignore_opt ::= IGNORE UNTREATED */ yytestcase(yyruleno==433); +{ yymsp[-1].minor.yy9 = true; } break; case 104: /* db_options ::= */ -{ yymsp[1].minor.yy560 = createDefaultDatabaseOptions(pCxt); } +{ yymsp[1].minor.yy840 = createDefaultDatabaseOptions(pCxt); } break; case 105: /* db_options ::= db_options BUFFER NK_INTEGER */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 106: /* db_options ::= db_options CACHEMODEL NK_STRING */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 107: /* db_options ::= db_options CACHESIZE NK_INTEGER */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 108: /* db_options ::= db_options COMP NK_INTEGER */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_COMP, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_COMP, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 109: /* db_options ::= db_options DURATION NK_INTEGER */ case 110: /* db_options ::= db_options DURATION NK_VARIABLE */ yytestcase(yyruleno==110); -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 111: /* db_options ::= db_options MAXROWS NK_INTEGER */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 112: /* db_options ::= db_options MINROWS NK_INTEGER */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 113: /* db_options ::= db_options KEEP integer_list */ case 114: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==114); -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_KEEP, yymsp[0].minor.yy334); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_KEEP, yymsp[0].minor.yy456); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 115: /* db_options ::= db_options PAGES NK_INTEGER */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 116: /* db_options ::= db_options PAGESIZE NK_INTEGER */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 117: /* db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 118: /* db_options ::= db_options PRECISION NK_STRING */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 119: /* db_options ::= db_options REPLICA NK_INTEGER */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 120: /* db_options ::= db_options VGROUPS NK_INTEGER */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 121: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 122: /* db_options ::= db_options RETENTIONS retention_list */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_RETENTIONS, yymsp[0].minor.yy334); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_RETENTIONS, yymsp[0].minor.yy456); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 123: /* db_options ::= db_options SCHEMALESS NK_INTEGER */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 124: /* db_options ::= db_options WAL_LEVEL NK_INTEGER */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_WAL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_WAL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 125: /* db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 126: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 127: /* 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.yy560 = setDatabaseOption(pCxt, yymsp[-3].minor.yy560, DB_OPTION_WAL_RETENTION_PERIOD, &t); + yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-3].minor.yy840, DB_OPTION_WAL_RETENTION_PERIOD, &t); } - yymsp[-3].minor.yy560 = yylhsminor.yy560; + yymsp[-3].minor.yy840 = yylhsminor.yy840; break; case 128: /* db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 129: /* 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.yy560 = setDatabaseOption(pCxt, yymsp[-3].minor.yy560, DB_OPTION_WAL_RETENTION_SIZE, &t); + yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-3].minor.yy840, DB_OPTION_WAL_RETENTION_SIZE, &t); } - yymsp[-3].minor.yy560 = yylhsminor.yy560; + yymsp[-3].minor.yy840 = yylhsminor.yy840; break; case 130: /* db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 131: /* db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 132: /* db_options ::= db_options STT_TRIGGER NK_INTEGER */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 133: /* db_options ::= db_options TABLE_PREFIX signed */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_TABLE_PREFIX, yymsp[0].minor.yy560); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_TABLE_PREFIX, yymsp[0].minor.yy840); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 134: /* db_options ::= db_options TABLE_SUFFIX signed */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_TABLE_SUFFIX, yymsp[0].minor.yy560); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_TABLE_SUFFIX, yymsp[0].minor.yy840); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 135: /* db_options ::= db_options S3_CHUNKSIZE NK_INTEGER */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_S3_CHUNKSIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_S3_CHUNKSIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 136: /* db_options ::= db_options S3_KEEPLOCAL NK_INTEGER */ case 137: /* db_options ::= db_options S3_KEEPLOCAL NK_VARIABLE */ yytestcase(yyruleno==137); -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_S3_KEEPLOCAL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_S3_KEEPLOCAL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 138: /* db_options ::= db_options S3_COMPACT NK_INTEGER */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_S3_COMPACT, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_S3_COMPACT, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 139: /* db_options ::= db_options KEEP_TIME_OFFSET NK_INTEGER */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_KEEP_TIME_OFFSET, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_KEEP_TIME_OFFSET, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 140: /* db_options ::= db_options ENCRYPT_ALGORITHM NK_STRING */ -{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_ENCRYPT_ALGORITHM, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy840 = setDatabaseOption(pCxt, yymsp[-2].minor.yy840, DB_OPTION_ENCRYPT_ALGORITHM, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 141: /* alter_db_options ::= alter_db_option */ -{ yylhsminor.yy560 = createAlterDatabaseOptions(pCxt); yylhsminor.yy560 = setAlterDatabaseOption(pCxt, yylhsminor.yy560, &yymsp[0].minor.yy389); } - yymsp[0].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy840 = createAlterDatabaseOptions(pCxt); yylhsminor.yy840 = setAlterDatabaseOption(pCxt, yylhsminor.yy840, &yymsp[0].minor.yy573); } + yymsp[0].minor.yy840 = yylhsminor.yy840; break; case 142: /* alter_db_options ::= alter_db_options alter_db_option */ -{ yylhsminor.yy560 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy560, &yymsp[0].minor.yy389); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy840 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy840, &yymsp[0].minor.yy573); } + yymsp[-1].minor.yy840 = yylhsminor.yy840; break; case 143: /* alter_db_option ::= BUFFER NK_INTEGER */ -{ yymsp[-1].minor.yy389.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy573.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy573.val = yymsp[0].minor.yy0; } break; case 144: /* alter_db_option ::= CACHEMODEL NK_STRING */ -{ yymsp[-1].minor.yy389.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy573.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy573.val = yymsp[0].minor.yy0; } break; case 145: /* alter_db_option ::= CACHESIZE NK_INTEGER */ -{ yymsp[-1].minor.yy389.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy573.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy573.val = yymsp[0].minor.yy0; } break; case 146: /* alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ -{ yymsp[-1].minor.yy389.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy573.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy573.val = yymsp[0].minor.yy0; } break; case 147: /* alter_db_option ::= KEEP integer_list */ case 148: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==148); -{ yymsp[-1].minor.yy389.type = DB_OPTION_KEEP; yymsp[-1].minor.yy389.pList = yymsp[0].minor.yy334; } +{ yymsp[-1].minor.yy573.type = DB_OPTION_KEEP; yymsp[-1].minor.yy573.pList = yymsp[0].minor.yy456; } break; case 149: /* alter_db_option ::= PAGES NK_INTEGER */ -{ yymsp[-1].minor.yy389.type = DB_OPTION_PAGES; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy573.type = DB_OPTION_PAGES; yymsp[-1].minor.yy573.val = yymsp[0].minor.yy0; } break; case 150: /* alter_db_option ::= REPLICA NK_INTEGER */ -{ yymsp[-1].minor.yy389.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy573.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy573.val = yymsp[0].minor.yy0; } break; case 151: /* alter_db_option ::= WAL_LEVEL NK_INTEGER */ -{ yymsp[-1].minor.yy389.type = DB_OPTION_WAL; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy573.type = DB_OPTION_WAL; yymsp[-1].minor.yy573.val = yymsp[0].minor.yy0; } break; case 152: /* alter_db_option ::= STT_TRIGGER NK_INTEGER */ -{ yymsp[-1].minor.yy389.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy573.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy573.val = yymsp[0].minor.yy0; } break; case 153: /* alter_db_option ::= MINROWS NK_INTEGER */ -{ yymsp[-1].minor.yy389.type = DB_OPTION_MINROWS; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy573.type = DB_OPTION_MINROWS; yymsp[-1].minor.yy573.val = yymsp[0].minor.yy0; } break; case 154: /* alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */ -{ yymsp[-1].minor.yy389.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy573.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-1].minor.yy573.val = yymsp[0].minor.yy0; } break; case 155: /* alter_db_option ::= 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; - yymsp[-2].minor.yy389.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-2].minor.yy389.val = t; + yymsp[-2].minor.yy573.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-2].minor.yy573.val = t; } break; case 156: /* alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */ -{ yymsp[-1].minor.yy389.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy573.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-1].minor.yy573.val = yymsp[0].minor.yy0; } break; case 157: /* alter_db_option ::= 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; - yymsp[-2].minor.yy389.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-2].minor.yy389.val = t; + yymsp[-2].minor.yy573.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-2].minor.yy573.val = t; } break; case 158: /* alter_db_option ::= S3_KEEPLOCAL NK_INTEGER */ case 159: /* alter_db_option ::= S3_KEEPLOCAL NK_VARIABLE */ yytestcase(yyruleno==159); -{ yymsp[-1].minor.yy389.type = DB_OPTION_S3_KEEPLOCAL; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy573.type = DB_OPTION_S3_KEEPLOCAL; yymsp[-1].minor.yy573.val = yymsp[0].minor.yy0; } break; case 160: /* alter_db_option ::= S3_COMPACT NK_INTEGER */ -{ yymsp[-1].minor.yy389.type = DB_OPTION_S3_COMPACT, yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy573.type = DB_OPTION_S3_COMPACT, yymsp[-1].minor.yy573.val = yymsp[0].minor.yy0; } break; case 161: /* alter_db_option ::= KEEP_TIME_OFFSET NK_INTEGER */ -{ yymsp[-1].minor.yy389.type = DB_OPTION_KEEP_TIME_OFFSET; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy573.type = DB_OPTION_KEEP_TIME_OFFSET; yymsp[-1].minor.yy573.val = yymsp[0].minor.yy0; } break; case 162: /* alter_db_option ::= ENCRYPT_ALGORITHM NK_STRING */ -{ yymsp[-1].minor.yy389.type = DB_OPTION_ENCRYPT_ALGORITHM; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy573.type = DB_OPTION_ENCRYPT_ALGORITHM; yymsp[-1].minor.yy573.val = yymsp[0].minor.yy0; } break; case 163: /* integer_list ::= NK_INTEGER */ -{ yylhsminor.yy334 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy334 = yylhsminor.yy334; +{ yylhsminor.yy456 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy456 = yylhsminor.yy456; break; case 164: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */ - case 445: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==445); -{ yylhsminor.yy334 = addNodeToList(pCxt, yymsp[-2].minor.yy334, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy334 = yylhsminor.yy334; + case 447: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==447); +{ yylhsminor.yy456 = addNodeToList(pCxt, yymsp[-2].minor.yy456, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy456 = yylhsminor.yy456; break; case 165: /* variable_list ::= NK_VARIABLE */ -{ yylhsminor.yy334 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy334 = yylhsminor.yy334; +{ yylhsminor.yy456 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy456 = yylhsminor.yy456; break; case 166: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */ -{ yylhsminor.yy334 = addNodeToList(pCxt, yymsp[-2].minor.yy334, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy334 = yylhsminor.yy334; +{ yylhsminor.yy456 = addNodeToList(pCxt, yymsp[-2].minor.yy456, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy456 = yylhsminor.yy456; break; case 167: /* retention_list ::= retention */ case 200: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==200); case 203: /* multi_drop_clause ::= drop_table_clause */ yytestcase(yyruleno==203); - case 210: /* tag_def_list ::= tag_def */ yytestcase(yyruleno==210); - case 213: /* column_def_list ::= column_def */ yytestcase(yyruleno==213); - case 261: /* rollup_func_list ::= rollup_func_name */ yytestcase(yyruleno==261); - case 266: /* col_name_list ::= col_name */ yytestcase(yyruleno==266); - case 336: /* tag_list_opt ::= tag_item */ yytestcase(yyruleno==336); - case 360: /* func_list ::= func */ yytestcase(yyruleno==360); - case 410: /* column_stream_def_list ::= column_stream_def */ yytestcase(yyruleno==410); - case 489: /* tags_literal_list ::= tags_literal */ yytestcase(yyruleno==489); - case 514: /* literal_list ::= signed_literal */ yytestcase(yyruleno==514); - case 606: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==606); - case 612: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==612); - case 688: /* select_list ::= select_item */ yytestcase(yyruleno==688); - case 699: /* partition_list ::= partition_item */ yytestcase(yyruleno==699); - case 760: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==760); -{ yylhsminor.yy334 = createNodeList(pCxt, yymsp[0].minor.yy560); } - yymsp[0].minor.yy334 = yylhsminor.yy334; + case 212: /* tag_def_list ::= tag_def */ yytestcase(yyruleno==212); + case 215: /* column_def_list ::= column_def */ yytestcase(yyruleno==215); + case 263: /* rollup_func_list ::= rollup_func_name */ yytestcase(yyruleno==263); + case 268: /* col_name_list ::= col_name */ yytestcase(yyruleno==268); + case 338: /* tag_list_opt ::= tag_item */ yytestcase(yyruleno==338); + case 362: /* func_list ::= func */ yytestcase(yyruleno==362); + case 412: /* column_stream_def_list ::= column_stream_def */ yytestcase(yyruleno==412); + case 491: /* tags_literal_list ::= tags_literal */ yytestcase(yyruleno==491); + case 516: /* literal_list ::= signed_literal */ yytestcase(yyruleno==516); + case 608: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==608); + case 614: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==614); + case 690: /* select_list ::= select_item */ yytestcase(yyruleno==690); + case 701: /* partition_list ::= partition_item */ yytestcase(yyruleno==701); + case 762: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==762); +{ yylhsminor.yy456 = createNodeList(pCxt, yymsp[0].minor.yy840); } + yymsp[0].minor.yy456 = yylhsminor.yy456; break; case 168: /* retention_list ::= retention_list NK_COMMA retention */ case 204: /* multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ yytestcase(yyruleno==204); - case 211: /* tag_def_list ::= tag_def_list NK_COMMA tag_def */ yytestcase(yyruleno==211); - case 214: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==214); - case 262: /* rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ yytestcase(yyruleno==262); - case 267: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==267); - case 337: /* tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ yytestcase(yyruleno==337); - case 361: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==361); - case 411: /* column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def */ yytestcase(yyruleno==411); - case 490: /* tags_literal_list ::= tags_literal_list NK_COMMA tags_literal */ yytestcase(yyruleno==490); - case 515: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==515); - case 607: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==607); - case 689: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==689); - case 700: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==700); - case 761: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==761); -{ yylhsminor.yy334 = addNodeToList(pCxt, yymsp[-2].minor.yy334, yymsp[0].minor.yy560); } - yymsp[-2].minor.yy334 = yylhsminor.yy334; + case 213: /* tag_def_list ::= tag_def_list NK_COMMA tag_def */ yytestcase(yyruleno==213); + case 216: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==216); + case 264: /* rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ yytestcase(yyruleno==264); + case 269: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==269); + case 339: /* tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ yytestcase(yyruleno==339); + case 363: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==363); + case 413: /* column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def */ yytestcase(yyruleno==413); + case 492: /* tags_literal_list ::= tags_literal_list NK_COMMA tags_literal */ yytestcase(yyruleno==492); + case 517: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==517); + case 609: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==609); + case 691: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==691); + case 702: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==702); + case 763: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==763); +{ yylhsminor.yy456 = addNodeToList(pCxt, yymsp[-2].minor.yy456, yymsp[0].minor.yy840); } + yymsp[-2].minor.yy456 = yylhsminor.yy456; break; case 169: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ case 170: /* retention ::= NK_MINUS NK_COLON NK_VARIABLE */ yytestcase(yyruleno==170); -{ yylhsminor.yy560 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy840 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; case 171: /* speed_opt ::= */ - case 394: /* bufsize_opt ::= */ yytestcase(yyruleno==394); -{ yymsp[1].minor.yy802 = 0; } + case 396: /* bufsize_opt ::= */ yytestcase(yyruleno==396); +{ yymsp[1].minor.yy516 = 0; } break; case 172: /* speed_opt ::= BWLIMIT NK_INTEGER */ - case 395: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==395); -{ yymsp[-1].minor.yy802 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } + case 397: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==397); +{ yymsp[-1].minor.yy516 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } break; case 174: /* start_opt ::= START WITH NK_INTEGER */ case 178: /* end_opt ::= END WITH NK_INTEGER */ yytestcase(yyruleno==178); -{ yymsp[-2].minor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } +{ yymsp[-2].minor.yy840 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } break; case 175: /* start_opt ::= START WITH NK_STRING */ case 179: /* end_opt ::= END WITH NK_STRING */ yytestcase(yyruleno==179); -{ yymsp[-2].minor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } +{ yymsp[-2].minor.yy840 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } break; case 176: /* start_opt ::= START WITH TIMESTAMP NK_STRING */ case 180: /* end_opt ::= END WITH TIMESTAMP NK_STRING */ yytestcase(yyruleno==180); -{ yymsp[-3].minor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } +{ yymsp[-3].minor.yy840 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } break; case 181: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ case 184: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==184); -{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy173, yymsp[-5].minor.yy560, yymsp[-3].minor.yy334, yymsp[-1].minor.yy334, yymsp[0].minor.yy560); } +{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy9, yymsp[-5].minor.yy840, yymsp[-3].minor.yy456, yymsp[-1].minor.yy456, yymsp[0].minor.yy840); } break; case 182: /* cmd ::= CREATE TABLE multi_create_clause */ -{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy334); } +{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy456); } break; case 183: /* cmd ::= CREATE TABLE not_exists_opt USING full_table_name NK_LP tag_list_opt NK_RP FILE NK_STRING */ -{ pCxt->pRootNode = createCreateSubTableFromFileClause(pCxt, yymsp[-7].minor.yy173, yymsp[-5].minor.yy560, yymsp[-3].minor.yy334, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createCreateSubTableFromFileClause(pCxt, yymsp[-7].minor.yy9, yymsp[-5].minor.yy840, yymsp[-3].minor.yy456, &yymsp[0].minor.yy0); } break; - case 185: /* cmd ::= DROP TABLE multi_drop_clause */ -{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy334); } + case 185: /* cmd ::= DROP TABLE with_opt multi_drop_clause */ +{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[-1].minor.yy9, yymsp[0].minor.yy456); } break; - case 186: /* cmd ::= DROP STABLE exists_opt full_table_name */ -{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy173, yymsp[0].minor.yy560); } + case 186: /* cmd ::= DROP STABLE with_opt exists_opt full_table_name */ +{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-2].minor.yy9, yymsp[-1].minor.yy9, yymsp[0].minor.yy840); } break; case 187: /* cmd ::= ALTER TABLE alter_table_clause */ - case 447: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==447); - case 448: /* cmd ::= insert_query */ yytestcase(yyruleno==448); -{ pCxt->pRootNode = yymsp[0].minor.yy560; } + case 449: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==449); + case 450: /* cmd ::= insert_query */ yytestcase(yyruleno==450); +{ pCxt->pRootNode = yymsp[0].minor.yy840; } break; case 188: /* cmd ::= ALTER STABLE alter_table_clause */ -{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy560); } +{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy840); } break; case 189: /* alter_table_clause ::= full_table_name alter_table_options */ -{ yylhsminor.yy560 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy560, yymsp[0].minor.yy560); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy840 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy840, yymsp[0].minor.yy840); } + yymsp[-1].minor.yy840 = yylhsminor.yy840; break; case 190: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name column_options */ -{ yylhsminor.yy560 = createAlterTableAddModifyColOptions2(pCxt, yymsp[-5].minor.yy560, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-2].minor.yy533, yymsp[-1].minor.yy952, yymsp[0].minor.yy560); } - yymsp[-5].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy840 = createAlterTableAddModifyColOptions2(pCxt, yymsp[-5].minor.yy840, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-2].minor.yy209, yymsp[-1].minor.yy48, yymsp[0].minor.yy840); } + yymsp[-5].minor.yy840 = yylhsminor.yy840; break; case 191: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ -{ yylhsminor.yy560 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy560, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy533); } - yymsp[-3].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy840 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy840, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy209); } + yymsp[-3].minor.yy840 = yylhsminor.yy840; break; case 192: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ -{ yylhsminor.yy560 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy560, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy533, yymsp[0].minor.yy952); } - yymsp[-4].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy840 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy840, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy209, yymsp[0].minor.yy48); } + yymsp[-4].minor.yy840 = yylhsminor.yy840; break; case 193: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name column_options */ -{ yylhsminor.yy560 = createAlterTableAddModifyColOptions(pCxt, yymsp[-4].minor.yy560, TSDB_ALTER_TABLE_UPDATE_COLUMN_COMPRESS, &yymsp[-1].minor.yy533, yymsp[0].minor.yy560); } - yymsp[-4].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy840 = createAlterTableAddModifyColOptions(pCxt, yymsp[-4].minor.yy840, TSDB_ALTER_TABLE_UPDATE_COLUMN_COMPRESS, &yymsp[-1].minor.yy209, yymsp[0].minor.yy840); } + yymsp[-4].minor.yy840 = yylhsminor.yy840; break; case 194: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ -{ yylhsminor.yy560 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy560, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy533, &yymsp[0].minor.yy533); } - yymsp[-4].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy840 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy840, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy209, &yymsp[0].minor.yy209); } + yymsp[-4].minor.yy840 = yylhsminor.yy840; break; case 195: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ -{ yylhsminor.yy560 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy560, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy533, yymsp[0].minor.yy952); } - yymsp[-4].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy840 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy840, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy209, yymsp[0].minor.yy48); } + yymsp[-4].minor.yy840 = yylhsminor.yy840; break; case 196: /* alter_table_clause ::= full_table_name DROP TAG column_name */ -{ yylhsminor.yy560 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy560, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy533); } - yymsp[-3].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy840 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy840, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy209); } + yymsp[-3].minor.yy840 = yylhsminor.yy840; break; case 197: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ -{ yylhsminor.yy560 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy560, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy533, yymsp[0].minor.yy952); } - yymsp[-4].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy840 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy840, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy209, yymsp[0].minor.yy48); } + yymsp[-4].minor.yy840 = yylhsminor.yy840; break; case 198: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ -{ yylhsminor.yy560 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy560, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy533, &yymsp[0].minor.yy533); } - yymsp[-4].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy840 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy840, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy209, &yymsp[0].minor.yy209); } + yymsp[-4].minor.yy840 = yylhsminor.yy840; break; case 199: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ tags_literal */ -{ yylhsminor.yy560 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy560, &yymsp[-2].minor.yy533, yymsp[0].minor.yy560); } - yymsp[-5].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy840 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy840, &yymsp[-2].minor.yy209, yymsp[0].minor.yy840); } + yymsp[-5].minor.yy840 = yylhsminor.yy840; break; case 201: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ - case 613: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==613); -{ yylhsminor.yy334 = addNodeToList(pCxt, yymsp[-1].minor.yy334, yymsp[0].minor.yy560); } - yymsp[-1].minor.yy334 = yylhsminor.yy334; + case 615: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==615); +{ yylhsminor.yy456 = addNodeToList(pCxt, yymsp[-1].minor.yy456, yymsp[0].minor.yy840); } + yymsp[-1].minor.yy456 = yylhsminor.yy456; break; case 202: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP tags_literal_list NK_RP table_options */ -{ yylhsminor.yy560 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy173, yymsp[-8].minor.yy560, yymsp[-6].minor.yy560, yymsp[-5].minor.yy334, yymsp[-2].minor.yy334, yymsp[0].minor.yy560); } - yymsp[-9].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy840 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy9, yymsp[-8].minor.yy840, yymsp[-6].minor.yy840, yymsp[-5].minor.yy456, yymsp[-2].minor.yy456, yymsp[0].minor.yy840); } + yymsp[-9].minor.yy840 = yylhsminor.yy840; break; case 205: /* drop_table_clause ::= exists_opt full_table_name */ -{ yylhsminor.yy560 = createDropTableClause(pCxt, yymsp[-1].minor.yy173, yymsp[0].minor.yy560); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; +{ yylhsminor.yy840 = createDropTableClause(pCxt, yymsp[-1].minor.yy9, yymsp[0].minor.yy840); } + yymsp[-1].minor.yy840 = yylhsminor.yy840; break; - case 207: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */ - case 409: /* col_list_opt ::= NK_LP column_stream_def_list NK_RP */ yytestcase(yyruleno==409); -{ yymsp[-2].minor.yy334 = yymsp[-1].minor.yy334; } + case 209: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */ + case 411: /* col_list_opt ::= NK_LP column_stream_def_list NK_RP */ yytestcase(yyruleno==411); +{ yymsp[-2].minor.yy456 = yymsp[-1].minor.yy456; } break; - case 208: /* full_table_name ::= table_name */ - case 350: /* full_tsma_name ::= tsma_name */ yytestcase(yyruleno==350); -{ yylhsminor.yy560 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy533, NULL); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 210: /* full_table_name ::= table_name */ + case 352: /* full_tsma_name ::= tsma_name */ yytestcase(yyruleno==352); +{ yylhsminor.yy840 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy209, NULL); } + yymsp[0].minor.yy840 = yylhsminor.yy840; break; - case 209: /* full_table_name ::= db_name NK_DOT table_name */ - case 351: /* full_tsma_name ::= db_name NK_DOT tsma_name */ yytestcase(yyruleno==351); -{ yylhsminor.yy560 = createRealTableNode(pCxt, &yymsp[-2].minor.yy533, &yymsp[0].minor.yy533, NULL); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 211: /* full_table_name ::= db_name NK_DOT table_name */ + case 353: /* full_tsma_name ::= db_name NK_DOT tsma_name */ yytestcase(yyruleno==353); +{ yylhsminor.yy840 = createRealTableNode(pCxt, &yymsp[-2].minor.yy209, &yymsp[0].minor.yy209, NULL); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; - case 212: /* tag_def ::= column_name type_name */ -{ yylhsminor.yy560 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy533, yymsp[0].minor.yy952, NULL); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; + case 214: /* tag_def ::= column_name type_name */ +{ yylhsminor.yy840 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy209, yymsp[0].minor.yy48, NULL); } + yymsp[-1].minor.yy840 = yylhsminor.yy840; break; - case 215: /* column_def ::= column_name type_name column_options */ -{ yylhsminor.yy560 = createColumnDefNode(pCxt, &yymsp[-2].minor.yy533, yymsp[-1].minor.yy952, yymsp[0].minor.yy560); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 217: /* column_def ::= column_name type_name column_options */ +{ yylhsminor.yy840 = createColumnDefNode(pCxt, &yymsp[-2].minor.yy209, yymsp[-1].minor.yy48, yymsp[0].minor.yy840); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; - case 216: /* type_name ::= BOOL */ -{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_BOOL); } + case 218: /* type_name ::= BOOL */ +{ yymsp[0].minor.yy48 = createDataType(TSDB_DATA_TYPE_BOOL); } break; - case 217: /* type_name ::= TINYINT */ -{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_TINYINT); } + case 219: /* type_name ::= TINYINT */ +{ yymsp[0].minor.yy48 = createDataType(TSDB_DATA_TYPE_TINYINT); } break; - case 218: /* type_name ::= SMALLINT */ -{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_SMALLINT); } + case 220: /* type_name ::= SMALLINT */ +{ yymsp[0].minor.yy48 = createDataType(TSDB_DATA_TYPE_SMALLINT); } break; - case 219: /* type_name ::= INT */ - case 220: /* type_name ::= INTEGER */ yytestcase(yyruleno==220); -{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_INT); } + case 221: /* type_name ::= INT */ + case 222: /* type_name ::= INTEGER */ yytestcase(yyruleno==222); +{ yymsp[0].minor.yy48 = createDataType(TSDB_DATA_TYPE_INT); } break; - case 221: /* type_name ::= BIGINT */ -{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_BIGINT); } + case 223: /* type_name ::= BIGINT */ +{ yymsp[0].minor.yy48 = createDataType(TSDB_DATA_TYPE_BIGINT); } break; - case 222: /* type_name ::= FLOAT */ -{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_FLOAT); } + case 224: /* type_name ::= FLOAT */ +{ yymsp[0].minor.yy48 = createDataType(TSDB_DATA_TYPE_FLOAT); } break; - case 223: /* type_name ::= DOUBLE */ -{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_DOUBLE); } + case 225: /* type_name ::= DOUBLE */ +{ yymsp[0].minor.yy48 = createDataType(TSDB_DATA_TYPE_DOUBLE); } break; - case 224: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } + case 226: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy48 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } break; - case 225: /* type_name ::= TIMESTAMP */ -{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } + case 227: /* type_name ::= TIMESTAMP */ +{ yymsp[0].minor.yy48 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } break; - case 226: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } + case 228: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy48 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } break; - case 227: /* type_name ::= TINYINT UNSIGNED */ -{ yymsp[-1].minor.yy952 = createDataType(TSDB_DATA_TYPE_UTINYINT); } + case 229: /* type_name ::= TINYINT UNSIGNED */ +{ yymsp[-1].minor.yy48 = createDataType(TSDB_DATA_TYPE_UTINYINT); } break; - case 228: /* type_name ::= SMALLINT UNSIGNED */ -{ yymsp[-1].minor.yy952 = createDataType(TSDB_DATA_TYPE_USMALLINT); } + case 230: /* type_name ::= SMALLINT UNSIGNED */ +{ yymsp[-1].minor.yy48 = createDataType(TSDB_DATA_TYPE_USMALLINT); } break; - case 229: /* type_name ::= INT UNSIGNED */ -{ yymsp[-1].minor.yy952 = createDataType(TSDB_DATA_TYPE_UINT); } + case 231: /* type_name ::= INT UNSIGNED */ +{ yymsp[-1].minor.yy48 = createDataType(TSDB_DATA_TYPE_UINT); } break; - case 230: /* type_name ::= BIGINT UNSIGNED */ -{ yymsp[-1].minor.yy952 = createDataType(TSDB_DATA_TYPE_UBIGINT); } + case 232: /* type_name ::= BIGINT UNSIGNED */ +{ yymsp[-1].minor.yy48 = createDataType(TSDB_DATA_TYPE_UBIGINT); } break; - case 231: /* type_name ::= JSON */ -{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_JSON); } + case 233: /* type_name ::= JSON */ +{ yymsp[0].minor.yy48 = createDataType(TSDB_DATA_TYPE_JSON); } break; - case 232: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } + case 234: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy48 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } break; - case 233: /* type_name ::= MEDIUMBLOB */ -{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } + case 235: /* type_name ::= MEDIUMBLOB */ +{ yymsp[0].minor.yy48 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } break; - case 234: /* type_name ::= BLOB */ -{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_BLOB); } + case 236: /* type_name ::= BLOB */ +{ yymsp[0].minor.yy48 = createDataType(TSDB_DATA_TYPE_BLOB); } break; - case 235: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } + case 237: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy48 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } break; - case 236: /* type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_GEOMETRY, &yymsp[-1].minor.yy0); } + case 238: /* type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy48 = createVarLenDataType(TSDB_DATA_TYPE_GEOMETRY, &yymsp[-1].minor.yy0); } break; - case 237: /* type_name ::= DECIMAL */ -{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_DECIMAL); } + case 239: /* type_name ::= DECIMAL */ +{ yymsp[0].minor.yy48 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; - case 238: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy952 = createDataType(TSDB_DATA_TYPE_DECIMAL); } + case 240: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy48 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; - case 239: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ -{ yymsp[-5].minor.yy952 = createDataType(TSDB_DATA_TYPE_DECIMAL); } + case 241: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ +{ yymsp[-5].minor.yy48 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; - case 240: /* type_name_default_len ::= BINARY */ -{ yymsp[0].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, NULL); } + case 242: /* type_name_default_len ::= BINARY */ +{ yymsp[0].minor.yy48 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, NULL); } break; - case 241: /* type_name_default_len ::= NCHAR */ -{ yymsp[0].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, NULL); } + case 243: /* type_name_default_len ::= NCHAR */ +{ yymsp[0].minor.yy48 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, NULL); } break; - case 242: /* type_name_default_len ::= VARCHAR */ -{ yymsp[0].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, NULL); } + case 244: /* type_name_default_len ::= VARCHAR */ +{ yymsp[0].minor.yy48 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, NULL); } break; - case 243: /* type_name_default_len ::= VARBINARY */ -{ yymsp[0].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, NULL); } + case 245: /* type_name_default_len ::= VARBINARY */ +{ yymsp[0].minor.yy48 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, NULL); } break; - case 246: /* tags_def ::= TAGS NK_LP tag_def_list NK_RP */ - case 417: /* tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP */ yytestcase(yyruleno==417); -{ yymsp[-3].minor.yy334 = yymsp[-1].minor.yy334; } + case 248: /* tags_def ::= TAGS NK_LP tag_def_list NK_RP */ + case 419: /* tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP */ yytestcase(yyruleno==419); +{ yymsp[-3].minor.yy456 = yymsp[-1].minor.yy456; } break; - case 247: /* table_options ::= */ -{ yymsp[1].minor.yy560 = createDefaultTableOptions(pCxt); } + case 249: /* table_options ::= */ +{ yymsp[1].minor.yy840 = createDefaultTableOptions(pCxt); } break; - case 248: /* table_options ::= table_options COMMENT NK_STRING */ -{ yylhsminor.yy560 = setTableOption(pCxt, yymsp[-2].minor.yy560, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 250: /* table_options ::= table_options COMMENT NK_STRING */ +{ yylhsminor.yy840 = setTableOption(pCxt, yymsp[-2].minor.yy840, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; - case 249: /* table_options ::= table_options MAX_DELAY duration_list */ -{ yylhsminor.yy560 = setTableOption(pCxt, yymsp[-2].minor.yy560, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy334); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 251: /* table_options ::= table_options MAX_DELAY duration_list */ +{ yylhsminor.yy840 = setTableOption(pCxt, yymsp[-2].minor.yy840, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy456); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; - case 250: /* table_options ::= table_options WATERMARK duration_list */ -{ yylhsminor.yy560 = setTableOption(pCxt, yymsp[-2].minor.yy560, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy334); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 252: /* table_options ::= table_options WATERMARK duration_list */ +{ yylhsminor.yy840 = setTableOption(pCxt, yymsp[-2].minor.yy840, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy456); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; - case 251: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ -{ yylhsminor.yy560 = setTableOption(pCxt, yymsp[-4].minor.yy560, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy334); } - yymsp[-4].minor.yy560 = yylhsminor.yy560; + case 253: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ +{ yylhsminor.yy840 = setTableOption(pCxt, yymsp[-4].minor.yy840, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy456); } + yymsp[-4].minor.yy840 = yylhsminor.yy840; break; - case 252: /* table_options ::= table_options TTL NK_INTEGER */ -{ yylhsminor.yy560 = setTableOption(pCxt, yymsp[-2].minor.yy560, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 254: /* table_options ::= table_options TTL NK_INTEGER */ +{ yylhsminor.yy840 = setTableOption(pCxt, yymsp[-2].minor.yy840, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; - case 253: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ -{ yylhsminor.yy560 = setTableOption(pCxt, yymsp[-4].minor.yy560, TABLE_OPTION_SMA, yymsp[-1].minor.yy334); } - yymsp[-4].minor.yy560 = yylhsminor.yy560; + case 255: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ +{ yylhsminor.yy840 = setTableOption(pCxt, yymsp[-4].minor.yy840, TABLE_OPTION_SMA, yymsp[-1].minor.yy456); } + yymsp[-4].minor.yy840 = yylhsminor.yy840; break; - case 254: /* table_options ::= table_options DELETE_MARK duration_list */ -{ yylhsminor.yy560 = setTableOption(pCxt, yymsp[-2].minor.yy560, TABLE_OPTION_DELETE_MARK, yymsp[0].minor.yy334); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 256: /* table_options ::= table_options DELETE_MARK duration_list */ +{ yylhsminor.yy840 = setTableOption(pCxt, yymsp[-2].minor.yy840, TABLE_OPTION_DELETE_MARK, yymsp[0].minor.yy456); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; - case 255: /* alter_table_options ::= alter_table_option */ -{ yylhsminor.yy560 = createAlterTableOptions(pCxt); yylhsminor.yy560 = setTableOption(pCxt, yylhsminor.yy560, yymsp[0].minor.yy389.type, &yymsp[0].minor.yy389.val); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 257: /* alter_table_options ::= alter_table_option */ +{ yylhsminor.yy840 = createAlterTableOptions(pCxt); yylhsminor.yy840 = setTableOption(pCxt, yylhsminor.yy840, yymsp[0].minor.yy573.type, &yymsp[0].minor.yy573.val); } + yymsp[0].minor.yy840 = yylhsminor.yy840; break; - case 256: /* alter_table_options ::= alter_table_options alter_table_option */ -{ yylhsminor.yy560 = setTableOption(pCxt, yymsp[-1].minor.yy560, yymsp[0].minor.yy389.type, &yymsp[0].minor.yy389.val); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; + case 258: /* alter_table_options ::= alter_table_options alter_table_option */ +{ yylhsminor.yy840 = setTableOption(pCxt, yymsp[-1].minor.yy840, yymsp[0].minor.yy573.type, &yymsp[0].minor.yy573.val); } + yymsp[-1].minor.yy840 = yylhsminor.yy840; break; - case 257: /* alter_table_option ::= COMMENT NK_STRING */ -{ yymsp[-1].minor.yy389.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; } + case 259: /* alter_table_option ::= COMMENT NK_STRING */ +{ yymsp[-1].minor.yy573.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy573.val = yymsp[0].minor.yy0; } break; - case 258: /* alter_table_option ::= TTL NK_INTEGER */ -{ yymsp[-1].minor.yy389.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; } + case 260: /* alter_table_option ::= TTL NK_INTEGER */ +{ yymsp[-1].minor.yy573.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy573.val = yymsp[0].minor.yy0; } break; - case 259: /* duration_list ::= duration_literal */ - case 547: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==547); -{ yylhsminor.yy334 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy560)); } - yymsp[0].minor.yy334 = yylhsminor.yy334; + case 261: /* duration_list ::= duration_literal */ + case 549: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==549); +{ yylhsminor.yy456 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy840)); } + yymsp[0].minor.yy456 = yylhsminor.yy456; break; - case 260: /* duration_list ::= duration_list NK_COMMA duration_literal */ - case 548: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==548); -{ yylhsminor.yy334 = addNodeToList(pCxt, yymsp[-2].minor.yy334, releaseRawExprNode(pCxt, yymsp[0].minor.yy560)); } - yymsp[-2].minor.yy334 = yylhsminor.yy334; + case 262: /* duration_list ::= duration_list NK_COMMA duration_literal */ + case 550: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==550); +{ yylhsminor.yy456 = addNodeToList(pCxt, yymsp[-2].minor.yy456, releaseRawExprNode(pCxt, yymsp[0].minor.yy840)); } + yymsp[-2].minor.yy456 = yylhsminor.yy456; break; - case 263: /* rollup_func_name ::= function_name */ -{ yylhsminor.yy560 = createFunctionNode(pCxt, &yymsp[0].minor.yy533, NULL); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 265: /* rollup_func_name ::= function_name */ +{ yylhsminor.yy840 = createFunctionNode(pCxt, &yymsp[0].minor.yy209, NULL); } + yymsp[0].minor.yy840 = yylhsminor.yy840; break; - case 264: /* rollup_func_name ::= FIRST */ - case 265: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==265); - case 339: /* tag_item ::= QTAGS */ yytestcase(yyruleno==339); -{ yylhsminor.yy560 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 266: /* rollup_func_name ::= FIRST */ + case 267: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==267); + case 341: /* tag_item ::= QTAGS */ yytestcase(yyruleno==341); +{ yylhsminor.yy840 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } + yymsp[0].minor.yy840 = yylhsminor.yy840; break; - case 268: /* col_name ::= column_name */ - case 340: /* tag_item ::= column_name */ yytestcase(yyruleno==340); -{ yylhsminor.yy560 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy533); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 270: /* col_name ::= column_name */ + case 342: /* tag_item ::= column_name */ yytestcase(yyruleno==342); +{ yylhsminor.yy840 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy209); } + yymsp[0].minor.yy840 = yylhsminor.yy840; break; - case 269: /* cmd ::= SHOW DNODES */ + case 271: /* cmd ::= SHOW DNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT); } break; - case 270: /* cmd ::= SHOW USERS */ + case 272: /* cmd ::= SHOW USERS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USERS_STMT); } break; - case 271: /* cmd ::= SHOW USERS FULL */ + case 273: /* cmd ::= SHOW USERS FULL */ { pCxt->pRootNode = createShowStmtWithFull(pCxt, QUERY_NODE_SHOW_USERS_FULL_STMT); } break; - case 272: /* cmd ::= SHOW USER PRIVILEGES */ + case 274: /* cmd ::= SHOW USER PRIVILEGES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USER_PRIVILEGES_STMT); } break; - case 273: /* cmd ::= SHOW db_kind_opt DATABASES */ + case 275: /* cmd ::= SHOW db_kind_opt DATABASES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT); - (void)setShowKind(pCxt, pCxt->pRootNode, yymsp[-1].minor.yy537); + (void)setShowKind(pCxt, pCxt->pRootNode, yymsp[-1].minor.yy881); } break; - case 274: /* cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */ + case 276: /* cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */ { - pCxt->pRootNode = createShowTablesStmt(pCxt, yymsp[-2].minor.yy709, yymsp[0].minor.yy560, OP_TYPE_LIKE); + pCxt->pRootNode = createShowTablesStmt(pCxt, yymsp[-2].minor.yy13, yymsp[0].minor.yy840, OP_TYPE_LIKE); } break; - case 275: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy560, yymsp[0].minor.yy560, OP_TYPE_LIKE); } + case 277: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy840, yymsp[0].minor.yy840, OP_TYPE_LIKE); } break; - case 276: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy560, NULL, OP_TYPE_LIKE); } + case 278: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy840, NULL, OP_TYPE_LIKE); } break; - case 277: /* cmd ::= SHOW MNODES */ + case 279: /* cmd ::= SHOW MNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT); } break; - case 278: /* cmd ::= SHOW QNODES */ + case 280: /* cmd ::= SHOW QNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QNODES_STMT); } break; - case 279: /* cmd ::= SHOW ARBGROUPS */ + case 281: /* cmd ::= SHOW ARBGROUPS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_ARBGROUPS_STMT); } break; - case 280: /* cmd ::= SHOW FUNCTIONS */ + case 282: /* cmd ::= SHOW FUNCTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT); } break; - case 281: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy560, yymsp[-1].minor.yy560, OP_TYPE_EQUAL); } + case 283: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy840, yymsp[-1].minor.yy840, OP_TYPE_EQUAL); } break; - case 282: /* cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy533), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy533), OP_TYPE_EQUAL); } + case 284: /* cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy209), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy209), OP_TYPE_EQUAL); } break; - case 283: /* cmd ::= SHOW STREAMS */ + case 285: /* cmd ::= SHOW STREAMS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT); } break; - case 284: /* cmd ::= SHOW ACCOUNTS */ + case 286: /* cmd ::= SHOW ACCOUNTS */ { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } break; - case 285: /* cmd ::= SHOW APPS */ + case 287: /* cmd ::= SHOW APPS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_APPS_STMT); } break; - case 286: /* cmd ::= SHOW CONNECTIONS */ + case 288: /* cmd ::= SHOW CONNECTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONNECTIONS_STMT); } break; - case 287: /* cmd ::= SHOW LICENCES */ - case 288: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==288); + case 289: /* cmd ::= SHOW LICENCES */ + case 290: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==290); { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LICENCES_STMT); } break; - case 289: /* cmd ::= SHOW GRANTS FULL */ + case 291: /* cmd ::= SHOW GRANTS FULL */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_GRANTS_FULL_STMT); } break; - case 290: /* cmd ::= SHOW GRANTS LOGS */ + case 292: /* cmd ::= SHOW GRANTS LOGS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_GRANTS_LOGS_STMT); } break; - case 291: /* cmd ::= SHOW CLUSTER MACHINES */ + case 293: /* cmd ::= SHOW CLUSTER MACHINES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_MACHINES_STMT); } break; - case 292: /* cmd ::= SHOW CREATE DATABASE db_name */ -{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy533); } + case 294: /* cmd ::= SHOW CREATE DATABASE db_name */ +{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy209); } break; - case 293: /* cmd ::= SHOW CREATE TABLE full_table_name */ -{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy560); } + case 295: /* cmd ::= SHOW CREATE TABLE full_table_name */ +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy840); } break; - case 294: /* cmd ::= SHOW CREATE STABLE full_table_name */ + case 296: /* cmd ::= SHOW CREATE STABLE full_table_name */ { pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, -yymsp[0].minor.yy560); } +yymsp[0].minor.yy840); } break; - case 295: /* cmd ::= SHOW ENCRYPTIONS */ + case 297: /* cmd ::= SHOW ENCRYPTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_ENCRYPTIONS_STMT); } break; - case 296: /* cmd ::= SHOW QUERIES */ + case 298: /* cmd ::= SHOW QUERIES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT); } break; - case 297: /* cmd ::= SHOW SCORES */ + case 299: /* cmd ::= SHOW SCORES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SCORES_STMT); } break; - case 298: /* cmd ::= SHOW TOPICS */ + case 300: /* cmd ::= SHOW TOPICS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TOPICS_STMT); } break; - case 299: /* cmd ::= SHOW VARIABLES */ - case 300: /* cmd ::= SHOW CLUSTER VARIABLES */ yytestcase(yyruleno==300); + case 301: /* cmd ::= SHOW VARIABLES */ + case 302: /* cmd ::= SHOW CLUSTER VARIABLES */ yytestcase(yyruleno==302); { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VARIABLES_STMT); } break; - case 301: /* cmd ::= SHOW LOCAL VARIABLES */ + case 303: /* cmd ::= SHOW LOCAL VARIABLES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT); } break; - case 302: /* cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ -{ pCxt->pRootNode = createShowDnodeVariablesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[-2].minor.yy0), yymsp[0].minor.yy560); } + case 304: /* cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ +{ pCxt->pRootNode = createShowDnodeVariablesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[-2].minor.yy0), yymsp[0].minor.yy840); } break; - case 303: /* cmd ::= SHOW BNODES */ + case 305: /* cmd ::= SHOW BNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_BNODES_STMT); } break; - case 304: /* cmd ::= SHOW SNODES */ + case 306: /* cmd ::= SHOW SNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SNODES_STMT); } break; - case 305: /* cmd ::= SHOW CLUSTER */ + case 307: /* cmd ::= SHOW CLUSTER */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_STMT); } break; - case 306: /* cmd ::= SHOW TRANSACTIONS */ + case 308: /* cmd ::= SHOW TRANSACTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TRANSACTIONS_STMT); } break; - case 307: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ -{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy560); } + case 309: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ +{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy840); } break; - case 308: /* cmd ::= SHOW CONSUMERS */ + case 310: /* cmd ::= SHOW CONSUMERS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONSUMERS_STMT); } break; - case 309: /* cmd ::= SHOW SUBSCRIPTIONS */ + case 311: /* cmd ::= SHOW SUBSCRIPTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT); } break; - case 310: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy560, yymsp[-1].minor.yy560, OP_TYPE_EQUAL); } + case 312: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy840, yymsp[-1].minor.yy840, OP_TYPE_EQUAL); } break; - case 311: /* cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy533), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy533), OP_TYPE_EQUAL); } + case 313: /* cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy209), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy209), OP_TYPE_EQUAL); } break; - case 312: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ -{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, yymsp[-1].minor.yy560, yymsp[0].minor.yy560, yymsp[-3].minor.yy334); } + case 314: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ +{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, yymsp[-1].minor.yy840, yymsp[0].minor.yy840, yymsp[-3].minor.yy456); } break; - case 313: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ -{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, createIdentifierValueNode(pCxt, &yymsp[0].minor.yy533), createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy533), yymsp[-4].minor.yy334); } + case 315: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ +{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, createIdentifierValueNode(pCxt, &yymsp[0].minor.yy209), createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy209), yymsp[-4].minor.yy456); } break; - case 314: /* cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ + case 316: /* cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ { pCxt->pRootNode = createShowVnodesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0), NULL); } break; - case 315: /* cmd ::= SHOW VNODES */ + case 317: /* cmd ::= SHOW VNODES */ { pCxt->pRootNode = createShowVnodesStmt(pCxt, NULL, NULL); } break; - case 316: /* cmd ::= SHOW db_name_cond_opt ALIVE */ -{ pCxt->pRootNode = createShowAliveStmt(pCxt, yymsp[-1].minor.yy560, QUERY_NODE_SHOW_DB_ALIVE_STMT); } + case 318: /* cmd ::= SHOW db_name_cond_opt ALIVE */ +{ pCxt->pRootNode = createShowAliveStmt(pCxt, yymsp[-1].minor.yy840, QUERY_NODE_SHOW_DB_ALIVE_STMT); } break; - case 317: /* cmd ::= SHOW CLUSTER ALIVE */ + case 319: /* cmd ::= SHOW CLUSTER ALIVE */ { pCxt->pRootNode = createShowAliveStmt(pCxt, NULL, QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT); } break; - case 318: /* cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VIEWS_STMT, yymsp[-2].minor.yy560, yymsp[0].minor.yy560, OP_TYPE_LIKE); } + case 320: /* cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt */ +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VIEWS_STMT, yymsp[-2].minor.yy840, yymsp[0].minor.yy840, OP_TYPE_LIKE); } break; - case 319: /* cmd ::= SHOW CREATE VIEW full_table_name */ -{ pCxt->pRootNode = createShowCreateViewStmt(pCxt, QUERY_NODE_SHOW_CREATE_VIEW_STMT, yymsp[0].minor.yy560); } + case 321: /* cmd ::= SHOW CREATE VIEW full_table_name */ +{ pCxt->pRootNode = createShowCreateViewStmt(pCxt, QUERY_NODE_SHOW_CREATE_VIEW_STMT, yymsp[0].minor.yy840); } break; - case 320: /* cmd ::= SHOW COMPACTS */ + case 322: /* cmd ::= SHOW COMPACTS */ { pCxt->pRootNode = createShowCompactsStmt(pCxt, QUERY_NODE_SHOW_COMPACTS_STMT); } break; - case 321: /* cmd ::= SHOW COMPACT NK_INTEGER */ + case 323: /* cmd ::= SHOW COMPACT NK_INTEGER */ { pCxt->pRootNode = createShowCompactDetailsStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } break; - case 322: /* table_kind_db_name_cond_opt ::= */ -{ yymsp[1].minor.yy709.kind = SHOW_KIND_ALL; yymsp[1].minor.yy709.dbName = nil_token; } + case 324: /* table_kind_db_name_cond_opt ::= */ +{ yymsp[1].minor.yy13.kind = SHOW_KIND_ALL; yymsp[1].minor.yy13.dbName = nil_token; } break; - case 323: /* table_kind_db_name_cond_opt ::= table_kind */ -{ yylhsminor.yy709.kind = yymsp[0].minor.yy537; yylhsminor.yy709.dbName = nil_token; } - yymsp[0].minor.yy709 = yylhsminor.yy709; + case 325: /* table_kind_db_name_cond_opt ::= table_kind */ +{ yylhsminor.yy13.kind = yymsp[0].minor.yy881; yylhsminor.yy13.dbName = nil_token; } + yymsp[0].minor.yy13 = yylhsminor.yy13; break; - case 324: /* table_kind_db_name_cond_opt ::= db_name NK_DOT */ -{ yylhsminor.yy709.kind = SHOW_KIND_ALL; yylhsminor.yy709.dbName = yymsp[-1].minor.yy533; } - yymsp[-1].minor.yy709 = yylhsminor.yy709; + case 326: /* table_kind_db_name_cond_opt ::= db_name NK_DOT */ +{ yylhsminor.yy13.kind = SHOW_KIND_ALL; yylhsminor.yy13.dbName = yymsp[-1].minor.yy209; } + yymsp[-1].minor.yy13 = yylhsminor.yy13; break; - case 325: /* table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */ -{ yylhsminor.yy709.kind = yymsp[-2].minor.yy537; yylhsminor.yy709.dbName = yymsp[-1].minor.yy533; } - yymsp[-2].minor.yy709 = yylhsminor.yy709; + case 327: /* table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */ +{ yylhsminor.yy13.kind = yymsp[-2].minor.yy881; yylhsminor.yy13.dbName = yymsp[-1].minor.yy209; } + yymsp[-2].minor.yy13 = yylhsminor.yy13; break; - case 326: /* table_kind ::= NORMAL */ -{ yymsp[0].minor.yy537 = SHOW_KIND_TABLES_NORMAL; } + case 328: /* table_kind ::= NORMAL */ +{ yymsp[0].minor.yy881 = SHOW_KIND_TABLES_NORMAL; } break; - case 327: /* table_kind ::= CHILD */ -{ yymsp[0].minor.yy537 = SHOW_KIND_TABLES_CHILD; } + case 329: /* table_kind ::= CHILD */ +{ yymsp[0].minor.yy881 = SHOW_KIND_TABLES_CHILD; } break; - case 328: /* db_name_cond_opt ::= */ - case 333: /* from_db_opt ::= */ yytestcase(yyruleno==333); -{ yymsp[1].minor.yy560 = createDefaultDatabaseCondValue(pCxt); } + case 330: /* db_name_cond_opt ::= */ + case 335: /* from_db_opt ::= */ yytestcase(yyruleno==335); +{ yymsp[1].minor.yy840 = createDefaultDatabaseCondValue(pCxt); } break; - case 329: /* db_name_cond_opt ::= db_name NK_DOT */ -{ yylhsminor.yy560 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy533); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; + case 331: /* db_name_cond_opt ::= db_name NK_DOT */ +{ yylhsminor.yy840 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy209); } + yymsp[-1].minor.yy840 = yylhsminor.yy840; break; - case 331: /* like_pattern_opt ::= LIKE NK_STRING */ -{ yymsp[-1].minor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } + case 333: /* like_pattern_opt ::= LIKE NK_STRING */ +{ yymsp[-1].minor.yy840 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } break; - case 332: /* table_name_cond ::= table_name */ -{ yylhsminor.yy560 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy533); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 334: /* table_name_cond ::= table_name */ +{ yylhsminor.yy840 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy209); } + yymsp[0].minor.yy840 = yylhsminor.yy840; break; - case 334: /* from_db_opt ::= FROM db_name */ -{ yymsp[-1].minor.yy560 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy533); } + case 336: /* from_db_opt ::= FROM db_name */ +{ yymsp[-1].minor.yy840 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy209); } break; - case 338: /* tag_item ::= TBNAME */ -{ yylhsminor.yy560 = setProjectionAlias(pCxt, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL), &yymsp[0].minor.yy0); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 340: /* tag_item ::= TBNAME */ +{ yylhsminor.yy840 = setProjectionAlias(pCxt, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL), &yymsp[0].minor.yy0); } + yymsp[0].minor.yy840 = yylhsminor.yy840; break; - case 341: /* tag_item ::= column_name column_alias */ -{ yylhsminor.yy560 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy533), &yymsp[0].minor.yy533); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; + case 343: /* tag_item ::= column_name column_alias */ +{ yylhsminor.yy840 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy209), &yymsp[0].minor.yy209); } + yymsp[-1].minor.yy840 = yylhsminor.yy840; break; - case 342: /* tag_item ::= column_name AS column_alias */ -{ yylhsminor.yy560 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-2].minor.yy533), &yymsp[0].minor.yy533); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 344: /* tag_item ::= column_name AS column_alias */ +{ yylhsminor.yy840 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-2].minor.yy209), &yymsp[0].minor.yy209); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; - case 343: /* db_kind_opt ::= */ -{ yymsp[1].minor.yy537 = SHOW_KIND_ALL; } + case 345: /* db_kind_opt ::= */ +{ yymsp[1].minor.yy881 = SHOW_KIND_ALL; } break; - case 344: /* db_kind_opt ::= USER */ -{ yymsp[0].minor.yy537 = SHOW_KIND_DATABASES_USER; } + case 346: /* db_kind_opt ::= USER */ +{ yymsp[0].minor.yy881 = SHOW_KIND_DATABASES_USER; } break; - case 345: /* db_kind_opt ::= SYSTEM */ -{ yymsp[0].minor.yy537 = SHOW_KIND_DATABASES_SYSTEM; } + case 347: /* db_kind_opt ::= SYSTEM */ +{ yymsp[0].minor.yy881 = SHOW_KIND_DATABASES_SYSTEM; } break; - case 346: /* cmd ::= CREATE TSMA not_exists_opt tsma_name ON full_table_name tsma_func_list INTERVAL NK_LP duration_literal NK_RP */ -{ pCxt->pRootNode = createCreateTSMAStmt(pCxt, yymsp[-8].minor.yy173, &yymsp[-7].minor.yy533, yymsp[-4].minor.yy560, yymsp[-5].minor.yy560, releaseRawExprNode(pCxt, yymsp[-1].minor.yy560)); } + case 348: /* cmd ::= CREATE TSMA not_exists_opt tsma_name ON full_table_name tsma_func_list INTERVAL NK_LP duration_literal NK_RP */ +{ pCxt->pRootNode = createCreateTSMAStmt(pCxt, yymsp[-8].minor.yy9, &yymsp[-7].minor.yy209, yymsp[-4].minor.yy840, yymsp[-5].minor.yy840, releaseRawExprNode(pCxt, yymsp[-1].minor.yy840)); } break; - case 347: /* cmd ::= CREATE RECURSIVE TSMA not_exists_opt tsma_name ON full_table_name INTERVAL NK_LP duration_literal NK_RP */ -{ pCxt->pRootNode = createCreateTSMAStmt(pCxt, yymsp[-7].minor.yy173, &yymsp[-6].minor.yy533, NULL, yymsp[-4].minor.yy560, releaseRawExprNode(pCxt, yymsp[-1].minor.yy560)); } + case 349: /* cmd ::= CREATE RECURSIVE TSMA not_exists_opt tsma_name ON full_table_name INTERVAL NK_LP duration_literal NK_RP */ +{ pCxt->pRootNode = createCreateTSMAStmt(pCxt, yymsp[-7].minor.yy9, &yymsp[-6].minor.yy209, NULL, yymsp[-4].minor.yy840, releaseRawExprNode(pCxt, yymsp[-1].minor.yy840)); } break; - case 348: /* cmd ::= DROP TSMA exists_opt full_tsma_name */ -{ pCxt->pRootNode = createDropTSMAStmt(pCxt, yymsp[-1].minor.yy173, yymsp[0].minor.yy560); } + case 350: /* cmd ::= DROP TSMA exists_opt full_tsma_name */ +{ pCxt->pRootNode = createDropTSMAStmt(pCxt, yymsp[-1].minor.yy9, yymsp[0].minor.yy840); } break; - case 349: /* cmd ::= SHOW db_name_cond_opt TSMAS */ -{ pCxt->pRootNode = createShowTSMASStmt(pCxt, yymsp[-1].minor.yy560); } + case 351: /* cmd ::= SHOW db_name_cond_opt TSMAS */ +{ pCxt->pRootNode = createShowTSMASStmt(pCxt, yymsp[-1].minor.yy840); } break; - case 352: /* tsma_func_list ::= FUNCTION NK_LP func_list NK_RP */ -{ yymsp[-3].minor.yy560 = createTSMAOptions(pCxt, yymsp[-1].minor.yy334); } + case 354: /* tsma_func_list ::= FUNCTION NK_LP func_list NK_RP */ +{ yymsp[-3].minor.yy840 = createTSMAOptions(pCxt, yymsp[-1].minor.yy456); } break; - case 353: /* cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */ -{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy173, yymsp[-3].minor.yy560, yymsp[-1].minor.yy560, NULL, yymsp[0].minor.yy560); } + case 355: /* cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */ +{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy9, yymsp[-3].minor.yy840, yymsp[-1].minor.yy840, NULL, yymsp[0].minor.yy840); } break; - case 354: /* cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */ -{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_NORMAL, yymsp[-6].minor.yy173, yymsp[-5].minor.yy560, yymsp[-3].minor.yy560, yymsp[-1].minor.yy334, NULL); } + case 356: /* cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */ +{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_NORMAL, yymsp[-6].minor.yy9, yymsp[-5].minor.yy840, yymsp[-3].minor.yy840, yymsp[-1].minor.yy456, NULL); } break; - case 355: /* cmd ::= DROP INDEX exists_opt full_index_name */ -{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy173, yymsp[0].minor.yy560); } + case 357: /* cmd ::= DROP INDEX exists_opt full_index_name */ +{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy9, yymsp[0].minor.yy840); } break; - case 356: /* full_index_name ::= index_name */ -{ yylhsminor.yy560 = createRealTableNodeForIndexName(pCxt, NULL, &yymsp[0].minor.yy533); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 358: /* full_index_name ::= index_name */ +{ yylhsminor.yy840 = createRealTableNodeForIndexName(pCxt, NULL, &yymsp[0].minor.yy209); } + yymsp[0].minor.yy840 = yylhsminor.yy840; break; - case 357: /* full_index_name ::= db_name NK_DOT index_name */ -{ yylhsminor.yy560 = createRealTableNodeForIndexName(pCxt, &yymsp[-2].minor.yy533, &yymsp[0].minor.yy533); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 359: /* full_index_name ::= db_name NK_DOT index_name */ +{ yylhsminor.yy840 = createRealTableNodeForIndexName(pCxt, &yymsp[-2].minor.yy209, &yymsp[0].minor.yy209); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; - case 358: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ -{ yymsp[-9].minor.yy560 = createIndexOption(pCxt, yymsp[-7].minor.yy334, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), NULL, yymsp[-1].minor.yy560, yymsp[0].minor.yy560); } + case 360: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ +{ yymsp[-9].minor.yy840 = createIndexOption(pCxt, yymsp[-7].minor.yy456, releaseRawExprNode(pCxt, yymsp[-3].minor.yy840), NULL, yymsp[-1].minor.yy840, yymsp[0].minor.yy840); } break; - case 359: /* 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.yy560 = createIndexOption(pCxt, yymsp[-9].minor.yy334, releaseRawExprNode(pCxt, yymsp[-5].minor.yy560), releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), yymsp[-1].minor.yy560, yymsp[0].minor.yy560); } + case 361: /* 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.yy840 = createIndexOption(pCxt, yymsp[-9].minor.yy456, releaseRawExprNode(pCxt, yymsp[-5].minor.yy840), releaseRawExprNode(pCxt, yymsp[-3].minor.yy840), yymsp[-1].minor.yy840, yymsp[0].minor.yy840); } break; - case 362: /* func ::= sma_func_name NK_LP expression_list NK_RP */ -{ yylhsminor.yy560 = createFunctionNode(pCxt, &yymsp[-3].minor.yy533, yymsp[-1].minor.yy334); } - yymsp[-3].minor.yy560 = yylhsminor.yy560; + case 364: /* func ::= sma_func_name NK_LP expression_list NK_RP */ +{ yylhsminor.yy840 = createFunctionNode(pCxt, &yymsp[-3].minor.yy209, yymsp[-1].minor.yy456); } + yymsp[-3].minor.yy840 = yylhsminor.yy840; break; - case 363: /* sma_func_name ::= function_name */ - case 656: /* alias_opt ::= table_alias */ yytestcase(yyruleno==656); -{ yylhsminor.yy533 = yymsp[0].minor.yy533; } - yymsp[0].minor.yy533 = yylhsminor.yy533; + case 365: /* sma_func_name ::= function_name */ + case 658: /* alias_opt ::= table_alias */ yytestcase(yyruleno==658); +{ yylhsminor.yy209 = yymsp[0].minor.yy209; } + yymsp[0].minor.yy209 = yylhsminor.yy209; break; - case 368: /* sma_stream_opt ::= */ - case 418: /* stream_options ::= */ yytestcase(yyruleno==418); -{ yymsp[1].minor.yy560 = createStreamOptions(pCxt); } + case 370: /* sma_stream_opt ::= */ + case 420: /* stream_options ::= */ yytestcase(yyruleno==420); +{ yymsp[1].minor.yy840 = createStreamOptions(pCxt); } break; - case 369: /* sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ -{ ((SStreamOptions*)yymsp[-2].minor.yy560)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy560); yylhsminor.yy560 = yymsp[-2].minor.yy560; } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 371: /* sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ +{ ((SStreamOptions*)yymsp[-2].minor.yy840)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy840); yylhsminor.yy840 = yymsp[-2].minor.yy840; } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; - case 370: /* sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ -{ ((SStreamOptions*)yymsp[-2].minor.yy560)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy560); yylhsminor.yy560 = yymsp[-2].minor.yy560; } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 372: /* sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ +{ ((SStreamOptions*)yymsp[-2].minor.yy840)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy840); yylhsminor.yy840 = yymsp[-2].minor.yy840; } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; - case 371: /* sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ -{ ((SStreamOptions*)yymsp[-2].minor.yy560)->pDeleteMark = releaseRawExprNode(pCxt, yymsp[0].minor.yy560); yylhsminor.yy560 = yymsp[-2].minor.yy560; } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 373: /* sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ +{ ((SStreamOptions*)yymsp[-2].minor.yy840)->pDeleteMark = releaseRawExprNode(pCxt, yymsp[0].minor.yy840); yylhsminor.yy840 = yymsp[-2].minor.yy840; } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; - case 372: /* with_meta ::= AS */ -{ yymsp[0].minor.yy802 = 0; } + case 374: /* with_meta ::= AS */ +{ yymsp[0].minor.yy516 = 0; } break; - case 373: /* with_meta ::= WITH META AS */ -{ yymsp[-2].minor.yy802 = 1; } + case 375: /* with_meta ::= WITH META AS */ +{ yymsp[-2].minor.yy516 = 1; } break; - case 374: /* with_meta ::= ONLY META AS */ -{ yymsp[-2].minor.yy802 = 2; } + case 376: /* with_meta ::= ONLY META AS */ +{ yymsp[-2].minor.yy516 = 2; } break; - case 375: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ -{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy173, &yymsp[-2].minor.yy533, yymsp[0].minor.yy560); } + case 377: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ +{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy9, &yymsp[-2].minor.yy209, yymsp[0].minor.yy840); } break; - case 376: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy173, &yymsp[-3].minor.yy533, &yymsp[0].minor.yy533, yymsp[-2].minor.yy802); } + case 378: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ +{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy9, &yymsp[-3].minor.yy209, &yymsp[0].minor.yy209, yymsp[-2].minor.yy516); } break; - case 377: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ -{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-5].minor.yy173, &yymsp[-4].minor.yy533, yymsp[-1].minor.yy560, yymsp[-3].minor.yy802, yymsp[0].minor.yy560); } + case 379: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ +{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-5].minor.yy9, &yymsp[-4].minor.yy209, yymsp[-1].minor.yy840, yymsp[-3].minor.yy516, yymsp[0].minor.yy840); } break; - case 378: /* cmd ::= DROP TOPIC exists_opt topic_name */ -{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy173, &yymsp[0].minor.yy533); } + case 380: /* cmd ::= DROP TOPIC exists_opt topic_name */ +{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy9, &yymsp[0].minor.yy209); } break; - case 379: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ -{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy173, &yymsp[-2].minor.yy533, &yymsp[0].minor.yy533); } + case 381: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ +{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy9, &yymsp[-2].minor.yy209, &yymsp[0].minor.yy209); } break; - case 380: /* cmd ::= DESC full_table_name */ - case 381: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==381); -{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy560); } + case 382: /* cmd ::= DESC full_table_name */ + case 383: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==383); +{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy840); } break; - case 382: /* cmd ::= RESET QUERY CACHE */ + case 384: /* cmd ::= RESET QUERY CACHE */ { pCxt->pRootNode = createResetQueryCacheStmt(pCxt); } break; - case 383: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ - case 384: /* cmd ::= EXPLAIN analyze_opt explain_options insert_query */ yytestcase(yyruleno==384); -{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy173, yymsp[-1].minor.yy560, yymsp[0].minor.yy560); } + case 385: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ + case 386: /* cmd ::= EXPLAIN analyze_opt explain_options insert_query */ yytestcase(yyruleno==386); +{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy9, yymsp[-1].minor.yy840, yymsp[0].minor.yy840); } break; - case 387: /* explain_options ::= */ -{ yymsp[1].minor.yy560 = createDefaultExplainOptions(pCxt); } + case 389: /* explain_options ::= */ +{ yymsp[1].minor.yy840 = createDefaultExplainOptions(pCxt); } break; - case 388: /* explain_options ::= explain_options VERBOSE NK_BOOL */ -{ yylhsminor.yy560 = setExplainVerbose(pCxt, yymsp[-2].minor.yy560, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 390: /* explain_options ::= explain_options VERBOSE NK_BOOL */ +{ yylhsminor.yy840 = setExplainVerbose(pCxt, yymsp[-2].minor.yy840, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; - case 389: /* explain_options ::= explain_options RATIO NK_FLOAT */ -{ yylhsminor.yy560 = setExplainRatio(pCxt, yymsp[-2].minor.yy560, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 391: /* explain_options ::= explain_options RATIO NK_FLOAT */ +{ yylhsminor.yy840 = setExplainRatio(pCxt, yymsp[-2].minor.yy840, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; - case 390: /* cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ -{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-7].minor.yy173, yymsp[-9].minor.yy173, &yymsp[-6].minor.yy533, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy952, yymsp[-1].minor.yy802, &yymsp[0].minor.yy533, yymsp[-10].minor.yy173); } + case 392: /* cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ +{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-7].minor.yy9, yymsp[-9].minor.yy9, &yymsp[-6].minor.yy209, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy48, yymsp[-1].minor.yy516, &yymsp[0].minor.yy209, yymsp[-10].minor.yy9); } break; - case 391: /* cmd ::= DROP FUNCTION exists_opt function_name */ -{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy173, &yymsp[0].minor.yy533); } + case 393: /* cmd ::= DROP FUNCTION exists_opt function_name */ +{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy9, &yymsp[0].minor.yy209); } break; - case 396: /* language_opt ::= */ - case 442: /* on_vgroup_id ::= */ yytestcase(yyruleno==442); -{ yymsp[1].minor.yy533 = nil_token; } + case 398: /* language_opt ::= */ + case 444: /* on_vgroup_id ::= */ yytestcase(yyruleno==444); +{ yymsp[1].minor.yy209 = nil_token; } break; - case 397: /* language_opt ::= LANGUAGE NK_STRING */ - case 443: /* on_vgroup_id ::= ON NK_INTEGER */ yytestcase(yyruleno==443); -{ yymsp[-1].minor.yy533 = yymsp[0].minor.yy0; } + case 399: /* language_opt ::= LANGUAGE NK_STRING */ + case 445: /* on_vgroup_id ::= ON NK_INTEGER */ yytestcase(yyruleno==445); +{ yymsp[-1].minor.yy209 = yymsp[0].minor.yy0; } break; - case 400: /* cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */ -{ pCxt->pRootNode = createCreateViewStmt(pCxt, yymsp[-4].minor.yy173, yymsp[-2].minor.yy560, &yymsp[-1].minor.yy0, yymsp[0].minor.yy560); } + case 402: /* cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */ +{ pCxt->pRootNode = createCreateViewStmt(pCxt, yymsp[-4].minor.yy9, yymsp[-2].minor.yy840, &yymsp[-1].minor.yy0, yymsp[0].minor.yy840); } break; - case 401: /* cmd ::= DROP VIEW exists_opt full_view_name */ -{ pCxt->pRootNode = createDropViewStmt(pCxt, yymsp[-1].minor.yy173, yymsp[0].minor.yy560); } + case 403: /* cmd ::= DROP VIEW exists_opt full_view_name */ +{ pCxt->pRootNode = createDropViewStmt(pCxt, yymsp[-1].minor.yy9, yymsp[0].minor.yy840); } break; - case 402: /* full_view_name ::= view_name */ -{ yylhsminor.yy560 = createViewNode(pCxt, NULL, &yymsp[0].minor.yy533); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 404: /* full_view_name ::= view_name */ +{ yylhsminor.yy840 = createViewNode(pCxt, NULL, &yymsp[0].minor.yy209); } + yymsp[0].minor.yy840 = yylhsminor.yy840; break; - case 403: /* full_view_name ::= db_name NK_DOT view_name */ -{ yylhsminor.yy560 = createViewNode(pCxt, &yymsp[-2].minor.yy533, &yymsp[0].minor.yy533); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 405: /* full_view_name ::= db_name NK_DOT view_name */ +{ yylhsminor.yy840 = createViewNode(pCxt, &yymsp[-2].minor.yy209, &yymsp[0].minor.yy209); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; - case 404: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */ -{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-9].minor.yy173, &yymsp[-8].minor.yy533, yymsp[-5].minor.yy560, yymsp[-7].minor.yy560, yymsp[-3].minor.yy334, yymsp[-2].minor.yy560, yymsp[0].minor.yy560, yymsp[-4].minor.yy334); } + case 406: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */ +{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-9].minor.yy9, &yymsp[-8].minor.yy209, yymsp[-5].minor.yy840, yymsp[-7].minor.yy840, yymsp[-3].minor.yy456, yymsp[-2].minor.yy840, yymsp[0].minor.yy840, yymsp[-4].minor.yy456); } break; - case 405: /* cmd ::= DROP STREAM exists_opt stream_name */ -{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy173, &yymsp[0].minor.yy533); } + case 407: /* cmd ::= DROP STREAM exists_opt stream_name */ +{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy9, &yymsp[0].minor.yy209); } break; - case 406: /* cmd ::= PAUSE STREAM exists_opt stream_name */ -{ pCxt->pRootNode = createPauseStreamStmt(pCxt, yymsp[-1].minor.yy173, &yymsp[0].minor.yy533); } + case 408: /* cmd ::= PAUSE STREAM exists_opt stream_name */ +{ pCxt->pRootNode = createPauseStreamStmt(pCxt, yymsp[-1].minor.yy9, &yymsp[0].minor.yy209); } break; - case 407: /* cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ -{ pCxt->pRootNode = createResumeStreamStmt(pCxt, yymsp[-2].minor.yy173, yymsp[-1].minor.yy173, &yymsp[0].minor.yy533); } + case 409: /* cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ +{ pCxt->pRootNode = createResumeStreamStmt(pCxt, yymsp[-2].minor.yy9, yymsp[-1].minor.yy9, &yymsp[0].minor.yy209); } break; - case 412: /* column_stream_def ::= column_name stream_col_options */ -{ yylhsminor.yy560 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy533, createDataType(TSDB_DATA_TYPE_NULL), yymsp[0].minor.yy560); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; + case 414: /* column_stream_def ::= column_name stream_col_options */ +{ yylhsminor.yy840 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy209, createDataType(TSDB_DATA_TYPE_NULL), yymsp[0].minor.yy840); } + yymsp[-1].minor.yy840 = yylhsminor.yy840; break; - case 413: /* stream_col_options ::= */ - case 769: /* column_options ::= */ yytestcase(yyruleno==769); -{ yymsp[1].minor.yy560 = createDefaultColumnOptions(pCxt); } + case 415: /* stream_col_options ::= */ + case 771: /* column_options ::= */ yytestcase(yyruleno==771); +{ yymsp[1].minor.yy840 = createDefaultColumnOptions(pCxt); } break; - case 414: /* stream_col_options ::= stream_col_options PRIMARY KEY */ - case 770: /* column_options ::= column_options PRIMARY KEY */ yytestcase(yyruleno==770); -{ yylhsminor.yy560 = setColumnOptionsPK(pCxt, yymsp[-2].minor.yy560); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 416: /* stream_col_options ::= stream_col_options PRIMARY KEY */ + case 772: /* column_options ::= column_options PRIMARY KEY */ yytestcase(yyruleno==772); +{ yylhsminor.yy840 = setColumnOptionsPK(pCxt, yymsp[-2].minor.yy840); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; - case 419: /* stream_options ::= stream_options TRIGGER AT_ONCE */ - case 420: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ yytestcase(yyruleno==420); - case 421: /* stream_options ::= stream_options TRIGGER FORCE_WINDOW_CLOSE */ yytestcase(yyruleno==421); -{ yylhsminor.yy560 = setStreamOptions(pCxt, yymsp[-2].minor.yy560, SOPT_TRIGGER_TYPE_SET, &yymsp[0].minor.yy0, NULL); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 421: /* stream_options ::= stream_options TRIGGER AT_ONCE */ + case 422: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ yytestcase(yyruleno==422); + case 423: /* stream_options ::= stream_options TRIGGER FORCE_WINDOW_CLOSE */ yytestcase(yyruleno==423); +{ yylhsminor.yy840 = setStreamOptions(pCxt, yymsp[-2].minor.yy840, SOPT_TRIGGER_TYPE_SET, &yymsp[0].minor.yy0, NULL); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; - case 422: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ -{ yylhsminor.yy560 = setStreamOptions(pCxt, yymsp[-3].minor.yy560, SOPT_TRIGGER_TYPE_SET, &yymsp[-1].minor.yy0, releaseRawExprNode(pCxt, yymsp[0].minor.yy560)); } - yymsp[-3].minor.yy560 = yylhsminor.yy560; + case 424: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ +{ yylhsminor.yy840 = setStreamOptions(pCxt, yymsp[-3].minor.yy840, SOPT_TRIGGER_TYPE_SET, &yymsp[-1].minor.yy0, releaseRawExprNode(pCxt, yymsp[0].minor.yy840)); } + yymsp[-3].minor.yy840 = yylhsminor.yy840; break; - case 423: /* stream_options ::= stream_options WATERMARK duration_literal */ -{ yylhsminor.yy560 = setStreamOptions(pCxt, yymsp[-2].minor.yy560, SOPT_WATERMARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy560)); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 425: /* stream_options ::= stream_options WATERMARK duration_literal */ +{ yylhsminor.yy840 = setStreamOptions(pCxt, yymsp[-2].minor.yy840, SOPT_WATERMARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy840)); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; - case 424: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ -{ yylhsminor.yy560 = setStreamOptions(pCxt, yymsp[-3].minor.yy560, SOPT_IGNORE_EXPIRED_SET, &yymsp[0].minor.yy0, NULL); } - yymsp[-3].minor.yy560 = yylhsminor.yy560; + case 426: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ +{ yylhsminor.yy840 = setStreamOptions(pCxt, yymsp[-3].minor.yy840, SOPT_IGNORE_EXPIRED_SET, &yymsp[0].minor.yy0, NULL); } + yymsp[-3].minor.yy840 = yylhsminor.yy840; break; - case 425: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ -{ yylhsminor.yy560 = setStreamOptions(pCxt, yymsp[-2].minor.yy560, SOPT_FILL_HISTORY_SET, &yymsp[0].minor.yy0, NULL); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 427: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ +{ yylhsminor.yy840 = setStreamOptions(pCxt, yymsp[-2].minor.yy840, SOPT_FILL_HISTORY_SET, &yymsp[0].minor.yy0, NULL); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; - case 426: /* stream_options ::= stream_options DELETE_MARK duration_literal */ -{ yylhsminor.yy560 = setStreamOptions(pCxt, yymsp[-2].minor.yy560, SOPT_DELETE_MARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy560)); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 428: /* stream_options ::= stream_options DELETE_MARK duration_literal */ +{ yylhsminor.yy840 = setStreamOptions(pCxt, yymsp[-2].minor.yy840, SOPT_DELETE_MARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy840)); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; - case 427: /* stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ -{ yylhsminor.yy560 = setStreamOptions(pCxt, yymsp[-3].minor.yy560, SOPT_IGNORE_UPDATE_SET, &yymsp[0].minor.yy0, NULL); } - yymsp[-3].minor.yy560 = yylhsminor.yy560; + case 429: /* stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ +{ yylhsminor.yy840 = setStreamOptions(pCxt, yymsp[-3].minor.yy840, SOPT_IGNORE_UPDATE_SET, &yymsp[0].minor.yy0, NULL); } + yymsp[-3].minor.yy840 = yylhsminor.yy840; break; - case 429: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - case 713: /* sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ yytestcase(yyruleno==713); - case 737: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==737); -{ yymsp[-3].minor.yy560 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy560); } + case 431: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + case 715: /* sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ yytestcase(yyruleno==715); + case 739: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==739); +{ yymsp[-3].minor.yy840 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy840); } break; - case 432: /* cmd ::= KILL CONNECTION NK_INTEGER */ + case 434: /* cmd ::= KILL CONNECTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); } break; - case 433: /* cmd ::= KILL QUERY NK_STRING */ + case 435: /* cmd ::= KILL QUERY NK_STRING */ { pCxt->pRootNode = createKillQueryStmt(pCxt, &yymsp[0].minor.yy0); } break; - case 434: /* cmd ::= KILL TRANSACTION NK_INTEGER */ + case 436: /* cmd ::= KILL TRANSACTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_TRANSACTION_STMT, &yymsp[0].minor.yy0); } break; - case 435: /* cmd ::= KILL COMPACT NK_INTEGER */ + case 437: /* cmd ::= KILL COMPACT NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_COMPACT_STMT, &yymsp[0].minor.yy0); } break; - case 436: /* cmd ::= BALANCE VGROUP */ + case 438: /* cmd ::= BALANCE VGROUP */ { pCxt->pRootNode = createBalanceVgroupStmt(pCxt); } break; - case 437: /* cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ -{ pCxt->pRootNode = createBalanceVgroupLeaderStmt(pCxt, &yymsp[0].minor.yy533); } + case 439: /* cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ +{ pCxt->pRootNode = createBalanceVgroupLeaderStmt(pCxt, &yymsp[0].minor.yy209); } break; - case 438: /* cmd ::= BALANCE VGROUP LEADER DATABASE db_name */ -{ pCxt->pRootNode = createBalanceVgroupLeaderDBNameStmt(pCxt, &yymsp[0].minor.yy533); } + case 440: /* cmd ::= BALANCE VGROUP LEADER DATABASE db_name */ +{ pCxt->pRootNode = createBalanceVgroupLeaderDBNameStmt(pCxt, &yymsp[0].minor.yy209); } break; - case 439: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + case 441: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ { pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } break; - case 440: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ -{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy334); } + case 442: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ +{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy456); } break; - case 441: /* cmd ::= SPLIT VGROUP NK_INTEGER */ + case 443: /* cmd ::= SPLIT VGROUP NK_INTEGER */ { pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); } break; - case 444: /* dnode_list ::= DNODE NK_INTEGER */ -{ yymsp[-1].minor.yy334 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + case 446: /* dnode_list ::= DNODE NK_INTEGER */ +{ yymsp[-1].minor.yy456 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } break; - case 446: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ -{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy560, yymsp[0].minor.yy560); } + case 448: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ +{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy840, yymsp[0].minor.yy840); } break; - case 449: /* insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ -{ yymsp[-6].minor.yy560 = createInsertStmt(pCxt, yymsp[-4].minor.yy560, yymsp[-2].minor.yy334, yymsp[0].minor.yy560); } + case 451: /* insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ +{ yymsp[-6].minor.yy840 = createInsertStmt(pCxt, yymsp[-4].minor.yy840, yymsp[-2].minor.yy456, yymsp[0].minor.yy840); } break; - case 450: /* insert_query ::= INSERT INTO full_table_name query_or_subquery */ -{ yymsp[-3].minor.yy560 = createInsertStmt(pCxt, yymsp[-1].minor.yy560, NULL, yymsp[0].minor.yy560); } + case 452: /* insert_query ::= INSERT INTO full_table_name query_or_subquery */ +{ yymsp[-3].minor.yy840 = createInsertStmt(pCxt, yymsp[-1].minor.yy840, NULL, yymsp[0].minor.yy840); } break; - case 451: /* tags_literal ::= NK_INTEGER */ - case 463: /* tags_literal ::= NK_BIN */ yytestcase(yyruleno==463); - case 472: /* tags_literal ::= NK_HEX */ yytestcase(yyruleno==472); -{ yylhsminor.yy560 = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0, NULL); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 453: /* tags_literal ::= NK_INTEGER */ + case 465: /* tags_literal ::= NK_BIN */ yytestcase(yyruleno==465); + case 474: /* tags_literal ::= NK_HEX */ yytestcase(yyruleno==474); +{ yylhsminor.yy840 = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0, NULL); } + yymsp[0].minor.yy840 = yylhsminor.yy840; break; - case 452: /* tags_literal ::= NK_INTEGER NK_PLUS duration_literal */ - case 453: /* tags_literal ::= NK_INTEGER NK_MINUS duration_literal */ yytestcase(yyruleno==453); - case 464: /* tags_literal ::= NK_BIN NK_PLUS duration_literal */ yytestcase(yyruleno==464); - case 465: /* tags_literal ::= NK_BIN NK_MINUS duration_literal */ yytestcase(yyruleno==465); - case 473: /* tags_literal ::= NK_HEX NK_PLUS duration_literal */ yytestcase(yyruleno==473); - case 474: /* tags_literal ::= NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==474); - case 482: /* tags_literal ::= NK_STRING NK_PLUS duration_literal */ yytestcase(yyruleno==482); - case 483: /* tags_literal ::= NK_STRING NK_MINUS duration_literal */ yytestcase(yyruleno==483); + case 454: /* tags_literal ::= NK_INTEGER NK_PLUS duration_literal */ + case 455: /* tags_literal ::= NK_INTEGER NK_MINUS duration_literal */ yytestcase(yyruleno==455); + case 466: /* tags_literal ::= NK_BIN NK_PLUS duration_literal */ yytestcase(yyruleno==466); + case 467: /* tags_literal ::= NK_BIN NK_MINUS duration_literal */ yytestcase(yyruleno==467); + case 475: /* tags_literal ::= NK_HEX NK_PLUS duration_literal */ yytestcase(yyruleno==475); + case 476: /* tags_literal ::= NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==476); + case 484: /* tags_literal ::= NK_STRING NK_PLUS duration_literal */ yytestcase(yyruleno==484); + case 485: /* tags_literal ::= NK_STRING NK_MINUS duration_literal */ yytestcase(yyruleno==485); { SToken l = yymsp[-2].minor.yy0; - SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); + SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy840); l.n = (r.z + r.n) - l.z; - yylhsminor.yy560 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, yymsp[0].minor.yy560); + yylhsminor.yy840 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, yymsp[0].minor.yy840); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 454: /* tags_literal ::= NK_PLUS NK_INTEGER */ - case 457: /* tags_literal ::= NK_MINUS NK_INTEGER */ yytestcase(yyruleno==457); - case 466: /* tags_literal ::= NK_PLUS NK_BIN */ yytestcase(yyruleno==466); - case 469: /* tags_literal ::= NK_MINUS NK_BIN */ yytestcase(yyruleno==469); - case 475: /* tags_literal ::= NK_PLUS NK_HEX */ yytestcase(yyruleno==475); - case 478: /* tags_literal ::= NK_MINUS NK_HEX */ yytestcase(yyruleno==478); + yymsp[-2].minor.yy840 = yylhsminor.yy840; + break; + case 456: /* tags_literal ::= NK_PLUS NK_INTEGER */ + case 459: /* tags_literal ::= NK_MINUS NK_INTEGER */ yytestcase(yyruleno==459); + case 468: /* tags_literal ::= NK_PLUS NK_BIN */ yytestcase(yyruleno==468); + case 471: /* tags_literal ::= NK_MINUS NK_BIN */ yytestcase(yyruleno==471); + case 477: /* tags_literal ::= NK_PLUS NK_HEX */ yytestcase(yyruleno==477); + case 480: /* tags_literal ::= NK_MINUS NK_HEX */ yytestcase(yyruleno==480); { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy560 = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &t, NULL); + yylhsminor.yy840 = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &t, NULL); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; - break; - case 455: /* tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal */ - case 456: /* tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal */ yytestcase(yyruleno==456); - case 458: /* tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal */ yytestcase(yyruleno==458); - case 459: /* tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal */ yytestcase(yyruleno==459); - case 467: /* tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal */ yytestcase(yyruleno==467); - case 468: /* tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal */ yytestcase(yyruleno==468); - case 470: /* tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal */ yytestcase(yyruleno==470); - case 471: /* tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal */ yytestcase(yyruleno==471); - case 476: /* tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal */ yytestcase(yyruleno==476); - case 477: /* tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==477); - case 479: /* tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal */ yytestcase(yyruleno==479); - case 480: /* tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==480); + yymsp[-1].minor.yy840 = yylhsminor.yy840; + break; + case 457: /* tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal */ + case 458: /* tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal */ yytestcase(yyruleno==458); + case 460: /* tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal */ yytestcase(yyruleno==460); + case 461: /* tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal */ yytestcase(yyruleno==461); + case 469: /* tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal */ yytestcase(yyruleno==469); + case 470: /* tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal */ yytestcase(yyruleno==470); + case 472: /* tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal */ yytestcase(yyruleno==472); + case 473: /* tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal */ yytestcase(yyruleno==473); + case 478: /* tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal */ yytestcase(yyruleno==478); + case 479: /* tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==479); + case 481: /* tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal */ yytestcase(yyruleno==481); + case 482: /* tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==482); { SToken l = yymsp[-3].minor.yy0; - SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); + SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy840); l.n = (r.z + r.n) - l.z; - yylhsminor.yy560 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, yymsp[0].minor.yy560); + yylhsminor.yy840 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, yymsp[0].minor.yy840); } - yymsp[-3].minor.yy560 = yylhsminor.yy560; + yymsp[-3].minor.yy840 = yylhsminor.yy840; break; - case 460: /* tags_literal ::= NK_FLOAT */ -{ yylhsminor.yy560 = createRawValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0, NULL); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 462: /* tags_literal ::= NK_FLOAT */ +{ yylhsminor.yy840 = createRawValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0, NULL); } + yymsp[0].minor.yy840 = yylhsminor.yy840; break; - case 461: /* tags_literal ::= NK_PLUS NK_FLOAT */ - case 462: /* tags_literal ::= NK_MINUS NK_FLOAT */ yytestcase(yyruleno==462); + case 463: /* tags_literal ::= NK_PLUS NK_FLOAT */ + case 464: /* tags_literal ::= NK_MINUS NK_FLOAT */ yytestcase(yyruleno==464); { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy560 = createRawValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t, NULL); + yylhsminor.yy840 = createRawValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t, NULL); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; + yymsp[-1].minor.yy840 = yylhsminor.yy840; break; - case 481: /* tags_literal ::= NK_STRING */ -{ yylhsminor.yy560 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0, NULL); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 483: /* tags_literal ::= NK_STRING */ +{ yylhsminor.yy840 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0, NULL); } + yymsp[0].minor.yy840 = yylhsminor.yy840; break; - case 484: /* tags_literal ::= NK_BOOL */ -{ yylhsminor.yy560 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0, NULL); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 486: /* tags_literal ::= NK_BOOL */ +{ yylhsminor.yy840 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0, NULL); } + yymsp[0].minor.yy840 = yylhsminor.yy840; break; - case 485: /* tags_literal ::= NULL */ -{ yylhsminor.yy560 = createRawValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0, NULL); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 487: /* tags_literal ::= NULL */ +{ yylhsminor.yy840 = createRawValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0, NULL); } + yymsp[0].minor.yy840 = yylhsminor.yy840; break; - case 486: /* tags_literal ::= literal_func */ -{ yylhsminor.yy560 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BINARY, NULL, yymsp[0].minor.yy560); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 488: /* tags_literal ::= literal_func */ +{ yylhsminor.yy840 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BINARY, NULL, yymsp[0].minor.yy840); } + yymsp[0].minor.yy840 = yylhsminor.yy840; break; - case 487: /* tags_literal ::= literal_func NK_PLUS duration_literal */ - case 488: /* tags_literal ::= literal_func NK_MINUS duration_literal */ yytestcase(yyruleno==488); + case 489: /* tags_literal ::= literal_func NK_PLUS duration_literal */ + case 490: /* tags_literal ::= literal_func NK_MINUS duration_literal */ yytestcase(yyruleno==490); { - SToken l = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); + SToken l = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy840); + SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy840); l.n = (r.z + r.n) - l.z; - yylhsminor.yy560 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, yymsp[-2].minor.yy560, yymsp[0].minor.yy560); + yylhsminor.yy840 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, yymsp[-2].minor.yy840, yymsp[0].minor.yy840); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 491: /* literal ::= NK_INTEGER */ -{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy560 = yylhsminor.yy560; - break; - case 492: /* literal ::= NK_FLOAT */ -{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy560 = yylhsminor.yy560; - break; - case 493: /* literal ::= NK_STRING */ -{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy560 = yylhsminor.yy560; - break; - case 494: /* literal ::= NK_BOOL */ -{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy560 = yylhsminor.yy560; - break; - case 495: /* literal ::= TIMESTAMP NK_STRING */ -{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; - break; - case 496: /* literal ::= duration_literal */ - case 506: /* signed_literal ::= signed */ yytestcase(yyruleno==506); - case 530: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==530); - case 531: /* expression ::= literal */ yytestcase(yyruleno==531); - case 533: /* expression ::= column_reference */ yytestcase(yyruleno==533); - case 534: /* expression ::= function_expression */ yytestcase(yyruleno==534); - case 535: /* expression ::= case_when_expression */ yytestcase(yyruleno==535); - case 578: /* function_expression ::= literal_func */ yytestcase(yyruleno==578); - case 579: /* function_expression ::= rand_func */ yytestcase(yyruleno==579); - case 637: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==637); - case 641: /* boolean_primary ::= predicate */ yytestcase(yyruleno==641); - case 643: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==643); - case 644: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==644); - case 647: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==647); - case 649: /* table_reference ::= table_primary */ yytestcase(yyruleno==649); - case 650: /* table_reference ::= joined_table */ yytestcase(yyruleno==650); - case 654: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==654); - case 739: /* query_simple ::= query_specification */ yytestcase(yyruleno==739); - case 740: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==740); - case 743: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==743); - case 745: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==745); -{ yylhsminor.yy560 = yymsp[0].minor.yy560; } - yymsp[0].minor.yy560 = yylhsminor.yy560; - break; - case 497: /* literal ::= NULL */ -{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy560 = yylhsminor.yy560; - break; - case 498: /* literal ::= NK_QUESTION */ -{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy560 = yylhsminor.yy560; - break; - case 499: /* duration_literal ::= NK_VARIABLE */ - case 714: /* interval_sliding_duration_literal ::= NK_VARIABLE */ yytestcase(yyruleno==714); - case 715: /* interval_sliding_duration_literal ::= NK_STRING */ yytestcase(yyruleno==715); - case 716: /* interval_sliding_duration_literal ::= NK_INTEGER */ yytestcase(yyruleno==716); -{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy560 = yylhsminor.yy560; - break; - case 500: /* signed ::= NK_INTEGER */ -{ yylhsminor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy560 = yylhsminor.yy560; - break; - case 501: /* signed ::= NK_PLUS NK_INTEGER */ -{ yymsp[-1].minor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } - break; - case 502: /* signed ::= NK_MINUS NK_INTEGER */ + yymsp[-2].minor.yy840 = yylhsminor.yy840; + break; + case 493: /* literal ::= NK_INTEGER */ +{ yylhsminor.yy840 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy840 = yylhsminor.yy840; + break; + case 494: /* literal ::= NK_FLOAT */ +{ yylhsminor.yy840 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy840 = yylhsminor.yy840; + break; + case 495: /* literal ::= NK_STRING */ +{ yylhsminor.yy840 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy840 = yylhsminor.yy840; + break; + case 496: /* literal ::= NK_BOOL */ +{ yylhsminor.yy840 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy840 = yylhsminor.yy840; + break; + case 497: /* literal ::= TIMESTAMP NK_STRING */ +{ yylhsminor.yy840 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } + yymsp[-1].minor.yy840 = yylhsminor.yy840; + break; + case 498: /* literal ::= duration_literal */ + case 508: /* signed_literal ::= signed */ yytestcase(yyruleno==508); + case 532: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==532); + case 533: /* expression ::= literal */ yytestcase(yyruleno==533); + case 535: /* expression ::= column_reference */ yytestcase(yyruleno==535); + case 536: /* expression ::= function_expression */ yytestcase(yyruleno==536); + case 537: /* expression ::= case_when_expression */ yytestcase(yyruleno==537); + case 580: /* function_expression ::= literal_func */ yytestcase(yyruleno==580); + case 581: /* function_expression ::= rand_func */ yytestcase(yyruleno==581); + case 639: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==639); + case 643: /* boolean_primary ::= predicate */ yytestcase(yyruleno==643); + case 645: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==645); + case 646: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==646); + case 649: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==649); + case 651: /* table_reference ::= table_primary */ yytestcase(yyruleno==651); + case 652: /* table_reference ::= joined_table */ yytestcase(yyruleno==652); + case 656: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==656); + case 741: /* query_simple ::= query_specification */ yytestcase(yyruleno==741); + case 742: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==742); + case 745: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==745); + case 747: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==747); +{ yylhsminor.yy840 = yymsp[0].minor.yy840; } + yymsp[0].minor.yy840 = yylhsminor.yy840; + break; + case 499: /* literal ::= NULL */ +{ yylhsminor.yy840 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy840 = yylhsminor.yy840; + break; + case 500: /* literal ::= NK_QUESTION */ +{ yylhsminor.yy840 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy840 = yylhsminor.yy840; + break; + case 501: /* duration_literal ::= NK_VARIABLE */ + case 716: /* interval_sliding_duration_literal ::= NK_VARIABLE */ yytestcase(yyruleno==716); + case 717: /* interval_sliding_duration_literal ::= NK_STRING */ yytestcase(yyruleno==717); + case 718: /* interval_sliding_duration_literal ::= NK_INTEGER */ yytestcase(yyruleno==718); +{ yylhsminor.yy840 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy840 = yylhsminor.yy840; + break; + case 502: /* signed ::= NK_INTEGER */ +{ yylhsminor.yy840 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy840 = yylhsminor.yy840; + break; + case 503: /* signed ::= NK_PLUS NK_INTEGER */ +{ yymsp[-1].minor.yy840 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } + break; + case 504: /* 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.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); + yylhsminor.yy840 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; + yymsp[-1].minor.yy840 = yylhsminor.yy840; break; - case 503: /* signed ::= NK_FLOAT */ -{ yylhsminor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 505: /* signed ::= NK_FLOAT */ +{ yylhsminor.yy840 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy840 = yylhsminor.yy840; break; - case 504: /* signed ::= NK_PLUS NK_FLOAT */ -{ yymsp[-1].minor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + case 506: /* signed ::= NK_PLUS NK_FLOAT */ +{ yymsp[-1].minor.yy840 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } break; - case 505: /* signed ::= NK_MINUS NK_FLOAT */ + case 507: /* 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.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); + yylhsminor.yy840 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; - break; - case 507: /* signed_literal ::= NK_STRING */ -{ yylhsminor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy560 = yylhsminor.yy560; - break; - case 508: /* signed_literal ::= NK_BOOL */ -{ yylhsminor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy560 = yylhsminor.yy560; - break; - case 509: /* signed_literal ::= TIMESTAMP NK_STRING */ -{ yymsp[-1].minor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } - break; - case 510: /* signed_literal ::= duration_literal */ - case 512: /* signed_literal ::= literal_func */ yytestcase(yyruleno==512); - case 608: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==608); - case 691: /* select_item ::= common_expression */ yytestcase(yyruleno==691); - case 701: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==701); - case 744: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==744); - case 746: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==746); - case 759: /* search_condition ::= common_expression */ yytestcase(yyruleno==759); -{ yylhsminor.yy560 = releaseRawExprNode(pCxt, yymsp[0].minor.yy560); } - yymsp[0].minor.yy560 = yylhsminor.yy560; - break; - case 511: /* signed_literal ::= NULL */ -{ yylhsminor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy560 = yylhsminor.yy560; - break; - case 513: /* signed_literal ::= NK_QUESTION */ -{ yylhsminor.yy560 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy560 = yylhsminor.yy560; - break; - case 532: /* expression ::= pseudo_column */ -{ yylhsminor.yy560 = yymsp[0].minor.yy560; (void)setRawExprNodeIsPseudoColumn(pCxt, yylhsminor.yy560, true); } - yymsp[0].minor.yy560 = yylhsminor.yy560; - break; - case 536: /* expression ::= NK_LP expression NK_RP */ - case 642: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==642); - case 758: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==758); -{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy560)); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 537: /* expression ::= NK_PLUS expr_or_subquery */ + yymsp[-1].minor.yy840 = yylhsminor.yy840; + break; + case 509: /* signed_literal ::= NK_STRING */ +{ yylhsminor.yy840 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy840 = yylhsminor.yy840; + break; + case 510: /* signed_literal ::= NK_BOOL */ +{ yylhsminor.yy840 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy840 = yylhsminor.yy840; + break; + case 511: /* signed_literal ::= TIMESTAMP NK_STRING */ +{ yymsp[-1].minor.yy840 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } + break; + case 512: /* signed_literal ::= duration_literal */ + case 514: /* signed_literal ::= literal_func */ yytestcase(yyruleno==514); + case 610: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==610); + case 693: /* select_item ::= common_expression */ yytestcase(yyruleno==693); + case 703: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==703); + case 746: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==746); + case 748: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==748); + case 761: /* search_condition ::= common_expression */ yytestcase(yyruleno==761); +{ yylhsminor.yy840 = releaseRawExprNode(pCxt, yymsp[0].minor.yy840); } + yymsp[0].minor.yy840 = yylhsminor.yy840; + break; + case 513: /* signed_literal ::= NULL */ +{ yylhsminor.yy840 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy840 = yylhsminor.yy840; + break; + case 515: /* signed_literal ::= NK_QUESTION */ +{ yylhsminor.yy840 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy840 = yylhsminor.yy840; + break; + case 534: /* expression ::= pseudo_column */ +{ yylhsminor.yy840 = yymsp[0].minor.yy840; (void)setRawExprNodeIsPseudoColumn(pCxt, yylhsminor.yy840, true); } + yymsp[0].minor.yy840 = yylhsminor.yy840; + break; + case 538: /* expression ::= NK_LP expression NK_RP */ + case 644: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==644); + case 760: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==760); +{ yylhsminor.yy840 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy840)); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; + break; + case 539: /* expression ::= NK_PLUS expr_or_subquery */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy560)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy840); + yylhsminor.yy840 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy840)); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; + yymsp[-1].minor.yy840 = yylhsminor.yy840; break; - case 538: /* expression ::= NK_MINUS expr_or_subquery */ + case 540: /* expression ::= NK_MINUS expr_or_subquery */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy560), NULL)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy840); + yylhsminor.yy840 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy840), NULL)); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; + yymsp[-1].minor.yy840 = yylhsminor.yy840; break; - case 539: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ + case 541: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy840); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy840); + yylhsminor.yy840 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy840), releaseRawExprNode(pCxt, yymsp[0].minor.yy840))); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; - case 540: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ + case 542: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy840); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy840); + yylhsminor.yy840 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy840), releaseRawExprNode(pCxt, yymsp[0].minor.yy840))); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; - case 541: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */ + case 543: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy840); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy840); + yylhsminor.yy840 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy840), releaseRawExprNode(pCxt, yymsp[0].minor.yy840))); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; - case 542: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ + case 544: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy840); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy840); + yylhsminor.yy840 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy840), releaseRawExprNode(pCxt, yymsp[0].minor.yy840))); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; - case 543: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */ + case 545: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy840); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy840); + yylhsminor.yy840 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy840), releaseRawExprNode(pCxt, yymsp[0].minor.yy840))); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; - case 544: /* expression ::= column_reference NK_ARROW NK_STRING */ + case 546: /* expression ::= column_reference NK_ARROW NK_STRING */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy840); + yylhsminor.yy840 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy840), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; - case 545: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ + case 547: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy840); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy840); + yylhsminor.yy840 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy840), releaseRawExprNode(pCxt, yymsp[0].minor.yy840))); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; - case 546: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ + case 548: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy840); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy840); + yylhsminor.yy840 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy840), releaseRawExprNode(pCxt, yymsp[0].minor.yy840))); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 549: /* column_reference ::= column_name */ -{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy533, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy533)); } - yymsp[0].minor.yy560 = yylhsminor.yy560; - break; - case 550: /* column_reference ::= table_name NK_DOT column_name */ -{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy533, &yymsp[0].minor.yy533, createColumnNode(pCxt, &yymsp[-2].minor.yy533, &yymsp[0].minor.yy533)); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 551: /* column_reference ::= NK_ALIAS */ -{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy560 = yylhsminor.yy560; - break; - case 552: /* column_reference ::= table_name NK_DOT NK_ALIAS */ -{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy533, &yymsp[0].minor.yy0, createColumnNode(pCxt, &yymsp[-2].minor.yy533, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 553: /* pseudo_column ::= ROWTS */ - case 554: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==554); - case 556: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==556); - case 557: /* pseudo_column ::= QEND */ yytestcase(yyruleno==557); - case 558: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==558); - case 559: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==559); - case 560: /* pseudo_column ::= WEND */ yytestcase(yyruleno==560); - case 561: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==561); - case 562: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==562); - case 563: /* pseudo_column ::= ISFILLED */ yytestcase(yyruleno==563); - case 564: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==564); - case 581: /* literal_func ::= NOW */ yytestcase(yyruleno==581); - case 582: /* literal_func ::= TODAY */ yytestcase(yyruleno==582); -{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } - yymsp[0].minor.yy560 = yylhsminor.yy560; - break; - case 555: /* pseudo_column ::= table_name NK_DOT TBNAME */ -{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy533, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy533)))); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 565: /* function_expression ::= function_name NK_LP expression_list NK_RP */ - case 566: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==566); - case 574: /* function_expression ::= substr_func NK_LP expression_list NK_RP */ yytestcase(yyruleno==574); -{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy533, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy533, yymsp[-1].minor.yy334)); } - yymsp[-3].minor.yy560 = yylhsminor.yy560; - break; - case 567: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ - case 568: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP */ yytestcase(yyruleno==568); -{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), yymsp[-1].minor.yy952)); } - yymsp[-5].minor.yy560 = yylhsminor.yy560; - break; - case 569: /* function_expression ::= POSITION NK_LP expr_or_subquery IN expr_or_subquery NK_RP */ -{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createPositionFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), releaseRawExprNode(pCxt, yymsp[-1].minor.yy560))); } - yymsp[-5].minor.yy560 = yylhsminor.yy560; - break; - case 570: /* function_expression ::= TRIM NK_LP expr_or_subquery NK_RP */ -{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createTrimFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy560), TRIM_TYPE_BOTH)); } - yymsp[-3].minor.yy560 = yylhsminor.yy560; - break; - case 571: /* function_expression ::= TRIM NK_LP trim_specification_type FROM expr_or_subquery NK_RP */ -{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createTrimFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy560), yymsp[-3].minor.yy672)); } - yymsp[-5].minor.yy560 = yylhsminor.yy560; - break; - case 572: /* function_expression ::= TRIM NK_LP expr_or_subquery FROM expr_or_subquery NK_RP */ -{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createTrimFunctionNodeExt(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), releaseRawExprNode(pCxt, yymsp[-1].minor.yy560), TRIM_TYPE_BOTH)); } - yymsp[-5].minor.yy560 = yylhsminor.yy560; - break; - case 573: /* function_expression ::= TRIM NK_LP trim_specification_type expr_or_subquery FROM expr_or_subquery NK_RP */ -{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-6].minor.yy0, &yymsp[0].minor.yy0, createTrimFunctionNodeExt(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), releaseRawExprNode(pCxt, yymsp[-1].minor.yy560), yymsp[-4].minor.yy672)); } - yymsp[-6].minor.yy560 = yylhsminor.yy560; - break; - case 575: /* function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery NK_RP */ -{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy533, &yymsp[0].minor.yy0, createSubstrFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), releaseRawExprNode(pCxt, yymsp[-1].minor.yy560))); } - yymsp[-5].minor.yy560 = yylhsminor.yy560; - break; - case 576: /* function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery FOR expr_or_subquery NK_RP */ -{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-7].minor.yy533, &yymsp[0].minor.yy0, createSubstrFunctionNodeExt(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy560), releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), releaseRawExprNode(pCxt, yymsp[-1].minor.yy560))); } - yymsp[-7].minor.yy560 = yylhsminor.yy560; - break; - case 577: /* function_expression ::= REPLACE NK_LP expression_list NK_RP */ - case 584: /* rand_func ::= RAND NK_LP expression_list NK_RP */ yytestcase(yyruleno==584); -{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy334)); } - yymsp[-3].minor.yy560 = yylhsminor.yy560; - break; - case 580: /* literal_func ::= noarg_func NK_LP NK_RP */ -{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy533, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy533, NULL)); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 583: /* rand_func ::= RAND NK_LP NK_RP */ -{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy0, NULL)); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 587: /* trim_specification_type ::= BOTH */ -{ yymsp[0].minor.yy672 = TRIM_TYPE_BOTH; } - break; - case 588: /* trim_specification_type ::= TRAILING */ -{ yymsp[0].minor.yy672 = TRIM_TYPE_TRAILING; } - break; - case 589: /* trim_specification_type ::= LEADING */ -{ yymsp[0].minor.yy672 = TRIM_TYPE_LEADING; } - break; - case 604: /* star_func_para_list ::= NK_STAR */ -{ yylhsminor.yy334 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy334 = yylhsminor.yy334; - break; - case 609: /* star_func_para ::= table_name NK_DOT NK_STAR */ - case 694: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==694); -{ yylhsminor.yy560 = createColumnNode(pCxt, &yymsp[-2].minor.yy533, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; - break; - case 610: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */ -{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy334, yymsp[-1].minor.yy560)); } - yymsp[-3].minor.yy560 = yylhsminor.yy560; - break; - case 611: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ -{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), yymsp[-2].minor.yy334, yymsp[-1].minor.yy560)); } - yymsp[-4].minor.yy560 = yylhsminor.yy560; - break; - case 614: /* when_then_expr ::= WHEN common_expression THEN common_expression */ -{ yymsp[-3].minor.yy560 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560)); } - break; - case 616: /* case_when_else_opt ::= ELSE common_expression */ -{ yymsp[-1].minor.yy560 = releaseRawExprNode(pCxt, yymsp[0].minor.yy560); } - break; - case 617: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */ - case 622: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==622); + yymsp[-2].minor.yy840 = yylhsminor.yy840; + break; + case 551: /* column_reference ::= column_name */ +{ yylhsminor.yy840 = createRawExprNode(pCxt, &yymsp[0].minor.yy209, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy209)); } + yymsp[0].minor.yy840 = yylhsminor.yy840; + break; + case 552: /* column_reference ::= table_name NK_DOT column_name */ +{ yylhsminor.yy840 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy209, &yymsp[0].minor.yy209, createColumnNode(pCxt, &yymsp[-2].minor.yy209, &yymsp[0].minor.yy209)); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; + break; + case 553: /* column_reference ::= NK_ALIAS */ +{ yylhsminor.yy840 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy840 = yylhsminor.yy840; + break; + case 554: /* column_reference ::= table_name NK_DOT NK_ALIAS */ +{ yylhsminor.yy840 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy209, &yymsp[0].minor.yy0, createColumnNode(pCxt, &yymsp[-2].minor.yy209, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; + break; + case 555: /* pseudo_column ::= ROWTS */ + case 556: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==556); + case 558: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==558); + case 559: /* pseudo_column ::= QEND */ yytestcase(yyruleno==559); + case 560: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==560); + case 561: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==561); + case 562: /* pseudo_column ::= WEND */ yytestcase(yyruleno==562); + case 563: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==563); + case 564: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==564); + case 565: /* pseudo_column ::= ISFILLED */ yytestcase(yyruleno==565); + case 566: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==566); + case 583: /* literal_func ::= NOW */ yytestcase(yyruleno==583); + case 584: /* literal_func ::= TODAY */ yytestcase(yyruleno==584); +{ yylhsminor.yy840 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } + yymsp[0].minor.yy840 = yylhsminor.yy840; + break; + case 557: /* pseudo_column ::= table_name NK_DOT TBNAME */ +{ yylhsminor.yy840 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy209, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy209)))); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; + break; + case 567: /* function_expression ::= function_name NK_LP expression_list NK_RP */ + case 568: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==568); + case 576: /* function_expression ::= substr_func NK_LP expression_list NK_RP */ yytestcase(yyruleno==576); +{ yylhsminor.yy840 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy209, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy209, yymsp[-1].minor.yy456)); } + yymsp[-3].minor.yy840 = yylhsminor.yy840; + break; + case 569: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ + case 570: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP */ yytestcase(yyruleno==570); +{ yylhsminor.yy840 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy840), yymsp[-1].minor.yy48)); } + yymsp[-5].minor.yy840 = yylhsminor.yy840; + break; + case 571: /* function_expression ::= POSITION NK_LP expr_or_subquery IN expr_or_subquery NK_RP */ +{ yylhsminor.yy840 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createPositionFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy840), releaseRawExprNode(pCxt, yymsp[-1].minor.yy840))); } + yymsp[-5].minor.yy840 = yylhsminor.yy840; + break; + case 572: /* function_expression ::= TRIM NK_LP expr_or_subquery NK_RP */ +{ yylhsminor.yy840 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createTrimFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy840), TRIM_TYPE_BOTH)); } + yymsp[-3].minor.yy840 = yylhsminor.yy840; + break; + case 573: /* function_expression ::= TRIM NK_LP trim_specification_type FROM expr_or_subquery NK_RP */ +{ yylhsminor.yy840 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createTrimFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy840), yymsp[-3].minor.yy512)); } + yymsp[-5].minor.yy840 = yylhsminor.yy840; + break; + case 574: /* function_expression ::= TRIM NK_LP expr_or_subquery FROM expr_or_subquery NK_RP */ +{ yylhsminor.yy840 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createTrimFunctionNodeExt(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy840), releaseRawExprNode(pCxt, yymsp[-1].minor.yy840), TRIM_TYPE_BOTH)); } + yymsp[-5].minor.yy840 = yylhsminor.yy840; + break; + case 575: /* function_expression ::= TRIM NK_LP trim_specification_type expr_or_subquery FROM expr_or_subquery NK_RP */ +{ yylhsminor.yy840 = createRawExprNodeExt(pCxt, &yymsp[-6].minor.yy0, &yymsp[0].minor.yy0, createTrimFunctionNodeExt(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy840), releaseRawExprNode(pCxt, yymsp[-1].minor.yy840), yymsp[-4].minor.yy512)); } + yymsp[-6].minor.yy840 = yylhsminor.yy840; + break; + case 577: /* function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery NK_RP */ +{ yylhsminor.yy840 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy209, &yymsp[0].minor.yy0, createSubstrFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy840), releaseRawExprNode(pCxt, yymsp[-1].minor.yy840))); } + yymsp[-5].minor.yy840 = yylhsminor.yy840; + break; + case 578: /* function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery FOR expr_or_subquery NK_RP */ +{ yylhsminor.yy840 = createRawExprNodeExt(pCxt, &yymsp[-7].minor.yy209, &yymsp[0].minor.yy0, createSubstrFunctionNodeExt(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy840), releaseRawExprNode(pCxt, yymsp[-3].minor.yy840), releaseRawExprNode(pCxt, yymsp[-1].minor.yy840))); } + yymsp[-7].minor.yy840 = yylhsminor.yy840; + break; + case 579: /* function_expression ::= REPLACE NK_LP expression_list NK_RP */ + case 586: /* rand_func ::= RAND NK_LP expression_list NK_RP */ yytestcase(yyruleno==586); +{ yylhsminor.yy840 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy456)); } + yymsp[-3].minor.yy840 = yylhsminor.yy840; + break; + case 582: /* literal_func ::= noarg_func NK_LP NK_RP */ +{ yylhsminor.yy840 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy209, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy209, NULL)); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; + break; + case 585: /* rand_func ::= RAND NK_LP NK_RP */ +{ yylhsminor.yy840 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy0, NULL)); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; + break; + case 589: /* trim_specification_type ::= BOTH */ +{ yymsp[0].minor.yy512 = TRIM_TYPE_BOTH; } + break; + case 590: /* trim_specification_type ::= TRAILING */ +{ yymsp[0].minor.yy512 = TRIM_TYPE_TRAILING; } + break; + case 591: /* trim_specification_type ::= LEADING */ +{ yymsp[0].minor.yy512 = TRIM_TYPE_LEADING; } + break; + case 606: /* star_func_para_list ::= NK_STAR */ +{ yylhsminor.yy456 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy456 = yylhsminor.yy456; + break; + case 611: /* star_func_para ::= table_name NK_DOT NK_STAR */ + case 696: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==696); +{ yylhsminor.yy840 = createColumnNode(pCxt, &yymsp[-2].minor.yy209, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; + break; + case 612: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */ +{ yylhsminor.yy840 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy456, yymsp[-1].minor.yy840)); } + yymsp[-3].minor.yy840 = yylhsminor.yy840; + break; + case 613: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ +{ yylhsminor.yy840 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy840), yymsp[-2].minor.yy456, yymsp[-1].minor.yy840)); } + yymsp[-4].minor.yy840 = yylhsminor.yy840; + break; + case 616: /* when_then_expr ::= WHEN common_expression THEN common_expression */ +{ yymsp[-3].minor.yy840 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy840), releaseRawExprNode(pCxt, yymsp[0].minor.yy840)); } + break; + case 618: /* case_when_else_opt ::= ELSE common_expression */ +{ yymsp[-1].minor.yy840 = releaseRawExprNode(pCxt, yymsp[0].minor.yy840); } + break; + case 619: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */ + case 624: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==624); { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy506, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy840); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy840); + yylhsminor.yy840 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy108, releaseRawExprNode(pCxt, yymsp[-2].minor.yy840), releaseRawExprNode(pCxt, yymsp[0].minor.yy840))); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; - case 618: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ + case 620: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy560), releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy840); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy840); + yylhsminor.yy840 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy840), releaseRawExprNode(pCxt, yymsp[-2].minor.yy840), releaseRawExprNode(pCxt, yymsp[0].minor.yy840))); } - yymsp[-4].minor.yy560 = yylhsminor.yy560; + yymsp[-4].minor.yy840 = yylhsminor.yy840; break; - case 619: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ + case 621: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy560), releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy840); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy840); + yylhsminor.yy840 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy840), releaseRawExprNode(pCxt, yymsp[-2].minor.yy840), releaseRawExprNode(pCxt, yymsp[0].minor.yy840))); } - yymsp[-5].minor.yy560 = yylhsminor.yy560; + yymsp[-5].minor.yy840 = yylhsminor.yy840; break; - case 620: /* predicate ::= expr_or_subquery IS NULL */ + case 622: /* predicate ::= expr_or_subquery IS NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy840); + yylhsminor.yy840 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy840), NULL)); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; - case 621: /* predicate ::= expr_or_subquery IS NOT NULL */ + case 623: /* predicate ::= expr_or_subquery IS NOT NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy840); + yylhsminor.yy840 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy840), NULL)); } - yymsp[-3].minor.yy560 = yylhsminor.yy560; + yymsp[-3].minor.yy840 = yylhsminor.yy840; break; - case 623: /* compare_op ::= NK_LT */ -{ yymsp[0].minor.yy506 = OP_TYPE_LOWER_THAN; } + case 625: /* compare_op ::= NK_LT */ +{ yymsp[0].minor.yy108 = OP_TYPE_LOWER_THAN; } break; - case 624: /* compare_op ::= NK_GT */ -{ yymsp[0].minor.yy506 = OP_TYPE_GREATER_THAN; } + case 626: /* compare_op ::= NK_GT */ +{ yymsp[0].minor.yy108 = OP_TYPE_GREATER_THAN; } break; - case 625: /* compare_op ::= NK_LE */ -{ yymsp[0].minor.yy506 = OP_TYPE_LOWER_EQUAL; } + case 627: /* compare_op ::= NK_LE */ +{ yymsp[0].minor.yy108 = OP_TYPE_LOWER_EQUAL; } break; - case 626: /* compare_op ::= NK_GE */ -{ yymsp[0].minor.yy506 = OP_TYPE_GREATER_EQUAL; } + case 628: /* compare_op ::= NK_GE */ +{ yymsp[0].minor.yy108 = OP_TYPE_GREATER_EQUAL; } break; - case 627: /* compare_op ::= NK_NE */ -{ yymsp[0].minor.yy506 = OP_TYPE_NOT_EQUAL; } + case 629: /* compare_op ::= NK_NE */ +{ yymsp[0].minor.yy108 = OP_TYPE_NOT_EQUAL; } break; - case 628: /* compare_op ::= NK_EQ */ -{ yymsp[0].minor.yy506 = OP_TYPE_EQUAL; } + case 630: /* compare_op ::= NK_EQ */ +{ yymsp[0].minor.yy108 = OP_TYPE_EQUAL; } break; - case 629: /* compare_op ::= LIKE */ -{ yymsp[0].minor.yy506 = OP_TYPE_LIKE; } + case 631: /* compare_op ::= LIKE */ +{ yymsp[0].minor.yy108 = OP_TYPE_LIKE; } break; - case 630: /* compare_op ::= NOT LIKE */ -{ yymsp[-1].minor.yy506 = OP_TYPE_NOT_LIKE; } + case 632: /* compare_op ::= NOT LIKE */ +{ yymsp[-1].minor.yy108 = OP_TYPE_NOT_LIKE; } break; - case 631: /* compare_op ::= MATCH */ -{ yymsp[0].minor.yy506 = OP_TYPE_MATCH; } + case 633: /* compare_op ::= MATCH */ +{ yymsp[0].minor.yy108 = OP_TYPE_MATCH; } break; - case 632: /* compare_op ::= NMATCH */ -{ yymsp[0].minor.yy506 = OP_TYPE_NMATCH; } + case 634: /* compare_op ::= NMATCH */ +{ yymsp[0].minor.yy108 = OP_TYPE_NMATCH; } break; - case 633: /* compare_op ::= CONTAINS */ -{ yymsp[0].minor.yy506 = OP_TYPE_JSON_CONTAINS; } + case 635: /* compare_op ::= CONTAINS */ +{ yymsp[0].minor.yy108 = OP_TYPE_JSON_CONTAINS; } break; - case 634: /* in_op ::= IN */ -{ yymsp[0].minor.yy506 = OP_TYPE_IN; } + case 636: /* in_op ::= IN */ +{ yymsp[0].minor.yy108 = OP_TYPE_IN; } break; - case 635: /* in_op ::= NOT IN */ -{ yymsp[-1].minor.yy506 = OP_TYPE_NOT_IN; } + case 637: /* in_op ::= NOT IN */ +{ yymsp[-1].minor.yy108 = OP_TYPE_NOT_IN; } break; - case 636: /* in_predicate_value ::= NK_LP literal_list NK_RP */ -{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy334)); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 638: /* in_predicate_value ::= NK_LP literal_list NK_RP */ +{ yylhsminor.yy840 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy456)); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; - case 638: /* boolean_value_expression ::= NOT boolean_primary */ + case 640: /* boolean_value_expression ::= NOT boolean_primary */ { - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy560), NULL)); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy840); + yylhsminor.yy840 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy840), NULL)); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; + yymsp[-1].minor.yy840 = yylhsminor.yy840; break; - case 639: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + case 641: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy840); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy840); + yylhsminor.yy840 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy840), releaseRawExprNode(pCxt, yymsp[0].minor.yy840))); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; - case 640: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + case 642: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560); - yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy840); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy840); + yylhsminor.yy840 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy840), releaseRawExprNode(pCxt, yymsp[0].minor.yy840))); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; - case 648: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ -{ yylhsminor.yy560 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, JOIN_STYPE_NONE, yymsp[-2].minor.yy560, yymsp[0].minor.yy560, NULL); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 650: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ +{ yylhsminor.yy840 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, JOIN_STYPE_NONE, yymsp[-2].minor.yy840, yymsp[0].minor.yy840, NULL); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; - case 651: /* table_primary ::= table_name alias_opt */ -{ yylhsminor.yy560 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy533, &yymsp[0].minor.yy533); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; + case 653: /* table_primary ::= table_name alias_opt */ +{ yylhsminor.yy840 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy209, &yymsp[0].minor.yy209); } + yymsp[-1].minor.yy840 = yylhsminor.yy840; break; - case 652: /* table_primary ::= db_name NK_DOT table_name alias_opt */ -{ yylhsminor.yy560 = createRealTableNode(pCxt, &yymsp[-3].minor.yy533, &yymsp[-1].minor.yy533, &yymsp[0].minor.yy533); } - yymsp[-3].minor.yy560 = yylhsminor.yy560; + case 654: /* table_primary ::= db_name NK_DOT table_name alias_opt */ +{ yylhsminor.yy840 = createRealTableNode(pCxt, &yymsp[-3].minor.yy209, &yymsp[-1].minor.yy209, &yymsp[0].minor.yy209); } + yymsp[-3].minor.yy840 = yylhsminor.yy840; break; - case 653: /* table_primary ::= subquery alias_opt */ -{ yylhsminor.yy560 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy560), &yymsp[0].minor.yy533); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; + case 655: /* table_primary ::= subquery alias_opt */ +{ yylhsminor.yy840 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy840), &yymsp[0].minor.yy209); } + yymsp[-1].minor.yy840 = yylhsminor.yy840; break; - case 655: /* alias_opt ::= */ -{ yymsp[1].minor.yy533 = nil_token; } + case 657: /* alias_opt ::= */ +{ yymsp[1].minor.yy209 = nil_token; } break; - case 657: /* alias_opt ::= AS table_alias */ -{ yymsp[-1].minor.yy533 = yymsp[0].minor.yy533; } + case 659: /* alias_opt ::= AS table_alias */ +{ yymsp[-1].minor.yy209 = yymsp[0].minor.yy209; } break; - case 658: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - case 659: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==659); -{ yymsp[-2].minor.yy560 = yymsp[-1].minor.yy560; } + case 660: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + case 661: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==661); +{ yymsp[-2].minor.yy840 = yymsp[-1].minor.yy840; } break; - case 660: /* joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt */ + case 662: /* joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt */ { - yylhsminor.yy560 = createJoinTableNode(pCxt, yymsp[-6].minor.yy36, yymsp[-5].minor.yy648, yymsp[-7].minor.yy560, yymsp[-3].minor.yy560, yymsp[-2].minor.yy560); - yylhsminor.yy560 = addWindowOffsetClause(pCxt, yylhsminor.yy560, yymsp[-1].minor.yy560); - yylhsminor.yy560 = addJLimitClause(pCxt, yylhsminor.yy560, yymsp[0].minor.yy560); + yylhsminor.yy840 = createJoinTableNode(pCxt, yymsp[-6].minor.yy724, yymsp[-5].minor.yy278, yymsp[-7].minor.yy840, yymsp[-3].minor.yy840, yymsp[-2].minor.yy840); + yylhsminor.yy840 = addWindowOffsetClause(pCxt, yylhsminor.yy840, yymsp[-1].minor.yy840); + yylhsminor.yy840 = addJLimitClause(pCxt, yylhsminor.yy840, yymsp[0].minor.yy840); } - yymsp[-7].minor.yy560 = yylhsminor.yy560; + yymsp[-7].minor.yy840 = yylhsminor.yy840; break; - case 661: /* join_type ::= */ -{ yymsp[1].minor.yy36 = JOIN_TYPE_INNER; } + case 663: /* join_type ::= */ +{ yymsp[1].minor.yy724 = JOIN_TYPE_INNER; } break; - case 662: /* join_type ::= INNER */ -{ yymsp[0].minor.yy36 = JOIN_TYPE_INNER; } + case 664: /* join_type ::= INNER */ +{ yymsp[0].minor.yy724 = JOIN_TYPE_INNER; } break; - case 663: /* join_type ::= LEFT */ -{ yymsp[0].minor.yy36 = JOIN_TYPE_LEFT; } + case 665: /* join_type ::= LEFT */ +{ yymsp[0].minor.yy724 = JOIN_TYPE_LEFT; } break; - case 664: /* join_type ::= RIGHT */ -{ yymsp[0].minor.yy36 = JOIN_TYPE_RIGHT; } + case 666: /* join_type ::= RIGHT */ +{ yymsp[0].minor.yy724 = JOIN_TYPE_RIGHT; } break; - case 665: /* join_type ::= FULL */ -{ yymsp[0].minor.yy36 = JOIN_TYPE_FULL; } + case 667: /* join_type ::= FULL */ +{ yymsp[0].minor.yy724 = JOIN_TYPE_FULL; } break; - case 666: /* join_subtype ::= */ -{ yymsp[1].minor.yy648 = JOIN_STYPE_NONE; } + case 668: /* join_subtype ::= */ +{ yymsp[1].minor.yy278 = JOIN_STYPE_NONE; } break; - case 667: /* join_subtype ::= OUTER */ -{ yymsp[0].minor.yy648 = JOIN_STYPE_OUTER; } + case 669: /* join_subtype ::= OUTER */ +{ yymsp[0].minor.yy278 = JOIN_STYPE_OUTER; } break; - case 668: /* join_subtype ::= SEMI */ -{ yymsp[0].minor.yy648 = JOIN_STYPE_SEMI; } + case 670: /* join_subtype ::= SEMI */ +{ yymsp[0].minor.yy278 = JOIN_STYPE_SEMI; } break; - case 669: /* join_subtype ::= ANTI */ -{ yymsp[0].minor.yy648 = JOIN_STYPE_ANTI; } + case 671: /* join_subtype ::= ANTI */ +{ yymsp[0].minor.yy278 = JOIN_STYPE_ANTI; } break; - case 670: /* join_subtype ::= ASOF */ -{ yymsp[0].minor.yy648 = JOIN_STYPE_ASOF; } + case 672: /* join_subtype ::= ASOF */ +{ yymsp[0].minor.yy278 = JOIN_STYPE_ASOF; } break; - case 671: /* join_subtype ::= WINDOW */ -{ yymsp[0].minor.yy648 = JOIN_STYPE_WIN; } + case 673: /* join_subtype ::= WINDOW */ +{ yymsp[0].minor.yy278 = JOIN_STYPE_WIN; } break; - case 675: /* window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP */ -{ yymsp[-5].minor.yy560 = createWindowOffsetNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), releaseRawExprNode(pCxt, yymsp[-1].minor.yy560)); } + case 677: /* window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP */ +{ yymsp[-5].minor.yy840 = createWindowOffsetNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy840), releaseRawExprNode(pCxt, yymsp[-1].minor.yy840)); } break; - case 676: /* window_offset_literal ::= NK_VARIABLE */ -{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createTimeOffsetValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 678: /* window_offset_literal ::= NK_VARIABLE */ +{ yylhsminor.yy840 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createTimeOffsetValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy840 = yylhsminor.yy840; break; - case 677: /* window_offset_literal ::= NK_MINUS NK_VARIABLE */ + case 679: /* window_offset_literal ::= NK_MINUS NK_VARIABLE */ { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy560 = createRawExprNode(pCxt, &t, createTimeOffsetValueNode(pCxt, &t)); + yylhsminor.yy840 = createRawExprNode(pCxt, &t, createTimeOffsetValueNode(pCxt, &t)); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; + yymsp[-1].minor.yy840 = yylhsminor.yy840; break; - case 679: /* jlimit_clause_opt ::= JLIMIT NK_INTEGER */ - case 750: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ yytestcase(yyruleno==750); - case 754: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==754); -{ yymsp[-1].minor.yy560 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } + case 681: /* jlimit_clause_opt ::= JLIMIT NK_INTEGER */ + case 752: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ yytestcase(yyruleno==752); + case 756: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==756); +{ yymsp[-1].minor.yy840 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } break; - case 680: /* query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_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 682: /* query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_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[-13].minor.yy560 = createSelectStmt(pCxt, yymsp[-11].minor.yy173, yymsp[-9].minor.yy334, yymsp[-8].minor.yy560, yymsp[-12].minor.yy334); - yymsp[-13].minor.yy560 = setSelectStmtTagMode(pCxt, yymsp[-13].minor.yy560, yymsp[-10].minor.yy173); - yymsp[-13].minor.yy560 = addWhereClause(pCxt, yymsp[-13].minor.yy560, yymsp[-7].minor.yy560); - yymsp[-13].minor.yy560 = addPartitionByClause(pCxt, yymsp[-13].minor.yy560, yymsp[-6].minor.yy334); - yymsp[-13].minor.yy560 = addWindowClauseClause(pCxt, yymsp[-13].minor.yy560, yymsp[-2].minor.yy560); - yymsp[-13].minor.yy560 = addGroupByClause(pCxt, yymsp[-13].minor.yy560, yymsp[-1].minor.yy334); - yymsp[-13].minor.yy560 = addHavingClause(pCxt, yymsp[-13].minor.yy560, yymsp[0].minor.yy560); - yymsp[-13].minor.yy560 = addRangeClause(pCxt, yymsp[-13].minor.yy560, yymsp[-5].minor.yy560); - yymsp[-13].minor.yy560 = addEveryClause(pCxt, yymsp[-13].minor.yy560, yymsp[-4].minor.yy560); - yymsp[-13].minor.yy560 = addFillClause(pCxt, yymsp[-13].minor.yy560, yymsp[-3].minor.yy560); + yymsp[-13].minor.yy840 = createSelectStmt(pCxt, yymsp[-11].minor.yy9, yymsp[-9].minor.yy456, yymsp[-8].minor.yy840, yymsp[-12].minor.yy456); + yymsp[-13].minor.yy840 = setSelectStmtTagMode(pCxt, yymsp[-13].minor.yy840, yymsp[-10].minor.yy9); + yymsp[-13].minor.yy840 = addWhereClause(pCxt, yymsp[-13].minor.yy840, yymsp[-7].minor.yy840); + yymsp[-13].minor.yy840 = addPartitionByClause(pCxt, yymsp[-13].minor.yy840, yymsp[-6].minor.yy456); + yymsp[-13].minor.yy840 = addWindowClauseClause(pCxt, yymsp[-13].minor.yy840, yymsp[-2].minor.yy840); + yymsp[-13].minor.yy840 = addGroupByClause(pCxt, yymsp[-13].minor.yy840, yymsp[-1].minor.yy456); + yymsp[-13].minor.yy840 = addHavingClause(pCxt, yymsp[-13].minor.yy840, yymsp[0].minor.yy840); + yymsp[-13].minor.yy840 = addRangeClause(pCxt, yymsp[-13].minor.yy840, yymsp[-5].minor.yy840); + yymsp[-13].minor.yy840 = addEveryClause(pCxt, yymsp[-13].minor.yy840, yymsp[-4].minor.yy840); + yymsp[-13].minor.yy840 = addFillClause(pCxt, yymsp[-13].minor.yy840, yymsp[-3].minor.yy840); } break; - case 681: /* hint_list ::= */ -{ yymsp[1].minor.yy334 = createHintNodeList(pCxt, NULL); } + case 683: /* hint_list ::= */ +{ yymsp[1].minor.yy456 = createHintNodeList(pCxt, NULL); } break; - case 682: /* hint_list ::= NK_HINT */ -{ yylhsminor.yy334 = createHintNodeList(pCxt, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy334 = yylhsminor.yy334; + case 684: /* hint_list ::= NK_HINT */ +{ yylhsminor.yy456 = createHintNodeList(pCxt, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy456 = yylhsminor.yy456; break; - case 687: /* set_quantifier_opt ::= ALL */ -{ yymsp[0].minor.yy173 = false; } + case 689: /* set_quantifier_opt ::= ALL */ +{ yymsp[0].minor.yy9 = false; } break; - case 690: /* select_item ::= NK_STAR */ -{ yylhsminor.yy560 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy560 = yylhsminor.yy560; + case 692: /* select_item ::= NK_STAR */ +{ yylhsminor.yy840 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy840 = yylhsminor.yy840; break; - case 692: /* select_item ::= common_expression column_alias */ - case 702: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==702); -{ yylhsminor.yy560 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy560), &yymsp[0].minor.yy533); } - yymsp[-1].minor.yy560 = yylhsminor.yy560; + case 694: /* select_item ::= common_expression column_alias */ + case 704: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==704); +{ yylhsminor.yy840 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy840), &yymsp[0].minor.yy209); } + yymsp[-1].minor.yy840 = yylhsminor.yy840; break; - case 693: /* select_item ::= common_expression AS column_alias */ - case 703: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==703); -{ yylhsminor.yy560 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), &yymsp[0].minor.yy533); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 695: /* select_item ::= common_expression AS column_alias */ + case 705: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==705); +{ yylhsminor.yy840 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy840), &yymsp[0].minor.yy209); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; - case 698: /* partition_by_clause_opt ::= PARTITION BY partition_list */ - case 728: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==728); - case 748: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==748); -{ yymsp[-2].minor.yy334 = yymsp[0].minor.yy334; } + case 700: /* partition_by_clause_opt ::= PARTITION BY partition_list */ + case 730: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==730); + case 750: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==750); +{ yymsp[-2].minor.yy456 = yymsp[0].minor.yy456; } break; - case 705: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ -{ yymsp[-5].minor.yy560 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), releaseRawExprNode(pCxt, yymsp[-1].minor.yy560)); } + case 707: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ +{ yymsp[-5].minor.yy840 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy840), releaseRawExprNode(pCxt, yymsp[-1].minor.yy840)); } break; - case 706: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ -{ yymsp[-3].minor.yy560 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy560)); } + case 708: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ +{ yymsp[-3].minor.yy840 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy840)); } break; - case 707: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-5].minor.yy560 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), NULL, yymsp[-1].minor.yy560, yymsp[0].minor.yy560); } + case 709: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-5].minor.yy840 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy840), NULL, yymsp[-1].minor.yy840, yymsp[0].minor.yy840); } break; - case 708: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-7].minor.yy560 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy560), releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), yymsp[-1].minor.yy560, yymsp[0].minor.yy560); } + case 710: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-7].minor.yy840 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy840), releaseRawExprNode(pCxt, yymsp[-3].minor.yy840), yymsp[-1].minor.yy840, yymsp[0].minor.yy840); } break; - case 709: /* twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ -{ yymsp[-6].minor.yy560 = createEventWindowNode(pCxt, yymsp[-3].minor.yy560, yymsp[0].minor.yy560); } + case 711: /* twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ +{ yymsp[-6].minor.yy840 = createEventWindowNode(pCxt, yymsp[-3].minor.yy840, yymsp[0].minor.yy840); } break; - case 710: /* twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy560 = createCountWindowNode(pCxt, &yymsp[-1].minor.yy0, &yymsp[-1].minor.yy0); } + case 712: /* twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy840 = createCountWindowNode(pCxt, &yymsp[-1].minor.yy0, &yymsp[-1].minor.yy0); } break; - case 711: /* twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ -{ yymsp[-5].minor.yy560 = createCountWindowNode(pCxt, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0); } + case 713: /* twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ +{ yymsp[-5].minor.yy840 = createCountWindowNode(pCxt, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0); } break; - case 718: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ -{ yymsp[-3].minor.yy560 = createFillNode(pCxt, yymsp[-1].minor.yy18, NULL); } + case 720: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ +{ yymsp[-3].minor.yy840 = createFillNode(pCxt, yymsp[-1].minor.yy470, NULL); } break; - case 719: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ -{ yymsp[-5].minor.yy560 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy334)); } + case 721: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ +{ yymsp[-5].minor.yy840 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy456)); } break; - case 720: /* fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ -{ yymsp[-5].minor.yy560 = createFillNode(pCxt, FILL_MODE_VALUE_F, createNodeListNode(pCxt, yymsp[-1].minor.yy334)); } + case 722: /* fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ +{ yymsp[-5].minor.yy840 = createFillNode(pCxt, FILL_MODE_VALUE_F, createNodeListNode(pCxt, yymsp[-1].minor.yy456)); } break; - case 721: /* fill_mode ::= NONE */ -{ yymsp[0].minor.yy18 = FILL_MODE_NONE; } + case 723: /* fill_mode ::= NONE */ +{ yymsp[0].minor.yy470 = FILL_MODE_NONE; } break; - case 722: /* fill_mode ::= PREV */ -{ yymsp[0].minor.yy18 = FILL_MODE_PREV; } + case 724: /* fill_mode ::= PREV */ +{ yymsp[0].minor.yy470 = FILL_MODE_PREV; } break; - case 723: /* fill_mode ::= NULL */ -{ yymsp[0].minor.yy18 = FILL_MODE_NULL; } + case 725: /* fill_mode ::= NULL */ +{ yymsp[0].minor.yy470 = FILL_MODE_NULL; } break; - case 724: /* fill_mode ::= NULL_F */ -{ yymsp[0].minor.yy18 = FILL_MODE_NULL_F; } + case 726: /* fill_mode ::= NULL_F */ +{ yymsp[0].minor.yy470 = FILL_MODE_NULL_F; } break; - case 725: /* fill_mode ::= LINEAR */ -{ yymsp[0].minor.yy18 = FILL_MODE_LINEAR; } + case 727: /* fill_mode ::= LINEAR */ +{ yymsp[0].minor.yy470 = FILL_MODE_LINEAR; } break; - case 726: /* fill_mode ::= NEXT */ -{ yymsp[0].minor.yy18 = FILL_MODE_NEXT; } + case 728: /* fill_mode ::= NEXT */ +{ yymsp[0].minor.yy470 = FILL_MODE_NEXT; } break; - case 729: /* group_by_list ::= expr_or_subquery */ -{ yylhsminor.yy334 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); } - yymsp[0].minor.yy334 = yylhsminor.yy334; + case 731: /* group_by_list ::= expr_or_subquery */ +{ yylhsminor.yy456 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy840))); } + yymsp[0].minor.yy456 = yylhsminor.yy456; break; - case 730: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ -{ yylhsminor.yy334 = addNodeToList(pCxt, yymsp[-2].minor.yy334, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); } - yymsp[-2].minor.yy334 = yylhsminor.yy334; + case 732: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ +{ yylhsminor.yy456 = addNodeToList(pCxt, yymsp[-2].minor.yy456, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy840))); } + yymsp[-2].minor.yy456 = yylhsminor.yy456; break; - case 734: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ -{ yymsp[-5].minor.yy560 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), releaseRawExprNode(pCxt, yymsp[-1].minor.yy560)); } + case 736: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ +{ yymsp[-5].minor.yy840 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy840), releaseRawExprNode(pCxt, yymsp[-1].minor.yy840)); } break; - case 735: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ -{ yymsp[-3].minor.yy560 = createInterpTimePoint(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy560)); } + case 737: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ +{ yymsp[-3].minor.yy840 = createInterpTimePoint(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy840)); } break; - case 738: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ + case 740: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ { - yylhsminor.yy560 = addOrderByClause(pCxt, yymsp[-3].minor.yy560, yymsp[-2].minor.yy334); - yylhsminor.yy560 = addSlimitClause(pCxt, yylhsminor.yy560, yymsp[-1].minor.yy560); - yylhsminor.yy560 = addLimitClause(pCxt, yylhsminor.yy560, yymsp[0].minor.yy560); + yylhsminor.yy840 = addOrderByClause(pCxt, yymsp[-3].minor.yy840, yymsp[-2].minor.yy456); + yylhsminor.yy840 = addSlimitClause(pCxt, yylhsminor.yy840, yymsp[-1].minor.yy840); + yylhsminor.yy840 = addLimitClause(pCxt, yylhsminor.yy840, yymsp[0].minor.yy840); } - yymsp[-3].minor.yy560 = yylhsminor.yy560; + yymsp[-3].minor.yy840 = yylhsminor.yy840; break; - case 741: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ -{ yylhsminor.yy560 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy560, yymsp[0].minor.yy560); } - yymsp[-3].minor.yy560 = yylhsminor.yy560; + case 743: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ +{ yylhsminor.yy840 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy840, yymsp[0].minor.yy840); } + yymsp[-3].minor.yy840 = yylhsminor.yy840; break; - case 742: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ -{ yylhsminor.yy560 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy560, yymsp[0].minor.yy560); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 744: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ +{ yylhsminor.yy840 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy840, yymsp[0].minor.yy840); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; - case 751: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - case 755: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==755); -{ yymsp[-3].minor.yy560 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } + case 753: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + case 757: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==757); +{ yymsp[-3].minor.yy840 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } break; - case 752: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - case 756: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==756); -{ yymsp[-3].minor.yy560 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } + case 754: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + case 758: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==758); +{ yymsp[-3].minor.yy840 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } break; - case 757: /* subquery ::= NK_LP query_expression NK_RP */ -{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy560); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 759: /* subquery ::= NK_LP query_expression NK_RP */ +{ yylhsminor.yy840 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy840); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; - case 762: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ -{ yylhsminor.yy560 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), yymsp[-1].minor.yy974, yymsp[0].minor.yy109); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 764: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ +{ yylhsminor.yy840 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy840), yymsp[-1].minor.yy818, yymsp[0].minor.yy777); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; - case 763: /* ordering_specification_opt ::= */ -{ yymsp[1].minor.yy974 = ORDER_ASC; } + case 765: /* ordering_specification_opt ::= */ +{ yymsp[1].minor.yy818 = ORDER_ASC; } break; - case 764: /* ordering_specification_opt ::= ASC */ -{ yymsp[0].minor.yy974 = ORDER_ASC; } + case 766: /* ordering_specification_opt ::= ASC */ +{ yymsp[0].minor.yy818 = ORDER_ASC; } break; - case 765: /* ordering_specification_opt ::= DESC */ -{ yymsp[0].minor.yy974 = ORDER_DESC; } + case 767: /* ordering_specification_opt ::= DESC */ +{ yymsp[0].minor.yy818 = ORDER_DESC; } break; - case 766: /* null_ordering_opt ::= */ -{ yymsp[1].minor.yy109 = NULL_ORDER_DEFAULT; } + case 768: /* null_ordering_opt ::= */ +{ yymsp[1].minor.yy777 = NULL_ORDER_DEFAULT; } break; - case 767: /* null_ordering_opt ::= NULLS FIRST */ -{ yymsp[-1].minor.yy109 = NULL_ORDER_FIRST; } + case 769: /* null_ordering_opt ::= NULLS FIRST */ +{ yymsp[-1].minor.yy777 = NULL_ORDER_FIRST; } break; - case 768: /* null_ordering_opt ::= NULLS LAST */ -{ yymsp[-1].minor.yy109 = NULL_ORDER_LAST; } + case 770: /* null_ordering_opt ::= NULLS LAST */ +{ yymsp[-1].minor.yy777 = NULL_ORDER_LAST; } break; - case 771: /* column_options ::= column_options NK_ID NK_STRING */ -{ yylhsminor.yy560 = setColumnOptions(pCxt, yymsp[-2].minor.yy560, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy560 = yylhsminor.yy560; + case 773: /* column_options ::= column_options NK_ID NK_STRING */ +{ yylhsminor.yy840 = setColumnOptions(pCxt, yymsp[-2].minor.yy840, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy840 = yylhsminor.yy840; break; default: break; @@ -8301,7 +8204,8 @@ void Parse( } #endif - do{ + while(1){ /* Exit by "break" */ + assert( yypParser->yytos>=yypParser->yystack ); assert( yyact==yypParser->yytos->stateno ); yyact = yy_find_shift_action((YYCODETYPE)yymajor,yyact); if( yyact >= YY_MIN_REDUCE ){ @@ -8405,14 +8309,13 @@ void Parse( yy_destructor(yypParser, (YYCODETYPE)yymajor, &yyminorunion); yymajor = YYNOCODE; }else{ - while( yypParser->yytos >= yypParser->yystack - && (yyact = yy_find_reduce_action( - yypParser->yytos->stateno, - YYERRORSYMBOL)) > YY_MAX_SHIFTREDUCE - ){ + while( yypParser->yytos > yypParser->yystack ){ + yyact = yy_find_reduce_action(yypParser->yytos->stateno, + YYERRORSYMBOL); + if( yyact<=YY_MAX_SHIFTREDUCE ) break; yy_pop_parser_stack(yypParser); } - if( yypParser->yytos < yypParser->yystack || yymajor==0 ){ + if( yypParser->yytos <= yypParser->yystack || yymajor==0 ){ yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion); yy_parse_failed(yypParser); #ifndef YYNOERRORRECOVERY @@ -8462,7 +8365,7 @@ void Parse( break; #endif } - }while( yypParser->yytos>yypParser->yystack ); + } #ifndef NDEBUG if( yyTraceFILE ){ yyStackEntry *i; From dfa374bc8ab5347a06898b4c320928ac621da8ae Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Wed, 25 Sep 2024 15:25:54 +0800 Subject: [PATCH 075/695] merge 3.0 --- source/libs/stream/src/streamData.c | 33 +---------------------------- 1 file changed, 1 insertion(+), 32 deletions(-) diff --git a/source/libs/stream/src/streamData.c b/source/libs/stream/src/streamData.c index 72d0fa323228..688b58622a0a 100644 --- a/source/libs/stream/src/streamData.c +++ b/source/libs/stream/src/streamData.c @@ -27,7 +27,7 @@ static int32_t streamMergedSubmitNew(SStreamMergedSubmit** pSubmit) { if ((*pSubmit)->submits == NULL) { taosFreeQitem(*pSubmit); *pSubmit = NULL; - return TSDB_CODE_OUT_OF_MEMORY; + return terrno; } (*pSubmit)->type = STREAM_INPUT__MERGED_SUBMIT; @@ -215,37 +215,6 @@ void streamDataSubmitDestroy(SStreamDataSubmit* pDataSubmit) { } } -int32_t streamMergedSubmitNew(SStreamMergedSubmit** pSubmit) { - *pSubmit = NULL; - - int32_t code = taosAllocateQitem(sizeof(SStreamMergedSubmit), DEF_QITEM, 0, (void**)pSubmit); - if (code) { - return TSDB_CODE_OUT_OF_MEMORY; - } - - (*pSubmit)->submits = taosArrayInit(0, sizeof(SPackedData)); - if ((*pSubmit)->submits == NULL) { - taosFreeQitem(*pSubmit); - *pSubmit = NULL; - return terrno; - } - - (*pSubmit)->type = STREAM_INPUT__MERGED_SUBMIT; - return TSDB_CODE_SUCCESS; -} - -int32_t streamMergeSubmit(SStreamMergedSubmit* pMerged, SStreamDataSubmit* pSubmit) { - void* p = taosArrayPush(pMerged->submits, &pSubmit->submit); - if (p == NULL) { - return terrno; - } - - if (pSubmit->ver > pMerged->ver) { - pMerged->ver = pSubmit->ver; - } - return 0; -} - // todo handle memory error int32_t streamQueueMergeQueueItem(SStreamQueueItem* dst, SStreamQueueItem* pElem, SStreamQueueItem** pRes) { *pRes = NULL; From 818a1f6a81ede30a0148107602c7104af0ad88e7 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Wed, 25 Sep 2024 16:53:06 +0800 Subject: [PATCH 076/695] adj code --- source/libs/executor/src/streamtimesliceoperator.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/source/libs/executor/src/streamtimesliceoperator.c b/source/libs/executor/src/streamtimesliceoperator.c index c1fedfb90661..c34677ce019f 100644 --- a/source/libs/executor/src/streamtimesliceoperator.c +++ b/source/libs/executor/src/streamtimesliceoperator.c @@ -2105,10 +2105,7 @@ int32_t createStreamTimeSliceOperatorInfo(SOperatorInfo* downstream, SPhysiNode* if (pInfo != NULL) { destroyStreamTimeSliceOperatorInfo(pInfo); } - if (pOperator != NULL) { - pOperator->info = NULL; - destroyOperator(pOperator); - } + destroyOperatorAndDownstreams(pOperator, &downstream, 1); pTaskInfo->code = code; (*ppOptInfo) = NULL; return code; From 5399bffe993bc462938e44100bef90d5bf321a8d Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Wed, 25 Sep 2024 18:47:02 +0800 Subject: [PATCH 077/695] enh:[TS-5441] cost too long in tmq write meta data --- source/client/src/clientRawBlockWrite.c | 188 ++++++++++++++---------- 1 file changed, 112 insertions(+), 76 deletions(-) diff --git a/source/client/src/clientRawBlockWrite.c b/source/client/src/clientRawBlockWrite.c index a97440eed77d..856f4f59c1a4 100644 --- a/source/client/src/clientRawBlockWrite.c +++ b/source/client/src/clientRawBlockWrite.c @@ -165,7 +165,7 @@ static void buildCreateTableJson(SSchemaWrapper* schemaRow, SSchemaWrapper* sche } RAW_FALSE_CHECK(cJSON_AddItemToObject(json, "tags", tags)); -end: + end: *pJson = json; } @@ -199,7 +199,7 @@ static int32_t setCompressOption(cJSON* json, uint32_t para) { return code; } -end: + end: return code; } static void buildAlterSTableJson(void* alterData, int32_t alterDataLen, cJSON** pJson) { @@ -340,7 +340,7 @@ static void buildAlterSTableJson(void* alterData, int32_t alterDataLen, cJSON** break; } -end: + end: tFreeSMAltertbReq(&req); *pJson = json; } @@ -360,7 +360,7 @@ static void processCreateStb(SMqMetaRsp* metaRsp, cJSON** pJson) { } buildCreateTableJson(&req.schemaRow, &req.schemaTag, req.name, req.suid, TSDB_SUPER_TABLE, &req.colCmpr, pJson); -end: + end: uDebug("create stable return, sql json:%s", cJSON_PrintUnformatted(*pJson)); tDecoderClear(&coder); } @@ -380,7 +380,7 @@ static void processAlterStb(SMqMetaRsp* metaRsp, cJSON** pJson) { } buildAlterSTableJson(req.alterOriData, req.alterOriDataLen, pJson); -end: + end: uDebug("alter stable return, sql json:%s", cJSON_PrintUnformatted(*pJson)); tDecoderClear(&coder); } @@ -485,7 +485,7 @@ static void buildChildElement(cJSON* json, SVCreateTbReq* pCreateReq) { RAW_FALSE_CHECK(cJSON_AddItemToArray(tags, tag)); } -end: + end: RAW_FALSE_CHECK(cJSON_AddItemToObject(json, "tags", tags)); taosArrayDestroy(pTagVals); } @@ -514,7 +514,7 @@ static void buildCreateCTableJson(SVCreateTbReq* pCreateReq, int32_t nReqs, cJSO } RAW_FALSE_CHECK(cJSON_AddItemToObject(json, "createList", createList)); -end: + end: *pJson = json; } @@ -542,7 +542,7 @@ static void processCreateTable(SMqMetaRsp* metaRsp, cJSON** pJson) { } } -end: + end: uDebug("create table return, sql json:%s", cJSON_PrintUnformatted(*pJson)); tDeleteSVCreateTbBatchReq(&req); tDecoderClear(&decoder); @@ -585,7 +585,7 @@ static void processAutoCreateTable(STaosxRsp* rsp, char** string) { *string = cJSON_PrintUnformatted(pJson); cJSON_Delete(pJson); -end: + end: uDebug("auto created table return, sql json:%s", *string); for (int i = 0; decoder && pCreateReq && i < rsp->createTableNum; i++) { tDecoderClear(&decoder[i]); @@ -771,7 +771,7 @@ static void processAlterTable(SMqMetaRsp* metaRsp, cJSON** pJson) { break; } -end: + end: uDebug("alter table return, sql json:%s", cJSON_PrintUnformatted(json)); tDecoderClear(&decoder); *pJson = json; @@ -806,7 +806,7 @@ static void processDropSTable(SMqMetaRsp* metaRsp, cJSON** pJson) { RAW_NULL_CHECK(tableName); RAW_FALSE_CHECK(cJSON_AddItemToObject(json, "tableName", tableName)); -end: + end: uDebug("processDropSTable return, sql json:%s", cJSON_PrintUnformatted(json)); tDecoderClear(&decoder); *pJson = json; @@ -842,7 +842,7 @@ static void processDeleteTable(SMqMetaRsp* metaRsp, cJSON** pJson) { RAW_NULL_CHECK(sqlJson); RAW_FALSE_CHECK(cJSON_AddItemToObject(json, "sql", sqlJson)); -end: + end: uDebug("processDeleteTable return, sql json:%s", cJSON_PrintUnformatted(json)); tDecoderClear(&coder); *pJson = json; @@ -879,7 +879,7 @@ static void processDropTable(SMqMetaRsp* metaRsp, cJSON** pJson) { } RAW_FALSE_CHECK(cJSON_AddItemToObject(json, "tableNameList", tableNameList)); -end: + end: uDebug("processDropTable return, json sql:%s", cJSON_PrintUnformatted(json)); tDecoderClear(&decoder); *pJson = json; @@ -990,7 +990,7 @@ static int32_t taosCreateStb(TAOS* taos, void* meta, int32_t metaLen) { code = pRequest->code; -end: + end: uDebug(LOG_ID_TAG " create stable return, msg:%s", LOG_ID_VALUE, tstrerror(code)); destroyRequest(pRequest); tFreeSMCreateStbReq(&pReq); @@ -1027,9 +1027,9 @@ static int32_t taosDropStb(TAOS* taos, void* meta, int32_t metaLen) { SCatalog* pCatalog = NULL; RAW_RETURN_CHECK(catalogGetHandle(pRequest->pTscObj->pAppInfo->clusterId, &pCatalog)); SRequestConnInfo conn = {.pTrans = pRequest->pTscObj->pAppInfo->pTransporter, - .requestId = pRequest->requestId, - .requestObjRefId = pRequest->self, - .mgmtEps = getEpSet_s(&pRequest->pTscObj->pAppInfo->mgmtEp)}; + .requestId = pRequest->requestId, + .requestObjRefId = pRequest->self, + .mgmtEps = getEpSet_s(&pRequest->pTscObj->pAppInfo->mgmtEp)}; SName pName = {0}; toName(pRequest->pTscObj->acctId, pRequest->pDb, req.name, &pName); STableMeta* pTableMeta = NULL; @@ -1092,7 +1092,7 @@ static int32_t taosDropStb(TAOS* taos, void* meta, int32_t metaLen) { code = pRequest->code; -end: + end: uDebug(LOG_ID_TAG " drop stable return, msg:%s", LOG_ID_VALUE, tstrerror(code)); destroyRequest(pRequest); tDecoderClear(&coder); @@ -1148,9 +1148,9 @@ static int32_t taosCreateTable(TAOS* taos, void* meta, int32_t metaLen) { taosHashSetFreeFp(pVgroupHashmap, destroyCreateTbReqBatch); SRequestConnInfo conn = {.pTrans = pTscObj->pAppInfo->pTransporter, - .requestId = pRequest->requestId, - .requestObjRefId = pRequest->self, - .mgmtEps = getEpSet_s(&pTscObj->pAppInfo->mgmtEp)}; + .requestId = pRequest->requestId, + .requestObjRefId = pRequest->self, + .mgmtEps = getEpSet_s(&pTscObj->pAppInfo->mgmtEp)}; pRequest->tableList = taosArrayInit(req.nReqs, sizeof(SName)); RAW_NULL_CHECK(pRequest->tableList); @@ -1243,7 +1243,7 @@ static int32_t taosCreateTable(TAOS* taos, void* meta, int32_t metaLen) { code = pRequest->code; -end: + end: uDebug(LOG_ID_TAG " create table return, msg:%s", LOG_ID_VALUE, tstrerror(code)); tDeleteSVCreateTbBatchReq(&req); @@ -1304,9 +1304,9 @@ static int32_t taosDropTable(TAOS* taos, void* meta, int32_t metaLen) { taosHashSetFreeFp(pVgroupHashmap, destroyDropTbReqBatch); SRequestConnInfo conn = {.pTrans = pTscObj->pAppInfo->pTransporter, - .requestId = pRequest->requestId, - .requestObjRefId = pRequest->self, - .mgmtEps = getEpSet_s(&pTscObj->pAppInfo->mgmtEp)}; + .requestId = pRequest->requestId, + .requestObjRefId = pRequest->self, + .mgmtEps = getEpSet_s(&pTscObj->pAppInfo->mgmtEp)}; pRequest->tableList = taosArrayInit(req.nReqs, sizeof(SName)); RAW_NULL_CHECK(pRequest->tableList); // loop to create table @@ -1371,7 +1371,7 @@ static int32_t taosDropTable(TAOS* taos, void* meta, int32_t metaLen) { } code = pRequest->code; -end: + end: uDebug(LOG_ID_TAG " drop table return, msg:%s", LOG_ID_VALUE, tstrerror(code)); taosHashCleanup(pVgroupHashmap); destroyRequest(pRequest); @@ -1412,7 +1412,7 @@ static int32_t taosDeleteData(TAOS* taos, void* meta, int32_t metaLen) { } taos_free_result(res); -end: + end: uDebug("connId:0x%" PRIx64 " delete data sql:%s, code:%s", *(int64_t*)taos, sql, tstrerror(code)); tDecoderClear(&coder); return code; @@ -1455,9 +1455,9 @@ static int32_t taosAlterTable(TAOS* taos, void* meta, int32_t metaLen) { SCatalog* pCatalog = NULL; RAW_RETURN_CHECK(catalogGetHandle(pTscObj->pAppInfo->clusterId, &pCatalog)); SRequestConnInfo conn = {.pTrans = pTscObj->pAppInfo->pTransporter, - .requestId = pRequest->requestId, - .requestObjRefId = pRequest->self, - .mgmtEps = getEpSet_s(&pTscObj->pAppInfo->mgmtEp)}; + .requestId = pRequest->requestId, + .requestObjRefId = pRequest->self, + .mgmtEps = getEpSet_s(&pTscObj->pAppInfo->mgmtEp)}; SVgroupInfo pInfo = {0}; SName pName = {0}; @@ -1525,7 +1525,7 @@ static int32_t taosAlterTable(TAOS* taos, void* meta, int32_t metaLen) { code = handleAlterTbExecRes(pRes->res, pCatalog); } } -end: + end: uDebug(LOG_ID_TAG " alter table return, meta:%p, len:%d, msg:%s", LOG_ID_VALUE, meta, metaLen, tstrerror(code)); taosArrayDestroy(pArray); if (pVgData) taosMemoryFreeClear(pVgData->pData); @@ -1590,7 +1590,7 @@ int taos_write_raw_block_with_fields_with_reqid(TAOS* taos, int rows, char* pDat (void)launchQueryImpl(pRequest, pQuery, true, NULL); code = pRequest->code; -end: + end: uDebug(LOG_ID_TAG " write raw block with field return, msg:%s", LOG_ID_VALUE, tstrerror(code)); taosMemoryFreeClear(pTableMeta); qDestroyQuery(pQuery); @@ -1650,7 +1650,7 @@ int taos_write_raw_block_with_reqid(TAOS* taos, int rows, char* pData, const cha (void)launchQueryImpl(pRequest, pQuery, true, NULL); code = pRequest->code; -end: + end: uDebug(LOG_ID_TAG " write raw block return, msg:%s", LOG_ID_VALUE, tstrerror(code)); taosMemoryFreeClear(pTableMeta); qDestroyQuery(pQuery); @@ -1769,7 +1769,7 @@ static int32_t tmqWriteRawDataImpl(TAOS* taos, void* data, int32_t dataLen) { (void)launchQueryImpl(pRequest, pQuery, true, NULL); code = pRequest->code; -end: + end: uDebug(LOG_ID_TAG " write raw data return, msg:%s", LOG_ID_VALUE, tstrerror(code)); tDeleteMqDataRsp(&rspObj.rsp); tDecoderClear(&decoder); @@ -1790,23 +1790,28 @@ static int32_t buildCreateTbMap(STaosxRsp* rsp, SHashObj* pHashObj) { void** dataTmp = taosArrayGet(rsp->createTableReq, j); RAW_NULL_CHECK(dataTmp); int32_t* lenTmp = taosArrayGet(rsp->createTableLen, j); - RAW_NULL_CHECK(dataTmp); + RAW_NULL_CHECK(lenTmp); tDecoderInit(&decoderTmp, *dataTmp, *lenTmp); - RAW_RETURN_CHECK (tDecodeSVCreateTbReq(&decoderTmp, &pCreateReq)); + RAW_RETURN_CHECK(tDecodeSVCreateTbReq(&decoderTmp, &pCreateReq)); if (pCreateReq.type != TSDB_CHILD_TABLE) { code = TSDB_CODE_INVALID_MSG; goto end; } - if (taosHashGet(pHashObj, pCreateReq.name, strlen(pCreateReq.name)) == NULL){ - RAW_RETURN_CHECK(taosHashPut(pHashObj, pCreateReq.name, strlen(pCreateReq.name), &pCreateReq, sizeof(SVCreateTbReq))); - } else{ - tDestroySVCreateTbReq(&pCreateReq, TSDB_MSG_FLG_DECODE); - pCreateReq = (SVCreateTbReq){0}; + SVCreateTbReq** pCreateReqDst = taosHashGet(pHashObj, pCreateReq.name, strlen(pCreateReq.name)); + if (pCreateReqDst == NULL){ + RAW_RETURN_CHECK(cloneSVreateTbReq(&pCreateReq, pCreateReqDst)); + code = taosHashPut(pHashObj, pCreateReq.name, strlen(pCreateReq.name), &pCreateReqDst, POINTER_BYTES); + if (code != 0){ + tdDestroySVCreateTbReq(*pCreateReqDst); + goto end; + } } tDecoderClear(&decoderTmp); + tDestroySVCreateTbReq(&pCreateReq, TSDB_MSG_FLG_DECODE); + pCreateReq = (SVCreateTbReq){0}; } return 0; @@ -1816,19 +1821,20 @@ static int32_t buildCreateTbMap(STaosxRsp* rsp, SHashObj* pHashObj) { return code; } +static threadlocal SHashObj* pVgHash = NULL; +static threadlocal SHashObj* pCreateTbHash = NULL; +static threadlocal SHashObj* pNameHash = NULL; +static threadlocal SHashObj* pMetaHash = NULL; + static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, int32_t dataLen) { if (taos == NULL || data == NULL) { SET_ERROR_MSG("taos:%p or data:%p is NULL", taos, data); return TSDB_CODE_INVALID_PARA; } int32_t code = TSDB_CODE_SUCCESS; - SHashObj* pVgHash = NULL; - SHashObj* pCreateTbHash = NULL; SQuery* pQuery = NULL; SMqTaosxRspObj rspObj = {0}; SDecoder decoder = {0}; - STableMeta* pTableMeta = NULL; - SRequestObj* pRequest = NULL; RAW_RETURN_CHECK(createRequest(*(int64_t*)taos, TSDB_SQL_INSERT, 0, &pRequest)); @@ -1856,6 +1862,23 @@ static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, int32_t dataLen) goto end; } + if (pVgHash == NULL){ + pVgHash = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, HASH_NO_LOCK); + RAW_NULL_CHECK(pVgHash); + } + if (pCreateTbHash == NULL){ + pCreateTbHash = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_NO_LOCK); + RAW_NULL_CHECK(pCreateTbHash); + } + if (pNameHash == NULL){ + pNameHash = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_NO_LOCK); + RAW_NULL_CHECK(pNameHash); + } + if (pMetaHash == NULL){ + pMetaHash = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_NO_LOCK); + RAW_NULL_CHECK(pMetaHash); + taosHashSetFreeFp(pMetaHash, taosMemoryFree); + } struct SCatalog* pCatalog = NULL; RAW_RETURN_CHECK(catalogGetHandle(pRequest->pTscObj->pAppInfo->clusterId, &pCatalog)); @@ -1866,11 +1889,6 @@ static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, int32_t dataLen) conn.mgmtEps = getEpSet_s(&pRequest->pTscObj->pAppInfo->mgmtEp); RAW_RETURN_CHECK(smlInitHandle(&pQuery)); - pVgHash = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, HASH_NO_LOCK); - RAW_NULL_CHECK(pVgHash); - pCreateTbHash = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK); - RAW_NULL_CHECK(pCreateTbHash); - RAW_RETURN_CHECK(buildCreateTbMap(&rspObj.rsp, pCreateTbHash)); uDebug(LOG_ID_TAG " write raw metadata block num:%d", LOG_ID_VALUE, rspObj.rsp.common.blockNum); while (++rspObj.common.resIter < rspObj.rsp.common.blockNum) { @@ -1894,21 +1912,37 @@ static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, int32_t dataLen) // find schema data info SVCreateTbReq* pCreateReqDst = (SVCreateTbReq*)taosHashGet(pCreateTbHash, tbName, strlen(tbName)); - SVgroupInfo vg = {0}; - RAW_RETURN_CHECK(catalogGetTableHashVgroup(pCatalog, &conn, &pName, &vg)); - if (pCreateReqDst) { // change stable name to get meta - (void)strcpy(pName.tname, pCreateReqDst->ctb.stbName); + if (pCreateReqDst == NULL) { + RAW_RETURN_CHECK(buildCreateTbMap(&rspObj.rsp, pCreateTbHash)); + pCreateReqDst = (SVCreateTbReq*)taosHashGet(pCreateTbHash, tbName, strlen(tbName)); } - RAW_RETURN_CHECK(catalogGetTableMeta(pCatalog, &conn, &pName, &pTableMeta)); - if (pCreateReqDst) { - pTableMeta->vgId = vg.vgId; - pTableMeta->uid = pCreateReqDst->uid; - pCreateReqDst->ctb.suid = pTableMeta->suid; + int32_t vgId = 0; + SVgroupInfo* vg = (SVgroupInfo*)taosHashGet(pNameHash, tbName, strlen(tbName)); + if (vg == NULL) { + SVgroupInfo vgTmp = {0}; + RAW_RETURN_CHECK(catalogGetTableHashVgroup(pCatalog, &conn, &pName, &vgTmp)); + RAW_RETURN_CHECK(taosHashPut(pNameHash, tbName, strlen(tbName), &vgTmp, sizeof(SVgroupInfo))); + code = taosHashPut(pVgHash, &vgTmp.vgId, sizeof(vgTmp.vgId), &vgTmp, sizeof(SVgroupInfo)); + code = (code == TSDB_CODE_DUP_KEY) ? 0 : code; + RAW_RETURN_CHECK(code); + vgId = vgTmp.vgId; + } else { + vgId = vg->vgId; } - void* hData = taosHashGet(pVgHash, &vg.vgId, sizeof(vg.vgId)); - if (hData == NULL) { - RAW_RETURN_CHECK(taosHashPut(pVgHash, (const char*)&vg.vgId, sizeof(vg.vgId), (char*)&vg, sizeof(vg))); + + STableMeta** pTableMeta = (STableMeta**)taosHashGet(pMetaHash, tbName, strlen(tbName)); + if (pTableMeta == NULL) { + if (pCreateReqDst) { // change stable name to get meta + (void)strcpy(pName.tname, pCreateReqDst->ctb.stbName); + } + RAW_RETURN_CHECK(catalogGetTableMeta(pCatalog, &conn, &pName, pTableMeta)); + RAW_RETURN_CHECK(taosHashPut(pMetaHash, tbName, strlen(tbName), pTableMeta, POINTER_BYTES)); + if (pCreateReqDst) { + (*pTableMeta)->vgId = vgId; + (*pTableMeta)->uid = pCreateReqDst->uid; + pCreateReqDst->ctb.suid = (*pTableMeta)->suid; + } } SSchemaWrapper* pSW = (SSchemaWrapper*)taosArrayGetP(rspObj.rsp.common.blockSchema, rspObj.common.resIter); @@ -1930,13 +1964,12 @@ static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, int32_t dataLen) if (pCreateReqDst){ RAW_RETURN_CHECK(cloneSVreateTbReq(pCreateReqDst, &pCreateReqTmp)); } - code = rawBlockBindData(pQuery, pTableMeta, rawData, &pCreateReqTmp, fields, pSW->nCols, true, err, ERR_MSG_LEN); + code = rawBlockBindData(pQuery, *pTableMeta, rawData, &pCreateReqTmp, fields, pSW->nCols, true, err, ERR_MSG_LEN); if (pCreateReqTmp != NULL) { tdDestroySVCreateTbReq(pCreateReqTmp); taosMemoryFree(pCreateReqTmp); } taosMemoryFree(fields); - taosMemoryFreeClear(pTableMeta); if (code != TSDB_CODE_SUCCESS) { SET_ERROR_MSG("table:%s, err:%s", tbName, err); goto end; @@ -1948,23 +1981,26 @@ static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, int32_t dataLen) (void)launchQueryImpl(pRequest, pQuery, true, NULL); code = pRequest->code; -end: + end: uDebug(LOG_ID_TAG " write raw metadata return, msg:%s", LOG_ID_VALUE, tstrerror(code)); + tDeleteSTaosxRsp(&rspObj.rsp); + tDecoderClear(&decoder); + qDestroyQuery(pQuery); + destroyRequest(pRequest); + + return code; +} + +void tmqClean() { + taosHashCleanup(pMetaHash); + taosHashCleanup(pNameHash); void* pIter = taosHashIterate(pCreateTbHash, NULL); while (pIter) { tDestroySVCreateTbReq(pIter, TSDB_MSG_FLG_DECODE); pIter = taosHashIterate(pCreateTbHash, pIter); } taosHashCleanup(pCreateTbHash); - - tDeleteSTaosxRsp(&rspObj.rsp); - tDecoderClear(&decoder); - qDestroyQuery(pQuery); - destroyRequest(pRequest); taosHashCleanup(pVgHash); - taosMemoryFreeClear(pTableMeta); - - return code; } static void processSimpleMeta(SMqMetaRsp* pMetaRsp, cJSON** meta) { @@ -2027,7 +2063,7 @@ static void processBatchMetaToJson(SMqBatchMetaRsp* pMsgRsp, char** string) { *string = fullStr; return; -end: + end: cJSON_Delete(pJson); tDeleteMqBatchMetaRsp(&rsp); } @@ -2113,7 +2149,7 @@ static int32_t encodeMqDataRsp(__encode_func__* encodeFunc, void* rspObj, tmq_ra raw->raw = buf; raw->raw_len = len; return code; -FAILED: + FAILED: tEncoderClear(&encoder); taosMemoryFree(buf); return code; @@ -2236,7 +2272,7 @@ static int32_t tmqWriteBatchMetaDataImpl(TAOS* taos, void* meta, int32_t metaLen } } -end: + end: tDeleteMqBatchMetaRsp(&rsp); return code; } From 8be15d5b138c0b21c85fa02cd1c236f9f156fb0d Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Thu, 26 Sep 2024 16:29:57 +0800 Subject: [PATCH 078/695] enh: add plan test cases --- include/util/tdef.h | 41 + source/libs/executor/test/queryPlanTests.cpp | 4278 ++++-------------- source/libs/nodes/src/nodesUtilFuncs.c | 5 + 3 files changed, 857 insertions(+), 3467 deletions(-) diff --git a/include/util/tdef.h b/include/util/tdef.h index 46c84ab26a47..07be21e044c8 100644 --- a/include/util/tdef.h +++ b/include/util/tdef.h @@ -188,6 +188,47 @@ typedef enum EOperatorType { OP_TYPE_ASSIGN = 200 } EOperatorType; +static const EOperatorType OPERATOR_ARRAY[] = { + OP_TYPE_ADD, + OP_TYPE_SUB, + OP_TYPE_MULTI, + OP_TYPE_DIV, + OP_TYPE_REM, + + OP_TYPE_MINUS, + + OP_TYPE_BIT_AND, + OP_TYPE_BIT_OR, + + OP_TYPE_GREATER_THAN, + OP_TYPE_GREATER_EQUAL, + OP_TYPE_LOWER_THAN, + OP_TYPE_LOWER_EQUAL, + OP_TYPE_EQUAL, + OP_TYPE_NOT_EQUAL, + OP_TYPE_IN, + OP_TYPE_NOT_IN, + OP_TYPE_LIKE, + OP_TYPE_NOT_LIKE, + OP_TYPE_MATCH, + OP_TYPE_NMATCH, + + OP_TYPE_IS_NULL, + OP_TYPE_IS_NOT_NULL, + OP_TYPE_IS_TRUE, + OP_TYPE_IS_FALSE, + OP_TYPE_IS_UNKNOWN, + OP_TYPE_IS_NOT_TRUE, + OP_TYPE_IS_NOT_FALSE, + OP_TYPE_IS_NOT_UNKNOWN, + //OP_TYPE_COMPARE_MAX_VALUE, + + OP_TYPE_JSON_GET_VALUE, + OP_TYPE_JSON_CONTAINS, + + OP_TYPE_ASSIGN +}; + #define OP_TYPE_CALC_MAX OP_TYPE_BIT_OR typedef enum ELogicConditionType { diff --git a/source/libs/executor/test/queryPlanTests.cpp b/source/libs/executor/test/queryPlanTests.cpp index 6dd42c3a93a6..8354620afb2f 100755 --- a/source/libs/executor/test/queryPlanTests.cpp +++ b/source/libs/executor/test/queryPlanTests.cpp @@ -45,63 +45,146 @@ namespace { +#define QPT_MAX_LOOP 1000 +#define QPT_MAX_SUBPLAN_LEVEL 1000 +#define QPT_MAX_WHEN_THEN_NUM 10 +#define QPT_MAX_NODE_LEVEL 5 +#define QPT_MAX_STRING_LEN 1048576 +#define QPT_MAX_FUNC_PARAM 5 +#define QPT_MAX_LOGIC_PARAM 5 +#define QPT_MAX_NODE_LIST_NUM 5 + +int32_t QPT_PHYSIC_NODE_LIST[] = { + QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN, + QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN, + QUERY_NODE_PHYSICAL_PLAN_TABLE_SEQ_SCAN, + QUERY_NODE_PHYSICAL_PLAN_TABLE_MERGE_SCAN, + QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN, + QUERY_NODE_PHYSICAL_PLAN_SYSTABLE_SCAN, + QUERY_NODE_PHYSICAL_PLAN_BLOCK_DIST_SCAN, + QUERY_NODE_PHYSICAL_PLAN_LAST_ROW_SCAN, + QUERY_NODE_PHYSICAL_PLAN_PROJECT, + QUERY_NODE_PHYSICAL_PLAN_MERGE_JOIN, + QUERY_NODE_PHYSICAL_PLAN_HASH_AGG, + QUERY_NODE_PHYSICAL_PLAN_EXCHANGE, + QUERY_NODE_PHYSICAL_PLAN_MERGE, + QUERY_NODE_PHYSICAL_PLAN_SORT, + QUERY_NODE_PHYSICAL_PLAN_GROUP_SORT, + QUERY_NODE_PHYSICAL_PLAN_HASH_INTERVAL, + QUERY_NODE_PHYSICAL_PLAN_MERGE_INTERVAL, + QUERY_NODE_PHYSICAL_PLAN_MERGE_ALIGNED_INTERVAL, + QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL, + QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL, + QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL, + QUERY_NODE_PHYSICAL_PLAN_FILL, + QUERY_NODE_PHYSICAL_PLAN_STREAM_FILL, + QUERY_NODE_PHYSICAL_PLAN_MERGE_SESSION, + QUERY_NODE_PHYSICAL_PLAN_STREAM_SESSION, + QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_SESSION, + QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_SESSION, + QUERY_NODE_PHYSICAL_PLAN_MERGE_STATE, + QUERY_NODE_PHYSICAL_PLAN_STREAM_STATE, + QUERY_NODE_PHYSICAL_PLAN_PARTITION, + QUERY_NODE_PHYSICAL_PLAN_STREAM_PARTITION, + QUERY_NODE_PHYSICAL_PLAN_INDEF_ROWS_FUNC, + QUERY_NODE_PHYSICAL_PLAN_INTERP_FUNC, + QUERY_NODE_PHYSICAL_PLAN_DISPATCH, + QUERY_NODE_PHYSICAL_PLAN_INSERT, + QUERY_NODE_PHYSICAL_PLAN_QUERY_INSERT, + QUERY_NODE_PHYSICAL_PLAN_DELETE, + QUERY_NODE_PHYSICAL_SUBPLAN, + QUERY_NODE_PHYSICAL_PLAN, + QUERY_NODE_PHYSICAL_PLAN_TABLE_COUNT_SCAN, + QUERY_NODE_PHYSICAL_PLAN_MERGE_EVENT, + QUERY_NODE_PHYSICAL_PLAN_STREAM_EVENT, + QUERY_NODE_PHYSICAL_PLAN_HASH_JOIN, + QUERY_NODE_PHYSICAL_PLAN_GROUP_CACHE, + QUERY_NODE_PHYSICAL_PLAN_DYN_QUERY_CTRL, + QUERY_NODE_PHYSICAL_PLAN_MERGE_COUNT, + QUERY_NODE_PHYSICAL_PLAN_STREAM_COUNT, + QUERY_NODE_PHYSICAL_PLAN_STREAM_MID_INTERVAL +}; + +#define QPT_PHYSIC_NODE_NUM() (sizeof(QPT_PHYSIC_NODE_LIST)/sizeof(QPT_PHYSIC_NODE_LIST[0])) + typedef struct { - bool succeed; - int32_t blkNum; - int32_t rowNum; - int32_t addRowNum; - int32_t subRowNum; - int32_t matchNum; -} SJoinTestResInfo; + ENodeType type; + void* param; +} SQPTNodeParam; typedef struct { - int32_t maxResRows; - int32_t maxResBlkRows; - int64_t totalResRows; - int64_t useMSecs; - SArray* pHistory; -} SJoinTestStat; - - -enum { - TEST_NO_COND = 1, - TEST_EQ_COND, - TEST_ON_COND, - TEST_FULL_COND -}; + bool singlePhysiNode; + int32_t subplanMaxLevel; + int32_t subplanType[QPT_MAX_SUBPLAN_LEVEL]; + int32_t physiNodeParamNum; + SQPTNodeParam* physicNodeParam; +} SQPTPlanParam; + +typedef struct { + uint8_t precision; + char dbName[TSDB_DB_NAME_LEN]; +} SQPTDbParam; + + +typedef struct { + int32_t vnodeNum; +} SQPTVnodeParam; -#define JT_PRINTF (void)printf +typedef struct { + char name[TSDB_COL_NAME_LEN]; + int32_t type; + int32_t len; + int8_t inUse; + bool hasIndex; + bool isPrimTs; + bool isPk; + EColumnType colType; +} SQPTCol; -#define COL_DISPLAY_WIDTH 18 -#define JT_MAX_LOOP 1000 +typedef struct { + int64_t uid; + int64_t suid; + int8_t tblType; + int32_t colNum; + int32_t tagNum; + int16_t pkNum; + char tblName[TSDB_TABLE_NAME_LEN]; + char tblAlias[TSDB_TABLE_NAME_LEN]; + SQPTCol* pCol; + SQPTCol* pTag; +} SQPTTblParam; -#define LEFT_BLK_ID 0 -#define RIGHT_BLK_ID 1 -#define RES_BLK_ID 2 -#define MAX_SLOT_NUM 4 -#define LEFT_TABLE_COLS 0x1 -#define RIGHT_TABLE_COLS 0x2 -#define ALL_TABLE_COLS (LEFT_TABLE_COLS | RIGHT_TABLE_COLS) +typedef struct { + bool correctExpected; + SQPTPlanParam plan; + SQPTDbParam db; + SQPTVnodeParam vnode; + SQPTTblParam tbl; +} SQPTParam; -#define JT_MAX_JLIMIT 20 -#define JT_MAX_WINDOW_OFFSET 5 -#define JT_KEY_SOLT_ID (MAX_SLOT_NUM - 1) -#define JT_PRIM_TS_SLOT_ID 0 -int32_t jtInputColType[MAX_SLOT_NUM] = {TSDB_DATA_TYPE_TIMESTAMP, TSDB_DATA_TYPE_INT, TSDB_DATA_TYPE_INT, TSDB_DATA_TYPE_BIGINT}; -char* jtColCondStr[] = {"", "NO COND", "EQ COND", "ON COND", "FULL COND"}; -char* jtJoinTypeStr[] = {"INNER", "LEFT", "RIGHT", "FULL"}; -char* jtSubTypeStr[] = {"", "OUTER", "SEMI", "ANTI", "ASOF", "WINDOW"}; +typedef struct { + SPhysiNode* pCurr; + SPhysiNode* pChild; + EOrder currTsOrder; + SPhysiPlanContext* pCxt; +} SQPTBuildCtx; -int64_t TIMESTAMP_FILTER_VALUE = 10000000000; -int32_t INT_FILTER_VALUE = 200000000; -int64_t BIGINT_FILTER_VALUE = 3000000000000000; +typedef struct { + int32_t nodeLevel; + bool onlyTag; + SDataBlockDescNode* pInputDataBlockDesc; +} SQPTMakeNodeCtx; -int64_t jtFilterValue[] = {TIMESTAMP_FILTER_VALUE, INT_FILTER_VALUE, INT_FILTER_VALUE, BIGINT_FILTER_VALUE}; -bool jtErrorRerun = false; -bool jtInRerun = false; +typedef struct { + int32_t loopIdx; + SQPTParam param; + SQPTBuildCtx buildCtx; + SQPTMakeNodeCtx makeCtx; + int64_t startTsUs; +} SQPTCtx; typedef struct { bool printTestInfo; @@ -109,752 +192,665 @@ typedef struct { bool printResRow; bool logHistory; bool noKeepResRows; -} SJoinTestCtrl; +} SQPTCtrl; -typedef struct { - bool filter; - bool asc; - bool grpJoin; - int32_t leftMaxRows; - int32_t leftMaxGrpRows; - int32_t rightMaxRows; - int32_t rightMaxGrpRows; - int32_t blkRows; - int32_t colCond; - int32_t joinType; - int32_t subType; - int32_t asofOpType; - int64_t jLimit; - int64_t winStartOffset; - int64_t winEndOffset; - int64_t inGrpId; - - int32_t leftTotalRows; - int32_t rightTotalRows; - int32_t blkRowSize; - int32_t inputStat; - - int32_t colEqNum; - int32_t colEqList[MAX_SLOT_NUM]; - - int32_t colOnNum; - int32_t colOnList[MAX_SLOT_NUM]; - - int32_t leftFilterNum; - int32_t leftFilterColList[MAX_SLOT_NUM]; - - int32_t rightFilterNum; - int32_t rightFilterColList[MAX_SLOT_NUM]; - - int32_t keyInSlotIdx; - int32_t keyOutSlotIdx; - int32_t keyColOffset; +SQPTCtx qptCtx = {0}; +SQPTCtrl qptCtrl = {1, 0, 0, 0, 0}; +bool qptErrorRerun = false; +bool qptInRerun = false; + +void qptPrintBeginInfo(char* caseName) { + if (!qptCtrl.printTestInfo) { + return; + } + +/* + char inputStat[4] = {0}; + JT_PRINTF("\n%dth TEST [%s] START\nBasic Info:\n\t asc:%d\n\t filter:%d\n\t maxRows:left-%d right-%d\n\t " + "maxGrpRows:left-%d right-%d\n\t blkRows:%d\n\t colCond:%s\n\t joinType:%s\n\t " + "subType:%s\n\t inputStat:%s\n\t groupJoin:%s\n", jtCtx.loopIdx, caseName, jtCtx.asc, jtCtx.filter, jtCtx.leftMaxRows, jtCtx.rightMaxRows, + jtCtx.leftMaxGrpRows, jtCtx.rightMaxGrpRows, jtCtx.blkRows, jtColCondStr[jtCtx.colCond], jtJoinTypeStr[jtCtx.joinType], + jtSubTypeStr[jtCtx.subType], getInputStatStr(inputStat), jtCtx.grpJoin ? "true" : "false"); + + if (JOIN_STYPE_ASOF == jtCtx.subType) { + JT_PRINTF("\t asofOp:%s\n\t JLimit:%" PRId64 "\n", getAsofOpStr(), jtCtx.jLimit); + } else if (JOIN_STYPE_WIN == jtCtx.subType) { + JT_PRINTF("\t windowOffset:[%" PRId64 ", %" PRId64 "]\n\t JLimit:%" PRId64 "\n", jtCtx.winStartOffset, jtCtx.winEndOffset, jtCtx.jLimit); + } - int32_t resColNum; - int32_t resColInSlot[MAX_SLOT_NUM * 2]; - int32_t resColList[MAX_SLOT_NUM * 2]; - int32_t resColOffset[MAX_SLOT_NUM * 2]; - int32_t resColSize; - char* resColBuf; + JT_PRINTF("Input Info:\n\t totalBlk:left-%d right-%d\n\t totalRows:left-%d right-%d\n\t " + "blkRowSize:%d\n\t inputCols:left-%s %s %s %s right-%s %s %s %s\n", + (int32_t)taosArrayGetSize(jtCtx.leftBlkList), (int32_t)taosArrayGetSize(jtCtx.rightBlkList), + jtCtx.leftTotalRows, jtCtx.rightTotalRows, + jtCtx.blkRowSize, tDataTypes[jtInputColType[0]].name, tDataTypes[jtInputColType[1]].name, + tDataTypes[jtInputColType[2]].name, tDataTypes[jtInputColType[3]].name, tDataTypes[jtInputColType[0]].name, + tDataTypes[jtInputColType[1]].name, tDataTypes[jtInputColType[2]].name, tDataTypes[jtInputColType[3]].name); - int32_t colRowDataBufSize; - char* colRowDataBuf; - int32_t colRowOffset[MAX_SLOT_NUM]; + if (jtCtx.colEqNum) { + JT_PRINTF("\t colEqNum:%d\n", jtCtx.colEqNum); + printColList("colEqList", false, jtCtx.colEqList, false, "="); + } + + if (jtCtx.colOnNum) { + JT_PRINTF("\t colOnNum:%d\n", jtCtx.colOnNum); + printColList("colOnList", false, jtCtx.colOnList, false, ">"); + } - int64_t curTs; - int64_t curKeyOffset; - int32_t grpOffset[MAX_SLOT_NUM]; + if (jtCtx.leftFilterNum) { + JT_PRINTF("\t leftFilterNum:%d\n", jtCtx.leftFilterNum); + printColList("leftFilterList", true, jtCtx.leftFilterColList, true, ">"); + } - int32_t leftBlkReadIdx; - SArray* leftBlkList; - int32_t rightBlkReadIdx; - SArray* rightBlkList; + if (jtCtx.rightFilterNum) { + JT_PRINTF("\t rightFilterNum:%d\n", jtCtx.rightFilterNum); + printColList("rightFilterList", false, jtCtx.rightFilterColList, true, ">"); + } - int64_t resRows; - bool leftColOnly; - bool rightColOnly; - SSHashObj* jtResRows; + JT_PRINTF("\t resColSize:%d\n\t resColNum:%d\n\t resColList:", jtCtx.resColSize, jtCtx.resColNum); + for (int32_t i = 0; i < jtCtx.resColNum; ++i) { + int32_t s = jtCtx.resColInSlot[i]; + int32_t idx = s >= MAX_SLOT_NUM ? s - MAX_SLOT_NUM : s; + JT_PRINTF("%sc%d[%s]\t", s >= MAX_SLOT_NUM ? "r" : "l", s, tDataTypes[jtInputColType[idx]].name); + } - SOperatorInfo* pJoinOp; + if (jtCtrl.printInputRow) { + printInputData(); + } +*/ +} - int32_t loopIdx; +void qptPrintStatInfo(char* caseName) { - int32_t rightFinMatchNum; - bool* rightFinMatch; +} - int32_t inColOffset[MAX_SLOT_NUM]; - int32_t inColSize; - char* inColBuf; - SArray* leftRowsList; - SArray* rightRowsList; - SArray* rightFilterOut; - int64_t startTsUs; -} SJoinTestCtx; +bool qptGetDynamicOp() { + if (!qptCtx->param.correctExpected) { + return (taosRand() % 2) : true : false; + } -typedef struct { - SJoinTestResInfo res; - SJoinTestCtx ctx; -} SJoinTestHistory; + if (qptCtx->buildCtx.pChild) { + return qptCtx->buildCtx.pChild->dynamicOp; + } -typedef struct { - EJoinType joinType; - EJoinSubType subType; - int32_t asofOp; - int64_t jLimit; - int32_t cond; - bool filter; - bool asc; - bool grpJoin; - bool timetruncate; - SExecTaskInfo* pTask; -} SJoinTestParam; + return (taosRand() % 2) : true : false; +} +EOrder qptGetInputTsOrder() { + return qptCtx->buildCtx.currTsOrder; +} -SJoinTestCtx jtCtx = {0}; -SJoinTestCtrl jtCtrl = {0, 0, 0, 0, 0}; -SJoinTestStat jtStat = {0}; -SJoinTestResInfo jtRes = {0}; +SNode* qptMakeLimitNode() { + SNode* pNode = NULL; + assert(0 == nodesMakeNode(QUERY_NODE_LIMIT, &pNode)); + assert(pNode); + SLimitNode* pLimit = (SLimitNode*)pNode; -void printResRow(char* value, int32_t type) { - if (!jtCtrl.printResRow) { - return; - } - - JT_PRINTF(" "); - for (int32_t i = 0; i < jtCtx.resColNum; ++i) { - int32_t slot = jtCtx.resColInSlot[i]; - if (0 == type && ((jtCtx.leftColOnly && slot >= MAX_SLOT_NUM) || - (jtCtx.rightColOnly && slot < MAX_SLOT_NUM))) { - ("%18s", " "); - continue; + if (!qptCtx->param->correctExpected) { + if (taosRand() % 2) { + pLimit->limit = taosRand() * ((taosRand() % 2) : 1 : -1); } - - if (*(bool*)(value + slot)) { - JT_PRINTF("%18s", " NULL"); - continue; + if (taosRand() % 2) { + pLimit->offset = taosRand() * ((taosRand() % 2) : 1 : -1); } - - switch (jtInputColType[slot % MAX_SLOT_NUM]) { - case TSDB_DATA_TYPE_TIMESTAMP: - JT_PRINTF("%18" PRId64 , *(int64_t*)(value + jtCtx.resColOffset[slot])); - break; - case TSDB_DATA_TYPE_INT: - JT_PRINTF("%18d", *(int32_t*)(value + jtCtx.resColOffset[slot])); - break; - case TSDB_DATA_TYPE_BIGINT: - JT_PRINTF("%18" PRId64, *(int64_t*)(value + jtCtx.resColOffset[slot])); - break; + } else { + pLimit->limit = taosRand(); + if (taosRand() % 2) { + pLimit->offset = taosRand(); } } - JT_PRINTF("\t %s\n", 0 == type ? "-" : (1 == type ? "+" : "")); + + return pLimit; } -void pushResRow(char* buf, int32_t size) { - jtCtx.resRows++; +SNode* qptMakeColumnNodeFromTable(int32_t colIdx, EColumnType colType, SScanPhysiNode* pScanPhysiNode) { + SColumnNode* pCol = NULL; + assert(0 == nodesMakeNode(QUERY_NODE_COLUMN, (SNode**)&pCol)); + assert(pCol); - if (!jtCtrl.noKeepResRows) { - int32_t* rows = (int32_t*)tSimpleHashGet(jtCtx.jtResRows, buf, size); - if (rows) { - (*rows)++; - } else { - int32_t n = 1; - assert(0 == tSimpleHashPut(jtCtx.jtResRows, buf, size, &n, sizeof(n))); - } - } -} + pCol->node.resType.type = qptCtx->param.tbl.pCol[colIdx].type; + pCol->node.resType.bytes = qptCtx->param.tbl.pCol[colIdx].len; -void rmResRow() { - int32_t* rows = (int32_t*)tSimpleHashGet(jtCtx.jtResRows, jtCtx.resColBuf, jtCtx.resColSize); - if (rows) { - (*rows)--; - if ((*rows) == 0) { - (void)tSimpleHashRemove(jtCtx.jtResRows, jtCtx.resColBuf, jtCtx.resColSize); - } - } else { - assert(0); - } + pCol->tableId = qptCtx->param.tbl.uid; + pCol->tableType = qptCtx->param.tbl.tblType; + pCol->colId = colIdx; + pCol->projIdx = colIdx; + pCol->colType = qptCtx->param.tbl.pCol[colIdx].colType; + pCol->hasIndex = qptCtx->param.tbl.pCol[colIdx].hasIndex; + pCol->isPrimTs = qptCtx->param.tbl.pCol[colIdx].isPrimTs; + strcpy(pCol->dbName, qptCtx->param.db.dbName); + strcpy(pCol->tableName, qptCtx->param.tbl.tblName); + strcpy(pCol->tableAlias, qptCtx->param.tbl.tblAlias); + strcpy(pCol->colName, qptCtx->param.tbl.pCol[colIdx].name); + pCol->dataBlockId = pScanPhysiNode->node.pOutputDataBlockDesc->dataBlockId; + pCol->slotId = colIdx; + pCol->numOfPKs = qptCtx->param.tbl.pkNum; + pCol->tableHasPk = qptCtx->param.tbl.pkNum > 0; + pCol->isPk = qptCtx->param.tbl.pCol[colIdx].isPk; + pCol->projRefIdx = 0; + pCol->resIdx = 0; + + return (SNode*)pCol; } -static int32_t jtMergeEqCond(SNode** ppDst, SNode** ppSrc) { - if (NULL == *ppSrc) { - return TSDB_CODE_SUCCESS; - } - if (NULL == *ppDst) { - *ppDst = *ppSrc; - *ppSrc = NULL; - return TSDB_CODE_SUCCESS; - } - if (QUERY_NODE_LOGIC_CONDITION == nodeType(*ppSrc)) { - TSWAP(*ppDst, *ppSrc); - } - if (QUERY_NODE_LOGIC_CONDITION == nodeType(*ppDst)) { - SLogicConditionNode* pLogic = (SLogicConditionNode*)*ppDst; - if (QUERY_NODE_LOGIC_CONDITION == nodeType(*ppSrc)) { - assert(0 == nodesListStrictAppendList(pLogic->pParameterList, ((SLogicConditionNode*)(*ppSrc))->pParameterList)); - ((SLogicConditionNode*)(*ppSrc))->pParameterList = NULL; - } else { - assert(0 == nodesListStrictAppend(pLogic->pParameterList, *ppSrc)); - *ppSrc = NULL; - } - nodesDestroyNode(*ppSrc); - *ppSrc = NULL; - return TSDB_CODE_SUCCESS; - } - SLogicConditionNode* pLogicCond = NULL; - int32_t code = nodesMakeNode(QUERY_NODE_LOGIC_CONDITION, (SNode**)&pLogicCond); - if (NULL == pLogicCond) { - return code; - } - pLogicCond->node.resType.type = TSDB_DATA_TYPE_BOOL; - pLogicCond->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_BOOL].bytes; - pLogicCond->condType = LOGIC_COND_TYPE_AND; - pLogicCond->pParameterList = NULL; - code = nodesMakeList(&pLogicCond->pParameterList); - assert(0 == nodesListStrictAppend(pLogicCond->pParameterList, *ppSrc)); - assert(0 == nodesListStrictAppend(pLogicCond->pParameterList, *ppDst)); - - *ppDst = (SNode*)pLogicCond; - *ppSrc = NULL; - - return TSDB_CODE_SUCCESS; +void qptMakeWhenThenNode(SNode** ppNode) { + assert(0 == nodesMakeNode(QUERY_NODE_WHEN_THEN, ppNode)); + assert(*ppNode); + SWhenThenNode* pWhenThen = (SWhenThenNode*)*ppNode; + + qptMakeExprNode(&pWhenThen->pWhen); + assert(pWhenThen->pWhen); + + qptMakeExprNode(&pWhenThen->pThen); + assert(pWhenThen->pThen); } -void createDummyDownstreamOperators(int32_t num, SOperatorInfo** ppRes) { - for (int32_t i = 0; i < num; ++i) { - SOperatorInfo* p = (SOperatorInfo*)taosMemoryCalloc(1, sizeof(SOperatorInfo)); - assert(NULL != p); - p->resultDataBlockId = i; - ppRes[i] = p; +void qptMakeCaseWhenNode(SNode** ppNode) { + assert(0 == nodesMakeNode(QUERY_NODE_CASE_WHEN, ppNode)); + assert(*ppNode); + SCaseWhenNode* pCaseWhen = (SCaseWhenNode*)*ppNode; + + qptCtx->makeCtx.nodeLevel++; + + qptMakeExprNode(&pCaseWhen->pCase); + assert(pCaseWhen->pCase); + + qptMakeExprNode(&pCaseWhen->pElse); + assert(pCaseWhen->pElse); + + int32_t whenNum = taosRand() % QPT_MAX_WHEN_THEN_NUM + 1; + for (int32_t i = 0; i < whenNum; ++i) { + SNode* pNode = NULL; + qptMakeWhenThenNode(&pNode); + assert(0 == nodesListMakeStrictAppend(&pCaseWhen->pWhenThenList, pNode)); } } -void createTargetSlotList(SSortMergeJoinPhysiNode* p) { - jtCtx.resColNum = 0; - TAOS_MEMSET(jtCtx.resColList, 0, sizeof(jtCtx.resColList)); - jtCtx.resColSize = MAX_SLOT_NUM * 2 * sizeof(bool); - jtCtx.keyInSlotIdx = -1; - for (int32_t i = 0; i < MAX_SLOT_NUM; ++i) { - if (jtCtx.colOnList[i] || jtCtx.colEqList[i] || jtCtx.leftFilterColList[i]) { - jtCtx.resColList[i] = 1; - } - } +void qptMakeOperatorNode(SNode** ppNode) { + EOperatorType opType; + opType = OPERATOR_ARRAY[taosRand() % (sizeof(OPERATOR_ARRAY)/sizeof(OPERATOR_ARRAY[0]))]; + assert(0 == nodesMakeNode(QUERY_NODE_OPERATOR, ppNode)); + SOperatorNode* pOp = (SOperatorNode*)*ppNode; + pOp->opType = opType; + switch (opType) { + case OP_TYPE_ADD: + case OP_TYPE_SUB: + case OP_TYPE_MULTI: + case OP_TYPE_DIV: + case OP_TYPE_REM: + case OP_TYPE_BIT_AND: + case OP_TYPE_BIT_OR: + case OP_TYPE_GREATER_THAN: + case OP_TYPE_GREATER_EQUAL: + case OP_TYPE_LOWER_THAN: + case OP_TYPE_LOWER_EQUAL: + case OP_TYPE_EQUAL: + case OP_TYPE_NOT_EQUAL: + case OP_TYPE_LIKE: + case OP_TYPE_NOT_LIKE: + case OP_TYPE_MATCH: + case OP_TYPE_NMATCH: + case OP_TYPE_IN: + case OP_TYPE_NOT_IN: + case OP_TYPE_JSON_GET_VALUE: + case OP_TYPE_JSON_CONTAINS: + case OP_TYPE_ASSIGN: + qptMakeOperatorNode(&pOp->pLeft); + qptMakeOperatorNode(&pOp->pRight); + break; - for (int32_t i = 0; i < MAX_SLOT_NUM; ++i) { - if (jtCtx.colOnList[i] || jtCtx.colEqList[i] || jtCtx.rightFilterColList[i]) { - jtCtx.resColList[MAX_SLOT_NUM + i] = 1; - } + case OP_TYPE_IS_NULL: + case OP_TYPE_IS_NOT_NULL: + case OP_TYPE_IS_TRUE: + case OP_TYPE_IS_FALSE: + case OP_TYPE_IS_UNKNOWN: + case OP_TYPE_IS_NOT_TRUE: + case OP_TYPE_IS_NOT_FALSE: + case OP_TYPE_IS_NOT_UNKNOWN: + case OP_TYPE_MINUS: + qptMakeOperatorNode(&pOp->pLeft); + break; + default: + assert(0); + break; } +} - for (int32_t i = 0; i < MAX_SLOT_NUM; ++i) { - if (0 == jtCtx.resColList[i]) { - jtCtx.resColList[i]= taosRand() % 2; - } +void qptMakeColumnNode(SNode** ppNode) { + SNodeList* pColList = qptCtx->makeCtx.pInputDataBlockDesc->pSlots; + int32_t colIdx = taosRand() % pColList->length; + SNode* pNode = nodesListGetNode(pColList, colIdx); + assert(nodeType(pNode) == QUERY_NODE_SLOT_DESC); + SSlotDescNode* pSlot = (SSlotDescNode*)pNode; + SColumnNode* pCol = NULL; + nodesMakeNode(QUERY_NODE_COLUMN, (SNode**)&pCol); + pCol->node.resType = pSlot->dataType; + pCol->dataBlockId = qptCtx->makeCtx.pInputDataBlockDesc->dataBlockId; + pCol->slotId = pSlot->slotId; - if ((jtCtx.joinType == JOIN_TYPE_LEFT || jtCtx.joinType == JOIN_TYPE_FULL) && (i == JT_KEY_SOLT_ID)) { - jtCtx.resColList[i] = 1; - } + *ppNode = (SNode*)pCol; +} - if (jtCtx.resColList[i] && i == JT_KEY_SOLT_ID && (jtCtx.joinType == JOIN_TYPE_LEFT || jtCtx.joinType == JOIN_TYPE_FULL)) { - jtCtx.keyInSlotIdx = JT_KEY_SOLT_ID; +void qptGetRandValue(int32_t* pType, int32_t* pLen, void** ppVal) { + *pType = taosRand() % TSDB_DATA_TYPE_MAX; + switch (*pType) { + case TSDB_DATA_TYPE_NULL: + *pLen = 0; + *ppVal = NULL; + break; + case TSDB_DATA_TYPE_BOOL: + *pLen = tDataTypes[*pType].bytes; + *ppVal = taosMemoryMalloc(tDataTypes[*pType].bytes); + assert(*ppVal); + *(bool*)*ppVal = (taosRand() % 2) : true : false; + break; + case TSDB_DATA_TYPE_TINYINT: + *pLen = tDataTypes[*pType].bytes; + *ppVal = taosMemoryMalloc(tDataTypes[*pType].bytes); + assert(*ppVal); + *(int8_t*)*ppVal = taosRand(); + break; + case TSDB_DATA_TYPE_SMALLINT: + *pLen = tDataTypes[*pType].bytes; + *ppVal = taosMemoryMalloc(tDataTypes[*pType].bytes); + assert(*ppVal); + *(int16_t*)*ppVal = taosRand(); + break; + case TSDB_DATA_TYPE_INT: + *pLen = tDataTypes[*pType].bytes; + *ppVal = taosMemoryMalloc(tDataTypes[*pType].bytes); + assert(*ppVal); + *(int32_t*)*ppVal = taosRand(); + break; + case TSDB_DATA_TYPE_BIGINT: + case TSDB_DATA_TYPE_TIMESTAMP: + *pLen = tDataTypes[*pType].bytes; + *ppVal = taosMemoryMalloc(tDataTypes[*pType].bytes); + assert(*ppVal); + *(int64_t*)*ppVal = taosRand(); + break; + case TSDB_DATA_TYPE_FLOAT: + *pLen = tDataTypes[*pType].bytes; + *ppVal = taosMemoryMalloc(tDataTypes[*pType].bytes); + assert(*ppVal); + *(float*)*ppVal = taosRand(); + break; + case TSDB_DATA_TYPE_DOUBLE: + *pLen = tDataTypes[*pType].bytes; + *ppVal = taosMemoryMalloc(tDataTypes[*pType].bytes); + assert(*ppVal); + *(double*)*ppVal = taosRand(); + break; + case TSDB_DATA_TYPE_VARCHAR: + case TSDB_DATA_TYPE_GEOMETRY: + case TSDB_DATA_TYPE_JSON: + case TSDB_DATA_TYPE_VARBINARY: + case TSDB_DATA_TYPE_DECIMAL: + case TSDB_DATA_TYPE_BLOB: + case TSDB_DATA_TYPE_MEDIUMBLOB: + *pLen = taosRand() % QPT_MAX_STRING_LEN; + *ppVal = taosMemoryCalloc(1, *pLen + VARSTR_HEADER_SIZE); + assert(*ppVal); + varDataSetLen(*ppVal, *pLen); + memset((char*)*ppVal + VARSTR_HEADER_SIZE, 'A' + taosRand() % 26, *pLen); + break; + case TSDB_DATA_TYPE_NCHAR: { + *pLen = taosRand() % QPT_MAX_STRING_LEN; + char* pTmp = taosMemoryCalloc(1, *pLen + 1); + assert(pTmp); + memset(pTmp, 'A' + taosRand() % 26, *pLen); + *ppVal = taosMemoryCalloc(1, *pLen * TSDB_NCHAR_SIZE + VARSTR_HEADER_SIZE); + assert(*ppVal); + assert(taosMbsToUcs4(pTmp, *pLen, (TdUcs4 *)varDataVal(*ppVal), *pLen * TSDB_NCHAR_SIZE, NULL)); + *pLen *= TSDB_NCHAR_SIZE; + varDataSetLen(*ppVal, *pLen); + taosMemoryFree(pTmp); + break; } + case TSDB_DATA_TYPE_UTINYINT: + *pLen = tDataTypes[*pType].bytes; + *ppVal = taosMemoryMalloc(tDataTypes[*pType].bytes); + assert(*ppVal); + *(uint8_t*)*ppVal = taosRand(); + break; + case TSDB_DATA_TYPE_USMALLINT: + *pLen = tDataTypes[*pType].bytes; + *ppVal = taosMemoryMalloc(tDataTypes[*pType].bytes); + assert(*ppVal); + *(uint16_t*)*ppVal = taosRand(); + break; + case TSDB_DATA_TYPE_UINT: + *pLen = tDataTypes[*pType].bytes; + *ppVal = taosMemoryMalloc(tDataTypes[*pType].bytes); + assert(*ppVal); + *(uint32_t*)*ppVal = taosRand(); + break; + case TSDB_DATA_TYPE_UBIGINT: + *pLen = tDataTypes[*pType].bytes; + *ppVal = taosMemoryMalloc(tDataTypes[*pType].bytes); + assert(*ppVal); + *(uint64_t*)*ppVal = taosRand(); + break; + default: + assert(0); + break; } +} - if (jtCtx.keyInSlotIdx < 0 || ((jtCtx.joinType == JOIN_TYPE_RIGHT || jtCtx.joinType == JOIN_TYPE_FULL))) { - jtCtx.resColList[MAX_SLOT_NUM + JT_KEY_SOLT_ID]= 1; - jtCtx.keyInSlotIdx = JT_KEY_SOLT_ID + MAX_SLOT_NUM; +void qptFreeRandValue(int32_t* pType, void* pVal) { + switch (*pType) { + case TSDB_DATA_TYPE_BOOL: + case TSDB_DATA_TYPE_TINYINT: + case TSDB_DATA_TYPE_SMALLINT: + case TSDB_DATA_TYPE_INT: + case TSDB_DATA_TYPE_BIGINT: + case TSDB_DATA_TYPE_FLOAT: + case TSDB_DATA_TYPE_DOUBLE: + case TSDB_DATA_TYPE_TIMESTAMP: + case TSDB_DATA_TYPE_UTINYINT: + case TSDB_DATA_TYPE_USMALLINT: + case TSDB_DATA_TYPE_UINT: + case TSDB_DATA_TYPE_UBIGINT: + taosMemoryFree(pVal); + break; + case TSDB_DATA_TYPE_NULL: + case TSDB_DATA_TYPE_VARCHAR: + case TSDB_DATA_TYPE_GEOMETRY: + case TSDB_DATA_TYPE_NCHAR: + case TSDB_DATA_TYPE_JSON: + case TSDB_DATA_TYPE_VARBINARY: + case TSDB_DATA_TYPE_DECIMAL: + case TSDB_DATA_TYPE_BLOB: + case TSDB_DATA_TYPE_MEDIUMBLOB: + break; + default: + assert(0); + break; } +} - for (int32_t i = 0; i < MAX_SLOT_NUM; ++i) { - if (0 == jtCtx.resColList[MAX_SLOT_NUM + i]) { - jtCtx.resColList[MAX_SLOT_NUM + i]= taosRand() % 2; - } - } +void qptMakeValueNode(SNode** ppNode) { + SValueNode* pVal = NULL; + nodesMakeNode(QUERY_NODE_VALUE, (SNode**)&pVal); - int32_t idx = 0; - int32_t dstIdx = 0; - int32_t dstOffset = jtCtx.resColSize; + int32_t valType, valBytes; + void* pValue = NULL; + qptGetRandValue(&valType, &valBytes, &pValue); + + pVal->node.resType.type = valType; + pVal->node.resType.bytes = valBytes; + nodesSetValueNodeValue(pVal, pValue); - for (int32_t i = 0; i < MAX_SLOT_NUM; ++i) { - if (jtCtx.resColList[i]) { - jtCtx.resColOffset[i] = dstOffset; - jtCtx.resColInSlot[dstIdx] = i; - if (jtCtx.keyInSlotIdx == i) { - jtCtx.keyColOffset = dstOffset; - } + *ppNode = (SNode*)pVal; +} - STargetNode* pTarget = NULL; - int32_t code = nodesMakeNode(QUERY_NODE_TARGET, (SNode**)&pTarget); - SColumnNode* pCol = NULL; - code = nodesMakeNode(QUERY_NODE_COLUMN, (SNode**)&pCol); - assert(NULL != pTarget && NULL != pCol); - pCol->dataBlockId = LEFT_BLK_ID; - pCol->slotId = i; - pTarget->dataBlockId = RES_BLK_ID; - pTarget->slotId = dstIdx++; - pTarget->pExpr = (SNode*)pCol; - dstOffset += tDataTypes[jtInputColType[i]].bytes; - jtCtx.resColSize += tDataTypes[jtInputColType[i]].bytes; - - assert(0 == nodesListMakeStrictAppend(&p->pTargets, (SNode*)pTarget)); +void qptMakeFunctionNode(SNode** ppNode) { + SFunctionNode* pFunc = NULL; + nodesMakeNode(QUERY_NODE_FUNCTION, (SNode**)&pFunc); - jtCtx.resColNum++; - } + int32_t funcIdx = taosRand() % funcMgtBuiltinsNum; + strcpy(pFunc->functionName, funcMgtBuiltins[funcIdx].name); + + fmGetFuncInfo(pFunc, NULL, 0); + + qptCtx->makeCtx.nodeLevel++; + int32_t paramNum = taosRand() % QPT_MAX_FUNC_PARAM + 1; + for (int32_t i = 0; i < paramNum; ++i) { + SNode* pNode = NULL; + qptMakeExprNode(&pNode); + assert(0 == nodesListMakeStrictAppend(&pFunc->pParameterList, pNode)); } - for (int32_t i = 0; i < MAX_SLOT_NUM; ++i) { - if (jtCtx.resColList[MAX_SLOT_NUM + i]) { - jtCtx.resColOffset[MAX_SLOT_NUM + i] = dstOffset; - jtCtx.resColInSlot[dstIdx] = i + MAX_SLOT_NUM; - if (jtCtx.keyInSlotIdx == (i + MAX_SLOT_NUM)) { - jtCtx.keyColOffset = dstOffset; - } + *ppNode = (SNode*)pFunc; +} - STargetNode* pTarget = NULL; - int32_t code = nodesMakeNode(QUERY_NODE_TARGET, (SNode**)&pTarget); - SColumnNode* pCol = NULL; - code = nodesMakeNode(QUERY_NODE_COLUMN, (SNode**)&pCol); - assert(NULL != pTarget && NULL != pCol); - pCol->dataBlockId = RIGHT_BLK_ID; - pCol->slotId = i; - pTarget->dataBlockId = RES_BLK_ID; - pTarget->slotId = dstIdx++; - pTarget->pExpr = (SNode*)pCol; - dstOffset += tDataTypes[jtInputColType[i]].bytes; - jtCtx.resColSize += tDataTypes[jtInputColType[i]].bytes; - - assert(0 == nodesListMakeStrictAppend(&p->pTargets, (SNode*)pTarget)); - jtCtx.resColNum++; - } - } +void qptMakeLogicCondNode(SNode** ppNode) { + SLogicConditionNode* pLogic = NULL; + nodesMakeNode(QUERY_NODE_LOGIC_CONDITION, (SNode**)&pLogic); - jtCtx.resColBuf = (char*)taosMemoryRealloc(jtCtx.resColBuf, jtCtx.resColSize); - assert(NULL != jtCtx.resColBuf); -} + pLogic->condType = (taosRand() % 3) ? ((taosRand() % 2) ? LOGIC_COND_TYPE_AND : LOGIC_COND_TYPE_OR) : LOGIC_COND_TYPE_NOT; -void createColEqCondStart(SSortMergeJoinPhysiNode* p) { - jtCtx.colEqNum = 0; - do { - jtCtx.colEqNum = taosRand() % MAX_SLOT_NUM; // except TIMESTAMP - } while (0 == jtCtx.colEqNum); - - int32_t idx = 0; - TAOS_MEMSET(jtCtx.colEqList, 0, sizeof(jtCtx.colEqList)); - for (int32_t i = 0; i < jtCtx.colEqNum; ) { - idx = taosRand() % MAX_SLOT_NUM; - if (jtCtx.colEqList[idx]) { - continue; - } - if (TSDB_DATA_TYPE_TIMESTAMP == jtInputColType[idx]) { - continue; - } - jtCtx.colEqList[idx] = 1; - ++i; + qptCtx->makeCtx.nodeLevel++; + int32_t paramNum = taosRand() % QPT_MAX_LOGIC_PARAM + 1; + for (int32_t i = 0; i < paramNum; ++i) { + SNode* pNode = NULL; + qptMakeExprNode(&pNode); + assert(0 == nodesListMakeStrictAppend(&pLogic->pParameterList, pNode)); } - for (int32_t i = 0; i < MAX_SLOT_NUM; ++i) { - if (jtCtx.colEqList[i]) { - SColumnNode* pCol1 = NULL; - int32_t code = nodesMakeNode(QUERY_NODE_COLUMN, (SNode**)&pCol1); - assert(pCol1); - pCol1->dataBlockId = LEFT_BLK_ID; - pCol1->slotId = i; - pCol1->node.resType.type = jtInputColType[i]; - pCol1->node.resType.bytes = tDataTypes[jtInputColType[i]].bytes; - - assert(0 == nodesListMakeStrictAppend(&p->pEqLeft, (SNode*)pCol1)); - - SColumnNode* pCol2 = NULL; - code = nodesMakeNode(QUERY_NODE_COLUMN, (SNode**)&pCol2); - pCol2->dataBlockId = RIGHT_BLK_ID; - pCol2->slotId = i; - pCol2->node.resType.type = jtInputColType[i]; - pCol2->node.resType.bytes = tDataTypes[jtInputColType[i]].bytes; - - assert(0 == nodesListMakeStrictAppend(&p->pEqRight, (SNode*)pCol2)); - } - } + *ppNode = (SNode*)pLogic; } -void createColOnCondStart(SSortMergeJoinPhysiNode* p) { - jtCtx.colOnNum = 0; - do { - jtCtx.colOnNum = taosRand() % (MAX_SLOT_NUM + 1); - } while (0 == jtCtx.colOnNum || (jtCtx.colOnNum + jtCtx.colEqNum) > MAX_SLOT_NUM); - - int32_t idx = 0; - TAOS_MEMSET(jtCtx.colOnList, 0, sizeof(jtCtx.colOnList)); - for (int32_t i = 0; i < jtCtx.colOnNum; ) { - idx = taosRand() % MAX_SLOT_NUM; - if (jtCtx.colOnList[idx] || jtCtx.colEqList[idx]) { - continue; - } - jtCtx.colOnList[idx] = 1; - ++i; - } -} +void qptMakeNodeListNode(SNode** ppNode) { + SNodeListNode* pList = NULL; + nodesMakeNode(QUERY_NODE_NODE_LIST, (SNode**)&pList); -int32_t getDstSlotId(int32_t srcIdx) { - for (int32_t i = 0; i < jtCtx.resColNum; ++i) { - if (jtCtx.resColInSlot[i] == srcIdx) { - return i; - } + qptCtx->makeCtx.nodeLevel++; + int32_t nodeNum = taosRand() % QPT_MAX_NODE_LIST_NUM + 1; + for (int32_t i = 0; i < nodeNum; ++i) { + SNode* pNode = NULL; + qptMakeExprNode(&pNode); + assert(0 == nodesListMakeStrictAppend(&pList->pNodeList, pNode)); } - return -1; + *ppNode = (SNode*)pList; } +void qptMakeTempTableNode(SNode** ppNode) { + STempTableNode* pTemp = NULL; + assert(0 == nodesMakeNode(QUERY_NODE_TEMP_TABLE, (SNode**)&pTemp)); -void createColEqCondEnd(SSortMergeJoinPhysiNode* p) { - if (jtCtx.colEqNum <= 0) { - return; - } + *ppNode = (SNode*)pTemp; +} - SLogicConditionNode* pLogic = NULL; - if (jtCtx.colEqNum > 1) { - int32_t code = nodesMakeNode(QUERY_NODE_LOGIC_CONDITION, (SNode**)&pLogic); - assert(pLogic); - pLogic->node.resType.type = TSDB_DATA_TYPE_BOOL; - pLogic->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_BOOL].bytes; - pLogic->condType = LOGIC_COND_TYPE_AND; - } - - for (int32_t i = 0; i < MAX_SLOT_NUM; ++i) { - if (jtCtx.colEqList[i]) { - SColumnNode* pCol1 = NULL; - int32_t code = nodesMakeNode(QUERY_NODE_COLUMN, (SNode**)&pCol1); - assert(pCol1); - pCol1->dataBlockId = RES_BLK_ID; - pCol1->slotId = getDstSlotId(i); - pCol1->node.resType.type = jtInputColType[i]; - pCol1->node.resType.bytes = tDataTypes[jtInputColType[i]].bytes; - - SColumnNode* pCol2 = NULL; - code = nodesMakeNode(QUERY_NODE_COLUMN, (SNode**)&pCol2); - assert(pCol2); - pCol2->dataBlockId = RES_BLK_ID; - pCol2->slotId = getDstSlotId(MAX_SLOT_NUM + i); - pCol2->node.resType.type = jtInputColType[i]; - pCol2->node.resType.bytes = tDataTypes[jtInputColType[i]].bytes; - - SOperatorNode* pOp = NULL; - code = nodesMakeNode(QUERY_NODE_OPERATOR, (SNode**)&pOp); - assert(pOp); - pOp->opType = OP_TYPE_EQUAL; - pOp->node.resType.type = TSDB_DATA_TYPE_BOOL; - pOp->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_BOOL].bytes; - pOp->pLeft = (SNode*)pCol1; - pOp->pRight = (SNode*)pCol2; - - if (jtCtx.colEqNum > 1) { - assert(0 == nodesListMakeStrictAppend(&pLogic->pParameterList, (SNode*)pOp)); - } else { - p->pFullOnCond = (SNode*)pOp; - break; - } - } - } +void qptMakeJoinTableNode(SNode** ppNode) { + SJoinTableNode* pJoin = NULL; + assert(0 == nodesMakeNode(QUERY_NODE_JOIN_TABLE, (SNode**)&pJoin)); - if (jtCtx.colEqNum > 1) { - p->pFullOnCond = (SNode*)pLogic; - } + *ppNode = (SNode*)pJoin; } -void createColOnCondEnd(SSortMergeJoinPhysiNode* p) { - if (jtCtx.colOnNum <= 0) { - return; - } - SLogicConditionNode* pLogic = NULL; - if (jtCtx.colOnNum > 1) { - int32_t code = nodesMakeNode(QUERY_NODE_LOGIC_CONDITION, (SNode**)&pLogic); - assert(pLogic); - pLogic->node.resType.type = TSDB_DATA_TYPE_BOOL; - pLogic->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_BOOL].bytes; - pLogic->condType = LOGIC_COND_TYPE_AND; - } - - for (int32_t i = 0; i < MAX_SLOT_NUM; ++i) { - if (jtCtx.colOnList[i]) { - SColumnNode* pCol1 = NULL; - int32_t code = nodesMakeNode(QUERY_NODE_COLUMN, (SNode**)&pCol1); - assert(pCol1); - pCol1->dataBlockId = RES_BLK_ID; - pCol1->slotId = getDstSlotId(i); - pCol1->node.resType.type = jtInputColType[i]; - pCol1->node.resType.bytes = tDataTypes[jtInputColType[i]].bytes; - - SColumnNode* pCol2 = NULL; - code = nodesMakeNode(QUERY_NODE_COLUMN, (SNode**)&pCol2); - assert(pCol2); - pCol2->dataBlockId = RES_BLK_ID; - pCol2->slotId = getDstSlotId(MAX_SLOT_NUM + i); - pCol2->node.resType.type = jtInputColType[i]; - pCol2->node.resType.bytes = tDataTypes[jtInputColType[i]].bytes; - - SOperatorNode* pOp = NULL; - code = nodesMakeNode(QUERY_NODE_OPERATOR, (SNode**)&pOp); - assert(pOp); - pOp->opType = OP_TYPE_GREATER_THAN; - pOp->node.resType.type = TSDB_DATA_TYPE_BOOL; - pOp->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_BOOL].bytes; - pOp->pLeft = (SNode*)pCol1; - pOp->pRight = (SNode*)pCol2; - - if (jtCtx.colOnNum > 1) { - assert(0 == nodesListMakeStrictAppend(&pLogic->pParameterList, (SNode*)pOp)); - } else { - p->pColOnCond = (SNode*)pOp; - break; - } - } +void qptMakeTableNode(SNode** ppNode) { + if (taosRand() % 2) { + qptMakeTempTableNode(ppNode); + } else { + qptMakeJoinTableNode(ppNode); } - - if (jtCtx.colOnNum > 1) { - p->pColOnCond = (SNode*)pLogic; - } - - SNode* pTmp = NULL; - int32_t code = nodesCloneNode(p->pColOnCond, &pTmp); - assert(pTmp); - assert(0 == jtMergeEqCond(&p->pFullOnCond, &pTmp)); } - -void createColCond(SSortMergeJoinPhysiNode* p, int32_t cond) { - jtCtx.colCond = cond; - switch (cond) { - case TEST_NO_COND: - jtCtx.colEqNum = 0; - jtCtx.colOnNum = 0; - TAOS_MEMSET(jtCtx.colEqList, 0, sizeof(jtCtx.colEqList)); - TAOS_MEMSET(jtCtx.colOnList, 0, sizeof(jtCtx.colOnList)); +void qptMakeExprNode(SNode** ppNode) { + int32_t nodeTypeMaxValue = 9; + if (qptCtx->makeCtx.nodeLevel >= QPT_MAX_NODE_LEVEL) { + nodeTypeMaxValue = 2; + } + + switch (taosRand() % 10) { + case 0: + qptMakeColumnNode(ppNode); + break; + case 1: + qptMakeValueNode(ppNode); + break; + case 2: + qptMakeFunctionNode(ppNode); + break; + case 3: + qptMakeLogicCondNode(ppNode); + break; + case 4: + qptMakeNodeListNode(ppNode); + break; + case 5: + qptMakeOperatorNode(ppNode); + break; + case 6: + qptMakeTableNode(ppNode); break; - case TEST_EQ_COND: - createColEqCondStart(p); - jtCtx.colOnNum = 0; - TAOS_MEMSET(jtCtx.colOnList, 0, sizeof(jtCtx.colOnList)); + case 7: + qptMakeCaseWhenNode(ppNode); break; - case TEST_ON_COND: - createColOnCondStart(p); - jtCtx.colEqNum = 0; - TAOS_MEMSET(jtCtx.colEqList, 0, sizeof(jtCtx.colEqList)); + case 8: + qptMakeWhenThenNode(ppNode); break; - case TEST_FULL_COND: - createColEqCondStart(p); - createColOnCondStart(p); - break; default: + assert(0); break; } } -void* getFilterValue(int32_t type) { - switch (type) { - case TSDB_DATA_TYPE_TIMESTAMP: - return &TIMESTAMP_FILTER_VALUE; - case TSDB_DATA_TYPE_INT: - return &INT_FILTER_VALUE; - case TSDB_DATA_TYPE_BIGINT: - return &BIGINT_FILTER_VALUE; - default: - return NULL; - } +void qptResetMakeNodeCtx(SDataBlockDescNode* pInput, bool onlyTag) { + SQPTMakeNodeCtx* pCtx = &qptCtx->makeCtx; + + pCtx->nodeLevel = 1; + pCtx->onlyTag = onlyTag; + pCtx->pInputDataBlockDesc = pInput; } -void createFilterStart(SSortMergeJoinPhysiNode* p, bool filter) { - jtCtx.filter = filter; - if (!filter) { - jtCtx.leftFilterNum = 0; - jtCtx.rightFilterNum = 0; - TAOS_MEMSET(jtCtx.leftFilterColList, 0, sizeof(jtCtx.leftFilterColList)); - TAOS_MEMSET(jtCtx.rightFilterColList, 0, sizeof(jtCtx.rightFilterColList)); - return; - } +SNode* qptMakeConditionNode(bool onlyTag) { + SNode* pNode = NULL; + qptResetMakeNodeCtx(qptCtx->buildCtx.pCurr->pOutputDataBlockDesc, onlyTag); + qptMakeExprNode(&pNode); + return pNode; +} - if ((JOIN_STYPE_SEMI == jtCtx.subType || JOIN_STYPE_ANTI == jtCtx.subType) && JOIN_TYPE_LEFT == jtCtx.joinType) { - jtCtx.rightFilterNum = 0; - jtCtx.leftFilterNum = taosRand() % (MAX_SLOT_NUM + 1); - if (0 == jtCtx.leftFilterNum) { - do { - jtCtx.leftFilterNum = taosRand() % (MAX_SLOT_NUM + 1); - } while (0 == jtCtx.leftFilterNum); - } - } else if ((JOIN_STYPE_SEMI == jtCtx.subType || JOIN_STYPE_ANTI == jtCtx.subType) && JOIN_TYPE_RIGHT == jtCtx.joinType) { - jtCtx.leftFilterNum = 0; - jtCtx.rightFilterNum = taosRand() % (MAX_SLOT_NUM + 1); - if (0 == jtCtx.rightFilterNum) { - do { - jtCtx.rightFilterNum = taosRand() % (MAX_SLOT_NUM + 1); - } while (0 == jtCtx.rightFilterNum); - } - } else { - jtCtx.leftFilterNum = taosRand() % (MAX_SLOT_NUM + 1); - if (0 == jtCtx.leftFilterNum) { - do { - jtCtx.rightFilterNum = taosRand() % (MAX_SLOT_NUM + 1); - } while (0 == jtCtx.rightFilterNum); - } else { - jtCtx.rightFilterNum = taosRand() % (MAX_SLOT_NUM + 1); - } - } - int32_t idx = 0; - TAOS_MEMSET(jtCtx.leftFilterColList, 0, sizeof(jtCtx.leftFilterColList)); - TAOS_MEMSET(jtCtx.rightFilterColList, 0, sizeof(jtCtx.rightFilterColList)); - for (int32_t i = 0; i < jtCtx.leftFilterNum; ) { - idx = taosRand() % MAX_SLOT_NUM; - if (jtCtx.leftFilterColList[idx]) { - continue; - } - jtCtx.leftFilterColList[idx] = 1; - ++i; +SPhysiNode* qptCreatePhysiNode(int32_t nodeType) { + SPhysiNode* pPhysiNode = NULL; + int32_t code = nodesMakeNode(nodeType, (SNode**)&pPhysiNode); + if (NULL == pPhysiNode) { + assert(0); } - for (int32_t i = 0; i < jtCtx.rightFilterNum; ) { - idx = taosRand() % MAX_SLOT_NUM; - if (jtCtx.rightFilterColList[idx]) { - continue; - } - jtCtx.rightFilterColList[idx] = 1; - ++i; - } + qptCtx.buildCtx.pCurr = pPhysiNode; + + pPhysiNode->pLimit = qptMakeLimitNode(); + pPhysiNode->pSlimit = qptMakeLimitNode(); + pPhysiNode->dynamicOp = qptGetDynamicOp(); + pPhysiNode->inputTsOrder = qptGetInputTsOrder(); + + assert(0 == createDataBlockDesc(qptCtx->buildCtx.pCxt, NULL, &pPhysiNode->pOutputDataBlockDesc)); + pPhysiNode->pOutputDataBlockDesc->precision = qptCtx->param.db.precision; + + return pPhysiNode; } -void createFilterEnd(SSortMergeJoinPhysiNode* p, bool filter) { - if (!filter || (jtCtx.leftFilterNum <= 0 && jtCtx.rightFilterNum <= 0)) { - return; +void qptPostCreatePhysiNode(SPhysiNode* pPhysiNode) { + pPhysiNode->outputTsOrder = qptGetInputTsOrder(); + + if (taosRand() % 2) { + pPhysiNode->pConditions = qptMakeConditionNode(false); } - SLogicConditionNode* pLogic = NULL; - if ((jtCtx.leftFilterNum + jtCtx.rightFilterNum) > 1) { - int32_t code = nodesMakeNode(QUERY_NODE_LOGIC_CONDITION, (SNode**)&pLogic); - assert(pLogic); - pLogic->node.resType.type = TSDB_DATA_TYPE_BOOL; - pLogic->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_BOOL].bytes; - pLogic->condType = LOGIC_COND_TYPE_AND; +} + +void qptMarkTableInUseCols(int32_t colNum, int32_t totalColNum, SQPTCol* pCol) { + if (colNum == totalColNum) { + for (int32_t i = 0; i < colNum; ++i) { + pCol[i].inUse = 1; + } + return; } - for (int32_t i = 0; i < MAX_SLOT_NUM; ++i) { - if (jtCtx.leftFilterColList[i]) { - SColumnNode* pCol = NULL; - int32_t code = nodesMakeNode(QUERY_NODE_COLUMN,(SNode**)&pCol); - assert(pCol); - pCol->dataBlockId = RES_BLK_ID; - pCol->slotId = getDstSlotId(i); - pCol->node.resType.type = jtInputColType[i]; - pCol->node.resType.bytes = tDataTypes[jtInputColType[i]].bytes; - (void)sprintf(pCol->colName, "l%d", i); - - SValueNode* pVal = NULL; - code = nodesMakeNode(QUERY_NODE_VALUE, (SNode**)&pVal); - assert(pVal); - pVal->node.resType.type = jtInputColType[i]; - pVal->node.resType.bytes = tDataTypes[jtInputColType[i]].bytes; - assert(0 == nodesSetValueNodeValue(pVal, getFilterValue(jtInputColType[i]))); - - SOperatorNode* pOp = NULL; - code = nodesMakeNode(QUERY_NODE_OPERATOR, (SNode**)&pOp); - assert(pOp); - pOp->opType = OP_TYPE_GREATER_THAN; - pOp->node.resType.type = TSDB_DATA_TYPE_BOOL; - pOp->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_BOOL].bytes; - pOp->pLeft = (SNode*)pCol; - pOp->pRight = (SNode*)pVal; - - if ((jtCtx.leftFilterNum + jtCtx.rightFilterNum) > 1) { - assert(0 == nodesListMakeStrictAppend(&pLogic->pParameterList, (SNode*)pOp)); - } else { - p->node.pConditions = (SNode*)pOp; - break; - } + int32_t colInUse = 0; + do { + int32_t colIdx = taosRand() % totalColNum; + if (pCol[colIdx].inUse) { + continue; } - } - for (int32_t i = 0; i < MAX_SLOT_NUM; ++i) { - if (jtCtx.rightFilterColList[i]) { - SColumnNode* pCol = NULL; - int32_t code = nodesMakeNode(QUERY_NODE_COLUMN, (SNode**)&pCol); - assert(pCol); - pCol->dataBlockId = RES_BLK_ID; - pCol->slotId = getDstSlotId(MAX_SLOT_NUM + i); - pCol->node.resType.type = jtInputColType[i]; - pCol->node.resType.bytes = tDataTypes[jtInputColType[i]].bytes; - (void)sprintf(pCol->colName, "r%d", i); - - SValueNode* pVal = NULL; - code = nodesMakeNode(QUERY_NODE_VALUE, (SNode**)&pVal); - assert(pVal); - pVal->node.resType.type = jtInputColType[i]; - pVal->node.resType.bytes = tDataTypes[jtInputColType[i]].bytes; - assert(0 == nodesSetValueNodeValue(pVal, getFilterValue(jtInputColType[i]))); - - SOperatorNode* pOp = NULL; - code = nodesMakeNode(QUERY_NODE_OPERATOR, (SNode**)&pOp); - assert(pOp); - pOp->opType = OP_TYPE_GREATER_THAN; - pOp->node.resType.type = TSDB_DATA_TYPE_BOOL; - pOp->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_BOOL].bytes; - pOp->pLeft = (SNode*)pCol; - pOp->pRight = (SNode*)pVal; - - if ((jtCtx.leftFilterNum + jtCtx.rightFilterNum) > 1) { - assert(0 == nodesListMakeStrictAppend(&pLogic->pParameterList, (SNode*)pOp)); - } else { - p->node.pConditions = (SNode*)pOp; - break; + pCol[colIdx].inUse = 1; + colInUse++; + } while (colInUse < colNum); +} + +void qptCreateTableScanColsImpl( SScanPhysiNode* pScanPhysiNode, SNodeList** ppCols, int32_t totalColNum, SQPTCol* pCol) { + int32_t colNum = qptCtx->pCfg->correctExpected ? (taosRand() % totalColNum + 1) : (taosRand()); + int32_t colAdded = 0; + + if (qptCtx->pCfg->correctExpected) { + qptMarkTableInUseCols(colNum, totalColNum, pCol); + for (int32_t i = 0; i < totalColNum && colAdded < colNum; ++i) { + if (0 == pCol[i].inUse) { + continue; } + + assert(0 == nodesListMakeStrictAppend(ppCols, qptMakeColumnNodeFromTable(i, pCol[i].colType, pScanPhysiNode))); } - } - if ((jtCtx.leftFilterNum + jtCtx.rightFilterNum) > 1) { - p->node.pConditions = (SNode*)pLogic; - } + return; + } + + for (int32_t i = 0; i < colNum; ++i) { + int32_t colIdx = taosRand(); + colIdx = (colIdx >= totalColNum) ? -1 : colIdx; + + assert(0 == nodesListMakeStrictAppend(ppCols, qptMakeColumnNodeFromTable(colIdx, pCol[i].colType, pScanPhysiNode))); + } } -void updateColRowInfo() { - jtCtx.blkRowSize = MAX_SLOT_NUM * sizeof(bool); +void qptCreateTableScanCols( SScanPhysiNode* pScanPhysiNode) { + qptCreateTableScanColsImpl(pScanPhysiNode, &pScanPhysiNode->pScanCols, qptCtx->param.tbl.colNum, qptCtx.param->tbl.pCol); +} - for (int32_t i = 0; i < MAX_SLOT_NUM; ++i) { - jtCtx.colRowOffset[i] = jtCtx.blkRowSize; - jtCtx.blkRowSize += tDataTypes[jtInputColType[i]].bytes; - } +void qptCreateTableScanPseudoCols( SScanPhysiNode* pScanPhysiNode) { + qptCreateTableScanColsImpl(pScanPhysiNode, &pScanPhysiNode->pScanPseudoCols, qptCtx->param.tbl.tagNum, qptCtx->param.tbl.pTag); } -void createBlockDescNode(SDataBlockDescNode** ppNode) { - SDataBlockDescNode* pDesc = NULL; - int32_t code = nodesMakeNode(QUERY_NODE_DATABLOCK_DESC, (SNode**)&pDesc); - assert(pDesc); - pDesc->dataBlockId = RES_BLK_ID; - pDesc->totalRowSize = jtCtx.resColSize - MAX_SLOT_NUM * 2 * sizeof(bool); - pDesc->outputRowSize = pDesc->totalRowSize; - for (int32_t i = 0; i < jtCtx.resColNum; ++i) { - SSlotDescNode* pSlot = NULL; - int32_t code = nodesMakeNode(QUERY_NODE_SLOT_DESC, (SNode**)&pSlot); - assert(pSlot); - pSlot->slotId = i; - int32_t slotIdx = jtCtx.resColInSlot[i] >= MAX_SLOT_NUM ? jtCtx.resColInSlot[i] - MAX_SLOT_NUM : jtCtx.resColInSlot[i]; - pSlot->dataType.type = jtInputColType[slotIdx]; - pSlot->dataType.bytes = tDataTypes[pSlot->dataType.type].bytes; - - assert(0 == nodesListMakeStrictAppend(&pDesc->pSlots, (SNode *)pSlot)); - } - *ppNode = pDesc; -} +void qptCreateScanPhysiNodeImpl( SScanPhysiNode* pScanPhysiNode) { + qptCreateTableScanCols(pScanPhysiNode); -SSortMergeJoinPhysiNode* createDummySortMergeJoinPhysiNode(SJoinTestParam* param) { - SSortMergeJoinPhysiNode* p = NULL; - int32_t code = nodesMakeNode(QUERY_NODE_PHYSICAL_PLAN_MERGE_JOIN, (SNode**)&p); - assert(p); + assert(0 == addDataBlockSlots(qptCtx->buildCtx.pCxt, pScanPhysiNode->pScanCols, pScanPhysiNode->node.pOutputDataBlockDesc)); + + if (taosRand() % 2) { + qptCreateTableScanPseudoCols(pScanPhysiNode); + } + + assert(0 == addDataBlockSlots(qptCtx->buildCtx.pCxt, pScanPhysiNode->pScanPseudoCols, pScanPhysiNode->node.pOutputDataBlockDesc)); + + pScanPhysiNode->uid = qptCtx->param.tbl.uid; + pScanPhysiNode->suid = qptCtx->param.tbl.suid; + pScanPhysiNode->tableType = qptCtx->param.tbl.tblType; + pScanPhysiNode->groupOrderScan = (taosRand() % 2) : true : false; + + SName tblName = {0}; + toName(1, qptCtx->param.db.dbName, qptCtx->param.tbl.tblName, &tblName); + memcpy(&pScanPhysiNode->tableName, &tblName, sizeof(SName)); +} + + + +STagScanPhysiNode* qptCreateTagScanPhysiNode(int32_t nodeType) { + SPhysiNode* pPhysiNode = qptCreatePhysiNode(nodeType); + assert(pPhysiNode); + + STagScanPhysiNode* pTagScanNode = (STagScanPhysiNode*)pPhysiNode; + pTagScanNode->onlyMetaCtbIdx = (taosRand() % 2) : true : false; + + qptCreateScanPhysiNodeImpl(&pTagScanNode->scan); + + qptPostCreatePhysiNode(pPhysiNode); + + return pPhysiNode; +} + + +SSortMergeJoinPhysiNode* qptCreateSortMergeJoinPhysiNode(int32_t nodeType) { + SPhysiNode* pPhysiNode = qptCreatePhysiNode(nodeType); + assert(pPhysiNode); + + SSortMergeJoinPhysiNode* p = (SSortMergeJoinPhysiNode*)pPhysiNode; + +/* p->joinType = param->joinType; p->subType = param->subType; p->asofOpType = param->asofOp; @@ -915,2862 +911,210 @@ SSortMergeJoinPhysiNode* createDummySortMergeJoinPhysiNode(SJoinTestParam* param createFilterEnd(p, param->filter); updateColRowInfo(); createBlockDescNode(&p->node.pOutputDataBlockDesc); - - return p; -} - -SExecTaskInfo* createDummyTaskInfo(char* taskId) { - SExecTaskInfo* p = (SExecTaskInfo*)taosMemoryCalloc(1, sizeof(SExecTaskInfo)); - assert(p); - p->id.str = taskId; - - return p; -} - -SSDataBlock* createDummyBlock(int32_t blkId) { - SSDataBlock* p = NULL; - int32_t code = createDataBlock(&p); - assert(code == 0); - - p->info.id.blockId = blkId; - p->info.type = STREAM_INVALID; - p->info.calWin.skey = INT64_MIN; - p->info.calWin.ekey = INT64_MAX; - p->info.watermark = INT64_MIN; - - for (int32_t i = 0; i < MAX_SLOT_NUM; ++i) { - SColumnInfoData idata = - createColumnInfoData(jtInputColType[i], tDataTypes[jtInputColType[i]].bytes, i); - - assert(0 == blockDataAppendColInfo(p, &idata)); +*/ + + return pPhysiNode; +} + +SPhysiNode* qptCreatePhysicalPlanNode(int32_t nodeType) { + switch (nodeType) { + case QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN: + return qptCreateTagScanPhysiNode(nodeType); + case QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN: + case QUERY_NODE_PHYSICAL_PLAN_TABLE_SEQ_SCAN: + case QUERY_NODE_PHYSICAL_PLAN_TABLE_MERGE_SCAN: + case QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN: + case QUERY_NODE_PHYSICAL_PLAN_SYSTABLE_SCAN: + case QUERY_NODE_PHYSICAL_PLAN_BLOCK_DIST_SCAN: + case QUERY_NODE_PHYSICAL_PLAN_LAST_ROW_SCAN: + case QUERY_NODE_PHYSICAL_PLAN_PROJECT: + case QUERY_NODE_PHYSICAL_PLAN_MERGE_JOIN: + return qptCreateSortMergeJoinPhysiNode(nodeType); + case QUERY_NODE_PHYSICAL_PLAN_HASH_AGG: + case QUERY_NODE_PHYSICAL_PLAN_EXCHANGE: + case QUERY_NODE_PHYSICAL_PLAN_MERGE: + case QUERY_NODE_PHYSICAL_PLAN_SORT: + case QUERY_NODE_PHYSICAL_PLAN_GROUP_SORT: + case QUERY_NODE_PHYSICAL_PLAN_HASH_INTERVAL: + case QUERY_NODE_PHYSICAL_PLAN_MERGE_INTERVAL: + case QUERY_NODE_PHYSICAL_PLAN_MERGE_ALIGNED_INTERVAL: + case QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL: + case QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL: + case QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL: + case QUERY_NODE_PHYSICAL_PLAN_FILL: + case QUERY_NODE_PHYSICAL_PLAN_STREAM_FILL: + case QUERY_NODE_PHYSICAL_PLAN_MERGE_SESSION: + case QUERY_NODE_PHYSICAL_PLAN_STREAM_SESSION: + case QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_SESSION: + case QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_SESSION: + case QUERY_NODE_PHYSICAL_PLAN_MERGE_STATE: + case QUERY_NODE_PHYSICAL_PLAN_STREAM_STATE: + case QUERY_NODE_PHYSICAL_PLAN_PARTITION: + case QUERY_NODE_PHYSICAL_PLAN_STREAM_PARTITION: + case QUERY_NODE_PHYSICAL_PLAN_INDEF_ROWS_FUNC: + case QUERY_NODE_PHYSICAL_PLAN_INTERP_FUNC: + case QUERY_NODE_PHYSICAL_PLAN_DISPATCH: + case QUERY_NODE_PHYSICAL_PLAN_INSERT: + case QUERY_NODE_PHYSICAL_PLAN_QUERY_INSERT: + case QUERY_NODE_PHYSICAL_PLAN_DELETE: + case QUERY_NODE_PHYSICAL_SUBPLAN: + case QUERY_NODE_PHYSICAL_PLAN: + case QUERY_NODE_PHYSICAL_PLAN_TABLE_COUNT_SCAN: + case QUERY_NODE_PHYSICAL_PLAN_MERGE_EVENT: + case QUERY_NODE_PHYSICAL_PLAN_STREAM_EVENT: + case QUERY_NODE_PHYSICAL_PLAN_HASH_JOIN: + case QUERY_NODE_PHYSICAL_PLAN_GROUP_CACHE: + case QUERY_NODE_PHYSICAL_PLAN_DYN_QUERY_CTRL: + case QUERY_NODE_PHYSICAL_PLAN_MERGE_COUNT: + case QUERY_NODE_PHYSICAL_PLAN_STREAM_COUNT: + case QUERY_NODE_PHYSICAL_PLAN_STREAM_MID_INTERVAL: + default: + assert(0); } - return p; + return 0; } -void appendAsofLeftEachResGrps(char* leftInRow, int32_t rightOffset, int32_t rightRows) { - TAOS_MEMSET(jtCtx.resColBuf, 0, jtCtx.resColSize); - for (int32_t c = 0; c < MAX_SLOT_NUM; ++c) { - if (!jtCtx.resColList[c]) { - continue; - } - - if (*((bool*)leftInRow + c)) { - *(char*)(jtCtx.resColBuf + c) = true; - } else { - TAOS_MEMCPY(jtCtx.resColBuf + jtCtx.resColOffset[c], leftInRow + jtCtx.inColOffset[c], tDataTypes[jtInputColType[c]].bytes); - } - } +int32_t qptCreateQueryPlan(SNode** ppPlan) { - int32_t endIdx = TMIN(rightRows, taosArrayGetSize(jtCtx.rightRowsList) - rightOffset) + rightOffset; - for (int32_t r = rightOffset; r < endIdx; ++r) { - bool* rightFilterOut = (bool*)taosArrayGet(jtCtx.rightFilterOut, r); - if (*rightFilterOut) { - continue; - } - - char* rightResRows = (char*)taosArrayGet(jtCtx.rightRowsList, r); - for (int32_t c = 0; c < MAX_SLOT_NUM; ++c) { - if (jtCtx.resColList[MAX_SLOT_NUM + c]) { - if (*(bool*)(rightResRows + c)) { - *(bool*)(jtCtx.resColBuf + MAX_SLOT_NUM + c) = true; - TAOS_MEMSET(jtCtx.resColBuf + jtCtx.resColOffset[MAX_SLOT_NUM + c], 0, tDataTypes[jtInputColType[c]].bytes); - } else { - *(bool*)(jtCtx.resColBuf + MAX_SLOT_NUM + c) = false; - TAOS_MEMCPY(jtCtx.resColBuf + jtCtx.resColOffset[MAX_SLOT_NUM + c], rightResRows + jtCtx.inColOffset[c], tDataTypes[jtInputColType[c]].bytes); - } - } - } - - pushResRow(jtCtx.resColBuf, jtCtx.resColSize); - } } -void appendLeftNonMatchGrp(char* leftInRow) { - if (!jtCtrl.noKeepResRows) { - TAOS_MEMSET(jtCtx.resColBuf, 0, jtCtx.resColSize); - for (int32_t c = 0; c < MAX_SLOT_NUM; ++c) { - if (!jtCtx.resColList[c]) { - continue; - } - - if (*((bool*)leftInRow + c)) { - *(char*)(jtCtx.resColBuf + c) = true; - } else { - TAOS_MEMCPY(jtCtx.resColBuf + jtCtx.resColOffset[c], leftInRow + jtCtx.inColOffset[c], tDataTypes[jtInputColType[c]].bytes); - } - } - - for (int32_t c = 0; c < MAX_SLOT_NUM; ++c) { - if (jtCtx.resColList[MAX_SLOT_NUM + c]) { - *(char*)(jtCtx.resColBuf + MAX_SLOT_NUM + c) = true; - } - } - } - - pushResRow(jtCtx.resColBuf, jtCtx.resColSize); -} -void appendAllAsofResRows() { - int32_t leftRows = taosArrayGetSize(jtCtx.leftRowsList); - int32_t rightRows = taosArrayGetSize(jtCtx.rightRowsList); - if (rightRows <= 0) { - if (0 == jtCtx.rightFilterNum) { - for (int32_t i = 0; i < leftRows; ++i) { - char* leftInRow = (char*)taosArrayGet(jtCtx.leftRowsList, i); - assert(leftInRow); - appendLeftNonMatchGrp(leftInRow); - } - } - } else { - assert(rightRows <= jtCtx.jLimit); - for (int32_t i = 0; i < leftRows; ++i) { - char* leftInRow = (char*)taosArrayGet(jtCtx.leftRowsList, i); - assert(leftInRow); - appendAsofLeftEachResGrps(leftInRow, 0, rightRows); - } +void qptRerunBlockedHere() { + while (qptInRerun) { + taosSsleep(1); } - taosArrayClear(jtCtx.leftRowsList); } -void chkAppendAsofForwardGrpResRows(bool forceOut) { - int32_t rightRows = taosArrayGetSize(jtCtx.rightRowsList); - if (rightRows < jtCtx.jLimit && !forceOut) { - return; - } - - int32_t rightRemains = rightRows; - int32_t rightOffset = 0; - int32_t leftRows = taosArrayGetSize(jtCtx.leftRowsList); - int32_t i = 0; - for (; i < leftRows; ++i) { - char* leftRow = (char*)taosArrayGet(jtCtx.leftRowsList, i); - assert(leftRow); - int64_t* leftTs = (int64_t*)(leftRow + jtCtx.inColOffset[JT_PRIM_TS_SLOT_ID]); - bool append = false; - for (int32_t r = rightOffset; r < rightRows; ++r) { - char* rightRow = (char*)taosArrayGet(jtCtx.rightRowsList, r); - assert(rightRow); - int64_t* rightTs = (int64_t*)(rightRow + jtCtx.inColOffset[JT_PRIM_TS_SLOT_ID]); - if (((jtCtx.asc && *leftTs > *rightTs) || (!jtCtx.asc && *leftTs < *rightTs)) || (*leftTs == *rightTs && (OP_TYPE_LOWER_THAN == jtCtx.asofOpType || OP_TYPE_GREATER_THAN == jtCtx.asofOpType))) { - rightOffset++; - rightRemains--; - if (rightRemains < jtCtx.jLimit && !forceOut) { - taosArrayPopFrontBatch(jtCtx.rightRowsList, rightOffset); - taosArrayPopFrontBatch(jtCtx.rightFilterOut, rightOffset); - taosArrayPopFrontBatch(jtCtx.leftRowsList, i); - return; - } - - continue; - } - - appendAsofLeftEachResGrps(leftRow, rightOffset, jtCtx.jLimit); - append = true; - break; - } - - if (!append) { - if (!forceOut) { - break; - } - - if (0 == jtCtx.rightFilterNum) { - appendLeftNonMatchGrp(leftRow); - } - } - } +void qptResetForReRun() { - taosArrayPopFrontBatch(jtCtx.rightRowsList, rightOffset); - taosArrayPopFrontBatch(jtCtx.rightFilterOut, rightOffset); - taosArrayPopFrontBatch(jtCtx.leftRowsList, i); } +void qptSingleTestDone(bool* contLoop) { + destroyOperator(jtCtx.pJoinOp); + jtCtx.pJoinOp = NULL; -void appendWinEachResGrps(char* leftInRow, int32_t rightOffset, int32_t rightRows) { - if (rightOffset < 0) { - if (0 == jtCtx.rightFilterNum) { - appendLeftNonMatchGrp(leftInRow); - } + if (jtRes.succeed) { + *contLoop = false; return; } - TAOS_MEMSET(jtCtx.resColBuf, 0, jtCtx.resColSize); - for (int32_t c = 0; c < MAX_SLOT_NUM; ++c) { - if (!jtCtx.resColList[c]) { - continue; - } - - if (*((bool*)leftInRow + c)) { - *(char*)(jtCtx.resColBuf + c) = true; - } else { - TAOS_MEMCPY(jtCtx.resColBuf + jtCtx.resColOffset[c], leftInRow + jtCtx.inColOffset[c], tDataTypes[jtInputColType[c]].bytes); - } - } - - int32_t endIdx = rightRows + rightOffset; - int32_t beginIdx = (!jtCtx.asc && rightRows > jtCtx.jLimit) ? (endIdx - jtCtx.jLimit) : rightOffset; - for (int32_t r = beginIdx; r < endIdx; ++r) { - bool* rightFilterOut = (bool*)taosArrayGet(jtCtx.rightFilterOut, r); - if (*rightFilterOut) { - continue; - } - - char* rightResRows = (char*)taosArrayGet(jtCtx.rightRowsList, r); - assert(rightResRows); - for (int32_t c = 0; c < MAX_SLOT_NUM; ++c) { - if (jtCtx.resColList[MAX_SLOT_NUM + c]) { - if (*(bool*)(rightResRows + c)) { - *(bool*)(jtCtx.resColBuf + MAX_SLOT_NUM + c) = true; - TAOS_MEMSET(jtCtx.resColBuf + jtCtx.resColOffset[MAX_SLOT_NUM + c], 0, tDataTypes[jtInputColType[c]].bytes); - } else { - *(bool*)(jtCtx.resColBuf + MAX_SLOT_NUM + c) = false; - TAOS_MEMCPY(jtCtx.resColBuf + jtCtx.resColOffset[MAX_SLOT_NUM + c], rightResRows + jtCtx.inColOffset[c], tDataTypes[jtInputColType[c]].bytes); - } - } - } - - pushResRow(jtCtx.resColBuf, jtCtx.resColSize); - } -} - -void chkAppendWinResRows(bool forceOut) { - int32_t rightRows = taosArrayGetSize(jtCtx.rightRowsList); - if (rightRows < jtCtx.jLimit && !forceOut) { + if (jtErrorRerun) { + *contLoop = false; return; } - int32_t rightRemains = rightRows; - int32_t rightOffset = 0; - int32_t leftRows = taosArrayGetSize(jtCtx.leftRowsList); - int32_t i = 0; - for (; i < leftRows; ++i) { - char* leftRow = (char*)taosArrayGet(jtCtx.leftRowsList, i); - assert(leftRow); - int64_t* leftTs = (int64_t*)(leftRow + jtCtx.inColOffset[JT_PRIM_TS_SLOT_ID]); - int64_t winStart = *leftTs + jtCtx.winStartOffset; - int64_t winEnd = *leftTs + jtCtx.winEndOffset; - int32_t winBeginIdx = -1; - bool append = false; - bool winClosed = false; - for (int32_t r = rightOffset; r < rightRows; ++r) { - char* rightRow = (char*)taosArrayGet(jtCtx.rightRowsList, r); - assert(rightRow); - int64_t* rightTs = (int64_t*)(rightRow + jtCtx.inColOffset[JT_PRIM_TS_SLOT_ID]); - if ((jtCtx.asc && *rightTs < winStart) || (!jtCtx.asc && *rightTs > winEnd)) { - rightOffset++; - rightRemains--; - if (rightRemains < jtCtx.jLimit && !forceOut) { - taosArrayPopFrontBatch(jtCtx.rightRowsList, rightOffset); - taosArrayPopFrontBatch(jtCtx.rightFilterOut, rightOffset); - taosArrayPopFrontBatch(jtCtx.leftRowsList, i); - return; - } - - continue; - } else if ((jtCtx.asc && *rightTs > winEnd) || (!jtCtx.asc && *rightTs < winStart)) { - winClosed = true; - appendWinEachResGrps(leftRow, winBeginIdx, r - winBeginIdx); - append = true; - break; - } + qptInRerun = true; +} - if (-1 == winBeginIdx) { - winBeginIdx = r; - } - if (jtCtx.asc && (r - winBeginIdx + 1) >= jtCtx.jLimit) { - appendWinEachResGrps(leftRow, winBeginIdx, jtCtx.jLimit); - append = true; - break; - } - } +void qptInitLogFile() { + const char *defaultLogFileNamePrefix = "queryPlanTestlog"; + const int32_t maxLogFileNum = 10; - if (!append) { - if (!forceOut) { - break; - } + tsAsyncLog = 0; + qDebugFlag = 159; + TAOS_STRCPY(tsLogDir, TD_LOG_DIR_PATH); - if (winBeginIdx >= 0) { - appendWinEachResGrps(leftRow, winBeginIdx, rightRows - winBeginIdx); - } else if (0 == jtCtx.rightFilterNum) { - appendLeftNonMatchGrp(leftRow); - } - } + if (taosInitLog(defaultLogFileNamePrefix, maxLogFileNum, false) < 0) { + printf("failed to open log file in directory:%s\n", tsLogDir); } - - taosArrayPopFrontBatch(jtCtx.rightRowsList, rightOffset); - taosArrayPopFrontBatch(jtCtx.rightFilterOut, rightOffset); - taosArrayPopFrontBatch(jtCtx.leftRowsList, i); } -void trimForAsofJlimit() { - int32_t rowNum = taosArrayGetSize(jtCtx.rightRowsList); - if (rowNum <= jtCtx.jLimit) { - return; - } - taosArrayPopFrontBatch(jtCtx.rightRowsList, rowNum - jtCtx.jLimit); - taosArrayPopFrontBatch(jtCtx.rightFilterOut, rowNum - jtCtx.jLimit); +void qptInitTest() { + qptInitLogFile(); } -void createGrpRows(SSDataBlock** ppBlk, int32_t blkId, int32_t grpRows) { - if (grpRows <= 0) { - return; - } - - if (NULL == *ppBlk) { - *ppBlk = createDummyBlock((blkId == LEFT_BLK_ID) ? LEFT_BLK_ID : RIGHT_BLK_ID); - assert(*ppBlk); - assert(0 == blockDataEnsureCapacity(*ppBlk, jtCtx.blkRows)); - assert(NULL != taosArrayPush((blkId == LEFT_BLK_ID) ? jtCtx.leftBlkList : jtCtx.rightBlkList, ppBlk)); - } - - if (jtCtx.grpJoin) { - (*ppBlk)->info.id.groupId = jtCtx.inGrpId; - } +void qptHandleTestEnd() { - jtCtx.inputStat |= (1 << blkId); +} - SArray* pTableRows = NULL; - int32_t tableOffset = 0; - int32_t peerOffset = 0; - bool keepRes = false; - bool keepInput = false; - if (blkId == LEFT_BLK_ID) { - if ((jtCtx.joinType == JOIN_TYPE_LEFT || jtCtx.joinType == JOIN_TYPE_FULL) && (jtCtx.subType != JOIN_STYPE_SEMI && jtCtx.subType != JOIN_STYPE_ASOF && jtCtx.subType != JOIN_STYPE_WIN)) { - keepRes = true; - } - peerOffset = MAX_SLOT_NUM; - } else { - if ((jtCtx.joinType == JOIN_TYPE_RIGHT || jtCtx.joinType == JOIN_TYPE_FULL) && (jtCtx.subType != JOIN_STYPE_SEMI && jtCtx.subType != JOIN_STYPE_ASOF && jtCtx.subType != JOIN_STYPE_WIN)) { - keepRes = true; - } - tableOffset = MAX_SLOT_NUM; - } +void qptRunPlanTest(char* caseName) { + SNode* pNode = NULL; + SReadHandle readHandle = {0}; + SOperatorInfo* pOperator = NULL; - if (JOIN_STYPE_ASOF == jtCtx.subType) { - keepInput = jtCtx.asofOpType != OP_TYPE_EQUAL ? true : (blkId == LEFT_BLK_ID); - pTableRows = (blkId == LEFT_BLK_ID) ? jtCtx.leftRowsList : jtCtx.rightRowsList; - } else if (JOIN_STYPE_WIN == jtCtx.subType) { - keepInput = true; - pTableRows = (blkId == LEFT_BLK_ID) ? jtCtx.leftRowsList : jtCtx.rightRowsList; - } - - int32_t filterNum = (blkId == LEFT_BLK_ID) ? jtCtx.leftFilterNum : jtCtx.rightFilterNum; - int32_t peerFilterNum = (blkId == LEFT_BLK_ID) ? jtCtx.rightFilterNum : jtCtx.leftFilterNum; - int32_t* filterCol = (blkId == LEFT_BLK_ID) ? jtCtx.leftFilterColList : jtCtx.rightFilterColList; - - char* pData = NULL; - int32_t tmpInt = 0; - int64_t tmpBigint = 0; - bool isNull = false; - bool filterOut = false; - bool addToRowList = false; - int32_t vRange = TMAX(grpRows / 3, 3); - for (int32_t c = 0; c < MAX_SLOT_NUM; ++c) { - jtCtx.grpOffset[c] = c * TMAX(100, grpRows); + if (qptCtx->param.plan.singlePhysiNode) { + pNode = (SNode*)qptCreatePhysicalPlanNode(qptCtx->param.plan.subplanType[0]); } - for (int32_t i = 0; i < grpRows; ++i) { - if ((*ppBlk)->info.rows >= (*ppBlk)->info.capacity) { - *ppBlk = createDummyBlock((blkId == LEFT_BLK_ID) ? LEFT_BLK_ID : RIGHT_BLK_ID); - assert(*ppBlk); - assert(0 == blockDataEnsureCapacity(*ppBlk, jtCtx.blkRows)); - assert(NULL != taosArrayPush((blkId == LEFT_BLK_ID) ? jtCtx.leftBlkList : jtCtx.rightBlkList, ppBlk)); - if (jtCtx.grpJoin) { - (*ppBlk)->info.id.groupId = jtCtx.inGrpId; - } - } - - filterOut = (peerFilterNum > 0 && (jtCtx.subType != JOIN_STYPE_ASOF && jtCtx.subType != JOIN_STYPE_WIN)) ? true : false; - if (!filterOut) { - TAOS_MEMSET(jtCtx.resColBuf, 0, jtCtx.resColSize); - if (keepInput) { - TAOS_MEMSET(jtCtx.inColBuf, 0, jtCtx.inColSize); - } - } - - addToRowList = true; - - for (int32_t c = 0; c < MAX_SLOT_NUM; ++c) { - switch (jtInputColType[c]) { - case TSDB_DATA_TYPE_TIMESTAMP: - jtCtx.asc ? ++jtCtx.curTs : --jtCtx.curTs; - pData = (char*)&jtCtx.curTs; - isNull = false; - if (!filterOut && filterNum && filterCol[c] && jtCtx.curTs <= TIMESTAMP_FILTER_VALUE) { - filterOut = true; - } - break; - case TSDB_DATA_TYPE_INT: - if (taosRand() % 10) { - tmpInt = (taosRand() % 2) ? INT_FILTER_VALUE + jtCtx.grpOffset[c] + taosRand() % vRange : INT_FILTER_VALUE - jtCtx.grpOffset[c] - taosRand() % vRange; - pData = (char*)&tmpInt; - isNull = false; - if (!filterOut && filterNum && filterCol[c] && tmpInt <= INT_FILTER_VALUE) { - filterOut = true; - } - } else { - isNull = true; - if (filterNum && filterCol[c]) { - filterOut = true; - } - } - break; - case TSDB_DATA_TYPE_BIGINT: - tmpBigint = (taosRand() % 2) ? BIGINT_FILTER_VALUE + jtCtx.curKeyOffset++ : BIGINT_FILTER_VALUE - jtCtx.curKeyOffset++; - pData = (char*)&tmpBigint; - isNull = false; - if (!filterOut && filterNum && filterCol[c] && tmpBigint <= BIGINT_FILTER_VALUE) { - filterOut = true; - } - break; - default: - break; - } - - SColumnInfoData* pCol = (SColumnInfoData*)taosArrayGet((*ppBlk)->pDataBlock, c); - assert(pCol); - assert(0 == colDataSetVal(pCol, (*ppBlk)->info.rows, pData, isNull)); - - if (keepInput) { - if (!filterOut || (blkId != LEFT_BLK_ID)) { - if (isNull) { - *(char*)(jtCtx.inColBuf + c) = true; - } else { - TAOS_MEMCPY(jtCtx.inColBuf + jtCtx.inColOffset[c], pData, tDataTypes[jtInputColType[c]].bytes); - } - } else { - addToRowList = false; - } - } else if (keepRes && !filterOut && jtCtx.resColList[tableOffset + c]) { - if (isNull) { - *(char*)(jtCtx.resColBuf + tableOffset + c) = true; - } else { - TAOS_MEMCPY(jtCtx.resColBuf + jtCtx.resColOffset[tableOffset + c], pData, tDataTypes[jtInputColType[c]].bytes); - } - } - } - - if (keepInput && addToRowList) { - assert(NULL != taosArrayPush(pTableRows, jtCtx.inColBuf)); - if (blkId == RIGHT_BLK_ID) { - bool fout = filterOut ? true : false; - assert(NULL != taosArrayPush(jtCtx.rightFilterOut, &fout)); - } - } - - if (keepRes && !filterOut) { - for (int32_t c = 0; c < MAX_SLOT_NUM; ++c) { - if (jtCtx.resColList[peerOffset + c]) { - *(char*)(jtCtx.resColBuf + peerOffset + c) = true; - } - } - - pushResRow(jtCtx.resColBuf, jtCtx.resColSize); - } - - (*ppBlk)->info.rows++; - } - - if (keepInput) { - if (JOIN_STYPE_ASOF == jtCtx.subType) { - if (((jtCtx.asc && (jtCtx.asofOpType == OP_TYPE_GREATER_EQUAL || jtCtx.asofOpType == OP_TYPE_GREATER_THAN)) || (!jtCtx.asc && (jtCtx.asofOpType == OP_TYPE_LOWER_EQUAL || jtCtx.asofOpType == OP_TYPE_LOWER_THAN)) ) || jtCtx.asofOpType == OP_TYPE_EQUAL) { - if (blkId == LEFT_BLK_ID) { - appendAllAsofResRows(); - } else { - trimForAsofJlimit(); - } - } else { - chkAppendAsofForwardGrpResRows(false); - } - } else { - chkAppendWinResRows(false); - } - } + qptPrintBeginInfo(caseName); -} + qptCtx.startTsUs = taosGetTimestampUs(); + int32_t code = createTagScanOperatorInfo(&readHandle, (STagScanPhysiNode*)pNode, NULL, NULL, NULL, NULL, &pOperator); -void createRowData(SSDataBlock* pBlk, int64_t tbOffset, int32_t rowIdx, int32_t vRange) { - int32_t tmpInt = 0; - int64_t tmpBig = 0; - - for (int32_t c = 0; c < MAX_SLOT_NUM; ++c) { - SColumnInfoData* pCol = (SColumnInfoData*)taosArrayGet(pBlk->pDataBlock, c); - assert(pCol); - - int32_t rv = taosRand() % 10; - switch (jtInputColType[c]) { - case TSDB_DATA_TYPE_TIMESTAMP: - *(int64_t*)(jtCtx.colRowDataBuf + tbOffset + rowIdx * jtCtx.blkRowSize + jtCtx.colRowOffset[c]) = jtCtx.curTs; - assert(0 == colDataSetVal(pCol, pBlk->info.rows, (char*)&jtCtx.curTs, false)); - break; - case TSDB_DATA_TYPE_INT: - if (rv) { - tmpInt = (taosRand() % 2) ? INT_FILTER_VALUE + jtCtx.grpOffset[c] + taosRand() % vRange : INT_FILTER_VALUE - taosRand() % vRange; - *(int32_t*)(jtCtx.colRowDataBuf + tbOffset + rowIdx * jtCtx.blkRowSize + jtCtx.colRowOffset[c]) = tmpInt; - assert(0 == colDataSetVal(pCol, pBlk->info.rows, (char*)&tmpInt, false)); - } else { - *(bool*)(jtCtx.colRowDataBuf + tbOffset + rowIdx * jtCtx.blkRowSize + c) = true; - assert(0 == colDataSetVal(pCol, pBlk->info.rows, NULL, true)); - } - break; - case TSDB_DATA_TYPE_BIGINT: - tmpBig = (taosRand() % 2) ? BIGINT_FILTER_VALUE + jtCtx.curKeyOffset++ : BIGINT_FILTER_VALUE - jtCtx.curKeyOffset++; - *(int64_t*)(jtCtx.colRowDataBuf + tbOffset + rowIdx * jtCtx.blkRowSize + jtCtx.colRowOffset[c]) = tmpBig; - assert(0 == colDataSetVal(pCol, pBlk->info.rows, (char*)&tmpBig, false)); - break; - default: - break; - } - } + destroyOperator(pOperator); + nodesDestroyNode((SNode*)pNode); - pBlk->info.rows++; + qptHandleTestEnd(); } -void makeAppendBlkData(SSDataBlock** ppLeft, SSDataBlock** ppRight, int32_t leftGrpRows, int32_t rightGrpRows) { - int64_t totalSize = (leftGrpRows + rightGrpRows) * jtCtx.blkRowSize; - int64_t rightOffset = leftGrpRows * jtCtx.blkRowSize; - - if (jtCtx.colRowDataBufSize < totalSize) { - jtCtx.colRowDataBuf = (char*)taosMemoryRealloc(jtCtx.colRowDataBuf, totalSize); - assert(jtCtx.colRowDataBuf); - } - - TAOS_MEMSET(jtCtx.colRowDataBuf, 0, totalSize); - - for (int32_t c = 0; c < MAX_SLOT_NUM; ++c) { - jtCtx.grpOffset[c] = c * TMAX(leftGrpRows, rightGrpRows); - } - - int32_t vRange = TMAX(leftGrpRows / 100, 3); - for (int32_t i = 0; i < leftGrpRows; ++i) { - if ((*ppLeft)->info.rows >= (*ppLeft)->info.capacity) { - *ppLeft = createDummyBlock(LEFT_BLK_ID); - assert(*ppLeft); - assert(0 == blockDataEnsureCapacity(*ppLeft, jtCtx.blkRows)); - assert(NULL != taosArrayPush(jtCtx.leftBlkList, ppLeft)); - if (jtCtx.grpJoin) { - (*ppLeft)->info.id.groupId = jtCtx.inGrpId; - } - } - - createRowData(*ppLeft, 0, i, vRange); - } - vRange = TMAX(rightGrpRows / 100, 3); - for (int32_t i = 0; i < rightGrpRows; ++i) { - if ((*ppRight)->info.rows >= (*ppRight)->info.capacity) { - *ppRight = createDummyBlock(RIGHT_BLK_ID); - assert(*ppRight); - assert(0 == blockDataEnsureCapacity(*ppRight, jtCtx.blkRows)); - assert(NULL != taosArrayPush(jtCtx.rightBlkList, ppRight)); - if (jtCtx.grpJoin) { - (*ppRight)->info.id.groupId = jtCtx.inGrpId; - } - } - createRowData(*ppRight, rightOffset, i, vRange); - } +SQPTNodeParam* qptInitNodeParam(int32_t nodeType) { } -void putNMatchRowToRes(char* lrow, int32_t tableOffset, int32_t peerOffset) { - if (!jtCtrl.noKeepResRows) { - TAOS_MEMSET(jtCtx.resColBuf, 0, jtCtx.resColSize); - - for (int32_t c = 0; c < MAX_SLOT_NUM; ++c) { - if (jtCtx.resColList[tableOffset + c]) { - if (*(bool*)(lrow + c)) { - *(bool*)(jtCtx.resColBuf + tableOffset + c) = true; - } else { - TAOS_MEMCPY(jtCtx.resColBuf + jtCtx.resColOffset[tableOffset + c], lrow + jtCtx.colRowOffset[c], tDataTypes[jtInputColType[c]].bytes); - } - } - } - - for (int32_t c = 0; c < MAX_SLOT_NUM; ++c) { - if (jtCtx.resColList[peerOffset + c]) { - *(bool*)(jtCtx.resColBuf + peerOffset + c) = true; - } +void qptInitTestCtx(bool correctExpected, bool singleNode, int32_t nodeType, int32_t paramNum, SQPTNodeParam* nodeParam) { + qptCtx->param.correctExpected = correctExpected; + qptCtx->param.plan.singlePhysiNode = singleNode; + if (singleNode) { + qptCtx->param.plan.subplanMaxLevel = 1; + qptCtx->param.plan.subplanType[0] = nodeType; + } else { + qptCtx->param.plan.subplanMaxLevel = taosRand() % QPT_MAX_SUBPLAN_LEVEL + 1; + for (int32_t i = 0; i < qptCtx->param.plan.subplanMaxLevel; ++i) { + qptCtx->param.plan.subplanType[i] = QPT_PHYSIC_NODE_LIST[taosRand() % QPT_PHYSIC_NODE_NUM()]; } } - - pushResRow(jtCtx.resColBuf, jtCtx.resColSize); -} -void putMatchRowToRes(char* lrow, char* rrow, int32_t cols) { - if (!jtCtrl.noKeepResRows) { - TAOS_MEMSET(jtCtx.resColBuf, 0, jtCtx.resColSize); - - if (cols & LEFT_TABLE_COLS) { - for (int32_t c = 0; c < MAX_SLOT_NUM; ++c) { - if (jtCtx.resColList[c]) { - if (*(bool*)(lrow + c)) { - *(bool*)(jtCtx.resColBuf + c) = true; - } else { - TAOS_MEMCPY(jtCtx.resColBuf + jtCtx.resColOffset[c], lrow + jtCtx.colRowOffset[c], tDataTypes[jtInputColType[c]].bytes); - } - } - } - } - - if (cols & RIGHT_TABLE_COLS) { - for (int32_t c = 0; c < MAX_SLOT_NUM; ++c) { - if (jtCtx.resColList[MAX_SLOT_NUM + c]) { - if (*(bool*)(rrow + c)) { - *(bool*)(jtCtx.resColBuf + MAX_SLOT_NUM + c) = true; - } else { - TAOS_MEMCPY(jtCtx.resColBuf + jtCtx.resColOffset[MAX_SLOT_NUM + c], rrow + jtCtx.colRowOffset[c], tDataTypes[jtInputColType[c]].bytes); - } - } - } - } + if (paramNum > 0) { + qptCtx->param.plan.physiNodeParamNum = paramNum; + qptCtx->param.plan.physicNodeParam = nodeParam; } - - pushResRow(jtCtx.resColBuf, jtCtx.resColSize); } +} // namespace -void innerJoinAppendEqGrpRes(int32_t leftGrpRows, int32_t rightGrpRows) { - bool leftMatch = false, rightMatch = false, filterOut = false; - void* lValue = NULL, *rValue = NULL, *filterValue = NULL; - int64_t lBig = 0, rBig = 0, fbig = 0; - int64_t rightTbOffset = jtCtx.blkRowSize * leftGrpRows; - - for (int32_t l = 0; l < leftGrpRows; ++l) { - char* lrow = jtCtx.colRowDataBuf + jtCtx.blkRowSize * l; - - filterOut = false; - leftMatch = true; - - for (int32_t c = 0; c < MAX_SLOT_NUM; ++c) { - lValue = lrow + jtCtx.colRowOffset[c]; - switch (jtInputColType[c]) { - case TSDB_DATA_TYPE_TIMESTAMP: - fbig = TIMESTAMP_FILTER_VALUE; - lBig = *(int64_t*)lValue; - break; - case TSDB_DATA_TYPE_INT: - fbig = INT_FILTER_VALUE; - lBig = *(int32_t*)lValue; - break; - case TSDB_DATA_TYPE_BIGINT: - fbig = BIGINT_FILTER_VALUE; - lBig = *(int64_t*)lValue; - break; - default: - break; - } - - if (jtCtx.leftFilterNum && jtCtx.leftFilterColList[c] && ((*(bool*)(lrow + c)) || lBig <= fbig)) { - filterOut = true; - break; - } - - if (jtCtx.colEqNum && jtCtx.colEqList[c] && (*(bool*)(lrow + c))) { - leftMatch = false; - break; - } - - if (jtCtx.colOnNum && jtCtx.colOnList[c] && (*(bool*)(lrow + c))) { - leftMatch = false; - break; - } - } - - if (filterOut || !leftMatch) { - continue; - } - - for (int32_t r = 0; r < rightGrpRows; ++r) { - char* rrow = jtCtx.colRowDataBuf + rightTbOffset + jtCtx.blkRowSize * r; - rightMatch = true; - filterOut = false; - - for (int32_t c = 0; c < MAX_SLOT_NUM; ++c) { - lValue = lrow + jtCtx.colRowOffset[c]; - - if (!*(bool*)(rrow + c)) { - rValue = rrow + jtCtx.colRowOffset[c]; - } - - switch (jtInputColType[c]) { - case TSDB_DATA_TYPE_TIMESTAMP: - fbig = TIMESTAMP_FILTER_VALUE; - lBig = *(int64_t*)lValue; - rBig = *(int64_t*)rValue; - break; - case TSDB_DATA_TYPE_INT: - fbig = INT_FILTER_VALUE; - lBig = *(int32_t*)lValue; - rBig = *(int32_t*)rValue; - break; - case TSDB_DATA_TYPE_BIGINT: - fbig = BIGINT_FILTER_VALUE; - lBig = *(int64_t*)lValue; - rBig = *(int64_t*)rValue; - break; - default: - break; - } - - if (jtCtx.colEqNum && jtCtx.colEqList[c] && ((*(bool*)(rrow + c)) || lBig != rBig)) { - rightMatch = false; - break; - } - - if (jtCtx.colOnNum && jtCtx.colOnList[c] && ((*(bool*)(rrow + c)) || lBig <= rBig)) { - rightMatch = false; - break; - } - - if (jtCtx.rightFilterNum && jtCtx.rightFilterColList[c] && ((*(bool*)(rrow + c)) || rBig <= fbig)) { - filterOut = true; - break; - } - } - - if (filterOut || !rightMatch) { - continue; - } +#if 1 +#if 1 +TEST(correctSingleNodeTest, tagScan) { + char* caseName = "correctSingleNodeTest:tagScan"; - putMatchRowToRes(lrow, rrow, ALL_TABLE_COLS); - } - } + qptInitTestCtx(true, true, QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN, 0, NULL); + for (qptCtx.loopIdx = 0; qptCtx.loopIdx < QPT_MAX_LOOP; ++qptCtx.loopIdx) { + qptRunPlanTest(caseName); + } + qptPrintStatInfo(caseName); } +#endif +#if 0 +TEST(randSingleNodeTest, tagScan) { + char* caseName = "randSingleNodeTest:tagScan"; - -void leftJoinAppendEqGrpRes(int32_t leftGrpRows, int32_t rightGrpRows) { - bool leftMatch = false, rightMatch = false, filterOut = false; - void* lValue = NULL, *rValue = NULL, *filterValue = NULL; - int64_t lBig = 0, rBig = 0, fbig = 0; - int64_t rightTbOffset = jtCtx.blkRowSize * leftGrpRows; + qptInitTestCtx(false, true, QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN, 0, NULL); - for (int32_t l = 0; l < leftGrpRows; ++l) { - char* lrow = jtCtx.colRowDataBuf + jtCtx.blkRowSize * l; - - filterOut = false; - leftMatch = true; - - for (int32_t c = 0; c < MAX_SLOT_NUM; ++c) { - lValue = lrow + jtCtx.colRowOffset[c]; - switch (jtInputColType[c]) { - case TSDB_DATA_TYPE_TIMESTAMP: - fbig = TIMESTAMP_FILTER_VALUE; - lBig = *(int64_t*)lValue; - break; - case TSDB_DATA_TYPE_INT: - fbig = INT_FILTER_VALUE; - lBig = *(int32_t*)lValue; - break; - case TSDB_DATA_TYPE_BIGINT: - fbig = BIGINT_FILTER_VALUE; - lBig = *(int64_t*)lValue; - break; - default: - break; - } - - if (jtCtx.leftFilterNum && jtCtx.leftFilterColList[c] && ((*(bool*)(lrow + c)) || lBig <= fbig)) { - filterOut = true; - break; - } - - if (jtCtx.colEqNum && jtCtx.colEqList[c] && (*(bool*)(lrow + c))) { - leftMatch = false; - } - - if (jtCtx.colOnNum && jtCtx.colOnList[c] && (*(bool*)(lrow + c))) { - leftMatch = false; - } - } - - if (filterOut) { - continue; - } - - if (false == leftMatch) { - if (0 == jtCtx.rightFilterNum) { - putNMatchRowToRes(lrow, 0, MAX_SLOT_NUM); - } - continue; - } - - leftMatch = false; - for (int32_t r = 0; r < rightGrpRows; ++r) { - char* rrow = jtCtx.colRowDataBuf + rightTbOffset + jtCtx.blkRowSize * r; - rightMatch = true; - filterOut = false; - - for (int32_t c = 0; c < MAX_SLOT_NUM; ++c) { - lValue = lrow + jtCtx.colRowOffset[c]; - - if (!*(bool*)(rrow + c)) { - rValue = rrow + jtCtx.colRowOffset[c]; - } - - switch (jtInputColType[c]) { - case TSDB_DATA_TYPE_TIMESTAMP: - fbig = TIMESTAMP_FILTER_VALUE; - lBig = *(int64_t*)lValue; - rBig = *(int64_t*)rValue; - break; - case TSDB_DATA_TYPE_INT: - fbig = INT_FILTER_VALUE; - lBig = *(int32_t*)lValue; - rBig = *(int32_t*)rValue; - break; - case TSDB_DATA_TYPE_BIGINT: - fbig = BIGINT_FILTER_VALUE; - lBig = *(int64_t*)lValue; - rBig = *(int64_t*)rValue; - break; - default: - break; - } - - if (jtCtx.colEqNum && jtCtx.colEqList[c] && ((*(bool*)(rrow + c)) || lBig != rBig)) { - rightMatch = false; - break; - } - - if (jtCtx.colOnNum && jtCtx.colOnList[c] && ((*(bool*)(rrow + c)) || lBig <= rBig)) { - rightMatch = false; - break; - } - - if (jtCtx.rightFilterNum && jtCtx.rightFilterColList[c] && ((*(bool*)(rrow + c)) || rBig <= fbig)) { - filterOut = true; - } - } - - if (rightMatch) { - leftMatch = true; - } - - if (filterOut) { - continue; - } - - if (rightMatch) { - putMatchRowToRes(lrow, rrow, ALL_TABLE_COLS); - } - } - - if (!leftMatch && 0 == jtCtx.rightFilterNum) { - putNMatchRowToRes(lrow, 0, MAX_SLOT_NUM); - } + for (qptCtx.loopIdx = 0; qptCtx.loopIdx < QPT_MAX_LOOP; ++qptCtx.loopIdx) { + qptRunSingleTest(caseName); } - + printStatInfo(caseName); } +#endif - -void semiJoinAppendEqGrpRes(int32_t leftGrpRows, int32_t rightGrpRows) { - bool leftMatch = false, rightMatch = false, filterOut = false; - void* lValue = NULL, *rValue = NULL, *filterValue = NULL; - int64_t lBig = 0, rBig = 0, fbig = 0; - int64_t leftTbOffset = 0; - int64_t rightTbOffset = jtCtx.blkRowSize * leftGrpRows; - char* rrow = NULL; - - for (int32_t l = 0; l < leftGrpRows; ++l) { - char* lrow = jtCtx.colRowDataBuf + leftTbOffset + jtCtx.blkRowSize * l; - - filterOut = false; - leftMatch = true; - - for (int32_t c = 0; c < MAX_SLOT_NUM; ++c) { - lValue = lrow + jtCtx.colRowOffset[c]; - switch (jtInputColType[c]) { - case TSDB_DATA_TYPE_TIMESTAMP: - fbig = TIMESTAMP_FILTER_VALUE; - lBig = *(int64_t*)lValue; - break; - case TSDB_DATA_TYPE_INT: - fbig = INT_FILTER_VALUE; - lBig = *(int32_t*)lValue; - break; - case TSDB_DATA_TYPE_BIGINT: - fbig = BIGINT_FILTER_VALUE; - lBig = *(int64_t*)lValue; - break; - default: - break; - } - - if (jtCtx.leftFilterNum && jtCtx.leftFilterColList[c] && ((*(bool*)(lrow + c)) || lBig <= fbig)) { - filterOut = true; - break; - } - - if (jtCtx.colEqNum && jtCtx.colEqList[c] && (*(bool*)(lrow + c))) { - leftMatch = false; - break; - } - - if (jtCtx.colOnNum && jtCtx.colOnList[c] && (*(bool*)(lrow + c))) { - leftMatch = false; - break; - } - } - - if (filterOut || !leftMatch) { - continue; - } - - for (int32_t r = 0; r < rightGrpRows; ++r) { - rrow = jtCtx.colRowDataBuf + rightTbOffset + jtCtx.blkRowSize * r; - rightMatch = true; - filterOut = false; - - for (int32_t c = 0; c < MAX_SLOT_NUM; ++c) { - lValue = lrow + jtCtx.colRowOffset[c]; - - if (!*(bool*)(rrow + c)) { - rValue = rrow + jtCtx.colRowOffset[c]; - } - - switch (jtInputColType[c]) { - case TSDB_DATA_TYPE_TIMESTAMP: - fbig = TIMESTAMP_FILTER_VALUE; - lBig = *(int64_t*)lValue; - rBig = *(int64_t*)rValue; - break; - case TSDB_DATA_TYPE_INT: - fbig = INT_FILTER_VALUE; - lBig = *(int32_t*)lValue; - rBig = *(int32_t*)rValue; - break; - case TSDB_DATA_TYPE_BIGINT: - fbig = BIGINT_FILTER_VALUE; - lBig = *(int64_t*)lValue; - rBig = *(int64_t*)rValue; - break; - default: - break; - } - - if (jtCtx.colEqNum && jtCtx.colEqList[c] && ((*(bool*)(rrow + c)) || lBig != rBig)) { - rightMatch = false; - break; - } - - if (jtCtx.colOnNum && jtCtx.colOnList[c] && ((*(bool*)(rrow + c)) || lBig <= rBig)) { - rightMatch = false; - break; - } - - if (jtCtx.rightFilterNum && jtCtx.rightFilterColList[c] && ((*(bool*)(rrow + c)) || rBig <= fbig)) { - filterOut = true; - break; - } - } - - if (filterOut || !rightMatch) { - continue; - } - - break; - } - - if (!filterOut && rightMatch) { - putMatchRowToRes(lrow, rrow, LEFT_TABLE_COLS); - } - } - - -} - - - - -void antiJoinAppendEqGrpRes(int32_t leftGrpRows, int32_t rightGrpRows) { - bool leftMatch = false, rightMatch = false, filterOut = false; - void* lValue = NULL, *rValue = NULL, *filterValue = NULL; - int64_t lBig = 0, rBig = 0, fbig = 0; - int64_t rightTbOffset = jtCtx.blkRowSize * leftGrpRows; - - assert(0 == jtCtx.rightFilterNum); - - for (int32_t l = 0; l < leftGrpRows; ++l) { - char* lrow = jtCtx.colRowDataBuf + jtCtx.blkRowSize * l; - - filterOut = false; - leftMatch = true; - - for (int32_t c = 0; c < MAX_SLOT_NUM; ++c) { - lValue = lrow + jtCtx.colRowOffset[c]; - switch (jtInputColType[c]) { - case TSDB_DATA_TYPE_TIMESTAMP: - fbig = TIMESTAMP_FILTER_VALUE; - lBig = *(int64_t*)lValue; - break; - case TSDB_DATA_TYPE_INT: - fbig = INT_FILTER_VALUE; - lBig = *(int32_t*)lValue; - break; - case TSDB_DATA_TYPE_BIGINT: - fbig = BIGINT_FILTER_VALUE; - lBig = *(int64_t*)lValue; - break; - default: - break; - } - - if (jtCtx.leftFilterNum && jtCtx.leftFilterColList[c] && ((*(bool*)(lrow + c)) || lBig <= fbig)) { - filterOut = true; - break; - } - - if (jtCtx.colEqNum && jtCtx.colEqList[c] && (*(bool*)(lrow + c))) { - leftMatch = false; - } - - if (jtCtx.colOnNum && jtCtx.colOnList[c] && (*(bool*)(lrow + c))) { - leftMatch = false; - } - } - - if (filterOut) { - continue; - } - - if (false == leftMatch) { - putNMatchRowToRes(lrow, 0, MAX_SLOT_NUM); - continue; - } - - leftMatch = false; - for (int32_t r = 0; r < rightGrpRows; ++r) { - char* rrow = jtCtx.colRowDataBuf + rightTbOffset + jtCtx.blkRowSize * r; - rightMatch = true; - - for (int32_t c = 0; c < MAX_SLOT_NUM; ++c) { - lValue = lrow + jtCtx.colRowOffset[c]; - - if (!*(bool*)(rrow + c)) { - rValue = rrow + jtCtx.colRowOffset[c]; - } - - switch (jtInputColType[c]) { - case TSDB_DATA_TYPE_TIMESTAMP: - fbig = TIMESTAMP_FILTER_VALUE; - lBig = *(int64_t*)lValue; - rBig = *(int64_t*)rValue; - break; - case TSDB_DATA_TYPE_INT: - fbig = INT_FILTER_VALUE; - lBig = *(int32_t*)lValue; - rBig = *(int32_t*)rValue; - break; - case TSDB_DATA_TYPE_BIGINT: - fbig = BIGINT_FILTER_VALUE; - lBig = *(int64_t*)lValue; - rBig = *(int64_t*)rValue; - break; - default: - break; - } - - if (jtCtx.colEqNum && jtCtx.colEqList[c] && ((*(bool*)(rrow + c)) || lBig != rBig)) { - rightMatch = false; - break; - } - - if (jtCtx.colOnNum && jtCtx.colOnList[c] && ((*(bool*)(rrow + c)) || lBig <= rBig)) { - rightMatch = false; - break; - } - } - - if (rightMatch) { - leftMatch = true; - break; - } - } - - if (!leftMatch) { - putNMatchRowToRes(lrow, 0, MAX_SLOT_NUM); - } - } - - -} - -void addAsofEqInRows(int32_t rowsNum, int64_t tbOffset, bool leftTable) { - bool filterOut = false; - void* cvalue = NULL; - int64_t cbig = 0, fbig = 0; - int32_t filterNum = leftTable ? jtCtx.leftFilterNum : jtCtx.rightFilterNum; - int32_t* filterCol = leftTable ? jtCtx.leftFilterColList : jtCtx.rightFilterColList; - SArray* rowList = leftTable ? jtCtx.leftRowsList : jtCtx.rightRowsList; - - if (!leftTable) { - rowsNum = TMIN(rowsNum, jtCtx.jLimit); - } - - for (int32_t l = 0; l < rowsNum; ++l) { - char* row = jtCtx.colRowDataBuf + tbOffset + jtCtx.blkRowSize * l; - - filterOut = false; - - for (int32_t c = 0; c < MAX_SLOT_NUM; ++c) { - cvalue = row + jtCtx.colRowOffset[c]; - switch (jtInputColType[c]) { - case TSDB_DATA_TYPE_TIMESTAMP: - fbig = TIMESTAMP_FILTER_VALUE; - cbig = *(int64_t*)cvalue; - break; - case TSDB_DATA_TYPE_INT: - fbig = INT_FILTER_VALUE; - cbig = *(int32_t*)cvalue; - break; - case TSDB_DATA_TYPE_BIGINT: - fbig = BIGINT_FILTER_VALUE; - cbig = *(int64_t*)cvalue; - break; - default: - break; - } - - if (filterNum && filterCol[c] && ((*(bool*)(row + c)) || cbig <= fbig)) { - filterOut = true; - break; - } - } - - if (filterOut && leftTable) { - continue; - } - - assert(NULL != taosArrayPush(rowList, row)); - if (!leftTable) { - assert(NULL != taosArrayPush(jtCtx.rightFilterOut, &filterOut)); - } - } - - if (!leftTable && ((jtCtx.asc && (jtCtx.asofOpType == OP_TYPE_GREATER_EQUAL || jtCtx.asofOpType == OP_TYPE_GREATER_THAN)) || (!jtCtx.asc && (jtCtx.asofOpType == OP_TYPE_LOWER_EQUAL || jtCtx.asofOpType == OP_TYPE_LOWER_THAN))) || jtCtx.asofOpType == OP_TYPE_EQUAL) { - trimForAsofJlimit(); - } -} - -void asofJoinAppendEqGrpRes(int32_t leftGrpRows, int32_t rightGrpRows) { - int64_t rightTbOffset = jtCtx.blkRowSize * leftGrpRows; - - if (jtCtx.asc) { - switch (jtCtx.asofOpType) { - case OP_TYPE_GREATER_THAN: - addAsofEqInRows(leftGrpRows, 0, true); - appendAllAsofResRows(); - addAsofEqInRows(rightGrpRows, rightTbOffset, false); - break; - case OP_TYPE_GREATER_EQUAL: - addAsofEqInRows(leftGrpRows, 0, true); - addAsofEqInRows(rightGrpRows, rightTbOffset, false); - appendAllAsofResRows(); - break; - case OP_TYPE_LOWER_THAN: - case OP_TYPE_LOWER_EQUAL: - addAsofEqInRows(leftGrpRows, 0, true); - addAsofEqInRows(rightGrpRows, rightTbOffset, false); - chkAppendAsofForwardGrpResRows(false); - break; - case OP_TYPE_EQUAL: - taosArrayClear(jtCtx.leftRowsList); - taosArrayClear(jtCtx.rightRowsList); - taosArrayClear(jtCtx.rightFilterOut); - addAsofEqInRows(leftGrpRows, 0, true); - addAsofEqInRows(rightGrpRows, rightTbOffset, false); - chkAppendAsofForwardGrpResRows(true); - taosArrayClear(jtCtx.leftRowsList); - taosArrayClear(jtCtx.rightRowsList); - taosArrayClear(jtCtx.rightFilterOut); - break; - default: - return; - } - - return; - } - - switch (jtCtx.asofOpType) { - case OP_TYPE_LOWER_THAN: - addAsofEqInRows(leftGrpRows, 0, true); - appendAllAsofResRows(); - addAsofEqInRows(rightGrpRows, rightTbOffset, false); - break; - case OP_TYPE_LOWER_EQUAL: - addAsofEqInRows(leftGrpRows, 0, true); - addAsofEqInRows(rightGrpRows, rightTbOffset, false); - appendAllAsofResRows(); - break; - case OP_TYPE_GREATER_THAN: - case OP_TYPE_GREATER_EQUAL: - addAsofEqInRows(leftGrpRows, 0, true); - addAsofEqInRows(rightGrpRows, rightTbOffset, false); - chkAppendAsofForwardGrpResRows(false); - break; - case OP_TYPE_EQUAL: - taosArrayClear(jtCtx.leftRowsList); - taosArrayClear(jtCtx.rightRowsList); - taosArrayClear(jtCtx.rightFilterOut); - addAsofEqInRows(leftGrpRows, 0, true); - addAsofEqInRows(rightGrpRows, rightTbOffset, false); - chkAppendAsofForwardGrpResRows(true); - taosArrayClear(jtCtx.leftRowsList); - taosArrayClear(jtCtx.rightRowsList); - taosArrayClear(jtCtx.rightFilterOut); - break; - default: - return; - } -} - - -void addWinEqInRows(int32_t rowsNum, int64_t tbOffset, bool leftTable) { - bool filterOut = false; - void* cvalue = NULL; - int64_t cbig = 0, fbig = 0; - int32_t filterNum = leftTable ? jtCtx.leftFilterNum : jtCtx.rightFilterNum; - int32_t* filterCol = leftTable ? jtCtx.leftFilterColList : jtCtx.rightFilterColList; - SArray* rowList = leftTable ? jtCtx.leftRowsList : jtCtx.rightRowsList; - - for (int32_t l = 0; l < rowsNum; ++l) { - char* row = jtCtx.colRowDataBuf + tbOffset + jtCtx.blkRowSize * l; - - filterOut = false; - - for (int32_t c = 0; c < MAX_SLOT_NUM; ++c) { - cvalue = row + jtCtx.colRowOffset[c]; - switch (jtInputColType[c]) { - case TSDB_DATA_TYPE_TIMESTAMP: - fbig = TIMESTAMP_FILTER_VALUE; - cbig = *(int64_t*)cvalue; - break; - case TSDB_DATA_TYPE_INT: - fbig = INT_FILTER_VALUE; - cbig = *(int32_t*)cvalue; - break; - case TSDB_DATA_TYPE_BIGINT: - fbig = BIGINT_FILTER_VALUE; - cbig = *(int64_t*)cvalue; - break; - default: - break; - } - - if (filterNum && filterCol[c] && ((*(bool*)(row + c)) || cbig <= fbig)) { - filterOut = true; - break; - } - } - - if (filterOut && leftTable) { - continue; - } - - assert(NULL != taosArrayPush(rowList, row)); - if (!leftTable) { - assert(NULL != taosArrayPush(jtCtx.rightFilterOut, &filterOut)); - } - } -} - - -void winJoinAppendEqGrpRes(int32_t leftGrpRows, int32_t rightGrpRows) { - int64_t rightTbOffset = jtCtx.blkRowSize * leftGrpRows; - - addWinEqInRows(leftGrpRows, 0, true); - addWinEqInRows(rightGrpRows, rightTbOffset, false); - chkAppendWinResRows(false); -} - - - -void fullJoinAppendEqGrpRes(int32_t leftGrpRows, int32_t rightGrpRows) { - bool leftMatch = false, rightMatch = false, lfilterOut = false, rfilterOut = false; - void* lValue = NULL, *rValue = NULL, *filterValue = NULL; - int64_t lBig = 0, rBig = 0, fbig = 0; - int64_t rightTbOffset = jtCtx.blkRowSize * leftGrpRows; - - TAOS_MEMSET(jtCtx.rightFinMatch, 0, rightGrpRows * sizeof(bool)); - - for (int32_t l = 0; l < leftGrpRows; ++l) { - char* lrow = jtCtx.colRowDataBuf + jtCtx.blkRowSize * l; - - lfilterOut = false; - leftMatch = false; - - for (int32_t c = 0; c < MAX_SLOT_NUM; ++c) { - lValue = lrow + jtCtx.colRowOffset[c]; - switch (jtInputColType[c]) { - case TSDB_DATA_TYPE_TIMESTAMP: - fbig = TIMESTAMP_FILTER_VALUE; - lBig = *(int64_t*)lValue; - break; - case TSDB_DATA_TYPE_INT: - fbig = INT_FILTER_VALUE; - lBig = *(int32_t*)lValue; - break; - case TSDB_DATA_TYPE_BIGINT: - fbig = BIGINT_FILTER_VALUE; - lBig = *(int64_t*)lValue; - break; - default: - break; - } - - if (jtCtx.leftFilterNum && jtCtx.leftFilterColList[c] && ((*(bool*)(lrow + c)) || lBig <= fbig)) { - lfilterOut = true; - } - } - - for (int32_t r = 0; r < rightGrpRows; ++r) { - char* rrow = jtCtx.colRowDataBuf + rightTbOffset + jtCtx.blkRowSize * r; - rightMatch = true; - rfilterOut = false; - - for (int32_t c = 0; c < MAX_SLOT_NUM; ++c) { - lValue = lrow + jtCtx.colRowOffset[c]; - - if (!*(bool*)(rrow + c)) { - rValue = rrow + jtCtx.colRowOffset[c]; - } - - switch (jtInputColType[c]) { - case TSDB_DATA_TYPE_TIMESTAMP: - fbig = TIMESTAMP_FILTER_VALUE; - lBig = *(int64_t*)lValue; - rBig = *(int64_t*)rValue; - break; - case TSDB_DATA_TYPE_INT: - fbig = INT_FILTER_VALUE; - lBig = *(int32_t*)lValue; - rBig = *(int32_t*)rValue; - break; - case TSDB_DATA_TYPE_BIGINT: - fbig = BIGINT_FILTER_VALUE; - lBig = *(int64_t*)lValue; - rBig = *(int64_t*)rValue; - break; - default: - break; - } - - if (jtCtx.colEqNum && jtCtx.colEqList[c] && ((*(bool*)(lrow + c)) || (*(bool*)(rrow + c)) || lBig != rBig)) { - rightMatch = false; - } - - if (jtCtx.colOnNum && jtCtx.colOnList[c] && ((*(bool*)(lrow + c)) || (*(bool*)(rrow + c)) || lBig <= rBig)) { - rightMatch = false; - } - - if (jtCtx.rightFilterNum && jtCtx.rightFilterColList[c] && ((*(bool*)(rrow + c)) || rBig <= fbig)) { - rfilterOut = true; - } - } - - if (rightMatch) { - jtCtx.rightFinMatch[r] = true; - } - - if (rfilterOut) { - if (!rightMatch) { - jtCtx.rightFinMatch[r] = true; - } - continue; - } - - if (!lfilterOut && rightMatch) { - putMatchRowToRes(lrow, rrow, ALL_TABLE_COLS); - leftMatch= true; - } - } - - if (!lfilterOut && !leftMatch && 0 == jtCtx.rightFilterNum) { - putNMatchRowToRes(lrow, 0, MAX_SLOT_NUM); - } - } - - if (0 == jtCtx.leftFilterNum) { - for (int32_t r = 0; r < rightGrpRows; ++r) { - if (!jtCtx.rightFinMatch[r]) { - char* rrow = jtCtx.colRowDataBuf + rightTbOffset + jtCtx.blkRowSize * r; - putNMatchRowToRes(rrow, MAX_SLOT_NUM, 0); - } - } - } -} - - -void appendEqGrpRes(int32_t leftGrpRows, int32_t rightGrpRows) { - switch (jtCtx.joinType) { - case JOIN_TYPE_INNER: - innerJoinAppendEqGrpRes(leftGrpRows, rightGrpRows); - break; - case JOIN_TYPE_LEFT: { - switch (jtCtx.subType) { - case JOIN_STYPE_OUTER: - leftJoinAppendEqGrpRes(leftGrpRows, rightGrpRows); - break; - case JOIN_STYPE_SEMI: - semiJoinAppendEqGrpRes(leftGrpRows, rightGrpRows); - break; - case JOIN_STYPE_ANTI: - antiJoinAppendEqGrpRes(leftGrpRows, rightGrpRows); - break; - case JOIN_STYPE_ASOF: - asofJoinAppendEqGrpRes(leftGrpRows, rightGrpRows); - break; - case JOIN_STYPE_WIN: - winJoinAppendEqGrpRes(leftGrpRows, rightGrpRows); - break; - default: - break; - } - break; - } - case JOIN_TYPE_FULL: - fullJoinAppendEqGrpRes(leftGrpRows, rightGrpRows); - break; - default: - break; - } -} - -void createTsEqGrpRows(SSDataBlock** ppLeft, SSDataBlock** ppRight, int32_t leftGrpRows, int32_t rightGrpRows) { - if (leftGrpRows <= 0 && rightGrpRows <= 0) { - return; - } - - if (leftGrpRows > 0 && rightGrpRows > 0) { - jtCtx.inputStat |= (1 << 2); - } - - jtCtx.asc ? ++jtCtx.curTs : --jtCtx.curTs; - - if (NULL == *ppLeft && leftGrpRows > 0) { - *ppLeft = createDummyBlock(LEFT_BLK_ID); - assert(*ppLeft); - assert(0 == blockDataEnsureCapacity(*ppLeft, jtCtx.blkRows)); - assert(NULL != taosArrayPush(jtCtx.leftBlkList, ppLeft)); - } - - if (jtCtx.grpJoin) { - (*ppLeft)->info.id.groupId = jtCtx.inGrpId; - } - - if (NULL == *ppRight && rightGrpRows > 0) { - *ppRight = createDummyBlock(RIGHT_BLK_ID); - assert(*ppRight); - assert(0 == blockDataEnsureCapacity(*ppRight, jtCtx.blkRows)); - assert(NULL != taosArrayPush(jtCtx.rightBlkList, ppRight)); - } - - if (jtCtx.grpJoin) { - (*ppRight)->info.id.groupId = jtCtx.inGrpId; - } - - - makeAppendBlkData(ppLeft, ppRight, leftGrpRows, rightGrpRows); - - appendEqGrpRes(leftGrpRows, rightGrpRows); -} - -void forceFlushResRows() { - if (JOIN_STYPE_ASOF == jtCtx.subType && taosArrayGetSize(jtCtx.leftRowsList) > 0) { - assert((jtCtx.asc && (OP_TYPE_LOWER_EQUAL == jtCtx.asofOpType || OP_TYPE_LOWER_THAN == jtCtx.asofOpType)) - || (!jtCtx.asc && (OP_TYPE_GREATER_EQUAL == jtCtx.asofOpType || OP_TYPE_GREATER_THAN == jtCtx.asofOpType))); - chkAppendAsofForwardGrpResRows(true); - } else if (JOIN_STYPE_WIN == jtCtx.subType && taosArrayGetSize(jtCtx.leftRowsList) > 0) { - chkAppendWinResRows(true); - } - - taosArrayClear(jtCtx.rightRowsList); - taosArrayClear(jtCtx.rightFilterOut); - taosArrayClear(jtCtx.leftRowsList); - -} - -void createBothBlkRowsData(void) { - SSDataBlock* pLeft = NULL; - SSDataBlock* pRight = NULL; - - jtCtx.leftTotalRows = taosRand() % jtCtx.leftMaxRows; - jtCtx.rightTotalRows = taosRand() % jtCtx.rightMaxRows; - - int32_t minTotalRows = TMIN(jtCtx.leftTotalRows, jtCtx.rightTotalRows); - int32_t maxTotalRows = TMAX(jtCtx.leftTotalRows, jtCtx.rightTotalRows); - jtCtx.curTs = jtCtx.asc ? (TIMESTAMP_FILTER_VALUE - minTotalRows / 5) : (TIMESTAMP_FILTER_VALUE + 4 * maxTotalRows / 5); - - int32_t leftTotalRows = 0, rightTotalRows = 0; - int32_t leftGrpRows = 0, rightGrpRows = 0; - int32_t grpType = 0; - while (leftTotalRows < jtCtx.leftTotalRows || rightTotalRows < jtCtx.rightTotalRows) { - if (leftTotalRows >= jtCtx.leftTotalRows) { - grpType = 1; - } else if (rightTotalRows >= jtCtx.rightTotalRows) { - grpType = 0; - } else { - grpType = taosRand() % 10; - } - - leftGrpRows = taosRand() % jtCtx.leftMaxGrpRows; - rightGrpRows = taosRand() % jtCtx.rightMaxGrpRows; - - if ((leftTotalRows + leftGrpRows) > jtCtx.leftTotalRows) { - leftGrpRows = jtCtx.leftTotalRows - leftTotalRows; - } - - if ((rightTotalRows + rightGrpRows) > jtCtx.rightTotalRows) { - rightGrpRows = jtCtx.rightTotalRows - rightTotalRows; - } - - if (0 != grpType && 1 != grpType && (leftGrpRows <= 0 || rightGrpRows <= 0)) { - if (leftGrpRows <= 0) { - grpType = 1; - } else { - grpType = 0; - } - } - - if (jtCtx.grpJoin && (0 == taosRand() % 3)) { - forceFlushResRows(); - jtCtx.inGrpId++; - pLeft = NULL; - pRight = NULL; - } - - switch (grpType) { - case 0: - createGrpRows(&pLeft, LEFT_BLK_ID, leftGrpRows); - leftTotalRows += leftGrpRows; - break; - case 1: - createGrpRows(&pRight, RIGHT_BLK_ID, rightGrpRows); - rightTotalRows += rightGrpRows; - break; - default: - createTsEqGrpRows(&pLeft, &pRight, leftGrpRows, rightGrpRows); - leftTotalRows += leftGrpRows; - rightTotalRows += rightGrpRows; - break; - } - } - - forceFlushResRows(); -} - -void createDummyBlkList(int32_t leftMaxRows, int32_t leftMaxGrpRows, int32_t rightMaxRows, int32_t rightMaxGrpRows, int32_t blkRows) { - jtCtx.leftMaxRows = leftMaxRows; - jtCtx.leftMaxGrpRows = leftMaxGrpRows; - jtCtx.rightMaxRows = rightMaxRows; - jtCtx.rightMaxGrpRows = rightMaxGrpRows; - jtCtx.blkRows = blkRows; - - int32_t maxGrpRows = TMAX(leftMaxGrpRows, rightMaxGrpRows); - if (maxGrpRows > jtCtx.rightFinMatchNum) { - jtCtx.rightFinMatchNum = maxGrpRows; - jtCtx.rightFinMatch = (bool*)taosMemoryRealloc(jtCtx.rightFinMatch, maxGrpRows * sizeof(bool)); - assert(jtCtx.rightFinMatch); - } - - taosArrayClear(jtCtx.leftRowsList); - taosArrayClear(jtCtx.rightRowsList); - taosArrayClear(jtCtx.rightFilterOut); - - createBothBlkRowsData(); -} - -void rerunBlockedHere() { - while (jtInRerun) { - taosSsleep(1); - } -} - - -SSDataBlock* getDummyInputBlock(struct SOperatorInfo* pOperator, int32_t idx) { - switch (idx) { - case LEFT_BLK_ID: - if (jtCtx.leftBlkReadIdx >= taosArrayGetSize(jtCtx.leftBlkList)) { - return NULL; - } - return (SSDataBlock*)taosArrayGetP(jtCtx.leftBlkList, jtCtx.leftBlkReadIdx++); - break; - case RIGHT_BLK_ID: - if (jtCtx.rightBlkReadIdx >= taosArrayGetSize(jtCtx.rightBlkList)) { - return NULL; - } - return (SSDataBlock*)taosArrayGetP(jtCtx.rightBlkList, jtCtx.rightBlkReadIdx++); - break; - default: - return NULL; - } -} - - -void joinTestReplaceRetrieveFp() { - static Stub stub; - stub.set(getNextBlockFromDownstreamRemain, getDummyInputBlock); - { -#ifdef WINDOWS - AddrAny any; - std::map result; - any.get_func_addr("getNextBlockFromDownstreamRemain", result); - for (const auto &f : result) { - stub.set(f.second, getDummyInputBlock); - } -#endif -#ifdef LINUX - AddrAny any("libexecutor.so"); - std::map result; - any.get_global_func_addr_dynsym("^getNextBlockFromDownstreamRemain$", result); - for (const auto &f : result) { - stub.set(f.second, getDummyInputBlock); - } -#endif - } -} - -void printColList(char* title, bool left, int32_t* colList, bool filter, char* opStr) { - bool first = true; - - JT_PRINTF("\t %s:", title); - for (int32_t i = 0; i < MAX_SLOT_NUM; ++i) { - if (colList[i]) { - if (!first) { - JT_PRINTF(" AND "); - } - first = false; - if (filter) { - JT_PRINTF("%sc%d%s%" PRId64 , left ? "l" : "r", i, opStr, jtFilterValue[i]); - } else { - JT_PRINTF("lc%d%src%d", i, opStr, i); - } - } - } - JT_PRINTF("\n"); -} - -void printInputRowData(SSDataBlock* pBlk, int32_t* rowIdx) { - if (jtCtx.grpJoin) { - JT_PRINTF("%5" PRIu64, pBlk->info.id.groupId); - } - for (int32_t c = 0; c < MAX_SLOT_NUM; ++c) { - SColumnInfoData* pCol = (SColumnInfoData*)taosArrayGet(pBlk->pDataBlock, c); - assert(pCol); - assert(pCol->info.type == jtInputColType[c]); - if (colDataIsNull_s(pCol, *rowIdx)) { - JT_PRINTF("%18s", " NULL"); - } else { - switch (jtInputColType[c]) { - case TSDB_DATA_TYPE_TIMESTAMP: - case TSDB_DATA_TYPE_BIGINT: - JT_PRINTF("%18" PRId64, *(int64_t*)colDataGetData(pCol, *rowIdx)); - break; - case TSDB_DATA_TYPE_INT: - JT_PRINTF("%18d", *(int32_t*)colDataGetData(pCol, *rowIdx)); - break; - default: - assert(0); - } - } - } - - (*rowIdx)++; -} - -void printInputData() { - int32_t leftRowIdx = 0, rightRowIdx = 0; - - JT_PRINTF("\nInput Data:\n"); - while (jtCtx.leftBlkReadIdx < taosArrayGetSize(jtCtx.leftBlkList) || jtCtx.rightBlkReadIdx < taosArrayGetSize(jtCtx.rightBlkList)) { - if (jtCtx.leftBlkReadIdx < taosArrayGetSize(jtCtx.leftBlkList)) { - while (true) { - SSDataBlock* pBlk = (SSDataBlock*)taosArrayGetP(jtCtx.leftBlkList, jtCtx.leftBlkReadIdx); - assert(pBlk); - if (leftRowIdx < pBlk->info.rows) { - printInputRowData(pBlk, &leftRowIdx); - break; - } - - JT_PRINTF("\t%*s-------------------------blk end-------------------------------", jtCtx.grpJoin ? 6 : 0, " "); - jtCtx.leftBlkReadIdx++; - leftRowIdx = 0; - break; - } - } else { - JT_PRINTF("%*s", jtCtx.grpJoin ? 77 : 72, " "); - } - - if (jtCtx.rightBlkReadIdx < taosArrayGetSize(jtCtx.rightBlkList)) { - while (true) { - SSDataBlock* pBlk = (SSDataBlock*)taosArrayGetP(jtCtx.rightBlkList, jtCtx.rightBlkReadIdx); - assert(pBlk); - if (rightRowIdx < pBlk->info.rows) { - printInputRowData(pBlk, &rightRowIdx); - break; - } - - JT_PRINTF("\t%*s--------------------------blk end----------------------------\t", jtCtx.grpJoin ? 6 : 0, " "); - jtCtx.rightBlkReadIdx++; - rightRowIdx = 0; - break; - } - } - - JT_PRINTF("\n"); - } - - jtCtx.leftBlkReadIdx = jtCtx.rightBlkReadIdx = 0; -} - -char* getInputStatStr(char* inputStat) { - if (jtCtx.inputStat & (1 << LEFT_BLK_ID)) { - TAOS_STRCAT(inputStat, "L"); - } - if (jtCtx.inputStat & (1 << RIGHT_BLK_ID)) { - TAOS_STRCAT(inputStat, "R"); - } - if (jtCtx.inputStat & (1 << 2)) { - TAOS_STRCAT(inputStat, "E"); - } - return inputStat; -} - -char* getAsofOpStr() { - switch (jtCtx.asofOpType) { - case OP_TYPE_GREATER_THAN: - return ">"; - case OP_TYPE_GREATER_EQUAL: - return ">="; - case OP_TYPE_LOWER_THAN: - return "<"; - case OP_TYPE_LOWER_EQUAL: - return "<="; - case OP_TYPE_EQUAL: - return "="; - default: - return "UNKNOWN"; - } -} - -void printBasicInfo(char* caseName) { - if (!jtCtrl.printTestInfo) { - return; - } - - char inputStat[4] = {0}; - JT_PRINTF("\n%dth TEST [%s] START\nBasic Info:\n\t asc:%d\n\t filter:%d\n\t maxRows:left-%d right-%d\n\t " - "maxGrpRows:left-%d right-%d\n\t blkRows:%d\n\t colCond:%s\n\t joinType:%s\n\t " - "subType:%s\n\t inputStat:%s\n\t groupJoin:%s\n", jtCtx.loopIdx, caseName, jtCtx.asc, jtCtx.filter, jtCtx.leftMaxRows, jtCtx.rightMaxRows, - jtCtx.leftMaxGrpRows, jtCtx.rightMaxGrpRows, jtCtx.blkRows, jtColCondStr[jtCtx.colCond], jtJoinTypeStr[jtCtx.joinType], - jtSubTypeStr[jtCtx.subType], getInputStatStr(inputStat), jtCtx.grpJoin ? "true" : "false"); - - if (JOIN_STYPE_ASOF == jtCtx.subType) { - JT_PRINTF("\t asofOp:%s\n\t JLimit:%" PRId64 "\n", getAsofOpStr(), jtCtx.jLimit); - } else if (JOIN_STYPE_WIN == jtCtx.subType) { - JT_PRINTF("\t windowOffset:[%" PRId64 ", %" PRId64 "]\n\t JLimit:%" PRId64 "\n", jtCtx.winStartOffset, jtCtx.winEndOffset, jtCtx.jLimit); - } - - JT_PRINTF("Input Info:\n\t totalBlk:left-%d right-%d\n\t totalRows:left-%d right-%d\n\t " - "blkRowSize:%d\n\t inputCols:left-%s %s %s %s right-%s %s %s %s\n", - (int32_t)taosArrayGetSize(jtCtx.leftBlkList), (int32_t)taosArrayGetSize(jtCtx.rightBlkList), - jtCtx.leftTotalRows, jtCtx.rightTotalRows, - jtCtx.blkRowSize, tDataTypes[jtInputColType[0]].name, tDataTypes[jtInputColType[1]].name, - tDataTypes[jtInputColType[2]].name, tDataTypes[jtInputColType[3]].name, tDataTypes[jtInputColType[0]].name, - tDataTypes[jtInputColType[1]].name, tDataTypes[jtInputColType[2]].name, tDataTypes[jtInputColType[3]].name); - - if (jtCtx.colEqNum) { - JT_PRINTF("\t colEqNum:%d\n", jtCtx.colEqNum); - printColList("colEqList", false, jtCtx.colEqList, false, "="); - } - - if (jtCtx.colOnNum) { - JT_PRINTF("\t colOnNum:%d\n", jtCtx.colOnNum); - printColList("colOnList", false, jtCtx.colOnList, false, ">"); - } - - if (jtCtx.leftFilterNum) { - JT_PRINTF("\t leftFilterNum:%d\n", jtCtx.leftFilterNum); - printColList("leftFilterList", true, jtCtx.leftFilterColList, true, ">"); - } - - if (jtCtx.rightFilterNum) { - JT_PRINTF("\t rightFilterNum:%d\n", jtCtx.rightFilterNum); - printColList("rightFilterList", false, jtCtx.rightFilterColList, true, ">"); - } - - JT_PRINTF("\t resColSize:%d\n\t resColNum:%d\n\t resColList:", jtCtx.resColSize, jtCtx.resColNum); - for (int32_t i = 0; i < jtCtx.resColNum; ++i) { - int32_t s = jtCtx.resColInSlot[i]; - int32_t idx = s >= MAX_SLOT_NUM ? s - MAX_SLOT_NUM : s; - JT_PRINTF("%sc%d[%s]\t", s >= MAX_SLOT_NUM ? "r" : "l", s, tDataTypes[jtInputColType[idx]].name); - } - - if (jtCtrl.printInputRow) { - printInputData(); - } -} - -void printOutputInfo() { - if (!jtCtrl.printTestInfo) { - return; - } - - JT_PRINTF("\nOutput Info:\n\t expectedRows:%d\n\t ", jtCtx.resRows); - JT_PRINTF("Actual Result:\n"); -} - -void printActualResInfo() { - if (!jtCtrl.printTestInfo) { - return; - } - - JT_PRINTF("Actual Result Summary:\n\t blkNum:%d\n\t rowNum:%d%s\n\t leftBlkRead:%d\n\t rightBlkRead:%d\n\t +rows:%d%s\n\t " - "-rows:%d%s\n\t matchRows:%d%s\n\t executionTime:%" PRId64 "us\n", - jtRes.blkNum, jtRes.rowNum, - jtRes.rowNum == jtCtx.resRows ? "" : "*", - jtCtx.leftBlkReadIdx, jtCtx.rightBlkReadIdx, - jtRes.addRowNum, jtRes.addRowNum ? "*" : "", - jtRes.subRowNum, jtRes.subRowNum ? "*" : "", - jtRes.matchNum, jtRes.matchNum == jtCtx.resRows ? "" : "*", - taosGetTimestampUs() - jtCtx.startTsUs); -} - -void printStatInfo(char* caseName) { - JT_PRINTF("\n TEST [%s] Stat:\n\t maxResRows:%d\n\t maxResBlkRows:%d\n\t totalResRows:%" PRId64 "\n\t useMSecs:%" PRId64 "\n", - caseName, jtStat.maxResRows, jtStat.maxResBlkRows, jtStat.totalResRows, jtStat.useMSecs); - -} - -void checkJoinDone(char* caseName) { - int32_t iter = 0; - void* p = NULL; - void* key = NULL; - if (!jtCtrl.noKeepResRows) { - while (NULL != (p = tSimpleHashIterate(jtCtx.jtResRows, p, &iter))) { - key = tSimpleHashGetKey(p, NULL); - jtRes.succeed = false; - jtRes.subRowNum += *(int32_t*)p; - for (int32_t i = 0; i < *(int32_t*)p; ++i) { - printResRow((char*)key, 0); - } - } - } - - printActualResInfo(); - - JT_PRINTF("\n%dth TEST [%s] Final Result: %s\n", jtCtx.loopIdx, caseName, jtRes.succeed ? "SUCCEED" : "FAILED"); -} - -void putRowToResColBuf(SSDataBlock* pBlock, int32_t r, bool ignoreTbCols) { - for (int32_t c = 0; c < jtCtx.resColNum; ++c) { - int32_t slot = jtCtx.resColInSlot[c]; - if (ignoreTbCols && ((jtCtx.leftColOnly && slot >= MAX_SLOT_NUM) || - (jtCtx.rightColOnly && slot < MAX_SLOT_NUM))) { - continue; - } - - SColumnInfoData* pCol = (SColumnInfoData*)taosArrayGet(pBlock->pDataBlock, c); - assert(pCol); - switch (jtInputColType[slot % MAX_SLOT_NUM]) { - case TSDB_DATA_TYPE_TIMESTAMP: - case TSDB_DATA_TYPE_BIGINT: - if (colDataIsNull_s(pCol, r)) { - *(bool*)(jtCtx.resColBuf + slot) = true; - } else { - *(int64_t*)(jtCtx.resColBuf + jtCtx.resColOffset[slot]) = *(int64_t*)colDataGetData(pCol, r); - } - break; - case TSDB_DATA_TYPE_INT: - if (colDataIsNull_s(pCol, r)) { - *(bool*)(jtCtx.resColBuf + slot) = true; - } else { - *(int32_t*)(jtCtx.resColBuf + jtCtx.resColOffset[slot]) = *(int32_t*)colDataGetData(pCol, r); - } - break; - default: - break; - } - } -} - -void checkJoinRes(SSDataBlock* pBlock) { - jtRes.rowNum += pBlock->info.rows; - if (jtRes.rowNum > jtStat.maxResRows) { - jtStat.maxResRows = jtRes.rowNum; - } - jtRes.blkNum++; - - if (pBlock->info.rows > jtStat.maxResBlkRows) { - jtStat.maxResBlkRows = pBlock->info.rows; - } - - jtStat.totalResRows += pBlock->info.rows; - if (jtCtrl.noKeepResRows) { - jtRes.matchNum += pBlock->info.rows; - } else { - for (int32_t r = 0; r < pBlock->info.rows; ++r) { - TAOS_MEMSET(jtCtx.resColBuf, 0, jtCtx.resColSize); - - putRowToResColBuf(pBlock, r, true); - - char* value = (char*)tSimpleHashGet(jtCtx.jtResRows, jtCtx.resColBuf, jtCtx.resColSize); - if (NULL == value) { - putRowToResColBuf(pBlock, r, false); - printResRow(jtCtx.resColBuf, 1); - jtRes.succeed = false; - jtRes.addRowNum++; - continue; - } - - rmResRow(); - - putRowToResColBuf(pBlock, r, false); - printResRow(jtCtx.resColBuf, 2); - jtRes.matchNum++; - } - } -} - -void resetForJoinRerun(int32_t dsNum, SSortMergeJoinPhysiNode* pNode, SExecTaskInfo* pTask) { - jtCtx.leftBlkReadIdx = 0; - jtCtx.rightBlkReadIdx = 0; - jtCtx.curKeyOffset = 0; - - TAOS_MEMSET(&jtRes, 0, sizeof(jtRes)); - jtRes.succeed = true; - - SOperatorInfo* pDownstreams[2]; - createDummyDownstreamOperators(2, pDownstreams); - SOperatorInfo* ppDownstreams[] = {pDownstreams[0], pDownstreams[1]}; - int32_t code = createMergeJoinOperatorInfo(ppDownstreams, 2, pNode, pTask, &jtCtx.pJoinOp); - ASSERT_TRUE(NULL != jtCtx.pJoinOp); -} - -void handleJoinDone(bool* contLoop) { - destroyOperator(jtCtx.pJoinOp); - jtCtx.pJoinOp = NULL; - - if (jtRes.succeed) { - *contLoop = false; - return; - } - - if (jtErrorRerun) { - *contLoop = false; - return; - } - - jtInRerun = true; -} - - -void jtInitLogFile() { - const char *defaultLogFileNamePrefix = "jtlog"; - const int32_t maxLogFileNum = 10; - - tsAsyncLog = 0; - qDebugFlag = 159; - TAOS_STRCPY(tsLogDir, TD_LOG_DIR_PATH); - - if (taosInitLog(defaultLogFileNamePrefix, maxLogFileNum, false) < 0) { - JT_PRINTF("failed to open log file in directory:%s\n", tsLogDir); - } -} - - - -void initJoinTest() { - jtCtx.leftBlkList = taosArrayInit(10, POINTER_BYTES); - jtCtx.rightBlkList = taosArrayInit(10, POINTER_BYTES); - assert(jtCtx.leftBlkList && jtCtx.rightBlkList); - jtCtx.jtResRows = tSimpleHashInit(10000000, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY)); - assert(jtCtx.jtResRows); - - joinTestReplaceRetrieveFp(); - - if (jtCtrl.logHistory) { - jtStat.pHistory = taosArrayInit(100000, sizeof(SJoinTestHistory)); - assert(jtStat.pHistory); - } - - int32_t offset = MAX_SLOT_NUM * sizeof(bool); - for (int32_t i = 0; i < MAX_SLOT_NUM; ++i) { - jtCtx.inColOffset[i] = offset; - offset += tDataTypes[jtInputColType[i]].bytes; - } - jtCtx.inColSize = offset; - jtCtx.inColBuf = (char*)taosMemoryMalloc(jtCtx.inColSize); - assert(jtCtx.inColBuf); - - jtCtx.leftRowsList = taosArrayInit(1024, jtCtx.inColSize); - jtCtx.rightRowsList = taosArrayInit(1024, jtCtx.inColSize); - jtCtx.rightFilterOut = taosArrayInit(1024, sizeof(bool)); - assert(jtCtx.leftRowsList && jtCtx.rightRowsList && jtCtx.rightFilterOut); - - jtInitLogFile(); -} - -void handleTestDone() { - if (jtCtrl.logHistory) { - SJoinTestHistory h; - TAOS_MEMCPY(&h.ctx, &jtCtx, sizeof(h.ctx)); - TAOS_MEMCPY(&h.res, &jtRes, sizeof(h.res)); - assert(NULL != taosArrayPush(jtStat.pHistory, &h)); - } - - int32_t blkNum = taosArrayGetSize(jtCtx.leftBlkList); - for (int32_t i = 0; i < blkNum; ++i) { - SSDataBlock* pBlk = (SSDataBlock*)taosArrayGetP(jtCtx.leftBlkList, i); - assert(pBlk); - (void)blockDataDestroy(pBlk); - } - taosArrayClear(jtCtx.leftBlkList); - - blkNum = taosArrayGetSize(jtCtx.rightBlkList); - for (int32_t i = 0; i < blkNum; ++i) { - SSDataBlock* pBlk = (SSDataBlock*)taosArrayGetP(jtCtx.rightBlkList, i); - assert(pBlk); - (void)blockDataDestroy(pBlk); - } - taosArrayClear(jtCtx.rightBlkList); - - tSimpleHashClear(jtCtx.jtResRows); - jtCtx.resRows = 0; - - jtCtx.inputStat = 0; -} - -void runSingleTest(char* caseName, SJoinTestParam* param) { - bool contLoop = true; - - SSortMergeJoinPhysiNode* pNode = createDummySortMergeJoinPhysiNode(param); - assert(pNode); - createDummyBlkList(1000, 1000, 1000, 1000, 100); - - while (contLoop) { - rerunBlockedHere(); - resetForJoinRerun(2, pNode, param->pTask); - printBasicInfo(caseName); - printOutputInfo(); - - jtCtx.startTsUs = taosGetTimestampUs(); - while (true) { - SSDataBlock* pBlock = NULL; - int32_t code = jtCtx.pJoinOp->fpSet.getNextFn(jtCtx.pJoinOp, &pBlock); - if (NULL == pBlock) { - checkJoinDone(caseName); - break; - } else { - checkJoinRes(pBlock); - } - } - - handleJoinDone(&contLoop); - } - - nodesDestroyNode((SNode*)pNode); - handleTestDone(); -} - -void handleCaseEnd() { - taosMemoryFreeClear(jtCtx.rightFinMatch); - jtCtx.rightFinMatchNum = 0; -} - -} // namespace - -#if 1 -#if 1 -TEST(innerJoin, noCondTest) { - SJoinTestParam param; - char* caseName = "innerJoin:noCondTest"; - SExecTaskInfo* pTask = createDummyTaskInfo(caseName); - assert(pTask); - - param.pTask = pTask; - param.joinType = JOIN_TYPE_INNER; - param.subType = JOIN_STYPE_NONE; - param.cond = TEST_NO_COND; - param.asc = true; - param.grpJoin = false; - - for (jtCtx.loopIdx = 0; jtCtx.loopIdx < JT_MAX_LOOP; ++jtCtx.loopIdx) { - param.asc = !param.asc; - param.filter = false; - runSingleTest(caseName, ¶m); - - param.filter = true; - runSingleTest(caseName, ¶m); - } - - printStatInfo(caseName); - taosMemoryFree(pTask); -} -#endif - -#if 1 -TEST(innerJoin, eqCondTest) { - SJoinTestParam param; - char* caseName = "innerJoin:eqCondTest"; - SExecTaskInfo* pTask = createDummyTaskInfo(caseName); - assert(pTask); - - param.pTask = pTask; - param.joinType = JOIN_TYPE_INNER; - param.subType = JOIN_STYPE_NONE; - param.cond = TEST_EQ_COND; - param.asc = true; - param.grpJoin = false; - - for (jtCtx.loopIdx = 0; jtCtx.loopIdx < JT_MAX_LOOP; ++jtCtx.loopIdx) { - param.asc = !param.asc; - param.filter = false; - runSingleTest(caseName, ¶m); - - param.filter = true; - runSingleTest(caseName, ¶m); - } - - printStatInfo(caseName); - taosMemoryFree(pTask); -} -#endif - -#if 1 -TEST(innerJoin, onCondTest) { - SJoinTestParam param; - char* caseName = "innerJoin:onCondTest"; - SExecTaskInfo* pTask = createDummyTaskInfo(caseName); - assert(pTask); - - param.pTask = pTask; - param.joinType = JOIN_TYPE_INNER; - param.subType = JOIN_STYPE_NONE; - param.cond = TEST_ON_COND; - param.asc = true; - param.grpJoin = false; - - for (jtCtx.loopIdx = 0; jtCtx.loopIdx < JT_MAX_LOOP; ++jtCtx.loopIdx) { - param.asc = !param.asc; - param.filter = false; - runSingleTest(caseName, ¶m); - - param.filter = true; - runSingleTest(caseName, ¶m); - } - - printStatInfo(caseName); - taosMemoryFree(pTask); -} -#endif - -#if 1 -TEST(innerJoin, fullCondTest) { - SJoinTestParam param; - char* caseName = "innerJoin:fullCondTest"; - SExecTaskInfo* pTask = createDummyTaskInfo(caseName); - assert(pTask); - - param.pTask = pTask; - param.joinType = JOIN_TYPE_INNER; - param.subType = JOIN_STYPE_NONE; - param.cond = TEST_FULL_COND; - param.asc = true; - param.grpJoin = false; - - for (jtCtx.loopIdx = 0; jtCtx.loopIdx < JT_MAX_LOOP; ++jtCtx.loopIdx) { - param.asc = !param.asc; - param.filter = false; - runSingleTest(caseName, ¶m); - - param.filter = true; - runSingleTest(caseName, ¶m); - } - - printStatInfo(caseName); - taosMemoryFree(pTask); -} -#endif -#endif - - -#if 1 -#if 1 -TEST(leftOuterJoin, noCondTest) { - SJoinTestParam param; - char* caseName = "leftOuterJoin:noCondTest"; - SExecTaskInfo* pTask = createDummyTaskInfo(caseName); - assert(pTask); - - param.pTask = pTask; - param.joinType = JOIN_TYPE_LEFT; - param.subType = JOIN_STYPE_OUTER; - param.cond = TEST_NO_COND; - param.asc = true; - - for (jtCtx.loopIdx = 0; jtCtx.loopIdx < JT_MAX_LOOP; ++jtCtx.loopIdx) { - param.asc = !param.asc; - param.grpJoin = taosRand() % 2 ? true : false; - param.filter = false; - runSingleTest(caseName, ¶m); - - param.grpJoin = taosRand() % 2 ? true : false; - param.filter = true; - runSingleTest(caseName, ¶m); - } - - printStatInfo(caseName); - taosMemoryFree(pTask); -} -#endif - -#if 1 -TEST(leftOuterJoin, eqCondTest) { - SJoinTestParam param; - char* caseName = "leftOuterJoin:eqCondTest"; - SExecTaskInfo* pTask = createDummyTaskInfo(caseName); - assert(pTask); - - param.pTask = pTask; - param.joinType = JOIN_TYPE_LEFT; - param.subType = JOIN_STYPE_OUTER; - param.cond = TEST_EQ_COND; - param.asc = true; - param.grpJoin = false; - - for (jtCtx.loopIdx = 0; jtCtx.loopIdx < JT_MAX_LOOP; ++jtCtx.loopIdx) { - param.asc = !param.asc; - param.filter = false; - runSingleTest(caseName, ¶m); - - param.filter = true; - runSingleTest(caseName, ¶m); - } - - printStatInfo(caseName); - taosMemoryFree(pTask); -} -#endif - -#if 1 -TEST(leftOuterJoin, onCondTest) { - SJoinTestParam param; - char* caseName = "leftOuterJoin:onCondTest"; - SExecTaskInfo* pTask = createDummyTaskInfo(caseName); - assert(pTask); - - param.pTask = pTask; - param.joinType = JOIN_TYPE_LEFT; - param.subType = JOIN_STYPE_OUTER; - param.cond = TEST_ON_COND; - param.asc = true; - param.grpJoin = false; - - for (jtCtx.loopIdx = 0; jtCtx.loopIdx < JT_MAX_LOOP; ++jtCtx.loopIdx) { - param.asc = !param.asc; - param.filter = false; - runSingleTest(caseName, ¶m); - - param.filter = true; - runSingleTest(caseName, ¶m); - } - - printStatInfo(caseName); - taosMemoryFree(pTask); -} -#endif - -#if 1 -TEST(leftOuterJoin, fullCondTest) { - SJoinTestParam param; - char* caseName = "leftOuterJoin:fullCondTest"; - SExecTaskInfo* pTask = createDummyTaskInfo(caseName); - assert(pTask); - - param.pTask = pTask; - param.joinType = JOIN_TYPE_LEFT; - param.subType = JOIN_STYPE_OUTER; - param.cond = TEST_FULL_COND; - param.asc = true; - param.grpJoin = false; - - for (jtCtx.loopIdx = 0; jtCtx.loopIdx < JT_MAX_LOOP; ++jtCtx.loopIdx) { - param.asc = !param.asc; - param.filter = false; - runSingleTest(caseName, ¶m); - - param.filter = true; - runSingleTest(caseName, ¶m); - } - - printStatInfo(caseName); - taosMemoryFree(pTask); -} -#endif -#endif - -#if 1 -#if 1 -TEST(fullOuterJoin, noCondTest) { - SJoinTestParam param; - char* caseName = "fullOuterJoin:noCondTest"; - SExecTaskInfo* pTask = createDummyTaskInfo(caseName); - assert(pTask); - - param.pTask = pTask; - param.joinType = JOIN_TYPE_FULL; - param.subType = JOIN_STYPE_OUTER; - param.cond = TEST_NO_COND; - param.asc = true; - param.grpJoin = false; - - for (jtCtx.loopIdx = 0; jtCtx.loopIdx < JT_MAX_LOOP; ++jtCtx.loopIdx) { - param.asc = !param.asc; - param.filter = false; - runSingleTest(caseName, ¶m); - - param.filter = true; - runSingleTest(caseName, ¶m); - } - - printStatInfo(caseName); - taosMemoryFree(pTask); -} -#endif - -#if 1 -TEST(fullOuterJoin, eqCondTest) { - SJoinTestParam param; - char* caseName = "fullOuterJoin:eqCondTest"; - SExecTaskInfo* pTask = createDummyTaskInfo(caseName); - assert(pTask); - - param.pTask = pTask; - param.joinType = JOIN_TYPE_FULL; - param.subType = JOIN_STYPE_OUTER; - param.cond = TEST_EQ_COND; - param.asc = true; - param.grpJoin = false; - - for (jtCtx.loopIdx = 0; jtCtx.loopIdx < JT_MAX_LOOP; ++jtCtx.loopIdx) { - param.asc = !param.asc; - param.filter = false; - runSingleTest(caseName, ¶m); - - param.filter = true; - runSingleTest(caseName, ¶m); - } - - printStatInfo(caseName); - taosMemoryFree(pTask); - handleCaseEnd(); -} -#endif - -#if 1 -TEST(fullOuterJoin, onCondTest) { - SJoinTestParam param; - char* caseName = "fullOuterJoin:onCondTest"; - SExecTaskInfo* pTask = createDummyTaskInfo(caseName); - assert(pTask); - - param.pTask = pTask; - param.joinType = JOIN_TYPE_FULL; - param.subType = JOIN_STYPE_OUTER; - param.cond = TEST_ON_COND; - param.asc = true; - param.grpJoin = false; - - for (jtCtx.loopIdx = 0; jtCtx.loopIdx < JT_MAX_LOOP; ++jtCtx.loopIdx) { - param.asc = !param.asc; - param.filter = false; - runSingleTest(caseName, ¶m); - - param.filter = true; - runSingleTest(caseName, ¶m); - } - - printStatInfo(caseName); - taosMemoryFree(pTask); -} -#endif - -#if 1 -TEST(fullOuterJoin, fullCondTest) { - SJoinTestParam param; - char* caseName = "fullOuterJoin:fullCondTest"; - SExecTaskInfo* pTask = createDummyTaskInfo(caseName); - assert(pTask); - - param.pTask = pTask; - param.joinType = JOIN_TYPE_FULL; - param.subType = JOIN_STYPE_OUTER; - param.cond = TEST_FULL_COND; - param.asc = true; - param.grpJoin = false; - - for (jtCtx.loopIdx = 0; jtCtx.loopIdx < JT_MAX_LOOP; ++jtCtx.loopIdx) { - param.asc = !param.asc; - param.filter = false; - runSingleTest(caseName, ¶m); - - param.filter = true; - runSingleTest(caseName, ¶m); - } - - printStatInfo(caseName); - taosMemoryFree(pTask); -} -#endif -#endif - -#if 1 -#if 1 -TEST(leftSemiJoin, noCondTest) { - SJoinTestParam param; - char* caseName = "leftSemiJoin:noCondTest"; - SExecTaskInfo* pTask = createDummyTaskInfo(caseName); - assert(pTask); - - param.pTask = pTask; - param.joinType = JOIN_TYPE_LEFT; - param.subType = JOIN_STYPE_SEMI; - param.cond = TEST_NO_COND; - param.asc = true; - param.grpJoin = false; - - for (jtCtx.loopIdx = 0; jtCtx.loopIdx < JT_MAX_LOOP; ++jtCtx.loopIdx) { - param.asc = !param.asc; - param.filter = false; - runSingleTest(caseName, ¶m); - - param.filter = true; - runSingleTest(caseName, ¶m); - } - - printStatInfo(caseName); - taosMemoryFree(pTask); -} -#endif - -#if 1 -TEST(leftSemiJoin, eqCondTest) { - SJoinTestParam param; - char* caseName = "leftSemiJoin:eqCondTest"; - SExecTaskInfo* pTask = createDummyTaskInfo(caseName); - assert(pTask); - - param.pTask = pTask; - param.joinType = JOIN_TYPE_LEFT; - param.subType = JOIN_STYPE_SEMI; - param.cond = TEST_EQ_COND; - param.asc = true; - param.grpJoin = false; - - for (jtCtx.loopIdx = 0; jtCtx.loopIdx < JT_MAX_LOOP; ++jtCtx.loopIdx) { - param.asc = !param.asc; - param.filter = false; - runSingleTest(caseName, ¶m); - - param.filter = true; - runSingleTest(caseName, ¶m); - } - - printStatInfo(caseName); - taosMemoryFree(pTask); - handleCaseEnd(); -} -#endif - -#if 1 -TEST(leftSemiJoin, onCondTest) { - SJoinTestParam param; - char* caseName = "leftSemiJoin:onCondTest"; - SExecTaskInfo* pTask = createDummyTaskInfo(caseName); - assert(pTask); - - param.pTask = pTask; - param.joinType = JOIN_TYPE_LEFT; - param.subType = JOIN_STYPE_SEMI; - param.cond = TEST_ON_COND; - param.asc = true; - param.grpJoin = false; - - for (jtCtx.loopIdx = 0; jtCtx.loopIdx < JT_MAX_LOOP; ++jtCtx.loopIdx) { - param.asc = !param.asc; - param.filter = false; - runSingleTest(caseName, ¶m); - - param.filter = true; - runSingleTest(caseName, ¶m); - } - - printStatInfo(caseName); - taosMemoryFree(pTask); -} -#endif - -#if 1 -TEST(leftSemiJoin, fullCondTest) { - SJoinTestParam param; - char* caseName = "leftSemiJoin:fullCondTest"; - SExecTaskInfo* pTask = createDummyTaskInfo(caseName); - assert(pTask); - - param.pTask = pTask; - param.joinType = JOIN_TYPE_LEFT; - param.subType = JOIN_STYPE_SEMI; - param.cond = TEST_FULL_COND; - param.asc = true; - param.grpJoin = false; - - for (jtCtx.loopIdx = 0; jtCtx.loopIdx < JT_MAX_LOOP; ++jtCtx.loopIdx) { - param.asc = !param.asc; - param.filter = false; - runSingleTest(caseName, ¶m); - - param.filter = true; - runSingleTest(caseName, ¶m); - } - - printStatInfo(caseName); - taosMemoryFree(pTask); -} -#endif -#endif - -#if 1 -#if 1 -TEST(leftAntiJoin, noCondTest) { - SJoinTestParam param; - char* caseName = "leftAntiJoin:noCondTest"; - SExecTaskInfo* pTask = createDummyTaskInfo(caseName); - assert(pTask); - - param.pTask = pTask; - param.joinType = JOIN_TYPE_LEFT; - param.subType = JOIN_STYPE_ANTI; - param.cond = TEST_NO_COND; - param.asc = true; - param.grpJoin = false; - - for (jtCtx.loopIdx = 0; jtCtx.loopIdx < JT_MAX_LOOP; ++jtCtx.loopIdx) { - param.asc = !param.asc; - param.filter = false; - runSingleTest(caseName, ¶m); - - param.filter = true; - runSingleTest(caseName, ¶m); - } - - printStatInfo(caseName); - taosMemoryFree(pTask); -} -#endif - -#if 1 -TEST(leftAntiJoin, eqCondTest) { - SJoinTestParam param; - char* caseName = "leftAntiJoin:eqCondTest"; - SExecTaskInfo* pTask = createDummyTaskInfo(caseName); - assert(pTask); - - param.pTask = pTask; - param.joinType = JOIN_TYPE_LEFT; - param.subType = JOIN_STYPE_ANTI; - param.cond = TEST_EQ_COND; - param.asc = true; - param.grpJoin = false; - - for (jtCtx.loopIdx = 0; jtCtx.loopIdx < JT_MAX_LOOP; ++jtCtx.loopIdx) { - param.asc = !param.asc; - param.filter = false; - runSingleTest(caseName, ¶m); - - param.filter = true; - runSingleTest(caseName, ¶m); - } - - printStatInfo(caseName); - taosMemoryFree(pTask); - handleCaseEnd(); -} -#endif - -#if 1 -TEST(leftAntiJoin, onCondTest) { - SJoinTestParam param; - char* caseName = "leftAntiJoin:onCondTest"; - SExecTaskInfo* pTask = createDummyTaskInfo(caseName); - assert(pTask); - - param.pTask = pTask; - param.joinType = JOIN_TYPE_LEFT; - param.subType = JOIN_STYPE_ANTI; - param.cond = TEST_ON_COND; - param.asc = true; - param.grpJoin = false; - - for (jtCtx.loopIdx = 0; jtCtx.loopIdx < JT_MAX_LOOP; ++jtCtx.loopIdx) { - param.asc = !param.asc; - param.filter = false; - runSingleTest(caseName, ¶m); - - param.filter = true; - runSingleTest(caseName, ¶m); - } - - printStatInfo(caseName); - taosMemoryFree(pTask); -} -#endif - -#if 1 -TEST(leftAntiJoin, fullCondTest) { - SJoinTestParam param; - char* caseName = "leftAntiJoin:fullCondTest"; - SExecTaskInfo* pTask = createDummyTaskInfo(caseName); - assert(pTask); - - param.pTask = pTask; - param.joinType = JOIN_TYPE_LEFT; - param.subType = JOIN_STYPE_ANTI; - param.cond = TEST_FULL_COND; - param.asc = true; - param.grpJoin = false; - - for (jtCtx.loopIdx = 0; jtCtx.loopIdx < JT_MAX_LOOP; ++jtCtx.loopIdx) { - param.asc = !param.asc; - param.filter = false; - runSingleTest(caseName, ¶m); - - param.filter = true; - runSingleTest(caseName, ¶m); - } - - printStatInfo(caseName); - taosMemoryFree(pTask); -} -#endif -#endif - -#if 1 -#if 1 -TEST(leftAsofJoin, noCondGreaterThanTest) { - SJoinTestParam param; - char* caseName = "leftAsofJoin:noCondGreaterThanTest"; - SExecTaskInfo* pTask = createDummyTaskInfo(caseName); - assert(pTask); - - param.pTask = pTask; - param.joinType = JOIN_TYPE_LEFT; - param.subType = JOIN_STYPE_ASOF; - param.cond = TEST_NO_COND; - param.asofOp = OP_TYPE_GREATER_THAN; - param.asc = true; - - for (jtCtx.loopIdx = 0; jtCtx.loopIdx < JT_MAX_LOOP; ++jtCtx.loopIdx) { - param.asc = !param.asc; - param.jLimit = taosRand() % 2 ? (1 + (taosRand() % JT_MAX_JLIMIT)) : 1; - - param.grpJoin = taosRand() % 2 ? true : false; - param.filter = false; - runSingleTest(caseName, ¶m); - - param.grpJoin = taosRand() % 2 ? true : false; - param.filter = true; - runSingleTest(caseName, ¶m); - } - - printStatInfo(caseName); - taosMemoryFree(pTask); -} -#endif - -#if 1 -TEST(leftAsofJoin, noCondGreaterEqTest) { - SJoinTestParam param; - char* caseName = "leftAsofJoin:noCondGreaterEqTest"; - SExecTaskInfo* pTask = createDummyTaskInfo(caseName); - assert(pTask); - - param.pTask = pTask; - param.joinType = JOIN_TYPE_LEFT; - param.subType = JOIN_STYPE_ASOF; - param.cond = TEST_NO_COND; - param.asofOp = OP_TYPE_GREATER_EQUAL; - param.asc = true; - - for (jtCtx.loopIdx = 0; jtCtx.loopIdx < JT_MAX_LOOP; ++jtCtx.loopIdx) { - param.asc = !param.asc; - param.jLimit = taosRand() % 2 ? (1 + (taosRand() % JT_MAX_JLIMIT)) : 1; - - param.grpJoin = taosRand() % 2 ? true : false; - param.filter = false; - runSingleTest(caseName, ¶m); - - param.grpJoin = taosRand() % 2 ? true : false; - param.filter = true; - runSingleTest(caseName, ¶m); - } - - printStatInfo(caseName); - taosMemoryFree(pTask); -} -#endif - -#if 1 -TEST(leftAsofJoin, noCondEqTest) { - SJoinTestParam param; - char* caseName = "leftAsofJoin:noCondEqTest"; - SExecTaskInfo* pTask = createDummyTaskInfo(caseName); - assert(pTask); - - param.pTask = pTask; - param.joinType = JOIN_TYPE_LEFT; - param.subType = JOIN_STYPE_ASOF; - param.cond = TEST_NO_COND; - param.asofOp = OP_TYPE_EQUAL; - param.asc = true; - - for (jtCtx.loopIdx = 0; jtCtx.loopIdx < JT_MAX_LOOP; ++jtCtx.loopIdx) { - param.asc = !param.asc; - param.jLimit = taosRand() % 2 ? (1 + (taosRand() % JT_MAX_JLIMIT)) : 1; - - param.grpJoin = taosRand() % 2 ? true : false; - param.filter = false; - runSingleTest(caseName, ¶m); - - param.grpJoin = taosRand() % 2 ? true : false; - param.filter = true; - runSingleTest(caseName, ¶m); - } - - printStatInfo(caseName); - taosMemoryFree(pTask); -} -#endif - -#if 1 -TEST(leftAsofJoin, noCondLowerThanTest) { - SJoinTestParam param; - char* caseName = "leftAsofJoin:noCondLowerThanTest"; - SExecTaskInfo* pTask = createDummyTaskInfo(caseName); - assert(pTask); - - param.pTask = pTask; - param.joinType = JOIN_TYPE_LEFT; - param.subType = JOIN_STYPE_ASOF; - param.cond = TEST_NO_COND; - param.asofOp = OP_TYPE_LOWER_THAN; - param.asc = true; - - for (jtCtx.loopIdx = 0; jtCtx.loopIdx < JT_MAX_LOOP; ++jtCtx.loopIdx) { - param.asc = !param.asc; - param.jLimit = taosRand() % 2 ? (1 + (taosRand() % JT_MAX_JLIMIT)) : 1; - - param.grpJoin = taosRand() % 2 ? true : false; - param.filter = false; - runSingleTest(caseName, ¶m); - - param.grpJoin = taosRand() % 2 ? true : false; - param.filter = true; - runSingleTest(caseName, ¶m); - } - - printStatInfo(caseName); - taosMemoryFree(pTask); -} -#endif - - -#if 1 -TEST(leftAsofJoin, noCondLowerEqTest) { - SJoinTestParam param; - char* caseName = "leftAsofJoin:noCondLowerEqTest"; - SExecTaskInfo* pTask = createDummyTaskInfo(caseName); - assert(pTask); - - param.pTask = pTask; - param.joinType = JOIN_TYPE_LEFT; - param.subType = JOIN_STYPE_ASOF; - param.cond = TEST_NO_COND; - param.asofOp = OP_TYPE_LOWER_EQUAL; - param.asc = true; - - for (jtCtx.loopIdx = 0; jtCtx.loopIdx < JT_MAX_LOOP; ++jtCtx.loopIdx) { - param.asc = !param.asc; - param.jLimit = taosRand() % 2 ? (1 + (taosRand() % JT_MAX_JLIMIT)) : 1; - - param.grpJoin = taosRand() % 2 ? true : false; - param.filter = false; - runSingleTest(caseName, ¶m); - - param.grpJoin = taosRand() % 2 ? true : false; - param.filter = true; - runSingleTest(caseName, ¶m); - } - - printStatInfo(caseName); - taosMemoryFree(pTask); -} -#endif - #endif -#if 1 -#if 1 -TEST(leftWinJoin, noCondProjectionTest) { - SJoinTestParam param; - char* caseName = "leftWinJoin:noCondProjectionTest"; - SExecTaskInfo* pTask = createDummyTaskInfo(caseName); - assert(pTask); - - param.pTask = pTask; - param.joinType = JOIN_TYPE_LEFT; - param.subType = JOIN_STYPE_WIN; - param.cond = TEST_NO_COND; - param.asc = true; - - for (jtCtx.loopIdx = 0; jtCtx.loopIdx < JT_MAX_LOOP; ++jtCtx.loopIdx) { - param.asc = !param.asc; - param.jLimit = taosRand() % 2 ? (1 + (taosRand() % JT_MAX_JLIMIT)) : 1; - - param.grpJoin = taosRand() % 2 ? true : false; - param.filter = false; - runSingleTest(caseName, ¶m); - - param.grpJoin = taosRand() % 2 ? true : false; - param.filter = true; - runSingleTest(caseName, ¶m); - } - - printStatInfo(caseName); - taosMemoryFree(pTask); -} -#endif - - -#endif - - - int main(int argc, char** argv) { taosSeedRand(taosGetTimestampSec()); - initJoinTest(); + qptInitTest(); testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c index 9f831c05e9d8..fc9e9712241e 100644 --- a/source/libs/nodes/src/nodesUtilFuncs.c +++ b/source/libs/nodes/src/nodesUtilFuncs.c @@ -2010,6 +2010,8 @@ void* nodesGetValueFromNode(SValueNode* pNode) { int32_t nodesSetValueNodeValue(SValueNode* pNode, void* value) { switch (pNode->node.resType.type) { + case TSDB_DATA_TYPE_NULL: + break; case TSDB_DATA_TYPE_BOOL: pNode->datum.b = *(bool*)value; *(bool*)&pNode->typeData = pNode->datum.b; @@ -2061,7 +2063,10 @@ int32_t nodesSetValueNodeValue(SValueNode* pNode, void* value) { case TSDB_DATA_TYPE_NCHAR: case TSDB_DATA_TYPE_VARCHAR: case TSDB_DATA_TYPE_VARBINARY: + case TSDB_DATA_TYPE_DECIMAL: case TSDB_DATA_TYPE_JSON: + case TSDB_DATA_TYPE_BLOB: + case TSDB_DATA_TYPE_MEDIUMBLOB: case TSDB_DATA_TYPE_GEOMETRY: pNode->datum.p = (char*)value; break; From e134ed1c99e9e8240210ad1631314eb6d069e189 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Fri, 27 Sep 2024 17:19:11 +0800 Subject: [PATCH 079/695] refactor: do some internal refactor. --- source/libs/executor/src/streamtimesliceoperator.c | 7 ++++--- source/libs/stream/src/streamExec.c | 4 +--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/source/libs/executor/src/streamtimesliceoperator.c b/source/libs/executor/src/streamtimesliceoperator.c index c34677ce019f..8dcaa007f6a7 100644 --- a/source/libs/executor/src/streamtimesliceoperator.c +++ b/source/libs/executor/src/streamtimesliceoperator.c @@ -829,7 +829,8 @@ static int32_t getPointInfoFromStateRight(SStreamAggSupporter* pAggSup, SStreamF &curVLen, pWinCode); QUERY_CHECK_CODE(code, lino, _end); - qDebug("===stream=== set stream interp next point buf.ts:%" PRId64 ", groupId:%" PRId64 ", res:%d", pNextPoint->key.ts, pNextPoint->key.groupId, pWinCode); + qDebug("===stream=== set stream interp next point buf.ts:%" PRId64 ", groupId:%" PRId64 ", res:%d", + pNextPoint->key.ts, pNextPoint->key.groupId, *pWinCode); setPointBuff(pNextPoint, pFillSup); @@ -1623,8 +1624,8 @@ int32_t getSliceMaxTsWins(const SArray* pAllWins, SArray* pMaxWins) { for (int32_t i = size - 2; i >= 0; i--) { pKey = taosArrayGet(pAllWins, i); if (preGpId != pKey->groupId) { - void* tmp = taosArrayPush(pMaxWins, pKey); - QUERY_CHECK_NULL(tmp, code, lino, _end, terrno); + void* p = taosArrayPush(pMaxWins, pKey); + QUERY_CHECK_NULL(p, code, lino, _end, terrno); preGpId = pKey->groupId; } } diff --git a/source/libs/stream/src/streamExec.c b/source/libs/stream/src/streamExec.c index 3a27234ba92f..c1740fffb363 100644 --- a/source/libs/stream/src/streamExec.c +++ b/source/libs/stream/src/streamExec.c @@ -174,15 +174,13 @@ int32_t streamTaskExecImpl(SStreamTask* pTask, SStreamQueueItem* pItem, int64_t* continue; // checkpoint block not dispatch to downstream tasks } - SSDataBlock block = {0}; + SSDataBlock block = {.info.childId = pTask->info.selfChildId}; code = assignOneDataBlock(&block, output); if (code) { stError("s-task:%s failed to build result block due to out of memory", pTask->id.idStr); continue; } - block.info.childId = pTask->info.selfChildId; - size += blockDataGetSize(output) + sizeof(SSDataBlock) + sizeof(SColumnInfoData) * blockDataGetNumOfCols(&block); numOfBlocks += 1; From 65985c7aaa8f909d449d94786534968f4851a768 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Fri, 27 Sep 2024 18:08:36 +0800 Subject: [PATCH 080/695] enh: add tag scan test --- include/libs/function/functionMgt.h | 2 + source/libs/executor/test/queryPlanTests.cpp | 346 ++++++++++++++----- source/libs/function/src/builtins.c | 44 ++- source/libs/planner/inc/planInt.h | 12 + source/libs/planner/src/planPhysiCreater.c | 9 - 5 files changed, 311 insertions(+), 102 deletions(-) diff --git a/include/libs/function/functionMgt.h b/include/libs/function/functionMgt.h index 519207377bff..acd521ff74c5 100644 --- a/include/libs/function/functionMgt.h +++ b/include/libs/function/functionMgt.h @@ -26,6 +26,8 @@ extern "C" { #define FUNC_AGGREGATE_UDF_ID 5001 #define FUNC_SCALAR_UDF_ID 5002 +extern const int32_t funcMgtBuiltinsNum; + typedef enum EFunctionType { // aggregate function FUNCTION_TYPE_APERCENTILE = 1, diff --git a/source/libs/executor/test/queryPlanTests.cpp b/source/libs/executor/test/queryPlanTests.cpp index 8354620afb2f..71b21e800678 100755 --- a/source/libs/executor/test/queryPlanTests.cpp +++ b/source/libs/executor/test/queryPlanTests.cpp @@ -41,7 +41,7 @@ #include "tvariant.h" #include "stub.h" #include "querytask.h" - +#include "functionMgt.h" namespace { @@ -53,6 +53,7 @@ namespace { #define QPT_MAX_FUNC_PARAM 5 #define QPT_MAX_LOGIC_PARAM 5 #define QPT_MAX_NODE_LIST_NUM 5 +#define QPT_DEFAULT_VNODE_NUM 5 int32_t QPT_PHYSIC_NODE_LIST[] = { QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN, @@ -106,6 +107,7 @@ int32_t QPT_PHYSIC_NODE_LIST[] = { }; #define QPT_PHYSIC_NODE_NUM() (sizeof(QPT_PHYSIC_NODE_LIST)/sizeof(QPT_PHYSIC_NODE_LIST[0])) +#define QPT_RAND_BOOL_V ((taosRand() % 2) ? true : false) typedef struct { ENodeType type; @@ -168,21 +170,26 @@ typedef struct { SPhysiNode* pCurr; SPhysiNode* pChild; EOrder currTsOrder; - SPhysiPlanContext* pCxt; } SQPTBuildCtx; typedef struct { int32_t nodeLevel; bool onlyTag; + int16_t nextBlockId; SDataBlockDescNode* pInputDataBlockDesc; -} SQPTMakeNodeCtx; +} SQPTMakePlanCtx; + +typedef struct { + int32_t code; +} SQPTExecResult; typedef struct { int32_t loopIdx; SQPTParam param; SQPTBuildCtx buildCtx; - SQPTMakeNodeCtx makeCtx; + SQPTMakePlanCtx makeCtx; + SQPTExecResult result; int64_t startTsUs; } SQPTCtx; @@ -200,11 +207,16 @@ SQPTCtrl qptCtrl = {1, 0, 0, 0, 0}; bool qptErrorRerun = false; bool qptInRerun = false; +void qptMakeExprNode(SNode** ppNode); + + void qptPrintBeginInfo(char* caseName) { if (!qptCtrl.printTestInfo) { return; } + printf("\n%dth TEST [%s] START\n", qptCtx.loopIdx, caseName); + /* char inputStat[4] = {0}; JT_PRINTF("\n%dth TEST [%s] START\nBasic Info:\n\t asc:%d\n\t filter:%d\n\t maxRows:left-%d right-%d\n\t " @@ -260,25 +272,35 @@ void qptPrintBeginInfo(char* caseName) { */ } +void qptPrintEndInfo(char* caseName) { + if (!qptCtrl.printTestInfo) { + return; + } + + printf("\n\t%dth TEST [%s] END, result - %s%s\n", qptCtx.loopIdx, caseName, + (0 == qptCtx.result.code) ? "succeed" : "failed with error:", + (0 == qptCtx.result.code) ? "" : tstrerror(qptCtx.result.code)); +} + void qptPrintStatInfo(char* caseName) { } bool qptGetDynamicOp() { - if (!qptCtx->param.correctExpected) { - return (taosRand() % 2) : true : false; + if (!qptCtx.param.correctExpected) { + return QPT_RAND_BOOL_V; } - if (qptCtx->buildCtx.pChild) { - return qptCtx->buildCtx.pChild->dynamicOp; + if (qptCtx.buildCtx.pChild) { + return qptCtx.buildCtx.pChild->dynamicOp; } - return (taosRand() % 2) : true : false; + return QPT_RAND_BOOL_V; } EOrder qptGetInputTsOrder() { - return qptCtx->buildCtx.currTsOrder; + return qptCtx.buildCtx.currTsOrder; } @@ -289,12 +311,12 @@ SNode* qptMakeLimitNode() { SLimitNode* pLimit = (SLimitNode*)pNode; - if (!qptCtx->param->correctExpected) { + if (!qptCtx.param.correctExpected) { if (taosRand() % 2) { - pLimit->limit = taosRand() * ((taosRand() % 2) : 1 : -1); + pLimit->limit = taosRand() * ((taosRand() % 2) ? 1 : -1); } if (taosRand() % 2) { - pLimit->offset = taosRand() * ((taosRand() % 2) : 1 : -1); + pLimit->offset = taosRand() * ((taosRand() % 2) ? 1 : -1); } } else { pLimit->limit = taosRand(); @@ -303,7 +325,7 @@ SNode* qptMakeLimitNode() { } } - return pLimit; + return pNode; } SNode* qptMakeColumnNodeFromTable(int32_t colIdx, EColumnType colType, SScanPhysiNode* pScanPhysiNode) { @@ -311,25 +333,25 @@ SNode* qptMakeColumnNodeFromTable(int32_t colIdx, EColumnType colType, SScanPhys assert(0 == nodesMakeNode(QUERY_NODE_COLUMN, (SNode**)&pCol)); assert(pCol); - pCol->node.resType.type = qptCtx->param.tbl.pCol[colIdx].type; - pCol->node.resType.bytes = qptCtx->param.tbl.pCol[colIdx].len; + pCol->node.resType.type = qptCtx.param.tbl.pCol[colIdx].type; + pCol->node.resType.bytes = qptCtx.param.tbl.pCol[colIdx].len; - pCol->tableId = qptCtx->param.tbl.uid; - pCol->tableType = qptCtx->param.tbl.tblType; + pCol->tableId = qptCtx.param.tbl.uid; + pCol->tableType = qptCtx.param.tbl.tblType; pCol->colId = colIdx; pCol->projIdx = colIdx; - pCol->colType = qptCtx->param.tbl.pCol[colIdx].colType; - pCol->hasIndex = qptCtx->param.tbl.pCol[colIdx].hasIndex; - pCol->isPrimTs = qptCtx->param.tbl.pCol[colIdx].isPrimTs; - strcpy(pCol->dbName, qptCtx->param.db.dbName); - strcpy(pCol->tableName, qptCtx->param.tbl.tblName); - strcpy(pCol->tableAlias, qptCtx->param.tbl.tblAlias); - strcpy(pCol->colName, qptCtx->param.tbl.pCol[colIdx].name); + pCol->colType = qptCtx.param.tbl.pCol[colIdx].colType; + pCol->hasIndex = qptCtx.param.tbl.pCol[colIdx].hasIndex; + pCol->isPrimTs = qptCtx.param.tbl.pCol[colIdx].isPrimTs; + strcpy(pCol->dbName, qptCtx.param.db.dbName); + strcpy(pCol->tableName, qptCtx.param.tbl.tblName); + strcpy(pCol->tableAlias, qptCtx.param.tbl.tblAlias); + strcpy(pCol->colName, qptCtx.param.tbl.pCol[colIdx].name); pCol->dataBlockId = pScanPhysiNode->node.pOutputDataBlockDesc->dataBlockId; pCol->slotId = colIdx; - pCol->numOfPKs = qptCtx->param.tbl.pkNum; - pCol->tableHasPk = qptCtx->param.tbl.pkNum > 0; - pCol->isPk = qptCtx->param.tbl.pCol[colIdx].isPk; + pCol->numOfPKs = qptCtx.param.tbl.pkNum; + pCol->tableHasPk = qptCtx.param.tbl.pkNum > 0; + pCol->isPk = qptCtx.param.tbl.pCol[colIdx].isPk; pCol->projRefIdx = 0; pCol->resIdx = 0; @@ -355,7 +377,7 @@ void qptMakeCaseWhenNode(SNode** ppNode) { assert(*ppNode); SCaseWhenNode* pCaseWhen = (SCaseWhenNode*)*ppNode; - qptCtx->makeCtx.nodeLevel++; + qptCtx.makeCtx.nodeLevel++; qptMakeExprNode(&pCaseWhen->pCase); assert(pCaseWhen->pCase); @@ -378,6 +400,8 @@ void qptMakeOperatorNode(SNode** ppNode) { assert(0 == nodesMakeNode(QUERY_NODE_OPERATOR, ppNode)); SOperatorNode* pOp = (SOperatorNode*)*ppNode; pOp->opType = opType; + + qptCtx.makeCtx.nodeLevel++; switch (opType) { case OP_TYPE_ADD: case OP_TYPE_SUB: @@ -401,8 +425,8 @@ void qptMakeOperatorNode(SNode** ppNode) { case OP_TYPE_JSON_GET_VALUE: case OP_TYPE_JSON_CONTAINS: case OP_TYPE_ASSIGN: - qptMakeOperatorNode(&pOp->pLeft); - qptMakeOperatorNode(&pOp->pRight); + qptMakeExprNode(&pOp->pLeft); + qptMakeExprNode(&pOp->pRight); break; case OP_TYPE_IS_NULL: @@ -414,7 +438,7 @@ void qptMakeOperatorNode(SNode** ppNode) { case OP_TYPE_IS_NOT_FALSE: case OP_TYPE_IS_NOT_UNKNOWN: case OP_TYPE_MINUS: - qptMakeOperatorNode(&pOp->pLeft); + qptMakeExprNode(&pOp->pLeft); break; default: assert(0); @@ -423,7 +447,7 @@ void qptMakeOperatorNode(SNode** ppNode) { } void qptMakeColumnNode(SNode** ppNode) { - SNodeList* pColList = qptCtx->makeCtx.pInputDataBlockDesc->pSlots; + SNodeList* pColList = qptCtx.makeCtx.pInputDataBlockDesc->pSlots; int32_t colIdx = taosRand() % pColList->length; SNode* pNode = nodesListGetNode(pColList, colIdx); assert(nodeType(pNode) == QUERY_NODE_SLOT_DESC); @@ -431,7 +455,7 @@ void qptMakeColumnNode(SNode** ppNode) { SColumnNode* pCol = NULL; nodesMakeNode(QUERY_NODE_COLUMN, (SNode**)&pCol); pCol->node.resType = pSlot->dataType; - pCol->dataBlockId = qptCtx->makeCtx.pInputDataBlockDesc->dataBlockId; + pCol->dataBlockId = qptCtx.makeCtx.pInputDataBlockDesc->dataBlockId; pCol->slotId = pSlot->slotId; *ppNode = (SNode*)pCol; @@ -448,7 +472,7 @@ void qptGetRandValue(int32_t* pType, int32_t* pLen, void** ppVal) { *pLen = tDataTypes[*pType].bytes; *ppVal = taosMemoryMalloc(tDataTypes[*pType].bytes); assert(*ppVal); - *(bool*)*ppVal = (taosRand() % 2) : true : false; + *(bool*)*ppVal = QPT_RAND_BOOL_V; break; case TSDB_DATA_TYPE_TINYINT: *pLen = tDataTypes[*pType].bytes; @@ -502,7 +526,7 @@ void qptGetRandValue(int32_t* pType, int32_t* pLen, void** ppVal) { break; case TSDB_DATA_TYPE_NCHAR: { *pLen = taosRand() % QPT_MAX_STRING_LEN; - char* pTmp = taosMemoryCalloc(1, *pLen + 1); + char* pTmp = (char*)taosMemoryCalloc(1, *pLen + 1); assert(pTmp); memset(pTmp, 'A' + taosRand() % 26, *pLen); *ppVal = taosMemoryCalloc(1, *pLen * TSDB_NCHAR_SIZE + VARSTR_HEADER_SIZE); @@ -595,11 +619,10 @@ void qptMakeFunctionNode(SNode** ppNode) { nodesMakeNode(QUERY_NODE_FUNCTION, (SNode**)&pFunc); int32_t funcIdx = taosRand() % funcMgtBuiltinsNum; - strcpy(pFunc->functionName, funcMgtBuiltins[funcIdx].name); - + strcpy(pFunc->functionName, fmGetFuncName(funcIdx)); fmGetFuncInfo(pFunc, NULL, 0); - qptCtx->makeCtx.nodeLevel++; + qptCtx.makeCtx.nodeLevel++; int32_t paramNum = taosRand() % QPT_MAX_FUNC_PARAM + 1; for (int32_t i = 0; i < paramNum; ++i) { SNode* pNode = NULL; @@ -616,7 +639,7 @@ void qptMakeLogicCondNode(SNode** ppNode) { pLogic->condType = (taosRand() % 3) ? ((taosRand() % 2) ? LOGIC_COND_TYPE_AND : LOGIC_COND_TYPE_OR) : LOGIC_COND_TYPE_NOT; - qptCtx->makeCtx.nodeLevel++; + qptCtx.makeCtx.nodeLevel++; int32_t paramNum = taosRand() % QPT_MAX_LOGIC_PARAM + 1; for (int32_t i = 0; i < paramNum; ++i) { SNode* pNode = NULL; @@ -631,7 +654,7 @@ void qptMakeNodeListNode(SNode** ppNode) { SNodeListNode* pList = NULL; nodesMakeNode(QUERY_NODE_NODE_LIST, (SNode**)&pList); - qptCtx->makeCtx.nodeLevel++; + qptCtx.makeCtx.nodeLevel++; int32_t nodeNum = taosRand() % QPT_MAX_NODE_LIST_NUM + 1; for (int32_t i = 0; i < nodeNum; ++i) { SNode* pNode = NULL; @@ -668,11 +691,11 @@ void qptMakeTableNode(SNode** ppNode) { void qptMakeExprNode(SNode** ppNode) { int32_t nodeTypeMaxValue = 9; - if (qptCtx->makeCtx.nodeLevel >= QPT_MAX_NODE_LEVEL) { + if (qptCtx.makeCtx.nodeLevel >= QPT_MAX_NODE_LEVEL) { nodeTypeMaxValue = 2; } - switch (taosRand() % 10) { + switch (taosRand() % nodeTypeMaxValue) { case 0: qptMakeColumnNode(ppNode); break; @@ -707,7 +730,7 @@ void qptMakeExprNode(SNode** ppNode) { } void qptResetMakeNodeCtx(SDataBlockDescNode* pInput, bool onlyTag) { - SQPTMakeNodeCtx* pCtx = &qptCtx->makeCtx; + SQPTMakePlanCtx* pCtx = &qptCtx.makeCtx; pCtx->nodeLevel = 1; pCtx->onlyTag = onlyTag; @@ -716,18 +739,24 @@ void qptResetMakeNodeCtx(SDataBlockDescNode* pInput, bool onlyTag) { SNode* qptMakeConditionNode(bool onlyTag) { SNode* pNode = NULL; - qptResetMakeNodeCtx(qptCtx->buildCtx.pCurr->pOutputDataBlockDesc, onlyTag); + qptResetMakeNodeCtx(qptCtx.buildCtx.pCurr->pOutputDataBlockDesc, onlyTag); qptMakeExprNode(&pNode); return pNode; } +SNode* qptMakeDataBlockDescNode() { + SDataBlockDescNode* pDesc = NULL; + assert(0 == nodesMakeNode(QUERY_NODE_DATABLOCK_DESC, (SNode**)&pDesc)); + pDesc->dataBlockId = qptCtx.makeCtx.nextBlockId++; + pDesc->precision = qptCtx.param.db.precision; + + return (SNode*)pDesc; +} + SPhysiNode* qptCreatePhysiNode(int32_t nodeType) { SPhysiNode* pPhysiNode = NULL; - int32_t code = nodesMakeNode(nodeType, (SNode**)&pPhysiNode); - if (NULL == pPhysiNode) { - assert(0); - } + assert(0 == nodesMakeNode((ENodeType)nodeType, (SNode**)&pPhysiNode)); qptCtx.buildCtx.pCurr = pPhysiNode; @@ -736,8 +765,8 @@ SPhysiNode* qptCreatePhysiNode(int32_t nodeType) { pPhysiNode->dynamicOp = qptGetDynamicOp(); pPhysiNode->inputTsOrder = qptGetInputTsOrder(); - assert(0 == createDataBlockDesc(qptCtx->buildCtx.pCxt, NULL, &pPhysiNode->pOutputDataBlockDesc)); - pPhysiNode->pOutputDataBlockDesc->precision = qptCtx->param.db.precision; + pPhysiNode->pOutputDataBlockDesc = (SDataBlockDescNode*)qptMakeDataBlockDescNode(); + assert(pPhysiNode->pOutputDataBlockDesc); return pPhysiNode; } @@ -772,10 +801,10 @@ void qptMarkTableInUseCols(int32_t colNum, int32_t totalColNum, SQPTCol* pCol) { } void qptCreateTableScanColsImpl( SScanPhysiNode* pScanPhysiNode, SNodeList** ppCols, int32_t totalColNum, SQPTCol* pCol) { - int32_t colNum = qptCtx->pCfg->correctExpected ? (taosRand() % totalColNum + 1) : (taosRand()); + int32_t colNum = qptCtx.param.correctExpected ? (taosRand() % totalColNum + 1) : (taosRand()); int32_t colAdded = 0; - if (qptCtx->pCfg->correctExpected) { + if (qptCtx.param.correctExpected) { qptMarkTableInUseCols(colNum, totalColNum, pCol); for (int32_t i = 0; i < totalColNum && colAdded < colNum; ++i) { if (0 == pCol[i].inUse) { @@ -798,53 +827,97 @@ void qptCreateTableScanColsImpl( SScanPhysiNode* pScanPhysiNode, SNodeList void qptCreateTableScanCols( SScanPhysiNode* pScanPhysiNode) { - qptCreateTableScanColsImpl(pScanPhysiNode, &pScanPhysiNode->pScanCols, qptCtx->param.tbl.colNum, qptCtx.param->tbl.pCol); + qptCreateTableScanColsImpl(pScanPhysiNode, &pScanPhysiNode->pScanCols, qptCtx.param.tbl.colNum, qptCtx.param.tbl.pCol); } void qptCreateTableScanPseudoCols( SScanPhysiNode* pScanPhysiNode) { - qptCreateTableScanColsImpl(pScanPhysiNode, &pScanPhysiNode->pScanPseudoCols, qptCtx->param.tbl.tagNum, qptCtx->param.tbl.pTag); + qptCreateTableScanColsImpl(pScanPhysiNode, &pScanPhysiNode->pScanPseudoCols, qptCtx.param.tbl.tagNum, qptCtx.param.tbl.pTag); +} + +SNode* qptMakeSlotDescNode(const char* pName, const SNode* pNode, int16_t slotId, bool output, bool reserve) { + SSlotDescNode* pSlot = NULL; + assert(0 == nodesMakeNode(QUERY_NODE_SLOT_DESC, (SNode**)&pSlot)); + snprintf(pSlot->name, sizeof(pSlot->name), "%s", pName); + pSlot->slotId = slotId; + pSlot->dataType = ((SExprNode*)pNode)->resType; + pSlot->reserve = reserve; + pSlot->output = output; + return (SNode*)pSlot; +} + +void qptCreateMakeNode(SNode* pNode, int16_t dataBlockId, int16_t slotId, SNode** pOutput) { + STargetNode* pTarget = NULL; + assert(0 == nodesMakeNode(QUERY_NODE_TARGET, (SNode**)&pTarget)); + + pTarget->dataBlockId = dataBlockId; + pTarget->slotId = slotId; + pTarget->pExpr = pNode; + + *pOutput = (SNode*)pTarget; +} + +void qptAddDataBlockSlots(SNodeList* pList, SDataBlockDescNode* pDataBlockDesc) { + int16_t nextSlotId = LIST_LENGTH(pDataBlockDesc->pSlots), slotId = 0; + SNode* pNode = NULL; + bool output = QPT_RAND_BOOL_V; + + FOREACH(pNode, pList) { + SNode* pExpr = QUERY_NODE_ORDER_BY_EXPR == nodeType(pNode) ? ((SOrderByExprNode*)pNode)->pExpr : pNode; + assert(0 == nodesListMakeStrictAppend(&pDataBlockDesc->pSlots, qptMakeSlotDescNode(NULL, pExpr, nextSlotId, output, QPT_RAND_BOOL_V))); + pDataBlockDesc->totalRowSize += ((SExprNode*)pExpr)->resType.bytes; + if (output) { + pDataBlockDesc->outputRowSize += ((SExprNode*)pExpr)->resType.bytes; + } + + slotId = nextSlotId; + ++nextSlotId; + + SNode* pTarget = NULL; + qptCreateMakeNode(pNode, pDataBlockDesc->dataBlockId, slotId, &pTarget); + REPLACE_NODE(pTarget); + } } void qptCreateScanPhysiNodeImpl( SScanPhysiNode* pScanPhysiNode) { qptCreateTableScanCols(pScanPhysiNode); - assert(0 == addDataBlockSlots(qptCtx->buildCtx.pCxt, pScanPhysiNode->pScanCols, pScanPhysiNode->node.pOutputDataBlockDesc)); + qptAddDataBlockSlots(pScanPhysiNode->pScanCols, pScanPhysiNode->node.pOutputDataBlockDesc); if (taosRand() % 2) { qptCreateTableScanPseudoCols(pScanPhysiNode); } - assert(0 == addDataBlockSlots(qptCtx->buildCtx.pCxt, pScanPhysiNode->pScanPseudoCols, pScanPhysiNode->node.pOutputDataBlockDesc)); + qptAddDataBlockSlots(pScanPhysiNode->pScanPseudoCols, pScanPhysiNode->node.pOutputDataBlockDesc); - pScanPhysiNode->uid = qptCtx->param.tbl.uid; - pScanPhysiNode->suid = qptCtx->param.tbl.suid; - pScanPhysiNode->tableType = qptCtx->param.tbl.tblType; - pScanPhysiNode->groupOrderScan = (taosRand() % 2) : true : false; + pScanPhysiNode->uid = qptCtx.param.tbl.uid; + pScanPhysiNode->suid = qptCtx.param.tbl.suid; + pScanPhysiNode->tableType = qptCtx.param.tbl.tblType; + pScanPhysiNode->groupOrderScan = (taosRand() % 2) ? true : false; SName tblName = {0}; - toName(1, qptCtx->param.db.dbName, qptCtx->param.tbl.tblName, &tblName); + toName(1, qptCtx.param.db.dbName, qptCtx.param.tbl.tblName, &tblName); memcpy(&pScanPhysiNode->tableName, &tblName, sizeof(SName)); } -STagScanPhysiNode* qptCreateTagScanPhysiNode(int32_t nodeType) { +SNode* qptCreateTagScanPhysiNode(int32_t nodeType) { SPhysiNode* pPhysiNode = qptCreatePhysiNode(nodeType); assert(pPhysiNode); STagScanPhysiNode* pTagScanNode = (STagScanPhysiNode*)pPhysiNode; - pTagScanNode->onlyMetaCtbIdx = (taosRand() % 2) : true : false; + pTagScanNode->onlyMetaCtbIdx = (taosRand() % 2) ? true : false; qptCreateScanPhysiNodeImpl(&pTagScanNode->scan); qptPostCreatePhysiNode(pPhysiNode); - return pPhysiNode; + return (SNode*)pPhysiNode; } -SSortMergeJoinPhysiNode* qptCreateSortMergeJoinPhysiNode(int32_t nodeType) { +SNode* qptCreateSortMergeJoinPhysiNode(int32_t nodeType) { SPhysiNode* pPhysiNode = qptCreatePhysiNode(nodeType); assert(pPhysiNode); @@ -913,13 +986,13 @@ SSortMergeJoinPhysiNode* qptCreateSortMergeJoinPhysiNode(int32_t nodeType) { createBlockDescNode(&p->node.pOutputDataBlockDesc); */ - return pPhysiNode; + return (SNode*)pPhysiNode; } -SPhysiNode* qptCreatePhysicalPlanNode(int32_t nodeType) { +SNode* qptCreatePhysicalPlanNode(int32_t nodeType) { switch (nodeType) { case QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN: - return qptCreateTagScanPhysiNode(nodeType); + return (SNode*)qptCreateTagScanPhysiNode(nodeType); case QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN: case QUERY_NODE_PHYSICAL_PLAN_TABLE_SEQ_SCAN: case QUERY_NODE_PHYSICAL_PLAN_TABLE_MERGE_SCAN: @@ -929,7 +1002,7 @@ SPhysiNode* qptCreatePhysicalPlanNode(int32_t nodeType) { case QUERY_NODE_PHYSICAL_PLAN_LAST_ROW_SCAN: case QUERY_NODE_PHYSICAL_PLAN_PROJECT: case QUERY_NODE_PHYSICAL_PLAN_MERGE_JOIN: - return qptCreateSortMergeJoinPhysiNode(nodeType); + return (SNode*)qptCreateSortMergeJoinPhysiNode(nodeType); case QUERY_NODE_PHYSICAL_PLAN_HASH_AGG: case QUERY_NODE_PHYSICAL_PLAN_EXCHANGE: case QUERY_NODE_PHYSICAL_PLAN_MERGE: @@ -975,8 +1048,8 @@ SPhysiNode* qptCreatePhysicalPlanNode(int32_t nodeType) { return 0; } -int32_t qptCreateQueryPlan(SNode** ppPlan) { - +void qptCreateQueryPlan(SNode** ppPlan) { + } @@ -987,19 +1060,23 @@ void qptRerunBlockedHere() { } void qptResetForReRun() { - + for (int32_t i = 0; i < qptCtx.param.tbl.colNum; ++i) { + qptCtx.param.tbl.pCol[i].inUse = 0; + } + for (int32_t i = 0; i < qptCtx.param.tbl.tagNum; ++i) { + qptCtx.param.tbl.pTag[i].inUse = 0; + } } void qptSingleTestDone(bool* contLoop) { - destroyOperator(jtCtx.pJoinOp); - jtCtx.pJoinOp = NULL; - +/* if (jtRes.succeed) { *contLoop = false; return; } - - if (jtErrorRerun) { +*/ + + if (qptErrorRerun) { *contLoop = false; return; } @@ -1036,44 +1113,133 @@ void qptRunPlanTest(char* caseName) { SReadHandle readHandle = {0}; SOperatorInfo* pOperator = NULL; - if (qptCtx->param.plan.singlePhysiNode) { - pNode = (SNode*)qptCreatePhysicalPlanNode(qptCtx->param.plan.subplanType[0]); + if (qptCtx.loopIdx > 0) { + qptResetForReRun(); + } + + if (qptCtx.param.plan.singlePhysiNode) { + pNode = (SNode*)qptCreatePhysicalPlanNode(qptCtx.param.plan.subplanType[0]); } qptPrintBeginInfo(caseName); qptCtx.startTsUs = taosGetTimestampUs(); - int32_t code = createTagScanOperatorInfo(&readHandle, (STagScanPhysiNode*)pNode, NULL, NULL, NULL, NULL, &pOperator); + qptCtx.result.code = createTagScanOperatorInfo(&readHandle, (STagScanPhysiNode*)pNode, NULL, NULL, NULL, NULL, &pOperator); destroyOperator(pOperator); nodesDestroyNode((SNode*)pNode); + qptPrintEndInfo(caseName); + qptHandleTestEnd(); } SQPTNodeParam* qptInitNodeParam(int32_t nodeType) { + return NULL; +} +int32_t qptGetColumnRandLen(int32_t colType) { + switch (colType) { + case TSDB_DATA_TYPE_NULL: + case TSDB_DATA_TYPE_BOOL: + case TSDB_DATA_TYPE_TINYINT: + case TSDB_DATA_TYPE_SMALLINT: + case TSDB_DATA_TYPE_INT: + case TSDB_DATA_TYPE_BIGINT: + case TSDB_DATA_TYPE_TIMESTAMP: + case TSDB_DATA_TYPE_FLOAT: + case TSDB_DATA_TYPE_DOUBLE: + case TSDB_DATA_TYPE_UTINYINT: + case TSDB_DATA_TYPE_USMALLINT: + case TSDB_DATA_TYPE_UINT: + case TSDB_DATA_TYPE_UBIGINT: + return tDataTypes[colType].bytes; + case TSDB_DATA_TYPE_VARCHAR: + case TSDB_DATA_TYPE_GEOMETRY: + case TSDB_DATA_TYPE_JSON: + case TSDB_DATA_TYPE_VARBINARY: + case TSDB_DATA_TYPE_DECIMAL: + case TSDB_DATA_TYPE_BLOB: + case TSDB_DATA_TYPE_MEDIUMBLOB: + case TSDB_DATA_TYPE_NCHAR: + return taosRand() % TSDB_MAX_BINARY_LEN; + default: + assert(0); + break; + } +} + +void qptInitTableCols(SQPTCol* pCol, int32_t colNum, EColumnType colType) { + int32_t tbnameIdx = -1; + if (QPT_RAND_BOOL_V && COLUMN_TYPE_TAG == colType) { + tbnameIdx = taosRand() % colNum; + } + + for (int32_t i = 0; i < colNum; ++i) { + if (tbnameIdx >= 0 && i == tbnameIdx) { + strcpy(pCol[i].name, "tbname"); + pCol[i].type = TSDB_DATA_TYPE_VARCHAR; + pCol[i].len = qptGetColumnRandLen(pCol[i].type); + pCol[i].inUse = 0; + pCol[i].hasIndex = QPT_RAND_BOOL_V; + pCol[i].isPrimTs = QPT_RAND_BOOL_V; + pCol[i].isPk = QPT_RAND_BOOL_V; + pCol[i].colType = COLUMN_TYPE_TBNAME; + continue; + } + + sprintf(pCol[i].name, "col%d", i); + pCol[i].type = taosRand() % TSDB_DATA_TYPE_MAX; + pCol[i].len = qptGetColumnRandLen(pCol[i].type); + pCol[i].inUse = 0; + pCol[i].hasIndex = QPT_RAND_BOOL_V; + pCol[i].isPrimTs = QPT_RAND_BOOL_V; + pCol[i].isPk = QPT_RAND_BOOL_V; + pCol[i].colType = colType; + } } void qptInitTestCtx(bool correctExpected, bool singleNode, int32_t nodeType, int32_t paramNum, SQPTNodeParam* nodeParam) { - qptCtx->param.correctExpected = correctExpected; - qptCtx->param.plan.singlePhysiNode = singleNode; + qptCtx.param.correctExpected = correctExpected; + qptCtx.param.plan.singlePhysiNode = singleNode; if (singleNode) { - qptCtx->param.plan.subplanMaxLevel = 1; - qptCtx->param.plan.subplanType[0] = nodeType; + qptCtx.param.plan.subplanMaxLevel = 1; + qptCtx.param.plan.subplanType[0] = nodeType; } else { - qptCtx->param.plan.subplanMaxLevel = taosRand() % QPT_MAX_SUBPLAN_LEVEL + 1; - for (int32_t i = 0; i < qptCtx->param.plan.subplanMaxLevel; ++i) { - qptCtx->param.plan.subplanType[i] = QPT_PHYSIC_NODE_LIST[taosRand() % QPT_PHYSIC_NODE_NUM()]; + qptCtx.param.plan.subplanMaxLevel = taosRand() % QPT_MAX_SUBPLAN_LEVEL + 1; + for (int32_t i = 0; i < qptCtx.param.plan.subplanMaxLevel; ++i) { + qptCtx.param.plan.subplanType[i] = QPT_PHYSIC_NODE_LIST[taosRand() % QPT_PHYSIC_NODE_NUM()]; } } if (paramNum > 0) { - qptCtx->param.plan.physiNodeParamNum = paramNum; - qptCtx->param.plan.physicNodeParam = nodeParam; + qptCtx.param.plan.physiNodeParamNum = paramNum; + qptCtx.param.plan.physicNodeParam = nodeParam; } + + qptCtx.param.db.precision = TSDB_TIME_PRECISION_MILLI; + strcpy(qptCtx.param.db.dbName, "qptdb1"); + + qptCtx.param.vnode.vnodeNum = QPT_DEFAULT_VNODE_NUM; + + qptCtx.param.tbl.uid = 100; + qptCtx.param.tbl.suid = 1; + qptCtx.param.tbl.tblType = taosRand() % TSDB_TABLE_MAX; + qptCtx.param.tbl.colNum = taosRand() % 4098; + qptCtx.param.tbl.tagNum = taosRand() % 130; + qptCtx.param.tbl.pkNum = taosRand() % 2; + strcpy(qptCtx.param.tbl.tblName, "qpttbl1"); + strcpy(qptCtx.param.tbl.tblName, "tbl1"); + qptCtx.param.tbl.pCol = (SQPTCol*)taosMemoryCalloc(qptCtx.param.tbl.colNum, sizeof(*qptCtx.param.tbl.pCol)); + assert(qptCtx.param.tbl.pCol); + qptInitTableCols(qptCtx.param.tbl.pCol, qptCtx.param.tbl.colNum, COLUMN_TYPE_COLUMN); + + qptCtx.param.tbl.pTag = (SQPTCol*)taosMemoryCalloc(qptCtx.param.tbl.tagNum, sizeof(*qptCtx.param.tbl.pTag)); + assert(qptCtx.param.tbl.pTag); + qptInitTableCols(qptCtx.param.tbl.pTag, qptCtx.param.tbl.tagNum, COLUMN_TYPE_TAG); + } diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c index 976d15e7d8ba..194e8caf5583 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -1860,6 +1860,11 @@ static int32_t translateIrate(SFunctionNode* pFunc, char* pErrBuf, int32_t len) } static int32_t translateIrateImpl(SFunctionNode* pFunc, char* pErrBuf, int32_t len, bool isPartial) { + int32_t numOfParams = LIST_LENGTH(pFunc->pParameterList); + if (numOfParams <= 0) { + return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); + } + uint8_t colType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type; if (isPartial) { if (3 != LIST_LENGTH(pFunc->pParameterList) && 4 != LIST_LENGTH(pFunc->pParameterList)) { @@ -1903,7 +1908,7 @@ static int32_t translateInterp(SFunctionNode* pFunc, char* pErrBuf, int32_t len) int32_t numOfParams = LIST_LENGTH(pFunc->pParameterList); uint8_t dbPrec = pFunc->node.resType.precision; - if (2 < numOfParams) { + if (2 < numOfParams || numOfParams <= 0) { return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); } @@ -1986,6 +1991,9 @@ static EFuncReturnRows interpEstReturnRows(SFunctionNode* pFunc) { static int32_t translateFirstLast(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { // forbid null as first/last input, since first(c0, null, 1) may have different number of input int32_t numOfParams = LIST_LENGTH(pFunc->pParameterList); + if (numOfParams <= 0) { + return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); + } for (int32_t i = 0; i < numOfParams; ++i) { uint8_t nodeType = nodeType(nodesListGetNode(pFunc->pParameterList, i)); @@ -2000,6 +2008,11 @@ static int32_t translateFirstLast(SFunctionNode* pFunc, char* pErrBuf, int32_t l } static int32_t translateFirstLastImpl(SFunctionNode* pFunc, char* pErrBuf, int32_t len, bool isPartial) { + int32_t numOfParams = LIST_LENGTH(pFunc->pParameterList); + if (numOfParams <= 0) { + return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); + } + // first(col_list) will be rewritten as first(col) SNode* pPara = nodesListGetNode(pFunc->pParameterList, 0); uint8_t paraType = getSDataTypeFromNode(pPara)->type; @@ -2035,6 +2048,11 @@ static int32_t translateFirstLastMerge(SFunctionNode* pFunc, char* pErrBuf, int3 } static int32_t translateFirstLastState(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { + int32_t numOfParams = LIST_LENGTH(pFunc->pParameterList); + if (numOfParams <= 0) { + return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); + } + SNode* pPara = nodesListGetNode(pFunc->pParameterList, 0); int32_t paraBytes = getSDataTypeFromNode(pPara)->bytes; @@ -2045,6 +2063,11 @@ static int32_t translateFirstLastState(SFunctionNode* pFunc, char* pErrBuf, int3 } static int32_t translateFirstLastStateMerge(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { + int32_t numOfParams = LIST_LENGTH(pFunc->pParameterList); + if (numOfParams <= 0) { + return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); + } + SNode* pPara = nodesListGetNode(pFunc->pParameterList, 0); int32_t paraBytes = getSDataTypeFromNode(pPara)->bytes; uint8_t paraType = getSDataTypeFromNode(pPara)->type; @@ -2081,11 +2104,16 @@ static int32_t translateMode(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { static int32_t translateDiff(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { int32_t numOfParams = LIST_LENGTH(pFunc->pParameterList); - if (numOfParams > 2) { + if (numOfParams > 2 || numOfParams <= 0) { return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); } - uint8_t colType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type; + SDataType* pDataType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0)); + if (NULL == pDataType) { + return buildFuncErrMsg(pErrBuf, len, TSDB_CODE_FUNC_FUNTION_ERROR, "Invalid first parameter for DIFF function."); + } + + uint8_t colType = pDataType->type; if (!IS_INTEGER_TYPE(colType) && !IS_FLOAT_TYPE(colType) && TSDB_DATA_TYPE_BOOL != colType && !IS_TIMESTAMP_TYPE(colType)) { return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); @@ -2432,6 +2460,11 @@ static int32_t translateRepeat(SFunctionNode* pFunc, char* pErrBuf, int32_t len) } static int32_t translateCast(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { + int32_t numOfParams = LIST_LENGTH(pFunc->pParameterList); + if (numOfParams <= 0) { + return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); + } + // The number of parameters has been limited by the syntax definition SExprNode* pPara0 = (SExprNode*)nodesListGetNode(pFunc->pParameterList, 0); @@ -2835,6 +2868,11 @@ static int32_t translateIn2GeomOutBool(SFunctionNode* pFunc, char* pErrBuf, int3 } static int32_t translateSelectValue(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { + int32_t numOfParams = LIST_LENGTH(pFunc->pParameterList); + if (numOfParams <= 0) { + return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); + } + pFunc->node.resType = ((SExprNode*)nodesListGetNode(pFunc->pParameterList, 0))->resType; return TSDB_CODE_SUCCESS; } diff --git a/source/libs/planner/inc/planInt.h b/source/libs/planner/inc/planInt.h index beb277493cb6..59e771454c68 100644 --- a/source/libs/planner/inc/planInt.h +++ b/source/libs/planner/inc/planInt.h @@ -24,6 +24,18 @@ extern "C" { #include "tsimplehash.h" #include "taoserror.h" + +typedef struct SPhysiPlanContext { + SPlanContext* pPlanCxt; + int32_t errCode; + int16_t nextDataBlockId; + SArray* pLocationHelper; + SArray* pProjIdxLocHelper; + bool hasScan; + bool hasSysScan; +} SPhysiPlanContext; + + #define planFatal(param, ...) qFatal("PLAN: " param, ##__VA_ARGS__) #define planError(param, ...) qError("PLAN: " param, ##__VA_ARGS__) #define planWarn(param, ...) qWarn("PLAN: " param, ##__VA_ARGS__) diff --git a/source/libs/planner/src/planPhysiCreater.c b/source/libs/planner/src/planPhysiCreater.c index 2b0f449b7732..a2f45c92eccb 100644 --- a/source/libs/planner/src/planPhysiCreater.c +++ b/source/libs/planner/src/planPhysiCreater.c @@ -30,15 +30,6 @@ typedef struct SSlotIndex { SArray* pSlotIdsInfo; // duplicate name slot } SSlotIndex; -typedef struct SPhysiPlanContext { - SPlanContext* pPlanCxt; - int32_t errCode; - int16_t nextDataBlockId; - SArray* pLocationHelper; - SArray* pProjIdxLocHelper; - bool hasScan; - bool hasSysScan; -} SPhysiPlanContext; static int32_t getSlotKey(SNode* pNode, const char* pStmtName, char** ppKey, int32_t *pLen, uint16_t extraBufLen) { int32_t code = 0; From 370fb56a0d064e056400ae3dd37e4733eed4faac Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Fri, 27 Sep 2024 18:24:28 +0800 Subject: [PATCH 081/695] add ci --- source/libs/executor/src/groupoperator.c | 1 + .../executor/src/streamtimesliceoperator.c | 4 +- .../stream/streamInterpForceWindowClose1.sim | 315 ++++++++++++++++++ 3 files changed, 319 insertions(+), 1 deletion(-) create mode 100644 tests/script/tsim/stream/streamInterpForceWindowClose1.sim diff --git a/source/libs/executor/src/groupoperator.c b/source/libs/executor/src/groupoperator.c index 1c9279b84fd2..0d8511827175 100644 --- a/source/libs/executor/src/groupoperator.c +++ b/source/libs/executor/src/groupoperator.c @@ -1503,6 +1503,7 @@ static int32_t doStreamHashPartitionNext(SOperatorInfo* pOperator, SSDataBlock** case STREAM_CREATE_CHILD_TABLE: case STREAM_RETRIEVE: case STREAM_CHECKPOINT: + case STREAM_GET_RESULT: case STREAM_GET_ALL: { (*ppRes) = pBlock; return code; diff --git a/source/libs/executor/src/streamtimesliceoperator.c b/source/libs/executor/src/streamtimesliceoperator.c index 8dcaa007f6a7..d03f4fba3873 100644 --- a/source/libs/executor/src/streamtimesliceoperator.c +++ b/source/libs/executor/src/streamtimesliceoperator.c @@ -967,7 +967,9 @@ static void setForceWindowCloseFillRule(SStreamFillSupporter* pFillSup, SStreamF } else { pFillInfo->pos = FILL_POS_INVALID; setFillKeyInfo(ts, ts + 1, &pFillSup->interval, pFillInfo); - copyNonFillValueInfo(pFillSup, pFillInfo); + if (pFillSup->cur.pRowVal != NULL) { + copyNonFillValueInfo(pFillSup, pFillInfo); + } } } break; case TSDB_FILL_PREV: { diff --git a/tests/script/tsim/stream/streamInterpForceWindowClose1.sim b/tests/script/tsim/stream/streamInterpForceWindowClose1.sim new file mode 100644 index 000000000000..f0147c3f021f --- /dev/null +++ b/tests/script/tsim/stream/streamInterpForceWindowClose1.sim @@ -0,0 +1,315 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sleep 50 +sql connect + +print step prev +print =============== create database +sql create database test vgroups 3; +sql use test; +sql create stable st(ts timestamp,a int,b int,c int, d double) tags(ta int,tb int,tc int); + +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); +sql create table t3 using st tags(2,2,2); + +sql create stream streams1 trigger force_window_close IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _irowts, interp(a) as a, _isfilled, tbname, b, c from st partition by tbname, b,c every(5s) fill(prev); + +run tsim/stream/checkTaskStatus.sim + +sql insert into t1 values(now,1,1,1,1.0) (now + 10s,2,1,1,2.0)(now + 20s,3,1,1,3.0) +sql insert into t2 values(now,21,1,1,1.0) (now + 10s,22,1,1,2.0)(now + 20s,23,1,1,3.0) +sql insert into t3 values(now,31,1,1,1.0) (now + 10s,32,1,1,2.0)(now + 20s,33,1,1,3.0) + +print sql select * from t1; +sql select * from t1; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +print sql select * from t2; +sql select * from t2; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +print sql select * from t3; +sql select * from t3; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 +loop0: + +sleep 2000 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 2 sql select * from streamt where a == 1; +sql select * from streamt where a == 1; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +# row 0 +if $rows < 2 then + print ======rows=$rows + goto loop0 +endi + +$loop_count = 0 +loop1: + +sleep 2000 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 2 sql select * from streamt where a == 2; +sql select * from streamt where a == 2; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows < 2 then + print ======rows=$rows + goto loop1 +endi + +$loop_count = 0 +loop2: + +sleep 2000 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 2 sql select * from streamt where a == 3; +sql select * from streamt where a == 3; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows < 2 then + print ======rows=$rows + goto loop2 +endi + +sleep 4000 + +$loop_count = 0 +loop3: + +sleep 2000 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 2 sql select * from streamt where a == 3; +sql select * from streamt where a == 3; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows < 5 then + print ======rows=$rows + goto loop3 +endi + +print step2 +print =============== create database +sql create database test2 vgroups 1; +sql use test2; + +sql create stable st(ts timestamp,a int,b int,c int, d double) tags(ta int,tb int,tc int); + +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); +sql create table t3 using st tags(2,2,2); + +sql create stream streams2 trigger force_window_close IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _irowts, interp(a) as a, _isfilled, tbname, b, c from st partition by tbname, b,c every(2s) fill(NULL); + +run tsim/stream/checkTaskStatus.sim + +sql insert into t1 values(now,1,1,1,1.0) (now + 10s,2,1,1,2.0)(now + 20s,3,1,1,3.0) +sql insert into t2 values(now,21,1,1,1.0) (now + 10s,22,1,1,2.0)(now + 20s,23,1,1,3.0) +sql insert into t3 values(now,31,1,1,1.0) (now + 10s,32,1,1,2.0)(now + 20s,33,1,1,3.0) + +print sql select * from t1; +sql select * from t1; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +print sql select * from t2; +sql select * from t2; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +print sql select * from t3; +sql select * from t3; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 +loop4: + +sleep 2000 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 2 sql select * from streamt where a is null; +sql select * from streamt where a is null; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows < 5 then + print ======rows=$rows + goto loop4 +endi + +print step3 +print =============== create database +sql create database test3 vgroups 1; +sql use test3; + +sql create stable st(ts timestamp,a int,b int,c int, d double) tags(ta int,tb int,tc int); + +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); +sql create table t3 using st tags(2,2,2); + +sql create stream streams3 trigger force_window_close IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _irowts, interp(a) as a, _isfilled, tbname, b, c from st partition by tbname, b,c every(2s) fill(value,100,200); + +run tsim/stream/checkTaskStatus.sim + + +sql insert into t1 values(now,1,1,1,1.0) (now + 10s,2,1,1,2.0)(now + 20s,3,1,1,3.0) +sql insert into t2 values(now,21,1,1,1.0) (now + 10s,22,1,1,2.0)(now + 20s,23,1,1,3.0) +sql insert into t3 values(now,31,1,1,1.0) (now + 10s,32,1,1,2.0)(now + 20s,33,1,1,3.0) + +print sql select * from t1; +sql select * from t1; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +print sql select * from t2; +sql select * from t2; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +print sql select * from t3; +sql select * from t3; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 +loop4: + +sleep 2000 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 2 sql select * from streamt where a == 100; +sql select * from streamt where a == 100; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows < 5 then + print ======rows=$rows + goto loop4 +endi + +print end + +system sh/exec.sh -n dnode1 -s stop -x SIGINT From 511e1c8f1ad6ec233a5d91837b1208adbe026da7 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Sun, 29 Sep 2024 16:33:36 +0800 Subject: [PATCH 082/695] valid iter --- source/libs/stream/src/streamBackendRocksdb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/stream/src/streamBackendRocksdb.c b/source/libs/stream/src/streamBackendRocksdb.c index a2c9012df585..3ec9f005f094 100644 --- a/source/libs/stream/src/streamBackendRocksdb.c +++ b/source/libs/stream/src/streamBackendRocksdb.c @@ -3337,7 +3337,7 @@ int32_t streamStateClear_rocksdb(SStreamState* pState) { return 0; } void streamStateCurNext_rocksdb(SStreamStateCur* pCur) { - if (pCur) { + if (pCur && pCur->iter && rocksdb_iter_valid(pCur->iter)) { rocksdb_iter_next(pCur->iter); } } From a068f807a2a1d645fd0bb06716b33171966c142c Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Sun, 29 Sep 2024 17:04:57 +0800 Subject: [PATCH 083/695] fix: add random test case --- source/libs/executor/test/queryPlanTests.cpp | 535 ++++++++++++------- 1 file changed, 340 insertions(+), 195 deletions(-) diff --git a/source/libs/executor/test/queryPlanTests.cpp b/source/libs/executor/test/queryPlanTests.cpp index 71b21e800678..37d0a797616a 100755 --- a/source/libs/executor/test/queryPlanTests.cpp +++ b/source/libs/executor/test/queryPlanTests.cpp @@ -108,6 +108,8 @@ int32_t QPT_PHYSIC_NODE_LIST[] = { #define QPT_PHYSIC_NODE_NUM() (sizeof(QPT_PHYSIC_NODE_LIST)/sizeof(QPT_PHYSIC_NODE_LIST[0])) #define QPT_RAND_BOOL_V ((taosRand() % 2) ? true : false) +#define QPT_RAND_ORDER_V (QPT_RAND_BOOL_V ? ORDER_ASC : ORDER_DESC) +#define QPT_RAND_INT_V (taosRand() * (QPT_RAND_BOOL_V ? 1 : -1)) typedef struct { ENodeType type; @@ -170,27 +172,26 @@ typedef struct { SPhysiNode* pCurr; SPhysiNode* pChild; EOrder currTsOrder; -} SQPTBuildCtx; +} SQPTBuildPlanCtx; typedef struct { int32_t nodeLevel; bool onlyTag; int16_t nextBlockId; SDataBlockDescNode* pInputDataBlockDesc; -} SQPTMakePlanCtx; +} SQPTMakeNodeCtx; typedef struct { int32_t code; } SQPTExecResult; - typedef struct { - int32_t loopIdx; - SQPTParam param; - SQPTBuildCtx buildCtx; - SQPTMakePlanCtx makeCtx; - SQPTExecResult result; - int64_t startTsUs; + int32_t loopIdx; + SQPTParam param; + SQPTBuildPlanCtx buildCtx; + SQPTMakeNodeCtx makeCtx; + SQPTExecResult result; + int64_t startTsUs; } SQPTCtx; typedef struct { @@ -299,12 +300,208 @@ bool qptGetDynamicOp() { return QPT_RAND_BOOL_V; } -EOrder qptGetInputTsOrder() { - return qptCtx.buildCtx.currTsOrder; +EOrder qptGetCurrTsOrder() { + return qptCtx.param.correctExpected ? qptCtx.buildCtx.currTsOrder : QPT_RAND_ORDER_V; +} + +void qptGetRandValue(int32_t* pType, int32_t* pLen, void** ppVal) { + int32_t typeMax = TSDB_DATA_TYPE_MAX + if (!qptCtx.param.correctExpected) { + typeMax++; + } + + *pType = taosRand() % TSDB_DATA_TYPE_MAX; + switch (*pType) { + case TSDB_DATA_TYPE_NULL: + *pLen = 0; + if (ppVal) { + *ppVal = NULL; + } + break; + case TSDB_DATA_TYPE_BOOL: + *pLen = tDataTypes[*pType].bytes; + if (ppVal) { + *ppVal = taosMemoryMalloc(tDataTypes[*pType].bytes); + assert(*ppVal); + *(bool*)*ppVal = QPT_RAND_BOOL_V; + } + break; + case TSDB_DATA_TYPE_TINYINT: + *pLen = tDataTypes[*pType].bytes; + if (ppVal) { + *ppVal = taosMemoryMalloc(tDataTypes[*pType].bytes); + assert(*ppVal); + *(int8_t*)*ppVal = taosRand(); + } + break; + case TSDB_DATA_TYPE_SMALLINT: + *pLen = tDataTypes[*pType].bytes; + if (ppVal) { + *ppVal = taosMemoryMalloc(tDataTypes[*pType].bytes); + assert(*ppVal); + *(int16_t*)*ppVal = taosRand(); + } + break; + case TSDB_DATA_TYPE_INT: + *pLen = tDataTypes[*pType].bytes; + if (ppVal) { + *ppVal = taosMemoryMalloc(tDataTypes[*pType].bytes); + assert(*ppVal); + *(int32_t*)*ppVal = taosRand(); + } + break; + case TSDB_DATA_TYPE_BIGINT: + case TSDB_DATA_TYPE_TIMESTAMP: + *pLen = tDataTypes[*pType].bytes; + if (ppVal) { + *ppVal = taosMemoryMalloc(tDataTypes[*pType].bytes); + assert(*ppVal); + *(int64_t*)*ppVal = taosRand(); + } + break; + case TSDB_DATA_TYPE_FLOAT: + *pLen = tDataTypes[*pType].bytes; + if (ppVal) { + *ppVal = taosMemoryMalloc(tDataTypes[*pType].bytes); + assert(*ppVal); + *(float*)*ppVal = taosRand(); + } + break; + case TSDB_DATA_TYPE_DOUBLE: + *pLen = tDataTypes[*pType].bytes; + if (ppVal) { + *ppVal = taosMemoryMalloc(tDataTypes[*pType].bytes); + assert(*ppVal); + *(double*)*ppVal = taosRand(); + } + break; + case TSDB_DATA_TYPE_VARCHAR: + case TSDB_DATA_TYPE_GEOMETRY: + case TSDB_DATA_TYPE_JSON: + case TSDB_DATA_TYPE_VARBINARY: + case TSDB_DATA_TYPE_DECIMAL: + case TSDB_DATA_TYPE_BLOB: + case TSDB_DATA_TYPE_MEDIUMBLOB: + *pLen = taosRand() % QPT_MAX_STRING_LEN; + if (ppVal) { + *ppVal = taosMemoryCalloc(1, *pLen + VARSTR_HEADER_SIZE); + assert(*ppVal); + varDataSetLen(*ppVal, *pLen); + memset((char*)*ppVal + VARSTR_HEADER_SIZE, 'A' + taosRand() % 26, *pLen); + } + break; + case TSDB_DATA_TYPE_NCHAR: { + *pLen = taosRand() % QPT_MAX_STRING_LEN; + if (ppVal) { + char* pTmp = (char*)taosMemoryCalloc(1, *pLen + 1); + assert(pTmp); + memset(pTmp, 'A' + taosRand() % 26, *pLen); + *ppVal = taosMemoryCalloc(1, *pLen * TSDB_NCHAR_SIZE + VARSTR_HEADER_SIZE); + assert(*ppVal); + assert(taosMbsToUcs4(pTmp, *pLen, (TdUcs4 *)varDataVal(*ppVal), *pLen * TSDB_NCHAR_SIZE, NULL)); + *pLen *= TSDB_NCHAR_SIZE; + varDataSetLen(*ppVal, *pLen); + taosMemoryFree(pTmp); + } + break; + } + case TSDB_DATA_TYPE_UTINYINT: + *pLen = tDataTypes[*pType].bytes; + if (ppVal) { + *ppVal = taosMemoryMalloc(tDataTypes[*pType].bytes); + assert(*ppVal); + *(uint8_t*)*ppVal = taosRand(); + } + break; + case TSDB_DATA_TYPE_USMALLINT: + *pLen = tDataTypes[*pType].bytes; + if (ppVal) { + *ppVal = taosMemoryMalloc(tDataTypes[*pType].bytes); + assert(*ppVal); + *(uint16_t*)*ppVal = taosRand(); + } + break; + case TSDB_DATA_TYPE_UINT: + *pLen = tDataTypes[*pType].bytes; + if (ppVal) { + *ppVal = taosMemoryMalloc(tDataTypes[*pType].bytes); + assert(*ppVal); + *(uint32_t*)*ppVal = taosRand(); + } + break; + case TSDB_DATA_TYPE_UBIGINT: + *pLen = tDataTypes[*pType].bytes; + if (ppVal) { + *ppVal = taosMemoryMalloc(tDataTypes[*pType].bytes); + assert(*ppVal); + *(uint64_t*)*ppVal = taosRand(); + } + break; + default: + *pLen = taosRand(); + if (ppVal) { + *ppVal = taosMemoryCalloc(1, *pLen); + assert(*ppVal); + memset((char*)*ppVal, 'a' + taosRand() % 26, *pLen); + } + break; + } +} + +void qptFreeRandValue(int32_t* pType, void* pVal) { + switch (*pType) { + case TSDB_DATA_TYPE_BOOL: + case TSDB_DATA_TYPE_TINYINT: + case TSDB_DATA_TYPE_SMALLINT: + case TSDB_DATA_TYPE_INT: + case TSDB_DATA_TYPE_BIGINT: + case TSDB_DATA_TYPE_FLOAT: + case TSDB_DATA_TYPE_DOUBLE: + case TSDB_DATA_TYPE_TIMESTAMP: + case TSDB_DATA_TYPE_UTINYINT: + case TSDB_DATA_TYPE_USMALLINT: + case TSDB_DATA_TYPE_UINT: + case TSDB_DATA_TYPE_UBIGINT: + taosMemoryFree(pVal); + break; + case TSDB_DATA_TYPE_NULL: + case TSDB_DATA_TYPE_VARCHAR: + case TSDB_DATA_TYPE_GEOMETRY: + case TSDB_DATA_TYPE_NCHAR: + case TSDB_DATA_TYPE_JSON: + case TSDB_DATA_TYPE_VARBINARY: + case TSDB_DATA_TYPE_DECIMAL: + case TSDB_DATA_TYPE_BLOB: + case TSDB_DATA_TYPE_MEDIUMBLOB: + break; + default: + assert(0); + break; + } +} + +void qptGetRandRealTableType(int8_t* tableType) { + while (true) { + int8_t tType = taosRand() % TSDB_TABLE_MAX; + switch (tType) { + case TSDB_SUPER_TABLE: + case TSDB_CHILD_TABLE: + case TSDB_NORMAL_TABLE: + case TSDB_SYSTEM_TABLE: + *tableType = tType; + return; + default: + break; + } + } } SNode* qptMakeLimitNode() { + if (QPT_RAND_BOOL_V) { + return NULL; + } + SNode* pNode = NULL; assert(0 == nodesMakeNode(QUERY_NODE_LIMIT, &pNode)); assert(pNode); @@ -329,31 +526,58 @@ SNode* qptMakeLimitNode() { } SNode* qptMakeColumnNodeFromTable(int32_t colIdx, EColumnType colType, SScanPhysiNode* pScanPhysiNode) { + if (colIdx < 0) { + return NULL; + } + SColumnNode* pCol = NULL; assert(0 == nodesMakeNode(QUERY_NODE_COLUMN, (SNode**)&pCol)); assert(pCol); - pCol->node.resType.type = qptCtx.param.tbl.pCol[colIdx].type; - pCol->node.resType.bytes = qptCtx.param.tbl.pCol[colIdx].len; - - pCol->tableId = qptCtx.param.tbl.uid; - pCol->tableType = qptCtx.param.tbl.tblType; - pCol->colId = colIdx; - pCol->projIdx = colIdx; - pCol->colType = qptCtx.param.tbl.pCol[colIdx].colType; - pCol->hasIndex = qptCtx.param.tbl.pCol[colIdx].hasIndex; - pCol->isPrimTs = qptCtx.param.tbl.pCol[colIdx].isPrimTs; - strcpy(pCol->dbName, qptCtx.param.db.dbName); - strcpy(pCol->tableName, qptCtx.param.tbl.tblName); - strcpy(pCol->tableAlias, qptCtx.param.tbl.tblAlias); - strcpy(pCol->colName, qptCtx.param.tbl.pCol[colIdx].name); - pCol->dataBlockId = pScanPhysiNode->node.pOutputDataBlockDesc->dataBlockId; - pCol->slotId = colIdx; - pCol->numOfPKs = qptCtx.param.tbl.pkNum; - pCol->tableHasPk = qptCtx.param.tbl.pkNum > 0; - pCol->isPk = qptCtx.param.tbl.pCol[colIdx].isPk; - pCol->projRefIdx = 0; - pCol->resIdx = 0; + if (qptCtx.param.correctExpected) { + pCol->node.resType.type = qptCtx.param.tbl.pCol[colIdx].type; + pCol->node.resType.bytes = qptCtx.param.tbl.pCol[colIdx].len; + + pCol->tableId = qptCtx.param.tbl.uid; + pCol->tableType = qptCtx.param.tbl.tblType; + pCol->colId = colIdx; + pCol->projIdx = colIdx; + pCol->colType = qptCtx.param.tbl.pCol[colIdx].colType; + pCol->hasIndex = qptCtx.param.tbl.pCol[colIdx].hasIndex; + pCol->isPrimTs = qptCtx.param.tbl.pCol[colIdx].isPrimTs; + strcpy(pCol->dbName, qptCtx.param.db.dbName); + strcpy(pCol->tableName, qptCtx.param.tbl.tblName); + strcpy(pCol->tableAlias, qptCtx.param.tbl.tblAlias); + strcpy(pCol->colName, qptCtx.param.tbl.pCol[colIdx].name); + pCol->dataBlockId = pScanPhysiNode->node.pOutputDataBlockDesc->dataBlockId; + pCol->slotId = colIdx; + pCol->numOfPKs = qptCtx.param.tbl.pkNum; + pCol->tableHasPk = qptCtx.param.tbl.pkNum > 0; + pCol->isPk = qptCtx.param.tbl.pCol[colIdx].isPk; + pCol->projRefIdx = 0; + pCol->resIdx = 0; + } else { + qptGetRandValue(&pCol->node.resType.type, &pCol->node.resType.bytes, NULL); + + pCol->tableId = taosRand(); + pCol->tableType = taosRand() % TSDB_TABLE_MAX; + pCol->colId = QPT_RAND_BOOL_V ? taosRand() : colIdx; + pCol->projIdx = taosRand(); + pCol->colType = QPT_RAND_BOOL_V ? qptCtx.param.tbl.pCol[colIdx].colType :taosRand() % (COLUMN_TYPE_GROUP_KEY + 1); + pCol->hasIndex = QPT_RAND_BOOL_V; + pCol->isPrimTs = QPT_RAND_BOOL_V; + QPT_RAND_BOOL_V ? (pCol->dbName[0] = 0) : strcpy(pCol->dbName, qptCtx.param.db.dbName); + QPT_RAND_BOOL_V ? (pCol->tableName[0] = 0) : strcpy(pCol->tableName, qptCtx.param.tbl.tblName); + QPT_RAND_BOOL_V ? (pCol->tableAlias[0] = 0) : strcpy(pCol->tableAlias, qptCtx.param.tbl.tblAlias); + QPT_RAND_BOOL_V ? (pCol->colName[0] = 0) : strcpy(pCol->colName, qptCtx.param.tbl.pCol[colIdx].name); + pCol->dataBlockId = QPT_RAND_BOOL_V ? taosRand() : pScanPhysiNode->node.pOutputDataBlockDesc->dataBlockId; + pCol->slotId = QPT_RAND_BOOL_V ? taosRand() : colIdx; + pCol->numOfPKs = QPT_RAND_BOOL_V ? taosRand() : qptCtx.param.tbl.pkNum; + pCol->tableHasPk = QPT_RAND_BOOL_V ? QPT_RAND_BOOL_V : (qptCtx.param.tbl.pkNum > 0); + pCol->isPk = QPT_RAND_BOOL_V ? QPT_RAND_BOOL_V : qptCtx.param.tbl.pCol[colIdx].isPk; + pCol->projRefIdx = taosRand(); + pCol->resIdx = taosRand(); + } return (SNode*)pCol; } @@ -461,143 +685,7 @@ void qptMakeColumnNode(SNode** ppNode) { *ppNode = (SNode*)pCol; } -void qptGetRandValue(int32_t* pType, int32_t* pLen, void** ppVal) { - *pType = taosRand() % TSDB_DATA_TYPE_MAX; - switch (*pType) { - case TSDB_DATA_TYPE_NULL: - *pLen = 0; - *ppVal = NULL; - break; - case TSDB_DATA_TYPE_BOOL: - *pLen = tDataTypes[*pType].bytes; - *ppVal = taosMemoryMalloc(tDataTypes[*pType].bytes); - assert(*ppVal); - *(bool*)*ppVal = QPT_RAND_BOOL_V; - break; - case TSDB_DATA_TYPE_TINYINT: - *pLen = tDataTypes[*pType].bytes; - *ppVal = taosMemoryMalloc(tDataTypes[*pType].bytes); - assert(*ppVal); - *(int8_t*)*ppVal = taosRand(); - break; - case TSDB_DATA_TYPE_SMALLINT: - *pLen = tDataTypes[*pType].bytes; - *ppVal = taosMemoryMalloc(tDataTypes[*pType].bytes); - assert(*ppVal); - *(int16_t*)*ppVal = taosRand(); - break; - case TSDB_DATA_TYPE_INT: - *pLen = tDataTypes[*pType].bytes; - *ppVal = taosMemoryMalloc(tDataTypes[*pType].bytes); - assert(*ppVal); - *(int32_t*)*ppVal = taosRand(); - break; - case TSDB_DATA_TYPE_BIGINT: - case TSDB_DATA_TYPE_TIMESTAMP: - *pLen = tDataTypes[*pType].bytes; - *ppVal = taosMemoryMalloc(tDataTypes[*pType].bytes); - assert(*ppVal); - *(int64_t*)*ppVal = taosRand(); - break; - case TSDB_DATA_TYPE_FLOAT: - *pLen = tDataTypes[*pType].bytes; - *ppVal = taosMemoryMalloc(tDataTypes[*pType].bytes); - assert(*ppVal); - *(float*)*ppVal = taosRand(); - break; - case TSDB_DATA_TYPE_DOUBLE: - *pLen = tDataTypes[*pType].bytes; - *ppVal = taosMemoryMalloc(tDataTypes[*pType].bytes); - assert(*ppVal); - *(double*)*ppVal = taosRand(); - break; - case TSDB_DATA_TYPE_VARCHAR: - case TSDB_DATA_TYPE_GEOMETRY: - case TSDB_DATA_TYPE_JSON: - case TSDB_DATA_TYPE_VARBINARY: - case TSDB_DATA_TYPE_DECIMAL: - case TSDB_DATA_TYPE_BLOB: - case TSDB_DATA_TYPE_MEDIUMBLOB: - *pLen = taosRand() % QPT_MAX_STRING_LEN; - *ppVal = taosMemoryCalloc(1, *pLen + VARSTR_HEADER_SIZE); - assert(*ppVal); - varDataSetLen(*ppVal, *pLen); - memset((char*)*ppVal + VARSTR_HEADER_SIZE, 'A' + taosRand() % 26, *pLen); - break; - case TSDB_DATA_TYPE_NCHAR: { - *pLen = taosRand() % QPT_MAX_STRING_LEN; - char* pTmp = (char*)taosMemoryCalloc(1, *pLen + 1); - assert(pTmp); - memset(pTmp, 'A' + taosRand() % 26, *pLen); - *ppVal = taosMemoryCalloc(1, *pLen * TSDB_NCHAR_SIZE + VARSTR_HEADER_SIZE); - assert(*ppVal); - assert(taosMbsToUcs4(pTmp, *pLen, (TdUcs4 *)varDataVal(*ppVal), *pLen * TSDB_NCHAR_SIZE, NULL)); - *pLen *= TSDB_NCHAR_SIZE; - varDataSetLen(*ppVal, *pLen); - taosMemoryFree(pTmp); - break; - } - case TSDB_DATA_TYPE_UTINYINT: - *pLen = tDataTypes[*pType].bytes; - *ppVal = taosMemoryMalloc(tDataTypes[*pType].bytes); - assert(*ppVal); - *(uint8_t*)*ppVal = taosRand(); - break; - case TSDB_DATA_TYPE_USMALLINT: - *pLen = tDataTypes[*pType].bytes; - *ppVal = taosMemoryMalloc(tDataTypes[*pType].bytes); - assert(*ppVal); - *(uint16_t*)*ppVal = taosRand(); - break; - case TSDB_DATA_TYPE_UINT: - *pLen = tDataTypes[*pType].bytes; - *ppVal = taosMemoryMalloc(tDataTypes[*pType].bytes); - assert(*ppVal); - *(uint32_t*)*ppVal = taosRand(); - break; - case TSDB_DATA_TYPE_UBIGINT: - *pLen = tDataTypes[*pType].bytes; - *ppVal = taosMemoryMalloc(tDataTypes[*pType].bytes); - assert(*ppVal); - *(uint64_t*)*ppVal = taosRand(); - break; - default: - assert(0); - break; - } -} -void qptFreeRandValue(int32_t* pType, void* pVal) { - switch (*pType) { - case TSDB_DATA_TYPE_BOOL: - case TSDB_DATA_TYPE_TINYINT: - case TSDB_DATA_TYPE_SMALLINT: - case TSDB_DATA_TYPE_INT: - case TSDB_DATA_TYPE_BIGINT: - case TSDB_DATA_TYPE_FLOAT: - case TSDB_DATA_TYPE_DOUBLE: - case TSDB_DATA_TYPE_TIMESTAMP: - case TSDB_DATA_TYPE_UTINYINT: - case TSDB_DATA_TYPE_USMALLINT: - case TSDB_DATA_TYPE_UINT: - case TSDB_DATA_TYPE_UBIGINT: - taosMemoryFree(pVal); - break; - case TSDB_DATA_TYPE_NULL: - case TSDB_DATA_TYPE_VARCHAR: - case TSDB_DATA_TYPE_GEOMETRY: - case TSDB_DATA_TYPE_NCHAR: - case TSDB_DATA_TYPE_JSON: - case TSDB_DATA_TYPE_VARBINARY: - case TSDB_DATA_TYPE_DECIMAL: - case TSDB_DATA_TYPE_BLOB: - case TSDB_DATA_TYPE_MEDIUMBLOB: - break; - default: - assert(0); - break; - } -} void qptMakeValueNode(SNode** ppNode) { SValueNode* pVal = NULL; @@ -689,11 +777,16 @@ void qptMakeTableNode(SNode** ppNode) { } -void qptMakeExprNode(SNode** ppNode) { +SNode* qptMakeExprNode(SNode** ppNode) { int32_t nodeTypeMaxValue = 9; if (qptCtx.makeCtx.nodeLevel >= QPT_MAX_NODE_LEVEL) { nodeTypeMaxValue = 2; } + + SNode* pNode = NULL; + if (NULL == ppNode) { + ppNode = &pNode; + } switch (taosRand() % nodeTypeMaxValue) { case 0: @@ -727,6 +820,8 @@ void qptMakeExprNode(SNode** ppNode) { assert(0); break; } + + return *ppNode; } void qptResetMakeNodeCtx(SDataBlockDescNode* pInput, bool onlyTag) { @@ -745,10 +840,15 @@ SNode* qptMakeConditionNode(bool onlyTag) { } SNode* qptMakeDataBlockDescNode() { + if (QPT_RAND_BOOL_V) { + return NULL; + } + SDataBlockDescNode* pDesc = NULL; assert(0 == nodesMakeNode(QUERY_NODE_DATABLOCK_DESC, (SNode**)&pDesc)); - pDesc->dataBlockId = qptCtx.makeCtx.nextBlockId++; - pDesc->precision = qptCtx.param.db.precision; + + pDesc->dataBlockId = qptCtx.param.correctExpected ? qptCtx.makeCtx.nextBlockId++ : QPT_RAND_INT_V; + pDesc->precision = qptCtx.param.correctExpected ? qptCtx.param.db.precision : QPT_RAND_INT_V; return (SNode*)pDesc; } @@ -763,16 +863,15 @@ SPhysiNode* qptCreatePhysiNode(int32_t nodeType) { pPhysiNode->pLimit = qptMakeLimitNode(); pPhysiNode->pSlimit = qptMakeLimitNode(); pPhysiNode->dynamicOp = qptGetDynamicOp(); - pPhysiNode->inputTsOrder = qptGetInputTsOrder(); + pPhysiNode->inputTsOrder = qptGetCurrTsOrder(); pPhysiNode->pOutputDataBlockDesc = (SDataBlockDescNode*)qptMakeDataBlockDescNode(); - assert(pPhysiNode->pOutputDataBlockDesc); return pPhysiNode; } void qptPostCreatePhysiNode(SPhysiNode* pPhysiNode) { - pPhysiNode->outputTsOrder = qptGetInputTsOrder(); + pPhysiNode->outputTsOrder = qptGetCurrTsOrder(); if (taosRand() % 2) { pPhysiNode->pConditions = qptMakeConditionNode(false); @@ -800,18 +899,56 @@ void qptMarkTableInUseCols(int32_t colNum, int32_t totalColNum, SQPTCol* pCol) { } while (colInUse < colNum); } +int32_t qptNodesListAppend(SNodeList* pList, SNode* pNode) { + SListCell* p = NULL; + assert(0 == nodesCalloc(1, sizeof(SListCell), (void**)&p)); + + p->pNode = pNode; + if (NULL == pList->pHead) { + pList->pHead = p; + } + if (NULL != pList->pTail) { + pList->pTail->pNext = p; + } + p->pPrev = pList->pTail; + pList->pTail = p; + ++(pList->length); + return TSDB_CODE_SUCCESS; +} + + +int32_t qptNodesListStrictAppend(SNodeList* pList, SNode* pNode) { + int32_t code = qptNodesListAppend(pList, pNode); + if (TSDB_CODE_SUCCESS != code) { + nodesDestroyNode(pNode); + } + return code; +} + +int32_t qptNodesListMakeStrictAppend(SNodeList** pList, SNode* pNode) { + if (NULL == *pList) { + int32_t code = nodesMakeList(pList); + if (NULL == *pList) { + return code; + } + } + return qptNodesListStrictAppend(*pList, pNode); +} + + void qptCreateTableScanColsImpl( SScanPhysiNode* pScanPhysiNode, SNodeList** ppCols, int32_t totalColNum, SQPTCol* pCol) { int32_t colNum = qptCtx.param.correctExpected ? (taosRand() % totalColNum + 1) : (taosRand()); int32_t colAdded = 0; if (qptCtx.param.correctExpected) { qptMarkTableInUseCols(colNum, totalColNum, pCol); + for (int32_t i = 0; i < totalColNum && colAdded < colNum; ++i) { if (0 == pCol[i].inUse) { continue; } - assert(0 == nodesListMakeStrictAppend(ppCols, qptMakeColumnNodeFromTable(i, pCol[i].colType, pScanPhysiNode))); + assert(0 == qptNodesListMakeStrictAppend(ppCols, qptMakeColumnNodeFromTable(i, pCol[i].colType, pScanPhysiNode))); } return; @@ -821,7 +958,7 @@ void qptCreateTableScanColsImpl( SScanPhysiNode* pScanPhysiNode, SNodeList int32_t colIdx = taosRand(); colIdx = (colIdx >= totalColNum) ? -1 : colIdx; - assert(0 == nodesListMakeStrictAppend(ppCols, qptMakeColumnNodeFromTable(colIdx, pCol[i].colType, pScanPhysiNode))); + assert(0 == qptNodesListMakeStrictAppend(ppCols, qptMakeColumnNodeFromTable(colIdx, pCol[i].colType, pScanPhysiNode))); } } @@ -837,7 +974,8 @@ void qptCreateTableScanPseudoCols( SScanPhysiNode* pScanPhysiNode) { SNode* qptMakeSlotDescNode(const char* pName, const SNode* pNode, int16_t slotId, bool output, bool reserve) { SSlotDescNode* pSlot = NULL; assert(0 == nodesMakeNode(QUERY_NODE_SLOT_DESC, (SNode**)&pSlot)); - snprintf(pSlot->name, sizeof(pSlot->name), "%s", pName); + + QPT_RAND_BOOL_V ? (pSlot->name[0] = 0) : snprintf(pSlot->name, sizeof(pSlot->name), "%s", pName); pSlot->slotId = slotId; pSlot->dataType = ((SExprNode*)pNode)->resType; pSlot->reserve = reserve; @@ -845,7 +983,7 @@ SNode* qptMakeSlotDescNode(const char* pName, const SNode* pNode, int16_t slotId return (SNode*)pSlot; } -void qptCreateMakeNode(SNode* pNode, int16_t dataBlockId, int16_t slotId, SNode** pOutput) { +void qptMakeTargetNode(SNode* pNode, int16_t dataBlockId, int16_t slotId, SNode** pOutput) { STargetNode* pTarget = NULL; assert(0 == nodesMakeNode(QUERY_NODE_TARGET, (SNode**)&pTarget)); @@ -863,18 +1001,23 @@ void qptAddDataBlockSlots(SNodeList* pList, SDataBlockDescNode* pDataBlockDesc) FOREACH(pNode, pList) { SNode* pExpr = QUERY_NODE_ORDER_BY_EXPR == nodeType(pNode) ? ((SOrderByExprNode*)pNode)->pExpr : pNode; - assert(0 == nodesListMakeStrictAppend(&pDataBlockDesc->pSlots, qptMakeSlotDescNode(NULL, pExpr, nextSlotId, output, QPT_RAND_BOOL_V))); - pDataBlockDesc->totalRowSize += ((SExprNode*)pExpr)->resType.bytes; - if (output) { - pDataBlockDesc->outputRowSize += ((SExprNode*)pExpr)->resType.bytes; + if (qptCtx.param.correctExpected || QPT_RAND_BOOL_V) { + SNode* pDesc = qptCtx.param.correctExpected ? qptMakeSlotDescNode(NULL, pExpr, nextSlotId, output, QPT_RAND_BOOL_V) : qptMakeExprNode(NULL); + assert(0 == qptNodesListMakeStrictAppend(&pDataBlockDesc->pSlots, pDesc)); + pDataBlockDesc->totalRowSize += qptCtx.param.correctExpected ? ((SExprNode*)pExpr)->resType.bytes : taosRand(); + if (output && QPT_RAND_BOOL_V) { + pDataBlockDesc->outputRowSize += qptCtx.param.correctExpected ? ((SExprNode*)pExpr)->resType.bytes : taosRand(); + } } slotId = nextSlotId; ++nextSlotId; - SNode* pTarget = NULL; - qptCreateMakeNode(pNode, pDataBlockDesc->dataBlockId, slotId, &pTarget); - REPLACE_NODE(pTarget); + if (qptCtx.param.correctExpected || QPT_RAND_BOOL_V) { + SNode* pTarget = NULL; + qptMakeTargetNode(pNode, pDataBlockDesc->dataBlockId, slotId, &pTarget); + REPLACE_NODE(pTarget); + } } } @@ -898,13 +1041,14 @@ void qptCreateScanPhysiNodeImpl( SScanPhysiNode* pScanPhysiNode) { SName tblName = {0}; toName(1, qptCtx.param.db.dbName, qptCtx.param.tbl.tblName, &tblName); memcpy(&pScanPhysiNode->tableName, &tblName, sizeof(SName)); + + qptCtx.buildCtx.currTsOrder = (qptCtx.param.correctExpected) ? qptCtx.buildCtx.currTsOrder : QPT_RAND_ORDER_V; } SNode* qptCreateTagScanPhysiNode(int32_t nodeType) { SPhysiNode* pPhysiNode = qptCreatePhysiNode(nodeType); - assert(pPhysiNode); STagScanPhysiNode* pTagScanNode = (STagScanPhysiNode*)pPhysiNode; pTagScanNode->onlyMetaCtbIdx = (taosRand() % 2) ? true : false; @@ -1226,7 +1370,7 @@ void qptInitTestCtx(bool correctExpected, bool singleNode, int32_t nodeType, int qptCtx.param.tbl.uid = 100; qptCtx.param.tbl.suid = 1; - qptCtx.param.tbl.tblType = taosRand() % TSDB_TABLE_MAX; + qptGetRandRealTableType(qptCtx.param.tbl.tblType); qptCtx.param.tbl.colNum = taosRand() % 4098; qptCtx.param.tbl.tagNum = taosRand() % 130; qptCtx.param.tbl.pkNum = taosRand() % 2; @@ -1247,10 +1391,10 @@ void qptInitTestCtx(bool correctExpected, bool singleNode, int32_t nodeType, int #if 1 #if 1 -TEST(correctSingleNodeTest, tagScan) { - char* caseName = "correctSingleNodeTest:tagScan"; +TEST(randSingleNodeTest, tagScan) { + char* caseName = "randSingleNodeTest:tagScan"; - qptInitTestCtx(true, true, QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN, 0, NULL); + qptInitTestCtx(false, true, QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN, 0, NULL); for (qptCtx.loopIdx = 0; qptCtx.loopIdx < QPT_MAX_LOOP; ++qptCtx.loopIdx) { qptRunPlanTest(caseName); @@ -1261,20 +1405,21 @@ TEST(correctSingleNodeTest, tagScan) { #endif #if 0 -TEST(randSingleNodeTest, tagScan) { - char* caseName = "randSingleNodeTest:tagScan"; +TEST(correctSingleNodeTest, tagScan) { + char* caseName = "correctSingleNodeTest:tagScan"; - qptInitTestCtx(false, true, QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN, 0, NULL); + qptInitTestCtx(true, true, QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN, 0, NULL); for (qptCtx.loopIdx = 0; qptCtx.loopIdx < QPT_MAX_LOOP; ++qptCtx.loopIdx) { - qptRunSingleTest(caseName); + qptRunPlanTest(caseName); } - printStatInfo(caseName); + qptPrintStatInfo(caseName); } #endif + #endif From e3a82cadd465dbe38633dbee2156821f0edd4025 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Mon, 30 Sep 2024 09:05:29 +0800 Subject: [PATCH 084/695] add ci --- .../stream/streamInterpForceWindowClose1.sim | 168 +++++++++++++++++- 1 file changed, 162 insertions(+), 6 deletions(-) diff --git a/tests/script/tsim/stream/streamInterpForceWindowClose1.sim b/tests/script/tsim/stream/streamInterpForceWindowClose1.sim index f0147c3f021f..1de845f33100 100644 --- a/tests/script/tsim/stream/streamInterpForceWindowClose1.sim +++ b/tests/script/tsim/stream/streamInterpForceWindowClose1.sim @@ -73,6 +73,50 @@ print $data40 $data41 $data42 $data43 $data44 print $data50 $data51 $data52 $data53 $data54 +# row 0 +if $rows < 2 then + print ======rows=$rows + goto loop0 +endi + +print 2 sql select * from streamt where a == 21; +sql select * from streamt where a == 21; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +# row 0 +if $rows < 2 then + print ======rows=$rows + goto loop0 +endi + +$loop_count = 0 +loop1: + +sleep 2000 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 2 sql select * from streamt where a == 31; +sql select * from streamt where a == 31; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + # row 0 if $rows < 2 then print ======rows=$rows @@ -89,7 +133,7 @@ if $loop_count == 20 then return -1 endi -print 2 sql select * from streamt where a == 2; +print sql select * from streamt where a == 2; sql select * from streamt where a == 2; print $data00 $data01 $data02 $data03 $data04 @@ -105,6 +149,38 @@ if $rows < 2 then goto loop1 endi +print 3 sql select * from streamt where a == 22; +sql select * from streamt where a == 22; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows < 2 then + print ======rows=$rows + goto loop1 +endi + +print 3 sql select * from streamt where a == 32; +sql select * from streamt where a == 32; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows < 2 then + print ======rows=$rows + goto loop1 +endi + $loop_count = 0 loop2: @@ -115,7 +191,7 @@ if $loop_count == 20 then return -1 endi -print 2 sql select * from streamt where a == 3; +print 4 sql select * from streamt where a == 3; sql select * from streamt where a == 3; print $data00 $data01 $data02 $data03 $data04 @@ -131,6 +207,38 @@ if $rows < 2 then goto loop2 endi +print 4 sql select * from streamt where a == 23; +sql select * from streamt where a == 23; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows < 2 then + print ======rows=$rows + goto loop2 +endi + +print 4 sql select * from streamt where a == 33; +sql select * from streamt where a == 33; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows < 2 then + print ======rows=$rows + goto loop2 +endi + sleep 4000 $loop_count = 0 @@ -143,6 +251,54 @@ if $loop_count == 20 then return -1 endi +print 5 sql select * from streamt where a == 3; +sql select * from streamt where a == 3; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows < 5 then + print ======rows=$rows + goto loop3 +endi + +print 5 sql select * from streamt where a == 23; +sql select * from streamt where a == 23; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows < 5 then + print ======rows=$rows + goto loop3 +endi + +print 5 sql select * from streamt where a == 33; +sql select * from streamt where a == 33; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows < 5 then + print ======rows=$rows + goto loop3 +endi + print 2 sql select * from streamt where a == 3; sql select * from streamt where a == 3; @@ -245,7 +401,7 @@ sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); sql create table t3 using st tags(2,2,2); -sql create stream streams3 trigger force_window_close IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _irowts, interp(a) as a, _isfilled, tbname, b, c from st partition by tbname, b,c every(2s) fill(value,100,200); +sql create stream streams3 trigger force_window_close IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _irowts, interp(a) as a, _isfilled, tbname, b, c from st partition by tbname, b,c every(2s) fill(value,100); run tsim/stream/checkTaskStatus.sim @@ -285,7 +441,7 @@ print $data40 $data41 $data42 $data43 $data44 print $data50 $data51 $data52 $data53 $data54 $loop_count = 0 -loop4: +loop5: sleep 2000 @@ -305,9 +461,9 @@ print $data40 $data41 $data42 $data43 $data44 print $data50 $data51 $data52 $data53 $data54 # row 0 -if $rows < 5 then +if $rows < 10 then print ======rows=$rows - goto loop4 + goto loop5 endi print end From 1143adce33a84db60b3973fb499eb45410ac5ffd Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Mon, 30 Sep 2024 09:54:37 +0800 Subject: [PATCH 085/695] fix: add random case --- source/libs/executor/test/queryPlanTests.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/source/libs/executor/test/queryPlanTests.cpp b/source/libs/executor/test/queryPlanTests.cpp index 37d0a797616a..dcd615b8c32a 100755 --- a/source/libs/executor/test/queryPlanTests.cpp +++ b/source/libs/executor/test/queryPlanTests.cpp @@ -976,8 +976,17 @@ SNode* qptMakeSlotDescNode(const char* pName, const SNode* pNode, int16_t slotId assert(0 == nodesMakeNode(QUERY_NODE_SLOT_DESC, (SNode**)&pSlot)); QPT_RAND_BOOL_V ? (pSlot->name[0] = 0) : snprintf(pSlot->name, sizeof(pSlot->name), "%s", pName); +<<<<<<< Updated upstream pSlot->slotId = slotId; pSlot->dataType = ((SExprNode*)pNode)->resType; +======= + pSlot->slotId = qptCtx.param.correctExpected ? slotId : taosRand(); + if (qptCtx.param.correctExpected) { + pSlot->dataType = ((SExprNode*)pNode)->resType; + } else { + + } +>>>>>>> Stashed changes pSlot->reserve = reserve; pSlot->output = output; return (SNode*)pSlot; From 14fcb4831860bce8f4b0600d69c8c5f6ed815cd6 Mon Sep 17 00:00:00 2001 From: Yaming Pei Date: Mon, 30 Sep 2024 10:11:48 +0800 Subject: [PATCH 086/695] docs: adjust the version function description --- docs/zh/14-reference/05-connector/50-odbc.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/zh/14-reference/05-connector/50-odbc.mdx b/docs/zh/14-reference/05-connector/50-odbc.mdx index 38dd88b86dab..73e5592cf5fa 100644 --- a/docs/zh/14-reference/05-connector/50-odbc.mdx +++ b/docs/zh/14-reference/05-connector/50-odbc.mdx @@ -7,7 +7,7 @@ TDengine ODBC 是为 TDengine 实现的 ODBC 驱动程序,支持 Windows 系 TDengine ODBC 提供基于 WebSocket(推荐)和 原生连接两种方式连接 TDengine 数据库,使用时可以为 TDengine 数据源设置不同的连接方式。访问云服务时必须使用 WebSocket 连接方式。 -注意:TDengine ODBC 支持 32/64 位 Windows 系统,调用 TDengine ODBC 需要通过相应位数的 ODBC 驱动管理器进行。在 32 位 Windows 系统或者 64 位 Windows 系统的 32 位应用程序中,仅支持使用 WebSocket 连接方式访问 TDengine 数据库。 +注意:TDengine ODBC 支持 64 位 Windows 系统,支持 32 位 Websocket 连接方式(仅企业版支持),调用 TDengine ODBC 需要通过相应位数的 ODBC 驱动管理器进行。在 32 位 Windows 系统或者 64 位 Windows 系统的 32 位应用程序中,仅支持使用 WebSocket 连接方式访问 TDengine 数据库。 想更多了解 TDengine 时序时序数据库的使用,可访问 [TDengine官方文档](https://docs.taosdata.com/intro/)。 @@ -111,7 +111,7 @@ WebSocket 连接方式除此之外还支持 Windows X64系统上运行的 32 位 | taos_odbc版本 | 主要变化 | TDengine 版本 | | :----------- | :-------------------------------------------------------------------------------------------------- | :---------------- | -| v1.1.0 | 1. 支持视图功能;
    2. 支持 VARBINARY/GEOMETRY 数据类型; | 3.3.3.0及更高版本 | +| v1.1.0 | 1. 支持视图功能;
    2. 支持 VARBINARY/GEOMETRY 数据类型;
    3. 支持 ODBC 32 位 WebSocket 连接方式(仅企业版支持);
    4. 支持 ODBC 数据源配置对话框设置对工业软件 KingSCADA、Kepware 等的兼容性适配选项(仅企业版支持); | 3.3.3.0及更高版本 | | v1.0.2 | 支持 CP1252 字符编码; | 3.2.3.0及更高版本 | | v1.0.1 | 1. 支持 DSN 设置 BI 模式,在 BI 模式下 TDengine 数据库不返回系统数据库和超级表子表信息;
    2. 重构字符集转换模块,提升读写性能;
    3. ODBC 数据源配置对话框中默认修改默认连接方式为“WebSocket”;
    4. ODBC 数据源配置对话框增加“测试连接”控件;
    5. ODBC 数据源配置支持中文/英文界面; | - | | v1.0.0.0 | 发布初始版本,支持与Tdengine数据库交互以读写数据,具体请参考“API 参考”一节 | 3.2.2.0及更高版本 | From f42a97e0a78fc25e8596370b24b33d49599cff2a Mon Sep 17 00:00:00 2001 From: sheyanjie-qq <249478495@qq.com> Date: Mon, 30 Sep 2024 10:25:13 +0800 Subject: [PATCH 087/695] update odbc doc --- docs/zh/14-reference/05-connector/50-odbc.mdx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/zh/14-reference/05-connector/50-odbc.mdx b/docs/zh/14-reference/05-connector/50-odbc.mdx index ac317435df20..69dcdc2a2a2d 100644 --- a/docs/zh/14-reference/05-connector/50-odbc.mdx +++ b/docs/zh/14-reference/05-connector/50-odbc.mdx @@ -3,11 +3,14 @@ sidebar_label: ODBC title: TDengine ODBC --- -TDengine ODBC 是为 TDengine 实现的 ODBC 驱动程序,支持 Windows 系统的应用(如 [PowerBI](https://powerbi.microsoft.com/zh-cn/) 等)通过 ODBC 标准接口访问本地、远程和云服务的 TDengine 数据库的数据表/视图。 +TDengine ODBC 是为 TDengine 实现的 ODBC 驱动程序,支持 Windows 系统的应用(如 [PowerBI](https://powerbi.microsoft.com/zh-cn/) 等)以及用户自定义开发的应用程序,通过 ODBC 标准接口访问本地、远程和云服务的 TDengine 数据库。 -TDengine ODBC 提供基于 WebSocket(推荐)和 原生连接两种方式连接 TDengine 数据库,使用时可以为 TDengine 数据源设置不同的连接方式。访问云服务时必须使用 WebSocket 连接方式。 +TDengine ODBC 提供基于 WebSocket(推荐)和 原生连接两种方式连接 TDengine 数据库,使用时可以为 TDengine 数据源设置不同的连接方式。访问云服务时必须使用 WebSocket 连接方式。 -注意:TDengine ODBC 支持 32/64 位 Windows 系统,调用 TDengine ODBC 需要通过相应位数的 ODBC 驱动管理器进行。在 32 位 Windows 系统或者 64 位 Windows 系统的 32 位应用程序中,仅支持使用 WebSocket 连接方式访问 TDengine 数据库。 +TDengine ODBC 提供 64 位 和 32 位 两种驱动程序。但 32 位仅企业版支持,且仅支持 Websocket 连接方式。 +**注意:** +- 驱动管理器:确保使用与应用程序架构匹配的 ODBC 驱动管理器。32 位应用程序需要使用 32 位 ODBC 驱动管理器,64 位应用程序需要使用 64 位 ODBC 驱动管理器。 +- 数据源名称(DSN):32 位和 64 位 ODBC 驱动管理器都可以看到所有 DSN,因此需要在 DSN 名称上去区分。 想更多了解 TDengine 时序时序数据库的使用,可访问 [TDengine官方文档](https://docs.taosdata.com/intro/)。 From 56cb709f42dc10f438be6070fb83d6c4ae5bf998 Mon Sep 17 00:00:00 2001 From: Yaming Pei Date: Mon, 30 Sep 2024 10:39:45 +0800 Subject: [PATCH 088/695] docs: adjust DSN description --- docs/zh/14-reference/05-connector/50-odbc.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/zh/14-reference/05-connector/50-odbc.mdx b/docs/zh/14-reference/05-connector/50-odbc.mdx index 0a57a6308be4..24c1a1e84d10 100644 --- a/docs/zh/14-reference/05-connector/50-odbc.mdx +++ b/docs/zh/14-reference/05-connector/50-odbc.mdx @@ -7,10 +7,10 @@ TDengine ODBC 是为 TDengine 实现的 ODBC 驱动程序,支持 Windows 系 TDengine ODBC 提供基于 WebSocket(推荐)和 原生连接两种方式连接 TDengine 数据库,使用时可以为 TDengine 数据源设置不同的连接方式。访问云服务时必须使用 WebSocket 连接方式。 -TDengine ODBC 提供 64 位 和 32 位 两种驱动程序。但 32 位仅企业版支持,且仅支持 Websocket 连接方式。 +TDengine ODBC 提供 64 位 和 32 位 两种驱动程序。但 32 位仅企业版支持,且仅支持 WebSocket 连接方式。 **注意:** - 驱动管理器:确保使用与应用程序架构匹配的 ODBC 驱动管理器。32 位应用程序需要使用 32 位 ODBC 驱动管理器,64 位应用程序需要使用 64 位 ODBC 驱动管理器。 -- 数据源名称(DSN):32 位和 64 位 ODBC 驱动管理器都可以看到所有 DSN,因此需要在 DSN 名称上去区分。 +- 数据源名称(DSN):32 位和 64 位 ODBC 驱动管理器都可以看到所有 DSN,用户 DSN 标签页下的 DSN 如果名字相同会共用,因此需要在 DSN 名称上去区分。 想更多了解 TDengine 时序时序数据库的使用,可访问 [TDengine官方文档](https://docs.taosdata.com/intro/)。 From 80936446f912a71087a4ee1b39eec0e6dab1bbb7 Mon Sep 17 00:00:00 2001 From: Yaming Pei Date: Mon, 30 Sep 2024 10:43:12 +0800 Subject: [PATCH 089/695] docs: adjust WebSocket description --- docs/zh/14-reference/05-connector/50-odbc.mdx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/zh/14-reference/05-connector/50-odbc.mdx b/docs/zh/14-reference/05-connector/50-odbc.mdx index 24c1a1e84d10..ee57901e9b33 100644 --- a/docs/zh/14-reference/05-connector/50-odbc.mdx +++ b/docs/zh/14-reference/05-connector/50-odbc.mdx @@ -27,17 +27,17 @@ TDengine ODBC 提供 64 位 和 32 位 两种驱动程序。但 32 位仅企业 ### 数据源连接类型与区别 -TDengine ODBC 支持两种连接 TDengine 数据库方式:Websocket 连接与 Native 连接,其区别如下: +TDengine ODBC 支持两种连接 TDengine 数据库方式:WebSocket 连接与 Native 连接,其区别如下: -1. 访问云服务仅支持使用 Websocket 连接方式。 +1. 访问云服务仅支持使用 WebSocket 连接方式。 2. 32 位应用程序仅支持使用 WebSocket 连接方式。 -3. Websocket 连接的兼容性更好,一般不需要随着 TDengine 数据库服务端升级而升级客户端的库。 +3. WebSocket 连接的兼容性更好,一般不需要随着 TDengine 数据库服务端升级而升级客户端的库。 4. Native 连接通常性能更好一点,但是必须与 TDengine 数据库服务端的版本保持一致。 -5. 对于一般用户,建议使用 **Websocket** 连接方式,性能与 Native 差别不大,兼容性更好。 +5. 对于一般用户,建议使用 **WebSocket** 连接方式,性能与 Native 差别不大,兼容性更好。 ### WebSocket 连接 @@ -49,11 +49,11 @@ TDengine ODBC 支持两种连接 TDengine 数据库方式:Websocket 连接与 4. 点击完成,进入 TDengine ODBC 数据源配置页面,填写如下必要信息 - ![ODBC websocket connection config](./assets/odbc-ws-config-zh.webp) + ![ODBC WebSocket connection config](./assets/odbc-ws-config-zh.webp) 4.1 【DSN】:Data Source Name 必填,为新添加的 ODBC 数据源命名 - 4.2【连接类型】 : 必选,选择连接类型,这里选择 【Websocket】 + 4.2【连接类型】 : 必选,选择连接类型,这里选择 【WebSocket】 4.3【URL】必填,ODBC 数据源 URL,示例: `http://localhost:6041`, 云服务的 url 示例: `https://gw.cloud.taosdata.com?token=your_token` From 1b6bb5e4b9b3db4fa86657de0bc9ed8c6ce7ed1c Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Mon, 30 Sep 2024 16:30:47 +0800 Subject: [PATCH 090/695] fix: random test issues --- source/libs/executor/test/queryPlanTests.cpp | 489 ++++++++++++++----- 1 file changed, 361 insertions(+), 128 deletions(-) diff --git a/source/libs/executor/test/queryPlanTests.cpp b/source/libs/executor/test/queryPlanTests.cpp index dcd615b8c32a..4c75ed4d7c6e 100755 --- a/source/libs/executor/test/queryPlanTests.cpp +++ b/source/libs/executor/test/queryPlanTests.cpp @@ -45,7 +45,7 @@ namespace { -#define QPT_MAX_LOOP 1000 +#define QPT_MAX_LOOP 100000000 #define QPT_MAX_SUBPLAN_LEVEL 1000 #define QPT_MAX_WHEN_THEN_NUM 10 #define QPT_MAX_NODE_LEVEL 5 @@ -54,6 +54,8 @@ namespace { #define QPT_MAX_LOGIC_PARAM 5 #define QPT_MAX_NODE_LIST_NUM 5 #define QPT_DEFAULT_VNODE_NUM 5 +#define QPT_MAX_COLUMN_NUM 8192 + int32_t QPT_PHYSIC_NODE_LIST[] = { QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN, @@ -110,6 +112,11 @@ int32_t QPT_PHYSIC_NODE_LIST[] = { #define QPT_RAND_BOOL_V ((taosRand() % 2) ? true : false) #define QPT_RAND_ORDER_V (QPT_RAND_BOOL_V ? ORDER_ASC : ORDER_DESC) #define QPT_RAND_INT_V (taosRand() * (QPT_RAND_BOOL_V ? 1 : -1)) +#define QPT_LOW_PROB() ((taosRand() % 11) == 0) +#define QPT_MID_PROB() ((taosRand() % 11) <= 4) +#define QPT_HIGH_PROB() ((taosRand() % 11) <= 7) + +#define QPT_CORRECT_HIGH_PROB() (qptCtx.param.correctExpected || QPT_HIGH_PROB()) typedef struct { ENodeType type; @@ -208,7 +215,7 @@ SQPTCtrl qptCtrl = {1, 0, 0, 0, 0}; bool qptErrorRerun = false; bool qptInRerun = false; -void qptMakeExprNode(SNode** ppNode); +SNode* qptMakeExprNode(SNode** ppNode); void qptPrintBeginInfo(char* caseName) { @@ -304,22 +311,22 @@ EOrder qptGetCurrTsOrder() { return qptCtx.param.correctExpected ? qptCtx.buildCtx.currTsOrder : QPT_RAND_ORDER_V; } -void qptGetRandValue(int32_t* pType, int32_t* pLen, void** ppVal) { - int32_t typeMax = TSDB_DATA_TYPE_MAX +void qptGetRandValue(uint8_t* pType, int32_t* pLen, void** ppVal) { + int32_t typeMax = TSDB_DATA_TYPE_MAX; if (!qptCtx.param.correctExpected) { typeMax++; } - *pType = taosRand() % TSDB_DATA_TYPE_MAX; + *pType = taosRand() % typeMax; switch (*pType) { case TSDB_DATA_TYPE_NULL: - *pLen = 0; + *pLen = qptCtx.param.correctExpected ? 0 : taosRand(); if (ppVal) { *ppVal = NULL; } break; case TSDB_DATA_TYPE_BOOL: - *pLen = tDataTypes[*pType].bytes; + *pLen = qptCtx.param.correctExpected ? tDataTypes[*pType].bytes : taosRand(); if (ppVal) { *ppVal = taosMemoryMalloc(tDataTypes[*pType].bytes); assert(*ppVal); @@ -327,7 +334,7 @@ void qptGetRandValue(int32_t* pType, int32_t* pLen, void** ppVal) { } break; case TSDB_DATA_TYPE_TINYINT: - *pLen = tDataTypes[*pType].bytes; + *pLen = qptCtx.param.correctExpected ? tDataTypes[*pType].bytes : taosRand(); if (ppVal) { *ppVal = taosMemoryMalloc(tDataTypes[*pType].bytes); assert(*ppVal); @@ -335,7 +342,7 @@ void qptGetRandValue(int32_t* pType, int32_t* pLen, void** ppVal) { } break; case TSDB_DATA_TYPE_SMALLINT: - *pLen = tDataTypes[*pType].bytes; + *pLen = qptCtx.param.correctExpected ? tDataTypes[*pType].bytes : taosRand(); if (ppVal) { *ppVal = taosMemoryMalloc(tDataTypes[*pType].bytes); assert(*ppVal); @@ -343,7 +350,7 @@ void qptGetRandValue(int32_t* pType, int32_t* pLen, void** ppVal) { } break; case TSDB_DATA_TYPE_INT: - *pLen = tDataTypes[*pType].bytes; + *pLen = qptCtx.param.correctExpected ? tDataTypes[*pType].bytes : taosRand(); if (ppVal) { *ppVal = taosMemoryMalloc(tDataTypes[*pType].bytes); assert(*ppVal); @@ -352,7 +359,7 @@ void qptGetRandValue(int32_t* pType, int32_t* pLen, void** ppVal) { break; case TSDB_DATA_TYPE_BIGINT: case TSDB_DATA_TYPE_TIMESTAMP: - *pLen = tDataTypes[*pType].bytes; + *pLen = qptCtx.param.correctExpected ? tDataTypes[*pType].bytes : taosRand(); if (ppVal) { *ppVal = taosMemoryMalloc(tDataTypes[*pType].bytes); assert(*ppVal); @@ -360,7 +367,7 @@ void qptGetRandValue(int32_t* pType, int32_t* pLen, void** ppVal) { } break; case TSDB_DATA_TYPE_FLOAT: - *pLen = tDataTypes[*pType].bytes; + *pLen = qptCtx.param.correctExpected ? tDataTypes[*pType].bytes : taosRand(); if (ppVal) { *ppVal = taosMemoryMalloc(tDataTypes[*pType].bytes); assert(*ppVal); @@ -368,7 +375,7 @@ void qptGetRandValue(int32_t* pType, int32_t* pLen, void** ppVal) { } break; case TSDB_DATA_TYPE_DOUBLE: - *pLen = tDataTypes[*pType].bytes; + *pLen = qptCtx.param.correctExpected ? tDataTypes[*pType].bytes : taosRand(); if (ppVal) { *ppVal = taosMemoryMalloc(tDataTypes[*pType].bytes); assert(*ppVal); @@ -406,7 +413,7 @@ void qptGetRandValue(int32_t* pType, int32_t* pLen, void** ppVal) { break; } case TSDB_DATA_TYPE_UTINYINT: - *pLen = tDataTypes[*pType].bytes; + *pLen = qptCtx.param.correctExpected ? tDataTypes[*pType].bytes : taosRand(); if (ppVal) { *ppVal = taosMemoryMalloc(tDataTypes[*pType].bytes); assert(*ppVal); @@ -414,7 +421,7 @@ void qptGetRandValue(int32_t* pType, int32_t* pLen, void** ppVal) { } break; case TSDB_DATA_TYPE_USMALLINT: - *pLen = tDataTypes[*pType].bytes; + *pLen = qptCtx.param.correctExpected ? tDataTypes[*pType].bytes : taosRand(); if (ppVal) { *ppVal = taosMemoryMalloc(tDataTypes[*pType].bytes); assert(*ppVal); @@ -422,7 +429,7 @@ void qptGetRandValue(int32_t* pType, int32_t* pLen, void** ppVal) { } break; case TSDB_DATA_TYPE_UINT: - *pLen = tDataTypes[*pType].bytes; + *pLen = qptCtx.param.correctExpected ? tDataTypes[*pType].bytes : taosRand(); if (ppVal) { *ppVal = taosMemoryMalloc(tDataTypes[*pType].bytes); assert(*ppVal); @@ -430,7 +437,7 @@ void qptGetRandValue(int32_t* pType, int32_t* pLen, void** ppVal) { } break; case TSDB_DATA_TYPE_UBIGINT: - *pLen = tDataTypes[*pType].bytes; + *pLen = qptCtx.param.correctExpected ? tDataTypes[*pType].bytes : taosRand(); if (ppVal) { *ppVal = taosMemoryMalloc(tDataTypes[*pType].bytes); assert(*ppVal); @@ -438,7 +445,7 @@ void qptGetRandValue(int32_t* pType, int32_t* pLen, void** ppVal) { } break; default: - *pLen = taosRand(); + *pLen = taosRand() % QPT_MAX_STRING_LEN; if (ppVal) { *ppVal = taosMemoryCalloc(1, *pLen); assert(*ppVal); @@ -497,6 +504,51 @@ void qptGetRandRealTableType(int8_t* tableType) { } + +void qptNodesCalloc(int32_t num, int32_t size, void** pOut) { + void* p = taosMemoryCalloc(num, size); + assert(p); + *(char*)p = 0; + *pOut = (char*)p + 1; +} + +int32_t qptNodesListAppend(SNodeList* pList, SNode* pNode) { + SListCell* p = NULL; + qptNodesCalloc(1, sizeof(SListCell), (void**)&p); + + p->pNode = pNode; + if (NULL == pList->pHead) { + pList->pHead = p; + } + if (NULL != pList->pTail) { + pList->pTail->pNext = p; + } + p->pPrev = pList->pTail; + pList->pTail = p; + ++(pList->length); + return TSDB_CODE_SUCCESS; +} + + +int32_t qptNodesListStrictAppend(SNodeList* pList, SNode* pNode) { + int32_t code = qptNodesListAppend(pList, pNode); + if (TSDB_CODE_SUCCESS != code) { + nodesDestroyNode(pNode); + } + return code; +} + +int32_t qptNodesListMakeStrictAppend(SNodeList** pList, SNode* pNode) { + if (NULL == *pList) { + int32_t code = nodesMakeList(pList); + if (NULL == *pList) { + return code; + } + } + return qptNodesListStrictAppend(*pList, pNode); +} + + SNode* qptMakeLimitNode() { if (QPT_RAND_BOOL_V) { return NULL; @@ -534,7 +586,7 @@ SNode* qptMakeColumnNodeFromTable(int32_t colIdx, EColumnType colType, SScanPhys assert(0 == nodesMakeNode(QUERY_NODE_COLUMN, (SNode**)&pCol)); assert(pCol); - if (qptCtx.param.correctExpected) { + if (QPT_CORRECT_HIGH_PROB()) { pCol->node.resType.type = qptCtx.param.tbl.pCol[colIdx].type; pCol->node.resType.bytes = qptCtx.param.tbl.pCol[colIdx].len; @@ -549,7 +601,7 @@ SNode* qptMakeColumnNodeFromTable(int32_t colIdx, EColumnType colType, SScanPhys strcpy(pCol->tableName, qptCtx.param.tbl.tblName); strcpy(pCol->tableAlias, qptCtx.param.tbl.tblAlias); strcpy(pCol->colName, qptCtx.param.tbl.pCol[colIdx].name); - pCol->dataBlockId = pScanPhysiNode->node.pOutputDataBlockDesc->dataBlockId; + pCol->dataBlockId = pScanPhysiNode->node.pOutputDataBlockDesc ? pScanPhysiNode->node.pOutputDataBlockDesc->dataBlockId : taosRand(); pCol->slotId = colIdx; pCol->numOfPKs = qptCtx.param.tbl.pkNum; pCol->tableHasPk = qptCtx.param.tbl.pkNum > 0; @@ -563,14 +615,31 @@ SNode* qptMakeColumnNodeFromTable(int32_t colIdx, EColumnType colType, SScanPhys pCol->tableType = taosRand() % TSDB_TABLE_MAX; pCol->colId = QPT_RAND_BOOL_V ? taosRand() : colIdx; pCol->projIdx = taosRand(); - pCol->colType = QPT_RAND_BOOL_V ? qptCtx.param.tbl.pCol[colIdx].colType :taosRand() % (COLUMN_TYPE_GROUP_KEY + 1); + pCol->colType = QPT_RAND_BOOL_V ? qptCtx.param.tbl.pCol[colIdx].colType : (EColumnType)(taosRand() % (COLUMN_TYPE_GROUP_KEY + 1)); pCol->hasIndex = QPT_RAND_BOOL_V; pCol->isPrimTs = QPT_RAND_BOOL_V; - QPT_RAND_BOOL_V ? (pCol->dbName[0] = 0) : strcpy(pCol->dbName, qptCtx.param.db.dbName); - QPT_RAND_BOOL_V ? (pCol->tableName[0] = 0) : strcpy(pCol->tableName, qptCtx.param.tbl.tblName); - QPT_RAND_BOOL_V ? (pCol->tableAlias[0] = 0) : strcpy(pCol->tableAlias, qptCtx.param.tbl.tblAlias); - QPT_RAND_BOOL_V ? (pCol->colName[0] = 0) : strcpy(pCol->colName, qptCtx.param.tbl.pCol[colIdx].name); - pCol->dataBlockId = QPT_RAND_BOOL_V ? taosRand() : pScanPhysiNode->node.pOutputDataBlockDesc->dataBlockId; + if (QPT_RAND_BOOL_V) { + pCol->dbName[0] = 0; + } else { + strcpy(pCol->dbName, qptCtx.param.db.dbName); + } + if (QPT_RAND_BOOL_V) { + pCol->tableName[0] = 0; + } else { + strcpy(pCol->tableName, qptCtx.param.tbl.tblName); + } + if (QPT_RAND_BOOL_V) { + pCol->tableAlias[0] = 0; + } else { + strcpy(pCol->tableAlias, qptCtx.param.tbl.tblAlias); + } + if (QPT_RAND_BOOL_V) { + pCol->colName[0] = 0; + } else { + strcpy(pCol->colName, qptCtx.param.tbl.pCol[colIdx].name); + } + + pCol->dataBlockId = (QPT_RAND_BOOL_V && pScanPhysiNode->node.pOutputDataBlockDesc) ? pScanPhysiNode->node.pOutputDataBlockDesc->dataBlockId : taosRand(); pCol->slotId = QPT_RAND_BOOL_V ? taosRand() : colIdx; pCol->numOfPKs = QPT_RAND_BOOL_V ? taosRand() : qptCtx.param.tbl.pkNum; pCol->tableHasPk = QPT_RAND_BOOL_V ? QPT_RAND_BOOL_V : (qptCtx.param.tbl.pkNum > 0); @@ -589,43 +658,45 @@ void qptMakeWhenThenNode(SNode** ppNode) { SWhenThenNode* pWhenThen = (SWhenThenNode*)*ppNode; qptMakeExprNode(&pWhenThen->pWhen); - assert(pWhenThen->pWhen); qptMakeExprNode(&pWhenThen->pThen); - assert(pWhenThen->pThen); } void qptMakeCaseWhenNode(SNode** ppNode) { assert(0 == nodesMakeNode(QUERY_NODE_CASE_WHEN, ppNode)); assert(*ppNode); + SCaseWhenNode* pCaseWhen = (SCaseWhenNode*)*ppNode; qptCtx.makeCtx.nodeLevel++; - qptMakeExprNode(&pCaseWhen->pCase); - assert(pCaseWhen->pCase); - - qptMakeExprNode(&pCaseWhen->pElse); - assert(pCaseWhen->pElse); - - int32_t whenNum = taosRand() % QPT_MAX_WHEN_THEN_NUM + 1; + if (QPT_RAND_BOOL_V) { + qptMakeExprNode(&pCaseWhen->pCase); + } + + if (QPT_RAND_BOOL_V) { + qptMakeExprNode(&pCaseWhen->pElse); + } + + int32_t whenNum = taosRand() % QPT_MAX_WHEN_THEN_NUM + (QPT_CORRECT_HIGH_PROB() ? 1 : 0); for (int32_t i = 0; i < whenNum; ++i) { SNode* pNode = NULL; qptMakeWhenThenNode(&pNode); - assert(0 == nodesListMakeStrictAppend(&pCaseWhen->pWhenThenList, pNode)); + qptNodesListMakeStrictAppend(&pCaseWhen->pWhenThenList, pNode); } } void qptMakeOperatorNode(SNode** ppNode) { - EOperatorType opType; - opType = OPERATOR_ARRAY[taosRand() % (sizeof(OPERATOR_ARRAY)/sizeof(OPERATOR_ARRAY[0]))]; + EOperatorType opType = OPERATOR_ARRAY[taosRand() % (sizeof(OPERATOR_ARRAY)/sizeof(OPERATOR_ARRAY[0]))]; assert(0 == nodesMakeNode(QUERY_NODE_OPERATOR, ppNode)); + SOperatorNode* pOp = (SOperatorNode*)*ppNode; - pOp->opType = opType; + pOp->opType = QPT_CORRECT_HIGH_PROB() ? opType : (EOperatorType)(opType + 1); qptCtx.makeCtx.nodeLevel++; + switch (opType) { case OP_TYPE_ADD: case OP_TYPE_SUB: @@ -649,8 +720,17 @@ void qptMakeOperatorNode(SNode** ppNode) { case OP_TYPE_JSON_GET_VALUE: case OP_TYPE_JSON_CONTAINS: case OP_TYPE_ASSIGN: - qptMakeExprNode(&pOp->pLeft); - qptMakeExprNode(&pOp->pRight); + if (QPT_CORRECT_HIGH_PROB()) { + qptMakeExprNode(&pOp->pLeft); + qptMakeExprNode(&pOp->pRight); + } else { + if (QPT_RAND_BOOL_V) { + qptMakeExprNode(&pOp->pLeft); + } + if (QPT_RAND_BOOL_V) { + qptMakeExprNode(&pOp->pRight); + } + } break; case OP_TYPE_IS_NULL: @@ -662,42 +742,154 @@ void qptMakeOperatorNode(SNode** ppNode) { case OP_TYPE_IS_NOT_FALSE: case OP_TYPE_IS_NOT_UNKNOWN: case OP_TYPE_MINUS: - qptMakeExprNode(&pOp->pLeft); + if (QPT_CORRECT_HIGH_PROB()) { + qptMakeExprNode(&pOp->pLeft); + } else { + if (QPT_RAND_BOOL_V) { + qptMakeExprNode(&pOp->pLeft); + } + if (QPT_RAND_BOOL_V) { + qptMakeExprNode(&pOp->pRight); + } + } break; default: - assert(0); + if (QPT_RAND_BOOL_V) { + qptMakeExprNode(&pOp->pLeft); + } + if (QPT_RAND_BOOL_V) { + qptMakeExprNode(&pOp->pRight); + } break; } } void qptMakeColumnNode(SNode** ppNode) { - SNodeList* pColList = qptCtx.makeCtx.pInputDataBlockDesc->pSlots; - int32_t colIdx = taosRand() % pColList->length; - SNode* pNode = nodesListGetNode(pColList, colIdx); - assert(nodeType(pNode) == QUERY_NODE_SLOT_DESC); - SSlotDescNode* pSlot = (SSlotDescNode*)pNode; SColumnNode* pCol = NULL; - nodesMakeNode(QUERY_NODE_COLUMN, (SNode**)&pCol); - pCol->node.resType = pSlot->dataType; - pCol->dataBlockId = qptCtx.makeCtx.pInputDataBlockDesc->dataBlockId; - pCol->slotId = pSlot->slotId; + if (qptCtx.param.correctExpected) { + SNodeList* pColList = qptCtx.makeCtx.pInputDataBlockDesc->pSlots; + int32_t colIdx = taosRand() % pColList->length; + SNode* pNode = nodesListGetNode(pColList, colIdx); + assert(nodeType(pNode) == QUERY_NODE_SLOT_DESC); + + SSlotDescNode* pSlot = (SSlotDescNode*)pNode; + nodesMakeNode(QUERY_NODE_COLUMN, (SNode**)&pCol); + pCol->node.resType = pSlot->dataType; + pCol->dataBlockId = qptCtx.makeCtx.pInputDataBlockDesc->dataBlockId; + pCol->slotId = pSlot->slotId; + } else { + nodesMakeNode(QUERY_NODE_COLUMN, (SNode**)&pCol); + qptGetRandValue(&pCol->node.resType.type, &pCol->node.resType.bytes, NULL); + pCol->dataBlockId = taosRand(); + pCol->slotId = taosRand(); + } *ppNode = (SNode*)pCol; } +void qptNodesSetValueNodeValue(SValueNode* pNode, void* value) { + switch (pNode->node.resType.type) { + case TSDB_DATA_TYPE_NULL: + taosMemoryFree(value); + break; + case TSDB_DATA_TYPE_BOOL: + pNode->datum.b = *(bool*)value; + taosMemoryFree(value); + *(bool*)&pNode->typeData = qptCtx.param.correctExpected ? pNode->datum.b : QPT_RAND_BOOL_V; + break; + case TSDB_DATA_TYPE_TINYINT: + pNode->datum.i = *(int8_t*)value; + taosMemoryFree(value); + *(int8_t*)&pNode->typeData = qptCtx.param.correctExpected ? pNode->datum.i : QPT_RAND_INT_V; + break; + case TSDB_DATA_TYPE_SMALLINT: + pNode->datum.i = *(int16_t*)value; + taosMemoryFree(value); + *(int16_t*)&pNode->typeData = qptCtx.param.correctExpected ? pNode->datum.i : QPT_RAND_INT_V; + break; + case TSDB_DATA_TYPE_INT: + pNode->datum.i = *(int32_t*)value; + taosMemoryFree(value); + *(int32_t*)&pNode->typeData = qptCtx.param.correctExpected ? pNode->datum.i : QPT_RAND_INT_V; + break; + case TSDB_DATA_TYPE_BIGINT: + pNode->datum.i = *(int64_t*)value; + taosMemoryFree(value); + *(int64_t*)&pNode->typeData = qptCtx.param.correctExpected ? pNode->datum.i : QPT_RAND_INT_V; + break; + case TSDB_DATA_TYPE_TIMESTAMP: + pNode->datum.i = *(int64_t*)value; + taosMemoryFree(value); + *(int64_t*)&pNode->typeData = qptCtx.param.correctExpected ? pNode->datum.i : QPT_RAND_INT_V; + break; + case TSDB_DATA_TYPE_UTINYINT: + pNode->datum.u = *(int8_t*)value; + taosMemoryFree(value); + *(int8_t*)&pNode->typeData = qptCtx.param.correctExpected ? pNode->datum.u : QPT_RAND_INT_V; + break; + case TSDB_DATA_TYPE_USMALLINT: + pNode->datum.u = *(int16_t*)value; + taosMemoryFree(value); + *(int16_t*)&pNode->typeData = qptCtx.param.correctExpected ? pNode->datum.u : QPT_RAND_INT_V; + break; + case TSDB_DATA_TYPE_UINT: + pNode->datum.u = *(int32_t*)value; + taosMemoryFree(value); + *(int32_t*)&pNode->typeData = qptCtx.param.correctExpected ? pNode->datum.u : QPT_RAND_INT_V; + break; + case TSDB_DATA_TYPE_UBIGINT: + pNode->datum.u = *(uint64_t*)value; + taosMemoryFree(value); + *(uint64_t*)&pNode->typeData = qptCtx.param.correctExpected ? pNode->datum.u : QPT_RAND_INT_V; + break; + case TSDB_DATA_TYPE_FLOAT: + pNode->datum.d = *(float*)value; + taosMemoryFree(value); + *(float*)&pNode->typeData = qptCtx.param.correctExpected ? pNode->datum.d : QPT_RAND_INT_V; + break; + case TSDB_DATA_TYPE_DOUBLE: + pNode->datum.d = *(double*)value; + taosMemoryFree(value); + *(double*)&pNode->typeData = qptCtx.param.correctExpected ? pNode->datum.d : QPT_RAND_INT_V; + break; + case TSDB_DATA_TYPE_NCHAR: + case TSDB_DATA_TYPE_VARCHAR: + case TSDB_DATA_TYPE_VARBINARY: + case TSDB_DATA_TYPE_JSON: + case TSDB_DATA_TYPE_GEOMETRY: + if (qptCtx.param.correctExpected || QPT_MID_PROB()) { + pNode->datum.p = (char*)value; + } else { + } + taosMemoryFree(value); + pNode->datum.p = NULL; + break; + case TSDB_DATA_TYPE_DECIMAL: + case TSDB_DATA_TYPE_BLOB: + case TSDB_DATA_TYPE_MEDIUMBLOB: + taosMemoryFree(value); + pNode->datum.p = NULL; + break; + default: + taosMemoryFree(value); + break; + } +} void qptMakeValueNode(SNode** ppNode) { SValueNode* pVal = NULL; nodesMakeNode(QUERY_NODE_VALUE, (SNode**)&pVal); - int32_t valType, valBytes; + uint8_t valType; + int32_t valBytes; void* pValue = NULL; qptGetRandValue(&valType, &valBytes, &pValue); pVal->node.resType.type = valType; pVal->node.resType.bytes = valBytes; - nodesSetValueNodeValue(pVal, pValue); + + qptNodesSetValueNodeValue(pVal, pValue); *ppNode = (SNode*)pVal; } @@ -706,33 +898,58 @@ void qptMakeFunctionNode(SNode** ppNode) { SFunctionNode* pFunc = NULL; nodesMakeNode(QUERY_NODE_FUNCTION, (SNode**)&pFunc); - int32_t funcIdx = taosRand() % funcMgtBuiltinsNum; - strcpy(pFunc->functionName, fmGetFuncName(funcIdx)); - fmGetFuncInfo(pFunc, NULL, 0); - + if (qptCtx.param.correctExpected || QPT_HIGH_PROB()) { + int32_t funcIdx = taosRand() % funcMgtBuiltinsNum; + char* funcName = fmGetFuncName(funcIdx); + strcpy(pFunc->functionName, funcName); + taosMemoryFree(funcName); + fmGetFuncInfo(pFunc, NULL, 0); + } else { + int32_t funcIdx = taosRand(); + if (QPT_RAND_BOOL_V) { + strcpy(pFunc->functionName, "invalidFuncName"); + } else { + pFunc->functionName[0] = 0; + } + fmGetFuncInfo(pFunc, NULL, 0); + } + qptCtx.makeCtx.nodeLevel++; - int32_t paramNum = taosRand() % QPT_MAX_FUNC_PARAM + 1; - for (int32_t i = 0; i < paramNum; ++i) { - SNode* pNode = NULL; - qptMakeExprNode(&pNode); - assert(0 == nodesListMakeStrictAppend(&pFunc->pParameterList, pNode)); + + if (QPT_CORRECT_HIGH_PROB()) { + // TODO + } else { + int32_t paramNum = taosRand() % QPT_MAX_FUNC_PARAM; + for (int32_t i = 0; i < paramNum; ++i) { + SNode* pNode = NULL; + qptMakeExprNode(&pNode); + qptNodesListMakeStrictAppend(&pFunc->pParameterList, pNode); + } } *ppNode = (SNode*)pFunc; } + + + void qptMakeLogicCondNode(SNode** ppNode) { SLogicConditionNode* pLogic = NULL; nodesMakeNode(QUERY_NODE_LOGIC_CONDITION, (SNode**)&pLogic); - pLogic->condType = (taosRand() % 3) ? ((taosRand() % 2) ? LOGIC_COND_TYPE_AND : LOGIC_COND_TYPE_OR) : LOGIC_COND_TYPE_NOT; - + if (QPT_CORRECT_HIGH_PROB()) { + pLogic->condType = (taosRand() % 3) ? ((taosRand() % 2) ? LOGIC_COND_TYPE_AND : LOGIC_COND_TYPE_OR) : LOGIC_COND_TYPE_NOT; + } else { + pLogic->condType = (ELogicConditionType)taosRand(); + } + qptCtx.makeCtx.nodeLevel++; - int32_t paramNum = taosRand() % QPT_MAX_LOGIC_PARAM + 1; + + int32_t paramNum = QPT_CORRECT_HIGH_PROB() ? (taosRand() % QPT_MAX_LOGIC_PARAM + 1) : (taosRand() % QPT_MAX_LOGIC_PARAM); for (int32_t i = 0; i < paramNum; ++i) { SNode* pNode = NULL; qptMakeExprNode(&pNode); - assert(0 == nodesListMakeStrictAppend(&pLogic->pParameterList, pNode)); + qptNodesListMakeStrictAppend(&pLogic->pParameterList, pNode); } *ppNode = (SNode*)pLogic; @@ -743,11 +960,12 @@ void qptMakeNodeListNode(SNode** ppNode) { nodesMakeNode(QUERY_NODE_NODE_LIST, (SNode**)&pList); qptCtx.makeCtx.nodeLevel++; - int32_t nodeNum = taosRand() % QPT_MAX_NODE_LIST_NUM + 1; + + int32_t nodeNum = QPT_CORRECT_HIGH_PROB() ? (taosRand() % QPT_MAX_NODE_LIST_NUM + 1) : (taosRand() % QPT_MAX_NODE_LIST_NUM); for (int32_t i = 0; i < nodeNum; ++i) { SNode* pNode = NULL; qptMakeExprNode(&pNode); - assert(0 == nodesListMakeStrictAppend(&pList->pNodeList, pNode)); + qptNodesListMakeStrictAppend(&pList->pNodeList, pNode); } *ppNode = (SNode*)pList; @@ -757,6 +975,10 @@ void qptMakeTempTableNode(SNode** ppNode) { STempTableNode* pTemp = NULL; assert(0 == nodesMakeNode(QUERY_NODE_TEMP_TABLE, (SNode**)&pTemp)); + if (QPT_CORRECT_HIGH_PROB()) { + // TODO + } + *ppNode = (SNode*)pTemp; } @@ -764,20 +986,51 @@ void qptMakeJoinTableNode(SNode** ppNode) { SJoinTableNode* pJoin = NULL; assert(0 == nodesMakeNode(QUERY_NODE_JOIN_TABLE, (SNode**)&pJoin)); + if (QPT_CORRECT_HIGH_PROB()) { + // TODO + } + *ppNode = (SNode*)pJoin; } +void qptMakeRealTableNode(SNode** ppNode) { + SRealTableNode* pReal = NULL; + assert(0 == nodesMakeNode(QUERY_NODE_REAL_TABLE, (SNode**)&pReal)); -void qptMakeTableNode(SNode** ppNode) { - if (taosRand() % 2) { - qptMakeTempTableNode(ppNode); + if (QPT_CORRECT_HIGH_PROB()) { + // TODO + } + + *ppNode = (SNode*)pReal; +} + + + +void qptMakeNonRealTableNode(SNode** ppNode) { + if (QPT_CORRECT_HIGH_PROB()) { + if (QPT_RAND_BOOL_V) { + qptMakeTempTableNode(ppNode); + } else { + qptMakeJoinTableNode(ppNode); + } } else { - qptMakeJoinTableNode(ppNode); + qptMakeRealTableNode(ppNode); } } +void qptMakeRandNode(SNode** ppNode) { + nodesMakeNode((ENodeType)taosRand(), ppNode); +} SNode* qptMakeExprNode(SNode** ppNode) { + if (!qptCtx.param.correctExpected && QPT_LOW_PROB()) { + if (ppNode) { + *ppNode = NULL; + } + + return NULL; + } + int32_t nodeTypeMaxValue = 9; if (qptCtx.makeCtx.nodeLevel >= QPT_MAX_NODE_LEVEL) { nodeTypeMaxValue = 2; @@ -787,6 +1040,11 @@ SNode* qptMakeExprNode(SNode** ppNode) { if (NULL == ppNode) { ppNode = &pNode; } + + if (!qptCtx.param.correctExpected && QPT_LOW_PROB()) { + qptMakeRandNode(ppNode); + return *ppNode; + } switch (taosRand() % nodeTypeMaxValue) { case 0: @@ -808,7 +1066,7 @@ SNode* qptMakeExprNode(SNode** ppNode) { qptMakeOperatorNode(ppNode); break; case 6: - qptMakeTableNode(ppNode); + qptMakeNonRealTableNode(ppNode); break; case 7: qptMakeCaseWhenNode(ppNode); @@ -825,7 +1083,7 @@ SNode* qptMakeExprNode(SNode** ppNode) { } void qptResetMakeNodeCtx(SDataBlockDescNode* pInput, bool onlyTag) { - SQPTMakePlanCtx* pCtx = &qptCtx.makeCtx; + SQPTMakeNodeCtx* pCtx = &qptCtx.makeCtx; pCtx->nodeLevel = 1; pCtx->onlyTag = onlyTag; @@ -836,11 +1094,12 @@ SNode* qptMakeConditionNode(bool onlyTag) { SNode* pNode = NULL; qptResetMakeNodeCtx(qptCtx.buildCtx.pCurr->pOutputDataBlockDesc, onlyTag); qptMakeExprNode(&pNode); + return pNode; } SNode* qptMakeDataBlockDescNode() { - if (QPT_RAND_BOOL_V) { + if (!qptCtx.param.correctExpected && QPT_LOW_PROB()) { return NULL; } @@ -899,45 +1158,9 @@ void qptMarkTableInUseCols(int32_t colNum, int32_t totalColNum, SQPTCol* pCol) { } while (colInUse < colNum); } -int32_t qptNodesListAppend(SNodeList* pList, SNode* pNode) { - SListCell* p = NULL; - assert(0 == nodesCalloc(1, sizeof(SListCell), (void**)&p)); - - p->pNode = pNode; - if (NULL == pList->pHead) { - pList->pHead = p; - } - if (NULL != pList->pTail) { - pList->pTail->pNext = p; - } - p->pPrev = pList->pTail; - pList->pTail = p; - ++(pList->length); - return TSDB_CODE_SUCCESS; -} - - -int32_t qptNodesListStrictAppend(SNodeList* pList, SNode* pNode) { - int32_t code = qptNodesListAppend(pList, pNode); - if (TSDB_CODE_SUCCESS != code) { - nodesDestroyNode(pNode); - } - return code; -} - -int32_t qptNodesListMakeStrictAppend(SNodeList** pList, SNode* pNode) { - if (NULL == *pList) { - int32_t code = nodesMakeList(pList); - if (NULL == *pList) { - return code; - } - } - return qptNodesListStrictAppend(*pList, pNode); -} - void qptCreateTableScanColsImpl( SScanPhysiNode* pScanPhysiNode, SNodeList** ppCols, int32_t totalColNum, SQPTCol* pCol) { - int32_t colNum = qptCtx.param.correctExpected ? (taosRand() % totalColNum + 1) : (taosRand()); + int32_t colNum = qptCtx.param.correctExpected ? (taosRand() % totalColNum + 1) : (taosRand() % QPT_MAX_COLUMN_NUM + 1); int32_t colAdded = 0; if (qptCtx.param.correctExpected) { @@ -948,7 +1171,7 @@ void qptCreateTableScanColsImpl( SScanPhysiNode* pScanPhysiNode, SNodeList continue; } - assert(0 == qptNodesListMakeStrictAppend(ppCols, qptMakeColumnNodeFromTable(i, pCol[i].colType, pScanPhysiNode))); + assert(0 == qptNodesListMakeStrictAppend(ppCols, qptMakeColumnNodeFromTable(i, pCol[0].colType, pScanPhysiNode))); } return; @@ -958,7 +1181,7 @@ void qptCreateTableScanColsImpl( SScanPhysiNode* pScanPhysiNode, SNodeList int32_t colIdx = taosRand(); colIdx = (colIdx >= totalColNum) ? -1 : colIdx; - assert(0 == qptNodesListMakeStrictAppend(ppCols, qptMakeColumnNodeFromTable(colIdx, pCol[i].colType, pScanPhysiNode))); + assert(0 == qptNodesListMakeStrictAppend(ppCols, qptMakeColumnNodeFromTable(colIdx, pCol[0].colType, pScanPhysiNode))); } } @@ -976,17 +1199,13 @@ SNode* qptMakeSlotDescNode(const char* pName, const SNode* pNode, int16_t slotId assert(0 == nodesMakeNode(QUERY_NODE_SLOT_DESC, (SNode**)&pSlot)); QPT_RAND_BOOL_V ? (pSlot->name[0] = 0) : snprintf(pSlot->name, sizeof(pSlot->name), "%s", pName); -<<<<<<< Updated upstream - pSlot->slotId = slotId; - pSlot->dataType = ((SExprNode*)pNode)->resType; -======= pSlot->slotId = qptCtx.param.correctExpected ? slotId : taosRand(); if (qptCtx.param.correctExpected) { pSlot->dataType = ((SExprNode*)pNode)->resType; } else { - + qptGetRandValue(&pSlot->dataType.type, &pSlot->dataType.bytes, NULL); } ->>>>>>> Stashed changes + pSlot->reserve = reserve; pSlot->output = output; return (SNode*)pSlot; @@ -1004,11 +1223,19 @@ void qptMakeTargetNode(SNode* pNode, int16_t dataBlockId, int16_t slotId, SNode* } void qptAddDataBlockSlots(SNodeList* pList, SDataBlockDescNode* pDataBlockDesc) { + if (NULL == pDataBlockDesc) { + return; + } + int16_t nextSlotId = LIST_LENGTH(pDataBlockDesc->pSlots), slotId = 0; SNode* pNode = NULL; bool output = QPT_RAND_BOOL_V; FOREACH(pNode, pList) { + if (NULL == pNode) { + continue; + } + SNode* pExpr = QUERY_NODE_ORDER_BY_EXPR == nodeType(pNode) ? ((SOrderByExprNode*)pNode)->pExpr : pNode; if (qptCtx.param.correctExpected || QPT_RAND_BOOL_V) { SNode* pDesc = qptCtx.param.correctExpected ? qptMakeSlotDescNode(NULL, pExpr, nextSlotId, output, QPT_RAND_BOOL_V) : qptMakeExprNode(NULL); @@ -1042,15 +1269,21 @@ void qptCreateScanPhysiNodeImpl( SScanPhysiNode* pScanPhysiNode) { qptAddDataBlockSlots(pScanPhysiNode->pScanPseudoCols, pScanPhysiNode->node.pOutputDataBlockDesc); - pScanPhysiNode->uid = qptCtx.param.tbl.uid; - pScanPhysiNode->suid = qptCtx.param.tbl.suid; - pScanPhysiNode->tableType = qptCtx.param.tbl.tblType; + pScanPhysiNode->uid = qptCtx.param.correctExpected ? qptCtx.param.tbl.uid : taosRand(); + pScanPhysiNode->suid = qptCtx.param.correctExpected ? qptCtx.param.tbl.suid : taosRand(); + pScanPhysiNode->tableType = qptCtx.param.correctExpected ? qptCtx.param.tbl.tblType : taosRand(); pScanPhysiNode->groupOrderScan = (taosRand() % 2) ? true : false; SName tblName = {0}; toName(1, qptCtx.param.db.dbName, qptCtx.param.tbl.tblName, &tblName); - memcpy(&pScanPhysiNode->tableName, &tblName, sizeof(SName)); - + if (qptCtx.param.correctExpected || QPT_RAND_BOOL_V) { + memcpy(&pScanPhysiNode->tableName, &tblName, sizeof(SName)); + } else { + pScanPhysiNode->tableName.acctId = 0; + pScanPhysiNode->tableName.dbname[0] = 0; + pScanPhysiNode->tableName.tname[0] = 0; + } + qptCtx.buildCtx.currTsOrder = (qptCtx.param.correctExpected) ? qptCtx.buildCtx.currTsOrder : QPT_RAND_ORDER_V; } @@ -1277,7 +1510,7 @@ void qptRunPlanTest(char* caseName) { qptPrintBeginInfo(caseName); qptCtx.startTsUs = taosGetTimestampUs(); - qptCtx.result.code = createTagScanOperatorInfo(&readHandle, (STagScanPhysiNode*)pNode, NULL, NULL, NULL, NULL, &pOperator); + //qptCtx.result.code = createTagScanOperatorInfo(&readHandle, (STagScanPhysiNode*)pNode, NULL, NULL, NULL, NULL, &pOperator); destroyOperator(pOperator); nodesDestroyNode((SNode*)pNode); @@ -1379,7 +1612,7 @@ void qptInitTestCtx(bool correctExpected, bool singleNode, int32_t nodeType, int qptCtx.param.tbl.uid = 100; qptCtx.param.tbl.suid = 1; - qptGetRandRealTableType(qptCtx.param.tbl.tblType); + qptGetRandRealTableType(&qptCtx.param.tbl.tblType); qptCtx.param.tbl.colNum = taosRand() % 4098; qptCtx.param.tbl.tagNum = taosRand() % 130; qptCtx.param.tbl.pkNum = taosRand() % 2; From bde18abb60445d03f3ca239fd1410f136a3ed4f8 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Mon, 30 Sep 2024 18:07:14 +0800 Subject: [PATCH 091/695] enh: add projection plan --- source/libs/executor/test/queryPlanTests.cpp | 54 ++++++++++++++++---- 1 file changed, 43 insertions(+), 11 deletions(-) diff --git a/source/libs/executor/test/queryPlanTests.cpp b/source/libs/executor/test/queryPlanTests.cpp index 4c75ed4d7c6e..3422611ea193 100755 --- a/source/libs/executor/test/queryPlanTests.cpp +++ b/source/libs/executor/test/queryPlanTests.cpp @@ -766,19 +766,22 @@ void qptMakeOperatorNode(SNode** ppNode) { void qptMakeColumnNode(SNode** ppNode) { SColumnNode* pCol = NULL; - if (qptCtx.param.correctExpected) { + nodesMakeNode(QUERY_NODE_COLUMN, (SNode**)&pCol); + SSlotDescNode* pSlot = NULL; + + if (QPT_CORRECT_HIGH_PROB() && qptCtx.makeCtx.pInputDataBlockDesc && qptCtx.makeCtx.pInputDataBlockDesc->pSlots) { SNodeList* pColList = qptCtx.makeCtx.pInputDataBlockDesc->pSlots; int32_t colIdx = taosRand() % pColList->length; SNode* pNode = nodesListGetNode(pColList, colIdx); - assert(nodeType(pNode) == QUERY_NODE_SLOT_DESC); - - SSlotDescNode* pSlot = (SSlotDescNode*)pNode; - nodesMakeNode(QUERY_NODE_COLUMN, (SNode**)&pCol); - pCol->node.resType = pSlot->dataType; - pCol->dataBlockId = qptCtx.makeCtx.pInputDataBlockDesc->dataBlockId; - pCol->slotId = pSlot->slotId; - } else { - nodesMakeNode(QUERY_NODE_COLUMN, (SNode**)&pCol); + if (pNode && nodeType(pNode) == QUERY_NODE_SLOT_DESC) { + pSlot = (SSlotDescNode*)pNode; + pCol->node.resType = pSlot->dataType; + pCol->dataBlockId = qptCtx.makeCtx.pInputDataBlockDesc->dataBlockId; + pCol->slotId = pSlot->slotId; + } + } + + if (NULL == pSlot) { qptGetRandValue(&pCol->node.resType.type, &pCol->node.resType.bytes, NULL); pCol->dataBlockId = taosRand(); pCol->slotId = taosRand(); @@ -1132,7 +1135,7 @@ SPhysiNode* qptCreatePhysiNode(int32_t nodeType) { void qptPostCreatePhysiNode(SPhysiNode* pPhysiNode) { pPhysiNode->outputTsOrder = qptGetCurrTsOrder(); - if (taosRand() % 2) { + if (QPT_RAND_BOOL_V) { pPhysiNode->pConditions = qptMakeConditionNode(false); } @@ -1302,6 +1305,34 @@ SNode* qptCreateTagScanPhysiNode(int32_t nodeType) { return (SNode*)pPhysiNode; } +void qptMakeExprList(SNodeList** ppList) { + int32_t exprNum = taosRand() % QPT_MAX_COLUMN_NUM + (QPT_CORRECT_HIGH_PROB() ? 1 : 0); + for (int32_t i = 0; i < exprNum; ++i) { + SNode* pNode = NULL; + qptResetMakeNodeCtx(qptCtx.buildCtx.pChild ? qptCtx.buildCtx.pChild->pOutputDataBlockDesc : NULL, false); + qptMakeExprNode(&pNode); + qptNodesListMakeStrictAppend(ppList, pNode); + } +} + +SNode* qptCreateProjectPhysiNode(int32_t nodeType) { + SPhysiNode* pPhysiNode = qptCreatePhysiNode(nodeType); + + SProjectPhysiNode* pProject = (SProjectPhysiNode*)pPhysiNode; + + pProject->mergeDataBlock = QPT_RAND_BOOL_V; + pProject->ignoreGroupId = QPT_RAND_BOOL_V; + pProject->inputIgnoreGroup = QPT_RAND_BOOL_V; + + qptMakeExprList(&pProject->pProjections); + + qptAddDataBlockSlots(pProject->pProjections, pProject->node.pOutputDataBlockDesc); + + qptPostCreatePhysiNode(pPhysiNode); + + return (SNode*)pPhysiNode; +} + SNode* qptCreateSortMergeJoinPhysiNode(int32_t nodeType) { SPhysiNode* pPhysiNode = qptCreatePhysiNode(nodeType); @@ -1387,6 +1418,7 @@ SNode* qptCreatePhysicalPlanNode(int32_t nodeType) { case QUERY_NODE_PHYSICAL_PLAN_BLOCK_DIST_SCAN: case QUERY_NODE_PHYSICAL_PLAN_LAST_ROW_SCAN: case QUERY_NODE_PHYSICAL_PLAN_PROJECT: + return (SNode*)qptCreateProjectPhysiNode(nodeType); case QUERY_NODE_PHYSICAL_PLAN_MERGE_JOIN: return (SNode*)qptCreateSortMergeJoinPhysiNode(nodeType); case QUERY_NODE_PHYSICAL_PLAN_HASH_AGG: From 37f13bfec2fa6c4c298b5306bfef5c493c77ca08 Mon Sep 17 00:00:00 2001 From: sheyanjie-qq <249478495@qq.com> Date: Tue, 1 Oct 2024 10:33:00 +0800 Subject: [PATCH 092/695] mod java code comments --- .../JDBC/SpringJdbcTemplate/readme.md | 16 ++--- .../src/main/resources/log4j.properties | 10 ++-- .../src/main/resources/proxool.xml | 21 +++---- .../src/main/java/com/taosdata/Worker.java | 9 +-- docs/examples/JDBC/mybatisplus-demo/readme | 8 +-- docs/examples/JDBC/springbootdemo/readme.md | 14 ++--- docs/examples/JDBC/taosdemo/readme.md | 7 ++- .../taosdemo/TaosDemoApplication.java | 15 +++-- .../taosdata/taosdemo/dao/SubTableMapper.java | 15 ++--- .../taosdemo/dao/SuperTableMapper.java | 22 +++---- .../taosdata/taosdemo/dao/TableMapper.java | 13 ++-- .../taosdemo/service/DatabaseService.java | 4 +- .../taosdemo/service/SubTableService.java | 60 ++++++++++--------- .../taosdemo/service/SuperTableService.java | 2 +- .../taosdemo/service/TableService.java | 5 +- .../service/data/FieldValueGenerator.java | 10 +++- .../service/data/SubTableMetaGenerator.java | 2 +- .../service/data/SuperTableMetaGenerator.java | 13 ++-- .../service/data/TagValueGenerator.java | 2 +- .../taosdemo/utils/TimeStampUtil.java | 6 +- .../src/main/resources/log4j.properties | 10 ++-- 21 files changed, 142 insertions(+), 122 deletions(-) diff --git a/docs/examples/JDBC/SpringJdbcTemplate/readme.md b/docs/examples/JDBC/SpringJdbcTemplate/readme.md index f59bcdbeb547..0e9812385af2 100644 --- a/docs/examples/JDBC/SpringJdbcTemplate/readme.md +++ b/docs/examples/JDBC/SpringJdbcTemplate/readme.md @@ -1,11 +1,11 @@ ## TDengine Spring JDBC Template Demo -`Spring JDBC Template` 简化了原生 JDBC Connection 获取释放等操作,使得操作数据库更加方便。 +`Spring JDBC Template` simplifies the operations of acquiring and releasing native JDBC Connections, making database operations more convenient. -### 配置 +### Configuration -修改 `src/main/resources/applicationContext.xml` 文件中 TDengine 的配置信息: +Modify the TDengine configuration in the `src/main/resources/applicationContext.xml` file: ```xml @@ -20,13 +20,15 @@ ``` -### 打包运行 +### Package and run + +Navigate to the `TDengine/tests/examples/JDBC/SpringJdbcTemplate` directory and execute the following commands to generate an executable jar file. -进入 `TDengine/tests/examples/JDBC/SpringJdbcTemplate` 目录下,执行以下命令可以生成可执行 jar 包。 ```shell mvn clean package ``` -打包成功之后,进入 `target/` 目录下,执行以下命令就可运行测试: +After successfully packaging, navigate to the `target/` directory and execute the following commands to run the tests: + ```shell java -jar target/SpringJdbcTemplate-1.0-SNAPSHOT-jar-with-dependencies.jar -``` \ No newline at end of file +``` diff --git a/docs/examples/JDBC/connectionPools/src/main/resources/log4j.properties b/docs/examples/JDBC/connectionPools/src/main/resources/log4j.properties index 1299357be3d2..a7f4d3d492c7 100644 --- a/docs/examples/JDBC/connectionPools/src/main/resources/log4j.properties +++ b/docs/examples/JDBC/connectionPools/src/main/resources/log4j.properties @@ -1,21 +1,21 @@ -### 设置### +### Settings### log4j.rootLogger=debug,stdout,DebugLog,ErrorLog -### 输出信息到控制抬 ### +### Output information to the console ### log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.Target=System.out log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=[%-5p] %d{yyyy-MM-dd HH:mm:ss,SSS} method:%l%n%m%n -### 输出DEBUG 级别以上的日志到=logs/debug.log +### Output logs of DEBUG level and above to logs/debug.log log4j.appender.DebugLog=org.apache.log4j.DailyRollingFileAppender log4j.appender.DebugLog.File=logs/debug.log log4j.appender.DebugLog.Append=true log4j.appender.DebugLog.Threshold=DEBUG log4j.appender.DebugLog.layout=org.apache.log4j.PatternLayout log4j.appender.DebugLog.layout.ConversionPattern=%-d{yyyy-MM-dd HH:mm:ss} [ %t:%r ] - [ %p ] %m%n -### 输出ERROR 级别以上的日志到=logs/error.log +### Output logs of ERROR level and above to logs/error.log log4j.appender.ErrorLog=org.apache.log4j.DailyRollingFileAppender log4j.appender.ErrorLog.File=logs/error.log log4j.appender.ErrorLog.Append=true log4j.appender.ErrorLog.Threshold=ERROR log4j.appender.ErrorLog.layout=org.apache.log4j.PatternLayout -log4j.appender.ErrorLog.layout.ConversionPattern=%-d{yyyy-MM-dd HH:mm:ss} [ %t:%r ] - [ %p ] %m%n \ No newline at end of file +log4j.appender.ErrorLog.layout.ConversionPattern=%-d{yyyy-MM-dd HH:mm:ss} [ %t:%r ] - [ %p ] %m%n diff --git a/docs/examples/JDBC/connectionPools/src/main/resources/proxool.xml b/docs/examples/JDBC/connectionPools/src/main/resources/proxool.xml index 0e2ac6368a3a..dcef51ffb5ab 100644 --- a/docs/examples/JDBC/connectionPools/src/main/resources/proxool.xml +++ b/docs/examples/JDBC/connectionPools/src/main/resources/proxool.xml @@ -1,27 +1,28 @@ + ds - + jdbc:TAOS-RS://127.0.0.1:6041/log - + com.taosdata.jdbc.rs.RestfulDriver - + - + 100 - + 100 - + 1 - + 5 - + 30000 - + select server_version() - \ No newline at end of file + diff --git a/docs/examples/JDBC/consumer-demo/src/main/java/com/taosdata/Worker.java b/docs/examples/JDBC/consumer-demo/src/main/java/com/taosdata/Worker.java index f6e21cd72943..6823ca5b4d28 100644 --- a/docs/examples/JDBC/consumer-demo/src/main/java/com/taosdata/Worker.java +++ b/docs/examples/JDBC/consumer-demo/src/main/java/com/taosdata/Worker.java @@ -35,17 +35,18 @@ public Worker(Properties prop, Config config) throws SQLException { public void run() { while (!Thread.interrupted()) { try { - // 控制请求频率 + // Control request rate if (semaphore.tryAcquire()) { ConsumerRecords records = consumer.poll(Duration.ofMillis(sleepTime)); pool.submit(() -> { RateLimiter limiter = RateLimiter.create(rate); try { for (ConsumerRecord record : records) { - // 流量控制 + // Traffic control limiter.acquire(); - // 业务处理数据 - System.out.println("[" + LocalDateTime.now() + "] Thread id:" + Thread.currentThread().getId() + " -> " + record.value()); + // Business data processing + System.out.println("[" + LocalDateTime.now() + "] Thread id:" + + Thread.currentThread().getId() + " -> " + record.value()); } } finally { semaphore.release(); diff --git a/docs/examples/JDBC/mybatisplus-demo/readme b/docs/examples/JDBC/mybatisplus-demo/readme index b31b6c34bf1c..a4816d7631e3 100644 --- a/docs/examples/JDBC/mybatisplus-demo/readme +++ b/docs/examples/JDBC/mybatisplus-demo/readme @@ -1,14 +1,14 @@ -# 使用说明 +# Instructions -## 创建使用db +## Create and use the database ```shell $ taos > create database mp_test ``` -## 执行测试用例 +## Execute test cases ```shell $ mvn clean test -``` \ No newline at end of file +``` diff --git a/docs/examples/JDBC/springbootdemo/readme.md b/docs/examples/JDBC/springbootdemo/readme.md index 625d43e4edc8..d11bb33c83e7 100644 --- a/docs/examples/JDBC/springbootdemo/readme.md +++ b/docs/examples/JDBC/springbootdemo/readme.md @@ -1,6 +1,6 @@ ## TDengine SpringBoot + Mybatis Demo -## 需要提前创建 test 数据库 +## Need to create a test database in advance ``` $ taos -s 'create database if not exists test' @@ -8,7 +8,7 @@ $ taos -s 'create database if not exists test' $ curl http://localhost:8080/weather/init ``` -### 配置 application.properties +### Configure application.properties ```properties # datasource config spring.datasource.driver-class-name=com.taosdata.jdbc.TSDBDriver @@ -38,9 +38,9 @@ mybatis.mapper-locations=classpath:mapper/*.xml logging.level.com.taosdata.jdbc.springbootdemo.dao=debug ``` -### 主要功能 +### Main functions -* 创建数据库和表 +* Create databases and tables ```xml @@ -52,14 +52,14 @@ logging.level.com.taosdata.jdbc.springbootdemo.dao=debug ``` -* 插入单条记录 +* Insert a single record ```xml insert into test.weather (ts, temperature, humidity) values (now, #{temperature,jdbcType=INTEGER}, #{humidity,jdbcType=FLOAT}) ``` -* 插入多条记录 +* Insert multiple records ```xml @@ -69,7 +69,7 @@ logging.level.com.taosdata.jdbc.springbootdemo.dao=debug ``` -* 分页查询 +* Pagination query ```xml diff --git a/docs/examples/JDBC/taosdemo/readme.md b/docs/examples/JDBC/taosdemo/readme.md index 986eef8a05d8..141391d1f619 100644 --- a/docs/examples/JDBC/taosdemo/readme.md +++ b/docs/examples/JDBC/taosdemo/readme.md @@ -1,11 +1,14 @@ ``` cd tests/examples/JDBC/taosdemo mvn clean package -Dmaven.test.skip=true -# 先建表,再插入的 +# Create tables first, then insert data java -jar target/taosdemo-2.0.1-jar-with-dependencies.jar -host -database -doCreateTable true -superTableSQL "create table weather(ts timestamp, f1 int) tags(t1 nchar(4))" -numOfTables 1000 -numOfRowsPerTable 100000000 -numOfThreadsForInsert 10 -numOfTablesPerSQL 10 -numOfValuesPerSQL 100 -# 不建表,直接插入的 +# Insert data directly without creating tables java -jar target/taosdemo-2.0.1-jar-with-dependencies.jar -host -database -doCreateTable false -superTableSQL "create table weather(ts timestamp, f1 int) tags(t1 nchar(4))" -numOfTables 1000 -numOfRowsPerTable 100000000 -numOfThreadsForInsert 10 -numOfTablesPerSQL 10 -numOfValuesPerSQL 100 ``` 如果发生错误 Exception in thread "main" java.lang.UnsatisfiedLinkError: no taos in java.library.path 请检查是否安装 TDengine 客户端安装包或编译 TDengine 安装。如果确定已经安装过还出现这个错误,可以在命令行 java 后加 -Djava.library.path=/usr/lib 来指定寻找共享库的路径。 + + +If you encounter the error Exception in thread "main" `java.lang.UnsatisfiedLinkError: no taos in java.library.path`, please check whether the TDengine client package is installed or TDengine is compiled and installed. If you are sure it is installed and still encounter this error, you can add `-Djava.library.path=/usr/lib` after the `java` command to specify the path to the shared library. diff --git a/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/TaosDemoApplication.java b/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/TaosDemoApplication.java index 685405470377..40d44475b8be 100644 --- a/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/TaosDemoApplication.java +++ b/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/TaosDemoApplication.java @@ -24,14 +24,14 @@ public class TaosDemoApplication { private static final Logger logger = LogManager.getLogger(TaosDemoApplication.class); public static void main(String[] args) throws IOException { - // 读配置参数 + // Read configuration parameters JdbcTaosdemoConfig config = new JdbcTaosdemoConfig(args); boolean isHelp = Arrays.asList(args).contains("--help"); if (isHelp || config.host == null || config.host.isEmpty()) { JdbcTaosdemoConfig.printHelp(); System.exit(0); } - // 初始化 + // final DataSource dataSource = DataSourceFactory.getInstance(config.host, config.port, config.user, config.password); if (config.executeSql != null && !config.executeSql.isEmpty() @@ -50,7 +50,7 @@ public static void main(String[] args) throws IOException { final SuperTableService superTableService = new SuperTableService(dataSource); final SubTableService subTableService = new SubTableService(dataSource); - // 创建数据库 + // create database long start = System.currentTimeMillis(); Map databaseParam = new HashMap<>(); databaseParam.put("database", config.database); @@ -81,13 +81,13 @@ public static void main(String[] args) throws IOException { config.prefixOfFields, config.numOfTags, config.prefixOfTags); } /**********************************************************************************/ - // 建表 + // create table start = System.currentTimeMillis(); if (config.doCreateTable) { superTableService.drop(superTableMeta.getDatabase(), superTableMeta.getName()); superTableService.create(superTableMeta); if (!config.autoCreateTable) { - // 批量建子表 + // create sub tables in batch subTableService.createSubTable(superTableMeta, config.numOfTables, config.prefixOfTable, config.numOfThreadsForCreate); } @@ -95,7 +95,7 @@ public static void main(String[] args) throws IOException { end = System.currentTimeMillis(); logger.info(">>> create table time cost : " + (end - start) + " ms."); /**********************************************************************************/ - // 插入 + // insert data long tableSize = config.numOfTables; int threadSize = config.numOfThreadsForInsert; long startTime = getProperStartTime(config.startTime, config.days); @@ -111,10 +111,9 @@ public static void main(String[] args) throws IOException { end = System.currentTimeMillis(); logger.info("insert " + affectedRows + " rows, time cost: " + (end - start) + " ms"); /**********************************************************************************/ - // 查询 /**********************************************************************************/ - // 删除表 + // drop table if (config.dropTable) { superTableService.drop(config.database, config.superTable); } diff --git a/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/dao/SubTableMapper.java b/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/dao/SubTableMapper.java index e0ddd220c190..013d24eb8778 100644 --- a/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/dao/SubTableMapper.java +++ b/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/dao/SubTableMapper.java @@ -9,21 +9,22 @@ @Repository public interface SubTableMapper { - // 创建:子表 + // Create: SubTable void createUsingSuperTable(SubTableMeta subTableMeta); - // 插入:一张子表多个values + // Insert: Multiple records into one SubTable int insertOneTableMultiValues(SubTableValue subTableValue); - // 插入:一张子表多个values, 自动建表 + // Insert: Multiple records into one SubTable, auto create SubTables int insertOneTableMultiValuesUsingSuperTable(SubTableValue subTableValue); - // 插入:多张表多个values + // Insert: Multiple records into multiple SubTable int insertMultiTableMultiValues(List tables); - // 插入:多张表多个values,自动建表 + // Insert: Multiple records into multiple SubTable, auto create SubTables int insertMultiTableMultiValuesUsingSuperTable(List tables); - // + // -} \ No newline at end of file +} diff --git a/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/dao/SuperTableMapper.java b/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/dao/SuperTableMapper.java index 9f8cec9e8fa5..15cafd04fbab 100644 --- a/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/dao/SuperTableMapper.java +++ b/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/dao/SuperTableMapper.java @@ -6,24 +6,26 @@ @Repository public interface SuperTableMapper { - // 创建超级表 create table if not exists xxx.xxx (f1 type1, f2 type2, ... ) tags( t1 type1, t2 type2 ...) + // Create super table: create table if not exists xxx.xxx (f1 type1, f2 type2, + // ... ) tags( t1 type1, t2 type2 ...) void createSuperTable(SuperTableMeta tableMetadata); - // 删除超级表 drop table if exists xxx; + // Drop super table: drop table if exists xxx; void dropSuperTable(String database, String name); - // + // - // + // - // + // - // + // - // + // - // - - // + // + // } diff --git a/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/dao/TableMapper.java b/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/dao/TableMapper.java index 32d1875e4d1a..c0f75d220428 100644 --- a/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/dao/TableMapper.java +++ b/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/dao/TableMapper.java @@ -9,19 +9,18 @@ @Repository public interface TableMapper { - // 创建:普通表 + // Create: Normal table void create(TableMeta tableMeta); - // 插入:一张表多个value + // Insert: Multiple records into one table int insertOneTableMultiValues(TableValue values); - // 插入: 一张表多个value,指定的列 + // Insert: Multiple records into one table, specified columns int insertOneTableMultiValuesWithColumns(TableValue values); - // 插入:多个表多个value + // Insert: Multiple records into multiple tables int insertMultiTableMultiValues(List tables); - // 插入:多个表多个value, 指定的列 + // Insert: Multiple records into multiple tables, specified columns int insertMultiTableMultiValuesWithColumns(List tables); - -} \ No newline at end of file +} diff --git a/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/service/DatabaseService.java b/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/service/DatabaseService.java index 3c8e9624066b..68ddd7832352 100644 --- a/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/service/DatabaseService.java +++ b/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/service/DatabaseService.java @@ -14,12 +14,12 @@ public DatabaseService(DataSource dataSource) { this.databaseMapper = new DatabaseMapperImpl(dataSource); } - // 建库,指定 name + // Create database with specified name public void createDatabase(String database) { databaseMapper.createDatabase(database); } - // 建库,指定参数 keep,days,replica等 + // Create database with specified parameters such as keep, days, replica, etc. public void createDatabase(Map map) { if (map.isEmpty()) return; diff --git a/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/service/SubTableService.java b/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/service/SubTableService.java index b0a79dea78f4..690b02f06544 100644 --- a/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/service/SubTableService.java +++ b/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/service/SubTableService.java @@ -27,7 +27,8 @@ public SubTableService(DataSource datasource) { this.mapper = new SubTableMapperImpl(datasource); } - public void createSubTable(SuperTableMeta superTableMeta, long numOfTables, String prefixOfTable, int numOfThreadsForCreate) { + public void createSubTable(SuperTableMeta superTableMeta, long numOfTables, String prefixOfTable, + int numOfThreadsForCreate) { ExecutorService executor = Executors.newFixedThreadPool(numOfThreadsForCreate); for (long i = 0; i < numOfTables; i++) { long tableIndex = i; @@ -35,54 +36,58 @@ public void createSubTable(SuperTableMeta superTableMeta, long numOfTables, Stri } executor.shutdown(); try { - executor.awaitTermination(Long.MAX_VALUE,TimeUnit.NANOSECONDS); + executor.awaitTermination(Long.MAX_VALUE, TimeUnit.NANOSECONDS); } catch (InterruptedException e) { e.printStackTrace(); } } public void createSubTable(SuperTableMeta superTableMeta, String tableName) { - // 构造数据 + // Construct data SubTableMeta meta = SubTableMetaGenerator.generate(superTableMeta, tableName); createSubTable(meta); } - // 创建一张子表,可以指定database,supertable,tablename,tag值 + // Create a sub-table, specifying database, super table, table name, and tag + // values public void createSubTable(SubTableMeta subTableMeta) { mapper.createUsingSuperTable(subTableMeta); } /*************************************************************************************************************************/ - // 插入:多线程,多表 + // Insert: Multi-threaded, multiple tables public int insert(List subTableValues, int threadSize, int frequency) { ExecutorService executor = Executors.newFixedThreadPool(threadSize); Future future = executor.submit(() -> insert(subTableValues)); executor.shutdown(); - //TODO:frequency + // TODO:frequency return getAffectRows(future); } - // 插入:单表,insert into xxx values(),()... + // Insert: Single table, insert into xxx values(),()... public int insert(SubTableValue subTableValue) { return mapper.insertOneTableMultiValues(subTableValue); } - // 插入: 多表,insert into xxx values(),()... xxx values(),()... + // Insert: Multiple tables, insert into xxx values(),()... xxx values(),()... public int insert(List subTableValues) { return mapper.insertMultiTableMultiValues(subTableValues); } - // 插入:单表,自动建表, insert into xxx using xxx tags(...) values(),()... + // Insert: Single table, auto-create table, insert into xxx using xxx tags(...) + // values(),()... public int insertAutoCreateTable(SubTableValue subTableValue) { return mapper.insertOneTableMultiValuesUsingSuperTable(subTableValue); } - // 插入:多表,自动建表, insert into xxx using XXX tags(...) values(),()... xxx using XXX tags(...) values(),()... + // Insert: Multiple tables, auto-create tables, insert into xxx using XXX + // tags(...) values(),()... xxx using XXX tags(...) values(),()... public int insertAutoCreateTable(List subTableValues) { return mapper.insertMultiTableMultiValuesUsingSuperTable(subTableValues); } - public int insertMultiThreads(SuperTableMeta superTableMeta, int threadSize, long tableSize, long startTime, long gap, JdbcTaosdemoConfig config) { + public int insertMultiThreads(SuperTableMeta superTableMeta, int threadSize, long tableSize, long startTime, + long gap, JdbcTaosdemoConfig config) { List taskList = new ArrayList<>(); List threads = IntStream.range(0, threadSize) .mapToObj(i -> { @@ -94,8 +99,7 @@ public int insertMultiThreads(SuperTableMeta superTableMeta, int threadSize, lon startTime, config.timeGap, config.numOfRowsPerTable, config.numOfTablesPerSQL, config.numOfValuesPerSQL, config.order, config.rate, config.range, - config.prefixOfTable, config.autoCreateTable) - ); + config.prefixOfTable, config.autoCreateTable)); taskList.add(task); return new Thread(task, "InsertThread-" + i); }).collect(Collectors.toList()); @@ -126,7 +130,7 @@ public int insertMultiThreads(SuperTableMeta superTableMeta, int threadSize, lon private class InsertTask implements Callable { private final long startTableInd; // included - private final long endTableInd; // excluded + private final long endTableInd; // excluded private final long startTime; private final long timeGap; private final long numOfRowsPerTable; @@ -140,10 +144,10 @@ private class InsertTask implements Callable { private final boolean autoCreateTable; public InsertTask(SuperTableMeta superTableMeta, long startTableInd, long endTableInd, - long startTime, long timeGap, - long numOfRowsPerTable, long numOfTablesPerSQL, long numOfValuesPerSQL, - int order, int rate, long range, - String prefixOfTable, boolean autoCreateTable) { + long startTime, long timeGap, + long numOfRowsPerTable, long numOfTablesPerSQL, long numOfValuesPerSQL, + int order, int rate, long range, + String prefixOfTable, boolean autoCreateTable) { this.superTableMeta = superTableMeta; this.startTableInd = startTableInd; this.endTableInd = endTableInd; @@ -159,7 +163,6 @@ public InsertTask(SuperTableMeta superTableMeta, long startTableInd, long endTab this.autoCreateTable = autoCreateTable; } - @Override public Integer call() { @@ -171,23 +174,27 @@ public Integer call() { int affectRows = 0; // row - for (long rowCnt = 0; rowCnt < numOfRowsPerTable; ) { + for (long rowCnt = 0; rowCnt < numOfRowsPerTable;) { long rowSize = numOfValuesPerSQL; if (rowCnt + rowSize > numOfRowsPerTable) { rowSize = numOfRowsPerTable - rowCnt; } - //table - for (long tableCnt = startTableInd; tableCnt < endTableInd; ) { + // table + for (long tableCnt = startTableInd; tableCnt < endTableInd;) { long tableSize = numOfTablesPerSQL; if (tableCnt + tableSize > endTableInd) { tableSize = endTableInd - tableCnt; } long startTime = this.startTime + rowCnt * timeGap; -// System.out.println(Thread.currentThread().getName() + " >>> " + "rowCnt: " + rowCnt + ", rowSize: " + rowSize + ", " + "tableCnt: " + tableCnt + ",tableSize: " + tableSize + ", " + "startTime: " + startTime + ",timeGap: " + timeGap + ""); + // System.out.println(Thread.currentThread().getName() + " >>> " + "rowCnt: " + + // rowCnt + ", rowSize: " + rowSize + ", " + "tableCnt: " + tableCnt + + // ",tableSize: " + tableSize + ", " + "startTime: " + startTime + ",timeGap: " + // + timeGap + ""); /***********************************************/ - // 生成数据 - List data = SubTableValueGenerator.generate(superTableMeta, prefixOfTable, tableCnt, tableSize, rowSize, startTime, timeGap); - // 乱序 + // Construct data + List data = SubTableValueGenerator.generate(superTableMeta, prefixOfTable, tableCnt, + tableSize, rowSize, startTime, timeGap); + // disorder if (order != 0) SubTableValueGenerator.disrupt(data, rate, range); // insert @@ -205,5 +212,4 @@ public Integer call() { } } - } diff --git a/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/service/SuperTableService.java b/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/service/SuperTableService.java index b91348e2d008..47798e0c4e11 100644 --- a/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/service/SuperTableService.java +++ b/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/service/SuperTableService.java @@ -14,7 +14,7 @@ public SuperTableService(DataSource dataSource) { this.superTableMapper = new SuperTableMapperImpl(dataSource); } - // 创建超级表,指定每个field的名称和类型,每个tag的名称和类型 + // Create super table, specifying the name and type of each field and each tag public void create(SuperTableMeta superTableMeta) { superTableMapper.createSuperTable(superTableMeta); } diff --git a/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/service/TableService.java b/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/service/TableService.java index 2504fdb0b4cd..2bfb963b4aac 100644 --- a/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/service/TableService.java +++ b/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/service/TableService.java @@ -11,15 +11,14 @@ public class TableService extends AbstractService { private TableMapper tableMapper; - //创建一张表 + // Create a table public void create(TableMeta tableMeta) { tableMapper.create(tableMeta); } - //创建多张表 + // Create multiple tables public void create(List tables) { tables.stream().forEach(this::create); } - } diff --git a/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/service/data/FieldValueGenerator.java b/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/service/data/FieldValueGenerator.java index 73cd981a4651..b3ce35231c0a 100644 --- a/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/service/data/FieldValueGenerator.java +++ b/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/service/data/FieldValueGenerator.java @@ -11,7 +11,8 @@ public class FieldValueGenerator { public static Random random = new Random(System.currentTimeMillis()); - // 生成start到end的时间序列,时间戳为顺序,不含有乱序,field的value为随机生成 + // Generate a time series from start to end, timestamps are in order without + // disorder, field values are randomly generated public static List generate(long start, long end, long timeGap, List fieldMetaList) { List values = new ArrayList<>(); @@ -29,9 +30,12 @@ public static List generate(long start, long end, long timeGap, List disrupt(List values, int rate, long range) { - long timeGap = (long) (values.get(1).getFields().get(0).getValue()) - (long) (values.get(0).getFields().get(0).getValue()); + long timeGap = (long) (values.get(1).getFields().get(0).getValue()) + - (long) (values.get(0).getFields().get(0).getValue()); int bugSize = values.size() * rate / 100; Set bugIndSet = new HashSet<>(); while (bugIndSet.size() < bugSize) { diff --git a/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/service/data/SubTableMetaGenerator.java b/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/service/data/SubTableMetaGenerator.java index 88e3c0d26a5a..7bdd72ec3be9 100644 --- a/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/service/data/SubTableMetaGenerator.java +++ b/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/service/data/SubTableMetaGenerator.java @@ -9,7 +9,7 @@ public class SubTableMetaGenerator { - // 创建tableSize张子表,使用tablePrefix作为子表名的前缀,使用superTableMeta的元数据 + // Create tableSize sub-tables, using tablePrefix as the prefix for sub-table names, and using the metadata from superTableMeta // create table xxx using XXX tags(XXX) public static List generate(SuperTableMeta superTableMeta, int tableSize, String tablePrefix) { List subTableMetaList = new ArrayList<>(); diff --git a/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/service/data/SuperTableMetaGenerator.java b/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/service/data/SuperTableMetaGenerator.java index 05aefd01ac8e..383b492c5adf 100644 --- a/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/service/data/SuperTableMetaGenerator.java +++ b/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/service/data/SuperTableMetaGenerator.java @@ -10,10 +10,11 @@ public class SuperTableMetaGenerator { - // 创建超级表,使用指定SQL语句 + // Create super table using the specified SQL statement public static SuperTableMeta generate(String superTableSQL) { SuperTableMeta tableMeta = new SuperTableMeta(); - // for example : create table superTable (ts timestamp, temperature float, humidity int) tags(location nchar(64), groupId int) + // for example : create table superTable (ts timestamp, temperature float, + // humidity int) tags(location nchar(64), groupId int) superTableSQL = superTableSQL.trim().toLowerCase(); if (!superTableSQL.startsWith("create")) throw new RuntimeException("invalid create super table SQL"); @@ -54,8 +55,9 @@ public static SuperTableMeta generate(String superTableSQL) { return tableMeta; } - // 创建超级表,指定field和tag的个数 - public static SuperTableMeta generate(String database, String name, int fieldSize, String fieldPrefix, int tagSize, String tagPrefix) { + // Create super table with specified number of fields and tags + public static SuperTableMeta generate(String database, String name, int fieldSize, String fieldPrefix, int tagSize, + String tagPrefix) { if (fieldSize < 2 || tagSize < 1) { throw new RuntimeException("create super table but fieldSize less than 2 or tagSize less than 1"); } @@ -66,7 +68,8 @@ public static SuperTableMeta generate(String database, String name, int fieldSiz List fields = new ArrayList<>(); fields.add(new FieldMeta("ts", "timestamp")); for (int i = 1; i <= fieldSize; i++) { - fields.add(new FieldMeta(fieldPrefix + "" + i, TaosConstants.DATA_TYPES[i % TaosConstants.DATA_TYPES.length])); + fields.add( + new FieldMeta(fieldPrefix + "" + i, TaosConstants.DATA_TYPES[i % TaosConstants.DATA_TYPES.length])); } tableMetadata.setFields(fields); // tags diff --git a/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/service/data/TagValueGenerator.java b/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/service/data/TagValueGenerator.java index b8024fea45c0..f7b18ca7cf6d 100644 --- a/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/service/data/TagValueGenerator.java +++ b/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/service/data/TagValueGenerator.java @@ -9,7 +9,7 @@ public class TagValueGenerator { - // 创建标签值:使用tagMetas + // Create tag values using tagMetas public static List generate(List tagMetas) { List tagValues = new ArrayList<>(); for (int i = 0; i < tagMetas.size(); i++) { diff --git a/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/utils/TimeStampUtil.java b/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/utils/TimeStampUtil.java index 9cfce16d8285..53748169aedc 100644 --- a/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/utils/TimeStampUtil.java +++ b/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/utils/TimeStampUtil.java @@ -41,17 +41,17 @@ public static TimeTuple range(long start, long timeGap, long size) { if (start == 0) start = now - size * timeGap; - // 如果size小于1异常 + // If size is less than 1, throw an exception if (size < 1) throw new IllegalArgumentException("size less than 1."); - // 如果timeGap为1,已经超长,需要前移start + // If timeGap is 1 and it exceeds the limit, move start forward if (start + size > now) { start = now - size; return new TimeTuple(start, now, 1); } long end = start + (long) (timeGap * size); if (end > now) { - //压缩timeGap + // Compress timeGap end = now; double gap = (end - start) / (size * 1.0f); if (gap < 1.0f) { diff --git a/docs/examples/JDBC/taosdemo/src/main/resources/log4j.properties b/docs/examples/JDBC/taosdemo/src/main/resources/log4j.properties index 352545854d0f..40b1478a24a9 100644 --- a/docs/examples/JDBC/taosdemo/src/main/resources/log4j.properties +++ b/docs/examples/JDBC/taosdemo/src/main/resources/log4j.properties @@ -1,21 +1,21 @@ -### 设置### +### Settings ### log4j.rootLogger=info,stdout -### 输出信息到控制抬 ### +### Output information to the console ### log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.Target=System.out log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=[%-5p] %d{yyyy-MM-dd HH:mm:ss,SSS} method:%l%n%m%n -### 输出DEBUG 级别以上的日志到=logs/debug.log +### Output logs of DEBUG level and above to logs/debug.log ### log4j.appender.DebugLog=org.apache.log4j.DailyRollingFileAppender log4j.appender.DebugLog.File=logs/debug.log log4j.appender.DebugLog.Append=true log4j.appender.DebugLog.Threshold=DEBUG log4j.appender.DebugLog.layout=org.apache.log4j.PatternLayout log4j.appender.DebugLog.layout.ConversionPattern=%-d{yyyy-MM-dd HH:mm:ss} [ %t:%r ] - [ %p ] %m%n -### 输出ERROR 级别以上的日志到=logs/error.log +### Output logs of ERROR level and above to logs/error.log ### log4j.appender.ErrorLog=org.apache.log4j.DailyRollingFileAppender log4j.appender.ErrorLog.File=logs/error.log log4j.appender.ErrorLog.Append=true log4j.appender.ErrorLog.Threshold=ERROR log4j.appender.ErrorLog.layout=org.apache.log4j.PatternLayout -log4j.appender.ErrorLog.layout.ConversionPattern=%-d{yyyy-MM-dd HH:mm:ss} [ %t:%r ] - [ %p ] %m%n \ No newline at end of file +log4j.appender.ErrorLog.layout.ConversionPattern=%-d{yyyy-MM-dd HH:mm:ss} [ %t:%r ] - [ %p ] %m%n From 29ba8ffb2d0da91cb1632cff4f7cdebc91d4404a Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Sat, 5 Oct 2024 16:12:59 +0800 Subject: [PATCH 093/695] refactor: init the local variable value. --- source/libs/stream/src/streamTask.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/stream/src/streamTask.c b/source/libs/stream/src/streamTask.c index 71a2ed3e4a00..53b262dff564 100644 --- a/source/libs/stream/src/streamTask.c +++ b/source/libs/stream/src/streamTask.c @@ -884,7 +884,7 @@ int32_t streamBuildAndSendDropTaskMsg(SMsgCb* pMsgCb, int32_t vgId, SStreamTaskI } int32_t streamSendChkptReportMsg(SStreamTask* pTask, SCheckpointInfo* pCheckpointInfo, int8_t dropRelHTask) { - int32_t code; + int32_t code = 0; int32_t tlen = 0; int32_t vgId = pTask->pMeta->vgId; const char* id = pTask->id.idStr; From 67fe6091298de92b1bb0876d09e985e2f74cbcbf Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Tue, 8 Oct 2024 18:24:16 +0800 Subject: [PATCH 094/695] enh:[TS-5441] cost too long in tmq write meta data by cache meta and vg info --- include/libs/parser/parser.h | 4 +-- source/client/src/clientRawBlockWrite.c | 41 ++++++++++++------------- source/libs/parser/src/parInsertUtil.c | 21 ++++++++++--- utils/test/c/tmq_taosx_ci.c | 1 + 4 files changed, 38 insertions(+), 29 deletions(-) diff --git a/include/libs/parser/parser.h b/include/libs/parser/parser.h index c98b188d49bd..832e4f8863ef 100644 --- a/include/libs/parser/parser.h +++ b/include/libs/parser/parser.h @@ -176,8 +176,8 @@ int32_t smlBindData(SQuery* handle, bool dataFormat, SArray* tags, SArray* colsS STableMeta* pTableMeta, char* tableName, const char* sTableName, int32_t sTableNameLen, int32_t ttl, char* msgBuf, int32_t msgBufLen); int32_t smlBuildOutput(SQuery* handle, SHashObj* pVgHash); -int rawBlockBindData(SQuery* query, STableMeta* pTableMeta, void* data, SVCreateTbReq* pCreateTb, TAOS_FIELD* fields, - int numFields, bool needChangeLength, char* errstr, int32_t errstrLen); +int rawBlockBindData(SQuery* query, STableMeta* pTableMeta, void* data, SVCreateTbReq* pCreateTb, void* fields, + int numFields, bool needChangeLength, char* errstr, int32_t errstrLen, bool raw); int32_t rewriteToVnodeModifyOpStmt(SQuery* pQuery, SArray* pBufArray); int32_t serializeVgroupsCreateTableBatch(SHashObj* pVgroupHashmap, SArray** pOut); diff --git a/source/client/src/clientRawBlockWrite.c b/source/client/src/clientRawBlockWrite.c index 17ebd9b5584b..064c3bdb2ecb 100644 --- a/source/client/src/clientRawBlockWrite.c +++ b/source/client/src/clientRawBlockWrite.c @@ -1618,7 +1618,7 @@ int taos_write_raw_block_with_fields_with_reqid(TAOS* taos, int rows, char* pDat RAW_NULL_CHECK(pVgHash); RAW_RETURN_CHECK( taosHashPut(pVgHash, (const char*)&vgData.vgId, sizeof(vgData.vgId), (char*)&vgData, sizeof(vgData))); - RAW_RETURN_CHECK(rawBlockBindData(pQuery, pTableMeta, pData, NULL, fields, numFields, false, NULL, 0)); + RAW_RETURN_CHECK(rawBlockBindData(pQuery, pTableMeta, pData, NULL, fields, numFields, false, NULL, 0, false)); RAW_RETURN_CHECK(smlBuildOutput(pQuery, pVgHash)); launchQueryImpl(pRequest, pQuery, true, NULL); @@ -1678,7 +1678,7 @@ int taos_write_raw_block_with_reqid(TAOS* taos, int rows, char* pData, const cha RAW_NULL_CHECK(pVgHash); RAW_RETURN_CHECK( taosHashPut(pVgHash, (const char*)&vgData.vgId, sizeof(vgData.vgId), (char*)&vgData, sizeof(vgData))); - RAW_RETURN_CHECK(rawBlockBindData(pQuery, pTableMeta, pData, NULL, NULL, 0, false, NULL, 0)); + RAW_RETURN_CHECK(rawBlockBindData(pQuery, pTableMeta, pData, NULL, NULL, 0, false, NULL, 0, false)); RAW_RETURN_CHECK(smlBuildOutput(pQuery, pVgHash)); launchQueryImpl(pRequest, pQuery, true, NULL); @@ -1960,35 +1960,32 @@ static int32_t tmqWriteRawImpl(TAOS* taos, uint16_t type, void* data, int32_t da vgId = vg->vgId; } - STableMeta** pTableMeta = (STableMeta**)taosHashGet(pMetaHash, tbName, strlen(tbName)); - if (pTableMeta == NULL) { + STableMeta* pTableMeta = NULL; + STableMeta** pTableMetaTmp = (STableMeta**)taosHashGet(pMetaHash, tbName, strlen(tbName)); + if (pTableMetaTmp == NULL) { if (pCreateReqDst) { // change stable name to get meta (void)strcpy(pName.tname, pCreateReqDst->ctb.stbName); } - RAW_RETURN_CHECK(catalogGetTableMeta(pCatalog, &conn, &pName, pTableMeta)); - RAW_RETURN_CHECK(taosHashPut(pMetaHash, tbName, strlen(tbName), pTableMeta, POINTER_BYTES)); + RAW_RETURN_CHECK(catalogGetTableMeta(pCatalog, &conn, &pName, &pTableMeta)); + code = taosHashPut(pMetaHash, tbName, strlen(tbName), &pTableMeta, POINTER_BYTES); + if (code != 0){ + taosMemoryFree(pTableMeta); + goto end; + } if (pCreateReqDst) { - (*pTableMeta)->vgId = vgId; - (*pTableMeta)->uid = pCreateReqDst->uid; - pCreateReqDst->ctb.suid = (*pTableMeta)->suid; + pTableMeta->vgId = vgId; + pTableMeta->uid = pCreateReqDst->uid; + pCreateReqDst->ctb.suid = pTableMeta->suid; } + }else{ + pTableMeta = *pTableMetaTmp; } -// SSchemaWrapper* pSW = (SSchemaWrapper*)taosArrayGetP(rspObj.dataRsp.blockSchema, rspObj.resIter); -// RAW_NULL_CHECK(pSW); -// TAOS_FIELD* fields = taosMemoryCalloc(pSW->nCols, sizeof(TAOS_FIELD)); -// RAW_NULL_CHECK(fields); -// -// for (int i = 0; i < pSW->nCols; i++) { -// fields[i].type = pSW->pSchema[i].type; -// fields[i].bytes = pSW->pSchema[i].bytes; -// tstrncpy(fields[i].name, pSW->pSchema[i].name, tListLen(pSW->pSchema[i].name)); -// } + SSchemaWrapper* pSW = (SSchemaWrapper*)taosArrayGetP(rspObj.dataRsp.blockSchema, rspObj.resIter); + RAW_NULL_CHECK(pSW); void* rawData = getRawDataFromRes(pRetrieve); char err[ERR_MSG_LEN] = {0}; - code = rawBlockBindData(pQuery, *pTableMeta, rawData, pCreateReqDst, NULL, 0, true, err, ERR_MSG_LEN); -// code = rawBlockBindData(pQuery, *pTableMeta, rawData, pCreateReqDst, fields, pSW->nCols, true, err, ERR_MSG_LEN); -// taosMemoryFree(fields); + code = rawBlockBindData(pQuery, pTableMeta, rawData, pCreateReqDst, pSW, pSW->nCols, true, err, ERR_MSG_LEN, true); if (code != TSDB_CODE_SUCCESS) { SET_ERROR_MSG("table:%s, err:%s", tbName, err); goto end; diff --git a/source/libs/parser/src/parInsertUtil.c b/source/libs/parser/src/parInsertUtil.c index 838f797394a8..f29ed79412fc 100644 --- a/source/libs/parser/src/parInsertUtil.c +++ b/source/libs/parser/src/parInsertUtil.c @@ -886,8 +886,8 @@ static bool findFileds(SSchema* pSchema, TAOS_FIELD* fields, int numFields) { return false; } -int rawBlockBindData(SQuery* query, STableMeta* pTableMeta, void* data, SVCreateTbReq* pCreateTb, TAOS_FIELD* tFields, - int numFields, bool needChangeLength, char* errstr, int32_t errstrLen) { +int rawBlockBindData(SQuery* query, STableMeta* pTableMeta, void* data, SVCreateTbReq* pCreateTb, void* tFields, + int numFields, bool needChangeLength, char* errstr, int32_t errstrLen, bool raw) { int ret = 0; if(data == NULL) { uError("rawBlockBindData, data is NULL"); @@ -964,11 +964,16 @@ int rawBlockBindData(SQuery* query, STableMeta* pTableMeta, void* data, SVCreate goto end; } if (tFields != NULL && numFields > boundInfo->numOfBound) { - if (errstr != NULL) - snprintf(errstr, errstrLen, "numFields:%d bigger than num of bound cols:%d", numFields, boundInfo->numOfBound); + if (errstr != NULL) snprintf(errstr, errstrLen, "numFields:%d bigger than num of bound cols:%d", numFields, boundInfo->numOfBound); ret = TSDB_CODE_INVALID_PARA; goto end; } + if (tFields == NULL && numOfCols != boundInfo->numOfBound) { + if (errstr != NULL) snprintf(errstr, errstrLen, "numFields:%d not equal to num of bound cols:%d", numOfCols, boundInfo->numOfBound); + ret = TSDB_CODE_INVALID_PARA; + goto end; + } + if (tFields == NULL) { for (int j = 0; j < boundInfo->numOfBound; j++) { SSchema* pColSchema = &pSchema[j]; @@ -1006,7 +1011,13 @@ int rawBlockBindData(SQuery* query, STableMeta* pTableMeta, void* data, SVCreate for (int i = 0; i < numFields; i++) { for (int j = 0; j < boundInfo->numOfBound; j++) { SSchema* pColSchema = &pSchema[j]; - if (strcmp(pColSchema->name, tFields[i].name) == 0) { + char* fieldName = NULL; + if (raw) { + fieldName = ((SSchemaWrapper*)tFields)->pSchema[i].name; + } else { + fieldName = ((TAOS_FIELD*)tFields)[i].name; + } + if (strcmp(pColSchema->name, fieldName) == 0) { if (*fields != pColSchema->type && *(int32_t*)(fields + sizeof(int8_t)) != pColSchema->bytes) { if (errstr != NULL) snprintf(errstr, errstrLen, diff --git a/utils/test/c/tmq_taosx_ci.c b/utils/test/c/tmq_taosx_ci.c index 3a79a3763cb4..d49c7e4ad4e1 100644 --- a/utils/test/c/tmq_taosx_ci.c +++ b/utils/test/c/tmq_taosx_ci.c @@ -79,6 +79,7 @@ static void msg_process(TAOS_RES* msg) { } else { taosFprintfFile(g_fp, result); taosFprintfFile(g_fp, "\n"); + taosFsyncFile(g_fp); } } } From 6170bb5c1cd550536c86c2bf3279dcb78a10ef58 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Wed, 9 Oct 2024 09:39:32 +0800 Subject: [PATCH 095/695] enh(stream): check the existence for snode. --- source/dnode/mnode/impl/inc/mndStream.h | 1 + source/dnode/mnode/impl/src/mndStream.c | 19 ++++++++++++---- source/dnode/mnode/impl/src/mndStreamUtil.c | 24 +++++++++++++++++++++ source/dnode/vnode/src/vnd/vnodeSvr.c | 2 +- source/libs/stream/src/streamTimer.c | 2 +- 5 files changed, 42 insertions(+), 6 deletions(-) diff --git a/source/dnode/mnode/impl/inc/mndStream.h b/source/dnode/mnode/impl/inc/mndStream.h index b97eaf31d1ad..ebc2e50065d1 100644 --- a/source/dnode/mnode/impl/inc/mndStream.h +++ b/source/dnode/mnode/impl/inc/mndStream.h @@ -133,6 +133,7 @@ int32_t mndStreamSetUpdateEpsetAction(SMnode *pMnode, SStreamObj *pStream, SVgr int32_t mndGetStreamObj(SMnode *pMnode, int64_t streamId, SStreamObj** pStream); bool mndStreamNodeIsUpdated(SMnode *pMnode); +bool mndCheckForSnode(SMnode *pMnode, SDbObj *pSrcDb); int32_t extractNodeEpset(SMnode *pMnode, SEpSet *pEpSet, bool *hasEpset, int32_t taskId, int32_t nodeId); int32_t mndProcessStreamHb(SRpcMsg *pReq); diff --git a/source/dnode/mnode/impl/src/mndStream.c b/source/dnode/mnode/impl/src/mndStream.c index 3ec99f6e44c2..d486570300fd 100644 --- a/source/dnode/mnode/impl/src/mndStream.c +++ b/source/dnode/mnode/impl/src/mndStream.c @@ -801,12 +801,23 @@ static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) { } if (createReq.sql != NULL) { - sqlLen = strlen(createReq.sql); - sql = taosMemoryMalloc(sqlLen + 1); + sql = taosStrdup(createReq.sql); TSDB_CHECK_NULL(sql, code, lino, _OVER, terrno); + } + + SDbObj *pSourceDb = mndAcquireDb(pMnode, createReq.sourceDB); + if (pSourceDb == NULL) { + code = terrno; + mInfo("stream:%s failed to create, acquire source db %s failed, code:%s", createReq.name, createReq.sourceDB, + tstrerror(code)); + goto _OVER; + } - memset(sql, 0, sqlLen + 1); - memcpy(sql, createReq.sql, sqlLen); + bool snodeCheckSucc = mndCheckForSnode(pMnode, pSourceDb); + mndReleaseDb(pMnode, pSourceDb); + if (!snodeCheckSucc) { + code = TSDB_CODE_SNODE_NOT_DEPLOYED; + goto _OVER; } // build stream obj from request diff --git a/source/dnode/mnode/impl/src/mndStreamUtil.c b/source/dnode/mnode/impl/src/mndStreamUtil.c index 6e48c58b30fb..206422b7950f 100644 --- a/source/dnode/mnode/impl/src/mndStreamUtil.c +++ b/source/dnode/mnode/impl/src/mndStreamUtil.c @@ -1497,6 +1497,30 @@ bool mndStreamNodeIsUpdated(SMnode *pMnode) { return updated; } +bool mndCheckForSnode(SMnode *pMnode, SDbObj *pSrcDb) { + SSdb *pSdb = pMnode->pSdb; + void *pIter = NULL; + SSnodeObj *pObj = NULL; + + if (pSrcDb->cfg.replications == 1) { + return true; + } else { + while (1) { + pIter = sdbFetch(pSdb, SDB_SNODE, pIter, (void **)&pObj); + if (pIter == NULL) { + break; + } + + sdbRelease(pSdb, pObj); + sdbCancelFetch(pSdb, pIter); + return true; + } + + mError("snode not existed when trying to create stream in db with multiple replica"); + return false; + } +} + uint32_t seed = 0; static SRpcMsg createRpcMsg(STransAction* pAction, int64_t traceId, int64_t signature) { SRpcMsg rpcMsg = {.msgType = pAction->msgType, .contLen = pAction->contLen, .info.ahandle = (void *)signature}; diff --git a/source/dnode/vnode/src/vnd/vnodeSvr.c b/source/dnode/vnode/src/vnd/vnodeSvr.c index 9dbf16cb48ac..ab8eede0ddfc 100644 --- a/source/dnode/vnode/src/vnd/vnodeSvr.c +++ b/source/dnode/vnode/src/vnd/vnodeSvr.c @@ -629,7 +629,7 @@ int32_t vnodeProcessWriteMsg(SVnode *pVnode, SRpcMsg *pMsg, int64_t ver, SRpcMsg } break; case TDMT_STREAM_TASK_DEPLOY: { - int32_t code = tqProcessTaskDeployReq(pVnode->pTq, ver, pReq, len); + code = tqProcessTaskDeployReq(pVnode->pTq, ver, pReq, len); if (code != TSDB_CODE_SUCCESS) { terrno = code; goto _err; diff --git a/source/libs/stream/src/streamTimer.c b/source/libs/stream/src/streamTimer.c index 8b77fe7cb150..0da9acfd1dbc 100644 --- a/source/libs/stream/src/streamTimer.c +++ b/source/libs/stream/src/streamTimer.c @@ -56,7 +56,7 @@ void streamTmrStart(TAOS_TMR_CALLBACK fp, int32_t mseconds, void* pParam, void* } } - stDebug("vgId:%d start %s tmr succ", vgId, pMsg); + stTrace("vgId:%d start %s tmr succ", vgId, pMsg); } void streamTmrStop(tmr_h tmrId) { From a2fa41ccc77797da594464221768c43cabc51448 Mon Sep 17 00:00:00 2001 From: Yu Chen <74105241+yu285@users.noreply.github.com> Date: Wed, 9 Oct 2024 09:51:19 +0800 Subject: [PATCH 096/695] Update 01-arch.md --- docs/zh/26-tdinternal/01-arch.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/zh/26-tdinternal/01-arch.md b/docs/zh/26-tdinternal/01-arch.md index 04e47797a86d..8aa69e45d5dd 100644 --- a/docs/zh/26-tdinternal/01-arch.md +++ b/docs/zh/26-tdinternal/01-arch.md @@ -178,7 +178,7 @@ TDengine 集群可以容纳单个、多个甚至几千个数据节点。应用 TDengine 存储的数据包括采集的时序数据以及库、表相关的元数据、标签数据等,这些数据具体分为三部分: -- 时序数据:TDengine 的核心存储对象,存放于 vnode 里,由 data、head 和 last 三个文件组成,数据量大,查询量取决于应用场景。允许乱序写入,但暂时不支持删除操作,并且仅在 update 参数设置为 1 时允许更新操作。通过采用一个采集点一张表的模型,一个时间段的数据是连续存储,对单张表的写入是简单的追加操作,一次读,可以读到多条记录,这样保证对单个采集点的插入和查询操作,性能达到最优。 +- 时序数据:时序数据是 TDengine 的核心存储对象,它们被存储在 vnode 中。时序数据由 data、head、sma 和 stt 4 类文件组成,这些文件共同构成了时序数据的完整存储结构。由于时序数据的特点是数据量大且查询需求取决于具体应用场景,因此 TDengine 采用了“一个数据采集点一张表”的模型来优化存储和查询性能。在这种模型下,一个时间段内的数据是连续存储的,对单张表的写入是简单的追加操作,一次读取可以获取多条记录。这种设计确保了单个数据采集点的写入和查询操作都能达到最优性能。 - 数据表元数据:包含标签信息和 Table Schema 信息,存放于 vnode 里的 meta 文件,支持增删改查四个标准操作。数据量很大,有 N 张表,就有 N 条记录,因此采用 LRU 存储,支持标签数据的索引。TDengine 支持多核多线程并发查询。只要计算内存足够,元数据全内存存储,千万级别规模的标签数据过滤结果能毫秒级返回。在内存资源不足的情况下,仍然可以支持数千万张表的快速查询。 - 数据库元数据:存放于 mnode 里,包含系统节点、用户、DB、STable Schema 等信息,支持增删改查四个标准操作。这部分数据的量不大,可以全内存保存,而且由于客户端有缓存,查询量也不大。因此目前的设计虽是集中式存储管理,但不会构成性能瓶颈。 @@ -321,4 +321,4 @@ TDengine 采用了一种数据驱动的策略来实现缓存数据的持久化 此外,TDengine 还提供了数据分级存储的功能,允许用户将不同时间段的数据存储在不同存储设备的目录中,以此实现将“热”数据和“冷”数据分开存储。这样做可以充分利用各种存储资源,同时节约成本。例如,对于最新采集且需要频繁访问的数据,由于其读取性能要求较高,用户可以配置将这些数据存储在高性能的固态硬盘上。而对于超过一定期限、查询需求较低的数据,则可以将其存储在成本相对较低的机械硬盘上。 -为了进一步降低存储成本,TDengine 还支持将时序数据存储在对象存储系统中。通过其创新性的设计,在大多数情况下,从对象存储系统中查询时序数据的性能接近本地硬盘的一半,而在某些场景下,性能甚至可以与本地硬盘相媲美。同时,TDengine 还允许用户对存储在对象存储中的时序数据执行删除和更新操作。 \ No newline at end of file +为了进一步降低存储成本,TDengine 还支持将时序数据存储在对象存储系统中。通过其创新性的设计,在大多数情况下,从对象存储系统中查询时序数据的性能接近本地硬盘的一半,而在某些场景下,性能甚至可以与本地硬盘相媲美。同时,TDengine 还允许用户对存储在对象存储中的时序数据执行删除和更新操作。 From 1353614dc213ab88cf69dcfbdf174ef34700f8d2 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Wed, 9 Oct 2024 10:02:52 +0800 Subject: [PATCH 097/695] fix ci issue --- source/libs/executor/src/scanoperator.c | 1 - source/libs/executor/src/streamtimesliceoperator.c | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 05d546560684..48a4d75edfd5 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -2375,7 +2375,6 @@ static int32_t generateTimeSliceScanRange(SStreamScanInfo* pInfo, SSDataBlock* p } STimeWindow scanRange = {0}; - ASSERT(mode == STREAM_DELETE_RESULT || mode == STREAM_DELETE_DATA); code = getTimeSliceWinRange(pInfo->windowSup.pStreamAggSup, pInfo->pFillSup, &pInfo->interval, startData[i], endData[i], groupId, &scanRange); QUERY_CHECK_CODE(code, lino, _end); diff --git a/source/libs/executor/src/streamtimesliceoperator.c b/source/libs/executor/src/streamtimesliceoperator.c index d03f4fba3873..fc331664dd5c 100644 --- a/source/libs/executor/src/streamtimesliceoperator.c +++ b/source/libs/executor/src/streamtimesliceoperator.c @@ -1807,7 +1807,8 @@ static int32_t doStreamTimeSliceNext(SOperatorInfo* pOperator, SSDataBlock** ppR continue; } default: - ASSERTS(false, "invalid SSDataBlock type"); + code = TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR; + QUERY_CHECK_CODE(code, lino, _end); } doStreamTimeSliceImpl(pOperator, pBlock); From 39495ec935a617aad3d7358dc6dc51cf41abe49a Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Wed, 9 Oct 2024 10:07:08 +0800 Subject: [PATCH 098/695] refactor: do some internal refactor. --- source/dnode/mnode/impl/inc/mndStream.h | 2 +- source/dnode/mnode/impl/src/mndStream.c | 5 ++--- source/dnode/mnode/impl/src/mndStreamUtil.c | 8 ++++---- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/source/dnode/mnode/impl/inc/mndStream.h b/source/dnode/mnode/impl/inc/mndStream.h index ebc2e50065d1..c9155f536c90 100644 --- a/source/dnode/mnode/impl/inc/mndStream.h +++ b/source/dnode/mnode/impl/inc/mndStream.h @@ -133,7 +133,7 @@ int32_t mndStreamSetUpdateEpsetAction(SMnode *pMnode, SStreamObj *pStream, SVgr int32_t mndGetStreamObj(SMnode *pMnode, int64_t streamId, SStreamObj** pStream); bool mndStreamNodeIsUpdated(SMnode *pMnode); -bool mndCheckForSnode(SMnode *pMnode, SDbObj *pSrcDb); +int32_t mndCheckForSnode(SMnode *pMnode, SDbObj *pSrcDb); int32_t extractNodeEpset(SMnode *pMnode, SEpSet *pEpSet, bool *hasEpset, int32_t taskId, int32_t nodeId); int32_t mndProcessStreamHb(SRpcMsg *pReq); diff --git a/source/dnode/mnode/impl/src/mndStream.c b/source/dnode/mnode/impl/src/mndStream.c index d486570300fd..9c22543265e2 100644 --- a/source/dnode/mnode/impl/src/mndStream.c +++ b/source/dnode/mnode/impl/src/mndStream.c @@ -813,10 +813,9 @@ static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) { goto _OVER; } - bool snodeCheckSucc = mndCheckForSnode(pMnode, pSourceDb); + code = mndCheckForSnode(pMnode, pSourceDb); mndReleaseDb(pMnode, pSourceDb); - if (!snodeCheckSucc) { - code = TSDB_CODE_SNODE_NOT_DEPLOYED; + if (code != 0) { goto _OVER; } diff --git a/source/dnode/mnode/impl/src/mndStreamUtil.c b/source/dnode/mnode/impl/src/mndStreamUtil.c index 206422b7950f..423d9df4b6fb 100644 --- a/source/dnode/mnode/impl/src/mndStreamUtil.c +++ b/source/dnode/mnode/impl/src/mndStreamUtil.c @@ -1497,13 +1497,13 @@ bool mndStreamNodeIsUpdated(SMnode *pMnode) { return updated; } -bool mndCheckForSnode(SMnode *pMnode, SDbObj *pSrcDb) { +int32_t mndCheckForSnode(SMnode *pMnode, SDbObj *pSrcDb) { SSdb *pSdb = pMnode->pSdb; void *pIter = NULL; SSnodeObj *pObj = NULL; if (pSrcDb->cfg.replications == 1) { - return true; + return TSDB_CODE_SUCCESS; } else { while (1) { pIter = sdbFetch(pSdb, SDB_SNODE, pIter, (void **)&pObj); @@ -1513,11 +1513,11 @@ bool mndCheckForSnode(SMnode *pMnode, SDbObj *pSrcDb) { sdbRelease(pSdb, pObj); sdbCancelFetch(pSdb, pIter); - return true; + return TSDB_CODE_SUCCESS; } mError("snode not existed when trying to create stream in db with multiple replica"); - return false; + return TSDB_CODE_SNODE_NOT_DEPLOYED; } } From 67237ae6156df93cc02e53f8596c8b44b2fd2191 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Wed, 9 Oct 2024 10:07:39 +0800 Subject: [PATCH 099/695] fix ci issue --- source/libs/executor/src/streamtimesliceoperator.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/libs/executor/src/streamtimesliceoperator.c b/source/libs/executor/src/streamtimesliceoperator.c index fc331664dd5c..d17ca0e10068 100644 --- a/source/libs/executor/src/streamtimesliceoperator.c +++ b/source/libs/executor/src/streamtimesliceoperator.c @@ -1662,7 +1662,8 @@ static int32_t doDeleteTimeSliceResult(SStreamAggSupporter* pAggSup, SSDataBlock if (key.ts > endCalTs) { break; } - (void)tSimpleHashRemove(pUpdatedMap, &key, sizeof(SWinKey)); + int32_t tmpRes = tSimpleHashRemove(pUpdatedMap, &key, sizeof(SWinKey)); + qTrace("delete stream interp result at line %d res: %s", __func__, __LINE__, tstrerror(tmpRes)); pAggSup->stateStore.streamStateDel(pAggSup->pState, &key); if (winCode != TSDB_CODE_SUCCESS) { From 609fb0b19807b3e24256866dd1f020524fc80cd5 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Wed, 9 Oct 2024 10:19:31 +0800 Subject: [PATCH 100/695] fix ci issue --- source/libs/executor/src/streamtimesliceoperator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/executor/src/streamtimesliceoperator.c b/source/libs/executor/src/streamtimesliceoperator.c index d17ca0e10068..f3f362ec7c74 100644 --- a/source/libs/executor/src/streamtimesliceoperator.c +++ b/source/libs/executor/src/streamtimesliceoperator.c @@ -1663,7 +1663,7 @@ static int32_t doDeleteTimeSliceResult(SStreamAggSupporter* pAggSup, SSDataBlock break; } int32_t tmpRes = tSimpleHashRemove(pUpdatedMap, &key, sizeof(SWinKey)); - qTrace("delete stream interp result at line %d res: %s", __func__, __LINE__, tstrerror(tmpRes)); + qTrace("%s delete stream interp result at line %d res: %s", __func__, __LINE__, tstrerror(tmpRes)); pAggSup->stateStore.streamStateDel(pAggSup->pState, &key); if (winCode != TSDB_CODE_SUCCESS) { From bfb94343fc8938e40cd4c8858a2a34d1369767cf Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Wed, 9 Oct 2024 10:34:19 +0800 Subject: [PATCH 101/695] fix ci issue --- include/libs/stream/tstreamFileState.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/libs/stream/tstreamFileState.h b/include/libs/stream/tstreamFileState.h index 2d418340a215..8caa69d83ab7 100644 --- a/include/libs/stream/tstreamFileState.h +++ b/include/libs/stream/tstreamFileState.h @@ -47,8 +47,6 @@ typedef int32_t (*range_cmpr_fn)(const SSessionKey* pWin1, const SSessionKey* pW typedef int (*__session_compare_fn_t)(const void* pWin, const void* pDatas, int pos); -typedef int (*__session_compare_fn_t)(const void* pWin, const void* pDatas, int pos); - int32_t streamFileStateInit(int64_t memSize, uint32_t keySize, uint32_t rowSize, uint32_t selectRowSize, GetTsFun fp, void* pFile, TSKEY delMark, const char* taskId, int64_t checkpointId, int8_t type, struct SStreamFileState** ppFileState); From 0c03409fd5e379d08385c35ecabefc15b89dddda Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Wed, 9 Oct 2024 10:46:12 +0800 Subject: [PATCH 102/695] fix ci issue --- source/libs/stream/src/streamUpdate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/stream/src/streamUpdate.c b/source/libs/stream/src/streamUpdate.c index 740c6f3d9db4..764045eed426 100644 --- a/source/libs/stream/src/streamUpdate.c +++ b/source/libs/stream/src/streamUpdate.c @@ -615,7 +615,7 @@ int32_t updateInfoDeserialize(void* buf, int32_t bufLen, SUpdateInfo* pInfo) { pInfo->pMap = taosHashInit(mapSize, hashFn, true, HASH_NO_LOCK); uint64_t uid = 0; void* pVal = NULL; - int32_t valSize = 0; + uint32_t valSize = 0; for (int32_t i = 0; i < mapSize; i++) { if (tDecodeU64(&decoder, &uid) < 0) return -1; if (tDecodeBinary(&decoder, (uint8_t**)&pVal, &valSize) < 0) return -1; From 3cac85f3ae32c3e0b133dded625ff8a39028cbeb Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Wed, 9 Oct 2024 10:58:11 +0800 Subject: [PATCH 103/695] fix ci issue --- include/libs/stream/tstreamFileState.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/libs/stream/tstreamFileState.h b/include/libs/stream/tstreamFileState.h index 8caa69d83ab7..64cb0456c9fb 100644 --- a/include/libs/stream/tstreamFileState.h +++ b/include/libs/stream/tstreamFileState.h @@ -16,8 +16,6 @@ #ifndef _STREAM_FILE_STATE_H_ #define _STREAM_FILE_STATE_H_ -#include "os.h" - #include "storageapi.h" #include "tarray.h" #include "tdef.h" From 58d8b9f84e28fb82644875455c029466b1e2e7ee Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Wed, 9 Oct 2024 11:32:20 +0800 Subject: [PATCH 104/695] fix ci issue --- source/libs/executor/src/scanoperator.c | 5 ++++- source/libs/executor/src/streamfilloperator.c | 8 ++++++-- source/libs/stream/src/tstreamFileState.c | 18 ++++++++++++++---- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 48a4d75edfd5..670956ab8010 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -3400,7 +3400,10 @@ static bool isStreamWindow(SStreamScanInfo* pInfo) { static int32_t copyGetResultBlock(SSDataBlock* dest, const SSDataBlock* src) { TSKEY start = src->info.window.skey; TSKEY end = src->info.window.ekey; - blockDataEnsureCapacity(dest, 1); + int32_t code = blockDataEnsureCapacity(dest, 1); + if (code != TSDB_CODE_SUCCESS) { + return code; + } return appendDataToSpecialBlock(dest, &start, &end, NULL, NULL, NULL); } diff --git a/source/libs/executor/src/streamfilloperator.c b/source/libs/executor/src/streamfilloperator.c index 6e7da8a8dbe1..8df8170f3bbb 100644 --- a/source/libs/executor/src/streamfilloperator.c +++ b/source/libs/executor/src/streamfilloperator.c @@ -1263,9 +1263,13 @@ SStreamFillInfo* initStreamFillInfo(SStreamFillSupporter* pFillSup, SSDataBlock* if (pColData == NULL) { SPoint dummy = {0}; dummy.val = taosMemoryCalloc(1, 1); - taosArrayPush(pFillInfo->pLinearInfo->pEndPoints, &dummy); + void* tmpRes = taosArrayPush(pFillInfo->pLinearInfo->pEndPoints, &dummy); + QUERY_CHECK_NULL(tmpRes, code, lino, _end, terrno); + dummy.val = taosMemoryCalloc(1, 1); - taosArrayPush(pFillInfo->pLinearInfo->pNextEndPoints, &dummy); + tmpRes = taosArrayPush(pFillInfo->pLinearInfo->pNextEndPoints, &dummy); + QUERY_CHECK_NULL(tmpRes, code, lino, _end, terrno); + continue; } SPoint value = {0}; diff --git a/source/libs/stream/src/tstreamFileState.c b/source/libs/stream/src/tstreamFileState.c index 5712d9166db8..a95b166fb120 100644 --- a/source/libs/stream/src/tstreamFileState.c +++ b/source/libs/stream/src/tstreamFileState.c @@ -458,7 +458,8 @@ int32_t flushRowBuff(SStreamFileState* pFileState) { } if (pFileState->searchBuff) { - clearFlushedRowBuff(pFileState, pFlushList, pFileState->curRowCount, true); + code = clearFlushedRowBuff(pFileState, pFlushList, pFileState->curRowCount, true); + QUERY_CHECK_CODE(code, lino, _end); } flushSnapshot(pFileState, pFlushList, false); @@ -712,11 +713,13 @@ int32_t getRowBuffByPos(SStreamFileState* pFileState, SRowBuffPos* pPos, void** goto _end; } - recoverStateRowBuff(pFileState, pPos); + code = recoverStateRowBuff(pFileState, pPos); + QUERY_CHECK_CODE(code, lino, _end); (*pVal) = pPos->pRowBuff; if (!pPos->needFree) { code = tdListPrepend(pFileState->usedBuffs, &pPos); + QUERY_CHECK_CODE(code, lino, _end); } _end: @@ -1023,11 +1026,13 @@ int32_t getFunctionRowBuff(SStreamFileState* pFileState, void* pKey, int32_t key int32_t recoverFillSnapshot(SStreamFileState* pFileState, int64_t ckId) { int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; if (pFileState->maxTs != INT64_MIN) { int64_t mark = (INT64_MIN + pFileState->deleteMark >= pFileState->maxTs) ? INT64_MIN : pFileState->maxTs - pFileState->deleteMark; - deleteExpiredCheckPoint(pFileState, mark); + code = deleteExpiredCheckPoint(pFileState, mark); + QUERY_CHECK_CODE(code, lino, _end); } SStreamStateCur* pCur = streamStateFillSeekToLast_rocksdb(pFileState->pFileStore); @@ -1065,6 +1070,10 @@ int32_t recoverFillSnapshot(SStreamFileState* pFileState, int64_t ckId) { } streamStateFreeCur(pCur); +_end: + if (code != TSDB_CODE_SUCCESS) { + qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } return code; } @@ -1082,7 +1091,8 @@ int32_t getRowBuff(SStreamFileState* pFileState, void* pKey, int32_t keyLen, voi (*ppPos)->beFlushed = false; (*pWinCode) = TSDB_CODE_SUCCESS; if ((*ppPos)->pRowBuff == NULL) { - recoverStateRowBuff(pFileState, *ppPos); + code = recoverStateRowBuff(pFileState, *ppPos); + QUERY_CHECK_CODE(code, lino, _end); } goto _end; } From ff5e7556c4c6399d56dd288d0e20b0d429a6c901 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Wed, 9 Oct 2024 14:29:56 +0800 Subject: [PATCH 105/695] enh: add merge join ut --- source/libs/executor/test/queryPlanTests.cpp | 293 ++++++++++++++----- 1 file changed, 216 insertions(+), 77 deletions(-) diff --git a/source/libs/executor/test/queryPlanTests.cpp b/source/libs/executor/test/queryPlanTests.cpp index 3422611ea193..9cfdf931a4eb 100755 --- a/source/libs/executor/test/queryPlanTests.cpp +++ b/source/libs/executor/test/queryPlanTests.cpp @@ -113,10 +113,11 @@ int32_t QPT_PHYSIC_NODE_LIST[] = { #define QPT_RAND_ORDER_V (QPT_RAND_BOOL_V ? ORDER_ASC : ORDER_DESC) #define QPT_RAND_INT_V (taosRand() * (QPT_RAND_BOOL_V ? 1 : -1)) #define QPT_LOW_PROB() ((taosRand() % 11) == 0) -#define QPT_MID_PROB() ((taosRand() % 11) <= 4) +#define QPT_MID_PROB() ((taosRand() % 11) <= 1) #define QPT_HIGH_PROB() ((taosRand() % 11) <= 7) #define QPT_CORRECT_HIGH_PROB() (qptCtx.param.correctExpected || QPT_HIGH_PROB()) +#define QPT_NCORRECT_LOW_PROB() (!qptCtx.param.correctExpected && QPT_LOW_PROB()) typedef struct { ENodeType type; @@ -125,6 +126,8 @@ typedef struct { typedef struct { bool singlePhysiNode; + uint64_t queryId; + uint64_t taskId; int32_t subplanMaxLevel; int32_t subplanType[QPT_MAX_SUBPLAN_LEVEL]; int32_t physiNodeParamNum; @@ -139,6 +142,7 @@ typedef struct { typedef struct { int32_t vnodeNum; + int32_t vgId; } SQPTVnodeParam; typedef struct { @@ -177,7 +181,10 @@ typedef struct { typedef struct { SPhysiNode* pCurr; - SPhysiNode* pChild; + int32_t childrenNum; + SPhysiNode* pChild; // current child + SPhysiNode* pLeftChild; + SPhysiNode* pRightChild; EOrder currTsOrder; } SQPTBuildPlanCtx; @@ -296,7 +303,7 @@ void qptPrintStatInfo(char* caseName) { bool qptGetDynamicOp() { - if (!qptCtx.param.correctExpected) { + if (QPT_NCORRECT_LOW_PROB()) { return QPT_RAND_BOOL_V; } @@ -308,25 +315,28 @@ bool qptGetDynamicOp() { } EOrder qptGetCurrTsOrder() { - return qptCtx.param.correctExpected ? qptCtx.buildCtx.currTsOrder : QPT_RAND_ORDER_V; + return QPT_CORRECT_HIGH_PROB() ? qptCtx.buildCtx.currTsOrder : QPT_RAND_ORDER_V; } -void qptGetRandValue(uint8_t* pType, int32_t* pLen, void** ppVal) { - int32_t typeMax = TSDB_DATA_TYPE_MAX; - if (!qptCtx.param.correctExpected) { - typeMax++; +void qptGetRandValue(int16_t* pType, int32_t* pLen, void** ppVal) { + if (*pType < 0 || QPT_NCORRECT_LOW_PROB()) { + int32_t typeMax = TSDB_DATA_TYPE_MAX; + if (QPT_NCORRECT_LOW_PROB()) { + typeMax++; + } + + *pType = taosRand() % typeMax; } - *pType = taosRand() % typeMax; switch (*pType) { case TSDB_DATA_TYPE_NULL: - *pLen = qptCtx.param.correctExpected ? 0 : taosRand(); + *pLen = QPT_CORRECT_HIGH_PROB() ? 0 : taosRand(); if (ppVal) { *ppVal = NULL; } break; case TSDB_DATA_TYPE_BOOL: - *pLen = qptCtx.param.correctExpected ? tDataTypes[*pType].bytes : taosRand(); + *pLen = QPT_CORRECT_HIGH_PROB() ? tDataTypes[*pType].bytes : taosRand(); if (ppVal) { *ppVal = taosMemoryMalloc(tDataTypes[*pType].bytes); assert(*ppVal); @@ -334,7 +344,7 @@ void qptGetRandValue(uint8_t* pType, int32_t* pLen, void** ppVal) { } break; case TSDB_DATA_TYPE_TINYINT: - *pLen = qptCtx.param.correctExpected ? tDataTypes[*pType].bytes : taosRand(); + *pLen = QPT_CORRECT_HIGH_PROB() ? tDataTypes[*pType].bytes : taosRand(); if (ppVal) { *ppVal = taosMemoryMalloc(tDataTypes[*pType].bytes); assert(*ppVal); @@ -342,7 +352,7 @@ void qptGetRandValue(uint8_t* pType, int32_t* pLen, void** ppVal) { } break; case TSDB_DATA_TYPE_SMALLINT: - *pLen = qptCtx.param.correctExpected ? tDataTypes[*pType].bytes : taosRand(); + *pLen = QPT_CORRECT_HIGH_PROB() ? tDataTypes[*pType].bytes : taosRand(); if (ppVal) { *ppVal = taosMemoryMalloc(tDataTypes[*pType].bytes); assert(*ppVal); @@ -350,7 +360,7 @@ void qptGetRandValue(uint8_t* pType, int32_t* pLen, void** ppVal) { } break; case TSDB_DATA_TYPE_INT: - *pLen = qptCtx.param.correctExpected ? tDataTypes[*pType].bytes : taosRand(); + *pLen = QPT_CORRECT_HIGH_PROB() ? tDataTypes[*pType].bytes : taosRand(); if (ppVal) { *ppVal = taosMemoryMalloc(tDataTypes[*pType].bytes); assert(*ppVal); @@ -359,7 +369,7 @@ void qptGetRandValue(uint8_t* pType, int32_t* pLen, void** ppVal) { break; case TSDB_DATA_TYPE_BIGINT: case TSDB_DATA_TYPE_TIMESTAMP: - *pLen = qptCtx.param.correctExpected ? tDataTypes[*pType].bytes : taosRand(); + *pLen = QPT_CORRECT_HIGH_PROB() ? tDataTypes[*pType].bytes : taosRand(); if (ppVal) { *ppVal = taosMemoryMalloc(tDataTypes[*pType].bytes); assert(*ppVal); @@ -367,7 +377,7 @@ void qptGetRandValue(uint8_t* pType, int32_t* pLen, void** ppVal) { } break; case TSDB_DATA_TYPE_FLOAT: - *pLen = qptCtx.param.correctExpected ? tDataTypes[*pType].bytes : taosRand(); + *pLen = QPT_CORRECT_HIGH_PROB() ? tDataTypes[*pType].bytes : taosRand(); if (ppVal) { *ppVal = taosMemoryMalloc(tDataTypes[*pType].bytes); assert(*ppVal); @@ -375,7 +385,7 @@ void qptGetRandValue(uint8_t* pType, int32_t* pLen, void** ppVal) { } break; case TSDB_DATA_TYPE_DOUBLE: - *pLen = qptCtx.param.correctExpected ? tDataTypes[*pType].bytes : taosRand(); + *pLen = QPT_CORRECT_HIGH_PROB() ? tDataTypes[*pType].bytes : taosRand(); if (ppVal) { *ppVal = taosMemoryMalloc(tDataTypes[*pType].bytes); assert(*ppVal); @@ -413,7 +423,7 @@ void qptGetRandValue(uint8_t* pType, int32_t* pLen, void** ppVal) { break; } case TSDB_DATA_TYPE_UTINYINT: - *pLen = qptCtx.param.correctExpected ? tDataTypes[*pType].bytes : taosRand(); + *pLen = QPT_CORRECT_HIGH_PROB() ? tDataTypes[*pType].bytes : taosRand(); if (ppVal) { *ppVal = taosMemoryMalloc(tDataTypes[*pType].bytes); assert(*ppVal); @@ -421,7 +431,7 @@ void qptGetRandValue(uint8_t* pType, int32_t* pLen, void** ppVal) { } break; case TSDB_DATA_TYPE_USMALLINT: - *pLen = qptCtx.param.correctExpected ? tDataTypes[*pType].bytes : taosRand(); + *pLen = QPT_CORRECT_HIGH_PROB() ? tDataTypes[*pType].bytes : taosRand(); if (ppVal) { *ppVal = taosMemoryMalloc(tDataTypes[*pType].bytes); assert(*ppVal); @@ -429,7 +439,7 @@ void qptGetRandValue(uint8_t* pType, int32_t* pLen, void** ppVal) { } break; case TSDB_DATA_TYPE_UINT: - *pLen = qptCtx.param.correctExpected ? tDataTypes[*pType].bytes : taosRand(); + *pLen = QPT_CORRECT_HIGH_PROB() ? tDataTypes[*pType].bytes : taosRand(); if (ppVal) { *ppVal = taosMemoryMalloc(tDataTypes[*pType].bytes); assert(*ppVal); @@ -437,7 +447,7 @@ void qptGetRandValue(uint8_t* pType, int32_t* pLen, void** ppVal) { } break; case TSDB_DATA_TYPE_UBIGINT: - *pLen = qptCtx.param.correctExpected ? tDataTypes[*pType].bytes : taosRand(); + *pLen = QPT_CORRECT_HIGH_PROB() ? tDataTypes[*pType].bytes : taosRand(); if (ppVal) { *ppVal = taosMemoryMalloc(tDataTypes[*pType].bytes); assert(*ppVal); @@ -503,6 +513,13 @@ void qptGetRandRealTableType(int8_t* tableType) { } } +int32_t qptGetInputSlotId(SDataBlockDescNode* pInput) { + if (pInput && pInput->pSlots && pInput->pSlots->length > 0 && QPT_CORRECT_HIGH_PROB()) { + return taosRand() % pInput->pSlots->length; + } + + return taosRand(); +} void qptNodesCalloc(int32_t num, int32_t size, void** pOut) { @@ -550,11 +567,11 @@ int32_t qptNodesListMakeStrictAppend(SNodeList** pList, SNode* pNode) { SNode* qptMakeLimitNode() { - if (QPT_RAND_BOOL_V) { - return NULL; + SNode* pNode = NULL; + if (QPT_NCORRECT_LOW_PROB()) { + return qptMakeRandNode(&pNode); } - SNode* pNode = NULL; assert(0 == nodesMakeNode(QUERY_NODE_LIMIT, &pNode)); assert(pNode); @@ -577,6 +594,26 @@ SNode* qptMakeLimitNode() { return pNode; } + +SNode* qptMakeWindowOffsetNode(SNode** ppNode) { + if (QPT_RAND_BOOL_V) { + return qptMakeRandNode(ppNode); + } + + SNode* pNode = NULL; + SWindowOffsetNode* pWinOffset = NULL; + + assert(0 == nodesMakeNode(QUERY_NODE_WINDOW_OFFSET, &pNode)); + assert(pNode); + + SWindowOffsetNode* pWinOffset = (SWindowOffsetNode*)pNode; + qptMakeValueNode(TSDB_DATA_TYPE_BIGINT, &pWinOffset->pStartOffset); + qptMakeValueNode(TSDB_DATA_TYPE_BIGINT, &pWinOffset->pEndOffset); + + return pNode; +} + + SNode* qptMakeColumnNodeFromTable(int32_t colIdx, EColumnType colType, SScanPhysiNode* pScanPhysiNode) { if (colIdx < 0) { return NULL; @@ -653,6 +690,10 @@ SNode* qptMakeColumnNodeFromTable(int32_t colIdx, EColumnType colType, SScanPhys void qptMakeWhenThenNode(SNode** ppNode) { + if (QPT_NCORRECT_LOW_PROB) { + return qptMakeRandNode(ppNode); + } + assert(0 == nodesMakeNode(QUERY_NODE_WHEN_THEN, ppNode)); assert(*ppNode); SWhenThenNode* pWhenThen = (SWhenThenNode*)*ppNode; @@ -664,6 +705,10 @@ void qptMakeWhenThenNode(SNode** ppNode) { void qptMakeCaseWhenNode(SNode** ppNode) { + if (QPT_NCORRECT_LOW_PROB) { + return qptMakeRandNode(ppNode); + } + assert(0 == nodesMakeNode(QUERY_NODE_CASE_WHEN, ppNode)); assert(*ppNode); @@ -689,6 +734,10 @@ void qptMakeCaseWhenNode(SNode** ppNode) { void qptMakeOperatorNode(SNode** ppNode) { + if (QPT_NCORRECT_LOW_PROB) { + return qptMakeRandNode(ppNode); + } + EOperatorType opType = OPERATOR_ARRAY[taosRand() % (sizeof(OPERATOR_ARRAY)/sizeof(OPERATOR_ARRAY[0]))]; assert(0 == nodesMakeNode(QUERY_NODE_OPERATOR, ppNode)); @@ -697,7 +746,7 @@ void qptMakeOperatorNode(SNode** ppNode) { qptCtx.makeCtx.nodeLevel++; - switch (opType) { + switch (pOp->opType) { case OP_TYPE_ADD: case OP_TYPE_SUB: case OP_TYPE_MULTI: @@ -765,6 +814,10 @@ void qptMakeOperatorNode(SNode** ppNode) { } void qptMakeColumnNode(SNode** ppNode) { + if (QPT_NCORRECT_LOW_PROB) { + return qptMakeRandNode(ppNode); + } + SColumnNode* pCol = NULL; nodesMakeNode(QUERY_NODE_COLUMN, (SNode**)&pCol); SSlotDescNode* pSlot = NULL; @@ -880,11 +933,14 @@ void qptNodesSetValueNodeValue(SValueNode* pNode, void* value) { } -void qptMakeValueNode(SNode** ppNode) { +void qptMakeValueNode(int16_t valType, SNode** ppNode) { + if (QPT_NCORRECT_LOW_PROB) { + return qptMakeRandNode(ppNode); + } + SValueNode* pVal = NULL; nodesMakeNode(QUERY_NODE_VALUE, (SNode**)&pVal); - uint8_t valType; int32_t valBytes; void* pValue = NULL; qptGetRandValue(&valType, &valBytes, &pValue); @@ -898,6 +954,10 @@ void qptMakeValueNode(SNode** ppNode) { } void qptMakeFunctionNode(SNode** ppNode) { + if (QPT_NCORRECT_LOW_PROB) { + return qptMakeRandNode(ppNode); + } + SFunctionNode* pFunc = NULL; nodesMakeNode(QUERY_NODE_FUNCTION, (SNode**)&pFunc); @@ -937,6 +997,10 @@ void qptMakeFunctionNode(SNode** ppNode) { void qptMakeLogicCondNode(SNode** ppNode) { + if (QPT_NCORRECT_LOW_PROB) { + return qptMakeRandNode(ppNode); + } + SLogicConditionNode* pLogic = NULL; nodesMakeNode(QUERY_NODE_LOGIC_CONDITION, (SNode**)&pLogic); @@ -959,6 +1023,10 @@ void qptMakeLogicCondNode(SNode** ppNode) { } void qptMakeNodeListNode(SNode** ppNode) { + if (QPT_NCORRECT_LOW_PROB) { + return qptMakeRandNode(ppNode); + } + SNodeListNode* pList = NULL; nodesMakeNode(QUERY_NODE_NODE_LIST, (SNode**)&pList); @@ -975,6 +1043,10 @@ void qptMakeNodeListNode(SNode** ppNode) { } void qptMakeTempTableNode(SNode** ppNode) { + if (QPT_NCORRECT_LOW_PROB) { + return qptMakeRandNode(ppNode); + } + STempTableNode* pTemp = NULL; assert(0 == nodesMakeNode(QUERY_NODE_TEMP_TABLE, (SNode**)&pTemp)); @@ -986,6 +1058,10 @@ void qptMakeTempTableNode(SNode** ppNode) { } void qptMakeJoinTableNode(SNode** ppNode) { + if (QPT_NCORRECT_LOW_PROB) { + return qptMakeRandNode(ppNode); + } + SJoinTableNode* pJoin = NULL; assert(0 == nodesMakeNode(QUERY_NODE_JOIN_TABLE, (SNode**)&pJoin)); @@ -997,6 +1073,10 @@ void qptMakeJoinTableNode(SNode** ppNode) { } void qptMakeRealTableNode(SNode** ppNode) { + if (QPT_NCORRECT_LOW_PROB) { + return qptMakeRandNode(ppNode); + } + SRealTableNode* pReal = NULL; assert(0 == nodesMakeNode(QUERY_NODE_REAL_TABLE, (SNode**)&pReal)); @@ -1010,6 +1090,10 @@ void qptMakeRealTableNode(SNode** ppNode) { void qptMakeNonRealTableNode(SNode** ppNode) { + if (QPT_NCORRECT_LOW_PROB) { + return qptMakeRandNode(ppNode); + } + if (QPT_CORRECT_HIGH_PROB()) { if (QPT_RAND_BOOL_V) { qptMakeTempTableNode(ppNode); @@ -1021,17 +1105,19 @@ void qptMakeNonRealTableNode(SNode** ppNode) { } } -void qptMakeRandNode(SNode** ppNode) { +SNode* qptMakeRandNode(SNode** ppNode) { nodesMakeNode((ENodeType)taosRand(), ppNode); + return *ppNode; } SNode* qptMakeExprNode(SNode** ppNode) { - if (!qptCtx.param.correctExpected && QPT_LOW_PROB()) { - if (ppNode) { - *ppNode = NULL; - } + SNode* pNode = NULL; + if (NULL == ppNode) { + ppNode = &pNode; + } - return NULL; + if (QPT_NCORRECT_LOW_PROB()) { + return qptMakeRandNode(ppNode); } int32_t nodeTypeMaxValue = 9; @@ -1039,22 +1125,12 @@ SNode* qptMakeExprNode(SNode** ppNode) { nodeTypeMaxValue = 2; } - SNode* pNode = NULL; - if (NULL == ppNode) { - ppNode = &pNode; - } - - if (!qptCtx.param.correctExpected && QPT_LOW_PROB()) { - qptMakeRandNode(ppNode); - return *ppNode; - } - switch (taosRand() % nodeTypeMaxValue) { case 0: qptMakeColumnNode(ppNode); break; case 1: - qptMakeValueNode(ppNode); + qptMakeValueNode(-1, ppNode); break; case 2: qptMakeFunctionNode(ppNode); @@ -1085,6 +1161,7 @@ SNode* qptMakeExprNode(SNode** ppNode) { return *ppNode; } + void qptResetMakeNodeCtx(SDataBlockDescNode* pInput, bool onlyTag) { SQPTMakeNodeCtx* pCtx = &qptCtx.makeCtx; @@ -1240,7 +1317,7 @@ void qptAddDataBlockSlots(SNodeList* pList, SDataBlockDescNode* pDataBlockDesc) } SNode* pExpr = QUERY_NODE_ORDER_BY_EXPR == nodeType(pNode) ? ((SOrderByExprNode*)pNode)->pExpr : pNode; - if (qptCtx.param.correctExpected || QPT_RAND_BOOL_V) { + if (QPT_CORRECT_HIGH_PROB()) { SNode* pDesc = qptCtx.param.correctExpected ? qptMakeSlotDescNode(NULL, pExpr, nextSlotId, output, QPT_RAND_BOOL_V) : qptMakeExprNode(NULL); assert(0 == qptNodesListMakeStrictAppend(&pDataBlockDesc->pSlots, pDesc)); pDataBlockDesc->totalRowSize += qptCtx.param.correctExpected ? ((SExprNode*)pExpr)->resType.bytes : taosRand(); @@ -1252,7 +1329,7 @@ void qptAddDataBlockSlots(SNodeList* pList, SDataBlockDescNode* pDataBlockDesc) slotId = nextSlotId; ++nextSlotId; - if (qptCtx.param.correctExpected || QPT_RAND_BOOL_V) { + if (QPT_CORRECT_HIGH_PROB()) { SNode* pTarget = NULL; qptMakeTargetNode(pNode, pDataBlockDesc->dataBlockId, slotId, &pTarget); REPLACE_NODE(pTarget); @@ -1336,27 +1413,36 @@ SNode* qptCreateProjectPhysiNode(int32_t nodeType) { SNode* qptCreateSortMergeJoinPhysiNode(int32_t nodeType) { SPhysiNode* pPhysiNode = qptCreatePhysiNode(nodeType); - assert(pPhysiNode); - SSortMergeJoinPhysiNode* p = (SSortMergeJoinPhysiNode*)pPhysiNode; + SSortMergeJoinPhysiNode* pJoin = (SSortMergeJoinPhysiNode*)pPhysiNode; + + pJoin->joinType = taosRand() % JOIN_TYPE_MAX_VALUE + (QPT_CORRECT_HIGH_PROB() ? 0 : 1); + pJoin->subType = taosRand() % JOIN_STYPE_MAX_VALUE + (QPT_CORRECT_HIGH_PROB() ? 0 : 1); + qptMakeWindowOffsetNode(&pJoin->pWindowOffset); + qptMakeLimitNode(&pJoin->pJLimit); + pJoin->asofOpType = OPERATOR_ARRAY[taosRand() % (sizeof(OPERATOR_ARRAY)/sizeof(OPERATOR_ARRAY[0]))] + (QPT_CORRECT_HIGH_PROB() ? 0 : 1); + + qptMakeExprNode(&pJoin->leftPrimExpr); + qptMakeExprNode(&pJoin->rightPrimExpr); + pJoin->leftPrimSlotId = qptGetInputSlotId(qptCtx->buildCtx.pChild ? qptCtx->buildCtx.pChild->pOutputDataBlockDesc : NULL); + pJoin->rightPrimSlotId = qptGetInputSlotId(qptCtx->buildCtx.pChild ? qptCtx->buildCtx.pChild->pOutputDataBlockDesc : NULL); + qptMakeColumnList(&pJoin->pEqLeft); + qptMakeColumnList(&pJoin->pEqRight); + qptMakeExprNode(&pJoin->pPrimKeyCond); + qptMakeExprNode(&pJoin->pColEqCond); + qptMakeExprNode(&pJoin->pColOnCond); + qptMakeExprNode(&pJoin->pFullOnCond); + qptMakeTargetNode(SNode * pNode, int16_t dataBlockId, int16_t slotId, SNode * * pOutput) + + pJoin->seqWinGroup = QPT_RAND_BOOL_V; + pJoin->grpJoin = QPT_RAND_BOOL_V; + -/* - p->joinType = param->joinType; - p->subType = param->subType; - p->asofOpType = param->asofOp; - p->grpJoin = param->grpJoin; - if (p->subType == JOIN_STYPE_WIN || param->jLimit > 1 || taosRand() % 2) { - SLimitNode* limitNode = NULL; - code = nodesMakeNode(QUERY_NODE_LIMIT, (SNode**)&limitNode); - assert(limitNode); - limitNode->limit = param->jLimit; - p->pJLimit = (SNode*)limitNode; - } - p->leftPrimSlotId = JT_PRIM_TS_SLOT_ID; - p->rightPrimSlotId = JT_PRIM_TS_SLOT_ID; - p->node.inputTsOrder = param->asc ? ORDER_ASC : ORDER_DESC; - if (JOIN_STYPE_WIN == p->subType) { + pJoin->leftPrimSlotId = JT_PRIM_TS_SLOT_ID; + pJoin->rightPrimSlotId = JT_PRIM_TS_SLOT_ID; + pJoin->node.inputTsOrder = param->asc ? ORDER_ASC : ORDER_DESC; + if (JOIN_STYPE_WIN == pJoin->subType) { SWindowOffsetNode* pOffset = NULL; code = nodesMakeNode(QUERY_NODE_WINDOW_OFFSET, (SNode**)&pOffset); assert(pOffset); @@ -1377,7 +1463,7 @@ SNode* qptCreateSortMergeJoinPhysiNode(int32_t nodeType) { } pOffset->pStartOffset = (SNode*)pStart; pOffset->pEndOffset = (SNode*)pEnd; - p->pWindowOffset = (SNode*)pOffset; + pJoin->pWindowOffset = (SNode*)pOffset; jtCtx.winStartOffset = pStart->datum.i; jtCtx.winEndOffset = pEnd->datum.i; @@ -1393,15 +1479,14 @@ SNode* qptCreateSortMergeJoinPhysiNode(int32_t nodeType) { jtCtx.rightColOnly = (JOIN_TYPE_RIGHT == param->joinType && JOIN_STYPE_SEMI == param->subType); jtCtx.inGrpId = 1; - createColCond(p, param->cond); - createFilterStart(p, param->filter); - createTargetSlotList(p); - createColEqCondEnd(p); - createColOnCondEnd(p); - createFilterEnd(p, param->filter); + createColCond(pJoin, param->cond); + createFilterStart(pJoin, param->filter); + createTargetSlotList(pJoin); + createColEqCondEnd(pJoin); + createColOnCondEnd(pJoin); + createFilterEnd(pJoin, param->filter); updateColRowInfo(); - createBlockDescNode(&p->node.pOutputDataBlockDesc); -*/ + createBlockDescNode(&pJoin->node.pOutputDataBlockDesc); return (SNode*)pPhysiNode; } @@ -1478,6 +1563,8 @@ void qptRerunBlockedHere() { } void qptResetForReRun() { + qptCtx.param.plan.taskId = 1; + qptCtx.param.vnode.vgId = 1; for (int32_t i = 0; i < qptCtx.param.tbl.colNum; ++i) { qptCtx.param.tbl.pCol[i].inUse = 0; } @@ -1526,23 +1613,52 @@ void qptHandleTestEnd() { } -void qptRunPlanTest(char* caseName) { +void qptRunSingleOpTest(char* caseName) { SNode* pNode = NULL; SReadHandle readHandle = {0}; SOperatorInfo* pOperator = NULL; + SExecTaskInfo* pTaskInfo = NULL; + SStorageAPI storageAPI = {0}; if (qptCtx.loopIdx > 0) { qptResetForReRun(); } - if (qptCtx.param.plan.singlePhysiNode) { - pNode = (SNode*)qptCreatePhysicalPlanNode(qptCtx.param.plan.subplanType[0]); + pNode = (SNode*)qptCreatePhysicalPlanNode(qptCtx.param.plan.subplanType[0]); + + qptPrintBeginInfo(caseName); + + doCreateTask(qptCtx.param.plan.queryId, qptCtx.param.plan.taskId++, qptCtx.param.vnode.vgId, OPTR_EXEC_MODEL_BATCH, &storageAPI, &pTaskInfo); + + qptCtx.startTsUs = taosGetTimestampUs(); + //qptCtx.result.code = createTagScanOperatorInfo(&readHandle, (STagScanPhysiNode*)pNode, NULL, NULL, NULL, pTaskInfo, &pOperator); + //qptCtx.result.code = createProjectOperatorInfo(NULL, (SProjectPhysiNode*)pNode, pTaskInfo, &pOperator); + + doDestroyTask(pTaskInfo); + destroyOperator(pOperator); + nodesDestroyNode((SNode*)pNode); + + qptPrintEndInfo(caseName); + + qptHandleTestEnd(); +} + +void qptRunSubplanTest(char* caseName) { + SNode* pNode = NULL; + SReadHandle readHandle = {0}; + SOperatorInfo* pOperator = NULL; + + if (qptCtx.loopIdx > 0) { + qptResetForReRun(); } + + //pNode = (SNode*)qptCreatePhysicalPlanNode(qptCtx.param.plan.subplanType[0]); qptPrintBeginInfo(caseName); qptCtx.startTsUs = taosGetTimestampUs(); //qptCtx.result.code = createTagScanOperatorInfo(&readHandle, (STagScanPhysiNode*)pNode, NULL, NULL, NULL, NULL, &pOperator); + //qptCtx.result.code = createProjectOperatorInfo(NULL, (SProjectPhysiNode*)pNode, NULL, &pOperator); destroyOperator(pOperator); nodesDestroyNode((SNode*)pNode); @@ -1553,6 +1669,13 @@ void qptRunPlanTest(char* caseName) { } +void qptRunPlanTest(char* caseName) { + if (qptCtx.param.plan.singlePhysiNode) { + qptRunSingleOpTest(caseName); + } else { + qptRunSubplanTest(caseName); + } +} SQPTNodeParam* qptInitNodeParam(int32_t nodeType) { return NULL; @@ -1664,7 +1787,7 @@ void qptInitTestCtx(bool correctExpected, bool singleNode, int32_t nodeType, int } // namespace #if 1 -#if 1 +#if 0 TEST(randSingleNodeTest, tagScan) { char* caseName = "randSingleNodeTest:tagScan"; @@ -1677,6 +1800,22 @@ TEST(randSingleNodeTest, tagScan) { qptPrintStatInfo(caseName); } #endif +#if 1 +TEST(randSingleNodeTest, projection) { + char* caseName = "randSingleNodeTest:projection"; + + qptInitTestCtx(false, true, QUERY_NODE_PHYSICAL_PLAN_PROJECT, 0, NULL); + + for (qptCtx.loopIdx = 0; qptCtx.loopIdx < QPT_MAX_LOOP; ++qptCtx.loopIdx) { + qptRunPlanTest(caseName); + } + + qptPrintStatInfo(caseName); +} +#endif + + + #if 0 TEST(correctSingleNodeTest, tagScan) { From 0bcaf6f4e5324553b7beee173824a2c8ece4de03 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Wed, 9 Oct 2024 15:30:28 +0800 Subject: [PATCH 106/695] enh:[TS-5441] change poll flag to consumer for multi consumers --- source/client/src/clientTmq.c | 16 +++++++++------- source/dnode/mnode/impl/src/mndConsumer.c | 1 + source/dnode/vnode/src/tq/tqRead.c | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/source/client/src/clientTmq.c b/source/client/src/clientTmq.c index 975d14f3ee98..4cbb80818720 100644 --- a/source/client/src/clientTmq.c +++ b/source/client/src/clientTmq.c @@ -134,6 +134,7 @@ struct tmq_t { // poll info int64_t pollCnt; int64_t totalRows; + int8_t pollFlag; // timer tmr_h hbLiveTimer; @@ -287,7 +288,6 @@ typedef struct { static TdThreadOnce tmqInit = PTHREAD_ONCE_INIT; // initialize only once volatile int32_t tmqInitRes = 0; // initialize rsp code static SMqMgmt tmqMgmt = {0}; -static int8_t pollFlag = 0; tmq_conf_t* tmq_conf_new() { tmq_conf_t* conf = taosMemoryCalloc(1, sizeof(tmq_conf_t)); @@ -977,7 +977,8 @@ void tmqSendHbReq(void* param, void* tmrId) { SMqHbReq req = {0}; req.consumerId = tmq->consumerId; req.epoch = tmq->epoch; - req.pollFlag = atomic_load_8(&pollFlag); + req.pollFlag = atomic_load_8(&tmq->pollFlag); + tqDebugC("consumer:0x%" PRIx64 " send hb, pollFlag:%d", tmq->consumerId, req.pollFlag); req.topics = taosArrayInit(taosArrayGetSize(tmq->clientTopics), sizeof(TopicOffsetRows)); if (req.topics == NULL) { goto END; @@ -1057,13 +1058,13 @@ void tmqSendHbReq(void* param, void* tmrId) { if (code != 0) { tqErrorC("tmqSendHbReq asyncSendMsgToServer failed"); } - (void)atomic_val_compare_exchange_8(&pollFlag, 1, 0); + (void)atomic_val_compare_exchange_8(&tmq->pollFlag, 1, 0); END: tDestroySMqHbReq(&req); if (tmrId != NULL) { bool ret = taosTmrReset(tmqSendHbReq, tmq->heartBeatIntervalMs, param, tmqMgmt.timer, &tmq->hbLiveTimer); - tqDebugC("reset timer fo tmq hb:%d", ret); + tqDebugC("consumer:0x%" PRIx64 " reset timer for tmq hb:%d, pollFlag:%d", tmq->consumerId, ret, tmq->pollFlag); } int32_t ret = taosReleaseRef(tmqMgmt.rsetId, refId); if (ret != 0){ @@ -1422,7 +1423,7 @@ void tmqHandleAllDelayedTask(tmq_t* pTmq) { tqDebugC("consumer:0x%" PRIx64 " retrieve ep from mnode in 1s", pTmq->consumerId); bool ret = taosTmrReset(tmqAssignAskEpTask, DEFAULT_ASKEP_INTERVAL, (void*)(pTmq->refId), tmqMgmt.timer, &pTmq->epTimer); - tqDebugC("reset timer fo tmq ask ep:%d", ret); + tqDebugC("reset timer for tmq ask ep:%d", ret); } else if (*pTaskType == TMQ_DELAYED_TASK__COMMIT) { tmq_commit_cb* pCallbackFn = (pTmq->commitCb != NULL) ? pTmq->commitCb : defaultCommitCbFn; asyncCommitAllOffsets(pTmq, pCallbackFn, pTmq->commitCbUserParam); @@ -1430,7 +1431,7 @@ void tmqHandleAllDelayedTask(tmq_t* pTmq) { pTmq->autoCommitInterval / 1000.0); bool ret = taosTmrReset(tmqAssignDelayedCommitTask, pTmq->autoCommitInterval, (void*)(pTmq->refId), tmqMgmt.timer, &pTmq->commitTimer); - tqDebugC("reset timer fo commit:%d", ret); + tqDebugC("reset timer for commit:%d", ret); } else { tqErrorC("consumer:0x%" PRIx64 " invalid task type:%d", pTmq->consumerId, *pTaskType); } @@ -1640,6 +1641,7 @@ tmq_t* tmq_consumer_new(tmq_conf_t* conf, char* errstr, int32_t errstrLen) { pTmq->status = TMQ_CONSUMER_STATUS__INIT; pTmq->pollCnt = 0; pTmq->epoch = 0; + pTmq->pollFlag = 0; // set conf tstrncpy(pTmq->clientId, conf->clientId, TSDB_CLIENT_ID_LEN); @@ -2441,7 +2443,7 @@ TAOS_RES* tmq_consumer_poll(tmq_t* tmq, int64_t timeout) { return NULL; } - (void)atomic_val_compare_exchange_8(&pollFlag, 0, 1); + (void)atomic_val_compare_exchange_8(&tmq->pollFlag, 0, 1); while (1) { tmqHandleAllDelayedTask(tmq); diff --git a/source/dnode/mnode/impl/src/mndConsumer.c b/source/dnode/mnode/impl/src/mndConsumer.c index a96b8b22f536..a91d2379aec1 100644 --- a/source/dnode/mnode/impl/src/mndConsumer.c +++ b/source/dnode/mnode/impl/src/mndConsumer.c @@ -239,6 +239,7 @@ static int32_t mndProcessMqHbReq(SRpcMsg *pMsg) { MND_TMQ_RETURN_CHECK(mndAcquireConsumer(pMnode, consumerId, &pConsumer)); MND_TMQ_RETURN_CHECK(checkPrivilege(pMnode, pConsumer, &rsp, pMsg->info.conn.user)); atomic_store_32(&pConsumer->hbStatus, 0); + mDebug("consumer:0x%" PRIx64 " receive hb pollFlag:%d %d", consumerId, req.pollFlag, pConsumer->pollStatus); if (req.pollFlag == 1){ atomic_store_32(&pConsumer->pollStatus, 0); } diff --git a/source/dnode/vnode/src/tq/tqRead.c b/source/dnode/vnode/src/tq/tqRead.c index 6dc5453d50b6..7ca749b5a39c 100644 --- a/source/dnode/vnode/src/tq/tqRead.c +++ b/source/dnode/vnode/src/tq/tqRead.c @@ -953,7 +953,7 @@ int32_t tqProcessRowData(STqReader* pReader, SSubmitTbData* pSubmitTbData, SArra } int32_t tqRetrieveTaosxBlock(STqReader* pReader, SArray* blocks, SArray* schemas, SSubmitTbData** pSubmitTbDataRet) { - tqDebug("tq reader retrieve data block %p, %d", pReader->msg.msgStr, pReader->nextBlk); + tqTrace("tq reader retrieve data block %p, %d", pReader->msg.msgStr, pReader->nextBlk); SSDataBlock* block = NULL; SSubmitTbData* pSubmitTbData = taosArrayGet(pReader->submit.aSubmitTbData, pReader->nextBlk); From e6f11c180c1b13b02e28a1408c9dbddfe1a2fbd2 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Wed, 9 Oct 2024 16:03:09 +0800 Subject: [PATCH 107/695] fix ci issue --- source/libs/executor/inc/streamexecutorInt.h | 4 ++-- source/libs/parser/src/parTranslater.c | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/source/libs/executor/inc/streamexecutorInt.h b/source/libs/executor/inc/streamexecutorInt.h index 2f89e3350660..ac0645e8e80d 100644 --- a/source/libs/executor/inc/streamexecutorInt.h +++ b/source/libs/executor/inc/streamexecutorInt.h @@ -31,8 +31,8 @@ extern "C" { #define HAS_ROW_DATA(pRowData) (pRowData && pRowData->key != INT64_MIN) typedef struct SSliceRowData { - TSKEY key; - SResultCellData pRowVal[]; + TSKEY key; + struct SResultCellData pRowVal[]; } SSliceRowData; typedef struct SSlicePoint { diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 70079436c3d6..b2d0e20af9a4 100755 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -10245,8 +10245,8 @@ static void getSourceDatabase(SNode* pStmt, int32_t acctId, char* pDbFName) { (void)tNameGetFullDbName(&name, pDbFName); } -static void getStreamQueryFirstProjectAliasName(SHashObj* pUserAliasSet, char* aliasName, int32_t len, char* defaultName[], int32_t defaultNum) { - for (int32_t i = 0; i < defaultNum; i++) { +static void getStreamQueryFirstProjectAliasName(SHashObj* pUserAliasSet, char* aliasName, int32_t len, char* defaultName[]) { + for (int32_t i = 0; defaultName[i] != NULL; i++) { if (NULL == taosHashGet(pUserAliasSet, defaultName[i], strlen(defaultName[i]))) { snprintf(aliasName, len, "%s", defaultName[i]); return; @@ -10285,8 +10285,8 @@ static int32_t addIrowTsToCreateStreamQueryImpl(STranslateContext* pCxt, SSelect } strcpy(pFunc->functionName, "_irowts"); strcpy(pFunc->node.userAlias, "_irowts"); - char* defaultName[] = {"_irowts"}; - getStreamQueryFirstProjectAliasName(pUserAliasSet, pFunc->node.aliasName, sizeof(pFunc->node.aliasName), defaultName, sizeof(defaultName)); + char* defaultName[] = {"_irowts", NULL}; + getStreamQueryFirstProjectAliasName(pUserAliasSet, pFunc->node.aliasName, sizeof(pFunc->node.aliasName), defaultName); code = getFuncInfo(pCxt, pFunc); if (TSDB_CODE_SUCCESS == code) { code = nodesListPushFront(pSelect->pProjectionList, (SNode*)pFunc); @@ -10324,8 +10324,8 @@ static int32_t addWstartTsToCreateStreamQueryImpl(STranslateContext* pCxt, SSele } strcpy(pFunc->functionName, "_wstart"); strcpy(pFunc->node.userAlias, "_irowts"); - char* defaultName[] = {"_wstart", "ts"}; - getStreamQueryFirstProjectAliasName(pUserAliasSet, pFunc->node.aliasName, sizeof(pFunc->node.aliasName), defaultName, sizeof(defaultName)); + char* defaultName[] = {"_wstart", "ts", NULL}; + getStreamQueryFirstProjectAliasName(pUserAliasSet, pFunc->node.aliasName, sizeof(pFunc->node.aliasName), defaultName); code = getFuncInfo(pCxt, pFunc); if (TSDB_CODE_SUCCESS == code) { code = nodesListPushFront(pSelect->pProjectionList, (SNode*)pFunc); From 8709a12ce251fe32a5979fb6325999db459eb9ec Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Wed, 9 Oct 2024 17:00:09 +0800 Subject: [PATCH 108/695] fix ci issue --- source/libs/executor/inc/streamexecutorInt.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/executor/inc/streamexecutorInt.h b/source/libs/executor/inc/streamexecutorInt.h index ac0645e8e80d..fb83e8f5f75e 100644 --- a/source/libs/executor/inc/streamexecutorInt.h +++ b/source/libs/executor/inc/streamexecutorInt.h @@ -32,7 +32,7 @@ extern "C" { typedef struct SSliceRowData { TSKEY key; - struct SResultCellData pRowVal[]; + struct SResultCellData pRowVal[0]; } SSliceRowData; typedef struct SSlicePoint { From 69b8505a8d8b5f3ff4f8611c3bc1e99e6dcb3d8d Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Wed, 9 Oct 2024 17:49:24 +0800 Subject: [PATCH 109/695] fix ci issue --- source/libs/executor/inc/streamexecutorInt.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/executor/inc/streamexecutorInt.h b/source/libs/executor/inc/streamexecutorInt.h index fb83e8f5f75e..94873b98e93e 100644 --- a/source/libs/executor/inc/streamexecutorInt.h +++ b/source/libs/executor/inc/streamexecutorInt.h @@ -32,7 +32,7 @@ extern "C" { typedef struct SSliceRowData { TSKEY key; - struct SResultCellData pRowVal[0]; + struct SResultCellData pRowVal[1]; } SSliceRowData; typedef struct SSlicePoint { From e6bf8dcfde498c8e73f3ce723d23230366e88c78 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Wed, 9 Oct 2024 18:10:43 +0800 Subject: [PATCH 110/695] enh:[TS-5441] cost too long in tmq write meta data by cache meta and vg info --- include/common/tmsg.h | 23 +++++----- include/libs/executor/executor.h | 3 +- source/client/src/clientRawBlockWrite.c | 55 +++++++++++++++++++--- source/common/src/tmsg.c | 40 ++++++++++++++++ source/dnode/vnode/src/tq/tqScan.c | 61 ++++++++++++------------- source/dnode/vnode/src/tq/tqUtil.c | 10 +++- source/libs/executor/inc/querytask.h | 1 + source/libs/executor/src/executor.c | 6 +++ 8 files changed, 145 insertions(+), 54 deletions(-) diff --git a/include/common/tmsg.h b/include/common/tmsg.h index 1a10f02c965d..fb118de907f9 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -4049,18 +4049,17 @@ void tDeleteMqMetaRsp(SMqMetaRsp* pRsp); #define MQ_DATA_RSP_VERSION 100 typedef struct { - struct { - SMqRspHead head; - STqOffsetVal rspOffset; - STqOffsetVal reqOffset; - int32_t blockNum; - int8_t withTbName; - int8_t withSchema; - SArray* blockDataLen; - SArray* blockData; - SArray* blockTbName; - SArray* blockSchema; - }; + SMqRspHead head; + STqOffsetVal rspOffset; + STqOffsetVal reqOffset; + int32_t blockNum; + int8_t withTbName; + int8_t withSchema; + SArray* blockDataLen; + SArray* blockData; + SArray* blockTbName; + SArray* blockSchema; + SArray* blockSuid; union{ struct{ diff --git a/include/libs/executor/executor.h b/include/libs/executor/executor.h index ae26d5f2aeab..6b02d8f985b1 100644 --- a/include/libs/executor/executor.h +++ b/include/libs/executor/executor.h @@ -209,7 +209,8 @@ SMqBatchMetaRsp* qStreamExtractMetaMsg(qTaskInfo_t tinfo); const SSchemaWrapper* qExtractSchemaFromTask(qTaskInfo_t tinfo); -const char* qExtractTbnameFromTask(qTaskInfo_t tinfo); +const char* qExtractTbnameFromTask(qTaskInfo_t tinfo); +const int64_t qExtractSuidFromTask(qTaskInfo_t tinfo); void* qExtractReaderFromStreamScanner(void* scanner); diff --git a/source/client/src/clientRawBlockWrite.c b/source/client/src/clientRawBlockWrite.c index 064c3bdb2ecb..4b2e9e234dcd 100644 --- a/source/client/src/clientRawBlockWrite.c +++ b/source/client/src/clientRawBlockWrite.c @@ -1856,6 +1856,42 @@ static threadlocal SHashObj* pCreateTbHash = NULL; static threadlocal SHashObj* pNameHash = NULL; static threadlocal SHashObj* pMetaHash = NULL; +static bool needRefreshMeta(void* rawData, STableMeta* pTableMeta, SSchemaWrapper* pSW){ + char* p = (char*)rawData; + // | version | total length | total rows | blankFill | total columns | flag seg| block group id | column schema | each + // column length | + p += sizeof(int32_t); + p += sizeof(int32_t); + p += sizeof(int32_t); + p += sizeof(int32_t); + p += sizeof(int32_t); + p += sizeof(uint64_t); + int8_t* fields = p; + + if (pSW->nCols != pTableMeta->tableInfo.numOfColumns) { + return true; + } + for (int i = 0; i < pSW->nCols; i++) { + int j = 0; + for (; j < pTableMeta->tableInfo.numOfColumns; j++) { + SSchema* pColSchema = &pTableMeta->schema[j]; + char* fieldName = pSW->pSchema[i].name; + + if (strcmp(pColSchema->name, fieldName) == 0) { + if (*fields != pColSchema->type && *(int32_t*)(fields + sizeof(int8_t)) != pColSchema->bytes) { + return true; + } + break; + } + } + fields += sizeof(int8_t) + sizeof(int32_t); + + if (j == pTableMeta->tableInfo.numOfColumns) + return true; + } + return false; +} + static int32_t tmqWriteRawImpl(TAOS* taos, uint16_t type, void* data, int32_t dataLen) { if (taos == NULL || data == NULL) { SET_ERROR_MSG("taos:%p or data:%p is NULL", taos, data); @@ -1905,7 +1941,7 @@ static int32_t tmqWriteRawImpl(TAOS* taos, uint16_t type, void* data, int32_t da RAW_NULL_CHECK(pNameHash); } if (pMetaHash == NULL){ - pMetaHash = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_NO_LOCK); + pMetaHash = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), true, HASH_NO_LOCK); RAW_NULL_CHECK(pMetaHash); taosHashSetFreeFp(pMetaHash, taosMemoryFree); } @@ -1931,6 +1967,9 @@ static int32_t tmqWriteRawImpl(TAOS* taos, uint16_t type, void* data, int32_t da const char* tbName = (const char*)taosArrayGetP(rspObj.dataRsp.blockTbName, rspObj.resIter); RAW_NULL_CHECK(tbName); + int64_t* suid = taosArrayGet(rspObj.dataRsp.blockSuid, rspObj.resIter); + RAW_NULL_CHECK(suid); + uDebug(LOG_ID_TAG " write raw data block tbname:%s", LOG_ID_VALUE, tbName); SName pName = {TSDB_TABLE_NAME_T, pRequest->pTscObj->acctId, {0}, {0}}; (void)strcpy(pName.dbname, pRequest->pDb); @@ -1960,14 +1999,19 @@ static int32_t tmqWriteRawImpl(TAOS* taos, uint16_t type, void* data, int32_t da vgId = vg->vgId; } + SSchemaWrapper* pSW = (SSchemaWrapper*)taosArrayGetP(rspObj.dataRsp.blockSchema, rspObj.resIter); + RAW_NULL_CHECK(pSW); + void* rawData = getRawDataFromRes(pRetrieve); + RAW_NULL_CHECK(rawData); + STableMeta* pTableMeta = NULL; - STableMeta** pTableMetaTmp = (STableMeta**)taosHashGet(pMetaHash, tbName, strlen(tbName)); - if (pTableMetaTmp == NULL) { + STableMeta** pTableMetaTmp = (STableMeta**)taosHashGet(pMetaHash, suid, POINTER_BYTES); + if (pTableMetaTmp == NULL || needRefreshMeta(rawData, *pTableMetaTmp, pSW)) { if (pCreateReqDst) { // change stable name to get meta (void)strcpy(pName.tname, pCreateReqDst->ctb.stbName); } RAW_RETURN_CHECK(catalogGetTableMeta(pCatalog, &conn, &pName, &pTableMeta)); - code = taosHashPut(pMetaHash, tbName, strlen(tbName), &pTableMeta, POINTER_BYTES); + code = taosHashPut(pMetaHash, suid, POINTER_BYTES, &pTableMeta, POINTER_BYTES); if (code != 0){ taosMemoryFree(pTableMeta); goto end; @@ -1981,9 +2025,6 @@ static int32_t tmqWriteRawImpl(TAOS* taos, uint16_t type, void* data, int32_t da pTableMeta = *pTableMetaTmp; } - SSchemaWrapper* pSW = (SSchemaWrapper*)taosArrayGetP(rspObj.dataRsp.blockSchema, rspObj.resIter); - RAW_NULL_CHECK(pSW); - void* rawData = getRawDataFromRes(pRetrieve); char err[ERR_MSG_LEN] = {0}; code = rawBlockBindData(pQuery, pTableMeta, rawData, pCreateReqDst, pSW, pSW->nCols, true, err, ERR_MSG_LEN, true); if (code != TSDB_CODE_SUCCESS) { diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index 986747fe5812..41516d325a36 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -10716,12 +10716,42 @@ int32_t tEncodeMqDataRspCommon(SEncoder *pEncoder, const SMqDataRsp *pRsp) { return code; } +int32_t tEncodeSuidArray(SEncoder *pEncoder, const SMqDataRsp *pRsp){ + for (int32_t i = 0; i < pRsp->blockNum; i++) { + if (pRsp->withTbName) { + int64_t* suid = taosArrayGet(pRsp->blockSuid, i); + if (suid != NULL){ + TAOS_CHECK_RETURN(tEncodeI64(pEncoder, *suid)); + } + } + } + return 0; +} int32_t tEncodeMqDataRsp(SEncoder *pEncoder, const SMqDataRsp *pRsp) { TAOS_CHECK_RETURN(tEncodeMqDataRspCommon(pEncoder, pRsp)); TAOS_CHECK_RETURN(tEncodeI64(pEncoder, pRsp->sleepTime)); + TAOS_CHECK_RETURN(tEncodeSuidArray(pEncoder, pRsp)); + return 0; } +int32_t tDecodeSuidArray(SDecoder *pDecoder, SMqDataRsp *pRsp){ + if (!tDecodeIsEnd(pDecoder)) { + if (pRsp->withTbName) { + if ((pRsp->blockSuid = taosArrayInit(pRsp->blockNum, sizeof(int64_t))) == NULL) { + TAOS_CHECK_RETURN(terrno); + } + } + for (int32_t i = 0; i < pRsp->blockNum; i++) { + int64_t suid = 0; + TAOS_CHECK_RETURN(tDecodeI64(pDecoder, &suid)); + if (taosArrayPush(pRsp->blockSuid, &suid) == NULL) { + TAOS_CHECK_RETURN(terrno); + } + } + } + return 0; +} int32_t tDecodeMqDataRspCommon(SDecoder *pDecoder, SMqDataRsp *pRsp) { int32_t code = 0; int32_t lino; @@ -10798,6 +10828,9 @@ int32_t tDecodeMqDataRsp(SDecoder *pDecoder, SMqDataRsp *pRsp) { if (!tDecodeIsEnd(pDecoder)) { TAOS_CHECK_RETURN(tDecodeI64(pDecoder, &pRsp->sleepTime)); } + if (!tDecodeIsEnd(pDecoder)) { + TAOS_CHECK_RETURN(tDecodeSuidArray(pDecoder, pRsp)); + } return 0; } @@ -10811,6 +10844,8 @@ static void tDeleteMqDataRspCommon(SMqDataRsp *pRsp) { pRsp->blockSchema = NULL; taosArrayDestroyP(pRsp->blockTbName, (FDelete)taosMemoryFree); pRsp->blockTbName = NULL; + taosArrayDestroy(pRsp->blockSuid); + pRsp->blockSuid = NULL; tOffsetDestroy(&pRsp->reqOffset); tOffsetDestroy(&pRsp->rspOffset); } @@ -10830,6 +10865,8 @@ int32_t tEncodeSTaosxRsp(SEncoder *pEncoder, const SMqDataRsp *pRsp) { TAOS_CHECK_EXIT(tEncodeBinary(pEncoder, createTableReq, createTableLen)); } } + TAOS_CHECK_EXIT(tEncodeSuidArray(pEncoder, pRsp)); + _exit: return code; } @@ -10860,6 +10897,9 @@ int32_t tDecodeSTaosxRsp(SDecoder *pDecoder, SMqDataRsp *pRsp) { } } } + if (!tDecodeIsEnd(pDecoder)) { + TAOS_CHECK_EXIT(tDecodeSuidArray(pDecoder, pRsp)); + } _exit: return code; diff --git a/source/dnode/vnode/src/tq/tqScan.c b/source/dnode/vnode/src/tq/tqScan.c index dbc1b16cf571..a95437ab0dc0 100644 --- a/source/dnode/vnode/src/tq/tqScan.c +++ b/source/dnode/vnode/src/tq/tqScan.c @@ -77,6 +77,14 @@ static int32_t tqAddTbNameToRsp(const STQ* pTq, int64_t uid, SMqDataRsp* pRsp, i tqError("failed to push tbName to blockTbName:%s", tbName); continue; } + int64_t suid = 0; + if(mr.me.type == TSDB_CHILD_TABLE){ + suid = mr.me.ctbEntry.suid; + } + if(taosArrayPush(pRsp->blockSuid, &suid) == NULL){ + tqError("failed to push suid to blockSuid:%"PRId64, suid); + continue; + } } metaReaderClear(&mr); return 0; @@ -210,36 +218,26 @@ int32_t tqScanTaosx(STQ* pTq, const STqHandle* pHandle, SMqDataRsp* pRsp, SMqBat if (pDataBlock != NULL && pDataBlock->info.rows > 0) { if (pRsp->withTbName) { - if (pOffset->type == TMQ_OFFSET__LOG) { - int64_t uid = pExec->pTqReader->lastBlkUid; - if (tqAddTbNameToRsp(pTq, uid, pRsp, 1) < 0) { - tqError("vgId:%d, failed to add tbname to rsp msg", pTq->pVnode->config.vgId); - continue; - } - } else { - char* tbName = taosStrdup(qExtractTbnameFromTask(task)); - if (tbName == NULL) { - tqError("vgId:%d, failed to add tbname to rsp msg, null", pTq->pVnode->config.vgId); - return terrno; - } - if (taosArrayPush(pRsp->blockTbName, &tbName) == NULL){ - tqError("vgId:%d, failed to add tbname to rsp msg", pTq->pVnode->config.vgId); - continue; - } + char* tbName = taosStrdup(qExtractTbnameFromTask(task)); + if (tbName == NULL) { + tqError("vgId:%d, failed to add tbname to rsp msg, null", pTq->pVnode->config.vgId); + return terrno; + } + if (taosArrayPush(pRsp->blockTbName, &tbName) == NULL){ + tqError("vgId:%d, failed to add tbname to rsp msg", pTq->pVnode->config.vgId); + continue; + } + int64_t suid = qExtractSuidFromTask(task); + if (taosArrayPush(pRsp->blockSuid, &suid) == NULL){ + tqError("vgId:%d, failed to add suid to rsp msg", pTq->pVnode->config.vgId); + continue; } } if (pRsp->withSchema) { - if (pOffset->type == TMQ_OFFSET__LOG) { - if (tqAddBlockSchemaToRsp(pExec, pRsp) != 0){ - tqError("vgId:%d, failed to add schema to rsp msg", pTq->pVnode->config.vgId); - continue; - } - } else { - SSchemaWrapper* pSW = tCloneSSchemaWrapper(qExtractSchemaFromTask(task)); - if(taosArrayPush(pRsp->blockSchema, &pSW) == NULL){ - tqError("vgId:%d, failed to add schema to rsp msg", pTq->pVnode->config.vgId); - continue; - } + SSchemaWrapper* pSW = tCloneSSchemaWrapper(qExtractSchemaFromTask(task)); + if(taosArrayPush(pRsp->blockSchema, &pSW) == NULL){ + tqError("vgId:%d, failed to add schema to rsp msg", pTq->pVnode->config.vgId); + continue; } } @@ -249,12 +247,9 @@ int32_t tqScanTaosx(STQ* pTq, const STqHandle* pHandle, SMqDataRsp* pRsp, SMqBat continue; } pRsp->blockNum++; - if (pOffset->type == TMQ_OFFSET__LOG) { - continue; - } else { - rowCnt += pDataBlock->info.rows; - if (rowCnt <= tmqRowSize) continue; - } + rowCnt += pDataBlock->info.rows; + if (rowCnt <= tmqRowSize) continue; + } // get meta diff --git a/source/dnode/vnode/src/tq/tqUtil.c b/source/dnode/vnode/src/tq/tqUtil.c index b4866b8c653c..891e55d91d21 100644 --- a/source/dnode/vnode/src/tq/tqUtil.c +++ b/source/dnode/vnode/src/tq/tqUtil.c @@ -50,8 +50,11 @@ static int32_t tqInitTaosxRsp(SMqDataRsp* pRsp, STqOffsetVal pOffset) { pRsp->blockDataLen = taosArrayInit(0, sizeof(int32_t)); pRsp->blockTbName = taosArrayInit(0, sizeof(void*)); pRsp->blockSchema = taosArrayInit(0, sizeof(void*)); + pRsp->blockSuid = taosArrayInit(0, sizeof(int64_t)); - if (pRsp->blockData == NULL || pRsp->blockDataLen == NULL || pRsp->blockTbName == NULL || pRsp->blockSchema == NULL) { + if (pRsp->blockData == NULL || pRsp->blockDataLen == NULL || + pRsp->blockTbName == NULL || pRsp->blockSchema == NULL || + pRsp->blockSuid == NULL) { if (pRsp->blockData != NULL) { taosArrayDestroy(pRsp->blockData); pRsp->blockData = NULL; @@ -71,6 +74,11 @@ static int32_t tqInitTaosxRsp(SMqDataRsp* pRsp, STqOffsetVal pOffset) { taosArrayDestroy(pRsp->blockSchema); pRsp->blockSchema = NULL; } + + if (pRsp->blockSuid != NULL) { + taosArrayDestroy(pRsp->blockSuid); + pRsp->blockSuid = NULL; + } return terrno; } diff --git a/source/libs/executor/inc/querytask.h b/source/libs/executor/inc/querytask.h index e3bb9a13614c..3c52f8080e17 100644 --- a/source/libs/executor/inc/querytask.h +++ b/source/libs/executor/inc/querytask.h @@ -69,6 +69,7 @@ typedef struct { SVersionRange fillHistoryVer; STimeWindow fillHistoryWindow; SStreamState* pState; + int64_t suid; // for tmq } SStreamTaskInfo; struct SExecTaskInfo { diff --git a/source/libs/executor/src/executor.c b/source/libs/executor/src/executor.c index cbf392f67e2b..08b7ba0e058c 100644 --- a/source/libs/executor/src/executor.c +++ b/source/libs/executor/src/executor.c @@ -1212,6 +1212,11 @@ const char* qExtractTbnameFromTask(qTaskInfo_t tinfo) { return pTaskInfo->streamInfo.tbName; } +const int64_t qExtractSuidFromTask(qTaskInfo_t tinfo) { + SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo; + return pTaskInfo->streamInfo.suid; +} + SMqBatchMetaRsp* qStreamExtractMetaMsg(qTaskInfo_t tinfo) { SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo; return &pTaskInfo->streamInfo.btMetaRsp; @@ -1494,6 +1499,7 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT cleanupQueryTableDataCond(&pTaskInfo->streamInfo.tableCond); tstrncpy(pTaskInfo->streamInfo.tbName, mtInfo.tbName, TSDB_TABLE_NAME_LEN); + pTaskInfo->streamInfo.suid = mtInfo.suid; tDeleteSchemaWrapper(pTaskInfo->streamInfo.schema); pTaskInfo->streamInfo.schema = mtInfo.schema; From 5f9de6ac70b4848c088226ccf2448c598527bf10 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Wed, 9 Oct 2024 18:34:14 +0800 Subject: [PATCH 111/695] enh:[TS-5441] cost too long in tmq write meta data by cache meta and vg info --- source/client/src/clientRawBlockWrite.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/source/client/src/clientRawBlockWrite.c b/source/client/src/clientRawBlockWrite.c index 4b2e9e234dcd..94162ff768b5 100644 --- a/source/client/src/clientRawBlockWrite.c +++ b/source/client/src/clientRawBlockWrite.c @@ -1892,6 +1892,11 @@ static bool needRefreshMeta(void* rawData, STableMeta* pTableMeta, SSchemaWrappe return false; } +static void tmqFreeMeta(void *data){ + STableMeta* pTableMeta = *(STableMeta**)data; + taosMemoryFree(pTableMeta); +} + static int32_t tmqWriteRawImpl(TAOS* taos, uint16_t type, void* data, int32_t dataLen) { if (taos == NULL || data == NULL) { SET_ERROR_MSG("taos:%p or data:%p is NULL", taos, data); @@ -1943,7 +1948,7 @@ static int32_t tmqWriteRawImpl(TAOS* taos, uint16_t type, void* data, int32_t da if (pMetaHash == NULL){ pMetaHash = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), true, HASH_NO_LOCK); RAW_NULL_CHECK(pMetaHash); - taosHashSetFreeFp(pMetaHash, taosMemoryFree); + taosHashSetFreeFp(pMetaHash, tmqFreeMeta); } struct SCatalog* pCatalog = NULL; RAW_RETURN_CHECK(catalogGetHandle(pRequest->pTscObj->pAppInfo->clusterId, &pCatalog)); @@ -2005,13 +2010,13 @@ static int32_t tmqWriteRawImpl(TAOS* taos, uint16_t type, void* data, int32_t da RAW_NULL_CHECK(rawData); STableMeta* pTableMeta = NULL; - STableMeta** pTableMetaTmp = (STableMeta**)taosHashGet(pMetaHash, suid, POINTER_BYTES); + STableMeta** pTableMetaTmp = (STableMeta**)taosHashGet(pMetaHash, suid, LONG_BYTES); if (pTableMetaTmp == NULL || needRefreshMeta(rawData, *pTableMetaTmp, pSW)) { if (pCreateReqDst) { // change stable name to get meta (void)strcpy(pName.tname, pCreateReqDst->ctb.stbName); } RAW_RETURN_CHECK(catalogGetTableMeta(pCatalog, &conn, &pName, &pTableMeta)); - code = taosHashPut(pMetaHash, suid, POINTER_BYTES, &pTableMeta, POINTER_BYTES); + code = taosHashPut(pMetaHash, suid, LONG_BYTES, &pTableMeta, POINTER_BYTES); if (code != 0){ taosMemoryFree(pTableMeta); goto end; From 669c3aa4db484308ee6a12cd3e9b0727bfa6fef5 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Wed, 9 Oct 2024 19:48:24 +0800 Subject: [PATCH 112/695] fix windows ci issue --- source/libs/executor/inc/streamexecutorInt.h | 4 ++-- .../executor/src/streamtimesliceoperator.c | 24 +++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/source/libs/executor/inc/streamexecutorInt.h b/source/libs/executor/inc/streamexecutorInt.h index 94873b98e93e..29e165631d09 100644 --- a/source/libs/executor/inc/streamexecutorInt.h +++ b/source/libs/executor/inc/streamexecutorInt.h @@ -31,8 +31,8 @@ extern "C" { #define HAS_ROW_DATA(pRowData) (pRowData && pRowData->key != INT64_MIN) typedef struct SSliceRowData { - TSKEY key; - struct SResultCellData pRowVal[1]; + TSKEY key; + char pRowVal[]; } SSliceRowData; typedef struct SSlicePoint { diff --git a/source/libs/executor/src/streamtimesliceoperator.c b/source/libs/executor/src/streamtimesliceoperator.c index f3f362ec7c74..24fbdf15de51 100644 --- a/source/libs/executor/src/streamtimesliceoperator.c +++ b/source/libs/executor/src/streamtimesliceoperator.c @@ -665,7 +665,7 @@ static int32_t getLinearResultInfoFromState(SStreamAggSupporter* pAggSup, SStrea if (HAS_ROW_DATA(pCurPoint->pRightRow)) { pFillSup->cur.key = pCurPoint->pRightRow->key; - pFillSup->cur.pRowVal = pCurPoint->pRightRow->pRowVal; + pFillSup->cur.pRowVal = (SResultCellData*)pCurPoint->pRightRow->pRowVal; if (HAS_NON_ROW_DATA(pCurPoint->pLeftRow)) { pPrevPoint->key.groupId = groupId; int32_t preVLen = 0; @@ -677,10 +677,10 @@ static int32_t getLinearResultInfoFromState(SStreamAggSupporter* pAggSup, SStrea setPointBuff(pPrevPoint, pFillSup); if (HAS_ROW_DATA(pPrevPoint->pRightRow)) { pFillSup->prev.key = pPrevPoint->pRightRow->key; - pFillSup->prev.pRowVal = pPrevPoint->pRightRow->pRowVal; + pFillSup->prev.pRowVal = (SResultCellData*)pPrevPoint->pRightRow->pRowVal; } else { pFillSup->prev.key = pPrevPoint->pLeftRow->key; - pFillSup->prev.pRowVal = pPrevPoint->pLeftRow->pRowVal; + pFillSup->prev.pRowVal = (SResultCellData*)pPrevPoint->pLeftRow->pRowVal; } pFillSup->prevOriginKey = pFillSup->prev.key; pFillSup->prev.key = adustPrevTsKey(pPrevPoint->key.ts, pFillSup->prev.key, &pFillSup->interval); @@ -691,7 +691,7 @@ static int32_t getLinearResultInfoFromState(SStreamAggSupporter* pAggSup, SStrea if (HAS_ROW_DATA(pCurPoint->pLeftRow)) { pFillSup->prev.key = pCurPoint->pLeftRow->key; - pFillSup->prev.pRowVal = pCurPoint->pLeftRow->pRowVal; + pFillSup->prev.pRowVal = (SResultCellData*)pCurPoint->pLeftRow->pRowVal; pFillSup->prevOriginKey = pFillSup->prev.key; pFillSup->prev.key = adustPrevTsKey(pCurPoint->key.ts, pFillSup->prev.key, &pFillSup->interval); if (HAS_NON_ROW_DATA(pCurPoint->pRightRow)) { @@ -705,10 +705,10 @@ static int32_t getLinearResultInfoFromState(SStreamAggSupporter* pAggSup, SStrea setPointBuff(pNextPoint, pFillSup); if (HAS_ROW_DATA(pNextPoint->pLeftRow)) { pFillSup->next.key = pNextPoint->pLeftRow->key; - pFillSup->next.pRowVal = pNextPoint->pLeftRow->pRowVal; + pFillSup->next.pRowVal = (SResultCellData*)pNextPoint->pLeftRow->pRowVal; } else { pFillSup->next.key = pNextPoint->pRightRow->key; - pFillSup->next.pRowVal = pNextPoint->pRightRow->pRowVal; + pFillSup->next.pRowVal = (SResultCellData*)pNextPoint->pRightRow->pRowVal; } pFillSup->nextOriginKey = pFillSup->next.key; pFillSup->next.key = adustEndTsKey(pNextPoint->key.ts, pFillSup->next.key, &pFillSup->interval); @@ -747,7 +747,7 @@ static int32_t getResultInfoFromState(SStreamAggSupporter* pAggSup, SStreamFillS if (tmpRes == TSDB_CODE_SUCCESS) { setPointBuff(pCurPoint, pFillSup); pFillSup->cur.key = pCurPoint->pRightRow->key; - pFillSup->cur.pRowVal = pCurPoint->pRightRow->pRowVal; + pFillSup->cur.pRowVal = (SResultCellData*)pCurPoint->pRightRow->pRowVal; } else { pFillSup->cur.key = pCurPoint->key.ts + 1; } @@ -764,10 +764,10 @@ static int32_t getResultInfoFromState(SStreamAggSupporter* pAggSup, SStreamFillS setPointBuff(pPrevPoint, pFillSup); if (HAS_ROW_DATA(pPrevPoint->pRightRow)) { pFillSup->prev.key = pPrevPoint->pRightRow->key; - pFillSup->prev.pRowVal = pPrevPoint->pRightRow->pRowVal; + pFillSup->prev.pRowVal = (SResultCellData*)pPrevPoint->pRightRow->pRowVal; } else { pFillSup->prev.key = pPrevPoint->pLeftRow->key; - pFillSup->prev.pRowVal = pPrevPoint->pLeftRow->pRowVal; + pFillSup->prev.pRowVal = (SResultCellData*)pPrevPoint->pLeftRow->pRowVal; } pFillSup->prev.key = adustPrevTsKey(pPrevPoint->key.ts, pFillSup->prev.key, &pFillSup->interval); } @@ -782,10 +782,10 @@ static int32_t getResultInfoFromState(SStreamAggSupporter* pAggSup, SStreamFillS setPointBuff(pNextPoint, pFillSup); if (HAS_ROW_DATA(pNextPoint->pLeftRow)) { pFillSup->next.key = pNextPoint->pLeftRow->key; - pFillSup->next.pRowVal = pNextPoint->pLeftRow->pRowVal; + pFillSup->next.pRowVal = (SResultCellData*)pNextPoint->pLeftRow->pRowVal; } else { pFillSup->next.key = pNextPoint->pRightRow->key; - pFillSup->next.pRowVal = pNextPoint->pRightRow->pRowVal; + pFillSup->next.pRowVal = (SResultCellData*)pNextPoint->pRightRow->pRowVal; } pFillSup->next.key = adustEndTsKey(pNextPoint->key.ts, pFillSup->next.key, &pFillSup->interval); @@ -1224,7 +1224,7 @@ static void transBlockToResultRow(const SSDataBlock* pBlock, int32_t rowId, TSKE int32_t numOfCols = taosArrayGetSize(pBlock->pDataBlock); for (int32_t i = 0; i < numOfCols; ++i) { SColumnInfoData* pColData = taosArrayGet(pBlock->pDataBlock, i); - SResultCellData* pCell = getSliceResultCell(pRowVal->pRowVal, i); + SResultCellData* pCell = getSliceResultCell((SResultCellData*)pRowVal->pRowVal, i); if (!colDataIsNull_s(pColData, rowId)) { pCell->isNull = false; pCell->type = pColData->info.type; From 5ebed2288b6ffe9b397a9b8d000428666461ed82 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Thu, 10 Oct 2024 09:56:09 +0800 Subject: [PATCH 113/695] fix(stream): remove duplicated release task. --- source/libs/stream/src/streamMeta.c | 1 - 1 file changed, 1 deletion(-) diff --git a/source/libs/stream/src/streamMeta.c b/source/libs/stream/src/streamMeta.c index b8c433d82f37..82ec56d043b7 100644 --- a/source/libs/stream/src/streamMeta.c +++ b/source/libs/stream/src/streamMeta.c @@ -890,7 +890,6 @@ int32_t streamMetaUnregisterTask(SStreamMeta* pMeta, int64_t streamId, int32_t t stDebug("s-task:%s stop schedTimer, and (before) desc ref:%d", pTask->id.idStr, pTask->refCnt); streamTmrStop(pTask->schedInfo.pDelayTimer); pTask->info.delaySchedParam = 0; - streamMetaReleaseTask(pMeta, pTask); } streamMetaReleaseTask(pMeta, pTask); From 01a4256d0a1625a476efb738ef1735534663a3bb Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Thu, 10 Oct 2024 11:32:37 +0800 Subject: [PATCH 114/695] fix: add merge join --- source/libs/executor/test/queryPlanTests.cpp | 146 ++++++++----------- 1 file changed, 64 insertions(+), 82 deletions(-) diff --git a/source/libs/executor/test/queryPlanTests.cpp b/source/libs/executor/test/queryPlanTests.cpp index 9cfdf931a4eb..e1cd313aae0c 100755 --- a/source/libs/executor/test/queryPlanTests.cpp +++ b/source/libs/executor/test/queryPlanTests.cpp @@ -1106,8 +1106,9 @@ void qptMakeNonRealTableNode(SNode** ppNode) { } SNode* qptMakeRandNode(SNode** ppNode) { - nodesMakeNode((ENodeType)taosRand(), ppNode); - return *ppNode; + SNode* pNode = NULL; + nodesMakeNode((ENodeType)taosRand(), ppNode ? ppNode : &pNode); + return ppNode ? *ppNode : pNode; } SNode* qptMakeExprNode(SNode** ppNode) { @@ -1179,7 +1180,7 @@ SNode* qptMakeConditionNode(bool onlyTag) { } SNode* qptMakeDataBlockDescNode() { - if (!qptCtx.param.correctExpected && QPT_LOW_PROB()) { + if (QPT_NCORRECT_LOW_PROB()) { return NULL; } @@ -1192,6 +1193,41 @@ SNode* qptMakeDataBlockDescNode() { return (SNode*)pDesc; } +SNode* qptMakeSlotDescNode(const char* pName, const SNode* pNode, int16_t slotId, bool output, bool reserve) { + SSlotDescNode* pSlot = NULL; + if (QPT_NCORRECT_LOW_PROB) { + return qptMakeRandNode((SNode**)&pSlot); + } + + assert(0 == nodesMakeNode(QUERY_NODE_SLOT_DESC, (SNode**)&pSlot)); + + QPT_RAND_BOOL_V ? (pSlot->name[0] = 0) : snprintf(pSlot->name, sizeof(pSlot->name), "%s", pName); + pSlot->slotId = QPT_CORRECT_HIGH_PROB() ? slotId : taosRand(); + if (QPT_CORRECT_HIGH_PROB()) { + pSlot->dataType = ((SExprNode*)pNode)->resType; + } else { + qptGetRandValue(&pSlot->dataType.type, &pSlot->dataType.bytes, NULL); + } + + pSlot->reserve = reserve; + pSlot->output = output; + return (SNode*)pSlot; +} + +void qptMakeTargetNode(SNode* pNode, int16_t dataBlockId, int16_t slotId, SNode** pOutput) { + if (QPT_NCORRECT_LOW_PROB) { + return qptMakeRandNode(pOutput); + } + + STargetNode* pTarget = NULL; + assert(0 == nodesMakeNode(QUERY_NODE_TARGET, (SNode**)&pTarget)); + + pTarget->dataBlockId = QPT_CORRECT_HIGH_PROB() ? dataBlockId : taosRand(); + pTarget->slotId = QPT_CORRECT_HIGH_PROB() ? slotId : taosRand(); + pTarget->pExpr = QPT_CORRECT_HIGH_PROB() ? pNode : qptMakeRandNode(NULL); + + *pOutput = (SNode*)pTarget; +} SPhysiNode* qptCreatePhysiNode(int32_t nodeType) { SPhysiNode* pPhysiNode = NULL; @@ -1274,33 +1310,6 @@ void qptCreateTableScanPseudoCols( SScanPhysiNode* pScanPhysiNode) { qptCreateTableScanColsImpl(pScanPhysiNode, &pScanPhysiNode->pScanPseudoCols, qptCtx.param.tbl.tagNum, qptCtx.param.tbl.pTag); } -SNode* qptMakeSlotDescNode(const char* pName, const SNode* pNode, int16_t slotId, bool output, bool reserve) { - SSlotDescNode* pSlot = NULL; - assert(0 == nodesMakeNode(QUERY_NODE_SLOT_DESC, (SNode**)&pSlot)); - - QPT_RAND_BOOL_V ? (pSlot->name[0] = 0) : snprintf(pSlot->name, sizeof(pSlot->name), "%s", pName); - pSlot->slotId = qptCtx.param.correctExpected ? slotId : taosRand(); - if (qptCtx.param.correctExpected) { - pSlot->dataType = ((SExprNode*)pNode)->resType; - } else { - qptGetRandValue(&pSlot->dataType.type, &pSlot->dataType.bytes, NULL); - } - - pSlot->reserve = reserve; - pSlot->output = output; - return (SNode*)pSlot; -} - -void qptMakeTargetNode(SNode* pNode, int16_t dataBlockId, int16_t slotId, SNode** pOutput) { - STargetNode* pTarget = NULL; - assert(0 == nodesMakeNode(QUERY_NODE_TARGET, (SNode**)&pTarget)); - - pTarget->dataBlockId = dataBlockId; - pTarget->slotId = slotId; - pTarget->pExpr = pNode; - - *pOutput = (SNode*)pTarget; -} void qptAddDataBlockSlots(SNodeList* pList, SDataBlockDescNode* pDataBlockDesc) { if (NULL == pDataBlockDesc) { @@ -1392,6 +1401,26 @@ void qptMakeExprList(SNodeList** ppList) { } } +void qptMakeColumnList(SNodeList** ppList) { + int32_t colNum = taosRand() % QPT_MAX_COLUMN_NUM + (QPT_CORRECT_HIGH_PROB() ? 1 : 0); + qptResetMakeNodeCtx(qptCtx.buildCtx.pChild ? qptCtx.buildCtx.pChild->pOutputDataBlockDesc : NULL, false); + for (int32_t i = 0; i < colNum; ++i) { + SNode* pNode = NULL; + qptMakeColumnNode(&pNode); + qptNodesListMakeStrictAppend(ppList, pNode); + } +} + +void qptMakeTargetList(int16_t datablockId, SNodeList** ppList) { + int32_t tarNum = taosRand() % QPT_MAX_COLUMN_NUM + (QPT_CORRECT_HIGH_PROB() ? 1 : 0); + for (int32_t i = 0; i < tarNum; ++i) { + SNode* pNode = NULL, *pExpr = NULL; + qptMakeColumnNode(&pExpr); + qptMakeTargetNode(pExpr, datablockId, i, &pNode); + qptNodesListMakeStrictAppend(ppList, pNode); + } +} + SNode* qptCreateProjectPhysiNode(int32_t nodeType) { SPhysiNode* pPhysiNode = qptCreatePhysiNode(nodeType); @@ -1432,61 +1461,14 @@ SNode* qptCreateSortMergeJoinPhysiNode(int32_t nodeType) { qptMakeExprNode(&pJoin->pColEqCond); qptMakeExprNode(&pJoin->pColOnCond); qptMakeExprNode(&pJoin->pFullOnCond); - qptMakeTargetNode(SNode * pNode, int16_t dataBlockId, int16_t slotId, SNode * * pOutput) + qptMakeTargetList(pPhysiNode->pOutputDataBlockDesc ? pPhysiNode->pOutputDataBlockDesc->dataBlockId, &pJoin->pTargets); + for (int32_t i = 0; i < 2; i++) { + pJoin->inputStat[i].inputRowNum = taosRand(); + pJoin->inputStat[i].inputRowSize = taosRand(); + } pJoin->seqWinGroup = QPT_RAND_BOOL_V; pJoin->grpJoin = QPT_RAND_BOOL_V; - - - - pJoin->leftPrimSlotId = JT_PRIM_TS_SLOT_ID; - pJoin->rightPrimSlotId = JT_PRIM_TS_SLOT_ID; - pJoin->node.inputTsOrder = param->asc ? ORDER_ASC : ORDER_DESC; - if (JOIN_STYPE_WIN == pJoin->subType) { - SWindowOffsetNode* pOffset = NULL; - code = nodesMakeNode(QUERY_NODE_WINDOW_OFFSET, (SNode**)&pOffset); - assert(pOffset); - SValueNode* pStart = NULL; - code = nodesMakeNode(QUERY_NODE_VALUE, (SNode**)&pStart); - assert(pStart); - SValueNode* pEnd = NULL; - code = nodesMakeNode(QUERY_NODE_VALUE, (SNode**)&pEnd); - assert(pEnd); - pStart->node.resType.type = TSDB_DATA_TYPE_BIGINT; - pStart->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_BIGINT].bytes; - pStart->datum.i = (taosRand() % 2) ? (((int32_t)-1) * (int64_t)(taosRand() % JT_MAX_WINDOW_OFFSET)) : (taosRand() % JT_MAX_WINDOW_OFFSET); - pEnd->node.resType.type = TSDB_DATA_TYPE_BIGINT; - pEnd->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_BIGINT].bytes; - pEnd->datum.i = (taosRand() % 2) ? (((int32_t)-1) * (int64_t)(taosRand() % JT_MAX_WINDOW_OFFSET)) : (taosRand() % JT_MAX_WINDOW_OFFSET); - if (pStart->datum.i > pEnd->datum.i) { - TSWAP(pStart->datum.i, pEnd->datum.i); - } - pOffset->pStartOffset = (SNode*)pStart; - pOffset->pEndOffset = (SNode*)pEnd; - pJoin->pWindowOffset = (SNode*)pOffset; - - jtCtx.winStartOffset = pStart->datum.i; - jtCtx.winEndOffset = pEnd->datum.i; - } - - jtCtx.grpJoin = param->grpJoin; - jtCtx.joinType = param->joinType; - jtCtx.subType = param->subType; - jtCtx.asc = param->asc; - jtCtx.jLimit = param->jLimit; - jtCtx.asofOpType = param->asofOp; - jtCtx.leftColOnly = (JOIN_TYPE_LEFT == param->joinType && JOIN_STYPE_SEMI == param->subType); - jtCtx.rightColOnly = (JOIN_TYPE_RIGHT == param->joinType && JOIN_STYPE_SEMI == param->subType); - jtCtx.inGrpId = 1; - - createColCond(pJoin, param->cond); - createFilterStart(pJoin, param->filter); - createTargetSlotList(pJoin); - createColEqCondEnd(pJoin); - createColOnCondEnd(pJoin); - createFilterEnd(pJoin, param->filter); - updateColRowInfo(); - createBlockDescNode(&pJoin->node.pOutputDataBlockDesc); return (SNode*)pPhysiNode; } From 42b7520d34356355d8d45c645a2f730c43a2c8fc Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Thu, 10 Oct 2024 18:27:42 +0800 Subject: [PATCH 115/695] enh:[TS-5441] cost too long in tmq write meta data by cache meta and vg info --- include/libs/executor/executor.h | 2 +- source/client/src/clientRawBlockWrite.c | 251 ++++++++++++++---------- source/client/src/clientTmq.c | 2 +- source/common/src/tmsg.c | 78 ++++---- source/dnode/vnode/src/tq/tqScan.c | 28 +-- source/dnode/vnode/src/tq/tqUtil.c | 13 +- source/libs/executor/src/executor.c | 10 +- source/libs/parser/src/parInsertUtil.c | 15 +- tests/system-test/7-tmq/tmq_taosx.py | 6 +- utils/test/c/tmq_taosx_ci.c | 45 ++++- 10 files changed, 271 insertions(+), 179 deletions(-) diff --git a/include/libs/executor/executor.h b/include/libs/executor/executor.h index 6b02d8f985b1..8501d88be0d9 100644 --- a/include/libs/executor/executor.h +++ b/include/libs/executor/executor.h @@ -210,7 +210,7 @@ SMqBatchMetaRsp* qStreamExtractMetaMsg(qTaskInfo_t tinfo); const SSchemaWrapper* qExtractSchemaFromTask(qTaskInfo_t tinfo); const char* qExtractTbnameFromTask(qTaskInfo_t tinfo); -const int64_t qExtractSuidFromTask(qTaskInfo_t tinfo); +//const int64_t qExtractSuidFromTask(qTaskInfo_t tinfo); void* qExtractReaderFromStreamScanner(void* scanner); diff --git a/source/client/src/clientRawBlockWrite.c b/source/client/src/clientRawBlockWrite.c index 94162ff768b5..578f8148da8e 100644 --- a/source/client/src/clientRawBlockWrite.c +++ b/source/client/src/clientRawBlockWrite.c @@ -53,9 +53,7 @@ #define TMQ_META_VERSION "1.0" static int32_t tmqWriteBatchMetaDataImpl(TAOS* taos, void* meta, int32_t metaLen); - static tb_uid_t processSuid(tb_uid_t suid, char* db) { return suid + MurmurHash3_32(db, strlen(db)); } - static void buildCreateTableJson(SSchemaWrapper* schemaRow, SSchemaWrapper* schemaTag, char* name, int64_t id, int8_t t, SColCmprWrapper* pColCmprRow, cJSON** pJson) { int32_t code = TSDB_CODE_SUCCESS; @@ -1856,6 +1854,12 @@ static threadlocal SHashObj* pCreateTbHash = NULL; static threadlocal SHashObj* pNameHash = NULL; static threadlocal SHashObj* pMetaHash = NULL; +typedef struct{ + SVgroupInfo vgInfo; + int64_t uid; + int64_t suid; +}tbInfo; + static bool needRefreshMeta(void* rawData, STableMeta* pTableMeta, SSchemaWrapper* pSW){ char* p = (char*)rawData; // | version | total length | total rows | blankFill | total columns | flag seg| block group id | column schema | each @@ -1878,7 +1882,7 @@ static bool needRefreshMeta(void* rawData, STableMeta* pTableMeta, SSchemaWrappe char* fieldName = pSW->pSchema[i].name; if (strcmp(pColSchema->name, fieldName) == 0) { - if (*fields != pColSchema->type && *(int32_t*)(fields + sizeof(int8_t)) != pColSchema->bytes) { + if (*fields != pColSchema->type || *(int32_t*)(fields + sizeof(int8_t)) != pColSchema->bytes) { return true; } break; @@ -1892,11 +1896,6 @@ static bool needRefreshMeta(void* rawData, STableMeta* pTableMeta, SSchemaWrappe return false; } -static void tmqFreeMeta(void *data){ - STableMeta* pTableMeta = *(STableMeta**)data; - taosMemoryFree(pTableMeta); -} - static int32_t tmqWriteRawImpl(TAOS* taos, uint16_t type, void* data, int32_t dataLen) { if (taos == NULL || data == NULL) { SET_ERROR_MSG("taos:%p or data:%p is NULL", taos, data); @@ -1933,23 +1932,6 @@ static int32_t tmqWriteRawImpl(TAOS* taos, uint16_t type, void* data, int32_t da goto end; } - if (pVgHash == NULL){ - pVgHash = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, HASH_NO_LOCK); - RAW_NULL_CHECK(pVgHash); - } - if (pCreateTbHash == NULL){ - pCreateTbHash = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_NO_LOCK); - RAW_NULL_CHECK(pCreateTbHash); - } - if (pNameHash == NULL){ - pNameHash = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_NO_LOCK); - RAW_NULL_CHECK(pNameHash); - } - if (pMetaHash == NULL){ - pMetaHash = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), true, HASH_NO_LOCK); - RAW_NULL_CHECK(pMetaHash); - taosHashSetFreeFp(pMetaHash, tmqFreeMeta); - } struct SCatalog* pCatalog = NULL; RAW_RETURN_CHECK(catalogGetHandle(pRequest->pTscObj->pAppInfo->clusterId, &pCatalog)); @@ -1959,90 +1941,119 @@ static int32_t tmqWriteRawImpl(TAOS* taos, uint16_t type, void* data, int32_t da conn.requestObjRefId = pRequest->self; conn.mgmtEps = getEpSet_s(&pRequest->pTscObj->pAppInfo->mgmtEp); - RAW_RETURN_CHECK(smlInitHandle(&pQuery)); + int retry = 0; + while(1){ + RAW_RETURN_CHECK(smlInitHandle(&pQuery)); - uDebug(LOG_ID_TAG " write raw data type:%d block num:%d", LOG_ID_VALUE, type, rspObj.dataRsp.blockNum); - while (++rspObj.resIter < rspObj.dataRsp.blockNum) { - void* pRetrieve = taosArrayGetP(rspObj.dataRsp.blockData, rspObj.resIter); - RAW_NULL_CHECK(pRetrieve); - if (!rspObj.dataRsp.withSchema) { - goto end; - } + uDebug(LOG_ID_TAG " write raw data type:%d block num:%d", LOG_ID_VALUE, type, rspObj.dataRsp.blockNum); + while (++rspObj.resIter < rspObj.dataRsp.blockNum) { + void* pRetrieve = taosArrayGetP(rspObj.dataRsp.blockData, rspObj.resIter); + RAW_NULL_CHECK(pRetrieve); + if (!rspObj.dataRsp.withSchema) { + goto end; + } - const char* tbName = (const char*)taosArrayGetP(rspObj.dataRsp.blockTbName, rspObj.resIter); - RAW_NULL_CHECK(tbName); + const char* tbName = (const char*)taosArrayGetP(rspObj.dataRsp.blockTbName, rspObj.resIter); + RAW_NULL_CHECK(tbName); - int64_t* suid = taosArrayGet(rspObj.dataRsp.blockSuid, rspObj.resIter); - RAW_NULL_CHECK(suid); +// int64_t* suid = taosArrayGet(rspObj.dataRsp.blockSuid, rspObj.resIter); +// RAW_NULL_CHECK(suid); - uDebug(LOG_ID_TAG " write raw data block tbname:%s", LOG_ID_VALUE, tbName); - SName pName = {TSDB_TABLE_NAME_T, pRequest->pTscObj->acctId, {0}, {0}}; - (void)strcpy(pName.dbname, pRequest->pDb); - (void)strcpy(pName.tname, tbName); + uDebug(LOG_ID_TAG " write raw data block tbname:%s", LOG_ID_VALUE, tbName); + SName pName = {TSDB_TABLE_NAME_T, pRequest->pTscObj->acctId, {0}, {0}}; + (void)strcpy(pName.dbname, pRequest->pDb); + (void)strcpy(pName.tname, tbName); - // find schema data info - SVCreateTbReq* pCreateReqDst = NULL; - if (type == RES_TYPE__TMQ_METADATA){ - pCreateReqDst = (SVCreateTbReq*)taosHashGet(pCreateTbHash, tbName, strlen(tbName)); - if (pCreateReqDst == NULL) { - RAW_RETURN_CHECK(buildCreateTbMap(&rspObj.dataRsp, pCreateTbHash)); + // find schema data info + SVCreateTbReq* pCreateReqDst = NULL; + if (type == RES_TYPE__TMQ_METADATA){ pCreateReqDst = (SVCreateTbReq*)taosHashGet(pCreateTbHash, tbName, strlen(tbName)); + if (pCreateReqDst == NULL) { + RAW_RETURN_CHECK(buildCreateTbMap(&rspObj.dataRsp, pCreateTbHash)); + pCreateReqDst = (SVCreateTbReq*)taosHashGet(pCreateTbHash, tbName, strlen(tbName)); + } } - } + STableMeta* pTableMeta = NULL; + tbInfo* tmpInfo = (tbInfo*)taosHashGet(pNameHash, tbName, strlen(tbName)); + if (tmpInfo == NULL || retry > 0) { + tbInfo info = {0}; - int32_t vgId = 0; - SVgroupInfo* vg = (SVgroupInfo*)taosHashGet(pNameHash, tbName, strlen(tbName)); - if (vg == NULL) { - SVgroupInfo vgTmp = {0}; - RAW_RETURN_CHECK(catalogGetTableHashVgroup(pCatalog, &conn, &pName, &vgTmp)); - RAW_RETURN_CHECK(taosHashPut(pNameHash, tbName, strlen(tbName), &vgTmp, sizeof(SVgroupInfo))); - code = taosHashPut(pVgHash, &vgTmp.vgId, sizeof(vgTmp.vgId), &vgTmp, sizeof(SVgroupInfo)); - code = (code == TSDB_CODE_DUP_KEY) ? 0 : code; - RAW_RETURN_CHECK(code); - vgId = vgTmp.vgId; - } else { - vgId = vg->vgId; - } + RAW_RETURN_CHECK(catalogGetTableHashVgroup(pCatalog, &conn, &pName, &info.vgInfo)); + if (pCreateReqDst) { // change stable name to get meta + (void)strcpy(pName.tname, pCreateReqDst->ctb.stbName); + } + RAW_RETURN_CHECK(catalogGetTableMeta(pCatalog, &conn, &pName, &pTableMeta)); + info.uid = pTableMeta->uid; + if (pTableMeta->tableType == TSDB_CHILD_TABLE){ + info.suid = pTableMeta->suid; + } else { + info.suid = pTableMeta->uid; + } + code = taosHashPut(pMetaHash, &info.suid, LONG_BYTES, &pTableMeta, POINTER_BYTES); + if (code != 0){ + taosMemoryFree(pTableMeta); + goto end; + } + if (pCreateReqDst) { + pTableMeta->vgId = info.vgInfo.vgId; + pTableMeta->uid = pCreateReqDst->uid; + pCreateReqDst->ctb.suid = pTableMeta->suid; + } - SSchemaWrapper* pSW = (SSchemaWrapper*)taosArrayGetP(rspObj.dataRsp.blockSchema, rspObj.resIter); - RAW_NULL_CHECK(pSW); - void* rawData = getRawDataFromRes(pRetrieve); - RAW_NULL_CHECK(rawData); + code = taosHashPut(pNameHash, pName.tname, strlen(pName.tname), &info, sizeof(tbInfo)); + code = (code == TSDB_CODE_DUP_KEY) ? 0 : code; + RAW_RETURN_CHECK(code); + code = taosHashPut(pVgHash, &info.vgInfo.vgId, sizeof(info.vgInfo.vgId), &info.vgInfo, sizeof(SVgroupInfo)); + code = (code == TSDB_CODE_DUP_KEY) ? 0 : code; + RAW_RETURN_CHECK(code); + } - STableMeta* pTableMeta = NULL; - STableMeta** pTableMetaTmp = (STableMeta**)taosHashGet(pMetaHash, suid, LONG_BYTES); - if (pTableMetaTmp == NULL || needRefreshMeta(rawData, *pTableMetaTmp, pSW)) { - if (pCreateReqDst) { // change stable name to get meta - (void)strcpy(pName.tname, pCreateReqDst->ctb.stbName); + SSchemaWrapper* pSW = (SSchemaWrapper*)taosArrayGetP(rspObj.dataRsp.blockSchema, rspObj.resIter); + RAW_NULL_CHECK(pSW); + void* rawData = getRawDataFromRes(pRetrieve); + RAW_NULL_CHECK(rawData); + + if (pTableMeta == NULL || retry > 0){ + STableMeta** pTableMetaTmp = (STableMeta**)taosHashGet(pMetaHash, &tmpInfo->suid, LONG_BYTES); + if (pTableMetaTmp == NULL || retry > 0 || needRefreshMeta(rawData, *pTableMetaTmp, pSW)) { + RAW_RETURN_CHECK(catalogGetTableMeta(pCatalog, &conn, &pName, &pTableMeta)); + code = taosHashPut(pMetaHash, &tmpInfo->suid, LONG_BYTES, &pTableMeta, POINTER_BYTES); + if (code != 0){ + taosMemoryFree(pTableMeta); + goto end; + } + + }else{ + pTableMeta = *pTableMetaTmp; + pTableMeta->uid = tmpInfo->uid; + pTableMeta->vgId = tmpInfo->vgInfo.vgId; + } } - RAW_RETURN_CHECK(catalogGetTableMeta(pCatalog, &conn, &pName, &pTableMeta)); - code = taosHashPut(pMetaHash, suid, LONG_BYTES, &pTableMeta, POINTER_BYTES); - if (code != 0){ - taosMemoryFree(pTableMeta); + + char err[ERR_MSG_LEN] = {0}; + code = rawBlockBindData(pQuery, pTableMeta, rawData, pCreateReqDst, pSW, pSW->nCols, true, err, ERR_MSG_LEN, true); + if (code != TSDB_CODE_SUCCESS) { + SET_ERROR_MSG("table:%s, err:%s", tbName, err); goto end; } - if (pCreateReqDst) { - pTableMeta->vgId = vgId; - pTableMeta->uid = pCreateReqDst->uid; - pCreateReqDst->ctb.suid = pTableMeta->suid; - } - }else{ - pTableMeta = *pTableMetaTmp; } + RAW_RETURN_CHECK(smlBuildOutput(pQuery, pVgHash)); + launchQueryImpl(pRequest, pQuery, true, NULL); + code = pRequest->code; - char err[ERR_MSG_LEN] = {0}; - code = rawBlockBindData(pQuery, pTableMeta, rawData, pCreateReqDst, pSW, pSW->nCols, true, err, ERR_MSG_LEN, true); - if (code != TSDB_CODE_SUCCESS) { - SET_ERROR_MSG("table:%s, err:%s", tbName, err); - goto end; + if (NEED_CLIENT_HANDLE_ERROR(code)) { + uInfo("write raw retry:%d/3 end code:%d, msg:%s", retry, code, tstrerror(code)); + if (retry++ >= 3) { + break; + } + qDestroyQuery(pQuery); + pQuery = NULL; + rspObj.resIter = -1; + continue; } + break; } - RAW_RETURN_CHECK(smlBuildOutput(pQuery, pVgHash)); - - launchQueryImpl(pRequest, pQuery, true, NULL); - code = pRequest->code; - end: uDebug(LOG_ID_TAG " write raw metadata return, msg:%s", LOG_ID_VALUE, tstrerror(code)); if (type == RES_TYPE__TMQ_METADATA){ @@ -2056,18 +2067,6 @@ static int32_t tmqWriteRawImpl(TAOS* taos, uint16_t type, void* data, int32_t da return code; } -void tmqClean() { - taosHashCleanup(pMetaHash); - taosHashCleanup(pNameHash); - void* pIter = taosHashIterate(pCreateTbHash, NULL); - while (pIter) { - tDestroySVCreateTbReq(pIter, TSDB_MSG_FLG_DECODE); - pIter = taosHashIterate(pCreateTbHash, pIter); - } - taosHashCleanup(pCreateTbHash); - taosHashCleanup(pVgHash); -} - static void processSimpleMeta(SMqMetaRsp* pMetaRsp, cJSON** meta) { if (pMetaRsp->resMsgType == TDMT_VND_CREATE_STB) { processCreateStb(pMetaRsp, meta); @@ -2263,7 +2262,53 @@ void tmq_free_raw(tmq_raw_data raw) { (void)memset(terrMsg, 0, ERR_MSG_LEN); } +static void tmqFreeMeta(void *data){ + STableMeta* pTableMeta = *(STableMeta**)data; + taosMemoryFree(pTableMeta); +} + +void freeHash() { + taosHashCleanup(pMetaHash); + taosHashCleanup(pNameHash); + void* pIter = taosHashIterate(pCreateTbHash, NULL); + while (pIter) { + tDestroySVCreateTbReq(pIter, TSDB_MSG_FLG_DECODE); + pIter = taosHashIterate(pCreateTbHash, pIter); + } + taosHashCleanup(pCreateTbHash); + taosHashCleanup(pVgHash); +} + +static int32_t initHash(){ + int32_t code = 0; + if (pVgHash == NULL){ + pVgHash = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, HASH_NO_LOCK); + RAW_NULL_CHECK(pVgHash); + } + if (pCreateTbHash == NULL){ + pCreateTbHash = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_NO_LOCK); + RAW_NULL_CHECK(pCreateTbHash); + } + if (pNameHash == NULL){ + pNameHash = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK); + RAW_NULL_CHECK(pNameHash); + } + if (pMetaHash == NULL){ + pMetaHash = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), true, HASH_NO_LOCK); + RAW_NULL_CHECK(pMetaHash); + taosHashSetFreeFp(pMetaHash, tmqFreeMeta); + } + return code; +end: + freeHash(); + return code; +} + static int32_t writeRawImpl(TAOS* taos, void* buf, uint32_t len, uint16_t type) { + int32_t code = initHash(); + if (code != 0) { + return code; + } if (type == TDMT_VND_CREATE_STB) { return taosCreateStb(taos, buf, len); } else if (type == TDMT_VND_ALTER_STB) { diff --git a/source/client/src/clientTmq.c b/source/client/src/clientTmq.c index 4cbb80818720..6d0323e20a29 100644 --- a/source/client/src/clientTmq.c +++ b/source/client/src/clientTmq.c @@ -1064,7 +1064,7 @@ void tmqSendHbReq(void* param, void* tmrId) { tDestroySMqHbReq(&req); if (tmrId != NULL) { bool ret = taosTmrReset(tmqSendHbReq, tmq->heartBeatIntervalMs, param, tmqMgmt.timer, &tmq->hbLiveTimer); - tqDebugC("consumer:0x%" PRIx64 " reset timer for tmq hb:%d, pollFlag:%d", tmq->consumerId, ret, tmq->pollFlag); + tqDebugC("consumer:0x%" PRIx64 " reset timer for tmq heartbeat:%d, pollFlag:%d", tmq->consumerId, ret, tmq->pollFlag); } int32_t ret = taosReleaseRef(tmqMgmt.rsetId, refId); if (ret != 0){ diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index 41516d325a36..e58521237290 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -10716,42 +10716,42 @@ int32_t tEncodeMqDataRspCommon(SEncoder *pEncoder, const SMqDataRsp *pRsp) { return code; } -int32_t tEncodeSuidArray(SEncoder *pEncoder, const SMqDataRsp *pRsp){ - for (int32_t i = 0; i < pRsp->blockNum; i++) { - if (pRsp->withTbName) { - int64_t* suid = taosArrayGet(pRsp->blockSuid, i); - if (suid != NULL){ - TAOS_CHECK_RETURN(tEncodeI64(pEncoder, *suid)); - } - } - } - return 0; -} +//int32_t tEncodeSuidArray(SEncoder *pEncoder, const SMqDataRsp *pRsp){ +// for (int32_t i = 0; i < pRsp->blockNum; i++) { +// if (pRsp->withTbName) { +// int64_t* suid = taosArrayGet(pRsp->blockSuid, i); +// if (suid != NULL){ +// TAOS_CHECK_RETURN(tEncodeI64(pEncoder, *suid)); +// } +// } +// } +// return 0; +//} int32_t tEncodeMqDataRsp(SEncoder *pEncoder, const SMqDataRsp *pRsp) { TAOS_CHECK_RETURN(tEncodeMqDataRspCommon(pEncoder, pRsp)); TAOS_CHECK_RETURN(tEncodeI64(pEncoder, pRsp->sleepTime)); - TAOS_CHECK_RETURN(tEncodeSuidArray(pEncoder, pRsp)); +// TAOS_CHECK_RETURN(tEncodeSuidArray(pEncoder, pRsp)); return 0; } -int32_t tDecodeSuidArray(SDecoder *pDecoder, SMqDataRsp *pRsp){ - if (!tDecodeIsEnd(pDecoder)) { - if (pRsp->withTbName) { - if ((pRsp->blockSuid = taosArrayInit(pRsp->blockNum, sizeof(int64_t))) == NULL) { - TAOS_CHECK_RETURN(terrno); - } - } - - for (int32_t i = 0; i < pRsp->blockNum; i++) { - int64_t suid = 0; - TAOS_CHECK_RETURN(tDecodeI64(pDecoder, &suid)); - if (taosArrayPush(pRsp->blockSuid, &suid) == NULL) { - TAOS_CHECK_RETURN(terrno); - } - } - } - return 0; -} +//int32_t tDecodeSuidArray(SDecoder *pDecoder, SMqDataRsp *pRsp){ +// if (!tDecodeIsEnd(pDecoder)) { +// if (pRsp->withTbName) { +// if ((pRsp->blockSuid = taosArrayInit(pRsp->blockNum, sizeof(int64_t))) == NULL) { +// TAOS_CHECK_RETURN(terrno); +// } +// } +// +// for (int32_t i = 0; i < pRsp->blockNum; i++) { +// int64_t suid = 0; +// TAOS_CHECK_RETURN(tDecodeI64(pDecoder, &suid)); +// if (taosArrayPush(pRsp->blockSuid, &suid) == NULL) { +// TAOS_CHECK_RETURN(terrno); +// } +// } +// } +// return 0; +//} int32_t tDecodeMqDataRspCommon(SDecoder *pDecoder, SMqDataRsp *pRsp) { int32_t code = 0; int32_t lino; @@ -10828,9 +10828,9 @@ int32_t tDecodeMqDataRsp(SDecoder *pDecoder, SMqDataRsp *pRsp) { if (!tDecodeIsEnd(pDecoder)) { TAOS_CHECK_RETURN(tDecodeI64(pDecoder, &pRsp->sleepTime)); } - if (!tDecodeIsEnd(pDecoder)) { - TAOS_CHECK_RETURN(tDecodeSuidArray(pDecoder, pRsp)); - } +// if (!tDecodeIsEnd(pDecoder)) { +// TAOS_CHECK_RETURN(tDecodeSuidArray(pDecoder, pRsp)); +// } return 0; } @@ -10844,8 +10844,8 @@ static void tDeleteMqDataRspCommon(SMqDataRsp *pRsp) { pRsp->blockSchema = NULL; taosArrayDestroyP(pRsp->blockTbName, (FDelete)taosMemoryFree); pRsp->blockTbName = NULL; - taosArrayDestroy(pRsp->blockSuid); - pRsp->blockSuid = NULL; +// taosArrayDestroy(pRsp->blockSuid); +// pRsp->blockSuid = NULL; tOffsetDestroy(&pRsp->reqOffset); tOffsetDestroy(&pRsp->rspOffset); } @@ -10865,7 +10865,7 @@ int32_t tEncodeSTaosxRsp(SEncoder *pEncoder, const SMqDataRsp *pRsp) { TAOS_CHECK_EXIT(tEncodeBinary(pEncoder, createTableReq, createTableLen)); } } - TAOS_CHECK_EXIT(tEncodeSuidArray(pEncoder, pRsp)); +// TAOS_CHECK_EXIT(tEncodeSuidArray(pEncoder, pRsp)); _exit: return code; @@ -10897,9 +10897,9 @@ int32_t tDecodeSTaosxRsp(SDecoder *pDecoder, SMqDataRsp *pRsp) { } } } - if (!tDecodeIsEnd(pDecoder)) { - TAOS_CHECK_EXIT(tDecodeSuidArray(pDecoder, pRsp)); - } +// if (!tDecodeIsEnd(pDecoder)) { +// TAOS_CHECK_EXIT(tDecodeSuidArray(pDecoder, pRsp)); +// } _exit: return code; diff --git a/source/dnode/vnode/src/tq/tqScan.c b/source/dnode/vnode/src/tq/tqScan.c index a95437ab0dc0..68702754aaa9 100644 --- a/source/dnode/vnode/src/tq/tqScan.c +++ b/source/dnode/vnode/src/tq/tqScan.c @@ -77,14 +77,16 @@ static int32_t tqAddTbNameToRsp(const STQ* pTq, int64_t uid, SMqDataRsp* pRsp, i tqError("failed to push tbName to blockTbName:%s", tbName); continue; } - int64_t suid = 0; - if(mr.me.type == TSDB_CHILD_TABLE){ - suid = mr.me.ctbEntry.suid; - } - if(taosArrayPush(pRsp->blockSuid, &suid) == NULL){ - tqError("failed to push suid to blockSuid:%"PRId64, suid); - continue; - } +// int64_t suid = 0; +// if(mr.me.type == TSDB_CHILD_TABLE){ +// suid = mr.me.ctbEntry.suid; +// }else{ +// suid = mr.me.uid; +// } +// if(taosArrayPush(pRsp->blockSuid, &suid) == NULL){ +// tqError("failed to push suid to blockSuid:%"PRId64, suid); +// continue; +// } } metaReaderClear(&mr); return 0; @@ -227,11 +229,11 @@ int32_t tqScanTaosx(STQ* pTq, const STqHandle* pHandle, SMqDataRsp* pRsp, SMqBat tqError("vgId:%d, failed to add tbname to rsp msg", pTq->pVnode->config.vgId); continue; } - int64_t suid = qExtractSuidFromTask(task); - if (taosArrayPush(pRsp->blockSuid, &suid) == NULL){ - tqError("vgId:%d, failed to add suid to rsp msg", pTq->pVnode->config.vgId); - continue; - } +// int64_t suid = qExtractSuidFromTask(task); +// if (taosArrayPush(pRsp->blockSuid, &suid) == NULL){ +// tqError("vgId:%d, failed to add suid to rsp msg", pTq->pVnode->config.vgId); +// continue; +// } } if (pRsp->withSchema) { SSchemaWrapper* pSW = tCloneSSchemaWrapper(qExtractSchemaFromTask(task)); diff --git a/source/dnode/vnode/src/tq/tqUtil.c b/source/dnode/vnode/src/tq/tqUtil.c index 891e55d91d21..6acfe6b074d5 100644 --- a/source/dnode/vnode/src/tq/tqUtil.c +++ b/source/dnode/vnode/src/tq/tqUtil.c @@ -50,11 +50,10 @@ static int32_t tqInitTaosxRsp(SMqDataRsp* pRsp, STqOffsetVal pOffset) { pRsp->blockDataLen = taosArrayInit(0, sizeof(int32_t)); pRsp->blockTbName = taosArrayInit(0, sizeof(void*)); pRsp->blockSchema = taosArrayInit(0, sizeof(void*)); - pRsp->blockSuid = taosArrayInit(0, sizeof(int64_t)); +// pRsp->blockSuid = taosArrayInit(0, sizeof(int64_t)); if (pRsp->blockData == NULL || pRsp->blockDataLen == NULL || - pRsp->blockTbName == NULL || pRsp->blockSchema == NULL || - pRsp->blockSuid == NULL) { + pRsp->blockTbName == NULL || pRsp->blockSchema == NULL) { if (pRsp->blockData != NULL) { taosArrayDestroy(pRsp->blockData); pRsp->blockData = NULL; @@ -75,10 +74,10 @@ static int32_t tqInitTaosxRsp(SMqDataRsp* pRsp, STqOffsetVal pOffset) { pRsp->blockSchema = NULL; } - if (pRsp->blockSuid != NULL) { - taosArrayDestroy(pRsp->blockSuid); - pRsp->blockSuid = NULL; - } +// if (pRsp->blockSuid != NULL) { +// taosArrayDestroy(pRsp->blockSuid); +// pRsp->blockSuid = NULL; +// } return terrno; } diff --git a/source/libs/executor/src/executor.c b/source/libs/executor/src/executor.c index 08b7ba0e058c..b5af516f75de 100644 --- a/source/libs/executor/src/executor.c +++ b/source/libs/executor/src/executor.c @@ -1212,10 +1212,10 @@ const char* qExtractTbnameFromTask(qTaskInfo_t tinfo) { return pTaskInfo->streamInfo.tbName; } -const int64_t qExtractSuidFromTask(qTaskInfo_t tinfo) { - SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo; - return pTaskInfo->streamInfo.suid; -} +//const int64_t qExtractSuidFromTask(qTaskInfo_t tinfo) { +// SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo; +// return pTaskInfo->streamInfo.suid; +//} SMqBatchMetaRsp* qStreamExtractMetaMsg(qTaskInfo_t tinfo) { SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo; @@ -1499,7 +1499,7 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT cleanupQueryTableDataCond(&pTaskInfo->streamInfo.tableCond); tstrncpy(pTaskInfo->streamInfo.tbName, mtInfo.tbName, TSDB_TABLE_NAME_LEN); - pTaskInfo->streamInfo.suid = mtInfo.suid; + pTaskInfo->streamInfo.suid = mtInfo.suid == 0 ? mtInfo.uid : mtInfo.suid; tDeleteSchemaWrapper(pTaskInfo->streamInfo.schema); pTaskInfo->streamInfo.schema = mtInfo.schema; diff --git a/source/libs/parser/src/parInsertUtil.c b/source/libs/parser/src/parInsertUtil.c index f29ed79412fc..8adf32d2ddd4 100644 --- a/source/libs/parser/src/parInsertUtil.c +++ b/source/libs/parser/src/parInsertUtil.c @@ -963,11 +963,11 @@ int rawBlockBindData(SQuery* query, STableMeta* pTableMeta, void* data, SVCreate ret = TSDB_CODE_INVALID_PARA; goto end; } - if (tFields != NULL && numFields > boundInfo->numOfBound) { - if (errstr != NULL) snprintf(errstr, errstrLen, "numFields:%d bigger than num of bound cols:%d", numFields, boundInfo->numOfBound); - ret = TSDB_CODE_INVALID_PARA; - goto end; - } +// if (tFields != NULL && numFields > boundInfo->numOfBound) { +// if (errstr != NULL) snprintf(errstr, errstrLen, "numFields:%d bigger than num of bound cols:%d", numFields, boundInfo->numOfBound); +// ret = TSDB_CODE_INVALID_PARA; +// goto end; +// } if (tFields == NULL && numOfCols != boundInfo->numOfBound) { if (errstr != NULL) snprintf(errstr, errstrLen, "numFields:%d not equal to num of bound cols:%d", numOfCols, boundInfo->numOfBound); ret = TSDB_CODE_INVALID_PARA; @@ -1037,6 +1037,11 @@ int rawBlockBindData(SQuery* query, STableMeta* pTableMeta, void* data, SVCreate pStart += numOfRows * sizeof(int32_t); } else { pStart += BitmapLen(numOfRows); +// for(int k = 0; k < numOfRows; k++) { +// if(!colDataIsNull_f(offset, k) && pColSchema->type == TSDB_DATA_TYPE_INT){ +// printf("colName:%s,val:%d", fieldName, *(int32_t*)(pStart + k * sizeof(int32_t))); +// } +// } } char* pData = pStart; diff --git a/tests/system-test/7-tmq/tmq_taosx.py b/tests/system-test/7-tmq/tmq_taosx.py index 4e90aefe7cab..5047ada1d101 100644 --- a/tests/system-test/7-tmq/tmq_taosx.py +++ b/tests/system-test/7-tmq/tmq_taosx.py @@ -131,14 +131,14 @@ def checkData(self): tdSql.checkData(0, 2, 1) tdSql.query("select * from ct3 order by c1 desc") - tdSql.checkRows(2) + tdSql.checkRows(5) tdSql.checkData(0, 1, 51) tdSql.checkData(0, 4, 940) tdSql.checkData(1, 1, 23) tdSql.checkData(1, 4, None) tdSql.query("select * from st1 order by ts") - tdSql.checkRows(8) + tdSql.checkRows(14) tdSql.checkData(0, 1, 1) tdSql.checkData(1, 1, 3) tdSql.checkData(4, 1, 4) @@ -180,7 +180,7 @@ def checkData(self): tdSql.checkData(6, 8, None) tdSql.query("select * from ct1") - tdSql.checkRows(4) + tdSql.checkRows(7) tdSql.query("select * from ct2") tdSql.checkRows(0) diff --git a/utils/test/c/tmq_taosx_ci.c b/utils/test/c/tmq_taosx_ci.c index d49c7e4ad4e1..cd70dd88f59f 100644 --- a/utils/test/c/tmq_taosx_ci.c +++ b/utils/test/c/tmq_taosx_ci.c @@ -133,7 +133,7 @@ int buildDatabase(TAOS* pConn, TAOS_RES* 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)); + printf("failed to create child table ct0, reason:%s\n", taos_errstr(pRes)); return -1; } taos_free_result(pRes); @@ -176,7 +176,7 @@ int buildDatabase(TAOS* pConn, TAOS_RES* 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(1626006833603, 4, 3, 'hwj') ct1 values(now+5s, 23, 32, 's21ds')"); + "'ddd') ct0 values(1626006833603, 4, 3, 'hwj') ct1 values(1626006833703, 23, 32, 's21ds')"); if (taos_errno(pRes) != 0) { printf("failed to insert into ct3, reason:%s\n", taos_errstr(pRes)); return -1; @@ -190,6 +190,41 @@ int buildDatabase(TAOS* pConn, TAOS_RES* pRes) { } taos_free_result(pRes); + pRes = taos_query(pConn, "insert into ct1 values(1736006813600, -32222, 43, 'ewb', 99)"); + 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, "alter table st1 drop column c4"); + 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 ct1 values(1736006833600, -4223, 344, 'bfs')"); + 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, "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, "insert into ct1 values(1766006833600, -4432, 4433, 'e23wb', 9349)"); + 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, "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)); @@ -597,6 +632,7 @@ tmq_t* build_consumer() { tmq_conf_set(conf, "enable.auto.commit", "true"); tmq_conf_set(conf, "auto.offset.reset", "earliest"); tmq_conf_set(conf, "msg.consume.excluded", "1"); +// tmq_conf_set(conf, "session.timeout.ms", "1000000"); // tmq_conf_set(conf, "max.poll.interval.ms", "20000"); if (g_conf.snapShot) { @@ -637,6 +673,7 @@ void basic_consume_loop(tmq_t* tmq, tmq_list_t* topics) { TAOS_RES* tmqmessage = tmq_consumer_poll(tmq, 5000); if (tmqmessage) { cnt++; + printf("cnt:%d\n", cnt); msg_process(tmqmessage); taos_free_result(tmqmessage); } else { @@ -845,6 +882,8 @@ void initLogFile() { "{\"name\":\"t1\",\"type\":4,\"value\":3000}],\"createList\":[]}", "{\"type\":\"alter\",\"tableType\":\"super\",\"tableName\":\"st1\",\"alterType\":5,\"colName\":\"c4\"," "\"colType\":5}", + "{\"type\":\"alter\",\"tableType\":\"super\",\"tableName\":\"st1\",\"alterType\":6,\"colName\":\"c4\"}", + "{\"type\":\"alter\",\"tableType\":\"super\",\"tableName\":\"st1\",\"alterType\":5,\"colName\":\"c4\",\"colType\":5}", "{\"type\":\"alter\",\"tableType\":\"super\",\"tableName\":\"st1\",\"alterType\":7,\"colName\":\"c3\"," "\"colType\":8,\"colLength\":64}", "{\"type\":\"alter\",\"tableType\":\"super\",\"tableName\":\"st1\",\"alterType\":1,\"colName\":\"t2\"," @@ -992,6 +1031,8 @@ void initLogFile() { "{\"name\":\"t1\",\"type\":4,\"value\":3000}],\"createList\":[]}", "{\"type\":\"alter\",\"tableType\":\"super\",\"tableName\":\"st1\",\"alterType\":5,\"colName\":\"c4\"," "\"colType\":5}", + "{\"type\":\"alter\",\"tableType\":\"super\",\"tableName\":\"st1\",\"alterType\":6,\"colName\":\"c4\"}", + "{\"type\":\"alter\",\"tableType\":\"super\",\"tableName\":\"st1\",\"alterType\":5,\"colName\":\"c4\",\"colType\":5}", "{\"type\":\"alter\",\"tableType\":\"super\",\"tableName\":\"st1\",\"alterType\":7,\"colName\":\"c3\"," "\"colType\":8,\"colLength\":64}", "{\"type\":\"alter\",\"tableType\":\"super\",\"tableName\":\"st1\",\"alterType\":1,\"colName\":\"t2\"," From 52f003e47408bb6aacdea7cfe0969ad7368a8b8e Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Fri, 11 Oct 2024 15:50:28 +0800 Subject: [PATCH 116/695] enh:[TS-5441] cost too long in tmq write meta data by cache meta and vg info --- source/client/src/clientRawBlockWrite.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/source/client/src/clientRawBlockWrite.c b/source/client/src/clientRawBlockWrite.c index 358df25481da..94e0b9bec0e4 100644 --- a/source/client/src/clientRawBlockWrite.c +++ b/source/client/src/clientRawBlockWrite.c @@ -1821,6 +1821,7 @@ static int32_t buildCreateTbMap(SMqDataRsp* rsp, SHashObj* pHashObj) { int32_t code = 0; SVCreateTbReq pCreateReq = {0}; SDecoder decoderTmp = {0}; + SVCreateTbReq *pCreateReqTmp = NULL; for (int j = 0; j < rsp->createTableNum; j++) { void** dataTmp = taosArrayGet(rsp->createTableReq, j); @@ -1836,8 +1837,9 @@ static int32_t buildCreateTbMap(SMqDataRsp* rsp, SHashObj* pHashObj) { goto end; } if (taosHashGet(pHashObj, pCreateReq.name, strlen(pCreateReq.name)) == NULL) { - RAW_RETURN_CHECK( - taosHashPut(pHashObj, pCreateReq.name, strlen(pCreateReq.name), &pCreateReq, sizeof(SVCreateTbReq))); + RAW_RETURN_CHECK(cloneSVreateTbReq(&pCreateReq, &pCreateReqTmp)); + RAW_RETURN_CHECK(taosHashPut(pHashObj, pCreateReq.name, strlen(pCreateReq.name), pCreateReqTmp, sizeof(SVCreateTbReq))); + pCreateReqTmp = NULL; } else { tDestroySVCreateTbReq(&pCreateReq, TSDB_MSG_FLG_DECODE); pCreateReq = (SVCreateTbReq){0}; @@ -1850,6 +1852,7 @@ static int32_t buildCreateTbMap(SMqDataRsp* rsp, SHashObj* pHashObj) { end: tDecoderClear(&decoderTmp); tDestroySVCreateTbReq(&pCreateReq, TSDB_MSG_FLG_DECODE); + tDestroySVCreateTbReq(pCreateReqTmp, TSDB_MSG_FLG_DECODE); return code; } @@ -1944,6 +1947,7 @@ static int32_t tmqWriteRawImpl(TAOS* taos, uint16_t type, void* data, int32_t da conn.requestId = pRequest->requestId; conn.requestObjRefId = pRequest->self; conn.mgmtEps = getEpSet_s(&pRequest->pTscObj->pAppInfo->mgmtEp); + RAW_RETURN_CHECK(buildCreateTbMap(&rspObj.dataRsp, pCreateTbHash)); int retry = 0; while(1){ @@ -1971,10 +1975,6 @@ static int32_t tmqWriteRawImpl(TAOS* taos, uint16_t type, void* data, int32_t da SVCreateTbReq* pCreateReqDst = NULL; if (type == RES_TYPE__TMQ_METADATA){ pCreateReqDst = (SVCreateTbReq*)taosHashGet(pCreateTbHash, tbName, strlen(tbName)); - if (pCreateReqDst == NULL) { - RAW_RETURN_CHECK(buildCreateTbMap(&rspObj.dataRsp, pCreateTbHash)); - pCreateReqDst = (SVCreateTbReq*)taosHashGet(pCreateTbHash, tbName, strlen(tbName)); - } } STableMeta* pTableMeta = NULL; tbInfo* tmpInfo = (tbInfo*)taosHashGet(pNameHash, tbName, strlen(tbName)); From ddc3676752b46b156dccbb68bfd77c4aeb555fed Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Fri, 11 Oct 2024 16:26:48 +0800 Subject: [PATCH 117/695] enh:[TS-5441] cost too long in tmq write meta data by cache meta and vg info --- source/client/src/clientRawBlockWrite.c | 38 +++++++++++++------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/source/client/src/clientRawBlockWrite.c b/source/client/src/clientRawBlockWrite.c index 94e0b9bec0e4..800973196a82 100644 --- a/source/client/src/clientRawBlockWrite.c +++ b/source/client/src/clientRawBlockWrite.c @@ -1821,7 +1821,6 @@ static int32_t buildCreateTbMap(SMqDataRsp* rsp, SHashObj* pHashObj) { int32_t code = 0; SVCreateTbReq pCreateReq = {0}; SDecoder decoderTmp = {0}; - SVCreateTbReq *pCreateReqTmp = NULL; for (int j = 0; j < rsp->createTableNum; j++) { void** dataTmp = taosArrayGet(rsp->createTableReq, j); @@ -1837,9 +1836,7 @@ static int32_t buildCreateTbMap(SMqDataRsp* rsp, SHashObj* pHashObj) { goto end; } if (taosHashGet(pHashObj, pCreateReq.name, strlen(pCreateReq.name)) == NULL) { - RAW_RETURN_CHECK(cloneSVreateTbReq(&pCreateReq, &pCreateReqTmp)); - RAW_RETURN_CHECK(taosHashPut(pHashObj, pCreateReq.name, strlen(pCreateReq.name), pCreateReqTmp, sizeof(SVCreateTbReq))); - pCreateReqTmp = NULL; + RAW_RETURN_CHECK(taosHashPut(pHashObj, pCreateReq.name, strlen(pCreateReq.name), &pCreateReq, sizeof(SVCreateTbReq))); } else { tDestroySVCreateTbReq(&pCreateReq, TSDB_MSG_FLG_DECODE); pCreateReq = (SVCreateTbReq){0}; @@ -1852,12 +1849,11 @@ static int32_t buildCreateTbMap(SMqDataRsp* rsp, SHashObj* pHashObj) { end: tDecoderClear(&decoderTmp); tDestroySVCreateTbReq(&pCreateReq, TSDB_MSG_FLG_DECODE); - tDestroySVCreateTbReq(pCreateReqTmp, TSDB_MSG_FLG_DECODE); return code; } static threadlocal SHashObj* pVgHash = NULL; -static threadlocal SHashObj* pCreateTbHash = NULL; +//static threadlocal SHashObj* pCreateTbHash = NULL; static threadlocal SHashObj* pNameHash = NULL; static threadlocal SHashObj* pMetaHash = NULL; @@ -1912,7 +1908,8 @@ static int32_t tmqWriteRawImpl(TAOS* taos, uint16_t type, void* data, int32_t da SQuery* pQuery = NULL; SMqRspObj rspObj = {0}; SDecoder decoder = {0}; - SRequestObj* pRequest = NULL; + SHashObj* pCreateTbHash = NULL; + SRequestObj* pRequest = NULL; RAW_RETURN_CHECK(createRequest(*(int64_t*)taos, TSDB_SQL_INSERT, 0, &pRequest)); uDebug(LOG_ID_TAG " write raw metadata, data:%p, dataLen:%d", LOG_ID_VALUE, data, dataLen); @@ -1947,7 +1944,12 @@ static int32_t tmqWriteRawImpl(TAOS* taos, uint16_t type, void* data, int32_t da conn.requestId = pRequest->requestId; conn.requestObjRefId = pRequest->self; conn.mgmtEps = getEpSet_s(&pRequest->pTscObj->pAppInfo->mgmtEp); - RAW_RETURN_CHECK(buildCreateTbMap(&rspObj.dataRsp, pCreateTbHash)); + + if (type == RES_TYPE__TMQ_METADATA) { + pCreateTbHash = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK); + RAW_NULL_CHECK(pCreateTbHash); + RAW_RETURN_CHECK(buildCreateTbMap(&rspObj.dataRsp, pCreateTbHash)); + } int retry = 0; while(1){ @@ -2064,6 +2066,12 @@ static int32_t tmqWriteRawImpl(TAOS* taos, uint16_t type, void* data, int32_t da }else { tDeleteMqDataRsp(&rspObj.dataRsp); } + void* pIter = taosHashIterate(pCreateTbHash, NULL); + while (pIter) { + tDestroySVCreateTbReq(pIter, TSDB_MSG_FLG_DECODE); + pIter = taosHashIterate(pCreateTbHash, pIter); + } + taosHashCleanup(pCreateTbHash); tDecoderClear(&decoder); qDestroyQuery(pQuery); destroyRequest(pRequest); @@ -2273,12 +2281,6 @@ static void tmqFreeMeta(void *data){ void freeHash() { taosHashCleanup(pMetaHash); taosHashCleanup(pNameHash); - void* pIter = taosHashIterate(pCreateTbHash, NULL); - while (pIter) { - tDestroySVCreateTbReq(pIter, TSDB_MSG_FLG_DECODE); - pIter = taosHashIterate(pCreateTbHash, pIter); - } - taosHashCleanup(pCreateTbHash); taosHashCleanup(pVgHash); } @@ -2288,10 +2290,10 @@ static int32_t initHash(){ pVgHash = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, HASH_NO_LOCK); RAW_NULL_CHECK(pVgHash); } - if (pCreateTbHash == NULL){ - pCreateTbHash = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_NO_LOCK); - RAW_NULL_CHECK(pCreateTbHash); - } +// if (pCreateTbHash == NULL){ +// pCreateTbHash = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_NO_LOCK); +// RAW_NULL_CHECK(pCreateTbHash); +// } if (pNameHash == NULL){ pNameHash = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK); RAW_NULL_CHECK(pNameHash); From 471871bff53126f30af89d1ce5a8ee3eecee86bd Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Fri, 11 Oct 2024 17:02:22 +0800 Subject: [PATCH 118/695] enh:[TS-5441] cost too long in tmq write meta data by cache meta and vg info --- source/client/src/clientRawBlockWrite.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/source/client/src/clientRawBlockWrite.c b/source/client/src/clientRawBlockWrite.c index 800973196a82..d3c2b53fb66d 100644 --- a/source/client/src/clientRawBlockWrite.c +++ b/source/client/src/clientRawBlockWrite.c @@ -1984,7 +1984,7 @@ static int32_t tmqWriteRawImpl(TAOS* taos, uint16_t type, void* data, int32_t da tbInfo info = {0}; RAW_RETURN_CHECK(catalogGetTableHashVgroup(pCatalog, &conn, &pName, &info.vgInfo)); - if (pCreateReqDst) { // change stable name to get meta + if (pCreateReqDst && tmpInfo == NULL) { // change stable name to get meta (void)strcpy(pName.tname, pCreateReqDst->ctb.stbName); } RAW_RETURN_CHECK(catalogGetTableMeta(pCatalog, &conn, &pName, &pTableMeta)); @@ -2005,12 +2005,13 @@ static int32_t tmqWriteRawImpl(TAOS* taos, uint16_t type, void* data, int32_t da pCreateReqDst->ctb.suid = pTableMeta->suid; } - code = taosHashPut(pNameHash, pName.tname, strlen(pName.tname), &info, sizeof(tbInfo)); - code = (code == TSDB_CODE_DUP_KEY) ? 0 : code; - RAW_RETURN_CHECK(code); - code = taosHashPut(pVgHash, &info.vgInfo.vgId, sizeof(info.vgInfo.vgId), &info.vgInfo, sizeof(SVgroupInfo)); - code = (code == TSDB_CODE_DUP_KEY) ? 0 : code; - RAW_RETURN_CHECK(code); + RAW_RETURN_CHECK(taosHashPut(pNameHash, pName.tname, strlen(pName.tname), &info, sizeof(tbInfo))); + tmpInfo = (tbInfo*)taosHashGet(pNameHash, pName.tname, strlen(pName.tname)); +// code = (code == TSDB_CODE_DUP_KEY) ? 0 : code; +// RAW_RETURN_CHECK(code); + RAW_RETURN_CHECK(taosHashPut(pVgHash, &info.vgInfo.vgId, sizeof(info.vgInfo.vgId), &info.vgInfo, sizeof(SVgroupInfo))); +// code = (code == TSDB_CODE_DUP_KEY) ? 0 : code; +// RAW_RETURN_CHECK(code); } SSchemaWrapper* pSW = (SSchemaWrapper*)taosArrayGetP(rspObj.dataRsp.blockSchema, rspObj.resIter); From dca556a7e8aa542d60e9d96818b24a414550febd Mon Sep 17 00:00:00 2001 From: Shungang Li Date: Mon, 30 Sep 2024 16:52:02 +0800 Subject: [PATCH 119/695] enh: delay allocation of array in LRU-insert --- source/util/src/tlrucache.c | 39 ++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/source/util/src/tlrucache.c b/source/util/src/tlrucache.c index 69832cd46c68..92dcf015a612 100644 --- a/source/util/src/tlrucache.c +++ b/source/util/src/tlrucache.c @@ -372,23 +372,34 @@ static void taosLRUCacheShardCleanup(SLRUCacheShard *shard) { static LRUStatus taosLRUCacheShardInsertEntry(SLRUCacheShard *shard, SLRUEntry *e, LRUHandle **handle, bool freeOnFail) { LRUStatus status = TAOS_LRU_STATUS_OK; - SArray *lastReferenceList = taosArrayInit(16, POINTER_BYTES); - if (!lastReferenceList) { - taosLRUEntryFree(e); - return TAOS_LRU_STATUS_FAIL; + SLRUEntry *toFree = NULL; + SArray *lastReferenceList = NULL; + if (shard->usage + e->totalCharge > shard->capacity) { + lastReferenceList = taosArrayInit(16, POINTER_BYTES); + if (!lastReferenceList) { + taosLRUEntryFree(e); + return TAOS_LRU_STATUS_FAIL; + } } (void)taosThreadMutexLock(&shard->mutex); - taosLRUCacheShardEvictLRU(shard, e->totalCharge, lastReferenceList); + if (shard->usage + e->totalCharge > shard->capacity && shard->lru.next != &shard->lru) { + if (!lastReferenceList) { + lastReferenceList = taosArrayInit(16, POINTER_BYTES); + if (!lastReferenceList) { + taosLRUEntryFree(e); + (void)taosThreadMutexUnlock(&shard->mutex); + return TAOS_LRU_STATUS_FAIL; + } + } + taosLRUCacheShardEvictLRU(shard, e->totalCharge, lastReferenceList); + } if (shard->usage + e->totalCharge > shard->capacity && (shard->strictCapacity || handle == NULL)) { TAOS_LRU_ENTRY_SET_IN_CACHE(e, false); if (handle == NULL) { - if (!taosArrayPush(lastReferenceList, &e)) { - taosLRUEntryFree(e); - goto _exit; - } + toFree = e; } else { if (freeOnFail) { taosLRUEntryFree(e); @@ -413,11 +424,7 @@ static LRUStatus taosLRUCacheShardInsertEntry(SLRUCacheShard *shard, SLRUEntry * taosLRUCacheShardLRURemove(shard, old); shard->usage -= old->totalCharge; - if (!taosArrayPush(lastReferenceList, &old)) { - taosLRUEntryFree(e); - taosLRUEntryFree(old); - goto _exit; - } + toFree = old; } } if (handle == NULL) { @@ -434,6 +441,10 @@ static LRUStatus taosLRUCacheShardInsertEntry(SLRUCacheShard *shard, SLRUEntry * _exit: (void)taosThreadMutexUnlock(&shard->mutex); + if (toFree) { + taosLRUEntryFree(toFree); + } + for (int i = 0; i < taosArrayGetSize(lastReferenceList); ++i) { SLRUEntry *entry = taosArrayGetP(lastReferenceList, i); From 3cb60211de79c8cad72c811e1bb60075936a2ae7 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Sat, 12 Oct 2024 15:43:58 +0800 Subject: [PATCH 120/695] enh:[TS-5441] cost too long in tmq write meta data by cache meta and vg info --- source/libs/executor/src/scanoperator.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index bae9926f6370..3713a2c0714f 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -2877,6 +2877,7 @@ static int32_t setBlockIntoRes(SStreamScanInfo* pInfo, const SSDataBlock* pBlock return 0; } + blockDataFreeRes((SSDataBlock*)pBlock); code = calBlockTbName(pInfo, pInfo->pRes, 0); QUERY_CHECK_CODE(code, lino, _end); From 88aac4ff677e8007f4e7890190733413005f301f Mon Sep 17 00:00:00 2001 From: yingzhao Date: Mon, 14 Oct 2024 15:38:31 +0800 Subject: [PATCH 121/695] docs(datain): add version information for every datasource --- docs/zh/06-advanced/05-data-in/index.md | 32 +++++++++++++++---------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/docs/zh/06-advanced/05-data-in/index.md b/docs/zh/06-advanced/05-data-in/index.md index 7e5c4670105b..50c66cc37782 100644 --- a/docs/zh/06-advanced/05-data-in/index.md +++ b/docs/zh/06-advanced/05-data-in/index.md @@ -14,18 +14,26 @@ TDengine Enterprise 配备了一个强大的可视化数据管理工具—taosEx ## 支持的数据源 -目前 TDengine 支持的数据源如下: - -1. Aveva PI System:一个工业数据管理和分析平台,前身为 OSIsoft PI System,它能够实时采集、整合、分析和可视化工业数据,助力企业实现智能化决策和精细化管理 -2. Aveva Historian:一个工业大数据分析软件,前身为 Wonderware Historian,专为工业环境设计,用于存储、管理和分析来自各种工业设备、传感器的实时和历史数据。 -3. OPC DA/UA:OPC 是 Open Platform Communications 的缩写,是一种开放式、标准化的通信协议,用于不同厂商的自动化设备之间进行数据交换。它最初由微软公司开发,旨在解决工业控制领域中不同设备之间互操作性差的问题。OPC 协议最初于 1996 年发布,当时称为 OPC DA (Data Access),主要用于实时数据采集和控制;2006 年,OPC 基金会发布了 OPC UA (Unified Architecture) 标准,它是一种基于服务的面向对象的协议,具有更高的灵活性和可扩展性,已成为 OPC 协议的主流版本。 -4. MQTT:Message Queuing Telemetry Transport 的缩写,一种基于发布/订阅模式的轻量级通讯协议,专为低开销、低带宽占用的即时通讯设计,广泛适用于物联网、小型设备、移动应用等领域。 -5. Kafka:由 Apache 软件基金会开发的一个开源流处理平台,主要用于处理实时数据,并提供一个统一、高通量、低延迟的消息系统。它具备高速度、可伸缩性、持久性和分布式设计等特点,使得它能够在每秒处理数十万次的读写操作,支持上千个客户端,同时保持数据的可靠性和可用性。 -6. OpenTSDB:基于 HBase 的分布式、可伸缩的时序数据库。它主要用于存储、索引和提供从大规模集群(包括网络设备、操作系统、应用程序等)中收集的指标数据,使这些数据更易于访问和图形化展示。 -7. CSV:Comma Separated Values 的缩写,是一种以逗号分隔的纯文本文件格式,通常用于电子表格或数据库软件。 -8. TDengine 2:泛指运行 TDengine 2.x 版本的 TDengine 实例。 -9. TDengine 3:泛指运行 TDengine 3.x 版本的 TDengine 实例。 -10. MySQL, PostgreSQL, Oracle 等关系型数据库。 +目前 TDengine 支持的数据源如下表: + +| 数据源 | 支持版本 | 描述 | +| --- | --- | --- | +| Aveva PI System | PI AF Server Version 2.10.9.593 或以上 | 工业数据管理和分析平台,前身为 OSIsoft PI System,它能够实时采集、整合、分析和可视化工业数据,助力企业实现智能化决策和精细化管理 | +| Aveva Historian | AVEVA Historian 2020 RS SP1 | 工业大数据分析软件,前身为 Wonderware Historian,专为工业环境设计,用于存储、管理和分析来自各种工业设备、传感器的实时和历史数据 | +| OPC DA | Matrikon OPC version: 1.7.2.7433 | OPC 是 Open Platform Communications 的缩写,是一种开放式、标准化的通信协议,用于不同厂商的自动化设备之间进行数据交换。它最初由微软公司开发,旨在解决工业控制领域中不同设备之间互操作性差的问题;OPC 协议最初于 1996 年发布,当时称为 OPC DA (Data Access),主要用于实时数据采集和控制。 | +| OPC UA | KeepWare KEPServerEx 6.5 | 2006 年,OPC 基金会发布了 OPC UA (Unified Architecture) 标准,它是一种基于服务的面向对象的协议,具有更高的灵活性和可扩展性,已成为 OPC 协议的主流版本 | +| MQTT | emqx: 3.0.0 到 5.7.1
    hivemq: 4.0.0 到 4.31.0
    mosquitto: 1.4.4 到 2.0.18 | Message Queuing Telemetry Transport 的缩写,一种基于发布/订阅模式的轻量级通讯协议,专为低开销、低带宽占用的即时通讯设计,广泛适用于物联网、小型设备、移动应用等领域。 | +| Kafka | 2.11 ~ 3.8.0 | 由 Apache 软件基金会开发的一个开源流处理平台,主要用于处理实时数据,并提供一个统一、高通量、低延迟的消息系统。它具备高速度、可伸缩性、持久性和分布式设计等特点,使得它能够在每秒处理数十万次的读写操作,支持上千个客户端,同时保持数据的可靠性和可用性。 | +| InfluxDB | 1.7、1.8、2.0-2.7 | InfluxDB 是一种流行的开源时间序列数据库,它针对处理大量时间序列数据进行了优化。| +| OpenTSDB | 2.4.1 | 基于 HBase 的分布式、可伸缩的时序数据库。它主要用于存储、索引和提供从大规模集群(包括网络设备、操作系统、应用程序等)中收集的指标数据,使这些数据更易于访问和图形化展示。 | +| MySQL | 5.6,5.7,8.0+ | MySQL是最流行的关系型数据库管理系统之一,由于其体积小、速度快、总体拥有成本低,尤其是开放源码这一特点,一般中小型和大型网站的开发都选择 MySQL 作为网站数据库。 | +| Oracle | 11G/12c/19c | Oracle 数据库系统是世界上流行的关系数据库管理系统,系统可移植性好、使用方便、功能强,适用于各类大、中、小微机环境。它是一种高效率的、可靠性好的、适应高吞吐量的数据库方案。 | +| PostgreSQL | v15.0+ | PostgreSQL 是一个功能非常强大的、源代码开放的客户/服务器关系型数据库管理系统, 有很多在大型商业RDBMS中所具有的特性,包括事务、子选择、触发器、视图、外键引用完整性和复杂锁定功能。| +| SQL Server | 2012/2022 | Microsoft SQL Server 是一种关系型数据库管理系统,由 Microsoft 公司开发,具有使用方便可伸缩性好与相关软件集成程度高等优点。 | +| MongoDB | 3.6+ | MongoDB 是一个介于关系型数据库与非关系型数据库之间的产品,被广泛应用于内容管理系统、移动应用与物联网等众多领域。 | +| CSV | - | Comma Separated Values 的缩写,是一种以逗号分隔的纯文本文件格式,通常用于电子表格或数据库软件。 | +| TDengine 2.x | 2.4 或 2.6+ | TDengine 旧版本,已不再维护,推荐升级到 3.0 最新版本。 | +| TDengine 3.x | 源端版本+ | 使用 TMQ 进行 TDengine 指定从数据库或超级表的订阅。 | ## 数据提取、过滤和转换 From 55b5b905b76335ae05901d1c70a79a7077a55434 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Mon, 14 Oct 2024 17:30:36 +0800 Subject: [PATCH 122/695] init groupResInfo --- source/libs/executor/src/streamtimesliceoperator.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/libs/executor/src/streamtimesliceoperator.c b/source/libs/executor/src/streamtimesliceoperator.c index 24fbdf15de51..f55d76c2e98a 100644 --- a/source/libs/executor/src/streamtimesliceoperator.c +++ b/source/libs/executor/src/streamtimesliceoperator.c @@ -2073,6 +2073,9 @@ int32_t createStreamTimeSliceOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pInfo->isHistoryOp = pHandle->fillHistory; } + // init Info->groupResInfo + pInfo->groupResInfo.freeItem = false; + pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERP_FUNC; setOperatorInfo(pOperator, getStreamOpName(pOperator->operatorType), QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERP_FUNC, true, OP_NOT_OPENED, pInfo, pTaskInfo); From 77998988960f0ab4a286909b54ad6e543f17c678 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Mon, 14 Oct 2024 19:40:55 +0800 Subject: [PATCH 123/695] fix(stream): adj result flag --- source/libs/executor/src/streamtimesliceoperator.c | 6 +++--- source/libs/stream/src/streamSliceState.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/source/libs/executor/src/streamtimesliceoperator.c b/source/libs/executor/src/streamtimesliceoperator.c index f55d76c2e98a..57643d29e8ad 100644 --- a/source/libs/executor/src/streamtimesliceoperator.c +++ b/source/libs/executor/src/streamtimesliceoperator.c @@ -1836,6 +1836,8 @@ static int32_t doStreamTimeSliceNext(SOperatorInfo* pOperator, SSDataBlock** ppR } initMultiResInfoFromArrayList(&pInfo->groupResInfo, pInfo->pUpdated); + pInfo->groupResInfo.freeItem = false; + pInfo->pUpdated = taosArrayInit(16, sizeof(SWinKey)); QUERY_CHECK_NULL(pInfo->pUpdated, code, lino, _end, terrno); @@ -2023,6 +2025,7 @@ int32_t createStreamTimeSliceOperatorInfo(SOperatorInfo* downstream, SPhysiNode* } int32_t keyBytes = sizeof(TSKEY); + keyBytes += blockDataGetRowSize(pDownRes) + sizeof(SResultCellData) * taosArrayGetSize(pDownRes->pDataBlock); if (pPkCol) { keyBytes += pPkCol->bytes; } @@ -2073,9 +2076,6 @@ int32_t createStreamTimeSliceOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pInfo->isHistoryOp = pHandle->fillHistory; } - // init Info->groupResInfo - pInfo->groupResInfo.freeItem = false; - pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERP_FUNC; setOperatorInfo(pOperator, getStreamOpName(pOperator->operatorType), QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERP_FUNC, true, OP_NOT_OPENED, pInfo, pTaskInfo); diff --git a/source/libs/stream/src/streamSliceState.c b/source/libs/stream/src/streamSliceState.c index c92fac5968da..ec451274ab63 100644 --- a/source/libs/stream/src/streamSliceState.c +++ b/source/libs/stream/src/streamSliceState.c @@ -237,7 +237,7 @@ int32_t getHashSortPrevRow(SStreamFileState* pFileState, const SWinKey* pKey, SW if (ppBuff) { pWinStates = (SArray*)(*ppBuff); } else { - qTrace("===stream=== search buff is empty.group id:%" PRId64, pKey->groupId); + qDebug("===stream=== search buff is empty.group id:%" PRId64, pKey->groupId); SStreamStateCur* pCur = streamStateFillSeekKeyPrev_rocksdb(pState, pKey); void* tmpVal = NULL; int32_t len = 0; From 47bf139416dbd6f01a06eb4b925855cc1d85197e Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Tue, 15 Oct 2024 09:44:55 +0800 Subject: [PATCH 124/695] fix(stream): adj state buff --- source/libs/stream/src/streamSliceState.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/stream/src/streamSliceState.c b/source/libs/stream/src/streamSliceState.c index ec451274ab63..2ec8ef202c08 100644 --- a/source/libs/stream/src/streamSliceState.c +++ b/source/libs/stream/src/streamSliceState.c @@ -71,7 +71,7 @@ int32_t getHashSortRowBuff(SStreamFileState* pFileState, const SWinKey* pKey, vo int32_t size = taosArrayGetSize(pWinStates); int32_t index = binarySearch(pWinStates, size, pKey, fillStateKeyCompare); - if (!isFlushedState(pFileState, pKey->ts, 0)|| index >= 0) { + if (!isFlushedState(pFileState, pKey->ts, 0)|| index >= 0 || size == 0) { // find the first position which is smaller than the pKey if (index >= 0) { SWinKey* pTmpKey = taosArrayGet(pWinStates, index); From 10436cacffbf07ddcccca22b392f521d6bada41b Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Tue, 15 Oct 2024 16:17:58 +0800 Subject: [PATCH 125/695] enh:[TS-5441] cost too long in tmq write meta data by cache meta and vg info --- source/client/src/clientTmq.c | 10 ++++++---- source/libs/executor/inc/querytask.h | 2 +- source/libs/executor/src/executor.c | 2 +- source/libs/executor/src/scanoperator.c | 1 - 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/source/client/src/clientTmq.c b/source/client/src/clientTmq.c index 020bf25e40a1..ce701a755c86 100644 --- a/source/client/src/clientTmq.c +++ b/source/client/src/clientTmq.c @@ -831,8 +831,8 @@ static int32_t innerCommitAll(tmq_t* tmq, SMqCommitCbParamSet* pParamSet){ } code = innerCommit(tmq, pTopic->topicName, &pVg->offsetInfo.endOffset, pVg, pParamSet); - if (code != 0){ - tqDebugC("consumer:0x%" PRIx64 " topic:%s vgId:%d, no commit, code:%s, current offset version:%" PRId64 ", ordinal:%d/%d", + if (code != 0 && code != TSDB_CODE_TMQ_SAME_COMMITTED_VALUE){ + tqErrorC("consumer:0x%" PRIx64 " topic:%s vgId:%d, no commit, code:%s, current offset version:%" PRId64 ", ordinal:%d/%d", tmq->consumerId, pTopic->topicName, pVg->vgId, tstrerror(code), pVg->offsetInfo.endOffset.version, j + 1, numOfVgroups); } } @@ -857,7 +857,7 @@ static void asyncCommitAllOffsets(tmq_t* tmq, tmq_commit_cb* pCommitFp, void* us return; } code = innerCommitAll(tmq, pParamSet); - if (code != 0){ + if (code != 0 && code != TSDB_CODE_TMQ_SAME_COMMITTED_VALUE){ tqErrorC("consumer:0x%" PRIx64 " innerCommitAll failed, code:%s", tmq->consumerId, tstrerror(code)); } @@ -1270,7 +1270,9 @@ static int32_t askEpCb(void* param, SDataBuf* pMsg, int32_t code) { } if (code != TSDB_CODE_SUCCESS) { - tqErrorC("consumer:0x%" PRIx64 ", get topic endpoint error, code:%s", tmq->consumerId, tstrerror(code)); + if (code != TSDB_CODE_MND_CONSUMER_NOT_READY){ + tqErrorC("consumer:0x%" PRIx64 ", get topic endpoint error, code:%s", tmq->consumerId, tstrerror(code)); + } goto END; } diff --git a/source/libs/executor/inc/querytask.h b/source/libs/executor/inc/querytask.h index 3c52f8080e17..c9e65bacaf1d 100644 --- a/source/libs/executor/inc/querytask.h +++ b/source/libs/executor/inc/querytask.h @@ -69,7 +69,7 @@ typedef struct { SVersionRange fillHistoryVer; STimeWindow fillHistoryWindow; SStreamState* pState; - int64_t suid; // for tmq +// int64_t suid; // for tmq } SStreamTaskInfo; struct SExecTaskInfo { diff --git a/source/libs/executor/src/executor.c b/source/libs/executor/src/executor.c index 4e5a1d2e1ee8..4cfa12be5b65 100644 --- a/source/libs/executor/src/executor.c +++ b/source/libs/executor/src/executor.c @@ -1499,7 +1499,7 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT cleanupQueryTableDataCond(&pTaskInfo->streamInfo.tableCond); tstrncpy(pTaskInfo->streamInfo.tbName, mtInfo.tbName, TSDB_TABLE_NAME_LEN); - pTaskInfo->streamInfo.suid = mtInfo.suid == 0 ? mtInfo.uid : mtInfo.suid; +// pTaskInfo->streamInfo.suid = mtInfo.suid == 0 ? mtInfo.uid : mtInfo.suid; tDeleteSchemaWrapper(pTaskInfo->streamInfo.schema); pTaskInfo->streamInfo.schema = mtInfo.schema; diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 3713a2c0714f..bae9926f6370 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -2877,7 +2877,6 @@ static int32_t setBlockIntoRes(SStreamScanInfo* pInfo, const SSDataBlock* pBlock return 0; } - blockDataFreeRes((SSDataBlock*)pBlock); code = calBlockTbName(pInfo, pInfo->pRes, 0); QUERY_CHECK_CODE(code, lino, _end); From ab61e051942c658b5172cf5cff36470c8e2f2383 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Tue, 15 Oct 2024 19:19:21 +0800 Subject: [PATCH 126/695] enh: add rand query plan --- source/libs/executor/test/queryPlanTests.cpp | 1694 +++++++++++++----- source/libs/nodes/src/nodesUtilFuncs.c | 3 + 2 files changed, 1265 insertions(+), 432 deletions(-) diff --git a/source/libs/executor/test/queryPlanTests.cpp b/source/libs/executor/test/queryPlanTests.cpp index e1cd313aae0c..2be84a57850c 100755 --- a/source/libs/executor/test/queryPlanTests.cpp +++ b/source/libs/executor/test/queryPlanTests.cpp @@ -42,10 +42,11 @@ #include "stub.h" #include "querytask.h" #include "functionMgt.h" +#include "ttime.h" namespace { -#define QPT_MAX_LOOP 100000000 +#define QPT_MAX_LOOP 10000 #define QPT_MAX_SUBPLAN_LEVEL 1000 #define QPT_MAX_WHEN_THEN_NUM 10 #define QPT_MAX_NODE_LEVEL 5 @@ -54,70 +55,22 @@ namespace { #define QPT_MAX_LOGIC_PARAM 5 #define QPT_MAX_NODE_LIST_NUM 5 #define QPT_DEFAULT_VNODE_NUM 5 -#define QPT_MAX_COLUMN_NUM 8192 - - -int32_t QPT_PHYSIC_NODE_LIST[] = { - QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN, - QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN, - QUERY_NODE_PHYSICAL_PLAN_TABLE_SEQ_SCAN, - QUERY_NODE_PHYSICAL_PLAN_TABLE_MERGE_SCAN, - QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN, - QUERY_NODE_PHYSICAL_PLAN_SYSTABLE_SCAN, - QUERY_NODE_PHYSICAL_PLAN_BLOCK_DIST_SCAN, - QUERY_NODE_PHYSICAL_PLAN_LAST_ROW_SCAN, - QUERY_NODE_PHYSICAL_PLAN_PROJECT, - QUERY_NODE_PHYSICAL_PLAN_MERGE_JOIN, - QUERY_NODE_PHYSICAL_PLAN_HASH_AGG, - QUERY_NODE_PHYSICAL_PLAN_EXCHANGE, - QUERY_NODE_PHYSICAL_PLAN_MERGE, - QUERY_NODE_PHYSICAL_PLAN_SORT, - QUERY_NODE_PHYSICAL_PLAN_GROUP_SORT, - QUERY_NODE_PHYSICAL_PLAN_HASH_INTERVAL, - QUERY_NODE_PHYSICAL_PLAN_MERGE_INTERVAL, - QUERY_NODE_PHYSICAL_PLAN_MERGE_ALIGNED_INTERVAL, - QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL, - QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL, - QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL, - QUERY_NODE_PHYSICAL_PLAN_FILL, - QUERY_NODE_PHYSICAL_PLAN_STREAM_FILL, - QUERY_NODE_PHYSICAL_PLAN_MERGE_SESSION, - QUERY_NODE_PHYSICAL_PLAN_STREAM_SESSION, - QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_SESSION, - QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_SESSION, - QUERY_NODE_PHYSICAL_PLAN_MERGE_STATE, - QUERY_NODE_PHYSICAL_PLAN_STREAM_STATE, - QUERY_NODE_PHYSICAL_PLAN_PARTITION, - QUERY_NODE_PHYSICAL_PLAN_STREAM_PARTITION, - QUERY_NODE_PHYSICAL_PLAN_INDEF_ROWS_FUNC, - QUERY_NODE_PHYSICAL_PLAN_INTERP_FUNC, - QUERY_NODE_PHYSICAL_PLAN_DISPATCH, - QUERY_NODE_PHYSICAL_PLAN_INSERT, - QUERY_NODE_PHYSICAL_PLAN_QUERY_INSERT, - QUERY_NODE_PHYSICAL_PLAN_DELETE, - QUERY_NODE_PHYSICAL_SUBPLAN, - QUERY_NODE_PHYSICAL_PLAN, - QUERY_NODE_PHYSICAL_PLAN_TABLE_COUNT_SCAN, - QUERY_NODE_PHYSICAL_PLAN_MERGE_EVENT, - QUERY_NODE_PHYSICAL_PLAN_STREAM_EVENT, - QUERY_NODE_PHYSICAL_PLAN_HASH_JOIN, - QUERY_NODE_PHYSICAL_PLAN_GROUP_CACHE, - QUERY_NODE_PHYSICAL_PLAN_DYN_QUERY_CTRL, - QUERY_NODE_PHYSICAL_PLAN_MERGE_COUNT, - QUERY_NODE_PHYSICAL_PLAN_STREAM_COUNT, - QUERY_NODE_PHYSICAL_PLAN_STREAM_MID_INTERVAL -}; +#define QPT_MAX_DS_SRC_NUM 10 +#define QPT_MAX_ORDER_BY_NUM 10 +#define QPT_MAX_COLUMN_NUM 6 //8192 -#define QPT_PHYSIC_NODE_NUM() (sizeof(QPT_PHYSIC_NODE_LIST)/sizeof(QPT_PHYSIC_NODE_LIST[0])) -#define QPT_RAND_BOOL_V ((taosRand() % 2) ? true : false) -#define QPT_RAND_ORDER_V (QPT_RAND_BOOL_V ? ORDER_ASC : ORDER_DESC) -#define QPT_RAND_INT_V (taosRand() * (QPT_RAND_BOOL_V ? 1 : -1)) -#define QPT_LOW_PROB() ((taosRand() % 11) == 0) -#define QPT_MID_PROB() ((taosRand() % 11) <= 1) -#define QPT_HIGH_PROB() ((taosRand() % 11) <= 7) +#define QPT_QUERY_NODE_COL 10000 + +typedef enum { + QPT_NODE_COLUMN, + QPT_NODE_EXPR, + QPT_NODE_FUNCTION, + QPT_NODE_VALUE, + QPT_NODE_MAX_VALUE +} QPT_NODE_TYPE; + +typedef SNode* (*planBuildFunc)(int32_t); -#define QPT_CORRECT_HIGH_PROB() (qptCtx.param.correctExpected || QPT_HIGH_PROB()) -#define QPT_NCORRECT_LOW_PROB() (!qptCtx.param.correctExpected && QPT_LOW_PROB()) typedef struct { ENodeType type; @@ -130,6 +83,7 @@ typedef struct { uint64_t taskId; int32_t subplanMaxLevel; int32_t subplanType[QPT_MAX_SUBPLAN_LEVEL]; + int32_t subplanIdx[QPT_MAX_SUBPLAN_LEVEL]; int32_t physiNodeParamNum; SQPTNodeParam* physicNodeParam; } SQPTPlanParam; @@ -143,11 +97,13 @@ typedef struct { typedef struct { int32_t vnodeNum; int32_t vgId; + SEpSet epSet; } SQPTVnodeParam; typedef struct { - char name[TSDB_COL_NAME_LEN]; int32_t type; + char name[TSDB_COL_NAME_LEN]; + int32_t dtype; int32_t len; int8_t inUse; bool hasIndex; @@ -165,13 +121,15 @@ typedef struct { int16_t pkNum; char tblName[TSDB_TABLE_NAME_LEN]; char tblAlias[TSDB_TABLE_NAME_LEN]; - SQPTCol* pCol; - SQPTCol* pTag; + SNodeList* pColList; + SNodeList* pTagList; + SNodeList* pColTagList; } SQPTTblParam; typedef struct { bool correctExpected; + uint64_t schedulerId; SQPTPlanParam plan; SQPTDbParam db; SQPTVnodeParam vnode; @@ -186,13 +144,18 @@ typedef struct { SPhysiNode* pLeftChild; SPhysiNode* pRightChild; EOrder currTsOrder; + int16_t nextBlockId; + int32_t primaryTsSlotId; + SExecTaskInfo* pCurrTask; } SQPTBuildPlanCtx; typedef struct { int32_t nodeLevel; + bool fromTable; bool onlyTag; - int16_t nextBlockId; - SDataBlockDescNode* pInputDataBlockDesc; + bool onlyCol; + int16_t inputBlockId; + SNodeList* pInputList; } SQPTMakeNodeCtx; typedef struct { @@ -201,9 +164,11 @@ typedef struct { typedef struct { int32_t loopIdx; + char caseName[128]; SQPTParam param; SQPTBuildPlanCtx buildCtx; SQPTMakeNodeCtx makeCtx; + SQPTMakeNodeCtx makeCtxBak; SQPTExecResult result; int64_t startTsUs; } SQPTCtx; @@ -216,21 +181,182 @@ typedef struct { bool noKeepResRows; } SQPTCtrl; +typedef struct { + int32_t type; + char* name; + planBuildFunc buildFunc; +} SQPTPlan; + +SNode* qptCreateTagScanPhysiNode(int32_t nodeType); +SNode* qptCreateTableScanPhysiNode(int32_t nodeType); +SNode* qptCreateTableSeqScanPhysiNode(int32_t nodeType); +SNode* qptCreateTableMergeScanPhysiNode(int32_t nodeType); +SNode* qptCreateStreamScanPhysiNode(int32_t nodeType); +SNode* qptCreateSysTableScanPhysiNode(int32_t nodeType); +SNode* qptCreateBlockDistScanPhysiNode(int32_t nodeType); +SNode* qptCreateLastRowScanPhysiNode(int32_t nodeType); +SNode* qptCreateProjectPhysiNode(int32_t nodeType); +SNode* qptCreateMergeJoinPhysiNode(int32_t nodeType); +SNode* qptCreateHashAggPhysiNode(int32_t nodeType); +SNode* qptCreateExchangePhysiNode(int32_t nodeType); +SNode* qptCreateMergePhysiNode(int32_t nodeType); +SNode* qptCreateSortPhysiNode(int32_t nodeType); +SNode* qptCreateGroupSortPhysiNode(int32_t nodeType); +SNode* qptCreateIntervalPhysiNode(int32_t nodeType); +SNode* qptCreateMergeIntervalPhysiNode(int32_t nodeType); +SNode* qptCreateMergeAlignedIntervalPhysiNode(int32_t nodeType); +SNode* qptCreateStreamIntervalPhysiNode(int32_t nodeType); +SNode* qptCreateStreamFinalIntervalPhysiNode(int32_t nodeType); +SNode* qptCreateStreamSemiIntervalPhysiNode(int32_t nodeType); +SNode* qptCreateFillPhysiNode(int32_t nodeType); +SNode* qptCreateStreamFillPhysiNode(int32_t nodeType); +SNode* qptCreateSessionPhysiNode(int32_t nodeType); +SNode* qptCreateStreamSessionPhysiNode(int32_t nodeType); +SNode* qptCreateStreamSemiSessionPhysiNode(int32_t nodeType); +SNode* qptCreateStreamFinalSessionPhysiNode(int32_t nodeType); +SNode* qptCreateStateWindowPhysiNode(int32_t nodeType); +SNode* qptCreateStreamStatePhysiNode(int32_t nodeType); +SNode* qptCreatePartitionPhysiNode(int32_t nodeType); +SNode* qptCreateStreamPartitionPhysiNode(int32_t nodeType); + +SQPTPlan qptPlans[] = { + {QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN, "tagScan", qptCreateTagScanPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN, "tableScan", qptCreateTableScanPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_TABLE_SEQ_SCAN, "tableSeqScan", qptCreateTableSeqScanPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_TABLE_MERGE_SCAN, "tableMergeScan", qptCreateTableMergeScanPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN, "streamScan", qptCreateStreamScanPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_SYSTABLE_SCAN, "sysTableScan", qptCreateSysTableScanPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_BLOCK_DIST_SCAN, "blockDistScan", qptCreateBlockDistScanPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_LAST_ROW_SCAN, "lastRowScan", qptCreateLastRowScanPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_PROJECT, "project", qptCreateProjectPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_MERGE_JOIN, "mergeJoin", qptCreateMergeJoinPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_HASH_AGG, "hashAgg", qptCreateHashAggPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_EXCHANGE, "exchange", qptCreateExchangePhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_MERGE, "merge", qptCreateMergePhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_SORT, "sort", qptCreateSortPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_GROUP_SORT, "groupSort", qptCreateGroupSortPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_HASH_INTERVAL, "interval", qptCreateIntervalPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_MERGE_INTERVAL, "mergeInterval", qptCreateMergeIntervalPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_MERGE_ALIGNED_INTERVAL, "mergeAlignedInterval", qptCreateMergeAlignedIntervalPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL, "streamInterval", qptCreateStreamIntervalPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL, "streamFinalInterval", qptCreateStreamFinalIntervalPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL, "streamSemiInterval", qptCreateStreamSemiIntervalPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_FILL, "fill", qptCreateFillPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_STREAM_FILL, "streamFill", qptCreateStreamFillPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_MERGE_SESSION, "sessionWindow", qptCreateSessionPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_STREAM_SESSION, "streamSession", qptCreateStreamSessionPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_SESSION, "streamSemiSession", qptCreateStreamSemiSessionPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_SESSION, "streamFinalSession", qptCreateStreamFinalSessionPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_MERGE_STATE, "stateWindow", qptCreateStateWindowPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_STREAM_STATE, "streamState", qptCreateStreamStatePhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_PARTITION, "partition", qptCreatePartitionPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_STREAM_PARTITION, "streamPartition", qptCreateStreamPartitionPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_INDEF_ROWS_FUNC, "", NULL}, + {QUERY_NODE_PHYSICAL_PLAN_INTERP_FUNC, "", NULL}, + {QUERY_NODE_PHYSICAL_PLAN_DISPATCH, "", NULL}, + {QUERY_NODE_PHYSICAL_PLAN_INSERT, "", NULL}, + {QUERY_NODE_PHYSICAL_PLAN_QUERY_INSERT, "", NULL}, + {QUERY_NODE_PHYSICAL_PLAN_DELETE, "", NULL}, + {QUERY_NODE_PHYSICAL_SUBPLAN, "", NULL}, + {QUERY_NODE_PHYSICAL_PLAN, "", NULL}, + {QUERY_NODE_PHYSICAL_PLAN_TABLE_COUNT_SCAN, "", NULL}, + {QUERY_NODE_PHYSICAL_PLAN_MERGE_EVENT, "", NULL}, + {QUERY_NODE_PHYSICAL_PLAN_STREAM_EVENT, "", NULL}, + {QUERY_NODE_PHYSICAL_PLAN_HASH_JOIN, "", NULL}, + {QUERY_NODE_PHYSICAL_PLAN_GROUP_CACHE, "", NULL}, + {QUERY_NODE_PHYSICAL_PLAN_DYN_QUERY_CTRL, "", NULL}, + {QUERY_NODE_PHYSICAL_PLAN_MERGE_COUNT, "", NULL}, + {QUERY_NODE_PHYSICAL_PLAN_STREAM_COUNT, "", NULL}, + {QUERY_NODE_PHYSICAL_PLAN_STREAM_MID_INTERVAL, "", NULL} +}; + + +#define QPT_PHYSIC_NODE_NUM() (sizeof(qptPlans)/sizeof(qptPlans[0])) +#define QPT_RAND_BOOL_V ((taosRand() % 2) ? true : false) +#define QPT_RAND_ORDER_V (QPT_RAND_BOOL_V ? ORDER_ASC : ORDER_DESC) +#define QPT_RAND_INT_V (taosRand() * (QPT_RAND_BOOL_V ? 1 : -1)) +#define QPT_LOW_PROB() ((taosRand() % 11) == 0) +#define QPT_MID_PROB() ((taosRand() % 11) <= 1) +#define QPT_HIGH_PROB() ((taosRand() % 11) <= 7) + +#define QPT_CORRECT_HIGH_PROB() (qptCtx.param.correctExpected || QPT_HIGH_PROB()) +#define QPT_NCORRECT_LOW_PROB() (!qptCtx.param.correctExpected && QPT_LOW_PROB()) + + SQPTCtx qptCtx = {0}; SQPTCtrl qptCtrl = {1, 0, 0, 0, 0}; bool qptErrorRerun = false; bool qptInRerun = false; + SNode* qptMakeExprNode(SNode** ppNode); +void qptMakeNodeList(QPT_NODE_TYPE nodeType, SNodeList** ppList); + + +int32_t qptGetColumnRandLen(int32_t colType) { + switch (colType) { + case TSDB_DATA_TYPE_NULL: + case TSDB_DATA_TYPE_BOOL: + case TSDB_DATA_TYPE_TINYINT: + case TSDB_DATA_TYPE_SMALLINT: + case TSDB_DATA_TYPE_INT: + case TSDB_DATA_TYPE_BIGINT: + case TSDB_DATA_TYPE_TIMESTAMP: + case TSDB_DATA_TYPE_FLOAT: + case TSDB_DATA_TYPE_DOUBLE: + case TSDB_DATA_TYPE_UTINYINT: + case TSDB_DATA_TYPE_USMALLINT: + case TSDB_DATA_TYPE_UINT: + case TSDB_DATA_TYPE_UBIGINT: + return tDataTypes[colType].bytes; + case TSDB_DATA_TYPE_VARCHAR: + case TSDB_DATA_TYPE_GEOMETRY: + case TSDB_DATA_TYPE_JSON: + case TSDB_DATA_TYPE_VARBINARY: + case TSDB_DATA_TYPE_DECIMAL: + case TSDB_DATA_TYPE_BLOB: + case TSDB_DATA_TYPE_MEDIUMBLOB: + case TSDB_DATA_TYPE_NCHAR: + return taosRand() % TSDB_MAX_BINARY_LEN; + default: + assert(0); + break; + } +} + + +void qptInitSingleTableCol(SQPTCol* pCol, int32_t idx, EColumnType colType) { + if (COLUMN_TYPE_COLUMN == colType && 0 == idx) { + sprintf(pCol->name, "primts%d", idx); + pCol->dtype = TSDB_DATA_TYPE_TIMESTAMP; + pCol->len = qptGetColumnRandLen(pCol->dtype); + pCol->inUse = 0; + pCol->hasIndex = false; + pCol->isPrimTs = true; + pCol->isPk = false; + pCol->colType = colType; + + return; + } + + sprintf(pCol->name, "%s%d", COLUMN_TYPE_COLUMN == colType ? "col" : "tag", idx); + pCol->dtype = taosRand() % TSDB_DATA_TYPE_MAX; + pCol->len = qptGetColumnRandLen(pCol->dtype); + pCol->inUse = 0; + pCol->hasIndex = COLUMN_TYPE_COLUMN == colType ? false : QPT_RAND_BOOL_V; + pCol->isPrimTs = false; + pCol->isPk = COLUMN_TYPE_COLUMN == colType ? QPT_RAND_BOOL_V : false;; + pCol->colType = colType; +} -void qptPrintBeginInfo(char* caseName) { +void qptPrintBeginInfo() { if (!qptCtrl.printTestInfo) { return; } - printf("\n%dth TEST [%s] START\n", qptCtx.loopIdx, caseName); + printf("\n%dth TEST [%s] START\n", qptCtx.loopIdx, qptCtx.caseName); /* char inputStat[4] = {0}; @@ -287,17 +413,17 @@ void qptPrintBeginInfo(char* caseName) { */ } -void qptPrintEndInfo(char* caseName) { +void qptPrintEndInfo() { if (!qptCtrl.printTestInfo) { return; } - printf("\n\t%dth TEST [%s] END, result - %s%s\n", qptCtx.loopIdx, caseName, + printf("\n\t%dth TEST [%s] END, result - %s%s\n", qptCtx.loopIdx, qptCtx.caseName, (0 == qptCtx.result.code) ? "succeed" : "failed with error:", (0 == qptCtx.result.code) ? "" : tstrerror(qptCtx.result.code)); } -void qptPrintStatInfo(char* caseName) { +void qptPrintStatInfo() { } @@ -318,8 +444,8 @@ EOrder qptGetCurrTsOrder() { return QPT_CORRECT_HIGH_PROB() ? qptCtx.buildCtx.currTsOrder : QPT_RAND_ORDER_V; } -void qptGetRandValue(int16_t* pType, int32_t* pLen, void** ppVal) { - if (*pType < 0 || QPT_NCORRECT_LOW_PROB()) { +void qptGetRandValue(uint8_t* pType, int32_t* pLen, void** ppVal) { + if (*pType == (uint8_t)-1 || QPT_NCORRECT_LOW_PROB()) { int32_t typeMax = TSDB_DATA_TYPE_MAX; if (QPT_NCORRECT_LOW_PROB()) { typeMax++; @@ -521,6 +647,28 @@ int32_t qptGetInputSlotId(SDataBlockDescNode* pInput) { return taosRand(); } +ENullOrder qptGetRandNullOrder() { + if (QPT_NCORRECT_LOW_PROB()) { + return (ENullOrder)taosRand(); + } + + return (ENullOrder)(taosRand() % NULL_ORDER_LAST + 1); +} + +int8_t qptGetRandTimestampUnit() { + static int8_t units[] = {TIME_UNIT_NANOSECOND, TIME_UNIT_MICROSECOND, TIME_UNIT_MILLISECOND, TIME_UNIT_SECOND, + TIME_UNIT_MINUTE, TIME_UNIT_HOUR, TIME_UNIT_DAY, TIME_UNIT_WEEK, TIME_UNIT_MONTH, TIME_UNIT_YEAR}; + + return units[taosRand() % (sizeof(units) / sizeof(units[0]))]; +} + +int32_t qptGetInputPrimaryTsSlotId() { + if (QPT_CORRECT_HIGH_PROB()) { + return qptCtx.buildCtx.primaryTsSlotId; + } + + return taosRand() % QPT_MAX_COLUMN_NUM; +} void qptNodesCalloc(int32_t num, int32_t size, void** pOut) { void* p = taosMemoryCalloc(num, size); @@ -529,6 +677,32 @@ void qptNodesCalloc(int32_t num, int32_t size, void** pOut) { *pOut = (char*)p + 1; } +void qptNodesFree(void* pNode) { + void* p = (char*)pNode - 1; + taosMemoryFree(p); +} + +EFillMode qptGetRandFillMode() { + if (QPT_CORRECT_HIGH_PROB()) { + return (EFillMode)(taosRand() % FILL_MODE_NEXT + 1); + } + + return (EFillMode)(taosRand()); +} + + +void qptGetRandTimeWindow(STimeWindow* pWindow) { + if (QPT_CORRECT_HIGH_PROB()) { + pWindow->skey = taosRand(); + pWindow->ekey = pWindow->skey + taosRand(); + return; + } + + pWindow->skey = taosRand(); + pWindow->ekey = taosRand(); +} + + int32_t qptNodesListAppend(SNodeList* pList, SNode* pNode) { SListCell* p = NULL; qptNodesCalloc(1, sizeof(SListCell), (void**)&p); @@ -546,7 +720,6 @@ int32_t qptNodesListAppend(SNodeList* pList, SNode* pNode) { return TSDB_CODE_SUCCESS; } - int32_t qptNodesListStrictAppend(SNodeList* pList, SNode* pNode) { int32_t code = qptNodesListAppend(pList, pNode); if (TSDB_CODE_SUCCESS != code) { @@ -565,56 +738,19 @@ int32_t qptNodesListMakeStrictAppend(SNodeList** pList, SNode* pNode) { return qptNodesListStrictAppend(*pList, pNode); } - -SNode* qptMakeLimitNode() { +SNode* qptMakeRandNode(SNode** ppNode) { SNode* pNode = NULL; - if (QPT_NCORRECT_LOW_PROB()) { - return qptMakeRandNode(&pNode); - } - - assert(0 == nodesMakeNode(QUERY_NODE_LIMIT, &pNode)); - assert(pNode); - - SLimitNode* pLimit = (SLimitNode*)pNode; - - if (!qptCtx.param.correctExpected) { - if (taosRand() % 2) { - pLimit->limit = taosRand() * ((taosRand() % 2) ? 1 : -1); - } - if (taosRand() % 2) { - pLimit->offset = taosRand() * ((taosRand() % 2) ? 1 : -1); - } - } else { - pLimit->limit = taosRand(); - if (taosRand() % 2) { - pLimit->offset = taosRand(); - } - } - - return pNode; + nodesMakeNode((ENodeType)taosRand(), ppNode ? ppNode : &pNode); + return ppNode ? *ppNode : pNode; } -SNode* qptMakeWindowOffsetNode(SNode** ppNode) { - if (QPT_RAND_BOOL_V) { - return qptMakeRandNode(ppNode); - } - - SNode* pNode = NULL; - SWindowOffsetNode* pWinOffset = NULL; - - assert(0 == nodesMakeNode(QUERY_NODE_WINDOW_OFFSET, &pNode)); - assert(pNode); - - SWindowOffsetNode* pWinOffset = (SWindowOffsetNode*)pNode; - qptMakeValueNode(TSDB_DATA_TYPE_BIGINT, &pWinOffset->pStartOffset); - qptMakeValueNode(TSDB_DATA_TYPE_BIGINT, &pWinOffset->pEndOffset); - - return pNode; -} +SNode* qptMakeColumnFromTable(int32_t colIdx) { + if (QPT_NCORRECT_LOW_PROB()) { + return qptMakeRandNode(NULL); + } -SNode* qptMakeColumnNodeFromTable(int32_t colIdx, EColumnType colType, SScanPhysiNode* pScanPhysiNode) { if (colIdx < 0) { return NULL; } @@ -623,26 +759,34 @@ SNode* qptMakeColumnNodeFromTable(int32_t colIdx, EColumnType colType, SScanPhys assert(0 == nodesMakeNode(QUERY_NODE_COLUMN, (SNode**)&pCol)); assert(pCol); + SQPTCol fakeCol; + fakeCol.type = QPT_QUERY_NODE_COL; + qptInitSingleTableCol(&fakeCol, taosRand(), (EColumnType)(taosRand() % COLUMN_TYPE_GROUP_KEY + 1)); + + SQPTCol* pTbCol = qptCtx.makeCtx.pInputList ? (SQPTCol*)nodesListGetNode(qptCtx.makeCtx.pInputList, colIdx) : &fakeCol; + + int16_t blkId = QPT_CORRECT_HIGH_PROB() ? qptCtx.makeCtx.inputBlockId : taosRand(); + if (QPT_CORRECT_HIGH_PROB()) { - pCol->node.resType.type = qptCtx.param.tbl.pCol[colIdx].type; - pCol->node.resType.bytes = qptCtx.param.tbl.pCol[colIdx].len; + pCol->node.resType.type = pTbCol->dtype; + pCol->node.resType.bytes = pTbCol->len; pCol->tableId = qptCtx.param.tbl.uid; pCol->tableType = qptCtx.param.tbl.tblType; pCol->colId = colIdx; pCol->projIdx = colIdx; - pCol->colType = qptCtx.param.tbl.pCol[colIdx].colType; - pCol->hasIndex = qptCtx.param.tbl.pCol[colIdx].hasIndex; - pCol->isPrimTs = qptCtx.param.tbl.pCol[colIdx].isPrimTs; + pCol->colType = pTbCol->colType; + pCol->hasIndex = pTbCol->hasIndex; + pCol->isPrimTs = pTbCol->isPrimTs; strcpy(pCol->dbName, qptCtx.param.db.dbName); strcpy(pCol->tableName, qptCtx.param.tbl.tblName); strcpy(pCol->tableAlias, qptCtx.param.tbl.tblAlias); - strcpy(pCol->colName, qptCtx.param.tbl.pCol[colIdx].name); - pCol->dataBlockId = pScanPhysiNode->node.pOutputDataBlockDesc ? pScanPhysiNode->node.pOutputDataBlockDesc->dataBlockId : taosRand(); + strcpy(pCol->colName, pTbCol->name); + pCol->dataBlockId = blkId; pCol->slotId = colIdx; pCol->numOfPKs = qptCtx.param.tbl.pkNum; pCol->tableHasPk = qptCtx.param.tbl.pkNum > 0; - pCol->isPk = qptCtx.param.tbl.pCol[colIdx].isPk; + pCol->isPk = pTbCol->isPk; pCol->projRefIdx = 0; pCol->resIdx = 0; } else { @@ -652,7 +796,7 @@ SNode* qptMakeColumnNodeFromTable(int32_t colIdx, EColumnType colType, SScanPhys pCol->tableType = taosRand() % TSDB_TABLE_MAX; pCol->colId = QPT_RAND_BOOL_V ? taosRand() : colIdx; pCol->projIdx = taosRand(); - pCol->colType = QPT_RAND_BOOL_V ? qptCtx.param.tbl.pCol[colIdx].colType : (EColumnType)(taosRand() % (COLUMN_TYPE_GROUP_KEY + 1)); + pCol->colType = QPT_RAND_BOOL_V ? pTbCol->colType : (EColumnType)(taosRand() % (COLUMN_TYPE_GROUP_KEY + 1)); pCol->hasIndex = QPT_RAND_BOOL_V; pCol->isPrimTs = QPT_RAND_BOOL_V; if (QPT_RAND_BOOL_V) { @@ -673,14 +817,14 @@ SNode* qptMakeColumnNodeFromTable(int32_t colIdx, EColumnType colType, SScanPhys if (QPT_RAND_BOOL_V) { pCol->colName[0] = 0; } else { - strcpy(pCol->colName, qptCtx.param.tbl.pCol[colIdx].name); + strcpy(pCol->colName, pTbCol->name); } - pCol->dataBlockId = (QPT_RAND_BOOL_V && pScanPhysiNode->node.pOutputDataBlockDesc) ? pScanPhysiNode->node.pOutputDataBlockDesc->dataBlockId : taosRand(); + pCol->dataBlockId = blkId; pCol->slotId = QPT_RAND_BOOL_V ? taosRand() : colIdx; pCol->numOfPKs = QPT_RAND_BOOL_V ? taosRand() : qptCtx.param.tbl.pkNum; pCol->tableHasPk = QPT_RAND_BOOL_V ? QPT_RAND_BOOL_V : (qptCtx.param.tbl.pkNum > 0); - pCol->isPk = QPT_RAND_BOOL_V ? QPT_RAND_BOOL_V : qptCtx.param.tbl.pCol[colIdx].isPk; + pCol->isPk = QPT_RAND_BOOL_V ? QPT_RAND_BOOL_V : pTbCol->isPk; pCol->projRefIdx = taosRand(); pCol->resIdx = taosRand(); } @@ -689,8 +833,8 @@ SNode* qptMakeColumnNodeFromTable(int32_t colIdx, EColumnType colType, SScanPhys } -void qptMakeWhenThenNode(SNode** ppNode) { - if (QPT_NCORRECT_LOW_PROB) { +SNode* qptMakeWhenThenNode(SNode** ppNode) { + if (QPT_NCORRECT_LOW_PROB()) { return qptMakeRandNode(ppNode); } @@ -701,11 +845,13 @@ void qptMakeWhenThenNode(SNode** ppNode) { qptMakeExprNode(&pWhenThen->pWhen); qptMakeExprNode(&pWhenThen->pThen); + + return *ppNode; } -void qptMakeCaseWhenNode(SNode** ppNode) { - if (QPT_NCORRECT_LOW_PROB) { +SNode* qptMakeCaseWhenNode(SNode** ppNode) { + if (QPT_NCORRECT_LOW_PROB()) { return qptMakeRandNode(ppNode); } @@ -730,11 +876,13 @@ void qptMakeCaseWhenNode(SNode** ppNode) { qptMakeWhenThenNode(&pNode); qptNodesListMakeStrictAppend(&pCaseWhen->pWhenThenList, pNode); } + + return *ppNode; } -void qptMakeOperatorNode(SNode** ppNode) { - if (QPT_NCORRECT_LOW_PROB) { +SNode* qptMakeOperatorNode(SNode** ppNode) { + if (QPT_NCORRECT_LOW_PROB()) { return qptMakeRandNode(ppNode); } @@ -811,36 +959,51 @@ void qptMakeOperatorNode(SNode** ppNode) { } break; } + + return *ppNode; } -void qptMakeColumnNode(SNode** ppNode) { - if (QPT_NCORRECT_LOW_PROB) { +SNode* qptMakeColumnNode(SNode** ppNode) { + if (QPT_NCORRECT_LOW_PROB()) { return qptMakeRandNode(ppNode); } SColumnNode* pCol = NULL; - nodesMakeNode(QUERY_NODE_COLUMN, (SNode**)&pCol); - SSlotDescNode* pSlot = NULL; - if (QPT_CORRECT_HIGH_PROB() && qptCtx.makeCtx.pInputDataBlockDesc && qptCtx.makeCtx.pInputDataBlockDesc->pSlots) { - SNodeList* pColList = qptCtx.makeCtx.pInputDataBlockDesc->pSlots; + if (QPT_CORRECT_HIGH_PROB() && qptCtx.makeCtx.pInputList) { + SNodeList* pColList = qptCtx.makeCtx.pInputList; int32_t colIdx = taosRand() % pColList->length; - SNode* pNode = nodesListGetNode(pColList, colIdx); - if (pNode && nodeType(pNode) == QUERY_NODE_SLOT_DESC) { - pSlot = (SSlotDescNode*)pNode; - pCol->node.resType = pSlot->dataType; - pCol->dataBlockId = qptCtx.makeCtx.pInputDataBlockDesc->dataBlockId; - pCol->slotId = pSlot->slotId; + SQPTCol* pNode = (SQPTCol*)nodesListGetNode(pColList, colIdx); + if (pNode) { + switch (pNode->type) { + case QUERY_NODE_SLOT_DESC: { + nodesMakeNode(QUERY_NODE_COLUMN, (SNode**)&pCol); + SSlotDescNode* pSlot = (SSlotDescNode*)pNode; + pCol->node.resType = pSlot->dataType; + pCol->dataBlockId = qptCtx.makeCtx.inputBlockId; + pCol->slotId = pSlot->slotId; + break; + } + case QPT_QUERY_NODE_COL: { + pCol = (SColumnNode*)qptMakeColumnFromTable(colIdx); + break; + } + default: + break; + } } } - if (NULL == pSlot) { + if (NULL == pCol) { + nodesMakeNode(QUERY_NODE_COLUMN, (SNode**)&pCol); qptGetRandValue(&pCol->node.resType.type, &pCol->node.resType.bytes, NULL); pCol->dataBlockId = taosRand(); pCol->slotId = taosRand(); } *ppNode = (SNode*)pCol; + + return *ppNode; } void qptNodesSetValueNodeValue(SValueNode* pNode, void* value) { @@ -933,8 +1096,8 @@ void qptNodesSetValueNodeValue(SValueNode* pNode, void* value) { } -void qptMakeValueNode(int16_t valType, SNode** ppNode) { - if (QPT_NCORRECT_LOW_PROB) { +SNode* qptMakeValueNode(uint8_t valType, SNode** ppNode) { + if (QPT_NCORRECT_LOW_PROB()) { return qptMakeRandNode(ppNode); } @@ -951,17 +1114,19 @@ void qptMakeValueNode(int16_t valType, SNode** ppNode) { qptNodesSetValueNodeValue(pVal, pValue); *ppNode = (SNode*)pVal; + + return *ppNode; } -void qptMakeFunctionNode(SNode** ppNode) { - if (QPT_NCORRECT_LOW_PROB) { +SNode* qptMakeFunctionNode(SNode** ppNode) { + if (QPT_NCORRECT_LOW_PROB()) { return qptMakeRandNode(ppNode); } SFunctionNode* pFunc = NULL; nodesMakeNode(QUERY_NODE_FUNCTION, (SNode**)&pFunc); - if (qptCtx.param.correctExpected || QPT_HIGH_PROB()) { + if (QPT_CORRECT_HIGH_PROB()) { int32_t funcIdx = taosRand() % funcMgtBuiltinsNum; char* funcName = fmGetFuncName(funcIdx); strcpy(pFunc->functionName, funcName); @@ -991,13 +1156,15 @@ void qptMakeFunctionNode(SNode** ppNode) { } *ppNode = (SNode*)pFunc; + + return *ppNode; } -void qptMakeLogicCondNode(SNode** ppNode) { - if (QPT_NCORRECT_LOW_PROB) { +SNode* qptMakeLogicCondNode(SNode** ppNode) { + if (QPT_NCORRECT_LOW_PROB()) { return qptMakeRandNode(ppNode); } @@ -1020,10 +1187,12 @@ void qptMakeLogicCondNode(SNode** ppNode) { } *ppNode = (SNode*)pLogic; + + return *ppNode; } -void qptMakeNodeListNode(SNode** ppNode) { - if (QPT_NCORRECT_LOW_PROB) { +SNode* qptMakeNodeListNode(QPT_NODE_TYPE nodeType, SNode** ppNode) { + if (QPT_NCORRECT_LOW_PROB()) { return qptMakeRandNode(ppNode); } @@ -1031,19 +1200,16 @@ void qptMakeNodeListNode(SNode** ppNode) { nodesMakeNode(QUERY_NODE_NODE_LIST, (SNode**)&pList); qptCtx.makeCtx.nodeLevel++; - - int32_t nodeNum = QPT_CORRECT_HIGH_PROB() ? (taosRand() % QPT_MAX_NODE_LIST_NUM + 1) : (taosRand() % QPT_MAX_NODE_LIST_NUM); - for (int32_t i = 0; i < nodeNum; ++i) { - SNode* pNode = NULL; - qptMakeExprNode(&pNode); - qptNodesListMakeStrictAppend(&pList->pNodeList, pNode); - } + + qptMakeNodeList(nodeType, &pList->pNodeList); *ppNode = (SNode*)pList; + + return *ppNode; } -void qptMakeTempTableNode(SNode** ppNode) { - if (QPT_NCORRECT_LOW_PROB) { +SNode* qptMakeTempTableNode(SNode** ppNode) { + if (QPT_NCORRECT_LOW_PROB()) { return qptMakeRandNode(ppNode); } @@ -1055,10 +1221,12 @@ void qptMakeTempTableNode(SNode** ppNode) { } *ppNode = (SNode*)pTemp; + + return *ppNode; } -void qptMakeJoinTableNode(SNode** ppNode) { - if (QPT_NCORRECT_LOW_PROB) { +SNode* qptMakeJoinTableNode(SNode** ppNode) { + if (QPT_NCORRECT_LOW_PROB()) { return qptMakeRandNode(ppNode); } @@ -1070,10 +1238,12 @@ void qptMakeJoinTableNode(SNode** ppNode) { } *ppNode = (SNode*)pJoin; + + return *ppNode; } -void qptMakeRealTableNode(SNode** ppNode) { - if (QPT_NCORRECT_LOW_PROB) { +SNode* qptMakeRealTableNode(SNode** ppNode) { + if (QPT_NCORRECT_LOW_PROB()) { return qptMakeRandNode(ppNode); } @@ -1085,12 +1255,14 @@ void qptMakeRealTableNode(SNode** ppNode) { } *ppNode = (SNode*)pReal; + + return *ppNode; } -void qptMakeNonRealTableNode(SNode** ppNode) { - if (QPT_NCORRECT_LOW_PROB) { +SNode* qptMakeNonRealTableNode(SNode** ppNode) { + if (QPT_NCORRECT_LOW_PROB()) { return qptMakeRandNode(ppNode); } @@ -1103,12 +1275,8 @@ void qptMakeNonRealTableNode(SNode** ppNode) { } else { qptMakeRealTableNode(ppNode); } -} -SNode* qptMakeRandNode(SNode** ppNode) { - SNode* pNode = NULL; - nodesMakeNode((ENodeType)taosRand(), ppNode ? ppNode : &pNode); - return ppNode ? *ppNode : pNode; + return *ppNode; } SNode* qptMakeExprNode(SNode** ppNode) { @@ -1140,7 +1308,7 @@ SNode* qptMakeExprNode(SNode** ppNode) { qptMakeLogicCondNode(ppNode); break; case 4: - qptMakeNodeListNode(ppNode); + qptMakeNodeListNode(QPT_NODE_EXPR, ppNode); break; case 5: qptMakeOperatorNode(ppNode); @@ -1163,59 +1331,152 @@ SNode* qptMakeExprNode(SNode** ppNode) { } -void qptResetMakeNodeCtx(SDataBlockDescNode* pInput, bool onlyTag) { - SQPTMakeNodeCtx* pCtx = &qptCtx.makeCtx; - - pCtx->nodeLevel = 1; - pCtx->onlyTag = onlyTag; - pCtx->pInputDataBlockDesc = pInput; -} - -SNode* qptMakeConditionNode(bool onlyTag) { +SNode* qptMakeLimitNode(SNode** ppNode) { SNode* pNode = NULL; - qptResetMakeNodeCtx(qptCtx.buildCtx.pCurr->pOutputDataBlockDesc, onlyTag); - qptMakeExprNode(&pNode); + if (QPT_NCORRECT_LOW_PROB()) { + return qptMakeRandNode(&pNode); + } + assert(0 == nodesMakeNode(QUERY_NODE_LIMIT, &pNode)); + assert(pNode); + + SLimitNode* pLimit = (SLimitNode*)pNode; + + if (!qptCtx.param.correctExpected) { + if (taosRand() % 2) { + pLimit->limit = taosRand() * ((taosRand() % 2) ? 1 : -1); + } + if (taosRand() % 2) { + pLimit->offset = taosRand() * ((taosRand() % 2) ? 1 : -1); + } + } else { + pLimit->limit = taosRand(); + if (taosRand() % 2) { + pLimit->offset = taosRand(); + } + } + + *ppNode = pNode; + return pNode; } -SNode* qptMakeDataBlockDescNode() { + +SNode* qptMakeWindowOffsetNode(SNode** ppNode) { if (QPT_NCORRECT_LOW_PROB()) { - return NULL; + return qptMakeRandNode(ppNode); } - SDataBlockDescNode* pDesc = NULL; - assert(0 == nodesMakeNode(QUERY_NODE_DATABLOCK_DESC, (SNode**)&pDesc)); + SNode* pNode = NULL; + assert(0 == nodesMakeNode(QUERY_NODE_WINDOW_OFFSET, &pNode)); + assert(pNode); + + SWindowOffsetNode* pWinOffset = (SWindowOffsetNode*)pNode; + qptMakeValueNode(TSDB_DATA_TYPE_BIGINT, &pWinOffset->pStartOffset); + qptMakeValueNode(TSDB_DATA_TYPE_BIGINT, &pWinOffset->pEndOffset); + + *ppNode = pNode; - pDesc->dataBlockId = qptCtx.param.correctExpected ? qptCtx.makeCtx.nextBlockId++ : QPT_RAND_INT_V; - pDesc->precision = qptCtx.param.correctExpected ? qptCtx.param.db.precision : QPT_RAND_INT_V; + return pNode; +} - return (SNode*)pDesc; +void qptSaveMakeNodeCtx() { + qptCtx.makeCtxBak.nodeLevel = qptCtx.makeCtx.nodeLevel; } -SNode* qptMakeSlotDescNode(const char* pName, const SNode* pNode, int16_t slotId, bool output, bool reserve) { - SSlotDescNode* pSlot = NULL; - if (QPT_NCORRECT_LOW_PROB) { - return qptMakeRandNode((SNode**)&pSlot); - } +void qptRestoreMakeNodeCtx() { + qptCtx.makeCtx.nodeLevel = qptCtx.makeCtxBak.nodeLevel; +} - assert(0 == nodesMakeNode(QUERY_NODE_SLOT_DESC, (SNode**)&pSlot)); - - QPT_RAND_BOOL_V ? (pSlot->name[0] = 0) : snprintf(pSlot->name, sizeof(pSlot->name), "%s", pName); - pSlot->slotId = QPT_CORRECT_HIGH_PROB() ? slotId : taosRand(); - if (QPT_CORRECT_HIGH_PROB()) { - pSlot->dataType = ((SExprNode*)pNode)->resType; - } else { - qptGetRandValue(&pSlot->dataType.type, &pSlot->dataType.bytes, NULL); + +void qptResetTableCols() { + SNode* pTmp = NULL; + FOREACH(pTmp, qptCtx.param.tbl.pColList) { + ((SQPTCol*)pTmp)->inUse = 0; + } + FOREACH(pTmp, qptCtx.param.tbl.pTagList) { + ((SQPTCol*)pTmp)->inUse = 0; + } +} + +void qptResetMakeNodeCtx() { + SQPTMakeNodeCtx* pCtx = &qptCtx.makeCtx; + pCtx->nodeLevel = 1; + + if (pCtx->fromTable) { + qptResetTableCols(); + } +} + +void qptInitMakeNodeCtx(bool fromTable, bool onlyTag, bool onlyCol, int16_t inputBlockId, SNodeList* pInputList) { + SQPTMakeNodeCtx* pCtx = &qptCtx.makeCtx; + + pCtx->onlyTag = onlyTag; + pCtx->fromTable = fromTable; + pCtx->onlyCol = onlyCol; + + if (NULL == pInputList) { + if (fromTable) { + inputBlockId = (qptCtx.buildCtx.pCurr && qptCtx.buildCtx.pCurr->pOutputDataBlockDesc) ? qptCtx.buildCtx.pCurr->pOutputDataBlockDesc->dataBlockId : taosRand(); + pInputList = onlyTag ? qptCtx.param.tbl.pTagList : (onlyCol ? qptCtx.param.tbl.pColList : qptCtx.param.tbl.pColTagList); + } else if (qptCtx.buildCtx.pChild && qptCtx.buildCtx.pChild->pOutputDataBlockDesc) { + inputBlockId = qptCtx.buildCtx.pChild->pOutputDataBlockDesc->dataBlockId; + pInputList = qptCtx.buildCtx.pChild->pOutputDataBlockDesc->pSlots; + } + } + + pCtx->inputBlockId = inputBlockId; + pCtx->pInputList = pInputList; + + qptResetMakeNodeCtx(); +} + +SNode* qptMakeConditionNode() { + SNode* pNode = NULL; + qptMakeExprNode(&pNode); + + return pNode; +} + +SNode* qptMakeDataBlockDescNode() { + if (QPT_NCORRECT_LOW_PROB()) { + return qptMakeRandNode(NULL); + } + + SDataBlockDescNode* pDesc = NULL; + assert(0 == nodesMakeNode(QUERY_NODE_DATABLOCK_DESC, (SNode**)&pDesc)); + + pDesc->dataBlockId = QPT_CORRECT_HIGH_PROB() ? qptCtx.buildCtx.nextBlockId++ : QPT_RAND_INT_V; + pDesc->precision = QPT_CORRECT_HIGH_PROB() ? qptCtx.param.db.precision : QPT_RAND_INT_V; + + return (SNode*)pDesc; +} + +SNode* qptMakeSlotDescNode(const char* pName, const SNode* pNode, int16_t slotId, bool output, bool reserve) { + SSlotDescNode* pSlot = NULL; + if (QPT_NCORRECT_LOW_PROB()) { + return qptMakeRandNode((SNode**)&pSlot); + } + + assert(0 == nodesMakeNode(QUERY_NODE_SLOT_DESC, (SNode**)&pSlot)); + + QPT_RAND_BOOL_V ? (pSlot->name[0] = 0) : snprintf(pSlot->name, sizeof(pSlot->name), "%s", pName); + pSlot->slotId = QPT_CORRECT_HIGH_PROB() ? slotId : taosRand(); + if (QPT_CORRECT_HIGH_PROB()) { + pSlot->dataType = ((SExprNode*)pNode)->resType; + } else { + qptGetRandValue(&pSlot->dataType.type, &pSlot->dataType.bytes, NULL); } pSlot->reserve = reserve; pSlot->output = output; + return (SNode*)pSlot; } -void qptMakeTargetNode(SNode* pNode, int16_t dataBlockId, int16_t slotId, SNode** pOutput) { - if (QPT_NCORRECT_LOW_PROB) { +SNode* qptMakeTargetNode(SNode* pNode, int16_t dataBlockId, int16_t slotId, SNode** pOutput) { + if (QPT_NCORRECT_LOW_PROB()) { + nodesDestroyNode(pNode); return qptMakeRandNode(pOutput); } @@ -1225,18 +1486,64 @@ void qptMakeTargetNode(SNode* pNode, int16_t dataBlockId, int16_t slotId, SNode* pTarget->dataBlockId = QPT_CORRECT_HIGH_PROB() ? dataBlockId : taosRand(); pTarget->slotId = QPT_CORRECT_HIGH_PROB() ? slotId : taosRand(); pTarget->pExpr = QPT_CORRECT_HIGH_PROB() ? pNode : qptMakeRandNode(NULL); - + if (pTarget->pExpr != pNode) { + nodesDestroyNode(pNode); + } + *pOutput = (SNode*)pTarget; + + return *pOutput; +} + +SNode* qptMakeDownstreamSrcNode(SNode** ppNode) { + if (QPT_NCORRECT_LOW_PROB()) { + return qptMakeRandNode(ppNode); + } + + SDownstreamSourceNode* pDs = NULL; + nodesMakeNode(QUERY_NODE_DOWNSTREAM_SOURCE, (SNode**)&pDs); + + pDs->addr.nodeId = qptCtx.param.vnode.vgId; + memcpy(&pDs->addr.epSet, &qptCtx.param.vnode.epSet, sizeof(pDs->addr.epSet)); + pDs->taskId = (QPT_CORRECT_HIGH_PROB() && qptCtx.buildCtx.pCurrTask) ? qptCtx.buildCtx.pCurrTask->id.taskId : taosRand(); + pDs->schedId = QPT_CORRECT_HIGH_PROB() ? qptCtx.param.schedulerId : taosRand(); + pDs->execId = taosRand(); + pDs->fetchMsgType = QPT_CORRECT_HIGH_PROB() ? (QPT_RAND_BOOL_V ? TDMT_SCH_FETCH : TDMT_SCH_MERGE_FETCH) : taosRand(); + pDs->localExec = QPT_RAND_BOOL_V; + + *ppNode = (SNode*)pDs; + + return *ppNode; +} + +SNode* qptMakeOrderByExprNode(SNode** ppNode) { + if (QPT_NCORRECT_LOW_PROB()) { + return qptMakeRandNode(ppNode); + } + + SOrderByExprNode* pOrder = NULL; + nodesMakeNode(QUERY_NODE_ORDER_BY_EXPR, (SNode**)&pOrder); + + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? false : true, QPT_RAND_BOOL_V, QPT_RAND_BOOL_V, 0, NULL); + qptMakeExprNode(&pOrder->pExpr); + + pOrder->order = (EOrder)(QPT_CORRECT_HIGH_PROB() ? (QPT_RAND_BOOL_V ? ORDER_ASC : ORDER_DESC) : taosRand()); + pOrder->nullOrder = qptGetRandNullOrder(); + + *ppNode = (SNode*)pOrder; + + return *ppNode; } SPhysiNode* qptCreatePhysiNode(int32_t nodeType) { SPhysiNode* pPhysiNode = NULL; assert(0 == nodesMakeNode((ENodeType)nodeType, (SNode**)&pPhysiNode)); - + assert(pPhysiNode); + qptCtx.buildCtx.pCurr = pPhysiNode; - pPhysiNode->pLimit = qptMakeLimitNode(); - pPhysiNode->pSlimit = qptMakeLimitNode(); + qptMakeLimitNode(&pPhysiNode->pLimit); + qptMakeLimitNode(&pPhysiNode->pSlimit); pPhysiNode->dynamicOp = qptGetDynamicOp(); pPhysiNode->inputTsOrder = qptGetCurrTsOrder(); @@ -1249,15 +1556,18 @@ void qptPostCreatePhysiNode(SPhysiNode* pPhysiNode) { pPhysiNode->outputTsOrder = qptGetCurrTsOrder(); if (QPT_RAND_BOOL_V) { - pPhysiNode->pConditions = qptMakeConditionNode(false); + qptInitMakeNodeCtx((QPT_CORRECT_HIGH_PROB() && qptCtx.buildCtx.pChild) ? false : true, QPT_RAND_BOOL_V, QPT_RAND_BOOL_V, 0, NULL); + pPhysiNode->pConditions = qptMakeConditionNode(); } } -void qptMarkTableInUseCols(int32_t colNum, int32_t totalColNum, SQPTCol* pCol) { - if (colNum == totalColNum) { - for (int32_t i = 0; i < colNum; ++i) { - pCol[i].inUse = 1; +void qptMarkTableInUseCols(int32_t colNum, int32_t totalColNum) { + if (colNum >= totalColNum) { + for (int32_t i = 0; i < totalColNum; ++i) { + SQPTCol* pNode = (SQPTCol*)nodesListGetNode(qptCtx.makeCtx.pInputList, i); + assert(pNode->type == QPT_QUERY_NODE_COL); + pNode->inUse = 1; } return; } @@ -1265,49 +1575,76 @@ void qptMarkTableInUseCols(int32_t colNum, int32_t totalColNum, SQPTCol* pCol) { int32_t colInUse = 0; do { int32_t colIdx = taosRand() % totalColNum; - if (pCol[colIdx].inUse) { + SQPTCol* pNode = (SQPTCol*)nodesListGetNode(qptCtx.makeCtx.pInputList, colIdx); + assert(pNode->type == QPT_QUERY_NODE_COL); + + if (pNode->inUse) { continue; } - pCol[colIdx].inUse = 1; + pNode->inUse = 1; colInUse++; } while (colInUse < colNum); } -void qptCreateTableScanColsImpl( SScanPhysiNode* pScanPhysiNode, SNodeList** ppCols, int32_t totalColNum, SQPTCol* pCol) { - int32_t colNum = qptCtx.param.correctExpected ? (taosRand() % totalColNum + 1) : (taosRand() % QPT_MAX_COLUMN_NUM + 1); - int32_t colAdded = 0; - - if (qptCtx.param.correctExpected) { - qptMarkTableInUseCols(colNum, totalColNum, pCol); - - for (int32_t i = 0; i < totalColNum && colAdded < colNum; ++i) { - if (0 == pCol[i].inUse) { - continue; - } - - assert(0 == qptNodesListMakeStrictAppend(ppCols, qptMakeColumnNodeFromTable(i, pCol[0].colType, pScanPhysiNode))); +void qptMakeTableScanColList( SNodeList** ppCols) { + if (QPT_NCORRECT_LOW_PROB()) { + if (QPT_RAND_BOOL_V) { + nodesMakeList(ppCols); + } else { + *ppCols = NULL; } - + return; } - for (int32_t i = 0; i < colNum; ++i) { - int32_t colIdx = taosRand(); - colIdx = (colIdx >= totalColNum) ? -1 : colIdx; + int32_t colNum = (QPT_CORRECT_HIGH_PROB() && qptCtx.makeCtx.pInputList) ? (taosRand() % qptCtx.makeCtx.pInputList->length + 1) : (taosRand() % QPT_MAX_COLUMN_NUM); + int32_t colAdded = 0; + + if (qptCtx.makeCtx.pInputList) { + if (QPT_CORRECT_HIGH_PROB()) { + qptMarkTableInUseCols(colNum, qptCtx.makeCtx.pInputList->length); + + for (int32_t i = 0; colAdded < colNum; ++i) { + int32_t idx = (i < qptCtx.makeCtx.pInputList->length) ? i : (taosRand() % qptCtx.makeCtx.pInputList->length); + SQPTCol* pNode = (SQPTCol*)nodesListGetNode(qptCtx.makeCtx.pInputList, idx); + assert(pNode->type == QPT_QUERY_NODE_COL); + + if (0 == pNode->inUse) { + continue; + } + + assert(0 == qptNodesListMakeStrictAppend(ppCols, qptMakeColumnFromTable(idx))); + colAdded++; + } + + return; + } - assert(0 == qptNodesListMakeStrictAppend(ppCols, qptMakeColumnNodeFromTable(colIdx, pCol[0].colType, pScanPhysiNode))); + for (int32_t i = 0; i < colNum; ++i) { + int32_t colIdx = taosRand(); + colIdx = (colIdx >= qptCtx.makeCtx.pInputList->length) ? -1 : colIdx; + + assert(0 == qptNodesListMakeStrictAppend(ppCols, qptMakeColumnFromTable(colIdx))); + } + } else { + for (int32_t i = 0; i < colNum; ++i) { + int32_t colIdx = taosRand(); + assert(0 == qptNodesListMakeStrictAppend(ppCols, qptMakeColumnFromTable(colIdx))); + } } } -void qptCreateTableScanCols( SScanPhysiNode* pScanPhysiNode) { - qptCreateTableScanColsImpl(pScanPhysiNode, &pScanPhysiNode->pScanCols, qptCtx.param.tbl.colNum, qptCtx.param.tbl.pCol); +void qptCreateTableScanCols( int16_t blockId, SNodeList** ppList) { + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? true : false, QPT_CORRECT_HIGH_PROB() ? false : true, QPT_CORRECT_HIGH_PROB() ? true : false, 0, NULL); + qptMakeTableScanColList(ppList); } -void qptCreateTableScanPseudoCols( SScanPhysiNode* pScanPhysiNode) { - qptCreateTableScanColsImpl(pScanPhysiNode, &pScanPhysiNode->pScanPseudoCols, qptCtx.param.tbl.tagNum, qptCtx.param.tbl.pTag); +void qptCreateTableScanPseudoCols( int16_t blockId, SNodeList** ppList) { + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? true : false, QPT_CORRECT_HIGH_PROB() ? true : false, QPT_CORRECT_HIGH_PROB() ? false : true, 0, NULL); + qptMakeTableScanColList(ppList); } @@ -1327,11 +1664,11 @@ void qptAddDataBlockSlots(SNodeList* pList, SDataBlockDescNode* pDataBlockDesc) SNode* pExpr = QUERY_NODE_ORDER_BY_EXPR == nodeType(pNode) ? ((SOrderByExprNode*)pNode)->pExpr : pNode; if (QPT_CORRECT_HIGH_PROB()) { - SNode* pDesc = qptCtx.param.correctExpected ? qptMakeSlotDescNode(NULL, pExpr, nextSlotId, output, QPT_RAND_BOOL_V) : qptMakeExprNode(NULL); + SNode* pDesc = QPT_CORRECT_HIGH_PROB() ? qptMakeSlotDescNode(NULL, pExpr, nextSlotId, output, QPT_RAND_BOOL_V) : qptMakeExprNode(NULL); assert(0 == qptNodesListMakeStrictAppend(&pDataBlockDesc->pSlots, pDesc)); - pDataBlockDesc->totalRowSize += qptCtx.param.correctExpected ? ((SExprNode*)pExpr)->resType.bytes : taosRand(); + pDataBlockDesc->totalRowSize += QPT_CORRECT_HIGH_PROB() ? ((SExprNode*)pExpr)->resType.bytes : taosRand(); if (output && QPT_RAND_BOOL_V) { - pDataBlockDesc->outputRowSize += qptCtx.param.correctExpected ? ((SExprNode*)pExpr)->resType.bytes : taosRand(); + pDataBlockDesc->outputRowSize += QPT_CORRECT_HIGH_PROB() ? ((SExprNode*)pExpr)->resType.bytes : taosRand(); } } @@ -1346,14 +1683,170 @@ void qptAddDataBlockSlots(SNodeList* pList, SDataBlockDescNode* pDataBlockDesc) } } +SNode* qptMakeSpecTypeNode(QPT_NODE_TYPE nodeType, SNode** ppNode) { + switch (nodeType) { + case QPT_NODE_COLUMN: + return qptMakeColumnNode(ppNode); + case QPT_NODE_FUNCTION: + return qptMakeFunctionNode(ppNode); + case QPT_NODE_EXPR: + return qptMakeExprNode(ppNode); + case QPT_NODE_VALUE: + return qptMakeValueNode(-1, ppNode); + default: + break; + } + + return qptMakeRandNode(ppNode); +} + + +void qptMakeRandNodeList(SNodeList** ppList) { + qptSaveMakeNodeCtx(); + + int32_t exprNum = taosRand() % QPT_MAX_COLUMN_NUM + (QPT_CORRECT_HIGH_PROB() ? 1 : 0); + for (int32_t i = 0; i < exprNum; ++i) { + SNode* pNode = NULL; + qptRestoreMakeNodeCtx(); + qptMakeSpecTypeNode((QPT_NODE_TYPE)(taosRand() % (QPT_NODE_MAX_VALUE + 1)), &pNode); + qptNodesListMakeStrictAppend(ppList, pNode); + } +} + + +void qptMakeExprList(SNodeList** ppList) { + qptSaveMakeNodeCtx(); + + int32_t exprNum = taosRand() % QPT_MAX_COLUMN_NUM + (QPT_CORRECT_HIGH_PROB() ? 1 : 0); + for (int32_t i = 0; i < exprNum; ++i) { + SNode* pNode = NULL; + qptRestoreMakeNodeCtx(); + qptMakeExprNode(&pNode); + qptNodesListMakeStrictAppend(ppList, pNode); + } +} + +void qptMakeValueList(SNodeList** ppList) { + qptSaveMakeNodeCtx(); + + int32_t colNum = taosRand() % QPT_MAX_COLUMN_NUM + (QPT_CORRECT_HIGH_PROB() ? 1 : 0); + for (int32_t i = 0; i < colNum; ++i) { + SNode* pNode = NULL; + qptRestoreMakeNodeCtx(); + qptMakeValueNode(-1, &pNode); + qptNodesListMakeStrictAppend(ppList, pNode); + } +} + +void qptMakeColumnList(SNodeList** ppList) { + qptSaveMakeNodeCtx(); + + int32_t colNum = taosRand() % QPT_MAX_COLUMN_NUM + (QPT_CORRECT_HIGH_PROB() ? 1 : 0); + for (int32_t i = 0; i < colNum; ++i) { + SNode* pNode = NULL; + qptRestoreMakeNodeCtx(); + qptMakeColumnNode(&pNode); + qptNodesListMakeStrictAppend(ppList, pNode); + } +} + +void qptMakeTargetList(QPT_NODE_TYPE nodeType, int16_t datablockId, SNodeList** ppList) { + qptSaveMakeNodeCtx(); + + int32_t tarNum = taosRand() % QPT_MAX_COLUMN_NUM + (QPT_CORRECT_HIGH_PROB() ? 1 : 0); + for (int32_t i = 0; i < tarNum; ++i) { + SNode* pNode = NULL, *pExpr = NULL; + qptRestoreMakeNodeCtx(); + qptMakeSpecTypeNode(nodeType, &pExpr); + qptMakeTargetNode(pExpr, datablockId, i, &pNode); + qptNodesListMakeStrictAppend(ppList, pNode); + } +} + +void qptMakeFunctionList(SNodeList** ppList) { + qptSaveMakeNodeCtx(); + + int32_t funcNum = taosRand() % QPT_MAX_COLUMN_NUM + (QPT_CORRECT_HIGH_PROB() ? 1 : 0); + for (int32_t i = 0; i < funcNum; ++i) { + SNode* pNode = NULL; + qptRestoreMakeNodeCtx(); + qptMakeFunctionNode(&pNode); + qptNodesListMakeStrictAppend(ppList, pNode); + } +} + + +void qptMakeDownstreamSrcList(SNodeList** ppList) { + qptSaveMakeNodeCtx(); + + int32_t dsNum = taosRand() % QPT_MAX_DS_SRC_NUM + (QPT_CORRECT_HIGH_PROB() ? 1 : 0); + for (int32_t i = 0; i < dsNum; ++i) { + SNode* pNode = NULL; + qptRestoreMakeNodeCtx(); + qptMakeDownstreamSrcNode(&pNode); + qptNodesListMakeStrictAppend(ppList, pNode); + } +} + + +void qptMakeOrerByExprList(SNodeList** ppList) { + qptSaveMakeNodeCtx(); + + int32_t orderNum = taosRand() % QPT_MAX_ORDER_BY_NUM + (QPT_CORRECT_HIGH_PROB() ? 1 : 0); + for (int32_t i = 0; i < orderNum; ++i) { + SNode* pNode = NULL; + qptRestoreMakeNodeCtx(); + qptMakeOrderByExprNode(&pNode); + qptNodesListMakeStrictAppend(ppList, pNode); + } +} + + +void qptMakeSpecTypeNodeList(QPT_NODE_TYPE nodeType, SNodeList** ppList) { + switch (nodeType) { + case QPT_NODE_COLUMN: + return qptMakeColumnList(ppList); + case QPT_NODE_FUNCTION: + return qptMakeFunctionList(ppList); + case QPT_NODE_EXPR: + return qptMakeExprList(ppList); + case QPT_NODE_VALUE: + return qptMakeValueList(ppList); + default: + break; + } + + return qptMakeRandNodeList(ppList); +} + + +void qptMakeNodeList(QPT_NODE_TYPE nodeType, SNodeList** ppList) { + qptMakeSpecTypeNodeList(nodeType, ppList); +} + + + +void qptMakeAppendToTargetList(SNodeList* pInputList, int16_t blockId, SNodeList** ppOutList) { + SNode* pNode = NULL; + FOREACH(pNode, pInputList) { + if (QPT_CORRECT_HIGH_PROB()) { + SNode* pTarget = NULL; + int16_t slotId = ((*ppOutList) && (*ppOutList)->length) ? (*ppOutList)->length : 0; + qptMakeTargetNode(pNode, blockId, slotId, &pTarget); + qptNodesListMakeStrictAppend(ppOutList, pTarget); + } + } +} void qptCreateScanPhysiNodeImpl( SScanPhysiNode* pScanPhysiNode) { - qptCreateTableScanCols(pScanPhysiNode); + int16_t blockId = (QPT_CORRECT_HIGH_PROB() && pScanPhysiNode->node.pOutputDataBlockDesc) ? pScanPhysiNode->node.pOutputDataBlockDesc->dataBlockId : taosRand(); + qptCreateTableScanCols(blockId, &pScanPhysiNode->pScanCols); qptAddDataBlockSlots(pScanPhysiNode->pScanCols, pScanPhysiNode->node.pOutputDataBlockDesc); if (taosRand() % 2) { - qptCreateTableScanPseudoCols(pScanPhysiNode); + blockId = (QPT_CORRECT_HIGH_PROB() && pScanPhysiNode->node.pOutputDataBlockDesc) ? pScanPhysiNode->node.pOutputDataBlockDesc->dataBlockId : taosRand(); + qptCreateTableScanPseudoCols(blockId, &pScanPhysiNode->pScanPseudoCols); } qptAddDataBlockSlots(pScanPhysiNode->pScanPseudoCols, pScanPhysiNode->node.pOutputDataBlockDesc); @@ -1391,34 +1884,131 @@ SNode* qptCreateTagScanPhysiNode(int32_t nodeType) { return (SNode*)pPhysiNode; } -void qptMakeExprList(SNodeList** ppList) { - int32_t exprNum = taosRand() % QPT_MAX_COLUMN_NUM + (QPT_CORRECT_HIGH_PROB() ? 1 : 0); - for (int32_t i = 0; i < exprNum; ++i) { - SNode* pNode = NULL; - qptResetMakeNodeCtx(qptCtx.buildCtx.pChild ? qptCtx.buildCtx.pChild->pOutputDataBlockDesc : NULL, false); - qptMakeExprNode(&pNode); - qptNodesListMakeStrictAppend(ppList, pNode); - } +SNode* qptCreateTableScanPhysiNode(int32_t nodeType) { + SPhysiNode* pPhysiNode = qptCreatePhysiNode(nodeType); + + STableScanPhysiNode* pTableScanNode = (STableScanPhysiNode*)pPhysiNode; + pTableScanNode->scanSeq[0] = taosRand() % 4; + pTableScanNode->scanSeq[1] = taosRand() % 4; + pTableScanNode->scanRange.skey = taosRand(); + pTableScanNode->scanRange.ekey = taosRand(); + pTableScanNode->ratio = taosRand(); + pTableScanNode->dataRequired = taosRand(); + + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? true : false, QPT_RAND_BOOL_V, QPT_RAND_BOOL_V, 0, NULL); + qptMakeFunctionList(&pTableScanNode->pDynamicScanFuncs); + + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? true : false, QPT_CORRECT_HIGH_PROB() ? true : false, QPT_CORRECT_HIGH_PROB() ? false : true, 0, NULL); + qptMakeColumnList(&pTableScanNode->pGroupTags); + + pTableScanNode->groupSort = QPT_RAND_BOOL_V; + + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? true : false, QPT_CORRECT_HIGH_PROB() ? true : false, QPT_CORRECT_HIGH_PROB() ? false : true, 0, NULL); + qptMakeExprList(&pTableScanNode->pTags); + + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? true : false, QPT_RAND_BOOL_V, QPT_RAND_BOOL_V, 0, NULL); + qptMakeExprNode(&pTableScanNode->pSubtable); + pTableScanNode->interval = taosRand(); + pTableScanNode->offset = taosRand(); + pTableScanNode->sliding = taosRand(); + pTableScanNode->intervalUnit = taosRand(); + pTableScanNode->slidingUnit = taosRand(); + pTableScanNode->triggerType = taosRand(); + pTableScanNode->watermark = taosRand(); + pTableScanNode->igExpired = taosRand(); + pTableScanNode->assignBlockUid = QPT_RAND_BOOL_V; + pTableScanNode->igCheckUpdate = taosRand(); + pTableScanNode->filesetDelimited = QPT_RAND_BOOL_V; + pTableScanNode->needCountEmptyTable = QPT_RAND_BOOL_V; + pTableScanNode->paraTablesSort = QPT_RAND_BOOL_V; + pTableScanNode->smallDataTsSort = QPT_RAND_BOOL_V; + + qptCreateScanPhysiNodeImpl(&pTableScanNode->scan); + + qptPostCreatePhysiNode(pPhysiNode); + + return (SNode*)pPhysiNode; } -void qptMakeColumnList(SNodeList** ppList) { - int32_t colNum = taosRand() % QPT_MAX_COLUMN_NUM + (QPT_CORRECT_HIGH_PROB() ? 1 : 0); - qptResetMakeNodeCtx(qptCtx.buildCtx.pChild ? qptCtx.buildCtx.pChild->pOutputDataBlockDesc : NULL, false); - for (int32_t i = 0; i < colNum; ++i) { - SNode* pNode = NULL; - qptMakeColumnNode(&pNode); - qptNodesListMakeStrictAppend(ppList, pNode); - } + +SNode* qptCreateTableSeqScanPhysiNode(int32_t nodeType) { + return qptCreateTableScanPhysiNode(nodeType); } -void qptMakeTargetList(int16_t datablockId, SNodeList** ppList) { - int32_t tarNum = taosRand() % QPT_MAX_COLUMN_NUM + (QPT_CORRECT_HIGH_PROB() ? 1 : 0); - for (int32_t i = 0; i < tarNum; ++i) { - SNode* pNode = NULL, *pExpr = NULL; - qptMakeColumnNode(&pExpr); - qptMakeTargetNode(pExpr, datablockId, i, &pNode); - qptNodesListMakeStrictAppend(ppList, pNode); +SNode* qptCreateTableMergeScanPhysiNode(int32_t nodeType) { + return qptCreateTableScanPhysiNode(nodeType); +} + +SNode* qptCreateStreamScanPhysiNode(int32_t nodeType) { + return qptCreateTableScanPhysiNode(nodeType); +} + +SNode* qptCreateSysTableScanPhysiNode(int32_t nodeType) { + SPhysiNode* pPhysiNode = qptCreatePhysiNode(nodeType); + + SSystemTableScanPhysiNode* pSysScanNode = (SSystemTableScanPhysiNode*)pPhysiNode; + + memcpy(&pSysScanNode->mgmtEpSet, &qptCtx.param.vnode.epSet, sizeof(pSysScanNode->mgmtEpSet)); + pSysScanNode->showRewrite = QPT_RAND_BOOL_V; + pSysScanNode->accountId = QPT_CORRECT_HIGH_PROB() ? 1 : taosRand(); + pSysScanNode->sysInfo = QPT_RAND_BOOL_V; + + qptCreateScanPhysiNodeImpl(&pSysScanNode->scan); + + qptPostCreatePhysiNode(pPhysiNode); + + return (SNode*)pPhysiNode; +} + +SNode* qptCreateBlockDistScanPhysiNode(int32_t nodeType) { + SPhysiNode* pPhysiNode = qptCreatePhysiNode(nodeType); + + SBlockDistScanPhysiNode* pBlkScanNode = (SBlockDistScanPhysiNode*)pPhysiNode; + + qptCreateScanPhysiNodeImpl((SScanPhysiNode*)pBlkScanNode); + + qptPostCreatePhysiNode(pPhysiNode); + + return (SNode*)pPhysiNode; +} + + +SNode* qptCreateLastRowScanPhysiNode(int32_t nodeType) { + SPhysiNode* pPhysiNode = qptCreatePhysiNode(nodeType); + + SLastRowScanPhysiNode* pLRScanNode = (SLastRowScanPhysiNode*)pPhysiNode; + + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? true : false, QPT_CORRECT_HIGH_PROB() ? true : false, QPT_CORRECT_HIGH_PROB() ? false : true, 0, NULL); + qptMakeColumnList(&pLRScanNode->pGroupTags); + + pLRScanNode->groupSort = QPT_RAND_BOOL_V; + pLRScanNode->ignoreNull = QPT_RAND_BOOL_V; + + if (QPT_CORRECT_HIGH_PROB()) { + int16_t blockId = (QPT_CORRECT_HIGH_PROB() && pPhysiNode->pOutputDataBlockDesc) ? pPhysiNode->pOutputDataBlockDesc->dataBlockId : taosRand(); + qptMakeAppendToTargetList(pLRScanNode->scan.pScanCols, blockId, &pLRScanNode->pTargets); } + + if (QPT_CORRECT_HIGH_PROB()) { + int16_t blockId = (QPT_CORRECT_HIGH_PROB() && pPhysiNode->pOutputDataBlockDesc) ? pPhysiNode->pOutputDataBlockDesc->dataBlockId : taosRand(); + qptMakeAppendToTargetList(pLRScanNode->scan.pScanPseudoCols, blockId, &pLRScanNode->pTargets); + } + + if (QPT_RAND_BOOL_V) { + int32_t funcNum = taosRand() % QPT_MAX_COLUMN_NUM; + pLRScanNode->pFuncTypes = taosArrayInit(funcNum, sizeof(int32_t)); + assert(pLRScanNode->pFuncTypes); + for (int32_t i = 0; i < funcNum; ++i) { + int32_t funcType = taosRand(); + taosArrayPush(pLRScanNode->pFuncTypes, &funcType); + } + } + + qptCreateScanPhysiNodeImpl(&pLRScanNode->scan); + + qptPostCreatePhysiNode(pPhysiNode); + + return (SNode*)pPhysiNode; } SNode* qptCreateProjectPhysiNode(int32_t nodeType) { @@ -1430,6 +2020,7 @@ SNode* qptCreateProjectPhysiNode(int32_t nodeType) { pProject->ignoreGroupId = QPT_RAND_BOOL_V; pProject->inputIgnoreGroup = QPT_RAND_BOOL_V; + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? false : true, QPT_RAND_BOOL_V, QPT_RAND_BOOL_V, 0, NULL); qptMakeExprList(&pProject->pProjections); qptAddDataBlockSlots(pProject->pProjections, pProject->node.pOutputDataBlockDesc); @@ -1440,28 +2031,48 @@ SNode* qptCreateProjectPhysiNode(int32_t nodeType) { } -SNode* qptCreateSortMergeJoinPhysiNode(int32_t nodeType) { +SNode* qptCreateMergeJoinPhysiNode(int32_t nodeType) { SPhysiNode* pPhysiNode = qptCreatePhysiNode(nodeType); SSortMergeJoinPhysiNode* pJoin = (SSortMergeJoinPhysiNode*)pPhysiNode; - pJoin->joinType = taosRand() % JOIN_TYPE_MAX_VALUE + (QPT_CORRECT_HIGH_PROB() ? 0 : 1); - pJoin->subType = taosRand() % JOIN_STYPE_MAX_VALUE + (QPT_CORRECT_HIGH_PROB() ? 0 : 1); + pJoin->joinType = (EJoinType)(taosRand() % JOIN_TYPE_MAX_VALUE + (QPT_CORRECT_HIGH_PROB() ? 0 : 1)); + pJoin->subType = (EJoinSubType)(taosRand() % JOIN_STYPE_MAX_VALUE + (QPT_CORRECT_HIGH_PROB() ? 0 : 1)); qptMakeWindowOffsetNode(&pJoin->pWindowOffset); qptMakeLimitNode(&pJoin->pJLimit); pJoin->asofOpType = OPERATOR_ARRAY[taosRand() % (sizeof(OPERATOR_ARRAY)/sizeof(OPERATOR_ARRAY[0]))] + (QPT_CORRECT_HIGH_PROB() ? 0 : 1); + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? false : true, QPT_RAND_BOOL_V, QPT_RAND_BOOL_V, 0, NULL); qptMakeExprNode(&pJoin->leftPrimExpr); + + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? false : true, QPT_RAND_BOOL_V, QPT_RAND_BOOL_V, 0, NULL); qptMakeExprNode(&pJoin->rightPrimExpr); - pJoin->leftPrimSlotId = qptGetInputSlotId(qptCtx->buildCtx.pChild ? qptCtx->buildCtx.pChild->pOutputDataBlockDesc : NULL); - pJoin->rightPrimSlotId = qptGetInputSlotId(qptCtx->buildCtx.pChild ? qptCtx->buildCtx.pChild->pOutputDataBlockDesc : NULL); + + pJoin->leftPrimSlotId = qptGetInputSlotId(qptCtx.buildCtx.pChild ? qptCtx.buildCtx.pChild->pOutputDataBlockDesc : NULL); + pJoin->rightPrimSlotId = qptGetInputSlotId(qptCtx.buildCtx.pChild ? qptCtx.buildCtx.pChild->pOutputDataBlockDesc : NULL); + + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? false : true, QPT_RAND_BOOL_V, QPT_RAND_BOOL_V, 0, NULL); qptMakeColumnList(&pJoin->pEqLeft); + + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? false : true, QPT_RAND_BOOL_V, QPT_RAND_BOOL_V, 0, NULL); qptMakeColumnList(&pJoin->pEqRight); + + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? false : true, QPT_RAND_BOOL_V, QPT_RAND_BOOL_V, 0, NULL); qptMakeExprNode(&pJoin->pPrimKeyCond); + + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? false : true, QPT_RAND_BOOL_V, QPT_RAND_BOOL_V, 0, NULL); qptMakeExprNode(&pJoin->pColEqCond); + + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? false : true, QPT_RAND_BOOL_V, QPT_RAND_BOOL_V, 0, NULL); qptMakeExprNode(&pJoin->pColOnCond); + + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? false : true, QPT_RAND_BOOL_V, QPT_RAND_BOOL_V, 0, NULL); qptMakeExprNode(&pJoin->pFullOnCond); - qptMakeTargetList(pPhysiNode->pOutputDataBlockDesc ? pPhysiNode->pOutputDataBlockDesc->dataBlockId, &pJoin->pTargets); + + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? false : true, QPT_RAND_BOOL_V, QPT_RAND_BOOL_V, 0, NULL); + int16_t blockId = (QPT_CORRECT_HIGH_PROB() && pPhysiNode->pOutputDataBlockDesc) ? pPhysiNode->pOutputDataBlockDesc->dataBlockId : taosRand(); + qptMakeTargetList(QPT_NODE_EXPR, blockId, &pJoin->pTargets); + for (int32_t i = 0; i < 2; i++) { pJoin->inputStat[i].inputRowNum = taosRand(); pJoin->inputStat[i].inputRowSize = taosRand(); @@ -1473,64 +2084,293 @@ SNode* qptCreateSortMergeJoinPhysiNode(int32_t nodeType) { return (SNode*)pPhysiNode; } -SNode* qptCreatePhysicalPlanNode(int32_t nodeType) { - switch (nodeType) { - case QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN: - return (SNode*)qptCreateTagScanPhysiNode(nodeType); - case QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN: - case QUERY_NODE_PHYSICAL_PLAN_TABLE_SEQ_SCAN: - case QUERY_NODE_PHYSICAL_PLAN_TABLE_MERGE_SCAN: - case QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN: - case QUERY_NODE_PHYSICAL_PLAN_SYSTABLE_SCAN: - case QUERY_NODE_PHYSICAL_PLAN_BLOCK_DIST_SCAN: - case QUERY_NODE_PHYSICAL_PLAN_LAST_ROW_SCAN: - case QUERY_NODE_PHYSICAL_PLAN_PROJECT: - return (SNode*)qptCreateProjectPhysiNode(nodeType); - case QUERY_NODE_PHYSICAL_PLAN_MERGE_JOIN: - return (SNode*)qptCreateSortMergeJoinPhysiNode(nodeType); - case QUERY_NODE_PHYSICAL_PLAN_HASH_AGG: - case QUERY_NODE_PHYSICAL_PLAN_EXCHANGE: - case QUERY_NODE_PHYSICAL_PLAN_MERGE: - case QUERY_NODE_PHYSICAL_PLAN_SORT: - case QUERY_NODE_PHYSICAL_PLAN_GROUP_SORT: - case QUERY_NODE_PHYSICAL_PLAN_HASH_INTERVAL: - case QUERY_NODE_PHYSICAL_PLAN_MERGE_INTERVAL: - case QUERY_NODE_PHYSICAL_PLAN_MERGE_ALIGNED_INTERVAL: - case QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL: - case QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL: - case QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL: - case QUERY_NODE_PHYSICAL_PLAN_FILL: - case QUERY_NODE_PHYSICAL_PLAN_STREAM_FILL: - case QUERY_NODE_PHYSICAL_PLAN_MERGE_SESSION: - case QUERY_NODE_PHYSICAL_PLAN_STREAM_SESSION: - case QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_SESSION: - case QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_SESSION: - case QUERY_NODE_PHYSICAL_PLAN_MERGE_STATE: - case QUERY_NODE_PHYSICAL_PLAN_STREAM_STATE: - case QUERY_NODE_PHYSICAL_PLAN_PARTITION: - case QUERY_NODE_PHYSICAL_PLAN_STREAM_PARTITION: - case QUERY_NODE_PHYSICAL_PLAN_INDEF_ROWS_FUNC: - case QUERY_NODE_PHYSICAL_PLAN_INTERP_FUNC: - case QUERY_NODE_PHYSICAL_PLAN_DISPATCH: - case QUERY_NODE_PHYSICAL_PLAN_INSERT: - case QUERY_NODE_PHYSICAL_PLAN_QUERY_INSERT: - case QUERY_NODE_PHYSICAL_PLAN_DELETE: - case QUERY_NODE_PHYSICAL_SUBPLAN: - case QUERY_NODE_PHYSICAL_PLAN: - case QUERY_NODE_PHYSICAL_PLAN_TABLE_COUNT_SCAN: - case QUERY_NODE_PHYSICAL_PLAN_MERGE_EVENT: - case QUERY_NODE_PHYSICAL_PLAN_STREAM_EVENT: - case QUERY_NODE_PHYSICAL_PLAN_HASH_JOIN: - case QUERY_NODE_PHYSICAL_PLAN_GROUP_CACHE: - case QUERY_NODE_PHYSICAL_PLAN_DYN_QUERY_CTRL: - case QUERY_NODE_PHYSICAL_PLAN_MERGE_COUNT: - case QUERY_NODE_PHYSICAL_PLAN_STREAM_COUNT: - case QUERY_NODE_PHYSICAL_PLAN_STREAM_MID_INTERVAL: - default: - assert(0); +SNode* qptCreateHashAggPhysiNode(int32_t nodeType) { + SPhysiNode* pPhysiNode = qptCreatePhysiNode(nodeType); + + SAggPhysiNode* pAgg = (SAggPhysiNode*)pPhysiNode; + + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? false : true, QPT_RAND_BOOL_V, QPT_RAND_BOOL_V, 0, NULL); + qptMakeExprList(&pAgg->pExprs); + + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? false : true, QPT_RAND_BOOL_V, QPT_RAND_BOOL_V, 0, NULL); + int16_t blockId = (QPT_CORRECT_HIGH_PROB() && pPhysiNode->pOutputDataBlockDesc) ? pPhysiNode->pOutputDataBlockDesc->dataBlockId : taosRand(); + qptMakeTargetList(QPT_NODE_EXPR, blockId, &pAgg->pGroupKeys); + + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? false : true, QPT_RAND_BOOL_V, QPT_RAND_BOOL_V, 0, NULL); + blockId = (QPT_CORRECT_HIGH_PROB() && pPhysiNode->pOutputDataBlockDesc) ? pPhysiNode->pOutputDataBlockDesc->dataBlockId : taosRand(); + qptMakeTargetList(QPT_NODE_FUNCTION, blockId, &pAgg->pAggFuncs); + + pAgg->mergeDataBlock = QPT_RAND_BOOL_V; + pAgg->groupKeyOptimized = QPT_RAND_BOOL_V; + pAgg->hasCountLikeFunc = QPT_RAND_BOOL_V; + + return (SNode*)pPhysiNode; +} + +SNode* qptCreateExchangePhysiNode(int32_t nodeType) { + SPhysiNode* pPhysiNode = qptCreatePhysiNode(nodeType); + + SExchangePhysiNode* pExc = (SExchangePhysiNode*)pPhysiNode; + + pExc->srcStartGroupId = taosRand(); + pExc->srcEndGroupId = taosRand(); + pExc->singleChannel = QPT_RAND_BOOL_V; + + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? false : true, QPT_RAND_BOOL_V, QPT_RAND_BOOL_V, 0, NULL); + qptMakeDownstreamSrcList(&pExc->pSrcEndPoints); + + pExc->seqRecvData = QPT_RAND_BOOL_V; + + return (SNode*)pPhysiNode; +} + +SNode* qptCreateMergePhysiNode(int32_t nodeType) { + SPhysiNode* pPhysiNode = qptCreatePhysiNode(nodeType); + + SMergePhysiNode* pMerge = (SMergePhysiNode*)pPhysiNode; + + pMerge->type = (EMergeType)(QPT_CORRECT_HIGH_PROB() ? (taosRand() % (MERGE_TYPE_MAX_VALUE - 1) + 1) : taosRand()); + + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? false : true, QPT_RAND_BOOL_V, QPT_RAND_BOOL_V, 0, NULL); + qptMakeOrerByExprList(&pMerge->pMergeKeys); + + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? false : true, QPT_RAND_BOOL_V, QPT_RAND_BOOL_V, 0, NULL); + int16_t blockId = (QPT_CORRECT_HIGH_PROB() && pPhysiNode->pOutputDataBlockDesc) ? pPhysiNode->pOutputDataBlockDesc->dataBlockId : taosRand(); + qptMakeTargetList(QPT_NODE_EXPR, blockId, &pMerge->pTargets); + + pMerge->numOfChannels = taosRand(); + pMerge->numOfSubplans = taosRand(); + pMerge->srcGroupId = taosRand(); + pMerge->srcEndGroupId = taosRand(); + pMerge->groupSort = QPT_RAND_BOOL_V; + pMerge->ignoreGroupId = QPT_RAND_BOOL_V; + pMerge->inputWithGroupId = QPT_RAND_BOOL_V; + + return (SNode*)pPhysiNode; +} + + +SNode* qptCreateSortPhysiNode(int32_t nodeType) { + SPhysiNode* pPhysiNode = qptCreatePhysiNode(nodeType); + + SSortPhysiNode* pSort = (SSortPhysiNode*)pPhysiNode; + + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? false : true, QPT_RAND_BOOL_V, QPT_RAND_BOOL_V, 0, NULL); + qptMakeExprList(&pSort->pExprs); + + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? false : true, QPT_RAND_BOOL_V, QPT_RAND_BOOL_V, 0, NULL); + qptMakeOrerByExprList(&pSort->pSortKeys); + + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? false : true, QPT_RAND_BOOL_V, QPT_RAND_BOOL_V, 0, NULL); + int16_t blockId = (QPT_CORRECT_HIGH_PROB() && pPhysiNode->pOutputDataBlockDesc) ? pPhysiNode->pOutputDataBlockDesc->dataBlockId : taosRand(); + qptMakeTargetList(QPT_NODE_EXPR, blockId, &pSort->pTargets); + + pSort->calcGroupId = QPT_RAND_BOOL_V; + pSort->excludePkCol = QPT_RAND_BOOL_V; + + return (SNode*)pPhysiNode; +} + +SNode* qptCreateGroupSortPhysiNode(int32_t nodeType) { + SPhysiNode* pPhysiNode = qptCreatePhysiNode(nodeType); + + SGroupSortPhysiNode* pSort = (SGroupSortPhysiNode*)pPhysiNode; + + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? false : true, QPT_RAND_BOOL_V, QPT_RAND_BOOL_V, 0, NULL); + qptMakeExprList(&pSort->pExprs); + + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? false : true, QPT_RAND_BOOL_V, QPT_RAND_BOOL_V, 0, NULL); + qptMakeOrerByExprList(&pSort->pSortKeys); + + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? false : true, QPT_RAND_BOOL_V, QPT_RAND_BOOL_V, 0, NULL); + int16_t blockId = (QPT_CORRECT_HIGH_PROB() && pPhysiNode->pOutputDataBlockDesc) ? pPhysiNode->pOutputDataBlockDesc->dataBlockId : taosRand(); + qptMakeTargetList(QPT_NODE_EXPR, blockId, &pSort->pTargets); + + pSort->calcGroupId = QPT_RAND_BOOL_V; + pSort->excludePkCol = QPT_RAND_BOOL_V; + + return (SNode*)pPhysiNode; +} + +void qptCreateWindowPhysiNode(SWindowPhysiNode* pWindow) { + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? false : true, QPT_RAND_BOOL_V, QPT_RAND_BOOL_V, 0, NULL); + qptMakeExprList(&pWindow->pExprs); + + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? false : true, QPT_RAND_BOOL_V, QPT_RAND_BOOL_V, 0, NULL); + qptMakeFunctionList(&pWindow->pFuncs); + + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? false : true, QPT_RAND_BOOL_V, QPT_RAND_BOOL_V, 0, NULL); + qptMakeColumnNode(&pWindow->pTspk); + + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? false : true, QPT_RAND_BOOL_V, QPT_RAND_BOOL_V, 0, NULL); + qptMakeColumnNode(&pWindow->pTsEnd); + + pWindow->triggerType = taosRand(); + pWindow->watermark = taosRand(); + pWindow->deleteMark = taosRand(); + pWindow->igExpired = taosRand(); + pWindow->destHasPrimayKey = taosRand(); + pWindow->mergeDataBlock = QPT_RAND_BOOL_V; +} + +SNode* qptCreateIntervalPhysiNode(int32_t nodeType) { + SPhysiNode* pPhysiNode = qptCreatePhysiNode(nodeType); + + SIntervalPhysiNode* pInterval = (SIntervalPhysiNode*)pPhysiNode; + + qptCreateWindowPhysiNode(&pInterval->window); + + pInterval->interval = taosRand(); + pInterval->offset = taosRand(); + pInterval->sliding = taosRand(); + pInterval->intervalUnit = qptGetRandTimestampUnit(); + pInterval->slidingUnit = qptGetRandTimestampUnit(); + + return (SNode*)pPhysiNode; +} + +SNode* qptCreateMergeIntervalPhysiNode(int32_t nodeType) { + return qptCreateIntervalPhysiNode(nodeType); +} + +SNode* qptCreateMergeAlignedIntervalPhysiNode(int32_t nodeType) { + return qptCreateIntervalPhysiNode(nodeType); +} + +SNode* qptCreateStreamIntervalPhysiNode(int32_t nodeType) { + return qptCreateIntervalPhysiNode(nodeType); +} + +SNode* qptCreateStreamFinalIntervalPhysiNode(int32_t nodeType) { + return qptCreateIntervalPhysiNode(nodeType); +} + +SNode* qptCreateStreamSemiIntervalPhysiNode(int32_t nodeType) { + return qptCreateIntervalPhysiNode(nodeType); +} + +SNode* qptCreateFillPhysiNode(int32_t nodeType) { + SPhysiNode* pPhysiNode = qptCreatePhysiNode(nodeType); + + SFillPhysiNode* pFill = (SFillPhysiNode*)pPhysiNode; + + pFill->mode = qptGetRandFillMode(); + + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? false : true, QPT_RAND_BOOL_V, QPT_RAND_BOOL_V, 0, NULL); + qptMakeExprList(&pFill->pFillExprs); + + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? false : true, QPT_RAND_BOOL_V, QPT_RAND_BOOL_V, 0, NULL); + qptMakeExprList(&pFill->pNotFillExprs); + + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? false : true, QPT_RAND_BOOL_V, QPT_RAND_BOOL_V, 0, NULL); + qptMakeColumnNode(&pFill->pWStartTs); + + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? false : true, QPT_RAND_BOOL_V, QPT_RAND_BOOL_V, 0, NULL); + qptMakeNodeListNode(QPT_NODE_VALUE, &pFill->pValues); + + qptGetRandTimeWindow(&pFill->timeRange); + + return (SNode*)pPhysiNode; +} + +SNode* qptCreateStreamFillPhysiNode(int32_t nodeType) { + return qptCreateFillPhysiNode(nodeType); +} + + +SNode* qptCreateSessionPhysiNode(int32_t nodeType) { + SPhysiNode* pPhysiNode = qptCreatePhysiNode(nodeType); + + SSessionWinodwPhysiNode* pSession = (SSessionWinodwPhysiNode*)pPhysiNode; + + qptCreateWindowPhysiNode(&pSession->window); + + pSession->gap = taosRand(); + + return (SNode*)pPhysiNode; +} + +SNode* qptCreateStreamSessionPhysiNode(int32_t nodeType) { + return qptCreateSessionPhysiNode(nodeType); +} + +SNode* qptCreateStreamSemiSessionPhysiNode(int32_t nodeType) { + return qptCreateSessionPhysiNode(nodeType); +} + +SNode* qptCreateStreamFinalSessionPhysiNode(int32_t nodeType) { + return qptCreateSessionPhysiNode(nodeType); +} + +SNode* qptCreateStateWindowPhysiNode(int32_t nodeType) { + SPhysiNode* pPhysiNode = qptCreatePhysiNode(nodeType); + + SStateWinodwPhysiNode* pState = (SStateWinodwPhysiNode*)pPhysiNode; + + qptCreateWindowPhysiNode(&pState->window); + + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? false : true, QPT_RAND_BOOL_V, QPT_RAND_BOOL_V, 0, NULL); + qptMakeColumnNode(&pState->pStateKey); + + return (SNode*)pPhysiNode; +} + +SNode* qptCreateStreamStatePhysiNode(int32_t nodeType) { + return qptCreateStateWindowPhysiNode(nodeType); +} + +void qptCreatePartitionPhysiNodeImpl(SPartitionPhysiNode* pPartition) { + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? false : true, QPT_RAND_BOOL_V, QPT_RAND_BOOL_V, 0, NULL); + qptMakeExprList(&pPartition->pExprs); + + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? false : true, QPT_RAND_BOOL_V, QPT_RAND_BOOL_V, pPartition->node.pOutputDataBlockDesc ? pPartition->node.pOutputDataBlockDesc->dataBlockId : taosRand(), pPartition->pExprs); + qptMakeColumnList(&pPartition->pPartitionKeys); + + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? false : true, QPT_RAND_BOOL_V, QPT_RAND_BOOL_V, 0, NULL); + qptMakeColumnList(&pPartition->pPartitionKeys); + + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? false : true, QPT_RAND_BOOL_V, QPT_RAND_BOOL_V, 0, NULL); + int16_t blockId = (QPT_CORRECT_HIGH_PROB() && pPartition->node.pOutputDataBlockDesc) ? pPartition->node.pOutputDataBlockDesc->dataBlockId : taosRand(); + qptMakeTargetList(QPT_NODE_EXPR, blockId, &pPartition->pTargets); + + pPartition->needBlockOutputTsOrder = QPT_RAND_BOOL_V; + pPartition->tsSlotId = qptGetInputPrimaryTsSlotId(); +} + +SNode* qptCreatePartitionPhysiNode(int32_t nodeType) { + SPhysiNode* pPhysiNode = qptCreatePhysiNode(nodeType); + + SPartitionPhysiNode* pPartition = (SPartitionPhysiNode*)pPhysiNode; + + qptCreatePartitionPhysiNodeImpl(pPartition); + + return (SNode*)pPhysiNode; +} + +SNode* qptCreateStreamPartitionPhysiNode(int32_t nodeType) { + SPhysiNode* pPhysiNode = qptCreatePhysiNode(nodeType); + + SStreamPartitionPhysiNode* pPartition = (SStreamPartitionPhysiNode*)pPhysiNode; + + qptCreatePartitionPhysiNodeImpl(&pPartition->part); + + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? false : true, QPT_CORRECT_HIGH_PROB() ? true : false, QPT_RAND_BOOL_V, 0, NULL); + qptMakeColumnList(&pPartition->pTags); + + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? false : true, QPT_RAND_BOOL_V, QPT_RAND_BOOL_V, 0, NULL); + qptMakeExprNode(&pPartition->pSubtable); + + return (SNode*)pPhysiNode; +} + + + +SNode* qptCreatePhysicalPlanNode(int32_t nodeIdx) { + if (qptPlans[nodeIdx].buildFunc) { + return (*qptPlans[nodeIdx].buildFunc)(qptPlans[nodeIdx].type); } - return 0; + return NULL; } void qptCreateQueryPlan(SNode** ppPlan) { @@ -1547,12 +2387,8 @@ void qptRerunBlockedHere() { void qptResetForReRun() { qptCtx.param.plan.taskId = 1; qptCtx.param.vnode.vgId = 1; - for (int32_t i = 0; i < qptCtx.param.tbl.colNum; ++i) { - qptCtx.param.tbl.pCol[i].inUse = 0; - } - for (int32_t i = 0; i < qptCtx.param.tbl.tagNum; ++i) { - qptCtx.param.tbl.pTag[i].inUse = 0; - } + + qptResetTableCols(); } void qptSingleTestDone(bool* contLoop) { @@ -1595,7 +2431,7 @@ void qptHandleTestEnd() { } -void qptRunSingleOpTest(char* caseName) { +void qptRunSingleOpTest() { SNode* pNode = NULL; SReadHandle readHandle = {0}; SOperatorInfo* pOperator = NULL; @@ -1605,12 +2441,13 @@ void qptRunSingleOpTest(char* caseName) { if (qptCtx.loopIdx > 0) { qptResetForReRun(); } - - pNode = (SNode*)qptCreatePhysicalPlanNode(qptCtx.param.plan.subplanType[0]); - qptPrintBeginInfo(caseName); - doCreateTask(qptCtx.param.plan.queryId, qptCtx.param.plan.taskId++, qptCtx.param.vnode.vgId, OPTR_EXEC_MODEL_BATCH, &storageAPI, &pTaskInfo); + qptCtx.buildCtx.pCurrTask = pTaskInfo; + + pNode = (SNode*)qptCreatePhysicalPlanNode(qptCtx.param.plan.subplanIdx[0]); + + qptPrintBeginInfo(); qptCtx.startTsUs = taosGetTimestampUs(); //qptCtx.result.code = createTagScanOperatorInfo(&readHandle, (STagScanPhysiNode*)pNode, NULL, NULL, NULL, pTaskInfo, &pOperator); @@ -1620,12 +2457,12 @@ void qptRunSingleOpTest(char* caseName) { destroyOperator(pOperator); nodesDestroyNode((SNode*)pNode); - qptPrintEndInfo(caseName); + qptPrintEndInfo(); qptHandleTestEnd(); } -void qptRunSubplanTest(char* caseName) { +void qptRunSubplanTest() { SNode* pNode = NULL; SReadHandle readHandle = {0}; SOperatorInfo* pOperator = NULL; @@ -1636,7 +2473,7 @@ void qptRunSubplanTest(char* caseName) { //pNode = (SNode*)qptCreatePhysicalPlanNode(qptCtx.param.plan.subplanType[0]); - qptPrintBeginInfo(caseName); + qptPrintBeginInfo(); qptCtx.startTsUs = taosGetTimestampUs(); //qptCtx.result.code = createTagScanOperatorInfo(&readHandle, (STagScanPhysiNode*)pNode, NULL, NULL, NULL, NULL, &pOperator); @@ -1645,17 +2482,17 @@ void qptRunSubplanTest(char* caseName) { destroyOperator(pOperator); nodesDestroyNode((SNode*)pNode); - qptPrintEndInfo(caseName); + qptPrintEndInfo(); qptHandleTestEnd(); } -void qptRunPlanTest(char* caseName) { +void qptRunPlanTest() { if (qptCtx.param.plan.singlePhysiNode) { - qptRunSingleOpTest(caseName); + qptRunSingleOpTest(); } else { - qptRunSubplanTest(caseName); + qptRunSubplanTest(); } } @@ -1663,77 +2500,52 @@ SQPTNodeParam* qptInitNodeParam(int32_t nodeType) { return NULL; } -int32_t qptGetColumnRandLen(int32_t colType) { - switch (colType) { - case TSDB_DATA_TYPE_NULL: - case TSDB_DATA_TYPE_BOOL: - case TSDB_DATA_TYPE_TINYINT: - case TSDB_DATA_TYPE_SMALLINT: - case TSDB_DATA_TYPE_INT: - case TSDB_DATA_TYPE_BIGINT: - case TSDB_DATA_TYPE_TIMESTAMP: - case TSDB_DATA_TYPE_FLOAT: - case TSDB_DATA_TYPE_DOUBLE: - case TSDB_DATA_TYPE_UTINYINT: - case TSDB_DATA_TYPE_USMALLINT: - case TSDB_DATA_TYPE_UINT: - case TSDB_DATA_TYPE_UBIGINT: - return tDataTypes[colType].bytes; - case TSDB_DATA_TYPE_VARCHAR: - case TSDB_DATA_TYPE_GEOMETRY: - case TSDB_DATA_TYPE_JSON: - case TSDB_DATA_TYPE_VARBINARY: - case TSDB_DATA_TYPE_DECIMAL: - case TSDB_DATA_TYPE_BLOB: - case TSDB_DATA_TYPE_MEDIUMBLOB: - case TSDB_DATA_TYPE_NCHAR: - return taosRand() % TSDB_MAX_BINARY_LEN; - default: - assert(0); - break; - } -} - -void qptInitTableCols(SQPTCol* pCol, int32_t colNum, EColumnType colType) { +void qptInitTableCols(SNodeList** ppList, int32_t colNum, EColumnType colType) { + SQPTCol* pCol = NULL; int32_t tbnameIdx = -1; if (QPT_RAND_BOOL_V && COLUMN_TYPE_TAG == colType) { tbnameIdx = taosRand() % colNum; } for (int32_t i = 0; i < colNum; ++i) { + qptNodesCalloc(1, sizeof(SQPTCol), (void**)&pCol); + pCol->type = QPT_QUERY_NODE_COL; + if (tbnameIdx >= 0 && i == tbnameIdx) { - strcpy(pCol[i].name, "tbname"); - pCol[i].type = TSDB_DATA_TYPE_VARCHAR; - pCol[i].len = qptGetColumnRandLen(pCol[i].type); - pCol[i].inUse = 0; - pCol[i].hasIndex = QPT_RAND_BOOL_V; - pCol[i].isPrimTs = QPT_RAND_BOOL_V; - pCol[i].isPk = QPT_RAND_BOOL_V; - pCol[i].colType = COLUMN_TYPE_TBNAME; + strcpy(pCol->name, "tbname"); + pCol->dtype = TSDB_DATA_TYPE_VARCHAR; + pCol->len = qptGetColumnRandLen(pCol->dtype); + pCol->inUse = 0; + pCol->hasIndex = QPT_RAND_BOOL_V; + pCol->isPrimTs = QPT_RAND_BOOL_V; + pCol->isPk = QPT_RAND_BOOL_V; + pCol->colType = COLUMN_TYPE_TBNAME; + + qptNodesListMakeStrictAppend(ppList, (SNode *)pCol); continue; } + + qptInitSingleTableCol(pCol, i, colType); - sprintf(pCol[i].name, "col%d", i); - pCol[i].type = taosRand() % TSDB_DATA_TYPE_MAX; - pCol[i].len = qptGetColumnRandLen(pCol[i].type); - pCol[i].inUse = 0; - pCol[i].hasIndex = QPT_RAND_BOOL_V; - pCol[i].isPrimTs = QPT_RAND_BOOL_V; - pCol[i].isPk = QPT_RAND_BOOL_V; - pCol[i].colType = colType; + qptNodesListMakeStrictAppend(ppList, (SNode *)pCol); } } -void qptInitTestCtx(bool correctExpected, bool singleNode, int32_t nodeType, int32_t paramNum, SQPTNodeParam* nodeParam) { +void qptInitTestCtx(bool correctExpected, bool singleNode, int32_t nodeType, int32_t nodeIdx, int32_t paramNum, SQPTNodeParam* nodeParam) { qptCtx.param.correctExpected = correctExpected; + qptCtx.param.schedulerId = taosRand(); qptCtx.param.plan.singlePhysiNode = singleNode; + if (singleNode) { qptCtx.param.plan.subplanMaxLevel = 1; qptCtx.param.plan.subplanType[0] = nodeType; + qptCtx.param.plan.subplanIdx[0] = nodeIdx; } else { qptCtx.param.plan.subplanMaxLevel = taosRand() % QPT_MAX_SUBPLAN_LEVEL + 1; for (int32_t i = 0; i < qptCtx.param.plan.subplanMaxLevel; ++i) { - qptCtx.param.plan.subplanType[i] = QPT_PHYSIC_NODE_LIST[taosRand() % QPT_PHYSIC_NODE_NUM()]; + nodeIdx = taosRand() % QPT_PHYSIC_NODE_NUM(); + qptCtx.param.plan.subplanType[i] = qptPlans[nodeIdx].type; + qptCtx.param.plan.subplanIdx[i] = nodeIdx; } } @@ -1746,55 +2558,73 @@ void qptInitTestCtx(bool correctExpected, bool singleNode, int32_t nodeType, int strcpy(qptCtx.param.db.dbName, "qptdb1"); qptCtx.param.vnode.vnodeNum = QPT_DEFAULT_VNODE_NUM; + qptCtx.param.vnode.vgId = 1; + qptCtx.param.vnode.epSet.numOfEps = 1; + qptCtx.param.vnode.epSet.inUse = 0; + strcpy(qptCtx.param.vnode.epSet.eps[0].fqdn, "127.0.0.1"); + qptCtx.param.vnode.epSet.eps[0].port = 6030; qptCtx.param.tbl.uid = 100; qptCtx.param.tbl.suid = 1; qptGetRandRealTableType(&qptCtx.param.tbl.tblType); - qptCtx.param.tbl.colNum = taosRand() % 4098; - qptCtx.param.tbl.tagNum = taosRand() % 130; + qptCtx.param.tbl.colNum = taosRand() % 4096 + 1; + qptCtx.param.tbl.tagNum = taosRand() % 128 + 1; qptCtx.param.tbl.pkNum = taosRand() % 2; strcpy(qptCtx.param.tbl.tblName, "qpttbl1"); strcpy(qptCtx.param.tbl.tblName, "tbl1"); - qptCtx.param.tbl.pCol = (SQPTCol*)taosMemoryCalloc(qptCtx.param.tbl.colNum, sizeof(*qptCtx.param.tbl.pCol)); - assert(qptCtx.param.tbl.pCol); - qptInitTableCols(qptCtx.param.tbl.pCol, qptCtx.param.tbl.colNum, COLUMN_TYPE_COLUMN); - - qptCtx.param.tbl.pTag = (SQPTCol*)taosMemoryCalloc(qptCtx.param.tbl.tagNum, sizeof(*qptCtx.param.tbl.pTag)); - assert(qptCtx.param.tbl.pTag); - qptInitTableCols(qptCtx.param.tbl.pTag, qptCtx.param.tbl.tagNum, COLUMN_TYPE_TAG); + qptInitTableCols(&qptCtx.param.tbl.pColList, qptCtx.param.tbl.colNum, COLUMN_TYPE_COLUMN); + qptInitTableCols(&qptCtx.param.tbl.pTagList, qptCtx.param.tbl.tagNum, COLUMN_TYPE_TAG); + + SNode* pTmp = NULL; + FOREACH(pTmp, qptCtx.param.tbl.pColList) { + qptNodesListMakeStrictAppend(&qptCtx.param.tbl.pColTagList, pTmp); + } + FOREACH(pTmp, qptCtx.param.tbl.pTagList) { + qptNodesListMakeStrictAppend(&qptCtx.param.tbl.pColTagList, pTmp); + } } +void qptDestroyTestCtx() { + SNode* pTmp = NULL; + FOREACH(pTmp, qptCtx.param.tbl.pColList) { + qptNodesFree(pTmp); + } + FOREACH(pTmp, qptCtx.param.tbl.pTagList) { + qptNodesFree(pTmp); + } + nodesClearList(qptCtx.param.tbl.pColList); + nodesClearList(qptCtx.param.tbl.pTagList); + nodesClearList(qptCtx.param.tbl.pColTagList); + + qptCtx.param.tbl.pColList = NULL; + qptCtx.param.tbl.pTagList = NULL; + qptCtx.param.tbl.pColTagList = NULL; +} } // namespace #if 1 -#if 0 -TEST(randSingleNodeTest, tagScan) { - char* caseName = "randSingleNodeTest:tagScan"; +#if 1 +TEST(singleNodeTest, randPlan) { + char* caseType = "singleNodeTest:randPlan"; - qptInitTestCtx(false, true, QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN, 0, NULL); - for (qptCtx.loopIdx = 0; qptCtx.loopIdx < QPT_MAX_LOOP; ++qptCtx.loopIdx) { - qptRunPlanTest(caseName); + for (int32_t i = 0; i < sizeof(qptPlans)/sizeof(qptPlans[0]); ++i) { + sprintf(qptCtx.caseName, "%s:%s", caseType, qptPlans[i].name); + qptInitTestCtx(false, true, qptPlans[i].type, i, 0, NULL); + + qptRunPlanTest(); + + qptDestroyTestCtx(); + } } - qptPrintStatInfo(caseName); + qptPrintStatInfo(); } #endif -#if 1 -TEST(randSingleNodeTest, projection) { - char* caseName = "randSingleNodeTest:projection"; - qptInitTestCtx(false, true, QUERY_NODE_PHYSICAL_PLAN_PROJECT, 0, NULL); - - for (qptCtx.loopIdx = 0; qptCtx.loopIdx < QPT_MAX_LOOP; ++qptCtx.loopIdx) { - qptRunPlanTest(caseName); - } - qptPrintStatInfo(caseName); -} -#endif diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c index 1b6399851379..382584bb7614 100644 --- a/source/libs/nodes/src/nodesUtilFuncs.c +++ b/source/libs/nodes/src/nodesUtilFuncs.c @@ -691,6 +691,8 @@ int32_t nodesMakeNode(ENodeType type, SNode** ppNodeOut) { code = makeNode(type, sizeof(SGroupSortPhysiNode), &pNode); break; case QUERY_NODE_PHYSICAL_PLAN_HASH_INTERVAL: code = makeNode(type, sizeof(SIntervalPhysiNode), &pNode); break; + case QUERY_NODE_PHYSICAL_PLAN_MERGE_INTERVAL: + code = makeNode(type, sizeof(SMergeIntervalPhysiNode), &pNode); break; case QUERY_NODE_PHYSICAL_PLAN_MERGE_ALIGNED_INTERVAL: code = makeNode(type, sizeof(SMergeAlignedIntervalPhysiNode), &pNode); break; case QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL: @@ -1619,6 +1621,7 @@ void nodesDestroyNode(SNode* pNode) { break; } case QUERY_NODE_PHYSICAL_PLAN_HASH_INTERVAL: + case QUERY_NODE_PHYSICAL_PLAN_MERGE_INTERVAL: case QUERY_NODE_PHYSICAL_PLAN_MERGE_ALIGNED_INTERVAL: case QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL: case QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL: From 0002ede469c58c20a8064f44f42d2b0d2c388354 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Wed, 16 Oct 2024 10:19:40 +0800 Subject: [PATCH 127/695] enh:[TS-5441] cost too long in tmq write meta data by cache meta and vg info --- source/client/src/clientRawBlockWrite.c | 116 ++++++++++++++---------- 1 file changed, 70 insertions(+), 46 deletions(-) diff --git a/source/client/src/clientRawBlockWrite.c b/source/client/src/clientRawBlockWrite.c index 6764dbfea53a..6c54c3aa691a 100644 --- a/source/client/src/clientRawBlockWrite.c +++ b/source/client/src/clientRawBlockWrite.c @@ -1852,10 +1852,14 @@ static int32_t buildCreateTbMap(SMqDataRsp* rsp, SHashObj* pHashObj) { return code; } -static threadlocal SHashObj* pVgHash = NULL; -//static threadlocal SHashObj* pCreateTbHash = NULL; -static threadlocal SHashObj* pNameHash = NULL; -static threadlocal SHashObj* pMetaHash = NULL; +static SHashObj* writeRawCache = NULL; +static int8_t initFlag = 0; + +typedef struct{ + SHashObj* pVgHash; + SHashObj* pNameHash; + SHashObj* pMetaHash; +}rawCacheInfo; typedef struct{ SVgroupInfo vgInfo; @@ -1863,6 +1867,29 @@ typedef struct{ int64_t suid; }tbInfo; +static void tmqFreeMeta(void *data){ + STableMeta* pTableMeta = *(STableMeta**)data; + taosMemoryFree(pTableMeta); +} + +static void freeRawCache(void *data) { + rawCacheInfo* pRawCache = (rawCacheInfo*)data; + taosHashCleanup(pRawCache->pMetaHash); + taosHashCleanup(pRawCache->pNameHash); + taosHashCleanup(pRawCache->pVgHash); +} + +static int32_t initRawCacheHash(){ + if (writeRawCache == NULL){ + writeRawCache = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_NO_LOCK); + if (writeRawCache == NULL){ + return terrno; + } + taosHashSetFreeFp(writeRawCache, freeRawCache); + } + return 0; +} + static bool needRefreshMeta(void* rawData, STableMeta* pTableMeta, SSchemaWrapper* pSW){ char* p = (char*)rawData; // | version | total length | total rows | blankFill | total columns | flag seg| block group id | column schema | each @@ -1899,6 +1926,34 @@ static bool needRefreshMeta(void* rawData, STableMeta* pTableMeta, SSchemaWrappe return false; } +static int32_t getRawCache(SHashObj **pVgHash, SHashObj **pNameHash, SHashObj **pMetaHash, void *key) { + int32_t code = 0; + void* cacheInfo = taosHashGet(writeRawCache, &key, POINTER_BYTES); + if (cacheInfo == NULL){ + *pVgHash = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, HASH_NO_LOCK); + RAW_NULL_CHECK(*pVgHash); + *pNameHash = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK); + RAW_NULL_CHECK(*pNameHash); + *pMetaHash = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), true, HASH_NO_LOCK); + RAW_NULL_CHECK(*pMetaHash); + taosHashSetFreeFp(*pMetaHash, tmqFreeMeta); + rawCacheInfo info = {*pVgHash, *pNameHash, *pMetaHash}; + RAW_RETURN_CHECK(taosHashPut(writeRawCache, &key, POINTER_BYTES, &info, sizeof(rawCacheInfo))); + } else { + rawCacheInfo *info = (rawCacheInfo *)cacheInfo; + *pVgHash = info->pVgHash; + *pNameHash = info->pNameHash; + *pMetaHash = info->pMetaHash; + } + + return 0; +end: + taosHashCleanup(*pMetaHash); + taosHashCleanup(*pNameHash); + taosHashCleanup(*pVgHash); + return code; +} + static int32_t tmqWriteRawImpl(TAOS* taos, uint16_t type, void* data, int32_t dataLen) { if (taos == NULL || data == NULL) { SET_ERROR_MSG("taos:%p or data:%p is NULL", taos, data); @@ -1951,6 +2006,10 @@ static int32_t tmqWriteRawImpl(TAOS* taos, uint16_t type, void* data, int32_t da RAW_RETURN_CHECK(buildCreateTbMap(&rspObj.dataRsp, pCreateTbHash)); } + SHashObj *pVgHash = NULL; + SHashObj *pNameHash = NULL; + SHashObj *pMetaHash = NULL; + RAW_RETURN_CHECK(getRawCache(&pVgHash, &pNameHash, &pMetaHash, taos)); int retry = 0; while(1){ RAW_RETURN_CHECK(smlInitHandle(&pQuery)); @@ -1965,9 +2024,6 @@ static int32_t tmqWriteRawImpl(TAOS* taos, uint16_t type, void* data, int32_t da const char* tbName = (const char*)taosArrayGetP(rspObj.dataRsp.blockTbName, rspObj.resIter); RAW_NULL_CHECK(tbName); -// int64_t* suid = taosArrayGet(rspObj.dataRsp.blockSuid, rspObj.resIter); -// RAW_NULL_CHECK(suid); - uDebug(LOG_ID_TAG " write raw data block tbname:%s", LOG_ID_VALUE, tbName); SName pName = {TSDB_TABLE_NAME_T, pRequest->pTscObj->acctId, {0}, {0}}; (void)strcpy(pName.dbname, pRequest->pDb); @@ -2274,47 +2330,15 @@ void tmq_free_raw(tmq_raw_data raw) { (void)memset(terrMsg, 0, ERR_MSG_LEN); } -static void tmqFreeMeta(void *data){ - STableMeta* pTableMeta = *(STableMeta**)data; - taosMemoryFree(pTableMeta); -} - -void freeHash() { - taosHashCleanup(pMetaHash); - taosHashCleanup(pNameHash); - taosHashCleanup(pVgHash); -} - -static int32_t initHash(){ - int32_t code = 0; - if (pVgHash == NULL){ - pVgHash = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, HASH_NO_LOCK); - RAW_NULL_CHECK(pVgHash); - } -// if (pCreateTbHash == NULL){ -// pCreateTbHash = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_NO_LOCK); -// RAW_NULL_CHECK(pCreateTbHash); -// } - if (pNameHash == NULL){ - pNameHash = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK); - RAW_NULL_CHECK(pNameHash); - } - if (pMetaHash == NULL){ - pMetaHash = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), true, HASH_NO_LOCK); - RAW_NULL_CHECK(pMetaHash); - taosHashSetFreeFp(pMetaHash, tmqFreeMeta); - } - return code; -end: - freeHash(); - return code; -} - static int32_t writeRawImpl(TAOS* taos, void* buf, uint32_t len, uint16_t type) { - int32_t code = initHash(); - if (code != 0) { - return code; + int8_t old = atomic_val_compare_exchange_8(&initFlag, 0, 1); + if (old == 0) { + int32_t code = initRawCacheHash(); + if (code != 0) { + return code; + } } + if (type == TDMT_VND_CREATE_STB) { return taosCreateStb(taos, buf, len); } else if (type == TDMT_VND_ALTER_STB) { From c39042b643d3fa780cf5e5a22be3a83dcd6ad24a Mon Sep 17 00:00:00 2001 From: the5fire Date: Wed, 16 Oct 2024 11:11:12 +0800 Subject: [PATCH 128/695] fix typo: 365 -> 3650 --- docs/zh/05-basic/01-model.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/zh/05-basic/01-model.md b/docs/zh/05-basic/01-model.md index bcd931df3a5e..f49db1789297 100644 --- a/docs/zh/05-basic/01-model.md +++ b/docs/zh/05-basic/01-model.md @@ -106,7 +106,7 @@ CREATE DATABASE power PRECISION 'ms' KEEP 3650 DURATION 10 BUFFER 16; ``` 该 SQL 将创建一个名为 `power` 的数据库,各参数说明如下: - `PRECISION 'ms'` :这个数据库的时序数据使用毫秒(ms)精度的时间戳 -- `KEEP 365`:这个库的数据将保留 3650 天,超过 3650 天的数据将被自动删除 +- `KEEP 3650`:这个库的数据将保留 3650 天,超过 3650 天的数据将被自动删除 - `DURATION 10` :每 10 天的数据放在一个数据文件中 - `BUFFER 16` :写入使用大小为 16MB 的内存池。 @@ -214,4 +214,4 @@ TDengine 支持灵活的数据模型设计,包括多列模型和单列模型 尽管 TDengine 推荐使用多列模型,因为这种模型在写入效率和存储效率方面通常更优,但在某些特定场景下,单列模型可能更为适用。例如,当一个数据采集点的采集量种类经常发生变化时,如果采用多列模型,就需要频繁修改超级表的结构定义,这会增加应用程序的复杂性。在这种情况下,采用单列模型可以简化应用程序的设计和管理,因为它允许独立地管理和扩展每个物理量的超级表。 -总之,TDengine 提供了灵活的数据模型选项,用户可以根据实际需求和场景选择最适合的模型,以优化性能和管理复杂性。 \ No newline at end of file +总之,TDengine 提供了灵活的数据模型选项,用户可以根据实际需求和场景选择最适合的模型,以优化性能和管理复杂性。 From 3e49f40c748057fa95f2bcccaf9748cc46598305 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Wed, 16 Oct 2024 12:16:59 +0800 Subject: [PATCH 129/695] stream twa --- include/common/tmsg.h | 1 + include/libs/executor/storageapi.h | 13 +- include/libs/nodes/querynodes.h | 1 + include/libs/stream/streamState.h | 7 +- include/libs/stream/tstreamFileState.h | 6 + source/dnode/snode/src/snodeInitApi.c | 10 +- source/dnode/vnode/src/vnd/vnodeInitApi.c | 5 +- source/libs/executor/inc/executorInt.h | 29 + source/libs/executor/inc/streamexecutorInt.h | 26 +- source/libs/executor/src/scanoperator.c | 12 +- source/libs/executor/src/streamfilloperator.c | 333 +++++++++- .../src/streamintervalsliceoperator.c | 591 ++++++++++++++++++ .../executor/src/streamtimesliceoperator.c | 27 +- .../executor/src/streamtimewindowoperator.c | 20 +- source/libs/function/src/builtins.c | 4 +- source/libs/nodes/src/nodesCodeFuncs.c | 7 + source/libs/parser/src/parTranslater.c | 29 + source/libs/stream/inc/streamBackendRocksdb.h | 2 + source/libs/stream/src/streamBackendRocksdb.c | 72 ++- source/libs/stream/src/streamData.c | 6 +- source/libs/stream/src/streamSliceState.c | 17 +- source/libs/stream/src/streamState.c | 14 +- source/libs/stream/src/tstreamFileState.c | 196 +++++- 23 files changed, 1359 insertions(+), 69 deletions(-) create mode 100644 source/libs/executor/src/streamintervalsliceoperator.c diff --git a/include/common/tmsg.h b/include/common/tmsg.h index c07f250a7479..4da4bf2d2da1 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -459,6 +459,7 @@ typedef enum ENodeType { QUERY_NODE_PHYSICAL_PLAN_STREAM_COUNT, QUERY_NODE_PHYSICAL_PLAN_STREAM_MID_INTERVAL, QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERP_FUNC, + QUERY_NODE_PHYSICAL_PLAN_STREAM_CONTINUE_INTERVAL, } ENodeType; typedef struct { diff --git a/include/libs/executor/storageapi.h b/include/libs/executor/storageapi.h index da3a63dcc4fa..929248f5cb35 100644 --- a/include/libs/executor/storageapi.h +++ b/include/libs/executor/storageapi.h @@ -39,9 +39,10 @@ extern "C" { #define META_READER_LOCK 0x0 #define META_READER_NOLOCK 0x1 -#define STREAM_STATE_BUFF_HASH 1 -#define STREAM_STATE_BUFF_SORT 2 -#define STREAM_STATE_BUFF_HASH_SORT 3 +#define STREAM_STATE_BUFF_HASH 1 +#define STREAM_STATE_BUFF_SORT 2 +#define STREAM_STATE_BUFF_HASH_SORT 3 +#define STREAM_STATE_BUFF_HASH_SEARCH 4 typedef struct SMeta SMeta; typedef TSKEY (*GetTsFun)(void*); @@ -341,6 +342,8 @@ typedef struct SStateStore { void (*streamStateReleaseBuf)(SStreamState* pState, void* pVal, bool used); void (*streamStateClearBuff)(SStreamState* pState, void* pVal); void (*streamStateFreeVal)(void* val); + int32_t (*streamStateGetPrev)(SStreamState* pState, const SWinKey* pKey, SWinKey* pResKey, void** pVal, + int32_t* pVLen, int32_t* pWinCode); int32_t (*streamStatePut)(SStreamState* pState, const SWinKey* key, const void* value, int32_t vLen); int32_t (*streamStateGet)(SStreamState* pState, const SWinKey* key, void** pVal, int32_t* pVLen, int32_t* pWinCode); @@ -372,9 +375,11 @@ typedef struct SStateStore { SStreamStateCur* (*streamStateFillSeekKeyPrev)(SStreamState* pState, const SWinKey* key); void (*streamStateFreeCur)(SStreamStateCur* pCur); - int32_t (*streamStateGetGroupKVByCur)(SStreamStateCur* pCur, SWinKey* pKey, const void** pVal, int32_t* pVLen); + int32_t (*streamStateFillGetGroupKVByCur)(SStreamStateCur* pCur, SWinKey* pKey, const void** pVal, int32_t* pVLen); int32_t (*streamStateGetKVByCur)(SStreamStateCur* pCur, SWinKey* pKey, const void** pVal, int32_t* pVLen); + void (*streamStateClearExpiredState)(SStreamState* pState); + int32_t (*streamStateSessionAddIfNotExist)(SStreamState* pState, SSessionKey* key, TSKEY gap, void** pVal, int32_t* pVLen, int32_t* pWinCode); int32_t (*streamStateSessionPut)(SStreamState* pState, const SSessionKey* key, void* value, int32_t vLen); diff --git a/include/libs/nodes/querynodes.h b/include/libs/nodes/querynodes.h index f5567c735e90..1095dcd81c7f 100644 --- a/include/libs/nodes/querynodes.h +++ b/include/libs/nodes/querynodes.h @@ -448,6 +448,7 @@ typedef struct SSelectStmt { bool hasCountFunc; bool hasUdaf; bool hasStateKey; + bool hasTwaOrElapsedFunc; bool onlyHasKeepOrderFunc; bool groupSort; bool tagScan; diff --git a/include/libs/stream/streamState.h b/include/libs/stream/streamState.h index be5c83b503ca..3b05e3abf20a 100644 --- a/include/libs/stream/streamState.h +++ b/include/libs/stream/streamState.h @@ -49,6 +49,8 @@ void streamStateClear(SStreamState* pState); void streamStateSetNumber(SStreamState* pState, int32_t number, int32_t tsIdex); void streamStateSaveInfo(SStreamState* pState, void* pKey, int32_t keyLen, void* pVal, int32_t vLen); int32_t streamStateGetInfo(SStreamState* pState, void* pKey, int32_t keyLen, void** pVal, int32_t* pLen); +int32_t streamStateGetPrev(SStreamState* pState, const SWinKey* pKey, SWinKey* pResKey, void** pVal, int32_t* pVLen, + int32_t* pWinCode); // session window int32_t streamStateSessionAddIfNotExist(SStreamState* pState, SSessionKey* key, TSKEY gap, void** pVal, int32_t* pVLen, @@ -102,9 +104,12 @@ SStreamStateCur* streamStateFillSeekKeyPrev(SStreamState* pState, const SWinKey* void streamStateFreeCur(SStreamStateCur* pCur); void streamStateResetCur(SStreamStateCur* pCur); -int32_t streamStateGetGroupKVByCur(SStreamStateCur* pCur, SWinKey* pKey, const void** pVal, int32_t* pVLen); +int32_t streamStateFillGetGroupKVByCur(SStreamStateCur* pCur, SWinKey* pKey, const void** pVal, int32_t* pVLen); int32_t streamStateGetKVByCur(SStreamStateCur* pCur, SWinKey* pKey, const void** pVal, int32_t* pVLen); +// twa +void streamStateClearExpiredState(SStreamState* pState); + void streamStateCurNext(SStreamState* pState, SStreamStateCur* pCur); void streamStateCurPrev(SStreamState* pState, SStreamStateCur* pCur); diff --git a/include/libs/stream/tstreamFileState.h b/include/libs/stream/tstreamFileState.h index 64cb0456c9fb..a6f55fca7629 100644 --- a/include/libs/stream/tstreamFileState.h +++ b/include/libs/stream/tstreamFileState.h @@ -142,6 +142,12 @@ int32_t streamFileStateGroupPut(SStreamFileState* pFileState, int64_t groupId, v void streamFileStateGroupCurNext(SStreamStateCur* pCur); int32_t streamFileStateGroupGetKVByCur(SStreamStateCur* pCur, int64_t* pKey, void** pVal, int32_t* pVLen); SSHashObj* getGroupIdCache(SStreamFileState* pFileState); +int fillStateKeyCompare(const void* pWin1, const void* pDatas, int pos); +int32_t getRowStatePrevRow(SStreamFileState* pFileState, const SWinKey* pKey, SWinKey* pResKey, void** ppVal, + int32_t* pVLen, int32_t* pWinCode); + +//twa +void clearExpiredState(SStreamFileState* pFileState); #ifdef __cplusplus } diff --git a/source/dnode/snode/src/snodeInitApi.c b/source/dnode/snode/src/snodeInitApi.c index 5485c000d1c5..628b4b392d3b 100644 --- a/source/dnode/snode/src/snodeInitApi.c +++ b/source/dnode/snode/src/snodeInitApi.c @@ -46,6 +46,7 @@ void initStateStoreAPI(SStateStore* pStore) { pStore->streamStateSaveInfo = streamStateSaveInfo; pStore->streamStateGetInfo = streamStateGetInfo; pStore->streamStateSetNumber = streamStateSetNumber; + pStore->streamStateGetPrev = streamStateGetPrev; pStore->streamStateFillPut = streamStateFillPut; pStore->streamStateFillGet = streamStateFillGet; @@ -63,9 +64,11 @@ void initStateStoreAPI(SStateStore* pStore) { pStore->streamStateFillSeekKeyPrev = streamStateFillSeekKeyPrev; pStore->streamStateFreeCur = streamStateFreeCur; - pStore->streamStateGetGroupKVByCur = streamStateGetGroupKVByCur; + pStore->streamStateFillGetGroupKVByCur = streamStateFillGetGroupKVByCur; pStore->streamStateGetKVByCur = streamStateGetKVByCur; + pStore->streamStateClearExpiredState = streamStateClearExpiredState; + pStore->streamStateSessionAddIfNotExist = streamStateSessionAddIfNotExist; pStore->streamStateSessionPut = streamStateSessionPut; pStore->streamStateSessionGet = streamStateSessionGet; @@ -78,11 +81,6 @@ void initStateStoreAPI(SStateStore* pStore) { pStore->streamStateCountGetKeyByRange = streamStateCountGetKeyByRange; pStore->streamStateSessionAllocWinBuffByNextPosition = streamStateSessionAllocWinBuffByNextPosition; - // void initStreamStateAPI(SStorageAPI* pAPI) { - // initStateStoreAPI(&pAPI->stateStore); - // initFunctionStateStore(&pAPI->functionStore); - // } - pStore->updateInfoInit = updateInfoInit; pStore->updateInfoFillBlockData = updateInfoFillBlockData; pStore->updateInfoIsUpdated = updateInfoIsUpdated; diff --git a/source/dnode/vnode/src/vnd/vnodeInitApi.c b/source/dnode/vnode/src/vnd/vnodeInitApi.c index 02e1a59c2277..3a36dacbf038 100644 --- a/source/dnode/vnode/src/vnd/vnodeInitApi.c +++ b/source/dnode/vnode/src/vnd/vnodeInitApi.c @@ -162,6 +162,7 @@ void initStateStoreAPI(SStateStore* pStore) { pStore->streamStateSaveInfo = streamStateSaveInfo; pStore->streamStateGetInfo = streamStateGetInfo; pStore->streamStateSetNumber = streamStateSetNumber; + pStore->streamStateGetPrev = streamStateGetPrev; pStore->streamStateFillPut = streamStateFillPut; pStore->streamStateFillGet = streamStateFillGet; @@ -179,9 +180,11 @@ void initStateStoreAPI(SStateStore* pStore) { pStore->streamStateFillSeekKeyPrev = streamStateFillSeekKeyPrev; pStore->streamStateFreeCur = streamStateFreeCur; - pStore->streamStateGetGroupKVByCur = streamStateGetGroupKVByCur; + pStore->streamStateFillGetGroupKVByCur = streamStateFillGetGroupKVByCur; pStore->streamStateGetKVByCur = streamStateGetKVByCur; + pStore->streamStateClearExpiredState = streamStateClearExpiredState; + pStore->streamStateSessionAddIfNotExist = streamStateSessionAddIfNotExist; pStore->streamStateSessionPut = streamStateSessionPut; pStore->streamStateSessionGet = streamStateSessionGet; diff --git a/source/libs/executor/inc/executorInt.h b/source/libs/executor/inc/executorInt.h index 2427a3d42a31..a0ad574d54c3 100644 --- a/source/libs/executor/inc/executorInt.h +++ b/source/libs/executor/inc/executorInt.h @@ -536,6 +536,7 @@ typedef struct SStreamScanInfo { SSDataBlock* pCheckpointRes; int8_t pkColType; int32_t pkColLen; + bool useGetResultRange; } SStreamScanInfo; typedef struct { @@ -818,6 +819,10 @@ typedef struct SStreamFillOperatorInfo { int32_t primaryTsCol; int32_t primarySrcSlotId; SStreamFillInfo* pFillInfo; + SStreamAggSupporter* pStreamAggSup; + SArray* pCloseTs; + SArray* pUpdated; + SGroupResInfo groupResInfo; } SStreamFillOperatorInfo; typedef struct SStreamTimeSliceOperatorInfo { @@ -850,8 +855,32 @@ typedef struct SStreamTimeSliceOperatorInfo { SGroupResInfo groupResInfo; bool ignoreNull; bool isHistoryOp; + struct SOperatorInfo* pOperator; } SStreamTimeSliceOperatorInfo; +typedef struct SStreamIntervalSliceOperatorInfo { + SSteamOpBasicInfo basic; + SOptrBasicInfo binfo; + STimeWindowAggSupp twAggSup; + SStreamAggSupporter streamAggSup; + SExprSupp scalarSup; + SInterval interval; + bool recvCkBlock; + SSDataBlock* pCheckpointRes; + int32_t primaryTsIndex; + SSHashObj* pUpdatedMap; // SWinKey + SArray* pUpdated; // SWinKey + SSHashObj* pDeletedMap; + SArray* pDelWins; + SSDataBlock* pDelRes; + int32_t delIndex; + bool destHasPrimaryKey; + int64_t endTs; + SGroupResInfo groupResInfo; + struct SOperatorInfo* pOperator; + bool hasFill; +} SStreamIntervalSliceOperatorInfo; + #define OPTR_IS_OPENED(_optr) (((_optr)->status & OP_OPENED) == OP_OPENED) #define OPTR_SET_OPENED(_optr) ((_optr)->status |= OP_OPENED) diff --git a/source/libs/executor/inc/streamexecutorInt.h b/source/libs/executor/inc/streamexecutorInt.h index 29e165631d09..1acfb4d2050f 100644 --- a/source/libs/executor/inc/streamexecutorInt.h +++ b/source/libs/executor/inc/streamexecutorInt.h @@ -30,6 +30,16 @@ extern "C" { #define HAS_NON_ROW_DATA(pRowData) (pRowData->key == INT64_MIN) #define HAS_ROW_DATA(pRowData) (pRowData && pRowData->key != INT64_MIN) +#define IS_INVALID_WIN_KEY(ts) ((ts) == INT64_MIN) +#define IS_VALID_WIN_KEY(ts) ((ts) != INT64_MIN) +#define SET_WIN_KEY_INVALID(ts) ((ts) = INT64_MIN) + +#define IS_NORMAL_INTERVAL_OP(op) \ + ((op)->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL || \ + (op)->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL) + +#define IS_CONTINUE_INTERVAL_OP(op) ((op)->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_CONTINUE_INTERVAL) + typedef struct SSliceRowData { TSKEY key; char pRowVal[]; @@ -73,9 +83,23 @@ int32_t checkResult(SStreamFillSupporter* pFillSup, TSKEY ts, uint64_t groupId, void resetStreamFillSup(SStreamFillSupporter* pFillSup); void setPointBuff(SSlicePoint* pPoint, SStreamFillSupporter* pFillSup); +int32_t saveTimeSliceWinResult(SWinKey* pKey, SSHashObj* pUpdatedMap); + int winPosCmprImpl(const void* pKey1, const void* pKey2); -void reuseOutputBuf(void* pState, SRowBuffPos* pPos, SStateStore* pAPI); +void reuseOutputBuf(void* pState, SRowBuffPos* pPos, SStateStore* pAPI); +SResultCellData* getSliceResultCell(SResultCellData* pRowVal, int32_t index); +int32_t getDownstreamRes(struct SOperatorInfo* downstream, SSDataBlock** ppRes, SColumnInfo** ppPkCol); +void destroyFlusedppPos(void* ppRes); +void doBuildStreamIntervalResult(struct SOperatorInfo* pOperator, void* pState, SSDataBlock* pBlock, + SGroupResInfo* pGroupResInfo); +void transBlockToSliceResultRow(const SSDataBlock* pBlock, int32_t rowId, TSKEY ts, SSliceRowData* pRowVal, + int32_t rowSize, void* pPkData, SColumnInfoData* pPkCol); +int32_t getQualifiedRowNumDesc(SExprSupp* pExprSup, SSDataBlock* pBlock, TSKEY* tsCols, int32_t rowId, bool ignoreNull); + +int32_t createStreamIntervalSliceOperatorInfo(struct SOperatorInfo* downstream, SPhysiNode* pPhyNode, + SExecTaskInfo* pTaskInfo, SReadHandle* pHandle, + struct SOperatorInfo** ppOptInfo); #ifdef __cplusplus } diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 670956ab8010..f10cb14686d4 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -25,6 +25,7 @@ #include "tdatablock.h" #include "tmsg.h" +#include "ttime.h" #include "operator.h" #include "query.h" @@ -3397,9 +3398,7 @@ static bool isStreamWindow(SStreamScanInfo* pInfo) { isTimeSlice(pInfo); } -static int32_t copyGetResultBlock(SSDataBlock* dest, const SSDataBlock* src) { - TSKEY start = src->info.window.skey; - TSKEY end = src->info.window.ekey; +static int32_t copyGetResultBlock(SSDataBlock* dest, TSKEY start, TSKEY end) { int32_t code = blockDataEnsureCapacity(dest, 1); if (code != TSDB_CODE_SUCCESS) { return code; @@ -3635,7 +3634,11 @@ static int32_t doStreamScanNext(SOperatorInfo* pOperator, SSDataBlock** ppRes) { case STREAM_GET_RESULT: { pInfo->blockType = STREAM_INPUT__DATA_SUBMIT; pInfo->updateResIndex = 0; - code = copyGetResultBlock(pInfo->pUpdateRes, pBlock); + TSKEY endKey = taosTimeGetIntervalEnd(pBlock->info.window.skey, &pInfo->interval); + if (pInfo->useGetResultRange == true) { + endKey = pBlock->info.window.ekey; + } + code = copyGetResultBlock(pInfo->pUpdateRes, pBlock->info.window.skey, endKey); QUERY_CHECK_CODE(code, lino, _end); pInfo->pUpdateInfo->maxDataVersion = -1; prepareRangeScan(pInfo, pInfo->pUpdateRes, &pInfo->updateResIndex, NULL); @@ -4445,6 +4448,7 @@ int32_t createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhysiNode* pInfo->stateStore = pTaskInfo->storageAPI.stateStore; pInfo->readerFn = pTaskInfo->storageAPI.tqReaderFn; pInfo->pFillSup = NULL; + pInfo->useGetResultRange = false; code = createSpecialDataBlock(STREAM_CHECKPOINT, &pInfo->pCheckpointRes); QUERY_CHECK_CODE(code, lino, _error); diff --git a/source/libs/executor/src/streamfilloperator.c b/source/libs/executor/src/streamfilloperator.c index 8df8170f3bbb..d3766a5eb569 100644 --- a/source/libs/executor/src/streamfilloperator.c +++ b/source/libs/executor/src/streamfilloperator.c @@ -86,6 +86,9 @@ void* destroyFillColumnInfo(SFillColInfo* pFillCol, int32_t start, int32_t end) } void destroyStreamFillSupporter(SStreamFillSupporter* pFillSup) { + if (pFillSup == NULL) { + return; + } pFillSup->pAllColInfo = destroyFillColumnInfo(pFillSup->pAllColInfo, pFillSup->numOfFillCols, pFillSup->numOfAllCols); tSimpleHashCleanup(pFillSup->pResMap); pFillSup->pResMap = NULL; @@ -139,6 +142,10 @@ static void destroyStreamFillOperatorInfo(void* param) { pInfo->pDelRes = NULL; taosArrayDestroy(pInfo->matchInfo.pList); pInfo->matchInfo.pList = NULL; + taosArrayDestroy(pInfo->pUpdated); + clearGroupResInfo(&pInfo->groupResInfo); + taosArrayDestroy(pInfo->pCloseTs); + taosMemoryFree(pInfo); } @@ -183,7 +190,7 @@ void getWindowFromDiscBuf(SOperatorInfo* pOperator, TSKEY ts, uint64_t groupId, SWinKey preKey = {.ts = INT64_MIN, .groupId = groupId}; void* preVal = NULL; int32_t preVLen = 0; - code = pAPI->stateStore.streamStateGetGroupKVByCur(pCur, &preKey, (const void**)&preVal, &preVLen); + code = pAPI->stateStore.streamStateFillGetGroupKVByCur(pCur, &preKey, (const void**)&preVal, &preVLen); if (code == TSDB_CODE_SUCCESS) { pFillSup->prev.key = preKey.ts; @@ -202,7 +209,7 @@ void getWindowFromDiscBuf(SOperatorInfo* pOperator, TSKEY ts, uint64_t groupId, SWinKey nextKey = {.ts = INT64_MIN, .groupId = groupId}; void* nextVal = NULL; int32_t nextVLen = 0; - code = pAPI->stateStore.streamStateGetGroupKVByCur(pCur, &nextKey, (const void**)&nextVal, &nextVLen); + code = pAPI->stateStore.streamStateFillGetGroupKVByCur(pCur, &nextKey, (const void**)&nextVal, &nextVLen); if (code == TSDB_CODE_SUCCESS) { pFillSup->next.key = nextKey.ts; pFillSup->next.pRowVal = nextVal; @@ -211,7 +218,7 @@ void getWindowFromDiscBuf(SOperatorInfo* pOperator, TSKEY ts, uint64_t groupId, SWinKey nextNextKey = {.groupId = groupId}; void* nextNextVal = NULL; int32_t nextNextVLen = 0; - code = pAPI->stateStore.streamStateGetGroupKVByCur(pCur, &nextNextKey, (const void**)&nextNextVal, &nextNextVLen); + code = pAPI->stateStore.streamStateFillGetGroupKVByCur(pCur, &nextNextKey, (const void**)&nextNextVal, &nextNextVLen); if (code == TSDB_CODE_SUCCESS) { pFillSup->nextNext.key = nextNextKey.ts; pFillSup->nextNext.pRowVal = nextNextVal; @@ -859,7 +866,7 @@ static void getWindowInfoByKey(SStorageAPI* pAPI, void* pState, TSKEY ts, int64_ qDebug("get window info by key failed, Data may be deleted, try next window. ts:%" PRId64 ", groupId:%" PRId64, ts, groupId); SStreamStateCur* pCur = pAPI->stateStore.streamStateFillSeekKeyNext(pState, &key); - code = pAPI->stateStore.streamStateGetGroupKVByCur(pCur, &key, (const void**)&val, &len); + code = pAPI->stateStore.streamStateFillGetGroupKVByCur(pCur, &key, (const void**)&val, &len); pAPI->stateStore.streamStateFreeCur(pCur); qDebug("get window info by key ts:%" PRId64 ", groupId:%" PRId64 ", res%d", ts, groupId, code); } @@ -937,7 +944,7 @@ static int32_t doDeleteFillResult(SOperatorInfo* pOperator) { SWinKey delKey = {.groupId = delGroupId, .ts = delTs}; if (delTs == nextKey.ts) { pAPI->stateStore.streamStateCurNext(pOperator->pTaskInfo->streamInfo.pState, pCur); - winCode = pAPI->stateStore.streamStateGetGroupKVByCur(pCur, &nextKey, NULL, NULL); + winCode = pAPI->stateStore.streamStateFillGetGroupKVByCur(pCur, &nextKey, NULL, NULL); // ts will be deleted later if (delTs != ts) { pAPI->stateStore.streamStateFillDel(pOperator->pTaskInfo->streamInfo.pState, &delKey); @@ -1148,6 +1155,251 @@ static int32_t doStreamFillNext(SOperatorInfo* pOperator, SSDataBlock** ppRes) { return code; } +void doBuildForceFillResultImpl(SOperatorInfo* pOperator, SStreamFillSupporter* pFillSup, + SStreamFillInfo* pFillInfo, SSDataBlock* pBlock, SGroupResInfo* pGroupResInfo) { + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; + SStorageAPI* pAPI = &pOperator->pTaskInfo->storageAPI; + void* pState = pOperator->pTaskInfo->streamInfo.pState; + bool res = false; + int32_t numOfRows = getNumOfTotalRes(pGroupResInfo); + for (; pGroupResInfo->index < numOfRows; pGroupResInfo->index++) { + SWinKey* pKey = (SWinKey*)taosArrayGet(pGroupResInfo->pRows, pGroupResInfo->index); + if (pBlock->info.id.groupId == 0) { + pBlock->info.id.groupId = pKey->groupId; + } else if (pBlock->info.id.groupId != pKey->groupId) { + break; + } + void* val = NULL; + int32_t len = 0; + int32_t winCode = pAPI->stateStore.streamStateFillGet(pOperator->pTaskInfo->streamInfo.pState, pKey, (void**)&val, &len, NULL); + qDebug("===stream=== build force fill res. key:%" PRId64 ",groupId:%" PRId64".res:%d", pKey->ts, pKey->groupId, winCode); + if (winCode == TSDB_CODE_SUCCESS) { + pFillSup->cur.key = pKey->ts; + pFillSup->cur.pRowVal = val; + buildFillResult(&pFillSup->cur, pFillSup, pKey->ts, pBlock, &res); + resetFillWindow(&pFillSup->cur); + } else { + SStreamStateCur* pCur = pAPI->stateStore.streamStateFillSeekKeyPrev(pState, pKey); + SWinKey preKey = {.ts = INT64_MIN, .groupId = pKey->groupId}; + void* preVal = NULL; + int32_t preVLen = 0; + winCode = pAPI->stateStore.streamStateFillGetGroupKVByCur(pCur, &preKey, (const void**)&preVal, &preVLen); + if (winCode == TSDB_CODE_SUCCESS) { + pFillSup->cur.key = pKey->ts; + pFillSup->cur.pRowVal = preVal; + if (pFillInfo->type == TSDB_FILL_PREV) { + code = buildFillResult(&pFillSup->cur, pFillSup, pKey->ts, pBlock, &res); + QUERY_CHECK_CODE(code, lino, _end); + } else { + copyNotFillExpData(pFillSup, pFillInfo); + pFillInfo->pResRow->key = pKey->ts; + code = buildFillResult(pFillInfo->pResRow, pFillSup, pKey->ts, pBlock, &res); + QUERY_CHECK_CODE(code, lino, _end); + } + resetFillWindow(&pFillSup->cur); + } + pAPI->stateStore.streamStateFreeCur(pCur); + } + } + +_end: + if (code != TSDB_CODE_SUCCESS) { + qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } +} + +void doBuildForceFillResult(SOperatorInfo* pOperator, SStreamFillSupporter* pFillSup, SStreamFillInfo* pFillInfo, + SSDataBlock* pBlock, SGroupResInfo* pGroupResInfo) { + blockDataCleanup(pBlock); + if (!hasRemainResults(pGroupResInfo)) { + return; + } + + // clear the existed group id + pBlock->info.id.groupId = 0; + doBuildForceFillResultImpl(pOperator, pFillSup, pFillInfo, pBlock, pGroupResInfo); +} + +static int32_t buildForceFillResult(SOperatorInfo* pOperator, SSDataBlock** ppRes) { + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; + SStreamFillOperatorInfo* pInfo = pOperator->info; + uint16_t opType = pOperator->operatorType; + SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; + + doBuildForceFillResult(pOperator, pInfo->pFillSup, pInfo->pFillInfo, pInfo->pRes, &pInfo->groupResInfo); + if (pInfo->pRes->info.rows != 0) { + printDataBlock(pInfo->pRes, getStreamOpName(opType), GET_TASKID(pTaskInfo)); + (*ppRes) = pInfo->pRes; + goto _end; + } + + (*ppRes) = NULL; + +_end: + if (code != TSDB_CODE_SUCCESS) { + qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } + return code; +} + +// force window close impl +static int32_t doStreamForceFillImpl(SOperatorInfo* pOperator) { + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; + SStreamFillOperatorInfo* pInfo = pOperator->info; + SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; + SStreamFillSupporter* pFillSup = pInfo->pFillSup; + SStreamFillInfo* pFillInfo = pInfo->pFillInfo; + SSDataBlock* pBlock = pInfo->pSrcBlock; + uint64_t groupId = pBlock->info.id.groupId; + SSDataBlock* pRes = pInfo->pRes; + SStreamAggSupporter* pAggSup = pInfo->pStreamAggSup; + SColumnInfoData* pTsCol = taosArrayGet(pInfo->pSrcBlock->pDataBlock, pInfo->primaryTsCol); + TSKEY* tsCol = (TSKEY*)pTsCol->pData; + for (int32_t i = 0; i < pBlock->info.rows; i++){ + code = keepBlockRowInDiscBuf(pOperator, pFillInfo, pBlock, tsCol, i, groupId, pFillSup->rowSize); + QUERY_CHECK_CODE(code, lino, _end); + } + code = pAggSup->stateStore.streamStateGroupPut(pAggSup->pState, groupId, NULL, 0); + QUERY_CHECK_CODE(code, lino, _end); + +_end: + if (code != TSDB_CODE_SUCCESS) { + qError("%s failed at line %d since %s. task:%s", __func__, lino, tstrerror(code), GET_TASKID(pTaskInfo)); + } + return code; +} + +static int32_t buildAllResultKey(SStreamAggSupporter* pAggSup, TSKEY ts, SArray* pUpdated) { + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; + int64_t groupId = 0; + SStreamStateCur* pCur = pAggSup->stateStore.streamStateGroupGetCur(pAggSup->pState); + while (1) { + int32_t winCode = pAggSup->stateStore.streamStateGroupGetKVByCur(pCur, &groupId, NULL, NULL); + if (winCode != TSDB_CODE_SUCCESS) { + break; + } + SWinKey key = {.ts = ts, .groupId = groupId}; + void* pPushRes = taosArrayPush(pUpdated, &key); + QUERY_CHECK_NULL(pPushRes, code, lino, _end, terrno); + + pAggSup->stateStore.streamStateGroupCurNext(pCur); + } + pAggSup->stateStore.streamStateFreeCur(pCur); + pCur = NULL; + +_end: + if (code != TSDB_CODE_SUCCESS) { + pAggSup->stateStore.streamStateFreeCur(pCur); + pCur = NULL; + qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } + return code; +} + +// force window close +static int32_t doStreamForceFillNext(SOperatorInfo* pOperator, SSDataBlock** ppRes) { + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; + SStreamFillOperatorInfo* pInfo = pOperator->info; + SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; + + if (pOperator->status == OP_EXEC_DONE) { + (*ppRes) = NULL; + return code; + } + + if (pOperator->status == OP_RES_TO_RETURN) { + SSDataBlock* resBlock = NULL; + code = buildForceFillResult(pOperator, &resBlock); + QUERY_CHECK_CODE(code, lino, _end); + + if (resBlock != NULL) { + (*ppRes) = resBlock; + goto _end; + } + + pInfo->pStreamAggSup->stateStore.streamStateClearExpiredState(pInfo->pStreamAggSup->pState); + setStreamOperatorCompleted(pOperator); + (*ppRes) = NULL; + goto _end; + } + + SSDataBlock* fillResult = NULL; + SOperatorInfo* downstream = pOperator->pDownstream[0]; + while (1) { + SSDataBlock* pBlock = getNextBlockFromDownstream(pOperator, 0); + if (pBlock == NULL) { + pOperator->status = OP_RES_TO_RETURN; + qDebug("===stream===return data:%s.", getStreamOpName(pOperator->operatorType)); + break; + } + printSpecDataBlock(pBlock, getStreamOpName(pOperator->operatorType), "recv", GET_TASKID(pTaskInfo)); + setStreamOperatorState(&pInfo->basic, pBlock->info.type); + + switch (pBlock->info.type) { + case STREAM_NORMAL: + case STREAM_INVALID: { + code = doApplyStreamScalarCalculation(pOperator, pBlock, pInfo->pSrcBlock); + QUERY_CHECK_CODE(code, lino, _end); + + memcpy(pInfo->pSrcBlock->info.parTbName, pBlock->info.parTbName, TSDB_TABLE_NAME_LEN); + pInfo->srcRowIndex = -1; + } break; + case STREAM_CHECKPOINT: + case STREAM_CREATE_CHILD_TABLE: { + (*ppRes) = pBlock; + goto _end; + } break; + case STREAM_GET_RESULT: { + void* pPushRes = taosArrayPush(pInfo->pCloseTs, &pBlock->info.window.skey); + QUERY_CHECK_NULL(pPushRes, code, lino, _end, terrno); + continue; + } + default: + code = TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR; + QUERY_CHECK_CODE(code, lino, _end); + } + + doStreamForceFillImpl(pOperator); + } + + for (int32_t i = 0; i < taosArrayGetSize(pInfo->pCloseTs); i++) { + TSKEY ts = *(TSKEY*) taosArrayGet(pInfo->pCloseTs, i); + code = buildAllResultKey(pInfo->pStreamAggSup, ts, pInfo->pUpdated); + QUERY_CHECK_CODE(code, lino, _end); + } + taosArrayClear(pInfo->pCloseTs); + taosArraySort(pInfo->pUpdated, winKeyCmprImpl); + + initMultiResInfoFromArrayList(&pInfo->groupResInfo, pInfo->pUpdated); + pInfo->groupResInfo.freeItem = false; + + pInfo->pUpdated = taosArrayInit(1024, sizeof(SWinKey)); + QUERY_CHECK_NULL(pInfo->pUpdated, code, lino, _end, terrno); + + code = blockDataEnsureCapacity(pInfo->pRes, pOperator->resultInfo.capacity); + QUERY_CHECK_CODE(code, lino, _end); + + code = buildForceFillResult(pOperator, ppRes); + QUERY_CHECK_CODE(code, lino, _end); + + if ((*ppRes) == NULL) { + pInfo->pStreamAggSup->stateStore.streamStateClearExpiredState(pInfo->pStreamAggSup->pState); + setStreamOperatorCompleted(pOperator); + } + +_end: + if (code != TSDB_CODE_SUCCESS) { + qError("%s failed at line %d since %s. task:%s", __func__, lino, tstrerror(code), GET_TASKID(pTaskInfo)); + pTaskInfo->code = code; + } + return code; +} + static int32_t initResultBuf(SSDataBlock* pInputRes, SStreamFillSupporter* pFillSup) { int32_t numOfCols = taosArrayGetSize(pInputRes->pDataBlock); pFillSup->rowSize = sizeof(SResultCellData) * numOfCols; @@ -1370,6 +1622,50 @@ static void setValueForFillInfo(SStreamFillSupporter* pFillSup, SStreamFillInfo* } } +int32_t getDownStreamInfo(SOperatorInfo* downstream, int8_t* triggerType, SInterval* pInterval, SStreamAggSupporter** ppAggSup) { + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; + if (IS_NORMAL_INTERVAL_OP(downstream)) { + SStreamIntervalOperatorInfo* pInfo = downstream->info; + *triggerType = pInfo->twAggSup.calTrigger; + *pInterval = pInfo->interval; + (*ppAggSup) = NULL; + } else if (IS_CONTINUE_INTERVAL_OP(downstream)) { + SStreamIntervalSliceOperatorInfo* pInfo = downstream->info; + *triggerType = pInfo->twAggSup.calTrigger; + *pInterval = pInfo->interval; + pInfo->hasFill = true; + (*ppAggSup) = &pInfo->streamAggSup; + } else { + code = TSDB_CODE_STREAM_INTERNAL_ERROR; + } + QUERY_CHECK_CODE(code, lino, _end); + +_end: + if (code != TSDB_CODE_SUCCESS) { + qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } + return code; +} + +int32_t initForceFillDownStream(SOperatorInfo* downstream) { + SExecTaskInfo* pTaskInfo = downstream->pTaskInfo; + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; + + if (downstream == NULL) { + return TSDB_CODE_STREAM_INTERNAL_ERROR; + } + + if (downstream->operatorType != QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN) { + code = initForceFillDownStream(downstream->pDownstream[0]); + return code; + } + SStreamScanInfo* pInfo = (SStreamScanInfo*) downstream->info; + pInfo->useGetResultRange = true; + return code; +} + int32_t createStreamFillOperatorInfo(SOperatorInfo* downstream, SStreamFillPhysiNode* pPhyFillNode, SExecTaskInfo* pTaskInfo, SOperatorInfo** pOptrInfo) { QRY_PARAM_CHECK(pOptrInfo); @@ -1383,7 +1679,6 @@ int32_t createStreamFillOperatorInfo(SOperatorInfo* downstream, SStreamFillPhysi QUERY_CHECK_CODE(code, lino, _error); } - SInterval* pInterval = &((SStreamIntervalOperatorInfo*)downstream->info)->interval; int32_t numOfFillCols = 0; SExprInfo* pFillExprInfo = NULL; @@ -1396,7 +1691,12 @@ int32_t createStreamFillOperatorInfo(SOperatorInfo* downstream, SStreamFillPhysi pInfo->pSrcBlock = createDataBlockFromDescNode(pPhyFillNode->node.pOutputDataBlockDesc); QUERY_CHECK_NULL(pInfo->pSrcBlock, code, lino, _error, terrno); - pInfo->pFillSup = initStreamFillSup(pPhyFillNode, pInterval, pFillExprInfo, numOfFillCols, &pTaskInfo->storageAPI, + int8_t triggerType = 0; + SInterval interval = {0}; + code = getDownStreamInfo(downstream, &triggerType, &interval, &pInfo->pStreamAggSup); + QUERY_CHECK_CODE(code, lino, _error); + + pInfo->pFillSup = initStreamFillSup(pPhyFillNode, &interval, pFillExprInfo, numOfFillCols, &pTaskInfo->storageAPI, pInfo->pSrcBlock); if (!pInfo->pFillSup) { code = TSDB_CODE_FAILED; @@ -1426,6 +1726,12 @@ int32_t createStreamFillOperatorInfo(SOperatorInfo* downstream, SStreamFillPhysi code = blockDataEnsureCapacity(pInfo->pDelRes, pOperator->resultInfo.capacity); QUERY_CHECK_CODE(code, lino, _error); + pInfo->pUpdated = taosArrayInit(1024, sizeof(SWinKey)); + QUERY_CHECK_NULL(pInfo->pUpdated, code, lino, _error, terrno); + + pInfo->pCloseTs = taosArrayInit(1024, sizeof(TSKEY)); + QUERY_CHECK_NULL(pInfo->pCloseTs, code, lino, _error, terrno); + pInfo->primaryTsCol = ((STargetNode*)pPhyFillNode->pWStartTs)->slotId; pInfo->primarySrcSlotId = ((SColumnNode*)((STargetNode*)pPhyFillNode->pWStartTs)->pExpr)->slotId; @@ -1440,8 +1746,17 @@ int32_t createStreamFillOperatorInfo(SOperatorInfo* downstream, SStreamFillPhysi pInfo->srcRowIndex = -1; setOperatorInfo(pOperator, "StreamFillOperator", QUERY_NODE_PHYSICAL_PLAN_STREAM_FILL, false, OP_NOT_OPENED, pInfo, pTaskInfo); - pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, doStreamFillNext, NULL, destroyStreamFillOperatorInfo, - optrDefaultBufFn, NULL, optrDefaultGetNextExtFn, NULL); + + if (triggerType == STREAM_TRIGGER_FORCE_WINDOW_CLOSE) { + code = initForceFillDownStream(downstream); + QUERY_CHECK_CODE(code, lino, _error); + + pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, doStreamForceFillNext, NULL, destroyStreamFillOperatorInfo, + optrDefaultBufFn, NULL, optrDefaultGetNextExtFn, NULL); + } else { + pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, doStreamFillNext, NULL, destroyStreamFillOperatorInfo, + optrDefaultBufFn, NULL, optrDefaultGetNextExtFn, NULL); + } setOperatorStreamStateFn(pOperator, streamOpReleaseState, streamOpReloadState); code = appendDownstream(pOperator, &downstream, 1); diff --git a/source/libs/executor/src/streamintervalsliceoperator.c b/source/libs/executor/src/streamintervalsliceoperator.c new file mode 100644 index 000000000000..77a75754b204 --- /dev/null +++ b/source/libs/executor/src/streamintervalsliceoperator.c @@ -0,0 +1,591 @@ +/* + * 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 "executorInt.h" +#include "functionMgt.h" +#include "operator.h" +#include "querytask.h" +#include "storageapi.h" +#include "streamexecutorInt.h" +#include "tcommon.h" +#include "tdatablock.h" +#include "ttime.h" + +#define STREAM_INTERVAL_SLICE_OP_CHECKPOINT_NAME "StreamIntervalSliceOperator_Checkpoint" + +typedef struct SInervalSlicePoint { + SSessionKey winKey; + SSliceRowData* pLastRow; + SRowBuffPos* pResPos; +} SInervalSlicePoint; + +typedef enum SIntervalSliceType { + INTERVAL_SLICE_START = 1, + INTERVAL_SLICE_END = 2, +} SIntervalSliceType; + +void streamIntervalSliceReleaseState(SOperatorInfo* pOperator) { +} + +void streamIntervalSliceReloadState(SOperatorInfo* pOperator) { +} + +void destroyStreamIntervalSliceOperatorInfo(void* param) { + SStreamIntervalSliceOperatorInfo* pInfo = (SStreamIntervalSliceOperatorInfo*)param; + if (param == NULL) { + return; + } + cleanupBasicInfo(&pInfo->binfo); + if (pInfo->pOperator) { + cleanupResultInfoInStream(pInfo->pOperator->pTaskInfo, pInfo->streamAggSup.pState, &pInfo->pOperator->exprSupp, + &pInfo->groupResInfo); + pInfo->pOperator = NULL; + } + + clearGroupResInfo(&pInfo->groupResInfo); + taosArrayDestroyP(pInfo->pUpdated, destroyFlusedPos); + pInfo->pUpdated = NULL; + + if (pInfo->pUpdatedMap != NULL) { + tSimpleHashSetFreeFp(pInfo->pUpdatedMap, destroyFlusedppPos); + tSimpleHashCleanup(pInfo->pUpdatedMap); + pInfo->pUpdatedMap = NULL; + } + destroyStreamAggSupporter(&pInfo->streamAggSup); + + colDataDestroy(&pInfo->twAggSup.timeWindowData); + cleanupExprSupp(&pInfo->scalarSup); + + tSimpleHashCleanup(pInfo->pDeletedMap); + taosArrayDestroy(pInfo->pDelWins); + blockDataDestroy(pInfo->pDelRes); + + blockDataDestroy(pInfo->pCheckpointRes); + + taosMemoryFreeClear(param); +} + +static int32_t buildIntervalSliceResult(SOperatorInfo* pOperator, SSDataBlock** ppRes) { + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; + SStreamIntervalSliceOperatorInfo* pInfo = pOperator->info; + SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; + uint16_t opType = pOperator->operatorType; + SStreamAggSupporter* pAggSup = &pInfo->streamAggSup; + + doBuildDeleteResultImpl(&pInfo->streamAggSup.stateStore, pInfo->streamAggSup.pState, pInfo->pDelWins, &pInfo->delIndex, + pInfo->pDelRes); + if (pInfo->pDelRes->info.rows != 0) { + // process the rest of the data + printDataBlock(pInfo->pDelRes, getStreamOpName(opType), GET_TASKID(pTaskInfo)); + (*ppRes) = pInfo->pDelRes; + return code; + } + + doBuildStreamIntervalResult(pOperator, pInfo->streamAggSup.pState, pInfo->binfo.pRes, &pInfo->groupResInfo); + if (pInfo->binfo.pRes->info.rows != 0) { + printDataBlock(pInfo->binfo.pRes, getStreamOpName(opType), GET_TASKID(pTaskInfo)); + (*ppRes) = pInfo->binfo.pRes; + goto _end; + } + +_end: + if (code != TSDB_CODE_SUCCESS) { + qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } + return code; +} + +// static void doStreamIntervalSliceSaveCheckpoint(SOperatorInfo* pOperator) { +// } + +void initIntervalSlicePoint(SStreamAggSupporter* pAggSup, STimeWindow* pTWin, int64_t groupId, SInervalSlicePoint* pPoint) { + pPoint->winKey.groupId = groupId; + pPoint->winKey.win = *pTWin; + pPoint->pLastRow = POINTER_SHIFT(pPoint->pResPos->pRowBuff, pAggSup->resultRowSize - pAggSup->stateKeySize); +} + +static int32_t getIntervalSliceCurStateBuf(SStreamAggSupporter* pAggSup, SInterval* pInterval, STimeWindow* pTWin, int64_t groupId, + SInervalSlicePoint* pCurPoint, SInervalSlicePoint* pPrevPoint, int32_t* pWinCode) { + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; + SWinKey curKey = {.ts = pTWin->skey, .groupId = groupId}; + int32_t curVLen = 0; + code = pAggSup->stateStore.streamStateAddIfNotExist(pAggSup->pState, &curKey, (void**)&pCurPoint->pResPos, + &curVLen, pWinCode); + QUERY_CHECK_CODE(code, lino, _end); + + qDebug("===stream=== set stream twa next point buf.ts:%" PRId64 ", groupId:%" PRId64 ", res:%d", + curKey.ts, curKey.groupId, *pWinCode); + + initIntervalSlicePoint(pAggSup, pTWin, groupId, pCurPoint); + + SWinKey prevKey = {.groupId = groupId}; + SET_WIN_KEY_INVALID(prevKey.ts); + int32_t prevVLen = 0; + int32_t prevWinCode = TSDB_CODE_SUCCESS; + code = pAggSup->stateStore.streamStateGetPrev(pAggSup->pState, &curKey, &prevKey, + (void**)&pPrevPoint->pResPos, &prevVLen, &prevWinCode); + QUERY_CHECK_CODE(code, lino, _end); + + if (prevWinCode == TSDB_CODE_SUCCESS) { + STimeWindow prevSTW = {.skey = prevKey.ts}; + prevSTW.ekey = taosTimeGetIntervalEnd(prevSTW.skey, pInterval); + initIntervalSlicePoint(pAggSup, &prevSTW, groupId, pPrevPoint); + } else { + SET_WIN_KEY_INVALID(pPrevPoint->winKey.win.skey); + SET_WIN_KEY_INVALID(pPrevPoint->winKey.win.ekey); + } + +_end: + if (code != TSDB_CODE_SUCCESS) { + qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } + return code; +} + +void doStreamSliceInterpolation(SSliceRowData* pPrevWinVal, TSKEY winKey, TSKEY curTs, SSDataBlock* pDataBlock, + int32_t curRowIndex, SExprSupp* pSup, SIntervalSliceType type) { + SqlFunctionCtx* pCtx = pSup->pCtx; + for (int32_t k = 0; k < pSup->numOfExprs; ++k) { + if (!fmIsIntervalInterpoFunc(pCtx[k].functionId)) { + pCtx[k].start.key = INT64_MIN; + continue; + } + + SFunctParam* pParam = &pCtx[k].param[0]; + SColumnInfoData* pColInfo = taosArrayGet(pDataBlock->pDataBlock, pParam->pCol->slotId); + + double prevVal = 0, curVal = 0, winVal = 0; + SResultCellData* pCell = getSliceResultCell((SResultCellData*)pPrevWinVal->pRowVal, pParam->pCol->slotId); + GET_TYPED_DATA(prevVal, double, pCell->type, pCell->pData); + GET_TYPED_DATA(curVal, double, pColInfo->info.type, colDataGetData(pColInfo, curRowIndex)); + + SPoint point1 = (SPoint){.key = pPrevWinVal->key, .val = &prevVal}; + SPoint point2 = (SPoint){.key = curTs, .val = &curVal}; + SPoint point = (SPoint){.key = winKey, .val = &winVal}; + + if (!fmIsElapsedFunc(pCtx[k].functionId)) { + taosGetLinearInterpolationVal(&point, TSDB_DATA_TYPE_DOUBLE, &point1, &point2, TSDB_DATA_TYPE_DOUBLE); + } + + if (type == INTERVAL_SLICE_START) { + pCtx[k].start.key = point.key; + pCtx[k].start.val = winVal; + } else { + pCtx[k].end.key = point.key; + pCtx[k].end.val = winVal; + } + } +} + +static void resetIntervalSliceFunctionKey(SqlFunctionCtx* pCtx, int32_t numOfOutput) { + for (int32_t k = 0; k < numOfOutput; ++k) { + pCtx[k].start.key = INT64_MIN; + pCtx[k].end.key = INT64_MIN; + } +} + +int32_t setIntervalSliceOutputBuf(SInervalSlicePoint* pPoint, SqlFunctionCtx* pCtx, int32_t numOfOutput, + int32_t* rowEntryInfoOffset) { + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; + SResultRow* res = pPoint->pResPos->pRowBuff; + + // set time window for current result + res->win = pPoint->winKey.win; + code = setResultRowInitCtx(res, pCtx, numOfOutput, rowEntryInfoOffset); + QUERY_CHECK_CODE(code, lino, _end); + +_end: + if (code != TSDB_CODE_SUCCESS) { + qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } + return code; +} + +static int32_t doStreamIntervalSliceAggImpl(SOperatorInfo* pOperator, SSDataBlock* pBlock, SSHashObj* pUpdatedMap, + SSHashObj* pDeletedMap) { + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; + SStreamIntervalSliceOperatorInfo* pInfo = (SStreamIntervalSliceOperatorInfo*)pOperator->info; + SResultRowInfo* pResultRowInfo = &(pInfo->binfo.resultRowInfo); + SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; + SExprSupp* pSup = &pOperator->exprSupp; + int32_t numOfOutput = pSup->numOfExprs; + TSKEY* tsCols = NULL; + int64_t groupId = pBlock->info.id.groupId; + SResultRow* pResult = NULL; + int32_t forwardRows = 0; + + SColumnInfoData* pColDataInfo = taosArrayGet(pBlock->pDataBlock, pInfo->primaryTsIndex); + tsCols = (int64_t*)pColDataInfo->pData; + + int32_t startPos = 0; + TSKEY curTs = getStartTsKey(&pBlock->info.window, tsCols); + SInervalSlicePoint curPoint = {0}; + SInervalSlicePoint prevPoint = {0}; + STimeWindow curWin = + getActiveTimeWindow(NULL, pResultRowInfo, curTs, &pInfo->interval, TSDB_ORDER_ASC); + while (1) { + if (curTs > pInfo->endTs) { + break; + } + + int32_t winCode = TSDB_CODE_SUCCESS; + code = getIntervalSliceCurStateBuf(&pInfo->streamAggSup, &pInfo->interval, &curWin, groupId, &curPoint, &prevPoint, &winCode); + QUERY_CHECK_CODE(code, lino, _end); + + if (IS_VALID_WIN_KEY(prevPoint.winKey.win.skey) && prevPoint.pLastRow->key != prevPoint.winKey.win.ekey) { + setIntervalSliceOutputBuf(&prevPoint, pSup->pCtx, numOfOutput, pSup->rowEntryInfoOffset); + resetIntervalSliceFunctionKey(pSup->pCtx, numOfOutput); + doStreamSliceInterpolation(prevPoint.pLastRow, prevPoint.winKey.win.ekey, curTs, pBlock, startPos, &pOperator->exprSupp, INTERVAL_SLICE_END); + updateTimeWindowInfo(&pInfo->twAggSup.timeWindowData, &prevPoint.winKey.win, 1); + code = applyAggFunctionOnPartialTuples(pTaskInfo, pSup->pCtx, &pInfo->twAggSup.timeWindowData, startPos, + 0, pBlock->info.rows, numOfOutput); + QUERY_CHECK_CODE(code, lino, _end); + SWinKey prevKey = {.ts = prevPoint.winKey.win.skey, .groupId = prevPoint.winKey.groupId}; + saveWinResult(&prevKey, prevPoint.pResPos, pInfo->pUpdatedMap); + } + + setIntervalSliceOutputBuf(&curPoint, pSup->pCtx, numOfOutput, pSup->rowEntryInfoOffset); + resetIntervalSliceFunctionKey(pSup->pCtx, numOfOutput); + if (IS_VALID_WIN_KEY(prevPoint.winKey.win.skey) && curPoint.winKey.win.skey != curTs) { + doStreamSliceInterpolation(prevPoint.pLastRow, curPoint.winKey.win.skey, curTs, pBlock, startPos, &pOperator->exprSupp, INTERVAL_SLICE_START); + } + forwardRows = getNumOfRowsInTimeWindow(&pBlock->info, tsCols, startPos, curWin.ekey, binarySearchForKey, NULL, + TSDB_ORDER_ASC); + int32_t prevEndPos = (forwardRows - 1) + startPos; + if (winCode != TSDB_CODE_SUCCESS) { + int32_t endRowId = getQualifiedRowNumDesc(pSup, pBlock, tsCols, prevEndPos, false); + TSKEY endRowTs = tsCols[endRowId]; + transBlockToSliceResultRow(pBlock, endRowId, endRowTs, curPoint.pLastRow, 0, NULL, NULL); + } + SWinKey curKey = {.ts = curPoint.winKey.win.skey, .groupId = curPoint.winKey.groupId}; + if (pInfo->destHasPrimaryKey && winCode == TSDB_CODE_SUCCESS) { + code = tSimpleHashPut(pDeletedMap, &curKey, sizeof(SWinKey), NULL, 0); + QUERY_CHECK_CODE(code, lino, _end); + } + + saveWinResult(&curKey, curPoint.pResPos, pInfo->pUpdatedMap); + + updateTimeWindowInfo(&pInfo->twAggSup.timeWindowData, &curPoint.winKey.win, 1); + code = applyAggFunctionOnPartialTuples(pTaskInfo, pSup->pCtx, &pInfo->twAggSup.timeWindowData, startPos, + forwardRows, pBlock->info.rows, numOfOutput); + QUERY_CHECK_CODE(code, lino, _end); + + startPos = getNextQualifiedWindow(&pInfo->interval, &curWin, &pBlock->info, tsCols, prevEndPos, TSDB_ORDER_ASC); + if (startPos < 0) { + break; + } + curTs = tsCols[startPos]; + } + +_end: + if (code != TSDB_CODE_SUCCESS) { + qError("%s failed at line %d since %s. task:%s", __func__, lino, tstrerror(code), GET_TASKID(pTaskInfo)); + } + return code; +} + +static int32_t doStreamIntervalSliceNext(SOperatorInfo* pOperator, SSDataBlock** ppRes) { + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; + SStreamIntervalSliceOperatorInfo* pInfo = pOperator->info; + SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; + SStreamAggSupporter* pAggSup = &pInfo->streamAggSup; + + qDebug("stask:%s %s status: %d", GET_TASKID(pTaskInfo), getStreamOpName(pOperator->operatorType), pOperator->status); + + if (pOperator->status == OP_EXEC_DONE) { + (*ppRes) = NULL; + goto _end; + } + + if (pOperator->status == OP_RES_TO_RETURN) { + SSDataBlock* resBlock = NULL; + code = buildIntervalSliceResult(pOperator, &resBlock); + QUERY_CHECK_CODE(code, lino, _end); + if (resBlock != NULL) { + (*ppRes) = resBlock; + return code; + } + + if (pInfo->hasFill == false) { + pAggSup->stateStore.streamStateClearExpiredState(pAggSup->pState); + } + setStreamOperatorCompleted(pOperator); + (*ppRes) = NULL; + return code; + } + + SOperatorInfo* downstream = pOperator->pDownstream[0]; + int32_t numOfDatapack = 0; + + while (1) { + SSDataBlock* pBlock = NULL; + code = downstream->fpSet.getNextFn(downstream, &pBlock); + QUERY_CHECK_CODE(code, lino, _end); + + if (pBlock == NULL) { + pOperator->status = OP_RES_TO_RETURN; + break; + } + + switch (pBlock->info.type) { + case STREAM_NORMAL: + case STREAM_INVALID: { + SExprSupp* pExprSup = &pInfo->scalarSup; + if (pExprSup->pExprInfo != NULL) { + code = projectApplyFunctions(pExprSup->pExprInfo, pBlock, pBlock, pExprSup->pCtx, pExprSup->numOfExprs, NULL); + QUERY_CHECK_CODE(code, lino, _end); + } + } break; + case STREAM_CHECKPOINT: { + pInfo->recvCkBlock = true; + pAggSup->stateStore.streamStateCommit(pAggSup->pState); + // doStreamIntervalSliceSaveCheckpoint(pOperator); + pInfo->recvCkBlock = true; + code = copyDataBlock(pInfo->pCheckpointRes, pBlock); + QUERY_CHECK_CODE(code, lino, _end); + continue; + } break; + case STREAM_CREATE_CHILD_TABLE: { + (*ppRes) = pBlock; + goto _end; + } break; + case STREAM_GET_RESULT: { + pInfo->endTs = taosTimeGetIntervalEnd(pBlock->info.window.skey, &pInfo->interval); + if (pInfo->hasFill) { + (*ppRes) = pBlock; + goto _end; + } else { + continue; + } + } + default: + ASSERTS(false, "invalid SSDataBlock type"); + } + + code = setInputDataBlock(&pOperator->exprSupp, pBlock, TSDB_ORDER_ASC, MAIN_SCAN, true); + QUERY_CHECK_CODE(code, lino, _end); + code = doStreamIntervalSliceAggImpl(pOperator, pBlock, pInfo->pUpdatedMap, pInfo->pDeletedMap); + QUERY_CHECK_CODE(code, lino, _end); + + } + + if (!pInfo->destHasPrimaryKey) { + removeDeleteResults(pInfo->pUpdatedMap, pInfo->pDelWins); + } + + if (pInfo->destHasPrimaryKey) { + code = copyIntervalDeleteKey(pInfo->pDeletedMap, pInfo->pDelWins); + QUERY_CHECK_CODE(code, lino, _end); + } + + code = copyUpdateResult(&pInfo->pUpdatedMap, pInfo->pUpdated, winPosCmprImpl); + QUERY_CHECK_CODE(code, lino, _end); + + _hash_fn_t hashFn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY); + pInfo->pUpdatedMap = tSimpleHashInit(1024, hashFn); + QUERY_CHECK_NULL(pInfo->pUpdatedMap, code, lino, _end, terrno); + + initMultiResInfoFromArrayList(&pInfo->groupResInfo, pInfo->pUpdated); + pInfo->pUpdated = taosArrayInit(1024, POINTER_BYTES); + QUERY_CHECK_NULL(pInfo->pUpdated, code, lino, _end, terrno); + + code = blockDataEnsureCapacity(pInfo->binfo.pRes, pOperator->resultInfo.capacity); + QUERY_CHECK_CODE(code, lino, _end); + + (*ppRes) = NULL; + code = buildIntervalSliceResult(pOperator, ppRes); + QUERY_CHECK_CODE(code, lino, _end); + + if ((*ppRes) == NULL) { + if (pInfo->hasFill == false) { + pAggSup->stateStore.streamStateClearExpiredState(pAggSup->pState); + } + setStreamOperatorCompleted(pOperator); + } + +_end: + if (code != TSDB_CODE_SUCCESS) { + qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } + return code; +} + +int32_t initIntervalSliceDownStream(SOperatorInfo* downstream, SStreamAggSupporter* pAggSup, uint16_t type, + int32_t tsColIndex, STimeWindowAggSupp* pTwSup, struct SSteamOpBasicInfo* pBasic, + SInterval* pInterval) { + SExecTaskInfo* pTaskInfo = downstream->pTaskInfo; + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; + if (downstream->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_PARTITION) { + SStreamPartitionOperatorInfo* pPartionInfo = downstream->info; + pPartionInfo->tsColIndex = tsColIndex; + pBasic->primaryPkIndex = pPartionInfo->basic.primaryPkIndex; + } + + if (downstream->operatorType != QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN) { + code = + initIntervalSliceDownStream(downstream->pDownstream[0], pAggSup, type, tsColIndex, pTwSup, pBasic, pInterval); + return code; + } + SStreamScanInfo* pScanInfo = downstream->info; + pScanInfo->igCheckUpdate = true; + pScanInfo->windowSup = (SWindowSupporter){.pStreamAggSup = pAggSup, .gap = pAggSup->gap, .parentType = type}; + pScanInfo->pState = pAggSup->pState; + if (!pScanInfo->pUpdateInfo) { + code = pAggSup->stateStore.updateInfoInit(60000, TSDB_TIME_PRECISION_MILLI, pTwSup->waterMark, + pScanInfo->igCheckUpdate, pScanInfo->pkColType, pScanInfo->pkColLen, + &pScanInfo->pUpdateInfo); + QUERY_CHECK_CODE(code, lino, _end); + } + pScanInfo->twAggSup = *pTwSup; + pScanInfo->interval = *pInterval; + pAggSup->pUpdateInfo = pScanInfo->pUpdateInfo; + if (!hasSrcPrimaryKeyCol(pBasic)) { + pBasic->primaryPkIndex = pScanInfo->basic.primaryPkIndex; + } + +_end: + if (code != TSDB_CODE_SUCCESS) { + qError("%s failed at line %d since %s. task:%s", __func__, lino, tstrerror(code), GET_TASKID(pTaskInfo)); + } + return code; +} + +int32_t createStreamIntervalSliceOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo, + SReadHandle* pHandle, SOperatorInfo** ppOptInfo) { + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; + SStreamIntervalSliceOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SStreamIntervalSliceOperatorInfo)); + QUERY_CHECK_NULL(pInfo, code, lino, _error, terrno); + + SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); + QUERY_CHECK_NULL(pOperator, code, lino, _error, terrno) + + pInfo->pUpdated = taosArrayInit(1024, POINTER_BYTES); + QUERY_CHECK_NULL(pInfo->pUpdated, code, lino, _error, terrno); + + _hash_fn_t hashFn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY); + pInfo->pUpdatedMap = tSimpleHashInit(1024, hashFn); + QUERY_CHECK_NULL(pInfo->pUpdatedMap, code, lino, _error, terrno); + + pInfo->pDeletedMap = tSimpleHashInit(1024, hashFn); + QUERY_CHECK_NULL(pInfo->pDeletedMap, code, lino, _error, terrno); + + pInfo->delIndex = 0; + pInfo->pDelWins = taosArrayInit(4, sizeof(SWinKey)); + QUERY_CHECK_NULL(pInfo->pDelWins, code, lino, _error, terrno); + + code = createSpecialDataBlock(STREAM_DELETE_RESULT, &pInfo->pDelRes); + QUERY_CHECK_CODE(code, lino, _error); + + SSDataBlock* pResBlock = createDataBlockFromDescNode(pPhyNode->pOutputDataBlockDesc); + QUERY_CHECK_NULL(pResBlock, code, lino, _error, terrno); + initBasicInfo(&pInfo->binfo, pResBlock); + + code = createSpecialDataBlock(STREAM_CHECKPOINT, &pInfo->pCheckpointRes); + QUERY_CHECK_CODE(code, lino, _error); + pInfo->recvCkBlock = false; + + SStreamIntervalPhysiNode* pIntervalPhyNode = (SStreamIntervalPhysiNode*)pPhyNode; + pOperator->pTaskInfo = pTaskInfo; + initResultSizeInfo(&pOperator->resultInfo, 4096); + SExprSupp* pExpSup = &pOperator->exprSupp; + int32_t numOfExprs = 0; + SExprInfo* pExprInfo = NULL; + code = createExprInfo(pIntervalPhyNode->window.pFuncs, NULL, &pExprInfo, &numOfExprs); + QUERY_CHECK_CODE(code, lino, _error); + + code = initExprSupp(pExpSup, pExprInfo, numOfExprs, &pTaskInfo->storageAPI.functionStore); + QUERY_CHECK_CODE(code, lino, _error); + + pInfo->interval = (SInterval){.interval = pIntervalPhyNode->interval, + .sliding = pIntervalPhyNode->sliding, + .intervalUnit = pIntervalPhyNode->intervalUnit, + .slidingUnit = pIntervalPhyNode->slidingUnit, + .offset = pIntervalPhyNode->offset, + .precision = ((SColumnNode*)pIntervalPhyNode->window.pTspk)->node.resType.precision}; + + pInfo->twAggSup = + (STimeWindowAggSupp){.waterMark = pIntervalPhyNode->window.watermark, + .calTrigger = pIntervalPhyNode->window.triggerType, + .maxTs = INT64_MIN, + .minTs = INT64_MAX, + .deleteMark = getDeleteMark(&pIntervalPhyNode->window, pIntervalPhyNode->interval)}; + code = initExecTimeWindowInfo(&pInfo->twAggSup.timeWindowData, &pTaskInfo->window); + QUERY_CHECK_CODE(code, lino, _error); + + if (pIntervalPhyNode->window.pExprs != NULL) { + int32_t numOfScalar = 0; + SExprInfo* pScalarExprInfo = NULL; + code = createExprInfo(pIntervalPhyNode->window.pExprs, NULL, &pScalarExprInfo, &numOfScalar); + QUERY_CHECK_CODE(code, lino, _error); + + code = initExprSupp(&pInfo->scalarSup, pScalarExprInfo, numOfScalar, &pTaskInfo->storageAPI.functionStore); + QUERY_CHECK_CODE(code, lino, _error); + } + + SSDataBlock* pDownRes = NULL; + SColumnInfo* pPkCol = NULL; + code = getDownstreamRes(downstream, &pDownRes, &pPkCol); + QUERY_CHECK_CODE(code, lino, _error); + + int32_t keyBytes = sizeof(TSKEY); + keyBytes += blockDataGetRowSize(pDownRes) + sizeof(SResultCellData) * taosArrayGetSize(pDownRes->pDataBlock); + if (pPkCol) { + keyBytes += pPkCol->bytes; + } + code = initStreamAggSupporter(&pInfo->streamAggSup, pExpSup, numOfExprs, 0, pTaskInfo->streamInfo.pState, keyBytes, 0, + &pTaskInfo->storageAPI.stateStore, pHandle, &pInfo->twAggSup, GET_TASKID(pTaskInfo), + &pTaskInfo->storageAPI, pInfo->primaryTsIndex, STREAM_STATE_BUFF_HASH_SEARCH, 1); + + pInfo->destHasPrimaryKey = pIntervalPhyNode->window.destHasPrimaryKey; + pInfo->pOperator = pOperator; + pInfo->hasFill = false; + + setOperatorInfo(pOperator, "StreamIntervalSliceOperator", QUERY_NODE_PHYSICAL_PLAN_STREAM_CONTINUE_INTERVAL, true, OP_NOT_OPENED, + pInfo, pTaskInfo); + pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, doStreamIntervalSliceNext, NULL, destroyStreamIntervalSliceOperatorInfo, + optrDefaultBufFn, NULL, optrDefaultGetNextExtFn, NULL); + setOperatorStreamStateFn(pOperator, streamIntervalSliceReleaseState, streamIntervalSliceReloadState); + + initStreamBasicInfo(&pInfo->basic); + if (downstream) { + code = initIntervalSliceDownStream(downstream, &pInfo->streamAggSup, pPhyNode->type, pInfo->primaryTsIndex, + &pInfo->twAggSup, &pInfo->basic, &pInfo->interval); + QUERY_CHECK_CODE(code, lino, _error); + + code = appendDownstream(pOperator, &downstream, 1); + QUERY_CHECK_CODE(code, lino, _error); + } + + (*ppOptInfo) = pOperator; + return code; + +_error: + if (code != TSDB_CODE_SUCCESS) { + qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } + if (pInfo != NULL) { + destroyStreamIntervalSliceOperatorInfo(pInfo); + } + destroyOperatorAndDownstreams(pOperator, &downstream, 1); + pTaskInfo->code = code; + (*ppOptInfo) = NULL; + return code; +} diff --git a/source/libs/executor/src/streamtimesliceoperator.c b/source/libs/executor/src/streamtimesliceoperator.c index 57643d29e8ad..289c641c43c8 100644 --- a/source/libs/executor/src/streamtimesliceoperator.c +++ b/source/libs/executor/src/streamtimesliceoperator.c @@ -29,8 +29,6 @@ #define STREAM_TIME_SLICE_OP_STATE_NAME "StreamTimeSliceHistoryState" #define STREAM_TIME_SLICE_OP_CHECKPOINT_NAME "StreamTimeSliceOperator_Checkpoint" -#define IS_INVALID_WIN_KEY(ts) ((ts) == INT64_MIN) -#define SET_WIN_KEY_INVALID(ts) ((ts) = INT64_MIN) int32_t saveTimeSliceWinResult(SWinKey* pKey, SSHashObj* pUpdatedMap) { return tSimpleHashPut(pUpdatedMap, pKey, sizeof(SWinKey), NULL, 0); @@ -146,6 +144,11 @@ static void resetPrevAndNextWindow(SStreamFillSupporter* pFillSup) { void destroyStreamTimeSliceOperatorInfo(void* param) { SStreamTimeSliceOperatorInfo* pInfo = (SStreamTimeSliceOperatorInfo*)param; + if (pInfo->pOperator) { + cleanupResultInfoInStream(pInfo->pOperator->pTaskInfo, pInfo->streamAggSup.pState, &pInfo->pOperator->exprSupp, + &pInfo->groupResInfo); + pInfo->pOperator = NULL; + } colDataDestroy(&pInfo->twAggSup.timeWindowData); destroyStreamAggSupporter(&pInfo->streamAggSup); resetPrevAndNextWindow(pInfo->pFillSup); @@ -353,7 +356,7 @@ static void doStreamTimeSliceSaveCheckpoint(SOperatorInfo* pOperator) { } } -static SResultCellData* getSliceResultCell(SResultCellData* pRowVal, int32_t index) { +SResultCellData* getSliceResultCell(SResultCellData* pRowVal, int32_t index) { if (!pRowVal) { return NULL; } @@ -608,8 +611,8 @@ static int32_t getQualifiedRowNumAsc(SExprSupp* pExprSup, SSDataBlock* pBlock, i return -1; } -static int32_t getQualifiedRowNumDesc(SExprSupp* pExprSup, SSDataBlock* pBlock, TSKEY* tsCols, int32_t rowId, - bool ignoreNull) { +int32_t getQualifiedRowNumDesc(SExprSupp* pExprSup, SSDataBlock* pBlock, TSKEY* tsCols, int32_t rowId, + bool ignoreNull) { TSKEY ts = tsCols[rowId]; int32_t resRow = -1; for (; rowId >= 0; rowId--) { @@ -1219,8 +1222,8 @@ static bool needAdjustValue(SSlicePoint* pPoint, TSKEY ts, void* pPkVal, SStream return false; } -static void transBlockToResultRow(const SSDataBlock* pBlock, int32_t rowId, TSKEY ts, SSliceRowData* pRowVal, - int32_t rowSize, void* pPkData, SColumnInfoData* pPkCol) { +void transBlockToSliceResultRow(const SSDataBlock* pBlock, int32_t rowId, TSKEY ts, SSliceRowData* pRowVal, + int32_t rowSize, void* pPkData, SColumnInfoData* pPkCol) { int32_t numOfCols = taosArrayGetSize(pBlock->pDataBlock); for (int32_t i = 0; i < numOfCols; ++i) { SColumnInfoData* pColData = taosArrayGet(pBlock->pDataBlock, i); @@ -1344,7 +1347,7 @@ static void doStreamTimeSliceImpl(SOperatorInfo* pOperator, SSDataBlock* pBlock) } right = needAdjustValue(&curPoint, tsCols[startPos], pPkVal, pFillSup, false, pFillSup->type); if (right) { - transBlockToResultRow(pBlock, startPos, tsCols[startPos], curPoint.pRightRow, pFillSup->rowSize, pPkVal, pPkColDataInfo); + transBlockToSliceResultRow(pBlock, startPos, tsCols[startPos], curPoint.pRightRow, pFillSup->rowSize, pPkVal, pPkColDataInfo); bool needDel = pInfo->destHasPrimaryKey && winCode == TSDB_CODE_SUCCESS; code = saveTimeSliceWinResultInfo(pAggSup, &pInfo->twAggSup, &curPoint.key, pInfo->pUpdatedMap, needDel, pInfo->pDeletedMap); @@ -1363,7 +1366,7 @@ static void doStreamTimeSliceImpl(SOperatorInfo* pOperator, SSDataBlock* pBlock) } left = needAdjustValue(&nextPoint, tsCols[leftRowId], pPkVal, pFillSup, true, pFillSup->type); if (left) { - transBlockToResultRow(pBlock, leftRowId, tsCols[leftRowId], nextPoint.pLeftRow, pFillSup->rowSize, pPkVal, pPkColDataInfo); + transBlockToSliceResultRow(pBlock, leftRowId, tsCols[leftRowId], nextPoint.pLeftRow, pFillSup->rowSize, pPkVal, pPkColDataInfo); bool needDel = pInfo->destHasPrimaryKey && winCode == TSDB_CODE_SUCCESS; code = saveTimeSliceWinResultInfo(pAggSup, &pInfo->twAggSup, &nextPoint.key, pInfo->pUpdatedMap, needDel, pInfo->pDeletedMap); @@ -1388,7 +1391,7 @@ static void doStreamTimeSliceImpl(SOperatorInfo* pOperator, SSDataBlock* pBlock) } right = needAdjustValue(&curPoint, tsCols[startPos], pPkVal, pFillSup, false, pFillSup->type); if (right) { - transBlockToResultRow(pBlock, startPos, tsCols[startPos], curPoint.pRightRow, pFillSup->rowSize, pPkVal, pPkColDataInfo); + transBlockToSliceResultRow(pBlock, startPos, tsCols[startPos], curPoint.pRightRow, pFillSup->rowSize, pPkVal, pPkColDataInfo); bool needDel = pInfo->destHasPrimaryKey && winCode == TSDB_CODE_SUCCESS; code = saveTimeSliceWinResultInfo(pAggSup, &pInfo->twAggSup, &curPoint.key, pInfo->pUpdatedMap, needDel, pInfo->pDeletedMap); @@ -1680,7 +1683,7 @@ static int32_t doDeleteTimeSliceResult(SStreamAggSupporter* pAggSup, SSDataBlock return code; } -static int32_t setAllResultKey(SStreamAggSupporter* pAggSup, TSKEY ts, SSHashObj* pUpdatedMap) { +int32_t setAllResultKey(SStreamAggSupporter* pAggSup, TSKEY ts, SSHashObj* pUpdatedMap) { int32_t code = TSDB_CODE_SUCCESS; int32_t lino = 0; int64_t groupId = 0; @@ -1793,7 +1796,6 @@ static int32_t doStreamTimeSliceNext(SOperatorInfo* pOperator, SSDataBlock** ppR pInfo->recvCkBlock = true; pAggSup->stateStore.streamStateCommit(pAggSup->pState); doStreamTimeSliceSaveCheckpoint(pOperator); - pInfo->recvCkBlock = true; code = copyDataBlock(pInfo->pCheckpointRes, pBlock); QUERY_CHECK_CODE(code, lino, _end); continue; @@ -2075,6 +2077,7 @@ int32_t createStreamTimeSliceOperatorInfo(SOperatorInfo* downstream, SPhysiNode* if (pHandle) { pInfo->isHistoryOp = pHandle->fillHistory; } + pInfo->pOperator = pOperator; pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERP_FUNC; setOperatorInfo(pOperator, getStreamOpName(pOperator->operatorType), QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERP_FUNC, diff --git a/source/libs/executor/src/streamtimewindowoperator.c b/source/libs/executor/src/streamtimewindowoperator.c index d68b633b29ae..11e7681a3076 100644 --- a/source/libs/executor/src/streamtimewindowoperator.c +++ b/source/libs/executor/src/streamtimewindowoperator.c @@ -30,9 +30,6 @@ #define IS_FINAL_INTERVAL_OP(op) ((op)->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL) #define IS_MID_INTERVAL_OP(op) ((op)->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_MID_INTERVAL) -#define IS_NORMAL_INTERVAL_OP(op) \ - ((op)->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL || \ - (op)->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL) #define IS_FINAL_SESSION_OP(op) ((op)->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_SESSION) #define IS_NORMAL_SESSION_OP(op) \ @@ -2240,7 +2237,7 @@ int32_t initStreamAggSupporter(SStreamAggSupporter* pSup, SExprSupp* pExpSup, in code = pSup->stateStore.streamFileStateInit(tsStreamBufferSize, sizeof(SSessionKey), pSup->resultRowSize, funResSize, sesionTs, pSup->pState, pTwAggSup->deleteMark, taskIdStr, pHandle->checkpointId, stateType, &pSup->pState->pFileState); - } else if (stateType == STREAM_STATE_BUFF_HASH_SORT) { + } else if (stateType == STREAM_STATE_BUFF_HASH_SORT || stateType == STREAM_STATE_BUFF_HASH_SEARCH) { pSup->pState->pFileState = NULL; code = pSup->stateStore.streamFileStateInit(tsStreamBufferSize, sizeof(SWinKey), pSup->resultRowSize, funResSize, compareTs, pSup->pState, pTwAggSup->deleteMark, taskIdStr, @@ -5304,8 +5301,8 @@ static int32_t doStreamIntervalAggNext(SOperatorInfo* pOperator, SSDataBlock** p return code; } -int32_t createStreamIntervalOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo, - SReadHandle* pHandle, SOperatorInfo** pOptrInfo) { +static int32_t createStreamSingleIntervalOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo, + SReadHandle* pHandle, SOperatorInfo** pOptrInfo) { QRY_PARAM_CHECK(pOptrInfo); int32_t code = TSDB_CODE_SUCCESS; @@ -5458,6 +5455,17 @@ int32_t createStreamIntervalOperatorInfo(SOperatorInfo* downstream, SPhysiNode* return code; } +int32_t createStreamIntervalOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo, + SReadHandle* pHandle, SOperatorInfo** pOptrInfo) { + SStreamIntervalPhysiNode* pIntervalPhyNode = (SStreamIntervalPhysiNode*)pPhyNode; + if (pIntervalPhyNode->window.triggerType == STREAM_TRIGGER_FORCE_WINDOW_CLOSE) { + return createStreamIntervalSliceOperatorInfo(downstream, pPhyNode, pTaskInfo, pHandle, pOptrInfo); + } else { + return createStreamSingleIntervalOperatorInfo(downstream, pPhyNode, pTaskInfo, pHandle, pOptrInfo); + } + return TSDB_CODE_SUCCESS; +} + static void doStreamMidIntervalAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSDataBlock, SSHashObj* pUpdatedMap) { int32_t code = TSDB_CODE_SUCCESS; int32_t lino = 0; diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c index b78150955643..15d88b304e8d 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -3252,7 +3252,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { { .name = "elapsed", .type = FUNCTION_TYPE_ELAPSED, - .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_TIMELINE_FUNC | FUNC_MGT_INTERVAL_INTERPO_FUNC | FUNC_MGT_FORBID_STREAM_FUNC | + .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_TIMELINE_FUNC | FUNC_MGT_INTERVAL_INTERPO_FUNC | FUNC_MGT_FORBID_SYSTABLE_FUNC | FUNC_MGT_SPECIAL_DATA_REQUIRED, .dataRequiredFunc = statisDataRequired, .translateFunc = translateElapsed, @@ -3508,7 +3508,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { { .name = "twa", .type = FUNCTION_TYPE_TWA, - .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_TIMELINE_FUNC | FUNC_MGT_INTERVAL_INTERPO_FUNC | FUNC_MGT_FORBID_STREAM_FUNC | + .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_TIMELINE_FUNC | FUNC_MGT_INTERVAL_INTERPO_FUNC | FUNC_MGT_IMPLICIT_TS_FUNC | FUNC_MGT_FORBID_SYSTABLE_FUNC | FUNC_MGT_PRIMARY_KEY_FUNC, .translateFunc = translateInNumOutDou, .dataRequiredFunc = statisDataRequired, diff --git a/source/libs/nodes/src/nodesCodeFuncs.c b/source/libs/nodes/src/nodesCodeFuncs.c index 364bb160aa17..f7c29c64f78d 100644 --- a/source/libs/nodes/src/nodesCodeFuncs.c +++ b/source/libs/nodes/src/nodesCodeFuncs.c @@ -5748,6 +5748,7 @@ static const char* jkSelectStmtHasAggFuncs = "HasAggFuncs"; static const char* jkSelectStmtInterpFuncs = "HasInterpFuncs"; static const char* jkSelectStmtInterpFill = "InterpFill"; static const char* jkSelectStmtInterpEvery = "InterpEvery"; +static const char* jkSelectStmtTwaOrElapsedFuncs = "HasTwaOrElapsedFuncs"; static int32_t selectStmtToJson(const void* pObj, SJson* pJson) { const SSelectStmt* pNode = (const SSelectStmt*)pObj; @@ -5798,6 +5799,9 @@ static int32_t selectStmtToJson(const void* pObj, SJson* pJson) { if (TSDB_CODE_SUCCESS == code) { code = tjsonAddBoolToObject(pJson, jkSelectStmtInterpFuncs, pNode->hasInterpFunc); } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonAddBoolToObject(pJson, jkSelectStmtTwaOrElapsedFuncs, pNode->hasTwaOrElapsedFunc); + } if (TSDB_CODE_SUCCESS == code) { code = tjsonAddObject(pJson, jkSelectStmtInterpFill, nodeToJson, pNode->pFill); } @@ -5857,6 +5861,9 @@ static int32_t jsonToSelectStmt(const SJson* pJson, void* pObj) { if (TSDB_CODE_SUCCESS == code) { code = tjsonGetBoolValue(pJson, jkSelectStmtInterpFuncs, &pNode->hasInterpFunc); } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonGetBoolValue(pJson, jkSelectStmtTwaOrElapsedFuncs, &pNode->hasTwaOrElapsedFunc); + } if (TSDB_CODE_SUCCESS == code) { code = jsonToNodeObject(pJson, jkSelectStmtInterpFill, &pNode->pFill); } diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 900305377315..edd460db08f1 100755 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -2753,6 +2753,9 @@ static void setFuncClassification(STranslateContext* pCxt, SFunctionNode* pFunc) pSelect->hasUniqueFunc = pSelect->hasUniqueFunc ? true : (FUNCTION_TYPE_UNIQUE == pFunc->funcType); pSelect->hasTailFunc = pSelect->hasTailFunc ? true : (FUNCTION_TYPE_TAIL == pFunc->funcType); pSelect->hasInterpFunc = pSelect->hasInterpFunc ? true : (FUNCTION_TYPE_INTERP == pFunc->funcType); + pSelect->hasTwaOrElapsedFunc = pSelect->hasTwaOrElapsedFunc ? true + : (FUNCTION_TYPE_TWA == pFunc->funcType || + FUNCTION_TYPE_ELAPSED == pFunc->funcType); pSelect->hasInterpPseudoColFunc = pSelect->hasInterpPseudoColFunc ? true : fmIsInterpPseudoColumnFunc(pFunc->funcId); pSelect->hasLastRowFunc = pSelect->hasLastRowFunc ? true : (FUNCTION_TYPE_LAST_ROW == pFunc->funcType); @@ -10690,6 +10693,32 @@ static int32_t checkStreamQuery(STranslateContext* pCxt, SCreateStreamStmt* pStm } } + if (pSelect->hasTwaOrElapsedFunc) { + if (pStmt->pOptions->triggerType != STREAM_TRIGGER_FORCE_WINDOW_CLOSE) { + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY, + "Stream twa or elapsed function only support force window close"); + } + if (pSelect->pWindow->type != QUERY_NODE_INTERVAL_WINDOW) { + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY, + "Stream twa or elapsed function only support interval"); + } + + if ((SRealTableNode*)pSelect->pFromTable && ((SRealTableNode*)pSelect->pFromTable)->pMeta && + TSDB_SUPER_TABLE == ((SRealTableNode*)pSelect->pFromTable)->pMeta->tableType && + !hasTbnameFunction(pSelect->pPartitionByList)) { + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY, + "twa or elapsed on super table must patitioned by table name"); + } + } + + if (pStmt->pOptions->triggerType == STREAM_TRIGGER_FORCE_WINDOW_CLOSE) { + if (pStmt->pOptions->fillHistory) { + return generateSyntaxErrMsgExt( + &pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY, + "When trigger was force window close, Stream unsupported Fill history"); + } + } + if (NULL != pSelect->pGroupByList) { return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY, "Unsupported Group by"); } diff --git a/source/libs/stream/inc/streamBackendRocksdb.h b/source/libs/stream/inc/streamBackendRocksdb.h index 871a8bdbdba0..7dd07a28e3a1 100644 --- a/source/libs/stream/inc/streamBackendRocksdb.h +++ b/source/libs/stream/inc/streamBackendRocksdb.h @@ -172,6 +172,7 @@ void streamStateCurPrev_rocksdb(SStreamStateCur* pCur); int32_t streamStateGetKVByCur_rocksdb(SStreamStateCur* pCur, SWinKey* pKey, const void** pVal, int32_t* pVLen); SStreamStateCur* streamStateGetAndCheckCur_rocksdb(SStreamState* pState, SWinKey* key); SStreamStateCur* streamStateSeekKeyNext_rocksdb(SStreamState* pState, const SWinKey* key); +SStreamStateCur* streamStateSeekKeyPrev_rocksdb(SStreamState* pState, const SWinKey* key); SStreamStateCur* streamStateSeekToLast_rocksdb(SStreamState* pState); SStreamStateCur* streamStateGetCur_rocksdb(SStreamState* pState, const SWinKey* key); @@ -210,6 +211,7 @@ int32_t streamStateFillGetKVByCur_rocksdb(SStreamStateCur* pCur, SWinKey* pKey, SStreamStateCur* streamStateFillSeekKeyPrev_rocksdb(SStreamState* pState, const SWinKey* key); SStreamStateCur* streamStateFillSeekKeyNext_rocksdb(SStreamState* pState, const SWinKey* key); SStreamStateCur* streamStateFillSeekToLast_rocksdb(SStreamState* pState); +int32_t streamStateFillGetGroupKVByCur_rocksdb(SStreamStateCur* pCur, SWinKey* pKey, const void** pVal, int32_t* pVLen); // partag cf int32_t streamStatePutParTag_rocksdb(SStreamState* pState, int64_t groupId, const void* tag, int32_t tagLen); diff --git a/source/libs/stream/src/streamBackendRocksdb.c b/source/libs/stream/src/streamBackendRocksdb.c index ae03af8083fc..d72a46b2d6c5 100644 --- a/source/libs/stream/src/streamBackendRocksdb.c +++ b/source/libs/stream/src/streamBackendRocksdb.c @@ -3359,7 +3359,7 @@ int32_t streamStateGetFirst_rocksdb(SStreamState* pState, SWinKey* key) { return streamStateDel_rocksdb(pState, &tmp); } -int32_t streamStateGetGroupKVByCur_rocksdb(SStreamStateCur* pCur, SWinKey* pKey, const void** pVal, int32_t* pVLen) { +int32_t streamStateFillGetGroupKVByCur_rocksdb(SStreamStateCur* pCur, SWinKey* pKey, const void** pVal, int32_t* pVLen) { if (!pCur) { return -1; } @@ -3422,7 +3422,7 @@ int32_t streamStateGetKVByCur_rocksdb(SStreamStateCur* pCur, SWinKey* pKey, cons SStreamStateCur* streamStateGetAndCheckCur_rocksdb(SStreamState* pState, SWinKey* key) { SStreamStateCur* pCur = streamStateFillGetCur_rocksdb(pState, key); if (pCur) { - int32_t code = streamStateGetGroupKVByCur_rocksdb(pCur, key, NULL, 0); + int32_t code = streamStateFillGetGroupKVByCur_rocksdb(pCur, key, NULL, 0); if (code == 0) return pCur; streamStateFreeCur(pCur); } @@ -4239,6 +4239,16 @@ void streamStateParTagSeekKeyNext_rocksdb(SStreamState* pState, const int64_t gr while (rocksdb_iter_valid(pCur->iter) && iterValueIsStale(pCur->iter)) { rocksdb_iter_next(pCur->iter); } + + if (rocksdb_iter_valid(pCur->iter)) { + int64_t curGroupId; + size_t kLen = 0; + char* keyStr = (char*)rocksdb_iter_key(pCur->iter, &kLen); + TAOS_UNUSED(parKeyDecode((void*)&curGroupId, keyStr)); + if (curGroupId > groupId) return ; + + rocksdb_iter_next(pCur->iter); + } } int32_t streamStateParTagGetKVByCur_rocksdb(SStreamStateCur* pCur, int64_t* pGroupId, const void** pVal, int32_t* pVLen) { @@ -5148,3 +5158,61 @@ int32_t bkdMgtDumpTo(SBkdMgt* bm, char* taskId, char* dname) { return code; } #endif + +SStreamStateCur* streamStateSeekKeyPrev_rocksdb(SStreamState* pState, const SWinKey* key) { + stDebug("streamStateSeekKeyPrev_rocksdb"); + STaskDbWrapper* wrapper = pState->pTdbState->pOwner->pBackend; + SStreamStateCur* pCur = createStreamStateCursor(); + if (pCur == NULL) { + return NULL; + } + + pCur->db = wrapper->db; + pCur->iter = streamStateIterCreate(pState, "state", (rocksdb_snapshot_t**)&pCur->snapshot, + (rocksdb_readoptions_t**)&pCur->readOpt); + pCur->number = pState->number; + + char buf[128] = {0}; + int len = winKeyEncode((void*)key, buf); + if (!streamStateIterSeekAndValid(pCur->iter, buf, len)) { + streamStateFreeCur(pCur); + return NULL; + } + while (rocksdb_iter_valid(pCur->iter) && iterValueIsStale(pCur->iter)) { + rocksdb_iter_prev(pCur->iter); + } + + if (rocksdb_iter_valid(pCur->iter)) { + SWinKey curKey; + size_t kLen = 0; + char* keyStr = (char*)rocksdb_iter_key(pCur->iter, &kLen); + TAOS_UNUSED(winKeyDecode((void*)&curKey, keyStr)); + if (winKeyCmpr(key, sizeof(*key), &curKey, sizeof(curKey)) > 0) { + return pCur; + } + rocksdb_iter_prev(pCur->iter); + return pCur; + } + + streamStateFreeCur(pCur); + return NULL; +} + +int32_t streamStateGetGroupKVByCur_rocksdb(SStreamStateCur* pCur, SWinKey* pKey, const void** pVal, int32_t* pVLen) { + if (!pCur) { + return -1; + } + uint64_t groupId = pKey->groupId; + + int32_t code = streamStateGetKVByCur_rocksdb(pCur, pKey, pVal, pVLen); + if (code == 0) { + if (pKey->groupId == groupId) { + return 0; + } + if (pVal != NULL) { + taosMemoryFree((void*)*pVal); + *pVal = NULL; + } + } + return -1; +} diff --git a/source/libs/stream/src/streamData.c b/source/libs/stream/src/streamData.c index 688b58622a0a..a315c9c72624 100644 --- a/source/libs/stream/src/streamData.c +++ b/source/libs/stream/src/streamData.c @@ -330,9 +330,11 @@ int32_t streamCreateSinkResTrigger(SStreamTrigger** pTrigger, int32_t triggerTyp int64_t now = taosGetTimestampMs(); STimeWindow window = getAlignQueryTimeWindow(&interval, now - trigger); - p->pBlock->info.window = window; + p->pBlock->info.window.skey = window.skey; + p->pBlock->info.window.ekey = TMAX(now, window.ekey); p->pBlock->info.type = STREAM_GET_RESULT; - stDebug("force_window_close trigger block generated, window range:%" PRId64 "-%" PRId64, window.skey, window.ekey); + stDebug("force_window_close trigger block generated, window range:%" PRId64 "-%" PRId64, + p->pBlock->info.window.skey, p->pBlock->info.window.ekey); } else { p->pBlock->info.type = STREAM_GET_ALL; } diff --git a/source/libs/stream/src/streamSliceState.c b/source/libs/stream/src/streamSliceState.c index 2ec8ef202c08..0660a68ed285 100644 --- a/source/libs/stream/src/streamSliceState.c +++ b/source/libs/stream/src/streamSliceState.c @@ -23,11 +23,6 @@ #define NUM_OF_CACHE_WIN 64 #define MAX_NUM_OF_CACHE_WIN 128 -int fillStateKeyCompare(const void* pWin1, const void* pDatas, int pos) { - SWinKey* pWin2 = taosArrayGet(pDatas, pos); - return winKeyCmprImpl((SWinKey*)pWin1, pWin2); -} - int32_t getHashSortRowBuff(SStreamFileState* pFileState, const SWinKey* pKey, void** pVal, int32_t* pVLen, int32_t* pWinCode) { int32_t code = TSDB_CODE_SUCCESS; @@ -57,7 +52,7 @@ int32_t getHashSortRowBuff(SStreamFileState* pFileState, const SWinKey* pKey, vo SStreamStateCur* pCur = streamStateFillSeekKeyPrev_rocksdb(pState, &start); for (int32_t i = 0; i < NUM_OF_CACHE_WIN; i++) { SWinKey tmpKey = {.groupId = pKey->groupId}; - int32_t tmpRes = streamStateGetGroupKVByCur_rocksdb(pCur, &tmpKey, NULL, 0); + int32_t tmpRes = streamStateFillGetGroupKVByCur_rocksdb(pCur, &tmpKey, NULL, 0); if (tmpRes != TSDB_CODE_SUCCESS) { break; } @@ -134,7 +129,7 @@ int32_t getStateFromRocksdbByCur(SStreamFileState* pFileState, SStreamStateCur* int32_t lino = 0; void* tmpVal = NULL; int32_t len = 0; - (*pWinCode) = streamStateGetGroupKVByCur_rocksdb(pCur, pResKey, (const void**)&tmpVal, &len); + (*pWinCode) = streamStateFillGetGroupKVByCur_rocksdb(pCur, pResKey, (const void**)&tmpVal, &len); if ((*pWinCode) == TSDB_CODE_SUCCESS) { SRowBuffPos* pNewPos = getNewRowPosForWrite(pFileState); if (!pNewPos || !pNewPos->pRowBuff) { @@ -167,7 +162,7 @@ int32_t getHashSortNextRow(SStreamFileState* pFileState, const SWinKey* pKey, SW SStreamStateCur* pCur = streamStateFillSeekKeyNext_rocksdb(pState, pKey); void* tmpVal = NULL; int32_t len = 0; - (*pWinCode) = streamStateGetGroupKVByCur_rocksdb(pCur, pResKey, (const void**)&tmpVal, &len); + (*pWinCode) = streamStateFillGetGroupKVByCur_rocksdb(pCur, pResKey, (const void**)&tmpVal, &len); if ((*pWinCode) == TSDB_CODE_SUCCESS && ppVal != NULL) { SRowBuffPos* pNewPos = getNewRowPosForWrite(pFileState); if (!pNewPos || !pNewPos->pRowBuff) { @@ -188,7 +183,7 @@ int32_t getHashSortNextRow(SStreamFileState* pFileState, const SWinKey* pKey, SW SStreamStateCur* pCur = streamStateFillSeekKeyNext_rocksdb(pState, pKey); void* tmpVal = NULL; int32_t len = 0; - (*pWinCode) = streamStateGetGroupKVByCur_rocksdb(pCur, pResKey, (const void**)&tmpVal, &len); + (*pWinCode) = streamStateFillGetGroupKVByCur_rocksdb(pCur, pResKey, (const void**)&tmpVal, &len); if ((*pWinCode) == TSDB_CODE_SUCCESS) { if (ppVal != NULL) { SRowBuffPos* pNewPos = getNewRowPosForWrite(pFileState); @@ -241,7 +236,7 @@ int32_t getHashSortPrevRow(SStreamFileState* pFileState, const SWinKey* pKey, SW SStreamStateCur* pCur = streamStateFillSeekKeyPrev_rocksdb(pState, pKey); void* tmpVal = NULL; int32_t len = 0; - (*pWinCode) = streamStateGetGroupKVByCur_rocksdb(pCur, pResKey, (const void**)&tmpVal, &len); + (*pWinCode) = streamStateFillGetGroupKVByCur_rocksdb(pCur, pResKey, (const void**)&tmpVal, &len); if ((*pWinCode) == TSDB_CODE_SUCCESS) { SRowBuffPos* pNewPos = getNewRowPosForWrite(pFileState); if (!pNewPos || !pNewPos->pRowBuff) { @@ -270,7 +265,7 @@ int32_t getHashSortPrevRow(SStreamFileState* pFileState, const SWinKey* pKey, SW SStreamStateCur* pCur = streamStateFillSeekKeyPrev_rocksdb(pState, pKey); void* tmpVal = NULL; int32_t len = 0; - (*pWinCode) = streamStateGetGroupKVByCur_rocksdb(pCur, pResKey, (const void**)&tmpVal, &len); + (*pWinCode) = streamStateFillGetGroupKVByCur_rocksdb(pCur, pResKey, (const void**)&tmpVal, &len); if ((*pWinCode) == TSDB_CODE_SUCCESS) { SRowBuffPos* pNewPos = getNewRowPosForWrite(pFileState); if (!pNewPos || !pNewPos->pRowBuff) { diff --git a/source/libs/stream/src/streamState.c b/source/libs/stream/src/streamState.c index 66e7888d6397..99801ab0ebb0 100644 --- a/source/libs/stream/src/streamState.c +++ b/source/libs/stream/src/streamState.c @@ -229,6 +229,7 @@ int32_t streamStateFillPut(SStreamState* pState, const SWinKey* key, const void* int32_t streamStateFillGet(SStreamState* pState, const SWinKey* key, void** pVal, int32_t* pVLen, int32_t* pWinCode) { if (pState->pFileState) { + // todo(liuyao) 改这里 return getRowBuff(pState->pFileState, (void*)key, sizeof(SWinKey), pVal, pVLen, pWinCode); } return streamStateFillGet_rocksdb(pState, key, pVal, pVLen); @@ -316,8 +317,8 @@ int32_t streamStateFillGetKVByCur(SStreamStateCur* pCur, SWinKey* pKey, const vo return streamStateFillGetKVByCur_rocksdb(pCur, pKey, pVal, pVLen); } -int32_t streamStateGetGroupKVByCur(SStreamStateCur* pCur, SWinKey* pKey, const void** pVal, int32_t* pVLen) { - return streamStateGetGroupKVByCur_rocksdb(pCur, pKey, pVal, pVLen); +int32_t streamStateFillGetGroupKVByCur(SStreamStateCur* pCur, SWinKey* pKey, const void** pVal, int32_t* pVLen) { + return streamStateFillGetGroupKVByCur_rocksdb(pCur, pKey, pVal, pVLen); } SStreamStateCur* streamStateSeekKeyNext(SStreamState* pState, const SWinKey* key) { @@ -582,3 +583,12 @@ int32_t streamStateGroupGetKVByCur(SStreamStateCur* pCur, int64_t* pKey, void** } return streamFileStateGroupGetKVByCur(pCur, pKey, pVal, pVLen); } + +void streamStateClearExpiredState(SStreamState* pState) { + clearExpiredState(pState->pFileState); +} + +int32_t streamStateGetPrev(SStreamState* pState, const SWinKey* pKey, SWinKey* pResKey, void** pVal, int32_t* pVLen, + int32_t* pWinCode) { + return getRowStatePrevRow(pState->pFileState, pKey, pResKey, pVal, pVLen, pWinCode); +} diff --git a/source/libs/stream/src/tstreamFileState.c b/source/libs/stream/src/tstreamFileState.c index a95b166fb120..ee6629704f37 100644 --- a/source/libs/stream/src/tstreamFileState.c +++ b/source/libs/stream/src/tstreamFileState.c @@ -30,6 +30,8 @@ #define MIN_NUM_SEARCH_BUCKET 128 #define MAX_ARRAY_SIZE 1024 #define MAX_GROUP_ID_NUM 200000 +#define NUM_OF_CACHE_WIN 64 +#define MAX_NUM_OF_CACHE_WIN 128 #define TASK_KEY "streamFileState" #define STREAM_STATE_INFO_NAME "StreamStateCheckPoint" @@ -68,6 +70,11 @@ struct SStreamFileState { typedef SRowBuffPos SRowBuffInfo; +int fillStateKeyCompare(const void* pWin1, const void* pDatas, int pos) { + SWinKey* pWin2 = taosArrayGet(pDatas, pos); + return winKeyCmprImpl((SWinKey*)pWin1, pWin2); +} + int32_t stateHashBuffRemoveFn(void* pBuff, const void* pKey, size_t keyLen) { SRowBuffPos** pos = tSimpleHashGet(pBuff, pKey, keyLen); if (pos) { @@ -111,6 +118,17 @@ void* intervalCreateStateKey(SRowBuffPos* pPos, int64_t num) { return pStateKey; } +void* defaultCreateStateKey(SRowBuffPos* pPos, int64_t num) { + SWinKey* pStateKey = taosMemoryCalloc(1, sizeof(SWinKey)); + if (pStateKey == NULL) { + qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(terrno)); + return NULL; + } + SWinKey* pWinKey = pPos->pKey; + *pStateKey = *pWinKey; + return pStateKey; +} + int32_t sessionFileRemoveFn(SStreamFileState* pFileState, const void* pKey) { return streamStateSessionDel_rocksdb(pFileState->pFileStore, pKey); } @@ -171,7 +189,7 @@ int32_t streamFileStateInit(int64_t memSize, uint32_t keySize, uint32_t rowSize, _hash_fn_t hashFn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY); int32_t cap = TMIN(MIN_NUM_OF_ROW_BUFF, pFileState->maxRowCount); - if (type == STREAM_STATE_BUFF_HASH) { + if (type == STREAM_STATE_BUFF_HASH || type == STREAM_STATE_BUFF_HASH_SEARCH) { pFileState->rowStateBuff = tSimpleHashInit(cap, hashFn); pFileState->stateBuffCleanupFn = stateHashBuffCleanupFn; pFileState->stateBuffRemoveFn = stateHashBuffRemoveFn; @@ -200,7 +218,7 @@ int32_t streamFileStateInit(int64_t memSize, uint32_t keySize, uint32_t rowSize, pFileState->stateBuffCleanupFn = stateHashBuffCleanupFn; pFileState->stateBuffRemoveFn = stateHashBuffRemoveFn; pFileState->stateBuffRemoveByPosFn = stateHashBuffRemoveByPosFn; - pFileState->stateBuffCreateStateKeyFn = intervalCreateStateKey; + pFileState->stateBuffCreateStateKeyFn = defaultCreateStateKey; pFileState->stateFileRemoveFn = hashSortFileRemoveFn; pFileState->stateFileGetFn = hashSortFileGetFn; @@ -213,6 +231,11 @@ int32_t streamFileStateInit(int64_t memSize, uint32_t keySize, uint32_t rowSize, QUERY_CHECK_NULL(pFileState->rowStateBuff, code, lino, _end, terrno); QUERY_CHECK_NULL(pFileState->cfName, code, lino, _end, terrno); + if (type == STREAM_STATE_BUFF_HASH_SEARCH) { + pFileState->searchBuff = tSimpleHashInit(MIN_NUM_SEARCH_BUCKET, hashFn); + QUERY_CHECK_NULL(pFileState->searchBuff, code, lino, _end, terrno); + } + pFileState->keyLen = keySize; pFileState->rowSize = rowSize; pFileState->selectivityRowSize = selectRowSize; @@ -230,8 +253,7 @@ int32_t streamFileStateInit(int64_t memSize, uint32_t keySize, uint32_t rowSize, pFileState->pGroupIdMap = tSimpleHashInit(1024, hashFn); QUERY_CHECK_NULL(pFileState->pGroupIdMap, code, lino, _end, terrno); - // todo(liuyao) optimize - if (type == STREAM_STATE_BUFF_HASH) { + if (type == STREAM_STATE_BUFF_HASH || type == STREAM_STATE_BUFF_HASH_SEARCH) { code = recoverSnapshot(pFileState, checkpointId); } else if (type == STREAM_STATE_BUFF_SORT) { code = recoverSesssion(pFileState, checkpointId); @@ -1160,6 +1182,9 @@ void streamFileStateGroupCurNext(SStreamStateCur* pCur) { return; } + int64_t gpId = *(int64_t*)tSimpleHashGetKey(pCur->pHashData, NULL); + pCur->minGpId = TMAX(pCur->minGpId, gpId); + SSHashObj* pHash = pFileState->pGroupIdMap; pCur->pHashData = tSimpleHashIterate(pHash, pCur->pHashData, &pCur->hashIter); if (!pCur->pHashData) { @@ -1167,8 +1192,6 @@ void streamFileStateGroupCurNext(SStreamStateCur* pCur) { streamStateParTagSeekKeyNext_rocksdb(pFileState->pFileStore, pCur->minGpId, pCur); return; } - int64_t gpId = *(int64_t*)tSimpleHashGetKey(pCur->pHashData, NULL); - pCur->minGpId = TMIN(pCur->minGpId, gpId); } int32_t streamFileStateGroupGetKVByCur(SStreamStateCur* pCur, int64_t* pKey, void** pVal, int32_t* pVLen) { @@ -1183,3 +1206,164 @@ int32_t streamFileStateGroupGetKVByCur(SStreamStateCur* pCur, int64_t* pKey, voi SSHashObj* getGroupIdCache(SStreamFileState* pFileState) { return pFileState->pGroupIdMap; } + +void clearExpiredState(SStreamFileState* pFileState) { + SSHashObj* pSearchBuff = pFileState->searchBuff; + void* pIte = NULL; + int32_t iter = 0; + while ((pIte = tSimpleHashIterate(pFileState->searchBuff, pIte, &iter)) != NULL) { + SArray* pWinStates = *((void**)pIte); + int32_t size = taosArrayGetSize(pWinStates); + for (int32_t i = 0; i < size - 1; i++) { + SWinKey* pKey = taosArrayGet(pWinStates, i); + int32_t code_buff = pFileState->stateBuffRemoveFn(pFileState->rowStateBuff, pKey, sizeof(SWinKey)); + qTrace("%s at line %d res:%d", __func__, __LINE__, code_buff); + + int32_t code_file = pFileState->stateFileRemoveFn(pFileState, pKey); + qTrace("%s at line %d res:%d", __func__, __LINE__, code_file); + + streamStateFillDel_rocksdb(pFileState->pFileStore, pKey); + } + taosArrayRemoveBatch(pWinStates, 0, size - 1, NULL); + } +} + +int32_t getStateSearchRowBuff(SStreamFileState* pFileState, const SWinKey* pKey, void** pVal, int32_t* pVLen, + int32_t* pWinCode) { + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; + + code = addRowBuffIfNotExist(pFileState, (void*)pKey, sizeof(SWinKey), pVal, pVLen, pWinCode); + QUERY_CHECK_CODE(code, lino, _end); + + SArray* pWinStates = NULL; + SSHashObj* pSearchBuff = getSearchBuff(pFileState); + void** ppBuff = tSimpleHashGet(pSearchBuff, &pKey->groupId, sizeof(uint64_t)); + if (ppBuff) { + pWinStates = (SArray*)(*ppBuff); + } else { + pWinStates = taosArrayInit(16, sizeof(SWinKey)); + QUERY_CHECK_NULL(pWinStates, code, lino, _end, terrno); + + code = tSimpleHashPut(pSearchBuff, &pKey->groupId, sizeof(uint64_t), &pWinStates, POINTER_BYTES); + QUERY_CHECK_CODE(code, lino, _end); + } + + // recover + if (taosArrayGetSize(pWinStates) == 0 && needClearDiskBuff(pFileState)) { + TSKEY ts = getFlushMark(pFileState); + SWinKey start = {.groupId = pKey->groupId, .ts = INT64_MAX}; + void* pState = getStateFileStore(pFileState); + SStreamStateCur* pCur = streamStateSeekKeyPrev_rocksdb(pState, &start); + for (int32_t i = 0; i < NUM_OF_CACHE_WIN; i++) { + SWinKey tmpKey = {.groupId = pKey->groupId}; + int32_t tmpRes = streamStateGetGroupKVByCur_rocksdb(pCur, &tmpKey, NULL, 0); + if (tmpRes != TSDB_CODE_SUCCESS) { + break; + } + void* tmp = taosArrayPush(pWinStates, &tmpKey); + QUERY_CHECK_NULL(tmp, code, lino, _end, terrno); + streamStateCurPrev_rocksdb(pCur); + } + taosArraySort(pWinStates, winKeyCmprImpl); + streamStateFreeCur(pCur); + } + + int32_t size = taosArrayGetSize(pWinStates); + int32_t index = binarySearch(pWinStates, size, pKey, fillStateKeyCompare); + if (!isFlushedState(pFileState, pKey->ts, 0)|| index >= 0) { + // find the first position which is smaller than the pKey + if (index >= 0) { + SWinKey* pTmpKey = taosArrayGet(pWinStates, index); + if (winKeyCmprImpl(pTmpKey, pKey) == 0) { + goto _end; + } + } + index++; + void* tmp = taosArrayInsert(pWinStates, index, pKey); + QUERY_CHECK_NULL(tmp, code, lino, _end, terrno); + } + + if (size >= MAX_NUM_OF_CACHE_WIN) { + int32_t num = size - NUM_OF_CACHE_WIN; + taosArrayRemoveBatch(pWinStates, 0, num, NULL); + } + +_end: + if (code != TSDB_CODE_SUCCESS) { + qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } + return code; +} + +int32_t getRowStatePrevRow(SStreamFileState* pFileState, const SWinKey* pKey, SWinKey* pResKey, void** ppVal, + int32_t* pVLen, int32_t* pWinCode) { + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; + SArray* pWinStates = NULL; + SSHashObj* pSearchBuff = getSearchBuff(pFileState); + void* pState = getStateFileStore(pFileState); + void** ppBuff = (void**) tSimpleHashGet(pSearchBuff, &pKey->groupId, sizeof(uint64_t)); + if (ppBuff) { + pWinStates = (SArray*)(*ppBuff); + } else { + qDebug("===stream=== search buff is empty.group id:%" PRId64, pKey->groupId); + SStreamStateCur* pCur = streamStateSeekKeyPrev_rocksdb(pState, pKey); + void* tmpVal = NULL; + int32_t len = 0; + (*pWinCode) = streamStateGetGroupKVByCur_rocksdb(pCur, pResKey, (const void**)&tmpVal, &len); + if ((*pWinCode) == TSDB_CODE_SUCCESS) { + SRowBuffPos* pNewPos = getNewRowPosForWrite(pFileState); + if (!pNewPos || !pNewPos->pRowBuff) { + code = TSDB_CODE_OUT_OF_MEMORY; + QUERY_CHECK_CODE(code, lino, _end); + } + memcpy(pNewPos->pRowBuff, tmpVal, len); + taosMemoryFreeClear(tmpVal); + *pVLen = getRowStateRowSize(pFileState); + (*ppVal) = pNewPos; + } + streamStateFreeCur(pCur); + return code; + } + int32_t size = taosArrayGetSize(pWinStates); + int32_t index = binarySearch(pWinStates, size, pKey, fillStateKeyCompare); + if (index >= 0) { + SWinKey* pCurKey = taosArrayGet(pWinStates, index); + if (winKeyCmprImpl(pCurKey, pKey) == 0) { + index--; + } else { + qDebug("%s failed at line %d since do not find cur SWinKey. trigger may be force window close", __func__, __LINE__); + } + } + if (index == -1) { + SStreamStateCur* pCur = streamStateSeekKeyPrev_rocksdb(pState, pKey); + void* tmpVal = NULL; + int32_t len = 0; + (*pWinCode) = streamStateGetGroupKVByCur_rocksdb(pCur, pResKey, (const void**)&tmpVal, &len); + if ((*pWinCode) == TSDB_CODE_SUCCESS) { + SRowBuffPos* pNewPos = getNewRowPosForWrite(pFileState); + if (!pNewPos || !pNewPos->pRowBuff) { + code = TSDB_CODE_OUT_OF_MEMORY; + QUERY_CHECK_CODE(code, lino, _end); + } + memcpy(pNewPos->pRowBuff, tmpVal, len); + taosMemoryFreeClear(tmpVal); + *pVLen = getRowStateRowSize(pFileState); + (*ppVal) = pNewPos; + } + streamStateFreeCur(pCur); + return code; + } else { + SWinKey* pPrevKey = taosArrayGet(pWinStates, index); + *pResKey = *pPrevKey; + return getHashSortRowBuff(pFileState, pResKey, ppVal, pVLen, pWinCode); + } + (*pWinCode) = TSDB_CODE_FAILED; + +_end: + if (code != TSDB_CODE_SUCCESS) { + qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } + return code; +} From 17939a184b79112f1d0f9bf512c1ca737f1fa4f6 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Wed, 16 Oct 2024 13:26:14 +0800 Subject: [PATCH 130/695] fix ci issue --- source/libs/executor/src/streamintervalsliceoperator.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/libs/executor/src/streamintervalsliceoperator.c b/source/libs/executor/src/streamintervalsliceoperator.c index 77a75754b204..7ec47958d1f6 100644 --- a/source/libs/executor/src/streamintervalsliceoperator.c +++ b/source/libs/executor/src/streamintervalsliceoperator.c @@ -375,7 +375,8 @@ static int32_t doStreamIntervalSliceNext(SOperatorInfo* pOperator, SSDataBlock** } } default: - ASSERTS(false, "invalid SSDataBlock type"); + code = TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR; + QUERY_CHECK_CODE(code, lino, _end); } code = setInputDataBlock(&pOperator->exprSupp, pBlock, TSDB_ORDER_ASC, MAIN_SCAN, true); From b24c9c5d2064baac9523a9c308e41dd0545b13d0 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Wed, 16 Oct 2024 13:39:32 +0800 Subject: [PATCH 131/695] fix ci check --- source/libs/executor/src/streamfilloperator.c | 23 ++++++++++++------- .../src/streamintervalsliceoperator.c | 14 +++++++---- source/libs/stream/src/tstreamFileState.c | 3 ++- 3 files changed, 27 insertions(+), 13 deletions(-) diff --git a/source/libs/executor/src/streamfilloperator.c b/source/libs/executor/src/streamfilloperator.c index d3766a5eb569..58050561ddc5 100644 --- a/source/libs/executor/src/streamfilloperator.c +++ b/source/libs/executor/src/streamfilloperator.c @@ -1177,7 +1177,8 @@ void doBuildForceFillResultImpl(SOperatorInfo* pOperator, SStreamFillSupporter* if (winCode == TSDB_CODE_SUCCESS) { pFillSup->cur.key = pKey->ts; pFillSup->cur.pRowVal = val; - buildFillResult(&pFillSup->cur, pFillSup, pKey->ts, pBlock, &res); + code = buildFillResult(&pFillSup->cur, pFillSup, pKey->ts, pBlock, &res); + QUERY_CHECK_CODE(code, lino, _end); resetFillWindow(&pFillSup->cur); } else { SStreamStateCur* pCur = pAPI->stateStore.streamStateFillSeekKeyPrev(pState, pKey); @@ -1254,13 +1255,14 @@ static int32_t doStreamForceFillImpl(SOperatorInfo* pOperator) { SStreamFillInfo* pFillInfo = pInfo->pFillInfo; SSDataBlock* pBlock = pInfo->pSrcBlock; uint64_t groupId = pBlock->info.id.groupId; - SSDataBlock* pRes = pInfo->pRes; SStreamAggSupporter* pAggSup = pInfo->pStreamAggSup; SColumnInfoData* pTsCol = taosArrayGet(pInfo->pSrcBlock->pDataBlock, pInfo->primaryTsCol); TSKEY* tsCol = (TSKEY*)pTsCol->pData; - for (int32_t i = 0; i < pBlock->info.rows; i++){ - code = keepBlockRowInDiscBuf(pOperator, pFillInfo, pBlock, tsCol, i, groupId, pFillSup->rowSize); - QUERY_CHECK_CODE(code, lino, _end); + if (pFillInfo->type == TSDB_FILL_PREV) { + for (int32_t i = 0; i < pBlock->info.rows; i++){ + code = keepBlockRowInDiscBuf(pOperator, pFillInfo, pBlock, tsCol, i, groupId, pFillSup->rowSize); + QUERY_CHECK_CODE(code, lino, _end); + } } code = pAggSup->stateStore.streamStateGroupPut(pAggSup->pState, groupId, NULL, 0); QUERY_CHECK_CODE(code, lino, _end); @@ -1322,7 +1324,9 @@ static int32_t doStreamForceFillNext(SOperatorInfo* pOperator, SSDataBlock** ppR goto _end; } - pInfo->pStreamAggSup->stateStore.streamStateClearExpiredState(pInfo->pStreamAggSup->pState); + if (pInfo->pFillInfo->type == TSDB_FILL_PREV) { + pInfo->pStreamAggSup->stateStore.streamStateClearExpiredState(pInfo->pStreamAggSup->pState); + } setStreamOperatorCompleted(pOperator); (*ppRes) = NULL; goto _end; @@ -1364,7 +1368,8 @@ static int32_t doStreamForceFillNext(SOperatorInfo* pOperator, SSDataBlock** ppR QUERY_CHECK_CODE(code, lino, _end); } - doStreamForceFillImpl(pOperator); + code = doStreamForceFillImpl(pOperator); + QUERY_CHECK_CODE(code, lino, _end); } for (int32_t i = 0; i < taosArrayGetSize(pInfo->pCloseTs); i++) { @@ -1388,7 +1393,9 @@ static int32_t doStreamForceFillNext(SOperatorInfo* pOperator, SSDataBlock** ppR QUERY_CHECK_CODE(code, lino, _end); if ((*ppRes) == NULL) { - pInfo->pStreamAggSup->stateStore.streamStateClearExpiredState(pInfo->pStreamAggSup->pState); + if (pInfo->pFillInfo->type == TSDB_FILL_PREV) { + pInfo->pStreamAggSup->stateStore.streamStateClearExpiredState(pInfo->pStreamAggSup->pState); + } setStreamOperatorCompleted(pOperator); } diff --git a/source/libs/executor/src/streamintervalsliceoperator.c b/source/libs/executor/src/streamintervalsliceoperator.c index 7ec47958d1f6..e873b31062b7 100644 --- a/source/libs/executor/src/streamintervalsliceoperator.c +++ b/source/libs/executor/src/streamintervalsliceoperator.c @@ -248,7 +248,9 @@ static int32_t doStreamIntervalSliceAggImpl(SOperatorInfo* pOperator, SSDataBloc QUERY_CHECK_CODE(code, lino, _end); if (IS_VALID_WIN_KEY(prevPoint.winKey.win.skey) && prevPoint.pLastRow->key != prevPoint.winKey.win.ekey) { - setIntervalSliceOutputBuf(&prevPoint, pSup->pCtx, numOfOutput, pSup->rowEntryInfoOffset); + code = setIntervalSliceOutputBuf(&prevPoint, pSup->pCtx, numOfOutput, pSup->rowEntryInfoOffset); + QUERY_CHECK_CODE(code, lino, _end); + resetIntervalSliceFunctionKey(pSup->pCtx, numOfOutput); doStreamSliceInterpolation(prevPoint.pLastRow, prevPoint.winKey.win.ekey, curTs, pBlock, startPos, &pOperator->exprSupp, INTERVAL_SLICE_END); updateTimeWindowInfo(&pInfo->twAggSup.timeWindowData, &prevPoint.winKey.win, 1); @@ -256,10 +258,13 @@ static int32_t doStreamIntervalSliceAggImpl(SOperatorInfo* pOperator, SSDataBloc 0, pBlock->info.rows, numOfOutput); QUERY_CHECK_CODE(code, lino, _end); SWinKey prevKey = {.ts = prevPoint.winKey.win.skey, .groupId = prevPoint.winKey.groupId}; - saveWinResult(&prevKey, prevPoint.pResPos, pInfo->pUpdatedMap); + code = saveWinResult(&prevKey, prevPoint.pResPos, pInfo->pUpdatedMap); + QUERY_CHECK_CODE(code, lino, _end); } - setIntervalSliceOutputBuf(&curPoint, pSup->pCtx, numOfOutput, pSup->rowEntryInfoOffset); + code = setIntervalSliceOutputBuf(&curPoint, pSup->pCtx, numOfOutput, pSup->rowEntryInfoOffset); + QUERY_CHECK_CODE(code, lino, _end); + resetIntervalSliceFunctionKey(pSup->pCtx, numOfOutput); if (IS_VALID_WIN_KEY(prevPoint.winKey.win.skey) && curPoint.winKey.win.skey != curTs) { doStreamSliceInterpolation(prevPoint.pLastRow, curPoint.winKey.win.skey, curTs, pBlock, startPos, &pOperator->exprSupp, INTERVAL_SLICE_START); @@ -278,7 +283,8 @@ static int32_t doStreamIntervalSliceAggImpl(SOperatorInfo* pOperator, SSDataBloc QUERY_CHECK_CODE(code, lino, _end); } - saveWinResult(&curKey, curPoint.pResPos, pInfo->pUpdatedMap); + code = saveWinResult(&curKey, curPoint.pResPos, pInfo->pUpdatedMap); + QUERY_CHECK_CODE(code, lino, _end); updateTimeWindowInfo(&pInfo->twAggSup.timeWindowData, &curPoint.winKey.win, 1); code = applyAggFunctionOnPartialTuples(pTaskInfo, pSup->pCtx, &pInfo->twAggSup.timeWindowData, startPos, diff --git a/source/libs/stream/src/tstreamFileState.c b/source/libs/stream/src/tstreamFileState.c index ee6629704f37..d31665de90cf 100644 --- a/source/libs/stream/src/tstreamFileState.c +++ b/source/libs/stream/src/tstreamFileState.c @@ -1222,7 +1222,8 @@ void clearExpiredState(SStreamFileState* pFileState) { int32_t code_file = pFileState->stateFileRemoveFn(pFileState, pKey); qTrace("%s at line %d res:%d", __func__, __LINE__, code_file); - streamStateFillDel_rocksdb(pFileState->pFileStore, pKey); + code_file = streamStateFillDel_rocksdb(pFileState->pFileStore, pKey); + qTrace("%s at line %d res %d", __func__, __LINE__, code_file); } taosArrayRemoveBatch(pWinStates, 0, size - 1, NULL); } From 4f399749384955e256e0ecc08abd450b041beaf8 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Wed, 16 Oct 2024 17:17:44 +0800 Subject: [PATCH 132/695] enh:[TS-5441] cost too long in tmq write meta data by cache meta and vg info --- include/util/tlog.h | 2 +- source/client/src/clientTmq.c | 11 +-- source/common/src/tglobal.c | 4 +- source/dnode/mnode/impl/src/mndConsumer.c | 2 +- source/dnode/vnode/inc/vnode.h | 2 +- source/dnode/vnode/src/inc/vnodeInt.h | 2 +- source/dnode/vnode/src/meta/metaQuery.c | 7 +- source/dnode/vnode/src/meta/metaSnapshot.c | 2 +- source/dnode/vnode/src/tq/tqRead.c | 10 +-- source/dnode/vnode/src/tq/tqScan.c | 92 +++++++++++++--------- source/dnode/vnode/src/vnd/vnodeQuery.c | 2 +- source/util/src/tlog.c | 2 +- 12 files changed, 76 insertions(+), 62 deletions(-) diff --git a/include/util/tlog.h b/include/util/tlog.h index e80e94de328a..1a3b687e406c 100644 --- a/include/util/tlog.h +++ b/include/util/tlog.h @@ -69,7 +69,7 @@ extern int32_t tdbDebugFlag; extern int32_t sndDebugFlag; extern int32_t simDebugFlag; -extern int32_t tqClientDebug; +extern int32_t tqClientDebugFlag; int32_t taosInitLog(const char *logName, int32_t maxFiles, bool tsc); void taosCloseLog(); diff --git a/source/client/src/clientTmq.c b/source/client/src/clientTmq.c index ce701a755c86..0233372012f2 100644 --- a/source/client/src/clientTmq.c +++ b/source/client/src/clientTmq.c @@ -24,12 +24,9 @@ #include "tref.h" #include "ttimer.h" -#define tqFatalC(...) do { if (cDebugFlag & DEBUG_FATAL || tqClientDebug) { taosPrintLog("TQ FATAL ", DEBUG_FATAL, tqDebugFlag, __VA_ARGS__); }} while(0) -#define tqErrorC(...) do { if (cDebugFlag & DEBUG_ERROR || tqClientDebug) { taosPrintLog("TQ ERROR ", DEBUG_ERROR, tqDebugFlag, __VA_ARGS__); }} while(0) -#define tqWarnC(...) do { if (cDebugFlag & DEBUG_WARN || tqClientDebug) { taosPrintLog("TQ WARN ", DEBUG_WARN, tqDebugFlag, __VA_ARGS__); }} while(0) -#define tqInfoC(...) do { if (cDebugFlag & DEBUG_INFO || tqClientDebug) { taosPrintLog("TQ ", DEBUG_INFO, tqDebugFlag, __VA_ARGS__); }} while(0) -#define tqDebugC(...) do { if (cDebugFlag & DEBUG_DEBUG || tqClientDebug) { taosPrintLog("TQ ", DEBUG_DEBUG, tqDebugFlag, __VA_ARGS__); }} while(0) -#define tqTraceC(...) do { if (cDebugFlag & DEBUG_TRACE || tqClientDebug) { taosPrintLog("TQ ", DEBUG_TRACE, tqDebugFlag, __VA_ARGS__); }} while(0) +#define tqErrorC(...) do { if (cDebugFlag & DEBUG_ERROR || tqClientDebugFlag & DEBUG_ERROR) { taosPrintLog("TQ ERROR ", DEBUG_ERROR, 255, __VA_ARGS__); }} while(0) +#define tqInfoC(...) do { if (cDebugFlag & DEBUG_INFO || tqClientDebugFlag & DEBUG_INFO) { taosPrintLog("TQ ", DEBUG_INFO, 255, __VA_ARGS__); }} while(0) +#define tqDebugC(...) do { if (cDebugFlag & DEBUG_DEBUG || tqClientDebugFlag & DEBUG_DEBUG) { taosPrintLog("TQ ", DEBUG_DEBUG, tqClientDebugFlag|cDebugFlag, __VA_ARGS__); }} while(0) #define EMPTY_BLOCK_POLL_IDLE_DURATION 10 #define DEFAULT_AUTO_COMMIT_INTERVAL 5000 @@ -957,7 +954,7 @@ int32_t tmqHbCb(void* param, SDataBuf* pMsg, int32_t code) { } } - tqClientDebug = rsp.debugFlag; + tqClientDebugFlag = rsp.debugFlag; tDestroySMqHbRsp(&rsp); END: diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index b6fdc2c3c76f..ea76adef1a3d 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -542,7 +542,7 @@ static int32_t taosAddServerLogCfg(SConfig *pCfg) { TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "sDebugFlag", sDebugFlag, 0, 255, CFG_SCOPE_SERVER, CFG_DYN_SERVER)); TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "tsdbDebugFlag", tsdbDebugFlag, 0, 255, CFG_SCOPE_SERVER, CFG_DYN_SERVER)); TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "tqDebugFlag", tqDebugFlag, 0, 255, CFG_SCOPE_SERVER, CFG_DYN_SERVER)); - TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "tqClientDebug", tqClientDebug, 0, 255, CFG_SCOPE_SERVER, CFG_DYN_SERVER)); + TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "tqClientDebugFlag", tqClientDebugFlag, 0, 255, CFG_SCOPE_SERVER, CFG_DYN_SERVER)); TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "fsDebugFlag", fsDebugFlag, 0, 255, CFG_SCOPE_SERVER, CFG_DYN_SERVER)); TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "udfDebugFlag", udfDebugFlag, 0, 255, CFG_SCOPE_SERVER, CFG_DYN_SERVER)); TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "smaDebugFlag", smaDebugFlag, 0, 255, CFG_SCOPE_SERVER, CFG_DYN_SERVER)); @@ -1959,7 +1959,7 @@ static int32_t taosCfgDynamicOptionsForServer(SConfig *pCfg, const char *name) { {"smaDebugFlag", &smaDebugFlag}, {"idxDebugFlag", &idxDebugFlag}, {"tdbDebugFlag", &tdbDebugFlag}, {"tmrDebugFlag", &tmrDebugFlag}, {"uDebugFlag", &uDebugFlag}, {"smaDebugFlag", &smaDebugFlag}, {"rpcDebugFlag", &rpcDebugFlag}, {"qDebugFlag", &qDebugFlag}, {"metaDebugFlag", &metaDebugFlag}, - {"stDebugFlag", &stDebugFlag}, {"sndDebugFlag", &sndDebugFlag}, {"tqClientDebug", &tqClientDebug}, + {"stDebugFlag", &stDebugFlag}, {"sndDebugFlag", &sndDebugFlag}, {"tqClientDebugFlag", &tqClientDebugFlag}, }; static OptionNameAndVar options[] = {{"audit", &tsEnableAudit}, diff --git a/source/dnode/mnode/impl/src/mndConsumer.c b/source/dnode/mnode/impl/src/mndConsumer.c index e80654b65acf..0538a5fe8389 100644 --- a/source/dnode/mnode/impl/src/mndConsumer.c +++ b/source/dnode/mnode/impl/src/mndConsumer.c @@ -245,7 +245,7 @@ static int32_t mndProcessMqHbReq(SRpcMsg *pMsg) { } storeOffsetRows(pMnode, &req, pConsumer); - rsp.debugFlag = tqClientDebug; + rsp.debugFlag = tqClientDebugFlag; code = buildMqHbRsp(pMsg, &rsp); END: diff --git a/source/dnode/vnode/inc/vnode.h b/source/dnode/vnode/inc/vnode.h index 204311aa98d0..610ba4367397 100644 --- a/source/dnode/vnode/inc/vnode.h +++ b/source/dnode/vnode/inc/vnode.h @@ -243,7 +243,7 @@ int32_t extractMsgFromWal(SWalReader *pReader, void **pItem, int64_t maxVer, con int32_t tqReaderSetSubmitMsg(STqReader *pReader, void *msgStr, int32_t msgLen, int64_t ver); bool tqNextDataBlockFilterOut(STqReader *pReader, SHashObj *filterOutUids); int32_t tqRetrieveDataBlock(STqReader *pReader, SSDataBlock **pRes, const char *idstr); -int32_t tqRetrieveTaosxBlock(STqReader *pReader, SArray *blocks, SArray *schemas, SSubmitTbData **pSubmitTbDataRet); +int32_t tqRetrieveTaosxBlock(STqReader *pReader, SArray *blocks, SArray *schemas, SSubmitTbData **pSubmitTbDataRet, int64_t *createTime); int32_t tqGetStreamExecInfo(SVnode *pVnode, int64_t streamId, int64_t *pDelay, bool *fhFinished); // sma diff --git a/source/dnode/vnode/src/inc/vnodeInt.h b/source/dnode/vnode/src/inc/vnodeInt.h index 1bd4317234f7..4497651151de 100644 --- a/source/dnode/vnode/src/inc/vnodeInt.h +++ b/source/dnode/vnode/src/inc/vnodeInt.h @@ -160,7 +160,7 @@ int32_t metaDropTables(SMeta* pMeta, SArray* tbUids); int metaTtlFindExpired(SMeta* pMeta, int64_t timePointMs, SArray* tbUids, int32_t ttlDropMaxCount); int metaAlterTable(SMeta* pMeta, int64_t version, SVAlterTbReq* pReq, STableMetaRsp* pMetaRsp); int metaUpdateChangeTimeWithLock(SMeta* pMeta, tb_uid_t uid, int64_t changeTimeMs); -SSchemaWrapper* metaGetTableSchema(SMeta* pMeta, tb_uid_t uid, int32_t sver, int lock); +SSchemaWrapper* metaGetTableSchema(SMeta* pMeta, tb_uid_t uid, int32_t sver, int lock, int64_t *createTime); int32_t metaGetTbTSchemaNotNull(SMeta* pMeta, tb_uid_t uid, int32_t sver, int lock, STSchema** ppTSchema); int32_t metaGetTbTSchemaMaybeNull(SMeta* pMeta, tb_uid_t uid, int32_t sver, int lock, STSchema** ppTSchema); STSchema* metaGetTbTSchema(SMeta* pMeta, tb_uid_t uid, int32_t sver, int lock); diff --git a/source/dnode/vnode/src/meta/metaQuery.c b/source/dnode/vnode/src/meta/metaQuery.c index 484c5c0a1613..e2ba8d9ccbc4 100644 --- a/source/dnode/vnode/src/meta/metaQuery.c +++ b/source/dnode/vnode/src/meta/metaQuery.c @@ -371,7 +371,7 @@ int32_t metaTbCursorPrev(SMTbCursor *pTbCur, ETableType jumpTableType) { return 0; } -SSchemaWrapper *metaGetTableSchema(SMeta *pMeta, tb_uid_t uid, int32_t sver, int lock) { +SSchemaWrapper *metaGetTableSchema(SMeta *pMeta, tb_uid_t uid, int32_t sver, int lock, int64_t *createTime) { void *pData = NULL; int nData = 0; int64_t version; @@ -407,6 +407,9 @@ SSchemaWrapper *metaGetTableSchema(SMeta *pMeta, tb_uid_t uid, int32_t sver, int } } else if (me.type == TSDB_CHILD_TABLE) { uid = me.ctbEntry.suid; + if (createTime != NULL){ + *createTime = me.ctbEntry.btime; + } tDecoderClear(&dc); goto _query; } else { @@ -617,7 +620,7 @@ STSchema *metaGetTbTSchema(SMeta *pMeta, tb_uid_t uid, int32_t sver, int lock) { STSchema *pTSchema = NULL; SSchemaWrapper *pSW = NULL; - pSW = metaGetTableSchema(pMeta, uid, sver, lock); + pSW = metaGetTableSchema(pMeta, uid, sver, lock, NULL); if (!pSW) return NULL; pTSchema = tBuildTSchema(pSW->pSchema, pSW->nCols, pSW->version); diff --git a/source/dnode/vnode/src/meta/metaSnapshot.c b/source/dnode/vnode/src/meta/metaSnapshot.c index 0936d8f09284..b2826ec45ac8 100644 --- a/source/dnode/vnode/src/meta/metaSnapshot.c +++ b/source/dnode/vnode/src/meta/metaSnapshot.c @@ -552,7 +552,7 @@ int32_t setForSnapShot(SSnapContext* ctx, int64_t uid) { void taosXSetTablePrimaryKey(SSnapContext* ctx, int64_t uid) { bool ret = false; - SSchemaWrapper* schema = metaGetTableSchema(ctx->pMeta, uid, -1, 1); + SSchemaWrapper* schema = metaGetTableSchema(ctx->pMeta, uid, -1, 1, NULL); if (schema && schema->nCols >= 2 && schema->pSchema[1].flags & COL_IS_KEY) { ret = true; } diff --git a/source/dnode/vnode/src/tq/tqRead.c b/source/dnode/vnode/src/tq/tqRead.c index f594c2f229a2..fedcc0e82dc7 100644 --- a/source/dnode/vnode/src/tq/tqRead.c +++ b/source/dnode/vnode/src/tq/tqRead.c @@ -263,7 +263,7 @@ bool tqGetTablePrimaryKey(STqReader* pReader) { return pReader->hasPrimaryKey; } void tqSetTablePrimaryKey(STqReader* pReader, int64_t uid) { bool ret = false; - SSchemaWrapper* schema = metaGetTableSchema(pReader->pVnodeMeta, uid, -1, 1); + SSchemaWrapper* schema = metaGetTableSchema(pReader->pVnodeMeta, uid, -1, 1, NULL); if (schema && schema->nCols >= 2 && schema->pSchema[1].flags & COL_IS_KEY) { ret = true; } @@ -669,7 +669,7 @@ int32_t tqRetrieveDataBlock(STqReader* pReader, SSDataBlock** pRes, const char* (pReader->cachedSchemaVer != sversion)) { tDeleteSchemaWrapper(pReader->pSchemaWrapper); - pReader->pSchemaWrapper = metaGetTableSchema(pReader->pVnodeMeta, uid, sversion, 1); + pReader->pSchemaWrapper = metaGetTableSchema(pReader->pVnodeMeta, uid, sversion, 1, NULL); if (pReader->pSchemaWrapper == NULL) { tqWarn("vgId:%d, cannot found schema wrapper for table: suid:%" PRId64 ", uid:%" PRId64 "version %d, possibly dropped table", @@ -961,10 +961,8 @@ int32_t tqProcessRowData(STqReader* pReader, SSubmitTbData* pSubmitTbData, SArra return code; } -int32_t tqRetrieveTaosxBlock(STqReader* pReader, SArray* blocks, SArray* schemas, SSubmitTbData** pSubmitTbDataRet) { +int32_t tqRetrieveTaosxBlock(STqReader* pReader, SArray* blocks, SArray* schemas, SSubmitTbData** pSubmitTbDataRet, int64_t *createTime) { tqTrace("tq reader retrieve data block %p, %d", pReader->msg.msgStr, pReader->nextBlk); - SSDataBlock* block = NULL; - SSubmitTbData* pSubmitTbData = taosArrayGet(pReader->submit.aSubmitTbData, pReader->nextBlk); if (pSubmitTbData == NULL) { return terrno; @@ -980,7 +978,7 @@ int32_t tqRetrieveTaosxBlock(STqReader* pReader, SArray* blocks, SArray* schemas pReader->lastBlkUid = uid; tDeleteSchemaWrapper(pReader->pSchemaWrapper); - pReader->pSchemaWrapper = metaGetTableSchema(pReader->pVnodeMeta, uid, sversion, 1); + pReader->pSchemaWrapper = metaGetTableSchema(pReader->pVnodeMeta, uid, sversion, 1, createTime); if (pReader->pSchemaWrapper == NULL) { tqWarn("vgId:%d, cannot found schema wrapper for table: suid:%" PRId64 ", version %d, possibly dropped table", pReader->pWalReader->pWal->cfg.vgId, uid, pReader->cachedSchemaVer); diff --git a/source/dnode/vnode/src/tq/tqScan.c b/source/dnode/vnode/src/tq/tqScan.c index 68702754aaa9..3e4895378bd0 100644 --- a/source/dnode/vnode/src/tq/tqScan.c +++ b/source/dnode/vnode/src/tq/tqScan.c @@ -293,6 +293,54 @@ int32_t tqScanTaosx(STQ* pTq, const STqHandle* pHandle, SMqDataRsp* pRsp, SMqBat return code; } +static int32_t buildCreateTbInfo(SMqDataRsp* pRsp, SVCreateTbReq* pCreateTbReq){ + int32_t code = 0; + void* createReq = NULL; + if (pRsp->createTableNum == 0) { + pRsp->createTableLen = taosArrayInit(0, sizeof(int32_t)); + if (pRsp->createTableLen == NULL) { + code = terrno; + goto END; + } + pRsp->createTableReq = taosArrayInit(0, sizeof(void*)); + if (pRsp->createTableReq == NULL) { + code = terrno; + goto END; + } + } + + uint32_t len = 0; + tEncodeSize(tEncodeSVCreateTbReq, pCreateTbReq, len, code); + if (TSDB_CODE_SUCCESS != code) { + goto END; + } + createReq = taosMemoryCalloc(1, len); + if (createReq == NULL){ + code = terrno; + goto END; + } + SEncoder encoder = {0}; + tEncoderInit(&encoder, createReq, len); + code = tEncodeSVCreateTbReq(&encoder, pCreateTbReq); + tEncoderClear(&encoder); + if (code < 0) { + goto END; + } + if (taosArrayPush(pRsp->createTableLen, &len) == NULL){ + code = terrno; + goto END; + } + if (taosArrayPush(pRsp->createTableReq, &createReq) == NULL){ + code = terrno; + goto END; + } + pRsp->createTableNum++; + + return 0; +END: + taosMemoryFree(createReq); + return code; +} static void tqProcessSubData(STQ* pTq, STqHandle* pHandle, SMqDataRsp* pRsp, int32_t* totalRows, int8_t sourceExcluded){ int32_t code = 0; @@ -312,7 +360,8 @@ static void tqProcessSubData(STQ* pTq, STqHandle* pHandle, SMqDataRsp* pRsp, int } SSubmitTbData* pSubmitTbDataRet = NULL; - code = tqRetrieveTaosxBlock(pReader, pBlocks, pSchemas, &pSubmitTbDataRet); + int64_t createTime = INT64_MAX; + code = tqRetrieveTaosxBlock(pReader, pBlocks, pSchemas, &pSubmitTbDataRet, &createTime); if (code != 0) { tqError("vgId:%d, failed to retrieve block", pTq->pVnode->config.vgId); goto END; @@ -330,46 +379,13 @@ static void tqProcessSubData(STQ* pTq, STqHandle* pHandle, SMqDataRsp* pRsp, int } } if (pHandle->fetchMeta != WITH_DATA && pSubmitTbDataRet->pCreateTbReq != NULL) { - if (pRsp->createTableNum == 0) { - pRsp->createTableLen = taosArrayInit(0, sizeof(int32_t)); - if (pRsp->createTableLen == NULL) { - code = terrno; - goto END; - } - pRsp->createTableReq = taosArrayInit(0, sizeof(void*)); - if (pRsp->createTableReq == NULL) { - code = terrno; + if (pSubmitTbDataRet->ctimeMs - createTime <= 1000) { // judge if table is already created to avoid sending crateTbReq + code = buildCreateTbInfo(pRsp, pSubmitTbDataRet->pCreateTbReq); + if (code != 0){ + tqError("vgId:%d, failed to build create table info", pTq->pVnode->config.vgId); goto END; } } - - uint32_t len = 0; - tEncodeSize(tEncodeSVCreateTbReq, pSubmitTbDataRet->pCreateTbReq, len, code); - if (TSDB_CODE_SUCCESS != code) { - goto END; - } - void* createReq = taosMemoryCalloc(1, len); - if (createReq == NULL){ - code = terrno; - goto END; - } - SEncoder encoder = {0}; - tEncoderInit(&encoder, createReq, len); - code = tEncodeSVCreateTbReq(&encoder, pSubmitTbDataRet->pCreateTbReq); - tEncoderClear(&encoder); - if (code < 0) { - taosMemoryFree(createReq); - goto END; - } - if (taosArrayPush(pRsp->createTableLen, &len) == NULL){ - taosMemoryFree(createReq); - goto END; - } - if (taosArrayPush(pRsp->createTableReq, &createReq) == NULL){ - taosMemoryFree(createReq); - goto END; - } - pRsp->createTableNum++; } if (pHandle->fetchMeta == ONLY_META && pSubmitTbDataRet->pCreateTbReq == NULL) { goto END; diff --git a/source/dnode/vnode/src/vnd/vnodeQuery.c b/source/dnode/vnode/src/vnd/vnodeQuery.c index 7c6a2e731308..0929953e1cfb 100644 --- a/source/dnode/vnode/src/vnd/vnodeQuery.c +++ b/source/dnode/vnode/src/vnd/vnodeQuery.c @@ -702,7 +702,7 @@ int32_t vnodeGetCtbNum(SVnode *pVnode, int64_t suid, int64_t *num) { } int32_t vnodeGetStbColumnNum(SVnode *pVnode, tb_uid_t suid, int *num) { - SSchemaWrapper *pSW = metaGetTableSchema(pVnode->pMeta, suid, -1, 0); + SSchemaWrapper *pSW = metaGetTableSchema(pVnode->pMeta, suid, -1, 0, NULL); if (pSW) { *num = pSW->nCols; tDeleteSchemaWrapper(pSW); diff --git a/source/util/src/tlog.c b/source/util/src/tlog.c index 45c8a2f6c289..2b80eaf85d6b 100644 --- a/source/util/src/tlog.c +++ b/source/util/src/tlog.c @@ -125,7 +125,7 @@ int32_t idxDebugFlag = 131; int32_t sndDebugFlag = 131; int32_t simDebugFlag = 131; -int32_t tqClientDebug = 0; +int32_t tqClientDebugFlag = 0; int64_t dbgEmptyW = 0; int64_t dbgWN = 0; From 39379af1a21559583ae59d2f0eef7cec465d09bf Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Wed, 16 Oct 2024 17:34:03 +0800 Subject: [PATCH 133/695] add twa ci --- source/libs/executor/inc/executorInt.h | 1 + source/libs/executor/src/executil.c | 2 + source/libs/executor/src/streamfilloperator.c | 38 +-- .../src/streamintervalsliceoperator.c | 64 ++-- tests/script/tsim/stream/streamTwaError.sim | 29 ++ tests/script/tsim/stream/streamTwaFwcFill.sim | 278 ++++++++++++++++++ .../stream/streamTwaFwcFillPrimaryKey.sim | 222 ++++++++++++++ .../streamTwaFwcIntervalPrimaryKeyl.sim | 109 +++++++ 8 files changed, 686 insertions(+), 57 deletions(-) create mode 100644 tests/script/tsim/stream/streamTwaError.sim create mode 100644 tests/script/tsim/stream/streamTwaFwcFill.sim create mode 100644 tests/script/tsim/stream/streamTwaFwcFillPrimaryKey.sim create mode 100644 tests/script/tsim/stream/streamTwaFwcIntervalPrimaryKeyl.sim diff --git a/source/libs/executor/inc/executorInt.h b/source/libs/executor/inc/executorInt.h index a0ad574d54c3..26d59a90badb 100644 --- a/source/libs/executor/inc/executorInt.h +++ b/source/libs/executor/inc/executorInt.h @@ -879,6 +879,7 @@ typedef struct SStreamIntervalSliceOperatorInfo { SGroupResInfo groupResInfo; struct SOperatorInfo* pOperator; bool hasFill; + bool hasInterpoFunc; } SStreamIntervalSliceOperatorInfo; #define OPTR_IS_OPENED(_optr) (((_optr)->status & OP_OPENED) == OP_OPENED) diff --git a/source/libs/executor/src/executil.c b/source/libs/executor/src/executil.c index fe8288955ff6..48d6e71fd90b 100644 --- a/source/libs/executor/src/executil.c +++ b/source/libs/executor/src/executil.c @@ -2821,6 +2821,8 @@ char* getStreamOpName(uint16_t opType) { return "stream count"; case QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERP_FUNC: return "stream interp"; + case QUERY_NODE_PHYSICAL_PLAN_STREAM_CONTINUE_INTERVAL: + return "interval continue"; } return ""; } diff --git a/source/libs/executor/src/streamfilloperator.c b/source/libs/executor/src/streamfilloperator.c index 58050561ddc5..a36c2a65e0ab 100644 --- a/source/libs/executor/src/streamfilloperator.c +++ b/source/libs/executor/src/streamfilloperator.c @@ -1258,11 +1258,9 @@ static int32_t doStreamForceFillImpl(SOperatorInfo* pOperator) { SStreamAggSupporter* pAggSup = pInfo->pStreamAggSup; SColumnInfoData* pTsCol = taosArrayGet(pInfo->pSrcBlock->pDataBlock, pInfo->primaryTsCol); TSKEY* tsCol = (TSKEY*)pTsCol->pData; - if (pFillInfo->type == TSDB_FILL_PREV) { - for (int32_t i = 0; i < pBlock->info.rows; i++){ - code = keepBlockRowInDiscBuf(pOperator, pFillInfo, pBlock, tsCol, i, groupId, pFillSup->rowSize); - QUERY_CHECK_CODE(code, lino, _end); - } + for (int32_t i = 0; i < pBlock->info.rows; i++){ + code = keepBlockRowInDiscBuf(pOperator, pFillInfo, pBlock, tsCol, i, groupId, pFillSup->rowSize); + QUERY_CHECK_CODE(code, lino, _end); } code = pAggSup->stateStore.streamStateGroupPut(pAggSup->pState, groupId, NULL, 0); QUERY_CHECK_CODE(code, lino, _end); @@ -1323,10 +1321,7 @@ static int32_t doStreamForceFillNext(SOperatorInfo* pOperator, SSDataBlock** ppR (*ppRes) = resBlock; goto _end; } - - if (pInfo->pFillInfo->type == TSDB_FILL_PREV) { - pInfo->pStreamAggSup->stateStore.streamStateClearExpiredState(pInfo->pStreamAggSup->pState); - } + pInfo->pStreamAggSup->stateStore.streamStateClearExpiredState(pInfo->pStreamAggSup->pState); setStreamOperatorCompleted(pOperator); (*ppRes) = NULL; goto _end; @@ -1393,9 +1388,7 @@ static int32_t doStreamForceFillNext(SOperatorInfo* pOperator, SSDataBlock** ppR QUERY_CHECK_CODE(code, lino, _end); if ((*ppRes) == NULL) { - if (pInfo->pFillInfo->type == TSDB_FILL_PREV) { - pInfo->pStreamAggSup->stateStore.streamStateClearExpiredState(pInfo->pStreamAggSup->pState); - } + pInfo->pStreamAggSup->stateStore.streamStateClearExpiredState(pInfo->pStreamAggSup->pState); setStreamOperatorCompleted(pOperator); } @@ -1655,24 +1648,6 @@ int32_t getDownStreamInfo(SOperatorInfo* downstream, int8_t* triggerType, SInter return code; } -int32_t initForceFillDownStream(SOperatorInfo* downstream) { - SExecTaskInfo* pTaskInfo = downstream->pTaskInfo; - int32_t code = TSDB_CODE_SUCCESS; - int32_t lino = 0; - - if (downstream == NULL) { - return TSDB_CODE_STREAM_INTERNAL_ERROR; - } - - if (downstream->operatorType != QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN) { - code = initForceFillDownStream(downstream->pDownstream[0]); - return code; - } - SStreamScanInfo* pInfo = (SStreamScanInfo*) downstream->info; - pInfo->useGetResultRange = true; - return code; -} - int32_t createStreamFillOperatorInfo(SOperatorInfo* downstream, SStreamFillPhysiNode* pPhyFillNode, SExecTaskInfo* pTaskInfo, SOperatorInfo** pOptrInfo) { QRY_PARAM_CHECK(pOptrInfo); @@ -1755,9 +1730,6 @@ int32_t createStreamFillOperatorInfo(SOperatorInfo* downstream, SStreamFillPhysi pTaskInfo); if (triggerType == STREAM_TRIGGER_FORCE_WINDOW_CLOSE) { - code = initForceFillDownStream(downstream); - QUERY_CHECK_CODE(code, lino, _error); - pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, doStreamForceFillNext, NULL, destroyStreamFillOperatorInfo, optrDefaultBufFn, NULL, optrDefaultGetNextExtFn, NULL); } else { diff --git a/source/libs/executor/src/streamintervalsliceoperator.c b/source/libs/executor/src/streamintervalsliceoperator.c index e873b31062b7..995ca02d4f9c 100644 --- a/source/libs/executor/src/streamintervalsliceoperator.c +++ b/source/libs/executor/src/streamintervalsliceoperator.c @@ -116,7 +116,7 @@ void initIntervalSlicePoint(SStreamAggSupporter* pAggSup, STimeWindow* pTWin, in pPoint->pLastRow = POINTER_SHIFT(pPoint->pResPos->pRowBuff, pAggSup->resultRowSize - pAggSup->stateKeySize); } -static int32_t getIntervalSliceCurStateBuf(SStreamAggSupporter* pAggSup, SInterval* pInterval, STimeWindow* pTWin, int64_t groupId, +static int32_t getIntervalSliceCurStateBuf(SStreamAggSupporter* pAggSup, SInterval* pInterval, bool needPrev, STimeWindow* pTWin, int64_t groupId, SInervalSlicePoint* pCurPoint, SInervalSlicePoint* pPrevPoint, int32_t* pWinCode) { int32_t code = TSDB_CODE_SUCCESS; int32_t lino = 0; @@ -126,26 +126,28 @@ static int32_t getIntervalSliceCurStateBuf(SStreamAggSupporter* pAggSup, SInterv &curVLen, pWinCode); QUERY_CHECK_CODE(code, lino, _end); - qDebug("===stream=== set stream twa next point buf.ts:%" PRId64 ", groupId:%" PRId64 ", res:%d", + qDebug("===stream=== set stream twa next point buf.ts:%" PRId64 ", groupId:%" PRIu64 ", res:%d", curKey.ts, curKey.groupId, *pWinCode); initIntervalSlicePoint(pAggSup, pTWin, groupId, pCurPoint); - SWinKey prevKey = {.groupId = groupId}; - SET_WIN_KEY_INVALID(prevKey.ts); - int32_t prevVLen = 0; - int32_t prevWinCode = TSDB_CODE_SUCCESS; - code = pAggSup->stateStore.streamStateGetPrev(pAggSup->pState, &curKey, &prevKey, - (void**)&pPrevPoint->pResPos, &prevVLen, &prevWinCode); - QUERY_CHECK_CODE(code, lino, _end); + if (needPrev) { + SWinKey prevKey = {.groupId = groupId}; + SET_WIN_KEY_INVALID(prevKey.ts); + int32_t prevVLen = 0; + int32_t prevWinCode = TSDB_CODE_SUCCESS; + code = pAggSup->stateStore.streamStateGetPrev(pAggSup->pState, &curKey, &prevKey, (void**)&pPrevPoint->pResPos, + &prevVLen, &prevWinCode); + QUERY_CHECK_CODE(code, lino, _end); - if (prevWinCode == TSDB_CODE_SUCCESS) { - STimeWindow prevSTW = {.skey = prevKey.ts}; - prevSTW.ekey = taosTimeGetIntervalEnd(prevSTW.skey, pInterval); - initIntervalSlicePoint(pAggSup, &prevSTW, groupId, pPrevPoint); - } else { - SET_WIN_KEY_INVALID(pPrevPoint->winKey.win.skey); - SET_WIN_KEY_INVALID(pPrevPoint->winKey.win.ekey); + if (prevWinCode == TSDB_CODE_SUCCESS) { + STimeWindow prevSTW = {.skey = prevKey.ts}; + prevSTW.ekey = taosTimeGetIntervalEnd(prevSTW.skey, pInterval); + initIntervalSlicePoint(pAggSup, &prevSTW, groupId, pPrevPoint); + } else { + SET_WIN_KEY_INVALID(pPrevPoint->winKey.win.skey); + SET_WIN_KEY_INVALID(pPrevPoint->winKey.win.ekey); + } } _end: @@ -244,10 +246,10 @@ static int32_t doStreamIntervalSliceAggImpl(SOperatorInfo* pOperator, SSDataBloc } int32_t winCode = TSDB_CODE_SUCCESS; - code = getIntervalSliceCurStateBuf(&pInfo->streamAggSup, &pInfo->interval, &curWin, groupId, &curPoint, &prevPoint, &winCode); + code = getIntervalSliceCurStateBuf(&pInfo->streamAggSup, &pInfo->interval, pInfo->hasInterpoFunc, &curWin, groupId, &curPoint, &prevPoint, &winCode); QUERY_CHECK_CODE(code, lino, _end); - if (IS_VALID_WIN_KEY(prevPoint.winKey.win.skey) && prevPoint.pLastRow->key != prevPoint.winKey.win.ekey) { + if (pInfo->hasInterpoFunc && IS_VALID_WIN_KEY(prevPoint.winKey.win.skey) && prevPoint.pLastRow->key != prevPoint.winKey.win.ekey) { code = setIntervalSliceOutputBuf(&prevPoint, pSup->pCtx, numOfOutput, pSup->rowEntryInfoOffset); QUERY_CHECK_CODE(code, lino, _end); @@ -266,13 +268,13 @@ static int32_t doStreamIntervalSliceAggImpl(SOperatorInfo* pOperator, SSDataBloc QUERY_CHECK_CODE(code, lino, _end); resetIntervalSliceFunctionKey(pSup->pCtx, numOfOutput); - if (IS_VALID_WIN_KEY(prevPoint.winKey.win.skey) && curPoint.winKey.win.skey != curTs) { + if (pInfo->hasInterpoFunc && IS_VALID_WIN_KEY(prevPoint.winKey.win.skey) && curPoint.winKey.win.skey != curTs) { doStreamSliceInterpolation(prevPoint.pLastRow, curPoint.winKey.win.skey, curTs, pBlock, startPos, &pOperator->exprSupp, INTERVAL_SLICE_START); } forwardRows = getNumOfRowsInTimeWindow(&pBlock->info, tsCols, startPos, curWin.ekey, binarySearchForKey, NULL, TSDB_ORDER_ASC); int32_t prevEndPos = (forwardRows - 1) + startPos; - if (winCode != TSDB_CODE_SUCCESS) { + if (pInfo->hasInterpoFunc && winCode != TSDB_CODE_SUCCESS) { int32_t endRowId = getQualifiedRowNumDesc(pSup, pBlock, tsCols, prevEndPos, false); TSKEY endRowTs = tsCols[endRowId]; transBlockToSliceResultRow(pBlock, endRowId, endRowTs, curPoint.pLastRow, 0, NULL, NULL); @@ -387,7 +389,7 @@ static int32_t doStreamIntervalSliceNext(SOperatorInfo* pOperator, SSDataBlock** code = setInputDataBlock(&pOperator->exprSupp, pBlock, TSDB_ORDER_ASC, MAIN_SCAN, true); QUERY_CHECK_CODE(code, lino, _end); - code = doStreamIntervalSliceAggImpl(pOperator, pBlock, pInfo->pUpdatedMap, pInfo->pDeletedMap); + code = doStreamIntervalSliceAggImpl(pOperator, pBlock, pInfo->pUpdatedMap, NULL); QUERY_CHECK_CODE(code, lino, _end); } @@ -435,7 +437,7 @@ static int32_t doStreamIntervalSliceNext(SOperatorInfo* pOperator, SSDataBlock** int32_t initIntervalSliceDownStream(SOperatorInfo* downstream, SStreamAggSupporter* pAggSup, uint16_t type, int32_t tsColIndex, STimeWindowAggSupp* pTwSup, struct SSteamOpBasicInfo* pBasic, - SInterval* pInterval) { + SInterval* pInterval, bool hasInterpoFunc) { SExecTaskInfo* pTaskInfo = downstream->pTaskInfo; int32_t code = TSDB_CODE_SUCCESS; int32_t lino = 0; @@ -447,10 +449,11 @@ int32_t initIntervalSliceDownStream(SOperatorInfo* downstream, SStreamAggSupport if (downstream->operatorType != QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN) { code = - initIntervalSliceDownStream(downstream->pDownstream[0], pAggSup, type, tsColIndex, pTwSup, pBasic, pInterval); + initIntervalSliceDownStream(downstream->pDownstream[0], pAggSup, type, tsColIndex, pTwSup, pBasic, pInterval, hasInterpoFunc); return code; } SStreamScanInfo* pScanInfo = downstream->info; + pScanInfo->useGetResultRange = hasInterpoFunc; pScanInfo->igCheckUpdate = true; pScanInfo->windowSup = (SWindowSupporter){.pStreamAggSup = pAggSup, .gap = pAggSup->gap, .parentType = type}; pScanInfo->pState = pAggSup->pState; @@ -474,6 +477,18 @@ int32_t initIntervalSliceDownStream(SOperatorInfo* downstream, SStreamAggSupport return code; } +static bool windowinterpNeeded(SqlFunctionCtx* pCtx, int32_t numOfCols) { + bool needed = false; + for (int32_t i = 0; i < numOfCols; ++i) { + SExprInfo* pExpr = pCtx[i].pExpr; + if (fmIsIntervalInterpoFunc(pCtx[i].functionId)) { + needed = true; + break; + } + } + return needed; +} + int32_t createStreamIntervalSliceOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo, SReadHandle* pHandle, SOperatorInfo** ppOptInfo) { int32_t code = TSDB_CODE_SUCCESS; @@ -564,6 +579,7 @@ int32_t createStreamIntervalSliceOperatorInfo(SOperatorInfo* downstream, SPhysiN pInfo->destHasPrimaryKey = pIntervalPhyNode->window.destHasPrimaryKey; pInfo->pOperator = pOperator; pInfo->hasFill = false; + pInfo->hasInterpoFunc = windowinterpNeeded(pExpSup->pCtx, numOfExprs); setOperatorInfo(pOperator, "StreamIntervalSliceOperator", QUERY_NODE_PHYSICAL_PLAN_STREAM_CONTINUE_INTERVAL, true, OP_NOT_OPENED, pInfo, pTaskInfo); @@ -574,7 +590,7 @@ int32_t createStreamIntervalSliceOperatorInfo(SOperatorInfo* downstream, SPhysiN initStreamBasicInfo(&pInfo->basic); if (downstream) { code = initIntervalSliceDownStream(downstream, &pInfo->streamAggSup, pPhyNode->type, pInfo->primaryTsIndex, - &pInfo->twAggSup, &pInfo->basic, &pInfo->interval); + &pInfo->twAggSup, &pInfo->basic, &pInfo->interval, pInfo->hasInterpoFunc); QUERY_CHECK_CODE(code, lino, _error); code = appendDownstream(pOperator, &downstream, 1); diff --git a/tests/script/tsim/stream/streamTwaError.sim b/tests/script/tsim/stream/streamTwaError.sim new file mode 100644 index 000000000000..2162c924e0b1 --- /dev/null +++ b/tests/script/tsim/stream/streamTwaError.sim @@ -0,0 +1,29 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sleep 50 +sql connect + +print step1 +print =============== create database +sql create database test vgroups 1; +sql use test; + +sql create stable st(ts timestamp, a int, b int , c int)tags(ta int,tb int,tc int); +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); + +sql create stream streams1 trigger force_window_close IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _wstart, twa(a) from st partition by tbname,ta interval(2s) fill(prev); + +sql_error create stream streams2 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2 as select _wstart, twa(a) from st partition by tbname,ta interval(2s) fill(prev); +sql_error create stream streams3 trigger window_close IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt3 as select _wstart, twa(a) from st partition by tbname,ta interval(2s) fill(prev); +sql_error create stream streams4 trigger max_delay 5s IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt4 as select _wstart, twa(a) from st partition by tbname,ta interval(2s) fill(prev); + +sql_error create stream streams5 trigger force_window_close IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt5 as select _wstart, twa(a) from st interval(2s) fill(prev); +sql_error create stream streams6 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt6 as select last(ts), twa(a) from st partition by tbname,ta; +sql_error create stream streams7 trigger force_window_close IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt7 as select _wstart, twa(a) from st partition by tbname,ta session(ts, 2s); +sql_error create stream streams8 trigger force_window_close IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt8 as select _wstart, twa(a) from st partition by tbname,ta state_window(a); + +print end + +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/stream/streamTwaFwcFill.sim b/tests/script/tsim/stream/streamTwaFwcFill.sim new file mode 100644 index 000000000000..009798bd676c --- /dev/null +++ b/tests/script/tsim/stream/streamTwaFwcFill.sim @@ -0,0 +1,278 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sleep 50 +sql connect + +print step1 +print =============== create database +sql create database test vgroups 1; +sql use test; + +sql create stable st(ts timestamp, a int, b int , c int)tags(ta int,tb int,tc int); +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); + +sql create stream streams1 trigger force_window_close IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _wstart, twa(a), twa(b), elapsed(ts), now ,timezone(), ta from st partition by tbname,ta interval(2s) fill(prev); + +run tsim/stream/checkTaskStatus.sim + +sql insert into t1 values(now + 3s,1,1,1) (now + 4s,10,1,1) (now + 7s,20,2,2) (now + 8s,30,3,3); +sql insert into t2 values(now + 4s,1,1,1) (now + 5s,10,1,1) (now + 8s,20,2,2) (now + 9s,30,3,3); + + +print sql select * from t1; +sql select * from t1; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +print sql select * from t2; +sql select * from t2; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 +loop0: + +sleep 2000 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 2 sql select * from streamt where ta == 1; +sql select * from streamt where ta == 1; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +# row 0 +if $rows < 5 then + print ======rows=$rows + goto loop0 +endi + +$loop_count = 0 +loop1: + +sleep 2000 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 2 sql select * from streamt where ta == 2; +sql select * from streamt where ta == 2; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows < 5 then + print ======rows=$rows + goto loop1 +endi + + +print step2 +print =============== create database +sql create database test2 vgroups 1; +sql use test2; + +sql create stable st(ts timestamp, a int, b int , c int)tags(ta int,tb int,tc int); +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); +sql create stream streams2 trigger force_window_close IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _wstart, twa(a), twa(b), elapsed(ts), now ,timezone(), ta from st partition by tbname interval(2s) fill(NULL); + +run tsim/stream/checkTaskStatus.sim + +sql insert into t1 values(now + 3s,1,1,1) (now + 4s,10,1,1) (now + 7s,20,2,2) (now + 8s,30,3,3); +sql insert into t2 values(now + 4s,1,1,1) (now + 5s,10,1,1) (now + 8s,20,2,2) (now + 9s,30,3,3); + + +print sql select * from t1; +sql select * from t1; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +print sql select * from t2; +sql select * from t2; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 +loop2: + +sleep 2000 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 2 sql select * from streamt where ta == 1; +sql select * from streamt where ta == 1; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +# row 0 +if $rows < 5 then + print ======rows=$rows + goto loop2 +endi + +$loop_count = 0 +loop3: + +sleep 2000 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 2 sql select * from streamt where ta == 2; +sql select * from streamt where ta == 2; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows < 5 then + print ======rows=$rows + goto loop3 +endi + +print step3 +print =============== create database +sql create database test3 vgroups 1; +sql use test3; + +sql create stable st(ts timestamp, a int, b int , c int)tags(ta int,tb int,tc int); +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); +sql create stream streams3 trigger force_window_close IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _wstart, twa(a), twa(b), elapsed(ts), now ,timezone(), ta from st partition by tbname interval(2s) fill(value,100,200,300); + +run tsim/stream/checkTaskStatus.sim + +sql insert into t1 values(now + 3s,1,1,1) (now + 4s,10,1,1) (now + 7s,20,2,2) (now + 8s,30,3,3); +sql insert into t2 values(now + 4s,1,1,1) (now + 5s,10,1,1) (now + 8s,20,2,2) (now + 9s,30,3,3); + + +print sql select * from t1; +sql select * from t1; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +print sql select * from t2; +sql select * from t2; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 +loop4: + +sleep 2000 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 2 sql select * from streamt where ta == 1; +sql select * from streamt where ta == 1; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +# row 0 +if $rows < 5 then + print ======rows=$rows + goto loop4 +endi + +$loop_count = 0 +loop5: + +sleep 2000 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 2 sql select * from streamt where ta == 2; +sql select * from streamt where ta == 2; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows < 5 then + print ======rows=$rows + goto loop5 +endi + +print end + +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/stream/streamTwaFwcFillPrimaryKey.sim b/tests/script/tsim/stream/streamTwaFwcFillPrimaryKey.sim new file mode 100644 index 000000000000..e3c967aaeff3 --- /dev/null +++ b/tests/script/tsim/stream/streamTwaFwcFillPrimaryKey.sim @@ -0,0 +1,222 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sleep 50 +sql connect + +print step1 +print =============== create database +sql create database test vgroups 1; +sql use test; + +sql create stable st(ts timestamp, a int primary key, b int , c int)tags(ta int,tb int,tc int); +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); + +sql create stream streams1 trigger force_window_close IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _wstart, twa(b), count(*),ta from st partition by tbname, ta interval(2s) fill(prev); + +run tsim/stream/checkTaskStatus.sim + +sql select now; + +sql insert into t1 values(now + 3s,1,1,1) (now + 3s,2,10,10) (now + 3s,3,30,30); +sql insert into t2 values(now + 4s,1,1,1) (now + 4s,2,10,10) (now + 4s,3,30,30); + + +print sql select _wstart, twa(b), count(*),ta from t1 partition by tbname, ta interval(2s); +sql select _wstart, twa(b), count(*),ta from t1 partition by tbname, ta interval(2s); + +$query1_data = $data01 + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +print sql select _wstart, twa(b), count(*),ta from t2 partition by tbname, ta interval(2s); +sql select _wstart, twa(b), count(*),ta from t2 partition by tbname, ta interval(2s); + +$query2_data = $data01 + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 +loop0: + +sleep 2000 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 2 sql select * from streamt where ta == 1; +sql select * from streamt where ta == 1; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +# row 0 +if $rows < 6 then + print ======rows=$rows + goto loop0 +endi + +if $data01 != $query1_data then + print ======data01=$data01 + return -1 +endi + + +$loop_count = 0 +loop1: + +sleep 2000 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 2 sql select * from streamt where ta == 2; +sql select * from streamt where ta == 2; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows < 6 then + print ======rows=$rows + goto loop1 +endi + + +if $data01 != $query2_data then + print ======data01=$data01 + return -1 +endi + + +print step2 +print =============== create database +sql create database test2 vgroups 1; +sql use test2; + +sql create stable st(ts timestamp, a int primary key, b int , c int)tags(ta int,tb int,tc int); +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); +sql create stream streams2 trigger force_window_close IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _wstart, twa(b), ta from st partition by tbname, ta interval(2s) fill(NULL); + +run tsim/stream/checkTaskStatus.sim + +sql insert into t1 values(now + 3s,1,1,1) (now + 3s,2,10,10) (now + 3s,3,30,30); +sql insert into t2 values(now + 4s,1,1,1) (now + 4s,2,10,10) (now + 4s,3,30,30); + + +print sql select _wstart, twa(b), count(*),ta from t1 partition by tbname, ta interval(2s); +sql select _wstart, twa(b), count(*),ta from t1 partition by tbname, ta interval(2s); + +$query1_data = $data01 + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +print sql select _wstart, twa(b), count(*),ta from t2 partition by tbname, ta interval(2s); +sql select _wstart, twa(b), count(*),ta from t2 partition by tbname, ta interval(2s); + +$query2_data = $data01 + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 +loop2: + +sleep 2000 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 2 sql select * from streamt where ta == 1; +sql select * from streamt where ta == 1; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +# row 0 +if $rows < 6 then + print ======rows=$rows + goto loop2 +endi + +if $data01 != $query1_data then + print ======data01=$data01 + return -1 +endi + +$loop_count = 0 +loop3: + +sleep 2000 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 2 sql select * from streamt where ta == 2; +sql select * from streamt where ta == 2; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows < 6 then + print ======rows=$rows + goto loop3 +endi + + +if $data01 != $query2_data then + print ======data01=$data01 + return -1 +endi + +print end + +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/stream/streamTwaFwcIntervalPrimaryKeyl.sim b/tests/script/tsim/stream/streamTwaFwcIntervalPrimaryKeyl.sim new file mode 100644 index 000000000000..a1952859674c --- /dev/null +++ b/tests/script/tsim/stream/streamTwaFwcIntervalPrimaryKeyl.sim @@ -0,0 +1,109 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sleep 50 +sql connect + +print step1 +print =============== create database +sql create database test vgroups 1; +sql use test; + +sql create stable st(ts timestamp, a int primary key, b int , c int)tags(ta int,tb int,tc int); +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); + +sql create stream streams1 trigger force_window_close IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _wstart, count(*), ta from st partition by tbname,ta interval(2s); + +run tsim/stream/checkTaskStatus.sim + +sql insert into t1 values(now + 3s,1,1,1) (now + 3s,2,10,10) (now + 3s,3,30,30) (now + 11s,1,1,1) (now + 11s,2,10,10); +sql insert into t2 values(now + 4s,1,1,1) (now + 4s,2,10,10) (now + 4s,3,30,30) (now + 12s,1,1,1) (now + 12s,2,10,10); + + +print sql select _wstart, count(*) from st partition by tbname,ta interval(2s); +sql select _wstart, count(*) from st partition by tbname,ta interval(2s); + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 +loop0: + +sleep 2000 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 2 sql select * from streamt order by +sql select * from streamt where ta == 1; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +# row 0 +if $rows < 2 then + print ======rows=$rows + goto loop0 +endi + +if $data01 != 3 then + print ======data01=$data01 + return -1 +endi + +if $data11 != 2 then + print ======data11=$data11 + return -1 +endi + +$loop_count = 0 +loop1: + +sleep 2000 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 2 sql select * from streamt where ta == 2; +sql select * from streamt where ta == 2; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows < 2 then + print ======rows=$rows + goto loop1 +endi + +if $data01 != 3 then + print ======data01=$data01 + return -1 +endi + +if $data11 != 2 then + print ======data11=$data11 + return -1 +endi + +print end + +system sh/exec.sh -n dnode1 -s stop -x SIGINT From baf47844f1aa85b01b01a5a4e55a2700a36d74a3 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Wed, 16 Oct 2024 17:48:48 +0800 Subject: [PATCH 134/695] add ci --- tests/parallel_test/cases.task | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 906b1e2f6f03..7e7247ea8cd5 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -1390,6 +1390,10 @@ ,,y,script,./test.sh -f tsim/stream/streamPrimaryKey1.sim ,,y,script,./test.sh -f tsim/stream/streamPrimaryKey2.sim ,,y,script,./test.sh -f tsim/stream/streamPrimaryKey3.sim +,,y,script,./test.sh -f tsim/stream/streamTwaError.sim +,,y,script,./test.sh -f tsim/stream/streamTwaFwcFill.sim +,,y,script,./test.sh -f tsim/stream/streamTwaFwcFillPrimaryKey.sim +,,y,script,./test.sh -f tsim/stream/streamTwaFwcIntervalPrimaryKeyl.sim ,,y,script,./test.sh -f tsim/stream/triggerInterval0.sim ,,y,script,./test.sh -f tsim/stream/triggerSession0.sim ,,y,script,./test.sh -f tsim/stream/udTableAndCol0.sim From 47742ce5ed6e0a84229ddcb9c875607dccf7a09c Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Wed, 16 Oct 2024 17:54:53 +0800 Subject: [PATCH 135/695] enh:[TS-5441] cost too long in tmq write meta data by cache meta and vg info --- source/client/src/clientTmq.c | 6 ++++-- source/util/src/tlog.c | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/source/client/src/clientTmq.c b/source/client/src/clientTmq.c index 0233372012f2..72d709d96277 100644 --- a/source/client/src/clientTmq.c +++ b/source/client/src/clientTmq.c @@ -24,8 +24,8 @@ #include "tref.h" #include "ttimer.h" -#define tqErrorC(...) do { if (cDebugFlag & DEBUG_ERROR || tqClientDebugFlag & DEBUG_ERROR) { taosPrintLog("TQ ERROR ", DEBUG_ERROR, 255, __VA_ARGS__); }} while(0) -#define tqInfoC(...) do { if (cDebugFlag & DEBUG_INFO || tqClientDebugFlag & DEBUG_INFO) { taosPrintLog("TQ ", DEBUG_INFO, 255, __VA_ARGS__); }} while(0) +#define tqErrorC(...) do { if (cDebugFlag & DEBUG_ERROR || tqClientDebugFlag & DEBUG_ERROR) { taosPrintLog("TQ ERROR ", DEBUG_ERROR, tqClientDebugFlag|cDebugFlag, __VA_ARGS__); }} while(0) +#define tqInfoC(...) do { if (cDebugFlag & DEBUG_INFO || tqClientDebugFlag & DEBUG_INFO) { taosPrintLog("TQ ", DEBUG_INFO, tqClientDebugFlag|cDebugFlag, __VA_ARGS__); }} while(0) #define tqDebugC(...) do { if (cDebugFlag & DEBUG_DEBUG || tqClientDebugFlag & DEBUG_DEBUG) { taosPrintLog("TQ ", DEBUG_DEBUG, tqClientDebugFlag|cDebugFlag, __VA_ARGS__); }} while(0) #define EMPTY_BLOCK_POLL_IDLE_DURATION 10 @@ -955,6 +955,8 @@ int32_t tmqHbCb(void* param, SDataBuf* pMsg, int32_t code) { } tqClientDebugFlag = rsp.debugFlag; + tqDebugC("consumer:0x%" PRIx64 ", tqClientDebugFlag:%d", tmq->consumerId, rsp.debugFlag); + tDestroySMqHbRsp(&rsp); END: diff --git a/source/util/src/tlog.c b/source/util/src/tlog.c index 2b80eaf85d6b..3b9d100da9d2 100644 --- a/source/util/src/tlog.c +++ b/source/util/src/tlog.c @@ -125,7 +125,7 @@ int32_t idxDebugFlag = 131; int32_t sndDebugFlag = 131; int32_t simDebugFlag = 131; -int32_t tqClientDebugFlag = 0; +int32_t tqClientDebugFlag = 131; int64_t dbgEmptyW = 0; int64_t dbgWN = 0; From 041f3380bae395c400a9f104c939ac024f5ccc12 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Wed, 16 Oct 2024 19:24:42 +0800 Subject: [PATCH 136/695] enh: add more rand plan --- source/libs/executor/test/queryPlanTests.cpp | 406 ++++++++++++++++--- 1 file changed, 356 insertions(+), 50 deletions(-) diff --git a/source/libs/executor/test/queryPlanTests.cpp b/source/libs/executor/test/queryPlanTests.cpp index 2be84a57850c..338c734114f9 100755 --- a/source/libs/executor/test/queryPlanTests.cpp +++ b/source/libs/executor/test/queryPlanTests.cpp @@ -195,6 +195,8 @@ SNode* qptCreateStreamScanPhysiNode(int32_t nodeType); SNode* qptCreateSysTableScanPhysiNode(int32_t nodeType); SNode* qptCreateBlockDistScanPhysiNode(int32_t nodeType); SNode* qptCreateLastRowScanPhysiNode(int32_t nodeType); +SNode* qptCreateTableCountScanPhysiNode(int32_t nodeType); + SNode* qptCreateProjectPhysiNode(int32_t nodeType); SNode* qptCreateMergeJoinPhysiNode(int32_t nodeType); SNode* qptCreateHashAggPhysiNode(int32_t nodeType); @@ -208,6 +210,7 @@ SNode* qptCreateMergeAlignedIntervalPhysiNode(int32_t nodeType); SNode* qptCreateStreamIntervalPhysiNode(int32_t nodeType); SNode* qptCreateStreamFinalIntervalPhysiNode(int32_t nodeType); SNode* qptCreateStreamSemiIntervalPhysiNode(int32_t nodeType); +SNode* qptCreateStreamMidIntervalPhysiNode(int32_t nodeType); SNode* qptCreateFillPhysiNode(int32_t nodeType); SNode* qptCreateStreamFillPhysiNode(int32_t nodeType); SNode* qptCreateSessionPhysiNode(int32_t nodeType); @@ -218,6 +221,19 @@ SNode* qptCreateStateWindowPhysiNode(int32_t nodeType); SNode* qptCreateStreamStatePhysiNode(int32_t nodeType); SNode* qptCreatePartitionPhysiNode(int32_t nodeType); SNode* qptCreateStreamPartitionPhysiNode(int32_t nodeType); +SNode* qptCreateIndefRowsFuncPhysiNode(int32_t nodeType); +SNode* qptCreateInterpFuncPhysiNode(int32_t nodeType); +SNode* qptCreateMergeEventPhysiNode(int32_t nodeType); +SNode* qptCreateStreamEventPhysiNode(int32_t nodeType); +SNode* qptCreateCountWindowPhysiNode(int32_t nodeType); +SNode* qptCreateStreamCountWindowPhysiNode(int32_t nodeType); +SNode* qptCreateHashJoinPhysiNode(int32_t nodeType); +SNode* qptCreateGroupCachePhysiNode(int32_t nodeType); +SNode* qptCreateDynQueryCtrlPhysiNode(int32_t nodeType); +SNode* qptCreateDataDispatchPhysiNode(int32_t nodeType); +SNode* qptCreateDataInsertPhysiNode(int32_t nodeType); +SNode* qptCreateDataQueryInsertPhysiNode(int32_t nodeType); + SQPTPlan qptPlans[] = { {QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN, "tagScan", qptCreateTagScanPhysiNode}, @@ -251,23 +267,23 @@ SQPTPlan qptPlans[] = { {QUERY_NODE_PHYSICAL_PLAN_STREAM_STATE, "streamState", qptCreateStreamStatePhysiNode}, {QUERY_NODE_PHYSICAL_PLAN_PARTITION, "partition", qptCreatePartitionPhysiNode}, {QUERY_NODE_PHYSICAL_PLAN_STREAM_PARTITION, "streamPartition", qptCreateStreamPartitionPhysiNode}, - {QUERY_NODE_PHYSICAL_PLAN_INDEF_ROWS_FUNC, "", NULL}, - {QUERY_NODE_PHYSICAL_PLAN_INTERP_FUNC, "", NULL}, - {QUERY_NODE_PHYSICAL_PLAN_DISPATCH, "", NULL}, - {QUERY_NODE_PHYSICAL_PLAN_INSERT, "", NULL}, - {QUERY_NODE_PHYSICAL_PLAN_QUERY_INSERT, "", NULL}, - {QUERY_NODE_PHYSICAL_PLAN_DELETE, "", NULL}, + {QUERY_NODE_PHYSICAL_PLAN_INDEF_ROWS_FUNC, "indefRowsFunc", qptCreateIndefRowsFuncPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_INTERP_FUNC, "interpFunc", qptCreateInterpFuncPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_DISPATCH, "dataDispatch", qptCreateDataDispatchPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_INSERT, "dataInseret", qptCreateDataInsertPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_QUERY_INSERT, "dataQueryInsert", qptCreateDataQueryInsertPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_DELETE, "dataDelete", NULL}, {QUERY_NODE_PHYSICAL_SUBPLAN, "", NULL}, {QUERY_NODE_PHYSICAL_PLAN, "", NULL}, - {QUERY_NODE_PHYSICAL_PLAN_TABLE_COUNT_SCAN, "", NULL}, - {QUERY_NODE_PHYSICAL_PLAN_MERGE_EVENT, "", NULL}, - {QUERY_NODE_PHYSICAL_PLAN_STREAM_EVENT, "", NULL}, - {QUERY_NODE_PHYSICAL_PLAN_HASH_JOIN, "", NULL}, - {QUERY_NODE_PHYSICAL_PLAN_GROUP_CACHE, "", NULL}, - {QUERY_NODE_PHYSICAL_PLAN_DYN_QUERY_CTRL, "", NULL}, - {QUERY_NODE_PHYSICAL_PLAN_MERGE_COUNT, "", NULL}, - {QUERY_NODE_PHYSICAL_PLAN_STREAM_COUNT, "", NULL}, - {QUERY_NODE_PHYSICAL_PLAN_STREAM_MID_INTERVAL, "", NULL} + {QUERY_NODE_PHYSICAL_PLAN_TABLE_COUNT_SCAN, "tableCountScan", qptCreateTableCountScanPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_MERGE_EVENT, "eventWindow", qptCreateMergeEventPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_STREAM_EVENT, "streamEventWindow", qptCreateStreamEventPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_HASH_JOIN, "hashJoin", qptCreateHashJoinPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_GROUP_CACHE, "groupCache", qptCreateGroupCachePhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_DYN_QUERY_CTRL, "dynQueryCtrl", qptCreateDynQueryCtrlPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_MERGE_COUNT, "countWindow", qptCreateCountWindowPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_STREAM_COUNT, "streamCountWindow", qptCreateStreamCountWindowPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_STREAM_MID_INTERVAL, "streamMidInterval", qptCreateStreamMidIntervalPhysiNode} }; @@ -282,7 +298,7 @@ SQPTPlan qptPlans[] = { #define QPT_CORRECT_HIGH_PROB() (qptCtx.param.correctExpected || QPT_HIGH_PROB()) #define QPT_NCORRECT_LOW_PROB() (!qptCtx.param.correctExpected && QPT_LOW_PROB()) - +#define QPT_VALID_DESC(_desc) ((_desc) && (QUERY_NODE_DATABLOCK_DESC == nodeType(_desc))) SQPTCtx qptCtx = {0}; SQPTCtrl qptCtrl = {1, 0, 0, 0, 0}; @@ -1438,19 +1454,6 @@ SNode* qptMakeConditionNode() { return pNode; } -SNode* qptMakeDataBlockDescNode() { - if (QPT_NCORRECT_LOW_PROB()) { - return qptMakeRandNode(NULL); - } - - SDataBlockDescNode* pDesc = NULL; - assert(0 == nodesMakeNode(QUERY_NODE_DATABLOCK_DESC, (SNode**)&pDesc)); - - pDesc->dataBlockId = QPT_CORRECT_HIGH_PROB() ? qptCtx.buildCtx.nextBlockId++ : QPT_RAND_INT_V; - pDesc->precision = QPT_CORRECT_HIGH_PROB() ? qptCtx.param.db.precision : QPT_RAND_INT_V; - - return (SNode*)pDesc; -} SNode* qptMakeSlotDescNode(const char* pName, const SNode* pNode, int16_t slotId, bool output, bool reserve) { SSlotDescNode* pSlot = NULL; @@ -1474,6 +1477,75 @@ SNode* qptMakeSlotDescNode(const char* pName, const SNode* pNode, int16_t slotId return (SNode*)pSlot; } + +SNode* qptMakeDataBlockDescNode(bool forSink) { + if (QPT_NCORRECT_LOW_PROB()) { + return qptMakeRandNode(NULL); + } + + SDataBlockDescNode* pDesc = NULL; + assert(0 == nodesMakeNode(QUERY_NODE_DATABLOCK_DESC, (SNode**)&pDesc)); + + pDesc->dataBlockId = QPT_CORRECT_HIGH_PROB() ? (forSink ? (qptCtx.buildCtx.nextBlockId - 1) : qptCtx.buildCtx.nextBlockId++) : QPT_RAND_INT_V; + pDesc->precision = QPT_CORRECT_HIGH_PROB() ? qptCtx.param.db.precision : QPT_RAND_INT_V; + + return (SNode*)pDesc; +} + +SNode* qptMakeDataBlockDescNodeFromNode(bool forSink) { + if (QPT_NCORRECT_LOW_PROB()) { + return qptMakeRandNode(NULL); + } + + SDataBlockDescNode* pDesc = NULL; + SDataBlockDescNode* pInput = qptCtx.buildCtx.pCurr ? qptCtx.buildCtx.pCurr->pOutputDataBlockDesc : NULL; + SNode* pTmp = NULL, *pTmp2 = NULL; + + if (QPT_VALID_DESC(pInput)) { + if (QPT_CORRECT_HIGH_PROB()) { + nodesCloneNode((SNode*)pInput, (SNode**)&pDesc); + } else { + assert(0 == nodesMakeNode(QUERY_NODE_DATABLOCK_DESC, (SNode**)&pDesc)); + + pDesc->dataBlockId = QPT_CORRECT_HIGH_PROB() ? pInput->dataBlockId : QPT_RAND_INT_V; + pDesc->precision = QPT_CORRECT_HIGH_PROB() ? pInput->precision : QPT_RAND_INT_V; + pDesc->totalRowSize = QPT_CORRECT_HIGH_PROB() ? pInput->totalRowSize : QPT_RAND_INT_V; + pDesc->outputRowSize = QPT_CORRECT_HIGH_PROB() ? pInput->outputRowSize : QPT_RAND_INT_V; + + FOREACH(pTmp, pInput->pSlots) { + if (QPT_RAND_BOOL_V) { + nodesCloneNode(pTmp, &pTmp2); + qptNodesListMakeStrictAppend(&pDesc->pSlots, pTmp2); + } + } + } + } else { + assert(0 == nodesMakeNode(QUERY_NODE_DATABLOCK_DESC, (SNode**)&pDesc)); + + pDesc->dataBlockId = QPT_CORRECT_HIGH_PROB() ? (forSink ? (qptCtx.buildCtx.nextBlockId - 1) : qptCtx.buildCtx.nextBlockId++) : QPT_RAND_INT_V; + pDesc->precision = QPT_CORRECT_HIGH_PROB() ? qptCtx.param.db.precision : QPT_RAND_INT_V; + pDesc->totalRowSize = QPT_RAND_INT_V; + pDesc->outputRowSize = QPT_RAND_INT_V; + + int32_t slotNum = taosRand() % QPT_MAX_COLUMN_NUM; + for (int32_t i = 0; i < slotNum; ++i) { + pTmp2 = qptMakeExprNode(NULL); + if (QPT_CORRECT_HIGH_PROB()) { + pTmp = qptMakeSlotDescNode(NULL, pTmp2, i, QPT_RAND_BOOL_V, QPT_RAND_BOOL_V); + nodesDestroyNode(pTmp2); + } else { + pTmp = pTmp2; + } + + qptNodesListMakeStrictAppend(&pDesc->pSlots, pTmp); + } + } + + return (SNode*)pDesc; +} + + + SNode* qptMakeTargetNode(SNode* pNode, int16_t dataBlockId, int16_t slotId, SNode** pOutput) { if (QPT_NCORRECT_LOW_PROB()) { nodesDestroyNode(pNode); @@ -1547,7 +1619,7 @@ SPhysiNode* qptCreatePhysiNode(int32_t nodeType) { pPhysiNode->dynamicOp = qptGetDynamicOp(); pPhysiNode->inputTsOrder = qptGetCurrTsOrder(); - pPhysiNode->pOutputDataBlockDesc = (SDataBlockDescNode*)qptMakeDataBlockDescNode(); + pPhysiNode->pOutputDataBlockDesc = (SDataBlockDescNode*)qptMakeDataBlockDescNode(false); return pPhysiNode; } @@ -1649,7 +1721,7 @@ void qptCreateTableScanPseudoCols( int16_t blockId, SNodeList** ppList) { void qptAddDataBlockSlots(SNodeList* pList, SDataBlockDescNode* pDataBlockDesc) { - if (NULL == pDataBlockDesc) { + if (NULL == pDataBlockDesc || QUERY_NODE_DATABLOCK_DESC != nodeType(pDataBlockDesc)) { return; } @@ -1838,35 +1910,36 @@ void qptMakeAppendToTargetList(SNodeList* pInputList, int16_t blockId, SNodeList } } -void qptCreateScanPhysiNodeImpl( SScanPhysiNode* pScanPhysiNode) { - int16_t blockId = (QPT_CORRECT_HIGH_PROB() && pScanPhysiNode->node.pOutputDataBlockDesc) ? pScanPhysiNode->node.pOutputDataBlockDesc->dataBlockId : taosRand(); - qptCreateTableScanCols(blockId, &pScanPhysiNode->pScanCols); +void qptCreateScanPhysiNodeImpl( SScanPhysiNode* pScan) { + SDataBlockDescNode* pDesc = pScan->node.pOutputDataBlockDesc; + int16_t blockId = (QPT_CORRECT_HIGH_PROB() && QPT_VALID_DESC(pDesc)) ? pDesc->dataBlockId : taosRand(); + qptCreateTableScanCols(blockId, &pScan->pScanCols); - qptAddDataBlockSlots(pScanPhysiNode->pScanCols, pScanPhysiNode->node.pOutputDataBlockDesc); + qptAddDataBlockSlots(pScan->pScanCols, pDesc); if (taosRand() % 2) { - blockId = (QPT_CORRECT_HIGH_PROB() && pScanPhysiNode->node.pOutputDataBlockDesc) ? pScanPhysiNode->node.pOutputDataBlockDesc->dataBlockId : taosRand(); - qptCreateTableScanPseudoCols(blockId, &pScanPhysiNode->pScanPseudoCols); + blockId = (QPT_CORRECT_HIGH_PROB() && QPT_VALID_DESC(pDesc)) ? pDesc->dataBlockId : taosRand(); + qptCreateTableScanPseudoCols(blockId, &pScan->pScanPseudoCols); } - qptAddDataBlockSlots(pScanPhysiNode->pScanPseudoCols, pScanPhysiNode->node.pOutputDataBlockDesc); + qptAddDataBlockSlots(pScan->pScanPseudoCols, pDesc); - pScanPhysiNode->uid = qptCtx.param.correctExpected ? qptCtx.param.tbl.uid : taosRand(); - pScanPhysiNode->suid = qptCtx.param.correctExpected ? qptCtx.param.tbl.suid : taosRand(); - pScanPhysiNode->tableType = qptCtx.param.correctExpected ? qptCtx.param.tbl.tblType : taosRand(); - pScanPhysiNode->groupOrderScan = (taosRand() % 2) ? true : false; + pScan->uid = QPT_CORRECT_HIGH_PROB() ? qptCtx.param.tbl.uid : taosRand(); + pScan->suid = QPT_CORRECT_HIGH_PROB() ? qptCtx.param.tbl.suid : taosRand(); + pScan->tableType = QPT_CORRECT_HIGH_PROB() ? qptCtx.param.tbl.tblType : taosRand(); + pScan->groupOrderScan = (taosRand() % 2) ? true : false; SName tblName = {0}; toName(1, qptCtx.param.db.dbName, qptCtx.param.tbl.tblName, &tblName); - if (qptCtx.param.correctExpected || QPT_RAND_BOOL_V) { - memcpy(&pScanPhysiNode->tableName, &tblName, sizeof(SName)); + if (QPT_CORRECT_HIGH_PROB()) { + memcpy(&pScan->tableName, &tblName, sizeof(SName)); } else { - pScanPhysiNode->tableName.acctId = 0; - pScanPhysiNode->tableName.dbname[0] = 0; - pScanPhysiNode->tableName.tname[0] = 0; + pScan->tableName.acctId = 0; + pScan->tableName.dbname[0] = 0; + pScan->tableName.tname[0] = 0; } - qptCtx.buildCtx.currTsOrder = (qptCtx.param.correctExpected) ? qptCtx.buildCtx.currTsOrder : QPT_RAND_ORDER_V; + qptCtx.buildCtx.currTsOrder = QPT_CORRECT_HIGH_PROB() ? qptCtx.buildCtx.currTsOrder : QPT_RAND_ORDER_V; } @@ -2011,6 +2084,11 @@ SNode* qptCreateLastRowScanPhysiNode(int32_t nodeType) { return (SNode*)pPhysiNode; } +SNode* qptCreateTableCountScanPhysiNode(int32_t nodeType) { + return qptCreateLastRowScanPhysiNode(nodeType); +} + + SNode* qptCreateProjectPhysiNode(int32_t nodeType) { SPhysiNode* pPhysiNode = qptCreatePhysiNode(nodeType); @@ -2090,10 +2168,11 @@ SNode* qptCreateHashAggPhysiNode(int32_t nodeType) { SAggPhysiNode* pAgg = (SAggPhysiNode*)pPhysiNode; qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? false : true, QPT_RAND_BOOL_V, QPT_RAND_BOOL_V, 0, NULL); - qptMakeExprList(&pAgg->pExprs); + int16_t blockId = (QPT_CORRECT_HIGH_PROB() && pPhysiNode->pOutputDataBlockDesc) ? pPhysiNode->pOutputDataBlockDesc->dataBlockId : taosRand(); + qptMakeTargetList(QPT_NODE_EXPR, blockId, &pAgg->pExprs); qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? false : true, QPT_RAND_BOOL_V, QPT_RAND_BOOL_V, 0, NULL); - int16_t blockId = (QPT_CORRECT_HIGH_PROB() && pPhysiNode->pOutputDataBlockDesc) ? pPhysiNode->pOutputDataBlockDesc->dataBlockId : taosRand(); + blockId = (QPT_CORRECT_HIGH_PROB() && pPhysiNode->pOutputDataBlockDesc) ? pPhysiNode->pOutputDataBlockDesc->dataBlockId : taosRand(); qptMakeTargetList(QPT_NODE_EXPR, blockId, &pAgg->pGroupKeys); qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? false : true, QPT_RAND_BOOL_V, QPT_RAND_BOOL_V, 0, NULL); @@ -2249,6 +2328,12 @@ SNode* qptCreateStreamSemiIntervalPhysiNode(int32_t nodeType) { return qptCreateIntervalPhysiNode(nodeType); } + +SNode* qptCreateStreamMidIntervalPhysiNode(int32_t nodeType) { + return qptCreateIntervalPhysiNode(nodeType); +} + + SNode* qptCreateFillPhysiNode(int32_t nodeType) { SPhysiNode* pPhysiNode = qptCreatePhysiNode(nodeType); @@ -2364,6 +2449,227 @@ SNode* qptCreateStreamPartitionPhysiNode(int32_t nodeType) { } +SNode* qptCreateIndefRowsFuncPhysiNode(int32_t nodeType) { + SPhysiNode* pPhysiNode = qptCreatePhysiNode(nodeType); + + SIndefRowsFuncPhysiNode* pFunc = (SIndefRowsFuncPhysiNode*)pPhysiNode; + + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? false : true, QPT_RAND_BOOL_V, QPT_RAND_BOOL_V, 0, NULL); + int16_t blockId = (QPT_CORRECT_HIGH_PROB() && pPhysiNode->pOutputDataBlockDesc) ? pPhysiNode->pOutputDataBlockDesc->dataBlockId : taosRand(); + qptMakeTargetList(QPT_NODE_EXPR, blockId, &pFunc->pExprs); + + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? false : true, QPT_RAND_BOOL_V, QPT_RAND_BOOL_V, 0, NULL); + blockId = (QPT_CORRECT_HIGH_PROB() && pPhysiNode->pOutputDataBlockDesc) ? pPhysiNode->pOutputDataBlockDesc->dataBlockId : taosRand(); + qptMakeTargetList(QPT_NODE_FUNCTION, blockId, &pFunc->pFuncs); + + return (SNode*)pPhysiNode; +} + + +SNode* qptCreateInterpFuncPhysiNode(int32_t nodeType) { + SPhysiNode* pPhysiNode = qptCreatePhysiNode(nodeType); + + SInterpFuncPhysiNode* pFunc = (SInterpFuncPhysiNode*)pPhysiNode; + + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? false : true, QPT_RAND_BOOL_V, QPT_RAND_BOOL_V, 0, NULL); + int16_t blockId = (QPT_CORRECT_HIGH_PROB() && pPhysiNode->pOutputDataBlockDesc) ? pPhysiNode->pOutputDataBlockDesc->dataBlockId : taosRand(); + qptMakeTargetList(QPT_NODE_EXPR, blockId, &pFunc->pExprs); + + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? false : true, QPT_RAND_BOOL_V, QPT_RAND_BOOL_V, 0, NULL); + blockId = (QPT_CORRECT_HIGH_PROB() && pPhysiNode->pOutputDataBlockDesc) ? pPhysiNode->pOutputDataBlockDesc->dataBlockId : taosRand(); + qptMakeTargetList(QPT_NODE_FUNCTION, blockId, &pFunc->pFuncs); + + qptGetRandTimeWindow(&pFunc->timeRange); + + pFunc->interval = taosRand(); + pFunc->intervalUnit = qptGetRandTimestampUnit(); + + pFunc->fillMode = qptGetRandFillMode(); + + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? false : true, QPT_RAND_BOOL_V, QPT_RAND_BOOL_V, 0, NULL); + qptMakeNodeListNode(QPT_NODE_VALUE, &pFunc->pFillValues); + + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? false : true, QPT_RAND_BOOL_V, QPT_RAND_BOOL_V, 0, NULL); + qptMakeColumnNode(&pFunc->pTimeSeries); + + return (SNode*)pPhysiNode; +} + +SNode* qptCreateMergeEventPhysiNode(int32_t nodeType) { + SPhysiNode* pPhysiNode = qptCreatePhysiNode(nodeType); + + SEventWinodwPhysiNode* pEvent = (SEventWinodwPhysiNode*)pPhysiNode; + + qptCreateWindowPhysiNode(&pEvent->window); + + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? false : true, QPT_RAND_BOOL_V, QPT_RAND_BOOL_V, 0, NULL); + qptMakeExprNode(&pEvent->pStartCond); + + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? false : true, QPT_RAND_BOOL_V, QPT_RAND_BOOL_V, 0, NULL); + qptMakeExprNode(&pEvent->pEndCond); + + return (SNode*)pPhysiNode; +} + +SNode* qptCreateStreamEventPhysiNode(int32_t nodeType) { + return qptCreateMergeEventPhysiNode(nodeType); +} + +SNode* qptCreateCountWindowPhysiNode(int32_t nodeType) { + SPhysiNode* pPhysiNode = qptCreatePhysiNode(nodeType); + + SCountWinodwPhysiNode* pCount = (SCountWinodwPhysiNode*)pPhysiNode; + + qptCreateWindowPhysiNode(&pCount->window); + + pCount->windowCount = taosRand(); + pCount->windowSliding = taosRand(); + + return (SNode*)pPhysiNode; +} + +SNode* qptCreateStreamCountWindowPhysiNode(int32_t nodeType) { + return qptCreateCountWindowPhysiNode(nodeType); +} + +SNode* qptCreateHashJoinPhysiNode(int32_t nodeType) { + SPhysiNode* pPhysiNode = qptCreatePhysiNode(nodeType); + + SHashJoinPhysiNode* pJoin = (SHashJoinPhysiNode*)pPhysiNode; + + pJoin->joinType = (EJoinType)(taosRand() % JOIN_TYPE_MAX_VALUE + (QPT_CORRECT_HIGH_PROB() ? 0 : 1)); + pJoin->subType = (EJoinSubType)(taosRand() % JOIN_STYPE_MAX_VALUE + (QPT_CORRECT_HIGH_PROB() ? 0 : 1)); + qptMakeWindowOffsetNode(&pJoin->pWindowOffset); + qptMakeLimitNode(&pJoin->pJLimit); + + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? false : true, QPT_RAND_BOOL_V, QPT_RAND_BOOL_V, 0, NULL); + qptMakeColumnList(&pJoin->pOnLeft); + + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? false : true, QPT_RAND_BOOL_V, QPT_RAND_BOOL_V, 0, NULL); + qptMakeColumnList(&pJoin->pOnRight); + + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? false : true, QPT_RAND_BOOL_V, QPT_RAND_BOOL_V, 0, NULL); + qptMakeExprNode(&pJoin->leftPrimExpr); + + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? false : true, QPT_RAND_BOOL_V, QPT_RAND_BOOL_V, 0, NULL); + qptMakeExprNode(&pJoin->rightPrimExpr); + + pJoin->leftPrimSlotId = qptGetInputSlotId(qptCtx.buildCtx.pChild ? qptCtx.buildCtx.pChild->pOutputDataBlockDesc : NULL); + pJoin->rightPrimSlotId = qptGetInputSlotId(qptCtx.buildCtx.pChild ? qptCtx.buildCtx.pChild->pOutputDataBlockDesc : NULL); + + pJoin->timeRangeTarget = QPT_CORRECT_HIGH_PROB() ? (taosRand() % 3) : taosRand(); + qptGetRandTimeWindow(&pJoin->timeRange); + + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? false : true, QPT_RAND_BOOL_V, QPT_RAND_BOOL_V, 0, NULL); + qptMakeExprNode(&pJoin->pLeftOnCond); + + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? false : true, QPT_RAND_BOOL_V, QPT_RAND_BOOL_V, 0, NULL); + qptMakeExprNode(&pJoin->pRightOnCond); + + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? false : true, QPT_RAND_BOOL_V, QPT_RAND_BOOL_V, 0, NULL); + qptMakeExprNode(&pJoin->pFullOnCond); + + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? false : true, QPT_RAND_BOOL_V, QPT_RAND_BOOL_V, 0, NULL); + int16_t blockId = (QPT_CORRECT_HIGH_PROB() && pPhysiNode->pOutputDataBlockDesc) ? pPhysiNode->pOutputDataBlockDesc->dataBlockId : taosRand(); + qptMakeTargetList(QPT_NODE_EXPR, blockId, &pJoin->pTargets); + + for (int32_t i = 0; i < 2; i++) { + pJoin->inputStat[i].inputRowNum = taosRand(); + pJoin->inputStat[i].inputRowSize = taosRand(); + } + + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? false : true, QPT_RAND_BOOL_V, QPT_RAND_BOOL_V, 0, NULL); + qptMakeExprNode(&pJoin->pPrimKeyCond); + + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? false : true, QPT_RAND_BOOL_V, QPT_RAND_BOOL_V, 0, NULL); + qptMakeExprNode(&pJoin->pColEqCond); + + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? false : true, QPT_CORRECT_HIGH_PROB() ? true : false, QPT_RAND_BOOL_V, 0, NULL); + qptMakeExprNode(&pJoin->pTagEqCond); + + return (SNode*)pPhysiNode; +} + +SNode* qptCreateGroupCachePhysiNode(int32_t nodeType) { + SPhysiNode* pPhysiNode = qptCreatePhysiNode(nodeType); + + SGroupCachePhysiNode* pGroup = (SGroupCachePhysiNode*)pPhysiNode; + + pGroup->grpColsMayBeNull = QPT_RAND_BOOL_V; + pGroup->grpByUid = QPT_RAND_BOOL_V; + pGroup->globalGrp = QPT_RAND_BOOL_V; + pGroup->batchFetch = QPT_RAND_BOOL_V; + + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? false : true, QPT_RAND_BOOL_V, QPT_RAND_BOOL_V, 0, NULL); + qptMakeColumnList(&pGroup->pGroupCols); + + return (SNode*)pPhysiNode; +} + +SNode* qptCreateDynQueryCtrlPhysiNode(int32_t nodeType) { + SPhysiNode* pPhysiNode = qptCreatePhysiNode(nodeType); + + SDynQueryCtrlPhysiNode* pDyn = (SDynQueryCtrlPhysiNode*)pPhysiNode; + + pDyn->qType = QPT_CORRECT_HIGH_PROB() ? DYN_QTYPE_STB_HASH : (EDynQueryType)taosRand(); + + SStbJoinDynCtrlBasic* pJoin = &pDyn->stbJoin; + pJoin->batchFetch = QPT_RAND_BOOL_V; + pJoin->vgSlot[0] = taosRand(); + pJoin->vgSlot[1] = taosRand(); + pJoin->uidSlot[0] = taosRand(); + pJoin->uidSlot[1] = taosRand(); + pJoin->srcScan[0] = QPT_RAND_BOOL_V; + pJoin->srcScan[1] = QPT_RAND_BOOL_V; + + return (SNode*)pPhysiNode; +} + +SNode* qptCreateDataSinkNode(int32_t nodeType) { + SDataSinkNode* pSinkNode = NULL; + assert(0 == nodesMakeNode((ENodeType)nodeType, (SNode**)&pSinkNode)); + assert(pSinkNode); + + if (QPT_CORRECT_HIGH_PROB() && qptCtx.buildCtx.pCurr && qptCtx.buildCtx.pCurr->pOutputDataBlockDesc) { + pSinkNode->pInputDataBlockDesc = (SDataBlockDescNode*)qptMakeDataBlockDescNodeFromNode(true); + } else { + pSinkNode->pInputDataBlockDesc = (SDataBlockDescNode*)qptMakeDataBlockDescNode(true); + } + + return (SNode*)pSinkNode; +} + +SNode* qptCreateDataDispatchPhysiNode(int32_t nodeType) { + return (SNode*)qptCreateDataSinkNode(nodeType); +} + +SNode* qptCreateDataInsertPhysiNode(int32_t nodeType) { + SDataInserterNode* pInserter = (SDataInserterNode*)qptCreateDataSinkNode(nodeType); + + pInserter->numOfTables = taosRand(); + pInserter->size = taosRand(); + pInserter->pData = QPT_RAND_BOOL_V ? taosMemoryMalloc(1) : NULL; + + return (SNode*)pInserter; +} + +SNode* qptCreateDataQueryInsertPhysiNode(int32_t nodeType) { + SQueryInserterNode* pInserter = (SQueryInserterNode*)qptCreateDataSinkNode(nodeType); + + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? false : true, QPT_RAND_BOOL_V, QPT_RAND_BOOL_V, 0, NULL); + qptMakeColumnList(&pInserter->pCols); + + pInserter->tableId = QPT_CORRECT_HIGH_PROB() ? qptCtx.param.tbl.uid : taosRand(); + pInserter->stableId = QPT_CORRECT_HIGH_PROB() ? qptCtx.param.tbl.suid : taosRand(); + pInserter->tableType = QPT_CORRECT_HIGH_PROB() ? (QPT_RAND_BOOL_V ? TSDB_CHILD_TABLE : TSDB_NORMAL_TABLE) : (taosRand() % TSDB_TABLE_MAX); + pInserter->tableName[0] = QPT_RAND_BOOL_V ? 'a' : taosRand(); + pInserter->vgId = qptCtx.param.vnode.vgId; + memcpy(&pInserter->epSet, &qptCtx.param.vnode.epSet, sizeof(pInserter->epSet)); + pInserter->explain = QPT_RAND_BOOL_V; + + return (SNode*)pInserter; +} + SNode* qptCreatePhysicalPlanNode(int32_t nodeIdx) { if (qptPlans[nodeIdx].buildFunc) { From 4a240288172a56620e9e455af7fd6960f075e013 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Wed, 16 Oct 2024 19:34:19 +0800 Subject: [PATCH 137/695] enh:[TS-5441] cost too long in tmq write meta data by cache meta and vg info --- tests/system-test/2-query/db.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/system-test/2-query/db.py b/tests/system-test/2-query/db.py index 588609e52474..1964cea51f5a 100644 --- a/tests/system-test/2-query/db.py +++ b/tests/system-test/2-query/db.py @@ -57,7 +57,7 @@ def case2(self): tdSql.checkData(0, 2, 0) tdSql.query("show dnode 1 variables like '%debugFlag'") - tdSql.checkRows(23) + tdSql.checkRows(24) tdSql.query("show dnode 1 variables like '____debugFlag'") tdSql.checkRows(2) From 3ae6f79290731acf6ef8048fe161bd661de0d7c9 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Thu, 17 Oct 2024 09:36:32 +0800 Subject: [PATCH 138/695] enh:[TS-5441] cost too long in tmq write meta data by cache meta and vg info --- source/client/src/clientTmq.c | 1 - 1 file changed, 1 deletion(-) diff --git a/source/client/src/clientTmq.c b/source/client/src/clientTmq.c index 72d709d96277..950e0f7f3428 100644 --- a/source/client/src/clientTmq.c +++ b/source/client/src/clientTmq.c @@ -955,7 +955,6 @@ int32_t tmqHbCb(void* param, SDataBuf* pMsg, int32_t code) { } tqClientDebugFlag = rsp.debugFlag; - tqDebugC("consumer:0x%" PRIx64 ", tqClientDebugFlag:%d", tmq->consumerId, rsp.debugFlag); tDestroySMqHbRsp(&rsp); From 44726fe42a3f6628b57cf428373b881a9f7ca2c6 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Thu, 17 Oct 2024 11:28:05 +0800 Subject: [PATCH 139/695] enh: add subplan test --- include/libs/nodes/plannodes.h | 6 +- source/libs/executor/test/queryPlanTests.cpp | 98 ++++++++++++++++++-- 2 files changed, 93 insertions(+), 11 deletions(-) diff --git a/include/libs/nodes/plannodes.h b/include/libs/nodes/plannodes.h index bfe9e9555b82..5ba24f08d8f7 100644 --- a/include/libs/nodes/plannodes.h +++ b/include/libs/nodes/plannodes.h @@ -766,9 +766,9 @@ typedef struct SDataDeleterNode { char tableFName[TSDB_TABLE_NAME_LEN]; char tsColName[TSDB_COL_NAME_LEN]; STimeWindow deleteTimeRange; - SNode* pAffectedRows; - SNode* pStartTs; - SNode* pEndTs; + SNode* pAffectedRows; // usless + SNode* pStartTs; // usless + SNode* pEndTs; // usless } SDataDeleterNode; typedef struct SSubplan { diff --git a/source/libs/executor/test/queryPlanTests.cpp b/source/libs/executor/test/queryPlanTests.cpp index 338c734114f9..6faeaed2cff5 100755 --- a/source/libs/executor/test/queryPlanTests.cpp +++ b/source/libs/executor/test/queryPlanTests.cpp @@ -146,6 +146,8 @@ typedef struct { EOrder currTsOrder; int16_t nextBlockId; int32_t primaryTsSlotId; + SSubplanId nextSubplanId; + int32_t currSubplanLevel; SExecTaskInfo* pCurrTask; } SQPTBuildPlanCtx; @@ -233,6 +235,7 @@ SNode* qptCreateDynQueryCtrlPhysiNode(int32_t nodeType); SNode* qptCreateDataDispatchPhysiNode(int32_t nodeType); SNode* qptCreateDataInsertPhysiNode(int32_t nodeType); SNode* qptCreateDataQueryInsertPhysiNode(int32_t nodeType); +SNode* qptCreateDataDeletePhysiNode(int32_t nodeType); SQPTPlan qptPlans[] = { @@ -272,9 +275,9 @@ SQPTPlan qptPlans[] = { {QUERY_NODE_PHYSICAL_PLAN_DISPATCH, "dataDispatch", qptCreateDataDispatchPhysiNode}, {QUERY_NODE_PHYSICAL_PLAN_INSERT, "dataInseret", qptCreateDataInsertPhysiNode}, {QUERY_NODE_PHYSICAL_PLAN_QUERY_INSERT, "dataQueryInsert", qptCreateDataQueryInsertPhysiNode}, - {QUERY_NODE_PHYSICAL_PLAN_DELETE, "dataDelete", NULL}, - {QUERY_NODE_PHYSICAL_SUBPLAN, "", NULL}, - {QUERY_NODE_PHYSICAL_PLAN, "", NULL}, + {QUERY_NODE_PHYSICAL_PLAN_DELETE, "dataDelete", qptCreateDataDeletePhysiNode}, + {QUERY_NODE_PHYSICAL_SUBPLAN, "subplan", NULL}, + {QUERY_NODE_PHYSICAL_PLAN, "plan", NULL}, {QUERY_NODE_PHYSICAL_PLAN_TABLE_COUNT_SCAN, "tableCountScan", qptCreateTableCountScanPhysiNode}, {QUERY_NODE_PHYSICAL_PLAN_MERGE_EVENT, "eventWindow", qptCreateMergeEventPhysiNode}, {QUERY_NODE_PHYSICAL_PLAN_STREAM_EVENT, "streamEventWindow", qptCreateStreamEventPhysiNode}, @@ -686,6 +689,12 @@ int32_t qptGetInputPrimaryTsSlotId() { return taosRand() % QPT_MAX_COLUMN_NUM; } +int32_t qptGetRandSubplanMsgType() { + int32_t msgTypeList[] = {TDMT_VND_DELETE, TDMT_SCH_MERGE_QUERY, TDMT_SCH_QUERY, TDMT_VND_SUBMIT}; + + return QPT_CORRECT_HIGH_PROB() ? msgTypeList[taosRand() % (sizeof(msgTypeList)/sizeof(msgTypeList[0]))] : taosRand(); +} + void qptNodesCalloc(int32_t num, int32_t size, void** pOut) { void* p = taosMemoryCalloc(num, size); assert(p); @@ -718,6 +727,11 @@ void qptGetRandTimeWindow(STimeWindow* pWindow) { pWindow->ekey = taosRand(); } +void qptGetSubplanId(SSubplanId* pId) { + pId->queryId = qptCtx.buildCtx.nextSubplanId.queryId; + pId->groupId = qptCtx.buildCtx.nextSubplanId.groupId++; + pId->subplanId = qptCtx.buildCtx.nextSubplanId.subplanId++; +} int32_t qptNodesListAppend(SNodeList* pList, SNode* pNode) { SListCell* p = NULL; @@ -2662,7 +2676,11 @@ SNode* qptCreateDataQueryInsertPhysiNode(int32_t nodeType) { pInserter->tableId = QPT_CORRECT_HIGH_PROB() ? qptCtx.param.tbl.uid : taosRand(); pInserter->stableId = QPT_CORRECT_HIGH_PROB() ? qptCtx.param.tbl.suid : taosRand(); pInserter->tableType = QPT_CORRECT_HIGH_PROB() ? (QPT_RAND_BOOL_V ? TSDB_CHILD_TABLE : TSDB_NORMAL_TABLE) : (taosRand() % TSDB_TABLE_MAX); - pInserter->tableName[0] = QPT_RAND_BOOL_V ? 'a' : taosRand(); + if (QPT_CORRECT_HIGH_PROB()) { + strcpy(pInserter->tableName, qptCtx.param.tbl.tblName); + } else { + pInserter->tableName[0] = QPT_RAND_BOOL_V ? 'a' : 0; + } pInserter->vgId = qptCtx.param.vnode.vgId; memcpy(&pInserter->epSet, &qptCtx.param.vnode.epSet, sizeof(pInserter->epSet)); pInserter->explain = QPT_RAND_BOOL_V; @@ -2671,6 +2689,60 @@ SNode* qptCreateDataQueryInsertPhysiNode(int32_t nodeType) { } +SNode* qptCreateDataDeletePhysiNode(int32_t nodeType) { + SDataDeleterNode* pDeleter = (SDataDeleterNode*)qptCreateDataSinkNode(nodeType); + + pDeleter->tableId = QPT_CORRECT_HIGH_PROB() ? qptCtx.param.tbl.uid : taosRand(); + pDeleter->tableType = QPT_CORRECT_HIGH_PROB() ? (QPT_RAND_BOOL_V ? TSDB_CHILD_TABLE : TSDB_NORMAL_TABLE) : (taosRand() % TSDB_TABLE_MAX); + if (QPT_CORRECT_HIGH_PROB()) { + sprintf(pDeleter->tableFName, "1.%s.%s", qptCtx.param.db.dbName, qptCtx.param.tbl.tblName); + } else { + pDeleter->tableFName[0] = QPT_RAND_BOOL_V ? 'a' : 0; + } + + SQPTCol* pCol = nodesListGetNode(qptCtx.param.tbl.pColList, 0); + if (QPT_CORRECT_HIGH_PROB() && pCol) { + strcpy(pDeleter->tsColName, pCol->name); + } else { + pDeleter->tsColName[0] = QPT_RAND_BOOL_V ? 't' : 0; + } + + qptGetRandTimeWindow(&pDeleter->deleteTimeRange); + + return (SNode*)pDeleter; +} + + +SNode* qptCreateSubplanNode(int32_t nodeType) { + SSubplan* pSubplan = NULL; + assert(0 == nodesMakeNode((ENodeType)nodeType, (SNode**)&pSubplan)); + + qptGetSubplanId(&pSubplan->id); + + pSubplan->subplanType = QPT_CORRECT_HIGH_PROB() ? (taosRand() % SUBPLAN_TYPE_COMPUTE + 1) : (ESubplanType)taosRand(); + pSubplan->msgType = qptGetRandSubplanMsgType(); + pSubplan->level = qptCtx.buildCtx.; + pDeleter->tableId = QPT_CORRECT_HIGH_PROB() ? qptCtx.param.tbl.uid : taosRand(); + pDeleter->tableType = QPT_CORRECT_HIGH_PROB() ? (QPT_RAND_BOOL_V ? TSDB_CHILD_TABLE : TSDB_NORMAL_TABLE) : (taosRand() % TSDB_TABLE_MAX); + if (QPT_CORRECT_HIGH_PROB()) { + sprintf(pDeleter->tableFName, "1.%s.%s", qptCtx.param.db.dbName, qptCtx.param.tbl.tblName); + } else { + pDeleter->tableFName[0] = QPT_RAND_BOOL_V ? 'a' : 0; + } + + SQPTCol* pCol = nodesListGetNode(qptCtx.param.tbl.pColList, 0); + if (QPT_CORRECT_HIGH_PROB() && pCol) { + strcpy(pDeleter->tsColName, pCol->name); + } else { + pDeleter->tsColName[0] = QPT_RAND_BOOL_V ? 't' : 0; + } + + qptGetRandTimeWindow(&pDeleter->deleteTimeRange); + + return (SNode*)pDeleter; +} + + SNode* qptCreatePhysicalPlanNode(int32_t nodeIdx) { if (qptPlans[nodeIdx].buildFunc) { return (*qptPlans[nodeIdx].buildFunc)(qptPlans[nodeIdx].type); @@ -2695,6 +2767,9 @@ void qptResetForReRun() { qptCtx.param.vnode.vgId = 1; qptResetTableCols(); + + qptCtx.buildCtx.pCurr = NULL; + qptCtx.buildCtx.pCurrTask = NULL; } void qptSingleTestDone(bool* contLoop) { @@ -2744,11 +2819,9 @@ void qptRunSingleOpTest() { SExecTaskInfo* pTaskInfo = NULL; SStorageAPI storageAPI = {0}; - if (qptCtx.loopIdx > 0) { - qptResetForReRun(); - } + qptResetForReRun(); - doCreateTask(qptCtx.param.plan.queryId, qptCtx.param.plan.taskId++, qptCtx.param.vnode.vgId, OPTR_EXEC_MODEL_BATCH, &storageAPI, &pTaskInfo); + doCreateTask(qptCtx.param.plan.queryId, qptCtx.param.plan.taskId, qptCtx.param.vnode.vgId, OPTR_EXEC_MODEL_BATCH, &storageAPI, &pTaskInfo); qptCtx.buildCtx.pCurrTask = pTaskInfo; pNode = (SNode*)qptCreatePhysicalPlanNode(qptCtx.param.plan.subplanIdx[0]); @@ -2860,6 +2933,9 @@ void qptInitTestCtx(bool correctExpected, bool singleNode, int32_t nodeType, int qptCtx.param.plan.physicNodeParam = nodeParam; } + qptCtx.param.plan.queryId++; + qptCtx.param.plan.taskId++; + qptCtx.param.db.precision = TSDB_TIME_PRECISION_MILLI; strcpy(qptCtx.param.db.dbName, "qptdb1"); @@ -2889,6 +2965,12 @@ void qptInitTestCtx(bool correctExpected, bool singleNode, int32_t nodeType, int FOREACH(pTmp, qptCtx.param.tbl.pTagList) { qptNodesListMakeStrictAppend(&qptCtx.param.tbl.pColTagList, pTmp); } + + qptCtx.buildCtx.nextBlockId++; + qptCtx.buildCtx.nextSubplanId.queryId = qptCtx.param.plan.queryId; + qptCtx.buildCtx.nextSubplanId.groupId++; + qptCtx.buildCtx.nextSubplanId.subplanId++; + qptCtx.buildCtx.currSubplanLevel = 0; } void qptDestroyTestCtx() { From f5c959da6f6c894ca0fee53150f90ce3a09e561a Mon Sep 17 00:00:00 2001 From: dmchen Date: Thu, 17 Oct 2024 03:34:57 +0000 Subject: [PATCH 140/695] feat/TS-5484-audit-delete --- include/common/tglobal.h | 1 + include/common/tmsg.h | 11 +++++ include/common/tmsgdef.h | 1 + include/libs/audit/audit.h | 1 - include/util/tdef.h | 1 + source/common/src/tglobal.c | 5 ++ source/common/src/tmsg.c | 54 +++++++++++++++++++++ source/dnode/mgmt/mgmt_mnode/src/mmHandle.c | 1 + source/dnode/mnode/impl/src/mndDnode.c | 17 +++++++ 9 files changed, 91 insertions(+), 1 deletion(-) diff --git a/include/common/tglobal.h b/include/common/tglobal.h index cf918c6e0dbf..3a7f307cfa1e 100644 --- a/include/common/tglobal.h +++ b/include/common/tglobal.h @@ -140,6 +140,7 @@ extern bool tsMonitorForceV2; // audit extern bool tsEnableAudit; extern bool tsEnableAuditCreateTable; +extern bool tsEnableAuditDelete; extern int32_t tsAuditInterval; // telem diff --git a/include/common/tmsg.h b/include/common/tmsg.h index 1a10f02c965d..0008bc0e9d72 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -1795,6 +1795,17 @@ int32_t tSerializeSStatisReq(void* buf, int32_t bufLen, SStatisReq* pReq); int32_t tDeserializeSStatisReq(void* buf, int32_t bufLen, SStatisReq* pReq); void tFreeSStatisReq(SStatisReq* pReq); +typedef struct { + char db[TSDB_DB_FNAME_LEN]; + char table[TSDB_TABLE_NAME_LEN]; + char operation[AUDIT_OPERATION_LEN]; + int32_t sqlLen; + char* pSql; +} SAuditReq; +int32_t tSerializeSAuditReq(void* buf, int32_t bufLen, SAuditReq* pReq); +int32_t tDeserializeSAuditReq(void* buf, int32_t bufLen, SAuditReq* pReq); +void tFreeSAuditReq(SAuditReq* pReq); + typedef struct { int32_t dnodeId; int64_t clusterId; diff --git a/include/common/tmsgdef.h b/include/common/tmsgdef.h index 40464dc29a77..4a2206bd2bce 100644 --- a/include/common/tmsgdef.h +++ b/include/common/tmsgdef.h @@ -254,6 +254,7 @@ TD_DEF_MSG_TYPE(TDMT_MND_STREAM_DROP_ORPHANTASKS, "stream-drop-orphan-tasks", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MND_STREAM_TASK_RESET, "stream-reset-tasks", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MND_UPDATE_DNODE_INFO, "update-dnode-info", NULL, NULL) + TD_DEF_MSG_TYPE(TDMT_MND_AUDIT, "audit", NULL, NULL) TD_CLOSE_MSG_SEG(TDMT_END_MND_MSG) TD_NEW_MSG_SEG(TDMT_VND_MSG) // 2<<8 diff --git a/include/libs/audit/audit.h b/include/libs/audit/audit.h index 2e786ab2b3b8..f5710256e995 100644 --- a/include/libs/audit/audit.h +++ b/include/libs/audit/audit.h @@ -29,7 +29,6 @@ extern "C" { #endif #define AUDIT_DETAIL_MAX 65472 -#define AUDIT_OPERATION_LEN 20 typedef struct { const char *server; diff --git a/include/util/tdef.h b/include/util/tdef.h index a2bc77d81976..970570683d7b 100644 --- a/include/util/tdef.h +++ b/include/util/tdef.h @@ -604,6 +604,7 @@ enum { RAND_ERR_MEMORY = 1, RAND_ERR_FILE = 2, RAND_ERR_NETWORK = 4 }; #define MONITOR_TAG_VALUE_LEN 300 #define MONITOR_METRIC_NAME_LEN 100 +#define AUDIT_OPERATION_LEN 20 #ifdef __cplusplus } #endif diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index 3c0529426413..b85fea632e47 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -117,6 +117,7 @@ bool tsMonitorForceV2 = true; // audit bool tsEnableAudit = true; bool tsEnableAuditCreateTable = true; +bool tsEnableAuditDelete = true; int32_t tsAuditInterval = 5000; // telem @@ -763,6 +764,7 @@ static int32_t taosAddServerCfg(SConfig *pCfg) { TAOS_CHECK_RETURN(cfgAddBool(pCfg, "monitorForceV2", tsMonitorForceV2, CFG_SCOPE_SERVER, CFG_DYN_NONE)); TAOS_CHECK_RETURN(cfgAddBool(pCfg, "audit", tsEnableAudit, CFG_SCOPE_SERVER, CFG_DYN_ENT_SERVER)); + TAOS_CHECK_RETURN(cfgAddBool(pCfg, "enableAuditDelete", tsEnableAuditDelete, CFG_SCOPE_SERVER, CFG_DYN_NONE)); TAOS_CHECK_RETURN(cfgAddBool(pCfg, "auditCreateTable", tsEnableAuditCreateTable, CFG_SCOPE_SERVER, CFG_DYN_NONE)); TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "auditInterval", tsAuditInterval, 500, 200000, CFG_SCOPE_SERVER, CFG_DYN_NONE)); @@ -1448,6 +1450,9 @@ static int32_t taosSetServerCfg(SConfig *pCfg) { TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "auditCreateTable"); tsEnableAuditCreateTable = pItem->bval; + TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "enableAuditDelete"); + tsEnableAuditDelete = pItem->bval; + TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "auditInterval"); tsAuditInterval = pItem->i32; diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index 4c4b78278e41..10c84d9bf8c2 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -1802,6 +1802,60 @@ int32_t tDeserializeSDropUserReq(void *buf, int32_t bufLen, SDropUserReq *pReq) void tFreeSDropUserReq(SDropUserReq *pReq) { FREESQL(); } +int32_t tSerializeSAuditReq(void *buf, int32_t bufLen, SAuditReq *pReq) { + SEncoder encoder = {0}; + int32_t code = 0; + int32_t lino; + int32_t tlen; + tEncoderInit(&encoder, buf, bufLen); + + TAOS_CHECK_EXIT(tStartEncode(&encoder)); + + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->operation)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->db)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->table)); + TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->sqlLen)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->pSql)); + + tEndEncode(&encoder); + +_exit: + if (code) { + tlen = code; + } else { + tlen = encoder.pos; + } + tEncoderClear(&encoder); + return tlen; +} + +int32_t tDeserializeSAuditReq(void *buf, int32_t bufLen, SAuditReq *pReq) { + SDecoder decoder = {0}; + int32_t code = 0; + int32_t lino; + tDecoderInit(&decoder, buf, bufLen); + + TAOS_CHECK_EXIT(tStartDecode(&decoder)); + + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->operation)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->db)); + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->table)); + TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->sqlLen)); + if (pReq->sqlLen > 0) { + pReq->pSql = taosMemoryMalloc(pReq->sqlLen + 1); + if (pReq->pSql == NULL) { + TAOS_CHECK_EXIT(terrno); + } + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->pSql)); + } + tEndDecode(&decoder); +_exit: + tDecoderClear(&decoder); + return code; +} + +void tFreeSAuditReq(SAuditReq *pReq) { taosMemoryFreeClear(pReq->pSql); } + SIpWhiteList *cloneIpWhiteList(SIpWhiteList *pIpWhiteList) { if (pIpWhiteList == NULL) return NULL; diff --git a/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c b/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c index 7204cde8f720..a182307c498b 100644 --- a/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c +++ b/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c @@ -208,6 +208,7 @@ SArray *mmGetMsgHandles() { if (dmSetMgmtHandle(pArray, TDMT_MND_DROP_VIEW, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_MND_VIEW_META, mmPutMsgToReadQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_MND_STATIS, mmPutMsgToReadQueue, 0) == NULL) goto _OVER; + if (dmSetMgmtHandle(pArray, TDMT_MND_AUDIT, mmPutMsgToReadQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_MND_KILL_COMPACT, mmPutMsgToReadQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_MND_CONFIG_CLUSTER, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_QUERY_COMPACT_PROGRESS_RSP, mmPutMsgToReadQueue, 0) == NULL) goto _OVER; diff --git a/source/dnode/mnode/impl/src/mndDnode.c b/source/dnode/mnode/impl/src/mndDnode.c index 04041646eb40..8eedcaa906ab 100644 --- a/source/dnode/mnode/impl/src/mndDnode.c +++ b/source/dnode/mnode/impl/src/mndDnode.c @@ -86,6 +86,7 @@ static int32_t mndProcessStatusReq(SRpcMsg *pReq); static int32_t mndProcessNotifyReq(SRpcMsg *pReq); static int32_t mndProcessRestoreDnodeReq(SRpcMsg *pReq); static int32_t mndProcessStatisReq(SRpcMsg *pReq); +static int32_t mndProcessAuditReq(SRpcMsg *pReq); static int32_t mndProcessUpdateDnodeInfoReq(SRpcMsg *pReq); static int32_t mndProcessCreateEncryptKeyReq(SRpcMsg *pRsp); static int32_t mndProcessCreateEncryptKeyRsp(SRpcMsg *pRsp); @@ -125,6 +126,7 @@ int32_t mndInitDnode(SMnode *pMnode) { mndSetMsgHandle(pMnode, TDMT_MND_SHOW_VARIABLES, mndProcessShowVariablesReq); mndSetMsgHandle(pMnode, TDMT_MND_RESTORE_DNODE, mndProcessRestoreDnodeReq); mndSetMsgHandle(pMnode, TDMT_MND_STATIS, mndProcessStatisReq); + mndSetMsgHandle(pMnode, TDMT_MND_AUDIT, mndProcessAuditReq); mndSetMsgHandle(pMnode, TDMT_MND_CREATE_ENCRYPT_KEY, mndProcessCreateEncryptKeyReq); mndSetMsgHandle(pMnode, TDMT_DND_CREATE_ENCRYPT_KEY_RSP, mndProcessCreateEncryptKeyRsp); mndSetMsgHandle(pMnode, TDMT_MND_UPDATE_DNODE_INFO, mndProcessUpdateDnodeInfoReq); @@ -604,6 +606,21 @@ static int32_t mndProcessStatisReq(SRpcMsg *pReq) { return 0; } +static int32_t mndProcessAuditReq(SRpcMsg *pReq) { + if (tsEnableAudit && tsEnableAuditDelete) { + SMnode *pMnode = pReq->info.node; + SAuditReq auditReq = {0}; + + TAOS_CHECK_RETURN(tDeserializeSAuditReq(pReq->pCont, pReq->contLen, &auditReq)); + + auditAddRecord(pReq, pMnode->clusterId, auditReq.operation, auditReq.db, auditReq.table, auditReq.pSql, + auditReq.sqlLen); + + tFreeSAuditReq(&auditReq); + } + return 0; +} + static int32_t mndUpdateDnodeObj(SMnode *pMnode, SDnodeObj *pDnode) { int32_t code = 0, lino = 0; SDnodeInfoReq infoReq = {0}; From a62b5a3efdcaff11ed85dd6f2dc450a99c1a633d Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Thu, 17 Oct 2024 14:55:07 +0800 Subject: [PATCH 141/695] fix issue --- include/libs/executor/storageapi.h | 1 + include/libs/stream/streamState.h | 1 + include/libs/stream/tstreamFileState.h | 3 + source/dnode/snode/src/snodeInitApi.c | 1 + source/dnode/vnode/src/vnd/vnodeInitApi.c | 1 + source/libs/executor/src/streamfilloperator.c | 1 + .../executor/src/streamtimesliceoperator.c | 6 ++ source/libs/function/inc/functionResInfoInt.h | 1 + source/libs/function/src/builtinsimpl.c | 6 +- source/libs/stream/src/streamSliceState.c | 31 +-------- source/libs/stream/src/streamState.c | 24 ++++++- source/libs/stream/src/tstreamFileState.c | 66 ++++++++++++++++++- 12 files changed, 106 insertions(+), 36 deletions(-) diff --git a/include/libs/executor/storageapi.h b/include/libs/executor/storageapi.h index 929248f5cb35..cd426a3a3a4f 100644 --- a/include/libs/executor/storageapi.h +++ b/include/libs/executor/storageapi.h @@ -378,6 +378,7 @@ typedef struct SStateStore { int32_t (*streamStateFillGetGroupKVByCur)(SStreamStateCur* pCur, SWinKey* pKey, const void** pVal, int32_t* pVLen); int32_t (*streamStateGetKVByCur)(SStreamStateCur* pCur, SWinKey* pKey, const void** pVal, int32_t* pVLen); + void (*streamStateSetFillInfo)(SStreamState* pState); void (*streamStateClearExpiredState)(SStreamState* pState); int32_t (*streamStateSessionAddIfNotExist)(SStreamState* pState, SSessionKey* key, TSKEY gap, void** pVal, diff --git a/include/libs/stream/streamState.h b/include/libs/stream/streamState.h index 3b05e3abf20a..a50451c3ebe9 100644 --- a/include/libs/stream/streamState.h +++ b/include/libs/stream/streamState.h @@ -108,6 +108,7 @@ int32_t streamStateFillGetGroupKVByCur(SStreamStateCur* pCur, SWinKey* pKey, con int32_t streamStateGetKVByCur(SStreamStateCur* pCur, SWinKey* pKey, const void** pVal, int32_t* pVLen); // twa +void streamStateSetFillInfo(SStreamState* pState); void streamStateClearExpiredState(SStreamState* pState); void streamStateCurNext(SStreamState* pState, SStreamStateCur* pCur); diff --git a/include/libs/stream/tstreamFileState.h b/include/libs/stream/tstreamFileState.h index a6f55fca7629..4a696d979805 100644 --- a/include/libs/stream/tstreamFileState.h +++ b/include/libs/stream/tstreamFileState.h @@ -145,9 +145,12 @@ SSHashObj* getGroupIdCache(SStreamFileState* pFileState); int fillStateKeyCompare(const void* pWin1, const void* pDatas, int pos); int32_t getRowStatePrevRow(SStreamFileState* pFileState, const SWinKey* pKey, SWinKey* pResKey, void** ppVal, int32_t* pVLen, int32_t* pWinCode); +int32_t addSearchItem(SStreamFileState* pFileState, SArray* pWinStates, const SWinKey* pKey); //twa +void setFillInfo(SStreamFileState* pFileState); void clearExpiredState(SStreamFileState* pFileState); +int32_t addArrayBuffIfNotExist(SSHashObj* pSearchBuff, uint64_t groupId, SArray** ppResStates); #ifdef __cplusplus } diff --git a/source/dnode/snode/src/snodeInitApi.c b/source/dnode/snode/src/snodeInitApi.c index 628b4b392d3b..680a2fd83c6e 100644 --- a/source/dnode/snode/src/snodeInitApi.c +++ b/source/dnode/snode/src/snodeInitApi.c @@ -67,6 +67,7 @@ void initStateStoreAPI(SStateStore* pStore) { pStore->streamStateFillGetGroupKVByCur = streamStateFillGetGroupKVByCur; pStore->streamStateGetKVByCur = streamStateGetKVByCur; + pStore->streamStateSetFillInfo = streamStateSetFillInfo; pStore->streamStateClearExpiredState = streamStateClearExpiredState; pStore->streamStateSessionAddIfNotExist = streamStateSessionAddIfNotExist; diff --git a/source/dnode/vnode/src/vnd/vnodeInitApi.c b/source/dnode/vnode/src/vnd/vnodeInitApi.c index 3a36dacbf038..d688d1323d31 100644 --- a/source/dnode/vnode/src/vnd/vnodeInitApi.c +++ b/source/dnode/vnode/src/vnd/vnodeInitApi.c @@ -183,6 +183,7 @@ void initStateStoreAPI(SStateStore* pStore) { pStore->streamStateFillGetGroupKVByCur = streamStateFillGetGroupKVByCur; pStore->streamStateGetKVByCur = streamStateGetKVByCur; + pStore->streamStateSetFillInfo = streamStateSetFillInfo; pStore->streamStateClearExpiredState = streamStateClearExpiredState; pStore->streamStateSessionAddIfNotExist = streamStateSessionAddIfNotExist; diff --git a/source/libs/executor/src/streamfilloperator.c b/source/libs/executor/src/streamfilloperator.c index a36c2a65e0ab..81832cac8fa1 100644 --- a/source/libs/executor/src/streamfilloperator.c +++ b/source/libs/executor/src/streamfilloperator.c @@ -1636,6 +1636,7 @@ int32_t getDownStreamInfo(SOperatorInfo* downstream, int8_t* triggerType, SInter *pInterval = pInfo->interval; pInfo->hasFill = true; (*ppAggSup) = &pInfo->streamAggSup; + pInfo->streamAggSup.stateStore.streamStateSetFillInfo(pInfo->streamAggSup.pState); } else { code = TSDB_CODE_STREAM_INTERNAL_ERROR; } diff --git a/source/libs/executor/src/streamtimesliceoperator.c b/source/libs/executor/src/streamtimesliceoperator.c index 289c641c43c8..8becadaa1af2 100644 --- a/source/libs/executor/src/streamtimesliceoperator.c +++ b/source/libs/executor/src/streamtimesliceoperator.c @@ -1751,6 +1751,9 @@ static int32_t doStreamTimeSliceNext(SOperatorInfo* pOperator, SSDataBlock** ppR goto _end; } + if (pInfo->twAggSup.calTrigger == STREAM_TRIGGER_FORCE_WINDOW_CLOSE) { + pAggSup->stateStore.streamStateClearExpiredState(pAggSup->pState); + } setStreamOperatorCompleted(pOperator); resetStreamFillSup(pInfo->pFillSup); (*ppRes) = NULL; @@ -1854,6 +1857,9 @@ static int32_t doStreamTimeSliceNext(SOperatorInfo* pOperator, SSDataBlock** ppR QUERY_CHECK_CODE(code, lino, _end); if (!(*ppRes)) { + if (pInfo->twAggSup.calTrigger == STREAM_TRIGGER_FORCE_WINDOW_CLOSE) { + pAggSup->stateStore.streamStateClearExpiredState(pAggSup->pState); + } setStreamOperatorCompleted(pOperator); resetStreamFillSup(pInfo->pFillSup); } diff --git a/source/libs/function/inc/functionResInfoInt.h b/source/libs/function/inc/functionResInfoInt.h index 9ee1e884b33a..f97d2e802489 100644 --- a/source/libs/function/inc/functionResInfoInt.h +++ b/source/libs/function/inc/functionResInfoInt.h @@ -237,6 +237,7 @@ typedef struct SElapsedInfo { } SElapsedInfo; typedef struct STwaInfo { + double dTwaRes; double dOutput; int64_t numOfElems; SPoint1 p; diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c index 9f50e705ca31..78e1166a0be4 100644 --- a/source/libs/function/src/builtinsimpl.c +++ b/source/libs/function/src/builtinsimpl.c @@ -6201,11 +6201,11 @@ int32_t twaFinalize(struct SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { pResInfo->numOfRes = 0; } else { if (pInfo->win.ekey == pInfo->win.skey) { - pInfo->dOutput = pInfo->p.val; + pInfo->dTwaRes = pInfo->p.val; } else if (pInfo->win.ekey == INT64_MAX || pInfo->win.skey == INT64_MIN) { // no data in timewindow - pInfo->dOutput = 0; + pInfo->dTwaRes = 0; } else { - pInfo->dOutput = pInfo->dOutput / (pInfo->win.ekey - pInfo->win.skey); + pInfo->dTwaRes = pInfo->dOutput / (pInfo->win.ekey - pInfo->win.skey); } pResInfo->numOfRes = 1; diff --git a/source/libs/stream/src/streamSliceState.c b/source/libs/stream/src/streamSliceState.c index 0660a68ed285..a80c42a881cc 100644 --- a/source/libs/stream/src/streamSliceState.c +++ b/source/libs/stream/src/streamSliceState.c @@ -33,16 +33,7 @@ int32_t getHashSortRowBuff(SStreamFileState* pFileState, const SWinKey* pKey, vo SArray* pWinStates = NULL; SSHashObj* pSearchBuff = getSearchBuff(pFileState); - void** ppBuff = tSimpleHashGet(pSearchBuff, &pKey->groupId, sizeof(uint64_t)); - if (ppBuff) { - pWinStates = (SArray*)(*ppBuff); - } else { - pWinStates = taosArrayInit(16, sizeof(SWinKey)); - QUERY_CHECK_NULL(pWinStates, code, lino, _end, terrno); - - code = tSimpleHashPut(pSearchBuff, &pKey->groupId, sizeof(uint64_t), &pWinStates, POINTER_BYTES); - QUERY_CHECK_CODE(code, lino, _end); - } + addArrayBuffIfNotExist(pSearchBuff, pKey->groupId, &pWinStates); // recover if (taosArrayGetSize(pWinStates) == 0 && needClearDiskBuff(pFileState)) { @@ -64,25 +55,7 @@ int32_t getHashSortRowBuff(SStreamFileState* pFileState, const SWinKey* pKey, vo streamStateFreeCur(pCur); } - int32_t size = taosArrayGetSize(pWinStates); - int32_t index = binarySearch(pWinStates, size, pKey, fillStateKeyCompare); - if (!isFlushedState(pFileState, pKey->ts, 0)|| index >= 0 || size == 0) { - // find the first position which is smaller than the pKey - if (index >= 0) { - SWinKey* pTmpKey = taosArrayGet(pWinStates, index); - if (winKeyCmprImpl(pTmpKey, pKey) == 0) { - goto _end; - } - } - index++; - void* tmp = taosArrayInsert(pWinStates, index, pKey); - QUERY_CHECK_NULL(tmp, code, lino, _end, terrno); - } - - if (size >= MAX_NUM_OF_CACHE_WIN) { - int32_t num = size - NUM_OF_CACHE_WIN; - taosArrayRemoveBatch(pWinStates, 0, num, NULL); - } + addSearchItem(pFileState, pWinStates, pKey); _end: if (code != TSDB_CODE_SUCCESS) { diff --git a/source/libs/stream/src/streamState.c b/source/libs/stream/src/streamState.c index 99801ab0ebb0..1266208d2c4b 100644 --- a/source/libs/stream/src/streamState.c +++ b/source/libs/stream/src/streamState.c @@ -229,7 +229,6 @@ int32_t streamStateFillPut(SStreamState* pState, const SWinKey* key, const void* int32_t streamStateFillGet(SStreamState* pState, const SWinKey* key, void** pVal, int32_t* pVLen, int32_t* pWinCode) { if (pState->pFileState) { - // todo(liuyao) 改这里 return getRowBuff(pState->pFileState, (void*)key, sizeof(SWinKey), pVal, pVLen, pWinCode); } return streamStateFillGet_rocksdb(pState, key, pVal, pVLen); @@ -289,7 +288,24 @@ int32_t streamStateGetInfo(SStreamState* pState, void* pKey, int32_t keyLen, voi int32_t streamStateAddIfNotExist(SStreamState* pState, const SWinKey* key, void** pVal, int32_t* pVLen, int32_t* pWinCode) { - return streamStateGet(pState, key, pVal, pVLen, pWinCode); + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; + code = streamStateGet(pState, key, pVal, pVLen, pWinCode); + QUERY_CHECK_CODE(code, lino, _end); + + SSHashObj* pSearchBuff = getSearchBuff(pState->pFileState); + if (pSearchBuff != NULL) { + SArray* pWinStates = NULL; + code = addArrayBuffIfNotExist(pSearchBuff, key->groupId, &pWinStates); + QUERY_CHECK_CODE(code, lino, _end); + code = addSearchItem(pState->pFileState, pWinStates, key); + QUERY_CHECK_CODE(code, lino, _end); + } +_end: + if (code != TSDB_CODE_SUCCESS) { + qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } + return code; } void streamStateReleaseBuf(SStreamState* pState, void* pVal, bool used) { @@ -588,6 +604,10 @@ void streamStateClearExpiredState(SStreamState* pState) { clearExpiredState(pState->pFileState); } +void streamStateSetFillInfo(SStreamState* pState) { + setFillInfo(pState->pFileState); +} + int32_t streamStateGetPrev(SStreamState* pState, const SWinKey* pKey, SWinKey* pResKey, void** pVal, int32_t* pVLen, int32_t* pWinCode) { return getRowStatePrevRow(pState->pFileState, pKey, pResKey, pVal, pVLen, pWinCode); diff --git a/source/libs/stream/src/tstreamFileState.c b/source/libs/stream/src/tstreamFileState.c index d31665de90cf..7a646e93b56a 100644 --- a/source/libs/stream/src/tstreamFileState.c +++ b/source/libs/stream/src/tstreamFileState.c @@ -56,6 +56,7 @@ struct SStreamFileState { char* cfName; void* searchBuff; SSHashObj* pGroupIdMap; + bool hasFillCatch; _state_buff_cleanup_fn stateBuffCleanupFn; _state_buff_remove_fn stateBuffRemoveFn; @@ -253,6 +254,8 @@ int32_t streamFileStateInit(int64_t memSize, uint32_t keySize, uint32_t rowSize, pFileState->pGroupIdMap = tSimpleHashInit(1024, hashFn); QUERY_CHECK_NULL(pFileState->pGroupIdMap, code, lino, _end, terrno); + pFileState->hasFillCatch = true; + if (type == STREAM_STATE_BUFF_HASH || type == STREAM_STATE_BUFF_HASH_SEARCH) { code = recoverSnapshot(pFileState, checkpointId); } else if (type == STREAM_STATE_BUFF_SORT) { @@ -997,6 +1000,7 @@ int32_t recoverSnapshot(SStreamFileState* pFileState, int64_t ckId) { } if (vlen != pFileState->rowSize) { code = TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR; + taosMemoryFreeClear(pVal); QUERY_CHECK_CODE(code, lino, _end); } memcpy(pNewPos->pRowBuff, pVal, vlen); @@ -1207,6 +1211,10 @@ SSHashObj* getGroupIdCache(SStreamFileState* pFileState) { return pFileState->pGroupIdMap; } +void setFillInfo(SStreamFileState* pFileState) { + pFileState->hasFillCatch = false; +} + void clearExpiredState(SStreamFileState* pFileState) { SSHashObj* pSearchBuff = pFileState->searchBuff; void* pIte = NULL; @@ -1222,8 +1230,10 @@ void clearExpiredState(SStreamFileState* pFileState) { int32_t code_file = pFileState->stateFileRemoveFn(pFileState, pKey); qTrace("%s at line %d res:%d", __func__, __LINE__, code_file); - code_file = streamStateFillDel_rocksdb(pFileState->pFileStore, pKey); - qTrace("%s at line %d res %d", __func__, __LINE__, code_file); + if (pFileState->hasFillCatch == false || isFlushedState(pFileState, pKey->ts, 0)) { + code_file = streamStateFillDel_rocksdb(pFileState->pFileStore, pKey); + qTrace("state fill delete.%s at line %d res %d", __func__, __LINE__, code_file); + } } taosArrayRemoveBatch(pWinStates, 0, size - 1, NULL); } @@ -1368,3 +1378,55 @@ int32_t getRowStatePrevRow(SStreamFileState* pFileState, const SWinKey* pKey, SW } return code; } + +int32_t addSearchItem(SStreamFileState* pFileState, SArray* pWinStates, const SWinKey* pKey) { + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; + int32_t size = taosArrayGetSize(pWinStates); + int32_t index = binarySearch(pWinStates, size, pKey, fillStateKeyCompare); + if (!isFlushedState(pFileState, pKey->ts, 0) || index >= 0 || size == 0) { + if (index >= 0) { + SWinKey* pTmpKey = taosArrayGet(pWinStates, index); + if (winKeyCmprImpl(pTmpKey, pKey) == 0) { + goto _end; + } + } + index++; + void* tmp = taosArrayInsert(pWinStates, index, pKey); + QUERY_CHECK_NULL(tmp, code, lino, _end, terrno); + } + + if (size >= MAX_NUM_OF_CACHE_WIN) { + int32_t num = size - NUM_OF_CACHE_WIN; + taosArrayRemoveBatch(pWinStates, 0, num, NULL); + } +_end: + if (code != TSDB_CODE_SUCCESS) { + qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } + return code; +} + +int32_t addArrayBuffIfNotExist(SSHashObj* pSearchBuff, uint64_t groupId, SArray** ppResStates) { + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; + SArray* pWinStates = NULL; + void** ppBuff = tSimpleHashGet(pSearchBuff, &groupId, sizeof(uint64_t)); + if (ppBuff) { + pWinStates = (SArray*)(*ppBuff); + } else { + pWinStates = taosArrayInit(16, sizeof(SWinKey)); + QUERY_CHECK_NULL(pWinStates, code, lino, _end, terrno); + + code = tSimpleHashPut(pSearchBuff, &groupId, sizeof(uint64_t), &pWinStates, POINTER_BYTES); + QUERY_CHECK_CODE(code, lino, _end); + } + + (*ppResStates) = pWinStates; + +_end: + if (code != TSDB_CODE_SUCCESS) { + qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } + return code; +} From 4a34ae257088afa7588fdbfbcebd5915c87051d2 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Thu, 17 Oct 2024 15:48:52 +0800 Subject: [PATCH 142/695] adj ci --- source/libs/executor/src/streamintervalsliceoperator.c | 1 + tests/army/query/function/test_resinfo.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/source/libs/executor/src/streamintervalsliceoperator.c b/source/libs/executor/src/streamintervalsliceoperator.c index 995ca02d4f9c..c122ceb43dfc 100644 --- a/source/libs/executor/src/streamintervalsliceoperator.c +++ b/source/libs/executor/src/streamintervalsliceoperator.c @@ -262,6 +262,7 @@ static int32_t doStreamIntervalSliceAggImpl(SOperatorInfo* pOperator, SSDataBloc SWinKey prevKey = {.ts = prevPoint.winKey.win.skey, .groupId = prevPoint.winKey.groupId}; code = saveWinResult(&prevKey, prevPoint.pResPos, pInfo->pUpdatedMap); QUERY_CHECK_CODE(code, lino, _end); + prevPoint.pLastRow->key = prevPoint.winKey.win.ekey; } code = setIntervalSliceOutputBuf(&curPoint, pSup->pCtx, numOfOutput, pSup->rowEntryInfoOffset); diff --git a/tests/army/query/function/test_resinfo.py b/tests/army/query/function/test_resinfo.py index 51d51f3ce168..5a59ed45cd0f 100644 --- a/tests/army/query/function/test_resinfo.py +++ b/tests/army/query/function/test_resinfo.py @@ -26,7 +26,7 @@ from frame.caseBase import * from frame import * -initial_hash_resinfoInt = "e739cde34b98f13dd9ad696d18f060cc" +initial_hash_resinfoInt = "fbfd69d6f0aa6e015a7b5475b33ee8c8" initial_hash_resinfo = "172d04aa7af0d8cd2e4d9df284079958" class TDTestCase(TBase): @@ -43,6 +43,7 @@ def testFileChanged(self): resinfoIntFile = etool.curFile(__file__, "../../../../source/libs/function/inc/functionResInfoInt.h") resinfoFile = etool.curFile(__file__, "../../../../include/libs/function/functionResInfo.h") current_hash = self.get_file_hash(resinfoIntFile) + tdLog.info(current_hash) if current_hash != initial_hash_resinfoInt: tdLog.exit(f"{resinfoIntFile} has been modified.") else: From 24b963d6211fb45c6b00bb038c8b934249aec05a Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Thu, 17 Oct 2024 16:43:47 +0800 Subject: [PATCH 143/695] add ci --- .../src/streamintervalsliceoperator.c | 22 ++- .../tsim/stream/streamTwaFwcInterval.sim | 129 ++++++++++++++++++ 2 files changed, 147 insertions(+), 4 deletions(-) create mode 100644 tests/script/tsim/stream/streamTwaFwcInterval.sim diff --git a/source/libs/executor/src/streamintervalsliceoperator.c b/source/libs/executor/src/streamintervalsliceoperator.c index c122ceb43dfc..2b53159cb9cb 100644 --- a/source/libs/executor/src/streamintervalsliceoperator.c +++ b/source/libs/executor/src/streamintervalsliceoperator.c @@ -26,6 +26,7 @@ typedef struct SInervalSlicePoint { SSessionKey winKey; + bool *pFinished; SSliceRowData* pLastRow; SRowBuffPos* pResPos; } SInervalSlicePoint; @@ -113,7 +114,8 @@ static int32_t buildIntervalSliceResult(SOperatorInfo* pOperator, SSDataBlock** void initIntervalSlicePoint(SStreamAggSupporter* pAggSup, STimeWindow* pTWin, int64_t groupId, SInervalSlicePoint* pPoint) { pPoint->winKey.groupId = groupId; pPoint->winKey.win = *pTWin; - pPoint->pLastRow = POINTER_SHIFT(pPoint->pResPos->pRowBuff, pAggSup->resultRowSize - pAggSup->stateKeySize); + pPoint->pFinished = POINTER_SHIFT(pPoint->pResPos->pRowBuff, pAggSup->resultRowSize - pAggSup->stateKeySize); + pPoint->pLastRow = POINTER_SHIFT(pPoint->pFinished, sizeof(bool)); } static int32_t getIntervalSliceCurStateBuf(SStreamAggSupporter* pAggSup, SInterval* pInterval, bool needPrev, STimeWindow* pTWin, int64_t groupId, @@ -217,6 +219,14 @@ int32_t setIntervalSliceOutputBuf(SInervalSlicePoint* pPoint, SqlFunctionCtx* pC return code; } +static void setInterpoWindowFinished(SInervalSlicePoint* pPoint) { + (*pPoint->pFinished) = true; +} + +static bool isInterpoWindowFinished(SInervalSlicePoint* pPoint) { + return *pPoint->pFinished; +} + static int32_t doStreamIntervalSliceAggImpl(SOperatorInfo* pOperator, SSDataBlock* pBlock, SSHashObj* pUpdatedMap, SSHashObj* pDeletedMap) { int32_t code = TSDB_CODE_SUCCESS; @@ -249,7 +259,7 @@ static int32_t doStreamIntervalSliceAggImpl(SOperatorInfo* pOperator, SSDataBloc code = getIntervalSliceCurStateBuf(&pInfo->streamAggSup, &pInfo->interval, pInfo->hasInterpoFunc, &curWin, groupId, &curPoint, &prevPoint, &winCode); QUERY_CHECK_CODE(code, lino, _end); - if (pInfo->hasInterpoFunc && IS_VALID_WIN_KEY(prevPoint.winKey.win.skey) && prevPoint.pLastRow->key != prevPoint.winKey.win.ekey) { + if (pInfo->hasInterpoFunc && IS_VALID_WIN_KEY(prevPoint.winKey.win.skey) && isInterpoWindowFinished(&prevPoint) == false) { code = setIntervalSliceOutputBuf(&prevPoint, pSup->pCtx, numOfOutput, pSup->rowEntryInfoOffset); QUERY_CHECK_CODE(code, lino, _end); @@ -262,7 +272,7 @@ static int32_t doStreamIntervalSliceAggImpl(SOperatorInfo* pOperator, SSDataBloc SWinKey prevKey = {.ts = prevPoint.winKey.win.skey, .groupId = prevPoint.winKey.groupId}; code = saveWinResult(&prevKey, prevPoint.pResPos, pInfo->pUpdatedMap); QUERY_CHECK_CODE(code, lino, _end); - prevPoint.pLastRow->key = prevPoint.winKey.win.ekey; + setInterpoWindowFinished(&prevPoint); } code = setIntervalSliceOutputBuf(&curPoint, pSup->pCtx, numOfOutput, pSup->rowEntryInfoOffset); @@ -294,6 +304,10 @@ static int32_t doStreamIntervalSliceAggImpl(SOperatorInfo* pOperator, SSDataBloc forwardRows, pBlock->info.rows, numOfOutput); QUERY_CHECK_CODE(code, lino, _end); + if (curPoint.pLastRow->key == curPoint.winKey.win.ekey) { + setInterpoWindowFinished(&curPoint); + } + startPos = getNextQualifiedWindow(&pInfo->interval, &curWin, &pBlock->info, tsCols, prevEndPos, TSDB_ORDER_ASC); if (startPos < 0) { break; @@ -569,7 +583,7 @@ int32_t createStreamIntervalSliceOperatorInfo(SOperatorInfo* downstream, SPhysiN QUERY_CHECK_CODE(code, lino, _error); int32_t keyBytes = sizeof(TSKEY); - keyBytes += blockDataGetRowSize(pDownRes) + sizeof(SResultCellData) * taosArrayGetSize(pDownRes->pDataBlock); + keyBytes += blockDataGetRowSize(pDownRes) + sizeof(SResultCellData) * taosArrayGetSize(pDownRes->pDataBlock) + sizeof(bool); if (pPkCol) { keyBytes += pPkCol->bytes; } diff --git a/tests/script/tsim/stream/streamTwaFwcInterval.sim b/tests/script/tsim/stream/streamTwaFwcInterval.sim new file mode 100644 index 000000000000..85e4bb552b1e --- /dev/null +++ b/tests/script/tsim/stream/streamTwaFwcInterval.sim @@ -0,0 +1,129 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sleep 50 +sql connect + +print step1 +print =============== create database +sql create database test vgroups 1; +sql use test; + +sql create stable st(ts timestamp, a int, b int , c int)tags(ta int,tb int,tc int); +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); + +sql create stream streams1 trigger force_window_close IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _wstart, twa(a), ta from st partition by tbname,ta interval(2s); + +run tsim/stream/checkTaskStatus.sim + +sql insert into t1 values(now + 3000a,1,1,1) (now + 3100a,5,10,10) (now + 3200a,5,10,10) (now + 5100a,20,1,1) (now + 5200a,30,10,10) (now + 5300a,40,10,10); +sql insert into t2 values(now + 3000a,1,1,1) (now + 3100a,2,10,10) (now + 3200a,30,10,10) (now + 5100a,10,1,1) (now + 5200a,40,10,10) (now + 5300a,7,10,10); + + +print sql select _wstart, twa(a) from t1 interval(2s); +sql select _wstart, twa(a) from t1 interval(2s); + +$query1_data01 = $data01 +$query1_data11 = $data11 + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +print sql select _wstart, twa(a) from t2 interval(2s); +sql select _wstart, twa(a) from t2 interval(2s); + +$query2_data01 = $data01 +$query2_data11 = $data11 + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 +loop0: + +sleep 2000 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 2 sql select * from streamt where ta == 1; +sql select * from streamt where ta == 1; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +# row 0 +if $rows < 2 then + print ======rows=$rows + goto loop0 +endi + +if $data01 != $query1_data01 then + print ======data01========$data01 + print ======query1_data01=$query1_data01 + return -1 +endi + +if $data11 != $query1_data11 then + print ======data11========$data11 + print ======query1_data11=$query1_data11 + return -1 +endi + +$loop_count = 0 +loop1: + +sleep 2000 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 2 sql select * from streamt where ta == 2; +sql select * from streamt where ta == 2; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows < 2 then + print ======rows=$rows + goto loop1 +endi + +if $data01 != $query2_data01 then + print ======data01======$data01 + print ====query2_data01=$query2_data01 + return -1 +endi + +if $data11 != $query2_data11 then + print ======data11======$data11 + print ====query2_data11=$query2_data11 + return -1 +endi + +print end + +system sh/exec.sh -n dnode1 -s stop -x SIGINT From 2e5501c354bd56464aba0fc8cafe1e88a05d9d0c Mon Sep 17 00:00:00 2001 From: qevolg <2227465945@qq.com> Date: Thu, 17 Oct 2024 16:56:01 +0800 Subject: [PATCH 144/695] feat(tools): add taoskeeper --- tools/keeper | 1 + 1 file changed, 1 insertion(+) create mode 160000 tools/keeper diff --git a/tools/keeper b/tools/keeper new file mode 160000 index 000000000000..1b291d793018 --- /dev/null +++ b/tools/keeper @@ -0,0 +1 @@ +Subproject commit 1b291d7930180b49a0765805a34b3fb56f41b9fa From cbd262541e916ff1507cfc3219856a363abd50fb Mon Sep 17 00:00:00 2001 From: qevolg <2227465945@qq.com> Date: Thu, 17 Oct 2024 17:04:34 +0800 Subject: [PATCH 145/695] feat(tools): add taoskeeper --- tools/keeper | 1 - tools/keeper/.dockerignore | 1 + tools/keeper/.github/workflows/build.yaml | 59 + .../.github/workflows/release-pr-title.yaml | 33 + tools/keeper/.github/workflows/release.yaml | 45 + tools/keeper/.gitignore | 22 + tools/keeper/CHANGELOG.md | 10 + tools/keeper/Dockerfile | 16 + tools/keeper/DockerfileCloud | 24 + tools/keeper/README-CN.md | 267 + tools/keeper/README.md | 273 + tools/keeper/api/adapter2.go | 260 + tools/keeper/api/adapter2_test.go | 98 + tools/keeper/api/audit.go | 336 ++ tools/keeper/api/audit_test.go | 153 + tools/keeper/api/checkhealth.go | 21 + tools/keeper/api/common.go | 89 + tools/keeper/api/exporter_test.go | 297 + tools/keeper/api/gen_metric.go | 770 +++ tools/keeper/api/gen_metric_test.go | 358 ++ tools/keeper/api/https_test.go | 127 + tools/keeper/api/nodeexporter.go | 32 + tools/keeper/api/report.go | 478 ++ tools/keeper/api/tables.go | 286 + tools/keeper/api/zabbix.go | 113 + tools/keeper/ci/changelog-generate.sh | 31 + tools/keeper/ci/post-release.sh | 22 + tools/keeper/ci/release.sh | 31 + tools/keeper/cmd/command.go | 461 ++ tools/keeper/cmd/empty_test.go | 8 + tools/keeper/config/metrics.sample | 38 + tools/keeper/config/taoskeeper.toml | 53 + .../keeper/config/taoskeeper_enterprise.toml | 65 + ...ngine-taoskeeper-prometheus-dashboard.json | 5365 +++++++++++++++++ ...engine-taoskeeper-prometheus-dashboard.png | Bin 0 -> 233143 bytes tools/keeper/db/connector.go | 177 + tools/keeper/db/empty_test.go | 8 + tools/keeper/docker-compose.yml | 29 + tools/keeper/examples/metrics.toml | 38 + tools/keeper/go.mod | 80 + tools/keeper/go.sum | 764 +++ tools/keeper/infrastructure/config/audit.go | 6 + tools/keeper/infrastructure/config/config.go | 296 + tools/keeper/infrastructure/config/log.go | 29 + .../infrastructure/config/metric_test.go | 85 + tools/keeper/infrastructure/config/metrics.go | 29 + tools/keeper/infrastructure/log/empty_test.go | 8 + tools/keeper/infrastructure/log/log.go | 278 + tools/keeper/infrastructure/log/log_test.go | 23 + tools/keeper/infrastructure/log/web.go | 55 + tools/keeper/main.go | 11 + tools/keeper/monitor/collect.go | 99 + tools/keeper/monitor/empty_test.go | 8 + tools/keeper/monitor/monitor.go | 89 + tools/keeper/monitor/monitor_test.go | 58 + tools/keeper/monitor/system.go | 97 + tools/keeper/process/builder.go | 55 + tools/keeper/process/empty_test.go | 8 + tools/keeper/process/handle.go | 666 ++ tools/keeper/prometheus/prometheus.yml | 13 + tools/keeper/system/empty_test.go | 8 + tools/keeper/system/program.go | 146 + tools/keeper/system/program_test.go | 22 + tools/keeper/taoskeeper.service | 19 + tools/keeper/telegraf.conf | 6 + tools/keeper/telegraf.yml | 9 + tools/keeper/util/empty_test.go | 8 + tools/keeper/util/pool/antpool.go | 15 + tools/keeper/util/pool/bytes.go | 23 + tools/keeper/util/pool/empty_test.go | 8 + tools/keeper/util/util.go | 154 + tools/keeper/version/version.go | 9 + tools/keeper/zbx_taos_keeper_templates.xml | 111 + 73 files changed, 13789 insertions(+), 1 deletion(-) delete mode 160000 tools/keeper create mode 100644 tools/keeper/.dockerignore create mode 100644 tools/keeper/.github/workflows/build.yaml create mode 100644 tools/keeper/.github/workflows/release-pr-title.yaml create mode 100644 tools/keeper/.github/workflows/release.yaml create mode 100644 tools/keeper/.gitignore create mode 100644 tools/keeper/CHANGELOG.md create mode 100644 tools/keeper/Dockerfile create mode 100644 tools/keeper/DockerfileCloud create mode 100644 tools/keeper/README-CN.md create mode 100644 tools/keeper/README.md create mode 100644 tools/keeper/api/adapter2.go create mode 100644 tools/keeper/api/adapter2_test.go create mode 100644 tools/keeper/api/audit.go create mode 100644 tools/keeper/api/audit_test.go create mode 100644 tools/keeper/api/checkhealth.go create mode 100644 tools/keeper/api/common.go create mode 100644 tools/keeper/api/exporter_test.go create mode 100644 tools/keeper/api/gen_metric.go create mode 100644 tools/keeper/api/gen_metric_test.go create mode 100644 tools/keeper/api/https_test.go create mode 100644 tools/keeper/api/nodeexporter.go create mode 100644 tools/keeper/api/report.go create mode 100644 tools/keeper/api/tables.go create mode 100644 tools/keeper/api/zabbix.go create mode 100755 tools/keeper/ci/changelog-generate.sh create mode 100755 tools/keeper/ci/post-release.sh create mode 100755 tools/keeper/ci/release.sh create mode 100644 tools/keeper/cmd/command.go create mode 100644 tools/keeper/cmd/empty_test.go create mode 100644 tools/keeper/config/metrics.sample create mode 100644 tools/keeper/config/taoskeeper.toml create mode 100644 tools/keeper/config/taoskeeper_enterprise.toml create mode 100644 tools/keeper/dashboards/tdengine-taoskeeper-prometheus-dashboard.json create mode 100644 tools/keeper/dashboards/tdengine-taoskeeper-prometheus-dashboard.png create mode 100644 tools/keeper/db/connector.go create mode 100644 tools/keeper/db/empty_test.go create mode 100644 tools/keeper/docker-compose.yml create mode 100644 tools/keeper/examples/metrics.toml create mode 100644 tools/keeper/go.mod create mode 100644 tools/keeper/go.sum create mode 100644 tools/keeper/infrastructure/config/audit.go create mode 100644 tools/keeper/infrastructure/config/config.go create mode 100644 tools/keeper/infrastructure/config/log.go create mode 100644 tools/keeper/infrastructure/config/metric_test.go create mode 100644 tools/keeper/infrastructure/config/metrics.go create mode 100644 tools/keeper/infrastructure/log/empty_test.go create mode 100644 tools/keeper/infrastructure/log/log.go create mode 100644 tools/keeper/infrastructure/log/log_test.go create mode 100644 tools/keeper/infrastructure/log/web.go create mode 100644 tools/keeper/main.go create mode 100644 tools/keeper/monitor/collect.go create mode 100644 tools/keeper/monitor/empty_test.go create mode 100644 tools/keeper/monitor/monitor.go create mode 100644 tools/keeper/monitor/monitor_test.go create mode 100644 tools/keeper/monitor/system.go create mode 100644 tools/keeper/process/builder.go create mode 100644 tools/keeper/process/empty_test.go create mode 100644 tools/keeper/process/handle.go create mode 100644 tools/keeper/prometheus/prometheus.yml create mode 100644 tools/keeper/system/empty_test.go create mode 100644 tools/keeper/system/program.go create mode 100644 tools/keeper/system/program_test.go create mode 100644 tools/keeper/taoskeeper.service create mode 100644 tools/keeper/telegraf.conf create mode 100644 tools/keeper/telegraf.yml create mode 100644 tools/keeper/util/empty_test.go create mode 100644 tools/keeper/util/pool/antpool.go create mode 100644 tools/keeper/util/pool/bytes.go create mode 100644 tools/keeper/util/pool/empty_test.go create mode 100644 tools/keeper/util/util.go create mode 100644 tools/keeper/version/version.go create mode 100644 tools/keeper/zbx_taos_keeper_templates.xml diff --git a/tools/keeper b/tools/keeper deleted file mode 160000 index 1b291d793018..000000000000 --- a/tools/keeper +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 1b291d7930180b49a0765805a34b3fb56f41b9fa diff --git a/tools/keeper/.dockerignore b/tools/keeper/.dockerignore new file mode 100644 index 000000000000..cff5a58d80a4 --- /dev/null +++ b/tools/keeper/.dockerignore @@ -0,0 +1 @@ +!taoskeeper diff --git a/tools/keeper/.github/workflows/build.yaml b/tools/keeper/.github/workflows/build.yaml new file mode 100644 index 000000000000..3b0db21ccbd1 --- /dev/null +++ b/tools/keeper/.github/workflows/build.yaml @@ -0,0 +1,59 @@ +name: Go + +on: [push] + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + go: ["1.18"] + name: Go ${{ matrix.go }} + steps: + - name: Build tools + run: | + sudo apt-get update -y + sudo apt-get install -y build-essential cmake libgeos-dev + + - name: checkout + uses: actions/checkout@v2 + + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: ${{ matrix.go }} + + - name: checkout TDengine + uses: actions/checkout@v3 + with: + repository: "taosdata/TDengine" + path: "TDengine" + ref: "main" + + - name: install TDengine + run: | + cd TDengine + mkdir debug + cd debug + cmake .. -DBUILD_HTTP=false -DBUILD_JDBC=false -DBUILD_TOOLS=false -DBUILD_TEST=off + make -j 4 + sudo make install + which taosd + which taosadapter + + - name: start taosd + run: | + cp /etc/taos/taos.cfg ./ + sudo echo "supportVnodes 256" >> taos.cfg + nohup sudo taosd -c taos.cfg & + + - name: start taosadapter + run: nohup sudo taosadapter & + + - name: test + run: go mod tidy && go test -v ./... + + - name: Build + run: | + go mod tidy + go build diff --git a/tools/keeper/.github/workflows/release-pr-title.yaml b/tools/keeper/.github/workflows/release-pr-title.yaml new file mode 100644 index 000000000000..b20e1e49d95a --- /dev/null +++ b/tools/keeper/.github/workflows/release-pr-title.yaml @@ -0,0 +1,33 @@ +name: "Release PR Check" + +on: + pull_request: + branches: + - develop + + types: + - opened + - edited + - synchronize + - labeled + - unlabeled +jobs: + check: + name: "PR check if release" + if: contains(github.event.pull_request.title, '') + runs-on: ubuntu-latest + steps: + - uses: Slashgear/action-check-pr-title@v3.0.0 + with: + regexp: '.*:?\s*(\d+\.\d+\.\d+)(-\S+)?.*' # Regex the title should match. + + - name: Check version + run: | + version=$(echo "${{ github.event.pull_request.title }}" | grep -o -P ':?\s*(\d+\.\d+\.\d+)(-\S+)?' |sed -E 's/:?\s*//') + echo Seems you want to release $version + if git show-ref --tags $version --quiet; then + echo "bug tag exists" + exit 1 + else + echo "tag is valid" + fi diff --git a/tools/keeper/.github/workflows/release.yaml b/tools/keeper/.github/workflows/release.yaml new file mode 100644 index 000000000000..2a156634d413 --- /dev/null +++ b/tools/keeper/.github/workflows/release.yaml @@ -0,0 +1,45 @@ +name: Release + +on: + pull_request: + branches: + - develop + types: + - closed + +jobs: + release: + if: github.event.pull_request.merged == true && contains(github.event.pull_request.title, '') + runs-on: ubuntu-20.04 + + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + ref: develop + fetch-depth: 0 + + - name: Extract version + id: extract-version + run: | + version=$(echo "${{ github.event.pull_request.title }}" | grep -o -P ':?\s*(\d+\.\d+\.\d+)(-\S+)?' |sed -E 's/:?\s*//') + echo $version + echo ::set-output name=version::$version + + - name: Version bump + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + ./ci/release.sh ${{ steps.extract-version.outputs.version }} + + - name: Release + uses: softprops/action-gh-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: v${{ steps.extract-version.outputs.version }} + body_path: CHANGELOG.tmp + + - name: Post-release + run: | + ./ci/post-release.sh ${{ steps.extract-version.outputs.version }} diff --git a/tools/keeper/.gitignore b/tools/keeper/.gitignore new file mode 100644 index 000000000000..2cba3f06c8b5 --- /dev/null +++ b/tools/keeper/.gitignore @@ -0,0 +1,22 @@ +# Binaries for programs and plugins +*.exe +*.exe~ +*.dll +*.so +*.dylib + +# Test binary, built with `go test -c` +*.test + +# Output of the go coverage tool, specifically when used with LiteIDE +*.out +*.html +*.data + +# Dependency directories (remove the comment below to include it) +vendor +/debug/ +/.idea/ +/taoskeeper +/test_data +/.vscode diff --git a/tools/keeper/CHANGELOG.md b/tools/keeper/CHANGELOG.md new file mode 100644 index 000000000000..6775343b0f53 --- /dev/null +++ b/tools/keeper/CHANGELOG.md @@ -0,0 +1,10 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Conventional Changelog](https://www.conventionalcommits.org/en/v1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## Footnote + +This changelog is automatically generated. diff --git a/tools/keeper/Dockerfile b/tools/keeper/Dockerfile new file mode 100644 index 000000000000..c38bdc1acbd0 --- /dev/null +++ b/tools/keeper/Dockerfile @@ -0,0 +1,16 @@ +FROM golang:1.18.6-alpine as builder +LABEL maintainer = "Linhe Huo " + +WORKDIR /usr/src/taoskeeper +COPY ./ /usr/src/taoskeeper/ +ENV GO111MODULE=on \ + GOPROXY=https://goproxy.cn,direct +RUN go mod tidy && go build + +FROM alpine:3 +RUN mkdir -p /etc/taos +COPY --from=builder /usr/src/taoskeeper/taoskeeper /usr/bin/ +COPY ./config/taoskeeper.toml /etc/taos/taoskeeper.toml +RUN chmod u+rw /etc/taos/taoskeeper.toml +EXPOSE 6043 +CMD ["taoskeeper"] diff --git a/tools/keeper/DockerfileCloud b/tools/keeper/DockerfileCloud new file mode 100644 index 000000000000..11137f61c232 --- /dev/null +++ b/tools/keeper/DockerfileCloud @@ -0,0 +1,24 @@ +FROM golang:1.18.6-alpine as builder +LABEL maintainer = "TDengine" + +ARG latestv +ARG gitinfo +ARG buildinfo + +RUN apk --no-cache add upx && \ + rm -rf /var/lib/apt/lists/* + +WORKDIR /usr/src/taoskeeper +COPY ./ /usr/src/taoskeeper/ +ENV GO111MODULE=on \ + GOPROXY=https://goproxy.cn,direct + +RUN echo "$latestv $gitinfo $buildinfo" +RUN go mod tidy && go build -ldflags="-s -w -X 'github.com/taosdata/taoskeeper/version.Version=${latestv}' -X 'github.com/taosdata/taoskeeper/version.Gitinfo=${gitinfo}' -X 'github.com/taosdata/taoskeeper/version.BuildInfo=${buildinfo}'" -o taoskeeper . && upx -9 taoskeeper +FROM alpine:3 +RUN mkdir -p /etc/taos +COPY --from=builder /usr/src/taoskeeper/taoskeeper /usr/bin/ +COPY ./config/taoskeeper.toml /etc/taos/taoskeeper.toml +RUN chmod u+rw /etc/taos/taoskeeper.toml +EXPOSE 6043 +CMD ["taoskeeper"] diff --git a/tools/keeper/README-CN.md b/tools/keeper/README-CN.md new file mode 100644 index 000000000000..770e9513c1a2 --- /dev/null +++ b/tools/keeper/README-CN.md @@ -0,0 +1,267 @@ +# TaosKeeper + +taosKeeper 是 TDengine 各项监控指标的导出工具,通过简单的几项配置即可获取 TDengine 的运行状态。并且 taosKeeper 企业版支持多种收集器,可以方便进行监控数据的展示。 + +taosKeeper 使用 TDengine RESTful 接口,所以不需要安装 TDengine 客户端即可使用。 + +## 构建 + +### 获取源码 + +从 GitHub 克隆源码: + +```sh +git clone https://github.com/taosdata/TDengine +cd TDengine/tools/keeper +``` + +### 编译 + +taosKeeper 使用 `GO` 语言编写,在构建前需要配置好 `GO` 语言开发环境。 + +```sh +go mod tidy +go build +``` + +## 安装 + +如果是自行构建的项目,仅需要拷贝 `taoskeeper` 文件到你的 `PATH` 中。 + +```sh +sudo install taoskeeper /usr/bin/ +``` + +## 启动 + +在启动前,应该做好如下配置: +在 `/etc/taos/taoskeeper.toml` 配置 TDengine 连接参数以及监控指标前缀等其他信息。 + +```toml +# gin 框架是否启用 debug +debug = false + +# 服务监听端口, 默认为 6043 +port = 6043 + +# 日志级别,包含 panic、error、info、debug、trace等 +loglevel = "info" + +# 程序中使用协程池的大小 +gopoolsize = 50000 + +# 查询 TDengine 监控数据轮询间隔 +RotationInterval = "15s" + +[tdengine] +host = "127.0.0.1" +port = 6041 +username = "root" +password = "taosdata" + +# 需要被监控的 taosAdapter +[taosAdapter] +address = ["127.0.0.1:6041"] + +[metrics] +# 监控指标前缀 +prefix = "taos" + +# 存放监控数据的数据库 +database = "log" + +# 指定需要监控的普通表 +tables = [] + +[environment] +# 是否在容器中运行,影响 taosKeeper 自身的监控数据 +incgroup = false +``` + +现在可以启动服务,输入: + +```sh +taoskeeper +``` + +如果你使用 `systemd`,复制 `taoskeeper.service` 到 `/lib/systemd/system/`,并启动服务。 + +```sh +sudo cp taoskeeper.service /lib/systemd/system/ +sudo systemctl daemon-reload +sudo systemctl start taoskeeper +``` + +让 taosKeeper 随系统开机自启动。 + +```sh +sudo systemctl enable taoskeeper +``` + +如果使用 `systemd`,你可以使用如下命令完成安装。 + +```sh +go mod tidy +go build +sudo install taoskeeper /usr/bin/ +sudo cp taoskeeper.service /lib/systemd/system/ +sudo systemctl daemon-reload +sudo systemctl start taoskeeper +sudo systemctl enable taoskeeper +``` + +## Docker + +如下介绍了如何在 docker 中构建 taosKeeper: + +在构建前请配置好 `./config/taoskeeper.toml` 中合适的参数,并编辑 Dockerfile ,示例如下。 + +```dockerfile +FROM golang:1.18.6-alpine as builder + +WORKDIR /usr/src/taoskeeper +COPY ./ /usr/src/taoskeeper/ +ENV GO111MODULE=on \ + GOPROXY=https://goproxy.cn,direct +RUN go mod tidy && go build + +FROM alpine:3 +RUN mkdir -p /etc/taos +COPY --from=builder /usr/src/taoskeeper/taoskeeper /usr/bin/ +COPY ./config/taoskeeper.toml /etc/taos/taoskeeper.toml +EXPOSE 6043 +CMD ["taoskeeper"] +``` + +如果已经有 taosKeeper 可执行文件,在配置好 `taoskeeper.toml` 后你可以使用如下方式构建: + +```dockerfile +FROM ubuntu:18.04 +RUN mkdir -p /etc/taos +COPY ./taoskeeper /usr/bin/ +COPY ./taoskeeper.toml /etc/taos/taoskeeper.toml +EXPOSE 6043 +CMD ["taoskeeper"] +``` + +## 使用(**企业版**) + +### Prometheus (by scrape) + +taosKeeper 可以像 `node-exporter` 一样向 Prometheus 提供监控指标。\ +在 `/etc/prometheus/prometheus.yml` 添加配置: + +```yml +global: + scrape_interval: 5s + +scrape_configs: + - job_name: "taoskeeper" + static_configs: + - targets: ["taoskeeper:6043"] +``` + +现在使用 PromQL 查询即可以显示结果,比如要查看指定主机(通过 FQDN 正则匹配表达式筛选)硬盘使用百分比: + +```promql +taos_dn_disk_used / taos_dn_disk_total {fqdn=~ "tdengine.*"} +``` + +你可以使用 `docker-compose` 测试完整的链路。 +`docker-compose.yml`示例: + +```yml +version: "3.7" + +services: + tdengine: + image: tdengine/tdengine + environment: + TAOS_FQDN: tdengine + volumes: + - taosdata:/var/lib/taos + taoskeeper: + build: ./ + depends_on: + - tdengine + environment: + TDENGINE_HOST: tdengine + TDENGINE_PORT: 6041 + volumes: + - ./config/taoskeeper.toml:/etc/taos/taoskeeper.toml + ports: + - 6043:6043 + prometheus: + image: prom/prometheus + volumes: + - ./prometheus/:/etc/prometheus/ + ports: + - 9090:9090 +volumes: + taosdata: +``` + +启动: + +```sh +docker-compose up -d +``` + +现在通过访问 来查询结果。访问[simple dashboard](https://grafana.com/grafana/dashboards/15164) 来查看TaosKeeper + Prometheus + Grafana 监控 TDengine 的快速启动实例。 + +### Telegraf + +如果使用 telegraf 来收集各个指标,仅需要在配置中增加: + +```toml +[[inputs.prometheus]] +## An array of urls to scrape metrics from. +urls = ["http://taoskeeper:6043/metrics"] +``` + +可以通过 `docker-compose` 来测试 + +```sh +docker-compose -f docker-compose.yml -f telegraf.yml up -d telegraf taoskeeper +``` + +由于可以在 `telegraf.conf` 设置日志为标准输出: + +```toml +[[outputs.file]] +files = ["stdout"] +``` + +所以你可以通过 `docker-compose logs` 在标准输出中追踪 TDengine 各项指标。 + +```sh +docker-compose -f docker-compose.yml -f telegraf.yml logs -f telegraf +``` + +### Zabbix + +1. 导入 zabbix 临时文件 `zbx_taos_keeper_templates.xml`。 +2. 使用 `TDengine` 模板来创建主机,修改宏 `{$TAOSKEEPER_HOST}` 和 `{$COLLECTION_INTERVAL}`。 +3. 等待并查看到自动创建的条目。 + +### 常见问题 + +* 启动报错,显示connection refused + + **解析**:taosKeeper 依赖 restful 接口查询数据,请检查 taosAdapter 是否正常运行或 taoskeeper.toml 中 taosAdapter 地址是否正确。 + +* taosKeeper 监控不同 TDengine 显示的检测指标数目不一致? + + **解析**:如果 TDengine 中未创建某项指标,taoskeeper 不能获取对应的检测结果。 + +* 不能接收到 TDengine 的监控日志。 + + **解析**: 修改 `/etc/taos/taos.cfg` 文件并增加如下参数: + + ```cfg + monitor 1 // 启用monitor + monitorInterval 30 // 发送间隔 (s) + monitorFqdn localhost // 接收消息的FQDN,默认为空 + monitorPort 6043 // 接收消息的端口号 + monitorMaxLogs 100 // 每个监控间隔缓存的最大日志数量 + ``` diff --git a/tools/keeper/README.md b/tools/keeper/README.md new file mode 100644 index 000000000000..18e351f1603f --- /dev/null +++ b/tools/keeper/README.md @@ -0,0 +1,273 @@ +# TaosKeeper + +TDengine Metrics Exporter for Kinds of Collectors, you can obtain the running status of TDengine by performing several simple configurations. + +This tool uses TDengine RESTful API, so you could just build it without TDengine client. + +## Build + +### Get the source codes + +```sh +git clone https://github.com/taosdata/TDengine +cd TDengine/tools/keeper +``` + +### compile + +```sh +go mod tidy +go build +``` + +## Install + +If you build the tool by your self, just copy the `taoskeeper` binary to your `PATH`. + +```sh +sudo install taoskeeper /usr/bin/ +``` + +## Start + +Before start, you should configure some options like database ip, port or the prefix and others for exported metrics. + +in `/etc/taos/taoskeeper.toml`. + +```toml +# Start with debug middleware for gin +debug = false + +# Listen port, default is 6043 +port = 6043 + +# log level +loglevel = "info" + +# go pool size +gopoolsize = 50000 + +# interval for TDengine metrics +RotationInterval = "15s" + +[tdengine] +host = "127.0.0.1" +port = 6041 +username = "root" +password = "taosdata" + +# list of taosAdapter that need to be monitored +[taosAdapter] +address = ["127.0.0.1:6041"] + +[metrics] +# metrics prefix in metrics names. +prefix = "taos" + +# database for storing metrics data +database = "log" + +# export some tables that are not super table +tables = [] + +[environment] +# Whether running in cgroup. +incgroup = false +``` + +Now you could run the tool: + +```sh +taoskeeper +``` + +If you use `systemd`, copy the `taoskeeper.service` to `/lib/systemd/system/` and start the service. + +```sh +sudo cp taoskeeper.service /lib/systemd/system/ +sudo systemctl daemon-reload +sudo systemctl start taoskeeper +``` + +To start taoskeeper whenever os rebooted, you should enable the systemd service: + +```sh +sudo systemctl enable taoskeeper +``` + +So if use `systemd`, you'd better install it with these lines all-in-one: + +```sh +go mod tidy +go build +sudo install taoskeeper /usr/bin/ +sudo cp taoskeeper.service /lib/systemd/system/ +sudo systemctl daemon-reload +sudo systemctl start taoskeeper +sudo systemctl enable taoskeeper +``` + +## Docker + +Here is an example to show how to build this tool in docker: + +Before building, you should configure `./config/taoskeeper.toml` with proper parameters and edit Dockerfile. Take following as example. + +```dockerfile +FROM golang:1.18.2 as builder + +WORKDIR /usr/src/taoskeeper +COPY ./ /usr/src/taoskeeper/ +ENV GO111MODULE=on \ + GOPROXY=https://goproxy.cn,direct +RUN go mod tidy && go build + +FROM alpine:3 +RUN mkdir -p /etc/taos +COPY --from=builder /usr/src/taoskeeper/taoskeeper /usr/bin/ +COPY ./config/taoskeeper.toml /etc/taos/taoskeeper.toml +EXPOSE 6043 +CMD ["taoskeeper"] +``` + +If you already have taosKeeper binary file, you can build this tool like: + +```dockerfile +FROM ubuntu:18.04 +RUN mkdir -p /etc/taos +COPY ./taoskeeper /usr/bin/ +COPY ./taoskeeper.toml /etc/taos/taoskeeper.toml +EXPOSE 6043 +CMD ["taoskeeper"] +``` + +## Usage (**Enterprise Edition**) + +### Prometheus (by scrape) + +It's now act as a prometheus exporter like `node-exporter`. + +Here's how to add this in scrape configs of `/etc/prometheus/prometheus.yml`: + +```yml +global: + scrape_interval: 5s + +scrape_configs: + - job_name: "taoskeeper" + static_configs: + - targets: [ "taoskeeper:6043" ] +``` + +Now PromQL query will show the right result, for example, to show disk used percent in an specific host with FQDN regex +match expression: + +```promql +taos_dn_disk_used / taos_dn_disk_total {fqdn=~ "tdengine.*"} +``` + +You can use `docker-compose` with the current `docker-compose.yml` to test the whole stack. + +Here is the `docker-compose.yml`: + +```yml +version: "3.7" + +services: + tdengine: + image: tdengine/tdengine + environment: + TAOS_FQDN: tdengine + volumes: + - taosdata:/var/lib/taos + taoskeeper: + build: ./ + depends_on: + - tdengine + environment: + TDENGINE_HOST: tdengine + TDENGINE_PORT: 6041 + volumes: + - ./config/taoskeeper.toml:/etc/taos/taoskeeper.toml + ports: + - 6043:6043 + prometheus: + image: prom/prometheus + volumes: + - ./prometheus/:/etc/prometheus/ + ports: + - 9090:9090 +volumes: + taosdata: + +``` + +Start the stack: + +```sh +docker-compose up -d +``` + +Now you point to (if you have not started a prometheus server by yourself) and query. + +For a quick demo with TaosKeeper + Prometheus + Grafana, we provide +a [simple dashboard](https://grafana.com/grafana/dashboards/15164) to monitor TDengine. + +### Telegraf + +If you are using telegraf to collect metrics, just add inputs like this: + +```toml +[[inputs.prometheus]] + ## An array of urls to scrape metrics from. + urls = ["http://taoskeeper:6043/metrics"] +``` + +You can test it with `docker-compose`: + +```sh +docker-compose -f docker-compose.yml -f telegraf.yml up -d telegraf taoskeeper +``` + +Since we have set an stdout file output in `telegraf.conf`: + +```toml +[[outputs.file]] + files = ["stdout"] +``` + +So you can track with TDengine metrics in standard output with `docker-compose logs`: + +```sh +docker-compose -f docker-compose.yml -f telegraf.yml logs -f telegraf +``` + +### Zabbix + +1. Import the zabbix template file `zbx_taos_keeper_templates.xml`. +2. Use the template `TDengine` to create the host and modify the macros `{$TAOSKEEPER_HOST}` + and `{$COLLECTION_INTERVAL}`. +3. Waiting for monitoring items to be created automatically. + +### FAQ + +* Error occurred: Connection refused, while taosKeeper was starting + + **Answer**: taoskeeper relies on restful interfaces to query data. Check whether the taosAdapter is running or whether + the taosAdapter address in taoskeeper.toml is correct. + +* Why detection metrics displayed by different TDengine's inconsistent with taoskeeper monitoring? + + **Answer**: If a metric is not created in TDengine, taoskeeper cannot get the corresponding test results. + +* Cannot receive log from TDengine server. + + **Answer**: Modify `/etc/taos/taos.cfg` file and add parameters like: + + ```cfg + monitor 1 // start monitor + monitorInterval 30 // send log interval (s) + monitorFqdn localhost + monitorPort 6043 // taosKeeper port + monitorMaxLogs 100 + ``` diff --git a/tools/keeper/api/adapter2.go b/tools/keeper/api/adapter2.go new file mode 100644 index 000000000000..645b9a176b5d --- /dev/null +++ b/tools/keeper/api/adapter2.go @@ -0,0 +1,260 @@ +package api + +import ( + "bytes" + "context" + "crypto/md5" + "encoding/hex" + "encoding/json" + "fmt" + "net/http" + "time" + + "github.com/gin-gonic/gin" + "github.com/sirupsen/logrus" + "github.com/taosdata/taoskeeper/db" + "github.com/taosdata/taoskeeper/infrastructure/config" + "github.com/taosdata/taoskeeper/infrastructure/log" + "github.com/taosdata/taoskeeper/util" +) + +var adapterLog = log.GetLogger("ADP") + +type adapterReqType int + +const ( + rest adapterReqType = iota // 0 - rest + ws // 1 - ws +) + +type Adapter struct { + username string + password string + host string + port int + usessl bool + conn *db.Connector + db string + dbOptions map[string]interface{} +} + +func NewAdapter(c *config.Config) *Adapter { + return &Adapter{ + username: c.TDengine.Username, + password: c.TDengine.Password, + host: c.TDengine.Host, + port: c.TDengine.Port, + usessl: c.TDengine.Usessl, + db: c.Metrics.Database.Name, + dbOptions: c.Metrics.Database.Options, + } +} + +func (a *Adapter) Init(c gin.IRouter) error { + if err := a.createDatabase(); err != nil { + return fmt.Errorf("create database error:%s", err) + } + if err := a.initConnect(); err != nil { + return fmt.Errorf("init db connect error:%s", err) + } + if err := a.createTable(); err != nil { + return fmt.Errorf("create table error:%s", err) + } + c.POST("/adapter_report", a.handleFunc()) + return nil +} + +func (a *Adapter) handleFunc() gin.HandlerFunc { + return func(c *gin.Context) { + qid := util.GetQid(c.GetHeader("X-QID")) + + adapterLog := adapterLog.WithFields( + logrus.Fields{config.ReqIDKey: qid}, + ) + + if a.conn == nil { + adapterLog.Error("no connection") + c.JSON(http.StatusInternalServerError, gin.H{"error": "no connection"}) + return + } + + data, err := c.GetRawData() + if err != nil { + adapterLog.Errorf("get adapter report data error, msg:%s", err) + c.JSON(http.StatusBadRequest, gin.H{"error": fmt.Sprintf("get adapter report data error. %s", err)}) + return + } + if adapterLog.Logger.IsLevelEnabled(logrus.TraceLevel) { + adapterLog.Tracef("received adapter report data:%s", string(data)) + } + + var report AdapterReport + if err = json.Unmarshal(data, &report); err != nil { + adapterLog.Errorf("parse adapter report data error, data:%s, error:%s", string(data), err) + c.JSON(http.StatusBadRequest, gin.H{"error": fmt.Sprintf("parse adapter report data error: %s", err)}) + return + } + sql := a.parseSql(report) + adapterLog.Debugf("adapter report sql:%s", sql) + + if _, err = a.conn.Exec(context.Background(), sql, qid); err != nil { + adapterLog.Errorf("adapter report error, msg:%s", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()}) + return + } + c.JSON(http.StatusOK, gin.H{}) + } +} + +func (a *Adapter) initConnect() error { + conn, err := db.NewConnectorWithDb(a.username, a.password, a.host, a.port, a.db, a.usessl) + if err != nil { + adapterLog.Dup().Errorf("init db connect error, msg:%s", err) + return err + } + a.conn = conn + return nil +} + +func (a *Adapter) parseSql(report AdapterReport) string { + // reqType: 0: rest, 1: websocket + restTbName := a.tableName(report.Endpoint, rest) + wsTbName := a.tableName(report.Endpoint, ws) + ts := time.Unix(report.Timestamp, 0).Format(time.RFC3339) + metric := report.Metric + return fmt.Sprintf("insert into %s using adapter_requests tags ('%s', %d) "+ + "values('%s', %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d) "+ + "%s using adapter_requests tags ('%s', %d) "+ + "values('%s', %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d)", + restTbName, report.Endpoint, rest, ts, metric.RestTotal, metric.RestQuery, metric.RestWrite, metric.RestOther, + metric.RestInProcess, metric.RestSuccess, metric.RestFail, metric.RestQuerySuccess, metric.RestQueryFail, + metric.RestWriteSuccess, metric.RestWriteFail, metric.RestOtherSuccess, metric.RestOtherFail, + metric.RestQueryInProcess, metric.RestWriteInProcess, + wsTbName, report.Endpoint, ws, ts, metric.WSTotal, + metric.WSQuery, metric.WSWrite, metric.WSOther, metric.WSInProcess, metric.WSSuccess, metric.WSFail, + metric.WSQuerySuccess, metric.WSQueryFail, metric.WSWriteSuccess, metric.WSWriteFail, metric.WSOtherSuccess, + metric.WSOtherFail, metric.WSQueryInProcess, metric.WSWriteInProcess) +} + +func (a *Adapter) tableName(endpoint string, reqType adapterReqType) string { + var tbname string + if reqType == rest { + tbname = fmt.Sprintf("adapter_req_%s_%s", endpoint, "rest") + } else { + tbname = fmt.Sprintf("adapter_req_%s_%s", endpoint, "ws") + } + + if len(tbname) <= util.MAX_TABLE_NAME_LEN { + return util.ToValidTableName(tbname) + } else { + sum := md5.Sum([]byte(fmt.Sprintf("%s%d", endpoint, reqType))) + return fmt.Sprintf("adapter_req_%s", hex.EncodeToString(sum[:])) + } +} + +func (a *Adapter) createDatabase() error { + qid := util.GetQidOwn() + + adapterLog := adapterLog.WithFields( + logrus.Fields{config.ReqIDKey: qid}, + ) + + conn, err := db.NewConnector(a.username, a.password, a.host, a.port, a.usessl) + if err != nil { + return fmt.Errorf("connect to database error, msg:%s", err) + } + defer func() { _ = conn.Close() }() + sql := a.createDBSql() + adapterLog.Infof("create database, sql:%s", sql) + _, err = conn.Exec(context.Background(), sql, util.GetQidOwn()) + if err != nil { + adapterLog.Errorf("create database error, msg:%s", err) + return err + } + + return err +} + +func (a *Adapter) createDBSql() string { + var buf bytes.Buffer + buf.WriteString(fmt.Sprintf("create database if not exists %s ", a.db)) + + for k, v := range a.dbOptions { + buf.WriteString(k) + switch v := v.(type) { + case string: + buf.WriteString(fmt.Sprintf(" '%s'", v)) + default: + buf.WriteString(fmt.Sprintf(" %v", v)) + } + buf.WriteString(" ") + } + + return buf.String() +} + +var adapterTableSql = "create stable if not exists `adapter_requests` (" + + "`ts` timestamp, " + + "`total` int unsigned, " + + "`query` int unsigned, " + + "`write` int unsigned, " + + "`other` int unsigned, " + + "`in_process` int unsigned, " + + "`success` int unsigned, " + + "`fail` int unsigned, " + + "`query_success` int unsigned, " + + "`query_fail` int unsigned, " + + "`write_success` int unsigned, " + + "`write_fail` int unsigned, " + + "`other_success` int unsigned, " + + "`other_fail` int unsigned, " + + "`query_in_process` int unsigned, " + + "`write_in_process` int unsigned ) " + + "tags (`endpoint` varchar(32), `req_type` tinyint unsigned )" + +func (a *Adapter) createTable() error { + if a.conn == nil { + return errNoConnection + } + _, err := a.conn.Exec(context.Background(), adapterTableSql, util.GetQidOwn()) + return err +} + +type AdapterReport struct { + Timestamp int64 `json:"ts"` + Metric AdapterMetrics `json:"metrics"` + Endpoint string `json:"endpoint"` +} + +type AdapterMetrics struct { + RestTotal int `json:"rest_total"` + RestQuery int `json:"rest_query"` + RestWrite int `json:"rest_write"` + RestOther int `json:"rest_other"` + RestInProcess int `json:"rest_in_process"` + RestSuccess int `json:"rest_success"` + RestFail int `json:"rest_fail"` + RestQuerySuccess int `json:"rest_query_success"` + RestQueryFail int `json:"rest_query_fail"` + RestWriteSuccess int `json:"rest_write_success"` + RestWriteFail int `json:"rest_write_fail"` + RestOtherSuccess int `json:"rest_other_success"` + RestOtherFail int `json:"rest_other_fail"` + RestQueryInProcess int `json:"rest_query_in_process"` + RestWriteInProcess int `json:"rest_write_in_process"` + WSTotal int `json:"ws_total"` + WSQuery int `json:"ws_query"` + WSWrite int `json:"ws_write"` + WSOther int `json:"ws_other"` + WSInProcess int `json:"ws_in_process"` + WSSuccess int `json:"ws_success"` + WSFail int `json:"ws_fail"` + WSQuerySuccess int `json:"ws_query_success"` + WSQueryFail int `json:"ws_query_fail"` + WSWriteSuccess int `json:"ws_write_success"` + WSWriteFail int `json:"ws_write_fail"` + WSOtherSuccess int `json:"ws_other_success"` + WSOtherFail int `json:"ws_other_fail"` + WSQueryInProcess int `json:"ws_query_in_process"` + WSWriteInProcess int `json:"ws_write_in_process"` +} diff --git a/tools/keeper/api/adapter2_test.go b/tools/keeper/api/adapter2_test.go new file mode 100644 index 000000000000..e6fd263c43fa --- /dev/null +++ b/tools/keeper/api/adapter2_test.go @@ -0,0 +1,98 @@ +package api + +import ( + "context" + "net/http" + "net/http/httptest" + "strings" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/taosdata/taoskeeper/db" + "github.com/taosdata/taoskeeper/infrastructure/config" + "github.com/taosdata/taoskeeper/util" +) + +func TestAdapter2(t *testing.T) { + c := &config.Config{ + InstanceID: 64, + Port: 6043, + TDengine: config.TDengineRestful{ + Host: "127.0.0.1", + Port: 6041, + Username: "root", + Password: "taosdata", + Usessl: false, + }, + Metrics: config.MetricsConfig{ + Database: config.Database{ + Name: "adapter_report_test", + Options: map[string]interface{}{}, + }, + }, + } + a := NewAdapter(c) + err := a.Init(router) + assert.NoError(t, err) + + w := httptest.NewRecorder() + body := strings.NewReader(" {\"ts\": 1696928323, \"metrics\": {\"rest_total\": 10, \"rest_query\": 2, " + + "\"rest_write\": 5, \"rest_other\": 3, \"rest_in_process\": 1, \"rest_fail\": 5, \"rest_success\": 3, " + + "\"rest_query_success\": 1, \"rest_query_fail\": 2, \"rest_write_success\": 2, \"rest_write_fail\": 3, " + + "\"rest_other_success\": 1, \"rest_other_fail\": 2, \"rest_query_in_process\": 1, \"rest_write_in_process\": 2, " + + "\"ws_total\": 10, \"ws_query\": 2, \"ws_write\": 3, \"ws_other\": 5, \"ws_in_process\": 1, \"ws_success\": 3, " + + "\"ws_fail\": 3, \"ws_query_success\": 1, \"ws_query_fail\": 1, \"ws_write_success\": 2, \"ws_write_fail\": 2, " + + "\"ws_other_success\": 1, \"ws_other_fail\": 2, \"ws_query_in_process\": 1, \"ws_write_in_process\": 2 }, " + + "\"endpoint\": \"adapter-1:6041\"}") + req, _ := http.NewRequest(http.MethodPost, "/adapter_report", body) + req.Header.Set("X-QID", "0x1234567890ABCD00") + router.ServeHTTP(w, req) + assert.Equal(t, 200, w.Code) + + conn, err := db.NewConnectorWithDb(c.TDengine.Username, c.TDengine.Password, c.TDengine.Host, c.TDengine.Port, c.Metrics.Database.Name, c.TDengine.Usessl) + defer func() { + _, _ = conn.Query(context.Background(), "drop database if exists adapter_report_test", util.GetQidOwn()) + }() + + assert.NoError(t, err) + data, err := conn.Query(context.Background(), "select * from adapter_report_test.adapter_requests where req_type=0", util.GetQidOwn()) + + assert.NoError(t, err) + assert.Equal(t, 1, len(data.Data)) + assert.Equal(t, uint32(10), data.Data[0][1]) + assert.Equal(t, uint32(2), data.Data[0][2]) + assert.Equal(t, uint32(5), data.Data[0][3]) + assert.Equal(t, uint32(3), data.Data[0][4]) + assert.Equal(t, uint32(1), data.Data[0][5]) + assert.Equal(t, uint32(3), data.Data[0][6]) + assert.Equal(t, uint32(5), data.Data[0][7]) + assert.Equal(t, uint32(1), data.Data[0][8]) + assert.Equal(t, uint32(2), data.Data[0][9]) + assert.Equal(t, uint32(2), data.Data[0][10]) + assert.Equal(t, uint32(3), data.Data[0][11]) + assert.Equal(t, uint32(1), data.Data[0][12]) + assert.Equal(t, uint32(2), data.Data[0][13]) + assert.Equal(t, uint32(1), data.Data[0][14]) + assert.Equal(t, uint32(2), data.Data[0][15]) + + data, err = conn.Query(context.Background(), "select * from adapter_report_test.adapter_requests where req_type=1", util.GetQidOwn()) + assert.NoError(t, err) + assert.Equal(t, 1, len(data.Data)) + assert.Equal(t, uint32(10), data.Data[0][1]) + assert.Equal(t, uint32(2), data.Data[0][2]) + assert.Equal(t, uint32(3), data.Data[0][3]) + assert.Equal(t, uint32(5), data.Data[0][4]) + assert.Equal(t, uint32(1), data.Data[0][5]) + assert.Equal(t, uint32(3), data.Data[0][6]) + assert.Equal(t, uint32(3), data.Data[0][7]) + assert.Equal(t, uint32(1), data.Data[0][8]) + assert.Equal(t, uint32(1), data.Data[0][9]) + assert.Equal(t, uint32(2), data.Data[0][10]) + assert.Equal(t, uint32(2), data.Data[0][11]) + assert.Equal(t, uint32(1), data.Data[0][12]) + assert.Equal(t, uint32(2), data.Data[0][13]) + assert.Equal(t, uint32(1), data.Data[0][14]) + assert.Equal(t, uint32(2), data.Data[0][15]) + + conn.Exec(context.Background(), "drop database "+c.Metrics.Database.Name, util.GetQidOwn()) +} diff --git a/tools/keeper/api/audit.go b/tools/keeper/api/audit.go new file mode 100644 index 000000000000..fd9fc4f66702 --- /dev/null +++ b/tools/keeper/api/audit.go @@ -0,0 +1,336 @@ +package api + +import ( + "bytes" + "context" + "encoding/json" + "errors" + "fmt" + "net/http" + "regexp" + "strconv" + "strings" + + "github.com/gin-gonic/gin" + "github.com/sirupsen/logrus" + "github.com/taosdata/taoskeeper/db" + "github.com/taosdata/taoskeeper/infrastructure/config" + "github.com/taosdata/taoskeeper/infrastructure/log" + "github.com/taosdata/taoskeeper/util" +) + +var auditLogger = log.GetLogger("AUD") + +const MAX_DETAIL_LEN = 50000 + +type Audit struct { + username string + password string + host string + port int + usessl bool + conn *db.Connector + db string + dbOptions map[string]interface{} +} + +type AuditInfo struct { + Timestamp string `json:"timestamp"` + ClusterID string `json:"cluster_id"` + User string `json:"user"` + Operation string `json:"operation"` + Db string `json:"db"` + Resource string `json:"resource"` + ClientAdd string `json:"client_add"` // client address + Details string `json:"details"` +} + +type AuditArrayInfo struct { + Records []AuditInfo `json:"records"` +} + +type AuditInfoOld struct { + Timestamp int64 `json:"timestamp"` + ClusterID string `json:"cluster_id"` + User string `json:"user"` + Operation string `json:"operation"` + Db string `json:"db"` + Resource string `json:"resource"` + ClientAdd string `json:"client_add"` // client address + Details string `json:"details"` +} + +func NewAudit(c *config.Config) (*Audit, error) { + a := Audit{ + username: c.TDengine.Username, + password: c.TDengine.Password, + host: c.TDengine.Host, + port: c.TDengine.Port, + usessl: c.TDengine.Usessl, + db: c.Audit.Database.Name, + dbOptions: c.Audit.Database.Options, + } + if a.db == "" { + a.db = "audit" + } + return &a, nil +} + +func (a *Audit) Init(c gin.IRouter) error { + if err := a.createDatabase(); err != nil { + return fmt.Errorf("create database error, msg:%s", err) + } + if err := a.initConnect(); err != nil { + return fmt.Errorf("init db connect error, msg:%s", err) + } + if err := a.createSTables(); err != nil { + return fmt.Errorf("create stable error, msg:%s", err) + } + c.POST("/audit", a.handleFunc()) + c.POST("/audit_v2", a.handleFunc()) + c.POST("/audit-batch", a.handleBatchFunc()) + return nil +} + +func (a *Audit) handleBatchFunc() gin.HandlerFunc { + return func(c *gin.Context) { + qid := util.GetQid(c.GetHeader("X-QID")) + + auditLogger := auditLogger.WithFields( + logrus.Fields{config.ReqIDKey: qid}, + ) + + if a.conn == nil { + auditLogger.Error("no connection") + c.JSON(http.StatusInternalServerError, gin.H{"error": "no connection"}) + return + } + + data, err := c.GetRawData() + if err != nil { + auditLogger.Errorf("get audit data error, msg:%s", err) + c.JSON(http.StatusBadRequest, gin.H{"error": fmt.Sprintf("get audit data error. %s", err)}) + return + } + + if auditLogger.Logger.IsLevelEnabled(logrus.TraceLevel) { + auditLogger.Tracef("receive audit request, data:%s", string(data)) + } + var auditArray AuditArrayInfo + + if err := json.Unmarshal(data, &auditArray); err != nil { + auditLogger.Errorf("parse audit data error, data:%s, error:%s", string(data), err) + c.JSON(http.StatusBadRequest, gin.H{"error": fmt.Sprintf("parse audit data error: %s", err)}) + return + } + + if len(auditArray.Records) == 0 { + if auditLogger.Logger.IsLevelEnabled(logrus.TraceLevel) { + auditLogger.Trace("handle request successfully (no records)") + } + c.JSON(http.StatusOK, gin.H{}) + return + } + + err = handleBatchRecord(auditArray.Records, a.conn, qid) + + if err != nil { + auditLogger.Errorf("process records error, error:%s", err) + c.JSON(http.StatusBadRequest, gin.H{"error": fmt.Sprintf("process records error. %s", err)}) + return + } + + c.JSON(http.StatusOK, gin.H{}) + } +} + +func (a *Audit) handleFunc() gin.HandlerFunc { + return func(c *gin.Context) { + qid := util.GetQid(c.GetHeader("X-QID")) + + auditLogger := auditLogger.WithFields( + logrus.Fields{config.ReqIDKey: qid}, + ) + + if a.conn == nil { + auditLogger.Error("no connection") + c.JSON(http.StatusInternalServerError, gin.H{"error": "no connection"}) + return + } + + data, err := c.GetRawData() + if err != nil { + auditLogger.Errorf("get audit data error, msg:%s", err) + c.JSON(http.StatusBadRequest, gin.H{"error": fmt.Sprintf("get audit data error. %s", err)}) + return + } + if auditLogger.Logger.IsLevelEnabled(logrus.TraceLevel) { + auditLogger.Tracef("receive audit request, data:%s", string(data)) + } + sql := "" + + isStrTime, _ := regexp.MatchString(`"timestamp"\s*:\s*"[^"]*"`, string(data)) + if isStrTime { + var audit AuditInfo + if err := json.Unmarshal(data, &audit); err != nil { + auditLogger.Errorf("parse audit data error, data:%s, error:%s", string(data), err) + c.JSON(http.StatusBadRequest, gin.H{"error": fmt.Sprintf("parse audit data error: %s", err)}) + return + } + + sql = parseSql(audit) + } else { + var audit AuditInfoOld + if err := json.Unmarshal(data, &audit); err != nil { + auditLogger.Errorf("parse old audit error, data:%s, error:%s", string(data), err) + c.JSON(http.StatusBadRequest, gin.H{"error": fmt.Sprintf("parse audit data error: %s", err)}) + return + } + + sql = parseSqlOld(audit) + } + + if _, err = a.conn.Exec(context.Background(), sql, qid); err != nil { + auditLogger.Errorf("save audit data error, sql:%s, error:%s", sql, err) + c.JSON(http.StatusInternalServerError, gin.H{"error": fmt.Sprintf("save audit data error: %s", err)}) + return + } + c.JSON(http.StatusOK, gin.H{}) + } +} + +func handleDetails(details string) string { + if strings.Contains(details, "'") { + details = strings.ReplaceAll(details, "'", "\\'") + } + if strings.Contains(details, "\"") { + details = strings.ReplaceAll(details, "\"", "\\\"") + } + if len(details) > MAX_DETAIL_LEN { + details = details[:MAX_DETAIL_LEN] + } + return details +} + +func parseSql(audit AuditInfo) string { + details := handleDetails(audit.Details) + + return fmt.Sprintf( + "insert into %s using operations tags ('%s') values (%s, '%s', '%s', '%s', '%s', '%s', '%s') ", + getTableName(audit), audit.ClusterID, audit.Timestamp, audit.User, audit.Operation, audit.Db, audit.Resource, audit.ClientAdd, details) +} + +func parseSqlOld(audit AuditInfoOld) string { + details := handleDetails(audit.Details) + + return fmt.Sprintf( + "insert into %s using operations tags ('%s') values (%s, '%s', '%s', '%s', '%s', '%s', '%s') ", + getTableNameOld(audit), audit.ClusterID, strconv.FormatInt(audit.Timestamp, 10)+"000000", audit.User, audit.Operation, audit.Db, audit.Resource, audit.ClientAdd, details) +} + +func handleBatchRecord(auditArray []AuditInfo, conn *db.Connector, qid uint64) error { + var builder strings.Builder + var head = fmt.Sprintf( + "insert into %s using operations tags ('%s') values", + getTableName(auditArray[0]), auditArray[0].ClusterID) + + builder.WriteString(head) + var qid_counter uint8 = 0 + for _, audit := range auditArray { + + details := handleDetails(audit.Details) + valuesStr := fmt.Sprintf( + "(%s, '%s', '%s', '%s', '%s', '%s', '%s') ", + audit.Timestamp, audit.User, audit.Operation, audit.Db, audit.Resource, audit.ClientAdd, details) + + if (builder.Len() + len(valuesStr)) > MAX_SQL_LEN { + sql := builder.String() + if _, err := conn.Exec(context.Background(), sql, qid|uint64((qid_counter%255))); err != nil { + return err + } + builder.Reset() + builder.WriteString(head) + } + builder.WriteString(valuesStr) + qid_counter++ + } + + if builder.Len() > len(head) { + sql := builder.String() + if _, err := conn.Exec(context.Background(), sql, qid|uint64((qid_counter%255))); err != nil { + return err + } + } + + return nil +} + +func getTableName(audit AuditInfo) string { + return fmt.Sprintf("t_operations_%s", audit.ClusterID) +} + +func getTableNameOld(audit AuditInfoOld) string { + return fmt.Sprintf("t_operations_%s", audit.ClusterID) +} + +func (a *Audit) initConnect() error { + conn, err := db.NewConnectorWithDb(a.username, a.password, a.host, a.port, a.db, a.usessl) + if err != nil { + auditLogger.Errorf("init db connect error, msg:%s", err) + return err + } + a.conn = conn + return nil +} + +func (a *Audit) createDatabase() error { + conn, err := db.NewConnector(a.username, a.password, a.host, a.port, a.usessl) + if err != nil { + return fmt.Errorf("connect to database error, msg:%s", err) + } + defer func() { _ = conn.Close() }() + sql := a.createDBSql() + auditLogger.Infof("create database, sql:%s", sql) + _, err = conn.Exec(context.Background(), sql, util.GetQidOwn()) + if err != nil { + auditLogger.Errorf("create database error, msg:%s", err) + return err + } + return err +} + +var errNoConnection = errors.New("no connection") + +func (a *Audit) createDBSql() string { + var buf bytes.Buffer + buf.WriteString(fmt.Sprintf("create database if not exists %s precision 'ns' ", a.db)) + + for k, v := range a.dbOptions { + buf.WriteString(k) + switch v := v.(type) { + case string: + buf.WriteString(fmt.Sprintf(" '%s'", v)) + default: + buf.WriteString(fmt.Sprintf(" %v", v)) + } + buf.WriteString(" ") + } + + return buf.String() +} + +func (a *Audit) createSTables() error { + var createTableSql = "create stable if not exists operations " + + "(ts timestamp, user_name varchar(25), operation varchar(20), db varchar(65), resource varchar(193), client_address varchar(25), details varchar(50000)) " + + "tags (cluster_id varchar(64))" + + if a.conn == nil { + return errNoConnection + } + _, err := a.conn.Exec(context.Background(), createTableSql, util.GetQidOwn()) + if err != nil { + auditLogger.Errorf("## create stable error, msg:%s", err) + return err + } + return nil +} diff --git a/tools/keeper/api/audit_test.go b/tools/keeper/api/audit_test.go new file mode 100644 index 000000000000..99beae7a5441 --- /dev/null +++ b/tools/keeper/api/audit_test.go @@ -0,0 +1,153 @@ +package api + +import ( + "context" + "fmt" + "net/http" + "net/http/httptest" + "strings" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/taosdata/taoskeeper/db" + "github.com/taosdata/taoskeeper/infrastructure/config" + "github.com/taosdata/taoskeeper/util" +) + +func TestAudit(t *testing.T) { + cfg := util.GetCfg() + cfg.Audit = config.AuditConfig{ + Database: config.Database{ + Name: "keepter_test_audit", + }, + Enable: true, + } + + a, err := NewAudit(cfg) + assert.NoError(t, err) + err = a.Init(router) + assert.NoError(t, err) + + longDetails := strings.Repeat("0123456789", 5000) + + cases := []struct { + name string + ts int64 + detail string + data string + expect string + }{ + { + name: "1", + ts: 1699839716440000000, + data: `{"timestamp": "1699839716440000000", "cluster_id": "cluster_id", "user": "user", "operation": "operation", "db":"dbnamea", "resource":"resourcenamea", "client_add": "localhost:30000", "details": "detail"}`, + expect: "detail", + }, + { + name: "2", + ts: 1699839716441000000, + data: `{"timestamp": "1699839716441000000", "cluster_id": "cluster_id", "user": "user", "operation": "operation", "db":"dbnamea", "resource":"resourcenamea", "client_add": "localhost:30000", "details": "` + longDetails + `"}`, + expect: longDetails[:50000], + }, + { + name: "3", + ts: 1699839716442000000, + data: "{\"timestamp\": \"1699839716442000000\", \"cluster_id\": \"cluster_id\", \"user\": \"user\", \"operation\": \"operation\", \"db\":\"dbnameb\", \"resource\":\"resourcenameb\", \"client_add\": \"localhost:30000\", \"details\": \"create database `meter` buffer 32 cachemodel 'none' duration 50d keep 3650d single_stable 0 wal_retention_period 3600 precision 'ms'\"}", + expect: "create database `meter` buffer 32 cachemodel 'none' duration 50d keep 3650d single_stable 0 wal_retention_period 3600 precision 'ms'", + }, + } + + cases2 := []struct { + name string + ts int64 + detail string + data string + expect string + }{ + { + name: "1", + ts: 1699839716445000000, + data: `{"timestamp":1699839716445, "cluster_id": "cluster_id", "user": "user", "operation": "operation", "db":"dbnamea", "resource":"resourcenamea", "client_add": "localhost:30000", "details": "details"}`, + expect: "details", + }, + } + conn, err := db.NewConnectorWithDb(cfg.TDengine.Username, cfg.TDengine.Password, cfg.TDengine.Host, cfg.TDengine.Port, cfg.Audit.Database.Name, cfg.TDengine.Usessl) + assert.NoError(t, err) + defer func() { + _, _ = conn.Query(context.Background(), fmt.Sprintf("drop database if exists %s", cfg.Audit.Database.Name), util.GetQidOwn()) + }() + + for _, c := range cases { + t.Run(c.name, func(t *testing.T) { + w := httptest.NewRecorder() + body := strings.NewReader(c.data) + req, _ := http.NewRequest(http.MethodPost, "/audit_v2", body) + router.ServeHTTP(w, req) + assert.Equal(t, 200, w.Code) + + data, err := conn.Query(context.Background(), fmt.Sprintf("select ts, details from %s.operations where ts=%d", cfg.Audit.Database.Name, c.ts), util.GetQidOwn()) + assert.NoError(t, err) + assert.Equal(t, 1, len(data.Data)) + assert.Equal(t, c.expect, data.Data[0][1]) + }) + } + + for _, c := range cases2 { + t.Run(c.name, func(t *testing.T) { + w := httptest.NewRecorder() + body := strings.NewReader(c.data) + req, _ := http.NewRequest(http.MethodPost, "/audit", body) + router.ServeHTTP(w, req) + assert.Equal(t, 200, w.Code) + + data, err := conn.Query(context.Background(), fmt.Sprintf("select ts, details from %s.operations where ts=%d", cfg.Audit.Database.Name, c.ts), util.GetQidOwn()) + assert.NoError(t, err) + assert.Equal(t, 1, len(data.Data)) + assert.Equal(t, c.expect, data.Data[0][1]) + }) + } + + for _, c := range cases2 { + t.Run(c.name, func(t *testing.T) { + w := httptest.NewRecorder() + body := strings.NewReader(c.data) + req, _ := http.NewRequest(http.MethodPost, "/audit", body) + router.ServeHTTP(w, req) + assert.Equal(t, 200, w.Code) + + data, err := conn.Query(context.Background(), fmt.Sprintf("select ts, details from %s.operations where ts=%d", cfg.Audit.Database.Name, c.ts), util.GetQidOwn()) + assert.NoError(t, err) + assert.Equal(t, 1, len(data.Data)) + assert.Equal(t, c.expect, data.Data[0][1]) + }) + } + + MAX_SQL_LEN = 300 + // test audit batch + input := `{"records":[{"timestamp":"1702548856940013848","cluster_id":"8468922059162439502","user":"root","operation":"createTable","client_add":"173.50.0.7:45166","db":"test","resource":"","details":"d630302"},{"timestamp":"1702548856939746458","cluster_id":"8468922059162439502","user":"root","operation":"createTable","client_add":"173.50.0.7:45230","db":"test","resource":"","details":"d130277"},{"timestamp":"1702548856939586665","cluster_id":"8468922059162439502","user":"root","operation":"createTable","client_add":"173.50.0.7:50288","db":"test","resource":"","details":"d5268"},{"timestamp":"1702548856939528940","cluster_id":"8468922059162439502","user":"root","operation":"createTable","client_add":"173.50.0.7:50222","db":"test","resource":"","details":"d255282"},{"timestamp":"1702548856939336371","cluster_id":"8468922059162439502","user":"root","operation":"createTable","client_add":"173.50.0.7:45126","db":"test","resource":"","details":"d755297"},{"timestamp":"1702548856939075131","cluster_id":"8468922059162439502","user":"root","operation":"createTable","client_add":"173.50.0.7:45122","db":"test","resource":"","details":"d380325"},{"timestamp":"1702548856938640661","cluster_id":"8468922059162439502","user":"root","operation":"createTable","client_add":"173.50.0.7:45152","db":"test","resource":"","details":"d255281"},{"timestamp":"1702548856938505795","cluster_id":"8468922059162439502","user":"root","operation":"createTable","client_add":"173.50.0.7:45122","db":"test","resource":"","details":"d130276"},{"timestamp":"1702548856938363319","cluster_id":"8468922059162439502","user":"root","operation":"createTable","client_add":"173.50.0.7:45178","db":"test","resource":"","details":"d755296"},{"timestamp":"1702548856938201478","cluster_id":"8468922059162439502","user":"root","operation":"createTable","client_add":"173.50.0.7:45166","db":"test","resource":"","details":"d380324"},{"timestamp":"1702548856937740618","cluster_id":"8468922059162439502","user":"root","operation":"createTable","client_add":"173.50.0.7:50288","db":"test","resource":"","details":"d5266"}]}` + + defer func() { + _, _ = conn.Query(context.Background(), fmt.Sprintf("drop database if exists %s", cfg.Audit.Database.Name), util.GetQidOwn()) + }() + + t.Run("testbatch", func(t *testing.T) { + //test empty array + w1 := httptest.NewRecorder() + body1 := strings.NewReader(`{"records": []}`) + + req1, _ := http.NewRequest(http.MethodPost, "/audit-batch", body1) + router.ServeHTTP(w1, req1) + assert.Equal(t, 200, w1.Code) + + //test 2 items array + w := httptest.NewRecorder() + body := strings.NewReader(input) + req, _ := http.NewRequest(http.MethodPost, "/audit-batch", body) + router.ServeHTTP(w, req) + assert.Equal(t, 200, w.Code) + + data, err := conn.Query(context.Background(), "select ts, details from "+cfg.Audit.Database.Name+".operations where cluster_id='8468922059162439502'", util.GetQidOwn()) + assert.NoError(t, err) + assert.Equal(t, 11, len(data.Data)) + }) +} diff --git a/tools/keeper/api/checkhealth.go b/tools/keeper/api/checkhealth.go new file mode 100644 index 000000000000..c5d5a2d24a8a --- /dev/null +++ b/tools/keeper/api/checkhealth.go @@ -0,0 +1,21 @@ +package api + +import ( + "net/http" + + "github.com/gin-gonic/gin" +) + +func NewCheckHealth(version string) *CheckHealth { + return &CheckHealth{version: version} +} + +type CheckHealth struct { + version string +} + +func (h *CheckHealth) Init(c gin.IRouter) { + c.GET("check_health", func(context *gin.Context) { + context.JSON(http.StatusOK, map[string]string{"version": h.version}) + }) +} diff --git a/tools/keeper/api/common.go b/tools/keeper/api/common.go new file mode 100644 index 000000000000..d02a30eb8b30 --- /dev/null +++ b/tools/keeper/api/common.go @@ -0,0 +1,89 @@ +package api + +import ( + "bytes" + "context" + "fmt" + "time" + + "github.com/sirupsen/logrus" + "github.com/taosdata/taoskeeper/db" + "github.com/taosdata/taoskeeper/infrastructure/config" + "github.com/taosdata/taoskeeper/infrastructure/log" + "github.com/taosdata/taoskeeper/util" +) + +var commonLogger = log.GetLogger("CMN") + +func CreateDatabase(username string, password string, host string, port int, usessl bool, dbname string, databaseOptions map[string]interface{}) { + qid := util.GetQidOwn() + + commonLogger := commonLogger.WithFields( + logrus.Fields{config.ReqIDKey: qid}, + ) + + ctx := context.Background() + + conn, err := db.NewConnector(username, password, host, port, usessl) + if err != nil { + commonLogger.Errorf("connect to adapter error, msg:%s", err) + return + } + + defer closeConn(conn) + + createDBSql := generateCreateDBSql(dbname, databaseOptions) + commonLogger.Warningf("create database sql: %s", createDBSql) + + for i := 0; i < 3; i++ { + if _, err := conn.Exec(ctx, createDBSql, util.GetQidOwn()); err != nil { + commonLogger.Errorf("try %v times: create database %s error, msg:%v", i+1, dbname, err) + time.Sleep(5 * time.Second) + continue + } + return + } + panic(err) +} + +func generateCreateDBSql(dbname string, databaseOptions map[string]interface{}) string { + var buf bytes.Buffer + buf.WriteString("create database if not exists ") + buf.WriteString(dbname) + + for k, v := range databaseOptions { + buf.WriteString(" ") + buf.WriteString(k) + switch v := v.(type) { + case string: + buf.WriteString(fmt.Sprintf(" '%s'", v)) + default: + buf.WriteString(fmt.Sprintf(" %v", v)) + } + buf.WriteString(" ") + } + return buf.String() +} + +func CreatTables(username string, password string, host string, port int, usessl bool, dbname string, createList []string) { + ctx := context.Background() + conn, err := db.NewConnectorWithDb(username, password, host, port, dbname, usessl) + if err != nil { + commonLogger.Errorf("connect to database error, msg:%s", err) + return + } + defer closeConn(conn) + + for _, createSql := range createList { + commonLogger.Infof("execute sql:%s", createSql) + if _, err = conn.Exec(ctx, createSql, util.GetQidOwn()); err != nil { + commonLogger.Errorf("execute sql: %s, error: %s", createSql, err) + } + } +} + +func closeConn(conn *db.Connector) { + if err := conn.Close(); err != nil { + commonLogger.Errorf("close connection error, msg:%s", err) + } +} diff --git a/tools/keeper/api/exporter_test.go b/tools/keeper/api/exporter_test.go new file mode 100644 index 000000000000..f9ef6b169a7a --- /dev/null +++ b/tools/keeper/api/exporter_test.go @@ -0,0 +1,297 @@ +package api + +import ( + "context" + "encoding/json" + "fmt" + "net/http" + "net/http/httptest" + "strings" + "testing" + "time" + + "github.com/gin-gonic/gin" + "github.com/shopspring/decimal" + "github.com/stretchr/testify/assert" + "github.com/taosdata/taoskeeper/cmd" + "github.com/taosdata/taoskeeper/db" + "github.com/taosdata/taoskeeper/infrastructure/config" + "github.com/taosdata/taoskeeper/infrastructure/log" + "github.com/taosdata/taoskeeper/process" + "github.com/taosdata/taoskeeper/util" +) + +var router *gin.Engine +var conf *config.Config +var dbName = "exporter_test" + +func TestMain(m *testing.M) { + conf = config.InitConfig() + log.ConfigLog() + + conf.Metrics.Database.Name = dbName + conn, err := db.NewConnector(conf.TDengine.Username, conf.TDengine.Password, conf.TDengine.Host, conf.TDengine.Port, conf.TDengine.Usessl) + if err != nil { + panic(err) + } + defer conn.Close() + ctx := context.Background() + conn.Query(context.Background(), fmt.Sprintf("drop database if exists %s", conf.Metrics.Database.Name), util.GetQidOwn()) + + if _, err = conn.Exec(ctx, fmt.Sprintf("create database if not exists %s", dbName), util.GetQidOwn()); err != nil { + logger.Errorf("execute sql: %s, error: %s", fmt.Sprintf("create database %s", dbName), err) + } + gin.SetMode(gin.ReleaseMode) + router = gin.New() + reporter := NewReporter(conf) + reporter.Init(router) + + var createList = []string{ + CreateClusterInfoSql, + CreateDnodeSql, + CreateMnodeSql, + CreateDnodeInfoSql, + CreateDataDirSql, + CreateLogDirSql, + CreateTempDirSql, + CreateVgroupsInfoSql, + CreateVnodeRoleSql, + CreateSummarySql, + CreateGrantInfoSql, + CreateKeeperSql, + } + CreatTables(conf.TDengine.Username, conf.TDengine.Password, conf.TDengine.Host, conf.TDengine.Port, conf.TDengine.Usessl, conf.Metrics.Database.Name, createList) + + processor := process.NewProcessor(conf) + node := NewNodeExporter(processor) + node.Init(router) + m.Run() + if _, err = conn.Exec(ctx, fmt.Sprintf("drop database if exists %s", dbName), util.GetQidOwn()); err != nil { + logger.Errorf("execute sql: %s, error: %s", fmt.Sprintf("drop database %s", dbName), err) + } +} + +func TestGetMetrics(t *testing.T) { + w := httptest.NewRecorder() + req, _ := http.NewRequest(http.MethodGet, "/metrics", nil) + router.ServeHTTP(w, req) + assert.Equal(t, 200, w.Code) +} + +var now = time.Now() +var nowStr = now.Format(time.RFC3339Nano) + +var report = Report{ + Ts: nowStr, + DnodeID: 1, + DnodeEp: "localhost:7100", + ClusterID: "6980428120398645172", + Protocol: 1, + ClusterInfo: &ClusterInfo{ + FirstEp: "localhost:7100", + FirstEpDnodeID: 1, + Version: "3.0.0.0", + MasterUptime: 2.3090276954462752e-05, + MonitorInterval: 1, + VgroupsTotal: 2, + VgroupsAlive: 2, + VnodesTotal: 2, + VnodesAlive: 2, + ConnectionsTotal: 1, + Dnodes: []Dnode{ + { + DnodeID: 1, + DnodeEp: "localhost:7100", + Status: "ready", + }, + }, + Mnodes: []Mnode{ + { + MnodeID: 1, + MnodeEp: "localhost:7100", + Role: "master", + }, + }, + }, + VgroupInfos: []VgroupInfo{ + { + VgroupID: 1, + DatabaseName: "test", + TablesNum: 1, + Status: "ready", + Vnodes: []Vnode{ + { + DnodeID: 1, + VnodeRole: "LEADER", + }, + { + DnodeID: 2, + VnodeRole: "FOLLOWER", + }, + }, + }, + }, + GrantInfo: &GrantInfo{ + ExpireTime: 2147483647, + TimeseriesUsed: 800, + TimeseriesTotal: 2147483647, + }, + DnodeInfo: DnodeInfo{ + Uptime: 0.000291412026854232, + CPUEngine: 0.0828500414250207, + CPUSystem: 0.4971002485501243, + CPUCores: 12, + MemEngine: 9268, + MemSystem: 54279816, + MemTotal: 65654816, + DiskEngine: 0, + DiskUsed: 39889702912, + DiskTotal: 210304475136, + NetIn: 4727.45292368682, + NetOut: 2194.251734390486, + IoRead: 3789.8909811694753, + IoWrite: 12311.19920713578, + IoReadDisk: 0, + IoWriteDisk: 12178.394449950447, + ReqSelect: 2, + ReqSelectRate: 0, + ReqInsert: 6, + ReqInsertSuccess: 4, + ReqInsertRate: 0, + ReqInsertBatch: 10, + ReqInsertBatchSuccess: 8, + ReqInsertBatchRate: 0, + Errors: 2, + VnodesNum: 2, + Masters: 2, + HasMnode: 1, + HasQnode: 1, + HasSnode: 1, + HasBnode: 1, + }, + DiskInfos: DiskInfo{ + Datadir: []DataDir{ + { + Name: "/root/TDengine/sim/dnode1/data", + Level: 0, + Avail: decimal.NewFromInt(171049893888), + Used: decimal.NewFromInt(39254581248), + Total: decimal.NewFromInt(210304475136), + }, + { + Name: "/root/TDengine/sim/dnode2/data", + Level: 1, + Avail: decimal.NewFromInt(171049893888), + Used: decimal.NewFromInt(39254581248), + Total: decimal.NewFromInt(210304475136), + }, + }, + Logdir: LogDir{ + Name: "/root/TDengine/sim/dnode1/log", + Avail: decimal.NewFromInt(171049771008), + Used: decimal.NewFromInt(39254704128), + Total: decimal.NewFromInt(210304475136), + }, + Tempdir: TempDir{ + Name: "/tmp", + Avail: decimal.NewFromInt(171049771008), + Used: decimal.NewFromInt(39254704128), + Total: decimal.NewFromInt(210304475136), + }, + }, + LogInfos: LogInfo{ + Summary: []Summary{ + { + Level: "error", + Total: 0, + }, { + Level: "info", + Total: 114, + }, { + Level: "debug", + Total: 117, + }, { + Level: "trace", + Total: 126, + }, + }, + }, +} + +func TestPutMetrics(t *testing.T) { + w := httptest.NewRecorder() + b, _ := json.Marshal(report) + body := strings.NewReader(string(b)) + req, _ := http.NewRequest(http.MethodPost, "/report", body) + router.ServeHTTP(w, req) + assert.Equal(t, 200, w.Code) + conn, err := db.NewConnectorWithDb(conf.TDengine.Username, conf.TDengine.Password, conf.TDengine.Host, + conf.TDengine.Port, dbName, conf.TDengine.Usessl) + if err != nil { + logger.Errorf("connect to database error, msg:%s", err) + return + } + + defer func() { + _, _ = conn.Query(context.Background(), fmt.Sprintf("drop database if exists %s", conf.Metrics.Database.Name), util.GetQidOwn()) + }() + + ctx := context.Background() + data, err := conn.Query(ctx, "select info from log_summary", util.GetQidOwn()) + if err != nil { + logger.Errorf("execute sql:%s, error:%s", "select * from log_summary", err) + t.Fatal(err) + } + for _, info := range data.Data { + assert.Equal(t, int32(114), info[0]) + } + + var tenMinutesBefore = now.Add(-10 * time.Minute) + var tenMinutesBeforeStr = tenMinutesBefore.Format(time.RFC3339Nano) + + conf.FromTime = tenMinutesBeforeStr + conf.Transfer = "old_taosd_metric" + + var cmd = cmd.NewCommand(conf) + cmd.Process(conf) + + type TableInfo struct { + TsName string + RowNum int + } + + tables := map[string]*TableInfo{ + "taosd_cluster_basic": {"ts", 1}, + "taosd_cluster_info": {"_ts", 1}, + "taosd_vgroups_info": {"_ts", 1}, + "taosd_dnodes_info": {"_ts", 1}, + "taosd_dnodes_status": {"_ts", 1}, + "taosd_dnodes_data_dirs": {"_ts", 1}, + "taosd_dnodes_log_dirs": {"_ts", 2}, + "taosd_mnodes_info": {"_ts", 1}, + "taosd_vnodes_info": {"_ts", 1}, + } + + for table, tableInfo := range tables { + data, err = conn.Query(ctx, fmt.Sprintf("select %s from %s", tableInfo.TsName, table), util.GetQidOwn()) + if err != nil { + logger.Errorf("execute sql:%s, error:%s", "select * from "+table, err) + t.Fatal(err) + } + + assert.Equal(t, tableInfo.RowNum, len(data.Data)) + assert.Equal(t, now.UnixMilli(), data.Data[0][0].(time.Time).UnixMilli()) + } + + conf.Transfer = "" + conf.Drop = "old_taosd_metric_stables" + cmd.Process(conf) + + data, err = conn.Query(ctx, "select * from information_schema.ins_stables where stable_name = 'm_info'", util.GetQidOwn()) + if err != nil { + logger.Errorf("execute sql:%s, error:%s", "m_info is not droped", err) + t.Fatal(err) + } + assert.Equal(t, 0, len(data.Data)) + logger.Infof("ALL OK !!!") +} diff --git a/tools/keeper/api/gen_metric.go b/tools/keeper/api/gen_metric.go new file mode 100644 index 000000000000..5534fe453df3 --- /dev/null +++ b/tools/keeper/api/gen_metric.go @@ -0,0 +1,770 @@ +package api + +import ( + "bytes" + "context" + "crypto/tls" + "encoding/json" + "fmt" + "io" + "net" + "net/http" + "regexp" + + "net/url" + "strconv" + "strings" + "sync" + "time" + + "github.com/gin-gonic/gin" + "github.com/sirupsen/logrus" + "github.com/taosdata/taoskeeper/db" + "github.com/taosdata/taoskeeper/infrastructure/config" + "github.com/taosdata/taoskeeper/infrastructure/log" + "github.com/taosdata/taoskeeper/util" +) + +var re = regexp.MustCompile("'+") +var gmLogger = log.GetLogger("GEN") + +var MAX_SQL_LEN = 1000000 + +var STABLE_NAME_KEY = "priv_stn" + +type ColumnSeq struct { + tagNames []string + metricNames []string +} + +var ( + mu sync.RWMutex + gColumnSeqMap = make(map[string]ColumnSeq) +) + +type GeneralMetric struct { + client *http.Client + conn *db.Connector + username string + password string + host string + port int + usessl bool + database string + url *url.URL +} + +type Tag struct { + Name string `json:"name"` + Value string `json:"value"` +} + +type Metric struct { + Name string `json:"name"` + Value float64 `json:"value"` +} + +type MetricGroup struct { + Tags []Tag `json:"tags"` + Metrics []Metric `json:"metrics"` +} + +type StableInfo struct { + Name string `json:"name"` + MetricGroups []MetricGroup `json:"metric_groups"` +} + +type StableArrayInfo struct { + Ts string `json:"ts"` + Protocol int `json:"protocol"` + Tables []StableInfo `json:"tables"` +} + +type ClusterBasic struct { + ClusterId string `json:"cluster_id"` + Ts string `json:"ts"` + FirstEp string `json:"first_ep"` + FirstEpDnodeId int32 `json:"first_ep_dnode_id"` + ClusterVersion string `json:"cluster_version"` +} + +type SlowSqlDetailInfo struct { + StartTs string `json:"start_ts"` + RequestId string `json:"request_id"` + QueryTime int32 `json:"query_time"` + Code int32 `json:"code"` + ErrorInfo string `json:"error_info"` + Type int8 `json:"type"` + RowsNum int64 `json:"rows_num"` + Sql string `json:"sql"` + ProcessName string `json:"process_name"` + ProcessId string `json:"process_id"` + Db string `json:"db"` + User string `json:"user"` + Ip string `json:"ip"` + ClusterId string `json:"cluster_id"` +} + +func (gm *GeneralMetric) Init(c gin.IRouter) error { + c.POST("/general-metric", gm.handleFunc()) + c.POST("/taosd-cluster-basic", gm.handleTaosdClusterBasic()) + c.POST("/slow-sql-detail-batch", gm.handleSlowSqlDetailBatch()) + + conn, err := db.NewConnectorWithDb(gm.username, gm.password, gm.host, gm.port, gm.database, gm.usessl) + if err != nil { + gmLogger.Errorf("init db connect error, msg:%s", err) + return err + } + gm.conn = conn + + err = gm.createSTables() + if err != nil { + gmLogger.Errorf("create stable error, msg:%s", err) + return err + } + + err = gm.initColumnSeqMap() + if err != nil { + gmLogger.Errorf("init gColumnSeqMap error, msg:%s", err) + return err + } + + return err +} + +func NewGeneralMetric(conf *config.Config) *GeneralMetric { + + client := &http.Client{ + Transport: &http.Transport{ + Proxy: http.ProxyFromEnvironment, + DialContext: (&net.Dialer{ + Timeout: 30 * time.Second, + KeepAlive: 30 * time.Second, + }).DialContext, + IdleConnTimeout: 90 * time.Second, + TLSHandshakeTimeout: 10 * time.Second, + ExpectContinueTimeout: 1 * time.Second, + DisableCompression: true, + TLSClientConfig: &tls.Config{ + InsecureSkipVerify: true, + }, + }, + } + + var protocol string + if conf.TDengine.Usessl { + protocol = "https" + } else { + protocol = "http" + } + + imp := &GeneralMetric{ + client: client, + username: conf.TDengine.Username, + password: conf.TDengine.Password, + host: conf.TDengine.Host, + port: conf.TDengine.Port, + usessl: conf.TDengine.Usessl, + database: conf.Metrics.Database.Name, + url: &url.URL{ + Scheme: protocol, + Host: fmt.Sprintf("%s:%d", conf.TDengine.Host, conf.TDengine.Port), + Path: "/influxdb/v1/write", + RawQuery: fmt.Sprintf("db=%s&precision=ms&table_name_key=%s", conf.Metrics.Database.Name, STABLE_NAME_KEY), + }, + } + return imp +} + +func (gm *GeneralMetric) handleFunc() gin.HandlerFunc { + return func(c *gin.Context) { + qid := util.GetQid(c.GetHeader("X-QID")) + + gmLogger := gmLogger.WithFields( + logrus.Fields{config.ReqIDKey: qid}, + ) + + if gm.client == nil { + gmLogger.Error("no connection") + c.JSON(http.StatusInternalServerError, gin.H{"error": "no connection"}) + return + } + + data, err := c.GetRawData() + if err != nil { + gmLogger.Errorf("get general metric data error, msg:%s", err) + c.JSON(http.StatusBadRequest, gin.H{"error": fmt.Sprintf("get general metric data error. %s", err)}) + return + } + + var request []StableArrayInfo + + if logger.Logger.IsLevelEnabled(logrus.TraceLevel) { + gmLogger.Tracef("data:%s", string(data)) + } + + if err := json.Unmarshal(data, &request); err != nil { + gmLogger.Errorf("parse general metric data error, data:%s, error:%s", string(data), err) + c.JSON(http.StatusBadRequest, gin.H{"error": fmt.Sprintf("parse general metric data error: %s", err)}) + return + } + + if len(request) == 0 { + c.JSON(http.StatusOK, gin.H{}) + return + } + + err = gm.handleBatchMetrics(request, qid) + + if err != nil { + gmLogger.Errorf("process records error. msg:%s", err) + c.JSON(http.StatusBadRequest, gin.H{"error": fmt.Sprintf("process records error. %s", err)}) + return + } + + c.JSON(http.StatusOK, gin.H{}) + } +} + +func (gm *GeneralMetric) handleBatchMetrics(request []StableArrayInfo, qid uint64) error { + var buf bytes.Buffer + + for _, stableArrayInfo := range request { + if stableArrayInfo.Ts == "" { + gmLogger.Error("ts data is empty") + continue + } + + for _, table := range stableArrayInfo.Tables { + if table.Name == "" { + gmLogger.Error("stable name is empty") + continue + } + + table.Name = strings.ToLower(table.Name) + if _, ok := Load(table.Name); !ok { + Init(table.Name) + } + + for _, metricGroup := range table.MetricGroups { + buf.WriteString(table.Name) + writeTags(metricGroup.Tags, table.Name, &buf) + buf.WriteString(" ") + writeMetrics(metricGroup.Metrics, table.Name, &buf) + buf.WriteString(" ") + buf.WriteString(stableArrayInfo.Ts) + buf.WriteString("\n") + } + } + } + + if buf.Len() > 0 { + return gm.lineWriteBody(&buf, qid) + } + return nil +} + +func (gm *GeneralMetric) lineWriteBody(buf *bytes.Buffer, qid uint64) error { + gmLogger := gmLogger.WithFields( + logrus.Fields{config.ReqIDKey: qid}, + ) + + header := map[string][]string{ + "Connection": {"keep-alive"}, + } + req_data := buf.String() + + //build new URL,add qid to URL + urlWithQid := *gm.url + query := urlWithQid.Query() + query.Set("qid", fmt.Sprintf("%d", qid)) + urlWithQid.RawQuery = query.Encode() + + req := &http.Request{ + Method: http.MethodPost, + URL: &urlWithQid, + Proto: "HTTP/1.1", + ProtoMajor: 1, + ProtoMinor: 1, + Header: header, + Host: gm.url.Host, + } + req.SetBasicAuth(gm.username, gm.password) + + req.Body = io.NopCloser(buf) + + startTime := time.Now() + resp, err := gm.client.Do(req) + + endTime := time.Now() + latency := endTime.Sub(startTime) + + if err != nil { + gmLogger.Errorf("latency:%v, req_data:%v, url:%s, resp:%d, err:%s", latency, req_data, urlWithQid.String(), resp.StatusCode, err) + return err + } + if logger.Logger.IsLevelEnabled(logrus.TraceLevel) { + gmLogger.Tracef("latency:%v, req_data:%v, url:%s, resp:%d", latency, req_data, urlWithQid.String(), resp.StatusCode) + } + + defer resp.Body.Close() + if resp.StatusCode != http.StatusNoContent { + body, _ := io.ReadAll(resp.Body) + return fmt.Errorf("unexpected status code %d:body:%s", resp.StatusCode, string(body)) + } + return nil +} + +func (gm *GeneralMetric) handleTaosdClusterBasic() gin.HandlerFunc { + return func(c *gin.Context) { + qid := util.GetQid(c.GetHeader("X-QID")) + + gmLogger := gmLogger.WithFields( + logrus.Fields{config.ReqIDKey: qid}, + ) + + if gm.conn == nil { + gmLogger.Error("no connection") + c.JSON(http.StatusInternalServerError, gin.H{"error": "no connection"}) + return + } + + data, err := c.GetRawData() + if err != nil { + gmLogger.Errorf("get taosd cluster basic data error, msg:%s", err) + c.JSON(http.StatusBadRequest, gin.H{"error": fmt.Sprintf("get general metric data error. %s", err)}) + return + } + if logger.Logger.IsLevelEnabled(logrus.TraceLevel) { + gmLogger.Tracef("receive taosd cluster basic data:%s", string(data)) + } + + var request ClusterBasic + + if err := json.Unmarshal(data, &request); err != nil { + gmLogger.Errorf("parse general metric data error, data:%s, msg:%s", string(data), err) + c.JSON(http.StatusBadRequest, gin.H{"error": fmt.Sprintf("parse general metric data error: %s", err)}) + return + } + + sql := fmt.Sprintf( + "insert into %s.taosd_cluster_basic_%s using taosd_cluster_basic tags ('%s') values (%s, '%s', %d, '%s') ", + gm.database, request.ClusterId, request.ClusterId, request.Ts, request.FirstEp, request.FirstEpDnodeId, request.ClusterVersion) + + if _, err = gm.conn.Exec(context.Background(), sql, qid); err != nil { + gmLogger.Errorf("insert taosd_cluster_basic error, msg:%s", err) + c.JSON(http.StatusBadRequest, gin.H{"error": fmt.Sprintf("insert taosd_cluster_basic error. %s", err)}) + return + } + c.JSON(http.StatusOK, gin.H{}) + } +} + +func processString(input string) string { + // remove number in the beginning + re := regexp.MustCompile(`^\d+`) + input = re.ReplaceAllString(input, "") + + // replage "." to "_" + input = strings.ReplaceAll(input, ".", "_") + + // remove special characters + re = regexp.MustCompile(`[^a-zA-Z0-9_]`) + input = re.ReplaceAllString(input, "") + + return input +} + +func (gm *GeneralMetric) handleSlowSqlDetailBatch() gin.HandlerFunc { + return func(c *gin.Context) { + qid := util.GetQid(c.GetHeader("X-QID")) + + gmLogger := gmLogger.WithFields( + logrus.Fields{config.ReqIDKey: qid}, + ) + + if gm.conn == nil { + gmLogger.Error("no connection") + c.JSON(http.StatusInternalServerError, gin.H{"error": "no connection"}) + return + } + + data, err := c.GetRawData() + if err != nil { + gmLogger.Errorf("get taos slow sql detail data error, msg:%s", err) + c.JSON(http.StatusBadRequest, gin.H{"error": fmt.Sprintf("get taos slow sql detail data error. %s", err)}) + return + } + if logger.Logger.IsLevelEnabled(logrus.TraceLevel) { + gmLogger.Tracef("receive taos slow sql detail data:%s", string(data)) + } + + var request []SlowSqlDetailInfo + + if err := json.Unmarshal(data, &request); err != nil { + gmLogger.Errorf("parse taos slow sql detail error, msg:%s", string(data)) + c.JSON(http.StatusBadRequest, gin.H{"error": fmt.Sprintf("parse taos slow sql detail error: %s", err)}) + return + } + + var sql_head = "INSERT INTO `taos_slow_sql_detail` (tbname, `db`, `user`, `ip`, `cluster_id`, `start_ts`, `request_id`, `query_time`, `code`, `error_info`, `type`, `rows_num`, `sql`, `process_name`, `process_id`) values " + var buf bytes.Buffer + buf.WriteString(sql_head) + var qid_counter uint8 = 0 + for _, slowSqlDetailInfo := range request { + if slowSqlDetailInfo.StartTs == "" { + gmLogger.Error("start_ts data is empty") + continue + } + + // cut string to max len + slowSqlDetailInfo.Sql = re.ReplaceAllString(slowSqlDetailInfo.Sql, "'") // 将匹配到的部分替换为一个单引号 + slowSqlDetailInfo.Sql = strings.ReplaceAll(slowSqlDetailInfo.Sql, "'", "''") + slowSqlDetailInfo.Sql = util.SafeSubstring(slowSqlDetailInfo.Sql, 16384) + slowSqlDetailInfo.ClusterId = util.SafeSubstring(slowSqlDetailInfo.ClusterId, 32) + slowSqlDetailInfo.Db = util.SafeSubstring(slowSqlDetailInfo.Db, 1024) + if slowSqlDetailInfo.Db == "" { + slowSqlDetailInfo.Db = "unknown" + } + slowSqlDetailInfo.User = util.SafeSubstring(slowSqlDetailInfo.User, 32) + slowSqlDetailInfo.Ip = util.SafeSubstring(slowSqlDetailInfo.Ip, 32) + slowSqlDetailInfo.ProcessName = util.SafeSubstring(slowSqlDetailInfo.ProcessName, 32) + slowSqlDetailInfo.ProcessId = util.SafeSubstring(slowSqlDetailInfo.ProcessId, 32) + slowSqlDetailInfo.ErrorInfo = util.SafeSubstring(slowSqlDetailInfo.ErrorInfo, 128) + + // max len 192 + var sub_table_name = slowSqlDetailInfo.User + "_" + util.SafeSubstring(slowSqlDetailInfo.Db, 80) + "_" + slowSqlDetailInfo.Ip + "_clusterId_" + slowSqlDetailInfo.ClusterId + sub_table_name = strings.ToLower(processString(sub_table_name)) + + var sql = fmt.Sprintf( + "('%s', '%s', '%s', '%s', '%s', %s, %s, %d, %d, '%s', %d, %d, '%s', '%s', '%s') ", + sub_table_name, + slowSqlDetailInfo.Db, slowSqlDetailInfo.User, slowSqlDetailInfo.Ip, slowSqlDetailInfo.ClusterId, slowSqlDetailInfo.StartTs, slowSqlDetailInfo.RequestId, + slowSqlDetailInfo.QueryTime, slowSqlDetailInfo.Code, slowSqlDetailInfo.ErrorInfo, slowSqlDetailInfo.Type, slowSqlDetailInfo.RowsNum, slowSqlDetailInfo.Sql, + slowSqlDetailInfo.ProcessName, slowSqlDetailInfo.ProcessId) + if (buf.Len() + len(sql)) < MAX_SQL_LEN { + buf.WriteString(sql) + } else { + if _, err = gm.conn.Exec(context.Background(), buf.String(), qid|uint64((qid_counter%255))); err != nil { + gmLogger.Errorf("insert taos_slow_sql_detail error, sql:%s, error:%s", buf.String(), err) + c.JSON(http.StatusBadRequest, gin.H{"error": fmt.Sprintf("insert taos_slow_sql_detail error. %s", err)}) + return + } + buf.Reset() + buf.WriteString(sql_head) + buf.WriteString(sql) + qid_counter++ + } + } + + if buf.Len() > len(sql_head) { + if _, err = gm.conn.Exec(context.Background(), buf.String(), qid|uint64((qid_counter%255))); err != nil { + gmLogger.Errorf("insert taos_slow_sql_detail error, data:%s, msg:%s", buf.String(), err) + c.JSON(http.StatusBadRequest, gin.H{"error": fmt.Sprintf("insert taos_slow_sql_detail error. %s", err)}) + return + } + } + c.JSON(http.StatusOK, gin.H{}) + } +} + +func writeTags(tags []Tag, stbName string, buf *bytes.Buffer) { + var nameArray []string + if columnSeq, ok := Load(stbName); ok { + if len(columnSeq.tagNames) < len(tags) { + // add column, only schema change will hit here + for _, tag := range tags { + if !contains(columnSeq.tagNames, tag.Name) { + columnSeq.tagNames = append(columnSeq.tagNames, tag.Name) + } + } + Store(stbName, columnSeq) + } + nameArray = columnSeq.tagNames + } + + // 将 Tag 切片转换为 map + tagMap := make(map[string]string) + for _, tag := range tags { + tagMap[tag.Name] = tag.Value + } + + for _, name := range nameArray { + if value, ok := tagMap[name]; ok { + if value != "" { + buf.WriteString(fmt.Sprintf(",%s=%s", name, util.EscapeInfluxProtocol(value))) + } else { + buf.WriteString(fmt.Sprintf(",%s=%s", name, "unknown")) + gmLogger.Errorf("tag value is empty, tag name:%s", name) + } + } else { + buf.WriteString(fmt.Sprintf(",%s=%s", name, "unknown")) + } + } + + // have sub table name + if _, ok := tagMap[STABLE_NAME_KEY]; ok { + return + } + + subTableName := get_sub_table_name_valid(stbName, tagMap) + if subTableName != "" { + buf.WriteString(fmt.Sprintf(",%s=%s", STABLE_NAME_KEY, subTableName)) + } else { + gmLogger.Errorf("get sub stable name error, stable name:%s, tag map:%v", stbName, tagMap) + } +} + +func checkKeysExist(data map[string]string, keys ...string) bool { + for _, key := range keys { + _, ok := data[key] + if !ok { + return false + } + } + return true +} + +func get_sub_table_name_valid(stbName string, tagMap map[string]string) string { + stbName = get_sub_table_name(stbName, tagMap) + return util.ToValidTableName(stbName) +} + +func get_sub_table_name(stbName string, tagMap map[string]string) string { + if strings.HasPrefix(stbName, "taosx") { + switch stbName { + case "taosx_sys": + if checkKeysExist(tagMap, "taosx_id") { + return fmt.Sprintf("sys_%s", tagMap["taosx_id"]) + } + case "taosx_agent": + if checkKeysExist(tagMap, "taosx_id", "agent_id") { + return fmt.Sprintf("agent_%s_%s", tagMap["taosx_id"], tagMap["agent_id"]) + } + case "taosx_connector": + if checkKeysExist(tagMap, "taosx_id", "ds_name", "task_id") { + return fmt.Sprintf("connector_%s_%s_%s", tagMap["taosx_id"], tagMap["ds_name"], tagMap["task_id"]) + } + default: + if strings.HasPrefix(stbName, "taosx_task_") { + ds_name := stbName[len("taosx_task_"):] + if checkKeysExist(tagMap, "taosx_id", "task_id") { + return fmt.Sprintf("task_%s_%s_%s", tagMap["taosx_id"], ds_name, tagMap["task_id"]) + } + } + return "" + } + } + + switch stbName { + case "taosd_cluster_info": + if checkKeysExist(tagMap, "cluster_id") { + return fmt.Sprintf("cluster_%s", tagMap["cluster_id"]) + } + case "taosd_vgroups_info": + if checkKeysExist(tagMap, "cluster_id", "vgroup_id", "database_name") { + return fmt.Sprintf("vginfo_%s_vgroup_%s_cluster_%s", tagMap["database_name"], tagMap["vgroup_id"], tagMap["cluster_id"]) + } + case "taosd_dnodes_info": + if checkKeysExist(tagMap, "cluster_id", "dnode_id") { + return fmt.Sprintf("dinfo_%s_cluster_%s", tagMap["dnode_id"], tagMap["cluster_id"]) + } + case "taosd_dnodes_status": + if checkKeysExist(tagMap, "cluster_id", "dnode_id") { + return fmt.Sprintf("dstatus_%s_cluster_%s", tagMap["dnode_id"], tagMap["cluster_id"]) + } + case "taosd_dnodes_log_dirs": + if checkKeysExist(tagMap, "cluster_id", "dnode_id", "data_dir_name") { + subTableName := fmt.Sprintf("dlog_%s_%s_cluster_%s", tagMap["dnode_id"], tagMap["data_dir_name"], tagMap["cluster_id"]) + if len(subTableName) <= util.MAX_TABLE_NAME_LEN { + return subTableName + } + return fmt.Sprintf("dlog_%s_%s_cluster_%s", tagMap["dnode_id"], + util.GetMd5HexStr(tagMap["data_dir_name"]), + tagMap["cluster_id"]) + } + case "taosd_dnodes_data_dirs": + if checkKeysExist(tagMap, "cluster_id", "dnode_id", "data_dir_name", "data_dir_level") { + subTableName := fmt.Sprintf("ddata_%s_%s_level_%s_cluster_%s", tagMap["dnode_id"], tagMap["data_dir_name"], tagMap["data_dir_level"], tagMap["cluster_id"]) + if len(subTableName) <= util.MAX_TABLE_NAME_LEN { + return subTableName + } + return fmt.Sprintf("ddata_%s_%s_level_%s_cluster_%s", tagMap["dnode_id"], + util.GetMd5HexStr(tagMap["data_dir_name"]), + tagMap["data_dir_level"], + tagMap["cluster_id"]) + } + case "taosd_mnodes_info": + if checkKeysExist(tagMap, "cluster_id", "mnode_id") { + return fmt.Sprintf("minfo_%s_cluster_%s", tagMap["mnode_id"], tagMap["cluster_id"]) + } + case "taosd_vnodes_info": + if checkKeysExist(tagMap, "cluster_id", "database_name", "vgroup_id", "dnode_id") { + return fmt.Sprintf("vninfo_%s_dnode_%s_vgroup_%s_cluster_%s", tagMap["database_name"], tagMap["dnode_id"], tagMap["vgroup_id"], tagMap["cluster_id"]) + } + case "taosd_sql_req": + if checkKeysExist(tagMap, "username", "sql_type", "result", "dnode_id", "vgroup_id", "cluster_id") { + return fmt.Sprintf("taosdsql_%s_%s_%s_%s_vgroup_%s_cluster_%s", tagMap["username"], + tagMap["sql_type"], tagMap["result"], tagMap["dnode_id"], tagMap["vgroup_id"], tagMap["cluster_id"]) + } + case "taos_sql_req": + if checkKeysExist(tagMap, "username", "sql_type", "result", "cluster_id") { + return fmt.Sprintf("taossql_%s_%s_%s_cluster_%s", tagMap["username"], + tagMap["sql_type"], tagMap["result"], tagMap["cluster_id"]) + } + case "taos_slow_sql": + if checkKeysExist(tagMap, "username", "duration", "result", "cluster_id") { + return fmt.Sprintf("slowsql_%s_%s_%s_cluster_%s", tagMap["username"], + tagMap["duration"], tagMap["result"], tagMap["cluster_id"]) + } + + default: + return "" + } + return "" +} + +func contains(array []string, item string) bool { + for _, value := range array { + if value == item { + return true + } + } + return false +} + +func writeMetrics(metrics []Metric, stbName string, buf *bytes.Buffer) { + var nameArray []string + if columnSeq, ok := Load(stbName); ok { + if len(columnSeq.metricNames) < len(metrics) { + // add column, only schema change will hit here + for _, metric := range metrics { + if !contains(columnSeq.metricNames, metric.Name) { + columnSeq.metricNames = append(columnSeq.metricNames, metric.Name) + } + } + Store(stbName, columnSeq) + } + nameArray = columnSeq.metricNames + } + + // 将 Metric 切片转换为 map + metricMap := make(map[string]float64) + for _, metric := range metrics { + metricMap[metric.Name] = metric.Value + } + + for i, name := range nameArray { + if value, ok := metricMap[name]; ok { + buf.WriteString(fmt.Sprintf("%s=%sf64", name, strconv.FormatFloat(value, 'f', -1, 64))) + if i != len(nameArray)-1 { + buf.WriteString(",") + } + } + } +} + +// 存储数据 +func Store(key string, value ColumnSeq) { + mu.Lock() + defer mu.Unlock() + gColumnSeqMap[key] = value +} + +// 加载数据 +func Load(key string) (ColumnSeq, bool) { + mu.RLock() + defer mu.RUnlock() + value, ok := gColumnSeqMap[key] + return value, ok +} + +// 初始化单表的列序列 +func Init(key string) { + mu.Lock() + defer mu.Unlock() + if _, ok := gColumnSeqMap[key]; !ok { + columnSeq := ColumnSeq{ + tagNames: []string{}, + metricNames: []string{}, + } + gColumnSeqMap[key] = columnSeq + } +} + +// 初始化所有列序列 +func (gm *GeneralMetric) initColumnSeqMap() error { + query := fmt.Sprintf(` + select stable_name + from information_schema.ins_stables + where db_name = '%s' + and ( + stable_name like 'taos_%%' + or stable_name like 'taosd_%%' + or stable_name like 'taosx_%%' + ) + order by stable_name asc; + `, gm.database) + + data, err := gm.conn.Query(context.Background(), query, util.GetQidOwn()) + + if err != nil { + return err + } + + //get all stables, then init gColumnSeqMap + for _, row := range data.Data { + stableName := row[0].(string) + Init(stableName) + } + //set gColumnSeqMap with desc stables + for tableName, columnSeq := range gColumnSeqMap { + data, err := gm.conn.Query(context.Background(), fmt.Sprintf(`desc %s.%s;`, gm.database, tableName), util.GetQidOwn()) + + if err != nil { + return err + } + + if len(data.Data) < 1 || len(data.Data[0]) < 4 { + return fmt.Errorf("desc %s.%s error", gm.database, tableName) + } + + for i, row := range data.Data { + if i == 0 { + continue + } + + if row[3].(string) == "TAG" { + columnSeq.tagNames = append(columnSeq.tagNames, row[0].(string)) + } else { + columnSeq.metricNames = append(columnSeq.metricNames, row[0].(string)) + } + } + Store(tableName, columnSeq) + } + + gmLogger.Infof("gColumnSeqMap:%v", gColumnSeqMap) + return nil +} + +func (gm *GeneralMetric) createSTables() error { + var createTableSql = "create stable if not exists taosd_cluster_basic " + + "(ts timestamp, first_ep varchar(100), first_ep_dnode_id INT, cluster_version varchar(20)) " + + "tags (cluster_id varchar(50))" + + if gm.conn == nil { + return errNoConnection + } + _, err := gm.conn.Exec(context.Background(), createTableSql, util.GetQidOwn()) + if err != nil { + return err + } + + createTableSql = "create stable if not exists taos_slow_sql_detail" + + " (start_ts TIMESTAMP, request_id BIGINT UNSIGNED PRIMARY KEY, query_time INT, code INT, error_info varchar(128), " + + "type TINYINT, rows_num BIGINT, sql varchar(16384), process_name varchar(32), process_id varchar(32)) " + + "tags (db varchar(1024), `user` varchar(32), ip varchar(32), cluster_id varchar(32))" + + _, err = gm.conn.Exec(context.Background(), createTableSql, util.GetQidOwn()) + return err +} diff --git a/tools/keeper/api/gen_metric_test.go b/tools/keeper/api/gen_metric_test.go new file mode 100644 index 000000000000..88987d654407 --- /dev/null +++ b/tools/keeper/api/gen_metric_test.go @@ -0,0 +1,358 @@ +package api + +import ( + "context" + "fmt" + "net/http" + "net/http/httptest" + "strings" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/taosdata/taoskeeper/db" + "github.com/taosdata/taoskeeper/util" +) + +var router_inited bool = false + +func TestClusterBasic(t *testing.T) { + cfg := util.GetCfg() + + CreateDatabase(cfg.TDengine.Username, cfg.TDengine.Password, cfg.TDengine.Host, cfg.TDengine.Port, cfg.TDengine.Usessl, cfg.Metrics.Database.Name, cfg.Metrics.Database.Options) + + gm := NewGeneralMetric(cfg) + if !router_inited { + err := gm.Init(router) + assert.NoError(t, err) + router_inited = true + } + + testcfg := struct { + name string + ts int64 + tbname string + data string + expect string + }{ + name: "1", + tbname: "taosd_cluster_basic", + ts: 1705655770381, + data: `{"ts":"1705655770381","cluster_id":"7648966395564416484","protocol":2,"first_ep":"ssfood06:6130","first_ep_dnode_id":1,"cluster_version":"3.2.1.0.alp"}`, + expect: "7648966395564416484", + } + + conn, err := db.NewConnectorWithDb(gm.username, gm.password, gm.host, gm.port, gm.database, gm.usessl) + assert.NoError(t, err) + defer func() { + _, _ = conn.Query(context.Background(), fmt.Sprintf("drop database if exists %s", gm.database), util.GetQidOwn()) + }() + + t.Run(testcfg.name, func(t *testing.T) { + w := httptest.NewRecorder() + body := strings.NewReader(testcfg.data) + req, _ := http.NewRequest(http.MethodPost, "/taosd-cluster-basic", body) + router.ServeHTTP(w, req) + assert.Equal(t, 200, w.Code) + + data, err := conn.Query(context.Background(), fmt.Sprintf("select ts, cluster_id from %s.%s where ts=%d", gm.database, testcfg.tbname, testcfg.ts), util.GetQidOwn()) + assert.NoError(t, err) + assert.Equal(t, 1, len(data.Data)) + assert.Equal(t, testcfg.expect, data.Data[0][1]) + }) + + testcfg = struct { + name string + ts int64 + tbname string + data string + expect string + }{ + name: "1", + tbname: "taos_slow_sql_detail", + ts: 1703226836762, + data: `[{ + "start_ts": "1703226836762", + "request_id": "1", + "query_time": 100, + "code": 0, + "error_info": "", + "type": 1, + "rows_num": 5, + "sql": "select * from abc;", + "process_name": "abc", + "process_id": "123", + "db": "dbname", + "user": "root", + "ip": "127.0.0.1", + "cluster_id": "1234567" + }, + { + "start_ts": "1703226836763", + "request_id": "2", + "query_time": 100, + "code": 0, + "error_info": "", + "type": 1, + "rows_num": 5, + "sql": "insert into abc ('a', 'b') values ('aaa', 'bbb');", + "process_name": "abc", + "process_id": "123", + "db": "dbname", + "user": "root", + "ip": "127.0.0.1", + "cluster_id": "1234567" + }]`, + expect: "1234567", + } + + conn, err = db.NewConnectorWithDb(gm.username, gm.password, gm.host, gm.port, gm.database, gm.usessl) + assert.NoError(t, err) + defer func() { + _, _ = conn.Query(context.Background(), fmt.Sprintf("drop database if exists %s", gm.database), util.GetQidOwn()) + }() + + t.Run(testcfg.name, func(t *testing.T) { + MAX_SQL_LEN = 1000000 + w := httptest.NewRecorder() + body := strings.NewReader(testcfg.data) + req, _ := http.NewRequest(http.MethodPost, "/slow-sql-detail-batch", body) + router.ServeHTTP(w, req) + assert.Equal(t, 200, w.Code) + + data, err := conn.Query(context.Background(), fmt.Sprintf("select start_ts, cluster_id from %s.%s where start_ts=%d", gm.database, testcfg.tbname, testcfg.ts), util.GetQidOwn()) + assert.NoError(t, err) + assert.Equal(t, 1, len(data.Data)) + assert.Equal(t, testcfg.expect, data.Data[0][1]) + }) +} + +func TestGenMetric(t *testing.T) { + cfg := util.GetCfg() + + CreateDatabase(cfg.TDengine.Username, cfg.TDengine.Password, cfg.TDengine.Host, cfg.TDengine.Port, cfg.TDengine.Usessl, cfg.Metrics.Database.Name, cfg.Metrics.Database.Options) + + gm := NewGeneralMetric(cfg) + if !router_inited { + err := gm.Init(router) + assert.NoError(t, err) + router_inited = true + } + + testcfg := struct { + name string + ts []int64 + tbname []string + data string + expect string + }{ + name: "1", + tbname: []string{"taosd_cluster_info", "taosd_dnodes_info"}, + ts: []int64{1703226836761, 1703226836762}, + data: `[{ + "ts": "1703226836761", + "protocol": 2, + "tables": [{ + "name": "taosd_cluster_info", + "metric_groups": [{ + "tags": [{ + "name": "cluster_id", + "value": "1397715317673023180" + }], + "metrics": [{ + "name": "dbs_total", + "value": 1 + }, { + "name": "master_uptime", + "value": 0 + }] + }] + }, { + "name": "taosd_dnodes_info", + "metric_groups": [{ + "tags": [{ + "name": "cluster_id", + "value": "1397715317673023180" + }, { + "name": "dnode_id", + "value": "1" + }, { + "name": "dnode_ep", + "value": "ssfood06:6130" + }], + "metrics": [{ + "name": "uptime", + "value": 0 + }, { + "name": "cpu_engine", + "value": 0 + }] + }] + }] + }, { + "ts": "1703226836762", + "protocol": 2, + "tables": [{ + "name": "taosd_cluster_info", + "metric_groups": [{ + "tags": [{ + "name": "cluster_id", + "value": "1397715317673023180" + }], + "metrics": [{ + "name": "dbs_total", + "value": 1 + }, { + "name": "master_uptime", + "value": 0 + }] + }] + }, { + "name": "taosd_dnodes_info", + "metric_groups": [{ + "tags": [{ + "name": "cluster_id", + "value": "1397715317673023180" + }, { + "name": "dnode_id", + "value": "1" + }, { + "name": "dnode_ep", + "value": ", =\"ssfood06:6130" + }], + "metrics": [{ + "name": "uptime", + "value": 0 + }, { + "name": "cpu_engine", + "value": 0 + }] + }] + }] + }]`, + expect: "1397715317673023180", + } + + conn, err := db.NewConnectorWithDb(gm.username, gm.password, gm.host, gm.port, gm.database, gm.usessl) + assert.NoError(t, err) + defer func() { + _, _ = conn.Query(context.Background(), fmt.Sprintf("drop database if exists %s", gm.database), util.GetQidOwn()) + }() + + t.Run(testcfg.name, func(t *testing.T) { + w := httptest.NewRecorder() + body := strings.NewReader(testcfg.data) + req, _ := http.NewRequest(http.MethodPost, "/general-metric", body) + router.ServeHTTP(w, req) + assert.Equal(t, 200, w.Code) + + for _, tbname := range testcfg.tbname { + for _, ts := range testcfg.ts { + data, err := conn.Query(context.Background(), fmt.Sprintf("select _ts, cluster_id from %s.%s where _ts=%d", gm.database, tbname, ts), util.GetQidOwn()) + assert.NoError(t, err) + assert.Equal(t, 1, len(data.Data)) + assert.Equal(t, testcfg.expect, data.Data[0][1]) + } + } + }) +} +func TestGetSubTableName(t *testing.T) { + tests := []struct { + stbName string + tagMap map[string]string + want string + }{ + { + stbName: "taosx_sys", + tagMap: map[string]string{"taosx_id": "123"}, + want: "sys_123", + }, + { + stbName: "taosx_agent", + tagMap: map[string]string{"taosx_id": "123", "agent_id": "456"}, + want: "agent_123_456", + }, + { + stbName: "taosx_connector", + tagMap: map[string]string{"taosx_id": "123", "ds_name": "ds", "task_id": "789"}, + want: "connector_123_ds_789", + }, + { + stbName: "taosx_task_example", + tagMap: map[string]string{"taosx_id": "123", "task_id": "789"}, + want: "task_123_example_789", + }, + { + stbName: "taosd_cluster_info", + tagMap: map[string]string{"cluster_id": "123"}, + want: "cluster_123", + }, + { + stbName: "taosd_vgroups_info", + tagMap: map[string]string{"cluster_id": "123", "vgroup_id": "456", "database_name": "db"}, + want: "vginfo_db_vgroup_456_cluster_123", + }, + { + stbName: "taosd_dnodes_info", + tagMap: map[string]string{"cluster_id": "123", "dnode_id": "123"}, + want: "dinfo_123_cluster_123", + }, + { + stbName: "taosd_dnodes_status", + tagMap: map[string]string{"cluster_id": "123", "dnode_id": "123"}, + want: "dstatus_123_cluster_123", + }, + { + stbName: "taosd_dnodes_log_dirs", + tagMap: map[string]string{"cluster_id": "123", "dnode_id": "123", "data_dir_name": "log"}, + want: "dlog_123_log_cluster_123", + }, + { + stbName: "taosd_dnodes_log_dirs", + tagMap: map[string]string{"cluster_id": "123", "dnode_id": "123", "data_dir_name": "loglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglog"}, + want: "dlog_123_9cdc719961a632a27603cd5ed9f1aee2_cluster_123", + }, + { + stbName: "taosd_dnodes_data_dirs", + tagMap: map[string]string{"cluster_id": "123", "dnode_id": "123", "data_dir_name": "data", "data_dir_level": "5"}, + want: "ddata_123_data_level_5_cluster_123", + }, + { + stbName: "taosd_dnodes_data_dirs", + tagMap: map[string]string{"cluster_id": "123", "dnode_id": "123", "data_dir_name": "datadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadatadata", "data_dir_level": "5"}, + want: "ddata_123_03bf8dffdf6b97e08f347c6ae795998b_level_5_cluster_123", + }, + { + stbName: "taosd_mnodes_info", + tagMap: map[string]string{"cluster_id": "123", "mnode_id": "12"}, + want: "minfo_12_cluster_123", + }, + { + stbName: "taosd_vnodes_info", + tagMap: map[string]string{"cluster_id": "123", "database_name": "db", "vgroup_id": "456", "dnode_id": "789"}, + want: "vninfo_db_dnode_789_vgroup_456_cluster_123", + }, + { + stbName: "taosd_sql_req", + tagMap: map[string]string{"username": "user", "sql_type": "select", "result": "success", "dnode_id": "123", "vgroup_id": "456", "cluster_id": "123"}, + want: "taosdsql_user_select_success_123_vgroup_456_cluster_123", + }, + { + stbName: "taos_sql_req", + tagMap: map[string]string{"username": "user", "sql_type": "select", "result": "success", "cluster_id": "123"}, + want: "taossql_user_select_success_cluster_123", + }, + { + stbName: "taos_slow_sql", + tagMap: map[string]string{"username": "user", "duration": "100ms", "result": "success", "cluster_id": "123"}, + want: "slowsql_user_100ms_success_cluster_123", + }, + } + + for _, tt := range tests { + t.Run(tt.stbName, func(t *testing.T) { + if got := get_sub_table_name_valid(tt.stbName, tt.tagMap); got != tt.want { + panic(fmt.Sprintf("get_sub_table_name() = %v, want %v", got, tt.want)) + } + }) + } +} diff --git a/tools/keeper/api/https_test.go b/tools/keeper/api/https_test.go new file mode 100644 index 000000000000..c73cbfc2e41a --- /dev/null +++ b/tools/keeper/api/https_test.go @@ -0,0 +1,127 @@ +package api + +import ( + "context" + "crypto/ecdsa" + "crypto/elliptic" + crand "crypto/rand" + "crypto/tls" + "crypto/x509" + "crypto/x509/pkix" + "encoding/pem" + "fmt" + "log" + "math/big" + "net/http" + "net/http/httputil" + "net/url" + "testing" + "time" + + "github.com/stretchr/testify/assert" + "github.com/taosdata/taoskeeper/db" + "github.com/taosdata/taoskeeper/util" +) + +func TestHttps(t *testing.T) { + server := startProxy() + defer server.Shutdown(context.Background()) + + cfg := util.GetCfg() + cfg.TDengine.Usessl = true + cfg.TDengine.Port = 34443 + + CreateDatabase(cfg.TDengine.Username, cfg.TDengine.Password, cfg.TDengine.Host, cfg.TDengine.Port, cfg.TDengine.Usessl, cfg.Metrics.Database.Name, cfg.Metrics.Database.Options) + + conn, err := db.NewConnectorWithDb(cfg.TDengine.Username, cfg.TDengine.Password, cfg.TDengine.Host, cfg.TDengine.Port, cfg.Metrics.Database.Name, cfg.TDengine.Usessl) + assert.NoError(t, err) + defer func() { + _, _ = conn.Query(context.Background(), fmt.Sprintf("drop database if exists %s", cfg.Metrics.Database.Name), util.GetQidOwn()) + }() + + data, err := conn.Query(context.Background(), "select server_version()", util.GetQidOwn()) + assert.NoError(t, err) + assert.Equal(t, 1, len(data.Data)) +} + +func generateSelfSignedCert() (tls.Certificate, error) { + priv, err := ecdsa.GenerateKey(elliptic.P384(), crand.Reader) + if err != nil { + return tls.Certificate{}, err + } + + notBefore := time.Now() + notAfter := notBefore.Add(365 * 24 * time.Hour) + + serialNumber, err := crand.Int(crand.Reader, new(big.Int).Lsh(big.NewInt(1), 128)) + if err != nil { + return tls.Certificate{}, err + } + + template := x509.Certificate{ + SerialNumber: serialNumber, + Subject: pkix.Name{ + Organization: []string{"Your Company"}, + }, + NotBefore: notBefore, + NotAfter: notAfter, + KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature, + ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth}, + BasicConstraintsValid: true, + } + + certDER, err := x509.CreateCertificate(crand.Reader, &template, &template, &priv.PublicKey, priv) + if err != nil { + return tls.Certificate{}, err + } + + certPEM := pem.EncodeToMemory(&pem.Block{Type: "CERTIFICATE", Bytes: certDER}) + keyPEM, err := x509.MarshalECPrivateKey(priv) + if err != nil { + return tls.Certificate{}, err + } + + keyPEMBlock := pem.EncodeToMemory(&pem.Block{Type: "EC PRIVATE KEY", Bytes: keyPEM}) + + return tls.X509KeyPair(certPEM, keyPEMBlock) +} + +func startProxy() *http.Server { + // Generate self-signed certificate + cert, err := generateSelfSignedCert() + if err != nil { + log.Fatalf("Failed to generate self-signed certificate: %v", err) + } + + target := "http://127.0.0.1:6041" + proxyURL, err := url.Parse(target) + if err != nil { + log.Fatalf("Failed to parse target URL: %v", err) + } + + proxy := httputil.NewSingleHostReverseProxy(proxyURL) + proxy.ErrorHandler = func(w http.ResponseWriter, r *http.Request, e error) { + http.Error(w, "Proxy error", http.StatusBadGateway) + } + mux := http.NewServeMux() + mux.Handle("/", proxy) + + server := &http.Server{ + Addr: ":34443", + Handler: mux, + TLSConfig: &tls.Config{Certificates: []tls.Certificate{cert}}, + // Setup server timeouts for better handling of idle connections and slowloris attacks + WriteTimeout: 10 * time.Second, + ReadTimeout: 10 * time.Second, + IdleTimeout: 30 * time.Second, + } + + log.Println("Starting server on :34443") + go func() { + err = server.ListenAndServeTLS("", "") + if err != nil && err != http.ErrServerClosed { + log.Fatalf("Failed to start HTTPS server: %v", err) + } + }() + return server +} diff --git a/tools/keeper/api/nodeexporter.go b/tools/keeper/api/nodeexporter.go new file mode 100644 index 000000000000..7b87a14336bc --- /dev/null +++ b/tools/keeper/api/nodeexporter.go @@ -0,0 +1,32 @@ +package api + +import ( + "net/http" + + "github.com/gin-gonic/gin" + "github.com/prometheus/client_golang/prometheus" + "github.com/prometheus/client_golang/prometheus/promhttp" + "github.com/taosdata/taoskeeper/process" +) + +type NodeExporter struct { + processor *process.Processor +} + +func NewNodeExporter(processor *process.Processor) *NodeExporter { + return &NodeExporter{processor: processor} +} + +func (z *NodeExporter) Init(c gin.IRouter) { + reg := prometheus.NewPedanticRegistry() + reg.MustRegister(z.processor) + c.GET("metrics", z.myMiddleware(promhttp.HandlerFor(reg, promhttp.HandlerOpts{}))) +} + +func (z *NodeExporter) myMiddleware(next http.Handler) gin.HandlerFunc { + return func(c *gin.Context) { + z.processor.Process() + // call Prometheus handler + next.ServeHTTP(c.Writer, c.Request) + } +} diff --git a/tools/keeper/api/report.go b/tools/keeper/api/report.go new file mode 100644 index 000000000000..eb9c3856f874 --- /dev/null +++ b/tools/keeper/api/report.go @@ -0,0 +1,478 @@ +package api + +import ( + "bytes" + "context" + "fmt" + "strconv" + "strings" + "sync/atomic" + + "github.com/gin-gonic/gin" + "github.com/sirupsen/logrus" + "github.com/taosdata/go-utils/json" + "github.com/taosdata/taoskeeper/db" + "github.com/taosdata/taoskeeper/infrastructure/config" + "github.com/taosdata/taoskeeper/infrastructure/log" + "github.com/taosdata/taoskeeper/util" +) + +var logger = log.GetLogger("REP") + +var createList = []string{ + // CreateClusterInfoSql, + // CreateDnodeSql, + // CreateMnodeSql, + // CreateDnodeInfoSql, + // CreateDataDirSql, + // CreateLogDirSql, + // CreateTempDirSql, + // CreateVgroupsInfoSql, + // CreateVnodeRoleSql, + // CreateSummarySql, + // CreateGrantInfoSql, + CreateKeeperSql, +} + +type Reporter struct { + username string + password string + host string + port int + usessl bool + dbname string + databaseOptions map[string]interface{} + totalRep atomic.Value +} + +func NewReporter(conf *config.Config) *Reporter { + r := &Reporter{ + username: conf.TDengine.Username, + password: conf.TDengine.Password, + host: conf.TDengine.Host, + port: conf.TDengine.Port, + usessl: conf.TDengine.Usessl, + dbname: conf.Metrics.Database.Name, + databaseOptions: conf.Metrics.Database.Options, + } + r.totalRep.Store(0) + return r +} + +func (r *Reporter) Init(c gin.IRouter) { + c.POST("report", r.handlerFunc()) + r.createDatabase() + r.creatTables() + // todo: it can delete in the future. + if r.shouldDetectFields() { + r.detectGrantInfoFieldType() + r.detectClusterInfoFieldType() + r.detectVgroupsInfoType() + } +} + +func (r *Reporter) getConn() *db.Connector { + conn, err := db.NewConnector(r.username, r.password, r.host, r.port, r.usessl) + if err != nil { + qid := util.GetQidOwn() + + logger := logger.WithFields( + logrus.Fields{config.ReqIDKey: qid}, + ) + logger.Errorf("connect to database error, msg:%s", err) + panic(err) + } + return conn +} + +func (r *Reporter) detectGrantInfoFieldType() { + // `expire_time` `timeseries_used` `timeseries_total` in table `grant_info` changed to bigint from TS-3003. + ctx := context.Background() + conn := r.getConn() + defer r.closeConn(conn) + + r.detectFieldType(ctx, conn, "grants_info", "expire_time", "bigint") + r.detectFieldType(ctx, conn, "grants_info", "timeseries_used", "bigint") + r.detectFieldType(ctx, conn, "grants_info", "timeseries_total", "bigint") + if r.tagExist(ctx, conn, "grants_info", "dnode_id") { + r.dropTag(ctx, conn, "grants_info", "dnode_id") + } + if r.tagExist(ctx, conn, "grants_info", "dnode_ep") { + r.dropTag(ctx, conn, "grants_info", "dnode_ep") + } +} + +func (r *Reporter) detectClusterInfoFieldType() { + // `tbs_total` in table `cluster_info` changed to bigint from TS-3003. + ctx := context.Background() + conn := r.getConn() + defer r.closeConn(conn) + + r.detectFieldType(ctx, conn, "cluster_info", "tbs_total", "bigint") + + // add column `topics_total` and `streams_total` from TD-22032 + // if exists, _ := r.columnInfo(ctx, conn, "cluster_info", "topics_total"); !exists { + // logger.Warningf("## %s.cluster_info.topics_total not exists, will add it", r.dbname) + // r.addColumn(ctx, conn, "cluster_info", "topics_total", "int") + // } + // if exists, _ := r.columnInfo(ctx, conn, "cluster_info", "streams_total"); !exists { + // logger.Warningf("## %s.cluster_info.streams_total not exists, will add it", r.dbname) + // r.addColumn(ctx, conn, "cluster_info", "streams_total", "int") + // } +} + +func (r *Reporter) detectVgroupsInfoType() { + // `tables_num` in table `vgroups_info` changed to bigint from TS-3003. + ctx := context.Background() + conn := r.getConn() + defer r.closeConn(conn) + + r.detectFieldType(ctx, conn, "vgroups_info", "tables_num", "bigint") +} + +func (r *Reporter) detectFieldType(ctx context.Context, conn *db.Connector, table, field, fieldType string) { + _, colType := r.columnInfo(ctx, conn, table, field) + if colType == "INT" { + logger.Warningf("%s.%s.%s type is %s, will change to %s", r.dbname, table, field, colType, fieldType) + // drop column `tables_num` + r.dropColumn(ctx, conn, table, field) + + // add column `tables_num` + r.addColumn(ctx, conn, table, field, fieldType) + } +} + +func (r *Reporter) shouldDetectFields() bool { + ctx := context.Background() + conn := r.getConn() + defer r.closeConn(conn) + + version, err := r.serverVersion(ctx, conn) + if err != nil { + logger.Errorf("get server version error:%s", err) + return false + } + + // if server version is less than v3.0.3.0, should not detect fields. + versions := strings.Split(version, ".") + if len(versions) < 4 { + logger.Errorf("get server version error. version:%s", version) + return false + } + + v1, _ := strconv.Atoi(versions[0]) + v2, _ := strconv.Atoi(versions[1]) + v3, _ := strconv.Atoi(versions[2]) + + if v1 > 3 || v2 > 0 || v3 >= 3 { + return true + } + + return false +} + +func (r *Reporter) serverVersion(ctx context.Context, conn *db.Connector) (version string, err error) { + res, err := conn.Query(ctx, "select server_version()", util.GetQidOwn()) + if err != nil { + logger.Errorf("get server version error, msg:%s", err) + return + } + + if len(res.Data) == 0 { + logger.Errorf("get server version error. response:%+v", res) + return + } + + if len(res.Data) != 1 && len(res.Data[0]) != 1 { + logger.Errorf("get server version error. response:%+v", res) + return + } + + version = res.Data[0][0].(string) + + return +} + +func (r *Reporter) columnInfo(ctx context.Context, conn *db.Connector, table string, field string) (exists bool, colType string) { + res, err := conn.Query(ctx, fmt.Sprintf("select col_type from information_schema.ins_columns where table_name='%s' and db_name='%s' and col_name='%s'", table, r.dbname, field), util.GetQidOwn()) + if err != nil { + logger.Errorf("get %s field type error, msg:%s", r.dbname, err) + panic(err) + } + + if len(res.Data) == 0 { + return + } + + if len(res.Data) != 1 && len(res.Data[0]) != 1 { + logger.Errorf("get field type for %s error. response:%+v", table, res) + panic(fmt.Sprintf("get field type for %s error. response:%+v", table, res)) + } + + exists = true + colType = res.Data[0][0].(string) + colType = strings.ToUpper(colType) + return +} + +func (r *Reporter) tagExist(ctx context.Context, conn *db.Connector, stable string, tag string) (exists bool) { + res, err := conn.Query(ctx, fmt.Sprintf("select tag_name from information_schema.ins_tags where stable_name='%s' and db_name='%s' and tag_name='%s'", stable, r.dbname, tag), util.GetQidOwn()) + if err != nil { + logger.Errorf("get %s tag_name error, msg:%s", r.dbname, err) + panic(err) + } + + if len(res.Data) == 0 { + exists = false + return + } + + if len(res.Data) != 1 && len(res.Data[0]) != 1 { + logger.Errorf("get tag_name for %s error. response:%+v", stable, res) + panic(fmt.Sprintf("get tag_name for %s error. response:%+v", stable, res)) + } + + exists = true + return +} + +func (r *Reporter) dropColumn(ctx context.Context, conn *db.Connector, table string, field string) { + if _, err := conn.Exec(ctx, fmt.Sprintf("alter table %s.%s drop column %s", r.dbname, table, field), util.GetQidOwn()); err != nil { + logger.Errorf("drop column %s from table %s error, msg:%s", field, table, err) + panic(err) + } +} + +func (r *Reporter) dropTag(ctx context.Context, conn *db.Connector, stable string, tag string) { + if _, err := conn.Exec(ctx, fmt.Sprintf("alter stable %s.%s drop tag %s", r.dbname, stable, tag), util.GetQidOwn()); err != nil { + logger.Errorf("drop tag %s from stable %s error, msg:%s", tag, stable, err) + panic(err) + } +} + +func (r *Reporter) addColumn(ctx context.Context, conn *db.Connector, table string, field string, fieldType string) { + if _, err := conn.Exec(ctx, fmt.Sprintf("alter table %s.%s add column %s %s", r.dbname, table, field, fieldType), util.GetQidOwn()); err != nil { + logger.Errorf("add column %s to table %s error, msg:%s", field, table, err) + panic(err) + } +} + +func (r *Reporter) createDatabase() { + ctx := context.Background() + conn := r.getConn() + defer r.closeConn(conn) + + createDBSql := r.generateCreateDBSql() + logger.Warningf("create database sql: %s", createDBSql) + + if _, err := conn.Exec(ctx, createDBSql, util.GetQidOwn()); err != nil { + logger.Errorf("create database %s error, msg:%v", r.dbname, err) + panic(err) + } +} + +func (r *Reporter) generateCreateDBSql() string { + var buf bytes.Buffer + buf.WriteString("create database if not exists ") + buf.WriteString(r.dbname) + + for k, v := range r.databaseOptions { + buf.WriteString(" ") + buf.WriteString(k) + switch v := v.(type) { + case string: + buf.WriteString(fmt.Sprintf(" '%s'", v)) + default: + buf.WriteString(fmt.Sprintf(" %v", v)) + } + buf.WriteString(" ") + } + return buf.String() +} + +func (r *Reporter) creatTables() { + ctx := context.Background() + conn, err := db.NewConnectorWithDb(r.username, r.password, r.host, r.port, r.dbname, r.usessl) + if err != nil { + logger.Errorf("connect to database error, msg:%s", err) + return + } + defer r.closeConn(conn) + + for _, createSql := range createList { + logger.Infof("execute sql:%s", createSql) + if _, err = conn.Exec(ctx, createSql, util.GetQidOwn()); err != nil { + logger.Errorf("execute sql:%s, error:%s", createSql, err) + } + } +} + +func (r *Reporter) closeConn(conn *db.Connector) { + if err := conn.Close(); err != nil { + logger.Errorf("close connection error, msg:%s", err) + } +} + +func (r *Reporter) handlerFunc() gin.HandlerFunc { + return func(c *gin.Context) { + qid := util.GetQid(c.GetHeader("X-QID")) + + logger := logger.WithFields( + logrus.Fields{config.ReqIDKey: qid}, + ) + + r.recordTotalRep() + // data parse + data, err := c.GetRawData() + if err != nil { + logger.Errorf("receiving taosd data error, msg:%s", err) + return + } + var report Report + + logger.Tracef("report data:%s", string(data)) + if e := json.Unmarshal(data, &report); e != nil { + logger.Errorf("error occurred while unmarshal request, data:%s, error:%s", data, err) + return + } + var sqls []string + if report.ClusterInfo != nil { + sqls = append(sqls, insertClusterInfoSql(*report.ClusterInfo, report.ClusterID, report.Protocol, report.Ts)...) + } + sqls = append(sqls, insertDnodeSql(report.DnodeInfo, report.DnodeID, report.DnodeEp, report.ClusterID, report.Ts)) + if report.GrantInfo != nil { + sqls = append(sqls, insertGrantSql(*report.GrantInfo, report.DnodeID, report.ClusterID, report.Ts)) + } + sqls = append(sqls, insertDataDirSql(report.DiskInfos, report.DnodeID, report.DnodeEp, report.ClusterID, report.Ts)...) + for _, group := range report.VgroupInfos { + sqls = append(sqls, insertVgroupSql(group, report.DnodeID, report.DnodeEp, report.ClusterID, report.Ts)...) + } + sqls = append(sqls, insertLogSummary(report.LogInfos, report.DnodeID, report.DnodeEp, report.ClusterID, report.Ts)) + + conn, err := db.NewConnectorWithDb(r.username, r.password, r.host, r.port, r.dbname, r.usessl) + if err != nil { + logger.Errorf("connect to database error, msg:%s", err) + return + } + defer r.closeConn(conn) + ctx := context.Background() + + for _, sql := range sqls { + logger.Tracef("execute sql:%s", sql) + if _, err := conn.Exec(ctx, sql, util.GetQidOwn()); err != nil { + logger.Errorf("execute sql error, sql:%s, error:%s", sql, err) + } + } + } +} + +func (r *Reporter) recordTotalRep() { + old := r.totalRep.Load().(int) + for i := 0; i < 3; i++ { + r.totalRep.CompareAndSwap(old, old+1) + } +} + +func (r *Reporter) GetTotalRep() *atomic.Value { + return &r.totalRep +} + +func insertClusterInfoSql(info ClusterInfo, ClusterID string, protocol int, ts string) []string { + var sqls []string + var dtotal, dalive, mtotal, malive int + for _, dnode := range info.Dnodes { + sqls = append(sqls, fmt.Sprintf("insert into d_info_%s using d_info tags (%d, '%s', '%s') values ('%s', '%s')", + ClusterID+strconv.Itoa(dnode.DnodeID), dnode.DnodeID, dnode.DnodeEp, ClusterID, ts, dnode.Status)) + dtotal++ + if "ready" == dnode.Status { + dalive++ + } + } + + for _, mnode := range info.Mnodes { + sqls = append(sqls, fmt.Sprintf("insert into m_info_%s using m_info tags (%d, '%s', '%s') values ('%s', '%s')", + ClusterID+strconv.Itoa(mnode.MnodeID), mnode.MnodeID, mnode.MnodeEp, ClusterID, ts, mnode.Role)) + mtotal++ + //LEADER FOLLOWER CANDIDATE ERROR + if "ERROR" != mnode.Role { + malive++ + } + } + + sqls = append(sqls, fmt.Sprintf( + "insert into cluster_info_%s using cluster_info tags('%s') (ts, first_ep, first_ep_dnode_id, version, "+ + "master_uptime, monitor_interval, dbs_total, tbs_total, stbs_total, dnodes_total, dnodes_alive, "+ + "mnodes_total, mnodes_alive, vgroups_total, vgroups_alive, vnodes_total, vnodes_alive, connections_total, "+ + "topics_total, streams_total, protocol) values ('%s', '%s', %d, '%s', %f, %d, %d, %d, %d, %d, %d, %d, %d, "+ + "%d, %d, %d, %d, %d, %d, %d, %d)", + ClusterID, ClusterID, ts, info.FirstEp, info.FirstEpDnodeID, info.Version, info.MasterUptime, info.MonitorInterval, + info.DbsTotal, info.TbsTotal, info.StbsTotal, dtotal, dalive, mtotal, malive, info.VgroupsTotal, info.VgroupsAlive, + info.VnodesTotal, info.VnodesAlive, info.ConnectionsTotal, info.TopicsTotal, info.StreamsTotal, protocol)) + return sqls +} + +func insertDnodeSql(info DnodeInfo, DnodeID int, DnodeEp string, ClusterID string, ts string) string { + return fmt.Sprintf("insert into dnode_info_%s using dnodes_info tags (%d, '%s', '%s') values ('%s', %f, %f, %f, %f, %d, %d, %d, %d, %d, %d, %f, %f, %f, %f, %f, %f, %d, %f, %d, %d, %f, %d, %d, %f, %d, %d, %d, %d, %d, %d, %d)", + ClusterID+strconv.Itoa(DnodeID), DnodeID, DnodeEp, ClusterID, + ts, info.Uptime, info.CPUEngine, info.CPUSystem, info.CPUCores, info.MemEngine, info.MemSystem, info.MemTotal, + info.DiskEngine, info.DiskUsed, info.DiskTotal, info.NetIn, info.NetOut, info.IoRead, info.IoWrite, + info.IoReadDisk, info.IoWriteDisk, info.ReqSelect, info.ReqSelectRate, info.ReqInsert, info.ReqInsertSuccess, + info.ReqInsertRate, info.ReqInsertBatch, info.ReqInsertBatchSuccess, info.ReqInsertBatchRate, info.Errors, + info.VnodesNum, info.Masters, info.HasMnode, info.HasQnode, info.HasSnode, info.HasBnode) +} + +func insertDataDirSql(disk DiskInfo, DnodeID int, DnodeEp string, ClusterID string, ts string) []string { + var sqls []string + for _, data := range disk.Datadir { + sqls = append(sqls, + fmt.Sprintf("insert into data_dir_%s using data_dir tags (%d, '%s', '%s') values ('%s', '%s', %d, %d, %d, %d)", + ClusterID+strconv.Itoa(DnodeID), DnodeID, DnodeEp, ClusterID, + ts, data.Name, data.Level, data.Avail.IntPart(), data.Used.IntPart(), data.Total.IntPart()), + ) + } + sqls = append(sqls, + fmt.Sprintf("insert into log_dir_%s using log_dir tags (%d, '%s', '%s') values ('%s', '%s', %d, %d, %d)", + ClusterID+strconv.Itoa(DnodeID), DnodeID, DnodeEp, ClusterID, + ts, disk.Logdir.Name, disk.Logdir.Avail.IntPart(), disk.Logdir.Used.IntPart(), disk.Logdir.Total.IntPart()), + fmt.Sprintf("insert into temp_dir_%s using temp_dir tags (%d, '%s', '%s') values ('%s', '%s', %d, %d, %d)", + ClusterID+strconv.Itoa(DnodeID), DnodeID, DnodeEp, ClusterID, + ts, disk.Tempdir.Name, disk.Tempdir.Avail.IntPart(), disk.Tempdir.Used.IntPart(), disk.Tempdir.Total.IntPart()), + ) + return sqls +} + +func insertVgroupSql(g VgroupInfo, DnodeID int, DnodeEp string, ClusterID string, ts string) []string { + var sqls []string + sqls = append(sqls, fmt.Sprintf("insert into vgroups_info_%s using vgroups_info tags (%d, '%s', '%s') "+ + "(ts, vgroup_id, database_name, tables_num, status, ) values ( '%s','%d', '%s', %d, '%s')", + ClusterID+strconv.Itoa(DnodeID)+strconv.Itoa(g.VgroupID), DnodeID, DnodeEp, ClusterID, + ts, g.VgroupID, g.DatabaseName, g.TablesNum, g.Status)) + for _, v := range g.Vnodes { + sqls = append(sqls, fmt.Sprintf("insert into vnodes_role_%s using vnodes_role tags (%d, '%s', '%s') values ('%s', '%s')", + ClusterID+strconv.Itoa(DnodeID), DnodeID, DnodeEp, ClusterID, ts, v.VnodeRole)) + } + return sqls +} + +func insertLogSummary(log LogInfo, DnodeID int, DnodeEp string, ClusterID string, ts string) string { + var e, info, debug, trace int + for _, s := range log.Summary { + switch s.Level { + case "error": + e = s.Total + case "info": + info = s.Total + case "debug": + debug = s.Total + case "trace": + trace = s.Total + } + } + return fmt.Sprintf("insert into log_summary_%s using log_summary tags (%d, '%s', '%s') values ('%s', %d, %d, %d, %d)", + ClusterID+strconv.Itoa(DnodeID), DnodeID, DnodeEp, ClusterID, ts, e, info, debug, trace) +} + +func insertGrantSql(g GrantInfo, DnodeID int, ClusterID string, ts string) string { + return fmt.Sprintf("insert into grants_info_%s using grants_info tags ('%s') (ts, expire_time, "+ + "timeseries_used, timeseries_total) values ('%s', %d, %d, %d)", ClusterID+strconv.Itoa(DnodeID), ClusterID, ts, g.ExpireTime, g.TimeseriesUsed, g.TimeseriesTotal) +} diff --git a/tools/keeper/api/tables.go b/tools/keeper/api/tables.go new file mode 100644 index 000000000000..90f0e0972120 --- /dev/null +++ b/tools/keeper/api/tables.go @@ -0,0 +1,286 @@ +package api + +import ( + "strconv" + + "github.com/shopspring/decimal" +) + +type Report struct { + Ts string `json:"ts"` + DnodeID int `json:"dnode_id"` + DnodeEp string `json:"dnode_ep"` + ClusterID string `json:"cluster_id"` + Protocol int `json:"protocol"` + ClusterInfo *ClusterInfo `json:"cluster_info"` // only reported by master + StbInfos []StbInfo `json:"stb_infos"` + VgroupInfos []VgroupInfo `json:"vgroup_infos"` // only reported by master + GrantInfo *GrantInfo `json:"grant_info"` // only reported by master + DnodeInfo DnodeInfo `json:"dnode_info"` + DiskInfos DiskInfo `json:"disk_infos"` + LogInfos LogInfo `json:"log_infos"` +} + +type ClusterInfo struct { + FirstEp string `json:"first_ep"` + FirstEpDnodeID int `json:"first_ep_dnode_id"` + Version string `json:"version"` + MasterUptime float32 `json:"master_uptime"` + MonitorInterval int `json:"monitor_interval"` + DbsTotal int `json:"dbs_total"` + TbsTotal int64 `json:"tbs_total"` // change to bigint since TS-3003 + StbsTotal int `json:"stbs_total"` + VgroupsTotal int `json:"vgroups_total"` + VgroupsAlive int `json:"vgroups_alive"` + VnodesTotal int `json:"vnodes_total"` + VnodesAlive int `json:"vnodes_alive"` + ConnectionsTotal int `json:"connections_total"` + TopicsTotal int `json:"topics_total"` + StreamsTotal int `json:"streams_total"` + Dnodes []Dnode `json:"dnodes"` + Mnodes []Mnode `json:"mnodes"` +} + +var dnodeEpLen = strconv.Itoa(255) + +var CreateClusterInfoSql = "create table if not exists cluster_info (" + + "ts timestamp, " + + "first_ep binary(134), " + + "first_ep_dnode_id int, " + + "version binary(12), " + + "master_uptime float, " + + "monitor_interval int, " + + "dbs_total int, " + + "tbs_total bigint, " + // change to bigint since TS-3003 + "stbs_total int, " + + "dnodes_total int, " + + "dnodes_alive int, " + + "mnodes_total int, " + + "mnodes_alive int, " + + "vgroups_total int, " + + "vgroups_alive int, " + + "vnodes_total int, " + + "vnodes_alive int, " + + "connections_total int, " + + "topics_total int, " + + "streams_total int, " + + "protocol int " + + ") tags (cluster_id nchar(32))" + +type Dnode struct { + DnodeID int `json:"dnode_id"` + DnodeEp string `json:"dnode_ep"` + Status string `json:"status"` +} + +var CreateDnodeSql = "create table if not exists d_info (" + + "ts timestamp, " + + "status binary(10)" + + ") tags (dnode_id int, dnode_ep nchar(" + dnodeEpLen + "), cluster_id nchar(32))" + +type Mnode struct { + MnodeID int `json:"mnode_id"` + MnodeEp string `json:"mnode_ep"` + Role string `json:"role"` +} + +var CreateMnodeSql = "create table if not exists m_info (" + + "ts timestamp, " + + "role binary(10)" + + ") tags (mnode_id int, mnode_ep nchar(" + dnodeEpLen + "), cluster_id nchar(32))" + +type DnodeInfo struct { + Uptime float32 `json:"uptime"` + CPUEngine float32 `json:"cpu_engine"` + CPUSystem float32 `json:"cpu_system"` + CPUCores float32 `json:"cpu_cores"` + MemEngine int `json:"mem_engine"` + MemSystem int `json:"mem_system"` + MemTotal int `json:"mem_total"` + DiskEngine int64 `json:"disk_engine"` + DiskUsed int64 `json:"disk_used"` + DiskTotal int64 `json:"disk_total"` + NetIn float32 `json:"net_in"` + NetOut float32 `json:"net_out"` + IoRead float32 `json:"io_read"` + IoWrite float32 `json:"io_write"` + IoReadDisk float32 `json:"io_read_disk"` + IoWriteDisk float32 `json:"io_write_disk"` + ReqSelect int `json:"req_select"` + ReqSelectRate float32 `json:"req_select_rate"` + ReqInsert int `json:"req_insert"` + ReqInsertSuccess int `json:"req_insert_success"` + ReqInsertRate float32 `json:"req_insert_rate"` + ReqInsertBatch int `json:"req_insert_batch"` + ReqInsertBatchSuccess int `json:"req_insert_batch_success"` + ReqInsertBatchRate float32 `json:"req_insert_batch_rate"` + Errors int `json:"errors"` + VnodesNum int `json:"vnodes_num"` + Masters int `json:"masters"` + HasMnode int8 `json:"has_mnode"` + HasQnode int8 `json:"has_qnode"` + HasSnode int8 `json:"has_snode"` + HasBnode int8 `json:"has_bnode"` +} + +var CreateDnodeInfoSql = "create table if not exists dnodes_info (" + + "ts timestamp, " + + "uptime float, " + + "cpu_engine float, " + + "cpu_system float, " + + "cpu_cores float, " + + "mem_engine int, " + + "mem_system int, " + + "mem_total int, " + + "disk_engine bigint, " + + "disk_used bigint, " + + "disk_total bigint, " + + "net_in float, " + + "net_out float, " + + "io_read float, " + + "io_write float, " + + "io_read_disk float, " + + "io_write_disk float, " + + "req_select int, " + + "req_select_rate float, " + + "req_insert int, " + + "req_insert_success int, " + + "req_insert_rate float, " + + "req_insert_batch int, " + + "req_insert_batch_success int, " + + "req_insert_batch_rate float, " + + "errors int, " + + "vnodes_num int, " + + "masters int, " + + "has_mnode int, " + + "has_qnode int, " + + "has_snode int, " + + "has_bnode int " + + ") tags (dnode_id int, dnode_ep nchar(" + dnodeEpLen + "), cluster_id nchar(32))" + +type DiskInfo struct { + Datadir []DataDir `json:"datadir"` + Logdir LogDir `json:"logdir"` + Tempdir TempDir `json:"tempdir"` +} + +type DataDir struct { + Name string `json:"name"` + Level int `json:"level"` + Avail decimal.Decimal `json:"avail"` + Used decimal.Decimal `json:"used"` + Total decimal.Decimal `json:"total"` +} + +var CreateDataDirSql = "create table if not exists data_dir (" + + "ts timestamp, " + + "name nchar(200), " + + "`level` int, " + + "avail bigint, " + + "used bigint, " + + "total bigint" + + ") tags (dnode_id int, dnode_ep nchar(" + dnodeEpLen + "), cluster_id nchar(32))" + +type LogDir struct { + Name string `json:"name"` + Avail decimal.Decimal `json:"avail"` + Used decimal.Decimal `json:"used"` + Total decimal.Decimal `json:"total"` +} + +var CreateLogDirSql = "create table if not exists log_dir (" + + "ts timestamp, " + + "name nchar(200), " + + "avail bigint, " + + "used bigint, " + + "total bigint" + + ") tags (dnode_id int, dnode_ep nchar(" + dnodeEpLen + "), cluster_id nchar(32))" + +type TempDir struct { + Name string `json:"name"` + Avail decimal.Decimal `json:"avail"` + Used decimal.Decimal `json:"used"` + Total decimal.Decimal `json:"total"` +} + +var CreateTempDirSql = "create table if not exists temp_dir(" + + "ts timestamp, " + + "name nchar(200), " + + "avail bigint, " + + "used bigint, " + + "total bigint " + + ") tags (dnode_id int, dnode_ep nchar(" + dnodeEpLen + "), cluster_id nchar(32))" + +type StbInfo struct { + StbName string `json:"stb_name"` + DataBaseName string `json:"database_name"` +} + +type VgroupInfo struct { + VgroupID int `json:"vgroup_id"` + DatabaseName string `json:"database_name"` + TablesNum int64 `json:"tables_num"` + Status string `json:"status"` + Vnodes []Vnode `json:"vnodes"` +} + +var CreateVgroupsInfoSql = "create table if not exists vgroups_info (" + + "ts timestamp, " + + "vgroup_id int, " + + "database_name binary(33), " + + "tables_num bigint, " + // change to bigint since TS-3003 + "status binary(512) " + + ") tags (dnode_id int, dnode_ep nchar(" + dnodeEpLen + "), cluster_id nchar(32))" + +type Vnode struct { + DnodeID int `json:"dnode_id"` + VnodeRole string `json:"vnode_role"` +} + +var CreateVnodeRoleSql = "create table if not exists vnodes_role (" + + "ts timestamp, " + + "vnode_role binary(10) " + + ") tags (dnode_id int, dnode_ep nchar(" + dnodeEpLen + "), cluster_id nchar(32))" + +type LogInfo struct { + Summary []Summary `json:"summary"` +} + +type Log struct { + Ts string `json:"ts"` + Level string `json:"level"` + Content string `json:"content"` +} + +type Summary struct { + Level string `json:"level"` + Total int `json:"total"` +} + +var CreateSummarySql = "create table if not exists log_summary(" + + "ts timestamp, " + + "error int, " + + "info int, " + + "debug int, " + + "trace int " + + ") tags (dnode_id int, dnode_ep nchar(" + dnodeEpLen + "), cluster_id nchar(32))" + +type GrantInfo struct { + ExpireTime int64 `json:"expire_time"` + TimeseriesUsed int64 `json:"timeseries_used"` + TimeseriesTotal int64 `json:"timeseries_total"` +} + +var CreateGrantInfoSql = "create table if not exists grants_info(" + + "ts timestamp, " + + "expire_time bigint, " + + "timeseries_used bigint, " + + "timeseries_total bigint " + + ") tags (cluster_id nchar(32))" + +var CreateKeeperSql = "create table if not exists keeper_monitor (" + + "ts timestamp, " + + "cpu float, " + + "mem float, " + + "total_reports int " + + ") tags (identify nchar(50))" diff --git a/tools/keeper/api/zabbix.go b/tools/keeper/api/zabbix.go new file mode 100644 index 000000000000..8b7cb759926f --- /dev/null +++ b/tools/keeper/api/zabbix.go @@ -0,0 +1,113 @@ +package api + +import ( + "net/http" + "sort" + "strings" + + "github.com/gin-gonic/gin" + "github.com/taosdata/taoskeeper/process" + "github.com/taosdata/taoskeeper/util/pool" +) + +type Zabbix struct { + processor *process.Processor + floatGroup []*process.Metric + strGroup []*process.Metric +} + +func NewZabbix(processor *process.Processor) *Zabbix { + z := &Zabbix{processor: processor} + z.processorMetrics() + return z +} + +type zabbixMetric struct { + Data []*ZMetric `json:"data"` +} + +type ZMetric struct { + Metric string `json:"{#METRIC}"` + Key string `json:"key"` + Value interface{} `json:"value"` +} + +const ( + FloatType = iota + 1 + StringType +) + +func (z *Zabbix) Init(c gin.IRouter) { + api := c.Group("zabbix") + api.GET("float", z.getFloat) + api.GET("string", z.getString) +} + +func (z *Zabbix) getFloat(c *gin.Context) { + z.returnData(c, FloatType) +} + +func (z *Zabbix) getString(c *gin.Context) { + z.returnData(c, StringType) +} + +func (z *Zabbix) returnData(c *gin.Context, valueType int) { + var metrics []*process.Metric + switch valueType { + case FloatType: + metrics = z.floatGroup + case StringType: + metrics = z.strGroup + } + var d zabbixMetric + b := pool.BytesPoolGet() + defer pool.BytesPoolPut(b) + for _, metric := range metrics { + values := metric.GetValue() + for _, value := range values { + label := z.sortLabel(value.Label) + b.Reset() + b.WriteString(metric.FQName) + if len(label) > 0 { + b.WriteByte(',') + b.WriteString(label) + } + metricName := b.String() + d.Data = append(d.Data, &ZMetric{ + Metric: metricName, + Key: metricName, + Value: value.Value, + }) + } + } + c.JSON(http.StatusOK, d) +} + +func (z *Zabbix) sortLabel(labels map[string]string) string { + if len(labels) == 0 { + return "" + } + result := make([]string, 0, len(labels)) + b := pool.BytesPoolGet() + defer pool.BytesPoolPut(b) + for k, v := range labels { + b.Reset() + b.WriteString(k) + b.WriteByte('=') + b.WriteString(v) + result = append(result, b.String()) + } + sort.Strings(result) + return strings.Join(result, "_") +} + +func (z *Zabbix) processorMetrics() { + metrics := z.processor.GetMetric() + for _, metric := range metrics { + if metric.Type == process.Gauge || metric.Type == process.Counter { + z.floatGroup = append(z.floatGroup, metric) + } else if metric.Type == process.Info { + z.strGroup = append(z.strGroup, metric) + } + } +} diff --git a/tools/keeper/ci/changelog-generate.sh b/tools/keeper/ci/changelog-generate.sh new file mode 100755 index 000000000000..516ebc527269 --- /dev/null +++ b/tools/keeper/ci/changelog-generate.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +last=$(git describe --tags --abbrev=0 2>/dev/null) + +if [ "$last" = "" ]; then + git log --pretty=format:'%s' | sort -k2n | uniq >./releaseNotes.tmp +else + git log --pretty=format:'%s' $last..HEAD | sort -k2n | uniq >./releaseNotes.tmp +fi + +function part() { + name=$1 + pattern=$2 + changes=$(grep -P '\[\w+-\d+\]\s*<('$pattern')>:' ./releaseNotes.tmp | sed -E 's/ *<('$pattern')>//' | sed 's/[ci skip]\s*//' | awk -F: '{print "- " $1 ": " $2}' | sort | uniq) + lines=$(printf "\\$changes\n" | wc -l) + # echo $name $pattern $lines >&2 + if [ $lines -gt 0 ]; then + echo "### $name" + echo "" + echo "$changes" + echo "" + fi +} + +part "Features" "feature|feat" +part "Bug Fixes" "bugfix|fix" +part "Enhancements" "enhance" +part "Tests" "test" +part "Documents" "docs|doc" + +rm -f ./releaseNotes.tmp diff --git a/tools/keeper/ci/post-release.sh b/tools/keeper/ci/post-release.sh new file mode 100755 index 000000000000..1b5d4201d6ac --- /dev/null +++ b/tools/keeper/ci/post-release.sh @@ -0,0 +1,22 @@ +#!/bin/bash +set -e +ci=$(realpath $(dirname $0)) +v=$1 +if [ "$v" = "" ]; then + echo "$0 " + exit 1 +fi + +newv=$(awk -F. '/[0-9]+\./{$NF+=1;print}' OFS=. <<<"$v") +tee version/version.go <" + exit 1 +fi + +tee version/version.go <CHANGELOG.md2 +printf "## v$newv - $(date +%F)\n\n" >>CHANGELOG.md2 +$ci/changelog-generate.sh >CHANGELOG.tmp +cat CHANGELOG.tmp >>CHANGELOG.md2 +sed "1,7d" CHANGELOG.md >>CHANGELOG.md2 +mv CHANGELOG.md2 CHANGELOG.md + +git config user.name github-actions +git config user.email github-actions@github.com +git add version/version.go CHANGELOG.md +git commit -m "release: v$newv" +git push + +git tag v$newv +git push origin v$newv:$newv --force diff --git a/tools/keeper/cmd/command.go b/tools/keeper/cmd/command.go new file mode 100644 index 000000000000..82d3efea1fd1 --- /dev/null +++ b/tools/keeper/cmd/command.go @@ -0,0 +1,461 @@ +package cmd + +import ( + "bytes" + "context" + "crypto/tls" + "fmt" + "io" + "net" + "net/http" + "net/url" + "strconv" + "sync" + "time" + + "github.com/sirupsen/logrus" + "github.com/taosdata/taoskeeper/db" + "github.com/taosdata/taoskeeper/infrastructure/config" + "github.com/taosdata/taoskeeper/infrastructure/log" + "github.com/taosdata/taoskeeper/util" + "github.com/taosdata/taoskeeper/util/pool" +) + +var logger = log.GetLogger("CMD") + +var MAX_SQL_LEN = 1000000 + +type Command struct { + fromTime time.Time + client *http.Client + conn *db.Connector + username string + password string + url *url.URL +} + +func NewCommand(conf *config.Config) *Command { + client := &http.Client{ + Transport: &http.Transport{ + Proxy: http.ProxyFromEnvironment, + DialContext: (&net.Dialer{ + Timeout: 30 * time.Second, + KeepAlive: 30 * time.Second, + }).DialContext, + IdleConnTimeout: 90 * time.Second, + TLSHandshakeTimeout: 10 * time.Second, + ExpectContinueTimeout: 1 * time.Second, + DisableCompression: true, + TLSClientConfig: &tls.Config{ + InsecureSkipVerify: true, + }, + }, + } + + conn, err := db.NewConnectorWithDb(conf.TDengine.Username, conf.TDengine.Password, conf.TDengine.Host, conf.TDengine.Port, conf.Metrics.Database.Name, conf.TDengine.Usessl) + if err != nil { + logger.Errorf("init db connect error, msg:%s", err) + panic(err) + } + + imp := &Command{ + client: client, + conn: conn, + username: conf.TDengine.Username, + password: conf.TDengine.Password, + url: &url.URL{ + Scheme: "http", + Host: fmt.Sprintf("%s:%d", conf.TDengine.Host, conf.TDengine.Port), + Path: "/influxdb/v1/write", + RawQuery: fmt.Sprintf("db=%s&precision=ms", conf.Metrics.Database.Name), + }, + } + return imp +} + +func (cmd *Command) Process(conf *config.Config) { + if len(conf.Transfer) > 0 && len(conf.Drop) > 0 { + logger.Errorf("transfer and drop can't be set at the same time") + return + } + + if len(conf.Transfer) > 0 && conf.Transfer != "old_taosd_metric" { + logger.Errorf("transfer only support old_taosd_metric") + return + } + + if conf.Transfer == "old_taosd_metric" { + cmd.ProcessTransfer(conf) + return + } + + if len(conf.Drop) > 0 && conf.Drop != "old_taosd_metric_stables" { + logger.Errorf("drop only support old_taosd_metric_stables") + return + } + + if conf.Drop == "old_taosd_metric_stables" { + cmd.ProcessDrop(conf) + return + } +} + +func (cmd *Command) ProcessTransfer(conf *config.Config) { + fromTime, err := time.Parse("2006-01-02T15:04:05Z07:00", conf.FromTime) + if err != nil { + logger.Errorf("parse fromTime error, msg:%s", err) + return + } + cmd.fromTime = fromTime + + funcs := []func() error{ + cmd.TransferTaosdClusterBasicInfo, + cmd.TransferTaosdClusterInfo, + cmd.TransferTaosdVgroupsInfo, + cmd.TransferTaosdDnodesInfo, + cmd.TransferTaosdDnodesStatus, + cmd.TransferTaosdDnodesLogDirs1, + cmd.TransferTaosdDnodesLogDirs2, + cmd.TransferTaosdDnodesDataDirs, + cmd.TransferTaosdMnodesInfo, + cmd.TransferTaosdVnodesInfo, + } + wg := sync.WaitGroup{} + wg.Add(len(funcs)) + + for i := range funcs { + index := i + err := pool.GoroutinePool.Submit(func() { + defer wg.Done() + funcs[index]() + }) + + if err != nil { + panic(err) + } + } + + wg.Wait() + logger.Info("transfer all old taosd metric success!!") +} + +func (cmd *Command) TransferTaosdClusterInfo() error { + sql := "select a.cluster_id, master_uptime * 3600 * 24 as cluster_uptime, dbs_total, tbs_total, stbs_total, dnodes_total, dnodes_alive, mnodes_total, mnodes_alive, vgroups_total, vgroups_alive, vnodes_total, vnodes_alive, connections_total, topics_total, streams_total, b.expire_time as grants_expire_time, b.timeseries_used as grants_timeseries_used, b.timeseries_total as grants_timeseries_total, a.ts from cluster_info a, grants_info b where a.ts = b.ts and a.cluster_id = b.cluster_id and" + dstTable := "taosd_cluster_info" + return cmd.TransferTableToDst(sql, dstTable, 1) +} + +func (cmd *Command) TransferTaosdVgroupsInfo() error { + sql := "select cluster_id, vgroup_id, database_name, tables_num, CASE status WHEN 'ready' THEN 1 ELSE 0 END as status, ts from vgroups_info a where " + dstTable := "taosd_vgroups_info" + return cmd.TransferTableToDst(sql, dstTable, 3) +} + +func (cmd *Command) TransferTaosdDnodesInfo() error { + sql := "select a.cluster_id, a.dnode_id, a.dnode_ep, uptime * 3600 * 24 as uptime, cpu_engine, cpu_system, cpu_cores, mem_engine, mem_system as mem_free, mem_total, disk_used, disk_total, disk_engine, net_in as system_net_in, net_out as system_net_out, io_read, io_write, io_read_disk, io_write_disk, vnodes_num, masters, has_mnode, has_qnode, has_snode, has_bnode, errors, b.error as error_log_count, b.info as info_log_count, b.debug as debug_log_count, b.trace as trace_log_count, a.ts as ts from dnodes_info a, log_summary b where a.ts = b.ts and a.dnode_id = b.dnode_id and a. dnode_ep = b.dnode_ep and " + dstTable := "taosd_dnodes_info" + return cmd.TransferTableToDst(sql, dstTable, 3) +} +func (cmd *Command) TransferTaosdDnodesStatus() error { + sql := "select cluster_id, dnode_id, dnode_ep, CASE status WHEN 'ready' THEN 1 ELSE 0 END as status, ts from d_info a where " + dstTable := "taosd_dnodes_status" + return cmd.TransferTableToDst(sql, dstTable, 3) +} + +func (cmd *Command) TransferTaosdDnodesLogDirs1() error { + sql := "select cluster_id, dnode_id, dnode_ep, name as log_dir_name, avail, used, total, ts from log_dir a where " + dstTable := "taosd_dnodes_log_dirs" + return cmd.TransferTableToDst(sql, dstTable, 4) +} +func (cmd *Command) TransferTaosdDnodesLogDirs2() error { + sql := "select cluster_id, dnode_id, dnode_ep, name as log_dir_name, avail, used, total, ts from temp_dir a where " + dstTable := "taosd_dnodes_log_dirs" + return cmd.TransferTableToDst(sql, dstTable, 4) +} + +func (cmd *Command) TransferTaosdDnodesDataDirs() error { + sql := "select cluster_id, dnode_id, dnode_ep, name as data_dir_name, `level` as data_dir_level, avail, used, total, ts from data_dir a where " + dstTable := "taosd_dnodes_data_dirs" + return cmd.TransferTableToDst(sql, dstTable, 5) +} + +func (cmd *Command) TransferTaosdMnodesInfo() error { + sql := "select cluster_id, mnode_id, mnode_ep, CASE role WHEN 'offline' THEN 0 WHEN 'follower' THEN 100 WHEN 'candidate' THEN 101 WHEN 'leader' THEN 102 WHEN 'learner' THEN 104 ELSE 103 END as role, ts from m_info a where " + dstTable := "taosd_mnodes_info" + return cmd.TransferTableToDst(sql, dstTable, 3) +} + +func (cmd *Command) TransferTaosdVnodesInfo() error { + sql := "select cluster_id, 0 as vgroup_id, 'UNKNOWN' as database_name, dnode_id, CASE vnode_role WHEN 'offline' THEN 0 WHEN 'follower' THEN 100 WHEN 'candidate' THEN 101 WHEN 'leader' THEN 102 WHEN 'learner' THEN 104 ELSE 103 END as role, ts from vnodes_role a where " + dstTable := "taosd_vnodes_info" + return cmd.TransferTableToDst(sql, dstTable, 4) +} + +func (cmd *Command) ProcessDrop(conf *config.Config) { + var dropStableList = []string{ + "log_dir", + "dnodes_info", + "data_dir", + "log_summary", + "m_info", + "vnodes_role", + "cluster_info", + "temp_dir", + "grants_info", + "vgroups_info", + "d_info", + "taosadapter_system_cpu_percent", + "taosadapter_restful_http_request_in_flight", + "taosadapter_restful_http_request_summary_milliseconds", + "taosadapter_restful_http_request_fail", + "taosadapter_system_mem_percent", + "taosadapter_restful_http_request_total", + } + ctx := context.Background() + logger.Infof("use database:%s", conf.Metrics.Database.Name) + + for _, stable := range dropStableList { + if _, err := cmd.conn.Exec(ctx, "DROP STABLE IF EXISTS "+stable, util.GetQidOwn()); err != nil { + logger.Errorf("drop stable %s, error:%s", stable, err) + panic(err) + } + } + logger.Info("drop old taosd metric stables success!!") +} + +func (cmd *Command) TransferDataToDest(data *db.Data, dstTable string, tagNum int) { + + var buf bytes.Buffer + + if len(data.Data) < 1 { + return + } + + for _, row := range data.Data { + // get one row here + buf.WriteString(dstTable) + + // write tags + var tag string + for j := 0; j < tagNum; j++ { + switch v := row[j].(type) { + case int: + tag = fmt.Sprint(v) + case int32: + tag = fmt.Sprint(v) + case int64: + tag = fmt.Sprint(v) + case string: + tag = v + default: + panic(fmt.Sprintf("Unexpected type for row[%d]: %T", j, row[j])) + } + + if tag != "" { + buf.WriteString(fmt.Sprintf(",%s=%s", data.Head[j], util.EscapeInfluxProtocol(tag))) + } else { + buf.WriteString(fmt.Sprintf(",%s=%s", data.Head[j], "unknown")) + logger.Errorf("tag value is empty, tag_name:%s", data.Head[j]) + } + } + buf.WriteString(" ") + + // write metrics + for j := tagNum; j < len(row)-1; j++ { + + switch v := row[j].(type) { + case int: + buf.WriteString(fmt.Sprintf("%s=%ff64", data.Head[j], float64(v))) + case int32: + buf.WriteString(fmt.Sprintf("%s=%ff64", data.Head[j], float64(v))) + case int64: + buf.WriteString(fmt.Sprintf("%s=%ff64", data.Head[j], float64(v))) + case float32: + buf.WriteString(fmt.Sprintf("%s=%sf64", data.Head[j], strconv.FormatFloat(float64(v), 'f', -1, 64))) + case float64: + buf.WriteString(fmt.Sprintf("%s=%sf64", data.Head[j], strconv.FormatFloat(v, 'f', -1, 64))) + default: + panic(fmt.Sprintf("Unexpected type for row[%d]: %T", j, row[j])) + } + + if j != len(row)-2 { + buf.WriteString(",") + } + } + + // write timestamp + buf.WriteString(" ") + buf.WriteString(fmt.Sprintf("%v", row[len(row)-1].(time.Time).UnixMilli())) + buf.WriteString("\n") + + if buf.Len() >= MAX_SQL_LEN { + if logger.Logger.IsLevelEnabled(logrus.TraceLevel) { + logger.Tracef("buf:%v", buf.String()) + } + err := cmd.lineWriteBody(&buf) + if err != nil { + logger.Errorf("insert data error, msg:%s", err) + panic(err) + } + buf.Reset() + } + } + + if buf.Len() > 0 { + if logger.Logger.IsLevelEnabled(logrus.TraceLevel) { + logger.Tracef("buf:%v", buf.String()) + } + err := cmd.lineWriteBody(&buf) + if err != nil { + logger.Errorf("insert data error, msg:%s", err) + panic(err) + } + } +} + +// cluster_info +func (cmd *Command) TransferTaosdClusterBasicInfo() error { + + ctx := context.Background() + + endTime := time.Now() + delta := time.Hour * 24 * 10 + + var createTableSql = "create stable if not exists taosd_cluster_basic " + + "(ts timestamp, first_ep varchar(100), first_ep_dnode_id INT, cluster_version varchar(20)) " + + "tags (cluster_id varchar(50))" + + if _, err := cmd.conn.Exec(ctx, createTableSql, util.GetQidOwn()); err != nil { + logger.Errorf("create taosd_cluster_basic error, msg:%s", err) + return err + } + + logger.Tracef("fromeTime:%d", cmd.fromTime.UnixMilli()) + + for current := cmd.fromTime; current.Before(endTime); current = current.Add(time.Duration(delta)) { + querySql := fmt.Sprintf("select cluster_id, first_ep, first_ep_dnode_id, `version` as cluster_version, ts from cluster_info where ts > %d and ts <= %d", + current.UnixMilli(), current.Add(time.Duration(delta)).UnixMilli()) + logger.Tracef("query sql:%s", querySql) + data, err := cmd.conn.Query(ctx, querySql, util.GetQidOwn()) + if err != nil { + logger.Errorf("query cluster_info error, msg:%s", err) + return err + } + + // transfer data to new table, only this table need use insert statement + var buf bytes.Buffer + + // 使用 map 将二维数组切分为多个二维数组 + result := make(map[string][][]interface{}) + for _, row := range data.Data { + key := row[0].(string) // 使用第一列的值作为 key + result[key] = append(result[key], row) + } + + // 按照不同 tag 来迁移数据 + for _, dataByCluster := range result { + buf.Reset() + + for _, row := range dataByCluster { + if len(buf.Bytes()) == 0 { + sql := fmt.Sprintf( + "insert into taosd_cluster_basic_%s using taosd_cluster_basic tags ('%s') values ", + row[0].(string), row[0].(string)) + + buf.WriteString(sql) + } + + sql := fmt.Sprintf( + "(%d, '%s', %d, '%s')", + row[4].(time.Time).UnixMilli(), row[1].(string), row[2].(int32), row[3].(string)) + buf.WriteString(sql) + + if buf.Len() >= MAX_SQL_LEN { + rowsAffected, err := cmd.conn.Exec(context.Background(), buf.String(), util.GetQidOwn()) + if err != nil { + logger.Errorf("insert taosd_cluster_basic error, msg:%s", err) + return err + } + if rowsAffected <= 0 { + logger.Errorf("insert taosd_cluster_basic failed, rowsAffected:%d", rowsAffected) + } + buf.Reset() + } + } + + if buf.Len() > 0 { + rowsAffected, err := cmd.conn.Exec(context.Background(), buf.String(), util.GetQidOwn()) + if err != nil { + logger.Errorf("insert taosd_cluster_basic error, msg:%s", err) + return err + } + if rowsAffected <= 0 { + logger.Errorf("insert taosd_cluster_basic failed, rowsAffected:%d", rowsAffected) + } + } + } + } + + logger.Info("transfer stable taosd_cluster_basic success!!") + return nil +} + +// cluster_info +func (cmd *Command) TransferTableToDst(sql string, dstTable string, tagNum int) error { + + ctx := context.Background() + + endTime := time.Now() + delta := time.Hour * 24 * 10 + + logger.Tracef("fromTime:%d", cmd.fromTime.UnixMilli()) + + for current := cmd.fromTime; current.Before(endTime); current = current.Add(time.Duration(delta)) { + querySql := fmt.Sprintf(sql+" a.ts > %d and a.ts <= %d", + current.UnixMilli(), current.Add(time.Duration(delta)).UnixMilli()) + logger.Tracef("query sql:%s", querySql) + data, err := cmd.conn.Query(ctx, querySql, util.GetQidOwn()) + if err != nil { + logger.Errorf("query cluster_info error, msg:%s", err) + return err + } + + // transfer data to new table, only this table need use insert statement + cmd.TransferDataToDest(data, dstTable, tagNum) + } + + logger.Info("transfer stable " + dstTable + " success!!") + return nil +} + +func (cmd *Command) lineWriteBody(buf *bytes.Buffer) error { + header := map[string][]string{ + "Connection": {"keep-alive"}, + } + + req := &http.Request{ + Method: http.MethodPost, + URL: cmd.url, + Proto: "HTTP/1.1", + ProtoMajor: 1, + ProtoMinor: 1, + Header: header, + Host: cmd.url.Host, + } + req.SetBasicAuth(cmd.username, cmd.password) + + req.Body = io.NopCloser(buf) + resp, err := cmd.client.Do(req) + + if err != nil { + logger.Errorf("writing metrics exception, msg:%s", err) + return err + } + + defer resp.Body.Close() + if resp.StatusCode != http.StatusNoContent { + body, _ := io.ReadAll(resp.Body) + return fmt.Errorf("unexpected status code %d:body:%s", resp.StatusCode, string(body)) + } + return nil +} diff --git a/tools/keeper/cmd/empty_test.go b/tools/keeper/cmd/empty_test.go new file mode 100644 index 000000000000..143df6893c2e --- /dev/null +++ b/tools/keeper/cmd/empty_test.go @@ -0,0 +1,8 @@ +package cmd + +import ( + "testing" +) + +func TestEmpty(t *testing.T) { +} diff --git a/tools/keeper/config/metrics.sample b/tools/keeper/config/metrics.sample new file mode 100644 index 000000000000..9dbfea2323df --- /dev/null +++ b/tools/keeper/config/metrics.sample @@ -0,0 +1,38 @@ +prefix = "taos" +cluster = "localhost" +database = "log" +explicit = false + +[tables.restful_info] +[tables.slowquery] +[tables.cluster_info] +[tables.grants_info] +[tables.disks_info] + +[tables.logs] +explicit = true +[tables.logs.metrics.content] +type = "info" +help = "login types or messages" +[tables.logs.metrics.level] +type = "gauge" +help = "login level" + +[tables.dnodes_info] +[tables.dnodes_info.metrics.has_mnode] +type = "gauge" +help = "check if the node has mnode" + +[tables.vgroups_info] +column_as_variables = ["database_name", "dnode_roles", "dnode_ids"] +explicit = false + +[tables.vgroups_info.metrics.tables_num] +type = "gauge" +help = "Tables count of the vgroup" +[tables.vgroups_info.metrics.online_vnodes] +type = "gauge" +help = "Online v-nodes of the v-group" +[tables.vgroups_info.metrics.status] +type = "info" +help = "Status of the v-group" diff --git a/tools/keeper/config/taoskeeper.toml b/tools/keeper/config/taoskeeper.toml new file mode 100644 index 000000000000..89847db2d5e2 --- /dev/null +++ b/tools/keeper/config/taoskeeper.toml @@ -0,0 +1,53 @@ +instanceId = 64 + +# Listen port, default is 6043 +port = 6043 + +# go pool size +gopoolsize = 50000 + +# interval for metrics +RotationInterval = "15s" + +[tdengine] +host = "127.0.0.1" +port = 6041 +username = "root" +password = "taosdata" +usessl = false + +[metrics] +# metrics prefix in metrics names. +prefix = "taos" + +# export some tables that are not super table +tables = [] + +# database for storing metrics data +[metrics.database] +name = "log" +# database options for db storing metrics data +[metrics.database.options] +vgroups = 1 +buffer = 64 +keep = 90 +cachemodel = "both" + +[environment] +# Whether running in cgroup. +incgroup = false + +[log] +# The directory where log files are stored. +# path = "/var/log/taos" +level = "info" +# Number of log file rotations before deletion. +rotationCount = 30 +# The number of days to retain log files. +keepDays = 30 +# The maximum size of a log file before rotation. +rotationSize = "1GB" +# If set to true, log files will be compressed. +compress = false +# Minimum disk space to reserve. Log files will not be written if disk space falls below this limit. +reservedDiskSize = "1GB" diff --git a/tools/keeper/config/taoskeeper_enterprise.toml b/tools/keeper/config/taoskeeper_enterprise.toml new file mode 100644 index 000000000000..6601b60cd89d --- /dev/null +++ b/tools/keeper/config/taoskeeper_enterprise.toml @@ -0,0 +1,65 @@ +instanceId = 64 + +# Listen port, default is 6043 +port = 6043 + +# go pool size +gopoolsize = 50000 + +# interval for TDengine metrics +RotationInterval = "15s" + +[tdengine] +host = "127.0.0.1" +port = 6041 +username = "root" +password = "taosdata" +usessl = false + +[metrics] +# metrics prefix in metrics names. +prefix = "taos" + +# cluster identifier for multiple TDengine clusters +cluster = "" + +# export some tables that are not super table +tables = [] + +# database for storing metrics data +[metrics.database] +name = "log" +# database options for db storing metrics data +[metrics.database.options] +vgroups = 1 +buffer = 64 +keep = 90 +cachemodel = "both" + +[environment] +# Whether running in cgroup. +incgroup = false + +[audit] +enable = true +[audit.database] +name = "audit" +[audit.database.options] +vgroups = 1 +buffer = 16 +cachemodel = "both" + +[log] +# The directory where log files are stored. +# path = "/var/log/taos" +level = "info" +# Number of log file rotations before deletion. +rotationCount = 30 +# The number of days to retain log files. +keepDays = 30 +# The maximum size of a log file before rotation. +rotationSize = "1GB" +# If set to true, log files will be compressed. +compress = false +# Minimum disk space to reserve. Log files will not be written if disk space falls below this limit. +reservedDiskSize = "1GB" diff --git a/tools/keeper/dashboards/tdengine-taoskeeper-prometheus-dashboard.json b/tools/keeper/dashboards/tdengine-taoskeeper-prometheus-dashboard.json new file mode 100644 index 000000000000..153778915f3d --- /dev/null +++ b/tools/keeper/dashboards/tdengine-taoskeeper-prometheus-dashboard.json @@ -0,0 +1,5365 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": "-- Grafana --", + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "target": { + "limit": 100, + "matchAny": false, + "tags": [], + "type": "dashboard" + }, + "type": "dashboard" + } + ] + }, + "editable": true, + "fiscalYearStartMonth": 0, + "gnetId": null, + "graphTooltip": 0, + "id": 3, + "iteration": 1643173897059, + "links": [], + "liveNow": false, + "panels": [ + { + "datasource": "Prometheus", + "gridPos": { + "h": 3, + "w": 24, + "x": 0, + "y": 0 + }, + "id": 32, + "options": { + "content": "

    TDengine Cluster Dashboard (First EP: ${firstEp}, Version: ${version})

    ", + "mode": "markdown" + }, + "pluginVersion": "8.2.2", + "repeatDirection": "h", + "targets": [ + { + "alias": "mnodes", + "formatType": "Time series", + "queryType": "SQL", + "refId": "A", + "sql": "show mnodes", + "target": "select metric", + "timeshift": { + "period": null + }, + "type": "timeserie" + } + ], + "timeFrom": null, + "timeShift": null, + "title": "-- OVERVIEW --", + "transformations": [ + { + "id": "calculateField", + "options": { + "binary": { + "left": "Time", + "operator": "+", + "reducer": "sum", + "right": "" + }, + "mode": "binary", + "reduce": { + "reducer": "sum" + } + } + } + ], + "type": "text" + }, + { + "collapsed": false, + "datasource": "Prometheus", + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 3 + }, + "id": 57, + "panels": [], + "title": "Cluster Status", + "type": "row" + }, + { + "datasource": "Prometheus", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 4, + "w": 3, + "x": 0, + "y": 4 + }, + "id": 73, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "last" + ], + "fields": "/.*/", + "values": false + }, + "text": {}, + "textMode": "auto" + }, + "pluginVersion": "8.2.2", + "targets": [ + { + "colNameFormatStr": "", + "colNameToGroup": "", + "exemplar": true, + "expr": "taos_cluster_info_first_ep{cluster=\"$cluster\"}", + "format": "table", + "formatType": "Time series", + "instant": false, + "interval": "", + "legendFormat": "", + "queryType": "SQL", + "refId": "A", + "sql": "label_values(taos_cluster_info_first_ep{cluster=\"$cluster\"}, value)", + "target": "select metric", + "type": "timeserie" + } + ], + "title": "First EP", + "transformations": [ + { + "id": "filterFieldsByName", + "options": { + "include": { + "names": [ + "value" + ] + } + } + } + ], + "type": "stat" + }, + { + "datasource": "Prometheus", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "s" + }, + "overrides": [] + }, + "gridPos": { + "h": 4, + "w": 3, + "x": 3, + "y": 4 + }, + "id": 74, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "/.*/", + "values": false + }, + "text": {}, + "textMode": "auto" + }, + "pluginVersion": "8.2.2", + "targets": [ + { + "colNameFormatStr": "", + "colNameToGroup": "", + "exemplar": true, + "expr": "taos_cluster_info_version{cluster=\"$cluster\"}", + "format": "table", + "formatType": "Time series", + "interval": "", + "legendFormat": "", + "queryType": "SQL", + "refId": "A", + "sql": "select last(version) from log.cluster_info", + "target": "select metric", + "type": "timeserie" + } + ], + "title": "Version", + "transformations": [ + { + "id": "filterFieldsByName", + "options": { + "include": { + "names": [ + "value" + ] + } + } + } + ], + "type": "stat" + }, + { + "datasource": "Prometheus", + "description": "MNode 被选举后经过的时长", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "s" + }, + "overrides": [] + }, + "gridPos": { + "h": 4, + "w": 3, + "x": 6, + "y": 4 + }, + "id": 72, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "text": {}, + "textMode": "auto" + }, + "pluginVersion": "8.2.2", + "targets": [ + { + "colNameFormatStr": "", + "colNameToGroup": "", + "exemplar": true, + "expr": "taos_cluster_info_master_uptime{cluster=\"$cluster\"}", + "formatType": "Time series", + "interval": "", + "legendFormat": "", + "queryType": "SQL", + "refId": "A", + "sql": "select last(master_uptime) from log.cluster_info", + "target": "select metric", + "type": "timeserie" + } + ], + "title": "Master Uptime", + "transformations": [ + { + "id": "reduce", + "options": { + "includeTimeField": false, + "mode": "reduceFields", + "reducers": [ + "lastNotNull" + ] + } + } + ], + "type": "stat" + }, + { + "datasource": "Prometheus", + "description": "企业版授权到期时间", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "s" + }, + "overrides": [] + }, + "gridPos": { + "h": 4, + "w": 3, + "x": 9, + "y": 4 + }, + "id": 99, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "text": {}, + "textMode": "auto" + }, + "pluginVersion": "8.2.2", + "targets": [ + { + "colNameFormatStr": "", + "colNameToGroup": "", + "exemplar": true, + "expr": "taos_grants_info_expire_time{cluster=\"$cluster\"}", + "formatType": "Time series", + "interval": "", + "legendFormat": "", + "queryType": "SQL", + "refId": "A", + "sql": "select last(expire_time) from log.grants_info", + "target": "select metric", + "type": "timeserie" + } + ], + "title": "Expire Time", + "transformations": [], + "type": "stat" + }, + { + "datasource": "Prometheus", + "description": "企业版授权已用测点数", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "none" + }, + "overrides": [ + { + "matcher": { + "id": "byFrameRefID", + "options": "A" + }, + "properties": [ + { + "id": "noValue", + "value": "unlimited" + } + ] + } + ] + }, + "gridPos": { + "h": 4, + "w": 4, + "x": 12, + "y": 4 + }, + "id": 100, + "options": { + "displayMode": "gradient", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "last" + ], + "fields": "", + "values": false + }, + "showUnfilled": true, + "text": {} + }, + "pluginVersion": "8.2.2", + "targets": [ + { + "colNameFormatStr": "", + "colNameToGroup": "", + "exemplar": true, + "expr": "taos_dnodes_info_disk_engine", + "formatType": "Time series", + "interval": "", + "legendFormat": "used", + "queryType": "SQL", + "refId": "A", + "sql": "select max(timeseries_used) as used ,max(timeseries_total) as total from log.grants_info where ts >= $from and ts <= $to interval(30s)", + "target": "select metric", + "type": "timeserie" + }, + { + "exemplar": true, + "expr": "taos_dnodes_info_disk_total", + "hide": false, + "interval": "", + "legendFormat": "total", + "refId": "B" + } + ], + "title": "Used Meassuring Points", + "transformations": [], + "type": "bargauge" + }, + { + "datasource": "Prometheus", + "description": "数据库个数", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 4, + "w": 2, + "x": 16, + "y": 4 + }, + "id": 65, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "text": {}, + "textMode": "auto" + }, + "pluginVersion": "8.2.2", + "repeatDirection": "h", + "targets": [ + { + "alias": "dnodes", + "colNameFormatStr": "", + "colNameToGroup": "", + "exemplar": true, + "expr": "count(taos_vgroups_info_status{cluster=\"$cluster\"})", + "format": "time_series", + "formatType": "Time series", + "instant": false, + "interval": "", + "legendFormat": "databases", + "queryType": "SQL", + "refId": "A", + "sql": "show databases;", + "target": "select metric", + "timeshift": { + "period": null + }, + "type": "timeserie" + } + ], + "timeFrom": null, + "timeShift": null, + "title": "Databases", + "transformations": [ + { + "id": "filterFieldsByName", + "options": { + "include": { + "names": [ + "Time", + "databases" + ] + } + } + } + ], + "type": "stat" + }, + { + "datasource": "Prometheus", + "description": "所有数据库的表数量之和", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 4, + "w": 3, + "x": 18, + "y": 4 + }, + "id": 68, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "text": {}, + "textMode": "auto" + }, + "pluginVersion": "8.2.2", + "repeatDirection": "h", + "targets": [ + { + "alias": "dnodes", + "colNameFormatStr": "", + "colNameToGroup": "", + "exemplar": true, + "expr": "sum(taos_tables_per_database{cluster=\"$cluster\"})", + "formatType": "Time series", + "interval": "", + "legendFormat": "", + "queryType": "SQL", + "refId": "A", + "sql": "show databases;", + "target": "select metric", + "timeshift": { + "period": null + }, + "type": "timeserie" + } + ], + "timeFrom": null, + "timeShift": null, + "title": "Tables", + "transformations": [], + "type": "stat" + }, + { + "datasource": "Prometheus", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "none" + }, + "overrides": [] + }, + "gridPos": { + "h": 4, + "w": 3, + "x": 21, + "y": 4 + }, + "id": 82, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "/.*/", + "values": false + }, + "text": {}, + "textMode": "auto" + }, + "pluginVersion": "8.2.2", + "targets": [ + { + "colNameFormatStr": "", + "colNameToGroup": "", + "exemplar": true, + "expr": "", + "formatType": "Time series", + "interval": "", + "legendFormat": "", + "queryType": "SQL", + "refId": "A", + "sql": "select connections_total from log.cluster_info where ts >= $from and ts <= $to", + "target": "select metric", + "type": "timeserie" + } + ], + "title": "Connections", + "type": "stat" + }, + { + "datasource": "Prometheus", + "description": "当前TDengine集群DNode数量,Alive 为存活,Total 为所有", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 4, + "w": 6, + "x": 0, + "y": 8 + }, + "id": 75, + "options": { + "displayMode": "basic", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showUnfilled": true, + "text": {} + }, + "pluginVersion": "8.2.2", + "targets": [ + { + "alias": "", + "colNameFormatStr": "", + "colNameToGroup": "", + "exemplar": true, + "expr": "taos_cluster_info_dnodes_total", + "formatType": "Time series", + "interval": "", + "legendFormat": "", + "queryType": "SQL", + "refId": "A", + "sql": "select dnodes_total as total,dnodes_alive as alive from log.cluster_info where ts >= $from and ts <= $to", + "target": "select metric", + "type": "timeserie" + } + ], + "timeFrom": null, + "timeShift": null, + "title": "DNodes", + "transformations": [], + "type": "bargauge" + }, + { + "datasource": "Prometheus", + "description": "当前TDengine集群MNode数量,Alive 为存活,Total 为所有", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 4, + "w": 6, + "x": 6, + "y": 8 + }, + "id": 101, + "options": { + "displayMode": "basic", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showUnfilled": true, + "text": {} + }, + "pluginVersion": "8.2.2", + "targets": [ + { + "alias": "", + "colNameFormatStr": "", + "colNameToGroup": "", + "exemplar": true, + "expr": "taos_cluster_info_mnodes_total{cluster=\"$cluster\"}", + "formatType": "Time series", + "interval": "", + "legendFormat": "", + "queryType": "SQL", + "refId": "A", + "sql": "select mnodes_total as total,mnodes_alive as alive from log.cluster_info where ts >= $from and ts <= $to", + "target": "select metric", + "type": "timeserie" + } + ], + "timeFrom": null, + "timeShift": null, + "title": "MNodes", + "transformations": [], + "type": "bargauge" + }, + { + "datasource": "Prometheus", + "description": "当前TDengine集群 VGroups 数量,Alive 为存活,Total 为所有", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 4, + "w": 6, + "x": 12, + "y": 8 + }, + "id": 102, + "options": { + "displayMode": "basic", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showUnfilled": true, + "text": {} + }, + "pluginVersion": "8.2.2", + "targets": [ + { + "alias": "", + "colNameFormatStr": "", + "colNameToGroup": "", + "exemplar": true, + "expr": "count(count(taos_vgroups_info_status{cluster=\"$cluster\"}) by (vgroup_id))", + "formatType": "Time series", + "interval": "", + "legendFormat": "", + "queryType": "SQL", + "refId": "A", + "sql": "select vgroups_total as total, vgroups_alive as alive from log.cluster_info where ts >= $from and ts <= $to", + "target": "select metric", + "type": "timeserie" + } + ], + "timeFrom": null, + "timeShift": null, + "title": "VGroups", + "transformations": [], + "type": "bargauge" + }, + { + "datasource": "Prometheus", + "description": "当前TDengine集群 VNodes 数量,Alive 为存活,Total 为所有", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 4, + "w": 6, + "x": 18, + "y": 8 + }, + "id": 103, + "options": { + "displayMode": "basic", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showUnfilled": true, + "text": {} + }, + "pluginVersion": "8.2.2", + "targets": [ + { + "alias": "", + "colNameFormatStr": "", + "colNameToGroup": "", + "exemplar": true, + "expr": "sum(taos_vgroups_info_online_vnodes{cluster=\"$cluster\"})", + "formatType": "Time series", + "interval": "", + "legendFormat": "", + "queryType": "SQL", + "refId": "A", + "sql": "select vnodes_total as total, vnodes_alive as alive from log.cluster_info where ts >= $from and ts <= $to", + "target": "select metric", + "type": "timeserie" + } + ], + "timeFrom": null, + "timeShift": null, + "title": "VNodes", + "transformations": [], + "type": "bargauge" + }, + { + "alert": { + "alertRuleTags": {}, + "conditions": [ + { + "evaluator": { + "params": [ + 1 + ], + "type": "lt" + }, + "operator": { + "type": "and" + }, + "query": { + "params": [ + "A", + "1m", + "now" + ] + }, + "reducer": { + "params": [], + "type": "avg" + }, + "type": "query" + } + ], + "executionErrorState": "alerting", + "for": "1m", + "frequency": "10s", + "handler": 1, + "name": "DNodes Alive Percent alert", + "noDataState": "no_data", + "notifications": [] + }, + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 6, + "w": 6, + "x": 0, + "y": 12 + }, + "hiddenSeries": false, + "id": 84, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "8.2.2", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "colNameFormatStr": "", + "colNameToGroup": "", + "exemplar": true, + "expr": "taos_cluster_info_dnodes_alive / taos_cluster_info_dnodes_total", + "formatType": "Time series", + "interval": "", + "legendFormat": "", + "queryType": "SQL", + "refId": "A", + "sql": "select avg(dnodes_alive)/avg(dnodes_total) from log.cluster_info where ts >= $from and ts <= $to interval(30s) fill(null)", + "target": "select metric", + "type": "timeserie" + } + ], + "thresholds": [ + { + "colorMode": "critical", + "fill": true, + "line": true, + "op": "lt", + "value": 1, + "visible": true + } + ], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "DNodes Alive Percent", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:71", + "format": "percentunit", + "label": null, + "logBase": 1, + "max": "1", + "min": "0", + "show": true + }, + { + "$$hashKey": "object:72", + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "alert": { + "alertRuleTags": {}, + "conditions": [ + { + "evaluator": { + "params": [ + 1 + ], + "type": "lt" + }, + "operator": { + "type": "and" + }, + "query": { + "params": [ + "A", + "1m", + "now" + ] + }, + "reducer": { + "params": [], + "type": "avg" + }, + "type": "query" + } + ], + "executionErrorState": "alerting", + "for": "1m", + "frequency": "10s", + "handler": 1, + "name": "MNodes Alive Percent alert", + "noDataState": "no_data", + "notifications": [] + }, + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 6, + "w": 6, + "x": 6, + "y": 12 + }, + "hiddenSeries": false, + "id": 87, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "8.2.2", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "alias": "", + "colNameFormatStr": "", + "colNameToGroup": "", + "exemplar": true, + "expr": "taos_cluster_info_mnodes_alive / taos_cluster_info_mnodes_total", + "formatType": "Time series", + "interval": "", + "legendFormat": "", + "queryType": "SQL", + "refId": "A", + "sql": "select avg(mnodes_alive)/avg(mnodes_total) from log.cluster_info where ts >= $from and ts <= $to interval(30s) fill(null)", + "target": "select metric", + "type": "timeserie" + } + ], + "thresholds": [ + { + "colorMode": "critical", + "fill": true, + "line": true, + "op": "lt", + "value": 1, + "visible": true + } + ], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "MNodes Alive Percent", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:221", + "format": "percentunit", + "label": null, + "logBase": 1, + "max": "1", + "min": "0", + "show": true + }, + { + "$$hashKey": "object:222", + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "alert": { + "alertRuleTags": {}, + "conditions": [ + { + "evaluator": { + "params": [ + 1 + ], + "type": "lt" + }, + "operator": { + "type": "and" + }, + "query": { + "params": [ + "A", + "1m", + "now" + ] + }, + "reducer": { + "params": [], + "type": "avg" + }, + "type": "query" + } + ], + "executionErrorState": "alerting", + "for": "1m", + "frequency": "10s", + "handler": 1, + "name": "VGroups Alive Percent alert", + "noDataState": "no_data", + "notifications": [] + }, + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 6, + "w": 6, + "x": 12, + "y": 12 + }, + "hiddenSeries": false, + "id": 85, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "8.2.2", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "alias": "", + "colNameFormatStr": "", + "colNameToGroup": "", + "exemplar": true, + "expr": "taos_cluster_info_vgroups_alive / taos_cluster_info_vgroups_total", + "formatType": "Time series", + "interval": "", + "legendFormat": "", + "queryType": "SQL", + "refId": "A", + "sql": "select avg(vgroups_alive)/avg(vgroups_total) from log.cluster_info where ts >= $from and ts <= $to interval(30s) fill(null)", + "target": "select metric", + "type": "timeserie" + } + ], + "thresholds": [ + { + "colorMode": "critical", + "fill": true, + "line": true, + "op": "lt", + "value": 1, + "visible": true + } + ], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "VGroups Alive Percent", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:256", + "format": "percentunit", + "label": null, + "logBase": 1, + "max": "1", + "min": "0", + "show": true + }, + { + "$$hashKey": "object:257", + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "alert": { + "alertRuleTags": {}, + "conditions": [ + { + "evaluator": { + "params": [ + 1 + ], + "type": "lt" + }, + "operator": { + "type": "and" + }, + "query": { + "params": [ + "A", + "1m", + "now" + ] + }, + "reducer": { + "params": [], + "type": "avg" + }, + "type": "query" + } + ], + "executionErrorState": "alerting", + "for": "1m", + "frequency": "10s", + "handler": 1, + "name": "VNodes Alive Percent alert", + "noDataState": "no_data", + "notifications": [] + }, + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 6, + "w": 6, + "x": 18, + "y": 12 + }, + "hiddenSeries": false, + "id": 86, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "8.2.2", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "alias": "", + "colNameFormatStr": "", + "colNameToGroup": "", + "exemplar": true, + "expr": "taos_cluster_info_vnodes_alive / taos_cluster_info_vnodes_total", + "formatType": "Time series", + "interval": "", + "legendFormat": "", + "queryType": "SQL", + "refId": "A", + "sql": "select avg(vnodes_alive)/avg(vnodes_total) from log.cluster_info where ts >= $from and ts <= $to interval(30s) fill(null)", + "target": "select metric", + "type": "timeserie" + } + ], + "thresholds": [ + { + "colorMode": "critical", + "fill": true, + "line": true, + "op": "lt", + "value": 1, + "visible": true + } + ], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "VNodes Alive Percent", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:291", + "format": "percentunit", + "label": null, + "logBase": 1, + "max": "1", + "min": "0", + "show": true + }, + { + "$$hashKey": "object:292", + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "alert": { + "alertRuleTags": {}, + "conditions": [ + { + "evaluator": { + "params": [ + 0.95 + ], + "type": "gt" + }, + "operator": { + "type": "and" + }, + "query": { + "params": [ + "A", + "1m", + "now" + ] + }, + "reducer": { + "params": [], + "type": "avg" + }, + "type": "query" + }, + { + "evaluator": { + "params": [ + 0, + 1 + ], + "type": "within_range" + }, + "operator": { + "type": "and" + }, + "query": { + "params": [ + "A", + "1m", + "now" + ] + }, + "reducer": { + "params": [], + "type": "avg" + }, + "type": "query" + } + ], + "executionErrorState": "keep_state", + "for": "1m", + "frequency": "10s", + "handler": 1, + "name": "DNodes Alive Percent alert", + "noDataState": "ok", + "notifications": [] + }, + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 6, + "w": 6, + "x": 0, + "y": 18 + }, + "hiddenSeries": false, + "id": 104, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "8.2.2", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "colNameFormatStr": "", + "colNameToGroup": "", + "exemplar": true, + "expr": "taos_grants_info_timeseries_used / taos_grants_info_timeseries_total {cluster=\"$cluster\"}", + "formatType": "Time series", + "interval": "", + "legendFormat": "percent", + "queryType": "SQL", + "refId": "A", + "sql": "select avg(timeseries_used)/avg(timeseries_total) as percent from log.grants_info where ts >= $from and ts <= $to interval(30s) fill(null)", + "target": "select metric", + "type": "timeserie" + } + ], + "thresholds": [ + { + "colorMode": "critical", + "fill": true, + "line": true, + "op": "gt", + "value": 0.95, + "visible": true + } + ], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Messuring Points Used Percent Alert", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:333", + "decimals": null, + "format": "percentunit", + "label": null, + "logBase": 1, + "max": "1", + "min": "0", + "show": true + }, + { + "$$hashKey": "object:334", + "format": "percentunit", + "label": null, + "logBase": 1, + "max": "1", + "min": "0", + "show": false + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "alert": { + "alertRuleTags": {}, + "conditions": [ + { + "evaluator": { + "params": [ + 86400 + ], + "type": "lt" + }, + "operator": { + "type": "and" + }, + "query": { + "params": [ + "A", + "1m", + "now" + ] + }, + "reducer": { + "params": [], + "type": "min" + }, + "type": "query" + } + ], + "executionErrorState": "keep_state", + "for": "1m", + "frequency": "10s", + "handler": 1, + "name": "Grants Expire Time alert", + "noDataState": "no_data", + "notifications": [] + }, + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 6, + "w": 6, + "x": 6, + "y": 18 + }, + "hiddenSeries": false, + "id": 105, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "8.2.2", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [ + { + "$$hashKey": "object:368", + "alias": "percent", + "yaxis": 2 + } + ], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "colNameFormatStr": "", + "colNameToGroup": "", + "exemplar": true, + "expr": "taos_grants_info_expire_time", + "formatType": "Time series", + "interval": "", + "legendFormat": "", + "queryType": "SQL", + "refId": "A", + "sql": "select last(expire_time) as expire_time from log.grants_info where ts >= $from and ts <= $to interval(30s) fill(null)", + "target": "select metric", + "type": "timeserie" + } + ], + "thresholds": [ + { + "colorMode": "critical", + "fill": true, + "line": true, + "op": "lt", + "value": 86400, + "visible": true + } + ], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Grants Expire Time", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:375", + "decimals": null, + "format": "s", + "label": null, + "logBase": 1, + "max": null, + "min": "0", + "show": true + }, + { + "$$hashKey": "object:376", + "format": "percentunit", + "label": null, + "logBase": 1, + "max": "1", + "min": "0", + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "alert": { + "alertRuleTags": {}, + "conditions": [ + { + "evaluator": { + "params": [ + 10 + ], + "type": "gt" + }, + "operator": { + "type": "and" + }, + "query": { + "params": [ + "A", + "1m", + "now" + ] + }, + "reducer": { + "params": [], + "type": "avg" + }, + "type": "query" + } + ], + "executionErrorState": "alerting", + "for": "1m", + "frequency": "10s", + "handler": 1, + "name": "Error Rate alert", + "noDataState": "no_data", + "notifications": [] + }, + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "description": "错误率(每秒错误数)", + "fieldConfig": { + "defaults": { + "unit": "cps" + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 6, + "w": 6, + "x": 12, + "y": 18 + }, + "hiddenSeries": false, + "id": 106, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "8.2.2", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [ + { + "$$hashKey": "object:410", + "alias": "percent", + "yaxis": 2 + } + ], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "colNameFormatStr": "", + "colNameToGroup": "", + "exemplar": true, + "expr": "deriv(taos_dnodes_info_errors{cluster=\"$cluster\"}[1m])", + "formatType": "Time series", + "interval": "", + "legendFormat": "", + "queryType": "SQL", + "refId": "A", + "sql": "select derivative(errors, 1s, 1) as errors from (select sum(errors) as errors from log.dnodes_info where ts >= $from and ts <= $to interval(1s))", + "target": "select metric", + "type": "timeserie" + } + ], + "thresholds": [ + { + "colorMode": "critical", + "fill": true, + "line": true, + "op": "gt", + "value": 10, + "visible": true + } + ], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Error Rate", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:417", + "decimals": null, + "format": "cps", + "label": null, + "logBase": 1, + "max": null, + "min": "0", + "show": true + }, + { + "$$hashKey": "object:418", + "format": "percentunit", + "label": null, + "logBase": 1, + "max": "1", + "min": "0", + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "collapsed": false, + "datasource": "Prometheus", + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 24 + }, + "id": 24, + "panels": [], + "repeat": null, + "title": "DNodes Overview", + "type": "row" + }, + { + "datasource": "Prometheus", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "s" + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 4, + "x": 0, + "y": 25 + }, + "id": 90, + "options": { + "colorMode": "value", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "text": {}, + "textMode": "value_and_name" + }, + "pluginVersion": "8.2.2", + "repeat": null, + "targets": [ + { + "alias": "", + "colNameFormatStr": "{{groupValue}}", + "colNameToGroup": "dnode_ep", + "exemplar": true, + "expr": "taos_dnodes_info_uptime{cluster=\"$cluster\"}", + "formatType": "Time series", + "interval": "", + "legendFormat": "{{dnode_ep}}", + "queryType": "SQL", + "refId": "A", + "sql": "select last(uptime) from log.dnodes_info where ts >= now -1m and ts <= now group by dnode_ep", + "target": "select metric", + "type": "timeserie" + } + ], + "timeFrom": null, + "timeShift": null, + "title": "DNodes Lifetime", + "type": "stat" + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "fieldConfig": { + "defaults": { + "unit": "short" + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 6, + "w": 10, + "x": 4, + "y": 25 + }, + "hiddenSeries": false, + "id": 88, + "legend": { + "alignAsTable": true, + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "8.2.2", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "colNameFormatStr": "", + "colNameToGroup": "", + "exemplar": true, + "expr": "taos_cluster_info_dnodes_total{cluster=\"$cluster\"}", + "formatType": "Time series", + "interval": "", + "legendFormat": "total", + "queryType": "SQL", + "refId": "A", + "sql": "select avg(dnodes_total) as total, avg(dnodes_alive) as alive from log.cluster_info where ts >= $from and ts <= $to interval($interval) fill(null)", + "target": "select metric", + "type": "timeserie" + }, + { + "colNameFormatStr": "", + "colNameToGroup": "", + "exemplar": true, + "expr": "taos_cluster_info_dnodes_alive{cluster=\"$cluster\"}", + "formatType": "Time series", + "hide": false, + "interval": "", + "legendFormat": "alive", + "queryType": "SQL", + "refId": "B", + "sql": "select avg(dnodes_total) as total, avg(dnodes_alive) as alive from log.cluster_info where ts >= $from and ts <= $to interval($interval) fill(null)", + "target": "select metric", + "type": "timeserie" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "DNodes Number", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:128", + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "$$hashKey": "object:129", + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": false + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "fieldConfig": { + "defaults": { + "unit": "short" + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 6, + "w": 10, + "x": 14, + "y": 25 + }, + "hiddenSeries": false, + "id": 89, + "legend": { + "alignAsTable": true, + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "8.2.2", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "colNameFormatStr": "", + "colNameToGroup": "", + "exemplar": true, + "expr": "taos_cluster_info_mnodes_total{cluster=\"$cluster\"}", + "formatType": "Time series", + "interval": "", + "legendFormat": "total", + "queryType": "SQL", + "refId": "A", + "sql": "select avg(mnodes_total) as total, avg(mnodes_alive) as alive from log.cluster_info where ts >= $from and ts <= $to interval($interval) fill(null)", + "target": "select metric", + "type": "timeserie" + }, + { + "exemplar": true, + "expr": "taos_cluster_info_mnodes_alive{cluster=\"$cluster\"}", + "hide": false, + "interval": "", + "legendFormat": "alive", + "refId": "B" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "MNodes Number", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:452", + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "$$hashKey": "object:453", + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": false + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "collapsed": true, + "datasource": "Prometheus", + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 31 + }, + "id": 108, + "panels": [ + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "description": "Include two parts:", + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 9, + "w": 24, + "x": 0, + "y": 32 + }, + "hiddenSeries": false, + "id": 110, + "legend": { + "alignAsTable": true, + "avg": true, + "current": true, + "hideEmpty": false, + "max": true, + "min": true, + "rightSide": true, + "show": true, + "sideWidth": 600, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "8.2.2", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [ + { + "$$hashKey": "object:66", + "alias": "/success_rate/", + "yaxis": 2 + } + ], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "colNameFormatStr": "", + "colNameToGroup": "dnode_ep", + "exemplar": true, + "expr": "sum(taos_dnodes_info_req_insert{cluster=\"$cluster\"}) by (dnode_ep)", + "formatType": "Time series", + "hide": false, + "interval": "", + "legendFormat": "insert_count - {{dnode_ep}}", + "queryType": "SQL", + "refId": "A", + "sql": "select sum(req_insert) as insert_count, sum(req_insert_success) as insert_success, sum(req_insert_batch) as insert_batches, sum(req_insert_batch_success) as insert_batch_success from log.dnodes_info where ts >= $from and ts <= $to interval($interval) fill(null) group by dnode_ep" + }, + { + "colNameFormatStr": "", + "colNameToGroup": "dnode_ep", + "exemplar": true, + "expr": "sum(taos_dnodes_info_req_insert_success{cluster=\"$cluster\"}) by (dnode_ep)", + "formatType": "Time series", + "hide": false, + "interval": "", + "legendFormat": "insert_success - {{dnode_ep}}", + "queryType": "SQL", + "refId": "B", + "sql": "select sum(req_insert_success) / sum(req_insert) as success_rate from log.dnodes_info where ts >= $from and ts <= $to interval($interval) fill(null) group by dnode_ep" + }, + { + "colNameFormatStr": "", + "colNameToGroup": "dnode_ep", + "exemplar": true, + "expr": "sum(taos_dnodes_info_req_insert_batch{cluster=\"$cluster\"}) by (dnode_ep)", + "formatType": "Time series", + "hide": false, + "interval": "", + "legendFormat": "insert_batches - {{dnode_ep}}", + "queryType": "SQL", + "refId": "C", + "sql": "select sum(req_insert) as total_inserts, sum(req_insert_batch) as total_batches from log.dnodes_info where ts >= $from and ts <= $to interval($interval) fill(null)" + }, + { + "colNameFormatStr": "", + "colNameToGroup": "", + "exemplar": true, + "expr": "sum(taos_dnodes_info_req_insert_batch_success{cluster=\"$cluster\"}) by (dnode_ep)", + "formatType": "Time series", + "hide": false, + "interval": "", + "legendFormat": "insert_batches_success - {{dnode_ep}}", + "queryType": "SQL", + "refId": "D", + "sql": "select sum(req_insert_success) / sum(req_insert) as success_rate from log.dnodes_info where ts >= $from and ts <= $to interval($interval) fill(null)" + }, + { + "exemplar": true, + "expr": "sum(taos_dnodes_info_req_insert_success{cluster=\"$cluster\"}) by (dnode_ep) / sum(taos_dnodes_info_req_insert{cluster=\"$cluster\"}) by (dnode_ep)", + "hide": false, + "interval": "", + "legendFormat": "success_rate - {{dnode_ep}}", + "refId": "E" + }, + { + "exemplar": true, + "expr": "sum(taos_dnodes_info_req_insert_batch_success{cluster=\"$cluster\"}) by (dnode_ep) / sum(taos_dnodes_info_req_insert_batch{cluster=\"$cluster\"}) by (dnode_ep)", + "hide": false, + "interval": "", + "legendFormat": "batch_success_rate - {{dnode_ep}}", + "refId": "F" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Requests (Inserts)", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "percentunit", + "label": null, + "logBase": 1, + "max": "1", + "min": "0", + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "fieldConfig": { + "defaults": { + "unit": "cps" + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 9, + "w": 24, + "x": 0, + "y": 41 + }, + "hiddenSeries": false, + "id": 112, + "legend": { + "alignAsTable": true, + "avg": true, + "current": true, + "max": true, + "min": true, + "rightSide": true, + "show": true, + "sideWidth": 600, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "8.2.2", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "colNameFormatStr": "", + "colNameToGroup": "dnode_ep", + "exemplar": true, + "expr": "avg(taos_dnodes_info_req_insert_rate{cluster=\"$cluster\"}) by (dnode_ep)", + "formatType": "Time series", + "interval": "", + "legendFormat": "insert_rate - {{dnode_ep}}", + "queryType": "SQL", + "refId": "A", + "sql": "select avg(req_insert_rate) as insert_rate, avg(req_insert_batch_rate) as batch_rate from log.dnodes_info where ts >= $from and ts <= $to interval($interval) fill(null) group by dnode_ep" + }, + { + "colNameFormatStr": "", + "colNameToGroup": "dnode_ep", + "exemplar": true, + "expr": "avg(taos_dnodes_info_req_insert_batch_rate{cluster=\"$cluster\"}) by (dnode_ep)", + "formatType": "Time series", + "hide": false, + "interval": "", + "legendFormat": "batch_rate - {{dnode_ep}}", + "queryType": "SQL", + "refId": "B", + "sql": "select avg(insert_rate) as cluster_insert_rate, avg(batch_rate) as cluster_batch_rate from (select sum(req_insert_rate) as insert_rate, sum(req_insert_batch_rate) as batch_rate from log.dnodes_info where ts >= $from and ts <= $to interval(1s)) where ts >= $from and ts <= $to interval($interval) fill(null)" + }, + { + "exemplar": true, + "expr": "avg(taos_dnodes_info_req_insert_rate{cluster=\"$cluster\"})", + "hide": false, + "interval": "", + "legendFormat": "cluster_insert_rate", + "refId": "C" + }, + { + "exemplar": true, + "expr": "avg(taos_dnodes_info_req_insert_batch_rate{cluster=\"$cluster\"})", + "hide": false, + "interval": "", + "legendFormat": "cluster_batch_rate", + "refId": "D" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Requests Rate (Inserts per Second)", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "cps", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 24, + "x": 0, + "y": 50 + }, + "hiddenSeries": false, + "id": 114, + "legend": { + "alignAsTable": true, + "avg": true, + "current": true, + "max": true, + "min": true, + "rightSide": true, + "show": true, + "sideWidth": 600, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "8.2.2", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [ + { + "$$hashKey": "object:227", + "alias": "/rate/", + "yaxis": 2 + } + ], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "colNameFormatStr": "", + "colNameToGroup": "dnode_ep", + "exemplar": true, + "expr": "sum(taos_dnodes_info_req_select{cluster=\"$cluster\"}) by (dnode_ep)", + "formatType": "Time series", + "interval": "", + "legendFormat": "req_select - {{dnode_ep}}", + "queryType": "SQL", + "refId": "A", + "sql": "select sum(req_select) as req_select from log.dnodes_info where ts >= $from and ts <= $to interval($interval) fill(null) group by dnode_ep" + }, + { + "colNameFormatStr": "", + "colNameToGroup": "dnode_ep", + "exemplar": true, + "expr": "sum(taos_dnodes_info_req_select{cluster=\"$cluster\"})", + "formatType": "Time series", + "hide": false, + "interval": "", + "legendFormat": "cluster_req_select", + "queryType": "SQL", + "refId": "B", + "sql": "select sum(req_select) as total from log.dnodes_info where ts >= $from and ts <= $to interval($interval) fill(null)" + }, + { + "colNameFormatStr": "", + "colNameToGroup": "dnode_ep", + "exemplar": true, + "expr": "avg(taos_dnodes_info_req_select_rate{cluster=\"$cluster\"}) by (dnode_ep)", + "formatType": "Time series", + "hide": false, + "interval": "", + "legendFormat": "req_select_rate - {{dnode_ep}}", + "queryType": "SQL", + "refId": "C", + "sql": "select avg(req_select_rate) as req_select_rate from log.dnodes_info where ts >= $from and ts <= $to interval($interval) fill(null) group by dnode_ep" + }, + { + "colNameFormatStr": "", + "colNameToGroup": "dnode_ep", + "exemplar": true, + "expr": "avg(taos_dnodes_info_req_select_rate{cluster=\"$cluster\"})", + "formatType": "Time series", + "hide": false, + "interval": "", + "legendFormat": "cluster_req_select_rate", + "queryType": "SQL", + "refId": "D", + "sql": "select avg(req_select_rate) as req_select_rate from (select sum(req_select_rate) as req_select_rate from log.dnodes_info where ts >= $from and ts <= $to interval(1s)) where ts >= $from and ts <= $to interval($interval) fill(null)" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Requests (Selects)", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "cps", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 24, + "x": 0, + "y": 58 + }, + "hiddenSeries": false, + "id": 111, + "interval": null, + "legend": { + "alignAsTable": true, + "avg": true, + "current": true, + "max": true, + "min": true, + "rightSide": true, + "show": true, + "sideWidth": 600, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "8.2.2", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [ + { + "$$hashKey": "object:100", + "alias": "/.*rate.*/", + "dashes": true, + "fill": 4, + "spaceLength": 1, + "yaxis": 2 + } + ], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "colNameFormatStr": "", + "colNameToGroup": "dnode_ep", + "exemplar": true, + "expr": "sum(taos_dnodes_info_req_http{cluster=\"$cluster\"}) by (dnode_ep)", + "formatType": "Time series", + "interval": "", + "legendFormat": "req_http - {{dnode_ep}}", + "queryType": "SQL", + "refId": "A", + "sql": "select sum(req_http) as req_http from log.dnodes_info where ts >= $from and ts <= $to interval($interval) fill(null) group by dnode_ep" + }, + { + "colNameFormatStr": "", + "colNameToGroup": "dnode_ep", + "exemplar": true, + "expr": "sum(taos_dnodes_info_req_http{cluster=\"$cluster\"})", + "formatType": "Time series", + "hide": false, + "interval": "", + "legendFormat": "cluster_req_http", + "queryType": "SQL", + "refId": "B", + "sql": "select sum(req_http) as req_http from log.dnodes_info where ts >= $from and ts <= $to interval($interval) fill(null)" + }, + { + "colNameFormatStr": "", + "colNameToGroup": "dnode_ep", + "exemplar": true, + "expr": "avg(taos_dnodes_info_req_http_rate{cluster=\"$cluster\"}) by (dnode_ep)", + "formatType": "Time series", + "hide": false, + "interval": "", + "legendFormat": "req_http_rate - {{dnode_ep}}", + "queryType": "SQL", + "refId": "C", + "sql": "select avg(req_http_rate) as req_http_rate from log.dnodes_info where ts >= $from and ts <= $to interval($interval) fill(null) group by dnode_ep" + }, + { + "colNameFormatStr": "", + "colNameToGroup": "", + "exemplar": true, + "expr": "avg(taos_dnodes_info_req_http_rate{cluster=\"$cluster\"})", + "formatType": "Time series", + "hide": false, + "interval": "", + "legendFormat": "cluster_req_http_rate", + "queryType": "SQL", + "refId": "D", + "sql": "select avg(req_http_rate) as req_http_rate from (select sum(req_http_rate) as req_http_rate from log.dnodes_info where ts >= $from and ts <= $to interval(1s)) where ts >= $from and ts <= $to interval($interval) fill(null)" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Requests (HTTP)", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "ops", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + } + ], + "title": "Requests", + "type": "row" + }, + { + "collapsed": true, + "datasource": "Prometheus", + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 32 + }, + "id": 92, + "panels": [ + { + "datasource": "Prometheus", + "description": "超级表的个数", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 3, + "w": 3, + "x": 0, + "y": 67 + }, + "id": 96, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "text": {}, + "textMode": "auto" + }, + "pluginVersion": "8.2.2", + "repeatDirection": "h", + "targets": [ + { + "alias": "dnodes", + "colNameFormatStr": "", + "colNameToGroup": "", + "exemplar": true, + "expr": "taos_stables_per_database{cluster=\"$cluster\", database=\"$database\"}", + "formatType": "Time series", + "interval": "", + "legendFormat": "", + "queryType": "SQL", + "refId": "A", + "sql": "show $database.stables;", + "target": "select metric", + "timeshift": { + "period": null + }, + "type": "timeserie" + } + ], + "timeFrom": null, + "timeShift": null, + "title": "STables", + "transformations": [], + "type": "stat" + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 9, + "w": 9, + "x": 3, + "y": 67 + }, + "hiddenSeries": false, + "id": 94, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "8.2.2", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "alias": "", + "colName": "vgroup_id", + "colNameFormatStr": "", + "colNameToGroup": "", + "exemplar": true, + "expr": "sum(taos_vgroups_info_tables_num{cluster=\"$cluster\", database_name=\"$database\"})", + "formatType": "Time series", + "groupDataByColName": "", + "interval": "", + "legendFormat": "", + "queryType": "SQL", + "refId": "A", + "sql": "select last(tables_num) as tables_num from (select last(ts) as ts, sum(tables_num) as tables_num from log.vgroups_info where ts > $from and ts <= $to and database_name = '$database' group by ts) where ts >= $from and ts <= $to interval($interval) fill(null)" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Tables", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 9, + "w": 12, + "x": 12, + "y": 67 + }, + "hiddenSeries": false, + "id": 95, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "8.2.2", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "alias": "", + "colName": "vgroup_id", + "colNameFormatStr": "vgoup{{groupValue}}", + "colNameToGroup": "vgroup_id", + "exemplar": true, + "expr": "taos_vgroups_info_tables_num", + "formatType": "Time series", + "groupDataByColName": "", + "interval": "", + "legendFormat": "vgroup_{{vgroup_id}}", + "queryType": "SQL", + "refId": "A", + "sql": "select max(tables_num) as tables_num from log.vgroups_info where ts > $from and ts <= $to and database_name = '$database' interval($interval) fill(null) group by vgroup_id" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Tables Number Foreach VGroups", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "datasource": "Prometheus", + "description": "所有普通表的个数(包括超级表的子表)", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 3, + "w": 3, + "x": 0, + "y": 70 + }, + "id": 98, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "text": {}, + "textMode": "auto" + }, + "pluginVersion": "8.2.2", + "repeatDirection": "h", + "targets": [ + { + "alias": "dnodes", + "colNameFormatStr": "", + "colNameToGroup": "", + "exemplar": true, + "expr": "taos_tables_per_database{cluster=\"$cluster\",database=\"$database\"}", + "formatType": "Time series", + "interval": "", + "legendFormat": "", + "queryType": "SQL", + "refId": "A", + "sql": "select last(tables_num) from (select last(ts) as ts, sum(tables_num) as tables_num from log.vgroups_info where ts > $from and ts <= $to and database_name = '$database' group by ts)", + "target": "select metric", + "timeshift": { + "period": null + }, + "type": "timeserie" + } + ], + "timeFrom": null, + "timeShift": null, + "title": "Total Tables", + "transformations": [], + "type": "stat" + }, + { + "datasource": "Prometheus", + "description": "超级表的所有子表个数", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 3, + "w": 3, + "x": 0, + "y": 73 + }, + "id": 97, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "text": {}, + "textMode": "auto" + }, + "pluginVersion": "8.2.2", + "repeatDirection": "h", + "targets": [ + { + "alias": "dnodes", + "colNameFormatStr": "", + "colNameToGroup": "", + "exemplar": true, + "expr": "taos_tables_per_database{cluster=\"$cluster\",database=\"$database\"}", + "formatType": "Time series", + "interval": "", + "legendFormat": "", + "queryType": "SQL", + "refId": "A", + "sql": "show $database.stables;", + "target": "select metric", + "timeshift": { + "period": null + }, + "type": "timeserie" + } + ], + "timeFrom": null, + "timeShift": null, + "title": "Sub Tables", + "transformations": [], + "type": "stat" + } + ], + "repeat": "database", + "title": "Database: [ $database ]", + "type": "row" + }, + { + "collapsed": true, + "datasource": "Prometheus", + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 34 + }, + "id": 20, + "panels": [ + { + "datasource": "Prometheus", + "description": "启动时长", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "noValue": "Down", + "thresholds": { + "mode": "percentage", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "s" + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 4, + "x": 0, + "y": 69 + }, + "id": 120, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "last" + ], + "fields": "", + "values": false + }, + "text": {}, + "textMode": "auto" + }, + "pluginVersion": "8.2.2", + "targets": [ + { + "alias": "disk_used", + "colNameFormatStr": "", + "colNameToGroup": "", + "exemplar": true, + "expr": "taos_dnodes_info_uptime{cluster=\"$cluster\",dnode_ep=\"$fqdn\"}", + "formatType": "Time series", + "interval": "", + "legendFormat": "", + "queryType": "SQL", + "refId": "A", + "sql": "select last(uptime) as uptime from log.dnodes_info where dnode_ep = '$fqdn'", + "target": "select metric", + "timeshift": { + "period": null + }, + "type": "timeserie" + } + ], + "timeFrom": null, + "timeShift": null, + "title": "Uptime", + "transformations": [ + { + "id": "reduce", + "options": { + "includeTimeField": false, + "mode": "reduceFields", + "reducers": [ + "lastNotNull" + ] + } + } + ], + "type": "stat" + }, + { + "datasource": "Prometheus", + "description": "是否有MNode", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [ + { + "options": { + "0": { + "index": 1, + "text": "No" + }, + "1": { + "index": 0, + "text": "Yes" + } + }, + "type": "value" + } + ], + "thresholds": { + "mode": "percentage", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "none" + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 2, + "x": 4, + "y": 69 + }, + "id": 121, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "last" + ], + "fields": "", + "values": false + }, + "text": {}, + "textMode": "auto" + }, + "pluginVersion": "8.2.2", + "targets": [ + { + "alias": "", + "colNameFormatStr": "", + "colNameToGroup": "", + "exemplar": true, + "expr": "taos_dnodes_info_has_mnode{cluster=\"$cluster\",dnode_ep=\"$fqdn\"}", + "formatType": "Time series", + "interval": "", + "legendFormat": "", + "queryType": "SQL", + "refId": "A", + "sql": "select last(has_mnode) as has_mnode from log.dnodes_info where dnode_ep = '$fqdn' and ts >= $from and ts < $to interval($interval) fill(null)", + "target": "select metric", + "timeshift": { + "period": null + }, + "type": "timeserie" + } + ], + "timeFrom": null, + "timeShift": null, + "title": "Has MNode?", + "transformations": [], + "type": "stat" + }, + { + "datasource": "Prometheus", + "description": "CPU 核数", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "noValue": "Down", + "thresholds": { + "mode": "percentage", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "none" + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 2, + "x": 6, + "y": 69 + }, + "id": 122, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "last" + ], + "fields": "", + "values": false + }, + "text": {}, + "textMode": "auto" + }, + "pluginVersion": "8.2.2", + "targets": [ + { + "alias": "", + "colNameFormatStr": "", + "colNameToGroup": "", + "exemplar": true, + "expr": "taos_dnodes_info_cpu_cores{cluster=\"$cluster\",dnode_ep=\"$fqdn\"}", + "formatType": "Time series", + "interval": "", + "legendFormat": "", + "queryType": "SQL", + "refId": "A", + "sql": "select last(cpu_cores) as uptime from log.dnodes_info where dnode_ep = '$fqdn' interval ($interval)", + "target": "select metric", + "timeshift": { + "period": null + }, + "type": "timeserie" + } + ], + "timeFrom": null, + "timeShift": null, + "title": "CPU Cores", + "transformations": [], + "type": "stat" + }, + { + "datasource": "Prometheus", + "description": "VNodes 数量", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "percentage", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "none" + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 2, + "x": 8, + "y": 69 + }, + "id": 123, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "last" + ], + "fields": "", + "values": false + }, + "text": {}, + "textMode": "auto" + }, + "pluginVersion": "8.2.2", + "targets": [ + { + "alias": "", + "colNameFormatStr": "", + "colNameToGroup": "", + "exemplar": true, + "expr": "taos_dnodes_info_vnodes_num{cluster=\"$cluster\",dnode_ep=\"$fqdn\"}", + "formatType": "Time series", + "interval": "", + "legendFormat": "", + "queryType": "SQL", + "refId": "A", + "sql": "select last(vnodes_num) as vnodes_num from log.dnodes_info where dnode_ep = '$fqdn' and ts >= $from and ts < $to interval($interval) fill(null)", + "target": "select metric", + "timeshift": { + "period": null + }, + "type": "timeserie" + } + ], + "timeFrom": null, + "timeShift": null, + "title": "VNodes Number", + "transformations": [], + "type": "stat" + }, + { + "datasource": "Prometheus", + "description": "Master VNodes 数量", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "percentage", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "none" + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 2, + "x": 10, + "y": 69 + }, + "id": 124, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "last" + ], + "fields": "", + "values": false + }, + "text": {}, + "textMode": "auto" + }, + "pluginVersion": "8.2.2", + "targets": [ + { + "alias": "", + "colNameFormatStr": "", + "colNameToGroup": "", + "exemplar": true, + "expr": "taos_dnodes_info_masters{cluster=\"$cluster\",dnode_ep=\"$fqdn\"}", + "formatType": "Time series", + "interval": "", + "legendFormat": "", + "queryType": "SQL", + "refId": "A", + "sql": "select last(masters) as masters from log.dnodes_info where dnode_ep = '$fqdn' and ts >= $from and ts < $to interval($interval) fill(null)", + "target": "select metric", + "timeshift": { + "period": null + }, + "type": "timeserie" + } + ], + "timeFrom": null, + "timeShift": null, + "title": "VNodes Masters", + "transformations": [], + "type": "stat" + }, + { + "datasource": "Prometheus", + "description": "当前 taosd 线程 CPU 使用率", + "fieldConfig": { + "defaults": { + "color": { + "mode": "continuous-GrYlRd" + }, + "mappings": [], + "max": 100, + "min": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "#EAB839", + "value": 0.5 + }, + { + "color": "red", + "value": 0.8 + } + ] + }, + "unit": "percent" + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "last(cpu_taosd)" + }, + "properties": [ + { + "id": "thresholds", + "value": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + } + ] + } + ] + }, + "gridPos": { + "h": 6, + "w": 4, + "x": 12, + "y": 69 + }, + "id": 45, + "options": { + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "mean" + ], + "fields": "", + "values": false + }, + "showThresholdLabels": true, + "showThresholdMarkers": true, + "text": {} + }, + "pluginVersion": "8.2.2", + "targets": [ + { + "alias": "mem_taosd", + "colNameFormatStr": "", + "colNameToGroup": "", + "exemplar": true, + "expr": "taos_dnodes_info_cpu_engine{cluster=\"$cluster\",dnode_ep=\"$fqdn\"}", + "formatType": "Table", + "interval": "", + "legendFormat": "", + "queryType": "SQL", + "refId": "A", + "sql": "select last(cpu_engine) from log.dnodes_info where dnode_ep = '$fqdn' and ts >= $from and ts < $to", + "target": "select metric", + "type": "timeserie" + } + ], + "timeFrom": null, + "timeShift": null, + "title": "Current CPU Usage of taosd", + "type": "gauge" + }, + { + "datasource": "Prometheus", + "description": "当前 taosd 线程 内存 使用率", + "fieldConfig": { + "defaults": { + "color": { + "mode": "continuous-GrYlRd" + }, + "mappings": [], + "min": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "decmbytes" + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 4, + "x": 16, + "y": 69 + }, + "id": 66, + "options": { + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "mean" + ], + "fields": "/^taosd$/", + "values": false + }, + "showThresholdLabels": true, + "showThresholdMarkers": true, + "text": {} + }, + "pluginVersion": "8.2.2", + "targets": [ + { + "alias": "memory", + "colNameFormatStr": "", + "colNameToGroup": "", + "exemplar": true, + "expr": "taos_dnodes_info_mem_engine{cluster=\"$cluster\",dnode_ep=\"$fqdn\"}", + "formatType": "Time series", + "interval": "", + "legendFormat": "taosd", + "queryType": "SQL", + "refId": "A", + "sql": "select last(mem_engine) as taosd, last(mem_total) as total from log.dnodes_info where dnode_ep = '$fqdn' and ts >= $from and ts < $to", + "target": "select metric", + "type": "timeserie" + }, + { + "alias": "memory", + "colNameFormatStr": "", + "colNameToGroup": "", + "exemplar": true, + "expr": "taos_dnodes_info_mem_total{cluster=\"$cluster\",dnode_ep=\"$fqdn\"}", + "formatType": "Time series", + "hide": false, + "interval": "", + "legendFormat": "total", + "queryType": "SQL", + "refId": "B", + "sql": "select last(mem_engine) as taosd, last(mem_total) as total from log.dnodes_info where dnode_ep = '$fqdn' and ts >= $from and ts < $to", + "target": "select metric", + "type": "timeserie" + } + ], + "timeFrom": null, + "timeShift": null, + "title": "Current Memory Usage of taosd", + "type": "gauge" + }, + { + "datasource": "Prometheus", + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "max": 1, + "min": 0, + "thresholds": { + "mode": "percentage", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "#EAB839", + "value": 75 + }, + { + "color": "red", + "value": 80 + }, + { + "color": "dark-red", + "value": 95 + } + ] + }, + "unit": "percentunit" + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 4, + "x": 20, + "y": 69 + }, + "id": 51, + "options": { + "displayMode": "gradient", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "last" + ], + "fields": "", + "values": false + }, + "showUnfilled": true, + "text": {} + }, + "pluginVersion": "8.2.2", + "targets": [ + { + "alias": "disk_used", + "colNameFormatStr": "", + "colNameToGroup": "", + "exemplar": true, + "expr": "taos_disks_info_datadir_l0_used/taos_disks_info_datadir_l0_total{cluster=\"$cluster\",dnode_ep=\"$fqdn\"}", + "formatType": "Time series", + "interval": "", + "legendFormat": "level0", + "queryType": "SQL", + "refId": "A", + "sql": "select last(disk_used) as used, last(disk_total) as total, last(disk_used) / last(disk_total) as percent from log.dnodes_info where dnode_ep = '$fqdn' and ts >= $from and ts < $to", + "target": "select metric", + "timeshift": { + "period": null + }, + "type": "timeserie" + }, + { + "alias": "disk_used", + "colNameFormatStr": "", + "colNameToGroup": "", + "exemplar": true, + "expr": "taos_disks_info_datadir_l1_used/taos_disks_info_datadir_l1_total{cluster=\"$cluster\",dnode_ep=\"$fqdn\"}", + "formatType": "Time series", + "hide": false, + "interval": "", + "legendFormat": "level1", + "queryType": "SQL", + "refId": "B", + "sql": "select last(disk_used) as used, last(disk_total) as total, last(disk_used) / last(disk_total) as percent from log.dnodes_info where dnode_ep = '$fqdn' and ts >= $from and ts < $to", + "target": "select metric", + "timeshift": { + "period": null + }, + "type": "timeserie" + }, + { + "alias": "disk_used", + "colNameFormatStr": "", + "colNameToGroup": "", + "exemplar": true, + "expr": "taos_disks_info_datadir_l2_used/taos_disks_info_datadir_l2_total{cluster=\"$cluster\",dnode_ep=\"$fqdn\"}", + "formatType": "Time series", + "hide": false, + "interval": "", + "legendFormat": "level2", + "queryType": "SQL", + "refId": "C", + "sql": "select last(disk_used) as used, last(disk_total) as total, last(disk_used) / last(disk_total) as percent from log.dnodes_info where dnode_ep = '$fqdn' and ts >= $from and ts < $to", + "target": "select metric", + "timeshift": { + "period": null + }, + "type": "timeserie" + } + ], + "timeFrom": null, + "timeShift": null, + "title": "Disk Used", + "transformations": [], + "type": "bargauge" + }, + { + "aliasColors": {}, + "bars": false, + "cacheTimeout": null, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "description": "CPU 资源占用情况。", + "fieldConfig": { + "defaults": { + "links": [] + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 11, + "w": 12, + "x": 0, + "y": 75 + }, + "hiddenSeries": false, + "hideTimeOverride": true, + "id": 2, + "legend": { + "alignAsTable": true, + "avg": true, + "current": true, + "hideZero": false, + "max": true, + "min": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "8.2.2", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "alias": "", + "colNameFormatStr": "", + "colNameToGroup": "", + "exemplar": true, + "expr": "avg_over_time(taos_dnodes_info_cpu_engine{cluster=\"$cluster\",dnode_ep=\"$fqdn\"}[$__interval])", + "formatType": "Time series", + "hide": false, + "interval": "", + "legendFormat": "taosd", + "queryType": "SQL", + "refId": "A", + "sql": "select avg(cpu_engine) as taosd, avg(cpu_system) as system from log.dnodes_info where dnode_ep='$fqdn' and ts >= $from and ts < $to interval($interval) fill(null)", + "target": "select metric", + "type": "timeserie" + }, + { + "alias": "", + "colNameFormatStr": "", + "colNameToGroup": "", + "exemplar": true, + "expr": "avg_over_time(taos_dnodes_info_cpu_system{cluster=\"$cluster\",dnode_ep=\"$fqdn\"}[$__interval])", + "formatType": "Time series", + "hide": false, + "interval": "", + "legendFormat": "system", + "queryType": "SQL", + "refId": "B", + "sql": "select avg(cpu_engine) as taosd, avg(cpu_system) as system from log.dnodes_info where dnode_ep='$fqdn' and ts >= $from and ts < $to interval($interval) fill(null)", + "target": "select metric", + "type": "timeserie" + } + ], + "thresholds": [], + "timeFrom": "1h", + "timeRegions": [], + "timeShift": "30s", + "title": "CPU Usage", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "decimals": null, + "format": "percent", + "label": "使用占比", + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": false + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "cacheTimeout": null, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "description": "内存资源占用情况", + "fieldConfig": { + "defaults": { + "links": [] + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 11, + "w": 12, + "x": 12, + "y": 75 + }, + "hiddenSeries": false, + "hideTimeOverride": true, + "id": 42, + "legend": { + "alignAsTable": true, + "avg": true, + "current": true, + "max": true, + "min": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "8.2.2", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "alias": "", + "colNameFormatStr": "", + "colNameToGroup": "", + "exemplar": true, + "expr": "avg_over_time(taos_dnodes_info_mem_engine{cluster=\"$cluster\",dnode_ep=\"$fqdn\"}[$__interval])", + "formatType": "Time series", + "hide": false, + "interval": "", + "legendFormat": "taosd", + "queryType": "SQL", + "refId": "A", + "sql": "select avg(mem_engine) as taosd, avg(mem_system) as system, avg(mem_total) as total from log.dnodes_info where dnode_ep='$fqdn' and ts >= $from and ts < $to interval($interval) fill(null)", + "target": "select metric", + "type": "timeserie" + }, + { + "alias": "", + "colNameFormatStr": "", + "colNameToGroup": "", + "exemplar": true, + "expr": "avg_over_time(taos_dnodes_info_mem_system{cluster=\"$cluster\",dnode_ep=\"$fqdn\"}[$__interval])", + "formatType": "Time series", + "hide": false, + "interval": "", + "legendFormat": "system", + "queryType": "SQL", + "refId": "B", + "sql": "select avg(mem_engine) as taosd, avg(mem_system) as system, avg(mem_total) as total from log.dnodes_info where dnode_ep='$fqdn' and ts >= $from and ts < $to interval($interval) fill(null)", + "target": "select metric", + "type": "timeserie" + }, + { + "alias": "", + "colNameFormatStr": "", + "colNameToGroup": "", + "exemplar": true, + "expr": "avg_over_time(taos_dnodes_info_mem_total{cluster=\"$cluster\",dnode_ep=\"$fqdn\"}[$__interval])", + "formatType": "Time series", + "hide": false, + "interval": "", + "legendFormat": "total", + "queryType": "SQL", + "refId": "C", + "sql": "select avg(mem_engine) as taosd, avg(mem_system) as system, avg(mem_total) as total from log.dnodes_info where dnode_ep='$fqdn' and ts >= $from and ts < $to interval($interval) fill(null)", + "target": "select metric", + "type": "timeserie" + } + ], + "thresholds": [], + "timeFrom": "1h", + "timeRegions": [], + "timeShift": "30s", + "title": "RAM Usage", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "decimals": null, + "format": "decmbytes", + "label": "使用占比", + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": false + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 10, + "w": 12, + "x": 0, + "y": 86 + }, + "hiddenSeries": false, + "id": 117, + "legend": { + "alignAsTable": true, + "avg": false, + "current": true, + "hideEmpty": false, + "hideZero": true, + "max": true, + "min": true, + "rightSide": false, + "show": true, + "sideWidth": 400, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "8.2.2", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [ + { + "$$hashKey": "object:84", + "alias": "/percent/", + "yaxis": 2 + } + ], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "alias": "", + "colNameFormatStr": "", + "colNameToGroup": "", + "exemplar": true, + "expr": "avg_over_time(taos_disks_info_datadir_l0_used{cluster=\"$cluster\",dnode_ep=\"$fqdn\"}[$__interval])", + "formatType": "Time series", + "hide": false, + "interval": "", + "legendFormat": "level0_used", + "queryType": "SQL", + "refId": "A", + "sql": "select avg(datadir_l0_used) as level0_used, avg(datadir_l0_total) as level0_total, avg(datadir_l1_used) as level1_used, avg(datadir_l1_total) as level1_total, avg(datadir_l2_used) as level2_used, avg(datadir_l2_total) as level2_total from log.disks_info where dnode_ep = '$fqdn' and ts >= $from and ts < $to interval($interval) fill(null)", + "target": "select metric", + "timeshift": { + "period": null + }, + "type": "timeserie" + }, + { + "alias": "", + "colNameFormatStr": "", + "colNameToGroup": "", + "exemplar": true, + "expr": "avg_over_time(taos_disks_info_datadir_l1_used{cluster=\"$cluster\",dnode_ep=\"$fqdn\"}[$__interval])", + "formatType": "Time series", + "hide": false, + "interval": "", + "legendFormat": "level1_used", + "queryType": "SQL", + "refId": "D", + "sql": "select avg(datadir_l0_used)/avg(datadir_l0_total) as level0_percent, avg(datadir_l1_used)/avg(datadir_l1_total) as level1_percent , avg(datadir_l2_used)/avg(datadir_l2_total) as level2_percent from log.disks_info where dnode_ep = '$fqdn' and ts >= $from and ts < $to interval($interval) fill(null)", + "target": "select metric", + "timeshift": { + "period": null + }, + "type": "timeserie" + }, + { + "alias": "", + "colNameFormatStr": "", + "colNameToGroup": "", + "exemplar": true, + "expr": "avg_over_time(taos_disks_info_datadir_l2_used{cluster=\"$cluster\",dnode_ep=\"$fqdn\"}[$__interval])", + "formatType": "Time series", + "hide": false, + "interval": "", + "legendFormat": "level2_used", + "queryType": "SQL", + "refId": "B", + "sql": "select avg(datadir_l0_used)/avg(datadir_l0_total) as level0_percent, avg(datadir_l1_used)/avg(datadir_l1_total) as level1_percent , avg(datadir_l2_used)/avg(datadir_l2_total) as level2_percent from log.disks_info where dnode_ep = '$fqdn' and ts >= $from and ts < $to interval($interval) fill(null)", + "target": "select metric", + "timeshift": { + "period": null + }, + "type": "timeserie" + }, + { + "alias": "", + "colNameFormatStr": "", + "colNameToGroup": "", + "exemplar": true, + "expr": "avg_over_time(taos_disks_info_datadir_l0_total{cluster=\"$cluster\",dnode_ep=\"$fqdn\"}[$__interval])", + "formatType": "Time series", + "hide": false, + "interval": "", + "legendFormat": "level0_total", + "queryType": "SQL", + "refId": "C", + "sql": "select avg(datadir_l0_used) as level0_used, avg(datadir_l0_total) as level0_total, avg(datadir_l1_used) as level1_used, avg(datadir_l1_total) as level1_total, avg(datadir_l2_used) as level2_used, avg(datadir_l2_total) as level2_total from log.disks_info where dnode_ep = '$fqdn' and ts >= $from and ts < $to interval($interval) fill(null)", + "target": "select metric", + "timeshift": { + "period": null + }, + "type": "timeserie" + }, + { + "alias": "", + "colNameFormatStr": "", + "colNameToGroup": "", + "exemplar": true, + "expr": "avg_over_time(taos_disks_info_datadir_l1_total{cluster=\"$cluster\",dnode_ep=\"$fqdn\"}[$__interval])", + "formatType": "Time series", + "hide": false, + "interval": "", + "legendFormat": "level1_total", + "queryType": "SQL", + "refId": "E", + "sql": "select avg(datadir_l0_used) as level0_used, avg(datadir_l0_total) as level0_total, avg(datadir_l1_used) as level1_used, avg(datadir_l1_total) as level1_total, avg(datadir_l2_used) as level2_used, avg(datadir_l2_total) as level2_total from log.disks_info where dnode_ep = '$fqdn' and ts >= $from and ts < $to interval($interval) fill(null)", + "target": "select metric", + "timeshift": { + "period": null + }, + "type": "timeserie" + }, + { + "alias": "", + "colNameFormatStr": "", + "colNameToGroup": "", + "exemplar": true, + "expr": "avg_over_time(taos_disks_info_datadir_l2_total{cluster=\"$cluster\",dnode_ep=\"$fqdn\"}[$__interval])", + "formatType": "Time series", + "hide": false, + "interval": "", + "legendFormat": "level2_total", + "queryType": "SQL", + "refId": "F", + "sql": "select avg(datadir_l0_used) as level0_used, avg(datadir_l0_total) as level0_total, avg(datadir_l1_used) as level1_used, avg(datadir_l1_total) as level1_total, avg(datadir_l2_used) as level2_used, avg(datadir_l2_total) as level2_total from log.disks_info where dnode_ep = '$fqdn' and ts >= $from and ts < $to interval($interval) fill(null)", + "target": "select metric", + "timeshift": { + "period": null + }, + "type": "timeserie" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Disk Used", + "tooltip": { + "shared": false, + "sort": 0, + "value_type": "individual" + }, + "transformations": [], + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "gbytes", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "percentunit", + "label": "Disk Used", + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 10, + "w": 12, + "x": 12, + "y": 86 + }, + "hiddenSeries": false, + "id": 64, + "legend": { + "alignAsTable": true, + "avg": true, + "current": true, + "max": true, + "min": true, + "rightSide": false, + "show": true, + "sideWidth": 400, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "8.2.2", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "alias": "level0", + "colNameFormatStr": "", + "colNameToGroup": "", + "exemplar": true, + "expr": "deriv(rate(taos_disks_info_datadir_l0_used{cluster=\"$cluster\", dnode_ep=\"$fqdn\"}[1m])[5m:1s]) * 1024", + "formatType": "Time series", + "hide": false, + "interval": "", + "legendFormat": "level0", + "queryType": "SQL", + "refId": "A", + "sql": "select derivative(value, 1m, 0) from (select avg(datadir_l0_used) * 1024 as value from log.disks_info where dnode_ep = '$fqdn' and ts >= $from and ts < $to interval($interval) fill(null))", + "target": "select metric", + "timeshift": { + "period": null + }, + "type": "timeserie" + }, + { + "alias": "level1", + "colNameFormatStr": "", + "colNameToGroup": "", + "exemplar": true, + "expr": "deriv(rate(taos_disks_info_datadir_l1_used{cluster=\"$cluster\", dnode_ep=\"$fqdn\"}[1m])[5m:1s]) * 1024", + "formatType": "Time series", + "hide": false, + "interval": "", + "legendFormat": "level1", + "queryType": "SQL", + "refId": "B", + "sql": "select derivative(value, 1m, 0) from (select avg(datadir_l1_used) * 1024 as value from log.disks_info where dnode_ep = '$fqdn' and ts >= $from and ts < $to interval($interval) fill(null))", + "target": "select metric", + "timeshift": { + "period": null + }, + "type": "timeserie" + }, + { + "alias": "level1", + "colNameFormatStr": "", + "colNameToGroup": "", + "exemplar": true, + "expr": "deriv(rate(taos_disks_info_datadir_l2_used{cluster=\"$cluster\", dnode_ep=\"$fqdn\"}[1m])[5m:1s]) * 1024", + "formatType": "Time series", + "hide": false, + "interval": "", + "legendFormat": "level2", + "queryType": "SQL", + "refId": "C", + "sql": "select derivative(value, 1m, 0) from (select avg(datadir_l1_used) * 1024 as value from log.disks_info where dnode_ep = '$fqdn' and ts >= $from and ts < $to interval($interval) fill(null))", + "target": "select metric", + "timeshift": { + "period": null + }, + "type": "timeserie" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Disk Used Increasing Rate per Minute", + "tooltip": { + "shared": false, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "MBs", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "percentunit", + "label": "Disk Used", + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "cacheTimeout": null, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "description": "io", + "fieldConfig": { + "defaults": { + "links": [] + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 12, + "w": 12, + "x": 0, + "y": 96 + }, + "hiddenSeries": false, + "hideTimeOverride": true, + "id": 119, + "legend": { + "alignAsTable": true, + "avg": true, + "current": true, + "max": true, + "min": true, + "rightSide": false, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "8.2.2", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [ + { + "$$hashKey": "object:302", + "alias": "/last/", + "dashLength": 5, + "dashes": true, + "spaceLength": 5 + } + ], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "alias": "", + "colNameFormatStr": "", + "colNameToGroup": "", + "exemplar": true, + "expr": "avg_over_time(taos_dnodes_info_io_write_disk{cluster=\"$cluster\",dnode_ep=\"$fqdn\"}[$interval])", + "formatType": "Time series", + "hide": false, + "interval": "", + "legendFormat": "io_write_disk", + "queryType": "SQL", + "refId": "A", + "sql": "select avg(io_read_disk) as io_read_taosd, avg(io_write_disk) as io_write_taosd from log.dnodes_info where dnode_ep = '$fqdn' and ts >= now-1h and ts < now interval($interval) fill(null)", + "target": "select metric", + "type": "timeserie" + }, + { + "alias": "", + "colNameFormatStr": "", + "colNameToGroup": "", + "exemplar": true, + "expr": "avg_over_time(taos_dnodes_info_io_read_disk{cluster=\"$cluster\",dnode_ep=\"$fqdn\"}[$interval])", + "formatType": "Time series", + "hide": false, + "interval": "", + "legendFormat": "io_read_disk", + "queryType": "SQL", + "refId": "B", + "sql": "select avg(io_read_disk) as io_read_taosd, avg(io_write_disk) as io_write_taosd from log.dnodes_info where dnode_ep = '$fqdn' and ts >= now-1h and ts < now interval($interval) fill(null)", + "target": "select metric", + "type": "timeserie" + } + ], + "thresholds": [], + "timeFrom": "1h", + "timeRegions": [], + "timeShift": "30s", + "title": "Disk IO", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "decimals": null, + "format": "MBs", + "label": "IO Rate", + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": false + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "cacheTimeout": null, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "description": "io", + "fieldConfig": { + "defaults": { + "links": [], + "unit": "Mbits" + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 12, + "w": 12, + "x": 12, + "y": 96 + }, + "hiddenSeries": false, + "hideTimeOverride": true, + "id": 118, + "legend": { + "alignAsTable": true, + "avg": true, + "current": true, + "max": true, + "min": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "8.2.2", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [ + { + "$$hashKey": "object:347", + "alias": "/in/", + "transform": "negative-Y" + } + ], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "alias": "", + "colNameFormatStr": "", + "colNameToGroup": "", + "exemplar": true, + "expr": "avg_over_time(taos_dnodes_info_net_in{cluster=\"$cluster\",dnode_ep=\"$fqdn\"}[$interval])", + "formatType": "Time series", + "hide": false, + "interval": "", + "legendFormat": "net_in", + "queryType": "SQL", + "refId": "A", + "sql": "select avg(net_in) as net_in, avg(net_out) as net_out from log.dnodes_info where dnode_ep = '$fqdn' and ts >= now-1h and ts < now interval($interval) fill(null)", + "target": "select metric", + "type": "timeserie" + }, + { + "alias": "", + "colNameFormatStr": "", + "colNameToGroup": "", + "exemplar": true, + "expr": "avg_over_time(taos_dnodes_info_net_out{cluster=\"$cluster\",dnode_ep=\"$fqdn\"}[$interval])", + "formatType": "Time series", + "hide": false, + "interval": "", + "legendFormat": "net_out", + "queryType": "SQL", + "refId": "B", + "sql": "select avg(net_in) as net_in, avg(net_out) as net_out from log.dnodes_info where dnode_ep = '$fqdn' and ts >= now-1h and ts < now interval($interval) fill(null)", + "target": "select metric", + "type": "timeserie" + } + ], + "thresholds": [], + "timeFrom": "1h", + "timeRegions": [], + "timeShift": "30s", + "title": "Net", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "decimals": null, + "format": "Mbits", + "label": "IO Rate", + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": false + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + } + ], + "repeat": "fqdn", + "title": "DNode Usage [ $fqdn ]", + "type": "row" + }, + { + "collapsed": true, + "datasource": "Prometheus", + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 35 + }, + "id": 63, + "panels": [ + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "fieldConfig": { + "defaults": { + "displayName": "Logins Per Minute", + "unit": "cpm" + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 10 + }, + "hiddenSeries": false, + "id": 61, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "8.2.2", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [ + { + "$$hashKey": "object:67", + "alias": "logins", + "nullPointMode": "null as zero" + } + ], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "alias": "logins", + "colNameFormatStr": "", + "colNameToGroup": "", + "exemplar": true, + "expr": "count_over_time(taos_logs_content{cluster=\"$cluster\"}[1m])", + "formatType": "Time series", + "interval": "", + "legendFormat": "", + "queryType": "SQL", + "refId": "A", + "sql": "select count(*) from log.logs where ts >= $from and ts < $to interval (1m)", + "target": "select metric", + "type": "timeserie" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Login Counts per Minute", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:74", + "format": "cpm", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "$$hashKey": "object:75", + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + } + ], + "title": "Login History", + "type": "row" + } + ], + "schemaVersion": 31, + "style": "dark", + "tags": [ + "TDengine", + "Prometheus", + "TaosKeeper" + ], + "templating": { + "list": [ + { + "allValue": null, + "current": { + "selected": false, + "text": "localhost", + "value": "localhost" + }, + "datasource": null, + "definition": "label_values(taos_dn_cpu_taosd, cluster)", + "description": null, + "error": null, + "hide": 0, + "includeAll": false, + "label": "", + "multi": false, + "name": "cluster", + "options": [], + "query": { + "query": "label_values(taos_dn_cpu_taosd, cluster)", + "refId": "StandardVariableQuery" + }, + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "type": "query" + }, + { + "allValue": null, + "current": { + "selected": false, + "text": "tdengine:6030", + "value": "tdengine:6030" + }, + "datasource": null, + "definition": "label_values(taos_dn_cpu_taosd{cluster=\"$cluster\"}, fqdn)", + "description": null, + "error": null, + "hide": 0, + "includeAll": false, + "label": "", + "multi": false, + "name": "fqdn", + "options": [], + "query": { + "query": "label_values(taos_dn_cpu_taosd{cluster=\"$cluster\"}, fqdn)", + "refId": "StandardVariableQuery" + }, + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "type": "query" + }, + { + "allValue": null, + "current": { + "selected": false, + "text": "1", + "value": "1" + }, + "datasource": null, + "definition": "label_values(taos_dn_cpu_taosd{cluster=\"$cluster\"}, dnodeid)", + "description": null, + "error": null, + "hide": 2, + "includeAll": false, + "label": "with DNode ID:", + "multi": false, + "name": "dnodeid", + "options": [], + "query": { + "query": "label_values(taos_dn_cpu_taosd{cluster=\"$cluster\"}, dnodeid)", + "refId": "StandardVariableQuery" + }, + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "type": "query" + }, + { + "allValue": null, + "current": { + "selected": true, + "text": [ + "All" + ], + "value": [ + "$__all" + ] + }, + "datasource": null, + "definition": "label_values(taos_vgroups_info_status{cluster=\"$cluster\"}, database_name)", + "description": null, + "error": null, + "hide": 0, + "includeAll": true, + "label": null, + "multi": true, + "name": "database", + "options": [], + "query": { + "query": "label_values(taos_vgroups_info_status{cluster=\"$cluster\"}, database_name)", + "refId": "StandardVariableQuery" + }, + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "type": "query" + }, + { + "allValue": null, + "current": { + "selected": false, + "text": "tdengine:6030", + "value": "tdengine:6030" + }, + "datasource": null, + "definition": "label_values(taos_cluster_info_first_ep{cluster=\"$cluster\"}, value)", + "description": null, + "error": null, + "hide": 0, + "includeAll": false, + "label": null, + "multi": false, + "name": "firstEp", + "options": [], + "query": { + "query": "label_values(taos_cluster_info_first_ep{cluster=\"$cluster\"}, value)", + "refId": "StandardVariableQuery" + }, + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "type": "query" + }, + { + "allValue": null, + "current": { + "selected": false, + "text": "2.4.0.4", + "value": "2.4.0.4" + }, + "datasource": null, + "definition": "label_values(taos_cluster_info_version{cluster=\"$cluster\"}, value)", + "description": null, + "error": null, + "hide": 0, + "includeAll": false, + "label": null, + "multi": false, + "name": "version", + "options": [], + "query": { + "query": "label_values(taos_cluster_info_version{cluster=\"$cluster\"}, value)", + "refId": "StandardVariableQuery" + }, + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "type": "query" + }, + { + "auto": true, + "auto_count": 100, + "auto_min": "10s", + "current": { + "selected": false, + "text": "5s", + "value": "5s" + }, + "description": null, + "error": null, + "hide": 0, + "label": null, + "name": "interval", + "options": [ + { + "selected": false, + "text": "auto", + "value": "$__auto_interval_interval" + }, + { + "selected": true, + "text": "5s", + "value": "5s" + }, + { + "selected": false, + "text": "10s", + "value": "10s" + }, + { + "selected": false, + "text": "15s", + "value": "15s" + }, + { + "selected": false, + "text": "20s", + "value": "20s" + }, + { + "selected": false, + "text": "30s", + "value": "30s" + }, + { + "selected": false, + "text": "1m", + "value": "1m" + }, + { + "selected": false, + "text": "2m", + "value": "2m" + }, + { + "selected": false, + "text": "5m", + "value": "5m" + }, + { + "selected": false, + "text": "10m", + "value": "10m" + }, + { + "selected": false, + "text": "30m", + "value": "30m" + }, + { + "selected": false, + "text": "1h", + "value": "1h" + }, + { + "selected": false, + "text": "6h", + "value": "6h" + }, + { + "selected": false, + "text": "12h", + "value": "12h" + }, + { + "selected": false, + "text": "1d", + "value": "1d" + } + ], + "query": "5s,10s,15s,20s,30s,1m,2m,5m,10m,30m,1h,6h,12h,1d", + "refresh": 2, + "skipUrlSync": false, + "type": "interval" + } + ] + }, + "time": { + "from": "now-1h", + "to": "now" + }, + "timepicker": { + "refresh_intervals": [ + "5s", + "10s", + "30s", + "1m", + "5m", + "15m", + "30m", + "1h", + "2h", + "1d" + ] + }, + "timezone": "", + "title": "TaosKeeper Prometheus Dashboard", + "uid": "rSFM0Fxnk", + "version": 62 +} \ No newline at end of file diff --git a/tools/keeper/dashboards/tdengine-taoskeeper-prometheus-dashboard.png b/tools/keeper/dashboards/tdengine-taoskeeper-prometheus-dashboard.png new file mode 100644 index 0000000000000000000000000000000000000000..a608c98b9305db20cf3f5d056847ca5045007de3 GIT binary patch literal 233143 zcmagGbyyrh*XTKeJHZ`-yE_C3?(RN#aCe(PAUMHYgS)#-kPtjba1ZVfTz8W9y}RGD z_qn@&bX8Z?DLEyls(;-xk!mWk=qSV}00018UQS8_06+u-05~*Au+SJ}kopwVgR>D= z76$<8<58c?;GtolyN0X;pk{*f004jms3~bl6OvFcFthV>GwNw5sHzB4Gtmq3aA08* zP|-58F;g)!a`U|7g2xL;xT3SQP zC^R$genfT<1hh$82HcSYO}!mX$|UQ9dQ5psK2aiG@p74`lJtkYDiq z$Z)?$uPraXNJ2u+uW~*SF==rD8WA}`dPeqWM=2I!@`O;skHzLK1rp>WG~%tuG`jE@mb&I@m-c9=+BqTsOL+_qEQ}>x-=>vnn;k=wQLTkAO$E zdCI^_m5Y!^msLvedkz^cZ5O48&XtmqCIXW85@ck$igb!%w45rs-5m;*of@BeKp9>7 z+^%gDbkzJ>eC7oPRzV75?MVy{B}UE?eC*U#UzbPHK*RaGW7WZWi5d<`Aoav4CSle% zWt!o9djcL`)er?AbLM8S!nUwtRTOt?A`eH#;#(=3ix5#6SBbdzED3O*w=j8ctTr*P z42?m_*F>qp(G^lLo!)ew6kj%aZYD~t6eC))5Gg8U_d-Zx856jfkcKObmc%KlKE3W| zYhiLh2P2B;Qw|a^eXL)6eSI~}ddM{73-+=5sITCb zKIq<~n+6VSfh0m@8T9n{n$M19V?Q4izg$zB15)(7Wi7`F3-SAsO zjgKRcyBgff7$V`fD#ypiEZPz>MPsM{z*~U4l(?49(s7Qf9Em>p5Ul@~K6L>%L|ER@ z@rs=9)ELX5<#O0UZ@o!FEbEK((>>S~M{X!^euzbVU>W(C-uPM+?9){Iw%kE*-))Jx zGgyl``axDvs)dErX*FEJu^z5Ad5dD4;@01pZdl4@e8A4I{cPyhz_7pb8p(XX?&DgF zr@+mGIz4oW0&YIR!XQBXx1hfvm~b!<>LC$A9Wa;@1oZ&_Bl$h#Zv-6LU-!Q<{}KNm zGXE(842xU$rIX@cabRzjjg`4M%(TDd`P`mOY^fWPx-QhZs##&;JPOrxlc^cP%(X<2 z{w??{n>wU>@V$7GsfDwZ^f%WJ0v)wOmDcY5!ueisq!U~~XDjzjBQFeSjbQH|QyuI> zf)6hvd}y|_qCu{S+va6L=BZ&kU0d)(vv%@6SJrsn46{^T>;_fBZNDg?sh ze$YgXo=PBw$z6MT0***3V#FAO9S$SOvnbp?Ml z9NP{COW1zJExWU%)sloXNMs(COy*PRqUtq1{8kmKJ$lWBOy>U12^+7YR$sWfsXEj9 ziR(nR?pr$Ut9n=sw_+UC^UJuIRJXE-aF4g3qR$_zPL+#*L)y+CW+KtU-Gigwa4>~A zGnE?Nbe5F+_tF~tyI-$Sk(W-v-7}5L(16%idb@|Sp@Phhne-dN^aj0P~jjar0yz<4t(@^v34r0xf_Fdk*~w&Ah2)PqmMiIbutQ-Y9P z4X}W6rH1)#UnGS_#Y`M>#VQ4V>(-j;Ih~4(O8cLE8~PKfBphrUv04-oJ>L7u)vXDc znOB@1PlJ0}?Tg-jBK7yO7o59}usXi$Mx1rhTX!~nt!#R+`@=X_#NB?r^_vzYC8MBa zaJOc%zeG83oINe8kq)?5>hB)N*^|(*@a{FH@ajs9{$&5p`TgLoX7J1iE4{2So9;YX zWKyj21W(!PCEfinz>~A1$zbPhn*p6OxaUg3jS@d6_&dBq6Zfirzj~cA*?Sf*yq*I1yRwD)w^-wY(jK& z@hDQclYFGV6M6TT+j#tV2YG;J@>jeG#-rmb{VkG3fTESgFMSz!eEW!azrx#H(+b_P zLN#_Oxb&+%vA6!*6SKlSOu)bE(WY6*7*gOI$1G2!quz5|3AZ%*gvZ0ycgUeks;bpz z7bNsh_FGV%I*8ZL&H}`#;6?1eaNXdTQ3x_$Xr_71!9!*lkW*TQ%O~pPGY|kmVCfXs@n+XjCQz4ZUjfw4~wY0qj&hn-tS5Fa*v_%)DK!$h&G0+7? zdGw@3O%zzzsOAR0_#;ncQ&Uzje#+f)kjBfWF-1;+LaJAo^8ysT1R8eQ4V`|b(8XHz znrf@wiPKE5p)zyVVNK6I-L(dc11ba1tzy^!-zxM0rfJFUp~MbdKz-q9i&U{AH=YfT zufG;?F4*cRt7XUp(;>Va{F?=%ktuiG6aVR`$Nfbc`#i%ZK6pk~Pc@#%_I_Q=U(_yY zCJiUdCUeT9Ikf9|w(sP^05yHOtIRZVMbEQF?N5d4pSHNUmGu{tJCvC-9oOtGVGS0? zBBXatd!idiLkDP=Lkfq)7L=1jVu24=Ru+YPVj?^wy(3M6*Q^;k7$T$bB3&vE=2-mg zKXm*U1DpuXjb|LHC^yCeRPt(-;~EyX%AIR%k>_Z-v&}bM+q_GXx&KTEQ`r1T+U8;M zN;-Zwbe&e|a2TDU6OAtXy%wYRDmG(ZbI!40pC^l(+`q4hzgL$c|M~KYx>gFp;(IoT?^tz06?}dM5B%V%MEVRyJOB&HOS? z09)z)AR3rv2T*i?7mM5N1c8XdJ8haa+4x5!*UZDKE>7?BdM|(`4EK z_voEJEWA9jCZbALvm=bg_okm_V`x5Kk8%FCZ|;#VI{ZeVBV zH;^ZB%Z+p$)rJ!Z3`SY?S`N(10ipM7F%UCLPzCqh&`{VVF-Q0LkRt4na-X0G5Vcs} zzJ)D&8%DIBKks%d6}t{1_KYUzsp#zdsI1>$nh^iohwJf`@kd3jUpCQQ7@R}9SmpPM zGD*l1(Q2=>7oLaaR2z|ABjW~!1&UBxAc|ki=b3r*HF}(bry^I_DFtarzS2 z*qqQ}$RQt)KKylP?LMq2Wykf&t8}axlT~tI6>LptSUs+iQ-!aQK*;xV(f149VhRtY zw@_B128B=p9=$n^2a{FwR8X@_ zzVeP=ufFn}de0iNC|4nO5PcQ~w0Oc9{dVO9o}tF(Qr?KTTk|Nwt&AXi6LLhJa#^DL zU=y0vEG6u28=_*YRtt<@Rt@IsA*L#DsV+S*?a9Xn&fI2_H(JpeV9=qorLoPF@mIZ@ zF{PZw6*3pTL>2cLm{x32Yo{Lmj9{U27&zKBA(@f0XfTsG(?y1onaDycYN2)`$A?pYCq(*4kZG{)2O(Vjr%wB8q(`medd~eOc-KH#)Mtkm% z)q}Kd{#XDc-*I)iig15GT|1~4-Ab?wX9h;{p)Sp+8{p~xQW#K%j^om_Q(s|KjcjmK zG}t_&EIB+&x4%*6`U#VOgMcy?y%ZY!{7ooQA^XO3I-F9u+>I-)wwNfxT>0k+(^s&p z)bEkE!iF4t;*~IS8Y)rXYY9)pWF)Qrm`za*D&nh{Pbrd8g|YnNuu8QEk>>|D&}J-OTz*S>QSQ+{L<6EbryA*=cn z_baX0rd{q=gf5m#Z-+zda`2)P{gJ$Z<2Rg}&}N%>OvZy9+6{%$#*mar?#*H7xvJU& zuXRc%H2jtyCzVD!?4j(V^VEEzYT~DYKO~lezV!g0cO66WUDP{I#8YfBubTTSr1V=h z>>173VZJ)rE>4*=`S97jRVlm1>G~RsUQs*d?7$ zezY_tmcVsOD<=Xs!O5v*HRwBvM$+Y9p~ZrCEZ9-+u9G<-!)*x>>Fy0Q}&hgZqlC2 zo$dyRu}fxYBkUS#-eTQTLNdMGKMVw4MtOVZ|*^mgKiKQHgN3W?yHI=G7q zlbKk(OXS+>_|l$_*+y(fY_$FDcg46j+Xr=QXXiKgpFg}|LF##w>Q(x&3(ul@?a}>W z=b0Lpk1X@-j@X;myHYC)X;QsN^tawoq&+?AT4>l#ufB<=L-9Fx3yuO0GXLUyRD!rA zA+*ca-y}ExW`CPS?lhk*`b#D2##mhXkD`Mryz?=O|3c7*8TzvhM!cqkqOo=3T zWi*wOQ6J(r;=!ZI?u=8iHH#uGcBoh8)ZQ;ca>1$TK#;aNbf=_uiT+Bu*vBQ)fbD-^ zLPs|@Lv#f_f~WAIMed0+^VV{hUtC8WDo!nR3<6H%lP7 zgnxwt^ZE-r;ZqR}4GzDB!284Twd3ZFSOgVaL?@DNU&+{hlQQsuFUrZawyk%18woaY z$htagFKTn-bnYAfMLrsN_|+J*0PDeN0fNMG!9^AlQFUwG@O}c@$=&m-E-|ka`b)6N zv7Vl-Akix;);W$bWRu>)yaH_XFswV3_i$i||I4&4QlO9fPwIkSuMh!GFPhStqnW0# zH%sl^p3{`qa%dw^^jlcRVJzK-iZNtloj@{~>8(CcffrsT$O?F5f0%lf3 z=)1X8n_ePVG6y5gc6(hmev9-4PJRouPm?u>^VW>IJCtkY0dnU&dZ_qypLG+7fH>q1 zG}A4^i?S8q?vWFu>H{ZPhSFCHoc$FY^Y5x2?peEE(i1^;b`2N(Qv;0TR-Ey(I0+h; zY^A4MX-i-DO)0Y;Uaw2K`N zeK;lIMIwPDLv!KS>@zO7e~ie87>KF`nP(Ge^D?yszr2Ny`OAr*IA~b`lE|>u@eF!j zgx(_=yt2^79+3VQh#?WetT`$Fyy~XBY25q9TWJ1Yu+#>p{4*->Ky|75FLZ-qwhb!O z^mRnNi#h-h7VzGdv2nMA)ZXeekE7MG_*xR%Mbz^Pub?|#rZU7g#|uie7`P;M*0LFJ z++GKC96OU3?Aph)8U9hZu1R;6|8Fq&Ke^rC>i+5mb^aIs`wt5IKNPX?6~9i+`X&6k zj`J%1W;2~lqg&SYnAF^8l*j9S0IGI&c7On$!BZmcStnmgYw{{Az$+CzT4kMBpE@<^ z7skq5IPbt$onn~P$U5d%U)d=jxOiCG;qkv^xyApYvO1SiKjFdGDr94rer--rAs~3~ z!qjv}%edz4$mHxPKnSDOrVk_QMjjI7h;bq z8TFvKQHzO_8x(GUe|_wuw))}RL9Ji(;=1%MsQcc~E#PKF@{*@}%k&U$@O(^RRHL`Y zVK@J2cksP}arnC5rRY0ZKfPE?lUu8@M+SFDWQht2wLb3cu+w@j z&Wg7i;?$YcZ?>ZQD!Tl1OA|HbWCR&Ru8OtL22QTBGjwvF8a_^QA?XFR+#d{U{eA%4 zD@Ke_v`SB2M$z`Hj1F8v=mMMw+T;B~ZCgJRv+d}5PC`?u2#Q^JOv0H(P9}Hc zt6P8WuVNE%RPEgYV~P&8Rj#|YkKI#`U1w*{xeeQ-uj>G#lk`e@^)aXS0LR~#y{*6) zW5q=GV&v^5O2F8WO-^*Cf&Xs+KK~&~4I-%4_XHNmQL8ERq)3PZ6Hfe{sLNdK1SdzH z>WfVONkhT3CNF?=9MN4-M*<5cI(?%Prv>-Cr$hJ>!M&BadK3~H5zfx|HRyFF9MPC( z-(#SN7|oWg2nYxT!q%E+=RVq50g~dU0*;tZkX5h; zV)L5B$3o3>iN|QdBc9tFpwgX3RiSdpm)M?G~ zIsbd$hT&ETGx%$J>vH2~U5L*`64*#2VRmWsnY0*_RfxWPZrjcAxQS!Y;2c*@D^~yD7ku_FB{$KJgY_OOWh8#)C_P&`MYt#hRyB3) za0nL!=Z8GMdR(%2bGJtTbO)$JBoLyfgw@-PrL1i;z}T9MZAD9ZGToMWIGrCHk84CO zP&2+@JQ#Nc$l`36!^GFJw8;zYP0}nqOnK;DrLFVW9%eclbDH+`WP=Qv%NFkaAg`?7 zPQf|^!X}52y{#FM1=1b#5J?1Jm1l-W)T^%!W7@7Dm&l8;`jPPtS33+{!u7^{o@^*a!*;MHopK%S8s|vW)g=jJR)Pm0(mM)MiL$jrAzW4QrWE@Fu{=Ps|9x z-5Tn+JeP0+W+-!V6O~U=e@&K74Tyad?3i<+o3P$U^@Mk^+?oufeh%^MUvmE_#CGH5{7Wk8##7~)!{$p z8WFh8DvDIeiJP{2J>E1kd)9}};{;M+RD92U1}m0fix^v=6S6BMD^@D$g2jd8II(C5 zFxqKsVSTWZ5-kKwL4xYIV%@^)kbrM6Z00JN=l#yf@gzK}BbO?}lkmWhSXnpqH?bHV z@A-tJ$}_<3*e4DNs&ZHFT)m?X#c!o0N*Gk+WzpsuteP+{`T1L~Gu zTOF9AsqQb7+SW$>$L&poGXcBRA1k=vbBdPqNlScj5Uo!fcQkgO;NXMM^HsIvuh}Ih zjy5#|SOkXxLMt_s72_B0Dm(PMk>=l)*+Cx}OuA61FJBf!E^*g=eA19#Cz zty$juT5ZobTjH+aKG?pY9|(n0CiuVCL=-*J0cY{)yH z`gg^6HDFdMj0!xJH5IuP%3YTE#ZZO$>Me`_7blU7wh<7d^JPqCDNWM8yHQ(OkAU6n z8odJ#rEPq_4v)i>9;|CES@1KsO#$GJ2zY0L6ejBIs)erQh<(E1}@ zUBl&fSG#;(!mHZ`xzu?u^4NkwXi#vwM5oD21(1cfAGC#x0Gg6>`tB>~m|zFHkc<39 z_VCnbHQ^$2zROEW^QXEI>?s@o)w+;bvXl0=I2J-Y!--(cPsDPicq2_H+!9aHOCS}Rdl{)y1a=D9QOK?aO0xWNaRkV=kToTc z>`4?*d`AsQGO4S~mq!Z94Vas*v&93<;TXpkjB4&GBY^VcIVq}3lpdJ90qj)%W;K@` zV9(%sKlcBaFD6hQlbiS#WUSDNCPOubUlS-;N#xY(RczJhph~18{y!^QKUCbk0+ce- zAGw6v)Rquq60xG|^u{Mzl?P+tzudzue21R9|9uOPj(P#zym6i3D)SGdt3u{t;>=HY zHzN5@Ed8vHtvb9@vd9;at#13H`M}@4FYA56V};dQ$!5fD7G&w$O0Il%$YWZ*^%sAG z^B6ct^Mm?GV5ROrB3T0TC{-s^-3$;xA+*hJNGN{eybqR|8&RuNrfQ2wnG!ono)9IM z3O^X2tjy<($X0oLqoyN9J%%DQx*Md`h?42KwDki!kH~1RaQ?K(;kkvhYanRTq(=dm zrsDey!@sb$9)gU4G`V{Jm-vZbB zC%G>-`Dk9%$wZ~ zz)rOmA%94!L;A>pLZ}PF=YEGqLh%M3G$iwhqr7=WIOTTlp+0l!p^gI+ zV)AF{b56($yZ;`+v`#AG#;8+<7b@AxV;zBmq7|J#YqY21H?QL4glQ|Y4@gY{j7B5Y zKR9we%R|i6SE?l}3-(n^FU@Uf-V*;%EGTE52yGFcC9uUBAV^S$8!8q(PTjIFn{02t zcTXylSGsC>7PX#US=-+B4&oOv4cg0HIqrWU2ryDzSFiXv-_73hwkj*LM^RB>hN+{h z#@z5(Ga_NW@%Lb>BDx4(b;5Xw>q_oQm3#9seH5`V>Jo$B2Wcwa$6^&P-;--|{V%~O z?M;Jh$h9~A;zbp5x^8SbcF9?T*A-!@vG%JBI~3N68D?)m;CM-h$|EO&pl;C5A0fdV z!Ix7zd!NZ3$dCC{C=TN}pV+zd7VQyVf=W-b!d`x3C@_dY7c5fSA@#B!9+hF1X42QV z>p^v7Jx!+S9*bI|y%$>nz5?j8^BWgd*_KNxLw1|K3u-J5G1&+(5CEJvf~efU!^l9O z5s{RH4hS0#!;QuSJ3lm1PKzlmIOG30&vRqp?B~GD#me`I&A6>H6tD_P} zz8dp-leXzWqfra@g;c%$HF zTxi^J-}S>1Qd`01hOPn>j@*H!h!5?lHjaw$0RRwtjqt(z7pRmdzRJH3i2k1v{(VYx zmkxK_?qxDRY5M0M{*c6Rk!`FI<9)S1`&aj8YLIH>+S0!5hjX4NVb;G*+2DX%nW|_F zHd}R^H=Km#vccBNa;NRRWHR&AbU;;=l8 zWk*M6${|s&#YT%Ivc!Uj!#K??Hxi^c%r9ecfT^eYYAlbkg-&CyV|?+74OhYgD+$<) z?wpMWo;&VS#DoMk4+$^>if+6!VO02{yP2ttXZnT%XSRr*jo#x!3%l8`CTnq92n7SP zCIZ3=V9m4`xVSCspAzw#7cTtjJFQMl#dofNNi_(f88H{c%)xfK zN=i)?qTJs6SbVWlpOjD_{;!B5Kgm<;&>CtG;IkV0^@E|Ux_F_RsinA7y&tPK<$86;Q-RC3Of!{*h(RGCqlT+RWgD&fxKkM2N6kBZgl!Aazl7wqD zQv1M1JzZD=p24f@>SWnV>hIy#t$jIleP0uzlf=AhdDV%yHN^d$_IAYcyUhDYDfL&(g`JS5L`5~7387D24?xUI^h_vt^~YbZmP z>S#F~rZvzQu6_wp9)>0=wY>`PED&`h2$@xhIM_XS?0IO;So9>pxirD_r1m0JVnO@r z4Qn@w!G|Vy$&_{YIX42cu$}BC>@2MvrDkPFJ-O$~o3L6VVOBj|T+Qw~f{h6H<0-@5 zA5NZ4hc<7Zvjv^hi*~XXn+@+4$8KIxd9HKr790i^<`4JV*%8#zN8Ss<)N?3{z6@}k zjdllS(}2dkPGY^Dqe8$yQu)v>>^U<1Uv{fOz6N@YHJ^A{;T@Fjb_Cbzh;@^*rS;6+ zzjwW#OAaP|g%MDI>=rXrE4q3#iT!HFr3G8qgCwWs9D~i)J}h-4bTm%R48H|8!c{dD z1;=cT>KM;wk^IGY5K1IH!I>IEBf*)j=#PIF?fVq?st>vLh9PaHB4 zlSUe_4;Lhf@i(6fu_o$QnoY^l$ICJqd}vJg?HflaGU9icx)>@I&z(*>@AXcyS{}WZ z0|#I*!e<4}>N7PcvOJs<5uoO>fCeE|i^NshkngOGttQA`%e>+I2GdG_=X~50->7H% zD42){Nb>7I-#dOWzGa)eRk0yywN0DAg=HJRS$!`w+lZYBmb#}+-6>uv;OixA)gyuK zS=zJ$EzGHjTut)DIi!0rx~7aDPZ@NgopqSC{;;xiZ+X+Oo)(ZKN_yWp^G+jB|FbP} z^Xw$+4(*KjZVgglH3!n4HyxLMQszUuLa86CJ#RfkEcC>oHXefpH2kC>jozV1@iFK@ z)qu)0OA^G0cMh2xza5=Uc~n8BH?{Ek{T+h=#HtGU7(qOb3-u-b_+PjFp%`cGME2oi z1`RLwS?BV+a`}LO^p@$g-VejsF|?U}i|_kVNDMc^#F`hcyB1Efhd+N2N)-fAnH5h& z9w&`${UImOc?tK6?xsGzpQfuKzpBQ4_Qp+7pQoRGMuhgHSsvy7WEvc~x{brIa2mNH z@U}X@`%j~PW6hPGK0XeA51Vhj`uRtOk3HSjtHzuzuip&K;aR?KUtlwl6;$4hXYs2B zJ2wY5;hjs_MG(}-`?Bc=u+ez@X117QW7)lCcwSKq4?w=1D{XaJeNZYnLv%KSGiJwR z*;rT!a2}@TE%nn{KRkQAsr0N&)LtjAT+X;I#Yn50f2uw5It`ocNt5>43((P@Kn@r& zbsKx6aZhVad>oIbr-*usBKi$YYI|>LrDw=*c3Wq4BKkyP%KmajN}($UGvGOf8Ho@m zDUZ;CaHO=z1n1DvR~C#tA{MWYVioi8Bi650+lWm+<24f2dKflii22*uxs;4g_OI>3 z6?w2K3vTo6W_`UU(yn!sqNIHIM7+CnY?&GB*t! z2bmokX5|koCT+{RuE8yN)Wwsfgy9;eXiY!z+pQJ4o>%Vkcq!T^mUh_5lZA?Kg4WHy zC0sg|GJzI9B)Ad(o&O>-g#ke3%YalNlTqE26Ov48^fimMX?(L3T9Ezrn5KHYMs0`Y zPhY(AWHCJP9`Nmnge{DYc|o5SrXj>Svsr0);p8@U&PEgZERa#dvV-QncG?B&(5@6t zTD_XqijXRGWKcgl67#V3$pNoUDUav^5-w!D&3`p7=XWSb$aK#AcWGOp=so;wklVX; ze`(oH6~tF*>nQQICNMhHu3X7z7v2-fS`i{j_}#hlGX!xl^9N6!`X_A@JyjK1?j8Ok z^LDN8XTtPp#F2YNs`>cg*A9*oDMYo678R7=@7nMVDjly^o>CK#hj$cuUZzO-!VnP# zTG*R)on8zF)>9)*4gH%>I^X5#pI*%zqxbq;I@$xs*D_Z5LIbH@x}F|ds$no#N>%K4 zbs^>qX<5jg`$+_-HEpa#Do0nAbA|p$3tEv}DaM?%s-Vn0K15B#AM6h)Sal0)qFG&k z+V-ckq{NJeg*}lq19uC4h9vb&Wp8iuVr6sdzC`Ulp1kC#4ABYQ2jA4N@l?>Dn#vAE zbTYdUloW9)rLLe)91FFH3Sh8RMQ{s9W(K%nazVtwj_yd zu%uvok<&lmP%IT;39~Cpy#FNLSAxZbylaL;*~99P^B|&qyQWeosv|Nsro3)=yCTH9 zS9zALS=u4?`qV{=`kv{?W<>+%u%Cg*DK5vyutx5}Wi*B7g&1UAakQD1vDoM9IZ4Ij!h6ph6iL4X(Fcu5$*@e>!p!z$sW zQGMg)tT8BAWrq5)&DuE~;ILxpRj?sDlXVvNq@{*w2&mGq`Y!aN+xo{Uawb8cd9m0O z(R&1=9XR0wd`7hl=Huo--h`s&G39fr*Nm|9jfN8T1KkmidS(_w7Je3ui1gQFgL{RP zQaaR(OKmg=N>(C3z|;!aMXxAp680fVsZInC&i-j|7z_gTO~wX1^L*+Mt2r;uEPhzBS~kImvYm{pKpLz9!;vkrxrN zb})khHeP0g#UB6@4~0{Am$Bv^<~ih5i>I) zg>g-NE6_@*_O&_Mq_5j0I_EP)5+pN+IfW_NXhCbggC+Hn^g zLH8-$LuqzOlP!heo0pHy2gTNqn~ikiH{ZZ#_uiek)l)<4&BQ!YR54nmqv%1_{g*~n zWBWc&rPS&(WV-`z07?gCV*dL_H5oxSf%%zZTeYt%`aAjvyMze~V4$V>Oo~kWF!)#1 zRaA+4UeA{17wH;0JZ-OWV4Z`bj4(qWeTHr%j9r@q&bU?P8T1V@$sAb_SQEyL=;DfOE$I+q6t zvcrfuJtye3z@^4KVXGk@^AG7hri7#|KnPYn=Q3@2NVM2Uhw($mXFFtyw~FdorwI~K z7}z`6-YHBA8*g|8bO>+<568yU%58HMaH(gJvO4N|qeB=h3OU7OOD!T}of1o`BPkJ* zUg}%%z-?$m2u8dT36bTnOkMV$&_IO+Vs;Cx85w5%Ky6-g$XPaIFB2BTUxxv{ugUnb zGx}qcGZx!~XpB-zAsww4PZEuA-O@V&4syW>ij=fG_@PP`Bh95qOpPD87hN>);rO>E zh3DHOQ{0%{gW&ioh6eV_JWqTN6bOP*7Ywa{-(I*%{SVH9^}4E+ij@%@sSaLPb~ywV zlBX)dy0-Z@j2PgHeg#|Bct+D$>opXB^@jsn_-|s8v0SNzBjVN{{6 zF9XMud0Wr{DX$bbtlTw;+I!DL~2X!@0O|+I9q#4-4W=fx7>ct>;Ei zDsGEY5RrdOrO`oyWh3fT+F*tE>i>TKMX;CC5sRZ(4=o8ud*IT9JG@NwS(g@jxQcV8 zyqpsO=<>kiP!#e#XiN{d|O*9?JCW9;4ZXk-PWM`k)EtBw*0QZ+I z7u6Ox(1RF2&2Iqw)z<32wsW~XU)`1kpCI`ro+GI`r-BbwhJVr6VHg}s=%QD1{}MTv zcjl8Q4FjN$#6yH!{^7F;YAiveP_|@r>0Von`l1yW-tj505|t1o?3#96r1HX&0u3T9 z7$-x^vg1r!_GXA(5*Id=+9{&R6HV{i*+YIB9E9OlTA)4_ItkvCMzVzD82IE{eTSMI z){mj>mjc)V8~W$z1)Q|^O7 z^gv;6AO#5j+t>Vo8(iBfkfoqA_%*N9o3(J@Z#K3SogT|BblWEeEjAS>fEYu6{z_ce z@gxQ7Ql-b~Li;XrVS4-Zml#YxJpCx2@XDR(I#I(F9c{0K-h$g`?-F(v1-qc z9+6WWXwS!K%>NZZo#2%S-%SmeP`wmiZaz|7Ya!%_1k@dF9brbAD9Hh=oo63of;i42 zT-p)20{n=I^*HgbRKiab=MFG<F53<~)5nlWFxw22BpV+U>|UhdGf2T!@lHULYi`o(E3Buqxa~9?4?V(2h>U&5ceM1Fxxyj6BB{{8 zLssG}|LvCRTwS@y^5t^;wtL3AQB5~t@N)PzV4*$V*q<)Z+1eXqM>RRaxcX0yZ*UtG7l2rT~S|}Oi6&Lr13C4i=ZhJE$)j_q#< z=y|zZ*sPhjui|Jdcf&`a7{=DXw+Yz_BI#WIe5|1NU0H|VhqYu%;rQsELfkcMn^>2(~$wa*Zkm9J19e2WKYM*YFo%4U-00aZO zE?Ywh?tXJ}g2Z}X(#A)-u<;An$Bnw1DZEy0E*m~)RGL0xOaOTRgj;d<*RWYSv@FAs zEm1%cs`??m9y{kjQxBs&D?)gX(cVJk%tTGVE9$Nv=9dr&6rqFbKQ{R_xMV7ZS<*~> zBWsj$P6{!=EaM*vdX#}4zkdcXb&0*XoN?#Bc~Y>AWvj=(&AxB=gNM4XBqpmzecYaC zn4L(MFUV<0%hEBiATXec&LRa|ApGj2=X8w23eRn+GX$fB?=e})BfR(Ju%*Gx8t|Q5??v90mNGkTu5E z1fM(@z`c^eFae7%Y{I>F*Iy{X#ak6ap)o^tH%cSVV);#aJx$7FN~Fhm|KXh^8zl36 zw{RbryAaD$XxLzSKD##DN-=BWSx57?eiRi%UZMS@3Fe}|(--=x`H^UMOi9d7=T8 zDdjhLg@ETbed_WQlP04gp#nt+8*ijaEp!>~eUtUHN8AKX`G9SE+JH16#<4e%aV#g5 zTm*;^t%VXKK$d4*_v!t{>+!1d2OMAWp$k${{Q-_e1aa_dH9tTwqI_i!ZVDSm_IwuQsESLf2! z#M0W(7PuAqIIi?!lj#06qni6{9(Fl>n5XytStu{aCWu>*Wm;KXfkOBCp*$t`L5yt| zGrB}+@up-!t`I5cdihcibR@G_@BpYW4$B=+Q=wtdua8toS?_`#(mrqPr7HLYxA@TD zPM+lII^;Ta1b&_B82Px8Dq<|mF;Z$B%f=9K6Leo+%LqPdP0$by({EDiY;Oe_0x4S7 zvg*wRll`rlK@Bx97^0Q;0)4M_ij-hvkVoH(v-j#sBQHyNG6CP|Or_Qte(@rkWh=_j zkZq<;_Z!Vdoig5+tB!8>d&i~PMr&!m)vT!}&uUE``9^*J`&j1PN%bo?YTApWtHZwU z$9flP&I=z5c0xDple}uKI3+Sy=jJMFoqZJjWOJ+M~_X&5Sa) zJd|||AEvduET9q%%zl%|9L^iuIse+fOV@C|i?ybiWFRPhs0(K1MzuDWy z%xn;Oqeb4Ay6(Qmfy5RLL6x^z*B2VPZMs^lu3KgeUiDZW54By*{L0f~r=sXRvK3?h z;?qggkz>|{0}*qkh2s$7F$>~5j&x9uV|U%I_8h>?jISqu{~b?;Ajo|`FN;#vxzxw& zcl;@#@W@vGY@m$r--c0I+)wkQDy{%pjcqepYTk%$n569$zxu2Vdmr6){@#%HD&ZL> zf#U$8(ZB5H_3EueQ!Hi_zBtMnu0OtYn#>Q@erK!1f-!AH=FoMW#D35F7CLSM>5wS% zF^joH>=T^3;~|QH$K6*x7sAW&YlJ0DARJ=%5JLr3dDpCkihA8+r#`SA%lk_wZ-{uq;eE z3iO2y)8A6CAV%TPw?lZ)x^mGsEE;z7R$Kp8dd3dE&4Sfqt9(oaAOP|!@mv_4ssT06 z6flGUu#*ntuZ$M7nQFkl4et7k;*$rJ+W=`n#zOwe1G~Dr#yz1)q@Pgk9CaoBFXrAd zAdY5h7wwtBJt4S-5Fl7^3l>6f0s(@DFnDlx8$y8K7Thf)xVsDq?(XjHu4l-*_xJ7Z zoO|y5dw=zGSJkSup7qq~o?6w_2;By3kn8W~z|P^=n80fR9}A`hd0f$JAB;po0H*pq zt;qs;X7f37r^p0iDqE8nONN`^;LNQK3mpK;)e2zeu~p~@g~@RiR(CxRO8iy7{yk{l z>Old%PaxK5iZ6TCgj|TX*Xs~(H}j*;Y(DhAK*6{mzyB4n)5Vm4?&?0eBIut61}zv1 zkEX>29t@dXWTNmsv)ETgAhhri9G1k#z7+Kn0ow(w?E_RWou>~dR+uYO0Kh+M0f02b z1UsA)RIl)l1A=aD-Ojv>taqEfShoUSAHO>;M7BQC z;y=|8ZA>AIniV(-qEcVpE<5Z#r6=%(J8U^T75Dnm6a0= z-t`++%PCVE`Zc>L1B8i$?0+3*e@qO#24r=TNF%e-6`I)WxIFrKVB>FOYfEi*N*w&0 zI1ZP8mdB_+2GwV2$ZqrE+nTS}et0D-NL5p~op)F_M!g{eunO1bNN;=9%CdqHoL|jU z78A=6R+>US(0g@yRIk983~8k9zq2<|WUgft`IS%SlKr$@oKkBYR@VBJImmb$;_UhI zY^zp+>Y+K4x9sKg5nlP-GuG}JNmY-$qOKp)4j|^-g%T3Q;{<{O#JKP7&U*)9e)q(X z-%kH@?@L{^H;m7M;)Wi7Lg~53c}@f?Qua4VxJht zI~4N0-kuqmg4LNXRfO-p{uNMRf1Gc*%JDp+A)%ZO?0mXH(r=|5T}vw6P0q}BS> zUG{s+ui4&)yk`=_B?u-J@N-io6rdEB^WpawtcYcJ^2El;wfC)t*ugukmbK19R{IH7 zeC2FkRv!Du6Gs&z0*kfJW$&984!R$PLV&UMqx6~AS252+2+sAi!e~w0_4jjKD69p~ zvyCWBUeZ=MCrix@J-!Nh<8CHKn7!w^c%W^PLHw#l!1yET&Fm+^bKX~v5bmBHIIWdj zYtp>^vo*e^7Tcs-%L%~AK!W4}DL9fev6o!W5d#==0S?pTz<+t-~aGIpN&iat}4KflzgN51$BOeZrG({o_^wxIquW$pgiD`C)RrwEM2;Rr{{Gt3Qk-N(^*bVVJ%Ts(j~;~EY)rIu_W83T;?`>*kxKGH z`n5K?J4agO1>5sP;0*VydNgg`tT&5uQ?7`=8uG_YY>ceeoB-bV7t@0VLjct$u)pAY z+Pqfp$$2G_y`-^gX1t|kHZO|bx?jGeW0?gZY3SQOi=PduSHbT0{7-N|=Mr%7x#&MMyF*@BZc z_`yUtE#g)PuC6*ijUHC^pQ-A$WTyW(C+Ac(LzCrGyG`H2ruP?D>;M z--w##P8*YDQgA$XcXrPB-gD{t;Dd3~YR0rB$v!_neSc%`k=bFL@ceysP3-_rA+zAF zpFMhFcHZlKy|EAZKN9h_-h;K(BYokeb>^D`zRdA(s9W%x>!n9OarM8_c)x9ydd})u z^3z9D9i{0))G_!tZ6YK1w0jxDdg7x0!EH=GW-EGLAyI;{qW=BJ7#ZU`FJ$=!A9B zM6{)f_O$)sK`d(-)W7Q9ezU`epnj%oOSmuRv%Pw(TzRKr(DH zMM|e_V7sXm^wl3&^dE0;@0`2ePTUMzn9AP%Pdb{b&MALiCu&Dk8%TK7GQ_h&!8g27kLhln{qTrnU zLEiLnd0mNQ&+LY$W}d33I__3kt|QBLYc-`aabpfW(_fjZbm0vQ_ERv8kW_6K1-IS; zW)pdgwMj-ONi$2gZRsw@m!$6_LTn4lIl(yZ$uK|snWRB1&ooR#8C?6&ga)BwFpQBp zLrb=VH~4Hmg~Yfs$-WNzt)rS*o(&5TyuyYGMlkOGqMONv4Iecb*QTL2}ZAh zYs`llV#XKuVaY;s<5D)JTt)T`!+lN(ch`02bJyb!8ul6J{CqlD^ZG3Zfa2(#Vqkb2 z5tv-~ZKbNKODfoR#1j5Zi}3JW{I;F9l4#!yOhH76N#tjl=@^Qf8_Qdl&(C|rcl2AL zz1E^1g(0Ec;4AyS4_~YxV>7fzqZIKQ(EHW&{^0k?$KOyMRe0kUqCxAz-yN$TW5|jl zk@dL(t>%{M)D1<~>IdG^?^?*03PkBhU7dolVnP~-yFUNMiWX4^mI4HsV? zw7WLhKbUvyao}1gC!%D^%i8Fg?c}le;3Qhs-_(tC8h{*_q>2KEDPMIw9XV?}IP8UZ zoR50jp0K?tAlI177A76igz(H4B8O_Y{{kiYKSiq%&`qLh;7UjhaL_asD2`WMT%76J zt$|09I=!1Mhw_V4{E2pR4_O@D!Y0n#eDhT{fi5#MV6Zb~_ zJ-0aGmRG5(B34~3K(sjQDu7n?f}?24cw2qD*Q_GpHeHCqpH{`nNzBtS z&kHF0*`YHMg#oJ@yX@@hI>$yb>36S ztiESXbJY3o!&Tth#g#b7ol#XKTa;`gY!l{*MexlS3MKp}p%Q%yjeK3pQ^{)W%W`$3KLZ#Sf>M!jFH$ z7|KXM2A@D>S%t+qa`ZPk82nZG^Y zd=)ff;s$@4+ZFx%mMbCJDsL1+eFuc=b+}2OV!OrgnVFi|kkH;_i%LvPY+sooGQ$UX z|HHv=>F%}n z#ZoLc%>@vY`nK*>1Hw-Pv2xa%+Ck_(!^Q2W;J53KQIzX51oUv@nAKf`o>glaBbsGe zBQb>{i9MM`zuoHQg~kT=CZQBy^S!}VFQavkg{+7CC|k1v%n3nmJL!Yy4gE0Jg25WTXR+c6zso!P#wQZXN9 znZZ!n2VE_Pg2J!dsHZ2)N61=QOWCs5nlK6)TMBdm5;3~k0_iTv0by}ngiS@J^Wjk^J7`|44I1_{C`f^K*!Ree?(R#*|lxd%2or z8XktDr13O90v+mcwMb`Y{e5^VuC8boX8k*+1#L~x_3yRC&ow^GjdM2N;k{a_BnqWp zg-NjL-}9^83am|6*k*%clwJzXL>hcMdgL`RBM>eo+GivW=?g@Gw27%NyOf~z}B-XHbIef~Mv7BP?zQTz-M#>J68 z^18pl)h%gReqeWiu!%y}G>o&JpbeFv8v0ZIcFiOYL3tYHf;^+K zB3}U8q$U)pb4g=~Eun!|1)NOo#VZvtLNhyJZksyd>5>HtoJkSgtcC}p$$ovTTi>oKos^d>ixBladqP|++*5jD6% zu%USnJJ~{^hf%QQiY~k7_cNNJATz0IyRL&H4B{eMRpO9Y>3rBVA;wWV&AiTUsHzU0 zX!ctxxlUIGiOQ-8l>}ro4R483+-Wj9Z*9$@$9_^|-CH$ZE~nDW$B?iIOI_RaP~^-} zu;juyeWx(gmv*X14l=l6khk~uxU+_T1b^_vk108`@iNh)I}?++Q#EuRkL|rap~QVZ zeIv+LG%8QJIBc!^-Qs9U0y1Xm-<0e)XeJfs{8e&5lz{CMXQW-?+bi!+V$XiVO4frN z8W%RYxjXvPBn(j_6_2Q#uR(%ClVPakuL5Uun=m!Y`swc^xs+TOF;L#rY5?aevENMz zUQ9c(fnUJxUT-mW{7Bff6fuWM3{MPHb>2@3c#T(AFo!bvN`w1<*0b4Avvn}U(Dt$w zHye;vaa`zDzOOnpvdY%m4oY}e8-e9m^2K{}TK*W0i95r53E`2e$+D?{vK9WYiEa>i z9%7Vr7#1KgB&D+|Bss{sz2Vk(xiRBLYe@LmLQw-b$1B%kmsVvIOC+=*LeT8SI?H&T zP;5jCYp16)zk!wL%k*G$!PcHJ&n@Zj%g! z%lDU}wh~^GvDlMmUv4T-JZs**#P@`@ccxV-0%T#o3Z=(m2+_+VyXMSXEQVl&j~c88 zV=~flVzo)CF>@3~!dw<6wPK8lq91+j_$;R#*y2a4I4+w{Llt!*JJcl0Lr$gt`8n*E zE4R02ws!7F{!Z~CCHq}K4LfJIJEl@u>vP)uk?Yg>`|D$!`@1UFO!s72qoPXNOCBGt z0mH;_-vf3OfH)-r+b(m9^Cv1iJMprJ4m>e|L3PvZwH9((0h#!$4z)~-lPW{Z5b+_w z>TnjeGLt?quKnnFj-*#86i{zJi`7H&4zs5KAK%2$0!YLMs+R$tsh39dJu|K6UR87K zuhvR|;zOg)@_trWK=mJhN0arT5cywa$*2dP=9A*q42HZ=0VhJZ#C7Y=*Z8`H{V@TF z_K%g@z}{(Zb4fY{Zf_$9aC!olKyCS-<-%;JrbeF|QDJrH&`eA{$KO5L2Tt1*nffoM z9RS>3eQrB*9MFP1cw*ygTr!&-(ao%D`$k;1BL(~iNk8!>IWWTjkj>%^!{Xv9oBwKS z?TG{IJ%&-!wd`=fY>e3O0YBrX#$s~c(AxnR2nrDMlj*&Y<3s7gGO{Fu@AvkcPy!Nt zesOsCKwErs4QDG+d<|BMX?PQqrVrXz>E#N_NoKA2vie$GyjXa$0-4M1#+!pVyZs;2Xc>@N?>_sD;fCQlvwsn%pj z)1I1JlS1TdYefEj%MD(V-|JF;W|MMKqDMexw*rRxW?XS2> zc{xcc%#lsS+aLTUB*J49++q@HICcQ^EggW>{~Ccb3sSN9xdka~IYO;4dt2U&0s^2Q zJo5l6FfM|ThXB_54A{Au|4~jLwk6@7cyp+R0m6X z0C5C5@P`wCew!p^A66W|&V#k;cs})%K*00w+Ghci-`8P5069kq@NVFn9Ae}=STy~@ zC=2z|#8-CpOW_432?|u7V!Z#dM5(8(9y5V&%$DjvrQ_#*+Ia!kaHz;HAGVax;aaST5ww2fz| zW&(TMKPTcxDbORVz(PB)+G`o1 z$ag>Ofz*Vx&0H_ge+yeRlIV1kz5PVPxbP07F2IHBOd+_F_(%VpKwKI+Dc~3Ppj)iP zTV!(Kl$;efFnj)?gs^380e!+X_x`IqP~C+JZXOhdD;&`_X30 z%cJ4yz{!0)(W6ct2op=?Abl$!&J;j&6koED>tI6s zOcw%vGtfZ?y1T^f0Ie3r0;(7ye`PoI$uJgGHIES*Ix8kdmf+Jc?9D%dB@e|1UeW@t z=SSN)!S}q^CZjyyj2*%LLII(<^R?mJWu2oxTD;fXs_U!G8jYNp7P7*&}TOfN8G^ygn&1`Y2!H0L&S2Iw@Gy}ri z^DuA%d$i6p{g2WN%HGIRGJH!RvUMT!2y5{;%`fhtJ-ToW zA+T1cHP~=|#PlYZynvW51?%}K*ZhZ(o$or4?}Zn~&0fcea5oRFXdO*{J{^e))cwvx z`q4_5-#szy6(?w63&c#`d{m>)lr#Sd5P95H0pW8~P@X{*v=wSUoEcQsEN%H=+x-TJ zV%OPq)<1d+C}^)o%-?*c+vvpQ5j_svUCUqwywYpA-5hnD?3t3+1#ffAw+xv117s6o zGOw8)ENJ}ZlN#bm8j*eQP8Xe=sJ7b!URo_w#+}%q%)IqXHMzY)6&{L)M3Se*d|yAu z)o4eXkk~jtx6*c@9GTWVO$qd4ew8Z^^_{%SoMg;x`v6q)0QirB(xsZ;>gi7*#j>z| zH#7axH?lHGrk=XW2wg%pF{?P1qPpRGe?G)aOa#PLiw;Ri{;^TKZhPjN6CrZno9O_! zbFh{96r*fo|E}$WT)0{Q_&89W>t)XK+N`6lS@-UPFvUkCfgXWP!uOp^J_uKE18==w z)fMZz+2{StY6`Bnjwz#UNIG{ttf+2OVSQXw0zO-}5XvHV! zUOOok3{|WNBf5qK+&?Fi_$Vin%ZU#ZlEe4vg(QF8E>~%(KrR;F7gm5(KO4^Jbx(m| z+Ve8Hz4liFqx<5fSb+(H04+sVt{9CTRctetF?}hsM)d8_Xmya; zywAZ>&1sSK4P4gh&0Y=N`gLylSyLq=WBdzR@w}ofRqeT~8DK%}?UNGQ$H=?m?%7kz z-Nw2k_3h32K5`~_uTy5E;S0-5y}y)IR2pnFZ}UCJg_zx1OAKd5Q&9Mkaj zDO*PP;;IsX}6Z6qJ=K z;6gdnSDJH?xrCvvooiy5K~`_43;Y5QBSb!yX&&QXEC!Yvow|Dvmeb^IWUQ*#wC{^@Dg!55IoIqvNVp}EXBI14FFLccS z?xPPbB!#)K*v+3>dHAx`<%@dAJ1g3>PxF`-B2wq)JcMBiJ$H2%D&J92bKJJ;1CKaJ zz7$Q#guTffE=%3hkO{SU(e^62Nxr$Bwdzp0xY~PWRVm_tMr1Da1Lkh;`ll7;wVYEL z#pNGK)x!0LW#iJayE)lk)OYQEjk()vTQL%S%fx)L&NHbF;Grwl{roIahMd$y09
      j;gzzuRNpUR!4^Ut5RmGFw0*&0JJ6`Pb}@DY6tKvC)o=t46Y^c_Mk-yq$9|y;WI@ zaw{Ey>PM_g2i?wV`B&}Xlo+d;Obd!~Gxi1(O2|9eqo%}H=<1o#+Q>Hdg;eh=<$7)E zTfzic1B3KsB`S#yqzg`4^J|+i2;dqU&ho^#j}P6pxkS%fr4VV%tW)8(a4f4xAXIXF zi&s>smZX!D`zS)Sl1Ywgo_(8UI>Dwtw)5;4bt`+J zRcsr{eawyRAjpj6L)?k(V2eSx=n4cI}IW4T&|XWA|7a<9yz!nuW9c-*qkmdkq7DxP2Ku7S*(`s zTw?Hk1QRS_8sqhp<0A`t2$$)T$KQ|l)o{nVXFKJb>fG8@;c`{GXL&cj_V+cOEU2Nc zWswMcDqi&lurf79HUe@?k}al$Ohm=XAS z;WKjF7s7f_a_?5Zgi$w~v4JyFz}rntOKtKPfMeoGaEQpp*9Eu-05APQM8vW7ZZ8!I zVc0>{@?5s&QX>~eThH`#a(ClRI0xD8J%KvMU+l&QwmF%6d1uN|1}F#U0C95gF1k?Z zHAz=gT-q;iF%NcL_tqMy>amZ-QbI(gn7rYx8qrt{4)C&icb&JHl2)w&cKpVyJX zW^RPQJDWUdn%>}@6m?qNPdNOlloVxs-yl3kRN8_MCVpL3D?|B-IQPScjG1*m@`PomX+zZKZ3HHC6J|F?!Q%WQtIup=Fb&ufM}ogg`cSS22_l9 zZZM(}1Bsts?kCrhCsNx^e|)C^$~j-8Y&P;_#2_|KU(DA~cy?`)DUv5Nk3sPPPIG;JH^ymRHw z*A*TZ+5U82RJkzBEbK(D{LQ#LK)--~w;Wr2ey#$Tzx}jX&Cpuj?VFveOZcUv&&Gv`(>Jxy@!QHR4$PP^k3L}G z*80~I>$eR#QDEoY-lAzf(pmTHX(OuSigRPnn>a-!BoXEsk2$+S#xD&$GC+Z z?l($O1vC3#uN5a2D=M{^(h&#hSrwcdn0HKsUcb($ocG&|G^ZEPdZ_hEPC5+z`#4k= z{e0+U;c_r4l4`O$Dy*~IiW3!n`ko5V!Bdnh;!8=30}1lOnv2Db#iBN0HxwjY!*OY- zK%Q6kw-=J2pm5hrnR4{{@@ZMcQhUT6Rr_^|i?3e73@M9cs#Fe@FyK$+&Afw797!D? z{|a&Va0DRM#4(vLHvzuPCyhIB!vo}bvsvsf>@TgTC?l7|>BlG~L75~T6$ge}6rXZ@ z1)(AsuinEgaSqEWiD#0LVB!NsZ#7lZ(UAqG40cE9;I&RFi(uzT4%Nm ze?p)3MtSjWC63MM9%MF(zFg80QL&qES~i>tc|Sy&T;ELv>QAPCc?*UeHSFjDZ)bZ* z;F2h8!W&B;>!?F;S33!caVmZXewU}s4@CL!!O`%s1MUXJ9++*DsK!cJ!;B23dm1T^ z2F--soBfV(pv}i7blV|PIW~EpVyX@A(CPbRPIV9>ZuB)`GCDbl)8J^XlX>38MfR%U zs3|lXCYp65#cmuY1FcpkRD?UOaIWDApqQ@;#*F*R<3Qt*jtp;(9plJUW8#@!s5gC; z638WItJwh~gKi7VIa^+Ui7nlD5SFRIQEK(xUViOVbz!8^QQf|*Kq(I9&OdkJGzO@M z;1dIBbg1;h%`qkEfoZ1O>=BCkl^BzW5jH7zli1tP^}@e zQZ>;Z+%Yhmb(t1Ij(3V8UxOepwXsia1ZMEt-g<>&r(B%`gW zmobvcT-|ZWB9o>QnRZ>f=11+g_+UP&vPJlfqDRUkzJkfxmixHIXap_ly&QyKL8^06 zaU3JA3aL$dIzPuFu|^mw3koyf)`uFd>l9VOzBt!E*G68?0VS=G7%1Ai)x~qd!Y~%V zDHpYTg7G*NEA1wUm!|k!707wv`?c9-UqYoPEak>3Mai-e8>*FhFl3iV$UOq0l3dIb z3Sj7TD_3-%^CE{0--5{Kcf~d!j!zE$K<6Ea^7gpCJKgkywewR$pgRO~41vG#uqe8k z8Lz2;$R?^kY`@kQvKQ3TML~J|((lo?XL*a5Wna<4+7lTkc64Kc%GU``>!z5fih=fG zIL1)cJAQTy^@Oy%&UqtI(n!+KtdKg_V>VXmScg07LeRW13OvnYT;u=+5eyh$5lt#K zNE{TO`Hj53^D-?M{FE|L`yJR^Nen4Qd;DDxsLM_s-FCo)k;NPh`kOsNHYf2>q0KMy z#EU3`u~Z%6Am>B!{vbbDZSZ4&UpHL7R=mmcuDNS~MmONXC{wuRxCH#(8>*Mz>z6j=^ns?-Hc?i-sVIJjKY&g!ZAC4G#OUr*+7w*gM zkiM?#K> zA$C>IYJaB+M^l)RNF7_Jd19^Q^Y4LP1BiMCI`g1xKdQSP(C7Ej=x1tT+cG@wxeEns zm;}C#wZK-qSP#@&yihRs;t0w=L`*1FJ4d0vnzj6*D$>zf+AUSeiJ>{ZkbCrljY5@P z84eFn=-QG=S8Wqe{szhT#&)>AN_K1ah!Gn9&W?u3&Rh*XG4vVv-q|Rw#g0CAGo6od)|k1QH@ezMYQMXJ<>5ug}iq9$=2Nr$OMf>br(R=f5hbYaaBMh$2-S$ zNk;vdgIG;X<$bx2qHNJK2kPS_ItL^;_Nd|jiF-;^Mk}}=2NlXEmRm+3qxUj^axwe` z`L{qDWI@P;7_+Gsr(alHECFj0N*i~F&nBgYOex7ssx!&Kl5b(NlENG{o$sqQi1 z!3dWy2hx}dbCcg255$%O_4q4O>V77jFeUDl3lqkLyK0AfPE{Nk zDSA>Kt|7FzU{u{+x(yO|6qrwl1qe#Bl)wj9V`UTvB3`MJejhjlvc@xLtwhmf@kke9 zhf)7|QB!`0f6f0Ems<6_Q+9ZrXeQx(3iye(*WjTw=1m!|yq<_z!+g@{LM&xu$#QsE z?gb;N61;Pl_v++YuLt#}XK2bmqk)KkOPG=lm25}M#uQ^hb6`eORcw1F>q)SU>U#XL z3OZ9w5U;P zS{U&J`{@>@aC3VM5xd-=+rWb(AA|D8k7|gM^O*)sBP+VO*hF!K7r5yzOd{=OsQhr6LMkb2k=`~vFJ1A-F;c7n4%rzhG=y4C%x z^fRgWiY{SH>Z&EG&QM@I9Q2X?lC*qWtcBY=WpjT~#6V;Fi~7n95WEn5*m?6S4i%2I zaB0*Bq<{n=d_ZwY^l_IlN72`xH9A6nv`JO!V@q=j{n9wmq48@YcIESm1Pm?d8F~D9 z>K0TOdE&it3>)edS5azkypa4ii6Wo+AW)P8cf{jIKXBJ6X@rN2Et}&OjH}pZ;p`(R zpts?`P^I4(I~SU?)z`*QPgyAr5CvYcpyXAiA=5x z*Yuwd&Z7R>ABdw@xJ?;>5e_VJ3C!1d^E28qt|25PPuj( z=FXS_^~aIl!s{yxlhmu7J;K$hf0he#;rLCo;h`=;&DX1?JDRDfy*g=I=E!Y7my*du zc9(kNot1tyXRzlrSC?U!)=J-(uGFuyS%T^J)?a$!4h7TFAFo|sH}==Z^DfJ3(S`L{ zBq+IF3{`qf58Oo+s~SIxl|jrpV{txAEqA&vqg6XP-NszIuOsR;-&QhgxG&FZRqy`l z{g|S4Z~aH=Y(}T@?skE59mlHCZMn;@?v?!Pnk253-PtrcAOQdm^WcaS!GV?}JkJR= zdFmuBgwuGu=q@GExt%$KDes&ixz^tIcsdca;HGP;$Cu2Pp zj@C(C7BHpz?GAac6VDPMB3^Ov1^qn>J6nZ29OzF3ASb=IO(Fb zVv7bN#3AhV!UN{{5brbg?$?-K2nX@X&c zh-5-E2>8>3YhtvV#)1M5A*+m-hKksrK0!ff@>fs$^7s(c?XY>DkQZ18ebIqTjt7K6 z@V}P5PQ~WbrNe;GVj^m9l)2 z-)tpHIeP-8ZZu!B72yp(Hqr)W+KJ8RO^>$k=(>WU*)E5ArSl#k1VjVYO}Y;GEN(2B zRDc9R!C4$A6CR6G+b@OfQ$HHYzzWHts?i;Wwg|+(Hx5ZHu8_jpH!4B|YktpCCSCN7@QX1lvDA z;49qNX0XpA9CG`0js%Pl51yV6RPgWHET*DI{`GGfc?$Y~PaU$rwHfe|5K|C>fHfD0 zbJzIu*@8Pbe?PenBib7QZ?2iqQ`wQ04*adB9QpBT@UUbv-0CW_lJFky47w@3 z^@Z)>I*sM%Hm|*P5V*0>qs{XDDUyzS9sGR~RN!c}ab!Jo!p@Q~{YeET}+59iPGb(_a z`^QO&HV;ZCZhS-^7&kM_j@~LJX#Vj$#joe<}{7fQhTF1#VGnaC^SSI&dIqsgf91(I-4#58PMeA5xCR-BO@x>U^JGS9p|8#tZb^%M;D#7(l zm*~mV(!=4TFsF+QFnE&-sb)Kia+q24WmnNf{6ikLU7W%joS4PT4xtL`?@p~{U&G;2 zHYT|oYoB=0sve|{RkrcNs$A78w=q6cVQr+mhq_77Hky#Ck<{ft3>|Q^pSEve6tY=DpD@x{kEb>cy z!wp<(V?o>L?cDELz zEc=j<(5U=aZ1Ff}7Hgs0P$M&xM|oUBwBEr)1t?QJ2TvS!t}yBC$a2JDQ)3Vl z+mYg+t+AH{4dN=C6sbMGx_Td@V;pz;3lj<69bNXEZnlRNViy=4mx<{NTy$dI9IZsD z`3o})PDFL3&!@tR}(VOb)f}kQn8jz^mn?7X;D?yg;1UwNYy#jj#+SQx-a498Y3pnZr@0J1`fDVP7@Yx9(x`y%&0m0nYtTfAuOi~Jqk%{VJ0m9)=uncq*6d?WCjZ74A^ken zr@ZUNg37~7!y1hjOVyab&IeA1OqCWvy-`4JwpI<8$ZTCHacawK=Udglw0e2v?lP82 z)FA3r4>6iL=}>=rbTuoGEsnm>gtK=qMUFd9t=YZy3Z^iVQxZkA5}iTAddG*vxtsf> z`+Zi_a~P_+CYZ0U#hQ1J8RuK~$|IVEy|tu$;_j0YX709b;K1##wqzh>2P8ozl;2G? zZr)xrVKr)WBC-3=ChwDtm3WC_B`9yUoiI|!6x-w);)a(q^I1MYtUu@w0-=Ggqx`cQ zjvAsXobxP8f4s?=OFnFttK0fycvcpXceFL&;Tg~Fy}X%Np3)lvd~$cR`RprnaX9_B zr@X-3H9ss~1&C_x0>e?3ZGRgyNA5=e;<+_g$AGMX3jfPFCP1K?Eth7Y6|tMNhOi^A zQbc;nuh0P2BGAQ+Rrl%<>qbW^Wn;q48y7%eTuw-0c6ZSzr2rHsH`bRyagPesSAQWH z5^pIK=@ZX0dU4Zg{H1Wz3@(DIQwVluNlXN8&V$5m#{LvZtkf{anJ5#S7Ly;z07T`; zAgJuRZH$3GZKNi$b!<;|taF#l)*l2~z(ljJA{l5tuR~*?tVNADFZoMMY|7g{TG%Dm{8 zW35GRk9qxhZ=Y(;B;9^o;^5eJh;J`rkr*xR?JH4`@&_dGr*9mp`R0Tv7nF%YEp@JS zJ*nl4W=px{iJt3&a3H-R$P|p%KBJ3&R;k1l5puaco;On6+IPl$mUS#(h7V&~r{lJ@ z^n>UxvkyWWY|h@P`}EQr#6(w!Mdo5Qg>4YqL1Pf|xmxsu{4U zj1-Xgroxe(J?iyFyO8bvoE}`YG96p}Hk}@*tToZDH|YIg&mVu<)w)-xwW!gbT31*R zEJ$Ae9o5-AarDl6F(%Ij&Dy=-@>6>!g&S(q^%;Cno?|=ajH}3$a^c4q-ohC&lNw7` zA>zY)m4zKm=w{2gw1-;LLzUbtlVNxm2V9Vk8$J=iB9B!$?sf-K9jM-sdO30KUP}`n z&u$+VX$y^MG$h{ND4q>VT?Tc#r)qzWr-lz^L=Q#*^oe4ysI_Plt&691CW^H+wAbue zrv;m4MQi;yVRkcCQmQt`R2`Ln`~cME7s>boCfyF{yFY7+4egy*LAir*)ud2h9ip*U&e-% z?$1d@8Z1>U#*UhvmC9r%7_eeC_3MzSL_JOkt|?nrG>R&{Yn5R+Uft--NiMZmvkPIA zroB!$$bSCo`6701w9FeiBQ2P$D;wi#(|U@4nL*!=_*liYk>&0tl#j^t4@lWx6(f_}z)59$%9{0{zh|+a@Mf|-GrHePfCpmF>i&+)-noTvz4hy#6;90xU=%`P0Bqw@)(@Sm%QLS-28MCa2exo~t)Ays7h zuzznoGgh+jJ0t#!MJu;+@~hG}bn)PinhAYpJY3{2FPr07I7OV#-i!GFu|5iJRH?U< z8!7W2I-V=Ty1UjJa{OKA9a6P1l~Nb(lg4RF9ESHejq%KDEaGXqtz?}ykqOtXmBWnEsFpJ}T9*E(GI3U;~|8V?!ieT}-dp5ve z>q+`|rEo;QI|kthj{n~XxnqDJ=09r3Bl!PUbU31`|IHYAl>fgd;ujx<{?EvHpd$k2 z2M_;sbmvz9@ip6jogxP9za9P;
      ~<$<8||C@3DZiB;t5b@s_{|BfKUi}{uS`{t&a z)jYx6{+82OqRZ|F36uJlZj~&d^I?b^&Tm$&rPcWh{Gj7l`J{ z7F7|K^)D5$4UV^P6{_~PoQuy~=ZS{BbUF_&I{He0)T_%?gGj(h@G}VsaZ+F1&gDgi zJV)yM`dqU$=N_8EY;WHlfIEAED|V@lYyS~P;dlDRerVXv{d^Q+l7iz3Rn-r-?>LIx zch}lF(oUNmxmuM`3^wd6>s)E$Nx9&Bcmk>a#ce@}d+D^vQBMyu}Lih@rZCehel6xf9tP!GB;Yjk9bJKx3fIh-P6*iU;a2xg!&tO z!f9W9Jv73fLO&I^Q$fO>eU>7mfti2K$?kO3gJ!&LZzsvw{}!@8Bj;~*j@xpW28c9u zy_h|*I_qP7Ubqvw+;o=CRJU6y#F`^VZZuLC+7{1FbKKsHPQtZQJ=8qF6S}HtM*R5* z4>^d0ac0$Gfc%s^P z@g)>HPn%yn24TWaLAC(__V~v`B^bu~<2bNi&*W4!Aea?&KlA4JW+fbbM;Bv?yCsc@ z^=;x@-m@BJAu;R+3&s*tXl%-b(Bo^lFeTmuKsTVT=0ybQo;}B}kCC5ZijeJ#B{v=TpNIimSsXm(;%1Uwni?z27 zi>m7yhtH7G(jW-Z(nvQd0wN{SjihvUjfqG}gF`5t(j7BMw{(Z3bmtJ?LA~RBp7)>c z`n}h6U=I82y?U*^nZ3_iw3^ zs)fAuRffzN^KS{Azsez0DVs^AFxn|HA_b`VrbwJcYjlb-X1v@n5kIg?I&V=ZB#N)w zhN5|}@n z7rQ6;f$8VGw!Cb)+)e(Q13=~*RW4w|5hG}AOg@lsap)TxrgrmYvP*wLHY`lWRihC| zGQUKDt~YOt3djXHmipY^UjI;70F!3%JC)^n))hy+8%EVOoF0=bg*16G> zj)=KtEG0$M=R>Q{NJp!|EG(~gWec^Xo2m~N|;u)#+W%% z-$Y^k+No`dtt3gHuq)iCWd(f47tMfLYNdTr@Qk?0?R~U7kUl7W|m95(cd@PANB3QjPw*365{X{R>|GFKCe?gKmJ)I`gD_A zb#h;O4}IKRO>6tTs-Iz^g8SRO0$X>$Q8k|gkQ}sq#8p)D9>ekVJr-c<4*8qg9GYB4 z68QsZT#_!MlwUt;rFg`??d)1QD?vA=3B@a7#?D5)xP^G;f?unsaf>&9we)L|Ze2YB zJhz(aDZk%Qt3pDNrFPLrNxVw*w7gWL2GuyCzePuqo26J(21mBR&tkXA3NqHYtf=`Z z-JUGh;Cpwx(q@#BWJV{m#)-@<0FZa|Ww>6})DZaIo!+3Cd{P0Ez~(b9mrz-a^oOt0 zI3^!+VhkY5LW)&tYHI@&>sLTu^f(-NzvnJ$UKx_G0h{9BJUGuOsYNzLTT`0aDW#~_ zTgFx6&}ntu%Y6t`RcS^Nra!8mZCSX5P;Xk(X$q_T}Ing7_A~$stK!yP^{fT8(F13xbF@{7_`uekc>vKV!2J2p+PSuhi7^*>i4l z*(Nq$9u^aXx(Q;I!pTK8zCHtb>umRC=8)!5D&~eCn*0X|0P<0ldqNt>HT*2tw5eW) zd#M}*G36vLglpqdH-pZZB1p_B?b|f=wLGF&HPVKG_?!2o!oFtD&7Pl|o(iijN=kNx zyab!E_xA3xt?5LH;mO+nbmLhciP2~^Z$~<}Dd|p7l(3;egRL`A9I1jwKH|+;kelMA z$9>kTQsq?D^Ljb_UZt~Rh3><>L)dUlouLElZY5;H9P)Dc%`R&{UO5OC( z5WhqIBrpQHzmlfvwn|XG4`Nx!Oil9U10!_^Lgq-VSJhm|LwK5Fv?Al+_QJDGi|}UL zv0I4-^CSB&M|}i+ZCYv7^znNZRX? z(9+n5eK5MTd=?Ru9NKl9rB(~EjqCV$+{+@wRcIfep3T!|-u08V*B2e2oqB?0TuH}V zA_&cq0l(yW7*VutX(CB|{AMYcl`Oan!>advS$Stc-vMiIM0V=87CS&JagQ>S%U$$Y zS_f4z#5N{}a);H@hOu#N1KSP&-^PD(J)fX^=`7R55htWSe&H?31X0u!l$m)HsXa5n z?v~}?xv?;7?vOczeIUwG>ad%MXPl(ezbds;kV6&dO@44Wp1;;*ZfGKH^~pLsx;pYCnued=5u*& zg9}I&fni$xcIIthUlU@yg+tZoPVZ6PzeWz&hsh)bIkN>)+oq2--@1@NyI%F)=oZh8V?@b$)+z%X+k;WzR~LV96%?WMis^k* zlGk9-O!-gE_V!zJy?&@X(*f8($wNXGTQ{d z(#3eDq-m5MOHK>!APJ@}i>{^f*@V$dao3_0{(e{n2}Y#^6o~9YFE0n-1LM`Rk@p@dohjrb|55pPL)k8!P|@l&+cj`VQs#<`uXX zbG@1S`woP5;~Loif3VfyQUiW%C`ac>U z0!7hj1r^WgTs0mMOVNu`Iu1KpJLDhF55yUFKL=?sW>yyk+>@|^V;h?c<&@q}7~q+Q z(&XmYe9fvbtvbsf16jPr9D@&4QGNS@5;ZI6R_YKD!(Mm9EYix<<>SIyobEr6n1^}8 z1c<5=nzq$ulOGScx79fADsV0T-hW~f0DNqMsPpq>%R*|fbxxk=?|8|z4Tgoatr;n( zY!+6|N=;u~TxR*^v59>!S{iK1P0fb?oNe&?1s~j>vLGAm-ZsJ5(3CFqR&BNE%CmtT ztRy9cd-%x*#mzPx`mgjz%7l9)?HRdmy~rpKz(d^`jS5v{F>il~Gw?y)sf{Bf6RZD` z;#f<&GW)|P58_c*cN+k16Qf>zMTh71&%-QR%;K!pzgLA61bF$639rC6F&%eFFB3}09p{;;&*AUhh#8b;| zG_XqwQifxe3kCOG@frnOE$x?|wjfmkswXGT&!knhtFK}$PY)(1;cjb#db6{2T`u)Y zIt2|^4j%BncUZ*Cit+2szGEo8H7q)Ll=Tbat&Y@ApDd%C5-Xn~g&U$K=TKBRWmvI!)Sx!cV|QXdjvlMwP|>o?UF zqDBx{NXk!1Di9;j^E2!*v-cv`ci>xd9Lqe{oT))zxW93r+wwM3|LVtP97Xr*X%1BB zUHmodOcYH7vvl`=49JJJ{MP`|qF)1;75@fDTGRo0(>1bxffJ-O!M_#*w)TJHCoMt& zZS#6Sf(c}Md&729o!dm8Q&W)2eS(=`{5SmWvIdmoB$+zNY<0H&39-#)u!LL0mY?7? zci$AVpmI_3@afaE*GH2-tl$>B1EIh8{-&4-WuK%X98?y9hiMI-H~s9iVOVYb%|)gf zqEN2|*0E&^7lX6-2%a4T^-PWw!jAQ%JOe~ku8#8+e@TFNd4h+w23ndnzSrL`vuk*n znvhZ@pm6X<%9;D5J6-{jG_U8Cj%%u9sIJX~nW6s=*{;~0yTrSp(;JJ~WLaK^5^r>i7_T(_exD_js|#3SXQC{ZVZu%HJaVOR3+~ z|651#|5EwiO8r|S{~Ew<{KwM%HQ@i$Mwm4b3)aOYRo2uhDb2QHR!t5!oT$rY@l}ulQ4ueGE5bq)U3}AZf8A3u zBwNd-F!MC9KW0?+*Uf35T$qnUFwIKUs8$=>({~2i{M;@$K>isAd{$iOW zn80DC!hgDM_N);(=ye8L77+K+@YNF&NUSv&FpFOmd$; zukLuv_s9H`Q0(DhRieQZo4vDQFW|S6k3jKR{7YZ2Rh!EOdkPnZ`LB3t_9h{ z{8qeu4^3l%jwbz|9)9rz`iMiRmD$*Kj276In^UkL4S}_TqU@)?keM02>dh>4xU}7{ zV38{q?kVjM?p2hH{KMla$&R60p0-c_|8Qc)zfIj3p1Ne|{RQVg1MUB5-27Ld{XaDy zi&S*qVc}%SpflGh2j0l=zhi3YFV|&3?ykr>%$hOY{u92HAx0@O2VrS`9|hJ1wU`-J z{|VvIBn$&rvKqTSMrB9FY4|C7Q1JmXfZuZPh2fjS7h34dia42v20ZXSl?NUwC7Pw4 z->>>)`0!_u$11|0p22~x*upbHVaT|al*9K;&-wPZQyf7K%`A}u;3Zkc*z)mTPS z#I#JN7$1A>WcH2VGwd;OQRnFe#aOsi zYMS0dGB{|lQ869K>AT~M53F2|y40E^M|RS}#XW|*j2!;bW0tHndZlBn*KxQ1>KhfN#1mNm**{)!+lpKNE4&eg}9Zk{-^69f0X|f zD);&)hmoG}S3w5d7O5V?wDZgSa-nr0g^j+M^Luf>u&=EI6#v2=eBn`bj`@2Lay=Q( z!aF28TBCeRs)SafXQhnl7l@FUX(z5WBdqX%!+p5-8JO^~`W)VCu)8-(`?p!qZf$I+ zdtkKqa9a{CSSaE%xX;GSUd=Pk4{HWp$O(mC-o54-#M`oBMOfE1e5#>ccl*gkcvW>d+kX$o^!($rnVJZei|o*fO1<*= zRGi8khm_kYv$13FXpmbYq?Y7W@Mf1^M!3fkFY zKU#2s6eI%LX$F+@UZt@v7~a8E&$U%OLyQEBi>2IbD-a92T8{kmR;Q*${JZvJ!PeMf zPQBI&j#i7?Nb#l@d|b4F3B{PlwD!s2|> zhf>M#tq3t&`wpH!#r8Mg)!hze3SsWc!L4Qrv^AnNxm_-5s=kVohYV_x!~|ied(iflN1Mal7gOt* zPd(GaUKo$)8a9m!hjy3gtb|>dTWhdV73ln^t$WKh>owGm!>E_)Xf7g%?;YoK8jzXW zHI%Qufq5$_$xTBww=|hXIR=}%RI$gNXW}`2%y0q4@<*(M>x(i8=oOzUJlET6Sk=NH zj_KzaLmVtW{PZbq5dDdzLicLinV*+MWy~}u%%@aBtT#+_mo06So1Gz-!nv15jiv8k ztuyh7`a5_8TvM?pgiV2sS1Wrn&vmf3!?!vn^mZ=(LTIdguchY$=?4q`La-|5BzM4#blhGk0&DJz|SDT%U zVe2NV`LiyQ$p>%yiZF&2@YMI%E45#}J8yk$FIaoqUtF?}zN@N($|7ehTb5DbUO<9y zz7Pv6_DPc88dDJVyZ8w2nCJ4HyUynP%|2wg9uADv2a2za z#9@tak1B88T4Qy2#vXIv-)_bZolUsXPW-f)NzwmkIfhO-!3g?A(F=w}iX?Sl|M85< zW%*dP88>Sa!>7VPN&mZ-`NjuI*ko)VBh{8y3}HTL%nx0~u_JbdKG@J#we9cgG!8Cp z30i-MwYYervhKQlT2(wR@%j#%^nx1SRYLV=UeE3J0g2sVcV;HXq{i_x9rO2C)8CIW zEvlR6b%Hy0eAs4IjMqAZm6bDYEB4@94gPH!3~o4QNlQKq(Lc2A*c3}d?SjXNLgX?Z z9FmD?n#JDYmFp=@T$=9DuCOt`?UdCxTRJC7TrN^8^v%-1Kw240@B6JX@1t;U ze&a+CWm?UWS-R>|%6kGG*c#Rv)NMbxB@MwBKlw@cx7?zf-fAW(bw^C~s#e^Ia}#{B zWX_<_$ot%%B#WVRYI{j1lZJg#dT%A{Q@xyso0qk_HkH*^Wu?PMbt1+0**P&KhEFt# zy`%Y%C3j=Uca*_X7QaK=79B@x!-c0IJXNtPl~-FML6RpsT0_)JGC>u8^-P@=UwS6d zShm0d-Df~J&oyskd?=*#>+~eU6L*r`=tSYLs*={ddcuGLeXXC_rt63DPbvB3@2*m$ zR19x0-J9q6?Vw)fWeFz!f1L$rKO{33{jmOYw!8-tx{+(Jh==TYWd7buXV6DGyhrl$ z@-&q^b9ByC(UqB~kGR8kLKQ|qgYDfqbXft9k->#jPwbBqxk*PtUJv?oe{=EB!WG3c zMn6gLjem!VYAK6-hmXsABTG)mT5=VI>_X73 zp^9as`<-9@PRGXvQDh3XYmJkI<%M*mL^6YE?^KSMuR1Dx7dZZs8Vi*2Wq}zv7$EL5 zkG=0ECk5ZV!*c-=0A4Wjx^X-zI34|&)gWdlXgmneCBcUfT%K<5Z*VeXxSlh?yMN|P z6mVyBWA2+Q4d!1!EpH)8-VylAQDt_3^aH$&vSyNlz-8FR#;dyvFFty?nRR{)iomMS zT`t7~D?k81J~|3`qye~227g@(=zgwvM(a(nos5}bk0tgWx zH8&B)r4V0JOL5stdMGHlJJ3c8)Oa{xSdSihE(4&V@!SVquTUdK4Nu#w0fxT@#Vzix zuC6X@Cnx)d;OZbrckp&^jtDGrUjsJgTLw zCo4JW<&=+{IiJb1#2F&!6Zy8jeR-zQKPC5^{p#Q~fiyuS+3{?^eqm~G%K5GU+79}8 z+{*TstDu3E937B+6uT6-c^dA0o)LX!k@mz&&q9%*rK<-Pcy z!XikEc-s1Htka%ThOWu^xorn9i$BVV$WBjFAi>qX>E!~<3-D>$Js!}7oS&to1Y+(O z;a)_zlJ&xq{5zMW&$JvkF?YBx1As#6EtIV(Z=aE6mVwFVkn@>F+M5U*Fn2sFI4?Ay-j&nj zwAMl4nIOCT(WNa1jj!rm63Hwal#@A}g?`R^vRZBAzoZ!HL$ERhLof22_Pk2TDMt~e zUJe~V1|U~cqyrDEffOWm{3*ou$B$luxnulG&Sjz-a{?$QyQbVwmDe&g(JZ17mu)kr zZ_8qqoX%Y--D_NHHxm7XZLQliww1eIq_PTHeJ>e!7aD`ng>Q#pZ=?3i{p@>{nH9qT z8(3zny*n6rGlA<>*(>CoA<=nBZ9IkfV7=9?d~SN1o3`or9M9ZmIybfxkt|wvV&kjy*=-m2N+N8ejt06kDy79IacuAUU|(LlM}cg?fmA>}qs3&Kz*El& zjf#r}v@dK(o#mMyC1TbZ=vB%PxoL3IWp^A*4oO6(h3&lO`$&)R46p%;Betr)NqnZ# z>o$ZD1dzQ<6Z)p2mZls1D()8MKqzOkXTQ~{Q|h*kKSOow&otw&UOm-%on)Aa9S-kH ztz?MSi>F>~LCe?1o;>KCrk@{*;PMy2mR}V57KiLGuFAZ_eM~?hVV&Uct~H849e{Ol zej~K1fQujtFn3&FWgVf8b$12P{a(e=%%{_&q*T?rk5UdOPlq~R^z-eUcD(WOefjh? zC4%Jzl~t<$yvy5-MqT=T3+L{w;;UHdoHAN?5juiq!ZCV;e}cVl2+db{Z0;DNH@SiY zDs|Q-hl!t9F?Ql$PKo%!2`C?!lY6J^$I)<}VKjZgqhVSjjOuR_=b-BxJ{cfJMWJ{L z%!FRrM`FxL%|f7|$Gz_?$2?t6C(fS+fCm9xBx*7_JAts?7&Pc=Vir)99MTvWb}Kdp zkA>DPGg4(_sf-?=HfRu;o!notE>V}bUF&MCf!iN@d&kprKUG+-7u;PS*pGry^Ay_G z`1Be)mL$reN$9L5|K`Ex@eOu5_J;SdivW)E+4}fc2Em(!+pEe=DcHs?)!d^^u#{BP zk&I@A+~W(JI`tP+ISP7C&yd9vWNS{|^?>pC!WX)nFdC_cy4kao+2H#K0Dbx}JNj$E z`Lr!Thq=!H&!M1@>-Sc*!y^|lfWyZ+d+H}aC+6ppTky0QU7%wAoZUJSe=g(QyKRyx z_GILSNZt8*HCfSX{yN_-M+9nr?af$tr_F8#3&t<2V)wIgMhM~|UU$d^4F|p4QKUbV zFGuV8y2amhj*P9ii|YCCdno6TB;#PQz>VQRGc)UGtS-@snT7!gl9vOFE-aG_fN$Za zm%*e4-+hrrdJQ~cb0;Pa1hso9)??BV<~a%xhzEqrVZsPl<);mQZ0-}K~P zrM`B&t6yj08qvt~3M*_!Aq3X7dm9_2N^!3J*5}IRERz_1RNDoN)tzdWKnTL_jlRS~ zXawozkaW9K$^^Qf;GGBte^LbfmlQ^g1HtX;quVU$VHG(523MdjOUC*^Gd>_~Ub#tR zl~&&Eq#3E)?;eaY#(U26l{diP7W7oKSqzPiI3gQ!!}!1{!s@-fQ9|F5*_x!lyn+hu z4Pz1%Pa%`QPCznU#Q45ZO&*e~dGxUmLEqi@?icuqY1e{L$8;pvW+a;w%i_oER#=X0 zmgG(L{frVH2O|Ww6kn1T%!p!$*Ap6E8oa>^M!Q$`Z94BBM!sfSZQ+Bo^C9cuH@F{^ zIs#vRBp}N1!GQA3n#HlbgA6zZEjtTi)NQgq4KWjZS#J!DI3umrG$GxOB<}QGvmYwiyH`v=k4Wq%D?}^$0p%_q_Pa@EtKID4i3ycoo`0yQ*xH$YtMv1g zPr;o4B1+}hxpXNSR@AXD2vq6gL+YXs5dnM3 zKc8i0zc5`Wz?T)ZuD=D9DA~{Up@PcGDAWsne4+TwxqtE&l)W3kHv|Ogh!C{<(#pC- zh{zbk!qDkD<76w;4OoZhVK|l?cws+uHCr3!Zso_cW&CaAc^fvhU-qqfg$1ve4o^8ohB^Q^P0l<>P}vilR?=G=%Q5gjr+;-%s}qidEm5HPBB&#A#-1 zt><%Idpv-375lA=m4ekpi?tVND9#J}`DW>BLf8d>N=>4Y+X#D>tkvgyP}qz2Ebg>V ztCY51EjMUODz&@q(F3*W0I?4{E3FA9pfExo?t&9w1Q<&gcLDDhFct-zxbr<8tOr3L zArFD=Ak2nFZAwHE>-&c^K?|7SY>X!;3;C7rQ?ems=Wa11#B24<=+qC8=lX;(7aCX@>hn zuJ|pao!>LEBhqv|wfK?z11eXu@&sFGM2Ba@w_8W?8*dD1ZtyD84dV;u5R#b3InhDU z5DxU!;#lNR2Fi(~TdleGG*C3!|81-5vO=?P1bq`zV7#s%e};~bR$|!$jS&?={^Gll zH1`G?4?`$EDT1?XSKah}$sH(D-j_D3<-%R+B8V}AF-s4ioNqygwWy1&9?A`irMQW> zi?(CvIk%0)Ct_R?zX`z>ihxdllrxTlVq7fHK!q4#^R9g&SZR7 z|5$?P)f3F|uH;}1l1t2i5*Jlu)?KmS=74Y2EOl&rN8dhKhW39 zR-9~0rA^eP@3iW>*(!KtlHgT8AGotV&v5ne09-$ScGf3TqkhQ4dNoxG%TggO~5 zQFCxijc}w*BROVEY2bnud@3b??_XV^_>5~k@LIV={1yNwd!r0Re@Rh~F4?ECE(o8T zV+;h5f736RdT9h$rr5H_KKOGU4fi78*HIdr>1FHh{aSP1y`IoQCIbFn|F~*>1TOPc ze?t!qdI+R}=G8qu7XKT;x5UtIt&ixSgy26b-Q#y{6@L@)yjS+QsflUo_5U#c+58*Y zvMq@qGe{u_kjK&#?EAkqg8;7axCmlXf%1?AwjoeEyRU58`q{W|@NYVQThD%;e&OkN zyEP)i#a)f(yEbG~{(t$vGGC5SrUkDuz^1K(JBNp{OV_oos}ixf)%u zA272uhLAcvU-?y@Zhz0qIkdG9dX{4|=>T1(HiD{iHBB!pUU3J$lEz;`!IuhXh=?g8 z3XOcrASV5(zcb3^)fbZSzKw^@h%zqKL2=2;%gaZ!Du&UJBiRjSYT~{-fb2ua*s0y! zND^{ZOFw8IYfIpMS(8**-q2TKbIGWL&B+4#*xWQ^LXsWP^v-Bm@-7udtmdYE*r0n# z8MDApvA+5awJedbL-Pj;2`>&&*DP0!Xdhzna4=EzT?DF+Fh^~`Ni*RH@j8m)mZM~G zP;`~q@>HIsf!{NDb+!g<8 zQpe=VdlFyP1hy|d!k0E{H;J6DZuCe_Ztx+MSjOHN(VPHO=P_5QAZWkO=imuc!S5@7NPt zUvm-)4ypBL- zj(T=jSaU^VZ0`i#n&&a<+)qe%jnZ~`Pm!*UcLfRtLKXewu2-isll6ztQ}?L)IHo(; z&4}2CMGqfE=kY1J^!<`uC;iTA^tY z04@x*ij0(E9}-*9>T|7*LQe%vfC3@WH+wSbWig{UH{=am75aK{1o)0~(H)0>-`HN} zL#_gI?GRt??b`b!00Snb=REBN(v9^}@JFLEi z4{8t{02dnJ2iZtMvaQA-N>7=M`@vk&JOIY^QwARt z;iXMSf%8jYhNTu!`3|$W5ll4s$p{)JaGsq4*`ibbuzE}umR%!^r z1vBw)Bp^)LBXx+%xwnTEOMZgN-i?2?qZN(a@SUACX5R@@k-_>KKk8hD@GR|{MXW^q z<1Pv?$H6sKeh{7#3`9CX96YE|!S|w&0qr*<*8&m+uFUY@lI`Em+5~=ezQz%--B#hPSAkS{yMgCutLdkG!JsQ9&!iA~v4DHjYpY%(kMTrH!&E+gnToPvqf3 zn^59oN+UHt&6f0@H+sRRLrqasfsjYkbKbBkvt|Ll$x1yLFwu)KKuv~FYY^AZ?hOSK zwY%g@|LidB|00%=mpTOlu1Ap0Ei4k!c6uqK4CrX33^^2G-vUtQz600s%(I9jQ3?-Z zCH11tx~hCfBYeS@w+#g(D~JuD6lzq)mzKzc;gR3qDJ2=JXj}VcO6p-L0n~^Ep_BCZ z1MTVLYoGnb>K7g#sEqCeGWzvFU7cPg9NXzE;QF zM}S8A5&C$ozoy3WYnT4yC27qd)kZQnr)otf^e!NqidEz>r^?o3Z62g6Y9o}5daZAK z8}1i*t^6@s-x4*{^l*DWCuPTon_C2ZN)@euZPZ`e1d$Tdfy3i~%vFTxsNvbqCzb5K z&=rNDHYjQYYYnl%=`ucP-%2#BZD(Z4!#?bl3C-_H;<$;9cx*->?XC2x{wb76&O-=o zka9&%d&&}v?G3>muk63d_MYlh(SD{_Y^SF_r=Z(Z#?MB zSfAm)N($KTl9JN*t)1KDmNb}xNlJ=IT-~2-b~vvdFqQEA9KPQ+U#XSCx=nt$bk#H~ zsn4-2Kc&6;a!U$JMN$ra%{KUR9tn|*V@fSM4t3i))ksD?ISZ5ncfTthzeu{eTDg_? z`L_&%G2%an5bKDEGcaEalarsNc( zw=YC7;~`+p;-5Ish-n~^MjhuOIs(Us8gYUbhPl=#*Pa;ymJbGF{x$$JynyxdZ#xYC zid$*m#07>OAw(Qa6=gAb?AV3IyO=j3#2x(6jy(k^T%}K!^wkuUtOv z;k*DdyMP$cudTR54yuq#^mxM#S96F6xP}cn83v;L3xJP*A3Q?~n#C`SB6Dm%^|xj| z{XB%&H+xY`r{_)!@t5rDTw`{OCoK{plfgD|Ovbk^ zQu`pj(bU(->%~|qcupAf%RH2$wp1KjtDNWm6|AU<=H?!O>Cj*)@6%wF2dqhB)Vo!# zBf~6*RQaz!&V2-`hs$;FKHA{NiwgTE}Kd3NeAsROK|1ZoNas+SMM`! zrQe0ZQx|{l<%4vW3KA2h2d+fyLPSf;*f&U0do}1EcH-W%c&{!lokN3qNIaBxKsBUx zP~{hjnx6Zrl8$l3hy}euCAP9>@2IWSSZrJQNyoDg6G{j%ElyE7n}`$}YY=vk*?#Wi zlU!XbQfGPzHG?DtS}249Ds-s#-QP(3*)tIZ!z|hh^hW2}xXf^k4A!`n-n%Eyrl|m2 zM6(>s(lG*&+)M0d|Ac5C)Et`xHoYEavMP zq9^hFOr!VEVTgyUZehyqe;38_BSn`n&un{yVTm;Zva2G;R z08m_0b$!KyApqmo#r&r+ULW}DmI8|P=ONhTe{K9d6vOx?x-l4OPxt`exbj;w(yN)b z^SrqSHuXwRgPYU9%wjy%fFc+++iny+i91IgDA;i#XKo+k~IIaXCs}@Ir+dp8AcfjW)AxcATJ7yd(_*9JTB&< zDZJGsIF6|>5iwQ^XHs(Gg^E!TOptE!YcA%rzd~qPhzgR0#+50KkFs=9x4GggHi{iJ z8Kw4R5%e+G|GT*B^gaU9@A* z;KBsXtpE!&Tm+bmX~*6WmF76KR~=v1$2n1;VKyjnG~^{RurVA5N(%6y{Nce95(Xx9 zLM)>26stmO{qiD8QhTO7rQ9u>WDWUkn$}xPlz}IlzwS0Er;v}FS)VhO>Xg)&G zS5eV;e#coyL|FLa!(y$NT|$s@zyaHMn2iZX$s<=#(^TO!iBF%#&?_5sb7DPQ$JK$$ zuv%{CSdV444ArdBr`Og~#|ow0+|sU0%<1ozJuzGK=yj|n32g0_rx5R~dycz(p9C6I zP>(SsSz7B{ZXwyZil`H-U6T6_j-^5sK8NwL*q=RE!HqN0mhs>ar=6G;(Hg44NCgya z*%71V5$zh6HTo{1$Im@+u9`F=q=tg=Rvh}5QFo+>=OS4n6*rJtUV(Dg0K%yR8%%vp zGal0kMfMjWZTzL%&IFggCV@0k(;|E><~}*tu%&jZ_ipf_T+5j1HpH@Sz47&4s>{2s z!gKbQq9A7RSpJY6ER4yuLl=TPQ}HSqZh}U`}^+BH?F;f3dK{GIEQNHK!C9iE-Mul3C%&%B3%zw4r0Ze;spH7%sii~B!7~Hqg{)Q330{W2s*CEqO$fe z>TfT+_G&#<6dql0Dgc%I>-z2dpmeUi@K?)khy4AV_*%EWufLxI|7!f}DQHWevHk<~ z@B9BV@XcJ1Up5>`>Dmd@`2aq{=yRJGCvK#Ce&AY9(N+SHtMP>F(*S4J@iGN<-d|?{ zF1#tB9yrGE8lY|%D9oO(0$13Iwo-_2zla*9j1Qd_7+FA_9)KKnqX$>}B!B}0LP3KA zKQtkV$1~ciiDKqjnUlCXs&b4`k8}CggIx2CY(S2R>QUJ+y0k! z9hp#@Yrhgi)#sIo4D$1_o>j!af%|%$>@DRXcPGh@QzQ<{;*ZJv{O(CPk-yy!)_AiW z5W838Od4hM)uhBZZ^Uq^X|3RFkd0hS)GK1oZd1c^U&UtoXTSnjFMVt3Ztex{HIdIr z+wf{5O(XIYA|Bc^rhSI{`yB3tWmPuRq3*N(>>)H%*=m#D@m5<8w!1t!(i%&lZ#JtJ zyafLXJ?CODUg_4q8>@6hzthw-8W_lOys+4a=Wy8pOQ{1%liUm8fMsYDfb^bdUKg6&H-T+Rd=mfJpxM?bbm1=(zzPN^Pe}5} zqqTPuPARoCkL_=r&jj9G^4-ZIr=7+^reIq{A2(#2&Pg=FhUr^^TLyL{3~ipo-ny9) zOP(!LYORsm9&B-OMYt7m#@eSAH&gAozJGOLT^Lu{342;%l6NkUyTnOedEw}Ck!kMr z5<9jTb0@WiS4FEVu_zI;}pxBVaDm!^w}ZDxL4wA=!1RcH=&C! zODTml!SGw<+JnKp9M++JMl&H9YN4})8lGPrEmH!sV=lClQ=G^q36E-5t|X+SFZ4xO zF7&GhR^&nFxd+L&HqdAvCl0+*av7-m(OpHnvJp2NV`3MbSWarx%*kP)-EwhI%qFz7 zH${nVlnYj{XrSuY{U%@x_-jFzm~8}>k5)n+mqw+vZIU2@*FNZH6zIPz{Gmz4mp^YX zauV_P3~wX{Fjw3%Hi?5UyBEbDqc-?nyEO!X){-9o0v(*=MPQ%f(Le`QbnIom%Y1z! zw34XwR1pP?&JbY{!Fu>XN;1iG-;!oc>Z4wp)mH=UeN04Hd`}wMV_f7K+BcD>HWgQF z(|y5Hbt&+zE%?5OUS5rE#&B+)vT8ZoEfUL%NOpW(-$6+ zmNpt%d1bn8!>qZQGNxRX=fFCNdRDUN($HF}=u$}KC(s%9dR0_bO1z-ljO#S%r~2hT zr{1ibj9m6sacEf{rPB8AXBdT#G(0Y~JMO)vfBl;NuHc!v*{zz|tKJpcf;HKdqLCGKhxLp?fYqp3=qpet*ydOl~Q|K-^x{PFQ#s?hcl{Q0pI%3SvFFk6A9f!l{%jehN}Q+q&;BU@R*tutp> z#;udmQUKx^H$Q}Wau5ah@~H*pdAeSCWxbyy zo-|D`Vc>Es1%A8sKLHy8a-9DOm_Fvi56kbnkSTEy5&6Wj&FTf4i2X#QV%a%|w|_3X zv-P8PhibLsh{@yqQHLw9niTSCFR81mjid(-^EJeXX+5sZmkR08?T{}w(bARBUS@yZ z19G4riRhg2gpV&zFt!K6_a&#V&S@u!=bw(r$=9wu;S1ClZCxm~6o-dMdq@?Z&jNFK z^?IG<8RxpKIT_+-8C&OEfYJJQ-b;>!-e+=UA!6_W7@9H4&auIR*9f)w&3Aa-?*^$5 z#3m-VZKL6{d*!PcS|OH-k~BsVQekl4%Xvp?kHZ7uOX9Ap+gjg8y(^<_6i&-S)D*l9 z6sAw@w7zSJmW4=lRh14AaxU~19x#Ke)AMP-f9;-4bG2pT!qQv#4Ig`7OBy&wAw_uB z{@Q8jE_q)7KXsddganA-6i$FhIksmVjoq`M%!=Ln8CSCpgPdCh#_n2Ddc=yRnopg^ z%rFAPP&hh*QA++NtqQ$m{M8A_{L>{0 z1a#Lj>LVW(;u>q`IOC$?HSRy~66OEkY zzAwp5`|g@PI5}cdaCb)qaNN(G^59<+DJr4WLtTes*rag1QSfk_Z$i%Pf?wFFjUV(- zy-h(YiubOvPA=X|6((!y^V=~2wtbG?6_4s-S?WHxz=akBxwUTfL9~BTl0+Nf7&{Kp zh4cbdhiAn-iD<0xKX!rqTDJutxi7Z9$~{YD_ZeV{SSolXJ)QK~>)DnO*La6fK^PcO zFExRb^TGnZ6webD;N-{UEn3>}PCoOZO9%79tfma_wJVWr_i;*KRw}V*+m82>KM}%Y z&2?DBbW+BN<6R1J4jqVXmD<}S@edJYO7xO4vjmekCKA^&ZCp}A-zGP533Q=SP`lko z;{*I%l*fj3n-&*hiCgK`eJm)Xct?d&P}E%J--5*+y7b<@a~0lrvhO$j?wWoU1Gcv=ayLag^;x_gP!<%6X|2RBc0g_BwBL{!JHQZP3g3_GF=`&>XuIT z!TgIvHo^RjCjegMV*P-&AelI1_i&_Z9;%xUk znMoXP?Bi?gSSNdliqgH?5G`8=x zC^P;nh9tINnJg^w`5V!LMY_pXk3?}b@}`rEsQmLDW8LF3Rf@MCBYWPM%IHB)wIef& zj*;cw*P*#`uwa-M1oQW7M`+qfB_|McRfgDI-hKU{EJ>XOqoC!01=RpYx>^);!jmq@ zl&5(VnTuzeb8WYs#HVR;h9A#IinQOkKP25rQG+;a)(^vq45BHxCH3%<7+b&R?jJ6E zkC8k=T1-~}iM_;eX|cNt2VW9Q^LX8%!>K6Adn`7QF$b+l^HC$SV_ zM$t}MOm-+=;DmW7j&+(`jP8YMFmY_<5_;G}5W)#;w{W^fmdONC2UHblN;o@izpIyz zakH)$emh^%!^lGE6Plca{le$_3^2q%Sz(HF6Q#DygO%9})`3a@cq*&~%|DdaqNzu3 zGbU4%X=X^_9*E;E_0xmlt`Ku)Ho$7H(jRW75rUuoq1MAIfG-epQ8`{9#QY~AG=KuC zBBoZ=Noa165_)GlUu6A$Ol6BcV{S!pl}AJ3nAh#@hK`3_M1JTC6zO7Zz5c1haYXi8;0p?_BC4wO>n#omUnUY(&*WO$ z7%VNNthL%wJTh1D$4Vd#RAOG}8`TOG(aM7s+=ktKjUN+&87iMDH}Eq-m*fp!F=&fg zl)p5UAcu&P8i<2Jjz=F!cX;YF-jXFXr23df?H-njbKp{^#ctkyVH=rS##(_Y(96YMenr+s0UgP#Xx z(|2C6;9G_YhoMr|=Nb>(dUqRTM+J4q%CeK*Y&ciu>zfovOS31T*(|!7B_=Q%VqN~B zyL@MdNp4tgY7oFx?f(i9J+@^wl&mwAiJWlfn2~igRf7oI(L+Z`-^a-wqCx{di+QTm z{}4AXiCES8ZfyaX8w)e7Wo39aeep%$#W%%zj0ck%l9>B^s4>X|Kx<4kXuuBK^3}OyKB69FF$2x&lJ4h)?}3~XF#DH2*D&g&aThGVV@i9rEWYMeeezst!P1xz^&SD zV&l_v5xdjfJ3$ORTRxoj7TeIkB)9ZOK}mWU$J!?KRNQcM^ny8PfXpE z%})C${w>}LAj>7_v|!kk@d3Z5Wuw~EK+mstBsB)#QOX!zdn5V9(C+`^>n-4-YNGz} zySsFUbg7im(v5=Bq0$Y~4br_Tf=YLXQj#LwtWqM~4U2Sl*YBb}&-=W;e|&a7+_`t= zoH_G7XU+_J&%Ngif*8vmcR@qw`~Hii73iRjTa2$g0u0*=&$_-_rsv*8aTMly!qN$;FDkWiI3h&YoTA>2&cssj z9dw}-3n78emSK6=B)6V@1&lWMGN6HOl`$6~j1Wh2ZHNP2ctDkIL>DFRN7$X!DYHtt zJt1)N^8jtWaD(XWu`|HP3>U4Ao~ipw#_;1OhxYFEC4Emf-yz!h=66NR8V#`TTLdp%#cbSFZ!)pm1;p{9( zrMY198{B9Sr^>(He^bjHphNSb4cxQ5S@yEOWLyi?zP5K^YiiA@H>pJ5vvS`174Ym6 z-$ONJy`O*?N{0?l84X+W$4>rdV6^LcPLH!=uCV*FyR#7Nc)Xl$`6!51Xeo-L zxCR0b<-5_VGxtX?x+iQG7=1cDM%TvBpa~VV8Y_1Ko>bogQVx&WGd``AFKl;;cI8BW zc*C;|eWT5Z; zyydoCGR4Sq=POmAeZlajey+I4gw{&ld-@YNrV%mq2dxj6?%b`z`Uy8NGTeLdh%oEt znN~O2@uNx6g!*@PWerI`e(Y11CMEsZ*ek>=@Zjs$35_EDS#+rvTQ#`?%M!~zr`ux3 z$|}y8BQsXwm6M92Vr8cAxb)Zd1;_lSjTJ|>D~Cry_9V)Wf+MGhNl- zbnqcLHb1PJdlneH6y+D0*0F-c`fm={{Ls%)mpNT{HtUhcW;8OA=J0saP{f9+yI?ck z-fPQ>9oIbiym3Uw;(SE^rIxSwm!j-@M(dNVBT4Q_4%(rO{tK zDJ%JF$Z%e}jS_G{uNIzYnV*W?6HC+R4Nczr6mr?taIw8A9He(qbNy;1R&2{4zypuW zmNRqIsDg~?aZUWl;?7W`GuA{* z)g7_MXL>ViS;(?uuWj$f!8IK|nV`B7EFG5&k%l!6<@Iv;Z3skHcadd9w>wSQ>_elu zOr~gj{*{?-oj!w^y~>-TVmNkCpQefb5*xL*lQ^es_o(VhUR!pl!;6YHQ(m2OTL(hH zxjDoA3nJdDB?PEN{+|oI`aP7w8ZTav2Fh;QX+P=sHmVm{Re836wU(rUXAq3f@YQ~qbWz?6$9hrOEGI?AB9xzMdW+viW%E%(LtTZP1Z;%%z{|dq6;Hgb{`k=d zy}$kEK{Tb!?uxBsbe+Sb-qAS@hm6uM`ZK3kt}#lq)@Cm6;YCGz3(fe}V&#cV_|8~HW_2LnEaaJ0E!K=%_b?F1$o zZ|QOUDv5c-&23-JMD@A%rh3`;Z^`MjT{fE*!-H!RVd{knXrt~sHgvf~ilc8-u|8?n zI5c)1#;KAg!r_EmP;v9m-lW<7fb#K&Pj=vc@JG>vF_z;oKW~BNipP*!X#nC;@s9a(xvB}rHH)qq2 z>9)~B1R@0&g%|>ZqAl6pPJqK95STOnw=8x7uG>aNJ!r2nL4@eR64O6*1UJ+tnJ61( zF?t^LDA7jWJ@J@sBY#3Gg=&JYUziBn{pZ?<-At!rHxOs5rrW!y2NkGBC(*J9dDJy+jDKCNUlX(7#qhn{|bj^L9y znzqQ!Vo=F+y4qW@Jd_3dfsmnY7>+vU?YQV+X?b}dVcf{8j=s-1GVOT15yz}|GH&Ei zK%v$pbMv`>D~Wr9BQhr+NAQ?s{)5;pA)BpM9ZPRbEdJWsPan zZ*%velxvoTi(j6<6s#jW?;hLvKy)&Nw9P27^0D!d-C+69b3*o>2LROU&kOZI_*`!>+h_ftd3nSLlRBHRB6`64`4$QQ$bW*+Pove}w%VHLg}?QQ-jhh|mxstm zKMtex-83Zg^W#wAl~DiCgPFQCIC|u%t}3a|H@G$goDS9r5t;66G_OL$k%y%BsqIj=08Vjx`XV zR~U41#j5cixIS>lPpg)0rJMA}(BcytCo7S)8AboT|Gm1b>2mA(OHfdpI!*uA_a2fb zx>(iK_e*0!LTvHvIf7&`Z}16)XTM^-R{@TB4+Foj9Ef?0W zcNOH`I|BEJ4^N8Nj@54)2Az0&-_O&fD5;P$d}qe=3%fZHlLIu}hkTeGbdeBFQU@vd zpH#s(QU7v z*BiBk>U|Xy*DtOW?@d-4YmqrDz7bqQ-^c$YTN4vRT&(4waH8@SM^L~-b~9hS@2%1c z0rkwUaxtJ5bx>`|1J5I$W;GTP4P2p~MtMhK*3h9XCO15F6FAVTc604by9z44K5b2k zyb_O?)ekP-qF4=z3mK+ZoGJ+U%w_NcUWD#_YYV24d~n6?>g^b!fB=A}+0ZM3^6v`8 z7hg5#_9F`PBQybD6N@&ba0QGUU+_c^G2~gS5n)N@xfEXn@)( zAV>l+%rOq{F#Ah40J-tupiBDQ83cCQ=*CfjeL$rVH_}7sjZknvKLxJ#U=si%;akAX z34-iC@=C55!_58luh8qf6YpYR~oN8z=B>u?;YW= z8^7bS=`8M^KM46?#@>}UM?y&oF~mUoewxQ+jD!C~+O(Z!Ht8MRbSi5+`v$jwpvvG~ zgVH7(Bso3mK^|PEIQ9}e=ZkvvM!U!}0nQrp1Y8$B8Dl{@Lrm>EvQgNUT1~L4CAGPY zP<&2!3)q8Xo_sIke~^VTb^U@phD6)WMIdE{V6gD8%17>+T`LNLeTs)ed3U)ZK4Lp4 zi1fv}^P5Sk;sebB@2j9!FYGW*pjcWUIE2=uyK&k@r!4dG+bFZ6JRi&qKTM;4&+PwN zRW~;lc5injd`WR*JOdoQaTD{^R>QNaUI@mCk2&Iyn?kOI`#Iw4w{dvXnuNdEww~l< z?SP709 zp;NCfjn~J6?pqBN#nxoJx(+1G*!z@-st>y{#V=D^t9>T{L2_@QX?mjLm-?{&=KZbH z>DH5}kS#dbQgaTq*M3w(&5J-2{bPVOt^Q+rN@%zsCBk}0zwwiC%8$BEGVHAgPv5Ux zV*(@+{w~98Txc{U13*ujlEn4BrBJ~NZlTZVR6y>?R?GBT-|4)%Z?@pga7ZCf^J=*G zrXMYj{-&DGM>BEZ{i7~|?5}3P`U5L>d&7R;&wI~%IeV!h`WFkRtpL4bnw_#O!pH`{ z{WQoJAGg9~iW{aN zB1_EV#_<{KaMvY{Rez69qEvu`Jm9Va^d8g&Q|2GBr;={>;5gV)Al^LS%SXpi30uKC zDHc*8?4oicqw51;NXkt(-4Y)cGo2UU*Pnbo{*Z5mUQswX_G3#!S9#B`r=`a^SHubz z=ME3>5#PoD#8$*nWTm1wPmw}q=5l!K67JC)0EmhT*{9*C_$7shCD!*_@!HezNd^r* z@1$AVa3iDLCggNSkRlcd%>d@&<+GN@)x4mX19%=&fM88hGA?Hlw~6>zQxgwQJqRt8 zmQ1@#X~qZ!1t1Ur~$tAfU{H|B~zv1S`0$Ui4O_>_h#)`6wbl2%E0S&6Ch zTjMjKD!19RfcxRTm^8 zetcy6AZ^`C3Y|K{gBY$*2H7!3De1vEceP=e;V^{l=yErQ6`_>)xhtvxf(htwh$F5$ zLabwJUqL{kehVU47sFByLFBayM_>Q?tm}?d+>rKB^e7cLS{nb7OTF%eUgAztu5S<% ztI#(eM$UEFjiik{N!9VZHJDeXwFOrIj%3~mKm^Co-~#mUhJuX4+|&jRvsR)55uWC- zijq{X3YfAIYbwJdWxxo~>!d098Pu@P;U^a}LsVX((1*_sKkqK0uR3<2ZM1IGK2zws z(rUtK#4>WgoahN=T!pXGBKj*>XM7PkbF2942CaGleCdhG3z@w=ZtDvavDoabikeN{ zALrluJJ;4t4Gipoi75AE7`#=(kLsaFBPw9V1vuhq*4?g78F_lh@tx93(>$i_C|Tju zv<3zOy!gG*)BWB;FL*z?I!?r>`hjwz^SUgTY$i_O)+t zJo)@`{2-JFzB!gPbHs4P0?)K@A3;Cgs6V6?HUey~{bla>w?11QPB`gka=LfUAnso1 zB+F=yJ!jnhx(nR=0&DL z5Hi*q5>Yi186PZJ)FqH~%frSzrkzEM$(75F^ZP(-JKLl1^|-knuR#fF{~29-Mroj$ zU)U&egT~zl5cy7#*5#TgvO~#v@E*NtsTsSqtGrenM__gI?3@0PgA}*YrlauavLeaU z;;`Om06sFpJ!q+(qgcK-c-?b^=5rY2!s}NeUAuUa#LOsevq?5h-Lp2MtG9>iCRbXges=_0T>%!0yzD!&JAqPFrjsP3haz@ zx#B^99PlCmApJXNJmha70N|1YV-I0Qe+%>|aKhgqj{g+y05?qm^4~`^1P0`$CF(n= zz#slNa4@>$pG!AZ5N#Ww+%0Cgu_k9`hzpDM&-A)g4 zn>A7uHfu>N=OaD}L%7f$f@9UhMtoB9Zxo&JtC!jkWN1;Q_?7VS4ES3~he)Rp8YUD! z^eiK|b9$#8XP659001GW)&cm>PQZtNH_E?Mo=?>IHb0Sd+lybXf{??E;6>H|pmz>z z3EpX$%VgGlE7*6k_imHw+E7u}?PaEj5r{)&J_K+Kg?R)Ko#O>5^XWe?GR#vE&mn*6 zzlIGC3QRo+=rIBUk1O9x(Ae5cv$j;#O*9HBJ;=BkA^}A}13(!l0VbA za)3B06$KGs$_(Ou!wKLTe+T)kmEYIyjDxWX@LkM9bYTCHF#v=BTsN0Mnf8j%#18rCq#FLwo4HI3V*Kf4Ck}NA>;-HP`F}Jcyi-= zk3*RXx6fhxjA0u#mX;YeFx=?&Hw^56Kh1^k5b^8^p~fToSx3UC)QiQlBA^W*H?pAu zfKe{^@K@4n?FEL}HY;GQ7zS3r@qU{|5Ps6#gY2tK(46&42TF$b$8P3r=y99Nw8qwRQ0;ZjZDS=$TSRa$thgs*#OQ%zh%5Z zk^w|nLmCHw`{Tl+8~Pvoz=mVWT|y86EkFeh@_l9GF=hNoBRMALM6Pu< zxf?y%*=sU8d(+b-fwiMn$uWJ8|Iskq3n=;7nP!NMtgol=4majZ`%y9}Y?6N5Zl-FZ zx0Hh$FVoCD(8!_6V_>>kS*%di4ndp*fc;~>hX6YwlZ%<7L;iHJ`cXCEK2Pygr0IlN zY8cx2%yWO`B}SZBsV%uk6-qDeb7V6O?JvQ%L6PaEO;XZNRFDMEFD z*|oU-qw21yDlsSLF}o=4Q8UMS1~Xl)%3M}JuSVb^4pc6P8L<#u6PJ4_{|*rgJ2~W{4G{oM((fvrnZ(~b*s@gn$wX9KPQ3< zU7~F(Eg6o-cq;M=!cH1*gI#>pS8U-qrcrtZn^=hT7c%eLtzIqlO_;o@eK~!8MC>i; z@o=U@@Cx7Cf^4EKwsn_kEK0P6w5!u@h|>S@2~5Ooq2=XcYN8ip1#NLsrP`c7Y}M=W zafb*wG{ncAV(6%*Y^vH;jHBIMdmb78iEpw5)m`9Qx#t6`k(l}zNy&_uhzK*QBjed4 zzfj&NX+!PaAC#B9Z^UZpSG#t*t}lGH8l0E+n|2-0;2((>=m2t#JAegD%VKT=7D`eS zkk%j?$sr?E$luVOK|xwl{}WTlUFbqp7C8YJ&0paQdP=E*@+I_1R&Pc>t*i;X>9~Nt$Pmas}+q>Olg;pHLeLZ9TmV&?7MFTadsH!Lt z1ON(>4Wfl_^k7yV-LckMsVXAn!Hgtu<;8@bUXWj|KWvY+^HLa_fYXoX4Ay@vh!jV< zT#Xmm_S#S4auAxnm9A=pwhd!I1Qmc0n8(qplukDDM}q}PDN=myEa-^RIzbE4a^vgq z&bjoKD&^e!URR$Uo==%vbrih7(I)K+9z9eSI&n~U?KS7@LItFle@Fma%C}IEPl2+t z{V!{6pXlysU#m@_`y7=XjWFNYYpvRz?L=eKAKuctdvF}j=L|#_q&Z6j{W#l9Opal@ zdd2y!HGjrXoFVvSs|DK1tYRc*lV;Ub+Bv#&&Dz{-YvZX&Bk4g`4VX71P&vXMe9-3} z2I7=tXOt)DS}aUM0GUaOR2vHRt}&%LAM!?g55%-q2{--_>?mjP5DXzoxr03hXA zkmHjo%?=$E85S23jb8f7(PzB^26n%;vbD!il?H(&n@2(07e^n((G;DJ_tCGswl2=G z7H?fYaWUm=teZv_5oIl)-}?9$G( zjsn1m{~P<6m}3JW7jG_Le?+pSf_F^S&3aw9`@0bXues~t^E+I5B+1D2_ z90od!d96R<;oNND_UQu-&JQ(Bm@z2Ue%Q%?fI6|k?*JI!9spi|iX6ow9Qd^A{^+=Z zkb7czGpX15|Is9kLvm_@gO8fjNFq>#>DY6+%?+IQbnVc8#Hb~44EE{wdt7nW7P{#j zb7>R4i58DhDrsYDTUZYTeHYw|2mtE!0nshStR^}8?c*{ZDfIC;_nEP<>$YcrVC79C zKn(#n4x2yn#vkl))4(Vh9GUFU)e%`SPS?~zfbF-K-R>C7+Y3#N*h|vlP zXfSQ>Uju-ViKbIh5h^RvvIS#s05EvJxDy}W(+P07yatVJ{_!Kw3d<{E2#ZkL;8xsJ z*^H3-TOG}u%sc<9w=O{nB~vtOY)yp1d+Mk-N?49uYSUL!me|B#67>I$K#t{$G#?Et z=e?p3m7H`unMRzv>%)SpWvv))dKc}W3-14-Lfs21(MDAqObN^8?{rS>T4HBpjY51C z{BIjus8MvLj$0m7@atns?X>v4^;OHn)X_; +}?Kh28*Lz9sl0n>>{{|J9-oImAb&H2+x}!369(J)b@QbD9BnMOXrRYB%FCorNUm6Z9bKff~n&M{?_gCUz1}6 zx>h>*>Ay<)D8|-GF1PxThCATJ&u zKd1CjJH>C06`_TeZIRBXy*<#egI4DTw`OntN}g_KY8Q>p|JD}dp9}r-Z&=k&{Kv%$DML0xxwP1|7fHYsuz(pdhJl2dAZ*r-X0fo0 zN;9-{nSR+o5%UI;XUPi$W61$HxCP*daF%d*ZWh}D35Z$~RHF)?(bJe}G5l@_!}Dy? zPeVc8N(!rL?3b6g(GMGftSm%WQSPnMyj0=uEkJ9aL36&DKjeU|Cu)iST1uZtm?qJq zUA0H%#U4&5td=re5Jj7nZHJTSRNF&3QKhhRw}?2mrm8pjXqRL-OP1iMxPY-MEUltD zHHlHg1qXchqq8B@!3m#4wUbG>a5QFtz;A$20V{F}?**T`P~16h;HTsL97R^6iVPP# z_^8k+Cj`Mo4&c1`2<4x6T@aBi4-q66D1g5i2Xdf@V~7zs4#;Ay4%$NlGvL5L-YpQ; z)Pr1O{^m=LLsEjN;JHdE$IixH^khCeeKVPb8_iY&g8mHBYy^M;ER#6q--bu8Q6SX( zhcax8J6VuPbTGGY*NXR{PAXL=4ZWjN3Yb=-yhWW!CSA^QKe!ADcivUiL{F>_^xTW( z6v}r zIep7pDa3hM@Y^<(Z^1W79Jk0zC~Obgd8(&A!((X}i+&|-T5hj1iJ{9)@)kgj2)PFw z#vd%zGME}gFus|)Gjc$tt3N@RePCu2!y>x=NsTt>aj`M2x{C%{&G2vYWyUh9Q$u{! z3<>Qg^6dj<2E$AseZih!dik?}@CQ`vDu7);V8}jwD4pKB+DY8R;eef-> zx&`;|ZZf3;JS-y)@*3|qjr3eKtZdLqjM?WY4sci@Y0_|n$Dd42TmK7VZ8@*}oKv;Q z%XBblJBTCh0MX5agJ+_YD6t@oz{EWDC!aJ(3IiBfk+NR-qr|Q<15{R5rPG{8q-Z;u z7iGWphtYRB0HtNR(o7qzixD~v`|c;nPC|l@2T&iT7jbNcJU=bvk(cs_dvgE$BH^@c z9G@h$;*k#I#%Vdm-3+U{9qzoWnmE#018_L7uN=P9v1Uyq(B+h@cRix;$8ySX%C|%< z6!guX0BCnSM3XEc8myBU7Gy;{FS+iVCl|)ZwPmZ=Ht>i(lx@cZ6-kl3XJ!%eGdug) z%kUVH{hodKhteRD8o#$!DU5JyO$4u*SFc0q3GWJ4S|Eew_m{f{=4Wj@57Jmqex9E9 z5B12H>hsQULXgbtm#B!dm>6+Ty#w;sMU?7FpIOeLA-$gbJTazmjEQYSi7ux2?N;l| z=5^EZ!j+~fUyaxC>C=tHo=#6P|E4cZ=Mqx~2YD64c#ii@Wah=f+r4Uu*!9J}PIpVF z6dCp#Klk~e#kT)tw`b;K%Se#s;T_F=?Il_pzI3y#JDLaD=Cog3^{sW?O?KYZSX7m& zykvyhf{vOiv{$eTlPdzHIe;W6RQCQwq`TC z!0U6fnSf$yB$)WRT@!iOlznQUt66B~>%4!4Ty@ykp02SW3GApWzAz=wt%_>zc_Oi3 zE#5h0QnXaoCAJ_h-q}U(Rw+=i)h+sBYrLq=I}FAT;J|gLfnfs(nevmwGY(edevL?~ zVfjetl&i417t7D|Mb7IlF46XL!JmQLtAP?|ZfX4`k1-emUW4Jzg+K!;1a3x9??Sa> zyYN2UVXxzLWKn40OFzz)$f(ZK`eOYv5td^3VDFcq^=(BT3@!{uR}Dm-%h2KctRMOF zg{7Gl+~&L}Vy9c2vl#Bav>lgmFab(53I97sc0qSAxiGk<7Fm&{_!OcvU&%%`x|Pwy z$eePqyp`kqsEw~)vP|u+ZJz=`hPdJsWl%Iops)^vj325Jf6S-vB+~10N;S&Nx?!$g zid*d{q-cNEp(O{WVkv^FY9MYSo`OMv*^_XS(3;eE3*|U=IIADI6kBZFpx$m>w}9!F zTFM%zK`HKu^c)80fD9c>_r47s0XVWVHmBR@OYm&nlf>Y#m(Ko>JDFY?=@D z_lM1(=_O4l#tm||+QLAIC=DR-b}+m+L`_1EDYmzDePOml0tGb=X*J_+W0FMVg3pl_ zQgu~6IW)5pVi6`PFGCx6P(uQae5f6(y5x}nm>&K@Z?3$1_1Es>n#+QL)~fh@i$1L4 zlw{5t)$zKK$Vqrv@XVBVU#P%dJ3}lr%@omAf*I8fgDxzOyD!@FB^BSS;NmTDrm;x# z>R+wOGFzZg{R~YHXSYF3(MIMN>Le@JZT;*L5->P1X1jhS_Zyr}R^%_z=@P^#HsiK> zdPp^go1f@i#9}-969-sN8btW=bZScP1pkeTTc^X^&p}*ce{{Q>@g`|QdS(1FPqP`7 zII&#q)0d;3IOQN#v)w-k+Y5T3riihc2_O6JGq?UsVXZv@v3vyoSgDElI=0dEDW-=_ zywmxLm`a($V5*0GYkReTa8}TZ%F(YTdGiSS?e@9Z9P#U>a$Is0a%(G8(Pyg*l)1{e z*mdekoTtuw=Jr&ax=4dm&U$-BNR{aUZn`ErL&jbg+L5;8+2@_;ELQIh{uL^)=mO#5l^4mbcBZ?-HFgJ2;=g zT+hQejn zR8#%YL~~hVAD@rxpFs&Ss~;IFhVvb^9L>%S`8h1TSo@eGBY>ORB{8J+cc9cppVxsm zU@~a%4|o7g7Uci;aC3zooTcEXKn+1dfcfnv2psbFRPPv~JVp71xq|R_e_-xq@Iz{} zj}N+4unF5ALffnV>fuH+2_i&DyBoj+|BO`~%h8bQ+IGt7>Z3C3H>qAX$xd+t*uvv4 zq(31BgR>&_tSSDluZ3UV|LpDmLSN?C4OGaVzL6}bCo?k*b#?rUOX-KnL@Ec&X)81S z4%d`m6M{c*#NzEx;m3Jo3SMu_q{|*m#V7moQ!Cg`#Ar1MMUFMjTu8B_jsXwhsMR_U zKgY-@5=3oL(e&vlbN}>st-yn+p~=be)_)tFoRcCOXi{5IAO8B-eff=Za`TO31IllD zk8GIUDou4LO=?i(m5{`Bq19xHtnJEJQ=LU7XaZROn1Eitlu}W0(0OG=kc=eLS&~1I z-l3!a;0_ElgZqD=nXLmvi0NEu{%?RcP@nv3+BcAr|HYob2uy*^e|`H8^>3x=SwI47 z@%}HR{x5BRV*oYvG!!`YG>*^fRS0alMgv^Mfh|iomF{zc2{X{ZygGJ{XMv0!bOa5q zWBu1{TKnQJt$$h`f-P;~5V#qk5kPSBg`fd9U(&y)AfgcP`}^8|F8^)C;d(J|$}Qxz z8t+}-1C%5|XdCLwd|6J9+|PM@hmR`hZ~&+e6@>QW9xa`SfajdZW#SBp5rA@12^FP4 z@tDJhk7$)rHWVcpz;r67ycA(lN}2(OtXm?e*lDTEVded_}$NI)@PBx#Bi;2kFEn zGR#dL{)S@~AYC$=hs^d1O%| zx4#)8h3QqVo;bq{B_xP??O=X()_a47f_<0(#9&Fc@6jvg%kC}I%SQ=QU!4oL^}jM z_>&2`!W@~(Eqkx3)A1d0=%eW+ zIE8(NVD3;5kx-1Aa@nbQWz!@k?8sEzjHqbtRaElZy*i{1lLF;*Fh=#^r)7H;-P=Ys zQ$N7(cq+Lhi0oij{j!D0QSR!$t4DzRu7oa8C+@YXvU~FCxR|bnz<=%M;j7M>S7;#p zb~8EY2eRhW5|$~oy~B6uc%bDlOW;~r-PoVz9fS!Kyg#Zrw+~OfnN7u#HKtm;Q)Up@6Z);4~%%^3KqkW(+V6m8 z;>KCcjr7psZ%yDy$LDcE2;KMJMZxk+C`ZGQ;RQATL})`a&;5!v+HPtn3?NNS>f@6q&5EQ)Ut8bh1b~O;sD-2mDwRj`h5!JkA$1H}ZgrHZ;0jfi-cE`?xx3+{-@w+8R_Zkk4FLYib`uLw7VdJ9uvQgX zU)PxcGyMqHS0ZEaKh?(rX)@u{4)SRgII~I>rwwVi(smJa1dg`pM^_KpsBdGV+Rg;1 z*TDTD1NV_4Vv=Fix#G%*%>Cn5HxxFs?F&Q(%rqSye&Mo!c*S}`cDox&N}RU*$=7Yz zcfZ&&*}%2w)KBqBCf2?3Ag^~nEf;%aNzUE7se37nGC`j&_^vn~>eS4&y<5e6EWuey z**qt1q=A9^=2~~Pc&2_Yg$tbR7T2gh#LW~{bfrduYr#)sa<967-N(zThm@p*`j~Ad ziLOy(d~bMhG3>2BhkGG4m3xz2QkAk!XXIR930y3Awrh5^X8OE%r(#(>D}HoIypd=$ zx8d4}J`*pZ8wx68m1yUCMfRz;SgO7+UQlWA{e_<5&+tia6>4Xk+T0;J!jlc%eV3QX z`B7&M?P}Yv(yynD${b%t|sk@4yo`i~c&zThsHV>uqB zx9gWiMs{=k7=QG;Lc-k=Thq>~yv0;B!;18KQ}tXquet|T5PS2V;ZygcdCmWirr_a%A4iw%bIEo7tpxYN=2-(k^vMHsuVUB4I(Mvb^ zQ*SYTf`%P^jll)9fAcedRB^IC!Sf_-O7!mIGA^_KPV{C;U%gWNL9w_*-5}3OjrQ@x zrEFOBtdGdRZe`we+Tp@Z^+XF+b=kW9oUK85JR`DNyvqBW+y!n+!Ufu68Jvn)=PbbA zZMdxZ_M5?it%>3X4|Zy^=OyD0$)on=sv-vWE16kCLsOl%@{SJMBbcVcU!Y#dvULlI zTul&cF)}Mc+7BOy01w@;$giPUWcx8CF(V4an_+I+*9OC#@ivE{pPU-9hjo5P*QpOQ zidJe^pkWAjTRnN;El07Bn=kvJk`RotH7$Veaw3%Jo1x0BF~ll)dY5=MXoOk;-#svV0WZ<9x;72{k4V>RgH^ktS z=LD4j`UKBEb6cN)3kIIT!PWUsDC%t^kQC*2xcYzG&wrv<|J41{+*A^g+p|bEPGJFz zd5^7s2+!{hef?nqCaIR!A^*W<(L(tFcL^to594;*w_m{_Jivz7-k13Mkj_%oqfgks zbo^Go?MXg!DP0Qr+-c@``yAD0wVpuc`kNpOF_Wot>mJ1avW6g=lPpEe5M=xz?&x$~{#*al;6(R5iwYj>;wImH+{v@vSbXJ@V!uB)q? zt1Hl7-fCbSJ2+WrJ7I6O&d(|Y;K5;I1?YWA4-vT^-j+<_k=}=-vvFbLYkoo-!-tZ( znwc>gK9=C)<5Q~Qw=?w$ZrIe|-*hzV>K#jjCG;G@Zo^EC!YwjZOIk;llBdd{Zd$BJ zo_s~p>s^ms#*K(j6exyAvxzL(=(TWSv}$@;;u-tVrv>Tbd;v`jnNGdP)Ux$&Ytbl^ zYwm?XMYFexyqw$1YVOlK^tDEhNFIPJWVr#%&d-Ga?uTgNMK}yv5JNHM$5v_8K9Amg zU(erosXqMVoa_f1)r0beepa{{%Bp$Rm2#Bxal} zVsDC3+eI%%Lr+A@AUmh)T= zF%pbS;W!)WkYG-1mY&gq#V?1{B?NfS4E1`NqqW}*@xA?MP^$w8rs$qfKqzL}J@go^ z(`;C;onZK8ZNXvUI}tUzk&imc+6`@{drIiS6Y-(IfTy@mC+}2$$=i}l+l*EZm%Cv_I+(DPVc_Jr=6;&ei0@vHz?%dG^avk1K zHvWw2J(!?Plj<%Xl>%A;aK{82C*eUGNp9Ct6{?lQQh}4GI8a`0=&pS1^04OC2lZ8 zaT{_lXzowZ0n*V=P>s-l>vo!!TFZP=UFOFRs_PgS^sUUJ*}9Kh@~sBBZJ5voMTf)* zK85mZkjmI;r>4@L3vEwi@hyhcF#L>=3H_OTVr#czY7~{-IGCbA5jst(y=-zM$9sgy zOtb5RD3!fe-RBMXylpFHiEhNmp2{p*c$sz%Ls*u62D$*`H6HS;lyRkcR|nG}YWOKG zD)aa=-xT<{8_y1Z3q`(fng+lT<|Pg}U&<9*k4%)?)_!X4I_9=P0*oBJs$$EOe=}5z z%`Y$8+!?qU!Z+_4gu@;s0bO)>` zuB3OY^Hwx8iI> zZarK`v58gyw)ghG>Q*KEkOw;<0W_$Uu;qa=26V2`0F^IY1I@WWWuO`Fq<3X&|8#W% zoTos=TuTu_j}-79WXP(1KZL2TxhGj=^FMvG16Su4;QN3Dnj+qN%kwQxo%90yEhy9~ z;7gE71R3g2aS&M-jN7LuKKGcA=bze_wWZdn0J8oK7F#6};HsR2I?XaGdckupCSnHf zgpon`hp7W~4RLMbf_3rfziJw_eRS>Xid_rOs<83>DnUH>oH;NGHa6Oc4aajUGdn6B zY^D)s%H-PV1vF|WnN5bi<@~zG=;qzx{@RE*pCa>jo zw(Lxd#8mlQh2keCWl!hF8zKC$Q?+AJZyz1rZ~6?906}~imsBe@2vC3cT;I~3e|3x3 zTU8P9URUX(LUQoa+WB>9X>EQ{SOWRPvW&p+pe*@hpb%~OSU!`;t6PXCE*q7y z8IPq`$R-(Ww-Ow z%cp7_SErk(qQHg&coS2Jlmt!zT=1}tSF{}gKfqU#8oAi20p`F?kURzVD0(3P-s-2J zx@m;-2-H9Rghba<$j$8(h*82v=w~q6;{WIJZ)+ic4H)s#CCs^gf=ckf@1ry%g6G;d zeQ<$6AqY!xuIBZ}r~r6V2<;C#(>QQ^yRDXhjY*%w_Y5=cesp*lkUtHR1F`BE;UxS| zaZ>MXJ><)2SwW{SwYmxQ2w8&h)GMnYeIeBDtpwDOs*isJM9E5!wdx?OZ7|Lqod@l_d318^UJNh?s$Sj5O(k$ zigdd)s?m`MaB`r1Z`SJS7wu4@sxpH80b#PzbczB{ZIwG4ii>vr<=JTAgaSZYSS(uY zUJlE?`oY97eNa~6)UydV0Unx z@>yvRuX++5IW^NF$O&cChJF_iXSEo%L zR|L!mYDhDkqXY3pwp!E=Y~E06h@%DbH!U8N6XwyTvO{a9rtkR^Yg!)}c4bXvHY~h+ z>Hm+hv6a8)bx`=>n=F!d^7YB{!DKmTHEm9yviHn%q(dH$qQ&cwji;H?e31B$P=u1W zY^%qb_G()W`teu@C2!Iw=^)GI3#fhd@%vm&Pg_a{a+>{ak7s}un9|Ug#ID6ftYTA1 zTHndBQh;`yltxD=$U#*~fyuk;MdHD$`!z}5|6LsvrZCsjCDK;X6#$<84^0C#39pl_ z%BTi2sFv&6mf2VCszIxnYu(BORzGwo!gaGw(Cp5gCJF~QfD}fIGVbuy6@9U^aLc1C z3i#oL_Rr4*>21F3goH^W?J-+x{etNq&^IR+wrP@oWSzg%{n;b^Qs}J&5W*CUg}?#g zfE_xrT9gu9fJ1MR$IEaz#U@t)Ap1y!D6?v8vR!_a%2b-m>uFSwC7(GoRPKanB-RDd zTfzi?#5OJksi&d;AN6V8;U=AscZLm}uBPF1feKI!^}H0&^)vexX2Cn==%Eh=>^#$3^1 zBlql=0WQ!TsUbB{cNEBsYaWfP4&HZXmuF_RKgI&+ruQc1xreI8x$27Zi^N)7e(ii= zevl+R&e$I+yRWQ1kr}e}>dfAc#3fP_NWimo-*tg29ExYFWC6mB5QY0bG)Z2kZVlhv562pm0OX8zd6o#(`L1_9@WY zozO${W;UsTKnfN(){S$#__z!&t4n46gBAb;-k!q5{^R;_Zo*NL@Vj<|pS?<_KoA@# zL;qQ$2vC5`Qv}WzVo*%bh5oavlKSgxt!|t@_+CyfVg8#Tmi&;M|5;3Y@;EEcrnQ>Gtchg2{ul+B1(l*v$*5Sao?`W7MA@ta`#v+wwRPt!36bcuFQS1!h=Fw%eaBHu) zbo;pam--T9iO*cjtnPN-ooOeg#KdGDi+;O!6<_rut5m~u7Fcc>rzMSgtQwzhQC(u) zsOA^fQFZ&m?=HpbFobOBJD>$X3QR0zW8=Qi)`a+2U!lUo{Wt-SQO}v2)dDm+NrHL|@VK{1JVPUFBca3RIaN$~=ql0s4-+Py%qVt$wYwEH@mpjA>=bMot{n&Ct-D zmwVF4aC%q8n^wfpKp8g9@Wk1fVRwx;GC0k26@^%`@qSd5$8(O02`T=tL+JA z&GR_$GwrjlCLMPP<5_tuNOKT5{7jrzk?UnL9g|4&eOC6yoaFdf1v<$W7Uks{aUg^t z7~>%h;3ooKpAQ>h>@;RJw&N~KQcVq6)ZZ_J#%c2PGDuTT|CszVp3?u=?MbgIa;C+d zfuAzzS_-vL*G1bs{L=svW!U??*}_F4#Qs}W#$RjAf#e_B2i{E`ds>v;>wObcR`$hm zc&naikY$U#VXY}{8GMo@itR4&061AbYTvdvYG;I-rG40b|IKE+@HE3sRw}#o(?0l6 zS*j$rK~#^|6X$xy7RM(lp;9l52+jJe#Py(pzpNj-^*;8@9JrgM3r*0RI%ao@Jx(Z9 zTF!_(rC}DOGtK=!oPBjvRZaKsxtEfbk`4g@B}9-e=?3X8>F%zpsDPk!m!x!u^i{gM zQ$)JE`40N{yzlp0zqP)#zJFNf%*>gcGkecv_TJ;QE&E&6b_hKoPj>K%BI^j%lluvL z0V3%KI4~mM%K7s8I}3#D{;&qO*=m1u;YR4QE?+D|teN-cxuv-92Gs}N@CNfI`z(T% zl*?N4KJ?PDKq(`kH{3jfEL+$K>JS#5{;+rjpujm`X0g^UAT#uLJ3-pcJ{>Tatj3O% zA*~b6oVF=m|5rzD@!{JjOURdUR>`=xNU++D=iA|xhk_QQ zzRl0Q5M;-xSEK}Z4BJwi!cNaAN)se>JawNdnvru!i47D*J^$kS#I|dZUv$;)B6>D& zCxHQFPi$a(3j@AnWh+lzJGQQ!#g)Y(8)VM8We6&5Wt^m%=6$aDYZTEGD}=#5+Q1AAffy61-|;?6febbnTQ%!On>r*4`9<%)P3-(t^kh``UB49`agf1gI zo291)fEMt2+aFCOLIxrEP`$qtL%bOPC@*K>p`q zi=qJk?yCQev52mln~5f7HhaZ?_tF5mDv}4jBHE%NyvJ7)-fc?8Sz&PqOv3-bPk#vA zy|;MHW!Gk3QM~bU#ZUnwCEQG4AXHIO)gB7}P5LVjiy(NQD%?9T{Cyq6=6ru1v_Gt} zDKBXkVbSu`>yqUx9^+Q2?muJsAZNl>PQXGTcc5M#LvWa6y&W6P+*k=P>sC%!Lfozf zq$Ms;M*qAXa4G4p+U^Mms-sZZVVJ|1`WZXi^u6I^fzqWW|4E+Jg|@rOFZG3nao_lm z3bYZPe^-W~{BGq5 z|EwuKA3Sxes*C3%b(LHVb7cg_g*Kl@@*0YiwpAfLq%##3L^HOv2G4coU(uI{4cL}i zcQBI#Rz>9U>BUZ-{-l8gnpL}q#l0gl(~J64nY&6B*pLget*+#Oy<0Ha*~um!W3Ja& z5a?42{i>s6%ei{{SaXzJNpRw9858SQ#xJ~hQ}zAoU*ZJrq9xo(%Ao5TDUL{m3}^s* zY5plwX>mZT=M%rIhb2riS~_}zQhN9y{e-fE%h>Sy1BYUUkX>t623gv}S~-;k%gi{fA8r-iZZ75jq#~ zwEM%wlF?YA`k4j8vG0=^wdQUxt{P+Jp6o7}O=D^<3%eMLl zTltMP`URY%>Ho3d1aRr3od9{A4+$2Ofcg zh^=oppL5Q%C(`UdH;ZhE!=%Y`6D6KyY=TmKK=UjHs2-b<1>$H{a^yeMF@5naEjuKP zUA}&g=YPv{0{iJlu&ZD7=+_W!{(nO^uvK!=eRH!K^Jop%YK6&~&t0{~${P#>_w4LH zfyrBCyUC_L=v%QVLvzb8UzjpQFn)NP`I?@Skh~^VA=g#&ZNBiaG(K-e2yv(GK4 zb21#ymZR1KrbXtJ**||TL1axEeWfde;J`yY_vp%Ew_kL_y2|vvY47Lv$>ROxIpl%} z{)g{^(cCE2rw2{dgz_K#N250x7uRYQn*47&PIniQ&JD1K9>FsCN6ZD$_r#%`1|)%iH$xez7!2XLY^e zXVc_lz%*k;*72Eyj&^?Ddq_(|tNt;_s{_Hrzh-K|w)uq{^D*h{m__Q6-3ozObxn8l zYs4+f3|hRzTj^+OxAU+~vh^$OUuhNhSFUE`=I!EhB(44fCg4HX!<^2dSv zYbHYR?u;DxL&-mm9rE2vBzEiKb1~41zjMCXIPV;>S-(YV*rq3?;PVfO$y>tqtb*D)j*_z4y0v16Q!15Jap01;?Pe_Kj> z%*9V-p4aDx+uN(;^>c?-jiv+reK`hEZhqb;{j^idco$7Wjd2hvXb@al96+UXvjSo_ zzpbRr%*@!=@KsM8J+fRak>)#{j5FW8a$D?gh4}EC{2q>t`?_aPfpx%Na(lN2{v+(( zqLS-o+Tr10+JL)F#k!gMLf|3dC6DDo-_AUCQp!Ng-1PYmZ{%<*#wU1irWrSn?wjbX=p`?;7=BZGaBeu8$sl~^phV~NZaCV^ZR)zK}5;#?~#FO zvhHiT@XFCWX;>)|NZ#0;^3YKGB6b)$VXkX?($E!3Zf`B2I)aSp$iaGz2oITxmGSed zB;vC^n$#o^tvKAw(Q-?P-@{8HJRvE&`g<3kaX0pr7h|SK>^PPl2kO%7 z!njFhv(?g(0Xf`R2l)@9ZyP4P^I)0L7FzX}M~nif@L>;k9dYZ+EA6yAA`Yj@7o6Jo z7N3?^GEKRm4+wst!uV#aEH^dJ>qoUUl0PEN?I-7UtvwD2ol4!o<9chgq@N{)kUzV;4_e}-& zOM1erN>y*M=Y1X=DQ0S}rBqXU8`~Ckwc&Y6HN`QxIr$us%q4NtiTB2fEBUM}0!R?{ zI*Timb=B7 zMxDiTb{OI%+r z<^s1M%B4>gtR|>+(3ulafRY-2YiljrwsmekOx>#0Xkf%6 zC529JkZfw<8O4E9(efIH+k^ISMPbIRY+%nqEE@(EtK)*9ghoALw2J4Dz{g%h_Y1Nv zo|8}(mIg{4*4j(TmY{GEgXfO_obJj-a$#vgNY{INd%J6=HG$j5{78L4z--aGB=u~& z)9FM0B$onxv-Ns`(t4eqq+i3n?K+T26#>P*3VAiPVv$4?X+@0 z9is-nc!arv5mT|Uane&Jl0*MRC{m?)2KdT1WJ&#Gas6kN78$a-xf-M-he-qQ(}f(0 z*!wOTeuMB=2b0CTc{Lg4Pt>W{Dl)l40`Ja&#&Qvq+Jtg1Pm#I7j3 ziJ~VYwdBaTvJ@d(2Ok(0V6Q`NfR=JQq*rJRXLChw=h!S;=qvW52=eGt)xMh3sH;R~ zVWI|lR^mgy^rMw?R zlQ}F;`K33V0a4!syL~Z)aMZ6zSlCzOL$+o1whjm8aU{vH@F&-v)6w9kfZXHyn|tu3 z7sx0l@3#cb$~Ub%5K22VW>&aPAwBOak@q@2MXZA9t&NcQZHsoqC~ENM<%R5ko&r*s zxM;b8bKJmf2jDS&$~ICp6NK5cva-w#NMaGlzwtmcOn;h4^w-OLvdC2$++9fEuj4Qr z>!9OS+B~!18@!zR)i-E%8dB6^ZWCwwrm+eCYU zFkFR?@%7P8v_BFd#RH_@r@^0Mi2CANahZM?EuAM;!|Y-5C9;byU&e?9=jN;`zIzBF zV}ZwP${?fUAUHM;66W3c^!M}?&?e#Ufp@3X`z_o!uWJas?G;7e+!^-Y=Ttf2-$z#L zR#pWu0E`U-z(Ci#^D$_}!4NTU!f%#A@WZwf=I?qvJ8>~iUV#VI zJ8y!o(Q&5{dr~cgc0&G!${=$s&N3SMj~@X}yIA$*^I@%1#E#ch&q)_sV6lPP-!n64 zG(3jTJlxTyYXULg1?JzM#P}HvB^slFnLzH&z;{%u+qe_B6nslt=%>_gq2v~GnF8yL z{5b*NeV+1otzOpb2j1HpgamNUq!8Sv(y;h@b|s>x-peO&*uJ>9*ron z7sVjSe(8e$p6%f`XlG?*XqweY9+X7BfUD0hIF0T?NLIq>k>4w9`S)L{&Lc3J6JH?pIW_DQ_9R5@t54*&ca~s1vFwmLKW64-L(_MDsbU2IZ`|dzG*Ql`_*N|FziD>}!&_CKRf2F7InREYV>}oywLxZA0 z7j%h>+$n->^{d|34JGrTb!lSJAK$Vh%}Y4NzBlnIG1vbzeX!j7VF<5LX^JxV({4eN z;2wQ>l}oGX;XMeM#3$$;-B%Y)p3Ls5^COh09BPo(1Rol{OAkIPMf3cM|tP_rPcBC~WB*VF#NShpjJP5n=w9!(SP2+tU@ z<)qg?a)9Ddkty+C0(_Ca8b!Dq%tn>{59T$GW{8_pr%B9%zihx(KZ-Y{c~3(4<~t(* zEcETQe5Uc14P}FS1xrLzn6S+sx#5C!MCi_}(YxqN<65b2?-QScS5+LQl0R7NR(ODYt!Upji z!j3r4DZx3urwtpwdGYvuQIS8});WUV2PR_p7UEBz^^%9E`vXrG-286{_%+{rl2ND( zPuW$&Ff>q~(y~*U)CuRDP*akJ%r?g!ds=p)rEnc&zeLO~W%mB%L;GQlwR?BUj-LP~ zAKY7fejlEn9TS-M!|Bm@c|cPcd6ll-B;fJ5zuf2`SKCcbp6)t==t;EH7c=QJ``j@r zdisO~CSF;9ae2jSzi5XEX|Iq8!_y)sl}8((|Car%yMn9L2&9EkT|%o(xucs5(c!*O z8%s`$^9m{q?{<#%%MB1uEsM-*jC!#Ox!Ru*gf;t|5|_SB8G6FW38cCWUvjx>Z!bL~ zEzm_XoZ83_L;b0K%DL&8+JxVjK7;?NoF&WpbJ=#g3dAG7r)8P_O>(gYE^u1B)ROqf z^2Y~PNwxEA`V)YuERsL5P{94#7KIEkQv#pMoJ$&Ii|-js4P~~=7iBSfH;m1%Nm&i} zbR)@Y$dg_rUR3Q-jnEX#w^*^2P&dM&^Q(ot)TPpX_y^D7HP%`Cyu8!KAI)OtT{KvO z5xC!`T%G<(I%`5mtsSdG;50?i)e{8vm~d^MN&!qi80-$W6AK69JOy^L={?JAdNXt) z@-W=0gTFva(~3VL3)4yQ88QmmsD@BZ0+WwZ1P~n#awn5x5lg+i9mZTj`(}`j%|1Vq z#fsnJT|B`fFI^+HLUGX)nt!w=@32l~zo6eoI3fxtWTbVS((jYTosVVEjaP`0m&zEJ zhhq&S&;ttQTq(;%LO@PuB&2r@=1&1X#g6@aTXsua>ZopsI#a}=V;$j4?zpWWQg8^s zi;CkniR;svT^Td@?{$29r_zZO!)T<&CaW?}@N2H;WiwV{6*&xV;Ij*{kevy$DtFN0WHW>CX*Lbq~nK!HL}ZrPH#Ky+%hIyt*0h+k*&oz!SwZ*D~47cTP| zERSR#R?CwBc1Sz_|EcZ+=)EWiS5G?2*N$kvQKb~J>t&~Q&0qdBj zwmH6&13tWKD<`Vq_|IN8h1!08Ag_6PSyw*;`MOIu%3@*gR6U2<%5y_Rsf3itq-zf9 z@oL?7N_G5rtP)qu@0%LAnUXn|<+T|#b?P$}?h}xi_G$$6`p@1v zz-phq4_r$xC0T%1A6yBK0`5^edOAn(-CLx+=sDvxoSNyus4B+tLuTT&`^G!#tY-3;@gZz48VA{rIq~ybDJlqMdXBK9hn_KXWK5G(QHivMns$T>4?&x&|$umiiDc7;=hHCGR4cvB|U?BA-usZ??;IbMc{jx@0hXV!^{x?42jrmhJ zY16^+&n!(AHF|GOB$>Jec?p19z2

      2ISryyyhv4qYONRJI}kWKc-z#^AEnn7zSas{z5GK2h&9OUJ0my}9JL8b0rl@fU|POtUReFYixxHn&r9RNTOEom{ zW7nt!&A#GG%ON(m*3T|AQ4pP^NTV51m3#Q&X86%ak_l0SJudgN2paI)t3|y_$+4$p z^DrV57kVZd5s1?x*(|Uu9 z7XJ-}xI-FxN%d1@@CAhZjOr)1G`Ii&w0PlI#PDYb$e&@vKH-kZv~Ua}2E#wC1pST& z51IaUl%BHrVS|0hlqO{KsHKRQ;540)Ksj{+qyiBWpEUrR?Nb!uiE#Uu&#$3od&1xi zSwMCW06Umasf>{^{)I}+`V#)9l`;9}vZ&_Y4#Qp3D+;g=L$H%u0oM?f1O_z=e*`fR zXG1VUCHV_@D9R3F?yWwZp_}^Z-&Xl`ORLg9&mk?(@HZCsByg-n@UsxX3ALtPJmzf*~H*p#^L?q6XB zPv3s0_%r0DyZV;GLH_0AFr|zdnKu;E09px*nWTQA1`7&oF~$|$_I@NT)v!mx3VhRm zit$bzZWeX()F%NC6F8S}*UY{(6QXQ+Bf@A10Kn(Fpbv(-C$#vx zDg}Su7aN%k6*WrPDu%ZCl4~(JVkZ)15<0#&I#pLYc*0$nRq|W*I=kf>128G_1bXJB zI^W{n7qIkeVSQ81mX4S#5G4(dKz&5zFwDu~yrM~KT8ukcZO$hHe3nB0+E6n@!IId+ z)*`N<=Pj)lr~KNm=CRr4*Vk)y!JXRpEtoJF4D#QQ=HrTIwii!x3pb zDJo4BZEflp7&D#>JQnrQA_#Yq+mcU#$~%F5b+lfFN@L~8Yu%}ST!3L1DwzKS1X9(! zQ<@)~+dbknO`?p_EsJE!jB_nx>&mE-pDx{8%~zRwVg67{<>O+isXeWU2r4&cI^w4Z z^BitA)Jc#Qn}nCpYPlznnUyDyOEz=um1Hjs)a7p7N8yY!T2Me-8{X|lUKQ9p+R`@E zYp~Dll%YJPDwff>tz0eo@p!wBx!CmDRsVXr7<0;BU0uwq&w*M`r2Lo^CqWfjEzj_} z+%WSt7krfKqFwAX!7VjaMxEr;K%I=^8DaaEBHMCuI^bn5((H8BM)ISc+#eHB$!nIo z1CYl_ykYoQ%q&8h{?l3( zoPCk^VZu$YfR7kzSGfWz$e2&^bdZpXT<}4T4kAex1*3`b#?<8GLN)2sy_?()caqLI z3eGvDfCn%vLGAX=eclgTP)V4EDcj!kdTY=tN=?lc#@lw1uH8vVXYYZG zajYz;76GAW;mEj{imMmQVoSK~~IDyQc@?0?DP0dU`RY+*9PEl7GF< z)P;4u7kx9rIfYgy!-&VbliusSW@(T!#&|NHS3D{YW&a4GKlM)DZ*fa)i*ZYzI-7MR ztL)Of)=elttllO@!oUa9kpeH_;Gf@5NOEA=g}?82l}BFudH>V-_Z_(Fc^Qs0+aC;u ze4X9ju2+Urlyv2RFCLUR6BUd|S9xC=@xe*wMe9#T<{le@k7o>j7C)Fw6$Z`uUpIrh zVUr`!6>LZF!DkWM(ZlTvtnuox4ERaotxB|RD7b|z25j}W5q%|l2mo-DA6{^9=>G%t z7lIC_VNJfC^X7`&r{LfhH<5K#L=s!;dv*f6*FJ&*g6xmW3h;VL@MNtiRaRHFIvWjQ zDI!=vGQ&HN$h_6+6R##eG(5jhSqP*Mh$oxLPxIwFZ${(pIG?|1O!Oeplx{fdgevsu zhv7ZF`=}X-pREv`(ak>)Dfw`17MkkqA&*M1H=Cm48@owkHTJ}iL(?zK12jLd1{T9( z*(EMlV-B7@HQj6jy13Y$;_QxNM5iZiD%o)c9sTlVG6g>=~4 zWd1s9z^8gi=R$$-w8vyiSC?lXmcqaO%In2In0?^|MWIRRi8|#u6jTRK0fbZ;-TLQs zs+Vm0)Er437uzjj)iC8B(fz<+|6SN6k&}#LcC7)hrWKLsheeG zU`andSI0GB3voU_%E5)Sn$+!?z>$`9$4xgA?(11EIz2G0I-9)!!kztx@8Iu6rJC2l zb6%Ya)VV(WxUtk&t^^MdHP+w#8DVriaJ3R9ZC%T4YOi7IcO=%gz%JW0j_cxebogXf z)lAE4=``&k8JfB)tCx~m+2nINiM=^K^;+@-_lWL`-^!D!_$%8UUnV*~d6Ke{rM!-j z7K-b>wq_AO{CX?aupS2Nd@L!C_|o3W*%z3idZ zfT|}|c2)BQeXeGyo;&?lv6q_hE8Fah!RJRFE2M`STkfgM73#B2Zf8x$zk0plb+Fxt ze}MCsy7{@Zdlk4AH8_Be|k1sJYA01c)y+}K6zIKPe?&mS7qfpoTh+jqJ~RITf@x_ z^i96uW(-!wOqbESRwX@i9OFNR;sEfiTtg-s7 z>5s+xtf<@^T5KqkiSJzGyG3dSbt8Amcv_!-d8fA~{3eItb3jd*T%_!`BV}?KD!S6C za-QfLl3~H&=w7-kcqMJjab~@H^>iov69J?5W3Ys&hR(*-S&)>}&KtY`a*l7~~3B z@Y}ya*;HEdw5f1IIEk=%a8HvIa=U-=<=o$1vT-TopeX)ZOe!FNC)bd{7x*HN8FFa$guj^4T2QzUB8c2H(R`UV{;6FTBw`_V+*X)qS0^^}nEZ z-CX~8ET3l{GEiJ1)Oe<$=XJ4i5#pa<{-(D@FeGe&|Lj10(^x9!w2$8H>|K!CPo>k6 zK4YmHXOZuTp5fBd%^U=KEhq-vI_bxh4+3(hZ_7t@p4rdoEi{zf=**RWOg}o>O`p*y zSu2VgsOv*eNwaOL^*CPjYVpUAo$Eql%xUu}o z8(wuRZabgfm|5jnrKuC+Iyb75$E;=3b+P1o=;T;doqnzu9ddJW+(*i%T6gYBlk+Uk zZps-x9(xsUanP>LJfA`N#G=5yKAWlHCSC`u7DKf7Qv?L+5wW|tcN;nN)D)Y))%~8c zr1O)z8Zwe?LpKtXzy96@Ky0XgOnJQ&?*3|FyIG#%)(;$W=Y+nvGaq327SQNX8G?_9 zU@ZDSp~-jM|AZ$0Zul8-~-5}%jkyu zc|mYPxA_L9{I=_XqXG(u&Eij-JsF9-EaUM)qsLC7>Vtz88rQXZk4B8l#F;VPIm;%4 z_VopPmvPaVrpYb9$)m1he$XP#;o@4`lbr9pFR|& zUT9DriIO=!>CM+tK>H0X4@M)5L?(}tZJ#wHNIr{7!Sj@P|LBFr_OGcH=O0`9j<~NP zSdpc_&qE*i7k@wcMmFLTaEu%$l4da-R`?{u#{HLTR9?DMx znFY7y!e~R^K3t4aIq@iWyr1(|AXYYs`Zd3ve(EBeA;#Q$QB7qnXZ0R4b5^#G|sonOlP zQY@DUySO`J;{momL)AR#iWC|tQq9`7@A=pE{LSF48YJDvX1_{c2lLbc4bT= zcFvGPOLH$;BU%hd+929jh84!gH81fT#tX?gMDo^(f;nV&gg0gzKNlSrOFgXDc4GAU z`B?}F4QZ;rhIuh#I7d>rQkMa-h;omD6>9cpo|dL#Yx%Tywh%%z$xn+0T*VBJ4JJOh zF!=zQ7RCPS($G|CUg0?Zjn~<=%{t6vsu0;C zUDt^n*{Q7y=y($>#4f$u*POfjbj$&a*_C1f^=z>P$FdfsFw6n_>*F^p!RNEz^Eai5 zz1BLy-^@?5LDZ_1b176II{HX}9KG1uVRfx6h<-!DwO#jp0920e?Z+e)GT<6afnlu1DNq*o23NYCUjzap_+D z=;@YC1zpiKV#6kj`up#3F^S|(yrvA9#H+(^lqYyo5>#w=NDC$uMwLGsTk<`ki4xZ> zU>8uJUZ`7NKKmxze>Aynq_*2A8{Tx@_y)1o8Zm*?5jnPoFc6b%g0TPC{uHZU3NIq` zuN=wE3$48y)7ALrukzb#U#I9uh(!1@F6y~Gvj|h{%AhZn#N)Lb*qncsJ)%^=HMRn! z*bSjg$s2fk9C27QKyM}uP~E@-W3`eO%I&DLs7R9eiK#i z9Jukw6iSse7ps*(I9NqyMw$$?jsb2<98(T3xR z;o+0S1YXmpV1jc8gAP;g{3_^<%mC)6quieL})pVkKa5%zdm}a)oRAOV*A+MTXL+BotwkK zsF})a?c_XX-X3W^d5%$v#{DCecE7H1x&&R((A$FmM0)pIsyKG}#y(;kx@5oG@>Vd` zo&piVE`S>%99epOeicP0XireOZJ_l@Cb-T}-bFGCcVn-Fjth~g2z@S zs4aV0G52a>KZr8R&FK^yw<~32rtzBn)q9IiFK&9{Q)g-J{asdpI&|_jk;77(_P`?NcQ_4`>`6g-xqqfri;jmuTVf27nx7+HofMV2a^i#0{(BsGgeZkxdgM|nPeQvs zD@zA8oaJ@a$;$feTq~Ho-Vi^SjG-P%L`t<^%iE4p@w9msakVT+fXZN1%Oyn9ilGc~ zZ$f2he0cQ|5x`i-sWc3~U%DErD13YDfX4eJvv$)5?5~@0;)sB7lU0J1o9fqcd!@$$ z-wuXQGd|{My^-K&$ryKfkyumY(FvLTCgF(9eS2@-YwJGh5hne2P3u0N{YBYVU-8Av z>8wg_o|N&5v&^FvGiIT?t-3Fzf8xU7SE=-MGs0!zD{eNm-^NJEs!AIDKt}!JtD)oa z{3*30$w%G@ez$BXl$v+x!%L(&Bp+-gO{lMy$Ac@y*|5s+f0)0;)mjf8=l0LuNWTXV z4bxbBqk3p4WVm!0XerBE4NVZtNZwjItigcm_=6#oV6G+)>dKt*!E*ezLK({gE~BLq z1{A^K(?A~07I#;&qx7pVW8_l&MyHa0{;tlCsZm! zRw>rf1$6i?v>)eAV`c_Br%9wn^R#a45Q7?B4xgEa0wQqG(KciS_RJx=#rO4@G~{jS z@4p?idTxjQtL|6+j~T3W95AOV0uTU!3861Ky>n>N<+$bu>KbtM?C*9O%cC#(v}YT5 zbPo~$gTTH4aB$EJ!S};o`J`ynU&(oRbqKQRbX^UDtx=k`!zmsbg84VVW?r_td^jr;2x$yg}? z;LMGdsK^g)t>Zdhro8}ZZmxLn0%3~_$)QZ-%(d1^n5c|^w?3cS*uMt#vB1!BkD8+B zvnZYLVXFUdND&%ea(|v7u0W7Gw56EE9lNljjM3oCX{?&%DTb8ge-ZZuausl5Qfu{p zHEKYJ{+k2;kJtdZaEUra_ z5Hu|iCiF+zypkLu$qFp7xW@qnW3b+8U=1I|IBJtM_sogHWxP(EXtb zUYv=RIeoQd*0$B3u7_GUOVw<}^P5QX(p&;j;)nn;^F1OAT^ z)Zn_XJ8~q@wVF^ao#UL9YU`bqp{b~FcC-YrU_1H6ZVhE|pE(Y4|JatFh`BE7?Lm$03^~QVBS?^2}rTeo-s?52te+1|I7)F4ZhKfF& zwJiN=*8P6s*$45Hq;4yNto0BfcUPbO!Hh6tm#w9JoyX5&e?eqWH0haQV#}L^_e}#E z5gQ|Xdx$LQ>f+7ix?3AuR~||mIV2+DB<{Yf@1Sa;ZCmg-xWkk!IU)&r4_QVi*?rOWL>{i^KAqwjz-1WP zK|xSG&Fzuij<0r9NSURde08Mzk%?zu0l4-2UTF6wHGr?R3cZgb_Z}Y0sY6KnB@*+s z*cGaTA%?!BDaIxng;0fPEne1wUrdib$?0u8c3#$67n3ZTt&ps2c2RW#N@k;y_to

      7V zTCYZdHa)ztUvilm6L-!jAjhnZj!;!qETzfRsScG z@AiB};A~fj@#J(H-(|XHBy=`73(xy^O|g9;s+&UQq! zAfdE6c%qrmEtN)#8PueXBaSM?hX4T&5HXNZA(x1-+lI1wZ+LgGDwm!R%ATG6mbncR z;G^qC$OEJI4SiNrsH{Z+CR$;ewq2l=KM00s8apSE!JQLVJsJBBjMeRxBm<!r>PcdtiAaWrNH{8>B#A zgBI5t^<&p!HgoxLmkLgmEV}%im5&$=c`314*)MJrqbIYE$!rg1W0p(kR2QM2uT`M^ zocn7&K{yTTv$y%O3B5pNIu{z+f8<^g|HdxgejK0plXs%Nl)QOndWHPaxi1o!r(Omk z-F1;=#8}api~Fr1Ynk5ZnrFDEUD_DnMG6!XG?cc1Z zT)wR!L}3-`96^-^ZG0SMgSmuGTHjS-kI7GS`=cUq+_83+LW1=O!>5xpOS6~yCLY4a z)W$_+Cz;B$ZOClV(e{%wl19&+sh{8`^r$*{RZ%08OJ?G)pOY?$Y#QlUN{+)Cm0bz` zTL-KuziT6+`J(ZL*NGjw;4qbRqE!!lnT!t=4Gq$2YanvtxuPKpi4#Y&mW+1 zmrk1pOJR7kB_eQV0R1|*9rNegIr(BnJ}2Z{oKy4RpAl_BMG*0!YhrSkk-4p6BX8^5 zt(}V-c@-Cb9^njNd^TiEOr6^i+OdChDJN^*^z#CCY@A+M)>B&cnS4B6-bVbAh4ys@ zB1d}8HR=Gw{ONEdVgXCVS!&~%!?rS?_hqbYX@>}xZ-{&DVE?HMjxST_8Rgl~JD+2n z2tyz7tOSAYIzi91kKiP$KAjW?ruCcz()=4qA~BtCd%CGK65e974p@?az_>+MiLB8O zQ!oG@d}9P2S$(0frycw1`?2g2`f)Yye*{J!oqh6uG)lm@GD8`sm@#cn{hc!JyZ!e! z4=_X{S-0qcvnaa>g_ieQiyB-@8cI+&Ll`&{u&4NOC0W9F4-G(uDN&>&fx)(jP(Z>{ zERq!ijHm)PJMiVL(I6Ct13qhmkiUT!ks)B@7DL#d5uiWGO!S`C2)yMCz#xXvl0?WY zI}fE1m;6zH(1Ux-w5Toj!B5Tkx@j;1i~v^XUr6D!PzdnTMiQJJyvi*Bzya2~ArB(O zr~q&p@H@l*nzN|+9()>~K^SC!$Q^FiP5|HBsdK7Lo|A9Mso%__k3xd9@?{kbVj~*- zEB8p5B1U;fKMj0Qpsx|PB5$LN{JDWneNiW4vOYX6s%65FaXn{wmfI;4N7y*B;V8z{ zH6_P^3o*3##tH&%qJV$Ac_;l;tw8*h*00@Si>vi#Lu!G%R|R%LsF$L+r=sbUc#3%B zyxd83xpNQpp_cOQ9b>!V$bsD&!)2{y%&}rb^*@8i0plmQ_%uJxO-x@c@4Z9kR;pzQ6MM3?04-=e>c)mE&ex70_4 zM?5Uw^*p`U;#o|_JB5H8MNDA>=j*2#==I>WJ#kKHG9jyH5RpuRd2=t?>>qtcb<5g zQ!mNUx4n>1vFt6*{3=!5VHdv=wx*8@`9iDT5@F%c#Lzk^ z;*XM2r>YhDF_tfRua--F8w+WXjAXB{vVmw>Ts>W1ghZ`WaP) z<-1M|1doAYG%}eFbSa2)hugpC1RQ_0J@{v>G{=k!nJd|(naYcSW%df#>~r>JJEObj zd0@WkJKBYXPq&B@svc*bAORsO>Ei5wO0lCNWxGt$1pic#fK-RQmlvPs_TgnC?Jf@K z?4+dL(C8+$ia>pHc!?n4v!5~%g`T#_!BX#^60~&Fy_2fzDE<(1SV%vhQ81q4;uEe^ zA+lTm>D_(1S~Ge`=R03>>}%;=D~-+ctokogC4osp@=q6VNW=PpHd9ehtBn0L1bc*- z5SaC${?traPrsas;8Cqqt33@7in>JGQ9e0g)|z4b)Zv=w(tFXSFx|+aKN*I*^sJLk z9=EQdfZ8$S*0tH^m@h&q_rZ_Qev6dgw~loc2d{TaI5Q8_WyH$`+|+0nbNe((rb1TT z`4l<=TNds&F&vBmoGxziF9{XodHEXZtVd!$fV|Y(Wa`5GmzU~e%xf<_@r#ZG3=1+z zw%=3PcMY2MrND2BvbA<`VSOJjOoZNkczE)j81{uc4=Algt?8y6i?1`XVD7pWbEoBY zktYkJRl4Zk9VAe7m(o=sJ6j)XcPZw*;k|zGazI}u$tb&1R;pUbN}=hZs54ea=h2eo z@FXERP7J4%V#L8iwUiH-I&vTh>W_!-Yf-#vPm1yi>vklw8Y07RBOL=UKKcXEO5Vi{U^YYz4Z=-7>U@ z!P}hi+8|F|fwFa!eq+|=ByhNTM_ zKl!eIO}YP?W8G{%D=cS8A=cr~T6W_CB&hrdVCN$%b|O~dQ9El+o4>va*bf_kYWle+ z;&lc2FPwkO)GaH_zd^cV>eIo!f2>I}8k~DZiNc5oOppP(N54%JXuj^O+y5|8Mnsjr zO;jd7wKQncK*I<`wN;SH~+MEq2{t{ZK*2=Np(k zB6x~}*rV}Wn5aRy-dk`idF}zR3%*McxW2?usQ@M=fl<$cc1u^X zA^Ag_6*jd0vT^M{9>79~)c`>v_j`*8O|v6M-LIT1ur5T?y@@a`^uD26dDjUh)e+4; z*neXpS#xLM#z6~rU^VuNk13ed&7I~4x6e!3OQODZAB#E{be;|ZShQ$_aDnQ0lWquztSDet$)~WHaeMtj}!khz0Nr{9(BP}5%U6LZ*-QC?BDWydT z>6Q*@$)j{j9J*7wr0d-W^m)F&xMSRRjQa<=&faUy{LHy)tu-G&vK*f84PCo#?j|aT z%2zggnu0Cma6f1tOwa#4^eC==nyygCC(b;D5;C#XBExc|Y@HweDbhm@Vb!M5#q!?F z%{X_`OzT(n`)QIhLlg3f@=~J+1cD;K-m66WX2QyyUy;P4h0Gfg6_vNA#@ zx}4{ejoB;@_my~b%O#(~aSBD-v8b3g=0p;?s4^9-wChwD>+yG)D_&{B{QFpH{byXE zF%7K~zQ0eZJ^VVSm1iGa+99K$f~uhgEq5s$VVZsfkOjW&@GP|l83&BYAvqPQy0XTG*2F|JSkc)*An zc0c!Z0tN~5qTIXviLlBs=>|b#zo&%%AtGtbLkaul`bJ=-!`>y2V8S~gozIa*u6Bs( zK5LvzVX{c`dAUQIs;r>-FsZ>XglT5pNTXdVl;ob=pg;rL6ozV1s z$fs+p{kp4lq9%-;0h<6VX$+4+qt(T%aeh^piL3pcSpOGSJps+u?ZD@|$6M*&BpU>m z^-2B_hZkW_zDmMZ3enx6pbLl5q<|Z3pXc!$8OH?Zgz%lC1A%~1!Fi?04ijX?TgNvX zfp2qb>W%tjP8O;OgI2|hdPRMnkN7ZVlAswY)mbK%BgO%nbqif_J@aQX#cQngwOZ}T-5$x+6$DektX2$lV z1r3$qzZwh?$J- zyel=}bNOA3fDH;;qX)}dLjhupjZw+ zSC}O!=pS$7_ZR3nX)o9=cHWj%O&c7AVCW2PNE>C?+zUG~%b;{Ss~3*kxdR;G8l$ zW*Zz9TIuFl+AM8CHaErHPsS;PLJ$QK6$O;gm>a&zk!x;yhb_1{m?M|AOX6*_ z-o?D;?#4`Wy%4W<-?lqPsNzaay=yLFfGcBfD%Y!7S5NEQakqD1fAC7L z@j~!oGVO{-w|^f?Pxi77;1soU(bt?Df7Nq-AnsSugsJ~+SLl`CD?nI3kGk2La^A)u zO`>*cR_j7P-zQL1kp5!y8$+Vt?FItixeTbU9Yqvu0IbwNKm<-`5{bjtdQcC|qXiof z5wpP8kGQw8SZ-rOfQ`T4i&a`FffJO#gnSUozU1@!UYo$wd**E5tyV`S8#iiHztw6b zQ|nJB9&U2kVQKMl$?t3kEc@>bh>mLzh=|g!5X%NDUchYKjR(RLj4BV;#9b&_YZIhr zY-7yc@aQk%wy?d zNQlJ!78dw?|1^yGEur@!JQZiQ>uCI@J5dj9<+dg@OMUD&45FUO;KwGl_uh#<9(9jp z3^I5P8ZSVLma?*Gk)$MHz29=TDyfySip9DV)Vub-x!njU;vba!MUnV(fX-iZ!S%Th zcTg6An=mC3yk+!>s2%k&NFPCl4}c#ld_fIf)QI6HqI>@vhualPcous|03ucpdUXI1 z|HB^uDzgdx(75dbY$x-VAEi04SZcqM`ad)YRtURY7X^S9a1S6naBoNrSC!~aHcQ|r z;#~;*_4pkJKn*~4c6WaOz>Wy3On0~k;QUt;MT|c*Zu|VBi9#4Id;yEQ@uz=-3%4b& z4N&8%58+zfnHptb(4#MT)Q({Bs2Dx<50>GM*hPYh4|FTnFGTaRnMQuqct2*xZZ&l0 zyYO^egjr0;SSpT<1nC(D@wSEAk0QfqvJCj{K{C|T2 zAWm@MS9O5P-y94$7YwA=D&Qyx$Z0@+{jWF!!V(O9^_cHF%Y83y1Sj|^ygTFk#dCg; z!7YuuKL6l3uMPDvIUs$x)Sqm5OL=6G=~nCa27rctZE=?i;4!QT9R0@@|3nPH0k~3t z^eHe?ft=O&6!Hz@KLh&4XxCbIs=NQ?r6O+xaxx)^(D{t2!^wmMc<&$-@bsz6YVjZM#$fGD@1tOr(m7oG>H+O1N={roOgi^7e zx?ICdDeh^+V=Sp+I;39rY!-A;Cp6P`NVk4mo|Dg`dIO4?L zgT+a9I|N{hfI2?07Ef6gyKi}Y<6kO`cB`N4#)lP>>$g(|DU6$7e4g_Uu91W0WWL{Q z)y1>VO}|m^vx~J#{p^MLd@fbsCobJGr!nFk>2d#iNY-Y^$&U%jENz4QCZ>POJiQE5 z*Bm~Ni#6rI^FF;!IvhCJ-e&@|$Nu=^{BkQ4TN+X$1x@0J_7n+5-g@pK*0(8WIZNU! z<@dRc;wa9|N=@3P4gK>GT95(}gT4?n7_3@_tkSt2TlN^WR`cLmW(_7XJmnwxjIDr= zCgqtO{*cg%y_K3Qvvh*Rbq2%F(KZ%&ke!YP>2NGI@4xh zMO&+8NZQ>P_|z>UP}-+}qiDo%cDM}yKS3bOx=H69+TVtn>P zxerViy)`Uc`+r@F`Z+pSjyC+yTrj|u<-mC%Xt)Fk)gM(*KkrK#81KXDoxxjtlIUea|6qnCz3$-Axe-mq5>AsZNJa41@D-M+at$u?_73b{TI&1Dtfn8<5Xh z7(SycT%w#d{JA+WIZd*K1~`gJ^oOzraGnex0ob259RId}1zfn(+rB^x5D(z}A3DKh zE_eU%@NQDtKNi7dS&C*vH$nzVTs*Qk4g5j7wTRSf_lNg?6_tP;n8TL6fCn5!`fDvl zKouN-1d5aaT$jJXT@tWEZ`7d|>&NHH_8gx!e+k9|;UGZrQB&#GNDtcy*va%6z^Z*8 zwLTw~+SX{A_zdQ^F6}QY`FP^10;2w5J%zispD5Y5t)~+gN;BVf*}0!!YdCcgcw{tT zLsd5hXZ?c~ZrOiB!5dVnX4STovDCBu$nSZ>6wI+CPxnvI+#;KPUQwad#ZVNi3y*-E zu64u6Gkuet`T-AA=;4#&>h0K&tp?3!P_*-?am^V~^;SVZKma{KSBDWOljo}aC};-D z!co3WN*MBAU>;uzpQ@`b`k(mrWR0HPB|WK)ljW0^a?{XDc}_hl?X7T25#u!ZY0+U7 z&_?oJ2j9+i{%@6)_DV3uxA6l`w#R$>Pvcii%QIgo=T_S=Smnnt(hf65tL*x4Wf`Xs zeEEHq-V4_Muruw=ZtGFWe11UUUZf#`MNh3#gLkc(cMs>V+?pu2jGNhP_IPI zl+vyMxQkkLW&8ZJI8cz=6BespMWaY-OaEF!tIM;f&iM1Qa;;%zC+5OfLSBQjjU8#1 zS=rI~AL4Nl2k+3mmJT{vLUY{t2#T+i%C}-jjVI^?dqWkkHG;%^Hc;01h69U}VgwUS z6tB%yvkyQxWgX?&S6$HqDrOBeBi&n@K~@@HJ~~)wU|?Pq=&<)bNJtuEK2%BhtTi7v$(Dd$~Yln-{_ zlobbhV5Eo-$g17|YNZ?m6un=G3Vs&aH|;obOk)}Xum{YEqJi6!_SE!X1iRnkOT~}T zHvpp-bbgEsnr8^8?t2BA$?=x8P7|(5B+@y2eO|B zS$IA-q1mJw;_Hz*fs48tjrHg5MTRtZhYz$Kw6ELVMAHlvE8WJ7m$161*QmNOeU zdEE*q@lHdv8@qxcPLR8IK7V(3`r&$wt^BomobZ_updN}4^hyn;&6(sUD} z@jB|OYn^NP{o{Vw^2F;Z#NFPoGn=n?)LK<BYdPkY(zvxP>sIAC)!Nw|w*|h5yd$ ze?fvefCQ3+rx=(HgrBv?1cBG#IXJieY9nH4g z=7fIa|27<$rS(6SLqJ~Rv)Hu)WbE6YIMfnS&OfvhLj!)D*@<;^0qgn@`j-u5+o9{I zK$rf&L%3A`gN!&7=y#WfDD@#XY6924`)qHvn|-A$fWz}CYrjgCUe@^T3y%ym&s>TV z^8@Q-^sWV7{?6T+lWlH1Z>fl{#DYLTID0cRLETPk3*7NJHFncp+e=A;e997ObLS_1 zsWazGkHFXGE#K$5?RLE-w&4sxg5yeh*Y;}_=3rm%&C-LH7mE2)X?%QX5LjRRNggp^ zM6!7lugo2*DBp|A_TseNu0A!cRK7RfP8XlN98VXy(z^O`1$|Ek)ecsa?2^u`Ivhy0 zi20irh=-mw{Y<-h=_S{-Q0n*WouBWjjhGi$_2yLIVp)m!Mtbgd0O9%YPFKgAS>w&y zx|@sAUw7>Ixi4o@b|ZHL@*C=|5B9E)Zpz&RG8BwGp89DJw70a2>do5nzHu|`Bt4Yi zZT(Cw^+@Jq6+0N1o_#Mf;Xa)!KN0!s_kkRU-Trt6OiSbjFOdB2@i_-*Xnnzs_#*oI zK@9SQfaK>#_e}AfaBz1oykIGUhU_;on^b90uDY<-jdp72N@r6^;4b??4NkCBZOv*tQ8Mif0B9`vHc{;i5LBKL1Lh z@A3FIE31Q!o6q9SJiKGBW{y9tCw<-^F^YX%Xg6=K5{I@J%?vXOe2RTF!10$Ti3P`D zm#5*pl$zSu+9$=_ChGYezZEx^?QQwe{#k~XKNqG0bFwO&X38}*q32W0&a^(hd!uLH znN5aEt|B24*Ysh2>U8?Bi<5~UkcON)ybKs{KRCwgNi%s}+{_klW^_TAn@)pbmpA)0 zI^&R^iwCxM(qfh-xx%{#MLpG?LFTwLpHA>^qD9^h{JOauC74|QvPtjgx@$TR#>=@U zw7!%Qk~*inJ5$ zbl|g1ppb0}k-NkBL1%2&_X{~)om5|6&pi~%`2`7zk*@D=&G1hqOV;Vet`6SmVRLgC z9Le0+Rd36#QZuriUj`ipFo&7)D+46 z=j&_~lgTdbij^U^`tV=uh{=6^g9)uGHRobUU6w$3OCSNM_jNu3l_JiKO!*ZC>sHmc zEg~Spy#ax#H$z~1W2b(3Wkl$gr#zA@>FH7{LE4qk1 zbwTLlymCCwzyC7qJDxOtr7@4{?|4qH$-b__e7%&S19mrupZd9|4c)9N`kfh1NHJr0s`k1}=^kcF9y|TiM?rhJWv5W^l~#Ml&1o4# zmJ}09yW+ad8pf>~zd2&q;pk@-+gYR1uYkGu>jweshj2g&<$UsdQ?KHYL+(VqaOiOp z*L#Z4ycryroj`3ogMOL@qlNRD8fg!}jLWnHY0R6RA0LKti2G_Zqyu;F7T3E)Q*&t&ZRYz)9fgi7X%)|8rRW5E0rkXn^&Mtl`A?0S%IN3fnF2;=<4+A5 z!|jIk!4I*Qd*IPGn6gP~*;a)!$r5nx*5Vd^#Y{{w(&`L;(Hq!LyPX-28LB#xN_(&i zfvPUZT))^zm|{)xx2l$^`SB`p&fkbBD~~RE4x?GNM+Q?-tu}Cmv+*!dzEPi!oE$v5 zkJ{DF%1g~_(6MY%n2=}VnKjf)RTOje9a($h05zweyw!;0`x2kXLxoo+Y#Xn1(>Joa zi~AL>I8ybu4Lb}eomV_;&y^1qH29Pk(c&`Ni_&dgzwhjcLsx(H+{~f^jn#tUYhG-) zMt+2x0b`_Wo&v*8_LosMGTR9Hsq#KZZNtY5<+`ygl}lps=EAwaHjhBKiAHI2`q?vD z8I82E2H!WdDn&x@2CFJhA_KGc=kwU<80z+Qq@q$;y&fcls4HA-4|iCIKi4vDrkXcq zrxHYNl_*Y2nN{Yq5L==!Mv?(U$3-SJLVk*W*cO8?h4Iojjxz}-Y!dCOX|Lw%ltRMF z^+72*V+kWw#et%uEFmh2U0Y_fmj#uNaB-hYP$bMoEk0(MyL^Q!_7EJbvN2XEK=~RR z`HC}TzV``DY)om$o9$4xNzNlDnagiqASnZzW5`9ZD-cKsMJR3Nyqf|D2o?rBMO8^@ zwOAZbFlQ5U!XWu0e#!$_M%Biz7>+C@Q*_Nz;5kf{?_mU`ekR~$+Hrn-`ypxZBI8c! z1cvWVsQD)?`i^Fljf>IMEmvY!I7HL%R{jSb5mw5xGaF4Vh_DvdY9@T zjwaRKYoHMBX!TY#9x2bcKeJ~fnJ_qM16HAZBvq^es^3;N{#_9I#aIcq>^XkfgxmU? z;1}RgS0oUg7+|mO67OA0y>%t+ScUDLNpIrYOsksOdi3F@8Q=TG#d$?l5h4zSGgCm= zjQz?+N<7nFBlPEh9nNcU#pCKGL@+g={(JB#ko;~{0v_*goht%7b>7Mv1l$O*tl;^; z5=O69RQqIl_rab*^F?3(HT?iuj%ESa;~;449^y7lEKe+L zvk&%S^^=a0z6Jr(q#H_FnCsmb%2jt_=bf}C-Ym^L0SnaHwS^9>c$pzLbbH)vTFTI9prf7Z?2=G_x`(yD`^YZkHI|i62=h}^JI-v@aox=7$3wbGN=$uy=rbEI zEsVk07dqPS;Tq)WJgQQriX(XFj;FJHqIK{51UnkY{Rm|!- zI~)Nm-yQ9o-1jTymJ1gh&GObhD8d%HH76>?k5FO@?r-6ME~dT0A)Ar3Dk}BsAt)-Q zNDWmVvI>4Y-I_!|=0&Ud{Ym_7SVUC?H5>g>j8^TJvZ2b?I*B9E>sCiinBj0(a!$ZjxJ z>*{xP&uw_uk?ZRH$=-mVjonVAIh)e#TxO+Ulw5AVJ;_`P9UD~^iH|bk&QD9pS8A3w zK!I)d*JjhtqI7TQw{TqY&gjt|3bLSsFqHbn1?w`XNa{)k(rEWtY)nxjSFxCQ=CT|? z7e?2i-D&TZ!6g`7$ks$d6a<^Xt>f|c5yAJ+Y10$m^I(RAamY!W7dAa&*t9+fb)_Pv z-8a3NZocL#XpThM+V@DU-(5|p{Dv_W3z?#P<4MM9hsn6}(^0bX?I^=vNFwh@3NZrwXHcH=iWDKs<*xjpfG-6A{gXO6z?4LA4)os z5;zUOrTniXC&W7wUNtqm8-grs13xT!SFFP@+-{}?uJhqa-b)~76ZENc1J<%BFZB&PMAF%PW<5St~TkEAQcR@kR#UEpm>8C@$1>AWvn9TW!Q77d4A-r+DN3awI z;&TiE!7muIX}E^YcpsBdPj|20DSX)PuaTy-jv#|-fZ)y%QOE8}N) zU>`k#4kCRvF9K~B=rHN>o?qiRab;j5ty#7sIPZ4bwknd0tOPO5Ijwy@7xtTwn%53^_Y_B-J#l;1*QW@5 zTv1>J4TAJYa6RrAdJ+eeX*x?iUG7?Bq{!TCuIM`pNXsT&U@wA+$qEZi8dW_Eb z>sG^DVPWs2C#tERb!Jp{;?J0Vty!Yg;n5rIC}^qdwptT9v%Y$vJhmvT#oa_}LCa;l z+@@nI$FDppOs7BO*oX&;k2*;2Vzo4L0z zS|R&Gn$Xek54mML#vFsJQ3%Kn<@K5{>h6a;7pR#!a~-K> zI!|>*je0wYyG@>8vhL1@SJN$_wlR9Hz2Fk#pJzcH2KL z$qfBKks* zWBOD+nUj?9YSkK$M2G`)v_E0}#K)6Ddvh%*k&x+$A`v>cgl@jD%*C0uTWc|bPhJRg zw3#8Fw@am8JRYB}GKJS2f&KFAEf}2^l?WN6Cl57b=jHjCYq^9d>k9xE9V{*kC45*$ zXIu~N+hCcs^M-a|1FVFhK!3L%z_4_PNCuhyEvz0Qh5JLuZ}Hv*{z5x4fqol;5PygQ z4$Hsfa998-kU^qw5{Ia_?JP2VR3d;B&=WWaH0~JR_Jk>ep17?gBoTvr|4>H#VY~mNkgvJ^2-8&eq7ajNVv@YR){m87D2P)*v*jo=C?AA;L|gqYNEAOhCG{ z<``^#;zDZ=8u03hvk}C26tqcFjG+5|hWm@Y7){|y{{Vb9C`AgYT2z!G1C37I zEFV_Acg0=rLI=}{LLqg@V+<4eQle95QL%uX=&WHUAGDm`K@GyRCeZu_2_s+s@Qnx4 zZld8WSXPk+Z!fUfyRj`d{xClct(N2!)2vnyv9#UA5!sa%iNENbz8ietxP;ipEtH^l z*GI;mY33tpVp|AQFmttW@qd$sY~;@HdX70&>(b2&XmOt?@oaJv!xq3y@5Td+3z?oI zLMn0)nC9C)H_H?bh&lq{zYI<#$|o64{NNrfOMPeYkq)HG0aA&h0RvOm*;D3C39#+J zN9BHG>+zWW`vt0M4mBidKRyrjv)MQmm-Lu3FsOc@VqYzOJAkZ>h4x0kvm-><3Hj-7 zBm;3P^jan=x7;Fhe+|N+2S@{NA#ebt3sBDs%5MA;St?7^e+??t9Wjr^a4%;0a$gRa zug)a=oAS)TyTWI`ROM2#V@?uYtN`MdnFN%A;=xUu)IC3o=;rG_Os6y|OdceA;!Lm& zPu!*O$044U6~E{&S{oWwY=b;t<0mIML5l-u<7;e|LtWJ4GI;~4=aQw{w1j)vojNpN z-TMb}Q^i?G4Vkibua;!Lp%p%T;AFV>yzG;9lu_j(+n}Zmj$xs!&5Gcyp`vx zAMtC3Y(fvQdiwgvvt29F=;RxukX)hscQv1<4wo9VMT)+LkOLV=A~gDL(rM~_7+nm< zuX4u&Z^QLL6$aXRMWfM}%2J+PdpA!~Lng5ligd#S#%Z%(TSajL)dbQMDTBfkx@N|U z*+J)C+BBOA%pnOdR(WB4_aWZZph+W;`#iJDcd!#5r&_MnrvuP?<>Djl!ioNvLH{hs z!)3>Q@uVN23;B}WbRm=J752m_u#WQfx@Z}JHi(pexzVJ=fpvvqx~lOq0xe;D@yC@P z=w`$&o4(=4So2dJpBdk=N?|rG1D`d2xR>+VGm1#aKg##}$?Z2e{9?YR-Gm{s$|e$S zEAsIW_4KNqtv7=LmFSj76RV|L%WEDW)tI~GUbJTjGM6GnnaqCWC;7-sGjEQLFATkl zaMY2ZXW69>(|Bd3xUhV}X!N&(e|Jonhp5XmB*SwD(tUV#LwZ)%WbW*-x1w1UA)2*; z_aKjWkmTb8`|Iy)4uwMhWD}JqN8_deF-WucgP*<4l~Ht)s)t~bmmf@)Qy*v&YWo8T z?N2;N*<_6oOCla!V2oo=2>I?-v)yLGJUua}9mbH*)iGE%|MlSe+4}AK|7I^jJp0Ya z+_^p2wz>TQJhwF0LKN~aU}L&KKG&UzyhkJWC#B7YVYsjGSKS{XCC45YeF9F*&u{?;gW#Ez`MEx8;>x=#8?!q`I4tPkrUu9x z@{75e-mIzq`DGNqk!17C#qVxNAG~)@Xi9-N+=|qPw^t>P_Y*d7nyXflo*LhO7(G!V<5O5=_W!-YGW#sD z(o0)i9)yT44*`#GP<~S5yiyM}<670I`Xs3aD=l;ngD8$PUV z-_y#DToWq&!{%SfD@3p&(zD$v>RH;iZ0&^70TJB!?*@ou0wO*UgG+&uUEl zAryF!=Jh1iVzQMo)CCPNvJRfm&r3E>b<)$AU}uQ*PJN8O!o@4A43Qw83k%ttdOO`i zzkToGkf2;<)R$b1O~=ZGivr)Coq)?WvF^D8E&=`?4^FgH5uU9bn;!oGwtsAWw>i%> zJrh<*?;*FyBvFp9;7clG2yCBIi|OK9R&Zk5uF z;<<;*Li*yFCR+iRy5$LLe$qW<=qJv6lc^tCASL=o?UD(}G!|9(2k0;L8ce;q*y6A= zUM9zH-@AH;#n4~(CfGX2dN2W1J);|@cs})F^0{!*0N8=$@spYaiGv%27l*L%);Zcz zO$U3E)B)U7dh_QlU(=HVigeGf)@vo73dLdZAm{UcC~!B9!AYe(v`Fd|&0EGXO3kQp z$67?`R^2#!HL>F$90eI!lyV0Dt5QdjJHveT_C-^~auLORdm*0{ncjhq)HCp^sQcBS zIMhwJ;_L&4`J2It5Z+2zV zkcIXE3XYS*gCCYKPqc-Q7jjzS+hhyV0ta1t=z%5tyhf?CYk~`E{t^**I5;eTH)w@? zw4p}t@EeO2p^FbfM$!97HByxCC)jnejoKkMJT_cj1M9wC$&qd-gwzy)eHnElP{&`K zAoU)9{47aO0VNih@>AZhS{%3rxc@>8 zWqXAvh$ntIEQskuqt9+U2I;ax{OF=|+^s6aP_r;>v#LOhwru}XU+7DAiF487yn8BA zQr2ZjN=Zs+;eu2rwfGaS53&&yU$G~KBExdYN~k0GwcqX`&3&+^(5`X7VpZ#IZ4yMw zH##6dJ@M_vGpX-Tw>9W7sZk~l0$x%Bz5s0)MGrb1U4@Nkt)}_=(#54~DOs?SsgyA$ zefC99#LVC-_&DT9?m+G=a!$P7#5wukCwdOU@x%;8YxFCb^$2Htwg-ePkGqFuRiM^( zb4v0XlD|t-Ms4Nq8*5Mo6>H9-gmW0s%u8kG*P|0X2UlD3MjjY++pJ<#Xt}J%PQDp- zTUwmo+ab{9l-Mdsd3DU&E%jbE*A3Tekm)NnS~%N>qh31!RdT-XT(r%(CniubL$X0~ z8nUl$5_-{+4eqW$XiUX)77ozll9B1duLqDi>7tQ9&gm3YV+ZeanRm~boW_#gMY}rg zPN+K<%6cT)M{vLu4Pgu)>Qpi-VcWpQ3_5f0EQ|h1h#< z8yxi0cUBl85XU0fn-zFzQBiMWCa*M*{t41S`&;wTiX$^;pqKta5T-u_0o3Aw1iv74 z$Pb)QIc~;bf<2amV)7C!!aAOySf)J8A%jy$mVk$yPA*vWm+0tAmI2S6r3gg)p3N#D z9Gt&`o%<=61PIN(#2NM_Iu2=n`x^Jrwb`^X5+L5~b>X~9K`a1T?x3&KW+cb>1O?p@ zBdNh*p7w{_1G^t&LPFZlg`jZbHIamJpcchOAfnWbOmA^ud9OquUevKaZ;D3926PQR zM1^PM!gMC9r>H~!DiER20si+qEpV%cdP)zzR&5u=CP|(-88c~tqt)m62-oc?>r37C zn#J$UzJl(*buQrAfeO5T&y`Znw_k{!vwp@#Y9MUZA-Xx;wgkaJt|or9#>SxE*U@;{lZU~)EZZ%$)OjR;Ej^K(A@$g_P4*} za>)=o?5Ydk7b<3d>!%j=ubq>c4v*8)ogd#2fqEFCxSV^woCW(J6Wt^K7cjkgBftwtK!k|>rRuStn zB}zh;C*`g_TKHdV(#GDFmg?4Gd3%x9ejLGl%qF!qyKR;2IsD)?OS}jry0R6SxzXz> zbXA;@{Ku$QA<5UpTQoQ| zdZZT3veu&~AweGp{vNq($JHnUYe9_9H6Te#M8xq*X4(=>9t^ zuMUfRr}gpd*asS32|xd!pv?pv28N?EoJ_yQ0PkJyc}Zx3;wkgHQUpBIi3P6z?f@jI21iUrmKP^S)E09GO;WLkEq*99c+P?zynH5BJ!ej9Q89C&p0+ zK2caUA%F^((0JWThibADCl$3mq?VkccOS`G68~i|ZQIx@u9mWi0^bMt+@^Zs#3~A0Gb@UW#`$)y zK@#=7*-YETRN{S8#m=3Y1=@4;9S;SWf*5X;=sMGW-*;*AaCy;*ga;K@FkUuwM$??E zdG3cc;0prlcBVGiAQhLwv~^|u`v;4%fr6CvY=QzDC}iS1j?D3K zH@-f#uY`b+H=bu*A29VgAYERhP>JrD;|zc#z`ApBtD8d5_&SsIfO;^APbFg^gY=WL zrCJ6Cc4<7l&bl1A97vW2|QE;`1S7i}Bh#|xG z#T7%e#Q-8mE?GZ{7kqsF-8ARJ24pOAm?%VyqYjN>(uCZrw$M-$T2kw*Z4g9UmfCBn zD!~g%YbUm6Ca^zU6V~Z!vTcIoKsOj+;8>4xt|BI|=$o~CPv?0=CpQ31_i1qKmB#~m z19l&0Nv|x?X1$Gx>$54uoF{dM@M)GP|QC4exWlZqx!(p(hc&gXx;_~qO+q41| z-obniR7I6F_bIJ$hlSUYhpK${9}zvW`}KuPf&4sEm6W?=#s$CCrtiwI=A7)+_1F2| z@hXLc_|qlvthP#N*j3q{hLJvZ3U+^YKtI`9etaL^bl%GUMe;o88>`Q@3Dt`E0d z)yJSv-+E>6PQ;N%n==NRPXqq7`mx|}LLG?nnZ8=zP64l#oR#X5k~f;Ca=B&h53b-G zS9?O|+Au*n7n^lis~Be}EXX80>47ty=iwfwUKRc5uPvl$2kIj!)*Xl)wZV-yhXO&` z<;k-mL{9&ly5ed}zv4t|rrep24v)uRn7!ZMjzuhw@F7`@TjKARRWW!2FL6-F+U(nG z!6E2vGefhwbLW+q=NKP1<`GqVR;BCsXm2PDAcYI7hwU_LbfvLN8wrZ6;| z5}uCBU;iA#xAJ{pYkP4HEBR0$K{w!t`Wcwej0=cCoP*ep+1J2|%E_CPU(b-e;n2WI z{C6l%B&3Gz&8EipFN4zfibty=&B_5|-i2pAJ`Mp8G_a{87#V$}2ECSLw9=8&9lgZU zBbk`+bJLKs^XXzQh(m^$5M>Z`v!GmHI5lGhaSA!kai+ zlO>|q{NB{RLrlX0d!PW-zrg@>^SiU*X5AbFh@>TcRn9eCRF^n99PoytehS{53n)eA zn|su5x!Yi>$$eiKheh-OU|o`+^WjuJCmmk15o4O<;p8TFv*%eN+GFer1*@8feF+6j z<6Snt`GUz%Ka-<9q?L~nx$^L9_*S6qqt|m^uChTPF~NcSn!-tG(5`24QM*{#@|Pu{ z$Y0_vXy@}QOQM3)z5C!l?%>fykwFDMGs8V|z&+p0TKC6gV({bl0O_M3=Rwb2Apswg zZ()Mxf15Q#(?26p17D*9z{sIkpK)$|Pm0*~6z~-)5g?c|G>{BF;EITL74Xe1gG@x~ z+-z-N|I&Q9rKX3D%le56T?yV3m9`P3l)kRO-Vw~!wOrYFt`|ikT`oM_&3H+=ij47HMPXc&MZa_$=zl|=+F74dsTuc4JlotW9Z0F&N;p5^$KRSf5ltwCE9T`monSpAPGb7O96g4 zAH}+Zv^s=UvzI{kQn@MH*OntdcU(`ByT(bEQ21}ab!04Z&lh_>Rn^z2$gnsoLgmph z+xF3x09bG6>UFDyp8XhP&#E4YL-i-q52k|0TP`9~$J{8BKXZ%9e}(X$4*XbfDK{)N z<*?TvCU(5v-lulQkGz=x#m`wZex2kkO&~ZC!TS^NcH5ADpgZ~LvaT{BwVQB^qwl$j z)Arj{85P2$;<+pZkdfayLABaP`MOlXsD~ilDuvJq% z=f_!x)6I<$a|{O-W9y7)mh-p19)XM&W#K`L9~iwmiDW`Q2ic2FZ~b_S8n}d2-EDI7 zmcbDTOEG(z`h#QGrpQn>2Kn2EXxZN=j)Z3uJWMQdsw#L7rKhC^l+-6r8nElI3s06x zbu~mmO3*y{3_~zbOi3X_r0NNMKkyR%3%uQi1Z=vWB@$%GrJM|Wu9AVbL(zbeMdCr| zFx$MBh(LuVcpD#&1pzr69lu~k-r*il*aP0Cr`AV6C&H&!uFqJ67iYrt((cYr`t){; z50yYx2|eu3IC=~J=^0y8++F-1Sr8-==+<>*np<4&$Fd*Ubn@M#@x1=MK5jP{!8It8+!dU44>at zRWL%gZX~#VZ)BmWg@%Mt0rlTxUnEri{_*2H+#$je@|<4ZYW#4Q+7?ENF)9@npAI+V zAlv-9P(+iidRYes2FB)!!g=>xL$J~}i!Ty#bg1K@V5Z!mP{(gs*ZJ{76I!!@fE^1W zWT6+9Ck~3=2d=jV_1ROO_l^xTII>{Og}xK*MTWX>e#DK`9aFKvFe+T4eW}f0kvVP~a^Lwknce_y>WvEo)H+dW zT&YMet(<4Bd2sxh!VREej6e4O2Z6WaWuQPA7JB78SJAe+ie5nbGX$uI z0>ElJIP|Uv*B!*<;bAd}iEjoK`hOlGdlVW>n}L7l0vy-IC~?(j*wsqhMq35m-j7kr zNG*KsH*`f@qep(kdtgp$4Uk!hW&xyFwT+47HexliERXKHJ8VWn3dM3&p7((MF~?Q~kasRM>^ka#huz;9z1b93v@6<~kU?6i(AbafQ>5<< zw2ahHb`<_@k#Nt$K+$FU?7TL=+pTESi=yo^NLwDKEEcZ}@A3={0m_qbuD5lDv}MPS zc0xw0pEkPUeWjg-ZsF%zw`JkQj&qZ) z0$$nStH;DQ^)~tL4TO)Yiy+TWTIpBONDw%?tv4sIEn#Vp3gpdflYyG-SJY-IQGZcr z^Xaj*8mPx*)M^%o55YRlep9OY*c5r1Hm9N{OlxS^`aG60i_PUEFNQ?9^L}+6Fu}HI zZ5p%de^v|w5Qu=F--E8MCnB|cQ1*0MRVyL!nc>kigJ^*gmr|u+!K?nOfpWIo@{s`E z>OQ`Li=C>chq^VWJ4acIoUu|icP#lkItiML-YHUfS7vExtq8Hghc(^x( z#+;G;D?7l)SbLWScz0^JKJ+3h(fD!5xdmTrXGCG@QB#2uOD6q@-T6^9F6=4-6#I6Z zusoF5EB~Vmb#E(4LHO-oi3+u0ni)Rp@!pUydWu{4c)SX$p`NN(2r&fg%e(L_<`w#x z=fq8V;&gGMc42wERH9-EJFKGiiQF^CY1M&qryRP57nzo7;rxFTu!@ZyM~Tp1WX1K$ zd-34kzffE+_jR(IA&-vtJ{tIx$0jN<;~?7kcc`hRJ|`mElx8*8KL%-OVy%bkH=ZaE zS3U+duavb9^ieoiVYbT z1z3x!gpaqpMxl%C=M~@TDIoe=hCdvFJ#bh^u09ej=H$AlaVz*&J4Tb)mGaYJz&Rdg{L(>Ua@=Q;f8Ev|~K^M~4vHl?b1M?uh7MBa$p!A>-h!pxJU zLYY>$=}#=&0Y?LVhs$5p{j=Fs51;=SGMdxLxcdu`J+q@JGn9ZA0r_%ocOBM_ta`wzU@=WlTSpt#;( z)Y?=OihEIh$K_^5LN?LRjV&S5(|5+S(Wv8ncS&`Fw_vK}aS?OFjh(nadcl_=^p4J~ z&?zJgdPKl9(c=t=cJ2n$aHqRo<=tt64FDCJnRvO-d3Ml958&prqM!g|Upz(xgxktr zKnbA#Y{4rs{qtK13N-(FJuaX;n2$d)P#i4$S`&TTl`#|EM(z1JrU)e+zoG(0@CnVG z>GQ+OiUE5I!2i4D@qeNW@Al-mzQB7xj`?Wp#j-IaC>AMvDN@;4ROYfF{Cre-Y8b0M zw+Jv-nDaC`01~FT~u}3fGuN)OK^3i|3lJ@ic(?R0w7AP|~a1L58FVb7EezW3>T`9*>GMa$NAf%iD5y|pq}VJN#7J}N1)no}}U)Ut+x*vebV zu#=POrh$edHoVLd>K#>@`OT;jDFvurXreZ4-sO3UR@Ne^;;_-!a-~bWK736DEpFK~ z$%SzHE;F^jnWC(B{pZuO{)l}H&6M~DT=8y#{~v8%9ah!z^}ElZ8zhyIMp}@P5|EOV z?h;8U={^P`jihuaAl+R@B&56R0MgwJccb5UfA4#r`^UY{^?C5@y=G?3nl)>E_I~!v ztaY#MWNgS{eWOoFVb+MkYjtk8!TC7xC1fM46GPiPvA65gU+>FPa`4dA6FC%btIf$@ zODzW%?e?Kr2~?G0;D;o4tCP(=FI8(woqdY7cJ zB1)l}(mPC4TAnfF;CYNEw&oV-Sy$#q4F$`Mif?62rL`-_{hgIJs+mH(GqToe2Fsv?!X3A zh<0-Od42>x0b_Q zUx~wS50e<)*`2_s89w~-*ypnCo5J-$%Tmsgd_TBL!+*y5I-8(o=I|ZC?k|hJr;3SP zo$D=2MKYSC4trZ)^33r=(OIbwB^ZUtK`SlAO`1%p_SRLn93QctP!{faJZYMv-%{9W93)hDw zJKZ=P!en)BVvcHObv-t+M<*$vVY7xw31mjTI97a)Wxsg8?q$IGqA^booK`S?tCINh ziBrrz-;!T_A<8D@U4vNzfg!JWtp~ih^~sA^{6R%0EDxN2-AHm!{^F~;-Omo>hw0vN zKv6#x^Pp;SFeK2vJyesIfug_GWXgN>{ikj+3MgJ$o4m0EcoOIT!^s>vV-P_8J;(z` zC3Qd;+tAIU!HyQ=N)=vwBokM}9KW|M4f=Z6rE2U%L+CBVJsdo%4rt57mUYhue_!R0 z`ye?#`%%`(?N!wv%D&2zN@Kjg0NH=@Y|#&T0zcPx1Co zunmsVat~+e)_x=edBKkG9gK=TmPU5i861y}`A|&ftiSp+Pj~*FN~kzMKzs|+eIs$8 z-X&DKER4@oSs~DU%(A{Jk=pB7S$Eol*PPprpt0Id@97ng=&gS^w4ah3ZQS~3Tow^8 z4sUu5Mp`czZ8WE}ZAtljXOD5Vm2GI$ngtOh4X-SORdqdaR!Nw05%HFVQvUd88^yKQ zZQHEVZX{-dtZ>XQtFY!nT5Ma9lX4aL${NeLyt8-r4csBToKb51ZTnZIpb0+Li4F6a zkj`43NGH`!m!9lr4hA#aU})HLv2yNO#c7v@0*QJ)^ZdK~c~dXB3t8NBdwW`r=JQ2u z88>RTLuT~{ezaXl?@i}Nxe;(-1U(?wxkp@lS;I44YY@Vt(;l+ITM2ZwF!!deuzD}J{NZ6*We+XF!anGw|jR`HIiDX@cOH7O`x=TQq;U&6w0US?TLn64$y z%4gBRut;x^(~xOl5O|Pg5ht(Djc4s}aFu+YiVFjirdVL%$_^#JUq=zcy-h344`o8V z;w6J_tOU81R?pop6JzM(tT`Gvuo!`B|JUH4OrNzRwu&oa2`rhZPku^rway)Uj%B+r z+b~y8sI`QWf0A2YgIu7g3HM+k?=$3I zaMdZxS!tz9tFKVd_L#Lj-bon3stmu&B%)Q%^Gc|QmkY`$PGFz)9%jOWu00l68Ko7Y z317?fg4d|)+HmJ3nzQ&ujob4OIy9_g9dRyEH)B?xIj^&J{HjQ=fEn0pZ!LLyau|{s z)L8v3{P$(494#@8k;|UMCDq7-7Tx31*k-Guu;NUIAPG1AOJ#??2xOrkh14o8{fuM_#ormG}P>h_4LSQR_ z{qL|9e>3K=#K6oA}P5ypm#h zTp;%TEg13QFO7`p!+Qw)yy9gKa-p-8Mcuto0|=8(bT}nGO$2M?K{$T-Qvn4e47{Ch zEc4Sln@~sE+51iX6Z6Q+cSmT9?+~fc&a&Bss^ph@l66b8##@=HXPCswfusUR47@f10G5wT#opNeK2}<*jVWDSX^!-;} zir61GB^-L2D*3#%(IW*7CL3wkyshUwvDg944XmZEe)$jB248ILU1;mZ`TU-oqg6gVFHCcz<;+Y)fMAODqc_ticz|keEZwju^z$#u^t} zk1=cyf!*95FUrbwG4W2GNE!dCB&!0w_al|)c|B~KSrAo@Xb5?zC4Oxj55Zqe*wmGL zIMlG{_RjB_o}QlPrpU^%#~o!yy2J_+roM2L!P(lUBL0JkmrjJKKefHp0Ky_dltgYl z-weA60x)BVyWc8cOhzOj(ePZC)y|C6;mzmK(-?mX2lE`0Q9r=e9>Z1RE# z!YgjThoVC*xy_JBu!9PIuL|!3<_63b#30+ZQ`Id5{=#KY%hphdYg1d_i^gf*!8D$W z4iL|=7x&AsYl8(AbiJw(a|XDuF=^6gWeeZ?H#%QDqJxiUu1zn`y`2?B+SOmPD2l$Q zSMzq2qWY-$jk?=8*-S=bYLE)9?(~ic>}d;C_ZYB#rFI-@!|4ZnR<47h&7BD%mZJH$ zJ8g9v?NrZJU?%~%zz1;}Fk3^1!4s?(8R)H?Tt0(cMr^-=dnVSxef0XTvr&K_X)5;b zk%1dpAhqR}6_9FLsxg+uSd0wDt>6efWtnKY9P1+V2l4A7meUB`CGskAnW+Al~wHN(SDaddGh+(Nh+E# zs(6#a-+BOry`2FV?3ao?Kn4W^A*^Eu`_vmNPTnxs@J)*OT;Us5N- z%*>hrjI&=HmX(n0U+fhY<_(<_z;7-!`o+QvtSrd>Vc4hl0-VGvW<8SZj9d1h=#FjCISnv9|fpX4sn<=87>LMPQt*Y^lF9?A1vy z#Czk;QS^+#=l7P6Ch-1qiaI<^W3NG0Ve9&?qc%JZ-MG#E``C#KJozgOmkkJ%GMhDH? zpy7JmUc64SW4N{E+tXfIrI8+A1Q+f*C_dUf)s(#WSPEiI=Vr^x6Nolft z&YM=76T(8IGs*UM14$4U8_pf=*7#+BD)c~E7_vLvMM_>Ffp&QZj`0|A!YrhSp_#c2 z2_DLF(6!EsrWsbh<&DzH^Z}c~^gm*gnfag3z2L3tvYS3CwHHHi(4v%f zO|5A7wRelK&o?+sHJeK9a9DA-Ax$!kI`L?kjVL}{V;#n-*4guEb@Lmlb8lT&h!5V( z^P7AJeSbalS5W5;gnD>K%;@Sv!RWnC$w){wze*O4P%eg@{rKzqy2)IDumBse}8G5s$n{(bXKLRJ>{2o*+i%kd)Pzag%; zU(zjB{)R{N|Avl#asN+rM1{>ae&d&b!f4QcKNG-#NoF(HtcaC8jsNr90|A*D&$!}b z;;!=|={^_$<#EJkPO(Sz5ZqfJmXH9;{gC0(_9vcF{7j$6cxI6u>ikR{#t{p1{ThmL z-n1%|Yo~Tqjj=cV6l)J)40XE}5t+w3!$@6O>y0j$8LdUvC@UK8l>O>UtknEmG)gS9 zAK@D5MY-2IYS0?qK1)35=z;3;ul&Gt&X!@(s|5khs(cq$F>0m7?38+nvKjJtW(}`b z#{Kn#CB2usc6dAM7L zv!I2c*SXq9PcgS)zVhenie^$jl=OdQG!`2M$9RdMv2JxdiJF~x$n#z zBk^iwVAxU5F4ZP}thArzd-Nt#uf1FmVm$SVDR3=uCZs+iuM#Ksa}xoK)QQ$F5@}?< zP`m$1nv0~pA>DmK@Taq6WXC%~$~8t3i+kR2r{IIc`CB8w?x!bTDZ1KqQgT!tNgg(H z`==1E-eVVe>6+S8CD6OCAH-}HVJ^P_<7)}f;2{Y(eN}(^Ts@MO1svo6t(AnV$a^>9ju+sDUaV0`^q7$+~W;0`Q1Ot>V)1^!~A{Tc5!`w}7EXL;$2Kd02~ z>)uhqVl*D1pV(yH)6k`>h>9E{A;&9yP+Mj`PdT6hOS2kffEe4Bk1j*uzG^7}0l4mh zkvR=C+&3o|KsB8bODRREsk*0K=%Ig7wPKL%0~`A|o&j~-^5`)mLkWBxn-R7WS<24E z-t=>f9cfBO@0PQ6lh_qcwn?9e(j3Y3y69}%dxC@0#9x+o1-f{agf@RMNuQaDr@+?LfTmpAJ~E zy&JV=t_jfyKb!IFJhadKN^k3?Rag5s$4G065qF~cFt-8S7+Yo4{t*VmTj%goDw$$c6yX{z}2p%15_=(HUmm7z?FdeP_ke8JP z>=9>jCT!c1_)of~b1{2e`Uw)q5}yRa;XB*7dl%V6(KmDFq)da2+o=&$j;#G)sm z1#pT2xxucSdI4MXO#g0!nOVZjc|zG2{txJXIC5rFuuEu8Ta?X@P4G%zG9o8cn{z_R zkciI76(smLCH*4;fX%auWpkyjU;E-@5dD6EJ4nyajTo3O5>>?nmR)W;u%>;0rQH@OmCBXLqOjyMKvNZSn6^i}&;ou9o?Z#yHrqRe4%ycz@ zATPm0h*Ne+;8&?nHJ&C>K_+wG-=?*k2YU*pLdp`mu!Pn>LdZO8{>wQ0DB$nFHw_z7 zh<=ATTwcal7HEDy*nuOJ0=2n3(iJ*96N3MfrjIwC0k(YD9e(U=|o-9GIW$KHu_id+xp-J z>e!C28=n|YA8s=+aVov2*==4b1X@DMi_hn5vipVG4^ey}by^d+5FkpHg`IvZ^cR+RrBAM7Inb-;oA*Z!k%ZTwg zdig?Cfb+C}q*^GR%oiIGN=bhLqXT3rBofgL3=VT!UL#FXV<^RG)+%`u@%W@bwbflO zskne~XxriCYG)gMGT&x;h);Z$$9B z-=yvGhq7=z>>ns-nYUW~Nu38Fj5a{tW6D#SD&FM2cd3 zIv($Xwv*7)Q7Od?tt~0w1x&*4iyS&4Tn_$rd#u5^3ZX2%qYMbgQ5+Lji=1%yVBUMX z=ef>ug=5JX*c9FEktI{Y33;&PoA==32eu6fY~zKWL((Mh=eF&I_)V-2^B6jq+zWJ8a zz*T-w3|c{3%3QMjPaOHX~D1WCu{uxhwlUTV;|xyVKa;r-jUKpWuCnBL^*z|4FLbLhwv6zAlSkhfs9zb4R_i0HPvM;K@U*V4e3 z`!E7Hna=>o07`~}a;p->=I`lEH{=q}RYVo>;bdw3^oRVoxVJn&-cR6QApv;u)%YKo ze=`BCUrs>akRN0M2?5$xgRiBd@Zo=iu)Kqddv!Ght@dt^vv^xA3DChD9Y6qHySWPw zx}JBauMo=`d(|Xb8SR}I69AT{#<`66oW6x%zJa}y^t&k!E0l_#48N+YaYJ(F_vD0O zdA=DO*zPgU*3e@*7c{I#-8GBo@sz1Bic$4Xe`WYOL(GS#&R%O~J9F!e>S7N|Uvx|} zipEtBap;IkUIlg82_wKZp78CE>j@3MgTv}h>d3$dGY{Jp1z>Y=0v+c(kKV4}PfXTi zK;U2&LG)K&Lhg_?vA`N)o1EN8`G8r9i54oN=vn{5fOq^W5{9Q&^5dy4v$-DJm`+an zlE<^iFgG;`Hc})aCIa# zhb*kDe9TNyyPO0ry!uAyK6Df6M2^_Ft8Uc4?>_#BP5v(Prk8TbXPt=qcyL;}Qz=OI z^u(f$uehTkv+z+aADdIP-~1~#MJCBH(Wp;_+0h*OhWT4Fc25Z7!i)zYpXSRWj$hN_ z4u{7M%)WVmC%NvTcO0eMWnk6jddZJx#hFd}=F1jw6aUS9jr5Xyg`V#^UiMIUrYKEJ z#>cpd$7z^$IL>8dOcT8SXlGpljH`r7lQOxX6pXm$fp7G0CRs`%V0{by*XEc}sO{xjFCLTL ze2Lfc3y2q+?e5M?6+7_zWnoy4{}L5uDvk?HOhwPEe8T#kZS1{za*(?pG2HJa>QfVs zP%zN)ng2O>Wi=r z(cpN;qpxzD*?ozmG_2b^7J5ha-mfR>e+2Rz&#Iv6&o8wvz5s)yqMYUhVX}COh-Ebg zwSRU0nX@zrhRgJb%eJ07u(nnePRh+`=jZ%R-k_-#epV@mhA*Qu5_aZ0^7V6qm%=@Y z1HNx^dk&rzPRCSH3pClTZBZZ-0S$Sd$mbU+iOos6%Xil6%nh&D&96^6Eex;9zJv!`O!P^i?J}@q`DU&%bT8QW{Oda&dja-5LX&j z0-)Ue3P?a{9zJXNj8crgJkhQ(>fq);;*ePvB-E&}%&&<1=IdHi#0sVJ5Q=)^j?1|Z zb6hBDF?tZ~i|p505|txOk$pKAzY>A#F)Z8Ua<-yKFAT(+1Ur0)yCv!y9bXLNo5$!- z<*cmrwKj8Y|7$+jlC?p0dK6psP#ghFCT_iF+4Qjm65{K%4Fs_Uh4*+~h3nFN!7$qJ zIU_Ef#n7bIFDLEX@^325RW7J{oYGW>k{?%08b^AL&>ncoDolpOqTw&tEIpZo;YwGe4FG9aZ*yeS5a@+@F(_rmAbC!?n2cADc?s?tUN zp~DJDr_TytQM7CoPx*>QfA|o%1?-?Y6nt&w{{qRU^V$xP;a;AV0SfuQXw?G_MMNSB zOqH7OI$+yQ6P`}NC)snq0m{ek6@J$b2NB$Z>0YY?A$4N+d2Tm)mQe+@5n}hNAUO^o zfXz$~&NYfE3(I!uEIGR2jYqvE$scVtS$DLudVL?Ol9Sxpwl3+V8=f{nrDKyWR`^>> z6#c}m_L6**bT(EvhsDIF>uw@qwQ5afs`CNI)G@=n6E$Fb*IK&Qa}4iAcu1rrZWEsP z+2fams$uhPEr`j$y2|Rk+P!qn%{Qibf&{*6p&rc+E|}+HoXX+>{_3>O?8#%>PF1d3 z&OM3!oE`7ABKT*WH-$JM`m!Su?Qv(SZe?iTh}}gnGq>8a#wtG7%_3wRXlDk&P>9C+<|?-5~qWlmA>Y!ejs=JH@|ttdM?yZU;=&PF3%HnGnD z2Vpu=uPkIDp~xS#n5+Aick&#%#tsB{B8?}Bbz-p=uY~p#&$@LRD4X%^X6H7aowHb0 zKzp6v>K{pq5tHm7an{u<@@Z)!RrlvxY;+LAypCFHMhu?@erz_{7e!33iy}Vj4QNG) ziMc^XW}D~2X5o}^?>cRaV39g=Xu>rkaiK+QM2{AoPA?kX~RwKa~f#wv1DC;3=T2q~4HG^wu|Xwhv+q#k}87;d?V1m?46Q z@xJM=V&^_yo7;IGXwOpN)?3o}xW1a*JtLLdXjAnAXD>rQLrYgt!FUbF&jIqtsDm?> z{FMUvaHf-;>%x*Ozu}pmQ*#rJVuHH{1L@De#VSKU;mPwmzJ6W+b)iP_^`K(!Xh36p zX`)e)ZJFBIFTXt@#10MVm?A=nq#4vw|?;DE&E{OkJH1cg~4`d>S0SaFvV`MP( z$N!eN7W^MI>253b%=3evGQjjD5GlD+MJM#X^^5eI_Al!vX@Zxi@Y@_ZP%u#|1^_n3 zV1AbIH*t{kKZsyz9wcK>>Sxf~Y#-2|$lb(c{96hCVsqO|(;oRBF0dy~r#Qb;_#hMc zs@(x@^ZKYnKmD8dmGeJ{VBR29_@jV-M>5afLvt(4Uu=Hs;lI(q7XJ^d7i*&941~)$ zI61erAb+ec)iPu8OFI=D#n}+B8`o-0t3Ew)HGNnk^5lT?Sb@~&6C|AfVYgMjs-!mIcts?S!_ zt+ev%{!51<14HF6q&R8vP3kvZKAqw9Ou47%CROCgiyqkzNydT+-KE*LJIvv68{*W_ zLt4KXbnLu7l{$Y(=+hPtnpjiLoZMCW3}j$Pli5zExlXk2^0xIivX5~{`S{wOK!dtj2%HU~Y9QQHrvs`w7di{3t@%!dc|ya+?w}`k zVY+`d*s7zqks#_W_**&F86pE;#+nOEkd38&`RWV2p_x=|*jFNA;4N1Cwqpp_Z7HnzUoQuZ`w#K3^*@OJgAE7`AR8b{@L#>%f*_b>=zn71KWO&{ z82^Gm3n=1^&|ipa#pKCqxd|bAGKUK{Lff}( z4oF1|?=_UP60F~r>#XNKZ(<11SFwUa50e2lfa?~bM6aIarCCjuWW?c*a?KubXKazx zl>XyxaNswl-MTUaaU6=zF0ZXavtM{B=CwjPq@M6$Z)_s;hatSR=8Tb27Ryfo|N)2I{A2ml7KjeK%GeBMy>b0m}eV30>y2D+P``c5_7MeEC7xauR zp+DB{0L5=zhjI+}vR|EKrt@>8!$$m~%PU_s?1XHCVSX%+! z-Fds8PRL{^D61$e(M^`Lc+7_UexiVIZT8!5wZYzR)GV>QS-{g?WPl3EYu1D`rpdt} zaSp#>i=w=5g3rXoC|&l*6FyKF6r37AybZr?tcBcN|K>@=&!u%NsgLWP){{O&cE9)q znrR&M9|5V6V3oA#>U-MPr3Gm1h7gc1&`EFX4BR&c0Olsx9zXx@9e%(QIJn^u{0AX5 z-8dOuBSlTRI6TOL&2)X#{^}yDsA`cn)5C^B;9|o^D6Yrwu+hwxk2pA5tSsqkntd5B zF-pxN#RKNGDOuJ2Dt&rzRSo=0ERaKW*$=QeM|$~otr06q;l!X^HuD4rK-PyIr^8Bg zt%?S;Sg(2pf|h-0t1Ms-;@kp-h!eJE;iui_yW)#t3 zvL4xnPu&U5xxq7VBt(a{$T_Rvgbh?(&UYWr%y5klv-pzfl%M^XDl)TNd*D9ej*%zY zxwc_qdHYa-{kz=t=bzNavzZEd8GN4IeCT8e-4_ zHhjA7-&z81pZzDZO8aCuAofWral4MW80Oi=r99wpN%$qG>_r)&a+fe4t zA{dL4wxc_?qDLHZH5jJ0;I3B%yAYXa^iE`9iDR|luy}tLDP#jYp}n2 z`}_O4(w>o9xAlgQKA3OD?Rn%xWAIyrBhcPnEi`cY85w!N-dT{qQEo-t;`j+}{x$^tYgR@nNy@5J+BonMZjCBQs(zKa-$cwhGw^kapar%)t(My{`wQqAv-uILB?Jll{mY*v|Du7Ee|-G5 zIQ1Ls3o{9LF&?&Bh(5k-{O$J*=5p~?5KOE}iWLHu6{9?FU#X)r1}}k4^jq)%e#iU= z_Z|Q4_Ad!OfG7jpZk7JKSVal4sGJ1e0zytq|7X$QxO-=!ceW-rE?!`ME~uWdkoS0U zE<1ij(c}U)ZxYhb@T&38%f0>#RT3R4Kgbj|zI+>7{bBAg*wpOvr~TNwU;Vg@ZWV@`@WZ%lr^DoD=Pd3Y0uPc zI}4`cDY*CTq$GCozS6xqC&4fJaGvlNoMn?oCile7+ecT?lgXI=<;}oFj#)lqjC$``=sbd=*+jhk>7MYPfpkX9E0}!VmtHm z!^L(35(lnYQ3#d=W2z%wY0ReO<`TWZpn$T~<-D%xo?;T#>6M?%i-3SY^SIGF;Vlo< z%H%J@NY8#~mMS^Mm0;bF&9Wg5e^iW5IZ41v95jWQ8-y#K2%kR?ISpB^AfHl#ul=N# zzqx}O;I{}A5PP(YDZAZ-W#fV(u&QgEeLUVi7uQaoT+PDxoVbVD6VCA=PPz!MFC|H~ zq2aTkQa!fCZ8XmcsT1GD5frglz+y$3F{WIihuTPF~#lCTCRu48hflRW=vWrFfC34N)4kOf(FT>%+Cy*A82jy0@-_#TZtqxmJ?-na^Ha zM3p$HDObl9VGq4)>d(S(U+x{IC+A^A*zElpX&Fj_9SykoUiiS*WIv3TOs~Y7Ytqe< zUg}ZYygU+=mkF!W;_*fmTNGv8Za>6o*=M=+76tq&ADba%HywC0Jdx3u#<)aWXXsSp z1@-P$fK5Wy6;t63k`iZj%18FT^R~4i!W<*K$(GsqjS+Tg!-IJ3uv`zwoYQ`L{tnV| z8wdVw=oTYl!p*U8m~ltQr|x)j-Qm33N!NoQ)rVhr*~iYyCDxDq$Cj7Z&F=WR+Zs<) zNJDdWAm}m7yIe8y@K-~Ot0#WBUde>Jr>{51a;ar9VNpXli9Bwq_R@u~Aw$nJhe+mH zR+3HaOJZ-*25Mn0KMJuv%lzUO-!X=g=%q#7oI7=WDyy-%Or`5>n+1UT$65=oiE?aGFUIL3w<6!jL>MUthHcP~ zZ`D;|6dp;n9`=VmXe+_zwBT6n?(Ehd#EMD;%XIm`rzlW*Mmp!->LnV<90iXP5} zK1vp(5Ib%-l{hyOpm62vZoJR8VIcCe$q_j~9Gw1QiTGp43SRR9p~E`k!@Y;}+p`ys zT*XOuV?xFog}XTf{b5DJW$}Ss@q!$PUpyR$8aS_cqP#w#kVoLQA^o}Dl{usj-GAj6 z5;cz2y?jS`?R&Z7#W7*AXs<6qSL9f_UJ_ji%$W0*%%#TXOmXd}nWtad=g|LafFvdR|RaoAzzoy@3 zw)DWR_`e_Dhug2# z=*D^8(3fbyE*J_yHwDdm^NSk=qI5SmHO79L)aa1MMl+uTXrx1O|3Ep_zsxqGRij=<;3w+O& z+u7(LQy3Cjl^=SP8f(AX+ju1UYbLQ}uHG$qO)aR52(7sFjm4hnnZH1b7E4c5Ut+7( zGpCxWZ87L^jm7;3t(>Bl_HGEB z0BdRpDgXnJfG02v@Uwi`QpX2C%HThEoZ2tK- zCkSvKeiH|*XeA`Z;ik|}&t48A9-;vFh-awo&o#V2(%t8ESsn@yKt=>U(4L$7xS-@J z`*UeKE;R!FjlXwmYkm3z7nBDE$WZGY7-eZ#IJdi`2fh~vB||<m3 zMF2_%DfEUVqv$BvJn1OoBJob|-~ZJBL>gI;&fiOrDj2ZGkmfFZ|P5fR%AG z8qFZnMNsbB$xa&;gsOKvwU)dp%Cz+OCmA?Od_*#xvD8yH*}GM0>^ffkpX(_d`5u1> zFVL5N%tZ&y&nhIzXEHUW7_Y`Bc!}d8MDFD3rx2LedlVw;#=VG>=7v_yey2KNw3WRB z!$veO4^*i`Ig8M9|-qhBsR3O{;WNN5be2XKpzCo*lu zIDE3U!0>fI7fxp`3y0?g?1vMI2C-Hhnn|FNau<8wLW0aQ?uC4xxHzu>G_mvZGiwjG zokAd>cB#0!hl-Ga#BGlniVX-XKw?oij;kI)kNL#yulCzDvdN5}FQ{NY3Ah8;@C7K(NV?Bb~x@yWYLKVP0jHiZejR4i)pi%=NO8S!?PI}iA_2F^eW zy8EyYjvTlzKYHi^+IaWL+KX*b04Ra!T54^qJg3g8R;EzymQ;y+>j6(;bF0>WJo5hkwbKS* zJN#IRI$D4IStmchaWlbc+ailMyszRZC(v~Kfz%yV=H~a+x9gB z(x~5bMa*G;!>{vJMX!r3m`x@0VU8tCdDO|zhpFl&kxlGd!OK`Fl5cIF>!X0wrsIt3 zb9or(%Ia>gCMw_2!RLNg3~*5BTyNydOIP{!z}gK?2r2|sWeFncvU#zyQPhM?hD`Rv z1x*_pW;BaDqpc;zGirX@f(y>nsN*XL4?Q~Kd0~qR#ZJ2?1JC{?uFbSw_;;hzss1u7 z%9za}l1`HRGX|s7^|if1Md=UIe(xFE6rlR@leDu)f~z8S^RwcTzG0%<;d>zN@#c)_ zeZ3HB2zIoAUkPW5O}qwDR-v=`aq7Jfp!?r3ve?2sVkjzDqAx|k8p zrN+hd+!Mgh=|G}uXpxD9{~G7$F?k<%?`rW}Q{nREHN%cIR6noTZ?A9SL6cvP3=G4; zNBg+SBFX7manS+dN-{lF&X4I}{A1_DjbcGcsta-)y79XH4(XTJoR34o76(Lm7eLp$ zV%=Dl>MIX@zYHr|JG=Igt)+MZ2X^^w_x|Pv3=qL>5_6=q2$xz*o$Mc=nu!;z>iy+5ho_jviytWB@4LgJ`LSys=P*U0fMCszxa~S5Uq^&4un@i>xhb-J5WCd#f)+smIa|7Eo5{jV!4n z)c-6D!(nR|N|91lpr4JtdlbSzVtjXE;ryBJGneWn*JB-{k57Z9rU&edj2}(cRoDsH zm=e5f-qtEGfD{Hm0FKWl^i%wN7mJg}ss@XYQ6+xI4+@NIr z(pn(1?YhcWmwg&4ia$4%OyI$EmAnK5GwGXkxo6v`)b9ZNn&tz(jfJ^6yk%s@Tifle zFU@}rOGCfV!oRm(_kO694L|)N6(@8%H}3mYilz;_vUW~GS({AUaGy8vs3ocq8~%v> zxl_d?;3lr&04tP52!1+Isp-%7BdlN2g5S(EOGs`pRXU+MlI=tOBaJ&QHe*E6Te8nC zN(0fi-xu?y(N2|Y2ixq@6n-C(HO9Czh2W^Z7uynNT>O!fR)Edfpj+*eD2Zop&B-$L z_qLfD{*&oTQP+kjIlD$qx85sX!IQq0!n+PDGGZ*w$3_BQ@WeOv@@c#lNMq!93rGAG z4zkK{VfLwAv*4+i3apTCoMiQazqW8^J%iFv9@GaHdxmf9MC~*==tqsPHeP=4u}<)M zE)=|d&N^w}^V#vZJUFn+mcNA^#rVv+qb_e4`!wY|pIcM82kI`n%6(KJ{u~Y{k+2qC z_IX7umw$+dtn4VnwkALP;#*ah0eBDBpgJs);Y_~!yeU)66p9UFPlN>bwQs07Dz>vqFb_WXiJM?^U8Ys5WVRz(@W?2a%=2&q z%WWBYYF+1f{9$ttaCJqq7uj(xO@N5mTAo^6Nczxw(z{8D?GUG)E)F}h_zu+h%BLcU zdN$W|q?I+DG@a*{raWE=ryMDUTuj?liFgiU-mkjW||M*5&G`S83wgv23w$D?0HTk>M0KFm_oWFLsU%PvA zdqpAE2m5H*kCUdN59yCJ+rv(UfsM>vAU}52 zvkcf4;W#2NLqhP8!j<-LX1yEjPFpenl9f^yN^50Rp80MqUNkRrfbEFhg9heft3t#K z3+B5SK~w2Ibp-NJJ?qHg{m^U0+?0Qgb~}tX8f*dMm_Xj!^Fcvu^RSv3{(!WjvurU)1^w_>X`}8`OOB!k}ne*oQA3pzyj7#3VD`Q$wGa$cc_xy=ZCg~HmP51VZXGY{iDCh_?f+1XG#q72e zMr_zf+D1ZWSZMY&@A!c`t=Gw?Lp#aNEqngpIVbW+6kybXXn%32rZ$Df39oJ3R%A(p zE+AWVDd1>E_Q8oLCNhjY9+J0ak)`J{sJ=aGS@?YJgL*YFe-+J|p8v08xf9jF_mJZ1 zd{KVk^xEzkbotaV;$`oIGNI~?jsX-N#QRBp^$t0w=(=4q+LWo(wR$zfp{%EN$tDzK%O%K9mN0EFbDIdBh7 zh44uNWKwc~z%xKe+ADFu937xz++>ah@4Wxqy>A95XBb4358y&Q^Lwzs_wNEUgxTTW z1DgW)_wnvhf z6R5_hoD#seIe?Y@Lziz%llp}^P2Qi@G638@`{Y%=B3FKdKVZH~iwv_xE!OnO(}_M$ zbGCZY{8RPI4iX|0ch4FK1(5Z-5;iOyT^bf5_j7!Oa$5=}|!S056bXImVHZw^c$w zCDJoI0C2+;_75u{JM(9ablK;HXyDlwfDGKUff5z{mGv(CrrwvH#0kPy)EaUwiV7z) zL5AImwE5)@QXQ|O0g$S-DdOjQpQH{I_OKZp02=}0G6g|fqOW~W;XZZYt2OpUo9ckt zKOzmrU?IYbd|1AsA>JpPKdbN-BN4*+x2;hRa5|*DS!0Fp~y`oA@3hzbNB zAZ3RgqCC7ofs;XuSwM9gtO15U7h&H2vfAZF|KI5!6|RE(m%48!=&vrgfDg2PaYBJh zp*omq9eEz4@oFG}CIG;*{U1q(8X2oZwTXT;-JtI{84o*6cu^3QqpiTy4&y8cl9+pDjy%970^et~Fmjl}# z5i6)hLXEK?Y!m?h*fuhpOb24@_LIfd_EB(bPsK?4x8Iu9!$hGi>-DpMh`@eFtp?3mhPb z9}l7bh0N>#G##`GNvE<`p0?D6ZUZlxn(zm|U`GxVB47YoQxFF>az zL7S7r7BiDO-<-k4FO{R&eTT3?0D^BbmU1*|nkpaz5T~fOVaN@LBLzex+%FSA0T7+H zbEWQ}eTM@Bab?iuQ_wVp1&IId;jL~#1n`i|FjgNEF7RJX$P_@u3Owj6 zl-(}8+YnK?_5G~`e}eeG7y@qI7RSDe?f*|Exswnmatl;!R%uK?y}#sgbwLsPdNCRv!VEZaGj0EI^%ybK?mFqnd+|>})Z&70MuPZK;^OvQbQaF4(8}Y7Pv*2txr@j->~nX# z>7!fq>4_Xx9UkOw7{^_aZ$QsKzwBB~t7=gxX1OLoq!*Jg!Dp6#`?^mFh+|BHsU^h} zVw0`liI$1cl)FbdH(Lj_+BQ6uSmLzUEg1$@P1Q}j*t`C}S@P=c!>zV-c!fdLdbSjz zVXtjhM^_g?r{DOJEVh*-UqirsF;!eyC?Kmmi*r!pkB#EQGo5iV$Z7tTOVK!q4$>@6*?oAK zfBegSk%9*&E|_3o=Oq$=`FR4^i}%u_-o*pdpA4$UkHb+Hg}4=oaMvADAta~~ff?p5 z{vjz1Z{3OEejscEdETpfP~*Z%S^LI8Gt=)yQFs=VfAStK`0^nuO0y|0qR=(xi~qFG zVdtWOJ?|vXNuL~&CLRo2kei)$AFlEAOxP_%&EC19Itn9ie%+cy=i8X*BzX1UD3F5~ zoUDKKbirenrXYOuMMeohT;*}-0}vL31Hj9nBjmJ;SRbv)xcsA)DudsbDO(B?nQ)h< zle^as5E(Vo^E>nYttAy{`9!EqLBCju$Ko%7Yc{4px7^v90V{)GSmNubfD+ai0H90J z1Ol%if1U{)gK`G-0Zt`!0F2uy5vu1{2I8Pfz_e?hk&+dB!K~=;I6!wwJDAG)6To!i z_<%x2_n>dCP)Z(xwEcKToRYx`g-swLWCPif?8FF8_}bB}#qOBxp$N48$E*^RGw~lY zA_NFdc>k^z2$kcHS1=7gDw23G!*nJX7#olT6(9*Axhtn>4m|v;6mYpH^FQToB?hXn zO5*`0BZPyp-~S^Va0v(oKo@u@cV8S76qpS{-E{^hZ?X2i3@&srGK!<|YokVtye-ni z#`WN5G2}UD9@H_~A-bdU3Q53M^8=`8370GDX(+l(8&37qHuVZW0|Nth!lX>4D$1>V z0u~@K^c5PIMxr?MSN8ia#-RF{b!s7Rm&gnT+bl3(J{0JF5%>hOE$^KKgaCNg*yrtT z%#7WRt6xIzL&gBDI{`moLaQ#J(3_3x%bb(>y4hem;OLw9>vlUkgeRuVtAVjJY-kye z06TwO%3Ife^9dmw1LaiRb7kq8|LSb{DtM>S{kD?6?LU?HRR+B<;R$a}T2cZ>4bXIc z&(%53PB%Gr)=(cT@{Bkg%I9RW@B3pQtiaW~iwkuZRTl^A$E1!EzS9k!SHM|MZ~XMU z*Kw-L_O{zvW|tBE4tS~#MPRGETuLYxxNno!zX{^i;CSL9N6Y9go`$`9F0->JN3S{6 z=W@`Vu&PrP_BWs#N!2Q=NRd^`V={*ti?yA0vUNs6x@n zb|`lRjR35wfRIQufY`&52e9xLq`;*P2IL=D`~@9=kbgoHW%pkHMw))T*WL>5pZFn! zb3!f;oOqt(=r^JQkVOK34yGUvYLZvHIlS87A0B?92mTYNpa_faPqOt7uVHTT0wJPvq&<)4xDPd|uhw7z1_-uto!71ZXN$K)Pyx1r7;DP49x>eug!^PS+{|!D64woI( z({oXze~GBW=923lp#3YE+Z@(;aI-P!U%8wh9_KCfw*h;nJ+?t8`d!3>a;{QJbddgy zklTp+8%ck3Li$YeKOVSENPnWMMFMaSFxj}zC2mEG0>sMb4%!JA1iBG&vtOaPEjZpr zPSOn&1dOYJr*)E&lgp6+8wn#afrR<_?}Pe=--PA25fn8BQ(QtR`4RxBuhP>K`V;om z_=Hd3g{|9`f>?L>SO7PAB9%GvXWx&3e`!}yQPJ>z;I#F{xBCAL>2o9lVFPg&`0Ayx z>H1*sekmmYm`U(0oZdb~d0O>(B2N&dFc-)L97V{jSWpute%B=_%|uH~gPnjt7V$mE zW=aXqt*ULY4?%aT-a_m)r~ThR`G4dpAQS%o=Co>jWCI|lA!L#2lPqDb|7Kc6SXrQ) zB-WBHQ}Z&UAGR_}z2liP#-X&E4H$aYd^{RcUSLPjPUba=@CA)J4=on&aESgh^g z9})Cn48xnnVlNpPw?MvU#ZN9ASLSC0)5sG)i0wk&nfa;!?Z!s7-Ai=n3BvIF5^!%h z(&b^3;%&J#t&_eK-?Sq*mZZ*7l4ahSCjV9YZ%}HXy4lbwfb}dNG_Tp|i~VTFCoAn1 zd27Fu8p$Z(`mvR1S^fXEAy4+JH#K#U6y7zNLH^0;88vOQY#=Nd5L|n!tvN zfyRQ1!8t$XxWPVnJyIa*s*J!wuz~m@?yd|sdc@>aQi^C@PFnq~JLE;+v5#QG^E-1o zNZVkMGE(F~4xl9ssYcbAqoO#Tx=3jfaldPg`Cw1Bb{2e!rhDp}wC~N$h@zvF@gF7} z?VE%2v@rdw1pp4OK-Jnl<6?K2{^XDJ76K>@>NT}Zh0t7g65BNJ?k7`k-f8R6sy1Xq zGyU6L-^1;DJ$*BuU%ZC+Qz^>J0~$Fjvz9A}x$mU#`_9%aU6TIE`DyalRF?*wF%gcCY(<}XfD6Zdv;ZN(bW8dSx6n^_ctQO%`hC$PTjG409&48Ec zUWLNf1e962TpL!9lIo76URh9BMlafKdUSh*l$E_UcSSi2;MFCQolIK(mh%uiV z=|aBP6>d{AuQgV3K#Mxj?i{EIT1CtC;0|dx?S7EQp(}O+vQ;826 zl3R?8-WIVQ$gQBf*gE%ZlZx+UB0i|?_GML4CUeIe;h&@Trla@ZgbFK)b!&B7LnQ@+2t&7_WFdf>=l zn8I?D%DpNovX~l>rMYFOGEF?WnBIpRcKb3K5+gk~g?xFwp_tcTDE?#zv!alc(kQPo z?D%r*qfD*KFY3@>z@Dyb+`{9;OtRg43?P!1!0R&sQ&eLahTF)PuR8zHn}OS#pKp!n zA&(V3<%?WV$dQws0;-lYI}^F z{Q4SjJlLSpfQD`;JQen-3wULv1@+uHzLNm@_6!SVj|`je17zoSgD9~3f;l2U9NHXF z_-iW)aEz5F|1lrO5a|3L=H$X)ET9trdRN<)XJOxZ?2Rixyk|ht7 z>2Lcm0B&G_IumdZ2dV~OY`C9v!rcq{A015~sBi=(U=~fhyE3;9xl>jSc;)|NEiNz; z&=v7Vjav@?Lo|ryU!uFAV4aZ)2UO6aIXT!XmLE;{*0V7fZo*)ZF1;*f8vw>^$R(Dl z+{;8Dz`Q1qSp`rUU!cG#D$Kq-5Y)JZHOTRgu)8i0H*2KobTAM_k6TB%$n!+PO8+y+O-=u~ zr8Xq}-qwUzL64*E`xkM_j}B2ez;G5|D5xN1Sj`*@T(F*FStFf`2Y~|}S0AjG6SF0z z&<*UP_>H3kf(RrZE4H?r5MN`A>f|@O^9LD}SKt8y&m(d|*69^T{NC7s2=OS&ufrI70QIWo3 zA;|Kiw);VrN9j%0YHJZlQ{@YrADToK#MUS4hiX~SiqL9c`_4>7&RA7An#MX;!q!A9`c$?~0wNdhP>z>M@s^@a!;NhdCs~ zluiGYMYp1gibdu`bUJ`{deDVdYW-49t3%pkN(>IQuYh(G! zw}fJCfPKqEQQfUelQDLUJ6?s6lKWLKVyIzO z-n_-K(L$kae(N~=#mN#+_VJ0`>T<@_PJd2k~iS`vu z#p#kZm+^P@p_3uNTic(M)O*<&G-Oj&@+EGpZA_t-2P>+p@*i1l4%UX7`nGh1uIM^J zjU;)qc^2A{Vw2~)8*6(4`y$n8%j8uR><@nC(r<5rCsoeP@f>aSYPv>qjFq zNJOm`ph11<4Y*gkE@&-RzsdAL5>)l+sSa80l{essMJwV) zp49*G3RzcWuODC|uPtNQG6TjbJ|%TyF3{zdw6sS03txEUW@KR^*sO{jQYxo;bB`HvUHVUE0nEiQB?q7-*i6u9Z0`PEy?Xwi(&DZ`^2F& zk!;fTa?7ag`&&!j8y7tQ0(HAtd)Ra`i*}4kNgW#QykrG1#G;}D z*Bbzy_!BOlkP-T`xtg8G91<)WT5pKb@9BI7hQ)5Y6@9N(*(}>^Z-@APQzD)2>}-f2 zVS#9YQ8frWf=g_)2Wai?av;{xYL24*uc}~;{Ye%4C-hWAtL zaboG+(40pONPSrG9OdtT9WY4u0-cTsZl}%d!VRqP1uETUSYSBspCP>4@6tYtyD>l? zdgnAMFWO~xVE7Lm)T9s6Hrs1;S9h|@i-qb4b-7zGbNS9vt@?|M<0@kN=972V>Y^V8 z`mwe!iEW3>A1(Ojph<+S>)xrb0}P7xDJt@*lg$iwOCjxgzeEO|?hfF>kGq4BODN~% zCoE6Fr=6{qATKU)L>s=z>!1?$5+3U|y?OgafHWj3H`J$DgkbC#+t9x_(`q^F zb$9k2)c8%)gCC!l-k3T<=|fLmyedraP<-D!j*_6hy`lC!7|%VbEwq`TUZ}TZMpxUyDC~jRqBd-5M$Mo1J+(O9dyi1y}Y}&^Sw? z#*5YF=oYVhG?@Rd?^Y@z1fJfD(vEX>J5Q~(x7#z{ve=1GFk2)~>N?O|gi_jQva`Fl z=6SE?^>5#fkLZD6FIViVu6P!WOqN*vruLX|lqjzcAuOfee$LA%C-eFDWi9 zDLwrn*>ldvzhPJRct~;VK-2~MG56M?)J)#+weL{OyHmExy~uV99$d%@t<`2ZTa^lO z&eC9^eZIcJ1iRkYDrF_bn+-`Dcty7Lr&74^)aSrnN)7b%lde9&)chsggm!*& zEA59Dv3Y!$9eMOiP2Mh;cnzAnP7GNg_z*X>9-=03{i1&Tp6+N!c~E*cb7+s%dX|CP z?*#jo+Ce>B-ZS@NU>~BdSf6sc0`pi|Xp8NVRkL2@I%DZ(KL+P3sLU{m-Ctga!~%<< z-b;;RRW^#LloOn_#6~+5SN_d4Mr^oPZs$M}#~^F{*`Yp-Rmp?&cCC@mJJ`*2{?EB! zjj9*g`PyjUc4J;`Ap`seZRLzH(bzX5#QoM^X`BH$dnV;Ze;? zuu7P~VZzgr!~AI2m{48Fa-Z$c0Xs0Z z#u{<<=H5WZ2uHpoie?WiSEjGW-!EbP;_>zY_(QgmJu#Ef3w^$?9jujKocApTx!GKs ziF$H4HX9-Sm>woO!*8JMvR`x z9&f^`$XcG)%TQ8L6caCru*?k{@1)UP7sh>SyU4|#5YjPlMg>j+zoY@*sLd0ux|`;+ zB3$B2my>&AU=u@SMjDoxea?I}IJij}Z|Y0zwCY7M1s*LAeb>b2SgwWko=Lre^E(Q& zAj{=5xO4D_{d~{d$(Yl(K?nZOYA2$(PoDRjUI;^z_q}@O1I6f{YagOVh|2LxENk5i zg3m{I5tUahA!^910n)80;WkOc5O%I^EBLRDuVw`b(>5gu&ntp0-?7V#`Zc5wLa3BW z=fh<(D!;_S)N*odW2U3vQ=aIjgG?Lj!rY_v!kC)jhOgqwhUKl*8J@(Rngv>hY;Q6m z^kW(MjDTfjj}XLIr)i66M#x^xL){5@+G_A#cf%g-^J+zW!og-{Lt>2r>NzUfpJAMJ z-h{inS|)MCkMtiQ8j6cQ`{;nz)Ox2&)gB>S?t^iS(Ulc|Q#;h|m+(<_pr4)#v(;(i zmk1S*N#-w&eyr+yA6>EK;u%MUT#z{X72R!6<0uVT=V@suOjt!rM|2>7J{L1qYpFb0 z^{7Y2%;#%3yW*K@XW2Bqw>^G|jFHktWjmYsh(#Xx2lUUVc1zwhCue0jtmHLX#T4Lt zPQnP)T9IkaDqCW5d_@e+xN$)#cw~G>fj5B__nnrQnp>+^Dl`37!B{DT!zo$Ap|GYY zU~YzmQ@xne1ihZN`v;U7=LgsJ?^7t>#AMI9e3Hu)LDie=eo?Uartvuh$7$}{SU4p) z#gb&JR^Lfsy@P9h5qRfEg{YNA^aDtdF#iX4K}g&fEXOgQy7(1*y~J|h*GK~K@2j}u z1EO-vbN2d@`s}=$$B6Y1B`igESFJq#T5AF6BrmqS*9l`@Ohw@QR8oZs^5=^3`c}Bi z5S)D{GX)vogg`^Ie?s`<7z~XK{j`*+yC9S0`gEU+BOE~Sfps0utN3^e{Vk4?oxMOl zwz;y)T_Pu?1$I3EG)=5ZNs6UBNVn0P3wtn$J6HNSA;c;wwFjrlRuMA#3FRpnl8viZbYg-T-+C6qV& z#Bu*oVZogZLWsEB-L;LWevTD&H=4b&s{W)#m@uZrGI5fyo{(y0ykNW2FsQ4BTz?ei z&cldNoxH+maO?dnSSx9d_btG?9XMrH({qsv+FpMMyP{khYT%1>biyY)Sk) z?Ks0AW9{f~ZsdL!%$Q)Y_|ZlE0M1sja@7wR@2y|r(lK8px5^p2o!5~oJ{I=IJ-umb z^3rWIOI>{)A?TcOO0`Qf{0Na#XYG0g->_B5Fe)a+ly_=8j-!Ksz|Y~uhE`%5!~uya zg@&xDc)R5DsFN2?Mu*!~6UnvqQ8wSe8O0}}zVk67^;lN390~2 zHD6I&seQ_RUpelTx^=AKAK4KH5b%j_sG_e;`>!x6vGK?S*}ZB~p%qQy!sD>hA_k9q z0^#EtnU%Yhx}pWJRad^qiy!LB8aHJyVA^UbY$xR`quncbO2uPSP=RMDb0OSFQZUka zP+eH&^xmyy;cVAU`RR9ca^=DMC#_{ly$huI6=#%p z#rg4|y^C|5>hx*U$o1tZ)(;~T7arFVK#E?zS{U`kFX4?KP()7l84Fpqg>pNsyu*7d z*e(voSiMYSF1_~z&&7CnV6P)vSK*2CSj^ip*G+o65f8$NO7{U7Ii|t;yzi~80)PF) z(eUiiRd|5Y@k8V7iMvFhEq#ZQ1)b%*rkh4BeZO=TGe|RLV36BH<)0THC@_~ zvQGv=wO5L_8~BOykwLF?K_ZcmMnwa<&(m{m0(Rj|sWjw*gGb9$=M_i4Wh67hu6YCO zt}G+giJXGH^a<|ozA?=)(~V+ZjPr{9PKCS~(o#q!8|JY!n{MV@sJLfOqoRG3XgT2l#p;*@lrAEjbanR z$*E8ALNRSIkDNoxN^FSQ!c~PtrU^;W(iKZ%l)E-O8h572Kj~!9^Vtww-4JmOdTw8B zyY>qUU_3jWNbC!C2b z8hJWftfbZRG)2d;g6WaLL|!v+mhAf&@13$^DrhhxXHu7iVcoYS{?y`*y6RlD@QJ*x z$VY;Y41kn##*T;xbx=|#Cx!}Rea@2!&I#PoV510s;6+?sp{F`nJh>>!=DC0$_ol2f z-GhvBA^VKE;v4bTm`$@>w+>hFobqu3XcBb1XH2!Ct>`=DhGc#_T_OQQ)aw4&Mt~Ch z@fcUXbH(#ItXlPo*FB1-9|Tw*uy2i8UDM!HDc;cF9D#3>$HO_4b~Gwus>m2z1xBSo_imf^=&`qz{JoW z_B7#2_=ob~dM*JD9mDn3-R1?!iI~+jYQWsVEdprvO+?90liU-X?pKdbT>}8h3Q@o^ zG7vy%?Y4FJr(L*fB7n97xbe4%xDBnp&B*_4i-mt$kpCg^ECNMm+6jk3Ud6sK8#~Hd z$yl27#fpUjsY9G|p93>u;UL(E7yP1>Xw{+%Zz5hYD8|q@btNXDP#p!Mlif`40hFND zI*4c426(zh`@D;TOVP2bM_&3xrC@h1tUtZmw4& zk}hAJVJbh<6tR}gg_&er3M}e70S{Lc7kV`uS!dlT?n}2RZ;#ahy-83<(NmutQc2?p zbP^_EaasZiRwI2?uEAad9pLzge#Fjb6+Tk-`8Y!9D;Mpy?f zJ%K@%AWe#_1BKXfG^U5Jd&a<+Oh(S4zW?e7^|>szhe#L)WBn(LBD_sFbigE%5Lze> zAFU4wvy)(wFxFB92)+7;5CU>-s#~c#{<~BwCiC+6-Li5sh5(aEIvo8eDzWd{WK*1h zWPNORK*N*s?0W7)r{)W*ef+MB`BhKZoo`1C#ARWdFLoOocX$2Ic9vbQWBKWa1Mq%O z&ulAG-5cP$c$p)-oVHVhQs3~rrays`OE~B4X4U*E!P``aip)j@i>n^7Po^nr@gr;0 zDO(~zu<&=@B&)so2kD^VKDWoic8>`MA{GNksLnl@y4{SAXF@`LZ}qWOQrL;>s-nB@ zR9mo%^k2|M`lSaOzhKO6>@_GoY(JaIwBB6KlRmp#;kzxBA}07uHZyN>-jW2L>=ix@t*NDIXg{M`KBb*xNiH?;ON zXoldRZ{YA;CP`0lDGU0mi~=#>kj(wu*f&7%!6T1kyn65Gyyy_vFx!O*gb%rL&0E~@ zC+*IM*YF!YNAL%C8_Nj>L}PAe`gA7iVpJ~cHXExSah2 zNFm4Djge;-sa};_nVAG74xeGMJIt`+M*!^B>Q5-yCo+kl;yS;DI7~t*^1I$aRuZhO zWn&>L>Aoc}f2#w`qbgR~#iZ9Fc7V!V5T^K_C*@Xt^4!D;TXIEq)sMH<6Q%Xv`Y82b zN9_fleV)k+9QpQD>f<@m(fymAcy)NQRPW78bj{9ESlKI5N{hfCO;m;?3~+Z@ zqFLT~1&YY=R3_2rJVYH+1+u|gkZOsNmdo!WhzHGzD@H9wZ36-(wI<}V*Y!vjGmufRzd>G zW%07B!@G8?b(ydi7ERZQn5@57m;KTU?_h0X4T=lZ=!f*W%x3x6 z=W`RI9elyiPyI68aLr6e#d%byh|?)&zBT~C2=pBL^*iacra9e(9u|{<%&zn~rsfob z%3I<&cURg2dYi&GY`uzAb#A@W(o+(b@HWrd)OV-$eajs^G{C>0nE1NqBKYUDO#`+? zHB~0Qa~tB7pKCe$>_$66e1DKO0gE#Z*Nx!2H;r*s@y49TMlG%j|7Z%~)L zxmV`K6K6LR<-7{ZJIAKq`$YUSi*_SB@_9Ky{hLu0Jd8)q$u@9*K>3HMH$_xVUPx+= zne3d6&7pjnHP~17h8|1vSGnM{*{g~Xd1d&IiQnqlWb2X@xi5e5>Q|obtHafe*m(4{ zwQFAuyD;vqt;d~c2#s9qay{$@=b>hsFR^1c8G~`>(zSfv5$|rZ2j9$2G)ajewe+tY zwVO9=H_i+F4 zew6)v(e}WxfRpD-Dh#q}bC30X>YCQm=EqJf9A)1%@!DCec88dpAj@?JTq#{7-mr8hl3k69zDWY# zoqmZ$2e)OLGO?a-=*NxR|3q}0LVV#NE^9{pkL>}=uWiM$MA1$dKeeR0<;)W4RWm=bG1m)3DM_C+ z-hEvAWEL%{jU>!wm)Q3;#k?2PM#b2d^FC@nhhIowv;BKfLV|tH634!)gH%?g5Hq#7 z`V+<|x(3&sn$^p`vl++jhCFGOdBr)o?@zBc$9j8YlyTRdz4ZJlmi3XH_sgaZc|U8z z_IpbdvqV^UO-_?|{ROYzO2kr6s%KgAhTWI3Ln%Ana9D&8usvlmNYy|7-o3L{r#5;6 zK`5wC-R$z4uQjs=jTugEc7P}TFA4nRl2oEMAS;EoX{PTM_JjO#AI%ZJB(Xievk2 z6%``u-bf2M4!yMZ??N6BlEViM)p@qB;7fdHlrA{mfTl+o7mmUobfIFTLjF*Ff82z* zUZ%7ZIsEZ&FkM6|L&yX7{lP6uk}?`__xCJ%1RQ?|j<4ePb77GPJx&?r?G^IUjh$ZN zml}y0Y|V&QI8m4+U))CWFpJEenPDW(`SwRvs0KRaf=yP*+)Xku}{IY^;76% z>EPe^<#uJRLtXGD9K3PRFaP!+fs$^gk9;iVkT@jVtAlV6%QR?(XlCN~Oh)vIrTve( zevLOQp^qzN@wZF(cY9vYAxa(^Jk*wl z?>3GIw2B4_E8wT4d{coO#}%RKiMej;czO+B7WVQdyuej#aXL-MevvVcjNEkp72HVW zWw5s^8pj1lqg6u(iRuejg;ij^IMq0dl;h}tRqE{CTq;;a&lvoW z`s%Vu26b>L?JSA<6H*1A!NTYyW4`E;nBs@6-~3@_Lmc-gy`u&mx|LGG1l+9AIZC65 z)WGuauEUcuw(P;Vz$)-?UiPKaC)k_&;BM)!m(O1iGFdE|!aqsFmFdtQMNLnVmR!n^ zK6jtH?uA+PG;KaXW#3DECr6BNawUU2?ed^#Zj1pOpVy;@)Q2oQD=E52FwqJsl#(#_ z^)xZBZj#04=t)+LdxU_`;p)~M%j&$H{+4ZQNsi><^8G;Ux)DBFV-(L8JNMp_bjiFL z^>UA1L5$M_e~DWrb2a5)MakFMiRi`8_UCoE+pN3NKL3#6={x}=0n8)_s?uRys z>Q6oG{LF)Y5+P6Dkc#Ya-`AGVH^UlC00Lr&jDx=3dg1Un1DIPJF7a^-xgZUl;rvPJ zMS+$LDq|OH@XcE}hxe9kwAu|iA+YByjVw7sd_!5NKFScEd$A$Bhzj2v8FWqBZ!s{V zy+X;z4hIZmI*=+dHrrEeVyCF)Wt}&;L`aH7t~Zw-OdccHX%G)W7!IW{Drg{aQIcoD zKXv^HO5Pw5F^3$YzFGPn7A}H9U2tGF=wX}$Zq zQaepud}wahrtUxtpMm(%;?$DK_ktu&`AHaSw^|Tm4=1y@9Ui#d@1qZ0Q+}nf%rhC6 zLw56`p=1)yCyMMwTfhN6d9H)0kMWo$YF@=wtVheCQBKL9dl@&zY&ziyDDnO?~ zvNrHtp!(8Ko#gwMx52T|OSMepkDno2Ap`84otq3W0B7Jv6cdOcOB>0lo}$60w0>Q^RNK zT%jqM>8|3>S)-W2bKa%w%=l#PWb{8seq0>y&=*V|JbB#IWOX$p&qh(!V#3Kb>zx`cpJVB@-13M~?}NqDkSURSG9P}H zdjx*zkrAoV$G`(#WMFVu$;?52=9ZO@*1mt79B;c{i zTaPWtuy;GcIVebi{9(L)kHL|xYp%5DJ{FUKIpPT9hw=XL!5Bv3f*NXQ5j7NU0WNP0 z3z1LU?&W4nM#(*sH-jU+8=1o2kUJ0lq1(18kjzbXK(WgvgeGSNm!SL7wuZ=@dnZzS zDH8|=q9q2_;K^B_C~9YEg)&{?wL4X26HHR~%jGyv9v=T5Hc^V(QzkNt&$0vr{Xl#Th@KUT`3=KaWi`j&ojnNEH5Cqqh}3 z$|(Bz;UZ_|!JhpHvxS{aqlN7!M=AJt%gKDQV0&@ zAc_QU3)4V!ANfDE9}=+ah-LORz52FadKv^Z216J?M~K!nTF+)>Cu62zq{k2}K?5`U z5_%N*1T^82m8|q^41w=dzm@KSk+NF0`D9tO_1$IlCVO20=3;SXRC_$})Q);motwKo`&suK zBQHC;wB2KZ9A#zAJ|L$#=;@}|N6rNPj^2pUCi*_lVbko>3_;MCeBIU)C_^yb#xY~E!XwupB%jR9t22gZWAJ^lXw{pjr2I&P~jl#?8 ze~>)63BV!dz}CZg#3KpEz-pl7a~2K`*7VI+B_V7{SI+{cu2$^#d{2c-tK&s}l6Sw4 zO0jdDWwLr2YvKf2S6!}t4AT$CR3Y2xLNmTy@nhqe z$w)m+DM!1~w)3DV?8f+wg15)R4^47>;2ZnL^L5Ip7h*==gdww5 z9efYLp1Pf6dR!VNb@kC@d+;ANk@?>pYHJ8)ydJzPW=mu!*7VHgiid3kz#5ADT-R6h zG`_dR_oz+Se)5Q9{7}oxLT#t7^~3#xmgl$IV*W7Q>zUFdfavi%{0`|Jb{$stywCGMJ);G~|$m!>gc2^jEzS1|XE(bN^b1n*Bh zjHKKIFbsdt!Nr17L?VB83F7YU#D*m#!~h#Ee6~<9 z1%=VyUXs8JBYHre6J7x`aPCSB21EnvfmM7z({jtS^&lHSU%b#2#0(jqgUIN8Z>?6eoP-RHiN_gYM}rMaew*<*`1wmD_T7LK?U-W z+d8`37JLb7v1v)7R^NT;PayhC^^*NAY;S&Y1PGZ zOH{a=BNvi^Uvw^tCUWoA&j~wRayN!qBje54BZ~H&Na~c=i(5avcWQS)*l>=Qrl6jl z$C*xWAOE@?h58e`*>Cr8$PtWwvR>X#S4|hMKPH0j-1qs5u@K0mGPMks9AW&tm>XkZ zW=ihT*6q9V@qct4LpH7bQj+To(>4UrqW$HYJ*ig=7z&_RyNit*jl$dXPGtWYO;QDR zLeTG=f?#{$*)D9mID=+~v+d&T*OF4=clD)(Z^HTazhwiGaRj_RDV;!z$WtcJQfyD? z$ z9Rniy7h1sOKcMXC$uzzPz8*VT3igbz9j=?Z>4=zHo6_(?`wQy?Oqh|c7?w{c+J~E; zvfe_YGh)mO3R9Gzzt&;~9gE`5cb~ZnNah5mO=ICS8NXDCKSyUcInxe_Y^s<6{{wUk znQRDxFp1$lL9(m(s{mr)d1T^%%YTf>V6niN<{Ujyq#$nY5G;^baPWcKHEYcmf&WoR z2l@2uj9aIVhJuysN$8@DHzo+x0EiussVP1ksJ+i8mCfBKVeb;FMLPrO-zQn1?g;

      Wb+Sk3+ zuOEJ30j9f+;A(eTGpWJKq9Q3etltfFcrI8ZePDsd+;4D#d)6HL#yd?WhFduQsN<`o z*UgUCYAgS8EIJzF;%h^pxB#v}r~PKwA5T^LaBE-?PVvp+RDCi2kr!b{j@O5D%4Vw{ z89Y3koPNsVxIjI7sXv=~Mes-6q6bGJrM-Mk*|NtdUh?G0NV`*W{2_ZMy9X!t{=g}= zK*mN&%&gpaq5C|sK${AV#=Aki9L|vQ#|{Ov1XDy}1;#%tJ9Y*Uai9X4Ke}l~GSFl5 zsc|u#CtCO)fPD6dU%lLO|HF8+gzE_JW^HG+Cq|B{301FV33R!?zrVWNuN|H-ljKW( znIBF2r)=ZzPTwJp!Rh`4#)OaE#kPJ2pxHCz9lyoAm!ic_=JhH2+g^5#D)A+*eug;&6$2Ii1HWYj{$zafa+_;QloSrj9Z$BHKT`&oXf?m8 z)2jlW+!};qYx+Sb0q@Sq%ZzKU(o}hE;#>cs_cFf!~#w#eIe(IQnI z?JzK_1}(k{mQW!2VPM*Q-Qth=8!*e~=maLhZ4VYX!>`|sEBBwq=9f3e)kZ%6u|5HU zH&*c=6Q$1zma%G~cCRFW;fqB`Q%Z1bO^;|7{(-EA6{f**NP^{Rq8D|cNs`TKW_*wO zo1%4O?JgM?)ZO9vRi-Oho{yyc5kEDyvTV^{u}C5*y~4y)dfgM2oI8<1ywthfYQA4K z$QzOr9F;~P?NjP#s9gCZ`O5M_+(rq#FG)vN4mO{e8Q$_?0*&XDY}c&mj-ys0v9Kf* zR$mkaCWfGKTE1O|r(JragX+82p!%|hAk$Hj?uBau=o$X@+Hc$gyR8pO1N9VH&bq0O! z!cAYZPOmnJ5$%;Kf8N(pT>?%e?JQ8vEYbCnyiqJuIv}bxG#ysO^fyMi{ytYfTyN+3 zb_h&VJL>qRZBnp?uB^O>xU!sx4Gj^KIH=@Q8Q-w!m8k)hzd?t^g1m%3yMC>DMkFd* z$j!3MEb51&>->J=2t-i@H|wwK-hY~@y@$*rUmE41u9YpS_e0LK6UjWr9pmGyiRUD1 z*(g0dxk0*_jb#>Z-dEkonQe-{u#`6u2t+KhvExKG*)WF za$efZTqb;Im_JU>>k?Vm$$5z1TZ$5TX*&1+aP<~YQFYzp@SUN%yQHO&kOt{)=^Bv^ z>5>{kkd_V!k&+OQZbrI6k*-0cQ$iZP!RLM6-~0d8T?=O2d(S?*&ffd%bM8Lc4Jbj* z^Rhd>U}KW@U&`h(aq3p2hf+c2?S7L6_UF!;YJ9K;8x2p)ijP)Z1L;h&EeCaVNNJP+ zCmDSG#wl{{=1!>SG(aLFj;Dj)J+R?qU(gFS=>22HbfIs9ua$fdw~dufT;%P2RcDjz z>)MedGE{!;**c!AsfzljL6q6)z7*xBv?dSnY{W=`W2=M3%g1 z^1aIV@+KXpr#g*m%@?8D%DDvXNuQ!EU+_--1H8xiLzP(}8+*3zsw0#kTeK|4Hg=R_%PoauuG`U7n(Mhx+q3`(@MWC0zfO zeJjliR%I=Q)YD2%4qV*tU#6?nz3J7k8vz?Ms?F=lq&$_JwHUV2eDx4OUs z@@?w8J8HhYqXA*#!fS?i_=KRfn);THxw9%%$zr-cBfWZ)n2kN$?Ty19ury?_cJ2MX zx*sB;=vsWLYFsfRG7S`(iooByh%Re_gl-eLcP?{ z5C(Z?g5Wbx@Gs6HXMX!2^YTK=Jtuq)@J~5tjPDxPbKb{(`4TOxk3Rnnc4-I<+Xv4+ zALHogmwjQmEy#gc2vVBKTiL&icsBe_Up_=)w|0=SK~endii9`Bn*wWeMZV;TVR|NT z=ifC(5HHoLh=Pp+89oxfj&cdFM^9zS)AqEgqOk61v#J~F zhc0GMG!CXO&N=Yn2h{0vThM~Z1bG*Bhs2Y*y}!JW1|iWAz^;*m&&*zXXrYKJ4Oae! zTn)iBwt7|kCp-HBq6%i5Lim8~xST#SvNi+yRgmx27fx|5Mo01#>s7bVSD=dF$45SF z*tyUaPVhxF;JpbQ4k6`qOi9v79o@&%f|XcQ{qhp?B1d*z!@SUlcM=V=j~U%_agn`PpIwstGKM@a+`hp*nCV9ur@9i%I7 zRPZ)*vkN_HstT3-Aqv+x?f9kn5v7_O3$Es0*tG7KT4vPQRcKK7QK_Xg-p~~HmjuB4 zdO?c@V?0$zZ33tWLl@E<9-xe%(QL1A3Bjlst`xY4ae9jbyO(^mL~~3EYV${L*;%VD zx~cwrO+N$5tJ_%@r}^--be-0!Xu#%mV}`K)VlnTp>9MvuBrTiMJFa<*ZgrmIpX^fK zJ`A1;;e9xiFzSYIs@lPk4fJGMIP<$!P{6EE?)N}bXPhPhEE0UQ>nFG{@8G3$IVuY8 zW9*Fx$SeuV+ULk&1vdqURBVi&aVTCp_r&JiZ|n(S^8-Z%?v6#YlmSYzF*|Z$EU&Y= z+kMEzbcL{ma$heAHT7tPO}yi7OgZ${HOFyr&O6 z)mWvXL;WXtN~_03Q@E%<^c8s9M_Hy}C1>zMB=he-oie%=JQ0}x*;e0ZZH3bvS5m_h zicvUB$c}50E13_>iU%cVNGc-pW`Vuep^gU()rJ(q0lFyahM?WgqDA%O4GCxLHrJXw zEq_w$Hux$P#Bte>NuipV)xkFFJPh+ad|!!tToAlReL;cMp6iu2!JR#fE`seN3PCw? zS(B9XTV#a#;7L2u!1RpQo0q+`D~VBE%094hK#EDpa0T`0-zTV6R5+YR-rk6>&^ZG` zT*JxDkKba)orsKdw{)%W)kFjuiIeEYb~nc+b!+YWl|WbH(cw!V@n1pKS2}Gz_0F=9 zNE~qG*2lej9nB`ekSDlY73v*b*w4<5jV(#p67$`J*|#mW!od(oH~w1b3s-k}qI3xN zO98$Oj_keoKoN+b#jGf&y^&BZogql`ic+&s>tNQid8Td2tEdrDS>BHN$YzfA z#As|(Pd<$0RzTWG!)^}=V%H6D7Nm@uq94|@SB^lMWHSim07aC&A;dl*g2QU*uPvlc zT&6+E`Y;71_q(+}ui(d-Ow;Ge!9I-SoLN6Rx`CARv7UA{&3J#O!k%%z>|sD1)_+2tZlAY$be@L};RI@hFnz`Gml_Ac&Uc|aIwLCP zl*xv@Q~=ibSp0Ij-}Yi0y%`4NDVK7P8mC+q1m{^jfeS77p1)sy16kc_3Z>lyizB(d z3_p`b^;)Sd_HGv@gsIjE=o4Xpej~2tM|1l8B53=ko~464$*FGnl-GIJh*rAw(ql#_ z4*2ljy#QB^Xw`c@S~*)OQAic2WmOjo8aP@jVkK)acF!I z1P;%MW`&5^2$LMWNw-hadz^l`3DEu?pN+p{-euMhlUY}>Nb8Wc(*mf(DoPj6N5_8P z$g0>y^dfAM-Row~d~#?XA16E9W%+H`f~DJgpiKs3d*!@fyw*UVUCg!nRMwRpzF#V; z1XSrQH`bBbJe@U%?1})*CR^*rHKng%O;`iJ-IL3f%Agj*?+j1W(9V6i)SJz?5m2S|&;hb|FPLioCt4Nyy>Pu&-S)7C zH9e)Qj7f>kI9dWA)+(dK+92!q^N6eo@op1Rb3jb}B|diyaMwZYDr)bta7#GIC2zPp z13FJQA^5Vu_gNmrl)-%C6@X{yF^oDKyZ$;IJN%WBY;V0Ge!sd>R<=TUIXy2L8icd^ zhVx}G!IVe5uY+$ovlR+&1abq&P}C*BbAuyq7hxP*5v7+6zD+0zERg~~bzsB0(Efz- zZ|}(@er00{V?z<=gBpJ`Sutw@(Ls-kz~5lgx(LLfL%Jz z-$!k ziheZ3#Spcvh)U=F;whf=3I;p;8o!F#HpJ*N|8l#^m=h3T08<5~F%40XUAdVAHXuN( z{VZMDgc`Utwhr(XiMwnaLFNq}(7%IixZeFz_1@YaM}!)P(%e_yZ1@H|@~djgxE*Jf zHKxQfhm2}f~Y;dr=P?D3&W5-rm^$u_Q-9occaJq?)Gz0tV_ou zm>6)Zeqn9`m>s6D*ULWgY}ya2Ctj3n7ST>Y)wmZaQi7I^ChpUcR_$?Zev%c&sT8K5 zgccHw_>RQZxrN&&A*HGC0DFkaTrj_jV3zlhd9l zB+H1OxMk4D(4*}ar^W-ZxY&VGU2lrfgOJ|g8XPHGXK3epRzpAjv%9<~yz*+49ip0{>E5;!WU4Zp&?DNIebO<2y#krGgnOyaDAIb9+Ri z;QdXlaeKHY)Yq^88oZG}=Mk!-%(m0jmQkytl%G{b(oIZ!wAPeLgj{a#<&hLW|EQkC z$Pf`%ZeZ+ayxq*S|2Pna9rs4$+Lg`+?;&(D`>v`y&aA}TPPa+4rT8I)6@vg~0l-NV zb0yB7j~tX-@~D^>+P^t5V_n$`9=E+IseK1X<{ZR*FP#ys%}6I}3CQNyRsDea!A;Gy zOsDiWay~krz(xc?w#TNRxu2oJH1AfD`4x%$Dv(VLf_<1QLx)Qt!B#x8^Ucx>5=4}Y ztqvq^f?w?;7Z12cI2cu4{FHwl`Fk#KU9dw8dd`d8Qh4q^mEAdv`wonn%ZvzcfcxLT zL62wwWKNyaOxF5C{uA(p$=M=FN#VI}I?W>#Z1JjSARckCSk0MnZLMgXl@h>QJqu9a z;lxlpd_LEp%8^NH0@%Za%sK4XkHRzwLHM5TZ4qOTUPNv2hHN?w0}3_h;ks!Df?g>( zr*@vZKDZ~xXQ`x6yhLyW4%GuDihyn{XZgC7OXUXX_ZoC~70#!hoDOf0c^QQO=`mvl zC?n$9HtMUX)0a_VlQSx5l!Do=oWH2)t}J~KV(Kj+hdC?h81)z1JMQ72JEpwAmB>tL zZ*}#@039O=wy5^ozYpUPogX5@Wh+XR!OeT*Y>lU#JuI@ zoh^TYfk|zpIh_TNE!LdB#_W)m8mji~9QyHwu;>QGQ?V_@*Hi7d{QmhA8_+}#oSU2r zfMAZdlVBJk`HDRZz%58%I{rW#+awf`KqUuIHvsrP!285WK7V9drBhx=tuKMn>UCVy zOZMl3oCeOm{uz^?e_w^n@!-Le@@t4#B6~Ss6y?h)W(pQX91Q&Sd$BBFiMB9gwE(E~ zUi5!=O}9CjRb`CHhb=JkNa_HPr=jH_N`jiGGyL z8|L}10?Gywy=7a>J;f+MBxVMSZ7nC1YsQN;Yf!!c_kj=A372DO?X@7dGa4@&k*)W~ zH&bATu5&4EJKws(h_s(rXc% zX1GxH9{uS9&tkkM{mt_saV1GpgojTbank5c40SL+9>kKE@?k9j8$j{^j`YJni10Dg zuk+J~Nk%@AS68;)9Hh**VU(Fg+Z&crpCHLhj6-(Cm~LZ<$Rw+ExLHfR+2&3~oSL8u zYr7@Hbz)Sh&NP52{8C5goC4@U>Ab7hciATC9iHbGrqY{xd$*(W+DXOU-{owEOmJs%bpQ zwo6Am^YIfS`US*M>sfCKB~T!e_QogHuG%0f8p;O!3p8h)r#MmbCwKOL$616maP$u0slP41>)e6ile0P=312Dhf*=TylB8Z1CaYz*}}>i$6&Hc&2Y|-pSC0={+WQD z;As|cP}Of;Yt#GVmtC|THsr~!v>C<%*LuN+u&?7^Bd7w+X3=g&Ig&PL$hiKM=BT?- zuo3VlS?Ybg!v&E+?V7jV*rOQM0wpgzAp&)0RG7}$!;SZgG6w~Ub837S13x9^gDj6!xE4aJYr(#|-?OH+zpH67l~JNBz1ZIF(44CF zU@Kz%@lvZTC~V#a7#|Ys+Exm1rTm>h=0PZ8w&yh5k8!MG!Zb0cfC2U6)3RPo13&06 ztQs4$$qU#(Cs8K&ysc|!lT%pYK<>_>iSk5#=ZbKAN>7`c>8bh03=;yVVE05)o(md2 z4izcqdnVP-$gYLZD7KiVhmToEfQ>QMlN-cB0)q4hq0XD?E3y(uy3DA{QE&vsNX^dV z7|Z&Y2}zK~Sd$kX?-@z@?OR&DER_c;OZxVON$TjYdVV#34P}Y^b=jv8GJ#*h0f)Az z2>ZxwhVfL`jM>75OMse87U{yo^2r~QZ@VLvH5fZVg(st%M4M0 zs!{90G5>jtt0x8LLAeP*qUG4Z!w#QHHGVoBvrN+UP$3y|nnE&b-;sJ7eV*W^n^U7n zSKG7OUb7OBd14wr@!?~p%Ou6X^_0eE= zJIBU_dtKbdquNEtCDCWkae~v6<;>RVs8$)2z6~j9Bp!)|`uZY=W_AqU@a_%tsNMdRsJw znUP0T=RX8;+Vw!N=l^6nT~$vlThs7NV0tdT_`HR{06fZy8WpALpcG4o<3+#AB!`ub zq3>rFNrL95{29z!TG}rb@Pw)N`AcVZ`=u8Z`7=3O=@M*Hb@0a_zH=Wh35*qA12IWQ-=%Dggm%92yU9Q z1XS597x_3&oUOfh8oqAgC2{;&Zac9k{;R`dALUMKp+4P^INM0Fu-o^``)xqOItzMs z799?PEEqNC!fRlL>dll*TE)EecXuk}(G*HE7+wE)Sgi<1&D6xG#q?S4q^t# zET-n~XA9-&r%KIW-FTpAmpkLkVHM&_x`z20sseMyd?_DvW4oWI%E6oc3P%@i)?@$_ zM1)Y{@sVUHr#Gbi(w~ix&N+G)t$mKH131um@C-I(L3^)E6rn}Z%x#PVgrK(z;0c+(S&}>|VurJj@47Dvz+JNd3StxIS9X?E`lSU8|Ue&tXF0}Zdd=Fw>=W}oB zyxyKVEGa-Y6)UTIp=qEL-+vH!QZT96dcIlSK77?+uVmG2n)dYK&u*}Itm*h(O$#77 zf7lU3Txsz-eLoQY4|fY*zhuXlkCZ3PsXGc%}Uzpnd3Sjn7?5 zH1HQ4x69L8dMtwD+mDSir)DgH65?q?_6_!N>66Q0bpDce%f!(8C7Q#Wj@0;;q@#ro zE5ZKmlCuVPCg{iC4$)&V5!D+W~v*saazQl{Ag z{^>MrdmXpO8#DwB9~PIS;;a4~#1B#;Qs3YLjyzXNXT!HwhcIW`_@9abm%Ac_wZ}WBvu|b{XWg+m5Wc z?2RXM&$iII5-5Cm^5=R>F_~K|fJ~`jSL_AWP)B5fk7C#UC#lxq9q@(KI7i^>)=t0# znTEy5XIp8yqdA=`C5|70UBlwUTi#(w^$al4O?2D2A)N!+(Vw}rx( zV$W%a11aH^N+#QzG1#uGwMzUB7H&F(XKdM2wl@Fn*AUdR9aOg*|~Lp z$~${Os0p(_ApdzQ36sXSSi_qz-)sDnLIGA_iNywWcJHtkDoT8N(*I2bTjLj=P|cg; ziBHMOXP&RuJ`YBT=3CaJ%qd!_WBTfE+-NjjQ4K2znqaeBv1p{y7+7Q;@124I@DM;< zpMmeTkPN#MzYPv5TbyLlLlA4?_|@kb>P0#=v%(**T^TtF_fogmc&y2GhH2)d4ei%2 zYRslf7Ix~-`mUqi=4eeS?Ds=%fU)qiQnZU3uEo3{D8_b@0t`JPksiLr30Km{)3%Ze zde2%@yuCwWS>xlH7i^6VIYjieOhJM87@0cFX|LCOi-M)57$YId^O23g!Z`^A_}O0w z5GMvXp9Z)6bZG|1Kf0>I9MQEO3$o@6tk3}vBSawr`XvhAzIDFb=Nt!xlfjX+Bzp#p z{yOG58XNQof;=*S&-+w6)?oi&#PBtfn$;-Le!PfGc!xX;ogBo^ha3w%A0N~bOdGg( z>x8GKw{Q4GxUOmd9{?-B5KMka#2^+rFn|rx^?2wABat40jBSStBBB_TgF&ICB8;-I zXI2PE$x?@i8UXL{5yF9?Uko@bzuFt{b(BMNg6}$vF05Ito+R|N#)om3zeXZ{1U~SI zI+5nJl~u#}2<~%O#|Qa3bqGpeghJndq^*^l0)K+Xzt1|4*2UnPgJ|k;v5A4x18-w( zXg3E2oW?V0Dxiq^3m@427EgF6ynx^qqM*p%Vm%1D5j7b87IFCd_{IWd}`^|~-K+G)*nm+Cr-Y@6|dIViwWwqLvS&T{~3Tc+_dZbsC zmt(~=4q$?UWnhE8;-YfHqi0n#F*bVys=8kOkW%jBRr4Dm4!B8{JZ;0BaAu>j#6<)yz-*zYz0`q986#mQo&)|;Mn+GR!*_T)N^Q+G9( zkaptDBtjDHEuG{M8*!Y)v3cXSlyywvGuF-G!A%$XOJ;$l23A)$j(udM3#a==OgXF*(WiL z;nmPwSy@%A3>!)jqz3M-(!;5t+w%E7gRx+eSuIgX|I1s7qn-Mbdp}-}k_J5~e;dC* z=L3b?x%7k`s`453Dj%EEYzll{E};}|BVR`Nz`J`nPQlAbF!uo4lf=_Tv7i@oZcnJ~ z$ijBwiw*)@rELbk6rrf`t7n5csjsf&*Bdfg8#)^N4)xVPU!Jdv)wk{(BYG667e7x} znd-QkviHhcI2jhwH1XM`A|vHN3De}}CSV2^uYcx6O1t9Ss!X5`7tE+uH98~INVNnR zk$fRIvn@CvpS)L682pm@&=qktxBj}dy3_LYXiu<3Mb&oPcN4Po+{GI=1aZ~%%#Fdm z#zf_Kv?x~Ve~Onm0%n$*cJwDDqOl&xBI<0#^A%V_Z|!%}C^fMEZkC+FdYUllu4aa- znrAnjwr3c`i@$xkpaM%Y1Cf;w2e~`FK!}VH#WYyrkIZf@{r90jE;v?9RXWe85OUkq z&rwOp?)x0YGu5wDsVlh7_8^Ct7KX1dzLQgE!_<CZF^N;3kZ}pkZ7#Cu4Q5hCd_|745pMQl z1?f*ak*kh^yB>uLXNpx@uzZA^e#9iRzojW+f!s=2*qzD18?TFPY6;S))e5Ym$*%lvNb+@J7s|dpC`sNFrHiGJlP1)9CC*`*;v(i|+*t6ra^ znRvKJl8rkajK48%=&=ai4~i;fS-eI<=v;0$h8&_S=ws=+1_T!8N6yaoyTiS^*&#>> zN)8*^qzK+-Gel04@{XP|oFvSh#zI%7veS?<9z(LW)laW4JS-7|k{V|CVA86vGX8mj z0rx_*28a-11hsKPjBz0!p${e&MQs?QM$9{keAEK97lB4Sm_>6kUW8r!kG*6ud}u@p zAPhOeZX;aGe||lJ00>6~Lfk|AdiHP^g!IoZgpL32-5=RD;D7E45dD2FObgZ^)9ntT zuhDs-9*Zs9h6|vg`!;6kN|frnN32O6;9_f{6D0EKIWsCj)5wmr&YMWMF%o0EJw4wZ zMcqKjcYhWE!j_=Jr;{qe9j=RJMDZ74Z^AX@`s6xzWZwZ?JP_6r$(Lkr2EtEueo)X1 z;+eD&1B#sRB^&Nf?zly#(cUJbk@5}dScZj)=!75EQ7V+nG$)Hf46UTG(-_*+x#!@if0lD7EF>`=It<~;(nJ%UHge!_n&3y{Trn>riU>vUq6}E{X?u1Vzo{;^k9&KhEQV zG-k$8xN33by4%9mxh0VPtTUiZXussc^4rFPhGg7X#S*%@${*g=C+#pae6Z=7bNX%| z`8I(lXZecR++Q->{dvCUUTNmq6Z#170ipnbKFm_fn0BZ__sEKTAW|&I!pEd(hJoERnkgoF$w1$8pxJnE#&0G7_!3j% zd^+>|aa0o9VC(9<$_<@c`meP$*X5Cuo8^f_9#Ytb}2nQ1;IWKE<~usR+^KCWS5KjpQ9TEeC&ocjI(B zzS5brf@D5GH826E?Yf>rx;Q7QM%4(>4HAR$OeQ>bMUn*&i3>za0AgiF4o1wvAvoC& z|KPOPAZVigS4v?N02TTI9g#c<6LiG{VzF@!=-U9^@9f!NW`Otq2O#ta{1-q80E6Km z0DvH|Xc`DO`7h8B-#{P$sDM?na=c400LBMWcmV8a7~5uf;q!7KMCzGOpegbn0PdA4 z9qdJuX#dZ>4iyL1|L4YmibmG&!eVAx-h|8_d$$1cKI zgaP}XF4Xx{zW4X{`@0UwmDZ!fw&OS-D3g5v0%*t$nzzm^LUmb&+>$}2foKS1yYa&x za;V9mBia|%v>KUAaiT~~DX9Nah6IaxygC$L4K9gIcPX>SfFlm}rJ#&>gkThq{WggR zxZu=D?*wZIdH?0}1DgO>1{Gt$t|9ttzHRxhxyY_)|0M&^z=h@HaAxzFiyj-mw*P?s z7dPei1K&lUx_tvLYUdW;-KaP2Jn#ft+82>k6eeIcov+_@9coHP-hX+uI^*Q80(s>+E9{`T={Q&8r z=|NQgp`J)vME1{ElQ+($J3)1f`{iQXF$Ve7i1PF<`bKkWa5 zldN@&^EVmySII!|6Cq|Z9RyqjRW>l3=zlne*hU)Bg_+HV3KNq6W{m%bPz+`<90c%n zC*T#*|53t}LhT8_mAh7cU>4#2SH%Fw_MKQs_}o z5D;`@c@m^Cxx6?R;3v;d8`y{mXktMzI9!J^f$Zg`3LxnE&whWSj$~Ou!nX*F{cGEO z-;F=D-Zv|qsFZ(*e82Z=)_iaoU`_Cn!m!NrF01B`ho*hz%MqfMe_zwc`X%X&u0r&U3A0&gM{6N)Cxi^X^x{(o z%mWps4zWHThZ?q(E}7h}ew)7K1jK28%8oEyg&_@MSkWmn%F&csB9m@PtEF4HuuOwh zg4&k_?IDNr4=a)iU#DTosHtlDuJz>F&lc!@diJmnU>iSDtdYN}#9Me`k8aS4S((@H zC}7NCT(4Ibspz_N&^s&SaJR!gOEJ?>*FU1ies(9}SG$Jj&BYg7|9auQuq|!`*lL3{ z&H-ZigU7agV&%JGdXo5{C`W};>%!~CzP{Ebo9ka?1LC@5mF$8A#8$5{Kk9m)c{XB@ z_KaLkFzTLRX8l?v+Mi}rH_6Je@Xx&8OcwG*30y6v79v5&^BZs=2MX|222tCPN=H4< z=%_@T^Ap`ZLZY1hrA9R6+Z9}-Ae5fD-P~$Sn>+2%?;5^O5LhU`GRu!Ag^;9uMjVQe z-j6OumAkLa7iuW=oA>-Yf6hO3&TV&`+}KB@?H=;xO6aNIj;%UM+%+O#OCK)mW}x|z zSFKU)?tr_puM@^9^gdhwHDo-l@_F0t?-Qj)dAjk`XlK5mhFQ|_deb=-pZleB!iyH! zRo7h9<4YdyRc{{w<{n)uRE zcb1+uVKn*WAI|snmz4(VClTv6i6!A0jm?#LSQ7S0IMNjfYcIWZGi363Q6i>s88>%Q zK(mJT(k7#h^EZ2XW3-w_V(=KDbve)lz6J#wnl>QR(NYMI7MDgw)h)jBTRMr+evSLY z6;S7R$!E?P#5jbS8cyapc9T+-$-Vw8yQS3NK9`;H60SrhLw1O^FKoV@)yyCiQ`3UfSc(h=g8&OtESeWr;Zh4V)In|dsDbPe zV{u7&U%B1Br#b0peQd~*y}{&^NvC;SNoW};F|ldK)bf&&?R(;Pnu99xzMeE+FOq6y zXINY6vs9c0s_It?$Ccss6SdC{sH5zk_N1voNl&Wxjkq?v2KtFqxsb(Y$lip0wes}G zb{;n0KYD7zkvJn1PHg7=>nUZ0sr^y1ul+>fm$4^}NTLi>Mj@Ne!xIU+e*f~U_Em@b z>1iJPu+sDJdZf^uh&dkS-Yh*Cjjl1yy9QOK|HvHnw);2C)QsrL6Lc{YV`6Lw;;}b= zn%DY1n3^R?Gs(r4@ZGkydq;6y7!^~I2*UaZ=THUO2S@~Jh>!t7O`;ehq1td$c1#h1 zPvG+Ruk^aGg+&hB0t<$tKaD+_km8*R(3@~o*nB!Eq@GufBP|$BhkP5$9mBA5xKJiH zpQ?C=W)=!vmDMa-s+3CRdtBA}{E63zsDWbHvya5wF#?rn)=wL)(FUE&Wd~?na72%X zrudva^_0V|1)Fjvzi^cHRfW?Sq&Wx>YDz>!s!bJ?m+_ZcEHCR#R>?9`7b@tF+zw&l z287U>rKW#IHK=X%Ud z)gs5@igao6L9d72u_)~~AH8_q-4< z&9Vko@;pM97L3>~!HS^z8iau?vgjzfcd2qTei4G3D;0R!jqQIkdJ=jUraq!2bNh88czO*zKo<$)6E-A6r%QccY)^ff8_AFu?hKj=<0Sl|I z<)+MERRIpe-}`ntan4L*ERu$3&EK*{i72}Toefaek_=dtG_X&%q$Vwz9<0Wo%Z7jA zZS=3#Hl%x_gqIcavYZio87%T!{}XMwmb$R4h+*Cn+tX-CTYc=XoySoE8h`2r;Pt51 z7yA_EB9FWHhSy^ZgXD)ae`+tZwwAGDJ9wD7eRuE5)IHn8kzAWXW(_!Fn*U~#MBkyT z;JR(|)>%7Wy()u$qd~ZqGaA{-O~vzuHiDP|j{D>Kb*>T@Pj)I!Jy@56OOH(~kcKT< zgZabb?`7j_Gk0aE=jvI^5s6v9r{=ZB!m2Ly{N?c)DNb1AGleD9NnHP|^CPxVXPb4D z+nZeOos`UD0T-d__A?~+dhYUP#0_vTyq;3xgHK!;C{EH8*-zYeKS>#^BDRMMW8EfO5tCF)W4 z+Af<`ajR04N{98?T&4(1glZpqJXf@vtqI0Mg%pmAyd+?`x`8emOJfx-F=gN zAY>as!j9|EKIZuo(T3*8y_1NE}d;=>Y7YoZ|Z>l;RyG4XC>(&%3J~TV(hu z=u{uah!to$x*Z0);Sj+N8?yT~v&Kh5eS494eU6`kVQ=J6nj+VW)Q$(9zTjd5;3!Ft zk*GL6A?ggd?|Qyu*mNU8EF8q#rn%Zmwk){jKIMSNm|b_?M{3%+;tfCSlu=9eM1897 zs*Q;UKlz-{`Z;T^qUBf9t%`LVQP!x+E+z>t0{%k?SOhd-0sZ0Y)7yQ%DJH;sH_w+h z7fyPxbVnN$Q!$b~19MKoeKPEiIR(`CI&c3r$#@s>06H2Mvb^~28=wEg*+v{1$_>&fnqVq^Cs{^|5DeREL`x%3WtnYfTb2Va0GZI^XZZQ@-&9kjpg># z%QVFm7_J4TzhGef+X#XRG@#*N1Mnj)TadVx7HEx#Ql|Q03ee_DI0vc@jgi5C zrt(AE=TYjzgiQwVr>O}bb<^GgObIi=hTN&oDY)$Z^T4;l%`CUarRnjDd~6%gNFDfT z>q5I53xFVSvHKV?^*GW2IG5HwYJr=Ew4yRwsy={Gq4dZIjAHsJXVyz~yW}xqG<-;5 zG-*JCj*p5F@V~rl;?^9(e~{=9e}oDXzt`1!grHrK9x%=}nr^Z+P37iRF;wan0q*;> zqR5{_WBwO0bYL3oL2A?YRwX^TeQMs)+ZqC9+Xer2?=eI5 zh@7}jFLLXYqW#~u&ST5x`{gk(f@onon%*ke_9GqdVM_-NJ{6~NE&c-1DA<7P!$f8? zMeu-t>R90sFuO~{g901lRa#Mp^rCx_KPjdFP+vWIAi8!uD;^1s0Z@}_yW1w{5upurFKQiN+isYsX^5ckIyRH@xp2q$wsN6e1H5v%X6Hb!f& zcz4cRwPh^zGLc*p=%G2<{Is3uSu>i{CylsVpMEbQ%dHAf5LiUi}vOANigPQo4i@ zP;daeo6dTFfQsXhlvqWN`ueBTxJAw1R2kU+4<<#+z8(dD8*?WPwT{b48nn9$*HzqB z+sLKYjFS5wyq0g(kE3)glfINC#c`ZqLcHt&{q-cNr<=6BYV7~_VyfUjFX|-uYo|?V zyMY#G=GfeFnq| z4GQ!BJM3*R;mU>UNNiEfE~>f2=rE606u&pfl~bA&KIBX15=LQ?H-+FM%)^+tqj=Lh zE;=RUkw6nS-Pgz1aAA*FWR;GnCpS10Iw$~=5Iz`SMRwgczF4}LxsE2d>2JIi1CG`} zymQAP=n$?T70pUO+}6MvFtjS}5weZKUn4*qkI9RWKQ_?zdwT%+XnT3GM6-F{!1j9a zEbD~O1sS-(DpXr#n0lO?aos>j(>q83RsAWXuM*LT3^UkB*!{eMP`2MTj|zo>JG>cQ z(9Nsifa*q%vp;)rs!Q=qI}*T!0l3LSGrcG4g_ss5Hk{n23|S@MB`rFE$1(>FbXbvt z+F(Ic>LwhM+yzx8+7oXUeAFAH+O%eFfgaq}>SfWi!s(^wj1EZErIb=U`Q{Oo(zDo@ zYR9NE4H9>mrQX#@eHJxtef0tusYki?cflgzUB(V4#)WN~(D|6yT$kUB`F}lKS=duH zc3DJ%(&-HSh|Sn)CPszpl@0(6mCxBrpVP&s?zxP$@Tf+&(7hfm*pdmXf=}}Q$F5Si00oYWd165xOw$toUE5@XJ*IL zGf2|^j~-EKCu>VfMpB-!AWKJ?z#%ILy5R5cAF009zpM)4vTLJ2XQPB(He9Y>k9`VX z>2#Ul&LOSam+frMEbEL!Y^YD#763kO60$|ryBSxkUwjPr#@OpD3ictEr^6wm!ZG!J zkMZq+iGC<;9?m^cmoGQ5*dY&4O;HwSe`>}%EM~&;IyWWNOeUTmoB+HFOq2G2aUNe( zJuBPbd0_?8tW?dX7UigZL*@>mzVNpqhpCk)&P!L9YXbR}&k6}dr#PW=!6g8vjI1Smx~vdL4U(KQm%*K?0r3^aN_zk3vhF!6B-EtdpV0# zFq$v{s^$5Bh7|dr4g=0h5Vf;fGAS&5tZF+M6*`0ceVW6jf9F-V-+Tp>$NR4(TOL_L z(y+YLaL?nxi3Ol^gfLJ=Qj#YsMklK^Ev#D$D4~nBVk3BYN#(H|!v^(1jxX2CB~LJ? zsME7i)Ae2XJ(pgshp5 zT5XKGJJ6@LJxBt*&8SEt<f2^}64J%d(faBtJpoLJ zD_+b{h;Hh=5G}NMhJ^M%j3f0V9QH}NZW}}^MFn`cl#hrVU<*yu`uIc1U4XDwiM}cp zMTtgg1v@d2X4Lp0u8Q~F#tMWAyBG}my>cN96SRMfhMleR&nv2H*u9Ry( zD1h=#OxV4tnc3|LbLM|61|tx3VAOG+K6D&7A8MXzBXm8XM-I4_F(Ff-2M>2r_Z2X` zM6bbxSQ`OptccDf56|A2Py91XB8(@LEfK=u(FuluU=_fg%Oz3LtXO1HEd78mw3PtR zc$qD#M|cXxQ8@MX0RH;LjIraKGL-%1ag%e(ZAmx)f3A!!sdi^S63%2Mu}vOYfn;bw z3Jo*=fCs>dguE*!Li^r_yvqh>KrS_=LjNq@R`|zxMyNhuXnB)sB134qTWLrR;4uK% zeZqni(1LOQBH-xv!9m2?_#dk04}Kx(C2-BTQffT0?5tEirM!6#042&Y$1jczJj0pB zrp-$A@qrU0XCnajbqFC)!H0T;whQRMsRk^I~E zZhX1xC6olBQ2u_~am-aT@Zlu`S4yk_*H2d8amaa} zyTW+i#{w_G-BtxC13WNSDQM?NqEnJ(E!|%6;I|~*c2xa_U*1xMcV2o1x5N2BQ<=Q- zcFz#72SC~8b95N#>z}a!xWaAwMPCrkoZo=%4%)XUl2Ij`1Z~IYIjSp>B9>?-gnaAi!JSs zm&*evIVE?+Xzhj#SU?j2H0)|E7Y7dU0;s)EAkl=;#vB^cxmd%XI94Sz4G*WYOzB!XxkzAB?5t)#6AniIO_2yUg(r7WyIJJ2m!8^FKNz+1sQTc za;jMP_>eC2ACd4vdlzssqodsg!iVU+yq*?3a|%ucvi;H~$9ol}ijvhNJ~GTb@hHi4 z#36)*o9l4^@un+y{~u#t85T#=w7ZMDyF0<%Ex1E~;I_ftg6l#OAh^2)4el0f1Hs*c zI|R4jb~bsQ_x-->oImFe%=GkBRaf6#)ze#D{Rwc?fV!T!UBLKH;{c##`0O_S0Oi}# z+VXlKe5JSx?(5HdGn#<(cbQ|NHR+L3Fy7x&K0!C3TGG{?H=Vt$?Yja(`}YNJ=jnlt zdkgsL-FK*xVBu>Dw;!@*_+RgAe##*c5zf@YY!K$sMTQXTPTwwjA2VfJ9AM)wGBDKd zRFi?V1D0LrI_Z(tAx`9whx4F_i*qzqP#PMVMH(O_$$yPni$x=$@J(xa%-F62I(#5{F0-LPWs-&?)&kUSQWK zWp_iKJ(^yxEp^rM0+8$VnwX`vVufm`vy`SgEn_-rZ-^RJZ#NUx{<{hmB+?W3=zZz> zXn$#Qvv-rwC(@D^>{rv#0eg0KmEOQff=Ylp@lO?RV zbBb~?N-o|??-5vhG1kLTK_wdsMjC+kl<&5I{?BKRkJ~5D^F3GQgV-PbK{zUyo_@^> z$?-!id)3wa_k|;$>4EXy(lBI@9UBFnTj(#WAeDW(Y4r*Rl?aE>w){N+gAzlOjC7&5 zstkNND!`ik*KuS=i8=%(bP)176d9yA=%pD$q+RauF##+rn0e(QoV~G_CJoEkNHA`I zId(F4r+M~;cOO8*6*6Qk0m=$yx`3m<^r$h{ zBMWNlIy%UM8Um02f5ZboT2O_RD@P)BkeSFEg7{M-XVpu3;5a*oOfJ3>tG)kL12j^M zmCK%#P6$NL+_L!<8(9O^iNy8J{*uXyYeqd)@M`)n4x!&R8sopm=KvJskxUS;2lIcRiYC^ zaQK*Nc8R(HF^ljn%NP`V#N2uih}h57PC$!|S;DD^j9pP9mU@H3ivxS=K_d2t6I^>V zJE93zw8%#~j(e5I%1sZW5_h?-a#nkdnY$Qa=OD|^kwXfO1XORFaNhymp9V>2MoBjP zV+46Gkrw|G3vm1wE{a!o?Qg*fIr4`Pl2qlZ!EnhNN(fO@Kz`zIw^u~!pmdDwQp>2U zep+a2-2RV|7TrZ;1Y}$;K&~93Jr%yTxWcw`Qj7 zuXpSzuZbYvP2nKxAqXemudk6HAGaUodLxM-TZD+De)2=BUE`E2l&4xo6AA(1gi3hG zJjVnO?vRH7n3~sQRXHAJqpU2_E1~T?QVKfRbO7MTFzTiYSb9TnxStxb$KHJ!SyhG@Pk9Jsnq}HSxDhdF-6CT9z z?Gl4I3x)D<#oU?hwOG>A-(P1QPYsqIPk(vM&l@-{%^KL~F+QhGfkVozvKx4ks)UJ& z3l^Jh`JOZdRwG#mpBhx z?%v17gW9a;#`YHf1;ct7>Nn=QKy#oo%aHfW_kyR?LinhxF`tgN*p#LZ1hhJp+ET|~ z_yIECM&- zy$eJgcT!0A4?-H}Z~%eg$8*hgDodp&oM0Ep#JpD}j@W`Wmcl77&B!kdNeE-J?RqvJ zF*|h}{Kw#HR1yTQ`=~KM{jOHyKed$;x*1&y(rerFT< zjLBIlR`%l7^Zs?Jxu1#4@vY@);eL8W&z#m#9 zTH0GUa|6n-^A#pCIeX{O94}KL9*@S*yrBBF19D+htkCEeIDpYJS85{EVS1-B289oR z8ZcQ|FSKc<8rA=3Pw{bV!Ot6^45m>9fIB=plcVR4Z2D6-aEtw51W{K(wxm?lB5l{ zzGg$Ha$DtnSJlX!{ZS7?*NV2IZWf?XZZP7{$lYNzslclkJ{`is1VC)R8zE2za{l8< z#b9bwGIgIE1@z1G&&D-_KkW@D=?O{0o~3f4v7xoV+i~^#3pr=x!F$ksvCZJ7A#jpn z^@`q-;etQ0C)vq1%~kG9Oa-#OWl!WIzY2RF%;(MsgG%HA3kw7Yyl`=}47y1WVNak7Q#rc>Tg$p%X4U7!tP@g`u=P6(z7YqVC;-wv`=C1_>p{SzL`Z;^yI7$OXBN2B79Dk6NSU7a zy%H?Z4J%<2`>w5t9+|-#c{7zXLel;kN17{T%2_&MOXtNZ+Ll+cva7arSid2^^aj*_cWR)h1Y&1@-?`_AEXVF^rJV=4-TYq0$oW-w@$|Z zb!7=Sn#{%0;X7FwIV9X3l^JUD$?p_&W04UiikrE2oj|@xIQ27sh${BwdbR9Swmhl zU4W%Eh+hB6j&A-3`RrFKi%WgIkVv=sehjVG!$w+dz_aBfSkB?9`H5HG;nDx%Wyw{t zV0(JgyFtv^j+Iys|E5Agb#oP%c4A^#&v3~~IA+BKseL@71TMLdH3Wr08HCKP}=Q@#{vG^$HT38(}|r? zuS?ix8teg)k&-t^ka#+9{aG;#M6Uv$!AMhv@6#8@egYatx_w+&bK}Hv$ws7H{AfFu zRG;s6cKRew3mIRU`xKJobbfH^C_YAISfSn@N>9G74kdcMEk?qr$`JO+q5JKOk#A5O5rwGc~eK*1S9yNYaDKVE4A;_Q!C(UV_l zrHY9TGcu;}=bg5rZ?7Gzvb%LvCzaIJ@2vwJs-SCUBtY+`IM}l!*!5faB6>jXu@&Xx z?{UP>lKzaqnu`lKqlrKBq*+%rPEp zxh?(5tpEuNT$G79z(a?6vzz4HgZ6Uf_%l<}t7HSbhJ-{BtEc=Kd@8GkBSk|ph}O0L z=8~B*An@jI+P}zceuDnYP{@6punIW|1D%L8`bP#4MTSu5x*AnY*kC9mpXi!fXfNL$ zL;P1u82tX6z=tuIecYd>5K6Po5rY(C%R$ZLx5o!jCApZ=X^PsVg-$Pz&!;b|ejX2D z&#@BE!jI80;I;OTNJK4&{SV%BHplsm<`cMzKYN3BAcHA<)k`O3I+*LPy$P+N#fpX& z)9g<&SEdouWqfp}a;qszii?tA`PCkZ1o>^KiyRmfcg)3DvQ%CDJv%|7yfx?Q0B9_Z zi#diHHQ?p)GN{YHh&0mwe0p|PS3Sqy&EsLSH&OS6`vtm7uWCM*&86cRyb4Qj@hZkE z8K(i7+CTVrOQVMmXu+k-L0{_?wcW)nz<~<1P$^ek7hQ%u91yo~yuv^SeyCLM^E9q+9RrW-i}ZW5N_EOe1sxdBo=A>W z^t&X!udZkcj$&T^CR~lntzPs9FROJXJz{(5ER-qSs&aUilyU{6!vbD29H5l$H`Abp zyPguGFy`BRfV%+4h4)JVuzK;kUht~x&=0-zd;+`Q= zZ|3y{Dv-siWD-v$N_k+2Rwox9*iwN5Tn^gHT%M| zd5~ykKRszlD|EgQiYy2Wj#dxE@Mu7>9BfA39FYQuUtAW?hJB)0-^*R|zj0h!x*y)_ z5`EaD?6L(&_}!7YK|cWmSNpd@=4|;y#6|e)uV5e-F~Q`h+A4Ki6TvRBfU$ZRz>Sed zlhqlsNTo;^Z^dUS`zGW--{V8GcaL74Bf4krm|%8VH_IG3cVXr9gSh<+D6UW)s#x{H zhCka(^M8>~f(I;z^8&(lbsR=kIpEfvog@ODGm%4s{I51kavy}()t$S5$Rz&)l6+@d z0|@y9PQEk1iV@dmifJG-!2~-e0GHp-E@V(IyGspi?Eml{G^|4w%6^(GQ+!#HADd}O zVlHQv`v?hBI+tU7HAE8{o|$)lqA*y7E%n18!e&e;E2R)9ID_hB4)+26J!Auw2DDB= zc4{7%M_Oe^A%J-W?fib=lE$rJB3$q25YS(j0aow*EYL;SA3(8bmblk@J0CZ_;7rZG z5Oz4_iEhna>zVjinO7J^W7fsAN-%ys3}c)Z0B{-?B1=bFU-($sb2Az8{R4pLzl>NG zjTb6}=6Zm`ra@*k+_%v%`M17+tS=S-d%wi#E;A&7?73`d^y+vQ*)9D+PRA+I%H15= zQzS};ISl1emn2irdj*=?-0D6uN8C0h#v|lld;A>j0B!%FsBh(N?k-LJzNy)ov3Iz~<;O^)T*7S7Rc=&VI41E^v z?#DU&Y6`-27g(Y}Etv%9?2%zue+FES`%`^&r2jkZrUtC{(*64A>W~T~I41ySSeTNF4?y@}KYsy~yMCAJ*OEC7DxnZq!2HV|}HIDo$^@*=XW-#pt6#oUB&H(vmX zo<{uvGV`#$>wqtSHNyg++ls+J{{BsFrh5iIiN0rHU7R?s=7b^d^Yrh5MoW=sJrRbh zuidW6n>9?X*QdW!g~XpZ9VFG^UHp!Wss2o$qyUiA#Jp^kOyoSdN6U!$b}ntYAv(hG zG>!Un#CMD*=WRaHLzpCx^rp_wLy4IqVshI7)yk&gRG7YztI%;e&lGkn7S|f2wPjd!v_q@8J(`7 z7#kgd_7hP_ecv=q(OR(nyVw)6#?#;5<2VpWlpHBCUaLtdXV-LMg6qGsYk1 zxHn+jGq2;Kp>Za97{f#Dl69XCvzQ-~Ba^7Xy(N$XfSMlAfGf0Wg=%DYsxB4gS*Vaj zp=xSiQG z;qFq|&QsTCTSO@Dn|@T}xXw9RzKUztgKI~$oB?+i)YF^Y`w7(n{-df8 zoCZs;McuL)?OwOtw)AK(Np>RK9U^6oVA*JyAdX_AgHmM*P%k>lh37}8Gcv400zYg& zR+Oh)>yRT=pSkCj;Pi>t(8_8ceM(Auwe>-grHAPK1>nf&K$Rw90$$BzP>`(bAaI*W zM|ef*KXAjOmQ;5f^($~-z?Kj6aBD$DvCSYO#>S)loauQ=YgeQhhUICF-;uSDXCnqk z83we>1FVc2e>ahduV-scrF_9mJI>Zonag^A8IpbIl2}IT(ntfazFR4+|Gp2P;ICN^ zfBy;jFh`F&91Ikw!2+B~D@J%kymUR+UGhxk@B@@7=83p=e?j_XdTGRVwZB3xljtt5GnCR`;Rf; zkW^O`Xj^lZR@^FHXl9gAxO2K>r93q`MJn1J8+yZlmsW)Vxsn3t%xGz;9I*eYEOzc5 zveok@GJW;!jDWH>EmGK!9Bi!rk%_4YevqFW@*)2FegX2ouA#FXPONcw>`{6NVjTAc z^mM=qS8VB(x$VQom2wWC2*s|zf@HD5vSycxP0kbqCF)N0<2b-Ax|n;%}>X$wSefaPT0JdIT2 z8S((6d92kMAwh%%T=I*(MW#{mf0@40o~MJ-&8GSN%vHmT`T(T!pzllAjhO)d>xWHE zLUQILQ?y6OaM9>`Y?NcwEceAd_Y~7qW%cYKrI>F4Z{Hk71`0O7_oFv?aQW^ zTjx=z<)f4;Qst$KZnHg?N<4ziOJI`$69+-a$Z;pVLtnCyYY2XgeA+klZS#f zudv6g>lFk*@WDdg1C#ie=mT~uRn03+l=w7(jXK*!n%W89WI&U!QS*m6PI8n_Q+{q& zIcIS%l>eG?vK#y7r@i~}t^l9Q$A!#lbNXLVTE?n$=^XA4xTmAC#L;Snbk&pu5N+}3 zw28RTB(p))FG&+$1-?ijef}1gHHk?EnJ%e24CwxdIwYeJ;C^#m_0Tqx{9Coz+DYJF zsJl#6-(^;ttUSAVTs|FRN_54f=8+mJ$gFnx)n}iIgs7F3M+*790Vp5E50_u4!{`)s z{F0gF>!;)g_b(XZ_qFs*FIIe$`#LhrQ_OOW@_a-HpaDTfUlv3%bDJ7@qjGih!DXKD zG25-n%E*+`;Zzf6s(A;9UmNf~GeFE3u!m8YGL>wLSnEK+`SA%W9d#CT$}6%;{PiS* zkFXlL`tnZ_R$_a@ibrta0Z8!o?NnKU;<34xi$W6FsXv3U0Y9gg{CV05qif5(5NJm2 zy>pm*C2~xpZ}Dma>2e!r9=E%{W=&P9zdURY-BuoU?O z+GKl$OF}37e_A@cWMuBK_mfa6hViCpaN8-Cvin=5`TJUf()8BL`fGLZ9lN6svpZub z?n_Uve%`bQAdcBp>anKs@aYt?3cN@Nii?|Yi(%ci>y+!aDzTZ45hC{IdOkP%=dN6r zTVTLI0tnvarjayo&+l)4X{?E3$^8O{z6?Qv{tgaHfo^{|>^|0V+qI%tmvnS4t=H`1 zK*3RKXv|PnY-_;F{FtcTn`Le!O4w5yAQ4fg->9N&CZg3kG1Qs7pWdaDp6~To_nf6W zv}1<=IB8axG}7bbnLpeN?Up06&i*JslxeOs1JQ*OS;@>wapj|v*9S@4hMABR)&+QPS4iftJx>JOjN z9K~}b#@~*}(7a0yVw!sm#{*hNkOP2{^8E0bE|g;+B)<`PKv5G=o=^gFR7?O)E66Xj zC;;T94KDim&%K-tRM#3I2=;N%oqF^(|Gxg6gbtnu8nyYC)}I?d9~v}fVM7*~q=#81 z4sQe+l={EkqlHFF_eA3G>U}7D4flT$fpQP|_Za|^288{ifP%lwz2G7Hla0rSN5KTk zpvaDO7H$GGHHTwpKb>rx<^PozYo8F@xRd^+lpeU=h-EyY_6FdLeQa|p1o+=|aKT*; z*xX$VfOewdAbA2IF!Dl%95Ts2@>WP{QcW=eUOJT&UJ3qyX2ztpu<}qE0SB3iY?F!# zzX`WSoW~kJiSPTq<`fxk?KL+*`^-WZd%I;FyL_0*VcOVj@`h3gW>c30I_{vv0P7U1 z={$Jfq`w0())8qhx6QpjJYjm9(cCIIoIPC~CeDlg3V~)=({t^;pYL$;UhsW^SzDqk zMb0uxgm_`Xq*~5KLT*^<4`#nxcCTs2He&{-#N*ELsHwgdm-?4Ojx~fDWBsOnvZrw( z;g#eIwerLuZ={6*Yc*QyySiBw(cerHb{@&E>!kA*^8E-Cbdkse42^0I3+=;3S8C%T z3s;CcX#!YHH!~xW_nS)8fY$s!niOxUvc--PSX)KBgpFC)2R-ZTn~ZF2pyyQP(TW*Q z2OX`(8bT&tVgwVa$&62~h6I)Ta0J~LrJ7{^r`>H_QoCWjFW|LPwrU3~WKi9C#B#2} zQ&x6id#j?5snW`QR&n6emyI^HMuJi&DL2b9b9E-ac)L@%vYs~w5l+RzsingrAO9i+ zx-^{|5>sifm52ke@DOx__2%H0#zOkRhoCe8LQjAJG|RiWJDyJ8 z`;_4}O<Dy(E8ZaFVP_>nKjl@SA@+{0fH$20ot z(*DbKxu58+g%x3b_MLbOMXbY_D--wS?K#*q{%m<8vlYKifLo%5L}&U9PaV&V705|` zG<@dF;zyBQJbnVG2Yz6iNOSV}pQQSrc$akqU)Dt2>t0=7@Lmq5tBdJKq4 zwMfFO+8AuL<*tV&E`lY47+#{#u<*ElT%yV(b)OBI;hl+!D%ywRFSC-d^XA^11L@jp zdHPQuN+w-%OMOdaRrgiTwK`mI~4PU+no-GQ2vxG~~CObz+2( z{_jYpf;niNu<2G-F%`Xu68!3F~lNb|3g{kk!S(!RMz}xn70VlRBo9@Np2f?Z3XFH1l^EB z2E8(HA*{RekC9}(Im7zBSs9^a*cViFrFI|fy?Hlh^cJW_iO*+1 z#qJnSi3&Ut?PFtom^q4Jgr)^<@2wf1+gbknJmotXf=O?VMp`D2H0kk{ud|zqv97FUUcC$ zpR9)df}VI|$AbdX_?}8Gt`BQrjQ@!RU|As53;6Pfi=``7Lkm>5cF+clG3U1X{+=}c zFB-YHN#^EK!@h>PuMdYCLW@N=+DQLnx-wzT?#=4q#OfQHo>r?Bcm-8xWx7q+FWO&A z4=UK$Sy2h*Y5>u$YN8g9U#$){LLd>;KhyS>aBtL|8 zKk`Mk$=Az+um4dN2o47LU#A1TydnL^*wZz1kU+i2A43YQ0_bD{*bnnaYbjfZDLspE zQvUBp*npsgO+tb35xasf$9ry;?G*Ee=ijiat@8|C&*C9wm->OK_jmM`fKfD|~ z#!og0*6LmiTy)9J1^$>{Qbq6YcIx4GO684m5OaDX?eOkLbSS6n{NWYEH2A|4L~@-a zAiHwlU?D}PfL`%aU8uLD5(@f*B||^|*bsmIhlSAcToqI28VNTEIX{fFJRYV{UgbnH z33Efsh0xG9Dde9KZ9=0zyk57b0{K_Y_j1)dFcF|X5R366h@gdPVE({V3YydrR>#)m zKQKjS##xu2;HSr=vuE(iax4ya`tE5xki39!S}e-%iAg4(U72*}uoGGo=Qz^%BL;ny zq5RTaB$0j$ue6tB|0tEQ_{o8Dv10hsn<~N|OpBnw^~x<8CSx@g*AcS*=|Bb@f16{l zXZhp+zfIN|CHBIY!&!0YrO_4#beGW|^-qPb5c1%WP4Uxkcd{u*7bQr=JMF_6irInXJ?N zCJy+KPO$gp^umj5Fjjq5;R_84qR{tXGwZmDSug19Ck$Fqnq)b zt}`M)J^P#S(RA~jO)|nJjs*?S?D6H|#zn@BK}A|HD~^5YR)715Qj;`VrdmAR&6d*b zQGok{fLoRweyO`wmQuuR>Y=rTo}GXs-A1B;US+AeW_}t|uEz`WO0N5_l1yjQ?J|=7 z@Vlb9q+i<~x@wRDUR3FBo>HAppU7SjCi7fnO1!h(NVla&d?imG%13g}A~eQP{dhi| zoIu_9u3h=>Ry**FcQ%#Uc?S zYF|&52z%5GdzQ$@w>xO)a*pA(}q3t$(?;Pe&~MySjF=u_b` z&5y$)Bwvj&Yy2_rv2YUNpYoILOBalV9bc=afRM5oF3^m;ufH^Tzql*SptURJTdeA? z>@FvJuUzrNoJ#y)*2=+WZlz9%4Z28-ATAxs^b@sfth-rtt?m8gL9E#R1}U-pG$KEh zuz{-r?{^RY0M;ZQMs2F&$V$9q4Q@BftL3Bj4E9>wAzYxkQ)~6u`B|h(Uw=sP1ol*e zjR((_1=i$p)!i?3j(g)|p7B_UKxee?9hYO-W5NvxHZ}#59(^5Z9@Hlu!pxX%`)aRW z{I3J8XHG2+{M{rb3*;pePMazV1$>5-b0BA%2A}>Eq(BC@1b@>8oOp0qj#wFsPs?fs6-0!YNB@*u0)TE2L%dW=O z8^SG$U({l&*!n^-xWe`3ZP|D3@lOWvJy!`38gu7e{V2CmijbEna8I z+d*_#nyF8-iurer6P2X>bA-vG<=($j^zO|1S>(}ds$wC;W671!9d41y!DLDCIUT1D zqo7amTz{nSmrZ@4O#-LVH4_7~-yDt<{SHQCI-b}iY!L(;jELZb>b@VOfL}vTc|{m? zJp3ktye0?qtMxk1+Ha2gS{=<~sy^&(#}xYa?7f+~u+9Kkt{5cT4$O=kJAA1hjW-JD zg04C`nX?BO%M~UJ2X60^mJE!Ik(CpevMBMGE3$v;ms+J!N2Vv~Y=DX;3^a$xaCqpW zvIz%;(G&Ca(Tcu8rMt!He&ti&@r`+}B?XI}sh-tJ^Y;j53Jfd)MGmk{*K?lyXB9VS zZ?V(lC%EGoLh*Z00&6{R_(ybr2=-8N@MR?m79X z%>iF(xl@ctToX2MbZ*CrFOl7$t`bMtfMp6yDuO_l%(hrFyYMbMqcfu}O>x0n{>na3 zk?Fm{ND^n0A@w1zN`w_xQhxqu!lp7(K_NSNj6%al7sYf-uEc!nz#2Rv&a-v2pXQ6R zg+RXwYg0DwB*p%CfoorOVgdZ_YqwL{%bcyadK_%m35m9*hxfv#p1to5;(={aLe|E0 zmfWth_g~jwQ!>AN*hF^JF-@H0w1n8Vy4`!|;Yhx*t37VN|8B=az{B)0wVza38JUjj zt(%5If(HqMY(0^Z#$>4CBvf%i%y{o9;XnW1ipvAuSfP7wpma+92%joL`l>JQ%1DOuqW z&_oenO*&z&kBV=xuJ~FvxO2bTY2ud?9j!6_#77Vlj5o z{YRxCa;TCL@m+ujXn8PJux$c0h{k@e0}oiq*k0pbf|)_*u2ngrfnqPXpqOKy>qZPB zZAjG$dDJSg+L#33SrE-zAX!OPEBV~&*Bym9$GlWxL!?=vXUnkOZWQq!T-fk5<(m8> zM_s$u-{v#O%KvS?Mz^g0`IdLYzf$<_A}R+1VKK+RZ4O4SBgzucZr37vuNhWh8Au!2 zbbmwY{gktuAy)&ht6S(-H!Rhf4@WD(ty><7X@?6roS-l+O?E>>RT9W}{@^~wtvNpk zSZ1%YcAxp>@(0s+&L?^yXNRwLg&mqJ)}hd0!d#SWQCioK^!m@B8eE*^WXkAudHOS^ zY!com&GGnGJ7E7m&}gCLXye4h6)c%9rzcCMQ0_+`#Pg$x zq_H5ehVJec3H2biazNXAipcmR3;y^40|$Mk?{soX4Nx5RT0;jyL3F}q;zy0TL_@IO`iQP`ml=-RBP@qke&w z-G7WO8UW$|G>5&gB?e=;fmQ;2}}Z)K>l z|62&X{f|-pPaW?#gk^TxFMlofdLWu$JuECjAS*@zfuUk#Vx$T$7JojQYdvK^zuTnE z@sZ-|qrfD{0@TL7SZ(+ER?>|-bQgFC*%vs6zsj&{fXVlg`HgUu6j(q~;gFvee{(Up zx4CN{5uQJJ!H>xzrk<_4_P0TgVXs6#0AVHY_GGy$9fVtx71Vf<2$gq!j5;%MuM>zU z%)^GPIaF6w)eXytm60VdHhJ?`qO~yGHfdQv(EB*%Oje^;ziRSYThH2=JovD;Y9&78 z-6frEf8cuuVLbB53*w*?Gqu(!g3iCdy%X;#M)eC*_}Asin#S2l8tV&%zkliVZqiw` zcBt1F>xM=|L7YCRluPoNoh-9Re#8 zzZ;;ph43~CoXRzO?u^!9@eh8pZih>ZDO(lFFD>xv4o@ zLI?j$BMy-QKcY2uM1qN*_~bk%d6XH}Ndy0z_GlT(t^V<&llxAKE32~M8W=V6`RTDq z@buc5%@QKgJ6ba(3;$RgfkFi6+%t zK5K0k!%X!WKD*8{UUkg7b;A#|On*plw0&?dvZz0Fk!0^tZo*mG+4awCsOzY%M>Qol zE0Gr^;3T$}ErCmA_tYPbzn(aW_e6$|B7+s6QZZNw#`CM}K(MM6Z>>5Ysr7*w^JuW< z-%z1|dz?()S(c+&kGE9`C`w0@B&-X~BQ9FKK~6*ciS$jJPvjFF(93+Q(l`u`HD?fd ziUpjHV$sqS!*WIQ200;TuAk~`=$)%%=O;tX14+oin;^t%BW`{imJh@ux{9*;2Yo8>|w%;`Ozg)dGolv{#*)HjKdD@KiWU(1TPp{-=hfv_=a_u zLELkziyqf#X+L@JI78YCHLC;(f?C144kvut&E><@SRcO^4!8Aq`gB^wr#Mi}usiA7 z>g<}Zf1gPe0ak|-ImyC&Ghs`$Jv7V#mPk*S=AcR1i`Cl29+-Ug_oSh(!lKm?U!?r% zPw)8#GQhRojaML<80Q->4`GuF&{u@7AnJ`;G}Ctwx{;pv9fJ3W%v8ehE;^jiIIegY zo^0WM+Ky*H_Tte5;uD`FW)Q|k2UDelo`7;&_^z|@kQI11g$Ex+C69MzDQwpvWbrGb zM=n(og5}>c%jWQlodsCWui?)Mve|hAgHK_9B&u+w7;(jg%AwT>0W|jr;<}-uC*# z+;3T231Ui}MUeo$DN76Pq4&eI$ELVW6+IzPjyq&q0|>2sG(5YRZu>QS>~=1o@A&SV z-jv6Pp)&J5)){5RzFR9cH1IbBMlSA!j%I<9``!@G)R_KxplZ;!ckB1`r-?*~DUY1P zq}!v;f9hdv%ibbgAJ~)#<)r_44~s5xY4l>D%lZ@a8jll&Nb))Jzt8?i=xvn`#{P4G z1br6gh0Q68wVf>qq=nu>3!wu?^37iX{+38WNre0@1Qz_yTYn1kz_C>8NH50%&?_i8 ze>!05;VaPg{B+Zf(nan^H}hjO2DAPc*&Tk6m*gK!E^#_i=SlGb|6(ZdII0ljbF0ijD`!q@uq5Y^QEb`Z(_(9 z)+6{8Um8tCsATD#6NY$|moqePTFr+WZJT#j)$_zI3O=A@O0r*6pO7AL5#J1cmRAv* zA33la#53eSHK?Yv=VZEe+XZ7OJ9&M-MQAPd*m?ysSFM3Pz!m(S19NQ3AjPssH75y4 zaDst$K3%g?r81MMUieznYOEb`_C)y-k~GsLXT2!E8<&HHB}7 z4gdJPfIfc(9?B>YoKcBJkiXtM`eopW;(QP-@J72!)ha+jXB`EB8ZKYD*NaN{?SmRT zd{jGb2Oy@4RQw?xPZGj-ae{TCu5jF7Il`>}>6{2{5qgB-Eb=}aT{c{tEor4Rief3C zJZ3tSY=%jy%8)kMUw)i9iB&2qJolRnA~08hM&qp#^YXWEOa#fnSGaJ?o{xD;(0muX z`}!JoGk%?R(^dO79=`7o17BEmI)s&A?|krV;(G_4A2(jH8ovj|zO@=P3D%E_>98(i zQGx7CnHZ**7#NtBHuD{ZfZtvE>NLt4sz5xfn}zP48D2L_R;CQYtH5s6R3YAM$*Q+K zXVR~i@{aQfTkOiXgA!^HC%?Q7c!HXxc0z`qET=`LY2Yifp4he{Lkc>tV(8{0D~hh! z!ZfBdza&eow1#%4Z9EJXxSgR-VFB zXP>gFAZFX^tvxZQKgqAd+B9|za>Ddpn8^zffQQdKv_Fj?Ja>!yKBH;IFfAWe-tMbF z-Wy6(96}F-Hn#A3B1F2aR`+|n(u1HZkF}}dKzglda07_qZPjjEkVt$a^!zIbZs3+L zIg&^zjH&y%mtCzku;%zieh>e|J!Q;iKsx#UN%iu}cl^R~I$CRSF>!nlWzI7dh}->r z6&AL{8!J|F+_D{$bF|xBiJM#N(-@PfwgPPOCX}fp0+9mSU{r6U)Lgkk7_$(QkN!9X z+;O=qASHE{`#rhMc1Y1@@D+8@d`O;_sy2Mva{}07tE{59Ta1(e)8-QlAN==1AK;M4 zZ+M`5vi|Ie>+$`p#t33tG&lxMlE_2fqrgvZe&ssZR-LEq85QnvAA3yP*0_EzN^LaF!eUGpIl|@dFcI#tzUZ*=bwy z2mBGNW+p08XENefwCxf`&^1HyxVUxC^jioI1?|SQIt$Bm%uNEAxM+Kp#dlh{*k}Mh zk#SwoG)NNi_{0=wy3a4U?l6$y>7++w4O6AX!jEwv+}}EIbkBivmb%h!4jezm-cR;M zO1~{Ui=WAEedc(unqK-^g#a2KBb8$&Erf%U3CDzg<#PKr909u!?kzIjXX7Lf_c{IS zrwx_e5 z!D)*BCaxcqwLQ!N!>^D)j1J>ef8TPSDT+)aKZXxfXDo@{>Jzq{*lLkLB_f^6{AMyG za-SJ#{L)VU>&3qr&XMh7sVQP<%$#evJA<3>PUZ{#u*eqxv^_Kf23cd+t6AJ2dQz5e zEL7~~)tu@^GmYOb9$wS-N?wCQ09W_{KKF08@4o6)dIss9x3s{y(s%hvh~L~*PsF;K4^CkpEQ_nK34?@C^$aFC-bAak)`dY{ z&3-ZsKt^SBD_)B)LG*!ULQzt>X;J4HNv}JSLO}BeAw*eg6CnJgAjpV?VJ9~=ByMT& zHmUQRhcl8-m*_WP-E2F0RC6n^>s(4T&)It__k*;A?_~AFC?~w*n+`);jN~57s5u1= zYdkeoomQ%38=c(mArk?>sWhFV$$|HN5H-yZ0&oycu6Uj#G{@NKCL_F2Qy{9k!{4JV zT+D&$g>X5k000aEV0{ky2daGlG$A_RHG~TKsr_dm^xr}%5HvG782W+!Zy`9S9=u_S z0qE-QCoAp)oQbGKLmB+1_Wu_NXjXP8r)No+CN^&~7>I;EhPM7^hI+$OxeTKe}_C`DDbLt zd|32jstD6UHPv#wAQY|E9^LshcWgtQXcNXKxD6|mg_D{tG0pNl8EI!@!*`u- zwe*y)tee<%BySJydTs8J^GMW$V$4(C64H7Ns*OHIa}QqIXi~pp@kz}m)RsqV&buNj zsi`%Ym25BId$)6KnjeGIBDab8_%v<&VgVfAV&#aWSLCA+)hOcBv&e{57ASXUKfkQV za5o?U6M>ho$a&Vy`ajT9Jnx|a|-jGuq2fAAIgJg;mo6>Pm3f^10BvV z1e>#W7gd1ebg-*fD-ss{2#MaQwEGf=0OLgmU})Nnp2wi183p>fGIc@mq}H-1jsfY3spS@kb!O z%ewkn^IHCgx$vqhxAakib})sU#f5wKc8>M&!RH2r4oDFW>Oo8(AwrJQ0ebx_oASHW`w>wJIh3@@)81X3 z4C}U&{3N(1%*6DfmC?5pt)i#-$m-pw?y`{lwj~V1uKF?pmO1o(8Ins=s7BMlgV zWYy(df~3J&6ZD3JKr+8^?)CT5TO+I;fzk;6{c9aqHMSxtmsY@+yO2~ElZoE;o}^=- zKnlqr6*NYRm@^=e*<2R4|0F_ZZp5;jOO;mslZPqAyIN=cV=9YngML0Y=I>)Qvt z@8@~nKfd?6Sl2mw?X_lR&CL4E0`{I6Y2GC1W+U70==8{3T!YMQHsDIw%}K$I!x+1~ z^=4!9uONs(@<7;cOgdHJD#q<9rf1%Q`k0=L4$oj%vtJD<_4&ujE*m`XxqBkmAaj09 z+UqLHbo#v+Ke8&J-Ac#44YzfQKdWgRs61b2rG(m8g~xu#rlfXzI_Qi5h-*ri`{RZ> zVk}7+Hv|%`JhManoo0_p`}kRbcx5@qnaA%%`9_=4d61-(| zp8<;MxUEt9;Zoq+lv&jLsw}$Gc^MI38IPP}Ab_DU8$;PCM%ub0_u&Oyg$ctniE*4O zs~nNf##^_XD-(U8NG^3&LSyOItUAwVuyrqM9a`r5q_f@tZ{XYQp8F*jPA7MBNzEEJ z^Exs&ZMLxYPQP1Ax%4%SxT_c$PfbL~95Wsv!qAMPbVD|nT6m)+8`WOm67W8EFr*3^NeZl8aOO{7Hm)a^vhACAn|GeRG-VAiXL&3~ewSS;OIU`+sW0p@ zeO(DUhETZGGj~T{L~LAqex+-?o_(V@wa}n5#Eix*ey#u0GG#NBD{OG{UF~lS*IE+E z^iuRqo5H8Tix^eZ#0wppmjxqVzOKH*ZH~yBmGxJ{FDlsIyn;p*NckhP4@|6Ixu2{I zR-KspJB@#(^Zm>Qu)W=s^mA|G-bE<+`ewO`rYq|VlN*XtiVK;U+%(vLKtTwI=cEWe zJ=(onOp;JA#OK=n2?8xpU5XiK$UqOS2^2&CGhG$ z5lQcFgCLl=Ch!Kj??>IAMwscMVSg@2o}4U6H`v#RJW284dI%Eq1i7(K>C*>G3nPT< zn3{4_$tSNdxp@NuGm>wl84!U>{Qte2 zdwFSL|GkL&1$1oTtF?vNW1$U+37XgUS`>@ymM(i-2jGgmtzoeDSf8_?h4p>Dv%pq9 zRS`1YO|FwL9v`8c!Lspd6W!d!p;obk)2T5?t3VU0|T_ySgWYVvkGzjJR)vt6-a7N?B{(@}$sxT%h z_j?8AF9_e2wlnYQsG1Z3r5yMOpa)upW8((>pDLP);fbk>3*73(LUQM6%!3WsmK8?0uxB&%-Zwqp^tq2 zQsEgvI}U3fLdAZ)2lBOnql0@#TKTHZljjsT^psSkc}CvQSr?z6S%N-i$dp97a0Ioy zUw`slzdL_+_W2-hHt=ZW4%y?#{kFb$S~6|@ii-ooeU!Uol)AeUR#ez|TCYsmjy5k= z166sX&M*t8aY6*Ju@NAVjnqwr6QTQ&eg{d|d*8Tbsnxltvxf4!nzP*9wcMSWoksMc zqx5YI6%ms_3}-@*Np4oZN1QK>>Udbv6@*h56e&?OSi-V8d@h_EB>QAY*oJR#n7xbJ zvE1u(I(~~7Hf35Mmm%1GMJePiDCT`T*)Wuz7OJG5zSAAktk3nEB4-!X4H^|Qf-%H8 zVweqSIxi_q9Q+P&0qZs3Q zd|TdNEqML2&>}Zu)hP+sJjr|-g{iCdvN@nR`{rW(OA00Bm(qC5J z>t(B|>}(L%o=mTK)rml<7H&~qan_d%G|+^0Uug`_Mddq}@)v_Wx1!yIcFx|<;vG}W zTpAvXYIqYi$z`%BT4jRmG3R(K$NXnOB2t!+G%?J18%X3eO%ul1y04u`<7rK35?@*` z&rFuP6;0E0;d1TgS-)`+*fSkOQrQ%#S$S7={el7Ms`E_Og$h4p(Spriv1w%uENQ)! zfTh>-f>J&`8eYR*K&({_nV+k_YW7Ahs;&}dpg(!tZ7I0Y7x^hTu73Yj<6S_*I>}j> zi$UJi)eB}nc?(FR!14a=%X14r4|nTgE4SAQjhhN65>b8Ri|addm<>Ui^!!H|gU|MotzYET^S?`b zFOg9-F8dbY)I9lgx-V>QR;%rDO;RGkjb)6j{{aAhU7pyUnN6CO9jz>3>v62=^CEkE zEpEuRT+P#>rYMu?b_Hdp?OnSdUGR9K-v-FiEz8ou?7_*?^nDe}Igx7FGJj&R%|@iz zHO`(mqXJN#5#mzxJmJDb2pB9Q9zB=tO`4N3R(^1<(vZ@+`CN#PICH45A@-oSB&>dFk**7vm6}4_A6+CQSid;W`A5zoo%u-||Vbj+#qd5qOC5}Km z(jmPp37vguaqrWj)J@ZwzZp&em)0QJ_5jVx@)pO~~}_UIw@jyC-8ACs%ep_#2=Fj`R%+ z=Hc<*PS*jvPqS5BMZi> zNX)c7y(pw;Pt-EP`H`a%RK^$MoivsqL92&uH%y~sZOB|(c z5CfX$#t+{IjAe7Bt|acXen^3(z^lQ%x!{!G*iYgKCxc_Gy|cwC*;{4X*hFIDJ%5ly zM&e!Mn&$J4morz-0(+y95d;nQcVEurgS$zZL zrXDf0JStR%?CWLFkc=}zrL9#E4`OpDbzz-=g?~?cOY6Z96(;t@#l*Qg$YE8{Xr_xIQcN}C zd%J5dmdWW1cL>(uvEKy$UxHW5Pr=vK-{*;Y8-SdzCQZ%VsIW+_xk{g8`{;Qdo0EM@ z!&ycT?)tZ_bf!%mYT(J4Y2v)j-<>}XRro2YZjxue<$%&yEz7T^f>9$8U>4?W?Cfly zN}0>Ju}vow0|lDO-(XYTjkBWW;1#0A04Zid7@JH=9?=VHzO(h|xpX~VLmyd*?>v#; zY6t%ip@wZ6R@b?0g9PtV!l?GEU$QrGmfvuF@hOkD(=2Zc6maN5gq+JVvEO~5gGi9V z+SHrg-;)NJ+;=gca3^T*BV&W1_w+!p1uRNV#PegU3$92p-z36L9p)hl5Je>4c1DZ1f{37wLmV=C5a=y@7$(T{LKYB#z0?7fk|!B7 zFjXhbIe~{FG7%%2K_Kg`M-)t&`d($~jrp9T9oLcCpm1_P0XIX4Vl8q@`sJ$D@Q)n_ zzV61Lo{h(iEx%M()z}sd5fUBTU(G+7n^SpknLphtx*4}-zg7}};cn!x;FCu~44(It z16~B01BBjhvpX7;8rjRF`RM2WoF%sKmTusRGG;^7?zj#A?+^rcSln?Mn|ar_Zl4_C z2&a}6QTY~DZJx1PwlUV&0|Jed6El=iuie~~0t;8yg84M)N8b~dDGJVg_3xu^=EJVO zdJ{PGA~P>IBayWXHD7)`S=id^4NT9wGHWE+(87^6#=$gTX1r_(dPY0xIfwS`W_9mu z?P`n*($tHD}@2bB#!?=Hh5=WCT`wBVQKhO;C&9QD9?7N`4X-br8C@DQJNP z(PY;DnGMRD$H$-I`*d|qU^xP74Zk;y?6zJi){DO*zuZ|LX{L(X?XG^F?59sZcS?_< zHjFK$2Rluq{}f`FwTrX3fV%GPy_GG&=+HL0^Rny2T}i|Y^p`#gf?xtc3rAS@Gp5yB z7wvRr7d2I7e6%UX&kFd5pINfU+7)}GV>pk55*?{|mU?27T?HH-+S;9K5Cp4SNI9qK zZt5v^Sx0$|;NN_g{vI0}ETLg$#zHO;{#!7LRpo*$c_C}M@h5Y#ZCph=85g0fGT~t) z`$%j-53#vkT0v||Uyddn*~5|8nb&Rx7M|XYnlgzz{VHm7g9nl0HdZ#H!}6N#iZmLh zWJE08qS%id-B)!>6$oh#82oD^S9$bA^O;s6dOdvAHJQ5ipT;W+2g%bMMJlONzh7St z4X2dip!PJoJ6XO=rk!Fa?Hl=_rg#-9jJN9ekwW)@d9+BhG+8MDN=9sQHrgMbzy2_N zEm5lSV@aB1D2vkPu6&r|QAxkC=xyd}9V0^u1+q>VEuJ!o$fX#2=S&U2^Bn<`yIEdN$4 zcX}_IO-Y+rUBJNcsilublFR%@uKm{JxKMxkaV}`3jn+u7>U; zqtS9s;l5L0S&ryq+)hu|Cc*a`^}1}@VC%;fj`GU8p>J`IMYB$NgdIH>;(gAClEsm@F>vBA=1_T+_OQKF;c*l2hHqUiqj63Au>EN44X-0B^w-8QPgT*8V!2= zA@U51@3Ts7Rc%(BHYYY!6#36wRnfG!&OPSV6YG!31b-}Lq*bb>yD>H`3u`s#xIZHE z){Ec#b^;`qD32I7r_-&|&SkcC7Tt0wXm~&8X#22=Pdo9I`+Q+;-qAXm2z@U>d~e%h zbH1LQtm4gYMhp|rRR&ob{O4?Fry0`|RIt*4KZ%af$Zi>j3o`Dg*pp7QKkwBHNwFC) zKR6xz{z7}IT*SISKF|Ju>|HVQZc3J@yfuj10|CHI97G2P1*g{0B`}!=h>==_eV(V-lUY-~q1i2~YIP%^I`h`7R zpi}gkw7-oNM9T9Au|MEpo$ica&_HA{VHhD>l(1E=?uVn3txsKZV@TRpx5kR|f6=k< znzjqrT6z-vk+GFR(CqQsrgJ{xhVxTd;C;#V3Q8D_exz2aZK5gvogv|%*13#_Wun+4 z;M^gD@SjPHZ`(QVNR|-AuNXGx!5E-H$7Tymn<}Ne$Q{nY12mY3xA}hri@|hr#EX!J z=-+`riQ$pD9ZCVFZcJ?Gy-3(*ZC!Fe26nP|U+Xk#iLDeML8rH3&5hv~_=4YoL&XgEjvjq$e&tjk%MCW} zh9_dug&R=54Xx466pbOu9qMzatp5R?d9`|V?3^*3hF}j`=)!V44Lhf3s6V%OMh&xP zi_{vit?AIYecoJbR5Jsz7{t2Q5h)5(;Ar#5PpN>t?qeAoYys6_~;vNVf zS<5n2%W|Vj2Vzf9YCKkDSzkf_+vE;K&q4v~E8YexMX;d8z$+9?GJ0-e(B6$Ys~;n% zg_Y-pHQ{R%(FxJjItYqmH~T11R#cGZZE~WlFQ}7q;0w0NDd)7olDl*B*&fv0y5Hr1 z>ISu!d$|1}=r5&JoE{=Yh==v(9_*vk-y#b+Os1)cR2hf*wHf8rY4Oa0E17dFv#NZ0 zx-KYJA;QZOmHu@jQ#F~MQKrcI>G%o$fPNlbqkG*H|8pK2lKpv9OvKM19-eX6TqY2W zMdJojBikPAZF!Y(yeQ@3{>MG9qrkS~7oQJfKt5$g^JeI<$h~(*<{d>feR^VufLgy| zy16+LVbI?nEO?|%-ia*O&duoLMSnWeW$@huoqtk))sE0%F}$bii`58*GVn}hCYHCl zj4}K>15`phGNq9VO7rj6DdxPTDpQ-XxH6W$c*QpRHBbQLAdTGMfp1g zx`-t{(4}*r=cvyg0OnqyAtM99_K|5UU-n(_zS~7ahQ;}t0kOA@!Y3`DeA<8JqEM7i z50rEm9f=7t@pv1}%RO$T2r3fg7yhr#W(twL2g4^G+M}TVko4u}KNo@7v3!KJXD0V~Gg8^1!^H5vG6X}<85){iG=e=^eBCkN%(_5uWeNa0wKx{pE z2mdX^59RUg2N~d^$DM%RwC0Kpt8gK>GA)ft;E(a?@fsUQ>dK& zkJcbO#YO9j#6^jq7XwXaF!;JLK?o)uQj!K{?rWwH9icNHDpHWfZ4B51glUi3<&d1G zUuJ}$Q@4|W@UMx$$ug@O#6_owge6BBnf?R+F0bP+^ z34&Rx6zn0 z(B7OIjnBTC^E@w5K6)5E}CHBdF}-x)fEIZ8+-4Jdv|^7}dJ^owo@?>`Kg?#6I$7g*Kx_&JyF>0YYbYih z##?s@66O4sDkuh6XCe#Fr?#6e+I??s%)bC>tpjccV*=^`|8JzDl`_Yn&U+4|u`{+6 zRawc3(Ie`9^X3sqyt?H&`;A^|q%Zcb(DX*cvh%qHffQ^&k)IHP1#HTV(W{hI8isE(?gMqhNj>@1cJug`NRWijDS=;UN%`(W5`%pQo;l!lYm zln=%O(ns`5`Q8~wSHPDAq#T;yRS8MuJ9*vYu27#ArWNfi@G`%^&H@bRa{&RG!!Qr# z?hrSS?68LBfL?^B=XLw`?OE{Bry47vY&)vm#>50{fUZ{^A49i>zJKOLmDNZuU78rJ zI4>wD?7ovI4wdVE%f-9YY+Pa8&C^amAQdLTgO%gYbQO@yF^XxrVLm+`3PNN|6}V2AQ;be+BQUR8b; zYWo>w!C>Z>j1x9A=xY%MUctK`#%f~jKup;8e#~!yAPRwn4{y#~tufqBeSyMGbs=s$ zh-r`Z@+%z*tTPw4yI8su0h@%g$Px|XhkWq_eH$S4Tx8S~C>pVB*m_2F)zqvEzVUP= z!G9(z>HWmY@5Kh59?^9q=bD;;nm($sZF18ip|7`k=XRBOJE40=akFqjaCdp2dU4nK zOi)%5LiS;eiX# z+fkZ_cI`2R)aYlwj&h~yC#ZUNxp*0-&1GGBw>ZHO!arPh>wSXv!cXYTMuhv+R4J84 znD&eFIx$qennm;R+25@$UoS2F_hEne%T0e1cz8uDDPaZy0XVP+=O zAeGbc{g}PB)4te9SBH|b5-`o!VJg!QN?DokqDPN)w5s$2-ySk;l_vxr5)n_metS7& zr_Spbb*DoB1gltpOl}u1GR%j}A*D}^2j`T40p6Fl-S$G0g8xY{kS=RhV9 z9@>3G(7<%t*Khc6V=NIKm%0*jEOTanDNE7w5MF5UX%Ndw>`b)0I4)*y1j7)20I&yY zq@U)6V_wf#2}tROu%q-3&b|r=yI1)dld;ir*E(W-2>}B@?YNv z@PF!r56+PRp%iXHZ0I8yNuQ5RjAbmK5CWS42s{WrK`L`u76EmTf)5l=0|CC2(b?E( zNcZH?;p9P)k08HOw@Ct;K($UCtgnHke?ri4%RvK~0&H0*a3?XKrpWhRCir*npoT_Q zSVFwP`-6=Ct3R`%qskIgx)nn4hkJk+5(mX!!Q%P!GWG(EW?4lr-~fz71Uv0I^R2nx z$A~|)lUH$*_Q3ZM<f zr8MS&`@I1D*D4mjvqS<=LOL###fXIN!|Z<+k{lIXf=EqCJ|X?Yj29kh*=s=w?|p!r zdd3b+MNDTMVqU!z-5{U7SMR|B>Xvk~uL3^bUQODZ% z-UPukX=Qy4gmB{DOHyYqPCH2xDz6~-rXc;trOblGu^ILkMm0H!)%wSP5F=Zaz`Qy1 zeevT_U`*(GT?(#+VN!vfpdkd-)dj`*SI)}ggONQ%KR=r-TE@uZ@uwgImC~XjRE|tc zCNF^y#y+hjS{i)qVD9MlTRotBJp+O`NJsduPDeZE(XOxGA0cJ0d ztR&5b?Xib#=3tqWH{HiI8jwL9y1(;ZPq)}w%4<4x0F_P&m{27WLl)ZX$&O^+arBW} zcgZ+r-^t*>u0mKrk&&3^poQ#`hUmX4JuSZoh7Fdkna0RTbLgaAAe`UFLwSwR5B0WU z#x?JMw)`6vy)v(UH{ag!40(}MNZze=!3@ma`YQk94Zk`q^29J`fy&~yZ7tPzT> zPD`c`3V6(+1pzx=S=hwP3>Jd@?@DJnkD8A1UK&f`?}l_#B9&EJ8NY27>edMX5A4v% zY%eoG+ugMg0L{XV|D)NngE8H82@s5)e4_e@j-#@e$;&_Q@y*c>9j?(U5Wl+GJ(uXz zGPC=*hT665J6c424%F}(AI);58~74rU@r}QG4P|HvnjPqQ%k@GeuDWof+Ctxi&rXdBW_?rS!o;|~5eD@Yg zc4tB(11t4gzWOD`+qV{*sB}isjb1CTy(@rR=Yk|^Fglid?zwQwNGhh3l2~}W!EwUB zx%TRAhJxY4*-R(K$$U%8Ey+FeaHw%pYUw=h82y>v&EAzJh7PuD5Cexv@(byXE9)?y zhsEpfPp~k=A?10u?dVAdIKfckM$7T=ytV;3jM@~OXBZw_wq35*Lpvuy?&LnN;9^eg zMBVE`mZS{x%TpoGaQB}C0)jCwF2xs~PRAN4zd7}qeGT(y7eEYzFU7^A2I5y&vBVBn z3o69o`t49aCWlD}TQeOlV&6GR76K|M{DurH(q9+~B`ZaIN{b3eB7=g<4IdH-b)=w@ zghgsY{*0Fb5}5oM{~!h%$RQ#{`-cxIDR_y(4in5^!VQp70|n5U0Oa!!09t_25#j1s z2SGaEQsHqgWdc(>*aH3v1V)U64`DDtR06mz#Y_GfkIVhfc!lggQUXLfBuD{S&x0j_ zyE0)eAaE84@&pEOQH4+aca48Zwiv=#mh6%UHbe?$Jl<+^F1OXmttdQvKVrB|_phJ} zh8VS4Np&l{F;5s`<^6R_mK)XL;we-gYLHQ%;&PJ$%YOis#N97JGN1@Gh9utr`3YvArA>hekMz)3S03)y^O8jwR zON)X3^= zw`M8LsJ)Jd@j`!uLjnvocjF8TZvX2zfUxjwwgG}zzL0K0H31J&V7PiwyG3k(@*|ft1kl@EDOs$4Wa4Z^ z8UC05iV*I#XW@l@n|>Jg~-uY;I(M!FUyrC zY%lfG{V+7Zid?q|yOko2y|Z5j|7+W54}v=(r)foUl_{vTqbJMX^c9e1&__FZ!}Ji{ z8$AU&|7&arWZ;J}(yx3bNC}4mkF}~P_^O$pz&H|lQ!lp8z=Evw-d~q!BC)Tvzzr|O zC4A~3;&Ovd&3VMxosK z1&Mtm{F|_~^RA}e2GN7?UoY>Gpwkak@7KzOU?u63%-H#@RhOnnZ$aP&%#hl^<--0T%nXgy!u{lNP&}XZH(vmI4iD7L43^O8L zOtYQwNQiD$AEaFL8=v)_;Kf`S$KRblr%XhwCfqCH$x+iQiPfck*QNZKB*H`g9{Yl!?izXON*10QWxDZtUpcFy$DpDm`K_as0IQ;}O;1-j zt~~IY>!WQ(YvYSr2-Pl`tCL)5SuH5!6m(HOzOo27#;!Ag_5qCW_hkufV zCeB79HFDe|uN17Izzh}ZtutS*YN>Qd>H&*lXK$2)b(C1zlv>rRNkhzHdv=nl;B*4# zhsI&psyS*TLhGR%7F2TKQ^+6H#{;sHbZPH_Mnf2_P4dMfc&n6r!3zKEm6XN@+vD8h zF77@y(u~NsvE{mo-7z%H&A?_G<&9KSz4ly9#f>;NCCj%@J!85a56tVLBUt%4I0#{{?4_^i$dyLv1aB@U25(K{ zbGG&izdWw$BtUq8hDLS3YruzIb&G{ngb&M;B3Fcy0WBG+LIM7%i~I$tQS7g=MM(DL z&$(&0RE**+Bc{$*(Ok8*t3$@G*2lAU7k{P|L^W8hSvywl7-moaUVB^&OlF-1yqEpM z3nt@6g$LzB^cF%U7~0sa}?f;)a0#aP9Pn^U<#w`bM^Hi3*$?~h{C zf5JEb3N5kFy^hN_8x?zNqgMW^%oF9%6@!-Qs6QtJfIvEipr5|;CC_0);9MNKpvZdJ zeXL0Og1aw*R{H|4TliqYR*QvRxl>3Eal3GMPf4HI^=fXg^F-_l%p-tLpV{oVL+ z15Gp7_sS^bZo=*=aj$tNg8?r7v^FfG-X*38%7WsBwCy)OPwLu`KN_l*H$Ott%tAr! zr@(2Se@@=Za$NkVNmF}9E{}r1xAEuKF@DaWHx*h{|8ozZygFsLgnDY0~Aq z_sv4Aud=_M_*4+^c)X8T;|j(ihq2)G$|YS1m0tx*Z-0Q;{5PMY`GK|!d%^3SW2X~) zOV0+nM(x`}>XKTYgZ)f80043KZQPG^X@`3{6Gi<`HDUCvClPn`Tj5s{rvsS+jyX}k zE5}lq^?yeGKnCNXe*)>!qm(_Rv;zfwlKUi=AF8hGc-27j>S}tQ&ejS8oy2NEs&@8D z4ag~RG+$(yaFaNDGy>^3@Jted;zU=r+WwGforpM}@R2@CbZ?QSO$c;2!b`PT+q`ol zMl;KL-tS4fBC69Z8=>rz;3_b7+vZfw559AI{7dZc?z{&v5G7UBxIWp4uFjJPPZGDZu`5nGU^-hB zA3AyM+R&bUJ~419Dwx_ptNk#Qp@21dbz|Ii*Xb~MXA1FUnt^J* zB5>wVADG$tx_~_1H}Cv2Zkx`A{K@d)3%-dhlsh!Gn648A4^EII2muPZH3DP8zkzUJ zAX?y=V^kC1;bYS4C$*e&$-sA@_u9dh?EEdXP z!oH`o>t~K==$%~7^p0=N-qy6>u|)=7Rteuyx2(e}LIUzYF-Li(<)smab)FrsRy`qU z&z+_YkP41Xt6yUbde%<4LPN*()Kb5$p?-Dk&=^tpnSn9CTqaGLp;cFSPFov-@pzX_ z?>8|tGsleWj~jXwX{mus#XXCk@6gekLMzSSLMkVJVbSN|Q~ko6x70nqk&F3TM->;g zFoCr&NT~U{@&q5T%;R&8Z;!*YTV4WhW!SEfRI1KMn5C;Rd#CD1{#Lsm|EEd!*KM94 z)pSm*9xDCJo2m@TBpYSR(nruz-SPS8HPrzX-R@605yCsypy8A2&^hSbBEmytmS&iUL9<)bYu)J*TrSi$r$VNw+xNN zR|E?+4kb{H4cL<>l2>S!yE*kgTv=eNowQc_RNL7DcUtZwt1O2dfpO0P#jd(A;BYHjPl`@uK z<&EF)Nt?P}7aDNvEoFa>KagrXLj<>=BWeO-Iv)14LucUb* zkz+JP*z?=o8(Dp~84+R9>QVEL&b+VR415Dt`tDvK^$G8I_!NDt4-Ke3lN=;SZ;gsh zea!c)V7lK3TiwWEH75 z+x88w;v((Esrp~?)M{!? zjd|am>n#tST~V8-P5ZW`h_|-W)IoxYEmP)C=fbw2b^EsD%}cr&m?oDX$+w3SDh-6N zyV$~aVk@QmP^M8iD)BC)sZ>$7_boEjjYA`|+4JTq4}VqMc5W$E=5u;0%^!XLK;GW^ zWJy6kcT4_3#2KS{u8sTyjc<&pYl&5i-A}oGbA*kvdR4IgYrTnBZYYr`fEyE_yOkb} z?+$5;8f?4vaYAeAcxjt)d*p=vO;irGG%b%;8#jwPDoJJ$ zu2Ao6Y|3h8-o+7R0DSjdbS?pmjmJE^jTlTbF7gNhX=Q~e82%i+ysSS2-Ke;nQNI{6)Ali20uyb5CGZd zXnRUP?;p4ZLE)W|fA0JX=J#;@52C|Kz~|kAKJq=(x7dPcm`5idaFB=YQNvVqk4~{D zkrdKcLKl9pzwP1H(N>}CPE{4^*a)c#zcY_+Zyg|~iH!4qFO9WbWo^tU^Iw)8Y z#D>CM8vii}Ll8Yq(2kOt`f_Mw7c=4|XwB^TY_=I_zC24MbGPZPw(`f-v6e@5S>dbI z8BybW-9E9AlZLc%_57BjxKC_cvoEvMPD#jF(HD-(_;E~lr38q`P3pQox=P5U?lnJd zeG!CQX{2GJ11PGQtmKLUXB{x4~SQt8ZvEtUb#0#k^hDD)K z58ExLfpW!s=C)(gktBV3qhuu*D;L8bK5l<$Qm=g7)vg*`uD)@K;Qd&=X)RR6>teXc zf~dv%c6nQKu6F=o@)LGy9+m`jDqWP#sv_3RzLIr`(<`w5+Q-Vsd993|B@~3bkor=; zJM(P8(B_f@K`@q+NwtUls&7;I1sAnww*Bj!2AONCDllsPnQ)U|Z6oSJcwa;G4J~xA zkT8JVyYn)t4<`DHbEx6#3$7a`vIIh>-jsGx*P;oFIh_|?+iJhHJX-1vU+?5>g{&x_ zsEnKSf_6tp6{DX11lN!|jUsgjGc|909o*5aIu9rwoe?YQLZgR*Co6Y|N^mQ~KJ89a zCQF?eyrD})Ws(1dX82`LQaDy(eYl$75nXc9&u4uT!Y;ht<)WV{V0YJ5-z99o247|e zr=yFsUbbtDXQhX#eYCN{iC3ar&_#KeR*if!V%odO8wCF*{Uc}e_G`l3fdwk2<=&(|4!y}x+}R$cv<+(;zj zljR#v57tojBPw}O-O=jaG-&kFmCH`3MRFYYpAHz-ykWwE`4{j;VZOrxt06K4e2@#x zenuTmvW`!k62OTo*$NeY5|42rYyY9+hTk*96oFGcTW;wH*ZPd3dXCJ<+z~+Sw25<$%w%WibEPksd7ij3&RP#c%h9m({TRm$7%W|6L?hqS)9Cai+SGRkE6r zzji>OlNrkN+n!1&6i*+)m)>MkH9r}Rbh5}^`e=9DQOpU~)rWBVh*BaWH*vzITX z4g9zkn)-iv2Lj1}g!m9FR<9vV4Vo~TDeX?J<(8S5=k4DU=bX1{-5)Ra_v^vVU>a{m z1{><~c2yMpEwBVr18=`sq6^18ZeFZVE`;C&Pz85<*a_sHZd7kG7Iwmw$s<)%ObTj% z*oE?&LHsN!xGhQI#995hxiW%LZJicz0*v0dM(f-PMkgm>y9}-H0`h~WSC)~kpZW+# z#~Id}Rde+2@tW-aAp17Mh%o-c>d=D_Z*Ae%m1>##+O$ecm7PA!JGJTz5y+6_WR0BW zb!^A6(9mGY=BL6^a@V}&JMGV{Sm5cW4g2WM4kg-bSz|&uNC}WCZd;W9_{qqgNN$bPg*@ud@d;+hf$P8UT-{JsI>lndMF?l+?^tFqlkaUk%aD}4Y@%YrKQ^h25unu3oIN`;~Y(%!xN-JSXXCZK*u=eWols5LmlAx?S`dE8w4Erz30;`Ep7x*lia_383q#F*ncd1{l#vs z-g@egUrIyPxbDPBbUn;yyw-)*95KALTuVMOmV@V+&`_$c#8`Z zGAdI(TqqX*@-^o$UgO;}vQfNuRRdgv+&2z%(wVffPC3|#w>)@dMU^)4W{_$*%BXes zgPp|~>d5b1N}Nx$EY1SoOwEOB3cP=#yZ#MBfsLq4BHKP#32BB-Ljcbz&v(_L=@Hmi z`v<`K%2A#g2clA|bmt>fpWnaPZw2rH`x#0JPcJnb$@zM7_07}L!EqwC ziDaBka<&ql0GTMuEkDrPx;WNfVY+pl!{#r+3NS=Wsof2Ki~%-ZC_2%8ZZvM)k6nbh zR+9ll%r|@Nkc^Rx3%`vJGrAzU9XCC7J$j(jOib3s1e#S{81zkSbG_R`li`=b*arA+ zK5LsF;%*)jIZRFr z(k*-*%@}vdo&F>RsnU&4v1&0i(gFR=3t(i>ib*Pzq92u;AW#04Vw-rkIs@Iq%6dDc zLT=W(Wxo?Bi03r&n4Hfr(V~c{#m1gK9(mM5K}P_`K6%yriB(*^f`+!LJfgu*v4k#l z0@PIv~!S1n1z(- z2_i)`qJeR~V!1MOznZ3Xm@%g}QAwx+8R0qvELm|x6>m9da0?E|A+l=}aG`mO$dV)c zdLpPIho~emPD#za(Be1$yOauCv$3zy#8m%OGYWH^_En8DI7{V&DcR4$4!Hy=*Y@I= zWHMgxNa0v+jq?OQ-|Rw4TrL-iwbQr2#6FC|9r?uC;`*krW#o4caEQyX?WaN&+FS9pK0JF&?fRD8D9iAiiU3R&C z1mnD8N8m)>Y=zwVhERbU;hQJv#rQZ% zXHZG`0?*{!6j!fA9Xy~=d)RXOXl}T(=MQE2Ug*5@9syWC*yu2%*acnhLrQk{c)$`$ zK27FK(KVv6JS=mZO9Wy!J+)1ye@<>-nPW--!#^r!apjjI>U{o~d5SJ23L-NX3Y|Jh zE(S|%qml}@VnC2v5Es~|YBtBJflz&c0r#>B(K%x7$3nN55b7!2%`Y|UimsJ>7`!IS z9DsJ^JNH2J8Cs;qzd{PEOqgy0W&Pq!org zEmF0uFFt9o*;GjW5UO=^LyaN!fdbM8Lbs^PeR3s9FSX5dDxJZdxu+kY`U>ScjP-vvg>Jo(^9C0W z*yf8e4>-{_=rOg9qrV0#F*%q#cg+w6`~b7qhnn)%S@&9>6pZ=OPEifS%4 zo?-Gj-+X`KTnG5}qbt~mwK?E{-)08SKUoo8&_qo1GXm;`dib(xUlJk^3*{}3dgwT$ zI*sh~e|l_~Jfeg-#>pY3IPgI4%8H76&{ie~`ix5HwF7Q9x%S{~f4f&LY>;3dt?~J> z3d!T!O?k0wh=he*XWL4sReGnUv72ud5!9kr&8mfdA^lC&N=gL7`wM^#6ZpOyqEZFrSxm z+xG+{36o%0NOAId2)s?jyxLV_x!4kCZr>9ClotscnB8CSngkG*39Xjqb0Uhe zM6s`V&n+IO374dt=T!A`_>c7g^459Vb&qzHoFV5xbz|)fj3h0kH_Hh(J^PZ=HsEOW-%33F&WMyzA|L!RQPgk<7ojt6P!x8TpO3FTOUI zD-|Ou5VX#MCA@_J9`W(O1DAUCFGuAnBm@^6rsRidMhRr3Vv2(;D}IxcD`i8a7W3tG z(32u5Gl*3~f0+)=vI=cb)5TyW6+ibl@+KAUwW?=%_I0p2FVS|;ehnHA!S?)6LjIYM zJDJUuy3W$|uqr3yNPuK(9m%gAx+bIULOJv$Qr5-R^G(}Q{+E}@iC7wBVEv}=7Fe67 z4|ZIwQ;Z~G3j{IvzB51l7_S2JVmnoXpzTywOU^lpb#IrP5_i_6ct{-j$*6DUHnWMN zp+TM^PVT0fnF)~7++8NbnaA5+opi+8Bj(q00ye@rPdQxhuIY>chPYn zQJ!BT45!5UOd3=WAPb~Cji48>tLKc?X(_imkJEUx)ZsifBhh5`tE?w(?W6v?$u=W0 zaP$Srk6pZvQ`ThkE%`dKT>GYo*H<)y=Qlx6g1MjHa7H)OdUJWHAH55c`+v;6bySpH z^gsFxLwAFuD4}#pN+_k23eqJhA>BEYpeP~TCEeXHC?VZlqjV3_eFxC@eZRl^UF+U| z?ppVsS)B7cXV=;Lv-k7Nuur9=5vT*G;UX#zCsSfaUtk|)MqqCx=ymw-q;CY^-w~OoiC)r3nZiC zpS67U@$_N;`*Z&^HpJ`mIwS5M-?I}L4WGCr2?{QdR@ORfU`8Qb8Xy~uQrm)pg(gVD z&)$pCwDz7>-)`C`$dyYA7N~>KuqV5|hsQj!+4xk41T_DEKa>E@NccIF1!ac3LK6W| zMGug4WhhHA0s9w?Sa@v+G1#>kg>@ImkJo z?RcMkRZkE81WKgAgXmO`6UCV{-cv*jkCFFNgeplvUqSmG7>`i%ccBaD?3PRreE;gq z<8Aju+BoOojs(lfpoN82Ks_RZMgGWVrL`ssFeyQa>2GOs5;;(D`$J=V&KgpXb1kzlH?or| z2ja&4H%(pY@O~WR@%?980+}J5 z(?m@BBK-K}sTU1nXS&pxCp0*-@$JzgC%OYaC+d}*5V{b80u|rg>GWEJwCN6D&>~tY zMyMfcb0$o^{{$iW-ZWX+o(UP|9i%Llgl@eJ7gDa>s2bycWTA${o;b!(m#X|-^{h0u zA}`m7Dl1obC3oEcI}Wn9hU1zy3@`k-zUl zMu)kvQ24NVj~zwGXp*j2tx;Y|PNO1&KKBT}5q>xN#28ks$j5ap!a!^Gu|ceJd{FlM z_LZl%UUM^9f}Yp26dCAs`lWn6{)zu-W%8RE`B-|p$*ow8YT#iX<4*Av)Fn(GY;B2G|E3_PvDbrB)#yDw3TJ3-Fd zDT|%-NQPBt?PpPJS@dQYK^B&LF*aX!qKQGySowaBXvSL$_Jm&&(Ahf#1aS2ciG-e| z-#JcMcz(Crx5>IHw$pFERFz&tt0jj4o%h)%YCe01Bsv87MhEl6XYpkJzCFY;g81S* z_@ER?agY%VuO{XMV837;__DPCVX?on+oDD zDSXcVIfRFzB>uv~f*ypWn;_Zr^6jM~74h$GqygF(=H(&r7*M|Po?y&ly@Lu=paye@ z(VP)bQ|F<*aDM{=0{{S{zpg881O#r26X1r^b<0VlOAg@`qA6*oj@=mX97ox=9f8k` zu{!U(VL3=CV7p>?#P=a*D@>o|-r`+r&aaVBE7Didl0HUwX<-6Gxk5&9Qdn;uVhkD& z<9~djFE`ms^DR1{EXGPHprpk8f!tc-PNVDn?oz6i(1ad&G1~6K27aEM{+-6+rak)4 z2#GkaJEqw|Qg4P0pysGJ z(SR1BgY!^8MlQ$Zm z{C+_>u&(Ek@SFL^SECnEOte|W#GgUkjn%=2wcfuUuKpnB?7~g~1uIAMv4`ZJh2uKz z5%QuoWP&n&+Y~?=&miy2pr+QzSG!yJ{3C%Ss$xUkx;vsUYgHNr@6z9`jGBX-h+UEf zlgdS(;z#p6<`QGBD+J4+W1*g7BSfIn0Bu-*D~ke=^{-8bSvu0fY1uEQ!x0{pg1#Hm zPs4QC!~aI=+ES}3c{nw~Y&gdQ6DkHpT0!y#A8PcW36z}7cps`pQ_`E+ygybo552Cf zdcKyJf}j5uA^0a>BM{gt8kAuNxl3^y8ULUE*#II^zvfnYbFvH=RXh%HP8Z@N6U3)J z;y)reQL!NiSh}4+{R9FdCT}PHo#sY>!0qi1h`^{&#Mz^BqUqT9j9}gExcKR`YEtQJ zw?lMWPJX_r*`Aa;iYAto&MA(P7YU`&ZK=kYOriNBo7jG6C5@;J5?>gfGTX07Du3CE zoaBXhHu_WEJw~+*#cSm;oLkxp^R$_uc}7#oWAAloVE5JVRlb{^Tl1+i8yk*`W-F5& zGhaV5rM^3kiyys0yR6+{pZwVu%lw`!kdiZj6$C~JKO2&j$=Wyh#YWd2>eSoCvYnXX z?V=gfq*U31N553(V%s1?S)yL@>j{+}p@EW;frAen@&qH;OY=)Gqv2vIzD`6F{WNpA zvzw^kgYsXs0^g9)n?Q0>!I9j`J3BsJZ?L$ywpQ?P+yWoOnJyj(O0S$E^>o6lZ>77*0Yr*C&gh@Nj0?2>dm51Py!=YZTjh2o%(&|HQOlXT^zu>+p z#b0OVGmJ&O9VV(G?hBeh%{oQtHnpDzC4W#kkHMycKDq-(efEeax?qOx4gI8Q+&aUm zgjthZH#*T>UKW_jo?X3M5Or;lNmEmwXsU5C(fH|-a!ZLWX!`6+y;MvcbbDK&&(Ym@ z%hl}kuz{l3?J|J_LL-@tHeH5f6>cQgKJevQP{|Us@y81I zWV3|TgpK8~*xe9p*OL#O1j`Q|r=m?8K`H6iENo2#xT*&tjf9O4adVXO~?=!Tfp~L0CKR&$3eu2dR%nK zh;=5{m&n2Gp6DP%TxD>(K|nnD=%B7vNSwhw0B(oa(msKJ459mo{eVJr#tUl#?9yJ$ z-3e|B9#!X44c91DuT*D?_xCyuT$4$IwI8+{2pbkXt6@%~`Q2(>NzRYgA)Km_FtgR( z*qe8@_f6A>q%-rIqE1wdjZU$+j$@k5Gn3a{)m=-!Gwq}pFiZPPP`olUu_7~n+_&!h zWyCd_e)+%!aXz(~&uWD+s7|Qa+&Me%o!ZN-%KRepqWRKF$uv#JUu9O_FC5!+W6$r; znoMB!BJI;Sn@aKZZ}^0yRqKt-5c-ZyjRmHrqIKq~zAjE&FaEgut0-?+)5lp|;&owr zI(dw+k!tNPDaI}t(2EV*`+%w1JN3q9J#P>8+ZWl{iPrAH1@70|YlSK!= z3#VA_NAJZi``2q8jhMNGEpoaVuhuP|FpKaNn~x6E3BE>AH8E|xFDHb|V7=P#EHzL$ zfH~oHcGSq-F4Sm>rp$OB{`(V_UzrCIXqiuc^S)MlIK3Hr$4sL#UR7gu<$XwKPt*NC zmCup<281M@wS{O3{q#hFv(!43xPi|W8!@8QzULku-!BzCW!r);C#pd#ukvz6-ElL(OX>;3=+BLIn9((Ewt!Cp5iN?K<`fcK)fI59e+v$-dD;m%8 zO9vG^D%0WeDV(%v51glL;lk6Q@8sKL3R_?6=!tU1DB(4P2Le-g58IA*6Gv5j z=Gas*uELRE>E&y%OdF=y8`D@4xa74woN@h0U_&#r8|j+gf*H%?jfleLXJD_FSMF9c z9=UmWkzE{G(ELZR=FM4QCCX`v_T3nrNfhENbs58g-I5O+zuBC6ChkuoeF(P2Ym4~os0mlZJtds?lbI5Zs?|Py zmz#mv_+rEPEJlhon#r7ry;7^bWoP+P_6&GD; z(?b@rGrT_}hT@Xa!1k2T?xCghkrBZB2E~>&{8N%$QT5-8VE`^~fTm+7JMOw9IZrQJ zsyHSRr3EZJoAW6VXE$m+NdyhX>339+JD2nT35CTk9N=b&J|IoY4Cn*zIS2vH(-$BB%=tY98Ni0FK1D%%(%(g# z&WuNb==i{M{tSQupF~vJ~R=L1dCVZa~4 z*QWZbH{<`5xyjk6>{dwx#V}Yn5K3KKPprK)_Sn?8Zs2$0X}oN<`O3&XeOdAZPqw0g z2O8WB^@i-V%7o{n&@ML3+FlzOE!D!jc-E24rY=Wg{c(d{O9$==tHs_m%LN+f7X7WH z2+PnPvq3^V!{f=cvqV4E_;o(9)7lB}oHPqIYL;OF+q8|H{qos(3z>dg|22kn{tF4y z>v@zLeGvA8AmbqmOcFn1VvTDkBu+pvE$c7m?0;R*=qsQ->2wDM#b>;yKuH6-rq;DEM`=$AK^DnHHYVC~eLt}c9E zCkn+YK0m>-0W-T)aoqYFOwZf&F#leqip`pt#O%UbI!_a?c5_o@df`usbkL+88xAD( z9Y{HaX+DRl>kr)6En1Qi@U5~J4_D3Qmbl%#^Nn~+E4BGFUd+DR`x(z4#3wxX5LsY( zat(kjr@7(^h~a<8Y?95u{YPO8no}W|XGcD5S6MxMpici}C@JQLNKwo$IC?;0QWNe3 z8C#{37Fhd{7)ql%DSLK2->sJ-!cP|d<%%%6&UyCj`M!iS$906C$J5;5Ctb#}3z3z?10AtJaa~rq4g=NB< z5Qc4mJqqXwU0aOTGlGP}*le+(TaekLD%nGKz@|-?=uV9yP_oI$8h(*RBczzu)D359 z(R#)yRCnowa|0>xLy+PlsUg&1_`A&1VkAg?l=-E4S0{C*JYY@S@WLP zO9iI^L|``fP-^S6T7zzoVi|xL=(av@?I8<)aj(|^8LsH`B2N=_)|UvF*-(orvuHwf zc}jcA)upt7#y>Ph`Y#@x2T|L&)qxeIfrRf{Xu`1PKnaH_O0Of|1SsFpUE_<%N_})` zy+y>y-s=7O-xUkFDOacbcU$ad_4miuL$5ZQO>O}ShUS@Y^v9=VW*0D^d1)MZ9l}!+ zn>I)`Ogu9QK!Mny)FUjnqZzV%5u+n1U;aHRI7s*ggJQ8DuPZa{?lktkE{iMIEc)mK zRaC9i&R@nc=#hPYkP}^`h#vUH{8Rl{fi%RRH%-rnnA{zxaFXhK3;u{sYn;;rfUCC5pUIF$B=xz$(EesX`fBC=Wo5>$->X1zlUlPCSl z3GN1@^z%avJ2u!+)ao7kHR9OS-Cg$*>V$t5uWrkGD?1zXCklPorG{?YxkUnmJo47? zjv4T6oH$n?;w0~F3r!sb%tt4fuY9mmzdoElyZo~|P#tj#mvAZHxH%Z&euv5EqyrR1(17vly`9-(PLryhO#gpu>n4Bz-t7KmQC!Asj`^-e`%*+mHxn ztYK;!2E+H;+Wi?N<_)qEN9jLA0XRLvVF94a zM?1jZXh0x*eE>`lrVzf#DHH%WbAN9{*KY*(nI{%DsV~t9>sNWJKyk^NWDz~~{ttL3 zVe<#Z8zc%QKOph~SHB_}z>n8!4?XdbWj&ChaQtUmK3Um_9{rCX*p$H{f-q1v0RqCF z)Fm96=37;$HI`nOZbz)zihLIT?9Lq|56*ZC2(5jN`}pT}C0e7~dIh1x5~#^F2DtjI z|99p;o<_>)a~pbqKEf$jW?(8{4_BoBcq!63_}^Ig8!}M%fi4i@{qM@_LhH8N@?dlG z-OvJ;{Clls6Lg9FFU2^phXLq6aRYe&8zuiC(})IN%{?B>Va#PVPg5`Xk2Bqe3PCs0Ej36W~Ai$-{*2;dF6j^TR< z^Q8L@fSPV#2(pYK)lqjHkJMz)G`*glRAYEHb=@t#p4G(J$qJNmc zj7L&@MaijyVsQ~>&O~v!OzIp87L~;3g5q4YFB0=2STq31Z%m!W5k+>;T`wTUVlAFx zRUcck0Lh+&p`NSvqm652qY(v*kA{zZgQxdG{cg-xk$#JfstqxRnO z@4GMC6>FoD(_Z}E5hWvrQopG>z1(p^Se~R63wB`yI)7^_%9Zt*1&1Sl+dRM;pc$J0 zA$F*Bi+DeDA;NbgSsN*QjyPSA&{~T9%BCS(S6fT(;7Mt?hB8Naf*?)_Ie8X7ZM*qk zXJ!&8Sd63<1Gcd6HOcpKiR+!VnZPxH+WB8UTUdollm zy*>{Ec}g{k?_cmqs&jz8%|<(w1e#6E!Q9R_)YrrfKsNPZk3_y-Ts|WitxP6-if@OZ3oqM+4=2R5LH;=l}UmkeSvGaM}(`%pTMaw5f zfs^r#@#3pX;Vw)s0+@`@-iK?Q3XCkds)Qnx2V6&s8rcrkT|DplDl6~IHFzx-dyAdL zMd2oOkO*gWR2OV>ga-)o!Saa|6)ouC?x;JE?dsBNWe{j_cl)a|hx zrGDVtWTD3+Y_W-mGe(j`k7rZ3$KieF&4{~k;Hj#Q;bosOpc$Xss0)R-wJfX_nY@qM z$~zLsng!=1&(Bd}A?PNDU`dP;CMiX$D|mpjyCdD^{-SkG(K|0p05{|)vUE%UsHqpF zK?U-S7i4+6)}@Yb&|KuUAS`QO&)lcXp7ffy z*Z%O;SIiT_VI8qgSCDe;y-l`!&~FN~<`ABg^CQT?sLyuvdF(Z8_^JbzV`Hd>NAN&X z&mXRRJ`+|&L4MR6*~QxjAlwkFjh{lWCQW7`x0MY&v<5887xrCo0P!&1q5n4%i!^Ge^#0ypL8KO#Dh;Dvl&y@d~1(4!G=6oP4xo(iWNL@5Gn zL;eRP*r0wbsc>3HFaoiEkTiG{gPNY>Lh1g{tN`Zm5NHa75dAat73e+#LE$J+E+m0Z zeMZ+}yAT9!Kn#Uo!I;s+FizBKX+SsN>F&!xCJHqj|34wSWDzh0kvEYx`d-i@iR|1` z2_l76X>np&Q6kXq4$$=MUn#x3p*{2ROw)h?nek^W~c(HD`lV)u}_Z2@~s3eTYHS0|XHX}-!h@ED^1 zq%|U#@V}$K85O}{33R-a@_*X-HZ|(B7y~8$$+q~QrX=8;?7Hl@-6wxs_y>$XxfG$@ zPw+Y3zZY+cY($C#zK?SQ=a&rsUh(H|+2#6o_}?2r=P1{e4?>Hd!I)3bj*YC(O03&pY~Z;V!Ud8HQyYiutEuuyZ^V8KmxpQ zp|h{X4lNr?dnX=_*NF{mgvzbM+!U%dPAQA!0`5E3YaXM*diyu8!T6?fz=T+T!GpUz zkjz*STX*y?X_}*TVPF=8t|`#PyQOH^QLG>4X8?V~jX3k0(Qe73`$B~OtWCt&MuPMc z;lZUff;30H7w3!WhQXpxjqi!)Bq$|I#%)^tuK>y|%hA_?c3>{}qiTNEe?`6IgE;R! zQL(tpNPktGm_P#uc^T)-7HSOwYVFaheD4u3Zt_NJQ}7AZ*KY2pB>98o$&9mQei{B> zD;!W{NzQWG8xt;L!E;fMg$4mRrlh$s%DE{7l0Oxpirt2&@j;(fKJKH|XmN+$(NYOq z7uD+`F5iSqBD(zxUl(34oT1|@+`BsBi>c_%Ta1kqQO@h5kF3u58&X& z?^Sr!N`9VX&YNLJiBn-N@ou4O=peufH4Cicz!fa~RKmIQIsW@eVuxL)>1DhJ+aq?fiFo9Z!hR)s`MP5%5yu#g$7&JBb)%-nS0Q z)cEQoVF*{*xt9k&OWSgY_N4^DgJXg}eqmQ3hhbPL1w}r8kE=Y~^@35|+pBKr(zDuW z{KESJ2ukG#i(G_SUU_)$ZQKK(185HcD1R=5=Ov1W)1-uo$3wY!S4=BpD9I^ruPjFw zrn>7Fnk=qe(%%stZp?n`SOnOzC{!{iH#%{y0?pd=%wHF0hXf+dL|0#^)|l>IkS@ee zXT#djTnz2JnSfY+SGn$C$-sq*+KPZSS^{iIWK00{nlHHrB&v7xdbMSXvfk#_Es5v$*NpP?^ zie2FsA@4o%Pw3{iwuONJkCnsoon#!8CVUAc&?Pzq#JMklNy7tuYzf06*f)Y4O8{`e zThRe1VhWLgusy@Bx3`7t?=(Q}fp`Y{v*8HOaakoud=KdTb1Q=O6(G6?5=Fh0{Q7?1 zOB^_&gX!&7T(k0qjMG7{pU)5u2Le#_5QmL`^;i9fucNR5kX&PVZYtr)_#B^>a3S662%< zJ<&-`n@WUAbV}p(@kR zHRQcaO`T3sIMBbj^47w&qZv6VapG%?oMd3Gnel@KJigQ6cZT~R?-s~*uFz4%G2I@4 z5Zi#?(uj0Ei*~#(0WM(8e3eiJOA2O&xqcK%ULyI;0^`Df73=@1ZyfVmSzCT5^Zhu0Dntr_Xqeltxhh>KhVxx!Z_W@@gjc1z_`@1%_#D zBcPZdr}gh_$_HQcXHRZ<;K#^9=T zydUHSZV=+yEscRCLj9#QFqM$Uh6X)LX9x{zqvj61omT^GD z=>Ox$saL=_qE`Cf{Mri*g7@n-7H@aE7&O;--N^ip8~cjl*nGqJ8wl_K^ivV&v@z6lkW7n*>;2k*-(2a7J^Tq2H=r@6P%})rr8*qgN(E?p!{`Xd4$T^WL?H?Gq6}=y{SllcmOak@@ z1w;|&Qe5j$wq;&rf;iJA0Db!npmA7Mg9Hl&LCJucd4Qj$I<_`)D3!i~z0UM|QD=%&D-|4IX5pgn_k&{8DqIBo+*`c>^g=ae zc4*sxm6s?UpD=5hfoUPyhd%*WJ@$(OCq89oT02aY>8ipOH`3Mj9>(U6u7M?W1x(do zVmps8v@=@G%W6j}r^?B?-?=lHcebzeoT*RH?sk6;(baKo4XPWidcgEa=dp*Rvv-L2gLQ#t)q=#r_NN-D$@1dje~>q{7J}~g9!n>;fCnS=LM%f4aRLWX}Jp3 z*<51eU)CU1_2@6<2M2e{NcO7t!V9e0ina1b&mWIg{W4YaBEYomJ{wXi!AEuPTQLUJji z_~5=Z;n&oke41oeItxK7)5IT7#*xasj)t(BWL3$W@e zu*ovy3a4uu_(nKWWSd@3-R_XVQSognh&N+FILw8nEoyRdqA+byxp zt#)oXCFPviRBuo6A>zPNElKBC?T&lTqlM=ZVW5%UmD#NE%7twe@Hf5q4_`=PQXMcu zMHCehU$+XR4d!Y+6=A8<^Q<~aOK9c>T_>+<%U@(~+7>#<3?RXVz|5@vkzK7SHqXzq ze8RQ{^^SBZJ}0vgJ;Dr>%N(!Q`lFV)tWzIT;8Q7YJMDP1^@VYjN2l}G%pEG+Qk61T zHD2*vrRQdBn2_U=#r)*=s!g8$=87L;E)=px-+K9zP|r~ajB^xjO3_l9Va-GtMKV9? zUllRR9U8>YxS%me^B`hftsZyhj`@zGSIUd;d&&cm&v1kLn0E+$?fIylS~RPRP&_8g z5>L*P>|Ktm8ZOGe_h$5k{=C>QMtSkcqRb9+>^TZXh*?|gS#x}isay3!!MN@Bk{}PiWXg6_- z#^16O?pzbnE5SaLQ>OH}^aRxk9Uoa+yG7da*FDI@F$9cGA_#j`(*y@27a&ECFJ(|& zt%ncUT#W5bg(&&IDNafL5l0u(eA4^keqfEY7c1!aj2f~Rt^RT%Jcq#t*L&KMGLsz2 z(7d;Xtv?-+2{HW`z{x0hNxEn{*3m=%A->G@amfJKP4m2*AdAdd;ZxYzMybJhH{d>uU$WLYfu zM1CakZm@ASwuxum6!(iy1sSiDO?Pv1_;QvfspyHq-aM8kpy{xEh@G?rWIhndj}yn2 z`)Y_rMIwQt=w?!^+qQGRR^VX`(<`2HTsq=UMAQ|AqCMoZiLpUp=(aXX$9ExNJs-QJ zl5;!WqQR(}oN#C=z?y2r3Xbyp#ZVxRcY?^j9ry#g9P zs=k&puB2e0h}OF7Er&Qo8q*wxEvg@0EmpGfc)iiNy~AWcx181k%>`O5oGie542xgFl)Vf_>Sw-NDcXM zmqd4`>-4L7`Ird6NL%Si15@1RvrSu5g%LDf{=v>kkV{~(j$h#V-6rtyfdfg3>=ejl znvmuBOveMmDFezV`vA{E=eg;_FkC3%>AY4fsjVg219?IMtam9Wbh|(Dr+>&j3WUG+ zjnSv5o(o@997ggaWY;M)+k0e`;GczZ-s?t=D#2#9fGzYmp(9mLFmXv;rmk3gtU#zd z69%z0QH_Oa@?DO+H-g&A#Smxg$5!JM8)#tC>^3+uUOdglRn9c#R{yk%w#n1`CEdH)*+LAYD@STeG7a0=hSSqzHqSrWF+{AIo-wtdT*%5Iso6(r*e1G>4PYj zfQRxPg$qhKQSwoRf$uv>x`VMFAfR@N9+_7`5x?7waml<}Ui{ZX3+OPU9L7FollPWl zj2+SwX!Ft2=j0!ue|4_t&D{w70IgNPkdVACo$8F@4j|@(1kN3dU2T19@g+IAUs)ne zKB&8s5^N}6Bjc#N)Ro>h8vh7Pu*nmz6p) zgH%VP51O3($L8CXYhuhoz%;I&So$iSFauwZ$tulHs#7h_;^RW_y!TY$gwl)ZqDzVqq0J{F30LFMvK6KPUN) zb>#l4_UDU&X=6x885Gis>{LcU$sU$J|NC12o_9ftfsW`t4-Y<|!yua4$`p3FCPzWk zv$uYawhblwW|!!U2CLUh_0E$Pmxz4&3fs~jsbu@)`Li@z0UBf?$TQ-67l2Cur%f*u zo3S_C)OWw1=OH)JzO}x=U35at9}>{@5vC|Zu6-l(H-mj%-LEk|73IkUD2Arm4-A5Q z$V?uihe$ZuBpWpiAb&DM)!Ef}J7H~0w9+RoGtsDH2NK1=CVbIf!NnV*7dXJ}F_k1Q zo!$KaLN2f=pfJ3@@ALQ)(Ms@#&{ck+9w zY%M{4!M#3@RxK+4FB+B=TfP-0U}P z!CqO2N0yT(uL=HbE}me2iQA5)P~tBeE>kPvOHq+xqH$`unkIc^@?f0mOWfV)#$zBY zoNszJnQ?;ZtsZt>p%9Gzg-J1Fhx`flk()0)`H3*@(=5kB^dBZNI4Srw9;(j3C!2DHfyx9Gl+)R`iAx+H@h@-v-WYK{X^#diWk`g~OyA{irRi zQMI+?AGV5R>j`KLB2V}PPd+j0gZV+sApJX<)go$4)=Gg>Q5$I{zHU5BbTGSKd7fU{ z0c2sod--hE@Mo0Dx9o6)ZRUynO{_i3LRo01IgVVRRS?-aDgFe(TB=|E-xC!NNs z;wU1ev+>IR>24hScPJsAtYH?Rm%pX9qNHaHs$-RWf_3)jE{-$oV1kdV*Jr4_+m0m0 z&62{8eQ}^D@`8t14li|{Mk%*XV(bZBK}YDkNOk_|!E`r3J_Lj5DcGc8`2@M^_^>+% z%#qYz7=UV~7}b7NpCAL;@1n^mI6005OOe+(cEois2%GgkdLid-{yBsFb=;d!j>eVlarRxLP-=G26&{ zCdQp|-<=ok%-jgMZD?M+wGUvU@Lw{PyYA^bqC!bES<4QW#Z%7OVfkvDiG^ z)$3xTIFv^0@(l<^v4X@aV6!GY?D2Sk?Z;%hJ<7LCJ)xkYuyVgYbNp+g z;R0r>RrKs>*^X=?{t0aILXN3M=&3D&4Pj>ZKds+BiaPpM?!@Q}%CqO>94=6@Zx3AZ z!Q_wDFI-OjT-WPL?6IzxFL_r0ZJHG84G!WkgiJHtX4kWg`T7`ZB4ApWPvr!C0D?;P zB;Z-{kfs(#$|Ah=*NFzi_b9syBY_$+Kb-thqIZYVGkz8kE?1!n5BW~T(uLKiQ?Pf! z8V!yrmNMRRZ#J3K!WQQ|*5p3N(Xj9ZiVDQZD_(78n`I}^)5uI&7)6#jv^7G9{a+c& zs9`=vPmSh(rfAEX5z;N4&w6>l?J@aT_EqViRf8OO#Fj``Do%{E=t=!E=VU%vB;H}! zuO%r4(g|(oSmXAOBUG%YGOa?M0W3wqG}_o9(?uod-j?SHh8f;CL= z9(8Yj^WA-eMuja%{xi0*fP*nxD#kcau;3~(H?PR5Qu9k;UR8F+@!6LLukz>f)picX z^!iCzvaoa6-}-XdMu zNW83SZw+HRHjAS_OMfe#Bl4dK#|w| zh{YiZrE@6>&EK8BHi@j%>=4|6pL`3rcgBlvCh+k|WnMd<FbO$vCxiF z=n{oqzKJ|{?^-L!o1G`=>DKJ*U?`A4L$Qft5e&8fqB=-~oG&Z*XYu{5hD~uQjPW+{ zdDItVZByP(t@^S-?r1>|<}0_F%{C%PJd==lr|s?1 z1u}zYg(e$~>b3p$Yf(0KNSmQ35ic*cRJh59KcO^+Yk&D-O_#JW?#!}_v|`HmjsSK{ zh)j;KokJsF5l823DNhE|4!Yzg%tF$>J0-0j>D4uFO|1WVzfz+wo2cHP>7^mR?PNjc z1poF+=j2ytL^Q9_9xeUinTWTIRhjcCg8kx(w>z{xtgcGl9-%rE_ixD_j(Tp&7nb*i zBiMcqhADh8bJfzc6lb`J?Ik1NdANJ=CKP%yo&_8gL@7PHDBaq05;SRY%B+5ZSFbdr z+BQ7>5_4*1=!qsI`&XI@dmCC~OQf@iIV*XvS?{7vE1_=5IpYB0+2r2rjWN(z<@m*S5B7x@&>e1GAP5*Ksp z(|A#-CJfM=XL)U{#;!*QQcu6?+=YsL7Ob7XQqAp!SZhym#Ih#N@#uusuhRMC#y(BM z_|vU&XH^ip+T-R6=?1-%J=Y7ta{lCR(rDuj=t2@QHTS=7QoCnL7I3Kd%iF&yV^D!) z)Z)kWN#z1(j8DHumVWj2VO^9qC49N*mL@7IL52m#C(&u{??yRRF7M_XN9)tqPNl(?WTq5Nua95I_Vr z3H0%(+Q`aU6kknIVUA^C%K)94B`yP`VtD8<9L0IqsyU3mp zl7puMmvC$id7?53@{tC*TSdnEAy2g-WYX`|?9;d|@b~?`-Q6vFI*2EVyh6LmVr^}$ zR$VP-Wld{kKY+J$q6fNoI(lB#v`lxkT(TAau1Cl^)%+c7rixML{7D)pkMgSI^lkI< z8++~js5M=*$2oZisZ+Keb>W=a1ua)^kvWLX;lq3Gs+I#%dcj8=-fByt9EB|k@1#Od z)aB5Scs#xd8}vblzBcJU+|x_}?a6WelIj||{G20zCLh@OeG{|O$Ayy-`IrU(jjO=|kFs1T?c~HM=y8?flELWozEy_g9Un z-s@Ig_8Q>DkErbO)pf23hfa157r2)_TXlG)Yw~O|=zhlDTN4 z3oPd1pU>;-qid$eV84clbH`G>s&lbU3Rhp#w zT2`7W@Ko05 zIy$IaC*7qMnzg>4(eML0prSd+|05vN(U?0!sF6aqFSc_WS$g+z!Do}?h|*YZ?hHK? z9s2J+tYrFn;Yr{*eSd0s_T!lH2N-}uDG;%8QM;c<2OVT`z)m)91|KrehNE0+1^PVE z7YQIl67S&M35tuqET2F2%xgP$h8nc2daw&hnbz#pdR;s#Re>n~e8~k0Z4Ri76FlC+fI6Rk^GMS?R;j)|VV}_!+1n8mei74%+&FL0@^m}XI$QaI-OqF3- zOe4<4wV*&OjF+0^7jnO3ny4)PEAMMOae)^~J|!weK7(bJK&Z5v`^gx)X0)QutdAv* zynE@LYTQ&7Wb#%AdHIeWhosnTp5cdFByq0p$S(2wdzdo!KS*##GSW52>@|eFatNbN zpX{Sl3VB(jhNrKegc}w354-aDx61K(Xm_b{vc=Vz$DwaE9zjG*i5>6$zhV}M67=u=jCD?8Nb&FJ-L2I$GA#rO$T(hQG$_C6_dt(?jqAba| zjK4G5P|1b~_|U!z6y3R2$(c~RkBp8RRN-`&Kq8~@aFHP+*A4jQsG<)n+my1hFF2#~;SvqUITPG^p#B&u&#QSbj$YTT!ZzPUiV) zXO8>mOU819VdPd4viNqZsWH;qE%AH4(r1>*u?v=&fInE~p?);3xqcNZ5g=m{9y=PN zAQ1uXq!`&MT-cN(!$Rl~^gnf|!howIa5|v;;9Mk@-iSAKQU77*Z`NC5L7{|n$^^I8 zN*xsaKHsSFuNRcW;D{Smb&embcW0$``WPWvM;Y)~QHzsd{NK5ZQTt}4J}sDAk@iyc z3)ZyMXlpTlBTh@R%hd5;Iv*`e!Tsr4fjm%1Ei0+7L`Tb%kJx>I93QJ(UGS`~5aj== z?z^L+YL*J8^B@S8xeyy zF$lBH=h$5T2=Pw?nG;wfsPWpuVPyyEt7jI1tQNEy~O3PIKZ9Xd_Ak zeFx>Fr88EOu(~5d4-hjqhm$1XQ67i=p%*obkrzIMy4A02KE=Q|=i&qT;95p!oDwym+~ zu)ZX|$|oGB@!ttGo9Wls)9jf%;2aB9xP=?LeJ=F6o>+?$0zIFzJooS3YgB@ZRkW7NIzkjwCDFvBdWnKb=$3 ze)&DRk@=HOJVySbeR&KPf3hNn!COldc`r=Nl6$NoUlM{C!I6v`Zac33aM zQq0Q=)~&-DJ8buFXuEJ@VadCnI5R8$qU1Sv;8|owUrRRJ>{yLhAk|ERJ$f5ygqC+;xqORjc^K`F(UZp< z5{|1c^t|WqFV@Gqk)1(>|g7$wh*QXE<*Qd)%Xjna2a3N5a2j@(;ZJ)SLtGOc%NC%cT7 z1|iO_s6V@;-bw-wjrAsc13bTzAL&NNH&V!hgSgkHkUn#3a9%I)F~IbB$U@k)KK_vi zXrw#q&tA=YHA*|7!$_80Z$e_89y?koblv-mjkre=1h#*^>`emJ-?;&oy}kfIE8Rom z3VM16h>*Fu0GPllkVDW@ko(oeWzS0%%a#yLR`x;_^JCI*u%S<^e9T#}ZpK!(X@w(j z^7+{iASN)_X`3kzZj2X2e;4p|*=rx_otj}8`>vtK&Qow-t{i^ho;Im>1(Z2oq%Mz5hJWr~VQ)N-9`gBUh4B4U^_YS*NWl3?cv z{|M;~F0QX`4?6su57h!f1S1!7wWSE&()y5mrg5O z*P0cnqocz9A|~(DdJRhf2fN*#L$<^i|>_o;s zns_6$I((XObvJQm?+HMGTgb(>yz0hHvM}ycWn|#}$bH)(25S{%iBIipQR6njGDNQ6 z{2^bn*L`6CK&(ExhgCO|A}2|!UHOrEc&n-_bkriHJ#_&G@bc)MtioqwTBssCUreEX zrSKd;CJQ@)-_mFOs5`;jp5=gxG<}HC5^-j_pN(egf}i`Vp!S!QgwJi|N-A|6@%@7v zOgyN-!iiPm#O~aCr|Y?Q_Bx`tJ$%1-e=WlN6ym%|*{wN9;gaq8xICQf$}rT{F5uox z{4oVB)aO@A8nVBS6!~fdauSUabCG zsj0jK;96z`${uI_FxmOw7S|`f)h1eAWl%Q&a|*BA*9U3q2;%S!m>>;a8Dz){w)G)V`e7Pt)@| z-3i~wz$YozyPs%K9|B+YJR33aelp^B&#dM~aGY7TN#32*+999Shea`zStRw}dw%k^ zo2&+&Q<-hxA=uZS*Wdr0ECL-`Eq)TlSFS?_euoxm^TgVWA`9I=CJh^Kb)e}BQ57~z z3U?GMbb6kdNWT5Z7i(Oq(5y>yO4ypLKmJ)@p?@9Q+v7EcfnuB9j>#aR0jdTFE%u*Rk7hUF zoS(Lh1jfk$R0$rk5YEPr*Z8;9J5pSjBDj|6xB zpb1y~D&M{~OLXebrD#GFpmqx$g68_X;yY-lR8Gj}H!36Mn}@L~TIi=4-ZrCn~-DL*}@zOB836i z($9Csajs4-iK5fo-u+8NCJW|q8%o`zXRA9fpOV5_gTK&l44zz10VUu zP%CPhnUImI5#8=ihBGN!#=XKep=7aD@-UYY!nse5 z(D!ImCT8{S@Yi5NtDxU8)w!DqHS2+X8bfqCGltGdUg6I>U?j#@2%J!;-od7-z9XAkFrbfVuzr~hYgh8^%o(P>Grh*C9$UaZj9k@zo z2wnL8t1V*qBi8OO@poNZjpsvFv)zC4z?K*`>)daBBE9>?g433Zms{{bOv(9ptOyqB z;%ziG+}?gV&KKUQZR+Ya$Y*2#{tzcRaGPCJk{D3Odd~h)lVxhH_u!#;De8Hq$D-$3 zjYPtT#|8>fktpN)_FZy=wUONf&)ZtVQ<#jUls3OKWz{kO0xEZ<(P9!MoH4?>Nb=Nd zY^iAPb<9kM=^yTyk55wF4b?B@-Hh?!R4jy@HeHlD^4I2ADAO!Gb9Al)~sBK{YVM8l0gOnWY!3pM($8I{U14;p7a!Q-J!PpO#Rh0qJUiL+Q1R z2Ep|o^&7AJb3a%x_YXF=bSCA4 zgh|em$oNC3Wpy875=f6{Ku-D+pAp2|7x@Kl>orICIYBYczL0zCu+T%J@A1~^52f?B zn~@WAyiWytm%u-YuJ#4^Q`R`CV#iaxJ=l~_Nnq9TsFJH zA5w`$>*M=)N{^r4=PYB=+DMk@J?Z4)ixEp5oU`jFQz5nc>Ac zG@!XYlNQKwMbc#b`NsPLKJjE?o6d(zuUzNXP5#=_;gEFB&Kd$qnhH$c-3-0nOa7<~B#Fn4DvoLWus8g?K8vbJ~GqwgUM+ zAJy}=STg+CC*}y&=IAJD7wEkRvOl_E>`$gL#y9XA2zS}UR zqW{r4UkM}RVj$hdS~@X(+lZ-zg*BcutXh-LdMYzI zW&{E-OS;j1`VftE^@on}gDNJZO_P`ehl&QD@2JV{ROCG|BzgxCk6)NzI3eSef84J0 zaz_ew^8Hp0)TN=~cKMAQi$eQn--Oc|-!`;exft50Gs0}4xSs`2xjq_|*RSVhm)=(A zP1yz|4U_ax^2(EgWm506F0rjnY-5>=`=*gdm<@gZwKOvqg|#|F&UtWw56(+ zzlA+(yrl892nE<{1Z4C!b=hC8oA=JO#!uYxbjpo=_uPul(EI&7xBM&jXP6~T!`%Qu0Vjh+>7-6uVSdOoH<(nF zWye1>33wW)7=SjZsXMsyOCTi41)BU*&BYA$W#4ekmKM_u_T0l|q zjSRKqA3iF}``k@Dgg;8d%LPl+Y<<7Mo;U0nP1)Xx;;7rxtx%NYi6F zN{fzt;V?x;E`RBIxrIQ=B1TdNSL_Mr^Cw}GUzRGcO#F@BVa0ro$)T9P@w+Ak!mYde zOIP}hETvbKh;!Jum&F6rgeTEQoamWq`|6ZW@3rG=8SQU+{IWFLdNZ;dFqn#TIbhH- zCFenYc_IY0GrPH3<*u}eA_v(` zQ5wd@;R}Qq@{ZWKZ-dgFOngboIO5jM{)jGvh{|P4dXR@6GavODmme}@J(3Xqjqp*t z_9h1C0PQJ{d8H50Iao7>^@XmXX}v6Xb z-5(d3Q_ZCdF{rJxGk_Hwyf_!?^(BL5^2sC&7w^85AgU2r{TxWuLqtDgj8kJ&Vg`q} znzrXjg}cYy=1$i3UjI?Tsp8+|M-)w8_7{$1_4= zRYOvZF0hlc|s6yK4RVV(Z|Y&{{6%m=R`>3(*->fa#k2y)K`rB*9iTD<{e&r4klwf z$A`X8IJRbHz#+8AMJ!R!Ljkn4c^PsCCkBsFZE{LAlZ%(InUa$FTz zk;;0IO>#b$R|j<|K+i2g?P-UO=&$kLq}YU&7tBu-wraZI`gbBEux6v-#ayr_tW+op zvn{qxBZ_cK%TkQtsNrtY4XwETH}Ro^ypYl)0ShsG2oKjz{tO)ExH+g0r}8of;u;Z* zpQwgNb9fqaYt8GIG8?0#FXyzuKH4VN!0hGPfzslY?2Tj#Sj?N8;ZH}(n9moV*!w&P zQb@nEU)!g-9+BTl$Igmu;6kpw83=F;M;}Aos6HA`wR|`k#dE{cL+)J)@x<)|CzIC` zcfuwuqp7^PdY2P)VI}_a521QcYs)`lW2gAsutX;TVF8#MeiCn{yqV=4pT~PIH(@`X z*Z54{Yz3uEX^Z6BUy0R>cid095EnTh?Nd(z>_pe*>*Wd0IkX<)1nu|!987-}9wSY{ zB-(Tw_@R$+Hf7>DqRAr$7o)iC<6FINO-UYGJumO;q(ozknZyb?jnX~i%rN;n*8cMT zO_!{Wged=Nvi$>3U&GXv(cb(VAMu`+IPr#t1D~UXv(m4%kRg@iC8;Ap*YdN+JF7Bi zYxpheKyBI{8boZw$iCIWW^6|UbMUrUregq3*^c|c%m zRkIrB*)RA~4L*;#vvOd_``;O%!eFZjRKdN#EV z%4%$!nkR9yARK6DVa9aB97~^NCiSU?Dl6fhFZ(0kOcJIstG;jZ%=Jk1!FOv~Q6%_X zEl9G_i`BOxt|4s3Z6jt8Tjk5UnlMP+A2A(H@kL2^;}zW(%5U#p>TbG4?kw!eDEK_v z=*=I<7H^ow5WHDE7pAzhBAB`1U9iD(m+aACnvWi1Z;osBD%3;e>^$gYd(P@ge{gk! zmg8t`j$*m1c3?eG7UzOjxN3hgo~sa~BF{_ESbqjtP(lCNht`3jj1*?Z_51Up4S7{s zd3W|cQT|et{hMjm?UvM6k?|TkFGnZeKWAozmM|_b)@x1{$Jx%U86oy@V_265Q5&oM z<8P`TJ)NMowc3wmusq2$Pyc3wFr8|+wBLx5ZM^ee$ALHPb<2Lh~apt0gzt zqgR;?ygm5iOS|7jC5Qf~)*^$kY8Z}t4Mxc3ni1@&7=RJ{a8AJ zb8xcpnwD1u<4B+7U9F~{;;80YdqAAV&Ihi!CE4s;gWCBOYS#E_JQ4MskScHTvU;>o z*T8m9U5+{YjsS+0aW|vVxrEo7lf0p-kHVGAo@|N)jN>TWtFJ^mV9H{u*QxB=&rv&< z_!(Ok@SR6DG=9-^f;C}s(;5-aP1_Z!Ddd|VYZ=4sN4l@ogGCwJdKzDJ$Kt_H7cbLo zF+GjJ#A*9yZObodg^!2F>znyi&wz`_H+@*i`qCgF(*QAB(aR*c-l3+&3w~JsU0TT@ z5tqSi)&xQxBSP_qN4h--oF9d$=weBqW#JGsd@!p7=BOY{;2RUnQWL}A04eysti-$)j-S1cO&m<~PjVt8 zQ+bR&(7llVu=Y%S0BV&U_-<=C2~zOE;Q>2t@0&as)$%8wJHM#8I7%e2s{Jg=jC}fW z9t+G3hCXq8)!(Ax_X5&zuV!9AN(+xFvjC%X4`@$qkt(EyMN=cwvn?8SKb7JM6Z5BO z-)7WFBz5-`Ii#>|eqVA5TH?=*HQv_N&Mue=oYZijz;yR*+iR8_J-CS{mQ*i+o#5TX zJv31k_3fHWAxOb!w@O%d(1+7+_dnE78g7BdHrq+QsXrfr(opDbZxYxyXjt!5;G#l} z5YQV8HIfSOo&B8;hCKv!12SQw%2=T7JTdl<$BHo4HUyF;Z1LQr;e6Ko48JGI?Y>WZ zazV?>2w}L}HUkBSk@aqnf^Vczk|jk?oY^X;DN$mOjV{bVyu-CQ%n%vXoyd6&8@RN8 z3~c#QieNx7d$#6GTRYGA4ofA@=ST4*SU7gdPEik8#&3OQwP5_r@?~&d#s&@zXe-?X z)vl6)TR+mi9qU{ORfrq;S%keoSk&N1;biqkrg>f+)g~v%aG|ze0Ih)L&3^>si9nc% z?vFC7P>0fZ)UdW-;$79S7(Ksv#}HK%kr*VHWe&L{D#J+V2+$z(-Q|xDDPH?mx4X>c z{-1g&su)x7^%0~DgSG91+Rg)wCIr(97?rp!_vTGMDJ)pv(N}NHy6=!ICWO!AHhh12 zk$~_j@<6`_hq{Wc%b@sgLN079>##LA@Z5YR(<6j+_~&*3 z{Z)vQA{%YldCz@%2C2)Vw>n1~wHvzjichfcP^sTG{2tsw(uzyOYSp-ZHUT#iCq}B! zAZh8IPY|FNysF*XGl0IzJ-cmdOWm@qcR&ie4E^K^;9_rNVB9Q1Y$~^Nw0*deX|wZD zy~BFr)P<;-?JlNG_oGN(@ndral!eOr2g15finYS!Yhp|&3G8C8quz+o*+LHCFyH;1 zKV}r(`%R78`Q5hGld-De>st$*vQv?kIy>zR0rd82=R4cM<>H-q#Z_PROjncHsIG<& z0J_;a&rU*$z3k88tLJ!{2<+D9qZQX`>!mT~GEwS=j%(8{@WfWH6Vo+uUpKD3Bc!F8 z#VzD$`=9txeJ`Sg`KHCBg6`o8pE7;3^^@jJFQOI_J$PbPEyU+!C0?g7u};JDs5xS2 zY!pNT!h~Q3zs254cdTxk$Nr~sk{p%D^Tu<(V197X5^szsS*wOei>T-%W_3R~u)$W| zw*tz>BU0+5^30jx{%Vcbg}}kG1M5K`!uqI^8n(D>1E(0^SYnlL6d_gP#JE!E5E#=b zdl+<}CZv(<2?0;OWz5^mu4rWDIo`X}BOBEB*ZMe*7$;)eWKxgx_r%^&tsZ;h?j^c&ZldeE(qsW)TqBw*5L~Udx zj|^mGN>)jZq-Vlmc!sQWu;UcBgT%&dM_B-G43f5*e`u6PukI8id@$& zcDk241r@9oH+_V0*wMTyPL$=l(uj!&2kI&z=gqEz7JE}>9On%lm7CqgajqY_FR)iJ z5E|#@$70AKdV{kEUPA{+frDc`;I#P{R^!>)Tp_h$|M17O!sBygZyNEneQDREacf8| zCTf}UghOfydN|%3xtY{L(Y<(Hv^}>Xu+?x-xw~*5qKU=@_pJje^)fn7=Y4$UHGYkK z+DP=W+d3Yk5U!Y<@|@o&-Hj+p4fO4vJW{-=>werTw>~T1P4Bp|^=r;r#yelJ{X>Jc zxtNZYH+A3dK1lLr5F~J9^KrT245_l!LU8XYC2V1eF;NYQ69$qWmF92JP z4zL&p?u#2JJ?T?>R^wJPRRaR?vJw!xiAf62!m|{=-)$1Vbr$Qv#2f55^7*%$%@FPb z5Gs^HBW41cm$6fx69b0(w}b~n64^H;Uq>xalyoK;9o>>ozZ7r+aH}ZNq;3B>#k(J9 zS9fE!md3X^x;ZV9xP_eUGpHHh3Pq-G{Tvz5KK538R0brig+asyJsxicka<)N^1F_$ zpY88YKQ}p00MA2(>!S(Ay>GlFpX68YQv(65Pf=P2P%V2ln{^e{V>X+Wl|*JN7Z?5L zMY~M;5F+wazu8|ZJ&&qWvbFItq=2**RZ!topi%!fAxBm`GiIp()&eKib-j6|IF6;^ zkJJxTDv+XdZ}Hu*)Uxcj4>`c4S1KE^TpD~J=C3ks7sv?*kWJTym4&YV$ z;*R%GkXtSZ2;**m1lgsjL8*^bdhGLAkxAo9s`>tXcdl_M^8^A({YK)UJJHa;YQ~b^ z@o^hm%hxAHFBNnN>ODY5^+huX9E9?k9a@pppz3oB(61mLuL(d8xh}8ST_d+24+07K zbL|!2-taBvXka|Df6Fuk9Rk1yJ>t6Ef(4`pjm|Pa%u;D)7j)7DeDTfO%?{DsP*2yUb!7Nt|H5hgULUhnm9~*8K zh01lF3EOK%e}^eiK#zFr`B%|s>y`tvmDnD(E)!{%*=nup?j&&6V?HE0vg*yW1@5-0 zkV>Av(u05=woXpt_(!eVJb$C@ih(rMe`HcoEdFjb#LZLaoaG&tHjaVS_iODzTy!B} zybyf~)?-( z{fVEkGJIq&qjSH#>~*~Prqo&>SNzl|B3^-ZeHT$0PXpUqXn7N&IKRfUXy-Jma^w`D zBGmXRCqWzr9??>sLj&$*h*SVB()AQ7O)ZySC~kW>p4k`j{2l2^ z&68OX8|!I10ll;K(XdKc+JkfB_$)(^%lU#8Cpcj?g89>V3Cq8uz8s3MwI1jY;aOf^ zw5`|6t*v+2tUG2%-b8NkkL542t8ho=uSeNqfO|QZz|-yqYE+s!NGg|;%LNxgQR?c| zwEy9g!k0d|0oYY@Qb&v7cpGwgI>OE!WFVp1;67Ma(FaBeB~szVbEo4RDYDCX8wa6_ zQRVoz+xS@lO1p1Wf(do)e0-~x(s$vqwyrIjs^L{CDP8R@=#GA}FC5#RsYz*DpS=3ng3 zYr&O5q=2U&HT{=(KjP6&;)VRx_}_JQm7WaOY|-j^f$n35@$T?Lv3uhCl1mkmOA~D3 zI}?gR-UlptLY}J=jVE?_b%W+&HkStRy@70ha;y~d&IBIj8V-n8LtP46e;0P0J7M8t zqx3PV62~FK6-_?U@QeU5&L>c}T0mcwI-~1$nGMFZ)V35zlxCq00eJW>XKoSKJo0LU6Ej#US6`$Xo$aR}v%XhulXe!=T&pN7N2dzU!cQ{j{J{tU@^U#JZT0^Htp6)~FYOHC1_z`ut0r>!8ym$2m>B;CDFpMdW?SiXNQ0+^ z%M#&VK}vuM^uY!X5e~%a|LwJPqCx*}*uFq_i$Xult~p$?@=~%Pl&DG$;Ih@7QeE(` zoxuAC?>h7|&BIq`;WH;%*wKr!@Pq4Ez4jwGU^~NU&>7Iwv^?Y2{(U=W_Mjc0-@FI$ z(H5&DKvEEc9_oA8{plI=vVNe#2HbLNdPy)3ixR;^3`1TBBPdEOjwKvZM(;agPM@lR z6BB097BHoz9o8O3w;I`9&h>~Ce*~qyf?FE zR_n$(vSpZWT>6^z=-h2&jrVBI@YsB0aj~qVrrpwH-R&qZuhT(0=xjE>(}y}^N@k7m zGLTWMIbDJ6mWTF?tYhAs)hrvXo18UihZDnrZCa(yDjv<|lj>o(6aDYCa_h_0WXxJm z7(6I!O{#+{!aGy*MK87-G=;>+N98Vveml*TUk&9P-T!-(Ei01#Y|AiDR85hb!Ke3f zVm_7Yl6X`fu(|0>)K}S!>!<9XMpGUk-z$5%u_`&fR=F~itKhgbk$k?wJ8T+}w%fuQ zyXH&S3o6#GTNXLbHu>8DOTc*V<{Lx0u5NMX{=n1=`4K)Z zCz2?Q=GIC2!av@Lt)1kBJJyObM8h!+oE_ae-Q+YO(XM(`zz!jT;LWqKy0 ziHBAQl;1&HYiz!>gumU~#G1l#eoO>e0OC@Y0}#2mx(3$5 z%zR{aFc|;RF=?D}k~~yVa+hONt|GYn($$P>6Vz8uGKiWS9=89pr>(FRMh=3Kupxx5 zmJy9~NTM@Njb?@7aHZf$sf>mA5lL^+?B-(hG~pU>TF&IiaxDeWyI) zbNu)Cy>7i+wtx#3$fZyI72SUq|EcdqCxnCSLesZ|N89t8G8=g=vwx(SPQ-2__gY}- zg~u(Vl1<~Bkc2jy^gV^skKtRV8{p#P)asqxKGc~80~m^#FeiGp__D# zu)janYrpvbQTmJ%U)!@^n|qQzqa6^~;eEB($$~i1ShhE!L%ya%&f`>3Re0Zk;SstB zA;K!D>GZ)B9nN&Yjg_4pi!@x68n!;6g!iYG;ni+9^{{~;eckJ@liY6jScGZSYRETW zIEtcs5XbEn(&Ep)6r5e~54cmMjr$E`9kqlA-r1HgqLaA9MbK)Xfv%wND}|qI5_6|B zTpCL&TRcwzu|uJ_5)UZ|u+~Ta^VUz72z9X66bulBEifZxvy-i`1kcH5x{P@c;LT!7 z2%+q&8juf6?IkH9RN^VnDPKLAD%d$0BisF|mJk^|oyix!u*$lWS063(k>1^H6Nh=Qo7~NESj*H|MzHwC>8s(^{f-T+3fyJqNu62HYV{JJ<=xO&H_*x z*W;t*792q*@nq{{c$(h!tQqr9tr99sNCgr+QmOL2dJ8h;6%Vyx7Hi YvKuAv^7rd30Q@H_rSP;s0`~TQ0pO*=PXGV_ literal 0 HcmV?d00001 diff --git a/tools/keeper/db/connector.go b/tools/keeper/db/connector.go new file mode 100644 index 000000000000..a8f106e95272 --- /dev/null +++ b/tools/keeper/db/connector.go @@ -0,0 +1,177 @@ +package db + +import ( + "context" + "database/sql" + "encoding/json" + "fmt" + "os" + "strings" + "time" + + "github.com/sirupsen/logrus" + "github.com/taosdata/driver-go/v3/common" + + _ "github.com/taosdata/driver-go/v3/taosRestful" + "github.com/taosdata/taoskeeper/infrastructure/config" + "github.com/taosdata/taoskeeper/infrastructure/log" + "github.com/taosdata/taoskeeper/util" +) + +type Connector struct { + db *sql.DB +} + +type Data struct { + Head []string `json:"head"` + Data [][]interface{} `json:"data"` +} + +var dbLogger = log.GetLogger("DB ") + +func NewConnector(username, password, host string, port int, usessl bool) (*Connector, error) { + var protocol string + if usessl { + protocol = "https" + } else { + protocol = "http" + } + dbLogger := dbLogger.WithFields(logrus.Fields{config.ReqIDKey: util.GetQidOwn()}) + dbLogger.Tracef("connect to adapter, host:%s, port:%d, usessl:%v", host, port, usessl) + + db, err := sql.Open("taosRestful", fmt.Sprintf("%s:%s@%s(%s:%d)/?skipVerify=true", username, password, protocol, host, port)) + if err != nil { + dbLogger.Errorf("connect to adapter failed, host:%s, port:%d, usessl:%v, error:%s", host, port, usessl, err) + return nil, err + } + + dbLogger.Tracef("connect to adapter success, host:%s, port:%d, usessl:%v", host, port, usessl) + return &Connector{db: db}, nil +} + +func NewConnectorWithDb(username, password, host string, port int, dbname string, usessl bool) (*Connector, error) { + var protocol string + if usessl { + protocol = "https" + } else { + protocol = "http" + } + + dbLogger := dbLogger.WithFields(logrus.Fields{config.ReqIDKey: util.GetQidOwn()}) + dbLogger.Tracef("connect to adapter, host:%s, port:%d, usessl:%v", host, port, usessl) + + db, err := sql.Open("taosRestful", fmt.Sprintf("%s:%s@%s(%s:%d)/%s?skipVerify=true", username, password, protocol, host, port, dbname)) + if err != nil { + dbLogger.Errorf("connect to adapter failed, host:%s, port:%d, db:%s, usessl:%v, error:%s", host, port, dbname, usessl, err) + return nil, err + } + + dbLogger.Tracef("connect to adapter success, host:%s, port:%d, db:%s, usessl:%v", host, port, dbname, usessl) + return &Connector{db: db}, nil +} + +func (c *Connector) Exec(ctx context.Context, sql string, qid uint64) (int64, error) { + dbLogger := dbLogger.WithFields(logrus.Fields{config.ReqIDKey: qid}) + ctx = context.WithValue(ctx, common.ReqIDKey, int64(qid)) + + dbLogger.Tracef("call adapter to execute sql:%s", sql) + startTime := time.Now() + res, err := c.db.ExecContext(ctx, sql) + + endTime := time.Now() + latency := endTime.Sub(startTime) + + if err != nil { + if strings.Contains(err.Error(), "Authentication failure") { + dbLogger.Error("Authentication failure") + ctxLog, cancelLog := context.WithTimeout(context.Background(), 3*time.Second) + defer cancelLog() + log.Close(ctxLog) + os.Exit(1) + } + dbLogger.Errorf("latency:%v, sql:%s, err:%s", latency, sql, err) + return 0, err + } + + rowsAffected, err := res.RowsAffected() + if err != nil { + dbLogger.Errorf("latency:%v, err:%s", latency, err) + return rowsAffected, err + } + + dbLogger.Tracef("response ok, rowsAffected:%v, latency:%v", rowsAffected, latency) + + return rowsAffected, err +} + +func logData(data *Data, logger *logrus.Entry) { + if data == nil { + logger.Tracef("No data to display") + return + } + + jsonData, err := json.Marshal(data) + if err != nil { + logger.Errorf("Failed to marshal data to JSON: %v", err) + return + } + logger.Tracef("query result data:%s", jsonData) +} + +func (c *Connector) Query(ctx context.Context, sql string, qid uint64) (*Data, error) { + dbLogger := dbLogger.WithFields(logrus.Fields{config.ReqIDKey: qid}) + ctx = context.WithValue(ctx, common.ReqIDKey, int64(qid)) + + dbLogger.Tracef("call adapter to execute query, sql:%s", sql) + + startTime := time.Now() + rows, err := c.db.QueryContext(ctx, sql) + + endTime := time.Now() + latency := endTime.Sub(startTime) + + if err != nil { + if strings.Contains(err.Error(), "Authentication failure") { + dbLogger.Error("Authentication failure") + ctxLog, cancelLog := context.WithTimeout(context.Background(), 3*time.Second) + defer cancelLog() + log.Close(ctxLog) + os.Exit(1) + } + dbLogger.Errorf("latency:%v, sql:%s, err:%s", latency, sql, err) + return nil, err + } + + dbLogger.Tracef("response ok, latency:%v, sql:%s", latency, sql) + + data := &Data{} + data.Head, err = rows.Columns() + columnCount := len(data.Head) + if err != nil { + dbLogger.Errorf("get columns error, msg:%s", err) + return nil, err + } + scanData := make([]interface{}, columnCount) + for rows.Next() { + tmp := make([]interface{}, columnCount) + for i := 0; i < columnCount; i++ { + scanData[i] = &tmp[i] + } + err = rows.Scan(scanData...) + if err != nil { + rows.Close() + dbLogger.Errorf("rows scan error, msg:%s", err) + return nil, err + } + data.Data = append(data.Data, tmp) + } + + if dbLogger.Logger.IsLevelEnabled(logrus.TraceLevel) { + logData(data, dbLogger) + } + return data, nil +} + +func (c *Connector) Close() error { + return c.db.Close() +} diff --git a/tools/keeper/db/empty_test.go b/tools/keeper/db/empty_test.go new file mode 100644 index 000000000000..52e32e1f8913 --- /dev/null +++ b/tools/keeper/db/empty_test.go @@ -0,0 +1,8 @@ +package db + +import ( + "testing" +) + +func TestEmpty(t *testing.T) { +} diff --git a/tools/keeper/docker-compose.yml b/tools/keeper/docker-compose.yml new file mode 100644 index 000000000000..f7f43fe112be --- /dev/null +++ b/tools/keeper/docker-compose.yml @@ -0,0 +1,29 @@ +version: "3.7" + +services: + tdengine: + image: tdengine/tdengine:3.0.1.6 + environment: + TZ: Asia/Shanghai + TAOS_FQDN: tdengine + volumes: + - taosdata:/var/lib/taos + taoskeeper: + build: ./ + depends_on: + - tdengine + environment: + TDENGINE_HOST: tdengine + TDENGINE_PORT: 6041 + volumes: + - ./config/taoskeeper.toml:/etc/taos/taoskeeper.toml + ports: + - 6043:6043 + prometheus: + image: prom/prometheus + volumes: + - ./prometheus/:/etc/prometheus/ + ports: + - 9090:9090 +volumes: + taosdata: diff --git a/tools/keeper/examples/metrics.toml b/tools/keeper/examples/metrics.toml new file mode 100644 index 000000000000..9dbfea2323df --- /dev/null +++ b/tools/keeper/examples/metrics.toml @@ -0,0 +1,38 @@ +prefix = "taos" +cluster = "localhost" +database = "log" +explicit = false + +[tables.restful_info] +[tables.slowquery] +[tables.cluster_info] +[tables.grants_info] +[tables.disks_info] + +[tables.logs] +explicit = true +[tables.logs.metrics.content] +type = "info" +help = "login types or messages" +[tables.logs.metrics.level] +type = "gauge" +help = "login level" + +[tables.dnodes_info] +[tables.dnodes_info.metrics.has_mnode] +type = "gauge" +help = "check if the node has mnode" + +[tables.vgroups_info] +column_as_variables = ["database_name", "dnode_roles", "dnode_ids"] +explicit = false + +[tables.vgroups_info.metrics.tables_num] +type = "gauge" +help = "Tables count of the vgroup" +[tables.vgroups_info.metrics.online_vnodes] +type = "gauge" +help = "Online v-nodes of the v-group" +[tables.vgroups_info.metrics.status] +type = "info" +help = "Status of the v-group" diff --git a/tools/keeper/go.mod b/tools/keeper/go.mod new file mode 100644 index 000000000000..f520ceb774a2 --- /dev/null +++ b/tools/keeper/go.mod @@ -0,0 +1,80 @@ +module github.com/taosdata/taoskeeper + +go 1.18 + +require ( + github.com/BurntSushi/toml v0.4.1 + github.com/gin-gonic/gin v1.9.1 + github.com/kardianos/service v1.2.1 + github.com/panjf2000/ants/v2 v2.4.6 + github.com/prometheus/client_golang v1.12.2 + github.com/shirou/gopsutil/v3 v3.22.4 + github.com/shopspring/decimal v1.3.1 + github.com/sirupsen/logrus v1.8.1 + github.com/spf13/pflag v1.0.5 + github.com/spf13/viper v1.12.0 + github.com/stretchr/testify v1.9.0 + github.com/taosdata/driver-go/v3 v3.5.8 + github.com/taosdata/file-rotatelogs/v2 v2.5.2 + github.com/taosdata/go-utils v0.0.0-20211022070036-018cc5f2432a +) + +require ( + github.com/beorn7/perks v1.0.1 // indirect + github.com/bytedance/sonic v1.9.1 // indirect + github.com/cespare/xxhash/v2 v2.1.2 // indirect + github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/fsnotify/fsnotify v1.5.4 // indirect + github.com/gabriel-vasile/mimetype v1.4.2 // indirect + github.com/gin-contrib/cors v1.3.1 // indirect + github.com/gin-contrib/gzip v0.0.3 // indirect + github.com/gin-contrib/pprof v1.3.0 // indirect + github.com/gin-contrib/sse v0.1.0 // indirect + github.com/go-ole/go-ole v1.2.6 // indirect + github.com/go-playground/locales v0.14.1 // indirect + github.com/go-playground/universal-translator v0.18.1 // indirect + github.com/go-playground/validator/v10 v10.14.0 // indirect + github.com/goccy/go-json v0.10.2 // indirect + github.com/golang/protobuf v1.5.2 // indirect + github.com/google/uuid v1.3.0 // indirect + github.com/gorilla/websocket v1.5.0 // indirect + github.com/hashicorp/hcl v1.0.0 // indirect + github.com/json-iterator/go v1.1.12 // indirect + github.com/klauspost/cpuid/v2 v2.2.4 // indirect + github.com/leodido/go-urn v1.2.4 // indirect + github.com/lestrrat-go/strftime v1.0.6 // indirect + github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect + github.com/magiconair/properties v1.8.6 // indirect + github.com/mattn/go-isatty v0.0.19 // indirect + github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect + github.com/mitchellh/mapstructure v1.5.0 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/pelletier/go-toml v1.9.5 // indirect + github.com/pelletier/go-toml/v2 v2.0.8 // indirect + github.com/pkg/errors v0.9.1 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect + github.com/prometheus/client_model v0.2.0 // indirect + github.com/prometheus/common v0.32.1 // indirect + github.com/prometheus/procfs v0.7.3 // indirect + github.com/spf13/afero v1.8.2 // indirect + github.com/spf13/cast v1.5.0 // indirect + github.com/spf13/jwalterweatherman v1.1.0 // indirect + github.com/subosito/gotenv v1.3.0 // indirect + github.com/tklauser/go-sysconf v0.3.10 // indirect + github.com/tklauser/numcpus v0.4.0 // indirect + github.com/twitchyliquid64/golang-asm v0.15.1 // indirect + github.com/ugorji/go/codec v1.2.11 // indirect + github.com/yusufpapurcu/wmi v1.2.2 // indirect + golang.org/x/arch v0.3.0 // indirect + golang.org/x/crypto v0.9.0 // indirect + golang.org/x/net v0.10.0 // indirect + golang.org/x/sys v0.24.0 // indirect + golang.org/x/text v0.9.0 // indirect + google.golang.org/protobuf v1.30.0 // indirect + gopkg.in/ini.v1 v1.66.4 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) diff --git a/tools/keeper/go.sum b/tools/keeper/go.sum new file mode 100644 index 000000000000..9c7721c4d71c --- /dev/null +++ b/tools/keeper/go.sum @@ -0,0 +1,764 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= +cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.44.3/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= +cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= +cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= +cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= +cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= +cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= +cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= +cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= +cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= +cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI= +cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk= +cloud.google.com/go v0.75.0/go.mod h1:VGuuCn7PG0dwsd5XPVm2Mm3wlh3EL55/79EKB6hlPTY= +cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= +cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= +cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= +cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= +cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= +cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= +cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= +cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= +cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= +cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= +cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= +cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= +cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= +cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/toml v0.4.1 h1:GaI7EiDXDRfa8VshkTj7Fym7ha+y8/XxIgD2okUIjLw= +github.com/BurntSushi/toml v0.4.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/Shopify/sarama v1.29.1/go.mod h1:mdtqvCSg8JOxk8PmpTNGyo6wzd4BMm4QXSfDnTXmgkE= +github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= +github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= +github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= +github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= +github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM= +github.com/bytedance/sonic v1.9.1 h1:6iJ6NqdoxCDr6mbY8h18oSO+cShGSMRGCEo7F2h0x8s= +github.com/bytedance/sonic v1.9.1/go.mod h1:i736AoUSYt75HyZLoJW9ERYxcy6eaN6h4BZXU064P/U= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE= +github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/chenzhuoyu/base64x v0.0.0-20211019084208-fb5309c8db06/go.mod h1:DH46F32mSOjUmXrMHnKwZdA8wcEefY7UVqBKYGjpdQY= +github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 h1:qSGYFH7+jGhDF8vLC+iwCD4WpbV1EBDSzWkJODFLams= +github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311/go.mod h1:b583jCggY9gE99b6G5LEC39OIiVsWj+R97kbl5odCEk= +github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/deathowl/go-metrics-prometheus v0.0.0-20200518174047-74482eab5bfb/go.mod h1:kZ9Xvhj+PTMJ415unU/sutrnWDVqG0PDS/Sl4Rt3xkE= +github.com/eapache/go-resiliency v1.2.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= +github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= +github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= +github.com/eclipse/paho.mqtt.golang v1.3.5/go.mod h1:eTzb4gxwwyWpqBUHGQZ4ABAV7+Jgm1PklsYT/eo8Hcc= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po= +github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= +github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k= +github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE= +github.com/fsnotify/fsnotify v1.5.4 h1:jRbGcIw6P2Meqdwuo0H1p6JVLbL5DHKAKlYndzMwVZI= +github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU= +github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q7OhCmWKU= +github.com/gabriel-vasile/mimetype v1.4.2/go.mod h1:zApsH/mKG4w07erKIaJPFiX0Tsq9BFQgN3qGY5GnNgA= +github.com/gin-contrib/cors v1.3.1 h1:doAsuITavI4IOcd0Y19U4B+O0dNWihRyX//nn4sEmgA= +github.com/gin-contrib/cors v1.3.1/go.mod h1:jjEJ4268OPZUcU7k9Pm653S7lXUGcqMADzFA61xsmDk= +github.com/gin-contrib/gzip v0.0.3 h1:etUaeesHhEORpZMp18zoOhepboiWnFtXrBZxszWUn4k= +github.com/gin-contrib/gzip v0.0.3/go.mod h1:YxxswVZIqOvcHEQpsSn+QF5guQtO1dCfy0shBPy4jFc= +github.com/gin-contrib/pprof v1.3.0 h1:G9eK6HnbkSqDZBYbzG4wrjCsA4e+cvYAHUZw6W+W9K0= +github.com/gin-contrib/pprof v1.3.0/go.mod h1:waMjT1H9b179t3CxuG1cV3DHpga6ybizwfBaM5OXaB0= +github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= +github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= +github.com/gin-gonic/gin v1.5.0/go.mod h1:Nd6IXA8m5kNZdNEHMBd93KT+mdY3+bewLgRvmCsR2Do= +github.com/gin-gonic/gin v1.6.2/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M= +github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M= +github.com/gin-gonic/gin v1.7.2/go.mod h1:jD2toBW3GZUr5UMcdrwQA10I7RuaFOl/SGeDjXkfUtY= +github.com/gin-gonic/gin v1.9.1 h1:4idEAncQnU5cB7BeOkPtxjfCSye0AAm1R0RVIqJ+Jmg= +github.com/gin-gonic/gin v1.9.1/go.mod h1:hPrL7YrpYKXt5YId3A/Tnip5kqbEAP+KLuI3SUcPTeU= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= +github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= +github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= +github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= +github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= +github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= +github.com/go-playground/locales v0.12.1/go.mod h1:IUMDtCfWo/w/mtMfIE/IG2K+Ey3ygWanZIBtBW0W2TM= +github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= +github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= +github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= +github.com/go-playground/universal-translator v0.16.0/go.mod h1:1AnU7NaIRDWWzGEKwgtJRd2xk99HeFyHw3yid4rvQIY= +github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= +github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= +github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= +github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI= +github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4= +github.com/go-playground/validator/v10 v10.14.0 h1:vgvQWe3XCz3gIeFDm/HnTIbj6UGmg/+t63MyGU2n5js= +github.com/go-playground/validator/v10 v10.14.0/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= +github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= +github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= +github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= +github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= +github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= +github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= +github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= +github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= +github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4= +github.com/gorilla/sessions v1.2.1/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM= +github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= +github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/jcmturner/aescts/v2 v2.0.0/go.mod h1:AiaICIRyfYg35RUkr8yESTqvSy7csK90qZ5xfvvsoNs= +github.com/jcmturner/dnsutils/v2 v2.0.0/go.mod h1:b0TnjGOvI/n42bZa+hmXL+kFJZsFT7G4t3HTlQ184QM= +github.com/jcmturner/gofork v1.0.0/go.mod h1:MK8+TM0La+2rjBD4jE12Kj1pCCxK7d2LK/UM3ncEo0o= +github.com/jcmturner/goidentity/v6 v6.0.1/go.mod h1:X1YW3bgtvwAXju7V3LCIMpY0Gbxyjn/mY9zx4tFonSg= +github.com/jcmturner/gokrb5/v8 v8.4.2/go.mod h1:sb+Xq/fTY5yktf/VxLsE3wlfPqQjp0aWNYyvBVK62bc= +github.com/jcmturner/rpc/v2 v2.0.3/go.mod h1:VUJYCIDm3PVOEHw8sgt091/20OJjskO/YJki3ELg/Hc= +github.com/jonboulle/clockwork v0.4.0 h1:p4Cf1aMWXnXAUh8lVfewRBx1zaTSYKrKMF2g3ST4RZ4= +github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= +github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= +github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= +github.com/kardianos/service v1.2.1 h1:AYndMsehS+ywIS6RB9KOlcXzteWUzxgMgBymJD7+BYk= +github.com/kardianos/service v1.2.1/go.mod h1:CIMRFEJVL+0DS1a3Nx06NaMn4Dz63Ng6O7dl0qH0zVM= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/klauspost/compress v1.12.2/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= +github.com/klauspost/compress v1.13.4/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= +github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= +github.com/klauspost/cpuid/v2 v2.2.4 h1:acbojRNwl3o09bUq+yDCtZFc1aiwaAAxtcn8YkZXnvk= +github.com/klauspost/cpuid/v2 v2.2.4/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/leodido/go-urn v1.1.0/go.mod h1:+cyI34gQWZcE1eQU7NVgKkkzdXDQHr1dBMtdAPozLkw= +github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= +github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q= +github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4= +github.com/lestrrat-go/envload v0.0.0-20180220234015-a3eb8ddeffcc h1:RKf14vYWi2ttpEmkA4aQ3j4u9dStX2t4M8UM6qqNsG8= +github.com/lestrrat-go/envload v0.0.0-20180220234015-a3eb8ddeffcc/go.mod h1:kopuH9ugFRkIXf3YoqHKyrJ9YfUFsckUU9S7B+XP+is= +github.com/lestrrat-go/strftime v1.0.6 h1:CFGsDEt1pOpFNU+TJB0nhz9jl+K0hZSLE205AhTIGQQ= +github.com/lestrrat-go/strftime v1.0.6/go.mod h1:f7jQKgV5nnJpYgdEasS+/y7EsTb8ykN2z68n3TtcTaw= +github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4= +github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= +github.com/magiconair/properties v1.8.6 h1:5ibWZ6iY0NctNGWo87LalDlEZ6R41TqbbDamhfG/Qzo= +github.com/magiconair/properties v1.8.6/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= +github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= +github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= +github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 h1:I0XW9+e1XWDxdcEniV4rQAIOPUGDq67JSCiRCgGCZLI= +github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= +github.com/minio/highwayhash v1.0.1/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= +github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= +github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/nats-io/jwt v1.2.2/go.mod h1:/xX356yQA6LuXI9xWW7mZNpxgF2mBmGecH+Fj34sP5Q= +github.com/nats-io/jwt/v2 v2.0.3/go.mod h1:VRP+deawSXyhNjXmxPCHskrR6Mq50BqpEI5SEcNiGlY= +github.com/nats-io/nats-server/v2 v2.5.0/go.mod h1:Kj86UtrXAL6LwYRA6H4RqzkHhK0Vcv2ZnKD5WbQ1t3g= +github.com/nats-io/nats.go v1.12.1/go.mod h1:BPko4oXsySz4aSWeFgOHLZs3G4Jq4ZAyE6/zMCxRT6w= +github.com/nats-io/nkeys v0.2.0/go.mod h1:XdZpAbhgyyODYqjTawOnIOI7VlbKSarI9Gfy1tqEu/s= +github.com/nats-io/nkeys v0.3.0/go.mod h1:gvUNGjVcM2IPr5rCsRsC6Wb3Hr2CQAm08dsxtV6A5y4= +github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= +github.com/panjf2000/ants/v2 v2.4.6 h1:drmj9mcygn2gawZ155dRbo+NfXEfAssjZNU1qoIb4gQ= +github.com/panjf2000/ants/v2 v2.4.6/go.mod h1:f6F0NZVFsGCp5A7QW/Zj/m92atWwOkY0OIhFxRNFr4A= +github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= +github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= +github.com/pelletier/go-toml/v2 v2.0.8 h1:0ctb6s9mE31h0/lhu+J6OPmVeDxJn+kYnJc2jZR9tGQ= +github.com/pelletier/go-toml/v2 v2.0.8/go.mod h1:vuYfssBdrU2XDZ9bYydBu6t+6a6PYNcZljzZR9VXg+4= +github.com/pierrec/lz4 v2.6.0+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF4JjgDlrVEn3C11VoGHZN7m8qihwgMEtzYw= +github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= +github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= +github.com/prometheus/client_golang v1.1.0/go.mod h1:I1FGZT9+L76gKKOs5djB6ezCbFQP1xR9D75/vuwEF3g= +github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= +github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= +github.com/prometheus/client_golang v1.12.2 h1:51L9cDoUHVrXx4zWYlcLQIZ+d+VXHgqnYKkIuq4g/34= +github.com/prometheus/client_golang v1.12.2/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= +github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc= +github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= +github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= +github.com/prometheus/common v0.32.1 h1:hWIdL3N2HoUx3B8j3YN9mWor0qhY/NlEKZEaXxuIRh4= +github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= +github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.0.3/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= +github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/prometheus/procfs v0.7.3 h1:4jVXhlkAyzOScmCkXBTOLRLTz8EeU+eyjrwB/EPq0VU= +github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/rcrowley/go-metrics v0.0.0-20190826022208-cac0b30c2563/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= +github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k= +github.com/shirou/gopsutil/v3 v3.22.4 h1:srAQaiX6jX/cYL6q29aE0m8lOskT9CurZ9N61YR3yoI= +github.com/shirou/gopsutil/v3 v3.22.4/go.mod h1:D01hZJ4pVHPpCTZ3m3T2+wDF2YAGfd+H4ifUguaQzHM= +github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= +github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= +github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= +github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= +github.com/spf13/afero v1.8.2 h1:xehSyVa0YnHWsJ49JFljMpg1HX19V6NDZ1fkm1Xznbo= +github.com/spf13/afero v1.8.2/go.mod h1:CtAatgMJh6bJEIs48Ay/FOnkljP3WeGUG0MC1RfAqwo= +github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w= +github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU= +github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk= +github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.12.0 h1:CZ7eSOd3kZoaYDLbXnmzgQI5RlciuXBMA+18HwHRfZQ= +github.com/spf13/viper v1.12.0/go.mod h1:b6COn30jlNxbm/V2IqWiNWkJ+vZNiMNksliPCiuKtSI= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/subosito/gotenv v1.3.0 h1:mjC+YW8QpAdXibNi+vNWgzmgBH4+5l5dCXv8cNysBLI= +github.com/subosito/gotenv v1.3.0/go.mod h1:YzJjq/33h7nrwdY+iHMhEOEEbW0ovIz0tB6t6PwAXzs= +github.com/taosdata/driver-go/v2 v2.0.1-0.20211018081904-0a2a3ef6c829/go.mod h1:W7pu74rSvDmGjJPO6fzp+GCtwOelrMgXEhPD0aQJ1xw= +github.com/taosdata/driver-go/v3 v3.5.8 h1:JT5lNFUCOHD9Hs4Phjg8RBkGOWlePRnpGqq8kIRHT98= +github.com/taosdata/driver-go/v3 v3.5.8/go.mod h1:H2vo/At+rOPY1aMzUV9P49SVX7NlXb3LAbKw+MCLrmU= +github.com/taosdata/file-rotatelogs/v2 v2.5.2 h1:6ryjwDdKqQtWrkVq9OKj4gvMING/f+fDluMAAe2DIXQ= +github.com/taosdata/file-rotatelogs/v2 v2.5.2/go.mod h1:Qm99Lh0iMZouGgyy++JgTqKvP5FQw1ruR5jkWF7e1n0= +github.com/taosdata/go-utils v0.0.0-20211022070036-018cc5f2432a h1:WGFREiuYBrTXTS9GVQQpDvVgGRyByfo0V5//o7tv/ho= +github.com/taosdata/go-utils v0.0.0-20211022070036-018cc5f2432a/go.mod h1:hlvGgM/HN3AqWMajvMQe80qoLNJ4KIxs8YOVqEqnxUo= +github.com/tidwall/gjson v1.9.1/go.mod h1:jydLKE7s8J0+1/5jC4eXcuFlzKizGrCKvLmBVX/5oXc= +github.com/tidwall/match v1.0.3/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= +github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= +github.com/tklauser/go-sysconf v0.3.10 h1:IJ1AZGZRWbY8T5Vfk04D9WOA5WSejdflXxP03OUqALw= +github.com/tklauser/go-sysconf v0.3.10/go.mod h1:C8XykCvCb+Gn0oNCWPIlcb0RuglQTYaQ2hGm7jmxEFk= +github.com/tklauser/numcpus v0.4.0 h1:E53Dm1HjH1/R2/aoCtXtPgzmElmn51aOkhCFSuZq//o= +github.com/tklauser/numcpus v0.4.0/go.mod h1:1+UI3pD8NW14VMwdgJNJ1ESk2UnwhAnz5hMwiKKqXCQ= +github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= +github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= +github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= +github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= +github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4dU= +github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= +github.com/xdg/scram v1.0.3/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I= +github.com/xdg/stringprep v1.0.3/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y= +github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yusufpapurcu/wmi v1.2.2 h1:KBNDSne4vP5mbSWnJbO+51IMOXJB67QiYCSBrubbPRg= +github.com/yusufpapurcu/wmi v1.2.2/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= +go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= +golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= +golang.org/x/arch v0.3.0 h1:02VY4/ZcO/gBOH6PUaoiptASxtXU10jazRCP865E97k= +golang.org/x/arch v0.3.0/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200323165209-0ec3e9974c59/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201112155050-0c6587e931a9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20210314154223-e6e6c4f2bb5b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= +golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= +golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g= +golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= +golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= +golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200425230154-ff2c4b7c35a0/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190130150945-aca44879d564/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= +golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= +golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= +golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= +google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= +google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= +google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= +google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg= +google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE= +google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= +google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= +google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= +google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= +google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= +google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= +google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= +google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= +google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE= +gopkg.in/go-playground/validator.v9 v9.29.1/go.mod h1:+c9/zcJMFNgbLvly1L1V+PpxWdVbfP1avr/N00E2vyQ= +gopkg.in/ini.v1 v1.66.4 h1:SsAcf+mM7mRZo2nJNGt8mZCjG8ZRaNGMURJw7BsIST4= +gopkg.in/ini.v1 v1.66.4/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= +rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= +rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= +rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/tools/keeper/infrastructure/config/audit.go b/tools/keeper/infrastructure/config/audit.go new file mode 100644 index 000000000000..10f3a6aa1e06 --- /dev/null +++ b/tools/keeper/infrastructure/config/audit.go @@ -0,0 +1,6 @@ +package config + +type AuditConfig struct { + Enable bool `toml:"enable"` + Database Database `toml:"database"` +} diff --git a/tools/keeper/infrastructure/config/config.go b/tools/keeper/infrastructure/config/config.go new file mode 100644 index 000000000000..f4bbe1b274de --- /dev/null +++ b/tools/keeper/infrastructure/config/config.go @@ -0,0 +1,296 @@ +package config + +import ( + "fmt" + "io/fs" + "os" + "runtime" + "time" + + "github.com/spf13/pflag" + "github.com/spf13/viper" + "github.com/taosdata/go-utils/web" + "github.com/taosdata/taoskeeper/util/pool" + "github.com/taosdata/taoskeeper/version" +) + +var IsEnterprise = "false" + +var Name = fmt.Sprintf("%skeeper", version.CUS_PROMPT) + +const ReqIDKey = "QID" +const ModelKey = "model" + +type Config struct { + InstanceID uint8 + Cors web.CorsConfig `toml:"cors"` + Port int `toml:"port"` + LogLevel string `toml:"loglevel"` + GoPoolSize int `toml:"gopoolsize"` + RotationInterval string `toml:"RotationInterval"` + TDengine TDengineRestful `toml:"tdengine"` + Metrics MetricsConfig `toml:"metrics"` + Env Environment `toml:"environment"` + Audit AuditConfig `toml:"audit"` + Log Log `mapstructure:"-"` + + Transfer string + FromTime string + Drop string +} + +type TDengineRestful struct { + Host string `toml:"host"` + Port int `toml:"port"` + Username string `toml:"username"` + Password string `toml:"password"` + Usessl bool `toml:"usessl"` +} + +var Conf *Config + +func InitConfig() *Config { + viper.SetConfigType("toml") + viper.SetConfigName(Name) + viper.AddConfigPath("/etc/taos") + + var cp *string + switch runtime.GOOS { + case "windows": + viper.AddConfigPath(fmt.Sprintf("C:\\%s\\cfg", version.CUS_NAME)) + cp = pflag.StringP("config", "c", "", fmt.Sprintf("config path default C:\\%s\\cfg\\%s.toml", version.CUS_NAME, Name)) + default: + viper.AddConfigPath(fmt.Sprintf("/etc/%s", version.CUS_PROMPT)) + cp = pflag.StringP("config", "c", "", fmt.Sprintf("config path default /etc/%s/%s.toml", version.CUS_PROMPT, Name)) + } + + transfer := pflag.StringP("transfer", "", "", "run "+Name+" in command mode, only support old_taosd_metric. transfer old metrics data to new tables and exit") + fromTime := pflag.StringP("fromTime", "", "2020-01-01T00:00:00+08:00", "parameter of transfer, example: 2020-01-01T00:00:00+08:00") + drop := pflag.StringP("drop", "", "", "run "+Name+" in command mode, only support old_taosd_metric_stables. ") + + v := pflag.BoolP("version", "V", false, "Print the version and exit") + help := pflag.BoolP("help", "h", false, "Print this help message and exit") + + pflag.Parse() + + if *help { + fmt.Fprintf(os.Stderr, "Usage of %s v%s:\n", Name, version.Version) + pflag.PrintDefaults() + os.Exit(0) + } + + if *v { + fmt.Printf("%s version: %s\n", Name, version.Version) + fmt.Printf("git: %s\n", version.Gitinfo) + fmt.Printf("build: %s\n", version.BuildInfo) + os.Exit(0) + } + + if *cp != "" { + viper.SetConfigFile(*cp) + } + + viper.SetEnvPrefix(Name) + err := viper.BindPFlags(pflag.CommandLine) + if err != nil { + panic(err) + } + viper.AutomaticEnv() + + gotoStep := false +ReadConfig: + if err := viper.ReadInConfig(); err != nil { + _, isConfigNotFoundError := err.(viper.ConfigFileNotFoundError) + _, isPathError := err.(*fs.PathError) + if isConfigNotFoundError || isPathError { + fmt.Println("config file not found") + + if !gotoStep { + fmt.Println("use keeper.toml instead") + viper.SetConfigName("keeper") + gotoStep = true + goto ReadConfig + } + } else { + panic(err) + } + } + + // if old format, change to new format + if !viper.IsSet("metrics.database.name") { + databaseName := viper.GetString("metrics.database") + viper.Set("metrics.database.name", databaseName) + viper.Set("metrics.database.options", viper.Get("metrics.databaseoptions")) + } + + var conf Config + if err = viper.Unmarshal(&conf); err != nil { + panic(err) + } + + conf.Transfer = *transfer + conf.FromTime = *fromTime + conf.Drop = *drop + + conf.Cors.Init() + pool.Init(conf.GoPoolSize) + conf.Log.SetValue() + + // set log level default value: info + if conf.LogLevel == "" { + conf.LogLevel = "info" + } + if viper.IsSet("log.level") { + conf.LogLevel = conf.Log.Level + } else { + viper.Set("log.level", "") + } + + if !viper.IsSet("logLevel") { + viper.Set("logLevel", "") + } + + Conf = &conf + return &conf +} + +func init() { + viper.SetDefault("instanceId", 64) + _ = viper.BindEnv("instanceId", "TAOS_KEEPER_INSTANCE_ID") + pflag.Int("instanceId", 64, `instance ID. Env "TAOS_KEEPER_INSTANCE_ID"`) + + viper.SetDefault("port", 6043) + _ = viper.BindEnv("port", "TAOS_KEEPER_PORT") + pflag.IntP("port", "P", 6043, `http port. Env "TAOS_KEEPER_PORT"`) + + _ = viper.BindEnv("logLevel", "TAOS_KEEPER_LOG_LEVEL") + pflag.String("logLevel", "info", `log level (trace debug info warning error). Env "TAOS_KEEPER_LOG_LEVEL"`) + + viper.SetDefault("gopoolsize", 50000) + _ = viper.BindEnv("gopoolsize", "TAOS_KEEPER_POOL_SIZE") + pflag.Int("gopoolsize", 50000, `coroutine size. Env "TAOS_KEEPER_POOL_SIZE"`) + + viper.SetDefault("RotationInterval", "15s") + _ = viper.BindEnv("RotationInterval", "TAOS_KEEPER_ROTATION_INTERVAL") + pflag.StringP("RotationInterval", "R", "15s", `interval for refresh metrics, such as "300ms", Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". Env "TAOS_KEEPER_ROTATION_INTERVAL"`) + + viper.SetDefault("tdengine.host", "127.0.0.1") + _ = viper.BindEnv("tdengine.host", "TAOS_KEEPER_TDENGINE_HOST") + pflag.String("tdengine.host", "127.0.0.1", `TDengine server's ip. Env "TAOS_KEEPER_TDENGINE_HOST"`) + + viper.SetDefault("tdengine.port", 6041) + _ = viper.BindEnv("tdengine.port", "TAOS_KEEPER_TDENGINE_PORT") + pflag.Int("tdengine.port", 6041, `TDengine REST server(taosAdapter)'s port. Env "TAOS_KEEPER_TDENGINE_PORT"`) + + viper.SetDefault("tdengine.username", "root") + _ = viper.BindEnv("tdengine.username", "TAOS_KEEPER_TDENGINE_USERNAME") + pflag.String("tdengine.username", "root", `TDengine server's username. Env "TAOS_KEEPER_TDENGINE_USERNAME"`) + + viper.SetDefault("tdengine.password", "taosdata") + _ = viper.BindEnv("tdengine.password", "TAOS_KEEPER_TDENGINE_PASSWORD") + pflag.String("tdengine.password", "taosdata", `TDengine server's password. Env "TAOS_KEEPER_TDENGINE_PASSWORD"`) + + viper.SetDefault("tdengine.usessl", false) + _ = viper.BindEnv("tdengine.usessl", "TAOS_KEEPER_TDENGINE_USESSL") + pflag.Bool("tdengine.usessl", false, `TDengine server use ssl or not. Env "TAOS_KEEPER_TDENGINE_USESSL"`) + + viper.SetDefault("metrics.prefix", "") + _ = viper.BindEnv("metrics.prefix", "TAOS_KEEPER_METRICS_PREFIX") + pflag.String("metrics.prefix", "", `prefix in metrics names. Env "TAOS_KEEPER_METRICS_PREFIX"`) + + viper.SetDefault("metrics.database.name", "log") + _ = viper.BindEnv("metrics.database.name", "TAOS_KEEPER_METRICS_DATABASE") + pflag.String("metrics.database.name", "log", `database for storing metrics data. Env "TAOS_KEEPER_METRICS_DATABASE"`) + + viper.SetDefault("metrics.database.options.vgroups", 1) + _ = viper.BindEnv("metrics.database.options.vgroups", "TAOS_KEEPER_METRICS_VGROUPS") + pflag.Int("metrics.database.options.vgroups", 1, `database option vgroups for audit database. Env "TAOS_KEEPER_METRICS_VGROUPS"`) + + viper.SetDefault("metrics.database.options.buffer", 64) + _ = viper.BindEnv("metrics.database.options.buffer", "TAOS_KEEPER_METRICS_BUFFER") + pflag.Int("metrics.database.options.buffer", 64, `database option buffer for audit database. Env "TAOS_KEEPER_METRICS_BUFFER"`) + + viper.SetDefault("metrics.database.options.keep", 90) + _ = viper.BindEnv("metrics.database.options.keep", "TAOS_KEEPER_METRICS_KEEP") + pflag.Int("metrics.database.options.keep", 90, `database option buffer for audit database. Env "TAOS_KEEPER_METRICS_KEEP"`) + + viper.SetDefault("metrics.database.options.cachemodel", "both") + _ = viper.BindEnv("metrics.database.options.cachemodel", "TAOS_KEEPER_METRICS_CACHEMODEL") + pflag.String("metrics.database.options.cachemodel", "both", `database option cachemodel for audit database. Env "TAOS_KEEPER_METRICS_CACHEMODEL"`) + + viper.SetDefault("metrics.tables", []string{}) + _ = viper.BindEnv("metrics.tables", "TAOS_KEEPER_METRICS_TABLES") + pflag.StringArray("metrics.tables", []string{}, `export some tables that are not super table, multiple values split with white space. Env "TAOS_KEEPER_METRICS_TABLES"`) + + viper.SetDefault("environment.incgroup", false) + _ = viper.BindEnv("environment.incgroup", "TAOS_KEEPER_ENVIRONMENT_INCGROUP") + pflag.Bool("environment.incgroup", false, `whether running in cgroup. Env "TAOS_KEEPER_ENVIRONMENT_INCGROUP"`) + + initLog() + + if IsEnterprise == "true" { + initAudit() + } +} + +func initLog() { + switch runtime.GOOS { + case "windows": + viper.SetDefault("log.path", fmt.Sprintf("C:\\%s\\log", version.CUS_NAME)) + _ = viper.BindEnv("log.path", "TAOS_KEEPER_LOG_PATH") + pflag.String("log.path", fmt.Sprintf("C:\\%s\\log", version.CUS_NAME), `log path. Env "TAOS_KEEPER_LOG_PATH"`) + default: + viper.SetDefault("log.path", fmt.Sprintf("/var/log/%s", version.CUS_PROMPT)) + _ = viper.BindEnv("log.path", "TAOS_KEEPER_LOG_PATH") + pflag.String("log.path", fmt.Sprintf("/var/log/%s", version.CUS_PROMPT), `log path. Env "TAOS_KEEPER_LOG_PATH"`) + } + + _ = viper.BindEnv("log.level", "TAOS_KEEPER_LOG_LEVEL") + pflag.String("log.level", "info", `log level (trace debug info warning error). Env "TAOS_KEEPER_LOG_LEVEL"`) + + viper.SetDefault("log.rotationCount", 5) + _ = viper.BindEnv("log.rotationCount", "TAOS_KEEPER_LOG_ROTATION_COUNT") + pflag.Uint("log.rotationCount", 5, `log rotation count. Env "TAOS_KEEPER_LOG_ROTATION_COUNT"`) + + viper.SetDefault("log.keepDays", 30) + _ = viper.BindEnv("log.keepDays", "TAOS_KEEPER_LOG_KEEP_DAYS") + pflag.Uint("log.keepDays", 30, `log retention days, must be a positive integer. Env "TAOS_KEEPER_LOG_KEEP_DAYS"`) + + viper.SetDefault("log.rotationTime", time.Hour*24) + _ = viper.BindEnv("log.rotationTime", "TAOS_KEEPER_LOG_ROTATION_TIME") + pflag.Duration("log.rotationTime", time.Hour*24, `deprecated: log rotation time always 24 hours. Env "TAOS_KEEPER_LOG_ROTATION_TIME"`) + + viper.SetDefault("log.rotationSize", "1GB") + _ = viper.BindEnv("log.rotationSize", "TAOS_KEEPER_LOG_ROTATION_SIZE") + pflag.String("log.rotationSize", "1GB", `log rotation size(KB MB GB), must be a positive integer. Env "TAOS_KEEPER_LOG_ROTATION_SIZE"`) + + viper.SetDefault("log.compress", false) + _ = viper.BindEnv("log.compress", "TAOS_KEEPER_LOG_COMPRESS") + pflag.Bool("log.compress", false, `whether to compress old log. Env "TAOS_KEEPER_LOG_COMPRESS"`) + + viper.SetDefault("log.reservedDiskSize", "1GB") + _ = viper.BindEnv("log.reservedDiskSize", "TAOS_KEEPER_LOG_RESERVED_DISK_SIZE") + pflag.String("log.reservedDiskSize", "1GB", `reserved disk size for log dir (KB MB GB), must be a positive integer. Env "TAOS_KEEPER_LOG_RESERVED_DISK_SIZE"`) +} + +func initAudit() { + viper.SetDefault("audit.enable", "true") + _ = viper.BindEnv("audit.enable", "TAOS_KEEPER_AUDIT_ENABLE") + pflag.String("audit.enable", "true", `database for enable audit data. Env "TAOS_KEEPER_AUDIT_ENABLE"`) + + viper.SetDefault("audit.database.name", "audit") + _ = viper.BindEnv("audit.database.name", "TAOS_KEEPER_AUDIT_DATABASE") + pflag.String("audit.database.name", "audit", `database for storing audit data. Env "TAOS_KEEPER_AUDIT_DATABASE"`) + + viper.SetDefault("audit.database.options.vgroups", 1) + _ = viper.BindEnv("audit.database.options.vgroups", "TAOS_KEEPER_AUDIT_VGROUPS") + pflag.Int("audit.database.options.vgroups", 1, `database option vgroups for audit database. Env "TAOS_KEEPER_AUDIT_VGROUPS"`) + + viper.SetDefault("audit.database.options.buffer", 16) + _ = viper.BindEnv("audit.database.options.buffer", "TAOS_KEEPER_AUDIT_BUFFER") + pflag.Int("audit.database.options.buffer", 16, `database option buffer for audit database. Env "TAOS_KEEPER_AUDIT_BUFFER"`) + + viper.SetDefault("audit.database.options.cachemodel", "both") + _ = viper.BindEnv("audit.database.options.cachemodel", "TAOS_KEEPER_AUDIT_CACHEMODEL") + pflag.String("audit.database.options.cachemodel", "both", `database option cachemodel for audit database. Env "TAOS_KEEPER_AUDIT_CACHEMODEL"`) +} diff --git a/tools/keeper/infrastructure/config/log.go b/tools/keeper/infrastructure/config/log.go new file mode 100644 index 000000000000..dc67d877e705 --- /dev/null +++ b/tools/keeper/infrastructure/config/log.go @@ -0,0 +1,29 @@ +package config + +import ( + "time" + + "github.com/spf13/viper" +) + +type Log struct { + Level string + Path string + RotationCount uint + RotationTime time.Duration + RotationSize uint + KeepDays uint + Compress bool + ReservedDiskSize uint +} + +func (l *Log) SetValue() { + l.Level = viper.GetString("log.level") + l.Path = viper.GetString("log.path") + l.RotationCount = viper.GetUint("log.rotationCount") + l.RotationTime = viper.GetDuration("log.rotationTime") + l.RotationSize = viper.GetSizeInBytes("log.rotationSize") + l.KeepDays = viper.GetUint("log.keepDays") + l.Compress = viper.GetBool("log.compress") + l.ReservedDiskSize = viper.GetSizeInBytes("log.reservedDiskSize") +} diff --git a/tools/keeper/infrastructure/config/metric_test.go b/tools/keeper/infrastructure/config/metric_test.go new file mode 100644 index 000000000000..5d20cdc5ec9a --- /dev/null +++ b/tools/keeper/infrastructure/config/metric_test.go @@ -0,0 +1,85 @@ +package config_test + +import ( + "fmt" + "io" + "os" + "runtime" + "testing" + + "github.com/BurntSushi/toml" + "github.com/stretchr/testify/assert" + "github.com/taosdata/taoskeeper/infrastructure/config" + "github.com/taosdata/taoskeeper/version" +) + +func TestConfig(t *testing.T) { + data := ` +# Start with debug middleware for gin +debug = true +# Listen port, default is 6043 +port = 9000 +# log level +loglevel = "error" +# go pool size +gopoolsize = 5000 +# interval for TDengine metrics +RotationInterval = "10s" +[tdengine] +address = "http://localhost:6041" +authtype = "Basic" +username = "root" +password = "taosdata" +` + var c config.Config + _, err := toml.Decode(data, &c) + if err != nil { + t.Error(err) + return + } + assert.EqualValues(t, c, c) + fmt.Print(c) +} + +func TestBakConfig(t *testing.T) { + isOk := copyConfigFile() + if isOk { + config.Name = "aaa" + config.InitConfig() + config.Name = "taoskeeper" + } +} + +func copyConfigFile() bool { + var sourceFile string + var destinationFile string + switch runtime.GOOS { + case "windows": + sourceFile = fmt.Sprintf("C:\\%s\\cfg\\%s.toml", version.CUS_NAME, "taoskeeper") + destinationFile = fmt.Sprintf("C:\\%s\\cfg\\%s.toml", version.CUS_NAME, "keeper") + default: + sourceFile = fmt.Sprintf("/etc/%s/%s.toml", version.CUS_PROMPT, "taoskeeper") + destinationFile = fmt.Sprintf("/etc/%s/%s.toml", version.CUS_PROMPT, "keeper") + } + _, err := os.Stat(sourceFile) + if os.IsNotExist(err) { + return false + } + + source, err := os.Open(sourceFile) //open the source file + if err != nil { + panic(err) + } + defer source.Close() + + destination, err := os.Create(destinationFile) //create the destination file + if err != nil { + panic(err) + } + defer destination.Close() + _, err = io.Copy(destination, source) //copy the contents of source to destination file + if err != nil { + panic(err) + } + return true +} diff --git a/tools/keeper/infrastructure/config/metrics.go b/tools/keeper/infrastructure/config/metrics.go new file mode 100644 index 000000000000..c41544fc399b --- /dev/null +++ b/tools/keeper/infrastructure/config/metrics.go @@ -0,0 +1,29 @@ +package config + +type MetricsConfig struct { + Cluster string `toml:"cluster"` + Prefix string `toml:"prefix"` + Database Database `toml:"database"` + Tables []string `toml:"tables"` +} + +type TaosAdapter struct { + Address []string `toml:"address"` +} + +type Metric struct { + Alias string `toml:"alias"` + Help string `toml:"help"` + Unit string `toml:"unit"` + Type string `toml:"type"` + Labels map[string]string `toml:"labels"` +} + +type Environment struct { + InCGroup bool `toml:"incgroup"` +} + +type Database struct { + Name string `toml:"name"` + Options map[string]interface{} `toml:"options"` +} diff --git a/tools/keeper/infrastructure/log/empty_test.go b/tools/keeper/infrastructure/log/empty_test.go new file mode 100644 index 000000000000..468c02173baa --- /dev/null +++ b/tools/keeper/infrastructure/log/empty_test.go @@ -0,0 +1,8 @@ +package log + +import ( + "testing" +) + +func TestEmpty(t *testing.T) { +} diff --git a/tools/keeper/infrastructure/log/log.go b/tools/keeper/infrastructure/log/log.go new file mode 100644 index 000000000000..0a54e99eb934 --- /dev/null +++ b/tools/keeper/infrastructure/log/log.go @@ -0,0 +1,278 @@ +package log + +import ( + "bytes" + "context" + "fmt" + "io" + "os" + "path/filepath" + "sync" + "time" + + "github.com/sirupsen/logrus" + rotatelogs "github.com/taosdata/file-rotatelogs/v2" + "github.com/taosdata/taoskeeper/infrastructure/config" + + "github.com/taosdata/taoskeeper/version" +) + +var logger = logrus.New() +var ServerID = randomID() +var globalLogFormatter = &TaosLogFormatter{} +var finish = make(chan struct{}) +var exist = make(chan struct{}) + +var bufferPool = &defaultPool{ + pool: &sync.Pool{ + New: func() interface{} { + return new(bytes.Buffer) + }, + }, +} + +type defaultPool struct { + pool *sync.Pool +} + +func (p *defaultPool) Put(buf *bytes.Buffer) { + buf.Reset() + p.pool.Put(buf) +} + +func (p *defaultPool) Get() *bytes.Buffer { + return p.pool.Get().(*bytes.Buffer) +} + +type FileHook struct { + formatter logrus.Formatter + writer io.Writer + buf *bytes.Buffer + sync.Mutex +} + +func NewFileHook(formatter logrus.Formatter, writer io.WriteCloser) *FileHook { + fh := &FileHook{formatter: formatter, writer: writer, buf: &bytes.Buffer{}} + ticker := time.NewTicker(time.Second * 5) + go func() { + for { + select { + case <-ticker.C: + //can be optimized by tryLock + fh.Lock() + if fh.buf.Len() > 0 { + fh.flush() + } + fh.Unlock() + case <-exist: + fh.Lock() + fh.flush() + fh.Unlock() + writer.Close() + ticker.Stop() + close(finish) + return + } + } + }() + return fh +} + +func (f *FileHook) Levels() []logrus.Level { + return logrus.AllLevels +} + +func (f *FileHook) Fire(entry *logrus.Entry) error { + if entry.Buffer == nil { + entry.Buffer = bufferPool.Get() + defer func() { + bufferPool.Put(entry.Buffer) + entry.Buffer = nil + }() + } + data, err := f.formatter.Format(entry) + if err != nil { + return err + } + f.Lock() + f.buf.Write(data) + if f.buf.Len() > 1024 || entry.Level == logrus.FatalLevel || entry.Level == logrus.PanicLevel { + err = f.flush() + } + f.Unlock() + return err +} + +func (f *FileHook) flush() error { + _, err := f.writer.Write(f.buf.Bytes()) + f.buf.Reset() + return err +} + +var once sync.Once + +func ConfigLog() { + once.Do(func() { + err := SetLevel(config.Conf.LogLevel) + if err != nil { + panic(err) + } + writer, err := rotatelogs.New( + filepath.Join(config.Conf.Log.Path, fmt.Sprintf("%skeeper_%d_%%Y%%m%%d.log", version.CUS_PROMPT, config.Conf.InstanceID)), + rotatelogs.WithRotationCount(config.Conf.Log.RotationCount), + rotatelogs.WithRotationTime(time.Hour*24), + rotatelogs.WithRotationSize(int64(config.Conf.Log.RotationSize)), + rotatelogs.WithReservedDiskSize(int64(config.Conf.Log.ReservedDiskSize)), + rotatelogs.WithRotateGlobPattern(filepath.Join(config.Conf.Log.Path, fmt.Sprintf("%skeeper_%d_*.log*", version.CUS_PROMPT, config.Conf.InstanceID))), + rotatelogs.WithCompress(config.Conf.Log.Compress), + rotatelogs.WithCleanLockFile(filepath.Join(config.Conf.Log.Path, fmt.Sprintf(".%skeeper_%d_rotate_lock", version.CUS_PROMPT, config.Conf.InstanceID))), + rotatelogs.ForceNewFile(), + rotatelogs.WithMaxAge(time.Hour*24*time.Duration(config.Conf.Log.KeepDays)), + ) + if err != nil { + panic(err) + } + fmt.Fprintln(writer, "==================================================") + fmt.Fprintln(writer, " new log file") + fmt.Fprintln(writer, "==================================================") + fmt.Fprintf(writer, "config:%+v\n", config.Conf) + + fmt.Fprintf(writer, "%-45s%v\n", "version", version.Version) + fmt.Fprintf(writer, "%-45s%v\n", "gitinfo", version.CommitID) + fmt.Fprintf(writer, "%-45s%v\n", "buildinfo", version.BuildInfo) + + hook := NewFileHook(globalLogFormatter, writer) + logger.AddHook(hook) + }) +} + +func SetLevel(level string) error { + l, err := logrus.ParseLevel(level) + if err != nil { + return err + } + logger.SetLevel(l) + return nil +} + +func GetLogger(model string) *logrus.Entry { + return logger.WithFields(logrus.Fields{config.ModelKey: model}) +} + +func init() { + logrus.SetBufferPool(bufferPool) + logger.SetFormatter(globalLogFormatter) + logger.SetOutput(os.Stdout) +} + +func randomID() string { + return fmt.Sprintf("%08d", os.Getpid()) +} + +type TaosLogFormatter struct { +} + +func (t *TaosLogFormatter) Format(entry *logrus.Entry) ([]byte, error) { + var b *bytes.Buffer + if entry.Buffer != nil { + b = entry.Buffer + } else { + b = &bytes.Buffer{} + } + b.Reset() + b.WriteString(entry.Time.Format("01/02 15:04:05.000000")) + b.WriteByte(' ') + b.WriteString(ServerID) + b.WriteByte(' ') + v, exist := entry.Data[config.ModelKey] + if exist && v != nil { + b.WriteString(v.(string)) + b.WriteByte(' ') + } else { + b.WriteString("CLI ") + } + switch entry.Level { + case logrus.PanicLevel: + b.WriteString("PANIC ") + case logrus.FatalLevel: + b.WriteString("FATAL ") + case logrus.ErrorLevel: + b.WriteString("ERROR ") + case logrus.WarnLevel: + b.WriteString("WARN ") + case logrus.InfoLevel: + b.WriteString("INFO ") + case logrus.DebugLevel: + b.WriteString("DEBUG ") + case logrus.TraceLevel: + b.WriteString("TRACE ") + } + + // request id + v, exist = entry.Data[config.ReqIDKey] + if exist && v != nil { + b.WriteString(config.ReqIDKey) + b.WriteByte(':') + fmt.Fprintf(b, "0x%x ", v) + } + if len(entry.Message) > 0 && entry.Message[len(entry.Message)-1] == '\n' { + b.WriteString(entry.Message[:len(entry.Message)-1]) + } else { + b.WriteString(entry.Message) + } + // sort the keys + keys := make([]string, 0, len(entry.Data)) + for k := range entry.Data { + if k == config.ModelKey || k == config.ReqIDKey { + continue + } + keys = append(keys, k) + } + for _, k := range keys { + v := entry.Data[k] + if k == config.ReqIDKey && v == nil { + continue + } + b.WriteString(", ") + b.WriteString(k) + b.WriteByte(':') + fmt.Fprintf(b, "%v", v) + } + + b.WriteByte('\n') + return b.Bytes(), nil +} + +func IsDebug() bool { + return logger.IsLevelEnabled(logrus.DebugLevel) +} + +func GetLogLevel() logrus.Level { + return logger.Level +} + +var zeroTime = time.Time{} +var zeroDuration = time.Duration(0) + +func GetLogNow(isDebug bool) time.Time { + if isDebug { + return time.Now() + } + return zeroTime +} +func GetLogDuration(isDebug bool, s time.Time) time.Duration { + if isDebug { + return time.Since(s) + } + return zeroDuration +} + +func Close(ctx context.Context) { + close(exist) + select { + case <-finish: + return + case <-ctx.Done(): + return + } +} diff --git a/tools/keeper/infrastructure/log/log_test.go b/tools/keeper/infrastructure/log/log_test.go new file mode 100644 index 000000000000..656cda4bbcef --- /dev/null +++ b/tools/keeper/infrastructure/log/log_test.go @@ -0,0 +1,23 @@ +package log + +import ( + "context" + "fmt" + "testing" + "time" + + "github.com/sirupsen/logrus" + "github.com/stretchr/testify/assert" + "github.com/taosdata/taoskeeper/infrastructure/config" +) + +func TestConfigLog(t *testing.T) { + config.InitConfig() + config.Conf.LogLevel = "debug" + ConfigLog() + debug, _ := logrus.ParseLevel("debug") + assert.Equal(t, logger.Level, debug) + assert.Equal(t, true, IsDebug()) + fmt.Print(GetLogNow(true), GetLogDuration(true, time.Now())) + Close(context.Background()) +} diff --git a/tools/keeper/infrastructure/log/web.go b/tools/keeper/infrastructure/log/web.go new file mode 100644 index 000000000000..4aa244448ba3 --- /dev/null +++ b/tools/keeper/infrastructure/log/web.go @@ -0,0 +1,55 @@ +package log + +import ( + "time" + + "github.com/gin-gonic/gin" + "github.com/sirupsen/logrus" + "github.com/taosdata/taoskeeper/infrastructure/config" + "github.com/taosdata/taoskeeper/util" +) + +func GinLog() gin.HandlerFunc { + logger := GetLogger("WEB") + + return func(c *gin.Context) { + qid := util.GetQid(c.GetHeader("X-QID")) + + logger := logger.WithFields( + logrus.Fields{config.ReqIDKey: qid}, + ) + statusCode := c.Writer.Status() + + startTime := time.Now() + c.Next() + endTime := time.Now() + latencyTime := endTime.Sub(startTime) + reqMethod := c.Request.Method + reqUri := c.Request.RequestURI + + clientIP := c.ClientIP() + + if statusCode != 200 { + logger.Errorf("finish request, status_code:%3d, latency:%v, client_ip:%s, method:%s, uri:%s", statusCode, latencyTime, clientIP, reqMethod, reqUri) + return + } + logger.Infof("finish request, status_code:%3d, latency:%v, client_ip:%s, method:%s, uri:%s", statusCode, latencyTime, clientIP, reqMethod, reqUri) + } +} + +type recoverLog struct { + logger logrus.FieldLogger +} + +func (r *recoverLog) Write(p []byte) (n int, err error) { + r.logger.Errorln(string(p)) + return len(p), nil +} + +func GinRecoverLog() gin.HandlerFunc { + logger := GetLogger("WEB") + return func(c *gin.Context) { + writer := &recoverLog{logger: logger} + gin.RecoveryWithWriter(writer)(c) + } +} diff --git a/tools/keeper/main.go b/tools/keeper/main.go new file mode 100644 index 000000000000..43432bde3d70 --- /dev/null +++ b/tools/keeper/main.go @@ -0,0 +1,11 @@ +package main + +import ( + "github.com/taosdata/taoskeeper/system" +) + +func main() { + r := system.Init() + system.Start(r) + // config.IsEnterprise +} diff --git a/tools/keeper/monitor/collect.go b/tools/keeper/monitor/collect.go new file mode 100644 index 000000000000..652ae1f1ce79 --- /dev/null +++ b/tools/keeper/monitor/collect.go @@ -0,0 +1,99 @@ +package monitor + +import ( + "math" + "os" + "runtime" + + "github.com/shirou/gopsutil/v3/mem" + "github.com/shirou/gopsutil/v3/process" + "github.com/taosdata/taoskeeper/util" +) + +type SysCollector interface { + CpuPercent() (float64, error) + MemPercent() (float64, error) +} + +type NormalCollector struct { + p *process.Process +} + +func NewNormalCollector() (*NormalCollector, error) { + p, err := process.NewProcess(int32(os.Getpid())) + if err != nil { + return nil, err + } + return &NormalCollector{p: p}, nil +} + +func (n *NormalCollector) CpuPercent() (float64, error) { + cpuPercent, err := n.p.Percent(0) + if err != nil { + return 0, err + } + return cpuPercent / float64(runtime.NumCPU()), nil +} + +func (n *NormalCollector) MemPercent() (float64, error) { + memPercent, err := n.p.MemoryPercent() + if err != nil { + return 0, err + } + return float64(memPercent), nil +} + +const ( + CGroupCpuQuotaPath = "/sys/fs/cgroup/cpu/cpu.cfs_quota_us" + CGroupCpuPeriodPath = "/sys/fs/cgroup/cpu/cpu.cfs_period_us" + CGroupMemLimitPath = "/sys/fs/cgroup/memory/memory.limit_in_bytes" +) + +type CGroupCollector struct { + p *process.Process + cpuCore float64 + totalMemory uint64 +} + +func NewCGroupCollector() (*CGroupCollector, error) { + p, err := process.NewProcess(int32(os.Getpid())) + if err != nil { + return nil, err + } + cpuPeriod, err := util.ReadUint(CGroupCpuPeriodPath) + if err != nil { + return nil, err + } + cpuQuota, err := util.ReadUint(CGroupCpuQuotaPath) + if err != nil { + return nil, err + } + cpuCore := float64(cpuQuota) / float64(cpuPeriod) + limitMemory, err := util.ReadUint(CGroupMemLimitPath) + if err != nil { + return nil, err + } + machineMemory, err := mem.VirtualMemory() + if err != nil { + return nil, err + } + totalMemory := uint64(math.Min(float64(limitMemory), float64(machineMemory.Total))) + return &CGroupCollector{p: p, cpuCore: cpuCore, totalMemory: totalMemory}, nil +} + +func (c *CGroupCollector) CpuPercent() (float64, error) { + cpuPercent, err := c.p.Percent(0) + if err != nil { + return 0, err + } + cpuPercent = cpuPercent / c.cpuCore + return cpuPercent, nil +} + +func (c *CGroupCollector) MemPercent() (float64, error) { + memInfo, err := c.p.MemoryInfo() + if err != nil { + return 0, err + } + return 100 * float64(memInfo.RSS) / float64(c.totalMemory), nil +} diff --git a/tools/keeper/monitor/empty_test.go b/tools/keeper/monitor/empty_test.go new file mode 100644 index 000000000000..689acfac4c37 --- /dev/null +++ b/tools/keeper/monitor/empty_test.go @@ -0,0 +1,8 @@ +package monitor + +import ( + "testing" +) + +func TestEmpty(t *testing.T) { +} diff --git a/tools/keeper/monitor/monitor.go b/tools/keeper/monitor/monitor.go new file mode 100644 index 000000000000..6f3083e8660d --- /dev/null +++ b/tools/keeper/monitor/monitor.go @@ -0,0 +1,89 @@ +package monitor + +import ( + "context" + "fmt" + "os" + "time" + + "github.com/taosdata/taoskeeper/api" + "github.com/taosdata/taoskeeper/db" + "github.com/taosdata/taoskeeper/infrastructure/config" + "github.com/taosdata/taoskeeper/infrastructure/log" + "github.com/taosdata/taoskeeper/util" + "github.com/taosdata/taoskeeper/util/pool" +) + +var logger = log.GetLogger("MON") + +func StartMonitor(identity string, conf *config.Config, reporter *api.Reporter) { + if len(identity) == 0 { + hostname, err := os.Hostname() + if err != nil { + logger.Errorf("can not get hostname, error:%s", err) + } + if len(hostname) > 40 { + hostname = hostname[:40] + } + identity = fmt.Sprintf("%s:%d", hostname, conf.Port) + } + + systemStatus := make(chan SysStatus) + _ = pool.GoroutinePool.Submit(func() { + var ( + cpuPercent float64 + memPercent float64 + totalReport int + ) + + for status := range systemStatus { + if status.CpuError == nil { + cpuPercent = status.CpuPercent + } + if status.MemError == nil { + memPercent = status.MemPercent + } + + totalResp := reporter.GetTotalRep() + for i := 0; i < 3; i++ { + totalReport = totalResp.Load().(int) + if totalResp.CompareAndSwap(totalReport, 0) { + break + } + logger.Warn("Reset keeper_monitor total resp via cas fail! Maybe to many concurrent ") + reporter.GetTotalRep().Store(0) + } + + var kn string + if len(identity) <= util.MAX_TABLE_NAME_LEN { + kn = util.ToValidTableName(identity) + } else { + kn = util.GetMd5HexStr(identity) + } + + sql := fmt.Sprintf("insert into `km_%s` using keeper_monitor tags ('%s') values ( now, "+ + " %f, %f, %d)", kn, identity, cpuPercent, memPercent, totalReport) + conn, err := db.NewConnectorWithDb(conf.TDengine.Username, conf.TDengine.Password, conf.TDengine.Host, + conf.TDengine.Port, conf.Metrics.Database.Name, conf.TDengine.Usessl) + if err != nil { + logger.Errorf("connect to database error, msg:%s", err) + return + } + + ctx := context.Background() + if _, err = conn.Exec(ctx, sql, util.GetQidOwn()); err != nil { + logger.Errorf("execute sql:%s, error:%s", sql, err) + } + + if err := conn.Close(); err != nil { + logger.Errorf("close connection error, msg:%s", err) + } + } + }) + SysMonitor.Register(systemStatus) + interval, err := time.ParseDuration(conf.RotationInterval) + if err != nil { + panic(err) + } + Start(interval, conf.Env.InCGroup) +} diff --git a/tools/keeper/monitor/monitor_test.go b/tools/keeper/monitor/monitor_test.go new file mode 100644 index 000000000000..b2b860dcaa9f --- /dev/null +++ b/tools/keeper/monitor/monitor_test.go @@ -0,0 +1,58 @@ +package monitor + +import ( + "context" + "fmt" + "os" + "testing" + "time" + + "github.com/stretchr/testify/assert" + "github.com/taosdata/go-utils/web" + "github.com/taosdata/taoskeeper/api" + "github.com/taosdata/taoskeeper/db" + "github.com/taosdata/taoskeeper/util" + + "github.com/taosdata/taoskeeper/infrastructure/config" + "github.com/taosdata/taoskeeper/infrastructure/log" +) + +func TestStart(t *testing.T) { + conf := config.InitConfig() + if conf == nil { + panic("config error") + } + conf.Env.InCGroup = true + cpuCgroupDir := "/sys/fs/cgroup/cpu" + if _, err := os.Stat(cpuCgroupDir); os.IsNotExist(err) { + conf.Env.InCGroup = false + } + log.ConfigLog() + router := web.CreateRouter(false, &conf.Cors, false) + conf.Metrics.Database.Name = "monitor" + reporter := api.NewReporter(conf) + reporter.Init(router) + conf.RotationInterval = "1s" + StartMonitor("", conf, reporter) + time.Sleep(2 * time.Second) + for k, _ := range SysMonitor.outputs { + SysMonitor.Deregister(k) + } + + conn, err := db.NewConnectorWithDb(conf.TDengine.Username, conf.TDengine.Password, conf.TDengine.Host, conf.TDengine.Port, conf.Metrics.Database.Name, conf.TDengine.Usessl) + assert.NoError(t, err) + conn.Query(context.Background(), fmt.Sprintf("drop database if exists %s", conf.Metrics.Database.Name), util.GetQidOwn()) + +} + +func TestParseUint(t *testing.T) { + num, err := util.ParseUint("-1", 10, 8) + assert.Equal(t, nil, err) + assert.Equal(t, uint64(0), num) + num, err = util.ParseUint("0", 10, 8) + assert.Equal(t, nil, err) + assert.Equal(t, uint64(0), num) + num, err = util.ParseUint("257", 10, 8) + assert.Equal(t, "strconv.ParseUint: parsing \"257\": value out of range", err.Error()) + assert.Equal(t, uint64(0), num) +} diff --git a/tools/keeper/monitor/system.go b/tools/keeper/monitor/system.go new file mode 100644 index 000000000000..7d5ef5bd549d --- /dev/null +++ b/tools/keeper/monitor/system.go @@ -0,0 +1,97 @@ +package monitor + +import ( + "math" + "runtime" + "sync" + "time" + + "github.com/taosdata/taoskeeper/util/pool" +) + +type SysStatus struct { + CollectTime time.Time + CpuPercent float64 + CpuError error + MemPercent float64 + MemError error + GoroutineCounts int + ThreadCounts int +} + +type sysMonitor struct { + sync.Mutex + collectDuration time.Duration + collector SysCollector + status *SysStatus + outputs map[chan<- SysStatus]struct{} + ticker *time.Ticker +} + +func (s *sysMonitor) collect() { + s.status.CollectTime = time.Now() + s.status.CpuPercent, s.status.CpuError = s.collector.CpuPercent() + s.status.MemPercent, s.status.MemError = s.collector.MemPercent() + s.status.GoroutineCounts = runtime.NumGoroutine() + s.status.ThreadCounts, _ = runtime.ThreadCreateProfile(nil) + // skip when inf or nan + if math.IsInf(s.status.CpuPercent, 0) || math.IsNaN(s.status.CpuPercent) || + math.IsInf(s.status.MemPercent, 0) || math.IsNaN(s.status.MemPercent) { + return + } + + s.Lock() + for output := range s.outputs { + select { + case output <- *s.status: + default: + } + } + s.Unlock() +} + +func (s *sysMonitor) Register(c chan<- SysStatus) { + s.Lock() + if s.outputs == nil { + s.outputs = map[chan<- SysStatus]struct{}{ + c: {}, + } + } else { + s.outputs[c] = struct{}{} + } + s.Unlock() +} + +func (s *sysMonitor) Deregister(c chan<- SysStatus) { + s.Lock() + if s.outputs != nil { + delete(s.outputs, c) + } + s.Unlock() +} + +var SysMonitor = &sysMonitor{status: &SysStatus{}} + +func Start(collectDuration time.Duration, inCGroup bool) { + SysMonitor.collectDuration = collectDuration + if inCGroup { + collector, err := NewCGroupCollector() + if err != nil { + logger.Errorf("new normal group controller error, msg:%s", err) + } + SysMonitor.collector = collector + } else { + collector, err := NewNormalCollector() + if err != nil { + logger.Errorf("new normal controller error, msg:%s", err) + } + SysMonitor.collector = collector + } + SysMonitor.collect() + SysMonitor.ticker = time.NewTicker(SysMonitor.collectDuration) + pool.GoroutinePool.Submit(func() { + for range SysMonitor.ticker.C { + SysMonitor.collect() + } + }) +} diff --git a/tools/keeper/process/builder.go b/tools/keeper/process/builder.go new file mode 100644 index 000000000000..d6e37534bf9e --- /dev/null +++ b/tools/keeper/process/builder.go @@ -0,0 +1,55 @@ +package process + +import ( + "context" + "fmt" + + "github.com/taosdata/taoskeeper/db" + "github.com/taosdata/taoskeeper/infrastructure/config" + "github.com/taosdata/taoskeeper/infrastructure/log" + "github.com/taosdata/taoskeeper/util" +) + +var builderLogger = log.GetLogger("BLD") + +func ExpandMetricsFromConfig(ctx context.Context, conn *db.Connector, cfg *config.MetricsConfig) (tables map[string]struct{}, err error) { + tables = make(map[string]struct{}) + for _, name := range cfg.Tables { + builderLogger.Debug("normal table: ", name) + + _, exist := tables[name] + if exist { + builderLogger.Debug(name, "is exist in config") + continue + } + tables[name] = struct{}{} + } + + sql := fmt.Sprintf(GetStableNameListSql(), cfg.Database.Name) + data, err := conn.Query(ctx, sql, util.GetQidOwn()) + if err != nil { + return nil, err + } + builderLogger.Debugf("show stables:%s", sql) + + for _, info := range data.Data { + name := info[0].(string) + builderLogger.Debug("stable:", info) + + _, exist := tables[name] + if exist { + builderLogger.Debug(name, "is exist in config") + continue + } + tables[name] = struct{}{} + } + return +} + +func GetStableNameListSql() string { + return "select stable_name from information_schema.ins_stables " + + " where db_name = '%s' " + + " and (stable_name not like 'taosx\\_%%')" + + " and (stable_name not like 'taosadapter%%')" + + " and (stable_name != 'temp_dir' and stable_name != 'data_dir')" +} diff --git a/tools/keeper/process/empty_test.go b/tools/keeper/process/empty_test.go new file mode 100644 index 000000000000..6718d125255f --- /dev/null +++ b/tools/keeper/process/empty_test.go @@ -0,0 +1,8 @@ +package process + +import ( + "testing" +) + +func TestEmpty(t *testing.T) { +} diff --git a/tools/keeper/process/handle.go b/tools/keeper/process/handle.go new file mode 100644 index 000000000000..980902daca35 --- /dev/null +++ b/tools/keeper/process/handle.go @@ -0,0 +1,666 @@ +package process + +import ( + "context" + "errors" + "fmt" + "math" + "strings" + "sync" + "time" + + "github.com/prometheus/client_golang/prometheus" + taosError "github.com/taosdata/driver-go/v3/errors" + "github.com/taosdata/taoskeeper/db" + "github.com/taosdata/taoskeeper/infrastructure/config" + "github.com/taosdata/taoskeeper/infrastructure/log" + "github.com/taosdata/taoskeeper/util" + "github.com/taosdata/taoskeeper/util/pool" +) + +var logger = log.GetLogger("HND") + +var metricNameMap = map[string]string{ + "taosd_cluster_basic_first_ep": "cluster_info_first_ep", + "taosd_cluster_basic_first_ep_dnode_id": "cluster_info_first_ep_dnode_id", + "taosd_cluster_basic_cluster_version": "cluster_info_version", + + "taosd_cluster_info_cluster_uptime": "cluster_info_master_uptime", + "taosd_cluster_info_dbs_total": "cluster_info_dbs_total", + "taosd_cluster_info_tbs_total": "cluster_info_tbs_total", + "taosd_cluster_info_stbs_total": "cluster_info_stbs_total", + "taosd_cluster_info_dnodes_total": "cluster_info_dnodes_total", + "taosd_cluster_info_dnodes_alive": "cluster_info_dnodes_alive", + "taosd_cluster_info_mnodes_total": "cluster_info_mnodes_total", + "taosd_cluster_info_mnodes_alive": "cluster_info_mnodes_alive", + "taosd_cluster_info_vgroups_total": "cluster_info_vgroups_total", + "taosd_cluster_info_vgroups_alive": "cluster_info_vgroups_alive", + "taosd_cluster_info_vnodes_total": "cluster_info_vnodes_total", + "taosd_cluster_info_vnodes_alive": "cluster_info_vnodes_alive", + "taosd_cluster_info_connections_total": "cluster_info_connections_total", + "taosd_cluster_info_topics_total": "cluster_info_topics_total", + "taosd_cluster_info_streams_total": "cluster_info_streams_total", + + "taosd_cluster_info_grants_expire_time": "grants_info_expire_time", + "taosd_cluster_info_grants_timeseries_used": "grants_info_timeseries_used", + "taosd_cluster_info_grants_timeseries_total": "grants_info_timeseries_total", + + "taosd_dnodes_info_uptime": "dnodes_info_uptime", + "taosd_dnodes_info_cpu_engine": "dnodes_info_cpu_engine", + "taosd_dnodes_info_cpu_system": "dnodes_info_cpu_system", + "taosd_dnodes_info_cpu_cores": "dnodes_info_cpu_cores", + "taosd_dnodes_info_mem_engine": "dnodes_info_mem_engine", + "taosd_dnodes_info_mem_free": "dnodes_info_mem_system", + "taosd_dnodes_info_mem_total": "dnodes_info_mem_total", + "taosd_dnodes_info_disk_engine": "dnodes_info_disk_engine", + "taosd_dnodes_info_disk_used": "dnodes_info_disk_used", + "taosd_dnodes_info_disk_total": "dnodes_info_disk_total", + "taosd_dnodes_info_system_net_in": "dnodes_info_net_in", + "taosd_dnodes_info_system_net_out": "dnodes_info_net_out", + "taosd_dnodes_info_io_read": "dnodes_info_io_read", + "taosd_dnodes_info_io_write": "dnodes_info_io_write", + "taosd_dnodes_info_io_read_disk": "dnodes_info_io_read_disk", + "taosd_dnodes_info_io_write_disk": "dnodes_info_io_write_disk", + "taosd_dnodes_info_vnodes_num": "dnodes_info_vnodes_num", + "taosd_dnodes_info_masters": "dnodes_info_masters", + "taosd_dnodes_info_has_mnode": "dnodes_info_has_mnode", + "taosd_dnodes_info_has_qnode": "dnodes_info_has_qnode", + "taosd_dnodes_info_has_snode": "dnodes_info_has_snode", + "taosd_dnodes_info_has_bnode": "dnodes_info_has_bnode", + "taosd_dnodes_info_errors": "dnodes_info_errors", + "taosd_dnodes_info_error_log_count": "log_summary_error", + "taosd_dnodes_info_info_log_count": "log_summary_info", + "taosd_dnodes_info_debug_log_count": "log_summary_debug", + "taosd_dnodes_info_trace_log_count": "log_summary_trace", + + "taosd_dnodes_status_status": "d_info_status", + + "taosd_mnodes_info_role": "m_info_role", +} + +var metricTypeMap = map[string]CollectType{ + "taosd_cluster_basic_first_ep": Info, + "taosd_cluster_basic_first_ep_dnode_id": Counter, + "taosd_cluster_basic_cluster_version": Info, + + "taosd_cluster_info_cluster_uptime": Gauge, + "taosd_cluster_info_dbs_total": Counter, + "taosd_cluster_info_tbs_total": Counter, + "taosd_cluster_info_stbs_total": Counter, + "taosd_cluster_info_dnodes_total": Counter, + "taosd_cluster_info_dnodes_alive": Counter, + "taosd_cluster_info_mnodes_total": Counter, + "taosd_cluster_info_mnodes_alive": Counter, + "taosd_cluster_info_vgroups_total": Counter, + "taosd_cluster_info_vgroups_alive": Counter, + "taosd_cluster_info_vnodes_total": Counter, + "taosd_cluster_info_vnodes_alive": Counter, + "taosd_cluster_info_connections_total": Counter, + "taosd_cluster_info_topics_total": Counter, + "taosd_cluster_info_streams_total": Counter, + + "taosd_cluster_info_grants_expire_time": Counter, + "taosd_cluster_info_grants_timeseries_used": Counter, + "taosd_cluster_info_grants_timeseries_total": Counter, + + "taosd_dnodes_info_uptime": Gauge, + "taosd_dnodes_info_cpu_engine": Gauge, + "taosd_dnodes_info_cpu_system": Gauge, + "taosd_dnodes_info_cpu_cores": Gauge, + "taosd_dnodes_info_mem_engine": Counter, + "taosd_dnodes_info_mem_free": Counter, + "taosd_dnodes_info_mem_total": Counter, + "taosd_dnodes_info_disk_engine": Counter, + "taosd_dnodes_info_disk_used": Counter, + "taosd_dnodes_info_disk_total": Counter, + "taosd_dnodes_info_system_net_in": Gauge, + "taosd_dnodes_info_system_net_out": Gauge, + "taosd_dnodes_info_io_read": Gauge, + "taosd_dnodes_info_io_write": Gauge, + "taosd_dnodes_info_io_read_disk": Gauge, + "taosd_dnodes_info_io_write_disk": Gauge, + "taosd_dnodes_info_vnodes_num": Counter, + "taosd_dnodes_info_masters": Counter, + "taosd_dnodes_info_has_mnode": Counter, + "taosd_dnodes_info_has_qnode": Counter, + "taosd_dnodes_info_has_snode": Counter, + "taosd_dnodes_info_has_bnode": Counter, + "taosd_dnodes_info_errors": Counter, + "taosd_dnodes_info_error_log_count": Counter, + "taosd_dnodes_info_info_log_count": Counter, + "taosd_dnodes_info_debug_log_count": Counter, + "taosd_dnodes_info_trace_log_count": Counter, + + "taosd_dnodes_status_status": Info, + + "taosd_mnodes_info_role": Info, +} + +type CollectType string + +const ( + Counter CollectType = "counter" + Gauge CollectType = "gauge" + Info CollectType = "info" + Summary CollectType = "summary" +) + +type Processor struct { + prefix string + db string + tableMap map[string]*Table //tableName:*Table{} + metricMap map[string]*Metric //Fqname:*Metric{} + tableList []string + ctx context.Context + rotationInterval time.Duration + exitChan chan struct{} + dbConn *db.Connector + summaryTable map[string]*Table + tables map[string]struct{} +} + +func (p *Processor) Describe(descs chan<- *prometheus.Desc) { + for _, metric := range p.metricMap { + descs <- metric.Desc + } +} + +func (p *Processor) Collect(metrics chan<- prometheus.Metric) { + for _, metric := range p.metricMap { + logger.Tracef("metric name:%v", metric.FQName) + + switch metric.Type { + case Gauge: + gv := prometheus.NewGaugeVec(prometheus.GaugeOpts{ + Name: metric.FQName, + Help: metric.Help, + ConstLabels: metric.ConstLabels, + }, metric.Variables) + for _, value := range metric.GetValue() { + if value.Value == nil { + continue + } + g := gv.With(value.Label) + g.Set(value.Value.(float64)) + metrics <- g + } + case Counter: + cv := prometheus.NewCounterVec(prometheus.CounterOpts{ + Name: metric.FQName, + Help: metric.Help, + ConstLabels: metric.ConstLabels, + }, metric.Variables) + for _, value := range metric.GetValue() { + if value.Value == nil { + continue + } + v := i2float(value.Value) + if v < 0 { + logger.Warningf("negative value for prometheus counter. label %v value %v", + value.Label, value.Value) + continue + } + c := cv.With(value.Label) + c.Add(v) + metrics <- c + } + case Info: + lbs := []string{"value"} + lbs = append(lbs, metric.Variables...) + gf := prometheus.NewGaugeVec(prometheus.GaugeOpts{ + Name: metric.FQName, + Help: metric.Help, + ConstLabels: metric.ConstLabels, + }, lbs) + for _, value := range metric.GetValue() { + if value == nil { + continue + } + v := make(map[string]string, len(value.Label)+1) + v["value"] = value.Value.(string) + for k, l := range value.Label { + v[k] = l + } + g := gf.With(v) + g.Set(1) + metrics <- g + } + case Summary: + } + } +} + +type Table struct { + tsName string + Variables []string + ColumnList []string +} + +type Metric struct { + sync.RWMutex + FQName string + Help string + Type CollectType + ColType int + ConstLabels map[string]string + Variables []string + Desc *prometheus.Desc + LastValue []*Value +} + +func (m *Metric) SetValue(v []*Value) { + m.Lock() + defer m.Unlock() + m.LastValue = v +} + +func (m *Metric) GetValue() []*Value { + m.RLock() + defer m.RUnlock() + return m.LastValue +} + +type Value struct { + Label map[string]string + Value interface{} +} + +func NewProcessor(conf *config.Config) *Processor { + + conn, err := db.NewConnector(conf.TDengine.Username, conf.TDengine.Password, conf.TDengine.Host, conf.TDengine.Port, conf.TDengine.Usessl) + if err != nil { + panic(err) + } + interval, err := time.ParseDuration(conf.RotationInterval) + if err != nil { + panic(err) + } + ctx := context.Background() + tables, err := ExpandMetricsFromConfig(ctx, conn, &conf.Metrics) + if err != nil { + panic(err) + } + p := &Processor{ + prefix: conf.Metrics.Prefix, + db: conf.Metrics.Database.Name, + tableMap: map[string]*Table{}, + metricMap: map[string]*Metric{}, + ctx: ctx, + rotationInterval: interval, + exitChan: make(chan struct{}), + dbConn: conn, + summaryTable: map[string]*Table{"taosadapter_restful_http_request_summary_milliseconds": nil}, + tables: tables, + } + p.Prepare() + p.Process() + return p +} + +func (p *Processor) Prepare() { + locker := sync.RWMutex{} + wg := sync.WaitGroup{} + wg.Add(len(p.tables)) + + for tn := range p.tables { + tableName := tn + + err := pool.GoroutinePool.Submit(func() { + defer wg.Done() + data, err := p.dbConn.Query(p.ctx, fmt.Sprintf("describe %s", p.withDBName(tableName)), util.GetQidOwn()) + if err != nil { + var tdEngineError *taosError.TaosError + if errors.As(err, &tdEngineError) { + logger.Errorf("table %s not exist, skip it, error:%s", tableName, err) + } else { + logger.Errorf("could not get table %s metadata, skip it, error:%s", tableName, err) + } + return + } + + tags := make([]string, 0, len(data.Data)) + columns := make([]string, 0, len(data.Data)) + typeList := make([]string, 0, len(data.Data)) + columnMap := make(map[string]struct{}, len(data.Data)) + variablesMap := make(map[string]struct{}, len(data.Data)) + for _, info := range data.Data { + if info[3].(string) != "" { + variable := info[0].(string) + tags = append(tags, variable) + variablesMap[variable] = struct{}{} + } else { + column := info[0].(string) + columns = append(columns, column) + typeList = append(typeList, info[1].(string)) + columnMap[column] = struct{}{} + } + } + + // metrics := make([]*Metric, 0, len(columns)) + // newMetrics := make(map[string]*Metric, len(columns)) + columnList := make([]string, 0, len(columns)) + + timestampColumn := "ts" + _, exist := p.summaryTable[tableName] + for i, column := range columns { + if _, columnExist := variablesMap[column]; columnExist { + continue + } + + if typeList[i] == "TIMESTAMP" { + timestampColumn = column + continue + } + + columnName, metricType := "", Summary + if !exist { + columnName = column + + if _, ok := metricTypeMap[tableName+"_"+columnName]; ok { + metricType = metricTypeMap[tableName+"_"+columnName] + } else { + metricType = exchangeDBType(typeList[i]) + } + + // 为了兼容性,硬编码,后续要优化 + if strings.HasSuffix(columnName, "role") { + metricType = Info + } + } + + labels := make(map[string]string) + + fqName := p.buildFQName(tableName, columnName) + pDesc := prometheus.NewDesc(fqName, "", nil, labels) + metric := &Metric{ + Type: metricType, + Desc: pDesc, + FQName: fqName, + Help: "", + ConstLabels: labels, + Variables: tags, + } + // metrics = append(metrics, metric) + // newMetrics[column] = metric + + locker.Lock() + p.metricMap[fqName] = metric + locker.Unlock() + + columnList = append(columnList, column) + } + + t := &Table{ + tsName: timestampColumn, + Variables: tags, + ColumnList: columnList, + } + locker.Lock() + p.tableMap[tableName] = t + p.tableList = append(p.tableList, tableName) + locker.Unlock() + + }) + if err != nil { + panic(err) + } + } + + wg.Wait() +} + +func (p *Processor) withDBName(tableName string) string { + b := pool.BytesPoolGet() + b.WriteString(p.db) + b.WriteByte('.') + b.WriteString(tableName) + return b.String() +} + +func (p *Processor) Process() { + // 首先清空所有指标值 + for _, metric := range p.metricMap { + metric.SetValue(nil) + } + + for _, tableName := range p.tableList { + tagIndex := 0 + hasTag := false + b := pool.BytesPoolGet() + b.WriteString("select ") + + table := p.tableMap[tableName] + columns := table.ColumnList + + for i, column := range columns { + b.WriteString("last_row(`" + column + "`) as `" + column + "`") + if i != len(columns)-1 { + b.WriteByte(',') + } + } + + if len(table.Variables) > 0 { + tagIndex = len(columns) + for _, tag := range table.Variables { + b.WriteString(", last_row(`" + tag + "`) as `" + tag + "`") + } + } + + b.WriteString(" from ") + b.WriteString(p.withDBName(tableName)) + + b.WriteString(" WHERE " + p.tableMap[tableName].tsName + " > (NOW() - 1m) ") + + if len(table.Variables) > 0 { + tagIndex = len(columns) + b.WriteString(" group by ") + for i, tag := range table.Variables { + b.WriteString("`" + tag + "`") + if i != len(table.Variables)-1 { + b.WriteByte(',') + } + } + } + sql := b.String() + pool.BytesPoolPut(b) + data, err := p.dbConn.Query(p.ctx, sql, util.GetQidOwn()) + logger.Debug(sql) + if err != nil { + logger.WithError(err).Errorln("select data sql:", sql) + continue + } + if tagIndex > 0 { + hasTag = true + } + if len(data.Data) == 0 { + continue + } + values := make([][]*Value, len(table.ColumnList)) + for _, row := range data.Data { + label := map[string]string{} + valuesMap := make(map[string]interface{}) + colEndIndex := len(columns) + if hasTag { + for i := tagIndex; i < len(data.Head); i++ { + if row[i] != nil { + label[data.Head[i]] = fmt.Sprintf("%v", row[i]) + } + } + } + // values array to map + for i := 0; i < colEndIndex; i++ { + valuesMap[columns[i]] = row[i] + } + for i, column := range table.ColumnList { + var v interface{} + metric := p.metricMap[p.buildFQName(tableName, column)] + switch metric.Type { + case Info: + _, isFloat := valuesMap[column].(float64) + if strings.HasSuffix(column, "role") && valuesMap[column] != nil && isFloat { + v = getRoleStr(valuesMap[column].(float64)) + break + } + if strings.HasSuffix(column, "status") && valuesMap[column] != nil && isFloat { + v = getStatusStr(valuesMap[column].(float64)) + break + } + + if valuesMap[column] != nil { + v = i2string(valuesMap[column]) + } else { + v = nil + } + case Counter, Gauge, Summary: + if valuesMap[column] != nil { + v = i2float(valuesMap[column]) + if column == "cluster_uptime" { + v = i2float(valuesMap[column]) / 86400 + } + } else { + v = nil + } + } + values[i] = append(values[i], &Value{ + Label: label, + Value: v, + }) + } + } + + for i, column := range table.ColumnList { + metric := p.metricMap[p.buildFQName(tableName, column)] + for _, value := range values[i] { + logger.Tracef("set metric:%s, Label:%v, Value:%v", column, value.Label, value.Value) + } + if metric.GetValue() != nil { + values[i] = append(values[i], metric.GetValue()...) + } + metric.SetValue(values[i]) + } + } +} + +func (p *Processor) buildFQName(tableName string, column string) string { + + // keep same metric name + tempFQName := tableName + "_" + column + if _, ok := metricNameMap[tempFQName]; ok { + return p.prefix + "_" + metricNameMap[tempFQName] + } + + b := pool.BytesPoolGet() + b.WriteString(p.prefix) + b.WriteByte('_') + + b.WriteString(tableName) + + if column != "" { + b.WriteByte('_') + b.WriteString(column) + } + + fqName := b.String() + pool.BytesPoolPut(b) + + return fqName +} + +func (p *Processor) GetMetric() map[string]*Metric { + return p.metricMap +} + +func (p *Processor) Close() error { + close(p.exitChan) + return p.dbConn.Close() +} + +func getRoleStr(v float64) string { + rounded := math.Round(v) + integer := int(rounded) + + switch integer { + case 0: + return "offline" + case 100: + return "follower" + case 101: + return "candidate" + case 102: + return "leader" + case 103: + return "error" + case 104: + return "learner" + } + return "unknown" +} + +func getStatusStr(v float64) string { + rounded := math.Round(v) + integer := int(rounded) + + switch integer { + case 0: + return "offline" + case 1: + return "ready" + } + return "unknown" +} + +func exchangeDBType(t string) CollectType { + switch t { + case "BOOL", "FLOAT", "DOUBLE": + return Gauge + case "TINYINT", "SMALLINT", "INT", "BIGINT", "TINYINT UNSIGNED", "SMALLINT UNSIGNED", "INT UNSIGNED", "BIGINT UNSIGNED": + return Counter + case "BINARY", "NCHAR", "VARCHAR": + return Info + default: + panic("unsupported type") + } +} + +func i2string(value interface{}) string { + switch v := value.(type) { + case string: + return v + case []byte: + return string(v) + default: + panic("unexpected type to string") + } +} + +func i2float(value interface{}) float64 { + switch v := value.(type) { + case int8: + return float64(v) + case int16: + return float64(v) + case int32: + return float64(v) + case int64: + return float64(v) + case uint8: + return float64(v) + case uint16: + return float64(v) + case uint32: + return float64(v) + case uint64: + return float64(v) + case float64: + return v + case float32: + return float64(v) + case bool: + if v { + return 1 + } + return 0 + default: + panic("unexpected type to float64") + } +} diff --git a/tools/keeper/prometheus/prometheus.yml b/tools/keeper/prometheus/prometheus.yml new file mode 100644 index 000000000000..397d566d9183 --- /dev/null +++ b/tools/keeper/prometheus/prometheus.yml @@ -0,0 +1,13 @@ +global: + scrape_interval: 5s + +scrape_configs: + - job_name: "prometheus" + static_configs: + - targets: ["localhost:9090"] + - job_name: "taoskeeper" + static_configs: + - targets: ["taoskeeper:6043"] + - job_name: "node" + static_configs: + - targets: ["nodeexporter:9100"] diff --git a/tools/keeper/system/empty_test.go b/tools/keeper/system/empty_test.go new file mode 100644 index 000000000000..a4d4777d3297 --- /dev/null +++ b/tools/keeper/system/empty_test.go @@ -0,0 +1,8 @@ +package system + +import ( + "testing" +) + +func TestEmpty(t *testing.T) { +} diff --git a/tools/keeper/system/program.go b/tools/keeper/system/program.go new file mode 100644 index 000000000000..437da68f08d6 --- /dev/null +++ b/tools/keeper/system/program.go @@ -0,0 +1,146 @@ +package system + +import ( + "context" + "fmt" + "net/http" + "os" + "strconv" + "time" + + "github.com/kardianos/service" + "github.com/taosdata/go-utils/web" + "github.com/taosdata/taoskeeper/api" + "github.com/taosdata/taoskeeper/cmd" + "github.com/taosdata/taoskeeper/infrastructure/config" + "github.com/taosdata/taoskeeper/infrastructure/log" + "github.com/taosdata/taoskeeper/monitor" + "github.com/taosdata/taoskeeper/process" + "github.com/taosdata/taoskeeper/version" +) + +var logger = log.GetLogger("PRG") + +func Init() *http.Server { + conf := config.InitConfig() + log.ConfigLog() + + if len(conf.Transfer) > 0 || len(conf.Drop) > 0 { + cmd := cmd.NewCommand(conf) + cmd.Process(conf) + os.Exit(0) + return nil + } + + router := web.CreateRouter(false, &conf.Cors, false) + router.Use(log.GinLog()) + router.Use(log.GinRecoverLog()) + + reporter := api.NewReporter(conf) + reporter.Init(router) + monitor.StartMonitor(conf.Metrics.Cluster, conf, reporter) + + go func() { + // wait for monitor to all metric received + time.Sleep(time.Second * 35) + + processor := process.NewProcessor(conf) + node := api.NewNodeExporter(processor) + node.Init(router) + + if config.IsEnterprise == "true" { + zabbix := api.NewZabbix(processor) + zabbix.Init(router) + } + }() + + checkHealth := api.NewCheckHealth(version.Version) + checkHealth.Init(router) + + if config.IsEnterprise == "true" { + if conf.Audit.Enable { + audit, err := api.NewAudit(conf) + if err != nil { + panic(err) + } + if err = audit.Init(router); err != nil { + panic(err) + } + } + } + + adapter := api.NewAdapter(conf) + if err := adapter.Init(router); err != nil { + panic(err) + } + + gen_metric := api.NewGeneralMetric(conf) + if err := gen_metric.Init(router); err != nil { + panic(err) + } + + server := &http.Server{ + Addr: ":" + strconv.Itoa(conf.Port), + Handler: router, + } + + return server +} + +func Start(server *http.Server) { + prg := newProgram(server) + svcConfig := &service.Config{ + Name: "taoskeeper", + DisplayName: "taoskeeper", + Description: "taosKeeper is a tool for TDengine that exports monitoring metrics", + } + s, err := service.New(prg, svcConfig) + if err != nil { + logger.Fatal(err) + } + err = s.Run() + if err != nil { + logger.Fatal(err) + } +} + +type program struct { + server *http.Server +} + +func newProgram(server *http.Server) *program { + return &program{server: server} +} + +func (p *program) Start(s service.Service) error { + if service.Interactive() { + logger.Info("Running in terminal.") + } else { + logger.Info("Running under service manager.") + } + + server := p.server + go func() { + if err := server.ListenAndServe(); err != nil && err != http.ErrServerClosed { + panic(fmt.Errorf("taoskeeper start up fail! %v", err)) + } + }() + return nil +} + +func (p *program) Stop(s service.Service) error { + logger.Println("Shutdown WebServer ...") + ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) + defer cancel() + + if err := p.server.Shutdown(ctx); err != nil { + logger.Println("WebServer Shutdown error:", err) + } + + logger.Println("Server exiting") + ctxLog, cancelLog := context.WithTimeout(context.Background(), 5*time.Second) + defer cancelLog() + logger.Println("Flushing Log") + log.Close(ctxLog) + return nil +} diff --git a/tools/keeper/system/program_test.go b/tools/keeper/system/program_test.go new file mode 100644 index 000000000000..eabc4fff35ec --- /dev/null +++ b/tools/keeper/system/program_test.go @@ -0,0 +1,22 @@ +package system + +import ( + "context" + "fmt" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/taosdata/taoskeeper/db" + "github.com/taosdata/taoskeeper/infrastructure/config" + "github.com/taosdata/taoskeeper/util" +) + +func TestStart(t *testing.T) { + server := Init() + assert.NotNil(t, server) + + conn, err := db.NewConnectorWithDb(config.Conf.TDengine.Username, config.Conf.TDengine.Password, config.Conf.TDengine.Host, config.Conf.TDengine.Port, config.Conf.Metrics.Database.Name, config.Conf.TDengine.Usessl) + assert.NoError(t, err) + conn.Query(context.Background(), fmt.Sprintf("drop database if exists %s", config.Conf.Metrics.Database.Name), util.GetQidOwn()) + conn.Query(context.Background(), fmt.Sprintf("drop database if exists %s", config.Conf.Audit.Database.Name), util.GetQidOwn()) +} diff --git a/tools/keeper/taoskeeper.service b/tools/keeper/taoskeeper.service new file mode 100644 index 000000000000..d8478bc59bd8 --- /dev/null +++ b/tools/keeper/taoskeeper.service @@ -0,0 +1,19 @@ +[Unit] +Description=TaosKeeper - TDengine Metrics Exporter for Kinds of Collectors +Documentation=https://www.taosdata.com +After=network-online.target +Wants=network-online.target + +[Service] +Type=simple +ExecStart=/usr/bin/taoskeeper +TimeoutSec=0 +RestartSec=2 +StandardOutput=null +StandardError=journal +Restart=always +StartLimitBurst=3 +StartLimitInterval=60s + +[Install] +WantedBy=multi-user.target diff --git a/tools/keeper/telegraf.conf b/tools/keeper/telegraf.conf new file mode 100644 index 000000000000..aa2e8e0b350f --- /dev/null +++ b/tools/keeper/telegraf.conf @@ -0,0 +1,6 @@ +[[inputs.prometheus]] +# An array of urls to scrape metrics from. +urls = ["${TAOSKEEPER}"] + +[[outputs.file]] +files = ["stdout"] diff --git a/tools/keeper/telegraf.yml b/tools/keeper/telegraf.yml new file mode 100644 index 000000000000..a02e9f669b5a --- /dev/null +++ b/tools/keeper/telegraf.yml @@ -0,0 +1,9 @@ +version: "3.6" +services: + telegraf: + image: telegraf:1.20-alpine + hostname: telegraf + volumes: + - ./telegraf.conf:/etc/telegraf/telegraf.conf:ro + environment: + TAOSKEEPER: http://taoskeeper:6043/metrics diff --git a/tools/keeper/util/empty_test.go b/tools/keeper/util/empty_test.go new file mode 100644 index 000000000000..5d8286672176 --- /dev/null +++ b/tools/keeper/util/empty_test.go @@ -0,0 +1,8 @@ +package util + +import ( + "testing" +) + +func TestEmpty(t *testing.T) { +} diff --git a/tools/keeper/util/pool/antpool.go b/tools/keeper/util/pool/antpool.go new file mode 100644 index 000000000000..7a4ecd46dea5 --- /dev/null +++ b/tools/keeper/util/pool/antpool.go @@ -0,0 +1,15 @@ +package pool + +import ( + "github.com/panjf2000/ants/v2" +) + +var GoroutinePool *ants.Pool + +func Init(size int) { + var err error + GoroutinePool, err = ants.NewPool(size) + if err != nil { + panic(err) + } +} diff --git a/tools/keeper/util/pool/bytes.go b/tools/keeper/util/pool/bytes.go new file mode 100644 index 000000000000..0fc44f77b87c --- /dev/null +++ b/tools/keeper/util/pool/bytes.go @@ -0,0 +1,23 @@ +package pool + +import ( + "bytes" + "sync" +) + +var bytesBufferPool sync.Pool + +func init() { + bytesBufferPool.New = func() interface{} { + return &bytes.Buffer{} + } +} + +func BytesPoolGet() *bytes.Buffer { + return bytesBufferPool.Get().(*bytes.Buffer) +} + +func BytesPoolPut(b *bytes.Buffer) { + b.Reset() + bytesBufferPool.Put(b) +} diff --git a/tools/keeper/util/pool/empty_test.go b/tools/keeper/util/pool/empty_test.go new file mode 100644 index 000000000000..dcbca2d11d90 --- /dev/null +++ b/tools/keeper/util/pool/empty_test.go @@ -0,0 +1,8 @@ +package pool + +import ( + "testing" +) + +func TestEmpty(t *testing.T) { +} diff --git a/tools/keeper/util/util.go b/tools/keeper/util/util.go new file mode 100644 index 000000000000..a739c2376051 --- /dev/null +++ b/tools/keeper/util/util.go @@ -0,0 +1,154 @@ +package util + +import ( + "crypto/md5" + "encoding/hex" + "os" + "strconv" + "strings" + "sync/atomic" + "time" + "unicode" + + "github.com/taosdata/taoskeeper/infrastructure/config" +) + +// https://github.com/containerd/cgroups/blob/main/utils.go +var globalCounter64 uint64 +var globalCounter32 uint32 + +var MAX_TABLE_NAME_LEN = 190 + +func init() { + atomic.StoreUint64(&globalCounter64, 0) + atomic.StoreUint32(&globalCounter32, 0) +} + +func ReadUint(path string) (uint64, error) { + v, err := os.ReadFile(path) + if err != nil { + return 0, err + } + return ParseUint(strings.TrimSpace(string(v)), 10, 64) +} + +func ParseUint(s string, base, bitSize int) (uint64, error) { + v, err := strconv.ParseUint(s, base, bitSize) + if err != nil { + intValue, intErr := strconv.ParseInt(s, base, bitSize) + // 1. Handle negative values greater than MinInt64 (and) + // 2. Handle negative values lesser than MinInt64 + if intErr == nil && intValue < 0 { + return 0, nil + } else if intErr != nil && + intErr.(*strconv.NumError).Err == strconv.ErrRange && + intValue < 0 { + return 0, nil + } + return 0, err + } + return v, nil +} + +func EscapeInfluxProtocol(s string) string { + s = strings.TrimSuffix(s, "\\") + s = strings.ReplaceAll(s, ",", "\\,") + s = strings.ReplaceAll(s, "=", "\\=") + s = strings.ReplaceAll(s, " ", "\\ ") + s = strings.ReplaceAll(s, "\"", "\\\"") + return s +} + +func GetCfg() *config.Config { + c := &config.Config{ + InstanceID: 64, + Port: 6043, + LogLevel: "trace", + TDengine: config.TDengineRestful{ + Host: "127.0.0.1", + Port: 6041, + Username: "root", + Password: "taosdata", + Usessl: false, + }, + Metrics: config.MetricsConfig{ + Database: config.Database{ + Name: "keeper_test_log", + Options: map[string]interface{}{}, + }, + }, + Log: config.Log{ + Level: "trace", + Path: "/var/log/taos", + RotationCount: 10, + RotationTime: 24 * time.Hour, + RotationSize: 1073741824, + Compress: true, + ReservedDiskSize: 1073741824, + }, + } + return c +} + +func SafeSubstring(s string, n int) string { + if len(s) > n { + return s[:n] + } + return s +} + +func GetQid(qidStr string) uint64 { + if qidStr == "" || !strings.HasPrefix(qidStr, "0x") { + qid32 := atomic.AddUint32(&globalCounter32, 1) + qid64 := uint64(qid32) << 8 + return qid64 + } + + qid, err := strconv.ParseUint(qidStr[2:], 16, 64) + if err != nil { + qid32 := atomic.AddUint32(&globalCounter32, 1) + qid64 := uint64(qid32) << 8 + return qid64 + } + + // clear the last byte + qid = qid &^ 0xFF + + return qid +} + +func GetQidOwn() uint64 { + + id := atomic.AddUint64(&globalCounter64, 1) + + if id > 0x00ffffffffffffff { + atomic.StoreUint64(&globalCounter64, 1) + id = 1 + } + qid64 := uint64(config.Conf.InstanceID)<<56 | id + return qid64 +} + +func GetMd5HexStr(str string) string { + sum := md5.Sum([]byte(str)) + return hex.EncodeToString(sum[:]) +} + +func isValidChar(r rune) bool { + return unicode.IsLetter(r) || unicode.IsDigit(r) || r == '_' +} + +func ToValidTableName(input string) string { + var builder strings.Builder + + for _, r := range input { + if isValidChar(r) { + builder.WriteRune(unicode.ToLower(r)) + } else { + builder.WriteRune('_') + } + } + + result := builder.String() + return result +} diff --git a/tools/keeper/version/version.go b/tools/keeper/version/version.go new file mode 100644 index 000000000000..a9e33f402b4d --- /dev/null +++ b/tools/keeper/version/version.go @@ -0,0 +1,9 @@ +package version + +var Version = "0.0.0.0" +var Gitinfo = "unknown" +var BuildInfo = "1970-01-01 00:00:00 +08:00" +var CommitID = "unknown" + +var CUS_NAME = "TDengine" +var CUS_PROMPT = "taos" diff --git a/tools/keeper/zbx_taos_keeper_templates.xml b/tools/keeper/zbx_taos_keeper_templates.xml new file mode 100644 index 000000000000..04e260cd2186 --- /dev/null +++ b/tools/keeper/zbx_taos_keeper_templates.xml @@ -0,0 +1,111 @@ + + + 5.0 + 2021-12-06T05:55:45Z + + + taos + + + + + + \ No newline at end of file From 0e2fe1554bab62f6d2cf6bcc01138645bc5517d6 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Thu, 17 Oct 2024 17:29:57 +0800 Subject: [PATCH 146/695] interp only support force window close --- source/libs/parser/src/parTranslater.c | 5 +++ tests/parallel_test/cases.task | 51 +++++++++++++------------- 2 files changed, 31 insertions(+), 25 deletions(-) diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index edd460db08f1..f89cbedb0138 100755 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -10659,6 +10659,11 @@ static int32_t checkStreamQuery(STranslateContext* pCxt, SCreateStreamStmt* pStm } if (pSelect->hasInterpFunc) { + // Temporary code + if (pStmt->pOptions->triggerType != STREAM_TRIGGER_FORCE_WINDOW_CLOSE) { + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY, + "Stream interp function only support force window close"); + } if (pStmt->pOptions->triggerType == STREAM_TRIGGER_FORCE_WINDOW_CLOSE) { if (pStmt->pOptions->fillHistory) { return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY, diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 7a464dbc9343..be28b1398d8d 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -1364,32 +1364,33 @@ ,,y,script,./test.sh -f tsim/stream/sliding.sim ,,y,script,./test.sh -f tsim/stream/state0.sim ,,y,script,./test.sh -f tsim/stream/state1.sim -,,y,script,./test.sh -f tsim/stream/streamInterpDelete0.sim -,,y,script,./test.sh -f tsim/stream/streamInterpDelete1.sim -,,y,script,./test.sh -f tsim/stream/streamInterpDelete2.sim -,,y,script,./test.sh -f tsim/stream/streamInterpError.sim +#,,y,script,./test.sh -f tsim/stream/streamInterpDelete0.sim +#,,y,script,./test.sh -f tsim/stream/streamInterpDelete1.sim +#,,y,script,./test.sh -f tsim/stream/streamInterpDelete2.sim +#,,y,script,./test.sh -f tsim/stream/streamInterpError.sim ,,y,script,./test.sh -f tsim/stream/streamInterpForceWindowClose.sim -,,y,script,./test.sh -f tsim/stream/streamInterpHistory.sim -,,y,script,./test.sh -f tsim/stream/streamInterpHistory1.sim -,,y,script,./test.sh -f tsim/stream/streamInterpLarge.sim -,,y,script,./test.sh -f tsim/stream/streamInterpLinear0.sim -,,y,script,./test.sh -f tsim/stream/streamInterpNext0.sim -,,y,script,./test.sh -f tsim/stream/streamInterpOther.sim -,,y,script,./test.sh -f tsim/stream/streamInterpOther1.sim -,,y,script,./test.sh -f tsim/stream/streamInterpPartitionBy0.sim -,,y,script,./test.sh -f tsim/stream/streamInterpPrev0.sim -,,y,script,./test.sh -f tsim/stream/streamInterpPrev1.sim -,,y,script,./test.sh -f tsim/stream/streamInterpPrimaryKey0.sim -,,y,script,./test.sh -f tsim/stream/streamInterpPrimaryKey1.sim -,,y,script,./test.sh -f tsim/stream/streamInterpPrimaryKey2.sim -,,y,script,./test.sh -f tsim/stream/streamInterpPrimaryKey3.sim -,,y,script,./test.sh -f tsim/stream/streamInterpUpdate.sim -,,y,script,./test.sh -f tsim/stream/streamInterpUpdate1.sim -,,y,script,./test.sh -f tsim/stream/streamInterpValue0.sim -,,y,script,./test.sh -f tsim/stream/streamPrimaryKey0.sim -,,y,script,./test.sh -f tsim/stream/streamPrimaryKey1.sim -,,y,script,./test.sh -f tsim/stream/streamPrimaryKey2.sim -,,y,script,./test.sh -f tsim/stream/streamPrimaryKey3.sim +,,y,script,./test.sh -f tsim/stream/streamInterpForceWindowClose1.sim +#,,y,script,./test.sh -f tsim/stream/streamInterpHistory.sim +#,,y,script,./test.sh -f tsim/stream/streamInterpHistory1.sim +#,,y,script,./test.sh -f tsim/stream/streamInterpLarge.sim +#,,y,script,./test.sh -f tsim/stream/streamInterpLinear0.sim +#,,y,script,./test.sh -f tsim/stream/streamInterpNext0.sim +#,,y,script,./test.sh -f tsim/stream/streamInterpOther.sim +#,,y,script,./test.sh -f tsim/stream/streamInterpOther1.sim +#,,y,script,./test.sh -f tsim/stream/streamInterpPartitionBy0.sim +#,,y,script,./test.sh -f tsim/stream/streamInterpPrev0.sim +#,,y,script,./test.sh -f tsim/stream/streamInterpPrev1.sim +#,,y,script,./test.sh -f tsim/stream/streamInterpPrimaryKey0.sim +#,,y,script,./test.sh -f tsim/stream/streamInterpPrimaryKey1.sim +#,,y,script,./test.sh -f tsim/stream/streamInterpPrimaryKey2.sim +#,,y,script,./test.sh -f tsim/stream/streamInterpPrimaryKey3.sim +#,,y,script,./test.sh -f tsim/stream/streamInterpUpdate.sim +#,,y,script,./test.sh -f tsim/stream/streamInterpUpdate1.sim +#,,y,script,./test.sh -f tsim/stream/streamInterpValue0.sim +#,,y,script,./test.sh -f tsim/stream/streamPrimaryKey0.sim +#,,y,script,./test.sh -f tsim/stream/streamPrimaryKey1.sim +#,,y,script,./test.sh -f tsim/stream/streamPrimaryKey2.sim +#,,y,script,./test.sh -f tsim/stream/streamPrimaryKey3.sim ,,y,script,./test.sh -f tsim/stream/streamTwaError.sim ,,y,script,./test.sh -f tsim/stream/streamTwaFwcFill.sim ,,y,script,./test.sh -f tsim/stream/streamTwaFwcFillPrimaryKey.sim From 88c03c8336b8cf83d18b2c05838655a50df45273 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Thu, 17 Oct 2024 17:42:03 +0800 Subject: [PATCH 147/695] fix ci issue --- source/libs/stream/src/streamSliceState.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/libs/stream/src/streamSliceState.c b/source/libs/stream/src/streamSliceState.c index a80c42a881cc..238bff8afcae 100644 --- a/source/libs/stream/src/streamSliceState.c +++ b/source/libs/stream/src/streamSliceState.c @@ -33,7 +33,8 @@ int32_t getHashSortRowBuff(SStreamFileState* pFileState, const SWinKey* pKey, vo SArray* pWinStates = NULL; SSHashObj* pSearchBuff = getSearchBuff(pFileState); - addArrayBuffIfNotExist(pSearchBuff, pKey->groupId, &pWinStates); + code = addArrayBuffIfNotExist(pSearchBuff, pKey->groupId, &pWinStates); + QUERY_CHECK_CODE(code, lino, _end); // recover if (taosArrayGetSize(pWinStates) == 0 && needClearDiskBuff(pFileState)) { @@ -55,7 +56,8 @@ int32_t getHashSortRowBuff(SStreamFileState* pFileState, const SWinKey* pKey, vo streamStateFreeCur(pCur); } - addSearchItem(pFileState, pWinStates, pKey); + code = addSearchItem(pFileState, pWinStates, pKey); + QUERY_CHECK_CODE(code, lino, _end); _end: if (code != TSDB_CODE_SUCCESS) { From bc05289192b50ebda674fa77a510281bd2f497e5 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Fri, 18 Oct 2024 09:28:16 +0800 Subject: [PATCH 148/695] enh:[TS-5441] cost too long in tmq write meta data by cache meta and vg info --- include/common/tmsg.h | 1 - include/libs/executor/executor.h | 1 - source/client/src/clientRawBlockWrite.c | 110 ------------------------ source/common/src/tmsg.c | 40 +-------- source/dnode/vnode/src/tq/tqScan.c | 15 ---- source/dnode/vnode/src/tq/tqUtil.c | 5 -- source/libs/executor/inc/querytask.h | 1 - source/libs/executor/src/executor.c | 5 -- 8 files changed, 1 insertion(+), 177 deletions(-) diff --git a/include/common/tmsg.h b/include/common/tmsg.h index eb7a08357b34..9058dfe53f60 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -4113,7 +4113,6 @@ typedef struct { SArray* blockData; SArray* blockTbName; SArray* blockSchema; -// SArray* blockSuid; union{ struct{ diff --git a/include/libs/executor/executor.h b/include/libs/executor/executor.h index 8501d88be0d9..6d4b3df0417e 100644 --- a/include/libs/executor/executor.h +++ b/include/libs/executor/executor.h @@ -210,7 +210,6 @@ SMqBatchMetaRsp* qStreamExtractMetaMsg(qTaskInfo_t tinfo); const SSchemaWrapper* qExtractSchemaFromTask(qTaskInfo_t tinfo); const char* qExtractTbnameFromTask(qTaskInfo_t tinfo); -//const int64_t qExtractSuidFromTask(qTaskInfo_t tinfo); void* qExtractReaderFromStreamScanner(void* scanner); diff --git a/source/client/src/clientRawBlockWrite.c b/source/client/src/clientRawBlockWrite.c index 6c54c3aa691a..206bc63d1923 100644 --- a/source/client/src/clientRawBlockWrite.c +++ b/source/client/src/clientRawBlockWrite.c @@ -1706,116 +1706,6 @@ static void* getRawDataFromRes(void* pRetrieve) { return rawData; } -//static int32_t tmqWriteRawDataImpl(TAOS* taos, void* data, int32_t dataLen) { -// if (taos == NULL || data == NULL) { -// SET_ERROR_MSG("taos:%p or data:%p is NULL", taos, data); -// return TSDB_CODE_INVALID_PARA; -// } -// int32_t code = TSDB_CODE_SUCCESS; -// SHashObj* pVgHash = NULL; -// SQuery* pQuery = NULL; -// SMqRspObj rspObj = {0}; -// SDecoder decoder = {0}; -// STableMeta* pTableMeta = NULL; -// -// SRequestObj* pRequest = NULL; -// RAW_RETURN_CHECK(createRequest(*(int64_t*)taos, TSDB_SQL_INSERT, 0, &pRequest)); -// -// uDebug(LOG_ID_TAG " write raw data, data:%p, dataLen:%d", LOG_ID_VALUE, data, dataLen); -// pRequest->syncQuery = true; -// rspObj.resIter = -1; -// rspObj.resType = RES_TYPE__TMQ; -// -// int8_t dataVersion = *(int8_t*)data; -// if (dataVersion >= MQ_DATA_RSP_VERSION) { -// data = POINTER_SHIFT(data, sizeof(int8_t) + sizeof(int32_t)); -// dataLen -= sizeof(int8_t) + sizeof(int32_t); -// } -// tDecoderInit(&decoder, data, dataLen); -// code = tDecodeMqDataRsp(&decoder, &rspObj.dataRsp); -// if (code != 0) { -// SET_ERROR_MSG("decode mq data rsp failed"); -// code = TSDB_CODE_INVALID_MSG; -// goto end; -// } -// -// if (!pRequest->pDb) { -// code = TSDB_CODE_PAR_DB_NOT_SPECIFIED; -// goto end; -// } -// -// struct SCatalog* pCatalog = NULL; -// RAW_RETURN_CHECK(catalogGetHandle(pRequest->pTscObj->pAppInfo->clusterId, &pCatalog)); -// -// 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); -// -// RAW_RETURN_CHECK(smlInitHandle(&pQuery)); -// pVgHash = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, HASH_NO_LOCK); -// RAW_NULL_CHECK(pVgHash); -// while (++rspObj.resIter < rspObj.dataRsp.blockNum) { -// void* pRetrieve = taosArrayGetP(rspObj.dataRsp.blockData, rspObj.resIter); -// RAW_NULL_CHECK(pRetrieve); -// if (!rspObj.dataRsp.withSchema) { -// goto end; -// } -// -// const char* tbName = (const char*)taosArrayGetP(rspObj.dataRsp.blockTbName, rspObj.resIter); -// RAW_NULL_CHECK(tbName); -// -// SName pName = {TSDB_TABLE_NAME_T, pRequest->pTscObj->acctId, {0}, {0}}; -// (void)strcpy(pName.dbname, pRequest->pDb); -// (void)strcpy(pName.tname, tbName); -// -// RAW_RETURN_CHECK(catalogGetTableMeta(pCatalog, &conn, &pName, &pTableMeta)); -// -// SVgroupInfo vg = {0}; -// RAW_RETURN_CHECK(catalogGetTableHashVgroup(pCatalog, &conn, &pName, &vg)); -// -// void* hData = taosHashGet(pVgHash, &vg.vgId, sizeof(vg.vgId)); -// if (hData == NULL) { -// RAW_RETURN_CHECK(taosHashPut(pVgHash, (const char*)&vg.vgId, sizeof(vg.vgId), (char*)&vg, sizeof(vg))); -// } -// -// SSchemaWrapper* pSW = (SSchemaWrapper*)taosArrayGetP(rspObj.dataRsp.blockSchema, rspObj.resIter); -// RAW_NULL_CHECK(pSW); -// TAOS_FIELD* fields = taosMemoryCalloc(pSW->nCols, sizeof(TAOS_FIELD)); -// RAW_NULL_CHECK(fields); -// for (int i = 0; i < pSW->nCols; i++) { -// fields[i].type = pSW->pSchema[i].type; -// fields[i].bytes = pSW->pSchema[i].bytes; -// tstrncpy(fields[i].name, pSW->pSchema[i].name, tListLen(pSW->pSchema[i].name)); -// } -// void* rawData = getRawDataFromRes(pRetrieve); -// char err[ERR_MSG_LEN] = {0}; -// code = rawBlockBindData(pQuery, pTableMeta, rawData, NULL, fields, pSW->nCols, true, err, ERR_MSG_LEN); -// taosMemoryFree(fields); -// taosMemoryFreeClear(pTableMeta); -// if (code != TSDB_CODE_SUCCESS) { -// SET_ERROR_MSG("table:%s, err:%s", tbName, err); -// goto end; -// } -// } -// -// RAW_RETURN_CHECK(smlBuildOutput(pQuery, pVgHash)); -// -// launchQueryImpl(pRequest, pQuery, true, NULL); -// code = pRequest->code; -// -// end: -// uDebug(LOG_ID_TAG " write raw data return, msg:%s", LOG_ID_VALUE, tstrerror(code)); -// tDeleteMqDataRsp(&rspObj.dataRsp); -// tDecoderClear(&decoder); -// qDestroyQuery(pQuery); -// destroyRequest(pRequest); -// taosHashCleanup(pVgHash); -// taosMemoryFreeClear(pTableMeta); -// return code; -//} - static int32_t buildCreateTbMap(SMqDataRsp* rsp, SHashObj* pHashObj) { // find schema data info int32_t code = 0; diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index e0009177e59a..9c8544fcd46e 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -10980,42 +10980,13 @@ int32_t tEncodeMqDataRspCommon(SEncoder *pEncoder, const SMqDataRsp *pRsp) { return code; } -//int32_t tEncodeSuidArray(SEncoder *pEncoder, const SMqDataRsp *pRsp){ -// for (int32_t i = 0; i < pRsp->blockNum; i++) { -// if (pRsp->withTbName) { -// int64_t* suid = taosArrayGet(pRsp->blockSuid, i); -// if (suid != NULL){ -// TAOS_CHECK_RETURN(tEncodeI64(pEncoder, *suid)); -// } -// } -// } -// return 0; -//} int32_t tEncodeMqDataRsp(SEncoder *pEncoder, const SMqDataRsp *pRsp) { TAOS_CHECK_RETURN(tEncodeMqDataRspCommon(pEncoder, pRsp)); TAOS_CHECK_RETURN(tEncodeI64(pEncoder, pRsp->sleepTime)); -// TAOS_CHECK_RETURN(tEncodeSuidArray(pEncoder, pRsp)); return 0; } -//int32_t tDecodeSuidArray(SDecoder *pDecoder, SMqDataRsp *pRsp){ -// if (!tDecodeIsEnd(pDecoder)) { -// if (pRsp->withTbName) { -// if ((pRsp->blockSuid = taosArrayInit(pRsp->blockNum, sizeof(int64_t))) == NULL) { -// TAOS_CHECK_RETURN(terrno); -// } -// } -// -// for (int32_t i = 0; i < pRsp->blockNum; i++) { -// int64_t suid = 0; -// TAOS_CHECK_RETURN(tDecodeI64(pDecoder, &suid)); -// if (taosArrayPush(pRsp->blockSuid, &suid) == NULL) { -// TAOS_CHECK_RETURN(terrno); -// } -// } -// } -// return 0; -//} + int32_t tDecodeMqDataRspCommon(SDecoder *pDecoder, SMqDataRsp *pRsp) { int32_t code = 0; int32_t lino; @@ -11092,9 +11063,6 @@ int32_t tDecodeMqDataRsp(SDecoder *pDecoder, SMqDataRsp *pRsp) { if (!tDecodeIsEnd(pDecoder)) { TAOS_CHECK_RETURN(tDecodeI64(pDecoder, &pRsp->sleepTime)); } -// if (!tDecodeIsEnd(pDecoder)) { -// TAOS_CHECK_RETURN(tDecodeSuidArray(pDecoder, pRsp)); -// } return 0; } @@ -11108,8 +11076,6 @@ static void tDeleteMqDataRspCommon(SMqDataRsp *pRsp) { pRsp->blockSchema = NULL; taosArrayDestroyP(pRsp->blockTbName, (FDelete)taosMemoryFree); pRsp->blockTbName = NULL; -// taosArrayDestroy(pRsp->blockSuid); -// pRsp->blockSuid = NULL; tOffsetDestroy(&pRsp->reqOffset); tOffsetDestroy(&pRsp->rspOffset); } @@ -11129,7 +11095,6 @@ int32_t tEncodeSTaosxRsp(SEncoder *pEncoder, const SMqDataRsp *pRsp) { TAOS_CHECK_EXIT(tEncodeBinary(pEncoder, createTableReq, createTableLen)); } } -// TAOS_CHECK_EXIT(tEncodeSuidArray(pEncoder, pRsp)); _exit: return code; @@ -11161,9 +11126,6 @@ int32_t tDecodeSTaosxRsp(SDecoder *pDecoder, SMqDataRsp *pRsp) { } } } -// if (!tDecodeIsEnd(pDecoder)) { -// TAOS_CHECK_EXIT(tDecodeSuidArray(pDecoder, pRsp)); -// } _exit: return code; diff --git a/source/dnode/vnode/src/tq/tqScan.c b/source/dnode/vnode/src/tq/tqScan.c index 3e4895378bd0..0e7e27fcff94 100644 --- a/source/dnode/vnode/src/tq/tqScan.c +++ b/source/dnode/vnode/src/tq/tqScan.c @@ -77,16 +77,6 @@ static int32_t tqAddTbNameToRsp(const STQ* pTq, int64_t uid, SMqDataRsp* pRsp, i tqError("failed to push tbName to blockTbName:%s", tbName); continue; } -// int64_t suid = 0; -// if(mr.me.type == TSDB_CHILD_TABLE){ -// suid = mr.me.ctbEntry.suid; -// }else{ -// suid = mr.me.uid; -// } -// if(taosArrayPush(pRsp->blockSuid, &suid) == NULL){ -// tqError("failed to push suid to blockSuid:%"PRId64, suid); -// continue; -// } } metaReaderClear(&mr); return 0; @@ -229,11 +219,6 @@ int32_t tqScanTaosx(STQ* pTq, const STqHandle* pHandle, SMqDataRsp* pRsp, SMqBat tqError("vgId:%d, failed to add tbname to rsp msg", pTq->pVnode->config.vgId); continue; } -// int64_t suid = qExtractSuidFromTask(task); -// if (taosArrayPush(pRsp->blockSuid, &suid) == NULL){ -// tqError("vgId:%d, failed to add suid to rsp msg", pTq->pVnode->config.vgId); -// continue; -// } } if (pRsp->withSchema) { SSchemaWrapper* pSW = tCloneSSchemaWrapper(qExtractSchemaFromTask(task)); diff --git a/source/dnode/vnode/src/tq/tqUtil.c b/source/dnode/vnode/src/tq/tqUtil.c index 6acfe6b074d5..3f1193746320 100644 --- a/source/dnode/vnode/src/tq/tqUtil.c +++ b/source/dnode/vnode/src/tq/tqUtil.c @@ -50,7 +50,6 @@ static int32_t tqInitTaosxRsp(SMqDataRsp* pRsp, STqOffsetVal pOffset) { pRsp->blockDataLen = taosArrayInit(0, sizeof(int32_t)); pRsp->blockTbName = taosArrayInit(0, sizeof(void*)); pRsp->blockSchema = taosArrayInit(0, sizeof(void*)); -// pRsp->blockSuid = taosArrayInit(0, sizeof(int64_t)); if (pRsp->blockData == NULL || pRsp->blockDataLen == NULL || pRsp->blockTbName == NULL || pRsp->blockSchema == NULL) { @@ -74,10 +73,6 @@ static int32_t tqInitTaosxRsp(SMqDataRsp* pRsp, STqOffsetVal pOffset) { pRsp->blockSchema = NULL; } -// if (pRsp->blockSuid != NULL) { -// taosArrayDestroy(pRsp->blockSuid); -// pRsp->blockSuid = NULL; -// } return terrno; } diff --git a/source/libs/executor/inc/querytask.h b/source/libs/executor/inc/querytask.h index c9e65bacaf1d..e3bb9a13614c 100644 --- a/source/libs/executor/inc/querytask.h +++ b/source/libs/executor/inc/querytask.h @@ -69,7 +69,6 @@ typedef struct { SVersionRange fillHistoryVer; STimeWindow fillHistoryWindow; SStreamState* pState; -// int64_t suid; // for tmq } SStreamTaskInfo; struct SExecTaskInfo { diff --git a/source/libs/executor/src/executor.c b/source/libs/executor/src/executor.c index 4cfa12be5b65..b9e103ebca44 100644 --- a/source/libs/executor/src/executor.c +++ b/source/libs/executor/src/executor.c @@ -1212,11 +1212,6 @@ const char* qExtractTbnameFromTask(qTaskInfo_t tinfo) { return pTaskInfo->streamInfo.tbName; } -//const int64_t qExtractSuidFromTask(qTaskInfo_t tinfo) { -// SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo; -// return pTaskInfo->streamInfo.suid; -//} - SMqBatchMetaRsp* qStreamExtractMetaMsg(qTaskInfo_t tinfo) { SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo; return &pTaskInfo->streamInfo.btMetaRsp; From 41acc1ea5ab7f68250f0b1f960b2dc4ad4d53e79 Mon Sep 17 00:00:00 2001 From: dmchen Date: Fri, 18 Oct 2024 03:43:39 +0000 Subject: [PATCH 149/695] feat/TS-5484-audit-delete-client-pull-config --- include/common/tmsg.h | 2 ++ source/dnode/mnode/impl/src/mndProfile.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/include/common/tmsg.h b/include/common/tmsg.h index 0008bc0e9d72..74907992e3cb 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -1009,6 +1009,7 @@ typedef struct { char sDetailVer[128]; int64_t whiteListVer; SMonitorParas monitorParas; + int8_t enableAuditDelete; } SConnectRsp; int32_t tSerializeSConnectRsp(void* buf, int32_t bufLen, SConnectRsp* pRsp); @@ -3369,6 +3370,7 @@ typedef struct { int32_t svrTimestamp; SArray* rsps; // SArray SMonitorParas monitorParas; + int8_t enableAuditDelete; } SClientHbBatchRsp; static FORCE_INLINE uint32_t hbKeyHashFunc(const char* key, uint32_t keyLen) { return taosIntHash_64(key, keyLen); } diff --git a/source/dnode/mnode/impl/src/mndProfile.c b/source/dnode/mnode/impl/src/mndProfile.c index a1ffee9b06a3..d0047cace196 100644 --- a/source/dnode/mnode/impl/src/mndProfile.c +++ b/source/dnode/mnode/impl/src/mndProfile.c @@ -305,6 +305,7 @@ static int32_t mndProcessConnectReq(SRpcMsg *pReq) { connectRsp.monitorParas.tsSlowLogMaxLen = tsSlowLogMaxLen; connectRsp.monitorParas.tsSlowLogThreshold = tsSlowLogThreshold; connectRsp.monitorParas.tsSlowLogThresholdTest = tsSlowLogThresholdTest; + connectRsp.enableAuditDelete = tsEnableAuditDelete; tstrncpy(connectRsp.monitorParas.tsSlowLogExceptDb, tsSlowLogExceptDb, TSDB_DB_NAME_LEN); connectRsp.whiteListVer = pUser->ipWhiteListVer; @@ -709,6 +710,7 @@ static int32_t mndProcessHeartBeatReq(SRpcMsg *pReq) { tstrncpy(batchRsp.monitorParas.tsSlowLogExceptDb, tsSlowLogExceptDb, TSDB_DB_NAME_LEN); batchRsp.monitorParas.tsSlowLogMaxLen = tsSlowLogMaxLen; batchRsp.monitorParas.tsSlowLogScope = tsSlowLogScope; + batchRsp.enableAuditDelete = tsEnableAuditDelete; int32_t sz = taosArrayGetSize(batchReq.reqs); for (int i = 0; i < sz; i++) { From e9550a6b2cef5d83fe72a700576f7cf16801493f Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Fri, 18 Oct 2024 15:40:37 +0800 Subject: [PATCH 150/695] feat(stream):save force window close scan range --- include/libs/executor/executor.h | 2 +- include/libs/executor/storageapi.h | 4 +- include/libs/stream/tstreamUpdate.h | 4 +- source/libs/executor/inc/executorInt.h | 1 + source/libs/executor/src/executor.c | 8 +- source/libs/executor/src/scanoperator.c | 160 +++++++++++++++++++++--- source/libs/stream/src/streamSched.c | 3 +- source/libs/stream/src/streamUpdate.c | 90 ++++++------- 8 files changed, 190 insertions(+), 82 deletions(-) diff --git a/include/libs/executor/executor.h b/include/libs/executor/executor.h index cd78e97e39da..438b4c869d08 100644 --- a/include/libs/executor/executor.h +++ b/include/libs/executor/executor.h @@ -222,7 +222,7 @@ int32_t qStreamRecoverFinish(qTaskInfo_t tinfo); bool qStreamScanhistoryFinished(qTaskInfo_t tinfo); int32_t qStreamInfoResetTimewindowFilter(qTaskInfo_t tinfo); void qResetTaskInfoCode(qTaskInfo_t tinfo); -int32_t qGetStreamIntervalExecInfo(qTaskInfo_t tinfo, int64_t* pWaterMark, SInterval* pInterval); +int32_t qGetStreamIntervalExecInfo(qTaskInfo_t tinfo, int64_t* pWaterMark, SInterval* pInterval, STimeWindow* pLastWindow); int32_t qStreamOperatorReleaseState(qTaskInfo_t tInfo); int32_t qStreamOperatorReloadState(qTaskInfo_t tInfo); diff --git a/include/libs/executor/storageapi.h b/include/libs/executor/storageapi.h index cd426a3a3a4f..db0d6339c815 100644 --- a/include/libs/executor/storageapi.h +++ b/include/libs/executor/storageapi.h @@ -417,8 +417,8 @@ typedef struct SStateStore { SUpdateInfo** ppInfo); void (*updateInfoAddCloseWindowSBF)(SUpdateInfo* pInfo); void (*updateInfoDestoryColseWinSBF)(SUpdateInfo* pInfo); - int32_t (*updateInfoSerialize)(void* buf, int32_t bufLen, const SUpdateInfo* pInfo, int32_t* pLen); - int32_t (*updateInfoDeserialize)(void* buf, int32_t bufLen, SUpdateInfo* pInfo); + int32_t (*updateInfoSerialize)(SEncoder* pEncoder, const SUpdateInfo* pInfo); + int32_t (*updateInfoDeserialize)(SDecoder* pDeCoder, SUpdateInfo* pInfo); SStreamStateCur* (*streamStateSessionSeekKeyNext)(SStreamState* pState, const SSessionKey* key); SStreamStateCur* (*streamStateCountSeekKeyPrev)(SStreamState* pState, const SSessionKey* pKey, COUNT_TYPE count); diff --git a/include/libs/stream/tstreamUpdate.h b/include/libs/stream/tstreamUpdate.h index 06465e79e58a..32712736c2fc 100644 --- a/include/libs/stream/tstreamUpdate.h +++ b/include/libs/stream/tstreamUpdate.h @@ -36,8 +36,8 @@ bool updateInfoIsTableInserted(SUpdateInfo* pInfo, int64_t tbUid); void updateInfoDestroy(SUpdateInfo* pInfo); void updateInfoAddCloseWindowSBF(SUpdateInfo* pInfo); void updateInfoDestoryColseWinSBF(SUpdateInfo* pInfo); -int32_t updateInfoSerialize(void* buf, int32_t bufLen, const SUpdateInfo* pInfo, int32_t* pLen); -int32_t updateInfoDeserialize(void* buf, int32_t bufLen, SUpdateInfo* pInfo); +int32_t updateInfoSerialize(SEncoder* pEncoder, const SUpdateInfo* pInfo); +int32_t updateInfoDeserialize(SDecoder* pDeCoder, SUpdateInfo* pInfo); void windowSBfDelete(SUpdateInfo* pInfo, uint64_t count); int32_t windowSBfAdd(SUpdateInfo* pInfo, uint64_t count); bool isIncrementalTimeStamp(SUpdateInfo* pInfo, uint64_t tableId, TSKEY ts, void* pPkVal, int32_t len); diff --git a/source/libs/executor/inc/executorInt.h b/source/libs/executor/inc/executorInt.h index 26d59a90badb..aa7344758a9f 100644 --- a/source/libs/executor/inc/executorInt.h +++ b/source/libs/executor/inc/executorInt.h @@ -537,6 +537,7 @@ typedef struct SStreamScanInfo { int8_t pkColType; int32_t pkColLen; bool useGetResultRange; + STimeWindow lastScanRange; } SStreamScanInfo; typedef struct { diff --git a/source/libs/executor/src/executor.c b/source/libs/executor/src/executor.c index f3764f1fd827..a5211f2da0a8 100644 --- a/source/libs/executor/src/executor.c +++ b/source/libs/executor/src/executor.c @@ -1092,9 +1092,9 @@ int32_t qStreamRecoverFinish(qTaskInfo_t tinfo) { return code; } -static int32_t getOpratorIntervalInfo(SOperatorInfo* pOperator, int64_t* pWaterMark, SInterval* pInterval) { +static int32_t getOpratorIntervalInfo(SOperatorInfo* pOperator, int64_t* pWaterMark, SInterval* pInterval, STimeWindow* pLastWindow) { if (pOperator->operatorType != QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN) { - return getOpratorIntervalInfo(pOperator->pDownstream[0], pWaterMark, pInterval); + return getOpratorIntervalInfo(pOperator->pDownstream[0], pWaterMark, pInterval, pLastWindow); } SStreamScanInfo* pScanOp = (SStreamScanInfo*) pOperator->info; *pWaterMark = pScanOp->twAggSup.waterMark; @@ -1102,10 +1102,10 @@ static int32_t getOpratorIntervalInfo(SOperatorInfo* pOperator, int64_t* pWaterM return TSDB_CODE_SUCCESS; } -int32_t qGetStreamIntervalExecInfo(qTaskInfo_t tinfo, int64_t* pWaterMark, SInterval* pInterval) { +int32_t qGetStreamIntervalExecInfo(qTaskInfo_t tinfo, int64_t* pWaterMark, SInterval* pInterval, STimeWindow* pLastWindow) { SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo; SOperatorInfo* pOperator = pTaskInfo->pRoot; - return getOpratorIntervalInfo(pOperator, pWaterMark, pInterval); + return getOpratorIntervalInfo(pOperator, pWaterMark, pInterval, pLastWindow); } int32_t qSetStreamOperatorOptionForScanHistory(qTaskInfo_t tinfo) { diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index f10cb14686d4..32012c9fbb03 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -3313,31 +3313,78 @@ static int32_t doCheckUpdate(SStreamScanInfo* pInfo, TSKEY endKey, SSDataBlock* } int32_t streamScanOperatorEncode(SStreamScanInfo* pInfo, void** pBuff, int32_t* pLen) { - int32_t code = TSDB_CODE_SUCCESS; - int32_t lino = 0; - int32_t len = 0; - code = pInfo->stateStore.updateInfoSerialize(NULL, 0, pInfo->pUpdateInfo, &len); - QUERY_CHECK_CODE(code, lino, _end); + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; + int32_t len = 0; + SEncoder* pEnCoder = NULL; + SEncoder* pScanEnCoder = NULL; len += encodeSTimeWindowAggSupp(NULL, &pInfo->twAggSup); + SEncoder encoder = {0}; + pEnCoder = &encoder; + tEncoderInit(pEnCoder, NULL, 0); + if (tStartEncode(pEnCoder) != 0) { + code = TSDB_CODE_STREAM_INTERNAL_ERROR; + QUERY_CHECK_CODE(code, lino, _end); + } + code = pInfo->stateStore.updateInfoSerialize(pEnCoder, pInfo->pUpdateInfo); + QUERY_CHECK_CODE(code, lino, _end); + + if (tEncodeI64(pEnCoder, pInfo->lastScanRange.skey) < 0) { + code = TSDB_CODE_STREAM_INTERNAL_ERROR; + QUERY_CHECK_CODE(code, lino, _end); + } + if (tEncodeI64(pEnCoder, pInfo->lastScanRange.ekey) < 0) { + code = TSDB_CODE_STREAM_INTERNAL_ERROR; + QUERY_CHECK_CODE(code, lino, _end); + } + + tEndEncode(pEnCoder); + len += encoder.pos; + tEncoderClear(pEnCoder); + pEnCoder = NULL; + *pBuff = taosMemoryCalloc(1, len); if (!(*pBuff)) { code = terrno; QUERY_CHECK_CODE(code, lino, _end); } void* buf = *pBuff; - (void)encodeSTimeWindowAggSupp(&buf, &pInfo->twAggSup); + int32_t stwLen = encodeSTimeWindowAggSupp(&buf, &pInfo->twAggSup); - int32_t tmp = 0; - code = pInfo->stateStore.updateInfoSerialize(buf, len, pInfo->pUpdateInfo, &tmp); + SEncoder scanEncoder = {0}; + pScanEnCoder = &scanEncoder; + tEncoderInit(pScanEnCoder, buf, len - stwLen); + if (tStartEncode(pScanEnCoder) != 0) { + code = TSDB_CODE_FAILED; + QUERY_CHECK_CODE(code, lino, _end); + } + code = pInfo->stateStore.updateInfoSerialize(pScanEnCoder, pInfo->pUpdateInfo); QUERY_CHECK_CODE(code, lino, _end); + if (tEncodeI64(pScanEnCoder, pInfo->lastScanRange.skey) < 0) { + code = TSDB_CODE_STREAM_INTERNAL_ERROR; + QUERY_CHECK_CODE(code, lino, _end); + } + if (tEncodeI64(pScanEnCoder, pInfo->lastScanRange.ekey) < 0) { + code = TSDB_CODE_STREAM_INTERNAL_ERROR; + QUERY_CHECK_CODE(code, lino, _end); + } + *pLen = len; _end: if (code != TSDB_CODE_SUCCESS) { qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); } + if (pEnCoder != NULL) { + tEndEncode(pEnCoder); + tEncoderClear(pEnCoder); + } + if (pScanEnCoder != NULL) { + tEndEncode(pScanEnCoder); + tEncoderClear(pScanEnCoder); + } return code; } @@ -3366,28 +3413,70 @@ void streamScanOperatorSaveCheckpoint(SStreamScanInfo* pInfo) { // other properties are recovered from the execution plan void streamScanOperatorDecode(void* pBuff, int32_t len, SStreamScanInfo* pInfo) { + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; + SDecoder* pDeCoder = NULL; if (!pBuff || len == 0) { - return; + lino = __LINE__; + goto _end; } void* buf = pBuff; buf = decodeSTimeWindowAggSupp(buf, &pInfo->twAggSup); int32_t tlen = len - encodeSTimeWindowAggSupp(NULL, &pInfo->twAggSup); if (tlen == 0) { - return; + lino = __LINE__; + goto _end; } void* pUpInfo = taosMemoryCalloc(1, sizeof(SUpdateInfo)); if (!pUpInfo) { - return; + lino = __LINE__; + goto _end; } - int32_t code = pInfo->stateStore.updateInfoDeserialize(buf, tlen, pUpInfo); + SDecoder decoder = {0}; + pDeCoder = &decoder; + tDecoderInit(pDeCoder, buf, tlen); + if (tStartDecode(&decoder) < 0) { + lino = __LINE__; + goto _end; + } + + code = pInfo->stateStore.updateInfoDeserialize(pDeCoder, pUpInfo); if (code == TSDB_CODE_SUCCESS) { pInfo->stateStore.updateInfoDestroy(pInfo->pUpdateInfo); pInfo->pUpdateInfo = pUpInfo; } else { taosMemoryFree(pUpInfo); + lino = __LINE__; + goto _end; + } + + if (tDecodeIsEnd(pDeCoder)) { + lino = __LINE__; + goto _end; + } + + SET_WIN_KEY_INVALID(pInfo->lastScanRange.skey); + SET_WIN_KEY_INVALID(pInfo->lastScanRange.ekey); + + if (tDecodeI64(pDeCoder, &pInfo->lastScanRange.skey) < 0) { + lino = __LINE__; + goto _end; + } + + if (tDecodeI64(pDeCoder, &pInfo->lastScanRange.ekey) < 0) { + lino = __LINE__; + goto _end; + } + +_end: + if (pDeCoder != NULL) { + tEndDecode(pDeCoder); + tDecoderClear(pDeCoder); } + qInfo("%s end at line %d", __func__, lino); } + static bool hasScanRange(SStreamScanInfo* pInfo) { SStreamAggSupporter* pSup = pInfo->windowSup.pStreamAggSup; return pSup && pSup->pScanBlock->info.rows > 0 && (isStateWindow(pInfo) || isCountWindow(pInfo)); @@ -3634,6 +3723,7 @@ static int32_t doStreamScanNext(SOperatorInfo* pOperator, SSDataBlock** ppRes) { case STREAM_GET_RESULT: { pInfo->blockType = STREAM_INPUT__DATA_SUBMIT; pInfo->updateResIndex = 0; + pInfo->lastScanRange = pBlock->info.window; TSKEY endKey = taosTimeGetIntervalEnd(pBlock->info.window.skey, &pInfo->interval); if (pInfo->useGetResultRange == true) { endKey = pBlock->info.window.ekey; @@ -4141,6 +4231,8 @@ void streamScanReleaseState(SOperatorInfo* pOperator) { int32_t lino = 0; SStreamScanInfo* pInfo = pOperator->info; void* pBuff = NULL; + SEncoder* pEnCoder = NULL; + SEncoder* pScanEnCoder = NULL; if (!pInfo->pState) { return; } @@ -4148,18 +4240,36 @@ void streamScanReleaseState(SOperatorInfo* pOperator) { qDebug("stask:%s streamScanReleaseState cancel", GET_TASKID(pOperator->pTaskInfo)); return; } - int32_t len = 0; - code = pInfo->stateStore.updateInfoSerialize(NULL, 0, pInfo->pUpdateInfo, &len); + int32_t len = 0; + SEncoder encoder = {0}; + pEnCoder = &encoder; + tEncoderInit(pEnCoder, NULL, 0); + if (tStartEncode(pEnCoder) != 0) { + code = TSDB_CODE_FAILED; + QUERY_CHECK_CODE(code, lino, _end); + } + code = pInfo->stateStore.updateInfoSerialize(pEnCoder, pInfo->pUpdateInfo); QUERY_CHECK_CODE(code, lino, _end); + tEndEncode(pEnCoder); + len += encoder.pos; + tEncoderClear(pEnCoder); + pEnCoder = NULL; + pBuff = taosMemoryCalloc(1, len); if (!pBuff) { code = terrno; QUERY_CHECK_CODE(code, lino, _end); } - int32_t tmp = 0; - code = pInfo->stateStore.updateInfoSerialize(pBuff, len, pInfo->pUpdateInfo, &tmp); + SEncoder scanEncoder = {0}; + pScanEnCoder = &scanEncoder; + tEncoderInit(pScanEnCoder, pBuff, len); + if (tStartEncode(pScanEnCoder) != 0) { + code = TSDB_CODE_FAILED; + QUERY_CHECK_CODE(code, lino, _end); + } + code = pInfo->stateStore.updateInfoSerialize(pScanEnCoder, pInfo->pUpdateInfo); QUERY_CHECK_CODE(code, lino, _end); pInfo->stateStore.streamStateSaveInfo(pInfo->pState, STREAM_SCAN_OP_STATE_NAME, strlen(STREAM_SCAN_OP_STATE_NAME), @@ -4168,12 +4278,21 @@ void streamScanReleaseState(SOperatorInfo* pOperator) { if (code != TSDB_CODE_SUCCESS) { qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); } + if (pEnCoder != NULL) { + tEndEncode(pEnCoder); + tEncoderClear(pEnCoder); + } + if (pScanEnCoder != NULL) { + tEndEncode(pScanEnCoder); + tEncoderClear(pScanEnCoder); + } taosMemoryFree(pBuff); } void streamScanReloadState(SOperatorInfo* pOperator) { int32_t code = TSDB_CODE_SUCCESS; int32_t lino = 0; + SDecoder* pDeCoder = NULL; SStreamScanInfo* pInfo = pOperator->info; if (!pInfo->pState) { return; @@ -4194,7 +4313,10 @@ void streamScanReloadState(SOperatorInfo* pOperator) { QUERY_CHECK_CODE(code, lino, _end); } - int32_t winCode = pInfo->stateStore.updateInfoDeserialize(pBuff, len, pUpInfo); + SDecoder decoder = {0}; + pDeCoder = &decoder; + tDecoderInit(pDeCoder, pBuff, len); + int32_t winCode = pInfo->stateStore.updateInfoDeserialize(pDeCoder, pUpInfo); taosMemoryFree(pBuff); if (winCode == TSDB_CODE_SUCCESS && pInfo->pUpdateInfo) { if (pInfo->pUpdateInfo->minTS < 0) { @@ -4231,6 +4353,10 @@ void streamScanReloadState(SOperatorInfo* pOperator) { } _end: + if (pDeCoder != NULL) { + tEndDecode(pDeCoder); + tDecoderClear(pDeCoder); + } if (code != TSDB_CODE_SUCCESS) { qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); } diff --git a/source/libs/stream/src/streamSched.c b/source/libs/stream/src/streamSched.c index 82c5b07c599f..cfb033fb71fa 100644 --- a/source/libs/stream/src/streamSched.c +++ b/source/libs/stream/src/streamSched.c @@ -33,7 +33,8 @@ void streamSetupScheduleTrigger(SStreamTask* pTask) { if ((pTask->info.trigger == STREAM_TRIGGER_FORCE_WINDOW_CLOSE) && (pTask->info.taskLevel == TASK_LEVEL__SOURCE)) { int64_t waterMark = 0; SInterval interval = {0}; - code = qGetStreamIntervalExecInfo(pTask->exec.pExecutor, &waterMark, &interval); + STimeWindow lastTimeWindow = {0}; + code = qGetStreamIntervalExecInfo(pTask->exec.pExecutor, &waterMark, &interval, &lastTimeWindow); if (code) { stError("s-task:%s failed to init scheduler info, code:%s", id, tstrerror(code)); return; diff --git a/source/libs/stream/src/streamUpdate.c b/source/libs/stream/src/streamUpdate.c index 764045eed426..a3cfa00127be 100644 --- a/source/libs/stream/src/streamUpdate.c +++ b/source/libs/stream/src/streamUpdate.c @@ -441,76 +441,69 @@ void updateInfoDestoryColseWinSBF(SUpdateInfo* pInfo) { pInfo->pCloseWinSBF = NULL; } -int32_t updateInfoSerialize(void* buf, int32_t bufLen, const SUpdateInfo* pInfo, int32_t* pLen) { +int32_t updateInfoSerialize(SEncoder* pEncoder, const SUpdateInfo* pInfo) { int32_t code = TSDB_CODE_SUCCESS; int32_t lino = 0; if (!pInfo) { return TSDB_CODE_SUCCESS; } - SEncoder encoder = {0}; - tEncoderInit(&encoder, buf, bufLen); - if (tStartEncode(&encoder) != 0) { - code = TSDB_CODE_FAILED; - QUERY_CHECK_CODE(code, lino, _end); - } - int32_t size = taosArrayGetSize(pInfo->pTsBuckets); - if (tEncodeI32(&encoder, size) < 0) { + if (tEncodeI32(pEncoder, size) < 0) { code = TSDB_CODE_FAILED; QUERY_CHECK_CODE(code, lino, _end); } for (int32_t i = 0; i < size; i++) { TSKEY* pTs = (TSKEY*)taosArrayGet(pInfo->pTsBuckets, i); - if (tEncodeI64(&encoder, *pTs) < 0) { + if (tEncodeI64(pEncoder, *pTs) < 0) { code = TSDB_CODE_FAILED; QUERY_CHECK_CODE(code, lino, _end); } } - if (tEncodeU64(&encoder, pInfo->numBuckets) < 0) { + if (tEncodeU64(pEncoder, pInfo->numBuckets) < 0) { code = TSDB_CODE_FAILED; QUERY_CHECK_CODE(code, lino, _end); } int32_t sBfSize = taosArrayGetSize(pInfo->pTsSBFs); - if (tEncodeI32(&encoder, sBfSize) < 0) { + if (tEncodeI32(pEncoder, sBfSize) < 0) { code = TSDB_CODE_FAILED; QUERY_CHECK_CODE(code, lino, _end); } for (int32_t i = 0; i < sBfSize; i++) { SScalableBf* pSBf = taosArrayGetP(pInfo->pTsSBFs, i); - if (tScalableBfEncode(pSBf, &encoder) < 0) { + if (tScalableBfEncode(pSBf, pEncoder) < 0) { code = TSDB_CODE_FAILED; QUERY_CHECK_CODE(code, lino, _end); } } - if (tEncodeU64(&encoder, pInfo->numSBFs) < 0) { + if (tEncodeU64(pEncoder, pInfo->numSBFs) < 0) { code = TSDB_CODE_FAILED; QUERY_CHECK_CODE(code, lino, _end); } - if (tEncodeI64(&encoder, pInfo->interval) < 0) { + if (tEncodeI64(pEncoder, pInfo->interval) < 0) { code = TSDB_CODE_FAILED; QUERY_CHECK_CODE(code, lino, _end); } - if (tEncodeI64(&encoder, pInfo->watermark) < 0) { + if (tEncodeI64(pEncoder, pInfo->watermark) < 0) { code = TSDB_CODE_FAILED; QUERY_CHECK_CODE(code, lino, _end); } - if (tEncodeI64(&encoder, pInfo->minTS) < 0) { + if (tEncodeI64(pEncoder, pInfo->minTS) < 0) { code = TSDB_CODE_FAILED; QUERY_CHECK_CODE(code, lino, _end); } - if (tScalableBfEncode(pInfo->pCloseWinSBF, &encoder) < 0) { + if (tScalableBfEncode(pInfo->pCloseWinSBF, pEncoder) < 0) { code = TSDB_CODE_FAILED; QUERY_CHECK_CODE(code, lino, _end); } int32_t mapSize = taosHashGetSize(pInfo->pMap); - if (tEncodeI32(&encoder, mapSize) < 0) { + if (tEncodeI32(pEncoder, mapSize) < 0) { code = TSDB_CODE_FAILED; QUERY_CHECK_CODE(code, lino, _end); } @@ -518,60 +511,51 @@ int32_t updateInfoSerialize(void* buf, int32_t bufLen, const SUpdateInfo* pInfo, size_t keyLen = 0; while ((pIte = taosHashIterate(pInfo->pMap, pIte)) != NULL) { void* key = taosHashGetKey(pIte, &keyLen); - if (tEncodeU64(&encoder, *(uint64_t*)key) < 0) { + if (tEncodeU64(pEncoder, *(uint64_t*)key) < 0) { code = TSDB_CODE_FAILED; QUERY_CHECK_CODE(code, lino, _end); } int32_t valueSize = taosHashGetValueSize(pIte); - if (tEncodeBinary(&encoder, (const uint8_t*)pIte, valueSize) < 0) { + if (tEncodeBinary(pEncoder, (const uint8_t*)pIte, valueSize) < 0) { code = TSDB_CODE_FAILED; QUERY_CHECK_CODE(code, lino, _end); } } - if (tEncodeU64(&encoder, pInfo->maxDataVersion) < 0) { + if (tEncodeU64(pEncoder, pInfo->maxDataVersion) < 0) { code = TSDB_CODE_FAILED; QUERY_CHECK_CODE(code, lino, _end); } - if (tEncodeI32(&encoder, pInfo->pkColLen) < 0) { + if (tEncodeI32(pEncoder, pInfo->pkColLen) < 0) { code = TSDB_CODE_FAILED; QUERY_CHECK_CODE(code, lino, _end); } - if (tEncodeI8(&encoder, pInfo->pkColType) < 0) { + if (tEncodeI8(pEncoder, pInfo->pkColType) < 0) { code = TSDB_CODE_FAILED; QUERY_CHECK_CODE(code, lino, _end); } - tEndEncode(&encoder); - - int32_t tlen = encoder.pos; - *pLen = tlen; - _end: - tEncoderClear(&encoder); if (code != TSDB_CODE_SUCCESS) { uError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); } return code; } -int32_t updateInfoDeserialize(void* buf, int32_t bufLen, SUpdateInfo* pInfo) { +int32_t updateInfoDeserialize(SDecoder* pDeCoder, SUpdateInfo* pInfo) { int32_t code = TSDB_CODE_SUCCESS; int32_t lino = 0; QUERY_CHECK_NULL(pInfo, code, lino, _error, TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR); - SDecoder decoder = {0}; - tDecoderInit(&decoder, buf, bufLen); - if (tStartDecode(&decoder) < 0) return -1; - + int32_t size = 0; - if (tDecodeI32(&decoder, &size) < 0) return -1; + if (tDecodeI32(pDeCoder, &size) < 0) return -1; pInfo->pTsBuckets = taosArrayInit(size, sizeof(TSKEY)); QUERY_CHECK_NULL(pInfo->pTsBuckets, code, lino, _error, terrno); TSKEY ts = INT64_MIN; for (int32_t i = 0; i < size; i++) { - if (tDecodeI64(&decoder, &ts) < 0) return -1; + if (tDecodeI64(pDeCoder, &ts) < 0) return -1; void* tmp = taosArrayPush(pInfo->pTsBuckets, &ts); if (!tmp) { code = terrno; @@ -579,16 +563,16 @@ int32_t updateInfoDeserialize(void* buf, int32_t bufLen, SUpdateInfo* pInfo) { } } - if (tDecodeU64(&decoder, &pInfo->numBuckets) < 0) return -1; + if (tDecodeU64(pDeCoder, &pInfo->numBuckets) < 0) return -1; int32_t sBfSize = 0; - if (tDecodeI32(&decoder, &sBfSize) < 0) return -1; + if (tDecodeI32(pDeCoder, &sBfSize) < 0) return -1; pInfo->pTsSBFs = taosArrayInit(sBfSize, sizeof(void*)); QUERY_CHECK_NULL(pInfo->pTsSBFs, code, lino, _error, terrno); for (int32_t i = 0; i < sBfSize; i++) { SScalableBf* pSBf = NULL; - code = tScalableBfDecode(&decoder, &pSBf); + code = tScalableBfDecode(pDeCoder, &pSBf); QUERY_CHECK_CODE(code, lino, _error); void* tmp = taosArrayPush(pInfo->pTsSBFs, &pSBf); @@ -598,36 +582,36 @@ int32_t updateInfoDeserialize(void* buf, int32_t bufLen, SUpdateInfo* pInfo) { } } - if (tDecodeU64(&decoder, &pInfo->numSBFs) < 0) return -1; - if (tDecodeI64(&decoder, &pInfo->interval) < 0) return -1; - if (tDecodeI64(&decoder, &pInfo->watermark) < 0) return -1; - if (tDecodeI64(&decoder, &pInfo->minTS) < 0) return -1; + if (tDecodeU64(pDeCoder, &pInfo->numSBFs) < 0) return -1; + if (tDecodeI64(pDeCoder, &pInfo->interval) < 0) return -1; + if (tDecodeI64(pDeCoder, &pInfo->watermark) < 0) return -1; + if (tDecodeI64(pDeCoder, &pInfo->minTS) < 0) return -1; - code = tScalableBfDecode(&decoder, &pInfo->pCloseWinSBF); + code = tScalableBfDecode(pDeCoder, &pInfo->pCloseWinSBF); if (code != TSDB_CODE_SUCCESS) { pInfo->pCloseWinSBF = NULL; code = TSDB_CODE_SUCCESS; } int32_t mapSize = 0; - if (tDecodeI32(&decoder, &mapSize) < 0) return -1; + if (tDecodeI32(pDeCoder, &mapSize) < 0) return -1; _hash_fn_t hashFn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_UBIGINT); pInfo->pMap = taosHashInit(mapSize, hashFn, true, HASH_NO_LOCK); uint64_t uid = 0; void* pVal = NULL; uint32_t valSize = 0; for (int32_t i = 0; i < mapSize; i++) { - if (tDecodeU64(&decoder, &uid) < 0) return -1; - if (tDecodeBinary(&decoder, (uint8_t**)&pVal, &valSize) < 0) return -1; + if (tDecodeU64(pDeCoder, &uid) < 0) return -1; + if (tDecodeBinary(pDeCoder, (uint8_t**)&pVal, &valSize) < 0) return -1; code = taosHashPut(pInfo->pMap, &uid, sizeof(uint64_t), pVal, valSize); QUERY_CHECK_CODE(code, lino, _error); } QUERY_CHECK_CONDITION((mapSize == taosHashGetSize(pInfo->pMap)), code, lino, _error, TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR); - if (tDecodeU64(&decoder, &pInfo->maxDataVersion) < 0) return -1; + if (tDecodeU64(pDeCoder, &pInfo->maxDataVersion) < 0) return -1; - if (tDecodeI32(&decoder, &pInfo->pkColLen) < 0) return -1; - if (tDecodeI8(&decoder, &pInfo->pkColType) < 0) return -1; + if (tDecodeI32(pDeCoder, &pInfo->pkColLen) < 0) return -1; + if (tDecodeI8(pDeCoder, &pInfo->pkColType) < 0) return -1; pInfo->pKeyBuff = taosMemoryCalloc(1, sizeof(TSKEY) + sizeof(int64_t) + pInfo->pkColLen); QUERY_CHECK_NULL(pInfo->pKeyBuff, code, lino, _error, terrno); @@ -643,10 +627,6 @@ int32_t updateInfoDeserialize(void* buf, int32_t bufLen, SUpdateInfo* pInfo) { pInfo->comparePkCol = NULL; } - tEndDecode(&decoder); - - tDecoderClear(&decoder); - _error: if (code != TSDB_CODE_SUCCESS) { uError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); From f40a760f1c8f90a93b8fb15a38c756b2c4eb4a02 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Fri, 18 Oct 2024 15:46:38 +0800 Subject: [PATCH 151/695] fix(stream):modify error message --- source/libs/parser/src/parTranslater.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 4c9c55945785..bea781cc925b 100755 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -10617,7 +10617,7 @@ static int32_t checkStreamQuery(STranslateContext* pCxt, SCreateStreamStmt* pStm parseNatualDuration(str, strlen(str), &minDelay, &pVal->unit, pVal->node.resType.precision, false)) { if (pVal->datum.i < minDelay) { return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY, - "stream max delay must be bigger than 5 session"); + "stream max delay must be bigger than 5 seconds"); } } } From 7a3f1afe68939b05477ba02063bc8105527176e4 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Fri, 18 Oct 2024 16:08:22 +0800 Subject: [PATCH 152/695] fix issue --- source/libs/executor/src/scanoperator.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 32012c9fbb03..392cb8f5c7ae 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -3436,7 +3436,7 @@ void streamScanOperatorDecode(void* pBuff, int32_t len, SStreamScanInfo* pInfo) SDecoder decoder = {0}; pDeCoder = &decoder; tDecoderInit(pDeCoder, buf, tlen); - if (tStartDecode(&decoder) < 0) { + if (tStartDecode(pDeCoder) < 0) { lino = __LINE__; goto _end; } @@ -4316,6 +4316,10 @@ void streamScanReloadState(SOperatorInfo* pOperator) { SDecoder decoder = {0}; pDeCoder = &decoder; tDecoderInit(pDeCoder, pBuff, len); + if (tStartDecode(pDeCoder) < 0) { + lino = __LINE__; + goto _end; + } int32_t winCode = pInfo->stateStore.updateInfoDeserialize(pDeCoder, pUpInfo); taosMemoryFree(pBuff); if (winCode == TSDB_CODE_SUCCESS && pInfo->pUpdateInfo) { From 936efc7529f700bb097508ce77be9b17f7da0b84 Mon Sep 17 00:00:00 2001 From: qevolg <2227465945@qq.com> Date: Fri, 18 Oct 2024 16:43:41 +0800 Subject: [PATCH 153/695] refactor(*): modify the position of IsEnterprise --- tools/keeper/infrastructure/config/config.go | 4 +--- tools/keeper/system/program.go | 4 ++-- tools/keeper/version/version.go | 2 ++ 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/keeper/infrastructure/config/config.go b/tools/keeper/infrastructure/config/config.go index f4bbe1b274de..d3e884ba8f9c 100644 --- a/tools/keeper/infrastructure/config/config.go +++ b/tools/keeper/infrastructure/config/config.go @@ -14,8 +14,6 @@ import ( "github.com/taosdata/taoskeeper/version" ) -var IsEnterprise = "false" - var Name = fmt.Sprintf("%skeeper", version.CUS_PROMPT) const ReqIDKey = "QID" @@ -228,7 +226,7 @@ func init() { initLog() - if IsEnterprise == "true" { + if version.IsEnterprise == "true" { initAudit() } } diff --git a/tools/keeper/system/program.go b/tools/keeper/system/program.go index 437da68f08d6..b8f1d8943fec 100644 --- a/tools/keeper/system/program.go +++ b/tools/keeper/system/program.go @@ -48,7 +48,7 @@ func Init() *http.Server { node := api.NewNodeExporter(processor) node.Init(router) - if config.IsEnterprise == "true" { + if version.IsEnterprise == "true" { zabbix := api.NewZabbix(processor) zabbix.Init(router) } @@ -57,7 +57,7 @@ func Init() *http.Server { checkHealth := api.NewCheckHealth(version.Version) checkHealth.Init(router) - if config.IsEnterprise == "true" { + if version.IsEnterprise == "true" { if conf.Audit.Enable { audit, err := api.NewAudit(conf) if err != nil { diff --git a/tools/keeper/version/version.go b/tools/keeper/version/version.go index a9e33f402b4d..c29a40c58e74 100644 --- a/tools/keeper/version/version.go +++ b/tools/keeper/version/version.go @@ -7,3 +7,5 @@ var CommitID = "unknown" var CUS_NAME = "TDengine" var CUS_PROMPT = "taos" + +var IsEnterprise = "false" From 904d738d7e93fe6bd3bc49c8e2a4a3277497af88 Mon Sep 17 00:00:00 2001 From: qevolg <2227465945@qq.com> Date: Fri, 18 Oct 2024 16:46:19 +0800 Subject: [PATCH 154/695] chore(*): add taoskeeper build process --- cmake/cmake.define | 13 ++++++ packaging/tools/make_install.sh | 72 +++++++++++++++++++++++++++++++++ tools/CMakeLists.txt | 46 +++++++++++++++++++++ 3 files changed, 131 insertions(+) diff --git a/cmake/cmake.define b/cmake/cmake.define index eb78b54caeaf..52b8a66a4a5e 100644 --- a/cmake/cmake.define +++ b/cmake/cmake.define @@ -57,6 +57,19 @@ IF (TD_BUILD_HTTP) ADD_DEFINITIONS(-DHTTP_EMBEDDED) ENDIF () +IF ("${BUILD_KEEPER}" STREQUAL "") + SET(TD_BUILD_KEEPER FALSE) +ELSEIF (${BUILD_KEEPER} MATCHES "false") + SET(TD_BUILD_KEEPER FALSE) +ELSEIF (${BUILD_KEEPER} MATCHES "true") + SET(TD_BUILD_KEEPER TRUE) +ELSEIF (${BUILD_KEEPER} MATCHES "internal") + SET(TD_BUILD_KEEPER FALSE) + SET(TD_BUILD_KEEPER_INTERNAL TRUE) +ELSE () + SET(TD_BUILD_KEEPER FALSE) +ENDIF () + IF ("${BUILD_TOOLS}" STREQUAL "") IF (TD_LINUX) IF (TD_ARM_32) diff --git a/packaging/tools/make_install.sh b/packaging/tools/make_install.sh index ea19125bf577..193ec4f9d0c0 100755 --- a/packaging/tools/make_install.sh +++ b/packaging/tools/make_install.sh @@ -129,6 +129,13 @@ function kill_taosadapter() { fi } +function kill_taoskeeper() { + pid=$(ps -ef | grep "taoskeeper" | grep -v "grep" | awk '{print $2}') + if [ -n "$pid" ]; then + ${csudo}kill -9 $pid || : + fi +} + function kill_taosd() { pid=$(ps -ef | grep -w ${serverName} | grep -v "grep" | awk '{print $2}') if [ -n "$pid" ]; then @@ -155,6 +162,7 @@ function install_bin() { ${csudo}rm -f ${bin_link_dir}/${clientName} || : ${csudo}rm -f ${bin_link_dir}/${serverName} || : ${csudo}rm -f ${bin_link_dir}/taosadapter || : + ${csudo}rm -f ${bin_link_dir}/taoskeeper || : ${csudo}rm -f ${bin_link_dir}/udfd || : ${csudo}rm -f ${bin_link_dir}/taosdemo || : ${csudo}rm -f ${bin_link_dir}/taosdump || : @@ -169,6 +177,7 @@ function install_bin() { [ -f ${install_main_dir}/bin/taosBenchmark ] && ${csudo}ln -sf ${install_main_dir}/bin/taosBenchmark ${install_main_dir}/bin/taosdemo > /dev/null 2>&1 || : [ -f ${binary_dir}/build/bin/taosdump ] && ${csudo}cp -r ${binary_dir}/build/bin/taosdump ${install_main_dir}/bin || : [ -f ${binary_dir}/build/bin/taosadapter ] && ${csudo}cp -r ${binary_dir}/build/bin/taosadapter ${install_main_dir}/bin || : + [ -f ${binary_dir}/build/bin/taoskeeper ] && ${csudo}cp -r ${binary_dir}/build/bin/taoskeeper ${install_main_dir}/bin || : [ -f ${binary_dir}/build/bin/udfd ] && ${csudo}cp -r ${binary_dir}/build/bin/udfd ${install_main_dir}/bin || : [ -f ${binary_dir}/build/bin/taosx ] && ${csudo}cp -r ${binary_dir}/build/bin/taosx ${install_main_dir}/bin || : ${csudo}cp -r ${binary_dir}/build/bin/${serverName} ${install_main_dir}/bin || : @@ -183,6 +192,7 @@ function install_bin() { [ -x ${install_main_dir}/bin/${clientName} ] && ${csudo}ln -s ${install_main_dir}/bin/${clientName} ${bin_link_dir}/${clientName} > /dev/null 2>&1 || : [ -x ${install_main_dir}/bin/${serverName} ] && ${csudo}ln -s ${install_main_dir}/bin/${serverName} ${bin_link_dir}/${serverName} > /dev/null 2>&1 || : [ -x ${install_main_dir}/bin/taosadapter ] && ${csudo}ln -s ${install_main_dir}/bin/taosadapter ${bin_link_dir}/taosadapter > /dev/null 2>&1 || : + [ -x ${install_main_dir}/bin/taoskeeper ] && ${csudo}ln -s ${install_main_dir}/bin/taoskeeper ${bin_link_dir}/taoskeeper > /dev/null 2>&1 || : [ -x ${install_main_dir}/bin/udfd ] && ${csudo}ln -s ${install_main_dir}/bin/udfd ${bin_link_dir}/udfd > /dev/null 2>&1 || : [ -x ${install_main_dir}/bin/taosdump ] && ${csudo}ln -s ${install_main_dir}/bin/taosdump ${bin_link_dir}/taosdump > /dev/null 2>&1 || : [ -x ${install_main_dir}/bin/taosdemo ] && ${csudo}ln -s ${install_main_dir}/bin/taosdemo ${bin_link_dir}/taosdemo > /dev/null 2>&1 || : @@ -197,6 +207,7 @@ function install_bin() { [ -f ${install_main_dir}/bin/taosBenchmark ] && ${csudo}ln -sf ${install_main_dir}/bin/taosBenchmark ${install_main_dir}/bin/taosdemo > /dev/null 2>&1 || : [ -f ${binary_dir}/build/bin/taosdump ] && ${csudo}cp -r ${binary_dir}/build/bin/taosdump ${install_main_dir}/bin || : [ -f ${binary_dir}/build/bin/taosadapter ] && ${csudo}cp -r ${binary_dir}/build/bin/taosadapter ${install_main_dir}/bin || : + [ -f ${binary_dir}/build/bin/taoskeeper ] && ${csudo}cp -r ${binary_dir}/build/bin/taoskeeper ${install_main_dir}/bin || : [ -f ${binary_dir}/build/bin/udfd ] && ${csudo}cp -r ${binary_dir}/build/bin/udfd ${install_main_dir}/bin || : [ -f ${binary_dir}/build/bin/taosx ] && ${csudo}cp -r ${binary_dir}/build/bin/taosx ${install_main_dir}/bin || : [ -f ${binary_dir}/build/bin/*explorer ] && ${csudo}cp -r ${binary_dir}/build/bin/*explorer ${install_main_dir}/bin || : @@ -208,6 +219,7 @@ function install_bin() { [ -x ${install_main_dir}/bin/${clientName} ] && ${csudo}ln -s ${install_main_dir}/bin/${clientName} ${bin_link_dir}/${clientName} > /dev/null 2>&1 || : [ -x ${install_main_dir}/bin/${serverName} ] && ${csudo}ln -s ${install_main_dir}/bin/${serverName} ${bin_link_dir}/${serverName} > /dev/null 2>&1 || : [ -x ${install_main_dir}/bin/taosadapter ] && ${csudo}ln -s ${install_main_dir}/bin/taosadapter ${bin_link_dir}/taosadapter > /dev/null 2>&1 || : + [ -x ${install_main_dir}/bin/taoskeeper ] && ${csudo}ln -s ${install_main_dir}/bin/taoskeeper ${bin_link_dir}/taoskeeper > /dev/null 2>&1 || : [ -x ${install_main_dir}/bin/udfd ] && ${csudo}ln -s ${install_main_dir}/bin/udfd ${bin_link_dir}/udfd > /dev/null 2>&1 || : [ -x ${install_main_dir}/bin/taosdump ] && ${csudo}ln -s ${install_main_dir}/bin/taosdump ${bin_link_dir}/taosdump > /dev/null 2>&1 || : [ -f ${install_main_dir}/bin/taosBenchmark ] && ${csudo}ln -sf ${install_main_dir}/bin/taosBenchmark ${install_main_dir}/bin/taosdemo > /dev/null 2>&1 || : @@ -407,6 +419,29 @@ function install_taosadapter_config() { fi } +function install_taoskeeper_config() { + if [ ! -f "${cfg_install_dir}/taoskeeper.toml" ]; then + ${csudo}mkdir -p ${cfg_install_dir} || : + [ -f ${binary_dir}/test/cfg/taoskeeper.toml ] && + ${csudo}cp ${binary_dir}/test/cfg/taoskeeper.toml ${cfg_install_dir} && + ${csudo}cp ${binary_dir}/test/cfg/taoskeeper.toml ${cfg_dir} || : + [ -f ${cfg_install_dir}/taoskeeper.toml ] && + ${csudo}chmod 644 ${cfg_install_dir}/taoskeeper.toml || : + [ -f ${binary_dir}/test/cfg/taoskeeper.toml ] && + ${csudo}cp -f ${binary_dir}/test/cfg/taoskeeper.toml \ + ${cfg_install_dir}/taoskeeper.toml.${verNumber} || : + [ -f ${cfg_install_dir}/taoskeeper.toml ] && + ${csudo}ln -s ${cfg_install_dir}/taoskeeper.toml \ + ${install_main_dir}/cfg/taoskeeper.toml > /dev/null 2>&1 || : + else + if [ -f "${binary_dir}/test/cfg/taoskeeper.toml" ]; then + ${csudo}cp -f ${binary_dir}/test/cfg/taoskeeper.toml \ + ${cfg_install_dir}/taoskeeper.toml.${verNumber} || : + ${csudo}cp -f ${binary_dir}/test/cfg/taoskeeper.toml ${cfg_dir} || : + fi + fi +} + function install_log() { ${csudo}rm -rf ${log_dir} || : ${csudo}mkdir -p ${log_dir} && ${csudo}chmod 777 ${log_dir} @@ -526,6 +561,15 @@ function install_taosadapter_service() { fi } +function install_taoskeeper_service() { + if ((${service_mod} == 0)); then + [ -f ${binary_dir}/test/cfg/taoskeeper.service ] && + ${csudo}cp ${binary_dir}/test/cfg/taoskeeper.service \ + ${service_config_dir}/ || : + ${csudo}systemctl daemon-reload + fi +} + function install_service_on_launchctl() { ${csudo}launchctl unload -w /Library/LaunchDaemons/com.taosdata.taosd.plist > /dev/null 2>&1 || : ${csudo}cp ${script_dir}/com.taosdata.taosd.plist /Library/LaunchDaemons/com.taosdata.taosd.plist @@ -534,6 +578,10 @@ function install_service_on_launchctl() { ${csudo}launchctl unload -w /Library/LaunchDaemons/com.taosdata.taosadapter.plist > /dev/null 2>&1 || : ${csudo}cp ${script_dir}/com.taosdata.taosadapter.plist /Library/LaunchDaemons/com.taosdata.taosadapter.plist ${csudo}launchctl load -w /Library/LaunchDaemons/com.taosdata.taosadapter.plist > /dev/null 2>&1 || : + + ${csudo}launchctl unload -w /Library/LaunchDaemons/com.taosdata.taoskeeper.plist > /dev/null 2>&1 || : + ${csudo}cp ${script_dir}/com.taosdata.taoskeeper.plist /Library/LaunchDaemons/com.taosdata.taoskeeper.plist + ${csudo}launchctl load -w /Library/LaunchDaemons/com.taosdata.taoskeeper.plist > /dev/null 2>&1 || : } function install_service() { @@ -549,6 +597,7 @@ function install_service() { install_service_on_launchctl fi } + function install_app() { if [ "$osType" = "Darwin" ]; then ${csudo}rm -rf /Applications/TDengine.app && @@ -573,6 +622,7 @@ function update_TDengine() { elif ((${service_mod} == 1)); then ${csudo}service ${serverName} stop || : else + kill_taoskeeper kill_taosadapter kill_taosd fi @@ -591,9 +641,11 @@ function update_TDengine() { install_service install_taosadapter_service + install_taoskeeper_service install_config install_taosadapter_config + install_taoskeeper_service echo echo -e "\033[44;32;1m${productName} is updated successfully!${NC}" @@ -602,22 +654,31 @@ function update_TDengine() { echo -e "${GREEN_DARK}To configure ${productName} ${NC}: edit ${configDir}/${configFile}" [ -f ${configDir}/taosadapter.toml ] && [ -f ${installDir}/bin/taosadapter ] && \ echo -e "${GREEN_DARK}To configure Adapter ${NC}: edit ${configDir}/taosadapter.toml" + [ -f ${configDir}/taoskeeper.toml ] && [ -f ${installDir}/bin/taoskeeper ] && \ + echo -e "${GREEN_DARK}To configure Keeper ${NC}: edit ${configDir}/taoskeeper.toml" if ((${service_mod} == 0)); then echo -e "${GREEN_DARK}To start ${productName} ${NC}: ${csudo}systemctl start ${serverName}${NC}" [ -f ${service_config_dir}/taosadapter.service ] && [ -f ${installDir}/bin/taosadapter ] && \ echo -e "${GREEN_DARK}To start Adapter ${NC}: ${csudo}systemctl start taosadapter ${NC}" + [ -f ${service_config_dir}/taoskeeper.service ] && [ -f ${installDir}/bin/taoskeeper ] && \ + echo -e "${GREEN_DARK}To start Keeper ${NC}: ${csudo}systemctl start taoskeeper ${NC}" elif ((${service_mod} == 1)); then echo -e "${GREEN_DARK}To start ${productName} ${NC}: ${csudo}service ${serverName} start${NC}" [ -f ${service_config_dir}/taosadapter.service ] && [ -f ${installDir}/bin/taosadapter ] && \ echo -e "${GREEN_DARK}To start Adapter ${NC}: ${csudo}service taosadapter start${NC}" + [ -f ${service_config_dir}/taoskeeper.service ] && [ -f ${installDir}/bin/taoskeeper ] && \ + echo -e "${GREEN_DARK}To start Keeper ${NC}: ${csudo}service taoskeeper start${NC}" else if [ "$osType" != "Darwin" ]; then echo -e "${GREEN_DARK}To start ${productName} ${NC}: ${serverName}${NC}" [ -f ${installDir}/bin/taosadapter ] && \ echo -e "${GREEN_DARK}To start Adapter ${NC}: taosadapter &${NC}" + [ -f ${installDir}/bin/taoskeeper ] && \ + echo -e "${GREEN_DARK}To start Keeper ${NC}: taoskeeper &${NC}" else echo -e "${GREEN_DARK}To start service ${NC}: launchctl start com.tdengine.taosd${NC}" echo -e "${GREEN_DARK}To start Adapter ${NC}: launchctl start com.tdengine.taosadapter${NC}" + echo -e "${GREEN_DARK}To start Keeper ${NC}: launchctl start com.tdengine.taoskeeper${NC}" fi fi @@ -643,9 +704,11 @@ function install_TDengine() { install_service install_taosadapter_service + install_taoskeeper_service install_config install_taosadapter_config + install_taoskeeper_config # Ask if to start the service echo @@ -654,22 +717,31 @@ function install_TDengine() { echo -e "${GREEN_DARK}To configure ${productName} ${NC}: edit ${configDir}/${configFile}" [ -f ${configDir}/taosadapter.toml ] && [ -f ${installDir}/bin/taosadapter ] && \ echo -e "${GREEN_DARK}To configure Adapter ${NC}: edit ${configDir}/taosadapter.toml" + [ -f ${configDir}/taoskeeper.toml ] && [ -f ${installDir}/bin/taoskeeper ] && \ + echo -e "${GREEN_DARK}To configure Keeper ${NC}: edit ${configDir}/taoskeeper.toml" if ((${service_mod} == 0)); then echo -e "${GREEN_DARK}To start ${productName} ${NC}: ${csudo}systemctl start ${serverName}${NC}" [ -f ${service_config_dir}/taosadapter.service ] && [ -f ${installDir}/bin/taosadapter ] && \ echo -e "${GREEN_DARK}To start Adapter ${NC}: ${csudo}systemctl start taosadapter ${NC}" + [ -f ${service_config_dir}/taoskeeper.service ] && [ -f ${installDir}/bin/taoskeeper ] && \ + echo -e "${GREEN_DARK}To start Keeper ${NC}: ${csudo}systemctl start taoskeeper ${NC}" elif ((${service_mod} == 1)); then echo -e "${GREEN_DARK}To start ${productName} ${NC}: ${csudo}service ${serverName} start${NC}" [ -f ${service_config_dir}/taosadapter.service ] && [ -f ${installDir}/bin/taosadapter ] && \ echo -e "${GREEN_DARK}To start Adapter ${NC}: ${csudo}service taosadapter start${NC}" + [ -f ${service_config_dir}/taoskeeper.service ] && [ -f ${installDir}/bin/taoskeeper ] && \ + echo -e "${GREEN_DARK}To start Keeper ${NC}: ${csudo}service taoskeeper start${NC}" else if [ "$osType" != "Darwin" ]; then echo -e "${GREEN_DARK}To start ${productName} ${NC}: ${serverName}${NC}" [ -f ${installDir}/bin/taosadapter ] && \ echo -e "${GREEN_DARK}To start Adapter ${NC}: taosadapter &${NC}" + [ -f ${installDir}/bin/taoskeeper ] && \ + echo -e "${GREEN_DARK}To start Keeper ${NC}: taoskeeper &${NC}" else echo -e "${GREEN_DARK}To start service ${NC}: launchctl start com.tdengine.taosd${NC}" echo -e "${GREEN_DARK}To start Adapter ${NC}: launchctl start com.tdengine.taosadapter${NC}" + echo -e "${GREEN_DARK}To start Keeper ${NC}: launchctl start com.tdengine.taoskeeper${NC}" fi fi diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index a16a03d30ab4..832bd68899dd 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -208,3 +208,49 @@ ELSE () ) ENDIF () ENDIF () + +IF(TD_BUILD_KEEPER) + MESSAGE("") + MESSAGE("${Green} build taoskeeper, current platform is ${PLATFORM_ARCH_STR} ${ColourReset}") + + EXECUTE_PROCESS( + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/keeper + COMMAND git rev-parse HEAD + OUTPUT_VARIABLE taoskeeper_commit_sha1 + ) + + IF("${taoskeeper_commit_sha1}" STREQUAL "") + SET(taoskeeper_commit_sha1 "unknown") + ELSE() + STRING(STRIP "${taoskeeper_commit_sha1}" taoskeeper_commit_sha1) + ENDIF() + + SET(taos_version ${TD_VER_NUMBER}) + MESSAGE("${Green} taoskeeper will use ${taos_version} and commit ${taoskeeper_commit_sha1} as version ${ColourReset}") + MESSAGE(" current source dir is ${CMAKE_CURRENT_SOURCE_DIR}") + + IF(TD_LINUX) + MESSAGE("Building taoskeeper on Linux") + INCLUDE(ExternalProject) + ExternalProject_Add(taoskeeper + PREFIX "taoskeeper" + SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/keeper + BUILD_ALWAYS off + BUILD_IN_SOURCE 1 + CONFIGURE_COMMAND cmake -E echo "taoskeeper no need cmake to config" + PATCH_COMMAND + COMMAND git clean -f -d + BUILD_COMMAND + COMMAND go build -a -ldflags "-X 'github.com/taosdata/taoskeeper/version.Version=${taos_version}' -X 'github.com/taosdata/taoskeeper/version.CommitID=${taoskeeper_commit_sha1}' -X 'github.com/taosdata/taoskeeper/version.BuildInfo=${TD_VER_OSTYPE}-${TD_VER_CPUTYPE} ${TD_VER_DATE}'" + INSTALL_COMMAND + COMMAND cmake -E echo "Copy taoskeeper" + COMMAND cmake -E copy taoskeeper ${CMAKE_BINARY_DIR}/build/bin + COMMAND cmake -E make_directory ${CMAKE_BINARY_DIR}/test/cfg/ + COMMAND cmake -E echo "Copy taoskeeper.toml" + COMMAND cmake -E copy ./config/taoskeeper.toml ${CMAKE_BINARY_DIR}/test/cfg/ + COMMAND cmake -E copy ./taoskeeper.service ${CMAKE_BINARY_DIR}/test/cfg/ + ) + ENDIF() +ELSEIF(TD_BUILD_KEEPER_INTERNAL) + MESSAGE("${Yellow} use taoskeeper internal ${ColourReset}") +ENDIF() From 399e2429f45b7a2052aeb845eb15241a9f724593 Mon Sep 17 00:00:00 2001 From: qevolg <2227465945@qq.com> Date: Fri, 18 Oct 2024 16:56:41 +0800 Subject: [PATCH 155/695] chore(packaging): add taoskeeper --- packaging/tools/make_install.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packaging/tools/make_install.sh b/packaging/tools/make_install.sh index c0e42e3ceba5..f395909d382b 100755 --- a/packaging/tools/make_install.sh +++ b/packaging/tools/make_install.sh @@ -678,6 +678,7 @@ function update_TDengine() { else echo -e "${GREEN_DARK}To start service ${NC}: sudo launchctl start com.tdengine.taosd${NC}" echo -e "${GREEN_DARK}To start Adapter ${NC}: sudo launchctl start com.tdengine.taosadapter${NC}" + echo -e "${GREEN_DARK}To start Keeper ${NC}: sudo launchctl start com.tdengine.taoskeeper${NC}" fi fi @@ -740,6 +741,7 @@ function install_TDengine() { else echo -e "${GREEN_DARK}To start service ${NC}: sudo launchctl start com.tdengine.taosd${NC}" echo -e "${GREEN_DARK}To start Adapter ${NC}: sudo launchctl start com.tdengine.taosadapter${NC}" + echo -e "${GREEN_DARK}To start Keeper ${NC}: sudo launchctl start com.tdengine.taoskeeper${NC}" fi fi From 51c7f8b4f003804990d3bb02dfe09cb2858b5973 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Fri, 18 Oct 2024 17:36:57 +0800 Subject: [PATCH 156/695] enh:[TS-5441] cost too long in tmq write meta data by cache meta and vg info --- source/client/src/clientRawBlockWrite.c | 307 ++++++++++++++---------- 1 file changed, 183 insertions(+), 124 deletions(-) diff --git a/source/client/src/clientRawBlockWrite.c b/source/client/src/clientRawBlockWrite.c index 206bc63d1923..eb4eed8b6d65 100644 --- a/source/client/src/clientRawBlockWrite.c +++ b/source/client/src/clientRawBlockWrite.c @@ -888,9 +888,6 @@ static void processDropTable(SMqMetaRsp* metaRsp, cJSON** pJson) { } static int32_t taosCreateStb(TAOS* taos, void* meta, int32_t metaLen) { - if (taos == NULL || meta == NULL) { - return TSDB_CODE_INVALID_PARA; - } SVCreateStbReq req = {0}; SDecoder coder; SMCreateStbReq pReq = {0}; @@ -1001,9 +998,6 @@ static int32_t taosCreateStb(TAOS* taos, void* meta, int32_t metaLen) { } static int32_t taosDropStb(TAOS* taos, void* meta, int32_t metaLen) { - if (taos == NULL || meta == NULL) { - return TSDB_CODE_INVALID_PARA; - } SVDropStbReq req = {0}; SDecoder coder = {0}; SMDropStbReq pReq = {0}; @@ -1113,9 +1107,6 @@ static void destroyCreateTbReqBatch(void* data) { } static int32_t taosCreateTable(TAOS* taos, void* meta, int32_t metaLen) { - if (taos == NULL || meta == NULL) { - return TSDB_CODE_INVALID_PARA; - } SVCreateTbBatchReq req = {0}; SDecoder coder = {0}; int32_t code = TSDB_CODE_SUCCESS; @@ -1302,9 +1293,6 @@ static void destroyDropTbReqBatch(void* data) { } static int32_t taosDropTable(TAOS* taos, void* meta, int32_t metaLen) { - if (taos == NULL || meta == NULL) { - return TSDB_CODE_INVALID_PARA; - } SVDropTbBatchReq req = {0}; SDecoder coder = {0}; int32_t code = TSDB_CODE_SUCCESS; @@ -1417,9 +1405,6 @@ static int32_t taosDropTable(TAOS* taos, void* meta, int32_t metaLen) { } static int32_t taosDeleteData(TAOS* taos, void* meta, int32_t metaLen) { - if (taos == NULL || meta == NULL) { - return TSDB_CODE_INVALID_PARA; - } SDeleteRes req = {0}; SDecoder coder = {0}; char sql[256] = {0}; @@ -1455,9 +1440,6 @@ static int32_t taosDeleteData(TAOS* taos, void* meta, int32_t metaLen) { } static int32_t taosAlterTable(TAOS* taos, void* meta, int32_t metaLen) { - if (taos == NULL || meta == NULL) { - return TSDB_CODE_INVALID_PARA; - } SVAlterTbReq req = {0}; SDecoder dcoder = {0}; int32_t code = TSDB_CODE_SUCCESS; @@ -1771,7 +1753,7 @@ static void freeRawCache(void *data) { static int32_t initRawCacheHash(){ if (writeRawCache == NULL){ - writeRawCache = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_NO_LOCK); + writeRawCache = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_ENTRY_LOCK); if (writeRawCache == NULL){ return terrno; } @@ -1844,57 +1826,113 @@ static int32_t getRawCache(SHashObj **pVgHash, SHashObj **pNameHash, SHashObj ** return code; } -static int32_t tmqWriteRawImpl(TAOS* taos, uint16_t type, void* data, int32_t dataLen) { - if (taos == NULL || data == NULL) { - SET_ERROR_MSG("taos:%p or data:%p is NULL", taos, data); - return TSDB_CODE_INVALID_PARA; +static int32_t buildRawRequest(TAOS* taos, SRequestObj** pRequest, SCatalog** pCatalog, SRequestConnInfo *conn){ + int32_t code = 0; + RAW_RETURN_CHECK(createRequest(*(int64_t*)taos, TSDB_SQL_INSERT, 0, pRequest)); + (*pRequest)->syncQuery = true; + if (!(*pRequest)->pDb) { + code = TSDB_CODE_PAR_DB_NOT_SPECIFIED; + goto end; } - int32_t code = TSDB_CODE_SUCCESS; - SQuery* pQuery = NULL; - SMqRspObj rspObj = {0}; - SDecoder decoder = {0}; - SHashObj* pCreateTbHash = NULL; - SRequestObj* pRequest = NULL; - RAW_RETURN_CHECK(createRequest(*(int64_t*)taos, TSDB_SQL_INSERT, 0, &pRequest)); - uDebug(LOG_ID_TAG " write raw metadata, data:%p, dataLen:%d", LOG_ID_VALUE, data, dataLen); - pRequest->syncQuery = true; - rspObj.resIter = -1; -// rspObj.resType = RES_TYPE__TMQ_METADATA; + RAW_RETURN_CHECK(catalogGetHandle((*pRequest)->pTscObj->pAppInfo->clusterId, pCatalog)); + conn->pTrans = (*pRequest)->pTscObj->pAppInfo->pTransporter; + conn->requestId = (*pRequest)->requestId; + conn->requestObjRefId = (*pRequest)->self; + conn->mgmtEps = getEpSet_s(&(*pRequest)->pTscObj->pAppInfo->mgmtEp); + +end: + return code; +} +typedef int32_t _raw_decode_func_(SDecoder *pDecoder, SMqDataRsp *pRsp); +static int32_t decodeRawData(SDecoder *decoder, void* data, int32_t dataLen, _raw_decode_func_ func, SMqRspObj* rspObj){ int8_t dataVersion = *(int8_t*)data; if (dataVersion >= MQ_DATA_RSP_VERSION) { data = POINTER_SHIFT(data, sizeof(int8_t) + sizeof(int32_t)); dataLen -= sizeof(int8_t) + sizeof(int32_t); } - tDecoderInit(&decoder, data, dataLen); - code = (type == RES_TYPE__TMQ_METADATA) ? tDecodeSTaosxRsp(&decoder, &rspObj.dataRsp) : tDecodeMqDataRsp(&decoder, &rspObj.dataRsp); + rspObj->resIter = -1; + tDecoderInit(decoder, data, dataLen); + int32_t code = func(decoder, &rspObj->dataRsp); if (code != 0) { SET_ERROR_MSG("decode mq taosx data rsp failed"); - code = TSDB_CODE_INVALID_MSG; - goto end; } + return code; +} - if (!pRequest->pDb) { - code = TSDB_CODE_PAR_DB_NOT_SPECIFIED; - goto end; - } +static int32_t processCacheMeta(SHashObj *pVgHash, SHashObj *pNameHash, SHashObj *pMetaHash, SVCreateTbReq* pCreateReqDst, + SCatalog* pCatalog, SRequestConnInfo* conn, SName* pName, + STableMeta** pMeta, SSchemaWrapper* pSW, void* rawData, int32_t retry){ + int32_t code = 0; + STableMeta* pTableMeta = NULL; + tbInfo* tmpInfo = (tbInfo*)taosHashGet(pNameHash, pName->tname, strlen(pName->tname)); + if (tmpInfo == NULL || retry > 0) { + tbInfo info = {0}; - struct SCatalog* pCatalog = NULL; - RAW_RETURN_CHECK(catalogGetHandle(pRequest->pTscObj->pAppInfo->clusterId, &pCatalog)); + RAW_RETURN_CHECK(catalogGetTableHashVgroup(pCatalog, conn, pName, &info.vgInfo)); + if (pCreateReqDst && tmpInfo == NULL) { // change stable name to get meta + tstrncpy(pName->tname, pCreateReqDst->ctb.stbName, TSDB_TABLE_NAME_LEN); + } + RAW_RETURN_CHECK(catalogGetTableMeta(pCatalog, conn, pName, &pTableMeta)); + info.uid = pTableMeta->uid; + if (pTableMeta->tableType == TSDB_CHILD_TABLE){ + info.suid = pTableMeta->suid; + } else { + info.suid = pTableMeta->uid; + } + code = taosHashPut(pMetaHash, &info.suid, LONG_BYTES, &pTableMeta, POINTER_BYTES); + if (code != 0){ + taosMemoryFree(pTableMeta); + goto end; + } + if (pCreateReqDst) { + pTableMeta->vgId = info.vgInfo.vgId; + pTableMeta->uid = pCreateReqDst->uid; + pCreateReqDst->ctb.suid = pTableMeta->suid; + } - 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); + RAW_RETURN_CHECK(taosHashPut(pNameHash, pName->tname, strlen(pName->tname), &info, sizeof(tbInfo))); + tmpInfo = (tbInfo*)taosHashGet(pNameHash, pName->tname, strlen(pName->tname)); + RAW_RETURN_CHECK(taosHashPut(pVgHash, &info.vgInfo.vgId, sizeof(info.vgInfo.vgId), &info.vgInfo, sizeof(SVgroupInfo))); + } - if (type == RES_TYPE__TMQ_METADATA) { - pCreateTbHash = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK); - RAW_NULL_CHECK(pCreateTbHash); - RAW_RETURN_CHECK(buildCreateTbMap(&rspObj.dataRsp, pCreateTbHash)); + if (pTableMeta == NULL || retry > 0){ + STableMeta** pTableMetaTmp = (STableMeta**)taosHashGet(pMetaHash, &tmpInfo->suid, LONG_BYTES); + if (pTableMetaTmp == NULL || retry > 0 || needRefreshMeta(rawData, *pTableMetaTmp, pSW)) { + RAW_RETURN_CHECK(catalogGetTableMeta(pCatalog, conn, pName, &pTableMeta)); + code = taosHashPut(pMetaHash, &tmpInfo->suid, LONG_BYTES, &pTableMeta, POINTER_BYTES); + if (code != 0){ + taosMemoryFree(pTableMeta); + goto end; + } + + }else{ + pTableMeta = *pTableMetaTmp; + pTableMeta->uid = tmpInfo->uid; + pTableMeta->vgId = tmpInfo->vgInfo.vgId; + } } + *pMeta = pTableMeta; + +end: + return code; +} + +static int32_t tmqWriteRawDataImpl(TAOS* taos, void* data, int32_t dataLen){ + int32_t code = TSDB_CODE_SUCCESS; + SQuery* pQuery = NULL; + SMqRspObj rspObj = {0}; + SDecoder decoder = {0}; + + SRequestObj* pRequest = NULL; + SCatalog* pCatalog = NULL; + SRequestConnInfo conn = {0}; + + uDebug(LOG_ID_TAG " write raw data, data:%p, dataLen:%d", LOG_ID_VALUE, data, dataLen); + RAW_RETURN_CHECK(buildRawRequest(taos, &pRequest, &pCatalog, &conn)); + RAW_RETURN_CHECK(decodeRawData(&decoder, data, dataLen, tDecodeMqDataRsp, &rspObj)); SHashObj *pVgHash = NULL; SHashObj *pNameHash = NULL; @@ -1903,89 +1941,114 @@ static int32_t tmqWriteRawImpl(TAOS* taos, uint16_t type, void* data, int32_t da int retry = 0; while(1){ RAW_RETURN_CHECK(smlInitHandle(&pQuery)); - uDebug(LOG_ID_TAG " write raw data type:%d block num:%d", LOG_ID_VALUE, type, rspObj.dataRsp.blockNum); + uDebug(LOG_ID_TAG " write raw meta data block num:%d", LOG_ID_VALUE, rspObj.dataRsp.blockNum); while (++rspObj.resIter < rspObj.dataRsp.blockNum) { - void* pRetrieve = taosArrayGetP(rspObj.dataRsp.blockData, rspObj.resIter); - RAW_NULL_CHECK(pRetrieve); if (!rspObj.dataRsp.withSchema) { goto end; } const char* tbName = (const char*)taosArrayGetP(rspObj.dataRsp.blockTbName, rspObj.resIter); RAW_NULL_CHECK(tbName); + SSchemaWrapper* pSW = (SSchemaWrapper*)taosArrayGetP(rspObj.dataRsp.blockSchema, rspObj.resIter); + RAW_NULL_CHECK(pSW); + void* pRetrieve = taosArrayGetP(rspObj.dataRsp.blockData, rspObj.resIter); + RAW_NULL_CHECK(pRetrieve); + void* rawData = getRawDataFromRes(pRetrieve); + RAW_NULL_CHECK(rawData); uDebug(LOG_ID_TAG " write raw data block tbname:%s", LOG_ID_VALUE, tbName); SName pName = {TSDB_TABLE_NAME_T, pRequest->pTscObj->acctId, {0}, {0}}; - (void)strcpy(pName.dbname, pRequest->pDb); - (void)strcpy(pName.tname, tbName); + tstrncpy(pName.dbname, pRequest->pDb, TSDB_DB_NAME_LEN); + tstrncpy(pName.tname, tbName, TSDB_TABLE_NAME_LEN); - // find schema data info - SVCreateTbReq* pCreateReqDst = NULL; - if (type == RES_TYPE__TMQ_METADATA){ - pCreateReqDst = (SVCreateTbReq*)taosHashGet(pCreateTbHash, tbName, strlen(tbName)); - } STableMeta* pTableMeta = NULL; - tbInfo* tmpInfo = (tbInfo*)taosHashGet(pNameHash, tbName, strlen(tbName)); - if (tmpInfo == NULL || retry > 0) { - tbInfo info = {0}; + processCacheMeta(pVgHash, pNameHash, pMetaHash, NULL, pCatalog, &conn, + &pName, &pTableMeta, pSW, rawData, retry); + char err[ERR_MSG_LEN] = {0}; + code = rawBlockBindData(pQuery, pTableMeta, rawData, NULL, pSW, pSW->nCols, true, err, ERR_MSG_LEN, true); + if (code != TSDB_CODE_SUCCESS) { + SET_ERROR_MSG("table:%s, err:%s", pName.tname, err); + goto end; + } + } + RAW_RETURN_CHECK(smlBuildOutput(pQuery, pVgHash)); + launchQueryImpl(pRequest, pQuery, true, NULL); + code = pRequest->code; - RAW_RETURN_CHECK(catalogGetTableHashVgroup(pCatalog, &conn, &pName, &info.vgInfo)); - if (pCreateReqDst && tmpInfo == NULL) { // change stable name to get meta - (void)strcpy(pName.tname, pCreateReqDst->ctb.stbName); - } - RAW_RETURN_CHECK(catalogGetTableMeta(pCatalog, &conn, &pName, &pTableMeta)); - info.uid = pTableMeta->uid; - if (pTableMeta->tableType == TSDB_CHILD_TABLE){ - info.suid = pTableMeta->suid; - } else { - info.suid = pTableMeta->uid; - } - code = taosHashPut(pMetaHash, &info.suid, LONG_BYTES, &pTableMeta, POINTER_BYTES); - if (code != 0){ - taosMemoryFree(pTableMeta); - goto end; - } - if (pCreateReqDst) { - pTableMeta->vgId = info.vgInfo.vgId; - pTableMeta->uid = pCreateReqDst->uid; - pCreateReqDst->ctb.suid = pTableMeta->suid; - } + if (NEED_CLIENT_HANDLE_ERROR(code) && retry++ < 3) { + uInfo("write raw retry:%d/3 end code:%d, msg:%s", retry, code, tstrerror(code)); + qDestroyQuery(pQuery); + pQuery = NULL; + rspObj.resIter = -1; + continue; + } + break; + } - RAW_RETURN_CHECK(taosHashPut(pNameHash, pName.tname, strlen(pName.tname), &info, sizeof(tbInfo))); - tmpInfo = (tbInfo*)taosHashGet(pNameHash, pName.tname, strlen(pName.tname)); -// code = (code == TSDB_CODE_DUP_KEY) ? 0 : code; -// RAW_RETURN_CHECK(code); - RAW_RETURN_CHECK(taosHashPut(pVgHash, &info.vgInfo.vgId, sizeof(info.vgInfo.vgId), &info.vgInfo, sizeof(SVgroupInfo))); -// code = (code == TSDB_CODE_DUP_KEY) ? 0 : code; -// RAW_RETURN_CHECK(code); + end: + uDebug(LOG_ID_TAG " write raw data return, msg:%s", LOG_ID_VALUE, tstrerror(code)); + tDeleteMqDataRsp(&rspObj.dataRsp); + tDecoderClear(&decoder); + qDestroyQuery(pQuery); + destroyRequest(pRequest); + return code; +} + +static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, int32_t dataLen) { + int32_t code = TSDB_CODE_SUCCESS; + SQuery* pQuery = NULL; + SMqRspObj rspObj = {0}; + SDecoder decoder = {0}; + SHashObj* pCreateTbHash = NULL; + + SRequestObj* pRequest = NULL; + SCatalog* pCatalog = NULL; + SRequestConnInfo conn = {0}; + + uDebug(LOG_ID_TAG " write raw metadata, data:%p, dataLen:%d", LOG_ID_VALUE, data, dataLen); + RAW_RETURN_CHECK(buildRawRequest(taos, &pRequest, &pCatalog, &conn)); + RAW_RETURN_CHECK(decodeRawData(&decoder, data, dataLen, tDecodeSTaosxRsp, &rspObj)); + + pCreateTbHash = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK); + RAW_NULL_CHECK(pCreateTbHash); + RAW_RETURN_CHECK(buildCreateTbMap(&rspObj.dataRsp, pCreateTbHash)); + + SHashObj *pVgHash = NULL; + SHashObj *pNameHash = NULL; + SHashObj *pMetaHash = NULL; + RAW_RETURN_CHECK(getRawCache(&pVgHash, &pNameHash, &pMetaHash, taos)); + int retry = 0; + while(1){ + RAW_RETURN_CHECK(smlInitHandle(&pQuery)); + uDebug(LOG_ID_TAG " write raw meta data block num:%d", LOG_ID_VALUE, rspObj.dataRsp.blockNum); + while (++rspObj.resIter < rspObj.dataRsp.blockNum) { + if (!rspObj.dataRsp.withSchema) { + goto end; } + const char* tbName = (const char*)taosArrayGetP(rspObj.dataRsp.blockTbName, rspObj.resIter); + RAW_NULL_CHECK(tbName); SSchemaWrapper* pSW = (SSchemaWrapper*)taosArrayGetP(rspObj.dataRsp.blockSchema, rspObj.resIter); RAW_NULL_CHECK(pSW); + void* pRetrieve = taosArrayGetP(rspObj.dataRsp.blockData, rspObj.resIter); + RAW_NULL_CHECK(pRetrieve); void* rawData = getRawDataFromRes(pRetrieve); RAW_NULL_CHECK(rawData); - if (pTableMeta == NULL || retry > 0){ - STableMeta** pTableMetaTmp = (STableMeta**)taosHashGet(pMetaHash, &tmpInfo->suid, LONG_BYTES); - if (pTableMetaTmp == NULL || retry > 0 || needRefreshMeta(rawData, *pTableMetaTmp, pSW)) { - RAW_RETURN_CHECK(catalogGetTableMeta(pCatalog, &conn, &pName, &pTableMeta)); - code = taosHashPut(pMetaHash, &tmpInfo->suid, LONG_BYTES, &pTableMeta, POINTER_BYTES); - if (code != 0){ - taosMemoryFree(pTableMeta); - goto end; - } - - }else{ - pTableMeta = *pTableMetaTmp; - pTableMeta->uid = tmpInfo->uid; - pTableMeta->vgId = tmpInfo->vgInfo.vgId; - } - } + uDebug(LOG_ID_TAG " write raw data block tbname:%s", LOG_ID_VALUE, tbName); + SName pName = {TSDB_TABLE_NAME_T, pRequest->pTscObj->acctId, {0}, {0}}; + tstrncpy(pName.dbname, pRequest->pDb, TSDB_DB_NAME_LEN); + tstrncpy(pName.tname, tbName, TSDB_TABLE_NAME_LEN); + // find schema data info + SVCreateTbReq* pCreateReqDst = (SVCreateTbReq*)taosHashGet(pCreateTbHash, pName.tname, strlen(pName.tname)); + STableMeta* pTableMeta = NULL; + processCacheMeta(pVgHash, pNameHash, pMetaHash, pCreateReqDst, pCatalog, &conn, + &pName, &pTableMeta, pSW, rawData, retry); char err[ERR_MSG_LEN] = {0}; code = rawBlockBindData(pQuery, pTableMeta, rawData, pCreateReqDst, pSW, pSW->nCols, true, err, ERR_MSG_LEN, true); if (code != TSDB_CODE_SUCCESS) { - SET_ERROR_MSG("table:%s, err:%s", tbName, err); + SET_ERROR_MSG("table:%s, err:%s", pName.tname, err); goto end; } } @@ -1993,11 +2056,8 @@ static int32_t tmqWriteRawImpl(TAOS* taos, uint16_t type, void* data, int32_t da launchQueryImpl(pRequest, pQuery, true, NULL); code = pRequest->code; - if (NEED_CLIENT_HANDLE_ERROR(code)) { + if (NEED_CLIENT_HANDLE_ERROR(code) && retry++ < 3) { uInfo("write raw retry:%d/3 end code:%d, msg:%s", retry, code, tstrerror(code)); - if (retry++ >= 3) { - break; - } qDestroyQuery(pQuery); pQuery = NULL; rspObj.resIter = -1; @@ -2006,13 +2066,9 @@ static int32_t tmqWriteRawImpl(TAOS* taos, uint16_t type, void* data, int32_t da break; } - end: +end: uDebug(LOG_ID_TAG " write raw metadata return, msg:%s", LOG_ID_VALUE, tstrerror(code)); - if (type == RES_TYPE__TMQ_METADATA){ - tDeleteSTaosxRsp(&rspObj.dataRsp); - }else { - tDeleteMqDataRsp(&rspObj.dataRsp); - } + tDeleteSTaosxRsp(&rspObj.dataRsp); void* pIter = taosHashIterate(pCreateTbHash, NULL); while (pIter) { tDestroySVCreateTbReq(pIter, TSDB_MSG_FLG_DECODE); @@ -2243,8 +2299,10 @@ static int32_t writeRawImpl(TAOS* taos, void* buf, uint32_t len, uint16_t type) return taosDropTable(taos, buf, len); } else if (type == TDMT_VND_DELETE) { return taosDeleteData(taos, buf, len); - } else if (type == RES_TYPE__TMQ_METADATA || type == RES_TYPE__TMQ) { - return tmqWriteRawImpl(taos, type, buf, len); + } else if (type == RES_TYPE__TMQ_METADATA){ + return tmqWriteRawMetaDataImpl(taos, buf, len); + } else if (type == RES_TYPE__TMQ) { + return tmqWriteRawDataImpl(taos, buf, len); } else if (type == RES_TYPE__TMQ_BATCH_META) { return tmqWriteBatchMetaDataImpl(taos, buf, len); } @@ -2252,7 +2310,8 @@ static int32_t writeRawImpl(TAOS* taos, void* buf, uint32_t len, uint16_t type) } int32_t tmq_write_raw(TAOS* taos, tmq_raw_data raw) { - if (!taos) { + if (taos == NULL || raw.raw == NULL || raw.raw_len <= 0) { + SET_ERROR_MSG("taos:%p or data:%p is NULL or raw_len <= 0", taos, raw.raw); return TSDB_CODE_INVALID_PARA; } From f04151d77285e9a7ef411153b094e651b5fda6c3 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Fri, 18 Oct 2024 17:38:14 +0800 Subject: [PATCH 157/695] fix(stream):add force window close check --- source/libs/parser/src/parTranslater.c | 13 ++++++++ tests/parallel_test/cases.task | 1 + .../tsim/stream/streamInterpFwcError.sim | 31 +++++++++++++++++++ 3 files changed, 45 insertions(+) create mode 100644 tests/script/tsim/stream/streamInterpFwcError.sim diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 01af053ede87..1d04b9427695 100755 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -10664,6 +10664,7 @@ static int32_t checkStreamQuery(STranslateContext* pCxt, SCreateStreamStmt* pStm return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY, "Stream interp function only support force window close"); } + if (pStmt->pOptions->triggerType == STREAM_TRIGGER_FORCE_WINDOW_CLOSE) { if (pStmt->pOptions->fillHistory) { return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY, @@ -10722,6 +10723,18 @@ static int32_t checkStreamQuery(STranslateContext* pCxt, SCreateStreamStmt* pStm &pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY, "When trigger was force window close, Stream unsupported Fill history"); } + + if (pStmt->pOptions->ignoreExpired != 1) { + return generateSyntaxErrMsgExt( + &pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY, + "When trigger was force window close, Stream must not set ignore expired 0"); + } + + if (pStmt->pOptions->ignoreUpdate != 1) { + return generateSyntaxErrMsgExt( + &pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY, + "When trigger was force window close, Stream must not set ignore update 0"); + } } if (NULL != pSelect->pGroupByList) { diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index be28b1398d8d..6e51d9c5011e 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -1370,6 +1370,7 @@ #,,y,script,./test.sh -f tsim/stream/streamInterpError.sim ,,y,script,./test.sh -f tsim/stream/streamInterpForceWindowClose.sim ,,y,script,./test.sh -f tsim/stream/streamInterpForceWindowClose1.sim +,,y,script,./test.sh -f tsim/stream/streamInterpFwcError.sim #,,y,script,./test.sh -f tsim/stream/streamInterpHistory.sim #,,y,script,./test.sh -f tsim/stream/streamInterpHistory1.sim #,,y,script,./test.sh -f tsim/stream/streamInterpLarge.sim diff --git a/tests/script/tsim/stream/streamInterpFwcError.sim b/tests/script/tsim/stream/streamInterpFwcError.sim new file mode 100644 index 000000000000..a53a6fe1899b --- /dev/null +++ b/tests/script/tsim/stream/streamInterpFwcError.sim @@ -0,0 +1,31 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sleep 50 +sql connect + +print step2 + +sql create database test2 vgroups 1; +sql use test2; + +sql create stable st(ts timestamp,a int,b int,c int, d double) tags(ta int,tb int,tc int); +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); + +sql create stream streams1 trigger force_window_close into streamt1 as select _irowts, _isfilled as a1, interp(a) as a2 from st partition by tbname every(1s) fill(prev); + +run tsim/stream/checkTaskStatus.sim + +sql_error create stream streams2 trigger force_window_close IGNORE EXPIRED 0 into streamt2 as select _irowts, _isfilled as a1, interp(a) as a2 from st partition by tbname every(1s) fill(prev); +sql_error create stream streams3 trigger force_window_close IGNORE UPDATE 0 into streamt3 as select _irowts, _isfilled as a1, interp(a) as a2 from st partition by tbname every(1s) fill(prev); + + +sql create stream streams4 trigger force_window_close IGNORE EXPIRED 1 into streamt4 as select _irowts, _isfilled as a1, interp(a) as a2 from st partition by tbname every(1s) fill(prev); +run tsim/stream/checkTaskStatus.sim + +sql create stream streams5 trigger force_window_close IGNORE UPDATE 1 into streamt5 as select _irowts, _isfilled as a1, interp(a) as a2 from st partition by tbname every(1s) fill(prev); +run tsim/stream/checkTaskStatus.sim + + +system sh/exec.sh -n dnode1 -s stop -x SIGINT From cde86c2e327af6328b7985deda56655eee5e9f50 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Fri, 18 Oct 2024 18:18:10 +0800 Subject: [PATCH 158/695] enh: add plan ut case --- source/libs/executor/test/queryPlanTests.cpp | 321 ++++++++++++++----- source/libs/nodes/src/nodesUtilFuncs.c | 6 +- source/libs/scheduler/src/schJob.c | 17 +- 3 files changed, 261 insertions(+), 83 deletions(-) diff --git a/source/libs/executor/test/queryPlanTests.cpp b/source/libs/executor/test/queryPlanTests.cpp index 6faeaed2cff5..52edd59b7511 100755 --- a/source/libs/executor/test/queryPlanTests.cpp +++ b/source/libs/executor/test/queryPlanTests.cpp @@ -46,8 +46,10 @@ namespace { -#define QPT_MAX_LOOP 10000 -#define QPT_MAX_SUBPLAN_LEVEL 1000 +#define QPT_MAX_LOOP 1000000 +#define QPT_MAX_LEVEL_SUBPLAN_NUM 10 +#define QPT_MAX_SUBPLAN_LEVEL 5 +#define QPT_MAX_SUBPLAN_GROUP 5 #define QPT_MAX_WHEN_THEN_NUM 10 #define QPT_MAX_NODE_LEVEL 5 #define QPT_MAX_STRING_LEN 1048576 @@ -66,9 +68,17 @@ typedef enum { QPT_NODE_EXPR, QPT_NODE_FUNCTION, QPT_NODE_VALUE, + QPT_NODE_SUBPLAN, QPT_NODE_MAX_VALUE } QPT_NODE_TYPE; +enum { + QPT_PLAN_PHYSIC = 1, + QPT_PLAN_SINK, + QPT_PLAN_SUBPLAN, + QPT_PLAN_PLAN +}; + typedef SNode* (*planBuildFunc)(int32_t); @@ -130,6 +140,7 @@ typedef struct { typedef struct { bool correctExpected; uint64_t schedulerId; + char userName[TSDB_USER_LEN]; SQPTPlanParam plan; SQPTDbParam db; SQPTVnodeParam vnode; @@ -146,8 +157,7 @@ typedef struct { EOrder currTsOrder; int16_t nextBlockId; int32_t primaryTsSlotId; - SSubplanId nextSubplanId; - int32_t currSubplanLevel; + int32_t nextSubplanId; SExecTaskInfo* pCurrTask; } SQPTBuildPlanCtx; @@ -185,6 +195,7 @@ typedef struct { typedef struct { int32_t type; + int32_t classify; char* name; planBuildFunc buildFunc; } SQPTPlan; @@ -236,57 +247,61 @@ SNode* qptCreateDataDispatchPhysiNode(int32_t nodeType); SNode* qptCreateDataInsertPhysiNode(int32_t nodeType); SNode* qptCreateDataQueryInsertPhysiNode(int32_t nodeType); SNode* qptCreateDataDeletePhysiNode(int32_t nodeType); +SNode* qptCreatePhysicalPlanNode(int32_t nodeIdx); +void qptCreatePhysiNodesTree(SPhysiNode** ppRes, SPhysiNode* pParent, int32_t level); +SNode* qptCreateQueryPlanNode(int32_t nodeType); +SNode* qptCreateSubplanNode(int32_t nodeType); SQPTPlan qptPlans[] = { - {QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN, "tagScan", qptCreateTagScanPhysiNode}, - {QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN, "tableScan", qptCreateTableScanPhysiNode}, - {QUERY_NODE_PHYSICAL_PLAN_TABLE_SEQ_SCAN, "tableSeqScan", qptCreateTableSeqScanPhysiNode}, - {QUERY_NODE_PHYSICAL_PLAN_TABLE_MERGE_SCAN, "tableMergeScan", qptCreateTableMergeScanPhysiNode}, - {QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN, "streamScan", qptCreateStreamScanPhysiNode}, - {QUERY_NODE_PHYSICAL_PLAN_SYSTABLE_SCAN, "sysTableScan", qptCreateSysTableScanPhysiNode}, - {QUERY_NODE_PHYSICAL_PLAN_BLOCK_DIST_SCAN, "blockDistScan", qptCreateBlockDistScanPhysiNode}, - {QUERY_NODE_PHYSICAL_PLAN_LAST_ROW_SCAN, "lastRowScan", qptCreateLastRowScanPhysiNode}, - {QUERY_NODE_PHYSICAL_PLAN_PROJECT, "project", qptCreateProjectPhysiNode}, - {QUERY_NODE_PHYSICAL_PLAN_MERGE_JOIN, "mergeJoin", qptCreateMergeJoinPhysiNode}, - {QUERY_NODE_PHYSICAL_PLAN_HASH_AGG, "hashAgg", qptCreateHashAggPhysiNode}, - {QUERY_NODE_PHYSICAL_PLAN_EXCHANGE, "exchange", qptCreateExchangePhysiNode}, - {QUERY_NODE_PHYSICAL_PLAN_MERGE, "merge", qptCreateMergePhysiNode}, - {QUERY_NODE_PHYSICAL_PLAN_SORT, "sort", qptCreateSortPhysiNode}, - {QUERY_NODE_PHYSICAL_PLAN_GROUP_SORT, "groupSort", qptCreateGroupSortPhysiNode}, - {QUERY_NODE_PHYSICAL_PLAN_HASH_INTERVAL, "interval", qptCreateIntervalPhysiNode}, - {QUERY_NODE_PHYSICAL_PLAN_MERGE_INTERVAL, "mergeInterval", qptCreateMergeIntervalPhysiNode}, - {QUERY_NODE_PHYSICAL_PLAN_MERGE_ALIGNED_INTERVAL, "mergeAlignedInterval", qptCreateMergeAlignedIntervalPhysiNode}, - {QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL, "streamInterval", qptCreateStreamIntervalPhysiNode}, - {QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL, "streamFinalInterval", qptCreateStreamFinalIntervalPhysiNode}, - {QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL, "streamSemiInterval", qptCreateStreamSemiIntervalPhysiNode}, - {QUERY_NODE_PHYSICAL_PLAN_FILL, "fill", qptCreateFillPhysiNode}, - {QUERY_NODE_PHYSICAL_PLAN_STREAM_FILL, "streamFill", qptCreateStreamFillPhysiNode}, - {QUERY_NODE_PHYSICAL_PLAN_MERGE_SESSION, "sessionWindow", qptCreateSessionPhysiNode}, - {QUERY_NODE_PHYSICAL_PLAN_STREAM_SESSION, "streamSession", qptCreateStreamSessionPhysiNode}, - {QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_SESSION, "streamSemiSession", qptCreateStreamSemiSessionPhysiNode}, - {QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_SESSION, "streamFinalSession", qptCreateStreamFinalSessionPhysiNode}, - {QUERY_NODE_PHYSICAL_PLAN_MERGE_STATE, "stateWindow", qptCreateStateWindowPhysiNode}, - {QUERY_NODE_PHYSICAL_PLAN_STREAM_STATE, "streamState", qptCreateStreamStatePhysiNode}, - {QUERY_NODE_PHYSICAL_PLAN_PARTITION, "partition", qptCreatePartitionPhysiNode}, - {QUERY_NODE_PHYSICAL_PLAN_STREAM_PARTITION, "streamPartition", qptCreateStreamPartitionPhysiNode}, - {QUERY_NODE_PHYSICAL_PLAN_INDEF_ROWS_FUNC, "indefRowsFunc", qptCreateIndefRowsFuncPhysiNode}, - {QUERY_NODE_PHYSICAL_PLAN_INTERP_FUNC, "interpFunc", qptCreateInterpFuncPhysiNode}, - {QUERY_NODE_PHYSICAL_PLAN_DISPATCH, "dataDispatch", qptCreateDataDispatchPhysiNode}, - {QUERY_NODE_PHYSICAL_PLAN_INSERT, "dataInseret", qptCreateDataInsertPhysiNode}, - {QUERY_NODE_PHYSICAL_PLAN_QUERY_INSERT, "dataQueryInsert", qptCreateDataQueryInsertPhysiNode}, - {QUERY_NODE_PHYSICAL_PLAN_DELETE, "dataDelete", qptCreateDataDeletePhysiNode}, - {QUERY_NODE_PHYSICAL_SUBPLAN, "subplan", NULL}, - {QUERY_NODE_PHYSICAL_PLAN, "plan", NULL}, - {QUERY_NODE_PHYSICAL_PLAN_TABLE_COUNT_SCAN, "tableCountScan", qptCreateTableCountScanPhysiNode}, - {QUERY_NODE_PHYSICAL_PLAN_MERGE_EVENT, "eventWindow", qptCreateMergeEventPhysiNode}, - {QUERY_NODE_PHYSICAL_PLAN_STREAM_EVENT, "streamEventWindow", qptCreateStreamEventPhysiNode}, - {QUERY_NODE_PHYSICAL_PLAN_HASH_JOIN, "hashJoin", qptCreateHashJoinPhysiNode}, - {QUERY_NODE_PHYSICAL_PLAN_GROUP_CACHE, "groupCache", qptCreateGroupCachePhysiNode}, - {QUERY_NODE_PHYSICAL_PLAN_DYN_QUERY_CTRL, "dynQueryCtrl", qptCreateDynQueryCtrlPhysiNode}, - {QUERY_NODE_PHYSICAL_PLAN_MERGE_COUNT, "countWindow", qptCreateCountWindowPhysiNode}, - {QUERY_NODE_PHYSICAL_PLAN_STREAM_COUNT, "streamCountWindow", qptCreateStreamCountWindowPhysiNode}, - {QUERY_NODE_PHYSICAL_PLAN_STREAM_MID_INTERVAL, "streamMidInterval", qptCreateStreamMidIntervalPhysiNode} + {QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN, QPT_PLAN_PHYSIC, "tagScan", qptCreateTagScanPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN, QPT_PLAN_PHYSIC, "tableScan", qptCreateTableScanPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_TABLE_SEQ_SCAN, QPT_PLAN_PHYSIC, "tableSeqScan", qptCreateTableSeqScanPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_TABLE_MERGE_SCAN, QPT_PLAN_PHYSIC, "tableMergeScan", qptCreateTableMergeScanPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN, QPT_PLAN_PHYSIC, "streamScan", qptCreateStreamScanPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_SYSTABLE_SCAN, QPT_PLAN_PHYSIC, "sysTableScan", qptCreateSysTableScanPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_BLOCK_DIST_SCAN, QPT_PLAN_PHYSIC, "blockDistScan", qptCreateBlockDistScanPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_LAST_ROW_SCAN, QPT_PLAN_PHYSIC, "lastRowScan", qptCreateLastRowScanPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_PROJECT, QPT_PLAN_PHYSIC, "project", qptCreateProjectPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_MERGE_JOIN, QPT_PLAN_PHYSIC, "mergeJoin", qptCreateMergeJoinPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_HASH_AGG, QPT_PLAN_PHYSIC, "hashAgg", qptCreateHashAggPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_EXCHANGE, QPT_PLAN_PHYSIC, "exchange", qptCreateExchangePhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_MERGE, QPT_PLAN_PHYSIC, "merge", qptCreateMergePhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_SORT, QPT_PLAN_PHYSIC, "sort", qptCreateSortPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_GROUP_SORT, QPT_PLAN_PHYSIC, "groupSort", qptCreateGroupSortPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_HASH_INTERVAL, QPT_PLAN_PHYSIC, "interval", qptCreateIntervalPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_MERGE_INTERVAL, QPT_PLAN_PHYSIC, "mergeInterval", qptCreateMergeIntervalPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_MERGE_ALIGNED_INTERVAL, QPT_PLAN_PHYSIC, "mergeAlignedInterval", qptCreateMergeAlignedIntervalPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL, QPT_PLAN_PHYSIC, "streamInterval", qptCreateStreamIntervalPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL, QPT_PLAN_PHYSIC, "streamFinalInterval", qptCreateStreamFinalIntervalPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL, QPT_PLAN_PHYSIC, "streamSemiInterval", qptCreateStreamSemiIntervalPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_FILL, QPT_PLAN_PHYSIC, "fill", qptCreateFillPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_STREAM_FILL, QPT_PLAN_PHYSIC, "streamFill", qptCreateStreamFillPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_MERGE_SESSION, QPT_PLAN_PHYSIC, "sessionWindow", qptCreateSessionPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_STREAM_SESSION, QPT_PLAN_PHYSIC, "streamSession", qptCreateStreamSessionPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_SESSION, QPT_PLAN_PHYSIC, "streamSemiSession", qptCreateStreamSemiSessionPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_SESSION, QPT_PLAN_PHYSIC, "streamFinalSession", qptCreateStreamFinalSessionPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_MERGE_STATE, QPT_PLAN_PHYSIC, "stateWindow", qptCreateStateWindowPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_STREAM_STATE, QPT_PLAN_PHYSIC, "streamState", qptCreateStreamStatePhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_PARTITION, QPT_PLAN_PHYSIC, "partition", qptCreatePartitionPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_STREAM_PARTITION, QPT_PLAN_PHYSIC, "streamPartition", qptCreateStreamPartitionPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_INDEF_ROWS_FUNC, QPT_PLAN_PHYSIC, "indefRowsFunc", qptCreateIndefRowsFuncPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_INTERP_FUNC, QPT_PLAN_PHYSIC, "interpFunc", qptCreateInterpFuncPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_DISPATCH, QPT_PLAN_SINK, "dataDispatch", qptCreateDataDispatchPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_INSERT, QPT_PLAN_SINK, "dataInseret", qptCreateDataInsertPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_QUERY_INSERT, QPT_PLAN_SINK, "dataQueryInsert", qptCreateDataQueryInsertPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_DELETE, QPT_PLAN_SINK, "dataDelete", qptCreateDataDeletePhysiNode}, + {QUERY_NODE_PHYSICAL_SUBPLAN, QPT_PLAN_SUBPLAN, "subplan", qptCreateSubplanNode}, + {QUERY_NODE_PHYSICAL_PLAN, QPT_PLAN_PLAN, "plan", qptCreateQueryPlanNode}, + {QUERY_NODE_PHYSICAL_PLAN_TABLE_COUNT_SCAN, QPT_PLAN_PHYSIC, "tableCountScan", qptCreateTableCountScanPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_MERGE_EVENT, QPT_PLAN_PHYSIC, "eventWindow", qptCreateMergeEventPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_STREAM_EVENT, QPT_PLAN_PHYSIC, "streamEventWindow", qptCreateStreamEventPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_HASH_JOIN, QPT_PLAN_PHYSIC, "hashJoin", qptCreateHashJoinPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_GROUP_CACHE, QPT_PLAN_PHYSIC, "groupCache", qptCreateGroupCachePhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_DYN_QUERY_CTRL, QPT_PLAN_PHYSIC, "dynQueryCtrl", qptCreateDynQueryCtrlPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_MERGE_COUNT, QPT_PLAN_PHYSIC, "countWindow", qptCreateCountWindowPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_STREAM_COUNT, QPT_PLAN_PHYSIC, "streamCountWindow", qptCreateStreamCountWindowPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_STREAM_MID_INTERVAL, QPT_PLAN_PHYSIC, "streamMidInterval", qptCreateStreamMidIntervalPhysiNode} }; @@ -307,6 +322,7 @@ SQPTCtx qptCtx = {0}; SQPTCtrl qptCtrl = {1, 0, 0, 0, 0}; bool qptErrorRerun = false; bool qptInRerun = false; +int32_t qptSink[] = {QUERY_NODE_PHYSICAL_PLAN_DISPATCH, QUERY_NODE_PHYSICAL_PLAN_INSERT, QUERY_NODE_PHYSICAL_PLAN_QUERY_INSERT, QUERY_NODE_PHYSICAL_PLAN_DELETE}; SNode* qptMakeExprNode(SNode** ppNode); @@ -727,10 +743,28 @@ void qptGetRandTimeWindow(STimeWindow* pWindow) { pWindow->ekey = taosRand(); } -void qptGetSubplanId(SSubplanId* pId) { - pId->queryId = qptCtx.buildCtx.nextSubplanId.queryId; - pId->groupId = qptCtx.buildCtx.nextSubplanId.groupId++; - pId->subplanId = qptCtx.buildCtx.nextSubplanId.subplanId++; +int32_t qptGetSubplanNum(SNodeList* pList) { + if (QPT_NCORRECT_LOW_PROB()) { + return taosRand(); + } + + int32_t subplanNum = 0; + SNode* pNode = NULL; + FOREACH(pNode, pList) { + if (NULL == pNode || QUERY_NODE_NODE_LIST != nodeType(pNode)) { + continue; + } + + SNodeListNode* pNodeListNode = (SNodeListNode*)pNode; + + if (NULL == pNodeListNode->pNodeList) { + continue; + } + + subplanNum += pNodeListNode->pNodeList->length; + } + + return subplanNum; } int32_t qptNodesListAppend(SNodeList* pList, SNode* pNode) { @@ -1226,6 +1260,11 @@ SNode* qptMakeNodeListNode(QPT_NODE_TYPE nodeType, SNode** ppNode) { return qptMakeRandNode(ppNode); } + SNode* pTmp = NULL; + if (NULL == ppNode) { + ppNode = &pTmp; + } + SNodeListNode* pList = NULL; nodesMakeNode(QUERY_NODE_NODE_LIST, (SNode**)&pList); @@ -2700,7 +2739,7 @@ SNode* qptCreateDataDeletePhysiNode(int32_t nodeType) { pDeleter->tableFName[0] = QPT_RAND_BOOL_V ? 'a' : 0; } - SQPTCol* pCol = nodesListGetNode(qptCtx.param.tbl.pColList, 0); + SQPTCol* pCol = (SQPTCol*)nodesListGetNode(qptCtx.param.tbl.pColList, 0); if (QPT_CORRECT_HIGH_PROB() && pCol) { strcpy(pDeleter->tsColName, pCol->name); } else { @@ -2712,34 +2751,58 @@ SNode* qptCreateDataDeletePhysiNode(int32_t nodeType) { return (SNode*)pDeleter; } +void qptBuildSinkIdx(int32_t* pSinkIdx) { + +} + +void qptCreateSubplanDataSink(SDataSinkNode** ppOutput) { + static int32_t sinkIdx[sizeof(qptSink) / sizeof(qptSink[0])] = {-1}; + int32_t nodeIdx = 0; + + if (sinkIdx[0] < 0) { + qptBuildSinkIdx(sinkIdx); + } + + nodeIdx = taosRand() % (sizeof(sinkIdx)/sizeof(sinkIdx[0])); + + *ppOutput = (SDataSinkNode*)qptCreatePhysicalPlanNode(nodeIdx); +} + SNode* qptCreateSubplanNode(int32_t nodeType) { SSubplan* pSubplan = NULL; assert(0 == nodesMakeNode((ENodeType)nodeType, (SNode**)&pSubplan)); - qptGetSubplanId(&pSubplan->id); + pSubplan->id.queryId = qptCtx.param.plan.queryId; + pSubplan->id.groupId = taosRand() % QPT_MAX_SUBPLAN_GROUP; + pSubplan->id.subplanId = qptCtx.buildCtx.nextSubplanId++; - pSubplan->subplanType = QPT_CORRECT_HIGH_PROB() ? (taosRand() % SUBPLAN_TYPE_COMPUTE + 1) : (ESubplanType)taosRand(); + pSubplan->subplanType = QPT_CORRECT_HIGH_PROB() ? (ESubplanType)(taosRand() % SUBPLAN_TYPE_COMPUTE + 1) : (ESubplanType)taosRand(); pSubplan->msgType = qptGetRandSubplanMsgType(); - pSubplan->level = qptCtx.buildCtx.; - pDeleter->tableId = QPT_CORRECT_HIGH_PROB() ? qptCtx.param.tbl.uid : taosRand(); - pDeleter->tableType = QPT_CORRECT_HIGH_PROB() ? (QPT_RAND_BOOL_V ? TSDB_CHILD_TABLE : TSDB_NORMAL_TABLE) : (taosRand() % TSDB_TABLE_MAX); - if (QPT_CORRECT_HIGH_PROB()) { - sprintf(pDeleter->tableFName, "1.%s.%s", qptCtx.param.db.dbName, qptCtx.param.tbl.tblName); - } else { - pDeleter->tableFName[0] = QPT_RAND_BOOL_V ? 'a' : 0; - } + pSubplan->level = taosRand() % QPT_MAX_SUBPLAN_LEVEL; + sprintf(pSubplan->dbFName, "1.%s", qptCtx.param.db.dbName); + strcpy(pSubplan->user, qptCtx.param.userName); + pSubplan->execNode.nodeId = qptCtx.param.vnode.vgId; + memcpy(&pSubplan->execNode.epSet, &qptCtx.param.vnode.epSet, sizeof(pSubplan->execNode.epSet)); + pSubplan->execNodeStat.tableNum = taosRand(); - SQPTCol* pCol = nodesListGetNode(qptCtx.param.tbl.pColList, 0); - if (QPT_CORRECT_HIGH_PROB() && pCol) { - strcpy(pDeleter->tsColName, pCol->name); - } else { - pDeleter->tsColName[0] = QPT_RAND_BOOL_V ? 't' : 0; - } + qptCreatePhysiNodesTree(&pSubplan->pNode, NULL, 0); - qptGetRandTimeWindow(&pDeleter->deleteTimeRange); + qptCreateSubplanDataSink(&pSubplan->pDataSink); + + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? false : true, QPT_CORRECT_HIGH_PROB() ? true : false, QPT_RAND_BOOL_V, 0, NULL); + qptMakeExprNode(&pSubplan->pTagCond); + + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? false : true, QPT_CORRECT_HIGH_PROB() ? true : false, QPT_RAND_BOOL_V, 0, NULL); + qptMakeExprNode(&pSubplan->pTagIndexCond); + + pSubplan->showRewrite = QPT_RAND_BOOL_V; + pSubplan->isView = QPT_RAND_BOOL_V; + pSubplan->isAudit = QPT_RAND_BOOL_V; + pSubplan->dynamicRowThreshold = QPT_RAND_BOOL_V; + pSubplan->rowsThreshold = taosRand(); - return (SNode*)pDeleter; + return (SNode*)pSubplan; } @@ -2751,8 +2814,108 @@ SNode* qptCreatePhysicalPlanNode(int32_t nodeIdx) { return NULL; } -void qptCreateQueryPlan(SNode** ppPlan) { +SNode* qptCreateRealPhysicalPlanNode() { + int32_t nodeIdx = 0; + do { + nodeIdx = taosRand() % (sizeof(qptPlans) / sizeof(qptPlans[0])); + if (QPT_PLAN_PHYSIC != qptPlans[nodeIdx].classify) { + continue; + } + + return qptCreatePhysicalPlanNode(nodeIdx); + } while (true); +} + +void qptCreatePhysiNodesTree(SPhysiNode** ppRes, SPhysiNode* pParent, int32_t level) { + SPhysiNode* pNew = NULL; + if (level < QPT_MAX_SUBPLAN_LEVEL && (NULL == pParent || QPT_RAND_BOOL_V)) { + pNew = (SPhysiNode*)qptCreateRealPhysicalPlanNode(); + pNew->pParent = pParent; + int32_t childrenNum = taosRand() % QPT_MAX_LEVEL_SUBPLAN_NUM; + for (int32_t i = 0; i < childrenNum; ++i) { + qptCreatePhysiNodesTree(NULL, pNew, level + 1); + } + } else if (QPT_RAND_BOOL_V) { + return; + } + + if (pParent) { + qptNodesListMakeStrictAppend(&pParent->pChildren, (SNode*)pNew); + } else { + *ppRes = pNew; + } +} + +void qptAppendParentsSubplan(SNodeList* pParents, SNodeList* pNew) { + SNode* pNode = NULL; + FOREACH(pNode, pNew) { + if (NULL == pNode || QUERY_NODE_PHYSICAL_SUBPLAN != nodeType(pNode)) { + continue; + } + + qptNodesListMakeStrictAppend(&pParents, pNode); + } +} + +void qptSetSubplansRelation(SNodeList* pParents, SNodeList* pNew) { + int32_t parentIdx = 0; + SNode* pNode = NULL; + SSubplan* pChild = NULL; + SSubplan* pParent = NULL; + FOREACH(pNode, pNew) { + if (QPT_CORRECT_HIGH_PROB()) { + pChild = (SSubplan*)pNode; + parentIdx = taosRand() % pParents->length; + pParent = (SSubplan*)nodesListGetNode(pParents, parentIdx); + qptNodesListMakeStrictAppend(&pParent->pChildren, pNode); + qptNodesListMakeStrictAppend(&pChild->pParents, (SNode*)pParent); + } + } +} + +void qptBuildSubplansRelation(SNodeList* pList) { + SNode* pNode = NULL; + SNodeList* pParents = NULL; + FOREACH(pNode, pList) { + if (NULL == pNode || QUERY_NODE_NODE_LIST != nodeType(pNode)) { + continue; + } + + SNodeListNode* pNodeList = (SNodeListNode*)pNode; + + if (NULL == pParents) { + qptAppendParentsSubplan(pParents, pNodeList->pNodeList); + continue; + } + + qptSetSubplansRelation(pParents, pNodeList->pNodeList); + qptAppendParentsSubplan(pParents, pNodeList->pNodeList); + } +} + +SNode* qptCreateQueryPlanNode(int32_t nodeType) { + SQueryPlan* pPlan = NULL; + assert(0 == nodesMakeNode((ENodeType)nodeType, (SNode**)&pPlan)); + + int32_t subplanNum = 0, subplanLevelNum = taosRand() % QPT_MAX_SUBPLAN_LEVEL; + pPlan->queryId = QPT_CORRECT_HIGH_PROB() ? qptCtx.param.plan.queryId : taosRand(); + + for (int32_t l = 0; l < subplanLevelNum; ++l) { + qptInitMakeNodeCtx(QPT_CORRECT_HIGH_PROB() ? false : true, QPT_RAND_BOOL_V, QPT_RAND_BOOL_V, 0, NULL); + qptNodesListMakeStrictAppend(&pPlan->pSubplans, qptMakeNodeListNode(QPT_NODE_SUBPLAN, NULL)); + } + + pPlan->numOfSubplans = qptGetSubplanNum(pPlan->pSubplans); + qptBuildSubplansRelation(pPlan->pSubplans); + + pPlan->explainInfo.mode = (EExplainMode)(taosRand() % EXPLAIN_MODE_ANALYZE + 1); + pPlan->explainInfo.verbose = QPT_RAND_BOOL_V; + pPlan->explainInfo.ratio = taosRand(); + + pPlan->pPostPlan = QPT_RAND_BOOL_V ? NULL : (void*)0x1; + + return (SNode*)pPlan; } @@ -2913,6 +3076,7 @@ void qptInitTableCols(SNodeList** ppList, int32_t colNum, EColumnType colType) { void qptInitTestCtx(bool correctExpected, bool singleNode, int32_t nodeType, int32_t nodeIdx, int32_t paramNum, SQPTNodeParam* nodeParam) { qptCtx.param.correctExpected = correctExpected; qptCtx.param.schedulerId = taosRand(); + strcpy(qptCtx.param.userName, "user1"); qptCtx.param.plan.singlePhysiNode = singleNode; if (singleNode) { @@ -2967,10 +3131,7 @@ void qptInitTestCtx(bool correctExpected, bool singleNode, int32_t nodeType, int } qptCtx.buildCtx.nextBlockId++; - qptCtx.buildCtx.nextSubplanId.queryId = qptCtx.param.plan.queryId; - qptCtx.buildCtx.nextSubplanId.groupId++; - qptCtx.buildCtx.nextSubplanId.subplanId++; - qptCtx.buildCtx.currSubplanLevel = 0; + qptCtx.buildCtx.nextSubplanId++; } void qptDestroyTestCtx() { diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c index 77b39b8f0dfb..acb5c41d3801 100644 --- a/source/libs/nodes/src/nodesUtilFuncs.c +++ b/source/libs/nodes/src/nodesUtilFuncs.c @@ -1575,10 +1575,14 @@ void nodesDestroyNode(SNode* pNode) { case QUERY_NODE_PHYSICAL_PLAN_HASH_JOIN: { SHashJoinPhysiNode* pPhyNode = (SHashJoinPhysiNode*)pNode; destroyPhysiNode((SPhysiNode*)pPhyNode); + nodesDestroyNode(pPhyNode->pWindowOffset); + nodesDestroyNode(pPhyNode->pJLimit); nodesDestroyList(pPhyNode->pOnLeft); nodesDestroyList(pPhyNode->pOnRight); nodesDestroyNode(pPhyNode->leftPrimExpr); nodesDestroyNode(pPhyNode->rightPrimExpr); + nodesDestroyNode(pPhyNode->pLeftOnCond); + nodesDestroyNode(pPhyNode->pRightOnCond); nodesDestroyNode(pPhyNode->pFullOnCond); nodesDestroyList(pPhyNode->pTargets); @@ -1586,8 +1590,6 @@ void nodesDestroyNode(SNode* pNode) { nodesDestroyNode(pPhyNode->pColEqCond); nodesDestroyNode(pPhyNode->pTagEqCond); - nodesDestroyNode(pPhyNode->pLeftOnCond); - nodesDestroyNode(pPhyNode->pRightOnCond); break; } case QUERY_NODE_PHYSICAL_PLAN_HASH_AGG: { diff --git a/source/libs/scheduler/src/schJob.c b/source/libs/scheduler/src/schJob.c index 03145da93988..b888b826bbed 100644 --- a/source/libs/scheduler/src/schJob.c +++ b/source/libs/scheduler/src/schJob.c @@ -363,6 +363,11 @@ int32_t schValidateAndBuildJob(SQueryPlan *pDag, SSchJob *pJob) { SCH_ERR_JRET(TSDB_CODE_QRY_INVALID_INPUT); } + if (QUERY_NODE_NODE_LIST != nodeType(plans)) { + SCH_JOB_ELOG("invalid level plan, level:%d, planNodeType:%d", i, nodeType(plans)); + SCH_ERR_JRET(TSDB_CODE_QRY_INVALID_INPUT); + } + taskNum = (int32_t)LIST_LENGTH(plans->pNodeList); if (taskNum <= 0) { SCH_JOB_ELOG("invalid level plan number:%d, level:%d", taskNum, i); @@ -380,10 +385,20 @@ int32_t schValidateAndBuildJob(SQueryPlan *pDag, SSchJob *pJob) { for (int32_t n = 0; n < taskNum; ++n) { SSubplan *plan = (SSubplan *)nodesListGetNode(plans->pNodeList, n); if (NULL == plan) { - SCH_JOB_ELOG("fail to get the %dth subplan, taskNum: %d", n, taskNum); + SCH_JOB_ELOG("fail to get the %dth subplan, taskNum: %d, level: %d", n, taskNum, i); SCH_ERR_RET(TSDB_CODE_SCH_INTERNAL_ERROR); } + if (QUERY_NODE_PHYSICAL_SUBPLAN != nodeType(plan)) { + SCH_JOB_ELOG("invalid subplan type, level:%d, subplanNodeType:%d", i, nodeType(plan)); + SCH_ERR_JRET(TSDB_CODE_QRY_INVALID_INPUT); + } + + if (plan->subplanType < SUBPLAN_TYPE_MERGE || plan->subplanType > SUBPLAN_TYPE_COMPUTE) { + SCH_JOB_ELOG("invalid subplanType %d, level:%d, subplan idx:%d", plan->subplanType, i, n); + SCH_ERR_JRET(TSDB_CODE_QRY_INVALID_INPUT); + } + SCH_SET_JOB_TYPE(pJob, plan->subplanType); SSchTask task = {0}; From ccfe5246365487f3158a8ced9770bbea25a93b5e Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Fri, 18 Oct 2024 18:28:09 +0800 Subject: [PATCH 159/695] enh:[TS-5441] cost too long in tmq write meta data by cache meta and vg info --- source/client/src/clientRawBlockWrite.c | 35 ++++++++++++++++++++----- 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/source/client/src/clientRawBlockWrite.c b/source/client/src/clientRawBlockWrite.c index eb4eed8b6d65..d955fad15014 100644 --- a/source/client/src/clientRawBlockWrite.c +++ b/source/client/src/clientRawBlockWrite.c @@ -1724,8 +1724,15 @@ static int32_t buildCreateTbMap(SMqDataRsp* rsp, SHashObj* pHashObj) { return code; } +typedef enum { + WRITE_RAW_INIT_START = 0, + WRITE_RAW_INIT_OK, + WRITE_RAW_INIT_FAIL, +}; + static SHashObj* writeRawCache = NULL; static int8_t initFlag = 0; +static int8_t initedFlag = WRITE_RAW_INIT_START; typedef struct{ SHashObj* pVgHash; @@ -2276,15 +2283,31 @@ void tmq_free_raw(tmq_raw_data raw) { (void)memset(terrMsg, 0, ERR_MSG_LEN); } -static int32_t writeRawImpl(TAOS* taos, void* buf, uint32_t len, uint16_t type) { - int8_t old = atomic_val_compare_exchange_8(&initFlag, 0, 1); - if (old == 0) { - int32_t code = initRawCacheHash(); - if (code != 0) { - return code; +static int32_t writeRawInit(){ + while (atomic_load_8(&initedFlag) == WRITE_RAW_INIT_OK) { + int8_t old = atomic_val_compare_exchange_8(&initFlag, 0, 1); + if (old == 0) { + int32_t code = initRawCacheHash(); + if (code != 0) { + uError("tmq writeRawImpl init error:%d", code); + atomic_store_8(&initedFlag, WRITE_RAW_INIT_FAIL); + return code; + } + atomic_store_8(&initedFlag, WRITE_RAW_INIT_OK); } } + if (atomic_load_8(&initedFlag) == WRITE_RAW_INIT_FAIL){ + return TSDB_CODE_INTERNAL_ERROR; + } + return 0; +} + +static int32_t writeRawImpl(TAOS* taos, void* buf, uint32_t len, uint16_t type) { + if (writeRawInit() != 0) { + return TSDB_CODE_INTERNAL_ERROR; + } + if (type == TDMT_VND_CREATE_STB) { return taosCreateStb(taos, buf, len); } else if (type == TDMT_VND_ALTER_STB) { From a6f6d41297c1de50effe63a4003a92cd099f2a35 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Mon, 21 Oct 2024 09:25:22 +0800 Subject: [PATCH 160/695] enh:[TS-5441] cost too long in tmq write meta data by cache meta and vg info --- source/client/src/clientRawBlockWrite.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/client/src/clientRawBlockWrite.c b/source/client/src/clientRawBlockWrite.c index d955fad15014..59dcbdf2929c 100644 --- a/source/client/src/clientRawBlockWrite.c +++ b/source/client/src/clientRawBlockWrite.c @@ -1728,7 +1728,7 @@ typedef enum { WRITE_RAW_INIT_START = 0, WRITE_RAW_INIT_OK, WRITE_RAW_INIT_FAIL, -}; +} WRITE_RAW_INIT_STATUS; static SHashObj* writeRawCache = NULL; static int8_t initFlag = 0; From 1195396e4f32ea2b67d841b2bbfbd215c289245c Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Mon, 21 Oct 2024 09:54:30 +0800 Subject: [PATCH 161/695] adjust ci --- .../script/tsim/stream/streamInterpError.sim | 20 +++++++++---------- .../stream/streamInterpForceWindowClose.sim | 6 +++--- .../stream/streamInterpForceWindowClose1.sim | 6 +++--- tests/script/tsim/stream/streamTwaError.sim | 8 ++++---- tests/script/tsim/stream/streamTwaFwcFill.sim | 6 +++--- .../stream/streamTwaFwcFillPrimaryKey.sim | 4 ++-- .../tsim/stream/streamTwaFwcInterval.sim | 2 +- ...sim => streamTwaFwcIntervalPrimaryKey.sim} | 2 +- 8 files changed, 27 insertions(+), 27 deletions(-) rename tests/script/tsim/stream/{streamTwaFwcIntervalPrimaryKeyl.sim => streamTwaFwcIntervalPrimaryKey.sim} (97%) diff --git a/tests/script/tsim/stream/streamInterpError.sim b/tests/script/tsim/stream/streamInterpError.sim index e32f537c7b00..53a92df772e1 100644 --- a/tests/script/tsim/stream/streamInterpError.sim +++ b/tests/script/tsim/stream/streamInterpError.sim @@ -71,11 +71,11 @@ sql create stream streams2_6_3 trigger at_once FILL_HISTORY 1 IGNORE EXPIRED 0 I sql create stream streams2_6_4 trigger at_once FILL_HISTORY 1 IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_6_4 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(NULL); sql create stream streams2_6_5 trigger at_once FILL_HISTORY 1 IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_6_5 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(value,11,22,33,44); -sql_error create stream streams2_6_6 trigger force_window_close FILL_HISTORY 1 IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_6_6 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(prev); -sql_error create stream streams2_6_7 trigger force_window_close FILL_HISTORY 1 IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_6_7 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(next); -sql_error create stream streams2_6_8 trigger force_window_close FILL_HISTORY 1 IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_6_8 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(linear); -sql_error create stream streams2_6_9 trigger force_window_close FILL_HISTORY 1 IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_6_9 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(NULL); -sql_error create stream streams2_6_10 trigger force_window_close FILL_HISTORY 1 IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2_6_10 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(value,11,22,33,44); +sql_error create stream streams2_6_6 trigger force_window_close FILL_HISTORY 1 IGNORE EXPIRED 1 IGNORE UPDATE 1 into streamt2_6_6 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(prev); +sql_error create stream streams2_6_7 trigger force_window_close FILL_HISTORY 1 IGNORE EXPIRED 1 IGNORE UPDATE 1 into streamt2_6_7 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(next); +sql_error create stream streams2_6_8 trigger force_window_close FILL_HISTORY 1 IGNORE EXPIRED 1 IGNORE UPDATE 1 into streamt2_6_8 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(linear); +sql_error create stream streams2_6_9 trigger force_window_close FILL_HISTORY 1 IGNORE EXPIRED 1 IGNORE UPDATE 1 into streamt2_6_9 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(NULL); +sql_error create stream streams2_6_10 trigger force_window_close FILL_HISTORY 1 IGNORE EXPIRED 1 IGNORE UPDATE 1 into streamt2_6_10 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(value,11,22,33,44); run tsim/stream/checkTaskStatus.sim @@ -90,17 +90,17 @@ sql create table t2 using st tags(2,2,2); print step3_0 -sql create stream streams3_0_1 trigger force_window_close FILL_HISTORY 0 IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt3_0_1 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(prev); +sql create stream streams3_0_1 trigger force_window_close FILL_HISTORY 0 IGNORE EXPIRED 1 IGNORE UPDATE 1 into streamt3_0_1 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(prev); sleep 5000 -sql_error create stream streams3_0_2 trigger force_window_close FILL_HISTORY 0 IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt3_0_2 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(next); -sql_error create stream streams3_0_3 trigger force_window_close FILL_HISTORY 0 IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt3_0_3 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(linear); -sql create stream streams3_0_4 trigger force_window_close FILL_HISTORY 0 IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt3_0_4 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(NULL); +sql_error create stream streams3_0_2 trigger force_window_close FILL_HISTORY 0 IGNORE EXPIRED 1 IGNORE UPDATE 1 into streamt3_0_2 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(next); +sql_error create stream streams3_0_3 trigger force_window_close FILL_HISTORY 0 IGNORE EXPIRED 1 IGNORE UPDATE 1 into streamt3_0_3 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(linear); +sql create stream streams3_0_4 trigger force_window_close FILL_HISTORY 0 IGNORE EXPIRED 1 IGNORE UPDATE 1 into streamt3_0_4 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(NULL); sleep 5000 -sql create stream streams3_0_5 trigger force_window_close FILL_HISTORY 0 IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt3_0_5 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(value,11,22,33,44); +sql create stream streams3_0_5 trigger force_window_close FILL_HISTORY 0 IGNORE EXPIRED 1 IGNORE UPDATE 1 into streamt3_0_5 as select interp(a), _isfilled as a1, interp(b), _isfilled as a2, interp(c), _isfilled as a3, interp(d) from t1 every(1s) fill(value,11,22,33,44); run tsim/stream/checkTaskStatus.sim diff --git a/tests/script/tsim/stream/streamInterpForceWindowClose.sim b/tests/script/tsim/stream/streamInterpForceWindowClose.sim index 6580682b8d81..e96866b3e0df 100644 --- a/tests/script/tsim/stream/streamInterpForceWindowClose.sim +++ b/tests/script/tsim/stream/streamInterpForceWindowClose.sim @@ -10,7 +10,7 @@ sql create database test vgroups 1; sql use test; sql create table t1(ts timestamp, a int, b int , c int, d double); -sql create stream streams1 trigger force_window_close IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _irowts, interp(a) as a, interp(b) as b, now from t1 every(2s) fill(prev); +sql create stream streams1 trigger force_window_close IGNORE EXPIRED 1 IGNORE UPDATE 1 into streamt as select _irowts, interp(a) as a, interp(b) as b, now from t1 every(2s) fill(prev); run tsim/stream/checkTaskStatus.sim @@ -140,7 +140,7 @@ sql create database test2 vgroups 1; sql use test2; sql create table t1(ts timestamp, a int, b int , c int, d double); -sql create stream streams2 trigger force_window_close IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _irowts, interp(a) as a, interp(b) as b, now from t1 every(2s) fill(NULL); +sql create stream streams2 trigger force_window_close IGNORE EXPIRED 1 IGNORE UPDATE 1 into streamt as select _irowts, interp(a) as a, interp(b) as b, now from t1 every(2s) fill(NULL); run tsim/stream/checkTaskStatus.sim @@ -188,7 +188,7 @@ sql create database test3 vgroups 1; sql use test3; sql create table t1(ts timestamp, a int, b int , c int, d double); -sql create stream streams3 trigger force_window_close IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _irowts, interp(a) as a, interp(b) as b, now from t1 every(2s) fill(value,100,200); +sql create stream streams3 trigger force_window_close IGNORE EXPIRED 1 IGNORE UPDATE 1 into streamt as select _irowts, interp(a) as a, interp(b) as b, now from t1 every(2s) fill(value,100,200); run tsim/stream/checkTaskStatus.sim diff --git a/tests/script/tsim/stream/streamInterpForceWindowClose1.sim b/tests/script/tsim/stream/streamInterpForceWindowClose1.sim index 1de845f33100..e870e407f991 100644 --- a/tests/script/tsim/stream/streamInterpForceWindowClose1.sim +++ b/tests/script/tsim/stream/streamInterpForceWindowClose1.sim @@ -14,7 +14,7 @@ sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); sql create table t3 using st tags(2,2,2); -sql create stream streams1 trigger force_window_close IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _irowts, interp(a) as a, _isfilled, tbname, b, c from st partition by tbname, b,c every(5s) fill(prev); +sql create stream streams1 trigger force_window_close IGNORE EXPIRED 1 IGNORE UPDATE 1 into streamt as select _irowts, interp(a) as a, _isfilled, tbname, b, c from st partition by tbname, b,c every(5s) fill(prev); run tsim/stream/checkTaskStatus.sim @@ -326,7 +326,7 @@ sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); sql create table t3 using st tags(2,2,2); -sql create stream streams2 trigger force_window_close IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _irowts, interp(a) as a, _isfilled, tbname, b, c from st partition by tbname, b,c every(2s) fill(NULL); +sql create stream streams2 trigger force_window_close IGNORE EXPIRED 1 IGNORE UPDATE 1 into streamt as select _irowts, interp(a) as a, _isfilled, tbname, b, c from st partition by tbname, b,c every(2s) fill(NULL); run tsim/stream/checkTaskStatus.sim @@ -401,7 +401,7 @@ sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); sql create table t3 using st tags(2,2,2); -sql create stream streams3 trigger force_window_close IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _irowts, interp(a) as a, _isfilled, tbname, b, c from st partition by tbname, b,c every(2s) fill(value,100); +sql create stream streams3 trigger force_window_close IGNORE EXPIRED 1 IGNORE UPDATE 1 into streamt as select _irowts, interp(a) as a, _isfilled, tbname, b, c from st partition by tbname, b,c every(2s) fill(value,100); run tsim/stream/checkTaskStatus.sim diff --git a/tests/script/tsim/stream/streamTwaError.sim b/tests/script/tsim/stream/streamTwaError.sim index 2162c924e0b1..e9d89f927592 100644 --- a/tests/script/tsim/stream/streamTwaError.sim +++ b/tests/script/tsim/stream/streamTwaError.sim @@ -13,16 +13,16 @@ sql create stable st(ts timestamp, a int, b int , c int)tags(ta int,tb int,tc in sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams1 trigger force_window_close IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _wstart, twa(a) from st partition by tbname,ta interval(2s) fill(prev); +sql create stream streams1 trigger force_window_close IGNORE EXPIRED 1 IGNORE UPDATE 1 into streamt as select _wstart, twa(a) from st partition by tbname,ta interval(2s) fill(prev); sql_error create stream streams2 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2 as select _wstart, twa(a) from st partition by tbname,ta interval(2s) fill(prev); sql_error create stream streams3 trigger window_close IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt3 as select _wstart, twa(a) from st partition by tbname,ta interval(2s) fill(prev); sql_error create stream streams4 trigger max_delay 5s IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt4 as select _wstart, twa(a) from st partition by tbname,ta interval(2s) fill(prev); -sql_error create stream streams5 trigger force_window_close IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt5 as select _wstart, twa(a) from st interval(2s) fill(prev); +sql_error create stream streams5 trigger force_window_close IGNORE EXPIRED 1 IGNORE UPDATE 1 into streamt5 as select _wstart, twa(a) from st interval(2s) fill(prev); sql_error create stream streams6 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt6 as select last(ts), twa(a) from st partition by tbname,ta; -sql_error create stream streams7 trigger force_window_close IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt7 as select _wstart, twa(a) from st partition by tbname,ta session(ts, 2s); -sql_error create stream streams8 trigger force_window_close IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt8 as select _wstart, twa(a) from st partition by tbname,ta state_window(a); +sql_error create stream streams7 trigger force_window_close IGNORE EXPIRED 1 IGNORE UPDATE 1 into streamt7 as select _wstart, twa(a) from st partition by tbname,ta session(ts, 2s); +sql_error create stream streams8 trigger force_window_close IGNORE EXPIRED 1 IGNORE UPDATE 1 into streamt8 as select _wstart, twa(a) from st partition by tbname,ta state_window(a); print end diff --git a/tests/script/tsim/stream/streamTwaFwcFill.sim b/tests/script/tsim/stream/streamTwaFwcFill.sim index 009798bd676c..6a742a317890 100644 --- a/tests/script/tsim/stream/streamTwaFwcFill.sim +++ b/tests/script/tsim/stream/streamTwaFwcFill.sim @@ -13,7 +13,7 @@ sql create stable st(ts timestamp, a int, b int , c int)tags(ta int,tb int,tc in sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams1 trigger force_window_close IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _wstart, twa(a), twa(b), elapsed(ts), now ,timezone(), ta from st partition by tbname,ta interval(2s) fill(prev); +sql create stream streams1 trigger force_window_close IGNORE EXPIRED 1 IGNORE UPDATE 1 into streamt as select _wstart, twa(a), twa(b), elapsed(ts), now ,timezone(), ta from st partition by tbname,ta interval(2s) fill(prev); run tsim/stream/checkTaskStatus.sim @@ -103,7 +103,7 @@ sql use test2; sql create stable st(ts timestamp, a int, b int , c int)tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams2 trigger force_window_close IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _wstart, twa(a), twa(b), elapsed(ts), now ,timezone(), ta from st partition by tbname interval(2s) fill(NULL); +sql create stream streams2 trigger force_window_close IGNORE EXPIRED 1 IGNORE UPDATE 1 into streamt as select _wstart, twa(a), twa(b), elapsed(ts), now ,timezone(), ta from st partition by tbname interval(2s) fill(NULL); run tsim/stream/checkTaskStatus.sim @@ -192,7 +192,7 @@ sql use test3; sql create stable st(ts timestamp, a int, b int , c int)tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams3 trigger force_window_close IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _wstart, twa(a), twa(b), elapsed(ts), now ,timezone(), ta from st partition by tbname interval(2s) fill(value,100,200,300); +sql create stream streams3 trigger force_window_close IGNORE EXPIRED 1 IGNORE UPDATE 1 into streamt as select _wstart, twa(a), twa(b), elapsed(ts), now ,timezone(), ta from st partition by tbname interval(2s) fill(value,100,200,300); run tsim/stream/checkTaskStatus.sim diff --git a/tests/script/tsim/stream/streamTwaFwcFillPrimaryKey.sim b/tests/script/tsim/stream/streamTwaFwcFillPrimaryKey.sim index e3c967aaeff3..4282518c9c84 100644 --- a/tests/script/tsim/stream/streamTwaFwcFillPrimaryKey.sim +++ b/tests/script/tsim/stream/streamTwaFwcFillPrimaryKey.sim @@ -13,7 +13,7 @@ sql create stable st(ts timestamp, a int primary key, b int , c int)tags(ta int, sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams1 trigger force_window_close IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _wstart, twa(b), count(*),ta from st partition by tbname, ta interval(2s) fill(prev); +sql create stream streams1 trigger force_window_close IGNORE EXPIRED 1 IGNORE UPDATE 1 into streamt as select _wstart, twa(b), count(*),ta from st partition by tbname, ta interval(2s) fill(prev); run tsim/stream/checkTaskStatus.sim @@ -121,7 +121,7 @@ sql use test2; sql create stable st(ts timestamp, a int primary key, b int , c int)tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams2 trigger force_window_close IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _wstart, twa(b), ta from st partition by tbname, ta interval(2s) fill(NULL); +sql create stream streams2 trigger force_window_close IGNORE EXPIRED 1 IGNORE UPDATE 1 into streamt as select _wstart, twa(b), ta from st partition by tbname, ta interval(2s) fill(NULL); run tsim/stream/checkTaskStatus.sim diff --git a/tests/script/tsim/stream/streamTwaFwcInterval.sim b/tests/script/tsim/stream/streamTwaFwcInterval.sim index 85e4bb552b1e..1a2b5f1e5aeb 100644 --- a/tests/script/tsim/stream/streamTwaFwcInterval.sim +++ b/tests/script/tsim/stream/streamTwaFwcInterval.sim @@ -13,7 +13,7 @@ sql create stable st(ts timestamp, a int, b int , c int)tags(ta int,tb int,tc in sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams1 trigger force_window_close IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _wstart, twa(a), ta from st partition by tbname,ta interval(2s); +sql create stream streams1 trigger force_window_close IGNORE EXPIRED 1 IGNORE UPDATE 1 into streamt as select _wstart, twa(a), ta from st partition by tbname,ta interval(2s); run tsim/stream/checkTaskStatus.sim diff --git a/tests/script/tsim/stream/streamTwaFwcIntervalPrimaryKeyl.sim b/tests/script/tsim/stream/streamTwaFwcIntervalPrimaryKey.sim similarity index 97% rename from tests/script/tsim/stream/streamTwaFwcIntervalPrimaryKeyl.sim rename to tests/script/tsim/stream/streamTwaFwcIntervalPrimaryKey.sim index a1952859674c..13de9eff317f 100644 --- a/tests/script/tsim/stream/streamTwaFwcIntervalPrimaryKeyl.sim +++ b/tests/script/tsim/stream/streamTwaFwcIntervalPrimaryKey.sim @@ -13,7 +13,7 @@ sql create stable st(ts timestamp, a int primary key, b int , c int)tags(ta int, sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams1 trigger force_window_close IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _wstart, count(*), ta from st partition by tbname,ta interval(2s); +sql create stream streams1 trigger force_window_close IGNORE EXPIRED 1 IGNORE UPDATE 1 into streamt as select _wstart, count(*), ta from st partition by tbname,ta interval(2s); run tsim/stream/checkTaskStatus.sim From c2a5325a6f36fcfd52017145940020f7142f7fda Mon Sep 17 00:00:00 2001 From: qevolg <2227465945@qq.com> Date: Mon, 21 Oct 2024 13:45:11 +0800 Subject: [PATCH 162/695] chore(*): modify taoskeeper build process --- packaging/tools/make_install.sh | 2 +- tools/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/tools/make_install.sh b/packaging/tools/make_install.sh index f395909d382b..b23c675e1042 100755 --- a/packaging/tools/make_install.sh +++ b/packaging/tools/make_install.sh @@ -645,7 +645,7 @@ function update_TDengine() { install_config install_taosadapter_config - install_taoskeeper_service + install_taoskeeper_config echo echo -e "\033[44;32;1m${productName} is updated successfully!${NC}" diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 832bd68899dd..686beb39dee7 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -252,5 +252,5 @@ IF(TD_BUILD_KEEPER) ) ENDIF() ELSEIF(TD_BUILD_KEEPER_INTERNAL) - MESSAGE("${Yellow} use taoskeeper internal ${ColourReset}") + MESSAGE("${Yellow} taoskeeper community edition does not support ${ColourReset}") ENDIF() From 41a7dce0df12eb7e4daedbd772e58f2e4aa347ce Mon Sep 17 00:00:00 2001 From: qevolg <2227465945@qq.com> Date: Mon, 21 Oct 2024 14:00:46 +0800 Subject: [PATCH 163/695] chore(tools): modify taoskeeper message --- tools/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 686beb39dee7..e294067ff5c0 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -252,5 +252,5 @@ IF(TD_BUILD_KEEPER) ) ENDIF() ELSEIF(TD_BUILD_KEEPER_INTERNAL) - MESSAGE("${Yellow} taoskeeper community edition does not support ${ColourReset}") + MESSAGE("${Yellow} taoskeeper does not support internal option ${ColourReset}") ENDIF() From 02c16bddc6dd76f3efc8f0043bae29d720b32725 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Mon, 21 Oct 2024 14:40:49 +0800 Subject: [PATCH 164/695] enh:[TS-5441] cost too long in tmq write meta data by cache meta and vg info --- source/client/src/clientRawBlockWrite.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/client/src/clientRawBlockWrite.c b/source/client/src/clientRawBlockWrite.c index 59dcbdf2929c..22de6e4a75f6 100644 --- a/source/client/src/clientRawBlockWrite.c +++ b/source/client/src/clientRawBlockWrite.c @@ -1969,8 +1969,8 @@ static int32_t tmqWriteRawDataImpl(TAOS* taos, void* data, int32_t dataLen){ tstrncpy(pName.tname, tbName, TSDB_TABLE_NAME_LEN); STableMeta* pTableMeta = NULL; - processCacheMeta(pVgHash, pNameHash, pMetaHash, NULL, pCatalog, &conn, - &pName, &pTableMeta, pSW, rawData, retry); + RAW_RETURN_CHECK(processCacheMeta(pVgHash, pNameHash, pMetaHash, NULL, pCatalog, &conn, + &pName, &pTableMeta, pSW, rawData, retry)); char err[ERR_MSG_LEN] = {0}; code = rawBlockBindData(pQuery, pTableMeta, rawData, NULL, pSW, pSW->nCols, true, err, ERR_MSG_LEN, true); if (code != TSDB_CODE_SUCCESS) { @@ -2050,8 +2050,8 @@ static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, int32_t dataLen) // find schema data info SVCreateTbReq* pCreateReqDst = (SVCreateTbReq*)taosHashGet(pCreateTbHash, pName.tname, strlen(pName.tname)); STableMeta* pTableMeta = NULL; - processCacheMeta(pVgHash, pNameHash, pMetaHash, pCreateReqDst, pCatalog, &conn, - &pName, &pTableMeta, pSW, rawData, retry); + RAW_RETURN_CHECK(processCacheMeta(pVgHash, pNameHash, pMetaHash, pCreateReqDst, pCatalog, &conn, + &pName, &pTableMeta, pSW, rawData, retry)); char err[ERR_MSG_LEN] = {0}; code = rawBlockBindData(pQuery, pTableMeta, rawData, pCreateReqDst, pSW, pSW->nCols, true, err, ERR_MSG_LEN, true); if (code != TSDB_CODE_SUCCESS) { From 118d079cbf6f9724649db933493c5ff62eff8a4f Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Mon, 21 Oct 2024 15:08:59 +0800 Subject: [PATCH 165/695] adj ci --- tests/script/tsim/stream/streamTwaFwcInterval.sim | 4 ++-- tests/script/tsim/stream/streamTwaFwcIntervalPrimaryKey.sim | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/script/tsim/stream/streamTwaFwcInterval.sim b/tests/script/tsim/stream/streamTwaFwcInterval.sim index 1a2b5f1e5aeb..d439bdccb39c 100644 --- a/tests/script/tsim/stream/streamTwaFwcInterval.sim +++ b/tests/script/tsim/stream/streamTwaFwcInterval.sim @@ -83,7 +83,7 @@ endi if $data11 != $query1_data11 then print ======data11========$data11 print ======query1_data11=$query1_data11 - return -1 + return loop0 endi $loop_count = 0 @@ -121,7 +121,7 @@ endi if $data11 != $query2_data11 then print ======data11======$data11 print ====query2_data11=$query2_data11 - return -1 + return loop1 endi print end diff --git a/tests/script/tsim/stream/streamTwaFwcIntervalPrimaryKey.sim b/tests/script/tsim/stream/streamTwaFwcIntervalPrimaryKey.sim index 13de9eff317f..cc1a04c4091c 100644 --- a/tests/script/tsim/stream/streamTwaFwcIntervalPrimaryKey.sim +++ b/tests/script/tsim/stream/streamTwaFwcIntervalPrimaryKey.sim @@ -65,7 +65,7 @@ endi if $data11 != 2 then print ======data11=$data11 - return -1 + return loop0 endi $loop_count = 0 @@ -101,7 +101,7 @@ endi if $data11 != 2 then print ======data11=$data11 - return -1 + return loop1 endi print end From 4efae71832e95d1c96110aed371b37b27576d3b6 Mon Sep 17 00:00:00 2001 From: qevolg <2227465945@qq.com> Date: Mon, 21 Oct 2024 16:28:06 +0800 Subject: [PATCH 166/695] chore(*): add taoskeeper CI for Windows and Darwin platforms --- packaging/tools/make_install.bat | 20 +++++++++++++- tools/CMakeLists.txt | 45 +++++++++++++++++++++++++++++++- 2 files changed, 63 insertions(+), 2 deletions(-) diff --git a/packaging/tools/make_install.bat b/packaging/tools/make_install.bat index 0b2a55b89c23..55b55eacde6f 100644 --- a/packaging/tools/make_install.bat +++ b/packaging/tools/make_install.bat @@ -13,8 +13,10 @@ if exist C:\\TDengine\\data\\dnode\\dnodeCfg.json ( rem // stop and delete service mshta vbscript:createobject("shell.application").shellexecute("%~s0",":stop_delete","","runas",1)(window.close) echo This might take a few moment to accomplish deleting service taosd/taosadapter ... +echo This might take a few moment to accomplish deleting service taosd/taoskeeper ... call :check_svc taosd call :check_svc taosadapter +call :check_svc taoskeeper set source_dir=%2 set source_dir=%source_dir:/=\\% @@ -46,6 +48,11 @@ if exist %binary_dir%\\test\\cfg\\taosadapter.toml ( copy %binary_dir%\\test\\cfg\\taosadapter.toml %target_dir%\\cfg\\taosadapter.toml > nul ) ) +if exist %binary_dir%\\test\\cfg\\taoskeeper.toml ( + if not exist %target_dir%\\cfg\\taoskeeper.toml ( + copy %binary_dir%\\test\\cfg\\taoskeeper.toml %target_dir%\\cfg\\taoskeeper.toml > nul + ) +) copy %source_dir%\\include\\client\\taos.h %target_dir%\\include > nul copy %source_dir%\\include\\util\\taoserror.h %target_dir%\\include > nul copy %source_dir%\\include\\libs\\function\\taosudf.h %target_dir%\\include > nul @@ -98,12 +105,15 @@ if %Enterprise% == TRUE ( copy %binary_dir%\\build\\bin\\*explorer.exe %target_dir% > nul ) ) - + copy %binary_dir%\\build\\bin\\taosd.exe %target_dir% > nul copy %binary_dir%\\build\\bin\\udfd.exe %target_dir% > nul if exist %binary_dir%\\build\\bin\\taosadapter.exe ( copy %binary_dir%\\build\\bin\\taosadapter.exe %target_dir% > nul ) +if exist %binary_dir%\\build\\bin\\taoskeeper.exe ( + copy %binary_dir%\\build\\bin\\taoskeeper.exe %target_dir% > nul +) mshta vbscript:createobject("shell.application").shellexecute("%~s0",":hasAdmin","","runas",1)(window.close) @@ -116,6 +126,10 @@ if exist %binary_dir%\\build\\bin\\taosadapter.exe ( echo To start/stop taosAdapter with administrator privileges: %ESC%[92msc start/stop taosadapter %ESC%[0m ) +if exist %binary_dir%\\build\\bin\\taoskeeper.exe ( + echo To start/stop taosKeeper with administrator privileges: %ESC%[92msc start/stop taoskeeper %ESC%[0m +) + goto :eof :hasAdmin @@ -123,6 +137,7 @@ goto :eof call :stop_delete call :check_svc taosd call :check_svc taosadapter +call :check_svc taoskeeper if exist c:\\windows\\sysnative ( echo x86 @@ -141,6 +156,7 @@ if exist c:\\windows\\sysnative ( rem // create services sc create "taosd" binPath= "C:\\TDengine\\taosd.exe --win_service" start= DEMAND sc create "taosadapter" binPath= "C:\\TDengine\\taosadapter.exe" start= DEMAND +sc create "taoskeeper" binPath= "C:\\TDengine\\taoskeeper.exe" start= DEMAND set "env=HKLM\System\CurrentControlSet\Control\Session Manager\Environment" for /f "tokens=2*" %%I in ('reg query "%env%" /v Path ^| findstr /i "\"') do ( @@ -181,6 +197,8 @@ sc stop taosd sc delete taosd sc stop taosadapter sc delete taosadapter +sc stop taoskeeper +sc delete taoskeeper exit /B 0 :check_svc diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index e294067ff5c0..a4867612e4c2 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -229,7 +229,50 @@ IF(TD_BUILD_KEEPER) MESSAGE("${Green} taoskeeper will use ${taos_version} and commit ${taoskeeper_commit_sha1} as version ${ColourReset}") MESSAGE(" current source dir is ${CMAKE_CURRENT_SOURCE_DIR}") - IF(TD_LINUX) + IF(TD_WINDOWS) + MESSAGE("Building taoskeeper on Windows") + INCLUDE(ExternalProject) + ExternalProject_Add(taoskeeper + PREFIX "taoskeeper" + SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/keeper + BUILD_ALWAYS off + BUILD_IN_SOURCE 1 + CONFIGURE_COMMAND cmake -E echo "taoskeeper no need cmake to config" + PATCH_COMMAND + COMMAND git clean -f -d + BUILD_COMMAND + COMMAND go build -a -ldflags "-X 'github.com/taosdata/taoskeeper/version.Version=${taos_version}' -X 'github.com/taosdata/taoskeeper/version.CommitID=${taoskeeper_commit_sha1}' -X 'github.com/taosdata/taoskeeper/version.BuildInfo=${TD_VER_OSTYPE}-${TD_VER_CPUTYPE} ${TD_VER_DATE}'" + INSTALL_COMMAND + COMMAND cmake -E echo "Comparessing taoskeeper.exe" + COMMAND cmake -E time upx taoskeeper.exe + COMMAND cmake -E echo "Copy taoskeeper.exe" + COMMAND cmake -E copy taoskeeper.exe ${CMAKE_BINARY_DIR}/build/bin/taoskeeper.exe + COMMAND cmake -E make_directory ${CMAKE_BINARY_DIR}/test/cfg/ + COMMAND cmake -E echo "Copy taoskeeper.toml" + COMMAND cmake -E copy ./config/taoskeeper.toml ${CMAKE_BINARY_DIR}/test/cfg/ + ) + ELSEIF(TD_DARWIN) + MESSAGE("Building taoskeeper on macOS") + INCLUDE(ExternalProject) + ExternalProject_Add(taoskeeper + PREFIX "taoskeeper" + SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/keeper + BUILD_ALWAYS off + BUILD_IN_SOURCE 1 + CONFIGURE_COMMAND cmake -E echo "taoskeeper no need cmake to config" + PATCH_COMMAND + COMMAND git clean -f -d + BUILD_COMMAND + COMMAND go build -a -ldflags "-X 'github.com/taosdata/taoskeeper/version.Version=${taos_version}' -X 'github.com/taosdata/taoskeeper/version.CommitID=${taoskeeper_commit_sha1}' -X 'github.com/taosdata/taoskeeper/version.BuildInfo=${TD_VER_OSTYPE}-${TD_VER_CPUTYPE} ${TD_VER_DATE}'" + INSTALL_COMMAND + COMMAND cmake -E echo "Copy taoskeeper" + COMMAND cmake -E copy taoskeeper ${CMAKE_BINARY_DIR}/build/bin + COMMAND cmake -E make_directory ${CMAKE_BINARY_DIR}/test/cfg/ + COMMAND cmake -E echo "Copy taoskeeper.toml" + COMMAND cmake -E copy ./config/taoskeeper.toml ${CMAKE_BINARY_DIR}/test/cfg/ + COMMAND cmake -E copy ./taoskeeper.service ${CMAKE_BINARY_DIR}/test/cfg/ + ) + ELSE() MESSAGE("Building taoskeeper on Linux") INCLUDE(ExternalProject) ExternalProject_Add(taoskeeper From eaae6d4bfda93383a1b7c30d64e987eda79ee93f Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Mon, 21 Oct 2024 17:30:12 +0800 Subject: [PATCH 167/695] enh:[TD-32166]refactor code in sml --- source/client/inc/clientSml.h | 24 +- source/client/src/clientSml.c | 1218 ++++++++----------------- source/client/src/clientSmlJson.c | 68 +- source/client/src/clientSmlLine.c | 26 +- source/client/src/clientSmlTelnet.c | 36 +- source/client/test/smlTest.cpp | 98 ++ source/libs/parser/src/parInsertSml.c | 23 +- 7 files changed, 590 insertions(+), 903 deletions(-) diff --git a/source/client/inc/clientSml.h b/source/client/inc/clientSml.h index a6aca2fddf64..3098b124b77c 100644 --- a/source/client/inc/clientSml.h +++ b/source/client/inc/clientSml.h @@ -92,6 +92,22 @@ extern "C" { } \ } +#define SML_CHECK_CODE(CMD) \ + do { \ + code = (CMD); \ + if (TSDB_CODE_SUCCESS != code) { \ + goto END; \ + } \ + } while (0) + +#define SML_CHECK_NULL(CMD) \ + do { \ + if (NULL == (CMD)) { \ + code = terrno; \ + goto END; \ + } \ + } while (0) + typedef enum { SCHEMA_ACTION_NULL, SCHEMA_ACTION_CREATE_STABLE, @@ -211,13 +227,10 @@ typedef struct { extern int64_t smlFactorNS[]; extern int64_t smlFactorS[]; -typedef int32_t (*_equal_fn_sml)(const void *, const void *); - int32_t smlBuildSmlInfo(TAOS *taos, SSmlHandle **handle); void smlDestroyInfo(SSmlHandle *info); int smlJsonParseObjFirst(char **start, SSmlLineInfo *element, int8_t *offset); -int smlJsonParseObj(char **start, SSmlLineInfo *element, int8_t *offset); -bool smlParseNumberOld(SSmlKv *kvVal, SSmlMsgBuf *msg); +int smlJsonParseObj(char **start, char *end, SSmlLineInfo *element, int8_t *offset); void smlBuildInvalidDataMsg(SSmlMsgBuf *pBuf, const char *msg1, const char *msg2); int32_t smlParseNumber(SSmlKv *kvVal, SSmlMsgBuf *msg); int64_t smlGetTimeValue(const char *value, int32_t len, uint8_t fromPrecision, uint8_t toPrecision); @@ -246,7 +259,8 @@ int32_t smlProcessChildTable(SSmlHandle *info, SSmlLineInfo *elements); int32_t smlProcessSuperTable(SSmlHandle *info, SSmlLineInfo *elements); int32_t smlJoinMeasureTag(SSmlLineInfo *elements); void smlBuildTsKv(SSmlKv *kv, int64_t ts); -int32_t smlParseEndTelnetJson(SSmlHandle *info, SSmlLineInfo *elements, SSmlKv *kvTs, SSmlKv *kv); +int32_t smlParseEndTelnetJsonFormat(SSmlHandle *info, SSmlLineInfo *elements, SSmlKv *kvTs, SSmlKv *kv); +int32_t smlParseEndTelnetJsonUnFormat(SSmlHandle *info, SSmlLineInfo *elements, SSmlKv *kvTs, SSmlKv *kv); int32_t smlParseEndLine(SSmlHandle *info, SSmlLineInfo *elements, SSmlKv *kvTs); static inline bool smlDoubleToInt64OverFlow(double num) { diff --git a/source/client/src/clientSml.c b/source/client/src/clientSml.c index 80f583bbee76..25abeb52fbb1 100644 --- a/source/client/src/clientSml.c +++ b/source/client/src/clientSml.c @@ -104,6 +104,9 @@ kvVal->type = TSDB_DATA_TYPE_UTINYINT; \ kvVal->u = result; +#define IS_COMMENT(protocol,data) \ + (protocol == TSDB_SML_LINE_PROTOCOL && data == '#') + int64_t smlToMilli[] = {3600000LL, 60000LL, 1000LL}; int64_t smlFactorNS[] = {NANOSECOND_PER_MSEC, NANOSECOND_PER_USEC, 1}; int64_t smlFactorS[] = {1000LL, 1000000LL, 1000000000LL}; @@ -224,6 +227,7 @@ int32_t smlBuildSuperTableInfo(SSmlHandle *info, SSmlLineInfo *currElement, SSml if (code != TSDB_CODE_SUCCESS) { info->dataFormat = false; info->reRun = true; + taosMemoryFreeClear(pTableMeta); return code; } code = smlBuildSTableMeta(info->dataFormat, sMeta); @@ -305,7 +309,6 @@ bool isSmlTagAligned(SSmlHandle *info, int cnt, SSmlKv *kv) { goto END; } SSmlKv *maxKV = (SSmlKv *)taosArrayGet(info->maxTagKVs, cnt); - if (maxKV == NULL) { goto END; } @@ -380,49 +383,23 @@ int32_t smlProcessChildTable(SSmlHandle *info, SSmlLineInfo *elements) { (SSmlTableInfo **)taosHashGet(info->childTables, elements->measureTag, elements->measureTagsLen); SSmlTableInfo *tinfo = NULL; if (unlikely(oneTable == NULL)) { - code = smlBuildTableInfo(1, elements->measure, elements->measureLen, &tinfo); - if (code != TSDB_CODE_SUCCESS) { - return code; - } - code = taosHashPut(info->childTables, elements->measureTag, elements->measureTagsLen, &tinfo, POINTER_BYTES); - if (code != 0) { - smlDestroyTableInfo(&tinfo); - return code; - } + SML_CHECK_CODE(smlBuildTableInfo(1, elements->measure, elements->measureLen, &tinfo)); + SML_CHECK_CODE(taosHashPut(info->childTables, elements->measureTag, elements->measureTagsLen, &tinfo, POINTER_BYTES)); tinfo->tags = taosArrayDup(info->preLineTagKV, NULL); - if (tinfo->tags == NULL) { - smlDestroyTableInfo(&tinfo); - return terrno; - } + SML_CHECK_NULL(tinfo->tags); for (size_t i = 0; i < taosArrayGetSize(info->preLineTagKV); i++) { SSmlKv *kv = (SSmlKv *)taosArrayGet(info->preLineTagKV, i); - if (kv == NULL) { - smlDestroyTableInfo(&tinfo); - return TSDB_CODE_SML_INVALID_DATA; - } + SML_CHECK_NULL(kv); if (kv->keyEscaped) kv->key = NULL; if (kv->valueEscaped) kv->value = NULL; } - code = smlSetCTableName(tinfo, info->tbnameKey); - if (code != TSDB_CODE_SUCCESS) { - smlDestroyTableInfo(&tinfo); - return code; - } - code = getTableUid(info, elements, tinfo); - if (code != TSDB_CODE_SUCCESS) { - smlDestroyTableInfo(&tinfo); - return code; - } + SML_CHECK_CODE(smlSetCTableName(tinfo, info->tbnameKey)); + SML_CHECK_CODE(getTableUid(info, elements, tinfo)); if (info->dataFormat) { info->currSTableMeta->uid = tinfo->uid; - code = smlInitTableDataCtx(info->pQuery, info->currSTableMeta, &tinfo->tableDataCtx); - if (code != TSDB_CODE_SUCCESS) { - smlBuildInvalidDataMsg(&info->msgBuf, "smlInitTableDataCtx error", NULL); - smlDestroyTableInfo(&tinfo); - return code; - } + SML_CHECK_CODE(smlInitTableDataCtx(info->pQuery, info->currSTableMeta, &tinfo->tableDataCtx)); } } else { tinfo = *oneTable; @@ -433,41 +410,41 @@ int32_t smlProcessChildTable(SSmlHandle *info, SSmlLineInfo *elements) { } if (info->dataFormat) info->currTableDataCtx = tinfo->tableDataCtx; return TSDB_CODE_SUCCESS; + +END: + smlDestroyTableInfo(&tinfo); + return code; } -int32_t smlParseEndTelnetJson(SSmlHandle *info, SSmlLineInfo *elements, SSmlKv *kvTs, SSmlKv *kv) { - if (info->dataFormat) { - uDebug("SML:0x%" PRIx64 " smlParseEndTelnetJson format true, ts:%" PRId64, info->id, kvTs->i); - int32_t ret = smlBuildCol(info->currTableDataCtx, info->currSTableMeta->schema, kvTs, 0); - if (ret == TSDB_CODE_SUCCESS) { - ret = smlBuildCol(info->currTableDataCtx, info->currSTableMeta->schema, kv, 1); - } - if (ret == TSDB_CODE_SUCCESS) { - ret = smlBuildRow(info->currTableDataCtx); - } - clearColValArraySml(info->currTableDataCtx->pValues); - if (unlikely(ret != TSDB_CODE_SUCCESS)) { - smlBuildInvalidDataMsg(&info->msgBuf, "smlBuildCol error", NULL); - return ret; - } - } else { - uDebug("SML:0x%" PRIx64 " smlParseEndTelnetJson format false, ts:%" PRId64, info->id, kvTs->i); - if (elements->colArray == NULL) { - elements->colArray = taosArrayInit(16, sizeof(SSmlKv)); - if (elements->colArray == NULL) { - return terrno; - } - } - if (taosArrayPush(elements->colArray, kvTs) == NULL) { - return terrno; - } - if (taosArrayPush(elements->colArray, kv) == NULL) { - return terrno; - } +int32_t smlParseEndTelnetJsonFormat(SSmlHandle *info, SSmlLineInfo *elements, SSmlKv *kvTs, SSmlKv *kv) { + int32_t code = 0; + uDebug("SML:0x%" PRIx64 " smlParseEndTelnetJson format true, ts:%" PRId64, info->id, kvTs->i); + SML_CHECK_CODE(smlBuildCol(info->currTableDataCtx, info->currSTableMeta->schema, kvTs, 0)); + SML_CHECK_CODE(smlBuildCol(info->currTableDataCtx, info->currSTableMeta->schema, kv, 1)); + SML_CHECK_CODE(smlBuildRow(info->currTableDataCtx)); + + info->preLine = *elements; +END: + clearColValArraySml(info->currTableDataCtx->pValues); + if (unlikely(code != TSDB_CODE_SUCCESS)) { + smlBuildInvalidDataMsg(&info->msgBuf, "smlBuildCol error", NULL); + } + return code; +} + +int32_t smlParseEndTelnetJsonUnFormat(SSmlHandle *info, SSmlLineInfo *elements, SSmlKv *kvTs, SSmlKv *kv) { + int32_t code = 0; + uDebug("SML:0x%" PRIx64 " smlParseEndTelnetJson format false, ts:%" PRId64, info->id, kvTs->i); + if (elements->colArray == NULL) { + elements->colArray = taosArrayInit(16, sizeof(SSmlKv)); + SML_CHECK_NULL(elements->colArray); } + SML_CHECK_NULL(taosArrayPush(elements->colArray, kvTs)); + SML_CHECK_NULL (taosArrayPush(elements->colArray, kv)); info->preLine = *elements; - return TSDB_CODE_SUCCESS; +END: + return code; } int32_t smlParseEndLine(SSmlHandle *info, SSmlLineInfo *elements, SSmlKv *kvTs) { @@ -494,15 +471,14 @@ int32_t smlParseEndLine(SSmlHandle *info, SSmlLineInfo *elements, SSmlKv *kvTs) } static int32_t smlParseTableName(SArray *tags, char *childTableName, char *tbnameKey) { + int32_t code = 0; bool autoChildName = false; size_t delimiter = strlen(tsSmlAutoChildTableNameDelimiter); if (delimiter > 0 && tbnameKey == NULL) { size_t totalNameLen = delimiter * (taosArrayGetSize(tags) - 1); for (int i = 0; i < taosArrayGetSize(tags); i++) { SSmlKv *tag = (SSmlKv *)taosArrayGet(tags, i); - if (tag == NULL) { - return TSDB_CODE_SML_INVALID_DATA; - } + SML_CHECK_NULL(tag); totalNameLen += tag->length; } if (totalNameLen < TSDB_TABLE_NAME_LEN) { @@ -513,9 +489,7 @@ static int32_t smlParseTableName(SArray *tags, char *childTableName, char *tbnam (void)memset(childTableName, 0, TSDB_TABLE_NAME_LEN); for (int i = 0; i < taosArrayGetSize(tags); i++) { SSmlKv *tag = (SSmlKv *)taosArrayGet(tags, i); - if (tag == NULL) { - return TSDB_CODE_SML_INVALID_DATA; - } + SML_CHECK_NULL(tag); (void)strncat(childTableName, tag->value, TMIN(tag->length, TSDB_TABLE_NAME_LEN - 1 - strlen(childTableName))); if (i != taosArrayGetSize(tags) - 1) { (void)strncat(childTableName, tsSmlAutoChildTableNameDelimiter, TSDB_TABLE_NAME_LEN - 1 - strlen(childTableName)); @@ -533,9 +507,7 @@ static int32_t smlParseTableName(SArray *tags, char *childTableName, char *tbnam for (int i = 0; i < taosArrayGetSize(tags); i++) { SSmlKv *tag = (SSmlKv *)taosArrayGet(tags, i); - if (tag == NULL) { - return TSDB_CODE_SML_INVALID_DATA; - } + SML_CHECK_NULL(tag); // handle child table name if (childTableNameLen == tag->keyLen && strncmp(tag->key, tbnameKey, tag->keyLen) == 0) { (void)memset(childTableName, 0, TSDB_TABLE_NAME_LEN); @@ -549,24 +521,22 @@ static int32_t smlParseTableName(SArray *tags, char *childTableName, char *tbnam } } - return TSDB_CODE_SUCCESS; +END: + return code; } int32_t smlSetCTableName(SSmlTableInfo *oneTable, char *tbnameKey) { - int32_t code = smlParseTableName(oneTable->tags, oneTable->childTableName, tbnameKey); - if (code != TSDB_CODE_SUCCESS) { - return code; - } + int32_t code = 0; + SArray *dst = NULL; + SML_CHECK_CODE(smlParseTableName(oneTable->tags, oneTable->childTableName, tbnameKey)); if (strlen(oneTable->childTableName) == 0) { - SArray *dst = taosArrayDup(oneTable->tags, NULL); - if (dst == NULL) { - return terrno; - } + dst = taosArrayDup(oneTable->tags, NULL); + SML_CHECK_NULL(dst); if (oneTable->sTableNameLen >= TSDB_TABLE_NAME_LEN) { uError("SML:smlSetCTableName super table name is too long"); - taosArrayDestroy(dst); - return TSDB_CODE_SML_INTERNAL_ERROR; + code = TSDB_CODE_SML_INTERNAL_ERROR; + goto END; } char superName[TSDB_TABLE_NAME_LEN] = {0}; RandTableName rName = {dst, NULL, (uint8_t)oneTable->sTableNameLen, oneTable->childTableName}; @@ -578,13 +548,12 @@ int32_t smlSetCTableName(SSmlTableInfo *oneTable, char *tbnameKey) { rName.stbFullName = oneTable->sTableName; } - code = buildChildTableName(&rName); - if (code != TSDB_CODE_SUCCESS) { - return code; - } - taosArrayDestroy(dst); + SML_CHECK_CODE(buildChildTableName(&rName)); } - return TSDB_CODE_SUCCESS; + +END: + taosArrayDestroy(dst); + return code; } int32_t getTableUid(SSmlHandle *info, SSmlLineInfo *currElement, SSmlTableInfo *tinfo) { @@ -608,40 +577,25 @@ int32_t getTableUid(SSmlHandle *info, SSmlLineInfo *currElement, SSmlTableInfo * } int32_t smlBuildSTableMeta(bool isDataFormat, SSmlSTableMeta **sMeta) { + int32_t code = 0; SSmlSTableMeta *meta = (SSmlSTableMeta *)taosMemoryCalloc(sizeof(SSmlSTableMeta), 1); - if (!meta) { - return terrno; - } - + SML_CHECK_NULL(meta); if (unlikely(!isDataFormat)) { meta->tagHash = taosHashInit(32, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_NO_LOCK); - if (meta->tagHash == NULL) { - uError("SML:smlBuildSTableMeta failed to allocate memory"); - goto cleanup; - } - + SML_CHECK_NULL(meta->tagHash); meta->colHash = taosHashInit(32, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_NO_LOCK); - if (meta->colHash == NULL) { - uError("SML:smlBuildSTableMeta failed to allocate memory"); - goto cleanup; - } + SML_CHECK_NULL(meta->colHash); } meta->tags = taosArrayInit(32, sizeof(SSmlKv)); - if (meta->tags == NULL) { - uError("SML:smlBuildSTableMeta failed to allocate memory"); - goto cleanup; - } + SML_CHECK_NULL(meta->tags); meta->cols = taosArrayInit(32, sizeof(SSmlKv)); - if (meta->cols == NULL) { - uError("SML:smlBuildSTableMeta failed to allocate memory"); - goto cleanup; - } + SML_CHECK_NULL(meta->cols); *sMeta = meta; return TSDB_CODE_SUCCESS; -cleanup: +END: smlDestroySTableMeta(meta); return TSDB_CODE_OUT_OF_MEMORY; } @@ -720,104 +674,6 @@ int32_t smlParseNumber(SSmlKv *kvVal, SSmlMsgBuf *msg) { return true; } -bool smlParseNumberOld(SSmlKv *kvVal, SSmlMsgBuf *msg) { - const char *pVal = kvVal->value; - int32_t len = kvVal->length; - char *endptr = NULL; - double result = taosStr2Double(pVal, &endptr); - if (pVal == endptr) { - smlBuildInvalidDataMsg(msg, "invalid data", pVal); - return false; - } - - int32_t left = len - (endptr - pVal); - if (left == 0 || (left == 3 && strncasecmp(endptr, "f64", left) == 0)) { - kvVal->type = TSDB_DATA_TYPE_DOUBLE; - kvVal->d = result; - } else if ((left == 3 && strncasecmp(endptr, "f32", left) == 0)) { - if (!IS_VALID_FLOAT(result)) { - smlBuildInvalidDataMsg(msg, "float out of range[-3.402823466e+38,3.402823466e+38]", pVal); - return false; - } - kvVal->type = TSDB_DATA_TYPE_FLOAT; - kvVal->f = (float)result; - } else if ((left == 1 && *endptr == 'i') || (left == 3 && strncasecmp(endptr, "i64", left) == 0)) { - if (smlDoubleToInt64OverFlow(result)) { - errno = 0; - int64_t tmp = taosStr2Int64(pVal, &endptr, 10); - if (errno == ERANGE) { - smlBuildInvalidDataMsg(msg, "big int out of range[-9223372036854775808,9223372036854775807]", pVal); - return false; - } - kvVal->type = TSDB_DATA_TYPE_BIGINT; - kvVal->i = tmp; - return true; - } - kvVal->type = TSDB_DATA_TYPE_BIGINT; - kvVal->i = (int64_t)result; - } else if ((left == 1 && *endptr == 'u') || (left == 3 && strncasecmp(endptr, "u64", left) == 0)) { - if (result >= (double)UINT64_MAX || result < 0) { - errno = 0; - uint64_t tmp = taosStr2UInt64(pVal, &endptr, 10); - if (errno == ERANGE || result < 0) { - smlBuildInvalidDataMsg(msg, "unsigned big int out of range[0,18446744073709551615]", pVal); - return false; - } - kvVal->type = TSDB_DATA_TYPE_UBIGINT; - kvVal->u = tmp; - return true; - } - kvVal->type = TSDB_DATA_TYPE_UBIGINT; - kvVal->u = result; - } else if (left == 3 && strncasecmp(endptr, "i32", left) == 0) { - if (!IS_VALID_INT(result)) { - smlBuildInvalidDataMsg(msg, "int out of range[-2147483648,2147483647]", pVal); - return false; - } - kvVal->type = TSDB_DATA_TYPE_INT; - kvVal->i = result; - } else if (left == 3 && strncasecmp(endptr, "u32", left) == 0) { - if (!IS_VALID_UINT(result)) { - smlBuildInvalidDataMsg(msg, "unsigned int out of range[0,4294967295]", pVal); - return false; - } - kvVal->type = TSDB_DATA_TYPE_UINT; - kvVal->u = result; - } else if (left == 3 && strncasecmp(endptr, "i16", left) == 0) { - if (!IS_VALID_SMALLINT(result)) { - smlBuildInvalidDataMsg(msg, "small int our of range[-32768,32767]", pVal); - return false; - } - kvVal->type = TSDB_DATA_TYPE_SMALLINT; - kvVal->i = result; - } else if (left == 3 && strncasecmp(endptr, "u16", left) == 0) { - if (!IS_VALID_USMALLINT(result)) { - smlBuildInvalidDataMsg(msg, "unsigned small int out of rang[0,65535]", pVal); - return false; - } - kvVal->type = TSDB_DATA_TYPE_USMALLINT; - kvVal->u = result; - } else if (left == 2 && strncasecmp(endptr, "i8", left) == 0) { - if (!IS_VALID_TINYINT(result)) { - smlBuildInvalidDataMsg(msg, "tiny int out of range[-128,127]", pVal); - return false; - } - kvVal->type = TSDB_DATA_TYPE_TINYINT; - kvVal->i = result; - } else if (left == 2 && strncasecmp(endptr, "u8", left) == 0) { - if (!IS_VALID_UTINYINT(result)) { - smlBuildInvalidDataMsg(msg, "unsigned tiny int out of range[0,255]", pVal); - return false; - } - kvVal->type = TSDB_DATA_TYPE_UTINYINT; - kvVal->u = result; - } else { - smlBuildInvalidDataMsg(msg, "invalid data", pVal); - return false; - } - return true; -} - int32_t smlGetMeta(SSmlHandle *info, const void *measure, int32_t measureLen, STableMeta **pTableMeta) { *pTableMeta = NULL; @@ -832,11 +688,7 @@ int32_t smlGetMeta(SSmlHandle *info, const void *measure, int32_t measureLen, ST (void)memset(pName.tname, 0, TSDB_TABLE_NAME_LEN); (void)memcpy(pName.tname, measure, measureLen); - int32_t code = catalogGetSTableMeta(info->pCatalog, &conn, &pName, pTableMeta); - if (code != TSDB_CODE_SUCCESS) { - return code; - } - return TSDB_CODE_SUCCESS; + return catalogGetSTableMeta(info->pCatalog, &conn, &pName, pTableMeta); } static int64_t smlGenId() { @@ -913,53 +765,34 @@ static int32_t smlProcessSchemaAction(SSmlHandle *info, SSchema *schemaField, SH for (int j = 0; j < taosArrayGetSize(cols); ++j) { if (j == 0 && !isTag) continue; SSmlKv *kv = (SSmlKv *)taosArrayGet(cols, j); - if (kv == NULL) { - return TSDB_CODE_SML_INVALID_DATA; - } - code = smlGenerateSchemaAction(schemaField, schemaHash, kv, isTag, action, info); - if (code != TSDB_CODE_SUCCESS) { - return code; - } + SML_CHECK_NULL(kv); + SML_CHECK_CODE(smlGenerateSchemaAction(schemaField, schemaHash, kv, isTag, action, info)); } for (int j = 0; j < taosArrayGetSize(checkDumplicateCols); ++j) { SSmlKv *kv = (SSmlKv *)taosArrayGet(checkDumplicateCols, j); - if (kv == NULL) { - return TSDB_CODE_SML_INVALID_DATA; - } + SML_CHECK_NULL(kv); if (taosHashGet(schemaHash, kv->key, kv->keyLen) != NULL) { - return TSDB_CODE_PAR_DUPLICATED_COLUMN; + code = TSDB_CODE_PAR_DUPLICATED_COLUMN; + goto END; } } - return TSDB_CODE_SUCCESS; +END: + return code; } static int32_t smlCheckMeta(SSchema *schema, int32_t length, SArray *cols, bool isTag) { int32_t code = TSDB_CODE_SUCCESS; SHashObj *hashTmp = taosHashInit(length, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK); - if (hashTmp == NULL) { - code = terrno; - goto END; - } + SML_CHECK_NULL(hashTmp); int32_t i = 0; for (; i < length; i++) { - code = taosHashPut(hashTmp, schema[i].name, strlen(schema[i].name), &i, SHORT_BYTES); - if (code != 0) { - goto END; - } - } - - if (isTag) { - i = 0; - } else { - i = 1; + SML_CHECK_CODE(taosHashPut(hashTmp, schema[i].name, strlen(schema[i].name), &i, SHORT_BYTES)); } + i = isTag ? 0 : 1; for (; i < taosArrayGetSize(cols); i++) { SSmlKv *kv = (SSmlKv *)taosArrayGet(cols, i); - if (kv == NULL) { - code = terrno; - goto END; - } + SML_CHECK_NULL(kv); if (taosHashGet(hashTmp, kv->key, kv->keyLen) == NULL) { code = TSDB_CODE_SML_INVALID_DATA; goto END; @@ -982,36 +815,29 @@ static int32_t getBytes(uint8_t type, int32_t length) { static int32_t smlBuildFieldsList(SSmlHandle *info, SSchema *schemaField, SHashObj *schemaHash, SArray *cols, SArray *results, int32_t numOfCols, bool isTag) { + int32_t code = TSDB_CODE_SUCCESS; for (int j = 0; j < taosArrayGetSize(cols); ++j) { SSmlKv *kv = (SSmlKv *)taosArrayGet(cols, j); - if (kv == NULL) { - return TSDB_CODE_SML_INVALID_DATA; - } + SML_CHECK_NULL(kv); ESchemaAction action = SCHEMA_ACTION_NULL; - int code = smlGenerateSchemaAction(schemaField, schemaHash, kv, isTag, &action, info); - if (code != 0) { - return code; - } + SML_CHECK_CODE(smlGenerateSchemaAction(schemaField, schemaHash, kv, isTag, &action, info)); if (action == SCHEMA_ACTION_ADD_COLUMN || action == SCHEMA_ACTION_ADD_TAG) { SField field = {0}; field.type = kv->type; field.bytes = getBytes(kv->type, kv->length); - (void)memcpy(field.name, kv->key, kv->keyLen); - if (taosArrayPush(results, &field) == NULL) { - return terrno; - } + (void)memcpy(field.name, kv->key, MIN(kv->keyLen, sizeof(field.name) - 1)); + SML_CHECK_NULL(taosArrayPush(results, &field)); } else if (action == SCHEMA_ACTION_CHANGE_COLUMN_SIZE || action == SCHEMA_ACTION_CHANGE_TAG_SIZE) { uint16_t *index = (uint16_t *)taosHashGet(schemaHash, kv->key, kv->keyLen); if (index == NULL) { uError("smlBuildFieldsList get error, key:%s", kv->key); - return TSDB_CODE_SML_INVALID_DATA; + code = TSDB_CODE_SML_INVALID_DATA; + goto END; } uint16_t newIndex = *index; if (isTag) newIndex -= numOfCols; SField *field = (SField *)taosArrayGet(results, newIndex); - if (field == NULL) { - return TSDB_CODE_SML_INVALID_DATA; - } + SML_CHECK_NULL(field); field->bytes = getBytes(kv->type, kv->length); } } @@ -1020,18 +846,23 @@ static int32_t smlBuildFieldsList(SSmlHandle *info, SSchema *schemaField, SHashO int32_t len = 0; for (int j = 0; j < taosArrayGetSize(results); ++j) { SField *field = taosArrayGet(results, j); - if (field == NULL) { - return TSDB_CODE_SML_INVALID_DATA; - } + SML_CHECK_NULL(field); len += field->bytes; } if (len > maxLen) { return isTag ? TSDB_CODE_PAR_INVALID_TAGS_LENGTH : TSDB_CODE_PAR_INVALID_ROW_LENGTH; } - return TSDB_CODE_SUCCESS; +END: + return code; } +static FORCE_INLINE void smlBuildCreateStbReq(SMCreateStbReq *pReq, int32_t colVer, int32_t tagVer, tb_uid_t suid, int8_t source){ + pReq->colVer = colVer; + pReq->tagVer = tagVer; + pReq->suid = suid; + pReq->source = source; +} static int32_t smlSendMetaMsg(SSmlHandle *info, SName *pName, SArray *pColumns, SArray *pTags, STableMeta *pTableMeta, ESchemaAction action) { SRequestObj *pRequest = NULL; @@ -1046,58 +877,37 @@ static int32_t smlSendMetaMsg(SSmlHandle *info, SName *pName, SArray *pColumns, pReq.numOfTags = taosArrayGetSize(pTags); pReq.pColumns = taosArrayInit(pReq.numOfColumns, sizeof(SFieldWithOptions)); - if (pReq.pColumns == NULL) { - code = terrno; - goto end; - } + SML_CHECK_NULL(pReq.pColumns); for (int32_t i = 0; i < pReq.numOfColumns; ++i) { SField *pField = taosArrayGet(pColumns, i); - if (pField == NULL) { - code = terrno; - goto end; - } + SML_CHECK_NULL(pField); SFieldWithOptions fieldWithOption = {0}; setFieldWithOptions(&fieldWithOption, pField); setDefaultOptionsForField(&fieldWithOption); - if (taosArrayPush(pReq.pColumns, &fieldWithOption) == NULL) { - code = terrno; - goto end; - } + SML_CHECK_NULL(taosArrayPush(pReq.pColumns, &fieldWithOption)); } if (action == SCHEMA_ACTION_CREATE_STABLE) { - pReq.colVer = 1; - pReq.tagVer = 1; - pReq.suid = 0; - pReq.source = TD_REQ_FROM_APP; pSql = "sml_create_stable"; + smlBuildCreateStbReq(&pReq, 1, 1, 0, TD_REQ_FROM_APP); } else if (action == SCHEMA_ACTION_ADD_TAG || action == SCHEMA_ACTION_CHANGE_TAG_SIZE) { - pReq.colVer = pTableMeta->sversion; - pReq.tagVer = pTableMeta->tversion + 1; - pReq.suid = pTableMeta->uid; - pReq.source = TD_REQ_FROM_TAOX; pSql = (action == SCHEMA_ACTION_ADD_TAG) ? "sml_add_tag" : "sml_modify_tag_size"; + smlBuildCreateStbReq(&pReq, pTableMeta->sversion, pTableMeta->tversion + 1, pTableMeta->uid, TD_REQ_FROM_TAOX); } else if (action == SCHEMA_ACTION_ADD_COLUMN || action == SCHEMA_ACTION_CHANGE_COLUMN_SIZE) { - pReq.colVer = pTableMeta->sversion + 1; - pReq.tagVer = pTableMeta->tversion; - pReq.suid = pTableMeta->uid; - pReq.source = TD_REQ_FROM_TAOX; pSql = (action == SCHEMA_ACTION_ADD_COLUMN) ? "sml_add_column" : "sml_modify_column_size"; + smlBuildCreateStbReq(&pReq, pTableMeta->sversion + 1, pTableMeta->tversion, pTableMeta->uid, TD_REQ_FROM_TAOX); } else { uError("SML:0x%" PRIx64 " invalid action:%d", info->id, action); code = TSDB_CODE_SML_INVALID_DATA; - goto end; + goto END; } - code = buildRequest(info->taos->id, pSql, strlen(pSql), NULL, false, &pRequest, 0); - if (code != TSDB_CODE_SUCCESS) { - goto end; - } + SML_CHECK_CODE(buildRequest(info->taos->id, pSql, strlen(pSql), NULL, false, &pRequest, 0)); pRequest->syncQuery = true; if (!pRequest->pDb) { code = TSDB_CODE_PAR_DB_NOT_SPECIFIED; - goto end; + goto END; } if (pReq.numOfTags == 0) { @@ -1106,40 +916,29 @@ static int32_t smlSendMetaMsg(SSmlHandle *info, SName *pName, SArray *pColumns, field.type = TSDB_DATA_TYPE_NCHAR; field.bytes = TSDB_NCHAR_SIZE + VARSTR_HEADER_SIZE; tstrncpy(field.name, tsSmlTagName, sizeof(field.name)); - if (taosArrayPush(pReq.pTags, &field) == NULL) { - code = terrno; - goto end; - } + SML_CHECK_NULL(taosArrayPush(pReq.pTags, &field)); } pReq.commentLen = -1; pReq.igExists = true; - code = tNameExtractFullName(pName, pReq.name); - if (TSDB_CODE_SUCCESS != code) { - goto end; - } + SML_CHECK_CODE(tNameExtractFullName(pName, pReq.name)); pCmdMsg.epSet = getEpSet_s(&info->taos->pAppInfo->mgmtEp); pCmdMsg.msgType = TDMT_MND_CREATE_STB; pCmdMsg.msgLen = tSerializeSMCreateStbReq(NULL, 0, &pReq); if (pCmdMsg.msgLen < 0) { - code = TSDB_CODE_OUT_OF_MEMORY; - goto end; + code = pCmdMsg.msgLen; + goto END; } pCmdMsg.pMsg = taosMemoryMalloc(pCmdMsg.msgLen); - if (NULL == pCmdMsg.pMsg) { - code = terrno; - goto end; - } - - if (tSerializeSMCreateStbReq(pCmdMsg.pMsg, pCmdMsg.msgLen, &pReq) < 0) { - code = TSDB_CODE_OUT_OF_MEMORY; + SML_CHECK_NULL(pCmdMsg.pMsg); + code = tSerializeSMCreateStbReq(pCmdMsg.pMsg, pCmdMsg.msgLen, &pReq); + if (code < 0) { taosMemoryFree(pCmdMsg.pMsg); - goto end; + goto END; } SQuery pQuery = {0}; - (void)memset(&pQuery, 0, sizeof(pQuery)); pQuery.execMode = QUERY_EXEC_MODE_RPC; pQuery.pCmdMsg = &pCmdMsg; pQuery.msgType = pQuery.pCmdMsg->msgType; @@ -1148,19 +947,134 @@ static int32_t smlSendMetaMsg(SSmlHandle *info, SName *pName, SArray *pColumns, launchQueryImpl(pRequest, &pQuery, true, NULL); // no need to check return value if (pRequest->code == TSDB_CODE_SUCCESS) { - code = catalogRemoveTableMeta(info->pCatalog, pName); - if (code != TSDB_CODE_SUCCESS) { - goto end; - } + SML_CHECK_CODE(catalogRemoveTableMeta(info->pCatalog, pName)); } code = pRequest->code; -end: +END: destroyRequest(pRequest); tFreeSMCreateStbReq(&pReq); return code; } +static int32_t smlCreateTable(SSmlHandle *info, SRequestConnInfo *conn, SSmlSTableMeta *sTableData, + SName *pName, STableMeta **pTableMeta){ + int32_t code = 0; + SArray *pColumns = NULL; + SArray *pTags = NULL; + SML_CHECK_CODE(smlCheckAuth(info, conn, NULL, AUTH_TYPE_WRITE)); + uDebug("SML:0x%" PRIx64 " smlModifyDBSchemas create table:%s", info->id, pName->tname); + pColumns = taosArrayInit(taosArrayGetSize(sTableData->cols), sizeof(SField)); + SML_CHECK_NULL(pColumns); + pTags = taosArrayInit(taosArrayGetSize(sTableData->tags), sizeof(SField)); + SML_CHECK_NULL(pTags); + SML_CHECK_CODE(smlBuildFieldsList(info, NULL, NULL, sTableData->tags, pTags, 0, true)); + SML_CHECK_CODE(smlBuildFieldsList(info, NULL, NULL, sTableData->cols, pColumns, 0, false)); + pTags = NULL; + SML_CHECK_CODE(smlSendMetaMsg(info, pName, pColumns, pTags, NULL, SCHEMA_ACTION_CREATE_STABLE)); + info->cost.numOfCreateSTables++; + taosMemoryFreeClear(*pTableMeta); + + SML_CHECK_CODE(catalogGetSTableMeta(info->pCatalog, conn, pName, pTableMeta)); + +END: + taosArrayDestroy(pColumns); + taosArrayDestroy(pTags); + return code; +} + +static int32_t smlBuildFields(SArray **pColumns, SArray **pTags, STableMeta *pTableMeta, SSmlSTableMeta *sTableData){ + int32_t code = 0; + *pColumns = taosArrayInit(taosArrayGetSize(sTableData->cols) + (pTableMeta)->tableInfo.numOfColumns, sizeof(SField)); + SML_CHECK_NULL(pColumns); + *pTags = taosArrayInit(taosArrayGetSize(sTableData->tags) + (pTableMeta)->tableInfo.numOfTags, sizeof(SField)); + SML_CHECK_NULL(pTags); + for (uint16_t i = 0; i < (pTableMeta)->tableInfo.numOfColumns + (pTableMeta)->tableInfo.numOfTags; i++) { + SField field = {0}; + field.type = (pTableMeta)->schema[i].type; + field.bytes = (pTableMeta)->schema[i].bytes; + tstrncpy(field.name, (pTableMeta)->schema[i].name, sizeof(field.name)); + if (i < (pTableMeta)->tableInfo.numOfColumns) { + SML_CHECK_NULL(taosArrayPush(*pColumns, &field)); + } else { + SML_CHECK_NULL(taosArrayPush(*pTags, &field)); + } + } +END: + return code; +} +static int32_t smlModifyTag(SSmlHandle *info, SHashObj* hashTmp, SRequestConnInfo *conn, + SSmlSTableMeta *sTableData, SName *pName, STableMeta **pTableMeta){ + ESchemaAction action = SCHEMA_ACTION_NULL; + SArray *pColumns = NULL; + SArray *pTags = NULL; + int32_t code = 0; + SML_CHECK_CODE(smlProcessSchemaAction(info, (*pTableMeta)->schema, hashTmp, sTableData->tags, sTableData->cols, &action, true)); + + if (action != SCHEMA_ACTION_NULL) { + SML_CHECK_CODE(smlCheckAuth(info, conn, pName->tname, AUTH_TYPE_WRITE)); + uDebug("SML:0x%" PRIx64 " smlModifyDBSchemas change table tag, table:%s, action:%d", info->id, pName->tname, + action); + SML_CHECK_CODE(smlBuildFields(&pColumns, &pTags, *pTableMeta, sTableData)); + SML_CHECK_CODE(smlBuildFieldsList(info, (*pTableMeta)->schema, hashTmp, sTableData->tags, pTags, + (*pTableMeta)->tableInfo.numOfColumns, true)); + + pTags = NULL; + SML_CHECK_CODE(smlSendMetaMsg(info, pName, pColumns, pTags, (*pTableMeta), action)); + + info->cost.numOfAlterTagSTables++; + taosMemoryFreeClear(*pTableMeta); + SML_CHECK_CODE(catalogRefreshTableMeta(info->pCatalog, conn, pName, -1)); + SML_CHECK_CODE(catalogGetSTableMeta(info->pCatalog, conn, pName, pTableMeta)); + } + +END: + taosArrayDestroy(pColumns); + taosArrayDestroy(pTags); + return code; +} + +static int32_t smlModifyCols(SSmlHandle *info, SHashObj* hashTmp, SRequestConnInfo *conn, + SSmlSTableMeta *sTableData, SName *pName, STableMeta **pTableMeta){ + ESchemaAction action = SCHEMA_ACTION_NULL; + SArray *pColumns = NULL; + SArray *pTags = NULL; + int32_t code = 0; + SML_CHECK_CODE(smlProcessSchemaAction(info, (*pTableMeta)->schema, hashTmp, sTableData->cols, sTableData->tags, &action, false)); + + if (action != SCHEMA_ACTION_NULL) { + SML_CHECK_CODE(smlCheckAuth(info, conn, pName->tname, AUTH_TYPE_WRITE)); + uDebug("SML:0x%" PRIx64 " smlModifyDBSchemas change table col, table:%s, action:%d", info->id, pName->tname, + action); + SML_CHECK_CODE(smlBuildFields(&pColumns, &pTags, *pTableMeta, sTableData)); + SML_CHECK_CODE(smlBuildFieldsList(info, (*pTableMeta)->schema, hashTmp, sTableData->cols, pColumns, + (*pTableMeta)->tableInfo.numOfColumns, false)); + + pTags = NULL; + SML_CHECK_CODE(smlSendMetaMsg(info, pName, pColumns, pTags, (*pTableMeta), action)); + + info->cost.numOfAlterColSTables++; + taosMemoryFreeClear(*pTableMeta); + SML_CHECK_CODE(catalogRefreshTableMeta(info->pCatalog, conn, pName, -1)); + SML_CHECK_CODE(catalogGetSTableMeta(info->pCatalog, conn, pName, pTableMeta)); + } + + END: + taosArrayDestroy(pColumns); + taosArrayDestroy(pTags); + return code; +} + +static int32_t smlBuildTempHash(SHashObj *hashTmp, STableMeta *pTableMeta, uint16_t start, uint16_t end){ + int32_t code = 0; + for (uint16_t i = start; i < end; i++) { + SML_CHECK_CODE(taosHashPut(hashTmp, pTableMeta->schema[i].name, strlen(pTableMeta->schema[i].name), &i, SHORT_BYTES)); + } + +END: + return code; +} + static int32_t smlModifyDBSchemas(SSmlHandle *info) { uDebug("SML:0x%" PRIx64 " smlModifyDBSchemas start, format:%d, needModifySchema:%d", info->id, info->dataFormat, info->needModifySchema); @@ -1188,286 +1102,43 @@ static int32_t smlModifyDBSchemas(SSmlHandle *info) { size_t superTableLen = 0; void *superTable = taosHashGetKey(tmp, &superTableLen); char *measure = taosMemoryMalloc(superTableLen); - if (measure == NULL) { - code = terrno; - goto end; - } + SML_CHECK_NULL(measure); (void)memcpy(measure, superTable, superTableLen); PROCESS_SLASH_IN_MEASUREMENT(measure, superTableLen); smlStrReplace(measure, superTableLen); (void)memset(pName.tname, 0, TSDB_TABLE_NAME_LEN); - (void)memcpy(pName.tname, measure, superTableLen); + (void)memcpy(pName.tname, measure, MIN(superTableLen, TSDB_TABLE_NAME_LEN - 1)); taosMemoryFree(measure); code = catalogGetSTableMeta(info->pCatalog, &conn, &pName, &pTableMeta); if (code == TSDB_CODE_PAR_TABLE_NOT_EXIST || code == TSDB_CODE_MND_STB_NOT_EXIST) { - code = smlCheckAuth(info, &conn, NULL, AUTH_TYPE_WRITE); - if (code != TSDB_CODE_SUCCESS) { - goto end; - } - uDebug("SML:0x%" PRIx64 " smlModifyDBSchemas create table:%s", info->id, pName.tname); - SArray *pColumns = taosArrayInit(taosArrayGetSize(sTableData->cols), sizeof(SField)); - if (pColumns == NULL) { - code = terrno; - goto end; - } - SArray *pTags = taosArrayInit(taosArrayGetSize(sTableData->tags), sizeof(SField)); - if (pTags == NULL) { - code = terrno; - taosArrayDestroy(pColumns); - goto end; - } - code = smlBuildFieldsList(info, NULL, NULL, sTableData->tags, pTags, 0, true); - if (code != TSDB_CODE_SUCCESS) { - uError("SML:0x%" PRIx64 " smlBuildFieldsList tag1 failed. %s", info->id, pName.tname); - taosArrayDestroy(pColumns); - taosArrayDestroy(pTags); - goto end; - } - code = smlBuildFieldsList(info, NULL, NULL, sTableData->cols, pColumns, 0, false); - if (code != TSDB_CODE_SUCCESS) { - uError("SML:0x%" PRIx64 " smlBuildFieldsList col1 failed. %s", info->id, pName.tname); - taosArrayDestroy(pColumns); - taosArrayDestroy(pTags); - goto end; - } - code = smlSendMetaMsg(info, &pName, pColumns, pTags, NULL, SCHEMA_ACTION_CREATE_STABLE); - taosArrayDestroy(pColumns); - if (code != TSDB_CODE_SUCCESS) { - uError("SML:0x%" PRIx64 " smlSendMetaMsg failed. can not create %s", info->id, pName.tname); - goto end; - } - info->cost.numOfCreateSTables++; - taosMemoryFreeClear(pTableMeta); - - code = catalogGetSTableMeta(info->pCatalog, &conn, &pName, &pTableMeta); - if (code != TSDB_CODE_SUCCESS) { - uError("SML:0x%" PRIx64 " catalogGetSTableMeta failed. super table name %s", info->id, pName.tname); - goto end; - } + SML_CHECK_CODE(smlCreateTable(info, &conn, sTableData, &pName, &pTableMeta)); } else if (code == TSDB_CODE_SUCCESS) { if (smlIsPKTable(pTableMeta)) { code = TSDB_CODE_SML_NOT_SUPPORT_PK; - goto end; - } - - hashTmp = taosHashInit(pTableMeta->tableInfo.numOfTags, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, - HASH_NO_LOCK); - if (hashTmp == NULL) { - code = terrno; - goto end; - } - for (uint16_t i = pTableMeta->tableInfo.numOfColumns; - i < pTableMeta->tableInfo.numOfColumns + pTableMeta->tableInfo.numOfTags; i++) { - code = taosHashPut(hashTmp, pTableMeta->schema[i].name, strlen(pTableMeta->schema[i].name), &i, SHORT_BYTES); - if (code != 0) { - goto end; - } - } - - ESchemaAction action = SCHEMA_ACTION_NULL; - code = - smlProcessSchemaAction(info, pTableMeta->schema, hashTmp, sTableData->tags, sTableData->cols, &action, true); - if (code != TSDB_CODE_SUCCESS) { - goto end; - } - if (action != SCHEMA_ACTION_NULL) { - code = smlCheckAuth(info, &conn, pName.tname, AUTH_TYPE_WRITE); - if (code != TSDB_CODE_SUCCESS) { - goto end; - } - uDebug("SML:0x%" PRIx64 " smlModifyDBSchemas change table tag, table:%s, action:%d", info->id, pName.tname, - action); - SArray *pColumns = - taosArrayInit(taosArrayGetSize(sTableData->cols) + pTableMeta->tableInfo.numOfColumns, sizeof(SField)); - if (pColumns == NULL) { - code = terrno; - goto end; - } - SArray *pTags = - taosArrayInit(taosArrayGetSize(sTableData->tags) + pTableMeta->tableInfo.numOfTags, sizeof(SField)); - if (pTags == NULL) { - taosArrayDestroy(pColumns); - code = terrno; - goto end; - } - for (uint16_t i = 0; i < pTableMeta->tableInfo.numOfColumns + pTableMeta->tableInfo.numOfTags; i++) { - SField field = {0}; - field.type = pTableMeta->schema[i].type; - field.bytes = pTableMeta->schema[i].bytes; - tstrncpy(field.name, pTableMeta->schema[i].name, sizeof(field.name)); - if (i < pTableMeta->tableInfo.numOfColumns) { - if (taosArrayPush(pColumns, &field) == NULL) { - taosArrayDestroy(pColumns); - taosArrayDestroy(pTags); - code = terrno; - goto end; - } - } else { - if (taosArrayPush(pTags, &field) == NULL) { - taosArrayDestroy(pColumns); - taosArrayDestroy(pTags); - code = terrno; - goto end; - } - } - } - code = smlBuildFieldsList(info, pTableMeta->schema, hashTmp, sTableData->tags, pTags, - pTableMeta->tableInfo.numOfColumns, true); - if (code != TSDB_CODE_SUCCESS) { - uError("SML:0x%" PRIx64 " smlBuildFieldsList tag2 failed. %s", info->id, pName.tname); - taosArrayDestroy(pColumns); - taosArrayDestroy(pTags); - goto end; - } - - if (taosArrayGetSize(pTags) + pTableMeta->tableInfo.numOfColumns > TSDB_MAX_COLUMNS) { - uError("SML:0x%" PRIx64 " too many columns than 4096", info->id); - code = TSDB_CODE_PAR_TOO_MANY_COLUMNS; - taosArrayDestroy(pColumns); - taosArrayDestroy(pTags); - goto end; - } - if (taosArrayGetSize(pTags) > TSDB_MAX_TAGS) { - uError("SML:0x%" PRIx64 " too many tags than 128", info->id); - code = TSDB_CODE_PAR_INVALID_TAGS_NUM; - taosArrayDestroy(pColumns); - taosArrayDestroy(pTags); - goto end; - } - - code = smlSendMetaMsg(info, &pName, pColumns, pTags, pTableMeta, action); - taosArrayDestroy(pColumns); - if (code != TSDB_CODE_SUCCESS) { - uError("SML:0x%" PRIx64 " smlSendMetaMsg failed. can not create %s", info->id, pName.tname); - goto end; - } - - info->cost.numOfAlterTagSTables++; - taosMemoryFreeClear(pTableMeta); - code = catalogRefreshTableMeta(info->pCatalog, &conn, &pName, -1); - if (code != TSDB_CODE_SUCCESS) { - goto end; - } - code = catalogGetSTableMeta(info->pCatalog, &conn, &pName, &pTableMeta); - if (code != TSDB_CODE_SUCCESS) { - goto end; - } + goto END; } + hashTmp = taosHashInit(pTableMeta->tableInfo.numOfTags, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK); + SML_CHECK_NULL(hashTmp); + SML_CHECK_CODE(smlBuildTempHash(hashTmp, pTableMeta, pTableMeta->tableInfo.numOfColumns, pTableMeta->tableInfo.numOfColumns + pTableMeta->tableInfo.numOfTags)); + SML_CHECK_CODE(smlModifyTag(info, hashTmp, &conn, sTableData, &pName, &pTableMeta)); taosHashClear(hashTmp); - for (uint16_t i = 0; i < pTableMeta->tableInfo.numOfColumns; i++) { - code = taosHashPut(hashTmp, pTableMeta->schema[i].name, strlen(pTableMeta->schema[i].name), &i, SHORT_BYTES); - if (code != TSDB_CODE_SUCCESS) { - goto end; - } - } - action = SCHEMA_ACTION_NULL; - code = - smlProcessSchemaAction(info, pTableMeta->schema, hashTmp, sTableData->cols, sTableData->tags, &action, false); - if (code != TSDB_CODE_SUCCESS) { - goto end; - } - if (action != SCHEMA_ACTION_NULL) { - code = smlCheckAuth(info, &conn, pName.tname, AUTH_TYPE_WRITE); - if (code != TSDB_CODE_SUCCESS) { - goto end; - } - uDebug("SML:0x%" PRIx64 " smlModifyDBSchemas change table col, table:%s, action:%d", info->id, pName.tname, - action); - SArray *pColumns = - taosArrayInit(taosArrayGetSize(sTableData->cols) + pTableMeta->tableInfo.numOfColumns, sizeof(SField)); - if (pColumns == NULL) { - code = terrno; - goto end; - } - SArray *pTags = - taosArrayInit(taosArrayGetSize(sTableData->tags) + pTableMeta->tableInfo.numOfTags, sizeof(SField)); - if (pTags == NULL) { - taosArrayDestroy(pColumns); - code = terrno; - goto end; - } - for (uint16_t i = 0; i < pTableMeta->tableInfo.numOfColumns + pTableMeta->tableInfo.numOfTags; i++) { - SField field = {0}; - field.type = pTableMeta->schema[i].type; - field.bytes = pTableMeta->schema[i].bytes; - tstrncpy(field.name, pTableMeta->schema[i].name, sizeof(field.name)); - if (i < pTableMeta->tableInfo.numOfColumns) { - if (taosArrayPush(pColumns, &field) == NULL) { - taosArrayDestroy(pColumns); - taosArrayDestroy(pTags); - code = terrno; - goto end; - } - } else { - if (taosArrayPush(pTags, &field) == NULL) { - taosArrayDestroy(pColumns); - taosArrayDestroy(pTags); - code = terrno; - goto end; - } - } - } - - code = smlBuildFieldsList(info, pTableMeta->schema, hashTmp, sTableData->cols, pColumns, - pTableMeta->tableInfo.numOfColumns, false); - if (code != TSDB_CODE_SUCCESS) { - uError("SML:0x%" PRIx64 " smlBuildFieldsList col2 failed. %s", info->id, pName.tname); - taosArrayDestroy(pColumns); - taosArrayDestroy(pTags); - goto end; - } - - if (taosArrayGetSize(pColumns) + pTableMeta->tableInfo.numOfTags > TSDB_MAX_COLUMNS) { - uError("SML:0x%" PRIx64 " too many columns than 4096", info->id); - code = TSDB_CODE_PAR_TOO_MANY_COLUMNS; - taosArrayDestroy(pColumns); - taosArrayDestroy(pTags); - goto end; - } - - code = smlSendMetaMsg(info, &pName, pColumns, pTags, pTableMeta, action); - taosArrayDestroy(pColumns); - if (code != TSDB_CODE_SUCCESS) { - uError("SML:0x%" PRIx64 " smlSendMetaMsg failed. can not create %s", info->id, pName.tname); - goto end; - } - - info->cost.numOfAlterColSTables++; - taosMemoryFreeClear(pTableMeta); - code = catalogRefreshTableMeta(info->pCatalog, &conn, &pName, -1); - if (code != TSDB_CODE_SUCCESS) { - goto end; - } - code = catalogGetSTableMeta(info->pCatalog, &conn, &pName, &pTableMeta); - if (code != TSDB_CODE_SUCCESS) { - uError("SML:0x%" PRIx64 " catalogGetSTableMeta failed. super table name %s", info->id, pName.tname); - goto end; - } - } + SML_CHECK_CODE(smlBuildTempHash(hashTmp, pTableMeta, 0, pTableMeta->tableInfo.numOfColumns)); + SML_CHECK_CODE(smlModifyCols(info, hashTmp, &conn, sTableData, &pName, &pTableMeta)); needCheckMeta = true; taosHashCleanup(hashTmp); hashTmp = NULL; } else { uError("SML:0x%" PRIx64 " load table meta error: %s", info->id, tstrerror(code)); - goto end; + goto END; } if (needCheckMeta) { - code = smlCheckMeta(&(pTableMeta->schema[pTableMeta->tableInfo.numOfColumns]), pTableMeta->tableInfo.numOfTags, - sTableData->tags, true); - if (code != TSDB_CODE_SUCCESS) { - uError("SML:0x%" PRIx64 " check tag failed. super table name %s", info->id, pName.tname); - goto end; - } - code = smlCheckMeta(&(pTableMeta->schema[0]), pTableMeta->tableInfo.numOfColumns, sTableData->cols, false); - if (code != TSDB_CODE_SUCCESS) { - uError("SML:0x%" PRIx64 " check cols failed. super table name %s", info->id, pName.tname); - goto end; - } + SML_CHECK_CODE(smlCheckMeta(&(pTableMeta->schema[pTableMeta->tableInfo.numOfColumns]), pTableMeta->tableInfo.numOfTags, sTableData->tags, true)); + SML_CHECK_CODE(smlCheckMeta(&(pTableMeta->schema[0]), pTableMeta->tableInfo.numOfColumns, sTableData->cols, false)); } taosMemoryFreeClear(sTableData->tableMeta); @@ -1481,7 +1152,7 @@ static int32_t smlModifyDBSchemas(SSmlHandle *info) { return TSDB_CODE_SUCCESS; -end: +END: taosHashCancelIterate(info->superTables, tmp); taosHashCleanup(hashTmp); taosMemoryFreeClear(pTableMeta); @@ -1493,40 +1164,37 @@ static int32_t smlModifyDBSchemas(SSmlHandle *info) { } static int32_t smlInsertMeta(SHashObj *metaHash, SArray *metaArray, SArray *cols, SHashObj *checkDuplicate) { + int32_t code = 0; terrno = 0; for (int16_t i = 0; i < taosArrayGetSize(cols); ++i) { SSmlKv *kv = (SSmlKv *)taosArrayGet(cols, i); - if (kv == NULL) { - return TSDB_CODE_SML_INVALID_DATA; - } + SML_CHECK_NULL(kv); int ret = taosHashPut(metaHash, kv->key, kv->keyLen, &i, SHORT_BYTES); if (ret == 0) { - if (taosArrayPush(metaArray, kv) == NULL) { - return terrno; - } + SML_CHECK_NULL(taosArrayPush(metaArray, kv)); if (taosHashGet(checkDuplicate, kv->key, kv->keyLen) != NULL) { - return TSDB_CODE_PAR_DUPLICATED_COLUMN; + code = TSDB_CODE_PAR_DUPLICATED_COLUMN; + goto END; } } else if (terrno == TSDB_CODE_DUP_KEY) { return TSDB_CODE_PAR_DUPLICATED_COLUMN; } } - return TSDB_CODE_SUCCESS; + +END: + return code; } static int32_t smlUpdateMeta(SHashObj *metaHash, SArray *metaArray, SArray *cols, bool isTag, SSmlMsgBuf *msg, SHashObj *checkDuplicate) { + int32_t code = 0; for (int i = 0; i < taosArrayGetSize(cols); ++i) { SSmlKv *kv = (SSmlKv *)taosArrayGet(cols, i); - if (kv == NULL) { - return TSDB_CODE_SML_INVALID_DATA; - } + SML_CHECK_NULL(kv); int16_t *index = (int16_t *)taosHashGet(metaHash, kv->key, kv->keyLen); if (index) { SSmlKv *value = (SSmlKv *)taosArrayGet(metaArray, *index); - if (value == NULL) { - return TSDB_CODE_SML_INVALID_DATA; - } + SML_CHECK_NULL(value); if (isTag) { if (kv->length > value->length) { @@ -1536,7 +1204,8 @@ static int32_t smlUpdateMeta(SHashObj *metaHash, SArray *metaArray, SArray *cols } if (kv->type != value->type) { smlBuildInvalidDataMsg(msg, "the type is not the same like before", kv->key); - return TSDB_CODE_SML_NOT_SAME_TYPE; + code = TSDB_CODE_SML_NOT_SAME_TYPE; + goto END; } if (IS_VAR_DATA_TYPE(kv->type) && (kv->length > value->length)) { // update string len, if bigger @@ -1547,24 +1216,21 @@ static int32_t smlUpdateMeta(SHashObj *metaHash, SArray *metaArray, SArray *cols if (tmp > INT16_MAX) { smlBuildInvalidDataMsg(msg, "too many cols or tags", kv->key); uError("too many cols or tags"); - return TSDB_CODE_SML_INVALID_DATA; + code = TSDB_CODE_SML_INVALID_DATA; + goto END; } int16_t size = tmp; - int ret = taosHashPut(metaHash, kv->key, kv->keyLen, &size, SHORT_BYTES); - if (ret == 0) { - if (taosArrayPush(metaArray, kv) == NULL) { - return terrno; - } - if (taosHashGet(checkDuplicate, kv->key, kv->keyLen) != NULL) { - return TSDB_CODE_PAR_DUPLICATED_COLUMN; - } - } else { - return ret; + SML_CHECK_CODE(taosHashPut(metaHash, kv->key, kv->keyLen, &size, SHORT_BYTES)); + SML_CHECK_NULL(taosArrayPush(metaArray, kv)); + if (taosHashGet(checkDuplicate, kv->key, kv->keyLen) != NULL) { + code = TSDB_CODE_PAR_DUPLICATED_COLUMN; + goto END; } } } - return TSDB_CODE_SUCCESS; +END: + return code; } void smlDestroyTableInfo(void *para) { @@ -1631,94 +1297,71 @@ void smlDestroyInfo(SSmlHandle *info) { int32_t smlBuildSmlInfo(TAOS *taos, SSmlHandle **handle) { int32_t code = TSDB_CODE_SUCCESS; SSmlHandle *info = (SSmlHandle *)taosMemoryCalloc(1, sizeof(SSmlHandle)); - if (NULL == info) { - return terrno; - } - if (taos != NULL) { + SML_CHECK_NULL(info); + if (taos != NULL){ info->taos = acquireTscObj(*(int64_t *)taos); - if (info->taos == NULL) { - code = TSDB_CODE_TSC_DISCONNECTED; - goto FAILED; - } - code = catalogGetHandle(info->taos->pAppInfo->clusterId, &info->pCatalog); - if (code != TSDB_CODE_SUCCESS) { - uError("SML:0x%" PRIx64 " get catalog error %d", info->id, code); - goto FAILED; - } + SML_CHECK_NULL(info->taos); + SML_CHECK_CODE(catalogGetHandle(info->taos->pAppInfo->clusterId, &info->pCatalog)); } info->pVgHash = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, HASH_NO_LOCK); + SML_CHECK_NULL(info->pVgHash); info->childTables = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK); + SML_CHECK_NULL(info->childTables); info->tableUids = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK); + SML_CHECK_NULL(info->tableUids); info->superTables = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK); - if (info->pVgHash == NULL || info->childTables == NULL || info->superTables == NULL || info->tableUids == NULL) { - uError("create SSmlHandle hash obj failed"); - code = terrno; - goto FAILED; - } + SML_CHECK_NULL(info->superTables); taosHashSetFreeFp(info->superTables, smlDestroySTableMeta); taosHashSetFreeFp(info->childTables, smlDestroyTableInfo); info->id = smlGenId(); - code = smlInitHandle(&info->pQuery); - if (code != TSDB_CODE_SUCCESS) { - goto FAILED; - } + SML_CHECK_CODE(smlInitHandle(&info->pQuery)); info->dataFormat = true; - info->tagJsonArray = taosArrayInit(8, POINTER_BYTES); + SML_CHECK_NULL(info->tagJsonArray); info->valueJsonArray = taosArrayInit(8, POINTER_BYTES); + SML_CHECK_NULL(info->valueJsonArray); info->preLineTagKV = taosArrayInit(8, sizeof(SSmlKv)); + SML_CHECK_NULL(info->preLineTagKV); info->escapedStringList = taosArrayInit(8, POINTER_BYTES); - if (info->tagJsonArray == NULL || info->valueJsonArray == NULL || - info->preLineTagKV == NULL || info->escapedStringList == NULL) { - uError("SML:0x%" PRIx64 " failed to allocate memory", info->id); - code = terrno; - goto FAILED; - } + SML_CHECK_NULL(info->escapedStringList); *handle = info; return code; -FAILED: +END: smlDestroyInfo(info); return code; } static int32_t smlPushCols(SArray *colsArray, SArray *cols) { + int32_t code = TSDB_CODE_SUCCESS; SHashObj *kvHash = taosHashInit(32, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_NO_LOCK); - if (!kvHash) { - uError("SML:smlDealCols failed to allocate memory"); - return terrno; - } + SML_CHECK_NULL(kvHash); for (size_t i = 0; i < taosArrayGetSize(cols); i++) { SSmlKv *kv = (SSmlKv *)taosArrayGet(cols, i); - if (kv == NULL) { - taosHashCleanup(kvHash); - return TSDB_CODE_SML_INVALID_DATA; - } + SML_CHECK_NULL(kv); terrno = 0; - int32_t code = taosHashPut(kvHash, kv->key, kv->keyLen, &kv, POINTER_BYTES); + code = taosHashPut(kvHash, kv->key, kv->keyLen, &kv, POINTER_BYTES); if (terrno == TSDB_CODE_DUP_KEY) { - taosHashCleanup(kvHash); - return TSDB_CODE_PAR_DUPLICATED_COLUMN; - } - if (code != TSDB_CODE_SUCCESS) { - taosHashCleanup(kvHash); - return code; + code = TSDB_CODE_PAR_DUPLICATED_COLUMN; + goto END; } + SML_CHECK_CODE(code); } - if (taosArrayPush(colsArray, &kvHash) == NULL) { - taosHashCleanup(kvHash); - return terrno; - } - return TSDB_CODE_SUCCESS; + SML_CHECK_NULL(taosArrayPush(colsArray, &kvHash)); + return code; +END: + taosHashCleanup(kvHash); + return code; } static int32_t smlParseLineBottom(SSmlHandle *info) { uDebug("SML:0x%" PRIx64 " smlParseLineBottom start, format:%d, linenum:%d", info->id, info->dataFormat, info->lineNum); + int32_t code = 0; if (info->dataFormat) return TSDB_CODE_SUCCESS; for (int32_t i = 0; i < info->lineNum; i++) { @@ -1728,10 +1371,6 @@ static int32_t smlParseLineBottom(SSmlHandle *info) { SSmlTableInfo **tmp = (SSmlTableInfo **)taosHashGet(info->childTables, elements->measure, elements->measureTagsLen); if (tmp) tinfo = *tmp; - } else if (info->protocol == TSDB_SML_TELNET_PROTOCOL) { - SSmlTableInfo **tmp = (SSmlTableInfo **)taosHashGet(info->childTables, elements->measureTag, - elements->measureLen + elements->tagsLen); - if (tmp) tinfo = *tmp; } else { SSmlTableInfo **tmp = (SSmlTableInfo **)taosHashGet(info->childTables, elements->measureTag, elements->measureLen + elements->tagsLen); @@ -1754,81 +1393,62 @@ static int32_t smlParseLineBottom(SSmlHandle *info) { return TSDB_CODE_PAR_TOO_MANY_COLUMNS; } - int ret = smlPushCols(tinfo->cols, elements->colArray); - if (ret != TSDB_CODE_SUCCESS) { - return ret; - } + SML_CHECK_CODE(smlPushCols(tinfo->cols, elements->colArray)); SSmlSTableMeta **tableMeta = (SSmlSTableMeta **)taosHashGet(info->superTables, elements->measure, elements->measureLen); if (tableMeta) { // update meta uDebug("SML:0x%" PRIx64 " smlParseLineBottom update meta, format:%d, linenum:%d", info->id, info->dataFormat, info->lineNum); - ret = smlUpdateMeta((*tableMeta)->colHash, (*tableMeta)->cols, elements->colArray, false, &info->msgBuf, - (*tableMeta)->tagHash); - if (ret == TSDB_CODE_SUCCESS) { - ret = smlUpdateMeta((*tableMeta)->tagHash, (*tableMeta)->tags, tinfo->tags, true, &info->msgBuf, - (*tableMeta)->colHash); - } - if (ret != TSDB_CODE_SUCCESS) { - uError("SML:0x%" PRIx64 " smlUpdateMeta failed, ret:%d", info->id, ret); - return ret; - } + SML_CHECK_CODE(smlUpdateMeta((*tableMeta)->colHash, (*tableMeta)->cols, elements->colArray, false, &info->msgBuf, + (*tableMeta)->tagHash)); + SML_CHECK_CODE(smlUpdateMeta((*tableMeta)->tagHash, (*tableMeta)->tags, tinfo->tags, true, &info->msgBuf, + (*tableMeta)->colHash)); } else { uDebug("SML:0x%" PRIx64 " smlParseLineBottom add meta, format:%d, linenum:%d", info->id, info->dataFormat, info->lineNum); SSmlSTableMeta *meta = NULL; - ret = smlBuildSTableMeta(info->dataFormat, &meta); - if (ret != TSDB_CODE_SUCCESS) { - return ret; - } - ret = taosHashPut(info->superTables, elements->measure, elements->measureLen, &meta, POINTER_BYTES); - if (ret != TSDB_CODE_SUCCESS) { + SML_CHECK_CODE(smlBuildSTableMeta(info->dataFormat, &meta)); + SML_CHECK_CODE(taosHashPut(info->superTables, elements->measure, elements->measureLen, &meta, POINTER_BYTES)); + code = taosHashPut(info->superTables, elements->measure, elements->measureLen, &meta, POINTER_BYTES); + if (code != TSDB_CODE_SUCCESS) { + smlDestroySTableMeta(meta); uError("SML:0x%" PRIx64 " put measuer to hash failed", info->id); - return ret; - } - ret = smlInsertMeta(meta->tagHash, meta->tags, tinfo->tags, NULL); - if (ret == TSDB_CODE_SUCCESS) { - ret = smlInsertMeta(meta->colHash, meta->cols, elements->colArray, meta->tagHash); - } - if (ret != TSDB_CODE_SUCCESS) { - uError("SML:0x%" PRIx64 " insert meta failed:%s", info->id, tstrerror(ret)); - return ret; + goto END; } + SML_CHECK_CODE(smlInsertMeta(meta->tagHash, meta->tags, tinfo->tags, NULL)); + SML_CHECK_CODE(smlInsertMeta(meta->colHash, meta->cols, elements->colArray, meta->tagHash)); } } uDebug("SML:0x%" PRIx64 " smlParseLineBottom end, format:%d, linenum:%d", info->id, info->dataFormat, info->lineNum); - return TSDB_CODE_SUCCESS; +END: + return code; } static int32_t smlInsertData(SSmlHandle *info) { - int32_t code = TSDB_CODE_SUCCESS; + int32_t code = TSDB_CODE_SUCCESS; + char *measure = NULL; + SSmlTableInfo **oneTable = NULL; uDebug("SML:0x%" PRIx64 " smlInsertData start, format:%d", info->id, info->dataFormat); if (info->pRequest->dbList == NULL) { info->pRequest->dbList = taosArrayInit(1, TSDB_DB_FNAME_LEN); - if (info->pRequest->dbList == NULL) { - return terrno; - } + SML_CHECK_NULL(info->pRequest->dbList); } char *data = (char *)taosArrayReserve(info->pRequest->dbList, 1); - if (data == NULL) { - return terrno; - } + SML_CHECK_NULL(data); SName pName = {TSDB_TABLE_NAME_T, info->taos->acctId, {0}, {0}}; tstrncpy(pName.dbname, info->pRequest->pDb, sizeof(pName.dbname)); (void)tNameGetFullDbName(&pName, data); // ignore - SSmlTableInfo **oneTable = (SSmlTableInfo **)taosHashIterate(info->childTables, NULL); + oneTable = (SSmlTableInfo **)taosHashIterate(info->childTables, NULL); while (oneTable) { SSmlTableInfo *tableData = *oneTable; int measureLen = tableData->sTableNameLen; - char *measure = (char *)taosMemoryMalloc(tableData->sTableNameLen); - if (measure == NULL) { - return terrno; - } + measure = (char *)taosMemoryMalloc(tableData->sTableNameLen); + SML_CHECK_NULL(measure); (void)memcpy(measure, tableData->sTableName, tableData->sTableNameLen); PROCESS_SLASH_IN_MEASUREMENT(measure, measureLen); smlStrReplace(measure, measureLen); @@ -1837,14 +1457,9 @@ static int32_t smlInsertData(SSmlHandle *info) { if (info->pRequest->tableList == NULL) { info->pRequest->tableList = taosArrayInit(1, sizeof(SName)); - if (info->pRequest->tableList == NULL) { - return terrno; - } - } - if (taosArrayPush(info->pRequest->tableList, &pName) == NULL) { - return terrno; + SML_CHECK_NULL(info->pRequest->tableList); } - + SML_CHECK_NULL(taosArrayPush(info->pRequest->tableList, &pName)); tstrncpy(pName.tname, tableData->childTableName, sizeof(pName.tname)); SRequestConnInfo conn = {0}; @@ -1853,36 +1468,18 @@ static int32_t smlInsertData(SSmlHandle *info) { conn.requestObjRefId = info->pRequest->self; conn.mgmtEps = getEpSet_s(&info->taos->pAppInfo->mgmtEp); - code = smlCheckAuth(info, &conn, pName.tname, AUTH_TYPE_WRITE); - if (code != TSDB_CODE_SUCCESS) { - taosMemoryFree(measure); - taosHashCancelIterate(info->childTables, oneTable); - return code; - } + SML_CHECK_CODE(smlCheckAuth(info, &conn, pName.tname, AUTH_TYPE_WRITE)); - SVgroupInfo vg; - code = catalogGetTableHashVgroup(info->pCatalog, &conn, &pName, &vg); - if (code != TSDB_CODE_SUCCESS) { - uError("SML:0x%" PRIx64 " catalogGetTableHashVgroup failed. table name: %s", info->id, tableData->childTableName); - taosMemoryFree(measure); - taosHashCancelIterate(info->childTables, oneTable); - return code; - } - code = taosHashPut(info->pVgHash, (const char *)&vg.vgId, sizeof(vg.vgId), (char *)&vg, sizeof(vg)); - if (code != TSDB_CODE_SUCCESS) { - uError("SML:0x%" PRIx64 " taosHashPut failed. table name: %s", info->id, tableData->childTableName); - taosMemoryFree(measure); - taosHashCancelIterate(info->childTables, oneTable); - return code; - } + SVgroupInfo vg = {0}; + SML_CHECK_CODE(catalogGetTableHashVgroup(info->pCatalog, &conn, &pName, &vg)); + SML_CHECK_CODE(taosHashPut(info->pVgHash, (const char *)&vg.vgId, sizeof(vg.vgId), (char *)&vg, sizeof(vg))); SSmlSTableMeta **pMeta = (SSmlSTableMeta **)taosHashGet(info->superTables, tableData->sTableName, tableData->sTableNameLen); - if (unlikely(NULL == pMeta || NULL == (*pMeta)->tableMeta)) { + if (unlikely(NULL == pMeta || NULL == *pMeta || NULL == (*pMeta)->tableMeta)) { uError("SML:0x%" PRIx64 " NULL == pMeta. table name: %s", info->id, tableData->childTableName); - taosMemoryFree(measure); - taosHashCancelIterate(info->childTables, oneTable); - return TSDB_CODE_SML_INTERNAL_ERROR; + code = TSDB_CODE_SML_INTERNAL_ERROR; + goto END; } // use tablemeta of stable to save vgid and uid of child table @@ -1891,23 +1488,14 @@ static int32_t smlInsertData(SSmlHandle *info) { uDebug("SML:0x%" PRIx64 " smlInsertData table:%s, uid:%" PRIu64 ", format:%d", info->id, pName.tname, tableData->uid, info->dataFormat); - code = smlBindData(info->pQuery, info->dataFormat, tableData->tags, (*pMeta)->cols, tableData->cols, + SML_CHECK_CODE(smlBindData(info->pQuery, info->dataFormat, tableData->tags, (*pMeta)->cols, tableData->cols, (*pMeta)->tableMeta, tableData->childTableName, measure, measureLen, info->ttl, info->msgBuf.buf, - info->msgBuf.len); - taosMemoryFree(measure); - if (code != TSDB_CODE_SUCCESS) { - uError("SML:0x%" PRIx64 " smlBindData failed", info->id); - taosHashCancelIterate(info->childTables, oneTable); - return code; - } + info->msgBuf.len)); + taosMemoryFreeClear(measure); oneTable = (SSmlTableInfo **)taosHashIterate(info->childTables, oneTable); } - code = smlBuildOutput(info->pQuery, info->pVgHash); - if (code != TSDB_CODE_SUCCESS) { - uError("SML:0x%" PRIx64 " smlBuildOutput failed", info->id); - return code; - } + SML_CHECK_CODE(smlBuildOutput(info->pQuery, info->pVgHash)); info->cost.insertRpcTime = taosGetTimestampUs(); SAppClusterSummary *pActivity = &info->taos->pAppInfo->summary; @@ -1919,6 +1507,11 @@ static int32_t smlInsertData(SSmlHandle *info) { tstrerror(info->pRequest->code)); return info->pRequest->code; + +END: + taosMemoryFree(measure); + taosHashCancelIterate(info->childTables, oneTable); + return code; } static void smlPrintStatisticInfo(SSmlHandle *info) { @@ -1958,11 +1551,33 @@ int32_t smlClearForRerun(SSmlHandle *info) { info->currTableDataCtx = NULL; SVnodeModifyOpStmt *stmt = (SVnodeModifyOpStmt *)(info->pQuery->pRoot); + if (stmt == NULL){ + return TSDB_CODE_SML_INVALID_DATA; + } stmt->freeHashFunc(stmt->pTableBlockHashObj); stmt->pTableBlockHashObj = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), true, HASH_NO_LOCK); + if (stmt->pTableBlockHashObj == NULL) { + uError("SML:0x%" PRIx64 " stmt->pTableBlockHashObj == NULL", info->id); + return terrno; + } return TSDB_CODE_SUCCESS; } +static void printRaw(int64_t id, int lineNum, int numLines, ELogLevel level, char* data, int32_t len){ + char *print = taosMemoryCalloc(len + 1, 1); + if (print == NULL) { + uError("SML:0x%" PRIx64 " smlParseLine failed. code : %d", id, terrno); + return; + } + (void)memcpy(print, data, len); + if (level == DEBUG_DEBUG){ + uDebug("SML:0x%" PRIx64 " smlParseLine is raw, line %d/%d : %s", id, lineNum, numLines, print); + }else if (level == DEBUG_ERROR){ + uError("SML:0x%" PRIx64 " smlParseLine failed. line %d/%d : %s", id, lineNum, numLines, print); + } + taosMemoryFree(print); +} + static bool getLine(SSmlHandle *info, char *lines[], char **rawLine, char *rawLineEnd, int numLines, int i, char **tmp, int *len) { if (lines) { @@ -1976,24 +1591,15 @@ static bool getLine(SSmlHandle *info, char *lines[], char **rawLine, char *rawLi } (*len)++; } - if (info->protocol == TSDB_SML_LINE_PROTOCOL && (*tmp)[0] == '#') { // this line is comment + if (IS_COMMENT(info->protocol,(*tmp)[0])) { // this line is comment return false; } } if (*rawLine != NULL && (uDebugFlag & DEBUG_DEBUG)) { - char *print = taosMemoryCalloc(*len + 1, 1); - if (print != NULL) { - (void)memcpy(print, *tmp, *len); - uDebug("SML:0x%" PRIx64 " smlParseLine is raw, numLines:%d, protocol:%d, len:%d, data:%s", info->id, numLines, - info->protocol, *len, print); - taosMemoryFree(print); - } else { - uError("SML:0x%" PRIx64 " smlParseLine taosMemoryCalloc failed", info->id); - } + printRaw(info->id, i, numLines, DEBUG_DEBUG, *tmp, *len); } else { - uDebug("SML:0x%" PRIx64 " smlParseLine is not numLines:%d, protocol:%d, len:%d, data:%s", info->id, numLines, - info->protocol, *len, *tmp); + uDebug("SML:0x%" PRIx64 " smlParseLine is not raw, line %d/%d : %s", info->id, i, numLines, *tmp); } return true; } @@ -2042,14 +1648,7 @@ static int32_t smlParseLine(SSmlHandle *info, char *lines[], char *rawLine, char } if (code != TSDB_CODE_SUCCESS) { if (rawLine != NULL) { - char *print = taosMemoryCalloc(len + 1, 1); - if (print == NULL) { - uError("SML:0x%" PRIx64 " smlParseLine failed. out of memory", info->id); - return code; - } - (void)memcpy(print, tmp, len); - uError("SML:0x%" PRIx64 " smlParseLine failed. line %d : %s", info->id, i, print); - taosMemoryFree(print); + printRaw(info->id, i, numLines, DEBUG_ERROR, tmp, len); } else { uError("SML:0x%" PRIx64 " smlParseLine failed. line %d : %s", info->id, i, tmp); } @@ -2078,21 +1677,12 @@ static int smlProcess(SSmlHandle *info, char *lines[], char *rawLine, char *rawL info->cost.parseTime = taosGetTimestampUs(); - code = smlParseLine(info, lines, rawLine, rawLineEnd, numLines); - if (code != 0) { - uError("SML:0x%" PRIx64 " smlParseLine error : %s", info->id, tstrerror(code)); - return code; - } - code = smlParseLineBottom(info); - if (code != 0) { - uError("SML:0x%" PRIx64 " smlParseLineBottom error : %s", info->id, tstrerror(code)); - return code; - } + SML_CHECK_CODE(smlParseLine(info, lines, rawLine, rawLineEnd, numLines)); + SML_CHECK_CODE(smlParseLineBottom(info)); info->cost.lineNum = info->lineNum; info->cost.numOfSTables = taosHashGetSize(info->superTables); info->cost.numOfCTables = taosHashGetSize(info->childTables); - info->cost.schemaTime = taosGetTimestampUs(); do { @@ -2105,18 +1695,11 @@ static int smlProcess(SSmlHandle *info, char *lines[], char *rawLine, char *rawL uInfo("SML:0x%" PRIx64 " smlModifyDBSchemas retry code:%s, times:%d", info->id, tstrerror(code), retryNum); } while (retryNum++ < taosHashGetSize(info->superTables) * MAX_RETRY_TIMES); - if (code != 0) { - uError("SML:0x%" PRIx64 " smlModifyDBSchemas error : %s", info->id, tstrerror(code)); - return code; - } - + SML_CHECK_CODE(code); info->cost.insertBindTime = taosGetTimestampUs(); - code = smlInsertData(info); - if (code != 0) { - uError("SML:0x%" PRIx64 " smlInsertData error : %s", info->id, tstrerror(code)); - return code; - } + SML_CHECK_CODE(smlInsertData(info)); +END: return code; } @@ -2160,29 +1743,16 @@ void smlSetReqSQL(SRequestObj *request, char *lines[], char *rawLine, char *rawL TAOS_RES *taos_schemaless_insert_inner(TAOS *taos, char *lines[], char *rawLine, char *rawLineEnd, int numLines, int protocol, int precision, int32_t ttl, int64_t reqid, char *tbnameKey) { - int32_t code = TSDB_CODE_SUCCESS; - if (NULL == taos) { - uError("SML:taos_schemaless_insert error taos is null"); - return NULL; - } + int32_t code = TSDB_CODE_SUCCESS; SRequestObj *request = NULL; - SSmlHandle *info = NULL; - int cnt = 0; + SSmlHandle *info = NULL; + int cnt = 0; while (1) { - code = createRequest(*(int64_t *)taos, TSDB_SQL_INSERT, reqid, &request); - if (TSDB_CODE_SUCCESS != code) { - uError("SML:taos_schemaless_insert error request is null"); - return NULL; - } - + SML_CHECK_CODE(createRequest(*(int64_t *)taos, TSDB_SQL_INSERT, reqid, &request)); SSmlMsgBuf msg = {ERROR_MSG_BUF_DEFAULT_SIZE, request->msgBuf}; - code = smlBuildSmlInfo(taos, &info); - if (code != TSDB_CODE_SUCCESS) { - request->code = code; - smlBuildInvalidDataMsg(&msg, "init SSmlHandle failed", NULL); - uError("SML:taos_schemaless_insert error SSmlHandle is null, err msg:%s", tstrerror(code)); - goto end; - } + request->code = smlBuildSmlInfo(taos, &info); + SML_CHECK_CODE(request->code); + info->pRequest = request; info->pRequest->pQuery = info->pQuery; info->ttl = ttl; @@ -2198,20 +1768,20 @@ TAOS_RES *taos_schemaless_insert_inner(TAOS *taos, char *lines[], char *rawLine, if (request->pDb == NULL) { request->code = TSDB_CODE_PAR_DB_NOT_SPECIFIED; smlBuildInvalidDataMsg(&msg, "Database not specified", NULL); - goto end; + goto END; } if (protocol < TSDB_SML_LINE_PROTOCOL || protocol > TSDB_SML_JSON_PROTOCOL) { request->code = TSDB_CODE_SML_INVALID_PROTOCOL_TYPE; smlBuildInvalidDataMsg(&msg, "protocol invalidate", NULL); - goto end; + goto END; } if (protocol == TSDB_SML_LINE_PROTOCOL && (precision < TSDB_SML_TIMESTAMP_NOT_CONFIGURED || precision > TSDB_SML_TIMESTAMP_NANO_SECONDS)) { request->code = TSDB_CODE_SML_INVALID_PRECISION_TYPE; smlBuildInvalidDataMsg(&msg, "precision invalidate for line protocol", NULL); - goto end; + goto END; } if (protocol == TSDB_SML_JSON_PROTOCOL) { @@ -2219,7 +1789,7 @@ TAOS_RES *taos_schemaless_insert_inner(TAOS *taos, char *lines[], char *rawLine, } else if (numLines <= 0) { request->code = TSDB_CODE_SML_INVALID_DATA; smlBuildInvalidDataMsg(&msg, "line num is invalid", NULL); - goto end; + goto END; } code = smlProcess(info, lines, rawLine, rawLineEnd, numLines); @@ -2249,7 +1819,7 @@ TAOS_RES *taos_schemaless_insert_inner(TAOS *taos, char *lines[], char *rawLine, break; } -end: + END: smlDestroyInfo(info); return (TAOS_RES *)request; } @@ -2275,6 +1845,16 @@ TAOS_RES *taos_schemaless_insert_inner(TAOS *taos, char *lines[], char *rawLine, TAOS_RES *taos_schemaless_insert_ttl_with_reqid_tbname_key(TAOS *taos, char *lines[], int numLines, int protocol, int precision, int32_t ttl, int64_t reqid, char *tbnameKey) { + if (taos == NULL || lines == NULL || numLines <= 0) { + terrno = TSDB_CODE_INVALID_PARA; + return NULL; + } + for (int i = 0; i < numLines; i++){ + if (lines[i] == NULL){ + terrno = TSDB_CODE_INVALID_PARA; + return NULL; + } + } return taos_schemaless_insert_inner(taos, lines, NULL, NULL, numLines, protocol, precision, ttl, reqid, tbnameKey); } @@ -2298,26 +1878,32 @@ TAOS_RES *taos_schemaless_insert_with_reqid(TAOS *taos, char *lines[], int numLi reqid); } -static void getRawLineLen(char *lines, int len, int32_t *totalRows, int protocol) { +static int32_t getRawLineLen(char *lines, int len, int protocol) { int numLines = 0; - *totalRows = 0; char *tmp = lines; for (int i = 0; i < len; i++) { if (lines[i] == '\n' || i == len - 1) { - numLines++; - if (tmp[0] != '#' || protocol != TSDB_SML_LINE_PROTOCOL) { // ignore comment - (*totalRows)++; + if (!IS_COMMENT(protocol, tmp[0])) { // ignore comment + numLines++; } tmp = lines + i + 1; } } + return numLines; } TAOS_RES *taos_schemaless_insert_raw_ttl_with_reqid_tbname_key(TAOS *taos, char *lines, int len, int32_t *totalRows, int protocol, int precision, int32_t ttl, int64_t reqid, char *tbnameKey) { - getRawLineLen(lines, len, totalRows, protocol); - return taos_schemaless_insert_inner(taos, NULL, lines, lines + len, *totalRows, protocol, precision, ttl, reqid, + if (taos == NULL || lines == NULL || len <= 0) { + terrno = TSDB_CODE_INVALID_PARA; + return NULL; + } + int numLines = getRawLineLen(lines, len, protocol); + if (totalRows != NULL){ + *totalRows = numLines; + } + return taos_schemaless_insert_inner(taos, NULL, lines, lines + len, numLines, protocol, precision, ttl, reqid, tbnameKey); } diff --git a/source/client/src/clientSmlJson.c b/source/client/src/clientSmlJson.c index ece1ddf61f4f..9568074018d4 100644 --- a/source/client/src/clientSmlJson.c +++ b/source/client/src/clientSmlJson.c @@ -184,7 +184,7 @@ int smlJsonParseObjFirst(char **start, SSmlLineInfo *element, int8_t *offset) { return 0; } -int smlJsonParseObj(char **start, SSmlLineInfo *element, int8_t *offset) { +int smlJsonParseObj(char **start, char *end, SSmlLineInfo *element, int8_t *offset) { int index = 0; while (*(*start)) { if ((*start)[0] != '"') { @@ -197,6 +197,10 @@ int smlJsonParseObj(char **start, SSmlLineInfo *element, int8_t *offset) { return TSDB_CODE_TSC_INVALID_JSON; } + if ((*start) + offset[index] >= end){ + return TSDB_CODE_TSC_INVALID_JSON; + } + if ((*start)[1] == 'm') { (*start) += offset[index++]; element->measure = *start; @@ -539,28 +543,19 @@ static int32_t smlProcessTagJson(SSmlHandle *info, cJSON *tags){ } static int32_t smlParseTagsFromJSON(SSmlHandle *info, cJSON *tags, SSmlLineInfo *elements) { - int32_t ret = 0; + int32_t code = 0; if(info->dataFormat){ - ret = smlProcessSuperTable(info, elements); - if(ret != 0){ - if(info->reRun){ - return TSDB_CODE_SUCCESS; - } - return ret; - } - } - ret = smlProcessTagJson(info, tags); - if(ret != 0){ - if(info->reRun){ - return TSDB_CODE_SUCCESS; - } - return ret; - } - ret = smlJoinMeasureTag(elements); - if(ret != 0){ - return ret; + SML_CHECK_CODE(smlProcessSuperTable(info, elements)); } + SML_CHECK_CODE(smlProcessTagJson(info, tags)); + SML_CHECK_CODE(smlJoinMeasureTag(elements)); return smlProcessChildTable(info, elements); + +END: + if(info->reRun){ + return TSDB_CODE_SUCCESS; + } + return code; } static int64_t smlParseTSFromJSONObj(SSmlHandle *info, cJSON *root, int32_t toPrecision) { @@ -757,19 +752,18 @@ static int32_t smlParseJSONStringExt(SSmlHandle *info, cJSON *root, SSmlLineInfo } SSmlKv kvTs = {0}; smlBuildTsKv(&kvTs, ts); - - return smlParseEndTelnetJson(info, elements, &kvTs, &kv); + if (info->dataFormat){ + ret = smlParseEndTelnetJsonFormat(info, elements, &kvTs, &kv); + } else { + ret = smlParseEndTelnetJsonUnFormat(info, elements, &kvTs, &kv); + } + return ret; } static int32_t smlParseJSONExt(SSmlHandle *info, char *payload) { int32_t payloadNum = 0; int32_t ret = TSDB_CODE_SUCCESS; - if (unlikely(payload == NULL)) { - uError("SML:0x%" PRIx64 " empty JSON Payload", info->id); - return TSDB_CODE_TSC_INVALID_JSON; - } - info->root = cJSON_Parse(payload); if (unlikely(info->root == NULL)) { uError("SML:0x%" PRIx64 " parse json failed:%s", info->id, payload); @@ -836,13 +830,13 @@ static int32_t smlParseJSONExt(SSmlHandle *info, char *payload) { return TSDB_CODE_SUCCESS; } -static int32_t smlParseJSONString(SSmlHandle *info, char **start, SSmlLineInfo *elements) { +static int32_t smlParseJSONString(SSmlHandle *info, char **start, char *end, SSmlLineInfo *elements) { int32_t ret = TSDB_CODE_SUCCESS; if (info->offset[0] == 0) { ret = smlJsonParseObjFirst(start, elements, info->offset); } else { - ret = smlJsonParseObj(start, elements, info->offset); + ret = smlJsonParseObj(start, end, elements, info->offset); } if (ret != TSDB_CODE_SUCCESS) { @@ -870,7 +864,7 @@ static int32_t smlParseJSONString(SSmlHandle *info, char **start, SSmlLineInfo * elements->cols[elements->colsLen] = tmp; return TSDB_CODE_TSC_INVALID_JSON; } - if (taosArrayPush(info->tagJsonArray, &valueJson) == NULL){ + if (taosArrayPush(info->valueJsonArray, &valueJson) == NULL){ cJSON_Delete(valueJson); elements->cols[elements->colsLen] = tmp; return terrno; @@ -945,20 +939,26 @@ static int32_t smlParseJSONString(SSmlHandle *info, char **start, SSmlLineInfo * SSmlKv kvTs = {0}; smlBuildTsKv(&kvTs, ts); - return smlParseEndTelnetJson(info, elements, &kvTs, &kv); + if (info->dataFormat){ + ret = smlParseEndTelnetJsonFormat(info, elements, &kvTs, &kv); + } else { + ret = smlParseEndTelnetJsonUnFormat(info, elements, &kvTs, &kv); + } + return ret; } int32_t smlParseJSON(SSmlHandle *info, char *payload) { - int32_t payloadNum = 1 << 15; + int32_t payloadNum = 1 << 10; int32_t ret = TSDB_CODE_SUCCESS; uDebug("SML:0x%" PRIx64 "json:%s", info->id, payload); int cnt = 0; char *dataPointStart = payload; + char *dataPointEnd = payload + strlen(payload); while (1) { if (info->dataFormat) { SSmlLineInfo element = {0}; - ret = smlParseJSONString(info, &dataPointStart, &element); + ret = smlParseJSONString(info, &dataPointStart, dataPointEnd, &element); if (element.measureTagsLen != 0) taosMemoryFree(element.measureTag); } else { if (cnt >= payloadNum) { @@ -971,7 +971,7 @@ int32_t smlParseJSON(SSmlHandle *info, char *payload) { info->lines = (SSmlLineInfo *)tmp; (void)memset(info->lines + cnt, 0, (payloadNum - cnt) * sizeof(SSmlLineInfo)); } - ret = smlParseJSONString(info, &dataPointStart, info->lines + cnt); + ret = smlParseJSONString(info, &dataPointStart, dataPointEnd, info->lines + cnt); if ((info->lines + cnt)->measure == NULL) break; } if (unlikely(ret != TSDB_CODE_SUCCESS)) { diff --git a/source/client/src/clientSmlLine.c b/source/client/src/clientSmlLine.c index c1f3431698df..5ecf4e2206f8 100644 --- a/source/client/src/clientSmlLine.c +++ b/source/client/src/clientSmlLine.c @@ -298,7 +298,7 @@ static int32_t smlProcessTagLine(SSmlHandle *info, char **sql, char *sqlEnd){ } if (info->dataFormat && !isSmlTagAligned(info, cnt, &kv)) { - return TSDB_CODE_TSC_INVALID_JSON; + return TSDB_CODE_SML_INVALID_DATA; } cnt++; @@ -311,31 +311,23 @@ static int32_t smlProcessTagLine(SSmlHandle *info, char **sql, char *sqlEnd){ } static int32_t smlParseTagLine(SSmlHandle *info, char **sql, char *sqlEnd, SSmlLineInfo *elements) { + int32_t code = 0; bool isSameCTable = IS_SAME_CHILD_TABLE; if(isSameCTable){ return TSDB_CODE_SUCCESS; } - int32_t ret = 0; if(info->dataFormat){ - ret = smlProcessSuperTable(info, elements); - if(ret != 0){ - if(info->reRun){ - return TSDB_CODE_SUCCESS; - } - return ret; - } + SML_CHECK_CODE(smlProcessSuperTable(info, elements)); } + SML_CHECK_CODE(smlProcessTagLine(info, sql, sqlEnd)); + return smlProcessChildTable(info, elements); - ret = smlProcessTagLine(info, sql, sqlEnd); - if(ret != 0){ - if (info->reRun){ - return TSDB_CODE_SUCCESS; - } - return ret; +END: + if(info->reRun){ + return TSDB_CODE_SUCCESS; } - - return smlProcessChildTable(info, elements); + return code; } static int32_t smlParseColLine(SSmlHandle *info, char **sql, char *sqlEnd, SSmlLineInfo *currElement) { diff --git a/source/client/src/clientSmlTelnet.c b/source/client/src/clientSmlTelnet.c index e8601e33bc8e..bf422675efeb 100644 --- a/source/client/src/clientSmlTelnet.c +++ b/source/client/src/clientSmlTelnet.c @@ -148,31 +148,20 @@ static int32_t smlParseTelnetTags(SSmlHandle *info, char *data, char *sqlEnd, SS return TSDB_CODE_SUCCESS; } - int32_t ret = 0; + int32_t code = 0; if(info->dataFormat){ - ret = smlProcessSuperTable(info, elements); - if(ret != 0){ - if(info->reRun){ - return TSDB_CODE_SUCCESS; - } - return ret; - } + SML_CHECK_CODE(smlProcessSuperTable(info, elements)); } + SML_CHECK_CODE(smlProcessTagTelnet(info, data, sqlEnd)); + SML_CHECK_CODE(smlJoinMeasureTag(elements)); - ret = smlProcessTagTelnet(info, data, sqlEnd); - if(ret != 0){ - if (info->reRun){ - return TSDB_CODE_SUCCESS; - } - return ret; - } + return smlProcessChildTable(info, elements); - ret = smlJoinMeasureTag(elements); - if(ret != 0){ - return ret; +END: + if(info->reRun){ + return TSDB_CODE_SUCCESS; } - - return smlProcessChildTable(info, elements); + return code; } // format: =[ =] @@ -239,5 +228,10 @@ int32_t smlParseTelnetString(SSmlHandle *info, char *sql, char *sqlEnd, SSmlLine kvTs.i = convertTimePrecision(kvTs.i, TSDB_TIME_PRECISION_NANO, info->currSTableMeta->tableInfo.precision); } - return smlParseEndTelnetJson(info, elements, &kvTs, &kv); + if (info->dataFormat){ + ret = smlParseEndTelnetJsonFormat(info, elements, &kvTs, &kv); + } else { + ret = smlParseEndTelnetJsonUnFormat(info, elements, &kvTs, &kv); + } + return ret; } \ No newline at end of file diff --git a/source/client/test/smlTest.cpp b/source/client/test/smlTest.cpp index dc6a302924f6..bcd12a393a48 100644 --- a/source/client/test/smlTest.cpp +++ b/source/client/test/smlTest.cpp @@ -591,6 +591,104 @@ TEST(testCase, smlParseTelnetLine_Test) { // smlDestroyInfo(info); //} +bool smlParseNumberOld(SSmlKv *kvVal, SSmlMsgBuf *msg) { + const char *pVal = kvVal->value; + int32_t len = kvVal->length; + char *endptr = NULL; + double result = taosStr2Double(pVal, &endptr); + if (pVal == endptr) { + smlBuildInvalidDataMsg(msg, "invalid data", pVal); + return false; + } + + int32_t left = len - (endptr - pVal); + if (left == 0 || (left == 3 && strncasecmp(endptr, "f64", left) == 0)) { + kvVal->type = TSDB_DATA_TYPE_DOUBLE; + kvVal->d = result; + } else if ((left == 3 && strncasecmp(endptr, "f32", left) == 0)) { + if (!IS_VALID_FLOAT(result)) { + smlBuildInvalidDataMsg(msg, "float out of range[-3.402823466e+38,3.402823466e+38]", pVal); + return false; + } + kvVal->type = TSDB_DATA_TYPE_FLOAT; + kvVal->f = (float)result; + } else if ((left == 1 && *endptr == 'i') || (left == 3 && strncasecmp(endptr, "i64", left) == 0)) { + if (smlDoubleToInt64OverFlow(result)) { + errno = 0; + int64_t tmp = taosStr2Int64(pVal, &endptr, 10); + if (errno == ERANGE) { + smlBuildInvalidDataMsg(msg, "big int out of range[-9223372036854775808,9223372036854775807]", pVal); + return false; + } + kvVal->type = TSDB_DATA_TYPE_BIGINT; + kvVal->i = tmp; + return true; + } + kvVal->type = TSDB_DATA_TYPE_BIGINT; + kvVal->i = (int64_t)result; + } else if ((left == 1 && *endptr == 'u') || (left == 3 && strncasecmp(endptr, "u64", left) == 0)) { + if (result >= (double)UINT64_MAX || result < 0) { + errno = 0; + uint64_t tmp = taosStr2UInt64(pVal, &endptr, 10); + if (errno == ERANGE || result < 0) { + smlBuildInvalidDataMsg(msg, "unsigned big int out of range[0,18446744073709551615]", pVal); + return false; + } + kvVal->type = TSDB_DATA_TYPE_UBIGINT; + kvVal->u = tmp; + return true; + } + kvVal->type = TSDB_DATA_TYPE_UBIGINT; + kvVal->u = result; + } else if (left == 3 && strncasecmp(endptr, "i32", left) == 0) { + if (!IS_VALID_INT(result)) { + smlBuildInvalidDataMsg(msg, "int out of range[-2147483648,2147483647]", pVal); + return false; + } + kvVal->type = TSDB_DATA_TYPE_INT; + kvVal->i = result; + } else if (left == 3 && strncasecmp(endptr, "u32", left) == 0) { + if (!IS_VALID_UINT(result)) { + smlBuildInvalidDataMsg(msg, "unsigned int out of range[0,4294967295]", pVal); + return false; + } + kvVal->type = TSDB_DATA_TYPE_UINT; + kvVal->u = result; + } else if (left == 3 && strncasecmp(endptr, "i16", left) == 0) { + if (!IS_VALID_SMALLINT(result)) { + smlBuildInvalidDataMsg(msg, "small int our of range[-32768,32767]", pVal); + return false; + } + kvVal->type = TSDB_DATA_TYPE_SMALLINT; + kvVal->i = result; + } else if (left == 3 && strncasecmp(endptr, "u16", left) == 0) { + if (!IS_VALID_USMALLINT(result)) { + smlBuildInvalidDataMsg(msg, "unsigned small int out of rang[0,65535]", pVal); + return false; + } + kvVal->type = TSDB_DATA_TYPE_USMALLINT; + kvVal->u = result; + } else if (left == 2 && strncasecmp(endptr, "i8", left) == 0) { + if (!IS_VALID_TINYINT(result)) { + smlBuildInvalidDataMsg(msg, "tiny int out of range[-128,127]", pVal); + return false; + } + kvVal->type = TSDB_DATA_TYPE_TINYINT; + kvVal->i = result; + } else if (left == 2 && strncasecmp(endptr, "u8", left) == 0) { + if (!IS_VALID_UTINYINT(result)) { + smlBuildInvalidDataMsg(msg, "unsigned tiny int out of range[0,255]", pVal); + return false; + } + kvVal->type = TSDB_DATA_TYPE_UTINYINT; + kvVal->u = result; + } else { + smlBuildInvalidDataMsg(msg, "invalid data", pVal); + return false; + } + return true; +} + TEST(testCase, smlParseNumber_performance_Test) { char msg[256] = {0}; SSmlMsgBuf msgBuf; diff --git a/source/libs/parser/src/parInsertSml.c b/source/libs/parser/src/parInsertSml.c index cca35d9c9ac1..b1ff8cb733de 100644 --- a/source/libs/parser/src/parInsertSml.c +++ b/source/libs/parser/src/parInsertSml.c @@ -468,35 +468,38 @@ int32_t smlBindData(SQuery* query, bool dataFormat, SArray* tags, SArray* colsSc int32_t smlInitHandle(SQuery** query) { *query = NULL; SQuery* pQuery = NULL; + SVnodeModifyOpStmt* stmt = NULL; + int32_t code = nodesMakeNode(QUERY_NODE_QUERY, (SNode**)&pQuery); - if (NULL == pQuery) { + if (code != 0) { uError("create pQuery error"); - return code; + goto END; } pQuery->execMode = QUERY_EXEC_MODE_SCHEDULE; pQuery->haveResultSet = false; pQuery->msgType = TDMT_VND_SUBMIT; - SVnodeModifyOpStmt* stmt = NULL; code = nodesMakeNode(QUERY_NODE_VNODE_MODIFY_STMT, (SNode**)&stmt); - if (NULL == stmt) { + if (code != 0) { uError("create SVnodeModifyOpStmt error"); - qDestroyQuery(pQuery); - return code; + goto END; } stmt->pTableBlockHashObj = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), true, HASH_NO_LOCK); if (stmt->pTableBlockHashObj == NULL){ uError("create pTableBlockHashObj error"); - qDestroyQuery(pQuery); - nodesDestroyNode((SNode*)stmt); - return terrno; + code = terrno; + goto END; } stmt->freeHashFunc = insDestroyTableDataCxtHashMap; stmt->freeArrayFunc = insDestroyVgroupDataCxtList; pQuery->pRoot = (SNode*)stmt; *query = pQuery; + return code; - return TSDB_CODE_SUCCESS; +END: + nodesDestroyNode((SNode*)stmt); + qDestroyQuery(pQuery); + return code; } int32_t smlBuildOutput(SQuery* handle, SHashObj* pVgHash) { From 4d26469ac51651e8f8abbbd47c326be40439ff07 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Mon, 21 Oct 2024 18:44:22 +0800 Subject: [PATCH 168/695] enh:[TS-5441] cost too long in tmq write meta data by cache meta and vg info --- source/client/src/clientRawBlockWrite.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/source/client/src/clientRawBlockWrite.c b/source/client/src/clientRawBlockWrite.c index 22de6e4a75f6..681d6e5fdb5f 100644 --- a/source/client/src/clientRawBlockWrite.c +++ b/source/client/src/clientRawBlockWrite.c @@ -1936,9 +1936,8 @@ static int32_t tmqWriteRawDataImpl(TAOS* taos, void* data, int32_t dataLen){ SRequestObj* pRequest = NULL; SCatalog* pCatalog = NULL; SRequestConnInfo conn = {0}; - - uDebug(LOG_ID_TAG " write raw data, data:%p, dataLen:%d", LOG_ID_VALUE, data, dataLen); RAW_RETURN_CHECK(buildRawRequest(taos, &pRequest, &pCatalog, &conn)); + uDebug(LOG_ID_TAG " write raw data, data:%p, dataLen:%d", LOG_ID_VALUE, data, dataLen); RAW_RETURN_CHECK(decodeRawData(&decoder, data, dataLen, tDecodeMqDataRsp, &rspObj)); SHashObj *pVgHash = NULL; @@ -2012,8 +2011,8 @@ static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, int32_t dataLen) SCatalog* pCatalog = NULL; SRequestConnInfo conn = {0}; - uDebug(LOG_ID_TAG " write raw metadata, data:%p, dataLen:%d", LOG_ID_VALUE, data, dataLen); RAW_RETURN_CHECK(buildRawRequest(taos, &pRequest, &pCatalog, &conn)); + uDebug(LOG_ID_TAG " write raw metadata, data:%p, dataLen:%d", LOG_ID_VALUE, data, dataLen); RAW_RETURN_CHECK(decodeRawData(&decoder, data, dataLen, tDecodeSTaosxRsp, &rspObj)); pCreateTbHash = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK); @@ -2284,7 +2283,7 @@ void tmq_free_raw(tmq_raw_data raw) { } static int32_t writeRawInit(){ - while (atomic_load_8(&initedFlag) == WRITE_RAW_INIT_OK) { + while (atomic_load_8(&initedFlag) == WRITE_RAW_INIT_START) { int8_t old = atomic_val_compare_exchange_8(&initFlag, 0, 1); if (old == 0) { int32_t code = initRawCacheHash(); From 1ffc1a20ffd8693b4a1a8217c09498e446cd0d38 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Mon, 21 Oct 2024 19:16:52 +0800 Subject: [PATCH 169/695] add ci --- .../tsim/stream/streamTwaFwcInterval.sim | 165 ++++++++++++++++++ 1 file changed, 165 insertions(+) diff --git a/tests/script/tsim/stream/streamTwaFwcInterval.sim b/tests/script/tsim/stream/streamTwaFwcInterval.sim index d439bdccb39c..c9ff7ef5e839 100644 --- a/tests/script/tsim/stream/streamTwaFwcInterval.sim +++ b/tests/script/tsim/stream/streamTwaFwcInterval.sim @@ -124,6 +124,171 @@ if $data11 != $query2_data11 then return loop1 endi + +print step2 +print =============== create database +sql create database test2 vgroups 4; +sql use test2; + +sql create stable st(ts timestamp, a int, b int , c int)tags(ta int,tb int,tc int); +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); + +sql create stream streams2 trigger force_window_close IGNORE EXPIRED 1 IGNORE UPDATE 1 into streamt as select _wstart, count(*), ta from st partition by tbname,ta interval(2s); + +run tsim/stream/checkTaskStatus.sim + +sql insert into t1 values(now + 3000a,1,1,1) (now + 3100a,3,10,10) (now + 3200a,5,10,10) (now + 5100a,20,1,1) (now + 5200a,30,10,10) (now + 5300a,40,10,10); +sql insert into t2 values(now + 3000a,1,1,1) (now + 3100a,3,10,10) (now + 3200a,5,10,10) (now + 5100a,10,1,1) (now + 5200a,40,10,10) (now + 5300a,7,10,10); + + +print sql select _wstart, count(*) from t1 interval(2s) order by 1; +sql select _wstart, count(*) from t1 interval(2s) order by 1; + +$query1_data01 = $data01 +$query1_data11 = $data11 + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +$loop_count = 0 +loop2: + +sleep 2000 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 2 sql select * from streamt where ta == 1 order by 1; +sql select * from streamt where ta == 1 order by 1; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +if $data01 != $query1_data01 then + print ======data01======$data01 + print ====query1_data01=$query1_data01 + return loop2 +endi + +if $data11 != $query1_data11 then + print ======data11========$data11 + print ======query1_data11=$query1_data11 + return loop2 +endi + +sql insert into t1 values(now + 3000a,1,1,1) (now + 3100a,3,10,10) (now + 3200a,5,10,10) (now + 5100a,20,1,1) (now + 5200a,30,10,10) (now + 5300a,40,10,10); +sql insert into t2 values(now + 3000a,1,1,1) (now + 3100a,3,10,10) (now + 3200a,5,10,10) (now + 5100a,10,1,1) (now + 5200a,40,10,10) (now + 5300a,7,10,10); + +print sql select _wstart, count(*) from t1 interval(2s) order by 1; +sql select _wstart, count(*) from t1 interval(2s) order by 1; + +$query1_data21 = $data21 +$query1_data31 = $data31 + + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +$loop_count = 0 +loop3: + +sleep 2000 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 2 sql select * from streamt where ta == 1 order by 1; +sql select * from streamt where ta == 1 order by 1; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +if $data21 != $query1_data21 then + print ======data21======$data21 + print ====query1_data21=$query1_data21 + return loop3 +endi + +if $data31 != $query1_data31 then + print ======data31========$data31 + print ======query1_data31=$query1_data31 + return loop3 +endi + + +sql insert into t1 values(now + 3000a,1,1,1) (now + 3100a,3,10,10) (now + 3200a,5,10,10) (now + 5100a,20,1,1) (now + 5200a,30,10,10) (now + 5300a,40,10,10); +sql insert into t2 values(now + 3000a,1,1,1) (now + 3100a,3,10,10) (now + 3200a,5,10,10) (now + 5100a,10,1,1) (now + 5200a,40,10,10) (now + 5300a,7,10,10); + +print sql select _wstart, count(*) from t1 interval(2s) order by 1; +sql select _wstart, count(*) from t1 interval(2s) order by 1; + +$query1_data41 = $data41 +$query1_data51 = $data51 + + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +$loop_count = 0 +loop3: + +sleep 2000 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 2 sql select * from streamt where ta == 1 order by 1; +sql select * from streamt where ta == 1 order by 1; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +if $data41 != $query1_data41 then + print ======data41======$data41 + print ====query1_data41=$query1_data41 + return loop3 +endi + +if $data51 != $query1_data51 then + print ======data51========$data51 + print ======query1_data51=$query1_data51 + return loop3 +endi + print end system sh/exec.sh -n dnode1 -s stop -x SIGINT From 6a9fd0c95e2a61f4d8775e40c22088569d711168 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Mon, 21 Oct 2024 19:24:52 +0800 Subject: [PATCH 170/695] enh: add operator --- include/common/tmsg.h | 4 +- source/libs/executor/test/queryPlanTests.cpp | 182 ++++++++++++++++--- source/libs/scheduler/inc/schInt.h | 5 +- source/libs/scheduler/src/schJob.c | 26 ++- source/libs/scheduler/src/schTask.c | 2 +- source/libs/scheduler/src/schUtil.c | 47 +++++ 6 files changed, 222 insertions(+), 44 deletions(-) diff --git a/include/common/tmsg.h b/include/common/tmsg.h index 1a10f02c965d..11c9be4d064c 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -412,7 +412,7 @@ typedef enum ENodeType { // physical plan node QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN = 1100, QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN, - QUERY_NODE_PHYSICAL_PLAN_TABLE_SEQ_SCAN, + QUERY_NODE_PHYSICAL_PLAN_TABLE_SEQ_SCAN, // INACTIVE QUERY_NODE_PHYSICAL_PLAN_TABLE_MERGE_SCAN, QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN, QUERY_NODE_PHYSICAL_PLAN_SYSTABLE_SCAN, @@ -426,7 +426,7 @@ typedef enum ENodeType { QUERY_NODE_PHYSICAL_PLAN_SORT, QUERY_NODE_PHYSICAL_PLAN_GROUP_SORT, QUERY_NODE_PHYSICAL_PLAN_HASH_INTERVAL, - QUERY_NODE_PHYSICAL_PLAN_MERGE_INTERVAL, + QUERY_NODE_PHYSICAL_PLAN_MERGE_INTERVAL, // INACTIVE QUERY_NODE_PHYSICAL_PLAN_MERGE_ALIGNED_INTERVAL, QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL, QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL, diff --git a/source/libs/executor/test/queryPlanTests.cpp b/source/libs/executor/test/queryPlanTests.cpp index 52edd59b7511..f03d347a787c 100755 --- a/source/libs/executor/test/queryPlanTests.cpp +++ b/source/libs/executor/test/queryPlanTests.cpp @@ -46,7 +46,7 @@ namespace { -#define QPT_MAX_LOOP 1000000 +#define QPT_MAX_LOOP 1000 #define QPT_MAX_LEVEL_SUBPLAN_NUM 10 #define QPT_MAX_SUBPLAN_LEVEL 5 #define QPT_MAX_SUBPLAN_GROUP 5 @@ -256,7 +256,7 @@ SNode* qptCreateSubplanNode(int32_t nodeType); SQPTPlan qptPlans[] = { {QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN, QPT_PLAN_PHYSIC, "tagScan", qptCreateTagScanPhysiNode}, {QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN, QPT_PLAN_PHYSIC, "tableScan", qptCreateTableScanPhysiNode}, - {QUERY_NODE_PHYSICAL_PLAN_TABLE_SEQ_SCAN, QPT_PLAN_PHYSIC, "tableSeqScan", qptCreateTableSeqScanPhysiNode}, + {QUERY_NODE_PHYSICAL_PLAN_TABLE_SEQ_SCAN, QPT_PLAN_PHYSIC, "tableSeqScan", NULL /*qptCreateTableSeqScanPhysiNode*/ }, {QUERY_NODE_PHYSICAL_PLAN_TABLE_MERGE_SCAN, QPT_PLAN_PHYSIC, "tableMergeScan", qptCreateTableMergeScanPhysiNode}, {QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN, QPT_PLAN_PHYSIC, "streamScan", qptCreateStreamScanPhysiNode}, {QUERY_NODE_PHYSICAL_PLAN_SYSTABLE_SCAN, QPT_PLAN_PHYSIC, "sysTableScan", qptCreateSysTableScanPhysiNode}, @@ -2975,6 +2975,159 @@ void qptHandleTestEnd() { } +void qptExecPlan(SReadHandle* pReadHandle, SNode* pNode, SExecTaskInfo* pTaskInfo, SOperatorInfo** ppOperaotr) { + switch (nodeType(pNode)) { + case QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN: + qptCtx.result.code = createTagScanOperatorInfo(pReadHandle, (STagScanPhysiNode*)pNode, NULL, NULL, NULL, pTaskInfo, ppOperaotr); + break; + case QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN: + qptCtx.result.code = createTableScanOperatorInfo((STableScanPhysiNode*)pNode, pReadHandle, NULL, pTaskInfo, ppOperaotr); + break; + case QUERY_NODE_PHYSICAL_PLAN_TABLE_SEQ_SCAN: + //qptCtx.result.code = createTableSeqScanOperatorInfo((STableScanPhysiNode*)pNode, pReadHandle, NULL, pTaskInfo, ppOperaotr); + break; + case QUERY_NODE_PHYSICAL_PLAN_TABLE_MERGE_SCAN: + qptCtx.result.code = createTableMergeScanOperatorInfo((STableScanPhysiNode*)pNode, pReadHandle, NULL, pTaskInfo, ppOperaotr); + break; + case QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN: + qptCtx.result.code = createStreamScanOperatorInfo(pReadHandle, (STableScanPhysiNode*)pNode, NULL, NULL, pTaskInfo, ppOperaotr); + break; + case QUERY_NODE_PHYSICAL_PLAN_SYSTABLE_SCAN: + qptCtx.result.code = createSysTableScanOperatorInfo(pReadHandle, (SSystemTableScanPhysiNode*)pNode, NULL, pTaskInfo, ppOperaotr); + break; + case QUERY_NODE_PHYSICAL_PLAN_BLOCK_DIST_SCAN: + qptCtx.result.code = createDataBlockInfoScanOperator(pReadHandle, (SBlockDistScanPhysiNode*)pNode, NULL, pTaskInfo, ppOperaotr); + break; + case QUERY_NODE_PHYSICAL_PLAN_LAST_ROW_SCAN: + qptCtx.result.code = createCacherowsScanOperator((SLastRowScanPhysiNode*)pNode, pReadHandle, NULL, pTaskInfo, ppOperaotr); + break; + case QUERY_NODE_PHYSICAL_PLAN_PROJECT: + qptCtx.result.code = createProjectOperatorInfo(NULL, (SProjectPhysiNode*)pNode, pTaskInfo, ppOperaotr); + break; + case QUERY_NODE_PHYSICAL_PLAN_MERGE_JOIN: + qptCtx.result.code = createMergeJoinOperatorInfo(NULL, 0, (SSortMergeJoinPhysiNode*)pNode, pTaskInfo, ppOperaotr); + break; + case QUERY_NODE_PHYSICAL_PLAN_HASH_AGG: { + SAggPhysiNode* pAggNode = (SAggPhysiNode*)pNode; + if (pAggNode->pGroupKeys != NULL) { + qptCtx.result.code = createGroupOperatorInfo(NULL, pAggNode, pTaskInfo, ppOperaotr); + } else { + qptCtx.result.code = createAggregateOperatorInfo(NULL, pAggNode, pTaskInfo, ppOperaotr); + } + break; + } + case QUERY_NODE_PHYSICAL_PLAN_EXCHANGE: + qptCtx.result.code = createExchangeOperatorInfo(NULL, (SExchangePhysiNode*)pNode, pTaskInfo, ppOperaotr); + break; + case QUERY_NODE_PHYSICAL_PLAN_MERGE: + qptCtx.result.code = createMultiwayMergeOperatorInfo(NULL, 0, (SMergePhysiNode*)pNode, pTaskInfo, ppOperaotr); + break; + case QUERY_NODE_PHYSICAL_PLAN_SORT: + qptCtx.result.code = createSortOperatorInfo(NULL, (SSortPhysiNode*)pNode, pTaskInfo, ppOperaotr); + break; + case QUERY_NODE_PHYSICAL_PLAN_GROUP_SORT: + qptCtx.result.code = createGroupSortOperatorInfo(NULL, (SGroupSortPhysiNode*)pNode, pTaskInfo, ppOperaotr); + break; + case QUERY_NODE_PHYSICAL_PLAN_HASH_INTERVAL: + qptCtx.result.code = createIntervalOperatorInfo(NULL, (SIntervalPhysiNode*)pNode, pTaskInfo, ppOperaotr); + break; + case QUERY_NODE_PHYSICAL_PLAN_MERGE_INTERVAL: + //qptCtx.result.code = createMergeIntervalOperatorInfo(NULL, (SMergeIntervalPhysiNode*)pNode, pTaskInfo, ppOperaotr); + break; + case QUERY_NODE_PHYSICAL_PLAN_MERGE_ALIGNED_INTERVAL: + qptCtx.result.code = createMergeAlignedIntervalOperatorInfo(NULL, (SMergeAlignedIntervalPhysiNode*)pNode, pTaskInfo, ppOperaotr); + break; + case QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL: + qptCtx.result.code = createStreamIntervalOperatorInfo(NULL, (SPhysiNode*)pNode, pTaskInfo, pReadHandle, ppOperaotr); + break; + case QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL: + case QUERY_NODE_PHYSICAL_PLAN_STREAM_MID_INTERVAL: + case QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL: + qptCtx.result.code = createStreamFinalIntervalOperatorInfo(NULL, (SPhysiNode*)pNode, pTaskInfo, 0, pReadHandle, ppOperaotr); + break; + case QUERY_NODE_PHYSICAL_PLAN_FILL: + qptCtx.result.code = createFillOperatorInfo(NULL, (SFillPhysiNode*)pNode, pTaskInfo, ppOperaotr); + break; + case QUERY_NODE_PHYSICAL_PLAN_STREAM_FILL: + qptCtx.result.code = createStreamFillOperatorInfo(NULL, (SStreamFillPhysiNode*)pNode, pTaskInfo, ppOperaotr); + break; + case QUERY_NODE_PHYSICAL_PLAN_MERGE_SESSION: + qptCtx.result.code = createSessionAggOperatorInfo(NULL, (SSessionWinodwPhysiNode*)pNode, pTaskInfo, ppOperaotr); + break; + case QUERY_NODE_PHYSICAL_PLAN_STREAM_SESSION: + qptCtx.result.code = createStreamSessionAggOperatorInfo(NULL, (SPhysiNode*)pNode, pTaskInfo, pReadHandle, ppOperaotr); + break; + case QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_SESSION: + qptCtx.result.code = createStreamFinalSessionAggOperatorInfo(NULL, (SPhysiNode*)pNode, pTaskInfo, 0, pReadHandle, ppOperaotr); + break; + case QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_SESSION: + qptCtx.result.code = createStreamFinalSessionAggOperatorInfo(NULL, (SPhysiNode*)pNode, pTaskInfo, 0, pReadHandle, ppOperaotr); + break; + case QUERY_NODE_PHYSICAL_PLAN_MERGE_STATE: + qptCtx.result.code = createStatewindowOperatorInfo(NULL, (SStateWinodwPhysiNode*)pNode, pTaskInfo, ppOperaotr); + break; + case QUERY_NODE_PHYSICAL_PLAN_STREAM_STATE: + qptCtx.result.code = createStreamStateAggOperatorInfo(NULL, (SPhysiNode*)pNode, pTaskInfo, pReadHandle, ppOperaotr); + break; + case QUERY_NODE_PHYSICAL_PLAN_PARTITION: + qptCtx.result.code = createPartitionOperatorInfo(NULL, (SPartitionPhysiNode*)pNode, pTaskInfo, ppOperaotr); + break; + case QUERY_NODE_PHYSICAL_PLAN_STREAM_PARTITION: + qptCtx.result.code = createStreamPartitionOperatorInfo(NULL, (SStreamPartitionPhysiNode*)pNode, pTaskInfo, ppOperaotr); + break; + case QUERY_NODE_PHYSICAL_PLAN_INDEF_ROWS_FUNC: + qptCtx.result.code = createIndefinitOutputOperatorInfo(NULL, (SPhysiNode*)pNode, pTaskInfo, ppOperaotr); + break; + case QUERY_NODE_PHYSICAL_PLAN_INTERP_FUNC: + qptCtx.result.code = createTimeSliceOperatorInfo(NULL, (SPhysiNode*)pNode, pTaskInfo, ppOperaotr); + break; + case QUERY_NODE_PHYSICAL_PLAN_INSERT: + break; + case QUERY_NODE_PHYSICAL_PLAN_DISPATCH: + case QUERY_NODE_PHYSICAL_PLAN_QUERY_INSERT: + case QUERY_NODE_PHYSICAL_PLAN_DELETE: { + DataSinkHandle handle = NULL; + qptCtx.result.code = dsCreateDataSinker(NULL, (SDataSinkNode*)pNode, &handle, NULL, NULL); + dsDestroyDataSinker(handle); + break; + } + case QUERY_NODE_PHYSICAL_SUBPLAN: + break; + case QUERY_NODE_PHYSICAL_PLAN: { + SSchJob job = {0}; + qptCtx.result.code = schValidateAndBuildJob((SQueryPlan*)pNode, &job); + schFreeJobImpl(&job); + break; + } + case QUERY_NODE_PHYSICAL_PLAN_TABLE_COUNT_SCAN: + qptCtx.result.code = createTableCountScanOperatorInfo(pReadHandle, (STableCountScanPhysiNode*)pNode, pTaskInfo, ppOperaotr); + break; + case QUERY_NODE_PHYSICAL_PLAN_MERGE_EVENT: + qptCtx.result.code = createEventwindowOperatorInfo(NULL, (SPhysiNode*)pNode, pTaskInfo, ppOperaotr); + break; + case QUERY_NODE_PHYSICAL_PLAN_STREAM_EVENT: + qptCtx.result.code = createStreamEventAggOperatorInfo(NULL, (SPhysiNode*)pNode, pTaskInfo, pReadHandle, ppOperaotr); + break; + case QUERY_NODE_PHYSICAL_PLAN_HASH_JOIN: + qptCtx.result.code = createHashJoinOperatorInfo(NULL, 0, (SHashJoinPhysiNode*)pNode, pTaskInfo, ppOperaotr); + break; + case QUERY_NODE_PHYSICAL_PLAN_GROUP_CACHE: + qptCtx.result.code = createGroupCacheOperatorInfo(NULL, 0, (SGroupCachePhysiNode*)pNode, pTaskInfo, ppOperaotr); + break; + case QUERY_NODE_PHYSICAL_PLAN_DYN_QUERY_CTRL: + qptCtx.result.code = createDynQueryCtrlOperatorInfo(NULL, 0, (SDynQueryCtrlPhysiNode*)pNode, pTaskInfo, ppOperaotr); + break; + case QUERY_NODE_PHYSICAL_PLAN_MERGE_COUNT: + qptCtx.result.code = createCountwindowOperatorInfo(NULL, (SPhysiNode*)pNode, pTaskInfo, ppOperaotr); + break; + case QUERY_NODE_PHYSICAL_PLAN_STREAM_COUNT: + qptCtx.result.code = createStreamCountAggOperatorInfo(NULL, (SPhysiNode*)pNode, pTaskInfo, pReadHandle, ppOperaotr); + break; + default: + assert(0); + } +} + void qptRunSingleOpTest() { SNode* pNode = NULL; SReadHandle readHandle = {0}; @@ -2992,8 +3145,8 @@ void qptRunSingleOpTest() { qptPrintBeginInfo(); qptCtx.startTsUs = taosGetTimestampUs(); - //qptCtx.result.code = createTagScanOperatorInfo(&readHandle, (STagScanPhysiNode*)pNode, NULL, NULL, NULL, pTaskInfo, &pOperator); - //qptCtx.result.code = createProjectOperatorInfo(NULL, (SProjectPhysiNode*)pNode, pTaskInfo, &pOperator); + + qptExecPlan(&readHandle, pNode, pTaskInfo, &pOperator); doDestroyTask(pTaskInfo); destroyOperator(pOperator); @@ -3173,27 +3326,6 @@ TEST(singleNodeTest, randPlan) { } #endif - - - - - -#if 0 -TEST(correctSingleNodeTest, tagScan) { - char* caseName = "correctSingleNodeTest:tagScan"; - - qptInitTestCtx(true, true, QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN, 0, NULL); - - for (qptCtx.loopIdx = 0; qptCtx.loopIdx < QPT_MAX_LOOP; ++qptCtx.loopIdx) { - qptRunPlanTest(caseName); - } - - qptPrintStatInfo(caseName); -} -#endif - - - #endif diff --git a/source/libs/scheduler/inc/schInt.h b/source/libs/scheduler/inc/schInt.h index 8a156e8a06d9..52c7c64887fb 100644 --- a/source/libs/scheduler/inc/schInt.h +++ b/source/libs/scheduler/inc/schInt.h @@ -330,8 +330,8 @@ extern SSchedulerMgmt schMgmt; #define SCH_TASK_EID(_task) ((_task) ? (_task)->execId : -1) #define SCH_IS_DATA_BIND_QRY_TASK(task) ((task)->plan->subplanType == SUBPLAN_TYPE_SCAN) -#define SCH_IS_DATA_BIND_TASK(task) \ - (((task)->plan->subplanType == SUBPLAN_TYPE_SCAN) || ((task)->plan->subplanType == SUBPLAN_TYPE_MODIFY)) +#define SCH_IS_DATA_BIND_PLAN(_plan) (((_plan)->subplanType == SUBPLAN_TYPE_SCAN) || ((_plan)->subplanType == SUBPLAN_TYPE_MODIFY)) +#define SCH_IS_DATA_BIND_TASK(task) SCH_IS_DATA_BIND_PLAN((task)->plan) #define SCH_IS_LEAF_TASK(_job, _task) (((_task)->level->level + 1) == (_job)->levelNum) #define SCH_IS_DATA_MERGE_TASK(task) (!SCH_IS_DATA_BIND_TASK(task)) #define SCH_IS_LOCAL_EXEC_TASK(_job, _task) \ @@ -641,6 +641,7 @@ void schDropTaskInHashList(SSchJob *pJob, SHashObj *list); int32_t schNotifyTaskInHashList(SSchJob *pJob, SHashObj *list, ETaskNotifyType type, SSchTask *pTask); int32_t schLaunchLevelTasks(SSchJob *pJob, SSchLevel *level); void schGetTaskFromList(SHashObj *pTaskList, uint64_t taskId, SSchTask **pTask); +int32_t schValidateSubplan(SSchJob *pJob, SSubplan* pSubplan, int32_t level, int32_t idx, int32_t taskNum); int32_t schInitTask(SSchJob *pJob, SSchTask *pTask, SSubplan *pPlan, SSchLevel *pLevel); int32_t schSwitchTaskCandidateAddr(SSchJob *pJob, SSchTask *pTask); void schDirectPostJobRes(SSchedulerReq *pReq, int32_t errCode); diff --git a/source/libs/scheduler/src/schJob.c b/source/libs/scheduler/src/schJob.c index b888b826bbed..1b6e08647231 100644 --- a/source/libs/scheduler/src/schJob.c +++ b/source/libs/scheduler/src/schJob.c @@ -200,7 +200,12 @@ int32_t schBuildTaskRalation(SSchJob *pJob, SHashObj *planToTask) { SSubplan *child = (SSubplan *)nodesListGetNode(pPlan->pChildren, n); if (NULL == child) { SCH_JOB_ELOG("fail to get the %dth child subplan, childNum: %d", n, childNum); - SCH_ERR_RET(TSDB_CODE_SCH_INTERNAL_ERROR); + SCH_ERR_RET(TSDB_CODE_QRY_INVALID_INPUT); + } + + if (QUERY_NODE_PHYSICAL_SUBPLAN != nodeType(child)) { + SCH_JOB_ELOG("invalid subplan type for the %dth child, level:%d, subplanNodeType:%d", n, i, nodeType(child)); + SCH_ERR_RET(TSDB_CODE_QRY_INVALID_INPUT); } SSchTask **childTask = taosHashGet(planToTask, &child, POINTER_BYTES); @@ -242,6 +247,11 @@ int32_t schBuildTaskRalation(SSchJob *pJob, SHashObj *planToTask) { SCH_ERR_RET(TSDB_CODE_SCH_INTERNAL_ERROR); } + if (QUERY_NODE_PHYSICAL_SUBPLAN != nodeType(parent)) { + SCH_JOB_ELOG("invalid subplan type for the %dth parent, level:%d, subplanNodeType:%d", n, i, nodeType(parent)); + SCH_ERR_RET(TSDB_CODE_QRY_INVALID_INPUT); + } + SSchTask **parentTask = taosHashGet(planToTask, &parent, POINTER_BYTES); if (NULL == parentTask || NULL == *parentTask) { SCH_TASK_ELOG("subplan parent relationship error, level:%d, taskIdx:%d, childIdx:%d", i, m, n); @@ -384,20 +394,8 @@ int32_t schValidateAndBuildJob(SQueryPlan *pDag, SSchJob *pJob) { for (int32_t n = 0; n < taskNum; ++n) { SSubplan *plan = (SSubplan *)nodesListGetNode(plans->pNodeList, n); - if (NULL == plan) { - SCH_JOB_ELOG("fail to get the %dth subplan, taskNum: %d, level: %d", n, taskNum, i); - SCH_ERR_RET(TSDB_CODE_SCH_INTERNAL_ERROR); - } - if (QUERY_NODE_PHYSICAL_SUBPLAN != nodeType(plan)) { - SCH_JOB_ELOG("invalid subplan type, level:%d, subplanNodeType:%d", i, nodeType(plan)); - SCH_ERR_JRET(TSDB_CODE_QRY_INVALID_INPUT); - } - - if (plan->subplanType < SUBPLAN_TYPE_MERGE || plan->subplanType > SUBPLAN_TYPE_COMPUTE) { - SCH_JOB_ELOG("invalid subplanType %d, level:%d, subplan idx:%d", plan->subplanType, i, n); - SCH_ERR_JRET(TSDB_CODE_QRY_INVALID_INPUT); - } + SCH_ERR_RET(schValidateSubplan(pJob, plan, pLevel->level, n, taskNum)); SCH_SET_JOB_TYPE(pJob, plan->subplanType); diff --git a/source/libs/scheduler/src/schTask.c b/source/libs/scheduler/src/schTask.c index e6b68051f930..fe24633c122b 100644 --- a/source/libs/scheduler/src/schTask.c +++ b/source/libs/scheduler/src/schTask.c @@ -831,7 +831,7 @@ int32_t schSetTaskCandidateAddrs(SSchJob *pJob, SSchTask *pTask) { if (SCH_IS_DATA_BIND_TASK(pTask)) { SCH_TASK_ELOG("no execNode specifed for data src task, numOfEps:%d", pTask->plan->execNode.epSet.numOfEps); - SCH_ERR_RET(TSDB_CODE_MND_INVALID_SCHEMA_VER); + SCH_ERR_RET(TSDB_CODE_SCH_INTERNAL_ERROR); } SCH_ERR_RET(schSetAddrsFromNodeList(pJob, pTask)); diff --git a/source/libs/scheduler/src/schUtil.c b/source/libs/scheduler/src/schUtil.c index b68f665200fe..48401086384e 100644 --- a/source/libs/scheduler/src/schUtil.c +++ b/source/libs/scheduler/src/schUtil.c @@ -360,3 +360,50 @@ void schGetTaskFromList(SHashObj *pTaskList, uint64_t taskId, SSchTask **pTask) *pTask = *task; } + +int32_t schValidateSubplan(SSchJob *pJob, SSubplan* pSubplan, int32_t level, int32_t idx, int32_t taskNum) { + if (NULL == pSubplan) { + SCH_JOB_ELOG("fail to get the %dth subplan, taskNum: %d, level: %d", idx, taskNum, level); + SCH_ERR_RET(TSDB_CODE_QRY_INVALID_INPUT); + } + + if (QUERY_NODE_PHYSICAL_SUBPLAN != nodeType(pSubplan)) { + SCH_JOB_ELOG("invalid subplan type, level:%d, subplanNodeType:%d", level, nodeType(pSubplan)); + SCH_ERR_RET(TSDB_CODE_QRY_INVALID_INPUT); + } + + if (pSubplan->subplanType < SUBPLAN_TYPE_MERGE || pSubplan->subplanType > SUBPLAN_TYPE_COMPUTE) { + SCH_JOB_ELOG("invalid subplanType %d, level:%d, subplan idx:%d", pSubplan->subplanType, level, idx); + SCH_ERR_RET(TSDB_CODE_QRY_INVALID_INPUT); + } + + if (pSubplan->level != level) { + SCH_JOB_ELOG("plan level %d mis-match with current level %d", pSubplan->level, level); + SCH_ERR_RET(TSDB_CODE_QRY_INVALID_INPUT); + } + + if (SCH_IS_DATA_BIND_PLAN(pSubplan)) { + if (pSubplan->execNode.epSet.numOfEps <= 0) { + SCH_JOB_ELOG("no execNode specifed for data src plan %d, numOfEps:%d", pSubplan->subplanType, pSubplan->execNode.epSet.numOfEps); + SCH_ERR_RET(TSDB_CODE_QRY_INVALID_INPUT); + } + if (pSubplan->execNode.epSet.inUse >= pSubplan->execNode.epSet.numOfEps) { + SCH_JOB_ELOG("invalid epset inUse %d for data src plan %d, numOfEps:%d", pSubplan->execNode.epSet.inUse, pSubplan->subplanType, pSubplan->execNode.epSet.numOfEps); + SCH_ERR_RET(TSDB_CODE_QRY_INVALID_INPUT); + } + } + + if (NULL == pSubplan->pNode) { + SCH_JOB_ELOG("empty plan root node, level:%d, subplan idx:%d", level, idx); + SCH_ERR_RET(TSDB_CODE_QRY_INVALID_INPUT); + } + + if (NULL == pSubplan->pDataSink) { + SCH_JOB_ELOG("empty plan dataSink, level:%d, subplan idx:%d", level, idx); + SCH_ERR_RET(TSDB_CODE_QRY_INVALID_INPUT); + } + + return TSDB_CODE_SUCCESS; +} + + From 5ee1c9b70a9cbf99ec71bf2517753d6d8305ef53 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Mon, 21 Oct 2024 21:01:33 +0800 Subject: [PATCH 171/695] fix retry error --- source/dnode/mgmt/node_mgmt/src/dmTransport.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/source/dnode/mgmt/node_mgmt/src/dmTransport.c b/source/dnode/mgmt/node_mgmt/src/dmTransport.c index 30909038057f..e63e17e584b3 100644 --- a/source/dnode/mgmt/node_mgmt/src/dmTransport.c +++ b/source/dnode/mgmt/node_mgmt/src/dmTransport.c @@ -29,9 +29,16 @@ static inline void dmBuildMnodeRedirectRsp(SDnode *pDnode, SRpcMsg *pMsg) { dmGetMnodeEpSetForRedirect(&pDnode->data, pMsg, &epSet); if (epSet.numOfEps <= 1) { - pMsg->pCont = NULL; - pMsg->code = TSDB_CODE_MNODE_NOT_FOUND; - return; + if (epSet.numOfEps == 0) { + pMsg->pCont = NULL; + pMsg->code = TSDB_CODE_MNODE_NOT_FOUND; + return; + } + if (strcmp(epSet.eps[0].fqdn, tsLocalFqdn) == 0 && epSet.eps[0].port == tsServerPort) { + pMsg->pCont = NULL; + pMsg->code = TSDB_CODE_MNODE_NOT_FOUND; + return; + } } int32_t contLen = tSerializeSEpSet(NULL, 0, &epSet); From a2665ebc82fb6a749989151663aced5eebc2cbc5 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Tue, 22 Oct 2024 09:04:12 +0800 Subject: [PATCH 172/695] fix: add plan validation in scheduler --- include/libs/scheduler/scheduler.h | 4 ++-- source/libs/executor/test/queryPlanTests.cpp | 8 +++---- source/libs/scheduler/src/schJob.c | 10 +++++---- source/libs/scheduler/src/scheduler.c | 23 ++++++++++++++++++++ 4 files changed, 35 insertions(+), 10 deletions(-) diff --git a/include/libs/scheduler/scheduler.h b/include/libs/scheduler/scheduler.h index b98170f16856..af8deff1a026 100644 --- a/include/libs/scheduler/scheduler.h +++ b/include/libs/scheduler/scheduler.h @@ -76,8 +76,6 @@ int32_t schedulerExecJob(SSchedulerReq* pReq, int64_t* pJob); int32_t schedulerFetchRows(int64_t jobId, SSchedulerReq* pReq); -void schedulerFetchRowsA(int64_t job, schedulerFetchFp fp, void* param); - int32_t schedulerGetTasksStatus(int64_t job, SArray* pSub); void schedulerStopQueryHb(void* pTrans); @@ -100,6 +98,8 @@ void schedulerFreeJob(int64_t* job, int32_t errCode); void schedulerDestroy(void); +int32_t schedulerValidatePlan(SQueryPlan* pPlan); + #ifdef __cplusplus } #endif diff --git a/source/libs/executor/test/queryPlanTests.cpp b/source/libs/executor/test/queryPlanTests.cpp index f03d347a787c..176af60944de 100755 --- a/source/libs/executor/test/queryPlanTests.cpp +++ b/source/libs/executor/test/queryPlanTests.cpp @@ -43,6 +43,7 @@ #include "querytask.h" #include "functionMgt.h" #include "ttime.h" +#include "scheduler.h" namespace { @@ -3091,12 +3092,11 @@ void qptExecPlan(SReadHandle* pReadHandle, SNode* pNode, SExecTaskInfo* pTaskInf dsDestroyDataSinker(handle); break; } - case QUERY_NODE_PHYSICAL_SUBPLAN: + case QUERY_NODE_PHYSICAL_SUBPLAN: { break; + } case QUERY_NODE_PHYSICAL_PLAN: { - SSchJob job = {0}; - qptCtx.result.code = schValidateAndBuildJob((SQueryPlan*)pNode, &job); - schFreeJobImpl(&job); + qptCtx.result.code = schedulerValidatePlan((SQueryPlan*)pNode); break; } case QUERY_NODE_PHYSICAL_PLAN_TABLE_COUNT_SCAN: diff --git a/source/libs/scheduler/src/schJob.c b/source/libs/scheduler/src/schJob.c index 1b6e08647231..d1c970b9febc 100644 --- a/source/libs/scheduler/src/schJob.c +++ b/source/libs/scheduler/src/schJob.c @@ -794,9 +794,11 @@ void schFreeJobImpl(void *job) { } taosMemoryFree(pJob); - int32_t jobNum = atomic_sub_fetch_32(&schMgmt.jobNum, 1); - if (jobNum == 0) { - schCloseJobRef(); + if (refId > 0) { + int32_t jobNum = atomic_sub_fetch_32(&schMgmt.jobNum, 1); + if (jobNum == 0) { + schCloseJobRef(); + } } qDebug("QID:0x%" PRIx64 " sch job freed, refId:0x%" PRIx64 ", pointer:%p", queryId, refId, pJob); @@ -917,7 +919,7 @@ int32_t schInitJob(int64_t *pJobId, SSchedulerReq *pReq) { if (NULL == pJob) { qDestroyQueryPlan(pReq->pDag); - } else if (pJob->refId < 0) { + } else if (pJob->refId <= 0) { schFreeJobImpl(pJob); } else { code = taosRemoveRef(schMgmt.jobRef, pJob->refId); diff --git a/source/libs/scheduler/src/scheduler.c b/source/libs/scheduler/src/scheduler.c index 091de5c04821..01d3204dc62e 100644 --- a/source/libs/scheduler/src/scheduler.c +++ b/source/libs/scheduler/src/scheduler.c @@ -224,3 +224,26 @@ void schedulerDestroy(void) { qWorkerDestroy(&schMgmt.queryMgmt); schMgmt.queryMgmt = NULL; } + +int32_t schedulerValidatePlan(SQueryPlan* pPlan) { + int32_t code = TSDB_CODE_SUCCESS; + SSchJob *pJob = taosMemoryCalloc(1, sizeof(SSchJob)); + if (NULL == pJob) { + qError("QID:0x%" PRIx64 " calloc %d failed", pPlan->queryId, (int32_t)sizeof(SSchJob)); + SCH_ERR_RET(terrno); + } + + SCH_ERR_JRET(schValidateAndBuildJob(pPlan, pJob)); + + if (SCH_IS_EXPLAIN_JOB(pJob)) { + SCH_ERR_JRET(qExecExplainBegin(pPlan, &pJob->explainCtx, 0)); + } + +_return: + + schFreeJobImpl(pJob); + + return code; +} + + From e4b3f9135b09a445a2485120e35214c76d896c73 Mon Sep 17 00:00:00 2001 From: wangjiaming0909 <604227650@qq.com> Date: Tue, 22 Oct 2024 09:09:40 +0800 Subject: [PATCH 173/695] fix fill with pesudo column exprs --- source/libs/planner/src/planLogicCreater.c | 169 +++++++++++++------ tests/system-test/2-query/fill_with_group.py | 63 +++++++ 2 files changed, 185 insertions(+), 47 deletions(-) diff --git a/source/libs/planner/src/planLogicCreater.c b/source/libs/planner/src/planLogicCreater.c index 6ad30eccb8f8..0d4da5c6f6e4 100644 --- a/source/libs/planner/src/planLogicCreater.c +++ b/source/libs/planner/src/planLogicCreater.c @@ -1196,74 +1196,128 @@ static int32_t createWindowLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSele return TSDB_CODE_FAILED; } +typedef struct SPartFillExprsCtx { + bool hasFillCol; + bool hasPseudoWinCol; + bool hasGroupKeyCol; + SHashObj* pPseudoCols; + int32_t code; +} SPartFillExprsCtx; + static EDealRes needFillValueImpl(SNode* pNode, void* pContext) { + SPartFillExprsCtx *pCtx = pContext; if (QUERY_NODE_COLUMN == nodeType(pNode)) { SColumnNode* pCol = (SColumnNode*)pNode; - if (COLUMN_TYPE_WINDOW_START != pCol->colType && COLUMN_TYPE_WINDOW_END != pCol->colType && - COLUMN_TYPE_WINDOW_DURATION != pCol->colType && COLUMN_TYPE_GROUP_KEY != pCol->colType) { - *(bool*)pContext = true; + if (COLUMN_TYPE_WINDOW_START == pCol->colType || COLUMN_TYPE_WINDOW_END == pCol->colType || + COLUMN_TYPE_WINDOW_DURATION == pCol->colType) { + pCtx->hasPseudoWinCol = true; + pCtx->code = taosHashPut(pCtx->pPseudoCols, pCol->colName, TSDB_COL_NAME_LEN, &pNode, POINTER_BYTES); + } else if (COLUMN_TYPE_GROUP_KEY == pCol->colType || COLUMN_TYPE_TBNAME == pCol->colType || COLUMN_TYPE_TAG == pCol->colType) { + pCtx->hasGroupKeyCol = true; + pCtx->code = taosHashPut(pCtx->pPseudoCols, pCol->colName, TSDB_COL_NAME_LEN, &pNode, POINTER_BYTES); + } else { + pCtx->hasFillCol = true; return DEAL_RES_END; } } return DEAL_RES_CONTINUE; } -static bool needFillValue(SNode* pNode) { - bool hasFillCol = false; - nodesWalkExpr(pNode, needFillValueImpl, &hasFillCol); - return hasFillCol; +static void needFillValue(SNode* pNode, SPartFillExprsCtx* pCtx) { + nodesWalkExpr(pNode, needFillValueImpl, pCtx); } -static int32_t partFillExprs(SSelectStmt* pSelect, SNodeList** pFillExprs, SNodeList** pNotFillExprs) { - int32_t code = TSDB_CODE_SUCCESS; - SNode* pProject = NULL; - FOREACH(pProject, pSelect->pProjectionList) { - if (needFillValue(pProject)) { - SNode* pNew = NULL; - code = nodesCloneNode(pProject, &pNew); - if (TSDB_CODE_SUCCESS == code) { - code = nodesListMakeStrictAppend(pFillExprs, pNew); - } - } else if (QUERY_NODE_VALUE != nodeType(pProject)) { - SNode* pNew = NULL; - code = nodesCloneNode(pProject, &pNew); - if (TSDB_CODE_SUCCESS == code) { - code = nodesListMakeStrictAppend(pNotFillExprs, pNew); - } +typedef struct SCollectFillExprsCtx { + SHashObj* pPseudoCols; + int32_t code; + SNodeList* pFillExprs; + SNodeList* pNotFillExprs; + bool skipFillCols; +} SCollectFillExprsCtx; + +static EDealRes collectFillExpr(SNode* pNode, void* pContext) { + SCollectFillExprsCtx* pCollectFillCtx = pContext; + SPartFillExprsCtx partFillCtx = {0}; + SNode* pNew = NULL; + partFillCtx.pPseudoCols = pCollectFillCtx->pPseudoCols; + needFillValue(pNode, &partFillCtx); + if (partFillCtx.code != TSDB_CODE_SUCCESS) { + pCollectFillCtx->code = partFillCtx.code; + return DEAL_RES_ERROR; + } + + if (partFillCtx.hasFillCol && !pCollectFillCtx->skipFillCols) { + if (nodeType(pNode) == QUERY_NODE_ORDER_BY_EXPR) { + pCollectFillCtx->code = nodesCloneNode(((SOrderByExprNode*)pNode)->pExpr, &pNew); + } else { + pCollectFillCtx->code = nodesCloneNode(pNode, &pNew); } - if (TSDB_CODE_SUCCESS != code) { - NODES_DESTORY_LIST(*pFillExprs); - NODES_DESTORY_LIST(*pNotFillExprs); - break; + if (pCollectFillCtx->code == TSDB_CODE_SUCCESS) { + pCollectFillCtx->code = nodesListMakeStrictAppend(&pCollectFillCtx->pFillExprs, pNew); } + if (pCollectFillCtx->code != TSDB_CODE_SUCCESS) return DEAL_RES_ERROR; + return DEAL_RES_IGNORE_CHILD; } - if (!pSelect->isDistinct) { - SNode* pOrderExpr = NULL; - FOREACH(pOrderExpr, pSelect->pOrderByList) { - SNode* pExpr = ((SOrderByExprNode*)pOrderExpr)->pExpr; - if (needFillValue(pExpr)) { - SNode* pNew = NULL; - code = nodesCloneNode(pExpr, &pNew); - if (TSDB_CODE_SUCCESS == code) { - code = nodesListMakeStrictAppend(pFillExprs, pNew); - } - } else if (QUERY_NODE_VALUE != nodeType(pExpr)) { - SNode* pNew = NULL; - code = nodesCloneNode(pExpr, &pNew); - if (TSDB_CODE_SUCCESS == code) { - code = nodesListMakeStrictAppend(pNotFillExprs, pNew); - } + return DEAL_RES_CONTINUE; +} + +static int32_t collectFillExprs(SSelectStmt* pSelect, SNodeList** pFillExprs, SNodeList** pNotFillExprs) { + int32_t code = TSDB_CODE_SUCCESS; + SCollectFillExprsCtx collectFillCtx = {0}; + collectFillCtx.pPseudoCols = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK); + if (!collectFillCtx.pPseudoCols) return terrno; + + if (collectFillCtx.code == TSDB_CODE_SUCCESS) { + nodesWalkExprs(pSelect->pProjectionList, collectFillExpr, &collectFillCtx); + } + if (collectFillCtx.code == TSDB_CODE_SUCCESS) { + collectFillCtx.skipFillCols = true; + nodesWalkExpr(pSelect->pHaving, collectFillExpr, &collectFillCtx); + } + if (collectFillCtx.code == TSDB_CODE_SUCCESS) { + nodesWalkExprs(pSelect->pGroupByList, collectFillExpr, &collectFillCtx); + } + if (collectFillCtx.code == TSDB_CODE_SUCCESS) { + nodesWalkExprs(pSelect->pOrderByList, collectFillExpr, &collectFillCtx); + } + if (collectFillCtx.code == TSDB_CODE_SUCCESS) { + void* pIter = taosHashIterate(collectFillCtx.pPseudoCols, 0); + while (pIter) { + SNode* pNode = *(SNode**)pIter, *pNew = NULL; + collectFillCtx.code = nodesCloneNode(pNode, &pNew); + if (collectFillCtx.code == TSDB_CODE_SUCCESS) { + collectFillCtx.code = nodesListMakeStrictAppend(&collectFillCtx.pNotFillExprs, pNew); } - if (TSDB_CODE_SUCCESS != code) { - NODES_DESTORY_LIST(*pFillExprs); - NODES_DESTORY_LIST(*pNotFillExprs); + if (collectFillCtx.code == TSDB_CODE_SUCCESS) { + pIter = taosHashIterate(collectFillCtx.pPseudoCols, pIter); + } else { + taosHashCancelIterate(collectFillCtx.pPseudoCols, pIter); break; } } + if (collectFillCtx.code == TSDB_CODE_SUCCESS) { + TSWAP(*pFillExprs, collectFillCtx.pFillExprs); + TSWAP(*pNotFillExprs, collectFillCtx.pNotFillExprs); + } } + if (collectFillCtx.code != TSDB_CODE_SUCCESS) { + if (collectFillCtx.pFillExprs) nodesDestroyList(collectFillCtx.pFillExprs); + if (collectFillCtx.pNotFillExprs) nodesDestroyList(collectFillCtx.pNotFillExprs); + } + taosHashCleanup(collectFillCtx.pPseudoCols); return code; } +static bool nodeAlreadyContained(SNodeList* pList, SNode* pNode) { + SNode* pExpr = NULL; + FOREACH(pExpr, pList) { + if (nodesEqualNode(pExpr, pNode)) { + return true; + } + } + return false; +} + static int32_t createFillLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect, SLogicNode** pLogicNode) { if (NULL == pSelect->pWindow || QUERY_NODE_INTERVAL_WINDOW != nodeType(pSelect->pWindow) || NULL == ((SIntervalWindowNode*)pSelect->pWindow)->pFill) { @@ -1286,13 +1340,34 @@ static int32_t createFillLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect pFill->node.resultDataOrder = pFill->node.requireDataOrder; pFill->node.inputTsOrder = TSDB_ORDER_ASC; - code = partFillExprs(pSelect, &pFill->pFillExprs, &pFill->pNotFillExprs); + code = collectFillExprs(pSelect, &pFill->pFillExprs, &pFill->pNotFillExprs); if (TSDB_CODE_SUCCESS == code) { code = rewriteExprsForSelect(pFill->pFillExprs, pSelect, SQL_CLAUSE_FILL, NULL); } if (TSDB_CODE_SUCCESS == code) { code = rewriteExprsForSelect(pFill->pNotFillExprs, pSelect, SQL_CLAUSE_FILL, NULL); } + SNodeList* pWindowTargets = NULL; + if (TSDB_CODE_SUCCESS == code) { + SNode* pNode = NULL, *pNodeNew = NULL; + FOREACH(pNode, pCxt->pCurrRoot->pTargets) { + if (nodesEqualNode(pNode, pFillNode->pWStartTs)) continue; + if (nodeAlreadyContained(pFill->pFillExprs, pNode)) continue; + if (nodeAlreadyContained(pFill->pNotFillExprs, pNode)) continue; + pNodeNew = NULL; + code = nodesCloneNode(pNode, &pNodeNew); + if (TSDB_CODE_SUCCESS == code) { + code = nodesListMakeStrictAppend(&pWindowTargets, pNodeNew); + } + if (TSDB_CODE_SUCCESS != code) { + nodesDestroyList(pWindowTargets); + break; + } + } + } + if (TSDB_CODE_SUCCESS == code && LIST_LENGTH(pWindowTargets) > 0) { + code = nodesListMakeStrictAppendList(&pFill->pFillExprs, pWindowTargets); + } if (TSDB_CODE_SUCCESS == code) { code = createColumnByRewriteExprs(pFill->pFillExprs, &pFill->node.pTargets); } diff --git a/tests/system-test/2-query/fill_with_group.py b/tests/system-test/2-query/fill_with_group.py index 2139bbbfb356..b48143db1592 100644 --- a/tests/system-test/2-query/fill_with_group.py +++ b/tests/system-test/2-query/fill_with_group.py @@ -237,11 +237,74 @@ def test_fill_with_order_by2(self): tdSql.checkData(12, 1, None) tdSql.checkData(13, 1, None) + def test_fill_with_complex_expr(self): + sql = "SELECT _wstart, _wstart + 1d, count(*), now, 1+1 FROM meters WHERE ts >= '2018-09-20 00:00:00.000' AND ts < '2018-09-20 01:00:00.000' INTERVAL(5m) FILL(NULL)" + tdSql.query(sql, queryTimes=1) + tdSql.checkRows(12) + for i in range(0, 12, 2): + tdSql.checkData(i, 2, 10) + for i in range(1, 12, 2): + tdSql.checkData(i, 2, None) + for i in range(0, 12): + firstCol = tdSql.getData(i, 0) + secondCol = tdSql.getData(i, 1) + tdLog.debug(f"firstCol: {firstCol}, secondCol: {secondCol}, secondCol - firstCol: {secondCol - firstCol}") + if secondCol - firstCol != timedelta(days=1): + tdLog.exit(f"query error: secondCol - firstCol: {secondCol - firstCol}") + nowCol = tdSql.getData(i, 3) + if nowCol is None: + tdLog.exit(f"query error: nowCol: {nowCol}") + constCol = tdSql.getData(i, 4) + if constCol != 2: + tdLog.exit(f"query error: constCol: {constCol}") + + sql = "SELECT _wstart + 1d, count(*), last(ts) + 1a, timediff(_wend, last(ts)) FROM meters WHERE ts >= '2018-09-20 00:00:00.000' AND ts < '2018-09-20 01:00:00.000' INTERVAL(5m) FILL(NULL)" + tdSql.query(sql, queryTimes=1) + tdSql.checkRows(12) + for i in range(0, 12, 2): + tdSql.checkData(i, 1, 10) + tdSql.checkData(i, 3, 300000) + for i in range(1, 12, 2): + tdSql.checkData(i, 1, None) + tdSql.checkData(i, 2, None) + tdSql.checkData(i, 3, None) + + sql = "SELECT count(*), tbname FROM meters WHERE ts >= '2018-09-20 00:00:00.000' AND ts < '2018-09-20 01:00:00.000' PARTITION BY tbname INTERVAL(5m) FILL(NULL)" + tdSql.query(sql, queryTimes=1) + tdSql.checkRows(120) + + sql = "SELECT * from (SELECT count(*), timediff(_wend, last(ts)) + t1, tbname FROM meters WHERE ts >= '2018-09-20 00:00:00.000' AND ts < '2018-09-20 01:00:00.000' PARTITION BY tbname, t1 INTERVAL(5m) FILL(NULL) LIMIT 1) order by tbname" + tdSql.query(sql, queryTimes=1) + tdSql.checkRows(10) + j = 0 + for i in range(0, 10): + tdSql.checkData(i, 1, 300000 + j) + j = j + 1 + if j == 5: + j = 0 + + sql = "SELECT count(*), timediff(_wend, last(ts)) + t1, tbname,t1 FROM meters WHERE ts >= '2018-09-20 00:00:00.000' AND ts < '2018-09-20 01:00:00.000' PARTITION BY tbname, t1 INTERVAL(5m) FILL(NULL) ORDER BY timediff(last(ts), _wstart)" + tdSql.query(sql, queryTimes=1) + tdSql.checkRows(120) + + sql = "SELECT 1+1, count(*), timediff(_wend, last(ts)) + t1 FROM meters WHERE ts >= '2018-09-20 00:00:00.000' AND ts < '2018-09-20 01:00:00.000' PARTITION BY tbname, t1 INTERVAL(5m) FILL(NULL) HAVING(timediff(last(ts), _wstart)+ t1 >= 1) ORDER BY timediff(last(ts), _wstart)" + tdSql.query(sql, queryTimes=1) + tdSql.checkRows(48) + + sql = "SELECT count(*), timediff(_wend, last(ts)) + t1, timediff('2018-09-20 01:00:00', _wstart) + t1, concat(to_char(_wstart, 'HH:MI:SS__'), tbname) FROM meters WHERE ts >= '2018-09-20 00:00:00.000' AND ts < '2018-09-20 01:00:00.000' PARTITION BY tbname, t1 INTERVAL(5m) FILL(NULL) HAVING(timediff(last(ts), _wstart) + t1 >= 1) ORDER BY timediff(last(ts), _wstart), tbname" + tdSql.query(sql, queryTimes=1) + tdSql.checkRows(48) + + sql = "SELECT count(*) FROM meters WHERE ts >= '2018-09-20 00:00:00.000' AND ts < '2018-09-20 01:00:00.000' PARTITION BY tbname, t1 INTERVAL(5m) FILL(NULL) having(timediff(last(ts), _wstart) >= 0)" + tdSql.query(sql, queryTimes=1) + tdSql.checkRows(60) + def run(self): self.prepareTestEnv() self.test_partition_by_with_interval_fill_prev_new_group_fill_error() self.test_fill_with_order_by() self.test_fill_with_order_by2() + self.test_fill_with_complex_expr() def stop(self): tdSql.close() From d91b771d9c3b22619a0cf52bcb0fff6f395627ad Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Tue, 22 Oct 2024 09:13:45 +0800 Subject: [PATCH 174/695] fix retry error --- source/dnode/mgmt/node_mgmt/src/dmTransport.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/dnode/mgmt/node_mgmt/src/dmTransport.c b/source/dnode/mgmt/node_mgmt/src/dmTransport.c index e63e17e584b3..1340ee927741 100644 --- a/source/dnode/mgmt/node_mgmt/src/dmTransport.c +++ b/source/dnode/mgmt/node_mgmt/src/dmTransport.c @@ -34,6 +34,8 @@ static inline void dmBuildMnodeRedirectRsp(SDnode *pDnode, SRpcMsg *pMsg) { pMsg->code = TSDB_CODE_MNODE_NOT_FOUND; return; } + // dnode is not the mnode or mnode leader and This ensures that the function correctly handles cases where the + // dnode cannot obtain a valid epSet and avoids returning an incorrect or misleading epSet. if (strcmp(epSet.eps[0].fqdn, tsLocalFqdn) == 0 && epSet.eps[0].port == tsServerPort) { pMsg->pCont = NULL; pMsg->code = TSDB_CODE_MNODE_NOT_FOUND; From a193644e8593982c76d2fa5203a158029016ec47 Mon Sep 17 00:00:00 2001 From: qevolg <2227465945@qq.com> Date: Tue, 22 Oct 2024 11:20:56 +0800 Subject: [PATCH 175/695] chore(*): modify taoskeeper build process --- cmake/cmake.define | 1 + tools/CMakeLists.txt | 31 ++++++++----------------------- 2 files changed, 9 insertions(+), 23 deletions(-) diff --git a/cmake/cmake.define b/cmake/cmake.define index 2aba4785be31..a5f636c0fcba 100644 --- a/cmake/cmake.define +++ b/cmake/cmake.define @@ -1,6 +1,7 @@ cmake_minimum_required(VERSION 3.0) set(CMAKE_VERBOSE_MAKEFILE FALSE) set(TD_BUILD_TAOSA_INTERNAL FALSE) +set(TD_BUILD_TAOSA_INTERNAL FALSE) #set output directory SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/build/lib) diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index a4867612e4c2..b540200b4d50 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -251,29 +251,13 @@ IF(TD_BUILD_KEEPER) COMMAND cmake -E echo "Copy taoskeeper.toml" COMMAND cmake -E copy ./config/taoskeeper.toml ${CMAKE_BINARY_DIR}/test/cfg/ ) - ELSEIF(TD_DARWIN) - MESSAGE("Building taoskeeper on macOS") - INCLUDE(ExternalProject) - ExternalProject_Add(taoskeeper - PREFIX "taoskeeper" - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/keeper - BUILD_ALWAYS off - BUILD_IN_SOURCE 1 - CONFIGURE_COMMAND cmake -E echo "taoskeeper no need cmake to config" - PATCH_COMMAND - COMMAND git clean -f -d - BUILD_COMMAND - COMMAND go build -a -ldflags "-X 'github.com/taosdata/taoskeeper/version.Version=${taos_version}' -X 'github.com/taosdata/taoskeeper/version.CommitID=${taoskeeper_commit_sha1}' -X 'github.com/taosdata/taoskeeper/version.BuildInfo=${TD_VER_OSTYPE}-${TD_VER_CPUTYPE} ${TD_VER_DATE}'" - INSTALL_COMMAND - COMMAND cmake -E echo "Copy taoskeeper" - COMMAND cmake -E copy taoskeeper ${CMAKE_BINARY_DIR}/build/bin - COMMAND cmake -E make_directory ${CMAKE_BINARY_DIR}/test/cfg/ - COMMAND cmake -E echo "Copy taoskeeper.toml" - COMMAND cmake -E copy ./config/taoskeeper.toml ${CMAKE_BINARY_DIR}/test/cfg/ - COMMAND cmake -E copy ./taoskeeper.service ${CMAKE_BINARY_DIR}/test/cfg/ - ) ELSE() - MESSAGE("Building taoskeeper on Linux") + IF(TD_DARWIN) + MESSAGE("Building taoskeeper on macOS") + ELSE() + MESSAGE("Building taoskeeper on Linux") + ENDIF() + INCLUDE(ExternalProject) ExternalProject_Add(taoskeeper PREFIX "taoskeeper" @@ -291,9 +275,10 @@ IF(TD_BUILD_KEEPER) COMMAND cmake -E make_directory ${CMAKE_BINARY_DIR}/test/cfg/ COMMAND cmake -E echo "Copy taoskeeper.toml" COMMAND cmake -E copy ./config/taoskeeper.toml ${CMAKE_BINARY_DIR}/test/cfg/ + COMMAND cmake -E echo "Copy taoskeeper.service" COMMAND cmake -E copy ./taoskeeper.service ${CMAKE_BINARY_DIR}/test/cfg/ ) ENDIF() ELSEIF(TD_BUILD_KEEPER_INTERNAL) - MESSAGE("${Yellow} taoskeeper does not support internal option ${ColourReset}") + MESSAGE("${Yellow} use taoskeeper internal ${ColourReset}") ENDIF() From b30097cc883141831dee57bc0d86af591c240f5d Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Tue, 22 Oct 2024 13:33:19 +0800 Subject: [PATCH 176/695] fix issue --- source/libs/executor/src/streamtimewindowoperator.c | 10 ++++++---- source/libs/stream/src/streamBackendRocksdb.c | 6 ++++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/source/libs/executor/src/streamtimewindowoperator.c b/source/libs/executor/src/streamtimewindowoperator.c index a95a2b053e8a..6e2ef59ae40f 100644 --- a/source/libs/executor/src/streamtimewindowoperator.c +++ b/source/libs/executor/src/streamtimewindowoperator.c @@ -2238,10 +2238,12 @@ int32_t initStreamAggSupporter(SStreamAggSupporter* pSup, SExprSupp* pExpSup, in *(pSup->pState) = *pState; pSup->stateStore.streamStateSetNumber(pSup->pState, -1, tsIndex); int32_t funResSize = getMaxFunResSize(pExpSup, numOfOutput); - // used for backward compatibility of function's result info - pSup->pState->pResultRowStore.resultRowGet = getResultRowFromBuf; - pSup->pState->pResultRowStore.resultRowPut = putResultRowToBuf; - pSup->pState->pExprSupp = pExpSup; + if (stateType != STREAM_STATE_BUFF_HASH_SORT) { + // used for backward compatibility of function's result info + pSup->pState->pResultRowStore.resultRowGet = getResultRowFromBuf; + pSup->pState->pResultRowStore.resultRowPut = putResultRowToBuf; + pSup->pState->pExprSupp = pExpSup; + } if (stateType == STREAM_STATE_BUFF_SORT) { pSup->pState->pFileState = NULL; diff --git a/source/libs/stream/src/streamBackendRocksdb.c b/source/libs/stream/src/streamBackendRocksdb.c index a0a4f2d51615..5f73b3913f75 100644 --- a/source/libs/stream/src/streamBackendRocksdb.c +++ b/source/libs/stream/src/streamBackendRocksdb.c @@ -4328,7 +4328,7 @@ int32_t streamStatePutParTag_rocksdb(SStreamState* pState, int64_t groupId, cons int code = 0; char* dst = NULL; size_t size = 0; - if (pState->pResultRowStore.resultRowPut == NULL || pState->pExprSupp == NULL) { + if (pState->pResultRowStore.resultRowPut == NULL || pState->pExprSupp == NULL || tag == NULL) { STREAM_STATE_PUT_ROCKSDB(pState, "partag", &groupId, tag, tagLen); return code; } @@ -4607,7 +4607,9 @@ int32_t streamStatePutBatchOptimize(SStreamState* pState, int32_t cfIdx, rocksdb rocksdb_column_family_handle_t* pCf = wrapper->pCf[ginitDict[cfIdx].idx]; rocksdb_writebatch_put_cf((rocksdb_writebatch_t*)pBatch, pCf, buf, (size_t)klen, ttlV, (size_t)ttlVLen); - taosMemoryFree(dst); + if (pState->pResultRowStore.resultRowPut != NULL && pState->pExprSupp != NULL) { + taosMemoryFree(dst); + } if (tmpBuf == NULL) { taosMemoryFree(ttlV); From 657c29b4e0b5e22d8063e2b4830f562314a8843c Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Tue, 22 Oct 2024 14:07:23 +0800 Subject: [PATCH 177/695] add ci --- .../tsim/stream/streamFwcIntervalFill.sim | 235 ++++++++++++++++++ .../tsim/stream/streamTwaFwcInterval.sim | 16 +- .../stream/streamTwaFwcIntervalPrimaryKey.sim | 4 +- 3 files changed, 245 insertions(+), 10 deletions(-) create mode 100644 tests/script/tsim/stream/streamFwcIntervalFill.sim diff --git a/tests/script/tsim/stream/streamFwcIntervalFill.sim b/tests/script/tsim/stream/streamFwcIntervalFill.sim new file mode 100644 index 000000000000..27859974283a --- /dev/null +++ b/tests/script/tsim/stream/streamFwcIntervalFill.sim @@ -0,0 +1,235 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sleep 50 +sql connect + +print step1 +print =============== create database +sql create database test vgroups 4; +sql use test; + +sql create stable st(ts timestamp, a int, b int , c int)tags(ta int,tb int,tc int); +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); + +sql create stream streams1 trigger force_window_close IGNORE EXPIRED 1 IGNORE UPDATE 1 into streamt as select _wstart, count(a) as ca, now, ta, sum(b) as cb, timezone() from st partition by tbname,ta interval(2s) fill(value, 100, 200); + +run tsim/stream/checkTaskStatus.sim + +sql insert into t1 values(now + 3000a,1,1,1) (now + 3100a,5,10,10) (now + 3200a,5,10,10) (now + 5100a,20,1,1) (now + 5200a,30,10,10) (now + 5300a,40,10,10); +sql insert into t2 values(now + 3000a,1,1,1) (now + 3100a,2,10,10) (now + 3200a,30,10,10) (now + 5100a,10,1,1) (now + 5200a,40,10,10) (now + 5300a,7,10,10); + + +print sql select _wstart, count(a) as ca, now, ta, sum(b) as cb, timezone() from t1 partition by tbname,ta interval(2s) +sql select _wstart, count(a) as ca, now, ta, sum(b) as cb, timezone() from t1 partition by tbname,ta interval(2s); + +$query1_data01 = $data01 +$query1_data11 = $data11 + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +print sql select _wstart, count(a) as ca, now, ta, sum(b) as cb, timezone() from t2 partition by tbname,ta interval(2s); +sql select _wstart, count(a) as ca, now, ta, sum(b) as cb, timezone() from t2 partition by tbname,ta interval(2s); + +$query2_data01 = $data01 +$query2_data11 = $data11 + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +$loop_count = 0 +loop0: + +sleep 2000 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 2 sql select * from streamt where ta == 1 order by 1; +sql select * from streamt where ta == 1 order by 1; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +# row 0 +if $rows < 2 then + print ======rows=$rows + goto loop0 +endi + +if $data01 != $query1_data01 then + print ======data01========$data01 + print ======query1_data01=$query1_data01 + return -1 +endi + +if $data11 != $query1_data11 then + print ======data11========$data11 + print ======query1_data11=$query1_data11 + goto loop0 +endi + +$loop_count = 0 +loop1: + +sleep 2000 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 2 sql select * from streamt where ta == 2 order by 1; +sql select * from streamt where ta == 2 order by 1; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +# row 0 +if $rows < 2 then + print ======rows=$rows + goto loop1 +endi + +if $data01 != $query2_data01 then + print ======data01======$data01 + print ====query2_data01=$query2_data01 + return -1 +endi + +if $data11 != $query2_data11 then + print ======data11======$data11 + print ====query2_data11=$query2_data11 + goto loop1 +endi + +$loop_count = 0 +loop2: + +sleep 2000 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 2 sql select * from streamt; +sql select * from streamt; + +if $rows < 6 then + print ======rows=$rows + goto loop2 +endi + + +print step2 +print =============== create database +sql create database test2 vgroups 4; +sql use test2; + +sql create stable st(ts timestamp, a int, b int , c int)tags(ta int,tb int,tc int); +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); + +sql create stream streams2 trigger force_window_close IGNORE EXPIRED 1 IGNORE UPDATE 1 into streamt as select _wstart, count(*), ta from st partition by tbname,ta interval(2s) fill(NULL); + +run tsim/stream/checkTaskStatus.sim + +sql insert into t1 values(now + 3000a,1,1,1) (now + 3100a,3,10,10) (now + 3200a,5,10,10) (now + 5100a,20,1,1) (now + 5200a,30,10,10) (now + 5300a,40,10,10); +sql insert into t2 values(now + 3000a,1,1,1) (now + 3100a,3,10,10) (now + 3200a,5,10,10) (now + 5100a,10,1,1) (now + 5200a,40,10,10) (now + 5300a,7,10,10); + + +print sql select _wstart, count(*) from t1 interval(2s) order by 1; +sql select _wstart, count(*) from t1 interval(2s) order by 1; + +$query1_data01 = $data01 +$query1_data11 = $data11 + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + + +$loop_count = 0 +loop3: + +sleep 2000 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 2 sql select * from streamt where ta == 1 order by 1; +sql select * from streamt where ta == 1 order by 1; + +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +if $data01 != $query1_data01 then + print ======data01======$data01 + print ====query1_data01=$query1_data01 + goto loop3 +endi + + +sql insert into t1 values(now + 3000a,1,1,1) (now + 3100a,3,10,10) (now + 3200a,5,10,10) (now + 5100a,20,1,1) (now + 5200a,30,10,10) (now + 5300a,40,10,10); +sql insert into t2 values(now + 3000a,1,1,1) (now + 3100a,3,10,10) (now + 3200a,5,10,10) (now + 5100a,10,1,1) (now + 5200a,40,10,10) (now + 5300a,7,10,10); + +$loop_count = 0 +loop4: + +sleep 2000 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print 2 sql select * from streamt; +sql select * from streamt; + +print ======step2=rows=$rows +print $data00 $data01 $data02 $data03 $data04 +print $data10 $data11 $data12 $data13 $data14 +print $data20 $data21 $data22 $data23 $data24 +print $data30 $data31 $data32 $data33 $data34 +print $data40 $data41 $data42 $data43 $data44 +print $data50 $data51 $data52 $data53 $data54 + +if $rows < 10 then + print ======rows=$rows + goto loop4 +endi + +print end + +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/stream/streamTwaFwcInterval.sim b/tests/script/tsim/stream/streamTwaFwcInterval.sim index c9ff7ef5e839..86406503107e 100644 --- a/tests/script/tsim/stream/streamTwaFwcInterval.sim +++ b/tests/script/tsim/stream/streamTwaFwcInterval.sim @@ -83,7 +83,7 @@ endi if $data11 != $query1_data11 then print ======data11========$data11 print ======query1_data11=$query1_data11 - return loop0 + goto loop0 endi $loop_count = 0 @@ -121,7 +121,7 @@ endi if $data11 != $query2_data11 then print ======data11======$data11 print ====query2_data11=$query2_data11 - return loop1 + goto loop1 endi @@ -179,13 +179,13 @@ print $data50 $data51 $data52 $data53 $data54 if $data01 != $query1_data01 then print ======data01======$data01 print ====query1_data01=$query1_data01 - return loop2 + goto loop2 endi if $data11 != $query1_data11 then print ======data11========$data11 print ======query1_data11=$query1_data11 - return loop2 + goto loop2 endi sql insert into t1 values(now + 3000a,1,1,1) (now + 3100a,3,10,10) (now + 3200a,5,10,10) (now + 5100a,20,1,1) (now + 5200a,30,10,10) (now + 5300a,40,10,10); @@ -229,13 +229,13 @@ print $data50 $data51 $data52 $data53 $data54 if $data21 != $query1_data21 then print ======data21======$data21 print ====query1_data21=$query1_data21 - return loop3 + goto loop3 endi if $data31 != $query1_data31 then print ======data31========$data31 print ======query1_data31=$query1_data31 - return loop3 + goto loop3 endi @@ -280,13 +280,13 @@ print $data50 $data51 $data52 $data53 $data54 if $data41 != $query1_data41 then print ======data41======$data41 print ====query1_data41=$query1_data41 - return loop3 + goto loop3 endi if $data51 != $query1_data51 then print ======data51========$data51 print ======query1_data51=$query1_data51 - return loop3 + goto loop3 endi print end diff --git a/tests/script/tsim/stream/streamTwaFwcIntervalPrimaryKey.sim b/tests/script/tsim/stream/streamTwaFwcIntervalPrimaryKey.sim index cc1a04c4091c..b015a5955a04 100644 --- a/tests/script/tsim/stream/streamTwaFwcIntervalPrimaryKey.sim +++ b/tests/script/tsim/stream/streamTwaFwcIntervalPrimaryKey.sim @@ -65,7 +65,7 @@ endi if $data11 != 2 then print ======data11=$data11 - return loop0 + goto loop0 endi $loop_count = 0 @@ -101,7 +101,7 @@ endi if $data11 != 2 then print ======data11=$data11 - return loop1 + goto loop1 endi print end From e7a90fe982945d70d5e125ffc78db803601708bb Mon Sep 17 00:00:00 2001 From: qevolg <2227465945@qq.com> Date: Tue, 22 Oct 2024 15:03:40 +0800 Subject: [PATCH 178/695] chore(tools): delete taoskeeper internal message --- tools/CMakeLists.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index b540200b4d50..29aacd6bcea7 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -279,6 +279,4 @@ IF(TD_BUILD_KEEPER) COMMAND cmake -E copy ./taoskeeper.service ${CMAKE_BINARY_DIR}/test/cfg/ ) ENDIF() -ELSEIF(TD_BUILD_KEEPER_INTERNAL) - MESSAGE("${Yellow} use taoskeeper internal ${ColourReset}") ENDIF() From a60f798ada056727373b62959e0024c5c7502d08 Mon Sep 17 00:00:00 2001 From: wangjiaming0909 <604227650@qq.com> Date: Tue, 22 Oct 2024 15:19:25 +0800 Subject: [PATCH 179/695] add docs for fill value columns --- docs/en/14-reference/03-taos-sql/12-distinguished.md | 2 +- docs/zh/14-reference/03-taos-sql/12-distinguished.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/en/14-reference/03-taos-sql/12-distinguished.md b/docs/en/14-reference/03-taos-sql/12-distinguished.md index bfc9ca32c0ff..2374b762d49e 100644 --- a/docs/en/14-reference/03-taos-sql/12-distinguished.md +++ b/docs/en/14-reference/03-taos-sql/12-distinguished.md @@ -80,7 +80,7 @@ These pseudocolumns occur after the aggregation clause. `FILL` clause is used to specify how to fill when there is data missing in any window, including: 1. NONE: No fill (the default fill mode) -2. VALUE: Fill with a fixed value, which should be specified together, for example `FILL(VALUE, 1.23)` Note: The value filled depends on the data type. For example, if you run FILL(VALUE 1.23) on an integer column, the value 1 is filled. If multiple columns in select list need to be filled, then in the fill clause there must be a fill value for each of these columns, for example, `SELECT _wstart, min(c1), max(c1) FROM ... FILL(VALUE, 0, 0)`. +2. VALUE: Fill with a fixed value, which should be specified together, for example `FILL(VALUE, 1.23)` Note: The value filled depends on the data type. For example, if you run FILL(VALUE 1.23) on an integer column, the value 1 is filled. If multiple columns in select list need to be filled, then in the fill clause there must be a fill value for each of these columns, for example, `SELECT _wstart, min(c1), max(c1) FROM ... FILL(VALUE, 0, 0)`. Note that only exprs in select list that contains normal cols need to specify fill value, exprs like `_wstart`, `_wend`, `_wduration`, `_wstart + 1a`, `now`, `1+1`, partition keys like tbname(when using partition by) don't need to specify fill value. But exprs like `timediff(last(ts), _wstart)` need to specify fill value. 3. PREV: Fill with the previous non-NULL value, `FILL(PREV)` 4. NULL: Fill with NULL, `FILL(NULL)` 5. LINEAR: Fill with the closest non-NULL value, `FILL(LINEAR)` diff --git a/docs/zh/14-reference/03-taos-sql/12-distinguished.md b/docs/zh/14-reference/03-taos-sql/12-distinguished.md index e149c2c82e9c..0b834dea298e 100644 --- a/docs/zh/14-reference/03-taos-sql/12-distinguished.md +++ b/docs/zh/14-reference/03-taos-sql/12-distinguished.md @@ -76,7 +76,7 @@ window_clause: { FILL 语句指定某一窗口区间数据缺失的情况下的填充模式。填充模式包括以下几种: 1. 不进行填充:NONE(默认填充模式)。 -2. VALUE 填充:固定值填充,此时需要指定填充的数值。例如:FILL(VALUE, 1.23)。这里需要注意,最终填充的值受由相应列的类型决定,如 FILL(VALUE, 1.23),相应列为 INT 类型,则填充值为 1, 若查询列表中有多列需要FILL, 则需要给每一个FILL列指定VALUE, 如`SELECT _wstart, min(c1), max(c1) FROM ... FILL(VALUE, 0, 0)`。 +2. VALUE 填充:固定值填充,此时需要指定填充的数值。例如:FILL(VALUE, 1.23)。这里需要注意,最终填充的值受由相应列的类型决定,如 FILL(VALUE, 1.23),相应列为 INT 类型,则填充值为 1, 若查询列表中有多列需要FILL, 则需要给每一个FILL列指定VALUE, 如`SELECT _wstart, min(c1), max(c1) FROM ... FILL(VALUE, 0, 0)`, 注意, SELECT表达式中只有包含普通列时才需要指定FILL VALUE, 如`_wstart`, `_wstart+1a`, `now`, `1+1` 以及使用partition by时的partition key(如tbname)都不需要指定VALUE, 如`timediff(last(ts), _wstart)`则需要指定VALUE。 3. PREV 填充:使用前一个非 NULL 值填充数据。例如:FILL(PREV)。 4. NULL 填充:使用 NULL 填充数据。例如:FILL(NULL)。 5. LINEAR 填充:根据前后距离最近的非 NULL 值做线性插值填充。例如:FILL(LINEAR)。 From 2e8a5348c9c9438f4341e5838104f420b8ceef5e Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Tue, 22 Oct 2024 17:32:18 +0800 Subject: [PATCH 180/695] enh:[TD-32166]refactor code in sml --- source/client/inc/clientSml.h | 26 +++++++--------- source/client/src/clientSml.c | 58 ++++++++++++++--------------------- 2 files changed, 34 insertions(+), 50 deletions(-) diff --git a/source/client/inc/clientSml.h b/source/client/inc/clientSml.h index 3098b124b77c..88831ce815db 100644 --- a/source/client/inc/clientSml.h +++ b/source/client/inc/clientSml.h @@ -92,21 +92,17 @@ extern "C" { } \ } -#define SML_CHECK_CODE(CMD) \ - do { \ - code = (CMD); \ - if (TSDB_CODE_SUCCESS != code) { \ - goto END; \ - } \ - } while (0) - -#define SML_CHECK_NULL(CMD) \ - do { \ - if (NULL == (CMD)) { \ - code = terrno; \ - goto END; \ - } \ - } while (0) +#define SML_CHECK_CODE(CMD) \ + code = (CMD); \ + if (TSDB_CODE_SUCCESS != code) { \ + goto END; \ + } + +#define SML_CHECK_NULL(CMD) \ + if (NULL == (CMD)) { \ + code = terrno; \ + goto END; \ + } typedef enum { SCHEMA_ACTION_NULL, diff --git a/source/client/src/clientSml.c b/source/client/src/clientSml.c index 25abeb52fbb1..c5842bb0bbf9 100644 --- a/source/client/src/clientSml.c +++ b/source/client/src/clientSml.c @@ -207,19 +207,18 @@ static void smlDestroySTableMeta(void *para) { } int32_t smlBuildSuperTableInfo(SSmlHandle *info, SSmlLineInfo *currElement, SSmlSTableMeta **sMeta) { - int32_t code = TSDB_CODE_SUCCESS; + int32_t code = TSDB_CODE_SUCCESS; + STableMeta *pTableMeta = NULL; + char *measure = currElement->measure; int measureLen = currElement->measureLen; if (currElement->measureEscaped) { measure = (char *)taosMemoryMalloc(measureLen); - if (measure == NULL) { - return terrno; - } + SML_CHECK_NULL(measure); (void)memcpy(measure, currElement->measure, measureLen); PROCESS_SLASH_IN_MEASUREMENT(measure, measureLen); smlStrReplace(measure, measureLen); } - STableMeta *pTableMeta = NULL; code = smlGetMeta(info, measure, measureLen, &pTableMeta); if (currElement->measureEscaped) { taosMemoryFree(measure); @@ -227,20 +226,9 @@ int32_t smlBuildSuperTableInfo(SSmlHandle *info, SSmlLineInfo *currElement, SSml if (code != TSDB_CODE_SUCCESS) { info->dataFormat = false; info->reRun = true; - taosMemoryFreeClear(pTableMeta); - return code; - } - code = smlBuildSTableMeta(info->dataFormat, sMeta); - if (code != TSDB_CODE_SUCCESS) { - taosMemoryFreeClear(pTableMeta); - return code; - } - (*sMeta)->tableMeta = pTableMeta; - code = taosHashPut(info->superTables, currElement->measure, currElement->measureLen, sMeta, POINTER_BYTES); - if (code != TSDB_CODE_SUCCESS) { - smlDestroySTableMeta(*sMeta); - return code; + goto END; } + SML_CHECK_CODE(smlBuildSTableMeta(info->dataFormat, sMeta)); for (int i = 1; i < pTableMeta->tableInfo.numOfTags + pTableMeta->tableInfo.numOfColumns; i++) { SSchema *col = pTableMeta->schema + i; SSmlKv kv = {.key = col->name, .keyLen = strlen(col->name), .type = col->type}; @@ -254,16 +242,19 @@ int32_t smlBuildSuperTableInfo(SSmlHandle *info, SSmlLineInfo *currElement, SSml } if (i < pTableMeta->tableInfo.numOfColumns) { - if (taosArrayPush((*sMeta)->cols, &kv) == NULL) { - return terrno; - } + SML_CHECK_NULL(taosArrayPush((*sMeta)->cols, &kv)); } else { - if (taosArrayPush((*sMeta)->tags, &kv) == NULL) { - return terrno; - } + SML_CHECK_NULL(taosArrayPush((*sMeta)->tags, &kv)); } } - return TSDB_CODE_SUCCESS; + SML_CHECK_CODE(taosHashPut(info->superTables, currElement->measure, currElement->measureLen, sMeta, POINTER_BYTES)); + (*sMeta)->tableMeta = pTableMeta; + return code; + +END: + smlDestroySTableMeta(*sMeta); + taosMemoryFreeClear(pTableMeta); + return code; } bool isSmlColAligned(SSmlHandle *info, int cnt, SSmlKv *kv) { @@ -863,7 +854,7 @@ static FORCE_INLINE void smlBuildCreateStbReq(SMCreateStbReq *pReq, int32_t colV pReq->suid = suid; pReq->source = source; } -static int32_t smlSendMetaMsg(SSmlHandle *info, SName *pName, SArray *pColumns, SArray *pTags, STableMeta *pTableMeta, +static int32_t smlSendMetaMsg(SSmlHandle *info, SName *pName, SArray *pColumns, SArray **pTags, STableMeta *pTableMeta, ESchemaAction action) { SRequestObj *pRequest = NULL; SMCreateStbReq pReq = {0}; @@ -873,8 +864,9 @@ static int32_t smlSendMetaMsg(SSmlHandle *info, SName *pName, SArray *pColumns, // put front for free pReq.numOfColumns = taosArrayGetSize(pColumns); - pReq.pTags = pTags; - pReq.numOfTags = taosArrayGetSize(pTags); + pReq.pTags = *pTags; + pReq.numOfTags = taosArrayGetSize(*pTags); + *pTags = NULL; pReq.pColumns = taosArrayInit(pReq.numOfColumns, sizeof(SFieldWithOptions)); SML_CHECK_NULL(pReq.pColumns); @@ -970,8 +962,7 @@ static int32_t smlCreateTable(SSmlHandle *info, SRequestConnInfo *conn, SSmlSTab SML_CHECK_NULL(pTags); SML_CHECK_CODE(smlBuildFieldsList(info, NULL, NULL, sTableData->tags, pTags, 0, true)); SML_CHECK_CODE(smlBuildFieldsList(info, NULL, NULL, sTableData->cols, pColumns, 0, false)); - pTags = NULL; - SML_CHECK_CODE(smlSendMetaMsg(info, pName, pColumns, pTags, NULL, SCHEMA_ACTION_CREATE_STABLE)); + SML_CHECK_CODE(smlSendMetaMsg(info, pName, pColumns, &pTags, NULL, SCHEMA_ACTION_CREATE_STABLE)); info->cost.numOfCreateSTables++; taosMemoryFreeClear(*pTableMeta); @@ -1019,8 +1010,7 @@ static int32_t smlModifyTag(SSmlHandle *info, SHashObj* hashTmp, SRequestConnInf SML_CHECK_CODE(smlBuildFieldsList(info, (*pTableMeta)->schema, hashTmp, sTableData->tags, pTags, (*pTableMeta)->tableInfo.numOfColumns, true)); - pTags = NULL; - SML_CHECK_CODE(smlSendMetaMsg(info, pName, pColumns, pTags, (*pTableMeta), action)); + SML_CHECK_CODE(smlSendMetaMsg(info, pName, pColumns, &pTags, (*pTableMeta), action)); info->cost.numOfAlterTagSTables++; taosMemoryFreeClear(*pTableMeta); @@ -1050,8 +1040,7 @@ static int32_t smlModifyCols(SSmlHandle *info, SHashObj* hashTmp, SRequestConnIn SML_CHECK_CODE(smlBuildFieldsList(info, (*pTableMeta)->schema, hashTmp, sTableData->cols, pColumns, (*pTableMeta)->tableInfo.numOfColumns, false)); - pTags = NULL; - SML_CHECK_CODE(smlSendMetaMsg(info, pName, pColumns, pTags, (*pTableMeta), action)); + SML_CHECK_CODE(smlSendMetaMsg(info, pName, pColumns, &pTags, (*pTableMeta), action)); info->cost.numOfAlterColSTables++; taosMemoryFreeClear(*pTableMeta); @@ -1409,7 +1398,6 @@ static int32_t smlParseLineBottom(SSmlHandle *info) { info->lineNum); SSmlSTableMeta *meta = NULL; SML_CHECK_CODE(smlBuildSTableMeta(info->dataFormat, &meta)); - SML_CHECK_CODE(taosHashPut(info->superTables, elements->measure, elements->measureLen, &meta, POINTER_BYTES)); code = taosHashPut(info->superTables, elements->measure, elements->measureLen, &meta, POINTER_BYTES); if (code != TSDB_CODE_SUCCESS) { smlDestroySTableMeta(meta); From 21a7b6dc16d0d4cdf60d348e86330723c723d3ed Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Tue, 22 Oct 2024 17:43:30 +0800 Subject: [PATCH 181/695] enh:[TD-32166]remove useless code in sml --- source/client/inc/clientSml.h | 4 +- source/client/src/clientSml.c | 4 +- source/client/src/clientSmlJson.c | 422 +----------------------------- 3 files changed, 4 insertions(+), 426 deletions(-) diff --git a/source/client/inc/clientSml.h b/source/client/inc/clientSml.h index 88831ce815db..a562ca322691 100644 --- a/source/client/inc/clientSml.h +++ b/source/client/inc/clientSml.h @@ -225,8 +225,6 @@ extern int64_t smlFactorS[]; int32_t smlBuildSmlInfo(TAOS *taos, SSmlHandle **handle); void smlDestroyInfo(SSmlHandle *info); -int smlJsonParseObjFirst(char **start, SSmlLineInfo *element, int8_t *offset); -int smlJsonParseObj(char **start, char *end, SSmlLineInfo *element, int8_t *offset); void smlBuildInvalidDataMsg(SSmlMsgBuf *pBuf, const char *msg1, const char *msg2); int32_t smlParseNumber(SSmlKv *kvVal, SSmlMsgBuf *msg); int64_t smlGetTimeValue(const char *value, int32_t len, uint8_t fromPrecision, uint8_t toPrecision); @@ -246,7 +244,7 @@ void smlDestroyTableInfo(void *para); void freeSSmlKv(void* data); int32_t smlParseInfluxString(SSmlHandle *info, char *sql, char *sqlEnd, SSmlLineInfo *elements); int32_t smlParseTelnetString(SSmlHandle *info, char *sql, char *sqlEnd, SSmlLineInfo *elements); -int32_t smlParseJSON(SSmlHandle *info, char *payload); +int32_t smlParseJSONExt(SSmlHandle *info, char *payload); int32_t smlBuildSuperTableInfo(SSmlHandle *info, SSmlLineInfo *currElement, SSmlSTableMeta** sMeta); bool isSmlTagAligned(SSmlHandle *info, int cnt, SSmlKv *kv); diff --git a/source/client/src/clientSml.c b/source/client/src/clientSml.c index c5842bb0bbf9..9f9671f340c3 100644 --- a/source/client/src/clientSml.c +++ b/source/client/src/clientSml.c @@ -1597,9 +1597,9 @@ static int32_t smlParseLine(SSmlHandle *info, char *lines[], char *rawLine, char int32_t code = TSDB_CODE_SUCCESS; if (info->protocol == TSDB_SML_JSON_PROTOCOL) { if (lines) { - code = smlParseJSON(info, *lines); + code = smlParseJSONExt(info, *lines); } else if (rawLine) { - code = smlParseJSON(info, rawLine); + code = smlParseJSONExt(info, rawLine); } if (code != TSDB_CODE_SUCCESS) { uError("SML:0x%" PRIx64 " smlParseJSON failed:%s", info->id, lines ? *lines : rawLine); diff --git a/source/client/src/clientSmlJson.c b/source/client/src/clientSmlJson.c index 9568074018d4..d44f9cac9c40 100644 --- a/source/client/src/clientSmlJson.c +++ b/source/client/src/clientSmlJson.c @@ -21,259 +21,6 @@ #define OTD_JSON_SUB_FIELDS_NUM 2 -#define JUMP_JSON_SPACE(start) \ - while (*(start)) { \ - if (unlikely(*(start) > 32)) \ - break; \ - else \ - (start)++; \ - } - -static int32_t smlJsonGetObj(char **payload) { - int leftBracketCnt = 0; - bool isInQuote = false; - while (**payload) { - if (**payload == '"' && *((*payload) - 1) != '\\') { - isInQuote = !isInQuote; - } else if (!isInQuote && unlikely(**payload == '{')) { - leftBracketCnt++; - (*payload)++; - continue; - } else if (!isInQuote && unlikely(**payload == '}')) { - leftBracketCnt--; - (*payload)++; - if (leftBracketCnt == 0) { - return 0; - } else if (leftBracketCnt < 0) { - return -1; - } - continue; - } - (*payload)++; - } - return -1; -} - -int smlJsonParseObjFirst(char **start, SSmlLineInfo *element, int8_t *offset) { - int index = 0; - while (*(*start)) { - if ((*start)[0] != '"') { - (*start)++; - continue; - } - - if (unlikely(index >= OTD_JSON_FIELDS_NUM)) { - uError("index >= %d, %s", OTD_JSON_FIELDS_NUM, *start); - return TSDB_CODE_TSC_INVALID_JSON; - } - - char *sTmp = *start; - if ((*start)[1] == 'm' && (*start)[2] == 'e' && (*start)[3] == 't' && (*start)[4] == 'r' && (*start)[5] == 'i' && - (*start)[6] == 'c' && (*start)[7] == '"') { - (*start) += 8; - bool isInQuote = false; - while (*(*start)) { - if (unlikely(!isInQuote && *(*start) == '"')) { - (*start)++; - offset[index++] = *start - sTmp; - element->measure = (*start); - isInQuote = true; - continue; - } - if (unlikely(isInQuote && *(*start) == '"')) { - element->measureLen = (*start) - element->measure; - (*start)++; - break; - } - (*start)++; - } - } else if ((*start)[1] == 't' && (*start)[2] == 'i' && (*start)[3] == 'm' && (*start)[4] == 'e' && - (*start)[5] == 's' && (*start)[6] == 't' && (*start)[7] == 'a' && (*start)[8] == 'm' && - (*start)[9] == 'p' && (*start)[10] == '"') { - (*start) += 11; - bool hasColon = false; - while (*(*start)) { - if (unlikely(!hasColon && *(*start) == ':')) { - (*start)++; - JUMP_JSON_SPACE((*start)) - offset[index++] = *start - sTmp; - element->timestamp = (*start); - if (*(*start) == '{') { - char *tmp = *start; - int32_t code = smlJsonGetObj(&tmp); - if (code == 0) { - element->timestampLen = tmp - (*start); - *start = tmp; - } - break; - } - hasColon = true; - continue; - } - if (unlikely(hasColon && (*(*start) == ',' || *(*start) == '}' || (*(*start)) <= 32))) { - element->timestampLen = (*start) - element->timestamp; - break; - } - (*start)++; - } - } else if ((*start)[1] == 'v' && (*start)[2] == 'a' && (*start)[3] == 'l' && (*start)[4] == 'u' && - (*start)[5] == 'e' && (*start)[6] == '"') { - (*start) += 7; - - bool hasColon = false; - while (*(*start)) { - if (unlikely(!hasColon && *(*start) == ':')) { - (*start)++; - JUMP_JSON_SPACE((*start)) - offset[index++] = *start - sTmp; - element->cols = (*start); - if (*(*start) == '{') { - char *tmp = *start; - int32_t code = smlJsonGetObj(&tmp); - if (code == 0) { - element->colsLen = tmp - (*start); - *start = tmp; - } - break; - } - hasColon = true; - continue; - } - if (unlikely(hasColon && (*(*start) == ',' || *(*start) == '}' || (*(*start)) <= 32))) { - element->colsLen = (*start) - element->cols; - break; - } - (*start)++; - } - } else if ((*start)[1] == 't' && (*start)[2] == 'a' && (*start)[3] == 'g' && (*start)[4] == 's' && - (*start)[5] == '"') { - (*start) += 6; - - while (*(*start)) { - if (unlikely(*(*start) == ':')) { - (*start)++; - JUMP_JSON_SPACE((*start)) - offset[index++] = *start - sTmp; - element->tags = (*start); - char *tmp = *start; - int32_t code = smlJsonGetObj(&tmp); - if (code == 0) { - element->tagsLen = tmp - (*start); - *start = tmp; - } - break; - } - (*start)++; - } - } - if (*(*start) == '\0') { - break; - } - if (*(*start) == '}') { - (*start)++; - break; - } - (*start)++; - } - - if (unlikely(index != OTD_JSON_FIELDS_NUM) || element->tags == NULL || element->cols == NULL || - element->measure == NULL || element->timestamp == NULL) { - uError("elements != %d or element parse null", OTD_JSON_FIELDS_NUM); - return TSDB_CODE_TSC_INVALID_JSON; - } - return 0; -} - -int smlJsonParseObj(char **start, char *end, SSmlLineInfo *element, int8_t *offset) { - int index = 0; - while (*(*start)) { - if ((*start)[0] != '"') { - (*start)++; - continue; - } - - if (unlikely(index >= OTD_JSON_FIELDS_NUM)) { - uError("index >= %d, %s", OTD_JSON_FIELDS_NUM, *start); - return TSDB_CODE_TSC_INVALID_JSON; - } - - if ((*start) + offset[index] >= end){ - return TSDB_CODE_TSC_INVALID_JSON; - } - - if ((*start)[1] == 'm') { - (*start) += offset[index++]; - element->measure = *start; - while (*(*start)) { - if (unlikely(*(*start) == '"')) { - element->measureLen = (*start) - element->measure; - (*start)++; - break; - } - (*start)++; - } - } else if ((*start)[1] == 't' && (*start)[2] == 'i') { - (*start) += offset[index++]; - element->timestamp = *start; - if (*(*start) == '{') { - char *tmp = *start; - int32_t code = smlJsonGetObj(&tmp); - if (code == 0) { - element->timestampLen = tmp - (*start); - *start = tmp; - } - } else { - while (*(*start)) { - if (unlikely(*(*start) == ',' || *(*start) == '}' || (*(*start)) <= 32)) { - element->timestampLen = (*start) - element->timestamp; - break; - } - (*start)++; - } - } - } else if ((*start)[1] == 'v') { - (*start) += offset[index++]; - element->cols = *start; - if (*(*start) == '{') { - char *tmp = *start; - int32_t code = smlJsonGetObj(&tmp); - if (code == 0) { - element->colsLen = tmp - (*start); - *start = tmp; - } - } else { - while (*(*start)) { - if (unlikely(*(*start) == ',' || *(*start) == '}' || (*(*start)) <= 32)) { - element->colsLen = (*start) - element->cols; - break; - } - (*start)++; - } - } - } else if ((*start)[1] == 't' && (*start)[2] == 'a') { - (*start) += offset[index++]; - element->tags = (*start); - char *tmp = *start; - int32_t code = smlJsonGetObj(&tmp); - if (code == 0) { - element->tagsLen = tmp - (*start); - *start = tmp; - } - } - if (*(*start) == '}') { - (*start)++; - break; - } - (*start)++; - } - - if (unlikely(index != 0 && index != OTD_JSON_FIELDS_NUM)) { - uError("elements != %d", OTD_JSON_FIELDS_NUM); - return TSDB_CODE_TSC_INVALID_JSON; - } - return TSDB_CODE_SUCCESS; -} - static inline int32_t smlParseMetricFromJSON(SSmlHandle *info, cJSON *metric, SSmlLineInfo *elements) { elements->measureLen = strlen(metric->valuestring); if (IS_INVALID_TABLE_LEN(elements->measureLen)) { @@ -760,7 +507,7 @@ static int32_t smlParseJSONStringExt(SSmlHandle *info, cJSON *root, SSmlLineInfo return ret; } -static int32_t smlParseJSONExt(SSmlHandle *info, char *payload) { +int32_t smlParseJSONExt(SSmlHandle *info, char *payload) { int32_t payloadNum = 0; int32_t ret = TSDB_CODE_SUCCESS; @@ -830,170 +577,3 @@ static int32_t smlParseJSONExt(SSmlHandle *info, char *payload) { return TSDB_CODE_SUCCESS; } -static int32_t smlParseJSONString(SSmlHandle *info, char **start, char *end, SSmlLineInfo *elements) { - int32_t ret = TSDB_CODE_SUCCESS; - - if (info->offset[0] == 0) { - ret = smlJsonParseObjFirst(start, elements, info->offset); - } else { - ret = smlJsonParseObj(start, end, elements, info->offset); - } - - if (ret != TSDB_CODE_SUCCESS) { - return ret; - } - - if (unlikely(**start == '\0' && elements->measure == NULL)) return TSDB_CODE_SUCCESS; - - if (unlikely(IS_INVALID_TABLE_LEN(elements->measureLen))) { - smlBuildInvalidDataMsg(&info->msgBuf, "measure is empty or too large than 192", NULL); - return TSDB_CODE_TSC_INVALID_TABLE_ID_LENGTH; - } - - SSmlKv kv = {.key = VALUE, .keyLen = VALUE_LEN, .value = elements->cols, .length = (size_t)elements->colsLen}; - - if (unlikely(elements->colsLen == 0)) { - uError("SML:colsLen == 0"); - return TSDB_CODE_TSC_INVALID_VALUE; - } else if (unlikely(elements->cols[0] == '{')) { - char tmp = elements->cols[elements->colsLen]; - elements->cols[elements->colsLen] = '\0'; - cJSON *valueJson = cJSON_Parse(elements->cols); - if (unlikely(valueJson == NULL)) { - uError("SML:0x%" PRIx64 " parse json cols failed:%s", info->id, elements->cols); - elements->cols[elements->colsLen] = tmp; - return TSDB_CODE_TSC_INVALID_JSON; - } - if (taosArrayPush(info->valueJsonArray, &valueJson) == NULL){ - cJSON_Delete(valueJson); - elements->cols[elements->colsLen] = tmp; - return terrno; - } - ret = smlParseValueFromJSONObj(valueJson, &kv); - if (ret != TSDB_CODE_SUCCESS) { - uError("SML:0x%" PRIx64 " Failed to parse value from JSON Obj:%s", info->id, elements->cols); - elements->cols[elements->colsLen] = tmp; - return TSDB_CODE_TSC_INVALID_VALUE; - } - elements->cols[elements->colsLen] = tmp; - } else if (smlParseValue(&kv, &info->msgBuf) != TSDB_CODE_SUCCESS) { - uError("SML:0x%" PRIx64 " cols invalidate:%s", info->id, elements->cols); - return TSDB_CODE_TSC_INVALID_VALUE; - } - - // Parse tags - if (is_same_child_table_telnet(elements, &info->preLine) != 0) { - char tmp = *(elements->tags + elements->tagsLen); - *(elements->tags + elements->tagsLen) = 0; - cJSON *tagsJson = cJSON_Parse(elements->tags); - *(elements->tags + elements->tagsLen) = tmp; - if (unlikely(tagsJson == NULL)) { - uError("SML:0x%" PRIx64 " parse json tag failed:%s", info->id, elements->tags); - return TSDB_CODE_TSC_INVALID_JSON; - } - - if (taosArrayPush(info->tagJsonArray, &tagsJson) == NULL){ - cJSON_Delete(tagsJson); - uError("SML:0x%" PRIx64 " taosArrayPush failed", info->id); - return terrno; - } - ret = smlParseTagsFromJSON(info, tagsJson, elements); - if (unlikely(ret)) { - uError("OTD:0x%" PRIx64 " Unable to parse tags from JSON payload", info->id); - return ret; - } - } else { - elements->measureTag = info->preLine.measureTag; - } - - if (unlikely(info->reRun)) { - return TSDB_CODE_SUCCESS; - } - - // Parse timestamp - // notice!!! put ts back to tag to ensure get meta->precision - int64_t ts = 0; - if (unlikely(elements->timestampLen == 0)) { - uError("OTD:0x%" PRIx64 " elements->timestampLen == 0", info->id); - return TSDB_CODE_INVALID_TIMESTAMP; - } else if (elements->timestamp[0] == '{') { - char tmp = elements->timestamp[elements->timestampLen]; - elements->timestamp[elements->timestampLen] = '\0'; - cJSON *tsJson = cJSON_Parse(elements->timestamp); - ts = smlParseTSFromJSON(info, tsJson); - if (unlikely(ts < 0)) { - uError("SML:0x%" PRIx64 " Unable to parse timestamp from JSON payload:%s", info->id, elements->timestamp); - elements->timestamp[elements->timestampLen] = tmp; - cJSON_Delete(tsJson); - return TSDB_CODE_INVALID_TIMESTAMP; - } - elements->timestamp[elements->timestampLen] = tmp; - cJSON_Delete(tsJson); - } else { - ts = smlParseOpenTsdbTime(info, elements->timestamp, elements->timestampLen); - if (unlikely(ts < 0)) { - uError("OTD:0x%" PRIx64 " Unable to parse timestamp from JSON payload", info->id); - return TSDB_CODE_INVALID_TIMESTAMP; - } - } - SSmlKv kvTs = {0}; - smlBuildTsKv(&kvTs, ts); - - if (info->dataFormat){ - ret = smlParseEndTelnetJsonFormat(info, elements, &kvTs, &kv); - } else { - ret = smlParseEndTelnetJsonUnFormat(info, elements, &kvTs, &kv); - } - return ret; -} - -int32_t smlParseJSON(SSmlHandle *info, char *payload) { - int32_t payloadNum = 1 << 10; - int32_t ret = TSDB_CODE_SUCCESS; - - uDebug("SML:0x%" PRIx64 "json:%s", info->id, payload); - int cnt = 0; - char *dataPointStart = payload; - char *dataPointEnd = payload + strlen(payload); - while (1) { - if (info->dataFormat) { - SSmlLineInfo element = {0}; - ret = smlParseJSONString(info, &dataPointStart, dataPointEnd, &element); - if (element.measureTagsLen != 0) taosMemoryFree(element.measureTag); - } else { - if (cnt >= payloadNum) { - payloadNum = payloadNum << 1; - void *tmp = taosMemoryRealloc(info->lines, payloadNum * sizeof(SSmlLineInfo)); - if (tmp == NULL) { - ret = terrno; - return ret; - } - info->lines = (SSmlLineInfo *)tmp; - (void)memset(info->lines + cnt, 0, (payloadNum - cnt) * sizeof(SSmlLineInfo)); - } - ret = smlParseJSONString(info, &dataPointStart, dataPointEnd, info->lines + cnt); - if ((info->lines + cnt)->measure == NULL) break; - } - if (unlikely(ret != TSDB_CODE_SUCCESS)) { - uError("SML:0x%" PRIx64 " Invalid JSON Payload 1:%s", info->id, payload); - return smlParseJSONExt(info, payload); - } - - if (unlikely(info->reRun)) { - cnt = 0; - dataPointStart = payload; - info->lineNum = payloadNum; - ret = smlClearForRerun(info); - if (ret != TSDB_CODE_SUCCESS) { - return ret; - } - continue; - } - - cnt++; - if (*dataPointStart == '\0') break; - } - info->lineNum = cnt; - - return TSDB_CODE_SUCCESS; -} From 574998f02835372490b6d5b9cfeec555a34ebb78 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Tue, 22 Oct 2024 17:50:26 +0800 Subject: [PATCH 182/695] enh:[TD-32166]remove useless code in sml --- source/client/src/clientSml.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/source/client/src/clientSml.c b/source/client/src/clientSml.c index 9f9671f340c3..c17ff1413ee0 100644 --- a/source/client/src/clientSml.c +++ b/source/client/src/clientSml.c @@ -197,7 +197,13 @@ void smlBuildTsKv(SSmlKv *kv, int64_t ts) { } static void smlDestroySTableMeta(void *para) { + if (para == NULL) { + return; + } SSmlSTableMeta *meta = *(SSmlSTableMeta **)para; + if (meta == NULL) { + return; + } taosHashCleanup(meta->tagHash); taosHashCleanup(meta->colHash); taosArrayDestroy(meta->tags); @@ -252,7 +258,7 @@ int32_t smlBuildSuperTableInfo(SSmlHandle *info, SSmlLineInfo *currElement, SSml return code; END: - smlDestroySTableMeta(*sMeta); + smlDestroySTableMeta(sMeta); taosMemoryFreeClear(pTableMeta); return code; } @@ -587,7 +593,7 @@ int32_t smlBuildSTableMeta(bool isDataFormat, SSmlSTableMeta **sMeta) { return TSDB_CODE_SUCCESS; END: - smlDestroySTableMeta(meta); + smlDestroySTableMeta(&meta); return TSDB_CODE_OUT_OF_MEMORY; } @@ -1400,7 +1406,7 @@ static int32_t smlParseLineBottom(SSmlHandle *info) { SML_CHECK_CODE(smlBuildSTableMeta(info->dataFormat, &meta)); code = taosHashPut(info->superTables, elements->measure, elements->measureLen, &meta, POINTER_BYTES); if (code != TSDB_CODE_SUCCESS) { - smlDestroySTableMeta(meta); + smlDestroySTableMeta(&meta); uError("SML:0x%" PRIx64 " put measuer to hash failed", info->id); goto END; } From c17bed98079a69a19c0d3a25b7dbf1354ad20ce5 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Tue, 22 Oct 2024 17:55:05 +0800 Subject: [PATCH 183/695] optimize clear expired state --- source/libs/stream/src/tstreamFileState.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/source/libs/stream/src/tstreamFileState.c b/source/libs/stream/src/tstreamFileState.c index eea3fd92d27d..0d0bdf29c007 100644 --- a/source/libs/stream/src/tstreamFileState.c +++ b/source/libs/stream/src/tstreamFileState.c @@ -1220,20 +1220,22 @@ void clearExpiredState(SStreamFileState* pFileState) { SSHashObj* pSearchBuff = pFileState->searchBuff; void* pIte = NULL; int32_t iter = 0; - while ((pIte = tSimpleHashIterate(pFileState->searchBuff, pIte, &iter)) != NULL) { + while ((pIte = tSimpleHashIterate(pSearchBuff, pIte, &iter)) != NULL) { SArray* pWinStates = *((void**)pIte); int32_t size = taosArrayGetSize(pWinStates); for (int32_t i = 0; i < size - 1; i++) { SWinKey* pKey = taosArrayGet(pWinStates, i); int32_t code_buff = pFileState->stateBuffRemoveFn(pFileState->rowStateBuff, pKey, sizeof(SWinKey)); - qTrace("%s at line %d res:%d", __func__, __LINE__, code_buff); + qTrace("clear expired buff, ts:%" PRId64 ". %s at line %d res:%d", pKey->ts, __func__, __LINE__, code_buff); - int32_t code_file = pFileState->stateFileRemoveFn(pFileState, pKey); - qTrace("%s at line %d res:%d", __func__, __LINE__, code_file); + if (isFlushedState(pFileState, pKey->ts, 0)) { + int32_t code_file = pFileState->stateFileRemoveFn(pFileState, pKey); + qTrace("clear expired file, ts:%" PRId64 ". %s at line %d res:%d", pKey->ts, __func__, __LINE__, code_file); + } - if (pFileState->hasFillCatch == false || isFlushedState(pFileState, pKey->ts, 0)) { - code_file = streamStateFillDel_rocksdb(pFileState->pFileStore, pKey); - qTrace("state fill delete.%s at line %d res %d", __func__, __LINE__, code_file); + if (pFileState->hasFillCatch == false) { + int32_t code_file = streamStateFillDel_rocksdb(pFileState->pFileStore, pKey); + qTrace("force clear expired file, ts:%" PRId64 ". %s at line %d res %d", pKey->ts, __func__, __LINE__, code_file); } } taosArrayRemoveBatch(pWinStates, 0, size - 1, NULL); From 94a70c9389cd930a3f80dbfe66edbd272a67246c Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Tue, 22 Oct 2024 23:24:39 +0800 Subject: [PATCH 184/695] enh:[TS-5441] cost too long in tmq write meta data by cache meta and vg info --- source/client/src/clientRawBlockWrite.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/client/src/clientRawBlockWrite.c b/source/client/src/clientRawBlockWrite.c index 681d6e5fdb5f..2bd815b4606a 100644 --- a/source/client/src/clientRawBlockWrite.c +++ b/source/client/src/clientRawBlockWrite.c @@ -2344,9 +2344,9 @@ static int32_t tmqWriteBatchMetaDataImpl(TAOS* taos, void* meta, int32_t metaLen if (taos == NULL || meta == NULL) { return TSDB_CODE_INVALID_PARA; } - SMqBatchMetaRsp rsp = {0}; + SMqBatchMetaRsp rsp = {0}; SDecoder coder = {0}; - int32_t code = TSDB_CODE_SUCCESS; + int32_t code = TSDB_CODE_SUCCESS; // decode and process req tDecoderInit(&coder, meta, metaLen); From 2178dd53ace79b55071dbac8c80fff28c381d2ab Mon Sep 17 00:00:00 2001 From: qevolg <2227465945@qq.com> Date: Wed, 23 Oct 2024 09:04:22 +0800 Subject: [PATCH 185/695] chore(cmake): modify define --- cmake/cmake.define | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/cmake.define b/cmake/cmake.define index d808f024135c..998a969b6570 100644 --- a/cmake/cmake.define +++ b/cmake/cmake.define @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.0) set(CMAKE_VERBOSE_MAKEFILE FALSE) set(TD_BUILD_TAOSA_INTERNAL FALSE) -set(TD_BUILD_TAOSA_INTERNAL FALSE) +set(TD_BUILD_KEEPER_INTERNAL FALSE) #set output directory SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/build/lib) From 9a3184578dc0c352aa96bbb22179881a8aeae2dc Mon Sep 17 00:00:00 2001 From: Yu Chen <74105241+yu285@users.noreply.github.com> Date: Wed, 23 Oct 2024 09:26:28 +0800 Subject: [PATCH 186/695] docs:Update 07-supported.md --- docs/zh/14-reference/07-supported.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/zh/14-reference/07-supported.md b/docs/zh/14-reference/07-supported.md index 10ca237653c8..fcb20b8ac180 100644 --- a/docs/zh/14-reference/07-supported.md +++ b/docs/zh/14-reference/07-supported.md @@ -14,7 +14,7 @@ description: "TDengine 服务端、客户端和连接器支持的平台列表" | M1 | | | | | | | | ● | 注:1) ● 表示经过官方测试验证, ○ 表示非官方测试验证,E 表示仅企业版支持。 - 2) 社区版仅支持主流操作系统的较新版本,包括 Ubuntu 18+/CentOS 7+/RedHat/Debian/CoreOS/FreeBSD/OpenSUSE/SUSE Linux/Fedora/macOS 等。如果有其他操作系统及版本的需求,请联系企业版支持。 + 2) 社区版仅支持主流操作系统的较新版本,包括 Ubuntu 18+/CentOS 7+/CentOS Stream/RedHat/Debian/CoreOS/FreeBSD/OpenSUSE/SUSE Linux/Fedora/macOS 等。如果有其他操作系统及版本的需求,请联系企业版支持。 ## TDengine 客户端和连接器支持的平台列表 From 14faa7585d42b1c0610b6f7d79854fe721ba0d92 Mon Sep 17 00:00:00 2001 From: Shungang Li Date: Tue, 22 Oct 2024 10:05:44 +0800 Subject: [PATCH 187/695] enh: mndArbGroup replace unsafe func --- source/dnode/mnode/impl/src/mndArbGroup.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndArbGroup.c b/source/dnode/mnode/impl/src/mndArbGroup.c index 97bf661bc35b..1dd21900e3fb 100644 --- a/source/dnode/mnode/impl/src/mndArbGroup.c +++ b/source/dnode/mnode/impl/src/mndArbGroup.c @@ -15,13 +15,10 @@ #define _DEFAULT_SOURCE #include "mndArbGroup.h" -#include "audit.h" #include "mndDb.h" #include "mndDnode.h" -#include "mndPrivilege.h" #include "mndShow.h" #include "mndTrans.h" -#include "mndUser.h" #include "mndVgroup.h" #define ARBGROUP_VER_NUMBER 1 @@ -245,11 +242,11 @@ static int32_t mndArbGroupActionUpdate(SSdb *pSdb, SArbGroup *pOld, SArbGroup *p } for (int i = 0; i < TSDB_ARB_GROUP_MEMBER_NUM; i++) { - (void)memcpy(pOld->members[i].state.token, pNew->members[i].state.token, TSDB_ARB_TOKEN_SIZE); + tstrncpy(pOld->members[i].state.token, pNew->members[i].state.token, TSDB_ARB_TOKEN_SIZE); } pOld->isSync = pNew->isSync; pOld->assignedLeader.dnodeId = pNew->assignedLeader.dnodeId; - (void)memcpy(pOld->assignedLeader.token, pNew->assignedLeader.token, TSDB_ARB_TOKEN_SIZE); + tstrncpy(pOld->assignedLeader.token, pNew->assignedLeader.token, TSDB_ARB_TOKEN_SIZE); pOld->assignedLeader.acked = pNew->assignedLeader.acked; pOld->version++; @@ -834,12 +831,12 @@ static int32_t mndProcessArbUpdateGroupBatchReq(SRpcMsg *pReq) { newGroup.dbUid = pUpdateGroup->dbUid; for (int i = 0; i < TSDB_ARB_GROUP_MEMBER_NUM; i++) { newGroup.members[i].info.dnodeId = pUpdateGroup->members[i].dnodeId; - (void)memcpy(newGroup.members[i].state.token, pUpdateGroup->members[i].token, TSDB_ARB_TOKEN_SIZE); + tstrncpy(newGroup.members[i].state.token, pUpdateGroup->members[i].token, TSDB_ARB_TOKEN_SIZE); } newGroup.isSync = pUpdateGroup->isSync; newGroup.assignedLeader.dnodeId = pUpdateGroup->assignedLeader.dnodeId; - (void)memcpy(newGroup.assignedLeader.token, pUpdateGroup->assignedLeader.token, TSDB_ARB_TOKEN_SIZE); + tstrncpy(newGroup.assignedLeader.token, pUpdateGroup->assignedLeader.token, TSDB_ARB_TOKEN_SIZE); newGroup.assignedLeader.acked = pUpdateGroup->assignedLeader.acked; newGroup.version = pUpdateGroup->version; @@ -897,7 +894,7 @@ static void mndArbGroupSetAssignedLeader(SArbGroup *pGroup, int32_t index) { SArbGroupMember *pMember = &pGroup->members[index]; pGroup->assignedLeader.dnodeId = pMember->info.dnodeId; - (void)strncpy(pGroup->assignedLeader.token, pMember->state.token, TSDB_ARB_TOKEN_SIZE); + tstrncpy(pGroup->assignedLeader.token, pMember->state.token, TSDB_ARB_TOKEN_SIZE); pGroup->assignedLeader.acked = false; } @@ -979,7 +976,7 @@ bool mndUpdateArbGroupByHeartBeat(SArbGroup *pGroup, SVArbHbRspMember *pRspMembe // update token mndArbGroupDupObj(pGroup, pNewGroup); - (void)memcpy(pNewGroup->members[index].state.token, pRspMember->memberToken, TSDB_ARB_TOKEN_SIZE); + tstrncpy(pNewGroup->members[index].state.token, pRspMember->memberToken, TSDB_ARB_TOKEN_SIZE); pNewGroup->isSync = false; bool resetAssigned = false; From 0a9d1282b28cf9fbff94e621527ba0b1d53110e5 Mon Sep 17 00:00:00 2001 From: xsren <285808407@qq.com> Date: Sat, 12 Oct 2024 18:02:30 +0800 Subject: [PATCH 188/695] setResultDataPtr --- source/client/inc/clientInt.h | 3 +-- source/client/src/clientImpl.c | 27 +++++++++++++-------------- source/client/src/clientTmq.c | 3 +-- 3 files changed, 15 insertions(+), 18 deletions(-) diff --git a/source/client/inc/clientInt.h b/source/client/inc/clientInt.h index 8d45e8b4a811..2ce466dee11f 100644 --- a/source/client/inc/clientInt.h +++ b/source/client/inc/clientInt.h @@ -295,8 +295,7 @@ void* doFetchRows(SRequestObj* pRequest, bool setupOneRowPtr, bool convertUcs4); void doSetOneRowPtr(SReqResultInfo* pResultInfo); void setResPrecision(SReqResultInfo* pResInfo, int32_t precision); int32_t setQueryResultFromRsp(SReqResultInfo* pResultInfo, const SRetrieveTableRsp* pRsp, bool convertUcs4); -int32_t setResultDataPtr(SReqResultInfo* pResultInfo, TAOS_FIELD* pFields, int32_t numOfCols, int32_t numOfRows, - bool convertUcs4); +int32_t setResultDataPtr(SReqResultInfo* pResultInfo, bool convertUcs4); int32_t setResSchemaInfo(SReqResultInfo* pResInfo, const SSchema* pSchema, int32_t numOfCols); void doFreeReqResultInfo(SReqResultInfo* pResInfo); int32_t transferTableNameList(const char* tbList, int32_t acctId, char* dbName, SArray** pReq); diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index 9131d29f30a6..08dbe7af6f71 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -2341,14 +2341,13 @@ static int32_t doConvertJson(SReqResultInfo* pResultInfo, int32_t numOfCols, int return TSDB_CODE_SUCCESS; } -int32_t setResultDataPtr(SReqResultInfo* pResultInfo, TAOS_FIELD* pFields, int32_t numOfCols, int32_t numOfRows, - bool convertUcs4) { - if (numOfCols <= 0 || pFields == NULL || pResultInfo == NULL) { +int32_t setResultDataPtr(SReqResultInfo* pResultInfo, bool convertUcs4) { + if (pResultInfo->numOfCols <= 0 || pResultInfo->fields == NULL || pResultInfo == NULL) { tscError("setResultDataPtr paras error"); return TSDB_CODE_TSC_INTERNAL_ERROR; } - if (numOfRows == 0) { + if (pResultInfo->numOfRows == 0) { return TSDB_CODE_SUCCESS; } @@ -2356,7 +2355,7 @@ int32_t setResultDataPtr(SReqResultInfo* pResultInfo, TAOS_FIELD* pFields, int32 if (code != TSDB_CODE_SUCCESS) { return code; } - code = doConvertJson(pResultInfo, numOfCols, numOfRows); + code = doConvertJson(pResultInfo, pResultInfo->numOfCols, pResultInfo->numOfRows); if (code != TSDB_CODE_SUCCESS) { return code; } @@ -2376,9 +2375,9 @@ int32_t setResultDataPtr(SReqResultInfo* pResultInfo, TAOS_FIELD* pFields, int32 int32_t cols = *(int32_t*)p; p += sizeof(int32_t); - if (rows != numOfRows || cols != numOfCols) { - tscError("setResultDataPtr paras error:rows;%d numOfRows:%d cols:%d numOfCols:%d", rows, numOfRows, cols, - numOfCols); + if (rows != pResultInfo->numOfRows || cols != pResultInfo->numOfCols) { + tscError("setResultDataPtr paras error:rows;%d numOfRows:%" PRId64 " cols:%d numOfCols:%d", rows, pResultInfo->numOfRows, cols, + pResultInfo->numOfCols); return TSDB_CODE_TSC_INTERNAL_ERROR; } @@ -2389,7 +2388,7 @@ int32_t setResultDataPtr(SReqResultInfo* pResultInfo, TAOS_FIELD* pFields, int32 p += sizeof(uint64_t); // check fields - for (int32_t i = 0; i < numOfCols; ++i) { + for (int32_t i = 0; i < pResultInfo->numOfCols; ++i) { int8_t type = *(int8_t*)p; p += sizeof(int8_t); @@ -2398,10 +2397,10 @@ int32_t setResultDataPtr(SReqResultInfo* pResultInfo, TAOS_FIELD* pFields, int32 } int32_t* colLength = (int32_t*)p; - p += sizeof(int32_t) * numOfCols; + p += sizeof(int32_t) * pResultInfo->numOfCols; char* pStart = p; - for (int32_t i = 0; i < numOfCols; ++i) { + for (int32_t i = 0; i < pResultInfo->numOfCols; ++i) { if (blockVersion == BLOCK_VERSION_1) { colLength[i] = htonl(colLength[i]); } @@ -2412,7 +2411,7 @@ int32_t setResultDataPtr(SReqResultInfo* pResultInfo, TAOS_FIELD* pFields, int32 if (IS_VAR_DATA_TYPE(pResultInfo->fields[i].type)) { pResultInfo->pCol[i].offset = (int32_t*)pStart; - pStart += numOfRows * sizeof(int32_t); + pStart += pResultInfo->numOfRows * sizeof(int32_t); } else { pResultInfo->pCol[i].nullbitmap = pStart; pStart += BitmapLen(pResultInfo->numOfRows); @@ -2429,7 +2428,7 @@ int32_t setResultDataPtr(SReqResultInfo* pResultInfo, TAOS_FIELD* pFields, int32 p += sizeof(bool); if (convertUcs4) { - code = doConvertUCS4(pResultInfo, numOfRows, numOfCols, colLength); + code = doConvertUCS4(pResultInfo, pResultInfo->numOfRows, pResultInfo->numOfCols, colLength); } return code; @@ -2542,7 +2541,7 @@ int32_t setQueryResultFromRsp(SReqResultInfo* pResultInfo, const SRetrieveTableR pResultInfo->totalRows += pResultInfo->numOfRows; int32_t code = - setResultDataPtr(pResultInfo, pResultInfo->fields, pResultInfo->numOfCols, pResultInfo->numOfRows, convertUcs4); + setResultDataPtr(pResultInfo, convertUcs4); return code; } diff --git a/source/client/src/clientTmq.c b/source/client/src/clientTmq.c index fd6ca831d123..d8a67d62e234 100644 --- a/source/client/src/clientTmq.c +++ b/source/client/src/clientTmq.c @@ -2868,8 +2868,7 @@ int32_t tmqGetNextResInfo(TAOS_RES* res, bool convertUcs4, SReqResultInfo** pRes pRspObj->resInfo.precision = precision; pRspObj->resInfo.totalRows += pRspObj->resInfo.numOfRows; - int32_t code = setResultDataPtr(&pRspObj->resInfo, pRspObj->resInfo.fields, pRspObj->resInfo.numOfCols, - pRspObj->resInfo.numOfRows, convertUcs4); + int32_t code = setResultDataPtr(&pRspObj->resInfo, convertUcs4); if (code != 0) { return code; } From 161eb54b56d4b37c51086c93149f6d0d7d269b04 Mon Sep 17 00:00:00 2001 From: xsren <285808407@qq.com> Date: Thu, 17 Oct 2024 15:47:26 +0800 Subject: [PATCH 189/695] enh: setResultDataPtr safe check --- source/client/src/clientImpl.c | 42 ++++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 9 deletions(-) diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index 08dbe7af6f71..713c07e60f1d 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -2079,12 +2079,12 @@ static int32_t doPrepareResPtr(SReqResultInfo* pResInfo) { return TSDB_CODE_SUCCESS; } -static int32_t doConvertUCS4(SReqResultInfo* pResultInfo, int32_t numOfRows, int32_t numOfCols, int32_t* colLength) { +static int32_t doConvertUCS4(SReqResultInfo* pResultInfo, int32_t* colLength) { int32_t idx = -1; iconv_t conv = taosAcquireConv(&idx, C2M); if (conv == (iconv_t)-1) return TSDB_CODE_TSC_INTERNAL_ERROR; - for (int32_t i = 0; i < numOfCols; ++i) { + for (int32_t i = 0; i < pResultInfo->numOfCols; ++i) { int32_t type = pResultInfo->fields[i].type; int32_t bytes = pResultInfo->fields[i].bytes; @@ -2098,7 +2098,7 @@ static int32_t doConvertUCS4(SReqResultInfo* pResultInfo, int32_t numOfRows, int pResultInfo->convertBuf[i] = p; SResultColumn* pCol = &pResultInfo->pCol[i]; - for (int32_t j = 0; j < numOfRows; ++j) { + for (int32_t j = 0; j < pResultInfo->numOfRows; ++j) { if (pCol->offset[j] != -1) { char* pStart = pCol->offset[j] + pCol->pData; @@ -2131,10 +2131,13 @@ int32_t getVersion1BlockMetaSize(const char* p, int32_t numOfCols) { numOfCols * (sizeof(int8_t) + sizeof(int32_t)); } -static int32_t estimateJsonLen(SReqResultInfo* pResultInfo, int32_t numOfCols, int32_t numOfRows) { +static int32_t estimateJsonLen(SReqResultInfo* pResultInfo) { char* p = (char*)pResultInfo->pData; int32_t blockVersion = *(int32_t*)p; + int32_t numOfRows = pResultInfo->numOfRows; + int32_t numOfCols = pResultInfo->numOfCols; + // | version | total length | total rows | total columns | flag seg| block group id | column schema | each column // length | int32_t cols = *(int32_t*)(p + sizeof(int32_t) * 3); @@ -2196,7 +2199,9 @@ static int32_t estimateJsonLen(SReqResultInfo* pResultInfo, int32_t numOfCols, i return len; } -static int32_t doConvertJson(SReqResultInfo* pResultInfo, int32_t numOfCols, int32_t numOfRows) { +static int32_t doConvertJson(SReqResultInfo* pResultInfo) { + int32_t numOfRows = pResultInfo->numOfRows; + int32_t numOfCols = pResultInfo->numOfCols; bool needConvert = false; for (int32_t i = 0; i < numOfCols; ++i) { if (pResultInfo->fields[i].type == TSDB_DATA_TYPE_JSON) { @@ -2213,7 +2218,7 @@ static int32_t doConvertJson(SReqResultInfo* pResultInfo, int32_t numOfCols, int char* p = (char*)pResultInfo->pData; int32_t blockVersion = *(int32_t*)p; - int32_t dataLen = estimateJsonLen(pResultInfo, numOfCols, numOfRows); + int32_t dataLen = estimateJsonLen(pResultInfo); if (dataLen <= 0) { return TSDB_CODE_TSC_INTERNAL_ERROR; } @@ -2342,7 +2347,7 @@ static int32_t doConvertJson(SReqResultInfo* pResultInfo, int32_t numOfCols, int } int32_t setResultDataPtr(SReqResultInfo* pResultInfo, bool convertUcs4) { - if (pResultInfo->numOfCols <= 0 || pResultInfo->fields == NULL || pResultInfo == NULL) { + if (pResultInfo == NULL || pResultInfo->numOfCols <= 0 || pResultInfo->fields == NULL) { tscError("setResultDataPtr paras error"); return TSDB_CODE_TSC_INTERNAL_ERROR; } @@ -2351,11 +2356,16 @@ int32_t setResultDataPtr(SReqResultInfo* pResultInfo, bool convertUcs4) { return TSDB_CODE_SUCCESS; } + if (pResultInfo->pData == NULL) { + tscError("estimateJsonLen error: pData is NULL"); + return TSDB_CODE_TSC_INTERNAL_ERROR; + } + int32_t code = doPrepareResPtr(pResultInfo); if (code != TSDB_CODE_SUCCESS) { return code; } - code = doConvertJson(pResultInfo, pResultInfo->numOfCols, pResultInfo->numOfRows); + code = doConvertJson(pResultInfo); if (code != TSDB_CODE_SUCCESS) { return code; } @@ -2401,6 +2411,10 @@ int32_t setResultDataPtr(SReqResultInfo* pResultInfo, bool convertUcs4) { char* pStart = p; for (int32_t i = 0; i < pResultInfo->numOfCols; ++i) { + if ((pStart - pResultInfo->pData) >= dataLen) { + tscError("setResultDataPtr invalid offset over dataLen %d", dataLen); + return TSDB_CODE_TSC_INTERNAL_ERROR; + } if (blockVersion == BLOCK_VERSION_1) { colLength[i] = htonl(colLength[i]); } @@ -2424,11 +2438,17 @@ int32_t setResultDataPtr(SReqResultInfo* pResultInfo, bool convertUcs4) { pStart += colLength[i]; } + p = pStart; // bool blankFill = *(bool*)p; p += sizeof(bool); + int32_t offset = p - pResultInfo->pData; + if (offset > dataLen) { + tscError("invalid offset %d, dataLen %d", offset, dataLen); + return TSDB_CODE_TSC_INTERNAL_ERROR; + } if (convertUcs4) { - code = doConvertUCS4(pResultInfo, pResultInfo->numOfRows, pResultInfo->numOfCols, colLength); + code = doConvertUCS4(pResultInfo, colLength); } return code; @@ -2535,6 +2555,10 @@ int32_t setQueryResultFromRsp(SReqResultInfo* pResultInfo, const SRetrieveTableR return TSDB_CODE_TSC_INTERNAL_ERROR; } } + } else { + pResultInfo->pData = NULL; + pResultInfo->payloadLen = 0; + return TSDB_CODE_TSC_INTERNAL_ERROR; } // TODO handle the compressed case From bee96ce5e253ce0046bcb8a82cd8997e1c6b152e Mon Sep 17 00:00:00 2001 From: xsren <285808407@qq.com> Date: Thu, 17 Oct 2024 16:40:28 +0800 Subject: [PATCH 190/695] fix: payloadLen may be zero --- source/client/src/clientImpl.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index 713c07e60f1d..7c14359f641c 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -2555,10 +2555,6 @@ int32_t setQueryResultFromRsp(SReqResultInfo* pResultInfo, const SRetrieveTableR return TSDB_CODE_TSC_INTERNAL_ERROR; } } - } else { - pResultInfo->pData = NULL; - pResultInfo->payloadLen = 0; - return TSDB_CODE_TSC_INTERNAL_ERROR; } // TODO handle the compressed case From 04a9d67965b4bc9a7a7968b68244e1e67fe09271 Mon Sep 17 00:00:00 2001 From: xsren <285808407@qq.com> Date: Thu, 17 Oct 2024 17:39:11 +0800 Subject: [PATCH 191/695] enh: type check --- include/common/ttypes.h | 1 + source/client/src/clientImpl.c | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/include/common/ttypes.h b/include/common/ttypes.h index 3934553b1c06..0f0f30a1c3d3 100644 --- a/include/common/ttypes.h +++ b/include/common/ttypes.h @@ -284,6 +284,7 @@ typedef struct { #define IS_VALID_UINT64(_t) ((_t) >= 0 && (_t) <= UINT64_MAX) #define IS_VALID_FLOAT(_t) ((_t) >= -FLT_MAX && (_t) <= FLT_MAX) #define IS_VALID_DOUBLE(_t) ((_t) >= -DBL_MAX && (_t) <= DBL_MAX) +#define IS_INVALID_TYPE(_t) ((_t) < TSDB_DATA_TYPE_NULL || (_t) >= TSDB_DATA_TYPE_MAX) #define IS_CONVERT_AS_SIGNED(_t) \ (IS_SIGNED_NUMERIC_TYPE(_t) || (_t) == (TSDB_DATA_TYPE_BOOL) || (_t) == (TSDB_DATA_TYPE_TIMESTAMP)) diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index 7c14359f641c..4f268aa96e39 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -2346,6 +2346,16 @@ static int32_t doConvertJson(SReqResultInfo* pResultInfo) { return TSDB_CODE_SUCCESS; } +int32_t checkResultInfo(SReqResultInfo* pResultInfo) { + if (pResultInfo->totalRows < pResultInfo->numOfRows) { + tscError("checkResultInfo error: totalRows:%" PRId64 " < numOfRows:%" PRId64, pResultInfo->totalRows, + pResultInfo->numOfRows); + return TSDB_CODE_TSC_INTERNAL_ERROR; + } + + return TSDB_CODE_SUCCESS; +} + int32_t setResultDataPtr(SReqResultInfo* pResultInfo, bool convertUcs4) { if (pResultInfo == NULL || pResultInfo->numOfCols <= 0 || pResultInfo->fields == NULL) { tscError("setResultDataPtr paras error"); @@ -2422,7 +2432,10 @@ int32_t setResultDataPtr(SReqResultInfo* pResultInfo, bool convertUcs4) { tscError("invalid colLength %d, dataLen %d", colLength[i], dataLen); return TSDB_CODE_TSC_INTERNAL_ERROR; } - + if (IS_INVALID_TYPE(pResultInfo->fields[i].type)) { + tscError("invalid type %d", pResultInfo->fields[i].type); + return TSDB_CODE_TSC_INTERNAL_ERROR; + } if (IS_VAR_DATA_TYPE(pResultInfo->fields[i].type)) { pResultInfo->pCol[i].offset = (int32_t*)pStart; pStart += pResultInfo->numOfRows * sizeof(int32_t); @@ -2450,6 +2463,7 @@ int32_t setResultDataPtr(SReqResultInfo* pResultInfo, bool convertUcs4) { if (convertUcs4) { code = doConvertUCS4(pResultInfo, colLength); } + code = checkResultInfo(pResultInfo); return code; } From d8218b3872531b718c95a1191310f597e2dda92f Mon Sep 17 00:00:00 2001 From: xsren <285808407@qq.com> Date: Thu, 17 Oct 2024 19:05:23 +0800 Subject: [PATCH 192/695] fix: resultDataLen with json col --- source/client/src/clientImpl.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index 4f268aa96e39..d8c01ee17c3e 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -2196,6 +2196,10 @@ static int32_t estimateJsonLen(SReqResultInfo* pResultInfo) { } pStart += colLen; } + + // Ensure the complete structure of the block, including the blankfill field, + // even though it is not used on the client side. + len += sizeof(bool); return len; } @@ -2341,6 +2345,11 @@ static int32_t doConvertJson(SReqResultInfo* pResultInfo) { pStart1 += colLen1; } + // Ensure the complete structure of the block, including the blankfill field, + // even though it is not used on the client side. + // (void)memcpy(pStart1, pStart, sizeof(bool)); + totalLen += sizeof(bool); + *(int32_t*)(pResultInfo->convertJson + 4) = totalLen; pResultInfo->pData = pResultInfo->convertJson; return TSDB_CODE_SUCCESS; @@ -2367,7 +2376,7 @@ int32_t setResultDataPtr(SReqResultInfo* pResultInfo, bool convertUcs4) { } if (pResultInfo->pData == NULL) { - tscError("estimateJsonLen error: pData is NULL"); + tscError("setResultDataPtr error: pData is NULL"); return TSDB_CODE_TSC_INTERNAL_ERROR; } From d01a3481bca8a3e8bbcfc6da5ec08570a719314e Mon Sep 17 00:00:00 2001 From: xsren <285808407@qq.com> Date: Fri, 18 Oct 2024 16:16:57 +0800 Subject: [PATCH 193/695] block buf len check --- include/common/tdatablock.h | 2 +- source/client/src/clientImpl.c | 14 ++++++++++++-- source/client/src/clientMsgHandler.c | 10 ++++++---- source/common/src/tdatablock.c | 13 ++++++++++++- source/dnode/mgmt/mgmt_dnode/src/dmHandle.c | 6 +++--- source/dnode/mnode/impl/src/mndShow.c | 6 +++--- source/dnode/vnode/src/tq/tqScan.c | 5 +++-- source/libs/command/src/command.c | 5 +++-- source/libs/command/src/explain.c | 5 +++-- source/libs/executor/src/dataDispatcher.c | 13 +++++++------ source/libs/stream/src/streamDispatch.c | 10 ++++++---- 11 files changed, 59 insertions(+), 30 deletions(-) diff --git a/include/common/tdatablock.h b/include/common/tdatablock.h index 99cdb5310377..c6f0b4d51778 100644 --- a/include/common/tdatablock.h +++ b/include/common/tdatablock.h @@ -266,7 +266,7 @@ SColumnInfoData createColumnInfoData(int16_t type, int32_t bytes, int16_t colId) int32_t bdGetColumnInfoData(const SSDataBlock* pBlock, int32_t index, SColumnInfoData** pColInfoData); int32_t blockGetEncodeSize(const SSDataBlock* pBlock); -int32_t blockEncode(const SSDataBlock* pBlock, char* data, int32_t numOfCols); +int32_t blockEncode(const SSDataBlock* pBlock, char* data, size_t dataLen, int32_t numOfCols); int32_t blockDecode(SSDataBlock* pBlock, const char* pData, const char** pEndPos); // for debug diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index d8c01ee17c3e..69b6fe312c47 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -2355,12 +2355,22 @@ static int32_t doConvertJson(SReqResultInfo* pResultInfo) { return TSDB_CODE_SUCCESS; } -int32_t checkResultInfo(SReqResultInfo* pResultInfo) { +int32_t resultInfoSafeCheck(SReqResultInfo* pResultInfo) { if (pResultInfo->totalRows < pResultInfo->numOfRows) { tscError("checkResultInfo error: totalRows:%" PRId64 " < numOfRows:%" PRId64, pResultInfo->totalRows, pResultInfo->numOfRows); return TSDB_CODE_TSC_INTERNAL_ERROR; } + for (int32_t i = 0; i < pResultInfo->numOfCols; ++i) { + if (pResultInfo->fields[i].bytes <= 0) { + tscError("checkResultInfo error: bytes:%d <= 0", pResultInfo->fields[i].bytes); + return TSDB_CODE_TSC_INTERNAL_ERROR; + } + if(!IS_VAR_DATA_TYPE(pResultInfo->fields[i].type) && TYPE_BYTES[pResultInfo->fields[i].type] != pResultInfo->fields[i].bytes) { + tscError("checkResultInfo error: type:%d bytes:%d != %d", pResultInfo->fields[i].type, pResultInfo->fields[i].bytes, TYPE_BYTES[pResultInfo->fields[i].type]); + return TSDB_CODE_TSC_INTERNAL_ERROR; + } + } return TSDB_CODE_SUCCESS; } @@ -2472,7 +2482,7 @@ int32_t setResultDataPtr(SReqResultInfo* pResultInfo, bool convertUcs4) { if (convertUcs4) { code = doConvertUCS4(pResultInfo, colLength); } - code = checkResultInfo(pResultInfo); + code = resultInfoSafeCheck(pResultInfo); return code; } diff --git a/source/client/src/clientMsgHandler.c b/source/client/src/clientMsgHandler.c index aef3cef1c5d0..f8a0f384deb3 100644 --- a/source/client/src/clientMsgHandler.c +++ b/source/client/src/clientMsgHandler.c @@ -588,7 +588,8 @@ static int32_t buildShowVariablesRsp(SArray* pVars, SRetrieveTableRsp** pRsp) { return code; } - size_t rspSize = sizeof(SRetrieveTableRsp) + blockGetEncodeSize(pBlock) + PAYLOAD_PREFIX_LEN; + size_t dataEncodeSize = blockGetEncodeSize(pBlock); + size_t rspSize = sizeof(SRetrieveTableRsp) + dataEncodeSize + PAYLOAD_PREFIX_LEN; *pRsp = taosMemoryCalloc(1, rspSize); if (NULL == *pRsp) { code = terrno; @@ -603,7 +604,7 @@ static int32_t buildShowVariablesRsp(SArray* pVars, SRetrieveTableRsp** pRsp) { (*pRsp)->numOfRows = htobe64((int64_t)pBlock->info.rows); (*pRsp)->numOfCols = htonl(SHOW_VARIABLES_RESULT_COLS); - int32_t len = blockEncode(pBlock, (*pRsp)->data + PAYLOAD_PREFIX_LEN, SHOW_VARIABLES_RESULT_COLS); + int32_t len = blockEncode(pBlock, (*pRsp)->data + PAYLOAD_PREFIX_LEN, dataEncodeSize, SHOW_VARIABLES_RESULT_COLS); if(len < 0) { uError("buildShowVariablesRsp error, len:%d", len); code = terrno; @@ -741,7 +742,8 @@ static int32_t buildRetriveTableRspForCompactDb(SCompactDbRsp* pCompactDb, SRetr return code; } - size_t rspSize = sizeof(SRetrieveTableRsp) + blockGetEncodeSize(pBlock) + PAYLOAD_PREFIX_LEN; + size_t dataEncodeSize = blockGetEncodeSize(pBlock); + size_t rspSize = sizeof(SRetrieveTableRsp) + dataEncodeSize + PAYLOAD_PREFIX_LEN; *pRsp = taosMemoryCalloc(1, rspSize); if (NULL == *pRsp) { code = terrno; @@ -757,7 +759,7 @@ static int32_t buildRetriveTableRspForCompactDb(SCompactDbRsp* pCompactDb, SRetr (*pRsp)->numOfRows = htobe64((int64_t)pBlock->info.rows); (*pRsp)->numOfCols = htonl(COMPACT_DB_RESULT_COLS); - int32_t len = blockEncode(pBlock, (*pRsp)->data + PAYLOAD_PREFIX_LEN, COMPACT_DB_RESULT_COLS); + int32_t len = blockEncode(pBlock, (*pRsp)->data + PAYLOAD_PREFIX_LEN, dataEncodeSize, COMPACT_DB_RESULT_COLS); if(len < 0) { uError("buildRetriveTableRspForCompactDb error, len:%d", len); code = terrno; diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c index 60d1f34cf7fb..2da83a6b7477 100644 --- a/source/common/src/tdatablock.c +++ b/source/common/src/tdatablock.c @@ -3041,7 +3041,7 @@ int32_t buildCtbNameByGroupIdImpl(const char* stbFullName, uint64_t groupId, cha } // return length of encoded data, return -1 if failed -int32_t blockEncode(const SSDataBlock* pBlock, char* data, int32_t numOfCols) { +int32_t blockEncode(const SSDataBlock* pBlock, char* data, size_t dataBuflen, int32_t numOfCols) { blockDataCheck(pBlock, false); int32_t dataLen = 0; @@ -3106,9 +3106,11 @@ int32_t blockEncode(const SSDataBlock* pBlock, char* data, int32_t numOfCols) { size_t metaSize = 0; if (IS_VAR_DATA_TYPE(pColRes->info.type)) { metaSize = numOfRows * sizeof(int32_t); + if(dataLen + metaSize > dataBuflen) goto _exit; memcpy(data, pColRes->varmeta.offset, metaSize); } else { metaSize = BitmapLen(numOfRows); + if(dataLen + metaSize > dataBuflen) goto _exit; memcpy(data, pColRes->nullbitmap, metaSize); } @@ -3127,12 +3129,14 @@ int32_t blockEncode(const SSDataBlock* pBlock, char* data, int32_t numOfCols) { } colSizes[col] += colSize; dataLen += colSize; + if(dataLen > dataBuflen) goto _exit; (void) memmove(data, pColData, colSize); data += colSize; } } else { colSizes[col] = colDataGetLength(pColRes, numOfRows); dataLen += colSizes[col]; + if(dataLen > dataBuflen) goto _exit; if (pColRes->pData != NULL) { (void) memmove(data, pColRes->pData, colSizes[col]); } @@ -3156,7 +3160,14 @@ int32_t blockEncode(const SSDataBlock* pBlock, char* data, int32_t numOfCols) { *actualLen = dataLen; *groupId = pBlock->info.id.groupId; + if (dataLen > dataBuflen) goto _exit; + return dataLen; + +_exit: + uError("blockEncode dataLen:%d, dataBuflen:%" PRIx64, dataLen, dataBuflen); + terrno = TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR; + return -1; } int32_t blockDecode(SSDataBlock* pBlock, const char* pData, const char** pEndPos) { diff --git a/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c b/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c index 1446faab77c9..0f3f42acb97f 100644 --- a/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c +++ b/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c @@ -548,8 +548,8 @@ int32_t dmProcessRetrieve(SDnodeMgmt *pMgmt, SRpcMsg *pMsg) { } size_t numOfCols = taosArrayGetSize(pBlock->pDataBlock); - size = sizeof(SRetrieveMetaTableRsp) + sizeof(int32_t) + sizeof(SSysTableSchema) * numOfCols + - blockDataGetSize(pBlock) + blockDataGetSerialMetaSize(numOfCols); + size_t dataEncodeSize = blockGetEncodeSize(pBlock); + size = sizeof(SRetrieveMetaTableRsp) + sizeof(int32_t) + sizeof(SSysTableSchema) * numOfCols + dataEncodeSize; SRetrieveMetaTableRsp *pRsp = rpcMallocCont(size); if (pRsp == NULL) { @@ -574,7 +574,7 @@ int32_t dmProcessRetrieve(SDnodeMgmt *pMgmt, SRpcMsg *pMsg) { pStart += sizeof(SSysTableSchema); } - int32_t len = blockEncode(pBlock, pStart, numOfCols); + int32_t len = blockEncode(pBlock, pStart, dataEncodeSize, numOfCols); if (len < 0) { dError("failed to retrieve data since %s", tstrerror(code)); blockDataDestroy(pBlock); diff --git a/source/dnode/mnode/impl/src/mndShow.c b/source/dnode/mnode/impl/src/mndShow.c index 264fea3476b0..01dc329d041b 100644 --- a/source/dnode/mnode/impl/src/mndShow.c +++ b/source/dnode/mnode/impl/src/mndShow.c @@ -333,8 +333,8 @@ static int32_t mndProcessRetrieveSysTableReq(SRpcMsg *pReq) { mDebug("show:0x%" PRIx64 ", stop retrieve data, rowsRead:%d numOfRows:%d", pShow->id, rowsRead, pShow->numOfRows); } - size = sizeof(SRetrieveMetaTableRsp) + sizeof(int32_t) + sizeof(SSysTableSchema) * pShow->pMeta->numOfColumns + - blockDataGetSize(pBlock) + blockDataGetSerialMetaSize(taosArrayGetSize(pBlock->pDataBlock)); + size_t dataEncodeSize = blockGetEncodeSize(pBlock); + size = sizeof(SRetrieveMetaTableRsp) + sizeof(int32_t) + sizeof(SSysTableSchema) * pShow->pMeta->numOfColumns + dataEncodeSize; SRetrieveMetaTableRsp *pRsp = rpcMallocCont(size); if (pRsp == NULL) { @@ -361,7 +361,7 @@ static int32_t mndProcessRetrieveSysTableReq(SRpcMsg *pReq) { pStart += sizeof(SSysTableSchema); } - int32_t len = blockEncode(pBlock, pStart, pShow->pMeta->numOfColumns); + int32_t len = blockEncode(pBlock, pStart, dataEncodeSize, pShow->pMeta->numOfColumns); if(len < 0){ mError("show:0x%" PRIx64 ", failed to retrieve data since %s", pShow->id, tstrerror(code)); code = terrno; diff --git a/source/dnode/vnode/src/tq/tqScan.c b/source/dnode/vnode/src/tq/tqScan.c index dbc1b16cf571..5632297a2b88 100644 --- a/source/dnode/vnode/src/tq/tqScan.c +++ b/source/dnode/vnode/src/tq/tqScan.c @@ -16,7 +16,8 @@ #include "tq.h" int32_t tqAddBlockDataToRsp(const SSDataBlock* pBlock, SMqDataRsp* pRsp, int32_t numOfCols, int8_t precision) { - int32_t dataStrLen = sizeof(SRetrieveTableRspForTmq) + blockGetEncodeSize(pBlock); + size_t dataEncodeSize = blockGetEncodeSize(pBlock); + int32_t dataStrLen = sizeof(SRetrieveTableRspForTmq) + dataEncodeSize; void* buf = taosMemoryCalloc(1, dataStrLen); if (buf == NULL) { return terrno; @@ -28,7 +29,7 @@ int32_t tqAddBlockDataToRsp(const SSDataBlock* pBlock, SMqDataRsp* pRsp, int32_t pRetrieve->compressed = 0; pRetrieve->numOfRows = htobe64((int64_t)pBlock->info.rows); - int32_t actualLen = blockEncode(pBlock, pRetrieve->data, numOfCols); + int32_t actualLen = blockEncode(pBlock, pRetrieve->data, dataEncodeSize, numOfCols); if(actualLen < 0){ taosMemoryFree(buf); return terrno; diff --git a/source/libs/command/src/command.c b/source/libs/command/src/command.c index b2417a8597f2..db3e553c7a0c 100644 --- a/source/libs/command/src/command.c +++ b/source/libs/command/src/command.c @@ -35,7 +35,8 @@ extern SConfig* tsCfg; static int32_t buildRetrieveTableRsp(SSDataBlock* pBlock, int32_t numOfCols, SRetrieveTableRsp** pRsp) { - size_t rspSize = sizeof(SRetrieveTableRsp) + blockGetEncodeSize(pBlock) + PAYLOAD_PREFIX_LEN; + size_t dataEncodeSize = blockGetEncodeSize(pBlock); + size_t rspSize = sizeof(SRetrieveTableRsp) + dataEncodeSize + PAYLOAD_PREFIX_LEN; *pRsp = taosMemoryCalloc(1, rspSize); if (NULL == *pRsp) { return terrno; @@ -49,7 +50,7 @@ static int32_t buildRetrieveTableRsp(SSDataBlock* pBlock, int32_t numOfCols, SRe (*pRsp)->numOfRows = htobe64((int64_t)pBlock->info.rows); (*pRsp)->numOfCols = htonl(numOfCols); - int32_t len = blockEncode(pBlock, (*pRsp)->data + PAYLOAD_PREFIX_LEN, numOfCols); + int32_t len = blockEncode(pBlock, (*pRsp)->data + PAYLOAD_PREFIX_LEN, dataEncodeSize, numOfCols); if(len < 0) { taosMemoryFree(*pRsp); return terrno; diff --git a/source/libs/command/src/explain.c b/source/libs/command/src/explain.c index b82bba250f07..4f4f67caf7a8 100644 --- a/source/libs/command/src/explain.c +++ b/source/libs/command/src/explain.c @@ -1966,7 +1966,8 @@ int32_t qExplainGetRspFromCtx(void *ctx, SRetrieveTableRsp **pRsp) { pBlock->info.rows = rowNum; - int32_t rspSize = sizeof(SRetrieveTableRsp) + blockGetEncodeSize(pBlock) + PAYLOAD_PREFIX_LEN; + size_t dataEncodeSize = blockGetEncodeSize(pBlock); + int32_t rspSize = sizeof(SRetrieveTableRsp) + dataEncodeSize + PAYLOAD_PREFIX_LEN; SRetrieveTableRsp *rsp = (SRetrieveTableRsp *)taosMemoryCalloc(1, rspSize); if (NULL == rsp) { @@ -1977,7 +1978,7 @@ int32_t qExplainGetRspFromCtx(void *ctx, SRetrieveTableRsp **pRsp) { rsp->completed = 1; rsp->numOfRows = htobe64((int64_t)rowNum); - int32_t len = blockEncode(pBlock, rsp->data + PAYLOAD_PREFIX_LEN, taosArrayGetSize(pBlock->pDataBlock)); + int32_t len = blockEncode(pBlock, rsp->data + PAYLOAD_PREFIX_LEN, dataEncodeSize, taosArrayGetSize(pBlock->pDataBlock)); if(len < 0) { qError("qExplainGetRspFromCtx: blockEncode failed"); QRY_ERR_JRET(terrno); diff --git a/source/libs/executor/src/dataDispatcher.c b/source/libs/executor/src/dataDispatcher.c index 8acd569358a8..8ab1558172f1 100644 --- a/source/libs/executor/src/dataDispatcher.c +++ b/source/libs/executor/src/dataDispatcher.c @@ -84,17 +84,18 @@ static int32_t toDataCacheEntry(SDataDispatchHandle* pHandle, const SInputData* pBuf->useSize = sizeof(SDataCacheEntry); { + size_t dataEncodeSize = pBuf->allocSize + 8; if ((pBuf->allocSize > tsCompressMsgSize) && (tsCompressMsgSize > 0) && pHandle->pManager->cfg.compress) { if (pHandle->pCompressBuf == NULL) { // allocate additional 8 bytes to avoid invalid write if compress failed to reduce the size - pHandle->pCompressBuf = taosMemoryMalloc(pBuf->allocSize + 8); + pHandle->pCompressBuf = taosMemoryMalloc(dataEncodeSize); if (NULL == pHandle->pCompressBuf) { QRY_RET(terrno); } - pHandle->bufSize = pBuf->allocSize + 8; + pHandle->bufSize = dataEncodeSize; } else { - if (pHandle->bufSize < pBuf->allocSize + 8) { - pHandle->bufSize = pBuf->allocSize + 8; + if (pHandle->bufSize < dataEncodeSize) { + pHandle->bufSize = dataEncodeSize; void* p = taosMemoryRealloc(pHandle->pCompressBuf, pHandle->bufSize); if (p != NULL) { pHandle->pCompressBuf = p; @@ -105,7 +106,7 @@ static int32_t toDataCacheEntry(SDataDispatchHandle* pHandle, const SInputData* } } - int32_t dataLen = blockEncode(pInput->pData, pHandle->pCompressBuf, numOfCols); + int32_t dataLen = blockEncode(pInput->pData, pHandle->pCompressBuf, dataEncodeSize, numOfCols); if(dataLen < 0) { qError("failed to encode data block, code: %d", dataLen); return terrno; @@ -123,7 +124,7 @@ static int32_t toDataCacheEntry(SDataDispatchHandle* pHandle, const SInputData* TAOS_MEMCPY(pEntry->data, pHandle->pCompressBuf, dataLen); } } else { - pEntry->dataLen = blockEncode(pInput->pData, pEntry->data, numOfCols); + pEntry->dataLen = blockEncode(pInput->pData, pEntry->data, dataEncodeSize, numOfCols); if(pEntry->dataLen < 0) { qError("failed to encode data block, code: %d", pEntry->dataLen); return terrno; diff --git a/source/libs/stream/src/streamDispatch.c b/source/libs/stream/src/streamDispatch.c index 62d60ff66427..2b91f0f80630 100644 --- a/source/libs/stream/src/streamDispatch.c +++ b/source/libs/stream/src/streamDispatch.c @@ -145,7 +145,8 @@ int32_t streamTaskBroadcastRetrieveReq(SStreamTask* pTask, SStreamRetrieveReq* r static int32_t buildStreamRetrieveReq(SStreamTask* pTask, const SSDataBlock* pBlock, SStreamRetrieveReq* req) { SRetrieveTableRsp* pRetrieve = NULL; - int32_t len = sizeof(SRetrieveTableRsp) + blockGetEncodeSize(pBlock) + PAYLOAD_PREFIX_LEN; + size_t dataEncodeSize = blockGetEncodeSize(pBlock); + int32_t len = sizeof(SRetrieveTableRsp) + dataEncodeSize + PAYLOAD_PREFIX_LEN; pRetrieve = taosMemoryCalloc(1, len); if (pRetrieve == NULL) return terrno; @@ -162,7 +163,7 @@ static int32_t buildStreamRetrieveReq(SStreamTask* pTask, const SSDataBlock* pBl pRetrieve->ekey = htobe64(pBlock->info.window.ekey); pRetrieve->version = htobe64(pBlock->info.version); - int32_t actualLen = blockEncode(pBlock, pRetrieve->data + PAYLOAD_PREFIX_LEN, numOfCols); + int32_t actualLen = blockEncode(pBlock, pRetrieve->data + PAYLOAD_PREFIX_LEN, dataEncodeSize, numOfCols); if (actualLen < 0) { taosMemoryFree(pRetrieve); return terrno; @@ -1203,7 +1204,8 @@ int32_t streamTaskSendCheckpointSourceRsp(SStreamTask* pTask) { } int32_t streamAddBlockIntoDispatchMsg(const SSDataBlock* pBlock, SStreamDispatchReq* pReq) { - int32_t dataStrLen = sizeof(SRetrieveTableRsp) + blockGetEncodeSize(pBlock) + PAYLOAD_PREFIX_LEN; + size_t dataEncodeSize = blockGetEncodeSize(pBlock); + int32_t dataStrLen = sizeof(SRetrieveTableRsp) + dataEncodeSize + PAYLOAD_PREFIX_LEN; void* buf = taosMemoryCalloc(1, dataStrLen); if (buf == NULL) { return terrno; @@ -1225,7 +1227,7 @@ int32_t streamAddBlockIntoDispatchMsg(const SSDataBlock* pBlock, SStreamDispatch int32_t numOfCols = (int32_t)taosArrayGetSize(pBlock->pDataBlock); pRetrieve->numOfCols = htonl(numOfCols); - int32_t actualLen = blockEncode(pBlock, pRetrieve->data + PAYLOAD_PREFIX_LEN, numOfCols); + int32_t actualLen = blockEncode(pBlock, pRetrieve->data + PAYLOAD_PREFIX_LEN, dataEncodeSize, numOfCols); if (actualLen < 0) { taosMemoryFree(buf); return terrno; From f35d2847b91388ace4baa16d3aacfd44167f6115 Mon Sep 17 00:00:00 2001 From: xsren <285808407@qq.com> Date: Sun, 20 Oct 2024 22:17:16 +0800 Subject: [PATCH 194/695] enh: blockencode --- source/client/src/clientMsgHandler.c | 12 ++++++------ source/dnode/mgmt/mgmt_dnode/src/dmHandle.c | 6 +++--- source/dnode/mnode/impl/src/mndShow.c | 6 +++--- source/dnode/vnode/src/tq/tqScan.c | 6 +++--- source/libs/command/src/command.c | 6 +++--- source/libs/command/src/explain.c | 6 +++--- source/libs/executor/src/dataDispatcher.c | 14 +++++++------- 7 files changed, 28 insertions(+), 28 deletions(-) diff --git a/source/client/src/clientMsgHandler.c b/source/client/src/clientMsgHandler.c index f8a0f384deb3..099a224f858d 100644 --- a/source/client/src/clientMsgHandler.c +++ b/source/client/src/clientMsgHandler.c @@ -588,8 +588,8 @@ static int32_t buildShowVariablesRsp(SArray* pVars, SRetrieveTableRsp** pRsp) { return code; } - size_t dataEncodeSize = blockGetEncodeSize(pBlock); - size_t rspSize = sizeof(SRetrieveTableRsp) + dataEncodeSize + PAYLOAD_PREFIX_LEN; + size_t dataEncodeBufSize = blockGetEncodeSize(pBlock); + size_t rspSize = sizeof(SRetrieveTableRsp) + dataEncodeBufSize + PAYLOAD_PREFIX_LEN; *pRsp = taosMemoryCalloc(1, rspSize); if (NULL == *pRsp) { code = terrno; @@ -604,7 +604,7 @@ static int32_t buildShowVariablesRsp(SArray* pVars, SRetrieveTableRsp** pRsp) { (*pRsp)->numOfRows = htobe64((int64_t)pBlock->info.rows); (*pRsp)->numOfCols = htonl(SHOW_VARIABLES_RESULT_COLS); - int32_t len = blockEncode(pBlock, (*pRsp)->data + PAYLOAD_PREFIX_LEN, dataEncodeSize, SHOW_VARIABLES_RESULT_COLS); + int32_t len = blockEncode(pBlock, (*pRsp)->data + PAYLOAD_PREFIX_LEN, dataEncodeBufSize, SHOW_VARIABLES_RESULT_COLS); if(len < 0) { uError("buildShowVariablesRsp error, len:%d", len); code = terrno; @@ -742,8 +742,8 @@ static int32_t buildRetriveTableRspForCompactDb(SCompactDbRsp* pCompactDb, SRetr return code; } - size_t dataEncodeSize = blockGetEncodeSize(pBlock); - size_t rspSize = sizeof(SRetrieveTableRsp) + dataEncodeSize + PAYLOAD_PREFIX_LEN; + size_t dataEncodeBufSize = blockGetEncodeSize(pBlock); + size_t rspSize = sizeof(SRetrieveTableRsp) + dataEncodeBufSize + PAYLOAD_PREFIX_LEN; *pRsp = taosMemoryCalloc(1, rspSize); if (NULL == *pRsp) { code = terrno; @@ -759,7 +759,7 @@ static int32_t buildRetriveTableRspForCompactDb(SCompactDbRsp* pCompactDb, SRetr (*pRsp)->numOfRows = htobe64((int64_t)pBlock->info.rows); (*pRsp)->numOfCols = htonl(COMPACT_DB_RESULT_COLS); - int32_t len = blockEncode(pBlock, (*pRsp)->data + PAYLOAD_PREFIX_LEN, dataEncodeSize, COMPACT_DB_RESULT_COLS); + int32_t len = blockEncode(pBlock, (*pRsp)->data + PAYLOAD_PREFIX_LEN, dataEncodeBufSize, COMPACT_DB_RESULT_COLS); if(len < 0) { uError("buildRetriveTableRspForCompactDb error, len:%d", len); code = terrno; diff --git a/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c b/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c index 0f3f42acb97f..d6b792ca74bd 100644 --- a/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c +++ b/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c @@ -548,8 +548,8 @@ int32_t dmProcessRetrieve(SDnodeMgmt *pMgmt, SRpcMsg *pMsg) { } size_t numOfCols = taosArrayGetSize(pBlock->pDataBlock); - size_t dataEncodeSize = blockGetEncodeSize(pBlock); - size = sizeof(SRetrieveMetaTableRsp) + sizeof(int32_t) + sizeof(SSysTableSchema) * numOfCols + dataEncodeSize; + size_t dataEncodeBufSize = blockGetEncodeSize(pBlock); + size = sizeof(SRetrieveMetaTableRsp) + sizeof(int32_t) + sizeof(SSysTableSchema) * numOfCols + dataEncodeBufSize; SRetrieveMetaTableRsp *pRsp = rpcMallocCont(size); if (pRsp == NULL) { @@ -574,7 +574,7 @@ int32_t dmProcessRetrieve(SDnodeMgmt *pMgmt, SRpcMsg *pMsg) { pStart += sizeof(SSysTableSchema); } - int32_t len = blockEncode(pBlock, pStart, dataEncodeSize, numOfCols); + int32_t len = blockEncode(pBlock, pStart, dataEncodeBufSize, numOfCols); if (len < 0) { dError("failed to retrieve data since %s", tstrerror(code)); blockDataDestroy(pBlock); diff --git a/source/dnode/mnode/impl/src/mndShow.c b/source/dnode/mnode/impl/src/mndShow.c index 01dc329d041b..29f6c32dbe68 100644 --- a/source/dnode/mnode/impl/src/mndShow.c +++ b/source/dnode/mnode/impl/src/mndShow.c @@ -333,8 +333,8 @@ static int32_t mndProcessRetrieveSysTableReq(SRpcMsg *pReq) { mDebug("show:0x%" PRIx64 ", stop retrieve data, rowsRead:%d numOfRows:%d", pShow->id, rowsRead, pShow->numOfRows); } - size_t dataEncodeSize = blockGetEncodeSize(pBlock); - size = sizeof(SRetrieveMetaTableRsp) + sizeof(int32_t) + sizeof(SSysTableSchema) * pShow->pMeta->numOfColumns + dataEncodeSize; + size_t dataEncodeBufSize = blockGetEncodeSize(pBlock); + size = sizeof(SRetrieveMetaTableRsp) + sizeof(int32_t) + sizeof(SSysTableSchema) * pShow->pMeta->numOfColumns + dataEncodeBufSize; SRetrieveMetaTableRsp *pRsp = rpcMallocCont(size); if (pRsp == NULL) { @@ -361,7 +361,7 @@ static int32_t mndProcessRetrieveSysTableReq(SRpcMsg *pReq) { pStart += sizeof(SSysTableSchema); } - int32_t len = blockEncode(pBlock, pStart, dataEncodeSize, pShow->pMeta->numOfColumns); + int32_t len = blockEncode(pBlock, pStart, dataEncodeBufSize, pShow->pMeta->numOfColumns); if(len < 0){ mError("show:0x%" PRIx64 ", failed to retrieve data since %s", pShow->id, tstrerror(code)); code = terrno; diff --git a/source/dnode/vnode/src/tq/tqScan.c b/source/dnode/vnode/src/tq/tqScan.c index 5632297a2b88..14cf41f1f921 100644 --- a/source/dnode/vnode/src/tq/tqScan.c +++ b/source/dnode/vnode/src/tq/tqScan.c @@ -16,8 +16,8 @@ #include "tq.h" int32_t tqAddBlockDataToRsp(const SSDataBlock* pBlock, SMqDataRsp* pRsp, int32_t numOfCols, int8_t precision) { - size_t dataEncodeSize = blockGetEncodeSize(pBlock); - int32_t dataStrLen = sizeof(SRetrieveTableRspForTmq) + dataEncodeSize; + size_t dataEncodeBufSize = blockGetEncodeSize(pBlock); + int32_t dataStrLen = sizeof(SRetrieveTableRspForTmq) + dataEncodeBufSize; void* buf = taosMemoryCalloc(1, dataStrLen); if (buf == NULL) { return terrno; @@ -29,7 +29,7 @@ int32_t tqAddBlockDataToRsp(const SSDataBlock* pBlock, SMqDataRsp* pRsp, int32_t pRetrieve->compressed = 0; pRetrieve->numOfRows = htobe64((int64_t)pBlock->info.rows); - int32_t actualLen = blockEncode(pBlock, pRetrieve->data, dataEncodeSize, numOfCols); + int32_t actualLen = blockEncode(pBlock, pRetrieve->data, dataEncodeBufSize, numOfCols); if(actualLen < 0){ taosMemoryFree(buf); return terrno; diff --git a/source/libs/command/src/command.c b/source/libs/command/src/command.c index db3e553c7a0c..471a079e4c21 100644 --- a/source/libs/command/src/command.c +++ b/source/libs/command/src/command.c @@ -35,8 +35,8 @@ extern SConfig* tsCfg; static int32_t buildRetrieveTableRsp(SSDataBlock* pBlock, int32_t numOfCols, SRetrieveTableRsp** pRsp) { - size_t dataEncodeSize = blockGetEncodeSize(pBlock); - size_t rspSize = sizeof(SRetrieveTableRsp) + dataEncodeSize + PAYLOAD_PREFIX_LEN; + size_t dataEncodeBufSize = blockGetEncodeSize(pBlock); + size_t rspSize = sizeof(SRetrieveTableRsp) + dataEncodeBufSize + PAYLOAD_PREFIX_LEN; *pRsp = taosMemoryCalloc(1, rspSize); if (NULL == *pRsp) { return terrno; @@ -50,7 +50,7 @@ static int32_t buildRetrieveTableRsp(SSDataBlock* pBlock, int32_t numOfCols, SRe (*pRsp)->numOfRows = htobe64((int64_t)pBlock->info.rows); (*pRsp)->numOfCols = htonl(numOfCols); - int32_t len = blockEncode(pBlock, (*pRsp)->data + PAYLOAD_PREFIX_LEN, dataEncodeSize, numOfCols); + int32_t len = blockEncode(pBlock, (*pRsp)->data + PAYLOAD_PREFIX_LEN, dataEncodeBufSize, numOfCols); if(len < 0) { taosMemoryFree(*pRsp); return terrno; diff --git a/source/libs/command/src/explain.c b/source/libs/command/src/explain.c index 4f4f67caf7a8..42c214fac73a 100644 --- a/source/libs/command/src/explain.c +++ b/source/libs/command/src/explain.c @@ -1966,8 +1966,8 @@ int32_t qExplainGetRspFromCtx(void *ctx, SRetrieveTableRsp **pRsp) { pBlock->info.rows = rowNum; - size_t dataEncodeSize = blockGetEncodeSize(pBlock); - int32_t rspSize = sizeof(SRetrieveTableRsp) + dataEncodeSize + PAYLOAD_PREFIX_LEN; + size_t dataEncodeBufSize = blockGetEncodeSize(pBlock); + int32_t rspSize = sizeof(SRetrieveTableRsp) + dataEncodeBufSize + PAYLOAD_PREFIX_LEN; SRetrieveTableRsp *rsp = (SRetrieveTableRsp *)taosMemoryCalloc(1, rspSize); if (NULL == rsp) { @@ -1978,7 +1978,7 @@ int32_t qExplainGetRspFromCtx(void *ctx, SRetrieveTableRsp **pRsp) { rsp->completed = 1; rsp->numOfRows = htobe64((int64_t)rowNum); - int32_t len = blockEncode(pBlock, rsp->data + PAYLOAD_PREFIX_LEN, dataEncodeSize, taosArrayGetSize(pBlock->pDataBlock)); + int32_t len = blockEncode(pBlock, rsp->data + PAYLOAD_PREFIX_LEN, dataEncodeBufSize, taosArrayGetSize(pBlock->pDataBlock)); if(len < 0) { qError("qExplainGetRspFromCtx: blockEncode failed"); QRY_ERR_JRET(terrno); diff --git a/source/libs/executor/src/dataDispatcher.c b/source/libs/executor/src/dataDispatcher.c index 8ab1558172f1..b9fbf06ef639 100644 --- a/source/libs/executor/src/dataDispatcher.c +++ b/source/libs/executor/src/dataDispatcher.c @@ -84,18 +84,18 @@ static int32_t toDataCacheEntry(SDataDispatchHandle* pHandle, const SInputData* pBuf->useSize = sizeof(SDataCacheEntry); { - size_t dataEncodeSize = pBuf->allocSize + 8; + size_t dataEncodeBufSize = pBuf->allocSize + 8; if ((pBuf->allocSize > tsCompressMsgSize) && (tsCompressMsgSize > 0) && pHandle->pManager->cfg.compress) { if (pHandle->pCompressBuf == NULL) { // allocate additional 8 bytes to avoid invalid write if compress failed to reduce the size - pHandle->pCompressBuf = taosMemoryMalloc(dataEncodeSize); + pHandle->pCompressBuf = taosMemoryMalloc(dataEncodeBufSize); if (NULL == pHandle->pCompressBuf) { QRY_RET(terrno); } - pHandle->bufSize = dataEncodeSize; + pHandle->bufSize = dataEncodeBufSize; } else { - if (pHandle->bufSize < dataEncodeSize) { - pHandle->bufSize = dataEncodeSize; + if (pHandle->bufSize < dataEncodeBufSize) { + pHandle->bufSize = dataEncodeBufSize; void* p = taosMemoryRealloc(pHandle->pCompressBuf, pHandle->bufSize); if (p != NULL) { pHandle->pCompressBuf = p; @@ -106,7 +106,7 @@ static int32_t toDataCacheEntry(SDataDispatchHandle* pHandle, const SInputData* } } - int32_t dataLen = blockEncode(pInput->pData, pHandle->pCompressBuf, dataEncodeSize, numOfCols); + int32_t dataLen = blockEncode(pInput->pData, pHandle->pCompressBuf, dataEncodeBufSize, numOfCols); if(dataLen < 0) { qError("failed to encode data block, code: %d", dataLen); return terrno; @@ -124,7 +124,7 @@ static int32_t toDataCacheEntry(SDataDispatchHandle* pHandle, const SInputData* TAOS_MEMCPY(pEntry->data, pHandle->pCompressBuf, dataLen); } } else { - pEntry->dataLen = blockEncode(pInput->pData, pEntry->data, dataEncodeSize, numOfCols); + pEntry->dataLen = blockEncode(pInput->pData, pEntry->data, pBuf->allocSize, numOfCols); if(pEntry->dataLen < 0) { qError("failed to encode data block, code: %d", pEntry->dataLen); return terrno; From 70c79abddca56cbe91a6f4b42bc7d83f09d22c6d Mon Sep 17 00:00:00 2001 From: xsren <285808407@qq.com> Date: Mon, 21 Oct 2024 09:27:46 +0800 Subject: [PATCH 195/695] fix: concat null failed --- source/client/src/clientImpl.c | 2 +- source/common/src/tdatablock.c | 2 +- source/libs/executor/src/dataDispatcher.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index 69b6fe312c47..323a5aed3ff9 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -2362,7 +2362,7 @@ int32_t resultInfoSafeCheck(SReqResultInfo* pResultInfo) { return TSDB_CODE_TSC_INTERNAL_ERROR; } for (int32_t i = 0; i < pResultInfo->numOfCols; ++i) { - if (pResultInfo->fields[i].bytes <= 0) { + if (pResultInfo->fields[i].bytes < 0) { tscError("checkResultInfo error: bytes:%d <= 0", pResultInfo->fields[i].bytes); return TSDB_CODE_TSC_INTERNAL_ERROR; } diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c index 2da83a6b7477..d41b4334685b 100644 --- a/source/common/src/tdatablock.c +++ b/source/common/src/tdatablock.c @@ -3165,7 +3165,7 @@ int32_t blockEncode(const SSDataBlock* pBlock, char* data, size_t dataBuflen, in return dataLen; _exit: - uError("blockEncode dataLen:%d, dataBuflen:%" PRIx64, dataLen, dataBuflen); + uError("blockEncode dataLen:%d, dataBuflen:%" PRIu64, dataLen, dataBuflen); terrno = TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR; return -1; } diff --git a/source/libs/executor/src/dataDispatcher.c b/source/libs/executor/src/dataDispatcher.c index b9fbf06ef639..d358cedfb713 100644 --- a/source/libs/executor/src/dataDispatcher.c +++ b/source/libs/executor/src/dataDispatcher.c @@ -84,10 +84,10 @@ static int32_t toDataCacheEntry(SDataDispatchHandle* pHandle, const SInputData* pBuf->useSize = sizeof(SDataCacheEntry); { + // allocate additional 8 bytes to avoid invalid write if compress failed to reduce the size size_t dataEncodeBufSize = pBuf->allocSize + 8; if ((pBuf->allocSize > tsCompressMsgSize) && (tsCompressMsgSize > 0) && pHandle->pManager->cfg.compress) { if (pHandle->pCompressBuf == NULL) { - // allocate additional 8 bytes to avoid invalid write if compress failed to reduce the size pHandle->pCompressBuf = taosMemoryMalloc(dataEncodeBufSize); if (NULL == pHandle->pCompressBuf) { QRY_RET(terrno); From 7094a8ddcfd49be3074d6001bd96d0e7fa41c9db Mon Sep 17 00:00:00 2001 From: xsren <285808407@qq.com> Date: Tue, 22 Oct 2024 14:15:48 +0800 Subject: [PATCH 196/695] fix: bytes of repeat and timezone --- include/libs/scalar/scalar.h | 1 + source/client/src/clientImpl.c | 21 ------ source/libs/executor/src/dataDispatcher.c | 78 +++++++++++++++++++++++ source/libs/function/src/builtins.c | 12 ++-- source/libs/scalar/src/sclfunc.c | 4 ++ 5 files changed, 91 insertions(+), 25 deletions(-) diff --git a/include/libs/scalar/scalar.h b/include/libs/scalar/scalar.h index fd936dd087d5..4b89a6a439fc 100644 --- a/include/libs/scalar/scalar.h +++ b/include/libs/scalar/scalar.h @@ -105,6 +105,7 @@ int32_t timeTruncateFunction(SScalarParam *pInput, int32_t inputNum, SScalarPara int32_t timeDiffFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput); int32_t nowFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput); int32_t todayFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput); +int32_t timeZoneStrLen(); int32_t timezoneFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput); int32_t weekdayFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput); int32_t dayofweekFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput); diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index 323a5aed3ff9..a3e327ee513f 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -2355,26 +2355,6 @@ static int32_t doConvertJson(SReqResultInfo* pResultInfo) { return TSDB_CODE_SUCCESS; } -int32_t resultInfoSafeCheck(SReqResultInfo* pResultInfo) { - if (pResultInfo->totalRows < pResultInfo->numOfRows) { - tscError("checkResultInfo error: totalRows:%" PRId64 " < numOfRows:%" PRId64, pResultInfo->totalRows, - pResultInfo->numOfRows); - return TSDB_CODE_TSC_INTERNAL_ERROR; - } - for (int32_t i = 0; i < pResultInfo->numOfCols; ++i) { - if (pResultInfo->fields[i].bytes < 0) { - tscError("checkResultInfo error: bytes:%d <= 0", pResultInfo->fields[i].bytes); - return TSDB_CODE_TSC_INTERNAL_ERROR; - } - if(!IS_VAR_DATA_TYPE(pResultInfo->fields[i].type) && TYPE_BYTES[pResultInfo->fields[i].type] != pResultInfo->fields[i].bytes) { - tscError("checkResultInfo error: type:%d bytes:%d != %d", pResultInfo->fields[i].type, pResultInfo->fields[i].bytes, TYPE_BYTES[pResultInfo->fields[i].type]); - return TSDB_CODE_TSC_INTERNAL_ERROR; - } - } - - return TSDB_CODE_SUCCESS; -} - int32_t setResultDataPtr(SReqResultInfo* pResultInfo, bool convertUcs4) { if (pResultInfo == NULL || pResultInfo->numOfCols <= 0 || pResultInfo->fields == NULL) { tscError("setResultDataPtr paras error"); @@ -2482,7 +2462,6 @@ int32_t setResultDataPtr(SReqResultInfo* pResultInfo, bool convertUcs4) { if (convertUcs4) { code = doConvertUCS4(pResultInfo, colLength); } - code = resultInfoSafeCheck(pResultInfo); return code; } diff --git a/source/libs/executor/src/dataDispatcher.c b/source/libs/executor/src/dataDispatcher.c index d358cedfb713..983309b7c205 100644 --- a/source/libs/executor/src/dataDispatcher.c +++ b/source/libs/executor/src/dataDispatcher.c @@ -54,6 +54,78 @@ typedef struct SDataDispatchHandle { TdThreadMutex mutex; } SDataDispatchHandle; +static int32_t inputSafetyCheck(SDataDispatchHandle* pHandle, const SInputData* pInput) { + if (pInput == NULL || pInput->pData == NULL || pInput->pData->info.rows <= 0) { + qError("invalid input data"); + return TSDB_CODE_QRY_INVALID_INPUT; + } + SDataBlockDescNode* pSchema = pHandle->pSchema; + if (pSchema == NULL || pSchema->outputRowSize > pInput->pData->info.rowSize) { + qError("invalid schema"); + return TSDB_CODE_QRY_INVALID_INPUT; + } + + SNode* pNode; + int32_t numOfCols = 0; + int32_t realOutputRowSize = 0; + FOREACH(pNode, pHandle->pSchema->pSlots) { + SSlotDescNode* pSlotDesc = (SSlotDescNode*)pNode; + if (pSlotDesc->output) { + realOutputRowSize += pSlotDesc->dataType.bytes; + ++numOfCols; + } else { + break; + } + } + if (realOutputRowSize != pSchema->outputRowSize) { + qError("invalid schema, realOutputRowSize:%d, outputRowSize:%d", realOutputRowSize, pSchema->outputRowSize); + return TSDB_CODE_QRY_INVALID_INPUT; + } + + if (numOfCols > taosArrayGetSize(pInput->pData->pDataBlock)) { + qError("invalid column number, schema:%d, input:%" PRIu64, numOfCols, taosArrayGetSize(pInput->pData->pDataBlock)); + return TSDB_CODE_QRY_INVALID_INPUT; + } + + int32_t colNum = 0; + FOREACH(pNode, pHandle->pSchema->pSlots) { + SSlotDescNode* pSlotDesc = (SSlotDescNode*)pNode; + if (pSlotDesc->output) { + SColumnInfoData* pColInfoData = taosArrayGet(pInput->pData->pDataBlock, colNum); + if (pColInfoData == NULL) { + return -1; + } + if (pColInfoData->info.bytes < 0) { + qError("invalid column bytes, schema:%d, input:%d", pSlotDesc->dataType.bytes, pColInfoData->info.bytes); + return TSDB_CODE_TSC_INTERNAL_ERROR; + } + if (!IS_VAR_DATA_TYPE(pColInfoData->info.type) && + TYPE_BYTES[pColInfoData->info.type] != pColInfoData->info.bytes) { + qError("invalid column bytes, schema:%d, input:%d", TYPE_BYTES[pColInfoData->info.type], + pColInfoData->info.bytes); + return TSDB_CODE_TSC_INTERNAL_ERROR; + } + if (pColInfoData->info.type != pSlotDesc->dataType.type) { + qError("invalid column type, schema:%d, input:%d", pSlotDesc->dataType.type, pColInfoData->info.type); + return TSDB_CODE_QRY_INVALID_INPUT; + } + if (pColInfoData->info.bytes != pSlotDesc->dataType.bytes) { + qError("invalid column bytes, schema:%d, input:%d", pSlotDesc->dataType.bytes, pColInfoData->info.bytes); + return TSDB_CODE_QRY_INVALID_INPUT; + } + + if (IS_INVALID_TYPE(pColInfoData->info.type)) { + qError("invalid column type, type:%d", pColInfoData->info.type); + return TSDB_CODE_TSC_INTERNAL_ERROR; + } + ++colNum; + } + } + + + return TSDB_CODE_SUCCESS; +} + // clang-format off // data format: // +----------------+------------------+--------------+--------------+------------------+--------------------------------------------+------------------------------------+-------------+-----------+-------------+-----------+ @@ -67,6 +139,12 @@ static int32_t toDataCacheEntry(SDataDispatchHandle* pHandle, const SInputData* int32_t numOfCols = 0; SNode* pNode; + int32_t code = inputSafetyCheck(pHandle, pInput); + if (code) { + qError("failed to check input data, code:%d", code); + return code; + } + FOREACH(pNode, pHandle->pSchema->pSlots) { SSlotDescNode* pSlotDesc = (SSlotDescNode*)pNode; if (pSlotDesc->output) { diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c index 1fd99125a038..1d3a43c49848 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -695,7 +695,8 @@ static int32_t translateIsFilledPseudoColumn(SFunctionNode* pFunc, char* pErrBuf } static int32_t translateTimezone(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - pFunc->node.resType = (SDataType){.bytes = TD_TIMEZONE_LEN, .type = TSDB_DATA_TYPE_BINARY}; + int32_t bytesLen = timeZoneStrLen(); + pFunc->node.resType = (SDataType){.bytes = bytesLen, .type = TSDB_DATA_TYPE_BINARY}; return TSDB_CODE_SUCCESS; } @@ -2465,9 +2466,12 @@ static int32_t translateRepeat(SFunctionNode* pFunc, char* pErrBuf, int32_t len) uint8_t type = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type; int32_t orgLen = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->bytes; - int32_t count = TMAX((int32_t)((SValueNode*)nodesListGetNode(pFunc->pParameterList, 1))->datum.i, 1); - - int32_t resLen = orgLen * count; + int32_t resLen; + if (nodeType(nodesListGetNode(pFunc->pParameterList, 1)) == QUERY_NODE_VALUE) { + resLen = orgLen * TMAX((int32_t)((SValueNode*)nodesListGetNode(pFunc->pParameterList, 1))->datum.i, 1); + } else { + resLen = TSDB_MAX_BINARY_LEN; + } pFunc->node.resType = (SDataType){.bytes = resLen, .type = type}; return TSDB_CODE_SUCCESS; } diff --git a/source/libs/scalar/src/sclfunc.c b/source/libs/scalar/src/sclfunc.c index 6f6362a8f791..9aa67c441bea 100644 --- a/source/libs/scalar/src/sclfunc.c +++ b/source/libs/scalar/src/sclfunc.c @@ -2662,6 +2662,10 @@ int32_t todayFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOut return TSDB_CODE_SUCCESS; } +int32_t timeZoneStrLen() { + return sizeof(VarDataLenT) + strlen(tsTimezoneStr); +} + int32_t timezoneFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput) { char output[TD_TIMEZONE_LEN + VARSTR_HEADER_SIZE] = {0}; (void)memcpy(varDataVal(output), tsTimezoneStr, TD_TIMEZONE_LEN); From f57e3f3c8511222ce74a03d574b233f27cd9d342 Mon Sep 17 00:00:00 2001 From: xsren <285808407@qq.com> Date: Tue, 22 Oct 2024 16:22:27 +0800 Subject: [PATCH 197/695] enh: safetyCheck --- include/common/tglobal.h | 1 + source/common/src/tdatablock.c | 2 +- source/common/src/tglobal.c | 11 +++++++++-- source/libs/executor/src/dataDispatcher.c | 3 +++ 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/include/common/tglobal.h b/include/common/tglobal.h index 41fb692e42eb..a13693d38c39 100644 --- a/include/common/tglobal.h +++ b/include/common/tglobal.h @@ -153,6 +153,7 @@ extern bool tsEnableCrashReport; extern char *tsTelemUri; extern char *tsClientCrashReportUri; extern char *tsSvrCrashReportUri; +extern bool tsEnableSafetyCheck; // query buffer management extern int32_t tsQueryBufferSize; // maximum allowed usage buffer size in MB for each data node during query processing diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c index d41b4334685b..23efe48209ff 100644 --- a/source/common/src/tdatablock.c +++ b/source/common/src/tdatablock.c @@ -3165,7 +3165,7 @@ int32_t blockEncode(const SSDataBlock* pBlock, char* data, size_t dataBuflen, in return dataLen; _exit: - uError("blockEncode dataLen:%d, dataBuflen:%" PRIu64, dataLen, dataBuflen); + uError("blockEncode dataLen:%d, dataBuflen:%zu", dataLen, dataBuflen); terrno = TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR; return -1; } diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index 7cff5de008b8..06791c5ec336 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -139,6 +139,7 @@ bool tsEnableCrashReport = true; #endif char *tsClientCrashReportUri = "/ccrashreport"; char *tsSvrCrashReportUri = "/dcrashreport"; +bool tsEnableSafetyCheck = true; // schemaless bool tsSmlDot2Underline = true; @@ -607,6 +608,7 @@ static int32_t taosAddClientCfg(SConfig *pCfg) { TAOS_CHECK_RETURN( cfgAddInt64(pCfg, "randErrorDivisor", tsRandErrDivisor, 1, INT64_MAX, CFG_SCOPE_BOTH, CFG_DYN_BOTH)); TAOS_CHECK_RETURN(cfgAddInt64(pCfg, "randErrorScope", tsRandErrScope, 0, INT64_MAX, CFG_SCOPE_BOTH, CFG_DYN_BOTH)); + TAOS_CHECK_RETURN(cfgAddBool(pCfg, "enableSafetyCheck", tsEnableSafetyCheck, CFG_SCOPE_BOTH, CFG_DYN_BOTH)); tsNumOfRpcThreads = tsNumOfCores / 2; tsNumOfRpcThreads = TRANGE(tsNumOfRpcThreads, 1, TSDB_MAX_RPC_THREADS); @@ -1299,6 +1301,9 @@ static int32_t taosSetClientCfg(SConfig *pCfg) { TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "tsmaDataDeleteMark"); tsmaDataDeleteMark = pItem->i32; + + TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "enableSafetyCheck"); + tsEnableSafetyCheck = pItem->bval; TAOS_RETURN(TSDB_CODE_SUCCESS); } @@ -2039,7 +2044,8 @@ static int32_t taosCfgDynamicOptionsForServer(SConfig *pCfg, const char *name) { {"s3UploadDelaySec", &tsS3UploadDelaySec}, {"supportVnodes", &tsNumOfSupportVnodes}, {"experimental", &tsExperimental}, - {"maxTsmaNum", &tsMaxTsmaNum}}; + {"maxTsmaNum", &tsMaxTsmaNum}, + {"enableSafetyCheck", &tsEnableSafetyCheck}}; if ((code = taosCfgSetOption(debugOptions, tListLen(debugOptions), pItem, true)) != TSDB_CODE_SUCCESS) { code = taosCfgSetOption(options, tListLen(options), pItem, false); @@ -2295,7 +2301,8 @@ static int32_t taosCfgDynamicOptionsForClient(SConfig *pCfg, const char *name) { {"experimental", &tsExperimental}, {"multiResultFunctionStarReturnTags", &tsMultiResultFunctionStarReturnTags}, {"maxTsmaCalcDelay", &tsMaxTsmaCalcDelay}, - {"tsmaDataDeleteMark", &tsmaDataDeleteMark}}; + {"tsmaDataDeleteMark", &tsmaDataDeleteMark}, + {"enableSafetyCheck", &tsEnableSafetyCheck}}; if ((code = taosCfgSetOption(debugOptions, tListLen(debugOptions), pItem, true)) != TSDB_CODE_SUCCESS) { code = taosCfgSetOption(options, tListLen(options), pItem, false); diff --git a/source/libs/executor/src/dataDispatcher.c b/source/libs/executor/src/dataDispatcher.c index 983309b7c205..5c3bc88b5b41 100644 --- a/source/libs/executor/src/dataDispatcher.c +++ b/source/libs/executor/src/dataDispatcher.c @@ -55,6 +55,9 @@ typedef struct SDataDispatchHandle { } SDataDispatchHandle; static int32_t inputSafetyCheck(SDataDispatchHandle* pHandle, const SInputData* pInput) { + if(!tsEnableSafetyCheck) { + return TSDB_CODE_SUCCESS; + } if (pInput == NULL || pInput->pData == NULL || pInput->pData->info.rows <= 0) { qError("invalid input data"); return TSDB_CODE_QRY_INVALID_INPUT; From 2ae51f311847a00450e22f4b4eab2a475e4b657f Mon Sep 17 00:00:00 2001 From: xsren <285808407@qq.com> Date: Wed, 23 Oct 2024 06:20:51 +0800 Subject: [PATCH 198/695] enh: safetyCheck config --- source/common/src/tglobal.c | 2 +- source/libs/executor/src/dataDispatcher.c | 2 +- tests/pytest/util/dnodes.py | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index 06791c5ec336..87cf1d758701 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -139,7 +139,7 @@ bool tsEnableCrashReport = true; #endif char *tsClientCrashReportUri = "/ccrashreport"; char *tsSvrCrashReportUri = "/dcrashreport"; -bool tsEnableSafetyCheck = true; +bool tsEnableSafetyCheck = false; // schemaless bool tsSmlDot2Underline = true; diff --git a/source/libs/executor/src/dataDispatcher.c b/source/libs/executor/src/dataDispatcher.c index 5c3bc88b5b41..b7422d849c04 100644 --- a/source/libs/executor/src/dataDispatcher.c +++ b/source/libs/executor/src/dataDispatcher.c @@ -86,7 +86,7 @@ static int32_t inputSafetyCheck(SDataDispatchHandle* pHandle, const SInputData* } if (numOfCols > taosArrayGetSize(pInput->pData->pDataBlock)) { - qError("invalid column number, schema:%d, input:%" PRIu64, numOfCols, taosArrayGetSize(pInput->pData->pDataBlock)); + qError("invalid column number, schema:%d, input:%zu", numOfCols, taosArrayGetSize(pInput->pData->pDataBlock)); return TSDB_CODE_QRY_INVALID_INPUT; } diff --git a/tests/pytest/util/dnodes.py b/tests/pytest/util/dnodes.py index bb6f8ff030ee..7a836c181b7a 100644 --- a/tests/pytest/util/dnodes.py +++ b/tests/pytest/util/dnodes.py @@ -48,6 +48,7 @@ def __init__(self, path): "telemetryReporting": "0", "tqDebugflag": "135", "stDebugflag":"135", + "enableSafetyCheck":"1" } def getLogDir(self): @@ -149,7 +150,8 @@ def __init__(self, index): "statusInterval": "1", "enableQueryHb": "1", "supportVnodes": "1024", - "telemetryReporting": "0" + "telemetryReporting": "0", + "enableSafetyCheck":"1" } def init(self, path, remoteIP = ""): From 00d374358a42a721cb7f4c8c84f7992ee39476c1 Mon Sep 17 00:00:00 2001 From: xsren <285808407@qq.com> Date: Wed, 23 Oct 2024 11:38:46 +0800 Subject: [PATCH 199/695] fix: rowSize check --- source/libs/executor/src/dataDispatcher.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/libs/executor/src/dataDispatcher.c b/source/libs/executor/src/dataDispatcher.c index b7422d849c04..732b2566a923 100644 --- a/source/libs/executor/src/dataDispatcher.c +++ b/source/libs/executor/src/dataDispatcher.c @@ -63,7 +63,7 @@ static int32_t inputSafetyCheck(SDataDispatchHandle* pHandle, const SInputData* return TSDB_CODE_QRY_INVALID_INPUT; } SDataBlockDescNode* pSchema = pHandle->pSchema; - if (pSchema == NULL || pSchema->outputRowSize > pInput->pData->info.rowSize) { + if (pSchema == NULL || pSchema->totalRowSize != pInput->pData->info.rowSize) { qError("invalid schema"); return TSDB_CODE_QRY_INVALID_INPUT; } @@ -77,6 +77,7 @@ static int32_t inputSafetyCheck(SDataDispatchHandle* pHandle, const SInputData* realOutputRowSize += pSlotDesc->dataType.bytes; ++numOfCols; } else { + // Slots must be sorted, and slots with 'output' set to true must come first break; } } From ea6c90e023af33ea8e6a6823ca0d195fdb928bfa Mon Sep 17 00:00:00 2001 From: xsren <285808407@qq.com> Date: Wed, 23 Oct 2024 13:52:53 +0800 Subject: [PATCH 200/695] fix: repeat.csv --- tests/army/query/function/ans/repeat.csv | 68 ++++++++++++------------ 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/tests/army/query/function/ans/repeat.csv b/tests/army/query/function/ans/repeat.csv index d8f8b3050fed..c303f164a97b 100644 --- a/tests/army/query/function/ans/repeat.csv +++ b/tests/army/query/function/ans/repeat.csv @@ -108,13 +108,13 @@ taos> select repeat(nch1, id) from ts_4893.meters where id > 0 order by ts limit novelnovelnovelnovelnovel | taos> select repeat(var1, id) from ts_4893.meters where id > 0 order by ts limit 5 - repeat(var1, id) | -=================== - person | - novelnovel | - plateplateplate | - 一二三四五六... | - updateupdateu... | + repeat(var1, id) | +================================= + person | + novelnovel | + plateplateplate | + 一二三四五六七八九十一二三... | + updateupdateupdateupdateupdate | taos> select repeat('nch1', id) from ts_4893.meters where id > 0 order by ts limit 5 repeat('nch1', id) | @@ -229,32 +229,32 @@ taos> select repeat(var1, 3) from ts_4893.meters order by ts limit 10 plateplateplate | taos> select repeat(name, groupid) from ts_4893.d0 order by ts limit 10 - repeat(name, groupid) | -======================== - lili | - x | - lili | - x | - lili | - taos | - haha | - taos | - taos | - haha | + repeat(name, groupid) | +================================= + lili | + x | + lili | + x | + lili | + taos | + haha | + taos | + taos | + haha | taos> select repeat(name, groupid) from ts_4893.meters order by ts limit 10 - repeat(name, groupid) | -======================== - lili | - x | - lili | - x | - lili | - taos | - haha | - taos | - taos | - haha | + repeat(name, groupid) | +================================= + lili | + x | + lili | + x | + lili | + taos | + haha | + taos | + taos | + haha | taos> select repeat(nch1, groupid) from ts_4893.d0 order by ts limit 10 repeat(nch1, groupid) | @@ -355,9 +355,9 @@ taos> select repeat('你好', 2) 你好你好 | taos> select repeat('abc', length('abc')) - repeat('abc', length('abc')) | -=============================== - abcabcabc | + repeat('abc', length('abc')) | +================================= + abcabcabc | taos> select repeat(concat('A', 'B', 'C'), 3) repeat(concat('A', 'B', 'C'), 3) | From d1d66896848dbede42490de2ad54ae1a2ef2b3fa Mon Sep 17 00:00:00 2001 From: wangjiaming0909 <604227650@qq.com> Date: Wed, 23 Oct 2024 15:15:03 +0800 Subject: [PATCH 201/695] add not fill exprs for fill operator --- include/libs/nodes/plannodes.h | 2 + source/libs/executor/inc/tfill.h | 11 +- source/libs/executor/src/filloperator.c | 32 +++- source/libs/executor/src/streamfilloperator.c | 2 +- source/libs/executor/src/tfill.c | 54 ++++-- source/libs/executor/src/timesliceoperator.c | 3 +- source/libs/nodes/src/nodesCloneFuncs.c | 1 + source/libs/nodes/src/nodesCodeFuncs.c | 7 + source/libs/nodes/src/nodesMsgFuncs.c | 9 +- source/libs/nodes/src/nodesUtilFuncs.c | 2 + source/libs/planner/src/planLogicCreater.c | 172 +++++++++--------- source/libs/planner/src/planPhysiCreater.c | 6 + tests/system-test/2-query/fill_with_group.py | 6 +- 13 files changed, 185 insertions(+), 122 deletions(-) diff --git a/include/libs/nodes/plannodes.h b/include/libs/nodes/plannodes.h index bfe9e9555b82..992948212c8b 100644 --- a/include/libs/nodes/plannodes.h +++ b/include/libs/nodes/plannodes.h @@ -325,6 +325,7 @@ typedef struct SFillLogicNode { SNode* pWStartTs; SNode* pValues; // SNodeListNode STimeWindow timeRange; + SNodeList* pFillNullExprs; } SFillLogicNode; typedef struct SSortLogicNode { @@ -663,6 +664,7 @@ typedef struct SFillPhysiNode { SNode* pWStartTs; // SColumnNode SNode* pValues; // SNodeListNode STimeWindow timeRange; + SNodeList* pFillNullExprs; } SFillPhysiNode; typedef SFillPhysiNode SStreamFillPhysiNode; diff --git a/source/libs/executor/inc/tfill.h b/source/libs/executor/inc/tfill.h index b06aa7d1c849..31ac5689f65c 100644 --- a/source/libs/executor/inc/tfill.h +++ b/source/libs/executor/inc/tfill.h @@ -35,6 +35,7 @@ typedef struct SFillColInfo { SExprInfo* pExpr; bool notFillCol; // denote if this column needs fill operation SVariant fillVal; + bool fillNull; } SFillColInfo; typedef struct SFillLinearInfo { @@ -125,12 +126,14 @@ void taosFillSetInputDataBlock(struct SFillInfo* pFillInfo, const struc void taosFillUpdateStartTimestampInfo(SFillInfo* pFillInfo, int64_t ts); bool taosFillNotStarted(const SFillInfo* pFillInfo); SFillColInfo* createFillColInfo(SExprInfo* pExpr, int32_t numOfFillExpr, SExprInfo* pNotFillExpr, - int32_t numOfNotFillCols, const struct SNodeListNode* val); + int32_t numOfNotFillCols, SExprInfo* pFillNullExpr, int32_t numOfFillNullExprs, + const struct SNodeListNode* val); bool taosFillHasMoreResults(struct SFillInfo* pFillInfo); -int32_t taosCreateFillInfo(TSKEY skey, int32_t numOfFillCols, int32_t numOfNotFillCols, int32_t capacity, - SInterval* pInterval, int32_t fillType, struct SFillColInfo* pCol, int32_t slotId, - int32_t order, const char* id, SExecTaskInfo* pTaskInfo, SFillInfo** ppFillInfo); +int32_t taosCreateFillInfo(TSKEY skey, int32_t numOfFillCols, int32_t numOfNotFillCols, int32_t fillNullCols, + int32_t capacity, SInterval* pInterval, int32_t fillType, struct SFillColInfo* pCol, + int32_t slotId, int32_t order, const char* id, SExecTaskInfo* pTaskInfo, + SFillInfo** ppFillInfo); void* taosDestroyFillInfo(struct SFillInfo* pFillInfo); int32_t taosFillResultDataBlock(struct SFillInfo* pFillInfo, SSDataBlock* p, int32_t capacity); diff --git a/source/libs/executor/src/filloperator.c b/source/libs/executor/src/filloperator.c index d530382f7cf7..d7a55c86bb7e 100644 --- a/source/libs/executor/src/filloperator.c +++ b/source/libs/executor/src/filloperator.c @@ -53,6 +53,7 @@ typedef struct SFillOperatorInfo { SExprInfo* pExprInfo; int32_t numOfExpr; SExprSupp noFillExprSupp; + SExprSupp fillNullExprSupp; } SFillOperatorInfo; static void destroyFillOperatorInfo(void* param); @@ -140,6 +141,15 @@ void doApplyScalarCalculation(SOperatorInfo* pOperator, SSDataBlock* pBlock, int code = projectApplyFunctions(pNoFillSupp->pExprInfo, pInfo->pRes, pBlock, pNoFillSupp->pCtx, pNoFillSupp->numOfExprs, NULL); QUERY_CHECK_CODE(code, lino, _end); + + if (pInfo->fillNullExprSupp.pExprInfo) { + pInfo->pRes->info.rows = 0; + code = setInputDataBlock(&pInfo->fillNullExprSupp, pBlock, order, scanFlag, false); + QUERY_CHECK_CODE(code, lino, _end); + code = projectApplyFunctions(pInfo->fillNullExprSupp.pExprInfo, pInfo->pRes, pBlock, pInfo->fillNullExprSupp.pCtx, + pInfo->fillNullExprSupp.numOfExprs, NULL); + } + pInfo->pRes->info.id.groupId = pBlock->info.id.groupId; _end: @@ -334,10 +344,11 @@ void destroyFillOperatorInfo(void* param) { } static int32_t initFillInfo(SFillOperatorInfo* pInfo, SExprInfo* pExpr, int32_t numOfCols, SExprInfo* pNotFillExpr, - int32_t numOfNotFillCols, SNodeListNode* pValNode, STimeWindow win, int32_t capacity, - const char* id, SInterval* pInterval, int32_t fillType, int32_t order, - SExecTaskInfo* pTaskInfo) { - SFillColInfo* pColInfo = createFillColInfo(pExpr, numOfCols, pNotFillExpr, numOfNotFillCols, pValNode); + int32_t numOfNotFillCols, SExprInfo* pFillNullExpr, int32_t numOfFillNullExprs, + SNodeListNode* pValNode, STimeWindow win, int32_t capacity, const char* id, + SInterval* pInterval, int32_t fillType, int32_t order, SExecTaskInfo* pTaskInfo) { + SFillColInfo* pColInfo = + createFillColInfo(pExpr, numOfCols, pNotFillExpr, numOfNotFillCols, pFillNullExpr, numOfFillNullExprs, pValNode); if (!pColInfo) { qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(terrno)); return terrno; @@ -348,8 +359,8 @@ static int32_t initFillInfo(SFillOperatorInfo* pInfo, SExprInfo* pExpr, int32_t // STimeWindow w = {0}; // getInitialStartTimeWindow(pInterval, startKey, &w, order == TSDB_ORDER_ASC); pInfo->pFillInfo = NULL; - int32_t code = taosCreateFillInfo(startKey, numOfCols, numOfNotFillCols, capacity, pInterval, fillType, pColInfo, - pInfo->primaryTsCol, order, id, pTaskInfo, &pInfo->pFillInfo); + int32_t code = taosCreateFillInfo(startKey, numOfCols, numOfNotFillCols, numOfFillNullExprs, capacity, pInterval, + fillType, pColInfo, pInfo->primaryTsCol, order, id, pTaskInfo, &pInfo->pFillInfo); if (code != TSDB_CODE_SUCCESS) { qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(code)); return code; @@ -455,6 +466,13 @@ int32_t createFillOperatorInfo(SOperatorInfo* downstream, SFillPhysiNode* pPhyFi initExprSupp(pNoFillSupp, pNoFillSupp->pExprInfo, pNoFillSupp->numOfExprs, &pTaskInfo->storageAPI.functionStore); QUERY_CHECK_CODE(code, lino, _error); + code = createExprInfo(pPhyFillNode->pFillNullExprs, NULL, &pInfo->fillNullExprSupp.pExprInfo, + &pInfo->fillNullExprSupp.numOfExprs); + QUERY_CHECK_CODE(code, lino, _error); + code = initExprSupp(&pInfo->fillNullExprSupp, pInfo->fillNullExprSupp.pExprInfo, pInfo->fillNullExprSupp.numOfExprs, + &pTaskInfo->storageAPI.functionStore); + QUERY_CHECK_CODE(code, lino, _error); + SInterval* pInterval = QUERY_NODE_PHYSICAL_PLAN_MERGE_ALIGNED_INTERVAL == downstream->operatorType ? &((SMergeAlignedIntervalAggOperatorInfo*)downstream->info)->intervalAggOperatorInfo->interval @@ -482,7 +500,9 @@ int32_t createFillOperatorInfo(SOperatorInfo* downstream, SFillPhysiNode* pPhyFi code = extractColMatchInfo(pPhyFillNode->pFillExprs, pPhyFillNode->node.pOutputDataBlockDesc, &numOfOutputCols, COL_MATCH_FROM_SLOT_ID, &pInfo->matchInfo); + QUERY_CHECK_CODE(code, lino, _error); code = initFillInfo(pInfo, pExprInfo, pInfo->numOfExpr, pNoFillSupp->pExprInfo, pNoFillSupp->numOfExprs, + pInfo->fillNullExprSupp.pExprInfo, pInfo->fillNullExprSupp.numOfExprs, (SNodeListNode*)pPhyFillNode->pValues, pPhyFillNode->timeRange, pResultInfo->capacity, pTaskInfo->id.str, pInterval, type, order, pTaskInfo); if (code != TSDB_CODE_SUCCESS) { diff --git a/source/libs/executor/src/streamfilloperator.c b/source/libs/executor/src/streamfilloperator.c index 826220581a4d..b7061fad9721 100644 --- a/source/libs/executor/src/streamfilloperator.c +++ b/source/libs/executor/src/streamfilloperator.c @@ -1201,7 +1201,7 @@ static SStreamFillSupporter* initStreamFillSup(SStreamFillPhysiNode* pPhyFillNod QUERY_CHECK_CODE(code, lino, _end); pFillSup->pAllColInfo = createFillColInfo(pFillExprInfo, pFillSup->numOfFillCols, noFillExprInfo, numOfNotFillCols, - (const SNodeListNode*)(pPhyFillNode->pValues)); + NULL, 0, (const SNodeListNode*)(pPhyFillNode->pValues)); if (pFillSup->pAllColInfo == NULL) { code = terrno; lino = __LINE__; diff --git a/source/libs/executor/src/tfill.c b/source/libs/executor/src/tfill.c index cdfbd7a8502e..190b327522c2 100644 --- a/source/libs/executor/src/tfill.c +++ b/source/libs/executor/src/tfill.c @@ -39,22 +39,27 @@ static int32_t doSetVal(SColumnInfoData* pDstColInfoData, int32_t rowIndex, const SGroupKeys* pKey); static void setNotFillColumn(SFillInfo* pFillInfo, SColumnInfoData* pDstColInfo, int32_t rowIndex, int32_t colIdx) { - SRowVal* p = NULL; - if (pFillInfo->type == TSDB_FILL_NEXT) { - p = FILL_IS_ASC_FILL(pFillInfo) ? &pFillInfo->next : &pFillInfo->prev; + SFillColInfo* pCol = &pFillInfo->pFillCol[colIdx]; + if (pCol->fillNull) { + colDataSetNULL(pDstColInfo, rowIndex); } else { - p = FILL_IS_ASC_FILL(pFillInfo) ? &pFillInfo->prev : &pFillInfo->next; - } + SRowVal* p = NULL; + if (pFillInfo->type == TSDB_FILL_NEXT) { + p = FILL_IS_ASC_FILL(pFillInfo) ? &pFillInfo->next : &pFillInfo->prev; + } else { + p = FILL_IS_ASC_FILL(pFillInfo) ? &pFillInfo->prev : &pFillInfo->next; + } - SGroupKeys* pKey = taosArrayGet(p->pRowVal, colIdx); - if (!pKey) { - qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(terrno)); - T_LONG_JMP(pFillInfo->pTaskInfo->env, terrno); - } - int32_t code = doSetVal(pDstColInfo, rowIndex, pKey); - if (code != TSDB_CODE_SUCCESS) { - qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(code)); - T_LONG_JMP(pFillInfo->pTaskInfo->env, code); + SGroupKeys* pKey = taosArrayGet(p->pRowVal, colIdx); + if (!pKey) { + qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(terrno)); + T_LONG_JMP(pFillInfo->pTaskInfo->env, terrno); + } + int32_t code = doSetVal(pDstColInfo, rowIndex, pKey); + if (code != TSDB_CODE_SUCCESS) { + qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(code)); + T_LONG_JMP(pFillInfo->pTaskInfo->env, code); + } } } @@ -545,9 +550,10 @@ static int32_t taosNumOfRemainRows(SFillInfo* pFillInfo) { return pFillInfo->numOfRows - pFillInfo->index; } -int32_t taosCreateFillInfo(TSKEY skey, int32_t numOfFillCols, int32_t numOfNotFillCols, int32_t capacity, - SInterval* pInterval, int32_t fillType, struct SFillColInfo* pCol, int32_t primaryTsSlotId, - int32_t order, const char* id, SExecTaskInfo* pTaskInfo, SFillInfo** ppFillInfo) { +int32_t taosCreateFillInfo(TSKEY skey, int32_t numOfFillCols, int32_t numOfNotFillCols, int32_t fillNullCols, + int32_t capacity, SInterval* pInterval, int32_t fillType, struct SFillColInfo* pCol, + int32_t primaryTsSlotId, int32_t order, const char* id, SExecTaskInfo* pTaskInfo, + SFillInfo** ppFillInfo) { int32_t code = TSDB_CODE_SUCCESS; int32_t lino = 0; if (fillType == TSDB_FILL_NONE) { @@ -574,7 +580,7 @@ int32_t taosCreateFillInfo(TSKEY skey, int32_t numOfFillCols, int32_t numOfNotFi pFillInfo->type = fillType; pFillInfo->pFillCol = pCol; - pFillInfo->numOfCols = numOfFillCols + numOfNotFillCols; + pFillInfo->numOfCols = numOfFillCols + numOfNotFillCols + fillNullCols; pFillInfo->alloc = capacity; pFillInfo->id = id; pFillInfo->interval = *pInterval; @@ -761,10 +767,11 @@ int32_t taosFillResultDataBlock(SFillInfo* pFillInfo, SSDataBlock* p, int32_t ca int64_t getFillInfoStart(struct SFillInfo* pFillInfo) { return pFillInfo->start; } SFillColInfo* createFillColInfo(SExprInfo* pExpr, int32_t numOfFillExpr, SExprInfo* pNotFillExpr, - int32_t numOfNoFillExpr, const struct SNodeListNode* pValNode) { + int32_t numOfNoFillExpr, SExprInfo* pFillNullExpr, int32_t numOfFillNullExpr, + const struct SNodeListNode* pValNode) { int32_t code = TSDB_CODE_SUCCESS; int32_t lino = 0; - SFillColInfo* pFillCol = taosMemoryCalloc(numOfFillExpr + numOfNoFillExpr, sizeof(SFillColInfo)); + SFillColInfo* pFillCol = taosMemoryCalloc(numOfFillExpr + numOfNoFillExpr + numOfFillNullExpr, sizeof(SFillColInfo)); if (pFillCol == NULL) { return NULL; } @@ -797,6 +804,13 @@ SFillColInfo* createFillColInfo(SExprInfo* pExpr, int32_t numOfFillExpr, SExprIn pFillCol[i + numOfFillExpr].notFillCol = true; } + for (int32_t i = 0; i < numOfFillNullExpr; ++i) { + SExprInfo* pExprInfo = &pFillNullExpr[i]; + pFillCol[i + numOfFillExpr + numOfNoFillExpr].pExpr = pExprInfo; + pFillCol[i + numOfFillExpr + numOfNoFillExpr].notFillCol = true; + pFillCol[i + numOfFillExpr + numOfNoFillExpr].fillNull = true; + } + return pFillCol; _end: diff --git a/source/libs/executor/src/timesliceoperator.c b/source/libs/executor/src/timesliceoperator.c index 2ea300ace89a..6803f40da417 100644 --- a/source/libs/executor/src/timesliceoperator.c +++ b/source/libs/executor/src/timesliceoperator.c @@ -1147,7 +1147,8 @@ int32_t createTimeSliceOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pPhyN pInfo->fillType = convertFillType(pInterpPhyNode->fillMode); initResultSizeInfo(&pOperator->resultInfo, 4096); - pInfo->pFillColInfo = createFillColInfo(pExprInfo, numOfExprs, NULL, 0, (SNodeListNode*)pInterpPhyNode->pFillValues); + pInfo->pFillColInfo = + createFillColInfo(pExprInfo, numOfExprs, NULL, 0, NULL, 0, (SNodeListNode*)pInterpPhyNode->pFillValues); QUERY_CHECK_NULL(pInfo->pFillColInfo, code, lino, _error, terrno); pInfo->pLinearInfo = NULL; diff --git a/source/libs/nodes/src/nodesCloneFuncs.c b/source/libs/nodes/src/nodesCloneFuncs.c index 5db8863311e4..c7914591f8bd 100644 --- a/source/libs/nodes/src/nodesCloneFuncs.c +++ b/source/libs/nodes/src/nodesCloneFuncs.c @@ -633,6 +633,7 @@ static int32_t logicFillCopy(const SFillLogicNode* pSrc, SFillLogicNode* pDst) { CLONE_NODE_FIELD(pWStartTs); CLONE_NODE_FIELD(pValues); COPY_OBJECT_FIELD(timeRange, sizeof(STimeWindow)); + CLONE_NODE_LIST_FIELD(pFillNullExprs); return TSDB_CODE_SUCCESS; } diff --git a/source/libs/nodes/src/nodesCodeFuncs.c b/source/libs/nodes/src/nodesCodeFuncs.c index 4b3ca97bbf57..39c939419a63 100644 --- a/source/libs/nodes/src/nodesCodeFuncs.c +++ b/source/libs/nodes/src/nodesCodeFuncs.c @@ -2843,6 +2843,7 @@ static const char* jkFillPhysiPlanWStartTs = "WStartTs"; static const char* jkFillPhysiPlanValues = "Values"; static const char* jkFillPhysiPlanStartTime = "StartTime"; static const char* jkFillPhysiPlanEndTime = "EndTime"; +static const char* jkFillPhysiPlanFillNullExprs = "FillNullExprs"; static int32_t physiFillNodeToJson(const void* pObj, SJson* pJson) { const SFillPhysiNode* pNode = (const SFillPhysiNode*)pObj; @@ -2869,6 +2870,9 @@ static int32_t physiFillNodeToJson(const void* pObj, SJson* pJson) { if (TSDB_CODE_SUCCESS == code) { code = tjsonAddIntegerToObject(pJson, jkFillPhysiPlanEndTime, pNode->timeRange.ekey); } + if (TSDB_CODE_SUCCESS == code) { + code = nodeListToJson(pJson, jkFillPhysiPlanFillNullExprs, pNode->pFillNullExprs); + } return code; } @@ -2898,6 +2902,9 @@ static int32_t jsonToPhysiFillNode(const SJson* pJson, void* pObj) { if (TSDB_CODE_SUCCESS == code) { code = tjsonGetBigIntValue(pJson, jkFillPhysiPlanEndTime, &pNode->timeRange.ekey); } + if (TSDB_CODE_SUCCESS == code) { + code = jsonToNodeList(pJson, jkFillPhysiPlanFillNullExprs, &pNode->pFillNullExprs); + } return code; } diff --git a/source/libs/nodes/src/nodesMsgFuncs.c b/source/libs/nodes/src/nodesMsgFuncs.c index 581c6222d2cb..3c3626509316 100644 --- a/source/libs/nodes/src/nodesMsgFuncs.c +++ b/source/libs/nodes/src/nodesMsgFuncs.c @@ -3326,7 +3326,8 @@ enum { PHY_FILL_CODE_WSTART, PHY_FILL_CODE_VALUES, PHY_FILL_CODE_TIME_RANGE, - PHY_FILL_CODE_INPUT_TS_ORDER + PHY_FILL_CODE_INPUT_TS_ORDER, + PHY_FILL_CODE_FILL_NULL_EXPRS, }; static int32_t physiFillNodeToMsg(const void* pObj, STlvEncoder* pEncoder) { @@ -3351,6 +3352,9 @@ static int32_t physiFillNodeToMsg(const void* pObj, STlvEncoder* pEncoder) { if (TSDB_CODE_SUCCESS == code) { code = tlvEncodeObj(pEncoder, PHY_FILL_CODE_TIME_RANGE, timeWindowToMsg, &pNode->timeRange); } + if (TSDB_CODE_SUCCESS == code) { + code = tlvEncodeObj(pEncoder, PHY_FILL_CODE_FILL_NULL_EXPRS, nodeListToMsg, pNode->pFillNullExprs); + } return code; } @@ -3383,6 +3387,9 @@ static int32_t msgToPhysiFillNode(STlvDecoder* pDecoder, void* pObj) { case PHY_FILL_CODE_TIME_RANGE: code = tlvDecodeObjFromTlv(pTlv, msgToTimeWindow, (void**)&pNode->timeRange); break; + case PHY_FILL_CODE_FILL_NULL_EXPRS: + code = msgToNodeListFromTlv(pTlv, (void**)&pNode->pFillNullExprs); + break; default: break; } diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c index c7d21d6fde99..fc7bae072f37 100644 --- a/source/libs/nodes/src/nodesUtilFuncs.c +++ b/source/libs/nodes/src/nodesUtilFuncs.c @@ -1469,6 +1469,7 @@ void nodesDestroyNode(SNode* pNode) { nodesDestroyNode(pLogicNode->pValues); nodesDestroyList(pLogicNode->pFillExprs); nodesDestroyList(pLogicNode->pNotFillExprs); + nodesDestroyList(pLogicNode->pFillNullExprs); break; } case QUERY_NODE_LOGIC_PLAN_SORT: { @@ -1634,6 +1635,7 @@ void nodesDestroyNode(SNode* pNode) { nodesDestroyList(pPhyNode->pNotFillExprs); nodesDestroyNode(pPhyNode->pWStartTs); nodesDestroyNode(pPhyNode->pValues); + nodesDestroyList(pPhyNode->pFillNullExprs); break; } case QUERY_NODE_PHYSICAL_PLAN_MERGE_SESSION: diff --git a/source/libs/planner/src/planLogicCreater.c b/source/libs/planner/src/planLogicCreater.c index 0d4da5c6f6e4..fdcb8df42ff2 100644 --- a/source/libs/planner/src/planLogicCreater.c +++ b/source/libs/planner/src/planLogicCreater.c @@ -1196,128 +1196,142 @@ static int32_t createWindowLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSele return TSDB_CODE_FAILED; } -typedef struct SPartFillExprsCtx { - bool hasFillCol; - bool hasPseudoWinCol; - bool hasGroupKeyCol; - SHashObj* pPseudoCols; - int32_t code; -} SPartFillExprsCtx; +typedef struct SCollectFillExprsCtx { + SHashObj* pPseudoCols; + SNodeList* pFillExprs; + SNodeList* pNotFillExprs; + bool collectAggFuncs; + SNodeList* pAggFuncCols; +} SCollectFillExprsCtx; + +typedef struct SWalkFillSubExprCtx { + bool hasFillCol; + bool hasPseudoWinCol; + bool hasGroupKeyCol; + SCollectFillExprsCtx* pCollectFillCtx; + int32_t code; +} SWalkFillSubExprCtx; + +static bool nodeAlreadyContained(SNodeList* pList, SNode* pNode) { + SNode* pExpr = NULL; + FOREACH(pExpr, pList) { + if (nodesEqualNode(pExpr, pNode)) { + return true; + } + } + return false; +} static EDealRes needFillValueImpl(SNode* pNode, void* pContext) { - SPartFillExprsCtx *pCtx = pContext; + SWalkFillSubExprCtx *pCtx = pContext; + EDealRes res = DEAL_RES_CONTINUE; if (QUERY_NODE_COLUMN == nodeType(pNode)) { SColumnNode* pCol = (SColumnNode*)pNode; if (COLUMN_TYPE_WINDOW_START == pCol->colType || COLUMN_TYPE_WINDOW_END == pCol->colType || COLUMN_TYPE_WINDOW_DURATION == pCol->colType) { pCtx->hasPseudoWinCol = true; - pCtx->code = taosHashPut(pCtx->pPseudoCols, pCol->colName, TSDB_COL_NAME_LEN, &pNode, POINTER_BYTES); - } else if (COLUMN_TYPE_GROUP_KEY == pCol->colType || COLUMN_TYPE_TBNAME == pCol->colType || COLUMN_TYPE_TAG == pCol->colType) { + pCtx->code = + taosHashPut(pCtx->pCollectFillCtx->pPseudoCols, pCol->colName, TSDB_COL_NAME_LEN, &pNode, POINTER_BYTES); + } else if (COLUMN_TYPE_GROUP_KEY == pCol->colType || COLUMN_TYPE_TBNAME == pCol->colType || + COLUMN_TYPE_TAG == pCol->colType) { pCtx->hasGroupKeyCol = true; - pCtx->code = taosHashPut(pCtx->pPseudoCols, pCol->colName, TSDB_COL_NAME_LEN, &pNode, POINTER_BYTES); + pCtx->code = + taosHashPut(pCtx->pCollectFillCtx->pPseudoCols, pCol->colName, TSDB_COL_NAME_LEN, &pNode, POINTER_BYTES); } else { pCtx->hasFillCol = true; - return DEAL_RES_END; + if (pCtx->pCollectFillCtx->collectAggFuncs) { + // Agg funcs has already been rewriten to columns by Interval + // Here, we return DEAL_RES_CONTINUE cause we need to collect all agg funcs + if (!nodeAlreadyContained(pCtx->pCollectFillCtx->pFillExprs, pNode) && + !nodeAlreadyContained(pCtx->pCollectFillCtx->pAggFuncCols, pNode)) + pCtx->code = nodesListMakeStrictAppend(&pCtx->pCollectFillCtx->pAggFuncCols, pNode); + } else { + res = DEAL_RES_END; + } } } - return DEAL_RES_CONTINUE; + if (pCtx->code != TSDB_CODE_SUCCESS) res = DEAL_RES_ERROR; + return res; } -static void needFillValue(SNode* pNode, SPartFillExprsCtx* pCtx) { +static void needFillValue(SNode* pNode, SWalkFillSubExprCtx* pCtx) { nodesWalkExpr(pNode, needFillValueImpl, pCtx); } -typedef struct SCollectFillExprsCtx { - SHashObj* pPseudoCols; - int32_t code; - SNodeList* pFillExprs; - SNodeList* pNotFillExprs; - bool skipFillCols; -} SCollectFillExprsCtx; - -static EDealRes collectFillExpr(SNode* pNode, void* pContext) { - SCollectFillExprsCtx* pCollectFillCtx = pContext; - SPartFillExprsCtx partFillCtx = {0}; +static int32_t collectFillExpr(SNode* pNode, SCollectFillExprsCtx* pCollectFillCtx) { SNode* pNew = NULL; - partFillCtx.pPseudoCols = pCollectFillCtx->pPseudoCols; - needFillValue(pNode, &partFillCtx); - if (partFillCtx.code != TSDB_CODE_SUCCESS) { - pCollectFillCtx->code = partFillCtx.code; - return DEAL_RES_ERROR; + SWalkFillSubExprCtx collectFillSubExprCtx = { + .hasFillCol = false, .hasPseudoWinCol = false, .hasGroupKeyCol = false, .pCollectFillCtx = pCollectFillCtx}; + needFillValue(pNode, &collectFillSubExprCtx); + if (collectFillSubExprCtx.code != TSDB_CODE_SUCCESS) { + return collectFillSubExprCtx.code; } - if (partFillCtx.hasFillCol && !pCollectFillCtx->skipFillCols) { + if (collectFillSubExprCtx.hasFillCol && !pCollectFillCtx->collectAggFuncs) { if (nodeType(pNode) == QUERY_NODE_ORDER_BY_EXPR) { - pCollectFillCtx->code = nodesCloneNode(((SOrderByExprNode*)pNode)->pExpr, &pNew); + collectFillSubExprCtx.code = nodesCloneNode(((SOrderByExprNode*)pNode)->pExpr, &pNew); } else { - pCollectFillCtx->code = nodesCloneNode(pNode, &pNew); + collectFillSubExprCtx.code = nodesCloneNode(pNode, &pNew); } - if (pCollectFillCtx->code == TSDB_CODE_SUCCESS) { - pCollectFillCtx->code = nodesListMakeStrictAppend(&pCollectFillCtx->pFillExprs, pNew); + if (collectFillSubExprCtx.code == TSDB_CODE_SUCCESS) { + collectFillSubExprCtx.code = nodesListMakeStrictAppend(&pCollectFillCtx->pFillExprs, pNew); } - if (pCollectFillCtx->code != TSDB_CODE_SUCCESS) return DEAL_RES_ERROR; - return DEAL_RES_IGNORE_CHILD; } - return DEAL_RES_CONTINUE; + return collectFillSubExprCtx.code; } -static int32_t collectFillExprs(SSelectStmt* pSelect, SNodeList** pFillExprs, SNodeList** pNotFillExprs) { - int32_t code = TSDB_CODE_SUCCESS; +static int32_t collectFillExprs(SSelectStmt* pSelect, SNodeList** pFillExprs, SNodeList** pNotFillExprs, + SNodeList** pPossibleFillNullCols) { + int32_t code = TSDB_CODE_SUCCESS; SCollectFillExprsCtx collectFillCtx = {0}; + SNode* pNode = NULL; collectFillCtx.pPseudoCols = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK); if (!collectFillCtx.pPseudoCols) return terrno; - if (collectFillCtx.code == TSDB_CODE_SUCCESS) { - nodesWalkExprs(pSelect->pProjectionList, collectFillExpr, &collectFillCtx); + FOREACH(pNode, pSelect->pProjectionList) { + code = collectFillExpr(pNode, &collectFillCtx); + if (code != TSDB_CODE_SUCCESS) break; } - if (collectFillCtx.code == TSDB_CODE_SUCCESS) { - collectFillCtx.skipFillCols = true; - nodesWalkExpr(pSelect->pHaving, collectFillExpr, &collectFillCtx); + collectFillCtx.collectAggFuncs = true; + if (code == TSDB_CODE_SUCCESS) { + code = collectFillExpr(pSelect->pHaving, &collectFillCtx); } - if (collectFillCtx.code == TSDB_CODE_SUCCESS) { - nodesWalkExprs(pSelect->pGroupByList, collectFillExpr, &collectFillCtx); - } - if (collectFillCtx.code == TSDB_CODE_SUCCESS) { - nodesWalkExprs(pSelect->pOrderByList, collectFillExpr, &collectFillCtx); + if (code == TSDB_CODE_SUCCESS) { + FOREACH(pNode, pSelect->pOrderByList) { + code = collectFillExpr(pNode, &collectFillCtx); + if (code != TSDB_CODE_SUCCESS) break; + } } - if (collectFillCtx.code == TSDB_CODE_SUCCESS) { + if (code == TSDB_CODE_SUCCESS) { void* pIter = taosHashIterate(collectFillCtx.pPseudoCols, 0); while (pIter) { SNode* pNode = *(SNode**)pIter, *pNew = NULL; - collectFillCtx.code = nodesCloneNode(pNode, &pNew); - if (collectFillCtx.code == TSDB_CODE_SUCCESS) { - collectFillCtx.code = nodesListMakeStrictAppend(&collectFillCtx.pNotFillExprs, pNew); + code = nodesCloneNode(pNode, &pNew); + if (code == TSDB_CODE_SUCCESS) { + code = nodesListMakeStrictAppend(&collectFillCtx.pNotFillExprs, pNew); } - if (collectFillCtx.code == TSDB_CODE_SUCCESS) { + if (code == TSDB_CODE_SUCCESS) { pIter = taosHashIterate(collectFillCtx.pPseudoCols, pIter); } else { taosHashCancelIterate(collectFillCtx.pPseudoCols, pIter); break; } } - if (collectFillCtx.code == TSDB_CODE_SUCCESS) { + if (code == TSDB_CODE_SUCCESS) { TSWAP(*pFillExprs, collectFillCtx.pFillExprs); TSWAP(*pNotFillExprs, collectFillCtx.pNotFillExprs); + TSWAP(*pPossibleFillNullCols, collectFillCtx.pAggFuncCols); } } - if (collectFillCtx.code != TSDB_CODE_SUCCESS) { + if (code != TSDB_CODE_SUCCESS) { if (collectFillCtx.pFillExprs) nodesDestroyList(collectFillCtx.pFillExprs); if (collectFillCtx.pNotFillExprs) nodesDestroyList(collectFillCtx.pNotFillExprs); + if (collectFillCtx.pAggFuncCols) nodesDestroyList(collectFillCtx.pAggFuncCols); } taosHashCleanup(collectFillCtx.pPseudoCols); return code; } -static bool nodeAlreadyContained(SNodeList* pList, SNode* pNode) { - SNode* pExpr = NULL; - FOREACH(pExpr, pList) { - if (nodesEqualNode(pExpr, pNode)) { - return true; - } - } - return false; -} - static int32_t createFillLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect, SLogicNode** pLogicNode) { if (NULL == pSelect->pWindow || QUERY_NODE_INTERVAL_WINDOW != nodeType(pSelect->pWindow) || NULL == ((SIntervalWindowNode*)pSelect->pWindow)->pFill) { @@ -1340,33 +1354,15 @@ static int32_t createFillLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect pFill->node.resultDataOrder = pFill->node.requireDataOrder; pFill->node.inputTsOrder = TSDB_ORDER_ASC; - code = collectFillExprs(pSelect, &pFill->pFillExprs, &pFill->pNotFillExprs); + code = collectFillExprs(pSelect, &pFill->pFillExprs, &pFill->pNotFillExprs, &pFill->pFillNullExprs); if (TSDB_CODE_SUCCESS == code) { code = rewriteExprsForSelect(pFill->pFillExprs, pSelect, SQL_CLAUSE_FILL, NULL); } if (TSDB_CODE_SUCCESS == code) { code = rewriteExprsForSelect(pFill->pNotFillExprs, pSelect, SQL_CLAUSE_FILL, NULL); } - SNodeList* pWindowTargets = NULL; - if (TSDB_CODE_SUCCESS == code) { - SNode* pNode = NULL, *pNodeNew = NULL; - FOREACH(pNode, pCxt->pCurrRoot->pTargets) { - if (nodesEqualNode(pNode, pFillNode->pWStartTs)) continue; - if (nodeAlreadyContained(pFill->pFillExprs, pNode)) continue; - if (nodeAlreadyContained(pFill->pNotFillExprs, pNode)) continue; - pNodeNew = NULL; - code = nodesCloneNode(pNode, &pNodeNew); - if (TSDB_CODE_SUCCESS == code) { - code = nodesListMakeStrictAppend(&pWindowTargets, pNodeNew); - } - if (TSDB_CODE_SUCCESS != code) { - nodesDestroyList(pWindowTargets); - break; - } - } - } - if (TSDB_CODE_SUCCESS == code && LIST_LENGTH(pWindowTargets) > 0) { - code = nodesListMakeStrictAppendList(&pFill->pFillExprs, pWindowTargets); + if (TSDB_CODE_SUCCESS == code && LIST_LENGTH(pFill->pFillNullExprs) > 0) { + code = createColumnByRewriteExprs(pFill->pFillNullExprs, &pFill->node.pTargets); } if (TSDB_CODE_SUCCESS == code) { code = createColumnByRewriteExprs(pFill->pFillExprs, &pFill->node.pTargets); diff --git a/source/libs/planner/src/planPhysiCreater.c b/source/libs/planner/src/planPhysiCreater.c index a00eb05482c2..9a4a4f5055dc 100644 --- a/source/libs/planner/src/planPhysiCreater.c +++ b/source/libs/planner/src/planPhysiCreater.c @@ -2512,6 +2512,12 @@ static int32_t createFillPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pChildren if (TSDB_CODE_SUCCESS == code) { code = addDataBlockSlots(pCxt, pFill->pNotFillExprs, pFill->node.pOutputDataBlockDesc); } + if (TSDB_CODE_SUCCESS == code && LIST_LENGTH(pFillNode->pFillNullExprs) > 0) { + code = setListSlotId(pCxt, pChildTupe->dataBlockId, -1, pFillNode->pFillNullExprs, &pFill->pFillNullExprs); + if (TSDB_CODE_SUCCESS == code ) { + code = addDataBlockSlots(pCxt, pFill->pFillNullExprs, pFill->node.pOutputDataBlockDesc); + } + } if (TSDB_CODE_SUCCESS == code) { code = setNodeSlotId(pCxt, pChildTupe->dataBlockId, -1, pFillNode->pWStartTs, &pFill->pWStartTs); diff --git a/tests/system-test/2-query/fill_with_group.py b/tests/system-test/2-query/fill_with_group.py index b48143db1592..49c3b5dcf8c2 100644 --- a/tests/system-test/2-query/fill_with_group.py +++ b/tests/system-test/2-query/fill_with_group.py @@ -295,10 +295,14 @@ def test_fill_with_complex_expr(self): tdSql.query(sql, queryTimes=1) tdSql.checkRows(48) - sql = "SELECT count(*) FROM meters WHERE ts >= '2018-09-20 00:00:00.000' AND ts < '2018-09-20 01:00:00.000' PARTITION BY tbname, t1 INTERVAL(5m) FILL(NULL) having(timediff(last(ts), _wstart) >= 0)" + sql = "SELECT count(*) FROM meters WHERE ts >= '2018-09-20 00:00:00.000' AND ts < '2018-09-20 01:00:00.000' PARTITION BY tbname, t1 INTERVAL(5m) FILL(NULL) HAVING(timediff(last(ts), _wstart) >= 0)" tdSql.query(sql, queryTimes=1) tdSql.checkRows(60) + sql = "SELECT count(*) + 1 FROM meters WHERE ts >= '2018-09-20 00:00:00.000' AND ts < '2018-09-20 01:00:00.000' PARTITION BY tbname, t1 INTERVAL(5m) FILL(NULL) HAVING(count(*) > 1)" + tdSql.query(sql, queryTimes=1) + tdSql.checkRows(0) + def run(self): self.prepareTestEnv() self.test_partition_by_with_interval_fill_prev_new_group_fill_error() From e8835c2caa0004dc5db18983ce074a389a90cd34 Mon Sep 17 00:00:00 2001 From: xsren <285808407@qq.com> Date: Wed, 23 Oct 2024 15:37:49 +0800 Subject: [PATCH 202/695] blockDataCheck --- include/common/tdatablock.h | 2 +- include/common/tglobal.h | 7 +++- source/common/src/tdatablock.c | 39 ++++++++++++------- source/common/src/tglobal.c | 16 ++++---- source/libs/executor/src/dataDispatcher.c | 2 +- .../libs/executor/src/dynqueryctrloperator.c | 7 +++- source/libs/executor/src/executor.c | 13 +++++-- source/libs/executor/src/executorInt.c | 9 +++-- source/libs/executor/src/groupcacheoperator.c | 2 +- source/libs/executor/src/mergeoperator.c | 10 +++-- source/libs/executor/src/operator.c | 20 +++++++--- source/libs/executor/src/sortoperator.c | 11 ++++-- tests/pytest/util/dnodes.py | 4 +- 13 files changed, 93 insertions(+), 49 deletions(-) diff --git a/include/common/tdatablock.h b/include/common/tdatablock.h index c6f0b4d51778..3b24ef9490c8 100644 --- a/include/common/tdatablock.h +++ b/include/common/tdatablock.h @@ -233,7 +233,7 @@ int32_t blockDataSort(SSDataBlock* pDataBlock, SArray* pOrderInfo); * @brief find how many rows already in order start from first row */ int32_t blockDataGetSortedRows(SSDataBlock* pDataBlock, SArray* pOrderInfo); -void blockDataCheck(const SSDataBlock* pDataBlock, bool forceChk); +int32_t blockDataCheck(const SSDataBlock* pDataBlock); int32_t colInfoDataEnsureCapacity(SColumnInfoData* pColumn, uint32_t numOfRows, bool clearPayload); int32_t blockDataEnsureCapacity(SSDataBlock* pDataBlock, uint32_t numOfRows); diff --git a/include/common/tglobal.h b/include/common/tglobal.h index a13693d38c39..5a52abe9ee32 100644 --- a/include/common/tglobal.h +++ b/include/common/tglobal.h @@ -153,7 +153,12 @@ extern bool tsEnableCrashReport; extern char *tsTelemUri; extern char *tsClientCrashReportUri; extern char *tsSvrCrashReportUri; -extern bool tsEnableSafetyCheck; +extern int8_t tsSafetyCheckLevel; +enum { + TSDB_SAFETY_CHECK_LEVELL_NEVER = 0, + TSDB_SAFETY_CHECK_LEVELL_NORMAL = 1, + TSDB_SAFETY_CHECK_LEVELL_BYROW = 2, +}; // query buffer management extern int32_t tsQueryBufferSize; // maximum allowed usage buffer size in MB for each data node during query processing diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c index 23efe48209ff..57df4a600612 100644 --- a/source/common/src/tdatablock.c +++ b/source/common/src/tdatablock.c @@ -18,6 +18,7 @@ #include "tcompare.h" #include "tlog.h" #include "tname.h" +#include "tglobal.h" #define MALLOC_ALIGN_BYTES 32 @@ -3042,7 +3043,11 @@ int32_t buildCtbNameByGroupIdImpl(const char* stbFullName, uint64_t groupId, cha // return length of encoded data, return -1 if failed int32_t blockEncode(const SSDataBlock* pBlock, char* data, size_t dataBuflen, int32_t numOfCols) { - blockDataCheck(pBlock, false); + int32_t code = blockDataCheck(pBlock); + if (code != TSDB_CODE_SUCCESS) { + terrno = code; + return -1; + } int32_t dataLen = 0; @@ -3297,9 +3302,13 @@ int32_t blockDecode(SSDataBlock* pBlock, const char* pData, const char** pEndPos *pEndPos = pStart; - blockDataCheck(pBlock, false); + code = blockDataCheck(pBlock); + if (code != TSDB_CODE_SUCCESS) { + terrno = code; + return code; + } - return code; + return TSDB_CODE_SUCCESS; } int32_t trimDataBlock(SSDataBlock* pBlock, int32_t totalRows, const bool* pBoolList) { @@ -3509,20 +3518,19 @@ int32_t blockDataGetSortedRows(SSDataBlock* pDataBlock, SArray* pOrderInfo) { return nextRowIdx; } -void blockDataCheck(const SSDataBlock* pDataBlock, bool forceChk) { - return; - - if (NULL == pDataBlock || pDataBlock->info.rows == 0) { - return; +#define BLOCK_DATA_CHECK_TRESSA(o) \ + if (!(o)) { \ + uError("blockDataCheck failed! line:%d", __LINE__); \ + return TSDB_CODE_INTERNAL_ERROR; \ + } +int32_t blockDataCheck(const SSDataBlock* pDataBlock) { + if (tsSafetyCheckLevel == TSDB_SAFETY_CHECK_LEVELL_NEVER || NULL == pDataBlock || pDataBlock->info.rows == 0) { + return TSDB_CODE_SUCCESS; } - -#define BLOCK_DATA_CHECK_TRESSA(o) ; -//#define BLOCK_DATA_CHECK_TRESSA(o) A S S E R T(o) BLOCK_DATA_CHECK_TRESSA(pDataBlock->info.rows > 0); - - if (!pDataBlock->info.dataLoad && !forceChk) { - return; + if (!pDataBlock->info.dataLoad) { + return TSDB_CODE_SUCCESS; } bool isVarType = false; @@ -3544,6 +3552,7 @@ void blockDataCheck(const SSDataBlock* pDataBlock, bool forceChk) { nextPos = 0; for (int64_t r = 0; r < checkRows; ++r) { + if (tsSafetyCheckLevel <= TSDB_SAFETY_CHECK_LEVELL_NORMAL) break; if (!colDataIsNull_s(pCol, r)) { BLOCK_DATA_CHECK_TRESSA(pCol->pData); BLOCK_DATA_CHECK_TRESSA(pCol->varmeta.length <= pCol->varmeta.allocLen); @@ -3578,7 +3587,7 @@ void blockDataCheck(const SSDataBlock* pDataBlock, bool forceChk) { } } - return; + return TSDB_CODE_SUCCESS; } diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index 87cf1d758701..6b222b15ab8b 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -137,9 +137,9 @@ bool tsEnableCrashReport = false; #else bool tsEnableCrashReport = true; #endif -char *tsClientCrashReportUri = "/ccrashreport"; -char *tsSvrCrashReportUri = "/dcrashreport"; -bool tsEnableSafetyCheck = false; +char *tsClientCrashReportUri = "/ccrashreport"; +char *tsSvrCrashReportUri = "/dcrashreport"; +int8_t tsSafetyCheckLevel = TSDB_SAFETY_CHECK_LEVELL_NEVER; // schemaless bool tsSmlDot2Underline = true; @@ -608,7 +608,7 @@ static int32_t taosAddClientCfg(SConfig *pCfg) { TAOS_CHECK_RETURN( cfgAddInt64(pCfg, "randErrorDivisor", tsRandErrDivisor, 1, INT64_MAX, CFG_SCOPE_BOTH, CFG_DYN_BOTH)); TAOS_CHECK_RETURN(cfgAddInt64(pCfg, "randErrorScope", tsRandErrScope, 0, INT64_MAX, CFG_SCOPE_BOTH, CFG_DYN_BOTH)); - TAOS_CHECK_RETURN(cfgAddBool(pCfg, "enableSafetyCheck", tsEnableSafetyCheck, CFG_SCOPE_BOTH, CFG_DYN_BOTH)); + TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "safetyCheckLevel", tsSafetyCheckLevel, 0, 5, CFG_SCOPE_BOTH, CFG_DYN_BOTH)); tsNumOfRpcThreads = tsNumOfCores / 2; tsNumOfRpcThreads = TRANGE(tsNumOfRpcThreads, 1, TSDB_MAX_RPC_THREADS); @@ -1302,8 +1302,8 @@ static int32_t taosSetClientCfg(SConfig *pCfg) { TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "tsmaDataDeleteMark"); tsmaDataDeleteMark = pItem->i32; - TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "enableSafetyCheck"); - tsEnableSafetyCheck = pItem->bval; + TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "safetyCheckLevel"); + tsSafetyCheckLevel = pItem->i32; TAOS_RETURN(TSDB_CODE_SUCCESS); } @@ -2045,7 +2045,7 @@ static int32_t taosCfgDynamicOptionsForServer(SConfig *pCfg, const char *name) { {"supportVnodes", &tsNumOfSupportVnodes}, {"experimental", &tsExperimental}, {"maxTsmaNum", &tsMaxTsmaNum}, - {"enableSafetyCheck", &tsEnableSafetyCheck}}; + {"safetyCheckLevel", &tsSafetyCheckLevel}}; if ((code = taosCfgSetOption(debugOptions, tListLen(debugOptions), pItem, true)) != TSDB_CODE_SUCCESS) { code = taosCfgSetOption(options, tListLen(options), pItem, false); @@ -2302,7 +2302,7 @@ static int32_t taosCfgDynamicOptionsForClient(SConfig *pCfg, const char *name) { {"multiResultFunctionStarReturnTags", &tsMultiResultFunctionStarReturnTags}, {"maxTsmaCalcDelay", &tsMaxTsmaCalcDelay}, {"tsmaDataDeleteMark", &tsmaDataDeleteMark}, - {"enableSafetyCheck", &tsEnableSafetyCheck}}; + {"safetyCheckLevel", &tsSafetyCheckLevel}}; if ((code = taosCfgSetOption(debugOptions, tListLen(debugOptions), pItem, true)) != TSDB_CODE_SUCCESS) { code = taosCfgSetOption(options, tListLen(options), pItem, false); diff --git a/source/libs/executor/src/dataDispatcher.c b/source/libs/executor/src/dataDispatcher.c index 732b2566a923..236d6a4d3ee3 100644 --- a/source/libs/executor/src/dataDispatcher.c +++ b/source/libs/executor/src/dataDispatcher.c @@ -55,7 +55,7 @@ typedef struct SDataDispatchHandle { } SDataDispatchHandle; static int32_t inputSafetyCheck(SDataDispatchHandle* pHandle, const SInputData* pInput) { - if(!tsEnableSafetyCheck) { + if(tsSafetyCheckLevel == TSDB_SAFETY_CHECK_LEVELL_NEVER) { return TSDB_CODE_SUCCESS; } if (pInput == NULL || pInput->pData == NULL || pInput->pData->info.rows <= 0) { diff --git a/source/libs/executor/src/dynqueryctrloperator.c b/source/libs/executor/src/dynqueryctrloperator.c index eb49057d8907..62f199387ef8 100644 --- a/source/libs/executor/src/dynqueryctrloperator.c +++ b/source/libs/executor/src/dynqueryctrloperator.c @@ -528,7 +528,12 @@ static void seqJoinLaunchNewRetrieveImpl(SOperatorInfo* pOperator, SSDataBlock** qDebug("%s dynamic post task begin", GET_TASKID(pOperator->pTaskInfo)); code = pOperator->pDownstream[1]->fpSet.getNextExtFn(pOperator->pDownstream[1], pParam, ppRes); if (*ppRes && (code == 0)) { - blockDataCheck(*ppRes, false); + code = blockDataCheck(*ppRes); + if (code) { + qError("Invalid block data, blockDataCheck failed, error:%s", tstrerror(code)); + pOperator->pTaskInfo->code = code; + T_LONG_JMP(pOperator->pTaskInfo->env, pOperator->pTaskInfo->code); + } pPost->isStarted = true; pStbJoin->execInfo.postBlkNum++; pStbJoin->execInfo.postBlkRows += (*ppRes)->info.rows; diff --git a/source/libs/executor/src/executor.c b/source/libs/executor/src/executor.c index 27dd687f40fd..632daf0aa08c 100644 --- a/source/libs/executor/src/executor.c +++ b/source/libs/executor/src/executor.c @@ -699,12 +699,12 @@ int32_t qExecTaskOpt(qTaskInfo_t tinfo, SArray* pResList, uint64_t* useconds, bo if (pTaskInfo->pOpParam && !pTaskInfo->paramSet) { pTaskInfo->paramSet = true; code = pTaskInfo->pRoot->fpSet.getNextExtFn(pTaskInfo->pRoot, pTaskInfo->pOpParam, &pRes); - blockDataCheck(pRes, false); } else { code = pTaskInfo->pRoot->fpSet.getNextFn(pTaskInfo->pRoot, &pRes); - blockDataCheck(pRes, false); } + QUERY_CHECK_CODE(code, lino, _end); + code = blockDataCheck(pRes); QUERY_CHECK_CODE(code, lino, _end); if (pRes == NULL) { @@ -749,7 +749,8 @@ int32_t qExecTaskOpt(qTaskInfo_t tinfo, SArray* pResList, uint64_t* useconds, bo } code = pTaskInfo->pRoot->fpSet.getNextFn(pTaskInfo->pRoot, &pRes); - blockDataCheck(pRes, false); + QUERY_CHECK_CODE(code, lino, _end); + code = blockDataCheck(pRes); QUERY_CHECK_CODE(code, lino, _end); } @@ -848,7 +849,11 @@ int32_t qExecTask(qTaskInfo_t tinfo, SSDataBlock** pRes, uint64_t* useconds) { qError("%s failed at line %d, code:%s %s", __func__, __LINE__, tstrerror(code), GET_TASKID(pTaskInfo)); } - blockDataCheck(*pRes, false); + code = blockDataCheck(*pRes); + if (code) { + pTaskInfo->code = code; + qError("%s failed at line %d, code:%s %s", __func__, __LINE__, tstrerror(code), GET_TASKID(pTaskInfo)); + } uint64_t el = (taosGetTimestampUs() - st); diff --git a/source/libs/executor/src/executorInt.c b/source/libs/executor/src/executorInt.c index 64a07c465371..b39cf4014d5f 100644 --- a/source/libs/executor/src/executorInt.c +++ b/source/libs/executor/src/executorInt.c @@ -616,11 +616,12 @@ int32_t doFilter(SSDataBlock* pBlock, SFilterInfo* pFilterInfo, SColMatchInfo* p } } } - code = TSDB_CODE_SUCCESS; - + code = blockDataCheck(pBlock); + QUERY_CHECK_CODE(code, lino, _err); _err: - blockDataCheck(pBlock, true); - + if (code != TSDB_CODE_SUCCESS) { + qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } colDataDestroy(p); taosMemoryFree(p); return code; diff --git a/source/libs/executor/src/groupcacheoperator.c b/source/libs/executor/src/groupcacheoperator.c index 10b372319b3d..d47ab366b615 100644 --- a/source/libs/executor/src/groupcacheoperator.c +++ b/source/libs/executor/src/groupcacheoperator.c @@ -765,7 +765,7 @@ static FORCE_INLINE int32_t getBlkFromDownstreamOperator(struct SOperatorInfo* p } } - blockDataCheck(pBlock, false); + code = blockDataCheck(pBlock); *ppRes = pBlock; return code; diff --git a/source/libs/executor/src/mergeoperator.c b/source/libs/executor/src/mergeoperator.c index 7fd6b91e522b..4a288a277b87 100644 --- a/source/libs/executor/src/mergeoperator.c +++ b/source/libs/executor/src/mergeoperator.c @@ -65,11 +65,14 @@ static int32_t sortMergeloadNextDataBlock(void* param, SSDataBlock** ppBlock); int32_t sortMergeloadNextDataBlock(void* param, SSDataBlock** ppBlock) { SOperatorInfo* pOperator = (SOperatorInfo*)param; - int32_t code = pOperator->fpSet.getNextFn(pOperator, ppBlock); - blockDataCheck(*ppBlock, false); + int32_t code = pOperator->fpSet.getNextFn(pOperator, ppBlock); if (code) { qError("failed to get next data block from upstream, %s code:%s", __func__, tstrerror(code)); } + blockDataCheck(*ppBlock); + if (code) { + qError("failed to check data block got from upstream, %s code:%s", __func__, tstrerror(code)); + } return code; } @@ -526,7 +529,8 @@ int32_t doMultiwayMerge(SOperatorInfo* pOperator, SSDataBlock** pResBlock) { if ((*pResBlock) != NULL) { pOperator->resultInfo.totalRows += (*pResBlock)->info.rows; - blockDataCheck(*pResBlock, false); + code = blockDataCheck(*pResBlock); + QUERY_CHECK_CODE(code, lino, _end); } else { setOperatorCompleted(pOperator); } diff --git a/source/libs/executor/src/operator.c b/source/libs/executor/src/operator.c index 7914f9f32025..f88b544b0fd1 100644 --- a/source/libs/executor/src/operator.c +++ b/source/libs/executor/src/operator.c @@ -870,15 +870,25 @@ int32_t setOperatorParams(struct SOperatorInfo* pOperator, SOperatorParam* pInpu SSDataBlock* getNextBlockFromDownstream(struct SOperatorInfo* pOperator, int32_t idx) { SSDataBlock* p = NULL; - int32_t code = getNextBlockFromDownstreamImpl(pOperator, idx, true, &p); - blockDataCheck(p, false); - return (code == 0)? p:NULL; + int32_t code = getNextBlockFromDownstreamImpl(pOperator, idx, true, &p); + if (code == TSDB_CODE_SUCCESS) { + code = blockDataCheck(p); + if (code != TSDB_CODE_SUCCESS) { + qError("blockDataCheck failed, code:%s", tstrerror(code)); + } + } + return (code == 0) ? p : NULL; } SSDataBlock* getNextBlockFromDownstreamRemain(struct SOperatorInfo* pOperator, int32_t idx) { SSDataBlock* p = NULL; - int32_t code = getNextBlockFromDownstreamImpl(pOperator, idx, false, &p); - blockDataCheck(p, false); + int32_t code = getNextBlockFromDownstreamImpl(pOperator, idx, false, &p); + if (code == TSDB_CODE_SUCCESS) { + code = blockDataCheck(p); + if (code != TSDB_CODE_SUCCESS) { + qError("blockDataCheck failed, code:%s", tstrerror(code)); + } + } return (code == 0)? p:NULL; } diff --git a/source/libs/executor/src/sortoperator.c b/source/libs/executor/src/sortoperator.c index 1c241dffec2f..a6ca20c5ee7b 100644 --- a/source/libs/executor/src/sortoperator.c +++ b/source/libs/executor/src/sortoperator.c @@ -334,10 +334,14 @@ static int32_t getSortedBlockData(SSortHandle* pHandle, SSDataBlock* pDataBlock, int32_t loadNextDataBlock(void* param, SSDataBlock** ppBlock) { SOperatorInfo* pOperator = (SOperatorInfo*)param; - int32_t code = pOperator->fpSet.getNextFn(pOperator, ppBlock); - blockDataCheck(*ppBlock, false); + int32_t code = pOperator->fpSet.getNextFn(pOperator, ppBlock); if (code) { qError("failed to get next data block from upstream, %s code:%s", __func__, tstrerror(code)); + } else { + code = blockDataCheck(*ppBlock); + if (code) { + qError("failed to check block data, %s code:%s", __func__, tstrerror(code)); + } } return code; } @@ -630,7 +634,8 @@ int32_t fetchNextGroupSortDataBlock(void* param, SSDataBlock** ppBlock) { QUERY_CHECK_CODE(code, lino, _end); if (block != NULL) { - blockDataCheck(block, false); + code = blockDataCheck(block); + QUERY_CHECK_CODE(code, lino, _end); if (block->info.id.groupId == grpSortOpInfo->currGroupId) { grpSortOpInfo->childOpStatus = CHILD_OP_SAME_GROUP; *ppBlock = block; diff --git a/tests/pytest/util/dnodes.py b/tests/pytest/util/dnodes.py index 7a836c181b7a..383253021810 100644 --- a/tests/pytest/util/dnodes.py +++ b/tests/pytest/util/dnodes.py @@ -48,7 +48,7 @@ def __init__(self, path): "telemetryReporting": "0", "tqDebugflag": "135", "stDebugflag":"135", - "enableSafetyCheck":"1" + "safetyCheckLevel":"2" } def getLogDir(self): @@ -151,7 +151,7 @@ def __init__(self, index): "enableQueryHb": "1", "supportVnodes": "1024", "telemetryReporting": "0", - "enableSafetyCheck":"1" + "safetyCheckLevel":"2" } def init(self, path, remoteIP = ""): From 1e8565eca839a2476133f22b9f9adb86a07e5bc4 Mon Sep 17 00:00:00 2001 From: xsren <285808407@qq.com> Date: Wed, 23 Oct 2024 15:51:46 +0800 Subject: [PATCH 203/695] fix: check return value --- source/libs/executor/src/mergeoperator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/executor/src/mergeoperator.c b/source/libs/executor/src/mergeoperator.c index 4a288a277b87..0dfe89e10e4b 100644 --- a/source/libs/executor/src/mergeoperator.c +++ b/source/libs/executor/src/mergeoperator.c @@ -69,7 +69,7 @@ int32_t sortMergeloadNextDataBlock(void* param, SSDataBlock** ppBlock) { if (code) { qError("failed to get next data block from upstream, %s code:%s", __func__, tstrerror(code)); } - blockDataCheck(*ppBlock); + code = blockDataCheck(*ppBlock); if (code) { qError("failed to check data block got from upstream, %s code:%s", __func__, tstrerror(code)); } From 0e6493d85d8b024b6d6bca8438ecc79b88d8045f Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Wed, 23 Oct 2024 15:55:33 +0800 Subject: [PATCH 204/695] enh(s3/default param value): new default values from s3 params --- include/util/tdef.h | 4 ++-- source/common/src/tglobal.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/util/tdef.h b/include/util/tdef.h index a0bfdc83f5be..800cdfbd39a0 100644 --- a/include/util/tdef.h +++ b/include/util/tdef.h @@ -453,10 +453,10 @@ typedef enum ELogicConditionType { #define TSDB_DEFAULT_S3_CHUNK_SIZE (256 * 1024) #define TSDB_MIN_S3_KEEP_LOCAL (1 * 1440) // unit minute #define TSDB_MAX_S3_KEEP_LOCAL (365000 * 1440) -#define TSDB_DEFAULT_S3_KEEP_LOCAL (3650 * 1440) +#define TSDB_DEFAULT_S3_KEEP_LOCAL (365 * 1440) #define TSDB_MIN_S3_COMPACT 0 #define TSDB_MAX_S3_COMPACT 1 -#define TSDB_DEFAULT_S3_COMPACT 0 +#define TSDB_DEFAULT_S3_COMPACT 1 #define TSDB_DB_MIN_WAL_RETENTION_PERIOD -1 #define TSDB_REP_DEF_DB_WAL_RET_PERIOD 3600 diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index 488b94eb2015..fb118cb75c4f 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -287,7 +287,7 @@ int32_t tsTtlUnit = 86400; int32_t tsTtlPushIntervalSec = 10; int32_t tsTrimVDbIntervalSec = 60 * 60; // interval of trimming db in all vgroups int32_t tsS3MigrateIntervalSec = 60 * 60; // interval of s3migrate db in all vgroups -bool tsS3MigrateEnabled = 1; +bool tsS3MigrateEnabled = 0; int32_t tsGrantHBInterval = 60; int32_t tsUptimeInterval = 300; // seconds char tsUdfdResFuncs[512] = ""; // udfd resident funcs that teardown when udfd exits From e4547fd5a7f225c03c029e3a0be0f6f8b8153e23 Mon Sep 17 00:00:00 2001 From: chenhaoran Date: Wed, 23 Oct 2024 16:56:11 +0800 Subject: [PATCH 205/695] tetst:add testecase for clear consumer with session and poll timout --- tests/army/frame/common.py | 8 +- tests/army/tmq/drop_lost_comsumers.py | 267 ++++++++++++++++++++++++++ tests/army/tmq/per_consumer.py | 144 ++++++++++++++ tests/parallel_test/cases.task | 2 +- 4 files changed, 417 insertions(+), 4 deletions(-) create mode 100644 tests/army/tmq/drop_lost_comsumers.py create mode 100644 tests/army/tmq/per_consumer.py diff --git a/tests/army/frame/common.py b/tests/army/frame/common.py index b816095817f7..bad86c828f36 100644 --- a/tests/army/frame/common.py +++ b/tests/army/frame/common.py @@ -803,11 +803,13 @@ def getOneRow(self, location, containElm): else: tdLog.exit(f"getOneRow out of range: row_index={location} row_count={self.query_row}") - def killProcessor(self, processorName): + def kill_signal_process(self, signal=15, processor_name: str = "taosd"): if (platform.system().lower() == 'windows'): - os.system("TASKKILL /F /IM %s.exe"%processorName) + os.system(f"TASKKILL /F /IM {processor_name}.exe") else: - os.system("unset LD_PRELOAD; pkill %s " % processorName) + tdLog.debug(f"unset LD_PRELOAD; sudo pkill -f -{signal} '{processor_name}' ") + os.system(f"unset LD_PRELOAD; sudo pkill -f -{signal} '{processor_name}' ") + def gen_tag_col_str(self, gen_type, data_type, count): """ diff --git a/tests/army/tmq/drop_lost_comsumers.py b/tests/army/tmq/drop_lost_comsumers.py new file mode 100644 index 000000000000..b88aae8c037d --- /dev/null +++ b/tests/army/tmq/drop_lost_comsumers.py @@ -0,0 +1,267 @@ + +import taos +import sys +import time +import socket +import os +import threading +import multiprocessing +from multiprocessing import Process, Queue + +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * +from taos.tmq import * +from frame import etool +from datetime import datetime +from taos.tmq import Consumer +from frame.common import * + +class TaosConsumer: + def __init__(self): + pass + + def sub_consumer(self ,consumer ,group_id ,topic_name ): + group_id = int(group_id) + if group_id < 100 : + try: + consumer.subscribe([topic_name]) + except TmqError: + tdLog.exit(f"subscribe error") + nrows = 0 + while True: + start = datetime.now() + print(f"time:{start},consumer:{group_id}, start to consume") + message = consumer.poll(timeout=10.0) + + if message: + id = message.offset() + topic = message.topic() + database = message.database() + + for block in message: + addrows = block.nrows() + nrows += block.nrows() + ncols = block.ncols() + values = block.fetchall + end = datetime.now() + elapsed_time = end -start + print(f"time:{end},consumer:{group_id}, elapsed time:{elapsed_time},consumer_nrows:{nrows},consumer_addrows:{addrows}, consumer_ncols:{ncols},offset:{id}") + consumer.commit() + print(f"consumer:{group_id},consumer_nrows:{nrows}") + # consumer.unsubscribe() + # consumer.close() + # break + # if nrows >= 1000000: + # break + + def set_conf(self,td_connect_ip="localhost",group_id=1,client_id="test_consumer_py",enable_auto_commit="false",auto_commit_interval_ms="1000",auto_offset_reset="earliest",msg_with_table_name="true",session_timeout_ms=10000,max_poll_interval_ms=180000,experimental_snapshot_enable="false"): + conf = { + # auth options + # consume options + "td.connect.ip": f"{td_connect_ip}", + "group.id": f"{group_id}", + "client.id": f"{client_id}", + "enable.auto.commit": f"{enable_auto_commit}", + "auto.commit.interval.ms": f"{auto_commit_interval_ms}", + "auto.offset.reset": f"{auto_offset_reset}", + "msg.with.table.name": f"{msg_with_table_name}", + "session.timeout.ms": f"{session_timeout_ms}", + "max.poll.interval.ms": f"{max_poll_interval_ms}", + "experimental.snapshot.enable" :f"{experimental_snapshot_enable}", + } + return conf + + def sub_consumer_once(self,consumer, group_id, topic_name, counter, stop_event): + group_id = int(group_id) + if group_id < 100 : + consumer.subscribe([topic_name]) + nrows = 0 + consumer_nrows = 0 + + while not stop_event.is_set(): + start = datetime.now() + tdLog.info(f"time:{start},consumer:{group_id}, start to consume") + #start = datetime.now() + #print(f"time:{start},consumer:{group_id}, start to consume") + tdLog.info(f"consumer_nrows:{consumer_nrows}") + message = consumer.poll(timeout=10.0) + + if message: + id = message.offset() + topic = message.topic() + database = message.database() + for block in message: + addrows = block.nrows() + nrows += block.nrows() + counter.rows(block.nrows()) + ncols = block.ncols() + values = block.fetchall + end = datetime.now() + elapsed_time = end -start + # tdLog.info(f"time:{end},consumer:{group_id}, elapsed time:{elapsed_time},consumer_nrows:{nrows},consumer_addrows:{addrows}, consumer_ncols:{ncols},offset:{id}") + consumer.commit() + # tdLog.info(f"consumer:{group_id},consumer_nrows:{nrows}") + consumer_nrows = nrows + # consumer.unsubscribe() + # consumer.close() + # break + + print("Consumer subscription thread is stopping.") + def taosc_consumer(self, conf, topic_name, counter,stop_event): + try: + print(conf) + from taos.tmq import Consumer + print("3333") + consumer = Consumer(conf) + print("456") + group_id = int(conf["group.id"]) + tdLog.info(f"{consumer},{group_id}") + except Exception as e: + tdLog.exit(f"{e}") + #counsmer sub: + # while True: + # try: + # self.sub_consumer_once(consumer,group_id) + # except Exception as e: + # print(str(e)) + # time.sleep(1) + # break + # only consumer once + try: + self.sub_consumer_once(consumer, group_id, topic_name, counter, stop_event) + + except Exception as e: + tdLog.exit(f"{e}") + + #consumer.close() + + +class ThreadSafeCounter: + def __init__(self): + self.counter = 0 + self.lock = threading.Lock() + + def rows(self, rows): + with self.lock: + self.counter += rows + + def get(self): + with self.lock: + return self.counter + + +class TDTestCase: + # updatecfgDict = {'debugFlag': 135, 'asynclog': 0} + + + def init(self, conn, logSql, replicaVar=1): + self.replicaVar = int(replicaVar) + tdLog.debug(f"start to excute {__file__}") + tdSql.init(conn.cursor()) + self.consumer_instance = TaosConsumer() + #tdSql.init(conn.cursor(), logSql) # output sql.txt file + def caseDescription(self): + ''' + drop_lost_consmuers: + 1. verifying that the boundary and valid values of session_timeout_ms are in effect + 2. verifying that the boundary and valid values of max_poll_interval_ms are in effect + 3. verifying that consumer will be closed when the session_timeout_ms and max_poll_interval_ms is expired + ''' + return + + def check_consumer(self,count,rows): + time.sleep(count) + print(count) + try: + for ct in range(5): + tdSql.query(f'show consumers') + anser_rows=tdSql.getRows() + if tdSql.checkRows(rows): + break + else: + time.sleep(1) + tdLog.info(f"wait for {count} seconds to check that consumers number is {rows}") + if anser_rows != rows: + tdLog.exit(f"consumer number is not {rows}") + except Exception as e: + tdLog.exit(f"{e},check consumer error") + + def drop_session_timeout_consmuers(self, consumer_groups_num, session_timeout_ms, max_poll_interval_ms, topic_name, timeout): + tdSql.execute(f'drop topic if exists {topic_name};') + tdSql.execute(f'use db_sub') + tdSql.execute(f'create topic {topic_name} as select * from db_sub.meters;') + + # start consumer and config some parameters + os.system(f"nohup python3 ./tmq/per_consumer.py -c {consumer_groups_num} -s {session_timeout_ms} -p {max_poll_interval_ms} > consumer.log &") + # wait 4s for consuming data + time.sleep(4) + # kill consumer to simulate session_timeout_ms + tdLog.info("kill per_consumer.py") + tdCom.kill_signal_process(signal=9,processor_name="python3\s*./tmq/per_consumer.py") + self.check_consumer(timeout,0) + tdSql.execute(f'drop topic if exists {topic_name};') + os.system("rm -rf consumer.log") + + + def drop_max_poll_timeout_consmuers(self, consumer_groups_num, consumer_rows, topic_name, timeout): + tdSql.execute(f'drop topic if exists {topic_name};') + tdSql.execute(f'use db_sub') + tdSql.execute(f'create topic {topic_name} as select * from db_sub.meters;') + + threads = [] + counter = ThreadSafeCounter() + stop_event = threading.Event() + for id in range(consumer_groups_num): + conf = self.consumer_instance.set_conf(group_id=id, session_timeout_ms=self.session_timeout_ms, max_poll_interval_ms=self.max_poll_interval_ms) + threads.append(threading.Thread(target=self.consumer_instance.taosc_consumer, args=(conf, topic_name, counter, stop_event))) + for tr in threads: + tr.start() + + consumer_all_rows = consumer_rows * consumer_groups_num + while True: + if counter.get() < consumer_all_rows: + time.sleep(5) + print(f"consumer_all_rows:{consumer_all_rows},counter.get():{counter.get()}") + elif counter.get() >= consumer_all_rows: + self.check_consumer(timeout+20, 0) + stop_event.set() + tr.join() + break + time.sleep(2) + tdSql.execute(f'drop topic if exists {topic_name};') + + def case_session_12s(self): + #test session_timeout_ms=12s + session_timeout_ms=12000 + max_poll_interval_ms=180000 + topic_name = "select_d1" + self.drop_session_timeout_consmuers(consumer_groups_num=1, session_timeout_ms=session_timeout_ms, max_poll_interval_ms=max_poll_interval_ms, topic_name=topic_name , timeout=int(session_timeout_ms/1000)) + + + def case_max_poll_12s(self,consumer_rows): + #test max_poll_interval_ms=12s + self.session_timeout_ms=180000 + self.max_poll_interval_ms=12000 + topic_name = "select_d1" + self.drop_max_poll_timeout_consmuers(consumer_groups_num=1, topic_name=topic_name, consumer_rows=consumer_rows, timeout=int(self.max_poll_interval_ms/1000)) + + + def run(self): + table_number = 1000 + rows_per_table = 1000 + vgroups = 4 + etool.benchMark(command=f"-d db_sub -t {table_number} -n {rows_per_table} -v {vgroups} -y") + consumer_rows = table_number * rows_per_table # 消费的目标行数 + # self.case_session_12s() + self.case_max_poll_12s(consumer_rows) + remaining_threads = threading.Lock() + + def stop(self): + tdSql.close() + tdLog.success(f"{__file__} successfully executed") + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) diff --git a/tests/army/tmq/per_consumer.py b/tests/army/tmq/per_consumer.py new file mode 100644 index 000000000000..67c82d5d3e5d --- /dev/null +++ b/tests/army/tmq/per_consumer.py @@ -0,0 +1,144 @@ +import os +import taos +import time +from datetime import datetime +import subprocess +from multiprocessing import Process +import threading +from taos.tmq import Consumer +import click + +try: + conn = taos.connect() +except Exception as e: + print(str(e)) + +@click.command() +@click.option('-c', '--consumer-groups-num', "consumer_group_num", default=1, help='Number of consumer group.') +@click.option('-s', '--session-timeout-ms', "session_timeout_ms", default=60000, help='session timeout:ms') +@click.option('-p', '--max-poll-interval-ms',"max_poll_interval_ms", default=180000, help='max poll interval timeout:ms') + +def test_timeout_sub(consumer_group_num,session_timeout_ms,max_poll_interval_ms): + threads = [] + print(consumer_group_num,session_timeout_ms,max_poll_interval_ms) + for id in range(consumer_group_num): + conf = set_conf(group_id=id,session_timeout_ms=session_timeout_ms,max_poll_interval_ms=max_poll_interval_ms) + print(conf) + threads.append(threading.Thread(target=taosc_consumer, args=(conf,))) + for tr in threads: + tr.start() + for tr in threads: + tr.join() + +def sub_consumer(consumer,group_id): + group_id = int(group_id) + if group_id < 100 : + try: + consumer.subscribe(["select_d1"]) + except Exception as e: + print(f"subscribe error") + exit(1) + + nrows = 0 + while True: + start = datetime.now() + print(f"time:{start},consumer:{group_id}, start to consume") + message = consumer.poll(timeout=10.0) + + if message: + id = message.offset() + topic = message.topic() + database = message.database() + + for block in message: + addrows = block.nrows() + nrows += block.nrows() + ncols = block.ncols() + values = block.fetchall + end = datetime.now() + elapsed_time = end -start + print(f"time:{end},consumer:{group_id}, elapsed time:{elapsed_time},consumer_nrows:{nrows},consumer_addrows:{addrows}, consumer_ncols:{ncols},offset:{id}") + consumer.commit() + print(f"consumer:{group_id},consumer_nrows:{nrows}") + # consumer.unsubscribe() + # consumer.close() + # break + # if nrows >= 1000000: + # break +def sub_consumer_once(consumer,group_id): + group_id = int(group_id) + if group_id < 100 : + consumer.subscribe(["select_d1"]) + nrows = 0 + consumer_nrows = 0 + while True: + start = datetime.now() + print(f"time:{start},consumer:{group_id}, start to consume") + #start = datetime.now() + #print(f"time:{start},consumer:{group_id}, start to consume") + print(f"consumer_nrows:{consumer_nrows}") + if consumer_nrows < 1000000: + message = consumer.poll(timeout=10.0) + else: + print(" stop consumer when consumer all rows") + + if message: + id = message.offset() + topic = message.topic() + database = message.database() + + for block in message: + addrows = block.nrows() + nrows += block.nrows() + ncols = block.ncols() + values = block.fetchall + end = datetime.now() + elapsed_time = end -start + # print(f"time:{end},consumer:{group_id}, elapsed time:{elapsed_time},consumer_nrows:{nrows},consumer_addrows:{addrows}, consumer_ncols:{ncols},offset:{id}") + consumer.commit() + # print(f"consumer:{group_id},consumer_nrows:{nrows}") + consumer_nrows = nrows + # consumer.unsubscribe() + # consumer.close() + # break + +def set_conf(td_connect_ip="localhost",group_id=1,client_id="test_consumer_py",enable_auto_commit="false",auto_commit_interval_ms="1000",auto_offset_reset="earliest",msg_with_table_name="true",session_timeout_ms=10000,max_poll_interval_ms=20000,experimental_snapshot_enable="false"): + conf = { + # auth options + # consume options + "td.connect.ip": f"{td_connect_ip}", + "group.id": f"{group_id}", + "client.id": f"{client_id}", + "enable.auto.commit": f"{enable_auto_commit}", + "auto.commit.interval.ms": f"{auto_commit_interval_ms}", + "auto.offset.reset": f"{auto_offset_reset}", + "msg.with.table.name": f"{msg_with_table_name}", + "session.timeout.ms": f"{session_timeout_ms}", + "max.poll.interval.ms": f"{max_poll_interval_ms}", + "experimental.snapshot.enable" :f"{experimental_snapshot_enable}", + } + return conf + +def taosc_consumer(conf): + consumer = Consumer(conf) + group_id = int(conf["group.id"]) + print(f"{consumer},{group_id}") + #counsmer sub: + # while True: + # try: + # self.sub_consumer_once(consumer,group_id) + # except Exception as e: + # print(str(e)) + # time.sleep(1) + # break + # only consumer once + try: + sub_consumer_once(consumer,group_id) + except Exception as e: + print(str(e)) + + #consumer.close() + + +if __name__ == '__main__': + test_timeout_sub() \ No newline at end of file diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index cfe88138ef92..ef3e9c9c56c0 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -47,7 +47,7 @@ ,,y,army,./pytest.sh python3 ./test.py -f query/window/base.py ,,y,army,./pytest.sh python3 ./test.py -f query/sys/tb_perf_queries_exist_test.py -N 3 ,,y,army,./pytest.sh python3 ./test.py -f query/test_having.py - +,,n,army,python3 ./test.py -f tmq/drop_lost_comsumers.py # # system test # From cd470aa2a68df8ff0b7345da79e2fd57cd22ebc1 Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Wed, 23 Oct 2024 17:00:56 +0800 Subject: [PATCH 206/695] s3/test: default duration to 100 with replicas --- tests/pytest/util/sql.py | 2 +- tests/script/tsim/db/create_all_options.sim | 6 ++++++ tests/system-test/2-query/db.py | 6 ++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/tests/pytest/util/sql.py b/tests/pytest/util/sql.py index 3bc784063e4a..1d3333264ac1 100644 --- a/tests/pytest/util/sql.py +++ b/tests/pytest/util/sql.py @@ -104,7 +104,7 @@ def prepare(self, dbname="db", drop=True, **kwargs): for k, v in kwargs.items(): s += f" {k} {v}" if "duration" not in kwargs: - s += " duration 300" + s += " duration 100" self.cursor.execute(s) s = f'use {dbname}' self.cursor.execute(s) diff --git a/tests/script/tsim/db/create_all_options.sim b/tests/script/tsim/db/create_all_options.sim index e402223d93b3..4b39829b248c 100644 --- a/tests/script/tsim/db/create_all_options.sim +++ b/tests/script/tsim/db/create_all_options.sim @@ -128,6 +128,12 @@ endi if $data21_db != 3000 then # wal_fsync_period return -1 endi +if $data30_db != 525600m then # s3_keeplocal + return -1 +endi +if $data31_db != 1 then # s3_compact + return -1 +endi sql drop database db diff --git a/tests/system-test/2-query/db.py b/tests/system-test/2-query/db.py index 1964cea51f5a..cd7c5bd26eb5 100644 --- a/tests/system-test/2-query/db.py +++ b/tests/system-test/2-query/db.py @@ -62,6 +62,12 @@ def case2(self): tdSql.query("show dnode 1 variables like '____debugFlag'") tdSql.checkRows(2) + tdSql.query("show dnode 1 variables like 's3MigrateEna%'") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1) + tdSql.checkData(0, 1, 's3MigrateEnabled') + tdSql.checkData(0, 2, 0) + def threadTest(self, threadID): print(f"Thread {threadID} starting...") tdsqln = tdCom.newTdSql() From 8c3ec327ba491bf9e5a0bb1e325dcaa819adfd0a Mon Sep 17 00:00:00 2001 From: wangjiaming0909 <604227650@qq.com> Date: Tue, 22 Oct 2024 15:28:33 +0800 Subject: [PATCH 207/695] fix drop table with tsma crash --- source/dnode/mnode/impl/src/mndStb.c | 32 +++++++++++++++++++++------- tests/system-test/2-query/tsma.py | 13 +++++------ 2 files changed, 31 insertions(+), 14 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndStb.c b/source/dnode/mnode/impl/src/mndStb.c index b8cf72cd9e7a..2500d1ef407d 100644 --- a/source/dnode/mnode/impl/src/mndStb.c +++ b/source/dnode/mnode/impl/src/mndStb.c @@ -4076,7 +4076,7 @@ typedef struct SMDropTbDbInfo { typedef struct SMDropTbTsmaInfo { char tsmaResTbDbFName[TSDB_DB_FNAME_LEN]; - char tsmaResTbNamePrefix[TSDB_TABLE_NAME_LEN]; + char tsmaResTbNamePrefix[TSDB_TABLE_FNAME_LEN]; int32_t suid; SMDropTbDbInfo dbInfo; // reference to DbInfo in pDbMap } SMDropTbTsmaInfo; @@ -4207,6 +4207,7 @@ static int32_t mndCreateDropTbsTxnPrepare(SRpcMsg *pRsp, SMndDropTbsWithTsmaCtx SMnode *pMnode = pRsp->info.node; STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_GLOBAL, pRsp, "drop-tbs"); mndTransSetChangeless(pTrans); + mndTransSetSerial(pTrans); if (pTrans == NULL) { code = TSDB_CODE_MND_RETURN_VALUE_NULL; if (terrno != 0) code = terrno; @@ -4294,6 +4295,18 @@ static int32_t mndDropTbAdd(SMnode *pMnode, SHashObj *pVgHashMap, const SVgroupI return 0; } +int vgInfoCmp(const void* lp, const void* rp) { + SVgroupInfo* pLeft = (SVgroupInfo*)lp; + SVgroupInfo* pRight = (SVgroupInfo*)rp; + if (pLeft->hashBegin < pRight->hashBegin) { + return -1; + } else if (pLeft->hashBegin > pRight->hashBegin) { + return 1; + } + + return 0; +} + static int32_t mndGetDbVgInfoForTsma(SMnode *pMnode, const char *dbname, SMDropTbTsmaInfo *pInfo) { int32_t code = 0; SDbObj *pDb = mndAcquireDb(pMnode, dbname); @@ -4308,6 +4321,7 @@ static int32_t mndGetDbVgInfoForTsma(SMnode *pMnode, const char *dbname, SMDropT goto _end; } mndBuildDBVgroupInfo(pDb, pMnode, pInfo->dbInfo.dbVgInfos); + taosArraySort(pInfo->dbInfo.dbVgInfos, vgInfoCmp); pInfo->dbInfo.hashPrefix = pDb->cfg.hashPrefix; pInfo->dbInfo.hashSuffix = pDb->cfg.hashSuffix; @@ -4380,9 +4394,8 @@ static int32_t mndDropTbAddTsmaResTbsForSingleVg(SMnode *pMnode, SMndDropTbsWith if (pInfos) { SMDropTbTsmaInfo info = {0}; int32_t len = sprintf(buf, "%s", pSma->name); - len = taosCreateMD5Hash(buf, len); sprintf(info.tsmaResTbDbFName, "%s", pSma->db); - snprintf(info.tsmaResTbNamePrefix, TSDB_TABLE_NAME_LEN, "%s", buf); + snprintf(info.tsmaResTbNamePrefix, TSDB_TABLE_FNAME_LEN, "%s", buf); SMDropTbDbInfo *pDbInfo = taosHashGet(pCtx->pDbMap, pSma->db, TSDB_DB_FNAME_LEN); info.suid = pSma->dstTbUid; if (!pDbInfo) { @@ -4417,14 +4430,17 @@ static int32_t mndDropTbAddTsmaResTbsForSingleVg(SMnode *pMnode, SMndDropTbsWith SMDropTbTsmaInfos *pInfos = taosHashGet(pCtx->pTsmaMap, &pTb->suid, sizeof(pTb->suid)); SArray *pVgInfos = NULL; - char buf[TSDB_TABLE_FNAME_LEN]; + char buf[TSDB_TABLE_FNAME_LEN + TSDB_TABLE_NAME_LEN + 1]; + char resTbFullName[TSDB_TABLE_FNAME_LEN + 1] = {0}; for (int32_t j = 0; j < pInfos->pTsmaInfos->size; ++j) { SMDropTbTsmaInfo *pInfo = taosArrayGet(pInfos->pTsmaInfos, j); - int32_t len = sprintf(buf, "%s.%s_%s", pInfo->tsmaResTbDbFName, pInfo->tsmaResTbNamePrefix, pTb->name); - uint32_t hashVal = - taosGetTbHashVal(buf, len, pInfo->dbInfo.hashMethod, pInfo->dbInfo.hashPrefix, pInfo->dbInfo.hashSuffix); + int32_t len = sprintf(buf, "%s_%s", pInfo->tsmaResTbNamePrefix, pTb->name); + len = taosCreateMD5Hash(buf, len); + len = snprintf(resTbFullName, TSDB_TABLE_FNAME_LEN + 1, "%s.%s", pInfo->tsmaResTbDbFName, buf); + uint32_t hashVal = taosGetTbHashVal(resTbFullName, len, pInfo->dbInfo.hashMethod, pInfo->dbInfo.hashPrefix, + pInfo->dbInfo.hashSuffix); const SVgroupInfo *pVgInfo = taosArraySearch(pInfo->dbInfo.dbVgInfos, &hashVal, vgHashValCmp, TD_EQ); - void *p = taosStrdup(buf + strlen(pInfo->tsmaResTbDbFName) + TSDB_NAME_DELIMITER_LEN); + void *p = taosStrdup(resTbFullName + strlen(pInfo->tsmaResTbDbFName) + TSDB_NAME_DELIMITER_LEN); if (taosArrayPush(pCtx->pResTbNames, &p) == NULL) { code = terrno; goto _end; diff --git a/tests/system-test/2-query/tsma.py b/tests/system-test/2-query/tsma.py index f05398600b0b..976e190e445f 100644 --- a/tests/system-test/2-query/tsma.py +++ b/tests/system-test/2-query/tsma.py @@ -1338,15 +1338,16 @@ def test_tb_ddl_with_created_tsma(self): self.create_tsma('tsma1', 'test', 'meters', ['avg(c1)', 'avg(c2)'], '5m') tdSql.execute('alter table test.t0 ttl 2', queryTimes=1) tdSql.execute('flush database test') - self.wait_query('show test.tables like "%t0"', 0, wait_query_seconds) + res_tb = TSMAQCBuilder().md5('1.test.tsma1_t0') + self.wait_query(f'select * from information_schema.ins_tables where table_name = "{res_tb}"', 0, wait_query_seconds) # test drop multi tables tdSql.execute('drop table test.t3, test.t4') - self.wait_query('show test.tables like "%t3"', 0, wait_query_seconds) - self.wait_query('show test.tables like "%t4"', 0, wait_query_seconds) - - tdSql.query('show test.tables like "%tsma%"') - tdSql.checkRows(0) + res_tb = TSMAQCBuilder().md5('1.test.tsma1_t3') + self.wait_query(f'select * from information_schema.ins_tables where table_name = "{res_tb}"', 0, wait_query_seconds) + res_tb = TSMAQCBuilder().md5('1.test.tsma1_t4') + self.wait_query(f'select * from information_schema.ins_tables where table_name = "{res_tb}"', 0, wait_query_seconds) + time.sleep(9999999) # test drop stream tdSql.error('drop stream tsma1', -2147471088) ## TSMA must be dropped first From a7bbb7863b87e92e81b79925f8308622169ec071 Mon Sep 17 00:00:00 2001 From: xsren <285808407@qq.com> Date: Wed, 23 Oct 2024 17:21:22 +0800 Subject: [PATCH 208/695] fix: varType length check --- source/common/src/tdatablock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c index 57df4a600612..cb5b7468444f 100644 --- a/source/common/src/tdatablock.c +++ b/source/common/src/tdatablock.c @@ -3570,7 +3570,7 @@ int32_t blockDataCheck(const SSDataBlock* pDataBlock) { colLen = varDataTLen(pCol->pData + pCol->varmeta.offset[r]); BLOCK_DATA_CHECK_TRESSA(colLen >= VARSTR_HEADER_SIZE); - BLOCK_DATA_CHECK_TRESSA(colLen <= pCol->info.bytes); + BLOCK_DATA_CHECK_TRESSA(colLen <= pCol->varmeta.length); if (pCol->reassigned) { BLOCK_DATA_CHECK_TRESSA((pCol->varmeta.offset[r] + colLen) <= pCol->varmeta.length); From 4d8bcd906b88187aa944b9e4146e449502e91254 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Wed, 23 Oct 2024 17:33:54 +0800 Subject: [PATCH 209/695] add ci --- source/libs/stream/src/streamBackendRocksdb.c | 2 +- .../script/tsim/stream/streamTwaInterpFwc.sim | 114 ++++++++++++++++++ 2 files changed, 115 insertions(+), 1 deletion(-) create mode 100644 tests/script/tsim/stream/streamTwaInterpFwc.sim diff --git a/source/libs/stream/src/streamBackendRocksdb.c b/source/libs/stream/src/streamBackendRocksdb.c index 9230c515549b..c17c400f2a10 100644 --- a/source/libs/stream/src/streamBackendRocksdb.c +++ b/source/libs/stream/src/streamBackendRocksdb.c @@ -4336,7 +4336,7 @@ int32_t streamStatePutParTag_rocksdb(SStreamState* pState, int64_t groupId, cons if (code != 0) { return code; } - STREAM_STATE_PUT_ROCKSDB(pState, "partag", &groupId, dst, size); + STREAM_STATE_PUT_ROCKSDB(pState, "partag", &groupId, dst, (int32_t)size); taosMemoryFree(dst); return code; } diff --git a/tests/script/tsim/stream/streamTwaInterpFwc.sim b/tests/script/tsim/stream/streamTwaInterpFwc.sim new file mode 100644 index 000000000000..2073378e92ae --- /dev/null +++ b/tests/script/tsim/stream/streamTwaInterpFwc.sim @@ -0,0 +1,114 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sleep 50 +sql connect + +print step1 +print =============== create database +sql create database test vgroups 4; +sql use test; + +sql create stable st(ts timestamp, a int, b int , c int)tags(ta int,tb int,tc int); +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); + +sql create stream streams1 trigger force_window_close IGNORE EXPIRED 1 IGNORE UPDATE 1 into streamt1 as select _wstart, count(a), sum(b), now, timezone(), ta from st partition by tbname,ta interval(2s) fill(value, 100, 200); +sql create stream streams2 trigger force_window_close IGNORE EXPIRED 1 IGNORE UPDATE 1 into streamt2 as select _wstart, count(a), twa(a), sum(b), now, timezone(), ta from st partition by tbname,ta interval(2s) fill(prev); +sql create stream streams3 trigger force_window_close IGNORE EXPIRED 1 IGNORE UPDATE 1 into streamt3 as select _irowts, interp(a), interp(b), interp(c), now, timezone(), ta from st partition by tbname,ta every(2s) fill(value, 100, 200, 300); +sql create stream streams4 trigger force_window_close IGNORE EXPIRED 1 IGNORE UPDATE 1 into streamt4 as select _irowts, interp(a), interp(b), interp(c), now, timezone(), ta from st partition by tbname,ta every(2s) fill(prev); +sql create stream streams5 trigger force_window_close IGNORE EXPIRED 1 IGNORE UPDATE 1 into streamt5 as select _wstart, count(a), sum(b), now, timezone(), ta from st partition by tbname,ta interval(2s); + +run tsim/stream/checkTaskStatus.sim + +$loop_count = 0 + +_data: + +sql insert into t1 values(now + 3000a,1,1,1) (now + 3100a,5,10,10) (now + 3200a,5,10,10) (now + 5100a,20,1,1) (now + 5200a,30,10,10) (now + 5300a,40,10,10); +sql insert into t2 values(now + 3000a,1,1,1) (now + 3100a,2,10,10) (now + 3200a,30,10,10) (now + 5100a,10,1,1) (now + 5200a,40,10,10) (now + 5300a,7,10,10); + +sleep 2000 + +$loop_count = $loop_count + 1 +if $loop_count < 10 then + goto _data +endi + +print sql select _wstart, count(a), sum(b), now, timezone(), ta from st partition by tbname,ta interval(2s) order by 1, 2; +sql select _wstart, count(a), sum(b), now, timezone(), ta from st partition by tbname,ta interval(2s) order by 1, 2; +$query1_rows = $rows +print ======query1_rows=$query1_rows + +$query1_data01 = $data01 +print ======query1_data01=$query1_data01 + +print select last(*) from (select _wstart, count(a), sum(b), now, timezone(), ta from st partition by tbname,ta interval(2s)) order by 1,2 desc; +sql select _wstart, count(a), sum(b), now, timezone(), ta from st partition by tbname,ta interval(2s) order by 1,2 desc; +print $data00 $data01 $data02 $data03 $data04 + +loop0: + +sleep 2000 + +print sql select * from streamt1 order by 1, 2; +sql select * from streamt1 order by 1, 2; +print ======streamt1=rows=$rows + +if $rows < $query1_rows then + goto loop0 +endi + +if $data01 != $query1_data01 then + print =============data01=$data01 + print ======query1_data01=$query1_data01 + return -1 +endi + +print sql select * from streamt2 order by 1, 2; +sql select * from streamt2 order by 1, 2; +print ======streamt2=rows=$rows + +if $rows < $query1_rows then + goto loop0 +endi + +if $data01 != $query1_data01 then + print =============data01=$data01 + print ======query1_data01=$query1_data01 + return -1 +endi + +print sql select * from streamt3 order by 1, 2; +sql select * from streamt3 order by 1, 2; +print ======streamt3=rows=$rows + +if $rows < $query1_rows then + goto loop0 +endi + +print sql select * from streamt4 order by 1, 2; +sql select * from streamt4 order by 1, 2; +print ======streamt4=rows=$rows + +if $rows < $query1_rows then + goto loop0 +endi + +print sql select * from streamt5 order by 1, 2; +sql select * from streamt5 order by 1, 2; +print ======streamt5=rows=$rows + +if $rows < $query1_rows then + return -1 +endi + +if $data01 != $query1_data01 then + print =============data01=$data01 + print ======query1_data01=$query1_data01 + return -1 +endi + +print end + +system sh/exec.sh -n dnode1 -s stop -x SIGINT From a7eb3c2607f1480fe537cab4fdea7c7c20059716 Mon Sep 17 00:00:00 2001 From: wangjiaming0909 <604227650@qq.com> Date: Wed, 23 Oct 2024 18:19:37 +0800 Subject: [PATCH 210/695] fix filloperator memory leak --- source/libs/executor/src/filloperator.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source/libs/executor/src/filloperator.c b/source/libs/executor/src/filloperator.c index d7a55c86bb7e..1595c90419aa 100644 --- a/source/libs/executor/src/filloperator.c +++ b/source/libs/executor/src/filloperator.c @@ -337,6 +337,7 @@ void destroyFillOperatorInfo(void* param) { pInfo->pFinalRes = NULL; cleanupExprSupp(&pInfo->noFillExprSupp); + cleanupExprSupp(&pInfo->fillNullExprSupp); taosMemoryFreeClear(pInfo->p); taosArrayDestroy(pInfo->matchInfo.pList); From 1e63510dfdf2671b125d6eaacdfea9546c58d38a Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Wed, 23 Oct 2024 18:38:15 +0800 Subject: [PATCH 211/695] s3/mnd: fix default value resetting --- source/dnode/mnode/impl/src/mndDb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/dnode/mnode/impl/src/mndDb.c b/source/dnode/mnode/impl/src/mndDb.c index 7c42564f4c42..aed00af3c189 100644 --- a/source/dnode/mnode/impl/src/mndDb.c +++ b/source/dnode/mnode/impl/src/mndDb.c @@ -583,7 +583,7 @@ static void mndSetDefaultDbCfg(SDbCfg *pCfg) { if (pCfg->tsdbPageSize <= 0) pCfg->tsdbPageSize = TSDB_DEFAULT_TSDB_PAGESIZE; if (pCfg->s3ChunkSize <= 0) pCfg->s3ChunkSize = TSDB_DEFAULT_S3_CHUNK_SIZE; if (pCfg->s3KeepLocal <= 0) pCfg->s3KeepLocal = TSDB_DEFAULT_S3_KEEP_LOCAL; - if (pCfg->s3Compact <= 0) pCfg->s3Compact = TSDB_DEFAULT_S3_COMPACT; + if (pCfg->s3Compact < 0) pCfg->s3Compact = TSDB_DEFAULT_S3_COMPACT; if (pCfg->withArbitrator < 0) pCfg->withArbitrator = TSDB_DEFAULT_DB_WITH_ARBITRATOR; if (pCfg->encryptAlgorithm < 0) pCfg->encryptAlgorithm = TSDB_DEFAULT_ENCRYPT_ALGO; } From 19bd1e933b318324f9f6b2d8a27222d0a5d7726f Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Wed, 23 Oct 2024 18:52:29 +0800 Subject: [PATCH 212/695] use 100 from army/frame/sql.py duration --- tests/army/frame/sql.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/army/frame/sql.py b/tests/army/frame/sql.py index 8b99219524ad..b4bc31b6a872 100644 --- a/tests/army/frame/sql.py +++ b/tests/army/frame/sql.py @@ -73,7 +73,7 @@ def prepare(self, dbname="db", drop=True, **kwargs): for k, v in kwargs.items(): s += f" {k} {v}" if "duration" not in kwargs: - s += " duration 300" + s += " duration 100" self.cursor.execute(s) s = f'use {dbname}' self.cursor.execute(s) From e52628ab57371c62db0d003ff526a3cac2d7adef Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Wed, 23 Oct 2024 19:13:15 +0800 Subject: [PATCH 213/695] fix: scheduler validate plan issues --- source/client/inc/clientInt.h | 2 + source/client/src/clientImpl.c | 13 ++- source/libs/executor/test/queryPlanTests.cpp | 87 +++++++++++++++++--- source/libs/scheduler/inc/schInt.h | 3 + source/libs/scheduler/src/schJob.c | 36 +++++--- source/libs/scheduler/src/scheduler.c | 7 ++ 6 files changed, 125 insertions(+), 23 deletions(-) diff --git a/source/client/inc/clientInt.h b/source/client/inc/clientInt.h index 8d45e8b4a811..114bc00125d8 100644 --- a/source/client/inc/clientInt.h +++ b/source/client/inc/clientInt.h @@ -58,6 +58,8 @@ enum { #define TD_RES_TMQ_METADATA(res) (*(int8_t*)(res) == RES_TYPE__TMQ_METADATA) #define TD_RES_TMQ_BATCH_META(res) (*(int8_t*)(res) == RES_TYPE__TMQ_BATCH_META) +#define TSC_MAX_SUBPLAN_CAPACITY_NUM 1000 + typedef struct SAppInstInfo SAppInstInfo; typedef struct { diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index 2c67cafdf590..c55764aaf4e3 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -1251,6 +1251,7 @@ void schedulerExecCb(SExecResult* pResult, void* param, int32_t code) { void launchQueryImpl(SRequestObj* pRequest, SQuery* pQuery, bool keepQuery, void** res) { int32_t code = 0; + int32_t subplanNum = 0; if (pQuery->pRoot) { pRequest->stmtType = pQuery->pRoot->type; @@ -1292,7 +1293,7 @@ void launchQueryImpl(SRequestObj* pRequest, SQuery* pQuery, bool keepQuery, void SQueryPlan* pDag = NULL; code = getPlan(pRequest, pQuery, &pDag, pMnodeList); if (TSDB_CODE_SUCCESS == code) { - pRequest->body.subplanNum = pDag->numOfSubplans; + subplanNum = pDag->numOfSubplans; if (!pRequest->validateOnly) { SArray* pNodeList = NULL; code = buildSyncExecNodeList(pRequest, &pNodeList, pMnodeList); @@ -1301,6 +1302,10 @@ void launchQueryImpl(SRequestObj* pRequest, SQuery* pQuery, bool keepQuery, void } taosArrayDestroy(pNodeList); } + + if (TSDB_CODE_SUCCESS == code) { + pRequest->body.subplanNum = subplanNum; + } } taosArrayDestroy(pMnodeList); break; @@ -1343,6 +1348,7 @@ static int32_t asyncExecSchQuery(SRequestObj* pRequest, SQuery* pQuery, SMetaDat pRequest->type = pQuery->msgType; SArray* pMnodeList = NULL; SQueryPlan* pDag = NULL; + int32_t subplanNum = 0; int64_t st = taosGetTimestampUs(); if (!pRequest->parseOnly) { @@ -1369,7 +1375,7 @@ static int32_t asyncExecSchQuery(SRequestObj* pRequest, SQuery* pQuery, SMetaDat tscError("0x%" PRIx64 " failed to create query plan, code:%s 0x%" PRIx64, pRequest->self, tstrerror(code), pRequest->requestId); } else { - pRequest->body.subplanNum = pDag->numOfSubplans; + subplanNum = pDag->numOfSubplans; TSWAP(pRequest->pPostPlan, pDag->pPostPlan); } } @@ -1406,6 +1412,9 @@ static int32_t asyncExecSchQuery(SRequestObj* pRequest, SQuery* pQuery, SMetaDat if (TSDB_CODE_SUCCESS == code) { code = schedulerExecJob(&req, &pRequest->body.queryJob); } + if (TSDB_CODE_SUCCESS == code) { + pRequest->body.subplanNum = subplanNum; + } taosArrayDestroy(pNodeList); } else { qDestroyQueryPlan(pDag); diff --git a/source/libs/executor/test/queryPlanTests.cpp b/source/libs/executor/test/queryPlanTests.cpp index 176af60944de..c367391f8ec1 100755 --- a/source/libs/executor/test/queryPlanTests.cpp +++ b/source/libs/executor/test/queryPlanTests.cpp @@ -47,9 +47,9 @@ namespace { -#define QPT_MAX_LOOP 1000 +#define QPT_MAX_LOOP 100000 #define QPT_MAX_LEVEL_SUBPLAN_NUM 10 -#define QPT_MAX_SUBPLAN_LEVEL 5 +#define QPT_MAX_SUBPLAN_LEVEL 2 #define QPT_MAX_SUBPLAN_GROUP 5 #define QPT_MAX_WHEN_THEN_NUM 10 #define QPT_MAX_NODE_LEVEL 5 @@ -172,7 +172,10 @@ typedef struct { } SQPTMakeNodeCtx; typedef struct { + int64_t startTsUs; int32_t code; + int64_t succeedTimes; + int64_t failedTimes; } SQPTExecResult; typedef struct { @@ -183,7 +186,6 @@ typedef struct { SQPTMakeNodeCtx makeCtx; SQPTMakeNodeCtx makeCtxBak; SQPTExecResult result; - int64_t startTsUs; } SQPTCtx; typedef struct { @@ -257,7 +259,7 @@ SNode* qptCreateSubplanNode(int32_t nodeType); SQPTPlan qptPlans[] = { {QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN, QPT_PLAN_PHYSIC, "tagScan", qptCreateTagScanPhysiNode}, {QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN, QPT_PLAN_PHYSIC, "tableScan", qptCreateTableScanPhysiNode}, - {QUERY_NODE_PHYSICAL_PLAN_TABLE_SEQ_SCAN, QPT_PLAN_PHYSIC, "tableSeqScan", NULL /*qptCreateTableSeqScanPhysiNode*/ }, + {QUERY_NODE_PHYSICAL_PLAN_TABLE_SEQ_SCAN, QPT_PLAN_PHYSIC, "tableSeqScan", qptCreateTableSeqScanPhysiNode}, {QUERY_NODE_PHYSICAL_PLAN_TABLE_MERGE_SCAN, QPT_PLAN_PHYSIC, "tableMergeScan", qptCreateTableMergeScanPhysiNode}, {QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN, QPT_PLAN_PHYSIC, "streamScan", qptCreateStreamScanPhysiNode}, {QUERY_NODE_PHYSICAL_PLAN_SYSTABLE_SCAN, QPT_PLAN_PHYSIC, "sysTableScan", qptCreateSysTableScanPhysiNode}, @@ -329,6 +331,16 @@ int32_t qptSink[] = {QUERY_NODE_PHYSICAL_PLAN_DISPATCH, QUERY_NODE_PHYSICAL_PLAN SNode* qptMakeExprNode(SNode** ppNode); void qptMakeNodeList(QPT_NODE_TYPE nodeType, SNodeList** ppList); +int32_t qptGetSpecificPlanIndex(int32_t type) { + int32_t planNum = sizeof(qptPlans) / sizeof(qptPlans[0]); + for (int32_t i = 0; i < planNum; ++i) { + if (qptPlans[i].type == type) { + return i; + } + } + + return -1; +} int32_t qptGetColumnRandLen(int32_t colType) { switch (colType) { @@ -460,7 +472,8 @@ void qptPrintEndInfo() { } void qptPrintStatInfo() { - + printf("\n\tAll %d times TEST [%s] END, result - succeed:%" PRId64 " failed:%" PRId64 "\n", qptCtx.loopIdx + 1, qptCtx.caseName, + qptCtx.result.succeedTimes, qptCtx.result.failedTimes); } @@ -1661,6 +1674,19 @@ SNode* qptMakeOrderByExprNode(SNode** ppNode) { return *ppNode; } +SNode* qptMakeSubplanNode(SNode** ppNode) { + if (QPT_NCORRECT_LOW_PROB()) { + return qptMakeRandNode(ppNode); + } + + *ppNode = (SNode*)qptCreateSubplanNode(QUERY_NODE_PHYSICAL_SUBPLAN); + + return *ppNode; +} + + + + SPhysiNode* qptCreatePhysiNode(int32_t nodeType) { SPhysiNode* pPhysiNode = NULL; assert(0 == nodesMakeNode((ENodeType)nodeType, (SNode**)&pPhysiNode)); @@ -1928,6 +1954,18 @@ void qptMakeOrerByExprList(SNodeList** ppList) { } +void qptMakeSubplanList(SNodeList** ppList) { + qptSaveMakeNodeCtx(); + + int32_t planNum = taosRand() % QPT_MAX_LEVEL_SUBPLAN_NUM + (QPT_CORRECT_HIGH_PROB() ? 1 : 0); + for (int32_t i = 0; i < planNum; ++i) { + SNode* pNode = NULL; + qptRestoreMakeNodeCtx(); + qptMakeSubplanNode(&pNode); + qptNodesListMakeStrictAppend(ppList, pNode); + } +} + void qptMakeSpecTypeNodeList(QPT_NODE_TYPE nodeType, SNodeList** ppList) { switch (nodeType) { case QPT_NODE_COLUMN: @@ -1938,6 +1976,8 @@ void qptMakeSpecTypeNodeList(QPT_NODE_TYPE nodeType, SNodeList** ppList) { return qptMakeExprList(ppList); case QPT_NODE_VALUE: return qptMakeValueList(ppList); + case QPT_NODE_SUBPLAN: + return qptMakeSubplanList(ppList); default: break; } @@ -2934,6 +2974,8 @@ void qptResetForReRun() { qptCtx.buildCtx.pCurr = NULL; qptCtx.buildCtx.pCurrTask = NULL; + + qptCtx.result.code = 0; } void qptSingleTestDone(bool* contLoop) { @@ -3126,6 +3168,13 @@ void qptExecPlan(SReadHandle* pReadHandle, SNode* pNode, SExecTaskInfo* pTaskInf default: assert(0); } + + if (qptCtx.result.code) { + qptCtx.result.failedTimes++; + } else { + qptCtx.result.succeedTimes++; + } + } void qptRunSingleOpTest() { @@ -3144,7 +3193,7 @@ void qptRunSingleOpTest() { qptPrintBeginInfo(); - qptCtx.startTsUs = taosGetTimestampUs(); + qptCtx.result.startTsUs = taosGetTimestampUs(); qptExecPlan(&readHandle, pNode, pTaskInfo, &pOperator); @@ -3170,7 +3219,7 @@ void qptRunSubplanTest() { qptPrintBeginInfo(); - qptCtx.startTsUs = taosGetTimestampUs(); + qptCtx.result.startTsUs = taosGetTimestampUs(); //qptCtx.result.code = createTagScanOperatorInfo(&readHandle, (STagScanPhysiNode*)pNode, NULL, NULL, NULL, NULL, &pOperator); //qptCtx.result.code = createProjectOperatorInfo(NULL, (SProjectPhysiNode*)pNode, NULL, &pOperator); @@ -3307,9 +3356,9 @@ void qptDestroyTestCtx() { } // namespace #if 1 -#if 1 -TEST(singleNodeTest, randPlan) { - char* caseType = "singleNodeTest:randPlan"; +#if 0 +TEST(singleRandNodeTest, loopPlans) { + char* caseType = "singleRandNodeTest:loopPlans"; for (qptCtx.loopIdx = 0; qptCtx.loopIdx < QPT_MAX_LOOP; ++qptCtx.loopIdx) { for (int32_t i = 0; i < sizeof(qptPlans)/sizeof(qptPlans[0]); ++i) { @@ -3325,6 +3374,24 @@ TEST(singleNodeTest, randPlan) { qptPrintStatInfo(); } #endif +#if 1 +TEST(singleRandNodeTest, specificPlan) { + char* caseType = "singleRandNodeTest:specificPlan"; + + int32_t idx = qptGetSpecificPlanIndex(QUERY_NODE_PHYSICAL_PLAN); + for (qptCtx.loopIdx = 0; qptCtx.loopIdx < QPT_MAX_LOOP; ++qptCtx.loopIdx) { + sprintf(qptCtx.caseName, "%s:%s", caseType, qptPlans[idx].name); + qptInitTestCtx(false, true, qptPlans[idx].type, idx, 0, NULL); + + qptRunPlanTest(); + + qptDestroyTestCtx(); + } + + qptPrintStatInfo(); +} +#endif + #endif diff --git a/source/libs/scheduler/inc/schInt.h b/source/libs/scheduler/inc/schInt.h index 52c7c64887fb..96b9d2da8d3d 100644 --- a/source/libs/scheduler/inc/schInt.h +++ b/source/libs/scheduler/inc/schInt.h @@ -62,6 +62,7 @@ typedef enum { #define SCH_DEFAULT_MAX_RETRY_NUM 6 #define SCH_MIN_AYSNC_EXEC_NUM 3 #define SCH_DEFAULT_RETRY_TOTAL_ROUND 3 +#define SCH_DEFAULT_TASK_CAPACITY_NUM 1000 typedef struct SSchDebug { bool lockEnable; @@ -318,6 +319,8 @@ typedef struct SSchTaskCtx { extern SSchedulerMgmt schMgmt; +#define SCH_GET_TASK_CAPACITY(_n) ((_n) > SCH_DEFAULT_TASK_CAPACITY_NUM ? SCH_DEFAULT_TASK_CAPACITY_NUM : (_n)) + #define SCH_TASK_TIMEOUT(_task) \ ((taosGetTimestampUs() - *(int64_t *)taosArrayGet((_task)->profile.execTime, (_task)->execId)) > (_task)->timeoutUsec) diff --git a/source/libs/scheduler/src/schJob.c b/source/libs/scheduler/src/schJob.c index d1c970b9febc..c52f779b75eb 100644 --- a/source/libs/scheduler/src/schJob.c +++ b/source/libs/scheduler/src/schJob.c @@ -317,7 +317,7 @@ int32_t schValidateAndBuildJob(SQueryPlan *pDag, SSchJob *pJob) { SCH_ERR_RET(TSDB_CODE_QRY_INVALID_INPUT); } - pJob->dataSrcTasks = taosArrayInit(pDag->numOfSubplans, POINTER_BYTES); + pJob->dataSrcTasks = taosArrayInit(SCH_GET_TASK_CAPACITY(pDag->numOfSubplans), POINTER_BYTES); if (NULL == pJob->dataSrcTasks) { SCH_ERR_RET(terrno); } @@ -329,7 +329,7 @@ int32_t schValidateAndBuildJob(SQueryPlan *pDag, SSchJob *pJob) { } SHashObj *planToTask = taosHashInit( - pDag->numOfSubplans, + SCH_GET_TASK_CAPACITY(pDag->numOfSubplans), taosGetDefaultHashFunction(POINTER_BYTES == sizeof(int64_t) ? TSDB_DATA_TYPE_BIGINT : TSDB_DATA_TYPE_INT), false, HASH_NO_LOCK); if (NULL == planToTask) { @@ -349,6 +349,7 @@ int32_t schValidateAndBuildJob(SQueryPlan *pDag, SSchJob *pJob) { SSchLevel level = {0}; SNodeListNode *plans = NULL; int32_t taskNum = 0; + int32_t totalTaskNum = 0; SSchLevel *pLevel = NULL; level.status = JOB_TASK_STATUS_INIT; @@ -362,7 +363,7 @@ int32_t schValidateAndBuildJob(SQueryPlan *pDag, SSchJob *pJob) { pLevel = taosArrayGet(pJob->levels, i); if (NULL == pLevel) { SCH_JOB_ELOG("fail to get the %dth level, levelNum: %d", i, levelNum); - SCH_ERR_RET(TSDB_CODE_SCH_INTERNAL_ERROR); + SCH_ERR_RET(TSDB_CODE_QRY_INVALID_INPUT); } pLevel->level = i; @@ -384,6 +385,12 @@ int32_t schValidateAndBuildJob(SQueryPlan *pDag, SSchJob *pJob) { SCH_ERR_JRET(TSDB_CODE_QRY_INVALID_INPUT); } + totalTaskNum += taskNum; + if (totalTaskNum > pDag->numOfSubplans) { + SCH_JOB_ELOG("current totalTaskNum %d is bigger than numOfSubplans %d, level:%d", totalTaskNum, pDag->numOfSubplans, i); + SCH_ERR_JRET(TSDB_CODE_QRY_INVALID_INPUT); + } + pLevel->taskNum = taskNum; pLevel->subTasks = taosArrayInit(taskNum, sizeof(SSchTask)); @@ -410,14 +417,16 @@ int32_t schValidateAndBuildJob(SQueryPlan *pDag, SSchJob *pJob) { SCH_ERR_JRET(schAppendJobDataSrc(pJob, pTask)); - if (0 != taosHashPut(planToTask, &plan, POINTER_BYTES, &pTask, POINTER_BYTES)) { - SCH_TASK_ELOG("taosHashPut to planToTaks failed, taskIdx:%d", n); - SCH_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); + code = taosHashPut(planToTask, &plan, POINTER_BYTES, &pTask, POINTER_BYTES); + if (0 != code) { + SCH_TASK_ELOG("taosHashPut to planToTaks failed, taskIdx:%d, error:%s", n, tstrerror(code)); + SCH_ERR_JRET(code); } - if (0 != taosHashPut(pJob->taskList, &pTask->taskId, sizeof(pTask->taskId), &pTask, POINTER_BYTES)) { - SCH_TASK_ELOG("taosHashPut to taskList failed, taskIdx:%d", n); - SCH_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); + code = taosHashPut(pJob->taskList, &pTask->taskId, sizeof(pTask->taskId), &pTask, POINTER_BYTES); + if (0 != code) { + SCH_TASK_ELOG("taosHashPut to taskList failed, taskIdx:%d, error:%s", n, tstrerror(code)); + SCH_ERR_JRET(code); } ++pJob->taskNum; @@ -426,6 +435,11 @@ int32_t schValidateAndBuildJob(SQueryPlan *pDag, SSchJob *pJob) { SCH_JOB_DLOG("level %d initialized, taskNum:%d", i, taskNum); } + if (totalTaskNum != pDag->numOfSubplans) { + SCH_JOB_ELOG("totalTaskNum %d mis-match with numOfSubplans %d", totalTaskNum, pDag->numOfSubplans); + SCH_ERR_JRET(TSDB_CODE_QRY_INVALID_INPUT); + } + SCH_ERR_JRET(schBuildTaskRalation(pJob, planToTask)); _return: @@ -876,10 +890,10 @@ int32_t schInitJob(int64_t *pJobId, SSchedulerReq *pReq) { } } - pJob->taskList = taosHashInit(pReq->pDag->numOfSubplans, taosGetDefaultHashFunction(TSDB_DATA_TYPE_UBIGINT), false, + pJob->taskList = taosHashInit(SCH_GET_TASK_CAPACITY(pReq->pDag->numOfSubplans), taosGetDefaultHashFunction(TSDB_DATA_TYPE_UBIGINT), false, HASH_ENTRY_LOCK); if (NULL == pJob->taskList) { - SCH_JOB_ELOG("taosHashInit %d taskList failed", pReq->pDag->numOfSubplans); + SCH_JOB_ELOG("taosHashInit %d taskList failed", SCH_GET_TASK_CAPACITY(pReq->pDag->numOfSubplans)); SCH_ERR_JRET(terrno); } diff --git a/source/libs/scheduler/src/scheduler.c b/source/libs/scheduler/src/scheduler.c index 01d3204dc62e..db9ecd602502 100644 --- a/source/libs/scheduler/src/scheduler.c +++ b/source/libs/scheduler/src/scheduler.c @@ -233,6 +233,13 @@ int32_t schedulerValidatePlan(SQueryPlan* pPlan) { SCH_ERR_RET(terrno); } + pJob->taskList = taosHashInit(100, taosGetDefaultHashFunction(TSDB_DATA_TYPE_UBIGINT), false, + HASH_ENTRY_LOCK); + if (NULL == pJob->taskList) { + SCH_JOB_ELOG("taosHashInit %d taskList failed", 100); + SCH_ERR_JRET(terrno); + } + SCH_ERR_JRET(schValidateAndBuildJob(pPlan, pJob)); if (SCH_IS_EXPLAIN_JOB(pJob)) { From 58bcde208376250bea358dc648236d0576331412 Mon Sep 17 00:00:00 2001 From: wangjiaming0909 <604227650@qq.com> Date: Wed, 23 Oct 2024 19:30:34 +0800 Subject: [PATCH 214/695] fix test tsma.py --- tests/system-test/2-query/tsma.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/system-test/2-query/tsma.py b/tests/system-test/2-query/tsma.py index 976e190e445f..1e115cff79fc 100644 --- a/tests/system-test/2-query/tsma.py +++ b/tests/system-test/2-query/tsma.py @@ -1347,7 +1347,6 @@ def test_tb_ddl_with_created_tsma(self): self.wait_query(f'select * from information_schema.ins_tables where table_name = "{res_tb}"', 0, wait_query_seconds) res_tb = TSMAQCBuilder().md5('1.test.tsma1_t4') self.wait_query(f'select * from information_schema.ins_tables where table_name = "{res_tb}"', 0, wait_query_seconds) - time.sleep(9999999) # test drop stream tdSql.error('drop stream tsma1', -2147471088) ## TSMA must be dropped first From b8725618f066cd707da0e0bae481e77450136d3b Mon Sep 17 00:00:00 2001 From: lyh250-666 Date: Wed, 23 Oct 2024 23:26:44 +0800 Subject: [PATCH 215/695] opti:modify time range of select ts in --- source/libs/scalar/src/filter.c | 33 ++++++++++++++++++++++++++++++--- tests/script/tsim/scalar/in.sim | 15 +++++++++++++++ 2 files changed, 45 insertions(+), 3 deletions(-) diff --git a/source/libs/scalar/src/filter.c b/source/libs/scalar/src/filter.c index 03bc2b544b84..c9740b8c25cf 100644 --- a/source/libs/scalar/src/filter.c +++ b/source/libs/scalar/src/filter.c @@ -4541,6 +4541,7 @@ int32_t filterGetTimeRange(SNode *pNode, STimeWindow *win, bool *isStrict) { if (info->scalarMode) { SArray *colRanges = info->sclCtx.fltSclRange; + SOperatorNode *optNode = (SOperatorNode *) pNode; if (taosArrayGetSize(colRanges) == 1) { SFltSclColumnRange *colRange = taosArrayGet(colRanges, 0); if (NULL == colRange) { @@ -4560,7 +4561,8 @@ int32_t filterGetTimeRange(SNode *pNode, STimeWindow *win, bool *isStrict) { FLT_ERR_JRET(fltSclGetTimeStampDatum(endPt, &end)); win->skey = start.i; win->ekey = end.i; - *isStrict = true; + if(optNode->opType == OP_TYPE_IN) *isStrict = false; + else *isStrict = true; goto _return; } else if (taosArrayGetSize(points) == 0) { *win = TSWINDOW_DESC_INITIALIZER; @@ -5023,6 +5025,29 @@ int32_t fltSclBuildRangePoints(SFltSclOperator *oper, SArray *points) { } break; } + case OP_TYPE_IN: { + SNodeListNode *listNode = (SNodeListNode *)oper->valNode; + SListCell *cell = listNode->pNodeList->pHead; + SFltSclDatum minDatum = {.kind = FLT_SCL_DATUM_KIND_INT64, .i = INT64_MAX, .type = oper->colNode->node.resType}; + SFltSclDatum maxDatum = {.kind = FLT_SCL_DATUM_KIND_INT64, .i = INT64_MIN, .type = oper->colNode->node.resType}; + for (int32_t i = 0; i < listNode->pNodeList->length; ++i) { + SValueNode *valueNode = (SValueNode *)cell->pNode; + SFltSclDatum valDatum; + FLT_ERR_RET(fltSclBuildDatumFromValueNode(&valDatum, valueNode)); + minDatum.i = TMIN(minDatum.i, valDatum.i); + maxDatum.i = TMAX(maxDatum.i, valDatum.i); + cell = cell->pNext; + } + SFltSclPoint startPt = {.start = true, .excl = false, .val = minDatum}; + SFltSclPoint endPt = {.start = false, .excl = false, .val = maxDatum}; + if (NULL == taosArrayPush(points, &startPt)) { + FLT_ERR_RET(terrno); + } + if (NULL == taosArrayPush(points, &endPt)) { + FLT_ERR_RET(terrno); + } + break; + } default: { qError("not supported operator type : %d when build range points", oper->type); break; @@ -5075,11 +5100,13 @@ static bool fltSclIsCollectableNode(SNode *pNode) { if (!(pOper->opType == OP_TYPE_GREATER_THAN || pOper->opType == OP_TYPE_GREATER_EQUAL || pOper->opType == OP_TYPE_LOWER_THAN || pOper->opType == OP_TYPE_LOWER_EQUAL || - pOper->opType == OP_TYPE_NOT_EQUAL || pOper->opType == OP_TYPE_EQUAL)) { + pOper->opType == OP_TYPE_NOT_EQUAL || pOper->opType == OP_TYPE_EQUAL || + pOper->opType == OP_TYPE_IN)) { return false; } - if (!(nodeType(pOper->pLeft) == QUERY_NODE_COLUMN && nodeType(pOper->pRight) == QUERY_NODE_VALUE)) { + if (!((nodeType(pOper->pLeft) == QUERY_NODE_COLUMN && nodeType(pOper->pRight) == QUERY_NODE_VALUE) || + (nodeType(pOper->pLeft) == QUERY_NODE_COLUMN && nodeType(pOper->pRight) == QUERY_NODE_NODE_LIST))) { return false; } return true; diff --git a/tests/script/tsim/scalar/in.sim b/tests/script/tsim/scalar/in.sim index 75e1face88a9..d241bbc1bfc9 100644 --- a/tests/script/tsim/scalar/in.sim +++ b/tests/script/tsim/scalar/in.sim @@ -35,6 +35,14 @@ if $rows != 3 then return -1 endi +sql explain verbose true select * from tb1 where tts in ('2022-07-10 16:31:01', '2022-07-10 16:31:03', 1657441865000); +if $rows != 3 then + return -1 +endi +if $data20 != @ Time Range: [-9223372036854775808, 9223372036854775807]@ then + return -1 +endi + sql select * from tb1 where fbool in (0, 3); if $rows != 5 then return -1 @@ -80,4 +88,11 @@ if $rows != 0 then return -1 endi +sql explain verbose true select * from tb1 where fts in ('2022-07-10 16:31:00', '2022-07-10 16:33:00', 1657441840000); +if $rows != 4 then + return -1 +endi +if $data20 != @ Time Range: [1657441840000, 1657441980000]@ then + return -1 +endi system sh/exec.sh -n dnode1 -s stop -x SIGINT From 1ba0b39582501d013ecc0e7284cd24c3a91f59e3 Mon Sep 17 00:00:00 2001 From: jiajingbin Date: Wed, 23 Oct 2024 23:55:15 +0800 Subject: [PATCH 216/695] test: format code and add dead-lock return code to crash_gen --- tests/pytest/auto_crash_gen.py | 61 +++++++------- tests/pytest/auto_crash_gen_valgrind.py | 74 ++++++++--------- .../pytest/auto_crash_gen_valgrind_cluster.py | 82 ++++++++----------- 3 files changed, 102 insertions(+), 115 deletions(-) diff --git a/tests/pytest/auto_crash_gen.py b/tests/pytest/auto_crash_gen.py index 343cbd72c3d0..4e4679db6a44 100755 --- a/tests/pytest/auto_crash_gen.py +++ b/tests/pytest/auto_crash_gen.py @@ -6,15 +6,12 @@ # -*- coding: utf-8 -*- import os ,sys import random -import argparse import subprocess -import time -import platform # valgrind mode ? valgrind_mode = False -msg_dict = {0:"success" , 1:"failed" , 2:"other errors" , 3:"crash occured" , 4:"Invalid read/write" , 5:"memory leak" } +msg_dict = {0: "success", 1: "failed", 2: "other errors", 3: "crash occured", 4: "Invalid read/write", 5: "memory leak", 6: "dead locked"} # formal hostname = socket.gethostname() @@ -112,9 +109,9 @@ def random_args(args_list): # args_list["--connector-type"]=connect_types[random.randint(0,2)] args_list["--connector-type"]= connect_types[0] args_list["--max-dbs"]= random.randint(1,10) - + # dnodes = [1,3] # set single dnodes; - + # args_list["--num-dnodes"]= random.sample(dnodes,1)[0] # args_list["--num-replicas"]= random.randint(1,args_list["--num-dnodes"]) args_list["--debug"]=False @@ -125,7 +122,7 @@ def random_args(args_list): # args_list["--ignore-errors"]=[] ## can add error codes for detail - + args_list["--run-tdengine"]= False args_list["--use-shadow-db"]= False args_list["--dynamic-db-table-names"]= True @@ -162,7 +159,7 @@ def random_args(args_list): if args_list["--larger-data"]: threads = [16,32] else: - threads = [32,64,128,256] + threads = [32,64,128,256] args_list["--num-threads"]=random.sample(threads,1)[0] #$ debug return args_list @@ -176,7 +173,7 @@ def limits(args_list): pass # env is start by test frame , not crash_gen instance - + # elif args_list["--num-replicas"]==0: # print(" make sure num-replicas is at least 1 ") # args_list["--num-replicas"]=1 @@ -186,10 +183,10 @@ def limits(args_list): # elif args_list["--num-replicas"]>1: # if not args_list["--auto-start-service"]: # print("it should be deployed by crash_gen auto-start-service for multi replicas") - + # else: # pass - + return args_list def get_auto_mix_cmds(args_list ,valgrind=valgrind_mode): @@ -216,9 +213,9 @@ def get_auto_mix_cmds(args_list ,valgrind=valgrind_mode): arguments+="" else: arguments+=(k+"="+str(v)+" ") - + if valgrind : - + crash_gen_cmd = 'cd %s && ./crash_gen.sh --valgrind %s -g 0x32c,0x32d,0x3d3,0x18,0x2501,0x369,0x388,0x061a,0x2550,0x0203,0x4012 '%(crash_gen_path ,arguments) else: @@ -239,7 +236,7 @@ def start_taosd(): start_cmd = 'cd %s && python3 test.py >>/dev/null '%(start_path) os.system(start_cmd) -def get_cmds(args_list): +def get_cmds(args_list): crash_gen_cmd = get_auto_mix_cmds(args_list,valgrind=valgrind_mode) return crash_gen_cmd @@ -276,11 +273,15 @@ def check_status(): os.system("tail -n 50 %s>>%s"%(result_file,exit_status_logs)) core_check = subprocess.Popen('ls -l %s | grep "^-" | wc -l'%core_path, shell=True, stdout=subprocess.PIPE,stderr=subprocess.STDOUT).stdout.read().decode("utf-8") + dead_lock_check = subprocess.Popen("grep -i 'dead locked' %s "%result_file, shell=True, stdout=subprocess.PIPE,stderr=subprocess.STDOUT).stdout.read().decode("utf-8") if int(core_check.strip().rstrip()) > 0: # it means core files has occured return 3 - + + if dead_lock_check: + return 6 + if "Crash_Gen is now exiting with status code: 1" in run_code: return 1 elif "Crash_Gen is now exiting with status code: 0" in run_code: @@ -293,7 +294,7 @@ def main(): args_list = {"--auto-start-service":False ,"--max-dbs":0,"--connector-type":"native","--debug":False,"--run-tdengine":False,"--ignore-errors":[], "--track-memory-leaks":False , "--larger-data":False, "--mix-oos-data":False, "--dynamic-db-table-names":False, - "--per-thread-db-connection":False , "--record-ops":False , "--max-steps":100, "--num-threads":10, "--verify-data":False,"--use-shadow-db":False , + "--per-thread-db-connection":False , "--record-ops":False , "--max-steps":100, "--num-threads":10, "--verify-data":False,"--use-shadow-db":False , "--continue-on-exception":False } args = random_args(args_list) @@ -301,24 +302,24 @@ def main(): build_path = get_path() - + if repo =="community": crash_gen_path = build_path[:-5]+"community/tests/pytest/" elif repo =="TDengine": crash_gen_path = build_path[:-5]+"/tests/pytest/" else: pass - + if os.path.exists(crash_gen_path+"crash_gen.sh"): print(" make sure crash_gen.sh is ready") else: print( " crash_gen.sh is not exists ") sys.exit(1) - + git_commit = subprocess.Popen("cd %s && git log | head -n1"%crash_gen_path, shell=True, stdout=subprocess.PIPE,stderr=subprocess.STDOUT).stdout.read().decode("utf-8")[7:16] - + # crash_cmds = get_cmds() - + crash_cmds = get_cmds(args) # clean run_dir os.system('rm -rf %s'%run_dir ) @@ -329,9 +330,9 @@ def main(): run_crash_gen(crash_cmds) endtime = datetime.datetime.now() status = check_status() - + print("exit status : ", status) - + if status ==4: print('======== crash_gen found memory bugs ========') if status ==5: @@ -344,15 +345,15 @@ def main(): try: cmd = crash_cmds.split('&')[2] if status == 0: - log_dir = "none" + log_dir = "none" else: - log_dir= "/root/pxiao/crash_gen_logs" - + log_dir= "/root/pxiao/crash_gen_logs" + if status == 3: core_dir = "/root/pxiao/crash_gen_logs" else: core_dir = "none" - + text = f''' exit status: {msg_dict[status]} test scope: crash_gen @@ -364,12 +365,12 @@ def main(): log dir: {log_dir} core dir: {core_dir} cmd: {cmd}''' - - send_msg(get_msg(text)) + + send_msg(get_msg(text)) except Exception as e: print("exception:", e) exit(status) - + if __name__ == '__main__': main() diff --git a/tests/pytest/auto_crash_gen_valgrind.py b/tests/pytest/auto_crash_gen_valgrind.py index 29d9d617320a..1e0de6ace11f 100755 --- a/tests/pytest/auto_crash_gen_valgrind.py +++ b/tests/pytest/auto_crash_gen_valgrind.py @@ -9,15 +9,12 @@ # -*- coding: utf-8 -*- import os ,sys import random -import argparse import subprocess -import time -import platform # valgrind mode ? valgrind_mode = True -msg_dict = {0:"success" , 1:"failed" , 2:"other errors" , 3:"crash occured" , 4:"Invalid read/write" , 5:"memory leak" } +msg_dict = {0: "success", 1: "failed", 2: "other errors", 3: "crash occured", 4: "Invalid read/write", 5: "memory leak", 6: "dead locked"} # formal hostname = socket.gethostname() @@ -48,6 +45,7 @@ def send_msg(json): 'Content-Type': 'application/json' } + req = requests.post(url=group_url, headers=headers, json=json) inf = req.json() if "StatusCode" in inf and inf["StatusCode"] == 0: @@ -115,9 +113,9 @@ def random_args(args_list): # args_list["--connector-type"]=connect_types[random.randint(0,2)] args_list["--connector-type"]= connect_types[0] args_list["--max-dbs"]= random.randint(1,10) - + # dnodes = [1,3] # set single dnodes; - + # args_list["--num-dnodes"]= random.sample(dnodes,1)[0] # args_list["--num-replicas"]= random.randint(1,args_list["--num-dnodes"]) args_list["--debug"]=False @@ -125,13 +123,13 @@ def random_args(args_list): args_list["--track-memory-leaks"]=False args_list["--max-steps"]=random.randint(200,500) - + threads = [16,32] args_list["--num-threads"]=random.sample(threads,1)[0] #$ debug # args_list["--ignore-errors"]=[] ## can add error codes for detail - + args_list["--run-tdengine"]= False args_list["--use-shadow-db"]= False args_list["--dynamic-db-table-names"]= True @@ -177,7 +175,7 @@ def limits(args_list): pass # env is start by test frame , not crash_gen instance - + # elif args_list["--num-replicas"]==0: # print(" make sure num-replicas is at least 1 ") # args_list["--num-replicas"]=1 @@ -187,10 +185,10 @@ def limits(args_list): # elif args_list["--num-replicas"]>1: # if not args_list["--auto-start-service"]: # print("it should be deployed by crash_gen auto-start-service for multi replicas") - + # else: # pass - + return args_list def get_auto_mix_cmds(args_list ,valgrind=valgrind_mode): @@ -217,9 +215,9 @@ def get_auto_mix_cmds(args_list ,valgrind=valgrind_mode): arguments+="" else: arguments+=(k+"="+str(v)+" ") - + if valgrind : - + crash_gen_cmd = 'cd %s && ./crash_gen.sh --valgrind %s -g 0x32c,0x32d,0x3d3,0x18,0x2501,0x369,0x388,0x061a,0x2550,0x0203,0x4012 '%(crash_gen_path ,arguments) else: @@ -228,7 +226,6 @@ def get_auto_mix_cmds(args_list ,valgrind=valgrind_mode): return crash_gen_cmd - def start_taosd(): build_path = get_path() if repo == "community": @@ -272,7 +269,7 @@ def check_status(): if int(core_check.strip().rstrip()) > 0: # it means core files has occured return 3 - + mem_status = check_memory() if mem_status >0: return mem_status @@ -281,8 +278,8 @@ def check_status(): elif "Crash_Gen is now exiting with status code: 0" in run_code: return 0 else: - return 2 - + return 2 + def check_memory(): @@ -301,34 +298,37 @@ def check_memory(): os.mkdir(back_path) stderr_file = os.path.join(crash_gen_path , "valgrind.err") - + stdout_file = os.path.join(crash_gen_path, 'valgrind.out') + status = 0 grep_res = subprocess.Popen("grep -i 'Invalid read' %s "%stderr_file , shell=True, stdout=subprocess.PIPE,stderr=subprocess.STDOUT).stdout.read().decode("utf-8") - + if grep_res: # os.system("cp %s %s"%(stderr_file , back_path)) status = 4 - + grep_res = subprocess.Popen("grep -i 'Invalid write' %s "%stderr_file , shell=True, stdout=subprocess.PIPE,stderr=subprocess.STDOUT).stdout.read().decode("utf-8") - + if grep_res: # os.system("cp %s %s"%(stderr_file , back_path)) status = 4 - + grep_res = subprocess.Popen("grep -i 'taosMemoryMalloc' %s "%stderr_file , shell=True, stdout=subprocess.PIPE,stderr=subprocess.STDOUT).stdout.read().decode("utf-8") - + if grep_res: + # mem-leak can be also occure when exit normally when dead lock # os.system("cp %s %s"%(stderr_file , back_path)) - status = 5 - + dead_lock_res = subprocess.Popen("grep -i 'dead locked' %s "%stdout_file , shell=True, stdout=subprocess.PIPE,stderr=subprocess.STDOUT).stdout.read().decode("utf-8") + status = 6 if dead_lock_res else 5 + return status def main(): args_list = {"--auto-start-service":False ,"--max-dbs":0,"--connector-type":"native","--debug":False,"--run-tdengine":False,"--ignore-errors":[], "--track-memory-leaks":False , "--larger-data":False, "--mix-oos-data":False, "--dynamic-db-table-names":False, - "--per-thread-db-connection":False , "--record-ops":False , "--max-steps":100, "--num-threads":10, "--verify-data":False,"--use-shadow-db":False , + "--per-thread-db-connection":False , "--record-ops":False , "--max-steps":100, "--num-threads":10, "--verify-data":False,"--use-shadow-db":False , "--continue-on-exception":False } args = random_args(args_list) @@ -341,17 +341,17 @@ def main(): crash_gen_path = build_path[:-5]+"/tests/pytest/" else: pass - + if os.path.exists(crash_gen_path+"crash_gen.sh"): print(" make sure crash_gen.sh is ready") else: print( " crash_gen.sh is not exists ") sys.exit(1) - + git_commit = subprocess.Popen("cd %s && git log | head -n1"%crash_gen_path, shell=True, stdout=subprocess.PIPE,stderr=subprocess.STDOUT).stdout.read().decode("utf-8")[7:16] # crash_cmds = get_cmds() - + crash_cmds = get_cmds(args) # clean run_dir @@ -364,9 +364,9 @@ def main(): endtime = datetime.datetime.now() status = check_status() # back_path = os.path.join(core_path,"valgrind_report") - + print("exit status : ", status) - + if status ==4: print('======== crash_gen found memory bugs ========') if status ==5: @@ -379,15 +379,15 @@ def main(): try: cmd = crash_cmds.split('&')[2] if status == 0: - log_dir = "none" + log_dir = "none" else: - log_dir= "/root/pxiao/crash_gen_logs" - + log_dir= "/root/pxiao/crash_gen_logs" + if status == 3: core_dir = "/root/pxiao/crash_gen_logs" else: core_dir = "none" - + text = f''' exit status: {msg_dict[status]} test scope: crash_gen @@ -399,12 +399,12 @@ def main(): log dir: {log_dir} core dir: {core_dir} cmd: {cmd}''' - + send_msg(get_msg(text)) except Exception as e: print("exception:", e) exit(status) - + if __name__ == '__main__': main() diff --git a/tests/pytest/auto_crash_gen_valgrind_cluster.py b/tests/pytest/auto_crash_gen_valgrind_cluster.py index 8546d436de0d..22f453e51ef0 100755 --- a/tests/pytest/auto_crash_gen_valgrind_cluster.py +++ b/tests/pytest/auto_crash_gen_valgrind_cluster.py @@ -1,23 +1,17 @@ #!/usr/bin/python3 - - +# -*- coding: utf-8 -*- import datetime import os import socket import requests - -# -*- coding: utf-8 -*- import os ,sys import random -import argparse import subprocess -import time -import platform # valgrind mode ? valgrind_mode = True -msg_dict = {0:"success" , 1:"failed" , 2:"other errors" , 3:"crash occured" , 4:"Invalid read/write" , 5:"memory leak" } +msg_dict = {0: "success", 1: "failed", 2: "other errors", 3: "crash occured", 4: "Invalid read/write", 5: "memory leak", 6: "dead locked"} # formal hostname = socket.gethostname() @@ -115,9 +109,9 @@ def random_args(args_list): # args_list["--connector-type"]=connect_types[random.randint(0,2)] args_list["--connector-type"]= connect_types[0] args_list["--max-dbs"]= random.randint(1,10) - + # dnodes = [1,3] # set single dnodes; - + # args_list["--num-dnodes"]= random.sample(dnodes,1)[0] # args_list["--num-replicas"]= random.randint(1,args_list["--num-dnodes"]) args_list["--debug"]=False @@ -125,13 +119,12 @@ def random_args(args_list): args_list["--track-memory-leaks"]=False args_list["--max-steps"]=random.randint(200,500) - + threads = [16,32] args_list["--num-threads"]=random.sample(threads,1)[0] #$ debug # args_list["--ignore-errors"]=[] ## can add error codes for detail - args_list["--run-tdengine"]= False args_list["--use-shadow-db"]= False args_list["--dynamic-db-table-names"]= True @@ -177,7 +170,7 @@ def limits(args_list): pass # env is start by test frame , not crash_gen instance - + # elif args_list["--num-replicas"]==0: # print(" make sure num-replicas is at least 1 ") # args_list["--num-replicas"]=1 @@ -187,10 +180,9 @@ def limits(args_list): # elif args_list["--num-replicas"]>1: # if not args_list["--auto-start-service"]: # print("it should be deployed by crash_gen auto-start-service for multi replicas") - + # else: # pass - return args_list def get_auto_mix_cmds(args_list ,valgrind=valgrind_mode): @@ -217,18 +209,13 @@ def get_auto_mix_cmds(args_list ,valgrind=valgrind_mode): arguments+="" else: arguments+=(k+"="+str(v)+" ") - + if valgrind : - crash_gen_cmd = 'cd %s && ./crash_gen.sh --valgrind -i 3 %s -g 0x32c,0x32d,0x3d3,0x18,0x2501,0x369,0x388,0x061a,0x2550,0x0707,0x0203,0x4012 '%(crash_gen_path ,arguments) - else: - crash_gen_cmd = 'cd %s && ./crash_gen.sh -i 3 %s -g 0x32c,0x32d,0x3d3,0x18,0x2501,0x369,0x388,0x061a,0x2550,0x0014,0x0707,0x0203,0x4012'%(crash_gen_path ,arguments) - return crash_gen_cmd - def start_taosd(): build_path = get_path() if repo == "community": @@ -242,7 +229,7 @@ def start_taosd(): os.system(start_cmd +">>/dev/null") def get_cmds(args_list): - + crash_gen_cmd = get_auto_mix_cmds(args_list,valgrind=valgrind_mode) return crash_gen_cmd @@ -272,7 +259,7 @@ def check_status(): if int(core_check.strip().rstrip()) > 0: # it means core files has occured return 3 - + mem_status = check_memory() if mem_status >0: return mem_status @@ -281,8 +268,7 @@ def check_status(): elif "Crash_Gen is now exiting with status code: 0" in run_code: return 0 else: - return 2 - + return 2 def check_memory(): @@ -301,57 +287,58 @@ def check_memory(): os.mkdir(back_path) stderr_file = os.path.join(crash_gen_path , "valgrind.err") - + stdout_file = os.path.join(crash_gen_path, 'valgrind.out') status = 0 grep_res = subprocess.Popen("grep -i 'Invalid read' %s "%stderr_file , shell=True, stdout=subprocess.PIPE,stderr=subprocess.STDOUT).stdout.read().decode("utf-8") - + if grep_res: # os.system("cp %s %s"%(stderr_file , back_path)) status = 4 - + grep_res = subprocess.Popen("grep -i 'Invalid write' %s "%stderr_file , shell=True, stdout=subprocess.PIPE,stderr=subprocess.STDOUT).stdout.read().decode("utf-8") - + if grep_res: # os.system("cp %s %s"%(stderr_file , back_path)) status = 4 - + grep_res = subprocess.Popen("grep -i 'taosMemoryMalloc' %s "%stderr_file , shell=True, stdout=subprocess.PIPE,stderr=subprocess.STDOUT).stdout.read().decode("utf-8") - + if grep_res: + # mem-leak can be also occure when exit normally when dead lock # os.system("cp %s %s"%(stderr_file , back_path)) - status = 5 - + dead_lock_res = subprocess.Popen("grep -i 'dead locked' %s "%stdout_file , shell=True, stdout=subprocess.PIPE,stderr=subprocess.STDOUT).stdout.read().decode("utf-8") + status = 6 if dead_lock_res else 5 + return status def main(): - args_list = {"--auto-start-service":False ,"--max-dbs":0,"--connector-type":"native","--debug":False,"--run-tdengine":False,"--ignore-errors":[], "--track-memory-leaks":False , "--larger-data":False, "--mix-oos-data":False, "--dynamic-db-table-names":False, - "--per-thread-db-connection":False , "--record-ops":False , "--max-steps":100, "--num-threads":10, "--verify-data":False,"--use-shadow-db":False , + "--per-thread-db-connection":False , "--record-ops":False , "--max-steps":100, "--num-threads":10, "--verify-data":False,"--use-shadow-db":False , "--continue-on-exception":False } args = random_args(args_list) args = limits(args) - build_path = get_path() + build_path = get_path() if repo =="community": crash_gen_path = build_path[:-5]+"community/tests/pytest/" elif repo =="TDengine": crash_gen_path = build_path[:-5]+"/tests/pytest/" else: pass - + if os.path.exists(crash_gen_path+"crash_gen.sh"): print(" make sure crash_gen.sh is ready") else: print( " crash_gen.sh is not exists ") sys.exit(1) - + git_commit = subprocess.Popen("cd %s && git log | head -n1"%crash_gen_path, shell=True, stdout=subprocess.PIPE,stderr=subprocess.STDOUT).stdout.read().decode("utf-8")[7:16] # crash_cmds = get_cmds() - + crash_cmds = get_cmds(args) # clean run_dir @@ -364,9 +351,9 @@ def main(): endtime = datetime.datetime.now() status = check_status() # back_path = os.path.join(core_path,"valgrind_report") - + print("exit status : ", status) - + if status ==4: print('======== crash_gen found memory bugs ========') if status ==5: @@ -379,15 +366,15 @@ def main(): try: cmd = crash_cmds.split('&')[2] if status == 0: - log_dir = "none" + log_dir = "none" else: - log_dir= "/root/pxiao/crash_gen_logs" - + log_dir= "/root/pxiao/crash_gen_logs" + if status == 3: core_dir = "/root/pxiao/crash_gen_logs" else: core_dir = "none" - + text = f''' exit status: {msg_dict[status]} test scope: crash_gen @@ -399,12 +386,11 @@ def main(): log dir: {log_dir} core dir: {core_dir} cmd: {cmd}''' - - send_msg(get_msg(text)) + + send_msg(get_msg(text)) except Exception as e: print("exception:", e) exit(status) - if __name__ == '__main__': main() From a29f6145b0560a84ce4a02180a39573dc6a873b7 Mon Sep 17 00:00:00 2001 From: xsren <285808407@qq.com> Date: Thu, 24 Oct 2024 06:40:37 +0800 Subject: [PATCH 217/695] check skip:pcol.pdata --- source/common/src/tdatablock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c index cb5b7468444f..ee551d54db5f 100644 --- a/source/common/src/tdatablock.c +++ b/source/common/src/tdatablock.c @@ -3554,7 +3554,7 @@ int32_t blockDataCheck(const SSDataBlock* pDataBlock) { for (int64_t r = 0; r < checkRows; ++r) { if (tsSafetyCheckLevel <= TSDB_SAFETY_CHECK_LEVELL_NORMAL) break; if (!colDataIsNull_s(pCol, r)) { - BLOCK_DATA_CHECK_TRESSA(pCol->pData); + // BLOCK_DATA_CHECK_TRESSA(pCol->pData); BLOCK_DATA_CHECK_TRESSA(pCol->varmeta.length <= pCol->varmeta.allocLen); if (isVarType) { From f91226b1d6357aca99b3b0976e5115629bf3be67 Mon Sep 17 00:00:00 2001 From: xsren <285808407@qq.com> Date: Thu, 24 Oct 2024 06:53:47 +0800 Subject: [PATCH 218/695] skip: pCol.pData Null --- source/common/src/tdatablock.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c index ee551d54db5f..b47abeeb65c7 100644 --- a/source/common/src/tdatablock.c +++ b/source/common/src/tdatablock.c @@ -3543,6 +3543,7 @@ int32_t blockDataCheck(const SSDataBlock* pDataBlock) { SColumnInfoData* pCol = (SColumnInfoData*)taosArrayGet(pDataBlock->pDataBlock, i); isVarType = IS_VAR_DATA_TYPE(pCol->info.type); checkRows = pDataBlock->info.rows; + if(pCol->pData == NULL) continue; if (isVarType) { BLOCK_DATA_CHECK_TRESSA(pCol->varmeta.offset); From 80522809efd22f12117014a943b9669bbdf33d10 Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Thu, 24 Oct 2024 09:16:24 +0800 Subject: [PATCH 219/695] test/system: use 100 instead of 300 --- tests/system-test/0-others/compatibility.py | 2 +- tests/system-test/0-others/compatibility_coverage.py | 2 +- tests/system-test/0-others/udfTest.py | 2 +- tests/system-test/0-others/udf_cfg1.py | 2 +- tests/system-test/0-others/udf_cfg2.py | 2 +- tests/system-test/0-others/udf_cluster.py | 2 +- tests/system-test/0-others/udf_create.py | 2 +- tests/system-test/0-others/udf_restart_taosd.py | 2 +- tests/system-test/2-query/abs.py | 2 +- tests/system-test/2-query/and_or_for_byte.py | 2 +- tests/system-test/2-query/countAlwaysReturnValue.py | 2 +- tests/system-test/2-query/distribute_agg_apercentile.py | 2 +- tests/system-test/2-query/distribute_agg_avg.py | 2 +- tests/system-test/2-query/distribute_agg_max.py | 2 +- tests/system-test/2-query/distribute_agg_min.py | 2 +- tests/system-test/2-query/distribute_agg_spread.py | 2 +- tests/system-test/2-query/distribute_agg_stddev.py | 2 +- tests/system-test/2-query/distribute_agg_sum.py | 2 +- tests/system-test/2-query/function_null.py | 4 ++-- tests/system-test/2-query/irate.py | 2 +- tests/system-test/2-query/last_row.py | 6 +++--- tests/system-test/2-query/sample.py | 2 +- tests/system-test/2-query/twa.py | 2 +- tests/system-test/6-cluster/5dnode1mnode.py | 2 +- tests/system-test/6-cluster/5dnode2mnode.py | 2 +- tests/system-test/6-cluster/5dnode3mnodeAdd1Ddnoe.py | 4 ++-- tests/system-test/6-cluster/5dnode3mnodeDrop.py | 2 +- tests/system-test/6-cluster/5dnode3mnodeDropInsert.py | 4 ++-- tests/system-test/6-cluster/5dnode3mnodeRecreateMnode.py | 4 ++-- .../6-cluster/5dnode3mnodeRestartDnodeInsertData.py | 4 ++-- tests/system-test/6-cluster/5dnode3mnodeRoll.py | 6 +++--- .../6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateDb.py | 4 ++-- .../6-cluster/5dnode3mnodeSep1VnodeStopDnodeInsertData.py | 4 ++-- .../6-cluster/5dnode3mnodeSep1VnodeStopDnodeRCreateDb.py | 4 ++-- .../6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateStb.py | 4 ++-- .../6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateStb.py | 4 ++-- .../6-cluster/5dnode3mnodeSepVnodeStopDnodeCreateUser.py | 4 ++-- tests/system-test/6-cluster/5dnode3mnodeStopInsert.py | 4 ++-- .../6dnode3mnodeInsertDataRebootAlterRep1-3.py | 4 ++-- .../6dnode3mnodeInsertDatarRebootAlterRep1-3.py | 4 ++-- .../6dnode3mnodeInsertLessDataAlterRep3to1to3.py | 4 ++-- .../6-cluster/vnode/4dnode1mnode_basic_createDb_replica1.py | 2 +- .../vnode/4dnode1mnode_basic_replica1_insertdatas.py | 2 +- .../vnode/4dnode1mnode_basic_replica1_insertdatas_querys.py | 2 +- .../vnode/4dnode1mnode_basic_replica3_insertdatas.py | 2 +- .../vnode/4dnode1mnode_basic_replica3_insertdatas_querys.py | 2 +- ...ic_replica3_insertdatas_querys_loop_restart_all_vnode.py | 2 +- ...sic_replica3_insertdatas_querys_loop_restart_follower.py | 2 +- ...basic_replica3_insertdatas_querys_loop_restart_leader.py | 2 +- ...e1mnode_basic_replica3_insertdatas_stop_follower_sync.py | 2 +- ...mnode_basic_replica3_insertdatas_stop_follower_unsync.py | 2 +- ..._replica3_insertdatas_stop_follower_unsync_force_stop.py | 2 +- ...de_basic_replica3_insertdatas_stop_leader_forece_stop.py | 2 +- ...4dnode1mnode_basic_replica3_mnode3_insertdatas_querys.py | 2 +- .../6-cluster/vnode/4dnode1mnode_basic_replica3_vgroups.py | 2 +- .../vnode/4dnode1mnode_basic_replica3_vgroups_stopOne.py | 2 +- 56 files changed, 75 insertions(+), 75 deletions(-) diff --git a/tests/system-test/0-others/compatibility.py b/tests/system-test/0-others/compatibility.py index 9ba3bd0d2ff5..7c3eb48fe1de 100644 --- a/tests/system-test/0-others/compatibility.py +++ b/tests/system-test/0-others/compatibility.py @@ -32,7 +32,7 @@ def init(self, conn, logSql, replicaVar=1): self.replicaVar = int(replicaVar) tdLog.debug(f"start to excute {__file__}") tdSql.init(conn.cursor()) - self.deletedDataSql= '''drop database if exists deldata;create database deldata duration 300 stt_trigger 1; ;use deldata; + self.deletedDataSql= '''drop database if exists deldata;create database deldata duration 100 stt_trigger 1; ;use deldata; create table deldata.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); create table deldata.ct1 using deldata.stb1 tags ( 1 ); insert into deldata.ct1 values ( now()-0s, 0, 0, 0, 0, 0.0, 0.0, 0, 'binary0', 'nchar0', now()+0a ) ( now()-10s, 1, 11111, 111, 11, 1.11, 11.11, 1, 'binary1', 'nchar1', now()+1a ) ( now()-20s, 2, 22222, 222, 22, 2.22, 22.22, 0, 'binary2', 'nchar2', now()+2a ) ( now()-30s, 3, 33333, 333, 33, 3.33, 33.33, 1, 'binary3', 'nchar3', now()+3a ); diff --git a/tests/system-test/0-others/compatibility_coverage.py b/tests/system-test/0-others/compatibility_coverage.py index 6eccf78c5a0e..bf7689277736 100644 --- a/tests/system-test/0-others/compatibility_coverage.py +++ b/tests/system-test/0-others/compatibility_coverage.py @@ -30,7 +30,7 @@ def init(self, conn, logSql, replicaVar=1): self.replicaVar = int(replicaVar) tdLog.debug(f"start to excute {__file__}") tdSql.init(conn.cursor()) - self.deletedDataSql= '''drop database if exists deldata;create database deldata duration 300 stt_trigger 1; ;use deldata; + self.deletedDataSql= '''drop database if exists deldata;create database deldata duration 100 stt_trigger 1; ;use deldata; create table deldata.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); create table deldata.ct1 using deldata.stb1 tags ( 1 ); insert into deldata.ct1 values ( now()-0s, 0, 0, 0, 0, 0.0, 0.0, 0, 'binary0', 'nchar0', now()+0a ) ( now()-10s, 1, 11111, 111, 11, 1.11, 11.11, 1, 'binary1', 'nchar1', now()+1a ) ( now()-20s, 2, 22222, 222, 22, 2.22, 22.22, 0, 'binary2', 'nchar2', now()+2a ) ( now()-30s, 3, 33333, 333, 33, 3.33, 33.33, 1, 'binary3', 'nchar3', now()+3a ); diff --git a/tests/system-test/0-others/udfTest.py b/tests/system-test/0-others/udfTest.py index 88d0d420f73f..829a8aec273a 100644 --- a/tests/system-test/0-others/udfTest.py +++ b/tests/system-test/0-others/udfTest.py @@ -61,7 +61,7 @@ def prepare_udf_so(self): def prepare_data(self): tdSql.execute("drop database if exists db ") - tdSql.execute("create database if not exists db duration 300") + tdSql.execute("create database if not exists db duration 100") tdSql.execute("use db") tdSql.execute( '''create table stb1 diff --git a/tests/system-test/0-others/udf_cfg1.py b/tests/system-test/0-others/udf_cfg1.py index 913e5fcca142..a92f3bce31fc 100644 --- a/tests/system-test/0-others/udf_cfg1.py +++ b/tests/system-test/0-others/udf_cfg1.py @@ -63,7 +63,7 @@ def prepare_udf_so(self): def prepare_data(self): tdSql.execute("drop database if exists db ") - tdSql.execute("create database if not exists db duration 300") + tdSql.execute("create database if not exists db duration 100") tdSql.execute("use db") tdSql.execute( '''create table stb1 diff --git a/tests/system-test/0-others/udf_cfg2.py b/tests/system-test/0-others/udf_cfg2.py index b535b4f626cd..89c40309778b 100644 --- a/tests/system-test/0-others/udf_cfg2.py +++ b/tests/system-test/0-others/udf_cfg2.py @@ -63,7 +63,7 @@ def prepare_udf_so(self): def prepare_data(self): tdSql.execute("drop database if exists db ") - tdSql.execute("create database if not exists db duration 300") + tdSql.execute("create database if not exists db duration 100") tdSql.execute("use db") tdSql.execute( '''create table stb1 diff --git a/tests/system-test/0-others/udf_cluster.py b/tests/system-test/0-others/udf_cluster.py index 9253be4ea37e..c41412c10d1c 100644 --- a/tests/system-test/0-others/udf_cluster.py +++ b/tests/system-test/0-others/udf_cluster.py @@ -64,7 +64,7 @@ def prepare_udf_so(self): def prepare_data(self): tdSql.execute("drop database if exists db") - tdSql.execute("create database if not exists db replica 1 duration 300") + tdSql.execute("create database if not exists db replica 1 duration 100") tdSql.execute("use db") tdSql.execute( '''create table stb1 diff --git a/tests/system-test/0-others/udf_create.py b/tests/system-test/0-others/udf_create.py index 6071561035d2..9038d99ff950 100644 --- a/tests/system-test/0-others/udf_create.py +++ b/tests/system-test/0-others/udf_create.py @@ -73,7 +73,7 @@ def prepare_udf_so(self): def prepare_data(self): tdSql.execute("drop database if exists db ") - tdSql.execute("create database if not exists db duration 300") + tdSql.execute("create database if not exists db duration 100") tdSql.execute("use db") tdSql.execute( '''create table stb1 diff --git a/tests/system-test/0-others/udf_restart_taosd.py b/tests/system-test/0-others/udf_restart_taosd.py index 61b6a4ea684f..c99e864e7134 100644 --- a/tests/system-test/0-others/udf_restart_taosd.py +++ b/tests/system-test/0-others/udf_restart_taosd.py @@ -60,7 +60,7 @@ def prepare_udf_so(self): def prepare_data(self): tdSql.execute("drop database if exists db ") - tdSql.execute("create database if not exists db duration 300") + tdSql.execute("create database if not exists db duration 100") tdSql.execute("use db") tdSql.execute( '''create table stb1 diff --git a/tests/system-test/2-query/abs.py b/tests/system-test/2-query/abs.py index 0eabd915350c..db841af03983 100644 --- a/tests/system-test/2-query/abs.py +++ b/tests/system-test/2-query/abs.py @@ -127,7 +127,7 @@ def prepare_datas(self, dbname="db"): def prepare_tag_datas(self, dbname="testdb"): # prepare datas tdSql.execute( - f"create database if not exists {dbname} keep 3650 duration 1000 replica {self.replicaVar} ") + f"create database if not exists {dbname} keep 3650 duration 100 replica {self.replicaVar} ") tdSql.execute(" use testdb ") tdSql.execute( f'''create table {dbname}.stb1 diff --git a/tests/system-test/2-query/and_or_for_byte.py b/tests/system-test/2-query/and_or_for_byte.py index 5b2fb5199856..ca9c1f2bef85 100644 --- a/tests/system-test/2-query/and_or_for_byte.py +++ b/tests/system-test/2-query/and_or_for_byte.py @@ -128,7 +128,7 @@ def prepare_datas(self, dbname="db"): def prepare_tag_datas(self, dbname="testdb"): # prepare datas tdSql.execute( - f"create database if not exists {dbname} keep 3650 duration 1000") + f"create database if not exists {dbname} keep 3650 duration 100") tdSql.execute(f" use {dbname} ") tdSql.execute( f'''create table {dbname}.stb1 diff --git a/tests/system-test/2-query/countAlwaysReturnValue.py b/tests/system-test/2-query/countAlwaysReturnValue.py index bced89456e68..a6a064ddfd61 100644 --- a/tests/system-test/2-query/countAlwaysReturnValue.py +++ b/tests/system-test/2-query/countAlwaysReturnValue.py @@ -18,7 +18,7 @@ def init(self, conn, logSql, replicaVar=1): def prepare_data(self, dbname="db"): tdSql.execute( - f"create database if not exists {dbname} keep 3650 duration 1000") + f"create database if not exists {dbname} keep 3650 duration 100") tdSql.execute(f"use {dbname} ") tdSql.execute( f"create table {dbname}.tb (ts timestamp, c0 int)" diff --git a/tests/system-test/2-query/distribute_agg_apercentile.py b/tests/system-test/2-query/distribute_agg_apercentile.py index 23ca0b9fae23..0a2f7ce45ffb 100644 --- a/tests/system-test/2-query/distribute_agg_apercentile.py +++ b/tests/system-test/2-query/distribute_agg_apercentile.py @@ -18,7 +18,7 @@ def init(self, conn, logSql, replicaVar=1): def prepare_datas_of_distribute(self, dbname="testdb"): # prepate datas for 20 tables distributed at different vgroups - tdSql.execute(f"create database if not exists {dbname} keep 3650 duration 1000 s3_keeplocal 3000 vgroups 5") + tdSql.execute(f"create database if not exists {dbname} keep 3650 duration 100 s3_keeplocal 3000 vgroups 5") tdSql.execute(f" use {dbname} ") tdSql.execute( f'''create table {dbname}.stb1 diff --git a/tests/system-test/2-query/distribute_agg_avg.py b/tests/system-test/2-query/distribute_agg_avg.py index 1cd24103f88c..497c3e9facf9 100644 --- a/tests/system-test/2-query/distribute_agg_avg.py +++ b/tests/system-test/2-query/distribute_agg_avg.py @@ -35,7 +35,7 @@ def check_avg_functions(self, tbname , col_name): def prepare_datas_of_distribute(self, dbname="testdb"): # prepate datas for 20 tables distributed at different vgroups - tdSql.execute(f"create database if not exists {dbname} keep 3650 duration 1000 vgroups 5") + tdSql.execute(f"create database if not exists {dbname} keep 3650 duration 100 vgroups 5") tdSql.execute(f" use {dbname} ") tdSql.execute( f'''create table {dbname}.stb1 diff --git a/tests/system-test/2-query/distribute_agg_max.py b/tests/system-test/2-query/distribute_agg_max.py index fb91216c3ea6..53379ecbb389 100644 --- a/tests/system-test/2-query/distribute_agg_max.py +++ b/tests/system-test/2-query/distribute_agg_max.py @@ -38,7 +38,7 @@ def check_max_functions(self, tbname , col_name): def prepare_datas_of_distribute(self, dbname="testdb"): # prepate datas for 20 tables distributed at different vgroups - tdSql.execute(f"create database if not exists {dbname} keep 3650 duration 1000 vgroups 5") + tdSql.execute(f"create database if not exists {dbname} keep 3650 duration 100 vgroups 5") tdSql.execute(f" use {dbname} ") tdSql.execute( f'''create table {dbname}.stb1 diff --git a/tests/system-test/2-query/distribute_agg_min.py b/tests/system-test/2-query/distribute_agg_min.py index 266779864011..01bc3da4a0f8 100644 --- a/tests/system-test/2-query/distribute_agg_min.py +++ b/tests/system-test/2-query/distribute_agg_min.py @@ -37,7 +37,7 @@ def check_min_functions(self, tbname , col_name): def prepare_datas_of_distribute(self, dbname="testdb"): # prepate datas for 20 tables distributed at different vgroups - tdSql.execute(f"create database if not exists {dbname} keep 3650 duration 1000 vgroups 5") + tdSql.execute(f"create database if not exists {dbname} keep 3650 duration 100 vgroups 5") tdSql.execute(f" use {dbname} ") tdSql.execute( f'''create table {dbname}.stb1 diff --git a/tests/system-test/2-query/distribute_agg_spread.py b/tests/system-test/2-query/distribute_agg_spread.py index 0247a91861a8..8dc91f712a2e 100644 --- a/tests/system-test/2-query/distribute_agg_spread.py +++ b/tests/system-test/2-query/distribute_agg_spread.py @@ -37,7 +37,7 @@ def check_spread_functions(self, tbname , col_name): def prepare_datas_of_distribute(self, dbname="testdb"): # prepate datas for 20 tables distributed at different vgroups - tdSql.execute(f"create database if not exists {dbname} keep 3650 duration 1000 vgroups 5") + tdSql.execute(f"create database if not exists {dbname} keep 3650 duration 100 vgroups 5") tdSql.execute(f" use {dbname}") tdSql.execute( f'''create table {dbname}.stb1 diff --git a/tests/system-test/2-query/distribute_agg_stddev.py b/tests/system-test/2-query/distribute_agg_stddev.py index 80bab3082d3f..f5383739ff62 100644 --- a/tests/system-test/2-query/distribute_agg_stddev.py +++ b/tests/system-test/2-query/distribute_agg_stddev.py @@ -46,7 +46,7 @@ def check_stddev_functions(self, tbname , col_name): def prepare_datas_of_distribute(self, dbname="testdb"): # prepate datas for 20 tables distributed at different vgroups - tdSql.execute(f"create database if not exists {dbname} keep 3650 duration 1000 vgroups 5") + tdSql.execute(f"create database if not exists {dbname} keep 3650 duration 100 vgroups 5") tdSql.execute(f" use {dbname}") tdSql.execute( f'''create table {dbname}.stb1 diff --git a/tests/system-test/2-query/distribute_agg_sum.py b/tests/system-test/2-query/distribute_agg_sum.py index da26fd58f934..fbe0221dd675 100644 --- a/tests/system-test/2-query/distribute_agg_sum.py +++ b/tests/system-test/2-query/distribute_agg_sum.py @@ -35,7 +35,7 @@ def check_sum_functions(self, tbname , col_name): def prepare_datas_of_distribute(self, dbname="testdb"): # prepate datas for 20 tables distributed at different vgroups - tdSql.execute(f"create database if not exists {dbname} keep 3650 duration 1000 vgroups 5") + tdSql.execute(f"create database if not exists {dbname} keep 3650 duration 100 vgroups 5") tdSql.execute(f" use {dbname}") tdSql.execute( f'''create table {dbname}.stb1 diff --git a/tests/system-test/2-query/function_null.py b/tests/system-test/2-query/function_null.py index e5056b7c5635..712c98d48bf7 100644 --- a/tests/system-test/2-query/function_null.py +++ b/tests/system-test/2-query/function_null.py @@ -23,7 +23,7 @@ def init(self, conn, logSql, replicaVar=1): def prepare_tag_datas(self, dbname="testdb"): # prepare datas tdSql.execute( - f"create database if not exists {dbname} keep 3650 duration 1000") + f"create database if not exists {dbname} keep 3650 duration 100") tdSql.execute(f"use {dbname} ") tdSql.execute( f'''create table {dbname}.stb1 @@ -249,4 +249,4 @@ def stop(self): tdCases.addLinux(__file__, TDTestCase()) -tdCases.addWindows(__file__, TDTestCase()) \ No newline at end of file +tdCases.addWindows(__file__, TDTestCase()) diff --git a/tests/system-test/2-query/irate.py b/tests/system-test/2-query/irate.py index 82841541f045..69aa7f19faa5 100644 --- a/tests/system-test/2-query/irate.py +++ b/tests/system-test/2-query/irate.py @@ -78,7 +78,7 @@ def insert_datas_and_check_irate(self ,tbnums , rownums , time_step ): def prepare_tag_datas(self, dbname="testdb"): # prepare datas tdSql.execute( - f"create database if not exists {dbname} keep 3650 duration 1000") + f"create database if not exists {dbname} keep 3650 duration 100") tdSql.execute(f"use {dbname} ") tdSql.execute( f'''create table {dbname}.stb1 diff --git a/tests/system-test/2-query/last_row.py b/tests/system-test/2-query/last_row.py index 395c754aa6f9..153418305642 100644 --- a/tests/system-test/2-query/last_row.py +++ b/tests/system-test/2-query/last_row.py @@ -61,7 +61,7 @@ def insert_datas_and_check_abs(self, tbnums, rownums, time_step, cache_value, db def prepare_datas(self ,cache_value, dbname="db"): tdSql.execute(f"drop database if exists {dbname} ") - create_db_sql = f"create database if not exists {dbname} keep 3650 duration 1000 cachemodel {cache_value}" + create_db_sql = f"create database if not exists {dbname} keep 3650 duration 100 cachemodel {cache_value}" tdSql.execute(create_db_sql) tdSql.execute(f"use {dbname}") @@ -129,7 +129,7 @@ def prepare_tag_datas(self,cache_value, dbname="testdb"): tdSql.execute(f"drop database if exists {dbname} ") # prepare datas - tdSql.execute(f"create database if not exists {dbname} keep 3650 duration 1000 cachemodel {cache_value}") + tdSql.execute(f"create database if not exists {dbname} keep 3650 duration 100 cachemodel {cache_value}") tdSql.execute(f"use {dbname} ") @@ -871,7 +871,7 @@ def basic_query(self): def initLastRowDelayTest(self, dbname="db"): tdSql.execute(f"drop database if exists {dbname} ") - create_db_sql = f"create database if not exists {dbname} keep 3650 duration 1000 cachemodel 'NONE' REPLICA 1" + create_db_sql = f"create database if not exists {dbname} keep 3650 duration 100 cachemodel 'NONE' REPLICA 1" tdSql.execute(create_db_sql) time.sleep(3) diff --git a/tests/system-test/2-query/sample.py b/tests/system-test/2-query/sample.py index a43c2e635eb7..efead7735b47 100644 --- a/tests/system-test/2-query/sample.py +++ b/tests/system-test/2-query/sample.py @@ -611,7 +611,7 @@ def check_sample(self , sample_query , origin_query ): def basic_sample_query(self, dbname="db"): tdSql.execute(f" drop database if exists {dbname} ") - tdSql.execute(f" create database if not exists {dbname} duration 300d ") + tdSql.execute(f" create database if not exists {dbname} duration 120d ") tdSql.execute( 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) diff --git a/tests/system-test/2-query/twa.py b/tests/system-test/2-query/twa.py index 16b9779fa85b..ebd439fd0993 100644 --- a/tests/system-test/2-query/twa.py +++ b/tests/system-test/2-query/twa.py @@ -22,7 +22,7 @@ def init(self, conn, logSql, replicaVar=1): def prepare_datas_of_distribute(self, dbname="testdb"): # prepate datas for 20 tables distributed at different vgroups - tdSql.execute(f"create database if not exists {dbname} keep 3650 duration 1000 vgroups 5") + tdSql.execute(f"create database if not exists {dbname} keep 3650 duration 100 vgroups 5") tdSql.execute( 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,c11 int UNSIGNED, c12 bigint UNSIGNED, c13 smallint UNSIGNED, c14 tinyint UNSIGNED) diff --git a/tests/system-test/6-cluster/5dnode1mnode.py b/tests/system-test/6-cluster/5dnode1mnode.py index 61451f03b192..ae093ffb908a 100644 --- a/tests/system-test/6-cluster/5dnode1mnode.py +++ b/tests/system-test/6-cluster/5dnode1mnode.py @@ -110,7 +110,7 @@ def five_dnode_one_mnode(self): tdSql.error("drop mnode on dnode 1;") tdSql.execute("drop database if exists db") - tdSql.execute("create database if not exists db replica 1 duration 300") + tdSql.execute("create database if not exists db replica 1 duration 100") tdSql.execute("use db") tdSql.execute( '''create table stb1 diff --git a/tests/system-test/6-cluster/5dnode2mnode.py b/tests/system-test/6-cluster/5dnode2mnode.py index ca7d6a58d54d..aa9c3fc053e7 100644 --- a/tests/system-test/6-cluster/5dnode2mnode.py +++ b/tests/system-test/6-cluster/5dnode2mnode.py @@ -84,7 +84,7 @@ def five_dnode_two_mnode(self): # fisrt add data : db\stable\childtable\general table tdSql.execute("drop database if exists db2") - tdSql.execute("create database if not exists db2 replica 1 duration 300") + tdSql.execute("create database if not exists db2 replica 1 duration 100") tdSql.execute("use db2") tdSql.execute( '''create table stb1 diff --git a/tests/system-test/6-cluster/5dnode3mnodeAdd1Ddnoe.py b/tests/system-test/6-cluster/5dnode3mnodeAdd1Ddnoe.py index f0f9c9556636..e2cf0d3dd3e2 100644 --- a/tests/system-test/6-cluster/5dnode3mnodeAdd1Ddnoe.py +++ b/tests/system-test/6-cluster/5dnode3mnodeAdd1Ddnoe.py @@ -73,8 +73,8 @@ def insertData(self,countstart,countstop): for couti in range(countstart,countstop): tdLog.debug("drop database if exists db%d" %couti) tdSql.execute("drop database if exists db%d" %couti, 20) - print("create database if not exists db%d replica 1 duration 300" %couti) - tdSql.execute("create database if not exists db%d replica 1 duration 300" %couti) + print("create database if not exists db%d replica 1 duration 100" %couti) + tdSql.execute("create database if not exists db%d replica 1 duration 100" %couti) tdSql.execute("use db%d" %couti) tdSql.execute( '''create table stb1 diff --git a/tests/system-test/6-cluster/5dnode3mnodeDrop.py b/tests/system-test/6-cluster/5dnode3mnodeDrop.py index aefa7a09f898..0ac28b2d1674 100644 --- a/tests/system-test/6-cluster/5dnode3mnodeDrop.py +++ b/tests/system-test/6-cluster/5dnode3mnodeDrop.py @@ -58,7 +58,7 @@ def insert_data(self,count): # fisrt add data : db\stable\childtable\general table for couti in count: tdSql.execute("drop database if exists db%d" %couti) - tdSql.execute("create database if not exists db%d replica 1 duration 300" %couti) + tdSql.execute("create database if not exists db%d replica 1 duration 100" %couti) tdSql.execute("use db%d" %couti) tdSql.execute( '''create table stb1 diff --git a/tests/system-test/6-cluster/5dnode3mnodeDropInsert.py b/tests/system-test/6-cluster/5dnode3mnodeDropInsert.py index db183d80c164..26ead3dc2b8a 100644 --- a/tests/system-test/6-cluster/5dnode3mnodeDropInsert.py +++ b/tests/system-test/6-cluster/5dnode3mnodeDropInsert.py @@ -78,8 +78,8 @@ def createDbTbale(self,dbcountStart,dbcountStop,stbname,chilCount): for couti in range(dbcountStart,dbcountStop): tdLog.debug("drop database if exists db%d" %couti) tdSql.execute("drop database if exists db%d" %couti) - print("create database if not exists db%d replica 1 duration 300" %couti) - tdSql.execute("create database if not exists db%d replica 1 duration 300" %couti) + print("create database if not exists db%d replica 1 duration 100" %couti) + tdSql.execute("create database if not exists db%d replica 1 duration 100" %couti) tdSql.execute("use db%d" %couti) tdSql.execute( '''create table %s diff --git a/tests/system-test/6-cluster/5dnode3mnodeRecreateMnode.py b/tests/system-test/6-cluster/5dnode3mnodeRecreateMnode.py index 7af5982decbe..2941a643fd42 100644 --- a/tests/system-test/6-cluster/5dnode3mnodeRecreateMnode.py +++ b/tests/system-test/6-cluster/5dnode3mnodeRecreateMnode.py @@ -72,8 +72,8 @@ def insertData(self,countstart,countstop): for couti in range(countstart,countstop): tdLog.debug("drop database if exists db%d" %couti) tdSql.execute("drop database if exists db%d" %couti) - print("create database if not exists db%d replica 1 duration 300" %couti) - tdSql.execute("create database if not exists db%d replica 1 duration 300" %couti) + print("create database if not exists db%d replica 1 duration 100" %couti) + tdSql.execute("create database if not exists db%d replica 1 duration 100" %couti) tdSql.execute("use db%d" %couti) tdSql.execute( '''create table stb1 diff --git a/tests/system-test/6-cluster/5dnode3mnodeRestartDnodeInsertData.py b/tests/system-test/6-cluster/5dnode3mnodeRestartDnodeInsertData.py index 16916034725c..1d2644c65f62 100644 --- a/tests/system-test/6-cluster/5dnode3mnodeRestartDnodeInsertData.py +++ b/tests/system-test/6-cluster/5dnode3mnodeRestartDnodeInsertData.py @@ -73,8 +73,8 @@ def insertData(self,countstart,countstop): for couti in range(countstart,countstop): tdLog.debug("drop database if exists db%d" %couti) tdSql.execute("drop database if exists db%d" %couti) - print("create database if not exists db%d replica 1 duration 300" %couti) - tdSql.execute("create database if not exists db%d replica 1 duration 300" %couti) + print("create database if not exists db%d replica 1 duration 100" %couti) + tdSql.execute("create database if not exists db%d replica 1 duration 100" %couti) tdSql.execute("use db%d" %couti) tdSql.execute( '''create table stb1 diff --git a/tests/system-test/6-cluster/5dnode3mnodeRoll.py b/tests/system-test/6-cluster/5dnode3mnodeRoll.py index 11a153c48f36..4816f976c6ec 100644 --- a/tests/system-test/6-cluster/5dnode3mnodeRoll.py +++ b/tests/system-test/6-cluster/5dnode3mnodeRoll.py @@ -37,7 +37,7 @@ def init(self, conn, logSql, replicaVar=1): tdSql.init(conn.cursor()) self.host = socket.gethostname() self.replicaVar = int(replicaVar) - self.deletedDataSql= '''drop database if exists deldata;create database deldata duration 300;use deldata; + self.deletedDataSql= '''drop database if exists deldata;create database deldata duration 100;use deldata; create table deldata.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); create table deldata.ct1 using deldata.stb1 tags ( 1 ); insert into deldata.ct1 values ( now()-0s, 0, 0, 0, 0, 0.0, 0.0, 0, 'binary0', 'nchar0', now()+0a ) ( now()-10s, 1, 11111, 111, 11, 1.11, 11.11, 1, 'binary1', 'nchar1', now()+1a ) ( now()-20s, 2, 22222, 222, 22, 2.22, 22.22, 0, 'binary2', 'nchar2', now()+2a ) ( now()-30s, 3, 33333, 333, 33, 3.33, 33.33, 1, 'binary3', 'nchar3', now()+3a ); @@ -140,8 +140,8 @@ def insertData(self,countstart,countstop): for couti in range(countstart,countstop): tdLog.debug("drop database if exists db%d" %couti) tdSql.execute("drop database if exists db%d" %couti) - print("create database if not exists db%d replica 1 duration 300" %couti) - tdSql.execute("create database if not exists db%d replica 1 duration 300" %couti) + print("create database if not exists db%d replica 1 duration 100" %couti) + tdSql.execute("create database if not exists db%d replica 1 duration 100" %couti) tdSql.execute("use db%d" %couti) tdSql.execute( '''create table stb1 diff --git a/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateDb.py b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateDb.py index fb62110b14cb..e89285c3274c 100644 --- a/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateDb.py +++ b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateDb.py @@ -71,8 +71,8 @@ def insertData(self,countstart,countstop): for couti in range(countstart,countstop): tdLog.debug("drop database if exists db%d" %couti) tdSql.execute("drop database if exists db%d" %couti) - print("create database if not exists db%d replica 1 duration 300" %couti) - tdSql.execute("create database if not exists db%d replica 1 duration 300" %couti) + print("create database if not exists db%d replica 1 duration 100" %couti) + tdSql.execute("create database if not exists db%d replica 1 duration 100" %couti) tdSql.execute("use db%d" %couti) tdSql.execute( '''create table stb1 diff --git a/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopDnodeInsertData.py b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopDnodeInsertData.py index 7eaf756737e3..77892a170017 100644 --- a/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopDnodeInsertData.py +++ b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopDnodeInsertData.py @@ -72,8 +72,8 @@ def insertData(self,countstart,countstop): for couti in range(countstart,countstop): tdLog.debug("drop database if exists db%d" %couti) tdSql.execute("drop database if exists db%d" %couti) - print("create database if not exists db%d replica 1 duration 300" %couti) - tdSql.execute("create database if not exists db%d replica 1 duration 300" %couti) + print("create database if not exists db%d replica 1 duration 100" %couti) + tdSql.execute("create database if not exists db%d replica 1 duration 100" %couti) tdSql.execute("use db%d" %couti) tdSql.execute( '''create table stb1 diff --git a/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopDnodeRCreateDb.py b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopDnodeRCreateDb.py index 27b15d4c990e..c7af2d162f3d 100644 --- a/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopDnodeRCreateDb.py +++ b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopDnodeRCreateDb.py @@ -71,8 +71,8 @@ def insertData(self,countstart,countstop): for couti in range(countstart,countstop): tdLog.debug("drop database if exists db%d" %couti) tdSql.execute("drop database if exists db%d" %couti) - print("create database if not exists db%d replica 1 duration 300" %couti) - tdSql.execute("create database if not exists db%d replica 1 duration 300" %couti) + print("create database if not exists db%d replica 1 duration 100" %couti) + tdSql.execute("create database if not exists db%d replica 1 duration 100" %couti) tdSql.execute("use db%d" %couti) tdSql.execute( '''create table stb1 diff --git a/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateStb.py b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateStb.py index 9395dd2a2b74..3e20721838eb 100644 --- a/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateStb.py +++ b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateStb.py @@ -71,8 +71,8 @@ def insertData(self,countstart,countstop): for couti in range(countstart,countstop): tdLog.debug("drop database if exists db%d" %couti) tdSql.execute("drop database if exists db%d" %couti) - print("create database if not exists db%d replica 1 duration 300" %couti) - tdSql.execute("create database if not exists db%d replica 1 duration 300" %couti) + print("create database if not exists db%d replica 1 duration 100" %couti) + tdSql.execute("create database if not exists db%d replica 1 duration 100" %couti) tdSql.execute("use db%d" %couti) tdSql.execute( '''create table stb1 diff --git a/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateStb.py b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateStb.py index 2fb196635fb9..adc8e8a3136a 100644 --- a/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateStb.py +++ b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateStb.py @@ -71,8 +71,8 @@ def insertData(self,countstart,countstop): for couti in range(countstart,countstop): tdLog.debug("drop database if exists db%d" %couti) tdSql.execute("drop database if exists db%d" %couti) - print("create database if not exists db%d replica 1 duration 300" %couti) - tdSql.execute("create database if not exists db%d replica 1 duration 300" %couti) + print("create database if not exists db%d replica 1 duration 100" %couti) + tdSql.execute("create database if not exists db%d replica 1 duration 100" %couti) tdSql.execute("use db%d" %couti) tdSql.execute( '''create table stb1 diff --git a/tests/system-test/6-cluster/5dnode3mnodeSepVnodeStopDnodeCreateUser.py b/tests/system-test/6-cluster/5dnode3mnodeSepVnodeStopDnodeCreateUser.py index bcc7edf5cbbc..04526971d7e1 100644 --- a/tests/system-test/6-cluster/5dnode3mnodeSepVnodeStopDnodeCreateUser.py +++ b/tests/system-test/6-cluster/5dnode3mnodeSepVnodeStopDnodeCreateUser.py @@ -73,8 +73,8 @@ def insertData(self,countstart,countstop): for couti in range(countstart,countstop): tdLog.debug("drop database if exists db%d" %couti) tdSql.execute("drop database if exists db%d" %couti) - print("create database if not exists db%d replica 1 duration 300" %couti) - tdSql.execute("create database if not exists db%d replica 1 duration 300" %couti) + print("create database if not exists db%d replica 1 duration 100" %couti) + tdSql.execute("create database if not exists db%d replica 1 duration 100" %couti) tdSql.execute("use db%d" %couti) tdSql.execute( '''create table stb1 diff --git a/tests/system-test/6-cluster/5dnode3mnodeStopInsert.py b/tests/system-test/6-cluster/5dnode3mnodeStopInsert.py index 9d2430506fd5..374381dc18a0 100644 --- a/tests/system-test/6-cluster/5dnode3mnodeStopInsert.py +++ b/tests/system-test/6-cluster/5dnode3mnodeStopInsert.py @@ -77,8 +77,8 @@ def insert_data(self,countstart,countstop): for couti in range(countstart,countstop): tdLog.debug("drop database if exists db%d" %couti) tdSql.execute("drop database if exists db%d" %couti) - tdLog.debug("create database if not exists db%d replica 1 duration 300" %couti) - tdSql.execute("create database if not exists db%d replica 1 duration 300" %couti) + tdLog.debug("create database if not exists db%d replica 1 duration 100" %couti) + tdSql.execute("create database if not exists db%d replica 1 duration 100" %couti) tdSql.execute("use db%d" %couti) tdSql.execute( '''create table stb1 diff --git a/tests/system-test/6-cluster/manually-test/6dnode3mnodeInsertDataRebootAlterRep1-3.py b/tests/system-test/6-cluster/manually-test/6dnode3mnodeInsertDataRebootAlterRep1-3.py index 0d3b920bb484..c583149ce6a5 100644 --- a/tests/system-test/6-cluster/manually-test/6dnode3mnodeInsertDataRebootAlterRep1-3.py +++ b/tests/system-test/6-cluster/manually-test/6dnode3mnodeInsertDataRebootAlterRep1-3.py @@ -70,8 +70,8 @@ def insertData(self,countstart,countstop): for couti in range(countstart,countstop): tdLog.debug("drop database if exists db%d" %couti) tdSql.execute("drop database if exists db%d" %couti) - print("create database if not exists db%d replica 1 duration 300" %couti) - tdSql.execute("create database if not exists db%d replica 1 duration 300" %couti) + print("create database if not exists db%d replica 1 duration 100" %couti) + tdSql.execute("create database if not exists db%d replica 1 duration 100" %couti) tdSql.execute("use db%d" %couti) tdSql.execute( '''create table stb1 diff --git a/tests/system-test/6-cluster/manually-test/6dnode3mnodeInsertDatarRebootAlterRep1-3.py b/tests/system-test/6-cluster/manually-test/6dnode3mnodeInsertDatarRebootAlterRep1-3.py index 0d3b920bb484..c583149ce6a5 100644 --- a/tests/system-test/6-cluster/manually-test/6dnode3mnodeInsertDatarRebootAlterRep1-3.py +++ b/tests/system-test/6-cluster/manually-test/6dnode3mnodeInsertDatarRebootAlterRep1-3.py @@ -70,8 +70,8 @@ def insertData(self,countstart,countstop): for couti in range(countstart,countstop): tdLog.debug("drop database if exists db%d" %couti) tdSql.execute("drop database if exists db%d" %couti) - print("create database if not exists db%d replica 1 duration 300" %couti) - tdSql.execute("create database if not exists db%d replica 1 duration 300" %couti) + print("create database if not exists db%d replica 1 duration 100" %couti) + tdSql.execute("create database if not exists db%d replica 1 duration 100" %couti) tdSql.execute("use db%d" %couti) tdSql.execute( '''create table stb1 diff --git a/tests/system-test/6-cluster/manually-test/6dnode3mnodeInsertLessDataAlterRep3to1to3.py b/tests/system-test/6-cluster/manually-test/6dnode3mnodeInsertLessDataAlterRep3to1to3.py index 9ab47764c8fd..c817756edc44 100644 --- a/tests/system-test/6-cluster/manually-test/6dnode3mnodeInsertLessDataAlterRep3to1to3.py +++ b/tests/system-test/6-cluster/manually-test/6dnode3mnodeInsertLessDataAlterRep3to1to3.py @@ -70,8 +70,8 @@ def insertData(self,countstart,countstop): for couti in range(countstart,countstop): tdLog.debug("drop database if exists db%d" %couti) tdSql.execute("drop database if exists db%d" %couti) - print("create database if not exists db%d replica 1 duration 300" %couti) - tdSql.execute("create database if not exists db%d replica 1 duration 300" %couti) + print("create database if not exists db%d replica 1 duration 100" %couti) + tdSql.execute("create database if not exists db%d replica 1 duration 100" %couti) tdSql.execute("use db%d" %couti) tdSql.execute( '''create table stb1 diff --git a/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_createDb_replica1.py b/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_createDb_replica1.py index 52d675208bab..fb00fc08460d 100644 --- a/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_createDb_replica1.py +++ b/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_createDb_replica1.py @@ -83,7 +83,7 @@ def check_setup_cluster_status(self): def create_db_check_vgroups(self): tdSql.execute("drop database if exists test") - tdSql.execute("create database if not exists test replica 1 duration 300") + tdSql.execute("create database if not exists test replica 1 duration 100") tdSql.execute("use test") tdSql.execute( '''create table stb1 diff --git a/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica1_insertdatas.py b/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica1_insertdatas.py index 9cc97543add8..51923f56a93b 100644 --- a/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica1_insertdatas.py +++ b/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica1_insertdatas.py @@ -88,7 +88,7 @@ def check_setup_cluster_status(self): def create_db_check_vgroups(self): tdSql.execute("drop database if exists test") - tdSql.execute("create database if not exists test replica 1 duration 300") + tdSql.execute("create database if not exists test replica 1 duration 100") tdSql.execute("use test") tdSql.execute( '''create table stb1 diff --git a/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica1_insertdatas_querys.py b/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica1_insertdatas_querys.py index 4ea00ff2e282..6567b1024cd9 100644 --- a/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica1_insertdatas_querys.py +++ b/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica1_insertdatas_querys.py @@ -89,7 +89,7 @@ def check_setup_cluster_status(self): def create_db_check_vgroups(self): tdSql.execute("drop database if exists test") - tdSql.execute("create database if not exists test replica 1 duration 300") + tdSql.execute("create database if not exists test replica 1 duration 100") tdSql.execute("use test") tdSql.execute( '''create table stb1 diff --git a/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas.py b/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas.py index 51da6fc72396..db45582c3b6d 100644 --- a/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas.py +++ b/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas.py @@ -88,7 +88,7 @@ def check_setup_cluster_status(self): def create_db_check_vgroups(self): tdSql.execute("drop database if exists test") - tdSql.execute("create database if not exists test replica 1 duration 300") + tdSql.execute("create database if not exists test replica 1 duration 100") tdSql.execute("use test") tdSql.execute( '''create table stb1 diff --git a/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_querys.py b/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_querys.py index a111e0bab5c6..64809a269b11 100644 --- a/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_querys.py +++ b/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_querys.py @@ -89,7 +89,7 @@ def check_setup_cluster_status(self): def create_db_check_vgroups(self): tdSql.execute("drop database if exists test") - tdSql.execute("create database if not exists test replica 1 duration 300") + tdSql.execute("create database if not exists test replica 1 duration 100") tdSql.execute("use test") tdSql.execute( '''create table stb1 diff --git a/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_querys_loop_restart_all_vnode.py b/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_querys_loop_restart_all_vnode.py index 66eca7143da7..3d061d4f639a 100644 --- a/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_querys_loop_restart_all_vnode.py +++ b/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_querys_loop_restart_all_vnode.py @@ -91,7 +91,7 @@ def check_setup_cluster_status(self): def create_db_check_vgroups(self): tdSql.execute("drop database if exists test") - tdSql.execute("create database if not exists test replica 1 duration 300") + tdSql.execute("create database if not exists test replica 1 duration 100") tdSql.execute("use test") tdSql.execute( '''create table stb1 diff --git a/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_querys_loop_restart_follower.py b/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_querys_loop_restart_follower.py index db9139dca2d3..b573d8eafa53 100644 --- a/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_querys_loop_restart_follower.py +++ b/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_querys_loop_restart_follower.py @@ -91,7 +91,7 @@ def check_setup_cluster_status(self): def create_db_check_vgroups(self): tdSql.execute("drop database if exists test") - tdSql.execute("create database if not exists test replica 1 duration 300") + tdSql.execute("create database if not exists test replica 1 duration 100") time.sleep(3) tdSql.execute("use test") tdSql.execute( diff --git a/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_querys_loop_restart_leader.py b/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_querys_loop_restart_leader.py index 4fc4507c3fc6..049464b53937 100644 --- a/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_querys_loop_restart_leader.py +++ b/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_querys_loop_restart_leader.py @@ -91,7 +91,7 @@ def check_setup_cluster_status(self): def create_db_check_vgroups(self): tdSql.execute("drop database if exists test") - tdSql.execute("create database if not exists test replica 1 duration 300") + tdSql.execute("create database if not exists test replica 1 duration 100") tdSql.execute("use test") time.sleep(3) tdSql.execute( diff --git a/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_stop_follower_sync.py b/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_stop_follower_sync.py index eb77c6d0032e..b5db868e6870 100644 --- a/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_stop_follower_sync.py +++ b/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_stop_follower_sync.py @@ -97,7 +97,7 @@ def check_setup_cluster_status(self): def create_db_check_vgroups(self): tdSql.execute("drop database if exists test") - tdSql.execute("create database if not exists test replica 1 duration 300") + tdSql.execute("create database if not exists test replica 1 duration 100") tdSql.execute("use test") tdSql.execute( '''create table stb1 diff --git a/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_stop_follower_unsync.py b/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_stop_follower_unsync.py index 9079bedb7cb9..31b8fd23261c 100644 --- a/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_stop_follower_unsync.py +++ b/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_stop_follower_unsync.py @@ -97,7 +97,7 @@ def check_setup_cluster_status(self): def create_db_check_vgroups(self): tdSql.execute("drop database if exists test") - tdSql.execute("create database if not exists test replica 1 duration 300") + tdSql.execute("create database if not exists test replica 1 duration 100") tdSql.execute("use test") tdSql.execute( '''create table stb1 diff --git a/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_stop_follower_unsync_force_stop.py b/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_stop_follower_unsync_force_stop.py index 35cbceb2689c..d7a161263e32 100644 --- a/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_stop_follower_unsync_force_stop.py +++ b/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_stop_follower_unsync_force_stop.py @@ -97,7 +97,7 @@ def check_setup_cluster_status(self): def create_db_check_vgroups(self): tdSql.execute("drop database if exists test") - tdSql.execute("create database if not exists test replica 1 duration 300") + tdSql.execute("create database if not exists test replica 1 duration 100") tdSql.execute("use test") tdSql.execute( '''create table stb1 diff --git a/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_stop_leader_forece_stop.py b/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_stop_leader_forece_stop.py index bf2ebadd06b9..82c9dbf86c5c 100644 --- a/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_stop_leader_forece_stop.py +++ b/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_stop_leader_forece_stop.py @@ -180,7 +180,7 @@ def check_setup_cluster_status(self): def create_db_check_vgroups(self): tdSql.execute("drop database if exists test") - tdSql.execute("create database if not exists test replica 1 duration 300") + tdSql.execute("create database if not exists test replica 1 duration 100") tdSql.execute("use test") tdSql.execute( '''create table stb1 diff --git a/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_mnode3_insertdatas_querys.py b/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_mnode3_insertdatas_querys.py index 25aba29235b2..7f8c75fa0366 100644 --- a/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_mnode3_insertdatas_querys.py +++ b/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_mnode3_insertdatas_querys.py @@ -89,7 +89,7 @@ def check_setup_cluster_status(self): def create_db_check_vgroups(self): tdSql.execute("drop database if exists test") - tdSql.execute("create database if not exists test replica 1 duration 300") + tdSql.execute("create database if not exists test replica 1 duration 100") tdSql.execute("use test") tdSql.execute( '''create table stb1 diff --git a/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_vgroups.py b/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_vgroups.py index 45ceb73059dd..4f3b2e2defde 100644 --- a/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_vgroups.py +++ b/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_vgroups.py @@ -88,7 +88,7 @@ def check_setup_cluster_status(self): def create_db_check_vgroups(self): tdSql.execute("drop database if exists test") - tdSql.execute("create database if not exists test replica 1 duration 300") + tdSql.execute("create database if not exists test replica 1 duration 100") tdSql.execute("use test") tdSql.execute( '''create table stb1 diff --git a/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_vgroups_stopOne.py b/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_vgroups_stopOne.py index 3f72f33951bd..e136517a4ffe 100644 --- a/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_vgroups_stopOne.py +++ b/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_vgroups_stopOne.py @@ -91,7 +91,7 @@ def check_setup_cluster_status(self): def create_db_check_vgroups(self): tdSql.execute("drop database if exists test") - tdSql.execute("create database if not exists test replica 1 duration 300") + tdSql.execute("create database if not exists test replica 1 duration 100") tdSql.execute("use test") tdSql.execute( '''create table stb1 From cd33915492c20c8349a0391c335d1acb7ba0c0f7 Mon Sep 17 00:00:00 2001 From: wangjiaming0909 <604227650@qq.com> Date: Thu, 24 Oct 2024 10:08:44 +0800 Subject: [PATCH 220/695] fix tsma test case --- tests/system-test/2-query/tsma.py | 23 +++++++++++++++++++---- tests/system-test/test.py | 4 +++- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/tests/system-test/2-query/tsma.py b/tests/system-test/2-query/tsma.py index 1e115cff79fc..acde26d5cab8 100644 --- a/tests/system-test/2-query/tsma.py +++ b/tests/system-test/2-query/tsma.py @@ -693,7 +693,7 @@ def init_data(self, db: str = 'test', ctb_num: int = 10, rows_per_ctb: int = 100 "======== prepare test env include database, stable, ctables, and insert data: ") paraDict = {'dbName': db, 'dropFlag': 1, - 'vgroups': 2, + 'vgroups': 4, 'stbName': 'meters', 'colPrefix': 'c', 'tagPrefix': 't', @@ -1273,6 +1273,21 @@ def wait_query(self, sql: str, expected_row_num: int, timeout_in_seconds: float, else: tdLog.debug(f'wait query succeed: {sql} to return {expected_row_num}, got: {tdSql.getRows()}') + def wait_query_err(self, sql: str, timeout_in_seconds: float, err): + timeout = timeout_in_seconds + while timeout > 0: + try: + tdSql.query(sql, queryTimes=1) + time.sleep(1) + timeout = timeout - 1 + except: + tdSql.error(sql, err); + break + if timeout <= 0: + tdLog.exit(f'failed to wait query: {sql} to return error timeout: {timeout_in_seconds}s') + else: + tdLog.debug(f'wait query error succeed: {sql}') + def test_drop_tsma(self): function_name = sys._getframe().f_code.co_name tdLog.debug(f'-----{function_name}------') @@ -1339,14 +1354,14 @@ def test_tb_ddl_with_created_tsma(self): tdSql.execute('alter table test.t0 ttl 2', queryTimes=1) tdSql.execute('flush database test') res_tb = TSMAQCBuilder().md5('1.test.tsma1_t0') - self.wait_query(f'select * from information_schema.ins_tables where table_name = "{res_tb}"', 0, wait_query_seconds) + self.wait_query_err(f'desc `{res_tb}`', wait_query_seconds, -2147473917) # test drop multi tables tdSql.execute('drop table test.t3, test.t4') res_tb = TSMAQCBuilder().md5('1.test.tsma1_t3') - self.wait_query(f'select * from information_schema.ins_tables where table_name = "{res_tb}"', 0, wait_query_seconds) + self.wait_query_err(f'desc `{res_tb}`', wait_query_seconds, -2147473917) res_tb = TSMAQCBuilder().md5('1.test.tsma1_t4') - self.wait_query(f'select * from information_schema.ins_tables where table_name = "{res_tb}"', 0, wait_query_seconds) + self.wait_query_err(f'desc `{res_tb}`', wait_query_seconds, -2147473917) # test drop stream tdSql.error('drop stream tsma1', -2147471088) ## TSMA must be dropped first diff --git a/tests/system-test/test.py b/tests/system-test/test.py index 9defcd083aa1..57a4789f2e37 100644 --- a/tests/system-test/test.py +++ b/tests/system-test/test.py @@ -24,6 +24,8 @@ import socket import threading import importlib +print(f"Python version: {sys.version}") +print(f"Version info: {sys.version_info}") import toml sys.path.append("../pytest") @@ -687,6 +689,6 @@ def runOnPreviousCluster(host, config, fileName): if conn is not None: conn.close() if asan: - # tdDnodes.StopAllSigint() + tdDnodes.StopAllSigint() tdLog.info("Address sanitizer mode finished") sys.exit(0) From 3a505157f372fad76b57716a27d0f7562281f14e Mon Sep 17 00:00:00 2001 From: xsren <285808407@qq.com> Date: Thu, 24 Oct 2024 10:33:18 +0800 Subject: [PATCH 221/695] fix: type overflow --- source/common/src/tdatablock.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c index b47abeeb65c7..b8e9579c6bbf 100644 --- a/source/common/src/tdatablock.c +++ b/source/common/src/tdatablock.c @@ -3582,7 +3582,15 @@ int32_t blockDataCheck(const SSDataBlock* pDataBlock) { typeValue = *(char*)(pCol->pData + pCol->varmeta.offset[r] + colLen - 1); } else { - GET_TYPED_DATA(typeValue, int64_t, pCol->info.type, colDataGetNumData(pCol, r)); + if (TSDB_DATA_TYPE_FLOAT == pCol->info.type) { + float v = 0; + GET_TYPED_DATA(v, float, pCol->info.type, colDataGetNumData(pCol, r)); + } else if (TSDB_DATA_TYPE_DOUBLE == pCol->info.type) { + double v = 0; + GET_TYPED_DATA(v, double, pCol->info.type, colDataGetNumData(pCol, r)); + } else { + GET_TYPED_DATA(typeValue, int64_t, pCol->info.type, colDataGetNumData(pCol, r)); + } } } } From afb71f1536d0388efb70df38417067f5f91051be Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Thu, 24 Oct 2024 10:42:39 +0800 Subject: [PATCH 222/695] test/duration: fix duration values --- tests/develop-test/2-query/show_create_db.py | 12 ++++++------ tests/script/tsim/insert/commit-merge0.sim | 2 +- tests/script/tsim/query/interval-offset.sim | 2 +- tests/script/tsim/sma/drop_sma.sim | 8 ++++---- tests/script/tsim/sma/sma_leak.sim | 8 ++++---- tests/system-test/2-query/distribute_agg_count.py | 2 +- tests/system-test/2-query/join.py | 2 +- tests/system-test/2-query/max.py | 2 +- 8 files changed, 19 insertions(+), 19 deletions(-) diff --git a/tests/develop-test/2-query/show_create_db.py b/tests/develop-test/2-query/show_create_db.py index d7d093aa7824..d6dcffcbb460 100644 --- a/tests/develop-test/2-query/show_create_db.py +++ b/tests/develop-test/2-query/show_create_db.py @@ -42,17 +42,17 @@ def run(self): tdSql.query('show create database scd;') tdSql.checkRows(1) tdSql.checkData(0, 0, 'scd') - tdSql.checkData(0, 1, "CREATE DATABASE `scd` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 10d WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 2 KEEP 3650d,3650d,3650d PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 ENCRYPT_ALGORITHM 'none' S3_CHUNKSIZE 262144 S3_KEEPLOCAL 5256000m S3_COMPACT 0") + tdSql.checkData(0, 1, "CREATE DATABASE `scd` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 10d WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 2 KEEP 3650d,3650d,3650d PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 ENCRYPT_ALGORITHM 'none' S3_CHUNKSIZE 262144 S3_KEEPLOCAL 5256000m S3_COMPACT 1") tdSql.query('show create database scd2;') tdSql.checkRows(1) tdSql.checkData(0, 0, 'scd2') - tdSql.checkData(0, 1, "CREATE DATABASE `scd2` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 10d WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 3 KEEP 3650d,3650d,3650d PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 ENCRYPT_ALGORITHM 'none' S3_CHUNKSIZE 262144 S3_KEEPLOCAL 5256000m S3_COMPACT 0") + tdSql.checkData(0, 1, "CREATE DATABASE `scd2` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 10d WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 3 KEEP 3650d,3650d,3650d PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 ENCRYPT_ALGORITHM 'none' S3_CHUNKSIZE 262144 S3_KEEPLOCAL 5256000m S3_COMPACT 1") tdSql.query('show create database scd4') tdSql.checkRows(1) tdSql.checkData(0, 0, 'scd4') - tdSql.checkData(0, 1, "CREATE DATABASE `scd4` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 10d WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 13 KEEP 3650d,3650d,3650d PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 ENCRYPT_ALGORITHM 'none' S3_CHUNKSIZE 262144 S3_KEEPLOCAL 5256000m S3_COMPACT 0") + tdSql.checkData(0, 1, "CREATE DATABASE `scd4` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 10d WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 13 KEEP 3650d,3650d,3650d PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 ENCRYPT_ALGORITHM 'none' S3_CHUNKSIZE 262144 S3_KEEPLOCAL 5256000m S3_COMPACT 1") self.restartTaosd(1, dbname='scd') @@ -60,16 +60,16 @@ def run(self): tdSql.query('show create database scd;') tdSql.checkRows(1) tdSql.checkData(0, 0, 'scd') - tdSql.checkData(0, 1, "CREATE DATABASE `scd` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 10d WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 2 KEEP 3650d,3650d,3650d PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 ENCRYPT_ALGORITHM 'none' S3_CHUNKSIZE 262144 S3_KEEPLOCAL 5256000m S3_COMPACT 0") + tdSql.checkData(0, 1, "CREATE DATABASE `scd` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 10d WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 2 KEEP 3650d,3650d,3650d PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 ENCRYPT_ALGORITHM 'none' S3_CHUNKSIZE 262144 S3_KEEPLOCAL 5256000m S3_COMPACT 1") tdSql.query('show create database scd2;') tdSql.checkRows(1) tdSql.checkData(0, 0, 'scd2') - tdSql.checkData(0, 1, "CREATE DATABASE `scd2` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 10d WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 3 KEEP 3650d,3650d,3650d PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 ENCRYPT_ALGORITHM 'none' S3_CHUNKSIZE 262144 S3_KEEPLOCAL 5256000m S3_COMPACT 0") + tdSql.checkData(0, 1, "CREATE DATABASE `scd2` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 10d WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 3 KEEP 3650d,3650d,3650d PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 ENCRYPT_ALGORITHM 'none' S3_CHUNKSIZE 262144 S3_KEEPLOCAL 5256000m S3_COMPACT 1") tdSql.query('show create database scd4') tdSql.checkRows(1) tdSql.checkData(0, 0, 'scd4') - tdSql.checkData(0, 1, "CREATE DATABASE `scd4` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 10d WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 13 KEEP 3650d,3650d,3650d PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 ENCRYPT_ALGORITHM 'none' S3_CHUNKSIZE 262144 S3_KEEPLOCAL 5256000m S3_COMPACT 0") + tdSql.checkData(0, 1, "CREATE DATABASE `scd4` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 10d WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 13 KEEP 3650d,3650d,3650d PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 ENCRYPT_ALGORITHM 'none' S3_CHUNKSIZE 262144 S3_KEEPLOCAL 5256000m S3_COMPACT 1") tdSql.execute('drop database scd') diff --git a/tests/script/tsim/insert/commit-merge0.sim b/tests/script/tsim/insert/commit-merge0.sim index da66560cbd90..78dbb44d61ef 100644 --- a/tests/script/tsim/insert/commit-merge0.sim +++ b/tests/script/tsim/insert/commit-merge0.sim @@ -4,7 +4,7 @@ system sh/exec.sh -n dnode1 -s start sql connect print =============== create database -sql create database db duration 300 keep 365000d,365000d,365000d +sql create database db duration 120 keep 365000d,365000d,365000d sql select * from information_schema.ins_databases if $rows != 3 then return -1 diff --git a/tests/script/tsim/query/interval-offset.sim b/tests/script/tsim/query/interval-offset.sim index fe3e4c9844b1..50b3efdc39ed 100644 --- a/tests/script/tsim/query/interval-offset.sim +++ b/tests/script/tsim/query/interval-offset.sim @@ -4,7 +4,7 @@ system sh/exec.sh -n dnode1 -s start sql connect print =============== create database -sql create database d0 duration 300 +sql create database d0 duration 120 sql use d0 print =============== create super table and child table diff --git a/tests/script/tsim/sma/drop_sma.sim b/tests/script/tsim/sma/drop_sma.sim index 7121f402fa11..b88fdc8955fb 100644 --- a/tests/script/tsim/sma/drop_sma.sim +++ b/tests/script/tsim/sma/drop_sma.sim @@ -126,21 +126,21 @@ sql drop table stb; print ========== step5 sql drop database if exists db; -sql create database db duration 300; +sql create database db duration 120; sql use db; sql create table stb1(ts timestamp, c_int int, c_bint bigint, c_sint smallint, c_tint tinyint, c_float float, c_double double, c_bool bool, c_binary binary(16), c_nchar nchar(32), c_ts timestamp, c_tint_un tinyint unsigned, c_sint_un smallint unsigned, c_int_un int unsigned, c_bint_un bigint unsigned) tags (t_int int); sql CREATE SMA INDEX sma_index_1 ON stb1 function(min(c_int), max(c_int)) interval(6m, 10s) sliding(6m) watermark 5s; print ========== step6 repeat sql drop database if exists db; -sql create database db duration 300; +sql create database db duration 120; sql use db; sql create table stb1(ts timestamp, c_int int, c_bint bigint ) tags (t_int int); sql CREATE SMA INDEX sma_index_1 ON stb1 function(min(c_int), max(c_int)) interval(6m, 10s) sliding(6m) watermark 5s; print ========== step7 sql drop database if exists db; -sql create database db duration 300; +sql create database db duration 120; sql use db; sql create table stb1(ts timestamp, c_int int, c_bint bigint, c_sint smallint, c_tint tinyint,c_float float, c_double double, c_bool bool,c_binary binary(16), c_nchar nchar(32), c_ts timestamp,c_tint_un tinyint unsigned, c_sint_un smallint unsigned,c_int_un int unsigned, c_bint_un bigint unsigned) tags (t_int int); @@ -160,7 +160,7 @@ sql DROP INDEX sma_index_3 ; print ========== step8 sql drop database if exists db; sleep 2000 -sql create database db duration 300; +sql create database db duration 120; sql use db; sql create table stb1(ts timestamp, c_int int, c_bint bigint, c_sint smallint, c_tint tinyint,c_float float, c_double double, c_bool bool,c_binary binary(16), c_nchar nchar(32), c_ts timestamp,c_tint_un tinyint unsigned, c_sint_un smallint unsigned,c_int_un int unsigned, c_bint_un bigint unsigned) tags (t_int int); diff --git a/tests/script/tsim/sma/sma_leak.sim b/tests/script/tsim/sma/sma_leak.sim index 4f2d1ebeb0ed..14f03541b529 100644 --- a/tests/script/tsim/sma/sma_leak.sim +++ b/tests/script/tsim/sma/sma_leak.sim @@ -98,21 +98,21 @@ sql drop table stb; print ========== step5 sql drop database if exists db; -sql create database db duration 300; +sql create database db duration 120; sql use db; sql create table stb1(ts timestamp, c_int int, c_bint bigint, c_sint smallint, c_tint tinyint, c_float float, c_double double, c_bool bool, c_binary binary(16), c_nchar nchar(32), c_ts timestamp, c_tint_un tinyint unsigned, c_sint_un smallint unsigned, c_int_un int unsigned, c_bint_un bigint unsigned) tags (t_int int); sql CREATE SMA INDEX sma_index_1 ON stb1 function(min(c_int), max(c_int)) interval(6m, 10s) sliding(6m) watermark 5s; print ========== step6 repeat sql drop database if exists db; -sql create database db duration 300; +sql create database db duration 120; sql use db; sql create table stb1(ts timestamp, c_int int, c_bint bigint ) tags (t_int int); sql CREATE SMA INDEX sma_index_1 ON stb1 function(min(c_int), max(c_int)) interval(6m, 10s) sliding(6m) watermark 5s; print ========== step7 sql drop database if exists db; -sql create database db duration 300; +sql create database db duration 120; sql use db; sql create table stb1(ts timestamp, c_int int, c_bint bigint, c_sint smallint, c_tint tinyint,c_float float, c_double double, c_bool bool,c_binary binary(16), c_nchar nchar(32), c_ts timestamp,c_tint_un tinyint unsigned, c_sint_un smallint unsigned,c_int_un int unsigned, c_bint_un bigint unsigned) tags (t_int int); @@ -131,7 +131,7 @@ sql DROP INDEX sma_index_3 ; print ========== step8 sql drop database if exists db; -sql create database db duration 300; +sql create database db duration 120; sql use db; sql create table stb1(ts timestamp, c_int int, c_bint bigint, c_sint smallint, c_tint tinyint,c_float float, c_double double, c_bool bool,c_binary binary(16), c_nchar nchar(32), c_ts timestamp,c_tint_un tinyint unsigned, c_sint_un smallint unsigned,c_int_un int unsigned, c_bint_un bigint unsigned) tags (t_int int); diff --git a/tests/system-test/2-query/distribute_agg_count.py b/tests/system-test/2-query/distribute_agg_count.py index 7d131cd77d7f..fdcf27040228 100644 --- a/tests/system-test/2-query/distribute_agg_count.py +++ b/tests/system-test/2-query/distribute_agg_count.py @@ -36,7 +36,7 @@ def check_count_functions(self, tbname , col_name): def prepare_datas_of_distribute(self, dbname="testdb"): # prepate datas for 20 tables distributed at different vgroups - tdSql.execute(f"create database if not exists {dbname} keep 3650 duration 1000 vgroups 5") + tdSql.execute(f"create database if not exists {dbname} keep 3650 duration 100 vgroups 5") tdSql.execute(f" use {dbname} ") tdSql.execute( f'''create table {dbname}.stb1 diff --git a/tests/system-test/2-query/join.py b/tests/system-test/2-query/join.py index c5c8f6c73089..1c303b6d9615 100644 --- a/tests/system-test/2-query/join.py +++ b/tests/system-test/2-query/join.py @@ -370,7 +370,7 @@ def run(self): tdLog.printNoPrefix("==========step4:cross db check") dbname1 = "db1" - tdSql.execute(f"create database {dbname1} duration 432000m") + tdSql.execute(f"create database {dbname1} duration 172800m") tdSql.execute(f"use {dbname1}") self.__create_tb(dbname=dbname1) self.__insert_data(dbname=dbname1) diff --git a/tests/system-test/2-query/max.py b/tests/system-test/2-query/max.py index ba6ab53fc7c2..564905583848 100644 --- a/tests/system-test/2-query/max.py +++ b/tests/system-test/2-query/max.py @@ -117,7 +117,7 @@ def check_max_functions(self, tbname , col_name): def support_distributed_aggregate(self, dbname="testdb"): # prepate datas for 20 tables distributed at different vgroups - tdSql.execute(f"create database if not exists {dbname} keep 3650 duration 1000 vgroups 5") + tdSql.execute(f"create database if not exists {dbname} keep 3650 duration 100 vgroups 5") tdSql.execute(f"use {dbname} ") tdSql.execute( f'''create table {dbname}.stb1 From a4eda032052a9a1dc4f7e291c91e30588a1ff5b5 Mon Sep 17 00:00:00 2001 From: chenhaoran Date: Thu, 24 Oct 2024 10:56:22 +0800 Subject: [PATCH 223/695] test:add testcase for interp in stream --- tests/pytest/util/common.py | 11 +- .../8-stream/force_window_close_interval.py | 253 ++++++++++++++++++ 2 files changed, 260 insertions(+), 4 deletions(-) create mode 100644 tests/system-test/8-stream/force_window_close_interval.py diff --git a/tests/pytest/util/common.py b/tests/pytest/util/common.py index 1dfcf8b5ddca..2542eca69c4a 100644 --- a/tests/pytest/util/common.py +++ b/tests/pytest/util/common.py @@ -838,7 +838,7 @@ def killProcessor(self, processorName): if (platform.system().lower() == 'windows'): os.system("TASKKILL /F /IM %s.exe"%processorName) else: - os.system("unset LD_PRELOAD; pkill %s " % processorName) + os.system("unset LD_PRELOAD; sudo pkill %s " % processorName) def gen_tag_col_str(self, gen_type, data_type, count): """ @@ -913,12 +913,13 @@ def create_stream(self, stream_name, des_table, source_sql, trigger_mode=None, w else: stream_options += f" ignore update 0" if not use_except: - tdSql.execute(f'create stream if not exists {stream_name} trigger at_once {stream_options} {fill_history} into {des_table} {subtable} as {source_sql} {fill};') + tdSql.execute(f'create stream if not exists {stream_name} trigger at_once {stream_options} {fill_history} into {des_table} {subtable} as {source_sql} {fill};',queryTimes=3) time.sleep(self.create_stream_sleep) return None else: return f'create stream if not exists {stream_name} {stream_options} {fill_history} into {des_table} {subtable} as {source_sql} {fill};' else: + if watermark is None: if trigger_mode == "max_delay": stream_options = f'trigger {trigger_mode} {max_delay}' @@ -938,12 +939,14 @@ def create_stream(self, stream_name, des_table, source_sql, trigger_mode=None, w stream_options += f" ignore update {ignore_update}" else: stream_options += f" ignore update 0" + if not use_except: - tdSql.execute(f'create stream if not exists {stream_name} {stream_options} {fill_history} into {des_table}{stb_field_name} {tags} {subtable} as {source_sql} {fill};') + tdSql.execute(f'create stream if not exists {stream_name} {stream_options} {fill_history} into {des_table}{stb_field_name} {tags} {subtable} as {source_sql} {fill};',queryTimes=3) time.sleep(self.create_stream_sleep) return None else: return f'create stream if not exists {stream_name} {stream_options} {fill_history} into {des_table}{stb_field_name} {tags} {subtable} as {source_sql} {fill};' + def pause_stream(self, stream_name, if_exist=True, if_not_exist=False): """pause_stream @@ -2160,4 +2163,4 @@ def dict2toml(in_dict: dict, file:str): -tdCom = TDCom() +tdCom = TDCom() \ No newline at end of file diff --git a/tests/system-test/8-stream/force_window_close_interval.py b/tests/system-test/8-stream/force_window_close_interval.py new file mode 100644 index 000000000000..32c228176cf3 --- /dev/null +++ b/tests/system-test/8-stream/force_window_close_interval.py @@ -0,0 +1,253 @@ +import sys +import threading +from util.log import * +from util.sql import * +from util.cases import * +from util.common import * + +class TDTestCase: + updatecfgDict = {'debugFlag': 135, 'asynclog': 0} + def init(self, conn, logSql, replicaVar=1): + self.replicaVar = int(replicaVar) + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + self.tdCom = tdCom + + def force_window_close(self, interval, partition="tbname", funciton_name="", funciton_name_alias= "",delete=False, fill_value=None, fill_history_value=None, case_when=None, ignore_expired=1, ignore_update=1): + tdLog.info(f"*** testing stream force_window_close+interp+every: every: {interval}, partition: {partition}, fill_history: {fill_history_value}, fill: {fill_value}, delete: {delete}, case_when: {case_when} ***") + self.tdCom.subtable=False + col_value_type = "Incremental" if partition=="c1" else "random" + custom_col_index = 1 if partition=="c1" else None + self.tdCom.custom_col_val = 0 + self.delete = delete + self.tdCom.case_name = sys._getframe().f_code.co_name + self.tdCom.prepare_data(interval=interval, fill_history_value=fill_history_value, custom_col_index=custom_col_index, col_value_type=col_value_type) + self.stb_name = self.tdCom.stb_name.replace(f"{self.tdCom.dbname}.", "") + self.ctb_name = self.tdCom.ctb_name.replace(f"{self.tdCom.dbname}.", "") + self.tb_name = self.tdCom.tb_name.replace(f"{self.tdCom.dbname}.", "") + self.stb_stream_des_table = f'{self.stb_name}{self.tdCom.des_table_suffix}' + self.ctb_stream_des_table = f'{self.ctb_name}{self.tdCom.des_table_suffix}' + self.tb_stream_des_table = f'{self.tb_name}{self.tdCom.des_table_suffix}' + if partition == "tbname": + if case_when: + stream_case_when_partition = case_when + else: + stream_case_when_partition = self.tdCom.partition_tbname_alias + + partition_elm_alias = self.tdCom.partition_tbname_alias + + elif partition == "c1": + if case_when: + stream_case_when_partition = case_when + else: + stream_case_when_partition = self.tdCom.partition_col_alias + partition_elm_alias = self.tdCom.partition_col_alias + elif partition == "abs(c1)": + partition_elm_alias = self.tdCom.partition_expression_alias + elif partition is None: + partition_elm_alias = '"no_partition"' + else: + partition_elm_alias = self.tdCom.partition_tag_alias + if partition == "tbname" or partition is None: + if case_when: + stb_subtable_value = f'concat(concat("{self.stb_name}_{self.tdCom.subtable_prefix}", {stream_case_when_partition}), "{self.tdCom.subtable_suffix}")' if self.tdCom.subtable else None + ctb_subtable_value = f'concat(concat("{self.ctb_name}_{self.tdCom.subtable_prefix}", {stream_case_when_partition}), "{self.tdCom.subtable_suffix}")' if self.tdCom.subtable else None + tb_subtable_value = f'concat(concat("{self.tb_name}_{self.tdCom.subtable_prefix}", {stream_case_when_partition}), "{self.tdCom.subtable_suffix}")' if self.tdCom.subtable else None + else: + stb_subtable_value = f'concat(concat("{self.stb_name}_{self.tdCom.subtable_prefix}", {partition_elm_alias}), "{self.tdCom.subtable_suffix}")' if self.tdCom.subtable else None + ctb_subtable_value = f'concat(concat("{self.ctb_name}_{self.tdCom.subtable_prefix}", {partition_elm_alias}), "{self.tdCom.subtable_suffix}")' if self.tdCom.subtable else None + tb_subtable_value = f'concat(concat("{self.tb_name}_{self.tdCom.subtable_prefix}", {partition_elm_alias}), "{self.tdCom.subtable_suffix}")' if self.tdCom.subtable else None + else: + stb_subtable_value = f'concat(concat("{self.stb_name}_{self.tdCom.subtable_prefix}", cast(cast(abs(cast({partition_elm_alias} as int)) as bigint) as varchar(100))), "{self.tdCom.subtable_suffix}")' if self.tdCom.subtable else None + ctb_subtable_value = f'concat(concat("{self.ctb_name}_{self.tdCom.subtable_prefix}", cast(cast(abs(cast({partition_elm_alias} as int)) as bigint) as varchar(100))), "{self.tdCom.subtable_suffix}")' if self.tdCom.subtable else None + tb_subtable_value = f'concat(concat("{self.tb_name}_{self.tdCom.subtable_prefix}", cast(cast(abs(cast({partition_elm_alias} as int)) as bigint) as varchar(100))), "{self.tdCom.subtable_suffix}")' if self.tdCom.subtable else None + if partition: + partition_elm = f'partition by {partition} {partition_elm_alias}' + else: + partition_elm = "" + if fill_value: + if "value" in fill_value.lower(): + fill_value='VALUE,1,2,3,4,5,6,7,8,9,10,11,1,2,3,4,5,6,7,8,9,10,11' + # create error stream + tdLog.info("create error stream") + sleep(10) + tdSql.error(f"create stream itp_force_error_1 trigger force_window_close IGNORE EXPIRED 1 IGNORE UPDATE 0 into itp_force_error_1 as select _irowts,tbname,_isfilled,interp(c1,1) from {self.stb_name} partition by tbname every(5s) fill(prev) ;") + tdSql.error(f"create stream itp_force_error_1 trigger force_window_close IGNORE EXPIRED 0 IGNORE UPDATE 1 into itp_force_error_1 as select _irowts,tbname,_isfilled,interp(c1,1) from {self.stb_name} partition by tbname every(5s) fill(prev) ;") + tdSql.error(f"create stream itp_force_error_1 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 1 into itp_force_error_1 as select _irowts,tbname,_isfilled,interp(c1,1) from {self.stb_name} partition by tbname every(5s) fill(prev) ;") + + + # function name : interp + trigger_mode = "force_window_close" + # # subtable is true + # create stream add :subtable_value=stb_subtable_value or subtable_value=ctb_subtable_value + # no subtable + self.tdCom.create_stream(stream_name=f'{self.stb_name}{self.tdCom.stream_suffix}', des_table=self.stb_stream_des_table, source_sql=f'select _irowts as irowts,tbname as table_name, _isfilled as isfilled, {funciton_name} as {funciton_name_alias} from {self.stb_name} {partition_elm} every({self.tdCom.dataDict["interval"]}s)', trigger_mode=trigger_mode, fill_value=fill_value, fill_history_value=fill_history_value,ignore_expired=ignore_expired,ignore_update=ignore_update) + self.tdCom.create_stream(stream_name=f'{self.ctb_name}{self.tdCom.stream_suffix}', des_table=self.ctb_stream_des_table, source_sql=f'select _irowts as irowts, tbname as table_name, _isfilled as isfilled, {funciton_name} as {funciton_name_alias} from {self.ctb_name} {partition_elm} every({self.tdCom.dataDict["interval"]}s)', trigger_mode=trigger_mode, fill_value=fill_value, fill_history_value=fill_history_value,ignore_expired=ignore_expired,ignore_update=ignore_update) + + if fill_value: + if "value" in fill_value.lower(): + fill_value='VALUE,1,2,3,4,5,6,7,8,9,10,11' + self.tdCom.create_stream(stream_name=f'{self.tb_name}{self.tdCom.stream_suffix}', des_table=self.tb_stream_des_table, source_sql=f'select _irowts as irowts,tbname as table_name, _isfilled as isfilled, {funciton_name} as {funciton_name_alias} from {self.tb_name} every({self.tdCom.dataDict["interval"]}s)', trigger_mode=trigger_mode, fill_value=fill_value, fill_history_value=fill_history_value,ignore_expired=ignore_expired,ignore_update=ignore_update) + start_time = self.tdCom.date_time + + time.sleep(1) + start_force_ts = str(0) + for i in range(self.tdCom.range_count): + ts_value = str(self.tdCom.date_time+self.tdCom.dataDict["interval"])+f'+{i*10}s' + if start_force_ts == "0": + start_force_ts = ts_value + ts_cast_delete_value = self.tdCom.time_cast(ts_value) + self.tdCom.sinsert_rows(tbname=self.tdCom.ctb_name, ts_value=ts_value, custom_col_index=custom_col_index, col_value_type=col_value_type) + if i%2 == 0: + self.tdCom.sinsert_rows(tbname=self.tdCom.ctb_name, ts_value=ts_value, custom_col_index=custom_col_index, col_value_type=col_value_type) + if self.delete and i%2 != 0: + self.tdCom.sdelete_rows(tbname=self.tdCom.ctb_name, start_ts=ts_cast_delete_value) + self.tdCom.date_time += 1 + self.tdCom.sinsert_rows(tbname=self.tdCom.tb_name, ts_value=ts_value, custom_col_index=custom_col_index, col_value_type=col_value_type) + if i%2 == 0: + self.tdCom.sinsert_rows(tbname=self.tdCom.tb_name, ts_value=ts_value, custom_col_index=custom_col_index, col_value_type=col_value_type) + if self.delete and i%2 != 0: + self.tdCom.sdelete_rows(tbname=self.tdCom.tb_name, start_ts=ts_cast_delete_value) + self.tdCom.date_time += 1 + if partition: + partition_elm = f'partition by {partition}' + else: + partition_elm = "" + + if not fill_value: + for tbname in [self.stb_name, self.ctb_name, self.tb_name]: + if tbname != self.tb_name: + self.tdCom.check_query_data(f'select wstart, {self.tdCom.stb_output_select_str} from {tbname}{self.tdCom.des_table_suffix} order by wstart', f'select _wstart AS wstart, {self.tdCom.stb_source_select_str} from {tbname} {partition_elm} interval({self.tdCom.dataDict["interval"]}s) order by wstart', sorted=True) + else: + self.tdCom.check_query_data(f'select wstart, {self.tdCom.tb_output_select_str} from {tbname}{self.tdCom.des_table_suffix} order by wstart', f'select _wstart AS wstart, {self.tdCom.tb_source_select_str} from {tbname} {partition_elm} interval({self.tdCom.dataDict["interval"]}s) order by wstart', sorted=True) + + if self.tdCom.subtable: + for tname in [self.stb_name, self.ctb_name]: + group_id = self.tdCom.get_group_id_from_stb(f'{tname}_output') + tdSql.query(f'select * from {self.ctb_name}') + ptn_counter = 0 + for c1_value in tdSql.queryResult: + if partition == "c1": + tbname = self.tdCom.get_subtable_wait(f'{tname}_{self.tdCom.subtable_prefix}{abs(c1_value[1])}{self.tdCom.subtable_suffix}') + tdSql.query(f'select count(*) from `{tbname}`') + elif partition is None: + tbname = self.tdCom.get_subtable_wait(f'{tname}_{self.tdCom.subtable_prefix}no_partition{self.tdCom.subtable_suffix}') + tdSql.query(f'select count(*) from `{tbname}`') + elif partition == "abs(c1)": + abs_c1_value = abs(c1_value[1]) + tbname = self.tdCom.get_subtable_wait(f'{tname}_{self.tdCom.subtable_prefix}{abs_c1_value}{self.tdCom.subtable_suffix}') + tdSql.query(f'select count(*) from `{tbname}`') + elif partition == "tbname" and ptn_counter == 0: + tbname = self.tdCom.get_subtable_wait(f'{tname}_{self.tdCom.subtable_prefix}{self.ctb_name}{self.tdCom.subtable_suffix}_{tname}_output_{group_id}') + tdSql.query(f'select count(*) from `{tbname}`') + ptn_counter += 1 + tdSql.checkEqual(tdSql.queryResult[0][0] > 0, True) + group_id = self.tdCom.get_group_id_from_stb(f'{self.tb_name}_output') + tdSql.query(f'select * from {self.tb_name}') + ptn_counter = 0 + for c1_value in tdSql.queryResult: + if partition == "c1": + tbname = self.tdCom.get_subtable_wait(f'{self.tb_name}_{self.tdCom.subtable_prefix}{abs(c1_value[1])}{self.tdCom.subtable_suffix}') + tdSql.query(f'select count(*) from `{tbname}`') + elif partition is None: + tbname = self.tdCom.get_subtable_wait(f'{self.tb_name}_{self.tdCom.subtable_prefix}no_partition{self.tdCom.subtable_suffix}') + tdSql.query(f'select count(*) from `{tbname}`') + elif partition == "abs(c1)": + abs_c1_value = abs(c1_value[1]) + tbname = self.tdCom.get_subtable_wait(f'{self.tb_name}_{self.tdCom.subtable_prefix}{abs_c1_value}{self.tdCom.subtable_suffix}') + tdSql.query(f'select count(*) from `{tbname}`') + elif partition == "tbname" and ptn_counter == 0: + tbname = self.tdCom.get_subtable_wait(f'{self.tb_name}_{self.tdCom.subtable_prefix}{self.tb_name}{self.tdCom.subtable_suffix}_{self.tb_name}_output_{group_id}') + tdSql.query(f'select count(*) from `{tbname}`') + ptn_counter += 1 + + tdSql.checkEqual(tdSql.queryResult[0][0] > 0, True) + if fill_value: + end_date_time = self.tdCom.date_time + final_range_count = self.tdCom.range_count + history_ts = str(start_time)+f'-{self.tdCom.dataDict["interval"]*(final_range_count+2)}s' + start_ts = self.tdCom.time_cast(history_ts, "-") + future_ts = str(end_date_time)+f'+{self.tdCom.dataDict["interval"]*(final_range_count+2)}s' + end_ts = self.tdCom.time_cast(future_ts) + self.tdCom.sinsert_rows(tbname=self.ctb_name, ts_value=history_ts) + self.tdCom.sinsert_rows(tbname=self.tb_name, ts_value=history_ts) + self.tdCom.sinsert_rows(tbname=self.ctb_name, ts_value=future_ts) + self.tdCom.sinsert_rows(tbname=self.tb_name, ts_value=future_ts) + self.tdCom.date_time = start_time + # update + history_ts = str(start_time)+f'-{self.tdCom.dataDict["interval"]*(final_range_count+2)}s' + start_ts = self.tdCom.time_cast(history_ts, "-") + future_ts = str(end_date_time)+f'+{self.tdCom.dataDict["interval"]*(final_range_count+2)}s' + end_ts = self.tdCom.time_cast(future_ts) + self.tdCom.sinsert_rows(tbname=self.ctb_name, ts_value=history_ts) + self.tdCom.sinsert_rows(tbname=self.tb_name, ts_value=history_ts) + self.tdCom.sinsert_rows(tbname=self.ctb_name, ts_value=future_ts) + self.tdCom.sinsert_rows(tbname=self.tb_name, ts_value=future_ts) + self.tdCom.date_time = start_time + for i in range(self.tdCom.range_count): + ts_value = str(self.tdCom.date_time+self.tdCom.dataDict["interval"])+f'+{i*10}s' + ts_cast_delete_value = self.tdCom.time_cast(ts_value) + self.tdCom.sinsert_rows(tbname=self.ctb_name, ts_value=ts_value) + self.tdCom.date_time += 1 + self.tdCom.sinsert_rows(tbname=self.tb_name, ts_value=ts_value) + self.tdCom.date_time += 1 + if self.delete: + self.tdCom.sdelete_rows(tbname=self.ctb_name, start_ts=self.tdCom.time_cast(start_time), end_ts=ts_cast_delete_value) + self.tdCom.sdelete_rows(tbname=self.tb_name, start_ts=self.tdCom.time_cast(start_time), end_ts=ts_cast_delete_value) + for tbname in [self.stb_name, self.ctb_name, self.tb_name]: + if tbname != self.tb_name: + if "value" in fill_value.lower(): + fill_value='VALUE,1,2,3,6,7,8,9,10,11,1,2,3,4,5,6,7,8,9,10,11' + if partition == "tbname": + self.tdCom.check_query_data(f'select irowts, table_name, isfilled, {funciton_name_alias} from {tbname}{self.tdCom.des_table_suffix} where irowts >= {start_force_ts} and irowts <= {end_ts} order by irowts', f'select _irowts as irowts ,tbname as table_name, _isfilled as isfilled , {funciton_name} as {funciton_name_alias} from {tbname} partition by {partition} range({start_force_ts},{end_ts}) every({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by irowts', fill_value=fill_value) + else: + self.tdCom.check_query_data(f'select wstart, {self.tdCom.fill_stb_output_select_str} from {tbname}{self.tdCom.des_table_suffix} where `min(c1)` is not Null order by wstart,`min(c1)`', f'select * from (select _wstart AS wstart, {self.tdCom.fill_stb_source_select_str} from {tbname} where ts >= {start_ts} and ts <= {end_ts} partition by {partition} interval({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by wstart) where `min(c1)` is not Null order by wstart,`min(c1)`', fill_value=fill_value) + else: + if "value" in fill_value.lower(): + fill_value='VALUE,1,2,3,6,7,8,9,10,11' + if partition == "tbname": + self.tdCom.check_query_data(f'select wstart, {self.tdCom.fill_tb_output_select_str} from {tbname}{self.tdCom.des_table_suffix} order by wstart', f'select _wstart AS wstart, {self.tdCom.fill_tb_source_select_str} from {tbname} where ts >= {start_ts} and ts <= {end_ts} partition by {partition} interval({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by wstart', fill_value=fill_value) + else: + self.tdCom.check_query_data(f'select wstart, {self.tdCom.fill_tb_output_select_str} from {tbname}{self.tdCom.des_table_suffix} where `min(c1)` is not Null order by wstart,`min(c1)`', f'select * from (select _wstart AS wstart, {self.tdCom.fill_tb_source_select_str} from {tbname} where ts >= {start_ts} and ts <= {end_ts} partition by {partition} interval({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by wstart) where `min(c1)` is not Null order by wstart,`min(c1)`', fill_value=fill_value) + + if self.delete: + self.tdCom.sdelete_rows(tbname=self.ctb_name, start_ts=start_ts, end_ts=ts_cast_delete_value) + self.tdCom.sdelete_rows(tbname=self.tb_name, start_ts=start_ts, end_ts=ts_cast_delete_value) + for tbname in [self.stb_name, self.ctb_name, self.tb_name]: + if tbname != self.tb_name: + if "value" in fill_value.lower(): + fill_value='VALUE,1,2,3,6,7,8,9,10,11,1,2,3,4,5,6,7,8,9,10,11' + if partition == "tbname": + self.tdCom.check_query_data(f'select wstart, {self.tdCom.fill_stb_output_select_str} from {tbname}{self.tdCom.des_table_suffix} order by wstart', f'select _wstart AS wstart, {self.tdCom.fill_stb_source_select_str} from {tbname} where ts >= {start_ts.replace("-", "+")} and ts <= {end_ts} partition by {partition} interval({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by wstart', fill_value=fill_value) + else: + self.tdCom.check_query_data(f'select wstart, {self.tdCom.fill_stb_output_select_str} from {tbname}{self.tdCom.des_table_suffix} order by wstart,`min(c1)`', f'select * from (select _wstart AS wstart, {self.tdCom.fill_stb_source_select_str} from {tbname} where ts >= {start_ts} and ts <= {end_ts} partition by {partition} interval({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by wstart) where `min(c1)` is not Null order by wstart,`min(c1)`', fill_value=fill_value) + + else: + if "value" in fill_value.lower(): + fill_value='VALUE,1,2,3,6,7,8,9,10,11' + if partition == "tbname": + self.tdCom.check_query_data(f'select wstart, {self.tdCom.fill_tb_output_select_str} from {tbname}{self.tdCom.des_table_suffix} order by wstart', f'select _wstart AS wstart, {self.tdCom.fill_tb_source_select_str} from {tbname} where ts >= {start_ts.replace("-", "+")} and ts <= {end_ts} partition by {partition} interval({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by wstart', fill_value=fill_value) + else: + self.tdCom.check_query_data(f'select wstart, {self.tdCom.fill_tb_output_select_str} from {tbname}{self.tdCom.des_table_suffix} order by wstart,`min(c1)`', f'select * from (select _wstart AS wstart, {self.tdCom.fill_tb_source_select_str} from {tbname} where ts >= {start_ts} and ts <= {end_ts} partition by {partition} interval({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by wstart) where `min(c1)` is not Null order by wstart,`min(c1)`', fill_value=fill_value) + + + def run(self): + self.force_window_close(interval=random.randint(10, 15), partition="tbname", funciton_name="interp(c1)", funciton_name_alias="intp_c1" ,delete=False, ignore_update=1, fill_value="PREV") + self.force_window_close(interval=random.randint(10, 15), partition="c1", ignore_update=1) + self.force_window_close(interval=random.randint(10, 15), partition="abs(c1)", ignore_update=1) + self.force_window_close(interval=random.randint(10, 15), partition=None, delete=True) + self.force_window_close(interval=random.randint(10, 15), partition=self.tdCom.stream_case_when_tbname, case_when=f'case when {self.tdCom.stream_case_when_tbname} = tbname then {self.tdCom.partition_tbname_alias} else tbname end') + self.force_window_close(interval=random.randint(10, 15), partition="tbname", fill_history_value=1, fill_value="NULL") + for fill_value in ["NULL", "PREV", "NEXT", "LINEAR", "VALUE,1,2,3,4,5,6,7,8,9,10,11,1,2,3,4,5,6,7,8,9,10,11"]: + # for fill_value in ["PREV", "NEXT", "LINEAR", "VALUE,1,2,3,4,5,6,7,8,9,10,11,1,2,3,4,5,6,7,8,9,10,11"]: + self.at_once_interval(interval=random.randint(10, 15), partition="tbname", fill_value=fill_value) + self.at_once_interval(interval=random.randint(10, 15), partition="tbname", fill_value=fill_value, delete=True) + + def stop(self): + tdSql.close() + tdLog.success(f"{__file__} successfully executed") + +event = threading.Event() + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) \ No newline at end of file From 20c54a24f0ef025c71bdd450f0672b1bcf594933 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Thu, 24 Oct 2024 11:22:55 +0800 Subject: [PATCH 224/695] avoid free memory incorrectly --- .../executor/src/streamtimewindowoperator.c | 3 +- tests/script/tsim/stream/basic4.sim | 196 +++++++++++++++++- 2 files changed, 195 insertions(+), 4 deletions(-) diff --git a/source/libs/executor/src/streamtimewindowoperator.c b/source/libs/executor/src/streamtimewindowoperator.c index be27f277c04e..83b9862ba659 100644 --- a/source/libs/executor/src/streamtimewindowoperator.c +++ b/source/libs/executor/src/streamtimewindowoperator.c @@ -497,6 +497,7 @@ void destroyStreamFinalIntervalOperatorInfo(void* param) { blockDataDestroy(pInfo->pMidRetriveRes); blockDataDestroy(pInfo->pMidPulloverRes); if (pInfo->pUpdatedMap != NULL) { + // free flushed pos tSimpleHashSetFreeFp(pInfo->pUpdatedMap, destroyFlusedppPos); tSimpleHashCleanup(pInfo->pUpdatedMap); pInfo->pUpdatedMap = NULL; @@ -1967,7 +1968,6 @@ int32_t createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream, SPhysiN code = initAggSup(&pOperator->exprSupp, &pInfo->aggSup, pExprInfo, numOfCols, keyBufSize, pTaskInfo->id.str, pInfo->pState, &pTaskInfo->storageAPI.functionStore); QUERY_CHECK_CODE(code, lino, _error); - tSimpleHashSetFreeFp(pInfo->aggSup.pResultRowHashTable, destroyFlusedppPos); code = initExecTimeWindowInfo(&pInfo->twAggSup.timeWindowData, &pTaskInfo->window); QUERY_CHECK_CODE(code, lino, _error); @@ -5346,7 +5346,6 @@ int32_t createStreamIntervalOperatorInfo(SOperatorInfo* downstream, SPhysiNode* code = initAggSup(pSup, &pInfo->aggSup, pExprInfo, numOfCols, keyBufSize, pTaskInfo->id.str, pInfo->pState, &pTaskInfo->storageAPI.functionStore); QUERY_CHECK_CODE(code, lino, _error); - tSimpleHashSetFreeFp(pInfo->aggSup.pResultRowHashTable, destroyFlusedppPos); if (pIntervalPhyNode->window.pExprs != NULL) { int32_t numOfScalar = 0; diff --git a/tests/script/tsim/stream/basic4.sim b/tests/script/tsim/stream/basic4.sim index 8868c3fd60ef..cadce94ef4f9 100644 --- a/tests/script/tsim/stream/basic4.sim +++ b/tests/script/tsim/stream/basic4.sim @@ -189,10 +189,10 @@ $loop_count = 0 loop4: -sleep 200 +sleep 500 $loop_count = $loop_count + 1 -if $loop_count == 10 then +if $loop_count == 20 then return -1 endi @@ -324,5 +324,197 @@ if $data[29][1] != 2 then goto loop7 endi +print step4==== + +sql create database test4 vgroups 1; +sql use test4; + +sql create stable st(ts timestamp,a int,b int,c int, d double) tags(ta int,tb int,tc int); +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); +sql create table t3 using st tags(2,2,2); +sql create table t4 using st tags(2,2,2); +sql create table t5 using st tags(2,2,2); +sql create table t6 using st tags(2,2,2); + +sql create stream streams4 trigger window_close IGNORE EXPIRED 0 into streamt as select _wstart, count(*), now from st partition by tbname interval(1s); +sql create stream streams5 trigger window_close IGNORE EXPIRED 0 into streamt1 as select _wstart, count(*), now from st partition by b interval(1s); + +run tsim/stream/checkTaskStatus.sim + +sql insert into t1 values(1648791211000,1,1,1,1.1) t2 values (1648791211000,2,2,2,2.1) t3 values(1648791211000,3,3,3,3.1) t4 values(1648791211000,4,4,4,4.1) t5 values (1648791211000,5,5,5,5.1) t6 values(1648791211000,6,6,6,6.1); + +sql insert into t1 values(now,1,1,1,1.1) t2 values (now,2,2,2,2.1) t3 values(now,3,3,3,3.1) t4 values(now,4,4,4,4.1) t5 values (now,5,5,5,5.1) t6 values(now,6,6,6,6.1); + + +$loop_count = 0 + +loop8: + +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print sql select * from streamt; +sql select * from streamt; + +if $rows != 6 then + print ======rows=$rows + goto loop8 +endi + +if $data01 != 1 then + print ======data01=$data01 + return -1 +endi + +if $data11 != 1 then + print ======data11=$data11 + return -1 +endi + +if $data21 != 1 then + print ======data21=$data21 + return -1 +endi + +$loop_count = 0 + +loop8_1: + +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print sql select * from streamt1; +sql select * from streamt1; + +if $rows != 6 then + print ======rows=$rows + goto loop8_1 +endi + +if $data01 != 1 then + print ======data01=$data01 + return -1 +endi + +if $data11 != 1 then + print ======data11=$data11 + return -1 +endi + +if $data21 != 1 then + print ======data21=$data21 + return -1 +endi + +sleep 2000 + +sql insert into t1 values(now,1,1,1,1.1) t2 values (now,2,2,2,2.1) t3 values(now,3,3,3,3.1) t4 values(now,4,4,4,4.1) t5 values (now,5,5,5,5.1) t6 values(now,6,6,6,6.1); + +sleep 2000 + +sql insert into t1 values(now,1,1,1,1.1) t2 values (now,2,2,2,2.1) t3 values(now,3,3,3,3.1) t4 values(now,4,4,4,4.1) t5 values (now,5,5,5,5.1) t6 values(now,6,6,6,6.1); + +$loop_count = 0 + +loop8_1: + +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +print sql select * from streamt order by 1 desc; +sql select * from streamt order by 1 desc; + +if $data01 != 1 then + print ======data01=$data01 + goto loop8_1 +endi + +print sql select * from streamt1 order by 1 desc; +sql select * from streamt1 order by 1 desc; + +if $data01 != 1 then + print ======data01=$data01 + goto loop8_1 +endi + +sleep 2000 + +sql insert into t1 values(now,1,1,1,1.1) +sql insert into t2 values(now,2,2,2,2.1); +sql insert into t3 values(now,3,3,3,3.1); +sql insert into t4 values(now,4,4,4,4.1); +sql insert into t5 values(now,5,5,5,5.1); +sql insert into t6 values(now,6,6,6,6.1); + +$loop_count = 0 + +loop9: + +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print sql select * from streamt order by 1 desc; +sql select * from streamt order by 1 desc; + +if $data01 != 1 then + print ======data01=$data01 + goto loop9 +endi + +if $data11 != 1 then + print ======data11=$data11 + goto loop9 +endi + +if $data21 != 1 then + print ======data21=$data21 + goto loop9 +endi + +$loop_count = 0 + +loop10: + +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +print sql select * from streamt1 order by 1 desc; +sql select * from streamt1 order by 1 desc; + +if $data01 != 1 then + print ======data01=$data01 + goto loop10 +endi + +if $data11 != 1 then + print ======data11=$data11 + goto loop10 +endi + +if $data21 != 1 then + print ======data21=$data21 + goto loop10 +endi system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file From b5aec92c2c8e6e0f495910670cd5539e41206ce0 Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Thu, 24 Oct 2024 12:54:50 +0800 Subject: [PATCH 225/695] db/param: fix s3_keeplocal defualt value --- tests/develop-test/2-query/show_create_db.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/develop-test/2-query/show_create_db.py b/tests/develop-test/2-query/show_create_db.py index d6dcffcbb460..b77e744df209 100644 --- a/tests/develop-test/2-query/show_create_db.py +++ b/tests/develop-test/2-query/show_create_db.py @@ -42,17 +42,17 @@ def run(self): tdSql.query('show create database scd;') tdSql.checkRows(1) tdSql.checkData(0, 0, 'scd') - tdSql.checkData(0, 1, "CREATE DATABASE `scd` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 10d WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 2 KEEP 3650d,3650d,3650d PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 ENCRYPT_ALGORITHM 'none' S3_CHUNKSIZE 262144 S3_KEEPLOCAL 5256000m S3_COMPACT 1") + tdSql.checkData(0, 1, "CREATE DATABASE `scd` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 10d WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 2 KEEP 3650d,3650d,3650d PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 ENCRYPT_ALGORITHM 'none' S3_CHUNKSIZE 262144 S3_KEEPLOCAL 525600m S3_COMPACT 1") tdSql.query('show create database scd2;') tdSql.checkRows(1) tdSql.checkData(0, 0, 'scd2') - tdSql.checkData(0, 1, "CREATE DATABASE `scd2` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 10d WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 3 KEEP 3650d,3650d,3650d PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 ENCRYPT_ALGORITHM 'none' S3_CHUNKSIZE 262144 S3_KEEPLOCAL 5256000m S3_COMPACT 1") + tdSql.checkData(0, 1, "CREATE DATABASE `scd2` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 10d WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 3 KEEP 3650d,3650d,3650d PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 ENCRYPT_ALGORITHM 'none' S3_CHUNKSIZE 262144 S3_KEEPLOCAL 525600m S3_COMPACT 1") tdSql.query('show create database scd4') tdSql.checkRows(1) tdSql.checkData(0, 0, 'scd4') - tdSql.checkData(0, 1, "CREATE DATABASE `scd4` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 10d WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 13 KEEP 3650d,3650d,3650d PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 ENCRYPT_ALGORITHM 'none' S3_CHUNKSIZE 262144 S3_KEEPLOCAL 5256000m S3_COMPACT 1") + tdSql.checkData(0, 1, "CREATE DATABASE `scd4` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 10d WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 13 KEEP 3650d,3650d,3650d PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 ENCRYPT_ALGORITHM 'none' S3_CHUNKSIZE 262144 S3_KEEPLOCAL 525600m S3_COMPACT 1") self.restartTaosd(1, dbname='scd') @@ -60,16 +60,16 @@ def run(self): tdSql.query('show create database scd;') tdSql.checkRows(1) tdSql.checkData(0, 0, 'scd') - tdSql.checkData(0, 1, "CREATE DATABASE `scd` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 10d WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 2 KEEP 3650d,3650d,3650d PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 ENCRYPT_ALGORITHM 'none' S3_CHUNKSIZE 262144 S3_KEEPLOCAL 5256000m S3_COMPACT 1") + tdSql.checkData(0, 1, "CREATE DATABASE `scd` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 10d WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 2 KEEP 3650d,3650d,3650d PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 ENCRYPT_ALGORITHM 'none' S3_CHUNKSIZE 262144 S3_KEEPLOCAL 525600m S3_COMPACT 1") tdSql.query('show create database scd2;') tdSql.checkRows(1) tdSql.checkData(0, 0, 'scd2') - tdSql.checkData(0, 1, "CREATE DATABASE `scd2` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 10d WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 3 KEEP 3650d,3650d,3650d PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 ENCRYPT_ALGORITHM 'none' S3_CHUNKSIZE 262144 S3_KEEPLOCAL 5256000m S3_COMPACT 1") + tdSql.checkData(0, 1, "CREATE DATABASE `scd2` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 10d WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 3 KEEP 3650d,3650d,3650d PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 ENCRYPT_ALGORITHM 'none' S3_CHUNKSIZE 262144 S3_KEEPLOCAL 525600m S3_COMPACT 1") tdSql.query('show create database scd4') tdSql.checkRows(1) tdSql.checkData(0, 0, 'scd4') - tdSql.checkData(0, 1, "CREATE DATABASE `scd4` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 10d WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 13 KEEP 3650d,3650d,3650d PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 ENCRYPT_ALGORITHM 'none' S3_CHUNKSIZE 262144 S3_KEEPLOCAL 5256000m S3_COMPACT 1") + tdSql.checkData(0, 1, "CREATE DATABASE `scd4` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 10d WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 13 KEEP 3650d,3650d,3650d PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 ENCRYPT_ALGORITHM 'none' S3_CHUNKSIZE 262144 S3_KEEPLOCAL 525600m S3_COMPACT 1") tdSql.execute('drop database scd') From ea1da6db9e8fef7edf4ff0c8f87246590a4edf6e Mon Sep 17 00:00:00 2001 From: Yu Chen <74105241+yu285@users.noreply.github.com> Date: Thu, 24 Oct 2024 13:35:01 +0800 Subject: [PATCH 226/695] docs:Update 01-taosd.md --- docs/zh/14-reference/01-components/01-taosd.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/zh/14-reference/01-components/01-taosd.md b/docs/zh/14-reference/01-components/01-taosd.md index fbf086bf6bc4..b724d46bde7c 100644 --- a/docs/zh/14-reference/01-components/01-taosd.md +++ b/docs/zh/14-reference/01-components/01-taosd.md @@ -33,7 +33,7 @@ taosd 命令行参数如下 | secondEp | taosd 启动时,如果 firstEp 连接不上,尝试连接集群中第二个 dnode 的 endpoint,缺省值:无 | | fqdn | 启动 taosd 后所监听的服务地址,缺省值:所在服务器上配置的第一个 hostname | | serverPort | 启动 taosd 后所监听的端口,缺省值:6030 | -| numOfRpcSessions | 允许一个客户端能创建的最大连接数,取值范围 100-100000,缺省值:30000 | +| numOfRpcSessions | 允许一个 dnode 能发起的最大连接数,取值范围 100-100000,缺省值:30000 | | timeToGetAvailableConn | 获得可用连接的最长等待时间,取值范围 10-50000000,单位为毫秒,缺省值:500000 | ### 监控相关 @@ -458,4 +458,4 @@ TDengine 的日志文件主要包括普通日志和慢日志两种类型。 3. 多个客户端的日志存储在相应日志路径下的同一个 taosSlowLog.yyyy.mm.dd 文件里。 4. 慢日志文件不自动删除,不压缩。 5. 使用和普通日志文件相同的三个参数 logDir, minimalLogDirGB, asyncLog。另外两个参数 numOfLogLines,logKeepDays 不适用于慢日志。 - \ No newline at end of file + From 4313b3ce40d7f547c9f199d6557c2517f42a45eb Mon Sep 17 00:00:00 2001 From: Alex Duan <51781608+DuanKuanJun@users.noreply.github.com> Date: Thu, 24 Oct 2024 13:54:44 +0800 Subject: [PATCH 227/695] Update 17-json.md modifi is not nul --- docs/zh/14-reference/03-taos-sql/17-json.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/zh/14-reference/03-taos-sql/17-json.md b/docs/zh/14-reference/03-taos-sql/17-json.md index 18c25cfe230f..6e1f568bac4f 100644 --- a/docs/zh/14-reference/03-taos-sql/17-json.md +++ b/docs/zh/14-reference/03-taos-sql/17-json.md @@ -33,7 +33,7 @@ description: 对 JSON 类型如何使用的详细说明 ## 支持的操作 -1. 在 where 条件中时,支持函数 match/nmatch/between and/like/and/or/is null/is no null,不支持 in +1. 在 where 条件中时,支持函数 match/nmatch/between and/like/and/or/is null/is not null,不支持 in ``` select * from s1 where info->'k1' match 'v*'; From 515b93ce2274ed4425450ecef1d54ea5ace5ea39 Mon Sep 17 00:00:00 2001 From: wangjiaming0909 <604227650@qq.com> Date: Thu, 24 Oct 2024 14:08:55 +0800 Subject: [PATCH 228/695] add tests for fill --- tests/system-test/2-query/fill_with_group.py | 45 ++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/tests/system-test/2-query/fill_with_group.py b/tests/system-test/2-query/fill_with_group.py index 49c3b5dcf8c2..3b98ec30cee9 100644 --- a/tests/system-test/2-query/fill_with_group.py +++ b/tests/system-test/2-query/fill_with_group.py @@ -303,6 +303,51 @@ def test_fill_with_complex_expr(self): tdSql.query(sql, queryTimes=1) tdSql.checkRows(0) + sql = "SELECT count(*), timediff(_wend, last(ts)) + t1, timediff('2018-09-20 01:00:00', _wstart) + t1, concat(to_char(_wstart, 'HH:MI:SS__'), tbname) FROM meters WHERE ts >= '2018-09-20 00:00:00.000' AND ts < '2018-09-20 01:00:00.000' PARTITION BY tbname, t1 INTERVAL(5m) FILL(value, 0, 0) HAVING(timediff(last(ts), _wstart) + t1 >= 1) ORDER BY timediff(last(ts), _wstart), tbname" + tdSql.query(sql, queryTimes=1) + tdSql.checkRows(48) + sql = "SELECT count(*), timediff(_wend, last(ts)) + t1, timediff('2018-09-20 01:00:00', _wstart) + t1, concat(to_char(_wstart, 'HH:MI:SS__'), tbname) FROM meters WHERE ts >= '2018-09-20 00:00:00.000' AND ts < '2018-09-20 01:00:00.000' PARTITION BY tbname, t1 INTERVAL(5m) FILL(value, 0, 0) HAVING(count(*) >= 0) ORDER BY timediff(last(ts), _wstart), tbname" + tdSql.query(sql, queryTimes=1) + tdSql.checkRows(120) + sql = "SELECT count(*), timediff(_wend, last(ts)) + t1, timediff('2018-09-20 01:00:00', _wstart) + t1, concat(to_char(_wstart, 'HH:MI:SS__'), tbname) FROM meters WHERE ts >= '2018-09-20 00:00:00.000' AND ts < '2018-09-20 01:00:00.000' PARTITION BY tbname, t1 INTERVAL(5m) FILL(value, 0, 0) HAVING(count(*) > 0) ORDER BY timediff(last(ts), _wstart), tbname" + tdSql.query(sql, queryTimes=1) + tdSql.checkRows(60) + sql = "SELECT count(*), timediff(_wend, last(ts)) + t1, timediff('2018-09-20 01:00:00', _wstart) + t1, concat(to_char(_wstart, 'HH:MI:SS__'), tbname) FROM meters WHERE ts >= '2018-09-20 00:00:00.000' AND ts < '2018-09-20 01:00:00.000' PARTITION BY tbname INTERVAL(5m) FILL(linear) HAVING(count(*) >= 0 and t1 <= 1) ORDER BY timediff(last(ts), _wstart), tbname, t1" + tdSql.query(sql, queryTimes=1) + tdSql.checkRows(44) + sql = "SELECT count(*), timediff(_wend, last(ts)) + t1, timediff('2018-09-20 01:00:00', _wstart) + t1, concat(to_char(_wstart, 'HH:MI:SS__'), tbname) FROM meters WHERE ts >= '2018-09-20 00:00:00.000' AND ts < '2018-09-20 01:00:00.000' PARTITION BY tbname INTERVAL(5m) FILL(prev) HAVING(count(*) >= 0 and t1 > 1) ORDER BY timediff(last(ts), _wstart), tbname, t1" + tdSql.query(sql, queryTimes=1) + tdSql.checkRows(72) + + sql = "SELECT 1+1, count(*), timediff(_wend, last(ts)) + t1, timediff('2018-09-20 01:00:00', _wstart) + t1, concat(to_char(_wstart, 'HH:MI:SS__'), tbname) FROM meters WHERE ts >= '2018-09-20 00:00:00.000' AND ts < '2018-09-20 01:00:00.000' PARTITION BY tbname INTERVAL(5m) FILL(linear) ORDER BY tbname, _wstart;" + tdSql.query(sql, queryTimes=1) + tdSql.checkRows(120) + for i in range(11, 120, 12): + tdSql.checkData(i, 1, None) + for i in range(0, 120): + tdSql.checkData(i, 0, 2) + + sql = "SELECT count(*), timediff(_wend, last(ts)) + t1, timediff('2018-09-20 01:00:00', _wstart) + t1, concat(to_char(_wstart, 'HH:MI:SS__'), tbname) FROM meters WHERE ts >= '2018-09-20 00:00:00.000' AND ts < '2018-09-20 01:00:00.000' PARTITION BY tbname INTERVAL(5m) FILL(linear) HAVING(count(*) >= 0) ORDER BY tbname;" + tdSql.query(sql, queryTimes=1) + tdSql.checkRows(110) + for i in range(0, 110, 11): + lastCol = tdSql.getData(i, 3) + tdLog.debug(f"lastCol: {lastCol}") + if lastCol[-1:] != str(i//11): + tdLog.exit(f"query error: lastCol: {lastCol}") + + sql = "SELECT 1+1, count(*), timediff(_wend, last(ts)) + t1, timediff('2018-09-20 01:00:00', _wstart) + t1,t1 FROM meters WHERE ts >= '2018-09-20 00:00:00.000' AND ts < '2018-09-20 01:00:00.000' PARTITION BY t1 INTERVAL(5m) FILL(linear) ORDER BY t1, _wstart;" + tdSql.query(sql, queryTimes=1) + tdSql.checkRows(60) + + sql = "SELECT 1+1, count(*), timediff(_wend, last(ts)) + t1, timediff('2018-09-20 01:00:00', _wstart) + t1,t1 FROM meters WHERE ts >= '2018-09-20 00:00:00.000' AND ts < '2018-09-20 01:00:00.000' PARTITION BY t1 INTERVAL(5m) FILL(linear) HAVING(count(*) > 0) ORDER BY t1, _wstart;" + tdSql.query(sql, queryTimes=1) + tdSql.checkRows(55) + + # TODO Fix Me! + sql = "explain SELECT count(*), timediff(_wend, last(ts)), timediff('2018-09-20 01:00:00', _wstart) FROM meters WHERE ts >= '2018-09-20 00:00:00.000' AND ts < '2018-09-20 01:00:00.000' PARTITION BY concat(tbname, 'asd') INTERVAL(5m) having(concat(tbname, 'asd') like '%asd');" + tdSql.error(sql, -2147473664) # Error: Planner internal error + def run(self): self.prepareTestEnv() self.test_partition_by_with_interval_fill_prev_new_group_fill_error() From 4e016d85fa42442e8162157d9bf963a31ade0dca Mon Sep 17 00:00:00 2001 From: qevolg <2227465945@qq.com> Date: Thu, 24 Oct 2024 14:21:10 +0800 Subject: [PATCH 229/695] chore(tools): modify the output of taoskeeper and taosadapter on Windows and macOS --- packaging/tools/make_install.bat | 11 +++++++++-- packaging/tools/make_install.sh | 6 ++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/packaging/tools/make_install.bat b/packaging/tools/make_install.bat index 55b55eacde6f..04d342ea06f5 100644 --- a/packaging/tools/make_install.bat +++ b/packaging/tools/make_install.bat @@ -12,8 +12,15 @@ if exist C:\\TDengine\\data\\dnode\\dnodeCfg.json ( rem // stop and delete service mshta vbscript:createobject("shell.application").shellexecute("%~s0",":stop_delete","","runas",1)(window.close) -echo This might take a few moment to accomplish deleting service taosd/taosadapter ... -echo This might take a few moment to accomplish deleting service taosd/taoskeeper ... + +if exist %binary_dir%\\build\\bin\\taosadapter.exe ( + echo This might take a few moment to accomplish deleting service taosd/taosadapter ... +) + +if exist %binary_dir%\\build\\bin\\taoskeeper.exe ( + echo This might take a few moment to accomplish deleting service taosd/taoskeeper ... +) + call :check_svc taosd call :check_svc taosadapter call :check_svc taoskeeper diff --git a/packaging/tools/make_install.sh b/packaging/tools/make_install.sh index b23c675e1042..ec4332a7a0fc 100755 --- a/packaging/tools/make_install.sh +++ b/packaging/tools/make_install.sh @@ -740,8 +740,10 @@ function install_TDengine() { echo -e "${GREEN_DARK}To start Keeper ${NC}: taoskeeper &${NC}" else echo -e "${GREEN_DARK}To start service ${NC}: sudo launchctl start com.tdengine.taosd${NC}" - echo -e "${GREEN_DARK}To start Adapter ${NC}: sudo launchctl start com.tdengine.taosadapter${NC}" - echo -e "${GREEN_DARK}To start Keeper ${NC}: sudo launchctl start com.tdengine.taoskeeper${NC}" + [ -f ${installDir}/bin/taosadapter ] && \ + echo -e "${GREEN_DARK}To start Adapter ${NC}: sudo launchctl start com.tdengine.taosadapter${NC}" + [ -f ${installDir}/bin/taoskeeper ] && \ + echo -e "${GREEN_DARK}To start Keeper ${NC}: sudo launchctl start com.tdengine.taoskeeper${NC}" fi fi From 421ea0def2473d5d878628252d7cb7a408075392 Mon Sep 17 00:00:00 2001 From: Yu Chen <74105241+yu285@users.noreply.github.com> Date: Thu, 24 Oct 2024 14:39:29 +0800 Subject: [PATCH 230/695] docs : 2nd time Update firstEP description in 02-taosc.md --- docs/zh/14-reference/01-components/02-taosc.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/zh/14-reference/01-components/02-taosc.md b/docs/zh/14-reference/01-components/02-taosc.md index 5f22ebe8d55e..3967924951c1 100755 --- a/docs/zh/14-reference/01-components/02-taosc.md +++ b/docs/zh/14-reference/01-components/02-taosc.md @@ -10,7 +10,7 @@ TDengine 客户端驱动提供了应用编程所需要的全部 API,并且在 | 参数名称 | 参数含义 | |:-----------:|:----------------------------------------------------------:| -|firstEp | taos 启动时,主动连接的集群中首个 dnode 的 endpoint,缺省值:${hostname}:6030,若无法获取 ${hostname},则赋值为 localhost | +|firstEp | taos 启动时,主动连接的集群中首个 dnode 的 endpoint,缺省值:hostname:6030,若无法获取该服务器的 hostname,则赋值为 localhost | |secondEp | 启动时,如果 firstEp 连接不上,尝试连接集群中第二个 dnode 的 endpoint,没有缺省值 | |numOfRpcSessions | 一个客户端能创建的最大连接数,取值范围:10-50000000(单位为毫秒);缺省值:500000 | |telemetryReporting | 是否上传 telemetry,0: 不上传,1: 上传;缺省值:1 | From 6db4797eb8e4c1b747e1751e64b2142464a3c396 Mon Sep 17 00:00:00 2001 From: qevolg <2227465945@qq.com> Date: Thu, 24 Oct 2024 14:39:57 +0800 Subject: [PATCH 231/695] chore(tools): modify the output of taoskeeper and taosadapter on macOS --- packaging/tools/make_install.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packaging/tools/make_install.sh b/packaging/tools/make_install.sh index ec4332a7a0fc..1b8fa2fb702f 100755 --- a/packaging/tools/make_install.sh +++ b/packaging/tools/make_install.sh @@ -677,8 +677,10 @@ function update_TDengine() { echo -e "${GREEN_DARK}To start Keeper ${NC}: taoskeeper &${NC}" else echo -e "${GREEN_DARK}To start service ${NC}: sudo launchctl start com.tdengine.taosd${NC}" - echo -e "${GREEN_DARK}To start Adapter ${NC}: sudo launchctl start com.tdengine.taosadapter${NC}" - echo -e "${GREEN_DARK}To start Keeper ${NC}: sudo launchctl start com.tdengine.taoskeeper${NC}" + [ -f ${installDir}/bin/taosadapter ] && \ + echo -e "${GREEN_DARK}To start Adapter ${NC}: sudo launchctl start com.tdengine.taosadapter${NC}" + [ -f ${installDir}/bin/taoskeeper ] && \ + echo -e "${GREEN_DARK}To start Keeper ${NC}: sudo launchctl start com.tdengine.taoskeeper${NC}" fi fi From a37fb974bd23e84492398973611b852381e6b148 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Thu, 24 Oct 2024 14:48:08 +0800 Subject: [PATCH 232/695] minor changes --- docs/zh/14-reference/01-components/02-taosc.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/zh/14-reference/01-components/02-taosc.md b/docs/zh/14-reference/01-components/02-taosc.md index 3967924951c1..d9f36a2df77c 100755 --- a/docs/zh/14-reference/01-components/02-taosc.md +++ b/docs/zh/14-reference/01-components/02-taosc.md @@ -10,7 +10,7 @@ TDengine 客户端驱动提供了应用编程所需要的全部 API,并且在 | 参数名称 | 参数含义 | |:-----------:|:----------------------------------------------------------:| -|firstEp | taos 启动时,主动连接的集群中首个 dnode 的 endpoint,缺省值:hostname:6030,若无法获取该服务器的 hostname,则赋值为 localhost | +|firstEp | taos 启动时,主动连接的集群中首个 dnode 的 endpoint,缺省值:hostname:6030,若无法获取该服务器的 hostname,则赋值为 localhost | |secondEp | 启动时,如果 firstEp 连接不上,尝试连接集群中第二个 dnode 的 endpoint,没有缺省值 | |numOfRpcSessions | 一个客户端能创建的最大连接数,取值范围:10-50000000(单位为毫秒);缺省值:500000 | |telemetryReporting | 是否上传 telemetry,0: 不上传,1: 上传;缺省值:1 | From dc9d6a8a73be2f0d3632cdf5be70ed1a9c07a253 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Thu, 24 Oct 2024 14:59:53 +0800 Subject: [PATCH 233/695] fix issue for _isfilled --- source/libs/executor/src/streamtimesliceoperator.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/libs/executor/src/streamtimesliceoperator.c b/source/libs/executor/src/streamtimesliceoperator.c index 8becadaa1af2..b52961c32dbf 100644 --- a/source/libs/executor/src/streamtimesliceoperator.c +++ b/source/libs/executor/src/streamtimesliceoperator.c @@ -976,7 +976,10 @@ static void setForceWindowCloseFillRule(SStreamFillSupporter* pFillSup, SStreamF } } break; case TSDB_FILL_PREV: { - if (ts >= pFillSup->cur.key) { + if (ts == pFillSup->cur.key) { + pFillInfo->pos = FILL_POS_START; + pFillInfo->needFill = false; + } else if (ts > pFillSup->cur.key) { setFillKeyInfo(ts, ts + 1, &pFillSup->interval, pFillInfo); pFillInfo->pResRow = &pFillSup->cur; } else if (hasPrevWindow(pFillSup)) { From f795e415e5e97b527c2e5f8bfb6755b32425133b Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Thu, 24 Oct 2024 15:01:49 +0800 Subject: [PATCH 234/695] fix: add subplan test --- source/libs/executor/test/queryPlanTests.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/source/libs/executor/test/queryPlanTests.cpp b/source/libs/executor/test/queryPlanTests.cpp index c367391f8ec1..720251fdfd48 100755 --- a/source/libs/executor/test/queryPlanTests.cpp +++ b/source/libs/executor/test/queryPlanTests.cpp @@ -3027,7 +3027,7 @@ void qptExecPlan(SReadHandle* pReadHandle, SNode* pNode, SExecTaskInfo* pTaskInf qptCtx.result.code = createTableScanOperatorInfo((STableScanPhysiNode*)pNode, pReadHandle, NULL, pTaskInfo, ppOperaotr); break; case QUERY_NODE_PHYSICAL_PLAN_TABLE_SEQ_SCAN: - //qptCtx.result.code = createTableSeqScanOperatorInfo((STableScanPhysiNode*)pNode, pReadHandle, NULL, pTaskInfo, ppOperaotr); + qptCtx.result.code = createTableSeqScanOperatorInfo((STableScanPhysiNode*)pNode, pReadHandle, NULL, pTaskInfo, ppOperaotr); break; case QUERY_NODE_PHYSICAL_PLAN_TABLE_MERGE_SCAN: qptCtx.result.code = createTableMergeScanOperatorInfo((STableScanPhysiNode*)pNode, pReadHandle, NULL, pTaskInfo, ppOperaotr); @@ -3075,7 +3075,7 @@ void qptExecPlan(SReadHandle* pReadHandle, SNode* pNode, SExecTaskInfo* pTaskInf qptCtx.result.code = createIntervalOperatorInfo(NULL, (SIntervalPhysiNode*)pNode, pTaskInfo, ppOperaotr); break; case QUERY_NODE_PHYSICAL_PLAN_MERGE_INTERVAL: - //qptCtx.result.code = createMergeIntervalOperatorInfo(NULL, (SMergeIntervalPhysiNode*)pNode, pTaskInfo, ppOperaotr); + qptCtx.result.code = createMergeIntervalOperatorInfo(NULL, (SMergeIntervalPhysiNode*)pNode, pTaskInfo, ppOperaotr); break; case QUERY_NODE_PHYSICAL_PLAN_MERGE_ALIGNED_INTERVAL: qptCtx.result.code = createMergeAlignedIntervalOperatorInfo(NULL, (SMergeAlignedIntervalPhysiNode*)pNode, pTaskInfo, ppOperaotr); @@ -3125,6 +3125,7 @@ void qptExecPlan(SReadHandle* pReadHandle, SNode* pNode, SExecTaskInfo* pTaskInf qptCtx.result.code = createTimeSliceOperatorInfo(NULL, (SPhysiNode*)pNode, pTaskInfo, ppOperaotr); break; case QUERY_NODE_PHYSICAL_PLAN_INSERT: + qptCtx.result.code = 0; break; case QUERY_NODE_PHYSICAL_PLAN_DISPATCH: case QUERY_NODE_PHYSICAL_PLAN_QUERY_INSERT: @@ -3135,6 +3136,9 @@ void qptExecPlan(SReadHandle* pReadHandle, SNode* pNode, SExecTaskInfo* pTaskInf break; } case QUERY_NODE_PHYSICAL_SUBPLAN: { + DataSinkHandle handle = NULL; + qptCtx.result.code = qCreateExecTask(pReadHandle, qptCtx.param.vnode.vgId, pTaskInfo->id.taskId, (SSubplan*)pNode, &pTaskInfo, &handle, + QPT_RAND_BOOL_V ? 0 : 1, taosStrdup("sql string"), OPTR_EXEC_MODEL_BATCH); break; } case QUERY_NODE_PHYSICAL_PLAN: { From eab9f1a5d217f3d499c034cf4e5ed8e7526e4f4c Mon Sep 17 00:00:00 2001 From: qevolg <2227465945@qq.com> Date: Thu, 24 Oct 2024 15:04:54 +0800 Subject: [PATCH 235/695] chore(.github): add taoskeeper github action workflow --- .github/workflows/taoskeeper-ci.yml | 56 +++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 .github/workflows/taoskeeper-ci.yml diff --git a/.github/workflows/taoskeeper-ci.yml b/.github/workflows/taoskeeper-ci.yml new file mode 100644 index 000000000000..a9f48831c1f0 --- /dev/null +++ b/.github/workflows/taoskeeper-ci.yml @@ -0,0 +1,56 @@ +name: taoskeeper CI + +on: + push: + paths: + - "tools/keeper/**" + +jobs: + build: + runs-on: ubuntu-latest + name: Run taoskeeper unit tests + steps: + - name: Checkout the repository + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: 1.18 + + - name: Install system dependencies + run: | + sudo apt update -y + sudo apt install -y build-essential cmake libgeos-dev + + - name: Install TDengine + run: | + cd TDengine + mkdir debug + cd debug + cmake .. -DBUILD_HTTP=false -DBUILD_JDBC=false -DBUILD_TOOLS=false -DBUILD_TEST=off -DBUILD_KEEPER=true + make -j 4 + sudo make install + which taosd + which taosadapter + which taoskeeper + + - name: Start taosd + run: | + cp /etc/taos/taos.cfg ./ + sudo echo "supportVnodes 256" >> taos.cfg + nohup sudo taosd -c taos.cfg & + + - name: Start taosadapter + run: nohup sudo taosadapter & + + - name: Run tests + run: | + go mod tidy + go test -v ./... + + - name: Clean up + if: always() + run: | + sudo pkill taosd + sudo pkill taosadapter From c26ab17f19eabe0e1a951edec7764747ed1523a0 Mon Sep 17 00:00:00 2001 From: Jing Sima Date: Wed, 16 Oct 2024 17:34:32 +0800 Subject: [PATCH 236/695] enh:[TD-32459] Abstract function properties into a struct. --- include/util/taoserror.h | 5 + source/libs/function/inc/builtins.h | 38 + source/libs/function/inc/functionMgtInt.h | 65 + source/libs/function/src/builtins.c | 5523 ++++++++++++-------- source/util/src/terror.c | 5 + tests/army/query/function/test_function.py | 2 +- 6 files changed, 3361 insertions(+), 2277 deletions(-) diff --git a/include/util/taoserror.h b/include/util/taoserror.h index fd8970a50f58..a53923b904be 100644 --- a/include/util/taoserror.h +++ b/include/util/taoserror.h @@ -917,6 +917,11 @@ int32_t taosGetErrSize(); #define TSDB_CODE_FUNC_INVALID_RES_LENGTH TAOS_DEF_ERROR_CODE(0, 0x280E) #define TSDB_CODE_FUNC_HISTOGRAM_ERROR TAOS_DEF_ERROR_CODE(0, 0x280F) #define TSDB_CODE_FUNC_PERCENTILE_ERROR TAOS_DEF_ERROR_CODE(0, 0x2810) +#define TSDB_CODE_FUNC_FUNTION_PARA_RANGE TAOS_DEF_ERROR_CODE(0, 0x2811) +#define TSDB_CODE_FUNC_FUNTION_PARA_PRIMTS TAOS_DEF_ERROR_CODE(0, 0x2812) +#define TSDB_CODE_FUNC_FUNTION_PARA_PK TAOS_DEF_ERROR_CODE(0, 0x2813) +#define TSDB_CODE_FUNC_FUNTION_PARA_HAS_COL TAOS_DEF_ERROR_CODE(0, 0x2814) +#define TSDB_CODE_FUNC_FUNCTION_HISTO_TYPE TAOS_DEF_ERROR_CODE(0, 0x2815) //udf diff --git a/source/libs/function/inc/builtins.h b/source/libs/function/inc/builtins.h index 5707ee76f4e6..c76d32efee95 100644 --- a/source/libs/function/inc/builtins.h +++ b/source/libs/function/inc/builtins.h @@ -22,16 +22,54 @@ extern "C" { #include "functionMgtInt.h" +struct SFunctionParaInfo; + 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, SDataBlockInfo* pBlocInfo); typedef EFuncReturnRows (*FEstimateReturnRows)(SFunctionNode* pFunc); +#define MAX_FUNC_PARA_NUM 16 + +typedef struct SParamRange { + double dMinVal; + double dMaxVal; +} SParamRange; + +typedef struct SParamInfo { + bool isLastParam; + int8_t startParam; + int8_t endParam; + uint64_t validDataType; + uint64_t validNodeType; + bool hasRange; + bool isTs; // used for input parameter + bool isPK; // used for input parameter + bool isFixedValue; // used for input parameter + bool hasColumn; // used for input parameter, parameter must contain columns + bool isFirstLast; // special check for first and last + bool isTimeUnit; // used for input parameter, need check whether time unit is valid + bool isHistogramBin; // used for input parameter, need check whether histogram bin is valid + uint8_t fixedValueSize; + char fixedStrValue[MAX_FUNC_PARA_NUM][16]; // used for input parameter + int32_t fixedNumValue[MAX_FUNC_PARA_NUM]; // used for input parameter + SParamRange range; +} SParamInfo; + +typedef struct SFunctionParaInfo { + int8_t minParamNum; + int8_t maxParamNum; + uint8_t paramInfoPattern; + SParamInfo inputParaInfo[MAX_FUNC_PARA_NUM][MAX_FUNC_PARA_NUM]; + SParamInfo outputParaInfo; +} SFunctionParaInfo; + typedef struct SBuiltinFuncDefinition { const char* name; EFunctionType type; uint64_t classification; + SFunctionParaInfo parameters; FTranslateFunc translateFunc; FFuncDataRequired dataRequiredFunc; FFuncDynDataRequired dynDataRequiredFunc; diff --git a/source/libs/function/inc/functionMgtInt.h b/source/libs/function/inc/functionMgtInt.h index 3112245de9c4..924ec6d40a90 100644 --- a/source/libs/function/inc/functionMgtInt.h +++ b/source/libs/function/inc/functionMgtInt.h @@ -64,6 +64,71 @@ extern "C" { #define FUNC_UDF_ID_START 5000 +#define FUNC_MGT_FUNC_PARAM_SUPPORT_TYPE(n) ((uint64_t)1 << n) +#define FUNC_PARAM_SUPPORT_ALL_TYPE FUNC_MGT_FUNC_PARAM_SUPPORT_TYPE(0) +#define FUNC_PARAM_SUPPORT_NUMERIC_TYPE FUNC_MGT_FUNC_PARAM_SUPPORT_TYPE(1) +#define FUNC_PARAM_SUPPORT_VAR_TYPE FUNC_MGT_FUNC_PARAM_SUPPORT_TYPE(2) +#define FUNC_PARAM_SUPPORT_STRING_TYPE FUNC_MGT_FUNC_PARAM_SUPPORT_TYPE(3) +#define FUNC_PARAM_SUPPORT_BOOL_TYPE FUNC_MGT_FUNC_PARAM_SUPPORT_TYPE(4) +#define FUNC_PARAM_SUPPORT_TINYINT_TYPE FUNC_MGT_FUNC_PARAM_SUPPORT_TYPE(5) +#define FUNC_PARAM_SUPPORT_SMALLINT_TYPE FUNC_MGT_FUNC_PARAM_SUPPORT_TYPE(6) +#define FUNC_PARAM_SUPPORT_INT_TYPE FUNC_MGT_FUNC_PARAM_SUPPORT_TYPE(7) +#define FUNC_PARAM_SUPPORT_BIGINT_TYPE FUNC_MGT_FUNC_PARAM_SUPPORT_TYPE(8) +#define FUNC_PARAM_SUPPORT_FLOAT_TYPE FUNC_MGT_FUNC_PARAM_SUPPORT_TYPE(9) +#define FUNC_PARAM_SUPPORT_DOUBLE_TYPE FUNC_MGT_FUNC_PARAM_SUPPORT_TYPE(10) +#define FUNC_PARAM_SUPPORT_VARCHAR_TYPE FUNC_MGT_FUNC_PARAM_SUPPORT_TYPE(11) +#define FUNC_PARAM_SUPPORT_TIMESTAMP_TYPE FUNC_MGT_FUNC_PARAM_SUPPORT_TYPE(12) +#define FUNC_PARAM_SUPPORT_NCHAR_TYPE FUNC_MGT_FUNC_PARAM_SUPPORT_TYPE(13) +#define FUNC_PARAM_SUPPORT_UTINYINT_TYPE FUNC_MGT_FUNC_PARAM_SUPPORT_TYPE(14) +#define FUNC_PARAM_SUPPORT_USMALLINT_TYPE FUNC_MGT_FUNC_PARAM_SUPPORT_TYPE(15) +#define FUNC_PARAM_SUPPORT_UINT_TYPE FUNC_MGT_FUNC_PARAM_SUPPORT_TYPE(16) +#define FUNC_PARAM_SUPPORT_UBIGINT_TYPE FUNC_MGT_FUNC_PARAM_SUPPORT_TYPE(17) +#define FUNC_PARAM_SUPPORT_JSON_TYPE FUNC_MGT_FUNC_PARAM_SUPPORT_TYPE(18) +#define FUNC_PARAM_SUPPORT_VARB_TYPE FUNC_MGT_FUNC_PARAM_SUPPORT_TYPE(19) +#define FUNC_PARAM_SUPPORT_GEOMETRY_TYPE FUNC_MGT_FUNC_PARAM_SUPPORT_TYPE(20) +#define FUNC_PARAM_SUPPORT_INTEGER_TYPE FUNC_MGT_FUNC_PARAM_SUPPORT_TYPE(21) +#define FUNC_PARAM_SUPPORT_NULL_TYPE FUNC_MGT_FUNC_PARAM_SUPPORT_TYPE(22) +#define FUNC_PARAM_SUPPORT_UNIX_TS_TYPE FUNC_MGT_FUNC_PARAM_SUPPORT_TYPE(23) + + + +#define FUNC_MGT_FUNC_PARAM_SUPPORT_NODE(n) ((uint64_t)1 << n) +#define FUNC_PARAM_SUPPORT_EXPR_NODE FUNC_MGT_FUNC_PARAM_SUPPORT_NODE(0) +#define FUNC_PARAM_SUPPORT_VALUE_NODE FUNC_MGT_FUNC_PARAM_SUPPORT_NODE(1) +#define FUNC_PARAM_SUPPORT_OPERATOR_NODE FUNC_MGT_FUNC_PARAM_SUPPORT_NODE(2) +#define FUNC_PARAM_SUPPORT_FUNCTION_NODE FUNC_MGT_FUNC_PARAM_SUPPORT_NODE(3) +#define FUNC_PARAM_SUPPORT_LOGIC_CONDITION_NODE FUNC_MGT_FUNC_PARAM_SUPPORT_NODE(4) +#define FUNC_PARAM_SUPPORT_CASE_WHEN_NODE FUNC_MGT_FUNC_PARAM_SUPPORT_NODE(5) +#define FUNC_PARAM_SUPPORT_COLUMN_NODE FUNC_MGT_FUNC_PARAM_SUPPORT_NODE(6) +#define FUNC_PARAM_SUPPORT_NOT_VALUE_NODE FUNC_MGT_FUNC_PARAM_SUPPORT_NODE(7) + +#define FUNC_PARAM_SUPPORT_NODE_MAX 7 + +#define FUNC_ERR_RET(c) \ + do { \ + int32_t _code = c; \ + if (_code != TSDB_CODE_SUCCESS) { \ + terrno = _code; \ + return _code; \ + } \ + } while (0) +#define FUNC_RET(c) \ + do { \ + int32_t _code = c; \ + if (_code != TSDB_CODE_SUCCESS) { \ + terrno = _code; \ + } \ + return _code; \ + } while (0) +#define FUNC_ERR_JRET(c) \ + do { \ + code = c; \ + if (code != TSDB_CODE_SUCCESS) { \ + terrno = code; \ + goto _return; \ + } \ + } while (0) + #ifdef __cplusplus } #endif diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c index 1fd99125a038..276c77f567c8 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -90,28 +90,6 @@ static bool validateMinuteRange(int8_t hour, int8_t minute, char sign) { return false; } -static bool validateTimestampDigits(const SValueNode* pVal) { - if (!IS_INTEGER_TYPE(pVal->node.resType.type)) { - return false; - } - - int64_t tsVal = pVal->datum.i; - char fraction[20] = {0}; - NUM_TO_STRING(pVal->node.resType.type, &tsVal, sizeof(fraction), fraction); - int32_t tsDigits = (int32_t)strlen(fraction); - - if (tsDigits > TSDB_TIME_PRECISION_SEC_DIGITS) { - if (tsDigits == TSDB_TIME_PRECISION_MILLI_DIGITS || tsDigits == TSDB_TIME_PRECISION_MICRO_DIGITS || - tsDigits == TSDB_TIME_PRECISION_NANO_DIGITS) { - return true; - } else { - return false; - } - } - - return true; -} - static bool validateTimezoneFormat(const SValueNode* pVal) { if (TSDB_DATA_TYPE_BINARY != pVal->node.resType.type) { return false; @@ -298,937 +276,286 @@ static SDataType* getSDataTypeFromNode(SNode* pNode) { } } -// There is only one parameter of numeric type, and the return type is parameter type -static int32_t translateInOutNum(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - if (1 != LIST_LENGTH(pFunc->pParameterList)) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } - - uint8_t paraType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type; - if (!IS_NUMERIC_TYPE(paraType) && !IS_NULL_TYPE(paraType)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } else if (IS_NULL_TYPE(paraType)) { - paraType = TSDB_DATA_TYPE_BIGINT; - } - - pFunc->node.resType = (SDataType){.bytes = tDataTypes[paraType].bytes, .type = paraType}; - return TSDB_CODE_SUCCESS; +static bool paramSupportNull(uint64_t typeFlag) { + return FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_NULL_TYPE) || + FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_ALL_TYPE); } -// There is only one parameter of numeric type, and the return type is parameter type -static int32_t translateMinMax(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - if (1 != LIST_LENGTH(pFunc->pParameterList)) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } - - SDataType* dataType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0)); - uint8_t paraType = dataType->type; - if (!IS_NUMERIC_TYPE(paraType) && !IS_NULL_TYPE(paraType) && !IS_STR_DATA_TYPE(paraType)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } else if (IS_NULL_TYPE(paraType)) { - paraType = TSDB_DATA_TYPE_BIGINT; - } - int32_t bytes = IS_STR_DATA_TYPE(paraType) ? dataType->bytes : tDataTypes[paraType].bytes; - pFunc->node.resType = (SDataType){.bytes = bytes, .type = paraType}; - return TSDB_CODE_SUCCESS; +static bool paramSupportBool(uint64_t typeFlag) { + return FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_BOOL_TYPE) || + FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_ALL_TYPE); } -// There is only one parameter of numeric type, and the return type is double type -static int32_t translateInNumOutDou(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - if (1 != LIST_LENGTH(pFunc->pParameterList)) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } - - uint8_t paraType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type; - if (!IS_NUMERIC_TYPE(paraType) && !IS_NULL_TYPE(paraType)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - - pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_DOUBLE].bytes, .type = TSDB_DATA_TYPE_DOUBLE}; - return TSDB_CODE_SUCCESS; +static bool paramSupportTinyint(uint64_t typeFlag) { + return FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_TINYINT_TYPE) || + FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_ALL_TYPE) || + FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_NUMERIC_TYPE) || + FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_INTEGER_TYPE) || + FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_UNIX_TS_TYPE); } -// There are two parameters of numeric type, and the return type is double type -static int32_t translateIn2NumOutDou(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - if (2 != LIST_LENGTH(pFunc->pParameterList)) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } - - uint8_t para1Type = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type; - uint8_t para2Type = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 1))->type; - if ((!IS_NUMERIC_TYPE(para1Type) && !IS_NULL_TYPE(para1Type)) || - (!IS_NUMERIC_TYPE(para2Type) && !IS_NULL_TYPE(para2Type))) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - - pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_DOUBLE].bytes, .type = TSDB_DATA_TYPE_DOUBLE}; - return TSDB_CODE_SUCCESS; +static bool paramSupportSmallint(uint64_t typeFlag) { + return FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_SMALLINT_TYPE) || + FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_ALL_TYPE) || + FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_NUMERIC_TYPE) || + FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_INTEGER_TYPE) || + FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_UNIX_TS_TYPE); } -// There is only one parameter of string type, and the return type is parameter type -static int32_t translateInOutStr(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - if (1 != LIST_LENGTH(pFunc->pParameterList)) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } - - SDataType* pRestType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0)); - if (TSDB_DATA_TYPE_VARBINARY == pRestType->type || !IS_STR_DATA_TYPE(pRestType->type)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - - pFunc->node.resType = (SDataType){.bytes = pRestType->bytes, .type = pRestType->type}; - return TSDB_CODE_SUCCESS; +static bool paramSupportInt(uint64_t typeFlag) { + return FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_INT_TYPE) || + FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_ALL_TYPE) || + FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_NUMERIC_TYPE) || + FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_INTEGER_TYPE) || + FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_UNIX_TS_TYPE); } -static int32_t translateTrimStr(SFunctionNode* pFunc, char* pErrBuf, int32_t len, bool isLtrim) { - if (1 != LIST_LENGTH(pFunc->pParameterList)) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } - - SDataType* pRestType1 = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0)); - if (TSDB_DATA_TYPE_VARBINARY == pRestType1->type || !IS_STR_DATA_TYPE(pRestType1->type)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - - int32_t numOfSpaces = 0; - SNode* pParamNode1 = nodesListGetNode(pFunc->pParameterList, 0); - // for select trim functions with constant value from table, - // need to set the proper result result schema bytes to avoid - // trailing garbage characters - if (nodeType(pParamNode1) == QUERY_NODE_VALUE) { - SValueNode* pValue = (SValueNode*)pParamNode1; - numOfSpaces = countTrailingSpaces(pValue, isLtrim); - } - - int32_t resBytes = pRestType1->bytes - numOfSpaces; - pFunc->node.resType = (SDataType){.bytes = resBytes, .type = pRestType1->type}; - return TSDB_CODE_SUCCESS; +static bool paramSupportBigint(uint64_t typeFlag) { + return FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_BIGINT_TYPE) || + FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_ALL_TYPE) || + FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_NUMERIC_TYPE) || + FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_INTEGER_TYPE) || + FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_UNIX_TS_TYPE); } -static int32_t translateLtrim(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - return translateTrimStr(pFunc, pErrBuf, len, true); +static bool paramSupportFloat(uint64_t typeFlag) { + return FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_FLOAT_TYPE) || + FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_ALL_TYPE) || + FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_NUMERIC_TYPE); } -static int32_t translateRtrim(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - return translateTrimStr(pFunc, pErrBuf, len, false); +static bool paramSupportDouble(uint64_t typeFlag) { + return FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_DOUBLE_TYPE) || + FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_ALL_TYPE) || + FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_NUMERIC_TYPE); } -static int32_t translateLogarithm(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - int32_t numOfParams = LIST_LENGTH(pFunc->pParameterList); - if (1 != numOfParams && 2 != numOfParams) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } - - uint8_t para1Type = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type; - if (!IS_NUMERIC_TYPE(para1Type) && !IS_NULL_TYPE(para1Type)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - - if (2 == numOfParams) { - uint8_t para2Type = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 1))->type; - if (!IS_NUMERIC_TYPE(para2Type) && !IS_NULL_TYPE(para2Type)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - } - - pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_DOUBLE].bytes, .type = TSDB_DATA_TYPE_DOUBLE}; - return TSDB_CODE_SUCCESS; +static bool paramSupportVarchar(uint64_t typeFlag) { + return FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_VARCHAR_TYPE) || + FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_ALL_TYPE) || + FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_STRING_TYPE) || + FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_VAR_TYPE) || + FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_UNIX_TS_TYPE); } -static int32_t translateCount(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - if (1 != LIST_LENGTH(pFunc->pParameterList)) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } - pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_BIGINT].bytes, .type = TSDB_DATA_TYPE_BIGINT}; - return TSDB_CODE_SUCCESS; +static bool paramSupportTimestamp(uint64_t typeFlag) { + return FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_TIMESTAMP_TYPE) || + FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_ALL_TYPE) || + FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_UNIX_TS_TYPE); } -static int32_t translateSum(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - if (1 != LIST_LENGTH(pFunc->pParameterList)) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } - - uint8_t paraType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type; - if (!IS_NUMERIC_TYPE(paraType) && !IS_NULL_TYPE(paraType)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - - uint8_t resType = 0; - if (IS_SIGNED_NUMERIC_TYPE(paraType) || TSDB_DATA_TYPE_BOOL == paraType || IS_NULL_TYPE(paraType)) { - resType = TSDB_DATA_TYPE_BIGINT; - } else if (IS_UNSIGNED_NUMERIC_TYPE(paraType)) { - resType = TSDB_DATA_TYPE_UBIGINT; - } else if (IS_FLOAT_TYPE(paraType)) { - resType = TSDB_DATA_TYPE_DOUBLE; - } - - pFunc->node.resType = (SDataType){.bytes = tDataTypes[resType].bytes, .type = resType}; - return TSDB_CODE_SUCCESS; +static bool paramSupportNchar(uint64_t typeFlag) { + return FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_NCHAR_TYPE) || + FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_ALL_TYPE) || + FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_STRING_TYPE) || + FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_VAR_TYPE) || + FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_UNIX_TS_TYPE); } -static int32_t translateAvgPartial(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - if (1 != LIST_LENGTH(pFunc->pParameterList)) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } - - uint8_t paraType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type; - if (!IS_NUMERIC_TYPE(paraType) && !IS_NULL_TYPE(paraType)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - - pFunc->node.resType = (SDataType){.bytes = getAvgInfoSize() + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}; - return TSDB_CODE_SUCCESS; +static bool paramSupportUTinyInt(uint64_t typeFlag) { + return FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_UTINYINT_TYPE) || + FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_ALL_TYPE) || + FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_NUMERIC_TYPE) || + FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_INTEGER_TYPE) || + FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_UNIX_TS_TYPE); } -static int32_t translateAvgMiddle(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - if (1 != LIST_LENGTH(pFunc->pParameterList)) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } - - uint8_t paraType = ((SExprNode*)nodesListGetNode(pFunc->pParameterList, 0))->resType.type; - if (TSDB_DATA_TYPE_BINARY != paraType) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - - pFunc->node.resType = (SDataType){.bytes = getAvgInfoSize() + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}; - return TSDB_CODE_SUCCESS; +static bool paramSupportUSmallInt(uint64_t typeFlag) { + return FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_USMALLINT_TYPE) || + FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_ALL_TYPE) || + FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_NUMERIC_TYPE) || + FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_INTEGER_TYPE) || + FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_UNIX_TS_TYPE); } -static int32_t translateAvgMerge(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - if (1 != LIST_LENGTH(pFunc->pParameterList)) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } - - uint8_t paraType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type; - if (TSDB_DATA_TYPE_BINARY != paraType) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } +static bool paramSupportUInt(uint64_t typeFlag) { + return FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_UINT_TYPE) || + FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_ALL_TYPE) || + FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_NUMERIC_TYPE) || + FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_INTEGER_TYPE) || + FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_UNIX_TS_TYPE); +} - pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_DOUBLE].bytes, .type = TSDB_DATA_TYPE_DOUBLE}; +static bool paramSupportUBigInt(uint64_t typeFlag) { + return FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_UBIGINT_TYPE) || + FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_ALL_TYPE) || + FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_NUMERIC_TYPE) || + FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_INTEGER_TYPE) || + FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_UNIX_TS_TYPE); +} - return TSDB_CODE_SUCCESS; +static bool paramSupportJSON(uint64_t typeFlag) { + return FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_JSON_TYPE) || + FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_ALL_TYPE) || + FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_VAR_TYPE); } -static int32_t translateAvgState(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - if (1 != LIST_LENGTH(pFunc->pParameterList)) return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); +static bool paramSupportVarBinary(uint64_t typeFlag) { + return FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_VARB_TYPE) || + FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_ALL_TYPE) || + FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_VAR_TYPE) || + FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_STRING_TYPE); +} - uint8_t paraType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type; - if (!IS_NUMERIC_TYPE(paraType) && !IS_NULL_TYPE(paraType)) - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); +static bool paramSupportGeometry(uint64_t typeFlag) { + return FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_GEOMETRY_TYPE) || + FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_ALL_TYPE) || + FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_VAR_TYPE); +} - pFunc->node.resType = (SDataType){.bytes = getAvgInfoSize() + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}; - return TSDB_CODE_SUCCESS; +static bool paramSupportValueNode(uint64_t typeFlag) { + return FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_VALUE_NODE) || + FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_EXPR_NODE); } -static int32_t translateAvgStateMerge(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - if (1 != LIST_LENGTH(pFunc->pParameterList)) return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); +static bool paramSupportOperatorNode(uint64_t typeFlag) { + return FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_EXPR_NODE) || + FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_OPERATOR_NODE) || + FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_NOT_VALUE_NODE); +} - pFunc->node.resType = (SDataType){.bytes = getAvgInfoSize() + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}; - return TSDB_CODE_SUCCESS; +static bool paramSupportFunctionNode(uint64_t typeFlag) { + return FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_EXPR_NODE) || + FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_FUNCTION_NODE) || + FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_NOT_VALUE_NODE); } -static int32_t translateStdPartial(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - if (1 != LIST_LENGTH(pFunc->pParameterList)) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } +static bool paramSupportLogicConNode(uint64_t typeFlag) { + return FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_EXPR_NODE) || + FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_LOGIC_CONDITION_NODE) || + FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_NOT_VALUE_NODE); +} - uint8_t paraType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type; - if (!IS_NUMERIC_TYPE(paraType) && !IS_NULL_TYPE(paraType)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } +static bool paramSupportCaseWhenNode(uint64_t typeFlag) { + return FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_EXPR_NODE) || + FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_CASE_WHEN_NODE) || + FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_NOT_VALUE_NODE); +} - pFunc->node.resType = (SDataType){.bytes = getStdInfoSize() + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}; - return TSDB_CODE_SUCCESS; +static bool paramSupportColumnNode(uint64_t typeFlag) { + return FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_EXPR_NODE) || + FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_COLUMN_NODE) || + FUNC_MGT_TEST_MASK(typeFlag, FUNC_PARAM_SUPPORT_NOT_VALUE_NODE); } -static int32_t translateStdMerge(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - if (1 != LIST_LENGTH(pFunc->pParameterList)) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); +static bool paramSupportNodeType(SNode* pNode, uint64_t typeFlag) { + switch (pNode->type) { + case QUERY_NODE_VALUE: + return paramSupportValueNode(typeFlag); + case QUERY_NODE_OPERATOR: + return paramSupportOperatorNode(typeFlag); + case QUERY_NODE_FUNCTION: + return paramSupportFunctionNode(typeFlag); + case QUERY_NODE_LOGIC_CONDITION: + return paramSupportLogicConNode(typeFlag); + case QUERY_NODE_CASE_WHEN: + return paramSupportCaseWhenNode(typeFlag); + case QUERY_NODE_COLUMN: + return paramSupportColumnNode(typeFlag); + default: + return false; } +} - uint8_t paraType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type; - if (TSDB_DATA_TYPE_BINARY != paraType) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); +static bool paramSupportDataType(SDataType* pDataType, uint64_t typeFlag) { + switch (pDataType->type) { + case TSDB_DATA_TYPE_NULL: + return paramSupportNull(typeFlag); + case TSDB_DATA_TYPE_BOOL: + return paramSupportBool(typeFlag); + case TSDB_DATA_TYPE_TINYINT: + return paramSupportTinyint(typeFlag); + case TSDB_DATA_TYPE_SMALLINT: + return paramSupportSmallint(typeFlag); + case TSDB_DATA_TYPE_INT: + return paramSupportInt(typeFlag); + case TSDB_DATA_TYPE_BIGINT: + return paramSupportBigint(typeFlag); + case TSDB_DATA_TYPE_FLOAT: + return paramSupportFloat(typeFlag); + case TSDB_DATA_TYPE_DOUBLE: + return paramSupportDouble(typeFlag); + case TSDB_DATA_TYPE_VARCHAR: + return paramSupportVarchar(typeFlag); + case TSDB_DATA_TYPE_TIMESTAMP: + return paramSupportTimestamp(typeFlag); + case TSDB_DATA_TYPE_NCHAR: + return paramSupportNchar(typeFlag); + case TSDB_DATA_TYPE_UTINYINT: + return paramSupportUTinyInt(typeFlag); + case TSDB_DATA_TYPE_USMALLINT: + return paramSupportUSmallInt(typeFlag); + case TSDB_DATA_TYPE_UINT: + return paramSupportUInt(typeFlag); + case TSDB_DATA_TYPE_UBIGINT: + return paramSupportUBigInt(typeFlag); + case TSDB_DATA_TYPE_JSON: + return paramSupportJSON(typeFlag); + case TSDB_DATA_TYPE_VARBINARY: + return paramSupportVarBinary(typeFlag); + case TSDB_DATA_TYPE_GEOMETRY: + return paramSupportGeometry(typeFlag); + default: + return false; } - - pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_DOUBLE].bytes, .type = TSDB_DATA_TYPE_DOUBLE}; - - return TSDB_CODE_SUCCESS; } -static int32_t translateStdState(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - if (1 != LIST_LENGTH(pFunc->pParameterList)) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } +typedef enum { UNKNOWN_BIN = 0, USER_INPUT_BIN, LINEAR_BIN, LOG_BIN } EHistoBinType; - uint8_t paraType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type; - if (!IS_NUMERIC_TYPE(paraType) && !IS_NULL_TYPE(paraType)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); +static int8_t validateHistogramBinType(char* binTypeStr) { + int8_t binType; + if (strcasecmp(binTypeStr, "user_input") == 0) { + binType = USER_INPUT_BIN; + } else if (strcasecmp(binTypeStr, "linear_bin") == 0) { + binType = LINEAR_BIN; + } else if (strcasecmp(binTypeStr, "log_bin") == 0) { + binType = LOG_BIN; + } else { + binType = UNKNOWN_BIN; } - pFunc->node.resType = (SDataType){.bytes = getStdInfoSize() + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}; - return TSDB_CODE_SUCCESS; + return binType; } -static int32_t translateStdStateMerge(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - if (1 != LIST_LENGTH(pFunc->pParameterList)) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } - - uint8_t paraType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type; - if (TSDB_DATA_TYPE_BINARY != paraType) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } +static int32_t validateHistogramBinDesc(char* binDescStr, int8_t binType, char* errMsg, int32_t msgLen) { + const char* msg1 = "HISTOGRAM function requires four parameters"; + const char* msg3 = "HISTOGRAM function invalid format for binDesc parameter"; + const char* msg4 = "HISTOGRAM function binDesc parameter \"count\" should be in range [1, 1000]"; + const char* msg5 = "HISTOGRAM function bin/parameter should be in range [-DBL_MAX, DBL_MAX]"; + const char* msg6 = "HISTOGRAM function binDesc parameter \"width\" cannot be 0"; + const char* msg7 = "HISTOGRAM function binDesc parameter \"start\" cannot be 0 with \"log_bin\" type"; + const char* msg8 = "HISTOGRAM function binDesc parameter \"factor\" cannot be negative or equal to 0/1"; + const char* msg9 = "HISTOGRAM function out of memory"; - pFunc->node.resType = (SDataType){.bytes = getStdInfoSize() + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}; + cJSON* binDesc = cJSON_Parse(binDescStr); + int32_t numOfBins; + double* intervals; + if (cJSON_IsObject(binDesc)) { /* linaer/log bins */ + int32_t numOfParams = cJSON_GetArraySize(binDesc); + int32_t startIndex; + if (numOfParams != 4) { + (void)snprintf(errMsg, msgLen, "%s", msg1); + cJSON_Delete(binDesc); + return TSDB_CODE_FAILED; + } - return TSDB_CODE_SUCCESS; -} + cJSON* start = cJSON_GetObjectItem(binDesc, "start"); + cJSON* factor = cJSON_GetObjectItem(binDesc, "factor"); + cJSON* width = cJSON_GetObjectItem(binDesc, "width"); + cJSON* count = cJSON_GetObjectItem(binDesc, "count"); + cJSON* infinity = cJSON_GetObjectItem(binDesc, "infinity"); -static int32_t translateWduration(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - // pseudo column do not need to check parameters - pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_BIGINT].bytes, .type = TSDB_DATA_TYPE_BIGINT, - .precision = pFunc->node.resType.precision}; - return TSDB_CODE_SUCCESS; -} + if (!cJSON_IsNumber(start) || !cJSON_IsNumber(count) || !cJSON_IsBool(infinity)) { + (void)snprintf(errMsg, msgLen, "%s", msg3); + cJSON_Delete(binDesc); + return TSDB_CODE_FAILED; + } -static int32_t translateNowToday(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - // pseudo column do not need to check parameters - - // add database precision as param - uint8_t dbPrec = pFunc->node.resType.precision; - int32_t code = addUint8Param(&pFunc->pParameterList, dbPrec); - if (code != TSDB_CODE_SUCCESS) { - return code; - } - - pFunc->node.resType = - (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_TIMESTAMP].bytes, .type = TSDB_DATA_TYPE_TIMESTAMP}; - return TSDB_CODE_SUCCESS; -} - -static int32_t translatePi(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - pFunc->node.resType = - (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_DOUBLE].bytes, .type = TSDB_DATA_TYPE_DOUBLE}; - return TSDB_CODE_SUCCESS; -} - -static int32_t translateRand(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - if (0 != LIST_LENGTH(pFunc->pParameterList) && 1 != LIST_LENGTH(pFunc->pParameterList)) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } - - if (1 == LIST_LENGTH(pFunc->pParameterList)) { - uint8_t paraType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type; - if (!IS_INTEGER_TYPE(paraType) && !IS_NULL_TYPE(paraType)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - } - - if (!pFunc->dual) { - int32_t code = addPseudoParam(&pFunc->pParameterList); - if (code != TSDB_CODE_SUCCESS) { - return code; - } - } - - pFunc->node.resType = - (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_DOUBLE].bytes, .type = TSDB_DATA_TYPE_DOUBLE}; - return TSDB_CODE_SUCCESS; -} - -static int32_t translateRound(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - if (2 != LIST_LENGTH(pFunc->pParameterList) && 1 != LIST_LENGTH(pFunc->pParameterList)) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } - - uint8_t paraType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type; - if (!IS_NUMERIC_TYPE(paraType) && !IS_NULL_TYPE(paraType)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } else if (IS_NULL_TYPE(paraType)) { - paraType = TSDB_DATA_TYPE_BIGINT; - } - - if (2 == LIST_LENGTH(pFunc->pParameterList)) { - uint8_t paraType2 = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 1))->type; - if (!IS_NUMERIC_TYPE(paraType2) && !IS_NULL_TYPE(paraType2)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - } - pFunc->node.resType = (SDataType){.bytes = tDataTypes[paraType].bytes, .type = paraType}; - return TSDB_CODE_SUCCESS; -} - -static int32_t translateTrunc(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - if (2 != LIST_LENGTH(pFunc->pParameterList)) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } - - uint8_t paraType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type; - if (!IS_NUMERIC_TYPE(paraType) && !IS_NULL_TYPE(paraType)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - - uint8_t paraType2 = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 1))->type; - if (!IS_NUMERIC_TYPE(paraType2) && !IS_NULL_TYPE(paraType2)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - - pFunc->node.resType = (SDataType){.bytes = tDataTypes[paraType].bytes, .type = paraType}; - return TSDB_CODE_SUCCESS; -} - -static int32_t translateTimePseudoColumn(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - // pseudo column do not need to check parameters - - pFunc->node.resType = - (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_TIMESTAMP].bytes, .type = TSDB_DATA_TYPE_TIMESTAMP, - .precision = pFunc->node.resType.precision}; - return TSDB_CODE_SUCCESS; -} - -static int32_t translateIsFilledPseudoColumn(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - // pseudo column do not need to check parameters - - pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_BOOL].bytes, .type = TSDB_DATA_TYPE_BOOL}; - return TSDB_CODE_SUCCESS; -} - -static int32_t translateTimezone(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - pFunc->node.resType = (SDataType){.bytes = TD_TIMEZONE_LEN, .type = TSDB_DATA_TYPE_BINARY}; - return TSDB_CODE_SUCCESS; -} - -static int32_t translatePercentile(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - int32_t numOfParams = LIST_LENGTH(pFunc->pParameterList); - if (numOfParams < 2 || numOfParams > 11) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } - - uint8_t para1Type = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type; - if (!IS_NUMERIC_TYPE(para1Type)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - - for (int32_t i = 1; i < numOfParams; ++i) { - SValueNode* pValue = (SValueNode*)nodesListGetNode(pFunc->pParameterList, i); - if (QUERY_NODE_VALUE != nodeType(pValue)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - pValue->notReserved = true; - - uint8_t paraType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, i))->type; - if (!IS_NUMERIC_TYPE(paraType)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - - double v = 0; - if (IS_INTEGER_TYPE(paraType)) { - v = (double)pValue->datum.i; - } else { - v = pValue->datum.d; - } - - if (v < 0 || v > 100) { - return invaildFuncParaValueErrMsg(pErrBuf, len, pFunc->functionName); - } - } - - // set result type - if (numOfParams > 2) { - pFunc->node.resType = (SDataType){.bytes = 3200, .type = TSDB_DATA_TYPE_VARCHAR}; - } else { - pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_DOUBLE].bytes, .type = TSDB_DATA_TYPE_DOUBLE}; - } - return TSDB_CODE_SUCCESS; -} - -static bool validateApercentileAlgo(const SValueNode* pVal) { - if (TSDB_DATA_TYPE_BINARY != pVal->node.resType.type) { - return false; - } - return (0 == strcasecmp(varDataVal(pVal->datum.p), "default") || - 0 == strcasecmp(varDataVal(pVal->datum.p), "t-digest")); -} - -static int32_t translateApercentile(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - int32_t numOfParams = LIST_LENGTH(pFunc->pParameterList); - if (2 != numOfParams && 3 != numOfParams) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } - - // param1 - SNode* pParamNode1 = nodesListGetNode(pFunc->pParameterList, 1); - if (nodeType(pParamNode1) != QUERY_NODE_VALUE) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - - SValueNode* pValue = (SValueNode*)pParamNode1; - if (pValue->datum.i < 0 || pValue->datum.i > 100) { - return invaildFuncParaValueErrMsg(pErrBuf, len, pFunc->functionName); - } - - pValue->notReserved = true; - - uint8_t para1Type = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type; - uint8_t para2Type = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 1))->type; - if (!IS_NUMERIC_TYPE(para1Type) || !IS_INTEGER_TYPE(para2Type)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - - // param2 - if (3 == numOfParams) { - uint8_t para3Type = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 2))->type; - if (!IS_STR_DATA_TYPE(para3Type)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - - SNode* pParamNode2 = nodesListGetNode(pFunc->pParameterList, 2); - if (QUERY_NODE_VALUE != nodeType(pParamNode2) || !validateApercentileAlgo((SValueNode*)pParamNode2)) { - return buildFuncErrMsg(pErrBuf, len, TSDB_CODE_FUNC_FUNTION_ERROR, - "Third parameter algorithm of apercentile must be 'default' or 't-digest'"); - } - - pValue = (SValueNode*)pParamNode2; - pValue->notReserved = true; - } - - pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_DOUBLE].bytes, .type = TSDB_DATA_TYPE_DOUBLE}; - return TSDB_CODE_SUCCESS; -} - -static int32_t translateApercentileImpl(SFunctionNode* pFunc, char* pErrBuf, int32_t len, bool isPartial) { - int32_t numOfParams = LIST_LENGTH(pFunc->pParameterList); - - if (isPartial) { - if (2 != numOfParams && 3 != numOfParams) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } - // param1 - SNode* pParamNode1 = nodesListGetNode(pFunc->pParameterList, 1); - if (nodeType(pParamNode1) != QUERY_NODE_VALUE) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - - SValueNode* pValue = (SValueNode*)pParamNode1; - if (pValue->datum.i < 0 || pValue->datum.i > 100) { - return invaildFuncParaValueErrMsg(pErrBuf, len, pFunc->functionName); - } - - pValue->notReserved = true; - - uint8_t para1Type = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type; - uint8_t para2Type = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 1))->type; - if (!IS_NUMERIC_TYPE(para1Type) || !IS_INTEGER_TYPE(para2Type)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - - // param2 - if (3 == numOfParams) { - uint8_t para3Type = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 2))->type; - if (!IS_STR_DATA_TYPE(para3Type)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - - SNode* pParamNode2 = nodesListGetNode(pFunc->pParameterList, 2); - if (QUERY_NODE_VALUE != nodeType(pParamNode2) || !validateApercentileAlgo((SValueNode*)pParamNode2)) { - return buildFuncErrMsg(pErrBuf, len, TSDB_CODE_FUNC_FUNTION_ERROR, - "Third parameter algorithm of apercentile must be 'default' or 't-digest'"); - } - - pValue = (SValueNode*)pParamNode2; - pValue->notReserved = true; - } - - pFunc->node.resType = - (SDataType){.bytes = getApercentileMaxSize() + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}; - } else { - // original percent param is reserved - if (3 != numOfParams && 2 != numOfParams) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } - uint8_t para1Type = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type; - uint8_t para2Type = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 1))->type; - if (TSDB_DATA_TYPE_BINARY != para1Type || !IS_INTEGER_TYPE(para2Type)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - - if (3 == numOfParams) { - uint8_t para3Type = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 2))->type; - if (!IS_STR_DATA_TYPE(para3Type)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - - SNode* pParamNode2 = nodesListGetNode(pFunc->pParameterList, 2); - if (QUERY_NODE_VALUE != nodeType(pParamNode2) || !validateApercentileAlgo((SValueNode*)pParamNode2)) { - return buildFuncErrMsg(pErrBuf, len, TSDB_CODE_FUNC_FUNTION_ERROR, - "Third parameter algorithm of apercentile must be 'default' or 't-digest'"); - } - } - - pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_DOUBLE].bytes, .type = TSDB_DATA_TYPE_DOUBLE}; - } - - return TSDB_CODE_SUCCESS; -} - -static int32_t translateApercentilePartial(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - return translateApercentileImpl(pFunc, pErrBuf, len, true); -} - -static int32_t translateApercentileMerge(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - return translateApercentileImpl(pFunc, pErrBuf, len, false); -} - -static int32_t translateTbnameColumn(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - // pseudo column do not need to check parameters - pFunc->node.resType = - (SDataType){.bytes = TSDB_TABLE_FNAME_LEN - 1 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}; - return TSDB_CODE_SUCCESS; -} - -static int32_t translateTbUidColumn(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - // pseudo column do not need to check parameters - pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_BIGINT].bytes, .type = TSDB_DATA_TYPE_BIGINT}; - return TSDB_CODE_SUCCESS; -} - -static int32_t translateVgIdColumn(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - // pseudo column do not need to check parameters - pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_INT].bytes, .type = TSDB_DATA_TYPE_INT}; - return TSDB_CODE_SUCCESS; -} - -static int32_t translateVgVerColumn(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_BIGINT].bytes, .type = TSDB_DATA_TYPE_BIGINT}; - return TSDB_CODE_SUCCESS; -} - -static int32_t translateTopBot(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - int32_t numOfParams = LIST_LENGTH(pFunc->pParameterList); - if (2 != numOfParams) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } - - uint8_t para1Type = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type; - uint8_t para2Type = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 1))->type; - if (!IS_NUMERIC_TYPE(para1Type) || !IS_INTEGER_TYPE(para2Type)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - - // param1 - SNode* pParamNode1 = nodesListGetNode(pFunc->pParameterList, 1); - if (nodeType(pParamNode1) != QUERY_NODE_VALUE) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - - SValueNode* pValue = (SValueNode*)pParamNode1; - if (!IS_INTEGER_TYPE(pValue->node.resType.type)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - - if (pValue->datum.i < 1 || pValue->datum.i > TOP_BOTTOM_QUERY_LIMIT) { - return invaildFuncParaValueErrMsg(pErrBuf, len, pFunc->functionName); - } - - pValue->notReserved = true; - - // set result type - SDataType* pType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0)); - pFunc->node.resType = (SDataType){.bytes = pType->bytes, .type = pType->type}; - return TSDB_CODE_SUCCESS; -} - -static int32_t reserveFirstMergeParam(SNodeList* pRawParameters, SNode* pPartialRes, SNodeList** pParameters) { - int32_t code = nodesListMakeAppend(pParameters, pPartialRes); - if (TSDB_CODE_SUCCESS == code) { - SNode* pNew = NULL; - code = nodesCloneNode(nodesListGetNode(pRawParameters, 1), &pNew); - if (TSDB_CODE_SUCCESS == code) { - code = nodesListStrictAppend(*pParameters, pNew); - } - } - return code; -} - -int32_t topBotCreateMergeParam(SNodeList* pRawParameters, SNode* pPartialRes, SNodeList** pParameters) { - return reserveFirstMergeParam(pRawParameters, pPartialRes, pParameters); -} - -int32_t apercentileCreateMergeParam(SNodeList* pRawParameters, SNode* pPartialRes, SNodeList** pParameters) { - int32_t code = reserveFirstMergeParam(pRawParameters, pPartialRes, pParameters); - if (TSDB_CODE_SUCCESS == code && pRawParameters->length >= 3) { - SNode* pNew = NULL; - code = nodesCloneNode(nodesListGetNode(pRawParameters, 2), &pNew); - if (TSDB_CODE_SUCCESS == code) { - code = nodesListStrictAppend(*pParameters, pNew); - } - } - return code; -} - -static int32_t translateSpread(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - if (1 != LIST_LENGTH(pFunc->pParameterList)) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } - - uint8_t paraType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type; - if (!IS_NUMERIC_TYPE(paraType) && !IS_TIMESTAMP_TYPE(paraType)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - - pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_DOUBLE].bytes, .type = TSDB_DATA_TYPE_DOUBLE}; - return TSDB_CODE_SUCCESS; -} - -static int32_t translateSpreadImpl(SFunctionNode* pFunc, char* pErrBuf, int32_t len, bool isPartial) { - if (1 != LIST_LENGTH(pFunc->pParameterList)) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } - - uint8_t paraType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type; - if (isPartial) { - if (!IS_NUMERIC_TYPE(paraType) && !IS_TIMESTAMP_TYPE(paraType)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - pFunc->node.resType = (SDataType){.bytes = getSpreadInfoSize() + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}; - } else { - if (TSDB_DATA_TYPE_BINARY != paraType) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_DOUBLE].bytes, .type = TSDB_DATA_TYPE_DOUBLE}; - } - - return TSDB_CODE_SUCCESS; -} - -static int32_t translateSpreadPartial(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - return translateSpreadImpl(pFunc, pErrBuf, len, true); -} - -static int32_t translateSpreadMerge(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - return translateSpreadImpl(pFunc, pErrBuf, len, false); -} - -static int32_t translateSpreadState(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - if (1 != LIST_LENGTH(pFunc->pParameterList)) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } - - uint8_t paraType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type; - if (!IS_NUMERIC_TYPE(paraType) && !IS_TIMESTAMP_TYPE(paraType)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - pFunc->node.resType = (SDataType){.bytes = getSpreadInfoSize() + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}; - return TSDB_CODE_SUCCESS; -} - -static int32_t translateSpreadStateMerge(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - if (1 != LIST_LENGTH(pFunc->pParameterList)) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } - uint8_t paraType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type; - if (paraType != TSDB_DATA_TYPE_BINARY) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - pFunc->node.resType = (SDataType){.bytes = getSpreadInfoSize() + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}; - return TSDB_CODE_SUCCESS; -} - -static int32_t translateElapsed(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - int32_t numOfParams = LIST_LENGTH(pFunc->pParameterList); - if (1 != numOfParams && 2 != numOfParams) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } - - SNode* pPara1 = nodesListGetNode(pFunc->pParameterList, 0); - if (QUERY_NODE_COLUMN != nodeType(pPara1) || PRIMARYKEY_TIMESTAMP_COL_ID != ((SColumnNode*)pPara1)->colId) { - return buildFuncErrMsg(pErrBuf, len, TSDB_CODE_FUNC_FUNTION_ERROR, - "The first parameter of the ELAPSED function can only be the timestamp primary key"); - } - - // param1 - if (2 == numOfParams) { - SNode* pParamNode1 = nodesListGetNode(pFunc->pParameterList, 1); - if (QUERY_NODE_VALUE != nodeType(pParamNode1)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - - SValueNode* pValue = (SValueNode*)pParamNode1; - - pValue->notReserved = true; - - if (!IS_INTEGER_TYPE(pValue->node.resType.type)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - - uint8_t dbPrec = pFunc->node.resType.precision; - - int32_t code = validateTimeUnitParam(dbPrec, (SValueNode*)nodesListGetNode(pFunc->pParameterList, 1)); - if (code == TSDB_CODE_FUNC_TIME_UNIT_TOO_SMALL) { - return buildFuncErrMsg(pErrBuf, len, code, - "ELAPSED function time unit parameter should be greater than db precision"); - } else if (code == TSDB_CODE_FUNC_TIME_UNIT_INVALID) { - return buildFuncErrMsg( - pErrBuf, len, code, - "ELAPSED function time unit parameter should be one of the following: [1b, 1u, 1a, 1s, 1m, 1h, 1d, 1w]"); - } - } - - pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_DOUBLE].bytes, .type = TSDB_DATA_TYPE_DOUBLE}; - return TSDB_CODE_SUCCESS; -} - -static int32_t translateElapsedImpl(SFunctionNode* pFunc, char* pErrBuf, int32_t len, bool isPartial) { - int32_t numOfParams = LIST_LENGTH(pFunc->pParameterList); - - if (isPartial) { - if (1 != numOfParams && 2 != numOfParams) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } - - uint8_t paraType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type; - if (!IS_TIMESTAMP_TYPE(paraType)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - - // param1 - if (2 == numOfParams) { - SNode* pParamNode1 = nodesListGetNode(pFunc->pParameterList, 1); - - if (QUERY_NODE_VALUE != nodeType(pParamNode1)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - - SValueNode* pValue = (SValueNode*)pParamNode1; - - pValue->notReserved = true; - - paraType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 1))->type; - if (!IS_INTEGER_TYPE(paraType)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - - if (pValue->datum.i == 0) { - return buildFuncErrMsg(pErrBuf, len, TSDB_CODE_FUNC_FUNTION_ERROR, - "ELAPSED function time unit parameter should be greater than db precision"); - } - } - - pFunc->node.resType = - (SDataType){.bytes = getElapsedInfoSize() + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}; - } else { - if (1 != numOfParams) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } - - uint8_t paraType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type; - if (TSDB_DATA_TYPE_BINARY != paraType) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_DOUBLE].bytes, .type = TSDB_DATA_TYPE_DOUBLE}; - } - return TSDB_CODE_SUCCESS; -} - -static int32_t translateElapsedPartial(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { -#if 0 - return translateElapsedImpl(pFunc, pErrBuf, len, true); -#endif - return 0; -} - -static int32_t translateElapsedMerge(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { -#if 0 - return translateElapsedImpl(pFunc, pErrBuf, len, false); -#endif - return 0; -} - -static int32_t translateLeastSQR(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - int32_t numOfParams = LIST_LENGTH(pFunc->pParameterList); - if (3 != numOfParams) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } - - for (int32_t i = 0; i < numOfParams; ++i) { - SNode* pParamNode = nodesListGetNode(pFunc->pParameterList, i); - if (i > 0) { // param1 & param2 - if (QUERY_NODE_VALUE != nodeType(pParamNode)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - - SValueNode* pValue = (SValueNode*)pParamNode; - - pValue->notReserved = true; - } - - uint8_t colType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, i))->type; - if (!IS_NUMERIC_TYPE(colType)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - } - - pFunc->node.resType = (SDataType){.bytes = LEASTSQUARES_BUFF_LENGTH, .type = TSDB_DATA_TYPE_BINARY}; - return TSDB_CODE_SUCCESS; -} - -typedef enum { UNKNOWN_BIN = 0, USER_INPUT_BIN, LINEAR_BIN, LOG_BIN } EHistoBinType; - -static int8_t validateHistogramBinType(char* binTypeStr) { - int8_t binType; - if (strcasecmp(binTypeStr, "user_input") == 0) { - binType = USER_INPUT_BIN; - } else if (strcasecmp(binTypeStr, "linear_bin") == 0) { - binType = LINEAR_BIN; - } else if (strcasecmp(binTypeStr, "log_bin") == 0) { - binType = LOG_BIN; - } else { - binType = UNKNOWN_BIN; - } - - return binType; -} - -static int32_t validateHistogramBinDesc(char* binDescStr, int8_t binType, char* errMsg, int32_t msgLen) { - const char* msg1 = "HISTOGRAM function requires four parameters"; - const char* msg3 = "HISTOGRAM function invalid format for binDesc parameter"; - const char* msg4 = "HISTOGRAM function binDesc parameter \"count\" should be in range [1, 1000]"; - const char* msg5 = "HISTOGRAM function bin/parameter should be in range [-DBL_MAX, DBL_MAX]"; - const char* msg6 = "HISTOGRAM function binDesc parameter \"width\" cannot be 0"; - const char* msg7 = "HISTOGRAM function binDesc parameter \"start\" cannot be 0 with \"log_bin\" type"; - const char* msg8 = "HISTOGRAM function binDesc parameter \"factor\" cannot be negative or equal to 0/1"; - const char* msg9 = "HISTOGRAM function out of memory"; - - cJSON* binDesc = cJSON_Parse(binDescStr); - int32_t numOfBins; - double* intervals; - if (cJSON_IsObject(binDesc)) { /* linaer/log bins */ - int32_t numOfParams = cJSON_GetArraySize(binDesc); - int32_t startIndex; - if (numOfParams != 4) { - (void)snprintf(errMsg, msgLen, "%s", msg1); - cJSON_Delete(binDesc); - return TSDB_CODE_FAILED; - } - - cJSON* start = cJSON_GetObjectItem(binDesc, "start"); - cJSON* factor = cJSON_GetObjectItem(binDesc, "factor"); - cJSON* width = cJSON_GetObjectItem(binDesc, "width"); - cJSON* count = cJSON_GetObjectItem(binDesc, "count"); - cJSON* infinity = cJSON_GetObjectItem(binDesc, "infinity"); - - if (!cJSON_IsNumber(start) || !cJSON_IsNumber(count) || !cJSON_IsBool(infinity)) { - (void)snprintf(errMsg, msgLen, "%s", msg3); - cJSON_Delete(binDesc); - return TSDB_CODE_FAILED; - } - - if (count->valueint <= 0 || count->valueint > 1000) { // limit count to 1000 - (void)snprintf(errMsg, msgLen, "%s", msg4); - cJSON_Delete(binDesc); - return TSDB_CODE_FAILED; - } + if (count->valueint <= 0 || count->valueint > 1000) { // limit count to 1000 + (void)snprintf(errMsg, msgLen, "%s", msg4); + cJSON_Delete(binDesc); + return TSDB_CODE_FAILED; + } if (isinf(start->valuedouble) || (width != NULL && isinf(width->valuedouble)) || (factor != NULL && isinf(factor->valuedouble)) || (count != NULL && isinf(count->valuedouble))) { @@ -1327,526 +654,360 @@ static int32_t validateHistogramBinDesc(char* binDescStr, int8_t binType, char* return terrno; } cJSON* bin = binDesc->child; - if (bin == NULL) { - (void)snprintf(errMsg, msgLen, "%s", msg3); - taosMemoryFree(intervals); - cJSON_Delete(binDesc); - return TSDB_CODE_FAILED; - } - int i = 0; - while (bin) { - intervals[i] = bin->valuedouble; - if (!cJSON_IsNumber(bin)) { - (void)snprintf(errMsg, msgLen, "%s", msg3); - taosMemoryFree(intervals); - cJSON_Delete(binDesc); - return TSDB_CODE_FAILED; - } - if (i != 0 && intervals[i] <= intervals[i - 1]) { - (void)snprintf(errMsg, msgLen, "%s", msg3); - taosMemoryFree(intervals); - cJSON_Delete(binDesc); - return TSDB_CODE_FAILED; - } - bin = bin->next; - i++; - } - } else { - (void)snprintf(errMsg, msgLen, "%s", msg3); - cJSON_Delete(binDesc); - return TSDB_CODE_FAILED; - } - - cJSON_Delete(binDesc); - taosMemoryFree(intervals); - return TSDB_CODE_SUCCESS; -} - -static int32_t translateHistogram(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - int32_t numOfParams = LIST_LENGTH(pFunc->pParameterList); - if (4 != numOfParams) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } - - uint8_t colType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type; - if (!IS_NUMERIC_TYPE(colType)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - - // param1 ~ param3 - if (getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 1))->type != TSDB_DATA_TYPE_BINARY || - getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 2))->type != TSDB_DATA_TYPE_BINARY || - !IS_INTEGER_TYPE(getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 3))->type)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - - int8_t binType; - char* binDesc; - for (int32_t i = 1; i < numOfParams; ++i) { - SNode* pParamNode = nodesListGetNode(pFunc->pParameterList, i); - if (QUERY_NODE_VALUE != nodeType(pParamNode)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - - SValueNode* pValue = (SValueNode*)pParamNode; - - pValue->notReserved = true; - - if (i == 1) { - binType = validateHistogramBinType(varDataVal(pValue->datum.p)); - if (binType == UNKNOWN_BIN) { - return buildFuncErrMsg(pErrBuf, len, TSDB_CODE_FUNC_FUNTION_ERROR, - "HISTOGRAM function binType parameter should be " - "\"user_input\", \"log_bin\" or \"linear_bin\""); - } - } - - if (i == 2) { - char errMsg[128] = {0}; - binDesc = varDataVal(pValue->datum.p); - if (TSDB_CODE_SUCCESS != validateHistogramBinDesc(binDesc, binType, errMsg, (int32_t)sizeof(errMsg))) { - return buildFuncErrMsg(pErrBuf, len, TSDB_CODE_FUNC_FUNTION_ERROR, errMsg); - } - } - - if (i == 3 && pValue->datum.i != 1 && pValue->datum.i != 0) { - return buildFuncErrMsg(pErrBuf, len, TSDB_CODE_FUNC_FUNTION_ERROR, - "HISTOGRAM function normalized parameter should be 0/1"); - } - } - - pFunc->node.resType = (SDataType){.bytes = 512, .type = TSDB_DATA_TYPE_BINARY}; - return TSDB_CODE_SUCCESS; -} - -static int32_t translateHistogramImpl(SFunctionNode* pFunc, char* pErrBuf, int32_t len, bool isPartial) { - int32_t numOfParams = LIST_LENGTH(pFunc->pParameterList); - if (isPartial) { - if (4 != numOfParams) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } - - uint8_t colType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type; - if (!IS_NUMERIC_TYPE(colType)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - - // param1 ~ param3 - if (getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 1))->type != TSDB_DATA_TYPE_BINARY || - getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 2))->type != TSDB_DATA_TYPE_BINARY || - !IS_INTEGER_TYPE(getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 3))->type)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - - int8_t binType; - char* binDesc; - for (int32_t i = 1; i < numOfParams; ++i) { - SNode* pParamNode = nodesListGetNode(pFunc->pParameterList, i); - if (QUERY_NODE_VALUE != nodeType(pParamNode)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - - SValueNode* pValue = (SValueNode*)pParamNode; - - pValue->notReserved = true; - - if (i == 1) { - binType = validateHistogramBinType(varDataVal(pValue->datum.p)); - if (binType == UNKNOWN_BIN) { - return buildFuncErrMsg(pErrBuf, len, TSDB_CODE_FUNC_FUNTION_ERROR, - "HISTOGRAM function binType parameter should be " - "\"user_input\", \"log_bin\" or \"linear_bin\""); - } - } - - if (i == 2) { - char errMsg[128] = {0}; - binDesc = varDataVal(pValue->datum.p); - if (TSDB_CODE_SUCCESS != validateHistogramBinDesc(binDesc, binType, errMsg, (int32_t)sizeof(errMsg))) { - return buildFuncErrMsg(pErrBuf, len, TSDB_CODE_FUNC_FUNTION_ERROR, errMsg); - } + if (bin == NULL) { + (void)snprintf(errMsg, msgLen, "%s", msg3); + taosMemoryFree(intervals); + cJSON_Delete(binDesc); + return TSDB_CODE_FAILED; + } + int i = 0; + while (bin) { + intervals[i] = bin->valuedouble; + if (!cJSON_IsNumber(bin)) { + (void)snprintf(errMsg, msgLen, "%s", msg3); + taosMemoryFree(intervals); + cJSON_Delete(binDesc); + return TSDB_CODE_FAILED; } - - if (i == 3 && pValue->datum.i != 1 && pValue->datum.i != 0) { - return buildFuncErrMsg(pErrBuf, len, TSDB_CODE_FUNC_FUNTION_ERROR, - "HISTOGRAM function normalized parameter should be 0/1"); + if (i != 0 && intervals[i] <= intervals[i - 1]) { + (void)snprintf(errMsg, msgLen, "%s", msg3); + taosMemoryFree(intervals); + cJSON_Delete(binDesc); + return TSDB_CODE_FAILED; } + bin = bin->next; + i++; } - - pFunc->node.resType = - (SDataType){.bytes = getHistogramInfoSize() + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}; } else { - if (1 != numOfParams) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } - - if (getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type != TSDB_DATA_TYPE_BINARY) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - - pFunc->node.resType = (SDataType){.bytes = 512, .type = TSDB_DATA_TYPE_BINARY}; - } - return TSDB_CODE_SUCCESS; -} - -static int32_t translateHistogramPartial(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - return translateHistogramImpl(pFunc, pErrBuf, len, true); -} - -static int32_t translateHistogramMerge(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - return translateHistogramImpl(pFunc, pErrBuf, len, false); -} - -static int32_t translateHLL(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - if (1 != LIST_LENGTH(pFunc->pParameterList)) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); + (void)snprintf(errMsg, msgLen, "%s", msg3); + cJSON_Delete(binDesc); + return TSDB_CODE_FAILED; } - pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_BIGINT].bytes, .type = TSDB_DATA_TYPE_BIGINT}; + cJSON_Delete(binDesc); + taosMemoryFree(intervals); return TSDB_CODE_SUCCESS; } -static int32_t translateHLLImpl(SFunctionNode* pFunc, char* pErrBuf, int32_t len, bool isPartial) { - if (1 != LIST_LENGTH(pFunc->pParameterList)) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } +static int32_t validateParam(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { + int32_t code = TSDB_CODE_SUCCESS; + SNodeList* paramList = pFunc->pParameterList; + char errMsg[128] = {0}; - if (isPartial) { - pFunc->node.resType = - (SDataType){.bytes = getHistogramInfoSize() + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}; - } else { - pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_BIGINT].bytes, .type = TSDB_DATA_TYPE_BIGINT}; + // no need to check + if (funcMgtBuiltins[pFunc->funcId].parameters.paramInfoPattern == 0) { + return TSDB_CODE_SUCCESS; } - - return TSDB_CODE_SUCCESS; -} - -static int32_t translateHLLPartial(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - return translateHLLImpl(pFunc, pErrBuf, len, true); -} - -static int32_t translateHLLMerge(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - return translateHLLImpl(pFunc, pErrBuf, len, false); -} - -static int32_t translateHLLState(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - return translateHLLPartial(pFunc, pErrBuf, len); -} - -static int32_t translateHLLStateMerge(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - - if (1 != LIST_LENGTH(pFunc->pParameterList)) { + + // check param num + if ((funcMgtBuiltins[pFunc->funcId].parameters.maxParamNum != -1 && + LIST_LENGTH(paramList) > funcMgtBuiltins[pFunc->funcId].parameters.maxParamNum) || + LIST_LENGTH(paramList) < funcMgtBuiltins[pFunc->funcId].parameters.minParamNum) { return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); } - if (getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type != TSDB_DATA_TYPE_BINARY) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - pFunc->node.resType = - (SDataType){.bytes = getHistogramInfoSize() + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}; - return TSDB_CODE_SUCCESS; -} + // check each param + for (int32_t i = 0; i < funcMgtBuiltins[pFunc->funcId].parameters.paramInfoPattern; i++) { + bool isMatch = true; + int32_t paramIdx = 0; + const SParamInfo* paramPattern = funcMgtBuiltins[pFunc->funcId].parameters.inputParaInfo[i]; -static bool validateStateOper(const SValueNode* pVal) { - if (TSDB_DATA_TYPE_BINARY != pVal->node.resType.type) { - return false; - } - if (strlen(varDataVal(pVal->datum.p)) == 2) { - return ( - 0 == strncasecmp(varDataVal(pVal->datum.p), "GT", 2) || 0 == strncasecmp(varDataVal(pVal->datum.p), "GE", 2) || - 0 == strncasecmp(varDataVal(pVal->datum.p), "LT", 2) || 0 == strncasecmp(varDataVal(pVal->datum.p), "LE", 2) || - 0 == strncasecmp(varDataVal(pVal->datum.p), "EQ", 2) || 0 == strncasecmp(varDataVal(pVal->datum.p), "NE", 2)); - } - return false; -} + while (1) { + for (int8_t j = paramPattern[paramIdx].startParam; j <= (paramPattern[paramIdx].endParam == -1 ? INT8_MAX : paramPattern[paramIdx].endParam); j++) { + if (j > LIST_LENGTH(paramList)) { + code = TSDB_CODE_SUCCESS; + isMatch = true; + break; + } + SNode* pNode = nodesListGetNode(paramList, j - 1); + // check node type + if (!paramSupportNodeType(pNode, paramPattern[paramIdx].validNodeType)) { + code = TSDB_CODE_FUNC_FUNTION_PARA_TYPE; + isMatch = false; + break; + } + // check data type + if (!paramSupportDataType(getSDataTypeFromNode(pNode), paramPattern[paramIdx].validDataType)) { + code = TSDB_CODE_FUNC_FUNTION_PARA_TYPE; + isMatch = false; + break; + } + if (paramPattern[paramIdx].validNodeType == FUNC_PARAM_SUPPORT_VALUE_NODE) { + SValueNode* pVal = (SValueNode*)pNode; + pVal->notReserved = true; + } + // check range value + if (paramPattern[paramIdx].hasRange) { + if (pNode->type == QUERY_NODE_VALUE) { + SValueNode* pVal = (SValueNode*)pNode; + if (IS_INTEGER_TYPE(getSDataTypeFromNode(pNode)->type)) { + if ((double)pVal->datum.i < paramPattern[paramIdx].range.dMinVal || + (double)pVal->datum.i > paramPattern[paramIdx].range.dMaxVal) { + code = TSDB_CODE_FUNC_FUNTION_PARA_RANGE; + isMatch = false; + break; + } + } else { + if ((double)pVal->datum.d < paramPattern[paramIdx].range.dMinVal || + (double)pVal->datum.d > paramPattern[paramIdx].range.dMaxVal) { + code = TSDB_CODE_FUNC_FUNTION_PARA_RANGE; + isMatch = false; + break; + } + } + } else { + // for other node type, range check should be done in process function + } + } + // check fixed value + if (paramPattern[paramIdx].isFixedValue) { + if (pNode->type == QUERY_NODE_VALUE) { + SValueNode* pVal = (SValueNode*)pNode; + if (IS_NUMERIC_TYPE(getSDataTypeFromNode(pNode)->type)) { + for (int32_t k = 0; k < paramPattern[paramIdx].fixedValueSize; k++) { + if (pVal->datum.i == paramPattern[paramIdx].fixedNumValue[k]) { + code = TSDB_CODE_SUCCESS; + isMatch = true; + break; + } else { + code = TSDB_CODE_FUNC_FUNTION_PARA_VALUE; + isMatch = false; + } + } + } else if (IS_STR_DATA_TYPE(getSDataTypeFromNode(pNode)->type)) { + for (int32_t k = 0; k < paramPattern[paramIdx].fixedValueSize; k++) { + if (strcasecmp(pVal->literal, paramPattern[paramIdx].fixedStrValue[k]) == 0) { + code = TSDB_CODE_SUCCESS; + isMatch = true; + break; + } else { + code = TSDB_CODE_FUNC_FUNTION_PARA_VALUE; + isMatch = false; + } + } + } + if (!isMatch) { + break; + } + } else { + // for other node type, fixed value check should be done in process function + } + } + // check isTs + if (paramPattern[paramIdx].isTs) { + if (nodeType(pNode) != QUERY_NODE_COLUMN || !IS_TIMESTAMP_TYPE(getSDataTypeFromNode(pNode)->type) || + !((SColumnNode*)pNode)->isPrimTs) { + code = TSDB_CODE_FUNC_FUNTION_PARA_PRIMTS; + isMatch = false; + break; + } + } + // check isPK + if (paramPattern[paramIdx].isPK) { + if (nodeType(pNode) != QUERY_NODE_COLUMN || !IS_INTEGER_TYPE(getSDataTypeFromNode(pNode)->type) || + !((SColumnNode*)pNode)->isPk) { + code = TSDB_CODE_FUNC_FUNTION_PARA_PK; + isMatch = false; + break; + } + } + // check hasColumn + if (paramPattern[paramIdx].hasColumn) { + if (!nodesExprHasColumn(pNode)) { + code = TSDB_CODE_FUNC_FUNTION_PARA_HAS_COL; + isMatch = false; + break; + } + } + // check first and last + if (paramPattern[paramIdx].isFirstLast) { + if (IS_NULL_TYPE(getSDataTypeFromNode(pNode)->type) && QUERY_NODE_VALUE == nodeType(pNode)) { + code = TSDB_CODE_FUNC_FUNTION_PARA_TYPE; + isMatch = false; + break; + } + } + // check time unit + if (paramPattern[paramIdx].isTimeUnit) { + if (nodeType(pNode) != QUERY_NODE_VALUE || !IS_INTEGER_TYPE(getSDataTypeFromNode(pNode)->type)) { + code = TSDB_CODE_FUNC_FUNTION_PARA_TYPE; + isMatch = false; + break; + } -static int32_t translateStateCount(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - int32_t numOfParams = LIST_LENGTH(pFunc->pParameterList); - if (3 != numOfParams) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } + if (IS_NULL_TYPE(getSDataTypeFromNode(pNode)->type)) { + code = TSDB_CODE_SUCCESS; + isMatch = true; + continue; + } - uint8_t colType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type; - if (!IS_NUMERIC_TYPE(colType)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } + code = validateTimeUnitParam(pFunc->node.resType.precision, (SValueNode*)pNode); + if (TSDB_CODE_SUCCESS != code) { + isMatch = false; + break; + } + } + // check histogram binary + if (paramPattern[paramIdx].isHistogramBin) { + if (nodeType(pNode) != QUERY_NODE_VALUE) { + code = TSDB_CODE_FUNC_FUNTION_PARA_TYPE; + isMatch = false; + break; + } + SValueNode *pValue = (SValueNode *)pNode; + SValueNode *pBinValue = (SValueNode *)nodesListGetNode(paramList, 1); + char* binDesc = varDataVal(pValue->datum.p); + int8_t binType = validateHistogramBinType(varDataVal(pBinValue->datum.p)); + if (binType == UNKNOWN_BIN) { + code = TSDB_CODE_FUNC_FUNCTION_HISTO_TYPE; + isMatch = false; + break; + } + code = validateHistogramBinDesc(binDesc, binType, errMsg, (int32_t)sizeof(errMsg)); + if (TSDB_CODE_SUCCESS != code) { + code = TSDB_CODE_FUNC_HISTOGRAM_ERROR; + isMatch = false; + break; + } + } + } - // param1 & param2 - for (int32_t i = 1; i < numOfParams; ++i) { - SNode* pParamNode = nodesListGetNode(pFunc->pParameterList, i); - if (QUERY_NODE_VALUE != nodeType(pParamNode)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); + if (paramPattern[paramIdx].isLastParam || !isMatch) { + break; + } + paramIdx++; } - - SValueNode* pValue = (SValueNode*)pParamNode; - - if (i == 1 && !validateStateOper(pValue)) { - return buildFuncErrMsg(pErrBuf, len, TSDB_CODE_FUNC_FUNTION_ERROR, - "Second parameter of STATECOUNT function" - "must be one of the following: 'GE', 'GT', 'LE', 'LT', 'EQ', 'NE'"); + if (isMatch) { + return TSDB_CODE_SUCCESS; } - - pValue->notReserved = true; - } - - if (getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 1))->type != TSDB_DATA_TYPE_BINARY || - (getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 2))->type != TSDB_DATA_TYPE_BIGINT && - getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 2))->type != TSDB_DATA_TYPE_DOUBLE)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - - // set result type - pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_BIGINT].bytes, .type = TSDB_DATA_TYPE_BIGINT}; - return TSDB_CODE_SUCCESS; -} - -static int32_t translateStateDuration(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - int32_t numOfParams = LIST_LENGTH(pFunc->pParameterList); - if (3 != numOfParams && 4 != numOfParams) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); } - - uint8_t colType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type; - if (!IS_NUMERIC_TYPE(colType)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - - // param1, param2 & param3 - for (int32_t i = 1; i < numOfParams; ++i) { - SNode* pParamNode = nodesListGetNode(pFunc->pParameterList, i); - if (QUERY_NODE_VALUE != nodeType(pParamNode)) { + switch (code) { + case TSDB_CODE_FUNC_FUNTION_PARA_NUM: + return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); + case TSDB_CODE_FUNC_FUNTION_PARA_TYPE: return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - - SValueNode* pValue = (SValueNode*)pParamNode; - - if (i == 1 && !validateStateOper(pValue)) { - return buildFuncErrMsg(pErrBuf, len, TSDB_CODE_FUNC_FUNTION_ERROR, - "Second parameter of STATEDURATION function" - "must be one of the following: 'GE', 'GT', 'LE', 'LT', 'EQ', 'NE'"); - } else if (i == 3 && pValue->datum.i == 0) { - return buildFuncErrMsg(pErrBuf, len, TSDB_CODE_FUNC_FUNTION_ERROR, - "STATEDURATION function time unit parameter should be greater than db precision"); - } - - pValue->notReserved = true; - } - - if (getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 1))->type != TSDB_DATA_TYPE_BINARY || - (getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 2))->type != TSDB_DATA_TYPE_BIGINT && - getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 2))->type != TSDB_DATA_TYPE_DOUBLE)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - - if (numOfParams == 4 && - getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 3))->type != TSDB_DATA_TYPE_BIGINT) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - - if (numOfParams == 4) { - uint8_t dbPrec = pFunc->node.resType.precision; - - int32_t code = validateTimeUnitParam(dbPrec, (SValueNode*)nodesListGetNode(pFunc->pParameterList, 3)); - if (code == TSDB_CODE_FUNC_TIME_UNIT_TOO_SMALL) { - return buildFuncErrMsg(pErrBuf, len, code, - "STATEDURATION function time unit parameter should be greater than db precision"); - } else if (code == TSDB_CODE_FUNC_TIME_UNIT_INVALID) { - return buildFuncErrMsg(pErrBuf, len, code, - "STATEDURATION function time unit parameter should be one of the following: [1b, 1u, 1a, " - "1s, 1m, 1h, 1d, 1w]"); - } + case TSDB_CODE_FUNC_FUNTION_PARA_VALUE: + return invaildFuncParaValueErrMsg(pErrBuf, len, pFunc->functionName); + case TSDB_CODE_FUNC_FUNTION_PARA_RANGE: + return buildFuncErrMsg(pErrBuf, len, TSDB_CODE_FUNC_FUNTION_PARA_RANGE, "Invalid parameter range : %s", + pFunc->functionName); + case TSDB_CODE_FUNC_FUNTION_PARA_PRIMTS: + return buildFuncErrMsg(pErrBuf, len, TSDB_CODE_FUNC_FUNTION_PARA_PRIMTS, "Parameter should be primary timestamp : %s", + pFunc->functionName); + case TSDB_CODE_FUNC_FUNTION_PARA_PK: + return buildFuncErrMsg(pErrBuf, len, TSDB_CODE_FUNC_FUNTION_PARA_PK, "Parameter should be primary key : %s", + pFunc->functionName); + case TSDB_CODE_FUNC_FUNTION_PARA_HAS_COL: + return buildFuncErrMsg(pErrBuf, len, TSDB_CODE_FUNC_FUNTION_PARA_HAS_COL, "Parameter should have column : %s", + pFunc->functionName); + case TSDB_CODE_FUNC_TIME_UNIT_INVALID: + return buildFuncErrMsg(pErrBuf, len, TSDB_CODE_FUNC_TIME_UNIT_INVALID, "Invalid timzone format : %s", + pFunc->functionName); + case TSDB_CODE_FUNC_TIME_UNIT_TOO_SMALL: + return buildFuncErrMsg(pErrBuf, len, TSDB_CODE_FUNC_TIME_UNIT_TOO_SMALL, "Time unit is too small : %s", + pFunc->functionName); + case TSDB_CODE_FUNC_FUNCTION_HISTO_TYPE: + return buildFuncErrMsg(pErrBuf, len, TSDB_CODE_FUNC_FUNCTION_HISTO_TYPE, "Invalid histogram bin type : %s", + pFunc->functionName); + case TSDB_CODE_FUNC_HISTOGRAM_ERROR: + return buildFuncErrMsg(pErrBuf, len, TSDB_CODE_FUNC_HISTOGRAM_ERROR, errMsg, pFunc->functionName); + default: + return buildFuncErrMsg(pErrBuf, len, TSDB_CODE_FUNC_FUNTION_ERROR, "Function check parameter failed : %s", + pFunc->functionName); } - - // set result type - pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_BIGINT].bytes, .type = TSDB_DATA_TYPE_BIGINT}; - return TSDB_CODE_SUCCESS; } -static int32_t translateCsum(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - if (1 != LIST_LENGTH(pFunc->pParameterList)) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } - - uint8_t colType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type; - uint8_t resType; - if (!IS_NUMERIC_TYPE(colType)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } else { - if (IS_SIGNED_NUMERIC_TYPE(colType)) { - resType = TSDB_DATA_TYPE_BIGINT; - } else if (IS_UNSIGNED_NUMERIC_TYPE(colType)) { - resType = TSDB_DATA_TYPE_UBIGINT; - } else if (IS_FLOAT_TYPE(colType)) { - resType = TSDB_DATA_TYPE_DOUBLE; - } else { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } +// There is only one parameter of numeric type, and the return type is parameter type +static int32_t translateOutNum(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { + FUNC_ERR_RET(validateParam(pFunc, pErrBuf, len)); + uint8_t paraType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type; + if (IS_NULL_TYPE(paraType)) { + paraType = TSDB_DATA_TYPE_BIGINT; } - - pFunc->node.resType = (SDataType){.bytes = tDataTypes[resType].bytes, .type = resType}; + pFunc->node.resType = (SDataType){.bytes = tDataTypes[paraType].bytes, .type = paraType}; return TSDB_CODE_SUCCESS; } -static EFuncReturnRows csumEstReturnRows(SFunctionNode* pFunc) { return FUNC_RETURN_ROWS_N; } - -static int32_t translateMavg(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - if (2 != LIST_LENGTH(pFunc->pParameterList)) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } - - uint8_t colType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type; - // param1 - SNode* pParamNode1 = nodesListGetNode(pFunc->pParameterList, 1); - if (QUERY_NODE_VALUE != nodeType(pParamNode1)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - - SValueNode* pValue = (SValueNode*)pParamNode1; - if (pValue->datum.i < 1 || pValue->datum.i > 1000) { - return invaildFuncParaValueErrMsg(pErrBuf, len, pFunc->functionName); - } - - pValue->notReserved = true; - - uint8_t paraType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 1))->type; - if (!IS_NUMERIC_TYPE(colType) || !IS_INTEGER_TYPE(paraType)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } +// There is only one parameter, and the return type is parameter type +static int32_t translateMinMax(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { + FUNC_ERR_RET(validateParam(pFunc, pErrBuf, len)); - pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_DOUBLE].bytes, .type = TSDB_DATA_TYPE_DOUBLE}; + SDataType* dataType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0)); + uint8_t paraType = IS_NULL_TYPE(dataType->type) ? TSDB_DATA_TYPE_BIGINT : dataType->type; + int32_t bytes = IS_STR_DATA_TYPE(paraType) ? dataType->bytes : tDataTypes[paraType].bytes; + pFunc->node.resType = (SDataType){.bytes = bytes, .type = paraType}; return TSDB_CODE_SUCCESS; } -static int32_t translateSample(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - if (2 != LIST_LENGTH(pFunc->pParameterList)) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } - - SDataType* pSDataType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0)); - uint8_t colType = pSDataType->type; - - // param1 - SNode* pParamNode1 = nodesListGetNode(pFunc->pParameterList, 1); - if (QUERY_NODE_VALUE != nodeType(pParamNode1)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - - SValueNode* pValue = (SValueNode*)pParamNode1; - if (pValue->datum.i < 1 || pValue->datum.i > 1000) { - return invaildFuncParaValueErrMsg(pErrBuf, len, pFunc->functionName); - } - - pValue->notReserved = true; - - uint8_t paraType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 1))->type; - if (!IS_INTEGER_TYPE(paraType)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - - // set result type - if (IS_STR_DATA_TYPE(colType)) { - pFunc->node.resType = (SDataType){.bytes = pSDataType->bytes, .type = colType}; - } else { - pFunc->node.resType = (SDataType){.bytes = tDataTypes[colType].bytes, .type = colType}; - } - +// The return type is DOUBLE type +static int32_t translateOutDouble(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { + FUNC_ERR_RET(validateParam(pFunc, pErrBuf, len)); + pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_DOUBLE].bytes, .type = TSDB_DATA_TYPE_DOUBLE}; return TSDB_CODE_SUCCESS; } -static int32_t translateTail(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - int32_t numOfParams = LIST_LENGTH(pFunc->pParameterList); - if (2 != numOfParams && 3 != numOfParams) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } - - SDataType* pSDataType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0)); - uint8_t colType = pSDataType->type; - - // param1 & param2 - for (int32_t i = 1; i < numOfParams; ++i) { - SNode* pParamNode = nodesListGetNode(pFunc->pParameterList, i); - if (QUERY_NODE_VALUE != nodeType(pParamNode)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - - SValueNode* pValue = (SValueNode*)pParamNode; - - if ((IS_SIGNED_NUMERIC_TYPE(pValue->node.resType.type) ? pValue->datum.i : pValue->datum.u) < ((i > 1) ? 0 : 1) || - (IS_SIGNED_NUMERIC_TYPE(pValue->node.resType.type) ? pValue->datum.i : pValue->datum.u) > 100) { - return buildFuncErrMsg(pErrBuf, len, TSDB_CODE_FUNC_FUNTION_ERROR, - "TAIL function second parameter should be in range [1, 100], " - "third parameter should be in range [0, 100]"); - } - - pValue->notReserved = true; - - uint8_t paraType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, i))->type; - if (!IS_INTEGER_TYPE(paraType)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - } - - // set result type - if (IS_STR_DATA_TYPE(colType)) { - pFunc->node.resType = (SDataType){.bytes = pSDataType->bytes, .type = colType}; - } else { - pFunc->node.resType = (SDataType){.bytes = tDataTypes[colType].bytes, .type = colType}; - } - return TSDB_CODE_SUCCESS; -} -static int32_t translateDerivative(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - if (3 != LIST_LENGTH(pFunc->pParameterList)) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } +static int32_t translateTrimStr(SFunctionNode* pFunc, char* pErrBuf, int32_t len, bool isLtrim) { + FUNC_ERR_RET(validateParam(pFunc, pErrBuf, len)); - uint8_t colType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type; + SDataType* pRestType1 = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0)); - // param1 - SNode* pParamNode1 = nodesListGetNode(pFunc->pParameterList, 1); - SValueNode* pValue1 = (SValueNode*)pParamNode1; - if (QUERY_NODE_VALUE != nodeType(pParamNode1)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); + int32_t numOfSpaces = 0; + SNode* pParamNode1 = nodesListGetNode(pFunc->pParameterList, 0); + // for select trim functions with constant value from table, + // need to set the proper result result schema bytes to avoid + // trailing garbage characters + if (nodeType(pParamNode1) == QUERY_NODE_VALUE) { + SValueNode* pValue = (SValueNode*)pParamNode1; + numOfSpaces = countTrailingSpaces(pValue, isLtrim); } - if (pValue1->datum.i <= 0) { - return invaildFuncParaValueErrMsg(pErrBuf, len, pFunc->functionName); - } + int32_t resBytes = pRestType1->bytes - numOfSpaces; + pFunc->node.resType = (SDataType){.bytes = resBytes, .type = pRestType1->type}; + return TSDB_CODE_SUCCESS; +} + +static int32_t translateLtrim(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { + return translateTrimStr(pFunc, pErrBuf, len, true); +} - SValueNode* pValue = (SValueNode*)pParamNode1; - pValue->notReserved = true; +static int32_t translateRtrim(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { + return translateTrimStr(pFunc, pErrBuf, len, false); +} - if (!IS_NUMERIC_TYPE(colType)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } +// The return type is BIGINT type +static int32_t translateOutBigInt(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { + FUNC_ERR_RET(validateParam(pFunc, pErrBuf, len)); + pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_BIGINT].bytes, .type = TSDB_DATA_TYPE_BIGINT}; + return TSDB_CODE_SUCCESS; +} - SNode* pParamNode2 = nodesListGetNode(pFunc->pParameterList, 2); - SValueNode* pValue2 = (SValueNode*)pParamNode2; - pValue2->notReserved = true; +static int32_t translateSum(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { + FUNC_ERR_RET(validateParam(pFunc, pErrBuf, len)); - if (pValue2->datum.i != 0 && pValue2->datum.i != 1) { - return invaildFuncParaValueErrMsg(pErrBuf, len, pFunc->functionName); + uint8_t paraType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type; + uint8_t resType = 0; + if (IS_SIGNED_NUMERIC_TYPE(paraType) || TSDB_DATA_TYPE_BOOL == paraType || IS_NULL_TYPE(paraType)) { + resType = TSDB_DATA_TYPE_BIGINT; + } else if (IS_UNSIGNED_NUMERIC_TYPE(paraType)) { + resType = TSDB_DATA_TYPE_UBIGINT; + } else if (IS_FLOAT_TYPE(paraType)) { + resType = TSDB_DATA_TYPE_DOUBLE; } - pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_DOUBLE].bytes, .type = TSDB_DATA_TYPE_DOUBLE}; + pFunc->node.resType = (SDataType){.bytes = tDataTypes[resType].bytes, .type = resType}; return TSDB_CODE_SUCCESS; } -static EFuncReturnRows derivativeEstReturnRows(SFunctionNode* pFunc) { - return 1 == ((SValueNode*)nodesListGetNode(pFunc->pParameterList, 2))->datum.i ? FUNC_RETURN_ROWS_INDEFINITE - : FUNC_RETURN_ROWS_N_MINUS_1; +static int32_t translateWduration(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { + // pseudo column do not need to check parameters + pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_BIGINT].bytes, .type = TSDB_DATA_TYPE_BIGINT, + .precision = pFunc->node.resType.precision}; + return TSDB_CODE_SUCCESS; } -static int32_t translateIrate(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - if (1 != LIST_LENGTH(pFunc->pParameterList)) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } - - uint8_t colType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type; - - if (!IS_NUMERIC_TYPE(colType)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } +static int32_t translateNowToday(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { + // pseudo column do not need to check parameters // add database precision as param uint8_t dbPrec = pFunc->node.resType.precision; @@ -1855,228 +1016,167 @@ static int32_t translateIrate(SFunctionNode* pFunc, char* pErrBuf, int32_t len) return code; } - pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_DOUBLE].bytes, .type = TSDB_DATA_TYPE_DOUBLE}; + pFunc->node.resType = + (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_TIMESTAMP].bytes, .type = TSDB_DATA_TYPE_TIMESTAMP}; return TSDB_CODE_SUCCESS; } -static int32_t translateIrateImpl(SFunctionNode* pFunc, char* pErrBuf, int32_t len, bool isPartial) { - uint8_t colType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type; - if (isPartial) { - if (3 != LIST_LENGTH(pFunc->pParameterList) && 4 != LIST_LENGTH(pFunc->pParameterList)) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } - if (!IS_NUMERIC_TYPE(colType)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - int32_t pkBytes = (pFunc->hasPk) ? pFunc->pkBytes : 0; - pFunc->node.resType = (SDataType){.bytes = getIrateInfoSize(pkBytes) + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}; - } else { - if (1 != LIST_LENGTH(pFunc->pParameterList)) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } - if (TSDB_DATA_TYPE_BINARY != colType) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_DOUBLE].bytes, .type = TSDB_DATA_TYPE_DOUBLE}; +static int32_t translateRand(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { + FUNC_ERR_RET(validateParam(pFunc, pErrBuf, len)); - // add database precision as param - uint8_t dbPrec = pFunc->node.resType.precision; - int32_t code = addUint8Param(&pFunc->pParameterList, dbPrec); + if (!pFunc->dual) { + int32_t code = addPseudoParam(&pFunc->pParameterList); if (code != TSDB_CODE_SUCCESS) { return code; } } - + pFunc->node.resType = + (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_DOUBLE].bytes, .type = TSDB_DATA_TYPE_DOUBLE}; return TSDB_CODE_SUCCESS; } -static int32_t translateIratePartial(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - return translateIrateImpl(pFunc, pErrBuf, len, true); -} - -static int32_t translateIrateMerge(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - return translateIrateImpl(pFunc, pErrBuf, len, false); +// return type is same as first input parameter's type +static int32_t translateOutFirstIn(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { + FUNC_ERR_RET(validateParam(pFunc, pErrBuf, len)); + pFunc->node.resType = *getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0)); + return TSDB_CODE_SUCCESS; } -static int32_t translateInterp(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - int32_t numOfParams = LIST_LENGTH(pFunc->pParameterList); - uint8_t dbPrec = pFunc->node.resType.precision; +static int32_t translateTimePseudoColumn(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { + // pseudo column do not need to check parameters - if (2 < numOfParams) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } + pFunc->node.resType = + (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_TIMESTAMP].bytes, .type = TSDB_DATA_TYPE_TIMESTAMP, + .precision = pFunc->node.resType.precision}; + return TSDB_CODE_SUCCESS; +} - uint8_t nodeType = nodeType(nodesListGetNode(pFunc->pParameterList, 0)); - uint8_t paraType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type; - if ((!IS_NUMERIC_TYPE(paraType) && !IS_BOOLEAN_TYPE(paraType)) || QUERY_NODE_VALUE == nodeType) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } +static int32_t translateIsFilledPseudoColumn(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { + // pseudo column do not need to check parameters - if (2 == numOfParams) { - nodeType = nodeType(nodesListGetNode(pFunc->pParameterList, 1)); - paraType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 1))->type; - if (!IS_INTEGER_TYPE(paraType) || QUERY_NODE_VALUE != nodeType) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } + pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_BOOL].bytes, .type = TSDB_DATA_TYPE_BOOL}; + return TSDB_CODE_SUCCESS; +} - SValueNode* pValue = (SValueNode*)nodesListGetNode(pFunc->pParameterList, 1); - if (pValue->datum.i != 0 && pValue->datum.i != 1) { - return buildFuncErrMsg(pErrBuf, len, TSDB_CODE_FUNC_FUNTION_ERROR, - "INTERP function second parameter should be 0/1"); - } +static int32_t translatePercentile(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { + FUNC_ERR_RET(validateParam(pFunc, pErrBuf, len)); + int32_t numOfParams = LIST_LENGTH(pFunc->pParameterList); - pValue->notReserved = true; + // set result type + if (numOfParams > 2) { + pFunc->node.resType = (SDataType){.bytes = 3200, .type = TSDB_DATA_TYPE_VARCHAR}; + } else { + pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_DOUBLE].bytes, .type = TSDB_DATA_TYPE_DOUBLE}; } + return TSDB_CODE_SUCCESS; +} -#if 0 - if (3 <= numOfParams) { - int64_t timeVal[2] = {0}; - for (int32_t i = 1; i < 3; ++i) { - nodeType = nodeType(nodesListGetNode(pFunc->pParameterList, i)); - paraType = ((SExprNode*)nodesListGetNode(pFunc->pParameterList, i))->resType.type; - if (!IS_STR_DATA_TYPE(paraType) || QUERY_NODE_VALUE != nodeType) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } +static int32_t translateVgIdColumn(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { + // pseudo column do not need to check parameters + pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_INT].bytes, .type = TSDB_DATA_TYPE_INT}; + return TSDB_CODE_SUCCESS; +} - SValueNode* pValue = (SValueNode*)nodesListGetNode(pFunc->pParameterList, i); - int32_t ret = convertStringToTimestamp(paraType, pValue->datum.p, dbPrec, &timeVal[i - 1]); - if (ret != TSDB_CODE_SUCCESS) { - return invaildFuncParaValueErrMsg(pErrBuf, len, pFunc->functionName); - } - } - if (timeVal[0] > timeVal[1]) { - return buildFuncErrMsg(pErrBuf, len, TSDB_CODE_FUNC_FUNTION_ERROR, "INTERP function invalid time range"); +static int32_t reserveFirstMergeParam(SNodeList* pRawParameters, SNode* pPartialRes, SNodeList** pParameters) { + int32_t code = nodesListMakeAppend(pParameters, pPartialRes); + if (TSDB_CODE_SUCCESS == code) { + SNode* pNew = NULL; + code = nodesCloneNode(nodesListGetNode(pRawParameters, 1), &pNew); + if (TSDB_CODE_SUCCESS == code) { + code = nodesListStrictAppend(*pParameters, pNew); } } + return code; +} - if (4 == numOfParams) { - nodeType = nodeType(nodesListGetNode(pFunc->pParameterList, 3)); - paraType = ((SExprNode*)nodesListGetNode(pFunc->pParameterList, 3))->resType.type; - if (!IS_INTEGER_TYPE(paraType) || QUERY_NODE_VALUE != nodeType) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } +int32_t topBotCreateMergeParam(SNodeList* pRawParameters, SNode* pPartialRes, SNodeList** pParameters) { + return reserveFirstMergeParam(pRawParameters, pPartialRes, pParameters); +} - int32_t ret = validateTimeUnitParam(dbPrec, (SValueNode*)nodesListGetNode(pFunc->pParameterList, 3)); - if (ret == TIME_UNIT_TOO_SMALL) { - return buildFuncErrMsg(pErrBuf, len, TSDB_CODE_FUNC_FUNTION_ERROR, - "INTERP function time interval parameter should be greater than db precision"); - } else if (ret == TIME_UNIT_INVALID) { - return buildFuncErrMsg( - pErrBuf, len, TSDB_CODE_FUNC_FUNTION_ERROR, - "INTERP function time interval parameter should be one of the following: [1b, 1u, 1a, 1s, 1m, 1h, 1d, 1w]"); +int32_t apercentileCreateMergeParam(SNodeList* pRawParameters, SNode* pPartialRes, SNodeList** pParameters) { + int32_t code = reserveFirstMergeParam(pRawParameters, pPartialRes, pParameters); + if (TSDB_CODE_SUCCESS == code && pRawParameters->length >= 3) { + SNode* pNew = NULL; + code = nodesCloneNode(nodesListGetNode(pRawParameters, 2), &pNew); + if (TSDB_CODE_SUCCESS == code) { + code = nodesListStrictAppend(*pParameters, pNew); } } -#endif - - pFunc->node.resType = ((SExprNode*)nodesListGetNode(pFunc->pParameterList, 0))->resType; - return TSDB_CODE_SUCCESS; + return code; } -static EFuncReturnRows interpEstReturnRows(SFunctionNode* pFunc) { - int32_t numOfParams = LIST_LENGTH(pFunc->pParameterList); - if (1 < numOfParams && 1 == ((SValueNode*)nodesListGetNode(pFunc->pParameterList, 1))->datum.i) { - return FUNC_RETURN_ROWS_INDEFINITE; - } else { - return FUNC_RETURN_ROWS_N; - } +static int32_t translateElapsedPartial(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { + return 0; } -static int32_t translateFirstLast(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - // forbid null as first/last input, since first(c0, null, 1) may have different number of input - int32_t numOfParams = LIST_LENGTH(pFunc->pParameterList); - - for (int32_t i = 0; i < numOfParams; ++i) { - uint8_t nodeType = nodeType(nodesListGetNode(pFunc->pParameterList, i)); - uint8_t paraType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, i))->type; - if (IS_NULL_TYPE(paraType) && QUERY_NODE_VALUE == nodeType) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - } - - pFunc->node.resType = *getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0)); - return TSDB_CODE_SUCCESS; +static int32_t translateElapsedMerge(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { + return 0; } -static int32_t translateFirstLastImpl(SFunctionNode* pFunc, char* pErrBuf, int32_t len, bool isPartial) { - // first(col_list) will be rewritten as first(col) - SNode* pPara = nodesListGetNode(pFunc->pParameterList, 0); - uint8_t paraType = getSDataTypeFromNode(pPara)->type; - int32_t paraBytes = getSDataTypeFromNode(pPara)->bytes; - if (isPartial) { - int32_t numOfParams = LIST_LENGTH(pFunc->pParameterList); - for (int32_t i = 0; i < numOfParams; ++i) { - uint8_t nodeType = nodeType(nodesListGetNode(pFunc->pParameterList, i)); - uint8_t pType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, i))->type; - if (IS_NULL_TYPE(pType) && QUERY_NODE_VALUE == nodeType) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - } - int32_t pkBytes = (pFunc->hasPk) ? pFunc->pkBytes : 0; - pFunc->node.resType = - (SDataType){.bytes = getFirstLastInfoSize(paraBytes, pkBytes) + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}; +static int32_t translateCsum(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { + FUNC_ERR_RET(validateParam(pFunc, pErrBuf, len)); + uint8_t colType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type; + uint8_t resType; + if (IS_SIGNED_NUMERIC_TYPE(colType)) { + resType = TSDB_DATA_TYPE_BIGINT; + } else if (IS_UNSIGNED_NUMERIC_TYPE(colType)) { + resType = TSDB_DATA_TYPE_UBIGINT; + } else if (IS_FLOAT_TYPE(colType)) { + resType = TSDB_DATA_TYPE_DOUBLE; } else { - if (TSDB_DATA_TYPE_BINARY != paraType) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - - pFunc->node.resType = ((SExprNode*)pPara)->resType; + return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); } + pFunc->node.resType = (SDataType){.bytes = tDataTypes[resType].bytes, .type = resType}; return TSDB_CODE_SUCCESS; } -static int32_t translateFirstLastPartial(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - return translateFirstLastImpl(pFunc, pErrBuf, len, true); -} +static EFuncReturnRows csumEstReturnRows(SFunctionNode* pFunc) { return FUNC_RETURN_ROWS_N; } -static int32_t translateFirstLastMerge(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - return translateFirstLastImpl(pFunc, pErrBuf, len, false); -} +static int32_t translateSampleTail(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { + FUNC_ERR_RET(validateParam(pFunc, pErrBuf, len)); -static int32_t translateFirstLastState(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - SNode* pPara = nodesListGetNode(pFunc->pParameterList, 0); - int32_t paraBytes = getSDataTypeFromNode(pPara)->bytes; + SDataType* pSDataType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0)); + uint8_t colType = pSDataType->type; - int32_t pkBytes = (pFunc->hasPk) ? pFunc->pkBytes : 0; - pFunc->node.resType = - (SDataType){.bytes = getFirstLastInfoSize(paraBytes, pkBytes) + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}; + // set result type + pFunc->node.resType = (SDataType){.bytes = IS_STR_DATA_TYPE(colType) ? pSDataType->bytes : tDataTypes[colType].bytes, + .type = colType}; return TSDB_CODE_SUCCESS; } -static int32_t translateFirstLastStateMerge(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - SNode* pPara = nodesListGetNode(pFunc->pParameterList, 0); - int32_t paraBytes = getSDataTypeFromNode(pPara)->bytes; - uint8_t paraType = getSDataTypeFromNode(pPara)->type; - if (paraType != TSDB_DATA_TYPE_BINARY) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - - pFunc->node.resType = (SDataType){.bytes = paraBytes, .type = TSDB_DATA_TYPE_BINARY}; - return TSDB_CODE_SUCCESS; +static EFuncReturnRows derivativeEstReturnRows(SFunctionNode* pFunc) { + return 1 == ((SValueNode*)nodesListGetNode(pFunc->pParameterList, 2))->datum.i ? FUNC_RETURN_ROWS_INDEFINITE + : FUNC_RETURN_ROWS_N_MINUS_1; } -static int32_t translateUniqueMode(SFunctionNode* pFunc, char* pErrBuf, int32_t len, bool isUnique) { - if (1 != LIST_LENGTH(pFunc->pParameterList)) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } - - SNode* pPara = nodesListGetNode(pFunc->pParameterList, 0); - if (!nodesExprHasColumn(pPara)) { - return buildFuncErrMsg(pErrBuf, len, TSDB_CODE_FUNC_FUNTION_ERROR, "The parameters of %s must contain columns", - isUnique ? "UNIQUE" : "MODE"); +static int32_t translateAddPrecOutDouble(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { + FUNC_ERR_RET(validateParam(pFunc, pErrBuf, len)); + // add database precision as param + uint8_t dbPrec = pFunc->node.resType.precision; + int32_t code = addUint8Param(&pFunc->pParameterList, dbPrec); + if (code != TSDB_CODE_SUCCESS) { + return code; } - pFunc->node.resType = ((SExprNode*)pPara)->resType; + pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_DOUBLE].bytes, .type = TSDB_DATA_TYPE_DOUBLE}; return TSDB_CODE_SUCCESS; } -static int32_t translateUnique(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - return translateUniqueMode(pFunc, pErrBuf, len, true); +static int32_t translateInterp(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { + FUNC_ERR_RET(validateParam(pFunc, pErrBuf, len)); + pFunc->node.resType = ((SExprNode*)nodesListGetNode(pFunc->pParameterList, 0))->resType; + return TSDB_CODE_SUCCESS; } -static int32_t translateMode(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - return translateUniqueMode(pFunc, pErrBuf, len, false); +static EFuncReturnRows interpEstReturnRows(SFunctionNode* pFunc) { + int32_t numOfParams = LIST_LENGTH(pFunc->pParameterList); + if (1 < numOfParams && 1 == ((SValueNode*)nodesListGetNode(pFunc->pParameterList, 1))->datum.i) { + return FUNC_RETURN_ROWS_INDEFINITE; + } else { + return FUNC_RETURN_ROWS_N; + } } static int32_t translateForecast(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { @@ -2121,117 +1221,42 @@ static int32_t translateForecastConf(SFunctionNode* pFunc, char* pErrBuf, int32_ static EFuncReturnRows forecastEstReturnRows(SFunctionNode* pFunc) { return FUNC_RETURN_ROWS_N; } static int32_t translateDiff(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - int32_t numOfParams = LIST_LENGTH(pFunc->pParameterList); - if (numOfParams > 2) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } - + FUNC_ERR_RET(validateParam(pFunc, pErrBuf, len)); uint8_t colType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type; - if (!IS_INTEGER_TYPE(colType) && !IS_FLOAT_TYPE(colType) && TSDB_DATA_TYPE_BOOL != colType && - !IS_TIMESTAMP_TYPE(colType)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - - // param1 - if (numOfParams == 2) { - uint8_t paraType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 1))->type; - if (!IS_INTEGER_TYPE(paraType)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - - SNode* pParamNode1 = nodesListGetNode(pFunc->pParameterList, 1); - if (QUERY_NODE_VALUE != nodeType(pParamNode1)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - - SValueNode* pValue = (SValueNode*)pParamNode1; - if (pValue->datum.i < 0 || pValue->datum.i > 3) { - return buildFuncErrMsg(pErrBuf, len, TSDB_CODE_FUNC_FUNTION_ERROR, - "Second parameter of DIFF function should be a number between 0 and 3."); - } - - pValue->notReserved = true; - } uint8_t resType; - if (IS_SIGNED_NUMERIC_TYPE(colType) || IS_TIMESTAMP_TYPE(colType) || TSDB_DATA_TYPE_BOOL == colType) { - resType = TSDB_DATA_TYPE_BIGINT; - } else if (IS_UNSIGNED_NUMERIC_TYPE(colType)) { - resType = TSDB_DATA_TYPE_BIGINT; - } else { - resType = TSDB_DATA_TYPE_DOUBLE; - } - pFunc->node.resType = (SDataType){.bytes = tDataTypes[resType].bytes, .type = resType}; - return TSDB_CODE_SUCCESS; -} - -static EFuncReturnRows diffEstReturnRows(SFunctionNode* pFunc) { - if (1 == LIST_LENGTH(pFunc->pParameterList)) { - return FUNC_RETURN_ROWS_N_MINUS_1; - } - return 1 < ((SValueNode*)nodesListGetNode(pFunc->pParameterList, 1))->datum.i ? FUNC_RETURN_ROWS_INDEFINITE - : FUNC_RETURN_ROWS_N_MINUS_1; -} - -static int32_t translateLength(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - if (1 != LIST_LENGTH(pFunc->pParameterList)) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } - - uint8_t paraType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type; - if (!IS_STR_DATA_TYPE(paraType) && !IS_NULL_TYPE(paraType)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); + if (IS_SIGNED_NUMERIC_TYPE(colType) || IS_TIMESTAMP_TYPE(colType) || TSDB_DATA_TYPE_BOOL == colType) { + resType = TSDB_DATA_TYPE_BIGINT; + } else if (IS_UNSIGNED_NUMERIC_TYPE(colType)) { + resType = TSDB_DATA_TYPE_BIGINT; + } else { + resType = TSDB_DATA_TYPE_DOUBLE; } - - pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_BIGINT].bytes, .type = TSDB_DATA_TYPE_BIGINT}; + pFunc->node.resType = (SDataType){.bytes = tDataTypes[resType].bytes, .type = resType}; return TSDB_CODE_SUCCESS; } -static int32_t translateCharLength(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - if (1 != LIST_LENGTH(pFunc->pParameterList)) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } - - uint8_t paraType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type; - if (paraType == TSDB_DATA_TYPE_VARBINARY || (!IS_STR_DATA_TYPE(paraType) && !IS_NULL_TYPE(paraType))) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); +static EFuncReturnRows diffEstReturnRows(SFunctionNode* pFunc) { + if (1 == LIST_LENGTH(pFunc->pParameterList)) { + return FUNC_RETURN_ROWS_N_MINUS_1; } - - pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_BIGINT].bytes, .type = TSDB_DATA_TYPE_BIGINT}; - return TSDB_CODE_SUCCESS; + return 1 < ((SValueNode*)nodesListGetNode(pFunc->pParameterList, 1))->datum.i ? FUNC_RETURN_ROWS_INDEFINITE + : FUNC_RETURN_ROWS_N_MINUS_1; } static int32_t translateConcatImpl(SFunctionNode* pFunc, char* pErrBuf, int32_t len, int32_t minParaNum, int32_t maxParaNum, bool hasSep) { + FUNC_ERR_RET(validateParam(pFunc, pErrBuf, len)); int32_t numOfParams = LIST_LENGTH(pFunc->pParameterList); - if (numOfParams < minParaNum || numOfParams > maxParaNum) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } uint8_t resultType = TSDB_DATA_TYPE_BINARY; int32_t resultBytes = 0; int32_t sepBytes = 0; - // concat_ws separator should be constant string - if (hasSep) { - SNode* pPara = nodesListGetNode(pFunc->pParameterList, 0); - if (nodeType(pPara) != QUERY_NODE_VALUE) { - return buildFuncErrMsg(pErrBuf, len, TSDB_CODE_FUNC_FUNTION_ERROR, - "The first parameter of CONCAT_WS function can only be constant string"); - } - } - /* For concat/concat_ws function, if params have NCHAR type, promote the final result to NCHAR */ for (int32_t i = 0; i < numOfParams; ++i) { SNode* pPara = nodesListGetNode(pFunc->pParameterList, i); uint8_t paraType = getSDataTypeFromNode(pPara)->type; - if (TSDB_DATA_TYPE_VARBINARY == paraType) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - - if (!IS_STR_DATA_TYPE(paraType) && !IS_NULL_TYPE(paraType)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } if (TSDB_DATA_TYPE_NCHAR == paraType) { resultType = paraType; } @@ -2274,130 +1299,29 @@ static int32_t translateConcatWs(SFunctionNode* pFunc, char* pErrBuf, int32_t le return translateConcatImpl(pFunc, pErrBuf, len, 3, 9, true); } -static int32_t translateSubstr(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - int32_t numOfParams = LIST_LENGTH(pFunc->pParameterList); - if (2 != numOfParams && 3 != numOfParams) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } - - SExprNode* pPara0 = (SExprNode*)nodesListGetNode(pFunc->pParameterList, 0); - SExprNode* pPara1 = (SExprNode*)nodesListGetNode(pFunc->pParameterList, 1); - - uint8_t para0Type = pPara0->resType.type; - uint8_t para1Type = pPara1->resType.type; - if (TSDB_DATA_TYPE_VARBINARY == para0Type || - (!IS_STR_DATA_TYPE(para0Type) && !IS_NULL_TYPE(para0Type)) || - (!IS_INTEGER_TYPE(para1Type) && !IS_NULL_TYPE(para1Type))) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - - if (3 == numOfParams) { - SExprNode* pPara2 = (SExprNode*)nodesListGetNode(pFunc->pParameterList, 2); - uint8_t para2Type = pPara2->resType.type; - if (!IS_INTEGER_TYPE(para2Type) && !IS_NULL_TYPE(para2Type)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - - int64_t v = ((SValueNode*)pPara2)->datum.i; - } - - pFunc->node.resType = (SDataType){.bytes = pPara0->resType.bytes, .type = pPara0->resType.type}; - return TSDB_CODE_SUCCESS; -} - -static int32_t translateSubstrIdx(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - if (3 != LIST_LENGTH(pFunc->pParameterList)) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } - - SExprNode* pPara0 = (SExprNode*)nodesListGetNode(pFunc->pParameterList, 0); - SExprNode* pPara1 = (SExprNode*)nodesListGetNode(pFunc->pParameterList, 1); - SExprNode* pPara2 = (SExprNode*)nodesListGetNode(pFunc->pParameterList, 2); - - uint8_t para0Type = pPara0->resType.type; - uint8_t para1Type = pPara1->resType.type; - uint8_t para2Type = pPara2->resType.type; - if (TSDB_DATA_TYPE_VARBINARY == para0Type || (!IS_STR_DATA_TYPE(para0Type) && !IS_NULL_TYPE(para0Type)) || - TSDB_DATA_TYPE_VARBINARY == para1Type || (!IS_STR_DATA_TYPE(para1Type) && !IS_NULL_TYPE(para1Type)) || - (!IS_INTEGER_TYPE(para2Type) && !IS_NULL_TYPE(para2Type))) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - - pFunc->node.resType = (SDataType){.bytes = pPara0->resType.bytes, .type = pPara0->resType.type}; - return TSDB_CODE_SUCCESS; -} - static int32_t translateChar(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - SNode *node; - FOREACH(node, pFunc->pParameterList) { - uint8_t paraType = getSDataTypeFromNode(node)->type; - if (paraType == TSDB_DATA_TYPE_VARBINARY || - (!IS_STR_DATA_TYPE(paraType) && !IS_NUMERIC_TYPE(paraType) && !IS_NULL_TYPE(paraType))) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - } - + FUNC_ERR_RET(validateParam(pFunc, pErrBuf, len)); int32_t numOfParams = LIST_LENGTH(pFunc->pParameterList); pFunc->node.resType = (SDataType){.bytes = 4 * numOfParams + 2, .type = TSDB_DATA_TYPE_VARCHAR}; return TSDB_CODE_SUCCESS; } static int32_t translateAscii(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - if (1 != LIST_LENGTH(pFunc->pParameterList)) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } - - uint8_t paraType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type; - if (paraType == TSDB_DATA_TYPE_VARBINARY || - (!IS_STR_DATA_TYPE(paraType) && !IS_NULL_TYPE(paraType))) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - + FUNC_ERR_RET(validateParam(pFunc, pErrBuf, len)); pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_UTINYINT].bytes, .type = TSDB_DATA_TYPE_UTINYINT}; return TSDB_CODE_SUCCESS; } -static int32_t translatePosition(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - if (2 != LIST_LENGTH(pFunc->pParameterList)) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } - - uint8_t para0Type = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type; - if (para0Type == TSDB_DATA_TYPE_VARBINARY || - (!IS_STR_DATA_TYPE(para0Type) && !IS_NULL_TYPE(para0Type))) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - - uint8_t para1Type = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 1))->type; - if (para1Type == TSDB_DATA_TYPE_VARBINARY || - (!IS_STR_DATA_TYPE(para1Type) && !IS_NULL_TYPE(para1Type))) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - - pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_BIGINT].bytes, .type = TSDB_DATA_TYPE_BIGINT}; - return TSDB_CODE_SUCCESS; -} - static int32_t translateTrim(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - if (2 != LIST_LENGTH(pFunc->pParameterList) && 1 != LIST_LENGTH(pFunc->pParameterList)) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } + FUNC_ERR_RET(validateParam(pFunc, pErrBuf, len)); - uint8_t para0Type = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type; - if (para0Type == TSDB_DATA_TYPE_VARBINARY || - (!IS_STR_DATA_TYPE(para0Type) && !IS_NULL_TYPE(para0Type))) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } + uint8_t para0Type = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type; int32_t resLen = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->bytes; uint8_t type = para0Type; if (2 == LIST_LENGTH(pFunc->pParameterList)) { uint8_t para1Type = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 1))->type; - if (para1Type == TSDB_DATA_TYPE_VARBINARY || - (!IS_STR_DATA_TYPE(para1Type) && !IS_NULL_TYPE(para1Type))) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } resLen = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 1))->bytes; type = para1Type; } @@ -2414,17 +1338,7 @@ static int32_t translateTrim(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { } static int32_t translateReplace(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - if (3 != LIST_LENGTH(pFunc->pParameterList)) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } - - for (int32_t i = 0; i < 3; ++i) { - uint8_t paraType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, i))->type; - if (paraType == TSDB_DATA_TYPE_VARBINARY || - (!IS_STR_DATA_TYPE(paraType) && !IS_NULL_TYPE(paraType))) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - } + FUNC_ERR_RET(validateParam(pFunc, pErrBuf, len)); uint8_t orgType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type; uint8_t fromType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 1))->type; @@ -2448,20 +1362,7 @@ static int32_t translateReplace(SFunctionNode* pFunc, char* pErrBuf, int32_t len } static int32_t translateRepeat(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - if (2 != LIST_LENGTH(pFunc->pParameterList)) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } - - uint8_t para0Type = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type; - if (para0Type == TSDB_DATA_TYPE_VARBINARY || - (!IS_STR_DATA_TYPE(para0Type) && !IS_NULL_TYPE(para0Type))) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - - uint8_t para1Type = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 1))->type; - if (!IS_INTEGER_TYPE(para1Type) && !IS_NULL_TYPE(para1Type)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } + FUNC_ERR_RET(validateParam(pFunc, pErrBuf, len)); uint8_t type = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type; int32_t orgLen = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->bytes; @@ -2497,292 +1398,97 @@ static int32_t translateCast(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { } else { return buildFuncErrMsg(pErrBuf, len, TSDB_CODE_FUNC_FUNTION_ERROR, "CAST function converted length should be in range (0, %d] bytes", - TSDB_MAX_BINARY_LEN - VARSTR_HEADER_SIZE); - } - } - - // add database precision as param - uint8_t dbPrec = pFunc->node.resType.precision; - int32_t code = addUint8Param(&pFunc->pParameterList, dbPrec); - if (code != TSDB_CODE_SUCCESS) { - return code; - } - - return TSDB_CODE_SUCCESS; -} - -static int32_t translateToIso8601(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - int32_t numOfParams = LIST_LENGTH(pFunc->pParameterList); - if (1 != numOfParams && 2 != numOfParams) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } - - // param0 - uint8_t paraType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type; - if (!IS_INTEGER_TYPE(paraType) && !IS_TIMESTAMP_TYPE(paraType)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - - // param1 - if (numOfParams == 2) { - SNode* pNode = (SNode*)nodesListGetNode(pFunc->pParameterList, 1); - if (QUERY_NODE_VALUE != nodeType(pNode)) { - return buildFuncErrMsg(pErrBuf, len, TSDB_CODE_FUNC_FUNTION_ERROR, "Not supported timzone format"); - } - - SValueNode* pValue = (SValueNode*)pNode; - if (!validateTimezoneFormat(pValue)) { - return buildFuncErrMsg(pErrBuf, len, TSDB_CODE_FUNC_FUNTION_ERROR, "Invalid timzone format"); - } - } else { // add default client timezone - int32_t code = addTimezoneParam(pFunc->pParameterList); - if (code != TSDB_CODE_SUCCESS) { - return code; - } - } - - // set result type - pFunc->node.resType = (SDataType){.bytes = 64, .type = TSDB_DATA_TYPE_BINARY}; - return TSDB_CODE_SUCCESS; -} - -static int32_t translateToUnixtimestamp(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - int32_t numOfParams = LIST_LENGTH(pFunc->pParameterList); - int16_t resType = TSDB_DATA_TYPE_BIGINT; - - if (1 != numOfParams && 2 != numOfParams) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } - - uint8_t para1Type = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type; - if (para1Type == TSDB_DATA_TYPE_VARBINARY || !IS_STR_DATA_TYPE(para1Type)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - - if (2 == numOfParams) { - uint8_t para2Type = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 1))->type; - if (!IS_INTEGER_TYPE(para2Type)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - - SValueNode* pValue = (SValueNode*)nodesListGetNode(pFunc->pParameterList, 1); - if (pValue->datum.i == 1) { - resType = TSDB_DATA_TYPE_TIMESTAMP; - } else if (pValue->datum.i == 0) { - resType = TSDB_DATA_TYPE_BIGINT; - } else { - return buildFuncErrMsg(pErrBuf, len, TSDB_CODE_FUNC_FUNTION_ERROR, - "TO_UNIXTIMESTAMP function second parameter should be 0/1"); - } - } - - // add database precision as param - uint8_t dbPrec = pFunc->node.resType.precision; - int32_t code = addUint8Param(&pFunc->pParameterList, dbPrec); - if (code != TSDB_CODE_SUCCESS) { - return code; - } - - pFunc->node.resType = (SDataType){.bytes = tDataTypes[resType].bytes, .type = resType}; - return TSDB_CODE_SUCCESS; -} - -static int32_t translateToTimestamp(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - if (LIST_LENGTH(pFunc->pParameterList) != 2) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } - uint8_t para1Type = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type; - uint8_t para2Type = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 1))->type; - if (!IS_STR_DATA_TYPE(para1Type) || !IS_STR_DATA_TYPE(para2Type)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - pFunc->node.resType = - (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_TIMESTAMP].bytes, .type = TSDB_DATA_TYPE_TIMESTAMP}; - return TSDB_CODE_SUCCESS; -} - -static int32_t translateToChar(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - if (LIST_LENGTH(pFunc->pParameterList) != 2) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } - uint8_t para1Type = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type; - uint8_t para2Type = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 1))->type; - // currently only support to_char(timestamp, str) - if (!IS_STR_DATA_TYPE(para2Type) || !IS_TIMESTAMP_TYPE(para1Type)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - pFunc->node.resType = (SDataType){.bytes = 4096, .type = TSDB_DATA_TYPE_VARCHAR}; - return TSDB_CODE_SUCCESS; -} - -static int32_t translateTimeTruncate(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - int32_t numOfParams = LIST_LENGTH(pFunc->pParameterList); - if (2 != numOfParams && 3 != numOfParams) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } - - uint8_t para1Type = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type; - uint8_t para2Type = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 1))->type; - if ((!IS_STR_DATA_TYPE(para1Type) && !IS_INTEGER_TYPE(para1Type) && !IS_TIMESTAMP_TYPE(para1Type)) || - !IS_INTEGER_TYPE(para2Type)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - - uint8_t dbPrec = pFunc->node.resType.precision; - int32_t code = validateTimeUnitParam(dbPrec, (SValueNode*)nodesListGetNode(pFunc->pParameterList, 1)); - if (code == TSDB_CODE_FUNC_TIME_UNIT_TOO_SMALL) { - return buildFuncErrMsg(pErrBuf, len, code, - "TIMETRUNCATE function time unit parameter should be greater than db precision"); - } else if (code == TSDB_CODE_FUNC_TIME_UNIT_INVALID) { - return buildFuncErrMsg( - pErrBuf, len, code, - "TIMETRUNCATE function time unit parameter should be one of the following: [1b, 1u, 1a, 1s, 1m, 1h, 1d, 1w]"); - } - - if (3 == numOfParams) { - uint8_t para3Type = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 2))->type; - if (!IS_INTEGER_TYPE(para3Type)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - SValueNode* pValue = (SValueNode*)nodesListGetNode(pFunc->pParameterList, 2); - if (pValue->datum.i != 0 && pValue->datum.i != 1) { - return invaildFuncParaValueErrMsg(pErrBuf, len, pFunc->functionName); - } - } - - // add database precision as param - - code = addUint8Param(&pFunc->pParameterList, dbPrec); - if (code != TSDB_CODE_SUCCESS) { - return code; - } - - // add client timezone as param - code = addTimezoneParam(pFunc->pParameterList); - if (code != TSDB_CODE_SUCCESS) { - return code; - } - - pFunc->node.resType = - (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_TIMESTAMP].bytes, .type = TSDB_DATA_TYPE_TIMESTAMP}; - return TSDB_CODE_SUCCESS; -} - -static int32_t translateTimeDiff(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - int32_t numOfParams = LIST_LENGTH(pFunc->pParameterList); - if (2 != numOfParams && 3 != numOfParams) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } - - for (int32_t i = 0; i < 2; ++i) { - uint8_t paraType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, i))->type; - if (!IS_STR_DATA_TYPE(paraType) && !IS_INTEGER_TYPE(paraType) && !IS_TIMESTAMP_TYPE(paraType) && !IS_NULL_TYPE(paraType)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - } - uint8_t para2Type; - if (3 == numOfParams) { - para2Type = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 2))->type; - if (!IS_INTEGER_TYPE(para2Type) && !IS_NULL_TYPE(para2Type)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - } - - // add database precision as param - uint8_t dbPrec = pFunc->node.resType.precision; - - if (3 == numOfParams && !IS_NULL_TYPE(para2Type)) { - int32_t code = validateTimeUnitParam(dbPrec, (SValueNode*)nodesListGetNode(pFunc->pParameterList, 2)); - if (code == TSDB_CODE_FUNC_TIME_UNIT_TOO_SMALL) { - return buildFuncErrMsg(pErrBuf, len, code, - "TIMEDIFF function time unit parameter should be greater than db precision"); - } else if (code == TSDB_CODE_FUNC_TIME_UNIT_INVALID) { - return buildFuncErrMsg( - pErrBuf, len, code, - "TIMEDIFF function time unit parameter should be one of the following: [1b, 1u, 1a, 1s, 1m, 1h, 1d, 1w]"); + TSDB_MAX_BINARY_LEN - VARSTR_HEADER_SIZE); } } + // add database precision as param + uint8_t dbPrec = pFunc->node.resType.precision; int32_t code = addUint8Param(&pFunc->pParameterList, dbPrec); if (code != TSDB_CODE_SUCCESS) { return code; } - pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_BIGINT].bytes, .type = TSDB_DATA_TYPE_BIGINT}; return TSDB_CODE_SUCCESS; } -static int32_t translateWeekday(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - if (1 != LIST_LENGTH(pFunc->pParameterList)) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); +static int32_t translateToIso8601(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { + FUNC_ERR_RET(validateParam(pFunc, pErrBuf, len)); + int32_t numOfParams = LIST_LENGTH(pFunc->pParameterList); + // param1 + if (numOfParams == 2) { + SValueNode* pValue = (SValueNode*)nodesListGetNode(pFunc->pParameterList, 1); + if (!validateTimezoneFormat(pValue)) { + return buildFuncErrMsg(pErrBuf, len, TSDB_CODE_FUNC_FUNTION_ERROR, "Invalid timzone format"); + } + } else { // add default client timezone + int32_t code = addTimezoneParam(pFunc->pParameterList); + if (code != TSDB_CODE_SUCCESS) { + return code; + } } - uint8_t para1Type = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type; - if ((!IS_STR_DATA_TYPE(para1Type) && !IS_INTEGER_TYPE(para1Type) && - !IS_TIMESTAMP_TYPE(para1Type) && !IS_NULL_TYPE(para1Type))) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); + // set result type + pFunc->node.resType = (SDataType){.bytes = 64, .type = TSDB_DATA_TYPE_BINARY}; + return TSDB_CODE_SUCCESS; +} + +static int32_t translateToUnixtimestamp(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { + FUNC_ERR_RET(validateParam(pFunc, pErrBuf, len)); + int32_t numOfParams = LIST_LENGTH(pFunc->pParameterList); + int16_t resType = TSDB_DATA_TYPE_BIGINT; + if (2 == numOfParams) { + SValueNode* pValue = (SValueNode*)nodesListGetNode(pFunc->pParameterList, 1); + if (pValue->datum.i == 1) { + resType = TSDB_DATA_TYPE_TIMESTAMP; + } else if (pValue->datum.i == 0) { + resType = TSDB_DATA_TYPE_BIGINT; + } else { + return buildFuncErrMsg(pErrBuf, len, TSDB_CODE_FUNC_FUNTION_ERROR, + "TO_UNIXTIMESTAMP function second parameter should be 0/1"); + } } // add database precision as param uint8_t dbPrec = pFunc->node.resType.precision; - int32_t code = addUint8Param(&pFunc->pParameterList, dbPrec); if (code != TSDB_CODE_SUCCESS) { return code; } - pFunc->node.resType = - (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_BIGINT].bytes, .type = TSDB_DATA_TYPE_BIGINT}; + pFunc->node.resType = (SDataType){.bytes = tDataTypes[resType].bytes, .type = resType}; return TSDB_CODE_SUCCESS; } -static int32_t translateWeek(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - if (1 != LIST_LENGTH(pFunc->pParameterList) && 2 != LIST_LENGTH(pFunc->pParameterList)) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } - - uint8_t para1Type = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type; - if ((!IS_STR_DATA_TYPE(para1Type) && !IS_INTEGER_TYPE(para1Type) && - !IS_TIMESTAMP_TYPE(para1Type)) && !IS_NULL_TYPE(para1Type)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - - if (2 == LIST_LENGTH(pFunc->pParameterList)) { - uint8_t para2Type = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 1))->type; - if (!IS_INTEGER_TYPE(para2Type) && !IS_NULL_TYPE(para2Type)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - if (IS_INTEGER_TYPE(para2Type)) { - SValueNode* pValue = (SValueNode*)nodesListGetNode(pFunc->pParameterList, 1); - if (pValue->datum.i < 0 || pValue->datum.i > 7) { - return invaildFuncParaValueErrMsg(pErrBuf, len, pFunc->functionName); - } - } - } +static int32_t translateToTimestamp(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { + FUNC_ERR_RET(validateParam(pFunc, pErrBuf, len)); + pFunc->node.resType = + (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_TIMESTAMP].bytes, .type = TSDB_DATA_TYPE_TIMESTAMP}; + return TSDB_CODE_SUCCESS; +} - // add database precision as param +static int32_t translateTimeTruncate(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { + FUNC_ERR_RET(validateParam(pFunc, pErrBuf, len)); uint8_t dbPrec = pFunc->node.resType.precision; - + // add database precision as param int32_t code = addUint8Param(&pFunc->pParameterList, dbPrec); if (code != TSDB_CODE_SUCCESS) { return code; } + // add client timezone as param + code = addTimezoneParam(pFunc->pParameterList); + if (code != TSDB_CODE_SUCCESS) { + return code; + } + pFunc->node.resType = - (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_BIGINT].bytes, .type = TSDB_DATA_TYPE_BIGINT}; + (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_TIMESTAMP].bytes, .type = TSDB_DATA_TYPE_TIMESTAMP}; return TSDB_CODE_SUCCESS; } -static int32_t translateWeekofyear(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - if (1 != LIST_LENGTH(pFunc->pParameterList)) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } - - uint8_t para1Type = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type; - if ((!IS_STR_DATA_TYPE(para1Type) && !IS_INTEGER_TYPE(para1Type) && - !IS_TIMESTAMP_TYPE(para1Type)) && !IS_NULL_TYPE(para1Type)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } +static int32_t translateAddPrecOutBigint(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { + FUNC_ERR_RET(validateParam(pFunc, pErrBuf, len)); // add database precision as param uint8_t dbPrec = pFunc->node.resType.precision; @@ -2798,78 +1504,27 @@ static int32_t translateWeekofyear(SFunctionNode* pFunc, char* pErrBuf, int32_t } static int32_t translateToJson(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - if (1 != LIST_LENGTH(pFunc->pParameterList)) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } - - SExprNode* pPara = (SExprNode*)nodesListGetNode(pFunc->pParameterList, 0); - if (QUERY_NODE_VALUE != nodeType(pPara) || TSDB_DATA_TYPE_VARBINARY == pPara->resType.type || (!IS_VAR_DATA_TYPE(pPara->resType.type))) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - + FUNC_ERR_RET(validateParam(pFunc, pErrBuf, len)); pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_JSON].bytes, .type = TSDB_DATA_TYPE_JSON}; return TSDB_CODE_SUCCESS; } -static int32_t translateInStrOutGeom(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - if (1 != LIST_LENGTH(pFunc->pParameterList)) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } - - uint8_t para1Type = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type; - if (!IS_STR_DATA_TYPE(para1Type) && !IS_NULL_TYPE(para1Type)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - +static int32_t translateOutGeom(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { + FUNC_ERR_RET(validateParam(pFunc, pErrBuf, len)); pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_GEOMETRY].bytes, .type = TSDB_DATA_TYPE_GEOMETRY}; return TSDB_CODE_SUCCESS; } static int32_t translateInGeomOutStr(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - if (1 != LIST_LENGTH(pFunc->pParameterList)) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } - - uint8_t para1Type = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type; - if (para1Type != TSDB_DATA_TYPE_GEOMETRY && !IS_NULL_TYPE(para1Type)) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - + FUNC_ERR_RET(validateParam(pFunc, pErrBuf, len)); pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_VARCHAR].bytes, .type = TSDB_DATA_TYPE_VARCHAR}; return TSDB_CODE_SUCCESS; } -static int32_t translateIn2NumOutGeom(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - if (2 != LIST_LENGTH(pFunc->pParameterList)) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } - - uint8_t para1Type = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type; - uint8_t para2Type = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 1))->type; - if ((!IS_NUMERIC_TYPE(para1Type) && !IS_NULL_TYPE(para1Type)) || - (!IS_NUMERIC_TYPE(para2Type) && !IS_NULL_TYPE(para2Type))) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - - pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_GEOMETRY].bytes, .type = TSDB_DATA_TYPE_GEOMETRY}; - - return TSDB_CODE_SUCCESS; -} - static int32_t translateIn2GeomOutBool(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - if (2 != LIST_LENGTH(pFunc->pParameterList)) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } - - uint8_t para1Type = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type; - uint8_t para2Type = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 1))->type; - if ((para1Type != TSDB_DATA_TYPE_GEOMETRY && !IS_NULL_TYPE(para1Type)) || - (para2Type != TSDB_DATA_TYPE_GEOMETRY && !IS_NULL_TYPE(para2Type))) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - } - + FUNC_ERR_RET(validateParam(pFunc, pErrBuf, len)); pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_BOOL].bytes, .type = TSDB_DATA_TYPE_BOOL}; return TSDB_CODE_SUCCESS; @@ -2885,11 +1540,6 @@ static int32_t translateBlockDistFunc(SFunctionNode* pFunc, char* pErrBuf, int32 return TSDB_CODE_SUCCESS; } -static int32_t translateBlockDistInfoFunc(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - pFunc->node.resType = (SDataType){.bytes = 128, .type = TSDB_DATA_TYPE_VARCHAR}; - return TSDB_CODE_SUCCESS; -} - static bool getBlockDistFuncEnv(SFunctionNode* UNUSED_PARAM(pFunc), SFuncExecEnv* pEnv) { pEnv->calcMemSize = sizeof(STableBlockDistInfo); return true; @@ -2899,63 +1549,104 @@ static int32_t translateGroupKey(SFunctionNode* pFunc, char* pErrBuf, int32_t le if (1 != LIST_LENGTH(pFunc->pParameterList)) { return TSDB_CODE_SUCCESS; } - - SNode* pPara = nodesListGetNode(pFunc->pParameterList, 0); - pFunc->node.resType = ((SExprNode*)pPara)->resType; - return TSDB_CODE_SUCCESS; -} - -static int32_t translateDatabaseFunc(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - pFunc->node.resType = (SDataType){.bytes = TSDB_DB_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR}; - return TSDB_CODE_SUCCESS; -} - -static int32_t translateClientVersionFunc(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - pFunc->node.resType = (SDataType){.bytes = TSDB_VERSION_LEN, .type = TSDB_DATA_TYPE_VARCHAR}; + pFunc->node.resType = *getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0)); return TSDB_CODE_SUCCESS; } -static int32_t translateServerVersionFunc(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - pFunc->node.resType = (SDataType){.bytes = TSDB_VERSION_LEN, .type = TSDB_DATA_TYPE_VARCHAR}; - return TSDB_CODE_SUCCESS; -} static int32_t translateServerStatusFunc(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_INT].bytes, .type = TSDB_DATA_TYPE_INT}; return TSDB_CODE_SUCCESS; } -static int32_t translateCurrentUserFunc(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - pFunc->node.resType = (SDataType){.bytes = TSDB_USER_LEN, .type = TSDB_DATA_TYPE_VARCHAR}; - return TSDB_CODE_SUCCESS; -} - -static int32_t translateUserFunc(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - pFunc->node.resType = (SDataType){.bytes = TSDB_USER_LEN, .type = TSDB_DATA_TYPE_VARCHAR}; - return TSDB_CODE_SUCCESS; -} - static int32_t translateTagsPseudoColumn(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { // The _tags pseudo-column will be expanded to the actual tags on the client side return TSDB_CODE_SUCCESS; } -static int32_t translateTableCountPseudoColumn(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_BIGINT].bytes, .type = TSDB_DATA_TYPE_BIGINT}; - return TSDB_CODE_SUCCESS; -} - -static int32_t translateMd5(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - if (1 != LIST_LENGTH(pFunc->pParameterList)) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); - } - - uint8_t para1Type = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type; - if (para1Type != TSDB_DATA_TYPE_VARCHAR) { - return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); +static int32_t translateOutVarchar(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { + FUNC_ERR_RET(validateParam(pFunc, pErrBuf, len)); + int32_t bytes = 0; + switch (pFunc->funcType) { + case FUNCTION_TYPE_MD5: + bytes = MD5_OUTPUT_LEN + VARSTR_HEADER_SIZE; + break; + case FUNCTION_TYPE_USER: + case FUNCTION_TYPE_CURRENT_USER: + bytes = TSDB_USER_LEN; + break; + case FUNCTION_TYPE_SERVER_VERSION: + case FUNCTION_TYPE_CLIENT_VERSION: + bytes = TSDB_VERSION_LEN; + break; + case FUNCTION_TYPE_DATABASE: + bytes = TSDB_DB_NAME_LEN; + break; + case FUNCTION_TYPE_BLOCK_DIST: + case FUNCTION_TYPE_BLOCK_DIST_INFO: + bytes = 128; + break; + case FUNCTION_TYPE_TO_CHAR: + bytes = 4096; + break; + case FUNCTION_TYPE_HYPERLOGLOG_STATE_MERGE: + case FUNCTION_TYPE_HYPERLOGLOG_PARTIAL: + case FUNCTION_TYPE_HYPERLOGLOG_STATE: + bytes = getHistogramInfoSize() + VARSTR_HEADER_SIZE; + break; + case FUNCTION_TYPE_SPREAD_PARTIAL: + case FUNCTION_TYPE_SPREAD_STATE: + case FUNCTION_TYPE_SPREAD_STATE_MERGE: + bytes = getSpreadInfoSize() + VARSTR_HEADER_SIZE; + break; + case FUNCTION_TYPE_APERCENTILE_PARTIAL: + bytes = getApercentileMaxSize() + VARSTR_HEADER_SIZE; + break; + case FUNCTION_TYPE_STD_STATE: + case FUNCTION_TYPE_STD_STATE_MERGE: + case FUNCTION_TYPE_STD_PARTIAL: + bytes = getStdInfoSize() + VARSTR_HEADER_SIZE; + break; + case FUNCTION_TYPE_AVG_PARTIAL: + case FUNCTION_TYPE_AVG_STATE: + case FUNCTION_TYPE_AVG_STATE_MERGE: + bytes = getAvgInfoSize() + VARSTR_HEADER_SIZE; + break; + case FUNCTION_TYPE_HISTOGRAM_PARTIAL: + bytes = getHistogramInfoSize() + VARSTR_HEADER_SIZE; + break; + case FUNCTION_TYPE_HISTOGRAM: + case FUNCTION_TYPE_HISTOGRAM_MERGE: + bytes = 512; + break; + case FUNCTION_TYPE_LEASTSQUARES: + bytes = LEASTSQUARES_BUFF_LENGTH; + break; + case FUNCTION_TYPE_TBNAME: + bytes = TSDB_TABLE_FNAME_LEN - 1 + VARSTR_HEADER_SIZE; + break; + case FUNCTION_TYPE_TIMEZONE: + bytes = TD_TIMEZONE_LEN; + break; + case FUNCTION_TYPE_IRATE_PARTIAL: + bytes = getIrateInfoSize((pFunc->hasPk) ? pFunc->pkBytes : 0) + VARSTR_HEADER_SIZE; + break; + case FUNCTION_TYPE_FIRST_PARTIAL: + case FUNCTION_TYPE_LAST_PARTIAL: + case FUNCTION_TYPE_FIRST_STATE: + case FUNCTION_TYPE_LAST_STATE: + bytes = getFirstLastInfoSize(getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->bytes, + (pFunc->hasPk) ? pFunc->pkBytes : 0) + VARSTR_HEADER_SIZE; + break; + case FUNCTION_TYPE_FIRST_STATE_MERGE: + case FUNCTION_TYPE_LAST_STATE_MERGE: + bytes = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->bytes; + break; + default: + bytes = 0; + break; } - - pFunc->node.resType = (SDataType){.bytes = MD5_OUTPUT_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}; + pFunc->node.resType = (SDataType){.bytes = bytes, .type = TSDB_DATA_TYPE_VARCHAR}; return TSDB_CODE_SUCCESS; } @@ -2965,7 +1656,20 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "count", .type = FUNCTION_TYPE_COUNT, .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SPECIAL_DATA_REQUIRED | FUNC_MGT_IGNORE_NULL_FUNC | FUNC_MGT_TSMA_FUNC | FUNC_MGT_COUNT_LIKE_FUNC, - .translateFunc = translateCount, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_ALL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_BIGINT_TYPE}}, + .translateFunc = translateOutBigInt, .dataRequiredFunc = countDataRequired, .getEnvFunc = getCountFuncEnv, .initFunc = functionSetup, @@ -2984,6 +1688,18 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "sum", .type = FUNCTION_TYPE_SUM, .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SPECIAL_DATA_REQUIRED | FUNC_MGT_IGNORE_NULL_FUNC | FUNC_MGT_TSMA_FUNC, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_BIGINT_TYPE | FUNC_PARAM_SUPPORT_DOUBLE_TYPE | FUNC_PARAM_SUPPORT_UBIGINT_TYPE}}, .translateFunc = translateSum, .dataRequiredFunc = statisDataRequired, .getEnvFunc = getSumFuncEnv, @@ -3003,6 +1719,18 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "min", .type = FUNCTION_TYPE_MIN, .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SPECIAL_DATA_REQUIRED | FUNC_MGT_SELECT_FUNC | FUNC_MGT_IGNORE_NULL_FUNC | FUNC_MGT_TSMA_FUNC, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_STRING_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_STRING_TYPE}}, .translateFunc = translateMinMax, .dataRequiredFunc = statisDataRequired, .getEnvFunc = getMinmaxFuncEnv, @@ -3019,6 +1747,18 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "max", .type = FUNCTION_TYPE_MAX, .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SPECIAL_DATA_REQUIRED | FUNC_MGT_SELECT_FUNC | FUNC_MGT_IGNORE_NULL_FUNC | FUNC_MGT_TSMA_FUNC, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_STRING_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_STRING_TYPE}}, .translateFunc = translateMinMax, .dataRequiredFunc = statisDataRequired, .getEnvFunc = getMinmaxFuncEnv, @@ -3035,7 +1775,20 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "stddev", .type = FUNCTION_TYPE_STDDEV, .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_TSMA_FUNC, - .translateFunc = translateInNumOutDou, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, + .translateFunc = translateOutDouble, .getEnvFunc = getStdFuncEnv, .initFunc = stdFunctionSetup, .processFunc = stdFunction, @@ -3053,7 +1806,19 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "_std_partial", .type = FUNCTION_TYPE_STD_PARTIAL, .classification = FUNC_MGT_AGG_FUNC, - .translateFunc = translateStdPartial, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, + .translateFunc = translateOutVarchar, .getEnvFunc = getStdFuncEnv, .initFunc = stdFunctionSetup, .processFunc = stdFunction, @@ -3067,7 +1832,19 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "_stddev_merge", .type = FUNCTION_TYPE_STDDEV_MERGE, .classification = FUNC_MGT_AGG_FUNC, - .translateFunc = translateStdMerge, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, + .translateFunc = translateOutDouble, .getEnvFunc = getStdFuncEnv, .initFunc = stdFunctionSetup, .processFunc = stdFunctionMerge, @@ -3083,7 +1860,27 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "leastsquares", .type = FUNCTION_TYPE_LEASTSQUARES, .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_FORBID_STREAM_FUNC | FUNC_MGT_FORBID_SYSTABLE_FUNC, - .translateFunc = translateLeastSQR, + .parameters = {.minParamNum = 3, + .maxParamNum = 3, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = false, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isFixedValue = false, + .hasRange = false}, + .inputParaInfo[0][1] = {.isLastParam = true, + .startParam = 2, + .endParam = 3, + .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, + .isPK = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, + .translateFunc = translateOutVarchar, .getEnvFunc = getLeastSQRFuncEnv, .initFunc = leastSQRFunctionSetup, .processFunc = leastSQRFunction, @@ -3098,7 +1895,20 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "avg", .type = FUNCTION_TYPE_AVG, .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SPECIAL_DATA_REQUIRED | FUNC_MGT_IGNORE_NULL_FUNC | FUNC_MGT_TSMA_FUNC, - .translateFunc = translateInNumOutDou, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, + .translateFunc = translateOutDouble, .dataRequiredFunc = statisDataRequired, .getEnvFunc = getAvgFuncEnv, .initFunc = avgFunctionSetup, @@ -3118,7 +1928,19 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "_avg_partial", .type = FUNCTION_TYPE_AVG_PARTIAL, .classification = FUNC_MGT_AGG_FUNC, - .translateFunc = translateAvgPartial, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, + .translateFunc = translateOutVarchar, .dataRequiredFunc = statisDataRequired, .getEnvFunc = getAvgFuncEnv, .initFunc = avgFunctionSetup, @@ -3133,7 +1955,19 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "_avg_merge", .type = FUNCTION_TYPE_AVG_MERGE, .classification = FUNC_MGT_AGG_FUNC, - .translateFunc = translateAvgMerge, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, + .translateFunc = translateOutDouble, .getEnvFunc = getAvgFuncEnv, .initFunc = avgFunctionSetup, .processFunc = avgFunctionMerge, @@ -3149,6 +1983,27 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "percentile", .type = FUNCTION_TYPE_PERCENTILE, .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_REPEAT_SCAN_FUNC | FUNC_MGT_SPECIAL_DATA_REQUIRED | FUNC_MGT_FORBID_STREAM_FUNC, + .parameters = {.minParamNum = 2, + .maxParamNum = 11, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = false, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isFixedValue = false, + .hasRange = false}, + .inputParaInfo[0][1] = {.isLastParam = true, + .startParam = 2, + .endParam = 11, + .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, + .isPK = false, + .isFixedValue = false, + .hasRange = true, + .range = {.dMinVal = 0.0, .dMaxVal = 100.0}}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, .translateFunc = translatePercentile, .dataRequiredFunc = statisDataRequired, .getEnvFunc = getPercentileFuncEnv, @@ -3166,7 +2021,38 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "apercentile", .type = FUNCTION_TYPE_APERCENTILE, .classification = FUNC_MGT_AGG_FUNC, - .translateFunc = translateApercentile, + .parameters = {.minParamNum = 2, + .maxParamNum = 3, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = false, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isFixedValue = false, + .hasRange = false}, + .inputParaInfo[0][1] = {.isLastParam = false, + .startParam = 2, + .endParam = 2, + .validDataType = FUNC_PARAM_SUPPORT_INTEGER_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, + .isPK = false, + .isFixedValue = false, + .hasRange = true, + .range = {.dMinVal = 0.0, .dMaxVal = 100.0}}, + .inputParaInfo[0][2] = {.isLastParam = true, + .startParam = 3, + .endParam = 3, + .validDataType = FUNC_PARAM_SUPPORT_STRING_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, + .isPK = false, + .isFixedValue = true, + .hasRange = false, + .fixedValueSize = 2, + .fixedStrValue = {"default", "t-digest"}}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, + .translateFunc = translateOutDouble, .getEnvFunc = getApercentileFuncEnv, .initFunc = apercentileFunctionSetup, .processFunc = apercentileFunction, @@ -3184,7 +2070,38 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "_apercentile_partial", .type = FUNCTION_TYPE_APERCENTILE_PARTIAL, .classification = FUNC_MGT_AGG_FUNC, - .translateFunc = translateApercentilePartial, + .parameters = {.minParamNum = 2, + .maxParamNum = 3, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = false, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isFixedValue = false, + .hasRange = false}, + .inputParaInfo[0][1] = {.isLastParam = false, + .startParam = 2, + .endParam = 2, + .validDataType = FUNC_PARAM_SUPPORT_INTEGER_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, + .isPK = false, + .isFixedValue = false, + .hasRange = true, + .range = {.dMinVal = 0.0, .dMaxVal = 100.0}}, + .inputParaInfo[0][2] = {.isLastParam = true, + .startParam = 3, + .endParam = 3, + .validDataType = FUNC_PARAM_SUPPORT_STRING_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, + .isPK = false, + .isFixedValue = true, + .hasRange = false, + .fixedValueSize = 2, + .fixedStrValue = {"default", "t-digest"}}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, + .translateFunc = translateOutVarchar, .getEnvFunc = getApercentileFuncEnv, .initFunc = apercentileFunctionSetup, .processFunc = apercentileFunction, @@ -3198,7 +2115,38 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "_apercentile_merge", .type = FUNCTION_TYPE_APERCENTILE_MERGE, .classification = FUNC_MGT_AGG_FUNC, - .translateFunc = translateApercentileMerge, + .parameters = {.minParamNum = 2, + .maxParamNum = 3, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = false, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isFixedValue = false, + .hasRange = false}, + .inputParaInfo[0][1] = {.isLastParam = false, + .startParam = 2, + .endParam = 2, + .validDataType = FUNC_PARAM_SUPPORT_INTEGER_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, + .isPK = false, + .isFixedValue = false, + .hasRange = true, + .range = {.dMinVal = 0.0, .dMaxVal = 100.0}}, + .inputParaInfo[0][2] = {.isLastParam = true, + .startParam = 3, + .endParam = 3, + .validDataType = FUNC_PARAM_SUPPORT_STRING_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, + .isPK = false, + .isFixedValue = true, + .hasRange = false, + .fixedValueSize = 2, + .fixedStrValue = {"default", "t-digest"}}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, + .translateFunc = translateOutDouble, .getEnvFunc = getApercentileFuncEnv, .initFunc = apercentileFunctionSetup, .processFunc = apercentileFunctionMerge, @@ -3213,7 +2161,28 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .type = FUNCTION_TYPE_TOP, .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_MULTI_ROWS_FUNC | FUNC_MGT_KEEP_ORDER_FUNC | FUNC_MGT_FORBID_STREAM_FUNC | FUNC_MGT_FORBID_FILL_FUNC | FUNC_MGT_IGNORE_NULL_FUNC, - .translateFunc = translateTopBot, + .parameters = {.minParamNum = 2, + .maxParamNum = 2, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = false, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isFixedValue = false, + .hasRange = false}, + .inputParaInfo[0][1] = {.isLastParam = true, + .startParam = 2, + .endParam = 2, + .validDataType = FUNC_PARAM_SUPPORT_INTEGER_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, + .isPK = false, + .isFixedValue = false, + .hasRange = true, + .range = {.dMinVal = 1.0, .dMaxVal = TOP_BOTTOM_QUERY_LIMIT}}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE}}, + .translateFunc = translateOutFirstIn, .getEnvFunc = getTopBotFuncEnv, .initFunc = topBotFunctionSetup, .processFunc = topFunction, @@ -3229,7 +2198,28 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .type = FUNCTION_TYPE_BOTTOM, .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_MULTI_ROWS_FUNC | FUNC_MGT_KEEP_ORDER_FUNC | FUNC_MGT_FORBID_STREAM_FUNC | FUNC_MGT_FORBID_FILL_FUNC | FUNC_MGT_IGNORE_NULL_FUNC, - .translateFunc = translateTopBot, + .parameters = {.minParamNum = 2, + .maxParamNum = 2, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = false, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isFixedValue = false, + .hasRange = false}, + .inputParaInfo[0][1] = {.isLastParam = true, + .startParam = 2, + .endParam = 2, + .validDataType = FUNC_PARAM_SUPPORT_INTEGER_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, + .isPK = false, + .isFixedValue = false, + .hasRange = true, + .range = {.dMinVal = 1.0, .dMaxVal = TOP_BOTTOM_QUERY_LIMIT}}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE}}, + .translateFunc = translateOutFirstIn, .getEnvFunc = getTopBotFuncEnv, .initFunc = topBotFunctionSetup, .processFunc = bottomFunction, @@ -3244,7 +2234,19 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "spread", .type = FUNCTION_TYPE_SPREAD, .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SPECIAL_DATA_REQUIRED | FUNC_MGT_TSMA_FUNC, - .translateFunc = translateSpread, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_TIMESTAMP_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, + .translateFunc = translateOutDouble, .dataRequiredFunc = statisDataRequired, .getEnvFunc = getSpreadFuncEnv, .initFunc = spreadFunctionSetup, @@ -3263,7 +2265,19 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "_spread_partial", .type = FUNCTION_TYPE_SPREAD_PARTIAL, .classification = FUNC_MGT_AGG_FUNC, - .translateFunc = translateSpreadPartial, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_TIMESTAMP_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, + .translateFunc = translateOutVarchar, .dataRequiredFunc = statisDataRequired, .getEnvFunc = getSpreadFuncEnv, .initFunc = spreadFunctionSetup, @@ -3277,8 +2291,20 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { { .name = "_spread_merge", .type = FUNCTION_TYPE_SPREAD_MERGE, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, .classification = FUNC_MGT_AGG_FUNC, - .translateFunc = translateSpreadMerge, + .translateFunc = translateOutDouble, .dataRequiredFunc = statisDataRequired, .getEnvFunc = getSpreadFuncEnv, .initFunc = spreadFunctionSetup, @@ -3296,8 +2322,30 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .type = FUNCTION_TYPE_ELAPSED, .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_TIMELINE_FUNC | FUNC_MGT_INTERVAL_INTERPO_FUNC | FUNC_MGT_FORBID_STREAM_FUNC | FUNC_MGT_FORBID_SYSTABLE_FUNC | FUNC_MGT_SPECIAL_DATA_REQUIRED, + .parameters = {.minParamNum = 1, + .maxParamNum = 2, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = false, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_TIMESTAMP_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_COLUMN_NODE, + .isTs = true, + .isPK = false, + .isFixedValue = false, + .hasRange = false}, + .inputParaInfo[0][1] = {.isLastParam = true, + .startParam = 2, + .endParam = 2, + .validDataType = FUNC_PARAM_SUPPORT_INTEGER_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, + .isPK = false, + .isFixedValue = false, + .hasRange = false, + .isTimeUnit = true}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, .dataRequiredFunc = statisDataRequired, - .translateFunc = translateElapsed, + .translateFunc = translateOutDouble, .getEnvFunc = getElapsedFuncEnv, .initFunc = elapsedFunctionSetup, .processFunc = elapsedFunction, @@ -3342,69 +2390,198 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .type = FUNCTION_TYPE_INTERP, .classification = FUNC_MGT_TIMELINE_FUNC | FUNC_MGT_INTERVAL_INTERPO_FUNC | FUNC_MGT_IMPLICIT_TS_FUNC | FUNC_MGT_FORBID_STREAM_FUNC | FUNC_MGT_FORBID_SYSTABLE_FUNC | FUNC_MGT_KEEP_ORDER_FUNC | FUNC_MGT_PRIMARY_KEY_FUNC, - .translateFunc = translateInterp, + .parameters = {.minParamNum = 1, + .maxParamNum = 2, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = false, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_BOOL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_NOT_VALUE_NODE, + .isPK = false, + .isFixedValue = false, + .hasRange = false}, + .inputParaInfo[0][1] = {.isLastParam = true, + .startParam = 2, + .endParam = 2, + .validDataType = FUNC_PARAM_SUPPORT_INTEGER_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, + .isPK = false, + .isFixedValue = true, + .hasRange = false, + .fixedValueSize = 2, + .fixedNumValue = {0, 1}}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE}}, + .translateFunc = translateOutFirstIn, .getEnvFunc = getSelectivityFuncEnv, .initFunc = functionSetup, .processFunc = NULL, .finalizeFunc = NULL, - .estimateReturnRowsFunc = interpEstReturnRows + .estimateReturnRowsFunc = interpEstReturnRows, }, { .name = "derivative", .type = FUNCTION_TYPE_DERIVATIVE, .classification = FUNC_MGT_INDEFINITE_ROWS_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_TIMELINE_FUNC | FUNC_MGT_IMPLICIT_TS_FUNC | FUNC_MGT_KEEP_ORDER_FUNC | FUNC_MGT_CUMULATIVE_FUNC | FUNC_MGT_FORBID_STREAM_FUNC | FUNC_MGT_FORBID_SYSTABLE_FUNC | FUNC_MGT_PRIMARY_KEY_FUNC, - .translateFunc = translateDerivative, + .parameters = {.minParamNum = 3, + .maxParamNum = 3, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = false, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isFixedValue = false, + .hasRange = false}, + .inputParaInfo[0][1] = {.isLastParam = false, + .startParam = 2, + .endParam = 2, + .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, + .isPK = false, + .isFixedValue = false, + .hasRange = true, + .range = {.dMinVal = 1.0, .dMaxVal = DBL_MAX}}, + .inputParaInfo[0][2] = {.isLastParam = true, + .startParam = 3, + .endParam = 3, + .validDataType = FUNC_PARAM_SUPPORT_INTEGER_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, + .isPK = false, + .isFixedValue = true, + .hasRange = false, + .fixedValueSize = 2, + .fixedNumValue = {0, 1}}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, + .translateFunc = translateOutDouble, .getEnvFunc = getDerivativeFuncEnv, .initFunc = derivativeFuncSetup, .processFunc = derivativeFunction, .sprocessFunc = derivativeScalarFunction, .finalizeFunc = functionFinalize, - .estimateReturnRowsFunc = derivativeEstReturnRows + .estimateReturnRowsFunc = derivativeEstReturnRows, }, { .name = "irate", .type = FUNCTION_TYPE_IRATE, .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_TIMELINE_FUNC | FUNC_MGT_IMPLICIT_TS_FUNC | FUNC_MGT_FORBID_STREAM_FUNC | FUNC_MGT_FORBID_SYSTABLE_FUNC | FUNC_MGT_PRIMARY_KEY_FUNC, - .translateFunc = translateIrate, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, + .translateFunc = translateAddPrecOutDouble, .getEnvFunc = getIrateFuncEnv, .initFunc = irateFuncSetup, .processFunc = irateFunction, .sprocessFunc = irateScalarFunction, .finalizeFunc = irateFinalize, .pPartialFunc = "_irate_partial", - .pMergeFunc = "_irate_merge" + .pMergeFunc = "_irate_merge", }, { .name = "_irate_partial", .type = FUNCTION_TYPE_IRATE_PARTIAL, .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_TIMELINE_FUNC | FUNC_MGT_IMPLICIT_TS_FUNC | FUNC_MGT_FORBID_STREAM_FUNC | FUNC_MGT_FORBID_SYSTABLE_FUNC | FUNC_MGT_PRIMARY_KEY_FUNC, - .translateFunc = translateIratePartial, + .parameters = {.minParamNum = 3, + .maxParamNum = 4, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = false, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isFixedValue = false, + .hasRange = false}, + .inputParaInfo[0][1] = {.isLastParam = false, + .startParam = 2, + .endParam = 2, + .validDataType = FUNC_PARAM_SUPPORT_TINYINT_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .inputParaInfo[0][2] = {.isLastParam = false, + .startParam = 3, + .endParam = 3, + .validDataType = FUNC_PARAM_SUPPORT_TIMESTAMP_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_COLUMN_NODE, + .isPK = false, + .isTs = true, + .isFixedValue = false, + .hasRange = false}, + .inputParaInfo[0][3] = {.isLastParam = true, + .startParam = 4, + .endParam = 4, + .validDataType = FUNC_PARAM_SUPPORT_INTEGER_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_COLUMN_NODE, + .isPK = true, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, + .translateFunc = translateOutVarchar, .getEnvFunc = getIrateFuncEnv, .initFunc = irateFuncSetup, .processFunc = irateFunction, .sprocessFunc = irateScalarFunction, - .finalizeFunc = iratePartialFinalize + .finalizeFunc = iratePartialFinalize, }, { .name = "_irate_merge", .type = FUNCTION_TYPE_IRATE_MERGE, .classification = FUNC_MGT_AGG_FUNC, - .translateFunc = translateIrateMerge, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, + .translateFunc = translateAddPrecOutDouble, .getEnvFunc = getIrateFuncEnv, .initFunc = irateFuncSetup, .processFunc = irateFunctionMerge, .sprocessFunc = irateScalarFunction, - .finalizeFunc = irateFinalize + .finalizeFunc = irateFinalize, }, { .name = "last_row", .type = FUNCTION_TYPE_LAST_ROW, .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_MULTI_RES_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_IMPLICIT_TS_FUNC | FUNC_MGT_KEEP_ORDER_FUNC | FUNC_MGT_FORBID_SYSTABLE_FUNC | FUNC_MGT_PRIMARY_KEY_FUNC, - .translateFunc = translateFirstLast, + .parameters = {.minParamNum = 1, + .maxParamNum = -1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = -1, + .validDataType = FUNC_PARAM_SUPPORT_ALL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isFixedValue = false, + .hasRange = false, + .isFirstLast = true}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_ALL_TYPE}}, + .translateFunc = translateOutFirstIn, .dynDataRequiredFunc = lastDynDataReq, .getEnvFunc = getFirstLastFuncEnv, .initFunc = functionSetup, @@ -3413,35 +2590,74 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .pPartialFunc = "_last_row_partial", .pMergeFunc = "_last_row_merge", .finalizeFunc = firstLastFinalize, - .combineFunc = lastCombine + .combineFunc = lastCombine, }, { .name = "_cache_last_row", .type = FUNCTION_TYPE_CACHE_LAST_ROW, .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_MULTI_RES_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_IMPLICIT_TS_FUNC | FUNC_MGT_FORBID_STREAM_FUNC | FUNC_MGT_FORBID_SYSTABLE_FUNC, - .translateFunc = translateFirstLast, + .parameters = {.minParamNum = 1, + .maxParamNum = -1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = -1, + .validDataType = FUNC_PARAM_SUPPORT_ALL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isFixedValue = false, + .hasRange = false, + .isFirstLast = true}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_ALL_TYPE}}, + .translateFunc = translateOutFirstIn, .getEnvFunc = getFirstLastFuncEnv, .initFunc = functionSetup, .processFunc = cachedLastRowFunction, - .finalizeFunc = firstLastFinalize + .finalizeFunc = firstLastFinalize, }, { .name = "_cache_last", .type = FUNCTION_TYPE_CACHE_LAST, .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_MULTI_RES_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_FORBID_STREAM_FUNC | FUNC_MGT_FORBID_SYSTABLE_FUNC | FUNC_MGT_IGNORE_NULL_FUNC, - .translateFunc = translateFirstLast, + .parameters = {.minParamNum = 1, + .maxParamNum = -1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = -1, + .validDataType = FUNC_PARAM_SUPPORT_ALL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isFixedValue = false, + .hasRange = false, + .isFirstLast = true}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_ALL_TYPE}}, + .translateFunc = translateOutFirstIn, .getEnvFunc = getFirstLastFuncEnv, .initFunc = functionSetup, .processFunc = lastFunctionMerge, - .finalizeFunc = firstLastFinalize + .finalizeFunc = firstLastFinalize, }, { .name = "_last_row_partial", .type = FUNCTION_TYPE_LAST_PARTIAL, .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_MULTI_RES_FUNC | FUNC_MGT_IMPLICIT_TS_FUNC | FUNC_MGT_FORBID_SYSTABLE_FUNC | FUNC_MGT_PRIMARY_KEY_FUNC, - .translateFunc = translateFirstLastPartial, + .parameters = {.minParamNum = 1, + .maxParamNum = -1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = -1, + .validDataType = FUNC_PARAM_SUPPORT_ALL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isFixedValue = false, + .hasRange = false, + .isFirstLast = true}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, + .translateFunc = translateOutVarchar, .dynDataRequiredFunc = lastDynDataReq, .getEnvFunc = getFirstLastFuncEnv, .initFunc = functionSetup, @@ -3453,7 +2669,20 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .type = FUNCTION_TYPE_LAST_MERGE, .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_MULTI_RES_FUNC | FUNC_MGT_IMPLICIT_TS_FUNC | FUNC_MGT_FORBID_SYSTABLE_FUNC | FUNC_MGT_PRIMARY_KEY_FUNC, - .translateFunc = translateFirstLastMerge, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = -1, + .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_ALL_TYPE}}, + .translateFunc = translateOutFirstIn, .getEnvFunc = getFirstLastFuncEnv, .initFunc = functionSetup, .processFunc = lastFunctionMerge, @@ -3464,7 +2693,20 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .type = FUNCTION_TYPE_FIRST, .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_MULTI_RES_FUNC | FUNC_MGT_IMPLICIT_TS_FUNC | FUNC_MGT_KEEP_ORDER_FUNC | FUNC_MGT_FORBID_SYSTABLE_FUNC | FUNC_MGT_IGNORE_NULL_FUNC | FUNC_MGT_PRIMARY_KEY_FUNC | FUNC_MGT_TSMA_FUNC, - .translateFunc = translateFirstLast, + .parameters = {.minParamNum = 1, + .maxParamNum = -1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = -1, + .validDataType = FUNC_PARAM_SUPPORT_ALL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isFixedValue = false, + .hasRange = false, + .isFirstLast = true}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_ALL_TYPE}}, + .translateFunc = translateOutFirstIn, .dynDataRequiredFunc = firstDynDataReq, .getEnvFunc = getFirstLastFuncEnv, .initFunc = functionSetup, @@ -3481,7 +2723,19 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .type = FUNCTION_TYPE_FIRST_PARTIAL, .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_MULTI_RES_FUNC | FUNC_MGT_IMPLICIT_TS_FUNC | FUNC_MGT_FORBID_SYSTABLE_FUNC | FUNC_MGT_IGNORE_NULL_FUNC | FUNC_MGT_PRIMARY_KEY_FUNC, - .translateFunc = translateFirstLastPartial, + .parameters = {.minParamNum = 1, + .maxParamNum = -1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = -1, + .validDataType = FUNC_PARAM_SUPPORT_ALL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, + .translateFunc = translateOutVarchar, .dynDataRequiredFunc = firstDynDataReq, .getEnvFunc = getFirstLastFuncEnv, .initFunc = functionSetup, @@ -3494,7 +2748,20 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .type = FUNCTION_TYPE_FIRST_MERGE, .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_MULTI_RES_FUNC | FUNC_MGT_IMPLICIT_TS_FUNC | FUNC_MGT_FORBID_SYSTABLE_FUNC | FUNC_MGT_IGNORE_NULL_FUNC | FUNC_MGT_PRIMARY_KEY_FUNC, - .translateFunc = translateFirstLastMerge, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = -1, + .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_ALL_TYPE}}, + .translateFunc = translateOutFirstIn, .getEnvFunc = getFirstLastFuncEnv, .initFunc = functionSetup, .processFunc = firstFunctionMerge, @@ -3508,7 +2775,20 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .type = FUNCTION_TYPE_LAST, .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_MULTI_RES_FUNC | FUNC_MGT_IMPLICIT_TS_FUNC | FUNC_MGT_KEEP_ORDER_FUNC | FUNC_MGT_FORBID_SYSTABLE_FUNC | FUNC_MGT_IGNORE_NULL_FUNC | FUNC_MGT_PRIMARY_KEY_FUNC | FUNC_MGT_TSMA_FUNC, - .translateFunc = translateFirstLast, + .parameters = {.minParamNum = 1, + .maxParamNum = -1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = -1, + .validDataType = FUNC_PARAM_SUPPORT_ALL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isFixedValue = false, + .hasRange = false, + .isFirstLast = true}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_ALL_TYPE}}, + .translateFunc = translateOutFirstIn, .dynDataRequiredFunc = lastDynDataReq, .getEnvFunc = getFirstLastFuncEnv, .initFunc = firstLastFunctionSetup, @@ -3525,7 +2805,20 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .type = FUNCTION_TYPE_LAST_PARTIAL, .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_MULTI_RES_FUNC | FUNC_MGT_IMPLICIT_TS_FUNC | FUNC_MGT_FORBID_SYSTABLE_FUNC | FUNC_MGT_IGNORE_NULL_FUNC | FUNC_MGT_PRIMARY_KEY_FUNC, - .translateFunc = translateFirstLastPartial, + .parameters = {.minParamNum = 1, + .maxParamNum = -1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = -1, + .validDataType = FUNC_PARAM_SUPPORT_ALL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isFixedValue = false, + .hasRange = false, + .isFirstLast = true}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, + .translateFunc = translateOutVarchar, .dynDataRequiredFunc = lastDynDataReq, .getEnvFunc = getFirstLastFuncEnv, .initFunc = functionSetup, @@ -3538,7 +2831,20 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .type = FUNCTION_TYPE_LAST_MERGE, .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_MULTI_RES_FUNC | FUNC_MGT_IMPLICIT_TS_FUNC | FUNC_MGT_FORBID_SYSTABLE_FUNC | FUNC_MGT_IGNORE_NULL_FUNC | FUNC_MGT_PRIMARY_KEY_FUNC, - .translateFunc = translateFirstLastMerge, + .parameters = {.minParamNum = 1, + .maxParamNum = -1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = -1, + .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_ALL_TYPE}}, + .translateFunc = translateOutFirstIn, .getEnvFunc = getFirstLastFuncEnv, .initFunc = functionSetup, .processFunc = lastFunctionMerge, @@ -3552,19 +2858,75 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .type = FUNCTION_TYPE_TWA, .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_TIMELINE_FUNC | FUNC_MGT_INTERVAL_INTERPO_FUNC | FUNC_MGT_FORBID_STREAM_FUNC | FUNC_MGT_IMPLICIT_TS_FUNC | FUNC_MGT_FORBID_SYSTABLE_FUNC | FUNC_MGT_PRIMARY_KEY_FUNC, - .translateFunc = translateInNumOutDou, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, + .translateFunc = translateOutDouble, .dataRequiredFunc = statisDataRequired, .getEnvFunc = getTwaFuncEnv, .initFunc = twaFunctionSetup, .processFunc = twaFunction, .sprocessFunc = twaScalarFunction, - .finalizeFunc = twaFinalize + .finalizeFunc = twaFinalize, }, { .name = "histogram", .type = FUNCTION_TYPE_HISTOGRAM, .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_MULTI_ROWS_FUNC | FUNC_MGT_FORBID_FILL_FUNC | FUNC_MGT_FORBID_STREAM_FUNC, - .translateFunc = translateHistogram, + .parameters = {.minParamNum = 4, + .maxParamNum = 4, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = false, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .inputParaInfo[0][1] = {.isLastParam = false, + .startParam = 2, + .endParam = 2, + .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = true, + .hasRange = false, + .fixedStrValue = {"user_input", "linear_bin", "log_bin"}}, + .inputParaInfo[0][2] = {.isLastParam = false, + .startParam = 3, + .endParam = 3, + .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .isHistogramBin = true, + .hasRange = false}, + .inputParaInfo[0][3] = {.isLastParam = true, + .startParam = 4, + .endParam = 4, + .validDataType = FUNC_PARAM_SUPPORT_INTEGER_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = true, + .hasRange = false, + .fixedNumValue = {0, 1}}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, + .translateFunc = translateOutVarchar, .getEnvFunc = getHistogramFuncEnv, .initFunc = histogramFunctionSetup, .processFunc = histogramFunction, @@ -3581,7 +2943,49 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "_histogram_partial", .type = FUNCTION_TYPE_HISTOGRAM_PARTIAL, .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_MULTI_ROWS_FUNC | FUNC_MGT_FORBID_FILL_FUNC, - .translateFunc = translateHistogramPartial, + .parameters = {.minParamNum = 4, + .maxParamNum = 4, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = false, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .inputParaInfo[0][1] = {.isLastParam = false, + .startParam = 2, + .endParam = 2, + .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = true, + .hasRange = false, + .fixedStrValue = {"user_input", "linear_bin", "log_bin"}}, + .inputParaInfo[0][2] = {.isLastParam = false, + .startParam = 3, + .endParam = 3, + .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .inputParaInfo[0][3] = {.isLastParam = true, + .startParam = 4, + .endParam = 4, + .validDataType = FUNC_PARAM_SUPPORT_INTEGER_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = true, + .hasRange = false, + .fixedNumValue = {0, 1}}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, + .translateFunc = translateOutVarchar, .getEnvFunc = getHistogramFuncEnv, .initFunc = histogramFunctionSetup, .processFunc = histogramFunctionPartial, @@ -3595,7 +2999,20 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "_histogram_merge", .type = FUNCTION_TYPE_HISTOGRAM_MERGE, .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_MULTI_ROWS_FUNC | FUNC_MGT_FORBID_FILL_FUNC, - .translateFunc = translateHistogramMerge, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, + .translateFunc = translateOutVarchar, .getEnvFunc = getHistogramFuncEnv, .initFunc = functionSetup, .processFunc = histogramFunctionMerge, @@ -3609,7 +3026,20 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "hyperloglog", .type = FUNCTION_TYPE_HYPERLOGLOG, .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_COUNT_LIKE_FUNC, - .translateFunc = translateHLL, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_ALL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_BIGINT_TYPE}}, + .translateFunc = translateOutBigInt, .getEnvFunc = getHLLFuncEnv, .initFunc = functionSetup, .processFunc = hllFunction, @@ -3620,13 +3050,26 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { #endif .combineFunc = hllCombine, .pPartialFunc = "_hyperloglog_partial", - .pMergeFunc = "_hyperloglog_merge" + .pMergeFunc = "_hyperloglog_merge", }, { .name = "_hyperloglog_partial", .type = FUNCTION_TYPE_HYPERLOGLOG_PARTIAL, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_ALL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, .classification = FUNC_MGT_AGG_FUNC, - .translateFunc = translateHLLPartial, + .translateFunc = translateOutVarchar, .getEnvFunc = getHLLFuncEnv, .initFunc = functionSetup, .processFunc = hllFunction, @@ -3639,8 +3082,21 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { { .name = "_hyperloglog_merge", .type = FUNCTION_TYPE_HYPERLOGLOG_MERGE, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_BIGINT_TYPE}}, .classification = FUNC_MGT_AGG_FUNC, - .translateFunc = translateHLLMerge, + .translateFunc = translateOutBigInt, .getEnvFunc = getHLLFuncEnv, .initFunc = functionSetup, .processFunc = hllFunctionMerge, @@ -3656,6 +3112,30 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .type = FUNCTION_TYPE_DIFF, .classification = FUNC_MGT_INDEFINITE_ROWS_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_TIMELINE_FUNC | FUNC_MGT_IMPLICIT_TS_FUNC | FUNC_MGT_PROCESS_BY_ROW | FUNC_MGT_KEEP_ORDER_FUNC | FUNC_MGT_FORBID_STREAM_FUNC | FUNC_MGT_CUMULATIVE_FUNC | FUNC_MGT_FORBID_SYSTABLE_FUNC | FUNC_MGT_PRIMARY_KEY_FUNC, + .parameters = {.minParamNum = 1, + .maxParamNum = 2, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = false, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_TIMESTAMP_TYPE | FUNC_PARAM_SUPPORT_BOOL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .inputParaInfo[0][1] = {.isLastParam = true, + .startParam = 2, + .endParam = 2, + .validDataType = FUNC_PARAM_SUPPORT_INTEGER_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = true, + .hasRange = false, + .fixedValueSize = 4, + .fixedNumValue = {0, 1, 2, 3}}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_BIGINT_TYPE | FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, .translateFunc = translateDiff, .getEnvFunc = getDiffFuncEnv, .initFunc = diffFunctionSetup, @@ -3670,30 +3150,119 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .type = FUNCTION_TYPE_STATE_COUNT, .classification = FUNC_MGT_INDEFINITE_ROWS_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_TIMELINE_FUNC | FUNC_MGT_IMPLICIT_TS_FUNC | FUNC_MGT_FORBID_STREAM_FUNC | FUNC_MGT_FORBID_SYSTABLE_FUNC, - .translateFunc = translateStateCount, + .parameters = {.minParamNum = 3, + .maxParamNum = 3, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = false, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .inputParaInfo[0][1] = {.isLastParam = false, + .startParam = 2, + .endParam = 2, + .validDataType = FUNC_PARAM_SUPPORT_STRING_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = true, + .hasRange = false, + .fixedValueSize = 6, + .fixedStrValue = {"LT", "GT", "LE", "GE", "NE", "EQ"}}, + .inputParaInfo[0][2] = {.isLastParam = true, + .startParam = 3, + .endParam = 3, + .validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE | FUNC_PARAM_SUPPORT_BIGINT_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_BIGINT_TYPE}}, + .translateFunc = translateOutBigInt, .getEnvFunc = getStateFuncEnv, .initFunc = functionSetup, .processFunc = stateCountFunction, .sprocessFunc = stateCountScalarFunction, - .finalizeFunc = NULL + .finalizeFunc = NULL, }, { .name = "stateduration", .type = FUNCTION_TYPE_STATE_DURATION, .classification = FUNC_MGT_INDEFINITE_ROWS_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_TIMELINE_FUNC | FUNC_MGT_IMPLICIT_TS_FUNC | FUNC_MGT_FORBID_STREAM_FUNC | FUNC_MGT_FORBID_SYSTABLE_FUNC, - .translateFunc = translateStateDuration, + .parameters = {.minParamNum = 3, + .maxParamNum = 4, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = false, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .inputParaInfo[0][1] = {.isLastParam = false, + .startParam = 2, + .endParam = 2, + .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = true, + .hasRange = false, + .fixedValueSize = 6, + .fixedStrValue = {"LT", "GT", "LE", "GE", "NE", "EQ"}}, + .inputParaInfo[0][2] = {.isLastParam = false, + .startParam = 3, + .endParam = 3, + .validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE | FUNC_PARAM_SUPPORT_BIGINT_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .inputParaInfo[0][3] = {.isLastParam = true, + .startParam = 4, + .endParam = 4, + .validDataType = FUNC_PARAM_SUPPORT_BIGINT_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false, + .isTimeUnit = true}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_BIGINT_TYPE}}, + .translateFunc = translateOutBigInt, .getEnvFunc = getStateFuncEnv, .initFunc = functionSetup, .processFunc = stateDurationFunction, .sprocessFunc = stateDurationScalarFunction, - .finalizeFunc = NULL + .finalizeFunc = NULL, }, { .name = "csum", .type = FUNCTION_TYPE_CSUM, .classification = FUNC_MGT_INDEFINITE_ROWS_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_TIMELINE_FUNC | FUNC_MGT_IMPLICIT_TS_FUNC | FUNC_MGT_FORBID_STREAM_FUNC | FUNC_MGT_CUMULATIVE_FUNC | FUNC_MGT_KEEP_ORDER_FUNC | FUNC_MGT_FORBID_SYSTABLE_FUNC, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_BIGINT_TYPE | FUNC_PARAM_SUPPORT_DOUBLE_TYPE | FUNC_PARAM_SUPPORT_UBIGINT_TYPE}}, .translateFunc = translateCsum, .getEnvFunc = getCsumFuncEnv, .initFunc = functionSetup, @@ -3707,438 +3276,1045 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .type = FUNCTION_TYPE_MAVG, .classification = FUNC_MGT_INDEFINITE_ROWS_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_TIMELINE_FUNC | FUNC_MGT_IMPLICIT_TS_FUNC | FUNC_MGT_FORBID_STREAM_FUNC | FUNC_MGT_FORBID_SYSTABLE_FUNC, - .translateFunc = translateMavg, + .parameters = {.minParamNum = 2, + .maxParamNum = 2, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = false, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .inputParaInfo[0][1] = {.isLastParam = true, + .startParam = 2, + .endParam = 2, + .validDataType = FUNC_PARAM_SUPPORT_INTEGER_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = true, + .range = {.dMinVal = 1.0, .dMaxVal = 1000.0}}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, + .translateFunc = translateOutDouble, .getEnvFunc = getMavgFuncEnv, .initFunc = mavgFunctionSetup, .processFunc = mavgFunction, .sprocessFunc = mavgScalarFunction, - .finalizeFunc = NULL + .finalizeFunc = NULL, }, { .name = "sample", .type = FUNCTION_TYPE_SAMPLE, .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_MULTI_ROWS_FUNC | FUNC_MGT_KEEP_ORDER_FUNC | FUNC_MGT_FORBID_STREAM_FUNC | FUNC_MGT_FORBID_FILL_FUNC, - .translateFunc = translateSample, + .parameters = {.minParamNum = 2, + .maxParamNum = 2, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = false, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_ALL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .inputParaInfo[0][1] = {.isLastParam = true, + .startParam = 2, + .endParam = 2, + .validDataType = FUNC_PARAM_SUPPORT_INTEGER_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = true, + .range = {.dMinVal = 1.0, .dMaxVal = 1000.0}}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_ALL_TYPE}}, + .translateFunc = translateSampleTail, .getEnvFunc = getSampleFuncEnv, .initFunc = sampleFunctionSetup, .processFunc = sampleFunction, .sprocessFunc = sampleScalarFunction, - .finalizeFunc = sampleFinalize + .finalizeFunc = sampleFinalize, }, { .name = "tail", .type = FUNCTION_TYPE_TAIL, .classification = FUNC_MGT_SELECT_FUNC | FUNC_MGT_INDEFINITE_ROWS_FUNC | FUNC_MGT_FORBID_STREAM_FUNC | FUNC_MGT_IMPLICIT_TS_FUNC, - .translateFunc = translateTail, + .parameters = {.minParamNum = 2, + .maxParamNum = 3, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = false, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_ALL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .inputParaInfo[0][1] = {.isLastParam = false, + .startParam = 2, + .endParam = 2, + .validDataType = FUNC_PARAM_SUPPORT_INTEGER_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = true, + .range = {.dMinVal = 1.0, .dMaxVal = 100.0}}, + .inputParaInfo[0][2] = {.isLastParam = true, + .startParam = 3, + .endParam = 3, + .validDataType = FUNC_PARAM_SUPPORT_INTEGER_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = true, + .range = {.dMinVal = 0.0, .dMaxVal = 100.0}}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_ALL_TYPE}}, + .translateFunc = translateSampleTail, .getEnvFunc = getTailFuncEnv, .initFunc = tailFunctionSetup, .processFunc = tailFunction, .sprocessFunc = tailScalarFunction, - .finalizeFunc = NULL + .finalizeFunc = NULL, }, { .name = "unique", .type = FUNCTION_TYPE_UNIQUE, .classification = FUNC_MGT_SELECT_FUNC | FUNC_MGT_INDEFINITE_ROWS_FUNC | FUNC_MGT_FORBID_STREAM_FUNC | FUNC_MGT_IMPLICIT_TS_FUNC | FUNC_MGT_PRIMARY_KEY_FUNC, - .translateFunc = translateUnique, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_ALL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false, + .hasColumn = true}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_ALL_TYPE}}, + .translateFunc = translateOutFirstIn, .getEnvFunc = getUniqueFuncEnv, .initFunc = uniqueFunctionSetup, .processFunc = uniqueFunction, .sprocessFunc = uniqueScalarFunction, - .finalizeFunc = NULL + .finalizeFunc = NULL, }, { .name = "mode", .type = FUNCTION_TYPE_MODE, .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_FORBID_STREAM_FUNC, - .translateFunc = translateMode, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_ALL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false, + .hasColumn = true}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_ALL_TYPE}}, + .translateFunc = translateOutFirstIn, .getEnvFunc = getModeFuncEnv, .initFunc = modeFunctionSetup, .processFunc = modeFunction, .sprocessFunc = modeScalarFunction, .finalizeFunc = modeFinalize, - .cleanupFunc = modeFunctionCleanupExt + .cleanupFunc = modeFunctionCleanupExt, }, { .name = "abs", .type = FUNCTION_TYPE_ABS, .classification = FUNC_MGT_SCALAR_FUNC, - .translateFunc = translateInOutNum, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE}}, + .translateFunc = translateOutNum, .getEnvFunc = NULL, .initFunc = NULL, .sprocessFunc = absFunction, - .finalizeFunc = NULL + .finalizeFunc = NULL, }, { .name = "log", .type = FUNCTION_TYPE_LOG, .classification = FUNC_MGT_SCALAR_FUNC, - .translateFunc = translateLogarithm, + .parameters = {.minParamNum = 1, + .maxParamNum = 2, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = false, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .inputParaInfo[0][1] = {.isLastParam = true, + .startParam = 2, + .endParam = 2, + .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, + .translateFunc = translateOutDouble, .getEnvFunc = NULL, .initFunc = NULL, .sprocessFunc = logFunction, - .finalizeFunc = NULL + .finalizeFunc = NULL, }, { .name = "pow", .type = FUNCTION_TYPE_POW, .classification = FUNC_MGT_SCALAR_FUNC, - .translateFunc = translateIn2NumOutDou, + .parameters = {.minParamNum = 2, + .maxParamNum = 2, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = false, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .inputParaInfo[0][1] = {.isLastParam = true, + .startParam = 2, + .endParam = 2, + .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, + .translateFunc = translateOutDouble, .getEnvFunc = NULL, .initFunc = NULL, .sprocessFunc = powFunction, - .finalizeFunc = NULL + .finalizeFunc = NULL, }, { .name = "sqrt", .type = FUNCTION_TYPE_SQRT, .classification = FUNC_MGT_SCALAR_FUNC, - .translateFunc = translateInNumOutDou, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, + .translateFunc = translateOutDouble, .getEnvFunc = NULL, .initFunc = NULL, .sprocessFunc = sqrtFunction, - .finalizeFunc = NULL + .finalizeFunc = NULL, }, { .name = "ceil", .type = FUNCTION_TYPE_CEIL, .classification = FUNC_MGT_SCALAR_FUNC, - .translateFunc = translateInOutNum, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE}}, + .translateFunc = translateOutNum, .getEnvFunc = NULL, .initFunc = NULL, .sprocessFunc = ceilFunction, - .finalizeFunc = NULL + .finalizeFunc = NULL, }, { .name = "floor", .type = FUNCTION_TYPE_FLOOR, .classification = FUNC_MGT_SCALAR_FUNC, - .translateFunc = translateInOutNum, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE}}, + .translateFunc = translateOutNum, .getEnvFunc = NULL, .initFunc = NULL, .sprocessFunc = floorFunction, - .finalizeFunc = NULL + .finalizeFunc = NULL, }, { .name = "round", .type = FUNCTION_TYPE_ROUND, .classification = FUNC_MGT_SCALAR_FUNC, - .translateFunc = translateRound, + .parameters = {.minParamNum = 1, + .maxParamNum = 2, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = false, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .inputParaInfo[0][1] = {.isLastParam = true, + .startParam = 2, + .endParam = 2, + .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, + .translateFunc = translateOutNum, .getEnvFunc = NULL, .initFunc = NULL, .sprocessFunc = roundFunction, - .finalizeFunc = NULL + .finalizeFunc = NULL, }, { .name = "sin", .type = FUNCTION_TYPE_SIN, .classification = FUNC_MGT_SCALAR_FUNC, - .translateFunc = translateInNumOutDou, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, + .translateFunc = translateOutDouble, .getEnvFunc = NULL, .initFunc = NULL, .sprocessFunc = sinFunction, - .finalizeFunc = NULL + .finalizeFunc = NULL, }, { .name = "cos", .type = FUNCTION_TYPE_COS, .classification = FUNC_MGT_SCALAR_FUNC, - .translateFunc = translateInNumOutDou, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, + .translateFunc = translateOutDouble, .getEnvFunc = NULL, .initFunc = NULL, .sprocessFunc = cosFunction, - .finalizeFunc = NULL + .finalizeFunc = NULL, }, { .name = "tan", .type = FUNCTION_TYPE_TAN, .classification = FUNC_MGT_SCALAR_FUNC, - .translateFunc = translateInNumOutDou, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, + .translateFunc = translateOutDouble, .getEnvFunc = NULL, .initFunc = NULL, .sprocessFunc = tanFunction, - .finalizeFunc = NULL + .finalizeFunc = NULL, }, { .name = "asin", .type = FUNCTION_TYPE_ASIN, .classification = FUNC_MGT_SCALAR_FUNC, - .translateFunc = translateInNumOutDou, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, + .translateFunc = translateOutDouble, .getEnvFunc = NULL, .initFunc = NULL, .sprocessFunc = asinFunction, - .finalizeFunc = NULL + .finalizeFunc = NULL, }, { .name = "acos", .type = FUNCTION_TYPE_ACOS, .classification = FUNC_MGT_SCALAR_FUNC, - .translateFunc = translateInNumOutDou, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, + .translateFunc = translateOutDouble, .getEnvFunc = NULL, .initFunc = NULL, .sprocessFunc = acosFunction, - .finalizeFunc = NULL + .finalizeFunc = NULL, }, { .name = "atan", .type = FUNCTION_TYPE_ATAN, .classification = FUNC_MGT_SCALAR_FUNC, - .translateFunc = translateInNumOutDou, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, + .translateFunc = translateOutDouble, .getEnvFunc = NULL, .initFunc = NULL, .sprocessFunc = atanFunction, - .finalizeFunc = NULL + .finalizeFunc = NULL, }, { .name = "length", .type = FUNCTION_TYPE_LENGTH, .classification = FUNC_MGT_SCALAR_FUNC | FUNC_MGT_STRING_FUNC, - .translateFunc = translateLength, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_STRING_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_BIGINT_TYPE}}, + .translateFunc = translateOutBigInt, .getEnvFunc = NULL, .initFunc = NULL, .sprocessFunc = lengthFunction, - .finalizeFunc = NULL + .finalizeFunc = NULL, }, { .name = "char_length", .type = FUNCTION_TYPE_CHAR_LENGTH, .classification = FUNC_MGT_SCALAR_FUNC | FUNC_MGT_STRING_FUNC, - .translateFunc = translateCharLength, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_BIGINT_TYPE}}, + .translateFunc = translateOutBigInt, .getEnvFunc = NULL, .initFunc = NULL, .sprocessFunc = charLengthFunction, - .finalizeFunc = NULL + .finalizeFunc = NULL, }, { .name = "concat", .type = FUNCTION_TYPE_CONCAT, .classification = FUNC_MGT_SCALAR_FUNC | FUNC_MGT_STRING_FUNC, + .parameters = {.minParamNum = 2, + .maxParamNum = 8, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 8, + .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE}}, .translateFunc = translateConcat, .getEnvFunc = NULL, .initFunc = NULL, .sprocessFunc = concatFunction, - .finalizeFunc = NULL + .finalizeFunc = NULL, }, { .name = "concat_ws", .type = FUNCTION_TYPE_CONCAT_WS, .classification = FUNC_MGT_SCALAR_FUNC | FUNC_MGT_STRING_FUNC, + .parameters = {.minParamNum = 3, + .maxParamNum = 9, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = false, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .inputParaInfo[0][1] = {.isLastParam = true, + .startParam = 2, + .endParam = 9, + .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE}}, .translateFunc = translateConcatWs, .getEnvFunc = NULL, .initFunc = NULL, .sprocessFunc = concatWsFunction, - .finalizeFunc = NULL + .finalizeFunc = NULL, }, { .name = "lower", .type = FUNCTION_TYPE_LOWER, .classification = FUNC_MGT_SCALAR_FUNC | FUNC_MGT_STRING_FUNC, - .translateFunc = translateInOutStr, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE}}, + .translateFunc = translateOutFirstIn, .getEnvFunc = NULL, .initFunc = NULL, .sprocessFunc = lowerFunction, - .finalizeFunc = NULL + .finalizeFunc = NULL, }, { .name = "upper", .type = FUNCTION_TYPE_UPPER, .classification = FUNC_MGT_SCALAR_FUNC | FUNC_MGT_STRING_FUNC, - .translateFunc = translateInOutStr, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE}}, + .translateFunc = translateOutFirstIn, .getEnvFunc = NULL, .initFunc = NULL, .sprocessFunc = upperFunction, - .finalizeFunc = NULL + .finalizeFunc = NULL, }, { .name = "ltrim", .type = FUNCTION_TYPE_LTRIM, .classification = FUNC_MGT_SCALAR_FUNC | FUNC_MGT_STRING_FUNC, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE}}, .translateFunc = translateLtrim, .getEnvFunc = NULL, .initFunc = NULL, .sprocessFunc = ltrimFunction, - .finalizeFunc = NULL + .finalizeFunc = NULL, }, { .name = "rtrim", .type = FUNCTION_TYPE_RTRIM, .classification = FUNC_MGT_SCALAR_FUNC | FUNC_MGT_STRING_FUNC, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE}}, .translateFunc = translateRtrim, .getEnvFunc = NULL, .initFunc = NULL, .sprocessFunc = rtrimFunction, - .finalizeFunc = NULL + .finalizeFunc = NULL, }, { .name = "substr", .type = FUNCTION_TYPE_SUBSTR, .classification = FUNC_MGT_SCALAR_FUNC | FUNC_MGT_STRING_FUNC, - .translateFunc = translateSubstr, + .parameters = {.minParamNum = 2, + .maxParamNum = 3, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = false, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .inputParaInfo[0][1] = {.isLastParam = true, + .startParam = 2, + .endParam = 3, + .validDataType = FUNC_PARAM_SUPPORT_INTEGER_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE}}, + .translateFunc = translateOutFirstIn, .getEnvFunc = NULL, .initFunc = NULL, .sprocessFunc = substrFunction, - .finalizeFunc = NULL + .finalizeFunc = NULL, }, { .name = "cast", .type = FUNCTION_TYPE_CAST, .classification = FUNC_MGT_SCALAR_FUNC, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_BOOL_TYPE | FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE | FUNC_PARAM_SUPPORT_GEOMETRY_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE | FUNC_PARAM_SUPPORT_TIMESTAMP_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_ALL_TYPE}}, .translateFunc = translateCast, .getEnvFunc = NULL, .initFunc = NULL, .sprocessFunc = castFunction, - .finalizeFunc = NULL + .finalizeFunc = NULL, }, { .name = "to_iso8601", .type = FUNCTION_TYPE_TO_ISO8601, .classification = FUNC_MGT_SCALAR_FUNC, + .parameters = {.minParamNum = 1, + .maxParamNum = 2, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = false, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_INTEGER_TYPE | FUNC_PARAM_SUPPORT_TIMESTAMP_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .inputParaInfo[0][1] = {.isLastParam = true, + .startParam = 2, + .endParam = 2, + .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, .translateFunc = translateToIso8601, .getEnvFunc = NULL, .initFunc = NULL, .sprocessFunc = toISO8601Function, - .finalizeFunc = NULL + .finalizeFunc = NULL, }, { .name = "to_unixtimestamp", .type = FUNCTION_TYPE_TO_UNIXTIMESTAMP, .classification = FUNC_MGT_SCALAR_FUNC, + .parameters = {.minParamNum = 1, + .maxParamNum = 2, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = false, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .inputParaInfo[0][1] = {.isLastParam = true, + .startParam = 2, + .endParam = 2, + .validDataType = FUNC_PARAM_SUPPORT_INTEGER_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = true, + .hasRange = false, + .fixedValueSize = 2, + .fixedNumValue = {0, 1}}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_BIGINT_TYPE | FUNC_PARAM_SUPPORT_TIMESTAMP_TYPE}}, .translateFunc = translateToUnixtimestamp, .getEnvFunc = NULL, .initFunc = NULL, .sprocessFunc = toUnixtimestampFunction, - .finalizeFunc = NULL + .finalizeFunc = NULL, }, { .name = "timetruncate", .type = FUNCTION_TYPE_TIMETRUNCATE, .classification = FUNC_MGT_SCALAR_FUNC, + .parameters = {.minParamNum = 2, + .maxParamNum = 3, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = false, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE | FUNC_PARAM_SUPPORT_TIMESTAMP_TYPE | FUNC_PARAM_SUPPORT_INTEGER_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .inputParaInfo[0][1] = {.isLastParam = false, + .startParam = 2, + .endParam = 2, + .validDataType = FUNC_PARAM_SUPPORT_INTEGER_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false, + .isTimeUnit = true}, + .inputParaInfo[0][2] = {.isLastParam = true, + .startParam = 3, + .endParam = 3, + .validDataType = FUNC_PARAM_SUPPORT_INTEGER_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = true, + .hasRange = false, + .fixedValueSize = 2, + .fixedNumValue = {0, 1}}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_TIMESTAMP_TYPE}}, .translateFunc = translateTimeTruncate, .getEnvFunc = NULL, .initFunc = NULL, .sprocessFunc = timeTruncateFunction, - .finalizeFunc = NULL + .finalizeFunc = NULL, }, { .name = "timediff", .type = FUNCTION_TYPE_TIMEDIFF, .classification = FUNC_MGT_SCALAR_FUNC, - .translateFunc = translateTimeDiff, + .parameters = {.minParamNum = 2, + .maxParamNum = 3, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = false, + .startParam = 1, + .endParam = 2, + .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE | FUNC_PARAM_SUPPORT_TIMESTAMP_TYPE | FUNC_PARAM_SUPPORT_INTEGER_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .inputParaInfo[0][1] = {.isLastParam = true, + .startParam = 3, + .endParam = 3, + .validDataType = FUNC_PARAM_SUPPORT_INTEGER_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false, + .isTimeUnit = true}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_TIMESTAMP_TYPE}}, + .translateFunc = translateAddPrecOutBigint, .getEnvFunc = NULL, .initFunc = NULL, .sprocessFunc = timeDiffFunction, - .finalizeFunc = NULL + .finalizeFunc = NULL, }, { .name = "now", .type = FUNCTION_TYPE_NOW, .classification = FUNC_MGT_SCALAR_FUNC | FUNC_MGT_DATETIME_FUNC | FUNC_MGT_KEEP_ORDER_FUNC, + .parameters = {.minParamNum = 0, + .maxParamNum = 0, + .paramInfoPattern = 0, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_TIMESTAMP_TYPE}}, .translateFunc = translateNowToday, .getEnvFunc = NULL, .initFunc = NULL, .sprocessFunc = nowFunction, - .finalizeFunc = NULL + .finalizeFunc = NULL, }, { .name = "today", .type = FUNCTION_TYPE_TODAY, .classification = FUNC_MGT_SCALAR_FUNC | FUNC_MGT_DATETIME_FUNC | FUNC_MGT_KEEP_ORDER_FUNC, + .parameters = {.minParamNum = 0, + .maxParamNum = 0, + .paramInfoPattern = 0, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_TIMESTAMP_TYPE}}, .translateFunc = translateNowToday, .getEnvFunc = NULL, .initFunc = NULL, .sprocessFunc = todayFunction, - .finalizeFunc = NULL + .finalizeFunc = NULL, }, { .name = "timezone", .type = FUNCTION_TYPE_TIMEZONE, .classification = FUNC_MGT_SCALAR_FUNC, - .translateFunc = translateTimezone, + .parameters = {.minParamNum = 0, + .maxParamNum = 0, + .paramInfoPattern = 0, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, + .translateFunc = translateOutVarchar, .getEnvFunc = NULL, .initFunc = NULL, .sprocessFunc = timezoneFunction, - .finalizeFunc = NULL + .finalizeFunc = NULL, }, { .name = "tbname", .type = FUNCTION_TYPE_TBNAME, .classification = FUNC_MGT_PSEUDO_COLUMN_FUNC | FUNC_MGT_SCAN_PC_FUNC | FUNC_MGT_KEEP_ORDER_FUNC, - .translateFunc = translateTbnameColumn, + .parameters = {.minParamNum = 0, + .maxParamNum = 0, + .paramInfoPattern = 0, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, + .translateFunc = translateOutVarchar, .getEnvFunc = NULL, .initFunc = NULL, .sprocessFunc = qPseudoTagFunction, - .finalizeFunc = NULL + .finalizeFunc = NULL, }, { .name = "_qstart", .type = FUNCTION_TYPE_QSTART, .classification = FUNC_MGT_PSEUDO_COLUMN_FUNC | FUNC_MGT_CLIENT_PC_FUNC, + .parameters = {.minParamNum = 0, + .maxParamNum = 0, + .paramInfoPattern = 0, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_TIMESTAMP_TYPE}}, .translateFunc = translateTimePseudoColumn, .getEnvFunc = NULL, .initFunc = NULL, .sprocessFunc = NULL, - .finalizeFunc = NULL + .finalizeFunc = NULL, }, { .name = "_qend", .type = FUNCTION_TYPE_QEND, .classification = FUNC_MGT_PSEUDO_COLUMN_FUNC | FUNC_MGT_CLIENT_PC_FUNC, + .parameters = {.minParamNum = 0, + .maxParamNum = 0, + .paramInfoPattern = 0, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_TIMESTAMP_TYPE}}, .translateFunc = translateTimePseudoColumn, .getEnvFunc = NULL, .initFunc = NULL, .sprocessFunc = NULL, - .finalizeFunc = NULL + .finalizeFunc = NULL, }, { .name = "_qduration", .type = FUNCTION_TYPE_QDURATION, .classification = FUNC_MGT_PSEUDO_COLUMN_FUNC | FUNC_MGT_CLIENT_PC_FUNC, + .parameters = {.minParamNum = 0, + .maxParamNum = 0, + .paramInfoPattern = 0, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_BIGINT_TYPE}}, .translateFunc = translateWduration, .getEnvFunc = NULL, .initFunc = NULL, .sprocessFunc = NULL, - .finalizeFunc = NULL + .finalizeFunc = NULL, }, { .name = "_wstart", .type = FUNCTION_TYPE_WSTART, .classification = FUNC_MGT_PSEUDO_COLUMN_FUNC | FUNC_MGT_WINDOW_PC_FUNC | FUNC_MGT_KEEP_ORDER_FUNC | FUNC_MGT_SKIP_SCAN_CHECK_FUNC, + .parameters = {.minParamNum = 0, + .maxParamNum = 0, + .paramInfoPattern = 0, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_TIMESTAMP_TYPE}}, .translateFunc = translateTimePseudoColumn, .getEnvFunc = getTimePseudoFuncEnv, .initFunc = NULL, .sprocessFunc = winStartTsFunction, - .finalizeFunc = NULL + .finalizeFunc = NULL, }, { .name = "_wend", .type = FUNCTION_TYPE_WEND, .classification = FUNC_MGT_PSEUDO_COLUMN_FUNC | FUNC_MGT_WINDOW_PC_FUNC | FUNC_MGT_KEEP_ORDER_FUNC | FUNC_MGT_SKIP_SCAN_CHECK_FUNC, + .parameters = {.minParamNum = 0, + .maxParamNum = 0, + .paramInfoPattern = 0, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_TIMESTAMP_TYPE}}, .translateFunc = translateTimePseudoColumn, .getEnvFunc = getTimePseudoFuncEnv, .initFunc = NULL, .sprocessFunc = winEndTsFunction, - .finalizeFunc = NULL + .finalizeFunc = NULL, }, { .name = "_wduration", .type = FUNCTION_TYPE_WDURATION, .classification = FUNC_MGT_PSEUDO_COLUMN_FUNC | FUNC_MGT_WINDOW_PC_FUNC | FUNC_MGT_KEEP_ORDER_FUNC | FUNC_MGT_SKIP_SCAN_CHECK_FUNC, + .parameters = {.minParamNum = 0, + .maxParamNum = 0, + .paramInfoPattern = 0, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_BIGINT_TYPE}}, .translateFunc = translateWduration, .getEnvFunc = getTimePseudoFuncEnv, .initFunc = NULL, .sprocessFunc = winDurFunction, - .finalizeFunc = NULL + .finalizeFunc = NULL, }, { .name = "to_json", .type = FUNCTION_TYPE_TO_JSON, .classification = FUNC_MGT_SCALAR_FUNC, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_JSON_TYPE}}, .translateFunc = translateToJson, .getEnvFunc = NULL, .initFunc = NULL, .sprocessFunc = toJsonFunction, - .finalizeFunc = NULL + .finalizeFunc = NULL, }, { .name = "_select_value", @@ -4150,13 +4326,17 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .processFunc = NULL, .finalizeFunc = NULL, .pPartialFunc = "_select_value", - .pMergeFunc = "_select_value" + .pMergeFunc = "_select_value", }, { .name = "_block_dist", .type = FUNCTION_TYPE_BLOCK_DIST, .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_FORBID_STREAM_FUNC, - .translateFunc = translateBlockDistFunc, + .parameters = {.minParamNum = 0, + .maxParamNum = 0, + .paramInfoPattern = 0, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, + .translateFunc = translateOutVarchar, .getEnvFunc = getBlockDistFuncEnv, .initFunc = blockDistSetup, .processFunc = blockDistFunction, @@ -4166,7 +4346,11 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "_block_dist_info", .type = FUNCTION_TYPE_BLOCK_DIST_INFO, .classification = FUNC_MGT_PSEUDO_COLUMN_FUNC | FUNC_MGT_SCAN_PC_FUNC, - .translateFunc = translateBlockDistInfoFunc, + .parameters = {.minParamNum = 0, + .maxParamNum = 0, + .paramInfoPattern = 0, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, + .translateFunc = translateOutVarchar, }, { .name = "_group_key", @@ -4185,42 +4369,70 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "database", .type = FUNCTION_TYPE_DATABASE, .classification = FUNC_MGT_SYSTEM_INFO_FUNC | FUNC_MGT_SCALAR_FUNC, - .translateFunc = translateDatabaseFunc, + .parameters = {.minParamNum = 0, + .maxParamNum = 0, + .paramInfoPattern = 0, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, + .translateFunc = translateOutVarchar, }, { .name = "client_version", .type = FUNCTION_TYPE_CLIENT_VERSION, .classification = FUNC_MGT_SYSTEM_INFO_FUNC | FUNC_MGT_SCALAR_FUNC, - .translateFunc = translateClientVersionFunc, + .parameters = {.minParamNum = 0, + .maxParamNum = 0, + .paramInfoPattern = 0, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, + .translateFunc = translateOutVarchar, }, { .name = "server_version", .type = FUNCTION_TYPE_SERVER_VERSION, .classification = FUNC_MGT_SYSTEM_INFO_FUNC | FUNC_MGT_SCALAR_FUNC, - .translateFunc = translateServerVersionFunc, + .parameters = {.minParamNum = 0, + .maxParamNum = 0, + .paramInfoPattern = 0, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, + .translateFunc = translateOutVarchar, }, { .name = "server_status", .type = FUNCTION_TYPE_SERVER_STATUS, .classification = FUNC_MGT_SYSTEM_INFO_FUNC | FUNC_MGT_SCALAR_FUNC, + .parameters = {.minParamNum = 0, + .maxParamNum = 0, + .paramInfoPattern = 0, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, .translateFunc = translateServerStatusFunc, }, { .name = "current_user", .type = FUNCTION_TYPE_CURRENT_USER, .classification = FUNC_MGT_SYSTEM_INFO_FUNC | FUNC_MGT_SCALAR_FUNC, - .translateFunc = translateCurrentUserFunc, + .parameters = {.minParamNum = 0, + .maxParamNum = 0, + .paramInfoPattern = 0, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, + .translateFunc = translateOutVarchar, }, { .name = "user", .type = FUNCTION_TYPE_USER, .classification = FUNC_MGT_SYSTEM_INFO_FUNC | FUNC_MGT_SCALAR_FUNC, - .translateFunc = translateUserFunc, + .parameters = {.minParamNum = 0, + .maxParamNum = 0, + .paramInfoPattern = 0, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, + .translateFunc = translateOutVarchar, }, { .name = "_irowts", .type = FUNCTION_TYPE_IROWTS, .classification = FUNC_MGT_PSEUDO_COLUMN_FUNC | FUNC_MGT_INTERP_PC_FUNC | FUNC_MGT_KEEP_ORDER_FUNC, + .parameters = {.minParamNum = 0, + .maxParamNum = 0, + .paramInfoPattern = 0, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_TIMESTAMP_TYPE}}, .translateFunc = translateTimePseudoColumn, .getEnvFunc = getTimePseudoFuncEnv, .initFunc = NULL, @@ -4231,6 +4443,10 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "_isfilled", .type = FUNCTION_TYPE_ISFILLED, .classification = FUNC_MGT_PSEUDO_COLUMN_FUNC | FUNC_MGT_INTERP_PC_FUNC, + .parameters = {.minParamNum = 0, + .maxParamNum = 0, + .paramInfoPattern = 0, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_BOOL_TYPE}}, .translateFunc = translateIsFilledPseudoColumn, .getEnvFunc = NULL, .initFunc = NULL, @@ -4251,7 +4467,11 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "_table_count", .type = FUNCTION_TYPE_TABLE_COUNT, .classification = FUNC_MGT_PSEUDO_COLUMN_FUNC | FUNC_MGT_SCAN_PC_FUNC, - .translateFunc = translateTableCountPseudoColumn, + .parameters = {.minParamNum = 0, + .maxParamNum = 0, + .paramInfoPattern = 0, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_BIGINT_TYPE}}, + .translateFunc = translateOutBigInt, .getEnvFunc = NULL, .initFunc = NULL, .sprocessFunc = NULL, @@ -4261,7 +4481,20 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "st_geomfromtext", .type = FUNCTION_TYPE_GEOM_FROM_TEXT, .classification = FUNC_MGT_SCALAR_FUNC | FUNC_MGT_GEOMETRY_FUNC, - .translateFunc = translateInStrOutGeom, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_STRING_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_GEOMETRY_TYPE}}, + .translateFunc = translateOutGeom, .getEnvFunc = NULL, .initFunc = NULL, .sprocessFunc = geomFromTextFunction, @@ -4271,6 +4504,19 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "st_astext", .type = FUNCTION_TYPE_AS_TEXT, .classification = FUNC_MGT_SCALAR_FUNC | FUNC_MGT_GEOMETRY_FUNC, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_GEOMETRY_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_STRING_TYPE}}, .translateFunc = translateInGeomOutStr, .getEnvFunc = NULL, .initFunc = NULL, @@ -4281,7 +4527,20 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "st_makepoint", .type = FUNCTION_TYPE_MAKE_POINT, .classification = FUNC_MGT_SCALAR_FUNC | FUNC_MGT_GEOMETRY_FUNC, - .translateFunc = translateIn2NumOutGeom, + .parameters = {.minParamNum = 2, + .maxParamNum = 2, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 2, + .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_GEOMETRY_TYPE}}, + .translateFunc = translateOutGeom, .getEnvFunc = NULL, .initFunc = NULL, .sprocessFunc = makePointFunction, @@ -4291,6 +4550,19 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "st_intersects", .type = FUNCTION_TYPE_INTERSECTS, .classification = FUNC_MGT_SCALAR_FUNC | FUNC_MGT_GEOMETRY_FUNC, + .parameters = {.minParamNum = 2, + .maxParamNum = 2, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 2, + .validDataType = FUNC_PARAM_SUPPORT_GEOMETRY_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_BOOL_TYPE}}, .translateFunc = translateIn2GeomOutBool, .getEnvFunc = NULL, .initFunc = NULL, @@ -4301,6 +4573,19 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "st_equals", .type = FUNCTION_TYPE_EQUALS, .classification = FUNC_MGT_SCALAR_FUNC | FUNC_MGT_GEOMETRY_FUNC, + .parameters = {.minParamNum = 2, + .maxParamNum = 2, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 2, + .validDataType = FUNC_PARAM_SUPPORT_GEOMETRY_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_BOOL_TYPE}}, .translateFunc = translateIn2GeomOutBool, .getEnvFunc = NULL, .initFunc = NULL, @@ -4311,6 +4596,19 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "st_touches", .type = FUNCTION_TYPE_TOUCHES, .classification = FUNC_MGT_SCALAR_FUNC | FUNC_MGT_GEOMETRY_FUNC, + .parameters = {.minParamNum = 2, + .maxParamNum = 2, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 2, + .validDataType = FUNC_PARAM_SUPPORT_GEOMETRY_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_BOOL_TYPE}}, .translateFunc = translateIn2GeomOutBool, .getEnvFunc = NULL, .initFunc = NULL, @@ -4321,6 +4619,19 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "st_covers", .type = FUNCTION_TYPE_COVERS, .classification = FUNC_MGT_SCALAR_FUNC | FUNC_MGT_GEOMETRY_FUNC, + .parameters = {.minParamNum = 2, + .maxParamNum = 2, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 2, + .validDataType = FUNC_PARAM_SUPPORT_GEOMETRY_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_BOOL_TYPE}}, .translateFunc = translateIn2GeomOutBool, .getEnvFunc = NULL, .initFunc = NULL, @@ -4331,6 +4642,19 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "st_contains", .type = FUNCTION_TYPE_CONTAINS, .classification = FUNC_MGT_SCALAR_FUNC | FUNC_MGT_GEOMETRY_FUNC, + .parameters = {.minParamNum = 2, + .maxParamNum = 2, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 2, + .validDataType = FUNC_PARAM_SUPPORT_GEOMETRY_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_BOOL_TYPE}}, .translateFunc = translateIn2GeomOutBool, .getEnvFunc = NULL, .initFunc = NULL, @@ -4341,6 +4665,19 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "st_containsproperly", .type = FUNCTION_TYPE_CONTAINS_PROPERLY, .classification = FUNC_MGT_SCALAR_FUNC | FUNC_MGT_GEOMETRY_FUNC, + .parameters = {.minParamNum = 2, + .maxParamNum = 2, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 2, + .validDataType = FUNC_PARAM_SUPPORT_GEOMETRY_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_BOOL_TYPE}}, .translateFunc = translateIn2GeomOutBool, .getEnvFunc = NULL, .initFunc = NULL, @@ -4351,7 +4688,11 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "_tbuid", .type = FUNCTION_TYPE_TBUID, .classification = FUNC_MGT_PSEUDO_COLUMN_FUNC | FUNC_MGT_SCAN_PC_FUNC | FUNC_MGT_KEEP_ORDER_FUNC, - .translateFunc = translateTbUidColumn, + .parameters = {.minParamNum = 0, + .maxParamNum = 0, + .paramInfoPattern = 0, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_BIGINT_TYPE}}, + .translateFunc = translateOutBigInt, .getEnvFunc = NULL, .initFunc = NULL, .sprocessFunc = qPseudoTagFunction, @@ -4361,6 +4702,10 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "_vgid", .type = FUNCTION_TYPE_VGID, .classification = FUNC_MGT_PSEUDO_COLUMN_FUNC | FUNC_MGT_SCAN_PC_FUNC | FUNC_MGT_KEEP_ORDER_FUNC, + .parameters = {.minParamNum = 0, + .maxParamNum = 0, + .paramInfoPattern = 0, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_INT_TYPE}}, .translateFunc = translateVgIdColumn, .getEnvFunc = NULL, .initFunc = NULL, @@ -4371,6 +4716,19 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "to_timestamp", .type = FUNCTION_TYPE_TO_TIMESTAMP, .classification = FUNC_MGT_SCALAR_FUNC | FUNC_MGT_DATETIME_FUNC, + .parameters = {.minParamNum = 2, + .maxParamNum = 2, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 2, + .validDataType = FUNC_PARAM_SUPPORT_STRING_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_TIMESTAMP_TYPE}}, .translateFunc = translateToTimestamp, .getEnvFunc = NULL, .initFunc = NULL, @@ -4381,7 +4739,29 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "to_char", .type = FUNCTION_TYPE_TO_CHAR, .classification = FUNC_MGT_SCALAR_FUNC, - .translateFunc = translateToChar, + .parameters = {.minParamNum = 2, + .maxParamNum = 2, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = false, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_TIMESTAMP_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .inputParaInfo[0][1] = {.isLastParam = true, + .startParam = 2, + .endParam = 2, + .validDataType = FUNC_PARAM_SUPPORT_STRING_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, + .translateFunc = translateOutVarchar, .getEnvFunc = NULL, .initFunc = NULL, .sprocessFunc = toCharFunction, @@ -4391,7 +4771,20 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "_avg_middle", .type = FUNCTION_TYPE_AVG_PARTIAL, .classification = FUNC_MGT_AGG_FUNC, - .translateFunc = translateAvgMiddle, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, + .translateFunc = translateOutVarchar, .dataRequiredFunc = statisDataRequired, .getEnvFunc = getAvgFuncEnv, .initFunc = avgFunctionSetup, @@ -4406,7 +4799,11 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "_vgver", .type = FUNCTION_TYPE_VGVER, .classification = FUNC_MGT_PSEUDO_COLUMN_FUNC | FUNC_MGT_SCAN_PC_FUNC | FUNC_MGT_KEEP_ORDER_FUNC, - .translateFunc = translateVgVerColumn, + .parameters = {.minParamNum = 0, + .maxParamNum = 0, + .paramInfoPattern = 0, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_BIGINT_TYPE}}, + .translateFunc = translateOutBigInt, .getEnvFunc = NULL, .initFunc = NULL, .sprocessFunc = qPseudoTagFunction, @@ -4416,7 +4813,20 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "_std_state", .type = FUNCTION_TYPE_STD_STATE, .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_TSMA_FUNC, - .translateFunc = translateStdState, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, + .translateFunc = translateOutVarchar, .getEnvFunc = getStdFuncEnv, .initFunc = stdFunctionSetup, .processFunc = stdFunction, @@ -4428,7 +4838,20 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "_std_state_merge", .type = FUNCTION_TYPE_STD_STATE_MERGE, .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_TSMA_FUNC, - .translateFunc = translateStdStateMerge, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, + .translateFunc = translateOutVarchar, .getEnvFunc = getStdFuncEnv, .initFunc = stdFunctionSetup, .processFunc = stdFunctionMerge, @@ -4438,7 +4861,20 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "_avg_state", .type = FUNCTION_TYPE_AVG_STATE, .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_TSMA_FUNC, - .translateFunc = translateAvgState, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, + .translateFunc = translateOutVarchar, .getEnvFunc = getAvgFuncEnv, .initFunc = avgFunctionSetup, .processFunc = avgFunction, @@ -4450,7 +4886,20 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "_avg_state_merge", .type = FUNCTION_TYPE_AVG_STATE_MERGE, .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_TSMA_FUNC, - .translateFunc = translateAvgStateMerge, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, + .translateFunc = translateOutVarchar, .getEnvFunc = getAvgFuncEnv, .initFunc = avgFunctionSetup, .processFunc = avgFunctionMerge, @@ -4460,7 +4909,20 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "_spread_state", .type = FUNCTION_TYPE_SPREAD_STATE, .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SPECIAL_DATA_REQUIRED | FUNC_MGT_TSMA_FUNC, - .translateFunc = translateSpreadState, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_TIMESTAMP_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, + .translateFunc = translateOutVarchar, .getEnvFunc = getSpreadFuncEnv, .initFunc = spreadFunctionSetup, .processFunc = spreadFunction, @@ -4472,7 +4934,20 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "_spread_state_merge", .type = FUNCTION_TYPE_SPREAD_STATE_MERGE, .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_TSMA_FUNC, - .translateFunc = translateSpreadStateMerge, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, + .translateFunc = translateOutVarchar, .getEnvFunc = getSpreadFuncEnv, .initFunc = spreadFunctionSetup, .processFunc = spreadFunctionMerge, @@ -4483,7 +4958,21 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .type = FUNCTION_TYPE_FIRST_STATE, .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_MULTI_RES_FUNC | FUNC_MGT_IMPLICIT_TS_FUNC | FUNC_MGT_KEEP_ORDER_FUNC | FUNC_MGT_FORBID_SYSTABLE_FUNC | FUNC_MGT_TSMA_FUNC | FUNC_MGT_PRIMARY_KEY_FUNC, - .translateFunc = translateFirstLastState, + .parameters = {.minParamNum = 1, + .maxParamNum = -1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = -1, + .validDataType = FUNC_PARAM_SUPPORT_ALL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false, + .isFirstLast = true}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, + .translateFunc = translateOutVarchar, .getEnvFunc = getFirstLastFuncEnv, .initFunc = functionSetup, .processFunc = firstFunction, @@ -4496,7 +4985,20 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .type = FUNCTION_TYPE_FIRST_STATE_MERGE, .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_MULTI_RES_FUNC | FUNC_MGT_IMPLICIT_TS_FUNC | FUNC_MGT_KEEP_ORDER_FUNC | FUNC_MGT_FORBID_SYSTABLE_FUNC | FUNC_MGT_TSMA_FUNC | FUNC_MGT_PRIMARY_KEY_FUNC, - .translateFunc = translateFirstLastStateMerge, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, + .translateFunc = translateOutVarchar, .getEnvFunc = getFirstLastFuncEnv, .initFunc = functionSetup, .processFunc = firstFunctionMerge, @@ -4507,7 +5009,21 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .type = FUNCTION_TYPE_LAST_STATE, .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_MULTI_RES_FUNC | FUNC_MGT_IMPLICIT_TS_FUNC | FUNC_MGT_KEEP_ORDER_FUNC | FUNC_MGT_FORBID_SYSTABLE_FUNC | FUNC_MGT_TSMA_FUNC | FUNC_MGT_PRIMARY_KEY_FUNC, - .translateFunc = translateFirstLastState, + .parameters = {.minParamNum = 1, + .maxParamNum = -1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = -1, + .validDataType = FUNC_PARAM_SUPPORT_ALL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false, + .isFirstLast = true}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, + .translateFunc = translateOutVarchar, .getEnvFunc = getFirstLastFuncEnv, .initFunc = functionSetup, .processFunc = lastFunction, @@ -4520,16 +5036,43 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .type = FUNCTION_TYPE_LAST_STATE_MERGE, .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_MULTI_RES_FUNC | FUNC_MGT_IMPLICIT_TS_FUNC | FUNC_MGT_KEEP_ORDER_FUNC | FUNC_MGT_FORBID_SYSTABLE_FUNC | FUNC_MGT_TSMA_FUNC | FUNC_MGT_PRIMARY_KEY_FUNC, - .translateFunc = translateFirstLastStateMerge, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, + .translateFunc = translateOutVarchar, .getEnvFunc = getFirstLastFuncEnv, .initFunc = functionSetup, .processFunc = lastFunctionMerge, .finalizeFunc = firstLastPartialFinalize, }, - { .name = "_hyperloglog_state", + { + .name = "_hyperloglog_state", .type = FUNCTION_TYPE_HYPERLOGLOG_STATE, .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_COUNT_LIKE_FUNC | FUNC_MGT_TSMA_FUNC, - .translateFunc = translateHLLState, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_ALL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, + .translateFunc = translateOutVarchar, .getEnvFunc = getHLLFuncEnv, .initFunc = functionSetup, .processFunc = hllFunction, @@ -4541,7 +5084,20 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "_hyperloglog_state_merge", .type = FUNCTION_TYPE_HYPERLOGLOG_STATE_MERGE, .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_COUNT_LIKE_FUNC | FUNC_MGT_TSMA_FUNC, - .translateFunc = translateHLLStateMerge, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, + .translateFunc = translateOutVarchar, .getEnvFunc = getHLLFuncEnv, .initFunc = functionSetup, .processFunc = hllFunctionMerge, @@ -4551,7 +5107,20 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "md5", .type = FUNCTION_TYPE_MD5, .classification = FUNC_MGT_SCALAR_FUNC, - .translateFunc = translateMd5, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, + .translateFunc = translateOutVarchar, .getEnvFunc = NULL, .initFunc = NULL, .sprocessFunc = md5Function, @@ -4561,6 +5130,10 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "_group_const_value", .type = FUNCTION_TYPE_GROUP_CONST_VALUE, .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_KEEP_ORDER_FUNC, + .parameters = {.minParamNum = 0, + .maxParamNum = 0, + .paramInfoPattern = 0, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_ALL_TYPE}}, .translateFunc = translateSelectValue, .getEnvFunc = getSelectivityFuncEnv, .initFunc = functionSetup, @@ -4571,7 +5144,20 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "stddev_pop", .type = FUNCTION_TYPE_STDDEV, .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_TSMA_FUNC, - .translateFunc = translateInNumOutDou, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, + .translateFunc = translateOutDouble, .getEnvFunc = getStdFuncEnv, .initFunc = stdFunctionSetup, .processFunc = stdFunction, @@ -4589,7 +5175,20 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "var_pop", .type = FUNCTION_TYPE_STDVAR, .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_TSMA_FUNC, - .translateFunc = translateInNumOutDou, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, + .translateFunc = translateOutDouble, .getEnvFunc = getStdFuncEnv, .initFunc = stdFunctionSetup, .processFunc = stdFunction, @@ -4607,7 +5206,19 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "_stdvar_merge", .type = FUNCTION_TYPE_STDVAR_MERGE, .classification = FUNC_MGT_AGG_FUNC, - .translateFunc = translateStdMerge, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, + .translateFunc = translateOutDouble, .getEnvFunc = getStdFuncEnv, .initFunc = stdFunctionSetup, .processFunc = stdFunctionMerge, @@ -4623,7 +5234,11 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "pi", .type = FUNCTION_TYPE_PI, .classification = FUNC_MGT_SCALAR_FUNC, - .translateFunc = translatePi, + .parameters = {.minParamNum = 0, + .maxParamNum = 0, + .paramInfoPattern = 0, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, + .translateFunc = translateOutDouble, .getEnvFunc = NULL, .initFunc = NULL, .sprocessFunc = piFunction, @@ -4633,7 +5248,20 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "exp", .type = FUNCTION_TYPE_EXP, .classification = FUNC_MGT_SCALAR_FUNC, - .translateFunc = translateInNumOutDou, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, + .translateFunc = translateOutDouble, .getEnvFunc = NULL, .initFunc = NULL, .sprocessFunc = expFunction, @@ -4643,7 +5271,20 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "ln", .type = FUNCTION_TYPE_LN, .classification = FUNC_MGT_SCALAR_FUNC, - .translateFunc = translateInNumOutDou, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, + .translateFunc = translateOutDouble, .getEnvFunc = NULL, .initFunc = NULL, .sprocessFunc = lnFunction, @@ -4653,7 +5294,29 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "mod", .type = FUNCTION_TYPE_MOD, .classification = FUNC_MGT_SCALAR_FUNC, - .translateFunc = translateIn2NumOutDou, + .parameters = {.minParamNum = 2, + .maxParamNum = 2, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = false, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .inputParaInfo[0][1] = {.isLastParam = true, + .startParam = 2, + .endParam = 2, + .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, + .translateFunc = translateOutDouble, .getEnvFunc = NULL, .initFunc = NULL, .sprocessFunc = modFunction, @@ -4663,7 +5326,20 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "sign", .type = FUNCTION_TYPE_SIGN, .classification = FUNC_MGT_SCALAR_FUNC, - .translateFunc = translateInOutNum, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE}}, + .translateFunc = translateOutNum, .getEnvFunc = NULL, .initFunc = NULL, .sprocessFunc = signFunction, @@ -4673,7 +5349,20 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "degrees", .type = FUNCTION_TYPE_DEGREES, .classification = FUNC_MGT_SCALAR_FUNC, - .translateFunc = translateInNumOutDou, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, + .translateFunc = translateOutDouble, .getEnvFunc = NULL, .initFunc = NULL, .sprocessFunc = degreesFunction, @@ -4683,7 +5372,20 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "radians", .type = FUNCTION_TYPE_RADIANS, .classification = FUNC_MGT_SCALAR_FUNC, - .translateFunc = translateInNumOutDou, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, + .translateFunc = translateOutDouble, .getEnvFunc = NULL, .initFunc = NULL, .sprocessFunc = radiansFunction, @@ -4693,7 +5395,29 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "truncate", .type = FUNCTION_TYPE_TRUNCATE, .classification = FUNC_MGT_SCALAR_FUNC, - .translateFunc = translateTrunc, + .parameters = {.minParamNum = 2, + .maxParamNum = 2, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = false, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .inputParaInfo[0][1] = {.isLastParam = true, + .startParam = 2, + .endParam = 2, + .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, + .translateFunc = translateOutFirstIn, .getEnvFunc = NULL, .initFunc = NULL, .sprocessFunc = truncFunction, @@ -4703,7 +5427,29 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "trunc", .type = FUNCTION_TYPE_TRUNCATE, .classification = FUNC_MGT_SCALAR_FUNC, - .translateFunc = translateTrunc, + .parameters = {.minParamNum = 1, + .maxParamNum = 2, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = false, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .inputParaInfo[0][1] = {.isLastParam = true, + .startParam = 2, + .endParam = 2, + .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, + .translateFunc = translateOutFirstIn, .getEnvFunc = NULL, .initFunc = NULL, .sprocessFunc = truncFunction, @@ -4713,7 +5459,38 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "substring", .type = FUNCTION_TYPE_SUBSTR, .classification = FUNC_MGT_SCALAR_FUNC | FUNC_MGT_STRING_FUNC, - .translateFunc = translateSubstr, + .parameters = {.minParamNum = 2, + .maxParamNum = 3, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = false, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .inputParaInfo[0][1] = {.isLastParam = false, + .startParam = 2, + .endParam = 2, + .validDataType = FUNC_PARAM_SUPPORT_INTEGER_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .inputParaInfo[0][2] = {.isLastParam = true, + .startParam = 3, + .endParam = 3, + .validDataType = FUNC_PARAM_SUPPORT_INTEGER_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE}}, + .translateFunc = translateOutFirstIn, .getEnvFunc = NULL, .initFunc = NULL, .sprocessFunc = substrFunction, @@ -4723,7 +5500,38 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "substring_index", .type = FUNCTION_TYPE_SUBSTR_IDX, .classification = FUNC_MGT_SCALAR_FUNC | FUNC_MGT_STRING_FUNC, - .translateFunc = translateSubstrIdx, + .parameters = {.minParamNum = 3, + .maxParamNum = 3, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = false, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .inputParaInfo[0][1] = {.isLastParam = false, + .startParam = 2, + .endParam = 2, + .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .inputParaInfo[0][2] = {.isLastParam = true, + .startParam = 3, + .endParam = 3, + .validDataType = FUNC_PARAM_SUPPORT_INTEGER_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE}}, + .translateFunc = translateOutFirstIn, .getEnvFunc = NULL, .initFunc = NULL, .sprocessFunc = substrIdxFunction, @@ -4733,6 +5541,19 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "char", .type = FUNCTION_TYPE_CHAR, .classification = FUNC_MGT_SCALAR_FUNC | FUNC_MGT_STRING_FUNC, + .parameters = {.minParamNum = 1, + .maxParamNum = -1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = -1, + .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE | FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, .translateFunc = translateChar, .getEnvFunc = NULL, .initFunc = NULL, @@ -4743,6 +5564,19 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "ascii", .type = FUNCTION_TYPE_ASCII, .classification = FUNC_MGT_SCALAR_FUNC | FUNC_MGT_STRING_FUNC, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_BIGINT_TYPE}}, .translateFunc = translateAscii, .getEnvFunc = NULL, .initFunc = NULL, @@ -4753,7 +5587,20 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "position", .type = FUNCTION_TYPE_POSITION, .classification = FUNC_MGT_SCALAR_FUNC | FUNC_MGT_STRING_FUNC, - .translateFunc = translatePosition, + .parameters = {.minParamNum = 2, + .maxParamNum = 2, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 2, + .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_BIGINT_TYPE}}, + .translateFunc = translateOutBigInt, .getEnvFunc = NULL, .initFunc = NULL, .sprocessFunc = positionFunction, @@ -4763,6 +5610,19 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "trim", .type = FUNCTION_TYPE_TRIM, .classification = FUNC_MGT_SCALAR_FUNC | FUNC_MGT_STRING_FUNC, + .parameters = {.minParamNum = 1, + .maxParamNum = 2, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 2, + .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE}}, .translateFunc = translateTrim, .getEnvFunc = NULL, .initFunc = NULL, @@ -4773,6 +5633,19 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "replace", .type = FUNCTION_TYPE_REPLACE, .classification = FUNC_MGT_SCALAR_FUNC | FUNC_MGT_STRING_FUNC, + .parameters = {.minParamNum = 3, + .maxParamNum = 3, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 3, + .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE}}, .translateFunc = translateReplace, .getEnvFunc = NULL, .initFunc = NULL, @@ -4783,6 +5656,28 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "repeat", .type = FUNCTION_TYPE_REPEAT, .classification = FUNC_MGT_SCALAR_FUNC | FUNC_MGT_STRING_FUNC, + .parameters = {.minParamNum = 2, + .maxParamNum = 2, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = false, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .inputParaInfo[0][1] = {.isLastParam = true, + .startParam = 2, + .endParam = 2, + .validDataType = FUNC_PARAM_SUPPORT_INTEGER_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE}}, .translateFunc = translateRepeat, .getEnvFunc = NULL, .initFunc = NULL, @@ -4793,7 +5688,20 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "weekday", .type = FUNCTION_TYPE_WEEKDAY, .classification = FUNC_MGT_SCALAR_FUNC, - .translateFunc = translateWeekday, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_UNIX_TS_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_BIGINT_TYPE}}, + .translateFunc = translateAddPrecOutBigint, .getEnvFunc = NULL, .initFunc = NULL, .sprocessFunc = weekdayFunction, @@ -4803,7 +5711,20 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "dayofweek", .type = FUNCTION_TYPE_DAYOFWEEK, .classification = FUNC_MGT_SCALAR_FUNC, - .translateFunc = translateWeekday, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_UNIX_TS_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_BIGINT_TYPE}}, + .translateFunc = translateAddPrecOutBigint, .getEnvFunc = NULL, .initFunc = NULL, .sprocessFunc = dayofweekFunction, @@ -4813,7 +5734,31 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "week", .type = FUNCTION_TYPE_WEEK, .classification = FUNC_MGT_SCALAR_FUNC, - .translateFunc = translateWeek, + .parameters = {.minParamNum = 1, + .maxParamNum = 2, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = false, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_UNIX_TS_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .inputParaInfo[0][1] = {.isLastParam = true, + .startParam = 2, + .endParam = 2, + .validDataType = FUNC_PARAM_SUPPORT_INTEGER_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = true, + .hasRange = false, + .fixedValueSize = 8, + .fixedNumValue = {0, 1, 2, 3, 4, 5, 6, 7}}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_BIGINT_TYPE}}, + .translateFunc = translateAddPrecOutBigint, .getEnvFunc = NULL, .initFunc = NULL, .sprocessFunc = weekFunction, @@ -4823,7 +5768,20 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "weekofyear", .type = FUNCTION_TYPE_WEEKOFYEAR, .classification = FUNC_MGT_SCALAR_FUNC, - .translateFunc = translateWeekofyear, + .parameters = {.minParamNum = 1, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_UNIX_TS_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_BIGINT_TYPE}}, + .translateFunc = translateAddPrecOutBigint, .getEnvFunc = NULL, .initFunc = NULL, .sprocessFunc = weekofyearFunction, @@ -4833,6 +5791,19 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "rand", .type = FUNCTION_TYPE_RAND, .classification = FUNC_MGT_SCALAR_FUNC, + .parameters = {.minParamNum = 0, + .maxParamNum = 1, + .paramInfoPattern = 1, + .inputParaInfo[0][0] = {.isLastParam = true, + .startParam = 1, + .endParam = 1, + .validDataType = FUNC_PARAM_SUPPORT_INTEGER_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, + .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, + .isPK = false, + .isTs = false, + .isFixedValue = false, + .hasRange = false}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, .translateFunc = translateRand, .getEnvFunc = NULL, .initFunc = NULL, diff --git a/source/util/src/terror.c b/source/util/src/terror.c index 9b85e8218408..52a3be120d5a 100644 --- a/source/util/src/terror.c +++ b/source/util/src/terror.c @@ -761,6 +761,11 @@ TAOS_DEFINE_ERROR(TSDB_CODE_FUNC_SETUP_ERROR, "Function set up fail TAOS_DEFINE_ERROR(TSDB_CODE_FUNC_INVALID_RES_LENGTH, "Function result exceed max length") TAOS_DEFINE_ERROR(TSDB_CODE_FUNC_HISTOGRAM_ERROR, "Function failed to calculate histogram") TAOS_DEFINE_ERROR(TSDB_CODE_FUNC_PERCENTILE_ERROR, "Function failed to calculate percentile") +TAOS_DEFINE_ERROR(TSDB_CODE_FUNC_FUNTION_PARA_RANGE, "Invalid function para range") +TAOS_DEFINE_ERROR(TSDB_CODE_FUNC_FUNTION_PARA_PRIMTS, "Function parameter should be primary timestamp") +TAOS_DEFINE_ERROR(TSDB_CODE_FUNC_FUNTION_PARA_PK, "Function parameter should be primary key") +TAOS_DEFINE_ERROR(TSDB_CODE_FUNC_FUNTION_PARA_HAS_COL, "Function parameter should have column") + //udf TAOS_DEFINE_ERROR(TSDB_CODE_UDF_STOPPING, "udf is stopping") diff --git a/tests/army/query/function/test_function.py b/tests/army/query/function/test_function.py index bf7cf492908b..d54460804a9c 100644 --- a/tests/army/query/function/test_function.py +++ b/tests/army/query/function/test_function.py @@ -296,7 +296,7 @@ def test_min(self): def test_error(self): tdSql.error("select * from (select to_iso8601(ts, timezone()), timezone() from ts_4893.meters \ - order by ts desc) limit 1000;", expectErrInfo="Not supported timzone format") # TS-5340 + order by ts desc) limit 1000;", expectErrInfo="Invalid parameter data type : to_iso8601") # TS-5340 def run(self): tdLog.debug(f"start to excute {__file__}") From 2a2c3d8b9087897dac99fb952b19264002246bc9 Mon Sep 17 00:00:00 2001 From: wangjiaming0909 <604227650@qq.com> Date: Thu, 24 Oct 2024 15:14:07 +0800 Subject: [PATCH 237/695] fix tsma test case --- tests/system-test/2-query/tsma.py | 6 +++--- tests/system-test/test.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/system-test/2-query/tsma.py b/tests/system-test/2-query/tsma.py index acde26d5cab8..a1638ae4cbc7 100644 --- a/tests/system-test/2-query/tsma.py +++ b/tests/system-test/2-query/tsma.py @@ -1354,14 +1354,14 @@ def test_tb_ddl_with_created_tsma(self): tdSql.execute('alter table test.t0 ttl 2', queryTimes=1) tdSql.execute('flush database test') res_tb = TSMAQCBuilder().md5('1.test.tsma1_t0') - self.wait_query_err(f'desc `{res_tb}`', wait_query_seconds, -2147473917) + self.wait_query_err(f'desc test.`{res_tb}`', wait_query_seconds, -2147473917) # test drop multi tables tdSql.execute('drop table test.t3, test.t4') res_tb = TSMAQCBuilder().md5('1.test.tsma1_t3') - self.wait_query_err(f'desc `{res_tb}`', wait_query_seconds, -2147473917) + self.wait_query_err(f'desc test.`{res_tb}`', wait_query_seconds, -2147473917) res_tb = TSMAQCBuilder().md5('1.test.tsma1_t4') - self.wait_query_err(f'desc `{res_tb}`', wait_query_seconds, -2147473917) + self.wait_query_err(f'desc test.`{res_tb}`', wait_query_seconds, -2147473917) # test drop stream tdSql.error('drop stream tsma1', -2147471088) ## TSMA must be dropped first diff --git a/tests/system-test/test.py b/tests/system-test/test.py index 57a4789f2e37..fb3357a2b9b5 100644 --- a/tests/system-test/test.py +++ b/tests/system-test/test.py @@ -689,6 +689,6 @@ def runOnPreviousCluster(host, config, fileName): if conn is not None: conn.close() if asan: - tdDnodes.StopAllSigint() + #tdDnodes.StopAllSigint() tdLog.info("Address sanitizer mode finished") sys.exit(0) From 7a45984c96b9a96c228308080d596f598ca32e32 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Thu, 24 Oct 2024 15:28:09 +0800 Subject: [PATCH 238/695] fix: table seq scan issue --- source/libs/executor/inc/operator.h | 2 ++ source/libs/executor/test/queryPlanTests.cpp | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/source/libs/executor/inc/operator.h b/source/libs/executor/inc/operator.h index fce0b05fde27..ddb9a5e0ec0e 100644 --- a/source/libs/executor/inc/operator.h +++ b/source/libs/executor/inc/operator.h @@ -85,6 +85,8 @@ int32_t createExchangeOperatorInfo(void* pTransporter, SExchangePhysiNode* pExNo int32_t createTableScanOperatorInfo(STableScanPhysiNode* pTableScanNode, SReadHandle* pHandle, STableListInfo* pTableList, SExecTaskInfo* pTaskInfo, SOperatorInfo** pInfo); +int32_t createTableSeqScanOperatorInfo(void* pReadHandle, SExecTaskInfo* pTaskInfo, SOperatorInfo** pOptrInfo); + int32_t createTableMergeScanOperatorInfo(STableScanPhysiNode* pTableScanNode, SReadHandle* readHandle, STableListInfo* pTableListInfo, SExecTaskInfo* pTaskInfo, SOperatorInfo** pInfo); int32_t createTagScanOperatorInfo(SReadHandle* pReadHandle, STagScanPhysiNode* pPhyNode, STableListInfo* pTableListInfo, SNode* pTagCond, SNode*pTagIndexCond, SExecTaskInfo* pTaskInfo, SOperatorInfo** pInfo); diff --git a/source/libs/executor/test/queryPlanTests.cpp b/source/libs/executor/test/queryPlanTests.cpp index 720251fdfd48..ced1f964c6aa 100755 --- a/source/libs/executor/test/queryPlanTests.cpp +++ b/source/libs/executor/test/queryPlanTests.cpp @@ -3027,7 +3027,7 @@ void qptExecPlan(SReadHandle* pReadHandle, SNode* pNode, SExecTaskInfo* pTaskInf qptCtx.result.code = createTableScanOperatorInfo((STableScanPhysiNode*)pNode, pReadHandle, NULL, pTaskInfo, ppOperaotr); break; case QUERY_NODE_PHYSICAL_PLAN_TABLE_SEQ_SCAN: - qptCtx.result.code = createTableSeqScanOperatorInfo((STableScanPhysiNode*)pNode, pReadHandle, NULL, pTaskInfo, ppOperaotr); + qptCtx.result.code = createTableSeqScanOperatorInfo(pReadHandle, pTaskInfo, ppOperaotr); // usless break; case QUERY_NODE_PHYSICAL_PLAN_TABLE_MERGE_SCAN: qptCtx.result.code = createTableMergeScanOperatorInfo((STableScanPhysiNode*)pNode, pReadHandle, NULL, pTaskInfo, ppOperaotr); From 8cd994645b0f132bd5d7618573088e5a2e6ddb5c Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Thu, 24 Oct 2024 15:30:47 +0800 Subject: [PATCH 239/695] fix: subplan test compile issue --- source/libs/executor/test/queryPlanTests.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/executor/test/queryPlanTests.cpp b/source/libs/executor/test/queryPlanTests.cpp index ced1f964c6aa..1e0129ce5b23 100755 --- a/source/libs/executor/test/queryPlanTests.cpp +++ b/source/libs/executor/test/queryPlanTests.cpp @@ -3137,7 +3137,7 @@ void qptExecPlan(SReadHandle* pReadHandle, SNode* pNode, SExecTaskInfo* pTaskInf } case QUERY_NODE_PHYSICAL_SUBPLAN: { DataSinkHandle handle = NULL; - qptCtx.result.code = qCreateExecTask(pReadHandle, qptCtx.param.vnode.vgId, pTaskInfo->id.taskId, (SSubplan*)pNode, &pTaskInfo, &handle, + qptCtx.result.code = qCreateExecTask(pReadHandle, qptCtx.param.vnode.vgId, pTaskInfo->id.taskId, (SSubplan*)pNode, (qTaskInfo_t*)&pTaskInfo, &handle, QPT_RAND_BOOL_V ? 0 : 1, taosStrdup("sql string"), OPTR_EXEC_MODEL_BATCH); break; } From 5085273360df493fcf2278b9bd10de4917c4aa85 Mon Sep 17 00:00:00 2001 From: qevolg <2227465945@qq.com> Date: Thu, 24 Oct 2024 15:36:53 +0800 Subject: [PATCH 240/695] chore(.github): modify taoskeeper github action workflow --- .github/workflows/taoskeeper-ci.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/taoskeeper-ci.yml b/.github/workflows/taoskeeper-ci.yml index a9f48831c1f0..a6e41bc5f086 100644 --- a/.github/workflows/taoskeeper-ci.yml +++ b/.github/workflows/taoskeeper-ci.yml @@ -8,13 +8,14 @@ on: jobs: build: runs-on: ubuntu-latest - name: Run taoskeeper unit tests + name: Run unit tests + steps: - name: Checkout the repository uses: actions/checkout@v4 - - name: Set up Go - uses: actions/setup-go@v4 + - name: Setup Go env + uses: actions/setup-go@v5 with: go-version: 1.18 @@ -25,7 +26,7 @@ jobs: - name: Install TDengine run: | - cd TDengine + # cd TDengine mkdir debug cd debug cmake .. -DBUILD_HTTP=false -DBUILD_JDBC=false -DBUILD_TOOLS=false -DBUILD_TEST=off -DBUILD_KEEPER=true From 3a11a2d319e0c4abce3c12388e129c36415fa0bd Mon Sep 17 00:00:00 2001 From: qevolg <2227465945@qq.com> Date: Thu, 24 Oct 2024 15:37:56 +0800 Subject: [PATCH 241/695] chore(keeper): delete unused files --- tools/keeper/.github/workflows/build.yaml | 59 ------------------- .../.github/workflows/release-pr-title.yaml | 33 ----------- tools/keeper/.github/workflows/release.yaml | 45 -------------- tools/keeper/ci/changelog-generate.sh | 31 ---------- tools/keeper/ci/post-release.sh | 22 ------- tools/keeper/ci/release.sh | 31 ---------- 6 files changed, 221 deletions(-) delete mode 100644 tools/keeper/.github/workflows/build.yaml delete mode 100644 tools/keeper/.github/workflows/release-pr-title.yaml delete mode 100644 tools/keeper/.github/workflows/release.yaml delete mode 100755 tools/keeper/ci/changelog-generate.sh delete mode 100755 tools/keeper/ci/post-release.sh delete mode 100755 tools/keeper/ci/release.sh diff --git a/tools/keeper/.github/workflows/build.yaml b/tools/keeper/.github/workflows/build.yaml deleted file mode 100644 index 3b0db21ccbd1..000000000000 --- a/tools/keeper/.github/workflows/build.yaml +++ /dev/null @@ -1,59 +0,0 @@ -name: Go - -on: [push] - -jobs: - build: - runs-on: ubuntu-latest - strategy: - matrix: - go: ["1.18"] - name: Go ${{ matrix.go }} - steps: - - name: Build tools - run: | - sudo apt-get update -y - sudo apt-get install -y build-essential cmake libgeos-dev - - - name: checkout - uses: actions/checkout@v2 - - - name: Set up Go - uses: actions/setup-go@v2 - with: - go-version: ${{ matrix.go }} - - - name: checkout TDengine - uses: actions/checkout@v3 - with: - repository: "taosdata/TDengine" - path: "TDengine" - ref: "main" - - - name: install TDengine - run: | - cd TDengine - mkdir debug - cd debug - cmake .. -DBUILD_HTTP=false -DBUILD_JDBC=false -DBUILD_TOOLS=false -DBUILD_TEST=off - make -j 4 - sudo make install - which taosd - which taosadapter - - - name: start taosd - run: | - cp /etc/taos/taos.cfg ./ - sudo echo "supportVnodes 256" >> taos.cfg - nohup sudo taosd -c taos.cfg & - - - name: start taosadapter - run: nohup sudo taosadapter & - - - name: test - run: go mod tidy && go test -v ./... - - - name: Build - run: | - go mod tidy - go build diff --git a/tools/keeper/.github/workflows/release-pr-title.yaml b/tools/keeper/.github/workflows/release-pr-title.yaml deleted file mode 100644 index b20e1e49d95a..000000000000 --- a/tools/keeper/.github/workflows/release-pr-title.yaml +++ /dev/null @@ -1,33 +0,0 @@ -name: "Release PR Check" - -on: - pull_request: - branches: - - develop - - types: - - opened - - edited - - synchronize - - labeled - - unlabeled -jobs: - check: - name: "PR check if release" - if: contains(github.event.pull_request.title, '') - runs-on: ubuntu-latest - steps: - - uses: Slashgear/action-check-pr-title@v3.0.0 - with: - regexp: '.*:?\s*(\d+\.\d+\.\d+)(-\S+)?.*' # Regex the title should match. - - - name: Check version - run: | - version=$(echo "${{ github.event.pull_request.title }}" | grep -o -P ':?\s*(\d+\.\d+\.\d+)(-\S+)?' |sed -E 's/:?\s*//') - echo Seems you want to release $version - if git show-ref --tags $version --quiet; then - echo "bug tag exists" - exit 1 - else - echo "tag is valid" - fi diff --git a/tools/keeper/.github/workflows/release.yaml b/tools/keeper/.github/workflows/release.yaml deleted file mode 100644 index 2a156634d413..000000000000 --- a/tools/keeper/.github/workflows/release.yaml +++ /dev/null @@ -1,45 +0,0 @@ -name: Release - -on: - pull_request: - branches: - - develop - types: - - closed - -jobs: - release: - if: github.event.pull_request.merged == true && contains(github.event.pull_request.title, '') - runs-on: ubuntu-20.04 - - steps: - - name: Checkout - uses: actions/checkout@v2 - with: - ref: develop - fetch-depth: 0 - - - name: Extract version - id: extract-version - run: | - version=$(echo "${{ github.event.pull_request.title }}" | grep -o -P ':?\s*(\d+\.\d+\.\d+)(-\S+)?' |sed -E 's/:?\s*//') - echo $version - echo ::set-output name=version::$version - - - name: Version bump - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - ./ci/release.sh ${{ steps.extract-version.outputs.version }} - - - name: Release - uses: softprops/action-gh-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: v${{ steps.extract-version.outputs.version }} - body_path: CHANGELOG.tmp - - - name: Post-release - run: | - ./ci/post-release.sh ${{ steps.extract-version.outputs.version }} diff --git a/tools/keeper/ci/changelog-generate.sh b/tools/keeper/ci/changelog-generate.sh deleted file mode 100755 index 516ebc527269..000000000000 --- a/tools/keeper/ci/changelog-generate.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash - -last=$(git describe --tags --abbrev=0 2>/dev/null) - -if [ "$last" = "" ]; then - git log --pretty=format:'%s' | sort -k2n | uniq >./releaseNotes.tmp -else - git log --pretty=format:'%s' $last..HEAD | sort -k2n | uniq >./releaseNotes.tmp -fi - -function part() { - name=$1 - pattern=$2 - changes=$(grep -P '\[\w+-\d+\]\s*<('$pattern')>:' ./releaseNotes.tmp | sed -E 's/ *<('$pattern')>//' | sed 's/[ci skip]\s*//' | awk -F: '{print "- " $1 ": " $2}' | sort | uniq) - lines=$(printf "\\$changes\n" | wc -l) - # echo $name $pattern $lines >&2 - if [ $lines -gt 0 ]; then - echo "### $name" - echo "" - echo "$changes" - echo "" - fi -} - -part "Features" "feature|feat" -part "Bug Fixes" "bugfix|fix" -part "Enhancements" "enhance" -part "Tests" "test" -part "Documents" "docs|doc" - -rm -f ./releaseNotes.tmp diff --git a/tools/keeper/ci/post-release.sh b/tools/keeper/ci/post-release.sh deleted file mode 100755 index 1b5d4201d6ac..000000000000 --- a/tools/keeper/ci/post-release.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -set -e -ci=$(realpath $(dirname $0)) -v=$1 -if [ "$v" = "" ]; then - echo "$0 " - exit 1 -fi - -newv=$(awk -F. '/[0-9]+\./{$NF+=1;print}' OFS=. <<<"$v") -tee version/version.go <" - exit 1 -fi - -tee version/version.go <CHANGELOG.md2 -printf "## v$newv - $(date +%F)\n\n" >>CHANGELOG.md2 -$ci/changelog-generate.sh >CHANGELOG.tmp -cat CHANGELOG.tmp >>CHANGELOG.md2 -sed "1,7d" CHANGELOG.md >>CHANGELOG.md2 -mv CHANGELOG.md2 CHANGELOG.md - -git config user.name github-actions -git config user.email github-actions@github.com -git add version/version.go CHANGELOG.md -git commit -m "release: v$newv" -git push - -git tag v$newv -git push origin v$newv:$newv --force From 75c8727c52909818b0ed5ac3a25ecced9b9a508b Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Thu, 24 Oct 2024 15:48:57 +0800 Subject: [PATCH 242/695] enh:[TD-32166]refactor code in sml --- source/client/inc/clientSml.h | 8 ++ source/client/src/clientSml.c | 167 ++++++++++++++-------------- source/client/src/clientSmlJson.c | 89 +++++---------- source/client/src/clientSmlLine.c | 3 +- source/client/src/clientSmlTelnet.c | 7 +- utils/test/c/sml_test.c | 104 ++++++++++++++++- 6 files changed, 230 insertions(+), 148 deletions(-) diff --git a/source/client/inc/clientSml.h b/source/client/inc/clientSml.h index a562ca322691..8558ec46dce4 100644 --- a/source/client/inc/clientSml.h +++ b/source/client/inc/clientSml.h @@ -95,15 +95,23 @@ extern "C" { #define SML_CHECK_CODE(CMD) \ code = (CMD); \ if (TSDB_CODE_SUCCESS != code) { \ + lino = __LINE__; \ goto END; \ } #define SML_CHECK_NULL(CMD) \ if (NULL == (CMD)) { \ code = terrno; \ + lino = __LINE__; \ goto END; \ } +#define RETURN \ + if (code != 0){ \ + uError("%s failed code:%d line:%d", __FUNCTION__ , code, lino); \ + } \ + return code; + typedef enum { SCHEMA_ACTION_NULL, SCHEMA_ACTION_CREATE_STABLE, diff --git a/source/client/src/clientSml.c b/source/client/src/clientSml.c index c17ff1413ee0..5f4327b1cd20 100644 --- a/source/client/src/clientSml.c +++ b/source/client/src/clientSml.c @@ -213,22 +213,20 @@ static void smlDestroySTableMeta(void *para) { } int32_t smlBuildSuperTableInfo(SSmlHandle *info, SSmlLineInfo *currElement, SSmlSTableMeta **sMeta) { - int32_t code = TSDB_CODE_SUCCESS; + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; STableMeta *pTableMeta = NULL; - char *measure = currElement->measure; - int measureLen = currElement->measureLen; + int measureLen = currElement->measureLen; + char *measure = (char *)taosMemoryMalloc(measureLen); + SML_CHECK_NULL(measure); + (void)memcpy(measure, currElement->measure, measureLen); if (currElement->measureEscaped) { - measure = (char *)taosMemoryMalloc(measureLen); - SML_CHECK_NULL(measure); - (void)memcpy(measure, currElement->measure, measureLen); PROCESS_SLASH_IN_MEASUREMENT(measure, measureLen); - smlStrReplace(measure, measureLen); } + smlStrReplace(measure, measureLen); code = smlGetMeta(info, measure, measureLen, &pTableMeta); - if (currElement->measureEscaped) { - taosMemoryFree(measure); - } + taosMemoryFree(measure); if (code != TSDB_CODE_SUCCESS) { info->dataFormat = false; info->reRun = true; @@ -260,7 +258,7 @@ int32_t smlBuildSuperTableInfo(SSmlHandle *info, SSmlLineInfo *currElement, SSml END: smlDestroySTableMeta(sMeta); taosMemoryFreeClear(pTableMeta); - return code; + RETURN } bool isSmlColAligned(SSmlHandle *info, int cnt, SSmlKv *kv) { @@ -376,8 +374,8 @@ int32_t smlProcessSuperTable(SSmlHandle *info, SSmlLineInfo *elements) { int32_t smlProcessChildTable(SSmlHandle *info, SSmlLineInfo *elements) { int32_t code = TSDB_CODE_SUCCESS; - SSmlTableInfo **oneTable = - (SSmlTableInfo **)taosHashGet(info->childTables, elements->measureTag, elements->measureTagsLen); + int32_t lino = 0; + SSmlTableInfo **oneTable = (SSmlTableInfo **)taosHashGet(info->childTables, elements->measureTag, elements->measureTagsLen); SSmlTableInfo *tinfo = NULL; if (unlikely(oneTable == NULL)) { SML_CHECK_CODE(smlBuildTableInfo(1, elements->measure, elements->measureLen, &tinfo)); @@ -401,47 +399,40 @@ int32_t smlProcessChildTable(SSmlHandle *info, SSmlLineInfo *elements) { } else { tinfo = *oneTable; } - if (tinfo == NULL) { - uError("smlProcessChildTable failed to get child table info"); - return TSDB_CODE_SML_INTERNAL_ERROR; - } if (info->dataFormat) info->currTableDataCtx = tinfo->tableDataCtx; return TSDB_CODE_SUCCESS; END: smlDestroyTableInfo(&tinfo); - return code; + RETURN } int32_t smlParseEndTelnetJsonFormat(SSmlHandle *info, SSmlLineInfo *elements, SSmlKv *kvTs, SSmlKv *kv) { int32_t code = 0; - uDebug("SML:0x%" PRIx64 " smlParseEndTelnetJson format true, ts:%" PRId64, info->id, kvTs->i); + int32_t lino = 0; + uDebug("SML:0x%" PRIx64 " %s format true, ts:%" PRId64, info->id, __FUNCTION__ , kvTs->i); SML_CHECK_CODE(smlBuildCol(info->currTableDataCtx, info->currSTableMeta->schema, kvTs, 0)); SML_CHECK_CODE(smlBuildCol(info->currTableDataCtx, info->currSTableMeta->schema, kv, 1)); SML_CHECK_CODE(smlBuildRow(info->currTableDataCtx)); - info->preLine = *elements; END: clearColValArraySml(info->currTableDataCtx->pValues); - if (unlikely(code != TSDB_CODE_SUCCESS)) { - smlBuildInvalidDataMsg(&info->msgBuf, "smlBuildCol error", NULL); - } - return code; + RETURN } int32_t smlParseEndTelnetJsonUnFormat(SSmlHandle *info, SSmlLineInfo *elements, SSmlKv *kvTs, SSmlKv *kv) { int32_t code = 0; - uDebug("SML:0x%" PRIx64 " smlParseEndTelnetJson format false, ts:%" PRId64, info->id, kvTs->i); + int32_t lino = 0; + uDebug("SML:0x%" PRIx64 " %s format false, ts:%" PRId64, info->id, __FUNCTION__, kvTs->i); if (elements->colArray == NULL) { elements->colArray = taosArrayInit(16, sizeof(SSmlKv)); SML_CHECK_NULL(elements->colArray); } SML_CHECK_NULL(taosArrayPush(elements->colArray, kvTs)); SML_CHECK_NULL (taosArrayPush(elements->colArray, kv)); - info->preLine = *elements; END: - return code; + RETURN } int32_t smlParseEndLine(SSmlHandle *info, SSmlLineInfo *elements, SSmlKv *kvTs) { @@ -469,8 +460,9 @@ int32_t smlParseEndLine(SSmlHandle *info, SSmlLineInfo *elements, SSmlKv *kvTs) static int32_t smlParseTableName(SArray *tags, char *childTableName, char *tbnameKey) { int32_t code = 0; - bool autoChildName = false; - size_t delimiter = strlen(tsSmlAutoChildTableNameDelimiter); + int32_t lino = 0; + bool autoChildName = false; + size_t delimiter = strlen(tsSmlAutoChildTableNameDelimiter); if (delimiter > 0 && tbnameKey == NULL) { size_t totalNameLen = delimiter * (taosArrayGetSize(tags) - 1); for (int i = 0; i < taosArrayGetSize(tags); i++) { @@ -519,11 +511,12 @@ static int32_t smlParseTableName(SArray *tags, char *childTableName, char *tbnam } END: - return code; + RETURN } int32_t smlSetCTableName(SSmlTableInfo *oneTable, char *tbnameKey) { int32_t code = 0; + int32_t lino = 0; SArray *dst = NULL; SML_CHECK_CODE(smlParseTableName(oneTable->tags, oneTable->childTableName, tbnameKey)); @@ -531,7 +524,6 @@ int32_t smlSetCTableName(SSmlTableInfo *oneTable, char *tbnameKey) { dst = taosArrayDup(oneTable->tags, NULL); SML_CHECK_NULL(dst); if (oneTable->sTableNameLen >= TSDB_TABLE_NAME_LEN) { - uError("SML:smlSetCTableName super table name is too long"); code = TSDB_CODE_SML_INTERNAL_ERROR; goto END; } @@ -550,7 +542,7 @@ int32_t smlSetCTableName(SSmlTableInfo *oneTable, char *tbnameKey) { END: taosArrayDestroy(dst); - return code; + RETURN } int32_t getTableUid(SSmlHandle *info, SSmlLineInfo *currElement, SSmlTableInfo *tinfo) { @@ -575,6 +567,7 @@ int32_t getTableUid(SSmlHandle *info, SSmlLineInfo *currElement, SSmlTableInfo * int32_t smlBuildSTableMeta(bool isDataFormat, SSmlSTableMeta **sMeta) { int32_t code = 0; + int32_t lino = 0; SSmlSTableMeta *meta = (SSmlSTableMeta *)taosMemoryCalloc(sizeof(SSmlSTableMeta), 1); SML_CHECK_NULL(meta); if (unlikely(!isDataFormat)) { @@ -594,7 +587,8 @@ int32_t smlBuildSTableMeta(bool isDataFormat, SSmlSTableMeta **sMeta) { END: smlDestroySTableMeta(&meta); - return TSDB_CODE_OUT_OF_MEMORY; + uError("%s failed code:%d line:%d", __FUNCTION__ , code, lino); + return code; } int32_t smlParseNumber(SSmlKv *kvVal, SSmlMsgBuf *msg) { @@ -704,8 +698,9 @@ static int32_t smlGenerateSchemaAction(SSchema *colField, SHashObj *colHash, SSm uint16_t *index = colHash ? (uint16_t *)taosHashGet(colHash, kv->key, kv->keyLen) : NULL; if (index) { if (colField[*index].type != kv->type) { - uError("SML:0x%" PRIx64 " point type and db type mismatch. db type: %d, point type: %d, key: %s", info->id, - colField[*index].type, kv->type, kv->key); + snprintf(info->msgBuf.buf, info->msgBuf.len, "SML:0x%" PRIx64 " %s point type and db type mismatch. db type: %d, point type: %d, key: %s", + info->id, __FUNCTION__, colField[*index].type, kv->type, kv->key); + uError("%s", info->msgBuf.buf); return TSDB_CODE_SML_INVALID_DATA; } @@ -759,6 +754,7 @@ static int32_t smlFindNearestPowerOf2(int32_t length, uint8_t type) { static int32_t smlProcessSchemaAction(SSmlHandle *info, SSchema *schemaField, SHashObj *schemaHash, SArray *cols, SArray *checkDumplicateCols, ESchemaAction *action, bool isTag) { int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; for (int j = 0; j < taosArrayGetSize(cols); ++j) { if (j == 0 && !isTag) continue; SSmlKv *kv = (SSmlKv *)taosArrayGet(cols, j); @@ -775,11 +771,12 @@ static int32_t smlProcessSchemaAction(SSmlHandle *info, SSchema *schemaField, SH } } END: - return code; + RETURN } static int32_t smlCheckMeta(SSchema *schema, int32_t length, SArray *cols, bool isTag) { int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; SHashObj *hashTmp = taosHashInit(length, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK); SML_CHECK_NULL(hashTmp); int32_t i = 0; @@ -798,7 +795,7 @@ static int32_t smlCheckMeta(SSchema *schema, int32_t length, SArray *cols, bool END: taosHashCleanup(hashTmp); - return code; + RETURN } static int32_t getBytes(uint8_t type, int32_t length) { @@ -813,6 +810,7 @@ static int32_t getBytes(uint8_t type, int32_t length) { static int32_t smlBuildFieldsList(SSmlHandle *info, SSchema *schemaField, SHashObj *schemaHash, SArray *cols, SArray *results, int32_t numOfCols, bool isTag) { int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = TSDB_CODE_SUCCESS; for (int j = 0; j < taosArrayGetSize(cols); ++j) { SSmlKv *kv = (SSmlKv *)taosArrayGet(cols, j); SML_CHECK_NULL(kv); @@ -822,7 +820,7 @@ static int32_t smlBuildFieldsList(SSmlHandle *info, SSchema *schemaField, SHashO SField field = {0}; field.type = kv->type; field.bytes = getBytes(kv->type, kv->length); - (void)memcpy(field.name, kv->key, MIN(kv->keyLen, sizeof(field.name) - 1)); + (void)memcpy(field.name, kv->key, TMIN(kv->keyLen, sizeof(field.name) - 1)); SML_CHECK_NULL(taosArrayPush(results, &field)); } else if (action == SCHEMA_ACTION_CHANGE_COLUMN_SIZE || action == SCHEMA_ACTION_CHANGE_TAG_SIZE) { uint16_t *index = (uint16_t *)taosHashGet(schemaHash, kv->key, kv->keyLen); @@ -851,7 +849,7 @@ static int32_t smlBuildFieldsList(SSmlHandle *info, SSchema *schemaField, SHashO } END: - return code; + RETURN } static FORCE_INLINE void smlBuildCreateStbReq(SMCreateStbReq *pReq, int32_t colVer, int32_t tagVer, tb_uid_t suid, int8_t source){ @@ -865,6 +863,7 @@ static int32_t smlSendMetaMsg(SSmlHandle *info, SName *pName, SArray *pColumns, SRequestObj *pRequest = NULL; SMCreateStbReq pReq = {0}; int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; SCmdMsgInfo pCmdMsg = {0}; char *pSql = NULL; @@ -952,16 +951,17 @@ static int32_t smlSendMetaMsg(SSmlHandle *info, SName *pName, SArray *pColumns, END: destroyRequest(pRequest); tFreeSMCreateStbReq(&pReq); - return code; + RETURN } static int32_t smlCreateTable(SSmlHandle *info, SRequestConnInfo *conn, SSmlSTableMeta *sTableData, SName *pName, STableMeta **pTableMeta){ int32_t code = 0; + int32_t lino = 0; SArray *pColumns = NULL; SArray *pTags = NULL; SML_CHECK_CODE(smlCheckAuth(info, conn, NULL, AUTH_TYPE_WRITE)); - uDebug("SML:0x%" PRIx64 " smlModifyDBSchemas create table:%s", info->id, pName->tname); + uDebug("SML:0x%" PRIx64 " %s create table:%s", info->id, __FUNCTION__, pName->tname); pColumns = taosArrayInit(taosArrayGetSize(sTableData->cols), sizeof(SField)); SML_CHECK_NULL(pColumns); pTags = taosArrayInit(taosArrayGetSize(sTableData->tags), sizeof(SField)); @@ -977,11 +977,12 @@ static int32_t smlCreateTable(SSmlHandle *info, SRequestConnInfo *conn, SSmlSTab END: taosArrayDestroy(pColumns); taosArrayDestroy(pTags); - return code; + RETURN } static int32_t smlBuildFields(SArray **pColumns, SArray **pTags, STableMeta *pTableMeta, SSmlSTableMeta *sTableData){ int32_t code = 0; + int32_t lino = 0; *pColumns = taosArrayInit(taosArrayGetSize(sTableData->cols) + (pTableMeta)->tableInfo.numOfColumns, sizeof(SField)); SML_CHECK_NULL(pColumns); *pTags = taosArrayInit(taosArrayGetSize(sTableData->tags) + (pTableMeta)->tableInfo.numOfTags, sizeof(SField)); @@ -998,7 +999,7 @@ static int32_t smlBuildFields(SArray **pColumns, SArray **pTags, STableMeta *pTa } } END: - return code; + RETURN } static int32_t smlModifyTag(SSmlHandle *info, SHashObj* hashTmp, SRequestConnInfo *conn, SSmlSTableMeta *sTableData, SName *pName, STableMeta **pTableMeta){ @@ -1006,11 +1007,12 @@ static int32_t smlModifyTag(SSmlHandle *info, SHashObj* hashTmp, SRequestConnInf SArray *pColumns = NULL; SArray *pTags = NULL; int32_t code = 0; + int32_t lino = 0; SML_CHECK_CODE(smlProcessSchemaAction(info, (*pTableMeta)->schema, hashTmp, sTableData->tags, sTableData->cols, &action, true)); if (action != SCHEMA_ACTION_NULL) { SML_CHECK_CODE(smlCheckAuth(info, conn, pName->tname, AUTH_TYPE_WRITE)); - uDebug("SML:0x%" PRIx64 " smlModifyDBSchemas change table tag, table:%s, action:%d", info->id, pName->tname, + uDebug("SML:0x%" PRIx64 " %s change table tag, table:%s, action:%d", info->id, __FUNCTION__, pName->tname, action); SML_CHECK_CODE(smlBuildFields(&pColumns, &pTags, *pTableMeta, sTableData)); SML_CHECK_CODE(smlBuildFieldsList(info, (*pTableMeta)->schema, hashTmp, sTableData->tags, pTags, @@ -1027,7 +1029,7 @@ static int32_t smlModifyTag(SSmlHandle *info, SHashObj* hashTmp, SRequestConnInf END: taosArrayDestroy(pColumns); taosArrayDestroy(pTags); - return code; + RETURN } static int32_t smlModifyCols(SSmlHandle *info, SHashObj* hashTmp, SRequestConnInfo *conn, @@ -1036,11 +1038,12 @@ static int32_t smlModifyCols(SSmlHandle *info, SHashObj* hashTmp, SRequestConnIn SArray *pColumns = NULL; SArray *pTags = NULL; int32_t code = 0; + int32_t lino = 0; SML_CHECK_CODE(smlProcessSchemaAction(info, (*pTableMeta)->schema, hashTmp, sTableData->cols, sTableData->tags, &action, false)); if (action != SCHEMA_ACTION_NULL) { SML_CHECK_CODE(smlCheckAuth(info, conn, pName->tname, AUTH_TYPE_WRITE)); - uDebug("SML:0x%" PRIx64 " smlModifyDBSchemas change table col, table:%s, action:%d", info->id, pName->tname, + uDebug("SML:0x%" PRIx64 " %s change table col, table:%s, action:%d", info->id, __FUNCTION__, pName->tname, action); SML_CHECK_CODE(smlBuildFields(&pColumns, &pTags, *pTableMeta, sTableData)); SML_CHECK_CODE(smlBuildFieldsList(info, (*pTableMeta)->schema, hashTmp, sTableData->cols, pColumns, @@ -1054,14 +1057,15 @@ static int32_t smlModifyCols(SSmlHandle *info, SHashObj* hashTmp, SRequestConnIn SML_CHECK_CODE(catalogGetSTableMeta(info->pCatalog, conn, pName, pTableMeta)); } - END: +END: taosArrayDestroy(pColumns); taosArrayDestroy(pTags); - return code; + RETURN } static int32_t smlBuildTempHash(SHashObj *hashTmp, STableMeta *pTableMeta, uint16_t start, uint16_t end){ int32_t code = 0; + int32_t lino = 0; for (uint16_t i = start; i < end; i++) { SML_CHECK_CODE(taosHashPut(hashTmp, pTableMeta->schema[i].name, strlen(pTableMeta->schema[i].name), &i, SHORT_BYTES)); } @@ -1071,12 +1075,13 @@ static int32_t smlBuildTempHash(SHashObj *hashTmp, STableMeta *pTableMeta, uint1 } static int32_t smlModifyDBSchemas(SSmlHandle *info) { - uDebug("SML:0x%" PRIx64 " smlModifyDBSchemas start, format:%d, needModifySchema:%d", info->id, info->dataFormat, + uDebug("SML:0x%" PRIx64 " %s start, format:%d, needModifySchema:%d", info->id, __FUNCTION__, info->dataFormat, info->needModifySchema); if (info->dataFormat && !info->needModifySchema) { return TSDB_CODE_SUCCESS; } int32_t code = 0; + int32_t lino = 0; SHashObj *hashTmp = NULL; STableMeta *pTableMeta = NULL; @@ -1099,10 +1104,12 @@ static int32_t smlModifyDBSchemas(SSmlHandle *info) { char *measure = taosMemoryMalloc(superTableLen); SML_CHECK_NULL(measure); (void)memcpy(measure, superTable, superTableLen); - PROCESS_SLASH_IN_MEASUREMENT(measure, superTableLen); + if (info->protocol == TSDB_SML_LINE_PROTOCOL){ + PROCESS_SLASH_IN_MEASUREMENT(measure, superTableLen); + } smlStrReplace(measure, superTableLen); (void)memset(pName.tname, 0, TSDB_TABLE_NAME_LEN); - (void)memcpy(pName.tname, measure, MIN(superTableLen, TSDB_TABLE_NAME_LEN - 1)); + (void)memcpy(pName.tname, measure, TMIN(superTableLen, TSDB_TABLE_NAME_LEN - 1)); taosMemoryFree(measure); code = catalogGetSTableMeta(info->pCatalog, &conn, &pName, &pTableMeta); @@ -1160,6 +1167,7 @@ static int32_t smlModifyDBSchemas(SSmlHandle *info) { static int32_t smlInsertMeta(SHashObj *metaHash, SArray *metaArray, SArray *cols, SHashObj *checkDuplicate) { int32_t code = 0; + int32_t lino = 0; terrno = 0; for (int16_t i = 0; i < taosArrayGetSize(cols); ++i) { SSmlKv *kv = (SSmlKv *)taosArrayGet(cols, i); @@ -1177,12 +1185,13 @@ static int32_t smlInsertMeta(SHashObj *metaHash, SArray *metaArray, SArray *cols } END: - return code; + RETURN } static int32_t smlUpdateMeta(SHashObj *metaHash, SArray *metaArray, SArray *cols, bool isTag, SSmlMsgBuf *msg, SHashObj *checkDuplicate) { int32_t code = 0; + int32_t lino = 0; for (int i = 0; i < taosArrayGetSize(cols); ++i) { SSmlKv *kv = (SSmlKv *)taosArrayGet(cols, i); SML_CHECK_NULL(kv); @@ -1225,7 +1234,7 @@ static int32_t smlUpdateMeta(SHashObj *metaHash, SArray *metaArray, SArray *cols } END: - return code; + RETURN } void smlDestroyTableInfo(void *para) { @@ -1249,8 +1258,7 @@ void freeSSmlKv(void *data) { } void smlDestroyInfo(SSmlHandle *info) { - if (!info) return; - // qDestroyQuery(info->pQuery); + if (info == NULL) return; taosHashCleanup(info->pVgHash); taosHashCleanup(info->childTables); @@ -1275,22 +1283,20 @@ void smlDestroyInfo(SSmlHandle *info) { if (!info->dataFormat) { for (int i = 0; i < info->lineNum; i++) { taosArrayDestroyEx(info->lines[i].colArray, freeSSmlKv); - if (info->parseJsonByLib) { - taosMemoryFree(info->lines[i].tags); - } if (info->lines[i].measureTagsLen != 0 && info->protocol != TSDB_SML_LINE_PROTOCOL) { taosMemoryFree(info->lines[i].measureTag); } } taosMemoryFree(info->lines); } - + taosMemoryFreeClear(info->preLine.tags); cJSON_Delete(info->root); taosMemoryFreeClear(info); } int32_t smlBuildSmlInfo(TAOS *taos, SSmlHandle **handle) { int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; SSmlHandle *info = (SSmlHandle *)taosMemoryCalloc(1, sizeof(SSmlHandle)); SML_CHECK_NULL(info); if (taos != NULL){ @@ -1327,11 +1333,12 @@ int32_t smlBuildSmlInfo(TAOS *taos, SSmlHandle **handle) { END: smlDestroyInfo(info); - return code; + RETURN } static int32_t smlPushCols(SArray *colsArray, SArray *cols) { int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; SHashObj *kvHash = taosHashInit(32, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_NO_LOCK); SML_CHECK_NULL(kvHash); for (size_t i = 0; i < taosArrayGetSize(cols); i++) { @@ -1350,13 +1357,14 @@ static int32_t smlPushCols(SArray *colsArray, SArray *cols) { return code; END: taosHashCleanup(kvHash); - return code; + RETURN } static int32_t smlParseLineBottom(SSmlHandle *info) { uDebug("SML:0x%" PRIx64 " smlParseLineBottom start, format:%d, linenum:%d", info->id, info->dataFormat, info->lineNum); int32_t code = 0; + int32_t lino = 0; if (info->dataFormat) return TSDB_CODE_SUCCESS; for (int32_t i = 0; i < info->lineNum; i++) { @@ -1417,11 +1425,12 @@ static int32_t smlParseLineBottom(SSmlHandle *info) { uDebug("SML:0x%" PRIx64 " smlParseLineBottom end, format:%d, linenum:%d", info->id, info->dataFormat, info->lineNum); END: - return code; + RETURN } static int32_t smlInsertData(SSmlHandle *info) { int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; char *measure = NULL; SSmlTableInfo **oneTable = NULL; uDebug("SML:0x%" PRIx64 " smlInsertData start, format:%d", info->id, info->dataFormat); @@ -1444,7 +1453,9 @@ static int32_t smlInsertData(SSmlHandle *info) { measure = (char *)taosMemoryMalloc(tableData->sTableNameLen); SML_CHECK_NULL(measure); (void)memcpy(measure, tableData->sTableName, tableData->sTableNameLen); - PROCESS_SLASH_IN_MEASUREMENT(measure, measureLen); + if (info->protocol == TSDB_SML_LINE_PROTOCOL){ + PROCESS_SLASH_IN_MEASUREMENT(measure, measureLen); + } smlStrReplace(measure, measureLen); (void)memset(pName.tname, 0, TSDB_TABLE_NAME_LEN); (void)memcpy(pName.tname, measure, measureLen); @@ -1505,7 +1516,7 @@ static int32_t smlInsertData(SSmlHandle *info) { END: taosMemoryFree(measure); taosHashCancelIterate(info->childTables, oneTable); - return code; + RETURN } static void smlPrintStatisticInfo(SSmlHandle *info) { @@ -1521,6 +1532,8 @@ static void smlPrintStatisticInfo(SSmlHandle *info) { } int32_t smlClearForRerun(SSmlHandle *info) { + int32_t code = 0; + int32_t lino = 0; info->reRun = false; taosHashClear(info->childTables); @@ -1528,33 +1541,23 @@ int32_t smlClearForRerun(SSmlHandle *info) { taosHashClear(info->tableUids); if (!info->dataFormat) { - if (unlikely(info->lines != NULL)) { - uError("SML:0x%" PRIx64 " info->lines != NULL", info->id); - return TSDB_CODE_SML_INVALID_DATA; - } info->lines = (SSmlLineInfo *)taosMemoryCalloc(info->lineNum, sizeof(SSmlLineInfo)); - if (unlikely(info->lines == NULL)) { - uError("SML:0x%" PRIx64 " info->lines == NULL", info->id); - return terrno; - } + SML_CHECK_NULL(info->lines); } taosArrayClearP(info->escapedStringList, taosMemoryFree); + taosMemoryFreeClear(info->preLine.tags); (void)memset(&info->preLine, 0, sizeof(SSmlLineInfo)); info->currSTableMeta = NULL; info->currTableDataCtx = NULL; SVnodeModifyOpStmt *stmt = (SVnodeModifyOpStmt *)(info->pQuery->pRoot); - if (stmt == NULL){ - return TSDB_CODE_SML_INVALID_DATA; - } stmt->freeHashFunc(stmt->pTableBlockHashObj); stmt->pTableBlockHashObj = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), true, HASH_NO_LOCK); - if (stmt->pTableBlockHashObj == NULL) { - uError("SML:0x%" PRIx64 " stmt->pTableBlockHashObj == NULL", info->id); - return terrno; - } - return TSDB_CODE_SUCCESS; + SML_CHECK_NULL(stmt->pTableBlockHashObj); + +END: + RETURN } static void printRaw(int64_t id, int lineNum, int numLines, ELogLevel level, char* data, int32_t len){ @@ -1667,6 +1670,7 @@ static int32_t smlParseLine(SSmlHandle *info, char *lines[], char *rawLine, char static int smlProcess(SSmlHandle *info, char *lines[], char *rawLine, char *rawLineEnd, int numLines) { int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; int32_t retryNum = 0; info->cost.parseTime = taosGetTimestampUs(); @@ -1694,7 +1698,7 @@ static int smlProcess(SSmlHandle *info, char *lines[], char *rawLine, char *rawL SML_CHECK_CODE(smlInsertData(info)); END: - return code; + RETURN } void smlSetReqSQL(SRequestObj *request, char *lines[], char *rawLine, char *rawLineEnd) { @@ -1738,6 +1742,7 @@ void smlSetReqSQL(SRequestObj *request, char *lines[], char *rawLine, char *rawL TAOS_RES *taos_schemaless_insert_inner(TAOS *taos, char *lines[], char *rawLine, char *rawLineEnd, int numLines, int protocol, int precision, int32_t ttl, int64_t reqid, char *tbnameKey) { int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; SRequestObj *request = NULL; SSmlHandle *info = NULL; int cnt = 0; diff --git a/source/client/src/clientSmlJson.c b/source/client/src/clientSmlJson.c index d44f9cac9c40..feb0b4645a31 100644 --- a/source/client/src/clientSmlJson.c +++ b/source/client/src/clientSmlJson.c @@ -290,7 +290,12 @@ static int32_t smlProcessTagJson(SSmlHandle *info, cJSON *tags){ } static int32_t smlParseTagsFromJSON(SSmlHandle *info, cJSON *tags, SSmlLineInfo *elements) { + if (is_same_child_table_telnet(elements, &info->preLine) == 0) { + elements->measureTag = info->preLine.measureTag; + return TSDB_CODE_SUCCESS; + } int32_t code = 0; + int32_t lino = 0; if(info->dataFormat){ SML_CHECK_CODE(smlProcessSuperTable(info, elements)); } @@ -302,7 +307,7 @@ static int32_t smlParseTagsFromJSON(SSmlHandle *info, cJSON *tags, SSmlLineInfo if(info->reRun){ return TSDB_CODE_SUCCESS; } - return code; + RETURN } static int64_t smlParseTSFromJSONObj(SSmlHandle *info, cJSON *root, int32_t toPrecision) { @@ -420,7 +425,8 @@ static int64_t smlParseTSFromJSON(SSmlHandle *info, cJSON *timestamp) { } static int32_t smlParseJSONStringExt(SSmlHandle *info, cJSON *root, SSmlLineInfo *elements) { - int32_t ret = TSDB_CODE_SUCCESS; + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; cJSON *metricJson = NULL; cJSON *tsJson = NULL; @@ -435,52 +441,22 @@ static int32_t smlParseJSONStringExt(SSmlHandle *info, cJSON *root, SSmlLineInfo } cJSON **marks[OTD_JSON_FIELDS_NUM] = {&metricJson, &tsJson, &valueJson, &tagsJson}; - ret = smlGetJsonElements(root, marks); - if (unlikely(ret != TSDB_CODE_SUCCESS)) { - return ret; - } - + SML_CHECK_CODE(smlGetJsonElements(root, marks)); // Parse metric - ret = smlParseMetricFromJSON(info, metricJson, elements); - if (unlikely(ret != TSDB_CODE_SUCCESS)) { - uError("OTD:0x%" PRIx64 " Unable to parse metric from JSON payload", info->id); - return ret; - } - + SML_CHECK_CODE(smlParseMetricFromJSON(info, metricJson, elements)); // Parse metric value SSmlKv kv = {.key = VALUE, .keyLen = VALUE_LEN}; - ret = smlParseValueFromJSON(valueJson, &kv); - if (unlikely(ret)) { - uError("OTD:0x%" PRIx64 " Unable to parse metric value from JSON payload", info->id); - return ret; - } + SML_CHECK_CODE(smlParseValueFromJSON(valueJson, &kv)); // Parse tags - bool needFree = info->dataFormat; elements->tags = cJSON_PrintUnformatted(tagsJson); - if (elements->tags == NULL){ - return TSDB_CODE_OUT_OF_MEMORY; - } - elements->tagsLen = strlen(elements->tags); - if (is_same_child_table_telnet(elements, &info->preLine) != 0) { - ret = smlParseTagsFromJSON(info, tagsJson, elements); - if (unlikely(ret)) { - uError("OTD:0x%" PRIx64 " Unable to parse tags from JSON payload", info->id); - taosMemoryFree(elements->tags); - elements->tags = NULL; - return ret; - } - } else { - elements->measureTag = info->preLine.measureTag; - } + SML_CHECK_NULL(elements->tags); - if (needFree) { - taosMemoryFree(elements->tags); - elements->tags = NULL; - } + elements->tagsLen = strlen(elements->tags); + SML_CHECK_CODE(smlParseTagsFromJSON(info, tagsJson, elements)); if (unlikely(info->reRun)) { - return TSDB_CODE_SUCCESS; + goto END; } // Parse timestamp @@ -489,22 +465,29 @@ static int32_t smlParseJSONStringExt(SSmlHandle *info, cJSON *root, SSmlLineInfo if (unlikely(ts < 0)) { char* tmp = cJSON_PrintUnformatted(tsJson); if (tmp == NULL) { - uError("cJSON_PrintUnformatted failed since %s", tstrerror(TSDB_CODE_OUT_OF_MEMORY)); uError("OTD:0x%" PRIx64 " Unable to parse timestamp from JSON payload %s %" PRId64, info->id, info->msgBuf.buf, ts); } else { uError("OTD:0x%" PRIx64 " Unable to parse timestamp from JSON payload %s %s %" PRId64, info->id, info->msgBuf.buf,tmp, ts); taosMemoryFree(tmp); } - return TSDB_CODE_INVALID_TIMESTAMP; + code = TSDB_CODE_INVALID_TIMESTAMP; + goto END; } SSmlKv kvTs = {0}; smlBuildTsKv(&kvTs, ts); if (info->dataFormat){ - ret = smlParseEndTelnetJsonFormat(info, elements, &kvTs, &kv); + code = smlParseEndTelnetJsonFormat(info, elements, &kvTs, &kv); } else { - ret = smlParseEndTelnetJsonUnFormat(info, elements, &kvTs, &kv); + code = smlParseEndTelnetJsonUnFormat(info, elements, &kvTs, &kv); } - return ret; + SML_CHECK_CODE(code); + taosMemoryFreeClear(info->preLine.tags); + info->preLine = *elements; + elements->tags = NULL; + +END: + taosMemoryFree(elements->tags); + RETURN } int32_t smlParseJSONExt(SSmlHandle *info, char *payload) { @@ -527,23 +510,7 @@ int32_t smlParseJSONExt(SSmlHandle *info, char *payload) { return TSDB_CODE_TSC_INVALID_JSON; } - if (unlikely(info->lines != NULL)) { - for (int i = 0; i < info->lineNum; i++) { - taosArrayDestroyEx(info->lines[i].colArray, freeSSmlKv); - if (info->lines[i].measureTagsLen != 0) taosMemoryFree(info->lines[i].measureTag); - } - taosMemoryFree(info->lines); - info->lines = NULL; - } info->lineNum = payloadNum; - info->dataFormat = true; - - ret = smlClearForRerun(info); - if (ret != TSDB_CODE_SUCCESS) { - return ret; - } - - info->parseJsonByLib = true; cJSON *head = (payloadNum == 1 && cJSON_IsObject(info->root)) ? info->root : info->root->child; int cnt = 0; @@ -552,6 +519,8 @@ int32_t smlParseJSONExt(SSmlHandle *info, char *payload) { if (info->dataFormat) { SSmlLineInfo element = {0}; ret = smlParseJSONStringExt(info, dataPoint, &element); + if (element.measureTagsLen != 0) taosMemoryFree(element.measureTag); + } else { ret = smlParseJSONStringExt(info, dataPoint, info->lines + cnt); } diff --git a/source/client/src/clientSmlLine.c b/source/client/src/clientSmlLine.c index 5ecf4e2206f8..e2e60ee7c493 100644 --- a/source/client/src/clientSmlLine.c +++ b/source/client/src/clientSmlLine.c @@ -312,6 +312,7 @@ static int32_t smlProcessTagLine(SSmlHandle *info, char **sql, char *sqlEnd){ static int32_t smlParseTagLine(SSmlHandle *info, char **sql, char *sqlEnd, SSmlLineInfo *elements) { int32_t code = 0; + int32_t lino = 0; bool isSameCTable = IS_SAME_CHILD_TABLE; if(isSameCTable){ return TSDB_CODE_SUCCESS; @@ -327,7 +328,7 @@ static int32_t smlParseTagLine(SSmlHandle *info, char **sql, char *sqlEnd, SSmlL if(info->reRun){ return TSDB_CODE_SUCCESS; } - return code; + RETURN } static int32_t smlParseColLine(SSmlHandle *info, char **sql, char *sqlEnd, SSmlLineInfo *currElement) { diff --git a/source/client/src/clientSmlTelnet.c b/source/client/src/clientSmlTelnet.c index bf422675efeb..4deb6a34cd4c 100644 --- a/source/client/src/clientSmlTelnet.c +++ b/source/client/src/clientSmlTelnet.c @@ -149,19 +149,20 @@ static int32_t smlParseTelnetTags(SSmlHandle *info, char *data, char *sqlEnd, SS } int32_t code = 0; + int32_t lino = 0; if(info->dataFormat){ SML_CHECK_CODE(smlProcessSuperTable(info, elements)); } SML_CHECK_CODE(smlProcessTagTelnet(info, data, sqlEnd)); SML_CHECK_CODE(smlJoinMeasureTag(elements)); - return smlProcessChildTable(info, elements); + code = smlProcessChildTable(info, elements); END: if(info->reRun){ return TSDB_CODE_SUCCESS; } - return code; + RETURN } // format: =[ =] @@ -233,5 +234,7 @@ int32_t smlParseTelnetString(SSmlHandle *info, char *sql, char *sqlEnd, SSmlLine } else { ret = smlParseEndTelnetJsonUnFormat(info, elements, &kvTs, &kv); } + info->preLine = *elements; + return ret; } \ No newline at end of file diff --git a/utils/test/c/sml_test.c b/utils/test/c/sml_test.c index 1d8d82ccb97c..20f2d7dc251f 100644 --- a/utils/test/c/sml_test.c +++ b/utils/test/c/sml_test.c @@ -105,6 +105,102 @@ int smlProcess_telnet_Test() { return code; } +int smlProcess_json0_Test() { + TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); + + TAOS_RES *pRes = taos_query(taos, "create database if not exists sml_db"); + taos_free_result(pRes); + + pRes = taos_query(taos, "use sml_db"); + taos_free_result(pRes); + + const char *sql[] = { + "[{\"metric\":\"sys.cpu.nice\",\"timestamp\":1662344045,\"value\":9,\"tags\":{\"host\":\"web02\",\"dc\":4}}]"}; + + char *sql1[1] = {0}; + for (int i = 0; i < 1; i++) { + sql1[i] = taosMemoryCalloc(1, 1024); + ASSERT(sql1[i] != NULL); + (void)strncpy(sql1[i], sql[i], 1023); + } + + pRes = taos_schemaless_insert(taos, (char **)sql1, sizeof(sql1) / sizeof(sql1[0]), TSDB_SML_JSON_PROTOCOL, + TSDB_SML_TIMESTAMP_NANO_SECONDS); + int code = taos_errno(pRes); + if (code != 0) { + printf("%s result:%s\n", __FUNCTION__, taos_errstr(pRes)); + } else { + printf("%s result:success\n", __FUNCTION__); + } + taos_free_result(pRes); + + for (int i = 0; i < 1; i++) { + taosMemoryFree(sql1[i]); + } + ASSERT(code == 0); + + + const char *sql2[] = { + "[{\"metric\":\"sys.cpu.nice\",\"timestamp\":1662344041,\"value\":13,\"tags\":{\"host\":\"web01\",\"dc\":1}" + "},{\"metric\":\"sys.cpu.nice\",\"timestamp\":1662344042,\"value\":9,\"tags\":{\"host\":\"web02\",\"dc\":4}" + "}]", + }; + + char *sql3[1] = {0}; + for (int i = 0; i < 1; i++) { + sql3[i] = taosMemoryCalloc(1, 1024); + ASSERT(sql3[i] != NULL); + (void)strncpy(sql3[i], sql2[i], 1023); + } + + pRes = taos_schemaless_insert(taos, (char **)sql3, sizeof(sql3) / sizeof(sql3[0]), TSDB_SML_JSON_PROTOCOL, + TSDB_SML_TIMESTAMP_NANO_SECONDS); + code = taos_errno(pRes); + if (code != 0) { + printf("%s result:%s\n", __FUNCTION__, taos_errstr(pRes)); + } else { + printf("%s result:success\n", __FUNCTION__); + } + taos_free_result(pRes); + + for (int i = 0; i < 1; i++) { + taosMemoryFree(sql3[i]); + } + + ASSERT(code == 0); + + + // TD-22903 + const char *sql4[] = { + "[{\"metric\": \"test_us\", \"timestamp\": {\"value\": 1626006833639, \"type\": \"ms\"}, \"value\": true, \"tags\": {\"t0\": true}}, {\"metric\": \"test_us\", \"timestamp\": {\"value\": 1626006833638, \"type\": \"ms\"}, \"value\": false, \"tags\": {\"t0\": true}}]" + }; + char *sql5[1] = {0}; + for (int i = 0; i < 1; i++) { + sql5[i] = taosMemoryCalloc(1, 1024); + ASSERT(sql5[i] != NULL); + (void)strncpy(sql5[i], sql4[i], 1023); + } + + pRes = taos_schemaless_insert(taos, (char **)sql5, sizeof(sql5) / sizeof(sql5[0]), TSDB_SML_JSON_PROTOCOL, + TSDB_SML_TIMESTAMP_NANO_SECONDS); + code = taos_errno(pRes); + if (code != 0) { + printf("%s result:%s\n", __FUNCTION__, taos_errstr(pRes)); + } else { + printf("%s result:success\n", __FUNCTION__); + } + taos_free_result(pRes); + + for (int i = 0; i < 1; i++) { + taosMemoryFree(sql5[i]); + } + ASSERT(code == 0); + + taos_close(taos); + + return code; +} + int smlProcess_json1_Test() { TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); @@ -2135,8 +2231,8 @@ int main(int argc, char *argv[]) { taos_options(TSDB_OPTION_CONFIGDIR, argv[1]); } - int ret = 0; - ret = sml_ts5528_test(); +// int ret = smlProcess_json0_Test(); + int ret = sml_ts5528_test(); ASSERT(!ret); ret = sml_td29691_Test(); ASSERT(ret); @@ -2146,8 +2242,8 @@ int main(int argc, char *argv[]) { ASSERT(!ret); ret = sml_td18789_Test(); ASSERT(!ret); - ret = sml_td24070_Test(); - ASSERT(!ret); +// ret = sml_td24070_Test(); +// ASSERT(!ret); ret = sml_td23881_Test(); ASSERT(ret); ret = sml_escape_Test(); From c642531e2f2e1d3591057faa4bd825095f51d421 Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Thu, 24 Oct 2024 15:58:39 +0800 Subject: [PATCH 243/695] fix(az/stream): catch all exceptions from cpp --- source/libs/azure/src/az.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/source/libs/azure/src/az.cpp b/source/libs/azure/src/az.cpp index 831694356a82..5989a7c333cb 100644 --- a/source/libs/azure/src/az.cpp +++ b/source/libs/azure/src/az.cpp @@ -416,7 +416,7 @@ int32_t azPutObjectFromFile2(const char *file, const char *object, int8_t withcp return 0; } -int32_t azGetObjectToFile(const char *object_name, const char *fileName) { +int32_t azGetObjectToFileImpl(const char *object_name, const char *fileName) { int32_t code = TSDB_CODE_SUCCESS; std::string accountName = tsS3AccessKeyId[0]; std::string accountKey = tsS3AccessKeySecret[0]; @@ -450,6 +450,23 @@ int32_t azGetObjectToFile(const char *object_name, const char *fileName) { TAOS_RETURN(code); } +int32_t azGetObjectToFile(const char *object_name, const char *fileName) { + int32_t code = 0; + + try { + code = azGetObjectToFileImpl(object_name, fileName); + } catch (const std::exception &e) { + azError("%s: Reason Phrase: %s", __func__, e.what()); + + code = TAOS_SYSTEM_ERROR(EIO); + azError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(code)); + + TAOS_RETURN(code); + } + + TAOS_RETURN(code); +} + int32_t azGetObjectsByPrefix(const char *prefix, const char *path) { const std::string delimiter = "/"; std::string accountName = tsS3AccessKeyId[0]; From 4090aad6fd2c53a940e9472a8d3614357d557704 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Thu, 24 Oct 2024 16:18:39 +0800 Subject: [PATCH 244/695] enh:[TD-32166]refactor code in sml --- source/client/src/clientSml.c | 8 +++- utils/test/c/sml_test.c | 82 ++++++++++++++++++++--------------- 2 files changed, 54 insertions(+), 36 deletions(-) diff --git a/source/client/src/clientSml.c b/source/client/src/clientSml.c index 5f4327b1cd20..1b4643a95821 100644 --- a/source/client/src/clientSml.c +++ b/source/client/src/clientSml.c @@ -1289,7 +1289,9 @@ void smlDestroyInfo(SSmlHandle *info) { } taosMemoryFree(info->lines); } - taosMemoryFreeClear(info->preLine.tags); + if(info->protocol == TSDB_SML_JSON_PROTOCOL) { + taosMemoryFreeClear(info->preLine.tags); + } cJSON_Delete(info->root); taosMemoryFreeClear(info); } @@ -1546,7 +1548,9 @@ int32_t smlClearForRerun(SSmlHandle *info) { } taosArrayClearP(info->escapedStringList, taosMemoryFree); - taosMemoryFreeClear(info->preLine.tags); + if(info->protocol == TSDB_SML_JSON_PROTOCOL) { + taosMemoryFreeClear(info->preLine.tags); + } (void)memset(&info->preLine, 0, sizeof(SSmlLineInfo)); info->currSTableMeta = NULL; info->currTableDataCtx = NULL; diff --git a/utils/test/c/sml_test.c b/utils/test/c/sml_test.c index 20f2d7dc251f..6d4192280c28 100644 --- a/utils/test/c/sml_test.c +++ b/utils/test/c/sml_test.c @@ -105,6 +105,44 @@ int smlProcess_telnet_Test() { return code; } +int smlProcess_telnet0_Test() { + TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); + + TAOS_RES *pRes = taos_query(taos, "create database if not exists sml_db schemaless 1"); + taos_free_result(pRes); + + pRes = taos_query(taos, "use sml_db"); + taos_free_result(pRes); + + const char *sql1[] = {"sysif.bytes.out 1479496100 1.3E0 host=web01 interface=eth0"}; + pRes = taos_schemaless_insert(taos, (char **)sql1, sizeof(sql1) / sizeof(sql1[0]), TSDB_SML_TELNET_PROTOCOL, + TSDB_SML_TIMESTAMP_NANO_SECONDS); + printf("%s result:%s\n", __FUNCTION__, taos_errstr(pRes)); + int code = taos_errno(pRes); + ASSERT(code == 0); + taos_free_result(pRes); + + const char *sql2[] = {"sysif.bytes.out 1479496700 1.6E0 host=web01 interface=eth0"}; + pRes = taos_schemaless_insert(taos, (char **)sql2, sizeof(sql2) / sizeof(sql2[0]), TSDB_SML_TELNET_PROTOCOL, + TSDB_SML_TIMESTAMP_NANO_SECONDS); + printf("%s result:%s\n", __FUNCTION__, taos_errstr(pRes)); + code = taos_errno(pRes); + ASSERT(code == 0); + taos_free_result(pRes); + + const char *sql3[] = {"sysif.bytes.out 1479496300 1.1E0 interface=eth0 host=web01"}; + pRes = taos_schemaless_insert(taos, (char **)sql3, sizeof(sql3) / sizeof(sql3[0]), TSDB_SML_TELNET_PROTOCOL, + TSDB_SML_TIMESTAMP_NANO_SECONDS); + printf("%s result:%s\n", __FUNCTION__, taos_errstr(pRes)); + code = taos_errno(pRes); + ASSERT(code == 0); + taos_free_result(pRes); + + taos_close(taos); + + return code; +} + int smlProcess_json0_Test() { TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); @@ -115,7 +153,7 @@ int smlProcess_json0_Test() { taos_free_result(pRes); const char *sql[] = { - "[{\"metric\":\"sys.cpu.nice\",\"timestamp\":1662344045,\"value\":9,\"tags\":{\"host\":\"web02\",\"dc\":4}}]"}; + "[{\"metric\":\"syscpu.nice\",\"timestamp\":1662344045,\"value\":9,\"tags\":{\"host\":\"web02\",\"dc\":4}}]"}; char *sql1[1] = {0}; for (int i = 0; i < 1; i++) { @@ -141,8 +179,8 @@ int smlProcess_json0_Test() { const char *sql2[] = { - "[{\"metric\":\"sys.cpu.nice\",\"timestamp\":1662344041,\"value\":13,\"tags\":{\"host\":\"web01\",\"dc\":1}" - "},{\"metric\":\"sys.cpu.nice\",\"timestamp\":1662344042,\"value\":9,\"tags\":{\"host\":\"web02\",\"dc\":4}" + "[{\"metric\":\"syscpu.nice\",\"timestamp\":1662344041,\"value\":13,\"tags\":{\"host\":\"web01\",\"dc\":1}" + "},{\"metric\":\"syscpu.nice\",\"timestamp\":1662344042,\"value\":9,\"tags\":{\"host\":\"web02\",\"dc\":4}" "}]", }; @@ -169,33 +207,6 @@ int smlProcess_json0_Test() { ASSERT(code == 0); - - // TD-22903 - const char *sql4[] = { - "[{\"metric\": \"test_us\", \"timestamp\": {\"value\": 1626006833639, \"type\": \"ms\"}, \"value\": true, \"tags\": {\"t0\": true}}, {\"metric\": \"test_us\", \"timestamp\": {\"value\": 1626006833638, \"type\": \"ms\"}, \"value\": false, \"tags\": {\"t0\": true}}]" - }; - char *sql5[1] = {0}; - for (int i = 0; i < 1; i++) { - sql5[i] = taosMemoryCalloc(1, 1024); - ASSERT(sql5[i] != NULL); - (void)strncpy(sql5[i], sql4[i], 1023); - } - - pRes = taos_schemaless_insert(taos, (char **)sql5, sizeof(sql5) / sizeof(sql5[0]), TSDB_SML_JSON_PROTOCOL, - TSDB_SML_TIMESTAMP_NANO_SECONDS); - code = taos_errno(pRes); - if (code != 0) { - printf("%s result:%s\n", __FUNCTION__, taos_errstr(pRes)); - } else { - printf("%s result:success\n", __FUNCTION__); - } - taos_free_result(pRes); - - for (int i = 0; i < 1; i++) { - taosMemoryFree(sql5[i]); - } - ASSERT(code == 0); - taos_close(taos); return code; @@ -2231,8 +2242,9 @@ int main(int argc, char *argv[]) { taos_options(TSDB_OPTION_CONFIGDIR, argv[1]); } -// int ret = smlProcess_json0_Test(); - int ret = sml_ts5528_test(); + int ret = smlProcess_json0_Test(); + ASSERT(!ret); + ret = sml_ts5528_test(); ASSERT(!ret); ret = sml_td29691_Test(); ASSERT(ret); @@ -2252,8 +2264,8 @@ int main(int argc, char *argv[]) { ASSERT(!ret); ret = sml_ts3116_Test(); ASSERT(!ret); - ret = sml_ts2385_Test(); // this test case need config sml table name using ./sml_test config_file - ASSERT(!ret); +// ret = sml_ts2385_Test(); // this test case need config sml table name using ./sml_test config_file +// ASSERT(!ret); ret = sml_ts3303_Test(); ASSERT(!ret); ret = sml_ttl_Test(); @@ -2268,6 +2280,8 @@ int main(int argc, char *argv[]) { ASSERT(!ret); ret = smlProcess_telnet_Test(); ASSERT(!ret); + ret = smlProcess_telnet0_Test(); + ASSERT(!ret); ret = smlProcess_json1_Test(); ASSERT(!ret); ret = smlProcess_json2_Test(); From 2bb13dd7dd3cf52ac332bcaed6a0d7ca9072b1b5 Mon Sep 17 00:00:00 2001 From: qevolg <2227465945@qq.com> Date: Thu, 24 Oct 2024 16:31:47 +0800 Subject: [PATCH 245/695] chore(.github): modify taoskeeper github action workflow --- .github/workflows/taoskeeper-ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/taoskeeper-ci.yml b/.github/workflows/taoskeeper-ci.yml index a6e41bc5f086..edfcfe717799 100644 --- a/.github/workflows/taoskeeper-ci.yml +++ b/.github/workflows/taoskeeper-ci.yml @@ -14,7 +14,7 @@ jobs: - name: Checkout the repository uses: actions/checkout@v4 - - name: Setup Go env + - name: Set up Go uses: actions/setup-go@v5 with: go-version: 1.18 @@ -49,6 +49,7 @@ jobs: run: | go mod tidy go test -v ./... + working-directory: tools/keeper - name: Clean up if: always() From 5f7dbde47fa0a408fd024819df17322a1a4faa75 Mon Sep 17 00:00:00 2001 From: Jing Sima Date: Thu, 24 Oct 2024 15:07:10 +0800 Subject: [PATCH 246/695] enh:[TD-32459] Abstract function properties into a struct. --- source/libs/function/inc/builtins.h | 20 +- source/libs/function/inc/functionMgtInt.h | 11 +- source/libs/function/src/builtins.c | 1439 +++++++++------------ 3 files changed, 599 insertions(+), 871 deletions(-) diff --git a/source/libs/function/inc/builtins.h b/source/libs/function/inc/builtins.h index c76d32efee95..fb0db58f1c7c 100644 --- a/source/libs/function/inc/builtins.h +++ b/source/libs/function/inc/builtins.h @@ -31,10 +31,10 @@ typedef EFuncDataRequired (*FFuncDynDataRequired)(void* pRes, SDataBlockInfo* pB typedef EFuncReturnRows (*FEstimateReturnRows)(SFunctionNode* pFunc); #define MAX_FUNC_PARA_NUM 16 - +#define MAX_FUNC_PARA_FIXED_VALUE_NUM 16 typedef struct SParamRange { - double dMinVal; - double dMaxVal; + int64_t iMinVal; + int64_t iMaxVal; } SParamRange; typedef struct SParamInfo { @@ -43,17 +43,11 @@ typedef struct SParamInfo { int8_t endParam; uint64_t validDataType; uint64_t validNodeType; - bool hasRange; - bool isTs; // used for input parameter - bool isPK; // used for input parameter - bool isFixedValue; // used for input parameter - bool hasColumn; // used for input parameter, parameter must contain columns - bool isFirstLast; // special check for first and last - bool isTimeUnit; // used for input parameter, need check whether time unit is valid - bool isHistogramBin; // used for input parameter, need check whether histogram bin is valid + uint64_t paramAttribute; + uint8_t valueRangeFlag; // 0 for no range and no fixed value, 1 for value has range, 2 for fixed value uint8_t fixedValueSize; - char fixedStrValue[MAX_FUNC_PARA_NUM][16]; // used for input parameter - int32_t fixedNumValue[MAX_FUNC_PARA_NUM]; // used for input parameter + char* fixedStrValue[MAX_FUNC_PARA_FIXED_VALUE_NUM]; // used for input parameter + int64_t fixedNumValue[MAX_FUNC_PARA_FIXED_VALUE_NUM]; // used for input parameter SParamRange range; } SParamInfo; diff --git a/source/libs/function/inc/functionMgtInt.h b/source/libs/function/inc/functionMgtInt.h index 924ec6d40a90..e10581beb632 100644 --- a/source/libs/function/inc/functionMgtInt.h +++ b/source/libs/function/inc/functionMgtInt.h @@ -102,7 +102,16 @@ extern "C" { #define FUNC_PARAM_SUPPORT_COLUMN_NODE FUNC_MGT_FUNC_PARAM_SUPPORT_NODE(6) #define FUNC_PARAM_SUPPORT_NOT_VALUE_NODE FUNC_MGT_FUNC_PARAM_SUPPORT_NODE(7) -#define FUNC_PARAM_SUPPORT_NODE_MAX 7 +#define FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE 0 +#define FUNC_PARAM_MUST_BE_PRIMTS 1 +#define FUNC_PARAM_MUST_BE_PK 2 +#define FUNC_PARAM_MUST_HAVE_COLUMN 3 +#define FUNC_PARAM_MUST_BE_TIME_UNIT 4 +#define FUNC_PARAM_VALUE_NODE_NOT_NULL 5 + +#define FUNC_PARAM_NO_SPECIFIC_VALUE 0 +#define FUNC_PARAM_HAS_RANGE 1 +#define FUNC_PARAM_HAS_FIXED_VALUE 2 #define FUNC_ERR_RET(c) \ do { \ diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c index 276c77f567c8..5e21cd94e81c 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -536,7 +536,7 @@ static int32_t validateHistogramBinDesc(char* binDescStr, int8_t binType, char* if (numOfParams != 4) { (void)snprintf(errMsg, msgLen, "%s", msg1); cJSON_Delete(binDesc); - return TSDB_CODE_FAILED; + return TSDB_CODE_FUNC_HISTOGRAM_ERROR; } cJSON* start = cJSON_GetObjectItem(binDesc, "start"); @@ -548,20 +548,20 @@ static int32_t validateHistogramBinDesc(char* binDescStr, int8_t binType, char* if (!cJSON_IsNumber(start) || !cJSON_IsNumber(count) || !cJSON_IsBool(infinity)) { (void)snprintf(errMsg, msgLen, "%s", msg3); cJSON_Delete(binDesc); - return TSDB_CODE_FAILED; + return TSDB_CODE_FUNC_HISTOGRAM_ERROR; } if (count->valueint <= 0 || count->valueint > 1000) { // limit count to 1000 (void)snprintf(errMsg, msgLen, "%s", msg4); cJSON_Delete(binDesc); - return TSDB_CODE_FAILED; + return TSDB_CODE_FUNC_HISTOGRAM_ERROR; } if (isinf(start->valuedouble) || (width != NULL && isinf(width->valuedouble)) || (factor != NULL && isinf(factor->valuedouble)) || (count != NULL && isinf(count->valuedouble))) { (void)snprintf(errMsg, msgLen, "%s", msg5); cJSON_Delete(binDesc); - return TSDB_CODE_FAILED; + return TSDB_CODE_FUNC_HISTOGRAM_ERROR; } int32_t counter = (int32_t)count->valueint; @@ -577,7 +577,7 @@ static int32_t validateHistogramBinDesc(char* binDescStr, int8_t binType, char* if (intervals == NULL) { (void)snprintf(errMsg, msgLen, "%s", msg9); cJSON_Delete(binDesc); - return TSDB_CODE_FAILED; + return TSDB_CODE_FUNC_HISTOGRAM_ERROR; } if (cJSON_IsNumber(width) && factor == NULL && binType == LINEAR_BIN) { // linear bin process @@ -585,7 +585,7 @@ static int32_t validateHistogramBinDesc(char* binDescStr, int8_t binType, char* (void)snprintf(errMsg, msgLen, "%s", msg6); taosMemoryFree(intervals); cJSON_Delete(binDesc); - return TSDB_CODE_FAILED; + return TSDB_CODE_FUNC_HISTOGRAM_ERROR; } for (int i = 0; i < counter + 1; ++i) { intervals[startIndex] = start->valuedouble + i * width->valuedouble; @@ -593,7 +593,7 @@ static int32_t validateHistogramBinDesc(char* binDescStr, int8_t binType, char* (void)snprintf(errMsg, msgLen, "%s", msg5); taosMemoryFree(intervals); cJSON_Delete(binDesc); - return TSDB_CODE_FAILED; + return TSDB_CODE_FUNC_HISTOGRAM_ERROR; } startIndex++; } @@ -603,13 +603,13 @@ static int32_t validateHistogramBinDesc(char* binDescStr, int8_t binType, char* (void)snprintf(errMsg, msgLen, "%s", msg7); taosMemoryFree(intervals); cJSON_Delete(binDesc); - return TSDB_CODE_FAILED; + return TSDB_CODE_FUNC_HISTOGRAM_ERROR; } if (factor->valuedouble < 0 || factor->valuedouble == 0 || factor->valuedouble == 1) { (void)snprintf(errMsg, msgLen, "%s", msg8); taosMemoryFree(intervals); cJSON_Delete(binDesc); - return TSDB_CODE_FAILED; + return TSDB_CODE_FUNC_HISTOGRAM_ERROR; } for (int i = 0; i < counter + 1; ++i) { intervals[startIndex] = start->valuedouble * pow(factor->valuedouble, i * 1.0); @@ -617,7 +617,7 @@ static int32_t validateHistogramBinDesc(char* binDescStr, int8_t binType, char* (void)snprintf(errMsg, msgLen, "%s", msg5); taosMemoryFree(intervals); cJSON_Delete(binDesc); - return TSDB_CODE_FAILED; + return TSDB_CODE_FUNC_HISTOGRAM_ERROR; } startIndex++; } @@ -625,7 +625,7 @@ static int32_t validateHistogramBinDesc(char* binDescStr, int8_t binType, char* (void)snprintf(errMsg, msgLen, "%s", msg3); taosMemoryFree(intervals); cJSON_Delete(binDesc); - return TSDB_CODE_FAILED; + return TSDB_CODE_FUNC_HISTOGRAM_ERROR; } if (infinity->valueint == true) { @@ -633,7 +633,7 @@ static int32_t validateHistogramBinDesc(char* binDescStr, int8_t binType, char* intervals[numOfBins - 1] = INFINITY; // in case of desc bin orders, -inf/inf should be swapped if (numOfBins < 4) { - return TSDB_CODE_FAILED; + return TSDB_CODE_FUNC_HISTOGRAM_ERROR; } if (intervals[1] > intervals[numOfBins - 2]) { @@ -644,7 +644,7 @@ static int32_t validateHistogramBinDesc(char* binDescStr, int8_t binType, char* if (binType != USER_INPUT_BIN) { (void)snprintf(errMsg, msgLen, "%s", msg3); cJSON_Delete(binDesc); - return TSDB_CODE_FAILED; + return TSDB_CODE_FUNC_HISTOGRAM_ERROR; } numOfBins = cJSON_GetArraySize(binDesc); intervals = taosMemoryCalloc(numOfBins, sizeof(double)); @@ -658,7 +658,7 @@ static int32_t validateHistogramBinDesc(char* binDescStr, int8_t binType, char* (void)snprintf(errMsg, msgLen, "%s", msg3); taosMemoryFree(intervals); cJSON_Delete(binDesc); - return TSDB_CODE_FAILED; + return TSDB_CODE_FUNC_HISTOGRAM_ERROR; } int i = 0; while (bin) { @@ -667,13 +667,13 @@ static int32_t validateHistogramBinDesc(char* binDescStr, int8_t binType, char* (void)snprintf(errMsg, msgLen, "%s", msg3); taosMemoryFree(intervals); cJSON_Delete(binDesc); - return TSDB_CODE_FAILED; + return TSDB_CODE_FUNC_HISTOGRAM_ERROR; } if (i != 0 && intervals[i] <= intervals[i - 1]) { (void)snprintf(errMsg, msgLen, "%s", msg3); taosMemoryFree(intervals); cJSON_Delete(binDesc); - return TSDB_CODE_FAILED; + return TSDB_CODE_FUNC_HISTOGRAM_ERROR; } bin = bin->next; i++; @@ -681,7 +681,7 @@ static int32_t validateHistogramBinDesc(char* binDescStr, int8_t binType, char* } else { (void)snprintf(errMsg, msgLen, "%s", msg3); cJSON_Delete(binDesc); - return TSDB_CODE_FAILED; + return TSDB_CODE_FUNC_HISTOGRAM_ERROR; } cJSON_Delete(binDesc); @@ -689,6 +689,120 @@ static int32_t validateHistogramBinDesc(char* binDescStr, int8_t binType, char* return TSDB_CODE_SUCCESS; } +static int32_t checkRangeValue(SNode *pNode, SParamRange range, bool *isMatch) { + int32_t code = TSDB_CODE_SUCCESS; + if (pNode->type == QUERY_NODE_VALUE) { + SValueNode* pVal = (SValueNode*)pNode; + if (IS_INTEGER_TYPE(getSDataTypeFromNode(pNode)->type)) { + if (pVal->datum.i < range.iMinVal || + pVal->datum.i > range.iMaxVal) { + code = TSDB_CODE_FUNC_FUNTION_PARA_RANGE; + *isMatch = false; + } + } else { + if ((int64_t)pVal->datum.d < range.iMinVal || + (int64_t)pVal->datum.d > range.iMaxVal) { + code = TSDB_CODE_FUNC_FUNTION_PARA_RANGE; + *isMatch = false; + } + } + } else { + // for other node type, range check should be done in process function + } + return code; +} + +static int32_t checkFixedValue(SNode *pNode, const SParamInfo *paramPattern, int32_t paramIdx, bool *isMatch) { + int32_t code = TSDB_CODE_SUCCESS; + bool checkStr = paramSupportVarBinary(paramPattern->validDataType) || + paramSupportVarchar(paramPattern->validDataType) || + paramSupportNchar(paramPattern->validDataType); + if (pNode->type == QUERY_NODE_VALUE) { + SValueNode* pVal = (SValueNode*)pNode; + if (!checkStr) { + for (int32_t k = 0; k < paramPattern->fixedValueSize; k++) { + if (pVal->datum.i == paramPattern->fixedNumValue[k]) { + code = TSDB_CODE_SUCCESS; + *isMatch = true; + break; + } else { + code = TSDB_CODE_FUNC_FUNTION_PARA_VALUE; + *isMatch = false; + } + } + } else { + for (int32_t k = 0; k < paramPattern->fixedValueSize; k++) { + if (strcasecmp(pVal->literal, paramPattern->fixedStrValue[k]) == 0) { + code = TSDB_CODE_SUCCESS; + *isMatch = true; + break; + } else { + code = TSDB_CODE_FUNC_FUNTION_PARA_VALUE; + *isMatch = false; + } + } + } + } else { + // for other node type, fixed value check should be done in process function + } + return code; +} + +static int32_t checkPrimTS(SNode *pNode, bool *isMatch) { + int32_t code = TSDB_CODE_SUCCESS; + if (nodeType(pNode) != QUERY_NODE_COLUMN || !IS_TIMESTAMP_TYPE(getSDataTypeFromNode(pNode)->type) || + !((SColumnNode*)pNode)->isPrimTs) { + code = TSDB_CODE_FUNC_FUNTION_PARA_PRIMTS; + *isMatch = false; + } + return code; +} + +static int32_t checkPrimaryKey(SNode *pNode, bool *isMatch) { + int32_t code = TSDB_CODE_SUCCESS; + if (nodeType(pNode) != QUERY_NODE_COLUMN || !IS_INTEGER_TYPE(getSDataTypeFromNode(pNode)->type) || + !((SColumnNode*)pNode)->isPk) { + code = TSDB_CODE_FUNC_FUNTION_PARA_PK; + *isMatch = false; + } + return code; +} + +static int32_t checkHasColumn(SNode *pNode, bool *isMatch) { + int32_t code = TSDB_CODE_SUCCESS; + if (!nodesExprHasColumn(pNode)) { + code = TSDB_CODE_FUNC_FUNTION_PARA_HAS_COL; + *isMatch = false; + } + return code; +} + +static int32_t checkValueNodeNotNull(SNode *pNode, bool *isMatch) { + int32_t code = TSDB_CODE_SUCCESS; + if (IS_NULL_TYPE(getSDataTypeFromNode(pNode)->type) && QUERY_NODE_VALUE == nodeType(pNode)) { + code = TSDB_CODE_FUNC_FUNTION_PARA_TYPE; + *isMatch = false; + } + return code; +} + +static int32_t checkTimeUnit(SNode *pNode, int32_t precision, bool *isMatch) { + if (nodeType(pNode) != QUERY_NODE_VALUE || !IS_INTEGER_TYPE(getSDataTypeFromNode(pNode)->type)) { + *isMatch = false; + return TSDB_CODE_FUNC_FUNTION_PARA_TYPE; + } + + if (IS_NULL_TYPE(getSDataTypeFromNode(pNode)->type)) { + *isMatch = true; + return TSDB_CODE_SUCCESS; + } + + int32_t code = validateTimeUnitParam(precision, (SValueNode*)pNode); + if (TSDB_CODE_SUCCESS != code) { + *isMatch = false; + } + return code; +} static int32_t validateParam(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { int32_t code = TSDB_CODE_SUCCESS; SNodeList* paramList = pFunc->pParameterList; @@ -736,139 +850,44 @@ static int32_t validateParam(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { SValueNode* pVal = (SValueNode*)pNode; pVal->notReserved = true; } - // check range value - if (paramPattern[paramIdx].hasRange) { - if (pNode->type == QUERY_NODE_VALUE) { - SValueNode* pVal = (SValueNode*)pNode; - if (IS_INTEGER_TYPE(getSDataTypeFromNode(pNode)->type)) { - if ((double)pVal->datum.i < paramPattern[paramIdx].range.dMinVal || - (double)pVal->datum.i > paramPattern[paramIdx].range.dMaxVal) { - code = TSDB_CODE_FUNC_FUNTION_PARA_RANGE; - isMatch = false; - break; - } - } else { - if ((double)pVal->datum.d < paramPattern[paramIdx].range.dMinVal || - (double)pVal->datum.d > paramPattern[paramIdx].range.dMaxVal) { - code = TSDB_CODE_FUNC_FUNTION_PARA_RANGE; - isMatch = false; - break; - } - } - } else { - // for other node type, range check should be done in process function - } - } - // check fixed value - if (paramPattern[paramIdx].isFixedValue) { - if (pNode->type == QUERY_NODE_VALUE) { - SValueNode* pVal = (SValueNode*)pNode; - if (IS_NUMERIC_TYPE(getSDataTypeFromNode(pNode)->type)) { - for (int32_t k = 0; k < paramPattern[paramIdx].fixedValueSize; k++) { - if (pVal->datum.i == paramPattern[paramIdx].fixedNumValue[k]) { - code = TSDB_CODE_SUCCESS; - isMatch = true; - break; - } else { - code = TSDB_CODE_FUNC_FUNTION_PARA_VALUE; - isMatch = false; - } - } - } else if (IS_STR_DATA_TYPE(getSDataTypeFromNode(pNode)->type)) { - for (int32_t k = 0; k < paramPattern[paramIdx].fixedValueSize; k++) { - if (strcasecmp(pVal->literal, paramPattern[paramIdx].fixedStrValue[k]) == 0) { - code = TSDB_CODE_SUCCESS; - isMatch = true; - break; - } else { - code = TSDB_CODE_FUNC_FUNTION_PARA_VALUE; - isMatch = false; - } - } - } - if (!isMatch) { - break; - } - } else { - // for other node type, fixed value check should be done in process function - } - } - // check isTs - if (paramPattern[paramIdx].isTs) { - if (nodeType(pNode) != QUERY_NODE_COLUMN || !IS_TIMESTAMP_TYPE(getSDataTypeFromNode(pNode)->type) || - !((SColumnNode*)pNode)->isPrimTs) { - code = TSDB_CODE_FUNC_FUNTION_PARA_PRIMTS; - isMatch = false; + switch (paramPattern[paramIdx].valueRangeFlag) { + case FUNC_PARAM_NO_SPECIFIC_VALUE: break; - } - } - // check isPK - if (paramPattern[paramIdx].isPK) { - if (nodeType(pNode) != QUERY_NODE_COLUMN || !IS_INTEGER_TYPE(getSDataTypeFromNode(pNode)->type) || - !((SColumnNode*)pNode)->isPk) { - code = TSDB_CODE_FUNC_FUNTION_PARA_PK; - isMatch = false; + case FUNC_PARAM_HAS_RANGE: + code = checkRangeValue(pNode, paramPattern[paramIdx].range, &isMatch); break; - } - } - // check hasColumn - if (paramPattern[paramIdx].hasColumn) { - if (!nodesExprHasColumn(pNode)) { - code = TSDB_CODE_FUNC_FUNTION_PARA_HAS_COL; - isMatch = false; + case FUNC_PARAM_HAS_FIXED_VALUE: + code = checkFixedValue(pNode, ¶mPattern[paramIdx], paramIdx, &isMatch); break; - } - } - // check first and last - if (paramPattern[paramIdx].isFirstLast) { - if (IS_NULL_TYPE(getSDataTypeFromNode(pNode)->type) && QUERY_NODE_VALUE == nodeType(pNode)) { - code = TSDB_CODE_FUNC_FUNTION_PARA_TYPE; - isMatch = false; + default: break; - } } - // check time unit - if (paramPattern[paramIdx].isTimeUnit) { - if (nodeType(pNode) != QUERY_NODE_VALUE || !IS_INTEGER_TYPE(getSDataTypeFromNode(pNode)->type)) { - code = TSDB_CODE_FUNC_FUNTION_PARA_TYPE; - isMatch = false; + if (!isMatch) { + break; + } + switch (paramPattern[paramIdx].paramAttribute) { + case FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE: break; - } - - if (IS_NULL_TYPE(getSDataTypeFromNode(pNode)->type)) { - code = TSDB_CODE_SUCCESS; - isMatch = true; - continue; - } - - code = validateTimeUnitParam(pFunc->node.resType.precision, (SValueNode*)pNode); - if (TSDB_CODE_SUCCESS != code) { - isMatch = false; + case FUNC_PARAM_MUST_BE_PRIMTS: + code = checkPrimTS(pNode, &isMatch); break; - } - } - // check histogram binary - if (paramPattern[paramIdx].isHistogramBin) { - if (nodeType(pNode) != QUERY_NODE_VALUE) { - code = TSDB_CODE_FUNC_FUNTION_PARA_TYPE; - isMatch = false; + case FUNC_PARAM_MUST_BE_PK: + code = checkPrimaryKey(pNode, &isMatch); break; - } - SValueNode *pValue = (SValueNode *)pNode; - SValueNode *pBinValue = (SValueNode *)nodesListGetNode(paramList, 1); - char* binDesc = varDataVal(pValue->datum.p); - int8_t binType = validateHistogramBinType(varDataVal(pBinValue->datum.p)); - if (binType == UNKNOWN_BIN) { - code = TSDB_CODE_FUNC_FUNCTION_HISTO_TYPE; - isMatch = false; + case FUNC_PARAM_MUST_HAVE_COLUMN: + code = checkHasColumn(pNode, &isMatch); break; - } - code = validateHistogramBinDesc(binDesc, binType, errMsg, (int32_t)sizeof(errMsg)); - if (TSDB_CODE_SUCCESS != code) { - code = TSDB_CODE_FUNC_HISTOGRAM_ERROR; - isMatch = false; + case FUNC_PARAM_VALUE_NODE_NOT_NULL: + code = checkValueNodeNotNull(pNode, &isMatch); + break; + case FUNC_PARAM_MUST_BE_TIME_UNIT: + code = checkTimeUnit(pNode, pFunc->node.resType.precision, &isMatch); + break; + default: break; - } + } + if (!isMatch) { + break; } } @@ -1650,6 +1669,45 @@ static int32_t translateOutVarchar(SFunctionNode* pFunc, char* pErrBuf, int32_t return TSDB_CODE_SUCCESS; } +static int32_t translateHistogramImpl(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { + FUNC_ERR_RET(validateParam(pFunc, pErrBuf, len)); + int32_t numOfParams = LIST_LENGTH(pFunc->pParameterList); + int8_t binType; + char* binDesc; + for (int32_t i = 1; i < numOfParams; ++i) { + SValueNode* pValue = (SValueNode*)nodesListGetNode(pFunc->pParameterList, i); + if (i == 1) { + binType = validateHistogramBinType(varDataVal(pValue->datum.p)); + if (binType == UNKNOWN_BIN) { + return buildFuncErrMsg(pErrBuf, len, TSDB_CODE_FUNC_FUNTION_ERROR, + "HISTOGRAM function binType parameter should be " + "\"user_input\", \"log_bin\" or \"linear_bin\""); + } + } + + if (i == 2) { + char errMsg[128] = {0}; + binDesc = varDataVal(pValue->datum.p); + if (TSDB_CODE_SUCCESS != validateHistogramBinDesc(binDesc, binType, errMsg, (int32_t)sizeof(errMsg))) { + return buildFuncErrMsg(pErrBuf, len, TSDB_CODE_FUNC_FUNTION_ERROR, errMsg); + } + } + } + return TSDB_CODE_SUCCESS; +} + +static int32_t translateHitogram(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { + FUNC_ERR_RET(translateHistogramImpl(pFunc, pErrBuf, len)); + pFunc->node.resType = (SDataType){.bytes = 512, .type = TSDB_DATA_TYPE_BINARY}; + return TSDB_CODE_SUCCESS; +} +static int32_t translateHistogramPartial(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { + FUNC_ERR_RET(translateHistogramImpl(pFunc, pErrBuf, len)); + pFunc->node.resType = + (SDataType){.bytes = getHistogramInfoSize() + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}; + return TSDB_CODE_SUCCESS; +} + // clang-format off const SBuiltinFuncDefinition funcMgtBuiltins[] = { { @@ -1664,10 +1722,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_ALL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_BIGINT_TYPE}}, .translateFunc = translateOutBigInt, .dataRequiredFunc = countDataRequired, @@ -1696,9 +1752,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_BIGINT_TYPE | FUNC_PARAM_SUPPORT_DOUBLE_TYPE | FUNC_PARAM_SUPPORT_UBIGINT_TYPE}}, .translateFunc = translateSum, .dataRequiredFunc = statisDataRequired, @@ -1727,9 +1782,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_STRING_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_STRING_TYPE}}, .translateFunc = translateMinMax, .dataRequiredFunc = statisDataRequired, @@ -1755,9 +1809,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_STRING_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_STRING_TYPE}}, .translateFunc = translateMinMax, .dataRequiredFunc = statisDataRequired, @@ -1783,10 +1836,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, .translateFunc = translateOutDouble, .getEnvFunc = getStdFuncEnv, @@ -1814,9 +1865,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, .translateFunc = translateOutVarchar, .getEnvFunc = getStdFuncEnv, @@ -1840,9 +1890,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, .translateFunc = translateOutDouble, .getEnvFunc = getStdFuncEnv, @@ -1868,17 +1917,15 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .inputParaInfo[0][1] = {.isLastParam = true, .startParam = 2, .endParam = 3, .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, - .isPK = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, .translateFunc = translateOutVarchar, .getEnvFunc = getLeastSQRFuncEnv, @@ -1903,10 +1950,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, .translateFunc = translateOutDouble, .dataRequiredFunc = statisDataRequired, @@ -1936,9 +1981,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, .translateFunc = translateOutVarchar, .dataRequiredFunc = statisDataRequired, @@ -1963,9 +2007,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, .translateFunc = translateOutDouble, .getEnvFunc = getAvgFuncEnv, @@ -1991,18 +2034,16 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .inputParaInfo[0][1] = {.isLastParam = true, .startParam = 2, .endParam = 11, .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, - .isPK = false, - .isFixedValue = false, - .hasRange = true, - .range = {.dMinVal = 0.0, .dMaxVal = 100.0}}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_HAS_RANGE, + .range = {.iMinVal = 0, .iMaxVal = 100}}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, .translateFunc = translatePercentile, .dataRequiredFunc = statisDataRequired, @@ -2029,26 +2070,23 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .inputParaInfo[0][1] = {.isLastParam = false, .startParam = 2, .endParam = 2, .validDataType = FUNC_PARAM_SUPPORT_INTEGER_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, - .isPK = false, - .isFixedValue = false, - .hasRange = true, - .range = {.dMinVal = 0.0, .dMaxVal = 100.0}}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_HAS_RANGE, + .range = {.iMinVal = 0, .iMaxVal = 100}}, .inputParaInfo[0][2] = {.isLastParam = true, .startParam = 3, .endParam = 3, .validDataType = FUNC_PARAM_SUPPORT_STRING_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, - .isPK = false, - .isFixedValue = true, - .hasRange = false, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_HAS_FIXED_VALUE, .fixedValueSize = 2, .fixedStrValue = {"default", "t-digest"}}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, @@ -2078,26 +2116,23 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .inputParaInfo[0][1] = {.isLastParam = false, .startParam = 2, .endParam = 2, .validDataType = FUNC_PARAM_SUPPORT_INTEGER_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, - .isPK = false, - .isFixedValue = false, - .hasRange = true, - .range = {.dMinVal = 0.0, .dMaxVal = 100.0}}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_HAS_RANGE, + .range = {.iMinVal = 0, .iMaxVal = 100}}, .inputParaInfo[0][2] = {.isLastParam = true, .startParam = 3, .endParam = 3, .validDataType = FUNC_PARAM_SUPPORT_STRING_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, - .isPK = false, - .isFixedValue = true, - .hasRange = false, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_HAS_FIXED_VALUE, .fixedValueSize = 2, .fixedStrValue = {"default", "t-digest"}}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, @@ -2123,26 +2158,23 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .inputParaInfo[0][1] = {.isLastParam = false, .startParam = 2, .endParam = 2, .validDataType = FUNC_PARAM_SUPPORT_INTEGER_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, - .isPK = false, - .isFixedValue = false, - .hasRange = true, - .range = {.dMinVal = 0.0, .dMaxVal = 100.0}}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_HAS_RANGE, + .range = {.iMinVal = 0, .iMaxVal = 100}}, .inputParaInfo[0][2] = {.isLastParam = true, .startParam = 3, .endParam = 3, .validDataType = FUNC_PARAM_SUPPORT_STRING_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, - .isPK = false, - .isFixedValue = true, - .hasRange = false, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_HAS_FIXED_VALUE, .fixedValueSize = 2, .fixedStrValue = {"default", "t-digest"}}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, @@ -2169,18 +2201,16 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .inputParaInfo[0][1] = {.isLastParam = true, .startParam = 2, .endParam = 2, .validDataType = FUNC_PARAM_SUPPORT_INTEGER_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, - .isPK = false, - .isFixedValue = false, - .hasRange = true, - .range = {.dMinVal = 1.0, .dMaxVal = TOP_BOTTOM_QUERY_LIMIT}}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_HAS_RANGE, + .range = {.iMinVal = 1, .iMaxVal = TOP_BOTTOM_QUERY_LIMIT}}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE}}, .translateFunc = translateOutFirstIn, .getEnvFunc = getTopBotFuncEnv, @@ -2206,18 +2236,16 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .inputParaInfo[0][1] = {.isLastParam = true, .startParam = 2, .endParam = 2, .validDataType = FUNC_PARAM_SUPPORT_INTEGER_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, - .isPK = false, - .isFixedValue = false, - .hasRange = true, - .range = {.dMinVal = 1.0, .dMaxVal = TOP_BOTTOM_QUERY_LIMIT}}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_HAS_RANGE, + .range = {.iMinVal = 1, .iMaxVal = TOP_BOTTOM_QUERY_LIMIT}}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE}}, .translateFunc = translateOutFirstIn, .getEnvFunc = getTopBotFuncEnv, @@ -2242,9 +2270,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_TIMESTAMP_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, .translateFunc = translateOutDouble, .dataRequiredFunc = statisDataRequired, @@ -2273,9 +2300,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_TIMESTAMP_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, .translateFunc = translateOutVarchar, .dataRequiredFunc = statisDataRequired, @@ -2299,9 +2325,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, .classification = FUNC_MGT_AGG_FUNC, .translateFunc = translateOutDouble, @@ -2330,19 +2355,15 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_TIMESTAMP_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_COLUMN_NODE, - .isTs = true, - .isPK = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_MUST_BE_PRIMTS, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .inputParaInfo[0][1] = {.isLastParam = true, .startParam = 2, .endParam = 2, .validDataType = FUNC_PARAM_SUPPORT_INTEGER_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, - .isPK = false, - .isFixedValue = false, - .hasRange = false, - .isTimeUnit = true}, + .paramAttribute = FUNC_PARAM_MUST_BE_TIME_UNIT, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, .dataRequiredFunc = statisDataRequired, .translateFunc = translateOutDouble, @@ -2398,17 +2419,15 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_BOOL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_NOT_VALUE_NODE, - .isPK = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .inputParaInfo[0][1] = {.isLastParam = true, .startParam = 2, .endParam = 2, .validDataType = FUNC_PARAM_SUPPORT_INTEGER_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, - .isPK = false, - .isFixedValue = true, - .hasRange = false, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_HAS_FIXED_VALUE, .fixedValueSize = 2, .fixedNumValue = {0, 1}}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE}}, @@ -2432,26 +2451,23 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .inputParaInfo[0][1] = {.isLastParam = false, .startParam = 2, .endParam = 2, .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, - .isPK = false, - .isFixedValue = false, - .hasRange = true, - .range = {.dMinVal = 1.0, .dMaxVal = DBL_MAX}}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_HAS_RANGE, + .range = {.iMinVal = 1, .iMaxVal = INT64_MAX}}, .inputParaInfo[0][2] = {.isLastParam = true, .startParam = 3, .endParam = 3, .validDataType = FUNC_PARAM_SUPPORT_INTEGER_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, - .isPK = false, - .isFixedValue = true, - .hasRange = false, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_HAS_FIXED_VALUE, .fixedValueSize = 2, .fixedNumValue = {0, 1}}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, @@ -2476,9 +2492,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, .translateFunc = translateAddPrecOutDouble, .getEnvFunc = getIrateFuncEnv, @@ -2502,36 +2517,29 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .inputParaInfo[0][1] = {.isLastParam = false, .startParam = 2, .endParam = 2, .validDataType = FUNC_PARAM_SUPPORT_TINYINT_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .inputParaInfo[0][2] = {.isLastParam = false, .startParam = 3, .endParam = 3, .validDataType = FUNC_PARAM_SUPPORT_TIMESTAMP_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_COLUMN_NODE, - .isPK = false, - .isTs = true, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_MUST_BE_PRIMTS, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .inputParaInfo[0][3] = {.isLastParam = true, .startParam = 4, .endParam = 4, .validDataType = FUNC_PARAM_SUPPORT_INTEGER_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_COLUMN_NODE, - .isPK = true, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_MUST_BE_PK, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, .translateFunc = translateOutVarchar, .getEnvFunc = getIrateFuncEnv, @@ -2552,9 +2560,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, .translateFunc = translateAddPrecOutDouble, .getEnvFunc = getIrateFuncEnv, @@ -2576,10 +2583,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = -1, .validDataType = FUNC_PARAM_SUPPORT_ALL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isFixedValue = false, - .hasRange = false, - .isFirstLast = true}, + .paramAttribute = FUNC_PARAM_VALUE_NODE_NOT_NULL, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_ALL_TYPE}}, .translateFunc = translateOutFirstIn, .dynDataRequiredFunc = lastDynDataReq, @@ -2605,10 +2610,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = -1, .validDataType = FUNC_PARAM_SUPPORT_ALL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isFixedValue = false, - .hasRange = false, - .isFirstLast = true}, + .paramAttribute = FUNC_PARAM_VALUE_NODE_NOT_NULL, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_ALL_TYPE}}, .translateFunc = translateOutFirstIn, .getEnvFunc = getFirstLastFuncEnv, @@ -2628,10 +2631,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = -1, .validDataType = FUNC_PARAM_SUPPORT_ALL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isFixedValue = false, - .hasRange = false, - .isFirstLast = true}, + .paramAttribute = FUNC_PARAM_VALUE_NODE_NOT_NULL, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_ALL_TYPE}}, .translateFunc = translateOutFirstIn, .getEnvFunc = getFirstLastFuncEnv, @@ -2652,10 +2653,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = -1, .validDataType = FUNC_PARAM_SUPPORT_ALL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isFixedValue = false, - .hasRange = false, - .isFirstLast = true}, + .paramAttribute = FUNC_PARAM_VALUE_NODE_NOT_NULL, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, .translateFunc = translateOutVarchar, .dynDataRequiredFunc = lastDynDataReq, @@ -2677,10 +2676,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = -1, .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_VALUE_NODE_NOT_NULL, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_ALL_TYPE}}, .translateFunc = translateOutFirstIn, .getEnvFunc = getFirstLastFuncEnv, @@ -2701,10 +2698,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = -1, .validDataType = FUNC_PARAM_SUPPORT_ALL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isFixedValue = false, - .hasRange = false, - .isFirstLast = true}, + .paramAttribute = FUNC_PARAM_VALUE_NODE_NOT_NULL, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_ALL_TYPE}}, .translateFunc = translateOutFirstIn, .dynDataRequiredFunc = firstDynDataReq, @@ -2731,9 +2726,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = -1, .validDataType = FUNC_PARAM_SUPPORT_ALL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, .translateFunc = translateOutVarchar, .dynDataRequiredFunc = firstDynDataReq, @@ -2756,10 +2750,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = -1, .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_ALL_TYPE}}, .translateFunc = translateOutFirstIn, .getEnvFunc = getFirstLastFuncEnv, @@ -2783,10 +2775,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = -1, .validDataType = FUNC_PARAM_SUPPORT_ALL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isFixedValue = false, - .hasRange = false, - .isFirstLast = true}, + .paramAttribute = FUNC_PARAM_VALUE_NODE_NOT_NULL, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_ALL_TYPE}}, .translateFunc = translateOutFirstIn, .dynDataRequiredFunc = lastDynDataReq, @@ -2813,10 +2803,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = -1, .validDataType = FUNC_PARAM_SUPPORT_ALL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isFixedValue = false, - .hasRange = false, - .isFirstLast = true}, + .paramAttribute = FUNC_PARAM_VALUE_NODE_NOT_NULL, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, .translateFunc = translateOutVarchar, .dynDataRequiredFunc = lastDynDataReq, @@ -2839,10 +2827,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = -1, .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_ALL_TYPE}}, .translateFunc = translateOutFirstIn, .getEnvFunc = getFirstLastFuncEnv, @@ -2866,10 +2852,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, .translateFunc = translateOutDouble, .dataRequiredFunc = statisDataRequired, @@ -2891,42 +2875,35 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .inputParaInfo[0][1] = {.isLastParam = false, .startParam = 2, .endParam = 2, .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = true, - .hasRange = false, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_HAS_FIXED_VALUE, + .fixedValueSize = 3, .fixedStrValue = {"user_input", "linear_bin", "log_bin"}}, .inputParaInfo[0][2] = {.isLastParam = false, .startParam = 3, .endParam = 3, .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .isHistogramBin = true, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .inputParaInfo[0][3] = {.isLastParam = true, .startParam = 4, .endParam = 4, .validDataType = FUNC_PARAM_SUPPORT_INTEGER_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = true, - .hasRange = false, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_HAS_FIXED_VALUE, + .fixedValueSize = 2, .fixedNumValue = {0, 1}}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, - .translateFunc = translateOutVarchar, + .translateFunc = translateHitogram, .getEnvFunc = getHistogramFuncEnv, .initFunc = histogramFunctionSetup, .processFunc = histogramFunction, @@ -2951,41 +2928,35 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .inputParaInfo[0][1] = {.isLastParam = false, .startParam = 2, .endParam = 2, .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = true, - .hasRange = false, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_HAS_FIXED_VALUE, + .fixedValueSize = 3, .fixedStrValue = {"user_input", "linear_bin", "log_bin"}}, .inputParaInfo[0][2] = {.isLastParam = false, .startParam = 3, .endParam = 3, .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .inputParaInfo[0][3] = {.isLastParam = true, .startParam = 4, .endParam = 4, .validDataType = FUNC_PARAM_SUPPORT_INTEGER_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = true, - .hasRange = false, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_HAS_FIXED_VALUE, + .fixedValueSize = 2, .fixedNumValue = {0, 1}}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, - .translateFunc = translateOutVarchar, + .translateFunc = translateHistogramPartial, .getEnvFunc = getHistogramFuncEnv, .initFunc = histogramFunctionSetup, .processFunc = histogramFunctionPartial, @@ -3007,10 +2978,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, .translateFunc = translateOutVarchar, .getEnvFunc = getHistogramFuncEnv, @@ -3034,10 +3003,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_ALL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_BIGINT_TYPE}}, .translateFunc = translateOutBigInt, .getEnvFunc = getHLLFuncEnv, @@ -3063,10 +3030,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_ALL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, .classification = FUNC_MGT_AGG_FUNC, .translateFunc = translateOutVarchar, @@ -3090,10 +3055,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_BIGINT_TYPE}}, .classification = FUNC_MGT_AGG_FUNC, .translateFunc = translateOutBigInt, @@ -3120,19 +3083,15 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_TIMESTAMP_TYPE | FUNC_PARAM_SUPPORT_BOOL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .inputParaInfo[0][1] = {.isLastParam = true, .startParam = 2, .endParam = 2, .validDataType = FUNC_PARAM_SUPPORT_INTEGER_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = true, - .hasRange = false, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_HAS_FIXED_VALUE, .fixedValueSize = 4, .fixedNumValue = {0, 1, 2, 3}}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_BIGINT_TYPE | FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, @@ -3158,19 +3117,15 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .inputParaInfo[0][1] = {.isLastParam = false, .startParam = 2, .endParam = 2, .validDataType = FUNC_PARAM_SUPPORT_STRING_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = true, - .hasRange = false, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_HAS_FIXED_VALUE, .fixedValueSize = 6, .fixedStrValue = {"LT", "GT", "LE", "GE", "NE", "EQ"}}, .inputParaInfo[0][2] = {.isLastParam = true, @@ -3178,10 +3133,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 3, .validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE | FUNC_PARAM_SUPPORT_BIGINT_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_BIGINT_TYPE}}, .translateFunc = translateOutBigInt, .getEnvFunc = getStateFuncEnv, @@ -3203,19 +3156,15 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .inputParaInfo[0][1] = {.isLastParam = false, .startParam = 2, .endParam = 2, .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = true, - .hasRange = false, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_HAS_FIXED_VALUE, .fixedValueSize = 6, .fixedStrValue = {"LT", "GT", "LE", "GE", "NE", "EQ"}}, .inputParaInfo[0][2] = {.isLastParam = false, @@ -3223,20 +3172,15 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 3, .validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE | FUNC_PARAM_SUPPORT_BIGINT_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .inputParaInfo[0][3] = {.isLastParam = true, .startParam = 4, .endParam = 4, .validDataType = FUNC_PARAM_SUPPORT_BIGINT_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false, - .isTimeUnit = true}, + .paramAttribute = FUNC_PARAM_MUST_BE_TIME_UNIT, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_BIGINT_TYPE}}, .translateFunc = translateOutBigInt, .getEnvFunc = getStateFuncEnv, @@ -3258,10 +3202,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_BIGINT_TYPE | FUNC_PARAM_SUPPORT_DOUBLE_TYPE | FUNC_PARAM_SUPPORT_UBIGINT_TYPE}}, .translateFunc = translateCsum, .getEnvFunc = getCsumFuncEnv, @@ -3284,20 +3226,16 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .inputParaInfo[0][1] = {.isLastParam = true, .startParam = 2, .endParam = 2, .validDataType = FUNC_PARAM_SUPPORT_INTEGER_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = true, - .range = {.dMinVal = 1.0, .dMaxVal = 1000.0}}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_HAS_RANGE, + .range = {.iMinVal = 1, .iMaxVal = 1000}}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, .translateFunc = translateOutDouble, .getEnvFunc = getMavgFuncEnv, @@ -3319,20 +3257,16 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_ALL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .inputParaInfo[0][1] = {.isLastParam = true, .startParam = 2, .endParam = 2, .validDataType = FUNC_PARAM_SUPPORT_INTEGER_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = true, - .range = {.dMinVal = 1.0, .dMaxVal = 1000.0}}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_HAS_RANGE, + .range = {.iMinVal = 1, .iMaxVal = 1000}}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_ALL_TYPE}}, .translateFunc = translateSampleTail, .getEnvFunc = getSampleFuncEnv, @@ -3353,30 +3287,24 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_ALL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .inputParaInfo[0][1] = {.isLastParam = false, .startParam = 2, .endParam = 2, .validDataType = FUNC_PARAM_SUPPORT_INTEGER_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = true, - .range = {.dMinVal = 1.0, .dMaxVal = 100.0}}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_HAS_RANGE, + .range = {.iMinVal = 1, .iMaxVal = 100}}, .inputParaInfo[0][2] = {.isLastParam = true, .startParam = 3, .endParam = 3, .validDataType = FUNC_PARAM_SUPPORT_INTEGER_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = true, - .range = {.dMinVal = 0.0, .dMaxVal = 100.0}}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_HAS_RANGE, + .range = {.iMinVal = 0, .iMaxVal = 100}}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_ALL_TYPE}}, .translateFunc = translateSampleTail, .getEnvFunc = getTailFuncEnv, @@ -3397,11 +3325,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_ALL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false, - .hasColumn = true}, + .paramAttribute = FUNC_PARAM_MUST_HAVE_COLUMN, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_ALL_TYPE}}, .translateFunc = translateOutFirstIn, .getEnvFunc = getUniqueFuncEnv, @@ -3422,11 +3347,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_ALL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false, - .hasColumn = true}, + .paramAttribute = FUNC_PARAM_MUST_HAVE_COLUMN, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_ALL_TYPE}}, .translateFunc = translateOutFirstIn, .getEnvFunc = getModeFuncEnv, @@ -3448,10 +3370,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE}}, .translateFunc = translateOutNum, .getEnvFunc = NULL, @@ -3471,19 +3391,15 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .inputParaInfo[0][1] = {.isLastParam = true, .startParam = 2, .endParam = 2, .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, .translateFunc = translateOutDouble, .getEnvFunc = NULL, @@ -3503,19 +3419,15 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .inputParaInfo[0][1] = {.isLastParam = true, .startParam = 2, .endParam = 2, .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, .translateFunc = translateOutDouble, .getEnvFunc = NULL, @@ -3535,10 +3447,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, .translateFunc = translateOutDouble, .getEnvFunc = NULL, @@ -3558,10 +3468,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE}}, .translateFunc = translateOutNum, .getEnvFunc = NULL, @@ -3581,10 +3489,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE}}, .translateFunc = translateOutNum, .getEnvFunc = NULL, @@ -3604,19 +3510,15 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .inputParaInfo[0][1] = {.isLastParam = true, .startParam = 2, .endParam = 2, .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, .translateFunc = translateOutNum, .getEnvFunc = NULL, @@ -3636,10 +3538,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, .translateFunc = translateOutDouble, .getEnvFunc = NULL, @@ -3659,10 +3559,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, .translateFunc = translateOutDouble, .getEnvFunc = NULL, @@ -3682,10 +3580,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, .translateFunc = translateOutDouble, .getEnvFunc = NULL, @@ -3705,10 +3601,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, .translateFunc = translateOutDouble, .getEnvFunc = NULL, @@ -3728,10 +3622,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, .translateFunc = translateOutDouble, .getEnvFunc = NULL, @@ -3751,10 +3643,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, .translateFunc = translateOutDouble, .getEnvFunc = NULL, @@ -3774,10 +3664,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_STRING_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_BIGINT_TYPE}}, .translateFunc = translateOutBigInt, .getEnvFunc = NULL, @@ -3797,10 +3685,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_BIGINT_TYPE}}, .translateFunc = translateOutBigInt, .getEnvFunc = NULL, @@ -3820,10 +3706,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 8, .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE}}, .translateFunc = translateConcat, .getEnvFunc = NULL, @@ -3843,19 +3727,15 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .inputParaInfo[0][1] = {.isLastParam = true, .startParam = 2, .endParam = 9, .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE}}, .translateFunc = translateConcatWs, .getEnvFunc = NULL, @@ -3875,10 +3755,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE}}, .translateFunc = translateOutFirstIn, .getEnvFunc = NULL, @@ -3898,10 +3776,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE}}, .translateFunc = translateOutFirstIn, .getEnvFunc = NULL, @@ -3921,10 +3797,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE}}, .translateFunc = translateLtrim, .getEnvFunc = NULL, @@ -3944,10 +3818,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE}}, .translateFunc = translateRtrim, .getEnvFunc = NULL, @@ -3967,19 +3839,15 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .inputParaInfo[0][1] = {.isLastParam = true, .startParam = 2, .endParam = 3, .validDataType = FUNC_PARAM_SUPPORT_INTEGER_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE}}, .translateFunc = translateOutFirstIn, .getEnvFunc = NULL, @@ -3999,10 +3867,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_BOOL_TYPE | FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE | FUNC_PARAM_SUPPORT_GEOMETRY_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE | FUNC_PARAM_SUPPORT_TIMESTAMP_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_ALL_TYPE}}, .translateFunc = translateCast, .getEnvFunc = NULL, @@ -4022,19 +3888,15 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_INTEGER_TYPE | FUNC_PARAM_SUPPORT_TIMESTAMP_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .inputParaInfo[0][1] = {.isLastParam = true, .startParam = 2, .endParam = 2, .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, .translateFunc = translateToIso8601, .getEnvFunc = NULL, @@ -4054,19 +3916,15 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .inputParaInfo[0][1] = {.isLastParam = true, .startParam = 2, .endParam = 2, .validDataType = FUNC_PARAM_SUPPORT_INTEGER_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = true, - .hasRange = false, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_HAS_FIXED_VALUE, .fixedValueSize = 2, .fixedNumValue = {0, 1}}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_BIGINT_TYPE | FUNC_PARAM_SUPPORT_TIMESTAMP_TYPE}}, @@ -4088,29 +3946,22 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE | FUNC_PARAM_SUPPORT_TIMESTAMP_TYPE | FUNC_PARAM_SUPPORT_INTEGER_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .inputParaInfo[0][1] = {.isLastParam = false, .startParam = 2, .endParam = 2, .validDataType = FUNC_PARAM_SUPPORT_INTEGER_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false, - .isTimeUnit = true}, + .paramAttribute = FUNC_PARAM_MUST_BE_TIME_UNIT, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .inputParaInfo[0][2] = {.isLastParam = true, .startParam = 3, .endParam = 3, .validDataType = FUNC_PARAM_SUPPORT_INTEGER_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = true, - .hasRange = false, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_HAS_FIXED_VALUE, .fixedValueSize = 2, .fixedNumValue = {0, 1}}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_TIMESTAMP_TYPE}}, @@ -4132,21 +3983,16 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 2, .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE | FUNC_PARAM_SUPPORT_TIMESTAMP_TYPE | FUNC_PARAM_SUPPORT_INTEGER_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .inputParaInfo[0][1] = {.isLastParam = true, .startParam = 3, .endParam = 3, .validDataType = FUNC_PARAM_SUPPORT_INTEGER_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false, - .isTimeUnit = true}, - .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_TIMESTAMP_TYPE}}, + .paramAttribute = FUNC_PARAM_MUST_BE_TIME_UNIT, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, + .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_BIGINT_TYPE}}, .translateFunc = translateAddPrecOutBigint, .getEnvFunc = NULL, .initFunc = NULL, @@ -4305,10 +4151,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_VALUE_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_JSON_TYPE}}, .translateFunc = translateToJson, .getEnvFunc = NULL, @@ -4489,10 +4333,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_STRING_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_GEOMETRY_TYPE}}, .translateFunc = translateOutGeom, .getEnvFunc = NULL, @@ -4512,10 +4354,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_GEOMETRY_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_STRING_TYPE}}, .translateFunc = translateInGeomOutStr, .getEnvFunc = NULL, @@ -4535,10 +4375,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 2, .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_GEOMETRY_TYPE}}, .translateFunc = translateOutGeom, .getEnvFunc = NULL, @@ -4558,10 +4396,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 2, .validDataType = FUNC_PARAM_SUPPORT_GEOMETRY_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_BOOL_TYPE}}, .translateFunc = translateIn2GeomOutBool, .getEnvFunc = NULL, @@ -4581,10 +4417,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 2, .validDataType = FUNC_PARAM_SUPPORT_GEOMETRY_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_BOOL_TYPE}}, .translateFunc = translateIn2GeomOutBool, .getEnvFunc = NULL, @@ -4604,10 +4438,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 2, .validDataType = FUNC_PARAM_SUPPORT_GEOMETRY_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_BOOL_TYPE}}, .translateFunc = translateIn2GeomOutBool, .getEnvFunc = NULL, @@ -4627,10 +4459,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 2, .validDataType = FUNC_PARAM_SUPPORT_GEOMETRY_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_BOOL_TYPE}}, .translateFunc = translateIn2GeomOutBool, .getEnvFunc = NULL, @@ -4650,10 +4480,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 2, .validDataType = FUNC_PARAM_SUPPORT_GEOMETRY_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_BOOL_TYPE}}, .translateFunc = translateIn2GeomOutBool, .getEnvFunc = NULL, @@ -4673,10 +4501,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 2, .validDataType = FUNC_PARAM_SUPPORT_GEOMETRY_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_BOOL_TYPE}}, .translateFunc = translateIn2GeomOutBool, .getEnvFunc = NULL, @@ -4724,10 +4550,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 2, .validDataType = FUNC_PARAM_SUPPORT_STRING_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_TIMESTAMP_TYPE}}, .translateFunc = translateToTimestamp, .getEnvFunc = NULL, @@ -4747,19 +4571,15 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_TIMESTAMP_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .inputParaInfo[0][1] = {.isLastParam = true, .startParam = 2, .endParam = 2, .validDataType = FUNC_PARAM_SUPPORT_STRING_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, .translateFunc = translateOutVarchar, .getEnvFunc = NULL, @@ -4779,10 +4599,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, .translateFunc = translateOutVarchar, .dataRequiredFunc = statisDataRequired, @@ -4821,10 +4639,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, .translateFunc = translateOutVarchar, .getEnvFunc = getStdFuncEnv, @@ -4846,10 +4662,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, .translateFunc = translateOutVarchar, .getEnvFunc = getStdFuncEnv, @@ -4869,10 +4683,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, .translateFunc = translateOutVarchar, .getEnvFunc = getAvgFuncEnv, @@ -4894,10 +4706,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, .translateFunc = translateOutVarchar, .getEnvFunc = getAvgFuncEnv, @@ -4917,10 +4727,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_TIMESTAMP_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, .translateFunc = translateOutVarchar, .getEnvFunc = getSpreadFuncEnv, @@ -4942,10 +4750,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, .translateFunc = translateOutVarchar, .getEnvFunc = getSpreadFuncEnv, @@ -4966,11 +4772,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = -1, .validDataType = FUNC_PARAM_SUPPORT_ALL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false, - .isFirstLast = true}, + .paramAttribute = FUNC_PARAM_VALUE_NODE_NOT_NULL, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, .translateFunc = translateOutVarchar, .getEnvFunc = getFirstLastFuncEnv, @@ -4993,10 +4796,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, .translateFunc = translateOutVarchar, .getEnvFunc = getFirstLastFuncEnv, @@ -5017,11 +4818,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = -1, .validDataType = FUNC_PARAM_SUPPORT_ALL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false, - .isFirstLast = true}, + .paramAttribute = FUNC_PARAM_VALUE_NODE_NOT_NULL, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, .translateFunc = translateOutVarchar, .getEnvFunc = getFirstLastFuncEnv, @@ -5044,10 +4842,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, .translateFunc = translateOutVarchar, .getEnvFunc = getFirstLastFuncEnv, @@ -5067,10 +4863,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_ALL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, .translateFunc = translateOutVarchar, .getEnvFunc = getHLLFuncEnv, @@ -5092,10 +4886,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, .translateFunc = translateOutVarchar, .getEnvFunc = getHLLFuncEnv, @@ -5115,10 +4907,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, .translateFunc = translateOutVarchar, .getEnvFunc = NULL, @@ -5152,10 +4942,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, .translateFunc = translateOutDouble, .getEnvFunc = getStdFuncEnv, @@ -5183,10 +4971,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, .translateFunc = translateOutDouble, .getEnvFunc = getStdFuncEnv, @@ -5214,9 +5000,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, .translateFunc = translateOutDouble, .getEnvFunc = getStdFuncEnv, @@ -5256,10 +5041,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, .translateFunc = translateOutDouble, .getEnvFunc = NULL, @@ -5279,10 +5062,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, .translateFunc = translateOutDouble, .getEnvFunc = NULL, @@ -5302,19 +5083,15 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .inputParaInfo[0][1] = {.isLastParam = true, .startParam = 2, .endParam = 2, .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, .translateFunc = translateOutDouble, .getEnvFunc = NULL, @@ -5334,10 +5111,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE}}, .translateFunc = translateOutNum, .getEnvFunc = NULL, @@ -5357,10 +5132,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, .translateFunc = translateOutDouble, .getEnvFunc = NULL, @@ -5380,10 +5153,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, .translateFunc = translateOutDouble, .getEnvFunc = NULL, @@ -5403,19 +5174,15 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .inputParaInfo[0][1] = {.isLastParam = true, .startParam = 2, .endParam = 2, .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, .translateFunc = translateOutFirstIn, .getEnvFunc = NULL, @@ -5435,19 +5202,15 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .inputParaInfo[0][1] = {.isLastParam = true, .startParam = 2, .endParam = 2, .validDataType = FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, .translateFunc = translateOutFirstIn, .getEnvFunc = NULL, @@ -5467,28 +5230,22 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .inputParaInfo[0][1] = {.isLastParam = false, .startParam = 2, .endParam = 2, .validDataType = FUNC_PARAM_SUPPORT_INTEGER_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .inputParaInfo[0][2] = {.isLastParam = true, .startParam = 3, .endParam = 3, .validDataType = FUNC_PARAM_SUPPORT_INTEGER_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE}}, .translateFunc = translateOutFirstIn, .getEnvFunc = NULL, @@ -5508,28 +5265,22 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .inputParaInfo[0][1] = {.isLastParam = false, .startParam = 2, .endParam = 2, .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .inputParaInfo[0][2] = {.isLastParam = true, .startParam = 3, .endParam = 3, .validDataType = FUNC_PARAM_SUPPORT_INTEGER_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE}}, .translateFunc = translateOutFirstIn, .getEnvFunc = NULL, @@ -5549,10 +5300,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = -1, .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE | FUNC_PARAM_SUPPORT_NUMERIC_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE}}, .translateFunc = translateChar, .getEnvFunc = NULL, @@ -5572,10 +5321,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_BIGINT_TYPE}}, .translateFunc = translateAscii, .getEnvFunc = NULL, @@ -5595,10 +5342,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 2, .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_BIGINT_TYPE}}, .translateFunc = translateOutBigInt, .getEnvFunc = NULL, @@ -5618,10 +5363,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 2, .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE}}, .translateFunc = translateTrim, .getEnvFunc = NULL, @@ -5641,10 +5384,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 3, .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE}}, .translateFunc = translateReplace, .getEnvFunc = NULL, @@ -5664,19 +5405,15 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .inputParaInfo[0][1] = {.isLastParam = true, .startParam = 2, .endParam = 2, .validDataType = FUNC_PARAM_SUPPORT_INTEGER_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_VARCHAR_TYPE | FUNC_PARAM_SUPPORT_NCHAR_TYPE}}, .translateFunc = translateRepeat, .getEnvFunc = NULL, @@ -5696,10 +5433,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_UNIX_TS_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_BIGINT_TYPE}}, .translateFunc = translateAddPrecOutBigint, .getEnvFunc = NULL, @@ -5719,10 +5454,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_UNIX_TS_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_BIGINT_TYPE}}, .translateFunc = translateAddPrecOutBigint, .getEnvFunc = NULL, @@ -5742,19 +5475,15 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_UNIX_TS_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .inputParaInfo[0][1] = {.isLastParam = true, .startParam = 2, .endParam = 2, .validDataType = FUNC_PARAM_SUPPORT_INTEGER_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = true, - .hasRange = false, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_HAS_FIXED_VALUE, .fixedValueSize = 8, .fixedNumValue = {0, 1, 2, 3, 4, 5, 6, 7}}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_BIGINT_TYPE}}, @@ -5776,10 +5505,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_UNIX_TS_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_BIGINT_TYPE}}, .translateFunc = translateAddPrecOutBigint, .getEnvFunc = NULL, @@ -5799,10 +5526,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .endParam = 1, .validDataType = FUNC_PARAM_SUPPORT_INTEGER_TYPE | FUNC_PARAM_SUPPORT_NULL_TYPE, .validNodeType = FUNC_PARAM_SUPPORT_EXPR_NODE, - .isPK = false, - .isTs = false, - .isFixedValue = false, - .hasRange = false}, + .paramAttribute = FUNC_PARAM_NO_SPECIFIC_ATTRIBUTE, + .valueRangeFlag = FUNC_PARAM_NO_SPECIFIC_VALUE,}, .outputParaInfo = {.validDataType = FUNC_PARAM_SUPPORT_DOUBLE_TYPE}}, .translateFunc = translateRand, .getEnvFunc = NULL, From cfd0497465637a3fb2cded3774cdc4e879bf90b1 Mon Sep 17 00:00:00 2001 From: qevolg <2227465945@qq.com> Date: Thu, 24 Oct 2024 16:42:57 +0800 Subject: [PATCH 247/695] test(keeper/api): trigger taoskeeper ci --- tools/keeper/api/adapter2_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/keeper/api/adapter2_test.go b/tools/keeper/api/adapter2_test.go index e6fd263c43fa..5456dfeecf1a 100644 --- a/tools/keeper/api/adapter2_test.go +++ b/tools/keeper/api/adapter2_test.go @@ -14,6 +14,7 @@ import ( ) func TestAdapter2(t *testing.T) { + // c := &config.Config{ InstanceID: 64, Port: 6043, From 1cd254ea96c67fc956ec496b62b7fde0f77fc327 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Thu, 24 Oct 2024 17:04:35 +0800 Subject: [PATCH 248/695] doc: minor changes --- docs/zh/14-reference/03-taos-sql/12-distinguished.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/zh/14-reference/03-taos-sql/12-distinguished.md b/docs/zh/14-reference/03-taos-sql/12-distinguished.md index 0b834dea298e..d7696b18598c 100644 --- a/docs/zh/14-reference/03-taos-sql/12-distinguished.md +++ b/docs/zh/14-reference/03-taos-sql/12-distinguished.md @@ -76,7 +76,7 @@ window_clause: { FILL 语句指定某一窗口区间数据缺失的情况下的填充模式。填充模式包括以下几种: 1. 不进行填充:NONE(默认填充模式)。 -2. VALUE 填充:固定值填充,此时需要指定填充的数值。例如:FILL(VALUE, 1.23)。这里需要注意,最终填充的值受由相应列的类型决定,如 FILL(VALUE, 1.23),相应列为 INT 类型,则填充值为 1, 若查询列表中有多列需要FILL, 则需要给每一个FILL列指定VALUE, 如`SELECT _wstart, min(c1), max(c1) FROM ... FILL(VALUE, 0, 0)`, 注意, SELECT表达式中只有包含普通列时才需要指定FILL VALUE, 如`_wstart`, `_wstart+1a`, `now`, `1+1` 以及使用partition by时的partition key(如tbname)都不需要指定VALUE, 如`timediff(last(ts), _wstart)`则需要指定VALUE。 +2. VALUE 填充:固定值填充,此时需要指定填充的数值。例如:FILL(VALUE, 1.23)。这里需要注意,最终填充的值受由相应列的类型决定,如 FILL(VALUE, 1.23),相应列为 INT 类型,则填充值为 1, 若查询列表中有多列需要 FILL, 则需要给每一个 FILL 列指定 VALUE, 如 `SELECT _wstart, min(c1), max(c1) FROM ... FILL(VALUE, 0, 0)`, 注意, SELECT 表达式中只有包含普通列时才需要指定 FILL VALUE, 如 `_wstart`, `_wstart+1a`, `now`, `1+1` 以及使用 partition by 时的 partition key (如 tbname)都不需要指定 VALUE, 如 `timediff(last(ts), _wstart)` 则需要指定VALUE。 3. PREV 填充:使用前一个非 NULL 值填充数据。例如:FILL(PREV)。 4. NULL 填充:使用 NULL 填充数据。例如:FILL(NULL)。 5. LINEAR 填充:根据前后距离最近的非 NULL 值做线性插值填充。例如:FILL(LINEAR)。 From 736149daeae74f38510ec4ab2e84026ac3e24316 Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Thu, 24 Oct 2024 17:41:37 +0800 Subject: [PATCH 249/695] feat: from 3.3.1.0~ 3.3.3.0 new key add --- tools/shell/src/shellAuto.c | 157 ++++++++++++++++++++++++++++-------- 1 file changed, 122 insertions(+), 35 deletions(-) diff --git a/tools/shell/src/shellAuto.c b/tools/shell/src/shellAuto.c index 65ae9fad54fb..9e6b0fe79e32 100644 --- a/tools/shell/src/shellAuto.c +++ b/tools/shell/src/shellAuto.c @@ -99,6 +99,8 @@ SWords shellCommands[] = { {"create qnode on dnode ;", 0, 0, NULL}, {"create stream into as select", 0, 0, NULL}, // 26 append sub sql {"create topic as select", 0, 0, NULL}, // 27 append sub sql + {"create tsma on function", 0, 0, NULL}, + {"create recursive tsma on interval(", 0, 0, NULL}, {"create function as outputtype language ", 0, 0, NULL}, {"create or replace as outputtype language ", 0, 0, NULL}, {"create aggregate function as outputtype bufsize language ", 0, 0, NULL}, @@ -123,6 +125,7 @@ SWords shellCommands[] = { {"drop consumer group on ", 0, 0, NULL}, {"drop topic ;", 0, 0, NULL}, {"drop stream ;", 0, 0, NULL}, + {"drop tsma ;", 0, 0, NULL}, {"explain select", 0, 0, NULL}, // 44 append sub sql {"flush database ;", 0, 0, NULL}, {"help;", 0, 0, NULL}, @@ -163,12 +166,14 @@ SWords shellCommands[] = { {"show create database \\G;", 0, 0, NULL}, {"show create stable \\G;", 0, 0, NULL}, {"show create table \\G;", 0, 0, NULL}, + {"show create tsma \\G;", 0, 0, NULL}, #ifdef TD_ENTERPRISE {"show create view \\G;", 0, 0, NULL}, -#endif - {"show connections;", 0, 0, NULL}, {"show compact", 0, 0, NULL}, {"show compacts;", 0, 0, NULL}, + +#endif + {"show connections;", 0, 0, NULL}, {"show cluster;", 0, 0, NULL}, {"show cluster alive;", 0, 0, NULL}, {"show cluster machines;", 0, 0, NULL}, @@ -196,10 +201,12 @@ SWords shellCommands[] = { {"show table tags from ", 0, 0, NULL}, {"show topics;", 0, 0, NULL}, {"show transactions;", 0, 0, NULL}, + {"show tsmas;", 0, 0, NULL}, {"show users;", 0, 0, NULL}, {"show variables;", 0, 0, NULL}, {"show local variables;", 0, 0, NULL}, - {"show vnodes ", 0, 0, NULL}, + {"show vnodes;", 0, 0, NULL}, + {"show vnodes on dnode ;", 0, 0, NULL}, {"show vgroups;", 0, 0, NULL}, {"show consumers;", 0, 0, NULL}, {"show grants;", 0, 0, NULL}, @@ -207,22 +214,26 @@ SWords shellCommands[] = { {"show grants logs;", 0, 0, NULL}, #ifdef TD_ENTERPRISE {"show views;", 0, 0, NULL}, + {"show arbgroups;", 0, 0, NULL}, {"split vgroup ", 0, 0, NULL}, + {"s3migrate database ", 0, 0, NULL}, #endif {"insert into values(", 0, 0, NULL}, {"insert into using tags(", 0, 0, NULL}, {"insert into using values(", 0, 0, NULL}, {"insert into file ", 0, 0, NULL}, {"trim database ", 0, 0, NULL}, - {"s3migrate database ", 0, 0, NULL}, {"use ", 0, 0, NULL}, {"quit", 0, 0, NULL}}; +// where keyword char* keywords[] = { "and ", "asc ", "desc ", "from ", "fill(", "limit ", "where ", "interval(", "order by ", "order by ", "offset ", "or ", "group by ", "now()", "session(", "sliding ", "slimit ", "soffset ", "state_window(", "today() ", "union all select ", - "partition by "}; + "partition by ", "match", "nmatch ", "between ", "like ", "is null ", "is not null ", + "state_window(", "event_window ", "count_window(" +}; char* functions[] = { "count(", "sum(", @@ -255,6 +266,20 @@ char* functions[] = { "timezone(", "timetruncate(", "twa(", "to_unixtimestamp(", "unique(", "upper(", + "pi(", "round(", + "truncate(", "exp(", + "ln(", "mod(", + "rand(", "sign(", + "degrees(", "radians(", + "greatest(", "least(", + "char_length(", "char(", + "ascii(", "position(", + "trim(", "replace(", + "repeat(", "substring(", + "substring_index(","timediff(", + "week(", "weekday(", + "weekofyear(", "dayofweek(", + "stddev_pop(", "var_pop(" }; char* tb_actions[] = { @@ -275,7 +300,7 @@ char* db_options[] = {"keep ", "cachesize ", "comp ", "duration ", - "wal_fsync_period", + "wal_fsync_period ", "maxrows ", "minrows ", "pages ", @@ -284,17 +309,22 @@ char* db_options[] = {"keep ", "wal_level ", "vgroups ", "single_stable ", - "s3_chunksize ", - "s3_keeplocal ", - "s3_compact ", + "s3_chunksize ", + "s3_keeplocal ", + "s3_compact ", "wal_retention_period ", "wal_roll_period ", "wal_retention_size ", - "wal_segment_size "}; +#ifdef TD_ENTERPRISE + "encrypt_algorithm " +#endif + "keep_time_offset ", + "wal_segment_size " +}; char* alter_db_options[] = {"cachemodel ", "replica ", "keep ", "stt_trigger ", "wal_retention_period ", "wal_retention_size ", "cachesize ", - "s3_keeplocal ", "s3_compact ", + "s3_keeplocal ", "s3_compact ", "wal_fsync_period ", "buffer ", "pages " ,"wal_level "}; char* data_types[] = {"timestamp", "int", @@ -304,6 +334,7 @@ char* data_types[] = {"timestamp", "int", "bigint", "bigint unsigned", "smallint", "smallint unsigned", "tinyint", "tinyint unsigned", + "geometry", "varbinary(16)", "bool", "json"}; char* key_tags[] = {"tags("}; @@ -319,6 +350,15 @@ char* key_systable[] = { char* udf_language[] = {"\'Python\'", "\'C\'"}; +char* field_options[] = { + "encode ", "compress ", "level ", + "lz4 ", "zlib ", "zstd ", "xz ", "tsz ", "disabled ", // compress + "simple8b ", "delta-i ", "delta-d ", "bit-packing ", + "high ", "medium ", "low ", + "comment ", + "primary key " +}; + // global keys can tips on anywhere char* global_keys[] = { "tbname", @@ -354,27 +394,29 @@ bool waitAutoFill = false; #define WT_VAR_STREAM 6 #define WT_VAR_UDFNAME 7 #define WT_VAR_VGROUPID 8 +#define WT_VAR_TSMA 9 -#define WT_FROM_DB_MAX 8 // max get content from db +#define WT_FROM_DB_MAX 9 // max get content from db #define WT_FROM_DB_CNT (WT_FROM_DB_MAX + 1) -#define WT_VAR_ALLTABLE 9 -#define WT_VAR_FUNC 10 -#define WT_VAR_KEYWORD 11 -#define WT_VAR_TBACTION 12 -#define WT_VAR_DBOPTION 13 -#define WT_VAR_ALTER_DBOPTION 14 -#define WT_VAR_DATATYPE 15 -#define WT_VAR_KEYTAGS 16 -#define WT_VAR_ANYWORD 17 -#define WT_VAR_TBOPTION 18 -#define WT_VAR_USERACTION 19 -#define WT_VAR_KEYSELECT 20 -#define WT_VAR_SYSTABLE 21 -#define WT_VAR_LANGUAGE 22 -#define WT_VAR_GLOBALKEYS 23 - -#define WT_VAR_CNT 24 +#define WT_VAR_ALLTABLE 10 +#define WT_VAR_FUNC 11 +#define WT_VAR_KEYWORD 12 +#define WT_VAR_TBACTION 13 +#define WT_VAR_DBOPTION 14 +#define WT_VAR_ALTER_DBOPTION 15 +#define WT_VAR_DATATYPE 16 +#define WT_VAR_KEYTAGS 17 +#define WT_VAR_ANYWORD 18 +#define WT_VAR_TBOPTION 19 +#define WT_VAR_USERACTION 20 +#define WT_VAR_KEYSELECT 21 +#define WT_VAR_SYSTABLE 22 +#define WT_VAR_LANGUAGE 23 +#define WT_VAR_GLOBALKEYS 24 +#define WT_VAR_FIELD_OPTIONS 25 + +#define WT_VAR_CNT 26 #define WT_TEXT 0xFF @@ -387,12 +429,17 @@ TdThreadMutex tiresMutex; TdThread* threads[WT_FROM_DB_CNT]; // obtain var name with sql from server char varTypes[WT_VAR_CNT][64] = { + // get from db "", "", "", "", "", "", "", - "", "", "", "", "", "", "", "", - "", "", "", "", "", "", "", ""}; + "", "", "", + // get from code + "", "", "", "", "", "", + "", "", "", "", "", "", "", + "", "", ""}; char varSqls[WT_FROM_DB_CNT][64] = {"show databases;", "show stables;", "show tables;", "show dnodes;", - "show users;", "show topics;", "show streams;", "show functions;", "show vgroups;"}; + "show users;", "show topics;", "show streams;", "show functions;", + "show vgroups;", "show tsmas;"}; // var words current cursor, if user press any one key except tab, cursorVar can be reset to -1 int cursorVar = -1; @@ -567,7 +614,8 @@ void showHelp() { show users;\n\ show variables;\n\ show local variables;\n\ - show vnodes \n\ + show vnodes;\n\ + show vnodes on dnode ;\n\ show vgroups;\n\ show consumers;\n\ show grants;\n\ @@ -588,8 +636,10 @@ void showHelp() { create view as select ...\n\ redistribute vgroup dnode ;\n\ split vgroup ;\n\ + s3migrate database ;\n\ show compacts;\n\ show compact \n\ + show arbgroups;\n\ show views;\n\ show create view ;"); #endif @@ -756,6 +806,7 @@ bool shellAutoInit() { GenerateVarType(WT_VAR_SYSTABLE, key_systable, sizeof(key_systable) / sizeof(char*)); GenerateVarType(WT_VAR_LANGUAGE, udf_language, sizeof(udf_language) / sizeof(char*)); GenerateVarType(WT_VAR_GLOBALKEYS, global_keys, sizeof(global_keys) / sizeof(char*)); + GenerateVarType(WT_VAR_FIELD_OPTIONS, field_options, sizeof(field_options) / sizeof(char*)); return true; } @@ -1648,6 +1699,36 @@ bool matchSelectQuery(TAOS* con, SShellCmd* cmd) { return appendAfterSelect(con, cmd, p, len); } +// is fields option area +bool fieldOptionsArea(char* p) { + char* p1 = strrchr(p, '('); + char* p2 = strrchr(p, ','); + if (p1 == NULL && p2 == NULL) { + return false; + } + + if(p2 == NULL) { + // first field area + p2 = p1; + } + + // find blank count + int32_t cnt = 0; + while(p2) { + p2 = strchr(p2, ' '); + if(p2) { + cnt ++; + while (p2[1] != 0 && p2[1] == ' ') { + // move next if blank again + p2 += 1; + } + } + } + + // like create table st(ts timestamp TAB-KEY or st(ts timestamp , age int TAB-KEY + return cnt >= 2; +} + // if is input create fields or tags area, return true bool isCreateFieldsArea(char* p) { // put to while, support like create table st(ts timestamp, bin1 binary(16), bin2 + blank + TAB @@ -1717,8 +1798,14 @@ bool matchCreateTable(TAOS* con, SShellCmd* cmd) { char* last = lastWord(ps); // check in create fields or tags input area - if (isCreateFieldsArea(ps)) { - ret = fillWithType(con, cmd, last, WT_VAR_DATATYPE); + if (isCreateFieldsArea(ps)) { + if (fieldOptionsArea(ps)) { + // fill field options + ret = fillWithType(con, cmd, last, WT_VAR_FIELD_OPTIONS); + } else { + // fill field + ret = fillWithType(con, cmd, last, WT_VAR_DATATYPE); + } } // tags From 5d20fde69209fda9e89ec1b7019cbaf4d7727559 Mon Sep 17 00:00:00 2001 From: xsren <285808407@qq.com> Date: Thu, 24 Oct 2024 17:44:13 +0800 Subject: [PATCH 250/695] safetycheck, use reserve state --- include/common/tmsg.h | 1 + source/common/src/tdatablock.c | 10 +++++----- source/libs/executor/src/executil.c | 1 + 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/include/common/tmsg.h b/include/common/tmsg.h index 01808d4f2f8b..14e3f9b0ebb7 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -1215,6 +1215,7 @@ typedef struct { int32_t bytes; int8_t type; uint8_t pk; + bool reserve; } SColumnInfo; typedef struct STimeWindow { diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c index b8e9579c6bbf..9240e18700be 100644 --- a/source/common/src/tdatablock.c +++ b/source/common/src/tdatablock.c @@ -3543,7 +3543,7 @@ int32_t blockDataCheck(const SSDataBlock* pDataBlock) { SColumnInfoData* pCol = (SColumnInfoData*)taosArrayGet(pDataBlock->pDataBlock, i); isVarType = IS_VAR_DATA_TYPE(pCol->info.type); checkRows = pDataBlock->info.rows; - if(pCol->pData == NULL) continue; + if (pCol->info.reserve == true) continue; if (isVarType) { BLOCK_DATA_CHECK_TRESSA(pCol->varmeta.offset); @@ -3555,12 +3555,12 @@ int32_t blockDataCheck(const SSDataBlock* pDataBlock) { for (int64_t r = 0; r < checkRows; ++r) { if (tsSafetyCheckLevel <= TSDB_SAFETY_CHECK_LEVELL_NORMAL) break; if (!colDataIsNull_s(pCol, r)) { - // BLOCK_DATA_CHECK_TRESSA(pCol->pData); + BLOCK_DATA_CHECK_TRESSA(pCol->pData); BLOCK_DATA_CHECK_TRESSA(pCol->varmeta.length <= pCol->varmeta.allocLen); - + if (isVarType) { BLOCK_DATA_CHECK_TRESSA(pCol->varmeta.allocLen > 0); - BLOCK_DATA_CHECK_TRESSA(pCol->varmeta.offset[r] < pCol->varmeta.length); + BLOCK_DATA_CHECK_TRESSA(pCol->varmeta.offset[r] <= pCol->varmeta.length); if (pCol->reassigned) { BLOCK_DATA_CHECK_TRESSA(pCol->varmeta.offset[r] >= 0); } else if (0 == r) { @@ -3571,7 +3571,7 @@ int32_t blockDataCheck(const SSDataBlock* pDataBlock) { colLen = varDataTLen(pCol->pData + pCol->varmeta.offset[r]); BLOCK_DATA_CHECK_TRESSA(colLen >= VARSTR_HEADER_SIZE); - BLOCK_DATA_CHECK_TRESSA(colLen <= pCol->varmeta.length); + BLOCK_DATA_CHECK_TRESSA(colLen <= pCol->info.bytes); if (pCol->reassigned) { BLOCK_DATA_CHECK_TRESSA((pCol->varmeta.offset[r] + colLen) <= pCol->varmeta.length); diff --git a/source/libs/executor/src/executil.c b/source/libs/executor/src/executil.c index b15cc2ab4527..1a43d423488c 100644 --- a/source/libs/executor/src/executil.c +++ b/source/libs/executor/src/executil.c @@ -390,6 +390,7 @@ SSDataBlock* createDataBlockFromDescNode(SDataBlockDescNode* pNode) { createColumnInfoData(pDescNode->dataType.type, pDescNode->dataType.bytes, pDescNode->slotId); idata.info.scale = pDescNode->dataType.scale; idata.info.precision = pDescNode->dataType.precision; + idata.info.reserve = pDescNode->reserve; code = blockDataAppendColInfo(pBlock, &idata); if (code != TSDB_CODE_SUCCESS) { From 9a9038faa06933f6f9db2db93a66af877df68414 Mon Sep 17 00:00:00 2001 From: qevolg <2227465945@qq.com> Date: Thu, 24 Oct 2024 18:03:04 +0800 Subject: [PATCH 251/695] chore(.github): modify taoskeeper github action workflow --- .github/workflows/taoskeeper-ci.yml | 43 ++++++++++------------------- 1 file changed, 14 insertions(+), 29 deletions(-) diff --git a/.github/workflows/taoskeeper-ci.yml b/.github/workflows/taoskeeper-ci.yml index edfcfe717799..538d1adbd38c 100644 --- a/.github/workflows/taoskeeper-ci.yml +++ b/.github/workflows/taoskeeper-ci.yml @@ -3,7 +3,7 @@ name: taoskeeper CI on: push: paths: - - "tools/keeper/**" + - tools/keeper/** jobs: build: @@ -19,40 +19,25 @@ jobs: with: go-version: 1.18 - - name: Install system dependencies + - name: Start TDengine run: | - sudo apt update -y - sudo apt install -y build-essential cmake libgeos-dev + docker pull tdengine/tdengine:latest + docker run --name tdengine -d -p 6030:6030 -p 6041:6041 -p 6043-6060:6043-6060 -p 6043-6060:6043-6060/udp tdengine/tdengine - - name: Install TDengine - run: | - # cd TDengine - mkdir debug - cd debug - cmake .. -DBUILD_HTTP=false -DBUILD_JDBC=false -DBUILD_TOOLS=false -DBUILD_TEST=off -DBUILD_KEEPER=true - make -j 4 - sudo make install - which taosd - which taosadapter - which taoskeeper - - - name: Start taosd - run: | - cp /etc/taos/taos.cfg ./ - sudo echo "supportVnodes 256" >> taos.cfg - nohup sudo taosd -c taos.cfg & - - - name: Start taosadapter - run: nohup sudo taosadapter & - - - name: Run tests + - name: Build taoskeeper + working-directory: tools/keeper run: | go mod tidy - go test -v ./... + go build -v ./... + + - name: Run tests with coverage working-directory: tools/keeper + run: | + go test -v -coverpkg=./... -coverprofile=coverage.out ./... + go tool cover -func=coverage.out - name: Clean up if: always() run: | - sudo pkill taosd - sudo pkill taosadapter + docker stop tdengine + docker rm tdengine From 5ec4b9d35abd1fd89c8a1156876dc38740a1d22e Mon Sep 17 00:00:00 2001 From: qevolg <2227465945@qq.com> Date: Thu, 24 Oct 2024 18:03:17 +0800 Subject: [PATCH 252/695] test(keeper/api): trigger taoskeeper ci --- tools/keeper/api/adapter2_test.go | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/keeper/api/adapter2_test.go b/tools/keeper/api/adapter2_test.go index 5456dfeecf1a..e6fd263c43fa 100644 --- a/tools/keeper/api/adapter2_test.go +++ b/tools/keeper/api/adapter2_test.go @@ -14,7 +14,6 @@ import ( ) func TestAdapter2(t *testing.T) { - // c := &config.Config{ InstanceID: 64, Port: 6043, From 534a6ef1c5243ad64e33da4aa19fb620b17e9fa4 Mon Sep 17 00:00:00 2001 From: qevolg <2227465945@qq.com> Date: Thu, 24 Oct 2024 18:05:30 +0800 Subject: [PATCH 253/695] chore(.github): modify taoskeeper github action workflow --- .github/workflows/taoskeeper-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/taoskeeper-ci.yml b/.github/workflows/taoskeeper-ci.yml index 538d1adbd38c..9ed23be1fa70 100644 --- a/.github/workflows/taoskeeper-ci.yml +++ b/.github/workflows/taoskeeper-ci.yml @@ -33,7 +33,7 @@ jobs: - name: Run tests with coverage working-directory: tools/keeper run: | - go test -v -coverpkg=./... -coverprofile=coverage.out ./... + sudo go test -v -coverpkg=./... -coverprofile=coverage.out ./... go tool cover -func=coverage.out - name: Clean up From 9aef8f1bdb2a62431bdd3e45585fe26c6a285f81 Mon Sep 17 00:00:00 2001 From: qevolg <2227465945@qq.com> Date: Thu, 24 Oct 2024 18:05:47 +0800 Subject: [PATCH 254/695] test(keeper/api): trigger taoskeeper ci --- tools/keeper/api/adapter2_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/keeper/api/adapter2_test.go b/tools/keeper/api/adapter2_test.go index e6fd263c43fa..5456dfeecf1a 100644 --- a/tools/keeper/api/adapter2_test.go +++ b/tools/keeper/api/adapter2_test.go @@ -14,6 +14,7 @@ import ( ) func TestAdapter2(t *testing.T) { + // c := &config.Config{ InstanceID: 64, Port: 6043, From c040bccf890af208af7a6f767eca7b6680799d30 Mon Sep 17 00:00:00 2001 From: qevolg <2227465945@qq.com> Date: Thu, 24 Oct 2024 18:07:45 +0800 Subject: [PATCH 255/695] test(keeper/api): trigger taoskeeper ci --- tools/keeper/api/adapter2_test.go | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/keeper/api/adapter2_test.go b/tools/keeper/api/adapter2_test.go index 5456dfeecf1a..e6fd263c43fa 100644 --- a/tools/keeper/api/adapter2_test.go +++ b/tools/keeper/api/adapter2_test.go @@ -14,7 +14,6 @@ import ( ) func TestAdapter2(t *testing.T) { - // c := &config.Config{ InstanceID: 64, Port: 6043, From 9cb415cb4d46efcae8bfdb4990d59476b4230b30 Mon Sep 17 00:00:00 2001 From: dmchen Date: Thu, 24 Oct 2024 10:08:11 +0000 Subject: [PATCH 256/695] fix/TD-32621-add-log --- source/dnode/mgmt/mgmt_vnode/src/vmFile.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmFile.c b/source/dnode/mgmt/mgmt_vnode/src/vmFile.c index 5fabd4cdde94..215a0576185d 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmFile.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmFile.c @@ -203,6 +203,7 @@ int32_t vmWriteVnodeListToFile(SVnodeMgmt *pMgmt) { SVnodeObj **ppVnodes = NULL; char file[PATH_MAX] = {0}; char realfile[PATH_MAX] = {0}; + int32_t lino = 0; int32_t nBytes = snprintf(file, sizeof(file), "%s%svnodes_tmp.json", pMgmt->path, TD_DIRSEP); if (nBytes <= 0 || nBytes >= sizeof(file)) { @@ -215,8 +216,7 @@ int32_t vmWriteVnodeListToFile(SVnodeMgmt *pMgmt) { } int32_t numOfVnodes = 0; - code = vmGetVnodeListFromHash(pMgmt, &numOfVnodes, &ppVnodes); - if (code) goto _OVER; + TAOS_CHECK_GOTO(vmGetVnodeListFromHash(pMgmt, &numOfVnodes, &ppVnodes), &lino, _OVER); // terrno = TSDB_CODE_OUT_OF_MEMORY; pJson = tjsonCreateObject(); @@ -224,36 +224,41 @@ int32_t vmWriteVnodeListToFile(SVnodeMgmt *pMgmt) { code = terrno; goto _OVER; } - if ((code = vmEncodeVnodeList(pJson, ppVnodes, numOfVnodes)) != 0) goto _OVER; + TAOS_CHECK_GOTO(vmEncodeVnodeList(pJson, ppVnodes, numOfVnodes), &lino, _OVER); buffer = tjsonToString(pJson); if (buffer == NULL) { code = TSDB_CODE_INVALID_JSON_FORMAT; + lino = __LINE__; goto _OVER; } pFile = taosOpenFile(file, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_TRUNC | TD_FILE_WRITE_THROUGH); if (pFile == NULL) { code = terrno; + lino = __LINE__; goto _OVER; } int32_t len = strlen(buffer); if (taosWriteFile(pFile, buffer, len) <= 0) { code = terrno; + lino = __LINE__; goto _OVER; } if (taosFsyncFile(pFile) < 0) { code = TAOS_SYSTEM_ERROR(errno); + lino = __LINE__; goto _OVER; } code = taosCloseFile(&pFile); if (code != 0) { code = TAOS_SYSTEM_ERROR(errno); + lino = __LINE__; goto _OVER; } - TAOS_CHECK_GOTO(taosRenameFile(file, realfile), NULL, _OVER); + TAOS_CHECK_GOTO(taosRenameFile(file, realfile), &lino, _OVER); dInfo("succeed to write vnodes file:%s, vnodes:%d", realfile, numOfVnodes); @@ -272,7 +277,8 @@ int32_t vmWriteVnodeListToFile(SVnodeMgmt *pMgmt) { } if (code != 0) { - dError("failed to write vnodes file:%s since %s, vnodes:%d", realfile, tstrerror(code), numOfVnodes); + dError("failed to write vnodes file:%s at line:%d since %s, vnodes:%d", realfile, lino, tstrerror(code), + numOfVnodes); } return code; } From 4a6e011615d5ff77a128f96aaec03459ee8ae100 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Thu, 24 Oct 2024 18:33:37 +0800 Subject: [PATCH 257/695] fix: invalid db options --- source/libs/parser/src/parAstCreater.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c index e031ee0fe1b3..7e6ffd12a29c 100644 --- a/source/libs/parser/src/parAstCreater.c +++ b/source/libs/parser/src/parAstCreater.c @@ -1974,14 +1974,13 @@ static SNode* setDatabaseOptionImpl(SAstCreateContext* pCxt, SNode* pOptions, ED case DB_OPTION_S3_COMPACT: pDbOptions->s3Compact = taosStr2Int8(((SToken*)pVal)->z, NULL, 10); break; - case DB_OPTION_KEEP_TIME_OFFSET: { + case DB_OPTION_KEEP_TIME_OFFSET: pDbOptions->keepTimeOffset = taosStr2Int32(((SToken*)pVal)->z, NULL, 10); break; - case DB_OPTION_ENCRYPT_ALGORITHM: - COPY_STRING_FORM_STR_TOKEN(pDbOptions->encryptAlgorithmStr, (SToken*)pVal); - pDbOptions->encryptAlgorithm = TSDB_DEFAULT_ENCRYPT_ALGO; - break; - } + case DB_OPTION_ENCRYPT_ALGORITHM: + COPY_STRING_FORM_STR_TOKEN(pDbOptions->encryptAlgorithmStr, (SToken*)pVal); + pDbOptions->encryptAlgorithm = TSDB_DEFAULT_ENCRYPT_ALGO; + break; default: break; } From 33a0fd551984fa5f0c48d0798d08a356f8784d9e Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Thu, 24 Oct 2024 18:34:53 +0800 Subject: [PATCH 258/695] fix: modify subplan validation issue --- source/libs/scheduler/src/schUtil.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/libs/scheduler/src/schUtil.c b/source/libs/scheduler/src/schUtil.c index 48401086384e..59951ab6185a 100644 --- a/source/libs/scheduler/src/schUtil.c +++ b/source/libs/scheduler/src/schUtil.c @@ -393,8 +393,8 @@ int32_t schValidateSubplan(SSchJob *pJob, SSubplan* pSubplan, int32_t level, int } } - if (NULL == pSubplan->pNode) { - SCH_JOB_ELOG("empty plan root node, level:%d, subplan idx:%d", level, idx); + if (NULL == pSubplan->pNode && pSubplan->subplanType != SUBPLAN_TYPE_MODIFY) { + SCH_JOB_ELOG("empty plan root node, level:%d, subplan idx:%d, subplanType:%d", level, idx, pSubplan->subplanType); SCH_ERR_RET(TSDB_CODE_QRY_INVALID_INPUT); } From 35d3d968ff7e582d11808cdc74c96539516ee0d6 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Thu, 24 Oct 2024 18:55:37 +0800 Subject: [PATCH 259/695] enh:[TD-32166]refactor code in sml --- source/client/inc/clientSml.h | 1 - source/client/src/clientSml.c | 101 +++++++++++++------------- source/client/src/clientSmlJson.c | 33 ++++----- source/client/src/clientSmlLine.c | 29 +++----- source/client/src/clientSmlTelnet.c | 16 ++-- source/client/test/smlTest.cpp | 9 +++ source/libs/parser/src/parInsertSml.c | 6 +- utils/test/c/sml_test.c | 24 ++++-- 8 files changed, 120 insertions(+), 99 deletions(-) diff --git a/source/client/inc/clientSml.h b/source/client/inc/clientSml.h index 8558ec46dce4..d94a671c4598 100644 --- a/source/client/inc/clientSml.h +++ b/source/client/inc/clientSml.h @@ -211,7 +211,6 @@ typedef struct { cJSON *root; // for parse json int8_t offset[OTD_JSON_FIELDS_NUM]; SSmlLineInfo *lines; // element is SSmlLineInfo - bool parseJsonByLib; SArray *tagJsonArray; SArray *valueJsonArray; diff --git a/source/client/src/clientSml.c b/source/client/src/clientSml.c index 1b4643a95821..f9ba8531f41a 100644 --- a/source/client/src/clientSml.c +++ b/source/client/src/clientSml.c @@ -169,23 +169,23 @@ int64_t smlGetTimeValue(const char *value, int32_t len, uint8_t fromPrecision, u } int32_t smlBuildTableInfo(int numRows, const char *measure, int32_t measureLen, SSmlTableInfo **tInfo) { + int32_t code = 0; + int32_t lino = 0; SSmlTableInfo *tag = (SSmlTableInfo *)taosMemoryCalloc(sizeof(SSmlTableInfo), 1); - if (!tag) { - return terrno; - } + SML_CHECK_NULL(tag) tag->sTableName = measure; tag->sTableNameLen = measureLen; tag->cols = taosArrayInit(numRows, POINTER_BYTES); - if (tag->cols == NULL) { - uError("SML:smlBuildTableInfo failed to allocate memory"); - taosMemoryFree(tag); - return terrno; - } - + SML_CHECK_NULL(tag->cols) *tInfo = tag; - return TSDB_CODE_SUCCESS; + return code; + +END: + taosMemoryFree(tag); + uError("%s failed code:%d line:%d", __FUNCTION__ , code, lino); + return code; } void smlBuildTsKv(SSmlKv *kv, int64_t ts) { @@ -437,7 +437,7 @@ int32_t smlParseEndTelnetJsonUnFormat(SSmlHandle *info, SSmlLineInfo *elements, int32_t smlParseEndLine(SSmlHandle *info, SSmlLineInfo *elements, SSmlKv *kvTs) { if (info->dataFormat) { - uDebug("SML:0x%" PRIx64 " smlParseEndLine format true, ts:%" PRId64, info->id, kvTs->i); + uDebug("SML:0x%" PRIx64 " %s format true, ts:%" PRId64, info->id, __FUNCTION__, kvTs->i); int32_t ret = smlBuildCol(info->currTableDataCtx, info->currSTableMeta->schema, kvTs, 0); if (ret == TSDB_CODE_SUCCESS) { ret = smlBuildRow(info->currTableDataCtx); @@ -446,11 +446,11 @@ int32_t smlParseEndLine(SSmlHandle *info, SSmlLineInfo *elements, SSmlKv *kvTs) clearColValArraySml(info->currTableDataCtx->pValues); taosArrayClearP(info->escapedStringList, taosMemoryFree); if (unlikely(ret != TSDB_CODE_SUCCESS)) { - smlBuildInvalidDataMsg(&info->msgBuf, "smlBuildCol error", NULL); + uError("SML:0x%" PRIx64 " %s smlBuildCol error:%d", info->id, __FUNCTION__, ret); return ret; } } else { - uDebug("SML:0x%" PRIx64 " smlParseEndLine format false, ts:%" PRId64, info->id, kvTs->i); + uDebug("SML:0x%" PRIx64 " %s format false, ts:%" PRId64, info->id, __FUNCTION__, kvTs->i); taosArraySet(elements->colArray, 0, kvTs); } info->preLine = *elements; @@ -1134,7 +1134,7 @@ static int32_t smlModifyDBSchemas(SSmlHandle *info) { taosHashCleanup(hashTmp); hashTmp = NULL; } else { - uError("SML:0x%" PRIx64 " load table meta error: %s", info->id, tstrerror(code)); + uError("SML:0x%" PRIx64 " %s load table meta error: %s", info->id, __FUNCTION__, tstrerror(code)); goto END; } @@ -1145,11 +1145,11 @@ static int32_t smlModifyDBSchemas(SSmlHandle *info) { taosMemoryFreeClear(sTableData->tableMeta); sTableData->tableMeta = pTableMeta; - uDebug("SML:0x%" PRIx64 "modify schema uid:%" PRIu64 ", sversion:%d, tversion:%d", info->id, pTableMeta->uid, + uDebug("SML:0x%" PRIx64 " %s modify schema uid:%" PRIu64 ", sversion:%d, tversion:%d", info->id, __FUNCTION__, pTableMeta->uid, pTableMeta->sversion, pTableMeta->tversion); tmp = (SSmlSTableMeta **)taosHashIterate(info->superTables, tmp); } - uDebug("SML:0x%" PRIx64 " smlModifyDBSchemas end success, format:%d, needModifySchema:%d", info->id, info->dataFormat, + uDebug("SML:0x%" PRIx64 " %s end success, format:%d, needModifySchema:%d", info->id, __FUNCTION__, info->dataFormat, info->needModifySchema); return TSDB_CODE_SUCCESS; @@ -1159,7 +1159,7 @@ static int32_t smlModifyDBSchemas(SSmlHandle *info) { taosHashCleanup(hashTmp); taosMemoryFreeClear(pTableMeta); (void)catalogRefreshTableMeta(info->pCatalog, &conn, &pName, 1); // ignore refresh meta code if there is an error - uError("SML:0x%" PRIx64 " smlModifyDBSchemas end failed:%d:%s, format:%d, needModifySchema:%d", info->id, code, + uError("SML:0x%" PRIx64 " %s end failed:%d:%s, format:%d, needModifySchema:%d", info->id, __FUNCTION__, code, tstrerror(code), info->dataFormat, info->needModifySchema); return code; @@ -1331,7 +1331,7 @@ int32_t smlBuildSmlInfo(TAOS *taos, SSmlHandle **handle) { SML_CHECK_NULL(info->escapedStringList); *handle = info; - return code; + info = NULL; END: smlDestroyInfo(info); @@ -1362,8 +1362,8 @@ static int32_t smlPushCols(SArray *colsArray, SArray *cols) { RETURN } -static int32_t smlParseLineBottom(SSmlHandle *info) { - uDebug("SML:0x%" PRIx64 " smlParseLineBottom start, format:%d, linenum:%d", info->id, info->dataFormat, +static int32_t smlParseEnd(SSmlHandle *info) { + uDebug("SML:0x%" PRIx64 " %s start, format:%d, linenum:%d", info->id, __FUNCTION__, info->dataFormat, info->lineNum); int32_t code = 0; int32_t lino = 0; @@ -1403,28 +1403,28 @@ static int32_t smlParseLineBottom(SSmlHandle *info) { SSmlSTableMeta **tableMeta = (SSmlSTableMeta **)taosHashGet(info->superTables, elements->measure, elements->measureLen); if (tableMeta) { // update meta - uDebug("SML:0x%" PRIx64 " smlParseLineBottom update meta, format:%d, linenum:%d", info->id, info->dataFormat, + uDebug("SML:0x%" PRIx64 " %s update meta, format:%d, linenum:%d", info->id, __FUNCTION__, info->dataFormat, info->lineNum); SML_CHECK_CODE(smlUpdateMeta((*tableMeta)->colHash, (*tableMeta)->cols, elements->colArray, false, &info->msgBuf, (*tableMeta)->tagHash)); SML_CHECK_CODE(smlUpdateMeta((*tableMeta)->tagHash, (*tableMeta)->tags, tinfo->tags, true, &info->msgBuf, (*tableMeta)->colHash)); } else { - uDebug("SML:0x%" PRIx64 " smlParseLineBottom add meta, format:%d, linenum:%d", info->id, info->dataFormat, + uDebug("SML:0x%" PRIx64 " %s add meta, format:%d, linenum:%d", info->id, __FUNCTION__, info->dataFormat, info->lineNum); SSmlSTableMeta *meta = NULL; SML_CHECK_CODE(smlBuildSTableMeta(info->dataFormat, &meta)); code = taosHashPut(info->superTables, elements->measure, elements->measureLen, &meta, POINTER_BYTES); if (code != TSDB_CODE_SUCCESS) { smlDestroySTableMeta(&meta); - uError("SML:0x%" PRIx64 " put measuer to hash failed", info->id); + uError("SML:0x%" PRIx64 " put measure to hash failed", info->id); goto END; } SML_CHECK_CODE(smlInsertMeta(meta->tagHash, meta->tags, tinfo->tags, NULL)); SML_CHECK_CODE(smlInsertMeta(meta->colHash, meta->cols, elements->colArray, meta->tagHash)); } } - uDebug("SML:0x%" PRIx64 " smlParseLineBottom end, format:%d, linenum:%d", info->id, info->dataFormat, info->lineNum); + uDebug("SML:0x%" PRIx64 " %s end, format:%d, linenum:%d", info->id, __FUNCTION__, info->dataFormat, info->lineNum); END: RETURN @@ -1435,7 +1435,7 @@ static int32_t smlInsertData(SSmlHandle *info) { int32_t lino = 0; char *measure = NULL; SSmlTableInfo **oneTable = NULL; - uDebug("SML:0x%" PRIx64 " smlInsertData start, format:%d", info->id, info->dataFormat); + uDebug("SML:0x%" PRIx64 " %s start, format:%d", info->id, __FUNCTION__, info->dataFormat); if (info->pRequest->dbList == NULL) { info->pRequest->dbList = taosArrayInit(1, TSDB_DB_FNAME_LEN); @@ -1484,7 +1484,7 @@ static int32_t smlInsertData(SSmlHandle *info) { SSmlSTableMeta **pMeta = (SSmlSTableMeta **)taosHashGet(info->superTables, tableData->sTableName, tableData->sTableNameLen); if (unlikely(NULL == pMeta || NULL == *pMeta || NULL == (*pMeta)->tableMeta)) { - uError("SML:0x%" PRIx64 " NULL == pMeta. table name: %s", info->id, tableData->childTableName); + uError("SML:0x%" PRIx64 " %s NULL == pMeta. table name: %s", info->id, __FUNCTION__, tableData->childTableName); code = TSDB_CODE_SML_INTERNAL_ERROR; goto END; } @@ -1492,7 +1492,7 @@ static int32_t smlInsertData(SSmlHandle *info) { // use tablemeta of stable to save vgid and uid of child table (*pMeta)->tableMeta->vgId = vg.vgId; (*pMeta)->tableMeta->uid = tableData->uid; // one table merge data block together according uid - uDebug("SML:0x%" PRIx64 " smlInsertData table:%s, uid:%" PRIu64 ", format:%d", info->id, pName.tname, + uDebug("SML:0x%" PRIx64 " %s table:%s, uid:%" PRIu64 ", format:%d", info->id, __FUNCTION__, pName.tname, tableData->uid, info->dataFormat); SML_CHECK_CODE(smlBindData(info->pQuery, info->dataFormat, tableData->tags, (*pMeta)->cols, tableData->cols, @@ -1510,7 +1510,7 @@ static int32_t smlInsertData(SSmlHandle *info) { launchQueryImpl(info->pRequest, info->pQuery, true, NULL); // no need to check return code - uDebug("SML:0x%" PRIx64 " smlInsertData end, format:%d, code:%d,%s", info->id, info->dataFormat, info->pRequest->code, + uDebug("SML:0x%" PRIx64 " %s end, format:%d, code:%d,%s", info->id, __FUNCTION__, info->dataFormat, info->pRequest->code, tstrerror(info->pRequest->code)); return info->pRequest->code; @@ -1605,20 +1605,25 @@ static bool getLine(SSmlHandle *info, char *lines[], char **rawLine, char *rawLi return true; } -static int32_t smlParseLine(SSmlHandle *info, char *lines[], char *rawLine, char *rawLineEnd, int numLines) { - uDebug("SML:0x%" PRIx64 " smlParseLine start", info->id); + +static int32_t smlParseJson(SSmlHandle *info, char *lines[], char *rawLine) { + int32_t code = TSDB_CODE_SUCCESS; + if (lines) { + code = smlParseJSONExt(info, *lines); + } else if (rawLine) { + code = smlParseJSONExt(info, rawLine); + } + if (code != TSDB_CODE_SUCCESS) { + uError("%s failed code:%d", __FUNCTION__ , code); + } + return code; +} + +static int32_t smlParseStart(SSmlHandle *info, char *lines[], char *rawLine, char *rawLineEnd, int numLines) { + uDebug("SML:0x%" PRIx64 " %s start", info->id, __FUNCTION__); int32_t code = TSDB_CODE_SUCCESS; if (info->protocol == TSDB_SML_JSON_PROTOCOL) { - if (lines) { - code = smlParseJSONExt(info, *lines); - } else if (rawLine) { - code = smlParseJSONExt(info, rawLine); - } - if (code != TSDB_CODE_SUCCESS) { - uError("SML:0x%" PRIx64 " smlParseJSON failed:%s", info->id, lines ? *lines : rawLine); - return code; - } - return code; + return smlParseJson(info, lines, rawLine); } char *oldRaw = rawLine; @@ -1644,19 +1649,17 @@ static int32_t smlParseLine(SSmlHandle *info, char *lines[], char *rawLine, char } else { code = smlParseTelnetString(info, (char *)tmp, (char *)tmp + len, info->lines + i); } - } else { - code = TSDB_CODE_SML_INVALID_PROTOCOL_TYPE; } if (code != TSDB_CODE_SUCCESS) { if (rawLine != NULL) { printRaw(info->id, i, numLines, DEBUG_ERROR, tmp, len); } else { - uError("SML:0x%" PRIx64 " smlParseLine failed. line %d : %s", info->id, i, tmp); + uError("SML:0x%" PRIx64 " %s failed. line %d : %s", info->id, __FUNCTION__, i, tmp); } return code; } if (info->reRun) { - uDebug("SML:0x%" PRIx64 " smlParseLine re run", info->id); + uDebug("SML:0x%" PRIx64 " %s re run", info->id, __FUNCTION__); i = 0; rawLine = oldRaw; code = smlClearForRerun(info); @@ -1667,7 +1670,7 @@ static int32_t smlParseLine(SSmlHandle *info, char *lines[], char *rawLine, char } i++; } - uDebug("SML:0x%" PRIx64 " smlParseLine end", info->id); + uDebug("SML:0x%" PRIx64 " %s end", info->id, __FUNCTION__); return code; } @@ -1679,8 +1682,8 @@ static int smlProcess(SSmlHandle *info, char *lines[], char *rawLine, char *rawL info->cost.parseTime = taosGetTimestampUs(); - SML_CHECK_CODE(smlParseLine(info, lines, rawLine, rawLineEnd, numLines)); - SML_CHECK_CODE(smlParseLineBottom(info)); + SML_CHECK_CODE(smlParseStart(info, lines, rawLine, rawLineEnd, numLines)); + SML_CHECK_CODE(smlParseEnd(info)); info->cost.lineNum = info->lineNum; info->cost.numOfSTables = taosHashGetSize(info->superTables); @@ -1752,7 +1755,7 @@ TAOS_RES *taos_schemaless_insert_inner(TAOS *taos, char *lines[], char *rawLine, int cnt = 0; while (1) { SML_CHECK_CODE(createRequest(*(int64_t *)taos, TSDB_SQL_INSERT, reqid, &request)); - SSmlMsgBuf msg = {ERROR_MSG_BUF_DEFAULT_SIZE, request->msgBuf}; + SSmlMsgBuf msg = {request->msgBufLen, request->msgBuf}; request->code = smlBuildSmlInfo(taos, &info); SML_CHECK_CODE(request->code); @@ -1822,7 +1825,7 @@ TAOS_RES *taos_schemaless_insert_inner(TAOS *taos, char *lines[], char *rawLine, break; } - END: +END: smlDestroyInfo(info); return (TAOS_RES *)request; } diff --git a/source/client/src/clientSmlJson.c b/source/client/src/clientSmlJson.c index feb0b4645a31..2dcc36eada13 100644 --- a/source/client/src/clientSmlJson.c +++ b/source/client/src/clientSmlJson.c @@ -24,7 +24,7 @@ static inline int32_t smlParseMetricFromJSON(SSmlHandle *info, cJSON *metric, SSmlLineInfo *elements) { elements->measureLen = strlen(metric->valuestring); if (IS_INVALID_TABLE_LEN(elements->measureLen)) { - uError("OTD:0x%" PRIx64 " Metric length is 0 or large than 192", info->id); + uError("SML:0x%" PRIx64 " Metric length is 0 or large than 192", info->id); return TSDB_CODE_TSC_INVALID_TABLE_ID_LENGTH; } @@ -44,7 +44,7 @@ static int32_t smlGetJsonElements(cJSON *root, cJSON ***marks) { child = child->next; } if (*marks[i] == NULL) { - uError("smlGetJsonElements error, not find mark:%d:%s", i, jsonName[i]); + uError("SML %s error, not find mark:%d:%s", __FUNCTION__, i, jsonName[i]); return TSDB_CODE_TSC_INVALID_JSON; } } @@ -53,7 +53,7 @@ static int32_t smlGetJsonElements(cJSON *root, cJSON ***marks) { static int32_t smlConvertJSONBool(SSmlKv *pVal, char *typeStr, cJSON *value) { if (strcasecmp(typeStr, "bool") != 0) { - uError("OTD:invalid type(%s) for JSON Bool", typeStr); + uError("SML:invalid type(%s) for JSON Bool", typeStr); return TSDB_CODE_TSC_INVALID_JSON_TYPE; } pVal->type = TSDB_DATA_TYPE_BOOL; @@ -67,7 +67,7 @@ static int32_t smlConvertJSONNumber(SSmlKv *pVal, char *typeStr, cJSON *value) { // tinyint if (strcasecmp(typeStr, "i8") == 0 || strcasecmp(typeStr, "tinyint") == 0) { if (!IS_VALID_TINYINT(value->valuedouble)) { - uError("OTD:JSON value(%f) cannot fit in type(tinyint)", value->valuedouble); + uError("SML:JSON value(%f) cannot fit in type(tinyint)", value->valuedouble); return TSDB_CODE_TSC_VALUE_OUT_OF_RANGE; } pVal->type = TSDB_DATA_TYPE_TINYINT; @@ -78,7 +78,7 @@ static int32_t smlConvertJSONNumber(SSmlKv *pVal, char *typeStr, cJSON *value) { // smallint if (strcasecmp(typeStr, "i16") == 0 || strcasecmp(typeStr, "smallint") == 0) { if (!IS_VALID_SMALLINT(value->valuedouble)) { - uError("OTD:JSON value(%f) cannot fit in type(smallint)", value->valuedouble); + uError("SML:JSON value(%f) cannot fit in type(smallint)", value->valuedouble); return TSDB_CODE_TSC_VALUE_OUT_OF_RANGE; } pVal->type = TSDB_DATA_TYPE_SMALLINT; @@ -89,7 +89,7 @@ static int32_t smlConvertJSONNumber(SSmlKv *pVal, char *typeStr, cJSON *value) { // int if (strcasecmp(typeStr, "i32") == 0 || strcasecmp(typeStr, "int") == 0) { if (!IS_VALID_INT(value->valuedouble)) { - uError("OTD:JSON value(%f) cannot fit in type(int)", value->valuedouble); + uError("SML:JSON value(%f) cannot fit in type(int)", value->valuedouble); return TSDB_CODE_TSC_VALUE_OUT_OF_RANGE; } pVal->type = TSDB_DATA_TYPE_INT; @@ -113,7 +113,7 @@ static int32_t smlConvertJSONNumber(SSmlKv *pVal, char *typeStr, cJSON *value) { // float if (strcasecmp(typeStr, "f32") == 0 || strcasecmp(typeStr, "float") == 0) { if (!IS_VALID_FLOAT(value->valuedouble)) { - uError("OTD:JSON value(%f) cannot fit in type(float)", value->valuedouble); + uError("SML:JSON value(%f) cannot fit in type(float)", value->valuedouble); return TSDB_CODE_TSC_VALUE_OUT_OF_RANGE; } pVal->type = TSDB_DATA_TYPE_FLOAT; @@ -130,7 +130,7 @@ static int32_t smlConvertJSONNumber(SSmlKv *pVal, char *typeStr, cJSON *value) { } // if reach here means type is unsupported - uError("OTD:invalid type(%s) for JSON Number", typeStr); + uError("SML:invalid type(%s) for JSON Number", typeStr); return TSDB_CODE_TSC_INVALID_JSON_TYPE; } @@ -142,7 +142,7 @@ static int32_t smlConvertJSONString(SSmlKv *pVal, char *typeStr, cJSON *value) { } else if (strcasecmp(typeStr, "nchar") == 0) { pVal->type = TSDB_DATA_TYPE_NCHAR; } else { - uError("OTD:invalid type(%s) for JSON String", typeStr); + uError("SML:invalid type(%s) for JSON String", typeStr); return TSDB_CODE_TSC_INVALID_JSON_TYPE; } pVal->length = strlen(value->valuestring); @@ -225,7 +225,7 @@ static int32_t smlParseValueFromJSON(cJSON *root, SSmlKv *kv) { case cJSON_String: { int32_t ret = smlConvertJSONString(kv, "binary", root); if (ret != TSDB_CODE_SUCCESS) { - uError("OTD:Failed to parse binary value from JSON Obj"); + uError("SML:Failed to parse binary value from JSON Obj"); return ret; } break; @@ -233,7 +233,7 @@ static int32_t smlParseValueFromJSON(cJSON *root, SSmlKv *kv) { case cJSON_Object: { int32_t ret = smlParseValueFromJSONObj(root, kv); if (ret != TSDB_CODE_SUCCESS) { - uError("OTD:Failed to parse value from JSON Obj"); + uError("SML:Failed to parse value from JSON Obj"); return ret; } break; @@ -262,7 +262,7 @@ static int32_t smlProcessTagJson(SSmlHandle *info, cJSON *tags){ } size_t keyLen = strlen(tag->string); if (unlikely(IS_INVALID_COL_LEN(keyLen))) { - uError("OTD:Tag key length is 0 or too large than 64"); + uError("SML:Tag key length is 0 or too large than 64"); return TSDB_CODE_TSC_INVALID_COLUMN_LENGTH; } @@ -436,7 +436,7 @@ static int32_t smlParseJSONStringExt(SSmlHandle *info, cJSON *root, SSmlLineInfo int32_t size = cJSON_GetArraySize(root); // outmost json fields has to be exactly 4 if (size != OTD_JSON_FIELDS_NUM) { - uError("OTD:0x%" PRIx64 " Invalid number of JSON fields in data point %d", info->id, size); + uError("SML:0x%" PRIx64 " Invalid number of JSON fields in data point %d", info->id, size); return TSDB_CODE_TSC_INVALID_JSON; } @@ -465,9 +465,9 @@ static int32_t smlParseJSONStringExt(SSmlHandle *info, cJSON *root, SSmlLineInfo if (unlikely(ts < 0)) { char* tmp = cJSON_PrintUnformatted(tsJson); if (tmp == NULL) { - uError("OTD:0x%" PRIx64 " Unable to parse timestamp from JSON payload %s %" PRId64, info->id, info->msgBuf.buf, ts); + uError("SML:0x%" PRIx64 " Unable to parse timestamp from JSON payload %s %" PRId64, info->id, info->msgBuf.buf, ts); } else { - uError("OTD:0x%" PRIx64 " Unable to parse timestamp from JSON payload %s %s %" PRId64, info->id, info->msgBuf.buf,tmp, ts); + uError("SML:0x%" PRIx64 " Unable to parse timestamp from JSON payload %s %s %" PRId64, info->id, info->msgBuf.buf,tmp, ts); taosMemoryFree(tmp); } code = TSDB_CODE_INVALID_TIMESTAMP; @@ -506,7 +506,7 @@ int32_t smlParseJSONExt(SSmlHandle *info, char *payload) { } else if (cJSON_IsObject(info->root)) { payloadNum = 1; } else { - uError("SML:0x%" PRIx64 " Invalid JSON Payload 3:%s", info->id, payload); + uError("SML:0x%" PRIx64 " Invalid JSON type:%s", info->id, payload); return TSDB_CODE_TSC_INVALID_JSON; } @@ -520,7 +520,6 @@ int32_t smlParseJSONExt(SSmlHandle *info, char *payload) { SSmlLineInfo element = {0}; ret = smlParseJSONStringExt(info, dataPoint, &element); if (element.measureTagsLen != 0) taosMemoryFree(element.measureTag); - } else { ret = smlParseJSONStringExt(info, dataPoint, info->lines + cnt); } diff --git a/source/client/src/clientSmlLine.c b/source/client/src/clientSmlLine.c index e2e60ee7c493..b54f4e0beb4a 100644 --- a/source/client/src/clientSmlLine.c +++ b/source/client/src/clientSmlLine.c @@ -63,7 +63,7 @@ static int64_t smlParseInfluxTime(SSmlHandle *info, const char *data, int32_t le int64_t ts = smlGetTimeValue(data, len, fromPrecision, toPrecision); if (unlikely(ts == -1)) { - smlBuildInvalidDataMsg(&info->msgBuf, "invalid timestamp", data); + smlBuildInvalidDataMsg(&info->msgBuf, "SML line invalid timestamp", data); return TSDB_CODE_SML_INVALID_DATA; } return ts; @@ -84,7 +84,7 @@ int32_t smlParseValue(SSmlKv *pVal, SSmlMsgBuf *msg) { } if (pVal->value[0] == 'l' || pVal->value[0] == 'L') { // nchar - if (pVal->value[1] == '"' && pVal->value[pVal->length - 1] == '"' && pVal->length >= 3) { + if (pVal->length >= NCHAR_ADD_LEN && pVal->value[1] == '"' && pVal->value[pVal->length - 1] == '"') { pVal->type = TSDB_DATA_TYPE_NCHAR; pVal->length -= NCHAR_ADD_LEN; if (pVal->length > (TSDB_MAX_NCHAR_LEN - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE) { @@ -97,7 +97,7 @@ int32_t smlParseValue(SSmlKv *pVal, SSmlMsgBuf *msg) { } if (pVal->value[0] == 'g' || pVal->value[0] == 'G') { // geometry - if (pVal->value[1] == '"' && pVal->value[pVal->length - 1] == '"' && pVal->length >= sizeof("POINT")+3) { + if (pVal->length >= NCHAR_ADD_LEN && pVal->value[1] == '"' && pVal->value[pVal->length - 1] == '"') { int32_t code = initCtxGeomFromText(); if (code != TSDB_CODE_SUCCESS) { return code; @@ -124,7 +124,7 @@ int32_t smlParseValue(SSmlKv *pVal, SSmlMsgBuf *msg) { } if (pVal->value[0] == 'b' || pVal->value[0] == 'B') { // varbinary - if (pVal->value[1] == '"' && pVal->value[pVal->length - 1] == '"' && pVal->length >= 3) { + if (pVal->length >= NCHAR_ADD_LEN && pVal->value[1] == '"' && pVal->value[pVal->length - 1] == '"') { pVal->type = TSDB_DATA_TYPE_VARBINARY; if(isHex(pVal->value + NCHAR_ADD_LEN - 1, pVal->length - NCHAR_ADD_LEN)){ if(!isValidateHex(pVal->value + NCHAR_ADD_LEN - 1, pVal->length - NCHAR_ADD_LEN)){ @@ -346,7 +346,7 @@ static int32_t smlParseColLine(SSmlHandle *info, char **sql, char *sqlEnd, SSmlL const char *escapeChar = NULL; while (*sql < sqlEnd) { if (unlikely(IS_SPACE(*sql,escapeChar) || IS_COMMA(*sql,escapeChar))) { - smlBuildInvalidDataMsg(&info->msgBuf, "invalid data", *sql); + smlBuildInvalidDataMsg(&info->msgBuf, "SML line invalid data", *sql); return TSDB_CODE_SML_INVALID_DATA; } if (unlikely(IS_EQUAL(*sql,escapeChar))) { @@ -363,7 +363,7 @@ static int32_t smlParseColLine(SSmlHandle *info, char **sql, char *sqlEnd, SSmlL } if (unlikely(IS_INVALID_COL_LEN(keyLen - keyLenEscaped))) { - smlBuildInvalidDataMsg(&info->msgBuf, "invalid key or key is too long than 64", key); + smlBuildInvalidDataMsg(&info->msgBuf, "SML line invalid key or key is too long than 64", key); return TSDB_CODE_TSC_INVALID_COLUMN_LENGTH; } @@ -397,18 +397,18 @@ static int32_t smlParseColLine(SSmlHandle *info, char **sql, char *sqlEnd, SSmlL valueLen = *sql - value; if (unlikely(quoteNum != 0 && quoteNum != 2)) { - smlBuildInvalidDataMsg(&info->msgBuf, "unbalanced quotes", value); + smlBuildInvalidDataMsg(&info->msgBuf, "SML line unbalanced quotes", value); return TSDB_CODE_SML_INVALID_DATA; } if (unlikely(valueLen == 0)) { - smlBuildInvalidDataMsg(&info->msgBuf, "invalid value", value); + smlBuildInvalidDataMsg(&info->msgBuf, "SML line invalid value", value); return TSDB_CODE_SML_INVALID_DATA; } SSmlKv kv = {.key = key, .keyLen = keyLen, .value = value, .length = valueLen}; int32_t ret = smlParseValue(&kv, &info->msgBuf); if (ret != TSDB_CODE_SUCCESS) { - smlBuildInvalidDataMsg(&info->msgBuf, "smlParseValue error", value); + uError("SML:0x%" PRIx64 " %s parse value error:%d.", info->id, __FUNCTION__, ret); return ret; } @@ -430,11 +430,6 @@ static int32_t smlParseColLine(SSmlHandle *info, char **sql, char *sqlEnd, SSmlL } (void)memcpy(tmp, kv.value, kv.length); PROCESS_SLASH_IN_FIELD_VALUE(tmp, kv.length); - if(kv.type == TSDB_DATA_TYPE_GEOMETRY) { - uError("SML:0x%" PRIx64 " smlParseColLine error, invalid GEOMETRY type.", info->id); - taosMemoryFree((void*)kv.value); - return TSDB_CODE_TSC_INVALID_VALUE; - } if(kv.type == TSDB_DATA_TYPE_VARBINARY){ taosMemoryFree((void*)kv.value); } @@ -503,7 +498,7 @@ int32_t smlParseInfluxString(SSmlHandle *info, char *sql, char *sqlEnd, SSmlLine } elements->measureLen = sql - elements->measure; if (unlikely(IS_INVALID_TABLE_LEN(elements->measureLen - measureLenEscaped))) { - smlBuildInvalidDataMsg(&info->msgBuf, "measure is empty or too large than 192", NULL); + smlBuildInvalidDataMsg(&info->msgBuf, "SML line measure is empty or too large than 192", NULL); return TSDB_CODE_TSC_INVALID_TABLE_ID_LENGTH; } @@ -550,7 +545,7 @@ int32_t smlParseInfluxString(SSmlHandle *info, char *sql, char *sqlEnd, SSmlLine elements->colsLen = sql - elements->cols; if (unlikely(elements->colsLen == 0)) { - smlBuildInvalidDataMsg(&info->msgBuf, "cols is empty", NULL); + smlBuildInvalidDataMsg(&info->msgBuf, "SML line cols is empty", NULL); return TSDB_CODE_SML_INVALID_DATA; } @@ -567,7 +562,7 @@ int32_t smlParseInfluxString(SSmlHandle *info, char *sql, char *sqlEnd, SSmlLine int64_t ts = smlParseInfluxTime(info, elements->timestamp, elements->timestampLen); if (unlikely(ts <= 0)) { - uError("SML:0x%" PRIx64 " smlParseTS error:%" PRId64, info->id, ts); + uError("SML:0x%" PRIx64 " %s error:%" PRId64, info->id, __FUNCTION__, ts); return TSDB_CODE_INVALID_TIMESTAMP; } diff --git a/source/client/src/clientSmlTelnet.c b/source/client/src/clientSmlTelnet.c index 4deb6a34cd4c..dd264da11e06 100644 --- a/source/client/src/clientSmlTelnet.c +++ b/source/client/src/clientSmlTelnet.c @@ -172,14 +172,14 @@ int32_t smlParseTelnetString(SSmlHandle *info, char *sql, char *sqlEnd, SSmlLine // parse metric smlParseTelnetElement(&sql, sqlEnd, &elements->measure, &elements->measureLen); if (unlikely((!(elements->measure) || IS_INVALID_TABLE_LEN(elements->measureLen)))) { - smlBuildInvalidDataMsg(&info->msgBuf, "invalid data", sql); + smlBuildInvalidDataMsg(&info->msgBuf, "SML telnet invalid measure", sql); return TSDB_CODE_TSC_INVALID_TABLE_ID_LENGTH; } // parse timestamp smlParseTelnetElement(&sql, sqlEnd, &elements->timestamp, &elements->timestampLen); if (unlikely(!elements->timestamp || elements->timestampLen == 0)) { - smlBuildInvalidDataMsg(&info->msgBuf, "invalid timestamp", sql); + smlBuildInvalidDataMsg(&info->msgBuf, "SML telnet invalid timestamp", sql); return TSDB_CODE_SML_INVALID_DATA; } @@ -189,19 +189,21 @@ int32_t smlParseTelnetString(SSmlHandle *info, char *sql, char *sqlEnd, SSmlLine } int64_t ts = smlParseOpenTsdbTime(info, elements->timestamp, elements->timestampLen); if (unlikely(ts < 0)) { - smlBuildInvalidDataMsg(&info->msgBuf, "invalid timestamp", sql); + smlBuildInvalidDataMsg(&info->msgBuf, "SML telnet parse timestamp failed", sql); return TSDB_CODE_INVALID_TIMESTAMP; } // parse value smlParseTelnetElement(&sql, sqlEnd, &elements->cols, &elements->colsLen); if (unlikely(!elements->cols || elements->colsLen == 0)) { - smlBuildInvalidDataMsg(&info->msgBuf, "invalid value", sql); + smlBuildInvalidDataMsg(&info->msgBuf, "SML telnet invalid value", sql); return TSDB_CODE_TSC_INVALID_VALUE; } SSmlKv kv = {.key = VALUE, .keyLen = VALUE_LEN, .value = elements->cols, .length = (size_t)elements->colsLen}; - if (smlParseValue(&kv, &info->msgBuf) != TSDB_CODE_SUCCESS) { + int ret = smlParseValue(&kv, &info->msgBuf); + if (ret != TSDB_CODE_SUCCESS) { + uError("SML:0x%" PRIx64 " %s parse value error:%d.", info->id, __FUNCTION__, ret); return TSDB_CODE_TSC_INVALID_VALUE; } @@ -210,11 +212,11 @@ int32_t smlParseTelnetString(SSmlHandle *info, char *sql, char *sqlEnd, SSmlLine elements->tags = sql; elements->tagsLen = sqlEnd - sql; if (unlikely(!elements->tags || elements->tagsLen == 0)) { - smlBuildInvalidDataMsg(&info->msgBuf, "invalid value", sql); + smlBuildInvalidDataMsg(&info->msgBuf, "SML telnet invalid tag value", sql); return TSDB_CODE_TSC_INVALID_VALUE; } - int ret = smlParseTelnetTags(info, sql, sqlEnd, elements); + ret = smlParseTelnetTags(info, sql, sqlEnd, elements); if (unlikely(ret != TSDB_CODE_SUCCESS)) { return ret; } diff --git a/source/client/test/smlTest.cpp b/source/client/test/smlTest.cpp index bcd12a393a48..338457bec457 100644 --- a/source/client/test/smlTest.cpp +++ b/source/client/test/smlTest.cpp @@ -68,6 +68,15 @@ TEST(testCase, smlParseInfluxString_Test) { taosArrayDestroy(elements.colArray); elements.colArray = nullptr; + // case 0 false + tmp = "st,t1=3 c3=\""; + (void)memcpy(sql, tmp, strlen(tmp) + 1); + (void)memset(&elements, 0, sizeof(SSmlLineInfo)); + ret = smlParseInfluxString(info, sql, sql + strlen(sql), &elements); + ASSERT_NE(ret, 0); + taosArrayDestroy(elements.colArray); + elements.colArray = nullptr; + // case 2 false tmp = "st,t1=3,t2=4,t3=t3 c1=3i64,c3=\"passit hello,c1=2,c2=false,c4=4f64 1626006833639000000"; (void)memcpy(sql, tmp, strlen(tmp) + 1); diff --git a/source/libs/parser/src/parInsertSml.c b/source/libs/parser/src/parInsertSml.c index b1ff8cb733de..b5cdf1e4ee20 100644 --- a/source/libs/parser/src/parInsertSml.c +++ b/source/libs/parser/src/parInsertSml.c @@ -472,7 +472,7 @@ int32_t smlInitHandle(SQuery** query) { int32_t code = nodesMakeNode(QUERY_NODE_QUERY, (SNode**)&pQuery); if (code != 0) { - uError("create pQuery error"); + uError("SML create pQuery error"); goto END; } pQuery->execMode = QUERY_EXEC_MODE_SCHEDULE; @@ -480,12 +480,12 @@ int32_t smlInitHandle(SQuery** query) { pQuery->msgType = TDMT_VND_SUBMIT; code = nodesMakeNode(QUERY_NODE_VNODE_MODIFY_STMT, (SNode**)&stmt); if (code != 0) { - uError("create SVnodeModifyOpStmt error"); + uError("SML create SVnodeModifyOpStmt error"); goto END; } stmt->pTableBlockHashObj = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), true, HASH_NO_LOCK); if (stmt->pTableBlockHashObj == NULL){ - uError("create pTableBlockHashObj error"); + uError("SML create pTableBlockHashObj error"); code = terrno; goto END; } diff --git a/utils/test/c/sml_test.c b/utils/test/c/sml_test.c index 6d4192280c28..a76dccbbc025 100644 --- a/utils/test/c/sml_test.c +++ b/utils/test/c/sml_test.c @@ -1882,6 +1882,20 @@ int sml_td24559_Test() { pRes = taos_query(taos, "create database if not exists td24559"); taos_free_result(pRes); + const char *sql1[] = { + "sttb,t1=1 f1=283i32,f2=g\"\" 1632299372000", + "sttb,t1=1 f2=G\"Point(4.343 89.342)\",f1=106i32 1632299373000", + }; + + pRes = taos_query(taos, "use td24559"); + taos_free_result(pRes); + + pRes = taos_schemaless_insert(taos, (char **)sql1, sizeof(sql1) / sizeof(sql1[0]), TSDB_SML_LINE_PROTOCOL, + TSDB_SML_TIMESTAMP_MILLI_SECONDS); + int code = taos_errno(pRes); + printf("%s result0:%s\n", __FUNCTION__, taos_errstr(pRes)); + ASSERT(code); + const char *sql[] = { "stb,t1=1 f1=283i32,f2=g\"Point(4.343 89.342)\" 1632299372000", "stb,t1=1 f2=G\"Point(4.343 89.342)\",f1=106i32 1632299373000", @@ -1895,7 +1909,7 @@ int sml_td24559_Test() { pRes = taos_schemaless_insert(taos, (char **)sql, sizeof(sql) / sizeof(sql[0]), TSDB_SML_LINE_PROTOCOL, TSDB_SML_TIMESTAMP_MILLI_SECONDS); - int code = taos_errno(pRes); + code = taos_errno(pRes); printf("%s result0:%s\n", __FUNCTION__, taos_errstr(pRes)); taos_free_result(pRes); @@ -2254,8 +2268,8 @@ int main(int argc, char *argv[]) { ASSERT(!ret); ret = sml_td18789_Test(); ASSERT(!ret); -// ret = sml_td24070_Test(); -// ASSERT(!ret); + ret = sml_td24070_Test(); + ASSERT(!ret); ret = sml_td23881_Test(); ASSERT(ret); ret = sml_escape_Test(); @@ -2264,8 +2278,8 @@ int main(int argc, char *argv[]) { ASSERT(!ret); ret = sml_ts3116_Test(); ASSERT(!ret); -// ret = sml_ts2385_Test(); // this test case need config sml table name using ./sml_test config_file -// ASSERT(!ret); + ret = sml_ts2385_Test(); // this test case need config sml table name using ./sml_test config_file + ASSERT(!ret); ret = sml_ts3303_Test(); ASSERT(!ret); ret = sml_ttl_Test(); From c148d0676bd6e9323941892c6278922fc77288ff Mon Sep 17 00:00:00 2001 From: dmchen Date: Thu, 24 Oct 2024 11:07:40 +0000 Subject: [PATCH 260/695] fix/TD-32621-remove-from-hash-when-creating-fail --- source/dnode/mgmt/mgmt_vnode/src/vmHandle.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c index 7e950ef1be13..f55cb648e084 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c @@ -436,6 +436,21 @@ int32_t vmProcessCreateVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) { _OVER: if (code != 0) { + int32_t r = 0; + r = taosThreadRwlockWrlock(&pMgmt->lock); + if (r != 0) { + dError("vgId:%d, failed to lock since %s", req.vgId, tstrerror(r)); + } + if (r == 0) { + r = taosHashRemove(pMgmt->hash, &pVnode->vgId, sizeof(int32_t)); + if (r != 0) { + dError("vgId:%d, failed to remove vnode since %s", req.vgId, tstrerror(r)); + } + } + r = taosThreadRwlockUnlock(&pMgmt->lock); + if (r != 0) { + dError("vgId:%d, failed to unlock since %s", req.vgId, tstrerror(r)); + } vnodeClose(pImpl); vnodeDestroy(0, path, pMgmt->pTfs, 0); } else { From 8c7c6945f27e77e2f0ec9d4f56daf26c55f98950 Mon Sep 17 00:00:00 2001 From: qevolg <2227465945@qq.com> Date: Thu, 24 Oct 2024 19:19:02 +0800 Subject: [PATCH 261/695] chore(.github): modify taoskeeper github action workflow --- .github/workflows/taoskeeper-ci.yml | 33 +++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/.github/workflows/taoskeeper-ci.yml b/.github/workflows/taoskeeper-ci.yml index 9ed23be1fa70..ea1cfd411f30 100644 --- a/.github/workflows/taoskeeper-ci.yml +++ b/.github/workflows/taoskeeper-ci.yml @@ -19,25 +19,40 @@ jobs: with: go-version: 1.18 - - name: Start TDengine + - name: Install system dependencies run: | - docker pull tdengine/tdengine:latest - docker run --name tdengine -d -p 6030:6030 -p 6041:6041 -p 6043-6060:6043-6060 -p 6043-6060:6043-6060/udp tdengine/tdengine + sudo apt update -y + sudo apt install -y build-essential cmake libgeos-dev - - name: Build taoskeeper - working-directory: tools/keeper + - name: Install TDengine run: | - go mod tidy - go build -v ./... + mkdir debug + cd debug + cmake .. -DBUILD_HTTP=false -DBUILD_JDBC=false -DBUILD_TOOLS=false -DBUILD_TEST=off -DBUILD_KEEPER=true + make -j 4 + sudo make install + which taosd + which taosadapter + which taoskeeper + + - name: Start taosd + run: | + cp /etc/taos/taos.cfg ./ + sudo echo "supportVnodes 256" >> taos.cfg + nohup sudo taosd -c taos.cfg & + + - name: Start taosadapter + run: nohup sudo taosadapter & - name: Run tests with coverage working-directory: tools/keeper run: | + go mod tidy sudo go test -v -coverpkg=./... -coverprofile=coverage.out ./... go tool cover -func=coverage.out - name: Clean up if: always() run: | - docker stop tdengine - docker rm tdengine + sudo pkill taosd + sudo pkill taosadapter From 5fe1217c090ffed645fa4f6674bbb224fcdc9400 Mon Sep 17 00:00:00 2001 From: qevolg <2227465945@qq.com> Date: Thu, 24 Oct 2024 19:19:27 +0800 Subject: [PATCH 262/695] test(keeper/api): trigger taoskeeper ci --- tools/keeper/api/adapter2_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/keeper/api/adapter2_test.go b/tools/keeper/api/adapter2_test.go index e6fd263c43fa..5456dfeecf1a 100644 --- a/tools/keeper/api/adapter2_test.go +++ b/tools/keeper/api/adapter2_test.go @@ -14,6 +14,7 @@ import ( ) func TestAdapter2(t *testing.T) { + // c := &config.Config{ InstanceID: 64, Port: 6043, From c590377bee0342e97f44e92a120bb69ce7c088da Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Thu, 24 Oct 2024 19:29:14 +0800 Subject: [PATCH 263/695] merge 3.0 --- source/libs/executor/src/streamtimesliceoperator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/executor/src/streamtimesliceoperator.c b/source/libs/executor/src/streamtimesliceoperator.c index b52961c32dbf..488f84aae0c9 100644 --- a/source/libs/executor/src/streamtimesliceoperator.c +++ b/source/libs/executor/src/streamtimesliceoperator.c @@ -287,7 +287,7 @@ static int32_t initTimeSliceFillSup(SStreamInterpFuncPhysiNode* pPhyFillNode, SE pFillSup->numOfFillCols = numOfExprs; int32_t numOfNotFillCols = 0; - pFillSup->pAllColInfo = createFillColInfo(pExprSup->pExprInfo, pFillSup->numOfFillCols, NULL, numOfNotFillCols, + pFillSup->pAllColInfo = createFillColInfo(pExprSup->pExprInfo, pFillSup->numOfFillCols, NULL, numOfNotFillCols, NULL, 0, (const SNodeListNode*)(pPhyFillNode->pFillValues)); QUERY_CHECK_NULL(pFillSup->pAllColInfo, code, lino, _end, terrno); From 5c1d2e429c768e1fc89e1d09c80b71ce5d75ba4b Mon Sep 17 00:00:00 2001 From: qevolg <2227465945@qq.com> Date: Thu, 24 Oct 2024 19:37:41 +0800 Subject: [PATCH 264/695] chore(.github): modify taoskeeper github action workflow --- .github/workflows/taoskeeper-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/taoskeeper-ci.yml b/.github/workflows/taoskeeper-ci.yml index ea1cfd411f30..9d177f641c88 100644 --- a/.github/workflows/taoskeeper-ci.yml +++ b/.github/workflows/taoskeeper-ci.yml @@ -48,7 +48,7 @@ jobs: working-directory: tools/keeper run: | go mod tidy - sudo go test -v -coverpkg=./... -coverprofile=coverage.out ./... + go test -v -coverpkg=./... -coverprofile=coverage.out ./... go tool cover -func=coverage.out - name: Clean up From 1de02f9fe2a7bd0f91cabc00cf83c35df49cc051 Mon Sep 17 00:00:00 2001 From: qevolg <2227465945@qq.com> Date: Thu, 24 Oct 2024 19:37:55 +0800 Subject: [PATCH 265/695] test(keeper/api): trigger taoskeeper ci --- tools/keeper/api/adapter2_test.go | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/keeper/api/adapter2_test.go b/tools/keeper/api/adapter2_test.go index 5456dfeecf1a..e6fd263c43fa 100644 --- a/tools/keeper/api/adapter2_test.go +++ b/tools/keeper/api/adapter2_test.go @@ -14,7 +14,6 @@ import ( ) func TestAdapter2(t *testing.T) { - // c := &config.Config{ InstanceID: 64, Port: 6043, From 6960a34cfbea562e98aaad277c0ffa003770423a Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Thu, 24 Oct 2024 19:52:39 +0800 Subject: [PATCH 266/695] enh:[TD-32166]refactor code in sml --- source/client/src/clientSml.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/client/src/clientSml.c b/source/client/src/clientSml.c index f9ba8531f41a..82e58f1467a6 100644 --- a/source/client/src/clientSml.c +++ b/source/client/src/clientSml.c @@ -698,8 +698,8 @@ static int32_t smlGenerateSchemaAction(SSchema *colField, SHashObj *colHash, SSm uint16_t *index = colHash ? (uint16_t *)taosHashGet(colHash, kv->key, kv->keyLen) : NULL; if (index) { if (colField[*index].type != kv->type) { - snprintf(info->msgBuf.buf, info->msgBuf.len, "SML:0x%" PRIx64 " %s point type and db type mismatch. db type: %d, point type: %d, key: %s", - info->id, __FUNCTION__, colField[*index].type, kv->type, kv->key); + snprintf(info->msgBuf.buf, info->msgBuf.len, "SML:0x%" PRIx64 " %s point type and db type mismatch. db type: %s, point type: %s, key: %s", + info->id, __FUNCTION__, tDataTypes[colField[*index].type].name, tDataTypes[kv->type].name, kv->key); uError("%s", info->msgBuf.buf); return TSDB_CODE_SML_INVALID_DATA; } From b5e6c557497669a611a5803c0e9a33074ca2fd2c Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Thu, 24 Oct 2024 19:55:26 +0800 Subject: [PATCH 267/695] feat: auto append end char ; to command --- tools/shell/src/shellAuto.c | 119 ++++++++++++++++++++---------------- 1 file changed, 67 insertions(+), 52 deletions(-) diff --git a/tools/shell/src/shellAuto.c b/tools/shell/src/shellAuto.c index 9e6b0fe79e32..a12efb7e962d 100644 --- a/tools/shell/src/shellAuto.c +++ b/tools/shell/src/shellAuto.c @@ -46,6 +46,7 @@ typedef struct SWord { int32_t len; struct SWord* next; bool free; // if true need free + bool end; // if true is last keyword } SWord; typedef struct { @@ -95,62 +96,62 @@ SWords shellCommands[] = { " ;", 0, 0, NULL}, {"create dnode ", 0, 0, NULL}, {"create index on ()", 0, 0, NULL}, - {"create mnode on dnode ;", 0, 0, NULL}, - {"create qnode on dnode ;", 0, 0, NULL}, + {"create mnode on dnode ;", 0, 0, NULL}, + {"create qnode on dnode ;", 0, 0, NULL}, {"create stream into as select", 0, 0, NULL}, // 26 append sub sql {"create topic as select", 0, 0, NULL}, // 27 append sub sql {"create tsma on function", 0, 0, NULL}, {"create recursive tsma on interval(", 0, 0, NULL}, - {"create function as outputtype language ", 0, 0, NULL}, - {"create or replace as outputtype language ", 0, 0, NULL}, - {"create aggregate function as outputtype bufsize language ", 0, 0, NULL}, - {"create or replace aggregate function as outputtype bufsize language ", 0, 0, NULL}, + {"create function as outputtype language ;", 0, 0, NULL}, + {"create or replace as outputtype language ;", 0, 0, NULL}, + {"create aggregate function as outputtype bufsize language ;", 0, 0, NULL}, + {"create or replace aggregate function as outputtype bufsize language ;", 0, 0, NULL}, {"create user pass sysinfo 0;", 0, 0, NULL}, {"create user pass sysinfo 1;", 0, 0, NULL}, #ifdef TD_ENTERPRISE {"create view as select", 0, 0, NULL}, {"compact database ", 0, 0, NULL}, #endif - {"describe ", 0, 0, NULL}, + {"describe ;", 0, 0, NULL}, {"delete from where ", 0, 0, NULL}, - {"drop database ", 0, 0, NULL}, - {"drop index ", 0, 0, NULL}, - {"drop table ", 0, 0, NULL}, - {"drop dnode ", 0, 0, NULL}, - {"drop mnode on dnode ;", 0, 0, NULL}, - {"drop qnode on dnode ;", 0, 0, NULL}, - {"drop user ;", 0, 0, NULL}, + {"drop database ;", 0, 0, NULL}, + {"drop index ;", 0, 0, NULL}, + {"drop table ;", 0, 0, NULL}, + {"drop dnode ;", 0, 0, NULL}, + {"drop mnode on dnode ;", 0, 0, NULL}, + {"drop qnode on dnode ;", 0, 0, NULL}, + {"drop user ;", 0, 0, NULL}, // 40 - {"drop function ;", 0, 0, NULL}, + {"drop function ;", 0, 0, NULL}, {"drop consumer group on ", 0, 0, NULL}, - {"drop topic ;", 0, 0, NULL}, - {"drop stream ;", 0, 0, NULL}, - {"drop tsma ;", 0, 0, NULL}, - {"explain select", 0, 0, NULL}, // 44 append sub sql - {"flush database ;", 0, 0, NULL}, + {"drop topic ;", 0, 0, NULL}, + {"drop stream ;", 0, 0, NULL}, + {"drop tsma ;", 0, 0, NULL}, + {"explain select ", 0, 0, NULL}, // 44 append sub sql + {"flush database ;", 0, 0, NULL}, {"help;", 0, 0, NULL}, - {"grant all on to ;", 0, 0, NULL}, - {"grant read on to ;", 0, 0, NULL}, - {"grant write on to ;", 0, 0, NULL}, - {"kill connection ;", 0, 0, NULL}, + {"grant all on to ;", 0, 0, NULL}, + {"grant read on to ;", 0, 0, NULL}, + {"grant write on to ;", 0, 0, NULL}, + {"kill connection ;", 0, 0, NULL}, {"kill query ", 0, 0, NULL}, {"kill transaction ", 0, 0, NULL}, #ifdef TD_ENTERPRISE - {"merge vgroup ", 0, 0, NULL}, + {"merge vgroup ;", 0, 0, NULL}, #endif - {"pause stream ;", 0, 0, NULL}, + {"pause stream ;", 0, 0, NULL}, #ifdef TD_ENTERPRISE - {"redistribute vgroup dnode ;", 0, 0, NULL}, + {"redistribute vgroup dnode ;", 0, 0, NULL}, #endif - {"resume stream ;", 0, 0, NULL}, + {"resume stream ;", 0, 0, NULL}, {"reset query cache;", 0, 0, NULL}, - {"restore dnode ;", 0, 0, NULL}, - {"restore vnode on dnode ;", 0, 0, NULL}, - {"restore mnode on dnode ;", 0, 0, NULL}, - {"restore qnode on dnode ;", 0, 0, NULL}, - {"revoke all on from ;", 0, 0, NULL}, - {"revoke read on from ;", 0, 0, NULL}, - {"revoke write on from ;", 0, 0, NULL}, + {"restore dnode ;", 0, 0, NULL}, + {"restore vnode on dnode ;", 0, 0, NULL}, + {"restore mnode on dnode ;", 0, 0, NULL}, + {"restore qnode on dnode ;", 0, 0, NULL}, + {"revoke all on from ;", 0, 0, NULL}, + {"revoke read on from ;", 0, 0, NULL}, + {"revoke write on from ;", 0, 0, NULL}, {"select * from ", 0, 0, NULL}, {"select client_version();", 0, 0, NULL}, // 60 @@ -163,6 +164,7 @@ SWords shellCommands[] = { {"select timezone();", 0, 0, NULL}, {"set max_binary_display_width ", 0, 0, NULL}, {"show apps;", 0, 0, NULL}, + {"show alive;", 0, 0, NULL}, {"show create database \\G;", 0, 0, NULL}, {"show create stable \\G;", 0, 0, NULL}, {"show create table \\G;", 0, 0, NULL}, @@ -195,10 +197,9 @@ SWords shellCommands[] = { {"show subscriptions;", 0, 0, NULL}, {"show tables;", 0, 0, NULL}, {"show tables like", 0, 0, NULL}, - {"show table distributed ", 0, 0, NULL}, - {"show tags from ", 0, 0, NULL}, - {"show tags from ", 0, 0, NULL}, - {"show table tags from ", 0, 0, NULL}, + {"show table distributed ;", 0, 0, NULL}, + {"show tags from ;", 0, 0, NULL}, + {"show table tags from ;", 0, 0, NULL}, {"show topics;", 0, 0, NULL}, {"show transactions;", 0, 0, NULL}, {"show tsmas;", 0, 0, NULL}, @@ -206,7 +207,7 @@ SWords shellCommands[] = { {"show variables;", 0, 0, NULL}, {"show local variables;", 0, 0, NULL}, {"show vnodes;", 0, 0, NULL}, - {"show vnodes on dnode ;", 0, 0, NULL}, + {"show vnodes on dnode ;", 0, 0, NULL}, {"show vgroups;", 0, 0, NULL}, {"show consumers;", 0, 0, NULL}, {"show grants;", 0, 0, NULL}, @@ -215,15 +216,15 @@ SWords shellCommands[] = { #ifdef TD_ENTERPRISE {"show views;", 0, 0, NULL}, {"show arbgroups;", 0, 0, NULL}, - {"split vgroup ", 0, 0, NULL}, - {"s3migrate database ", 0, 0, NULL}, + {"split vgroup ;", 0, 0, NULL}, + {"s3migrate database ;", 0, 0, NULL}, #endif {"insert into values(", 0, 0, NULL}, {"insert into using tags(", 0, 0, NULL}, {"insert into using values(", 0, 0, NULL}, {"insert into file ", 0, 0, NULL}, - {"trim database ", 0, 0, NULL}, - {"use ", 0, 0, NULL}, + {"trim database ;", 0, 0, NULL}, + {"use ;", 0, 0, NULL}, {"quit", 0, 0, NULL}}; // where keyword @@ -362,7 +363,8 @@ char* field_options[] = { // global keys can tips on anywhere char* global_keys[] = { "tbname", - "now", + "now", + "vgroups", "_wstart", "_wend", "_wduration", @@ -581,6 +583,7 @@ void showHelp() { select timezone();\n\ set max_binary_display_width ...\n\ show apps;\n\ + show alive;\n\ show create database ;\n\ show create stable ;\n\ show create table ;\n\ @@ -698,7 +701,12 @@ SWord* addWord(const char* p, int32_t len, bool pattern) { // check format if (pattern && len > 0) { - word->type = wordType(p, len); + if (p[len-1] == ';') { + word->type = wordType(p, len - 1); + word->end = true; + } else { + word->type = wordType(p, len); + } } else { word->type = WT_TEXT; } @@ -1304,10 +1312,10 @@ void printScreen(TAOS* con, SShellCmd* cmd, SWords* match) { // first tab press const char* str = NULL; int strLen = 0; - + + SWord* word = MATCH_WORD(match); if (firstMatchIndex == curMatchIndex && lastWordBytes == -1) { // first press tab - SWord* word = MATCH_WORD(match); str = word->word + match->matchLen; strLen = word->len - match->matchLen; lastMatchIndex = firstMatchIndex; @@ -1315,8 +1323,6 @@ void printScreen(TAOS* con, SShellCmd* cmd, SWords* match) { } else { if (lastWordBytes == -1) return; deleteCount(cmd, lastWordBytes); - - SWord* word = MATCH_WORD(match); str = word->word; strLen = word->len; // set current to last @@ -1324,8 +1330,17 @@ void printScreen(TAOS* con, SShellCmd* cmd, SWords* match) { lastWordBytes = word->len; } - // insert new - shellInsertStr(cmd, (char*)str, strLen); + if (word->end) { + // append end ';' + char *p = taosMemoryMalloc(strLen + 8); + strcpy(p, str); + strcat(p, ";"); + shellInsertStr(cmd, (char *)p, strLen + 1); + taosMemoryFree(p); + } else { + // insert new + shellInsertStr(cmd, (char *)str, strLen); + } } // main key press tab , matched return true else false From b7c793050973413640aa366b0ab29071c3afd098 Mon Sep 17 00:00:00 2001 From: qevolg <2227465945@qq.com> Date: Thu, 24 Oct 2024 20:00:13 +0800 Subject: [PATCH 268/695] chore(.github): modify taoskeeper github action workflow --- .github/workflows/taoskeeper-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/taoskeeper-ci.yml b/.github/workflows/taoskeeper-ci.yml index 9d177f641c88..87b893666ca6 100644 --- a/.github/workflows/taoskeeper-ci.yml +++ b/.github/workflows/taoskeeper-ci.yml @@ -54,5 +54,5 @@ jobs: - name: Clean up if: always() run: | - sudo pkill taosd - sudo pkill taosadapter + if pgrep taosd; then sudo pkill taosd; fi + if pgrep taosadapter; then sudo pkill taosadapter; fi From a57ef351375c5c133e7bf4f8ad9b97ef60fc9ee9 Mon Sep 17 00:00:00 2001 From: qevolg <2227465945@qq.com> Date: Thu, 24 Oct 2024 20:00:29 +0800 Subject: [PATCH 269/695] test(keeper/api): trigger taoskeeper ci --- tools/keeper/api/adapter2_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/keeper/api/adapter2_test.go b/tools/keeper/api/adapter2_test.go index e6fd263c43fa..5456dfeecf1a 100644 --- a/tools/keeper/api/adapter2_test.go +++ b/tools/keeper/api/adapter2_test.go @@ -14,6 +14,7 @@ import ( ) func TestAdapter2(t *testing.T) { + // c := &config.Config{ InstanceID: 64, Port: 6043, From 08ec37e2cc2cd7514245ccc2be5fda4759e11d35 Mon Sep 17 00:00:00 2001 From: qevolg <2227465945@qq.com> Date: Thu, 24 Oct 2024 20:00:57 +0800 Subject: [PATCH 270/695] test(keeper/api): trigger taoskeeper ci --- tools/keeper/api/adapter2_test.go | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/keeper/api/adapter2_test.go b/tools/keeper/api/adapter2_test.go index 5456dfeecf1a..e6fd263c43fa 100644 --- a/tools/keeper/api/adapter2_test.go +++ b/tools/keeper/api/adapter2_test.go @@ -14,7 +14,6 @@ import ( ) func TestAdapter2(t *testing.T) { - // c := &config.Config{ InstanceID: 64, Port: 6043, From bd81eeccd09b66ef0d60cae7a1b80b5be8c6e3f8 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Thu, 24 Oct 2024 23:54:12 +0800 Subject: [PATCH 271/695] enh:[TD-32166]refactor code in sml --- utils/test/c/sml_test.c | 1 + 1 file changed, 1 insertion(+) diff --git a/utils/test/c/sml_test.c b/utils/test/c/sml_test.c index a76dccbbc025..3387447059c9 100644 --- a/utils/test/c/sml_test.c +++ b/utils/test/c/sml_test.c @@ -1895,6 +1895,7 @@ int sml_td24559_Test() { int code = taos_errno(pRes); printf("%s result0:%s\n", __FUNCTION__, taos_errstr(pRes)); ASSERT(code); + taos_free_result(pRes); const char *sql[] = { "stb,t1=1 f1=283i32,f2=g\"Point(4.343 89.342)\" 1632299372000", From 68f651a92f8caa674ee7c33fc35ceebf0ae6122c Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Fri, 25 Oct 2024 08:37:20 +0800 Subject: [PATCH 272/695] az/object to file: static impl func --- source/libs/azure/src/az.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/azure/src/az.cpp b/source/libs/azure/src/az.cpp index 5989a7c333cb..5f95624c940d 100644 --- a/source/libs/azure/src/az.cpp +++ b/source/libs/azure/src/az.cpp @@ -416,7 +416,7 @@ int32_t azPutObjectFromFile2(const char *file, const char *object, int8_t withcp return 0; } -int32_t azGetObjectToFileImpl(const char *object_name, const char *fileName) { +static int32_t azGetObjectToFileImpl(const char *object_name, const char *fileName) { int32_t code = TSDB_CODE_SUCCESS; std::string accountName = tsS3AccessKeyId[0]; std::string accountKey = tsS3AccessKeySecret[0]; From c31eadea217db12c921b9a3500e952a0e49545a8 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Fri, 25 Oct 2024 08:42:14 +0800 Subject: [PATCH 273/695] fix: request subplan number setting issue --- source/client/src/clientImpl.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index c55764aaf4e3..ac164dc48471 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -1293,7 +1293,7 @@ void launchQueryImpl(SRequestObj* pRequest, SQuery* pQuery, bool keepQuery, void SQueryPlan* pDag = NULL; code = getPlan(pRequest, pQuery, &pDag, pMnodeList); if (TSDB_CODE_SUCCESS == code) { - subplanNum = pDag->numOfSubplans; + pRequest->body.subplanNum = pDag->numOfSubplans; if (!pRequest->validateOnly) { SArray* pNodeList = NULL; code = buildSyncExecNodeList(pRequest, &pNodeList, pMnodeList); @@ -1302,10 +1302,6 @@ void launchQueryImpl(SRequestObj* pRequest, SQuery* pQuery, bool keepQuery, void } taosArrayDestroy(pNodeList); } - - if (TSDB_CODE_SUCCESS == code) { - pRequest->body.subplanNum = subplanNum; - } } taosArrayDestroy(pMnodeList); break; @@ -1348,7 +1344,6 @@ static int32_t asyncExecSchQuery(SRequestObj* pRequest, SQuery* pQuery, SMetaDat pRequest->type = pQuery->msgType; SArray* pMnodeList = NULL; SQueryPlan* pDag = NULL; - int32_t subplanNum = 0; int64_t st = taosGetTimestampUs(); if (!pRequest->parseOnly) { @@ -1375,7 +1370,7 @@ static int32_t asyncExecSchQuery(SRequestObj* pRequest, SQuery* pQuery, SMetaDat tscError("0x%" PRIx64 " failed to create query plan, code:%s 0x%" PRIx64, pRequest->self, tstrerror(code), pRequest->requestId); } else { - subplanNum = pDag->numOfSubplans; + pRequest->body.subplanNum = pDag->numOfSubplans; TSWAP(pRequest->pPostPlan, pDag->pPostPlan); } } @@ -1412,9 +1407,7 @@ static int32_t asyncExecSchQuery(SRequestObj* pRequest, SQuery* pQuery, SMetaDat if (TSDB_CODE_SUCCESS == code) { code = schedulerExecJob(&req, &pRequest->body.queryJob); } - if (TSDB_CODE_SUCCESS == code) { - pRequest->body.subplanNum = subplanNum; - } + taosArrayDestroy(pNodeList); } else { qDestroyQueryPlan(pDag); From a062a0cb8453037b3924cf7a04760a44f742a93d Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Fri, 25 Oct 2024 09:41:35 +0800 Subject: [PATCH 274/695] enh:[TD-32166]refactor code in sml --- source/client/src/clientSml.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/client/src/clientSml.c b/source/client/src/clientSml.c index 82e58f1467a6..9d3b28e10578 100644 --- a/source/client/src/clientSml.c +++ b/source/client/src/clientSml.c @@ -1851,7 +1851,7 @@ TAOS_RES *taos_schemaless_insert_inner(TAOS *taos, char *lines[], char *rawLine, TAOS_RES *taos_schemaless_insert_ttl_with_reqid_tbname_key(TAOS *taos, char *lines[], int numLines, int protocol, int precision, int32_t ttl, int64_t reqid, char *tbnameKey) { - if (taos == NULL || lines == NULL || numLines <= 0) { + if (taos == NULL || lines == NULL || numLines < 0) { terrno = TSDB_CODE_INVALID_PARA; return NULL; } @@ -1901,7 +1901,7 @@ static int32_t getRawLineLen(char *lines, int len, int protocol) { TAOS_RES *taos_schemaless_insert_raw_ttl_with_reqid_tbname_key(TAOS *taos, char *lines, int len, int32_t *totalRows, int protocol, int precision, int32_t ttl, int64_t reqid, char *tbnameKey) { - if (taos == NULL || lines == NULL || len <= 0) { + if (taos == NULL || lines == NULL || len < 0) { terrno = TSDB_CODE_INVALID_PARA; return NULL; } From de31de5d11940a3b9cae0e9b96607bda67177241 Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Fri, 25 Oct 2024 09:59:30 +0800 Subject: [PATCH 275/695] fix: parse blank count error --- tools/shell/src/shellAuto.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tools/shell/src/shellAuto.c b/tools/shell/src/shellAuto.c index a12efb7e962d..05a996dafc32 100644 --- a/tools/shell/src/shellAuto.c +++ b/tools/shell/src/shellAuto.c @@ -1731,13 +1731,19 @@ bool fieldOptionsArea(char* p) { int32_t cnt = 0; while(p2) { p2 = strchr(p2, ' '); - if(p2) { - cnt ++; + if (p2) { + if ((p2 - 1)[0] != ',') { + // blank if before comma, not calc count. like st(ts timestamp, age int + BLANK + TAB only two blank + cnt ++; + } + + // continue blank is one blank while (p2[1] != 0 && p2[1] == ' ') { // move next if blank again p2 += 1; } - } + p2 += 1; + } } // like create table st(ts timestamp TAB-KEY or st(ts timestamp , age int TAB-KEY From 48444f2aca16f9efd778f6e2c29595c0ce933866 Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Fri, 25 Oct 2024 10:16:10 +0800 Subject: [PATCH 276/695] fix: compress and encode algo add single quotes --- tools/shell/src/shellAuto.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/shell/src/shellAuto.c b/tools/shell/src/shellAuto.c index 05a996dafc32..b8d346f34ff5 100644 --- a/tools/shell/src/shellAuto.c +++ b/tools/shell/src/shellAuto.c @@ -353,9 +353,9 @@ char* udf_language[] = {"\'Python\'", "\'C\'"}; char* field_options[] = { "encode ", "compress ", "level ", - "lz4 ", "zlib ", "zstd ", "xz ", "tsz ", "disabled ", // compress - "simple8b ", "delta-i ", "delta-d ", "bit-packing ", - "high ", "medium ", "low ", + "\'lz4\' ", "\'zlib\' ", "\'zstd\' ", "\'xz\' ", "\'tsz\' ", "\'disabled\' ", // compress + "\'simple8b\' ", "\'delta-i\' ", "\'delta-d\' ", "\'bit-packing\' ", + "\'high\' ", "\'medium\' ", "\'low\' ", "comment ", "primary key " }; From b50a89804f4ce4400297bf4a3268c28e8643eed8 Mon Sep 17 00:00:00 2001 From: xsren <285808407@qq.com> Date: Fri, 25 Oct 2024 10:16:28 +0800 Subject: [PATCH 277/695] fix: reserve check --- source/common/src/tdatablock.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c index 9240e18700be..d59c9252f328 100644 --- a/source/common/src/tdatablock.c +++ b/source/common/src/tdatablock.c @@ -3541,9 +3541,10 @@ int32_t blockDataCheck(const SSDataBlock* pDataBlock) { int32_t colNum = taosArrayGetSize(pDataBlock->pDataBlock); for (int32_t i = 0; i < colNum; ++i) { SColumnInfoData* pCol = (SColumnInfoData*)taosArrayGet(pDataBlock->pDataBlock, i); + BLOCK_DATA_CHECK_TRESSA(pCol != NULL); isVarType = IS_VAR_DATA_TYPE(pCol->info.type); checkRows = pDataBlock->info.rows; - if (pCol->info.reserve == true) continue; + if (pCol->info.reserve == false) continue; if (isVarType) { BLOCK_DATA_CHECK_TRESSA(pCol->varmeta.offset); From 3795f9cd137036673345be598b2cebae1b38fea1 Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Fri, 25 Oct 2024 10:26:15 +0800 Subject: [PATCH 278/695] fix(vnode/commit): fix sync commit log output --- source/dnode/vnode/src/vnd/vnodeCommit.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source/dnode/vnode/src/vnd/vnodeCommit.c b/source/dnode/vnode/src/vnd/vnodeCommit.c index dae2b3a5eca6..3ebcf50858be 100644 --- a/source/dnode/vnode/src/vnd/vnodeCommit.c +++ b/source/dnode/vnode/src/vnd/vnodeCommit.c @@ -409,7 +409,12 @@ int32_t vnodeSyncCommit(SVnode *pVnode) { vnodeAWait(&pVnode->commitTask); _exit: - vError("vgId:%d, %s failed at line %d since %s", TD_VID(pVnode), __func__, lino, tstrerror(code)); + if (code) { + vError("vgId:%d, %s failed at line %d since %s", TD_VID(pVnode), __func__, lino, tstrerror(code)); + } else { + vInfo("vgId:%d, sync commit end", TD_VID(pVnode)); + } + return code; } From 1b2ac1e5376c0b1512a890f2e1df6f1f7642a690 Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Fri, 25 Oct 2024 10:44:23 +0800 Subject: [PATCH 279/695] fix: create talbe fields area support blank on left bracket --- tools/shell/src/shellAuto.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/shell/src/shellAuto.c b/tools/shell/src/shellAuto.c index b8d346f34ff5..89d882d52b25 100644 --- a/tools/shell/src/shellAuto.c +++ b/tools/shell/src/shellAuto.c @@ -1732,7 +1732,9 @@ bool fieldOptionsArea(char* p) { while(p2) { p2 = strchr(p2, ' '); if (p2) { - if ((p2 - 1)[0] != ',') { + // get prev char + char prec = *(p2 - 1); + if (prec != ',' && prec != '(') { // blank if before comma, not calc count. like st(ts timestamp, age int + BLANK + TAB only two blank cnt ++; } From 9f69124708398a0231f1ef2914c03c4cb5195e26 Mon Sep 17 00:00:00 2001 From: dmchen Date: Fri, 25 Oct 2024 02:53:48 +0000 Subject: [PATCH 280/695] fix/TD-32622-add-closed-hash --- source/dnode/mgmt/mgmt_vnode/inc/vmInt.h | 2 + source/dnode/mgmt/mgmt_vnode/src/vmFile.c | 50 ++++++++++++++++++- source/dnode/mgmt/mgmt_vnode/src/vmInt.c | 58 ++++++++++++++++++++++- source/dnode/mnode/sdb/src/sdbFile.c | 11 +++-- 4 files changed, 113 insertions(+), 8 deletions(-) diff --git a/source/dnode/mgmt/mgmt_vnode/inc/vmInt.h b/source/dnode/mgmt/mgmt_vnode/inc/vmInt.h index 0e1a4bc98e2b..5bf151fcedde 100644 --- a/source/dnode/mgmt/mgmt_vnode/inc/vmInt.h +++ b/source/dnode/mgmt/mgmt_vnode/inc/vmInt.h @@ -36,6 +36,7 @@ typedef struct SVnodeMgmt { SSingleWorker mgmtWorker; SSingleWorker mgmtMultiWorker; SHashObj *hash; + SHashObj *closedHash; TdThreadRwlock lock; SVnodesStat state; STfs *pTfs; @@ -111,6 +112,7 @@ int32_t vmProcessArbHeartBeatReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg); int32_t vmGetVnodeListFromFile(SVnodeMgmt *pMgmt, SWrapperCfg **ppCfgs, int32_t *numOfVnodes); int32_t vmWriteVnodeListToFile(SVnodeMgmt *pMgmt); int32_t vmGetVnodeListFromHash(SVnodeMgmt *pMgmt, int32_t *numOfVnodes, SVnodeObj ***ppVnodes); +int32_t vmGetAllVnodeListFromHash(SVnodeMgmt *pMgmt, int32_t *numOfVnodes, SVnodeObj ***ppVnodes); // vmWorker.c int32_t vmStartWorker(SVnodeMgmt *pMgmt); diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmFile.c b/source/dnode/mgmt/mgmt_vnode/src/vmFile.c index 215a0576185d..c3f103d45c61 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmFile.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmFile.c @@ -19,6 +19,54 @@ #define MAX_CONTENT_LEN 2 * 1024 * 1024 +int32_t vmGetAllVnodeListFromHash(SVnodeMgmt *pMgmt, int32_t *numOfVnodes, SVnodeObj ***ppVnodes) { + (void)taosThreadRwlockRdlock(&pMgmt->lock); + + int32_t num = 0; + int32_t size = taosHashGetSize(pMgmt->hash); + int32_t closedSize = taosHashGetSize(pMgmt->closedHash); + size += closedSize; + SVnodeObj **pVnodes = taosMemoryCalloc(size, sizeof(SVnodeObj *)); + if (pVnodes == NULL) { + (void)taosThreadRwlockUnlock(&pMgmt->lock); + return terrno; + } + + void *pIter = taosHashIterate(pMgmt->hash, NULL); + while (pIter) { + SVnodeObj **ppVnode = pIter; + SVnodeObj *pVnode = *ppVnode; + if (pVnode && num < size) { + int32_t refCount = atomic_add_fetch_32(&pVnode->refCount, 1); + // dTrace("vgId:%d, acquire vnode list, ref:%d", pVnode->vgId, refCount); + pVnodes[num++] = (*ppVnode); + pIter = taosHashIterate(pMgmt->hash, pIter); + } else { + taosHashCancelIterate(pMgmt->hash, pIter); + } + } + + pIter = taosHashIterate(pMgmt->closedHash, NULL); + while (pIter) { + SVnodeObj **ppVnode = pIter; + SVnodeObj *pVnode = *ppVnode; + if (pVnode && num < size) { + int32_t refCount = atomic_add_fetch_32(&pVnode->refCount, 1); + // dTrace("vgId:%d, acquire vnode list, ref:%d", pVnode->vgId, refCount); + pVnodes[num++] = (*ppVnode); + pIter = taosHashIterate(pMgmt->closedHash, pIter); + } else { + taosHashCancelIterate(pMgmt->closedHash, pIter); + } + } + + (void)taosThreadRwlockUnlock(&pMgmt->lock); + *numOfVnodes = num; + *ppVnodes = pVnodes; + + return 0; +} + int32_t vmGetVnodeListFromHash(SVnodeMgmt *pMgmt, int32_t *numOfVnodes, SVnodeObj ***ppVnodes) { (void)taosThreadRwlockRdlock(&pMgmt->lock); @@ -216,7 +264,7 @@ int32_t vmWriteVnodeListToFile(SVnodeMgmt *pMgmt) { } int32_t numOfVnodes = 0; - TAOS_CHECK_GOTO(vmGetVnodeListFromHash(pMgmt, &numOfVnodes, &ppVnodes), &lino, _OVER); + TAOS_CHECK_GOTO(vmGetAllVnodeListFromHash(pMgmt, &numOfVnodes, &ppVnodes), &lino, _OVER); // terrno = TSDB_CODE_OUT_OF_MEMORY; pJson = tjsonCreateObject(); diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmInt.c b/source/dnode/mgmt/mgmt_vnode/src/vmInt.c index 20618dbdf386..55d42646d4eb 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmInt.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmInt.c @@ -166,10 +166,27 @@ int32_t vmOpenVnode(SVnodeMgmt *pMgmt, SWrapperCfg *pCfg, SVnode *pImpl) { (void)taosThreadRwlockWrlock(&pMgmt->lock); SVnodeObj *pOld = NULL; int32_t r = taosHashGetDup(pMgmt->hash, &pVnode->vgId, sizeof(int32_t), (void *)&pOld); + if (r != 0) { + dError("vgId:%d, failed to get vnode from hash", pVnode->vgId); + } if (pOld) { vmFreeVnodeObj(&pOld); } int32_t code = taosHashPut(pMgmt->hash, &pVnode->vgId, sizeof(int32_t), &pVnode, sizeof(SVnodeObj *)); + + pOld = NULL; + r = taosHashGetDup(pMgmt->closedHash, &pVnode->vgId, sizeof(int32_t), (void *)&pOld); + if (r != 0) { + dError("vgId:%d, failed to get vnode from closedHash", pVnode->vgId); + } + if (pOld) { + vmFreeVnodeObj(&pOld); + } + + r = taosHashRemove(pMgmt->closedHash, &pVnode->vgId, sizeof(int32_t)); + if (r != 0) { + dError("vgId:%d, failed to remove vnode from hash", pVnode->vgId); + } (void)taosThreadRwlockUnlock(&pMgmt->lock); return code; @@ -185,7 +202,33 @@ void vmCloseVnode(SVnodeMgmt *pMgmt, SVnodeObj *pVnode, bool commitAndRemoveWal) (void)taosThreadRwlockWrlock(&pMgmt->lock); int32_t r = taosHashRemove(pMgmt->hash, &pVnode->vgId, sizeof(int32_t)); + if (r != 0) { + dError("vgId:%d, failed to remove vnode from hash", pVnode->vgId); + } + + SVnodeObj *pClosedVnode = taosMemoryCalloc(1, sizeof(SVnodeObj)); + if (pVnode == NULL) { + dError("vgId:%d, failed to alloc vnode since %s", pVnode->vgId, terrstr()); + (void)taosThreadRwlockUnlock(&pMgmt->lock); + return; + } + + *pClosedVnode = *pVnode; + + SVnodeObj *pOld = NULL; + r = taosHashGetDup(pMgmt->closedHash, &pVnode->vgId, sizeof(int32_t), (void *)&pOld); + if (r != 0) { + dError("vgId:%d, failed to get vnode from closedHash", pVnode->vgId); + } + if (pOld) { + vmFreeVnodeObj(&pOld); + } + r = taosHashPut(pMgmt->closedHash, &pVnode->vgId, sizeof(int32_t), &pClosedVnode, sizeof(SVnodeObj *)); + if (r != 0) { + dError("vgId:%d, failed to put vnode to closedHash", pVnode->vgId); + } (void)taosThreadRwlockUnlock(&pMgmt->lock); + vmReleaseVnode(pMgmt, pVnode); if (pVnode->failed) { @@ -362,9 +405,15 @@ static void *vmOpenVnodeInThread(void *param) { static int32_t vmOpenVnodes(SVnodeMgmt *pMgmt) { pMgmt->hash = taosHashInit(TSDB_MIN_VNODES, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, HASH_ENTRY_LOCK); if (pMgmt->hash == NULL) { - terrno = TSDB_CODE_OUT_OF_MEMORY; dError("failed to init vnode hash since %s", terrstr()); - return -1; + return TSDB_CODE_OUT_OF_MEMORY; + } + + pMgmt->closedHash = + taosHashInit(TSDB_MIN_VNODES, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, HASH_ENTRY_LOCK); + if (pMgmt->hash == NULL) { + dError("failed to init vnode closed hash since %s", terrstr()); + return TSDB_CODE_OUT_OF_MEMORY; } SWrapperCfg *pCfgs = NULL; @@ -537,6 +586,11 @@ static void vmCloseVnodes(SVnodeMgmt *pMgmt) { pMgmt->hash = NULL; } + if (pMgmt->closedHash != NULL) { + taosHashCleanup(pMgmt->closedHash); + pMgmt->closedHash = NULL; + } + dInfo("total vnodes:%d are all closed", numOfVnodes); } diff --git a/source/dnode/mnode/sdb/src/sdbFile.c b/source/dnode/mnode/sdb/src/sdbFile.c index 227ff15da9c7..474b22cca014 100644 --- a/source/dnode/mnode/sdb/src/sdbFile.c +++ b/source/dnode/mnode/sdb/src/sdbFile.c @@ -400,8 +400,8 @@ static int32_t sdbReadFileImp(SSdb *pSdb) { pSdb->commitTerm = pSdb->applyTerm; pSdb->commitConfig = pSdb->applyConfig; memcpy(pSdb->tableVer, tableVer, sizeof(tableVer)); - mInfo("read sdb file:%s success, commit index:%" PRId64 " term:%" PRId64 " config:%" PRId64, file, pSdb->commitIndex, - pSdb->commitTerm, pSdb->commitConfig); + mInfo("vgId:1, trans:0, read sdb file:%s success, commit index:%" PRId64 " term:%" PRId64 " config:%" PRId64, file, + pSdb->commitIndex, pSdb->commitTerm, pSdb->commitConfig); _OVER: if ((ret = taosCloseFile(&pFile)) != 0) { @@ -573,7 +573,8 @@ static int32_t sdbWriteFileImp(SSdb *pSdb, int32_t skip_type) { pSdb->commitIndex = pSdb->applyIndex; pSdb->commitTerm = pSdb->applyTerm; pSdb->commitConfig = pSdb->applyConfig; - mInfo("write sdb file success, commit index:%" PRId64 " term:%" PRId64 " config:%" PRId64 " file:%s", + mInfo("vgId:1, trans:0, write sdb file success, commit index:%" PRId64 " term:%" PRId64 " config:%" PRId64 + " file:%s", pSdb->commitIndex, pSdb->commitTerm, pSdb->commitConfig, curfile); } @@ -610,8 +611,8 @@ int32_t sdbWriteFile(SSdb *pSdb, int32_t delta) { if (code != 0) { mError("failed to write sdb file since %s", tstrerror(code)); } else { - mInfo("write sdb file success, apply index:%" PRId64 " term:%" PRId64 " config:%" PRId64, pSdb->applyIndex, - pSdb->applyTerm, pSdb->applyConfig); + mInfo("vgId:1, trans:0, write sdb file success, apply index:%" PRId64 ", term:%" PRId64 ", config:%" PRId64, + pSdb->applyIndex, pSdb->applyTerm, pSdb->applyConfig); } (void)taosThreadMutexUnlock(&pSdb->filelock); return code; From 86dbba5c8cf2e39feaeb41e8eafd5e95c3568698 Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Fri, 25 Oct 2024 10:58:25 +0800 Subject: [PATCH 281/695] fix: create table tags area --- tools/shell/src/shellAuto.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/shell/src/shellAuto.c b/tools/shell/src/shellAuto.c index 89d882d52b25..defbf1cb824e 100644 --- a/tools/shell/src/shellAuto.c +++ b/tools/shell/src/shellAuto.c @@ -1722,6 +1722,11 @@ bool fieldOptionsArea(char* p) { return false; } + // find tags + if(strstr(p, " tags") != NULL) { + return false; + } + if(p2 == NULL) { // first field area p2 = p1; From 8c826bfc095797d0580ebc710e25be8a6021a0b1 Mon Sep 17 00:00:00 2001 From: qevolg <2227465945@qq.com> Date: Fri, 25 Oct 2024 10:58:57 +0800 Subject: [PATCH 282/695] style(cmake): format code --- cmake/cmake.define | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/cmake/cmake.define b/cmake/cmake.define index 4f12b15af07b..3fa99a7c9322 100644 --- a/cmake/cmake.define +++ b/cmake/cmake.define @@ -58,18 +58,18 @@ IF(TD_BUILD_HTTP) ADD_DEFINITIONS(-DHTTP_EMBEDDED) ENDIF() -IF ("${BUILD_KEEPER}" STREQUAL "") - SET(TD_BUILD_KEEPER FALSE) -ELSEIF (${BUILD_KEEPER} MATCHES "false") - SET(TD_BUILD_KEEPER FALSE) -ELSEIF (${BUILD_KEEPER} MATCHES "true") - SET(TD_BUILD_KEEPER TRUE) -ELSEIF (${BUILD_KEEPER} MATCHES "internal") - SET(TD_BUILD_KEEPER FALSE) - SET(TD_BUILD_KEEPER_INTERNAL TRUE) -ELSE () - SET(TD_BUILD_KEEPER FALSE) -ENDIF () +IF("${BUILD_KEEPER}" STREQUAL "") + SET(TD_BUILD_KEEPER FALSE) +ELSEIF(${BUILD_KEEPER} MATCHES "false") + SET(TD_BUILD_KEEPER FALSE) +ELSEIF(${BUILD_KEEPER} MATCHES "true") + SET(TD_BUILD_KEEPER TRUE) +ELSEIF(${BUILD_KEEPER} MATCHES "internal") + SET(TD_BUILD_KEEPER FALSE) + SET(TD_BUILD_KEEPER_INTERNAL TRUE) +ELSE() + SET(TD_BUILD_KEEPER FALSE) +ENDIF() IF("${BUILD_TOOLS}" STREQUAL "") IF(TD_LINUX) From 02295c407141183e91035738067077a441c20a15 Mon Sep 17 00:00:00 2001 From: Yu Chen <74105241+yu285@users.noreply.github.com> Date: Fri, 25 Oct 2024 10:59:25 +0800 Subject: [PATCH 283/695] docs:Update description of "numOfCommitThread" 01-taosd.md --- docs/zh/14-reference/01-components/01-taosd.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/zh/14-reference/01-components/01-taosd.md b/docs/zh/14-reference/01-components/01-taosd.md index fbf086bf6bc4..fdc7e241639a 100644 --- a/docs/zh/14-reference/01-components/01-taosd.md +++ b/docs/zh/14-reference/01-components/01-taosd.md @@ -163,7 +163,7 @@ charset 的有效值是 UTF-8。 | 参数名称 | 参数说明 | | :----------------: | :---------------------------------------------: | -| numOfCommitThreads | 写入线程的最大数量,取值范围 0-1024,缺省值为 4 | +| numOfCommitThreads | 落盘线程的最大数量,取值范围 0-1024,缺省值为 4 | ### 日志相关 @@ -458,4 +458,4 @@ TDengine 的日志文件主要包括普通日志和慢日志两种类型。 3. 多个客户端的日志存储在相应日志路径下的同一个 taosSlowLog.yyyy.mm.dd 文件里。 4. 慢日志文件不自动删除,不压缩。 5. 使用和普通日志文件相同的三个参数 logDir, minimalLogDirGB, asyncLog。另外两个参数 numOfLogLines,logKeepDays 不适用于慢日志。 - \ No newline at end of file + From 9d76aa91bc74faab85f827c8b5e5fa143497b0d9 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Fri, 25 Oct 2024 10:59:51 +0800 Subject: [PATCH 284/695] change transport log level --- source/libs/transport/inc/transComm.h | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/source/libs/transport/inc/transComm.h b/source/libs/transport/inc/transComm.h index 3a4f11ac81c2..d835d12c7915 100644 --- a/source/libs/transport/inc/transComm.h +++ b/source/libs/transport/inc/transComm.h @@ -278,19 +278,19 @@ bool transAsyncPoolIsEmpty(SAsyncPool* pool); } \ } while (0) -#define ASYNC_CHECK_HANDLE(idMgt, id, exh1) \ - do { \ - if (id > 0) { \ - SExHandle* exh2 = transAcquireExHandle(idMgt, id); \ - if (exh2 == NULL || exh1 != exh2 || (exh2 != NULL && exh2->refId != id)) { \ - tError("handle not match, exh1:%p, exh2:%p, refId:%"PRId64"", exh1, exh2, id); \ - code = TSDB_CODE_INVALID_MSG; \ - goto _return1; \ - } \ - } else { \ - tError("invalid handle to release"); \ - goto _return2; \ - } \ +#define ASYNC_CHECK_HANDLE(idMgt, id, exh1) \ + do { \ + if (id > 0) { \ + SExHandle* exh2 = transAcquireExHandle(idMgt, id); \ + if (exh2 == NULL || exh1 != exh2 || (exh2 != NULL && exh2->refId != id)) { \ + tDebug("handle not match, exh1:%p, exh2:%p, refId:%" PRId64 "", exh1, exh2, id); \ + code = TSDB_CODE_INVALID_MSG; \ + goto _return1; \ + } \ + } else { \ + tDebug("invalid handle to release"); \ + goto _return2; \ + } \ } while (0) int32_t transInitBuffer(SConnBuffer* buf); From 9f111b60ab37f7bee8d3599719db6b3efc815bdb Mon Sep 17 00:00:00 2001 From: dmchen Date: Fri, 25 Oct 2024 03:50:16 +0000 Subject: [PATCH 285/695] fix/TD-32622-add-closed-hash-fix-case --- source/dnode/mgmt/mgmt_vnode/src/vmInt.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmInt.c b/source/dnode/mgmt/mgmt_vnode/src/vmInt.c index 55d42646d4eb..0f27e04303ce 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmInt.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmInt.c @@ -586,6 +586,13 @@ static void vmCloseVnodes(SVnodeMgmt *pMgmt) { pMgmt->hash = NULL; } + void *pIter = taosHashIterate(pMgmt->closedHash, NULL); + while (pIter) { + SVnodeObj **ppVnode = pIter; + vmFreeVnodeObj(ppVnode); + pIter = taosHashIterate(pMgmt->closedHash, pIter); + } + if (pMgmt->closedHash != NULL) { taosHashCleanup(pMgmt->closedHash); pMgmt->closedHash = NULL; From 7a6c21814ebce207812d38c2cfb58687cdc8e66a Mon Sep 17 00:00:00 2001 From: dmchen Date: Fri, 25 Oct 2024 04:50:16 +0000 Subject: [PATCH 286/695] fix/TD-32622-add-closed-hash-fix-case --- source/dnode/mgmt/mgmt_vnode/inc/vmInt.h | 2 +- source/dnode/mgmt/mgmt_vnode/src/vmHandle.c | 8 ++-- source/dnode/mgmt/mgmt_vnode/src/vmInt.c | 50 ++++++++++++--------- 3 files changed, 34 insertions(+), 26 deletions(-) diff --git a/source/dnode/mgmt/mgmt_vnode/inc/vmInt.h b/source/dnode/mgmt/mgmt_vnode/inc/vmInt.h index 5bf151fcedde..1c08442bef86 100644 --- a/source/dnode/mgmt/mgmt_vnode/inc/vmInt.h +++ b/source/dnode/mgmt/mgmt_vnode/inc/vmInt.h @@ -95,7 +95,7 @@ SVnodeObj *vmAcquireVnode(SVnodeMgmt *pMgmt, int32_t vgId); SVnodeObj *vmAcquireVnodeImpl(SVnodeMgmt *pMgmt, int32_t vgId, bool strict); void vmReleaseVnode(SVnodeMgmt *pMgmt, SVnodeObj *pVnode); int32_t vmOpenVnode(SVnodeMgmt *pMgmt, SWrapperCfg *pCfg, SVnode *pImpl); -void vmCloseVnode(SVnodeMgmt *pMgmt, SVnodeObj *pVnode, bool commitAndRemoveWal); +void vmCloseVnode(SVnodeMgmt *pMgmt, SVnodeObj *pVnode, bool commitAndRemoveWal, bool keepClosed); // vmHandle.c SArray *vmGetMsgHandles(); diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c index 7e950ef1be13..04d64a7b3340 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c @@ -535,7 +535,7 @@ int32_t vmProcessAlterVnodeTypeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) { tstrncpy(wrapperCfg.path, pVnode->path, sizeof(wrapperCfg.path)); bool commitAndRemoveWal = vnodeShouldRemoveWal(pVnode->pImpl); - vmCloseVnode(pMgmt, pVnode, commitAndRemoveWal); + vmCloseVnode(pMgmt, pVnode, commitAndRemoveWal, true); int32_t diskPrimary = wrapperCfg.diskPrimary; char path[TSDB_FILENAME_LEN] = {0}; @@ -683,7 +683,7 @@ int32_t vmProcessAlterHashRangeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) { } dInfo("vgId:%d, close vnode", srcVgId); - vmCloseVnode(pMgmt, pVnode, true); + vmCloseVnode(pMgmt, pVnode, true, true); int32_t diskPrimary = wrapperCfg.diskPrimary; char srcPath[TSDB_FILENAME_LEN] = {0}; @@ -792,7 +792,7 @@ int32_t vmProcessAlterVnodeReplicaReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) { tstrncpy(wrapperCfg.path, pVnode->path, sizeof(wrapperCfg.path)); bool commitAndRemoveWal = vnodeShouldRemoveWal(pVnode->pImpl); - vmCloseVnode(pMgmt, pVnode, commitAndRemoveWal); + vmCloseVnode(pMgmt, pVnode, commitAndRemoveWal, true); int32_t diskPrimary = wrapperCfg.diskPrimary; char path[TSDB_FILENAME_LEN] = {0}; @@ -860,7 +860,7 @@ int32_t vmProcessDropVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) { return code; } - vmCloseVnode(pMgmt, pVnode, false); + vmCloseVnode(pMgmt, pVnode, false, false); if (vmWriteVnodeListToFile(pMgmt) != 0) { dError("vgId:%d, failed to write vnode list since %s", vgId, terrstr()); } diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmInt.c b/source/dnode/mgmt/mgmt_vnode/src/vmInt.c index 0f27e04303ce..20385d4e6b3c 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmInt.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmInt.c @@ -183,6 +183,7 @@ int32_t vmOpenVnode(SVnodeMgmt *pMgmt, SWrapperCfg *pCfg, SVnode *pImpl) { vmFreeVnodeObj(&pOld); } + dInfo("vgId:%d, remove from closedHash", pVnode->vgId); r = taosHashRemove(pMgmt->closedHash, &pVnode->vgId, sizeof(int32_t)); if (r != 0) { dError("vgId:%d, failed to remove vnode from hash", pVnode->vgId); @@ -192,7 +193,7 @@ int32_t vmOpenVnode(SVnodeMgmt *pMgmt, SWrapperCfg *pCfg, SVnode *pImpl) { return code; } -void vmCloseVnode(SVnodeMgmt *pMgmt, SVnodeObj *pVnode, bool commitAndRemoveWal) { +void vmCloseVnode(SVnodeMgmt *pMgmt, SVnodeObj *pVnode, bool commitAndRemoveWal, bool keepClosed) { char path[TSDB_FILENAME_LEN] = {0}; bool atExit = true; @@ -205,27 +206,34 @@ void vmCloseVnode(SVnodeMgmt *pMgmt, SVnodeObj *pVnode, bool commitAndRemoveWal) if (r != 0) { dError("vgId:%d, failed to remove vnode from hash", pVnode->vgId); } + if (keepClosed) { + SVnodeObj *pClosedVnode = taosMemoryCalloc(1, sizeof(SVnodeObj)); + (void)memset(pClosedVnode, 0, sizeof(SVnodeObj)); + if (pVnode == NULL) { + dError("vgId:%d, failed to alloc vnode since %s", pVnode->vgId, terrstr()); + (void)taosThreadRwlockUnlock(&pMgmt->lock); + return; + } - SVnodeObj *pClosedVnode = taosMemoryCalloc(1, sizeof(SVnodeObj)); - if (pVnode == NULL) { - dError("vgId:%d, failed to alloc vnode since %s", pVnode->vgId, terrstr()); - (void)taosThreadRwlockUnlock(&pMgmt->lock); - return; - } - - *pClosedVnode = *pVnode; + pClosedVnode->vgId = pVnode->vgId; + pClosedVnode->dropped = pVnode->dropped; + pClosedVnode->vgVersion = pVnode->vgVersion; + pClosedVnode->diskPrimary = pVnode->diskPrimary; + pClosedVnode->toVgId = pVnode->toVgId; - SVnodeObj *pOld = NULL; - r = taosHashGetDup(pMgmt->closedHash, &pVnode->vgId, sizeof(int32_t), (void *)&pOld); - if (r != 0) { - dError("vgId:%d, failed to get vnode from closedHash", pVnode->vgId); - } - if (pOld) { - vmFreeVnodeObj(&pOld); - } - r = taosHashPut(pMgmt->closedHash, &pVnode->vgId, sizeof(int32_t), &pClosedVnode, sizeof(SVnodeObj *)); - if (r != 0) { - dError("vgId:%d, failed to put vnode to closedHash", pVnode->vgId); + SVnodeObj *pOld = NULL; + r = taosHashGetDup(pMgmt->closedHash, &pVnode->vgId, sizeof(int32_t), (void *)&pOld); + if (r != 0) { + dError("vgId:%d, failed to get vnode from closedHash", pVnode->vgId); + } + if (pOld) { + vmFreeVnodeObj(&pOld); + } + dInfo("vgId:%d, put vnode to closedHash", pVnode->vgId); + r = taosHashPut(pMgmt->closedHash, &pVnode->vgId, sizeof(int32_t), &pClosedVnode, sizeof(SVnodeObj *)); + if (r != 0) { + dError("vgId:%d, failed to put vnode to closedHash", pVnode->vgId); + } } (void)taosThreadRwlockUnlock(&pMgmt->lock); @@ -508,7 +516,7 @@ static void *vmCloseVnodeInThread(void *param) { pMgmt->state.openVnodes, pMgmt->state.totalVnodes); tmsgReportStartup("vnode-close", stepDesc); - vmCloseVnode(pMgmt, pVnode, false); + vmCloseVnode(pMgmt, pVnode, false, false); } dInfo("thread:%d, numOfVnodes:%d is closed", pThread->threadIndex, pThread->vnodeNum); From 947566449454f728b5e0a4d316c0709dffd2a62f Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Fri, 25 Oct 2024 13:39:26 +0800 Subject: [PATCH 287/695] add stream doc --- docs/zh/06-advanced/03-stream.md | 3 ++- docs/zh/14-reference/03-taos-sql/10-function.md | 2 +- docs/zh/14-reference/03-taos-sql/14-stream.md | 6 ++---- source/libs/executor/src/streamtimesliceoperator.c | 1 + tests/script/tsim/stream/streamInterpPrimaryKey1.sim | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/zh/06-advanced/03-stream.md b/docs/zh/06-advanced/03-stream.md index a219f86750da..1827c0903310 100644 --- a/docs/zh/06-advanced/03-stream.md +++ b/docs/zh/06-advanced/03-stream.md @@ -116,10 +116,11 @@ create stream if not exists count_history_s fill_history 1 into count_history as ### 流计算的触发模式 -在创建流时,可以通过 TRIGGER 指令指定流计算的触发模式。对于非窗口计算,流计算的触发是实时的,对于窗口计算,目前提供 3 种触发模式,默认为 WINDOW_CLOSE。 +在创建流时,可以通过 TRIGGER 指令指定流计算的触发模式。对于非窗口计算,流计算的触发是实时的,对于窗口计算,目前提供 4 种触发模式,默认为 WINDOW_CLOSE。 1. AT_ONCE:写入立即触发。 2. WINDOW_CLOSE:窗口关闭时触发(窗口关闭由事件时间决定,可配合 watermark 使用)。 3. MAX_DELAY time:若窗口关闭,则触发计算。若窗口未关闭,且未关闭时长超过 max delay 指定的时间,则触发计算。 +4. FORCE_WINDOW_CLOSE:以操作系统当前时间为准,只计算当前关闭窗口的结果,并推送出去。窗口只会在被关闭的时刻计算一次,后续不会再重复计算。该模式当前只支持INTERVAL窗口和INTERP函数;FILL_HISTORY必须为 0,IGNORE EXPIRED必须为 1,IGNORE EXPIRED必须为 1;FILL只支持PREV 、NULL、 NONE、VALUE。 窗口关闭是由事件时间决定的,如事件流中断、或持续延迟,此时事件时间无法更新,可能导致无法得到最新的计算结果。 diff --git a/docs/zh/14-reference/03-taos-sql/10-function.md b/docs/zh/14-reference/03-taos-sql/10-function.md index 8c882b323722..c67710796d30 100644 --- a/docs/zh/14-reference/03-taos-sql/10-function.md +++ b/docs/zh/14-reference/03-taos-sql/10-function.md @@ -1829,7 +1829,7 @@ ignore_null_values: { - INTERP 用于在指定时间断面获取指定列的记录值,如果该时间断面不存在符合条件的行数据,那么会根据 FILL 参数的设定进行插值。 - INTERP 的输入数据为指定列的数据,可以通过条件语句(where 子句)来对原始列数据进行过滤,如果没有指定过滤条件则输入为全部数据。 -- INTERP 需要同时与 RANGE,EVERY 和 FILL 关键字一起使用。 +- INTERP SQL查询需要同时与 RANGE,EVERY 和 FILL 关键字一起使用;流计算不能使用RANGE,需要EVERY 和 FILL 关键字一起使用。 - INTERP 的输出时间范围根据 RANGE(timestamp1, timestamp2)字段来指定,需满足 timestamp1 \<= timestamp2。其中 timestamp1 为输出时间范围的起始值,即如果 timestamp1 时刻符合插值条件则 timestamp1 为输出的第一条记录,timestamp2 为输出时间范围的结束值,即输出的最后一条记录的 timestamp 不能大于 timestamp2。 - INTERP 根据 EVERY(time_unit) 字段来确定输出时间范围内的结果条数,即从 timestamp1 开始每隔固定长度的时间(time_unit 值)进行插值,time_unit 可取值时间单位:1a(毫秒),1s(秒),1m(分),1h(小时),1d(天),1w(周)。例如 EVERY(500a) 将对于指定数据每500毫秒间隔进行一次插值. - INTERP 根据 FILL 字段来决定在每个符合输出条件的时刻如何进行插值。关于 FILL 子句如何使用请参考 [FILL 子句](../distinguished/#fill-子句) diff --git a/docs/zh/14-reference/03-taos-sql/14-stream.md b/docs/zh/14-reference/03-taos-sql/14-stream.md index cd5c76a4ad38..ed9b4d261721 100644 --- a/docs/zh/14-reference/03-taos-sql/14-stream.md +++ b/docs/zh/14-reference/03-taos-sql/14-stream.md @@ -143,13 +143,14 @@ SELECT * from information_schema.`ins_streams`; 在创建流时,可以通过 TRIGGER 指令指定流式计算的触发模式。 -对于非窗口计算,流式计算的触发是实时的;对于窗口计算,目前提供 3 种触发模式,默认为 WINDOW_CLOSE: +对于非窗口计算,流式计算的触发是实时的;对于窗口计算,目前提供 4 种触发模式,默认为 WINDOW_CLOSE: 1. AT_ONCE:写入立即触发 2. WINDOW_CLOSE:窗口关闭时触发(窗口关闭由事件时间决定,可配合 watermark 使用) 3. MAX_DELAY time:若窗口关闭,则触发计算。若窗口未关闭,且未关闭时长超过 max delay 指定的时间,则触发计算。 +4. FORCE_WINDOW_CLOSE:以操作系统当前时间为准,只计算当前关闭窗口的结果,并推送出去。窗口只会在被关闭的时刻计算一次,后续不会再重复计算。该模式当前只支持INTERVAL窗口和INTERP函数;FILL_HISTORY必须为 0,IGNORE EXPIRED必须为 1,IGNORE EXPIRED必须为 1;FILL只支持PREV 、NULL、 NONE、VALUE。 由于窗口关闭是由事件时间决定的,如事件流中断、或持续延迟,则事件时间无法更新,可能导致无法得到最新的计算结果。 @@ -248,11 +249,8 @@ T = 最新事件时间 - DELETE_MARK - [percentile](../function/#percentile) - [top](../function/#top) - [bottom](../function/#bottom) -- [elapsed](../function/#elapsed) -- [interp](../function/#interp) - [derivative](../function/#derivative) - [irate](../function/#irate) -- [twa](../function/#twa) - [histogram](../function/#histogram) - [diff](../function/#diff) - [statecount](../function/#statecount) diff --git a/source/libs/executor/src/streamtimesliceoperator.c b/source/libs/executor/src/streamtimesliceoperator.c index 488f84aae0c9..3d7219a26285 100644 --- a/source/libs/executor/src/streamtimesliceoperator.c +++ b/source/libs/executor/src/streamtimesliceoperator.c @@ -780,6 +780,7 @@ static int32_t getResultInfoFromState(SStreamAggSupporter* pAggSup, SStreamFillS code = pAggSup->stateStore.streamStateFillGetNext(pState, &pCurPoint->key, &pNextPoint->key, (void**)&pNextPoint->pResPos, &nextVLen, &tmpRes); QUERY_CHECK_CODE(code, lino, _end); + qDebug("===stream=== set stream interp resutl next buf.ts:%" PRId64 ", groupId:%" PRId64 ", res:%d", pNextPoint->key.ts, pNextPoint->key.groupId, tmpRes); if (tmpRes == TSDB_CODE_SUCCESS) { QUERY_CHECK_CONDITION(!IS_INVALID_WIN_KEY(pNextPoint->key.ts), code, lino, _end, TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR); setPointBuff(pNextPoint, pFillSup); diff --git a/tests/script/tsim/stream/streamInterpPrimaryKey1.sim b/tests/script/tsim/stream/streamInterpPrimaryKey1.sim index 25d1480917ae..04a1f299be30 100644 --- a/tests/script/tsim/stream/streamInterpPrimaryKey1.sim +++ b/tests/script/tsim/stream/streamInterpPrimaryKey1.sim @@ -204,10 +204,10 @@ $loop_count = 0 loop4: -sleep 300 +sleep 500 $loop_count = $loop_count + 1 -if $loop_count == 10 then +if $loop_count == 20 then return -1 endi From 6b2d338a20df26baed502f79f7b127d1a60dfc78 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Fri, 25 Oct 2024 13:47:09 +0800 Subject: [PATCH 288/695] enh(executor):avoid use dangerous functions --- include/libs/executor/executor.h | 5 +- .../libs/executor/src/anomalywindowoperator.c | 2 +- source/libs/executor/src/exchangeoperator.c | 2 +- source/libs/executor/src/executor.c | 9 +-- source/libs/executor/src/scanoperator.c | 2 +- source/libs/executor/src/sysscanoperator.c | 67 +++++++++++-------- source/libs/executor/test/executorTests.cpp | 4 +- source/libs/executor/test/lhashTests.cpp | 2 +- source/libs/qworker/src/qwUtil.c | 2 +- source/libs/stream/src/streamState.c | 2 +- source/libs/stream/src/tstreamFileState.c | 8 +-- 11 files changed, 60 insertions(+), 45 deletions(-) diff --git a/include/libs/executor/executor.h b/include/libs/executor/executor.h index ae26d5f2aeab..fa17abdebc91 100644 --- a/include/libs/executor/executor.h +++ b/include/libs/executor/executor.h @@ -151,8 +151,9 @@ int32_t qCreateExecTask(SReadHandle* readHandle, int32_t vgId, uint64_t taskId, * @param tversion * @return */ -int32_t qGetQueryTableSchemaVersion(qTaskInfo_t tinfo, char* dbName, char* tableName, int32_t* sversion, - int32_t* tversion, int32_t idx, bool* tbGet); +int32_t qGetQueryTableSchemaVersion(qTaskInfo_t tinfo, char* dbName, int32_t dbNameBuffLen, char* tableName, + int32_t tbaleNameBuffLen, int32_t* sversion, int32_t* tversion, int32_t idx, + bool* tbGet); /** * The main task execution function, including query on both table and multiple tables, diff --git a/source/libs/executor/src/anomalywindowoperator.c b/source/libs/executor/src/anomalywindowoperator.c index 7f3430b8374e..d03e527c2ba0 100644 --- a/source/libs/executor/src/anomalywindowoperator.c +++ b/source/libs/executor/src/anomalywindowoperator.c @@ -86,7 +86,7 @@ int32_t createAnomalywindowOperatorInfo(SOperatorInfo* downstream, SPhysiNode* p pOperator->exprSupp.hasWindowOrGroup = true; pInfo->tsSlotId = ((SColumnNode*)pAnomalyNode->window.pTspk)->slotId; - strncpy(pInfo->anomalyOpt, pAnomalyNode->anomalyOpt, sizeof(pInfo->anomalyOpt)); + tstrncpy(pInfo->anomalyOpt, pAnomalyNode->anomalyOpt, sizeof(pInfo->anomalyOpt)); if (pAnomalyNode->window.pExprs != NULL) { int32_t numOfScalarExpr = 0; diff --git a/source/libs/executor/src/exchangeoperator.c b/source/libs/executor/src/exchangeoperator.c index 60442c34ee48..042fcf0120b8 100644 --- a/source/libs/executor/src/exchangeoperator.c +++ b/source/libs/executor/src/exchangeoperator.c @@ -320,7 +320,7 @@ static int32_t initDataSource(int32_t numOfSources, SExchangeInfo* pInfo, const if (!pInfo->pTaskId) { return terrno; } - strncpy(pInfo->pTaskId, id, len); + tstrncpy(pInfo->pTaskId, id, len); for (int32_t i = 0; i < numOfSources; ++i) { SSourceDataInfo dataInfo = {0}; dataInfo.status = EX_SOURCE_DATA_NOT_READY; diff --git a/source/libs/executor/src/executor.c b/source/libs/executor/src/executor.c index 27dd687f40fd..019b4faed919 100644 --- a/source/libs/executor/src/executor.c +++ b/source/libs/executor/src/executor.c @@ -545,8 +545,9 @@ int32_t qUpdateTableListForStreamScanner(qTaskInfo_t tinfo, const SArray* tableI return code; } -int32_t qGetQueryTableSchemaVersion(qTaskInfo_t tinfo, char* dbName, char* tableName, int32_t* sversion, - int32_t* tversion, int32_t idx, bool* tbGet) { +int32_t qGetQueryTableSchemaVersion(qTaskInfo_t tinfo, char* dbName, int32_t dbNameBuffLen, char* tableName, + int32_t tbaleNameBuffLen, int32_t* sversion, int32_t* tversion, int32_t idx, + bool* tbGet) { *tbGet = false; if (tinfo == NULL || dbName == NULL || tableName == NULL) { @@ -567,12 +568,12 @@ int32_t qGetQueryTableSchemaVersion(qTaskInfo_t tinfo, char* dbName, char* table *sversion = pSchemaInfo->sw->version; *tversion = pSchemaInfo->tversion; if (pSchemaInfo->dbname) { - strcpy(dbName, pSchemaInfo->dbname); + tstrncpy(dbName, pSchemaInfo->dbname, dbNameBuffLen); } else { dbName[0] = 0; } if (pSchemaInfo->tablename) { - strcpy(tableName, pSchemaInfo->tablename); + tstrncpy(tableName, pSchemaInfo->tablename, tbaleNameBuffLen); } else { tableName[0] = 0; } diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index bae9926f6370..95846087d044 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -6345,7 +6345,7 @@ int32_t fillTableCountScanDataBlock(STableCountScanSupp* pSupp, char* dbName, ch QUERY_CHECK_NULL(colInfoData, code, lino, _end, terrno); if (strlen(stbName) != 0) { char varStbName[TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE] = {0}; - strncpy(varDataVal(varStbName), stbName, TSDB_TABLE_NAME_LEN); + tstrncpy(varDataVal(varStbName), stbName, TSDB_TABLE_NAME_LEN); varDataSetLen(varStbName, strlen(stbName)); code = colDataSetVal(colInfoData, 0, varStbName, false); QUERY_CHECK_CODE(code, lino, _end); diff --git a/source/libs/executor/src/sysscanoperator.c b/source/libs/executor/src/sysscanoperator.c index 051a06ba5ccd..108cf7820421 100644 --- a/source/libs/executor/src/sysscanoperator.c +++ b/source/libs/executor/src/sysscanoperator.c @@ -425,7 +425,7 @@ static bool sysTableIsOperatorCondOnOneTable(SNode* pCond, char* condTable) { SValueNode* pValue = (SValueNode*)node->pRight; if (pValue->node.resType.type == TSDB_DATA_TYPE_NCHAR || pValue->node.resType.type == TSDB_DATA_TYPE_VARCHAR) { char* value = nodesGetValueFromNode(pValue); - strncpy(condTable, varDataVal(value), TSDB_TABLE_NAME_LEN); + tstrncpy(condTable, varDataVal(value), TSDB_TABLE_NAME_LEN); return true; } } @@ -914,41 +914,41 @@ void relocateAndFilterSysTagsScanResult(SSysTableScanInfo* pInfo, int32_t numOfR } } -int32_t convertTagDataToStr(char* str, int type, void* buf, int32_t bufSize, int32_t* len) { +int32_t convertTagDataToStr(char* str, int32_t strBuffLen, int type, void* buf, int32_t bufSize, int32_t* len) { int32_t n = 0; switch (type) { case TSDB_DATA_TYPE_NULL: - n = sprintf(str, "null"); + n = tsnprintf(str, strBuffLen, "null"); break; case TSDB_DATA_TYPE_BOOL: - n = sprintf(str, (*(int8_t*)buf) ? "true" : "false"); + n = tsnprintf(str, strBuffLen, (*(int8_t*)buf) ? "true" : "false"); break; case TSDB_DATA_TYPE_TINYINT: - n = sprintf(str, "%d", *(int8_t*)buf); + n = tsnprintf(str, strBuffLen, "%d", *(int8_t*)buf); break; case TSDB_DATA_TYPE_SMALLINT: - n = sprintf(str, "%d", *(int16_t*)buf); + n = tsnprintf(str, strBuffLen, "%d", *(int16_t*)buf); break; case TSDB_DATA_TYPE_INT: - n = sprintf(str, "%d", *(int32_t*)buf); + n = tsnprintf(str, strBuffLen, "%d", *(int32_t*)buf); break; case TSDB_DATA_TYPE_BIGINT: case TSDB_DATA_TYPE_TIMESTAMP: - n = sprintf(str, "%" PRId64, *(int64_t*)buf); + n = tsnprintf(str, strBuffLen, "%" PRId64, *(int64_t*)buf); break; case TSDB_DATA_TYPE_FLOAT: - n = sprintf(str, "%.5f", GET_FLOAT_VAL(buf)); + n = tsnprintf(str, strBuffLen, "%.5f", GET_FLOAT_VAL(buf)); break; case TSDB_DATA_TYPE_DOUBLE: - n = sprintf(str, "%.9f", GET_DOUBLE_VAL(buf)); + n = tsnprintf(str, strBuffLen, "%.9f", GET_DOUBLE_VAL(buf)); break; case TSDB_DATA_TYPE_BINARY: @@ -973,19 +973,19 @@ int32_t convertTagDataToStr(char* str, int type, void* buf, int32_t bufSize, int n = length; break; case TSDB_DATA_TYPE_UTINYINT: - n = sprintf(str, "%u", *(uint8_t*)buf); + n = tsnprintf(str, strBuffLen, "%u", *(uint8_t*)buf); break; case TSDB_DATA_TYPE_USMALLINT: - n = sprintf(str, "%u", *(uint16_t*)buf); + n = tsnprintf(str, strBuffLen, "%u", *(uint16_t*)buf); break; case TSDB_DATA_TYPE_UINT: - n = sprintf(str, "%u", *(uint32_t*)buf); + n = tsnprintf(str, strBuffLen, "%u", *(uint32_t*)buf); break; case TSDB_DATA_TYPE_UBIGINT: - n = sprintf(str, "%" PRIu64, *(uint64_t*)buf); + n = tsnprintf(str, strBuffLen, "%" PRIu64, *(uint64_t*)buf); break; default: @@ -1065,14 +1065,21 @@ static int32_t sysTableUserTagsFillOneTableTags(const SSysTableScanInfo* pInfo, int8_t tagType = (*smrSuperTable).me.stbEntry.schemaTag.pSchema[i].type; pColInfoData = taosArrayGet(dataBlock->pDataBlock, 4); QUERY_CHECK_NULL(pColInfoData, code, lino, _end, terrno); - char tagTypeStr[VARSTR_HEADER_SIZE + 32]; - int tagTypeLen = sprintf(varDataVal(tagTypeStr), "%s", tDataTypes[tagType].name); + int32_t tagStrBufflen = 32; + char tagTypeStr[VARSTR_HEADER_SIZE + tagStrBufflen]; + int tagTypeLen = tsnprintf(varDataVal(tagTypeStr), tagStrBufflen, "%s", tDataTypes[tagType].name); + tagStrBufflen -= tagTypeLen; + if (tagStrBufflen <= 0) { + code = TSDB_CODE_INVALID_PARA; + QUERY_CHECK_CODE(code, lino, _end); + } + if (tagType == TSDB_DATA_TYPE_NCHAR) { - tagTypeLen += sprintf( - varDataVal(tagTypeStr) + tagTypeLen, "(%d)", + tagTypeLen += tsnprintf( + varDataVal(tagTypeStr) + tagTypeLen, tagStrBufflen, "(%d)", (int32_t)(((*smrSuperTable).me.stbEntry.schemaTag.pSchema[i].bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE)); } else if (IS_VAR_DATA_TYPE(tagType)) { - tagTypeLen += sprintf(varDataVal(tagTypeStr) + tagTypeLen, "(%d)", + tagTypeLen += tsnprintf(varDataVal(tagTypeStr) + tagTypeLen, tagStrBufflen, "(%d)", (int32_t)((*smrSuperTable).me.stbEntry.schemaTag.pSchema[i].bytes - VARSTR_HEADER_SIZE)); } varDataSetLen(tagTypeStr, tagTypeLen); @@ -1127,7 +1134,7 @@ static int32_t sysTableUserTagsFillOneTableTags(const SSysTableScanInfo* pInfo, QUERY_CHECK_NULL(tagVarChar, code, lino, _end, terrno); int32_t len = -1; if (tagLen > 0) - convertTagDataToStr(varDataVal(tagVarChar), tagType, tagData, tagLen, &len); + convertTagDataToStr(varDataVal(tagVarChar), bufSize + 1 - VARSTR_HEADER_SIZE, tagType, tagData, tagLen, &len); else len = 0; varDataSetLen(tagVarChar, len); @@ -1197,13 +1204,19 @@ static int32_t sysTableUserColsFillOneTableCols(const SSysTableScanInfo* pInfo, int8_t colType = schemaRow->pSchema[i].type; pColInfoData = taosArrayGet(dataBlock->pDataBlock, 4); QUERY_CHECK_NULL(pColInfoData, code, lino, _end, terrno); - char colTypeStr[VARSTR_HEADER_SIZE + 32]; - int colTypeLen = sprintf(varDataVal(colTypeStr), "%s", tDataTypes[colType].name); + int32_t colStrBufflen = 32; + char colTypeStr[VARSTR_HEADER_SIZE + colStrBufflen]; + int colTypeLen = tsnprintf(varDataVal(colTypeStr), colStrBufflen, "%s", tDataTypes[colType].name); + colStrBufflen -= colTypeLen; + if (colStrBufflen <= 0) { + code = TSDB_CODE_INVALID_PARA; + QUERY_CHECK_CODE(code, lino, _end); + } if (colType == TSDB_DATA_TYPE_VARCHAR) { - colTypeLen += sprintf(varDataVal(colTypeStr) + colTypeLen, "(%d)", + colTypeLen += tsnprintf(varDataVal(colTypeStr) + colTypeLen, colStrBufflen, "(%d)", (int32_t)(schemaRow->pSchema[i].bytes - VARSTR_HEADER_SIZE)); } else if (colType == TSDB_DATA_TYPE_NCHAR) { - colTypeLen += sprintf(varDataVal(colTypeStr) + colTypeLen, "(%d)", + colTypeLen += tsnprintf(varDataVal(colTypeStr) + colTypeLen, colStrBufflen, "(%d)", (int32_t)((schemaRow->pSchema[i].bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE)); } varDataSetLen(colTypeStr, colTypeLen); @@ -2019,7 +2032,7 @@ static EDealRes getDBNameFromConditionWalker(SNode* pNode, void* pContext) { SValueNode* node = (SValueNode*)pNode; char* dbName = nodesGetValueFromNode(node); - strncpy(pContext, varDataVal(dbName), varDataLen(dbName)); + tstrncpy((char*)pContext, varDataVal(dbName), varDataLen(dbName)); *((char*)pContext + varDataLen(dbName)) = 0; return DEAL_RES_END; // stop walk } @@ -2056,11 +2069,11 @@ static int32_t doSysTableScanNext(SOperatorInfo* pOperator, SSDataBlock** ppRes) getDBNameFromCondition(pInfo->pCondition, dbName); if (strncasecmp(name, TSDB_INS_TABLE_COMPACTS, TSDB_TABLE_FNAME_LEN) != 0 && strncasecmp(name, TSDB_INS_TABLE_COMPACT_DETAILS, TSDB_TABLE_FNAME_LEN) != 0) { - sprintf(pInfo->req.db, "%d.%s", pInfo->accountId, dbName); + tsnprintf(pInfo->req.db, sizeof(pInfo->req.db), "%d.%s", pInfo->accountId, dbName); } } else if (strncasecmp(name, TSDB_INS_TABLE_COLS, TSDB_TABLE_FNAME_LEN) == 0) { getDBNameFromCondition(pInfo->pCondition, dbName); - if (dbName[0]) sprintf(pInfo->req.db, "%d.%s", pInfo->accountId, dbName); + if (dbName[0]) tsnprintf(pInfo->req.db, sizeof(pInfo->req.db), "%d.%s", pInfo->accountId, dbName); (void)sysTableIsCondOnOneTable(pInfo->pCondition, pInfo->req.filterTb); } diff --git a/source/libs/executor/test/executorTests.cpp b/source/libs/executor/test/executorTests.cpp index ff33732b2320..87887d2b2f03 100644 --- a/source/libs/executor/test/executorTests.cpp +++ b/source/libs/executor/test/executorTests.cpp @@ -115,7 +115,7 @@ SSDataBlock* getDummyBlock(SOperatorInfo* pOperator) { int32_t code = colDataSetVal(pColInfo, i, reinterpret_cast(&v), false); ASSERT(code == 0); - // sprintf(buf, "this is %d row", i); + // tsnprintf(buf, "this is %d row", i); // STR_TO_VARSTR(b1, buf); // // SColumnInfoData* pColInfo2 = static_cast(TARRAY_GET_ELEM(pBlock->pDataBlock, 1)); @@ -179,7 +179,7 @@ SSDataBlock* get2ColsDummyBlock(SOperatorInfo* pOperator) { code = colDataSetVal(pColInfo1, i, reinterpret_cast(&v), false); ASSERT(code == 0); - // sprintf(buf, "this is %d row", i); + // tsnprintf(buf, "this is %d row", i); // STR_TO_VARSTR(b1, buf); // // SColumnInfoData* pColInfo2 = static_cast(TARRAY_GET_ELEM(pBlock->pDataBlock, 1)); diff --git a/source/libs/executor/test/lhashTests.cpp b/source/libs/executor/test/lhashTests.cpp index daf59c6058cc..89e1cd2b0798 100644 --- a/source/libs/executor/test/lhashTests.cpp +++ b/source/libs/executor/test/lhashTests.cpp @@ -26,7 +26,7 @@ TEST(testCase, linear_hash_Tests) { taosSeedRand(taosGetTimestampSec()); - strcpy(tsTempDir, "/tmp/"); + tstrncpy((char*)tsTempDir, "/tmp/", sizeof(tsTempDir)); _hash_fn_t fn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT); diff --git a/source/libs/qworker/src/qwUtil.c b/source/libs/qworker/src/qwUtil.c index bebb9b288aa2..ef07a4262985 100644 --- a/source/libs/qworker/src/qwUtil.c +++ b/source/libs/qworker/src/qwUtil.c @@ -533,7 +533,7 @@ int32_t qwSaveTbVersionInfo(qTaskInfo_t pTaskInfo, SQWTaskCtx *ctx) { while (true) { tbGet = false; - code = qGetQueryTableSchemaVersion(pTaskInfo, dbFName, tbName, &tbInfo.sversion, &tbInfo.tversion, i, &tbGet); + code = qGetQueryTableSchemaVersion(pTaskInfo, dbFName, TSDB_DB_FNAME_LEN, tbName, TSDB_TABLE_NAME_LEN, &tbInfo.sversion, &tbInfo.tversion, i, &tbGet); if (TSDB_CODE_SUCCESS != code || !tbGet) { break; } diff --git a/source/libs/stream/src/streamState.c b/source/libs/stream/src/streamState.c index cfe476540cd0..2791e3ceadd8 100644 --- a/source/libs/stream/src/streamState.c +++ b/source/libs/stream/src/streamState.c @@ -120,7 +120,7 @@ SStreamState* streamStateOpen(const char* path, void* pTask, int64_t streamId, i SStreamTask* pStreamTask = pTask; pState->streamId = streamId; pState->taskId = taskId; - sprintf(pState->pTdbState->idstr, "0x%" PRIx64 "-0x%x", pState->streamId, pState->taskId); + tsnprintf(pState->pTdbState->idstr, sizeof(pState->pTdbState->idstr), "0x%" PRIx64 "-0x%x", pState->streamId, pState->taskId); code = streamTaskSetDb(pStreamTask->pMeta, pTask, pState->pTdbState->idstr); QUERY_CHECK_CODE(code, lino, _end); diff --git a/source/libs/stream/src/tstreamFileState.c b/source/libs/stream/src/tstreamFileState.c index 424845e4f2fd..d4a181f89f54 100644 --- a/source/libs/stream/src/tstreamFileState.c +++ b/source/libs/stream/src/tstreamFileState.c @@ -777,7 +777,7 @@ void flushSnapshot(SStreamFileState* pFileState, SStreamSnapshot* pSnapshot, boo int32_t forceRemoveCheckpoint(SStreamFileState* pFileState, int64_t checkpointId) { char keyBuf[128] = {0}; - sprintf(keyBuf, "%s:%" PRId64 "", TASK_KEY, checkpointId); + tsnprintf(keyBuf, sizeof(keyBuf), "%s:%" PRId64 "", TASK_KEY, checkpointId); return streamDefaultDel_rocksdb(pFileState->pFileStore, keyBuf); } @@ -799,14 +799,14 @@ int32_t deleteExpiredCheckPoint(SStreamFileState* pFileState, TSKEY mark) { } memcpy(buf, val, len); buf[len] = 0; - maxCheckPointId = atol((char*)buf); + maxCheckPointId = taosStr2Int64((char*)buf, NULL, 10); taosMemoryFree(val); } for (int64_t i = maxCheckPointId; i > 0; i--) { char buf[128] = {0}; void* val = 0; int32_t len = 0; - sprintf(buf, "%s:%" PRId64 "", TASK_KEY, i); + tsnprintf(buf, sizeof(buf), "%s:%" PRId64 "", TASK_KEY, i); code = streamDefaultGet_rocksdb(pFileState->pFileStore, buf, &val, &len); if (code != 0) { return TSDB_CODE_FAILED; @@ -816,7 +816,7 @@ int32_t deleteExpiredCheckPoint(SStreamFileState* pFileState, TSKEY mark) { taosMemoryFree(val); TSKEY ts; - ts = atol((char*)buf); + ts = taosStr2Int64((char*)buf, NULL, 10); if (ts < mark) { // statekey winkey.ts < mark int32_t tmpRes = forceRemoveCheckpoint(pFileState, i); From 25343b914def17a929799f5bdec93f20c67a6235 Mon Sep 17 00:00:00 2001 From: dmchen Date: Fri, 25 Oct 2024 05:51:40 +0000 Subject: [PATCH 289/695] fix/TD-32622-add-closed-hash-fix-case --- source/dnode/mgmt/mgmt_vnode/src/vmHandle.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c index 04d64a7b3340..7558f6f3debd 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c @@ -683,7 +683,7 @@ int32_t vmProcessAlterHashRangeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) { } dInfo("vgId:%d, close vnode", srcVgId); - vmCloseVnode(pMgmt, pVnode, true, true); + vmCloseVnode(pMgmt, pVnode, true, false); int32_t diskPrimary = wrapperCfg.diskPrimary; char srcPath[TSDB_FILENAME_LEN] = {0}; From a10e6457bf173d8ed0587c6574547f4d39d3c269 Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Fri, 25 Oct 2024 14:00:32 +0800 Subject: [PATCH 290/695] fix: blank and double quotes --- tools/shell/src/shellAuto.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/shell/src/shellAuto.c b/tools/shell/src/shellAuto.c index defbf1cb824e..2b203953dde7 100644 --- a/tools/shell/src/shellAuto.c +++ b/tools/shell/src/shellAuto.c @@ -229,7 +229,7 @@ SWords shellCommands[] = { // where keyword char* keywords[] = { - "and ", "asc ", "desc ", "from ", "fill(", "limit ", "where ", + "where ", "and ", "asc ", "desc ", "from ", "fill(", "limit ", "interval(", "order by ", "order by ", "offset ", "or ", "group by ", "now()", "session(", "sliding ", "slimit ", "soffset ", "state_window(", "today() ", "union all select ", "partition by ", "match", "nmatch ", "between ", "like ", "is null ", "is not null ", @@ -1330,7 +1330,7 @@ void printScreen(TAOS* con, SShellCmd* cmd, SWords* match) { lastWordBytes = word->len; } - if (word->end) { + if (word->end && str[strLen - 1] != ';') { // append end ';' char *p = taosMemoryMalloc(strLen + 8); strcpy(p, str); From c466bea5e0999a4737d9ef8bb19b0be94277db08 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Fri, 25 Oct 2024 14:03:03 +0800 Subject: [PATCH 291/695] add stream doc --- docs/zh/14-reference/03-taos-sql/10-function.md | 4 ++-- tests/script/tsim/stream/streamTwaError.sim | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/zh/14-reference/03-taos-sql/10-function.md b/docs/zh/14-reference/03-taos-sql/10-function.md index c67710796d30..dd58adfeed46 100644 --- a/docs/zh/14-reference/03-taos-sql/10-function.md +++ b/docs/zh/14-reference/03-taos-sql/10-function.md @@ -1569,7 +1569,7 @@ COUNT({* | expr}) ELAPSED(ts_primary_key [, time_unit]) ``` -**功能说明**:elapsed函数表达了统计周期内连续的时间长度,和twa函数配合使用可以计算统计曲线下的面积。在通过INTERVAL子句指定窗口的情况下,统计在给定时间范围内的每个窗口内有数据覆盖的时间范围;如果没有INTERVAL子句,则返回整个给定时间范围内的有数据覆盖的时间范围。注意,ELAPSED返回的并不是时间范围的绝对值,而是绝对值除以time_unit所得到的单位个数。 +**功能说明**:elapsed函数表达了统计周期内连续的时间长度,和twa函数配合使用可以计算统计曲线下的面积。在通过INTERVAL子句指定窗口的情况下,统计在给定时间范围内的每个窗口内有数据覆盖的时间范围;如果没有INTERVAL子句,则返回整个给定时间范围内的有数据覆盖的时间范围。注意,ELAPSED返回的并不是时间范围的绝对值,而是绝对值除以time_unit所得到的单位个数。流计算仅在FORCE_WINDOW_CLOSE模式下支持该函数。 **返回结果类型**:DOUBLE。 @@ -2180,7 +2180,7 @@ STATEDURATION(expr, oper, val, unit) TWA(expr) ``` -**功能说明**:时间加权平均函数。统计表中某列在一段时间内的时间加权平均。对于存在复合主键的表的查询,若时间戳相同的数据存在多条,则只有对应的复合主键最小的数据参与运算。 +**功能说明**:时间加权平均函数。统计表中某列在一段时间内的时间加权平均。对于存在复合主键的表的查询,若时间戳相同的数据存在多条,则只有对应的复合主键最小的数据参与运算。流计算仅在FORCE_WINDOW_CLOSE模式下支持该函数。 **返回数据类型**:DOUBLE。 diff --git a/tests/script/tsim/stream/streamTwaError.sim b/tests/script/tsim/stream/streamTwaError.sim index e9d89f927592..9e84ffb48c4c 100644 --- a/tests/script/tsim/stream/streamTwaError.sim +++ b/tests/script/tsim/stream/streamTwaError.sim @@ -24,6 +24,8 @@ sql_error create stream streams6 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE sql_error create stream streams7 trigger force_window_close IGNORE EXPIRED 1 IGNORE UPDATE 1 into streamt7 as select _wstart, twa(a) from st partition by tbname,ta session(ts, 2s); sql_error create stream streams8 trigger force_window_close IGNORE EXPIRED 1 IGNORE UPDATE 1 into streamt8 as select _wstart, twa(a) from st partition by tbname,ta state_window(a); +sql_error create stream streams9 trigger at_once IGNORE EXPIRED 1 IGNORE UPDATE 1 into streamt9 as select _wstart, elapsed(ts) from st partition by tbname,ta interval(2s) fill(prev); + print end system sh/exec.sh -n dnode1 -s stop -x SIGINT From 39af874ff8e8c50ae9efaeeee030518f5538914e Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Fri, 25 Oct 2024 14:20:07 +0800 Subject: [PATCH 292/695] enh(tsdb/cache): move last ref array into shard instance --- source/util/src/tlrucache.c | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/source/util/src/tlrucache.c b/source/util/src/tlrucache.c index 69832cd46c68..bccf37c7d6e0 100644 --- a/source/util/src/tlrucache.c +++ b/source/util/src/tlrucache.c @@ -14,12 +14,12 @@ */ #define _DEFAULT_SOURCE +#include "tlrucache.h" #include "os.h" #include "taoserror.h" #include "tarray.h" #include "tdef.h" #include "tlog.h" -#include "tlrucache.h" #include "tutil.h" typedef struct SLRUEntry SLRUEntry; @@ -248,6 +248,7 @@ struct SLRUCacheShard { SLRUEntryTable table; size_t usage; // Memory size for entries residing in the cache. size_t lruUsage; // Memory size for entries residing only in the LRU list. + SArray *lastReferenceList; TdThreadMutex mutex; }; @@ -367,25 +368,34 @@ static void taosLRUCacheShardCleanup(SLRUCacheShard *shard) { (void)taosThreadMutexDestroy(&shard->mutex); taosLRUEntryTableCleanup(&shard->table); + + taosArrayDestroy(shard->lastReferenceList); } static LRUStatus taosLRUCacheShardInsertEntry(SLRUCacheShard *shard, SLRUEntry *e, LRUHandle **handle, bool freeOnFail) { LRUStatus status = TAOS_LRU_STATUS_OK; - SArray *lastReferenceList = taosArrayInit(16, POINTER_BYTES); - if (!lastReferenceList) { - taosLRUEntryFree(e); - return TAOS_LRU_STATUS_FAIL; - } (void)taosThreadMutexLock(&shard->mutex); - taosLRUCacheShardEvictLRU(shard, e->totalCharge, lastReferenceList); + if (!shard->lastReferenceList) { + shard->lastReferenceList = taosArrayInit(16, POINTER_BYTES); + if (!shard->lastReferenceList) { + taosLRUEntryFree(e); + (void)taosThreadMutexUnlock(&shard->mutex); + + return TAOS_LRU_STATUS_FAIL; + } + } else { + taosArrayClear(shard->lastReferenceList); + } + + taosLRUCacheShardEvictLRU(shard, e->totalCharge, shard->lastReferenceList); if (shard->usage + e->totalCharge > shard->capacity && (shard->strictCapacity || handle == NULL)) { TAOS_LRU_ENTRY_SET_IN_CACHE(e, false); if (handle == NULL) { - if (!taosArrayPush(lastReferenceList, &e)) { + if (!taosArrayPush(shard->lastReferenceList, &e)) { taosLRUEntryFree(e); goto _exit; } @@ -413,7 +423,7 @@ static LRUStatus taosLRUCacheShardInsertEntry(SLRUCacheShard *shard, SLRUEntry * taosLRUCacheShardLRURemove(shard, old); shard->usage -= old->totalCharge; - if (!taosArrayPush(lastReferenceList, &old)) { + if (!taosArrayPush(shard->lastReferenceList, &old)) { taosLRUEntryFree(e); taosLRUEntryFree(old); goto _exit; @@ -434,12 +444,11 @@ static LRUStatus taosLRUCacheShardInsertEntry(SLRUCacheShard *shard, SLRUEntry * _exit: (void)taosThreadMutexUnlock(&shard->mutex); - for (int i = 0; i < taosArrayGetSize(lastReferenceList); ++i) { - SLRUEntry *entry = taosArrayGetP(lastReferenceList, i); + for (int i = 0; i < taosArrayGetSize(shard->lastReferenceList); ++i) { + SLRUEntry *entry = taosArrayGetP(shard->lastReferenceList, i); taosLRUEntryFree(entry); } - taosArrayDestroy(lastReferenceList); return status; } @@ -733,7 +742,8 @@ void taosLRUCacheCleanup(SLRUCache *cache) { } LRUStatus taosLRUCacheInsert(SLRUCache *cache, const void *key, size_t keyLen, void *value, size_t charge, - _taos_lru_deleter_t deleter, _taos_lru_overwriter_t overwriter, LRUHandle **handle, LRUPriority priority, void *ud) { + _taos_lru_deleter_t deleter, _taos_lru_overwriter_t overwriter, LRUHandle **handle, + LRUPriority priority, void *ud) { uint32_t hash = TAOS_LRU_CACHE_SHARD_HASH32(key, keyLen); uint32_t shardIndex = hash & cache->shardedCache.shardMask; From fa9f27344950405d905ffa501e81471cd448820b Mon Sep 17 00:00:00 2001 From: lyh250-666 Date: Fri, 25 Oct 2024 14:39:03 +0800 Subject: [PATCH 293/695] opti:add case for double and float --- source/libs/scalar/src/filter.c | 9 +++++++-- tests/script/tsim/scalar/in.sim | 34 +++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/source/libs/scalar/src/filter.c b/source/libs/scalar/src/filter.c index c9740b8c25cf..2c449fced6cd 100644 --- a/source/libs/scalar/src/filter.c +++ b/source/libs/scalar/src/filter.c @@ -5034,8 +5034,13 @@ int32_t fltSclBuildRangePoints(SFltSclOperator *oper, SArray *points) { SValueNode *valueNode = (SValueNode *)cell->pNode; SFltSclDatum valDatum; FLT_ERR_RET(fltSclBuildDatumFromValueNode(&valDatum, valueNode)); - minDatum.i = TMIN(minDatum.i, valDatum.i); - maxDatum.i = TMAX(maxDatum.i, valDatum.i); + if(valueNode->node.resType.type == TSDB_DATA_TYPE_FLOAT || valueNode->node.resType.type == TSDB_DATA_TYPE_DOUBLE) { + minDatum.i = TMIN(minDatum.i, valDatum.d); + maxDatum.i = TMAX(maxDatum.i, valDatum.d); + } else { + minDatum.i = TMIN(minDatum.i, valDatum.i); + maxDatum.i = TMAX(maxDatum.i, valDatum.i); + } cell = cell->pNext; } SFltSclPoint startPt = {.start = true, .excl = false, .val = minDatum}; diff --git a/tests/script/tsim/scalar/in.sim b/tests/script/tsim/scalar/in.sim index d241bbc1bfc9..f7fa2bcd2d57 100644 --- a/tests/script/tsim/scalar/in.sim +++ b/tests/script/tsim/scalar/in.sim @@ -95,4 +95,38 @@ endi if $data20 != @ Time Range: [1657441840000, 1657441980000]@ then return -1 endi + +sql explain verbose true select * from tb1 where fts in ('2022-07-10 16:31:00', '2022-07-10 16:33:00', 1657441840000, true); +if $rows != 4 then + return -1 +endi +if $data20 != @ Time Range: [0, 1657441980000]@ then + return -1 +endi + +sql explain verbose true select * from tb1 where fts in ('2022-07-10 16:31:00', '2022-07-10 16:33:00', 1657441840000, false); +if $rows != 4 then + return -1 +endi +if $data20 != @ Time Range: [1, 1657441980000]@ then + return -1 +endi + +sql explain verbose true select * from tb1 where fts in ('2022-07-10 16:31:00', '2022-07-10 16:33:00', 1657441840000, 1.02); +if $rows != 4 then + return -1 +endi +if $data20 != @ Time Range: [1, 1657441980000]@ then + return -1 +endi + +sql explain verbose true select * from tb1 where fts in ('2022-07-10 16:31:00', '2022-07-10 16:33:00', 1657441840000, -1.02); +if $rows != 4 then + return -1 +endi +if $data20 != @ Time Range: [-1, 1657441980000]@ then + return -1 +endi + +sql_error explain verbose true select * from tb1 where fts in ('2022-07-10 16:31:00', '2022-07-10 16:33:00', 1657441840000, 'abc'); system sh/exec.sh -n dnode1 -s stop -x SIGINT From 1da7897a44eb944a03be27360e44152631f68d2f Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 25 Oct 2024 14:41:25 +0800 Subject: [PATCH 294/695] doc: init directory --- .../zh/06-advanced/06-data-analysis/01-arima.md | 10 ++++++++++ docs/zh/06-advanced/06-data-analysis/index.md | 13 +++++++++++++ .../06-data-analysis/pic/data-analysis.png | Bin 0 -> 63007 bytes 3 files changed, 23 insertions(+) create mode 100644 docs/zh/06-advanced/06-data-analysis/01-arima.md create mode 100644 docs/zh/06-advanced/06-data-analysis/index.md create mode 100644 docs/zh/06-advanced/06-data-analysis/pic/data-analysis.png diff --git a/docs/zh/06-advanced/06-data-analysis/01-arima.md b/docs/zh/06-advanced/06-data-analysis/01-arima.md new file mode 100644 index 000000000000..1668da453c17 --- /dev/null +++ b/docs/zh/06-advanced/06-data-analysis/01-arima.md @@ -0,0 +1,10 @@ +--- +title: "ARIMA" +sidebar_label: "ARIMA" +--- + +本节讲述如何 ARIMA 算法的使用方法。 + +## 功能概述 + +…… \ No newline at end of file diff --git a/docs/zh/06-advanced/06-data-analysis/index.md b/docs/zh/06-advanced/06-data-analysis/index.md new file mode 100644 index 000000000000..a1ca53d7d0c7 --- /dev/null +++ b/docs/zh/06-advanced/06-data-analysis/index.md @@ -0,0 +1,13 @@ +--- +sidebar_label: 数据分析 +title: 数据分析功能 +--- + +## 概述 + +TDengine 提供数据分析功能的扩展组件,通过引入 ANode,TDengine 能够支持时间序列的机器学习分析 + +下图展示了数据分析的技术架构。 + +![数据分析功能架构图](./pic/data-analysis.png) + diff --git a/docs/zh/06-advanced/06-data-analysis/pic/data-analysis.png b/docs/zh/06-advanced/06-data-analysis/pic/data-analysis.png new file mode 100644 index 0000000000000000000000000000000000000000..1598238f2cc7ce6fafa1be9e45c9d46f5759d36c GIT binary patch literal 63007 zcmd42_d^p;v_3qWkWdUwdPh+@5_%JfCIC9i0hoDUeF6lQfaMx6JVapk5Y($A zq&p~LGs_(^+XLdk>9N_-|8yi88D0A@I(l+4GqtqTI=*#sMPByLpFajEC+B^3Rh6&a z($OZdS+8h6R*&3rb8)e}YpR*FNXJukE9vN6b$@VRz1}Y5I>0KoFw5t#;irDGI2$=?bJHiPY!{Zdh^pP7YgVJ@BO%#RqV=1l^g);d9aSm}2Xo+s=AQy2RH78pre-hw! z_0pipjO!4Opx_a8rRw7^ZLBUbLiPdNc@v9;R4Dhr0&zj*>B2F6Gm{0w40AW3Pk&0} z%UU6v9+Vpv=4_b3HEkF_c%Nf_f9maQa#)YvyFp!ZlNrQ%ZyLqMO{vtS0=*xA`#Z5st6G2x0tf1&v3nE$MWEd(0KF*-kq#P(~2tm)7nn%@{)A zG^h&yKYIPLNHWy3t(24*Uk03|ios-8ECoG|P*RtoNlG1(x4Y=HP+3?}{@ zZ=W`3_8@eIZD}Iz9j8}?8$V1VC@6`$atBPIFk+qi+p|W;4 zM2q}_->vcxY&Zgv4e!%%(()Q0&g7j}q>SE4d031c1Ip*_1rOCv-@()H333WrHdG*f zC87F>r}oHHPHjlFiPi)P*VRjSqxVA(TStOHwFgE#f0q`2LV+7 zW0lyG4Oggf+LOqo3FL*QF=>VjfCo8q)C71_^Zz0g#k%AILg!AA5={-6WYOa+{r{(1 ziEZ}s3R_Ss&cMFN z6{*%!EqnjH*}`ZGoz;K5#>Xw{9Lzk*bW@2p(76QB4G{!{&4Op5df0G%M7HoHPm)NF zY(MmlIL_Wx8efaMrxGxFhSioxVYkP7`3t<8(p##Un)^A@o5of5-$||4s*apS4~4Co zzUC4jsN;6>-DRrh!DgwBPoLZQ=Xig}+5hTh+?FdsV8ymMvt`0K{JO7X7JsAL#}0MT zUTEq^6Nqi99?w&Tu0uVhVBvnoIUba-W&ld`_Ge6!)|b+z~t z@WS}hyDI`P>Ln(ixph-%Q>c(nG{mjHac>5_zF>bNFDZr6eRFN>$5)5_29ZmM>9{bc5SJ#)|N*0J6m_638r7}YQD$j9lv4-XGdwZFeu$I+c- zrl5HSeYhn5%-7^#-I-k{l50*d8wwAF4)t{VCBMuXyrQKNjSxTkcjvIU1p$tSh%56W zi2E(9bhYqXEcZQNyUIKE-g}0tnkJX{w=9|l&}@@~r-FpO^qbQFz9%xQ@a_Xu=LJB} zu>;@8STUA4nN+Bw`Lyym%`a=VX7`jW2O zN={VRzBZ68pZeZzjv=?*EohPlgmMyC3XN5TH?o{}0_GgfuD3Je{z2go$jpG63iqUq zvSo@t3Jck&GMcyy1q@IJ9&f1bwZzZxe%GSj=$x;=rTS|0Lm#=p?BSKQ*QyU(=0>HH z->-1X?R@bWI{Od-rcaRI@RrjXcnL!o(0X$7qnS)3+XoLGK0$Of)4~2`i@~d|*Q$$) z>KyOs5B;B|K6xEJK4$a&A7$>Ssz}f5YFD$jj+|z>6Q>)T>QP<{qiN8TgmGrvmo=wX z?A3G{ufkrQyB2W{TPxoX@AUJpd-sHT3_Z#4-iwX*MVIJDURIlzKG9I(9C-whAWb4g zqpvyKU{Q!N_W+7-z4`_lhLW)2+0hh(^NZAZcjvDu+r~#t%xsOdku`*Da%XEd@j>;OZhpFcUq`s`UzWi=y8s|n0V}>&Imvo z06JemfR@GiHJ>3h*pJo05_Fs934E%yF5UD(f<!EO=g$YK#SX-Mp^LoITihRm2vM`u0o6P zfBZibhFR07b70|$7d&HQq}X11HE~4XiS!T0RrTvGwzAptx0)1F&=_F3 zLyg>BMy)?3xqDzqUmZR4Y17ur8X8#>B;v3HeP02UT>U&nLQMt*;!?Kg>ZO);q)`2J zqg|_$L~~ofb!CcSJf{f6cB?QcQL|{Z$3EV&1RsdGH?0^(F7(~xa+i7({4C|RGS(D< zw`bnHlHwyE7VX8C!>Tox&MhGVm}eWTd{nHsYJbz!IfY`!XSl-uDV8Cs;M39jK&+{d zL)-;A`iq;orgW{I47|K@<1fD^abUQw?nItvq5p;)2}N9{ADPiZ9nOLHl~M#1U%xPC z1j7-eoGtwvU`^Z4U|_tnlCOhiz4Y-92WK^idGI; zcLP}{p+w6p^;V6?>^#6B##O!+Tuw--&Z~^sri`%!rtEeBZp>4E4sD|>QK%NygG3a7 zD;@zFL;T4L=pP(ckS$W2A3t8)ptsT8b|#F!icLJm$QJy0@6xd1EL+r``hy2U_&MAP zLS8=$HpGj7PvWW~!{&a!7%uIQK4S4*ST#ruH<0 zUPby*px3{*f_?8wpO8zGvnf~L=c9&lKzPP2@`w4e>`0T~9(Tv>t8$C`RDoLxx9~H) zz;z920`LjBgp?t;8(6*wrcp6V^@Z@N3>A(c^eSaslN9WoMrfMgQ>{LPkg{)pyY_Zv zPO~yyev$AZFR&y$Nq{x|P?rsF2_$4;!Vb0{g)eopESDS22!>^gVtbvR2|6vYPP=kj<1#qD2!|? zHa}2vQnRKRVHwGz*ll!~R5(*-18h}X(|AN#!J=}pha@WfzLBO8?y{kL%X*UtgLCvL zAH>Dr6~sQU*g|+YJkhx`bDQ(}8#p2z^4jvbyJU#hLSw;ze{@J5Z_2s08Z2ChIOf0* zLIo{fBzmfhdM9PbfJSvjINp1(-ZuZ{sxAUjdVFfSd_Bn&2a%sIZC%g+_Pjvr5#&@4@GL}jI zF^yh##&8!wJ+Jt>mw3ULHbiRpEm^%ZBeSip??G;tG-bBatP;Q6!^_ljk5qEoB@9u{X{+uojR0n2!4Vf3N%$@v*okD!LFoQINOx}WrOJ=} zE0hG7ew_<~eX;OeO3=s~`mYC3BLqi1^I-!`!ma01lG3j;4?Ep_SeXHlfJ2_o2%;%K zFlEMxucru9Zk*fpY*4VO%Bs!~AUFuyhn?h3Y>UA^OjX?UXEnUJiPRiEK)ZJd69{}> zi?^JgAjvFnN9E`^-MVT;WLo!8W|&)%mT_RVee z*`e3pDe40WiL*N^g^2l9D+cpm7beM$G8+hRFLQ(I4C_j^psGhZbyD)580^G~kA5ZF zC~mcDKE?AU=tnRs&dJQthnX2?f&^c_9%grswK}q;e$OQech)+gRY~h0VxA(aIHcl5n7!Re8O|Gp)e#D+5+fFZH zd-WpwAjRJiN>C*0>1UMvSN)aoBSs$Ymrs6cLkp|%>CBjkK9EbzjREV+nCz@{+Py=w z!jefrq{$ojZfM8>%R3z;^Oxu|5wZDLX51JBQjKomI3`jas#Cl6rZ+Zi3PWhL(2P|K zUGSmIet1nX==kaXtB&x>NappsznG*HrH;;= zXE1n33MRjR{TDso;toT-=8W%iA!XlDDZi_w7@MzxmkjT@Gd12h^&dmhrt{mNRVVs10HM#0DZ{htx+V;ez8*#LpW%7 zf2`G53_r4aH&%8XS`RUX02vbL$B4#;T7QY`_deHZmcw(B`tyTR3^-uMN47aMV+c3n zuEvqQ6v`CB!Hwb7!b&UQx`Tu!V1jzimB?=Uns6n zAk%nS?GS5^Sg1tus&{@;aDb|WqB9f?C3$NjinNw(gT4i<6(eFV@6+A=(j`4tx*ck1 z4!DWaybqN1Af&Cbd+D`ogvKPURy$^~FHi~0~PrC2!holS>N zD5&K-Ep&)e&>A$Z&xpTh{&wj@Id%5iof&(Jm8uk|q+LUjbn*;XBUTd=-&yhJdMRiY z1RI6;kuN=NnmQ#XjasLwi6UiRubx|m|K6`w#AG{4zzGuK`^{75FjsB_;xqnB9FlN> z9r&tyr&#QHQ59v36DH=B5i_nv+J0BLm!*s>-SWsv5fD-&;F3G2+wYXkitlNk*qt{d zpXdb*s!tnwVoQvnG~z{tk7|#*=RIZ;-ws1dMl4Z6<19F7z2K(jx35JtSHT%Y2j0H% zP<}*&xFq88*^wCteBc6Q4nQa~*K4S#U!_QJj=WX};otD7NQM+)?#a;q zU#Z*&UKI^=4m(a?kIG=hFPKNaHGWv^kWKonJM1s-$Rm? zvBmdO!NBkgM8P)GWfYBb@HJ6q0VgXy4F6YMa3SEBzg=AF3qHF`1<}pCB9zZgwj9Mh z!tB4eC)<^yw9o_7YkB7d|H_fezPBAe_ucRMWc`l!`1eh|Puo@*k&M3{;A{VoA$M01 zn_SE|EPVf)(ZyTUB&1m!lgFlb+ac4DtmSeBi=A7{VW}g+T9^9kELH1MZuC+J5}-&H~A~mV)FFn z_Ju89FR^paN<@sxk^j1-{xn9;{=Q^T=cWHGHrmbRnM*&jnFpwhoh)bEaZA5E`Z$SQ z(?Gx_KXB*~XLidx{7u2~LU_C^;pC*O3ypTh+9dvH&l!Dd_Kl@;#(BhIx@L!$c)uk= z<@;)fsa8lD--^=8Oi&$d_wN1P#$m3ubFBp~w;td+UWKVW`t;Q5)f2id@z9K^0LD;QCyu?@ z)N5|6YE3^Nq>AURm}X8^^&NK?WBtix9=kL1S|}2lY!Ig2ktCjVop^I09B@XFTuH@A z$~xB7o)7z~*eu0Bg98wWt4)$P7fHWP?eP~u%Zj|J-|1(ca>G{y;SLa{LdIPT$7z9U zUDq{YwQdm2kZ>gac`qQh5O`oO_!J@`woxD>?1E4w4`xlRT{xKBk^`YeynDy|?cZ}; zr5}dd1V%~S)c!X71$jo*YZ<8T=6UA$pW0W}i?dB=>>|F}nL^C89SIiG2!Z9qfz45_?L z-<27992vJs7^tM!{lsed`wg7So!_O8iWjh~KyFx4Av}K+6u|&NkHbb*M|IN2)1?O0 zEEk8ys+oSgaba9RLfMv@V^@Ewbm)yT~yTT)Uz=i+R6Q5H!-+iMs#6tg%v>t%TREO!Ird$PlA>}7i9QJvv8Bp0HssSzyg+lN)-f0 zLqSXb{pxn=C2<&cS=9ReXr2nUo2aNg88^7{ih_)r8%+aWtKYIHMXcI|o`b>eJwe$s z%*31Y?)CPIzZ1dS)r2h{&k*C8GUODI|~K-y3*cTKDUhB7JuFr?e-hY%6K>;vsi5Gy_MGzFc`P( z@17T;e|gkcekH5wepcp6^+}+=+%*8Lcb#gBh`LJ;n0Fn|y&ex*)NSb z>YLem%^P^qJn0%#UOug})e^kVx7c}i>)8i}aRn)vmMxiv0VA8W8%f($$v&QW4MerU zqHhq0|L_l#J`67PweSxP2@Wn5ITQ^pLe&>!?ca3r(^0Y*whi{aRoi@JRA$6jDJ`q| zZdS;ZnX<*Kq5Dg0SzY&MZXN2`2RnNDhdkUn!ayW=CjF}zZc7F%i11octU4QY(oBma zgZchf%zy?@X#{0$Rbz``XkGPxW)&oR7HZm813Cf6DM>i6{>_*uI(j05KSu&V_=6p%fi$L=e`TkbAqj6H~n;Z%dgvcUd+=0av+)`Mlw(pJUndq&-kIl|D+rO4e?H^3~GIAl$=PW?7NY-GQ|1r1)K48I*vkiG=L+wQNH7pX!DS6Tlq2{P$$44B`C%fA&~Dw7Th3ZQwDsm4IbBfR0eY*} zEwbano*k)nAK8)k?&gByab3uU!jFO}35=|Uju|6L$O-!@ zh2)m^CByC;RA#H#r4Bv;AxV^+BZ04`NOS`|h5V?#UnenFgK2Q?b zBL{S-O_6=O^kKfx2Zj=RTFumA!~cXBLWA#OkWkzd4AKRo6-p;H2$RdXE2~9d{+?UN z6s=?977f10xI_$9qS`h0?W*ogfe)FT>4?;~&zV@oUm#>t5wU5*>b5eMrJBh#woV>+ zLhI3n(`HaliB)ys=P?_z|5g^lqeFFPWpLt;(rvC3?G}O`ju?YYt@-UIu8I_dBMQrA z)}KEv4bY$S|2?WtVc9Ynp3Q)C5Jd=7hyaI{`HDFd#)6yZk-(JKhT zSq~i+3*;s*p|QvFLcfXg?aW#H$)*h#jvn75)!oK{KU*f*x;*NELQ?Zd>;5uf=tuABqLA28+=1(k4n=u@E+e%+O%(4a;-k(ymk<_VE_I=_^-D80b!QWYk2$7gM!$s*W($3 zdM@ApT%#a3E6GXxeyi~6V&V@D>&_sd(U0{HLqpdNz!eUC=(&?1Y|VqJVCE;5E4^Df zb(5KNhRvwiPK|Go5Q)NByyS=9dZNnB?fXxkR?i5UIW(%MGg~}p_6!+29NQo9IIA`} z$sDdSk}N7>aQ>0Kh}(cmR!oV5IQ8b=fs-aJ-G$3VKs5#1Bt}(KIj9h7pkjX4|3+0I zCNcA@EInTG{+GfiMTcw+hn9)_{SU7*Ui**L9+ZTe+9fz_RNPA(tWjPJ^q#wbw`K5N zx$-UKadV?d{+A*%O=;7pTqUfrx0bo}@C~bhXUIEW#kCD+&o??QY6m_%-jEQ3D>=m4 zn8g%nMZPmeTKjr`oqlTQk*4GQc|!Y>7st)w61NwMdw@1ahemPzAYU4E|%Od zn;`5_VT7@)OhE7-MnW+yj56;^5zL~pfoD+)G&pO}>M91?4!bD4meJ>;!Hd&P)n0XI zdAjw2(%*BSb7g`Bh1J@(x&A@yu4I6hhG$|wzZtjlD{DsK=T-KQuUo2}@7qezFFgXS zQ?7^G=n@`Oe?y;Rw#~XLTjI|agz{_I0$}u5kA9Q=!njF$&CA;)Sm}q3u8#`3rx>_P zR7LD0-K<@WzrCmvb@2=|TeBU>thc6QwVDe!5w!H|7(*QnX2oEgX<1mZqRV97;)VUw zzUqb-wY@YNX;+;TbDnfPN-%;7-Z}p=ERA?|U9NQFdQRfCVS|xN;XVIqU$WnqnHRK_ zOLUzu*z{9_ZIXw`&F&V?*auut7346Nzm#^c`9(z|rc$c}VRW&0BfxFmPuFE`-)1(f zj!*a%`ewwVzQUT80py2%v#K(9$Z$Xh?j0@BOZ$$U*mx6?vY#?n(X6_aq9q->T2w5& zDA=ccWm3MaslA>$I}jd{(j=8X;I6eg`6QOsdxbsQHtFW-VnGe{X5G}IcOrpunK#uY z>{9aVQanb5R`s@XPD|N}W<)A#UO{3cF6hKe_-k#2R@=W~>A1(6j}^>N!q*fsdi*3N zVk=nItUW3M+=K&N+brQtl8UC67gYjmtl!9Q333@U&DvcO$+p$8tI>vS-_|3G)vJYH%+niRhjrd80k< zm_;x2-}X?Xnzj%e`zJzI_E4jg%D373&sS}KF-7`8o~XvZoUuO}ZRoczW)Ytm)ZECE zw7qxZ>ZEIWU2=9c1Mc1hMkCbQ9}@PO&u*KYXwe(qFM9l*&1l}+)$ndt+3|>aL+K5p z>43i78u4^qv7!a|#Ng6T+}_alW#8V9D~bPl$^Y{W(L6I}#CDN$*dS11&IGYi2$iH$s2=+9aSX z`fqK<$3O09J2|;Shm_tzBqAwfRa;J=D2raGqV`f@#&0Mlf2ie;Y5NxsVRZU0E^g&tLNe2@qTT84vQ?AX z=2?2yuwI->Ys6=bY#)7I(~4i8z9*`{7c;WNyC>~9eq!A^dXKVv(bJj!ccYOEb}JEA zh{j4pbyXXXKm(B;&aZ7>&CUO0k~uh&;=Xg-b>>#_Rne6DRWrMX?!4Fk^+~{YyAhY@ zh7I0yL}#MMth#-u66CJ;-6sP{S7D2T*n5Nc{qqWxn?D=MOlC=m`xb6EYi$Bu zX0F3a2bFQu2q2X8u*7<~aMoj^E)J?I05mH3?$5a+n(#q}YwRgrPGD_`4I(HIZwmC4 zTpH)3w8*BU`e^Y>GMZIzn!CkxF`_Z$iL_QaDt)Ea|dPk;b1Vj>YFItD>WdH(O-t>^()EPQ2JDTRF2!Qihq2{U+G+RqVO?r?qL?Z{5@; zU;k3f?b>d}?_U^&(uvO_W5exZt~&Sp=wzGXw7ly1H=2up*JWX3Pd~~m(y}|kH?#Lw zzqAD>A+Ly0f=M?Y_OL2{4xiE;2&+q#T)G`mZ0(mV~JOlmg@$;_5ct(LS=9>O87V_ z1!;CgAn}wuYSFw7h~s>WeG+fROR`rjnQ>B0kL=qO7NlpudP~R+WSzC=9mc39AouIW zbRlT(-Q+0MVReI48hg$?o`q)7`nr$8RHXggj={$Zc|)fiYEg<0~u*&rBkIP z)FVy;IPjtnzNz<~-SJ9;5q(RtSB_=+na9rUW#65iZbZDf-fwo7iUnU8xxnQ*7r~e< zW-GI^k5`^neC&N^2Sw*8LQPswF;Kq7^q9MYsf;&~gUd{gykl)=g75Xz$=S>QDqcv* zh+HAv%#9zhH-El@h1pzS|0BM>^+Rg3_>|KU^E2laYl%B9agMx?6Gwjx-@TX+iGdBv zsdv)u(=YqImzb>?_%-B`Jmq#fB(Oy0?QhC0%I%0TRG{uz z%Kj*3vdyC3^@sY~PvMdDs`j>CgEN_NwlCN;8Wedf%(?Uoq0K#IUk?1ieg=*EEfU}C zqkxNZmnkP1rEK?pM7~g4d%@p0_bNWt4)uGG)mbOE#{5+dH@>)KTngN-C>;;z_PVJ3 zbID)N8i-uIw$5=?Ul#d0x&NXy67%QDhATJ8;c_SIMge47X9zw2xGJ=|^pq`mJxvU) zD?y(jxts)KZqMi-uGU79jLKs-!z16N<7}2NPw=3PW__EU*OR2u!cTn$SO#bZ*5zhvzs_%26+0Mvbv7-8qY6tzjlsvtlG)ODujaq8~CASTqv59 zE4e0j_II}Ii?-Owy0cWtw(K7x$QER>-nN4WE^Uu&A*P*Cqn*M+e~*?V`Sa+nvWz#c z7*>Q#i-_yz-#QJ9-tB5Weu0I@*N?>_$_o;l?1s5XV!9Uey1Kqy&wU*J zT<>ofg~9uX0C=#$@AonjYx`4-<*Fbyfz~_m>pxoc;y6DZhNBTMJz9>1oo6+4qibkD z=#?RxD84#%9(4R@`28Jq*}YboK0SSf7U^~dlb5ZsUjb__%=o~*YWV6&OXd4JtXu5ypm3dmQlN}PQdG z=~Y3bo!8fR(y1-$|Kg4~>|80go-4Wde8}M2=YI(pLi-idpD#YfPhO4a6ABxp%}YQ2 z2U+5WJRR@-;)!aZRf>3{KR3)C8A4;1bJaMHMw>%`E2HU2euAw}$dc#ZaN6j&D}X&Y zR7}=U-4$g!y%ixiE903q*}5e2Aj!oC zLBGYgUtGkT^=-_)Oj??MElDMs6>pgONo(MdvC4qkaBIC3ytAc%$+q263*GvGcR_k) zrdXhLK`Tk-3?Nf}6o&e7yRqq~IDt~`cf}wpP6jRdOZ{xIPYAt3BD4G->*pkGjrmC^ zVO_iIqKjwzY_eRaw`UuyE1D!kzCJOpuSFP2#4tIK<@{2o3sF$wb>-FKkMx^U&5w_61;`qS0-qgJI?Vi9PQ&gN57EVa`Wq(nFdXV#MPP9Ns z;`kkGPl6%Sx+l=pKYF}Evk|kdlOP6@f4m?ik&@j6_9jJ1zWpq6&fm^@YjHLs=S1mk z<|_X*WnZ4AfF0ln<|8fru8S-zDx$!EvJOrYyD19q_+P4L`xJB~o7I|o91z!X5%bN= z>y*R=%ouRbe1Z3VeY|;YHvePRNVpC&g7NJUQdf7Ne>cREx$foyg{GH?9hay0nbcI} zKgN&Ripd1shh7SuE%~~#;s8*K?}*f}zs2CcuUj^R)FnUCLe?nC-!>uFQb|jB9YnYM zjz~+^3oStcT0zq3&7uU1rL7w5_TCu0FX6xb&ps2CE-P#AgDBHk)qLFI0*^hjzXxYq zunKdqBJ5BI%|_2$!N>^xd+2`e+i6`6uCB`tlUrJ7nsihTlj4w&4Nwy~qpkkQ+c_vum|0SG~i*iFZN>$wAVgJcho%EKM`7;eUm3qMP_rusod+*R`XEr#=1o*2UU z-L~!Tm0QfXP#j4|!m2%VW~`(gpzZp8xSk&|Z=M&EYuUhCJ^R&MD~2pAXU3!M1AAti z>vpRG>7VDVu4K1&cEl@I%6cYX8<}D~mjxDl-w-g9UTB=gn0xwd>_C>dtw&GX!db*N z!kPx?<7?=DW&OUHItVBV&igc-Q$T+$IX|b1{Nz-ieDXNCEYRH?IighD)6$E?L$tjN z%|bg)gHp&(V;UBu{okf5pQp^NX7G@7M3w%#FC~-v``sO6_dq6J9?4gONmgRw_Mptx zKMM>9F{B**!$Uf4e;UoJGTcKILMh`e;OAei^ahHD?5a<)*$vLfk%vpZI1wB_zMAnA zGRVh?iErJ{hP-ZKmKU}0&yvE1Nj9dEzbg*j6Bk}J&$f%Y1ueZp>yB+UjeoCb{tWi{ zd|7%~JiVDc9&|lgk$t6dJL3~X81#;ueJPL4@;^(KRv5{&W5H&7ahD%HUX_49Yj^)9 z@8<*k9uYaFSqvUdeE8Heka-W5x`*Zl^2ZV@4vGY4x08?*l~uEek;|7Tkh)`tEvB$)li za|i9NBx!oN)wTyXenhkPn0IeDck7$l!>^{qw{} zN>&K3eUL(h+(m=s1vyKVHD2}%B=_H^(66B;rdt~+l4!W8ot|9E|FWF^AmH={5qjjD zcD=d(d|B`Z!i0nU6ksVp`>~8$L*^1QzGFm5-eUCI>*BeHTAFoZX1q%FgO)5PCR04k znrwH18Se{Ox>?qm5+RDiTazg7%b^fn1Kl5#0F}(0#E~XZoPB$jRQC)kZYu*rAbRGn zjp{rg{3Z*9s>2uPplmJ#e$(NuVb+^Q`Z>Wsg?HDEdL`gnv_*y`C=n8ka!L4zW*zlV z6oLC;MhMGK-W}8=t8==`kK_lq)Ch$Eu&4nX%FZZX#|jCgxZ617N!YbLl7QO_JBWKq zYSI7I$YV&DNq$7O2-0L?#m@`d%02P-vNf&Lo_**5^dq34YslThM6~-Wh#s<(XmT}p z-HL%MnW>iJA%hs`_IPa7@{RV_oA*<^!GaVVjIQ8xs^eJr`S?Csm)ZT1B)oWr72nr` zn8#!%&^}q57ocRpp{$eM4t~CGh5x7w3*W3(|(=HNZVG9NrlXSCy zLwTg^Td%Menl#w=j(I{@n7AWT3JnXc;nx?K3Z z8@(<#6Ax)xv*V}Ui(rn{dB0VdZep>Kosq9wg9dBfP^vs`7#d_CLY?aV;%U zHqrwG)`&<_Wh=FVUiMWWVJlM!Ei2rPVJSJVz`^tr{x1 zVU|cz^LjDvP7qBj*-k;Pz! zz5Q6v8Y(TLCZp@UZ4k6#zo-XhHZhi6x?l6V(YkhETqQ5IwLBDWc)Rv37NIj$Y-y5zsgynf3u)MR?+Elu$fNLQeiVMKp$0j*$ZwJs zJzwd>B%{2RXmcZa`^#<=Oy>+dmRQYa!rooJB-;ykW7*)J@f?@j`RwioG}gl}nX|`- z`iYCG;?d+iIo!rBUlS~_e2WB{ozYcu=dCT>3W)c33Nu754#IhsnS7!XF zR3FL#o7fWVqzj6)YxAU6dz-|NF$60ATn05kJKlM6^>IvY=eC{(lMe@@51o6f%5>Fg_H09gD#%Hvs2=P)Wjhw*O1+mXsQ2`OHH#|sO z2>IBM&rYfZMf^XI^`%tdGkCBWlbIAqljNpEPrB}xQQ*Lpmtj@bNmS%^^*(=Ou_^vT z{Gen99a}6pAGH|Jj52qs`ePz^SWEqKwDhB1GnVd6dRCLvKU?%Vf*9l#X?QCa(OlT` z%*O7K#$?-)wOBe(V(c3s)==HYGP6mhgP3KfPO`dkL;hFm=GahB`qzLRuP+T(&;B8^ zft`U6^X7FqscX*z3~ntt2X=&)K1-_iUfr^di0yduw#1F=`ES=ywo`Ys z>smcre<%JAr(X&s!SI+HTwX&pWq47x%jVJ7#SMGbnyU1$J`hE<6$XDS_=$+Y_r3eo zoiJ5*&Agv=BUHrB?w_Rqsh@(nW6TUo{$(XcucQD`q>0Bm)wJVK&OR}Mv*AMf>4Bb!kShE-(gh%g+c><9LO;D+5oN>8@8y#-RA*CA zUK2fcs8>n-vb+()jVY?v*=`s*e|&quk)E`IDywU>v4$Vvot)LXfUwg$ne3;zm?*92 zg#7e~azD+HV;=NVm~kq8a7BK4&)CgUvGTdikt*EFiS4gu^*MB=xL44k;Y^$TLLi1a z&LlPY6lFR4{}ik7tf_YS zGq0%9le6YWsej9!AYAnl4Gx}`-#?G(>lN_dE_)`xmF0e9o*VzWmUULa6IwIh(<%?{ z&LNrpzM7xhf6LLgy;Lmu+NFWUoUc`rTszX8C?TF_>(5)6A1v+xB?%_?vzq;1u9K!mtJV5#-gx;RAWeGfP~>e2q$|)du_+A; z_a{b}7g(+{R%Et?t$UaIL2g1*vj=aOyhM`w`KVdPI9}5h`C{D08A0>yt}cX}cqp5k zbi1Cq@?i+`?hv;XBL$6vSG?o=e_WFTI_=C??}{D`%Rc4rXJdTk-1*IfPQ~j0@%O@m z;&a6{4OX=FicEjZBe|=2hQ~Z#;`aIKFa9u+!st@=K7DzaNu;?{`iJEN$Kh-?Qdo#{ zOnt2o_E&D+e*9%VDmfOil&kD6#*fQktw9H}EZzf|8faoBL`5%)t7?Osd2G!{BK-!8 zJs&MNj|n9KZWihoW{Vi)?vHxdcl_hckNFshq+zLoVM#Y#oac+lU+Ec^M|Q5Hp?B_< ztP3TTCwpjHVUbeU9>`vE% ziO#Ob*?X_et16O=6i4lT+ao9K-=YI3uDIFyC_eh~AYqJmLr@hZ8fnaqFAloKh8In& zA0C|Q^1gRr_z~B6g~Au(u--%sx9+Vk7e4=vg}BoVjB=V8q&4S=cyz>J`e4qwUZZu7 z4q4dpm##2YmzJacf_%T+9BE51Io}od9(EgXoGV9{eIE0k?YsUo60TA%dW2&0G}+q! z{QU`wmCVGW$*!2IVIL(rb0R%{S6RBHe|nB)d*3;Z9n<@7(YjcTO32BDQF&TpF5}_r|x-MNy|a zuKR`oCl*GnP15V>i*gBy&X9aXKjFTScF*q$72)srz`4f_f(=cs8q%CRG`-(}s*m?C z{7sG(hbJ8qW&`AxTz_1x*myX^m3*VyrCaUp^`_&f>aMHe{0T<(&Aw4HzTvhe4YQAL z<6Yk3BbUGN?lsYUNq?XCSjT%nwrJ&lXFkX*B9R zd#7f}R*K^k-F05`fqDf*`_^dWAA3uExn=%;djTvo+i0DxU66P~?qe;%!$rqqVpX{~ zaFHq7pf+LR#Omdrqy#=T#;1}lZ|D{?sB0h_raHCyeG(SjQlRi&j4R#0ZFS-c)~!oF zJwC2K{o{g>Tvygrq{x=(If2m@|Jn1sld6Oe-x-UuqawDR{ywwihm3Z3J6jnAkwTff^_FS ze7^VlyZ65C`2!Bi%ro!j{XA#RoU=3U@mJ}1b9ekbQ`*Xw;UE9&l^;DD>QY>_yZAVY zkAHn&;1o|5Qs%8TEWI-~Pqy|btEReyHt^2$s;7JPFll_4S$gHC{`hsW^qW_cvObcj zgw)|UB57HdNl!k;m|wp37jg4Z$vI7_>%WBe)353$e(OG^Y0fD&prT8{+{iL ztf&7SU+#%=Cz-nB6}(kd62G$1c49(+MP%d+~a4 z)NG;a>Hj>~ut3-vU;n_=%snBqI!0^@JLnRakIOqUDcutB7>E-2!B*aNbIwnGvIcSB zXVLBm-}O};kq5@l*6}bD>N+s{&8>$!X}X*Yps{P(z{yXDb#Zc8LF-2PsgXrH3eMe7 zMyyPn}lg2qn6cu@(K`yi~j zv9U31QyFQCIM6u#ftT>qs*FSZB>ZgeaPcsH@n8P$Jwu~jln0_ST~xGsO73iT)WVg0+WbM?c0oBoLct!8y$o5>qSrB8KM{EKCYHsZAMv=Z08DVd}6Aud!1cR&a+IOz#wPj^YEsFFz9d<$w0lBF?R)!~GCk$6k;ZYW_ z!3*+9`E41qF=)auS~^fMyP4PThXr$n6ZOhA+c z7P~+MOBN_&5+?BUVf70&cp*Q6kVtd|R(NP+r|Uz&Q!o>gcl8QO0Yd!3)CiK057Y2B zoS5^0Ff3Y7EeeZgJSo)%|KQ576HhI$2^vMg#Eb=!&<;B+$DrwPn*)}{_yq?8_Jpg% zvB?69{s-#-NJ5Vs_%Otr`r@z|ZNT-y@w8P73(w$`z3~{)IgIKz!rCHS5QG&Mj>3Ku z=O742bzn&b*k%!cRWJ(bOpQSW0p-B$VFDE82qg^m8y@8=iwmIvVFNgvFd?5mu5V~@ z!U)MPYQ7PG!Q#`PY0yta;YL@XM-L1q+0nMGc>Te^hlEiZF4HL_v7f7nqwztpBaJf5e--Yd0feYrBot&yHpm{67{iUDRVo>tERLL==D-dI??=pp1tY zvJ$?~SV-uroC*dJItG74Y+)BXZFp$79`Mm1bS9zm!@ht`9TeiwPY2d-V|4qAus;H;^_z!92D-X-STxcNT` z!~6N;LwX5)ci6cBwF?lb@YR3K<3d@0UgG}^@_%inzx~R7!SeqD5+;^94VIihPr|U^ zDXlLY;iVrDZ(tLZe*ed!$VKq>KqTDGHGdjdM4|@6Rft#;w9Q$&WAI;WZVv}jaKaR1 zpq|6@{OJ?5%^AK32b@N^2y_1iKpywOtXZdj56@c=W~2K4&RJg>?WcbqR)RtB4I=}H z?HMsD0e@|UG+!<(FXx|Qr~=t!7T8mXA$FNIgoPvvqL5zpH3m)M;#qh?G!Fgp& zQ~X=RoxQvm;u?%=7cSFJ`I9PGJz~dBVF@Y6;$v(Pno&IH4(NKiSYOK2DkUGADCRBV z3N_sx80fD*>&#?x`5C|6UY*syOk~R?l*3|RhtRxEuKVGO7yYNX>3MyMNl}amGDNOP z68T6BzIHWvD#8M!L^BBxCAIQ4qraqyGDR^>GiYP>goi3pX+JsK-P?Fdh1)AcieO4Qr$ zoRj>zV-TJjK`gJ7W*Sa2Ibj79eI6Q}SvelPJwLs<=Q}K}hAP*LQ8#|{-ObS0Kyt|1 zg?HpQ-^ez9*lStI6JmWzY%41Cbt~^~yn)Zh`u=`h>}F^n`KspaQoojbQ4G=mYGkB) zZT>dWg>=uEf`r7TIi%^(EcMai{Q93>@+!LyIe!Kd6sg< zq#Gz`Y->!@aULQ*ph|vWCBmzI+u_Bk!%m3OUsr-1jqA9}b|?Kz zXW^mWo;s>rP-LwMFTv^eZtJFq(rLzHXVv>+R`nipQrclnz2Vf!XN?){KGjA)vwOe( z)%^PK_xozMBQq>`I3+LP_> z6eDHhG?loO&!u_>70nF&a%1nipKNg}{di887y0yVs06Fot>a^`szJAG@*!Rgm0)d5 z`8yPMx=A{c>QkiI?uh$%KpRnVj=Qjq1;b(-{{h&YOGmt zA+RNdO=d>et~?Rkrt}mN_LhkT#@ut#G1c@>KE@paDE8+fJ}=QH=ViLuLUZ`b`bleA z?d~t)+O)9${z=*0ud;$*O2r@#8F*o@?pp)f|7iiJsE^-x0nc*G5d1L@o4j8i|;Lzv4`0|515S z-|27R;Qzzq21!!Z1vU|Ahh73;;Ds?53MbYJB2q7y5&t4;3!f*NEMHVLy`ysh6h1b% z>Zg?9|9oU5fc=nu5^)hTVGICik~D<>i;;!sqPhQ^`md6T+6onHxiJ8?jE2`BVF{!! z5PI_dSC2sgE^K*$MO#keg1@93qKj&{`|WpF0C0H!k@@0NGsMybr2o6&JQy&ic+MKBhC(WNIJ1TN?vC2V?z`;YAFa^JW= z8Cbxf%E>H}(n0+;iTVaWCtAA-lNf#8UdXIW2q#B`k4Q|AOYGZ>=O`pdNO9Vdh4Dwb zmo1(b5ahvER7mBB-rz3()iVOHQP&k#^kK7hVt28pEc-}z1%QymRL_$qxkbs^;!UWN zOV3R%ljX5e)(*-(A$dH_X*E;$;ek)S9?36nbLPb#Me;2>X=k^pFl;H`ygP{(+GRK= zO#Fkzj`e3Ad{nDQWJ|7`ty@jd;Hnb~Hs{uK zl`?g@c>&zbGBZ@7nY&G0lL0U3n7+W(28SX9k!}Iw-4qZKj1# z;)EBwb^~f&5DyqsJk!DG?Z;JzGum!vf@rq`Q%t)miFXJeR__>!s=97-^VEm+)u*AJ zTY@iL7TiGe_UPJ$IlRdLb^~H26@9#1QXLUD+OqA7Wfa!_ zOUcSiiR{juio-vqQ?w2{2d~^Njf2?gd9#wo4rBhDj5ZF5*>oIM1$_R#xst9kofp^Dz(8A9d?|t-E65rzHOVo12*%OA2VcgZWoj$v|a^H&W_RX*%w0 zkhymSdmxXUQNh}WdY&(DnA{Eac?LuayukCSdb(YF@2c9#h50a0&E&k0Os~eew9*2K2I@o373h}RrpS{t`LK_xp z@+SAq1o4Md@sapD5mt+&NrN{`kJ=@s$)XxcB~?Ru###4nFmc}3bJ;=SP%{#$c6c>c z#5o#MzG-KHMls~-jo*Rhc{Yt{mBX;qP9M_2|J$0K*xo+#!~2-fJ1H5s65Zd&TCnzx z(RVO+cb46^KcC3-RGm6 zKD_ksxpS*h1DE_*W1YV*QsUTZApY`k!wb9w(N>2yf~@zZY!ZP}pE-JUe=rSwu!>jy z3RJ%J{}d=qja~imoq5q=NmdgacF)W;ZZ`GJ5fIrfG&uZ2_nmpp&P&SfQlm{j$H{tC z7vBU>KpIYhqQ&0k7arVU$NN91d2+h=;>i)pKSoUc3kzFkQ{Q*FL??vZv4mGMfvMs* zoXfT~bD85}7_VFo%k;7=a|BtQ54b(ZjK9!J`nt7+M`3m5tK|6G8q7;@M*Iy*1Xob# znm>Nek)5W9CFj{De-krMrTWSpZ%?XNaoiG8LmaTEA+O#7ml5@3)aWz+=0Efs={_il zeXD^IC4UlwvyKI?7`%iRG&k60C#li*0JeDO8)2l4Po9(Az=W5N6Sc+T6a)!!7*=DDn+!|#mCm~vgM6KUN?XdDOOO+?*Nz<`+zp#eT!1`v z2%Q1H7s3H}KN^+5>sR}#!GUEY9Q_Vm+;USXVX1(NlflRoG>#A!f&};ekmlH{vD-`d zK%HE`h3rMnAJhttlyj(yYz!;^ji?4gg#oE#nqO{l>QjUQt0)zWny(>1gGg3FvS+|>DHp0;b9CqZjjCqRS@+spOxp2J|7GdJH!hwzP&gk*c$1g>vAqr zJw$_?d$oVO3oOd{Rd?yW`{}w++_TL|li=#RZZ)OJ!q_4Ihq`kP#Tf;oe)|7GErh`U zJOxTjKQDMD8%KoZd!$L;PhO4r^SB@qJi>=MIptBIfC}>tU`GGrS_|A|^8Al$_U|+z zAWnh>ANuDl z=FJzPAVeq7Vh(5v7%=8fjQR-@H2XNw7VtQWIhTS{h8X5q5dH(wB!->s{9@z{yH-J3 zlPpAs{eHt2ACh26h$7}3qRupc9=KnVN6Pz=;AHt(Uv}BcV!$JRJg!~74!AHH07`qU z3Mac|v2(Riz zS|hH4N?r)g5ZDPy%&d8lG2rL;&V=VebmPV!6r47qREYixqCcd#q5D$o&X4v)eCA-_ z$pV{6GkaolNzw!QTO9^tw zz6eqf*0o1&sQN*jaNhjulw@(?yIoO+=jR)hf@X!^))AsJE?-<|6No2#kme^JZ6L*^ z=8N&)peB_0dh24Xd57V9#8cp)g>XXp!k@wm!Yhmmfv(CcX~KSbAxu9h9U68GF@?yI z|Ks-k)gzvsCszR;=O-@t&8M=uSK)^!Fem@M4=I7KRO$#nT(Lrk3#9OY6>O9as=Dr; zoS(6Uz?k9@Q4lJ~@@RLqp*Vjl!(757kDukQQUVDbWl~Rq*E&#%a_|^!?ABuRD0T%v6dVU#t2qY_vK1jz9X9vW8pIleqr(YFZmZR80tG_9fq%Qu%A6L+ur>VfBZFBdf87^QPyT%t|7d2rBKP2 zuA#|}La1+6s$|TwPi|4dG~B9grQkk?TX z*)um;P6GwcV}jeJC7Czuru`le-a@@xrwZ>VAEjvO>nhKJ&v_`c#wU)f7gYjcPgugM z6D-oz2C7L{7l zq4uuzqksR%@3PNn=5k*QwR?@?H*+m2?|Ub4w6^+uiNPA?FWx7rI4%XpY!A&**iiX+ z&8n&FS~`-K9M3$Q9E`56%?C_B8W+6n<-rv6JgK*VaAMd#xv^edQw} z<9LDjlusXTRSil$^6FhH!ys6lGT+mmMk7K@PUDTNibnhmk)(HxaQem-f=@~yjl$8l zQ);xf1k$%n67;>eQ?BBhJ74v+AzIKEjrVwH3D-C2IZ1Ze=dgl6yM z@s_)n(aTGiv)77*<~z-OQn3xDX2?(03|jKXEq{F5n)UO-Op zEG1pd{3`A0c~>U#)9F-QwnbFKF#YiUaC{p{yOYk_oVd&fG6y_cqR%2VP%bCAM~Q*M z11EYLd{5~zzx(>vo^LL6O-~b-R}}~99ACD`NWU^X^ZQhpxLxSb_R)P5Ym8yFQ#l{q zlfCd)iPD1g%HgW?K9^(Ghu5#%A|(KqhrtUvT^>U*P~1z$OVWOy8dWm)jYSPOS%PF0 zd;tcw$hmwn+~l?mWn@WPoAvbSHrXk^QoM<_{N4TKh(z+%Gf@<}{Sp>p7a}wy z#>}khh|sbb9@`nSe6*J*IJoNJ9~N#Ok5s(VTCdgg-aJ#4r*y^f-mCYCc-my->g&~! zoAV)E#qM2Uakez#5VI<68cbl{4Z%vwGebr9*0AB*cZX{)mmFXIM$+oYnfRFIw+Vy4 z5?8de9BQ^u-lRM&RWIkz(c@x6VC@lTDLP7tS z=Dce^w4`ci0Pl#wQ(Rn3WnJdc?!3JvLm@5A?-jE7rkJ~%Ew8!^@eKP?OSg89*8k4T zxSbGhY^=o|P~-yeKYIj7nh-K5(?g@sT4em5;FZREe8}mgpH^#~L(Rjt=M+sx>Kg9l z4A{$^pTst#_cgaI#>U3pLiLS>Nplkkcd@!7Y8!mM=&P7K@x8ASHoRZ}hy~CDKWJNA zgwmbE2PZAV3bp4wPm=G3mN}ysnXDsLFlBY(RBVX!7G9^b(M^Z_6Pw^;dnO#&7^USvo4IhJv5IOD$=A8SFGx@FuX4HtQ zvfR88Vf6w`jIDk*o?7yvZw|hJYL-duQonq^=7-4q*5AS2(gty#;v7?trg9t9Qktl5 z3DS3(<|+C1x{j^DfmY&K*a_Eu%lo-Ml@`#_2wQ?x9+)`c2Ex&kFYrEQ>>j`1c0Tn- zr8cuX1C3)tk5A%A=Y2@bTe+|;&1{50!DRh)&nx@xh2&?{P5u-AuvPb(sHwpi)_`u7 zy{j_+nL_6zyQ$dy1*_RxId8e;d8a2#o!49Mnk(2+tVTVelw}u{j`)6lu2UmAZkQzE zr}QsAkxikh;kEzxWNh568~M6P)R1L9@!ZNRg6Ht5J9?lZL2h%LJFiOBJ*CV1d@y=; zEm{FZnd#hqg;c-mI`5vyQ>O;4mXJ%bfm#b(x#vE3lt@>)tPk#maUijpGyvVzNVkZ* ziZFL(6yB3720{9_9W{k7QNXf2E!p(3g0H({22`*s)K~?c!+@ig1rx*_`(^PDS(Ka~ z{%~kIz2_kI?bczvp4ZmRh0&{t^<;#&iJ_^KmhVBw>GUY(?aJ<30|YUen5XQjddZ;g zj?a{lF_`2s_u~6vr$MIg>fmZThnFNwoD(Y;&WEU7k-}Yaiq0QwX)!v;tvT~6T3%yo z9`i#41dYuo@K{a+W`Z}E$)MdQOPO&icpHP3h=3`0#R4RQmK^YT38<9M6i(OI?4I#% zAnzgMttCz6A9;TtDB3DQ9GnEyJU7oE#3|BX2dV$_Wg^^N0Q19h&3aQIIAlr^vK+ZR zIk(EF@{beBsC#~3uScAt2NbK=pY*XZ8;AwU`4Zzkenz+=3Q)nZU{C)gNhr5?N+U}J z?S?EhE|eQnOoc^hPzz&%fBxr&HgyhK{Wgn zgk=?iS9I!#-UE2DNViAgNjg#Dbt-fL=!=otp~D6cGh&9d`z$oO|CT;vxv7v>4E}22B`jvSbQIswx*Z*)uyNBm&OkA2 zYRK?={h!g#fmTCO4=g;bQ^<7u9}(gj9r6B%=A~Ev>`nziXhG$iCC|BQ4bn>z`a38A zLo3YJQlNf6>I0R2PlsS-`c+Pp_qRKC1nk%vTI_b+hQ@D=r&w>fd$mm09U1>^F+;RT zUyLY)>>Lb@KurQz&mPd=ToJ~|#m~)}p!AI#Z_hOh!zP**S2x!~g)s}47+L}s_q`mi z=FEM6Ydm9_6q-%>fWRu{`gwwgm&KQAJ2P6xpDnj&)dho{^^YH`&CR^ITl)=fV_ONe z!S9&U_#XI+L-Ho-s&5sRjto-Np@_Fs!k_GWw{o4mqvObf7RrJEv6uqHaO>4}{V3^y z9i(?Kc}9mN*AF^LNP%?=Zzo=hl^SvEeBuA?FT0RsQoFv#TQO*vI(duB_>Z2rh_S%% zTlC_HEVZp6FcU`9rK>6`Wrk%Kv0&$G@~;!)g2b>5i&I(c zwRp9zuIF98qE`E^l!N*_Lm4?-Oe-2Jnwam%T2tbKPi?CbzmNxFe2S+HZ#c-@XUrkX ze+t19bp#t9x100AgVm?nX9kS#J5;OZxaH4QLv8bs4X-;9r4PW5jsuED239M7L`*sJq2AL8+ z#P=tCC#4GXBZX8~wzn)VKPHzGkGcgb{?c$-i;R zp0Tx_g;uLpDEc$gRc(qYR9%H#U}e#Koy_P&=x2?$WM za{U4_-sf@!fZNRsxo7^xft{a-)&^>{5>bgH=zpG78D3SyLCVHQttqf6RL-4*@!n(Y zGXj}tONgj^nL7!;llKP5e(Aa6olT2H?m&&9{sCj#rrvM*Qu=?>VLxY8bu|Kpo!*Q8o3<@&K4=g z6eF~`Fj05-m44&|OFv0)-IuzflS9G@^}Hm)n&iu|$I-R3M_SWu{7Y-PE`Uj%Je2nx znkG>%^}vf3eYj80QAeU9@=osCOD!Q(NKFZm1Qk|C2_x4>ew}WkZ6NmFq+gI53;JeO zTLq#P)>|8IBIu{a4j7qEcvy2%#W%>!9RG@9(L6T69^5MA{8LQ0;7-qrvGHGrjFDMF z&$<77uzI}1&NI1*Jr$C%XW)8C*?1#}j8Is^%k0XUFecl}3~13{U5Ra#1wy-C<5q~@*W0JaBWb1`F#lLixg!x2zzrK>@PqthwWHAyF4eJ z&J9o~zPclR1OAGM3X5pXJ^t(vVE2{ji&R2(7QqIWAZD@e=o!1OnfKHOlA?Y$n&}^Q zgWKR5*2xx%JmCAWe0Z~2nIE;0N{q{AVNx3-2^du>Cl|uFQ(+hL-eEd|gT@$$S{4JcwTpl7)e7%^*9CpWcr!|vz?$?92~VfFO1`(i*K3C3som)lgbT`bme)ho^&r}jF;0dSyZD$E z8=WVB=~9`KC~!cg?-S-+^Sc^nAE`cn88MPASrgsgQ_dfO2Wb<-H=bD&Y*5Mr?ZE@v z&~{`hEmjz>d~NaMr@)wp7?=FU&awhg-M-t5Mc zquBK^zN9O%EM|=C`|yi)2|QYO45LaSi0N2D%2Q(bXpOc~5dxM05hahz=c}42p&>~J zry+QZB!GDa26n->BFyf3WvM!x$OhMH{R(ex0bPDf^|Z#Xe?^HEXEqC}>Y5PV2NBnO z{NZxf6=PKSG37D;dyJqk#uV4v!P9XiB!HL`7xkemdvv`HNj$;N_XgoloD=o_P~zJw zf`m$hyk_HvG=c5%S2kv#A+~1`%3XQ9T)~$ac zmQ=|=tkobqBVHkM8V&I7(xElj1a1WZihcrbb7SkmuP=hYvHuLc(Dhblm0UvJxSn_5 z!>j~5wnX;4DVOJu?7%ebR2nVT6|aBK*K-E1-xzY2FS9`LHU2t&B!n}d>SQOxeUz1O zI2X_VhgxmRmiqfK-V~xp|3rQp?ZZxkO+}cGc}6~pe@U=$h7`txxcpVg1YgNtO*a2T z8so^-yaX}x?1XT{UlT|eqdt0>H4MvaEeDD>+fa3Cuw$DTBFvo`;t5uSiEUe~<#O+A zy$qo-12^swP?Ul-FL7MZb2hqx!x>`Eqoi9TwCz6@zr!zqsg~K#-wD}1&$^p1$6Xy) zORzDq`*gW6i(JU42t)TJQ&mIqk{~=<2(W^*@7dAgzFL?->+sk1il09}*X|(1bs|Sv zs)U$?jf0K3Wr81u|B8?%mP06p5eH1Oqmi_~3w3l&K=k>_LgX8u|5lx|RP_Bc;hPVL zfSd3A?SV+siktYtSI*DFG3fvI#{^NMCx@xt; z31_#Z&BBh*M}Y`hZ%t@bmigzWh^>la5M+Yw`n7#bpl_`aRSce|$G>6$eZ!YdI!BEoc5FMC_r(Hyt0+%g1FaQ{$5 z{;=xN@Pkm}rmAn*dAQ3jKItTNjWsj>{q881_=VHAF+F>5{VPtVBv?tCfKk|JFwusa@t?m~xbHBFi z-e_9K+uFMFX5NOM63g(cHmWfKI(xNSM)3!-+@&0Sx^lXka=XA074Tl8)kIdgr7Juh zER?M~xoRs$s1fEA)#oK!L1k@+wtT{UbrL(_{m8sf@Paev?^#?Dt|bqgWjDEx`_bKa z`!{-cHTn=!qNX%bQt_kpCE9bHb8O)GrIYh%nGs7%{MYD68VUd6eJ#QoUb-rC6L%9~ z4z307_X;VK@AqVlA&wse-mC%>p$d7u`suLmIvlMR(p$-8Gt8iP1Zs2K7r(qFVR;ODIVED!5u-On5+GBE{p5bkbK~@(+}zfp zJ2<2ia7sxPTgOB2(7af`quT>Ki9r(AMxx-JQI`Zt^vz&Oc~IU5;u4K59;mZ*pt7|tc-w!TKJB${zO3f8U*7*o zaXp*XOGEv7SB*m>HhcjR_})fz8&Y}pn^GJFOz6;GrP!CLbx~D0 z{a8OIxt||Jn{?${yVCD^4m&PxLMOA{moc^Ko^!_X{x2ZeSh1>)}s(sWy@TrfkVb`WmgEoYl8cR9bybAmPzFtMtwjNxvLIN&y$!m+h<)^w(JV^s9@Z z2{~i{ziC^mzTg@vZ7G|9mhz!afq5RHVke}&_1|{ficXK3Ies~7gyNWLZWxfiOZM5Z z=Lji>+j_VvguDF9bEc5A$O+s^X_>uaO5kmwO#MiP#kFq|g>iWT8ISVdOQaIyRQVc0 z(TxWW&3t8~rsQhKO_Vs=6^yZ7oN;_&5^ZH1s;dX<@ZW!K#C1HgXzt#^nHgezBr%4I z_cLLmB;|50PXz)L;t8wW|TMp&i9=s(1X8E{(!*+X%Yas8kF1Omo< z;seo$$ovTEpC+dwO_){+S;<2|^8P7%HYDR!vYZEy?H(a`ONAVXtGvoQkQB%$W?*`q zO~8`^6`NAe_MLhEGeS+FA>s1c%FCUKikGyGPrH@jol}glEQqUQ{Wqhg-OzwJ)GK=2 zSB4K*Y%{7jfmmZCBM-9n#3?h23}o@48aFwu0V54E;FUFYz0QmgLenyU=Wn14EokLl zfwQD<<@YOTJwc5wm(Z1uW9$LpFO^yZVWN<&uTSBso7!4AzBiHsEtyZXsil$lXY12i z3Nid;Gb|WU70M?3bQ>15Npcoi3sMsQ`n3>W;(+qOYSo)Twku_8C=ix?MStQB^!j&f zfhkTz1>*%_@)VKmqdN0nOt6*Azri){hkB@0$#75l^V(;3e?eE<+}>-C{kFZ*LY+{f1a zR@F`*bi?$cbWd9rFn;7fob@nti5aVd!GZpQpJ77-@k;$eIva7@ zkMsZ=iQHZ;eTgRsyo*D2PRy2H)$Pe0Q_KDfWF4z3Uhc3MV`pw((^e{i z8m(__=kSBa?e_x6L2}s;h@q6la2H}!vnqe`-Ksr|_w|o`F?Ul1!-aU<#vt&WKtjJ@ zW9ix@V!Co^TO*2~vVPs9cl@M5N4j_J{E&Lk)BQ_Jla#uq>ZwN1uSbT7mu-P~N(qDu z-+PM)`-=Y|A9QoQUXjAMJug=x#nA}i2;ISttcqtr?`XZ5Ntm#6$kcCAfRO?DR8w@` zkq9|*>Fx?W9`|LZ)h;_Dq@=6zUwUpkV)I*!Zi*rfyfpX{j9{XgVWT)>S}C0G1Xf`Q zH(!pnK$;)8f$l&K^q+OS%8YSZiw6o?q_)h#C=9c~Gh6QGPuSc2Dz2L0rItMn*8hdx)SpXHKX>yk|`>3*cRqc!8 z9kviR>c0cH^Ghz-@afZ8(_3h z8Q(~escvA2X>BoK`82S}e%vV*MBWst~)yK0YNB)gp;dHYLO5 zSz~9|*@F<=CIHCVmhi7&h-Y|QDb_dYjrOP=}S98hqUOFRI#vczD5zG7HOY9NrN3#5RR zmbfkWd|gJC374Ig=ND<$L6GnR>OCgKO&{9>=OBoHB>`$IqBabf7~H*X?&$4jWrh^^ zx}thP3ju@?M6vE_Hem)w#E}P^%;@hgtB98N+^=8-U#z)lo(6Uu*b%DpD{on0e5o1k`N4bFiHO}(`v&c0YqSE z)Pj_fQ*%{z_C`%|6qD^^cZw(X-M}t;IPVhPwYmAL{0U7*psxU9mh;7g`Hver@D(_G zUzZLvYF1{L(aqn}O8tmvpF!I8HDKe%Z$|VN!O#zv=<{SW2Pb0;sX6mS-)xIUg(Rup z|EgZAIr@?U_j+9>TspVkI76vR=ltnEy%Hv0 zuw0yLm#v5s`YzEK4F;A$QkCgDdldaPqCu|_zP3V zfxqZC%`amvIj`_be>+(Cjf>gbB0Tmez29ryo(|z|3E@(jg@2x?WFJzdKfB!7zB;T; z$rZ!wm-~$ z5o+HC%S=u9|2<9??-eG*+$1xQy5pYW+Ai8BeHnAJD30PpQfKKC)n`{J?RiUaoVO6J zOwS8@Nhin?}{Pzh9N|9)Z;L$y;B2T zbBu;%KgGx8Ag(6ZlG>iRJz6CLPq0S3oS+AOG+;Xf^rOvylLQHN>57Scnz==QQV@Sa zAf1Gaa~5Gx-OAXiKp2^-i_zC72sJ{Zn`{M|_4h=%M&QxC{}B~ODSm%9h_TZ;e zc37YJAwIqYto^o@kH0|&7!ms(oxt?@B>4{z)_w>1G=XEQ5ZXOe;rJvbc$p%^A!yVxrTK^@43^%0ieb3iS#EtO;?Ql{G-?-E` z14Br0|4bjFFmhJ;L5$#_hyq8>g#Pq1e|qB8*vdTte0@A!XdNEr#LA*9BbPd(4C+N> zfKmV%Czq-3&k2zY69&WFd1wPh&*U2ulgrlc1B`-(M6X z8WWV04FxZ~*W;0T8K-HrwqIW2UG-`z`=o802;NH4Gil%3g_&|uQStNRy~t=osH5ZJ zF<5xik4^4vFb0#cgNBjJ9w1YsCE*o|uybY+p{Up3m zs$c#HlKo)K1`*h%$DWb3socUJMiSuVlN4-_^RG%ZYnMckCDe=*xBdg}7B@+A7=-|5^ASPb4p}Ewdv`A zEQgqkrN>=x-{w}#lZR&ehqt6K;^cr#XCiB=yY&kWBn>?f;>|9v0OoV|UC z@^e6n)Ve$%jomJlD|2hAmjIpRalU=xf9boMRX+W*O5yj6_#8+Tg@g zFxrumBs^jrc37OJxshf2(CJ~Av2ed}I&RzuY4y{)(EIedl z1YJM;wwH`sgDWD-G+(1E*Ir}uJN|Y?h-cXAB|i_OP+5DlyH}0^n^10+>D_Eciih2e zF{1Y;;~TZ4kp)&BTS)K++YI3oe9{~#K_6?zc1HBQ`}M(}-&#Kn zGiPh-AI;`h%NI|o*OqcwgPQmQDyw2J^6 z>-!lo19?x_I0gdz+0a)E5#X1t z`oO@K2c;{w=)25DtZPOPj}%|zT2cV+-l`(hRA++~zfn;xNv&xbB@O$?410&7IYTb2&^xYeCZT)onnKh8P&)_ z^0=cu+Rp%a)>%fS`h=X+%ZwmFNDBd;`5{heO$6>)F`-{nGsQ{}A&27aeB`UqO>PUc z2;`7+9~mRIh_%=>4vXlicTxWN?omHNr8&ZYP08#LFZ1g$ z`_dS())j?HvStK!Zc!}d_lX6PD;1cpY8$y4NVJg?i7(1_6eB~&sV7&EZBvK<>@3iqG;r&4#qTWJ$I z9H3~1?b77GFV1ZAjtu~lKk3qZ3*M`l_(zwW=)anRrAn_Kyg#o0)HC2IG4-(?|5lun zNr-f*5HEM_xn`fcd?~oucfE3^`$SXl!xtZA*P+4(p}) zq4B|*+6}i+O@*`8!16?t=Kn?2TL8t;MD4<}i@R%rJAtqScM=E?+}%lVf)kvD;K4(1 zcX!vtgOlKH!QCD1zTbEMTlG)X*3L|A&*>xG+h@A_d2oojHvzTDcLF1qTM0(D=6%_3 zja>(j@dg|7)6!VQ%?#D4o-nB zO9USJdp%)rekrvwzV_yfOyn=~3luxLnY0^ZY+*j+35JH!S61Ff9}Qx2_-MuBCt5n* z!TT!rUfjK@U)QQ%VXt#Ti6>nOgTe*`-2ZIX`Tr$cWL7Fw4K==OV5Vd1ZWakc&fmnY zJ&^i?i=Z8xz1LrJ>PbJ}swMXIyzYm@`6u`oA+(K29pAm=!kQ;kCs@fsth;?ms_^5u+Hqr;T+*!(7%Xgd<5n= zF2+F1pF8M(T4HA|I+!z>@(Mq0H*c`_mDc{gBF(_FeI4I7$RawT4P#!Fq`dnA+~%{b zy&PJ&;E}#r#jd@*KE+gU4J@5gn^A9QVc9MFn|Rg(tiXpY2eXxp zfqpn}GEEuxqxJ6YuG_O8dxNua!8jj+Dk%|uA3D}wB^(r@VXtb8sy~F3Lt<~T}NB4*kuS!M%gZOqxNVV6oC=V zLO6N^B#_d+?|KmlmUTRzC*N@rwpB%tejSe|sHwZejmuiw!>@}|pb%GjpDKjK@b{=I z?)CeuY7_PBz^z#VKOtMOQuA*-f0Z!Tlk8$?BzH9nkg}+@yV1(=F(pQdQ9=E<7Tz--Mw`}sv_&=n+Yh6<-IR8k&6OWl{!y-{ z)P70$j=#-~tK2`>U^GN2npD)2+wej>r(mbl|h@Kog4c;gWDRw#1AnC8Kv$Q+L=G4^@!?BHcu! z*Mgr-bU%_Kcg=i%2jQ7$?M)uEOC3{Yn$TWyvLcPxI)1;H3|~TAsVRJ+<`Ddf91=B( zqRi&F$a|~EiChKZfk=EV0Ay^aowT*WUk!?4G*w?fNt%sw1;^PDEQ5V^eI0u5C!bJ$ zC)1%K16WAV61n7-T*h-XGaxm#n zAuF%|VDgXA0drFzeb0r)pO#;}ir&0JZ!K==i7nfES6})lLMK{^<>sw|d^(P!>ordb z^IL)e!J9HQA&GI%$GX#cI6h}^NOCh=zzt=pc&q6*h)AH0vstY=t=v#}F}^Qbuin!fwn=*8MPV0}(KU49L2i zuE*5x0CYbz^9;_ZTBAZr0A(j+WhmJI9>>>44L@rNc=yupzmaE!Icz&7@q}%yOmLib zKQzXZC%Iv$?{b#z>C3-MCeAWPWaQp7aem#%1@#w{+yAiNtYR_fql#$w@;1Y4U=xc| zJK)GeXMCE!^oQZU6?=AHQ@{@w5Qbpzdz0OG-%Zl2gZSB&ZYCTCv{zX%v^nV-D2|8;Bh?nh2jUnj-!3Zg~v8 zJtjiA9JS^dK}r_B;bE*NjcVcU5lc73%^|kWw1Va7w z+z89^s1b=sP$>L5ygn=yvjes|)4?>o`Vj}1S*xFc^}2P>FyfAniV#EwNySwF;~8iQmwv@k5I6a`$;I!QVPaqizSyvS=K>F*2?^NI zJ+*_V1~7W^jDfOx*o;AYQ=l5j5mda_0MHqO^w_vM{S{zVDtyJZL=3pFAy0&J0uho! z-THdIp@k`rk-b3hWLD2Ia0*9`PS_;}gzX_v^2rl~*H|6cKqeW&t=M%%h1OTXFvYy~ zWTC-B>k4ih_DD8^*M0x60&z7%rjOeWUtZ*FVB$o^-xdoNm&3|sKD8|JQX##@)+i)Z zWx?hdMfv02o4LldAv1xCR7S9z07QS#3N|n$12$s9g-IZCzc*mJ4J2f+Vtp9q;TyRg zGi2bJ8kcc7ws%c9H;Cx48L_l7Q_b+CTmCiX+J!XeWFMtzxY@2RZfO|B;S26>fiFNI zV4RVu00N56E&3>0GYfk>tnmOh_%joX04NEW_=j2nZzLf83-Sco6k0yw6)P-I`C;9AqjvL)o@ZClF4$QBJnk&4lz)P8}Nf?wC;dw_@~B(PmLgy5D>@G zRv*IcY`I@hLvh$Zz2#odNI<;X9!o(&j_DB+P)}wfHFH8tvl*UD1AW%vkiP|nJdl;g z2%Os7NwZE7(djm=`q3u)p0h)6*1CYVk>Hi+f=ND(pbGWLJF_j6XmG#31ty|@*8E2j z%Vwyz@Uf`^F%sH$G1FaXD@6s~T`~ms{sB5)r=>##W{VvaUEP@K3Dgm!L$2O>(+z5` zt$GVq{;=0#WVm~8(4q}6!74h04um?q?IaJmn2q@HvC^Q)Hv!_rQlOrue`God=d+}- z)|Yg6he6Xi)8D2+@=F{NGb{?^W{-21T5Ux~qBU z!X0Gg$Gua&fm_acBJ+WKBxbis?~oGWhv*G~iZ$Y_xe%VtjF8`H%4oYTaZqdYYW1=`X={wJBX6pS%enJ*A~6gd{!yQ!exqDs{Z`ZebPm zCi9vzuD5XxLr&rcW*H}8Qb0cq{ViI=_2KV8DTDXOQgl?Xf1Z>O?6|6W#5t@zIs>Y0vi;;jr zxrr+uP%Sf5iQ4)Fz_lf z3N5pv&VU1zST@Gub1{x_CN=IPAgq@MrQEn>SDeKy^bF7I?9WF`2o(bW{W645tFQpW z%7F90BV}PlVzwsZQ94G+>VX9)MK{LJ4>jra|t=K{Q0Kg;-70-)HLB<7Y`G-y%5}n$kN1p?Ie1e%W#X z;_oP69aVT6-fpc2Lgclxj<(Eksimxq`|Akqx4_H=Xo@I1W`!`O^o^>Ar<7WYE*#)_ z5HWyu{KH$Ok=jc$Y<)sal1Y2~wN!%69sW;xIDIc`*q%+L%ou!@Aw<9*|*925XaKa|QJ&FPQk3HpSpvY7gm3F|(f&ctKrl6-G18b>2g zhLAf{e9*$60>hKck^hq|iL|P9vmX^QNNP@q@`Dci(kP>EX^A(hB1HWOpMyjA&fV~V9fm_7OuFA#YG?+^Y}qvEsO59=yp8o zxN?<)?W;H?GT3l{nYX3Eo@Al*0EE{S=ziHr0dM16*A;aQevlq{?Ud@)wnofbVUkjL zb6Q!9aNA<~19!$`B{*pK_V8|uw>f$9T)}%WEjLmU2tCfloyM_a*G=+_4!{aQ#XjFw z+d9e{tS!C7tFuA+;e~|oJABv|lPZfkFn63_{I@o@GA5cs_7y&sAT%zKyfvi1_9xC7 zIfXdM3XY8|ZS#p;fZ7@s`Ku}%{C8Qo6Z{e>>^|?Z=L$^!7*t?o1~-?}-6a=;`%6&c zX*=Qba5?s}OMN-`gOB3c0YfNncwBLaIVAj#JW$>!L#s6w`wE;sg9W?+zK@_2`h^-l zVCVzQ?!XMl~9n8Wd^G~spWRrA_OB;r3rB=g|`AK0+ zKfs2}6*+u@C)1&w%M|tdJEMs2j=4kbdQ=JiR4$nCemLAQ2n83o-MM!C$mlr;P|h+) zdr}BPedD&f|2X;S-}e!9!4nwgMl07NoOkShXI4P#jGr~RU4;m zq)2SgbEg7?ITBg*tY;654jg4o?rd>dYz-B~7Hon^C`|o*S2rwpRVq z$3Ipy#BKr$j3dNtCAPD)LmqS7iG~hj*zAys^9x&|r3a~i4Jn4Xl9ZysdFX0##TxKI zXcY6>cTid+xPqastnxXigM4^zpeJt}?%4wU_j(^j2PHTV2dEki^mmpbdbds;nX*z& z9Q1BG-x;YDyX^D)1O!(W3o(R$46k!JbD)^ALaJ0%|Eg9&SZ{@t!wDYy93o%BFFbMV zN36pQt=}xkUY2Xt*d3`b-6(0W??q14s{Cw_Hdxs!KM7t8*`6*$0iYZwHpWFZ-zLGo zKP1^9&CSz|sTNSNSaVL|i0n#xQ4NbQp55E7rtx&xs5(RYfB1-c+b*`DaAtss+c;7Z zxrh?xiSDDhPO~Km|gk>Riy*msGXRAlev^th`6 z`%%=Lk2dfpR>3G2_5QMmWI$R~b1HA9-h%M7`>N9*^~C*PblmOAUGh}Wb#)fSVGl}E zDsYB2+DCP56vY_Mt*P-3;MaJ*hU2{k4#5 zJN)_Obz(0@6PjCjkml8FBMyA{zJk@WRWc@a%tK8oO#5$!p8C4@Wgad=#ooS)vke{9 zGwKJ^=Rz{G#RK0Pd1@4(jR-+|(|dRG#Hd4z()VvF{cXX!pxsv=Mj|}QHnTlEI((np z9+E9Z5a#Sh9Zqkx7k=RQqHsF2d zX#>dc+M*-r_>i8tB(~rIj}AM`YpX_`RF+4?z^Pg~b<7Dyc1*_oRRMR$z2eByIU9}V z$1gAU2aAOd04&vhPDxL7@h{bjtrD#c`V7yNCiC_4xeYtr{o{QTP<5s1Cx(EKRP@0~ z^-HL?-$N~&=xK5IA#$00OivMMSLq*H7P;`-`vPQ@=ZrMgr40DoCID@0diM1z25r5Z zZRr`zU5yC(6AeEMAc_R3opeRImfZ_w#I7jY0aXSj%O7t;Q7u? z&B%WmaIkFjZCBp7Fj%l=x_37&E&cRHnD>g<01NQD+iVaD!jgu4FD}~NaU^!wFA<0_ZuQAs+I4V(qGQX$H_Sz$bS9{$MDF`LXqA}#} z#UF!s;obMkWhKnNPI)`$H>-ZF6<5RQeMBWk+n)_MEKP|l z+6kcprN}4Go4C!XUb^~Kz2g7CscS8^nkR?V}go@Ik_AMd{JUhXbMMN~q;Ar=xl!+ti) z|1>pbekQYnNa=Nk=krL>ocyG`rnRKpJOHB2GE z?~yY^LF+=^wHg_7_LQixkV)tj(x1GQR&is}@&J1Upuh#)NuV)YXbypNqzSDmh-mFs z`hJ%A{or2=@%!5XUcJtP8lIh}J>=1A^72n{TlBnP8c()neznxB+XDWyKg$)5&|tb_9NO0TkOOOb63)!CS$DAi?1StLC;YroqUWC=Mf(j`0GMr9Z-IwOGVi zBPG5IlHBODJfC>Ap|qv~AcNH#-nC`c6hqjgC1R(zKf>&$`%IVGj z-&z3iWB~>t50UrM*lW!4@3>Q!<$%I#slRejtw5`alSihe-z&fBefIDWw!NZ8}`E2ad|mvyS*T`6R^B5?NV7g;%9Q*a%_{h*Ya(3k1cYw^_`xD zQfn1X8TAX6`C(EZS<}X50VCimrR2|`mD(nz(lQHA%|EQS3OBZ~%KrrVS|Za-m%JIt z&?n-a7h2i&d^7UVwD?drK51?52ZxAfwEGH+t7trFa+F*e zE%9fsfzW>t8f+1MV+4kW0Trm*rIEQ0y+-jkPPtrh8^x&kS;B6=5v$ned-MyoB!*Nf zdI6e4zF#7NNFaB0s5{iD#8b1rd|0aG6G25J;k4S<5{>UcX-@v&&s4@27gS;{H8o;! z`QRmk7Nob09S()NVbp_@7lJ&QcerUUBv;K#0@39PGCQ4f3iR1FlK$@|r%V40S&vDU|p z8zeu*3v2I3@5)M^adrObMwE9A&>X|&p2oYe=UMJH8GKzNyzAA5-@J}Xnk{Dqf@Wme zGK%x^ll$Ul(#zR@C0Cy%!MrhkMtWt~R>jnUQx+aidiv+YBtfqpkHUi=Juk{G-FWpz z(oMeYe^K!pn5u4wq*mZ18}^de@im$XxJ;KhW3NNc9hA4h508*CIg7I1-NikvEHKUf zDIx?q80yS?v2mq;`tbe`N6TUV+%3UDVLauZ+fsiI@1NOpi}kwSb3&@u##~ow4S#;z z=%RYPb>ehB`kgFC2=c$>v zAZ_<$61dB}@O$HX|4+=`==?A-?WJR=(&xT!O!PxvW#w()poL%JWT(pXj>3>f!fWZB z9*>!2#UI8SA+__SoWJ@_XG-@aHkhg~{um238-uTtt6PC>NJ3Xknl6|-ndxz@OD?PvnE(80TtbO{ z0QA5gXv=r-em=3cV`OJ9XgGgDhUGbIQ|ZIU`6I%pY!)8H{!LeA?m};JCJHLhT|Q^V zWI7YiU7hl4(Q@o-Db+p>KWe2FemXCa6bpZjSO<}e=-EELj@qIGL8R>UcZQx7QnHdC zID7RH?DAV#)lGq(s6&tE`sZo-*$qGl^t#Se}OrUGz@ z|5i>weevEXO39W<&8k8}11O{EbGZ&Z7{?X_?){`eyCG)MA~0T4nIbS-E24e-^=l0% z9$Meh%Y`gxmt#31-q?jl+x*bk)z~FiWIQl(we+a*t$J1|rLhnvz1GX!fh!*5?aWnZ zpp*aeo4(AG);*A+$_q=^13G=g{|d5xG<+0WH7bvKImkhoQ^owW^uu||Z>74Tbr;lM z7f-U+NvpiE**JED5Fs@ynaz2xPeGb)GS2lL?SXIjgjq}f63{!K0Xw2kcnL763qr9y z;T7C^_q0=)@iWYs(iqb6&N4#u|7yi(@^b#NqAlP?%>R`$IL`yh@tk=wuEpUr!Gc7} zf?;Tui=0HBDB$HxpEYs~w6^?KFYLh*$2*vnn+?X!e3^z9AZmlXnyu@HhWjron+& z3oQOVLu`|+-iZQ7NIgL#p^>HEO_>sx zja6^40Vmn$e^j)&Cv+@w@0<9?!JKrYLJYtr|E^1B6h0oay`1}aAymmv-Le9$MUGeY zV-0JA92gQFpz@+z6fs;XVL?|6mMWBzI-bYGpszBN@_z&0YM<9T7`wF)Ypg;aZ|)BV zA1f?UiBE`|=+5k`cB5ndnu2X_ZQF44vQD+vJneJRU=fHA>VkT4DZXSC51UU0??Hn_>ROCb_aA)Tqqo6+gcEe8*v~w+v=~Ab&3f9p4iybN!{?D zFawSN2=L4-nV&)G2gkHv!`JJSk^)&bAJgTr`oXv;xbjH^%y40*+BHT1oUhe@5CFu{ zSvRnZ;5TWr3J~C5O+mV29;kqEefgyaG60B#*cii-i0p5{1lwtF^zmIGeMGDRcvUbF zf*t|@;2tiVwCC!pF)=f$H~{Uq*@tsqVV;1I;Ruk>m=w{0DbQp~6auQbe>WH0A_6MC zTmXDwD=PfQ|EVdC#5vFh2j=X>JrCx9-}&!=cHxa^!L3l0qUqj64~Va>Q;I`^8H^#O z9sip60rAfNu5pO5{h@eEaQMy%F9)Ejt%45dVpDd2>wk|0uMq(?&?OIS0AS#f0+CvI zw#zAN?Z1oki5)U1*&zr~@IP#ExO@%0!7WwzsVU-GIG;DXCjWC_;>c6{cQT;uY$29} ze-_LEv3|4jnFxSp^n9E!4%fwJGY0<$zwU{10|a;&?7*2SkkGNI0rBxJ5Tcqp0V*lF z_t!2y4y-!-#Bzx|= z^%ZRdDT9nr1{$OiZMAR^3pIG2hyf6}p=vXZ|3H9!bot5WjW>Q<8GKx^pt zGjK>#_cw67cwd3?I!!pebR-<%-opti)P)dEyb(VpHPO4{x(Lh41@!&Vsn5nt4Vj36 z5&#^ph!jJG2+aU9;sg84K>qk%gBzVKPbC35paFowqXC7zz#Uf*HQr=dE&$VrLs9|} z{KcvO0s0KUpm28lKXv1xbZ=8*wNW9Vpy_O1yhM zpb#2{1a0sKG5aXOA$xP+Wf7skESw$0Bi-nj`5h8;Bg9&-6)z7QDi2ztMP7vAX3Um@ z=uQ8s0Bi5qNEvd--jINRiW~|;H((9DZ3zQd8y)$9ihDa<=j4C|44G4jZ=~nj8z6!i zqkq6P7KQfKB3%gL{U_2-kp#fcm_>r30-(3=|3_ou2)JFFz(nFXZD@hUKoJ;Kxn<_U zGimm2IqE-)ms*Y-^!^>{QdlB+$b&G^VcztlZ+7 zP)0C0vh7MM{1#hTm`HpBlvN1D1Hk$Lky&9V&~4Wbpe%V%)}?>}AR`QL|7YDV=s><6 z>nwD)?brae%M6?vY7&Wmu-f`Z4mY#B&kijBe-XlW4Xokcul(m*rVQ{lN_!sz^30`#eY=vQ=vks<)xHGFj-Z2X|%n}jr|3Gx4@-=LFSHz>;^ zUHLzCfmt-Ti^E*v`+VROdJ*%lIzo5bIFYk1_1i1;5#b@XL4&)o7a%7tS*ebxEC}~U z)XNf>v3K&r|45?*QfASR;DLk8oQ_VdlKwyLg?sUDF@T>rOXN180{mxb_XarI3^Sk( zLS*(WYN*I`uuz$M|6j!rc-A{iv8c17-t9314(WhH0tYT6q5>qozR<-(O%CY7JA=eE z7Gt<6g}fxy+u`%{w`p$y`XRVq;ZRUn?hXE3ZDSnY2$R9$dvJ|aL6QZ410E~%zc_Er zhR1ope{r7k|D-Es{@a(_aSftyA%x12qDb&?Hu%%bs4&8jUvYtRLyA68D6kbhor_N0 z)ltLt77XZj)yU4EAww_r`}`%<)8Q4kj9;m&ziGukWLIO?qn=RdpN2dCT1I5nwY)@P zMAgeYZFZr>@D~6YqAb?>DcEJ3tvh;vC^)2AS-+J7Fr@BVX&?LvqMp**Zb@W6{m?k$ zbL8&`4dA*eSqbR;;)atn(I%=zNw$&Sk6{IY>z{3;g#)>I2TRnY%=DWo0HLI< zs+`8Y;nntQHlkLm`%Gc#Tjo$}vl~g$&eP}ld#Q_tGS!_p{M4c-E6wjth=I0?v z^zpd;NR0$nkHM{l?H4E5AUh&N6e2~J9ZH?v5N$6!EiQYk5f@--e68OLqHNY!7ONQ@xBHrh(0Z|? zXOp}w!eXB>cIj%M^rO+|tk`)*i8z#3lfJ<%W$F{ z*Pkal^3A`#-d`2h7tFp_zgyfJTsIM`8b0V%eUt7ph*AJ&Gyd(d7Ek;438wzWauk!n z=3LLT<%>rghizDI4!(AS@29_1j=%Kw?45s?i@wxbjAP5+?c8p`(nyY}_Qs?sGmuwp|k!s%)(^>aA9?m$iT+->mOpr<PjiYnXgBku~V|0TXv!u*LMwzdJp#h z+>HGwwbN0sy=-Kbx7U{zPxemi{a&fo#QKGq{o)qLP-?lb*=v>fnm;!GPt!LkPf+Y# z1{K*@w97d5Kc-l(Oy8g$Pq`=2Z9QF&&%t{MzJA-Go5`BKWfspKuicfD8o3&F{Fe)z zslrx`>W151ga)Exb%&2OM>EdHMk!g2Up8U~HFw5aU*9lYzl6AnRS9{TP=08=fJJ9( zq#=hlV(Gqo(W-aINyT|onzYbmof8)MGyiz6_B!l#Cz^Y-{cguAq_nu4GoXt8Owy)H@LTq*JTdwdL|` zJka?!z3+%nf5zw;N0ln+tLx$B3$@6%B?>X^pMNpzX`@QEMexZd<6`Jq6w4i>D;mv9 zmU)XcwqSN6(9m!E;cDDLG*z)2Sjg%j6j$a&Rt~f!r`+75?gpTP~>~Xh$l?}V7 zS1#5PiY(a+WPHOjFE*#VFit+|?9#8DfC%tIlb<><@b?@W%S zH{X>F)azt+oX?GzY}an--&`DxR%CvJ(o834cGze7u@c#?+aa@BY}6qcc1p znAlhM8_%)t#n*ur^oTBK?%8^6!#fZ~^nUT!pB`V{PZsNHNTBucg=ekeypdzy7r6AO zrGsv;)jwqH)bY&nBG7XemlF9sB-T|t$9Imt3T4 zvM(2b<1;f_kPG{ipJeR^VHteI``(Lk>M~R>pFd-Wd!($$_{@4zEtNj!q{Vs|?tUDh z6BT{=%vOs$^g8`e?aJ?P+0MR{mo&st1qt$+;IwB+8>e{yHpXpR{1 zB!1fz>t14cGt!$&4j}J_lekU0V`07}9JLJMO*K^ct~L9b6bzAZ0eD;hN1EuwRy+U= z3fM}aDEE9j8w)iz3wPk&?xz9p0nl6oc2+PBXTM*G`DTI*86w#> zUPess%P5L4m(Mx&@?b3 z045a_wam&!a1S0Bjy6KnLWFGtGALF3UH}M_04~D_EFcu`Sl_lH;EkRq0Q?1&{Q)6D zCZu_A3dt#8&Y)!AmNvx@4|tWy>H@6Fr!s?~pba~7d&UFxToLMVW@QQ|RHyS{4qnhi>`Ap#{=Yz8BruSQ5v>prK}=n(#|#&Fg8x&<~p;hN>H z^FV;$FnHW?_}9I1M$UtSk%6f}xX`{`z}mfDuXQjUUKaSQZ;uJ}Mw3kCb<74xbBqP>IiZWHBJ0AC2*U_exP&F92A_#$$u>&zD8)5FPv3BJd zB`g8>ZAD{OAPyk@*Zk_eB~YrC14ZII|5qCqzy>Z3lYl~8;R9fc^*ashO91QvyvYBz zO<{(QB#+W=cJN6e_4}SUzEkQ?(8{em_-E<)<$6cQ0O!PdW8|0V^9QuDw-J94=!xeUq~Kd#Q*J7}eCxg{cuL&BZ#w^vV3moamS;OHfr7 zY4bf#5S8ERZ&B5JJh%9Q7UjQXt4d#xrhVv+n(hDoOV!Qw|AG@=cQW`PKCh!{FS$F4 zXbs2e`O9>zl>uQ$kJBmkO<%gF<%5oq(xJ+sT(THpbaZQ~|KbrPRU-~7G;jW!aK&^{ z1#-x=funs_kP|=Qx6;jtl}(?YB`;kix6LfWeXw6!=A9a5tyF%}-wIjfE6^`+f&^Sg zOZn3(e>{weDK++7U%JeZl(wY^JF;Qi5^Q9~f9w0psDXUxiR5J2N56z)Zq8G;icyQA{DQ zatUih=T~t&r?)_@Z}*)$_2Ol9v^~<HI`0{K-KRE3 zJZH?%t@hi2>xFtsy;!#oNv>HnCid80<_$=b$(L`4iv+f|XAG^QMs;vu3al^l!etzZ zA@!jOB2~HS!iQ{QetcrrB3Hn7))yTgxJEQs*8rEEmcYRmm@W+#s?6 z)2mBgk9zJ_UA^n7=TZ&?3{NQZ$2%*JXEihkNpJGb({INPpsu7P|0uq!RT7$Hg?`oq~Z4C`;!JxiZ)`@>$#ol8mx)kCd#{j z?p^$9PuA3Pjl1=6rDu)F%*@_;MX^d-oPcf593c1)5RtA8h<0E~<(Uk`ikxq4M!uqy z^tOY5km+KDoYL8xlOu%^85?dzzMYWxKTRz8`cpd>Lkw@a5sT+;s`F233XJBT0Eee> zz1nd?;H5U!#a!QLCG4^$jVrM}AtdMr&d{KCLuV?(;s*H$8iO{dLPn0u_6P zmWN8~P8QXwpJ(Sx z0Mw-2fDF%E4U>x2v9yl8vaeQ$m(uf>5*oDEf@9Sn%wVRO~;+tcACY1G%Wm&F-W+6@sN87_BvROLxi)^}u1tS~VspXV0XT~VR%FpZ(Tjo}mRUaRH4N~-Cbv42#I_^Sh)Ped>Jb%pUFDB==B=6Z zxhQ}*9VnX&nUS=snV33S-dpQE2$?L*Sg!ikZ`NSW?*XU7oyAf9F#t$9?=6p8!tmqV z{N4VA)xRB*-gbk+&UU}twXxr;qEG2BA`KiL=ytA!6E&emy6|qiPmE$n;K$O<2d+)Q zAP;HZXS^mF-}_B{(()PT7AIav8WQp$$(v*v6T<$5YT7oNt!!m^tKQiJY1*T{yace+Y!-Os|CHP%+2JxCsLvQ zol;RqFriqN-@?gDE!7Vv&GWZQI6RYcj;sJ>M(vpviW`sP{g&#O#|ry|kG@urjxwo& z(*juAm)*r6W_?I$%s)QyrR{tZ$I3^;+0;BA_`e(hqZfp!AB|!D!0yb@%K4VZQ@y6t z_Jo{qRH3-yffi%IK{Y?WYc}dji=35|)0XsKN5?Z2jq^H?+W@dR=gew7eM5x7*#;xXlDV!pgEm78-XQZ54qRor_G zZ#eOdNg!=BP*T#; z=xDbu*V^A3@ldX10dt#U@XzG(EHP1qKtOE%3(*AFVeYT6w#EUv%b51JPP-xZ%Wm)8 zG=y&qSb1s@IA}j1otjqHF9Dh3RCpj$<2hQOQ->8mNz1w>fZ4{Wu6=qFE`s zCqv_@+oL{4JK1D_(+g?sw{sBFF!8qQVYjzcI>Nj61{_B&Kttdr{~&kRdS)Cz3+{z! zdkN1;124EJ*IkGXQpevcl8TVlI{R70ZP3=LHs|EQr@MEM9CghUL}MGrw2y!&=1XgG zCO}E&Y=RC4>CpR`s6%2tm#O>_Xa!NSQ#GNqAZ#Bd=dBGL=8r$H`CW#yIj{gddNr`R zj~1$2ND)CWQc@WpQ5HZEuN3kCYFj_OX9r$LAEfRI%PC@Zz*(}|0n`h4^xf9?ZsH& zPyu7ih-nOQJ+!r$@q=M7L@$U1VuLPD4>f<4BqsL4DfLQhNqQ$%y2egV^gcbo?vW5SEd$}XGAV@} zT)+H52IVCd(;Qup?Gr*$08U5@@b(vgecN_S51qg2?>IDnN>Xqtwi^xvPl)2I^(5sd z#{&KL8-pSGKNwJc+=Yu%GCE?6$N)Y~kk9NGlM(>Z#v3DNBO|BRA700?uGjx0Gxa2U zaBcLm!WCaAp|z)jTK*Rvtw3D_;5)-~$oG@tBT)OEhk_5I%l5C=0Ta|rtnBCtz$Sp! z;)#P@#)gZh1l~>w6ehc10|rWR^iYlp8lW^tU_XeakAm17mG$@(_<*#Hu`$p{AGPVB zTwbpOaO^io72IC4u2rlSi$FIc`$$PiPtw2*2>>>KOnEh)%M2YF6Crd4PkamXx{jL* zUmWKvb3GuiOyUw*>$V&MoCi4`S3@ezNVa<}Iys6;VR*et+Q1E(!_yztJ*iwK59M6+ zr0YQy&-bXllZd!T)X2#Aupmz$GnfEogSxER3j2Hnb~p^F@1um#fF0iA7#r+Byi$w4 ziHxDOJd>lfY%@X!$U&d`sH`~?AL-55hF})DiGR4XnppAZpMoK_! zJ&`{(s7wQ7gR|C+YOFsgpy-cSRUDyJ3n3|m3S|6n`53AsN3<(LPnuw=yd81@Ro@!( z{orpg!NMC-;+ckciK(8^B#2hL4$5OW5LP>;Q^9_3R+Vk3GLYm#+jk)ZavI?hup~ z3@GXictw7<4?oADhwg&vQUIxgGvL{$SgV%pGQaI#?%Ev3Ot<_*7lN9{^IKFAM#Mgc zn9;CLt>iu#z0IwXI zxK`qaY<^kyZaxi0n7%9MGydqZR)t8xj<5poNuMDCqu@^RILR}GU|XM@k+qPmvG(An zKAJ)_E(c44)rwwi043aoKM<+$VZLDgPb++__GbgH?Tp#zpyL=<0KUWyq+zR_8f1$r z-a!1!N?cHnK1Zl&J10GjF31oy{A`g9jMFl(ZTEhZE&J6d7djQhG{<|N6}Pf4x~ijY-`)CL02U^0+; zDR|~e1DDBSh~8B;B@>d7l8_=yqHL8$1ljB&!1(3xJ?1nlch7}+6c*t?pjq>w;FF$% za%9wM4bo#c3EEbRy`K47<`uYKO2Z%hf6L|#G~yc9Zn5x;kw_c^G*7L>Al6|XzFt4X zkj=0v3N)+31JrJ*Y57??8cmc^cVQT)&SWc#4>)Ja7nQ7 z^OuAEOE{Kx&F3x-WAwIYpcH^IRwO@s4<&|F03x#9&Mlt@L0^za47Zqz!j7^W$!K}N zy@#;OGQg0-TShxVpRrHun=m4zE>Jy%G=gL%&MqZh;+!sT?Q_BTX=rH<)H2SdS@Zrs zyJbSQMq%@$d>1l%nw~Tt1(-6RW+TSzGW$5Ss6MnVE?`(c>K`e_d0mcua8%Z(`3o8j zdrAK)3HXc|`_xz@wRkr7J=uXFdUk#xb{+yVRbf&`x?t{7TZ!Nd>Wzl;9b%*q?kWk` z@16Tfz{bIIwt<8RX`2dN_So&U(yOk8vCGo{Lq`9Zj*H)Rp38#UUq34V8%Mw(R)Z-M62^$E zItAyFNc}W52!O0n=(l@PMPxh^S7tNxc`u%;5u=6=fUVc4h!HxhaP>_v$FJFV7y}I^ zAA!_xAl+!_;==dtSBn{Xw(ZK*ANh+XMi=t6c<`m~z6IzS*69iR#NXhxuLmUD513L0 zu9R#q*bMV#$wH4hu(b6{bCDBkO@^4okrE1T@{ptvG-~$noOLiKO_!($$;t67iPuRThom9XFnY>1Q%G}g(vpJ38hM5h-G6F;VwP% z1bmc{I}EbBBpP@kYDJYg@3CL?@XS2cK&1j2RRqz$!Tyu;MF+^V9xNKYvKY7sk;m^c z%cFPt+xhJlU%bD^=h%cz&@#6>DuR41Zo3jAT4=v6W;@j+31l!&c}&#kiOlTK*e$|G z8@RnP#E|j*5dV{AFC{p`6ZZ71m{T!gjLoD|?panOrnTm?6_Js2;Bd5doJ z4{W?~*6y3H%x|(k1+`wHv|MBJ8VHm}ClOEczm{bl0vg9?h`1JmI6VeMy4SOQee!fR z_(AmTaPXPSqW?!|`9u4w<~TPN$n|dl=+e)!lGp~>aV}t{wAuh@X(k0zjY)d4Ci|yi zJ-t@`TsoblyDpAbDk7RQw?m*#ZuF>Dz0l8IUP{kFIf;Zs_8KV`SN5ct`$z=wjmcZ} zUG;4Y9Qhw3Zxo!^BvAR>#;#SR3f#&r@pH|;2zNAy(ru>*RCcPa#gIE>X`ffXk(cS;u39948CK!(a1nWZN*{4=sPTpRo_{Nv znn-W%k+FMu#86%b22VW;aPd8`%{M&)R(GIcuFZhrO2ZiVii>uDlq@<8Xtb);b-S-F z`bE%Ngf_(Ip6ZVq1ERyP!bXDlcE@0j#;9;9Wr(D5YI8Pe&$aKk*;)JEi(%A)B7*Ec zlUD)nXwm=yeLsD$!72$N(68SlD@x=m$HmR(&~VMMbof(t$F7M-!Ejm9Jh6iRtgb;R z_L@o_s46mF3Mxd_xoIy>b$Fg^Lk=E}>|?se@-I+cjbKXKra(ysid|kQ0l~T4(S?w` zveM~8Z@zEelaLP%BD?z?_-KCn2}BtFTKl1F^&(c`rzFHK$G zi2wN}2%vSXldhGiiGv6@o{f-?>skKW6w6;CjLk#8xTj7mfxU&&f+C@@X`G$M_d zBMyR%0rQM*CmnV`0bhDJ0EWaf4*Po5+OmHDRIjbofwPd8v6*i@tfEjL?43ol4iFXUcfsU%CUjykx2ep3CzLRuxZTbz={W8eK_!@ zs9xizYC49_6IXY?bk`KPT>J(oM#SBOpdi_h4)aW*bTo0@=Y~faOzA!Keu4`J07^PX;J!qoR^x zPh|m_edj`_zGLm&F`{Ya>q*h01j;LL1?m#EW9DUWoGE#*uo95(F_#p{kb$`}jRZSl zXtxJ9E^ef&8;y3)zMR!-Q3g(!jh_}lug7#gql*@JMlM8OLfE=rKjS76MJH0eui*&2 z>BJv-gqBeTNV_d+1@v2=J^%t9ae(d2A~fVkt(L;Nlz@kzf}k=0UxywXVET8tuiQ&J z1pIB3P^EIFg%Zw&3_Z0tOJ}s80=Mbn@D{`=J4GTE*c-+;ZzZ2~n@RFb2?^avXfX~; zk>KHRR|D>v<#DGe{u2D<8pw!O2&~-(AFtWvOgK*za@}P;P3&NxMNoHil2uo~Xm{NnEJtNp3p}Sl1 zKJcS6W%*eD7Xj)!O2>G>(2Y@5pGK4ss2S^WCdDB^X&(W6(gcDPtRb9Z;V@Rom4Ayt z_Zdk^EWz0s|9BAx93PK~B8M)~;TVhj0io&}^pBxL=V`glC+ufm+`w)%CS+d&((TGO z_euh2=vw59v?4`O)1!_>IkT@}qR8g)gL66&WWTux>|XMb9pXSPs$qvk`CAKLw_LaPgNFci;@5{d(wkVgtat$DQyF2p_{tR z11x?g;C=7}E`*sFwuO~O{+hxw?{7Zm&(P&r8OC)%r${EIx0gp#Nfc&sktFI6BHOEy;@ep^LzC?Kz!h+3$~K9pYg z1{?O$K-yThDwrnt0E@TZD{Rbc5_>8WK4x_h{mZ}z0(Y3h`ql7jc6MY1 z1It^^%EWs@Reth~aiZGqX!+*^|K;G(et0O06p5v_!8`7=I5X!*k+2G~Vd?I$8|I0z zi;4(VrJwJKP}Aiw&m`b5i<`nZ`#iSW%dL6)r4M?(rj<(m3?o?FC8l?*i}H#~wO8Ug zi}3W2Q@|wNz^J54SWAefn3N<`lWg@_vEcrT<06x_-x#WBA+|E zCj<0^FPr;VKE2A&cyO|A2Z_i)&*rUlrN$P-)@rrWU}jRM4O|ei;u;%HWi|hMo+;lC zLf7^^1Wg<~YtOeuS$HsYkk68ymNFf5 zeLK0l%(Ix~LGHU0!meb6aBHlmWxQDH^ytmXgn2?|{1mAx+i&lq5pwyD2f5>CfF7pC z=a2bwLlI;2;qCqQ0_@(@!gHg+!V2+CHWxc>A!fa+y{FV_5ETp7tpOM-!rltKe%OUsj9D zv}d@t@jGGq1*KE&;h_0uVhJ5P*K2|xIkC|`yel($UTh+FsUZwKn{;{g^r&`?;+Dam zM~`A$kB$z%UB^Ekn$5u;&al7SX2ojZv#4WYQQ2U!>=Z`Yr7e7D!B;LFVSg?MH#?}_ zq+zxrbT|Lc+1rBWW|$z()PB@PTC>t<LwTiL|n9g`;#zlStzQ6ye ztRY#@s9QG3o*1w$-JULvef#B)$M-B@gG7Do!HNc!9F-R(&%M2Y z;T|pp1s@p=|H&Lb)fcy2uyghTRhmW-o5+Om&oSNyFE0LapNtHQ>A!j;752}yy2}6o zbZ2DnL!hhfpuX(zZgHr+nb9AF)Mt5yU?151Dg0#P@N*|}l9TA8G1)iTw{68D5A6$c zx8j$W`)qxZrb5QUu8t;kO(s3B(aQG;`NYls3GbSGu80X%grcUsX}Cq>{BIH7Noi8E zdYF#*3fyw5E*X9*?>+E7r{5SVZf@#;=H6ZJzWZiL6w1&$roh4>CSc7*TMmBx7g38t z4tDqba8W)aD9QY0wSJO21O>KV^pmGQtY~4FX*3W1 z_E7Ks9Uxdzg#ZlR{93!wKl^SRn|<<-`eaHh0kFKR!(%b6s}PuPW$^eN12QEE>&q=lGX3w=3c`nvgF0VhD`W7Dv_SwPOrTVBm`xb?J6# zD?PJL_OMGiPp51nUP>&^=z7P-T=(Py&p*I!j1)h81wmJ%cNHaAm|*g7w)^Q&Q{gVT z2nK4&3ej+Auu@)8YP@lw$NBp0cTj;^vh->to9{cEU#x-3%J(EE3h#?Kj!^0{r|u4b z#hYYq-K3hWZj4M__Koi>EK=Rx)b~m(;GqO~OJk}0h5S~zma+o<8%mmYV@wDxdwn>< z6DJ7hs-=SaE3C8EjS)qQ#3;GH&PoV;)i;sdPI6SIr2PLP{hbtGuNdmfik=T7Q_5>I za`h@;<^3RdeItS-|4%pvz6{y4}!hLhFo&!h-4 zIKnxktvHrS65^pUI67|%S!i@Uh%8H@x*CZXL6g(6dp~mHoFGwEpnBkcNWlP}V~8T#p-yYx1lyn9S?%lk+r&4+|B`AD-(8S_w>|z+nY&ycE;-hYG^aW@f?SKsG})Zx!rdH~z2@j^=$8Qk+E< zsh6dueocBfR>VO40jLQ4&L=Bp%!i3@@wmu)AjchKU8H`bEY=HK2#=p?U$wMEY{2yJ zs<`uzxp*!M>`Q}gEryemx$=|s^PP?`UBJsON^alky0-5~86Fbth#jVQiC##Y5HToG zKJp%!#Hea-PpF-*#!#{$;nLJ0uueNXZ^2G0#^4mEHxslo-TPiQTitG9SUVL~|H3?d zBWX+vsA`*jZ8CT0vzX?6tz**E+kw*^ZIAv6MHjlgLsNM>BOs7gVwQYde;YElZf}tI z3pbW@tNgT{`ZnaE-ge0{g1Zm#JlI=QJUW?7qAP*62>FGdHGQN00geF%87i;M z+_#48WVB7l*TmDZKkvxJPYD3X-Yd#TY6Y*f<=mN)h4N-WHdUoTJ4PS3@I{~5$$8$f zMX}q99!(&o^C6vdz;^4Uo{vSByiMMPSEubeFLQzOiY%!c!^nSc*i0^w3MthFt`7Ma z>4)-b=aq&rgwQE7?U>?7K{3~tWMj=b_8_wP-0 zf&0y`z`0Tmo+vlO08_az4$Z&K`J|-^dC0IloohzW!7MspRlRFrfXliRUsNp5{G_F@35*jQT*% zB_+k|U14PPw*KtN4ZfzFRle&m=ea>o>yfW{(h(5$1bQIk${Va+IPskOg^J{gmG}UE6bkPg~zQ-(T`!A!Wl(p79!=N@pYb_Qk;D&}(6=O=ho4 z@$7DryvqjX#4OayULD{@-xHQy?pT`*_ZHA`r<|Q=tk_;{ zs|%c(Krmy8QGyZk4A<&f05OghFoN+dr%I`V{xR)#1C|TGx(td?t8(h5?TDMW3AC}V z%X-2y(T!1MV;DOA@%PVOMZR*X;c-yGkFMfNW3m7EFxtxtzI173jANXB-W~1tYIa_f zCAek0-=|q%4$xNx^Ba*SNygJ%m*0$e2)xlE2XK}yk$A>ckZ-*$^1ARe6?GX*Cv!}m zZwIN?xO!<8t0aaCAsLv&rq)ERsIjW@*`Oryw zJHAj%89Q`y3>L=l@Lk6s)gyaV(&W$`i+ILFWo>zk&mv{ zt9e2zzeL}?EpgUKihY2*KZOC`f{hK|TZ~x(SCdPslVQ@fG?k8j;RH2iZxTfo@?-d5 zhzETRfBEh$fsa0ny_HqCB^M~RnQJ}_7N|w4gE9!$`{)A-G7TW~^_QR=YsNBBbSK@= zHb_R)5T}zEmjFH83VFXHCE?3x+qqj@u9RN6@wg-IL`WEuMtrX{5t0<0TT9+W_~YwB z4|^FwWQUa@jY@~84%L`Zts00uLM9N1bH0~!vv1wT*(zV;X`VN0D78Dyz63(?5RG=) zzFFtpqfaBFea11+y@NRKby44dNe-mu$mvrXgd}`PMii+GMqfNHG|I)mw**A369^Jg zg?D0vdm>J^!(N&tSnHZdM!y|(v8P8h@%$`YyxGg);Z3O-sN_-fHT5%*;xf%=i#A9# zeZFi9<8KMaKF}8L^6+-nPv<)geeY-2`(dv%bzi8G0l`0U+KbpED=QA67M$awOU9GA zdy*=H-Z%-&10_#Dk+pM65E#{@W2!tRb^*Gz0JE=VdEW8F$&o%5iUlIh@W9-`_`iMZ$Cz?&Zq%a6clgH0$a< zcm8_qr>hSWYMJB`$mw`8t-axAb5+}LNx{Q`#ObJch)k|Qe)a?+au}zS{yYd^AHm!< zM59Ib0EnOPQM>p}xqi!UsxQ|H-EaS_PbC|=J`dP=>zw?BJ36XV5Ss_5w=Kya6!-co zk9#gpr;dtx5;>dl5!t~sy#z;UPuoHhfxNf&q}9xP&0z-DrHsdn7LQx63gXz@BD^L` zdel1d9lBST=#oeRjgt#_OHaB`Xumef5{qyZoh-nA=+EECIG8)-Ahl;r)QNoeHMZFp z2jA`|^P1N=G7XOJTE-Deyf7?ikhqRW9su7qT|u)#pLo zZ-y`-kFDkmQ198p(=2e`^b+BSlLR(FtbKb30;35dHBmSrrBEVr30XXZu+me+$E=Jb z451dtw6f77F#<=e=tfw*E>%E*lF4(-1E%vbE}U|MFwOQQj&AEK$^L)F+leoVR6%#5 z=J$VeQS_zb4#iulr$@a?ejt?YOx>g`58^XwX1C4tIzYU(l4;ey-XEoyVz>j)J`T!( zG?D?CC|})#(@-c5V|ebVAV%?w$7-v%%K+6v9&WsRBzA?+)656Tm}U8Gut0V@FdGss zu_*<>H^E|UV5nzpFpFmC%DlzW4KoY#9!g|ENJBv&Glc+~%s?)1kwSxS56ZdO2kGTm;A zPHBw()vlBp(?2lyyrN!Yf#Sim?78tSwm_{u3PuF^7PTaa)~@@zYaFn%3`s|U#qj$SdRZK#$CA!|HG z@s{eosAiA}(V6Mk>^*tohE>@rcu9ff8Hr7??$F{-thQpSPcy1VnWGk|+Zv10A{|5U z9~errdfcf^gY<7(TbhlU-doRV#!}+&eai|kxE;IP4HlE+xyB9+Ah>S!nhaa_?YUhz z5M8peXF_>khJN?!4>qQmHqZth@9It#g>9*S+;HKf__s?%``}Q`N8qkFu*!D&#=BMr zZe_JP8qZKtcA9ck&Q${V`;2eIw}DR^u@YEVI_}UWI(3j8^azZG9hIt>pk||fgns9p z%+P3FOfRG-SNv%6KF9{|bJjkLhcp;U6j<-SdGs!g62P7>+uwUH9Z)Gyz437RHGK!o zPa1z6Z3&=tzzr>)iuU*StF7l#;8Vt2+)S}hTrrC0crHeXmCucQ`b17*Gvu7~>K)5_QB{D}-6xs)CeFA=xTDdKTPc~(xL({44<}Q=GVnaOjerSR zCmrB;{Gx%4J2gPtS$c#CBaFNM1;mrzs0rVGbaaxlwOOEBQ3qB<%6mV(pgA8w6#kJ{ zuefIVs3C0d_D6==KIM=`N3?zi>GZ|R4_&l{`qCC$gz%_f`qz?2Um{26sC3Qgv4@(R zxXQNY`UyB2R(kP{>OF7C42P9EgFzd(c$U+#i%ZHy=Tb7B0vcrKoXSG0kKz-X!WPo^ z=~-G zg?saM2r5Ur)d>6T^{9~hu@-g_`RR(s0~NRkau0Fi>vo@t__d7?Z^jp zL5X#pzm`AetI)EIG2YfJZ(PVxKQrmv=C~s9%RY*2HsEl`EY5FNhd)KV^KuFN5>hah zQqyt*DtTZVa#k+JErVxtzPn70f;7vLg|1R?eSNvs?{&Qk4r-~f>0Pf+>qY7b^xShu zixRm7LtUGx#^QZdwaZA4g!>@Xwvm}=Na)ySchg&yB!SN@< zv_s1VtP4VS`^Uq|ZS`K^)g!Op6^hYSYfg?0gA^4DEcu^NOo=ngzt}xaez}yCwY1fV zo$m39FILX-<-1Z!Y{vX%(>kT11T(B&i#|(h*r2}r{Z*fSDw^}md*d+YmE+X2L?g=A zyuJ56bXneyaw#M#oL;Mb)urm-*;fC$!}D2^+jon+;R7v`zfUGn(J64{9`@H4_ETSf zdB^10HQ#aGECh_143XSkGOvDOvf<4KGVEzNu6Fh}XIs7e>eg2;ypsv@I|rJ4=Vp94 zQ}mYg1nP`EJyPro3e$eiDgTRh344B7D{{JDN6rbW6l+wl{EI97hz&|fJ_J;b+k^hT_V zCI95MEYRn*esrX1OMQU8fQOqyiZ(X)ofm$tZ6A#`%xXKNH{GIY!bPN8F^MIFJYy)wHna!ss z>h>87Tq@3j1K^FHm%NA8P*dD~ce-3ss?-FtJ>?R0wSm~#h1FI@mTQGamQgRp>r^LG z3bt*;N@bFT*WA4t(|M-vqSYo`;W|@Haz+&q-rP?zv>m0^#$LsONCfg zBJ#}~Q}7Sr1h+zza+#^{i`zG%Jbya-K5AU2Yi@nFP^uN?0O!YVJ&%6;TJSBw8Oyu; z9w30sDwFz*UnBZOH9y;-F@4Y4BUx$6W&(VrVtkfO98~d)#(u8UMCh9-sT6-C;&IkR zU!7cDh2BhF{F^!au9fYc2tUYIyg~YG5KhLtZf-{^>fc z=kWzwFk9EaGwHk<`{pSW6Qt^+CYCtA!tU8#tMJCYhunu-xc3Z@$FSOl^Ek0|%;flo zHK(@P*BIsOm`Xke==uTS3stbeJV|Nl=I12m-bBX&xNei}vr^zZHigRJE53!_#>%2# zGX>l;4HFwRuz_FB{JajALNBew&`m8JgLlD(9!OG)W`+^#3qt~44`e%q?utqOO5Q|4 zkbAzkaOVT0B<#HV(}{JT_JVhzs+m3btH9Kzc!kBWv9S9dl?!WMz(GEBS5k$Z-T{r= zm%<_5mujrvIVf)G6^EQNag>iam%QHM4F^*2XisEw?!;FOjGO6U+WFKxeBw|W#@vR= zvA3F@ej9lTzs;oQc^p_K_;YLY-GFl1#>S>cSi8X)>7LdM-VdQOo2P%A_9`sl8fau+uO)J_^pV|a4vizzpm`aBCq^B>6lDCZiO Date: Fri, 25 Oct 2024 15:08:46 +0800 Subject: [PATCH 295/695] docs: Update 01-docker.md --- docs/zh/04-get-started/01-docker.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/zh/04-get-started/01-docker.md b/docs/zh/04-get-started/01-docker.md index cadde10e0c13..848a7fd499d6 100644 --- a/docs/zh/04-get-started/01-docker.md +++ b/docs/zh/04-get-started/01-docker.md @@ -17,7 +17,7 @@ docker pull tdengine/tdengine:latest 或者指定版本的容器镜像: ```shell -docker pull tdengine/tdengine:3.0.1.4 +docker pull tdengine/tdengine:3.3.3.0 ``` 然后只需执行下面的命令: @@ -121,4 +121,4 @@ SELECT AVG(current), MAX(voltage), MIN(phase) FROM test.meters WHERE groupId = 1 SELECT _wstart, AVG(current), MAX(voltage), MIN(phase) FROM test.d1001 INTERVAL(10s); ``` -在上面的查询中,使用系统提供的伪列_wstart 来给出每个窗口的开始时间。 \ No newline at end of file +在上面的查询中,使用系统提供的伪列_wstart 来给出每个窗口的开始时间。 From a34ce8f773949a8b0986af43706b3cad0678db19 Mon Sep 17 00:00:00 2001 From: dmchen Date: Fri, 25 Oct 2024 07:39:18 +0000 Subject: [PATCH 296/695] fix/remove-monitor-error-log --- source/libs/monitor/src/monFramework.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/libs/monitor/src/monFramework.c b/source/libs/monitor/src/monFramework.c index a2d03bbd6aa6..0dbf6e091ac1 100644 --- a/source/libs/monitor/src/monFramework.c +++ b/source/libs/monitor/src/monFramework.c @@ -183,7 +183,7 @@ void monGenClusterInfoTable(SMonInfo *pMonitor){ } if (taosHashRemove(tsMonitor.metrics, metric_names[i], strlen(metric_names[i])) != 0) { - uError("failed to remove metric %s", metric_names[i]); + uTrace("failed to remove metric %s", metric_names[i]); } } @@ -652,7 +652,7 @@ void monGenMnodeRoleTable(SMonInfo *pMonitor){ } if (taosHashRemove(tsMonitor.metrics, mnodes_role_gauges[i], strlen(mnodes_role_gauges[i])) != 0) { - uError("failed to remove metric %s", mnodes_role_gauges[i]); + uTrace("failed to remove metric %s", mnodes_role_gauges[i]); } } @@ -725,7 +725,7 @@ void monGenVnodeRoleTable(SMonInfo *pMonitor){ } if (taosHashRemove(tsMonitor.metrics, vnodes_role_gauges[i], strlen(vnodes_role_gauges[i])) != 0) { - uError("failed to remove metric %s", vnodes_role_gauges[i]); + uTrace("failed to remove metric %s", vnodes_role_gauges[i]); } } From fc0a4c2c2a6b14fd01c8bc911e180b327b738bea Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Fri, 25 Oct 2024 15:40:55 +0800 Subject: [PATCH 297/695] docs(s3/param): new default values from s3 params --- docs/zh/08-operation/12-multi.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/zh/08-operation/12-multi.md b/docs/zh/08-operation/12-multi.md index a5608ad5fadf..bb3326cf3e06 100644 --- a/docs/zh/08-operation/12-multi.md +++ b/docs/zh/08-operation/12-multi.md @@ -76,7 +76,7 @@ dataDir /mnt/data6 2 0 |s3UploadDelaySec | data 文件持续多长时间不再变动后上传至 s3,单位:秒。最小值:1;最大值:2592000 (30天),默认值 60 秒 | |s3PageCacheSize |s3 page cache 缓存页数目,单位:页。最小值:4;最大值:1024*1024\*1024。 ,默认值 4096| |s3MigrateIntervalSec | 本地数据文件自动上传 S3 的触发周期,单位为秒。最小值:600;最大值:100000。默认值 3600 | -|s3MigrateEnabled | 是否自动进行 S3 迁移,默认值为 1,表示开启自动 S3 迁移,可配置为 0。 | +|s3MigrateEnabled | 是否自动进行 S3 迁移,默认值为 0,表示关闭自动 S3 迁移,可配置为 1。 | ### 检查配置参数可用性 @@ -108,9 +108,9 @@ s3migrate database ; | # | 参数 | 默认值 | 最小值 | 最大值 | 描述 | | :--- | :----------- | :----- | :----- | :------ | :----------------------------------------------------------- | -| 1 | s3_keeplocal | 3650 | 1 | 365000 | 数据在本地保留的天数,即 data 文件在本地磁盘保留多长时间后可以上传到 S3。默认单位:天,支持 m(分钟)、h(小时)和 d(天)三个单位 | +| 1 | s3_keeplocal | 365 | 1 | 365000 | 数据在本地保留的天数,即 data 文件在本地磁盘保留多长时间后可以上传到 S3。默认单位:天,支持 m(分钟)、h(小时)和 d(天)三个单位 | | 2 | s3_chunksize | 262144 | 131072 | 1048576 | 上传对象的大小阈值,与 TSDB_PAGESIZE 参数一样,不可修改,单位为 TSDB 页 | -| 3 | s3_compact | 0 | 0 | 1 | TSDB 文件组首次上传 S3 时,是否自动进行 compact 操作。 | +| 3 | s3_compact | 1 | 0 | 1 | TSDB 文件组首次上传 S3 时,是否自动进行 compact 操作。 | ## Azure Blob 存储 本节介绍在 TDengine Enterprise 如何使用微软 Azure Blob 对象存储。本功能是上一小节‘对象存储’功能的扩展,需额外依赖 Flexify 服务提供的 S3 网关。通过适当的参数配置,可以把大部分较冷的时序数据存储到 Azure Blob 服务中。 From ff46074b193ebd1ae1bb72e654613ebe79473ddf Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Fri, 25 Oct 2024 15:43:28 +0800 Subject: [PATCH 298/695] unsupported sliding --- docs/zh/06-advanced/03-stream.md | 2 +- docs/zh/14-reference/03-taos-sql/14-stream.md | 2 +- source/libs/parser/src/parTranslater.c | 12 ++++++++++++ tests/script/tsim/stream/streamTwaError.sim | 3 +++ 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/docs/zh/06-advanced/03-stream.md b/docs/zh/06-advanced/03-stream.md index 1827c0903310..d2947f96586d 100644 --- a/docs/zh/06-advanced/03-stream.md +++ b/docs/zh/06-advanced/03-stream.md @@ -120,7 +120,7 @@ create stream if not exists count_history_s fill_history 1 into count_history as 1. AT_ONCE:写入立即触发。 2. WINDOW_CLOSE:窗口关闭时触发(窗口关闭由事件时间决定,可配合 watermark 使用)。 3. MAX_DELAY time:若窗口关闭,则触发计算。若窗口未关闭,且未关闭时长超过 max delay 指定的时间,则触发计算。 -4. FORCE_WINDOW_CLOSE:以操作系统当前时间为准,只计算当前关闭窗口的结果,并推送出去。窗口只会在被关闭的时刻计算一次,后续不会再重复计算。该模式当前只支持INTERVAL窗口和INTERP函数;FILL_HISTORY必须为 0,IGNORE EXPIRED必须为 1,IGNORE EXPIRED必须为 1;FILL只支持PREV 、NULL、 NONE、VALUE。 +4. FORCE_WINDOW_CLOSE:以操作系统当前时间为准,只计算当前关闭窗口的结果,并推送出去。窗口只会在被关闭的时刻计算一次,后续不会再重复计算。该模式当前只支持INTERVAL窗口(不支持滑动)和INTERP函数;FILL_HISTORY必须为 0,IGNORE EXPIRED必须为 1,IGNORE EXPIRED必须为 1;FILL只支持PREV 、NULL、 NONE、VALUE。 窗口关闭是由事件时间决定的,如事件流中断、或持续延迟,此时事件时间无法更新,可能导致无法得到最新的计算结果。 diff --git a/docs/zh/14-reference/03-taos-sql/14-stream.md b/docs/zh/14-reference/03-taos-sql/14-stream.md index ed9b4d261721..1bc0bf3b44ba 100644 --- a/docs/zh/14-reference/03-taos-sql/14-stream.md +++ b/docs/zh/14-reference/03-taos-sql/14-stream.md @@ -150,7 +150,7 @@ SELECT * from information_schema.`ins_streams`; 2. WINDOW_CLOSE:窗口关闭时触发(窗口关闭由事件时间决定,可配合 watermark 使用) 3. MAX_DELAY time:若窗口关闭,则触发计算。若窗口未关闭,且未关闭时长超过 max delay 指定的时间,则触发计算。 -4. FORCE_WINDOW_CLOSE:以操作系统当前时间为准,只计算当前关闭窗口的结果,并推送出去。窗口只会在被关闭的时刻计算一次,后续不会再重复计算。该模式当前只支持INTERVAL窗口和INTERP函数;FILL_HISTORY必须为 0,IGNORE EXPIRED必须为 1,IGNORE EXPIRED必须为 1;FILL只支持PREV 、NULL、 NONE、VALUE。 +4. FORCE_WINDOW_CLOSE:以操作系统当前时间为准,只计算当前关闭窗口的结果,并推送出去。窗口只会在被关闭的时刻计算一次,后续不会再重复计算。该模式当前只支持INTERVAL窗口(不支持滑动)和INTERP函数;FILL_HISTORY必须为 0,IGNORE EXPIRED必须为 1,IGNORE EXPIRED必须为 1;FILL只支持PREV 、NULL、 NONE、VALUE。 由于窗口关闭是由事件时间决定的,如事件流中断、或持续延迟,则事件时间无法更新,可能导致无法得到最新的计算结果。 diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 548da84d9f42..be9515e450c9 100755 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -10996,6 +10996,18 @@ static int32_t checkStreamQuery(STranslateContext* pCxt, SCreateStreamStmt* pStm &pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY, "When trigger was force window close, Stream must not set ignore update 0"); } + + if (pSelect->pWindow != NULL && QUERY_NODE_INTERVAL_WINDOW == nodeType(pSelect->pWindow)) { + SIntervalWindowNode* pWindow = (SIntervalWindowNode*)pSelect->pWindow; + if (NULL != pWindow->pSliding) { + int64_t interval = ((SValueNode*)pWindow->pInterval)->datum.i; + int64_t sliding = ((SValueNode*)pWindow->pSliding)->datum.i; + if (interval != sliding) { + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY, + "When trigger was force window close, Stream unsupported sliding"); + } + } + } } if (NULL != pSelect->pGroupByList) { diff --git a/tests/script/tsim/stream/streamTwaError.sim b/tests/script/tsim/stream/streamTwaError.sim index 9e84ffb48c4c..625b5840c9a7 100644 --- a/tests/script/tsim/stream/streamTwaError.sim +++ b/tests/script/tsim/stream/streamTwaError.sim @@ -26,6 +26,9 @@ sql_error create stream streams8 trigger force_window_close IGNORE EXPIRED 1 IGN sql_error create stream streams9 trigger at_once IGNORE EXPIRED 1 IGNORE UPDATE 1 into streamt9 as select _wstart, elapsed(ts) from st partition by tbname,ta interval(2s) fill(prev); +sql_error create stream streams10 trigger force_window_close IGNORE EXPIRED 1 IGNORE UPDATE 1 into streamt10 as select _wstart, sum(a) from st partition by tbname,ta interval(2s) SLIDING(1s); +sql create stream streams11 trigger force_window_close IGNORE EXPIRED 1 IGNORE UPDATE 1 into streamt11 as select _wstart, avg(a) from st partition by tbname,ta interval(2s) SLIDING(2s); + print end system sh/exec.sh -n dnode1 -s stop -x SIGINT From c6ef1333f6d5149ef41679e741b68886e2afd97c Mon Sep 17 00:00:00 2001 From: dmchen Date: Fri, 25 Oct 2024 07:48:32 +0000 Subject: [PATCH 299/695] fix/TD-32681-monitor-test-ci-fail --- source/libs/monitor/test/monTest.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/libs/monitor/test/monTest.cpp b/source/libs/monitor/test/monTest.cpp index 2660cff21695..a788a5a3410b 100644 --- a/source/libs/monitor/test/monTest.cpp +++ b/source/libs/monitor/test/monTest.cpp @@ -26,7 +26,10 @@ class MonitorTest : public ::testing::Test { monInit(&cfg); } - static void TearDownTestSuite() { monCleanup(); } + static void TearDownTestSuite() { + monCleanup(); + taosMsleep(100); + } public: void SetUp() override {} From e71fb627230d9d9d6feb2aac90713f0517a92111 Mon Sep 17 00:00:00 2001 From: dmchen Date: Fri, 25 Oct 2024 08:05:10 +0000 Subject: [PATCH 300/695] fix/TD-32621-remove-from-hash-when-creating-fail --- source/dnode/mgmt/mgmt_vnode/src/vmHandle.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c index f55cb648e084..99d76d553173 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c @@ -442,7 +442,8 @@ int32_t vmProcessCreateVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) { dError("vgId:%d, failed to lock since %s", req.vgId, tstrerror(r)); } if (r == 0) { - r = taosHashRemove(pMgmt->hash, &pVnode->vgId, sizeof(int32_t)); + dInfo("vgId:%d, remove from hash", req.vgId); + r = taosHashRemove(pMgmt->hash, &req.vgId, sizeof(int32_t)); if (r != 0) { dError("vgId:%d, failed to remove vnode since %s", req.vgId, tstrerror(r)); } From 077005a9f99f939905c3323d8cb3b1b529ead3a6 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Fri, 25 Oct 2024 16:08:38 +0800 Subject: [PATCH 301/695] fix ci issue --- source/libs/executor/src/sysscanoperator.c | 4 ++-- source/libs/stream/src/streamState.c | 2 +- source/libs/stream/src/tstreamFileState.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/source/libs/executor/src/sysscanoperator.c b/source/libs/executor/src/sysscanoperator.c index 108cf7820421..20d290db0196 100644 --- a/source/libs/executor/src/sysscanoperator.c +++ b/source/libs/executor/src/sysscanoperator.c @@ -2069,11 +2069,11 @@ static int32_t doSysTableScanNext(SOperatorInfo* pOperator, SSDataBlock** ppRes) getDBNameFromCondition(pInfo->pCondition, dbName); if (strncasecmp(name, TSDB_INS_TABLE_COMPACTS, TSDB_TABLE_FNAME_LEN) != 0 && strncasecmp(name, TSDB_INS_TABLE_COMPACT_DETAILS, TSDB_TABLE_FNAME_LEN) != 0) { - tsnprintf(pInfo->req.db, sizeof(pInfo->req.db), "%d.%s", pInfo->accountId, dbName); + TAOS_UNUSED(tsnprintf(pInfo->req.db, sizeof(pInfo->req.db), "%d.%s", pInfo->accountId, dbName)); } } else if (strncasecmp(name, TSDB_INS_TABLE_COLS, TSDB_TABLE_FNAME_LEN) == 0) { getDBNameFromCondition(pInfo->pCondition, dbName); - if (dbName[0]) tsnprintf(pInfo->req.db, sizeof(pInfo->req.db), "%d.%s", pInfo->accountId, dbName); + if (dbName[0]) TAOS_UNUSED(tsnprintf(pInfo->req.db, sizeof(pInfo->req.db), "%d.%s", pInfo->accountId, dbName)); (void)sysTableIsCondOnOneTable(pInfo->pCondition, pInfo->req.filterTb); } diff --git a/source/libs/stream/src/streamState.c b/source/libs/stream/src/streamState.c index 2791e3ceadd8..0e2ff48fa58b 100644 --- a/source/libs/stream/src/streamState.c +++ b/source/libs/stream/src/streamState.c @@ -120,7 +120,7 @@ SStreamState* streamStateOpen(const char* path, void* pTask, int64_t streamId, i SStreamTask* pStreamTask = pTask; pState->streamId = streamId; pState->taskId = taskId; - tsnprintf(pState->pTdbState->idstr, sizeof(pState->pTdbState->idstr), "0x%" PRIx64 "-0x%x", pState->streamId, pState->taskId); + TAOS_UNUSED(tsnprintf(pState->pTdbState->idstr, sizeof(pState->pTdbState->idstr), "0x%" PRIx64 "-0x%x", pState->streamId, pState->taskId)); code = streamTaskSetDb(pStreamTask->pMeta, pTask, pState->pTdbState->idstr); QUERY_CHECK_CODE(code, lino, _end); diff --git a/source/libs/stream/src/tstreamFileState.c b/source/libs/stream/src/tstreamFileState.c index d4a181f89f54..c63001059840 100644 --- a/source/libs/stream/src/tstreamFileState.c +++ b/source/libs/stream/src/tstreamFileState.c @@ -777,7 +777,7 @@ void flushSnapshot(SStreamFileState* pFileState, SStreamSnapshot* pSnapshot, boo int32_t forceRemoveCheckpoint(SStreamFileState* pFileState, int64_t checkpointId) { char keyBuf[128] = {0}; - tsnprintf(keyBuf, sizeof(keyBuf), "%s:%" PRId64 "", TASK_KEY, checkpointId); + TAOS_UNUSED(tsnprintf(keyBuf, sizeof(keyBuf), "%s:%" PRId64 "", TASK_KEY, checkpointId)); return streamDefaultDel_rocksdb(pFileState->pFileStore, keyBuf); } @@ -806,7 +806,7 @@ int32_t deleteExpiredCheckPoint(SStreamFileState* pFileState, TSKEY mark) { char buf[128] = {0}; void* val = 0; int32_t len = 0; - tsnprintf(buf, sizeof(buf), "%s:%" PRId64 "", TASK_KEY, i); + TAOS_UNUSED(tsnprintf(buf, sizeof(buf), "%s:%" PRId64 "", TASK_KEY, i)); code = streamDefaultGet_rocksdb(pFileState->pFileStore, buf, &val, &len); if (code != 0) { return TSDB_CODE_FAILED; From f5626d45bc3eedd33acb08ec3a30a07b68b4122a Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Fri, 25 Oct 2024 16:13:43 +0800 Subject: [PATCH 302/695] fix issue for windows compile --- source/libs/executor/src/sysscanoperator.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/source/libs/executor/src/sysscanoperator.c b/source/libs/executor/src/sysscanoperator.c index 20d290db0196..112c52ba235f 100644 --- a/source/libs/executor/src/sysscanoperator.c +++ b/source/libs/executor/src/sysscanoperator.c @@ -1065,10 +1065,10 @@ static int32_t sysTableUserTagsFillOneTableTags(const SSysTableScanInfo* pInfo, int8_t tagType = (*smrSuperTable).me.stbEntry.schemaTag.pSchema[i].type; pColInfoData = taosArrayGet(dataBlock->pDataBlock, 4); QUERY_CHECK_NULL(pColInfoData, code, lino, _end, terrno); - int32_t tagStrBufflen = 32; - char tagTypeStr[VARSTR_HEADER_SIZE + tagStrBufflen]; - int tagTypeLen = tsnprintf(varDataVal(tagTypeStr), tagStrBufflen, "%s", tDataTypes[tagType].name); - tagStrBufflen -= tagTypeLen; + const int32_t bufflen = 32; + char tagTypeStr[VARSTR_HEADER_SIZE + bufflen]; + int tagTypeLen = tsnprintf(varDataVal(tagTypeStr), bufflen, "%s", tDataTypes[tagType].name); + int32_t tagStrBufflen = bufflen - tagTypeLen; if (tagStrBufflen <= 0) { code = TSDB_CODE_INVALID_PARA; QUERY_CHECK_CODE(code, lino, _end); @@ -1204,10 +1204,10 @@ static int32_t sysTableUserColsFillOneTableCols(const SSysTableScanInfo* pInfo, int8_t colType = schemaRow->pSchema[i].type; pColInfoData = taosArrayGet(dataBlock->pDataBlock, 4); QUERY_CHECK_NULL(pColInfoData, code, lino, _end, terrno); - int32_t colStrBufflen = 32; - char colTypeStr[VARSTR_HEADER_SIZE + colStrBufflen]; - int colTypeLen = tsnprintf(varDataVal(colTypeStr), colStrBufflen, "%s", tDataTypes[colType].name); - colStrBufflen -= colTypeLen; + const int32_t bufflen = 32; + char colTypeStr[VARSTR_HEADER_SIZE + bufflen]; + int colTypeLen = tsnprintf(varDataVal(colTypeStr), bufflen, "%s", tDataTypes[colType].name); + int32_t colStrBufflen = bufflen - colTypeLen; if (colStrBufflen <= 0) { code = TSDB_CODE_INVALID_PARA; QUERY_CHECK_CODE(code, lino, _end); From dd913a211dddd5e1582786a1a90c992f9b7f5f82 Mon Sep 17 00:00:00 2001 From: dmchen Date: Fri, 25 Oct 2024 08:48:54 +0000 Subject: [PATCH 303/695] doc/TD-32681-drop-dnode --- docs/en/14-reference/03-taos-sql/21-node.md | 10 ++++++++++ docs/zh/14-reference/03-taos-sql/21-node.md | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/docs/en/14-reference/03-taos-sql/21-node.md b/docs/en/14-reference/03-taos-sql/21-node.md index 2ebccb76f711..fd1a9df53ec6 100644 --- a/docs/en/14-reference/03-taos-sql/21-node.md +++ b/docs/en/14-reference/03-taos-sql/21-node.md @@ -32,6 +32,16 @@ DROP DNODE dnode_id Note that deleting a dnode does not stop its process. You must stop the process after the dnode is deleted. +```sql +DROP DNODE dnode_id force +``` +Only online node is allowed to be deleted. Drop is executed forcely if the offline node need to be deleted. + +```sql +DROP DNODE dnode_id unsafe +``` +Drop is executed unsafely if the node with single replica is offline, and the data on it is not able to be restored. + ## Modify Dnode Configuration ```sql diff --git a/docs/zh/14-reference/03-taos-sql/21-node.md b/docs/zh/14-reference/03-taos-sql/21-node.md index 967cb5112733..0137d0cd7938 100644 --- a/docs/zh/14-reference/03-taos-sql/21-node.md +++ b/docs/zh/14-reference/03-taos-sql/21-node.md @@ -32,6 +32,16 @@ DROP DNODE dnode_id 注意删除 dnode 不等于停止相应的进程。实际中推荐先将一个 dnode 删除之后再停止其所对应的进程。 +```sql +DROP DNODE dnode_id force +``` +只有在线节点可以被删除。如果要强制删除离线节点,需要执行强制删除操作。 + +```sql +DROP DNODE dnode_id unsafe +``` +当节点上存在单副本,并且节点处于离线,如果要强制删除该节点,需要执行非安全删除,并且数据不可再恢复。 + ## 修改数据节点配置 ```sql From 9dce56d552c4f99b7bbf45f4ff9c35e7c2110e6e Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Fri, 25 Oct 2024 16:49:45 +0800 Subject: [PATCH 304/695] fix: fields area left right quotes change total method --- tools/shell/src/shellAuto.c | 41 +++++++++++++------------------------ 1 file changed, 14 insertions(+), 27 deletions(-) diff --git a/tools/shell/src/shellAuto.c b/tools/shell/src/shellAuto.c index 2b203953dde7..81021965a2da 100644 --- a/tools/shell/src/shellAuto.c +++ b/tools/shell/src/shellAuto.c @@ -168,7 +168,6 @@ SWords shellCommands[] = { {"show create database \\G;", 0, 0, NULL}, {"show create stable \\G;", 0, 0, NULL}, {"show create table \\G;", 0, 0, NULL}, - {"show create tsma \\G;", 0, 0, NULL}, #ifdef TD_ENTERPRISE {"show create view \\G;", 0, 0, NULL}, {"show compact", 0, 0, NULL}, @@ -290,7 +289,7 @@ char* tb_actions[] = { char* user_actions[] = {"pass ", "enable ", "sysinfo "}; -char* tb_options[] = {"comment ", "watermark ", "max_delay ", "ttl ", "rollup(", "sma("}; +char* tb_options[] = {"tags(", "comment ", "watermark ", "max_delay ", "ttl ", "rollup(", "sma("}; char* db_options[] = {"keep ", "replica ", @@ -335,7 +334,7 @@ char* data_types[] = {"timestamp", "int", "bigint", "bigint unsigned", "smallint", "smallint unsigned", "tinyint", "tinyint unsigned", - "geometry", "varbinary(16)", + "geometry(64)", "varbinary(16)", "bool", "json"}; char* key_tags[] = {"tags("}; @@ -1759,36 +1758,24 @@ bool fieldOptionsArea(char* p) { // if is input create fields or tags area, return true bool isCreateFieldsArea(char* p) { - // put to while, support like create table st(ts timestamp, bin1 binary(16), bin2 + blank + TAB - char* p1 = taosStrdup(p); - bool ret = false; - while (1) { - char* left = strrchr(p1, '('); - if (left == NULL) { - // like 'create table st' - ret = false; + int32_t n = 0; // count + char *p1 = p; + while (*p1 != 0) { + switch (*p1) { + case '(': + ++ n; break; - } - - char* right = strrchr(p1, ')'); - if (right == NULL) { - // like 'create table st( ' - ret = true; + case ')': + -- n; break; - } - - if (left > right) { - // like 'create table st( ts timestamp, age int) tags(area ' - ret = true; + default: break; } - - // set string end by small for next strrchr search - *left = 0; + // move next + ++p1; } - taosMemoryFree(p1); - return ret; + return n > 0; } bool matchCreateTable(TAOS* con, SShellCmd* cmd) { From d5876b045751f49cd304c80d100f0812e76aa00e Mon Sep 17 00:00:00 2001 From: lyh250-666 Date: Fri, 25 Oct 2024 16:59:46 +0800 Subject: [PATCH 305/695] opti:modify bytes for numbers and string --- source/libs/parser/src/parTranslater.c | 16 +++++-------- source/libs/scalar/src/sclvector.c | 30 ++++++++++++------------ tests/script/tsim/scalar/caseWhen.sim | 32 +++++++++++--------------- 3 files changed, 35 insertions(+), 43 deletions(-) diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 636be7c5cce6..26151230d3f9 100755 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -3314,17 +3314,13 @@ static int32_t selectCommonType(SDataType* commonType, const SDataType* newType) commonType->bytes = TMAX(commonType->bytes, newType->bytes); return TSDB_CODE_SUCCESS; } - if (resultType == commonType->type){ - return TSDB_CODE_SUCCESS; - } - if(resultType == newType->type) { - *commonType = *newType; - return TSDB_CODE_SUCCESS; - } commonType->bytes = TMAX(TMAX(commonType->bytes, newType->bytes), TYPE_BYTES[resultType]); - if(resultType == TSDB_DATA_TYPE_VARCHAR && (IS_FLOAT_TYPE(commonType->type) || IS_FLOAT_TYPE(newType->type))) { - commonType->bytes += TYPE_BYTES[TSDB_DATA_TYPE_DOUBLE]; - } + if((resultType == TSDB_DATA_TYPE_VARCHAR || resultType == TSDB_DATA_TYPE_NCHAR) && ( + (IS_FLOAT_TYPE(commonType->type) || IS_FLOAT_TYPE(newType->type)) || + (IS_NUMERIC_TYPE(commonType->type) || IS_NUMERIC_TYPE(newType->type)))) + { + commonType->bytes = TMAX(commonType->bytes, 32); + } commonType->type = resultType; return TSDB_CODE_SUCCESS; diff --git a/source/libs/scalar/src/sclvector.c b/source/libs/scalar/src/sclvector.c index 54794b9044fa..487027941cf3 100644 --- a/source/libs/scalar/src/sclvector.c +++ b/source/libs/scalar/src/sclvector.c @@ -1033,21 +1033,21 @@ int8_t gConvertTypes[TSDB_DATA_TYPE_MAX][TSDB_DATA_TYPE_MAX] = { int8_t gDisplyTypes[TSDB_DATA_TYPE_MAX][TSDB_DATA_TYPE_MAX] = { /*NULL BOOL TINY SMAL INT BIGI FLOA DOUB VARC TIME NCHA UTINY USMA UINT UBIG JSON VARB DECI BLOB MEDB GEOM*/ /*NULL*/ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, -1, -1, -1, 8, - /*BOOL*/ 0, 1, 2, 3, 4, 5, 6, 7, 8, 5, 10, 11, 12, 13, 14, 8, -1, -1, -1, -1, 8, - /*TINY*/ 0, 0, 2, 3, 4, 5, 8, 8, 8, 5, 10, 3, 4, 5, 8, 8, -1, -1, -1, -1, 8, - /*SMAL*/ 0, 0, 0, 3, 4, 5, 8, 8, 8, 5, 10, 3, 4, 5, 8, 8, -1, -1, -1, -1, 8, - /*INT */ 0, 0, 0, 0, 4, 5, 8, 8, 8, 5, 10, 4, 4, 5, 8, 8, -1, -1, -1, -1, 8, - /*BIGI*/ 0, 0, 0, 0, 0, 5, 8, 8, 8, 5, 10, 5, 5, 5, 8, 8, -1, -1, -1, -1, 8, - /*FLOA*/ 0, 0, 0, 0, 0, 0, 6, 7, 8, 8, 10, 8, 8, 8, 8, 8, -1, -1, -1, -1, 8, - /*DOUB*/ 0, 0, 0, 0, 0, 0, 0, 7, 8, 8, 10, 8, 8, 8, 8, 8, -1, -1, -1, -1, 8, - /*VARC*/ 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 10, 8, 8, 8, 8, 8, -1, -1, -1, -1, 8, - /*TIME*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 10, 5, 5, 5, 8, 8, -1, -1, -1, -1, 8, - /*NCHA*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10, 10, 10, 10, 10, -1, -1, -1, -1, 10, - /*UTINY*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 12, 13, 14, 8, -1, -1, -1, -1, 8, - /*USMA*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 13, 14, 8, -1, -1, -1, -1, 8, - /*UINT*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 14, 8, -1, -1, -1, -1, 8, - /*UBIG*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 8, -1, -1, -1, -1, 8, - /*JSON*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, -1, -1, -1, -1, 8, + /*BOOL*/ 0, 1, 2, 3, 4, 5, 6, 7, 8, 5, 10, 11, 12, 13, 14, -1, -1, -1, -1, -1, -1, + /*TINY*/ 0, 0, 2, 3, 4, 5, 8, 8, 8, 5, 10, 3, 4, 5, 8, -1, -1, -1, -1, -1, -1, + /*SMAL*/ 0, 0, 0, 3, 4, 5, 8, 8, 8, 5, 10, 3, 4, 5, 8, -1, -1, -1, -1, -1, -1, + /*INT */ 0, 0, 0, 0, 4, 5, 8, 8, 8, 5, 10, 4, 4, 5, 8, -1, -1, -1, -1, -1, -1, + /*BIGI*/ 0, 0, 0, 0, 0, 5, 8, 8, 8, 5, 10, 5, 5, 5, 8, -1, -1, -1, -1, -1, -1, + /*FLOA*/ 0, 0, 0, 0, 0, 0, 6, 7, 8, 8, 10, 8, 8, 8, 8, -1, -1, -1, -1, -1, -1, + /*DOUB*/ 0, 0, 0, 0, 0, 0, 0, 7, 8, 8, 10, 8, 8, 8, 8, -1, -1, -1, -1, -1, -1, + /*VARC*/ 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 10, 8, 8, 8, 8, -1, -1, -1, -1, -1, -1, + /*TIME*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 10, 5, 5, 5, 8, -1, -1, -1, -1, -1, -1, + /*NCHA*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10, 10, 10, 10, -1, -1, -1, -1, -1, -1, + /*UTINY*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 12, 13, 14, -1, -1, -1, -1, -1, -1, + /*USMA*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 13, 14, -1, -1, -1, -1, -1, -1, + /*UINT*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 14, -1, -1, -1, -1, -1, -1, + /*UBIG*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, -1, -1, -1, -1, -1, -1, + /*JSON*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, /*VARB*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, -1, -1, -1, -1, /*DECI*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, /*BLOB*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, diff --git a/tests/script/tsim/scalar/caseWhen.sim b/tests/script/tsim/scalar/caseWhen.sim index 67c8ac36735b..3bba63aae3db 100644 --- a/tests/script/tsim/scalar/caseWhen.sim +++ b/tests/script/tsim/scalar/caseWhen.sim @@ -838,7 +838,7 @@ endi if $data20 != 11 then return -1 endi -if $data30 != 1664176504 then +if $data30 != 1664176504000 then return -1 endi @@ -1130,36 +1130,32 @@ if $data00 != varchar_val then return -1 endi -sql select case when ts > '2022-01-01 00:00:00' then c_varchar else c_geometry end as result from t_test; -if $data00 != varchar_val then +sql select case when 1 then 1234567890987654 else 'abcertyuiojhgfddhjgfcvbn' end; +if $data00 != 1234567890987654 then return -1 endi -sql select case when ts > '2022-01-01 00:00:00' then c_bool else c_geometry end as result from t_test; -if $data00 != true then +sql select case when 0 then 1234567890987654 else 'abcertyuiojhgfddhjgfcvbn' end; +if $data00 != abcertyuiojhgfddhjgfcvbn then return -1 endi -sql select case when 0 then tag_id else c_geometry end as result from t_test; -if $data00 != 16842773 then - return -1 -endi - -sql select case when 0 then tag_id else c_nchar end as result from t_test; +sql select case when 0 then 1234567890987654 else c_nchar end from t_test; if $data00 != 涛思数据 then return -1 endi -sql select case when 0 then tag_id else c_int end as result from t_test; -if $data00 != 123 then - return -1 -endi - -sql select case when 0 then tag_id else c_float end as result from t_test; -if $data00 != 123.449997 then +sql select case when 1 then 1234567890987654 else c_nchar end from t_test; +if $data00 != 1234567890987654 then return -1 endi +sql_error select case when ts > '2022-01-01 00:00:00' then c_varchar else c_geometry end as result from t_test; +sql_error select case when ts > '2022-01-01 00:00:00' then c_bool else c_geometry end as result from t_test; +sql_error select case when 0 then tag_id else c_geometry end as result from t_test; +sql_error select case when 0 then tag_id else c_nchar end as result from t_test; +sql_error select case when 0 then tag_id else c_int end as result from t_test; +sql_error select case when 0 then tag_id else c_float end as result from t_test; sql_error select case when c_double > 100 then c_varbinary else c_geometry end as result from t_test; sql_error select case when c_bool then c_double else c_varbinary end as result from t_test; sql_error select case when c_bool then c_varbinary else c_varchar end as result from t_test; From fca6e89dc576d4a424f87339f692fa6dc0c57058 Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Fri, 25 Oct 2024 17:03:01 +0800 Subject: [PATCH 306/695] fix: fill tags is passed --- tools/shell/src/shellAuto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/shell/src/shellAuto.c b/tools/shell/src/shellAuto.c index 81021965a2da..18b9bb88603d 100644 --- a/tools/shell/src/shellAuto.c +++ b/tools/shell/src/shellAuto.c @@ -289,7 +289,7 @@ char* tb_actions[] = { char* user_actions[] = {"pass ", "enable ", "sysinfo "}; -char* tb_options[] = {"tags(", "comment ", "watermark ", "max_delay ", "ttl ", "rollup(", "sma("}; +char* tb_options[] = {"comment ", "watermark ", "max_delay ", "ttl ", "rollup(", "sma("}; char* db_options[] = {"keep ", "replica ", From 38ae87fa05d3ae042394543cc89513ef9cbcc914 Mon Sep 17 00:00:00 2001 From: lyh250-666 Date: Fri, 25 Oct 2024 17:05:14 +0800 Subject: [PATCH 307/695] opti:modify bytes for numbers and string --- source/libs/scalar/src/sclvector.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/libs/scalar/src/sclvector.c b/source/libs/scalar/src/sclvector.c index 487027941cf3..f2e27c2f65b0 100644 --- a/source/libs/scalar/src/sclvector.c +++ b/source/libs/scalar/src/sclvector.c @@ -1032,7 +1032,7 @@ int8_t gConvertTypes[TSDB_DATA_TYPE_MAX][TSDB_DATA_TYPE_MAX] = { int8_t gDisplyTypes[TSDB_DATA_TYPE_MAX][TSDB_DATA_TYPE_MAX] = { /*NULL BOOL TINY SMAL INT BIGI FLOA DOUB VARC TIME NCHA UTINY USMA UINT UBIG JSON VARB DECI BLOB MEDB GEOM*/ - /*NULL*/ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, -1, -1, -1, 8, + /*NULL*/ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, -1, -1, -1, 20, /*BOOL*/ 0, 1, 2, 3, 4, 5, 6, 7, 8, 5, 10, 11, 12, 13, 14, -1, -1, -1, -1, -1, -1, /*TINY*/ 0, 0, 2, 3, 4, 5, 8, 8, 8, 5, 10, 3, 4, 5, 8, -1, -1, -1, -1, -1, -1, /*SMAL*/ 0, 0, 0, 3, 4, 5, 8, 8, 8, 5, 10, 3, 4, 5, 8, -1, -1, -1, -1, -1, -1, @@ -1040,7 +1040,7 @@ int8_t gDisplyTypes[TSDB_DATA_TYPE_MAX][TSDB_DATA_TYPE_MAX] = { /*BIGI*/ 0, 0, 0, 0, 0, 5, 8, 8, 8, 5, 10, 5, 5, 5, 8, -1, -1, -1, -1, -1, -1, /*FLOA*/ 0, 0, 0, 0, 0, 0, 6, 7, 8, 8, 10, 8, 8, 8, 8, -1, -1, -1, -1, -1, -1, /*DOUB*/ 0, 0, 0, 0, 0, 0, 0, 7, 8, 8, 10, 8, 8, 8, 8, -1, -1, -1, -1, -1, -1, - /*VARC*/ 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 10, 8, 8, 8, 8, -1, -1, -1, -1, -1, -1, + /*VARC*/ 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 10, 8, 8, 8, 8, -1, 8, -1, -1, -1, -1, /*TIME*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 10, 5, 5, 5, 8, -1, -1, -1, -1, -1, -1, /*NCHA*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10, 10, 10, 10, -1, -1, -1, -1, -1, -1, /*UTINY*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 12, 13, 14, -1, -1, -1, -1, -1, -1, From dffab4422ff714aad58ce67e05865cbc7799ec7e Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Fri, 25 Oct 2024 17:05:33 +0800 Subject: [PATCH 308/695] fix: fill tags is passed1 --- tools/shell/src/shellAuto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/shell/src/shellAuto.c b/tools/shell/src/shellAuto.c index 18b9bb88603d..f0d61e4a5456 100644 --- a/tools/shell/src/shellAuto.c +++ b/tools/shell/src/shellAuto.c @@ -1828,7 +1828,7 @@ bool matchCreateTable(TAOS* con, SShellCmd* cmd) { // find only one ')' , can insert tags char* p1 = strchr(ps, ')'); if (p1) { - if (strchr(p1 + 1, ')') == NULL && strstr(p1 + 1, "tags") == NULL) { + if (strstr(p1 + 1, "tags") == NULL) { // can insert tags keyword ret = fillWithType(con, cmd, last, WT_VAR_KEYTAGS); } From ed1186f05e416777610e63ad468c8406ae136838 Mon Sep 17 00:00:00 2001 From: lyh250-666 Date: Fri, 25 Oct 2024 17:20:59 +0800 Subject: [PATCH 309/695] opti:modify bytes for numbers and string, and varbinary --- source/libs/scalar/src/sclvector.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/scalar/src/sclvector.c b/source/libs/scalar/src/sclvector.c index f2e27c2f65b0..2fb37e34bf5e 100644 --- a/source/libs/scalar/src/sclvector.c +++ b/source/libs/scalar/src/sclvector.c @@ -1040,7 +1040,7 @@ int8_t gDisplyTypes[TSDB_DATA_TYPE_MAX][TSDB_DATA_TYPE_MAX] = { /*BIGI*/ 0, 0, 0, 0, 0, 5, 8, 8, 8, 5, 10, 5, 5, 5, 8, -1, -1, -1, -1, -1, -1, /*FLOA*/ 0, 0, 0, 0, 0, 0, 6, 7, 8, 8, 10, 8, 8, 8, 8, -1, -1, -1, -1, -1, -1, /*DOUB*/ 0, 0, 0, 0, 0, 0, 0, 7, 8, 8, 10, 8, 8, 8, 8, -1, -1, -1, -1, -1, -1, - /*VARC*/ 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 10, 8, 8, 8, 8, -1, 8, -1, -1, -1, -1, + /*VARC*/ 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 10, 8, 8, 8, 8, -1, 16, -1, -1, -1, -1, /*TIME*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 10, 5, 5, 5, 8, -1, -1, -1, -1, -1, -1, /*NCHA*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10, 10, 10, 10, -1, -1, -1, -1, -1, -1, /*UTINY*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 12, 13, 14, -1, -1, -1, -1, -1, -1, From 417938d2b294eeb9cac553caeb1c6adc4ecdffe2 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Fri, 25 Oct 2024 17:21:28 +0800 Subject: [PATCH 310/695] fix issue --- source/libs/executor/src/sysscanoperator.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source/libs/executor/src/sysscanoperator.c b/source/libs/executor/src/sysscanoperator.c index 112c52ba235f..a997a956867e 100644 --- a/source/libs/executor/src/sysscanoperator.c +++ b/source/libs/executor/src/sysscanoperator.c @@ -2032,8 +2032,7 @@ static EDealRes getDBNameFromConditionWalker(SNode* pNode, void* pContext) { SValueNode* node = (SValueNode*)pNode; char* dbName = nodesGetValueFromNode(node); - tstrncpy((char*)pContext, varDataVal(dbName), varDataLen(dbName)); - *((char*)pContext + varDataLen(dbName)) = 0; + tstrncpy((char*)pContext, varDataVal(dbName), varDataLen(dbName) + 1); return DEAL_RES_END; // stop walk } default: From e6031cba1e6d5cb4dd9ef018d88f8dd30efe4258 Mon Sep 17 00:00:00 2001 From: lyh250-666 Date: Fri, 25 Oct 2024 17:27:36 +0800 Subject: [PATCH 311/695] opti:modify bytes for numbers and string, and varbinary --- tests/script/tsim/scalar/caseWhen.sim | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/script/tsim/scalar/caseWhen.sim b/tests/script/tsim/scalar/caseWhen.sim index 3bba63aae3db..4753e245137c 100644 --- a/tests/script/tsim/scalar/caseWhen.sim +++ b/tests/script/tsim/scalar/caseWhen.sim @@ -1150,6 +1150,11 @@ if $data00 != 1234567890987654 then return -1 endi +sql select case when 1 then c_varchar else c_varbinary end from t_test; +if $data00 != null then + return -1 +endi + sql_error select case when ts > '2022-01-01 00:00:00' then c_varchar else c_geometry end as result from t_test; sql_error select case when ts > '2022-01-01 00:00:00' then c_bool else c_geometry end as result from t_test; sql_error select case when 0 then tag_id else c_geometry end as result from t_test; @@ -1158,6 +1163,5 @@ sql_error select case when 0 then tag_id else c_int end as result from t_test; sql_error select case when 0 then tag_id else c_float end as result from t_test; sql_error select case when c_double > 100 then c_varbinary else c_geometry end as result from t_test; sql_error select case when c_bool then c_double else c_varbinary end as result from t_test; -sql_error select case when c_bool then c_varbinary else c_varchar end as result from t_test; system sh/exec.sh -n dnode1 -s stop -x SIGINT From f897543994d156d4055c4ae9c062a98308c0cdce Mon Sep 17 00:00:00 2001 From: charles Date: Fri, 25 Oct 2024 17:31:21 +0800 Subject: [PATCH 312/695] add test case for case...when... by charles --- tests/army/query/test_case_when.py | 361 +++++++++++++++++++++++++++++ tests/parallel_test/cases.task | 1 + 2 files changed, 362 insertions(+) create mode 100644 tests/army/query/test_case_when.py diff --git a/tests/army/query/test_case_when.py b/tests/army/query/test_case_when.py new file mode 100644 index 000000000000..9edc9daad695 --- /dev/null +++ b/tests/army/query/test_case_when.py @@ -0,0 +1,361 @@ +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * +from frame.eos import * +from datetime import datetime, timedelta + + +class TDTestCase(TBase): + """Verify the case...when... expression in the query statement + """ + def init(self, conn, logSql, replicaVar=1): + self.replicaVar = int(replicaVar) + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + self.stable_schema = { + "columns": { + "ts": "timestamp", + "c_null": "int", + "c_bool": "bool", + "c_tinyint": "tinyint", + "c_smallint": "smallint", + "c_int": "int", + "c_bigint": "bigint", + "c_float": "float", + "c_double": "double", + "c_varchar": "varchar(16)", + "c_timestamp": "timestamp", + "c_nchar": "nchar(16)", + "c_utinyint": "tinyint unsigned", + "c_usmallint": "smallint unsigned", + "c_uint": "int unsigned", + "c_ubigint": "bigint unsigned", + "c_varbinary": "varbinary(16)", + "c_geometry": "geometry(32)" + }, + "tags": { + "t_null": "int", + "t_bool": "bool", + "t_tinyint": "tinyint", + "t_smallint": "smallint", + "t_int": "int", + "t_bigint": "bigint", + "t_float": "float", + "t_double": "double", + "t_varchar": "varchar(16)", + "t_timestamp": "timestamp", + "t_nchar": "nchar(16)", + "t_utinyint": "tinyint unsigned", + "t_usmallint": "smallint unsigned", + "t_uint": "int unsigned", + "t_ubigint": "bigint unsigned", + "t_varbinary": "varbinary(16)", + "t_geometry": "geometry(32)" + } + } + + def prepare_data(self): + # create database + tdSql.execute("create database test_case_when;") + tdSql.execute("use test_case_when;") + # create stable + columns = ",".join([f"{k} {v}" for k, v in self.stable_schema["columns"].items()]) + tags = ",".join([f"{k} {v}" for k, v in self.stable_schema["tags"].items()]) + st_sql = f"create stable st1 ({columns}) tags ({tags});" + tdSql.execute(st_sql) + st_sql_json_tag = f"create stable st2 ({columns}) tags (t json);" + tdSql.execute(st_sql_json_tag) + # create child table + tdSql.execute("create table ct1 using st1 tags(NULL, True, 1, 1, 1, 1, 1.1, 1.11, 'aaaaaaaa', '2021-09-01 00:00:00.000', 'aaaaaaaa', 1, 1, 1, 1, \"0x06\",'POINT(1 1)');") + tdSql.execute("""create table ct2 using st2 tags('{"name": "test", "location": "beijing"}');""") + # insert data + ct1_data = [ + """'2024-10-01 00:00:00.000', NULL, True, 2, 2, 2, 2, 2.2, 2.22, 'bbbbbbbb', '2021-09-01 00:00:00.000', 'bbbbbbbb', 2, 2, 2, 2, "0x07",'POINT(2 2)'""", + """'2024-10-01 00:00:01.000', NULL, False, 3, 3, 3, 3, 3.3, 3.33, 'cccccccc', '2021-09-01 00:00:00.000', 'cccccccc', 3, 3, 3, 3, "0x08",'POINT(3 3)'""", + """'2024-10-01 00:00:02.000', NULL, True, 4, 4, 4, 4, 4.4, 4.44, 'dddddddd', '2021-09-01 00:00:00.000', 'dddddddd', 4, 4, 4, 4, "0x09",'POINT(4 4)'""", + """'2024-10-01 00:00:03.000', NULL, False, 5, 5, 5, 5, 5.5, 5.55, 'eeeeeeee', '2021-09-01 00:00:00.000', 'eeeeeeee', 5, 5, 5, 5, "0x0A",'POINT(5 5)'""", + """'2024-10-01 00:00:04.000', NULL, True, 6, 6, 6, 6, 6.6, 6.66, 'ffffffff', '2021-09-01 00:00:00.000', 'ffffffff', 6, 6, 6, 6, "0x0B",'POINT(6 6)'""", + """'2024-10-01 00:00:05.000', NULL, False, 7, 7, 7, 7, 7.7, 7.77, 'gggggggg', '2021-09-01 00:00:00.000', 'gggggggg', 7, 7, 7, 7, "0x0C",'POINT(7 7)'""", + """'2024-10-01 00:00:06.000', NULL, True, 8, 8, 8, 8, 8.8, 8.88, 'hhhhhhhh', '2021-09-01 00:00:00.000', 'hhhhhhhh', 8, 8, 8, 8, "0x0D",'POINT(8 8)'""", + """'2024-10-01 00:00:07.000', NULL, False, 9, 9, 9, 9, 9.9, 9.99, 'iiiiiiii', '2021-09-01 00:00:00.000', 'iiiiiiii', 9, 9, 9, 9, "0x0E",'POINT(9 9)'""", + """'2024-10-01 00:00:08.000', NULL, True, 10, 10, 10, 10, 10.10, 10.1010, 'jjjjjjjj', '2021-09-01 00:00:00.000', 'jjjjjjjj', 10, 10, 10, 10, "0x0F",'POINT(10 10)'""", + """'2024-10-01 00:00:09.000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL""" + ] + ct1_insert_sql = "insert into ct1 values(%s);" % "),(".join(ct1_data) + tdSql.execute(ct1_insert_sql) + ct2_data = [ + """'2024-10-01 00:00:00.000', NULL, True, 2, 2, 2, 2, 2.2, 2.22, 'bbbbbbbb', '2021-09-01 00:00:00.000', 'bbbbbbbb', 2, 2, 2, 2, "0x07",'POINT(2 2)'""", + """'2024-10-01 00:00:01.000', NULL, False, 3, 3, 3, 3, 3.3, 3.33, 'cccccccc', '2021-09-01 00:00:00.000', 'cccccccc', 3, 3, 3, 3, "0x08",'POINT(3 3)'""", + """'2024-10-01 00:00:02.000', NULL, True, 4, 4, 4, 4, 4.4, 4.44, 'dddddddd', '2021-09-01 00:00:00.000', 'dddddddd', 4, 4, 4, 4, "0x09",'POINT(4 4)'""", + """'2024-10-01 00:00:03.000', NULL, False, 5, 5, 5, 5, 5.5, 5.55, 'eeeeeeee', '2021-09-01 00:00:00.000', 'eeeeeeee', 5, 5, 5, 5, "0x0A",'POINT(5 5)'""", + """'2024-10-01 00:00:04.000', NULL, True, 6, 6, 6, 6, 6.6, 6.66, 'ffffffff', '2021-09-01 00:00:00.000', 'ffffffff', 6, 6, 6, 6, "0x0B",'POINT(6 6)'""", + """'2024-10-01 00:00:05.000', NULL, False, 7, 7, 7, 7, 7.7, 7.77, 'gggggggg', '2021-09-01 00:00:00.000', 'gggggggg', 7, 7, 7, 7, "0x0C",'POINT(7 7)'""", + """'2024-10-01 00:00:06.000', NULL, True, 8, 8, 8, 8, 8.8, 8.88, 'hhhhhhhh', '2021-09-01 00:00:00.000', 'hhhhhhhh', 8, 8, 8, 8, "0x0D",'POINT(8 8)'""", + """'2024-10-01 00:00:07.000', NULL, False, 9, 9, 9, 9, 9.9, 9.99, 'iiiiiiii', '2021-09-01 00:00:00.000', 'iiiiiiii', 9, 9, 9, 9, "0x0E",'POINT(9 9)'""", + """'2024-10-01 00:00:08.000', NULL, True, 10, 10, 10, 10, 10.10, 10.1010, 'jjjjjjjj', '2021-09-01 00:00:00.000', 'jjjjjjjj', 10, 10, 10, 10, "0x0F",'POINT(10 10)'""", + """'2024-10-01 00:00:09.000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL""" + ] + ct2_insert_sql = "insert into ct2 values(%s);" % "),(".join(ct2_data) + tdSql.execute(ct2_insert_sql) + + def test_case_when_statements(self): + tdSql.execute("use test_case_when;") + tdSql.query("select case when c_null is null then c_null else t_null end from st1;") + assert(tdSql.checkRows(10) and all([item[0] is None for item in tdSql.res])) + + tdSql.query("select case when c_null is not null then c_null else t_null end from st1;") + assert(tdSql.checkRows(10) and all([item[0] is None for item in tdSql.res])) + + tdSql.query("select case when c_bool is null then c_bool else c_null end from st1;") + assert(tdSql.checkRows(10) and all([item[0] is None for item in tdSql.res])) + + tdSql.query("select case when c_bool is not null then c_bool else c_null end from st1;") + assert(tdSql.checkRows(10) and tdSql.res == [(1,), (0,), (1,), (0,), (1,), (0,), (1,), (0,), (1,), (None,)]) + + tdSql.query("select case when c_tinyint is null then c_tinyint else c_null end from st1;") + assert(tdSql.checkRows(10) and all([item[0] is None for item in tdSql.res])) + + tdSql.query("select case when c_tinyint is not null then c_tinyint else c_null end from st1;") + assert(tdSql.checkRows(10) and tdSql.res == [(2,), (3,), (4,), (5,), (6,), (7,), (8,), (9,), (10,), (None,)]) + + tdSql.query("select case when c_smallint is null then c_smallint else c_null end from st1;") + assert(tdSql.checkRows(10) and all([item[0] is None for item in tdSql.res])) + + tdSql.query("select case when c_smallint is not null then c_smallint else c_null end from st1;") + assert(tdSql.checkRows(10) and tdSql.res == [(2,), (3,), (4,), (5,), (6,), (7,), (8,), (9,), (10,), (None,)]) + + tdSql.query("select case when c_int is null then c_int else c_null end from st1;") + assert(tdSql.checkRows(10) and all([item[0] is None for item in tdSql.res])) + + tdSql.query("select case when c_int is not null then c_int else c_null end from st1;") + assert(tdSql.checkRows(10) and tdSql.res == [(2,), (3,), (4,), (5,), (6,), (7,), (8,), (9,), (10,), (None,)]) + + tdSql.query("select case when c_bigint is null then c_bigint else c_null end from st1;") + assert(tdSql.checkRows(10) and all([item[0] is None for item in tdSql.res])) + + tdSql.query("select case when c_bigint is not null then c_bigint else c_null end from st1;") + assert(tdSql.checkRows(10) and tdSql.res == [(2,), (3,), (4,), (5,), (6,), (7,), (8,), (9,), (10,), (None,)]) + + tdSql.query("select case when c_float is null then c_float else c_null end from st1;") + assert(tdSql.checkRows(10) and all([item[0] is None for item in tdSql.res])) + + tdSql.query("select case when c_float is not null then c_float else c_null end from st1;") + assert(tdSql.checkRows(10) and tdSql.res == [('2.200000',), ('3.300000',), ('4.400000',), ('5.500000',), ('6.600000',), ('7.700000',), ('8.800000',), ('9.900000',), ('10.100000',), (None,)]) + + tdSql.query("select case when c_double is null then c_double else c_null end from st1;") + assert(tdSql.checkRows(10) and all([item[0] is None for item in tdSql.res])) + + tdSql.query("select case when c_double is not null then c_double else c_null end from st1;") + assert(tdSql.checkRows(10) and tdSql.res == [('2.220000',), ('3.330000',), ('4.440000',), ('5.550000',), ('6.660000',), ('7.770000',), ('8.880000',), ('9.990000',), ('10.101000',), (None,)]) + + tdSql.query("select case when c_varchar is null then c_varchar else c_null end from st1;") + assert(tdSql.checkRows(10) and all([item[0] is None for item in tdSql.res])) + + tdSql.query("select case when c_varchar is not null then c_varchar else c_null end from st1;") + assert(tdSql.checkRows(10) and tdSql.res == [('bbbbbbbb',), ('cccccccc',), ('dddddddd',), ('eeeeeeee',), ('ffffffff',), ('gggggggg',), ('hhhhhhhh',), ('iiiiiiii',), ('jjjjjjjj',), (None,)]) + + tdSql.query("select case when c_nchar is null then c_nchar else c_null end from st1;") + assert(tdSql.checkRows(10) and all([item[0] is None for item in tdSql.res])) + + tdSql.query("select case when c_nchar is not null then c_nchar else c_null end from st1;") + assert(tdSql.checkRows(10) and tdSql.res == [('bbbbbbbb',), ('cccccccc',), ('dddddddd',), ('eeeeeeee',), ('ffffffff',), ('gggggggg',), ('hhhhhhhh',), ('iiiiiiii',), ('jjjjjjjj',), (None,)]) + + tdSql.query("select case when c_utinyint is null then c_utinyint else c_null end from st1;") + assert(tdSql.checkRows(10) and all([item[0] is None for item in tdSql.res])) + + tdSql.query("select case when c_utinyint is not null then c_utinyint else c_null end from st1;") + assert(tdSql.checkRows(10) and tdSql.res == [(2,), (3,), (4,), (5,), (6,), (7,), (8,), (9,), (10,), (None,)]) + + tdSql.query("select case when c_usmallint is null then c_usmallint else c_null end from st1;") + assert(tdSql.checkRows(10) and all([item[0] is None for item in tdSql.res])) + + tdSql.query("select case when c_usmallint is not null then c_usmallint else c_null end from st1;") + assert(tdSql.checkRows(10) and tdSql.res == [(2,), (3,), (4,), (5,), (6,), (7,), (8,), (9,), (10,), (None,)]) + + tdSql.query("select case when c_uint is null then c_uint else c_null end from st1;") + assert(tdSql.checkRows(10) and all([item[0] is None for item in tdSql.res])) + + tdSql.query("select case when c_uint is not null then c_uint else c_null end from st1;") + assert(tdSql.checkRows(10) and tdSql.res == [(2,), (3,), (4,), (5,), (6,), (7,), (8,), (9,), (10,), (None,)]) + + tdSql.query("select case when c_ubigint is null then c_ubigint else c_null end from st1;") + assert(tdSql.checkRows(10) and all([item[0] is None for item in tdSql.res])) + + tdSql.query("select case when c_ubigint is not null then c_ubigint else c_null end from st1;") + assert(tdSql.checkRows(10) and tdSql.res == [('2',), ('3',), ('4',), ('5',), ('6',), ('7',), ('8',), ('9',), ('10',), (None,)]) + + tdSql.error("select case when c_varbinary is null then c_varbinary else c_null end from st1;") + tdSql.error("select case when c_varbinary is not null then c_varbinary else c_null end from st1;") + + tdSql.query("select case when c_null is null then NULL else c_bool end from st1;") + assert(tdSql.checkRows(10) and all([item[0] is None for item in tdSql.res])) + + tdSql.query("select case when c_null is not null then NULL else c_bool end from st1;") + assert(tdSql.checkRows(10) and tdSql.res == [(True,), (False,), (True,), (False,), (True,), (False,), (True,), (False,), (True,), (None,)]) + + tdSql.query("select case when c_bool=true then NULL else c_bool end from st1;") + assert(tdSql.checkRows(10) and tdSql.res == [(None,), (False,), (None,), (False,), (None,), (False,), (None,), (False,), (None,), (None,)]) + + tdSql.query("select case when c_bool!=true then NULL else c_bool end from st1;") + assert(tdSql.checkRows(10) and tdSql.res == [(True,), (None,), (True,), (None,), (True,), (None,), (True,), (None,), (True,), (None,)]) + + tdSql.query("select case when c_tinyint=2 then c_tinyint else c_bool end from st1;") + assert(tdSql.checkRows(10) and tdSql.res == [(2,), (0,), (1,), (0,), (1,), (0,), (1,), (0,), (1,), (None,)]) + + tdSql.query("select case when c_tinyint!=2 then c_tinyint else c_bool end from st1;") + assert(tdSql.checkRows(10) and tdSql.res == [(1,), (3,), (4,), (5,), (6,), (7,), (8,), (9,), (10,), (None,)]) + + tdSql.query("select case when c_smallint=2 then c_smallint else c_bool end from st1;") + assert(tdSql.checkRows(10) and tdSql.res == [(2,), (0,), (1,), (0,), (1,), (0,), (1,), (0,), (1,), (None,)]) + + tdSql.query("select case when c_smallint!=2 then c_smallint else c_bool end from st1;") + assert(tdSql.checkRows(10) and tdSql.res == [(1,), (3,), (4,), (5,), (6,), (7,), (8,), (9,), (10,), (None,)]) + + tdSql.query("select case when c_int=2 then c_int else c_bool end from st1;") + assert(tdSql.checkRows(10) and tdSql.res == [(2,), (0,), (1,), (0,), (1,), (0,), (1,), (0,), (1,), (None,)]) + + tdSql.query("select case when c_int!=2 then c_int else c_bool end from st1;") + assert(tdSql.checkRows(10) and tdSql.res == [(1,), (3,), (4,), (5,), (6,), (7,), (8,), (9,), (10,), (None,)]) + + tdSql.query("select case when c_bigint=2 then c_bigint else c_bool end from st1;") + assert(tdSql.checkRows(10) and tdSql.res == [(2,), (0,), (1,), (0,), (1,), (0,), (1,), (0,), (1,), (None,)]) + + tdSql.query("select case when c_bigint!=2 then c_bigint else c_bool end from st1;") + assert(tdSql.checkRows(10) and tdSql.res == [(1,), (3,), (4,), (5,), (6,), (7,), (8,), (9,), (10,), (None,)]) + + tdSql.query("select case when c_float=2.2 then c_float else c_bool end from st1;") + assert(tdSql.checkRows(10) and tdSql.res[1:] == [(0.0,), (1.0,), (0.0,), (1.0,), (0.0,), (1.0,), (0.0,), (1.0,), (None,)]) + + tdSql.query("select case when c_float!=2.2 then c_float else c_bool end from st1;") + assert(tdSql.checkRows(10) and tdSql.res[0] == (1.0,)) + + tdSql.query("select case when c_double=2.22 then c_double else c_bool end from st1;") + assert(tdSql.checkRows(10) and tdSql.res == [(2.22,), (0.0,), (1.0,), (0.0,), (1.0,), (0.0,), (1.0,), (0.0,), (1.0,), (None,)]) + + tdSql.query("select case when c_double!=2.2 then c_double else c_bool end from st1;") + assert(tdSql.checkRows(10) and tdSql.res == [(2.22,), (3.33,), (4.44,), (5.55,), (6.66,), (7.77,), (8.88,), (9.99,), (10.101,), (None,)]) + + tdSql.query("select case when c_varchar='bbbbbbbb' then c_varchar else c_bool end from st1;") + assert(tdSql.checkRows(10) and tdSql.res == [('bbbbbbbb',), ('false',), ('true',), ('false',), ('true',), ('false',), ('true',), ('false',), ('true',), (None,)]) + + tdSql.query("select case when c_varchar!='bbbbbbbb' then c_varchar else c_bool end from st1;") + assert(tdSql.checkRows(10) and tdSql.res == [('true',), ('cccccccc',), ('dddddddd',), ('eeeeeeee',), ('ffffffff',), ('gggggggg',), ('hhhhhhhh',), ('iiiiiiii',), ('jjjjjjjj',), (None,)]) + + tdSql.query("select case when c_timestamp='2021-09-01 00:00:00.000' then c_timestamp else c_bool end from st1;") + assert(tdSql.checkRows(10) and tdSql.res == [(1630425600000,), (1630425600000,), (1630425600000,), (1630425600000,), (1630425600000,), (1630425600000,), (1630425600000,), (1630425600000,), (1630425600000,), (None,)]) + + tdSql.query("select case when c_timestamp!='2021-09-01 00:00:00.000' then c_timestamp else c_bool end from st1;") + assert(tdSql.checkRows(10) and tdSql.res == [(1,), (0,), (1,), (0,), (1,), (0,), (1,), (0,), (1,), (None,)]) + + tdSql.query("select case when c_nchar='bbbbbbbb' then c_nchar else c_bool end from st1;") + assert(tdSql.checkRows(10) and tdSql.res == [('bbbbbbbb',), ('false',), ('true',), ('false',), ('true',), ('false',), ('true',), ('false',), ('true',), (None,)]) + + tdSql.query("select case when c_nchar!='bbbbbbbb' then c_nchar else c_bool end from st1;") + assert(tdSql.checkRows(10) and tdSql.res == [('true',), ('cccccccc',), ('dddddddd',), ('eeeeeeee',), ('ffffffff',), ('gggggggg',), ('hhhhhhhh',), ('iiiiiiii',), ('jjjjjjjj',), (None,)]) + + tdSql.query("select case when c_utinyint=2 then c_utinyint else c_bool end from st1;") + assert(tdSql.checkRows(10) and tdSql.res == [(2,), (0,), (1,), (0,), (1,), (0,), (1,), (0,), (1,), (None,)]) + + tdSql.query("select case when c_utinyint!=2 then c_utinyint else c_bool end from st1;") + assert(tdSql.checkRows(10) and tdSql.res == [(1,), (3,), (4,), (5,), (6,), (7,), (8,), (9,), (10,), (None,)]) + + tdSql.query("select case when c_usmallint=2 then c_usmallint else c_bool end from st1;") + assert(tdSql.checkRows(10) and tdSql.res == [(2,), (0,), (1,), (0,), (1,), (0,), (1,), (0,), (1,), (None,)]) + + tdSql.query("select case when c_usmallint!=2 then c_usmallint else c_bool end from st1;") + assert(tdSql.checkRows(10) and tdSql.res == [(1,), (3,), (4,), (5,), (6,), (7,), (8,), (9,), (10,), (None,)]) + + tdSql.query("select case when c_uint=2 then c_uint else c_bool end from st1;") + assert(tdSql.checkRows(10) and tdSql.res == [(2,), (0,), (1,), (0,), (1,), (0,), (1,), (0,), (1,), (None,)]) + + tdSql.query("select case when c_uint!=2 then c_uint else c_bool end from st1;") + assert(tdSql.checkRows(10) and tdSql.res == [(1,), (3,), (4,), (5,), (6,), (7,), (8,), (9,), (10,), (None,)]) + + tdSql.query("select case when c_ubigint=2 then c_ubigint else c_bool end from st1;") + assert(tdSql.checkRows(10) and tdSql.res == [(2,), (0,), (1,), (0,), (1,), (0,), (1,), (0,), (1,), (None,)]) + + tdSql.query("select case when c_ubigint!=2 then c_ubigint else c_bool end from st1;") + assert(tdSql.checkRows(10) and tdSql.res == [(1,), (3,), (4,), (5,), (6,), (7,), (8,), (9,), (10,), (None,)]) + + tdSql.query("select case when c_ubigint=2 then c_ubigint else c_bool end from st1;") + assert(tdSql.checkRows(10) and tdSql.res == [(2,), (0,), (1,), (0,), (1,), (0,), (1,), (0,), (1,), (None,)]) + + tdSql.query("select case when c_ubigint!=2 then c_ubigint else c_bool end from st1;") + assert(tdSql.checkRows(10) and tdSql.res == [(1,), (3,), (4,), (5,), (6,), (7,), (8,), (9,), (10,), (None,)]) + + tdSql.error("select case when c_varbinary='\x30783037' then c_varbinary else c_bool end from st1;") + tdSql.error("select case when c_varbinary!='\x30783037' then c_varbinary else c_bool end from st1;") + + tdSql.query("select case when c_null is null then NULL else c_tinyint end from st1;") + assert(tdSql.checkRows(10) and all([item[0] is None for item in tdSql.res])) + + tdSql.query("select case when c_null is not null then NULL else c_tinyint end from st1;") + assert(tdSql.checkRows(10) and tdSql.res == [(2,), (3,), (4,), (5,), (6,), (7,), (8,), (9,), (10,), (None,)]) + + tdSql.query("select case when c_bool=true then false else c_tinyint end from st1;") + assert(tdSql.checkRows(10) and tdSql.res == [(0,), (3,), (0,), (5,), (0,), (7,), (0,), (9,), (0,), (None,)]) + + tdSql.query("select case when c_bool!=true then false else c_tinyint end from st1;") + assert(tdSql.checkRows(10) and tdSql.res == [(2,), (0,), (4,), (0,), (6,), (0,), (8,), (0,), (10,), (None,)]) + + tdSql.query("select case when c_smallint=2 then c_smallint else c_tinyint end from st1;") + assert(tdSql.checkRows(10) and tdSql.res == [(2,), (3,), (4,), (5,), (6,), (7,), (8,), (9,), (10,), (None,)]) + + tdSql.query("select case when c_smallint!=2 then c_smallint else c_tinyint end from st1;") + assert(tdSql.checkRows(10) and tdSql.res == [(2,), (3,), (4,), (5,), (6,), (7,), (8,), (9,), (10,), (None,)]) + + tdSql.query("select case when c_int=2 then c_smallint else c_int end from st1;") + assert(tdSql.checkRows(10) and tdSql.res == [(2,), (3,), (4,), (5,), (6,), (7,), (8,), (9,), (10,), (None,)]) + + tdSql.query("select case when c_int!=2 then c_smallint else c_int end from st1;") + assert(tdSql.checkRows(10) and tdSql.res == [(2,), (3,), (4,), (5,), (6,), (7,), (8,), (9,), (10,), (None,)]) + + tdSql.query("select case when c_float=2.2 then 387897 else 'test message' end from st1;") + assert(tdSql.checkRows(10) and tdSql.res == [('387897',), ('test message',), ('test message',), ('test message',), ('test message',), ('test message',), ('test message',), ('test message',), ('test message',), ('test message',)]) + + tdSql.query("select case when c_double=2.22 then 387897 else 'test message' end from st1;") + assert(tdSql.checkRows(10) and tdSql.res == [('387897',), ('test message',), ('test message',), ('test message',), ('test message',), ('test message',), ('test message',), ('test message',), ('test message',), ('test message',)]) + + tdSql.query("select case when c_varchar='cccccccc' then 'test' when c_varchar='bbbbbbbb' then 'bbbb' else 'test message' end from st1;") + assert(tdSql.checkRows(10) and tdSql.res == [('bbbb',), ('test',), ('test message',), ('test message',), ('test message',), ('test message',), ('test message',), ('test message',), ('test message',), ('test message',)]) + + tdSql.query("select case when ts='2024-10-01 00:00:04.000' then 456646546 when ts>'2024-10-01 00:00:04.000' then 'after today' else 'before today or unknow date' end from st1;") + assert(tdSql.checkRows(10) and tdSql.res == [('before today or unknow date',), ('before today or unknow date',), ('before today or unknow date',), ('before today or unknow date',), ('456646546',), ('after today',), ('after today',), ('after today',), ('after today',), ('after today',)]) + + tdSql.query("select case when c_geometry is null then c_geometry else c_null end from st1;") + assert(tdSql.checkRows(10) and all([item[0] is None for item in tdSql.res])) + + # tdSql.error("select case when c_geometry is not null then c_geometry else c_null end from st1;") + # tdSql.error("select case when c_geometry='POINT(2 2)' then c_geometry else c_bool end from st1;") + # tdSql.error("select case when c_geometry!='POINT(2 2)' then c_geometry else c_bool end from st1;") + + tdSql.query("select case when t is null then t else c_null end from st2;") + assert(tdSql.checkRows(10) and all([item[0] is None for item in tdSql.res])) + + # tdSql.error("select case when t is not null then t else c_null end from st2;") + # tdSql.error("select case when t->'location'='beijing' then t->'location' else c_bool end from st2;") + # tdSql.error("select case when t->'location'!='beijing' then t->'location' else c_bool end from st1;") + + tdSql.query("select case when c_float!=2.2 then 387897 else 'test message' end from st1;") + assert(tdSql.checkRows(10) and tdSql.res == [('test message',), ('387897',), ('387897',), ('387897',), ('387897',), ('387897',), ('387897',), ('387897',), ('387897',), ('test message',)]) + + tdSql.query("select case when c_double!=2.22 then 387897 else 'test message' end from st1;") + assert(tdSql.checkRows(10) and tdSql.res == [('test message',), ('387897',), ('387897',), ('387897',), ('387897',), ('387897',), ('387897',), ('387897',), ('387897',), ('test message',)]) + + # tdSql.query("select case c_tinyint when 2 then -2147483648 when 3 then 'three' else '4294967295' end from st1;") + # tdSql.query("select case c_float when 2.2 then 9.2233720e+18 when 3.3 then -9.2233720e+18 else 'aa' end from st1;") + # tdSql.query("select case t1.c_int when 2 then 'run' when t1.c_int is null then 'other' else t2.c_varchar end from st1 t1, st2 t2 where t1.ts=t2.ts;") + + def run(self): + self.prepare_data() + self.test_case_when_statements() + + def stop(self): + # tdSql.execute("drop database test_case_when;") + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 09216add8261..a03f6cf904a6 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -20,6 +20,7 @@ ,,y,army,./pytest.sh python3 ./test.py -f query/function/cast.py ,,y,army,./pytest.sh python3 ./test.py -f query/test_join.py ,,y,army,./pytest.sh python3 ./test.py -f query/test_compare.py +,,y,army,./pytest.sh python3 ./test.py -f query/test_case_when.py ,,y,army,./pytest.sh python3 ./test.py -f insert/test_column_tag_boundary.py ,,y,army,./pytest.sh python3 ./test.py -f query/fill/fill_desc.py -N 3 -L 3 -D 2 ,,y,army,./pytest.sh python3 ./test.py -f query/fill/fill_null.py From c404086a5a1e5cdeae936198aeda0d79d921d2cd Mon Sep 17 00:00:00 2001 From: dmchen Date: Fri, 25 Oct 2024 09:51:57 +0000 Subject: [PATCH 313/695] doc/TD-32681-drop-dnode-add-option --- docs/en/14-reference/03-taos-sql/21-node.md | 12 +++--------- docs/zh/14-reference/03-taos-sql/21-node.md | 12 +++--------- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/docs/en/14-reference/03-taos-sql/21-node.md b/docs/en/14-reference/03-taos-sql/21-node.md index fd1a9df53ec6..cdc4bdd02063 100644 --- a/docs/en/14-reference/03-taos-sql/21-node.md +++ b/docs/en/14-reference/03-taos-sql/21-node.md @@ -27,20 +27,14 @@ The preceding SQL command shows all dnodes in the cluster with the ID, endpoint, ## Delete a DNODE ```sql -DROP DNODE dnode_id +DROP DNODE dnode_id [force] [unsafe] ``` Note that deleting a dnode does not stop its process. You must stop the process after the dnode is deleted. -```sql -DROP DNODE dnode_id force -``` -Only online node is allowed to be deleted. Drop is executed forcely if the offline node need to be deleted. +Only online node is allowed to be deleted. Drop is executed with force option if the offline node need to be deleted. -```sql -DROP DNODE dnode_id unsafe -``` -Drop is executed unsafely if the node with single replica is offline, and the data on it is not able to be restored. +Drop is executed with unsafe option if the node with single replica is offline, and the data on it is not able to be restored. ## Modify Dnode Configuration diff --git a/docs/zh/14-reference/03-taos-sql/21-node.md b/docs/zh/14-reference/03-taos-sql/21-node.md index 0137d0cd7938..e3a672790c5f 100644 --- a/docs/zh/14-reference/03-taos-sql/21-node.md +++ b/docs/zh/14-reference/03-taos-sql/21-node.md @@ -27,20 +27,14 @@ SHOW DNODES; ## 删除数据节点 ```sql -DROP DNODE dnode_id +DROP DNODE dnode_id [force] [unsafe] ``` 注意删除 dnode 不等于停止相应的进程。实际中推荐先将一个 dnode 删除之后再停止其所对应的进程。 -```sql -DROP DNODE dnode_id force -``` -只有在线节点可以被删除。如果要强制删除离线节点,需要执行强制删除操作。 +只有在线节点可以被删除。如果要强制删除离线节点,需要执行强制删除操作, 即指定force选项。 -```sql -DROP DNODE dnode_id unsafe -``` -当节点上存在单副本,并且节点处于离线,如果要强制删除该节点,需要执行非安全删除,并且数据不可再恢复。 +当节点上存在单副本,并且节点处于离线,如果要强制删除该节点,需要执行非安全删除,即制定unsafe,并且数据不可再恢复。 ## 修改数据节点配置 From 18c062016ecc222f5bfdf928c141e49a4599d897 Mon Sep 17 00:00:00 2001 From: sheyanjie-qq <249478495@qq.com> Date: Fri, 25 Oct 2024 17:54:43 +0800 Subject: [PATCH 314/695] update sample code --- .../com/taos/example/ConsumerLoopFull.java | 15 ++--- .../com/taos/example/ConsumerLoopImp.java | 8 ++- .../com/taos/example/WsConsumerLoopFull.java | 15 ++--- .../com/taos/example/WsConsumerLoopImp.java | 8 ++- .../example/highvolume/DataBaseMonitor.java | 3 + .../taos/example/highvolume/SQLWriter.java | 3 + .../src/test/java/com/taos/test/TestAll.java | 57 +++++++++++++++---- 7 files changed, 81 insertions(+), 28 deletions(-) diff --git a/docs/examples/java/src/main/java/com/taos/example/ConsumerLoopFull.java b/docs/examples/java/src/main/java/com/taos/example/ConsumerLoopFull.java index a399f3aa6aff..647855dc480b 100644 --- a/docs/examples/java/src/main/java/com/taos/example/ConsumerLoopFull.java +++ b/docs/examples/java/src/main/java/com/taos/example/ConsumerLoopFull.java @@ -1,8 +1,9 @@ package com.taos.example; -import com.alibaba.fastjson.JSON; +import com.fasterxml.jackson.core.JsonProcessingException; import com.taosdata.jdbc.TSDBDriver; import com.taosdata.jdbc.tmq.*; +import com.taosdata.jdbc.utils.JsonUtil; import java.sql.*; import java.time.Duration; @@ -60,7 +61,7 @@ public static TaosConsumer getConsumer() throws Exception { // ANCHOR_END: create_consumer } - public static void pollExample(TaosConsumer consumer) throws SQLException { + public static void pollExample(TaosConsumer consumer) throws SQLException, JsonProcessingException { // ANCHOR: poll_data_code_piece List topics = Collections.singletonList("topic_meters"); try { @@ -73,7 +74,7 @@ public static void pollExample(TaosConsumer consumer) throws SQLExce for (ConsumerRecord record : records) { ResultBean bean = record.value(); // Add your data processing logic here - System.out.println("data: " + JSON.toJSONString(bean)); + System.out.println("data: " + JsonUtil.getObjectMapper().writeValueAsString(bean)); } } } catch (Exception ex) { @@ -91,7 +92,7 @@ public static void pollExample(TaosConsumer consumer) throws SQLExce // ANCHOR_END: poll_data_code_piece } - public static void seekExample(TaosConsumer consumer) throws SQLException { + public static void seekExample(TaosConsumer consumer) throws SQLException, JsonProcessingException { // ANCHOR: consumer_seek List topics = Collections.singletonList("topic_meters"); try { @@ -99,7 +100,7 @@ public static void seekExample(TaosConsumer consumer) throws SQLExce consumer.subscribe(topics); System.out.println("Subscribe topics successfully."); Set assignment = consumer.assignment(); - System.out.println("Now assignment: " + JSON.toJSONString(assignment)); + System.out.println("Now assignment: " + JsonUtil.getObjectMapper().writeValueAsString(assignment)); ConsumerRecords records = ConsumerRecords.emptyRecord(); // make sure we have got some data @@ -125,7 +126,7 @@ public static void seekExample(TaosConsumer consumer) throws SQLExce } - public static void commitExample(TaosConsumer consumer) throws SQLException { + public static void commitExample(TaosConsumer consumer) throws SQLException, JsonProcessingException { // ANCHOR: commit_code_piece List topics = Collections.singletonList("topic_meters"); try { @@ -135,7 +136,7 @@ public static void commitExample(TaosConsumer consumer) throws SQLEx for (ConsumerRecord record : records) { ResultBean bean = record.value(); // Add your data processing logic here - System.out.println("data: " + JSON.toJSONString(bean)); + System.out.println("data: " + JsonUtil.getObjectMapper().writeValueAsString(bean)); } if (!records.isEmpty()) { // after processing the data, commit the offset manually diff --git a/docs/examples/java/src/main/java/com/taos/example/ConsumerLoopImp.java b/docs/examples/java/src/main/java/com/taos/example/ConsumerLoopImp.java index a59bfc282fe9..378ef8ae6ddb 100644 --- a/docs/examples/java/src/main/java/com/taos/example/ConsumerLoopImp.java +++ b/docs/examples/java/src/main/java/com/taos/example/ConsumerLoopImp.java @@ -1,7 +1,7 @@ package com.taos.example; -import com.alibaba.fastjson.JSON; import com.taosdata.jdbc.TSDBDriver; +import com.taosdata.jdbc.utils.JsonUtil; import java.sql.Connection; import java.sql.DriverManager; @@ -31,7 +31,11 @@ public static void main(String[] args) throws SQLException, InterruptedException final AbsConsumerLoop consumerLoop = new AbsConsumerLoop() { @Override public void process(ResultBean result) { - System.out.println("data: " + JSON.toJSONString(result)); + try{ + System.out.println("data: " + JsonUtil.getObjectMapper().writeValueAsString(result)); + } catch (Exception e) { + throw new RuntimeException(e); + } } }; diff --git a/docs/examples/java/src/main/java/com/taos/example/WsConsumerLoopFull.java b/docs/examples/java/src/main/java/com/taos/example/WsConsumerLoopFull.java index 6db65f47f2b2..02db97a5a956 100644 --- a/docs/examples/java/src/main/java/com/taos/example/WsConsumerLoopFull.java +++ b/docs/examples/java/src/main/java/com/taos/example/WsConsumerLoopFull.java @@ -1,8 +1,9 @@ package com.taos.example; -import com.alibaba.fastjson.JSON; +import com.fasterxml.jackson.core.JsonProcessingException; import com.taosdata.jdbc.TSDBDriver; import com.taosdata.jdbc.tmq.*; +import com.taosdata.jdbc.utils.JsonUtil; import java.sql.*; import java.time.Duration; @@ -60,7 +61,7 @@ public static TaosConsumer getConsumer() throws Exception { // ANCHOR_END: create_consumer } - public static void pollExample(TaosConsumer consumer) throws SQLException { + public static void pollExample(TaosConsumer consumer) throws SQLException, JsonProcessingException { // ANCHOR: poll_data_code_piece List topics = Collections.singletonList("topic_meters"); try { @@ -73,7 +74,7 @@ public static void pollExample(TaosConsumer consumer) throws SQLExce for (ConsumerRecord record : records) { ResultBean bean = record.value(); // Add your data processing logic here - System.out.println("data: " + JSON.toJSONString(bean)); + System.out.println("data: " + JsonUtil.getObjectMapper().writeValueAsString(bean)); } } } catch (Exception ex) { @@ -91,7 +92,7 @@ public static void pollExample(TaosConsumer consumer) throws SQLExce // ANCHOR_END: poll_data_code_piece } - public static void seekExample(TaosConsumer consumer) throws SQLException { + public static void seekExample(TaosConsumer consumer) throws SQLException, JsonProcessingException { // ANCHOR: consumer_seek List topics = Collections.singletonList("topic_meters"); try { @@ -99,7 +100,7 @@ public static void seekExample(TaosConsumer consumer) throws SQLExce consumer.subscribe(topics); System.out.println("Subscribe topics successfully."); Set assignment = consumer.assignment(); - System.out.println("Now assignment: " + JSON.toJSONString(assignment)); + System.out.println("Now assignment: " + JsonUtil.getObjectMapper().writeValueAsString(assignment)); ConsumerRecords records = ConsumerRecords.emptyRecord(); // make sure we have got some data @@ -125,7 +126,7 @@ public static void seekExample(TaosConsumer consumer) throws SQLExce } - public static void commitExample(TaosConsumer consumer) throws SQLException { + public static void commitExample(TaosConsumer consumer) throws SQLException, JsonProcessingException { // ANCHOR: commit_code_piece List topics = Collections.singletonList("topic_meters"); try { @@ -135,7 +136,7 @@ public static void commitExample(TaosConsumer consumer) throws SQLEx for (ConsumerRecord record : records) { ResultBean bean = record.value(); // Add your data processing logic here - System.out.println("data: " + JSON.toJSONString(bean)); + System.out.println("data: " + JsonUtil.getObjectMapper().writeValueAsString(bean)); } if (!records.isEmpty()) { // after processing the data, commit the offset manually diff --git a/docs/examples/java/src/main/java/com/taos/example/WsConsumerLoopImp.java b/docs/examples/java/src/main/java/com/taos/example/WsConsumerLoopImp.java index 70e29503f857..77c6a4fd1bd1 100644 --- a/docs/examples/java/src/main/java/com/taos/example/WsConsumerLoopImp.java +++ b/docs/examples/java/src/main/java/com/taos/example/WsConsumerLoopImp.java @@ -1,7 +1,7 @@ package com.taos.example; -import com.alibaba.fastjson.JSON; import com.taosdata.jdbc.TSDBDriver; +import com.taosdata.jdbc.utils.JsonUtil; import java.sql.Connection; import java.sql.DriverManager; @@ -28,7 +28,11 @@ public static void main(String[] args) throws SQLException, InterruptedException final AbsConsumerLoop consumerLoop = new AbsConsumerLoop() { @Override public void process(ResultBean result) { - System.out.println("data: " + JSON.toJSONString(result)); + try{ + System.out.println("data: " + JsonUtil.getObjectMapper().writeValueAsString(result)); + } catch (Exception e) { + throw new RuntimeException(e); + } } }; diff --git a/docs/examples/java/src/main/java/com/taos/example/highvolume/DataBaseMonitor.java b/docs/examples/java/src/main/java/com/taos/example/highvolume/DataBaseMonitor.java index 8678f6523115..fa6ebf08586b 100644 --- a/docs/examples/java/src/main/java/com/taos/example/highvolume/DataBaseMonitor.java +++ b/docs/examples/java/src/main/java/com/taos/example/highvolume/DataBaseMonitor.java @@ -13,6 +13,9 @@ public class DataBaseMonitor { public DataBaseMonitor init() throws SQLException { if (conn == null) { String jdbcURL = System.getenv("TDENGINE_JDBC_URL"); + if (jdbcURL == null || jdbcURL == ""){ + jdbcURL = "jdbc:TAOS://localhost:6030?user=root&password=taosdata"; + } conn = DriverManager.getConnection(jdbcURL); stmt = conn.createStatement(); } diff --git a/docs/examples/java/src/main/java/com/taos/example/highvolume/SQLWriter.java b/docs/examples/java/src/main/java/com/taos/example/highvolume/SQLWriter.java index dc820f161c8a..1497992f6b50 100644 --- a/docs/examples/java/src/main/java/com/taos/example/highvolume/SQLWriter.java +++ b/docs/examples/java/src/main/java/com/taos/example/highvolume/SQLWriter.java @@ -69,6 +69,9 @@ public SQLWriter(int maxBatchSize) { */ private static Connection getConnection() throws SQLException { String jdbcURL = System.getenv("TDENGINE_JDBC_URL"); + if (jdbcURL == null || jdbcURL == ""){ + jdbcURL = "jdbc:TAOS://localhost:6030?user=root&password=taosdata"; + } return DriverManager.getConnection(jdbcURL); } diff --git a/docs/examples/java/src/test/java/com/taos/test/TestAll.java b/docs/examples/java/src/test/java/com/taos/test/TestAll.java index e014a3b31519..a92ddd116c07 100644 --- a/docs/examples/java/src/test/java/com/taos/test/TestAll.java +++ b/docs/examples/java/src/test/java/com/taos/test/TestAll.java @@ -17,6 +17,37 @@ public void dropDB(String dbName) throws SQLException { stmt.execute("drop database if exists " + dbName); } } + waitTransaction(); + } + + public void dropTopic(String topicName) throws SQLException { + String jdbcUrl = "jdbc:TAOS://localhost:6030?user=root&password=taosdata"; + try (Connection conn = DriverManager.getConnection(jdbcUrl)) { + try (Statement stmt = conn.createStatement()) { + stmt.execute("drop topic if exists " + topicName); + } + } + waitTransaction(); + } + + public void waitTransaction() throws SQLException { + + String jdbcUrl = "jdbc:TAOS://localhost:6030?user=root&password=taosdata"; + try (Connection conn = DriverManager.getConnection(jdbcUrl)) { + try (Statement stmt = conn.createStatement()) { + for (int i = 0; i < 10; i++) { + stmt.execute("show transactions"); + try (ResultSet resultSet = stmt.getResultSet()) { + if (resultSet.next()) { + int count = resultSet.getInt(1); + if (count == 0) { + break; + } + } + } + } + } + } } public void insertData() throws SQLException { @@ -104,14 +135,20 @@ public void testConsumer() throws Exception { SubscribeDemo.main(args); } -// @Test -// public void testSubscribeJni() throws SQLException, InterruptedException { -// dropDB("power"); -// ConsumerLoopFull.main(args); -// } -// @Test -// public void testSubscribeWs() throws SQLException, InterruptedException { -// dropDB("power"); -// WsConsumerLoopFull.main(args); -// } + @Test + public void testSubscribeJni() throws SQLException, InterruptedException { + dropTopic("topic_meters"); + dropDB("power"); + ConsumerLoopFull.main(args); + dropTopic("topic_meters"); + dropDB("power"); + } + @Test + public void testSubscribeWs() throws SQLException, InterruptedException { + dropTopic("topic_meters"); + dropDB("power"); + WsConsumerLoopFull.main(args); + dropTopic("topic_meters"); + dropDB("power"); + } } From d63795fd835859f2a96d4d02cd3364ebd12821ea Mon Sep 17 00:00:00 2001 From: sheyanjie-qq <249478495@qq.com> Date: Fri, 25 Oct 2024 17:54:43 +0800 Subject: [PATCH 315/695] update sample code --- .../com/taos/example/ConsumerLoopFull.java | 15 ++--- .../com/taos/example/ConsumerLoopImp.java | 8 ++- .../com/taos/example/WsConsumerLoopFull.java | 15 ++--- .../com/taos/example/WsConsumerLoopImp.java | 8 ++- .../example/highvolume/DataBaseMonitor.java | 3 + .../taos/example/highvolume/SQLWriter.java | 3 + .../src/test/java/com/taos/test/TestAll.java | 57 +++++++++++++++---- 7 files changed, 81 insertions(+), 28 deletions(-) diff --git a/docs/examples/java/src/main/java/com/taos/example/ConsumerLoopFull.java b/docs/examples/java/src/main/java/com/taos/example/ConsumerLoopFull.java index a399f3aa6aff..647855dc480b 100644 --- a/docs/examples/java/src/main/java/com/taos/example/ConsumerLoopFull.java +++ b/docs/examples/java/src/main/java/com/taos/example/ConsumerLoopFull.java @@ -1,8 +1,9 @@ package com.taos.example; -import com.alibaba.fastjson.JSON; +import com.fasterxml.jackson.core.JsonProcessingException; import com.taosdata.jdbc.TSDBDriver; import com.taosdata.jdbc.tmq.*; +import com.taosdata.jdbc.utils.JsonUtil; import java.sql.*; import java.time.Duration; @@ -60,7 +61,7 @@ public static TaosConsumer getConsumer() throws Exception { // ANCHOR_END: create_consumer } - public static void pollExample(TaosConsumer consumer) throws SQLException { + public static void pollExample(TaosConsumer consumer) throws SQLException, JsonProcessingException { // ANCHOR: poll_data_code_piece List topics = Collections.singletonList("topic_meters"); try { @@ -73,7 +74,7 @@ public static void pollExample(TaosConsumer consumer) throws SQLExce for (ConsumerRecord record : records) { ResultBean bean = record.value(); // Add your data processing logic here - System.out.println("data: " + JSON.toJSONString(bean)); + System.out.println("data: " + JsonUtil.getObjectMapper().writeValueAsString(bean)); } } } catch (Exception ex) { @@ -91,7 +92,7 @@ public static void pollExample(TaosConsumer consumer) throws SQLExce // ANCHOR_END: poll_data_code_piece } - public static void seekExample(TaosConsumer consumer) throws SQLException { + public static void seekExample(TaosConsumer consumer) throws SQLException, JsonProcessingException { // ANCHOR: consumer_seek List topics = Collections.singletonList("topic_meters"); try { @@ -99,7 +100,7 @@ public static void seekExample(TaosConsumer consumer) throws SQLExce consumer.subscribe(topics); System.out.println("Subscribe topics successfully."); Set assignment = consumer.assignment(); - System.out.println("Now assignment: " + JSON.toJSONString(assignment)); + System.out.println("Now assignment: " + JsonUtil.getObjectMapper().writeValueAsString(assignment)); ConsumerRecords records = ConsumerRecords.emptyRecord(); // make sure we have got some data @@ -125,7 +126,7 @@ public static void seekExample(TaosConsumer consumer) throws SQLExce } - public static void commitExample(TaosConsumer consumer) throws SQLException { + public static void commitExample(TaosConsumer consumer) throws SQLException, JsonProcessingException { // ANCHOR: commit_code_piece List topics = Collections.singletonList("topic_meters"); try { @@ -135,7 +136,7 @@ public static void commitExample(TaosConsumer consumer) throws SQLEx for (ConsumerRecord record : records) { ResultBean bean = record.value(); // Add your data processing logic here - System.out.println("data: " + JSON.toJSONString(bean)); + System.out.println("data: " + JsonUtil.getObjectMapper().writeValueAsString(bean)); } if (!records.isEmpty()) { // after processing the data, commit the offset manually diff --git a/docs/examples/java/src/main/java/com/taos/example/ConsumerLoopImp.java b/docs/examples/java/src/main/java/com/taos/example/ConsumerLoopImp.java index a59bfc282fe9..378ef8ae6ddb 100644 --- a/docs/examples/java/src/main/java/com/taos/example/ConsumerLoopImp.java +++ b/docs/examples/java/src/main/java/com/taos/example/ConsumerLoopImp.java @@ -1,7 +1,7 @@ package com.taos.example; -import com.alibaba.fastjson.JSON; import com.taosdata.jdbc.TSDBDriver; +import com.taosdata.jdbc.utils.JsonUtil; import java.sql.Connection; import java.sql.DriverManager; @@ -31,7 +31,11 @@ public static void main(String[] args) throws SQLException, InterruptedException final AbsConsumerLoop consumerLoop = new AbsConsumerLoop() { @Override public void process(ResultBean result) { - System.out.println("data: " + JSON.toJSONString(result)); + try{ + System.out.println("data: " + JsonUtil.getObjectMapper().writeValueAsString(result)); + } catch (Exception e) { + throw new RuntimeException(e); + } } }; diff --git a/docs/examples/java/src/main/java/com/taos/example/WsConsumerLoopFull.java b/docs/examples/java/src/main/java/com/taos/example/WsConsumerLoopFull.java index 6db65f47f2b2..02db97a5a956 100644 --- a/docs/examples/java/src/main/java/com/taos/example/WsConsumerLoopFull.java +++ b/docs/examples/java/src/main/java/com/taos/example/WsConsumerLoopFull.java @@ -1,8 +1,9 @@ package com.taos.example; -import com.alibaba.fastjson.JSON; +import com.fasterxml.jackson.core.JsonProcessingException; import com.taosdata.jdbc.TSDBDriver; import com.taosdata.jdbc.tmq.*; +import com.taosdata.jdbc.utils.JsonUtil; import java.sql.*; import java.time.Duration; @@ -60,7 +61,7 @@ public static TaosConsumer getConsumer() throws Exception { // ANCHOR_END: create_consumer } - public static void pollExample(TaosConsumer consumer) throws SQLException { + public static void pollExample(TaosConsumer consumer) throws SQLException, JsonProcessingException { // ANCHOR: poll_data_code_piece List topics = Collections.singletonList("topic_meters"); try { @@ -73,7 +74,7 @@ public static void pollExample(TaosConsumer consumer) throws SQLExce for (ConsumerRecord record : records) { ResultBean bean = record.value(); // Add your data processing logic here - System.out.println("data: " + JSON.toJSONString(bean)); + System.out.println("data: " + JsonUtil.getObjectMapper().writeValueAsString(bean)); } } } catch (Exception ex) { @@ -91,7 +92,7 @@ public static void pollExample(TaosConsumer consumer) throws SQLExce // ANCHOR_END: poll_data_code_piece } - public static void seekExample(TaosConsumer consumer) throws SQLException { + public static void seekExample(TaosConsumer consumer) throws SQLException, JsonProcessingException { // ANCHOR: consumer_seek List topics = Collections.singletonList("topic_meters"); try { @@ -99,7 +100,7 @@ public static void seekExample(TaosConsumer consumer) throws SQLExce consumer.subscribe(topics); System.out.println("Subscribe topics successfully."); Set assignment = consumer.assignment(); - System.out.println("Now assignment: " + JSON.toJSONString(assignment)); + System.out.println("Now assignment: " + JsonUtil.getObjectMapper().writeValueAsString(assignment)); ConsumerRecords records = ConsumerRecords.emptyRecord(); // make sure we have got some data @@ -125,7 +126,7 @@ public static void seekExample(TaosConsumer consumer) throws SQLExce } - public static void commitExample(TaosConsumer consumer) throws SQLException { + public static void commitExample(TaosConsumer consumer) throws SQLException, JsonProcessingException { // ANCHOR: commit_code_piece List topics = Collections.singletonList("topic_meters"); try { @@ -135,7 +136,7 @@ public static void commitExample(TaosConsumer consumer) throws SQLEx for (ConsumerRecord record : records) { ResultBean bean = record.value(); // Add your data processing logic here - System.out.println("data: " + JSON.toJSONString(bean)); + System.out.println("data: " + JsonUtil.getObjectMapper().writeValueAsString(bean)); } if (!records.isEmpty()) { // after processing the data, commit the offset manually diff --git a/docs/examples/java/src/main/java/com/taos/example/WsConsumerLoopImp.java b/docs/examples/java/src/main/java/com/taos/example/WsConsumerLoopImp.java index 70e29503f857..77c6a4fd1bd1 100644 --- a/docs/examples/java/src/main/java/com/taos/example/WsConsumerLoopImp.java +++ b/docs/examples/java/src/main/java/com/taos/example/WsConsumerLoopImp.java @@ -1,7 +1,7 @@ package com.taos.example; -import com.alibaba.fastjson.JSON; import com.taosdata.jdbc.TSDBDriver; +import com.taosdata.jdbc.utils.JsonUtil; import java.sql.Connection; import java.sql.DriverManager; @@ -28,7 +28,11 @@ public static void main(String[] args) throws SQLException, InterruptedException final AbsConsumerLoop consumerLoop = new AbsConsumerLoop() { @Override public void process(ResultBean result) { - System.out.println("data: " + JSON.toJSONString(result)); + try{ + System.out.println("data: " + JsonUtil.getObjectMapper().writeValueAsString(result)); + } catch (Exception e) { + throw new RuntimeException(e); + } } }; diff --git a/docs/examples/java/src/main/java/com/taos/example/highvolume/DataBaseMonitor.java b/docs/examples/java/src/main/java/com/taos/example/highvolume/DataBaseMonitor.java index 8678f6523115..fa6ebf08586b 100644 --- a/docs/examples/java/src/main/java/com/taos/example/highvolume/DataBaseMonitor.java +++ b/docs/examples/java/src/main/java/com/taos/example/highvolume/DataBaseMonitor.java @@ -13,6 +13,9 @@ public class DataBaseMonitor { public DataBaseMonitor init() throws SQLException { if (conn == null) { String jdbcURL = System.getenv("TDENGINE_JDBC_URL"); + if (jdbcURL == null || jdbcURL == ""){ + jdbcURL = "jdbc:TAOS://localhost:6030?user=root&password=taosdata"; + } conn = DriverManager.getConnection(jdbcURL); stmt = conn.createStatement(); } diff --git a/docs/examples/java/src/main/java/com/taos/example/highvolume/SQLWriter.java b/docs/examples/java/src/main/java/com/taos/example/highvolume/SQLWriter.java index dc820f161c8a..1497992f6b50 100644 --- a/docs/examples/java/src/main/java/com/taos/example/highvolume/SQLWriter.java +++ b/docs/examples/java/src/main/java/com/taos/example/highvolume/SQLWriter.java @@ -69,6 +69,9 @@ public SQLWriter(int maxBatchSize) { */ private static Connection getConnection() throws SQLException { String jdbcURL = System.getenv("TDENGINE_JDBC_URL"); + if (jdbcURL == null || jdbcURL == ""){ + jdbcURL = "jdbc:TAOS://localhost:6030?user=root&password=taosdata"; + } return DriverManager.getConnection(jdbcURL); } diff --git a/docs/examples/java/src/test/java/com/taos/test/TestAll.java b/docs/examples/java/src/test/java/com/taos/test/TestAll.java index e014a3b31519..a92ddd116c07 100644 --- a/docs/examples/java/src/test/java/com/taos/test/TestAll.java +++ b/docs/examples/java/src/test/java/com/taos/test/TestAll.java @@ -17,6 +17,37 @@ public void dropDB(String dbName) throws SQLException { stmt.execute("drop database if exists " + dbName); } } + waitTransaction(); + } + + public void dropTopic(String topicName) throws SQLException { + String jdbcUrl = "jdbc:TAOS://localhost:6030?user=root&password=taosdata"; + try (Connection conn = DriverManager.getConnection(jdbcUrl)) { + try (Statement stmt = conn.createStatement()) { + stmt.execute("drop topic if exists " + topicName); + } + } + waitTransaction(); + } + + public void waitTransaction() throws SQLException { + + String jdbcUrl = "jdbc:TAOS://localhost:6030?user=root&password=taosdata"; + try (Connection conn = DriverManager.getConnection(jdbcUrl)) { + try (Statement stmt = conn.createStatement()) { + for (int i = 0; i < 10; i++) { + stmt.execute("show transactions"); + try (ResultSet resultSet = stmt.getResultSet()) { + if (resultSet.next()) { + int count = resultSet.getInt(1); + if (count == 0) { + break; + } + } + } + } + } + } } public void insertData() throws SQLException { @@ -104,14 +135,20 @@ public void testConsumer() throws Exception { SubscribeDemo.main(args); } -// @Test -// public void testSubscribeJni() throws SQLException, InterruptedException { -// dropDB("power"); -// ConsumerLoopFull.main(args); -// } -// @Test -// public void testSubscribeWs() throws SQLException, InterruptedException { -// dropDB("power"); -// WsConsumerLoopFull.main(args); -// } + @Test + public void testSubscribeJni() throws SQLException, InterruptedException { + dropTopic("topic_meters"); + dropDB("power"); + ConsumerLoopFull.main(args); + dropTopic("topic_meters"); + dropDB("power"); + } + @Test + public void testSubscribeWs() throws SQLException, InterruptedException { + dropTopic("topic_meters"); + dropDB("power"); + WsConsumerLoopFull.main(args); + dropTopic("topic_meters"); + dropDB("power"); + } } From dde9ae82f2ffa1d24ebd59791cfc81fdb7325af8 Mon Sep 17 00:00:00 2001 From: dmchen Date: Fri, 25 Oct 2024 10:10:00 +0000 Subject: [PATCH 316/695] fix/TD-32622-add-lock-for-vnodes --- source/dnode/mgmt/mgmt_vnode/inc/vmInt.h | 2 +- source/dnode/mgmt/mgmt_vnode/src/vmFile.c | 22 ++++++++++++++++----- source/dnode/mgmt/mgmt_vnode/src/vmHandle.c | 13 ------------ 3 files changed, 18 insertions(+), 19 deletions(-) diff --git a/source/dnode/mgmt/mgmt_vnode/inc/vmInt.h b/source/dnode/mgmt/mgmt_vnode/inc/vmInt.h index 0e1a4bc98e2b..b027763c63b7 100644 --- a/source/dnode/mgmt/mgmt_vnode/inc/vmInt.h +++ b/source/dnode/mgmt/mgmt_vnode/inc/vmInt.h @@ -41,7 +41,7 @@ typedef struct SVnodeMgmt { STfs *pTfs; TdThread thread; bool stop; - TdThreadMutex createLock; + TdThreadMutex fileLock; } SVnodeMgmt; typedef struct { diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmFile.c b/source/dnode/mgmt/mgmt_vnode/src/vmFile.c index 215a0576185d..80170cfa56a8 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmFile.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmFile.c @@ -233,35 +233,47 @@ int32_t vmWriteVnodeListToFile(SVnodeMgmt *pMgmt) { goto _OVER; } + code = taosThreadMutexLock(&pMgmt->fileLock); + if (code != 0) { + lino = __LINE__; + goto _OVER; + } + pFile = taosOpenFile(file, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_TRUNC | TD_FILE_WRITE_THROUGH); if (pFile == NULL) { code = terrno; lino = __LINE__; - goto _OVER; + goto _OVER1; } int32_t len = strlen(buffer); if (taosWriteFile(pFile, buffer, len) <= 0) { code = terrno; lino = __LINE__; - goto _OVER; + goto _OVER1; } if (taosFsyncFile(pFile) < 0) { code = TAOS_SYSTEM_ERROR(errno); lino = __LINE__; - goto _OVER; + goto _OVER1; } code = taosCloseFile(&pFile); if (code != 0) { code = TAOS_SYSTEM_ERROR(errno); lino = __LINE__; - goto _OVER; + goto _OVER1; } - TAOS_CHECK_GOTO(taosRenameFile(file, realfile), &lino, _OVER); + TAOS_CHECK_GOTO(taosRenameFile(file, realfile), &lino, _OVER1); dInfo("succeed to write vnodes file:%s, vnodes:%d", realfile, numOfVnodes); +_OVER1: + int32_t ret = taosThreadMutexUnlock(&pMgmt->fileLock); + if (ret != 0) { + dError("failed to unlock since %s", tstrerror(ret)); + } + _OVER: if (pJson != NULL) tjsonDelete(pJson); if (buffer != NULL) taosMemoryFree(buffer); diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c index f55cb648e084..bd00e99baeee 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c @@ -415,24 +415,11 @@ int32_t vmProcessCreateVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) { goto _OVER; } - code = taosThreadMutexLock(&pMgmt->createLock); - if (code != 0) { - dError("vgId:%d, failed to lock since %s", req.vgId, tstrerror(code)); - goto _OVER; - } code = vmWriteVnodeListToFile(pMgmt); if (code != 0) { code = terrno != 0 ? terrno : code; - int32_t ret = taosThreadMutexUnlock(&pMgmt->createLock); - if (ret != 0) { - dError("vgId:%d, failed to unlock since %s", req.vgId, tstrerror(ret)); - } goto _OVER; } - int32_t ret = taosThreadMutexUnlock(&pMgmt->createLock); - if (ret != 0) { - dError("vgId:%d, failed to unlock since %s", req.vgId, tstrerror(ret)); - } _OVER: if (code != 0) { From 83ca164e97882deb0bb7c9816da2c527fe645deb Mon Sep 17 00:00:00 2001 From: dmchen Date: Fri, 25 Oct 2024 10:13:15 +0000 Subject: [PATCH 317/695] fix/TD-32622-add-lock-for-vnodes-fix-compile --- source/dnode/mgmt/mgmt_vnode/src/vmInt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmInt.c b/source/dnode/mgmt/mgmt_vnode/src/vmInt.c index 20618dbdf386..b769791ec361 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmInt.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmInt.c @@ -545,7 +545,7 @@ static void vmCleanup(SVnodeMgmt *pMgmt) { vmStopWorker(pMgmt); vnodeCleanup(); (void)taosThreadRwlockDestroy(&pMgmt->lock); - (void)taosThreadMutexDestroy(&pMgmt->createLock); + (void)taosThreadMutexDestroy(&pMgmt->fileLock); taosMemoryFree(pMgmt); } @@ -637,7 +637,7 @@ static int32_t vmInit(SMgmtInputOpt *pInput, SMgmtOutputOpt *pOutput) { goto _OVER; } - code = taosThreadMutexInit(&pMgmt->createLock, NULL); + code = taosThreadMutexInit(&pMgmt->fileLock, NULL); if (code != 0) { code = TAOS_SYSTEM_ERROR(errno); goto _OVER; From 0a8b3714f9496276f6af5e67b1935c8ba2ed7b40 Mon Sep 17 00:00:00 2001 From: xsren <285808407@qq.com> Date: Fri, 25 Oct 2024 18:45:29 +0800 Subject: [PATCH 318/695] fix: reserve --- source/libs/planner/src/planPhysiCreater.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/libs/planner/src/planPhysiCreater.c b/source/libs/planner/src/planPhysiCreater.c index 738ccf3224b0..a44fbbdbeeb9 100644 --- a/source/libs/planner/src/planPhysiCreater.c +++ b/source/libs/planner/src/planPhysiCreater.c @@ -233,7 +233,7 @@ static int32_t buildDataBlockSlots(SPhysiPlanContext* pCxt, SNodeList* pList, SD int32_t len = 0; code = getSlotKey(pNode, NULL, &name, &len, 16); if (TSDB_CODE_SUCCESS == code) { - code = nodesListStrictAppend(pDataBlockDesc->pSlots, createSlotDesc(pCxt, name, pNode, slotId, true, false)); + code = nodesListStrictAppend(pDataBlockDesc->pSlots, createSlotDesc(pCxt, name, pNode, slotId, true, true)); } code = putSlotToHash(name, len, pDataBlockDesc->dataBlockId, slotId, pNode, pHash); if (TSDB_CODE_SUCCESS == code) { @@ -367,7 +367,7 @@ static int32_t addDataBlockSlotsForProject(SPhysiPlanContext* pCxt, const char* } static int32_t pushdownDataBlockSlots(SPhysiPlanContext* pCxt, SNodeList* pList, SDataBlockDescNode* pDataBlockDesc) { - return addDataBlockSlotsImpl(pCxt, pList, pDataBlockDesc, NULL, true, true); + return addDataBlockSlotsImpl(pCxt, pList, pDataBlockDesc, NULL, true, false); } typedef struct SSetSlotIdCxt { From 0cae5f178c9b80a9577e0c9271206f6552ebbd3f Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Sat, 26 Oct 2024 20:58:02 +0800 Subject: [PATCH 319/695] enh: increase synatx parser --- include/common/tmsg.h | 1 + include/libs/nodes/cmdnodes.h | 1 + include/util/taoserror.h | 1 + include/util/tdef.h | 1 + source/common/src/tmsg.c | 5 +++++ source/dnode/mnode/impl/src/mndDb.c | 9 +++++++++ source/libs/parser/inc/parAst.h | 1 + source/libs/parser/inc/sql.y | 1 + source/libs/parser/src/parAstCreater.c | 11 +++++++++++ source/libs/parser/src/parTranslater.c | 2 ++ source/util/src/terror.c | 1 + 11 files changed, 34 insertions(+) diff --git a/include/common/tmsg.h b/include/common/tmsg.h index 01808d4f2f8b..d14facec259d 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -1337,6 +1337,7 @@ typedef struct { char* sql; int8_t withArbitrator; int8_t encryptAlgorithm; + char dnodeListStr[TSDB_DNODE_LIST_LEN]; } SCreateDbReq; int32_t tSerializeSCreateDbReq(void* buf, int32_t bufLen, SCreateDbReq* pReq); diff --git a/include/libs/nodes/cmdnodes.h b/include/libs/nodes/cmdnodes.h index bbf288928984..514eddbc249a 100644 --- a/include/libs/nodes/cmdnodes.h +++ b/include/libs/nodes/cmdnodes.h @@ -72,6 +72,7 @@ typedef struct SDatabaseOptions { int8_t compressionLevel; int8_t encryptAlgorithm; int32_t daysPerFile; + char dnodeListStr[TSDB_DNODE_LIST_LEN]; char encryptAlgorithmStr[TSDB_ENCRYPT_ALGO_STR_LEN]; SValueNode* pDaysPerFile; int32_t fsyncPeriod; diff --git a/include/util/taoserror.h b/include/util/taoserror.h index a53923b904be..db4a3c3fe42a 100644 --- a/include/util/taoserror.h +++ b/include/util/taoserror.h @@ -352,6 +352,7 @@ int32_t taosGetErrSize(); #define TSDB_CODE_MND_INVALID_SYS_TABLENAME TAOS_DEF_ERROR_CODE(0, 0x039A) #define TSDB_CODE_MND_ENCRYPT_NOT_ALLOW_CHANGE TAOS_DEF_ERROR_CODE(0, 0x039B) #define TSDB_CODE_MND_INVALID_WAL_LEVEL TAOS_DEF_ERROR_CODE(0, 0x039C) +#define TSDB_CODE_MND_INVALID_DNODE_LIST_FMT TAOS_DEF_ERROR_CODE(0, 0x039D) // mnode-node #define TSDB_CODE_MND_MNODE_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x03A0) diff --git a/include/util/tdef.h b/include/util/tdef.h index e15ec0b4999a..11d4878ebc03 100644 --- a/include/util/tdef.h +++ b/include/util/tdef.h @@ -411,6 +411,7 @@ typedef enum ELogicConditionType { #define TSDB_CACHE_MODEL_LAST_ROW 1 #define TSDB_CACHE_MODEL_LAST_VALUE 2 #define TSDB_CACHE_MODEL_BOTH 3 +#define TSDB_DNODE_LIST_LEN 256 #define TSDB_ENCRYPT_ALGO_STR_LEN 16 #define TSDB_ENCRYPT_ALGO_NONE_STR "none" #define TSDB_ENCRYPT_ALGO_SM4_STR "sm4" diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index 63fcf900bf00..6cbf3665a727 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -3874,6 +3874,7 @@ int32_t tSerializeSCreateDbReq(void *buf, int32_t bufLen, SCreateDbReq *pReq) { TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->s3ChunkSize)); TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->s3KeepLocal)); TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->s3Compact)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->dnodeListStr)); tEndEncode(&encoder); @@ -3962,6 +3963,10 @@ int32_t tDeserializeSCreateDbReq(void *buf, int32_t bufLen, SCreateDbReq *pReq) TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->s3Compact)); } + if (!tDecodeIsEnd(&decoder)) { + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->dnodeListStr)); + } + tEndDecode(&decoder); _exit: diff --git a/source/dnode/mnode/impl/src/mndDb.c b/source/dnode/mnode/impl/src/mndDb.c index aed00af3c189..aea92662a1ec 100644 --- a/source/dnode/mnode/impl/src/mndDb.c +++ b/source/dnode/mnode/impl/src/mndDb.c @@ -883,6 +883,13 @@ static void mndBuildAuditDetailInt64(char *detail, char *tmp, char *format, int6 } } +static int32_t mndCheckDbDnodeList(SMnode *pMnode, SCreateDbReq *pReq) { + if (pReq->dnodeListStr[0] == 0) return 0; + + mInfo("db:%s, dnode list is %s", pReq->db, pReq->dnodeListStr); + return 0; +} + static int32_t mndCheckDbEncryptKey(SMnode *pMnode, SCreateDbReq *pReq) { int32_t code = 0; SSdb *pSdb = pMnode->pSdb; @@ -975,6 +982,8 @@ static int32_t mndProcessCreateDbReq(SRpcMsg *pReq) { TAOS_CHECK_GOTO(mndCheckDbEncryptKey(pMnode, &createReq), &lino, _OVER); + TAOS_CHECK_GOTO(mndCheckDbDnodeList(pMnode, &createReq), &lino, _OVER); + TAOS_CHECK_GOTO(mndAcquireUser(pMnode, pReq->info.conn.user, &pUser), &lino, _OVER); TAOS_CHECK_GOTO(mndCreateDb(pMnode, pReq, &createReq, pUser), &lino, _OVER); diff --git a/source/libs/parser/inc/parAst.h b/source/libs/parser/inc/parAst.h index 28e867965f42..94ad7316e8ae 100644 --- a/source/libs/parser/inc/parAst.h +++ b/source/libs/parser/inc/parAst.h @@ -69,6 +69,7 @@ typedef enum EDatabaseOptionType { DB_OPTION_S3_COMPACT, DB_OPTION_KEEP_TIME_OFFSET, DB_OPTION_ENCRYPT_ALGORITHM, + DB_OPTION_DNODES, } EDatabaseOptionType; typedef enum ETableOptionType { diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index 99f301445a55..ed6202021e4a 100644 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -286,6 +286,7 @@ db_options(A) ::= db_options(B) S3_KEEPLOCAL NK_VARIABLE(C). db_options(A) ::= db_options(B) S3_COMPACT NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_S3_COMPACT, &C); } db_options(A) ::= db_options(B) KEEP_TIME_OFFSET NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_KEEP_TIME_OFFSET, &C); } db_options(A) ::= db_options(B) ENCRYPT_ALGORITHM NK_STRING(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_ENCRYPT_ALGORITHM, &C); } +db_options(A) ::= db_options(B) DNODES NK_STRING(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_DNODES, &C); } alter_db_options(A) ::= alter_db_option(B). { A = createAlterDatabaseOptions(pCxt); A = setAlterDatabaseOption(pCxt, A, &B); } alter_db_options(A) ::= alter_db_options(B) alter_db_option(C). { A = setAlterDatabaseOption(pCxt, B, &C); } diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c index e031ee0fe1b3..a770ed34907e 100644 --- a/source/libs/parser/src/parAstCreater.c +++ b/source/libs/parser/src/parAstCreater.c @@ -1799,6 +1799,7 @@ SNode* createDefaultDatabaseOptions(SAstCreateContext* pCxt) { pOptions->s3Compact = TSDB_DEFAULT_S3_COMPACT; pOptions->withArbitrator = TSDB_DEFAULT_DB_WITH_ARBITRATOR; pOptions->encryptAlgorithm = TSDB_DEFAULT_ENCRYPT_ALGO; + pOptions->dnodeListStr[0] = 0; return (SNode*)pOptions; _err: return NULL; @@ -1842,6 +1843,7 @@ SNode* createAlterDatabaseOptions(SAstCreateContext* pCxt) { pOptions->s3Compact = -1; pOptions->withArbitrator = -1; pOptions->encryptAlgorithm = -1; + pOptions->dnodeListStr[0] = 0; return (SNode*)pOptions; _err: return NULL; @@ -1982,6 +1984,15 @@ static SNode* setDatabaseOptionImpl(SAstCreateContext* pCxt, SNode* pOptions, ED pDbOptions->encryptAlgorithm = TSDB_DEFAULT_ENCRYPT_ALGO; break; } + case DB_OPTION_DNODES: + if (((SToken*)pVal)->n >= TSDB_DNODE_LIST_LEN) { + snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, "the dnode list is too long (should less than %d)", + TSDB_DNODE_LIST_LEN); + pCxt->errCode = TSDB_CODE_PAR_SYNTAX_ERROR; + } else { + COPY_STRING_FORM_STR_TOKEN(pDbOptions->dnodeListStr, (SToken*)pVal); + } + break; default: break; } diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 636be7c5cce6..f9006d032f82 100755 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -7532,6 +7532,8 @@ static int32_t buildCreateDbReq(STranslateContext* pCxt, SCreateDatabaseStmt* pS pReq->ignoreExist = pStmt->ignoreExists; pReq->withArbitrator = pStmt->pOptions->withArbitrator; pReq->encryptAlgorithm = pStmt->pOptions->encryptAlgorithm; + tstrncpy(pReq->dnodeListStr, pStmt->pOptions->dnodeListStr, TSDB_DNODE_LIST_LEN); + return buildCreateDbRetentions(pStmt->pOptions->pRetentions, pReq); } diff --git a/source/util/src/terror.c b/source/util/src/terror.c index 52a3be120d5a..43fd47fcc7fe 100644 --- a/source/util/src/terror.c +++ b/source/util/src/terror.c @@ -268,6 +268,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_DB_IN_CREATING, "Database in creating TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_SYS_TABLENAME, "Invalid system table name") TAOS_DEFINE_ERROR(TSDB_CODE_MND_ENCRYPT_NOT_ALLOW_CHANGE, "Encryption is not allowed to be changed after database is created") TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_WAL_LEVEL, "Invalid option, wal_level 0 should be used with replica 1") +TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_DNODE_LIST_FMT, "Invalid dnode list format") // mnode-node TAOS_DEFINE_ERROR(TSDB_CODE_MND_MNODE_ALREADY_EXIST, "Mnode already exists") From 81f08c9d822f5b4062e6515f555c03814deb5a60 Mon Sep 17 00:00:00 2001 From: qevolg <2227465945@qq.com> Date: Sun, 27 Oct 2024 09:22:58 +0800 Subject: [PATCH 320/695] chore(.github): modify taoskeeper github action workflow --- .github/workflows/taoskeeper-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/taoskeeper-ci.yml b/.github/workflows/taoskeeper-ci.yml index 87b893666ca6..38dfb6d43c00 100644 --- a/.github/workflows/taoskeeper-ci.yml +++ b/.github/workflows/taoskeeper-ci.yml @@ -1,4 +1,4 @@ -name: taoskeeper CI +name: TaosKeeper CI on: push: From 4df8aeded9024c47df2cfb1bfb6e065fbe19129e Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Sun, 27 Oct 2024 11:25:51 +0800 Subject: [PATCH 321/695] fix: repeat double state_window( keyword --- tools/shell/src/shellAuto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/shell/src/shellAuto.c b/tools/shell/src/shellAuto.c index f0d61e4a5456..201389f20b70 100644 --- a/tools/shell/src/shellAuto.c +++ b/tools/shell/src/shellAuto.c @@ -232,7 +232,7 @@ char* keywords[] = { "interval(", "order by ", "order by ", "offset ", "or ", "group by ", "now()", "session(", "sliding ", "slimit ", "soffset ", "state_window(", "today() ", "union all select ", "partition by ", "match", "nmatch ", "between ", "like ", "is null ", "is not null ", - "state_window(", "event_window ", "count_window(" + "event_window ", "count_window(" }; char* functions[] = { From 380f43349972ff44794b1c7e05bf5ad48ebc8b22 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Sun, 27 Oct 2024 15:40:17 +0800 Subject: [PATCH 322/695] fix(stream): use the refId in stream meta list, in order to avoid access already freed stream tasks. --- include/libs/stream/tstream.h | 12 +++--- source/libs/stream/inc/streamInt.h | 5 ++- source/libs/stream/src/streamTask.c | 66 ++++++++++++++++++----------- 3 files changed, 53 insertions(+), 30 deletions(-) diff --git a/include/libs/stream/tstream.h b/include/libs/stream/tstream.h index a189cee0bbb3..449df5207f67 100644 --- a/include/libs/stream/tstream.h +++ b/include/libs/stream/tstream.h @@ -70,7 +70,8 @@ typedef struct SActiveCheckpointInfo SActiveCheckpointInfo; #define SSTREAM_TASK_NEED_CONVERT_VER 2 #define SSTREAM_TASK_SUBTABLE_CHANGED_VER 3 -extern int32_t streamMetaId; +extern int32_t streamMetaRefPool; +extern int32_t streamTaskRefPool; enum { STREAM_STATUS__NORMAL = 0, @@ -258,6 +259,7 @@ typedef struct STaskId { typedef struct SStreamTaskId { int64_t streamId; int32_t taskId; + int64_t refId; const char* idStr; } SStreamTaskId; @@ -291,7 +293,6 @@ typedef struct SStreamStatus { int8_t schedStatus; int8_t statusBackup; int32_t schedIdleTime; // idle time before invoke again - int32_t timerActive; // timer is active int64_t lastExecTs; // last exec time stamp int32_t inScanHistorySentinel; bool appendTranstateBlock; // has append the transfer state data block already @@ -546,7 +547,7 @@ typedef int32_t (*__state_trans_user_fn)(SStreamTask*, void* param); int32_t tNewStreamTask(int64_t streamId, int8_t taskLevel, SEpSet* pEpset, bool fillHistory, int64_t triggerParam, SArray* pTaskList, bool hasFillhistory, int8_t subtableWithoutMd5, SStreamTask** pTask); -void tFreeStreamTask(SStreamTask* pTask); +void tFreeStreamTask(void* pTask); int32_t tEncodeStreamTask(SEncoder* pEncoder, const SStreamTask* pTask); int32_t tDecodeStreamTask(SDecoder* pDecoder, SStreamTask* pTask); int32_t streamTaskInit(SStreamTask* pTask, SStreamMeta* pMeta, SMsgCb* pMsgCb, int64_t ver); @@ -664,6 +665,8 @@ void streamTaskResetStatus(SStreamTask* pTask); void streamTaskSetStatusReady(SStreamTask* pTask); ETaskStatus streamTaskGetPrevStatus(const SStreamTask* pTask); const char* streamTaskGetExecType(int32_t type); +int32_t streamTaskAllocRefId(SStreamTask* pTask, int64_t** pRefId); +void streamTaskFreeRefId(int64_t* pRefId); bool streamTaskUpdateEpsetInfo(SStreamTask* pTask, SArray* pNodeList); void streamTaskResetUpstreamStageInfo(SStreamTask* pTask); @@ -752,16 +755,15 @@ int32_t streamMetaRegisterTask(SStreamMeta* pMeta, int64_t ver, SStreamTask* pTa int32_t streamMetaUnregisterTask(SStreamMeta* pMeta, int64_t streamId, int32_t taskId); int32_t streamMetaGetNumOfTasks(SStreamMeta* pMeta); int32_t streamMetaAcquireTaskNoLock(SStreamMeta* pMeta, int64_t streamId, int32_t taskId, SStreamTask** pTask); +int32_t streamMetaAcquireTaskUnsafe(SStreamMeta* pMeta, STaskId* pId, SStreamTask** pTask); int32_t streamMetaAcquireTask(SStreamMeta* pMeta, int64_t streamId, int32_t taskId, SStreamTask** pTask); void streamMetaReleaseTask(SStreamMeta* pMeta, SStreamTask* pTask); -int32_t streamMetaAcquireOneTask(SStreamTask* pTask); void streamMetaClear(SStreamMeta* pMeta); void streamMetaInitBackend(SStreamMeta* pMeta); int32_t streamMetaCommit(SStreamMeta* pMeta); int64_t streamMetaGetLatestCheckpointId(SStreamMeta* pMeta); void streamMetaNotifyClose(SStreamMeta* pMeta); void streamMetaStartHb(SStreamMeta* pMeta); -bool streamMetaTaskInTimer(SStreamMeta* pMeta); int32_t streamMetaAddTaskLaunchResult(SStreamMeta* pMeta, int64_t streamId, int32_t taskId, int64_t startTs, int64_t endTs, bool ready); int32_t streamMetaInitStartInfo(STaskStartInfo* pStartInfo); diff --git a/source/libs/stream/inc/streamInt.h b/source/libs/stream/inc/streamInt.h index 94c196d280f6..93c8dc3b404c 100644 --- a/source/libs/stream/inc/streamInt.h +++ b/source/libs/stream/inc/streamInt.h @@ -21,6 +21,7 @@ #include "streamBackendRocksdb.h" #include "trpc.h" #include "tstream.h" +#include "tref.h" #ifdef __cplusplus extern "C" { @@ -70,7 +71,7 @@ struct SActiveCheckpointInfo { SStreamTmrInfo chkptReadyMsgTmr; }; -int32_t streamCleanBeforeQuitTmr(SStreamTmrInfo* pInfo, SStreamTask* pTask); +void streamCleanBeforeQuitTmr(SStreamTmrInfo* pInfo, void* param); typedef struct { int8_t type; @@ -225,6 +226,8 @@ void destroyMetaHbInfo(SMetaHbInfo* pInfo); void streamMetaWaitForHbTmrQuit(SStreamMeta* pMeta); void streamMetaGetHbSendInfo(SMetaHbInfo* pInfo, int64_t* pStartTs, int32_t* pSendCount); int32_t streamMetaSendHbHelper(SStreamMeta* pMeta); +int32_t metaRefMgtAdd(int64_t vgId, int64_t* rid); +void metaRefMgtRemove(int64_t* pRefId); ECHECKPOINT_BACKUP_TYPE streamGetCheckpointBackupType(); diff --git a/source/libs/stream/src/streamTask.c b/source/libs/stream/src/streamTask.c index b359cdfc81b3..e00984ea9b41 100644 --- a/source/libs/stream/src/streamTask.c +++ b/source/libs/stream/src/streamTask.c @@ -211,18 +211,19 @@ int32_t tDecodeStreamTaskId(SDecoder* pDecoder, STaskId* pTaskId) { return 0; } -void tFreeStreamTask(SStreamTask* pTask) { - char* p = NULL; - int32_t taskId = pTask->id.taskId; +void tFreeStreamTask(void* pParam) { + char* p = NULL; + SStreamTask* pTask = pParam; + int32_t taskId = pTask->id.taskId; STaskExecStatisInfo* pStatis = &pTask->execInfo; ETaskStatus status1 = TASK_STATUS__UNINIT; streamMutexLock(&pTask->lock); if (pTask->status.pSM != NULL) { - SStreamTaskState pStatus = streamTaskGetStatus(pTask); - p = pStatus.name; - status1 = pStatus.state; + SStreamTaskState status = streamTaskGetStatus(pTask); + p = status.name; + status1 = status.state; } streamMutexUnlock(&pTask->lock); @@ -235,12 +236,6 @@ void tFreeStreamTask(SStreamTask* pTask) { taskId, pStatis->created, pStatis->checkTs, pStatis->readyTs, pStatis->updateCount, pStatis->latestUpdateTs, pCkInfo->checkpointId, pCkInfo->checkpointVer, pCkInfo->nextProcessVer, pStatis->checkpoint); - // remove the ref by timer - while (pTask->status.timerActive > 0) { - stDebug("s-task:%s wait for task stop timer activities, ref:%d", pTask->id.idStr, pTask->status.timerActive); - taosMsleep(100); - } - if (pTask->schedInfo.pDelayTimer != NULL) { streamTmrStop(pTask->schedInfo.pDelayTimer); pTask->schedInfo.pDelayTimer = NULL; @@ -429,6 +424,7 @@ int32_t streamTaskInit(SStreamTask* pTask, SStreamMeta* pMeta, SMsgCb* pMsgCb, i } pTask->refCnt = 1; + pTask->id.refId = 0; pTask->inputq.status = TASK_INPUT_STATUS__NORMAL; pTask->outputq.status = TASK_OUTPUT_STATUS__NORMAL; @@ -441,7 +437,6 @@ int32_t streamTaskInit(SStreamTask* pTask, SStreamMeta* pMeta, SMsgCb* pMsgCb, i } pTask->status.schedStatus = TASK_SCHED_STATUS__INACTIVE; - pTask->status.timerActive = 0; code = streamCreateStateMachine(pTask); if (pTask->status.pSM == NULL || code != TSDB_CODE_SUCCESS) { @@ -837,28 +832,31 @@ int8_t streamTaskSetSchedStatusInactive(SStreamTask* pTask) { int32_t streamTaskClearHTaskAttr(SStreamTask* pTask, int32_t resetRelHalt) { int32_t code = 0; SStreamMeta* pMeta = pTask->pMeta; - STaskId sTaskId = {.streamId = pTask->streamTaskId.streamId, .taskId = pTask->streamTaskId.taskId}; + SStreamTask* pStreamTask = NULL; + if (pTask->info.fillHistory == 0) { return code; } - SStreamTask** ppStreamTask = (SStreamTask**)taosHashGet(pMeta->pTasksMap, &sTaskId, sizeof(sTaskId)); - if (ppStreamTask != NULL) { + code = streamMetaAcquireTaskUnsafe(pMeta, &pTask->streamTaskId, &pStreamTask); + if (code == 0) { stDebug("s-task:%s clear the related stream task:0x%x attr to fill-history task", pTask->id.idStr, - (int32_t)sTaskId.taskId); + (int32_t)pTask->streamTaskId.taskId); - streamMutexLock(&(*ppStreamTask)->lock); - CLEAR_RELATED_FILLHISTORY_TASK((*ppStreamTask)); + streamMutexLock(&(pStreamTask->lock)); + CLEAR_RELATED_FILLHISTORY_TASK(pStreamTask); if (resetRelHalt) { stDebug("s-task:0x%" PRIx64 " set the persistent status attr to be ready, prev:%s, status in sm:%s", - sTaskId.taskId, streamTaskGetStatusStr((*ppStreamTask)->status.taskStatus), - streamTaskGetStatus(*ppStreamTask).name); - (*ppStreamTask)->status.taskStatus = TASK_STATUS__READY; + pTask->streamTaskId.taskId, streamTaskGetStatusStr(pStreamTask->status.taskStatus), + streamTaskGetStatus(pStreamTask).name); + pStreamTask->status.taskStatus = TASK_STATUS__READY; } - code = streamMetaSaveTask(pMeta, *ppStreamTask); - streamMutexUnlock(&(*ppStreamTask)->lock); + code = streamMetaSaveTask(pMeta, pStreamTask); + streamMutexUnlock(&(pStreamTask->lock)); + + streamMetaReleaseTask(pMeta, pStreamTask); } return code; @@ -1282,3 +1280,23 @@ const char* streamTaskGetExecType(int32_t type) { return "invalid-exec-type"; } } + +int32_t streamTaskAllocRefId(SStreamTask* pTask, int64_t** pRefId) { + *pRefId = taosMemoryMalloc(sizeof(int64_t)); + if (*pRefId != NULL) { + **pRefId = pTask->id.refId; + metaRefMgtAdd(pTask->pMeta->vgId, *pRefId); + return 0; + } else { + stError("s-task:%s failed to alloc new ref id, code:%s", pTask->id.idStr, tstrerror(terrno)); + return terrno; + } +} + +void streamTaskFreeRefId(int64_t* pRefId) { + if (pRefId == NULL) { + return; + } + + metaRefMgtRemove(pRefId); +} \ No newline at end of file From 4802f59dfe4ee049351041be269962edb8d19c05 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Sun, 27 Oct 2024 15:49:40 +0800 Subject: [PATCH 323/695] fix(stream): use the refId in stream meta list, in order to avoid access already freed stream tasks. --- source/dnode/snode/src/snode.c | 8 +- source/dnode/vnode/src/sma/smaRollup.c | 15 +- source/dnode/vnode/src/tq/tq.c | 8 +- source/dnode/vnode/src/tq/tqRead.c | 17 +- source/dnode/vnode/src/tq/tqStreamTask.c | 4 +- source/dnode/vnode/src/tq/tqUtil.c | 14 +- source/dnode/vnode/src/tqCommon/tqCommon.c | 93 +++-- source/libs/stream/src/streamCheckStatus.c | 106 +++--- source/libs/stream/src/streamCheckpoint.c | 103 +++--- source/libs/stream/src/streamDispatch.c | 164 ++++++--- source/libs/stream/src/streamHb.c | 86 +++-- source/libs/stream/src/streamMeta.c | 382 ++++++++++---------- source/libs/stream/src/streamSched.c | 67 ++-- source/libs/stream/src/streamStartHistory.c | 261 +++++++------ source/libs/stream/src/streamStartTask.c | 65 ++-- source/libs/stream/src/streamTimer.c | 10 +- 16 files changed, 764 insertions(+), 639 deletions(-) diff --git a/source/dnode/snode/src/snode.c b/source/dnode/snode/src/snode.c index d61f3d80d34e..e8d4663bbbb0 100644 --- a/source/dnode/snode/src/snode.c +++ b/source/dnode/snode/src/snode.c @@ -45,17 +45,17 @@ int32_t sndBuildStreamTask(SSnode *pSnode, SStreamTask *pTask, int64_t nextProce char *p = streamTaskGetStatus(pTask).name; if (pTask->info.fillHistory) { - sndInfo("vgId:%d build stream task, s-task:%s, checkpointId:%" PRId64 " checkpointVer:%" PRId64 + sndInfo("vgId:%d build stream task, s-task:%s, %p checkpointId:%" PRId64 " checkpointVer:%" PRId64 " nextProcessVer:%" PRId64 " child id:%d, level:%d, status:%s fill-history:%d, related stream task:0x%x trigger:%" PRId64 " ms", - SNODE_HANDLE, pTask->id.idStr, pChkInfo->checkpointId, pChkInfo->checkpointVer, pChkInfo->nextProcessVer, + SNODE_HANDLE, pTask->id.idStr, pTask, pChkInfo->checkpointId, pChkInfo->checkpointVer, pChkInfo->nextProcessVer, pTask->info.selfChildId, pTask->info.taskLevel, p, pTask->info.fillHistory, (int32_t)pTask->streamTaskId.taskId, pTask->info.delaySchedParam); } else { - sndInfo("vgId:%d build stream task, s-task:%s, checkpointId:%" PRId64 " checkpointVer:%" PRId64 + sndInfo("vgId:%d build stream task, s-task:%s, %p checkpointId:%" PRId64 " checkpointVer:%" PRId64 " nextProcessVer:%" PRId64 " child id:%d, level:%d, status:%s fill-history:%d, related fill-task:0x%x trigger:%" PRId64 " ms", - SNODE_HANDLE, pTask->id.idStr, pChkInfo->checkpointId, pChkInfo->checkpointVer, pChkInfo->nextProcessVer, + SNODE_HANDLE, pTask->id.idStr, pTask, pChkInfo->checkpointId, pChkInfo->checkpointVer, pChkInfo->nextProcessVer, pTask->info.selfChildId, pTask->info.taskLevel, p, pTask->info.fillHistory, (int32_t)pTask->hTaskInfo.id.taskId, pTask->info.delaySchedParam); } diff --git a/source/dnode/vnode/src/sma/smaRollup.c b/source/dnode/vnode/src/sma/smaRollup.c index 4fdf299e50d1..80c04a327652 100644 --- a/source/dnode/vnode/src/sma/smaRollup.c +++ b/source/dnode/vnode/src/sma/smaRollup.c @@ -238,13 +238,18 @@ int32_t tdFetchTbUidList(SSma *pSma, STbUidStore **ppStore, tb_uid_t suid, tb_ui } static void tdRSmaTaskInit(SStreamMeta *pMeta, SRSmaInfoItem *pItem, SStreamTaskId *pId) { - STaskId id = {.streamId = pId->streamId, .taskId = pId->taskId}; + STaskId id = {.streamId = pId->streamId, .taskId = pId->taskId}; + SStreamTask *pTask = NULL; + streamMetaRLock(pMeta); - SStreamTask **ppTask = (SStreamTask **)taosHashGet(pMeta->pTasksMap, &id, sizeof(id)); - if (ppTask && *ppTask) { - pItem->submitReqVer = (*ppTask)->chkInfo.checkpointVer; - pItem->fetchResultVer = (*ppTask)->info.delaySchedParam; + + int32_t code = streamMetaAcquireTaskUnsafe(pMeta, &id, &pTask); + if (code == 0) { + pItem->submitReqVer = pTask->chkInfo.checkpointVer; + pItem->fetchResultVer = pTask->info.delaySchedParam; + streamMetaReleaseTask(pMeta, pTask); } + streamMetaRUnLock(pMeta); } diff --git a/source/dnode/vnode/src/tq/tq.c b/source/dnode/vnode/src/tq/tq.c index b75baea08d16..292912102988 100644 --- a/source/dnode/vnode/src/tq/tq.c +++ b/source/dnode/vnode/src/tq/tq.c @@ -774,19 +774,19 @@ int32_t tqBuildStreamTask(void* pTqObj, SStreamTask* pTask, int64_t nextProcessV const char* pNext = streamTaskGetStatusStr(pTask->status.taskStatus); if (pTask->info.fillHistory) { - tqInfo("vgId:%d build stream task, s-task:%s, checkpointId:%" PRId64 " checkpointVer:%" PRId64 + tqInfo("vgId:%d build stream task, s-task:%s, %p checkpointId:%" PRId64 " checkpointVer:%" PRId64 " nextProcessVer:%" PRId64 " child id:%d, level:%d, cur-status:%s, next-status:%s fill-history:%d, related stream task:0x%x " "delaySched:%" PRId64 " ms, inputVer:%" PRId64, - vgId, pTask->id.idStr, pChkInfo->checkpointId, pChkInfo->checkpointVer, pChkInfo->nextProcessVer, + vgId, pTask->id.idStr, pTask, pChkInfo->checkpointId, pChkInfo->checkpointVer, pChkInfo->nextProcessVer, pTask->info.selfChildId, pTask->info.taskLevel, p, pNext, pTask->info.fillHistory, (int32_t)pTask->streamTaskId.taskId, pTask->info.delaySchedParam, nextProcessVer); } else { - tqInfo("vgId:%d build stream task, s-task:%s, checkpointId:%" PRId64 " checkpointVer:%" PRId64 + tqInfo("vgId:%d build stream task, s-task:%s, %p checkpointId:%" PRId64 " checkpointVer:%" PRId64 " nextProcessVer:%" PRId64 " child id:%d, level:%d, cur-status:%s next-status:%s fill-history:%d, related fill-task:0x%x " "delaySched:%" PRId64 " ms, inputVer:%" PRId64, - vgId, pTask->id.idStr, pChkInfo->checkpointId, pChkInfo->checkpointVer, pChkInfo->nextProcessVer, + vgId, pTask->id.idStr, pTask, pChkInfo->checkpointId, pChkInfo->checkpointVer, pChkInfo->nextProcessVer, pTask->info.selfChildId, pTask->info.taskLevel, p, pNext, pTask->info.fillHistory, (int32_t)pTask->hTaskInfo.id.taskId, pTask->info.delaySchedParam, nextProcessVer); diff --git a/source/dnode/vnode/src/tq/tqRead.c b/source/dnode/vnode/src/tq/tqRead.c index f2f85773b504..9d9e7c431aeb 100644 --- a/source/dnode/vnode/src/tq/tqRead.c +++ b/source/dnode/vnode/src/tq/tqRead.c @@ -1115,13 +1115,18 @@ int32_t tqUpdateTbUidList(STQ* pTq, const SArray* tbUidList, bool isAdd) { break; } - SStreamTask* pTask = *(SStreamTask**)pIter; - if ((pTask->info.taskLevel == TASK_LEVEL__SOURCE) && (pTask->exec.pExecutor != NULL)) { - int32_t code = qUpdateTableListForStreamScanner(pTask->exec.pExecutor, tbUidList, isAdd); - if (code != 0) { - tqError("vgId:%d, s-task:%s update qualified table error for stream task", vgId, pTask->id.idStr); - continue; + int64_t refId = *(int64_t*)pIter; + SStreamTask* pTask = taosAcquireRef(streamTaskRefPool, refId); + if (pTask != NULL) { + int32_t taskId = pTask->id.taskId; + + if ((pTask->info.taskLevel == TASK_LEVEL__SOURCE) && (pTask->exec.pExecutor != NULL)) { + int32_t code = qUpdateTableListForStreamScanner(pTask->exec.pExecutor, tbUidList, isAdd); + if (code != 0) { + tqError("vgId:%d, s-task:0x%x update qualified table error for stream task", vgId, taskId); + } } + taosReleaseRef(streamTaskRefPool, refId); } } diff --git a/source/dnode/vnode/src/tq/tqStreamTask.c b/source/dnode/vnode/src/tq/tqStreamTask.c index 3ec269ec2201..24c892de8bf4 100644 --- a/source/dnode/vnode/src/tq/tqStreamTask.c +++ b/source/dnode/vnode/src/tq/tqStreamTask.c @@ -79,7 +79,7 @@ static void doStartScanWal(void* param, void* tmrId) { SBuildScanWalMsgParam* pParam = (SBuildScanWalMsgParam*)param; - SStreamMeta* pMeta = taosAcquireRef(streamMetaId, pParam->metaId); + SStreamMeta* pMeta = taosAcquireRef(streamMetaRefPool, pParam->metaId); if (pMeta == NULL) { tqError("metaRid:%" PRId64 " not valid now, stream meta has been freed", pParam->metaId); taosMemoryFree(pParam); @@ -97,7 +97,7 @@ static void doStartScanWal(void* param, void* tmrId) { tqError("vgId:%d failed sched task to scan wal, code:%s", vgId, tstrerror(code)); } - code = taosReleaseRef(streamMetaId, pParam->metaId); + code = taosReleaseRef(streamMetaRefPool, pParam->metaId); if (code) { tqError("vgId:%d failed to release ref for streamMeta, rid:%" PRId64 " code:%s", vgId, pParam->metaId, tstrerror(code)); diff --git a/source/dnode/vnode/src/tq/tqUtil.c b/source/dnode/vnode/src/tq/tqUtil.c index b4866b8c653c..5b51d6a94f68 100644 --- a/source/dnode/vnode/src/tq/tqUtil.c +++ b/source/dnode/vnode/src/tq/tqUtil.c @@ -683,19 +683,21 @@ int32_t tqGetStreamExecInfo(SVnode* pVnode, int64_t streamId, int64_t* pDelay, b continue; } - STaskId id = {.streamId = pId->streamId, .taskId = pId->taskId}; - SStreamTask** ppTask = taosHashGet(pMeta->pTasksMap, &id, sizeof(id)); - if (ppTask == NULL) { + STaskId id = {.streamId = pId->streamId, .taskId = pId->taskId}; + SStreamTask* pTask = NULL; + + code = streamMetaAcquireTaskUnsafe(pMeta, &id, &pTask); + if (code != 0) { tqError("vgId:%d failed to acquire task:0x%x in retrieving progress", pMeta->vgId, pId->taskId); continue; } - if ((*ppTask)->info.taskLevel != TASK_LEVEL__SOURCE) { + if (pTask->info.taskLevel != TASK_LEVEL__SOURCE) { + streamMetaReleaseTask(pMeta, pTask); continue; } // here we get the required stream source task - SStreamTask* pTask = *ppTask; *fhFinished = !HAS_RELATED_FILLHISTORY_TASK(pTask); int64_t ver = walReaderGetCurrentVer(pTask->exec.pWalReader); @@ -711,6 +713,7 @@ int32_t tqGetStreamExecInfo(SVnode* pVnode, int64_t streamId, int64_t* pDelay, b SWalReader* pReader = walOpenReader(pTask->exec.pWalReader->pWal, NULL, 0); if (pReader == NULL) { tqError("failed to open wal reader to extract exec progress, vgId:%d", pMeta->vgId); + streamMetaReleaseTask(pMeta, pTask); continue; } @@ -736,6 +739,7 @@ int32_t tqGetStreamExecInfo(SVnode* pVnode, int64_t streamId, int64_t* pDelay, b } walCloseReader(pReader); + streamMetaReleaseTask(pMeta, pTask); } streamMetaRUnLock(pMeta); diff --git a/source/dnode/vnode/src/tqCommon/tqCommon.c b/source/dnode/vnode/src/tqCommon/tqCommon.c index a00e92997c0c..e8d929e4aa9f 100644 --- a/source/dnode/vnode/src/tqCommon/tqCommon.c +++ b/source/dnode/vnode/src/tqCommon/tqCommon.c @@ -138,13 +138,15 @@ int32_t tqStreamStartOneTaskAsync(SStreamMeta* pMeta, SMsgCb* cb, int64_t stream // this is to process request from transaction, always return true. int32_t tqStreamTaskProcessUpdateReq(SStreamMeta* pMeta, SMsgCb* cb, SRpcMsg* pMsg, bool restored) { - int32_t vgId = pMeta->vgId; - char* msg = POINTER_SHIFT(pMsg->pCont, sizeof(SMsgHead)); - int32_t len = pMsg->contLen - sizeof(SMsgHead); - SRpcMsg rsp = {.info = pMsg->info, .code = TSDB_CODE_SUCCESS}; - int64_t st = taosGetTimestampMs(); - bool updated = false; - int32_t code = 0; + int32_t vgId = pMeta->vgId; + char* msg = POINTER_SHIFT(pMsg->pCont, sizeof(SMsgHead)); + int32_t len = pMsg->contLen - sizeof(SMsgHead); + SRpcMsg rsp = {.info = pMsg->info, .code = TSDB_CODE_SUCCESS}; + int64_t st = taosGetTimestampMs(); + bool updated = false; + int32_t code = 0; + SStreamTask* pTask = NULL; + SStreamTask* pHTask = NULL; SStreamTaskNodeUpdateMsg req = {0}; @@ -170,9 +172,9 @@ int32_t tqStreamTaskProcessUpdateReq(SStreamMeta* pMeta, SMsgCb* cb, SRpcMsg* pM streamMetaWLock(pMeta); // the task epset may be updated again and again, when replaying the WAL, the task may be in stop status. - STaskId id = {.streamId = req.streamId, .taskId = req.taskId}; - SStreamTask** ppTask = (SStreamTask**)taosHashGet(pMeta->pTasksMap, &id, sizeof(id)); - if (ppTask == NULL || *ppTask == NULL) { + STaskId id = {.streamId = req.streamId, .taskId = req.taskId}; + code = streamMetaAcquireTaskUnsafe(pMeta, &id, &pTask); + if (code != 0) { tqError("vgId:%d failed to acquire task:0x%x when handling update task epset, it may have been dropped", vgId, req.taskId); rsp.code = TSDB_CODE_SUCCESS; @@ -181,12 +183,13 @@ int32_t tqStreamTaskProcessUpdateReq(SStreamMeta* pMeta, SMsgCb* cb, SRpcMsg* pM return rsp.code; } - SStreamTask* pTask = *ppTask; - const char* idstr = pTask->id.idStr; + const char* idstr = pTask->id.idStr; if (req.transId <= 0) { tqError("vgId:%d invalid update nodeEp task, transId:%d, discard", vgId, req.taskId); rsp.code = TSDB_CODE_SUCCESS; + + streamMetaReleaseTask(pMeta, pTask); streamMetaWUnLock(pMeta); taosArrayDestroy(req.pNodeList); @@ -227,24 +230,23 @@ int32_t tqStreamTaskProcessUpdateReq(SStreamMeta* pMeta, SMsgCb* cb, SRpcMsg* pM streamTaskStopMonitorCheckRsp(&pTask->taskCheckInfo, pTask->id.idStr); - SStreamTask** ppHTask = NULL; if (HAS_RELATED_FILLHISTORY_TASK(pTask)) { - ppHTask = (SStreamTask**)taosHashGet(pMeta->pTasksMap, &pTask->hTaskInfo.id, sizeof(pTask->hTaskInfo.id)); - if (ppHTask == NULL || *ppHTask == NULL) { + code = streamMetaAcquireTaskUnsafe(pMeta, &pTask->hTaskInfo.id, &pHTask); + if (code != 0) { tqError( "vgId:%d failed to acquire fill-history task:0x%x when handling update, may have been dropped already, rel " "stream task:0x%x", vgId, (uint32_t)pTask->hTaskInfo.id.taskId, req.taskId); CLEAR_RELATED_FILLHISTORY_TASK(pTask); } else { - tqDebug("s-task:%s fill-history task update nodeEp along with stream task", (*ppHTask)->id.idStr); - bool updateEpSet = streamTaskUpdateEpsetInfo(*ppHTask, req.pNodeList); + tqDebug("s-task:%s fill-history task update nodeEp along with stream task", pHTask->id.idStr); + bool updateEpSet = streamTaskUpdateEpsetInfo(pHTask, req.pNodeList); if (updateEpSet) { updated = updateEpSet; } - streamTaskResetStatus(*ppHTask); - streamTaskStopMonitorCheckRsp(&(*ppHTask)->taskCheckInfo, (*ppHTask)->id.idStr); + streamTaskResetStatus(pHTask); + streamTaskStopMonitorCheckRsp(&pHTask->taskCheckInfo, pHTask->id.idStr); } } @@ -256,8 +258,8 @@ int32_t tqStreamTaskProcessUpdateReq(SStreamMeta* pMeta, SMsgCb* cb, SRpcMsg* pM tqError("s-task:%s vgId:%d failed to save task, code:%s", idstr, vgId, tstrerror(code)); } - if (ppHTask != NULL) { - code = streamMetaSaveTask(pMeta, *ppHTask); + if (pHTask != NULL) { + code = streamMetaSaveTask(pMeta, pHTask); if (code) { tqError("s-task:%s vgId:%d failed to save related history task, code:%s", idstr, vgId, tstrerror(code)); } @@ -271,15 +273,17 @@ int32_t tqStreamTaskProcessUpdateReq(SStreamMeta* pMeta, SMsgCb* cb, SRpcMsg* pM tqError("s-task:%s vgId:%d failed to stop task, code:%s", idstr, vgId, tstrerror(code)); } - if (ppHTask != NULL) { - code = streamTaskStop(*ppHTask); + if (pHTask != NULL) { + code = streamTaskStop(pHTask); if (code) { tqError("s-task:%s vgId:%d failed to stop related history task, code:%s", idstr, vgId, tstrerror(code)); } } // keep info - streamMetaAddIntoUpdateTaskList(pMeta, pTask, (ppHTask != NULL) ? (*ppHTask) : NULL, req.transId, st); + streamMetaAddIntoUpdateTaskList(pMeta, pTask, (pHTask != NULL) ? (pHTask) : NULL, req.transId, st); + streamMetaReleaseTask(pMeta, pTask); + streamMetaReleaseTask(pMeta, pHTask); rsp.code = TSDB_CODE_SUCCESS; @@ -643,7 +647,6 @@ int32_t tqStreamTaskProcessDeployReq(SStreamMeta* pMeta, SMsgCb* cb, int64_t sve if (code < 0) { tqError("failed to add s-task:0x%x into vgId:%d meta, existed:%d, code:%s", vgId, taskId, numOfTasks, tstrerror(code)); - tFreeStreamTask(pTask); return code; } @@ -673,7 +676,6 @@ int32_t tqStreamTaskProcessDeployReq(SStreamMeta* pMeta, SMsgCb* cb, int64_t sve } } else { tqWarn("vgId:%d failed to add s-task:0x%x, since already exists in meta store, total:%d", vgId, taskId, numOfTasks); - tFreeStreamTask(pTask); } return code; @@ -681,25 +683,25 @@ int32_t tqStreamTaskProcessDeployReq(SStreamMeta* pMeta, SMsgCb* cb, int64_t sve int32_t tqStreamTaskProcessDropReq(SStreamMeta* pMeta, char* msg, int32_t msgLen) { SVDropStreamTaskReq* pReq = (SVDropStreamTaskReq*)msg; + int32_t code = 0; + int32_t vgId = pMeta->vgId; + STaskId hTaskId = {0}; + SStreamTask* pTask = NULL; - int32_t code = 0; - int32_t vgId = pMeta->vgId; - STaskId hTaskId = {0}; tqDebug("vgId:%d receive msg to drop s-task:0x%x", vgId, pReq->taskId); streamMetaWLock(pMeta); - STaskId id = {.streamId = pReq->streamId, .taskId = pReq->taskId}; - SStreamTask** ppTask = (SStreamTask**)taosHashGet(pMeta->pTasksMap, &id, sizeof(id)); - if ((ppTask != NULL) && ((*ppTask) != NULL)) { - int32_t unusedRetRef = streamMetaAcquireOneTask(*ppTask); - SStreamTask* pTask = *ppTask; - + STaskId id = {.streamId = pReq->streamId, .taskId = pReq->taskId}; + code = streamMetaAcquireTaskUnsafe(pMeta, &id, &pTask); + if (code == 0) { if (HAS_RELATED_FILLHISTORY_TASK(pTask)) { hTaskId.streamId = pTask->hTaskInfo.id.streamId; hTaskId.taskId = pTask->hTaskInfo.id.taskId; } + // clear the relationship, and then release the stream tasks, to avoid invalid accessing of already freed + // related stream(history) task streamTaskSetRemoveBackendFiles(pTask); code = streamTaskClearHTaskAttr(pTask, pReq->resetRelHalt); streamMetaReleaseTask(pMeta, pTask); @@ -742,18 +744,19 @@ int32_t tqStreamTaskProcessDropReq(SStreamMeta* pMeta, char* msg, int32_t msgLen int32_t tqStreamTaskProcessUpdateCheckpointReq(SStreamMeta* pMeta, bool restored, char* msg) { SVUpdateCheckpointInfoReq* pReq = (SVUpdateCheckpointInfoReq*)msg; + int32_t code = 0; + int32_t vgId = pMeta->vgId; + SStreamTask* pTask = NULL; - int32_t code = 0; - int32_t vgId = pMeta->vgId; tqDebug("vgId:%d receive msg to update-checkpoint-info for s-task:0x%x", vgId, pReq->taskId); streamMetaWLock(pMeta); - STaskId id = {.streamId = pReq->streamId, .taskId = pReq->taskId}; - SStreamTask** ppTask = (SStreamTask**)taosHashGet(pMeta->pTasksMap, &id, sizeof(id)); - - if (ppTask != NULL && (*ppTask) != NULL) { - code = streamTaskUpdateTaskCheckpointInfo(*ppTask, restored, pReq); + STaskId id = {.streamId = pReq->streamId, .taskId = pReq->taskId}; + code = streamMetaAcquireTaskUnsafe(pMeta, &id, &pTask); + if (code == 0) { + code = streamTaskUpdateTaskCheckpointInfo(pTask, restored, pReq); + streamMetaReleaseTask(pMeta, pTask); } else { // failed to get the task. int32_t numOfTasks = streamMetaGetNumOfTasks(pMeta); tqError( @@ -763,7 +766,6 @@ int32_t tqStreamTaskProcessUpdateCheckpointReq(SStreamMeta* pMeta, bool restored } streamMetaWUnLock(pMeta); - // always return success when handling the requirement issued by mnode during transaction. return TSDB_CODE_SUCCESS; } @@ -789,11 +791,6 @@ static int32_t restartStreamTasks(SStreamMeta* pMeta, bool isLeader) { tqInfo("vgId:%d tasks are all updated and stopped, restart all tasks, triggered by transId:%d, ts:%" PRId64, vgId, pMeta->updateInfo.completeTransId, pMeta->updateInfo.completeTs); - while (streamMetaTaskInTimer(pMeta)) { - tqDebug("vgId:%d some tasks in timer, wait for 100ms and recheck", pMeta->vgId); - taosMsleep(100); - } - streamMetaWLock(pMeta); streamMetaClear(pMeta); diff --git a/source/libs/stream/src/streamCheckStatus.c b/source/libs/stream/src/streamCheckStatus.c index c1c54b3c0bfd..60f8744448bf 100644 --- a/source/libs/stream/src/streamCheckStatus.c +++ b/source/libs/stream/src/streamCheckStatus.c @@ -299,13 +299,14 @@ void streamTaskStartMonitorCheckRsp(SStreamTask* pTask) { return; } - int32_t unusedRetRef = streamMetaAcquireOneTask(pTask); // add task ref here streamTaskInitTaskCheckInfo(pInfo, &pTask->outputInfo, taosGetTimestampMs()); - int32_t ref = atomic_add_fetch_32(&pTask->status.timerActive, 1); - stDebug("s-task:%s start check-rsp monitor, ref:%d ", pTask->id.idStr, ref); - streamTmrStart(rspMonitorFn, CHECK_RSP_CHECK_INTERVAL, pTask, streamTimer, &pInfo->checkRspTmr, vgId, - "check-status-monitor"); + int64_t* pTaskRefId = NULL; + code = streamTaskAllocRefId(pTask, &pTaskRefId); + if (code == 0) { + streamTmrStart(rspMonitorFn, CHECK_RSP_CHECK_INTERVAL, pTaskRefId, streamTimer, &pInfo->checkRspTmr, vgId, + "check-status-monitor"); + } streamMutexUnlock(&pInfo->checkInfoLock); } @@ -721,21 +722,45 @@ int32_t addDownstreamFailedStatusResultAsync(SMsgCb* pMsgCb, int32_t vgId, int64 return streamTaskSchedTask(pMsgCb, vgId, streamId, taskId, STREAM_EXEC_T_ADD_FAILED_TASK); } +static void doCleanup(SStreamTask* pTask, SArray* pNotReadyList, SArray* pTimeoutList, void* param) { + streamMetaReleaseTask(pTask->pMeta, pTask); + + taosArrayDestroy(pNotReadyList); + taosArrayDestroy(pTimeoutList); + streamTaskFreeRefId(param); +} + // this function is executed in timer thread void rspMonitorFn(void* param, void* tmrId) { - SStreamTask* pTask = param; - SStreamMeta* pMeta = pTask->pMeta; - STaskCheckInfo* pInfo = &pTask->taskCheckInfo; - int32_t vgId = pTask->pMeta->vgId; - int64_t now = taosGetTimestampMs(); - int64_t timeoutDuration = now - pInfo->timeoutStartTs; - const char* id = pTask->id.idStr; int32_t numOfReady = 0; int32_t numOfFault = 0; int32_t numOfNotRsp = 0; int32_t numOfNotReady = 0; int32_t numOfTimeout = 0; - int32_t total = taosArrayGetSize(pInfo->pList); + int64_t taskRefId = *(int64_t*)param; + int64_t now = taosGetTimestampMs(); + SArray* pNotReadyList = NULL; + SArray* pTimeoutList = NULL; + SStreamMeta* pMeta = NULL; + STaskCheckInfo* pInfo = NULL; + int32_t vgId = -1; + int64_t timeoutDuration = 0; + const char* id = NULL; + int32_t total = 0; + + SStreamTask* pTask = taosAcquireRef(streamTaskRefPool, taskRefId); + if (pTask == NULL) { + stError("invalid task rid:%" PRId64 " failed to acquired stream-task", taskRefId); + streamTaskFreeRefId(param); + return; + } + + pMeta = pTask->pMeta; + pInfo = &pTask->taskCheckInfo; + vgId = pTask->pMeta->vgId; + timeoutDuration = now - pInfo->timeoutStartTs; + id = pTask->id.idStr; + total = (int32_t) taosArrayGetSize(pInfo->pList); stDebug("s-task:%s start to do check-downstream-rsp check in tmr", id); @@ -744,12 +769,10 @@ void rspMonitorFn(void* param, void* tmrId) { streamMutexUnlock(&pTask->lock); if (state.state == TASK_STATUS__STOP) { - int32_t ref = atomic_sub_fetch_32(&pTask->status.timerActive, 1); - stDebug("s-task:%s status:%s vgId:%d quit from monitor check-rsp tmr, ref:%d", id, state.name, vgId, ref); - + stDebug("s-task:%s status:%s vgId:%d quit from monitor check-rsp tmr", id, state.name, vgId); streamTaskCompleteCheckRsp(pInfo, true, id); - // not record the failed of the current task if try to close current vnode + // not record the failure of the current task if try to close current vnode // otherwise, the put of message operation may incur invalid read of message queue. if (!pMeta->closeFlag) { int32_t code = addDownstreamFailedStatusResultAsync(pTask->pMsgCb, vgId, pTask->id.streamId, pTask->id.taskId); @@ -758,33 +781,30 @@ void rspMonitorFn(void* param, void* tmrId) { } } - streamMetaReleaseTask(pMeta, pTask); + doCleanup(pTask, pNotReadyList, pTimeoutList, param); return; } if (state.state == TASK_STATUS__DROPPING || state.state == TASK_STATUS__READY) { - int32_t ref = atomic_sub_fetch_32(&pTask->status.timerActive, 1); - stDebug("s-task:%s status:%s vgId:%d quit from monitor check-rsp tmr, ref:%d", id, state.name, vgId, ref); + stDebug("s-task:%s status:%s vgId:%d quit from monitor check-rsp tmr", id, state.name, vgId); streamTaskCompleteCheckRsp(pInfo, true, id); - streamMetaReleaseTask(pMeta, pTask); + doCleanup(pTask, pNotReadyList, pTimeoutList, param); return; } streamMutexLock(&pInfo->checkInfoLock); if (pInfo->notReadyTasks == 0) { - int32_t ref = atomic_sub_fetch_32(&pTask->status.timerActive, 1); - stDebug("s-task:%s status:%s vgId:%d all downstream ready, quit from monitor rsp tmr, ref:%d", id, state.name, vgId, - ref); + stDebug("s-task:%s status:%s vgId:%d all downstream ready, quit from monitor rsp tmr", id, state.name, vgId); streamTaskCompleteCheckRsp(pInfo, false, id); streamMutexUnlock(&pInfo->checkInfoLock); - streamMetaReleaseTask(pMeta, pTask); + doCleanup(pTask, pNotReadyList, pTimeoutList, param); return; } - SArray* pNotReadyList = taosArrayInit(4, sizeof(int64_t)); - SArray* pTimeoutList = taosArrayInit(4, sizeof(int64_t)); + pNotReadyList = taosArrayInit(4, sizeof(int64_t)); + pTimeoutList = taosArrayInit(4, sizeof(int64_t)); if (state.state == TASK_STATUS__UNINIT) { getCheckRspStatus(pInfo, timeoutDuration, &numOfReady, &numOfFault, &numOfNotRsp, pTimeoutList, pNotReadyList, id); @@ -795,31 +815,25 @@ void rspMonitorFn(void* param, void* tmrId) { // fault tasks detected, not try anymore bool jumpOut = false; if ((numOfReady + numOfFault + numOfNotReady + numOfTimeout + numOfNotRsp) != total) { - int32_t ref = atomic_sub_fetch_32(&pTask->status.timerActive, 1); - stError( "s-task:%s vgId:%d internal error in handling the check downstream procedure, rsp number is inconsistent, " - "stop rspMonitor tmr, total:%d, notRsp:%d, notReady:%d, fault:%d, timeout:%d, ready:%d ref:%d", - id, vgId, total, numOfNotRsp, numOfNotReady, numOfFault, numOfTimeout, numOfReady, ref); + "stop rspMonitor tmr, total:%d, notRsp:%d, notReady:%d, fault:%d, timeout:%d, ready:%d", + id, vgId, total, numOfNotRsp, numOfNotReady, numOfFault, numOfTimeout, numOfReady); jumpOut = true; } if (numOfFault > 0) { - int32_t ref = atomic_sub_fetch_32(&pTask->status.timerActive, 1); stDebug( "s-task:%s status:%s vgId:%d all rsp. quit from monitor rsp tmr, since vnode-transfer/leader-change/restart " - "detected, total:%d, notRsp:%d, notReady:%d, fault:%d, timeout:%d, ready:%d ref:%d", - id, state.name, vgId, total, numOfNotRsp, numOfNotReady, numOfFault, numOfTimeout, numOfReady, ref); + "detected, total:%d, notRsp:%d, notReady:%d, fault:%d, timeout:%d, ready:%d", + id, state.name, vgId, total, numOfNotRsp, numOfNotReady, numOfFault, numOfTimeout, numOfReady); jumpOut = true; } if (jumpOut) { streamTaskCompleteCheckRsp(pInfo, false, id); streamMutexUnlock(&pInfo->checkInfoLock); - streamMetaReleaseTask(pMeta, pTask); - - taosArrayDestroy(pNotReadyList); - taosArrayDestroy(pTimeoutList); + doCleanup(pTask, pNotReadyList, pTimeoutList, param); return; } } else { // unexpected status @@ -828,11 +842,10 @@ void rspMonitorFn(void* param, void* tmrId) { // checking of downstream tasks has been stopped by other threads if (pInfo->stopCheckProcess == 1) { - int32_t ref = atomic_sub_fetch_32(&pTask->status.timerActive, 1); stDebug( "s-task:%s status:%s vgId:%d stopped by other threads to check downstream process, total:%d, notRsp:%d, " - "notReady:%d, fault:%d, timeout:%d, ready:%d ref:%d", - id, state.name, vgId, total, numOfNotRsp, numOfNotReady, numOfFault, numOfTimeout, numOfReady, ref); + "notReady:%d, fault:%d, timeout:%d, ready:%d", + id, state.name, vgId, total, numOfNotRsp, numOfNotReady, numOfFault, numOfTimeout, numOfReady); streamTaskCompleteCheckRsp(pInfo, false, id); streamMutexUnlock(&pInfo->checkInfoLock); @@ -842,10 +855,7 @@ void rspMonitorFn(void* param, void* tmrId) { stError("s-task:%s failed to create async record start failed task, code:%s", id, tstrerror(code)); } - streamMetaReleaseTask(pMeta, pTask); - - taosArrayDestroy(pNotReadyList); - taosArrayDestroy(pTimeoutList); + doCleanup(pTask, pNotReadyList, pTimeoutList, param); return; } @@ -857,7 +867,7 @@ void rspMonitorFn(void* param, void* tmrId) { handleTimeoutDownstreamTasks(pTask, pTimeoutList); } - streamTmrStart(rspMonitorFn, CHECK_RSP_CHECK_INTERVAL, pTask, streamTimer, &pInfo->checkRspTmr, vgId, + streamTmrStart(rspMonitorFn, CHECK_RSP_CHECK_INTERVAL, param, streamTimer, &pInfo->checkRspTmr, vgId, "check-status-monitor"); streamMutexUnlock(&pInfo->checkInfoLock); @@ -865,7 +875,5 @@ void rspMonitorFn(void* param, void* tmrId) { "s-task:%s vgId:%d continue checking rsp in 300ms, total:%d, notRsp:%d, notReady:%d, fault:%d, timeout:%d, " "ready:%d", id, vgId, total, numOfNotRsp, numOfNotReady, numOfFault, numOfTimeout, numOfReady); - - taosArrayDestroy(pNotReadyList); - taosArrayDestroy(pTimeoutList); + doCleanup(pTask, pNotReadyList, pTimeoutList, NULL); } diff --git a/source/libs/stream/src/streamCheckpoint.c b/source/libs/stream/src/streamCheckpoint.c index 302090bb3731..af2d8b559b48 100644 --- a/source/libs/stream/src/streamCheckpoint.c +++ b/source/libs/stream/src/streamCheckpoint.c @@ -345,13 +345,15 @@ int32_t streamProcessCheckpointTriggerBlock(SStreamTask* pTask, SStreamDataBlock SStreamTmrInfo* pTmrInfo = &pActiveInfo->chkptTriggerMsgTmr; int8_t old = atomic_val_compare_exchange_8(&pTmrInfo->isActive, 0, 1); if (old == 0) { - int32_t ref = atomic_add_fetch_32(&pTask->status.timerActive, 1); - stDebug("s-task:%s start checkpoint-trigger monitor in 10s, ref:%d ", pTask->id.idStr, ref); - - int32_t unusedRetRef = streamMetaAcquireOneTask(pTask); - streamTmrStart(checkpointTriggerMonitorFn, 200, pTask, streamTimer, &pTmrInfo->tmrHandle, vgId, - "trigger-recv-monitor"); - pTmrInfo->launchChkptId = pActiveInfo->activeId; + stDebug("s-task:%s start checkpoint-trigger monitor in 10s", pTask->id.idStr); + + int64_t* pTaskRefId = NULL; + code = streamTaskAllocRefId(pTask, &pTaskRefId); + if (code == 0) { + streamTmrStart(checkpointTriggerMonitorFn, 200, pTaskRefId, streamTimer, &pTmrInfo->tmrHandle, vgId, + "trigger-recv-monitor"); + pTmrInfo->launchChkptId = pActiveInfo->activeId; + } } else { // already launched, do nothing stError("s-task:%s previous checkpoint-trigger monitor tmr is set, not start new one", pTask->id.idStr); } @@ -890,7 +892,7 @@ int32_t streamTaskBuildCheckpoint(SStreamTask* pTask) { return code; } -static int32_t doChkptStatusCheck(SStreamTask* pTask) { +static int32_t doChkptStatusCheck(SStreamTask* pTask, void* param) { const char* id = pTask->id.idStr; int32_t vgId = pTask->pMeta->vgId; SActiveCheckpointInfo* pActiveInfo = pTask->chkInfo.pActiveInfo; @@ -898,25 +900,24 @@ static int32_t doChkptStatusCheck(SStreamTask* pTask) { // checkpoint-trigger recv flag is set, quit if (pActiveInfo->allUpstreamTriggerRecv) { - int32_t ref = streamCleanBeforeQuitTmr(pTmrInfo, pTask); - stDebug("s-task:%s vgId:%d all checkpoint-trigger recv, quit from monitor checkpoint-trigger, ref:%d", id, vgId, - ref); + streamCleanBeforeQuitTmr(pTmrInfo, param); + stDebug("s-task:%s vgId:%d all checkpoint-trigger recv, quit from monitor checkpoint-trigger", id, vgId); return -1; } if (pTmrInfo->launchChkptId != pActiveInfo->activeId) { - int32_t ref = streamCleanBeforeQuitTmr(pTmrInfo, pTask); + streamCleanBeforeQuitTmr(pTmrInfo, param); stWarn("s-task:%s vgId:%d checkpoint-trigger retrieve by previous checkpoint procedure, checkpointId:%" PRId64 - ", quit, ref:%d", - id, vgId, pTmrInfo->launchChkptId, ref); + ", quit", + id, vgId, pTmrInfo->launchChkptId); return -1; } // active checkpoint info is cleared for now if ((pActiveInfo->activeId == 0) || (pActiveInfo->transId == 0) || (pTask->chkInfo.startTs == 0)) { - int32_t ref = streamCleanBeforeQuitTmr(pTmrInfo, pTask); - stWarn("s-task:%s vgId:%d active checkpoint may be cleared, quit from retrieve checkpoint-trigger send tmr, ref:%d", - id, vgId, ref); + streamCleanBeforeQuitTmr(pTmrInfo, param); + stWarn("s-task:%s vgId:%d active checkpoint may be cleared, quit from retrieve checkpoint-trigger send tmr", id, + vgId); return -1; } @@ -964,22 +965,22 @@ static int32_t doFindNotSendUpstream(SStreamTask* pTask, SArray* pList, SArray** return 0; } -static int32_t chkptTriggerRecvMonitorHelper(SStreamTask* pTask, SArray* pNotSendList) { +static int32_t chkptTriggerRecvMonitorHelper(SStreamTask* pTask, void* param, SArray* pNotSendList) { const char* id = pTask->id.idStr; SArray* pList = pTask->upstreamInfo.pList; // send msg to retrieve checkpoint trigger msg SActiveCheckpointInfo* pActiveInfo = pTask->chkInfo.pActiveInfo; SStreamTmrInfo* pTmrInfo = &pActiveInfo->chkptTriggerMsgTmr; int32_t vgId = pTask->pMeta->vgId; - int32_t code = doChkptStatusCheck(pTask); + int32_t code = doChkptStatusCheck(pTask, param); if (code) { return code; } code = doFindNotSendUpstream(pTask, pList, &pNotSendList); if (code) { - int32_t ref = streamCleanBeforeQuitTmr(pTmrInfo, pTask); - stDebug("s-task:%s failed to find not send upstream, code:%s, out of tmr, ref:%d", id, tstrerror(code), ref); + streamCleanBeforeQuitTmr(pTmrInfo, param); + stDebug("s-task:%s failed to find not send upstream, code:%s, out of tmr", id, tstrerror(code)); return code; } @@ -993,36 +994,48 @@ static int32_t chkptTriggerRecvMonitorHelper(SStreamTask* pTask, SArray* pNotSen return code; } +static void doCleanup(SStreamTask* pTask, SArray* pList) { + streamMetaReleaseTask(pTask->pMeta, pTask); + taosArrayDestroy(pList); +} + void checkpointTriggerMonitorFn(void* param, void* tmrId) { - SStreamTask* pTask = param; - int32_t vgId = pTask->pMeta->vgId; - int64_t now = taosGetTimestampMs(); - const char* id = pTask->id.idStr; - SArray* pNotSendList = NULL; - SArray* pList = pTask->upstreamInfo.pList; // send msg to retrieve checkpoint trigger msg int32_t code = 0; int32_t numOfNotSend = 0; + SArray* pNotSendList = NULL; + int64_t taskRefId = *(int64_t*)param; + int64_t now = taosGetTimestampMs(); + + SStreamTask* pTask = taosAcquireRef(streamTaskRefPool, taskRefId); + if (pTask == NULL) { + stError("invalid task rid:%" PRId64 " failed to acquired stream-task", taskRefId); + streamTaskFreeRefId(param); + return; + } + int32_t vgId = pTask->pMeta->vgId; + const char* id = pTask->id.idStr; + SArray* pList = pTask->upstreamInfo.pList; // send msg to retrieve checkpoint trigger msg SActiveCheckpointInfo* pActiveInfo = pTask->chkInfo.pActiveInfo; SStreamTmrInfo* pTmrInfo = &pActiveInfo->chkptTriggerMsgTmr; if (pTask->info.taskLevel == TASK_LEVEL__SOURCE) { - int32_t ref = streamCleanBeforeQuitTmr(pTmrInfo, pTask); - stError("s-task:%s source task should not start the checkpoint-trigger monitor fn, ref:%d quit", id, ref); - streamMetaReleaseTask(pTask->pMeta, pTask); + streamCleanBeforeQuitTmr(pTmrInfo, param); + stError("s-task:%s source task should not start the checkpoint-trigger monitor fn, quit", id); + doCleanup(pTask, pNotSendList); return; } // check the status every 100ms if (streamTaskShouldStop(pTask)) { - int32_t ref = streamCleanBeforeQuitTmr(pTmrInfo, pTask); - stDebug("s-task:%s vgId:%d quit from monitor checkpoint-trigger, ref:%d", id, vgId, ref); - streamMetaReleaseTask(pTask->pMeta, pTask); + streamCleanBeforeQuitTmr(pTmrInfo, param); + stDebug("s-task:%s vgId:%d quit from monitor checkpoint-trigger", id, vgId); + doCleanup(pTask, pNotSendList); return; } if (++pTmrInfo->activeCounter < 50) { - streamTmrStart(checkpointTriggerMonitorFn, 200, pTask, streamTimer, &pTmrInfo->tmrHandle, vgId, + streamTmrStart(checkpointTriggerMonitorFn, 200, param, streamTimer, &pTmrInfo->tmrHandle, vgId, "trigger-recv-monitor"); return; } @@ -1035,20 +1048,19 @@ void checkpointTriggerMonitorFn(void* param, void* tmrId) { streamMutexUnlock(&pTask->lock); if (state.state != TASK_STATUS__CK) { - int32_t ref = streamCleanBeforeQuitTmr(pTmrInfo, pTask); - stDebug("s-task:%s vgId:%d status:%s not in checkpoint status, quit from monitor checkpoint-trigger, ref:%d", id, - vgId, state.name, ref); - streamMetaReleaseTask(pTask->pMeta, pTask); + streamCleanBeforeQuitTmr(pTmrInfo, param); + stDebug("s-task:%s vgId:%d status:%s not in checkpoint status, quit from monitor checkpoint-trigger", id, + vgId, state.name); + doCleanup(pTask, pNotSendList); return; } streamMutexLock(&pActiveInfo->lock); - code = chkptTriggerRecvMonitorHelper(pTask, pNotSendList); + code = chkptTriggerRecvMonitorHelper(pTask, param, pNotSendList); streamMutexUnlock(&pActiveInfo->lock); if (code != TSDB_CODE_SUCCESS) { - streamMetaReleaseTask(pTask->pMeta, pTask); - taosArrayDestroy(pNotSendList); + doCleanup(pTask, pNotSendList); return; } @@ -1056,15 +1068,14 @@ void checkpointTriggerMonitorFn(void* param, void* tmrId) { numOfNotSend = taosArrayGetSize(pNotSendList); if (numOfNotSend > 0) { stDebug("s-task:%s start to monitor checkpoint-trigger in 10s", id); - streamTmrStart(checkpointTriggerMonitorFn, 200, pTask, streamTimer, &pTmrInfo->tmrHandle, vgId, + streamTmrStart(checkpointTriggerMonitorFn, 200, param, streamTimer, &pTmrInfo->tmrHandle, vgId, "trigger-recv-monitor"); } else { - int32_t ref = streamCleanBeforeQuitTmr(pTmrInfo, pTask); - stDebug("s-task:%s all checkpoint-trigger recved, quit from monitor checkpoint-trigger tmr, ref:%d", id, ref); - streamMetaReleaseTask(pTask->pMeta, pTask); + streamCleanBeforeQuitTmr(pTmrInfo, param); + stDebug("s-task:%s all checkpoint-trigger recved, quit from monitor checkpoint-trigger tmr", id); } - taosArrayDestroy(pNotSendList); + doCleanup(pTask, pNotSendList); } int32_t doSendRetrieveTriggerMsg(SStreamTask* pTask, SArray* pNotSendList) { diff --git a/source/libs/stream/src/streamDispatch.c b/source/libs/stream/src/streamDispatch.c index 62d60ff66427..ff410087591f 100644 --- a/source/libs/stream/src/streamDispatch.c +++ b/source/libs/stream/src/streamDispatch.c @@ -518,45 +518,66 @@ static void doSendFailedDispatch(SStreamTask* pTask, SDispatchEntry* pEntry, int } } +static void cleanupInMonitor(int32_t taskId, int64_t taskRefId, void* param) { + int32_t ret = taosReleaseRef(streamTaskRefPool, taskRefId); + if (ret) { + stError("s-task:0x%x failed to release task refId:%" PRId64, taskId, taskRefId); + } + streamTaskFreeRefId(param); +} + static void doMonitorDispatchData(void* param, void* tmrId) { - SStreamTask* pTask = param; - const char* id = pTask->id.idStr; - int32_t vgId = pTask->pMeta->vgId; - SDispatchMsgInfo* pMsgInfo = &pTask->msgInfo; - int32_t msgId = pMsgInfo->msgId; int32_t code = 0; int64_t now = taosGetTimestampMs(); bool inDispatch = true; + SStreamTask* pTask = NULL; + int64_t taskRefId = *(int64_t*)param; + const char* id = NULL; + int32_t vgId = -1; + SDispatchMsgInfo* pMsgInfo = NULL; + int32_t msgId = -1; + + pTask = taosAcquireRef(streamTaskRefPool, taskRefId); + if (pTask == NULL) { + stError("invalid task rid:%" PRId64 " failed to acquired stream-task", taskRefId); + streamTaskFreeRefId(param); + return; + } - stDebug("s-task:%s start monitor dispatch data", id); + id = pTask->id.idStr; + vgId = pTask->pMeta->vgId; + pMsgInfo = &pTask->msgInfo; + msgId = pMsgInfo->msgId; + + stDebug("s-task:%s start to monitor dispatch data", id); if (streamTaskShouldStop(pTask)) { - int32_t ref = atomic_sub_fetch_32(&pTask->status.timerActive, 1); - stDebug("s-task:%s should stop, abort from timer, ref:%d", pTask->id.idStr, ref); + stDebug("s-task:%s should stop, abort from timer", pTask->id.idStr); setNotInDispatchMonitor(pMsgInfo); + cleanupInMonitor(pTask->id.taskId, taskRefId, param); return; } // slave task not handle the dispatch, downstream not ready will break the monitor timer // follower not handle the dispatch rsp if ((pTask->pMeta->role == NODE_ROLE_FOLLOWER) || (pTask->status.downstreamReady != 1)) { - int32_t ref = atomic_sub_fetch_32(&pTask->status.timerActive, 1); - stError("s-task:%s vgId:%d follower or downstream not ready, jump out of monitor tmr, ref:%d", id, vgId, ref); + stError("s-task:%s vgId:%d follower or downstream not ready, jump out of monitor tmr", id, vgId); setNotInDispatchMonitor(pMsgInfo); + cleanupInMonitor(pTask->id.taskId, taskRefId, param); return; } streamMutexLock(&pMsgInfo->lock); if (pTask->outputq.status == TASK_OUTPUT_STATUS__NORMAL) { - int32_t ref = atomic_sub_fetch_32(&pTask->status.timerActive, 1); - stDebug("s-task:%s not in dispatch procedure, abort from timer, ref:%d", pTask->id.idStr, ref); - + stDebug("s-task:%s not in dispatch procedure, abort from timer", pTask->id.idStr); pMsgInfo->inMonitor = 0; inDispatch = false; } + streamMutexUnlock(&pMsgInfo->lock); if (!inDispatch) { + cleanupInMonitor(pTask->id.taskId, taskRefId, param); return; } @@ -564,6 +585,7 @@ static void doMonitorDispatchData(void* param, void* tmrId) { if (numOfFailed == 0) { stDebug("s-task:%s no error occurs, check again in %dms", id, DISPATCH_RETRY_INTERVAL_MS); streamStartMonitorDispatchData(pTask, DISPATCH_RETRY_INTERVAL_MS); + cleanupInMonitor(pTask->id.taskId, taskRefId, param); return; } @@ -628,18 +650,23 @@ static void doMonitorDispatchData(void* param, void* tmrId) { } if (streamTaskShouldStop(pTask)) { - int32_t ref = atomic_sub_fetch_32(&pTask->status.timerActive, 1); - stDebug("s-task:%s should stop, abort from timer, ref:%d", pTask->id.idStr, ref); + stDebug("s-task:%s should stop, abort from timer", pTask->id.idStr); setNotInDispatchMonitor(pMsgInfo); } else { streamStartMonitorDispatchData(pTask, DISPATCH_RETRY_INTERVAL_MS); } + + cleanupInMonitor(pTask->id.taskId, taskRefId, param); } void streamStartMonitorDispatchData(SStreamTask* pTask, int64_t waitDuration) { - int32_t vgId = pTask->pMeta->vgId; - streamTmrStart(doMonitorDispatchData, waitDuration, pTask, streamTimer, &pTask->msgInfo.pRetryTmr, vgId, - "dispatch-monitor"); + int32_t vgId = pTask->pMeta->vgId; + int64_t* pTaskRefId = NULL; + int32_t code = streamTaskAllocRefId(pTask, &pTaskRefId); + if (code == 0) { + streamTmrStart(doMonitorDispatchData, waitDuration, pTaskRefId, streamTimer, &pTask->msgInfo.pRetryTmr, vgId, + "dispatch-monitor"); + } } static int32_t doAddDispatchBlock(SStreamTask* pTask, SStreamDispatchReq* pReqs, SSDataBlock* pDataBlock, @@ -854,9 +881,9 @@ int32_t streamDispatchStreamBlock(SStreamTask* pTask) { } else { streamMutexLock(&pTask->msgInfo.lock); if (pTask->msgInfo.inMonitor == 0) { - int32_t ref = atomic_add_fetch_32(&pTask->status.timerActive, 1); - stDebug("s-task:%s start dispatch monitor tmr in %dms, ref:%d, dispatch code:%s", id, DISPATCH_RETRY_INTERVAL_MS, - ref, tstrerror(code)); +// int32_t ref = atomic_add_fetch_32(&pTask->status.timerActive, 1); + stDebug("s-task:%s start dispatch monitor tmr in %dms, dispatch code:%s", id, DISPATCH_RETRY_INTERVAL_MS, + tstrerror(code)); streamStartMonitorDispatchData(pTask, DISPATCH_RETRY_INTERVAL_MS); pTask->msgInfo.inMonitor = 1; } else { @@ -911,31 +938,31 @@ int32_t initCheckpointReadyMsg(SStreamTask* pTask, int32_t upstreamNodeId, int32 return TSDB_CODE_SUCCESS; } -static int32_t doTaskChkptStatusCheck(SStreamTask* pTask, int32_t num) { +static int32_t doTaskChkptStatusCheck(SStreamTask* pTask, void* param, int32_t num) { SActiveCheckpointInfo* pActiveInfo = pTask->chkInfo.pActiveInfo; SStreamTmrInfo* pTmrInfo = &pActiveInfo->chkptReadyMsgTmr; const char* id = pTask->id.idStr; int32_t vgId = pTask->pMeta->vgId; if (pTmrInfo->launchChkptId != pActiveInfo->activeId) { - int32_t ref = streamCleanBeforeQuitTmr(pTmrInfo, pTask); + streamCleanBeforeQuitTmr(pTmrInfo, param); stWarn("s-task:%s vgId:%d ready-msg send tmr launched by previous checkpoint procedure, checkpointId:%" PRId64 - ", quit, ref:%d", - id, vgId, pTmrInfo->launchChkptId, ref); + ", quit", + id, vgId, pTmrInfo->launchChkptId); return -1; } // active checkpoint info is cleared for now if ((pActiveInfo->activeId == 0) || (pActiveInfo->transId == 0) || (num == 0) || (pTask->chkInfo.startTs == 0)) { - int32_t ref = streamCleanBeforeQuitTmr(pTmrInfo, pTask); - stWarn("s-task:%s vgId:%d active checkpoint may be cleared, quit from readyMsg send tmr, ref:%d", id, vgId, ref); + streamCleanBeforeQuitTmr(pTmrInfo, param); + stWarn("s-task:%s vgId:%d active checkpoint may be cleared, quit from readyMsg send tmr", id, vgId); return -1; } if (taosArrayGetSize(pTask->upstreamInfo.pList) != num) { - int32_t ref = streamCleanBeforeQuitTmr(pTmrInfo, pTask); - stWarn("s-task:%s vgId:%d upstream number:%d not equals sent readyMsg:%d, quit from readyMsg send tmr, ref:%d", id, - vgId, (int32_t)taosArrayGetSize(pTask->upstreamInfo.pList), num, ref); + streamCleanBeforeQuitTmr(pTmrInfo, param); + stWarn("s-task:%s vgId:%d upstream number:%d not equals sent readyMsg:%d, quit from readyMsg send tmr", id, + vgId, (int32_t)taosArrayGetSize(pTask->upstreamInfo.pList), num); return -1; } @@ -1011,7 +1038,7 @@ static void doSendChkptReadyMsg(SStreamTask* pTask, SArray* pNotRspList, int64_t } } -static int32_t chkptReadyMsgSendHelper(SStreamTask* pTask, SArray* pNotRspList) { +static int32_t chkptReadyMsgSendHelper(SStreamTask* pTask, void* param, SArray* pNotRspList) { SActiveCheckpointInfo* pActiveInfo = pTask->chkInfo.pActiveInfo; SStreamTmrInfo* pTmrInfo = &pActiveInfo->chkptReadyMsgTmr; SArray* pList = pActiveInfo->pReadyMsgList; @@ -1021,16 +1048,15 @@ static int32_t chkptReadyMsgSendHelper(SStreamTask* pTask, SArray* pNotRspList) const char* id = pTask->id.idStr; int32_t notRsp = 0; - int32_t code = doTaskChkptStatusCheck(pTask, num); + int32_t code = doTaskChkptStatusCheck(pTask, param, num); if (code) { return code; } code = doFindNotConfirmUpstream(&pNotRspList, pList, num, vgId, pTask->info.taskLevel, id); if (code) { - int32_t ref = streamCleanBeforeQuitTmr(pTmrInfo, pTask); - stError("s-task:%s failed to find not rsp checkpoint-ready downstream, code:%s, out of tmr, ref:%d", id, - tstrerror(code), ref); + streamCleanBeforeQuitTmr(pTmrInfo, param); + stError("s-task:%s failed to find not rsp checkpoint-ready downstream, code:%s, out of tmr", id, tstrerror(code)); return code; } @@ -1045,26 +1071,41 @@ static int32_t chkptReadyMsgSendHelper(SStreamTask* pTask, SArray* pNotRspList) } static void chkptReadyMsgSendMonitorFn(void* param, void* tmrId) { - SStreamTask* pTask = param; - int32_t vgId = pTask->pMeta->vgId; - const char* id = pTask->id.idStr; - SActiveCheckpointInfo* pActiveInfo = pTask->chkInfo.pActiveInfo; - SStreamTmrInfo* pTmrInfo = &pActiveInfo->chkptReadyMsgTmr; SArray* pNotRspList = NULL; int32_t code = 0; int32_t notRsp = 0; + int64_t taskRefId = *(int64_t*)param; + int32_t vgId = -1; + const char* id = NULL; + SActiveCheckpointInfo* pActiveInfo = NULL; + SStreamTmrInfo* pTmrInfo = NULL; + + SStreamTask* pTask = taosAcquireRef(streamTaskRefPool, taskRefId); + if (pTask == NULL) { + stError("invalid task rid:%" PRId64 " failed to acquired stream-task", taskRefId); + streamTaskFreeRefId(param); + return; + } + + vgId = pTask->pMeta->vgId; + id = pTask->id.idStr; + pActiveInfo = pTask->chkInfo.pActiveInfo; + pTmrInfo = &pActiveInfo->chkptReadyMsgTmr; // check the status every 100ms if (streamTaskShouldStop(pTask)) { - int32_t ref = streamCleanBeforeQuitTmr(pTmrInfo, pTask); - stDebug("s-task:%s vgId:%d status:stop, quit from monitor checkpoint-trigger, ref:%d", id, vgId, ref); + streamCleanBeforeQuitTmr(pTmrInfo, param); + stDebug("s-task:%s vgId:%d status:stop, quit from monitor checkpoint-trigger", id, vgId); streamMetaReleaseTask(pTask->pMeta, pTask); + taosArrayDestroy(pNotRspList); return; } if (++pTmrInfo->activeCounter < 50) { - streamTmrStart(chkptReadyMsgSendMonitorFn, 200, pTask, streamTimer, &pTmrInfo->tmrHandle, vgId, + streamTmrStart(chkptReadyMsgSendMonitorFn, 200, param, streamTimer, &pTmrInfo->tmrHandle, vgId, "chkpt-ready-monitor"); + streamMetaReleaseTask(pTask->pMeta, pTask); + taosArrayDestroy(pNotRspList); return; } @@ -1078,15 +1119,16 @@ static void chkptReadyMsgSendMonitorFn(void* param, void* tmrId) { // 1. check status in the first place if (state.state != TASK_STATUS__CK) { - int32_t ref = streamCleanBeforeQuitTmr(pTmrInfo, pTask); - stDebug("s-task:%s vgId:%d status:%s not in checkpoint, quit from monitor checkpoint-ready, ref:%d", id, vgId, - state.name, ref); + streamCleanBeforeQuitTmr(pTmrInfo, param); + stDebug("s-task:%s vgId:%d status:%s not in checkpoint, quit from monitor checkpoint-ready", id, vgId, + state.name); streamMetaReleaseTask(pTask->pMeta, pTask); + taosArrayDestroy(pNotRspList); return; } streamMutexLock(&pActiveInfo->lock); - code = chkptReadyMsgSendHelper(pTask, pNotRspList); + code = chkptReadyMsgSendHelper(pTask, param, pNotRspList); streamMutexUnlock(&pActiveInfo->lock); if (code != TSDB_CODE_SUCCESS) { @@ -1098,18 +1140,18 @@ static void chkptReadyMsgSendMonitorFn(void* param, void* tmrId) { notRsp = taosArrayGetSize(pNotRspList); if (notRsp > 0) { // send checkpoint-ready msg again stDebug("s-task:%s start to monitor checkpoint-ready msg recv status in 10s", id); - streamTmrStart(chkptReadyMsgSendMonitorFn, 200, pTask, streamTimer, &pTmrInfo->tmrHandle, vgId, + streamTmrStart(chkptReadyMsgSendMonitorFn, 200, param, streamTimer, &pTmrInfo->tmrHandle, vgId, "chkpt-ready-monitor"); } else { - int32_t ref = streamCleanBeforeQuitTmr(pTmrInfo, pTask); + streamCleanBeforeQuitTmr(pTmrInfo, param); stDebug( "s-task:%s vgId:%d checkpoint-ready msg confirmed by all upstream task(s), clear checkpoint-ready msg and quit " - "from timer, ref:%d", - id, vgId, ref); - // release should be the last execution, since pTask may be destroy after it immidiately. - streamMetaReleaseTask(pTask->pMeta, pTask); + "from timer", + id, vgId); } + // release should be the last execution, since pTask may be destroyed after it immediately. + streamMetaReleaseTask(pTask->pMeta, pTask); taosArrayDestroy(pNotRspList); } @@ -1160,15 +1202,17 @@ int32_t streamTaskSendCheckpointReadyMsg(SStreamTask* pTask) { int8_t old = atomic_val_compare_exchange_8(&pTmrInfo->isActive, 0, 1); if (old == 0) { - int32_t ref = atomic_add_fetch_32(&pTask->status.timerActive, 1); - stDebug("s-task:%s start checkpoint-ready monitor in 10s, ref:%d ", pTask->id.idStr, ref); - int32_t unusedRetRef = streamMetaAcquireOneTask(pTask); + stDebug("s-task:%s start checkpoint-ready monitor in 10s", pTask->id.idStr); - streamTmrStart(chkptReadyMsgSendMonitorFn, 200, pTask, streamTimer, &pTmrInfo->tmrHandle, vgId, - "chkpt-ready-monitor"); + int64_t* pTaskRefId = NULL; + int32_t code = streamTaskAllocRefId(pTask, &pTaskRefId); + if (code == 0) { + streamTmrStart(chkptReadyMsgSendMonitorFn, 200, pTaskRefId, streamTimer, &pTmrInfo->tmrHandle, vgId, + "chkpt-ready-monitor"); - // mark the timer monitor checkpointId - pTmrInfo->launchChkptId = pActiveInfo->activeId; + // mark the timer monitor checkpointId + pTmrInfo->launchChkptId = pActiveInfo->activeId; + } } else { stError("s-task:%s previous checkpoint-ready monitor tmr is set, not start new one", pTask->id.idStr); } diff --git a/source/libs/stream/src/streamHb.c b/source/libs/stream/src/streamHb.c index 19391bf7a05f..96e853630ee9 100644 --- a/source/libs/stream/src/streamHb.c +++ b/source/libs/stream/src/streamHb.c @@ -21,7 +21,7 @@ #include "ttimer.h" #include "wal.h" -int32_t streamMetaId = 0; +int32_t streamMetaRefPool = 0; struct SMetaHbInfo { tmr_h hbTmr; @@ -123,17 +123,21 @@ int32_t streamMetaSendHbHelper(SStreamMeta* pMeta) { for(int32_t i = 0; i < numOfTasks; ++i) { SStreamTaskId* pId = taosArrayGet(pMeta->pTaskList, i); - STaskId id = {.streamId = pId->streamId, .taskId = pId->taskId}; - SStreamTask** pTask = taosHashGet(pMeta->pTasksMap, &id, sizeof(id)); - if (pTask == NULL) { + STaskId id = {.streamId = pId->streamId, .taskId = pId->taskId}; + SStreamTask* pTask = NULL; + + code = streamMetaAcquireTaskUnsafe(pMeta, &id, &pTask); + if (code != 0) { continue; } - if ((*pTask)->info.fillHistory == 1) { + if (pTask->info.fillHistory == 1) { + streamMetaReleaseTask(pMeta, pTask); continue; } - epsetAssign(&epset, &(*pTask)->info.mnodeEpset); + epsetAssign(&epset, &pTask->info.mnodeEpset); + streamMetaReleaseTask(pMeta, pTask); break; } @@ -159,28 +163,30 @@ int32_t streamMetaSendHbHelper(SStreamMeta* pMeta) { for (int32_t i = 0; i < numOfTasks; ++i) { SStreamTaskId* pId = taosArrayGet(pMeta->pTaskList, i); - STaskId id = {.streamId = pId->streamId, .taskId = pId->taskId}; - SStreamTask** pTask = taosHashGet(pMeta->pTasksMap, &id, sizeof(id)); - if (pTask == NULL) { + STaskId id = {.streamId = pId->streamId, .taskId = pId->taskId}; + SStreamTask* pTask = NULL; + code = streamMetaAcquireTaskUnsafe(pMeta, &id, &pTask); + if (code != 0) { continue; } // not report the status of fill-history task - if ((*pTask)->info.fillHistory == 1) { + if (pTask->info.fillHistory == 1) { + streamMetaReleaseTask(pMeta, pTask); continue; } - streamMutexLock(&(*pTask)->lock); - STaskStatusEntry entry = streamTaskGetStatusEntry(*pTask); - streamMutexUnlock(&(*pTask)->lock); + streamMutexLock(&pTask->lock); + STaskStatusEntry entry = streamTaskGetStatusEntry(pTask); + streamMutexUnlock(&pTask->lock); entry.inputRate = entry.inputQUsed * 100.0 / (2 * STREAM_TASK_QUEUE_CAPACITY_IN_SIZE); - if ((*pTask)->info.taskLevel == TASK_LEVEL__SINK) { - entry.sinkQuota = (*pTask)->outputInfo.pTokenBucket->quotaRate; - entry.sinkDataSize = SIZE_IN_MiB((*pTask)->execInfo.sink.dataSize); + if (pTask->info.taskLevel == TASK_LEVEL__SINK) { + entry.sinkQuota = pTask->outputInfo.pTokenBucket->quotaRate; + entry.sinkDataSize = SIZE_IN_MiB(pTask->execInfo.sink.dataSize); } - SActiveCheckpointInfo* p = (*pTask)->chkInfo.pActiveInfo; + SActiveCheckpointInfo* p = pTask->chkInfo.pActiveInfo; if (p->activeId != 0) { entry.checkpointInfo.failed = (p->failedId >= p->activeId) ? 1 : 0; entry.checkpointInfo.activeId = p->activeId; @@ -188,40 +194,42 @@ int32_t streamMetaSendHbHelper(SStreamMeta* pMeta) { if (entry.checkpointInfo.failed) { stInfo("s-task:%s set kill checkpoint trans in hbMsg, transId:%d, clear the active checkpointInfo", - (*pTask)->id.idStr, p->transId); + pTask->id.idStr, p->transId); - streamMutexLock(&(*pTask)->lock); - streamTaskClearCheckInfo((*pTask), true); - streamMutexUnlock(&(*pTask)->lock); + streamMutexLock(&pTask->lock); + streamTaskClearCheckInfo(pTask, true); + streamMutexUnlock(&pTask->lock); } } - streamMutexLock(&(*pTask)->lock); - entry.checkpointInfo.consensusChkptId = streamTaskCheckIfReqConsenChkptId(*pTask, pMsg->ts); + streamMutexLock(&pTask->lock); + entry.checkpointInfo.consensusChkptId = streamTaskCheckIfReqConsenChkptId(pTask, pMsg->ts); if (entry.checkpointInfo.consensusChkptId) { entry.checkpointInfo.consensusTs = pMsg->ts; } - streamMutexUnlock(&(*pTask)->lock); + streamMutexUnlock(&pTask->lock); - if ((*pTask)->exec.pWalReader != NULL) { - entry.processedVer = walReaderGetCurrentVer((*pTask)->exec.pWalReader) - 1; + if (pTask->exec.pWalReader != NULL) { + entry.processedVer = walReaderGetCurrentVer(pTask->exec.pWalReader) - 1; if (entry.processedVer < 0) { - entry.processedVer = (*pTask)->chkInfo.processedVer; + entry.processedVer = pTask->chkInfo.processedVer; } - walReaderValidVersionRange((*pTask)->exec.pWalReader, &entry.verRange.minVer, &entry.verRange.maxVer); + walReaderValidVersionRange(pTask->exec.pWalReader, &entry.verRange.minVer, &entry.verRange.maxVer); } - addUpdateNodeIntoHbMsg(*pTask, pMsg); + addUpdateNodeIntoHbMsg(pTask, pMsg); p = taosArrayPush(pMsg->pTaskStatus, &entry); if (p == NULL) { - stError("failed to add taskInfo:0x%x in hbMsg, vgId:%d", (*pTask)->id.taskId, pMeta->vgId); + stError("failed to add taskInfo:0x%x in hbMsg, vgId:%d", pTask->id.taskId, pMeta->vgId); } if (!hasMnodeEpset) { - epsetAssign(&epset, &(*pTask)->info.mnodeEpset); + epsetAssign(&epset, &pTask->info.mnodeEpset); hasMnodeEpset = true; } + + streamMetaReleaseTask(pMeta, pTask); } pMsg->numOfTasks = taosArrayGetSize(pMsg->pTaskStatus); @@ -244,9 +252,10 @@ void streamMetaHbToMnode(void* param, void* tmrId) { int32_t vgId = 0; int32_t role = 0; - SStreamMeta* pMeta = taosAcquireRef(streamMetaId, rid); + SStreamMeta* pMeta = taosAcquireRef(streamMetaRefPool, rid); if (pMeta == NULL) { - stError("invalid rid:%" PRId64 " failed to acquired stream-meta", rid); + stError("invalid meta rid:%" PRId64 " failed to acquired stream-meta", rid); +// taosMemoryFree(param); return; } @@ -256,24 +265,26 @@ void streamMetaHbToMnode(void* param, void* tmrId) { // need to stop, stop now if (pMeta->closeFlag) { pMeta->pHbInfo->hbStart = 0; - code = taosReleaseRef(streamMetaId, rid); + code = taosReleaseRef(streamMetaRefPool, rid); if (code == TSDB_CODE_SUCCESS) { stDebug("vgId:%d jump out of meta timer", vgId); } else { stError("vgId:%d jump out of meta timer, failed to release the meta rid:%" PRId64, vgId, rid); } +// taosMemoryFree(param); return; } // not leader not send msg if (pMeta->role != NODE_ROLE_LEADER) { pMeta->pHbInfo->hbStart = 0; - code = taosReleaseRef(streamMetaId, rid); + code = taosReleaseRef(streamMetaRefPool, rid); if (code == TSDB_CODE_SUCCESS) { stInfo("vgId:%d role:%d not leader not send hb to mnode", vgId, role); } else { stError("vgId:%d role:%d not leader not send hb to mnodefailed to release the meta rid:%" PRId64, vgId, role, rid); } +// taosMemoryFree(param); return; } @@ -281,7 +292,7 @@ void streamMetaHbToMnode(void* param, void* tmrId) { streamTmrStart(streamMetaHbToMnode, META_HB_CHECK_INTERVAL, param, streamTimer, &pMeta->pHbInfo->hbTmr, vgId, "meta-hb-tmr"); - code = taosReleaseRef(streamMetaId, rid); + code = taosReleaseRef(streamMetaRefPool, rid); if (code) { stError("vgId:%d in meta timer, failed to release the meta rid:%" PRId64, vgId, rid); } @@ -298,12 +309,13 @@ void streamMetaHbToMnode(void* param, void* tmrId) { if (code) { stError("vgId:%d failed to send hmMsg to mnode, try again in 5s, code:%s", pMeta->vgId, tstrerror(code)); } + streamMetaRUnLock(pMeta); streamTmrStart(streamMetaHbToMnode, META_HB_CHECK_INTERVAL, param, streamTimer, &pMeta->pHbInfo->hbTmr, pMeta->vgId, "meta-hb-tmr"); - code = taosReleaseRef(streamMetaId, rid); + code = taosReleaseRef(streamMetaRefPool, rid); if (code) { stError("vgId:%d in meta timer, failed to release the meta rid:%" PRId64, vgId, rid); } diff --git a/source/libs/stream/src/streamMeta.c b/source/libs/stream/src/streamMeta.c index 7e9b60b61a8b..db46934e47dd 100644 --- a/source/libs/stream/src/streamMeta.c +++ b/source/libs/stream/src/streamMeta.c @@ -13,7 +13,6 @@ * along with this program. If not, see . */ -#include "executor.h" #include "streamBackendRocksdb.h" #include "streamInt.h" #include "tmisce.h" @@ -28,6 +27,7 @@ static TdThreadOnce streamMetaModuleInit = PTHREAD_ONCE_INIT; int32_t streamBackendId = 0; int32_t streamBackendCfWrapperId = 0; int32_t taskDbWrapperId = 0; +int32_t streamTaskRefPool = 0; static int32_t streamMetaBegin(SStreamMeta* pMeta); static void streamMetaCloseImpl(void* arg); @@ -41,14 +41,14 @@ SMetaRefMgt gMetaRefMgt; int32_t metaRefMgtInit(); void metaRefMgtCleanup(); -int32_t metaRefMgtAdd(int64_t vgId, int64_t* rid); static void streamMetaEnvInit() { streamBackendId = taosOpenRef(64, streamBackendCleanup); streamBackendCfWrapperId = taosOpenRef(64, streamBackendHandleCleanup); taskDbWrapperId = taosOpenRef(64, taskDbDestroy2); - streamMetaId = taosOpenRef(64, streamMetaCloseImpl); + streamMetaRefPool = taosOpenRef(64, streamMetaCloseImpl); + streamTaskRefPool = taosOpenRef(64, tFreeStreamTask); int32_t code = metaRefMgtInit(); if (code) { @@ -72,7 +72,8 @@ void streamMetaInit() { void streamMetaCleanup() { taosCloseRef(streamBackendId); taosCloseRef(streamBackendCfWrapperId); - taosCloseRef(streamMetaId); + taosCloseRef(streamMetaRefPool); + taosCloseRef(streamTaskRefPool); metaRefMgtCleanup(); streamTimerCleanUp(); @@ -98,16 +99,21 @@ int32_t metaRefMgtInit() { void metaRefMgtCleanup() { void* pIter = taosHashIterate(gMetaRefMgt.pTable, NULL); while (pIter) { - SArray* list = *(SArray**)pIter; - for (int i = 0; i < taosArrayGetSize(list); i++) { - void* rid = taosArrayGetP(list, i); - taosMemoryFree(rid); - } - taosArrayDestroy(list); + int64_t* p = *(int64_t**) pIter; + stInfo("---------------free refId:%"PRId64", %p", *p, p); + + taosMemoryFree(p); + +// SArray* list = *(SArray**)pIter; +// for (int i = 0; i < taosArrayGetSize(list); i++) { +// void* rid = taosArrayGetP(list, i); +// taosMemoryFree(rid); +// } +// taosArrayDestroy(list); pIter = taosHashIterate(gMetaRefMgt.pTable, pIter); } - taosHashCleanup(gMetaRefMgt.pTable); + taosHashCleanup(gMetaRefMgt.pTable); streamMutexDestroy(&gMetaRefMgt.mutex); } @@ -117,35 +123,31 @@ int32_t metaRefMgtAdd(int64_t vgId, int64_t* rid) { streamMutexLock(&gMetaRefMgt.mutex); - p = taosHashGet(gMetaRefMgt.pTable, &vgId, sizeof(vgId)); + p = taosHashGet(gMetaRefMgt.pTable, &rid, sizeof(rid)); if (p == NULL) { - SArray* pList = taosArrayInit(8, POINTER_BYTES); - if (pList == NULL) { - return terrno; - } - - p = taosArrayPush(pList, &rid); - if (p == NULL) { - return terrno; - } - - code = taosHashPut(gMetaRefMgt.pTable, &vgId, sizeof(vgId), &pList, sizeof(void*)); + code = taosHashPut(gMetaRefMgt.pTable, &rid, sizeof(rid), &rid, sizeof(void*)); if (code) { stError("vgId:%d failed to put into metaRef table, rid:%" PRId64, (int32_t)vgId, *rid); return code; + } else { + stInfo("add refId:%"PRId64" vgId:%d, %p", *rid, (int32_t)vgId, rid); } } else { - SArray* list = *(SArray**)p; - void* px = taosArrayPush(list, &rid); - if (px == NULL) { - code = terrno; - } + // todo } streamMutexUnlock(&gMetaRefMgt.mutex); return code; } +void metaRefMgtRemove(int64_t* pRefId) { + streamMutexLock(&gMetaRefMgt.mutex); + + taosHashRemove(gMetaRefMgt.pTable, &pRefId, sizeof(pRefId)); + stInfo("remove refId from mgt, refId:%"PRId64", %p", *pRefId, pRefId); + streamMutexUnlock(&gMetaRefMgt.mutex); +} + int32_t streamMetaOpenTdb(SStreamMeta* pMeta) { if (tdbOpen(pMeta->path, 16 * 1024, 1, &pMeta->db, 0, 0, NULL) < 0) { stError("vgId:%d open file:%s failed, stream meta open failed", pMeta->vgId, pMeta->path); @@ -434,7 +436,7 @@ int32_t streamMetaOpen(const char* path, void* ahandle, FTaskBuild buildTaskFn, pMeta->closeFlag = false; stInfo("vgId:%d open stream meta succ, latest checkpoint:%" PRId64 ", stage:%" PRId64, vgId, pMeta->chkpId, stage); - pMeta->rid = taosAddRef(streamMetaId, pMeta); + pMeta->rid = taosAddRef(streamMetaRefPool, pMeta); // set the attribute when running on Linux OS TdThreadRwlockAttr attr; @@ -527,17 +529,20 @@ void streamMetaClear(SStreamMeta* pMeta) { // remove all existed tasks in this vnode void* pIter = NULL; while ((pIter = taosHashIterate(pMeta->pTasksMap, pIter)) != NULL) { - SStreamTask* p = *(SStreamTask**)pIter; + int64_t refId = *(int64_t*)pIter; + SStreamTask* p = taosAcquireRef(streamTaskRefPool, refId); + if (p == NULL) { + continue; + } // release the ref by timer if (p->info.delaySchedParam != 0 && p->info.fillHistory == 0) { // one more ref in timer stDebug("s-task:%s stop schedTimer, and (before) desc ref:%d", p->id.idStr, p->refCnt); streamTmrStop(p->schedInfo.pDelayTimer); p->info.delaySchedParam = 0; - streamMetaReleaseTask(pMeta, p); } - streamMetaReleaseTask(pMeta, p); + taosRemoveRef(streamTaskRefPool, refId); } if (pMeta->streamBackendRid != 0) { @@ -567,9 +572,9 @@ void streamMetaClose(SStreamMeta* pMeta) { if (pMeta == NULL) { return; } - int32_t code = taosRemoveRef(streamMetaId, pMeta->rid); + int32_t code = taosRemoveRef(streamMetaRefPool, pMeta->rid); if (code) { - stError("vgId:%d failed to remove ref:%" PRId64 ", code:%s", pMeta->vgId, pMeta->rid, tstrerror(code)); + stError("vgId:%d failed to remove meta ref:%" PRId64 ", code:%s", pMeta->vgId, pMeta->rid, tstrerror(code)); } } @@ -656,9 +661,16 @@ int32_t streamMetaSaveTask(SStreamMeta* pMeta, SStreamTask* pTask) { code = tdbTbUpsert(pMeta->pTaskDb, id, STREAM_TASK_KEY_LEN, buf, len, pMeta->txn); if (code != TSDB_CODE_SUCCESS) { code = terrno; - stError("s-task:%s vgId:%d task meta save to disk failed, code:%s", pTask->id.idStr, vgId, tstrerror(terrno)); + stError("s-task:%s vgId:%d refId:%" PRId64 " task meta save to disk failed, remove ref, code:%s", pTask->id.idStr, + vgId, pTask->id.refId, tstrerror(code)); + + int64_t refId = pTask->id.refId; + int32_t ret = taosRemoveRef(streamTaskRefPool, pTask->id.refId); + if (ret != 0) { + stError("s-task:0x%x failed to remove ref, refId:%"PRId64, (int32_t) id[1], refId); + } } else { - stDebug("s-task:%s vgId:%d task meta save to disk", pTask->id.idStr, vgId); + stDebug("s-task:%s vgId:%d refId:%" PRId64 " task meta save to disk", pTask->id.idStr, vgId, pTask->id.refId); } taosMemoryFree(buf); @@ -683,34 +695,47 @@ int32_t streamMetaRegisterTask(SStreamMeta* pMeta, int64_t ver, SStreamTask* pTa *pAdded = false; int32_t code = 0; + int64_t refId = 0; STaskId id = streamTaskGetTaskId(pTask); void* p = taosHashGet(pMeta->pTasksMap, &id, sizeof(id)); + if (p != NULL) { stDebug("s-task:%" PRIx64 " already exist in meta, no need to register", id.taskId); + tFreeStreamTask(pTask); return code; } if ((code = pMeta->buildTaskFn(pMeta->ahandle, pTask, ver)) != 0) { + tFreeStreamTask(pTask); return code; } p = taosArrayPush(pMeta->pTaskList, &pTask->id); if (p == NULL) { stError("s-task:0x%" PRIx64 " failed to register task into meta-list, code: out of memory", id.taskId); + tFreeStreamTask(pTask); return terrno; } - code = taosHashPut(pMeta->pTasksMap, &id, sizeof(id), &pTask, POINTER_BYTES); + pTask->id.refId = refId = taosAddRef(streamTaskRefPool, pTask); + code = taosHashPut(pMeta->pTasksMap, &id, sizeof(id), &pTask->id.refId, sizeof(int64_t)); if (code) { stError("s-task:0x%" PRIx64 " failed to register task into meta-list, code: out of memory", id.taskId); + + int32_t ret = taosRemoveRef(streamTaskRefPool, refId); + if (ret != 0) { + stError("s-task:0x%x failed to remove ref, refId:%"PRId64, (int32_t) id.taskId, refId); + } return code; } if ((code = streamMetaSaveTask(pMeta, pTask)) != 0) { + taosRemoveRef(streamTaskRefPool, refId); return code; } if ((code = streamMetaCommit(pMeta)) != 0) { + taosRemoveRef(streamTaskRefPool, refId); return code; } @@ -733,16 +758,72 @@ int32_t streamMetaGetNumOfTasks(SStreamMeta* pMeta) { } int32_t streamMetaAcquireTaskNoLock(SStreamMeta* pMeta, int64_t streamId, int32_t taskId, SStreamTask** pTask) { - STaskId id = {.streamId = streamId, .taskId = taskId}; - SStreamTask** ppTask = (SStreamTask**)taosHashGet(pMeta->pTasksMap, &id, sizeof(id)); - if (ppTask == NULL || streamTaskShouldStop(*ppTask)) { - *pTask = NULL; + QRY_PARAM_CHECK(pTask); + STaskId id = {.streamId = streamId, .taskId = taskId}; + int64_t* pTaskRefId = (int64_t*)taosHashGet(pMeta->pTasksMap, &id, sizeof(id)); + if (pTaskRefId == NULL) { + return TSDB_CODE_STREAM_TASK_NOT_EXIST; + } + + SStreamTask* p = taosAcquireRef(streamTaskRefPool, *pTaskRefId); + if (p == NULL) { + stDebug("s-task:%x failed to acquire task refId:%"PRId64", may have been destoried", taskId, *pTaskRefId); + return TSDB_CODE_STREAM_TASK_NOT_EXIST; + } + + if (p->id.refId != *pTaskRefId) { + stFatal("s-task:%x inconsistent refId, task refId:%" PRId64 " try acquire:%" PRId64, taskId, *pTaskRefId, + p->id.refId); + int32_t ret = taosReleaseRef(streamTaskRefPool, *pTaskRefId); + if (ret) { + stError("s-task:0x%x failed to release task refId:%" PRId64, taskId, *pTaskRefId); + } + return TSDB_CODE_STREAM_TASK_NOT_EXIST; } - int32_t ref = atomic_add_fetch_32(&(*ppTask)->refCnt, 1); - stTrace("s-task:%s acquire task, ref:%d", (*ppTask)->id.idStr, ref); - *pTask = *ppTask; + if (streamTaskShouldStop(p)) { + stDebug("s-task:%s is stopped, failed to acquire it now", p->id.idStr); + int32_t ret = taosReleaseRef(streamTaskRefPool, *pTaskRefId); + if (ret) { + stError("s-task:0x%x failed to release task refId:%" PRId64, taskId, *pTaskRefId); + } + return TSDB_CODE_STREAM_TASK_NOT_EXIST; + } + + stDebug("s-task:%s acquire task, refId:%" PRId64, p->id.idStr, p->id.refId); + *pTask = p; + return TSDB_CODE_SUCCESS; +} + +int32_t streamMetaAcquireTaskUnsafe(SStreamMeta* pMeta, STaskId* pId, SStreamTask** pTask) { + QRY_PARAM_CHECK(pTask); + int64_t* pTaskRefId = (int64_t*)taosHashGet(pMeta->pTasksMap, pId, sizeof(*pId)); + + if (pTaskRefId == NULL) { + return TSDB_CODE_STREAM_TASK_NOT_EXIST; + } + + SStreamTask* p = taosAcquireRef(streamTaskRefPool, *pTaskRefId); + if (p == NULL) { + stDebug("s-task:%" PRIx64 " failed to acquire task refId:%" PRId64 ", may have been destoried", pId->taskId, + *pTaskRefId); + return TSDB_CODE_STREAM_TASK_NOT_EXIST; + } + + if (p->id.refId != *pTaskRefId) { + stFatal("s-task:%" PRIx64 " inconsistent refId, task refId:%" PRId64 " try acquire:%" PRId64, pId->taskId, + *pTaskRefId, p->id.refId); + int32_t ret = taosReleaseRef(streamTaskRefPool, *pTaskRefId); + if (ret) { + stError("s-task:0x%" PRIx64 " failed to release task refId:%" PRId64, pId->taskId, *pTaskRefId); + } + + return TSDB_CODE_STREAM_TASK_NOT_EXIST; + } + + stDebug("s-task:%s acquire task, refId:%" PRId64, p->id.idStr, p->id.refId); + *pTask = p; return TSDB_CODE_SUCCESS; } @@ -753,28 +834,17 @@ int32_t streamMetaAcquireTask(SStreamMeta* pMeta, int64_t streamId, int32_t task return code; } -int32_t streamMetaAcquireOneTask(SStreamTask* pTask) { - int32_t ref = atomic_add_fetch_32(&pTask->refCnt, 1); - stTrace("s-task:%s acquire task, ref:%d", pTask->id.idStr, ref); - return ref; -} - void streamMetaReleaseTask(SStreamMeta* UNUSED_PARAM(pMeta), SStreamTask* pTask) { if (pTask == NULL) { return; } int32_t taskId = pTask->id.taskId; - int32_t ref = atomic_sub_fetch_32(&pTask->refCnt, 1); - - // not safe to use the pTask->id.idStr, since pTask may be released by other threads when print logs. - if (ref > 0) { - stTrace("s-task:0x%x release task, ref:%d", taskId, ref); - } else if (ref == 0) { - stTrace("s-task:0x%x all refs are gone, free it", taskId); - tFreeStreamTask(pTask); - } else if (ref < 0) { - stError("task ref is invalid, ref:%d, 0x%x", ref, taskId); + int64_t refId = pTask->id.refId; + stDebug("s-task:0x%x release task, refId:%" PRId64, taskId, pTask->id.refId); + int32_t ret = taosReleaseRef(streamTaskRefPool, pTask->id.refId); + if (ret) { + stError("s-task:0x%x failed to release task refId:%" PRId64, taskId, refId); } } @@ -812,13 +882,10 @@ int32_t streamMetaUnregisterTask(SStreamMeta* pMeta, int64_t streamId, int32_t t int32_t code = 0; STaskId id = {.streamId = streamId, .taskId = taskId}; - // pre-delete operation streamMetaWLock(pMeta); - SStreamTask** ppTask = (SStreamTask**)taosHashGet(pMeta->pTasksMap, &id, sizeof(id)); - if (ppTask) { - pTask = *ppTask; - + code = streamMetaAcquireTaskUnsafe(pMeta, &id, &pTask); + if (code == 0) { // desc the paused task counter if (streamTaskShouldPause(pTask)) { int32_t num = atomic_sub_fetch_32(&pMeta->numOfPausedTasks, 1); @@ -830,43 +897,9 @@ int32_t streamMetaUnregisterTask(SStreamMeta* pMeta, int64_t streamId, int32_t t if (code) { stError("s-task:0x%" PRIx64 " failed to handle dropping event async, code:%s", id.taskId, tstrerror(code)); } - } else { - stDebug("vgId:%d failed to find the task:0x%x, it may be dropped already", vgId, taskId); - streamMetaWUnLock(pMeta); - return 0; - } - - streamMetaWUnLock(pMeta); - - stDebug("s-task:0x%x vgId:%d set task status:dropping and start to unregister it", taskId, vgId); - - while (1) { - int32_t timerActive = 0; - - streamMetaRLock(pMeta); - ppTask = (SStreamTask**)taosHashGet(pMeta->pTasksMap, &id, sizeof(id)); - if (ppTask) { - // to make sure check status will not start the check downstream status when we start to check timerActive count. - streamMutexLock(&pTask->taskCheckInfo.checkInfoLock); - timerActive = (*ppTask)->status.timerActive; - streamMutexUnlock(&pTask->taskCheckInfo.checkInfoLock); - } - streamMetaRUnLock(pMeta); - - if (timerActive > 0) { - taosMsleep(100); - stDebug("s-task:0x%" PRIx64 " wait for quit from timer", id.taskId); - } else { - break; - } - } - // let's do delete of stream task - streamMetaWLock(pMeta); + stDebug("s-task:0x%x vgId:%d set task status:dropping and start to unregister it", taskId, vgId); - ppTask = (SStreamTask**)taosHashGet(pMeta->pTasksMap, &id, sizeof(id)); - if (ppTask) { - pTask = *ppTask; // it is a fill-history task, remove the related stream task's id that points to it if (pTask->info.fillHistory == 0) { int32_t ret = atomic_sub_fetch_32(&pMeta->numOfStreamTasks, 1); @@ -884,21 +917,22 @@ int32_t streamMetaUnregisterTask(SStreamMeta* pMeta, int64_t streamId, int32_t t if (sizeInList != size) { stError("vgId:%d tasks number not consistent in list:%d and map:%d, ", vgId, sizeInList, size); } - streamMetaWUnLock(pMeta); - - int32_t numOfTmr = pTask->status.timerActive; - if (numOfTmr != 0) { - stError("s-task:%s vgId:%d invalid timer Active record:%d, internal error", pTask->id.idStr, vgId, numOfTmr); - } if (pTask->info.delaySchedParam != 0 && pTask->info.fillHistory == 0) { stDebug("s-task:%s stop schedTimer, and (before) desc ref:%d", pTask->id.idStr, pTask->refCnt); streamTmrStop(pTask->schedInfo.pDelayTimer); pTask->info.delaySchedParam = 0; - streamMetaReleaseTask(pMeta, pTask); + } + + + int64_t refId = pTask->id.refId; + int32_t ret = taosRemoveRef(streamTaskRefPool, refId); + if (ret != 0) { + stError("s-task:0x%x failed to remove ref, refId:%"PRId64, (int32_t) id.taskId, refId); } streamMetaReleaseTask(pMeta, pTask); + streamMetaWUnLock(pMeta); } else { stDebug("vgId:%d failed to find the task:0x%x, it may have been dropped already", vgId, taskId); streamMetaWUnLock(pMeta); @@ -1008,13 +1042,13 @@ void streamMetaLoadAllTasks(SStreamMeta* pMeta) { return; } + vgId = pMeta->vgId; pRecycleList = taosArrayInit(4, sizeof(STaskId)); if (pRecycleList == NULL) { stError("vgId:%d failed prepare load all tasks, code:out of memory", vgId); return; } - vgId = pMeta->vgId; stInfo("vgId:%d load stream tasks from meta files", vgId); code = tdbTbcOpen(pMeta->pTaskDb, &pCur, NULL); @@ -1058,9 +1092,9 @@ void streamMetaLoadAllTasks(SStreamMeta* pMeta) { if (pTask->status.taskStatus == TASK_STATUS__DROPPING) { int32_t taskId = pTask->id.taskId; - tFreeStreamTask(pTask); - STaskId id = streamTaskGetTaskId(pTask); + + tFreeStreamTask(pTask); void* px = taosArrayPush(pRecycleList, &id); if (px == NULL) { stError("s-task:0x%x failed record the task into recycle list due to out of memory", taskId); @@ -1096,13 +1130,22 @@ void streamMetaLoadAllTasks(SStreamMeta* pMeta) { continue; } - if (taosHashPut(pMeta->pTasksMap, &id, sizeof(id), &pTask, POINTER_BYTES) != 0) { - stError("s-task:0x%x failed to put into hashTable, code:%s, continue", pTask->id.taskId, tstrerror(terrno)); - void* px = taosArrayPop(pMeta->pTaskList); - tFreeStreamTask(pTask); + pTask->id.refId = taosAddRef(streamTaskRefPool, pTask); + + if (taosHashPut(pMeta->pTasksMap, &id, sizeof(id), &pTask->id.refId, sizeof(int64_t)) != 0) { + int64_t refId = pTask->id.refId; + stError("s-task:0x%x failed to put into hashTable, code:%s, remove task ref, refId:%" PRId64 " continue", + pTask->id.taskId, tstrerror(terrno), refId); + + void* px = taosArrayPop(pMeta->pTaskList); + int32_t ret = taosRemoveRef(streamTaskRefPool, refId); + if (ret != 0) { + stError("s-task:0x%x failed to remove ref, refId:%" PRId64, (int32_t)id.taskId, refId); + } continue; } + stInfo("s-task:0x%x vgId:%d set refId:%"PRId64, (int32_t) id.taskId, vgId, pTask->id.refId); if (pTask->info.fillHistory == 0) { int32_t val = atomic_add_fetch_32(&pMeta->numOfStreamTasks, 1); } @@ -1138,72 +1181,22 @@ void streamMetaLoadAllTasks(SStreamMeta* pMeta) { } } -bool streamMetaTaskInTimer(SStreamMeta* pMeta) { - bool inTimer = false; - streamMetaRLock(pMeta); - - void* pIter = NULL; - while (1) { - pIter = taosHashIterate(pMeta->pTasksMap, pIter); - if (pIter == NULL) { - break; - } - - SStreamTask* pTask = *(SStreamTask**)pIter; - if (pTask->status.timerActive >= 1) { - stDebug("s-task:%s in timer, blocking tasks in vgId:%d restart, set closing again", pTask->id.idStr, pMeta->vgId); - int32_t code = streamTaskStop(pTask); - if (code) { - stError("s-task:%s failed to stop task, code:%s", pTask->id.idStr, tstrerror(code)); - } - inTimer = true; - } - } - - streamMetaRUnLock(pMeta); - return inTimer; -} - void streamMetaNotifyClose(SStreamMeta* pMeta) { int32_t vgId = pMeta->vgId; int64_t startTs = 0; int32_t sendCount = 0; - streamMetaGetHbSendInfo(pMeta->pHbInfo, &startTs, &sendCount); + streamMetaGetHbSendInfo(pMeta->pHbInfo, &startTs, &sendCount); stInfo("vgId:%d notify all stream tasks that current vnode is closing. isLeader:%d startHb:%" PRId64 ", totalHb:%d", vgId, (pMeta->role == NODE_ROLE_LEADER), startTs, sendCount); // wait for the stream meta hb function stopping streamMetaWaitForHbTmrQuit(pMeta); - - streamMetaWLock(pMeta); - pMeta->closeFlag = true; - void* pIter = NULL; - while (1) { - pIter = taosHashIterate(pMeta->pTasksMap, pIter); - if (pIter == NULL) { - break; - } - - SStreamTask* pTask = *(SStreamTask**)pIter; - stDebug("vgId:%d s-task:%s set task closing flag", vgId, pTask->id.idStr); - int32_t code = streamTaskStop(pTask); - if (code) { - stError("vgId:%d failed to stop task:0x%x, code:%s", vgId, pTask->id.taskId, tstrerror(code)); - } - } - - streamMetaWUnLock(pMeta); stDebug("vgId:%d start to check all tasks for closing", vgId); int64_t st = taosGetTimestampMs(); - while (streamMetaTaskInTimer(pMeta)) { - stDebug("vgId:%d some tasks in timer, wait for 100ms and recheck", pMeta->vgId); - taosMsleep(100); - } - streamMetaRLock(pMeta); SArray* pTaskList = NULL; @@ -1211,14 +1204,34 @@ void streamMetaNotifyClose(SStreamMeta* pMeta) { if (code != TSDB_CODE_SUCCESS) { } - streamMetaRUnLock(pMeta); + int32_t numOfTasks = taosArrayGetSize(pTaskList); + for (int32_t i = 0; i < numOfTasks; ++i) { + SStreamTaskId* pTaskId = taosArrayGet(pTaskList, i); + SStreamTask* pTask = NULL; + + code = streamMetaAcquireTaskNoLock(pMeta, pTaskId->streamId, pTaskId->taskId, &pTask); + if (code != TSDB_CODE_SUCCESS) { + continue; + } - if (pTaskList != NULL) { - taosArrayDestroy(pTaskList); + int64_t refId = pTask->id.refId; + int32_t ret = streamTaskStop(pTask); + if (ret) { + stError("s-task:0x%x failed to stop task, code:%s", pTaskId->taskId, tstrerror(ret)); + } + + streamMetaReleaseTask(pMeta, pTask); + ret = taosRemoveRef(streamTaskRefPool, refId); + if (ret) { + stError("vgId:%d failed to remove task:0x%x, refId:%"PRId64, pMeta->vgId, pTaskId->taskId, refId); + } } - int64_t el = taosGetTimestampMs() - st; - stDebug("vgId:%d all stream tasks are not in timer, continue close, elapsed time:%" PRId64 " ms", pMeta->vgId, el); + taosArrayDestroy(pTaskList); + + double el = (taosGetTimestampMs() - st) / 1000.0; + stDebug("vgId:%d stop all %d task(s) completed, elapsed time:%.2f Sec.", pMeta->vgId, numOfTasks, el); + streamMetaRUnLock(pMeta); } void streamMetaStartHb(SStreamMeta* pMeta) { @@ -1228,12 +1241,12 @@ void streamMetaStartHb(SStreamMeta* pMeta) { return; } + *pRid = pMeta->rid; int32_t code = metaRefMgtAdd(pMeta->vgId, pRid); if (code) { return; } - *pRid = pMeta->rid; streamMetaHbToMnode(pRid, NULL); } @@ -1308,13 +1321,15 @@ bool streamMetaAllTasksReady(const SStreamMeta* pMeta) { for (int32_t i = 0; i < num; ++i) { SStreamTaskId* pId = taosArrayGet(pMeta->pTaskList, i); STaskId id = {.streamId = pId->streamId, .taskId = pId->taskId}; - SStreamTask** ppTask = taosHashGet(pMeta->pTasksMap, &id, sizeof(id)); - if (ppTask == NULL) { - continue; - } + SStreamTask* pTask = NULL; + int32_t code = streamMetaAcquireTaskUnsafe((SStreamMeta*)pMeta, &id, &pTask); - if ((*ppTask)->status.downstreamReady == 0) { - return false; + if (code == 0) { + if (pTask->status.downstreamReady == 0) { + streamMetaReleaseTask((SStreamMeta*)pMeta, pTask); + return false; + } + streamMetaReleaseTask((SStreamMeta*)pMeta, pTask); } } @@ -1331,10 +1346,13 @@ int32_t streamMetaResetTaskStatus(SStreamMeta* pMeta) { for (int32_t i = 0; i < numOfTasks; ++i) { SStreamTaskId* pTaskId = taosArrayGet(pMeta->pTaskList, i); - - STaskId id = {.streamId = pTaskId->streamId, .taskId = pTaskId->taskId}; - SStreamTask** pTask = taosHashGet(pMeta->pTasksMap, &id, sizeof(id)); - streamTaskResetStatus(*pTask); + STaskId id = {.streamId = pTaskId->streamId, .taskId = pTaskId->taskId}; + SStreamTask* pTask = NULL; + int32_t code = streamMetaAcquireTaskUnsafe(pMeta, &id, &pTask); + if (code == 0) { + streamTaskResetStatus(pTask); + streamMetaReleaseTask(pMeta, pTask); + } } return 0; @@ -1343,7 +1361,7 @@ int32_t streamMetaResetTaskStatus(SStreamMeta* pMeta) { void streamMetaAddIntoUpdateTaskList(SStreamMeta* pMeta, SStreamTask* pTask, SStreamTask* pHTask, int32_t transId, int64_t startTs) { const char* id = pTask->id.idStr; - int32_t vgId = pTask->pMeta->vgId; + int32_t vgId = pMeta->vgId; int32_t code = 0; // keep the already updated info diff --git a/source/libs/stream/src/streamSched.c b/source/libs/stream/src/streamSched.c index cdaa603e3864..7c77797ef94b 100644 --- a/source/libs/stream/src/streamSched.c +++ b/source/libs/stream/src/streamSched.c @@ -22,13 +22,13 @@ static void streamTaskSchedHelper(void* param, void* tmrId); void streamSetupScheduleTrigger(SStreamTask* pTask) { int64_t delaySchema = pTask->info.delaySchedParam; if (delaySchema != 0 && pTask->info.fillHistory == 0) { - int32_t ref = streamMetaAcquireOneTask(pTask); - stDebug("s-task:%s setup scheduler trigger, ref:%d delay:%" PRId64 " ms", pTask->id.idStr, ref, - pTask->info.delaySchedParam); - - streamTmrStart(streamTaskSchedHelper, (int32_t)delaySchema, pTask, streamTimer, &pTask->schedInfo.pDelayTimer, - pTask->pMeta->vgId, "sched-tmr"); - pTask->schedInfo.status = TASK_TRIGGER_STATUS__INACTIVE; + int64_t* pTaskRefId = NULL; + int32_t code = streamTaskAllocRefId(pTask, &pTaskRefId); + if (code == 0) { + streamTmrStart(streamTaskSchedHelper, (int32_t)delaySchema, pTaskRefId, streamTimer, + &pTask->schedInfo.pDelayTimer, pTask->pMeta->vgId, "sched-tmr"); + pTask->schedInfo.status = TASK_TRIGGER_STATUS__INACTIVE; + } } } @@ -75,49 +75,65 @@ void streamTaskClearSchedIdleInfo(SStreamTask* pTask) { pTask->status.schedIdleT void streamTaskSetIdleInfo(SStreamTask* pTask, int32_t idleTime) { pTask->status.schedIdleTime = idleTime; } void streamTaskResumeInFuture(SStreamTask* pTask) { - int32_t ref = atomic_add_fetch_32(&pTask->status.timerActive, 1); - stDebug("s-task:%s task should idle, add into timer to retry in %dms, ref:%d", pTask->id.idStr, - pTask->status.schedIdleTime, ref); + stDebug("s-task:%s task should idle, add into timer to retry in %dms", pTask->id.idStr, + pTask->status.schedIdleTime); // add one ref count for task - int32_t unusedRetRef = streamMetaAcquireOneTask(pTask); - streamTmrStart(streamTaskResumeHelper, pTask->status.schedIdleTime, pTask, streamTimer, &pTask->schedInfo.pIdleTimer, - pTask->pMeta->vgId, "resume-task-tmr"); + int64_t* pTaskRefId = NULL; + int32_t code = streamTaskAllocRefId(pTask, &pTaskRefId); + if (code == 0) { + streamTmrStart(streamTaskResumeHelper, pTask->status.schedIdleTime, pTaskRefId, streamTimer, + &pTask->schedInfo.pIdleTimer, pTask->pMeta->vgId, "resume-task-tmr"); + } } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void streamTaskResumeHelper(void* param, void* tmrId) { - SStreamTask* pTask = (SStreamTask*)param; + int32_t code = 0; + int64_t taskRefId = *(int64_t*)param; + SStreamTask* pTask = taosAcquireRef(streamTaskRefPool, taskRefId); + if (pTask == NULL) { + stError("invalid task rid:%" PRId64 " failed to acquired stream-task", taskRefId); + streamTaskFreeRefId(param); + return; + } + SStreamTaskId* pId = &pTask->id; SStreamTaskState p = streamTaskGetStatus(pTask); - int32_t code = 0; if (p.state == TASK_STATUS__DROPPING || p.state == TASK_STATUS__STOP) { int8_t status = streamTaskSetSchedStatusInactive(pTask); TAOS_UNUSED(status); - int32_t ref = atomic_sub_fetch_32(&pTask->status.timerActive, 1); - stDebug("s-task:%s status:%s not resume task, ref:%d", pId->idStr, p.name, ref); - + stDebug("s-task:%s status:%s not resume task", pId->idStr, p.name); streamMetaReleaseTask(pTask->pMeta, pTask); + streamTaskFreeRefId(param); return; } code = streamTaskSchedTask(pTask->pMsgCb, pTask->info.nodeId, pId->streamId, pId->taskId, STREAM_EXEC_T_RESUME_TASK); - int32_t ref = atomic_sub_fetch_32(&pTask->status.timerActive, 1); if (code) { - stError("s-task:%s sched task failed, code:%s, ref:%d", pId->idStr, tstrerror(code), ref); + stError("s-task:%s sched task failed, code:%s", pId->idStr, tstrerror(code)); } else { - stDebug("trigger to resume s-task:%s after idled for %dms, ref:%d", pId->idStr, pTask->status.schedIdleTime, ref); + stDebug("trigger to resume s-task:%s after idled for %dms", pId->idStr, pTask->status.schedIdleTime); // release the task ref count streamTaskClearSchedIdleInfo(pTask); - streamMetaReleaseTask(pTask->pMeta, pTask); } + + streamMetaReleaseTask(pTask->pMeta, pTask); + streamTaskFreeRefId(param); } void streamTaskSchedHelper(void* param, void* tmrId) { - SStreamTask* pTask = (void*)param; + int64_t taskRefId = *(int64_t*)param; + SStreamTask* pTask = taosAcquireRef(streamTaskRefPool, taskRefId); + if (pTask == NULL) { + stError("invalid task rid:%" PRId64 " failed to acquired stream-task", taskRefId); + streamTaskFreeRefId(param); + return; + } + const char* id = pTask->id.idStr; int32_t nextTrigger = (int32_t)pTask->info.delaySchedParam; int32_t vgId = pTask->pMeta->vgId; @@ -127,6 +143,8 @@ void streamTaskSchedHelper(void* param, void* tmrId) { if (streamTaskShouldStop(pTask) || streamTaskShouldPause(pTask)) { stDebug("s-task:%s should stop, jump out of schedTimer", id); + streamMetaReleaseTask(pTask->pMeta, pTask); + streamTaskFreeRefId(param); return; } @@ -171,6 +189,7 @@ void streamTaskSchedHelper(void* param, void* tmrId) { } _end: - streamTmrStart(streamTaskSchedHelper, nextTrigger, pTask, streamTimer, &pTask->schedInfo.pDelayTimer, vgId, + streamTmrStart(streamTaskSchedHelper, nextTrigger, param, streamTimer, &pTask->schedInfo.pDelayTimer, vgId, "sched-run-tmr"); + streamMetaReleaseTask(pTask->pMeta, pTask); } diff --git a/source/libs/stream/src/streamStartHistory.c b/source/libs/stream/src/streamStartHistory.c index 4d7bf2ba8759..54026f5db2cf 100644 --- a/source/libs/stream/src/streamStartHistory.c +++ b/source/libs/stream/src/streamStartHistory.c @@ -15,6 +15,7 @@ #include "streamInt.h" #include "streamsm.h" +#include "tref.h" #include "trpc.h" #include "ttimer.h" #include "wal.h" @@ -24,7 +25,7 @@ #define SCANHISTORY_IDLE_TICK ((SCANHISTORY_MAX_IDLE_TIME * 1000) / SCANHISTORY_IDLE_TIME_SLICE) typedef struct SLaunchHTaskInfo { - SStreamMeta* pMeta; + int64_t metaRid; STaskId id; STaskId hTaskId; } SLaunchHTaskInfo; @@ -89,7 +90,7 @@ void streamExecScanHistoryInFuture(SStreamTask* pTask, int32_t idleDuration) { // add ref for task SStreamTask* p = NULL; - int32_t code = streamMetaAcquireTask(pTask->pMeta, pTask->id.streamId, pTask->id.taskId, &p); + int32_t code = streamMetaAcquireTask(pTask->pMeta, pTask->id.streamId, pTask->id.taskId, &p); if (p == NULL || code != 0) { stError("s-task:0x%x failed to acquire task, status:%s, not exec scan-history data", pTask->id.taskId, streamTaskGetStatus(pTask).name); @@ -98,10 +99,13 @@ void streamExecScanHistoryInFuture(SStreamTask* pTask, int32_t idleDuration) { pTask->schedHistoryInfo.numOfTicks = numOfTicks; - int32_t ref = atomic_add_fetch_32(&pTask->status.timerActive, 1); - stDebug("s-task:%s scan-history resumed in %.2fs, ref:%d", pTask->id.idStr, numOfTicks * 0.1, ref); - streamTmrStart(doExecScanhistoryInFuture, SCANHISTORY_IDLE_TIME_SLICE, pTask, streamTimer, - &pTask->schedHistoryInfo.pTimer, vgId, "history-task"); + stDebug("s-task:%s scan-history resumed in %.2fs", pTask->id.idStr, numOfTicks * 0.1); + int64_t* pTaskRefId = NULL; + int32_t ret = streamTaskAllocRefId(pTask, &pTaskRefId); + if (ret == 0) { + streamTmrStart(doExecScanhistoryInFuture, SCANHISTORY_IDLE_TIME_SLICE, pTaskRefId, streamTimer, + &pTask->schedHistoryInfo.pTimer, vgId, "history-task"); + } } int32_t streamTaskStartScanHistory(SStreamTask* pTask) { @@ -220,42 +224,32 @@ int32_t streamLaunchFillHistoryTask(SStreamTask* pTask) { // Set the execution conditions, including the query time window and the version range streamMetaRLock(pMeta); - SStreamTask** pHTask = taosHashGet(pMeta->pTasksMap, &pTask->hTaskInfo.id, sizeof(pTask->hTaskInfo.id)); + SStreamTask* pHisTask = NULL; + code = streamMetaAcquireTaskUnsafe(pMeta, &pTask->hTaskInfo.id, &pHisTask); streamMetaRUnLock(pMeta); - if (pHTask != NULL) { // it is already added into stream meta store. - SStreamTask* pHisTask = NULL; - code = streamMetaAcquireTask(pMeta, hStreamId, hTaskId, &pHisTask); - if (pHisTask == NULL) { - stDebug("s-task:%s failed acquire and start fill-history task, it may have been dropped/stopped", idStr); - code = streamMetaAddTaskLaunchResult(pMeta, hStreamId, hTaskId, pExecInfo->checkTs, pExecInfo->readyTs, false); + if (code == 0) { // it is already added into stream meta store. + if (pHisTask->status.downstreamReady == 1) { // it's ready now, do nothing + stDebug("s-task:%s fill-history task is ready, no need to check downstream", pHisTask->id.idStr); + code = streamMetaAddTaskLaunchResult(pMeta, hStreamId, hTaskId, pExecInfo->checkTs, pExecInfo->readyTs, true); if (code) { stError("s-task:%s failed to record start task status, code:%s", idStr, tstrerror(code)); } - } else { - if (pHisTask->status.downstreamReady == 1) { // it's ready now, do nothing - stDebug("s-task:%s fill-history task is ready, no need to check downstream", pHisTask->id.idStr); - code = streamMetaAddTaskLaunchResult(pMeta, hStreamId, hTaskId, pExecInfo->checkTs, pExecInfo->readyTs, true); - if (code) { - stError("s-task:%s failed to record start task status, code:%s", idStr, tstrerror(code)); - } - } else { // exist, but not ready, continue check downstream task status - if (pHisTask->pBackend == NULL) { - code = pMeta->expandTaskFn(pHisTask); - if (code != TSDB_CODE_SUCCESS) { - streamMetaAddFailedTaskSelf(pHisTask, now); - stError("s-task:%s failed to expand fill-history task, code:%s", pHisTask->id.idStr, tstrerror(code)); - } - } - - if (code == TSDB_CODE_SUCCESS) { - checkFillhistoryTaskStatus(pTask, pHisTask); + } else { // exist, but not ready, continue check downstream task status + if (pHisTask->pBackend == NULL) { + code = pMeta->expandTaskFn(pHisTask); + if (code != TSDB_CODE_SUCCESS) { + streamMetaAddFailedTaskSelf(pHisTask, now); + stError("s-task:%s failed to expand fill-history task, code:%s", pHisTask->id.idStr, tstrerror(code)); } } - streamMetaReleaseTask(pMeta, pHisTask); + if (code == TSDB_CODE_SUCCESS) { + checkFillhistoryTaskStatus(pTask, pHisTask); + } } + streamMetaReleaseTask(pMeta, pHisTask); return code; } else { return launchNotBuiltFillHistoryTask(pTask); @@ -296,14 +290,14 @@ void notRetryLaunchFillHistoryTask(SStreamTask* pTask, SLaunchHTaskInfo* pInfo, SStreamMeta* pMeta = pTask->pMeta; SHistoryTaskInfo* pHTaskInfo = &pTask->hTaskInfo; - int32_t ref = atomic_sub_fetch_32(&pTask->status.timerActive, 1); +// int32_t ref = atomic_sub_fetch_32(&pTask->status.timerActive, 1); int32_t code = streamMetaAddTaskLaunchResult(pMeta, pInfo->hTaskId.streamId, pInfo->hTaskId.taskId, 0, now, false); if (code) { stError("s-task:%s failed to record the start task status, code:%s", pTask->id.idStr, tstrerror(code)); } else { - stError("s-task:%s max retry:%d reached, quit from retrying launch related fill-history task:0x%x, ref:%d", - pTask->id.idStr, MAX_RETRY_LAUNCH_HISTORY_TASK, (int32_t)pHTaskInfo->id.taskId, ref); + stError("s-task:%s max retry:%d reached, quit from retrying launch related fill-history task:0x%x", + pTask->id.idStr, MAX_RETRY_LAUNCH_HISTORY_TASK, (int32_t)pHTaskInfo->id.taskId); } pHTaskInfo->id.taskId = 0; @@ -315,9 +309,9 @@ void doRetryLaunchFillHistoryTask(SStreamTask* pTask, SLaunchHTaskInfo* pInfo, i SHistoryTaskInfo* pHTaskInfo = &pTask->hTaskInfo; if (streamTaskShouldStop(pTask)) { // record the failure - int32_t ref = atomic_sub_fetch_32(&pTask->status.timerActive, 1); - stDebug("s-task:0x%" PRIx64 " stopped, not launch rel history task:0x%" PRIx64 ", ref:%d", pInfo->id.taskId, - pInfo->hTaskId.taskId, ref); +// int32_t ref = atomic_sub_fetch_32(&pTask->status.timerActive, 1); + stDebug("s-task:0x%" PRIx64 " stopped, not launch rel history task:0x%" PRIx64, pInfo->id.taskId, + pInfo->hTaskId.taskId); int32_t code = streamMetaAddTaskLaunchResult(pMeta, pInfo->hTaskId.streamId, pInfo->hTaskId.taskId, 0, now, false); if (code) { @@ -336,30 +330,60 @@ void doRetryLaunchFillHistoryTask(SStreamTask* pTask, SLaunchHTaskInfo* pInfo, i } } +static void doCleanup(SStreamTask* pTask, int64_t metaRid, SLaunchHTaskInfo* pInfo) { + SStreamMeta* pMeta = pTask->pMeta; + int32_t vgId = pMeta->vgId; + + streamMetaReleaseTask(pMeta, pTask); + int32_t ret = taosReleaseRef(streamMetaRefPool, metaRid); + if (ret) { + stError("vgId:%d failed to release meta refId:%"PRId64, vgId, metaRid); + } + + if (pInfo != NULL) { + taosMemoryFree(pInfo); + } +} + void tryLaunchHistoryTask(void* param, void* tmrId) { SLaunchHTaskInfo* pInfo = param; - SStreamMeta* pMeta = pInfo->pMeta; + int64_t metaRid = pInfo->metaRid; int64_t now = taosGetTimestampMs(); int32_t code = 0; + SStreamTask* pTask = NULL; + int32_t vgId = 0; + + SStreamMeta* pMeta = taosAcquireRef(streamMetaRefPool, metaRid); + if (pMeta == NULL) { + stError("invalid meta rid:%" PRId64 " failed to acquired stream-meta", metaRid); + taosMemoryFree(pInfo); + return; + } + + vgId = pMeta->vgId; streamMetaWLock(pMeta); - SStreamTask** ppTask = (SStreamTask**)taosHashGet(pMeta->pTasksMap, &pInfo->id, sizeof(pInfo->id)); - if (ppTask == NULL || *ppTask == NULL) { + code = streamMetaAcquireTaskUnsafe(pMeta, &pInfo->id, &pTask); + if (code != 0) { stError("s-task:0x%x and rel fill-history task:0x%" PRIx64 " all have been destroyed, not launch", (int32_t)pInfo->id.taskId, pInfo->hTaskId.taskId); streamMetaWUnLock(pMeta); + int32_t ret = taosReleaseRef(streamMetaRefPool, metaRid); + if (ret) { + stError("vgId:%d failed to release meta refId:%"PRId64, vgId, metaRid); + } + // already dropped, no need to set the failure info into the stream task meta. taosMemoryFree(pInfo); return; } - if (streamTaskShouldStop(*ppTask)) { - char* p = streamTaskGetStatus(*ppTask).name; - int32_t ref = atomic_sub_fetch_32(&(*ppTask)->status.timerActive, 1); - stDebug("s-task:%s status:%s should stop, quit launch fill-history task timer, retry:%d, ref:%d", - (*ppTask)->id.idStr, p, (*ppTask)->hTaskInfo.retryTimes, ref); + if (streamTaskShouldStop(pTask)) { + char* p = streamTaskGetStatus(pTask).name; + stDebug("s-task:%s status:%s should stop, quit launch fill-history task timer, retry:%d", pTask->id.idStr, p, + pTask->hTaskInfo.retryTimes); streamMetaWUnLock(pMeta); @@ -369,77 +393,54 @@ void tryLaunchHistoryTask(void* param, void* tmrId) { stError("s-task:0x%" PRId64 " failed to record the start task status, code:%s", pInfo->hTaskId.taskId, tstrerror(code)); } - taosMemoryFree(pInfo); + + doCleanup(pTask, metaRid, pInfo); return; } - SStreamTask* pTask = NULL; - code = streamMetaAcquireTaskNoLock(pMeta, pInfo->id.streamId, pInfo->id.taskId, &pTask); - if (code != TSDB_CODE_SUCCESS) { - // todo - } streamMetaWUnLock(pMeta); - if (pTask != NULL) { - SHistoryTaskInfo* pHTaskInfo = &pTask->hTaskInfo; + SHistoryTaskInfo* pHTaskInfo = &pTask->hTaskInfo; + pHTaskInfo->tickCount -= 1; + if (pHTaskInfo->tickCount > 0) { + streamTmrStart(tryLaunchHistoryTask, LAUNCH_HTASK_INTERVAL, pInfo, streamTimer, &pHTaskInfo->pTimer, + pTask->pMeta->vgId, " start-history-task-tmr"); + doCleanup(pTask, metaRid, NULL); + return; + } - pHTaskInfo->tickCount -= 1; - if (pHTaskInfo->tickCount > 0) { - streamTmrStart(tryLaunchHistoryTask, LAUNCH_HTASK_INTERVAL, pInfo, streamTimer, &pHTaskInfo->pTimer, - pTask->pMeta->vgId, " start-history-task-tmr"); - streamMetaReleaseTask(pMeta, pTask); + if (pHTaskInfo->retryTimes > MAX_RETRY_LAUNCH_HISTORY_TASK) { + notRetryLaunchFillHistoryTask(pTask, pInfo, now); + } else { // not reach the limitation yet, let's continue retrying launch related fill-history task. + streamTaskSetRetryInfoForLaunch(pHTaskInfo); + + // abort the timer if intend to stop task + SStreamTask* pHTask = NULL; + code = streamMetaAcquireTask(pMeta, pHTaskInfo->id.streamId, pHTaskInfo->id.taskId, &pHTask); + if (pHTask == NULL) { + doRetryLaunchFillHistoryTask(pTask, pInfo, now); + doCleanup(pTask, metaRid, NULL); return; - } - - if (pHTaskInfo->retryTimes > MAX_RETRY_LAUNCH_HISTORY_TASK) { - notRetryLaunchFillHistoryTask(pTask, pInfo, now); - } else { // not reach the limitation yet, let's continue retrying launch related fill-history task. - streamTaskSetRetryInfoForLaunch(pHTaskInfo); - if (pTask->status.timerActive < 1) { - stError("s-task:%s invalid timerActive recorder:%d, abort timer", pTask->id.idStr, pTask->status.timerActive); - return; - } - - // abort the timer if intend to stop task - SStreamTask* pHTask = NULL; - code = streamMetaAcquireTask(pMeta, pHTaskInfo->id.streamId, pHTaskInfo->id.taskId, &pHTask); - if (pHTask == NULL) { - doRetryLaunchFillHistoryTask(pTask, pInfo, now); - streamMetaReleaseTask(pMeta, pTask); - return; - } else { - if (pHTask->pBackend == NULL) { - code = pMeta->expandTaskFn(pHTask); - if (code != TSDB_CODE_SUCCESS) { - streamMetaAddFailedTaskSelf(pHTask, now); - stError("failed to expand fill-history task:%s, code:%s", pHTask->id.idStr, tstrerror(code)); - } - } - - if (code == TSDB_CODE_SUCCESS) { - checkFillhistoryTaskStatus(pTask, pHTask); - // not in timer anymore - int32_t ref = atomic_sub_fetch_32(&pTask->status.timerActive, 1); - stDebug("s-task:0x%x fill-history task launch completed, retry times:%d, ref:%d", (int32_t)pInfo->id.taskId, - pHTaskInfo->retryTimes, ref); + } else { + if (pHTask->pBackend == NULL) { + code = pMeta->expandTaskFn(pHTask); + if (code != TSDB_CODE_SUCCESS) { + streamMetaAddFailedTaskSelf(pHTask, now); + stError("failed to expand fill-history task:%s, code:%s", pHTask->id.idStr, tstrerror(code)); } - streamMetaReleaseTask(pMeta, pHTask); } - } - streamMetaReleaseTask(pMeta, pTask); - } else { - code = streamMetaAddTaskLaunchResult(pMeta, pInfo->hTaskId.streamId, pInfo->hTaskId.taskId, 0, now, false); - if (code) { - stError("s-task:%s failed to record the start task status, code:%s", pTask->id.idStr, tstrerror(code)); + if (code == TSDB_CODE_SUCCESS) { + checkFillhistoryTaskStatus(pTask, pHTask); + // not in timer anymore + stDebug("s-task:0x%x fill-history task launch completed, retry times:%d", (int32_t)pInfo->id.taskId, + pHTaskInfo->retryTimes); + } + streamMetaReleaseTask(pMeta, pHTask); } - - int32_t ref = atomic_sub_fetch_32(&(*ppTask)->status.timerActive, 1); - stError("s-task:0x%x rel fill-history task:0x%" PRIx64 " may have been destroyed, not launch, ref:%d", - (int32_t)pInfo->id.taskId, pInfo->hTaskId.taskId, ref); } - taosMemoryFree(pInfo); + doCleanup(pTask, metaRid, pInfo); } int32_t createHTaskLaunchInfo(SStreamMeta* pMeta, STaskId* pTaskId, int64_t hStreamId, int32_t hTaskId, @@ -455,7 +456,7 @@ int32_t createHTaskLaunchInfo(SStreamMeta* pMeta, STaskId* pTaskId, int64_t hStr (*pInfo)->hTaskId.streamId = hStreamId; (*pInfo)->hTaskId.taskId = hTaskId; - (*pInfo)->pMeta = pMeta; + (*pInfo)->metaRid = pMeta->rid; return TSDB_CODE_SUCCESS; } @@ -485,12 +486,10 @@ int32_t launchNotBuiltFillHistoryTask(SStreamTask* pTask) { // check for the timer if (pTask->hTaskInfo.pTimer == NULL) { - int32_t ref = atomic_add_fetch_32(&pTask->status.timerActive, 1); pTask->hTaskInfo.pTimer = taosTmrStart(tryLaunchHistoryTask, WAIT_FOR_MINIMAL_INTERVAL, pInfo, streamTimer); if (pTask->hTaskInfo.pTimer == NULL) { - ref = atomic_sub_fetch_32(&pTask->status.timerActive, 1); - stError("s-task:%s failed to start timer, related fill-history task not launched, ref:%d", idStr, ref); + stError("s-task:%s failed to start timer, related fill-history task not launched", idStr); taosMemoryFree(pInfo); code = streamMetaAddTaskLaunchResult(pMeta, hStreamId, hTaskId, pExecInfo->checkTs, pExecInfo->readyTs, false); @@ -500,18 +499,8 @@ int32_t launchNotBuiltFillHistoryTask(SStreamTask* pTask) { return terrno; } - if (ref < 1) { - stError("s-task:%s invalid timerActive recorder:%d, abort timer", pTask->id.idStr, pTask->status.timerActive); - return TSDB_CODE_STREAM_INTERNAL_ERROR; - } - - stDebug("s-task:%s set timer active flag, ref:%d", idStr, ref); + stDebug("s-task:%s set timer active flag", idStr); } else { // timer exists - if (pTask->status.timerActive < 1) { - stError("s-task:%s invalid timerActive recorder:%d, abort timer", pTask->id.idStr, pTask->status.timerActive); - return TSDB_CODE_STREAM_INTERNAL_ERROR; - } - stDebug("s-task:%s set timer active flag, task timer not null", idStr); streamTmrStart(tryLaunchHistoryTask, WAIT_FOR_MINIMAL_INTERVAL, pInfo, streamTimer, &pTask->hTaskInfo.pTimer, pTask->pMeta->vgId, " start-history-task-tmr"); @@ -590,15 +579,22 @@ int32_t streamTaskSetRangeStreamCalc(SStreamTask* pTask) { } void doExecScanhistoryInFuture(void* param, void* tmrId) { - SStreamTask* pTask = param; + int64_t taskRefId = *(int64_t*) param; + + SStreamTask* pTask = taosAcquireRef(streamTaskRefPool, taskRefId); + if (pTask == NULL) { + stError("invalid task rid:%" PRId64 " failed to acquired stream-task", taskRefId); + streamTaskFreeRefId(param); + return; + } + pTask->schedHistoryInfo.numOfTicks -= 1; SStreamTaskState p = streamTaskGetStatus(pTask); if (p.state == TASK_STATUS__DROPPING || p.state == TASK_STATUS__STOP) { - int32_t ref = atomic_sub_fetch_32(&pTask->status.timerActive, 1); - stDebug("s-task:%s status:%s not start scan-history again, ref:%d", pTask->id.idStr, p.name, ref); - + stDebug("s-task:%s status:%s not start scan-history again", pTask->id.idStr, p.name); streamMetaReleaseTask(pTask->pMeta, pTask); + streamTaskFreeRefId(param); return; } @@ -608,16 +604,19 @@ void doExecScanhistoryInFuture(void* param, void* tmrId) { stError("s-task:%s async start history task failed", pTask->id.idStr); } - int32_t ref = atomic_sub_fetch_32(&pTask->status.timerActive, 1); - stDebug("s-task:%s fill-history:%d start scan-history data, out of tmr, ref:%d", pTask->id.idStr, - pTask->info.fillHistory, ref); - - // release the task. - streamMetaReleaseTask(pTask->pMeta, pTask); + stDebug("s-task:%s fill-history:%d start scan-history data, out of tmr", pTask->id.idStr, + pTask->info.fillHistory); } else { - streamTmrStart(doExecScanhistoryInFuture, SCANHISTORY_IDLE_TIME_SLICE, pTask, streamTimer, - &pTask->schedHistoryInfo.pTimer, pTask->pMeta->vgId, " start-history-task-tmr"); + int64_t* pTaskRefId = NULL; + int32_t code = streamTaskAllocRefId(pTask, &pTaskRefId); + if (code == 0) { + streamTmrStart(doExecScanhistoryInFuture, SCANHISTORY_IDLE_TIME_SLICE, pTaskRefId, streamTimer, + &pTask->schedHistoryInfo.pTimer, pTask->pMeta->vgId, " start-history-task-tmr"); + } } + + streamMetaReleaseTask(pTask->pMeta, pTask); + streamTaskFreeRefId(param); } int32_t doStartScanHistoryTask(SStreamTask* pTask) { diff --git a/source/libs/stream/src/streamStartTask.c b/source/libs/stream/src/streamStartTask.c index 0858f57414a7..ee9117ddc822 100644 --- a/source/libs/stream/src/streamStartTask.c +++ b/source/libs/stream/src/streamStartTask.c @@ -196,19 +196,17 @@ int32_t streamMetaAddTaskLaunchResult(SStreamMeta* pMeta, int64_t streamId, int3 STaskId id = {.streamId = streamId, .taskId = taskId}; int32_t vgId = pMeta->vgId; bool allRsp = true; + SStreamTask* p = NULL; streamMetaWLock(pMeta); - SStreamTask** p = taosHashGet(pMeta->pTasksMap, &id, sizeof(id)); - if (p == NULL) { // task does not exists in current vnode, not record the complete info + int32_t code = streamMetaAcquireTaskUnsafe(pMeta, &id, &p); + if (code != 0) { // task does not exist in current vnode, not record the complete info stError("vgId:%d s-task:0x%x not exists discard the check downstream info", vgId, taskId); streamMetaWUnLock(pMeta); return 0; } - // clear the send consensus-checkpointId flag -// streamMutexLock(&(*p)->lock); -// (*p)->status.sendConsensusChkptId = false; -// streamMutexUnlock(&(*p)->lock); + streamMetaReleaseTask(pMeta, p); if (pStartInfo->startAllTasks != 1) { int64_t el = endTs - startTs; @@ -222,7 +220,7 @@ int32_t streamMetaAddTaskLaunchResult(SStreamMeta* pMeta, int64_t streamId, int3 STaskInitTs initTs = {.start = startTs, .end = endTs, .success = ready}; SHashObj* pDst = ready ? pStartInfo->pReadyTaskSet : pStartInfo->pFailedTaskSet; - int32_t code = taosHashPut(pDst, &id, sizeof(id), &initTs, sizeof(STaskInitTs)); + code = taosHashPut(pDst, &id, sizeof(id), &initTs, sizeof(STaskInitTs)); if (code) { if (code == TSDB_CODE_DUP_KEY) { stError("vgId:%d record start task result failed, s-task:0x%" PRIx64 @@ -296,13 +294,14 @@ void displayStatusInfo(SStreamMeta* pMeta, SHashObj* pTaskSet, bool succ) { while ((pIter = taosHashIterate(pTaskSet, pIter)) != NULL) { STaskInitTs* pInfo = pIter; void* key = taosHashGetKey(pIter, &keyLen); - - SStreamTask** pTask1 = taosHashGet(pMeta->pTasksMap, key, sizeof(STaskId)); - if (pTask1 == NULL) { - stInfo("s-task:0x%x is dropped already, %s", (int32_t)((STaskId*)key)->taskId, succ ? "success" : "failed"); + SStreamTask* pTask = NULL; + int32_t code = streamMetaAcquireTaskUnsafe(pMeta, key, &pTask); + if (code == 0) { + stInfo("s-task:%s level:%d vgId:%d, init:%" PRId64 ", initEnd:%" PRId64 ", %s", pTask->id.idStr, + pTask->info.taskLevel, vgId, pInfo->start, pInfo->end, pInfo->success ? "success" : "failed"); + streamMetaReleaseTask(pMeta, pTask); } else { - stInfo("s-task:%s level:%d vgId:%d, init:%" PRId64 ", initEnd:%" PRId64 ", %s", (*pTask1)->id.idStr, - (*pTask1)->info.taskLevel, vgId, pInfo->start, pInfo->end, pInfo->success ? "success" : "failed"); + stInfo("s-task:0x%x is dropped already, %s", (int32_t)((STaskId*)key)->taskId, succ ? "success" : "failed"); } } } @@ -417,8 +416,10 @@ int32_t streamMetaStartOneTask(SStreamMeta* pMeta, int64_t streamId, int32_t tas int32_t streamMetaStopAllTasks(SStreamMeta* pMeta) { streamMetaRLock(pMeta); + SArray* pTaskList = NULL; int32_t num = taosArrayGetSize(pMeta->pTaskList); stDebug("vgId:%d stop all %d stream task(s)", pMeta->vgId, num); + if (num == 0) { stDebug("vgId:%d stop all %d task(s) completed, elapsed time:0 Sec.", pMeta->vgId, num); streamMetaRUnLock(pMeta); @@ -428,14 +429,12 @@ int32_t streamMetaStopAllTasks(SStreamMeta* pMeta) { int64_t st = taosGetTimestampMs(); // send hb msg to mnode before closing all tasks. - SArray* pTaskList = NULL; int32_t code = streamMetaSendMsgBeforeCloseTasks(pMeta, &pTaskList); if (code != TSDB_CODE_SUCCESS) { return code; } int32_t numOfTasks = taosArrayGetSize(pTaskList); - for (int32_t i = 0; i < numOfTasks; ++i) { SStreamTaskId* pTaskId = taosArrayGet(pTaskList, i); SStreamTask* pTask = NULL; @@ -445,11 +444,17 @@ int32_t streamMetaStopAllTasks(SStreamMeta* pMeta) { continue; } + int64_t refId = pTask->id.refId; int32_t ret = streamTaskStop(pTask); if (ret) { stError("s-task:0x%x failed to stop task, code:%s", pTaskId->taskId, tstrerror(ret)); } + streamMetaReleaseTask(pMeta, pTask); + ret = taosRemoveRef(streamTaskRefPool, refId); + if (ret) { + stError("vgId:%d failed to remove task:0x%x, refId:%"PRId64, pMeta->vgId, pTaskId->taskId, refId); + } } taosArrayDestroy(pTaskList); @@ -466,6 +471,7 @@ int32_t streamTaskCheckIfReqConsenChkptId(SStreamTask* pTask, int64_t ts) { int32_t vgId = pTask->pMeta->vgId; if (pConChkptInfo->status == TASK_CONSEN_CHKPT_REQ) { + // mark the sending of req consensus checkpoint request. pConChkptInfo->status = TASK_CONSEN_CHKPT_SEND; pConChkptInfo->statusTs = ts; stDebug("s-task:%s vgId:%d set requiring consensus-chkptId in hbMsg, ts:%" PRId64, pTask->id.idStr, @@ -473,6 +479,8 @@ int32_t streamTaskCheckIfReqConsenChkptId(SStreamTask* pTask, int64_t ts) { return 1; } else { int32_t el = (ts - pConChkptInfo->statusTs) / 1000; + + // not recv consensus-checkpoint rsp for 60sec, send it again in hb to mnode if ((pConChkptInfo->status == TASK_CONSEN_CHKPT_SEND) && el > 60) { pConChkptInfo->statusTs = ts; @@ -492,7 +500,7 @@ void streamTaskSetConsenChkptIdRecv(SStreamTask* pTask, int32_t transId, int64_t pInfo->status = TASK_CONSEN_CHKPT_RECV; pInfo->statusTs = ts; - stDebug("s-task:%s set recv consen-checkpointId, transId:%d", pTask->id.idStr, transId); + stInfo("s-task:%s set recv consen-checkpointId, transId:%d", pTask->id.idStr, transId); } void streamTaskSetReqConsenChkptId(SStreamTask* pTask, int64_t ts) { @@ -507,23 +515,24 @@ void streamTaskSetReqConsenChkptId(SStreamTask* pTask, int64_t ts) { } int32_t streamMetaAddFailedTask(SStreamMeta* pMeta, int64_t streamId, int32_t taskId) { - int32_t code = TSDB_CODE_SUCCESS; - int64_t now = taosGetTimestampMs(); - int64_t startTs = 0; - bool hasFillhistoryTask = false; - STaskId hId = {0}; + int32_t code = TSDB_CODE_SUCCESS; + int64_t now = taosGetTimestampMs(); + int64_t startTs = 0; + bool hasFillhistoryTask = false; + STaskId hId = {0}; + STaskId id = {.streamId = streamId, .taskId = taskId}; + SStreamTask* pTask = NULL; stDebug("vgId:%d add start failed task:0x%x", pMeta->vgId, taskId); streamMetaRLock(pMeta); - STaskId id = {.streamId = streamId, .taskId = taskId}; - SStreamTask** ppTask = taosHashGet(pMeta->pTasksMap, &id, sizeof(id)); - - if (ppTask != NULL) { - startTs = (*ppTask)->taskCheckInfo.startTs; - hasFillhistoryTask = HAS_RELATED_FILLHISTORY_TASK(*ppTask); - hId = (*ppTask)->hTaskInfo.id; + code = streamMetaAcquireTaskUnsafe(pMeta, &id, &pTask); + if (code == 0) { + startTs = pTask->taskCheckInfo.startTs; + hasFillhistoryTask = HAS_RELATED_FILLHISTORY_TASK(pTask); + hId = pTask->hTaskInfo.id; + streamMetaReleaseTask(pMeta, pTask); streamMetaRUnLock(pMeta); diff --git a/source/libs/stream/src/streamTimer.c b/source/libs/stream/src/streamTimer.c index 0da9acfd1dbc..848e9c874eef 100644 --- a/source/libs/stream/src/streamTimer.c +++ b/source/libs/stream/src/streamTimer.c @@ -66,15 +66,9 @@ void streamTmrStop(tmr_h tmrId) { } } -int32_t streamCleanBeforeQuitTmr(SStreamTmrInfo* pInfo, SStreamTask* pTask) { +void streamCleanBeforeQuitTmr(SStreamTmrInfo* pInfo, void* param) { pInfo->activeCounter = 0; pInfo->launchChkptId = 0; atomic_store_8(&pInfo->isActive, 0); - - int32_t ref = atomic_sub_fetch_32(&pTask->status.timerActive, 1); - if (ref < 0) { - stFatal("invalid task timer ref value:%d, %s", ref, pTask->id.idStr); - } - - return ref; + streamTaskFreeRefId(param); } \ No newline at end of file From 86e7371e8732df3e482006c11dac6d6227df8dc6 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Sun, 27 Oct 2024 15:50:57 +0800 Subject: [PATCH 324/695] fix issue for windows compile --- source/libs/executor/src/sysscanoperator.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/source/libs/executor/src/sysscanoperator.c b/source/libs/executor/src/sysscanoperator.c index 112c52ba235f..4b783d1b8d1c 100644 --- a/source/libs/executor/src/sysscanoperator.c +++ b/source/libs/executor/src/sysscanoperator.c @@ -1065,10 +1065,10 @@ static int32_t sysTableUserTagsFillOneTableTags(const SSysTableScanInfo* pInfo, int8_t tagType = (*smrSuperTable).me.stbEntry.schemaTag.pSchema[i].type; pColInfoData = taosArrayGet(dataBlock->pDataBlock, 4); QUERY_CHECK_NULL(pColInfoData, code, lino, _end, terrno); - const int32_t bufflen = 32; - char tagTypeStr[VARSTR_HEADER_SIZE + bufflen]; - int tagTypeLen = tsnprintf(varDataVal(tagTypeStr), bufflen, "%s", tDataTypes[tagType].name); - int32_t tagStrBufflen = bufflen - tagTypeLen; + int32_t tagStrBufflen = 32; + char tagTypeStr[VARSTR_HEADER_SIZE + 32]; + int tagTypeLen = tsnprintf(varDataVal(tagTypeStr), tagStrBufflen, "%s", tDataTypes[tagType].name); + tagStrBufflen -= tagTypeLen; if (tagStrBufflen <= 0) { code = TSDB_CODE_INVALID_PARA; QUERY_CHECK_CODE(code, lino, _end); @@ -1204,10 +1204,10 @@ static int32_t sysTableUserColsFillOneTableCols(const SSysTableScanInfo* pInfo, int8_t colType = schemaRow->pSchema[i].type; pColInfoData = taosArrayGet(dataBlock->pDataBlock, 4); QUERY_CHECK_NULL(pColInfoData, code, lino, _end, terrno); - const int32_t bufflen = 32; - char colTypeStr[VARSTR_HEADER_SIZE + bufflen]; - int colTypeLen = tsnprintf(varDataVal(colTypeStr), bufflen, "%s", tDataTypes[colType].name); - int32_t colStrBufflen = bufflen - colTypeLen; + int32_t colStrBufflen = 32; + char colTypeStr[VARSTR_HEADER_SIZE + 32]; + int colTypeLen = tsnprintf(varDataVal(colTypeStr), colStrBufflen, "%s", tDataTypes[colType].name); + colStrBufflen -= colTypeLen; if (colStrBufflen <= 0) { code = TSDB_CODE_INVALID_PARA; QUERY_CHECK_CODE(code, lino, _end); From 651a652376a28f39a46472b4488b6334624783d8 Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Sun, 27 Oct 2024 18:04:21 +0800 Subject: [PATCH 325/695] feat: add unit test to shell --- tools/shell/CMakeLists.txt | 50 +++++++++++++ tools/shell/inc/shellAuto.h | 8 +++ tools/shell/src/shellEngine.c | 2 + tools/shell/src/shellMain.c | 3 +- tools/shell/test/shellTest.cpp | 128 +++++++++++++++++++++++++++++++++ 5 files changed, 189 insertions(+), 2 deletions(-) create mode 100644 tools/shell/test/shellTest.cpp diff --git a/tools/shell/CMakeLists.txt b/tools/shell/CMakeLists.txt index fd46870ac544..9fdc0e98f432 100644 --- a/tools/shell/CMakeLists.txt +++ b/tools/shell/CMakeLists.txt @@ -14,14 +14,17 @@ IF(TD_LINUX AND TD_WEBSOCKET) ADD_DEFINITIONS(-DWEBSOCKET -I${CMAKE_BINARY_DIR}/build/include -ltaosws) SET(LINK_WEBSOCKET "-L${CMAKE_BINARY_DIR}/build/lib -ltaosws") ADD_DEPENDENCIES(shell taosws-rs) + ADD_DEPENDENCIES(shell_ut taosws-rs) ELSEIF(TD_DARWIN AND TD_WEBSOCKET) ADD_DEFINITIONS(-DWEBSOCKET -I${CMAKE_BINARY_DIR}/build/include) SET(LINK_WEBSOCKET "${CMAKE_BINARY_DIR}/build/lib/libtaosws.dylib") ADD_DEPENDENCIES(shell taosws-rs) + ADD_DEPENDENCIES(shell_ut taosws-rs) ELSEIF(TD_WINDOWS AND TD_WEBSOCKET) ADD_DEFINITIONS(-DWEBSOCKET -I${CMAKE_BINARY_DIR}/build/include) SET(LINK_WEBSOCKET "${CMAKE_BINARY_DIR}/build/lib/taosws.lib") ADD_DEPENDENCIES(shell taosws-rs) + ADD_DEPENDENCIES(shell_ut taosws-rs) ELSE() SET(LINK_WEBSOCKET "") ENDIF() @@ -49,3 +52,50 @@ target_include_directories( ) SET_TARGET_PROPERTIES(shell PROPERTIES OUTPUT_NAME taos) + +# +# generator library shell_ut for uint test +# + +# include +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/inc) + +LIST(APPEND SHELL_UT_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/shellMain.c) +LIST(APPEND SHELL_UT_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/shellAuto.c) +LIST(APPEND SHELL_UT_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/shellTire.c) +LIST(APPEND SHELL_UT_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/shellArguments.c) +LIST(APPEND SHELL_UT_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/shellCommand.c) +LIST(APPEND SHELL_UT_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/shellEngine.c) +LIST(APPEND SHELL_UT_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/shellUtil.c) +LIST(APPEND SHELL_UT_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/shellNettest.c) +LIST(APPEND SHELL_UT_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/shellWebsocket.c) + + + +# shell_ut library +add_library(shell_ut STATIC ${SHELL_UT_SRC}) + +# link public +if(TD_WINDOWS) + target_link_libraries(shell_ut PUBLIC taos_static ${LINK_WEBSOCKET}) +else() + target_link_libraries(shell_ut PUBLIC taos ${LINK_WEBSOCKET} ${LINK_JEMALLOC} ${LINK_ARGP}) +endif() + +# link private +target_link_libraries( + shell_ut + PRIVATE os common transport geometry util +) + +# util depends +target_link_directories( + shell_ut + PUBLIC "${TD_SOURCE_DIR}/contrib/lzma2" + PUBLIC "${TD_SOURCE_DIR}/contrib/pcre2" +) + +# unit test +if(${BUILD_TEST}) + ADD_SUBDIRECTORY(test) +endif(${BUILD_TEST}) \ No newline at end of file diff --git a/tools/shell/inc/shellAuto.h b/tools/shell/inc/shellAuto.h index bcf500fefcbf..7fe249251b88 100644 --- a/tools/shell/inc/shellAuto.h +++ b/tools/shell/inc/shellAuto.h @@ -47,4 +47,12 @@ void showAD(bool end); // show all commands help void showHelp(); + +// +// for unit test +// +bool fieldOptionsArea(char* p); +bool isCreateFieldsArea(char* p); + + #endif diff --git a/tools/shell/src/shellEngine.c b/tools/shell/src/shellEngine.c index 2a583f948e76..50a7fe81196c 100644 --- a/tools/shell/src/shellEngine.c +++ b/tools/shell/src/shellEngine.c @@ -22,6 +22,8 @@ #include "shellAuto.h" #include "shellInt.h" +SShellObj shell = {0}; + typedef struct { const char *sql; bool vertical; diff --git a/tools/shell/src/shellMain.c b/tools/shell/src/shellMain.c index 71acf23e41f7..fc6ba0f7d897 100644 --- a/tools/shell/src/shellMain.c +++ b/tools/shell/src/shellMain.c @@ -17,8 +17,7 @@ #include "shellInt.h" #include "shellAuto.h" -SShellObj shell = {0}; - +extern SShellObj shell; void shellCrashHandler(int signum, void *sigInfo, void *context) { taosIgnSignal(SIGTERM); diff --git a/tools/shell/test/shellTest.cpp b/tools/shell/test/shellTest.cpp new file mode 100644 index 000000000000..1f3f1b1b2af8 --- /dev/null +++ b/tools/shell/test/shellTest.cpp @@ -0,0 +1,128 @@ +/* + * 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 "shellAuto.h" + + +TEST(fieldOptionsArea, autoTabTest) { + printf("hellow world SHELL tab test\n"); + + // str false + const char *s0 [] = { + "create table st(ts ", + "create table st(ts timestamp, age ", + "create table st(ts timestamp, age", + "create table st(ts timestamp, age int , name ", + "create table st(ts timestamp, age int , name binary(16)", + "create table st(ts timestamp, age int , name binary(16) ) tags( ", + "create table st(ts timestamp, age int , name binary(16) ) tags( area int, addr ", + "create table st(ts timestamp, age int , name binary(16) ) tags( area int,addr varbinary", + "create table st(ts timestamp, age int, name binary(16)) tags(area int , addr varbinary(32)", + "create table st( ts timestamp, age int, name binary(16)) tags( area int, addr", + "create table st (ts timestamp , age int, name binary(16) , area int,", + "create table st (ts timestamp , age int, name binary(16) ) tags ( area int ,addr varbinary", + "create table st (ts timestamp , age int, name binary(16) ) tags ( area int , addr varbinary(32) level 'high' , no i", + "create table st (ts timestamp , age int, name binary(16) ) tags ( area int , addr varbinary(32) encode 'simple8b' level 'high', no in", + }; + + // str true + const char *s1 [] = { + "create table st(ts timestamp ", + "create table st(ts timestamp, age int ", + "create table st(ts timestamp, age int ", + "create table st(ts timestamp, age int , name binary(16) ", + "create table st(ts timestamp, age int , name binary(16) ", + "create table st(ts timestamp, age int , name binary(16) , addr varbinary( 32 ) ", + "create table st(ts timestamp, age int , name binary(16) ,area int, addr varbinary(32) ", + "create table st(ts timestamp, age int , name binary(16), area int,addr varbinary(32) ", + "create table st(ts timestamp, age int, name binary(16) , area int,addr varbinary(32) ", + "create table st( ts timestamp, age int, name binary(16) ,area int,addr varbinary(32) ", + "create table st (ts timestamp , age int, name binary(16), area int,addr varbinary(32) ", + "create table st (ts timestamp , age int, name binary(16), area int , addr varbinary(32) compress 'zlib' ", + "create table st (ts timestamp , age int, name binary(16), area int , addr varbinary(32) level 'high' ", + "create table st (ts timestamp , age int, name binary(16) , area int , addr varbinary(32) encode 'simple8b' level 'high' ", + }; + + // s0 is false + for(int32_t i = 0; i < sizeof(s0)/sizeof(char*) ; i++) { + printf("s0 i=%d fieldOptionsArea %s expect false \n", i, s0[i]); + ASSERT (fieldOptionsArea((char *)s0[i]) == false); + } + + // s1 is true + for(int32_t i = 0; i < sizeof(s1)/sizeof(char*) ; i++) { + printf("s1 i=%d fieldOptionsArea %s expect true \n", i, s1[i]); + ASSERT (fieldOptionsArea((char *)s1[i]) == true); + } +} + +TEST(isCreateFieldsArea, autoTabTest) { + printf("hellow world SHELL tab test\n"); + + // str false + const char *s0 [] = { + "create table st(ts )", + "create table st(ts timestamp, age) ", + "create table st(ts timestamp, age)", + "create table st(ts timestamp, age int , name binary(16) )", + "create table st(ts timestamp, age int , name binary(16))", + "create table st(ts timestamp, age int , name binary(16) ) tags( )", + "create table st(ts timestamp, age int , name binary(16) ) tags( area int, addr )", + "create table st(ts timestamp, age int , name binary(16) ) tags( area int,addr varbinary)", + "create table st(ts timestamp, age int, name binary(16)) tags(area int , addr varbinary(32))", + "create table st( ts timestamp, age int, name binary(16)) tags( area int, addr int)", + "create table st (ts timestamp , age int, name binary(16) ) tags ( area int,addr varbinary(32) )", + "create table st (ts timestamp , age int, name binary(16) ) tags ( area int ,addr varbinary(14))", + "create table st (ts timestamp , age int, name binary(16) ) tags ( area int , addr varbinary(32) level 'high' )", + "create table st (ts timestamp , age int, name binary(16) ) tags ( area int , addr varbinary(32) encode 'simple8b' level 'high' ) ", + }; + + // str true + const char *s1 [] = { + "create table st(ts timestamp ", + "create table st(ts timestamp, age int ", + "create table st(ts timestamp, age int ,", + "create table st(ts timestamp, age int , name binary(16), ", + "create table st(ts timestamp, age int , name binary(16) ", + "create table st(ts timestamp, age int , name binary(16) ) tags( area int ", + "create table st(ts timestamp, age int , name binary(16) ) tags( area int, addr varbinary(32) ", + "create table st(ts timestamp, age int , name binary(16) ) tags( area int,addr varbinary(32)", + "create table st(ts timestamp, age int, name binary(16)) tags(area int,addr varbinary(32) ", + "create table st( ts timestamp, age int, name binary(16)) tags(area int,addr varbinary(32) ", + "create table st (ts timestamp , age int, name binary(16) ) tags ( area int, addr varbinary(32) ", + "create table st (ts timestamp , age int, name binary(16) ) tags ( area int , addr varbinary(32) compress 'zlib' ", + "create table st (ts timestamp , age int, name binary(16) ) tags ( area int , addr varbinary(32) level 'high' ", + "create table st (ts timestamp , age int, name binary(16) ) tags ( area int , addr varbinary(32) encode 'simple8b' level 'high' ", + }; + + // s0 is false + for(int32_t i = 0; i < sizeof(s0)/sizeof(char*) ; i++) { + printf("s0 i=%d isCreateFieldsArea %s expect false. \n", i, s0[i]); + ASSERT (isCreateFieldsArea((char *)s0[i]) == false); + } + + // s1 is true + for(int32_t i = 0; i < sizeof(s1)/sizeof(char*) ; i++) { + printf("s1 i=%d isCreateFieldsArea %s expect true. \n", i, s1[i]); + ASSERT (isCreateFieldsArea((char *)s1[i]) == true); + } +} + +int main(int argc, char **argv) { + testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} \ No newline at end of file From efa6db21502f7162aea6143f8d4b408e146f41aa Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Sun, 27 Oct 2024 18:12:33 +0800 Subject: [PATCH 326/695] fix: websocket build --- tools/shell/CMakeLists.txt | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/tools/shell/CMakeLists.txt b/tools/shell/CMakeLists.txt index 9fdc0e98f432..3c9ae1d9621a 100644 --- a/tools/shell/CMakeLists.txt +++ b/tools/shell/CMakeLists.txt @@ -2,6 +2,22 @@ aux_source_directory(src SHELL_SRC) add_executable(shell ${SHELL_SRC}) +# include +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/inc) + +LIST(APPEND SHELL_UT_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/shellMain.c) +LIST(APPEND SHELL_UT_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/shellAuto.c) +LIST(APPEND SHELL_UT_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/shellTire.c) +LIST(APPEND SHELL_UT_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/shellArguments.c) +LIST(APPEND SHELL_UT_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/shellCommand.c) +LIST(APPEND SHELL_UT_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/shellEngine.c) +LIST(APPEND SHELL_UT_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/shellUtil.c) +LIST(APPEND SHELL_UT_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/shellNettest.c) +LIST(APPEND SHELL_UT_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/shellWebsocket.c) + +# shell_ut library +add_library(shell_ut STATIC ${SHELL_UT_SRC}) + IF(TD_LINUX_64 AND JEMALLOC_ENABLED) ADD_DEFINITIONS(-DTD_JEMALLOC_ENABLED -I${CMAKE_BINARY_DIR}/build/include -L${CMAKE_BINARY_DIR}/build/lib -Wl,-rpath,${CMAKE_BINARY_DIR}/build/lib -ljemalloc) SET(LINK_JEMALLOC "-L${CMAKE_BINARY_DIR}/build/lib -ljemalloc") @@ -57,24 +73,6 @@ SET_TARGET_PROPERTIES(shell PROPERTIES OUTPUT_NAME taos) # generator library shell_ut for uint test # -# include -include_directories(${CMAKE_CURRENT_SOURCE_DIR}/inc) - -LIST(APPEND SHELL_UT_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/shellMain.c) -LIST(APPEND SHELL_UT_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/shellAuto.c) -LIST(APPEND SHELL_UT_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/shellTire.c) -LIST(APPEND SHELL_UT_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/shellArguments.c) -LIST(APPEND SHELL_UT_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/shellCommand.c) -LIST(APPEND SHELL_UT_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/shellEngine.c) -LIST(APPEND SHELL_UT_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/shellUtil.c) -LIST(APPEND SHELL_UT_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/shellNettest.c) -LIST(APPEND SHELL_UT_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/shellWebsocket.c) - - - -# shell_ut library -add_library(shell_ut STATIC ${SHELL_UT_SRC}) - # link public if(TD_WINDOWS) target_link_libraries(shell_ut PUBLIC taos_static ${LINK_WEBSOCKET}) From 3ce942f5fbc23fec76900ea10eacbd5a0cffcc4c Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Sun, 27 Oct 2024 18:30:36 +0800 Subject: [PATCH 327/695] fix: PR error --- tools/shell/CMakeLists.txt | 65 ++++++++++++++------------------------ 1 file changed, 23 insertions(+), 42 deletions(-) diff --git a/tools/shell/CMakeLists.txt b/tools/shell/CMakeLists.txt index 3c9ae1d9621a..317fb69c6209 100644 --- a/tools/shell/CMakeLists.txt +++ b/tools/shell/CMakeLists.txt @@ -2,21 +2,6 @@ aux_source_directory(src SHELL_SRC) add_executable(shell ${SHELL_SRC}) -# include -include_directories(${CMAKE_CURRENT_SOURCE_DIR}/inc) - -LIST(APPEND SHELL_UT_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/shellMain.c) -LIST(APPEND SHELL_UT_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/shellAuto.c) -LIST(APPEND SHELL_UT_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/shellTire.c) -LIST(APPEND SHELL_UT_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/shellArguments.c) -LIST(APPEND SHELL_UT_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/shellCommand.c) -LIST(APPEND SHELL_UT_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/shellEngine.c) -LIST(APPEND SHELL_UT_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/shellUtil.c) -LIST(APPEND SHELL_UT_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/shellNettest.c) -LIST(APPEND SHELL_UT_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/shellWebsocket.c) - -# shell_ut library -add_library(shell_ut STATIC ${SHELL_UT_SRC}) IF(TD_LINUX_64 AND JEMALLOC_ENABLED) ADD_DEFINITIONS(-DTD_JEMALLOC_ENABLED -I${CMAKE_BINARY_DIR}/build/include -L${CMAKE_BINARY_DIR}/build/lib -Wl,-rpath,${CMAKE_BINARY_DIR}/build/lib -ljemalloc) @@ -30,17 +15,13 @@ IF(TD_LINUX AND TD_WEBSOCKET) ADD_DEFINITIONS(-DWEBSOCKET -I${CMAKE_BINARY_DIR}/build/include -ltaosws) SET(LINK_WEBSOCKET "-L${CMAKE_BINARY_DIR}/build/lib -ltaosws") ADD_DEPENDENCIES(shell taosws-rs) - ADD_DEPENDENCIES(shell_ut taosws-rs) ELSEIF(TD_DARWIN AND TD_WEBSOCKET) ADD_DEFINITIONS(-DWEBSOCKET -I${CMAKE_BINARY_DIR}/build/include) SET(LINK_WEBSOCKET "${CMAKE_BINARY_DIR}/build/lib/libtaosws.dylib") - ADD_DEPENDENCIES(shell taosws-rs) - ADD_DEPENDENCIES(shell_ut taosws-rs) ELSEIF(TD_WINDOWS AND TD_WEBSOCKET) ADD_DEFINITIONS(-DWEBSOCKET -I${CMAKE_BINARY_DIR}/build/include) SET(LINK_WEBSOCKET "${CMAKE_BINARY_DIR}/build/lib/taosws.lib") ADD_DEPENDENCIES(shell taosws-rs) - ADD_DEPENDENCIES(shell_ut taosws-rs) ELSE() SET(LINK_WEBSOCKET "") ENDIF() @@ -73,27 +54,27 @@ SET_TARGET_PROPERTIES(shell PROPERTIES OUTPUT_NAME taos) # generator library shell_ut for uint test # -# link public -if(TD_WINDOWS) - target_link_libraries(shell_ut PUBLIC taos_static ${LINK_WEBSOCKET}) -else() - target_link_libraries(shell_ut PUBLIC taos ${LINK_WEBSOCKET} ${LINK_JEMALLOC} ${LINK_ARGP}) -endif() +IF(TD_LINUX) + # include + include_directories(${CMAKE_CURRENT_SOURCE_DIR}/inc) + # shell_ut library + add_library(shell_ut STATIC ${SHELL_SRC}) -# link private -target_link_libraries( - shell_ut - PRIVATE os common transport geometry util -) - -# util depends -target_link_directories( - shell_ut - PUBLIC "${TD_SOURCE_DIR}/contrib/lzma2" - PUBLIC "${TD_SOURCE_DIR}/contrib/pcre2" -) - -# unit test -if(${BUILD_TEST}) - ADD_SUBDIRECTORY(test) -endif(${BUILD_TEST}) \ No newline at end of file + IF(TD_WEBSOCKET) + ADD_DEPENDENCIES(shell_ut taosws-rs) + ENDIF() + target_link_libraries(shell_ut PUBLIC taos ${LINK_WEBSOCKET} ${LINK_JEMALLOC} ${LINK_ARGP}) + target_link_libraries(shell_ut PRIVATE os common transport geometry util) + + # util depends + target_link_directories( + shell_ut + PUBLIC "${TD_SOURCE_DIR}/contrib/lzma2" + PUBLIC "${TD_SOURCE_DIR}/contrib/pcre2" + ) + + # unit test + IF(${BUILD_TEST}) + ADD_SUBDIRECTORY(test) + ENDIF(${BUILD_TEST}) +ENDIF() From 4876bc4fb2ab7a8ff75e9808ba1118c32ba92727 Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Sun, 27 Oct 2024 18:33:31 +0800 Subject: [PATCH 328/695] fix: restore shell origin code --- tools/shell/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/shell/CMakeLists.txt b/tools/shell/CMakeLists.txt index 317fb69c6209..4a8e0b9d34c2 100644 --- a/tools/shell/CMakeLists.txt +++ b/tools/shell/CMakeLists.txt @@ -2,7 +2,6 @@ aux_source_directory(src SHELL_SRC) add_executable(shell ${SHELL_SRC}) - IF(TD_LINUX_64 AND JEMALLOC_ENABLED) ADD_DEFINITIONS(-DTD_JEMALLOC_ENABLED -I${CMAKE_BINARY_DIR}/build/include -L${CMAKE_BINARY_DIR}/build/lib -Wl,-rpath,${CMAKE_BINARY_DIR}/build/lib -ljemalloc) SET(LINK_JEMALLOC "-L${CMAKE_BINARY_DIR}/build/lib -ljemalloc") @@ -18,6 +17,7 @@ IF(TD_LINUX AND TD_WEBSOCKET) ELSEIF(TD_DARWIN AND TD_WEBSOCKET) ADD_DEFINITIONS(-DWEBSOCKET -I${CMAKE_BINARY_DIR}/build/include) SET(LINK_WEBSOCKET "${CMAKE_BINARY_DIR}/build/lib/libtaosws.dylib") + ADD_DEPENDENCIES(shell taosws-rs) ELSEIF(TD_WINDOWS AND TD_WEBSOCKET) ADD_DEFINITIONS(-DWEBSOCKET -I${CMAKE_BINARY_DIR}/build/include) SET(LINK_WEBSOCKET "${CMAKE_BINARY_DIR}/build/lib/taosws.lib") From db71fe49ed88342f91e161756b665519f1f11808 Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Sun, 27 Oct 2024 19:04:58 +0800 Subject: [PATCH 329/695] add shell-test CMakefiles --- tools/shell/test/CMakeLists.txt | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 tools/shell/test/CMakeLists.txt diff --git a/tools/shell/test/CMakeLists.txt b/tools/shell/test/CMakeLists.txt new file mode 100644 index 000000000000..31ee70c20249 --- /dev/null +++ b/tools/shell/test/CMakeLists.txt @@ -0,0 +1,25 @@ + +MESSAGE(STATUS "build catalog unit test") + +IF(NOT TD_DARWIN) + # GoogleTest requires at least C++11 + SET(CMAKE_CXX_STANDARD 11) + AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} SOURCE_LIST) + + ADD_EXECUTABLE(shellTest ${SOURCE_LIST}) + TARGET_LINK_LIBRARIES( + shellTest + PRIVATE shell_ut gtest os common transport geometry util + ) + + target_include_directories( + shell_ui + PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../inc" + ) + + + add_test( + NAME shellTest + COMMAND shellTest + ) +ENDIF() From 0e2ccadd2fea60af4afdba79f72e0363275943a8 Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Sun, 27 Oct 2024 19:06:10 +0800 Subject: [PATCH 330/695] add shell-test CMakefiles --- tools/shell/test/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/shell/test/CMakeLists.txt b/tools/shell/test/CMakeLists.txt index 31ee70c20249..6f3b0474bd66 100644 --- a/tools/shell/test/CMakeLists.txt +++ b/tools/shell/test/CMakeLists.txt @@ -1,5 +1,5 @@ -MESSAGE(STATUS "build catalog unit test") +MESSAGE(STATUS "build taos-CLI unit test") IF(NOT TD_DARWIN) # GoogleTest requires at least C++11 From 2803d51797ea190610dc405071ce66b562ff2602 Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Sun, 27 Oct 2024 19:15:51 +0800 Subject: [PATCH 331/695] add shell-test CMakefiles shell-ut --- tools/shell/test/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/shell/test/CMakeLists.txt b/tools/shell/test/CMakeLists.txt index 6f3b0474bd66..1eb6c709ab33 100644 --- a/tools/shell/test/CMakeLists.txt +++ b/tools/shell/test/CMakeLists.txt @@ -13,7 +13,7 @@ IF(NOT TD_DARWIN) ) target_include_directories( - shell_ui + shell_ut PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../inc" ) From 90642f4dc2ddf01a7d51c36bd46c8dd04c1a5d53 Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Sun, 27 Oct 2024 19:33:58 +0800 Subject: [PATCH 332/695] fix: add extern C support c++ --- tools/shell/inc/shellAuto.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/shell/inc/shellAuto.h b/tools/shell/inc/shellAuto.h index 7fe249251b88..c9d631f4b272 100644 --- a/tools/shell/inc/shellAuto.h +++ b/tools/shell/inc/shellAuto.h @@ -16,6 +16,10 @@ #ifndef __SHELL_AUTO__ #define __SHELL_AUTO__ +#ifdef __cplusplus +extern "C" { +#endif + #include "shellInt.h" #define TAB_KEY 0x09 @@ -54,5 +58,8 @@ void showHelp(); bool fieldOptionsArea(char* p); bool isCreateFieldsArea(char* p); +#ifdef __cplusplus +} +#endif #endif From 0fa7bf1a26b403a35315279378677e456fb30754 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Sun, 27 Oct 2024 19:51:52 +0800 Subject: [PATCH 333/695] fix(stream): fix memory leak. --- source/libs/stream/src/streamMeta.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/source/libs/stream/src/streamMeta.c b/source/libs/stream/src/streamMeta.c index db46934e47dd..05aaa6604969 100644 --- a/source/libs/stream/src/streamMeta.c +++ b/source/libs/stream/src/streamMeta.c @@ -100,16 +100,7 @@ void metaRefMgtCleanup() { void* pIter = taosHashIterate(gMetaRefMgt.pTable, NULL); while (pIter) { int64_t* p = *(int64_t**) pIter; - stInfo("---------------free refId:%"PRId64", %p", *p, p); - taosMemoryFree(p); - -// SArray* list = *(SArray**)pIter; -// for (int i = 0; i < taosArrayGetSize(list); i++) { -// void* rid = taosArrayGetP(list, i); -// taosMemoryFree(rid); -// } -// taosArrayDestroy(list); pIter = taosHashIterate(gMetaRefMgt.pTable, pIter); } @@ -127,13 +118,14 @@ int32_t metaRefMgtAdd(int64_t vgId, int64_t* rid) { if (p == NULL) { code = taosHashPut(gMetaRefMgt.pTable, &rid, sizeof(rid), &rid, sizeof(void*)); if (code) { - stError("vgId:%d failed to put into metaRef table, rid:%" PRId64, (int32_t)vgId, *rid); + stError("vgId:%d failed to put into refId mgt, refId:%" PRId64" %p, code:%s", (int32_t)vgId, *rid, rid, + tstrerror(code)); return code; - } else { - stInfo("add refId:%"PRId64" vgId:%d, %p", *rid, (int32_t)vgId, rid); + } else { // not +// stInfo("add refId:%"PRId64" vgId:%d, %p", *rid, (int32_t)vgId, rid); } } else { - // todo + stFatal("try to add refId:%"PRId64" vgId:%d, %p that already added into mgt", *rid, (int32_t) vgId, rid); } streamMutexUnlock(&gMetaRefMgt.mutex); @@ -144,7 +136,7 @@ void metaRefMgtRemove(int64_t* pRefId) { streamMutexLock(&gMetaRefMgt.mutex); taosHashRemove(gMetaRefMgt.pTable, &pRefId, sizeof(pRefId)); - stInfo("remove refId from mgt, refId:%"PRId64", %p", *pRefId, pRefId); + taosMemoryFree(pRefId); streamMutexUnlock(&gMetaRefMgt.mutex); } From 51f3f29d5bf323d34dbe70d9e471e729e638a6e5 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Sun, 27 Oct 2024 21:52:46 +0800 Subject: [PATCH 334/695] fix(stream): fix syntax check failure. --- source/dnode/vnode/src/tq/tqRead.c | 5 ++++- source/libs/stream/src/streamMeta.c | 20 +++++++++++++++----- source/libs/stream/src/streamTask.c | 8 ++++++-- 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/source/dnode/vnode/src/tq/tqRead.c b/source/dnode/vnode/src/tq/tqRead.c index 9d9e7c431aeb..bb8491108f99 100644 --- a/source/dnode/vnode/src/tq/tqRead.c +++ b/source/dnode/vnode/src/tq/tqRead.c @@ -1126,7 +1126,10 @@ int32_t tqUpdateTbUidList(STQ* pTq, const SArray* tbUidList, bool isAdd) { tqError("vgId:%d, s-task:0x%x update qualified table error for stream task", vgId, taskId); } } - taosReleaseRef(streamTaskRefPool, refId); + int32_t ret = taosReleaseRef(streamTaskRefPool, refId); + if (ret) { + tqError("vgId:%d release task refId failed, refId:%" PRId64, vgId, refId); + } } } diff --git a/source/libs/stream/src/streamMeta.c b/source/libs/stream/src/streamMeta.c index 05aaa6604969..d414b02d6989 100644 --- a/source/libs/stream/src/streamMeta.c +++ b/source/libs/stream/src/streamMeta.c @@ -135,7 +135,7 @@ int32_t metaRefMgtAdd(int64_t vgId, int64_t* rid) { void metaRefMgtRemove(int64_t* pRefId) { streamMutexLock(&gMetaRefMgt.mutex); - taosHashRemove(gMetaRefMgt.pTable, &pRefId, sizeof(pRefId)); + int32_t code = taosHashRemove(gMetaRefMgt.pTable, &pRefId, sizeof(pRefId)); taosMemoryFree(pRefId); streamMutexUnlock(&gMetaRefMgt.mutex); } @@ -534,7 +534,10 @@ void streamMetaClear(SStreamMeta* pMeta) { p->info.delaySchedParam = 0; } - taosRemoveRef(streamTaskRefPool, refId); + int32_t code = taosRemoveRef(streamTaskRefPool, refId); + if (code) { + stError("vgId:%d remove task refId failed, refId:%" PRId64, pMeta->vgId, refId); + } } if (pMeta->streamBackendRid != 0) { @@ -722,12 +725,19 @@ int32_t streamMetaRegisterTask(SStreamMeta* pMeta, int64_t ver, SStreamTask* pTa } if ((code = streamMetaSaveTask(pMeta, pTask)) != 0) { - taosRemoveRef(streamTaskRefPool, refId); + int32_t ret = taosRemoveRef(streamTaskRefPool, refId); + if (ret) { + stError("vgId:%d remove task refId failed, refId:%" PRId64, pMeta->vgId, refId); + } return code; } if ((code = streamMetaCommit(pMeta)) != 0) { - taosRemoveRef(streamTaskRefPool, refId); + int32_t ret = taosRemoveRef(streamTaskRefPool, refId); + if (ret) { + stError("vgId:%d remove task refId failed, refId:%" PRId64, pMeta->vgId, refId); + } + return code; } @@ -1215,7 +1225,7 @@ void streamMetaNotifyClose(SStreamMeta* pMeta) { streamMetaReleaseTask(pMeta, pTask); ret = taosRemoveRef(streamTaskRefPool, refId); if (ret) { - stError("vgId:%d failed to remove task:0x%x, refId:%"PRId64, pMeta->vgId, pTaskId->taskId, refId); + stError("vgId:%d failed to remove task:0x%x, refId:%" PRId64, pMeta->vgId, pTaskId->taskId, refId); } } diff --git a/source/libs/stream/src/streamTask.c b/source/libs/stream/src/streamTask.c index e00984ea9b41..67d76ba2ef21 100644 --- a/source/libs/stream/src/streamTask.c +++ b/source/libs/stream/src/streamTask.c @@ -1285,8 +1285,12 @@ int32_t streamTaskAllocRefId(SStreamTask* pTask, int64_t** pRefId) { *pRefId = taosMemoryMalloc(sizeof(int64_t)); if (*pRefId != NULL) { **pRefId = pTask->id.refId; - metaRefMgtAdd(pTask->pMeta->vgId, *pRefId); - return 0; + int32_t code = metaRefMgtAdd(pTask->pMeta->vgId, *pRefId); + if (code != 0) { + stError("s-task:%s failed to add refId:%" PRId64 " into refId-mgmt, code:%s", pTask->id.idStr, pTask->id.refId, + tstrerror(code)); + } + return code; } else { stError("s-task:%s failed to alloc new ref id, code:%s", pTask->id.idStr, tstrerror(terrno)); return terrno; From 323088dc7113d1c5e2e3a80f14e682e02ba73697 Mon Sep 17 00:00:00 2001 From: xsren <285808407@qq.com> Date: Sun, 27 Oct 2024 22:41:34 +0800 Subject: [PATCH 335/695] fix: create partialfunction --- include/libs/function/functionMgt.h | 1 + source/libs/function/src/builtins.c | 2 +- source/libs/function/src/functionMgt.c | 36 +++++++++++++++++++------- 3 files changed, 28 insertions(+), 11 deletions(-) diff --git a/include/libs/function/functionMgt.h b/include/libs/function/functionMgt.h index e5bacf85b29c..0b6928fa509e 100644 --- a/include/libs/function/functionMgt.h +++ b/include/libs/function/functionMgt.h @@ -290,6 +290,7 @@ bool fmIsElapsedFunc(int32_t funcId); void getLastCacheDataType(SDataType* pType, int32_t pkBytes); int32_t createFunction(const char* pName, SNodeList* pParameterList, SFunctionNode** pFunc); +int32_t createFunctionWithSrcFunc(const char* pName, const SFunctionNode* pSrcFunc, SNodeList* pParameterList, SFunctionNode** pFunc); int32_t fmGetDistMethod(const SFunctionNode* pFunc, SFunctionNode** pPartialFunc, SFunctionNode** pMidFunc, SFunctionNode** pMergeFunc); diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c index 7c659bdef57e..bd72498508b8 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -1648,7 +1648,7 @@ static int32_t translateOutVarchar(SFunctionNode* pFunc, char* pErrBuf, int32_t bytes = TSDB_TABLE_FNAME_LEN - 1 + VARSTR_HEADER_SIZE; break; case FUNCTION_TYPE_TIMEZONE: - bytes = TD_TIMEZONE_LEN; + bytes = timeZoneStrLen(); break; case FUNCTION_TYPE_IRATE_PARTIAL: bytes = getIrateInfoSize((pFunc->hasPk) ? pFunc->pkBytes : 0) + VARSTR_HEADER_SIZE; diff --git a/source/libs/function/src/functionMgt.c b/source/libs/function/src/functionMgt.c index aaa66441eed3..a406b23c59b2 100644 --- a/source/libs/function/src/functionMgt.c +++ b/source/libs/function/src/functionMgt.c @@ -412,6 +412,27 @@ int32_t createFunction(const char* pName, SNodeList* pParameterList, SFunctionNo return code; } +int32_t createFunctionWithSrcFunc(const char* pName, const SFunctionNode* pSrcFunc, SNodeList* pParameterList, SFunctionNode** ppFunc) { + int32_t code = nodesMakeNode(QUERY_NODE_FUNCTION, (SNode**)ppFunc); + if (NULL == *ppFunc) { + return code; + } + + (*ppFunc)->hasPk = pSrcFunc->hasPk; + (*ppFunc)->pkBytes = pSrcFunc->pkBytes; + + (void)snprintf((*ppFunc)->functionName, sizeof((*ppFunc)->functionName), "%s", pName); + (*ppFunc)->pParameterList = pParameterList; + code = getFuncInfo((*ppFunc)); + if (TSDB_CODE_SUCCESS != code) { + (*ppFunc)->pParameterList = NULL; + nodesDestroyNode((SNode*)*ppFunc); + *ppFunc = NULL; + return code; + } + return code; +} + static int32_t createColumnByFunc(const SFunctionNode* pFunc, SColumnNode** ppCol) { int32_t code = nodesMakeNode(QUERY_NODE_COLUMN, (SNode**)ppCol); if (NULL == *ppCol) { @@ -438,7 +459,8 @@ static int32_t createPartialFunction(const SFunctionNode* pSrcFunc, SFunctionNod if (NULL == pParameterList) { return code; } - code = createFunction(funcMgtBuiltins[pSrcFunc->funcId].pPartialFunc, pParameterList,pPartialFunc ); + code = + createFunctionWithSrcFunc(funcMgtBuiltins[pSrcFunc->funcId].pPartialFunc, pSrcFunc, pParameterList, pPartialFunc); if (TSDB_CODE_SUCCESS != code) { nodesDestroyList(pParameterList); return code; @@ -452,8 +474,6 @@ static int32_t createPartialFunction(const SFunctionNode* pSrcFunc, SFunctionNod return TSDB_CODE_FAILED; } tstrncpy((*pPartialFunc)->node.aliasName, name, TSDB_COL_NAME_LEN); - (*pPartialFunc)->hasPk = pSrcFunc->hasPk; - (*pPartialFunc)->pkBytes = pSrcFunc->pkBytes; return TSDB_CODE_SUCCESS; } @@ -479,9 +499,9 @@ static int32_t createMidFunction(const SFunctionNode* pSrcFunc, const SFunctionN int32_t code = createMergeFuncPara(pSrcFunc, pPartialFunc, &pParameterList); if (TSDB_CODE_SUCCESS == code) { if(funcMgtBuiltins[pSrcFunc->funcId].pMiddleFunc != NULL){ - code = createFunction(funcMgtBuiltins[pSrcFunc->funcId].pMiddleFunc, pParameterList, &pFunc); + code = createFunctionWithSrcFunc(funcMgtBuiltins[pSrcFunc->funcId].pMiddleFunc, pSrcFunc, pParameterList, &pFunc); }else{ - code = createFunction(funcMgtBuiltins[pSrcFunc->funcId].pMergeFunc, pParameterList, &pFunc); + code = createFunctionWithSrcFunc(funcMgtBuiltins[pSrcFunc->funcId].pMergeFunc, pSrcFunc, pParameterList, &pFunc); } } if (TSDB_CODE_SUCCESS == code) { @@ -493,8 +513,6 @@ static int32_t createMidFunction(const SFunctionNode* pSrcFunc, const SFunctionN } else { nodesDestroyList(pParameterList); } - (*pMidFunc)->hasPk = pPartialFunc->hasPk; - (*pMidFunc)->pkBytes = pPartialFunc->pkBytes; return code; } @@ -505,7 +523,7 @@ static int32_t createMergeFunction(const SFunctionNode* pSrcFunc, const SFunctio int32_t code = createMergeFuncPara(pSrcFunc, pPartialFunc, &pParameterList); if (TSDB_CODE_SUCCESS == code) { - code = createFunction(funcMgtBuiltins[pSrcFunc->funcId].pMergeFunc, pParameterList, &pFunc); + code = createFunctionWithSrcFunc(funcMgtBuiltins[pSrcFunc->funcId].pMergeFunc, pSrcFunc, pParameterList, &pFunc); } if (TSDB_CODE_SUCCESS == code) { pFunc->hasOriginalFunc = true; @@ -522,8 +540,6 @@ static int32_t createMergeFunction(const SFunctionNode* pSrcFunc, const SFunctio } else { nodesDestroyList(pParameterList); } - (*pMergeFunc)->hasPk = pPartialFunc->hasPk; - (*pMergeFunc)->pkBytes = pPartialFunc->pkBytes; return code; } From b02ad5c8e28ede23bbf29f7ab2bed07713657802 Mon Sep 17 00:00:00 2001 From: xsren <285808407@qq.com> Date: Sun, 27 Oct 2024 23:35:21 +0800 Subject: [PATCH 336/695] fix to_char length --- source/libs/scalar/src/sclfunc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/scalar/src/sclfunc.c b/source/libs/scalar/src/sclfunc.c index 9aa67c441bea..da4a39a55135 100644 --- a/source/libs/scalar/src/sclfunc.c +++ b/source/libs/scalar/src/sclfunc.c @@ -2413,7 +2413,7 @@ int32_t toCharFunction(SScalarParam* pInput, int32_t inputNum, SScalarParam* pOu char *ts = colDataGetData(pInput[0].columnData, i); char *formatData = colDataGetData(pInput[1].columnData, pInput[1].numOfRows > 1 ? i : 0); - len = TMIN(TS_FORMAT_MAX_LEN - 1, varDataLen(formatData)); + len = TMIN(TS_FORMAT_MAX_LEN - VARSTR_HEADER_SIZE, varDataLen(formatData)); if (pInput[1].numOfRows > 1 || i == 0) { (void)strncpy(format, varDataVal(formatData), len); format[len] = '\0'; From 92e7ba50dec8b05a27885caed41a902f9de2f18b Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Mon, 28 Oct 2024 08:41:52 +0800 Subject: [PATCH 337/695] docs/s3: new section for s3 interacting --- docs/zh/08-operation/12-multi.md | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/docs/zh/08-operation/12-multi.md b/docs/zh/08-operation/12-multi.md index bb3326cf3e06..ece590d6c805 100644 --- a/docs/zh/08-operation/12-multi.md +++ b/docs/zh/08-operation/12-multi.md @@ -109,9 +109,37 @@ s3migrate database ; | # | 参数 | 默认值 | 最小值 | 最大值 | 描述 | | :--- | :----------- | :----- | :----- | :------ | :----------------------------------------------------------- | | 1 | s3_keeplocal | 365 | 1 | 365000 | 数据在本地保留的天数,即 data 文件在本地磁盘保留多长时间后可以上传到 S3。默认单位:天,支持 m(分钟)、h(小时)和 d(天)三个单位 | -| 2 | s3_chunksize | 262144 | 131072 | 1048576 | 上传对象的大小阈值,与 TSDB_PAGESIZE 参数一样,不可修改,单位为 TSDB 页 | +| 2 | s3_chunksize | 262144 | 131072 | 1048576 | 上传对象的大小阈值,与 tsdb_pagesize 参数一样,不可修改,单位为 TSDB 页 | | 3 | s3_compact | 1 | 0 | 1 | TSDB 文件组首次上传 S3 时,是否自动进行 compact 操作。 | +### 对象存储交互 + +对象存储服务的使用成本与存储的数据量及请求次数相关,下面分别介绍数据的上传及下载过程。 + +#### 数据上传 + +当 TSDB 时序数据超过 `s3_keeplocal` 参数指定的时间,相关的数据文件会被切分成多个文件块,每个文件块的默认大小是 1G 字节 (`s3_chunksize * tsdb_pagesize`)。除了最后一个文件块保留在本地文件系统外,其余的文件块会被上 +传到对象存储服务。 + +```math +上传次数 = 数据文件大小 / 每个文件块大小 - 1 +``` + +在创建数据库时,可以通过 `s3_chunksize` 参数调整每个文件块的大小,从而控制每个数据文件的上传次数。 + +其它类型的文件如 head, stt, sma 等,保留在本地文件系统,以加速预计算相关查询。 + +#### 数据下载 + +在查询操作中,如果需要访问对象存储中的数据,TSDB 不会下载整个数据文件,而是计算所需数据在文件中的位置,只下载相应的数据块(请参考存储引擎部分)到 TSDB 页缓存中,然后将数据返回给查询执行引擎。后续查询首先检查页缓 +存,查看数据是否已被缓存。如果数据已缓存,则直接使用缓存中的数据,而无需重复从对象存储下载,从而有效降低从对象存储下载数据的次数。 + +```math +下载次数 = 查询需要的数据块数量 - 已缓存的数据块数量 +``` + +页缓存是内存缓存,节点重启后,再次查询需要重新下载数据。缓存采用 LRU (Least Recently Used) 策略,当缓存空间不足时,最近最少使用的数据将被淘汰。缓存的大小可以通过 `s3PageCacheSize` 参数进行调整,通常来说,缓存越>大,下载次数越少。 + ## Azure Blob 存储 本节介绍在 TDengine Enterprise 如何使用微软 Azure Blob 对象存储。本功能是上一小节‘对象存储’功能的扩展,需额外依赖 Flexify 服务提供的 S3 网关。通过适当的参数配置,可以把大部分较冷的时序数据存储到 Azure Blob 服务中。 From cee0626163c7481f8ebd350db98b7a0bb799f737 Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Mon, 28 Oct 2024 08:48:19 +0800 Subject: [PATCH 338/695] docs/s3: fix incorrect line feed --- docs/zh/08-operation/12-multi.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/zh/08-operation/12-multi.md b/docs/zh/08-operation/12-multi.md index ece590d6c805..b8b231fbdbcf 100644 --- a/docs/zh/08-operation/12-multi.md +++ b/docs/zh/08-operation/12-multi.md @@ -118,8 +118,7 @@ s3migrate database ; #### 数据上传 -当 TSDB 时序数据超过 `s3_keeplocal` 参数指定的时间,相关的数据文件会被切分成多个文件块,每个文件块的默认大小是 1G 字节 (`s3_chunksize * tsdb_pagesize`)。除了最后一个文件块保留在本地文件系统外,其余的文件块会被上 -传到对象存储服务。 +当 TSDB 时序数据超过 `s3_keeplocal` 参数指定的时间,相关的数据文件会被切分成多个文件块,每个文件块的默认大小是 1G 字节 (`s3_chunksize * tsdb_pagesize`)。除了最后一个文件块保留在本地文件系统外,其余的文件块会被上传到对象存储服务。 ```math 上传次数 = 数据文件大小 / 每个文件块大小 - 1 From 4be0380e17944400fa3d26e23db10ff2acb42027 Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Mon, 28 Oct 2024 08:51:39 +0800 Subject: [PATCH 339/695] fix typos --- docs/zh/08-operation/12-multi.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/zh/08-operation/12-multi.md b/docs/zh/08-operation/12-multi.md index b8b231fbdbcf..d4c869a27ad2 100644 --- a/docs/zh/08-operation/12-multi.md +++ b/docs/zh/08-operation/12-multi.md @@ -137,7 +137,7 @@ s3migrate database ; 下载次数 = 查询需要的数据块数量 - 已缓存的数据块数量 ``` -页缓存是内存缓存,节点重启后,再次查询需要重新下载数据。缓存采用 LRU (Least Recently Used) 策略,当缓存空间不足时,最近最少使用的数据将被淘汰。缓存的大小可以通过 `s3PageCacheSize` 参数进行调整,通常来说,缓存越>大,下载次数越少。 +页缓存是内存缓存,节点重启后,再次查询需要重新下载数据。缓存采用 LRU (Least Recently Used) 策略,当缓存空间不足时,最近最少使用的数据将被淘汰。缓存的大小可以通过 `s3PageCacheSize` 参数进行调整,通常来说,缓存越大,下载次数越少。 ## Azure Blob 存储 本节介绍在 TDengine Enterprise 如何使用微软 Azure Blob 对象存储。本功能是上一小节‘对象存储’功能的扩展,需额外依赖 Flexify 服务提供的 S3 网关。通过适当的参数配置,可以把大部分较冷的时序数据存储到 Azure Blob 服务中。 From 67a05c28600c6cd0a1da9b04858aa3d2002ef9b4 Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Mon, 28 Oct 2024 08:53:33 +0800 Subject: [PATCH 340/695] fix line ending --- docs/zh/08-operation/12-multi.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/zh/08-operation/12-multi.md b/docs/zh/08-operation/12-multi.md index d4c869a27ad2..623761322366 100644 --- a/docs/zh/08-operation/12-multi.md +++ b/docs/zh/08-operation/12-multi.md @@ -130,8 +130,7 @@ s3migrate database ; #### 数据下载 -在查询操作中,如果需要访问对象存储中的数据,TSDB 不会下载整个数据文件,而是计算所需数据在文件中的位置,只下载相应的数据块(请参考存储引擎部分)到 TSDB 页缓存中,然后将数据返回给查询执行引擎。后续查询首先检查页缓 -存,查看数据是否已被缓存。如果数据已缓存,则直接使用缓存中的数据,而无需重复从对象存储下载,从而有效降低从对象存储下载数据的次数。 +在查询操作中,如果需要访问对象存储中的数据,TSDB 不会下载整个数据文件,而是计算所需数据在文件中的位置,只下载相应的数据块(请参考存储引擎部分)到 TSDB 页缓存中,然后将数据返回给查询执行引擎。后续查询首先检查页缓存,查看数据是否已被缓存。如果数据已缓存,则直接使用缓存中的数据,而无需重复从对象存储下载,从而有效降低从对象存储下载数据的次数。 ```math 下载次数 = 查询需要的数据块数量 - 已缓存的数据块数量 From 9b9f06eec3c52ee18b4571997a216599958c47e2 Mon Sep 17 00:00:00 2001 From: dmchen Date: Mon, 28 Oct 2024 01:23:52 +0000 Subject: [PATCH 341/695] fix/TD-32622-add-lock-for-vnodes-fix-compile --- source/dnode/mgmt/mgmt_vnode/src/vmFile.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmFile.c b/source/dnode/mgmt/mgmt_vnode/src/vmFile.c index 80170cfa56a8..866072bc1ac3 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmFile.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmFile.c @@ -204,6 +204,7 @@ int32_t vmWriteVnodeListToFile(SVnodeMgmt *pMgmt) { char file[PATH_MAX] = {0}; char realfile[PATH_MAX] = {0}; int32_t lino = 0; + int32_t ret = -1; int32_t nBytes = snprintf(file, sizeof(file), "%s%svnodes_tmp.json", pMgmt->path, TD_DIRSEP); if (nBytes <= 0 || nBytes >= sizeof(file)) { @@ -269,7 +270,7 @@ int32_t vmWriteVnodeListToFile(SVnodeMgmt *pMgmt) { dInfo("succeed to write vnodes file:%s, vnodes:%d", realfile, numOfVnodes); _OVER1: - int32_t ret = taosThreadMutexUnlock(&pMgmt->fileLock); + ret = taosThreadMutexUnlock(&pMgmt->fileLock); if (ret != 0) { dError("failed to unlock since %s", tstrerror(ret)); } From 13086bc66e0b90987afc0a22634e1eb6c3c2dae2 Mon Sep 17 00:00:00 2001 From: chenhaoran Date: Mon, 28 Oct 2024 09:25:49 +0800 Subject: [PATCH 342/695] test:add testcase for interp in stream --- tests/pytest/util/common.py | 11 ++- .../8-stream/force_window_close_interval.py | 90 +++++++++++++++---- 2 files changed, 78 insertions(+), 23 deletions(-) diff --git a/tests/pytest/util/common.py b/tests/pytest/util/common.py index 2542eca69c4a..1ec6d2cbb990 100644 --- a/tests/pytest/util/common.py +++ b/tests/pytest/util/common.py @@ -170,6 +170,8 @@ def __init__(self): self.fill_tb_source_select_str = ','.join(self.fill_function_list[0:13]) self.ext_tb_source_select_str = ','.join(self.downsampling_function_list[0:13]) self.stream_case_when_tbname = "tbname" + self.tag_value_str = "" + self.tag_value_list = [] self.update = True self.disorder = True @@ -202,7 +204,7 @@ def __init__(self): self.cast_tag_stb_filter_des_select_elm = "ts, t1, t2, t3, t4, cast(t1 as TINYINT UNSIGNED), t6, t7, t8, t9, t10, cast(t2 as varchar(256)), t12, cast(t3 as bool)" self.tag_count = len(self.tag_filter_des_select_elm.split(",")) self.state_window_range = list() - + self.custom_col_val = 0 self.part_val_list = [1, 2] # def init(self, conn, logSql): @@ -754,10 +756,10 @@ def create_ctable(self, tsql, dbname=None, stbname=None, tag_elm_list=None, coun if len(kwargs) > 0: for param, value in kwargs.items(): ctb_params += f'{param} "{value}" ' - tag_value_list = self.gen_tag_value_list(tag_elm_list) + self.tag_value_list = self.gen_tag_value_list(tag_elm_list) tag_value_str = "" # tag_value_str = ", ".join(str(v) for v in self.tag_value_list) - for tag_value in tag_value_list: + for tag_value in self.tag_value_list: if isinstance(tag_value, str): tag_value_str += f'"{tag_value}", ' else: @@ -1764,6 +1766,7 @@ def check_query_data(self, sql1, sql2, sorted=False, fill_value=None, tag_value_ bool: False if failed """ tdLog.info("checking query data ...") + tdLog.info(f"sq1:{sql1}; sql2:{sql2};") if tag_value_list: dvalue = len(self.tag_type_str.split(',')) - defined_tag_count tdSql.query(sql1) @@ -1799,7 +1802,7 @@ def check_query_data(self, sql1, sql2, sorted=False, fill_value=None, tag_value_ res2 = self.round_handle(res2) if not reverse_check: while res1 != res2: - tdLog.info("query retrying ...") + # tdLog.info("query retrying ...") new_list = list() tdSql.query(sql1) res1 = tdSql.queryResult diff --git a/tests/system-test/8-stream/force_window_close_interval.py b/tests/system-test/8-stream/force_window_close_interval.py index 32c228176cf3..0cad878895ca 100644 --- a/tests/system-test/8-stream/force_window_close_interval.py +++ b/tests/system-test/8-stream/force_window_close_interval.py @@ -14,6 +14,7 @@ def init(self, conn, logSql, replicaVar=1): self.tdCom = tdCom def force_window_close(self, interval, partition="tbname", funciton_name="", funciton_name_alias= "",delete=False, fill_value=None, fill_history_value=None, case_when=None, ignore_expired=1, ignore_update=1): + # partition must be tbname, and not NONE. tdLog.info(f"*** testing stream force_window_close+interp+every: every: {interval}, partition: {partition}, fill_history: {fill_history_value}, fill: {fill_value}, delete: {delete}, case_when: {case_when} ***") self.tdCom.subtable=False col_value_type = "Incremental" if partition=="c1" else "random" @@ -26,6 +27,7 @@ def force_window_close(self, interval, partition="tbname", funciton_name="", fun self.ctb_name = self.tdCom.ctb_name.replace(f"{self.tdCom.dbname}.", "") self.tb_name = self.tdCom.tb_name.replace(f"{self.tdCom.dbname}.", "") self.stb_stream_des_table = f'{self.stb_name}{self.tdCom.des_table_suffix}' + self.ctb_stream_des_table = f'{self.ctb_name}{self.tdCom.des_table_suffix}' self.tb_stream_des_table = f'{self.tb_name}{self.tdCom.des_table_suffix}' if partition == "tbname": @@ -68,32 +70,68 @@ def force_window_close(self, interval, partition="tbname", funciton_name="", fun if fill_value: if "value" in fill_value.lower(): fill_value='VALUE,1,2,3,4,5,6,7,8,9,10,11,1,2,3,4,5,6,7,8,9,10,11' + # create error stream tdLog.info("create error stream") sleep(10) tdSql.error(f"create stream itp_force_error_1 trigger force_window_close IGNORE EXPIRED 1 IGNORE UPDATE 0 into itp_force_error_1 as select _irowts,tbname,_isfilled,interp(c1,1) from {self.stb_name} partition by tbname every(5s) fill(prev) ;") tdSql.error(f"create stream itp_force_error_1 trigger force_window_close IGNORE EXPIRED 0 IGNORE UPDATE 1 into itp_force_error_1 as select _irowts,tbname,_isfilled,interp(c1,1) from {self.stb_name} partition by tbname every(5s) fill(prev) ;") tdSql.error(f"create stream itp_force_error_1 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 1 into itp_force_error_1 as select _irowts,tbname,_isfilled,interp(c1,1) from {self.stb_name} partition by tbname every(5s) fill(prev) ;") + tdSql.error(f"create stream itp_force_error_1 trigger force_window_close IGNORE EXPIRED 1 IGNORE UPDATE 0 into itp_force_error_1 as select _irowts,tbname,_isfilled,interp(c11,1) from {self.stb_name} partition by tbname every(5s) fill(prev) ;") # function name : interp trigger_mode = "force_window_close" + + + # # subtable is true # create stream add :subtable_value=stb_subtable_value or subtable_value=ctb_subtable_value + # no subtable + # create stream super table and child table + tdLog.info("create stream super table and child table") self.tdCom.create_stream(stream_name=f'{self.stb_name}{self.tdCom.stream_suffix}', des_table=self.stb_stream_des_table, source_sql=f'select _irowts as irowts,tbname as table_name, _isfilled as isfilled, {funciton_name} as {funciton_name_alias} from {self.stb_name} {partition_elm} every({self.tdCom.dataDict["interval"]}s)', trigger_mode=trigger_mode, fill_value=fill_value, fill_history_value=fill_history_value,ignore_expired=ignore_expired,ignore_update=ignore_update) self.tdCom.create_stream(stream_name=f'{self.ctb_name}{self.tdCom.stream_suffix}', des_table=self.ctb_stream_des_table, source_sql=f'select _irowts as irowts, tbname as table_name, _isfilled as isfilled, {funciton_name} as {funciton_name_alias} from {self.ctb_name} {partition_elm} every({self.tdCom.dataDict["interval"]}s)', trigger_mode=trigger_mode, fill_value=fill_value, fill_history_value=fill_history_value,ignore_expired=ignore_expired,ignore_update=ignore_update) + + # creat stream set filter of tag and tbname + tdLog.info("create stream with tag and tbname filter") + tag_t1_value = self.tdCom.tag_value_list[0] + where_tag = f'where t1 = {tag_t1_value}' + where_tbname = f'where tbname="{self.ctb_name}"' + print(f"tag: {tag_t1_value}") + + self.stb_stream_des_where_tag_table = f'{self.stb_name}_where_tag{self.tdCom.des_table_suffix}' + self.tdCom.create_stream(stream_name=f'{self.stb_name}_where_tag{self.tdCom.stream_suffix}', des_table=self.stb_stream_des_where_tag_table, source_sql=f'select _irowts as irowts,tbname as table_name, _isfilled as isfilled, {funciton_name} as {funciton_name_alias} from {self.stb_name} {where_tag} {partition_elm} every({self.tdCom.dataDict["interval"]}s)', trigger_mode=trigger_mode, fill_value=fill_value, fill_history_value=fill_history_value,ignore_expired=ignore_expired,ignore_update=ignore_update) + self.stb_stream_des_where_tbname_table = f'{self.stb_name}_where_tbname{self.tdCom.des_table_suffix}' + self.tdCom.create_stream(stream_name=f'{self.stb_name}_where_tbname{self.tdCom.stream_suffix}', des_table=self.stb_stream_des_where_tbname_table, source_sql=f'select _irowts as irowts,tbname as table_name, _isfilled as isfilled, {funciton_name} as {funciton_name_alias} from {self.stb_name} {where_tbname} {partition_elm} every({self.tdCom.dataDict["interval"]}s)', trigger_mode=trigger_mode, fill_value=fill_value, fill_history_value=fill_history_value,ignore_expired=ignore_expired,ignore_update=ignore_update) + + # set partition by tag and column + if partition: + tdLog.info("create stream with partition by tag and tbname ") + partition_elm_new = f'partition by {partition}, t1' + self.tdCom.create_stream(stream_name=f'{self.stb_name}_partition_tag{self.tdCom.stream_suffix}', des_table=f'{self.stb_name}_partition_tag{self.tdCom.des_table_suffix}', source_sql=f'select _irowts as irowts, tbname as table_name, _isfilled as isfilled, {funciton_name} as {funciton_name_alias} from {self.stb_name} {partition_elm_new} every({self.tdCom.dataDict["interval"]}s)', trigger_mode=trigger_mode, fill_value=fill_value, fill_history_value=fill_history_value,ignore_expired=ignore_expired,ignore_update=ignore_update) + partition_elm_new = f'partition by {partition}, c1' + self.tdCom.create_stream(stream_name=f'{self.stb_name}_partition_column1{self.tdCom.stream_suffix}', des_table=f'{self.stb_name}_partition_column1{self.tdCom.des_table_suffix}', source_sql=f'select _irowts as irowts, tbname as table_name, c1 as c_c1, _isfilled as isfilled, {funciton_name} as {funciton_name_alias} from {self.stb_name} {partition_elm_new} every({self.tdCom.dataDict["interval"]}s)', trigger_mode=trigger_mode, fill_value=fill_value, fill_history_value=fill_history_value,ignore_expired=ignore_expired,ignore_update=ignore_update) + partition_elm_new = f'partition by {partition}, c2' + self.tdCom.create_stream(stream_name=f'{self.stb_name}_partition_column2{self.tdCom.stream_suffix}', des_table=f'{self.stb_name}_partition_column2{self.tdCom.des_table_suffix}', source_sql=f'select _irowts as irowts, tbname as table_name, c2 as c_c2, _isfilled as isfilled, {funciton_name} as {funciton_name_alias} from {self.stb_name} {partition_elm_new} every({self.tdCom.dataDict["interval"]}s)', trigger_mode=trigger_mode, fill_value=fill_value, fill_history_value=fill_history_value,ignore_expired=ignore_expired,ignore_update=ignore_update) + + if fill_value: if "value" in fill_value.lower(): fill_value='VALUE,1,2,3,4,5,6,7,8,9,10,11' + # create stream general table + tdLog.info("create stream general table") self.tdCom.create_stream(stream_name=f'{self.tb_name}{self.tdCom.stream_suffix}', des_table=self.tb_stream_des_table, source_sql=f'select _irowts as irowts,tbname as table_name, _isfilled as isfilled, {funciton_name} as {funciton_name_alias} from {self.tb_name} every({self.tdCom.dataDict["interval"]}s)', trigger_mode=trigger_mode, fill_value=fill_value, fill_history_value=fill_history_value,ignore_expired=ignore_expired,ignore_update=ignore_update) + + self.tdCom.date_time = self.tdCom.genTs(precision=self.tdCom.precision)[0] start_time = self.tdCom.date_time - time.sleep(1) start_force_ts = str(0) for i in range(self.tdCom.range_count): ts_value = str(self.tdCom.date_time+self.tdCom.dataDict["interval"])+f'+{i*10}s' + print(ts_value) if start_force_ts == "0": start_force_ts = ts_value ts_cast_delete_value = self.tdCom.time_cast(ts_value) @@ -183,7 +221,13 @@ def force_window_close(self, interval, partition="tbname", funciton_name="", fun self.tdCom.sinsert_rows(tbname=self.tb_name, ts_value=history_ts) self.tdCom.sinsert_rows(tbname=self.ctb_name, ts_value=future_ts) self.tdCom.sinsert_rows(tbname=self.tb_name, ts_value=future_ts) - self.tdCom.date_time = start_time + + # get query time range using interval count windows + tdSql.query(f'select _wstart, _wend ,last(ts) from {self.stb_name} where ts >= {start_force_ts} and ts <= {end_ts} partition by tbname interval({self.tdCom.dataDict["interval"]}s)fill ({fill_value}) ') + end_new_ts = tdSql.getData(tdSql.queryRows-1, 1) + tdSql.execute(f"insert into {self.ctb_name} (ts,c1) values(\"{end_new_ts}\",-102) ") + tdSql.execute(f"insert into {self.tb_name} (ts,c1) values(\"{end_new_ts}\",-51) ") + for i in range(self.tdCom.range_count): ts_value = str(self.tdCom.date_time+self.tdCom.dataDict["interval"])+f'+{i*10}s' ts_cast_delete_value = self.tdCom.time_cast(ts_value) @@ -194,21 +238,29 @@ def force_window_close(self, interval, partition="tbname", funciton_name="", fun if self.delete: self.tdCom.sdelete_rows(tbname=self.ctb_name, start_ts=self.tdCom.time_cast(start_time), end_ts=ts_cast_delete_value) self.tdCom.sdelete_rows(tbname=self.tb_name, start_ts=self.tdCom.time_cast(start_time), end_ts=ts_cast_delete_value) + + # wait for the stream to process the data + time.sleep(self.tdCom.dataDict["interval"]*(final_range_count+2)) + + # check the data for tbname in [self.stb_name, self.ctb_name, self.tb_name]: + print(tbname) + tdSql.query(f'select _wstart, _wend ,last(ts) from {tbname} where ts >= {start_force_ts} and ts <= {end_ts} partition by tbname interval({self.tdCom.dataDict["interval"]}s)fill ({fill_value}) ') + start_new_ts = tdSql.getData(0, 1) if tbname != self.tb_name: if "value" in fill_value.lower(): fill_value='VALUE,1,2,3,6,7,8,9,10,11,1,2,3,4,5,6,7,8,9,10,11' if partition == "tbname": - self.tdCom.check_query_data(f'select irowts, table_name, isfilled, {funciton_name_alias} from {tbname}{self.tdCom.des_table_suffix} where irowts >= {start_force_ts} and irowts <= {end_ts} order by irowts', f'select _irowts as irowts ,tbname as table_name, _isfilled as isfilled , {funciton_name} as {funciton_name_alias} from {tbname} partition by {partition} range({start_force_ts},{end_ts}) every({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by irowts', fill_value=fill_value) - else: - self.tdCom.check_query_data(f'select wstart, {self.tdCom.fill_stb_output_select_str} from {tbname}{self.tdCom.des_table_suffix} where `min(c1)` is not Null order by wstart,`min(c1)`', f'select * from (select _wstart AS wstart, {self.tdCom.fill_stb_source_select_str} from {tbname} where ts >= {start_ts} and ts <= {end_ts} partition by {partition} interval({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by wstart) where `min(c1)` is not Null order by wstart,`min(c1)`', fill_value=fill_value) + # print(self.tdCom.dataDict["interval"]*(final_range_count+2)) + self.tdCom.check_query_data(f'select irowts, table_name, isfilled, {funciton_name_alias} from {tbname}{self.tdCom.des_table_suffix} where irowts >= {start_force_ts} and irowts <= "{end_new_ts}" order by irowts', f'select _irowts as irowts ,tbname as table_name, _isfilled as isfilled , {funciton_name} as {funciton_name_alias} from {tbname} partition by {partition} range("{start_new_ts}","{end_new_ts}") every({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by irowts', fill_value=fill_value) + # check tag and tbname filter + self.tdCom.check_query_data(f'select irowts, table_name, isfilled, {funciton_name_alias} from {self.stb_stream_des_where_tag_table} where irowts >= {start_force_ts} and irowts <= "{end_new_ts}" order by irowts', f'select _irowts as irowts ,tbname as table_name, _isfilled as isfilled , {funciton_name} as {funciton_name_alias} from {tbname} {where_tag} partition by {partition} range("{start_new_ts}","{end_new_ts}") every({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by irowts', fill_value=fill_value) + self.tdCom.check_query_data(f'select irowts, table_name, isfilled, {funciton_name_alias} from {self.stb_stream_des_where_tbname_table} where irowts >= {start_force_ts} and irowts <= "{end_new_ts}" order by irowts', f'select _irowts as irowts ,tbname as table_name, _isfilled as isfilled , {funciton_name} as {funciton_name_alias} from {tbname} {where_tbname} partition by {partition} range("{start_new_ts}","{end_new_ts}") every({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by irowts', fill_value=fill_value) else: if "value" in fill_value.lower(): - fill_value='VALUE,1,2,3,6,7,8,9,10,11' + fill_value='VALUE,1' if partition == "tbname": - self.tdCom.check_query_data(f'select wstart, {self.tdCom.fill_tb_output_select_str} from {tbname}{self.tdCom.des_table_suffix} order by wstart', f'select _wstart AS wstart, {self.tdCom.fill_tb_source_select_str} from {tbname} where ts >= {start_ts} and ts <= {end_ts} partition by {partition} interval({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by wstart', fill_value=fill_value) - else: - self.tdCom.check_query_data(f'select wstart, {self.tdCom.fill_tb_output_select_str} from {tbname}{self.tdCom.des_table_suffix} where `min(c1)` is not Null order by wstart,`min(c1)`', f'select * from (select _wstart AS wstart, {self.tdCom.fill_tb_source_select_str} from {tbname} where ts >= {start_ts} and ts <= {end_ts} partition by {partition} interval({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by wstart) where `min(c1)` is not Null order by wstart,`min(c1)`', fill_value=fill_value) + self.tdCom.check_query_data(f'select irowts, isfilled, {funciton_name_alias} from {tbname}{self.tdCom.des_table_suffix} where irowts >= {start_force_ts} and irowts <= "{end_new_ts}" order by irowts', f'select _irowts as irowts , _isfilled as isfilled , {funciton_name} as {funciton_name_alias} from {tbname} partition by {partition} range("{start_new_ts}","{end_new_ts}") every({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by irowts', fill_value=fill_value) if self.delete: self.tdCom.sdelete_rows(tbname=self.ctb_name, start_ts=start_ts, end_ts=ts_cast_delete_value) @@ -232,16 +284,16 @@ def force_window_close(self, interval, partition="tbname", funciton_name="", fun def run(self): - self.force_window_close(interval=random.randint(10, 15), partition="tbname", funciton_name="interp(c1)", funciton_name_alias="intp_c1" ,delete=False, ignore_update=1, fill_value="PREV") - self.force_window_close(interval=random.randint(10, 15), partition="c1", ignore_update=1) - self.force_window_close(interval=random.randint(10, 15), partition="abs(c1)", ignore_update=1) - self.force_window_close(interval=random.randint(10, 15), partition=None, delete=True) - self.force_window_close(interval=random.randint(10, 15), partition=self.tdCom.stream_case_when_tbname, case_when=f'case when {self.tdCom.stream_case_when_tbname} = tbname then {self.tdCom.partition_tbname_alias} else tbname end') - self.force_window_close(interval=random.randint(10, 15), partition="tbname", fill_history_value=1, fill_value="NULL") - for fill_value in ["NULL", "PREV", "NEXT", "LINEAR", "VALUE,1,2,3,4,5,6,7,8,9,10,11,1,2,3,4,5,6,7,8,9,10,11"]: - # for fill_value in ["PREV", "NEXT", "LINEAR", "VALUE,1,2,3,4,5,6,7,8,9,10,11,1,2,3,4,5,6,7,8,9,10,11"]: - self.at_once_interval(interval=random.randint(10, 15), partition="tbname", fill_value=fill_value) - self.at_once_interval(interval=random.randint(10, 15), partition="tbname", fill_value=fill_value, delete=True) + self.force_window_close(interval=10, partition="tbname", funciton_name="interp(c1)", funciton_name_alias="intp_c1" ,delete=False, ignore_update=1, fill_value="PREV") + # self.force_window_close(interval=random.randint(10, 15), partition="c1", ignore_update=1) + # self.force_window_close(interval=random.randint(10, 15), partition="abs(c1)", ignore_update=1) + # self.force_window_close(interval=random.randint(10, 15), partition=None, delete=True) + # self.force_window_close(interval=random.randint(10, 15), partition=self.tdCom.stream_case_when_tbname, case_when=f'case when {self.tdCom.stream_case_when_tbname} = tbname then {self.tdCom.partition_tbname_alias} else tbname end') + # self.force_window_close(interval=random.randint(10, 15), partition="tbname", fill_history_value=1, fill_value="NULL") + # for fill_value in ["NULL", "PREV", "NEXT", "LINEAR", "VALUE,1,2,3,4,5,6,7,8,9,10,11,1,2,3,4,5,6,7,8,9,10,11"]: + # # for fill_value in ["PREV", "NEXT", "LINEAR", "VALUE,1,2,3,4,5,6,7,8,9,10,11,1,2,3,4,5,6,7,8,9,10,11"]: + # self.at_once_interval(interval=random.randint(10, 15), partition="tbname", fill_value=fill_value) + # self.at_once_interval(interval=random.randint(10, 15), partition="tbname", fill_value=fill_value, delete=True) def stop(self): tdSql.close() From 69e930be6646561d4e190961c9342602ae0a4cbc Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Mon, 28 Oct 2024 10:18:48 +0800 Subject: [PATCH 343/695] Revert "enh(tsdb/cache): move last ref array into shard instance" This reverts commit 39af874ff8e8c50ae9efaeeee030518f5538914e. --- source/util/src/tlrucache.c | 36 +++++++++++++----------------------- 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/source/util/src/tlrucache.c b/source/util/src/tlrucache.c index bccf37c7d6e0..69832cd46c68 100644 --- a/source/util/src/tlrucache.c +++ b/source/util/src/tlrucache.c @@ -14,12 +14,12 @@ */ #define _DEFAULT_SOURCE -#include "tlrucache.h" #include "os.h" #include "taoserror.h" #include "tarray.h" #include "tdef.h" #include "tlog.h" +#include "tlrucache.h" #include "tutil.h" typedef struct SLRUEntry SLRUEntry; @@ -248,7 +248,6 @@ struct SLRUCacheShard { SLRUEntryTable table; size_t usage; // Memory size for entries residing in the cache. size_t lruUsage; // Memory size for entries residing only in the LRU list. - SArray *lastReferenceList; TdThreadMutex mutex; }; @@ -368,34 +367,25 @@ static void taosLRUCacheShardCleanup(SLRUCacheShard *shard) { (void)taosThreadMutexDestroy(&shard->mutex); taosLRUEntryTableCleanup(&shard->table); - - taosArrayDestroy(shard->lastReferenceList); } static LRUStatus taosLRUCacheShardInsertEntry(SLRUCacheShard *shard, SLRUEntry *e, LRUHandle **handle, bool freeOnFail) { LRUStatus status = TAOS_LRU_STATUS_OK; + SArray *lastReferenceList = taosArrayInit(16, POINTER_BYTES); + if (!lastReferenceList) { + taosLRUEntryFree(e); + return TAOS_LRU_STATUS_FAIL; + } (void)taosThreadMutexLock(&shard->mutex); - if (!shard->lastReferenceList) { - shard->lastReferenceList = taosArrayInit(16, POINTER_BYTES); - if (!shard->lastReferenceList) { - taosLRUEntryFree(e); - (void)taosThreadMutexUnlock(&shard->mutex); - - return TAOS_LRU_STATUS_FAIL; - } - } else { - taosArrayClear(shard->lastReferenceList); - } - - taosLRUCacheShardEvictLRU(shard, e->totalCharge, shard->lastReferenceList); + taosLRUCacheShardEvictLRU(shard, e->totalCharge, lastReferenceList); if (shard->usage + e->totalCharge > shard->capacity && (shard->strictCapacity || handle == NULL)) { TAOS_LRU_ENTRY_SET_IN_CACHE(e, false); if (handle == NULL) { - if (!taosArrayPush(shard->lastReferenceList, &e)) { + if (!taosArrayPush(lastReferenceList, &e)) { taosLRUEntryFree(e); goto _exit; } @@ -423,7 +413,7 @@ static LRUStatus taosLRUCacheShardInsertEntry(SLRUCacheShard *shard, SLRUEntry * taosLRUCacheShardLRURemove(shard, old); shard->usage -= old->totalCharge; - if (!taosArrayPush(shard->lastReferenceList, &old)) { + if (!taosArrayPush(lastReferenceList, &old)) { taosLRUEntryFree(e); taosLRUEntryFree(old); goto _exit; @@ -444,11 +434,12 @@ static LRUStatus taosLRUCacheShardInsertEntry(SLRUCacheShard *shard, SLRUEntry * _exit: (void)taosThreadMutexUnlock(&shard->mutex); - for (int i = 0; i < taosArrayGetSize(shard->lastReferenceList); ++i) { - SLRUEntry *entry = taosArrayGetP(shard->lastReferenceList, i); + for (int i = 0; i < taosArrayGetSize(lastReferenceList); ++i) { + SLRUEntry *entry = taosArrayGetP(lastReferenceList, i); taosLRUEntryFree(entry); } + taosArrayDestroy(lastReferenceList); return status; } @@ -742,8 +733,7 @@ void taosLRUCacheCleanup(SLRUCache *cache) { } LRUStatus taosLRUCacheInsert(SLRUCache *cache, const void *key, size_t keyLen, void *value, size_t charge, - _taos_lru_deleter_t deleter, _taos_lru_overwriter_t overwriter, LRUHandle **handle, - LRUPriority priority, void *ud) { + _taos_lru_deleter_t deleter, _taos_lru_overwriter_t overwriter, LRUHandle **handle, LRUPriority priority, void *ud) { uint32_t hash = TAOS_LRU_CACHE_SHARD_HASH32(key, keyLen); uint32_t shardIndex = hash & cache->shardedCache.shardMask; From 0bc5f8cb884496bc47d4598016cee31c26e31224 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Mon, 28 Oct 2024 10:20:08 +0800 Subject: [PATCH 344/695] fix(stream): relase the task. --- source/dnode/mnode/impl/src/mndScheduler.c | 19 +++++++++++-------- source/libs/stream/src/streamCheckpoint.c | 1 + source/libs/stream/src/streamStartTask.c | 6 ++++-- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndScheduler.c b/source/dnode/mnode/impl/src/mndScheduler.c index 4f72b26a5efd..8d33e61733be 100644 --- a/source/dnode/mnode/impl/src/mndScheduler.c +++ b/source/dnode/mnode/impl/src/mndScheduler.c @@ -248,7 +248,7 @@ static int32_t doAddSinkTask(SStreamObj* pStream, SMnode* pMnode, SVgObj* pVgrou return code; } - mDebug("doAddSinkTask taskId:%s, vgId:%d, isFillHistory:%d", pTask->id.idStr, pVgroup->vgId, isFillhistory); + mDebug("doAddSinkTask taskId:%s, %p vgId:%d, isFillHistory:%d", pTask->id.idStr, pTask, pVgroup->vgId, isFillhistory); pTask->info.nodeId = pVgroup->vgId; pTask->info.epSet = mndGetVgroupEpset(pMnode, pVgroup); @@ -364,12 +364,13 @@ static int32_t buildSourceTask(SStreamObj* pStream, SEpSet* pEpset, bool isFillh static void addNewTaskList(SStreamObj* pStream) { SArray* pTaskList = taosArrayInit(0, POINTER_BYTES); if (taosArrayPush(pStream->tasks, &pTaskList) == NULL) { - mError("failed to put array"); + mError("failed to put into array"); } + if (pStream->conf.fillHistory) { pTaskList = taosArrayInit(0, POINTER_BYTES); if (taosArrayPush(pStream->pHTasksList, &pTaskList) == NULL) { - mError("failed to put array"); + mError("failed to put into array"); } } } @@ -402,7 +403,8 @@ static int32_t doAddSourceTask(SMnode* pMnode, SSubplan* plan, SStreamObj* pStre return code; } - mDebug("doAddSourceTask taskId:%s, vgId:%d, isFillHistory:%d", pTask->id.idStr, pVgroup->vgId, isFillhistory); + mDebug("doAddSourceTask taskId:%s, %p vgId:%d, isFillHistory:%d", pTask->id.idStr, pTask, pVgroup->vgId, + isFillhistory); if (pStream->conf.fillHistory) { haltInitialTaskStatus(pTask, plan, isFillhistory); @@ -512,19 +514,20 @@ static int32_t doAddAggTask(SStreamObj* pStream, SMnode* pMnode, SSubplan* plan, SSnodeObj* pSnode, bool isFillhistory, bool useTriggerParam) { int32_t code = 0; SStreamTask* pTask = NULL; + const char* id = NULL; code = buildAggTask(pStream, pEpset, isFillhistory, useTriggerParam, &pTask); if (code != TSDB_CODE_SUCCESS) { return code; } + id = pTask->id.idStr; if (pSnode != NULL) { code = mndAssignStreamTaskToSnode(pMnode, pTask, plan, pSnode); - mDebug("doAddAggTask taskId:%s, snode id:%d, isFillHistory:%d", pTask->id.idStr, pSnode->id, isFillhistory); - + mDebug("doAddAggTask taskId:%s, %p snode id:%d, isFillHistory:%d", id, pTask, pSnode->id, isFillhistory); } else { code = mndAssignStreamTaskToVgroup(pMnode, pTask, plan, pVgroup); - mDebug("doAddAggTask taskId:%s, vgId:%d, isFillHistory:%d", pTask->id.idStr, pVgroup->vgId, isFillhistory); + mDebug("doAddAggTask taskId:%s, %p vgId:%d, isFillHistory:%d", id, pTask, pVgroup->vgId, isFillhistory); } return code; } @@ -678,7 +681,7 @@ static int32_t doScheduleStream(SStreamObj* pStream, SMnode* pMnode, SQueryPlan* if (numOfPlanLevel > 1 || externalTargetDB || multiTarget || pStream->fixedSinkVgId) { // add extra sink hasExtraSink = true; - int32_t code = addSinkTask(pMnode, pStream, pEpset); + code = addSinkTask(pMnode, pStream, pEpset); if (code != TSDB_CODE_SUCCESS) { return code; } diff --git a/source/libs/stream/src/streamCheckpoint.c b/source/libs/stream/src/streamCheckpoint.c index af2d8b559b48..d1b57c32b975 100644 --- a/source/libs/stream/src/streamCheckpoint.c +++ b/source/libs/stream/src/streamCheckpoint.c @@ -1037,6 +1037,7 @@ void checkpointTriggerMonitorFn(void* param, void* tmrId) { if (++pTmrInfo->activeCounter < 50) { streamTmrStart(checkpointTriggerMonitorFn, 200, param, streamTimer, &pTmrInfo->tmrHandle, vgId, "trigger-recv-monitor"); + doCleanup(pTask, pNotSendList); return; } diff --git a/source/libs/stream/src/streamStartTask.c b/source/libs/stream/src/streamStartTask.c index ee9117ddc822..3518b8681d8b 100644 --- a/source/libs/stream/src/streamStartTask.c +++ b/source/libs/stream/src/streamStartTask.c @@ -355,7 +355,7 @@ int32_t streamMetaStartOneTask(SStreamMeta* pMeta, int64_t streamId, int32_t tas // fill-history task can only be launched by related stream tasks. STaskExecStatisInfo* pInfo = &pTask->execInfo; if (pTask->info.fillHistory == 1) { - stError("s-task:0x%x vgId:%d fill-histroy task, not start here", taskId, vgId); + stError("s-task:0x%x vgId:%d fill-history task, not start here", taskId, vgId); streamMetaReleaseTask(pMeta, pTask); return TSDB_CODE_SUCCESS; } @@ -363,6 +363,7 @@ int32_t streamMetaStartOneTask(SStreamMeta* pMeta, int64_t streamId, int32_t tas // the start all tasks procedure may happen to start the newly deployed stream task, and results in the // concurrently start this task by two threads. streamMutexLock(&pTask->lock); + SStreamTaskState status = streamTaskGetStatus(pTask); if (status.state != TASK_STATUS__UNINIT) { stError("s-task:0x%x vgId:%d status:%s not uninit status, not start stream task", taskId, vgId, status.name); @@ -379,6 +380,7 @@ int32_t streamMetaStartOneTask(SStreamMeta* pMeta, int64_t streamId, int32_t tas if(pTask->status.downstreamReady != 0) { stFatal("s-task:0x%x downstream should be not ready, but it ready here, internal error happens", taskId); + streamMetaReleaseTask(pMeta, pTask); return TSDB_CODE_STREAM_INTERNAL_ERROR; } @@ -395,7 +397,7 @@ int32_t streamMetaStartOneTask(SStreamMeta* pMeta, int64_t streamId, int32_t tas streamMutexUnlock(&pTask->lock); } - // concurrently start task may cause the later started task be failed, and also failed to added into meta result. + // concurrently start task may cause the latter started task be failed, and also failed to added into meta result. if (code == TSDB_CODE_SUCCESS) { code = streamTaskHandleEvent(pTask->status.pSM, TASK_EVENT_INIT); if (code != TSDB_CODE_SUCCESS) { From b89d01a11f1b013e4cebd406d0d4305b32ee1bd1 Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Mon, 28 Oct 2024 10:46:59 +0800 Subject: [PATCH 345/695] more detailed upload formular --- docs/zh/08-operation/12-multi.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/zh/08-operation/12-multi.md b/docs/zh/08-operation/12-multi.md index 623761322366..9b1e7fc7bad6 100644 --- a/docs/zh/08-operation/12-multi.md +++ b/docs/zh/08-operation/12-multi.md @@ -121,7 +121,7 @@ s3migrate database ; 当 TSDB 时序数据超过 `s3_keeplocal` 参数指定的时间,相关的数据文件会被切分成多个文件块,每个文件块的默认大小是 1G 字节 (`s3_chunksize * tsdb_pagesize`)。除了最后一个文件块保留在本地文件系统外,其余的文件块会被上传到对象存储服务。 ```math -上传次数 = 数据文件大小 / 每个文件块大小 - 1 +上传次数 = 数据文件大小 / (s3_chunksize * tsdb_pagesize) - 1 ``` 在创建数据库时,可以通过 `s3_chunksize` 参数调整每个文件块的大小,从而控制每个数据文件的上传次数。 From 424e574e94b2250b536c9d6418dff8fb23d05891 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Mon, 28 Oct 2024 11:09:56 +0800 Subject: [PATCH 346/695] fix issue --- source/libs/executor/src/executor.c | 1 + source/libs/executor/src/streamtimesliceoperator.c | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/source/libs/executor/src/executor.c b/source/libs/executor/src/executor.c index a5211f2da0a8..30f23f60da93 100644 --- a/source/libs/executor/src/executor.c +++ b/source/libs/executor/src/executor.c @@ -1099,6 +1099,7 @@ static int32_t getOpratorIntervalInfo(SOperatorInfo* pOperator, int64_t* pWaterM SStreamScanInfo* pScanOp = (SStreamScanInfo*) pOperator->info; *pWaterMark = pScanOp->twAggSup.waterMark; *pInterval = pScanOp->interval; + *pLastWindow = pScanOp->lastScanRange; return TSDB_CODE_SUCCESS; } diff --git a/source/libs/executor/src/streamtimesliceoperator.c b/source/libs/executor/src/streamtimesliceoperator.c index 3d7219a26285..07c96d38df94 100644 --- a/source/libs/executor/src/streamtimesliceoperator.c +++ b/source/libs/executor/src/streamtimesliceoperator.c @@ -1315,8 +1315,9 @@ static void doStreamTimeSliceImpl(SOperatorInfo* pOperator, SSDataBlock* pBlock) pkLen = colDataGetRowLength(pPkColDataInfo, startPos); } - if (pInfo->ignoreExpiredData && checkExpiredData(&pAggSup->stateStore, pAggSup->pUpdateInfo, &pInfo->twAggSup, - pBlock->info.id.uid, tsCols[startPos], pPkVal, pkLen)) { + if (pInfo->twAggSup.calTrigger != STREAM_TRIGGER_FORCE_WINDOW_CLOSE && pInfo->ignoreExpiredData && + checkExpiredData(&pAggSup->stateStore, pAggSup->pUpdateInfo, &pInfo->twAggSup, pBlock->info.id.uid, + tsCols[startPos], pPkVal, pkLen)) { qDebug("===stream===ignore expired data, window end ts:%" PRId64 ", maxts - wartermak:%" PRId64, tsCols[startPos], pInfo->twAggSup.maxTs - pInfo->twAggSup.waterMark); continue; From d34fc78a2265cf507fcec72d81008c3f3faed1c4 Mon Sep 17 00:00:00 2001 From: Shungang Li Date: Mon, 28 Oct 2024 11:18:06 +0800 Subject: [PATCH 347/695] fix: (last) eliminate redundant logs caused by incorrect return results --- source/dnode/vnode/src/tsdb/tsdbCache.c | 91 ++++++++++++------------- 1 file changed, 43 insertions(+), 48 deletions(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbCache.c b/source/dnode/vnode/src/tsdb/tsdbCache.c index 5583e464ed40..cbb4f9e873d5 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCache.c +++ b/source/dnode/vnode/src/tsdb/tsdbCache.c @@ -723,34 +723,32 @@ static int32_t tsdbCacheDropTableColumn(STsdb *pTsdb, int64_t uid, int16_t cid, rocksdb_writebatch_t *wb = pTsdb->rCache.writebatch; { SLastCol *pLastCol = NULL; - code = tsdbCacheDeserialize(values_list[0], values_list_sizes[0], &pLastCol); - if (code == TSDB_CODE_INVALID_PARA) { - tsdbTrace("vgId:%d, %s deserialize failed at line %d since %s", TD_VID(pTsdb->pVnode), __func__, __LINE__, - tstrerror(code)); - } else if (code != TSDB_CODE_SUCCESS) { - tsdbError("vgId:%d, %s deserialize failed at line %d since %s", TD_VID(pTsdb->pVnode), __func__, __LINE__, - tstrerror(code)); - goto _exit; - } - if (NULL != pLastCol) { - rocksdb_writebatch_delete(wb, keys_list[0], klen); + if (values_list[0] != NULL) { + code = tsdbCacheDeserialize(values_list[0], values_list_sizes[0], &pLastCol); + if (code != TSDB_CODE_SUCCESS) { + tsdbError("vgId:%d, %s deserialize failed at line %d since %s", TD_VID(pTsdb->pVnode), __func__, __LINE__, + tstrerror(code)); + goto _exit; + } + if (NULL != pLastCol) { + rocksdb_writebatch_delete(wb, keys_list[0], klen); + } + taosMemoryFreeClear(pLastCol); } - taosMemoryFreeClear(pLastCol); pLastCol = NULL; - code = tsdbCacheDeserialize(values_list[1], values_list_sizes[1], &pLastCol); - if (code == TSDB_CODE_INVALID_PARA) { - tsdbTrace("vgId:%d, %s deserialize failed at line %d since %s", TD_VID(pTsdb->pVnode), __func__, __LINE__, - tstrerror(code)); - } else if (code != TSDB_CODE_SUCCESS) { - tsdbError("vgId:%d, %s deserialize failed at line %d since %s", TD_VID(pTsdb->pVnode), __func__, __LINE__, - tstrerror(code)); - goto _exit; - } - if (NULL != pLastCol) { - rocksdb_writebatch_delete(wb, keys_list[1], klen); + if (values_list[1] != NULL) { + code = tsdbCacheDeserialize(values_list[1], values_list_sizes[1], &pLastCol); + if (code != TSDB_CODE_SUCCESS) { + tsdbError("vgId:%d, %s deserialize failed at line %d since %s", TD_VID(pTsdb->pVnode), __func__, __LINE__, + tstrerror(code)); + goto _exit; + } + if (NULL != pLastCol) { + rocksdb_writebatch_delete(wb, keys_list[1], klen); + } + taosMemoryFreeClear(pLastCol); } - taosMemoryFreeClear(pLastCol); rocksdb_free(values_list[0]); rocksdb_free(values_list[1]); @@ -1218,14 +1216,13 @@ static int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, SArray SColVal *pColVal = &updCtx->colVal; SLastCol *pLastCol = NULL; - code = tsdbCacheDeserialize(values_list[i], values_list_sizes[i], &pLastCol); - if (code == TSDB_CODE_INVALID_PARA) { - tsdbTrace("vgId:%d, %s deserialize failed at line %d since %s", TD_VID(pTsdb->pVnode), __func__, __LINE__, - tstrerror(code)); - } else if (code != TSDB_CODE_SUCCESS) { - tsdbError("vgId:%d, %s deserialize failed at line %d since %s", TD_VID(pTsdb->pVnode), __func__, __LINE__, - tstrerror(code)); - goto _exit; + if (values_list[i] != NULL) { + code = tsdbCacheDeserialize(values_list[i], values_list_sizes[i], &pLastCol); + if (code != TSDB_CODE_SUCCESS) { + tsdbError("vgId:%d, %s deserialize failed at line %d since %s", TD_VID(pTsdb->pVnode), __func__, __LINE__, + tstrerror(code)); + goto _exit; + } } /* if (code) { @@ -1692,14 +1689,13 @@ static int32_t tsdbCacheLoadFromRocks(STsdb *pTsdb, tb_uid_t uid, SArray *pLastA continue; } - code = tsdbCacheDeserialize(values_list[i], values_list_sizes[i], &pLastCol); - if (code == TSDB_CODE_INVALID_PARA) { - tsdbTrace("vgId:%d, %s deserialize failed at line %d since %s", TD_VID(pTsdb->pVnode), __func__, __LINE__, - tstrerror(code)); - } else if (code != TSDB_CODE_SUCCESS) { - tsdbError("vgId:%d, %s deserialize failed at line %d since %s", TD_VID(pTsdb->pVnode), __func__, __LINE__, - tstrerror(code)); - goto _exit; + if (values_list[i] != NULL) { + code = tsdbCacheDeserialize(values_list[i], values_list_sizes[i], &pLastCol); + if (code != TSDB_CODE_SUCCESS) { + tsdbError("vgId:%d, %s deserialize failed at line %d since %s", TD_VID(pTsdb->pVnode), __func__, __LINE__, + tstrerror(code)); + goto _exit; + } } SLastCol *pToFree = pLastCol; SIdxKey *idxKey = &((SIdxKey *)TARRAY_DATA(remainCols))[j]; @@ -1959,14 +1955,13 @@ int32_t tsdbCacheDel(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSKEY sKey, TSKE rocksdb_writebatch_t *wb = pTsdb->rCache.writebatch; for (int i = 0; i < numKeys; ++i) { SLastCol *pLastCol = NULL; - code = tsdbCacheDeserialize(values_list[i], values_list_sizes[i], &pLastCol); - if (code == TSDB_CODE_INVALID_PARA) { - tsdbTrace("vgId:%d, %s deserialize failed at line %d since %s", TD_VID(pTsdb->pVnode), __func__, __LINE__, - tstrerror(code)); - } else if (code != TSDB_CODE_SUCCESS) { - tsdbError("vgId:%d, %s deserialize failed at line %d since %s", TD_VID(pTsdb->pVnode), __func__, __LINE__, - tstrerror(code)); - goto _exit; + if (values_list[i] != NULL) { + code = tsdbCacheDeserialize(values_list[i], values_list_sizes[i], &pLastCol); + if (code != TSDB_CODE_SUCCESS) { + tsdbError("vgId:%d, %s deserialize failed at line %d since %s", TD_VID(pTsdb->pVnode), __func__, __LINE__, + tstrerror(code)); + goto _exit; + } } SIdxKey *idxKey = taosArrayGet(remainCols, i); SLastKey *pLastKey = &idxKey->key; From bb733ca52b89ff272cde80d29ee91b6238aed8d4 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Mon, 28 Oct 2024 11:18:31 +0800 Subject: [PATCH 348/695] fix issue --- source/libs/executor/src/scanoperator.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 392cb8f5c7ae..a14db482b20e 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -4583,6 +4583,8 @@ int32_t createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhysiNode* code = createSpecialDataBlock(STREAM_CHECKPOINT, &pInfo->pCheckpointRes); QUERY_CHECK_CODE(code, lino, _error); + SET_WIN_KEY_INVALID(pInfo->lastScanRange.skey); + SET_WIN_KEY_INVALID(pInfo->lastScanRange.ekey); // for stream if (pTaskInfo->streamInfo.pState) { void* buff = NULL; From b55694ab19402a7dd435e10541ae0e180344f4da Mon Sep 17 00:00:00 2001 From: Shungang Li Date: Mon, 28 Oct 2024 11:25:00 +0800 Subject: [PATCH 349/695] docs: 'ttlChangeOnWrite' default value --- docs/zh/14-reference/01-components/01-taosd.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/zh/14-reference/01-components/01-taosd.md b/docs/zh/14-reference/01-components/01-taosd.md index fdc7e241639a..d09eb4764d36 100644 --- a/docs/zh/14-reference/01-components/01-taosd.md +++ b/docs/zh/14-reference/01-components/01-taosd.md @@ -225,14 +225,14 @@ lossyColumns float|double | :--------------: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | | enableCoreFile | crash 时是否生成 core 文件;0: 不生成,1:生成;默认值 为 1; 不同的启动方式,生成 core 文件的目录如下:1、systemctl start taosd 启动:生成的 core 在根目录下
      2、手动启动,就在 taosd 执行目录下。 | | udf | 是否启动 UDF 服务;0: 不启动,1:启动;默认值 为 0 | -| ttlChangeOnWrite | ttl 到期时间是否伴随表的修改操作改变; 0: 不改变,1:改变 ;默认值 为 | +| ttlChangeOnWrite | ttl 到期时间是否伴随表的修改操作改变; 0: 不改变,1:改变 ;默认值 为 0 | | tmqMaxTopicNum | 订阅最多可建立的 topic 数量; 取值范围 1-10000;缺省值 为20 | | maxTsmaNum | 集群内可创建的TSMA个数;取值范围:0-3;缺省值: 3 | ## taosd 监控指标 -taosd 会将监控指标上报给 taosKeeper,这些监控指标会被 taosKeeper 写入监控数据库,默认是 `log` 库,可以在 taoskeeper 配置文件中修改。以下是这些监控指标的详细介绍。 +taosd 会将监控指标上报给 taosKeeper,这些监控指标会被 taosKeeper 写入监控数据库,默认是 `log` 库,可以在 taoskeeper 配置文件中修改。以下是这些监控指标的详细介绍。 ### taosd\_cluster\_basic 表 @@ -458,4 +458,3 @@ TDengine 的日志文件主要包括普通日志和慢日志两种类型。 3. 多个客户端的日志存储在相应日志路径下的同一个 taosSlowLog.yyyy.mm.dd 文件里。 4. 慢日志文件不自动删除,不压缩。 5. 使用和普通日志文件相同的三个参数 logDir, minimalLogDirGB, asyncLog。另外两个参数 numOfLogLines,logKeepDays 不适用于慢日志。 - From dbd4147e88871d7e10cc09c94b20fa020be68918 Mon Sep 17 00:00:00 2001 From: Shungang Li Date: Mon, 28 Oct 2024 11:41:18 +0800 Subject: [PATCH 350/695] docs: format for space --- docs/zh/14-reference/01-components/01-taosd.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/zh/14-reference/01-components/01-taosd.md b/docs/zh/14-reference/01-components/01-taosd.md index d09eb4764d36..d11bbf4fa511 100644 --- a/docs/zh/14-reference/01-components/01-taosd.md +++ b/docs/zh/14-reference/01-components/01-taosd.md @@ -223,11 +223,11 @@ lossyColumns float|double | 参数名称 | 参数说明 | | :--------------: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | -| enableCoreFile | crash 时是否生成 core 文件;0: 不生成,1:生成;默认值 为 1; 不同的启动方式,生成 core 文件的目录如下:1、systemctl start taosd 启动:生成的 core 在根目录下
      2、手动启动,就在 taosd 执行目录下。 | -| udf | 是否启动 UDF 服务;0: 不启动,1:启动;默认值 为 0 | -| ttlChangeOnWrite | ttl 到期时间是否伴随表的修改操作改变; 0: 不改变,1:改变 ;默认值 为 0 | -| tmqMaxTopicNum | 订阅最多可建立的 topic 数量; 取值范围 1-10000;缺省值 为20 | -| maxTsmaNum | 集群内可创建的TSMA个数;取值范围:0-3;缺省值: 3 | +| enableCoreFile | crash 时是否生成 core 文件;0: 不生成,1:生成;默认值为 1; 不同的启动方式,生成 core 文件的目录如下:1、systemctl start taosd 启动:生成的 core 在根目录下
      2、手动启动,就在 taosd 执行目录下。 | +| udf | 是否启动 UDF 服务;0: 不启动,1:启动;默认值为 0 | +| ttlChangeOnWrite | ttl 到期时间是否伴随表的修改操作改变; 0: 不改变,1:改变;默认值为 0 | +| tmqMaxTopicNum | 订阅最多可建立的 topic 数量; 取值范围 1-10000;缺省值为20 | +| maxTsmaNum | 集群内可创建的TSMA个数;取值范围:0-3;缺省值为 3 | ## taosd 监控指标 From fb34549ae76d58bd930fc5fca13ce9059fd5b644 Mon Sep 17 00:00:00 2001 From: xsren <285808407@qq.com> Date: Mon, 28 Oct 2024 11:50:25 +0800 Subject: [PATCH 351/695] fix: json tag length check --- source/common/src/tdatablock.c | 13 ++++++++++--- source/libs/function/src/builtins.c | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c index d59c9252f328..5ac5ffdd9bef 100644 --- a/source/common/src/tdatablock.c +++ b/source/common/src/tdatablock.c @@ -3569,11 +3569,18 @@ int32_t blockDataCheck(const SSDataBlock* pDataBlock) { } else { BLOCK_DATA_CHECK_TRESSA(pCol->varmeta.offset[r] == nextPos); } - - colLen = varDataTLen(pCol->pData + pCol->varmeta.offset[r]); + + char* pColData = pCol->pData + pCol->varmeta.offset[r]; + int32_t colSize = 0; + if (pCol->info.type == TSDB_DATA_TYPE_JSON) { + colLen = getJsonValueLen(pColData); + } else { + colLen = varDataTLen(pColData); + } + BLOCK_DATA_CHECK_TRESSA(colLen >= VARSTR_HEADER_SIZE); BLOCK_DATA_CHECK_TRESSA(colLen <= pCol->info.bytes); - + if (pCol->reassigned) { BLOCK_DATA_CHECK_TRESSA((pCol->varmeta.offset[r] + colLen) <= pCol->varmeta.length); } else { diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c index bd72498508b8..e66ddf519766 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -1606,7 +1606,7 @@ static int32_t translateOutVarchar(SFunctionNode* pFunc, char* pErrBuf, int32_t break; case FUNCTION_TYPE_BLOCK_DIST: case FUNCTION_TYPE_BLOCK_DIST_INFO: - bytes = 128; + bytes = sizeof(STableBlockDistInfo); break; case FUNCTION_TYPE_TO_CHAR: bytes = 4096; From 3fdb1f4b7cd87fa51f4db8c3043fa43a0e4eceb5 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Mon, 28 Oct 2024 13:18:59 +0800 Subject: [PATCH 352/695] add stream check --- source/libs/parser/src/parTranslater.c | 7 +++++++ tests/script/tsim/stream/streamTwaError.sim | 2 ++ 2 files changed, 9 insertions(+) diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index be9515e450c9..47181f8ce1e0 100755 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -11008,6 +11008,13 @@ static int32_t checkStreamQuery(STranslateContext* pCxt, SCreateStreamStmt* pStm } } } + + if ((SRealTableNode*)pSelect->pFromTable && ((SRealTableNode*)pSelect->pFromTable)->pMeta && + TSDB_SUPER_TABLE == ((SRealTableNode*)pSelect->pFromTable)->pMeta->tableType && + !hasTbnameFunction(pSelect->pPartitionByList)) { + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY, + "When trigger was force window close, Super table must patitioned by table name"); + } } if (NULL != pSelect->pGroupByList) { diff --git a/tests/script/tsim/stream/streamTwaError.sim b/tests/script/tsim/stream/streamTwaError.sim index 625b5840c9a7..cda5fa9c4bfd 100644 --- a/tests/script/tsim/stream/streamTwaError.sim +++ b/tests/script/tsim/stream/streamTwaError.sim @@ -29,6 +29,8 @@ sql_error create stream streams9 trigger at_once IGNORE EXPIRED 1 IGNORE UPDATE sql_error create stream streams10 trigger force_window_close IGNORE EXPIRED 1 IGNORE UPDATE 1 into streamt10 as select _wstart, sum(a) from st partition by tbname,ta interval(2s) SLIDING(1s); sql create stream streams11 trigger force_window_close IGNORE EXPIRED 1 IGNORE UPDATE 1 into streamt11 as select _wstart, avg(a) from st partition by tbname,ta interval(2s) SLIDING(2s); +sql_error create stream streams10 trigger force_window_close IGNORE EXPIRED 1 IGNORE UPDATE 1 into streamt10 as select _wstart, sum(a) from st interval(2s); + print end system sh/exec.sh -n dnode1 -s stop -x SIGINT From 9fecac785013a4f847041ff73a1e22a0959b0ceb Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Mon, 28 Oct 2024 13:51:51 +0800 Subject: [PATCH 353/695] refactor desc. on data block --- docs/zh/08-operation/12-multi.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/zh/08-operation/12-multi.md b/docs/zh/08-operation/12-multi.md index 9b1e7fc7bad6..128aab2174a4 100644 --- a/docs/zh/08-operation/12-multi.md +++ b/docs/zh/08-operation/12-multi.md @@ -112,7 +112,7 @@ s3migrate database ; | 2 | s3_chunksize | 262144 | 131072 | 1048576 | 上传对象的大小阈值,与 tsdb_pagesize 参数一样,不可修改,单位为 TSDB 页 | | 3 | s3_compact | 1 | 0 | 1 | TSDB 文件组首次上传 S3 时,是否自动进行 compact 操作。 | -### 对象存储交互 +### 对象存储读写次数估算 对象存储服务的使用成本与存储的数据量及请求次数相关,下面分别介绍数据的上传及下载过程。 @@ -130,7 +130,9 @@ s3migrate database ; #### 数据下载 -在查询操作中,如果需要访问对象存储中的数据,TSDB 不会下载整个数据文件,而是计算所需数据在文件中的位置,只下载相应的数据块(请参考存储引擎部分)到 TSDB 页缓存中,然后将数据返回给查询执行引擎。后续查询首先检查页缓存,查看数据是否已被缓存。如果数据已缓存,则直接使用缓存中的数据,而无需重复从对象存储下载,从而有效降低从对象存储下载数据的次数。 +在查询操作中,如果需要访问对象存储中的数据,TSDB 不会下载整个数据文件,而是计算所需数据在文件中的位置,只下载相应的数据到 TSDB 页缓存中,然后将数据返回给查询执行引擎。后续查询首先检查页缓存,查看数据是否已被缓存。如果数据已缓存,则直接使用缓存中的数据,而无需重复从对象存储下载,从而有效降低从对象存储下载数据的次数。 + +相邻的多个数据页(创建数据库时,通过 `tsdb_pagesize` 参数指定数据页大小,默认 4K 字节)会作为一个数据块从对象存储下载一次,以减少从对象存储下载的次数。 ```math 下载次数 = 查询需要的数据块数量 - 已缓存的数据块数量 From f114dfc529706c7f2628556ed4a0885fe8ac7e4d Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Mon, 28 Oct 2024 13:58:08 +0800 Subject: [PATCH 354/695] refact desc. for tsdb page size --- docs/zh/08-operation/12-multi.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/zh/08-operation/12-multi.md b/docs/zh/08-operation/12-multi.md index 128aab2174a4..e015e80cc857 100644 --- a/docs/zh/08-operation/12-multi.md +++ b/docs/zh/08-operation/12-multi.md @@ -132,7 +132,7 @@ s3migrate database ; 在查询操作中,如果需要访问对象存储中的数据,TSDB 不会下载整个数据文件,而是计算所需数据在文件中的位置,只下载相应的数据到 TSDB 页缓存中,然后将数据返回给查询执行引擎。后续查询首先检查页缓存,查看数据是否已被缓存。如果数据已缓存,则直接使用缓存中的数据,而无需重复从对象存储下载,从而有效降低从对象存储下载数据的次数。 -相邻的多个数据页(创建数据库时,通过 `tsdb_pagesize` 参数指定数据页大小,默认 4K 字节)会作为一个数据块从对象存储下载一次,以减少从对象存储下载的次数。 +相邻的多个数据页会作为一个数据块从对象存储下载一次,以减少从对象存储下载的次数。每个数据页的大小,在创建数据库时,通过 `tsdb_pagesize` 参数指定,默认 4K 字节。 ```math 下载次数 = 查询需要的数据块数量 - 已缓存的数据块数量 From d9ee12b8f6d1cc819fd4ca8b44c9e68a8b432c1f Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Mon, 28 Oct 2024 14:29:07 +0800 Subject: [PATCH 355/695] refact s3_chunksize's default value --- docs/zh/08-operation/12-multi.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/zh/08-operation/12-multi.md b/docs/zh/08-operation/12-multi.md index e015e80cc857..6afd6427529f 100644 --- a/docs/zh/08-operation/12-multi.md +++ b/docs/zh/08-operation/12-multi.md @@ -109,7 +109,7 @@ s3migrate database ; | # | 参数 | 默认值 | 最小值 | 最大值 | 描述 | | :--- | :----------- | :----- | :----- | :------ | :----------------------------------------------------------- | | 1 | s3_keeplocal | 365 | 1 | 365000 | 数据在本地保留的天数,即 data 文件在本地磁盘保留多长时间后可以上传到 S3。默认单位:天,支持 m(分钟)、h(小时)和 d(天)三个单位 | -| 2 | s3_chunksize | 262144 | 131072 | 1048576 | 上传对象的大小阈值,与 tsdb_pagesize 参数一样,不可修改,单位为 TSDB 页 | +| 2 | s3_chunksize | 131072 | 131072 | 1048576 | 上传对象的大小阈值,与 tsdb_pagesize 参数一样,不可修改,单位为 TSDB 页 | | 3 | s3_compact | 1 | 0 | 1 | TSDB 文件组首次上传 S3 时,是否自动进行 compact 操作。 | ### 对象存储读写次数估算 @@ -118,7 +118,7 @@ s3migrate database ; #### 数据上传 -当 TSDB 时序数据超过 `s3_keeplocal` 参数指定的时间,相关的数据文件会被切分成多个文件块,每个文件块的默认大小是 1G 字节 (`s3_chunksize * tsdb_pagesize`)。除了最后一个文件块保留在本地文件系统外,其余的文件块会被上传到对象存储服务。 +当 TSDB 时序数据超过 `s3_keeplocal` 参数指定的时间,相关的数据文件会被切分成多个文件块,每个文件块的默认大小是 500M 字节 (`s3_chunksize * tsdb_pagesize`)。除了最后一个文件块保留在本地文件系统外,其余的文件块会被上传到对象存储服务。 ```math 上传次数 = 数据文件大小 / (s3_chunksize * tsdb_pagesize) - 1 From 0100d383eead8c110c8f21b31154ab7d6573c297 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Mon, 28 Oct 2024 15:02:03 +0800 Subject: [PATCH 356/695] enh:[TS-5441] cost too long in tmq write meta data by cache meta and vg info --- source/client/src/clientRawBlockWrite.c | 329 ++++++++++++------------ 1 file changed, 166 insertions(+), 163 deletions(-) diff --git a/source/client/src/clientRawBlockWrite.c b/source/client/src/clientRawBlockWrite.c index 2bd815b4606a..80403986aa0f 100644 --- a/source/client/src/clientRawBlockWrite.c +++ b/source/client/src/clientRawBlockWrite.c @@ -23,12 +23,12 @@ #include "tglobal.h" #include "tmsgtype.h" -#define RAW_NULL_CHECK(c) \ - do { \ - if (c == NULL) { \ - code = terrno; \ - goto end; \ - } \ +#define RAW_NULL_CHECK(c) \ + do { \ + if (c == NULL) { \ + code = terrno; \ + goto end; \ + } \ } while (0) #define RAW_FALSE_CHECK(c) \ @@ -52,7 +52,7 @@ #define TMQ_META_VERSION "1.0" -static int32_t tmqWriteBatchMetaDataImpl(TAOS* taos, void* meta, int32_t metaLen); +static int32_t tmqWriteBatchMetaDataImpl(TAOS* taos, void* meta, int32_t metaLen); static tb_uid_t processSuid(tb_uid_t suid, char* db) { return suid + MurmurHash3_32(db, strlen(db)); } static void buildCreateTableJson(SSchemaWrapper* schemaRow, SSchemaWrapper* schemaTag, char* name, int64_t id, int8_t t, SColCmprWrapper* pColCmprRow, cJSON** pJson) { @@ -163,7 +163,7 @@ static void buildCreateTableJson(SSchemaWrapper* schemaRow, SSchemaWrapper* sche } RAW_FALSE_CHECK(cJSON_AddItemToObject(json, "tags", tags)); - end: +end: *pJson = json; } @@ -197,7 +197,7 @@ static int32_t setCompressOption(cJSON* json, uint32_t para) { return code; } - end: +end: return code; } static void buildAlterSTableJson(void* alterData, int32_t alterDataLen, cJSON** pJson) { @@ -338,7 +338,7 @@ static void buildAlterSTableJson(void* alterData, int32_t alterDataLen, cJSON** break; } - end: +end: tFreeSMAltertbReq(&req); *pJson = json; } @@ -455,7 +455,7 @@ static void buildChildElement(cJSON* json, SVCreateTbReq* pCreateReq) { cJSON* tvalue = NULL; if (IS_VAR_DATA_TYPE(pTagVal->type)) { - char* buf = NULL; + char* buf = NULL; int64_t bufSize = 0; if (pTagVal->type == TSDB_DATA_TYPE_VARBINARY) { bufSize = pTagVal->nData * 2 + 2 + 3; @@ -485,7 +485,7 @@ static void buildChildElement(cJSON* json, SVCreateTbReq* pCreateReq) { RAW_FALSE_CHECK(cJSON_AddItemToArray(tags, tag)); } - end: +end: RAW_FALSE_CHECK(cJSON_AddItemToObject(json, "tags", tags)); taosArrayDestroy(pTagVals); } @@ -514,7 +514,7 @@ static void buildCreateCTableJson(SVCreateTbReq* pCreateReq, int32_t nReqs, cJSO } RAW_FALSE_CHECK(cJSON_AddItemToObject(json, "createList", createList)); - end: +end: *pJson = json; } @@ -585,7 +585,7 @@ static void processAutoCreateTable(SMqDataRsp* rsp, char** string) { *string = cJSON_PrintUnformatted(pJson); cJSON_Delete(pJson); - end: +end: uDebug("auto created table return, sql json:%s", *string); for (int i = 0; decoder && pCreateReq && i < rsp->createTableNum; i++) { tDecoderClear(&decoder[i]); @@ -989,7 +989,7 @@ static int32_t taosCreateStb(TAOS* taos, void* meta, int32_t metaLen) { code = pRequest->code; - end: +end: uDebug(LOG_ID_TAG " create stable return, msg:%s", LOG_ID_VALUE, tstrerror(code)); destroyRequest(pRequest); tFreeSMCreateStbReq(&pReq); @@ -1023,9 +1023,9 @@ static int32_t taosDropStb(TAOS* taos, void* meta, int32_t metaLen) { SCatalog* pCatalog = NULL; RAW_RETURN_CHECK(catalogGetHandle(pRequest->pTscObj->pAppInfo->clusterId, &pCatalog)); SRequestConnInfo conn = {.pTrans = pRequest->pTscObj->pAppInfo->pTransporter, - .requestId = pRequest->requestId, - .requestObjRefId = pRequest->self, - .mgmtEps = getEpSet_s(&pRequest->pTscObj->pAppInfo->mgmtEp)}; + .requestId = pRequest->requestId, + .requestObjRefId = pRequest->self, + .mgmtEps = getEpSet_s(&pRequest->pTscObj->pAppInfo->mgmtEp)}; SName pName = {0}; toName(pRequest->pTscObj->acctId, pRequest->pDb, req.name, &pName); STableMeta* pTableMeta = NULL; @@ -1088,7 +1088,7 @@ static int32_t taosDropStb(TAOS* taos, void* meta, int32_t metaLen) { code = pRequest->code; - end: +end: uDebug(LOG_ID_TAG " drop stable return, msg:%s", LOG_ID_VALUE, tstrerror(code)); destroyRequest(pRequest); tDecoderClear(&coder); @@ -1142,9 +1142,9 @@ static int32_t taosCreateTable(TAOS* taos, void* meta, int32_t metaLen) { taosHashSetFreeFp(pVgroupHashmap, destroyCreateTbReqBatch); SRequestConnInfo conn = {.pTrans = pTscObj->pAppInfo->pTransporter, - .requestId = pRequest->requestId, - .requestObjRefId = pRequest->self, - .mgmtEps = getEpSet_s(&pTscObj->pAppInfo->mgmtEp)}; + .requestId = pRequest->requestId, + .requestObjRefId = pRequest->self, + .mgmtEps = getEpSet_s(&pTscObj->pAppInfo->mgmtEp)}; pRequest->tableList = taosArrayInit(req.nReqs, sizeof(SName)); RAW_NULL_CHECK(pRequest->tableList); @@ -1269,7 +1269,7 @@ static int32_t taosCreateTable(TAOS* taos, void* meta, int32_t metaLen) { code = pRequest->code; - end: +end: uDebug(LOG_ID_TAG " create table return, msg:%s", LOG_ID_VALUE, tstrerror(code)); tDeleteSVCreateTbBatchReq(&req); @@ -1328,9 +1328,9 @@ static int32_t taosDropTable(TAOS* taos, void* meta, int32_t metaLen) { taosHashSetFreeFp(pVgroupHashmap, destroyDropTbReqBatch); SRequestConnInfo conn = {.pTrans = pTscObj->pAppInfo->pTransporter, - .requestId = pRequest->requestId, - .requestObjRefId = pRequest->self, - .mgmtEps = getEpSet_s(&pTscObj->pAppInfo->mgmtEp)}; + .requestId = pRequest->requestId, + .requestObjRefId = pRequest->self, + .mgmtEps = getEpSet_s(&pTscObj->pAppInfo->mgmtEp)}; pRequest->tableList = taosArrayInit(req.nReqs, sizeof(SName)); RAW_NULL_CHECK(pRequest->tableList); // loop to create table @@ -1395,7 +1395,7 @@ static int32_t taosDropTable(TAOS* taos, void* meta, int32_t metaLen) { } code = pRequest->code; - end: +end: uDebug(LOG_ID_TAG " drop table return, msg:%s", LOG_ID_VALUE, tstrerror(code)); taosHashCleanup(pVgroupHashmap); destroyRequest(pRequest); @@ -1433,7 +1433,7 @@ static int32_t taosDeleteData(TAOS* taos, void* meta, int32_t metaLen) { } taos_free_result(res); - end: +end: uDebug("connId:0x%" PRIx64 " delete data sql:%s, code:%s", *(int64_t*)taos, sql, tstrerror(code)); tDecoderClear(&coder); return code; @@ -1473,9 +1473,9 @@ static int32_t taosAlterTable(TAOS* taos, void* meta, int32_t metaLen) { SCatalog* pCatalog = NULL; RAW_RETURN_CHECK(catalogGetHandle(pTscObj->pAppInfo->clusterId, &pCatalog)); SRequestConnInfo conn = {.pTrans = pTscObj->pAppInfo->pTransporter, - .requestId = pRequest->requestId, - .requestObjRefId = pRequest->self, - .mgmtEps = getEpSet_s(&pTscObj->pAppInfo->mgmtEp)}; + .requestId = pRequest->requestId, + .requestObjRefId = pRequest->self, + .mgmtEps = getEpSet_s(&pTscObj->pAppInfo->mgmtEp)}; SVgroupInfo pInfo = {0}; SName pName = {0}; @@ -1543,7 +1543,7 @@ static int32_t taosAlterTable(TAOS* taos, void* meta, int32_t metaLen) { code = handleAlterTbExecRes(pRes->res, pCatalog); } } - end: +end: uDebug(LOG_ID_TAG " alter table return, meta:%p, len:%d, msg:%s", LOG_ID_VALUE, meta, metaLen, tstrerror(code)); taosArrayDestroy(pArray); if (pVgData) taosMemoryFreeClear(pVgData->pData); @@ -1608,7 +1608,7 @@ int taos_write_raw_block_with_fields_with_reqid(TAOS* taos, int rows, char* pDat launchQueryImpl(pRequest, pQuery, true, NULL); code = pRequest->code; - end: +end: uDebug(LOG_ID_TAG " write raw block with field return, msg:%s", LOG_ID_VALUE, tstrerror(code)); taosMemoryFreeClear(pTableMeta); qDestroyQuery(pQuery); @@ -1668,7 +1668,7 @@ int taos_write_raw_block_with_reqid(TAOS* taos, int rows, char* pData, const cha launchQueryImpl(pRequest, pQuery, true, NULL); code = pRequest->code; - end: +end: uDebug(LOG_ID_TAG " write raw block return, msg:%s", LOG_ID_VALUE, tstrerror(code)); taosMemoryFreeClear(pTableMeta); qDestroyQuery(pQuery); @@ -1708,7 +1708,8 @@ static int32_t buildCreateTbMap(SMqDataRsp* rsp, SHashObj* pHashObj) { goto end; } if (taosHashGet(pHashObj, pCreateReq.name, strlen(pCreateReq.name)) == NULL) { - RAW_RETURN_CHECK(taosHashPut(pHashObj, pCreateReq.name, strlen(pCreateReq.name), &pCreateReq, sizeof(SVCreateTbReq))); + RAW_RETURN_CHECK( + taosHashPut(pHashObj, pCreateReq.name, strlen(pCreateReq.name), &pCreateReq, sizeof(SVCreateTbReq))); } else { tDestroySVCreateTbReq(&pCreateReq, TSDB_MSG_FLG_DECODE); pCreateReq = (SVCreateTbReq){0}; @@ -1734,34 +1735,34 @@ static SHashObj* writeRawCache = NULL; static int8_t initFlag = 0; static int8_t initedFlag = WRITE_RAW_INIT_START; -typedef struct{ - SHashObj* pVgHash; - SHashObj* pNameHash; - SHashObj* pMetaHash; -}rawCacheInfo; +typedef struct { + SHashObj* pVgHash; + SHashObj* pNameHash; + SHashObj* pMetaHash; +} rawCacheInfo; -typedef struct{ +typedef struct { SVgroupInfo vgInfo; int64_t uid; int64_t suid; -}tbInfo; +} tbInfo; -static void tmqFreeMeta(void *data){ +static void tmqFreeMeta(void* data) { STableMeta* pTableMeta = *(STableMeta**)data; taosMemoryFree(pTableMeta); } -static void freeRawCache(void *data) { +static void freeRawCache(void* data) { rawCacheInfo* pRawCache = (rawCacheInfo*)data; taosHashCleanup(pRawCache->pMetaHash); taosHashCleanup(pRawCache->pNameHash); taosHashCleanup(pRawCache->pVgHash); } -static int32_t initRawCacheHash(){ - if (writeRawCache == NULL){ +static int32_t initRawCacheHash() { + if (writeRawCache == NULL) { writeRawCache = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_ENTRY_LOCK); - if (writeRawCache == NULL){ + if (writeRawCache == NULL) { return terrno; } taosHashSetFreeFp(writeRawCache, freeRawCache); @@ -1769,7 +1770,7 @@ static int32_t initRawCacheHash(){ return 0; } -static bool needRefreshMeta(void* rawData, STableMeta* pTableMeta, SSchemaWrapper* pSW){ +static bool needRefreshMeta(void* rawData, STableMeta* pTableMeta, SSchemaWrapper* pSW) { char* p = (char*)rawData; // | version | total length | total rows | blankFill | total columns | flag seg| block group id | column schema | each // column length | @@ -1799,16 +1800,15 @@ static bool needRefreshMeta(void* rawData, STableMeta* pTableMeta, SSchemaWrappe } fields += sizeof(int8_t) + sizeof(int32_t); - if (j == pTableMeta->tableInfo.numOfColumns) - return true; + if (j == pTableMeta->tableInfo.numOfColumns) return true; } return false; } -static int32_t getRawCache(SHashObj **pVgHash, SHashObj **pNameHash, SHashObj **pMetaHash, void *key) { +static int32_t getRawCache(SHashObj** pVgHash, SHashObj** pNameHash, SHashObj** pMetaHash, void* key) { int32_t code = 0; - void* cacheInfo = taosHashGet(writeRawCache, &key, POINTER_BYTES); - if (cacheInfo == NULL){ + void* cacheInfo = taosHashGet(writeRawCache, &key, POINTER_BYTES); + if (cacheInfo == NULL) { *pVgHash = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, HASH_NO_LOCK); RAW_NULL_CHECK(*pVgHash); *pNameHash = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK); @@ -1819,7 +1819,7 @@ static int32_t getRawCache(SHashObj **pVgHash, SHashObj **pNameHash, SHashObj ** rawCacheInfo info = {*pVgHash, *pNameHash, *pMetaHash}; RAW_RETURN_CHECK(taosHashPut(writeRawCache, &key, POINTER_BYTES, &info, sizeof(rawCacheInfo))); } else { - rawCacheInfo *info = (rawCacheInfo *)cacheInfo; + rawCacheInfo* info = (rawCacheInfo*)cacheInfo; *pVgHash = info->pVgHash; *pNameHash = info->pNameHash; *pMetaHash = info->pMetaHash; @@ -1833,7 +1833,7 @@ static int32_t getRawCache(SHashObj **pVgHash, SHashObj **pNameHash, SHashObj ** return code; } -static int32_t buildRawRequest(TAOS* taos, SRequestObj** pRequest, SCatalog** pCatalog, SRequestConnInfo *conn){ +static int32_t buildRawRequest(TAOS* taos, SRequestObj** pRequest, SCatalog** pCatalog, SRequestConnInfo* conn) { int32_t code = 0; RAW_RETURN_CHECK(createRequest(*(int64_t*)taos, TSDB_SQL_INSERT, 0, pRequest)); (*pRequest)->syncQuery = true; @@ -1852,29 +1852,30 @@ static int32_t buildRawRequest(TAOS* taos, SRequestObj** pRequest, SCatalog** p return code; } -typedef int32_t _raw_decode_func_(SDecoder *pDecoder, SMqDataRsp *pRsp); -static int32_t decodeRawData(SDecoder *decoder, void* data, int32_t dataLen, _raw_decode_func_ func, SMqRspObj* rspObj){ - int8_t dataVersion = *(int8_t*)data; - if (dataVersion >= MQ_DATA_RSP_VERSION) { - data = POINTER_SHIFT(data, sizeof(int8_t) + sizeof(int32_t)); - dataLen -= sizeof(int8_t) + sizeof(int32_t); +typedef int32_t _raw_decode_func_(SDecoder* pDecoder, SMqDataRsp* pRsp); +static int32_t decodeRawData(SDecoder* decoder, void* data, int32_t dataLen, _raw_decode_func_ func, + SMqRspObj* rspObj) { + int8_t dataVersion = *(int8_t*)data; + if (dataVersion >= MQ_DATA_RSP_VERSION) { + data = POINTER_SHIFT(data, sizeof(int8_t) + sizeof(int32_t)); + dataLen -= sizeof(int8_t) + sizeof(int32_t); } - rspObj->resIter = -1; - tDecoderInit(decoder, data, dataLen); - int32_t code = func(decoder, &rspObj->dataRsp); - if (code != 0) { - SET_ERROR_MSG("decode mq taosx data rsp failed"); + rspObj->resIter = -1; + tDecoderInit(decoder, data, dataLen); + int32_t code = func(decoder, &rspObj->dataRsp); + if (code != 0) { + SET_ERROR_MSG("decode mq taosx data rsp failed"); } - return code; + return code; } -static int32_t processCacheMeta(SHashObj *pVgHash, SHashObj *pNameHash, SHashObj *pMetaHash, SVCreateTbReq* pCreateReqDst, - SCatalog* pCatalog, SRequestConnInfo* conn, SName* pName, - STableMeta** pMeta, SSchemaWrapper* pSW, void* rawData, int32_t retry){ - int32_t code = 0; +static int32_t processCacheMeta(SHashObj* pVgHash, SHashObj* pNameHash, SHashObj* pMetaHash, + SVCreateTbReq* pCreateReqDst, SCatalog* pCatalog, SRequestConnInfo* conn, SName* pName, + STableMeta** pMeta, SSchemaWrapper* pSW, void* rawData, int32_t retry) { + int32_t code = 0; STableMeta* pTableMeta = NULL; - tbInfo* tmpInfo = (tbInfo*)taosHashGet(pNameHash, pName->tname, strlen(pName->tname)); + tbInfo* tmpInfo = (tbInfo*)taosHashGet(pNameHash, pName->tname, strlen(pName->tname)); if (tmpInfo == NULL || retry > 0) { tbInfo info = {0}; @@ -1884,13 +1885,13 @@ static int32_t processCacheMeta(SHashObj *pVgHash, SHashObj *pNameHash, SHashObj } RAW_RETURN_CHECK(catalogGetTableMeta(pCatalog, conn, pName, &pTableMeta)); info.uid = pTableMeta->uid; - if (pTableMeta->tableType == TSDB_CHILD_TABLE){ + if (pTableMeta->tableType == TSDB_CHILD_TABLE) { info.suid = pTableMeta->suid; } else { info.suid = pTableMeta->uid; } code = taosHashPut(pMetaHash, &info.suid, LONG_BYTES, &pTableMeta, POINTER_BYTES); - if (code != 0){ + if (code != 0) { taosMemoryFree(pTableMeta); goto end; } @@ -1902,20 +1903,21 @@ static int32_t processCacheMeta(SHashObj *pVgHash, SHashObj *pNameHash, SHashObj RAW_RETURN_CHECK(taosHashPut(pNameHash, pName->tname, strlen(pName->tname), &info, sizeof(tbInfo))); tmpInfo = (tbInfo*)taosHashGet(pNameHash, pName->tname, strlen(pName->tname)); - RAW_RETURN_CHECK(taosHashPut(pVgHash, &info.vgInfo.vgId, sizeof(info.vgInfo.vgId), &info.vgInfo, sizeof(SVgroupInfo))); + RAW_RETURN_CHECK( + taosHashPut(pVgHash, &info.vgInfo.vgId, sizeof(info.vgInfo.vgId), &info.vgInfo, sizeof(SVgroupInfo))); } - if (pTableMeta == NULL || retry > 0){ + if (pTableMeta == NULL || retry > 0) { STableMeta** pTableMetaTmp = (STableMeta**)taosHashGet(pMetaHash, &tmpInfo->suid, LONG_BYTES); if (pTableMetaTmp == NULL || retry > 0 || needRefreshMeta(rawData, *pTableMetaTmp, pSW)) { RAW_RETURN_CHECK(catalogGetTableMeta(pCatalog, conn, pName, &pTableMeta)); code = taosHashPut(pMetaHash, &tmpInfo->suid, LONG_BYTES, &pTableMeta, POINTER_BYTES); - if (code != 0){ + if (code != 0) { taosMemoryFree(pTableMeta); goto end; } - }else{ + } else { pTableMeta = *pTableMetaTmp; pTableMeta->uid = tmpInfo->uid; pTableMeta->vgId = tmpInfo->vgInfo.vgId; @@ -1927,25 +1929,25 @@ static int32_t processCacheMeta(SHashObj *pVgHash, SHashObj *pNameHash, SHashObj return code; } -static int32_t tmqWriteRawDataImpl(TAOS* taos, void* data, int32_t dataLen){ - int32_t code = TSDB_CODE_SUCCESS; - SQuery* pQuery = NULL; - SMqRspObj rspObj = {0}; - SDecoder decoder = {0}; +static int32_t tmqWriteRawDataImpl(TAOS* taos, void* data, int32_t dataLen) { + int32_t code = TSDB_CODE_SUCCESS; + SQuery* pQuery = NULL; + SMqRspObj rspObj = {0}; + SDecoder decoder = {0}; - SRequestObj* pRequest = NULL; - SCatalog* pCatalog = NULL; - SRequestConnInfo conn = {0}; + SRequestObj* pRequest = NULL; + SCatalog* pCatalog = NULL; + SRequestConnInfo conn = {0}; RAW_RETURN_CHECK(buildRawRequest(taos, &pRequest, &pCatalog, &conn)); uDebug(LOG_ID_TAG " write raw data, data:%p, dataLen:%d", LOG_ID_VALUE, data, dataLen); RAW_RETURN_CHECK(decodeRawData(&decoder, data, dataLen, tDecodeMqDataRsp, &rspObj)); - SHashObj *pVgHash = NULL; - SHashObj *pNameHash = NULL; - SHashObj *pMetaHash = NULL; + SHashObj* pVgHash = NULL; + SHashObj* pNameHash = NULL; + SHashObj* pMetaHash = NULL; RAW_RETURN_CHECK(getRawCache(&pVgHash, &pNameHash, &pMetaHash, taos)); int retry = 0; - while(1){ + while (1) { RAW_RETURN_CHECK(smlInitHandle(&pQuery)); uDebug(LOG_ID_TAG " write raw meta data block num:%d", LOG_ID_VALUE, rspObj.dataRsp.blockNum); while (++rspObj.resIter < rspObj.dataRsp.blockNum) { @@ -1968,9 +1970,9 @@ static int32_t tmqWriteRawDataImpl(TAOS* taos, void* data, int32_t dataLen){ tstrncpy(pName.tname, tbName, TSDB_TABLE_NAME_LEN); STableMeta* pTableMeta = NULL; - RAW_RETURN_CHECK(processCacheMeta(pVgHash, pNameHash, pMetaHash, NULL, pCatalog, &conn, - &pName, &pTableMeta, pSW, rawData, retry)); - char err[ERR_MSG_LEN] = {0}; + RAW_RETURN_CHECK(processCacheMeta(pVgHash, pNameHash, pMetaHash, NULL, pCatalog, &conn, &pName, &pTableMeta, pSW, + rawData, retry)); + char err[ERR_MSG_LEN] = {0}; code = rawBlockBindData(pQuery, pTableMeta, rawData, NULL, pSW, pSW->nCols, true, err, ERR_MSG_LEN, true); if (code != TSDB_CODE_SUCCESS) { SET_ERROR_MSG("table:%s, err:%s", pName.tname, err); @@ -1991,7 +1993,7 @@ static int32_t tmqWriteRawDataImpl(TAOS* taos, void* data, int32_t dataLen){ break; } - end: +end: uDebug(LOG_ID_TAG " write raw data return, msg:%s", LOG_ID_VALUE, tstrerror(code)); tDeleteMqDataRsp(&rspObj.dataRsp); tDecoderClear(&decoder); @@ -2001,15 +2003,15 @@ static int32_t tmqWriteRawDataImpl(TAOS* taos, void* data, int32_t dataLen){ } static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, int32_t dataLen) { - int32_t code = TSDB_CODE_SUCCESS; - SQuery* pQuery = NULL; - SMqRspObj rspObj = {0}; - SDecoder decoder = {0}; - SHashObj* pCreateTbHash = NULL; + int32_t code = TSDB_CODE_SUCCESS; + SQuery* pQuery = NULL; + SMqRspObj rspObj = {0}; + SDecoder decoder = {0}; + SHashObj* pCreateTbHash = NULL; - SRequestObj* pRequest = NULL; - SCatalog* pCatalog = NULL; - SRequestConnInfo conn = {0}; + SRequestObj* pRequest = NULL; + SCatalog* pCatalog = NULL; + SRequestConnInfo conn = {0}; RAW_RETURN_CHECK(buildRawRequest(taos, &pRequest, &pCatalog, &conn)); uDebug(LOG_ID_TAG " write raw metadata, data:%p, dataLen:%d", LOG_ID_VALUE, data, dataLen); @@ -2019,12 +2021,12 @@ static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, int32_t dataLen) RAW_NULL_CHECK(pCreateTbHash); RAW_RETURN_CHECK(buildCreateTbMap(&rspObj.dataRsp, pCreateTbHash)); - SHashObj *pVgHash = NULL; - SHashObj *pNameHash = NULL; - SHashObj *pMetaHash = NULL; + SHashObj* pVgHash = NULL; + SHashObj* pNameHash = NULL; + SHashObj* pMetaHash = NULL; RAW_RETURN_CHECK(getRawCache(&pVgHash, &pNameHash, &pMetaHash, taos)); int retry = 0; - while(1){ + while (1) { RAW_RETURN_CHECK(smlInitHandle(&pQuery)); uDebug(LOG_ID_TAG " write raw meta data block num:%d", LOG_ID_VALUE, rspObj.dataRsp.blockNum); while (++rspObj.resIter < rspObj.dataRsp.blockNum) { @@ -2048,11 +2050,12 @@ static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, int32_t dataLen) // find schema data info SVCreateTbReq* pCreateReqDst = (SVCreateTbReq*)taosHashGet(pCreateTbHash, pName.tname, strlen(pName.tname)); - STableMeta* pTableMeta = NULL; - RAW_RETURN_CHECK(processCacheMeta(pVgHash, pNameHash, pMetaHash, pCreateReqDst, pCatalog, &conn, - &pName, &pTableMeta, pSW, rawData, retry)); - char err[ERR_MSG_LEN] = {0}; - code = rawBlockBindData(pQuery, pTableMeta, rawData, pCreateReqDst, pSW, pSW->nCols, true, err, ERR_MSG_LEN, true); + STableMeta* pTableMeta = NULL; + RAW_RETURN_CHECK(processCacheMeta(pVgHash, pNameHash, pMetaHash, pCreateReqDst, pCatalog, &conn, &pName, + &pTableMeta, pSW, rawData, retry)); + char err[ERR_MSG_LEN] = {0}; + code = + rawBlockBindData(pQuery, pTableMeta, rawData, pCreateReqDst, pSW, pSW->nCols, true, err, ERR_MSG_LEN, true); if (code != TSDB_CODE_SUCCESS) { SET_ERROR_MSG("table:%s, err:%s", pName.tname, err); goto end; @@ -2147,7 +2150,7 @@ static void processBatchMetaToJson(SMqBatchMetaRsp* pMsgRsp, char** string) { *string = fullStr; return; - end: +end: cJSON_Delete(pJson); tDeleteMqBatchMetaRsp(&rsp); } @@ -2159,18 +2162,18 @@ char* tmq_get_json_meta(TAOS_RES* res) { return NULL; } - char* string = NULL; + char* string = NULL; SMqRspObj* rspObj = (SMqRspObj*)res; if (TD_RES_TMQ_METADATA(res)) { processAutoCreateTable(&rspObj->dataRsp, &string); } else if (TD_RES_TMQ_BATCH_META(res)) { processBatchMetaToJson(&rspObj->batchMetaRsp, &string); } else if (TD_RES_TMQ_META(res)) { - cJSON* pJson = NULL; + cJSON* pJson = NULL; processSimpleMeta(&rspObj->metaRsp, &pJson); string = cJSON_PrintUnformatted(pJson); cJSON_Delete(pJson); - } else{ + } else { uError("tmq_get_json_meta res:%d, invalid type", *(int8_t*)res); } @@ -2181,7 +2184,7 @@ char* tmq_get_json_meta(TAOS_RES* res) { void tmq_free_json_meta(char* jsonMeta) { taosMemoryFreeClear(jsonMeta); } static int32_t getOffSetLen(const SMqDataRsp* pRsp) { - SEncoder coder = {0}; + SEncoder coder = {0}; tEncoderInit(&coder, NULL, 0); if (tEncodeSTqOffsetVal(&coder, &pRsp->reqOffset) < 0) return -1; if (tEncodeSTqOffsetVal(&coder, &pRsp->rspOffset) < 0) return -1; @@ -2191,46 +2194,46 @@ static int32_t getOffSetLen(const SMqDataRsp* pRsp) { } typedef int32_t __encode_func__(SEncoder* pEncoder, const SMqDataRsp* pRsp); -static int32_t encodeMqDataRsp(__encode_func__* encodeFunc, SMqDataRsp* rspObj, tmq_raw_data* raw) { - int32_t len = 0; - int32_t code = 0; - SEncoder encoder = {0}; - void* buf = NULL; - tEncodeSize(encodeFunc, rspObj, len, code); - if (code < 0) { - code = TSDB_CODE_INVALID_MSG; - goto FAILED; - } - len += sizeof(int8_t) + sizeof(int32_t); - buf = taosMemoryCalloc(1, len); - if (buf == NULL) { - code = terrno; - goto FAILED; - } - tEncoderInit(&encoder, buf, len); - if (tEncodeI8(&encoder, MQ_DATA_RSP_VERSION) < 0) { - code = TSDB_CODE_INVALID_MSG; - goto FAILED; - } - int32_t offsetLen = getOffSetLen(rspObj); - if (offsetLen <= 0) { - code = TSDB_CODE_INVALID_MSG; - goto FAILED; - } - if (tEncodeI32(&encoder, offsetLen) < 0) { - code = TSDB_CODE_INVALID_MSG; - goto FAILED; - } - if (encodeFunc(&encoder, rspObj) < 0) { - code = TSDB_CODE_INVALID_MSG; - goto FAILED; - } - tEncoderClear(&encoder); - - raw->raw = buf; - raw->raw_len = len; - return code; - FAILED: +static int32_t encodeMqDataRsp(__encode_func__* encodeFunc, SMqDataRsp* rspObj, tmq_raw_data* raw) { + int32_t len = 0; + int32_t code = 0; + SEncoder encoder = {0}; + void* buf = NULL; + tEncodeSize(encodeFunc, rspObj, len, code); + if (code < 0) { + code = TSDB_CODE_INVALID_MSG; + goto FAILED; + } + len += sizeof(int8_t) + sizeof(int32_t); + buf = taosMemoryCalloc(1, len); + if (buf == NULL) { + code = terrno; + goto FAILED; + } + tEncoderInit(&encoder, buf, len); + if (tEncodeI8(&encoder, MQ_DATA_RSP_VERSION) < 0) { + code = TSDB_CODE_INVALID_MSG; + goto FAILED; + } + int32_t offsetLen = getOffSetLen(rspObj); + if (offsetLen <= 0) { + code = TSDB_CODE_INVALID_MSG; + goto FAILED; + } + if (tEncodeI32(&encoder, offsetLen) < 0) { + code = TSDB_CODE_INVALID_MSG; + goto FAILED; + } + if (encodeFunc(&encoder, rspObj) < 0) { + code = TSDB_CODE_INVALID_MSG; + goto FAILED; + } + tEncoderClear(&encoder); + + raw->raw = buf; + raw->raw_len = len; + return code; +FAILED: tEncoderClear(&encoder); taosMemoryFree(buf); return code; @@ -2247,7 +2250,7 @@ int32_t tmq_get_raw(TAOS_RES* res, tmq_raw_data* raw) { raw->raw_type = rspObj->metaRsp.resMsgType; uDebug("tmq get raw type meta:%p", raw); } else if (TD_RES_TMQ(res)) { - int32_t code = encodeMqDataRsp(tEncodeMqDataRsp, &rspObj->dataRsp, raw); + int32_t code = encodeMqDataRsp(tEncodeMqDataRsp, &rspObj->dataRsp, raw); if (code != 0) { uError("tmq get raw type error:%d", terrno); return code; @@ -2282,7 +2285,7 @@ void tmq_free_raw(tmq_raw_data raw) { (void)memset(terrMsg, 0, ERR_MSG_LEN); } -static int32_t writeRawInit(){ +static int32_t writeRawInit() { while (atomic_load_8(&initedFlag) == WRITE_RAW_INIT_START) { int8_t old = atomic_val_compare_exchange_8(&initFlag, 0, 1); if (old == 0) { @@ -2296,7 +2299,7 @@ static int32_t writeRawInit(){ } } - if (atomic_load_8(&initedFlag) == WRITE_RAW_INIT_FAIL){ + if (atomic_load_8(&initedFlag) == WRITE_RAW_INIT_FAIL) { return TSDB_CODE_INTERNAL_ERROR; } return 0; @@ -2321,7 +2324,7 @@ static int32_t writeRawImpl(TAOS* taos, void* buf, uint32_t len, uint16_t type) return taosDropTable(taos, buf, len); } else if (type == TDMT_VND_DELETE) { return taosDeleteData(taos, buf, len); - } else if (type == RES_TYPE__TMQ_METADATA){ + } else if (type == RES_TYPE__TMQ_METADATA) { return tmqWriteRawMetaDataImpl(taos, buf, len); } else if (type == RES_TYPE__TMQ) { return tmqWriteRawDataImpl(taos, buf, len); @@ -2344,9 +2347,9 @@ static int32_t tmqWriteBatchMetaDataImpl(TAOS* taos, void* meta, int32_t metaLen if (taos == NULL || meta == NULL) { return TSDB_CODE_INVALID_PARA; } - SMqBatchMetaRsp rsp = {0}; + SMqBatchMetaRsp rsp = {0}; SDecoder coder = {0}; - int32_t code = TSDB_CODE_SUCCESS; + int32_t code = TSDB_CODE_SUCCESS; // decode and process req tDecoderInit(&coder, meta, metaLen); @@ -2374,7 +2377,7 @@ static int32_t tmqWriteBatchMetaDataImpl(TAOS* taos, void* meta, int32_t metaLen } } - end: +end: tDeleteMqBatchMetaRsp(&rsp); return code; } From b8a9e4d364d40ab3c5c3c99acb382c4b425fcfd8 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Mon, 28 Oct 2024 15:19:48 +0800 Subject: [PATCH 357/695] opt log to aovid stack overflow --- source/util/src/tlog.c | 64 +++++++++++++++++++++++++++------ source/util/test/CMakeLists.txt | 7 ++++ source/util/test/log.cpp | 46 ++++++++++++++++++++++++ 3 files changed, 106 insertions(+), 11 deletions(-) create mode 100644 source/util/test/log.cpp diff --git a/source/util/src/tlog.c b/source/util/src/tlog.c index 3ca148a62507..6174a9cb3e32 100644 --- a/source/util/src/tlog.c +++ b/source/util/src/tlog.c @@ -21,10 +21,12 @@ #include "tjson.h" #include "tutil.h" -#define LOG_MAX_LINE_SIZE (10024) -#define LOG_MAX_LINE_BUFFER_SIZE (LOG_MAX_LINE_SIZE + 3) -#define LOG_MAX_LINE_DUMP_SIZE (1024 * 1024) -#define LOG_MAX_LINE_DUMP_BUFFER_SIZE (LOG_MAX_LINE_DUMP_SIZE + 128) +#define LOG_MAX_LINE_SIZE (10024) +#define LOG_MAX_LINE_BUFFER_SIZE (LOG_MAX_LINE_SIZE + 3) +#define LOG_MAX_STACK_LINE_SIZE (512) +#define LOG_MAX_STACK_LINE_BUFFER_SIZE (LOG_MAX_STACK_LINE_SIZE + 3) +#define LOG_MAX_LINE_DUMP_SIZE (1024 * 1024) +#define LOG_MAX_LINE_DUMP_BUFFER_SIZE (LOG_MAX_LINE_DUMP_SIZE + 128) #define LOG_FILE_DAY_LEN 64 @@ -669,16 +671,40 @@ static inline void taosPrintLogImp(ELogLevel level, int32_t dflag, const char *b } } -void taosPrintLog(const char *flags, int32_t level, int32_t dflag, const char *format, ...) { - if (!(dflag & DEBUG_FILE) && !(dflag & DEBUG_SCREEN)) return; +/* + use taosPrintLogImpl_useStackBuffer to avoid stack overflow - char buffer[LOG_MAX_LINE_BUFFER_SIZE]; +*/ +int8_t taosPrintLogImpl_useStackBuffer(const char *flags, int32_t level, int32_t dflag, const char *format, + va_list args) { + char buffer[LOG_MAX_STACK_LINE_BUFFER_SIZE]; int32_t len = taosBuildLogHead(buffer, flags); - va_list argpointer; - va_start(argpointer, format); - int32_t writeLen = len + vsnprintf(buffer + len, LOG_MAX_LINE_BUFFER_SIZE - len, format, argpointer); - va_end(argpointer); + int32_t writeLen = len + vsnprintf(buffer + len, LOG_MAX_STACK_LINE_BUFFER_SIZE - len - 1, format, args); + if (writeLen > LOG_MAX_STACK_LINE_SIZE) { + return 1; + } + + buffer[writeLen++] = '\n'; + buffer[writeLen] = 0; + + taosPrintLogImp(level, dflag, buffer, writeLen); + + if (tsLogFp && level <= DEBUG_INFO) { + buffer[writeLen - 1] = 0; + (*tsLogFp)(taosGetTimestampMs(), level, buffer + len); + } + return 0; +} +int8_t taosPrintLogImpl_useHeapBuffer(const char *flags, int32_t level, int32_t dflag, const char *format, + va_list args) { + char *buffer = taosMemoryCalloc(1, LOG_MAX_LINE_BUFFER_SIZE + 1); + if (buffer == NULL) { + return 1; + } + int32_t len = taosBuildLogHead(buffer, flags); + + int32_t writeLen = len + vsnprintf(buffer + len, LOG_MAX_LINE_BUFFER_SIZE - len - 1, format, args); if (writeLen > LOG_MAX_LINE_SIZE) writeLen = LOG_MAX_LINE_SIZE; buffer[writeLen++] = '\n'; @@ -690,6 +716,22 @@ void taosPrintLog(const char *flags, int32_t level, int32_t dflag, const char *f buffer[writeLen - 1] = 0; (*tsLogFp)(taosGetTimestampMs(), level, buffer + len); } + taosMemoryFree(buffer); + return 0; +} +void taosPrintLog(const char *flags, int32_t level, int32_t dflag, const char *format, ...) { + if (!(dflag & DEBUG_FILE) && !(dflag & DEBUG_SCREEN)) return; + + va_list argpointer, argpointer_copy; + va_start(argpointer, format); + va_copy(argpointer_copy, argpointer); + + if (taosPrintLogImpl_useStackBuffer(flags, level, dflag, format, argpointer) == 0) { + } else { + TAOS_UNUSED(taosPrintLogImpl_useHeapBuffer(flags, level, dflag, format, argpointer_copy)); + } + va_end(argpointer_copy); + va_end(argpointer); } void taosPrintLongString(const char *flags, int32_t level, int32_t dflag, const char *format, ...) { diff --git a/source/util/test/CMakeLists.txt b/source/util/test/CMakeLists.txt index 4966a629d802..3732c2af59e8 100644 --- a/source/util/test/CMakeLists.txt +++ b/source/util/test/CMakeLists.txt @@ -126,6 +126,13 @@ add_test( COMMAND regexTest ) +add_executable(logTest "log.cpp") + target_link_libraries(logTest os util common gtest_main) + add_test( + NAME logTest + COMMAND logTest +) + add_executable(decompressTest "decompressTest.cpp") target_link_libraries(decompressTest os util common gtest_main) add_test( diff --git a/source/util/test/log.cpp b/source/util/test/log.cpp new file mode 100644 index 000000000000..ba32d2d63949 --- /dev/null +++ b/source/util/test/log.cpp @@ -0,0 +1,46 @@ +#include +#include +#include +#include +#include +#include + +using namespace std; + + +TEST(log, check_log_refactor) { + const char *logDir = "/tmp"; + const char *defaultLogFileNamePrefix = "taoslog"; + const int32_t maxLogFileNum = 10000; + tsAsyncLog = 0; + // idxDebugFlag = 143; + strcpy(tsLogDir, (char *)logDir); + taosInitLog(tsLogDir, 10, false); + tsAsyncLog = 0; + uDebugFlag = 143; + + std::string str; + str.push_back('a'); + + for (int i = 0; i < 10000; i += 2) { + str.push_back('a'); + uError("write to file %s", str.c_str()); + } + str.clear(); + for (int i = 0; i < 10000; i += 2) { + str.push_back('a'); + uDebug("write to file %s", str.c_str()); + } + + for (int i = 0; i < 10000; i += 2) { + str.push_back('a'); + uInfo("write to file %s", str.c_str()); + } + str.clear(); + + for (int i = 0; i < 10000; i += 2) { + str.push_back('a'); + uTrace("write to file %s", str.c_str()); + } + taosCloseLog(); +} From 036b7ebefa0e4386fefa0e3ed370edb54086a323 Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Mon, 28 Oct 2024 16:12:18 +0800 Subject: [PATCH 358/695] fix: replace unsafe str fun and check return value --- tools/shell/src/shellAuto.c | 54 ++++++------ tools/shell/test/shellTest.cpp | 145 +++++++++++++++++---------------- 2 files changed, 105 insertions(+), 94 deletions(-) diff --git a/tools/shell/src/shellAuto.c b/tools/shell/src/shellAuto.c index 201389f20b70..8ad9e9072b94 100644 --- a/tools/shell/src/shellAuto.c +++ b/tools/shell/src/shellAuto.c @@ -700,9 +700,9 @@ SWord* addWord(const char* p, int32_t len, bool pattern) { // check format if (pattern && len > 0) { - if (p[len-1] == ';') { + if (p[len - 1] == ';') { word->type = wordType(p, len - 1); - word->end = true; + word->end = true; } else { word->type = wordType(p, len); } @@ -1311,7 +1311,7 @@ void printScreen(TAOS* con, SShellCmd* cmd, SWords* match) { // first tab press const char* str = NULL; int strLen = 0; - + SWord* word = MATCH_WORD(match); if (firstMatchIndex == curMatchIndex && lastWordBytes == -1) { // first press tab @@ -1331,14 +1331,18 @@ void printScreen(TAOS* con, SShellCmd* cmd, SWords* match) { if (word->end && str[strLen - 1] != ';') { // append end ';' - char *p = taosMemoryMalloc(strLen + 8); - strcpy(p, str); - strcat(p, ";"); - shellInsertStr(cmd, (char *)p, strLen + 1); - taosMemoryFree(p); + char* p = taosMemoryCalloc(strLen + 8, 1); + if (p) { + tstrncpy(p, str, strLen); + tstrncpy(p + strLen, ";", 1); + shellInsertStr(cmd, (char*)p, strLen + 1); + taosMemoryFree(p); + } else { + shellInsertStr(cmd, (char*)str, strLen); + } } else { // insert new - shellInsertStr(cmd, (char *)str, strLen); + shellInsertStr(cmd, (char*)str, strLen); } } @@ -1722,27 +1726,27 @@ bool fieldOptionsArea(char* p) { } // find tags - if(strstr(p, " tags") != NULL) { + if (strstr(p, " tags") != NULL) { return false; } - if(p2 == NULL) { + if (p2 == NULL) { // first field area p2 = p1; } // find blank count int32_t cnt = 0; - while(p2) { + while (p2) { p2 = strchr(p2, ' '); if (p2) { // get prev char char prec = *(p2 - 1); if (prec != ',' && prec != '(') { // blank if before comma, not calc count. like st(ts timestamp, age int + BLANK + TAB only two blank - cnt ++; + cnt++; } - + // continue blank is one blank while (p2[1] != 0 && p2[1] == ' ') { // move next if blank again @@ -1758,18 +1762,18 @@ bool fieldOptionsArea(char* p) { // if is input create fields or tags area, return true bool isCreateFieldsArea(char* p) { - int32_t n = 0; // count - char *p1 = p; + int32_t n = 0; // count + char* p1 = p; while (*p1 != 0) { switch (*p1) { - case '(': - ++ n; - break; - case ')': - -- n; - break; - default: - break; + case '(': + ++n; + break; + case ')': + --n; + break; + default: + break; } // move next ++p1; @@ -1813,7 +1817,7 @@ bool matchCreateTable(TAOS* con, SShellCmd* cmd) { char* last = lastWord(ps); // check in create fields or tags input area - if (isCreateFieldsArea(ps)) { + if (isCreateFieldsArea(ps)) { if (fieldOptionsArea(ps)) { // fill field options ret = fillWithType(con, cmd, last, WT_VAR_FIELD_OPTIONS); diff --git a/tools/shell/test/shellTest.cpp b/tools/shell/test/shellTest.cpp index 1f3f1b1b2af8..cf0ec503fe30 100644 --- a/tools/shell/test/shellTest.cpp +++ b/tools/shell/test/shellTest.cpp @@ -17,56 +17,58 @@ #include #include "shellAuto.h" - TEST(fieldOptionsArea, autoTabTest) { printf("hellow world SHELL tab test\n"); // str false - const char *s0 [] = { - "create table st(ts ", - "create table st(ts timestamp, age ", - "create table st(ts timestamp, age", - "create table st(ts timestamp, age int , name ", - "create table st(ts timestamp, age int , name binary(16)", - "create table st(ts timestamp, age int , name binary(16) ) tags( ", - "create table st(ts timestamp, age int , name binary(16) ) tags( area int, addr ", - "create table st(ts timestamp, age int , name binary(16) ) tags( area int,addr varbinary", - "create table st(ts timestamp, age int, name binary(16)) tags(area int , addr varbinary(32)", - "create table st( ts timestamp, age int, name binary(16)) tags( area int, addr", - "create table st (ts timestamp , age int, name binary(16) , area int,", - "create table st (ts timestamp , age int, name binary(16) ) tags ( area int ,addr varbinary", - "create table st (ts timestamp , age int, name binary(16) ) tags ( area int , addr varbinary(32) level 'high' , no i", - "create table st (ts timestamp , age int, name binary(16) ) tags ( area int , addr varbinary(32) encode 'simple8b' level 'high', no in", + const char *s0[] = { + "create table st(ts ", + "create table st(ts timestamp, age ", + "create table st(ts timestamp, age", + "create table st(ts timestamp, age int , name ", + "create table st(ts timestamp, age int , name binary(16)", + "create table st(ts timestamp, age int , name binary(16) ) tags( ", + "create table st(ts timestamp, age int , name binary(16) ) tags( area int, addr ", + "create table st(ts timestamp, age int , name binary(16) ) tags( area int,addr varbinary", + "create table st(ts timestamp, age int, name binary(16)) tags(area int , addr varbinary(32)", + "create table st( ts timestamp, age int, name binary(16)) tags( area int, addr", + "create table st (ts timestamp , age int, name binary(16) , area int,", + "create table st (ts timestamp , age int, name binary(16) ) tags ( area int ,addr varbinary", + "create table st (ts timestamp , age int, name binary(16) ) tags ( area int , addr varbinary(32) level " + "'high' , no i", + "create table st (ts timestamp , age int, name binary(16) ) tags ( area int , addr varbinary(32) encode " + "'simple8b' level 'high', no in", }; // str true - const char *s1 [] = { - "create table st(ts timestamp ", - "create table st(ts timestamp, age int ", - "create table st(ts timestamp, age int ", - "create table st(ts timestamp, age int , name binary(16) ", - "create table st(ts timestamp, age int , name binary(16) ", - "create table st(ts timestamp, age int , name binary(16) , addr varbinary( 32 ) ", - "create table st(ts timestamp, age int , name binary(16) ,area int, addr varbinary(32) ", - "create table st(ts timestamp, age int , name binary(16), area int,addr varbinary(32) ", - "create table st(ts timestamp, age int, name binary(16) , area int,addr varbinary(32) ", - "create table st( ts timestamp, age int, name binary(16) ,area int,addr varbinary(32) ", - "create table st (ts timestamp , age int, name binary(16), area int,addr varbinary(32) ", - "create table st (ts timestamp , age int, name binary(16), area int , addr varbinary(32) compress 'zlib' ", - "create table st (ts timestamp , age int, name binary(16), area int , addr varbinary(32) level 'high' ", - "create table st (ts timestamp , age int, name binary(16) , area int , addr varbinary(32) encode 'simple8b' level 'high' ", + const char *s1[] = { + "create table st(ts timestamp ", + "create table st(ts timestamp, age int ", + "create table st(ts timestamp, age int ", + "create table st(ts timestamp, age int , name binary(16) ", + "create table st(ts timestamp, age int , name binary(16) ", + "create table st(ts timestamp, age int , name binary(16) , addr varbinary( 32 ) ", + "create table st(ts timestamp, age int , name binary(16) ,area int, addr varbinary(32) ", + "create table st(ts timestamp, age int , name binary(16), area int,addr varbinary(32) ", + "create table st(ts timestamp, age int, name binary(16) , area int,addr varbinary(32) ", + "create table st( ts timestamp, age int, name binary(16) ,area int,addr varbinary(32) ", + "create table st (ts timestamp , age int, name binary(16), area int,addr varbinary(32) ", + "create table st (ts timestamp , age int, name binary(16), area int , addr varbinary(32) compress 'zlib' ", + "create table st (ts timestamp , age int, name binary(16), area int , addr varbinary(32) level 'high' ", + "create table st (ts timestamp , age int, name binary(16) , area int , addr varbinary(32) encode 'simple8b' " + "level 'high' ", }; // s0 is false - for(int32_t i = 0; i < sizeof(s0)/sizeof(char*) ; i++) { + for (int32_t i = 0; i < sizeof(s0) / sizeof(char *); i++) { printf("s0 i=%d fieldOptionsArea %s expect false \n", i, s0[i]); - ASSERT (fieldOptionsArea((char *)s0[i]) == false); + ASSERT(fieldOptionsArea((char *)s0[i]) == false); } // s1 is true - for(int32_t i = 0; i < sizeof(s1)/sizeof(char*) ; i++) { + for (int32_t i = 0; i < sizeof(s1) / sizeof(char *); i++) { printf("s1 i=%d fieldOptionsArea %s expect true \n", i, s1[i]); - ASSERT (fieldOptionsArea((char *)s1[i]) == true); + ASSERT(fieldOptionsArea((char *)s1[i]) == true); } } @@ -74,51 +76,56 @@ TEST(isCreateFieldsArea, autoTabTest) { printf("hellow world SHELL tab test\n"); // str false - const char *s0 [] = { - "create table st(ts )", - "create table st(ts timestamp, age) ", - "create table st(ts timestamp, age)", - "create table st(ts timestamp, age int , name binary(16) )", - "create table st(ts timestamp, age int , name binary(16))", - "create table st(ts timestamp, age int , name binary(16) ) tags( )", - "create table st(ts timestamp, age int , name binary(16) ) tags( area int, addr )", - "create table st(ts timestamp, age int , name binary(16) ) tags( area int,addr varbinary)", - "create table st(ts timestamp, age int, name binary(16)) tags(area int , addr varbinary(32))", - "create table st( ts timestamp, age int, name binary(16)) tags( area int, addr int)", - "create table st (ts timestamp , age int, name binary(16) ) tags ( area int,addr varbinary(32) )", - "create table st (ts timestamp , age int, name binary(16) ) tags ( area int ,addr varbinary(14))", - "create table st (ts timestamp , age int, name binary(16) ) tags ( area int , addr varbinary(32) level 'high' )", - "create table st (ts timestamp , age int, name binary(16) ) tags ( area int , addr varbinary(32) encode 'simple8b' level 'high' ) ", + const char *s0[] = { + "create table st(ts )", + "create table st(ts timestamp, age) ", + "create table st(ts timestamp, age)", + "create table st(ts timestamp, age int , name binary(16) )", + "create table st(ts timestamp, age int , name binary(16))", + "create table st(ts timestamp, age int , name binary(16) ) tags( )", + "create table st(ts timestamp, age int , name binary(16) ) tags( area int, addr )", + "create table st(ts timestamp, age int , name binary(16) ) tags( area int,addr varbinary)", + "create table st(ts timestamp, age int, name binary(16)) tags(area int , addr varbinary(32))", + "create table st( ts timestamp, age int, name binary(16)) tags( area int, addr int)", + "create table st (ts timestamp , age int, name binary(16) ) tags ( area int,addr varbinary(32) )", + "create table st (ts timestamp , age int, name binary(16) ) tags ( area int ,addr varbinary(14))", + "create table st (ts timestamp , age int, name binary(16) ) tags ( area int , addr varbinary(32) level " + "'high' )", + "create table st (ts timestamp , age int, name binary(16) ) tags ( area int , addr varbinary(32) encode " + "'simple8b' level 'high' ) ", }; // str true - const char *s1 [] = { - "create table st(ts timestamp ", - "create table st(ts timestamp, age int ", - "create table st(ts timestamp, age int ,", - "create table st(ts timestamp, age int , name binary(16), ", - "create table st(ts timestamp, age int , name binary(16) ", - "create table st(ts timestamp, age int , name binary(16) ) tags( area int ", - "create table st(ts timestamp, age int , name binary(16) ) tags( area int, addr varbinary(32) ", - "create table st(ts timestamp, age int , name binary(16) ) tags( area int,addr varbinary(32)", - "create table st(ts timestamp, age int, name binary(16)) tags(area int,addr varbinary(32) ", - "create table st( ts timestamp, age int, name binary(16)) tags(area int,addr varbinary(32) ", - "create table st (ts timestamp , age int, name binary(16) ) tags ( area int, addr varbinary(32) ", - "create table st (ts timestamp , age int, name binary(16) ) tags ( area int , addr varbinary(32) compress 'zlib' ", - "create table st (ts timestamp , age int, name binary(16) ) tags ( area int , addr varbinary(32) level 'high' ", - "create table st (ts timestamp , age int, name binary(16) ) tags ( area int , addr varbinary(32) encode 'simple8b' level 'high' ", + const char *s1[] = { + "create table st(ts timestamp ", + "create table st(ts timestamp, age int ", + "create table st(ts timestamp, age int ,", + "create table st(ts timestamp, age int , name binary(16), ", + "create table st(ts timestamp, age int , name binary(16) ", + "create table st(ts timestamp, age int , name binary(16) ) tags( area int ", + "create table st(ts timestamp, age int , name binary(16) ) tags( area int, addr varbinary(32) ", + "create table st(ts timestamp, age int , name binary(16) ) tags( area int,addr varbinary(32)", + "create table st(ts timestamp, age int, name binary(16)) tags(area int,addr varbinary(32) ", + "create table st( ts timestamp, age int, name binary(16)) tags(area int,addr varbinary(32) ", + "create table st (ts timestamp , age int, name binary(16) ) tags ( area int, addr varbinary(32) ", + "create table st (ts timestamp , age int, name binary(16) ) tags ( area int , addr varbinary(32) compress " + "'zlib' ", + "create table st (ts timestamp , age int, name binary(16) ) tags ( area int , addr varbinary(32) level " + "'high' ", + "create table st (ts timestamp , age int, name binary(16) ) tags ( area int , addr varbinary(32) encode " + "'simple8b' level 'high' ", }; // s0 is false - for(int32_t i = 0; i < sizeof(s0)/sizeof(char*) ; i++) { + for (int32_t i = 0; i < sizeof(s0) / sizeof(char *); i++) { printf("s0 i=%d isCreateFieldsArea %s expect false. \n", i, s0[i]); - ASSERT (isCreateFieldsArea((char *)s0[i]) == false); + ASSERT(isCreateFieldsArea((char *)s0[i]) == false); } // s1 is true - for(int32_t i = 0; i < sizeof(s1)/sizeof(char*) ; i++) { + for (int32_t i = 0; i < sizeof(s1) / sizeof(char *); i++) { printf("s1 i=%d isCreateFieldsArea %s expect true. \n", i, s1[i]); - ASSERT (isCreateFieldsArea((char *)s1[i]) == true); + ASSERT(isCreateFieldsArea((char *)s1[i]) == true); } } From 6b6c9c884e4856f33099e33898252cf4ef3f2c1d Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Mon, 28 Oct 2024 16:21:15 +0800 Subject: [PATCH 359/695] fix: tstrncpy len must add 1 --- tools/shell/src/shellAuto.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/shell/src/shellAuto.c b/tools/shell/src/shellAuto.c index 8ad9e9072b94..a3093237cb6a 100644 --- a/tools/shell/src/shellAuto.c +++ b/tools/shell/src/shellAuto.c @@ -1333,8 +1333,8 @@ void printScreen(TAOS* con, SShellCmd* cmd, SWords* match) { // append end ';' char* p = taosMemoryCalloc(strLen + 8, 1); if (p) { - tstrncpy(p, str, strLen); - tstrncpy(p + strLen, ";", 1); + tstrncpy(p, str, strLen + 1); + tstrncpy(p + strLen, ";", 1 + 1); shellInsertStr(cmd, (char*)p, strLen + 1); taosMemoryFree(p); } else { From 462dc3362f2c88fe5428ceb43f700dc65d905024 Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Mon, 28 Oct 2024 16:27:52 +0800 Subject: [PATCH 360/695] fix: lastWordBytes need add 1 --- tools/shell/src/shellAuto.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/shell/src/shellAuto.c b/tools/shell/src/shellAuto.c index a3093237cb6a..959e2d6d62d9 100644 --- a/tools/shell/src/shellAuto.c +++ b/tools/shell/src/shellAuto.c @@ -1335,6 +1335,7 @@ void printScreen(TAOS* con, SShellCmd* cmd, SWords* match) { if (p) { tstrncpy(p, str, strLen + 1); tstrncpy(p + strLen, ";", 1 + 1); + lastWordBytes += 1; shellInsertStr(cmd, (char*)p, strLen + 1); taosMemoryFree(p); } else { From 64c16fbcfecba2ce9c198347b15891833ee20be6 Mon Sep 17 00:00:00 2001 From: Shungang Li Date: Mon, 28 Oct 2024 16:34:31 +0800 Subject: [PATCH 361/695] docs: add example for 'insert into stb file csv_path' --- docs/zh/14-reference/03-taos-sql/03-table.md | 2 +- docs/zh/14-reference/03-taos-sql/05-insert.md | 26 ++++++++++++------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/docs/zh/14-reference/03-taos-sql/03-table.md b/docs/zh/14-reference/03-taos-sql/03-table.md index cad9190bd90e..9e4cc66eaf53 100644 --- a/docs/zh/14-reference/03-taos-sql/03-table.md +++ b/docs/zh/14-reference/03-taos-sql/03-table.md @@ -87,7 +87,7 @@ CREATE TABLE [IF NOT EXISTS] USING [db_name.]stb_name (field1_name [, field2_nam **参数说明** -1. FILE 语法表示数据来自于 CSV 文件(英文逗号分隔、英文单引号括住每个值),CSV 文件无需表头。CSV 文件中应仅包含 table name 与 tag 值。如需插入数据,请参考数据写入章节。 +1. FILE 语法表示数据来自于 CSV 文件(英文逗号分隔、英文单引号括住每个值),CSV 文件无需表头。CSV 文件中应仅包含 table name 与 tag 值。如需插入数据,请参考'数据写入'章节。 2. 为指定的 stb_name 创建子表,该超级表必须已经存在。 3. field_name 列表顺序与 CSV 文件各列内容顺序一致。列表中不允许出现重复项,且必须包含 `tbname`,可包含零个或多个超级表中已定义的标签列。未包含在列表中的标签值将被设置为 NULL。 diff --git a/docs/zh/14-reference/03-taos-sql/05-insert.md b/docs/zh/14-reference/03-taos-sql/05-insert.md index b2c34f4c558a..40f8e95006cb 100644 --- a/docs/zh/14-reference/03-taos-sql/05-insert.md +++ b/docs/zh/14-reference/03-taos-sql/05-insert.md @@ -1,7 +1,7 @@ --- sidebar_label: 数据写入 title: 数据写入 -description: 写入数据的详细语法 +description: 写入数据的详细语法 --- ## 写入语法 @@ -25,9 +25,9 @@ INSERT INTO tb_name [(field1_name, ...)] subquery ### 超级表语法 ```sql INSERT INTO - stb1_name [(field1_name, ...)] + stb1_name [(field1_name, ...)] VALUES (field1_value, ...) [(field1_value2, ...) ...] | FILE csv_file_path - [stb2_name [(field1_name, ...)] + [stb2_name [(field1_name, ...)] VALUES (field1_value, ...) [(field1_value2, ...) ...] | FILE csv_file_path ...]; ``` @@ -47,7 +47,7 @@ INSERT INTO 2. VALUES 语法表示了要插入的一行或多行数据。 -3. FILE 语法表示数据来自于 CSV 文件(英文逗号分隔、英文单引号括住每个值),CSV 文件无需表头。 +3. FILE 语法表示数据来自于 CSV 文件(英文逗号分隔、英文单引号括住每个值),CSV 文件无需表头。如仅需创建子表,请参考'表'章节。 4. `INSERT ... VALUES` 语句和 `INSERT ... FILE` 语句均可以在一条 INSERT 语句中同时向多个表插入数据。 @@ -154,12 +154,20 @@ INSERT INTO d21001 USING meters TAGS ('California.SanFrancisco', 2) FILE '/tmp/c INSERT INTO d21001 USING meters TAGS ('California.SanFrancisco', 2) FILE '/tmp/csvfile_21001.csv' d21002 USING meters (groupId) TAGS (2) FILE '/tmp/csvfile_21002.csv'; ``` -## 超级表语法 +## 向超级表插入数据并自动创建子表 -自动建表, 表名通过tbname列指定 +自动建表, 表名通过 tbname 列指定 ```sql -INSERT INTO meters(tbname, location, groupId, ts, current, voltage, phase) - values('d31001', 'California.SanFrancisco', 2, '2021-07-13 14:06:34.630', 10.2, 219, 0.32) +INSERT INTO meters(tbname, location, groupId, ts, current, voltage, phase) + VALUES ('d31001', 'California.SanFrancisco', 2, '2021-07-13 14:06:34.630', 10.2, 219, 0.32) ('d31001', 'California.SanFrancisco', 2, '2021-07-13 14:06:35.779', 10.15, 217, 0.33) - ('d31002', NULL, 2, '2021-07-13 14:06:34.255', 10.15, 217, 0.33) + ('d31002', NULL, 2, '2021-07-13 14:06:34.255', 10.15, 217, 0.33) +``` +## 通过 CSV 文件向超级表插入数据并自动创建子表 + +根据 csv 文件内容,为 超级表创建子表,并填充相应 column 与 tag + +```sql +INSERT INTO meters(tbname, location, groupId, ts, current, voltage, phase) + FILE '/tmp/csvfile_21002.csv' ``` From 53826a320f260b481643a4e4e224373c48778810 Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Mon, 28 Oct 2024 16:46:26 +0800 Subject: [PATCH 362/695] fix(s3/s3_chunksize): rename to s3_chunkpages & default to 128k pages --- include/common/ttokendef.h | 776 ++++++------ include/util/tdef.h | 2 +- source/common/src/systable.c | 2 +- source/libs/command/src/command.c | 146 +-- source/libs/parser/inc/parAst.h | 4 +- source/libs/parser/inc/sql.y | 2 +- source/libs/parser/src/parAstCreater.c | 28 +- source/libs/parser/src/parTokenizer.c | 14 +- source/libs/parser/src/parTranslater.c | 490 ++++---- source/libs/parser/src/sql.c | 1502 +++++++++++++++++++++++- 10 files changed, 2205 insertions(+), 761 deletions(-) diff --git a/include/common/ttokendef.h b/include/common/ttokendef.h index b86830869ccc..3b2a0a009467 100644 --- a/include/common/ttokendef.h +++ b/include/common/ttokendef.h @@ -16,394 +16,394 @@ #ifndef _TD_COMMON_TOKEN_H_ #define _TD_COMMON_TOKEN_H_ -#define TK_OR 1 -#define TK_AND 2 -#define TK_UNION 3 -#define TK_ALL 4 -#define TK_MINUS 5 -#define TK_EXCEPT 6 -#define TK_INTERSECT 7 -#define TK_NK_BITAND 8 -#define TK_NK_BITOR 9 -#define TK_NK_LSHIFT 10 -#define TK_NK_RSHIFT 11 -#define TK_NK_PLUS 12 -#define TK_NK_MINUS 13 -#define TK_NK_STAR 14 -#define TK_NK_SLASH 15 -#define TK_NK_REM 16 -#define TK_NK_CONCAT 17 -#define TK_CREATE 18 -#define TK_ACCOUNT 19 -#define TK_NK_ID 20 -#define TK_PASS 21 -#define TK_NK_STRING 22 -#define TK_ALTER 23 -#define TK_PPS 24 -#define TK_TSERIES 25 -#define TK_STORAGE 26 -#define TK_STREAMS 27 -#define TK_QTIME 28 -#define TK_DBS 29 -#define TK_USERS 30 -#define TK_CONNS 31 -#define TK_STATE 32 -#define TK_NK_COMMA 33 -#define TK_HOST 34 -#define TK_IS_IMPORT 35 -#define TK_NK_INTEGER 36 -#define TK_CREATEDB 37 -#define TK_USER 38 -#define TK_ENABLE 39 -#define TK_SYSINFO 40 -#define TK_ADD 41 -#define TK_DROP 42 -#define TK_GRANT 43 -#define TK_ON 44 -#define TK_TO 45 -#define TK_REVOKE 46 -#define TK_FROM 47 -#define TK_SUBSCRIBE 48 -#define TK_READ 49 -#define TK_WRITE 50 -#define TK_NK_DOT 51 -#define TK_WITH 52 -#define TK_ENCRYPT_KEY 53 -#define TK_ANODE 54 -#define TK_UPDATE 55 -#define TK_ANODES 56 -#define TK_DNODE 57 -#define TK_PORT 58 -#define TK_DNODES 59 -#define TK_RESTORE 60 -#define TK_NK_IPTOKEN 61 -#define TK_FORCE 62 -#define TK_UNSAFE 63 -#define TK_CLUSTER 64 -#define TK_LOCAL 65 -#define TK_QNODE 66 -#define TK_BNODE 67 -#define TK_SNODE 68 -#define TK_MNODE 69 -#define TK_VNODE 70 -#define TK_DATABASE 71 -#define TK_USE 72 -#define TK_FLUSH 73 -#define TK_TRIM 74 -#define TK_S3MIGRATE 75 -#define TK_COMPACT 76 -#define TK_IF 77 -#define TK_NOT 78 -#define TK_EXISTS 79 -#define TK_BUFFER 80 -#define TK_CACHEMODEL 81 -#define TK_CACHESIZE 82 -#define TK_COMP 83 -#define TK_DURATION 84 -#define TK_NK_VARIABLE 85 -#define TK_MAXROWS 86 -#define TK_MINROWS 87 -#define TK_KEEP 88 -#define TK_PAGES 89 -#define TK_PAGESIZE 90 -#define TK_TSDB_PAGESIZE 91 -#define TK_PRECISION 92 -#define TK_REPLICA 93 -#define TK_VGROUPS 94 -#define TK_SINGLE_STABLE 95 -#define TK_RETENTIONS 96 -#define TK_SCHEMALESS 97 -#define TK_WAL_LEVEL 98 -#define TK_WAL_FSYNC_PERIOD 99 -#define TK_WAL_RETENTION_PERIOD 100 -#define TK_WAL_RETENTION_SIZE 101 -#define TK_WAL_ROLL_PERIOD 102 -#define TK_WAL_SEGMENT_SIZE 103 -#define TK_STT_TRIGGER 104 -#define TK_TABLE_PREFIX 105 -#define TK_TABLE_SUFFIX 106 -#define TK_S3_CHUNKSIZE 107 -#define TK_S3_KEEPLOCAL 108 -#define TK_S3_COMPACT 109 -#define TK_KEEP_TIME_OFFSET 110 -#define TK_ENCRYPT_ALGORITHM 111 -#define TK_NK_COLON 112 -#define TK_BWLIMIT 113 -#define TK_START 114 -#define TK_TIMESTAMP 115 -#define TK_END 116 -#define TK_TABLE 117 -#define TK_NK_LP 118 -#define TK_NK_RP 119 -#define TK_USING 120 -#define TK_FILE 121 -#define TK_STABLE 122 -#define TK_COLUMN 123 -#define TK_MODIFY 124 -#define TK_RENAME 125 -#define TK_TAG 126 -#define TK_SET 127 -#define TK_NK_EQ 128 -#define TK_TAGS 129 -#define TK_BOOL 130 -#define TK_TINYINT 131 -#define TK_SMALLINT 132 -#define TK_INT 133 -#define TK_INTEGER 134 -#define TK_BIGINT 135 -#define TK_FLOAT 136 -#define TK_DOUBLE 137 -#define TK_BINARY 138 -#define TK_NCHAR 139 -#define TK_UNSIGNED 140 -#define TK_JSON 141 -#define TK_VARCHAR 142 -#define TK_MEDIUMBLOB 143 -#define TK_BLOB 144 -#define TK_VARBINARY 145 -#define TK_GEOMETRY 146 -#define TK_DECIMAL 147 -#define TK_COMMENT 148 -#define TK_MAX_DELAY 149 -#define TK_WATERMARK 150 -#define TK_ROLLUP 151 -#define TK_TTL 152 -#define TK_SMA 153 -#define TK_DELETE_MARK 154 -#define TK_FIRST 155 -#define TK_LAST 156 -#define TK_SHOW 157 -#define TK_FULL 158 -#define TK_PRIVILEGES 159 -#define TK_DATABASES 160 -#define TK_TABLES 161 -#define TK_STABLES 162 -#define TK_MNODES 163 -#define TK_QNODES 164 -#define TK_ARBGROUPS 165 -#define TK_FUNCTIONS 166 -#define TK_INDEXES 167 -#define TK_ACCOUNTS 168 -#define TK_APPS 169 -#define TK_CONNECTIONS 170 -#define TK_LICENCES 171 -#define TK_GRANTS 172 -#define TK_LOGS 173 -#define TK_MACHINES 174 -#define TK_ENCRYPTIONS 175 -#define TK_QUERIES 176 -#define TK_SCORES 177 -#define TK_TOPICS 178 -#define TK_VARIABLES 179 -#define TK_BNODES 180 -#define TK_SNODES 181 -#define TK_TRANSACTIONS 182 -#define TK_DISTRIBUTED 183 -#define TK_CONSUMERS 184 -#define TK_SUBSCRIPTIONS 185 -#define TK_VNODES 186 -#define TK_ALIVE 187 -#define TK_VIEWS 188 -#define TK_VIEW 189 -#define TK_COMPACTS 190 -#define TK_NORMAL 191 -#define TK_CHILD 192 -#define TK_LIKE 193 -#define TK_TBNAME 194 -#define TK_QTAGS 195 -#define TK_AS 196 -#define TK_SYSTEM 197 -#define TK_TSMA 198 -#define TK_INTERVAL 199 -#define TK_RECURSIVE 200 -#define TK_TSMAS 201 -#define TK_FUNCTION 202 -#define TK_INDEX 203 -#define TK_COUNT 204 -#define TK_LAST_ROW 205 -#define TK_META 206 -#define TK_ONLY 207 -#define TK_TOPIC 208 -#define TK_CONSUMER 209 -#define TK_GROUP 210 -#define TK_DESC 211 -#define TK_DESCRIBE 212 -#define TK_RESET 213 -#define TK_QUERY 214 -#define TK_CACHE 215 -#define TK_EXPLAIN 216 -#define TK_ANALYZE 217 -#define TK_VERBOSE 218 -#define TK_NK_BOOL 219 -#define TK_RATIO 220 -#define TK_NK_FLOAT 221 -#define TK_OUTPUTTYPE 222 -#define TK_AGGREGATE 223 -#define TK_BUFSIZE 224 -#define TK_LANGUAGE 225 -#define TK_REPLACE 226 -#define TK_STREAM 227 -#define TK_INTO 228 -#define TK_PAUSE 229 -#define TK_RESUME 230 -#define TK_PRIMARY 231 -#define TK_KEY 232 -#define TK_TRIGGER 233 -#define TK_AT_ONCE 234 -#define TK_WINDOW_CLOSE 235 -#define TK_IGNORE 236 -#define TK_EXPIRED 237 -#define TK_FILL_HISTORY 238 -#define TK_SUBTABLE 239 -#define TK_UNTREATED 240 -#define TK_KILL 241 -#define TK_CONNECTION 242 -#define TK_TRANSACTION 243 -#define TK_BALANCE 244 -#define TK_VGROUP 245 -#define TK_LEADER 246 -#define TK_MERGE 247 -#define TK_REDISTRIBUTE 248 -#define TK_SPLIT 249 -#define TK_DELETE 250 -#define TK_INSERT 251 -#define TK_NK_BIN 252 -#define TK_NK_HEX 253 -#define TK_NULL 254 -#define TK_NK_QUESTION 255 -#define TK_NK_ALIAS 256 -#define TK_NK_ARROW 257 -#define TK_ROWTS 258 -#define TK_QSTART 259 -#define TK_QEND 260 -#define TK_QDURATION 261 -#define TK_WSTART 262 -#define TK_WEND 263 -#define TK_WDURATION 264 -#define TK_IROWTS 265 -#define TK_ISFILLED 266 -#define TK_FLOW 267 -#define TK_FHIGH 268 -#define TK_FROWTS 269 -#define TK_CAST 270 -#define TK_POSITION 271 -#define TK_IN 272 -#define TK_FOR 273 -#define TK_NOW 274 -#define TK_TODAY 275 -#define TK_RAND 276 -#define TK_SUBSTR 277 -#define TK_SUBSTRING 278 -#define TK_BOTH 279 -#define TK_TRAILING 280 -#define TK_LEADING 281 -#define TK_TIMEZONE 282 -#define TK_CLIENT_VERSION 283 -#define TK_SERVER_VERSION 284 -#define TK_SERVER_STATUS 285 -#define TK_CURRENT_USER 286 -#define TK_PI 287 -#define TK_CASE 288 -#define TK_WHEN 289 -#define TK_THEN 290 -#define TK_ELSE 291 -#define TK_BETWEEN 292 -#define TK_IS 293 -#define TK_NK_LT 294 -#define TK_NK_GT 295 -#define TK_NK_LE 296 -#define TK_NK_GE 297 -#define TK_NK_NE 298 -#define TK_MATCH 299 -#define TK_NMATCH 300 -#define TK_CONTAINS 301 -#define TK_JOIN 302 -#define TK_INNER 303 -#define TK_LEFT 304 -#define TK_RIGHT 305 -#define TK_OUTER 306 -#define TK_SEMI 307 -#define TK_ANTI 308 -#define TK_ASOF 309 -#define TK_WINDOW 310 -#define TK_WINDOW_OFFSET 311 -#define TK_JLIMIT 312 -#define TK_SELECT 313 -#define TK_NK_HINT 314 -#define TK_DISTINCT 315 -#define TK_WHERE 316 -#define TK_PARTITION 317 -#define TK_BY 318 -#define TK_SESSION 319 -#define TK_STATE_WINDOW 320 -#define TK_EVENT_WINDOW 321 -#define TK_COUNT_WINDOW 322 -#define TK_ANOMALY_WINDOW 323 -#define TK_SLIDING 324 -#define TK_FILL 325 -#define TK_VALUE 326 -#define TK_VALUE_F 327 -#define TK_NONE 328 -#define TK_PREV 329 -#define TK_NULL_F 330 -#define TK_LINEAR 331 -#define TK_NEXT 332 -#define TK_HAVING 333 -#define TK_RANGE 334 -#define TK_EVERY 335 -#define TK_ORDER 336 -#define TK_SLIMIT 337 -#define TK_SOFFSET 338 -#define TK_LIMIT 339 -#define TK_OFFSET 340 -#define TK_ASC 341 -#define TK_NULLS 342 -#define TK_ABORT 343 -#define TK_AFTER 344 -#define TK_ATTACH 345 -#define TK_BEFORE 346 -#define TK_BEGIN 347 -#define TK_BITAND 348 -#define TK_BITNOT 349 -#define TK_BITOR 350 -#define TK_BLOCKS 351 -#define TK_CHANGE 352 -#define TK_COMMA 353 -#define TK_CONCAT 354 -#define TK_CONFLICT 355 -#define TK_COPY 356 -#define TK_DEFERRED 357 -#define TK_DELIMITERS 358 -#define TK_DETACH 359 -#define TK_DIVIDE 360 -#define TK_DOT 361 -#define TK_EACH 362 -#define TK_FAIL 363 -#define TK_GLOB 364 -#define TK_ID 365 -#define TK_IMMEDIATE 366 -#define TK_IMPORT 367 -#define TK_INITIALLY 368 -#define TK_INSTEAD 369 -#define TK_ISNULL 370 -#define TK_MODULES 371 -#define TK_NK_BITNOT 372 -#define TK_NK_SEMI 373 -#define TK_NOTNULL 374 -#define TK_OF 375 -#define TK_PLUS 376 -#define TK_PRIVILEGE 377 -#define TK_RAISE 378 -#define TK_RESTRICT 379 -#define TK_ROW 380 -#define TK_STAR 381 -#define TK_STATEMENT 382 -#define TK_STRICT 383 -#define TK_STRING 384 -#define TK_TIMES 385 -#define TK_VALUES 386 -#define TK_VARIABLE 387 -#define TK_WAL 388 +#define TK_OR 1 +#define TK_AND 2 +#define TK_UNION 3 +#define TK_ALL 4 +#define TK_MINUS 5 +#define TK_EXCEPT 6 +#define TK_INTERSECT 7 +#define TK_NK_BITAND 8 +#define TK_NK_BITOR 9 +#define TK_NK_LSHIFT 10 +#define TK_NK_RSHIFT 11 +#define TK_NK_PLUS 12 +#define TK_NK_MINUS 13 +#define TK_NK_STAR 14 +#define TK_NK_SLASH 15 +#define TK_NK_REM 16 +#define TK_NK_CONCAT 17 +#define TK_CREATE 18 +#define TK_ACCOUNT 19 +#define TK_NK_ID 20 +#define TK_PASS 21 +#define TK_NK_STRING 22 +#define TK_ALTER 23 +#define TK_PPS 24 +#define TK_TSERIES 25 +#define TK_STORAGE 26 +#define TK_STREAMS 27 +#define TK_QTIME 28 +#define TK_DBS 29 +#define TK_USERS 30 +#define TK_CONNS 31 +#define TK_STATE 32 +#define TK_NK_COMMA 33 +#define TK_HOST 34 +#define TK_IS_IMPORT 35 +#define TK_NK_INTEGER 36 +#define TK_CREATEDB 37 +#define TK_USER 38 +#define TK_ENABLE 39 +#define TK_SYSINFO 40 +#define TK_ADD 41 +#define TK_DROP 42 +#define TK_GRANT 43 +#define TK_ON 44 +#define TK_TO 45 +#define TK_REVOKE 46 +#define TK_FROM 47 +#define TK_SUBSCRIBE 48 +#define TK_READ 49 +#define TK_WRITE 50 +#define TK_NK_DOT 51 +#define TK_WITH 52 +#define TK_ENCRYPT_KEY 53 +#define TK_ANODE 54 +#define TK_UPDATE 55 +#define TK_ANODES 56 +#define TK_DNODE 57 +#define TK_PORT 58 +#define TK_DNODES 59 +#define TK_RESTORE 60 +#define TK_NK_IPTOKEN 61 +#define TK_FORCE 62 +#define TK_UNSAFE 63 +#define TK_CLUSTER 64 +#define TK_LOCAL 65 +#define TK_QNODE 66 +#define TK_BNODE 67 +#define TK_SNODE 68 +#define TK_MNODE 69 +#define TK_VNODE 70 +#define TK_DATABASE 71 +#define TK_USE 72 +#define TK_FLUSH 73 +#define TK_TRIM 74 +#define TK_S3MIGRATE 75 +#define TK_COMPACT 76 +#define TK_IF 77 +#define TK_NOT 78 +#define TK_EXISTS 79 +#define TK_BUFFER 80 +#define TK_CACHEMODEL 81 +#define TK_CACHESIZE 82 +#define TK_COMP 83 +#define TK_DURATION 84 +#define TK_NK_VARIABLE 85 +#define TK_MAXROWS 86 +#define TK_MINROWS 87 +#define TK_KEEP 88 +#define TK_PAGES 89 +#define TK_PAGESIZE 90 +#define TK_TSDB_PAGESIZE 91 +#define TK_PRECISION 92 +#define TK_REPLICA 93 +#define TK_VGROUPS 94 +#define TK_SINGLE_STABLE 95 +#define TK_RETENTIONS 96 +#define TK_SCHEMALESS 97 +#define TK_WAL_LEVEL 98 +#define TK_WAL_FSYNC_PERIOD 99 +#define TK_WAL_RETENTION_PERIOD 100 +#define TK_WAL_RETENTION_SIZE 101 +#define TK_WAL_ROLL_PERIOD 102 +#define TK_WAL_SEGMENT_SIZE 103 +#define TK_STT_TRIGGER 104 +#define TK_TABLE_PREFIX 105 +#define TK_TABLE_SUFFIX 106 +#define TK_S3_CHUNKPAGES 107 +#define TK_S3_KEEPLOCAL 108 +#define TK_S3_COMPACT 109 +#define TK_KEEP_TIME_OFFSET 110 +#define TK_ENCRYPT_ALGORITHM 111 +#define TK_NK_COLON 112 +#define TK_BWLIMIT 113 +#define TK_START 114 +#define TK_TIMESTAMP 115 +#define TK_END 116 +#define TK_TABLE 117 +#define TK_NK_LP 118 +#define TK_NK_RP 119 +#define TK_USING 120 +#define TK_FILE 121 +#define TK_STABLE 122 +#define TK_COLUMN 123 +#define TK_MODIFY 124 +#define TK_RENAME 125 +#define TK_TAG 126 +#define TK_SET 127 +#define TK_NK_EQ 128 +#define TK_TAGS 129 +#define TK_BOOL 130 +#define TK_TINYINT 131 +#define TK_SMALLINT 132 +#define TK_INT 133 +#define TK_INTEGER 134 +#define TK_BIGINT 135 +#define TK_FLOAT 136 +#define TK_DOUBLE 137 +#define TK_BINARY 138 +#define TK_NCHAR 139 +#define TK_UNSIGNED 140 +#define TK_JSON 141 +#define TK_VARCHAR 142 +#define TK_MEDIUMBLOB 143 +#define TK_BLOB 144 +#define TK_VARBINARY 145 +#define TK_GEOMETRY 146 +#define TK_DECIMAL 147 +#define TK_COMMENT 148 +#define TK_MAX_DELAY 149 +#define TK_WATERMARK 150 +#define TK_ROLLUP 151 +#define TK_TTL 152 +#define TK_SMA 153 +#define TK_DELETE_MARK 154 +#define TK_FIRST 155 +#define TK_LAST 156 +#define TK_SHOW 157 +#define TK_FULL 158 +#define TK_PRIVILEGES 159 +#define TK_DATABASES 160 +#define TK_TABLES 161 +#define TK_STABLES 162 +#define TK_MNODES 163 +#define TK_QNODES 164 +#define TK_ARBGROUPS 165 +#define TK_FUNCTIONS 166 +#define TK_INDEXES 167 +#define TK_ACCOUNTS 168 +#define TK_APPS 169 +#define TK_CONNECTIONS 170 +#define TK_LICENCES 171 +#define TK_GRANTS 172 +#define TK_LOGS 173 +#define TK_MACHINES 174 +#define TK_ENCRYPTIONS 175 +#define TK_QUERIES 176 +#define TK_SCORES 177 +#define TK_TOPICS 178 +#define TK_VARIABLES 179 +#define TK_BNODES 180 +#define TK_SNODES 181 +#define TK_TRANSACTIONS 182 +#define TK_DISTRIBUTED 183 +#define TK_CONSUMERS 184 +#define TK_SUBSCRIPTIONS 185 +#define TK_VNODES 186 +#define TK_ALIVE 187 +#define TK_VIEWS 188 +#define TK_VIEW 189 +#define TK_COMPACTS 190 +#define TK_NORMAL 191 +#define TK_CHILD 192 +#define TK_LIKE 193 +#define TK_TBNAME 194 +#define TK_QTAGS 195 +#define TK_AS 196 +#define TK_SYSTEM 197 +#define TK_TSMA 198 +#define TK_INTERVAL 199 +#define TK_RECURSIVE 200 +#define TK_TSMAS 201 +#define TK_FUNCTION 202 +#define TK_INDEX 203 +#define TK_COUNT 204 +#define TK_LAST_ROW 205 +#define TK_META 206 +#define TK_ONLY 207 +#define TK_TOPIC 208 +#define TK_CONSUMER 209 +#define TK_GROUP 210 +#define TK_DESC 211 +#define TK_DESCRIBE 212 +#define TK_RESET 213 +#define TK_QUERY 214 +#define TK_CACHE 215 +#define TK_EXPLAIN 216 +#define TK_ANALYZE 217 +#define TK_VERBOSE 218 +#define TK_NK_BOOL 219 +#define TK_RATIO 220 +#define TK_NK_FLOAT 221 +#define TK_OUTPUTTYPE 222 +#define TK_AGGREGATE 223 +#define TK_BUFSIZE 224 +#define TK_LANGUAGE 225 +#define TK_REPLACE 226 +#define TK_STREAM 227 +#define TK_INTO 228 +#define TK_PAUSE 229 +#define TK_RESUME 230 +#define TK_PRIMARY 231 +#define TK_KEY 232 +#define TK_TRIGGER 233 +#define TK_AT_ONCE 234 +#define TK_WINDOW_CLOSE 235 +#define TK_IGNORE 236 +#define TK_EXPIRED 237 +#define TK_FILL_HISTORY 238 +#define TK_SUBTABLE 239 +#define TK_UNTREATED 240 +#define TK_KILL 241 +#define TK_CONNECTION 242 +#define TK_TRANSACTION 243 +#define TK_BALANCE 244 +#define TK_VGROUP 245 +#define TK_LEADER 246 +#define TK_MERGE 247 +#define TK_REDISTRIBUTE 248 +#define TK_SPLIT 249 +#define TK_DELETE 250 +#define TK_INSERT 251 +#define TK_NK_BIN 252 +#define TK_NK_HEX 253 +#define TK_NULL 254 +#define TK_NK_QUESTION 255 +#define TK_NK_ALIAS 256 +#define TK_NK_ARROW 257 +#define TK_ROWTS 258 +#define TK_QSTART 259 +#define TK_QEND 260 +#define TK_QDURATION 261 +#define TK_WSTART 262 +#define TK_WEND 263 +#define TK_WDURATION 264 +#define TK_IROWTS 265 +#define TK_ISFILLED 266 +#define TK_FLOW 267 +#define TK_FHIGH 268 +#define TK_FROWTS 269 +#define TK_CAST 270 +#define TK_POSITION 271 +#define TK_IN 272 +#define TK_FOR 273 +#define TK_NOW 274 +#define TK_TODAY 275 +#define TK_RAND 276 +#define TK_SUBSTR 277 +#define TK_SUBSTRING 278 +#define TK_BOTH 279 +#define TK_TRAILING 280 +#define TK_LEADING 281 +#define TK_TIMEZONE 282 +#define TK_CLIENT_VERSION 283 +#define TK_SERVER_VERSION 284 +#define TK_SERVER_STATUS 285 +#define TK_CURRENT_USER 286 +#define TK_PI 287 +#define TK_CASE 288 +#define TK_WHEN 289 +#define TK_THEN 290 +#define TK_ELSE 291 +#define TK_BETWEEN 292 +#define TK_IS 293 +#define TK_NK_LT 294 +#define TK_NK_GT 295 +#define TK_NK_LE 296 +#define TK_NK_GE 297 +#define TK_NK_NE 298 +#define TK_MATCH 299 +#define TK_NMATCH 300 +#define TK_CONTAINS 301 +#define TK_JOIN 302 +#define TK_INNER 303 +#define TK_LEFT 304 +#define TK_RIGHT 305 +#define TK_OUTER 306 +#define TK_SEMI 307 +#define TK_ANTI 308 +#define TK_ASOF 309 +#define TK_WINDOW 310 +#define TK_WINDOW_OFFSET 311 +#define TK_JLIMIT 312 +#define TK_SELECT 313 +#define TK_NK_HINT 314 +#define TK_DISTINCT 315 +#define TK_WHERE 316 +#define TK_PARTITION 317 +#define TK_BY 318 +#define TK_SESSION 319 +#define TK_STATE_WINDOW 320 +#define TK_EVENT_WINDOW 321 +#define TK_COUNT_WINDOW 322 +#define TK_ANOMALY_WINDOW 323 +#define TK_SLIDING 324 +#define TK_FILL 325 +#define TK_VALUE 326 +#define TK_VALUE_F 327 +#define TK_NONE 328 +#define TK_PREV 329 +#define TK_NULL_F 330 +#define TK_LINEAR 331 +#define TK_NEXT 332 +#define TK_HAVING 333 +#define TK_RANGE 334 +#define TK_EVERY 335 +#define TK_ORDER 336 +#define TK_SLIMIT 337 +#define TK_SOFFSET 338 +#define TK_LIMIT 339 +#define TK_OFFSET 340 +#define TK_ASC 341 +#define TK_NULLS 342 +#define TK_ABORT 343 +#define TK_AFTER 344 +#define TK_ATTACH 345 +#define TK_BEFORE 346 +#define TK_BEGIN 347 +#define TK_BITAND 348 +#define TK_BITNOT 349 +#define TK_BITOR 350 +#define TK_BLOCKS 351 +#define TK_CHANGE 352 +#define TK_COMMA 353 +#define TK_CONCAT 354 +#define TK_CONFLICT 355 +#define TK_COPY 356 +#define TK_DEFERRED 357 +#define TK_DELIMITERS 358 +#define TK_DETACH 359 +#define TK_DIVIDE 360 +#define TK_DOT 361 +#define TK_EACH 362 +#define TK_FAIL 363 +#define TK_GLOB 364 +#define TK_ID 365 +#define TK_IMMEDIATE 366 +#define TK_IMPORT 367 +#define TK_INITIALLY 368 +#define TK_INSTEAD 369 +#define TK_ISNULL 370 +#define TK_MODULES 371 +#define TK_NK_BITNOT 372 +#define TK_NK_SEMI 373 +#define TK_NOTNULL 374 +#define TK_OF 375 +#define TK_PLUS 376 +#define TK_PRIVILEGE 377 +#define TK_RAISE 378 +#define TK_RESTRICT 379 +#define TK_ROW 380 +#define TK_STAR 381 +#define TK_STATEMENT 382 +#define TK_STRICT 383 +#define TK_STRING 384 +#define TK_TIMES 385 +#define TK_VALUES 386 +#define TK_VARIABLE 387 +#define TK_WAL 388 #define TK_NK_SPACE 600 #define TK_NK_COMMENT 601 diff --git a/include/util/tdef.h b/include/util/tdef.h index e15ec0b4999a..b924b377dad1 100644 --- a/include/util/tdef.h +++ b/include/util/tdef.h @@ -450,7 +450,7 @@ typedef enum ELogicConditionType { #define TSDB_MIN_S3_CHUNK_SIZE (128 * 1024) #define TSDB_MAX_S3_CHUNK_SIZE (1024 * 1024) -#define TSDB_DEFAULT_S3_CHUNK_SIZE (256 * 1024) +#define TSDB_DEFAULT_S3_CHUNK_SIZE (128 * 1024) #define TSDB_MIN_S3_KEEP_LOCAL (1 * 1440) // unit minute #define TSDB_MAX_S3_KEEP_LOCAL (365000 * 1440) #define TSDB_DEFAULT_S3_KEEP_LOCAL (365 * 1440) diff --git a/source/common/src/systable.c b/source/common/src/systable.c index eef38bf18eee..02efb40f9f56 100644 --- a/source/common/src/systable.c +++ b/source/common/src/systable.c @@ -118,7 +118,7 @@ static const SSysDbTableSchema userDBSchema[] = { {.name = "table_suffix", .bytes = 2, .type = TSDB_DATA_TYPE_SMALLINT, .sysInfo = true}, {.name = "tsdb_pagesize", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = true}, {.name = "keep_time_offset", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = false}, - {.name = "s3_chunksize", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = true}, + {.name = "s3_chunkpages", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = true}, {.name = "s3_keeplocal", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, {.name = "s3_compact", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT, .sysInfo = true}, {.name = "with_arbitrator", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT, .sysInfo = true}, diff --git a/source/libs/command/src/command.c b/source/libs/command/src/command.c index b2417a8597f2..716296345f83 100644 --- a/source/libs/command/src/command.c +++ b/source/libs/command/src/command.c @@ -50,7 +50,7 @@ static int32_t buildRetrieveTableRsp(SSDataBlock* pBlock, int32_t numOfCols, SRe (*pRsp)->numOfCols = htonl(numOfCols); int32_t len = blockEncode(pBlock, (*pRsp)->data + PAYLOAD_PREFIX_LEN, numOfCols); - if(len < 0) { + if (len < 0) { taosMemoryFree(*pRsp); return terrno; } @@ -292,7 +292,7 @@ static int32_t buildRetension(SArray* pRetension, char** ppRetentions) { } const int lMaxLen = 128; - char* p1 = taosMemoryCalloc(1, lMaxLen); + char* p1 = taosMemoryCalloc(1, lMaxLen); if (NULL == p1) { return terrno; } @@ -346,20 +346,20 @@ static const char* encryptAlgorithmStr(int8_t encryptAlgorithm) { } int32_t formatDurationOrKeep(char* buffer, int64_t bufSize, int32_t timeInMinutes) { - if (buffer == NULL || bufSize <= 0) { - return 0; - } - int32_t len = 0; - if (timeInMinutes % 1440 == 0) { - int32_t days = timeInMinutes / 1440; - len = tsnprintf(buffer, bufSize, "%dd", days); - } else if (timeInMinutes % 60 == 0) { - int32_t hours = timeInMinutes / 60; - len = tsnprintf(buffer, bufSize, "%dh", hours); - } else { - len = tsnprintf(buffer, bufSize, "%dm", timeInMinutes); - } - return len; + if (buffer == NULL || bufSize <= 0) { + return 0; + } + int32_t len = 0; + if (timeInMinutes % 1440 == 0) { + int32_t days = timeInMinutes / 1440; + len = tsnprintf(buffer, bufSize, "%dd", days); + } else if (timeInMinutes % 60 == 0) { + int32_t hours = timeInMinutes / 60; + len = tsnprintf(buffer, bufSize, "%dh", hours); + } else { + len = tsnprintf(buffer, bufSize, "%dm", timeInMinutes); + } + return len; } static int32_t setCreateDBResultIntoDataBlock(SSDataBlock* pBlock, char* dbName, char* dbFName, SDbCfgInfo* pCfg) { @@ -410,27 +410,27 @@ static int32_t setCreateDBResultIntoDataBlock(SSDataBlock* pBlock, char* dbName, int32_t lenKeep2 = formatDurationOrKeep(keep2Str, sizeof(keep2Str), pCfg->daysToKeep2); if (IS_SYS_DBNAME(dbName)) { - len += tsnprintf(buf2 + VARSTR_HEADER_SIZE, SHOW_CREATE_DB_RESULT_FIELD2_LEN - VARSTR_HEADER_SIZE, "CREATE DATABASE `%s`", dbName); - } else { len += tsnprintf(buf2 + VARSTR_HEADER_SIZE, SHOW_CREATE_DB_RESULT_FIELD2_LEN - VARSTR_HEADER_SIZE, - "CREATE DATABASE `%s` BUFFER %d CACHESIZE %d CACHEMODEL '%s' COMP %d DURATION %s " - "WAL_FSYNC_PERIOD %d MAXROWS %d MINROWS %d STT_TRIGGER %d KEEP %s,%s,%s PAGES %d PAGESIZE %d " - "PRECISION '%s' REPLICA %d " - "WAL_LEVEL %d VGROUPS %d SINGLE_STABLE %d TABLE_PREFIX %d TABLE_SUFFIX %d TSDB_PAGESIZE %d " - "WAL_RETENTION_PERIOD %d WAL_RETENTION_SIZE %" PRId64 - " KEEP_TIME_OFFSET %d ENCRYPT_ALGORITHM '%s' S3_CHUNKSIZE %d S3_KEEPLOCAL %dm S3_COMPACT %d", - dbName, pCfg->buffer, pCfg->cacheSize, cacheModelStr(pCfg->cacheLast), pCfg->compression, - durationStr, - pCfg->walFsyncPeriod, pCfg->maxRows, pCfg->minRows, pCfg->sstTrigger, - keep0Str, keep1Str, keep2Str, - pCfg->pages, pCfg->pageSize, prec, - pCfg->replications, pCfg->walLevel, pCfg->numOfVgroups, 1 == pCfg->numOfStables, hashPrefix, - pCfg->hashSuffix, pCfg->tsdbPageSize, pCfg->walRetentionPeriod, pCfg->walRetentionSize, - pCfg->keepTimeOffset, encryptAlgorithmStr(pCfg->encryptAlgorithm), pCfg->s3ChunkSize, - pCfg->s3KeepLocal, pCfg->s3Compact); + "CREATE DATABASE `%s`", dbName); + } else { + len += + tsnprintf(buf2 + VARSTR_HEADER_SIZE, SHOW_CREATE_DB_RESULT_FIELD2_LEN - VARSTR_HEADER_SIZE, + "CREATE DATABASE `%s` BUFFER %d CACHESIZE %d CACHEMODEL '%s' COMP %d DURATION %s " + "WAL_FSYNC_PERIOD %d MAXROWS %d MINROWS %d STT_TRIGGER %d KEEP %s,%s,%s PAGES %d PAGESIZE %d " + "PRECISION '%s' REPLICA %d " + "WAL_LEVEL %d VGROUPS %d SINGLE_STABLE %d TABLE_PREFIX %d TABLE_SUFFIX %d TSDB_PAGESIZE %d " + "WAL_RETENTION_PERIOD %d WAL_RETENTION_SIZE %" PRId64 + " KEEP_TIME_OFFSET %d ENCRYPT_ALGORITHM '%s' S3_CHUNKPAGES %d S3_KEEPLOCAL %dm S3_COMPACT %d", + dbName, pCfg->buffer, pCfg->cacheSize, cacheModelStr(pCfg->cacheLast), pCfg->compression, durationStr, + pCfg->walFsyncPeriod, pCfg->maxRows, pCfg->minRows, pCfg->sstTrigger, keep0Str, keep1Str, keep2Str, + pCfg->pages, pCfg->pageSize, prec, pCfg->replications, pCfg->walLevel, pCfg->numOfVgroups, + 1 == pCfg->numOfStables, hashPrefix, pCfg->hashSuffix, pCfg->tsdbPageSize, pCfg->walRetentionPeriod, + pCfg->walRetentionSize, pCfg->keepTimeOffset, encryptAlgorithmStr(pCfg->encryptAlgorithm), + pCfg->s3ChunkSize, pCfg->s3KeepLocal, pCfg->s3Compact); if (pRetentions) { - len += tsnprintf(buf2 + VARSTR_HEADER_SIZE + len, SHOW_CREATE_DB_RESULT_FIELD2_LEN - VARSTR_HEADER_SIZE, " RETENTIONS %s", pRetentions); + len += tsnprintf(buf2 + VARSTR_HEADER_SIZE + len, SHOW_CREATE_DB_RESULT_FIELD2_LEN - VARSTR_HEADER_SIZE, + " RETENTIONS %s", pRetentions); } } @@ -510,30 +510,30 @@ void appendColumnFields(char* buf, int32_t* len, STableCfg* pCfg) { #define LTYPE_LEN (32 + 60) // 60 byte for compress info char type[LTYPE_LEN]; snprintf(type, LTYPE_LEN, "%s", tDataTypes[pSchema->type].name); - int typeLen = strlen(type); + int typeLen = strlen(type); if (TSDB_DATA_TYPE_VARCHAR == pSchema->type || TSDB_DATA_TYPE_VARBINARY == pSchema->type || TSDB_DATA_TYPE_GEOMETRY == pSchema->type) { typeLen += tsnprintf(type + typeLen, LTYPE_LEN - typeLen, "(%d)", (int32_t)(pSchema->bytes - VARSTR_HEADER_SIZE)); } else if (TSDB_DATA_TYPE_NCHAR == pSchema->type) { typeLen += tsnprintf(type + typeLen, LTYPE_LEN - typeLen, "(%d)", - (int32_t)((pSchema->bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE)); + (int32_t)((pSchema->bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE)); } if (useCompress(pCfg->tableType) && pCfg->pSchemaExt) { typeLen += tsnprintf(type + typeLen, LTYPE_LEN - typeLen, " ENCODE \'%s\'", - columnEncodeStr(COMPRESS_L1_TYPE_U32(pCfg->pSchemaExt[i].compress))); + columnEncodeStr(COMPRESS_L1_TYPE_U32(pCfg->pSchemaExt[i].compress))); typeLen += tsnprintf(type + typeLen, LTYPE_LEN - typeLen, " COMPRESS \'%s\'", - columnCompressStr(COMPRESS_L2_TYPE_U32(pCfg->pSchemaExt[i].compress))); + columnCompressStr(COMPRESS_L2_TYPE_U32(pCfg->pSchemaExt[i].compress))); typeLen += tsnprintf(type + typeLen, LTYPE_LEN - typeLen, " LEVEL \'%s\'", - columnLevelStr(COMPRESS_L2_TYPE_LEVEL_U32(pCfg->pSchemaExt[i].compress))); + columnLevelStr(COMPRESS_L2_TYPE_LEVEL_U32(pCfg->pSchemaExt[i].compress))); } if (!(pSchema->flags & COL_IS_KEY)) { - *len += tsnprintf(buf + VARSTR_HEADER_SIZE + *len, SHOW_CREATE_TB_RESULT_FIELD2_LEN - (VARSTR_HEADER_SIZE + *len), "%s`%s` %s", - ((i > 0) ? ", " : ""), pSchema->name, type); + *len += tsnprintf(buf + VARSTR_HEADER_SIZE + *len, SHOW_CREATE_TB_RESULT_FIELD2_LEN - (VARSTR_HEADER_SIZE + *len), + "%s`%s` %s", ((i > 0) ? ", " : ""), pSchema->name, type); } else { char* pk = "PRIMARY KEY"; - *len += tsnprintf(buf + VARSTR_HEADER_SIZE + *len, SHOW_CREATE_TB_RESULT_FIELD2_LEN - (VARSTR_HEADER_SIZE + *len), "%s`%s` %s %s", - ((i > 0) ? ", " : ""), pSchema->name, type, pk); + *len += tsnprintf(buf + VARSTR_HEADER_SIZE + *len, SHOW_CREATE_TB_RESULT_FIELD2_LEN - (VARSTR_HEADER_SIZE + *len), + "%s`%s` %s %s", ((i > 0) ? ", " : ""), pSchema->name, type, pk); } } } @@ -545,14 +545,15 @@ void appendTagFields(char* buf, int32_t* len, STableCfg* pCfg) { snprintf(type, sizeof(type), "%s", tDataTypes[pSchema->type].name); if (TSDB_DATA_TYPE_VARCHAR == pSchema->type || TSDB_DATA_TYPE_VARBINARY == pSchema->type || TSDB_DATA_TYPE_GEOMETRY == pSchema->type) { - snprintf(type + strlen(type), sizeof(type) - strlen(type), "(%d)", (int32_t)(pSchema->bytes - VARSTR_HEADER_SIZE)); + snprintf(type + strlen(type), sizeof(type) - strlen(type), "(%d)", + (int32_t)(pSchema->bytes - VARSTR_HEADER_SIZE)); } else if (TSDB_DATA_TYPE_NCHAR == pSchema->type) { snprintf(type + strlen(type), sizeof(type) - strlen(type), "(%d)", (int32_t)((pSchema->bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE)); } - *len += tsnprintf(buf + VARSTR_HEADER_SIZE + *len, SHOW_CREATE_TB_RESULT_FIELD2_LEN - (VARSTR_HEADER_SIZE + *len), "%s`%s` %s", - ((i > 0) ? ", " : ""), pSchema->name, type); + *len += tsnprintf(buf + VARSTR_HEADER_SIZE + *len, SHOW_CREATE_TB_RESULT_FIELD2_LEN - (VARSTR_HEADER_SIZE + *len), + "%s`%s` %s", ((i > 0) ? ", " : ""), pSchema->name, type); } } @@ -560,7 +561,7 @@ void appendTagNameFields(char* buf, int32_t* len, STableCfg* pCfg) { for (int32_t i = 0; i < pCfg->numOfTags; ++i) { SSchema* pSchema = pCfg->pSchemas + pCfg->numOfColumns + i; *len += tsnprintf(buf + VARSTR_HEADER_SIZE + *len, SHOW_CREATE_TB_RESULT_FIELD2_LEN - (VARSTR_HEADER_SIZE + *len), - "%s`%s`", ((i > 0) ? ", " : ""), pSchema->name); + "%s`%s`", ((i > 0) ? ", " : ""), pSchema->name); } } @@ -582,7 +583,7 @@ int32_t appendTagValues(char* buf, int32_t* len, STableCfg* pCfg) { return terrno; } *len += tsnprintf(buf + VARSTR_HEADER_SIZE + *len, SHOW_CREATE_TB_RESULT_FIELD2_LEN - (VARSTR_HEADER_SIZE + *len), - "%s", pJson); + "%s", pJson); taosMemoryFree(pJson); return TSDB_CODE_SUCCESS; @@ -596,12 +597,12 @@ int32_t appendTagValues(char* buf, int32_t* len, STableCfg* pCfg) { SSchema* pSchema = pCfg->pSchemas + pCfg->numOfColumns + i; if (i > 0) { *len += tsnprintf(buf + VARSTR_HEADER_SIZE + *len, SHOW_CREATE_TB_RESULT_FIELD2_LEN - (VARSTR_HEADER_SIZE + *len), - ", "); + ", "); } if (j >= valueNum) { *len += tsnprintf(buf + VARSTR_HEADER_SIZE + *len, SHOW_CREATE_TB_RESULT_FIELD2_LEN - (VARSTR_HEADER_SIZE + *len), - "NULL"); + "NULL"); continue; } @@ -624,14 +625,15 @@ int32_t appendTagValues(char* buf, int32_t* len, STableCfg* pCfg) { code = dataConverToStr(buf + VARSTR_HEADER_SIZE + *len, leftSize, type, pTagVal->pData, pTagVal->nData, &tlen); TAOS_CHECK_ERRNO(code); } else { - code = dataConverToStr(buf + VARSTR_HEADER_SIZE + *len, leftSize, type, &pTagVal->i64, tDataTypes[type].bytes, &tlen); + code = dataConverToStr(buf + VARSTR_HEADER_SIZE + *len, leftSize, type, &pTagVal->i64, tDataTypes[type].bytes, + &tlen); TAOS_CHECK_ERRNO(code); } *len += tlen; j++; } else { *len += tsnprintf(buf + VARSTR_HEADER_SIZE + *len, SHOW_CREATE_TB_RESULT_FIELD2_LEN - (VARSTR_HEADER_SIZE + *len), - "NULL"); + "NULL"); } } _exit: @@ -643,38 +645,38 @@ int32_t appendTagValues(char* buf, int32_t* len, STableCfg* pCfg) { void appendTableOptions(char* buf, int32_t* len, SDbCfgInfo* pDbCfg, STableCfg* pCfg) { if (pCfg->commentLen > 0) { *len += tsnprintf(buf + VARSTR_HEADER_SIZE + *len, SHOW_CREATE_TB_RESULT_FIELD2_LEN - (VARSTR_HEADER_SIZE + *len), - " COMMENT '%s'", pCfg->pComment); + " COMMENT '%s'", pCfg->pComment); } else if (0 == pCfg->commentLen) { *len += tsnprintf(buf + VARSTR_HEADER_SIZE + *len, SHOW_CREATE_TB_RESULT_FIELD2_LEN - (VARSTR_HEADER_SIZE + *len), - " COMMENT ''"); + " COMMENT ''"); } if (NULL != pDbCfg->pRetensions && pCfg->watermark1 > 0) { *len += tsnprintf(buf + VARSTR_HEADER_SIZE + *len, SHOW_CREATE_TB_RESULT_FIELD2_LEN - (VARSTR_HEADER_SIZE + *len), - " WATERMARK %" PRId64 "a", pCfg->watermark1); + " WATERMARK %" PRId64 "a", pCfg->watermark1); if (pCfg->watermark2 > 0) { *len += tsnprintf(buf + VARSTR_HEADER_SIZE + *len, SHOW_CREATE_TB_RESULT_FIELD2_LEN - (VARSTR_HEADER_SIZE + *len), - ", %" PRId64 "a", pCfg->watermark2); + ", %" PRId64 "a", pCfg->watermark2); } } if (NULL != pDbCfg->pRetensions && pCfg->delay1 > 0) { *len += tsnprintf(buf + VARSTR_HEADER_SIZE + *len, SHOW_CREATE_TB_RESULT_FIELD2_LEN - (VARSTR_HEADER_SIZE + *len), - " MAX_DELAY %" PRId64 "a", pCfg->delay1); + " MAX_DELAY %" PRId64 "a", pCfg->delay1); if (pCfg->delay2 > 0) { *len += tsnprintf(buf + VARSTR_HEADER_SIZE + *len, SHOW_CREATE_TB_RESULT_FIELD2_LEN - (VARSTR_HEADER_SIZE + *len), - ", %" PRId64 "a", pCfg->delay2); + ", %" PRId64 "a", pCfg->delay2); } } int32_t funcNum = taosArrayGetSize(pCfg->pFuncs); if (NULL != pDbCfg->pRetensions && funcNum > 0) { *len += tsnprintf(buf + VARSTR_HEADER_SIZE + *len, SHOW_CREATE_TB_RESULT_FIELD2_LEN - (VARSTR_HEADER_SIZE + *len), - " ROLLUP("); + " ROLLUP("); for (int32_t i = 0; i < funcNum; ++i) { char* pFunc = taosArrayGet(pCfg->pFuncs, i); *len += tsnprintf(buf + VARSTR_HEADER_SIZE + *len, SHOW_CREATE_TB_RESULT_FIELD2_LEN - (VARSTR_HEADER_SIZE + *len), - "%s%s", ((i > 0) ? ", " : ""), pFunc); + "%s%s", ((i > 0) ? ", " : ""), pFunc); } *len += snprintf(buf + VARSTR_HEADER_SIZE + *len, SHOW_CREATE_TB_RESULT_FIELD2_LEN - (VARSTR_HEADER_SIZE + *len), ")"); @@ -682,7 +684,7 @@ void appendTableOptions(char* buf, int32_t* len, SDbCfgInfo* pDbCfg, STableCfg* if (pCfg->ttl > 0) { *len += tsnprintf(buf + VARSTR_HEADER_SIZE + *len, SHOW_CREATE_TB_RESULT_FIELD2_LEN - (VARSTR_HEADER_SIZE + *len), - " TTL %d", pCfg->ttl); + " TTL %d", pCfg->ttl); } if (TSDB_SUPER_TABLE == pCfg->tableType || TSDB_NORMAL_TABLE == pCfg->tableType) { @@ -696,18 +698,18 @@ void appendTableOptions(char* buf, int32_t* len, SDbCfgInfo* pDbCfg, STableCfg* if (nSma < pCfg->numOfColumns && nSma > 0) { bool smaOn = false; *len += tsnprintf(buf + VARSTR_HEADER_SIZE + *len, SHOW_CREATE_TB_RESULT_FIELD2_LEN - (VARSTR_HEADER_SIZE + *len), - " SMA("); + " SMA("); for (int32_t i = 0; i < pCfg->numOfColumns; ++i) { if (IS_BSMA_ON(pCfg->pSchemas + i)) { if (smaOn) { *len += tsnprintf(buf + VARSTR_HEADER_SIZE + *len, - SHOW_CREATE_TB_RESULT_FIELD2_LEN - (VARSTR_HEADER_SIZE + *len), ",`%s`", - (pCfg->pSchemas + i)->name); + SHOW_CREATE_TB_RESULT_FIELD2_LEN - (VARSTR_HEADER_SIZE + *len), ",`%s`", + (pCfg->pSchemas + i)->name); } else { smaOn = true; *len += tsnprintf(buf + VARSTR_HEADER_SIZE + *len, - SHOW_CREATE_TB_RESULT_FIELD2_LEN - (VARSTR_HEADER_SIZE + *len), "`%s`", - (pCfg->pSchemas + i)->name); + SHOW_CREATE_TB_RESULT_FIELD2_LEN - (VARSTR_HEADER_SIZE + *len), "`%s`", + (pCfg->pSchemas + i)->name); } } } @@ -736,20 +738,20 @@ static int32_t setCreateTBResultIntoDataBlock(SSDataBlock* pBlock, SDbCfgInfo* p if (TSDB_SUPER_TABLE == pCfg->tableType) { len += tsnprintf(buf2 + VARSTR_HEADER_SIZE, SHOW_CREATE_TB_RESULT_FIELD2_LEN - VARSTR_HEADER_SIZE, - "CREATE STABLE `%s` (", tbName); + "CREATE STABLE `%s` (", tbName); appendColumnFields(buf2, &len, pCfg); len += tsnprintf(buf2 + VARSTR_HEADER_SIZE + len, SHOW_CREATE_TB_RESULT_FIELD2_LEN - (VARSTR_HEADER_SIZE + len), - ") TAGS ("); + ") TAGS ("); appendTagFields(buf2, &len, pCfg); len += snprintf(buf2 + VARSTR_HEADER_SIZE + len, SHOW_CREATE_TB_RESULT_FIELD2_LEN - (VARSTR_HEADER_SIZE + len), ")"); appendTableOptions(buf2, &len, pDbCfg, pCfg); } else if (TSDB_CHILD_TABLE == pCfg->tableType) { len += tsnprintf(buf2 + VARSTR_HEADER_SIZE, SHOW_CREATE_TB_RESULT_FIELD2_LEN - VARSTR_HEADER_SIZE, - "CREATE TABLE `%s` USING `%s` (", tbName, pCfg->stbName); + "CREATE TABLE `%s` USING `%s` (", tbName, pCfg->stbName); appendTagNameFields(buf2, &len, pCfg); len += tsnprintf(buf2 + VARSTR_HEADER_SIZE + len, SHOW_CREATE_TB_RESULT_FIELD2_LEN - (VARSTR_HEADER_SIZE + len), - ") TAGS ("); + ") TAGS ("); code = appendTagValues(buf2, &len, pCfg); TAOS_CHECK_ERRNO(code); len += @@ -757,7 +759,7 @@ static int32_t setCreateTBResultIntoDataBlock(SSDataBlock* pBlock, SDbCfgInfo* p appendTableOptions(buf2, &len, pDbCfg, pCfg); } else { len += tsnprintf(buf2 + VARSTR_HEADER_SIZE, SHOW_CREATE_TB_RESULT_FIELD2_LEN - VARSTR_HEADER_SIZE, - "CREATE TABLE `%s` (", tbName); + "CREATE TABLE `%s` (", tbName); appendColumnFields(buf2, &len, pCfg); len += snprintf(buf2 + VARSTR_HEADER_SIZE + len, SHOW_CREATE_TB_RESULT_FIELD2_LEN - (VARSTR_HEADER_SIZE + len), ")"); @@ -793,7 +795,7 @@ static int32_t setCreateViewResultIntoDataBlock(SSDataBlock* pBlock, SShowCreate } SViewMeta* pMeta = pStmt->pViewMeta; - if(NULL == pMeta) { + if (NULL == pMeta) { qError("exception: view meta is null"); return TSDB_CODE_APP_ERROR; } diff --git a/source/libs/parser/inc/parAst.h b/source/libs/parser/inc/parAst.h index 28e867965f42..597ee5f5d2cf 100644 --- a/source/libs/parser/inc/parAst.h +++ b/source/libs/parser/inc/parAst.h @@ -64,7 +64,7 @@ typedef enum EDatabaseOptionType { DB_OPTION_STT_TRIGGER, DB_OPTION_TABLE_PREFIX, DB_OPTION_TABLE_SUFFIX, - DB_OPTION_S3_CHUNKSIZE, + DB_OPTION_S3_CHUNKPAGES, DB_OPTION_S3_KEEPLOCAL, DB_OPTION_S3_COMPACT, DB_OPTION_KEEP_TIME_OFFSET, @@ -244,7 +244,7 @@ SNode* createShowTableDistributedStmt(SAstCreateContext* pCxt, SNode* pRealTable SNode* createShowDnodeVariablesStmt(SAstCreateContext* pCxt, SNode* pDnodeId, SNode* pLikePattern); SNode* createShowVnodesStmt(SAstCreateContext* pCxt, SNode* pDnodeId, SNode* pDnodeEndpoint); SNode* createShowTableTagsStmt(SAstCreateContext* pCxt, SNode* pTbName, SNode* pDbName, SNodeList* pTags); -SNode* createCreateUserStmt(SAstCreateContext* pCxt, SToken* pUserName, const SToken* pPassword, int8_t sysinfo, +SNode* createCreateUserStmt(SAstCreateContext* pCxt, SToken* pUserName, const SToken* pPassword, int8_t sysinfo, int8_t createdb, int8_t is_import); SNode* addCreateUserStmtWhiteList(SAstCreateContext* pCxt, SNode* pStmt, SNodeList* pIpRangesNodeList); SNode* createAlterUserStmt(SAstCreateContext* pCxt, SToken* pUserName, int8_t alterType, void* pAlterInfo); diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index 99f301445a55..067a8e3ccc13 100644 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -280,7 +280,7 @@ db_options(A) ::= db_options(B) WAL_SEGMENT_SIZE NK_INTEGER(C). db_options(A) ::= db_options(B) STT_TRIGGER NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_STT_TRIGGER, &C); } db_options(A) ::= db_options(B) TABLE_PREFIX signed(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_TABLE_PREFIX, C); } db_options(A) ::= db_options(B) TABLE_SUFFIX signed(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_TABLE_SUFFIX, C); } -db_options(A) ::= db_options(B) S3_CHUNKSIZE NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_S3_CHUNKSIZE, &C); } +db_options(A) ::= db_options(B) S3_CHUNKPAGES NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_S3_CHUNKPAGES, &C); } db_options(A) ::= db_options(B) S3_KEEPLOCAL NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_S3_KEEPLOCAL, &C); } db_options(A) ::= db_options(B) S3_KEEPLOCAL NK_VARIABLE(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_S3_KEEPLOCAL, &C); } db_options(A) ::= db_options(B) S3_COMPACT NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_S3_COMPACT, &C); } diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c index e031ee0fe1b3..8a148aa76673 100644 --- a/source/libs/parser/src/parAstCreater.c +++ b/source/libs/parser/src/parAstCreater.c @@ -43,11 +43,11 @@ } \ } while (0) -#define CHECK_NAME(p) \ - do { \ - if (!p) { \ - goto _err; \ - } \ +#define CHECK_NAME(p) \ + do { \ + if (!p) { \ + goto _err; \ + } \ } while (0) #define COPY_STRING_FORM_ID_TOKEN(buf, pToken) strncpy(buf, (pToken)->z, TMIN((pToken)->n, sizeof(buf) - 1)) @@ -333,7 +333,7 @@ SNode* releaseRawExprNode(SAstCreateContext* pCxt, SNode* pNode) { // Len of pRawExpr->p could be larger than len of aliasName[TSDB_COL_NAME_LEN]. // If aliasName is truncated, hash value of aliasName could be the same. uint64_t hashVal = MurmurHash3_64(pRawExpr->p, pRawExpr->n); - sprintf(pExpr->aliasName, "%"PRIu64, hashVal); + sprintf(pExpr->aliasName, "%" PRIu64, hashVal); strncpy(pExpr->userAlias, pRawExpr->p, len); pExpr->userAlias[len] = '\0'; } @@ -405,7 +405,7 @@ SNode* createValueNode(SAstCreateContext* pCxt, int32_t dataType, const SToken* pCxt->errCode = nodesMakeNode(QUERY_NODE_VALUE, (SNode**)&val); CHECK_MAKE_NODE(val); val->literal = taosStrndup(pLiteral->z, pLiteral->n); - if(!val->literal) { + if (!val->literal) { pCxt->errCode = terrno; nodesDestroyNode((SNode*)val); return NULL; @@ -586,8 +586,8 @@ SNodeList* createHintNodeList(SAstCreateContext* pCxt, const SToken* pLiteral) { if (NULL == pLiteral || pLiteral->n <= 5) { return NULL; } - SNodeList* pHintList = NULL; - char* hint = taosStrndup(pLiteral->z + 3, pLiteral->n - 5); + SNodeList* pHintList = NULL; + char* hint = taosStrndup(pLiteral->z + 3, pLiteral->n - 5); if (!hint) return NULL; int32_t i = 0; bool quit = false; @@ -971,7 +971,7 @@ SNode* createOperatorNode(SAstCreateContext* pCxt, EOperatorType type, SNode* pL } SNode* createBetweenAnd(SAstCreateContext* pCxt, SNode* pExpr, SNode* pLeft, SNode* pRight) { - SNode* pNew = NULL, *pGE = NULL, *pLE = NULL; + SNode *pNew = NULL, *pGE = NULL, *pLE = NULL; CHECK_PARSER_STATUS(pCxt); pCxt->errCode = nodesCloneNode(pExpr, &pNew); CHECK_PARSER_STATUS(pCxt); @@ -993,7 +993,7 @@ SNode* createBetweenAnd(SAstCreateContext* pCxt, SNode* pExpr, SNode* pLeft, SNo } SNode* createNotBetweenAnd(SAstCreateContext* pCxt, SNode* pExpr, SNode* pLeft, SNode* pRight) { - SNode* pNew = NULL, *pLT = NULL, *pGT = NULL; + SNode *pNew = NULL, *pLT = NULL, *pGT = NULL; CHECK_PARSER_STATUS(pCxt); pCxt->errCode = nodesCloneNode(pExpr, &pNew); CHECK_PARSER_STATUS(pCxt); @@ -1959,7 +1959,7 @@ static SNode* setDatabaseOptionImpl(SAstCreateContext* pCxt, SNode* pOptions, ED nodesDestroyNode((SNode*)pNode); break; } - case DB_OPTION_S3_CHUNKSIZE: + case DB_OPTION_S3_CHUNKPAGES: pDbOptions->s3ChunkSize = taosStr2Int32(((SToken*)pVal)->z, NULL, 10); break; case DB_OPTION_S3_KEEPLOCAL: { @@ -2210,7 +2210,7 @@ SNode* setColumnOptionsPK(SAstCreateContext* pCxt, SNode* pOptions) { SNode* setColumnOptions(SAstCreateContext* pCxt, SNode* pOptions, const SToken* pVal1, void* pVal2) { CHECK_PARSER_STATUS(pCxt); - char optionType[TSDB_CL_OPTION_LEN]; + char optionType[TSDB_CL_OPTION_LEN]; memset(optionType, 0, TSDB_CL_OPTION_LEN); strncpy(optionType, pVal1->z, TMIN(pVal1->n, TSDB_CL_OPTION_LEN)); @@ -2807,7 +2807,7 @@ static int32_t getIpV4RangeFromWhitelistItem(char* ipRange, SIpV4Range* pIpRange int32_t code = TSDB_CODE_SUCCESS; char* ipCopy = taosStrdup(ipRange); if (!ipCopy) return terrno; - char* slash = strchr(ipCopy, '/'); + char* slash = strchr(ipCopy, '/'); if (slash) { *slash = '\0'; struct in_addr addr; diff --git a/source/libs/parser/src/parTokenizer.c b/source/libs/parser/src/parTokenizer.c index 63121ec044c9..9b2815d2dfac 100644 --- a/source/libs/parser/src/parTokenizer.c +++ b/source/libs/parser/src/parTokenizer.c @@ -340,7 +340,7 @@ static SKeyword keywordTable[] = { {"_FROWTS", TK_FROWTS}, {"ALIVE", TK_ALIVE}, {"VARBINARY", TK_VARBINARY}, - {"S3_CHUNKSIZE", TK_S3_CHUNKSIZE}, + {"S3_CHUNKPAGES", TK_S3_CHUNKPAGES}, {"S3_KEEPLOCAL", TK_S3_KEEPLOCAL}, {"S3_COMPACT", TK_S3_COMPACT}, {"S3MIGRATE", TK_S3MIGRATE}, @@ -370,7 +370,7 @@ static int32_t doInitKeywordsTable(void) { keywordHashTable = taosHashInit(numOfEntries, MurmurHash3_32, true, false); for (int32_t i = 0; i < numOfEntries; i++) { keywordTable[i].len = (uint8_t)strlen(keywordTable[i].name); - void* ptr = &keywordTable[i]; + void* ptr = &keywordTable[i]; int32_t code = taosHashPut(keywordHashTable, keywordTable[i].name, keywordTable[i].len, (void*)&ptr, POINTER_BYTES); if (TSDB_CODE_SUCCESS != code) { taosHashCleanup(keywordHashTable); @@ -698,7 +698,7 @@ uint32_t tGetToken(const char* z, uint32_t* tokenId) { } } if (hasNonAsciiChars) { - *tokenId = TK_NK_ALIAS; // must be alias + *tokenId = TK_NK_ALIAS; // must be alias return i; } if (IS_TRUE_STR(z, i) || IS_FALSE_STR(z, i)) { @@ -713,10 +713,10 @@ uint32_t tGetToken(const char* z, uint32_t* tokenId) { break; } bool hasNonAsciiChars = false; - for (i = 1; ; i++) { + for (i = 1;; i++) { if ((z[i] & 0x80) != 0) { hasNonAsciiChars = true; - } else if (isIdChar[(uint8_t)z[i]]){ + } else if (isIdChar[(uint8_t)z[i]]) { } else { break; } @@ -834,9 +834,7 @@ SToken tStrGetToken(const char* str, int32_t* i, bool isPrevOptr, bool* pIgnoreC bool taosIsKeyWordToken(const char* z, int32_t len) { return (tKeywordCode((char*)z, len) != TK_NK_ID); } -int32_t taosInitKeywordsTable() { - return doInitKeywordsTable(); -} +int32_t taosInitKeywordsTable() { return doInitKeywordsTable(); } void taosCleanupKeywordsTable() { void* m = keywordHashTable; diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 636be7c5cce6..395801e3dd4f 100755 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -34,19 +34,19 @@ #define SYSTABLE_SHOW_TYPE_OFFSET QUERY_NODE_SHOW_DNODES_STMT -#define CHECK_RES_OUT_OF_MEM(p) \ - do { \ - int32_t code = (p); \ - if (TSDB_CODE_SUCCESS != code) { \ - return code; \ - } \ +#define CHECK_RES_OUT_OF_MEM(p) \ + do { \ + int32_t code = (p); \ + if (TSDB_CODE_SUCCESS != code) { \ + return code; \ + } \ } while (0) -#define CHECK_POINTER_OUT_OF_MEM(p) \ - do { \ - if (NULL == (p)) { \ - return code; \ - } \ +#define CHECK_POINTER_OUT_OF_MEM(p) \ + do { \ + if (NULL == (p)) { \ + return code; \ + } \ } while (0) typedef struct SRewriteTbNameContext { @@ -458,7 +458,7 @@ static int32_t collectUseDatabase(const SName* pName, SHashObj* pDbs) { } static int32_t collectUseTable(const SName* pName, SHashObj* pTable) { - char fullName[TSDB_TABLE_FNAME_LEN]; + char fullName[TSDB_TABLE_FNAME_LEN]; int32_t code = tNameExtractFullName(pName, fullName); if (TSDB_CODE_SUCCESS != code) { return code; @@ -709,7 +709,7 @@ static int32_t getDBVgInfoImpl(STranslateContext* pCxt, const SName* pName, SArr } static int32_t getDBVgInfo(STranslateContext* pCxt, const char* pDbName, SArray** pVgInfo) { - SName name; + SName name; int32_t code = tNameSetDbName(&name, pCxt->pParseCxt->acctId, pDbName, strlen(pDbName)); if (TSDB_CODE_SUCCESS != code) return code; char dbFname[TSDB_DB_FNAME_LEN] = {0}; @@ -725,7 +725,7 @@ static int32_t getTableHashVgroupImpl(STranslateContext* pCxt, const SName* pNam } if (TSDB_CODE_SUCCESS == code) { if (pParCxt->async) { - if(pCxt->withOpt) { + if (pCxt->withOpt) { code = getDbTableVgroupFromCache(pCxt->pMetaCache, pName, pInfo); } else { code = getTableVgroupFromCache(pCxt->pMetaCache, pName, pInfo); @@ -777,7 +777,7 @@ static int32_t getDBCfg(STranslateContext* pCxt, const char* pDbName, SDbCfgInfo SParseContext* pParCxt = pCxt->pParseCxt; SName name; - int32_t code = tNameSetDbName(&name, pCxt->pParseCxt->acctId, pDbName, strlen(pDbName)); + int32_t code = tNameSetDbName(&name, pCxt->pParseCxt->acctId, pDbName, strlen(pDbName)); if (TSDB_CODE_SUCCESS != code) return code; char dbFname[TSDB_DB_FNAME_LEN] = {0}; (void)tNameGetFullDbName(&name, dbFname); @@ -1019,8 +1019,7 @@ static uint8_t getPrecisionFromCurrStmt(SNode* pCurrStmt, uint8_t defaultVal) { if (isDeleteStmt(pCurrStmt)) { return ((SDeleteStmt*)pCurrStmt)->precision; } - if (pCurrStmt && nodeType(pCurrStmt) == QUERY_NODE_CREATE_TSMA_STMT) - return ((SCreateTSMAStmt*)pCurrStmt)->precision; + if (pCurrStmt && nodeType(pCurrStmt) == QUERY_NODE_CREATE_TSMA_STMT) return ((SCreateTSMAStmt*)pCurrStmt)->precision; return defaultVal; } @@ -1168,7 +1167,7 @@ static bool isBlockTimeLineAlignedQuery(SNode* pStmt) { return false; } -int32_t buildPartitionListFromOrderList(SNodeList* pOrderList, int32_t nodesNum, SNodeList**ppOut) { +int32_t buildPartitionListFromOrderList(SNodeList* pOrderList, int32_t nodesNum, SNodeList** ppOut) { *ppOut = NULL; SNodeList* pPartitionList = NULL; SNode* pNode = NULL; @@ -1194,8 +1193,7 @@ int32_t buildPartitionListFromOrderList(SNodeList* pOrderList, int32_t nodesNum, break; } } - if(TSDB_CODE_SUCCESS == code) - *ppOut = pPartitionList; + if (TSDB_CODE_SUCCESS == code) *ppOut = pPartitionList; return code; } @@ -1229,7 +1227,8 @@ static int32_t isTimeLineAlignedQuery(SNode* pStmt, bool* pRes) { } } } - if (TSDB_CODE_SUCCESS == code && QUERY_NODE_SET_OPERATOR == nodeType(((STempTableNode*)pSelect->pFromTable)->pSubquery)) { + if (TSDB_CODE_SUCCESS == code && + QUERY_NODE_SET_OPERATOR == nodeType(((STempTableNode*)pSelect->pFromTable)->pSubquery)) { SSetOperator* pSub = (SSetOperator*)((STempTableNode*)pSelect->pFromTable)->pSubquery; if (pSelect->pPartitionByList && pSub->timeLineFromOrderBy && pSub->pOrderByList->length > 1) { SNodeList* pPartitionList = NULL; @@ -1397,12 +1396,16 @@ static void setColumnPrimTs(STranslateContext* pCxt, SColumnNode* pCol, const ST } } -static int32_t createColumnsByTable(STranslateContext* pCxt, const STableNode* pTable, bool igTags, SNodeList* pList, bool skipProjRef) { +static int32_t createColumnsByTable(STranslateContext* pCxt, const STableNode* pTable, bool igTags, SNodeList* pList, + bool skipProjRef) { int32_t code = 0; if (QUERY_NODE_REAL_TABLE == nodeType(pTable)) { const STableMeta* pMeta = ((SRealTableNode*)pTable)->pMeta; int32_t nums = pMeta->tableInfo.numOfColumns + - (igTags ? 0 : ((TSDB_SUPER_TABLE == pMeta->tableType || ((SRealTableNode*)pTable)->stbRewrite) ? pMeta->tableInfo.numOfTags : 0)); + (igTags ? 0 + : ((TSDB_SUPER_TABLE == pMeta->tableType || ((SRealTableNode*)pTable)->stbRewrite) + ? pMeta->tableInfo.numOfTags + : 0)); for (int32_t i = 0; i < nums; ++i) { if (invisibleColumn(pCxt->pParseCxt->enableSysInfo, pMeta->tableType, pMeta->schema[i].flags)) { pCxt->pParseCxt->hasInvisibleCol = true; @@ -1433,7 +1436,8 @@ static int32_t createColumnsByTable(STranslateContext* pCxt, const STableNode* p code = setColumnInfoByExpr(pTempTable, (SExprNode*)pNode, (SColumnNode**)&pCell->pNode); } if (TSDB_CODE_SUCCESS == code) { - if (!skipProjRef) pCol->projRefIdx = ((SExprNode*)pNode)->projIdx; // only set proj ref when select * from (select ...) + if (!skipProjRef) + pCol->projRefIdx = ((SExprNode*)pNode)->projIdx; // only set proj ref when select * from (select ...) } else { break; } @@ -1603,7 +1607,8 @@ static EDealRes translateColumnUseAlias(STranslateContext* pCxt, SColumnNode** p } } if (*pFound) { - if (QUERY_NODE_FUNCTION == nodeType(pFoundNode) && (SQL_CLAUSE_GROUP_BY == pCxt->currClause || SQL_CLAUSE_PARTITION_BY == pCxt->currClause)) { + if (QUERY_NODE_FUNCTION == nodeType(pFoundNode) && + (SQL_CLAUSE_GROUP_BY == pCxt->currClause || SQL_CLAUSE_PARTITION_BY == pCxt->currClause)) { pCxt->errCode = getFuncInfo(pCxt, (SFunctionNode*)pFoundNode); if (TSDB_CODE_SUCCESS == pCxt->errCode) { if (fmIsVectorFunc(((SFunctionNode*)pFoundNode)->funcId)) { @@ -1622,7 +1627,7 @@ static EDealRes translateColumnUseAlias(STranslateContext* pCxt, SColumnNode** p return DEAL_RES_ERROR; } } - SNode* pNew = NULL; + SNode* pNew = NULL; int32_t code = nodesCloneNode(pFoundNode, &pNew); if (NULL == pNew) { pCxt->errCode = code; @@ -1687,7 +1692,7 @@ static int32_t biMakeTbnameProjectAstNode(char* funcName, char* tableAlias, SNod } if (TSDB_CODE_SUCCESS == code) { snprintf(tbNameFunc->node.userAlias, sizeof(tbNameFunc->node.userAlias), (tableAlias) ? "%s.tbname" : "%stbname", - (tableAlias) ? tableAlias : ""); + (tableAlias) ? tableAlias : ""); strncpy(tbNameFunc->node.aliasName, tbNameFunc->functionName, TSDB_COL_NAME_LEN); if (funcName == NULL) { *pOutNode = (SNode*)tbNameFunc; @@ -1705,13 +1710,13 @@ static int32_t biMakeTbnameProjectAstNode(char* funcName, char* tableAlias, SNod if (TSDB_CODE_SUCCESS == code) { if (tsKeepColumnName) { snprintf(multiResFunc->node.userAlias, sizeof(tbNameFunc->node.userAlias), - (tableAlias) ? "%s.tbname" : "%stbname", (tableAlias) ? tableAlias : ""); + (tableAlias) ? "%s.tbname" : "%stbname", (tableAlias) ? tableAlias : ""); strcpy(multiResFunc->node.aliasName, tbNameFunc->functionName); } else { snprintf(multiResFunc->node.userAlias, sizeof(multiResFunc->node.userAlias), - tableAlias ? "%s(%s.tbname)" : "%s(%stbname)", funcName, tableAlias ? tableAlias : ""); + tableAlias ? "%s(%s.tbname)" : "%s(%stbname)", funcName, tableAlias ? tableAlias : ""); biMakeAliasNameInMD5(multiResFunc->node.userAlias, strlen(multiResFunc->node.userAlias), - multiResFunc->node.aliasName); + multiResFunc->node.aliasName); } *pOutNode = (SNode*)multiResFunc; } else { @@ -1726,7 +1731,7 @@ static int32_t biMakeTbnameProjectAstNode(char* funcName, char* tableAlias, SNod static int32_t biRewriteSelectFuncParamStar(STranslateContext* pCxt, SSelectStmt* pSelect, SNode* pNode, SListCell* pSelectListCell) { SNodeList* pTbnameNodeList = NULL; - int32_t code = nodesMakeList(&pTbnameNodeList); + int32_t code = nodesMakeList(&pTbnameNodeList); if (!pTbnameNodeList) return code; SFunctionNode* pFunc = (SFunctionNode*)pNode; @@ -1744,8 +1749,7 @@ static int32_t biRewriteSelectFuncParamStar(STranslateContext* pCxt, SSelectStmt ((SRealTableNode*)pTable)->pMeta->tableType == TSDB_SUPER_TABLE) { SNode* pTbnameNode = NULL; code = biMakeTbnameProjectAstNode(pFunc->functionName, NULL, &pTbnameNode); - if (TSDB_CODE_SUCCESS == code) - code = nodesListStrictAppend(pTbnameNodeList, pTbnameNode); + if (TSDB_CODE_SUCCESS == code) code = nodesListStrictAppend(pTbnameNodeList, pTbnameNode); } } if (TSDB_CODE_SUCCESS == code && LIST_LENGTH(pTbnameNodeList) > 0) { @@ -1761,8 +1765,7 @@ static int32_t biRewriteSelectFuncParamStar(STranslateContext* pCxt, SSelectStmt ((SRealTableNode*)pTable)->pMeta->tableType == TSDB_SUPER_TABLE) { SNode* pTbnameNode = NULL; code = biMakeTbnameProjectAstNode(pFunc->functionName, pTableAlias, &pTbnameNode); - if (TSDB_CODE_SUCCESS == code) - code = nodesListStrictAppend(pTbnameNodeList, pTbnameNode); + if (TSDB_CODE_SUCCESS == code) code = nodesListStrictAppend(pTbnameNodeList, pTbnameNode); } if (TSDB_CODE_SUCCESS == code && LIST_LENGTH(pTbnameNodeList) > 0) { nodesListInsertListAfterPos(pSelect->pProjectionList, pSelectListCell, pTbnameNodeList); @@ -1794,8 +1797,7 @@ int32_t biRewriteSelectStar(STranslateContext* pCxt, SSelectStmt* pSelect) { ((SRealTableNode*)pTable)->pMeta->tableType == TSDB_SUPER_TABLE) { SNode* pTbnameNode = NULL; code = biMakeTbnameProjectAstNode(NULL, NULL, &pTbnameNode); - if (TSDB_CODE_SUCCESS == code) - code = nodesListStrictAppend(pTbnameNodeList, pTbnameNode); + if (TSDB_CODE_SUCCESS == code) code = nodesListStrictAppend(pTbnameNodeList, pTbnameNode); } } if (TSDB_CODE_SUCCESS == code && LIST_LENGTH(pTbnameNodeList) > 0) { @@ -1810,8 +1812,7 @@ int32_t biRewriteSelectStar(STranslateContext* pCxt, SSelectStmt* pSelect) { ((SRealTableNode*)pTable)->pMeta != NULL && ((SRealTableNode*)pTable)->pMeta->tableType == TSDB_SUPER_TABLE) { SNode* pTbnameNode = NULL; code = biMakeTbnameProjectAstNode(NULL, pTableAlias, &pTbnameNode); - if (TSDB_CODE_SUCCESS ==code) - code = nodesListStrictAppend(pTbnameNodeList, pTbnameNode); + if (TSDB_CODE_SUCCESS == code) code = nodesListStrictAppend(pTbnameNodeList, pTbnameNode); } if (TSDB_CODE_SUCCESS == code && LIST_LENGTH(pTbnameNodeList) > 0) { nodesListInsertListAfterPos(pSelect->pProjectionList, cell, pTbnameNodeList); @@ -1877,9 +1878,7 @@ int32_t biCheckCreateTableTbnameCol(STranslateContext* pCxt, SCreateTableStmt* p } static bool clauseSupportAlias(ESqlClause clause) { - return SQL_CLAUSE_GROUP_BY == clause || - SQL_CLAUSE_PARTITION_BY == clause || - SQL_CLAUSE_ORDER_BY == clause; + return SQL_CLAUSE_GROUP_BY == clause || SQL_CLAUSE_PARTITION_BY == clause || SQL_CLAUSE_ORDER_BY == clause; } static EDealRes translateColumn(STranslateContext* pCxt, SColumnNode** pCol) { @@ -1895,7 +1894,7 @@ static EDealRes translateColumn(STranslateContext* pCxt, SColumnNode** pCol) { if (pCxt->pParseCxt->biMode) { SNode** ppNode = (SNode**)pCol; - bool ret; + bool ret; pCxt->errCode = biRewriteToTbnameFunc(pCxt, ppNode, &ret); if (TSDB_CODE_SUCCESS != pCxt->errCode) return DEAL_RES_ERROR; if (ret) { @@ -1908,8 +1907,7 @@ static EDealRes translateColumn(STranslateContext* pCxt, SColumnNode** pCol) { res = translateColumnWithPrefix(pCxt, pCol); } else { bool found = false; - if ((pCxt->currClause == SQL_CLAUSE_ORDER_BY) && - !(*pCol)->node.asParam) { + if ((pCxt->currClause == SQL_CLAUSE_ORDER_BY) && !(*pCol)->node.asParam) { res = translateColumnUseAlias(pCxt, pCol, &found); } if (DEAL_RES_ERROR != res && !found) { @@ -1919,9 +1917,7 @@ static EDealRes translateColumn(STranslateContext* pCxt, SColumnNode** pCol) { res = translateColumnWithoutPrefix(pCxt, pCol); } } - if (clauseSupportAlias(pCxt->currClause) && - !(*pCol)->node.asParam && - res != DEAL_RES_CONTINUE && + if (clauseSupportAlias(pCxt->currClause) && !(*pCol)->node.asParam && res != DEAL_RES_CONTINUE && res != DEAL_RES_END) { res = translateColumnUseAlias(pCxt, pCol, &found); } @@ -2478,8 +2474,8 @@ static int32_t translateIndefiniteRowsFunc(STranslateContext* pCxt, SFunctionNod return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_NOT_ALLOWED_FUNC); } if (pSelect->hasIndefiniteRowsFunc && - (FUNC_RETURN_ROWS_INDEFINITE == pSelect->returnRows || pSelect->returnRows != fmGetFuncReturnRows(pFunc)) && - (pSelect->lastProcessByRowFuncId == -1 || !fmIsProcessByRowFunc(pFunc->funcId))) { + (FUNC_RETURN_ROWS_INDEFINITE == pSelect->returnRows || pSelect->returnRows != fmGetFuncReturnRows(pFunc)) && + (pSelect->lastProcessByRowFuncId == -1 || !fmIsProcessByRowFunc(pFunc->funcId))) { return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_NOT_ALLOWED_FUNC); } if (pSelect->lastProcessByRowFuncId != -1 && pSelect->lastProcessByRowFuncId != pFunc->funcId) { @@ -2651,14 +2647,14 @@ static int32_t translateTimelineFunc(STranslateContext* pCxt, SFunctionNode* pFu "%s function must be used in select statements", pFunc->functionName); } SSelectStmt* pSelect = (SSelectStmt*)pCxt->pCurrStmt; - bool isTimelineAlignedQuery = false; + bool isTimelineAlignedQuery = false; if ((NULL != pSelect->pFromTable && QUERY_NODE_TEMP_TABLE == nodeType(pSelect->pFromTable) && !isGlobalTimeLineQuery(((STempTableNode*)pSelect->pFromTable)->pSubquery))) { int32_t code = isTimeLineAlignedQuery(pCxt->pCurrStmt, &isTimelineAlignedQuery); if (TSDB_CODE_SUCCESS != code) return code; if (!isTimelineAlignedQuery) return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_NOT_ALLOWED_FUNC, - "%s function requires valid time series input", pFunc->functionName); + "%s function requires valid time series input", pFunc->functionName); } if (NULL != pSelect->pFromTable && QUERY_NODE_JOIN_TABLE == nodeType(pSelect->pFromTable) && (TIME_LINE_GLOBAL != pSelect->timeLineCurMode && TIME_LINE_MULTI != pSelect->timeLineCurMode)) { @@ -2750,9 +2746,10 @@ static int32_t translateRepeatScanFunc(STranslateContext* pCxt, SFunctionNode* p } if (NULL != pSelect->pWindow) { - if (QUERY_NODE_EVENT_WINDOW == nodeType(pSelect->pWindow) || QUERY_NODE_COUNT_WINDOW == nodeType(pSelect->pWindow)) { - return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_NOT_ALLOWED_FUNC, - "%s function is not supported in count/event window", pFunc->functionName); + if (QUERY_NODE_EVENT_WINDOW == nodeType(pSelect->pWindow) || + QUERY_NODE_COUNT_WINDOW == nodeType(pSelect->pWindow)) { + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_NOT_ALLOWED_FUNC, + "%s function is not supported in count/event window", pFunc->functionName); } } return TSDB_CODE_SUCCESS; @@ -2861,7 +2858,7 @@ static void setFuncClassification(STranslateContext* pCxt, SFunctionNode* pFunc) static int32_t rewriteFuncToValue(STranslateContext* pCxt, char** pLiteral, SNode** pNode) { SValueNode* pVal = NULL; - int32_t code = nodesMakeNode(QUERY_NODE_VALUE, (SNode**)&pVal); + int32_t code = nodesMakeNode(QUERY_NODE_VALUE, (SNode**)&pVal); if (TSDB_CODE_SUCCESS != code) { return code; } @@ -2970,7 +2967,7 @@ static int32_t rewriteSystemInfoFunc(STranslateContext* pCxt, SNode** pNode) { static int32_t replacePsedudoColumnFuncWithColumn(STranslateContext* pCxt, SNode** ppNode) { SColumnNode* pCol = NULL; - int32_t code = nodesMakeNode(QUERY_NODE_COLUMN, (SNode**)&pCol); + int32_t code = nodesMakeNode(QUERY_NODE_COLUMN, (SNode**)&pCol); if (TSDB_CODE_SUCCESS != code) { return code; } @@ -3222,8 +3219,7 @@ static EDealRes translateFunction(STranslateContext* pCxt, SFunctionNode** pFunc pCxt->errCode = getFuncInfo(pCxt, *pFunc); if (TSDB_CODE_SUCCESS == pCxt->errCode) { - if ((SQL_CLAUSE_GROUP_BY == pCxt->currClause || - SQL_CLAUSE_PARTITION_BY == pCxt->currClause) && + if ((SQL_CLAUSE_GROUP_BY == pCxt->currClause || SQL_CLAUSE_PARTITION_BY == pCxt->currClause) && fmIsVectorFunc((*pFunc)->funcId)) { pCxt->errCode = TSDB_CODE_PAR_ILLEGAL_USE_AGG_FUNCTION; } @@ -3246,7 +3242,7 @@ static EDealRes translateLogicCond(STranslateContext* pCxt, SLogicConditionNode* static int32_t createCastFunc(STranslateContext* pCxt, SNode* pExpr, SDataType dt, SNode** pCast) { SFunctionNode* pFunc = NULL; - int32_t code = nodesMakeNode(QUERY_NODE_FUNCTION, (SNode**)&pFunc); + int32_t code = nodesMakeNode(QUERY_NODE_FUNCTION, (SNode**)&pFunc); if (TSDB_CODE_SUCCESS != code) { return code; } @@ -3281,7 +3277,7 @@ static bool isCondition(const SNode* pNode) { static int32_t rewriteIsTrue(SNode* pSrc, SNode** pIsTrue) { SOperatorNode* pOp = NULL; - int32_t code = nodesMakeNode(QUERY_NODE_OPERATOR, (SNode**)&pOp); + int32_t code = nodesMakeNode(QUERY_NODE_OPERATOR, (SNode**)&pOp); if (TSDB_CODE_SUCCESS != code) { return code; } @@ -3293,11 +3289,11 @@ static int32_t rewriteIsTrue(SNode* pSrc, SNode** pIsTrue) { return TSDB_CODE_SUCCESS; } -extern int8_t gDisplyTypes[TSDB_DATA_TYPE_MAX][TSDB_DATA_TYPE_MAX]; +extern int8_t gDisplyTypes[TSDB_DATA_TYPE_MAX][TSDB_DATA_TYPE_MAX]; static int32_t selectCommonType(SDataType* commonType, const SDataType* newType) { - if (commonType->type < TSDB_DATA_TYPE_NULL || commonType->type >= TSDB_DATA_TYPE_MAX || + if (commonType->type < TSDB_DATA_TYPE_NULL || commonType->type >= TSDB_DATA_TYPE_MAX || newType->type < TSDB_DATA_TYPE_NULL || newType->type >= TSDB_DATA_TYPE_MAX) { - return TSDB_CODE_INVALID_PARA; + return TSDB_CODE_INVALID_PARA; } int8_t type1 = commonType->type; int8_t type2 = newType->type; @@ -3308,26 +3304,25 @@ static int32_t selectCommonType(SDataType* commonType, const SDataType* newType) resultType = gDisplyTypes[type2][type1]; } if (resultType == -1) { - return TSDB_CODE_SCALAR_CONVERT_ERROR; + return TSDB_CODE_SCALAR_CONVERT_ERROR; } if (commonType->type == newType->type) { commonType->bytes = TMAX(commonType->bytes, newType->bytes); return TSDB_CODE_SUCCESS; } - if (resultType == commonType->type){ + if (resultType == commonType->type) { return TSDB_CODE_SUCCESS; } - if(resultType == newType->type) { + if (resultType == newType->type) { *commonType = *newType; return TSDB_CODE_SUCCESS; } commonType->bytes = TMAX(TMAX(commonType->bytes, newType->bytes), TYPE_BYTES[resultType]); - if(resultType == TSDB_DATA_TYPE_VARCHAR && (IS_FLOAT_TYPE(commonType->type) || IS_FLOAT_TYPE(newType->type))) { + if (resultType == TSDB_DATA_TYPE_VARCHAR && (IS_FLOAT_TYPE(commonType->type) || IS_FLOAT_TYPE(newType->type))) { commonType->bytes += TYPE_BYTES[TSDB_DATA_TYPE_DOUBLE]; } commonType->type = resultType; return TSDB_CODE_SUCCESS; - } static EDealRes translateCaseWhen(STranslateContext* pCxt, SCaseWhenNode* pCaseWhen) { @@ -3350,7 +3345,7 @@ static EDealRes translateCaseWhen(STranslateContext* pCxt, SCaseWhenNode* pCaseW } allNullThen = false; pCxt->errCode = selectCommonType(&pCaseWhen->node.resType, &pThenExpr->resType); - if(TSDB_CODE_SUCCESS != pCxt->errCode){ + if (TSDB_CODE_SUCCESS != pCxt->errCode) { return DEAL_RES_ERROR; } } @@ -3358,7 +3353,7 @@ static EDealRes translateCaseWhen(STranslateContext* pCxt, SCaseWhenNode* pCaseW SExprNode* pElseExpr = (SExprNode*)pCaseWhen->pElse; if (NULL != pElseExpr) { pCxt->errCode = selectCommonType(&pCaseWhen->node.resType, &pElseExpr->resType); - if(TSDB_CODE_SUCCESS != pCxt->errCode) { + if (TSDB_CODE_SUCCESS != pCxt->errCode) { return DEAL_RES_ERROR; } } @@ -3459,7 +3454,7 @@ static int32_t getGroupByErrorCode(STranslateContext* pCxt) { static EDealRes rewriteColToSelectValFunc(STranslateContext* pCxt, SNode** pNode) { SFunctionNode* pFunc = NULL; - int32_t code = nodesMakeNode(QUERY_NODE_FUNCTION, (SNode**)&pFunc); + int32_t code = nodesMakeNode(QUERY_NODE_FUNCTION, (SNode**)&pFunc); if (TSDB_CODE_SUCCESS != code) { pCxt->errCode = code; return DEAL_RES_ERROR; @@ -3482,7 +3477,7 @@ static EDealRes rewriteColToSelectValFunc(STranslateContext* pCxt, SNode** pNode static EDealRes rewriteExprToGroupKeyFunc(STranslateContext* pCxt, SNode** pNode) { SFunctionNode* pFunc = NULL; - int32_t code = nodesMakeNode(QUERY_NODE_FUNCTION, (SNode**)&pFunc); + int32_t code = nodesMakeNode(QUERY_NODE_FUNCTION, (SNode**)&pFunc); if (TSDB_CODE_SUCCESS != code) { pCxt->errCode = code; return DEAL_RES_ERROR; @@ -3866,7 +3861,7 @@ static EDealRes doCheckAggColCoexist(SNode** pNode, void* pContext) { static EDealRes doCheckGetAggColCoexist(SNode** pNode, void* pContext) { CheckAggColCoexistCxt* pCxt = (CheckAggColCoexistCxt*)pContext; - int32_t code = 0; + int32_t code = 0; if (isVectorFunc(*pNode)) { return DEAL_RES_IGNORE_CHILD; } @@ -3893,7 +3888,7 @@ static int32_t resetSelectFuncNumWithoutDup(SSelectStmt* pSelect) { pSelect->selectFuncNum = 0; pSelect->lastProcessByRowFuncId = -1; SNodeList* pNodeList = NULL; - int32_t code = nodesMakeList(&pNodeList); + int32_t code = nodesMakeList(&pNodeList); if (TSDB_CODE_SUCCESS != code) return code; code = nodesCollectSelectFuncs(pSelect, SQL_CLAUSE_FROM, NULL, fmIsSelectFunc, pNodeList); if (TSDB_CODE_SUCCESS != code) { @@ -4278,8 +4273,8 @@ static int32_t setTableTsmas(STranslateContext* pCxt, SName* pName, SRealTableNo SVgroupInfo vgInfo = {0}; bool exists = false; toName(pCxt->pParseCxt->acctId, pRealTable->table.dbName, "", &tsmaTargetTbName); - int32_t len = tsnprintf(buf, TSDB_TABLE_FNAME_LEN + TSDB_TABLE_NAME_LEN, "%s.%s_%s", pTsma->dbFName, pTsma->name, - pRealTable->table.tableName); + int32_t len = tsnprintf(buf, TSDB_TABLE_FNAME_LEN + TSDB_TABLE_NAME_LEN, "%s.%s_%s", pTsma->dbFName, + pTsma->name, pRealTable->table.tableName); len = taosCreateMD5Hash(buf, len); strncpy(tsmaTargetTbName.tname, buf, MD5_OUTPUT_LEN); code = collectUseTable(&tsmaTargetTbName, pCxt->pTargetTables); @@ -4364,7 +4359,7 @@ static EDealRes doTranslateTbName(SNode** pNode, void* pContext) { if (FUNCTION_TYPE_TBNAME == pFunc->funcType) { SRewriteTbNameContext* pCxt = (SRewriteTbNameContext*)pContext; SValueNode* pVal = NULL; - int32_t code = nodesMakeNode(QUERY_NODE_VALUE, (SNode**)&pVal); + int32_t code = nodesMakeNode(QUERY_NODE_VALUE, (SNode**)&pVal); if (TSDB_CODE_SUCCESS != code) { pCxt->errCode = code; return DEAL_RES_ERROR; @@ -4957,8 +4952,7 @@ int32_t translateTable(STranslateContext* pCxt, SNode** pTable, SNode* pJoinPare } code = translateAudit(pCxt, pRealTable, &name); #endif - if (TSDB_CODE_SUCCESS == code) - code = setTableVgroupList(pCxt, &name, pRealTable); + if (TSDB_CODE_SUCCESS == code) code = setTableVgroupList(pCxt, &name, pRealTable); if (TSDB_CODE_SUCCESS == code) { code = setTableIndex(pCxt, &name, pRealTable); } @@ -5063,7 +5057,7 @@ static int32_t createAllColumns(STranslateContext* pCxt, bool igTags, SNodeList* static int32_t createMultiResFunc(SFunctionNode* pSrcFunc, SExprNode* pExpr, SNode** ppNodeOut) { SFunctionNode* pFunc = NULL; - int32_t code = nodesMakeNode(QUERY_NODE_FUNCTION, (SNode**)&pFunc); + int32_t code = nodesMakeNode(QUERY_NODE_FUNCTION, (SNode**)&pFunc); if (TSDB_CODE_SUCCESS != code) { return code; } @@ -5153,12 +5147,12 @@ static int32_t createMultiResFuncsParas(STranslateContext* pCxt, SNodeList* pSrc static int32_t createMultiResFuncs(SFunctionNode* pSrcFunc, SNodeList* pExprs, SNodeList** pOutput) { SNodeList* pFuncs = NULL; - int32_t code = nodesMakeList(&pFuncs); + int32_t code = nodesMakeList(&pFuncs); if (NULL == pFuncs) { return code; } - SNode* pExpr = NULL; + SNode* pExpr = NULL; FOREACH(pExpr, pExprs) { SNode* pNode = NULL; code = createMultiResFunc(pSrcFunc, (SExprNode*)pExpr, &pNode); @@ -5205,7 +5199,7 @@ static int32_t createTags(STranslateContext* pCxt, SNodeList** pOutput) { SSchema* pTagsSchema = getTableTagSchema(pMeta); for (int32_t i = 0; i < pMeta->tableInfo.numOfTags; ++i) { SColumnNode* pCol = NULL; - int32_t code = nodesMakeNode(QUERY_NODE_COLUMN, (SNode**)&pCol); + int32_t code = nodesMakeNode(QUERY_NODE_COLUMN, (SNode**)&pCol); if (TSDB_CODE_SUCCESS != code) { return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_OUT_OF_MEMORY); } @@ -5291,7 +5285,7 @@ static int32_t getPositionValue(const SValueNode* pVal) { } static int32_t translateClausePosition(STranslateContext* pCxt, SNodeList* pProjectionList, SNodeList* pClauseList, - bool* pOther) { + bool* pOther) { *pOther = false; SNode* pNode = NULL; WHERE_EACH(pNode, pClauseList) { @@ -5350,8 +5344,8 @@ static int32_t translateOrderBy(STranslateContext* pCxt, SSelectStmt* pSelect) { } static EDealRes needFillImpl(SNode* pNode, void* pContext) { - if ((isAggFunc(pNode) || isInterpFunc(pNode)) && FUNCTION_TYPE_GROUP_KEY != ((SFunctionNode*)pNode)->funcType - && FUNCTION_TYPE_GROUP_CONST_VALUE != ((SFunctionNode*)pNode)->funcType) { + if ((isAggFunc(pNode) || isInterpFunc(pNode)) && FUNCTION_TYPE_GROUP_KEY != ((SFunctionNode*)pNode)->funcType && + FUNCTION_TYPE_GROUP_CONST_VALUE != ((SFunctionNode*)pNode)->funcType) { *(bool*)pContext = true; return DEAL_RES_END; } @@ -5435,8 +5429,8 @@ static int32_t checkProjectAlias(STranslateContext* pCxt, SNodeList* pProjection SHashObj* pUserAliasSet = taosHashInit(LIST_LENGTH(pProjectionList), taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_NO_LOCK); if (!pUserAliasSet) return terrno; - SNode* pProject = NULL; - int32_t code = TSDB_CODE_SUCCESS; + SNode* pProject = NULL; + int32_t code = TSDB_CODE_SUCCESS; FOREACH(pProject, pProjectionList) { SExprNode* pExpr = (SExprNode*)pProject; if (NULL != taosHashGet(pUserAliasSet, pExpr->userAlias, strlen(pExpr->userAlias))) { @@ -5458,11 +5452,9 @@ static int32_t translateProjectionList(STranslateContext* pCxt, SSelectStmt* pSe if (!pSelect->isSubquery) { return rewriteProjectAlias(pSelect->pProjectionList); } else { - SNode* pNode; + SNode* pNode; int32_t projIdx = 1; - FOREACH(pNode, pSelect->pProjectionList) { - ((SExprNode*)pNode)->projIdx = projIdx++; - } + FOREACH(pNode, pSelect->pProjectionList) { ((SExprNode*)pNode)->projIdx = projIdx++; } return TSDB_CODE_SUCCESS; } } @@ -5478,7 +5470,7 @@ static EDealRes replaceGroupByAliasImpl(SNode** pNode, void* pContext) { SNode* pProject = NULL; if (QUERY_NODE_VALUE == nodeType(*pNode)) { STranslateContext* pTransCxt = pCxt->pTranslateCxt; - SValueNode* pVal = (SValueNode*) *pNode; + SValueNode* pVal = (SValueNode*)*pNode; if (DEAL_RES_ERROR == translateValue(pTransCxt, pVal)) { return DEAL_RES_CONTINUE; } @@ -5487,7 +5479,7 @@ static EDealRes replaceGroupByAliasImpl(SNode** pNode, void* pContext) { } int32_t pos = getPositionValue(pVal); if (0 < pos && pos <= LIST_LENGTH(pProjectionList)) { - SNode* pNew = NULL; + SNode* pNew = NULL; int32_t code = nodesCloneNode(nodesListGetNode(pProjectionList, pos - 1), (SNode**)&pNew); if (TSDB_CODE_SUCCESS != code) { pCxt->pTranslateCxt->errCode = code; @@ -5511,8 +5503,7 @@ static int32_t replaceGroupByAlias(STranslateContext* pCxt, SSelectStmt* pSelect if (NULL == pSelect->pGroupByList) { return TSDB_CODE_SUCCESS; } - SReplaceGroupByAliasCxt cxt = { - .pTranslateCxt = pCxt, .pProjectionList = pSelect->pProjectionList}; + SReplaceGroupByAliasCxt cxt = {.pTranslateCxt = pCxt, .pProjectionList = pSelect->pProjectionList}; nodesRewriteExprsPostOrder(pSelect->pGroupByList, replaceGroupByAliasImpl, &cxt); return pCxt->errCode; @@ -5522,8 +5513,7 @@ static int32_t replacePartitionByAlias(STranslateContext* pCxt, SSelectStmt* pSe if (NULL == pSelect->pPartitionByList) { return TSDB_CODE_SUCCESS; } - SReplaceGroupByAliasCxt cxt = { - .pTranslateCxt = pCxt, .pProjectionList = pSelect->pProjectionList}; + SReplaceGroupByAliasCxt cxt = {.pTranslateCxt = pCxt, .pProjectionList = pSelect->pProjectionList}; nodesRewriteExprsPostOrder(pSelect->pPartitionByList, replaceGroupByAliasImpl, &cxt); return pCxt->errCode; @@ -5613,7 +5603,7 @@ static int32_t getQueryTimeRange(STranslateContext* pCxt, SNode* pWhere, STimeWi return TSDB_CODE_SUCCESS; } - SNode* pCond = NULL; + SNode* pCond = NULL; int32_t code = nodesCloneNode(pWhere, &pCond); if (NULL == pCond) { return code; @@ -5787,14 +5777,14 @@ static int32_t checkIntervalWindow(STranslateContext* pCxt, SIntervalWindowNode* return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INTER_OFFSET_TOO_BIG); } if (!fixed) { - double offsetMonth = 0, intervalMonth = 0; + double offsetMonth = 0, intervalMonth = 0; int32_t code = getMonthsFromTimeVal(pOffset->datum.i, precision, pOffset->unit, &offsetMonth); if (TSDB_CODE_SUCCESS != code) { - return code; + return code; } code = getMonthsFromTimeVal(pInter->datum.i, precision, pInter->unit, &intervalMonth); if (TSDB_CODE_SUCCESS != code) { - return code; + return code; } if (offsetMonth > intervalMonth) { return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INTER_OFFSET_TOO_BIG); @@ -5819,14 +5809,14 @@ static int32_t checkIntervalWindow(STranslateContext* pCxt, SIntervalWindowNode* return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INTER_SLIDING_TOO_SMALL); } if (valInter) { - double slidingMonth = 0, intervalMonth = 0; + double slidingMonth = 0, intervalMonth = 0; int32_t code = getMonthsFromTimeVal(pSliding->datum.i, precision, pSliding->unit, &slidingMonth); if (TSDB_CODE_SUCCESS != code) { - return code; + return code; } code = getMonthsFromTimeVal(pInter->datum.i, precision, pInter->unit, &intervalMonth); if (TSDB_CODE_SUCCESS != code) { - return code; + return code; } if (slidingMonth > intervalMonth) { return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INTER_SLIDING_TOO_BIG); @@ -6055,7 +6045,7 @@ static int32_t translateWindow(STranslateContext* pCxt, SSelectStmt* pSelect) { int32_t code = 0; if (QUERY_NODE_INTERVAL_WINDOW != nodeType(pSelect->pWindow)) { if (NULL != pSelect->pFromTable && QUERY_NODE_TEMP_TABLE == nodeType(pSelect->pFromTable) && - !isGlobalTimeLineQuery(((STempTableNode*)pSelect->pFromTable)->pSubquery)) { + !isGlobalTimeLineQuery(((STempTableNode*)pSelect->pFromTable)->pSubquery)) { bool isTimelineAlignedQuery = false; code = isTimeLineAlignedQuery(pCxt->pCurrStmt, &isTimelineAlignedQuery); if (TSDB_CODE_SUCCESS != code) return code; @@ -6094,7 +6084,7 @@ static int32_t translateWindow(STranslateContext* pCxt, SSelectStmt* pSelect) { static int32_t createDefaultFillNode(STranslateContext* pCxt, SNode** pOutput) { SFillNode* pFill = NULL; - int32_t code = nodesMakeNode(QUERY_NODE_FILL, (SNode**)&pFill); + int32_t code = nodesMakeNode(QUERY_NODE_FILL, (SNode**)&pFill); if (TSDB_CODE_SUCCESS != code) { return code; } @@ -6117,7 +6107,7 @@ static int32_t createDefaultFillNode(STranslateContext* pCxt, SNode** pOutput) { static int32_t createDefaultEveryNode(STranslateContext* pCxt, SNode** pOutput) { SValueNode* pEvery = NULL; - int32_t code = nodesMakeNode(QUERY_NODE_VALUE, (SNode**)&pEvery); + int32_t code = nodesMakeNode(QUERY_NODE_VALUE, (SNode**)&pEvery); if (TSDB_CODE_SUCCESS != code) { return code; } @@ -6308,7 +6298,7 @@ typedef struct SEqCondTbNameTableInfo { //[tableAlias.]tbname = tbNamVal static int32_t isOperatorEqTbnameCond(STranslateContext* pCxt, SOperatorNode* pOperator, char** ppTableAlias, - SArray** ppTabNames, bool* pRet) { + SArray** ppTabNames, bool* pRet) { if (pOperator->opType != OP_TYPE_EQUAL) { *pRet = false; return TSDB_CODE_SUCCESS; @@ -6359,7 +6349,7 @@ static int32_t isOperatorEqTbnameCond(STranslateContext* pCxt, SOperatorNode* pO //[tableAlias.]tbname in (value1, value2, ...) static int32_t isOperatorTbnameInCond(STranslateContext* pCxt, SOperatorNode* pOperator, char** ppTableAlias, - SArray** ppTbNames, bool* pRet) { + SArray** ppTbNames, bool* pRet) { if (pOperator->opType != OP_TYPE_IN) return false; if (nodeType(pOperator->pLeft) != QUERY_NODE_FUNCTION || ((SFunctionNode*)(pOperator->pLeft))->funcType != FUNCTION_TYPE_TBNAME || @@ -6383,8 +6373,8 @@ static int32_t isOperatorTbnameInCond(STranslateContext* pCxt, SOperatorNode* pO SNodeListNode* pValueListNode = (SNodeListNode*)pOperator->pRight; *ppTbNames = taosArrayInit(LIST_LENGTH(pValueListNode->pNodeList), sizeof(void*)); if (!*ppTbNames) return terrno; - SNodeList* pValueNodeList = pValueListNode->pNodeList; - SNode* pValNode = NULL; + SNodeList* pValueNodeList = pValueListNode->pNodeList; + SNode* pValNode = NULL; FOREACH(pValNode, pValueNodeList) { if (nodeType(pValNode) != QUERY_NODE_VALUE) { *pRet = false; @@ -6400,7 +6390,8 @@ static int32_t isOperatorTbnameInCond(STranslateContext* pCxt, SOperatorNode* pO return TSDB_CODE_SUCCESS; } -static int32_t findEqCondTbNameInOperatorNode(STranslateContext* pCxt, SNode* pWhere, SEqCondTbNameTableInfo* pInfo, bool* pRet) { +static int32_t findEqCondTbNameInOperatorNode(STranslateContext* pCxt, SNode* pWhere, SEqCondTbNameTableInfo* pInfo, + bool* pRet) { int32_t code = TSDB_CODE_SUCCESS; char* pTableAlias = NULL; bool eqTbnameCond = false, tbnameInCond = false; @@ -6467,7 +6458,7 @@ static int32_t findEqualCondTbnameInLogicCondAnd(STranslateContext* pCxt, SNode* static int32_t unionEqualCondTbnamesOfSameTable(SArray* aTableTbnames, SEqCondTbNameTableInfo* pInfo) { int32_t code = TSDB_CODE_SUCCESS; - bool bFoundTable = false; + bool bFoundTable = false; for (int i = 0; i < taosArrayGetSize(aTableTbnames); ++i) { SEqCondTbNameTableInfo* info = taosArrayGet(aTableTbnames, i); if (info->pRealTable == pInfo->pRealTable) { @@ -6547,7 +6538,7 @@ static int32_t findEqualCondTbname(STranslateContext* pCxt, SNode* pWhere, SArra } static void findVgroupsFromEqualTbname(STranslateContext* pCxt, SArray* aTbnames, const char* dbName, - int32_t numOfVgroups, SVgroupsInfo* vgsInfo) { + int32_t numOfVgroups, SVgroupsInfo* vgsInfo) { int32_t nVgroups = 0; int32_t nTbls = taosArrayGetSize(aTbnames); @@ -6584,10 +6575,10 @@ static void findVgroupsFromEqualTbname(STranslateContext* pCxt, SArray* aTbnames } static int32_t replaceToChildTableQuery(STranslateContext* pCxt, SEqCondTbNameTableInfo* pInfo) { - SName snameTb = {0}; - int32_t code = 0; + SName snameTb = {0}; + int32_t code = 0; SRealTableNode* pRealTable = pInfo->pRealTable; - char* tbName = taosArrayGetP(pInfo->aTbnames, 0); + char* tbName = taosArrayGetP(pInfo->aTbnames, 0); toName(pCxt->pParseCxt->acctId, pRealTable->table.dbName, tbName, &snameTb); STableMeta* pMeta = NULL; @@ -6604,14 +6595,14 @@ static int32_t replaceToChildTableQuery(STranslateContext* pCxt, SEqCondTbNameTa pRealTable->stbRewrite = true; if (pRealTable->pTsmas) { - // if select from a child table, fetch it's corresponding tsma target child table infos + // if select from a child table, fetch it's corresponding tsma target child table infos char buf[TSDB_TABLE_FNAME_LEN + TSDB_TABLE_NAME_LEN + 1]; for (int32_t i = 0; i < pRealTable->pTsmas->size; ++i) { STableTSMAInfo* pTsma = taosArrayGetP(pRealTable->pTsmas, i); SName tsmaTargetTbName = {0}; toName(pCxt->pParseCxt->acctId, pRealTable->table.dbName, "", &tsmaTargetTbName); int32_t len = tsnprintf(buf, TSDB_TABLE_FNAME_LEN + TSDB_TABLE_NAME_LEN, "%s.%s_%s", pTsma->dbFName, pTsma->name, - pRealTable->table.tableName); + pRealTable->table.tableName); len = taosCreateMD5Hash(buf, len); strncpy(tsmaTargetTbName.tname, buf, MD5_OUTPUT_LEN); STsmaTargetTbInfo ctbInfo = {0}; @@ -6639,16 +6630,16 @@ static int32_t replaceToChildTableQuery(STranslateContext* pCxt, SEqCondTbNameTa } static int32_t setEqualTbnameTableVgroups(STranslateContext* pCxt, SSelectStmt* pSelect, SArray* aTables) { - int32_t code = TSDB_CODE_SUCCESS; - int32_t aTableNum = taosArrayGetSize(aTables); - int32_t nTbls = 0; - bool stableQuery = false; + int32_t code = TSDB_CODE_SUCCESS; + int32_t aTableNum = taosArrayGetSize(aTables); + int32_t nTbls = 0; + bool stableQuery = false; SEqCondTbNameTableInfo* pInfo = NULL; qDebug("start to update stable vg for tbname optimize, aTableNum:%d", aTableNum); for (int i = 0; i < aTableNum; ++i) { pInfo = taosArrayGet(aTables, i); - int32_t numOfVgs = pInfo->pRealTable->pVgroupList->numOfVgroups; + int32_t numOfVgs = pInfo->pRealTable->pVgroupList->numOfVgroups; nTbls = taosArrayGetSize(pInfo->aTbnames); SVgroupsInfo* vgsInfo = taosMemoryMalloc(sizeof(SVgroupsInfo) + nTbls * sizeof(SVgroupInfo)); @@ -6714,7 +6705,8 @@ static int32_t setEqualTbnameTableVgroups(STranslateContext* pCxt, SSelectStmt* } } - qDebug("before ctbname optimize, code:%d, aTableNum:%d, nTbls:%d, stableQuery:%d", code, aTableNum, nTbls, stableQuery); + qDebug("before ctbname optimize, code:%d, aTableNum:%d, nTbls:%d, stableQuery:%d", code, aTableNum, nTbls, + stableQuery); if (TSDB_CODE_SUCCESS == code && 1 == aTableNum && 1 == nTbls && stableQuery && NULL == pInfo->pRealTable->pTsmas) { code = replaceToChildTableQuery(pCxt, pInfo); @@ -6770,13 +6762,13 @@ static int32_t checkLimit(STranslateContext* pCxt, SSelectStmt* pSelect) { static int32_t createPrimaryKeyColByTable(STranslateContext* pCxt, STableNode* pTable, SNode** pPrimaryKey) { SColumnNode* pCol = NULL; - int32_t code = nodesMakeNode(QUERY_NODE_COLUMN, (SNode**)&pCol); + int32_t code = nodesMakeNode(QUERY_NODE_COLUMN, (SNode**)&pCol); if (TSDB_CODE_SUCCESS != code) { return code; } pCol->colId = PRIMARYKEY_TIMESTAMP_COL_ID; strcpy(pCol->colName, ROWTS_PSEUDO_COLUMN_NAME); - bool found = false; + bool found = false; code = findAndSetColumn(pCxt, &pCol, pTable, &found, true); if (TSDB_CODE_SUCCESS != code || !found) { return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_VALID_PRIM_TS_REQUIRED); @@ -6808,8 +6800,8 @@ static EDealRes collectTableAlias(SNode* pNode, void* pContext) { *(SSHashObj**)pContext = pHash; } - if (TSDB_CODE_SUCCESS != tSimpleHashPut(*(SSHashObj**)pContext, pCol->tableAlias, strlen(pCol->tableAlias), pCol->tableAlias, - sizeof(pCol->tableAlias))) { + if (TSDB_CODE_SUCCESS != tSimpleHashPut(*(SSHashObj**)pContext, pCol->tableAlias, strlen(pCol->tableAlias), + pCol->tableAlias, sizeof(pCol->tableAlias))) { return DEAL_RES_ERROR; } @@ -6869,13 +6861,13 @@ static int32_t appendTsForImplicitTsFunc(STranslateContext* pCxt, SSelectStmt* p static int32_t createPkColByTable(STranslateContext* pCxt, SRealTableNode* pTable, SNode** pPk) { SColumnNode* pCol = NULL; - int32_t code = nodesMakeNode(QUERY_NODE_COLUMN, (SNode**)&pCol); + int32_t code = nodesMakeNode(QUERY_NODE_COLUMN, (SNode**)&pCol); if (TSDB_CODE_SUCCESS != code) { return code; } pCol->colId = pTable->pMeta->schema[1].colId; strcpy(pCol->colName, pTable->pMeta->schema[1].name); - bool found = false; + bool found = false; code = findAndSetColumn(pCxt, &pCol, (STableNode*)pTable, &found, true); if (TSDB_CODE_SUCCESS != code || !found) { return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INTERNAL_ERROR); @@ -6943,7 +6935,7 @@ static EDealRes replaceOrderByAliasImpl(SNode** pNode, void* pContext) { (QUERY_NODE_COLUMN == nodeType(pProject) && !nodesEqualNode(*pNode, pProject)))) { continue; } - SNode* pNew = NULL; + SNode* pNew = NULL; int32_t code = nodesCloneNode(pProject, &pNew); if (NULL == pNew) { pCxt->pTranslateCxt->errCode = code; @@ -6966,7 +6958,7 @@ static EDealRes replaceOrderByAliasImpl(SNode** pNode, void* pContext) { } int32_t pos = getPositionValue(pVal); if (0 < pos && pos <= LIST_LENGTH(pProjectionList)) { - SNode* pNew = NULL; + SNode* pNew = NULL; int32_t code = nodesCloneNode(nodesListGetNode(pProjectionList, pos - 1), &pNew); if (NULL == pNew) { pCxt->pTranslateCxt->errCode = code; @@ -7075,8 +7067,7 @@ static int32_t translateSelectFrom(STranslateContext* pCxt, SSelectStmt* pSelect } if (TSDB_CODE_SUCCESS == code) { code = resetSelectFuncNumWithoutDup(pSelect); - if (TSDB_CODE_SUCCESS == code) - code = checkAggColCoexist(pCxt, pSelect); + if (TSDB_CODE_SUCCESS == code) code = checkAggColCoexist(pCxt, pSelect); } /* if (TSDB_CODE_SUCCESS == code) { @@ -7137,7 +7128,7 @@ static int32_t translateSelect(STranslateContext* pCxt, SSelectStmt* pSelect) { static SNode* createSetOperProject(const char* pTableAlias, SNode* pNode) { SColumnNode* pCol = NULL; - int32_t code = nodesMakeNode(QUERY_NODE_COLUMN, (SNode**)&pCol); + int32_t code = nodesMakeNode(QUERY_NODE_COLUMN, (SNode**)&pCol); if (TSDB_CODE_SUCCESS != code) { return NULL; } @@ -7350,7 +7341,7 @@ static int32_t translateInsertQuery(STranslateContext* pCxt, SInsertStmt* pInser static int32_t addOrderByPrimaryKeyToQueryImpl(STranslateContext* pCxt, SNode* pPrimaryKeyExpr, SNodeList** pOrderByList) { SOrderByExprNode* pOrderByExpr = NULL; - int32_t code = nodesMakeNode(QUERY_NODE_ORDER_BY_EXPR, (SNode**)&pOrderByExpr); + int32_t code = nodesMakeNode(QUERY_NODE_ORDER_BY_EXPR, (SNode**)&pOrderByExpr); if (TSDB_CODE_SUCCESS != code) { return code; } @@ -7493,7 +7484,7 @@ static int32_t buildCreateDbRetentions(const SNodeList* pRetentions, SCreateDbRe } static int32_t buildCreateDbReq(STranslateContext* pCxt, SCreateDatabaseStmt* pStmt, SCreateDbReq* pReq) { - SName name = {0}; + SName name = {0}; int32_t code = tNameSetDbName(&name, pCxt->pParseCxt->acctId, pStmt->dbName, strlen(pStmt->dbName)); if (TSDB_CODE_SUCCESS != code) return code; (void)tNameGetFullDbName(&name, pReq->db); @@ -8005,8 +7996,8 @@ static int32_t checkDatabaseOptions(STranslateContext* pCxt, const char* pDbName code = checkOptionsDependency(pCxt, pDbName, pOptions); } if (TSDB_CODE_SUCCESS == code) { - code = - checkDbRangeOption(pCxt, "s3_chunksize", pOptions->s3ChunkSize, TSDB_MIN_S3_CHUNK_SIZE, TSDB_MAX_S3_CHUNK_SIZE); + code = checkDbRangeOption(pCxt, "s3_chunkpages", pOptions->s3ChunkSize, TSDB_MIN_S3_CHUNK_SIZE, + TSDB_MAX_S3_CHUNK_SIZE); } if (TSDB_CODE_SUCCESS == code) { code = checkDbRangeOption(pCxt, "s3_compact", pOptions->s3Compact, TSDB_MIN_S3_COMPACT, TSDB_MAX_S3_COMPACT); @@ -8026,7 +8017,7 @@ static int32_t checkCreateDatabase(STranslateContext* pCxt, SCreateDatabaseStmt* CMD_TYPE* pCmdReq = genericCmd; \ char* cmdSql = taosMemoryMalloc(sqlLen); \ if (cmdSql == NULL) { \ - return terrno; \ + return terrno; \ } \ memcpy(cmdSql, sql, sqlLen); \ pCmdReq->sqlLen = sqlLen; \ @@ -8210,7 +8201,7 @@ static int32_t translateCreateDatabase(STranslateContext* pCxt, SCreateDatabaseS static int32_t translateDropDatabase(STranslateContext* pCxt, SDropDatabaseStmt* pStmt) { SDropDbReq dropReq = {0}; SName name = {0}; - int32_t code = tNameSetDbName(&name, pCxt->pParseCxt->acctId, pStmt->dbName, strlen(pStmt->dbName)); + int32_t code = tNameSetDbName(&name, pCxt->pParseCxt->acctId, pStmt->dbName, strlen(pStmt->dbName)); if (TSDB_CODE_SUCCESS != code) return code; (void)tNameGetFullDbName(&name, dropReq.db); dropReq.ignoreNotExists = pStmt->ignoreNotExists; @@ -8292,7 +8283,7 @@ static int32_t translateAlterDatabase(STranslateContext* pCxt, SAlterDatabaseStm static int32_t translateTrimDatabase(STranslateContext* pCxt, STrimDatabaseStmt* pStmt) { STrimDbReq req = {.maxSpeed = pStmt->maxSpeed}; SName name = {0}; - int32_t code = tNameSetDbName(&name, pCxt->pParseCxt->acctId, pStmt->dbName, strlen(pStmt->dbName)); + int32_t code = tNameSetDbName(&name, pCxt->pParseCxt->acctId, pStmt->dbName, strlen(pStmt->dbName)); if (TSDB_CODE_SUCCESS != code) return code; (void)tNameGetFullDbName(&name, req.db); return buildCmdMsg(pCxt, TDMT_MND_TRIM_DB, (FSerializeFunc)tSerializeSTrimDbReq, &req); @@ -8329,7 +8320,7 @@ static int32_t columnDefNodeToField(SNodeList* pList, SArray** pArray, bool calB if (!pArray) return terrno; int32_t code = TSDB_CODE_SUCCESS; - SNode* pNode; + SNode* pNode; FOREACH(pNode, pList) { SColumnDefNode* pCol = (SColumnDefNode*)pNode; SFieldWithOptions field = {.type = pCol->dataType.type, .bytes = calcTypeBytes(pCol->dataType)}; @@ -8801,7 +8792,7 @@ typedef struct SSampleAstInfo { static int32_t buildTableForSampleAst(SSampleAstInfo* pInfo, SNode** pOutput) { SRealTableNode* pTable = NULL; - int32_t code = nodesMakeNode(QUERY_NODE_REAL_TABLE, (SNode**)&pTable); + int32_t code = nodesMakeNode(QUERY_NODE_REAL_TABLE, (SNode**)&pTable); if (TSDB_CODE_SUCCESS != code) { return code; } @@ -8815,7 +8806,7 @@ static int32_t buildTableForSampleAst(SSampleAstInfo* pInfo, SNode** pOutput) { static int32_t addWstartToSampleProjects(SNodeList* pProjectionList) { SFunctionNode* pFunc = NULL; - int32_t code = nodesMakeNode(QUERY_NODE_FUNCTION, (SNode**)&pFunc); + int32_t code = nodesMakeNode(QUERY_NODE_FUNCTION, (SNode**)&pFunc); if (NULL == pFunc) { return code; } @@ -8826,7 +8817,7 @@ static int32_t addWstartToSampleProjects(SNodeList* pProjectionList) { static int32_t addWendToSampleProjects(SNodeList* pProjectionList) { SFunctionNode* pFunc = NULL; - int32_t code = nodesMakeNode(QUERY_NODE_FUNCTION, (SNode**)&pFunc); + int32_t code = nodesMakeNode(QUERY_NODE_FUNCTION, (SNode**)&pFunc); if (NULL == pFunc) { return code; } @@ -8837,7 +8828,7 @@ static int32_t addWendToSampleProjects(SNodeList* pProjectionList) { static int32_t addWdurationToSampleProjects(SNodeList* pProjectionList) { SFunctionNode* pFunc = NULL; - int32_t code = nodesMakeNode(QUERY_NODE_FUNCTION, (SNode**)&pFunc); + int32_t code = nodesMakeNode(QUERY_NODE_FUNCTION, (SNode**)&pFunc); if (NULL == pFunc) { return code; } @@ -8874,7 +8865,7 @@ static int32_t buildProjectsForSampleAst(SSampleAstInfo* pInfo, SNodeList** pLis static int32_t buildIntervalForSampleAst(SSampleAstInfo* pInfo, SNode** pOutput) { SIntervalWindowNode* pInterval = NULL; - int32_t code = nodesMakeNode(QUERY_NODE_INTERVAL_WINDOW, (SNode**)&pInterval); + int32_t code = nodesMakeNode(QUERY_NODE_INTERVAL_WINDOW, (SNode**)&pInterval); if (NULL == pInterval) { return code; } @@ -8896,7 +8887,7 @@ static int32_t buildIntervalForSampleAst(SSampleAstInfo* pInfo, SNode** pOutput) static int32_t buildSampleAst(STranslateContext* pCxt, SSampleAstInfo* pInfo, char** pAst, int32_t* pLen, char** pExpr, int32_t* pExprLen, int32_t* pProjectionTotalLen) { SSelectStmt* pSelect = NULL; - int32_t code = nodesMakeNode(QUERY_NODE_SELECT_STMT, (SNode**)&pSelect); + int32_t code = nodesMakeNode(QUERY_NODE_SELECT_STMT, (SNode**)&pSelect); if (NULL == pSelect) { return code; } @@ -8937,7 +8928,7 @@ static void clearSampleAstInfo(SSampleAstInfo* pInfo) { static int32_t makeIntervalVal(SRetention* pRetension, int8_t precision, SNode** ppNode) { SValueNode* pVal = NULL; - int32_t code = nodesMakeNode(QUERY_NODE_VALUE, (SNode**)&pVal); + int32_t code = nodesMakeNode(QUERY_NODE_VALUE, (SNode**)&pVal); if (NULL == pVal) { return code; } @@ -8964,7 +8955,7 @@ static int32_t makeIntervalVal(SRetention* pRetension, int8_t precision, SNode** static int32_t createColumnFromDef(SColumnDefNode* pDef, SNode** ppCol) { SColumnNode* pCol = NULL; - int32_t code = nodesMakeNode(QUERY_NODE_COLUMN, (SNode**)&pCol); + int32_t code = nodesMakeNode(QUERY_NODE_COLUMN, (SNode**)&pCol); if (NULL == pCol) { return code; } @@ -8975,7 +8966,7 @@ static int32_t createColumnFromDef(SColumnDefNode* pDef, SNode** ppCol) { static int32_t createRollupFunc(SNode* pSrcFunc, SColumnDefNode* pColDef, SNode** ppRollupFunc) { SFunctionNode* pFunc = NULL; - int32_t code = nodesCloneNode(pSrcFunc, (SNode**)&pFunc); + int32_t code = nodesCloneNode(pSrcFunc, (SNode**)&pFunc); if (NULL == pFunc) { return code; } @@ -8995,7 +8986,7 @@ static int32_t createRollupFunc(SNode* pSrcFunc, SColumnDefNode* pColDef, SNode* static int32_t createRollupFuncs(SCreateTableStmt* pStmt, SNodeList** ppList) { SNodeList* pFuncs = NULL; - int32_t code = nodesMakeList(&pFuncs); + int32_t code = nodesMakeList(&pFuncs); if (NULL == pFuncs) { return code; } @@ -9024,7 +9015,8 @@ static int32_t createRollupFuncs(SCreateTableStmt* pStmt, SNodeList** ppList) { } *ppList = pFuncs; - return code;; + return code; + ; } static int32_t createRollupTableMeta(SCreateTableStmt* pStmt, int8_t precision, STableMeta** ppTbMeta) { @@ -9056,7 +9048,7 @@ static int32_t createRollupTableMeta(SCreateTableStmt* pStmt, int8_t precision, static int32_t createTbnameFunction(SFunctionNode** ppFunc) { SFunctionNode* pFunc = NULL; - int32_t code = nodesMakeNode(QUERY_NODE_FUNCTION, (SNode**)&pFunc); + int32_t code = nodesMakeNode(QUERY_NODE_FUNCTION, (SNode**)&pFunc); if (NULL == pFunc) { return code; } @@ -9153,8 +9145,7 @@ static int32_t buildCreateStbReq(STranslateContext* pCxt, SCreateTableStmt* pStm // columnDefNodeToField(pStmt->pCols, &pReq->pColumns, true); // columnDefNodeToField(pStmt->pTags, &pReq->pTags, true); code = columnDefNodeToField(pStmt->pCols, &pReq->pColumns, true); - if (TSDB_CODE_SUCCESS == code) - code = tagDefNodeToField(pStmt->pTags, &pReq->pTags, true); + if (TSDB_CODE_SUCCESS == code) code = tagDefNodeToField(pStmt->pTags, &pReq->pTags, true); if (TSDB_CODE_SUCCESS == code) { pReq->numOfColumns = LIST_LENGTH(pStmt->pCols); pReq->numOfTags = LIST_LENGTH(pStmt->pTags); @@ -9174,8 +9165,7 @@ static int32_t buildCreateStbReq(STranslateContext* pCxt, SCreateTableStmt* pStm toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, &tableName); code = tNameExtractFullName(&tableName, pReq->name); } - if (TSDB_CODE_SUCCESS == code) - code = collectUseTable(&tableName, pCxt->pTables); + if (TSDB_CODE_SUCCESS == code) code = collectUseTable(&tableName, pCxt->pTables); if (TSDB_CODE_SUCCESS == code) { code = collectUseTable(&tableName, pCxt->pTargetTables); } @@ -9527,12 +9517,13 @@ static int32_t translateAlterSuperTable(STranslateContext* pCxt, SAlterTableStmt static int32_t translateUseDatabase(STranslateContext* pCxt, SUseDatabaseStmt* pStmt) { SUseDbReq usedbReq = {0}; SName name = {0}; - int32_t code = tNameSetDbName(&name, pCxt->pParseCxt->acctId, pStmt->dbName, strlen(pStmt->dbName)); + int32_t code = tNameSetDbName(&name, pCxt->pParseCxt->acctId, pStmt->dbName, strlen(pStmt->dbName)); if (TSDB_CODE_SUCCESS == code) { code = tNameExtractFullName(&name, usedbReq.db); } if (TSDB_CODE_SUCCESS == code) - code = getDBVgVersion(pCxt, usedbReq.db, &usedbReq.vgVersion, &usedbReq.dbId, &usedbReq.numOfTable, &usedbReq.stateTs); + code = + getDBVgVersion(pCxt, usedbReq.db, &usedbReq.vgVersion, &usedbReq.dbId, &usedbReq.numOfTable, &usedbReq.stateTs); if (TSDB_CODE_SUCCESS == code) { code = buildCmdMsg(pCxt, TDMT_MND_USE_DB, (FSerializeFunc)tSerializeSUseDbReq, &usedbReq); } @@ -9801,9 +9792,9 @@ static int32_t buildCreateSmaReq(STranslateContext* pCxt, SCreateIndexStmt* pStm pReq->intervalUnit = ((SValueNode*)pStmt->pOptions->pInterval)->unit; pReq->offset = (NULL != pStmt->pOptions->pOffset ? ((SValueNode*)pStmt->pOptions->pOffset)->datum.i : 0); pReq->sliding = - (NULL != pStmt->pOptions->pSliding ? ((SValueNode*)pStmt->pOptions->pSliding)->datum.i : pReq->interval); + (NULL != pStmt->pOptions->pSliding ? ((SValueNode*)pStmt->pOptions->pSliding)->datum.i : pReq->interval); pReq->slidingUnit = - (NULL != pStmt->pOptions->pSliding ? ((SValueNode*)pStmt->pOptions->pSliding)->unit : pReq->intervalUnit); + (NULL != pStmt->pOptions->pSliding ? ((SValueNode*)pStmt->pOptions->pSliding)->unit : pReq->intervalUnit); } if (TSDB_CODE_SUCCESS == code && NULL != pStmt->pOptions->pStreamOptions) { @@ -10112,8 +10103,7 @@ static int32_t buildCreateTopicReq(STranslateContext* pCxt, SCreateTopicStmt* pS } else if ('\0' != pStmt->subDbName[0]) { pReq->subType = TOPIC_SUB_TYPE__DB; code = tNameSetDbName(&name, pCxt->pParseCxt->acctId, pStmt->subDbName, strlen(pStmt->subDbName)); - if (TSDB_CODE_SUCCESS == code) - (void)tNameGetFullDbName(&name, pReq->subDbName); + if (TSDB_CODE_SUCCESS == code) (void)tNameGetFullDbName(&name, pReq->subDbName); } else { pReq->subType = TOPIC_SUB_TYPE__COLUMN; char* dbName = ((SRealTableNode*)(((SSelectStmt*)pStmt->pQuery)->pFromTable))->table.dbName; @@ -10202,7 +10192,7 @@ static int32_t checkCollectTopicTags(STranslateContext* pCxt, SCreateTopicStmt* // for (int32_t i = 0; i < pMeta->tableInfo.numOfColumns; ++i) { SSchema* column = &pMeta->schema[0]; SColumnNode* col = NULL; - int32_t code = nodesMakeNode(QUERY_NODE_COLUMN, (SNode**)&col); + int32_t code = nodesMakeNode(QUERY_NODE_COLUMN, (SNode**)&col); if (NULL == col) { return code; } @@ -10239,7 +10229,7 @@ static int32_t buildQueryForTableTopic(STranslateContext* pCxt, SCreateTopicStmt return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_SYNTAX_ERROR, "Only supertable table can be used"); } - SNodeList* pProjection = NULL; + SNodeList* pProjection = NULL; SRealTableNode* realTable = NULL; code = checkCollectTopicTags(pCxt, pStmt, pMeta, &pProjection); if (TSDB_CODE_SUCCESS == code) { @@ -10518,7 +10508,7 @@ static int32_t setColumnDefNodePrimaryKey(SColumnDefNode* pNode, bool isPk) { if (!pNode->pOptions) { code = nodesMakeNode(QUERY_NODE_COLUMN_OPTIONS, &pNode->pOptions); } - if (TSDB_CODE_SUCCESS ==code) ((SColumnOptions*)pNode->pOptions)->bPrimaryKey = isPk; + if (TSDB_CODE_SUCCESS == code) ((SColumnOptions*)pNode->pOptions)->bPrimaryKey = isPk; return code; } @@ -10530,7 +10520,7 @@ static int32_t addWstartTsToCreateStreamQueryImpl(STranslateContext* pCxt, SSele return TSDB_CODE_SUCCESS; } SFunctionNode* pFunc = NULL; - int32_t code = nodesMakeNode(QUERY_NODE_FUNCTION, (SNode**)&pFunc); + int32_t code = nodesMakeNode(QUERY_NODE_FUNCTION, (SNode**)&pFunc); if (NULL == pFunc) { return code; } @@ -10589,7 +10579,7 @@ static int32_t addTagsToCreateStreamQuery(STranslateContext* pCxt, SCreateStream SNode* pPart = NULL; FOREACH(pPart, pSelect->pPartitionByList) { if (0 == strcmp(getTagNameForCreateStreamTag(pTag), ((SExprNode*)pPart)->userAlias)) { - SNode* pNew = NULL; + SNode* pNew = NULL; int32_t code = nodesCloneNode(pPart, &pNew); if (TSDB_CODE_SUCCESS != code) return code; if (TSDB_CODE_SUCCESS != (code = nodesListMakeStrictAppend(&pSelect->pTags, pNew))) { @@ -10608,7 +10598,7 @@ static int32_t addTagsToCreateStreamQuery(STranslateContext* pCxt, SCreateStream static int32_t createNullValue(SNode** ppNode) { SValueNode* pValue = NULL; - int32_t code = nodesMakeNode(QUERY_NODE_VALUE, (SNode**)&pValue); + int32_t code = nodesMakeNode(QUERY_NODE_VALUE, (SNode**)&pValue); if (NULL == pValue) { return code; } @@ -10625,8 +10615,7 @@ static int32_t addNullTagsForExistTable(STranslateContext* pCxt, STableMeta* pMe for (int32_t i = 0; TSDB_CODE_SUCCESS == code && i < numOfTags; ++i) { SNode* pNull = NULL; code = createNullValue(&pNull); - if (TSDB_CODE_SUCCESS == code) - code = nodesListMakeStrictAppend(&pSelect->pTags, pNull); + if (TSDB_CODE_SUCCESS == code) code = nodesListMakeStrictAppend(&pSelect->pTags, pNull); } return code; } @@ -10643,7 +10632,7 @@ static EDealRes rewriteSubtable(SNode** pNode, void* pContext) { SNode* pPart = NULL; FOREACH(pPart, pCxt->pPartitionList) { if (0 == strcmp(((SColumnNode*)*pNode)->colName, ((SExprNode*)pPart)->userAlias)) { - SNode* pNew = NULL; + SNode* pNew = NULL; int32_t code = nodesCloneNode(pPart, &pNew); if (NULL == pNew) { pCxt->pCxt->errCode = code; @@ -10686,8 +10675,7 @@ static int32_t addNullTagsForCreateTable(STranslateContext* pCxt, SCreateStreamS for (int32_t i = 0; TSDB_CODE_SUCCESS == code && i < LIST_LENGTH(pStmt->pTags); ++i) { SNode* pNull = NULL; code = createNullValue(&pNull); - if (TSDB_CODE_SUCCESS == code) - code = nodesListMakeStrictAppend(&((SSelectStmt*)pStmt->pQuery)->pTags, pNull); + if (TSDB_CODE_SUCCESS == code) code = nodesListMakeStrictAppend(&((SSelectStmt*)pStmt->pQuery)->pTags, pNull); } return code; } @@ -10700,9 +10688,9 @@ static int32_t addNullTagsToCreateStreamQuery(STranslateContext* pCxt, STableMet } static int32_t addColDefNodeByProj(SNodeList** ppCols, const SNode* pProject, int8_t flags) { - const SExprNode* pExpr = (const SExprNode*)pProject; - SColumnDefNode* pColDef = NULL; - int32_t code = nodesMakeNode(QUERY_NODE_COLUMN_DEF, (SNode**)&pColDef); + const SExprNode* pExpr = (const SExprNode*)pProject; + SColumnDefNode* pColDef = NULL; + int32_t code = nodesMakeNode(QUERY_NODE_COLUMN_DEF, (SNode**)&pColDef); if (TSDB_CODE_SUCCESS != code) return code; strcpy(pColDef->colName, pExpr->userAlias); pColDef->dataType = pExpr->resType; @@ -10872,10 +10860,11 @@ static int32_t checkStreamQuery(STranslateContext* pCxt, SCreateStreamStmt* pStm if (NULL != pStmt->pOptions->pDelay) { SValueNode* pVal = (SValueNode*)pStmt->pOptions->pDelay; - int64_t minDelay = 0; - char* str = "5s"; - if (DEAL_RES_ERROR != translateValue(pCxt, pVal) && TSDB_CODE_SUCCESS == - parseNatualDuration(str, strlen(str), &minDelay, &pVal->unit, pVal->node.resType.precision, false)) { + int64_t minDelay = 0; + char* str = "5s"; + if (DEAL_RES_ERROR != translateValue(pCxt, pVal) && + TSDB_CODE_SUCCESS == + parseNatualDuration(str, strlen(str), &minDelay, &pVal->unit, pVal->node.resType.precision, false)) { if (pVal->datum.i < minDelay) { return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY, "stream max delay must be bigger than 5 session"); @@ -10907,7 +10896,7 @@ static int32_t adjustDataTypeOfProjections(STranslateContext* pCxt, const STable REPLACE_NODE(pFunc); } SColumnDefNode* pColDef = NULL; - int32_t code = nodesMakeNode(QUERY_NODE_COLUMN_DEF, (SNode**)&pColDef); + int32_t code = nodesMakeNode(QUERY_NODE_COLUMN_DEF, (SNode**)&pColDef); if (TSDB_CODE_SUCCESS != code) return code; strcpy(pColDef->colName, pSchema->name); pColDef->dataType = dt; @@ -10942,7 +10931,7 @@ static int32_t projColPosCompar(const void* l, const void* r) { static void projColPosDelete(void* p) { nodesDestroyNode(((SProjColPos*)p)->pProj); } static int32_t addProjToProjColPos(STranslateContext* pCxt, const SSchema* pSchema, SNode* pProj, SArray* pProjColPos) { - SNode* pNewProj = NULL; + SNode* pNewProj = NULL; int32_t code = nodesCloneNode(pProj, &pNewProj); if (NULL == pNewProj) { return code; @@ -11170,8 +11159,7 @@ static int32_t adjustOrderOfTags(STranslateContext* pCxt, SNodeList* pTags, cons } SNode* pNull = NULL; code = createNullValue(&pNull); - if (TSDB_CODE_SUCCESS == code) - code = nodesListStrictAppend(pNewTagExprs, pNull); + if (TSDB_CODE_SUCCESS == code) code = nodesListStrictAppend(pNewTagExprs, pNull); } } @@ -11275,7 +11263,7 @@ static int32_t translateStreamTargetTable(STranslateContext* pCxt, SCreateStream static int32_t createLastTsSelectStmt(char* pDb, const char* pTable, const char* pkColName, SNode** pQuery) { SColumnNode* col = NULL; - int32_t code = nodesMakeNode(QUERY_NODE_COLUMN, (SNode**)&col); + int32_t code = nodesMakeNode(QUERY_NODE_COLUMN, (SNode**)&col); if (NULL == col) { return code; } @@ -11623,7 +11611,7 @@ static int32_t createStreamReqVersionInfo(SSDataBlock* pBlock, SArray** pArray, for (int32_t i = 0; i < pBlock->info.rows; ++i) { SVgroupVer v = {.vgId = *(int32_t*)colDataGetData(pCol1, i), .ver = *(int64_t*)colDataGetData(pCol2, i)}; - if((taosArrayPush(*pArray, &v)) == NULL) { + if ((taosArrayPush(*pArray, &v)) == NULL) { taosArrayDestroy(*pArray); return terrno; } @@ -11678,7 +11666,7 @@ int32_t translatePostCreateStream(SParseContext* pParseCxt, SQuery* pQuery, SSDa static int32_t translateDropStream(STranslateContext* pCxt, SDropStreamStmt* pStmt) { SMDropStreamReq dropReq = {0}; SName name; - int32_t code = tNameSetDbName(&name, pCxt->pParseCxt->acctId, pStmt->streamName, strlen(pStmt->streamName)); + int32_t code = tNameSetDbName(&name, pCxt->pParseCxt->acctId, pStmt->streamName, strlen(pStmt->streamName)); if (TSDB_CODE_SUCCESS != code) return code; (void)tNameGetFullDbName(&name, dropReq.name); dropReq.igNotExists = pStmt->ignoreNotExists; @@ -11690,7 +11678,7 @@ static int32_t translateDropStream(STranslateContext* pCxt, SDropStreamStmt* pSt static int32_t translatePauseStream(STranslateContext* pCxt, SPauseStreamStmt* pStmt) { SMPauseStreamReq req = {0}; SName name; - int32_t code = tNameSetDbName(&name, pCxt->pParseCxt->acctId, pStmt->streamName, strlen(pStmt->streamName)); + int32_t code = tNameSetDbName(&name, pCxt->pParseCxt->acctId, pStmt->streamName, strlen(pStmt->streamName)); if (TSDB_CODE_SUCCESS != code) return code; (void)tNameGetFullDbName(&name, req.name); req.igNotExists = pStmt->ignoreNotExists; @@ -11700,7 +11688,7 @@ static int32_t translatePauseStream(STranslateContext* pCxt, SPauseStreamStmt* p static int32_t translateResumeStream(STranslateContext* pCxt, SResumeStreamStmt* pStmt) { SMResumeStreamReq req = {0}; SName name; - int32_t code = tNameSetDbName(&name, pCxt->pParseCxt->acctId, pStmt->streamName, strlen(pStmt->streamName)); + int32_t code = tNameSetDbName(&name, pCxt->pParseCxt->acctId, pStmt->streamName, strlen(pStmt->streamName)); if (TSDB_CODE_SUCCESS != code) return code; (void)tNameGetFullDbName(&name, req.name); req.igNotExists = pStmt->ignoreNotExists; @@ -11775,7 +11763,7 @@ static int32_t translateDropView(STranslateContext* pCxt, SDropViewStmt* pStmt) SCMDropViewReq dropReq = {0}; SName name = {0}; - int32_t code = tNameSetDbName(&name, pCxt->pParseCxt->acctId, pStmt->dbName, strlen(pStmt->dbName)); + int32_t code = tNameSetDbName(&name, pCxt->pParseCxt->acctId, pStmt->dbName, strlen(pStmt->dbName)); if (TSDB_CODE_SUCCESS == code) { (void)tNameGetFullDbName(&name, dropReq.dbFName); strncpy(dropReq.name, pStmt->viewName, sizeof(dropReq.name) - 1); @@ -11871,7 +11859,7 @@ static int32_t translateDropFunction(STranslateContext* pCxt, SDropFunctionStmt* static int32_t createRealTableForGrantTable(SGrantStmt* pStmt, SRealTableNode** pTable) { SRealTableNode* pRealTable = NULL; - int32_t code = nodesMakeNode(QUERY_NODE_REAL_TABLE, (SNode**)&pRealTable); + int32_t code = nodesMakeNode(QUERY_NODE_REAL_TABLE, (SNode**)&pRealTable); if (NULL == pRealTable) { return code; } @@ -12074,11 +12062,10 @@ static int32_t translateShowCreateDatabase(STranslateContext* pCxt, SShowCreateD return terrno; } - SName name; + SName name; int32_t code = tNameSetDbName(&name, pCxt->pParseCxt->acctId, pStmt->dbName, strlen(pStmt->dbName)); (void)tNameGetFullDbName(&name, pStmt->dbFName); - if (TSDB_CODE_SUCCESS == code) - return getDBCfg(pCxt, pStmt->dbName, (SDbCfgInfo*)pStmt->pCfg); + if (TSDB_CODE_SUCCESS == code) return getDBCfg(pCxt, pStmt->dbName, (SDbCfgInfo*)pStmt->pCfg); return code; } @@ -12108,7 +12095,7 @@ static int32_t translateShowCreateView(STranslateContext* pCxt, SShowCreateViewS static int32_t createColumnNodeWithName(const char* name, SNode** ppCol) { SColumnNode* pCol = NULL; - int32_t code = nodesMakeNode(QUERY_NODE_COLUMN, (SNode**)&pCol); + int32_t code = nodesMakeNode(QUERY_NODE_COLUMN, (SNode**)&pCol); if (!pCol) return code; tstrncpy(pCol->colName, name, TSDB_COL_NAME_LEN); tstrncpy(pCol->node.aliasName, name, TSDB_COL_NAME_LEN); @@ -12170,7 +12157,7 @@ static int32_t buildTSMAAstStreamSubTable(SCreateTSMAStmt* pStmt, SMCreateSmaReq SFunctionNode* pConcatFunc = NULL; code = nodesMakeNode(QUERY_NODE_FUNCTION, (SNode**)&pConcatFunc); if (TSDB_CODE_SUCCESS != code) goto _end; - SValueNode* pVal = NULL; + SValueNode* pVal = NULL; code = nodesMakeNode(QUERY_NODE_VALUE, (SNode**)&pVal); if (TSDB_CODE_SUCCESS != code) goto _end; @@ -12218,8 +12205,7 @@ static int32_t buildTSMAAst(STranslateContext* pCxt, SCreateTSMAStmt* pStmt, SMC info.pDbName = pStmt->dbName; info.pTableName = tbName; code = nodesCloneList(pStmt->pOptions->pFuncs, &info.pFuncs); - if (TSDB_CODE_SUCCESS == code) - code = nodesCloneNode(pStmt->pOptions->pInterval, &info.pInterval); + if (TSDB_CODE_SUCCESS == code) code = nodesCloneNode(pStmt->pOptions->pInterval, &info.pInterval); SFunctionNode* pTbnameFunc = NULL; if (TSDB_CODE_SUCCESS == code) { @@ -12244,10 +12230,9 @@ static int32_t buildTSMAAst(STranslateContext* pCxt, SCreateTSMAStmt* pStmt, SMC } code = nodesListAppend(info.pPartitionByList, pTagCol); if (TSDB_CODE_SUCCESS == code) { - SNode*pNew = NULL; + SNode* pNew = NULL; code = nodesCloneNode(pTagCol, &pNew); - if (TSDB_CODE_SUCCESS == code) - code = nodesListMakeStrictAppend(&info.pTags, pNew); + if (TSDB_CODE_SUCCESS == code) code = nodesListMakeStrictAppend(&info.pTags, pNew); } } @@ -12394,7 +12379,7 @@ static int32_t buildCreateTSMAReq(STranslateContext* pCxt, SCreateTSMAStmt* pStm pReq->interval = ((SValueNode*)pStmt->pOptions->pInterval)->datum.i; pReq->intervalUnit = ((SValueNode*)pStmt->pOptions->pInterval)->unit; -#define TSMA_MIN_INTERVAL_MS 1000 * 60 // 1m +#define TSMA_MIN_INTERVAL_MS 1000 * 60 // 1m #define TSMA_MAX_INTERVAL_MS (60UL * 60UL * 1000UL * 24UL * 365UL) // 1y if (!IS_CALENDAR_TIME_DURATION(pReq->intervalUnit)) { @@ -12405,8 +12390,7 @@ static int32_t buildCreateTSMAReq(STranslateContext* pCxt, SCreateTSMAStmt* pStm } else { if (pReq->intervalUnit == TIME_UNIT_MONTH && (pReq->interval < 1 || pReq->interval > 12)) return TSDB_CODE_TSMA_INVALID_INTERVAL; - if (pReq->intervalUnit == TIME_UNIT_YEAR && (pReq->interval != 1)) - return TSDB_CODE_TSMA_INVALID_INTERVAL; + if (pReq->intervalUnit == TIME_UNIT_YEAR && (pReq->interval != 1)) return TSDB_CODE_TSMA_INVALID_INTERVAL; } STableMeta* pTableMeta = NULL; @@ -12422,7 +12406,7 @@ static int32_t buildCreateTSMAReq(STranslateContext* pCxt, SCreateTSMAStmt* pStm if (TSDB_CODE_SUCCESS == code) { SValueNode* pInterval = (SValueNode*)pStmt->pOptions->pInterval; if (checkRecursiveTsmaInterval(pRecursiveTsma->interval, pRecursiveTsma->unit, pInterval->datum.i, - pInterval->unit, pDbInfo.precision, true)) { + pInterval->unit, pDbInfo.precision, true)) { } else { code = TSDB_CODE_TSMA_INVALID_RECURSIVE_INTERVAL; } @@ -13044,7 +13028,7 @@ int32_t extractResultSchema(const SNode* pRoot, int32_t* numOfCols, SSchema** pS static int32_t createStarCol(SNode** ppNode) { SColumnNode* pCol = NULL; - int32_t code = nodesMakeNode(QUERY_NODE_COLUMN, (SNode**)&pCol); + int32_t code = nodesMakeNode(QUERY_NODE_COLUMN, (SNode**)&pCol); if (NULL == pCol) { return code; } @@ -13055,7 +13039,7 @@ static int32_t createStarCol(SNode** ppNode) { static int32_t createProjectCol(const char* pProjCol, SNode** ppNode) { SColumnNode* pCol = NULL; - int32_t code = nodesMakeNode(QUERY_NODE_COLUMN, (SNode**)&pCol); + int32_t code = nodesMakeNode(QUERY_NODE_COLUMN, (SNode**)&pCol); if (NULL == pCol) { return code; } @@ -13098,7 +13082,7 @@ static int32_t createProjectCols(int32_t ncols, const char* const pCols[], SNode static int32_t createSimpleSelectStmtImpl(const char* pDb, const char* pTable, SNodeList* pProjectionList, SSelectStmt** pStmt) { SSelectStmt* pSelect = NULL; - int32_t code = nodesMakeNode(QUERY_NODE_SELECT_STMT, (SNode**)&pSelect); + int32_t code = nodesMakeNode(QUERY_NODE_SELECT_STMT, (SNode**)&pSelect); if (NULL == pSelect) { return code; } @@ -13153,7 +13137,7 @@ static int32_t createOperatorNode(EOperatorType opType, const char* pColName, co } SOperatorNode* pOper = NULL; - int32_t code = nodesMakeNode(QUERY_NODE_OPERATOR, (SNode**)&pOper); + int32_t code = nodesMakeNode(QUERY_NODE_OPERATOR, (SNode**)&pOper); if (NULL == pOper) { return code; } @@ -13178,7 +13162,7 @@ static int32_t createOperatorNode(EOperatorType opType, const char* pColName, co static int32_t createParOperatorNode(EOperatorType opType, const char* pLeftCol, const char* pRightCol, SNode** ppResOp) { SOperatorNode* pOper = NULL; - int32_t code = nodesMakeNode(QUERY_NODE_OPERATOR, (SNode**)&pOper); + int32_t code = nodesMakeNode(QUERY_NODE_OPERATOR, (SNode**)&pOper); if (TSDB_CODE_SUCCESS != code) return code; pOper->opType = opType; @@ -13201,7 +13185,7 @@ static int32_t createParOperatorNode(EOperatorType opType, const char* pLeftCol, static int32_t createIsOperatorNode(EOperatorType opType, const char* pColName, SNode** pOp) { SOperatorNode* pOper = NULL; - int32_t code = nodesMakeNode(QUERY_NODE_OPERATOR, (SNode**)&pOper); + int32_t code = nodesMakeNode(QUERY_NODE_OPERATOR, (SNode**)&pOper); if (NULL == pOper) { return code; } @@ -13323,7 +13307,7 @@ static int32_t addShowUserDatabasesCond(SSelectStmt* pSelect) { SNode* pNameCond1 = NULL; SNode* pNameCond2 = NULL; SNode* pNameCond = NULL; - SValueNode* pValNode1 = NULL, *pValNode2 = NULL; + SValueNode *pValNode1 = NULL, *pValNode2 = NULL; code = nodesMakeValueNodeFromString(TSDB_INFORMATION_SCHEMA_DB, &pValNode1); if (TSDB_CODE_SUCCESS == code) { @@ -13337,11 +13321,9 @@ static int32_t addShowUserDatabasesCond(SSelectStmt* pSelect) { } nodesDestroyNode((SNode*)pValNode2); nodesDestroyNode((SNode*)pValNode1); - if (TSDB_CODE_SUCCESS == code) - code = createLogicCondNode(&pNameCond1, &pNameCond2, &pNameCond, LOGIC_COND_TYPE_AND); + if (TSDB_CODE_SUCCESS == code) code = createLogicCondNode(&pNameCond1, &pNameCond2, &pNameCond, LOGIC_COND_TYPE_AND); - if (TSDB_CODE_SUCCESS == code) - code = insertCondIntoSelectStmt(pSelect, &pNameCond); + if (TSDB_CODE_SUCCESS == code) code = insertCondIntoSelectStmt(pSelect, &pNameCond); if (TSDB_CODE_SUCCESS != code) { nodesDestroyNode(pNameCond1); @@ -13355,8 +13337,8 @@ static int32_t addShowSystemDatabasesCond(SSelectStmt* pSelect) { int32_t code = TSDB_CODE_SUCCESS; SNode* pNameCond1 = NULL; SNode* pNameCond2 = NULL; - SValueNode* pValNode1 = NULL, * pValNode2 = NULL; - SNode* pNameCond = NULL; + SValueNode *pValNode1 = NULL, *pValNode2 = NULL; + SNode* pNameCond = NULL; code = nodesMakeValueNodeFromString(TSDB_INFORMATION_SCHEMA_DB, &pValNode1); if (TSDB_CODE_SUCCESS == code) { code = nodesMakeValueNodeFromString(TSDB_PERFORMANCE_SCHEMA_DB, &pValNode2); @@ -13373,8 +13355,7 @@ static int32_t addShowSystemDatabasesCond(SSelectStmt* pSelect) { code = createLogicCondNode(&pNameCond1, &pNameCond2, &pNameCond, LOGIC_COND_TYPE_OR); } - if (TSDB_CODE_SUCCESS == code) - code = insertCondIntoSelectStmt(pSelect, &pNameCond); + if (TSDB_CODE_SUCCESS == code) code = insertCondIntoSelectStmt(pSelect, &pNameCond); if (TSDB_CODE_SUCCESS != code) { nodesDestroyNode(pNameCond1); @@ -13390,8 +13371,7 @@ static int32_t addShowNormalTablesCond(SSelectStmt* pSelect) { SValueNode* pValNode1 = NULL; code = nodesMakeValueNodeFromString("NORMAL_TABLE", &pValNode1); - if (TSDB_CODE_SUCCESS == code) - code = createOperatorNode(OP_TYPE_EQUAL, "type", (SNode*)pValNode1, &pTypeCond); + if (TSDB_CODE_SUCCESS == code) code = createOperatorNode(OP_TYPE_EQUAL, "type", (SNode*)pValNode1, &pTypeCond); nodesDestroyNode((SNode*)pValNode1); @@ -13406,8 +13386,7 @@ static int32_t addShowChildTablesCond(SSelectStmt* pSelect) { SValueNode* pValNode1 = NULL; code = nodesMakeValueNodeFromString("CHILD_TABLE", &pValNode1); - if (TSDB_CODE_SUCCESS == code) - code = createOperatorNode(OP_TYPE_EQUAL, "type", (SNode*)pValNode1, &pTypeCond); + if (TSDB_CODE_SUCCESS == code) code = createOperatorNode(OP_TYPE_EQUAL, "type", (SNode*)pValNode1, &pTypeCond); nodesDestroyNode((SNode*)pValNode1); @@ -13506,7 +13485,8 @@ static int32_t checkShowTags(STranslateContext* pCxt, const SShowStmt* pShow) { int32_t code = 0; SName name = {0}; STableMeta* pTableMeta = NULL; - toName(pCxt->pParseCxt->acctId, ((SValueNode*)pShow->pDbName)->literal, ((SValueNode*)pShow->pTbName)->literal, &name); + toName(pCxt->pParseCxt->acctId, ((SValueNode*)pShow->pDbName)->literal, ((SValueNode*)pShow->pTbName)->literal, + &name); code = getTargetMeta(pCxt, &name, &pTableMeta, true); if (TSDB_CODE_SUCCESS != code) { code = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_GET_META_ERROR, tstrerror(code)); @@ -13533,7 +13513,7 @@ static int32_t rewriteShowTags(STranslateContext* pCxt, SQuery* pQuery) { static int32_t createTagsFunction(SFunctionNode** ppNode) { SFunctionNode* pFunc = NULL; - int32_t code = nodesMakeNode(QUERY_NODE_FUNCTION, (SNode**)&pFunc); + int32_t code = nodesMakeNode(QUERY_NODE_FUNCTION, (SNode**)&pFunc); if (NULL == pFunc) { return code; } @@ -13548,7 +13528,7 @@ static int32_t createShowTableTagsProjections(SNodeList** pProjections, SNodeLis return TSDB_CODE_SUCCESS; } SFunctionNode* pTbNameFunc = NULL; - int32_t code = createTbnameFunction(&pTbNameFunc); + int32_t code = createTbnameFunction(&pTbNameFunc); if (TSDB_CODE_SUCCESS == code) { code = nodesListMakeStrictAppend(pProjections, (SNode*)pTbNameFunc); } @@ -13630,7 +13610,7 @@ static int32_t rewriteShowVnodes(STranslateContext* pCxt, SQuery* pQuery) { static int32_t createBlockDistInfoFunc(SFunctionNode** ppNode) { SFunctionNode* pFunc = NULL; - int32_t code = nodesMakeNode(QUERY_NODE_FUNCTION, (SNode**)&pFunc); + int32_t code = nodesMakeNode(QUERY_NODE_FUNCTION, (SNode**)&pFunc); if (NULL == pFunc) { return code; } @@ -13643,7 +13623,7 @@ static int32_t createBlockDistInfoFunc(SFunctionNode** ppNode) { static int32_t createBlockDistFunc(SFunctionNode** ppNode) { SFunctionNode* pFunc = NULL; - int32_t code = nodesMakeNode(QUERY_NODE_FUNCTION, (SNode**)&pFunc); + int32_t code = nodesMakeNode(QUERY_NODE_FUNCTION, (SNode**)&pFunc); if (NULL == pFunc) { return code; } @@ -13670,8 +13650,7 @@ static int32_t rewriteShowTableDist(STranslateContext* pCxt, SQuery* pQuery) { NODES_DESTORY_LIST(pStmt->pProjectionList); SFunctionNode* pFuncNew = NULL; code = createBlockDistFunc(&pFuncNew); - if (TSDB_CODE_SUCCESS == code) - code = nodesListMakeStrictAppend(&pStmt->pProjectionList, (SNode*)pFuncNew); + if (TSDB_CODE_SUCCESS == code) code = nodesListMakeStrictAppend(&pStmt->pProjectionList, (SNode*)pFuncNew); } if (TSDB_CODE_SUCCESS == code) { pCxt->showRewrite = true; @@ -13725,7 +13704,7 @@ static int32_t buildNormalTableBatchReq(int32_t acctId, const SCreateTableStmt* } SNode* pCol; col_id_t index = 0; - int32_t code = tInitDefaultSColCmprWrapperByCols(&req.colCmpr, req.ntb.schemaRow.nCols); + int32_t code = tInitDefaultSColCmprWrapperByCols(&req.colCmpr, req.ntb.schemaRow.nCols); if (TSDB_CODE_SUCCESS != code) { tdDestroySVCreateTbReq(&req); return code; @@ -13823,7 +13802,7 @@ static void destroyCreateTbReqBatch(void* data) { int32_t rewriteToVnodeModifyOpStmt(SQuery* pQuery, SArray* pBufArray) { SVnodeModifyOpStmt* pNewStmt = NULL; - int32_t code = nodesMakeNode(QUERY_NODE_VNODE_MODIFY_STMT, (SNode**)&pNewStmt); + int32_t code = nodesMakeNode(QUERY_NODE_VNODE_MODIFY_STMT, (SNode**)&pNewStmt); if (pNewStmt == NULL) { return code; } @@ -13952,7 +13931,7 @@ static int32_t addCreateTbReqIntoVgroup(SHashObj* pVgroupHashmap, const char* db } static int32_t createCastFuncForTag(STranslateContext* pCxt, SNode* pNode, SDataType dt, SNode** pCast) { - SNode* pExpr = NULL; + SNode* pExpr = NULL; int32_t code = nodesCloneNode(pNode, (SNode**)&pExpr); if (NULL == pExpr) { return code; @@ -14636,7 +14615,7 @@ static int32_t rewriteCreateMultiTable(STranslateContext* pCxt, SQuery* pQuery) static int32_t rewriteCreateTableFromFile(STranslateContext* pCxt, SQuery* pQuery) { SVnodeModifyOpStmt* pModifyStmt = NULL; - int32_t code = nodesMakeNode(QUERY_NODE_VNODE_MODIFY_STMT, (SNode**)&pModifyStmt); + int32_t code = nodesMakeNode(QUERY_NODE_VNODE_MODIFY_STMT, (SNode**)&pModifyStmt); if (pModifyStmt == NULL) { return code; } @@ -15535,7 +15514,7 @@ static int32_t rewriteShowCompactDetailsStmt(STranslateContext* pCxt, SQuery* pQ static int32_t createParWhenThenNode(SNode* pWhen, SNode* pThen, SNode** ppResWhenThen) { SWhenThenNode* pWThen = NULL; - int32_t code = nodesMakeNode(QUERY_NODE_WHEN_THEN, (SNode**)&pWThen); + int32_t code = nodesMakeNode(QUERY_NODE_WHEN_THEN, (SNode**)&pWThen); if (TSDB_CODE_SUCCESS != code) return code; pWThen->pWhen = pWhen; @@ -15547,7 +15526,7 @@ static int32_t createParWhenThenNode(SNode* pWhen, SNode* pThen, SNode** ppResWh static int32_t createParCaseWhenNode(SNode* pCase, SNodeList* pWhenThenList, SNode* pElse, const char* pAias, SNode** ppResCaseWhen) { SCaseWhenNode* pCaseWhen = NULL; - int32_t code = nodesMakeNode(QUERY_NODE_CASE_WHEN, (SNode**)&pCaseWhen); + int32_t code = nodesMakeNode(QUERY_NODE_CASE_WHEN, (SNode**)&pCaseWhen); if (TSDB_CODE_SUCCESS != code) { return code; } @@ -15566,7 +15545,7 @@ static int32_t createParCaseWhenNode(SNode* pCase, SNodeList* pWhenThenList, SNo static int32_t createParFunctionNode(const char* pFunName, const char* pAias, SNodeList* pParameterList, SNode** ppResFunc) { SFunctionNode* pFunc = NULL; - int32_t code = nodesMakeNode(QUERY_NODE_FUNCTION, (SNode**)&pFunc); + int32_t code = nodesMakeNode(QUERY_NODE_FUNCTION, (SNode**)&pFunc); if (TSDB_CODE_SUCCESS != code) { return code; } @@ -15580,7 +15559,7 @@ static int32_t createParFunctionNode(const char* pFunName, const char* pAias, SN static int32_t createParListNode(SNode* pItem, SNodeList** ppResList) { SNodeList* pList = NULL; - int32_t code = nodesMakeList(&pList); + int32_t code = nodesMakeList(&pList); if (TSDB_CODE_SUCCESS != code) { return code; } @@ -15591,7 +15570,7 @@ static int32_t createParListNode(SNode* pItem, SNodeList** ppResList) { static int32_t createParTempTableNode(SSelectStmt* pSubquery, SNode** ppResTempTable) { STempTableNode* pTempTable = NULL; - int32_t code = nodesMakeNode(QUERY_NODE_TEMP_TABLE, (SNode**)&pTempTable); + int32_t code = nodesMakeNode(QUERY_NODE_TEMP_TABLE, (SNode**)&pTempTable); if (TSDB_CODE_SUCCESS != code) { return code; } @@ -15623,12 +15602,9 @@ static int32_t rewriteShowAliveStmt(STranslateContext* pCxt, SQuery* pQuery) { SNode* pCond3 = NULL; SNode* pCond4 = NULL; code = createOperatorNode(OP_TYPE_EQUAL, "v1_status", (SNode*)pValNode, &pCond1); - if (TSDB_CODE_SUCCESS == code) - code = createOperatorNode(OP_TYPE_EQUAL, "v2_status", (SNode*)pValNode, &pCond2); - if (TSDB_CODE_SUCCESS == code) - code = createOperatorNode(OP_TYPE_EQUAL, "v3_status", (SNode*)pValNode, &pCond3); - if (TSDB_CODE_SUCCESS == code) - code = createOperatorNode(OP_TYPE_EQUAL, "v4_status", (SNode*)pValNode, &pCond4); + if (TSDB_CODE_SUCCESS == code) code = createOperatorNode(OP_TYPE_EQUAL, "v2_status", (SNode*)pValNode, &pCond2); + if (TSDB_CODE_SUCCESS == code) code = createOperatorNode(OP_TYPE_EQUAL, "v3_status", (SNode*)pValNode, &pCond3); + if (TSDB_CODE_SUCCESS == code) code = createOperatorNode(OP_TYPE_EQUAL, "v4_status", (SNode*)pValNode, &pCond4); nodesDestroyNode((SNode*)pValNode); if (TSDB_CODE_SUCCESS != code) { nodesDestroyNode(pCond1); @@ -15643,10 +15619,8 @@ static int32_t rewriteShowAliveStmt(STranslateContext* pCxt, SQuery* pQuery) { SNode* pTemp2 = NULL; SNode* pFullCond = NULL; code = createLogicCondNode(&pCond1, &pCond2, &pTemp1, LOGIC_COND_TYPE_OR); - if (TSDB_CODE_SUCCESS == code) - code = createLogicCondNode(&pTemp1, &pCond3, &pTemp2, LOGIC_COND_TYPE_OR); - if (TSDB_CODE_SUCCESS == code) - code = createLogicCondNode(&pTemp2, &pCond4, &pFullCond, LOGIC_COND_TYPE_OR); + if (TSDB_CODE_SUCCESS == code) code = createLogicCondNode(&pTemp1, &pCond3, &pTemp2, LOGIC_COND_TYPE_OR); + if (TSDB_CODE_SUCCESS == code) code = createLogicCondNode(&pTemp2, &pCond4, &pFullCond, LOGIC_COND_TYPE_OR); if (TSDB_CODE_SUCCESS != code) { nodesDestroyNode(pCond1); nodesDestroyNode(pCond2); @@ -15969,8 +15943,8 @@ static int32_t rewriteShowAliveStmt(STranslateContext* pCxt, SQuery* pQuery) { } // pSubSelect, pWhenThenlist need to free - // case when leader_col = count_col and leader_col > 0 then 1 when leader_col < count_col and leader_col > 0 then 2 else - // 0 end as status + // case when leader_col = count_col and leader_col > 0 then 1 when leader_col < count_col and leader_col > 0 then 2 + // else 0 end as status pElse = NULL; code = nodesMakeValueNodeFromInt32(0, &pElse); if (TSDB_CODE_SUCCESS != code) { diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c index 5849977a3a2f..9ddf50f7aaf0 100644 --- a/source/libs/parser/src/sql.c +++ b/source/libs/parser/src/sql.c @@ -1,3 +1,5 @@ +/* This file is automatically generated by Lemon from input grammar +** source file "sql.y". */ /* ** 2000-05-29 ** @@ -22,9 +24,8 @@ ** The following is the concatenation of all %include directives from the ** input grammar file: */ -#include -#include /************ Begin %include sections from the grammar ************************/ +#line 11 "sql.y" #include #include @@ -41,12 +42,401 @@ #include "parAst.h" #define YYSTACKDEPTH 0 +#line 46 "sql.c" /**************** End of %include directives **********************************/ -/* These constants specify the various numeric values for terminal symbols -** in a format understandable to "makeheaders". This section is blank unless -** "lemon" is run with the "-m" command-line option. -***************** Begin makeheaders token definitions *************************/ -/**************** End makeheaders token definitions ***************************/ +/* These constants specify the various numeric values for terminal symbols. +***************** Begin token definitions *************************************/ +#ifndef TK_OR +#define TK_OR 1 +#define TK_AND 2 +#define TK_UNION 3 +#define TK_ALL 4 +#define TK_MINUS 5 +#define TK_EXCEPT 6 +#define TK_INTERSECT 7 +#define TK_NK_BITAND 8 +#define TK_NK_BITOR 9 +#define TK_NK_LSHIFT 10 +#define TK_NK_RSHIFT 11 +#define TK_NK_PLUS 12 +#define TK_NK_MINUS 13 +#define TK_NK_STAR 14 +#define TK_NK_SLASH 15 +#define TK_NK_REM 16 +#define TK_NK_CONCAT 17 +#define TK_CREATE 18 +#define TK_ACCOUNT 19 +#define TK_NK_ID 20 +#define TK_PASS 21 +#define TK_NK_STRING 22 +#define TK_ALTER 23 +#define TK_PPS 24 +#define TK_TSERIES 25 +#define TK_STORAGE 26 +#define TK_STREAMS 27 +#define TK_QTIME 28 +#define TK_DBS 29 +#define TK_USERS 30 +#define TK_CONNS 31 +#define TK_STATE 32 +#define TK_NK_COMMA 33 +#define TK_HOST 34 +#define TK_IS_IMPORT 35 +#define TK_NK_INTEGER 36 +#define TK_CREATEDB 37 +#define TK_USER 38 +#define TK_ENABLE 39 +#define TK_SYSINFO 40 +#define TK_ADD 41 +#define TK_DROP 42 +#define TK_GRANT 43 +#define TK_ON 44 +#define TK_TO 45 +#define TK_REVOKE 46 +#define TK_FROM 47 +#define TK_SUBSCRIBE 48 +#define TK_READ 49 +#define TK_WRITE 50 +#define TK_NK_DOT 51 +#define TK_WITH 52 +#define TK_ENCRYPT_KEY 53 +#define TK_ANODE 54 +#define TK_UPDATE 55 +#define TK_ANODES 56 +#define TK_DNODE 57 +#define TK_PORT 58 +#define TK_DNODES 59 +#define TK_RESTORE 60 +#define TK_NK_IPTOKEN 61 +#define TK_FORCE 62 +#define TK_UNSAFE 63 +#define TK_CLUSTER 64 +#define TK_LOCAL 65 +#define TK_QNODE 66 +#define TK_BNODE 67 +#define TK_SNODE 68 +#define TK_MNODE 69 +#define TK_VNODE 70 +#define TK_DATABASE 71 +#define TK_USE 72 +#define TK_FLUSH 73 +#define TK_TRIM 74 +#define TK_S3MIGRATE 75 +#define TK_COMPACT 76 +#define TK_IF 77 +#define TK_NOT 78 +#define TK_EXISTS 79 +#define TK_BUFFER 80 +#define TK_CACHEMODEL 81 +#define TK_CACHESIZE 82 +#define TK_COMP 83 +#define TK_DURATION 84 +#define TK_NK_VARIABLE 85 +#define TK_MAXROWS 86 +#define TK_MINROWS 87 +#define TK_KEEP 88 +#define TK_PAGES 89 +#define TK_PAGESIZE 90 +#define TK_TSDB_PAGESIZE 91 +#define TK_PRECISION 92 +#define TK_REPLICA 93 +#define TK_VGROUPS 94 +#define TK_SINGLE_STABLE 95 +#define TK_RETENTIONS 96 +#define TK_SCHEMALESS 97 +#define TK_WAL_LEVEL 98 +#define TK_WAL_FSYNC_PERIOD 99 +#define TK_WAL_RETENTION_PERIOD 100 +#define TK_WAL_RETENTION_SIZE 101 +#define TK_WAL_ROLL_PERIOD 102 +#define TK_WAL_SEGMENT_SIZE 103 +#define TK_STT_TRIGGER 104 +#define TK_TABLE_PREFIX 105 +#define TK_TABLE_SUFFIX 106 +#define TK_S3_CHUNKPAGES 107 +#define TK_S3_KEEPLOCAL 108 +#define TK_S3_COMPACT 109 +#define TK_KEEP_TIME_OFFSET 110 +#define TK_ENCRYPT_ALGORITHM 111 +#define TK_NK_COLON 112 +#define TK_BWLIMIT 113 +#define TK_START 114 +#define TK_TIMESTAMP 115 +#define TK_END 116 +#define TK_TABLE 117 +#define TK_NK_LP 118 +#define TK_NK_RP 119 +#define TK_USING 120 +#define TK_FILE 121 +#define TK_STABLE 122 +#define TK_COLUMN 123 +#define TK_MODIFY 124 +#define TK_RENAME 125 +#define TK_TAG 126 +#define TK_SET 127 +#define TK_NK_EQ 128 +#define TK_TAGS 129 +#define TK_BOOL 130 +#define TK_TINYINT 131 +#define TK_SMALLINT 132 +#define TK_INT 133 +#define TK_INTEGER 134 +#define TK_BIGINT 135 +#define TK_FLOAT 136 +#define TK_DOUBLE 137 +#define TK_BINARY 138 +#define TK_NCHAR 139 +#define TK_UNSIGNED 140 +#define TK_JSON 141 +#define TK_VARCHAR 142 +#define TK_MEDIUMBLOB 143 +#define TK_BLOB 144 +#define TK_VARBINARY 145 +#define TK_GEOMETRY 146 +#define TK_DECIMAL 147 +#define TK_COMMENT 148 +#define TK_MAX_DELAY 149 +#define TK_WATERMARK 150 +#define TK_ROLLUP 151 +#define TK_TTL 152 +#define TK_SMA 153 +#define TK_DELETE_MARK 154 +#define TK_FIRST 155 +#define TK_LAST 156 +#define TK_SHOW 157 +#define TK_FULL 158 +#define TK_PRIVILEGES 159 +#define TK_DATABASES 160 +#define TK_TABLES 161 +#define TK_STABLES 162 +#define TK_MNODES 163 +#define TK_QNODES 164 +#define TK_ARBGROUPS 165 +#define TK_FUNCTIONS 166 +#define TK_INDEXES 167 +#define TK_ACCOUNTS 168 +#define TK_APPS 169 +#define TK_CONNECTIONS 170 +#define TK_LICENCES 171 +#define TK_GRANTS 172 +#define TK_LOGS 173 +#define TK_MACHINES 174 +#define TK_ENCRYPTIONS 175 +#define TK_QUERIES 176 +#define TK_SCORES 177 +#define TK_TOPICS 178 +#define TK_VARIABLES 179 +#define TK_BNODES 180 +#define TK_SNODES 181 +#define TK_TRANSACTIONS 182 +#define TK_DISTRIBUTED 183 +#define TK_CONSUMERS 184 +#define TK_SUBSCRIPTIONS 185 +#define TK_VNODES 186 +#define TK_ALIVE 187 +#define TK_VIEWS 188 +#define TK_VIEW 189 +#define TK_COMPACTS 190 +#define TK_NORMAL 191 +#define TK_CHILD 192 +#define TK_LIKE 193 +#define TK_TBNAME 194 +#define TK_QTAGS 195 +#define TK_AS 196 +#define TK_SYSTEM 197 +#define TK_TSMA 198 +#define TK_INTERVAL 199 +#define TK_RECURSIVE 200 +#define TK_TSMAS 201 +#define TK_FUNCTION 202 +#define TK_INDEX 203 +#define TK_COUNT 204 +#define TK_LAST_ROW 205 +#define TK_META 206 +#define TK_ONLY 207 +#define TK_TOPIC 208 +#define TK_CONSUMER 209 +#define TK_GROUP 210 +#define TK_DESC 211 +#define TK_DESCRIBE 212 +#define TK_RESET 213 +#define TK_QUERY 214 +#define TK_CACHE 215 +#define TK_EXPLAIN 216 +#define TK_ANALYZE 217 +#define TK_VERBOSE 218 +#define TK_NK_BOOL 219 +#define TK_RATIO 220 +#define TK_NK_FLOAT 221 +#define TK_OUTPUTTYPE 222 +#define TK_AGGREGATE 223 +#define TK_BUFSIZE 224 +#define TK_LANGUAGE 225 +#define TK_REPLACE 226 +#define TK_STREAM 227 +#define TK_INTO 228 +#define TK_PAUSE 229 +#define TK_RESUME 230 +#define TK_PRIMARY 231 +#define TK_KEY 232 +#define TK_TRIGGER 233 +#define TK_AT_ONCE 234 +#define TK_WINDOW_CLOSE 235 +#define TK_IGNORE 236 +#define TK_EXPIRED 237 +#define TK_FILL_HISTORY 238 +#define TK_SUBTABLE 239 +#define TK_UNTREATED 240 +#define TK_KILL 241 +#define TK_CONNECTION 242 +#define TK_TRANSACTION 243 +#define TK_BALANCE 244 +#define TK_VGROUP 245 +#define TK_LEADER 246 +#define TK_MERGE 247 +#define TK_REDISTRIBUTE 248 +#define TK_SPLIT 249 +#define TK_DELETE 250 +#define TK_INSERT 251 +#define TK_NK_BIN 252 +#define TK_NK_HEX 253 +#define TK_NULL 254 +#define TK_NK_QUESTION 255 +#define TK_NK_ALIAS 256 +#define TK_NK_ARROW 257 +#define TK_ROWTS 258 +#define TK_QSTART 259 +#define TK_QEND 260 +#define TK_QDURATION 261 +#define TK_WSTART 262 +#define TK_WEND 263 +#define TK_WDURATION 264 +#define TK_IROWTS 265 +#define TK_ISFILLED 266 +#define TK_FLOW 267 +#define TK_FHIGH 268 +#define TK_FROWTS 269 +#define TK_CAST 270 +#define TK_POSITION 271 +#define TK_IN 272 +#define TK_FOR 273 +#define TK_NOW 274 +#define TK_TODAY 275 +#define TK_RAND 276 +#define TK_SUBSTR 277 +#define TK_SUBSTRING 278 +#define TK_BOTH 279 +#define TK_TRAILING 280 +#define TK_LEADING 281 +#define TK_TIMEZONE 282 +#define TK_CLIENT_VERSION 283 +#define TK_SERVER_VERSION 284 +#define TK_SERVER_STATUS 285 +#define TK_CURRENT_USER 286 +#define TK_PI 287 +#define TK_CASE 288 +#define TK_WHEN 289 +#define TK_THEN 290 +#define TK_ELSE 291 +#define TK_BETWEEN 292 +#define TK_IS 293 +#define TK_NK_LT 294 +#define TK_NK_GT 295 +#define TK_NK_LE 296 +#define TK_NK_GE 297 +#define TK_NK_NE 298 +#define TK_MATCH 299 +#define TK_NMATCH 300 +#define TK_CONTAINS 301 +#define TK_JOIN 302 +#define TK_INNER 303 +#define TK_LEFT 304 +#define TK_RIGHT 305 +#define TK_OUTER 306 +#define TK_SEMI 307 +#define TK_ANTI 308 +#define TK_ASOF 309 +#define TK_WINDOW 310 +#define TK_WINDOW_OFFSET 311 +#define TK_JLIMIT 312 +#define TK_SELECT 313 +#define TK_NK_HINT 314 +#define TK_DISTINCT 315 +#define TK_WHERE 316 +#define TK_PARTITION 317 +#define TK_BY 318 +#define TK_SESSION 319 +#define TK_STATE_WINDOW 320 +#define TK_EVENT_WINDOW 321 +#define TK_COUNT_WINDOW 322 +#define TK_ANOMALY_WINDOW 323 +#define TK_SLIDING 324 +#define TK_FILL 325 +#define TK_VALUE 326 +#define TK_VALUE_F 327 +#define TK_NONE 328 +#define TK_PREV 329 +#define TK_NULL_F 330 +#define TK_LINEAR 331 +#define TK_NEXT 332 +#define TK_HAVING 333 +#define TK_RANGE 334 +#define TK_EVERY 335 +#define TK_ORDER 336 +#define TK_SLIMIT 337 +#define TK_SOFFSET 338 +#define TK_LIMIT 339 +#define TK_OFFSET 340 +#define TK_ASC 341 +#define TK_NULLS 342 +#define TK_ABORT 343 +#define TK_AFTER 344 +#define TK_ATTACH 345 +#define TK_BEFORE 346 +#define TK_BEGIN 347 +#define TK_BITAND 348 +#define TK_BITNOT 349 +#define TK_BITOR 350 +#define TK_BLOCKS 351 +#define TK_CHANGE 352 +#define TK_COMMA 353 +#define TK_CONCAT 354 +#define TK_CONFLICT 355 +#define TK_COPY 356 +#define TK_DEFERRED 357 +#define TK_DELIMITERS 358 +#define TK_DETACH 359 +#define TK_DIVIDE 360 +#define TK_DOT 361 +#define TK_EACH 362 +#define TK_FAIL 363 +#define TK_GLOB 364 +#define TK_ID 365 +#define TK_IMMEDIATE 366 +#define TK_IMPORT 367 +#define TK_INITIALLY 368 +#define TK_INSTEAD 369 +#define TK_ISNULL 370 +#define TK_MODULES 371 +#define TK_NK_BITNOT 372 +#define TK_NK_SEMI 373 +#define TK_NOTNULL 374 +#define TK_OF 375 +#define TK_PLUS 376 +#define TK_PRIVILEGE 377 +#define TK_RAISE 378 +#define TK_RESTRICT 379 +#define TK_ROW 380 +#define TK_STAR 381 +#define TK_STATEMENT 382 +#define TK_STRICT 383 +#define TK_STRING 384 +#define TK_TIMES 385 +#define TK_VALUES 386 +#define TK_VARIABLE 387 +#define TK_WAL 388 +#endif +/**************** End token definitions ***************************************/ /* The next sections is a series of control #defines. ** various aspects of the generated parser. @@ -1546,7 +1936,7 @@ static const YYCODETYPE yyFallback[] = { 0, /* STT_TRIGGER => nothing */ 0, /* TABLE_PREFIX => nothing */ 0, /* TABLE_SUFFIX => nothing */ - 0, /* S3_CHUNKSIZE => nothing */ + 0, /* S3_CHUNKPAGES => nothing */ 0, /* S3_KEEPLOCAL => nothing */ 0, /* S3_COMPACT => nothing */ 0, /* KEEP_TIME_OFFSET => nothing */ @@ -1881,6 +2271,7 @@ typedef struct yyParser yyParser; #ifndef NDEBUG #include +#include static FILE *yyTraceFILE = 0; static char *yyTracePrompt = 0; #endif /* NDEBUG */ @@ -2022,7 +2413,7 @@ static const char *const yyTokenName[] = { /* 104 */ "STT_TRIGGER", /* 105 */ "TABLE_PREFIX", /* 106 */ "TABLE_SUFFIX", - /* 107 */ "S3_CHUNKSIZE", + /* 107 */ "S3_CHUNKPAGES", /* 108 */ "S3_KEEPLOCAL", /* 109 */ "S3_COMPACT", /* 110 */ "KEEP_TIME_OFFSET", @@ -2634,7 +3025,7 @@ static const char *const yyRuleName[] = { /* 136 */ "db_options ::= db_options STT_TRIGGER NK_INTEGER", /* 137 */ "db_options ::= db_options TABLE_PREFIX signed", /* 138 */ "db_options ::= db_options TABLE_SUFFIX signed", - /* 139 */ "db_options ::= db_options S3_CHUNKSIZE NK_INTEGER", + /* 139 */ "db_options ::= db_options S3_CHUNKPAGES NK_INTEGER", /* 140 */ "db_options ::= db_options S3_KEEPLOCAL NK_INTEGER", /* 141 */ "db_options ::= db_options S3_KEEPLOCAL NK_VARIABLE", /* 142 */ "db_options ::= db_options S3_COMPACT NK_INTEGER", @@ -3493,7 +3884,9 @@ static void yy_destructor( case 568: /* query_simple_or_subquery */ case 570: /* sort_specification */ { +#line 7 "sql.y" nodesDestroyNode((yypminor->yy974)); +#line 3889 "sql.c" } break; case 390: /* account_options */ @@ -3503,7 +3896,9 @@ static void yy_destructor( case 478: /* with_meta */ case 487: /* bufsize_opt */ { +#line 54 "sql.y" +#line 3901 "sql.c" } break; case 394: /* ip_range_list */ @@ -3543,14 +3938,18 @@ static void yy_destructor( case 564: /* order_by_clause_opt */ case 569: /* sort_specification_list */ { +#line 85 "sql.y" nodesDestroyList((yypminor->yy946)); +#line 3943 "sql.c" } break; case 397: /* is_import_opt */ case 398: /* is_createdb_opt */ case 400: /* sysinfo_opt */ { +#line 99 "sql.y" +#line 3952 "sql.c" } break; case 399: /* user_name */ @@ -3575,19 +3974,25 @@ static void yy_destructor( case 517: /* noarg_func */ case 535: /* alias_opt */ { +#line 1095 "sql.y" +#line 3979 "sql.c" } break; case 401: /* privileges */ case 404: /* priv_type_list */ case 405: /* priv_type */ { +#line 131 "sql.y" +#line 3988 "sql.c" } break; case 402: /* priv_level */ { +#line 148 "sql.y" +#line 3995 "sql.c" } break; case 411: /* force_opt */ @@ -3602,71 +4007,97 @@ static void yy_destructor( case 546: /* set_quantifier_opt */ case 547: /* tag_mode_opt */ { +#line 186 "sql.y" +#line 4012 "sql.c" } break; case 424: /* alter_db_option */ case 452: /* alter_table_option */ { +#line 294 "sql.y" +#line 4020 "sql.c" } break; case 438: /* type_name */ case 449: /* type_name_default_len */ { +#line 436 "sql.y" +#line 4028 "sql.c" } break; case 457: /* db_kind_opt */ case 463: /* table_kind */ { +#line 617 "sql.y" +#line 4036 "sql.c" } break; case 458: /* table_kind_db_name_cond_opt */ { +#line 582 "sql.y" +#line 4043 "sql.c" } break; case 467: /* tsma_func_list */ { +#line 636 "sql.y" nodesDestroyNode((yypminor->yy974)); +#line 4050 "sql.c" } break; case 514: /* trim_specification_type */ { +#line 1241 "sql.y" +#line 4057 "sql.c" } break; case 525: /* compare_op */ case 526: /* in_op */ { +#line 1328 "sql.y" +#line 4065 "sql.c" } break; case 538: /* join_type */ { +#line 1409 "sql.y" +#line 4072 "sql.c" } break; case 539: /* join_subtype */ { +#line 1417 "sql.y" +#line 4079 "sql.c" } break; case 560: /* fill_mode */ { +#line 1537 "sql.y" +#line 4086 "sql.c" } break; case 571: /* ordering_specification_opt */ { +#line 1622 "sql.y" +#line 4093 "sql.c" } break; case 572: /* null_ordering_opt */ { +#line 1628 "sql.y" +#line 4100 "sql.c" } break; /********* End destructor definitions *****************************************/ @@ -3833,7 +4264,7 @@ static YYACTIONTYPE yy_find_shift_action( #endif /* YYWILDCARD */ return yy_default[stateno]; }else{ - assert( i>=0 && i=0 && i<(int)(sizeof(yy_action)/sizeof(yy_action[0])) ); return yy_action[i]; } }while(1); @@ -4094,7 +4525,7 @@ static const YYCODETYPE yyRuleInfoLhs[] = { 414, /* (136) db_options ::= db_options STT_TRIGGER NK_INTEGER */ 414, /* (137) db_options ::= db_options TABLE_PREFIX signed */ 414, /* (138) db_options ::= db_options TABLE_SUFFIX signed */ - 414, /* (139) db_options ::= db_options S3_CHUNKSIZE NK_INTEGER */ + 414, /* (139) db_options ::= db_options S3_CHUNKPAGES NK_INTEGER */ 414, /* (140) db_options ::= db_options S3_KEEPLOCAL NK_INTEGER */ 414, /* (141) db_options ::= db_options S3_KEEPLOCAL NK_VARIABLE */ 414, /* (142) db_options ::= db_options S3_COMPACT NK_INTEGER */ @@ -4883,7 +5314,7 @@ static const signed char yyRuleInfoNRhs[] = { -3, /* (136) db_options ::= db_options STT_TRIGGER NK_INTEGER */ -3, /* (137) db_options ::= db_options TABLE_PREFIX signed */ -3, /* (138) db_options ::= db_options TABLE_SUFFIX signed */ - -3, /* (139) db_options ::= db_options S3_CHUNKSIZE NK_INTEGER */ + -3, /* (139) db_options ::= db_options S3_CHUNKPAGES NK_INTEGER */ -3, /* (140) db_options ::= db_options S3_KEEPLOCAL NK_INTEGER */ -3, /* (141) db_options ::= db_options S3_KEEPLOCAL NK_VARIABLE */ -3, /* (142) db_options ::= db_options S3_COMPACT NK_INTEGER */ @@ -5557,8 +5988,9 @@ static YYACTIONTYPE yy_reduce( (void)yyLookahead; (void)yyLookaheadToken; yymsp = yypParser->yytos; + assert( yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ); #ifndef NDEBUG - if( yyTraceFILE && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){ + if( yyTraceFILE ){ yysize = yyRuleInfoNRhs[yyruleno]; if( yysize ){ fprintf(yyTraceFILE, "%sReduce %d [%s]%s, pop back to state %d.\n", @@ -5618,15 +6050,21 @@ static YYACTIONTYPE yy_reduce( /********** Begin reduce actions **********************************************/ YYMINORTYPE yylhsminor; case 0: /* cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ +#line 50 "sql.y" { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } +#line 6055 "sql.c" yy_destructor(yypParser,390,&yymsp[0].minor); break; case 1: /* cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ +#line 51 "sql.y" { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } +#line 6061 "sql.c" yy_destructor(yypParser,391,&yymsp[0].minor); break; case 2: /* account_options ::= */ +#line 55 "sql.y" { } +#line 6067 "sql.c" break; case 3: /* account_options ::= account_options PPS literal */ case 4: /* account_options ::= account_options TSERIES literal */ yytestcase(yyruleno==4); @@ -5638,18 +6076,24 @@ static YYACTIONTYPE yy_reduce( 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,390,&yymsp[-2].minor); +#line 56 "sql.y" { } +#line 6081 "sql.c" yy_destructor(yypParser,392,&yymsp[0].minor); } break; case 12: /* alter_account_options ::= alter_account_option */ { yy_destructor(yypParser,393,&yymsp[0].minor); +#line 68 "sql.y" { } +#line 6089 "sql.c" } break; case 13: /* alter_account_options ::= alter_account_options alter_account_option */ { yy_destructor(yypParser,391,&yymsp[-1].minor); +#line 69 "sql.y" { } +#line 6096 "sql.c" yy_destructor(yypParser,393,&yymsp[0].minor); } break; @@ -5663,19 +6107,27 @@ static YYACTIONTYPE yy_reduce( case 21: /* alter_account_option ::= USERS literal */ yytestcase(yyruleno==21); case 22: /* alter_account_option ::= CONNS literal */ yytestcase(yyruleno==22); case 23: /* alter_account_option ::= STATE literal */ yytestcase(yyruleno==23); +#line 73 "sql.y" { } +#line 6112 "sql.c" yy_destructor(yypParser,392,&yymsp[0].minor); break; case 24: /* ip_range_list ::= NK_STRING */ +#line 86 "sql.y" { yylhsminor.yy946 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } +#line 6118 "sql.c" yymsp[0].minor.yy946 = yylhsminor.yy946; break; case 25: /* ip_range_list ::= ip_range_list NK_COMMA NK_STRING */ +#line 87 "sql.y" { yylhsminor.yy946 = addNodeToList(pCxt, yymsp[-2].minor.yy946, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } +#line 6124 "sql.c" yymsp[-2].minor.yy946 = yylhsminor.yy946; break; case 26: /* white_list ::= HOST ip_range_list */ +#line 91 "sql.y" { yymsp[-1].minor.yy946 = yymsp[0].minor.yy946; } +#line 6130 "sql.c" break; case 27: /* white_list_opt ::= */ case 212: /* specific_cols_opt ::= */ yytestcase(yyruleno==212); @@ -5686,98 +6138,150 @@ static YYACTIONTYPE yy_reduce( case 707: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==707); case 739: /* group_by_clause_opt ::= */ yytestcase(yyruleno==739); case 759: /* order_by_clause_opt ::= */ yytestcase(yyruleno==759); +#line 95 "sql.y" { yymsp[1].minor.yy946 = NULL; } +#line 6143 "sql.c" break; case 28: /* white_list_opt ::= white_list */ case 251: /* tags_def_opt ::= tags_def */ yytestcase(yyruleno==251); case 424: /* tag_def_or_ref_opt ::= tags_def */ yytestcase(yyruleno==424); case 615: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==615); +#line 96 "sql.y" { yylhsminor.yy946 = yymsp[0].minor.yy946; } +#line 6151 "sql.c" yymsp[0].minor.yy946 = yylhsminor.yy946; break; case 29: /* is_import_opt ::= */ case 31: /* is_createdb_opt ::= */ yytestcase(yyruleno==31); +#line 100 "sql.y" { yymsp[1].minor.yy815 = 0; } +#line 6158 "sql.c" break; case 30: /* is_import_opt ::= IS_IMPORT NK_INTEGER */ case 32: /* is_createdb_opt ::= CREATEDB NK_INTEGER */ yytestcase(yyruleno==32); case 42: /* sysinfo_opt ::= SYSINFO NK_INTEGER */ yytestcase(yyruleno==42); +#line 101 "sql.y" { yymsp[-1].minor.yy815 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); } +#line 6165 "sql.c" break; case 33: /* cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt is_createdb_opt is_import_opt white_list_opt */ +#line 109 "sql.y" { pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-6].minor.yy557, &yymsp[-4].minor.yy0, yymsp[-3].minor.yy815, yymsp[-1].minor.yy815, yymsp[-2].minor.yy815); pCxt->pRootNode = addCreateUserStmtWhiteList(pCxt, pCxt->pRootNode, yymsp[0].minor.yy946); } +#line 6173 "sql.c" break; case 34: /* cmd ::= ALTER USER user_name PASS NK_STRING */ +#line 113 "sql.y" { pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy557, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } +#line 6178 "sql.c" break; case 35: /* cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ +#line 114 "sql.y" { pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy557, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); } +#line 6183 "sql.c" break; case 36: /* cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ +#line 115 "sql.y" { pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy557, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); } +#line 6188 "sql.c" break; case 37: /* cmd ::= ALTER USER user_name CREATEDB NK_INTEGER */ +#line 116 "sql.y" { pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy557, TSDB_ALTER_USER_CREATEDB, &yymsp[0].minor.yy0); } +#line 6193 "sql.c" break; case 38: /* cmd ::= ALTER USER user_name ADD white_list */ +#line 117 "sql.y" { pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy557, TSDB_ALTER_USER_ADD_WHITE_LIST, yymsp[0].minor.yy946); } +#line 6198 "sql.c" break; case 39: /* cmd ::= ALTER USER user_name DROP white_list */ +#line 118 "sql.y" { pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy557, TSDB_ALTER_USER_DROP_WHITE_LIST, yymsp[0].minor.yy946); } +#line 6203 "sql.c" break; case 40: /* cmd ::= DROP USER user_name */ +#line 119 "sql.y" { pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy557); } +#line 6208 "sql.c" break; case 41: /* sysinfo_opt ::= */ +#line 123 "sql.y" { yymsp[1].minor.yy815 = 1; } +#line 6213 "sql.c" break; case 43: /* cmd ::= GRANT privileges ON priv_level with_clause_opt TO user_name */ +#line 127 "sql.y" { pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-5].minor.yy483, &yymsp[-3].minor.yy723, &yymsp[0].minor.yy557, yymsp[-2].minor.yy974); } +#line 6218 "sql.c" break; case 44: /* cmd ::= REVOKE privileges ON priv_level with_clause_opt FROM user_name */ +#line 128 "sql.y" { pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-5].minor.yy483, &yymsp[-3].minor.yy723, &yymsp[0].minor.yy557, yymsp[-2].minor.yy974); } +#line 6223 "sql.c" break; case 45: /* privileges ::= ALL */ +#line 132 "sql.y" { yymsp[0].minor.yy483 = PRIVILEGE_TYPE_ALL; } +#line 6228 "sql.c" break; case 46: /* privileges ::= priv_type_list */ case 48: /* priv_type_list ::= priv_type */ yytestcase(yyruleno==48); +#line 133 "sql.y" { yylhsminor.yy483 = yymsp[0].minor.yy483; } +#line 6234 "sql.c" yymsp[0].minor.yy483 = yylhsminor.yy483; break; case 47: /* privileges ::= SUBSCRIBE */ +#line 134 "sql.y" { yymsp[0].minor.yy483 = PRIVILEGE_TYPE_SUBSCRIBE; } +#line 6240 "sql.c" break; case 49: /* priv_type_list ::= priv_type_list NK_COMMA priv_type */ +#line 139 "sql.y" { yylhsminor.yy483 = yymsp[-2].minor.yy483 | yymsp[0].minor.yy483; } +#line 6245 "sql.c" yymsp[-2].minor.yy483 = yylhsminor.yy483; break; case 50: /* priv_type ::= READ */ +#line 143 "sql.y" { yymsp[0].minor.yy483 = PRIVILEGE_TYPE_READ; } +#line 6251 "sql.c" break; case 51: /* priv_type ::= WRITE */ +#line 144 "sql.y" { yymsp[0].minor.yy483 = PRIVILEGE_TYPE_WRITE; } +#line 6256 "sql.c" break; case 52: /* priv_type ::= ALTER */ +#line 145 "sql.y" { yymsp[0].minor.yy483 = PRIVILEGE_TYPE_ALTER; } +#line 6261 "sql.c" break; case 53: /* priv_level ::= NK_STAR NK_DOT NK_STAR */ +#line 149 "sql.y" { yylhsminor.yy723.first = yymsp[-2].minor.yy0; yylhsminor.yy723.second = yymsp[0].minor.yy0; } +#line 6266 "sql.c" yymsp[-2].minor.yy723 = yylhsminor.yy723; break; case 54: /* priv_level ::= db_name NK_DOT NK_STAR */ +#line 150 "sql.y" { yylhsminor.yy723.first = yymsp[-2].minor.yy557; yylhsminor.yy723.second = yymsp[0].minor.yy0; } +#line 6272 "sql.c" yymsp[-2].minor.yy723 = yylhsminor.yy723; break; case 55: /* priv_level ::= db_name NK_DOT table_name */ +#line 151 "sql.y" { yylhsminor.yy723.first = yymsp[-2].minor.yy557; yylhsminor.yy723.second = yymsp[0].minor.yy557; } +#line 6278 "sql.c" yymsp[-2].minor.yy723 = yylhsminor.yy723; break; case 56: /* priv_level ::= topic_name */ +#line 152 "sql.y" { yylhsminor.yy723.first = yymsp[0].minor.yy557; yylhsminor.yy723.second = nil_token; } +#line 6284 "sql.c" yymsp[0].minor.yy723 = yylhsminor.yy723; break; case 57: /* with_clause_opt ::= */ @@ -5799,62 +6303,98 @@ static YYACTIONTYPE yy_reduce( case 748: /* every_opt ::= */ yytestcase(yyruleno==748); case 761: /* slimit_clause_opt ::= */ yytestcase(yyruleno==761); case 765: /* limit_clause_opt ::= */ yytestcase(yyruleno==765); +#line 154 "sql.y" { yymsp[1].minor.yy974 = NULL; } +#line 6308 "sql.c" break; case 58: /* with_clause_opt ::= WITH search_condition */ case 656: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==656); case 683: /* join_on_clause_opt ::= ON search_condition */ yytestcase(yyruleno==683); case 706: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==706); case 744: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==744); +#line 155 "sql.y" { yymsp[-1].minor.yy974 = yymsp[0].minor.yy974; } +#line 6317 "sql.c" break; case 59: /* cmd ::= CREATE ENCRYPT_KEY NK_STRING */ +#line 158 "sql.y" { pCxt->pRootNode = createEncryptKeyStmt(pCxt, &yymsp[0].minor.yy0); } +#line 6322 "sql.c" break; case 60: /* cmd ::= CREATE ANODE NK_STRING */ +#line 161 "sql.y" { pCxt->pRootNode = createCreateAnodeStmt(pCxt, &yymsp[0].minor.yy0); } +#line 6327 "sql.c" break; case 61: /* cmd ::= UPDATE ANODE NK_INTEGER */ +#line 162 "sql.y" { pCxt->pRootNode = createUpdateAnodeStmt(pCxt, &yymsp[0].minor.yy0, false); } +#line 6332 "sql.c" break; case 62: /* cmd ::= UPDATE ALL ANODES */ +#line 163 "sql.y" { pCxt->pRootNode = createUpdateAnodeStmt(pCxt, NULL, true); } +#line 6337 "sql.c" break; case 63: /* cmd ::= DROP ANODE NK_INTEGER */ +#line 164 "sql.y" { pCxt->pRootNode = createDropAnodeStmt(pCxt, &yymsp[0].minor.yy0); } +#line 6342 "sql.c" break; case 64: /* cmd ::= CREATE DNODE dnode_endpoint */ +#line 167 "sql.y" { pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy557, NULL); } +#line 6347 "sql.c" break; case 65: /* cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ +#line 168 "sql.y" { pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy557, &yymsp[0].minor.yy0); } +#line 6352 "sql.c" break; case 66: /* cmd ::= DROP DNODE NK_INTEGER force_opt */ +#line 169 "sql.y" { pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy569, false); } +#line 6357 "sql.c" break; case 67: /* cmd ::= DROP DNODE dnode_endpoint force_opt */ +#line 170 "sql.y" { pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy557, yymsp[0].minor.yy569, false); } +#line 6362 "sql.c" break; case 68: /* cmd ::= DROP DNODE NK_INTEGER unsafe_opt */ +#line 171 "sql.y" { pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, false, yymsp[0].minor.yy569); } +#line 6367 "sql.c" break; case 69: /* cmd ::= DROP DNODE dnode_endpoint unsafe_opt */ +#line 172 "sql.y" { pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy557, false, yymsp[0].minor.yy569); } +#line 6372 "sql.c" break; case 70: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ +#line 173 "sql.y" { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, NULL); } +#line 6377 "sql.c" break; case 71: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ +#line 174 "sql.y" { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-2].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } +#line 6382 "sql.c" break; case 72: /* cmd ::= ALTER ALL DNODES NK_STRING */ +#line 175 "sql.y" { pCxt->pRootNode = createAlterDnodeStmt(pCxt, NULL, &yymsp[0].minor.yy0, NULL); } +#line 6387 "sql.c" break; case 73: /* cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ +#line 176 "sql.y" { pCxt->pRootNode = createAlterDnodeStmt(pCxt, NULL, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } +#line 6392 "sql.c" break; case 74: /* cmd ::= RESTORE DNODE NK_INTEGER */ +#line 177 "sql.y" { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_DNODE_STMT, &yymsp[0].minor.yy0); } +#line 6397 "sql.c" break; case 75: /* dnode_endpoint ::= NK_STRING */ case 76: /* dnode_endpoint ::= NK_ID */ yytestcase(yyruleno==76); @@ -5893,7 +6433,9 @@ static YYACTIONTYPE yy_reduce( case 611: /* star_func ::= FIRST */ yytestcase(yyruleno==611); case 612: /* star_func ::= LAST */ yytestcase(yyruleno==612); case 613: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==613); +#line 181 "sql.y" { yylhsminor.yy557 = yymsp[0].minor.yy0; } +#line 6438 "sql.c" yymsp[0].minor.yy557 = yylhsminor.yy557; break; case 78: /* force_opt ::= */ @@ -5906,7 +6448,9 @@ static YYACTIONTYPE yy_reduce( case 437: /* ignore_opt ::= */ yytestcase(yyruleno==437); case 693: /* tag_mode_opt ::= */ yytestcase(yyruleno==693); case 695: /* set_quantifier_opt ::= */ yytestcase(yyruleno==695); +#line 187 "sql.y" { yymsp[1].minor.yy569 = false; } +#line 6453 "sql.c" break; case 79: /* force_opt ::= FORCE */ case 80: /* unsafe_opt ::= UNSAFE */ yytestcase(yyruleno==80); @@ -5915,318 +6459,486 @@ static YYACTIONTYPE yy_reduce( case 401: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==401); case 694: /* tag_mode_opt ::= TAGS */ yytestcase(yyruleno==694); case 696: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==696); +#line 188 "sql.y" { yymsp[0].minor.yy569 = true; } +#line 6464 "sql.c" break; case 81: /* cmd ::= ALTER CLUSTER NK_STRING */ +#line 195 "sql.y" { pCxt->pRootNode = createAlterClusterStmt(pCxt, &yymsp[0].minor.yy0, NULL); } +#line 6469 "sql.c" break; case 82: /* cmd ::= ALTER CLUSTER NK_STRING NK_STRING */ +#line 196 "sql.y" { pCxt->pRootNode = createAlterClusterStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } +#line 6474 "sql.c" break; case 83: /* cmd ::= ALTER LOCAL NK_STRING */ +#line 199 "sql.y" { pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[0].minor.yy0, NULL); } +#line 6479 "sql.c" break; case 84: /* cmd ::= ALTER LOCAL NK_STRING NK_STRING */ +#line 200 "sql.y" { pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } +#line 6484 "sql.c" break; case 85: /* cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ +#line 203 "sql.y" { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_QNODE_STMT, &yymsp[0].minor.yy0); } +#line 6489 "sql.c" break; case 86: /* cmd ::= DROP QNODE ON DNODE NK_INTEGER */ +#line 204 "sql.y" { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_QNODE_STMT, &yymsp[0].minor.yy0); } +#line 6494 "sql.c" break; case 87: /* cmd ::= RESTORE QNODE ON DNODE NK_INTEGER */ +#line 205 "sql.y" { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_QNODE_STMT, &yymsp[0].minor.yy0); } +#line 6499 "sql.c" break; case 88: /* cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ +#line 208 "sql.y" { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_BNODE_STMT, &yymsp[0].minor.yy0); } +#line 6504 "sql.c" break; case 89: /* cmd ::= DROP BNODE ON DNODE NK_INTEGER */ +#line 209 "sql.y" { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_BNODE_STMT, &yymsp[0].minor.yy0); } +#line 6509 "sql.c" break; case 90: /* cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ +#line 212 "sql.y" { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_SNODE_STMT, &yymsp[0].minor.yy0); } +#line 6514 "sql.c" break; case 91: /* cmd ::= DROP SNODE ON DNODE NK_INTEGER */ +#line 213 "sql.y" { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_SNODE_STMT, &yymsp[0].minor.yy0); } +#line 6519 "sql.c" break; case 92: /* cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ +#line 216 "sql.y" { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_MNODE_STMT, &yymsp[0].minor.yy0); } +#line 6524 "sql.c" break; case 93: /* cmd ::= DROP MNODE ON DNODE NK_INTEGER */ +#line 217 "sql.y" { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_MNODE_STMT, &yymsp[0].minor.yy0); } +#line 6529 "sql.c" break; case 94: /* cmd ::= RESTORE MNODE ON DNODE NK_INTEGER */ +#line 218 "sql.y" { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_MNODE_STMT, &yymsp[0].minor.yy0); } +#line 6534 "sql.c" break; case 95: /* cmd ::= RESTORE VNODE ON DNODE NK_INTEGER */ +#line 221 "sql.y" { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_VNODE_STMT, &yymsp[0].minor.yy0); } +#line 6539 "sql.c" break; case 96: /* cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ +#line 224 "sql.y" { pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy569, &yymsp[-1].minor.yy557, yymsp[0].minor.yy974); } +#line 6544 "sql.c" break; case 97: /* cmd ::= DROP DATABASE exists_opt db_name */ +#line 225 "sql.y" { pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy569, &yymsp[0].minor.yy557); } +#line 6549 "sql.c" break; case 98: /* cmd ::= USE db_name */ +#line 226 "sql.y" { pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy557); } +#line 6554 "sql.c" break; case 99: /* cmd ::= ALTER DATABASE db_name alter_db_options */ +#line 227 "sql.y" { pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy557, yymsp[0].minor.yy974); } +#line 6559 "sql.c" break; case 100: /* cmd ::= FLUSH DATABASE db_name */ +#line 228 "sql.y" { pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy557); } +#line 6564 "sql.c" break; case 101: /* cmd ::= TRIM DATABASE db_name speed_opt */ +#line 229 "sql.y" { pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy557, yymsp[0].minor.yy904); } +#line 6569 "sql.c" break; case 102: /* cmd ::= S3MIGRATE DATABASE db_name */ +#line 230 "sql.y" { pCxt->pRootNode = createS3MigrateDatabaseStmt(pCxt, &yymsp[0].minor.yy557); } +#line 6574 "sql.c" break; case 103: /* cmd ::= COMPACT DATABASE db_name start_opt end_opt */ +#line 231 "sql.y" { pCxt->pRootNode = createCompactStmt(pCxt, &yymsp[-2].minor.yy557, yymsp[-1].minor.yy974, yymsp[0].minor.yy974); } +#line 6579 "sql.c" break; case 104: /* not_exists_opt ::= IF NOT EXISTS */ +#line 235 "sql.y" { yymsp[-2].minor.yy569 = true; } +#line 6584 "sql.c" break; case 106: /* exists_opt ::= IF EXISTS */ case 407: /* or_replace_opt ::= OR REPLACE */ yytestcase(yyruleno==407); case 438: /* ignore_opt ::= IGNORE UNTREATED */ yytestcase(yyruleno==438); +#line 240 "sql.y" { yymsp[-1].minor.yy569 = true; } +#line 6591 "sql.c" break; case 108: /* db_options ::= */ +#line 243 "sql.y" { yymsp[1].minor.yy974 = createDefaultDatabaseOptions(pCxt); } +#line 6596 "sql.c" break; case 109: /* db_options ::= db_options BUFFER NK_INTEGER */ +#line 244 "sql.y" { yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } +#line 6601 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 110: /* db_options ::= db_options CACHEMODEL NK_STRING */ +#line 245 "sql.y" { yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); } +#line 6607 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 111: /* db_options ::= db_options CACHESIZE NK_INTEGER */ +#line 246 "sql.y" { yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); } +#line 6613 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 112: /* db_options ::= db_options COMP NK_INTEGER */ +#line 247 "sql.y" { yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_COMP, &yymsp[0].minor.yy0); } +#line 6619 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 113: /* db_options ::= db_options DURATION NK_INTEGER */ case 114: /* db_options ::= db_options DURATION NK_VARIABLE */ yytestcase(yyruleno==114); +#line 248 "sql.y" { yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } +#line 6626 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 115: /* db_options ::= db_options MAXROWS NK_INTEGER */ +#line 250 "sql.y" { yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } +#line 6632 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 116: /* db_options ::= db_options MINROWS NK_INTEGER */ +#line 251 "sql.y" { yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } +#line 6638 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 117: /* db_options ::= db_options KEEP integer_list */ case 118: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==118); +#line 252 "sql.y" { yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_KEEP, yymsp[0].minor.yy946); } +#line 6645 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 119: /* db_options ::= db_options PAGES NK_INTEGER */ +#line 254 "sql.y" { yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } +#line 6651 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 120: /* db_options ::= db_options PAGESIZE NK_INTEGER */ +#line 255 "sql.y" { yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } +#line 6657 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 121: /* db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ +#line 256 "sql.y" { yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); } +#line 6663 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 122: /* db_options ::= db_options PRECISION NK_STRING */ +#line 257 "sql.y" { yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } +#line 6669 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 123: /* db_options ::= db_options REPLICA NK_INTEGER */ +#line 258 "sql.y" { yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } +#line 6675 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 124: /* db_options ::= db_options VGROUPS NK_INTEGER */ +#line 260 "sql.y" { yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } +#line 6681 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 125: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */ +#line 261 "sql.y" { yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } +#line 6687 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 126: /* db_options ::= db_options RETENTIONS retention_list */ +#line 262 "sql.y" { yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_RETENTIONS, yymsp[0].minor.yy946); } +#line 6693 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 127: /* db_options ::= db_options SCHEMALESS NK_INTEGER */ +#line 263 "sql.y" { yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } +#line 6699 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 128: /* db_options ::= db_options WAL_LEVEL NK_INTEGER */ +#line 264 "sql.y" { yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_WAL, &yymsp[0].minor.yy0); } +#line 6705 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 129: /* db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ +#line 265 "sql.y" { yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } +#line 6711 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 130: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ +#line 266 "sql.y" { yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); } +#line 6717 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 131: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ +#line 267 "sql.y" { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-3].minor.yy974, DB_OPTION_WAL_RETENTION_PERIOD, &t); } +#line 6727 "sql.c" yymsp[-3].minor.yy974 = yylhsminor.yy974; break; case 132: /* db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ +#line 272 "sql.y" { yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); } +#line 6733 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 133: /* db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ +#line 273 "sql.y" { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-3].minor.yy974, DB_OPTION_WAL_RETENTION_SIZE, &t); } +#line 6743 "sql.c" yymsp[-3].minor.yy974 = yylhsminor.yy974; break; case 134: /* db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ +#line 278 "sql.y" { yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); } +#line 6749 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 135: /* db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ +#line 279 "sql.y" { yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); } +#line 6755 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 136: /* db_options ::= db_options STT_TRIGGER NK_INTEGER */ +#line 280 "sql.y" { yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); } +#line 6761 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 137: /* db_options ::= db_options TABLE_PREFIX signed */ +#line 281 "sql.y" { yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_TABLE_PREFIX, yymsp[0].minor.yy974); } +#line 6767 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 138: /* db_options ::= db_options TABLE_SUFFIX signed */ +#line 282 "sql.y" { yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_TABLE_SUFFIX, yymsp[0].minor.yy974); } +#line 6773 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; - case 139: /* db_options ::= db_options S3_CHUNKSIZE NK_INTEGER */ -{ yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_S3_CHUNKSIZE, &yymsp[0].minor.yy0); } + case 139: /* db_options ::= db_options S3_CHUNKPAGES NK_INTEGER */ +#line 283 "sql.y" +{ yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_S3_CHUNKPAGES, &yymsp[0].minor.yy0); } +#line 6779 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 140: /* db_options ::= db_options S3_KEEPLOCAL NK_INTEGER */ case 141: /* db_options ::= db_options S3_KEEPLOCAL NK_VARIABLE */ yytestcase(yyruleno==141); +#line 284 "sql.y" { yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_S3_KEEPLOCAL, &yymsp[0].minor.yy0); } +#line 6786 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 142: /* db_options ::= db_options S3_COMPACT NK_INTEGER */ +#line 286 "sql.y" { yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_S3_COMPACT, &yymsp[0].minor.yy0); } +#line 6792 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 143: /* db_options ::= db_options KEEP_TIME_OFFSET NK_INTEGER */ +#line 287 "sql.y" { yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_KEEP_TIME_OFFSET, &yymsp[0].minor.yy0); } +#line 6798 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 144: /* db_options ::= db_options ENCRYPT_ALGORITHM NK_STRING */ +#line 288 "sql.y" { yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_ENCRYPT_ALGORITHM, &yymsp[0].minor.yy0); } +#line 6804 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 145: /* alter_db_options ::= alter_db_option */ +#line 290 "sql.y" { yylhsminor.yy974 = createAlterDatabaseOptions(pCxt); yylhsminor.yy974 = setAlterDatabaseOption(pCxt, yylhsminor.yy974, &yymsp[0].minor.yy683); } +#line 6810 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; case 146: /* alter_db_options ::= alter_db_options alter_db_option */ +#line 291 "sql.y" { yylhsminor.yy974 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy974, &yymsp[0].minor.yy683); } +#line 6816 "sql.c" yymsp[-1].minor.yy974 = yylhsminor.yy974; break; case 147: /* alter_db_option ::= BUFFER NK_INTEGER */ +#line 295 "sql.y" { yymsp[-1].minor.yy683.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; } +#line 6822 "sql.c" break; case 148: /* alter_db_option ::= CACHEMODEL NK_STRING */ +#line 296 "sql.y" { yymsp[-1].minor.yy683.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; } +#line 6827 "sql.c" break; case 149: /* alter_db_option ::= CACHESIZE NK_INTEGER */ +#line 297 "sql.y" { yymsp[-1].minor.yy683.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; } +#line 6832 "sql.c" break; case 150: /* alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ +#line 298 "sql.y" { yymsp[-1].minor.yy683.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; } +#line 6837 "sql.c" break; case 151: /* alter_db_option ::= KEEP integer_list */ case 152: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==152); +#line 299 "sql.y" { yymsp[-1].minor.yy683.type = DB_OPTION_KEEP; yymsp[-1].minor.yy683.pList = yymsp[0].minor.yy946; } +#line 6843 "sql.c" break; case 153: /* alter_db_option ::= PAGES NK_INTEGER */ +#line 301 "sql.y" { yymsp[-1].minor.yy683.type = DB_OPTION_PAGES; yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; } +#line 6848 "sql.c" break; case 154: /* alter_db_option ::= REPLICA NK_INTEGER */ +#line 302 "sql.y" { yymsp[-1].minor.yy683.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; } +#line 6853 "sql.c" break; case 155: /* alter_db_option ::= WAL_LEVEL NK_INTEGER */ +#line 304 "sql.y" { yymsp[-1].minor.yy683.type = DB_OPTION_WAL; yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; } +#line 6858 "sql.c" break; case 156: /* alter_db_option ::= STT_TRIGGER NK_INTEGER */ +#line 305 "sql.y" { yymsp[-1].minor.yy683.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; } +#line 6863 "sql.c" break; case 157: /* alter_db_option ::= MINROWS NK_INTEGER */ +#line 306 "sql.y" { yymsp[-1].minor.yy683.type = DB_OPTION_MINROWS; yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; } +#line 6868 "sql.c" break; case 158: /* alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */ +#line 307 "sql.y" { yymsp[-1].minor.yy683.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; } +#line 6873 "sql.c" break; case 159: /* alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ +#line 308 "sql.y" { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; yymsp[-2].minor.yy683.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-2].minor.yy683.val = t; } +#line 6882 "sql.c" break; case 160: /* alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */ +#line 313 "sql.y" { yymsp[-1].minor.yy683.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; } +#line 6887 "sql.c" break; case 161: /* alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ +#line 314 "sql.y" { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; yymsp[-2].minor.yy683.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-2].minor.yy683.val = t; } +#line 6896 "sql.c" break; case 162: /* alter_db_option ::= S3_KEEPLOCAL NK_INTEGER */ case 163: /* alter_db_option ::= S3_KEEPLOCAL NK_VARIABLE */ yytestcase(yyruleno==163); +#line 319 "sql.y" { yymsp[-1].minor.yy683.type = DB_OPTION_S3_KEEPLOCAL; yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; } +#line 6902 "sql.c" break; case 164: /* alter_db_option ::= S3_COMPACT NK_INTEGER */ +#line 321 "sql.y" { yymsp[-1].minor.yy683.type = DB_OPTION_S3_COMPACT, yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; } +#line 6907 "sql.c" break; case 165: /* alter_db_option ::= KEEP_TIME_OFFSET NK_INTEGER */ +#line 322 "sql.y" { yymsp[-1].minor.yy683.type = DB_OPTION_KEEP_TIME_OFFSET; yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; } +#line 6912 "sql.c" break; case 166: /* alter_db_option ::= ENCRYPT_ALGORITHM NK_STRING */ +#line 323 "sql.y" { yymsp[-1].minor.yy683.type = DB_OPTION_ENCRYPT_ALGORITHM; yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; } +#line 6917 "sql.c" break; case 167: /* integer_list ::= NK_INTEGER */ +#line 327 "sql.y" { yylhsminor.yy946 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } +#line 6922 "sql.c" yymsp[0].minor.yy946 = yylhsminor.yy946; break; case 168: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */ case 452: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==452); +#line 328 "sql.y" { yylhsminor.yy946 = addNodeToList(pCxt, yymsp[-2].minor.yy946, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } +#line 6929 "sql.c" yymsp[-2].minor.yy946 = yylhsminor.yy946; break; case 169: /* variable_list ::= NK_VARIABLE */ +#line 332 "sql.y" { yylhsminor.yy946 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } +#line 6935 "sql.c" yymsp[0].minor.yy946 = yylhsminor.yy946; break; case 170: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */ +#line 333 "sql.y" { yylhsminor.yy946 = addNodeToList(pCxt, yymsp[-2].minor.yy946, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } +#line 6941 "sql.c" yymsp[-2].minor.yy946 = yylhsminor.yy946; break; case 171: /* retention_list ::= retention */ @@ -6246,7 +6958,9 @@ static YYACTIONTYPE yy_reduce( case 698: /* select_list ::= select_item */ yytestcase(yyruleno==698); case 709: /* partition_list ::= partition_item */ yytestcase(yyruleno==709); case 772: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==772); +#line 337 "sql.y" { yylhsminor.yy946 = createNodeList(pCxt, yymsp[0].minor.yy974); } +#line 6963 "sql.c" yymsp[0].minor.yy946 = yylhsminor.yy946; break; case 172: /* retention_list ::= retention_list NK_COMMA retention */ @@ -6264,762 +6978,1198 @@ static YYACTIONTYPE yy_reduce( case 699: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==699); case 710: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==710); case 773: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==773); +#line 338 "sql.y" { yylhsminor.yy946 = addNodeToList(pCxt, yymsp[-2].minor.yy946, yymsp[0].minor.yy974); } +#line 6983 "sql.c" yymsp[-2].minor.yy946 = yylhsminor.yy946; break; case 173: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ case 174: /* retention ::= NK_MINUS NK_COLON NK_VARIABLE */ yytestcase(yyruleno==174); +#line 340 "sql.y" { yylhsminor.yy974 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } +#line 6990 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 175: /* speed_opt ::= */ case 402: /* bufsize_opt ::= */ yytestcase(yyruleno==402); +#line 345 "sql.y" { yymsp[1].minor.yy904 = 0; } +#line 6997 "sql.c" break; case 176: /* speed_opt ::= BWLIMIT NK_INTEGER */ case 403: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==403); +#line 346 "sql.y" { yymsp[-1].minor.yy904 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } +#line 7003 "sql.c" break; case 178: /* start_opt ::= START WITH NK_INTEGER */ case 182: /* end_opt ::= END WITH NK_INTEGER */ yytestcase(yyruleno==182); +#line 349 "sql.y" { yymsp[-2].minor.yy974 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } +#line 7009 "sql.c" break; case 179: /* start_opt ::= START WITH NK_STRING */ case 183: /* end_opt ::= END WITH NK_STRING */ yytestcase(yyruleno==183); +#line 350 "sql.y" { yymsp[-2].minor.yy974 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } +#line 7015 "sql.c" break; case 180: /* start_opt ::= START WITH TIMESTAMP NK_STRING */ case 184: /* end_opt ::= END WITH TIMESTAMP NK_STRING */ yytestcase(yyruleno==184); +#line 351 "sql.y" { yymsp[-3].minor.yy974 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } +#line 7021 "sql.c" break; case 185: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ case 188: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==188); +#line 360 "sql.y" { pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy569, yymsp[-5].minor.yy974, yymsp[-3].minor.yy946, yymsp[-1].minor.yy946, yymsp[0].minor.yy974); } +#line 7027 "sql.c" break; case 186: /* cmd ::= CREATE TABLE multi_create_clause */ +#line 361 "sql.y" { pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy946); } +#line 7032 "sql.c" break; case 187: /* cmd ::= CREATE TABLE not_exists_opt USING full_table_name NK_LP tag_list_opt NK_RP FILE NK_STRING */ +#line 363 "sql.y" { pCxt->pRootNode = createCreateSubTableFromFileClause(pCxt, yymsp[-7].minor.yy569, yymsp[-5].minor.yy974, yymsp[-3].minor.yy946, &yymsp[0].minor.yy0); } +#line 7037 "sql.c" break; case 189: /* cmd ::= DROP TABLE with_opt multi_drop_clause */ +#line 366 "sql.y" { pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[-1].minor.yy569, yymsp[0].minor.yy946); } +#line 7042 "sql.c" break; case 190: /* cmd ::= DROP STABLE with_opt exists_opt full_table_name */ +#line 367 "sql.y" { pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-2].minor.yy569, yymsp[-1].minor.yy569, yymsp[0].minor.yy974); } +#line 7047 "sql.c" break; case 191: /* cmd ::= ALTER TABLE alter_table_clause */ case 454: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==454); case 455: /* cmd ::= insert_query */ yytestcase(yyruleno==455); +#line 369 "sql.y" { pCxt->pRootNode = yymsp[0].minor.yy974; } +#line 7054 "sql.c" break; case 192: /* cmd ::= ALTER STABLE alter_table_clause */ +#line 370 "sql.y" { pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy974); } +#line 7059 "sql.c" break; case 193: /* alter_table_clause ::= full_table_name alter_table_options */ +#line 372 "sql.y" { yylhsminor.yy974 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy974, yymsp[0].minor.yy974); } +#line 7064 "sql.c" yymsp[-1].minor.yy974 = yylhsminor.yy974; break; case 194: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name column_options */ +#line 374 "sql.y" { yylhsminor.yy974 = createAlterTableAddModifyColOptions2(pCxt, yymsp[-5].minor.yy974, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-2].minor.yy557, yymsp[-1].minor.yy424, yymsp[0].minor.yy974); } +#line 7070 "sql.c" yymsp[-5].minor.yy974 = yylhsminor.yy974; break; case 195: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ +#line 375 "sql.y" { yylhsminor.yy974 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy974, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy557); } +#line 7076 "sql.c" yymsp[-3].minor.yy974 = yylhsminor.yy974; break; case 196: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ +#line 377 "sql.y" { yylhsminor.yy974 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy974, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy557, yymsp[0].minor.yy424); } +#line 7082 "sql.c" yymsp[-4].minor.yy974 = yylhsminor.yy974; break; case 197: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name column_options */ +#line 379 "sql.y" { yylhsminor.yy974 = createAlterTableAddModifyColOptions(pCxt, yymsp[-4].minor.yy974, TSDB_ALTER_TABLE_UPDATE_COLUMN_COMPRESS, &yymsp[-1].minor.yy557, yymsp[0].minor.yy974); } +#line 7088 "sql.c" yymsp[-4].minor.yy974 = yylhsminor.yy974; break; case 198: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ +#line 381 "sql.y" { yylhsminor.yy974 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy974, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy557, &yymsp[0].minor.yy557); } +#line 7094 "sql.c" yymsp[-4].minor.yy974 = yylhsminor.yy974; break; case 199: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ +#line 383 "sql.y" { yylhsminor.yy974 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy974, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy557, yymsp[0].minor.yy424); } +#line 7100 "sql.c" yymsp[-4].minor.yy974 = yylhsminor.yy974; break; case 200: /* alter_table_clause ::= full_table_name DROP TAG column_name */ +#line 384 "sql.y" { yylhsminor.yy974 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy974, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy557); } +#line 7106 "sql.c" yymsp[-3].minor.yy974 = yylhsminor.yy974; break; case 201: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ +#line 386 "sql.y" { yylhsminor.yy974 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy974, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy557, yymsp[0].minor.yy424); } +#line 7112 "sql.c" yymsp[-4].minor.yy974 = yylhsminor.yy974; break; case 202: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ +#line 388 "sql.y" { yylhsminor.yy974 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy974, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy557, &yymsp[0].minor.yy557); } +#line 7118 "sql.c" yymsp[-4].minor.yy974 = yylhsminor.yy974; break; case 203: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ tags_literal */ +#line 390 "sql.y" { yylhsminor.yy974 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy974, &yymsp[-2].minor.yy557, yymsp[0].minor.yy974); } +#line 7124 "sql.c" yymsp[-5].minor.yy974 = yylhsminor.yy974; break; case 205: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ case 623: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==623); +#line 395 "sql.y" { yylhsminor.yy946 = addNodeToList(pCxt, yymsp[-1].minor.yy946, yymsp[0].minor.yy974); } +#line 7131 "sql.c" yymsp[-1].minor.yy946 = yylhsminor.yy946; break; case 206: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP tags_literal_list NK_RP table_options */ +#line 399 "sql.y" { yylhsminor.yy974 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy569, yymsp[-8].minor.yy974, yymsp[-6].minor.yy974, yymsp[-5].minor.yy946, yymsp[-2].minor.yy946, yymsp[0].minor.yy974); } +#line 7137 "sql.c" yymsp[-9].minor.yy974 = yylhsminor.yy974; break; case 209: /* drop_table_clause ::= exists_opt full_table_name */ +#line 406 "sql.y" { yylhsminor.yy974 = createDropTableClause(pCxt, yymsp[-1].minor.yy569, yymsp[0].minor.yy974); } +#line 7143 "sql.c" yymsp[-1].minor.yy974 = yylhsminor.yy974; break; case 213: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */ case 417: /* col_list_opt ::= NK_LP column_stream_def_list NK_RP */ yytestcase(yyruleno==417); +#line 416 "sql.y" { yymsp[-2].minor.yy946 = yymsp[-1].minor.yy946; } +#line 7150 "sql.c" break; case 214: /* full_table_name ::= table_name */ case 358: /* full_tsma_name ::= tsma_name */ yytestcase(yyruleno==358); +#line 418 "sql.y" { yylhsminor.yy974 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy557, NULL); } +#line 7156 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; case 215: /* full_table_name ::= db_name NK_DOT table_name */ case 359: /* full_tsma_name ::= db_name NK_DOT tsma_name */ yytestcase(yyruleno==359); +#line 419 "sql.y" { yylhsminor.yy974 = createRealTableNode(pCxt, &yymsp[-2].minor.yy557, &yymsp[0].minor.yy557, NULL); } +#line 7163 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 218: /* tag_def ::= column_name type_name */ +#line 425 "sql.y" { yylhsminor.yy974 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy557, yymsp[0].minor.yy424, NULL); } +#line 7169 "sql.c" yymsp[-1].minor.yy974 = yylhsminor.yy974; break; case 221: /* column_def ::= column_name type_name column_options */ +#line 433 "sql.y" { yylhsminor.yy974 = createColumnDefNode(pCxt, &yymsp[-2].minor.yy557, yymsp[-1].minor.yy424, yymsp[0].minor.yy974); } +#line 7175 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 222: /* type_name ::= BOOL */ +#line 437 "sql.y" { yymsp[0].minor.yy424 = createDataType(TSDB_DATA_TYPE_BOOL); } +#line 7181 "sql.c" break; case 223: /* type_name ::= TINYINT */ +#line 438 "sql.y" { yymsp[0].minor.yy424 = createDataType(TSDB_DATA_TYPE_TINYINT); } +#line 7186 "sql.c" break; case 224: /* type_name ::= SMALLINT */ +#line 439 "sql.y" { yymsp[0].minor.yy424 = createDataType(TSDB_DATA_TYPE_SMALLINT); } +#line 7191 "sql.c" break; case 225: /* type_name ::= INT */ case 226: /* type_name ::= INTEGER */ yytestcase(yyruleno==226); +#line 440 "sql.y" { yymsp[0].minor.yy424 = createDataType(TSDB_DATA_TYPE_INT); } +#line 7197 "sql.c" break; case 227: /* type_name ::= BIGINT */ +#line 442 "sql.y" { yymsp[0].minor.yy424 = createDataType(TSDB_DATA_TYPE_BIGINT); } +#line 7202 "sql.c" break; case 228: /* type_name ::= FLOAT */ +#line 443 "sql.y" { yymsp[0].minor.yy424 = createDataType(TSDB_DATA_TYPE_FLOAT); } +#line 7207 "sql.c" break; case 229: /* type_name ::= DOUBLE */ +#line 444 "sql.y" { yymsp[0].minor.yy424 = createDataType(TSDB_DATA_TYPE_DOUBLE); } +#line 7212 "sql.c" break; case 230: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ +#line 445 "sql.y" { yymsp[-3].minor.yy424 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } +#line 7217 "sql.c" break; case 231: /* type_name ::= TIMESTAMP */ +#line 446 "sql.y" { yymsp[0].minor.yy424 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } +#line 7222 "sql.c" break; case 232: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ +#line 447 "sql.y" { yymsp[-3].minor.yy424 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } +#line 7227 "sql.c" break; case 233: /* type_name ::= TINYINT UNSIGNED */ +#line 448 "sql.y" { yymsp[-1].minor.yy424 = createDataType(TSDB_DATA_TYPE_UTINYINT); } +#line 7232 "sql.c" break; case 234: /* type_name ::= SMALLINT UNSIGNED */ +#line 449 "sql.y" { yymsp[-1].minor.yy424 = createDataType(TSDB_DATA_TYPE_USMALLINT); } +#line 7237 "sql.c" break; case 235: /* type_name ::= INT UNSIGNED */ +#line 450 "sql.y" { yymsp[-1].minor.yy424 = createDataType(TSDB_DATA_TYPE_UINT); } +#line 7242 "sql.c" break; case 236: /* type_name ::= BIGINT UNSIGNED */ +#line 451 "sql.y" { yymsp[-1].minor.yy424 = createDataType(TSDB_DATA_TYPE_UBIGINT); } +#line 7247 "sql.c" break; case 237: /* type_name ::= JSON */ +#line 452 "sql.y" { yymsp[0].minor.yy424 = createDataType(TSDB_DATA_TYPE_JSON); } +#line 7252 "sql.c" break; case 238: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ +#line 453 "sql.y" { yymsp[-3].minor.yy424 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } +#line 7257 "sql.c" break; case 239: /* type_name ::= MEDIUMBLOB */ +#line 454 "sql.y" { yymsp[0].minor.yy424 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } +#line 7262 "sql.c" break; case 240: /* type_name ::= BLOB */ +#line 455 "sql.y" { yymsp[0].minor.yy424 = createDataType(TSDB_DATA_TYPE_BLOB); } +#line 7267 "sql.c" break; case 241: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ +#line 456 "sql.y" { yymsp[-3].minor.yy424 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } +#line 7272 "sql.c" break; case 242: /* type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ +#line 457 "sql.y" { yymsp[-3].minor.yy424 = createVarLenDataType(TSDB_DATA_TYPE_GEOMETRY, &yymsp[-1].minor.yy0); } +#line 7277 "sql.c" break; case 243: /* type_name ::= DECIMAL */ +#line 458 "sql.y" { yymsp[0].minor.yy424 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +#line 7282 "sql.c" break; case 244: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ +#line 459 "sql.y" { yymsp[-3].minor.yy424 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +#line 7287 "sql.c" break; case 245: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ +#line 460 "sql.y" { yymsp[-5].minor.yy424 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +#line 7292 "sql.c" break; case 246: /* type_name_default_len ::= BINARY */ +#line 464 "sql.y" { yymsp[0].minor.yy424 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, NULL); } +#line 7297 "sql.c" break; case 247: /* type_name_default_len ::= NCHAR */ +#line 465 "sql.y" { yymsp[0].minor.yy424 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, NULL); } +#line 7302 "sql.c" break; case 248: /* type_name_default_len ::= VARCHAR */ +#line 466 "sql.y" { yymsp[0].minor.yy424 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, NULL); } +#line 7307 "sql.c" break; case 249: /* type_name_default_len ::= VARBINARY */ +#line 467 "sql.y" { yymsp[0].minor.yy424 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, NULL); } +#line 7312 "sql.c" break; case 252: /* tags_def ::= TAGS NK_LP tag_def_list NK_RP */ case 425: /* tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP */ yytestcase(yyruleno==425); +#line 476 "sql.y" { yymsp[-3].minor.yy946 = yymsp[-1].minor.yy946; } +#line 7318 "sql.c" break; case 253: /* table_options ::= */ +#line 478 "sql.y" { yymsp[1].minor.yy974 = createDefaultTableOptions(pCxt); } +#line 7323 "sql.c" break; case 254: /* table_options ::= table_options COMMENT NK_STRING */ +#line 479 "sql.y" { yylhsminor.yy974 = setTableOption(pCxt, yymsp[-2].minor.yy974, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } +#line 7328 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 255: /* table_options ::= table_options MAX_DELAY duration_list */ +#line 480 "sql.y" { yylhsminor.yy974 = setTableOption(pCxt, yymsp[-2].minor.yy974, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy946); } +#line 7334 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 256: /* table_options ::= table_options WATERMARK duration_list */ +#line 481 "sql.y" { yylhsminor.yy974 = setTableOption(pCxt, yymsp[-2].minor.yy974, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy946); } +#line 7340 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 257: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ +#line 482 "sql.y" { yylhsminor.yy974 = setTableOption(pCxt, yymsp[-4].minor.yy974, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy946); } +#line 7346 "sql.c" yymsp[-4].minor.yy974 = yylhsminor.yy974; break; case 258: /* table_options ::= table_options TTL NK_INTEGER */ +#line 483 "sql.y" { yylhsminor.yy974 = setTableOption(pCxt, yymsp[-2].minor.yy974, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } +#line 7352 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 259: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ +#line 484 "sql.y" { yylhsminor.yy974 = setTableOption(pCxt, yymsp[-4].minor.yy974, TABLE_OPTION_SMA, yymsp[-1].minor.yy946); } +#line 7358 "sql.c" yymsp[-4].minor.yy974 = yylhsminor.yy974; break; case 260: /* table_options ::= table_options DELETE_MARK duration_list */ +#line 485 "sql.y" { yylhsminor.yy974 = setTableOption(pCxt, yymsp[-2].minor.yy974, TABLE_OPTION_DELETE_MARK, yymsp[0].minor.yy946); } +#line 7364 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 261: /* alter_table_options ::= alter_table_option */ +#line 487 "sql.y" { yylhsminor.yy974 = createAlterTableOptions(pCxt); yylhsminor.yy974 = setTableOption(pCxt, yylhsminor.yy974, yymsp[0].minor.yy683.type, &yymsp[0].minor.yy683.val); } +#line 7370 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; case 262: /* alter_table_options ::= alter_table_options alter_table_option */ +#line 488 "sql.y" { yylhsminor.yy974 = setTableOption(pCxt, yymsp[-1].minor.yy974, yymsp[0].minor.yy683.type, &yymsp[0].minor.yy683.val); } +#line 7376 "sql.c" yymsp[-1].minor.yy974 = yylhsminor.yy974; break; case 263: /* alter_table_option ::= COMMENT NK_STRING */ +#line 492 "sql.y" { yymsp[-1].minor.yy683.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; } +#line 7382 "sql.c" break; case 264: /* alter_table_option ::= TTL NK_INTEGER */ +#line 493 "sql.y" { yymsp[-1].minor.yy683.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; } +#line 7387 "sql.c" break; case 265: /* duration_list ::= duration_literal */ case 554: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==554); +#line 497 "sql.y" { yylhsminor.yy946 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy974)); } +#line 7393 "sql.c" yymsp[0].minor.yy946 = yylhsminor.yy946; break; case 266: /* duration_list ::= duration_list NK_COMMA duration_literal */ case 555: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==555); +#line 498 "sql.y" { yylhsminor.yy946 = addNodeToList(pCxt, yymsp[-2].minor.yy946, releaseRawExprNode(pCxt, yymsp[0].minor.yy974)); } +#line 7400 "sql.c" yymsp[-2].minor.yy946 = yylhsminor.yy946; break; case 269: /* rollup_func_name ::= function_name */ +#line 505 "sql.y" { yylhsminor.yy974 = createFunctionNode(pCxt, &yymsp[0].minor.yy557, NULL); } +#line 7406 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; case 270: /* rollup_func_name ::= FIRST */ case 271: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==271); case 347: /* tag_item ::= QTAGS */ yytestcase(yyruleno==347); +#line 506 "sql.y" { yylhsminor.yy974 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } +#line 7414 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; case 274: /* col_name ::= column_name */ case 348: /* tag_item ::= column_name */ yytestcase(yyruleno==348); +#line 514 "sql.y" { yylhsminor.yy974 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy557); } +#line 7421 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; case 275: /* cmd ::= SHOW DNODES */ +#line 517 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT); } +#line 7427 "sql.c" break; case 276: /* cmd ::= SHOW USERS */ +#line 518 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USERS_STMT); } +#line 7432 "sql.c" break; case 277: /* cmd ::= SHOW USERS FULL */ +#line 519 "sql.y" { pCxt->pRootNode = createShowStmtWithFull(pCxt, QUERY_NODE_SHOW_USERS_FULL_STMT); } +#line 7437 "sql.c" break; case 278: /* cmd ::= SHOW USER PRIVILEGES */ +#line 520 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USER_PRIVILEGES_STMT); } +#line 7442 "sql.c" break; case 279: /* cmd ::= SHOW db_kind_opt DATABASES */ +#line 521 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT); (void)setShowKind(pCxt, pCxt->pRootNode, yymsp[-1].minor.yy741); } +#line 7450 "sql.c" break; case 280: /* cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */ +#line 525 "sql.y" { pCxt->pRootNode = createShowTablesStmt(pCxt, yymsp[-2].minor.yy595, yymsp[0].minor.yy974, OP_TYPE_LIKE); } +#line 7457 "sql.c" break; case 281: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ +#line 528 "sql.y" { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy974, yymsp[0].minor.yy974, OP_TYPE_LIKE); } +#line 7462 "sql.c" break; case 282: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ +#line 529 "sql.y" { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy974, NULL, OP_TYPE_LIKE); } +#line 7467 "sql.c" break; case 283: /* cmd ::= SHOW MNODES */ +#line 530 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT); } +#line 7472 "sql.c" break; case 284: /* cmd ::= SHOW QNODES */ +#line 532 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QNODES_STMT); } +#line 7477 "sql.c" break; case 285: /* cmd ::= SHOW ANODES */ +#line 533 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_ANODES_STMT); } +#line 7482 "sql.c" break; case 286: /* cmd ::= SHOW ANODES FULL */ +#line 534 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_ANODES_FULL_STMT); } +#line 7487 "sql.c" break; case 287: /* cmd ::= SHOW ARBGROUPS */ +#line 535 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_ARBGROUPS_STMT); } +#line 7492 "sql.c" break; case 288: /* cmd ::= SHOW FUNCTIONS */ +#line 536 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT); } +#line 7497 "sql.c" break; case 289: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ +#line 537 "sql.y" { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy974, yymsp[-1].minor.yy974, OP_TYPE_EQUAL); } +#line 7502 "sql.c" break; case 290: /* cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ +#line 538 "sql.y" { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy557), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy557), OP_TYPE_EQUAL); } +#line 7507 "sql.c" break; case 291: /* cmd ::= SHOW STREAMS */ +#line 539 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT); } +#line 7512 "sql.c" break; case 292: /* cmd ::= SHOW ACCOUNTS */ +#line 540 "sql.y" { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } +#line 7517 "sql.c" break; case 293: /* cmd ::= SHOW APPS */ +#line 541 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_APPS_STMT); } +#line 7522 "sql.c" break; case 294: /* cmd ::= SHOW CONNECTIONS */ +#line 542 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONNECTIONS_STMT); } +#line 7527 "sql.c" break; case 295: /* cmd ::= SHOW LICENCES */ case 296: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==296); +#line 543 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LICENCES_STMT); } +#line 7533 "sql.c" break; case 297: /* cmd ::= SHOW GRANTS FULL */ +#line 545 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_GRANTS_FULL_STMT); } +#line 7538 "sql.c" break; case 298: /* cmd ::= SHOW GRANTS LOGS */ +#line 546 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_GRANTS_LOGS_STMT); } +#line 7543 "sql.c" break; case 299: /* cmd ::= SHOW CLUSTER MACHINES */ +#line 547 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_MACHINES_STMT); } +#line 7548 "sql.c" break; case 300: /* cmd ::= SHOW CREATE DATABASE db_name */ +#line 548 "sql.y" { pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy557); } +#line 7553 "sql.c" break; case 301: /* cmd ::= SHOW CREATE TABLE full_table_name */ +#line 549 "sql.y" { pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy974); } +#line 7558 "sql.c" break; case 302: /* cmd ::= SHOW CREATE STABLE full_table_name */ +#line 550 "sql.y" { pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy974); } +#line 7564 "sql.c" break; case 303: /* cmd ::= SHOW ENCRYPTIONS */ +#line 552 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_ENCRYPTIONS_STMT); } +#line 7569 "sql.c" break; case 304: /* cmd ::= SHOW QUERIES */ +#line 553 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT); } +#line 7574 "sql.c" break; case 305: /* cmd ::= SHOW SCORES */ +#line 554 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SCORES_STMT); } +#line 7579 "sql.c" break; case 306: /* cmd ::= SHOW TOPICS */ +#line 555 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TOPICS_STMT); } +#line 7584 "sql.c" break; case 307: /* cmd ::= SHOW VARIABLES */ case 308: /* cmd ::= SHOW CLUSTER VARIABLES */ yytestcase(yyruleno==308); +#line 556 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VARIABLES_STMT); } +#line 7590 "sql.c" break; case 309: /* cmd ::= SHOW LOCAL VARIABLES */ +#line 558 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT); } +#line 7595 "sql.c" break; case 310: /* cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ +#line 559 "sql.y" { pCxt->pRootNode = createShowDnodeVariablesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[-2].minor.yy0), yymsp[0].minor.yy974); } +#line 7600 "sql.c" break; case 311: /* cmd ::= SHOW BNODES */ +#line 560 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_BNODES_STMT); } +#line 7605 "sql.c" break; case 312: /* cmd ::= SHOW SNODES */ +#line 561 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SNODES_STMT); } +#line 7610 "sql.c" break; case 313: /* cmd ::= SHOW CLUSTER */ +#line 562 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_STMT); } +#line 7615 "sql.c" break; case 314: /* cmd ::= SHOW TRANSACTIONS */ +#line 563 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TRANSACTIONS_STMT); } +#line 7620 "sql.c" break; case 315: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ +#line 564 "sql.y" { pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy974); } +#line 7625 "sql.c" break; case 316: /* cmd ::= SHOW CONSUMERS */ +#line 565 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONSUMERS_STMT); } +#line 7630 "sql.c" break; case 317: /* cmd ::= SHOW SUBSCRIPTIONS */ +#line 566 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT); } +#line 7635 "sql.c" break; case 318: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ +#line 567 "sql.y" { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy974, yymsp[-1].minor.yy974, OP_TYPE_EQUAL); } +#line 7640 "sql.c" break; case 319: /* cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ +#line 568 "sql.y" { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy557), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy557), OP_TYPE_EQUAL); } +#line 7645 "sql.c" break; case 320: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ +#line 569 "sql.y" { pCxt->pRootNode = createShowTableTagsStmt(pCxt, yymsp[-1].minor.yy974, yymsp[0].minor.yy974, yymsp[-3].minor.yy946); } +#line 7650 "sql.c" break; case 321: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ +#line 570 "sql.y" { pCxt->pRootNode = createShowTableTagsStmt(pCxt, createIdentifierValueNode(pCxt, &yymsp[0].minor.yy557), createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy557), yymsp[-4].minor.yy946); } +#line 7655 "sql.c" break; case 322: /* cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ +#line 571 "sql.y" { pCxt->pRootNode = createShowVnodesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0), NULL); } +#line 7660 "sql.c" break; case 323: /* cmd ::= SHOW VNODES */ +#line 572 "sql.y" { pCxt->pRootNode = createShowVnodesStmt(pCxt, NULL, NULL); } +#line 7665 "sql.c" break; case 324: /* cmd ::= SHOW db_name_cond_opt ALIVE */ +#line 574 "sql.y" { pCxt->pRootNode = createShowAliveStmt(pCxt, yymsp[-1].minor.yy974, QUERY_NODE_SHOW_DB_ALIVE_STMT); } +#line 7670 "sql.c" break; case 325: /* cmd ::= SHOW CLUSTER ALIVE */ +#line 575 "sql.y" { pCxt->pRootNode = createShowAliveStmt(pCxt, NULL, QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT); } +#line 7675 "sql.c" break; case 326: /* cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt */ +#line 576 "sql.y" { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VIEWS_STMT, yymsp[-2].minor.yy974, yymsp[0].minor.yy974, OP_TYPE_LIKE); } +#line 7680 "sql.c" break; case 327: /* cmd ::= SHOW CREATE VIEW full_table_name */ +#line 577 "sql.y" { pCxt->pRootNode = createShowCreateViewStmt(pCxt, QUERY_NODE_SHOW_CREATE_VIEW_STMT, yymsp[0].minor.yy974); } +#line 7685 "sql.c" break; case 328: /* cmd ::= SHOW COMPACTS */ +#line 578 "sql.y" { pCxt->pRootNode = createShowCompactsStmt(pCxt, QUERY_NODE_SHOW_COMPACTS_STMT); } +#line 7690 "sql.c" break; case 329: /* cmd ::= SHOW COMPACT NK_INTEGER */ +#line 579 "sql.y" { pCxt->pRootNode = createShowCompactDetailsStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } +#line 7695 "sql.c" break; case 330: /* table_kind_db_name_cond_opt ::= */ +#line 583 "sql.y" { yymsp[1].minor.yy595.kind = SHOW_KIND_ALL; yymsp[1].minor.yy595.dbName = nil_token; } +#line 7700 "sql.c" break; case 331: /* table_kind_db_name_cond_opt ::= table_kind */ +#line 584 "sql.y" { yylhsminor.yy595.kind = yymsp[0].minor.yy741; yylhsminor.yy595.dbName = nil_token; } +#line 7705 "sql.c" yymsp[0].minor.yy595 = yylhsminor.yy595; break; case 332: /* table_kind_db_name_cond_opt ::= db_name NK_DOT */ +#line 585 "sql.y" { yylhsminor.yy595.kind = SHOW_KIND_ALL; yylhsminor.yy595.dbName = yymsp[-1].minor.yy557; } +#line 7711 "sql.c" yymsp[-1].minor.yy595 = yylhsminor.yy595; break; case 333: /* table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */ +#line 586 "sql.y" { yylhsminor.yy595.kind = yymsp[-2].minor.yy741; yylhsminor.yy595.dbName = yymsp[-1].minor.yy557; } +#line 7717 "sql.c" yymsp[-2].minor.yy595 = yylhsminor.yy595; break; case 334: /* table_kind ::= NORMAL */ +#line 590 "sql.y" { yymsp[0].minor.yy741 = SHOW_KIND_TABLES_NORMAL; } +#line 7723 "sql.c" break; case 335: /* table_kind ::= CHILD */ +#line 591 "sql.y" { yymsp[0].minor.yy741 = SHOW_KIND_TABLES_CHILD; } +#line 7728 "sql.c" break; case 336: /* db_name_cond_opt ::= */ case 341: /* from_db_opt ::= */ yytestcase(yyruleno==341); +#line 593 "sql.y" { yymsp[1].minor.yy974 = createDefaultDatabaseCondValue(pCxt); } +#line 7734 "sql.c" break; case 337: /* db_name_cond_opt ::= db_name NK_DOT */ +#line 594 "sql.y" { yylhsminor.yy974 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy557); } +#line 7739 "sql.c" yymsp[-1].minor.yy974 = yylhsminor.yy974; break; case 339: /* like_pattern_opt ::= LIKE NK_STRING */ +#line 597 "sql.y" { yymsp[-1].minor.yy974 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } +#line 7745 "sql.c" break; case 340: /* table_name_cond ::= table_name */ +#line 599 "sql.y" { yylhsminor.yy974 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy557); } +#line 7750 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; case 342: /* from_db_opt ::= FROM db_name */ +#line 602 "sql.y" { yymsp[-1].minor.yy974 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy557); } +#line 7756 "sql.c" break; case 346: /* tag_item ::= TBNAME */ +#line 610 "sql.y" { yylhsminor.yy974 = setProjectionAlias(pCxt, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL), &yymsp[0].minor.yy0); } +#line 7761 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; case 349: /* tag_item ::= column_name column_alias */ +#line 613 "sql.y" { yylhsminor.yy974 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy557), &yymsp[0].minor.yy557); } +#line 7767 "sql.c" yymsp[-1].minor.yy974 = yylhsminor.yy974; break; case 350: /* tag_item ::= column_name AS column_alias */ +#line 614 "sql.y" { yylhsminor.yy974 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-2].minor.yy557), &yymsp[0].minor.yy557); } +#line 7773 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 351: /* db_kind_opt ::= */ +#line 618 "sql.y" { yymsp[1].minor.yy741 = SHOW_KIND_ALL; } +#line 7779 "sql.c" break; case 352: /* db_kind_opt ::= USER */ +#line 619 "sql.y" { yymsp[0].minor.yy741 = SHOW_KIND_DATABASES_USER; } +#line 7784 "sql.c" break; case 353: /* db_kind_opt ::= SYSTEM */ +#line 620 "sql.y" { yymsp[0].minor.yy741 = SHOW_KIND_DATABASES_SYSTEM; } +#line 7789 "sql.c" break; case 354: /* cmd ::= CREATE TSMA not_exists_opt tsma_name ON full_table_name tsma_func_list INTERVAL NK_LP duration_literal NK_RP */ +#line 626 "sql.y" { pCxt->pRootNode = createCreateTSMAStmt(pCxt, yymsp[-8].minor.yy569, &yymsp[-7].minor.yy557, yymsp[-4].minor.yy974, yymsp[-5].minor.yy974, releaseRawExprNode(pCxt, yymsp[-1].minor.yy974)); } +#line 7794 "sql.c" break; case 355: /* cmd ::= CREATE RECURSIVE TSMA not_exists_opt tsma_name ON full_table_name INTERVAL NK_LP duration_literal NK_RP */ +#line 628 "sql.y" { pCxt->pRootNode = createCreateTSMAStmt(pCxt, yymsp[-7].minor.yy569, &yymsp[-6].minor.yy557, NULL, yymsp[-4].minor.yy974, releaseRawExprNode(pCxt, yymsp[-1].minor.yy974)); } +#line 7799 "sql.c" break; case 356: /* cmd ::= DROP TSMA exists_opt full_tsma_name */ +#line 629 "sql.y" { pCxt->pRootNode = createDropTSMAStmt(pCxt, yymsp[-1].minor.yy569, yymsp[0].minor.yy974); } +#line 7804 "sql.c" break; case 357: /* cmd ::= SHOW db_name_cond_opt TSMAS */ +#line 630 "sql.y" { pCxt->pRootNode = createShowTSMASStmt(pCxt, yymsp[-1].minor.yy974); } +#line 7809 "sql.c" break; case 360: /* tsma_func_list ::= FUNCTION NK_LP func_list NK_RP */ +#line 637 "sql.y" { yymsp[-3].minor.yy974 = createTSMAOptions(pCxt, yymsp[-1].minor.yy946); } +#line 7814 "sql.c" break; case 361: /* cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */ +#line 641 "sql.y" { pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy569, yymsp[-3].minor.yy974, yymsp[-1].minor.yy974, NULL, yymsp[0].minor.yy974); } +#line 7819 "sql.c" break; case 362: /* cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */ +#line 643 "sql.y" { pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_NORMAL, yymsp[-6].minor.yy569, yymsp[-5].minor.yy974, yymsp[-3].minor.yy974, yymsp[-1].minor.yy946, NULL); } +#line 7824 "sql.c" break; case 363: /* cmd ::= DROP INDEX exists_opt full_index_name */ +#line 644 "sql.y" { pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy569, yymsp[0].minor.yy974); } +#line 7829 "sql.c" break; case 364: /* full_index_name ::= index_name */ +#line 646 "sql.y" { yylhsminor.yy974 = createRealTableNodeForIndexName(pCxt, NULL, &yymsp[0].minor.yy557); } +#line 7834 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; case 365: /* full_index_name ::= db_name NK_DOT index_name */ +#line 647 "sql.y" { yylhsminor.yy974 = createRealTableNodeForIndexName(pCxt, &yymsp[-2].minor.yy557, &yymsp[0].minor.yy557); } +#line 7840 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 366: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ +#line 650 "sql.y" { yymsp[-9].minor.yy974 = createIndexOption(pCxt, yymsp[-7].minor.yy946, releaseRawExprNode(pCxt, yymsp[-3].minor.yy974), NULL, yymsp[-1].minor.yy974, yymsp[0].minor.yy974); } +#line 7846 "sql.c" break; case 367: /* 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 */ +#line 653 "sql.y" { yymsp[-11].minor.yy974 = createIndexOption(pCxt, yymsp[-9].minor.yy946, releaseRawExprNode(pCxt, yymsp[-5].minor.yy974), releaseRawExprNode(pCxt, yymsp[-3].minor.yy974), yymsp[-1].minor.yy974, yymsp[0].minor.yy974); } +#line 7851 "sql.c" break; case 370: /* func ::= sma_func_name NK_LP expression_list NK_RP */ +#line 660 "sql.y" { yylhsminor.yy974 = createFunctionNode(pCxt, &yymsp[-3].minor.yy557, yymsp[-1].minor.yy946); } +#line 7856 "sql.c" yymsp[-3].minor.yy974 = yylhsminor.yy974; break; case 371: /* sma_func_name ::= function_name */ case 666: /* alias_opt ::= table_alias */ yytestcase(yyruleno==666); +#line 664 "sql.y" { yylhsminor.yy557 = yymsp[0].minor.yy557; } +#line 7863 "sql.c" yymsp[0].minor.yy557 = yylhsminor.yy557; break; case 376: /* sma_stream_opt ::= */ case 426: /* stream_options ::= */ yytestcase(yyruleno==426); +#line 670 "sql.y" { yymsp[1].minor.yy974 = createStreamOptions(pCxt); } +#line 7870 "sql.c" break; case 377: /* sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ +#line 671 "sql.y" { ((SStreamOptions*)yymsp[-2].minor.yy974)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy974); yylhsminor.yy974 = yymsp[-2].minor.yy974; } +#line 7875 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 378: /* sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ +#line 672 "sql.y" { ((SStreamOptions*)yymsp[-2].minor.yy974)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy974); yylhsminor.yy974 = yymsp[-2].minor.yy974; } +#line 7881 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 379: /* sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ +#line 673 "sql.y" { ((SStreamOptions*)yymsp[-2].minor.yy974)->pDeleteMark = releaseRawExprNode(pCxt, yymsp[0].minor.yy974); yylhsminor.yy974 = yymsp[-2].minor.yy974; } +#line 7887 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 380: /* with_meta ::= AS */ +#line 678 "sql.y" { yymsp[0].minor.yy904 = 0; } +#line 7893 "sql.c" break; case 381: /* with_meta ::= WITH META AS */ +#line 679 "sql.y" { yymsp[-2].minor.yy904 = 1; } +#line 7898 "sql.c" break; case 382: /* with_meta ::= ONLY META AS */ +#line 680 "sql.y" { yymsp[-2].minor.yy904 = 2; } +#line 7903 "sql.c" break; case 383: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ +#line 682 "sql.y" { pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy569, &yymsp[-2].minor.yy557, yymsp[0].minor.yy974); } +#line 7908 "sql.c" break; case 384: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ +#line 684 "sql.y" { pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy569, &yymsp[-3].minor.yy557, &yymsp[0].minor.yy557, yymsp[-2].minor.yy904); } +#line 7913 "sql.c" break; case 385: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ +#line 686 "sql.y" { pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-5].minor.yy569, &yymsp[-4].minor.yy557, yymsp[-1].minor.yy974, yymsp[-3].minor.yy904, yymsp[0].minor.yy974); } +#line 7918 "sql.c" break; case 386: /* cmd ::= DROP TOPIC exists_opt topic_name */ +#line 688 "sql.y" { pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy569, &yymsp[0].minor.yy557); } +#line 7923 "sql.c" break; case 387: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ +#line 689 "sql.y" { pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy569, &yymsp[-2].minor.yy557, &yymsp[0].minor.yy557); } +#line 7928 "sql.c" break; case 388: /* cmd ::= DESC full_table_name */ case 389: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==389); +#line 692 "sql.y" { pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy974); } +#line 7934 "sql.c" break; case 390: /* cmd ::= RESET QUERY CACHE */ +#line 696 "sql.y" { pCxt->pRootNode = createResetQueryCacheStmt(pCxt); } +#line 7939 "sql.c" break; case 391: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ case 392: /* cmd ::= EXPLAIN analyze_opt explain_options insert_query */ yytestcase(yyruleno==392); +#line 699 "sql.y" { pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy569, yymsp[-1].minor.yy974, yymsp[0].minor.yy974); } +#line 7945 "sql.c" break; case 395: /* explain_options ::= */ +#line 707 "sql.y" { yymsp[1].minor.yy974 = createDefaultExplainOptions(pCxt); } +#line 7950 "sql.c" break; case 396: /* explain_options ::= explain_options VERBOSE NK_BOOL */ +#line 708 "sql.y" { yylhsminor.yy974 = setExplainVerbose(pCxt, yymsp[-2].minor.yy974, &yymsp[0].minor.yy0); } +#line 7955 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 397: /* explain_options ::= explain_options RATIO NK_FLOAT */ +#line 709 "sql.y" { yylhsminor.yy974 = setExplainRatio(pCxt, yymsp[-2].minor.yy974, &yymsp[0].minor.yy0); } +#line 7961 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 398: /* cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ +#line 714 "sql.y" { pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-7].minor.yy569, yymsp[-9].minor.yy569, &yymsp[-6].minor.yy557, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy424, yymsp[-1].minor.yy904, &yymsp[0].minor.yy557, yymsp[-10].minor.yy569); } +#line 7967 "sql.c" break; case 399: /* cmd ::= DROP FUNCTION exists_opt function_name */ +#line 715 "sql.y" { pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy569, &yymsp[0].minor.yy557); } +#line 7972 "sql.c" break; case 404: /* language_opt ::= */ case 449: /* on_vgroup_id ::= */ yytestcase(yyruleno==449); +#line 729 "sql.y" { yymsp[1].minor.yy557 = nil_token; } +#line 7978 "sql.c" break; case 405: /* language_opt ::= LANGUAGE NK_STRING */ case 450: /* on_vgroup_id ::= ON NK_INTEGER */ yytestcase(yyruleno==450); +#line 730 "sql.y" { yymsp[-1].minor.yy557 = yymsp[0].minor.yy0; } +#line 7984 "sql.c" break; case 408: /* cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */ +#line 739 "sql.y" { pCxt->pRootNode = createCreateViewStmt(pCxt, yymsp[-4].minor.yy569, yymsp[-2].minor.yy974, &yymsp[-1].minor.yy0, yymsp[0].minor.yy974); } +#line 7989 "sql.c" break; case 409: /* cmd ::= DROP VIEW exists_opt full_view_name */ +#line 740 "sql.y" { pCxt->pRootNode = createDropViewStmt(pCxt, yymsp[-1].minor.yy569, yymsp[0].minor.yy974); } +#line 7994 "sql.c" break; case 410: /* full_view_name ::= view_name */ +#line 742 "sql.y" { yylhsminor.yy974 = createViewNode(pCxt, NULL, &yymsp[0].minor.yy557); } +#line 7999 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; case 411: /* full_view_name ::= db_name NK_DOT view_name */ +#line 743 "sql.y" { yylhsminor.yy974 = createViewNode(pCxt, &yymsp[-2].minor.yy557, &yymsp[0].minor.yy557); } +#line 8005 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 412: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */ +#line 748 "sql.y" { pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-9].minor.yy569, &yymsp[-8].minor.yy557, yymsp[-5].minor.yy974, yymsp[-7].minor.yy974, yymsp[-3].minor.yy946, yymsp[-2].minor.yy974, yymsp[0].minor.yy974, yymsp[-4].minor.yy946); } +#line 8011 "sql.c" break; case 413: /* cmd ::= DROP STREAM exists_opt stream_name */ +#line 749 "sql.y" { pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy569, &yymsp[0].minor.yy557); } +#line 8016 "sql.c" break; case 414: /* cmd ::= PAUSE STREAM exists_opt stream_name */ +#line 750 "sql.y" { pCxt->pRootNode = createPauseStreamStmt(pCxt, yymsp[-1].minor.yy569, &yymsp[0].minor.yy557); } +#line 8021 "sql.c" break; case 415: /* cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ +#line 751 "sql.y" { pCxt->pRootNode = createResumeStreamStmt(pCxt, yymsp[-2].minor.yy569, yymsp[-1].minor.yy569, &yymsp[0].minor.yy557); } +#line 8026 "sql.c" break; case 420: /* column_stream_def ::= column_name stream_col_options */ +#line 764 "sql.y" { yylhsminor.yy974 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy557, createDataType(TSDB_DATA_TYPE_NULL), yymsp[0].minor.yy974); } +#line 8031 "sql.c" yymsp[-1].minor.yy974 = yylhsminor.yy974; break; case 421: /* stream_col_options ::= */ case 781: /* column_options ::= */ yytestcase(yyruleno==781); +#line 765 "sql.y" { yymsp[1].minor.yy974 = createDefaultColumnOptions(pCxt); } +#line 8038 "sql.c" break; case 422: /* stream_col_options ::= stream_col_options PRIMARY KEY */ case 782: /* column_options ::= column_options PRIMARY KEY */ yytestcase(yyruleno==782); +#line 766 "sql.y" { yylhsminor.yy974 = setColumnOptionsPK(pCxt, yymsp[-2].minor.yy974); } +#line 8044 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 427: /* stream_options ::= stream_options TRIGGER AT_ONCE */ case 428: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ yytestcase(yyruleno==428); +#line 776 "sql.y" { yylhsminor.yy974 = setStreamOptions(pCxt, yymsp[-2].minor.yy974, SOPT_TRIGGER_TYPE_SET, &yymsp[0].minor.yy0, NULL); } +#line 8051 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 429: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ +#line 778 "sql.y" { yylhsminor.yy974 = setStreamOptions(pCxt, yymsp[-3].minor.yy974, SOPT_TRIGGER_TYPE_SET, &yymsp[-1].minor.yy0, releaseRawExprNode(pCxt, yymsp[0].minor.yy974)); } +#line 8057 "sql.c" yymsp[-3].minor.yy974 = yylhsminor.yy974; break; case 430: /* stream_options ::= stream_options WATERMARK duration_literal */ +#line 779 "sql.y" { yylhsminor.yy974 = setStreamOptions(pCxt, yymsp[-2].minor.yy974, SOPT_WATERMARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy974)); } +#line 8063 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 431: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ +#line 780 "sql.y" { yylhsminor.yy974 = setStreamOptions(pCxt, yymsp[-3].minor.yy974, SOPT_IGNORE_EXPIRED_SET, &yymsp[0].minor.yy0, NULL); } +#line 8069 "sql.c" yymsp[-3].minor.yy974 = yylhsminor.yy974; break; case 432: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ +#line 781 "sql.y" { yylhsminor.yy974 = setStreamOptions(pCxt, yymsp[-2].minor.yy974, SOPT_FILL_HISTORY_SET, &yymsp[0].minor.yy0, NULL); } +#line 8075 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 433: /* stream_options ::= stream_options DELETE_MARK duration_literal */ +#line 782 "sql.y" { yylhsminor.yy974 = setStreamOptions(pCxt, yymsp[-2].minor.yy974, SOPT_DELETE_MARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy974)); } +#line 8081 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 434: /* stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ +#line 783 "sql.y" { yylhsminor.yy974 = setStreamOptions(pCxt, yymsp[-3].minor.yy974, SOPT_IGNORE_UPDATE_SET, &yymsp[0].minor.yy0, NULL); } +#line 8087 "sql.c" yymsp[-3].minor.yy974 = yylhsminor.yy974; break; case 436: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ case 725: /* sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ yytestcase(yyruleno==725); case 749: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==749); +#line 786 "sql.y" { yymsp[-3].minor.yy974 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy974); } +#line 8095 "sql.c" break; case 439: /* cmd ::= KILL CONNECTION NK_INTEGER */ +#line 794 "sql.y" { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); } +#line 8100 "sql.c" break; case 440: /* cmd ::= KILL QUERY NK_STRING */ +#line 795 "sql.y" { pCxt->pRootNode = createKillQueryStmt(pCxt, &yymsp[0].minor.yy0); } +#line 8105 "sql.c" break; case 441: /* cmd ::= KILL TRANSACTION NK_INTEGER */ +#line 796 "sql.y" { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_TRANSACTION_STMT, &yymsp[0].minor.yy0); } +#line 8110 "sql.c" break; case 442: /* cmd ::= KILL COMPACT NK_INTEGER */ +#line 797 "sql.y" { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_COMPACT_STMT, &yymsp[0].minor.yy0); } +#line 8115 "sql.c" break; case 443: /* cmd ::= BALANCE VGROUP */ +#line 800 "sql.y" { pCxt->pRootNode = createBalanceVgroupStmt(pCxt); } +#line 8120 "sql.c" break; case 444: /* cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ +#line 801 "sql.y" { pCxt->pRootNode = createBalanceVgroupLeaderStmt(pCxt, &yymsp[0].minor.yy557); } +#line 8125 "sql.c" break; case 445: /* cmd ::= BALANCE VGROUP LEADER DATABASE db_name */ +#line 802 "sql.y" { pCxt->pRootNode = createBalanceVgroupLeaderDBNameStmt(pCxt, &yymsp[0].minor.yy557); } +#line 8130 "sql.c" break; case 446: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ +#line 803 "sql.y" { pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } +#line 8135 "sql.c" break; case 447: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ +#line 804 "sql.y" { pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy946); } +#line 8140 "sql.c" break; case 448: /* cmd ::= SPLIT VGROUP NK_INTEGER */ +#line 805 "sql.y" { pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); } +#line 8145 "sql.c" break; case 451: /* dnode_list ::= DNODE NK_INTEGER */ +#line 814 "sql.y" { yymsp[-1].minor.yy946 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } +#line 8150 "sql.c" break; case 453: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ +#line 821 "sql.y" { pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy974, yymsp[0].minor.yy974); } +#line 8155 "sql.c" break; case 456: /* insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ +#line 830 "sql.y" { yymsp[-6].minor.yy974 = createInsertStmt(pCxt, yymsp[-4].minor.yy974, yymsp[-2].minor.yy946, yymsp[0].minor.yy974); } +#line 8160 "sql.c" break; case 457: /* insert_query ::= INSERT INTO full_table_name query_or_subquery */ +#line 831 "sql.y" { yymsp[-3].minor.yy974 = createInsertStmt(pCxt, yymsp[-1].minor.yy974, NULL, yymsp[0].minor.yy974); } +#line 8165 "sql.c" break; case 458: /* tags_literal ::= NK_INTEGER */ case 470: /* tags_literal ::= NK_BIN */ yytestcase(yyruleno==470); case 479: /* tags_literal ::= NK_HEX */ yytestcase(yyruleno==479); +#line 834 "sql.y" { yylhsminor.yy974 = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0, NULL); } +#line 8172 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; case 459: /* tags_literal ::= NK_INTEGER NK_PLUS duration_literal */ @@ -7030,12 +8180,14 @@ yymsp[0].minor.yy974); } case 481: /* tags_literal ::= NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==481); case 489: /* tags_literal ::= NK_STRING NK_PLUS duration_literal */ yytestcase(yyruleno==489); case 490: /* tags_literal ::= NK_STRING NK_MINUS duration_literal */ yytestcase(yyruleno==490); +#line 835 "sql.y" { SToken l = yymsp[-2].minor.yy0; SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974); l.n = (r.z + r.n) - l.z; yylhsminor.yy974 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, yymsp[0].minor.yy974); } +#line 8190 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 461: /* tags_literal ::= NK_PLUS NK_INTEGER */ @@ -7044,11 +8196,13 @@ yymsp[0].minor.yy974); } case 476: /* tags_literal ::= NK_MINUS NK_BIN */ yytestcase(yyruleno==476); case 482: /* tags_literal ::= NK_PLUS NK_HEX */ yytestcase(yyruleno==482); case 485: /* tags_literal ::= NK_MINUS NK_HEX */ yytestcase(yyruleno==485); +#line 847 "sql.y" { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; yylhsminor.yy974 = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &t, NULL); } +#line 8205 "sql.c" yymsp[-1].minor.yy974 = yylhsminor.yy974; break; case 462: /* tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal */ @@ -7063,71 +8217,97 @@ yymsp[0].minor.yy974); } case 484: /* tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==484); case 486: /* tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal */ yytestcase(yyruleno==486); case 487: /* tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==487); +#line 852 "sql.y" { SToken l = yymsp[-3].minor.yy0; SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974); l.n = (r.z + r.n) - l.z; yylhsminor.yy974 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, yymsp[0].minor.yy974); } +#line 8227 "sql.c" yymsp[-3].minor.yy974 = yylhsminor.yy974; break; case 467: /* tags_literal ::= NK_FLOAT */ +#line 881 "sql.y" { yylhsminor.yy974 = createRawValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0, NULL); } +#line 8233 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; case 468: /* tags_literal ::= NK_PLUS NK_FLOAT */ case 469: /* tags_literal ::= NK_MINUS NK_FLOAT */ yytestcase(yyruleno==469); +#line 882 "sql.y" { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; yylhsminor.yy974 = createRawValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t, NULL); } +#line 8244 "sql.c" yymsp[-1].minor.yy974 = yylhsminor.yy974; break; case 488: /* tags_literal ::= NK_STRING */ +#line 988 "sql.y" { yylhsminor.yy974 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0, NULL); } +#line 8250 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; case 491: /* tags_literal ::= NK_BOOL */ +#line 1001 "sql.y" { yylhsminor.yy974 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0, NULL); } +#line 8256 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; case 492: /* tags_literal ::= NULL */ +#line 1002 "sql.y" { yylhsminor.yy974 = createRawValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0, NULL); } +#line 8262 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; case 493: /* tags_literal ::= literal_func */ +#line 1004 "sql.y" { yylhsminor.yy974 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BINARY, NULL, yymsp[0].minor.yy974); } +#line 8268 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; case 494: /* tags_literal ::= literal_func NK_PLUS duration_literal */ case 495: /* tags_literal ::= literal_func NK_MINUS duration_literal */ yytestcase(yyruleno==495); +#line 1005 "sql.y" { SToken l = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy974); SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974); l.n = (r.z + r.n) - l.z; yylhsminor.yy974 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, yymsp[-2].minor.yy974, yymsp[0].minor.yy974); } +#line 8280 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 498: /* literal ::= NK_INTEGER */ +#line 1024 "sql.y" { yylhsminor.yy974 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); } +#line 8286 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; case 499: /* literal ::= NK_FLOAT */ +#line 1025 "sql.y" { yylhsminor.yy974 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } +#line 8292 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; case 500: /* literal ::= NK_STRING */ +#line 1026 "sql.y" { yylhsminor.yy974 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } +#line 8298 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; case 501: /* literal ::= NK_BOOL */ +#line 1027 "sql.y" { yylhsminor.yy974 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } +#line 8304 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; case 502: /* literal ::= TIMESTAMP NK_STRING */ +#line 1028 "sql.y" { yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } +#line 8310 "sql.c" yymsp[-1].minor.yy974 = yylhsminor.yy974; break; case 503: /* literal ::= duration_literal */ @@ -7151,64 +8331,90 @@ yymsp[0].minor.yy974); } case 752: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==752); case 755: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==755); case 757: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==757); +#line 1029 "sql.y" { yylhsminor.yy974 = yymsp[0].minor.yy974; } +#line 8336 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; case 504: /* literal ::= NULL */ +#line 1030 "sql.y" { yylhsminor.yy974 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } +#line 8342 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; case 505: /* literal ::= NK_QUESTION */ +#line 1031 "sql.y" { yylhsminor.yy974 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } +#line 8348 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; case 506: /* duration_literal ::= NK_VARIABLE */ case 726: /* interval_sliding_duration_literal ::= NK_VARIABLE */ yytestcase(yyruleno==726); case 727: /* interval_sliding_duration_literal ::= NK_STRING */ yytestcase(yyruleno==727); case 728: /* interval_sliding_duration_literal ::= NK_INTEGER */ yytestcase(yyruleno==728); +#line 1033 "sql.y" { yylhsminor.yy974 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } +#line 8357 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; case 507: /* signed ::= NK_INTEGER */ +#line 1035 "sql.y" { yylhsminor.yy974 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } +#line 8363 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; case 508: /* signed ::= NK_PLUS NK_INTEGER */ +#line 1036 "sql.y" { yymsp[-1].minor.yy974 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } +#line 8369 "sql.c" break; case 509: /* signed ::= NK_MINUS NK_INTEGER */ +#line 1037 "sql.y" { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; yylhsminor.yy974 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); } +#line 8378 "sql.c" yymsp[-1].minor.yy974 = yylhsminor.yy974; break; case 510: /* signed ::= NK_FLOAT */ +#line 1042 "sql.y" { yylhsminor.yy974 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } +#line 8384 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; case 511: /* signed ::= NK_PLUS NK_FLOAT */ +#line 1043 "sql.y" { yymsp[-1].minor.yy974 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } +#line 8390 "sql.c" break; case 512: /* signed ::= NK_MINUS NK_FLOAT */ +#line 1044 "sql.y" { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; yylhsminor.yy974 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); } +#line 8399 "sql.c" yymsp[-1].minor.yy974 = yylhsminor.yy974; break; case 514: /* signed_literal ::= NK_STRING */ +#line 1051 "sql.y" { yylhsminor.yy974 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } +#line 8405 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; case 515: /* signed_literal ::= NK_BOOL */ +#line 1052 "sql.y" { yylhsminor.yy974 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } +#line 8411 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; case 516: /* signed_literal ::= TIMESTAMP NK_STRING */ +#line 1053 "sql.y" { yymsp[-1].minor.yy974 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } +#line 8417 "sql.c" break; case 517: /* signed_literal ::= duration_literal */ case 519: /* signed_literal ::= literal_func */ yytestcase(yyruleno==519); @@ -7218,118 +8424,156 @@ yymsp[0].minor.yy974); } case 756: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==756); case 758: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==758); case 771: /* search_condition ::= common_expression */ yytestcase(yyruleno==771); +#line 1054 "sql.y" { yylhsminor.yy974 = releaseRawExprNode(pCxt, yymsp[0].minor.yy974); } +#line 8429 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; case 518: /* signed_literal ::= NULL */ +#line 1055 "sql.y" { yylhsminor.yy974 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } +#line 8435 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; case 520: /* signed_literal ::= NK_QUESTION */ +#line 1057 "sql.y" { yylhsminor.yy974 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); } +#line 8441 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; case 539: /* expression ::= pseudo_column */ +#line 1123 "sql.y" { yylhsminor.yy974 = yymsp[0].minor.yy974; (void)setRawExprNodeIsPseudoColumn(pCxt, yylhsminor.yy974, true); } +#line 8447 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; case 543: /* expression ::= NK_LP expression NK_RP */ case 652: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==652); case 770: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==770); +#line 1127 "sql.y" { yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy974)); } +#line 8455 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 544: /* expression ::= NK_PLUS expr_or_subquery */ +#line 1128 "sql.y" { SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974); yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy974)); } +#line 8464 "sql.c" yymsp[-1].minor.yy974 = yylhsminor.yy974; break; case 545: /* expression ::= NK_MINUS expr_or_subquery */ +#line 1132 "sql.y" { SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974); yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy974), NULL)); } +#line 8473 "sql.c" yymsp[-1].minor.yy974 = yylhsminor.yy974; break; case 546: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ +#line 1136 "sql.y" { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy974); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974); yylhsminor.yy974 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), releaseRawExprNode(pCxt, yymsp[0].minor.yy974))); } +#line 8483 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 547: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ +#line 1141 "sql.y" { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy974); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974); yylhsminor.yy974 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), releaseRawExprNode(pCxt, yymsp[0].minor.yy974))); } +#line 8493 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 548: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */ +#line 1146 "sql.y" { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy974); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974); yylhsminor.yy974 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), releaseRawExprNode(pCxt, yymsp[0].minor.yy974))); } +#line 8503 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 549: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ +#line 1151 "sql.y" { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy974); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974); yylhsminor.yy974 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), releaseRawExprNode(pCxt, yymsp[0].minor.yy974))); } +#line 8513 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 550: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */ +#line 1156 "sql.y" { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy974); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974); yylhsminor.yy974 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), releaseRawExprNode(pCxt, yymsp[0].minor.yy974))); } +#line 8523 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 551: /* expression ::= column_reference NK_ARROW NK_STRING */ +#line 1161 "sql.y" { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy974); yylhsminor.yy974 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); } +#line 8532 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 552: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ +#line 1165 "sql.y" { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy974); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974); yylhsminor.yy974 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), releaseRawExprNode(pCxt, yymsp[0].minor.yy974))); } +#line 8542 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 553: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ +#line 1170 "sql.y" { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy974); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974); yylhsminor.yy974 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), releaseRawExprNode(pCxt, yymsp[0].minor.yy974))); } +#line 8552 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 556: /* column_reference ::= column_name */ +#line 1181 "sql.y" { yylhsminor.yy974 = createRawExprNode(pCxt, &yymsp[0].minor.yy557, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy557)); } +#line 8558 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; case 557: /* column_reference ::= table_name NK_DOT column_name */ +#line 1182 "sql.y" { yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy557, &yymsp[0].minor.yy557, createColumnNode(pCxt, &yymsp[-2].minor.yy557, &yymsp[0].minor.yy557)); } +#line 8564 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 558: /* column_reference ::= NK_ALIAS */ +#line 1183 "sql.y" { yylhsminor.yy974 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } +#line 8570 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; case 559: /* column_reference ::= table_name NK_DOT NK_ALIAS */ +#line 1184 "sql.y" { yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy557, &yymsp[0].minor.yy0, createColumnNode(pCxt, &yymsp[-2].minor.yy557, &yymsp[0].minor.yy0)); } +#line 8576 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 560: /* pseudo_column ::= ROWTS */ @@ -7348,290 +8592,427 @@ yymsp[0].minor.yy974); } case 574: /* pseudo_column ::= FROWTS */ yytestcase(yyruleno==574); case 591: /* literal_func ::= NOW */ yytestcase(yyruleno==591); case 592: /* literal_func ::= TODAY */ yytestcase(yyruleno==592); +#line 1186 "sql.y" { yylhsminor.yy974 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } +#line 8597 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; case 562: /* pseudo_column ::= table_name NK_DOT TBNAME */ +#line 1188 "sql.y" { yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy557, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy557)))); } +#line 8603 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 575: /* function_expression ::= function_name NK_LP expression_list NK_RP */ case 576: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==576); case 584: /* function_expression ::= substr_func NK_LP expression_list NK_RP */ yytestcase(yyruleno==584); +#line 1202 "sql.y" { yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy557, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy557, yymsp[-1].minor.yy946)); } +#line 8611 "sql.c" yymsp[-3].minor.yy974 = yylhsminor.yy974; break; case 577: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ case 578: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP */ yytestcase(yyruleno==578); +#line 1205 "sql.y" { yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy974), yymsp[-1].minor.yy424)); } +#line 8618 "sql.c" yymsp[-5].minor.yy974 = yylhsminor.yy974; break; case 579: /* function_expression ::= POSITION NK_LP expr_or_subquery IN expr_or_subquery NK_RP */ +#line 1209 "sql.y" { yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createPositionFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy974), releaseRawExprNode(pCxt, yymsp[-1].minor.yy974))); } +#line 8624 "sql.c" yymsp[-5].minor.yy974 = yylhsminor.yy974; break; case 580: /* function_expression ::= TRIM NK_LP expr_or_subquery NK_RP */ +#line 1211 "sql.y" { yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createTrimFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy974), TRIM_TYPE_BOTH)); } +#line 8630 "sql.c" yymsp[-3].minor.yy974 = yylhsminor.yy974; break; case 581: /* function_expression ::= TRIM NK_LP trim_specification_type FROM expr_or_subquery NK_RP */ +#line 1213 "sql.y" { yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createTrimFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy974), yymsp[-3].minor.yy300)); } +#line 8636 "sql.c" yymsp[-5].minor.yy974 = yylhsminor.yy974; break; case 582: /* function_expression ::= TRIM NK_LP expr_or_subquery FROM expr_or_subquery NK_RP */ +#line 1215 "sql.y" { yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createTrimFunctionNodeExt(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy974), releaseRawExprNode(pCxt, yymsp[-1].minor.yy974), TRIM_TYPE_BOTH)); } +#line 8642 "sql.c" yymsp[-5].minor.yy974 = yylhsminor.yy974; break; case 583: /* function_expression ::= TRIM NK_LP trim_specification_type expr_or_subquery FROM expr_or_subquery NK_RP */ +#line 1217 "sql.y" { yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-6].minor.yy0, &yymsp[0].minor.yy0, createTrimFunctionNodeExt(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy974), releaseRawExprNode(pCxt, yymsp[-1].minor.yy974), yymsp[-4].minor.yy300)); } +#line 8648 "sql.c" yymsp[-6].minor.yy974 = yylhsminor.yy974; break; case 585: /* function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery NK_RP */ +#line 1221 "sql.y" { yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy557, &yymsp[0].minor.yy0, createSubstrFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy974), releaseRawExprNode(pCxt, yymsp[-1].minor.yy974))); } +#line 8654 "sql.c" yymsp[-5].minor.yy974 = yylhsminor.yy974; break; case 586: /* function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery FOR expr_or_subquery NK_RP */ +#line 1223 "sql.y" { yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-7].minor.yy557, &yymsp[0].minor.yy0, createSubstrFunctionNodeExt(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy974), releaseRawExprNode(pCxt, yymsp[-3].minor.yy974), releaseRawExprNode(pCxt, yymsp[-1].minor.yy974))); } +#line 8660 "sql.c" yymsp[-7].minor.yy974 = yylhsminor.yy974; break; case 587: /* function_expression ::= REPLACE NK_LP expression_list NK_RP */ case 594: /* rand_func ::= RAND NK_LP expression_list NK_RP */ yytestcase(yyruleno==594); +#line 1224 "sql.y" { yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy946)); } +#line 8667 "sql.c" yymsp[-3].minor.yy974 = yylhsminor.yy974; break; case 590: /* literal_func ::= noarg_func NK_LP NK_RP */ +#line 1228 "sql.y" { yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy557, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy557, NULL)); } +#line 8673 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 593: /* rand_func ::= RAND NK_LP NK_RP */ +#line 1232 "sql.y" { yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy0, NULL)); } +#line 8679 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 597: /* trim_specification_type ::= BOTH */ +#line 1242 "sql.y" { yymsp[0].minor.yy300 = TRIM_TYPE_BOTH; } +#line 8685 "sql.c" break; case 598: /* trim_specification_type ::= TRAILING */ +#line 1243 "sql.y" { yymsp[0].minor.yy300 = TRIM_TYPE_TRAILING; } +#line 8690 "sql.c" break; case 599: /* trim_specification_type ::= LEADING */ +#line 1244 "sql.y" { yymsp[0].minor.yy300 = TRIM_TYPE_LEADING; } +#line 8695 "sql.c" break; case 614: /* star_func_para_list ::= NK_STAR */ +#line 1268 "sql.y" { yylhsminor.yy946 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } +#line 8700 "sql.c" yymsp[0].minor.yy946 = yylhsminor.yy946; break; case 619: /* star_func_para ::= table_name NK_DOT NK_STAR */ case 704: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==704); +#line 1277 "sql.y" { yylhsminor.yy974 = createColumnNode(pCxt, &yymsp[-2].minor.yy557, &yymsp[0].minor.yy0); } +#line 8707 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 620: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */ +#line 1280 "sql.y" { yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy946, yymsp[-1].minor.yy974)); } +#line 8713 "sql.c" yymsp[-3].minor.yy974 = yylhsminor.yy974; break; case 621: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ +#line 1282 "sql.y" { yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy974), yymsp[-2].minor.yy946, yymsp[-1].minor.yy974)); } +#line 8719 "sql.c" yymsp[-4].minor.yy974 = yylhsminor.yy974; break; case 624: /* when_then_expr ::= WHEN common_expression THEN common_expression */ +#line 1289 "sql.y" { yymsp[-3].minor.yy974 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), releaseRawExprNode(pCxt, yymsp[0].minor.yy974)); } +#line 8725 "sql.c" break; case 626: /* case_when_else_opt ::= ELSE common_expression */ +#line 1292 "sql.y" { yymsp[-1].minor.yy974 = releaseRawExprNode(pCxt, yymsp[0].minor.yy974); } +#line 8730 "sql.c" break; case 627: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */ case 632: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==632); +#line 1295 "sql.y" { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy974); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974); yylhsminor.yy974 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy140, releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), releaseRawExprNode(pCxt, yymsp[0].minor.yy974))); } +#line 8740 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 628: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ +#line 1302 "sql.y" { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy974); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974); yylhsminor.yy974 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy974), releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), releaseRawExprNode(pCxt, yymsp[0].minor.yy974))); } +#line 8750 "sql.c" yymsp[-4].minor.yy974 = yylhsminor.yy974; break; case 629: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ +#line 1308 "sql.y" { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy974); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974); yylhsminor.yy974 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy974), releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), releaseRawExprNode(pCxt, yymsp[0].minor.yy974))); } +#line 8760 "sql.c" yymsp[-5].minor.yy974 = yylhsminor.yy974; break; case 630: /* predicate ::= expr_or_subquery IS NULL */ +#line 1313 "sql.y" { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy974); yylhsminor.yy974 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), NULL)); } +#line 8769 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 631: /* predicate ::= expr_or_subquery IS NOT NULL */ +#line 1317 "sql.y" { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy974); yylhsminor.yy974 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy974), NULL)); } +#line 8778 "sql.c" yymsp[-3].minor.yy974 = yylhsminor.yy974; break; case 633: /* compare_op ::= NK_LT */ +#line 1329 "sql.y" { yymsp[0].minor.yy140 = OP_TYPE_LOWER_THAN; } +#line 8784 "sql.c" break; case 634: /* compare_op ::= NK_GT */ +#line 1330 "sql.y" { yymsp[0].minor.yy140 = OP_TYPE_GREATER_THAN; } +#line 8789 "sql.c" break; case 635: /* compare_op ::= NK_LE */ +#line 1331 "sql.y" { yymsp[0].minor.yy140 = OP_TYPE_LOWER_EQUAL; } +#line 8794 "sql.c" break; case 636: /* compare_op ::= NK_GE */ +#line 1332 "sql.y" { yymsp[0].minor.yy140 = OP_TYPE_GREATER_EQUAL; } +#line 8799 "sql.c" break; case 637: /* compare_op ::= NK_NE */ +#line 1333 "sql.y" { yymsp[0].minor.yy140 = OP_TYPE_NOT_EQUAL; } +#line 8804 "sql.c" break; case 638: /* compare_op ::= NK_EQ */ +#line 1334 "sql.y" { yymsp[0].minor.yy140 = OP_TYPE_EQUAL; } +#line 8809 "sql.c" break; case 639: /* compare_op ::= LIKE */ +#line 1335 "sql.y" { yymsp[0].minor.yy140 = OP_TYPE_LIKE; } +#line 8814 "sql.c" break; case 640: /* compare_op ::= NOT LIKE */ +#line 1336 "sql.y" { yymsp[-1].minor.yy140 = OP_TYPE_NOT_LIKE; } +#line 8819 "sql.c" break; case 641: /* compare_op ::= MATCH */ +#line 1337 "sql.y" { yymsp[0].minor.yy140 = OP_TYPE_MATCH; } +#line 8824 "sql.c" break; case 642: /* compare_op ::= NMATCH */ +#line 1338 "sql.y" { yymsp[0].minor.yy140 = OP_TYPE_NMATCH; } +#line 8829 "sql.c" break; case 643: /* compare_op ::= CONTAINS */ +#line 1339 "sql.y" { yymsp[0].minor.yy140 = OP_TYPE_JSON_CONTAINS; } +#line 8834 "sql.c" break; case 644: /* in_op ::= IN */ +#line 1343 "sql.y" { yymsp[0].minor.yy140 = OP_TYPE_IN; } +#line 8839 "sql.c" break; case 645: /* in_op ::= NOT IN */ +#line 1344 "sql.y" { yymsp[-1].minor.yy140 = OP_TYPE_NOT_IN; } +#line 8844 "sql.c" break; case 646: /* in_predicate_value ::= NK_LP literal_list NK_RP */ +#line 1346 "sql.y" { yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy946)); } +#line 8849 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 648: /* boolean_value_expression ::= NOT boolean_primary */ +#line 1350 "sql.y" { SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974); yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy974), NULL)); } +#line 8858 "sql.c" yymsp[-1].minor.yy974 = yylhsminor.yy974; break; case 649: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ +#line 1355 "sql.y" { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy974); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974); yylhsminor.yy974 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), releaseRawExprNode(pCxt, yymsp[0].minor.yy974))); } +#line 8868 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 650: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ +#line 1361 "sql.y" { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy974); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974); yylhsminor.yy974 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), releaseRawExprNode(pCxt, yymsp[0].minor.yy974))); } +#line 8878 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 658: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ +#line 1379 "sql.y" { yylhsminor.yy974 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, JOIN_STYPE_NONE, yymsp[-2].minor.yy974, yymsp[0].minor.yy974, NULL); } +#line 8884 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 661: /* table_primary ::= table_name alias_opt */ +#line 1385 "sql.y" { yylhsminor.yy974 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy557, &yymsp[0].minor.yy557); } +#line 8890 "sql.c" yymsp[-1].minor.yy974 = yylhsminor.yy974; break; case 662: /* table_primary ::= db_name NK_DOT table_name alias_opt */ +#line 1386 "sql.y" { yylhsminor.yy974 = createRealTableNode(pCxt, &yymsp[-3].minor.yy557, &yymsp[-1].minor.yy557, &yymsp[0].minor.yy557); } +#line 8896 "sql.c" yymsp[-3].minor.yy974 = yylhsminor.yy974; break; case 663: /* table_primary ::= subquery alias_opt */ +#line 1387 "sql.y" { yylhsminor.yy974 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy974), &yymsp[0].minor.yy557); } +#line 8902 "sql.c" yymsp[-1].minor.yy974 = yylhsminor.yy974; break; case 665: /* alias_opt ::= */ +#line 1392 "sql.y" { yymsp[1].minor.yy557 = nil_token; } +#line 8908 "sql.c" break; case 667: /* alias_opt ::= AS table_alias */ +#line 1394 "sql.y" { yymsp[-1].minor.yy557 = yymsp[0].minor.yy557; } +#line 8913 "sql.c" break; case 668: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ case 669: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==669); +#line 1396 "sql.y" { yymsp[-2].minor.yy974 = yymsp[-1].minor.yy974; } +#line 8919 "sql.c" break; case 670: /* joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt */ +#line 1402 "sql.y" { yylhsminor.yy974 = createJoinTableNode(pCxt, yymsp[-6].minor.yy792, yymsp[-5].minor.yy744, yymsp[-7].minor.yy974, yymsp[-3].minor.yy974, yymsp[-2].minor.yy974); yylhsminor.yy974 = addWindowOffsetClause(pCxt, yylhsminor.yy974, yymsp[-1].minor.yy974); yylhsminor.yy974 = addJLimitClause(pCxt, yylhsminor.yy974, yymsp[0].minor.yy974); } +#line 8928 "sql.c" yymsp[-7].minor.yy974 = yylhsminor.yy974; break; case 671: /* join_type ::= */ +#line 1410 "sql.y" { yymsp[1].minor.yy792 = JOIN_TYPE_INNER; } +#line 8934 "sql.c" break; case 672: /* join_type ::= INNER */ +#line 1411 "sql.y" { yymsp[0].minor.yy792 = JOIN_TYPE_INNER; } +#line 8939 "sql.c" break; case 673: /* join_type ::= LEFT */ +#line 1412 "sql.y" { yymsp[0].minor.yy792 = JOIN_TYPE_LEFT; } +#line 8944 "sql.c" break; case 674: /* join_type ::= RIGHT */ +#line 1413 "sql.y" { yymsp[0].minor.yy792 = JOIN_TYPE_RIGHT; } +#line 8949 "sql.c" break; case 675: /* join_type ::= FULL */ +#line 1414 "sql.y" { yymsp[0].minor.yy792 = JOIN_TYPE_FULL; } +#line 8954 "sql.c" break; case 676: /* join_subtype ::= */ +#line 1418 "sql.y" { yymsp[1].minor.yy744 = JOIN_STYPE_NONE; } +#line 8959 "sql.c" break; case 677: /* join_subtype ::= OUTER */ +#line 1419 "sql.y" { yymsp[0].minor.yy744 = JOIN_STYPE_OUTER; } +#line 8964 "sql.c" break; case 678: /* join_subtype ::= SEMI */ +#line 1420 "sql.y" { yymsp[0].minor.yy744 = JOIN_STYPE_SEMI; } +#line 8969 "sql.c" break; case 679: /* join_subtype ::= ANTI */ +#line 1421 "sql.y" { yymsp[0].minor.yy744 = JOIN_STYPE_ANTI; } +#line 8974 "sql.c" break; case 680: /* join_subtype ::= ASOF */ +#line 1422 "sql.y" { yymsp[0].minor.yy744 = JOIN_STYPE_ASOF; } +#line 8979 "sql.c" break; case 681: /* join_subtype ::= WINDOW */ +#line 1423 "sql.y" { yymsp[0].minor.yy744 = JOIN_STYPE_WIN; } +#line 8984 "sql.c" break; case 685: /* window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP */ +#line 1430 "sql.y" { yymsp[-5].minor.yy974 = createWindowOffsetNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy974), releaseRawExprNode(pCxt, yymsp[-1].minor.yy974)); } +#line 8989 "sql.c" break; case 686: /* window_offset_literal ::= NK_VARIABLE */ +#line 1432 "sql.y" { yylhsminor.yy974 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createTimeOffsetValueNode(pCxt, &yymsp[0].minor.yy0)); } +#line 8994 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; case 687: /* window_offset_literal ::= NK_MINUS NK_VARIABLE */ +#line 1433 "sql.y" { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; yylhsminor.yy974 = createRawExprNode(pCxt, &t, createTimeOffsetValueNode(pCxt, &t)); } +#line 9004 "sql.c" yymsp[-1].minor.yy974 = yylhsminor.yy974; break; case 689: /* jlimit_clause_opt ::= JLIMIT NK_INTEGER */ case 762: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ yytestcase(yyruleno==762); case 766: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==766); +#line 1440 "sql.y" { yymsp[-1].minor.yy974 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } +#line 9012 "sql.c" break; case 690: /* query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_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 */ +#line 1446 "sql.y" { yymsp[-13].minor.yy974 = createSelectStmt(pCxt, yymsp[-11].minor.yy569, yymsp[-9].minor.yy946, yymsp[-8].minor.yy974, yymsp[-12].minor.yy946); yymsp[-13].minor.yy974 = setSelectStmtTagMode(pCxt, yymsp[-13].minor.yy974, yymsp[-10].minor.yy569); @@ -7644,156 +9025,243 @@ yymsp[0].minor.yy974); } yymsp[-13].minor.yy974 = addEveryClause(pCxt, yymsp[-13].minor.yy974, yymsp[-4].minor.yy974); yymsp[-13].minor.yy974 = addFillClause(pCxt, yymsp[-13].minor.yy974, yymsp[-3].minor.yy974); } +#line 9028 "sql.c" break; case 691: /* hint_list ::= */ +#line 1461 "sql.y" { yymsp[1].minor.yy946 = createHintNodeList(pCxt, NULL); } +#line 9033 "sql.c" break; case 692: /* hint_list ::= NK_HINT */ +#line 1462 "sql.y" { yylhsminor.yy946 = createHintNodeList(pCxt, &yymsp[0].minor.yy0); } +#line 9038 "sql.c" yymsp[0].minor.yy946 = yylhsminor.yy946; break; case 697: /* set_quantifier_opt ::= ALL */ +#line 1473 "sql.y" { yymsp[0].minor.yy569 = false; } +#line 9044 "sql.c" break; case 700: /* select_item ::= NK_STAR */ +#line 1480 "sql.y" { yylhsminor.yy974 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } +#line 9049 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; case 702: /* select_item ::= common_expression column_alias */ case 712: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==712); +#line 1482 "sql.y" { yylhsminor.yy974 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy974), &yymsp[0].minor.yy557); } +#line 9056 "sql.c" yymsp[-1].minor.yy974 = yylhsminor.yy974; break; case 703: /* select_item ::= common_expression AS column_alias */ case 713: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==713); +#line 1483 "sql.y" { yylhsminor.yy974 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), &yymsp[0].minor.yy557); } +#line 9063 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 708: /* partition_by_clause_opt ::= PARTITION BY partition_list */ case 740: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==740); case 760: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==760); +#line 1492 "sql.y" { yymsp[-2].minor.yy946 = yymsp[0].minor.yy946; } +#line 9071 "sql.c" break; case 715: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ +#line 1505 "sql.y" { yymsp[-5].minor.yy974 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy974), releaseRawExprNode(pCxt, yymsp[-1].minor.yy974)); } +#line 9076 "sql.c" break; case 716: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ +#line 1506 "sql.y" { yymsp[-3].minor.yy974 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy974)); } +#line 9081 "sql.c" break; case 717: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ +#line 1508 "sql.y" { yymsp[-5].minor.yy974 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy974), NULL, yymsp[-1].minor.yy974, yymsp[0].minor.yy974); } +#line 9086 "sql.c" break; case 718: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ +#line 1512 "sql.y" { yymsp[-7].minor.yy974 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy974), releaseRawExprNode(pCxt, yymsp[-3].minor.yy974), yymsp[-1].minor.yy974, yymsp[0].minor.yy974); } +#line 9091 "sql.c" break; case 719: /* twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ +#line 1514 "sql.y" { yymsp[-6].minor.yy974 = createEventWindowNode(pCxt, yymsp[-3].minor.yy974, yymsp[0].minor.yy974); } +#line 9096 "sql.c" break; case 720: /* twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */ +#line 1516 "sql.y" { yymsp[-3].minor.yy974 = createCountWindowNode(pCxt, &yymsp[-1].minor.yy0, &yymsp[-1].minor.yy0); } +#line 9101 "sql.c" break; case 721: /* twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ +#line 1518 "sql.y" { yymsp[-5].minor.yy974 = createCountWindowNode(pCxt, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0); } +#line 9106 "sql.c" break; case 722: /* twindow_clause_opt ::= ANOMALY_WINDOW NK_LP expr_or_subquery NK_RP */ +#line 1520 "sql.y" { yymsp[-3].minor.yy974 = createAnomalyWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy974), NULL); } +#line 9111 "sql.c" break; case 723: /* twindow_clause_opt ::= ANOMALY_WINDOW NK_LP expr_or_subquery NK_COMMA NK_STRING NK_RP */ +#line 1522 "sql.y" { yymsp[-5].minor.yy974 = createAnomalyWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy974), &yymsp[-1].minor.yy0); } +#line 9116 "sql.c" break; case 730: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ +#line 1532 "sql.y" { yymsp[-3].minor.yy974 = createFillNode(pCxt, yymsp[-1].minor.yy102, NULL); } +#line 9121 "sql.c" break; case 731: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ +#line 1533 "sql.y" { yymsp[-5].minor.yy974 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy946)); } +#line 9126 "sql.c" break; case 732: /* fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ +#line 1534 "sql.y" { yymsp[-5].minor.yy974 = createFillNode(pCxt, FILL_MODE_VALUE_F, createNodeListNode(pCxt, yymsp[-1].minor.yy946)); } +#line 9131 "sql.c" break; case 733: /* fill_mode ::= NONE */ +#line 1538 "sql.y" { yymsp[0].minor.yy102 = FILL_MODE_NONE; } +#line 9136 "sql.c" break; case 734: /* fill_mode ::= PREV */ +#line 1539 "sql.y" { yymsp[0].minor.yy102 = FILL_MODE_PREV; } +#line 9141 "sql.c" break; case 735: /* fill_mode ::= NULL */ +#line 1540 "sql.y" { yymsp[0].minor.yy102 = FILL_MODE_NULL; } +#line 9146 "sql.c" break; case 736: /* fill_mode ::= NULL_F */ +#line 1541 "sql.y" { yymsp[0].minor.yy102 = FILL_MODE_NULL_F; } +#line 9151 "sql.c" break; case 737: /* fill_mode ::= LINEAR */ +#line 1542 "sql.y" { yymsp[0].minor.yy102 = FILL_MODE_LINEAR; } +#line 9156 "sql.c" break; case 738: /* fill_mode ::= NEXT */ +#line 1543 "sql.y" { yymsp[0].minor.yy102 = FILL_MODE_NEXT; } +#line 9161 "sql.c" break; case 741: /* group_by_list ::= expr_or_subquery */ +#line 1552 "sql.y" { yylhsminor.yy946 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy974))); } +#line 9166 "sql.c" yymsp[0].minor.yy946 = yylhsminor.yy946; break; case 742: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ +#line 1553 "sql.y" { yylhsminor.yy946 = addNodeToList(pCxt, yymsp[-2].minor.yy946, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy974))); } +#line 9172 "sql.c" yymsp[-2].minor.yy946 = yylhsminor.yy946; break; case 746: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ +#line 1560 "sql.y" { yymsp[-5].minor.yy974 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy974), releaseRawExprNode(pCxt, yymsp[-1].minor.yy974)); } +#line 9178 "sql.c" break; case 747: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ +#line 1562 "sql.y" { yymsp[-3].minor.yy974 = createInterpTimePoint(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy974)); } +#line 9183 "sql.c" break; case 750: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ +#line 1569 "sql.y" { yylhsminor.yy974 = addOrderByClause(pCxt, yymsp[-3].minor.yy974, yymsp[-2].minor.yy946); yylhsminor.yy974 = addSlimitClause(pCxt, yylhsminor.yy974, yymsp[-1].minor.yy974); yylhsminor.yy974 = addLimitClause(pCxt, yylhsminor.yy974, yymsp[0].minor.yy974); } +#line 9192 "sql.c" yymsp[-3].minor.yy974 = yylhsminor.yy974; break; case 753: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ +#line 1579 "sql.y" { yylhsminor.yy974 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy974, yymsp[0].minor.yy974); } +#line 9198 "sql.c" yymsp[-3].minor.yy974 = yylhsminor.yy974; break; case 754: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ +#line 1581 "sql.y" { yylhsminor.yy974 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy974, yymsp[0].minor.yy974); } +#line 9204 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 763: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ case 767: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==767); +#line 1596 "sql.y" { yymsp[-3].minor.yy974 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } +#line 9211 "sql.c" break; case 764: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ case 768: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==768); +#line 1597 "sql.y" { yymsp[-3].minor.yy974 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } +#line 9217 "sql.c" break; case 769: /* subquery ::= NK_LP query_expression NK_RP */ +#line 1605 "sql.y" { yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy974); } +#line 9222 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 774: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ +#line 1619 "sql.y" { yylhsminor.yy974 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), yymsp[-1].minor.yy410, yymsp[0].minor.yy307); } +#line 9228 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 775: /* ordering_specification_opt ::= */ +#line 1623 "sql.y" { yymsp[1].minor.yy410 = ORDER_ASC; } +#line 9234 "sql.c" break; case 776: /* ordering_specification_opt ::= ASC */ +#line 1624 "sql.y" { yymsp[0].minor.yy410 = ORDER_ASC; } +#line 9239 "sql.c" break; case 777: /* ordering_specification_opt ::= DESC */ +#line 1625 "sql.y" { yymsp[0].minor.yy410 = ORDER_DESC; } +#line 9244 "sql.c" break; case 778: /* null_ordering_opt ::= */ +#line 1629 "sql.y" { yymsp[1].minor.yy307 = NULL_ORDER_DEFAULT; } +#line 9249 "sql.c" break; case 779: /* null_ordering_opt ::= NULLS FIRST */ +#line 1630 "sql.y" { yymsp[-1].minor.yy307 = NULL_ORDER_FIRST; } +#line 9254 "sql.c" break; case 780: /* null_ordering_opt ::= NULLS LAST */ +#line 1631 "sql.y" { yymsp[-1].minor.yy307 = NULL_ORDER_LAST; } +#line 9259 "sql.c" break; case 783: /* column_options ::= column_options NK_ID NK_STRING */ +#line 1639 "sql.y" { yylhsminor.yy974 = setColumnOptions(pCxt, yymsp[-2].minor.yy974, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } +#line 9264 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; default: @@ -7856,6 +9324,7 @@ static void yy_syntax_error( ParseCTX_FETCH #define TOKEN yyminor /************ Begin %syntax_error code ****************************************/ +#line 29 "sql.y" if (TSDB_CODE_SUCCESS == pCxt->errCode) { if(TOKEN.z) { @@ -7866,6 +9335,7 @@ static void yy_syntax_error( } else if (TSDB_CODE_PAR_DB_NOT_SPECIFIED == pCxt->errCode && TK_NK_FLOAT == TOKEN.type) { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_SYNTAX_ERROR, TOKEN.z); } +#line 9338 "sql.c" /************ End %syntax_error code ******************************************/ ParseARG_STORE /* Suppress warning about unused %extra_argument variable */ ParseCTX_STORE From c0932d419d53768c7f0a3565364b8b0e837aa996 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Mon, 28 Oct 2024 18:07:11 +0800 Subject: [PATCH 363/695] fix(stream): fix error in pause/resume for force_window_close --- include/libs/stream/tstream.h | 5 +- source/libs/stream/inc/streamInt.h | 4 +- source/libs/stream/src/streamCheckStatus.c | 2 +- source/libs/stream/src/streamData.c | 50 +++++++++++++---- source/libs/stream/src/streamQueue.c | 2 +- source/libs/stream/src/streamSched.c | 65 ++++++++++++++++++---- 6 files changed, 102 insertions(+), 26 deletions(-) diff --git a/include/libs/stream/tstream.h b/include/libs/stream/tstream.h index d018682a10dd..3be581a7a073 100644 --- a/include/libs/stream/tstream.h +++ b/include/libs/stream/tstream.h @@ -113,7 +113,7 @@ enum { enum { TASK_TRIGGER_STATUS__INACTIVE = 1, - TASK_TRIGGER_STATUS__ACTIVE, + TASK_TRIGGER_STATUS__MAY_ACTIVE, }; typedef enum { @@ -294,9 +294,10 @@ typedef struct SStreamStatus { int32_t timerActive; // timer is active int64_t lastExecTs; // last exec time stamp int32_t inScanHistorySentinel; - bool appendTranstateBlock; // has append the transfer state data block already + bool appendTranstateBlock; // has appended the transfer state data block already bool removeBackendFiles; // remove backend files on disk when free stream tasks SConsenChkptInfo consenChkptInfo; + STimeWindow latestForceWindow; // latest generated time window, only valid in } SStreamStatus; typedef struct SDataRange { diff --git a/source/libs/stream/inc/streamInt.h b/source/libs/stream/inc/streamInt.h index 83c662552694..6d49e6b10c6e 100644 --- a/source/libs/stream/inc/streamInt.h +++ b/source/libs/stream/inc/streamInt.h @@ -238,7 +238,9 @@ int32_t initCheckpointReadyMsg(SStreamTask* pTask, int32_t upstreamNodeId, int32 int64_t checkpointId, SRpcMsg* pMsg); int32_t flushStateDataInExecutor(SStreamTask* pTask, SStreamQueueItem* pCheckpointBlock); -int32_t streamCreateSinkResTrigger(SStreamTrigger** pTrigger, int32_t triggerType, int32_t trigger); +int32_t streamCreateSinkResTrigger(SStreamTrigger** pTrigger); +int32_t streamCreateForcewindowTrigger(SStreamTrigger** pTrigger, int32_t trigger, SInterval* pInterval, + STimeWindow* pLatestWindow); #ifdef __cplusplus } diff --git a/source/libs/stream/src/streamCheckStatus.c b/source/libs/stream/src/streamCheckStatus.c index c1c54b3c0bfd..f830a8e3cfe4 100644 --- a/source/libs/stream/src/streamCheckStatus.c +++ b/source/libs/stream/src/streamCheckStatus.c @@ -749,7 +749,7 @@ void rspMonitorFn(void* param, void* tmrId) { streamTaskCompleteCheckRsp(pInfo, true, id); - // not record the failed of the current task if try to close current vnode + // not record the failure of the current task if try to close current vnode // otherwise, the put of message operation may incur invalid read of message queue. if (!pMeta->closeFlag) { int32_t code = addDownstreamFailedStatusResultAsync(pTask->pMsgCb, vgId, pTask->id.streamId, pTask->id.taskId); diff --git a/source/libs/stream/src/streamData.c b/source/libs/stream/src/streamData.c index a315c9c72624..4bbff3ad2143 100644 --- a/source/libs/stream/src/streamData.c +++ b/source/libs/stream/src/streamData.c @@ -307,8 +307,9 @@ void streamFreeQitem(SStreamQueueItem* data) { } } -int32_t streamCreateSinkResTrigger(SStreamTrigger** pTrigger, int32_t triggerType, int32_t trigger) { +int32_t streamCreateForcewindowTrigger(SStreamTrigger** pTrigger, int32_t trigger, SInterval* pInterval, STimeWindow* pLatestWindow) { QRY_PARAM_CHECK(pTrigger); + int64_t ts = INT64_MIN; SStreamTrigger* p = NULL; int32_t code = taosAllocateQitem(sizeof(SStreamTrigger), DEF_QITEM, 0, (void**)&p); @@ -324,22 +325,49 @@ int32_t streamCreateSinkResTrigger(SStreamTrigger** pTrigger, int32_t triggerTyp } // let's calculate the previous time window - // todo get the time precision for ts - if (triggerType == STREAM_TRIGGER_FORCE_WINDOW_CLOSE) { - SInterval interval = {.interval = trigger, .sliding = trigger, .intervalUnit = 'a', .slidingUnit = 'a'}; - int64_t now = taosGetTimestampMs(); + SInterval interval = {.interval = trigger, + .sliding = trigger, + .intervalUnit = pInterval->intervalUnit, + .slidingUnit = pInterval->slidingUnit}; + + ts = taosGetTimestampMs(); + + if (pLatestWindow->skey == INT64_MIN) { + STimeWindow window = getAlignQueryTimeWindow(&interval, ts); - STimeWindow window = getAlignQueryTimeWindow(&interval, now - trigger); p->pBlock->info.window.skey = window.skey; - p->pBlock->info.window.ekey = TMAX(now, window.ekey); - p->pBlock->info.type = STREAM_GET_RESULT; - stDebug("force_window_close trigger block generated, window range:%" PRId64 "-%" PRId64, - p->pBlock->info.window.skey, p->pBlock->info.window.ekey); + p->pBlock->info.window.ekey = TMAX(ts, window.ekey); } else { - p->pBlock->info.type = STREAM_GET_ALL; + int64_t skey = pLatestWindow->skey + trigger; + p->pBlock->info.window.skey = skey; + p->pBlock->info.window.ekey = TMAX(ts, skey + trigger); } + p->pBlock->info.type = STREAM_GET_RESULT; + stDebug("force_window_close trigger block generated, window range:%" PRId64 "-%" PRId64, p->pBlock->info.window.skey, + p->pBlock->info.window.ekey); + *pTrigger = p; + return code; +} +int32_t streamCreateSinkResTrigger(SStreamTrigger** pTrigger) { + QRY_PARAM_CHECK(pTrigger); + SStreamTrigger* p = NULL; + + int32_t code = taosAllocateQitem(sizeof(SStreamTrigger), DEF_QITEM, 0, (void**)&p); + if (code) { + return code; + } + + p->type = STREAM_INPUT__GET_RES; + p->pBlock = taosMemoryCalloc(1, sizeof(SSDataBlock)); + if (p->pBlock == NULL) { + taosFreeQitem(p); + return terrno; + } + + p->pBlock->info.type = STREAM_GET_ALL; + *pTrigger = p; return code; } \ No newline at end of file diff --git a/source/libs/stream/src/streamQueue.c b/source/libs/stream/src/streamQueue.c index 6af6ebd0441b..c1d70f4259fd 100644 --- a/source/libs/stream/src/streamQueue.c +++ b/source/libs/stream/src/streamQueue.c @@ -352,7 +352,7 @@ int32_t streamTaskPutDataIntoInputQ(SStreamTask* pTask, SStreamQueueItem* pItem) if (type != STREAM_INPUT__GET_RES && type != STREAM_INPUT__CHECKPOINT && type != STREAM_INPUT__CHECKPOINT_TRIGGER && (pTask->info.delaySchedParam != 0)) { (void)atomic_val_compare_exchange_8(&pTask->schedInfo.status, TASK_TRIGGER_STATUS__INACTIVE, - TASK_TRIGGER_STATUS__ACTIVE); + TASK_TRIGGER_STATUS__MAY_ACTIVE); stDebug("s-task:%s new data arrived, active the sched-trigger, triggerStatus:%d", pTask->id.idStr, pTask->schedInfo.status); } diff --git a/source/libs/stream/src/streamSched.c b/source/libs/stream/src/streamSched.c index cfb033fb71fa..042d082ed9b3 100644 --- a/source/libs/stream/src/streamSched.c +++ b/source/libs/stream/src/streamSched.c @@ -40,6 +40,7 @@ void streamSetupScheduleTrigger(SStreamTask* pTask) { return; } + pTask->status.latestForceWindow = lastTimeWindow; pTask->info.delaySchedParam = interval.sliding; pTask->info.watermark = waterMark; pTask->info.interval = interval; @@ -156,27 +157,71 @@ void streamTaskSchedHelper(void* param, void* tmrId) { const char* id = pTask->id.idStr; int32_t nextTrigger = (int32_t)pTask->info.delaySchedParam; int32_t vgId = pTask->pMeta->vgId; + int32_t code = 0; int8_t status = atomic_load_8(&pTask->schedInfo.status); stTrace("s-task:%s in scheduler, trigger status:%d, next:%dms", id, status, nextTrigger); - if (streamTaskShouldStop(pTask) || streamTaskShouldPause(pTask)) { + if (streamTaskShouldStop(pTask)) { stDebug("s-task:%s should stop, jump out of schedTimer", id); return; } + if (streamTaskShouldPause(pTask)) { + stDebug("s-task:%s is paused, check in nextTrigger:%ds", id, nextTrigger/1000); + streamTmrStart(streamTaskSchedHelper, nextTrigger, pTask, streamTimer, &pTask->schedInfo.pDelayTimer, vgId, + "sched-run-tmr"); + } + if (streamTaskGetStatus(pTask).state == TASK_STATUS__CK) { stDebug("s-task:%s in checkpoint procedure, not retrieve result, next:%dms", id, nextTrigger); } else { - if ((status == TASK_TRIGGER_STATUS__ACTIVE) || - (pTask->info.trigger == STREAM_TRIGGER_FORCE_WINDOW_CLOSE && pTask->info.taskLevel == TASK_LEVEL__SOURCE)) { - SStreamTrigger* pTrigger; + if (pTask->info.trigger == STREAM_TRIGGER_FORCE_WINDOW_CLOSE && pTask->info.taskLevel == TASK_LEVEL__SOURCE) { + SStreamTrigger* pTrigger = NULL; + + while (1) { + code = streamCreateForcewindowTrigger(&pTrigger, pTask->info.delaySchedParam, &pTask->info.interval, + &pTask->status.latestForceWindow); + if (code != 0) { + stError("s-task:%s failed to prepare force window close trigger, code:%s, try again in %dms", id, + tstrerror(code), nextTrigger); + goto _end; + } + + // in the force window close model, status trigger does not matter. So we do not set the trigger model + code = streamTaskPutDataIntoInputQ(pTask, (SStreamQueueItem*)pTrigger); + if (code != TSDB_CODE_SUCCESS) { + stError("s-task:%s failed to put retrieve aggRes block into q, code:%s", pTask->id.idStr, tstrerror(code)); + goto _end; + } + + // check whether the time window gaps exist or not + int64_t now = taosGetTimestamp(pTask->info.interval.precision); + int64_t intervalEndTs = pTrigger->pBlock->info.window.skey + pTask->info.interval.interval; + + // there are gaps, needs to be filled + STimeWindow w = pTrigger->pBlock->info.window; + w.ekey = w.skey + pTask->info.interval.interval; + if (w.skey <= pTask->status.latestForceWindow.skey) { + stFatal("s-task:%s invalid new time window in force_window_close model, skey:%" PRId64 + " should be greater than latestForceWindow skey:%" PRId64, + pTask->id.idStr, w.skey, pTask->status.latestForceWindow.skey); + } + + pTask->status.latestForceWindow = w; + if (intervalEndTs + pTask->info.watermark + pTask->info.interval.interval > now) { + break; + } else { + stDebug("s-task:%s gap exist for force_window_close, current force_window_skey:%" PRId64, id, w.skey); + } + } - int32_t code = streamCreateSinkResTrigger(&pTrigger, pTask->info.trigger, pTask->info.delaySchedParam); + } else if (status == TASK_TRIGGER_STATUS__MAY_ACTIVE) { + SStreamTrigger* pTrigger = NULL; + code = streamCreateSinkResTrigger(&pTrigger); if (code) { stError("s-task:%s failed to prepare retrieve data trigger, code:%s, try again in %dms", id, tstrerror(code), nextTrigger); - terrno = code; goto _end; } @@ -187,11 +232,11 @@ void streamTaskSchedHelper(void* param, void* tmrId) { stError("s-task:%s failed to put retrieve aggRes block into q, code:%s", pTask->id.idStr, tstrerror(code)); goto _end; } + } - code = streamTrySchedExec(pTask); - if (code != TSDB_CODE_SUCCESS) { - stError("s-task:%s failed to sched to run, wait for next time", pTask->id.idStr); - } + code = streamTrySchedExec(pTask); + if (code != TSDB_CODE_SUCCESS) { + stError("s-task:%s failed to sched to run, wait for next time", pTask->id.idStr); } } From af0a41979e59c3846833b66e1ff9350fe4d04479 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Mon, 28 Oct 2024 18:11:39 +0800 Subject: [PATCH 364/695] fix:conflicts from 3.0 --- source/common/src/tglobal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index 56af9a1c4703..7ea6b01bf348 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -2000,7 +2000,7 @@ static int32_t taosCfgDynamicOptionsForServer(SConfig *pCfg, const char *name) { {"tdbDebugFlag", &tdbDebugFlag}, {"tmrDebugFlag", &tmrDebugFlag}, {"uDebugFlag", &uDebugFlag}, {"smaDebugFlag", &smaDebugFlag}, {"rpcDebugFlag", &rpcDebugFlag}, {"qDebugFlag", &qDebugFlag}, {"metaDebugFlag", &metaDebugFlag}, {"stDebugFlag", &stDebugFlag}, {"sndDebugFlag", &sndDebugFlag}, - {"tqClientDebugFlag", &}tqClientDebugFlag, + {"tqClientDebugFlag", &tqClientDebugFlag}, }; static OptionNameAndVar options[] = {{"audit", &tsEnableAudit}, From 481ceefcdf8b294a4862afd4b97d1814406b10ba Mon Sep 17 00:00:00 2001 From: Pan Wei <72057773+dapan1121@users.noreply.github.com> Date: Mon, 28 Oct 2024 18:26:34 +0800 Subject: [PATCH 365/695] Update in.sim --- tests/script/tsim/scalar/in.sim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/script/tsim/scalar/in.sim b/tests/script/tsim/scalar/in.sim index f7fa2bcd2d57..a2164675f057 100644 --- a/tests/script/tsim/scalar/in.sim +++ b/tests/script/tsim/scalar/in.sim @@ -100,7 +100,7 @@ sql explain verbose true select * from tb1 where fts in ('2022-07-10 16:31:00', if $rows != 4 then return -1 endi -if $data20 != @ Time Range: [0, 1657441980000]@ then +if $data20 != @ Time Range: [1, 1657441980000]@ then return -1 endi @@ -108,7 +108,7 @@ sql explain verbose true select * from tb1 where fts in ('2022-07-10 16:31:00', if $rows != 4 then return -1 endi -if $data20 != @ Time Range: [1, 1657441980000]@ then +if $data20 != @ Time Range: [0, 1657441980000]@ then return -1 endi From 969400616851162a5ff368c71b810a9ff78ab4e3 Mon Sep 17 00:00:00 2001 From: Pan Wei <72057773+dapan1121@users.noreply.github.com> Date: Mon, 28 Oct 2024 18:27:12 +0800 Subject: [PATCH 366/695] Update filter.c --- source/libs/scalar/src/filter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/scalar/src/filter.c b/source/libs/scalar/src/filter.c index 2c449fced6cd..d8622d93eec5 100644 --- a/source/libs/scalar/src/filter.c +++ b/source/libs/scalar/src/filter.c @@ -4133,7 +4133,7 @@ int32_t fltSclBuildDatumFromValueNode(SFltSclDatum *datum, SValueNode *valNode) } case TSDB_DATA_TYPE_BOOL: { datum->kind = FLT_SCL_DATUM_KIND_INT64; - datum->i = (valNode->datum.b) ? 0 : 1; + datum->i = (valNode->datum.b) ? 1 : 0; break; } case TSDB_DATA_TYPE_TINYINT: From 8694eb99bee9a3e7a281b9afead7f0798b5e6c57 Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Mon, 28 Oct 2024 18:34:43 +0800 Subject: [PATCH 367/695] s3/chunksize tests: rename chunksize in cases --- tests/army/storage/s3/s3Basic.json | 2 +- tests/army/storage/s3/s3Basic.py | 10 +++++----- tests/army/storage/s3/s3Basic1.json | 2 +- tests/army/storage/s3/s3azure.py | 10 +++++----- tests/develop-test/2-query/show_create_db.py | 12 ++++++------ 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/tests/army/storage/s3/s3Basic.json b/tests/army/storage/s3/s3Basic.json index ee341b209613..2b911a989ff9 100644 --- a/tests/army/storage/s3/s3Basic.json +++ b/tests/army/storage/s3/s3Basic.json @@ -20,7 +20,7 @@ "replica": 1, "duration":"10d", "s3_keeplocal":"30d", - "s3_chunksize":"131072", + "s3_chunkpages":"131072", "tsdb_pagesize":"1", "s3_compact":"1", "wal_retention_size":"1", diff --git a/tests/army/storage/s3/s3Basic.py b/tests/army/storage/s3/s3Basic.py index bc55fe6f5cc2..273a6129e1ce 100644 --- a/tests/army/storage/s3/s3Basic.py +++ b/tests/army/storage/s3/s3Basic.py @@ -168,13 +168,13 @@ def checkCreateDb(self, keepLocal, chunkSize, compact): if keepLocal is not None: kw1 = f"s3_keeplocal {keepLocal}" if chunkSize is not None: - kw2 = f"s3_chunksize {chunkSize}" + kw2 = f"s3_chunkpages {chunkSize}" if compact is not None: kw3 = f"s3_compact {compact}" sql = f" create database db1 vgroups 1 duration 1h {kw1} {kw2} {kw3}" tdSql.execute(sql, show=True) - #sql = f"select name,s3_keeplocal,s3_chunksize,s3_compact from information_schema.ins_databases where name='db1';" + #sql = f"select name,s3_keeplocal,s3_chunkpages,s3_compact from information_schema.ins_databases where name='db1';" sql = f"select * from information_schema.ins_databases where name='db1';" tdSql.query(sql) # 29 30 31 -> chunksize keeplocal compact @@ -194,9 +194,9 @@ def checkExcept(self): f"create database db2 s3_keeplocal -1", f"create database db2 s3_keeplocal 0", f"create database db2 s3_keeplocal 365001", - f"create database db2 s3_chunksize -1", - f"create database db2 s3_chunksize 0", - f"create database db2 s3_chunksize 900000000", + f"create database db2 s3_chunkpages -1", + f"create database db2 s3_chunkpages 0", + f"create database db2 s3_chunkpages 900000000", f"create database db2 s3_compact -1", f"create database db2 s3_compact 100", f"create database db2 duration 1d s3_keeplocal 1d" diff --git a/tests/army/storage/s3/s3Basic1.json b/tests/army/storage/s3/s3Basic1.json index 02be308443c5..087f89edec4a 100644 --- a/tests/army/storage/s3/s3Basic1.json +++ b/tests/army/storage/s3/s3Basic1.json @@ -20,7 +20,7 @@ "replica": 1, "duration":"10d", "s3_keeplocal":"30d", - "s3_chunksize":"131072", + "s3_chunkpages":"131072", "tsdb_pagesize":"1", "s3_compact":"1", "wal_retention_size":"1", diff --git a/tests/army/storage/s3/s3azure.py b/tests/army/storage/s3/s3azure.py index 43857cb7ca58..e0226b0aa462 100644 --- a/tests/army/storage/s3/s3azure.py +++ b/tests/army/storage/s3/s3azure.py @@ -202,13 +202,13 @@ def checkCreateDb(self, keepLocal, chunkSize, compact): if keepLocal is not None: kw1 = f"s3_keeplocal {keepLocal}" if chunkSize is not None: - kw2 = f"s3_chunksize {chunkSize}" + kw2 = f"s3_chunkpages {chunkSize}" if compact is not None: kw3 = f"s3_compact {compact}" sql = f" create database db1 vgroups 1 duration 1h {kw1} {kw2} {kw3}" tdSql.execute(sql, show=True) - # sql = f"select name,s3_keeplocal,s3_chunksize,s3_compact from information_schema.ins_databases where name='db1';" + # sql = f"select name,s3_keeplocal,s3_chunkpages,s3_compact from information_schema.ins_databases where name='db1';" sql = f"select * from information_schema.ins_databases where name='db1';" tdSql.query(sql) # 29 30 31 -> chunksize keeplocal compact @@ -228,9 +228,9 @@ def checkExcept(self): f"create database db2 s3_keeplocal -1", f"create database db2 s3_keeplocal 0", f"create database db2 s3_keeplocal 365001", - f"create database db2 s3_chunksize -1", - f"create database db2 s3_chunksize 0", - f"create database db2 s3_chunksize 900000000", + f"create database db2 s3_chunkpages -1", + f"create database db2 s3_chunkpages 0", + f"create database db2 s3_chunkpages 900000000", f"create database db2 s3_compact -1", f"create database db2 s3_compact 100", f"create database db2 duration 1d s3_keeplocal 1d" diff --git a/tests/develop-test/2-query/show_create_db.py b/tests/develop-test/2-query/show_create_db.py index b77e744df209..a698a3e92e7a 100644 --- a/tests/develop-test/2-query/show_create_db.py +++ b/tests/develop-test/2-query/show_create_db.py @@ -42,17 +42,17 @@ def run(self): tdSql.query('show create database scd;') tdSql.checkRows(1) tdSql.checkData(0, 0, 'scd') - tdSql.checkData(0, 1, "CREATE DATABASE `scd` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 10d WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 2 KEEP 3650d,3650d,3650d PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 ENCRYPT_ALGORITHM 'none' S3_CHUNKSIZE 262144 S3_KEEPLOCAL 525600m S3_COMPACT 1") + tdSql.checkData(0, 1, "CREATE DATABASE `scd` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 10d WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 2 KEEP 3650d,3650d,3650d PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 ENCRYPT_ALGORITHM 'none' S3_CHUNKPAGES 262144 S3_KEEPLOCAL 525600m S3_COMPACT 1") tdSql.query('show create database scd2;') tdSql.checkRows(1) tdSql.checkData(0, 0, 'scd2') - tdSql.checkData(0, 1, "CREATE DATABASE `scd2` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 10d WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 3 KEEP 3650d,3650d,3650d PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 ENCRYPT_ALGORITHM 'none' S3_CHUNKSIZE 262144 S3_KEEPLOCAL 525600m S3_COMPACT 1") + tdSql.checkData(0, 1, "CREATE DATABASE `scd2` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 10d WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 3 KEEP 3650d,3650d,3650d PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 ENCRYPT_ALGORITHM 'none' S3_CHUNKPAGES 262144 S3_KEEPLOCAL 525600m S3_COMPACT 1") tdSql.query('show create database scd4') tdSql.checkRows(1) tdSql.checkData(0, 0, 'scd4') - tdSql.checkData(0, 1, "CREATE DATABASE `scd4` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 10d WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 13 KEEP 3650d,3650d,3650d PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 ENCRYPT_ALGORITHM 'none' S3_CHUNKSIZE 262144 S3_KEEPLOCAL 525600m S3_COMPACT 1") + tdSql.checkData(0, 1, "CREATE DATABASE `scd4` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 10d WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 13 KEEP 3650d,3650d,3650d PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 ENCRYPT_ALGORITHM 'none' S3_CHUNKPAGES 262144 S3_KEEPLOCAL 525600m S3_COMPACT 1") self.restartTaosd(1, dbname='scd') @@ -60,16 +60,16 @@ def run(self): tdSql.query('show create database scd;') tdSql.checkRows(1) tdSql.checkData(0, 0, 'scd') - tdSql.checkData(0, 1, "CREATE DATABASE `scd` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 10d WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 2 KEEP 3650d,3650d,3650d PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 ENCRYPT_ALGORITHM 'none' S3_CHUNKSIZE 262144 S3_KEEPLOCAL 525600m S3_COMPACT 1") + tdSql.checkData(0, 1, "CREATE DATABASE `scd` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 10d WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 2 KEEP 3650d,3650d,3650d PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 ENCRYPT_ALGORITHM 'none' S3_CHUNKPAGES 262144 S3_KEEPLOCAL 525600m S3_COMPACT 1") tdSql.query('show create database scd2;') tdSql.checkRows(1) tdSql.checkData(0, 0, 'scd2') - tdSql.checkData(0, 1, "CREATE DATABASE `scd2` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 10d WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 3 KEEP 3650d,3650d,3650d PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 ENCRYPT_ALGORITHM 'none' S3_CHUNKSIZE 262144 S3_KEEPLOCAL 525600m S3_COMPACT 1") + tdSql.checkData(0, 1, "CREATE DATABASE `scd2` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 10d WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 3 KEEP 3650d,3650d,3650d PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 ENCRYPT_ALGORITHM 'none' S3_CHUNKPAGES 262144 S3_KEEPLOCAL 525600m S3_COMPACT 1") tdSql.query('show create database scd4') tdSql.checkRows(1) tdSql.checkData(0, 0, 'scd4') - tdSql.checkData(0, 1, "CREATE DATABASE `scd4` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 10d WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 13 KEEP 3650d,3650d,3650d PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 ENCRYPT_ALGORITHM 'none' S3_CHUNKSIZE 262144 S3_KEEPLOCAL 525600m S3_COMPACT 1") + tdSql.checkData(0, 1, "CREATE DATABASE `scd4` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 10d WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 13 KEEP 3650d,3650d,3650d PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 ENCRYPT_ALGORITHM 'none' S3_CHUNKPAGES 262144 S3_KEEPLOCAL 525600m S3_COMPACT 1") tdSql.execute('drop database scd') From cea25e7f9d9da27d55da219b4b2cf06a94a14e4b Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Mon, 28 Oct 2024 18:44:41 +0800 Subject: [PATCH 368/695] fix: scheduler ut issues --- source/libs/executor/test/queryPlanTests.cpp | 2 ++ source/libs/scheduler/src/schJob.c | 4 ++-- source/libs/scheduler/test/schedulerTests.cpp | 19 ++++++++++++++++++- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/source/libs/executor/test/queryPlanTests.cpp b/source/libs/executor/test/queryPlanTests.cpp index 1e0129ce5b23..2b0c0e11188c 100755 --- a/source/libs/executor/test/queryPlanTests.cpp +++ b/source/libs/executor/test/queryPlanTests.cpp @@ -371,6 +371,8 @@ int32_t qptGetColumnRandLen(int32_t colType) { assert(0); break; } + + return 0; } diff --git a/source/libs/scheduler/src/schJob.c b/source/libs/scheduler/src/schJob.c index c52f779b75eb..ab9bc6a98fd0 100644 --- a/source/libs/scheduler/src/schJob.c +++ b/source/libs/scheduler/src/schJob.c @@ -334,7 +334,7 @@ int32_t schValidateAndBuildJob(SQueryPlan *pDag, SSchJob *pJob) { HASH_NO_LOCK); if (NULL == planToTask) { SCH_JOB_ELOG("taosHashInit %d failed", SCHEDULE_DEFAULT_MAX_TASK_NUM); - SCH_ERR_RET(terrno); + SCH_ERR_JRET(terrno); } pJob->levels = taosArrayInit(levelNum, sizeof(SSchLevel)); @@ -363,7 +363,7 @@ int32_t schValidateAndBuildJob(SQueryPlan *pDag, SSchJob *pJob) { pLevel = taosArrayGet(pJob->levels, i); if (NULL == pLevel) { SCH_JOB_ELOG("fail to get the %dth level, levelNum: %d", i, levelNum); - SCH_ERR_RET(TSDB_CODE_QRY_INVALID_INPUT); + SCH_ERR_JRET(TSDB_CODE_QRY_INVALID_INPUT); } pLevel->level = i; diff --git a/source/libs/scheduler/test/schedulerTests.cpp b/source/libs/scheduler/test/schedulerTests.cpp index 44d32b9480e8..6e13e37e88e8 100644 --- a/source/libs/scheduler/test/schedulerTests.cpp +++ b/source/libs/scheduler/test/schedulerTests.cpp @@ -203,6 +203,10 @@ void schtBuildQueryDag(SQueryPlan *dag) { return; } scanPlan->msgType = TDMT_SCH_QUERY; + code = nodesMakeNode(QUERY_NODE_PHYSICAL_PLAN_DISPATCH, (SNode**)&scanPlan->pDataSink); + if (NULL == scanPlan->pDataSink) { + return; + } mergePlan->id.queryId = qId; mergePlan->id.groupId = schtMergeTemplateId; @@ -223,6 +227,10 @@ void schtBuildQueryDag(SQueryPlan *dag) { return; } mergePlan->msgType = TDMT_SCH_QUERY; + code = nodesMakeNode(QUERY_NODE_PHYSICAL_PLAN_DISPATCH, (SNode**)&mergePlan->pDataSink); + if (NULL == mergePlan->pDataSink) { + return; + } merge->pNodeList = NULL; code = nodesMakeList(&merge->pNodeList); @@ -235,6 +243,7 @@ void schtBuildQueryDag(SQueryPlan *dag) { return; } + (void)nodesListAppend(merge->pNodeList, (SNode *)mergePlan); (void)nodesListAppend(scan->pNodeList, (SNode *)scanPlan); @@ -250,7 +259,7 @@ void schtBuildQueryFlowCtrlDag(SQueryPlan *dag) { int32_t scanPlanNum = 20; dag->queryId = qId; - dag->numOfSubplans = 2; + dag->numOfSubplans = scanPlanNum + 1; dag->pSubplans = NULL; int32_t code = nodesMakeList(&dag->pSubplans); if (NULL == dag->pSubplans) { @@ -289,6 +298,10 @@ void schtBuildQueryFlowCtrlDag(SQueryPlan *dag) { if (NULL == mergePlan->pChildren) { return; } + code = nodesMakeNode(QUERY_NODE_PHYSICAL_PLAN_DISPATCH, (SNode**)&mergePlan->pDataSink); + if (NULL == mergePlan->pDataSink) { + return; + } for (int32_t i = 0; i < scanPlanNum; ++i) { SSubplan *scanPlan = NULL; @@ -322,6 +335,10 @@ void schtBuildQueryFlowCtrlDag(SQueryPlan *dag) { return; } scanPlan->msgType = TDMT_SCH_QUERY; + code = nodesMakeNode(QUERY_NODE_PHYSICAL_PLAN_DISPATCH, (SNode**)&scanPlan->pDataSink); + if (NULL == scanPlan->pDataSink) { + return; + } (void)nodesListAppend(scanPlan->pParents, (SNode *)mergePlan); (void)nodesListAppend(mergePlan->pChildren, (SNode *)scanPlan); From 570b69c30d4626fa6df8f15411615598ee61999d Mon Sep 17 00:00:00 2001 From: chenhaoran Date: Mon, 28 Oct 2024 18:55:14 +0800 Subject: [PATCH 369/695] test:verify the output of the stream with tag filtering is correct when a new child table with matching tag conditions is created --- .../8-stream/force_window_close_interval.py | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/tests/system-test/8-stream/force_window_close_interval.py b/tests/system-test/8-stream/force_window_close_interval.py index 0cad878895ca..8eeca329da12 100644 --- a/tests/system-test/8-stream/force_window_close_interval.py +++ b/tests/system-test/8-stream/force_window_close_interval.py @@ -111,7 +111,7 @@ def force_window_close(self, interval, partition="tbname", funciton_name="", fun if partition: tdLog.info("create stream with partition by tag and tbname ") partition_elm_new = f'partition by {partition}, t1' - self.tdCom.create_stream(stream_name=f'{self.stb_name}_partition_tag{self.tdCom.stream_suffix}', des_table=f'{self.stb_name}_partition_tag{self.tdCom.des_table_suffix}', source_sql=f'select _irowts as irowts, tbname as table_name, _isfilled as isfilled, {funciton_name} as {funciton_name_alias} from {self.stb_name} {partition_elm_new} every({self.tdCom.dataDict["interval"]}s)', trigger_mode=trigger_mode, fill_value=fill_value, fill_history_value=fill_history_value,ignore_expired=ignore_expired,ignore_update=ignore_update) + self.tdCom.create_stream(stream_name=f'{self.stb_name}_partition_tag{self.tdCom.stream_suffix}', des_table=f'{self.stb_name}_partition_tag{self.tdCom.des_table_suffix}', source_sql=f'select _irowts as irowts, tbname as table_name, t1 as t_t1, _isfilled as isfilled, {funciton_name} as {funciton_name_alias} from {self.stb_name} {partition_elm_new} every({self.tdCom.dataDict["interval"]}s)', trigger_mode=trigger_mode, fill_value=fill_value, fill_history_value=fill_history_value,ignore_expired=ignore_expired,ignore_update=ignore_update) partition_elm_new = f'partition by {partition}, c1' self.tdCom.create_stream(stream_name=f'{self.stb_name}_partition_column1{self.tdCom.stream_suffix}', des_table=f'{self.stb_name}_partition_column1{self.tdCom.des_table_suffix}', source_sql=f'select _irowts as irowts, tbname as table_name, c1 as c_c1, _isfilled as isfilled, {funciton_name} as {funciton_name_alias} from {self.stb_name} {partition_elm_new} every({self.tdCom.dataDict["interval"]}s)', trigger_mode=trigger_mode, fill_value=fill_value, fill_history_value=fill_history_value,ignore_expired=ignore_expired,ignore_update=ignore_update) partition_elm_new = f'partition by {partition}, c2' @@ -125,6 +125,7 @@ def force_window_close(self, interval, partition="tbname", funciton_name="", fun tdLog.info("create stream general table") self.tdCom.create_stream(stream_name=f'{self.tb_name}{self.tdCom.stream_suffix}', des_table=self.tb_stream_des_table, source_sql=f'select _irowts as irowts,tbname as table_name, _isfilled as isfilled, {funciton_name} as {funciton_name_alias} from {self.tb_name} every({self.tdCom.dataDict["interval"]}s)', trigger_mode=trigger_mode, fill_value=fill_value, fill_history_value=fill_history_value,ignore_expired=ignore_expired,ignore_update=ignore_update) + # insert data self.tdCom.date_time = self.tdCom.genTs(precision=self.tdCom.precision)[0] start_time = self.tdCom.date_time time.sleep(1) @@ -224,9 +225,13 @@ def force_window_close(self, interval, partition="tbname", funciton_name="", fun # get query time range using interval count windows tdSql.query(f'select _wstart, _wend ,last(ts) from {self.stb_name} where ts >= {start_force_ts} and ts <= {end_ts} partition by tbname interval({self.tdCom.dataDict["interval"]}s)fill ({fill_value}) ') + # getData don't support negative index end_new_ts = tdSql.getData(tdSql.queryRows-1, 1) + end_last_but_one_ts = tdSql.getData(tdSql.queryRows-2, 1) + #source data include that fill valuse is null and "_isfilled" column of the stream output is false tdSql.execute(f"insert into {self.ctb_name} (ts,c1) values(\"{end_new_ts}\",-102) ") tdSql.execute(f"insert into {self.tb_name} (ts,c1) values(\"{end_new_ts}\",-51) ") + tdSql.execute(f"insert into {self.ctb_name} (ts,c1) values(\"{end_last_but_one_ts}\",NULL) ") for i in range(self.tdCom.range_count): ts_value = str(self.tdCom.date_time+self.tdCom.dataDict["interval"])+f'+{i*10}s' @@ -240,6 +245,7 @@ def force_window_close(self, interval, partition="tbname", funciton_name="", fun self.tdCom.sdelete_rows(tbname=self.tb_name, start_ts=self.tdCom.time_cast(start_time), end_ts=ts_cast_delete_value) # wait for the stream to process the data + # print(self.tdCom.dataDict["interval"]*(final_range_count+2)) time.sleep(self.tdCom.dataDict["interval"]*(final_range_count+2)) # check the data @@ -247,11 +253,13 @@ def force_window_close(self, interval, partition="tbname", funciton_name="", fun print(tbname) tdSql.query(f'select _wstart, _wend ,last(ts) from {tbname} where ts >= {start_force_ts} and ts <= {end_ts} partition by tbname interval({self.tdCom.dataDict["interval"]}s)fill ({fill_value}) ') start_new_ts = tdSql.getData(0, 1) - if tbname != self.tb_name: + if tbname == self.ctb_name: if "value" in fill_value.lower(): fill_value='VALUE,1,2,3,6,7,8,9,10,11,1,2,3,4,5,6,7,8,9,10,11' if partition == "tbname": - # print(self.tdCom.dataDict["interval"]*(final_range_count+2)) + self.tdCom.check_query_data(f'select irowts, table_name, isfilled, {funciton_name_alias} from {tbname}{self.tdCom.des_table_suffix} where irowts >= {start_force_ts} and irowts <= "{end_new_ts}" order by irowts', f'select _irowts as irowts ,tbname as table_name, _isfilled as isfilled , {funciton_name} as {funciton_name_alias} from {tbname} partition by {partition} range("{start_new_ts}","{end_new_ts}") every({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by irowts', fill_value=fill_value) + elif tbname == self.stb_name: + if partition == "tbname": self.tdCom.check_query_data(f'select irowts, table_name, isfilled, {funciton_name_alias} from {tbname}{self.tdCom.des_table_suffix} where irowts >= {start_force_ts} and irowts <= "{end_new_ts}" order by irowts', f'select _irowts as irowts ,tbname as table_name, _isfilled as isfilled , {funciton_name} as {funciton_name_alias} from {tbname} partition by {partition} range("{start_new_ts}","{end_new_ts}") every({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by irowts', fill_value=fill_value) # check tag and tbname filter self.tdCom.check_query_data(f'select irowts, table_name, isfilled, {funciton_name_alias} from {self.stb_stream_des_where_tag_table} where irowts >= {start_force_ts} and irowts <= "{end_new_ts}" order by irowts', f'select _irowts as irowts ,tbname as table_name, _isfilled as isfilled , {funciton_name} as {funciton_name_alias} from {tbname} {where_tag} partition by {partition} range("{start_new_ts}","{end_new_ts}") every({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by irowts', fill_value=fill_value) @@ -262,6 +270,18 @@ def force_window_close(self, interval, partition="tbname", funciton_name="", fun if partition == "tbname": self.tdCom.check_query_data(f'select irowts, isfilled, {funciton_name_alias} from {tbname}{self.tdCom.des_table_suffix} where irowts >= {start_force_ts} and irowts <= "{end_new_ts}" order by irowts', f'select _irowts as irowts , _isfilled as isfilled , {funciton_name} as {funciton_name_alias} from {tbname} partition by {partition} range("{start_new_ts}","{end_new_ts}") every({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by irowts', fill_value=fill_value) + # Recreate a sub-table that meets the filtering "where_tag" and check if the streaming results are automatically included within it." + where_tag_ctbname = f"{self.ctb_name}_where_tag" + tdSql.execute(f"create table {where_tag_ctbname} using {self.stb_name} (t1) tags({tag_t1_value}) ") + where_tag_timestamp = self.tdCom.genTs(precision=self.tdCom.precision)[0] + where_tag_ts_start_value = str(where_tag_timestamp)+ '+2s' + self.tdCom.sinsert_rows(tbname=where_tag_ctbname, ts_value=where_tag_ts_start_value) + time.sleep(self.tdCom.dataDict["interval"]+5) + tdSql.query(f'select distinct(table_name) from {self.stb_stream_des_where_tag_table} where table_name="{where_tag_ctbname}"') + tdSql.checkEqual(tdSql.queryResult[0][0], where_tag_ctbname) + + + if self.delete: self.tdCom.sdelete_rows(tbname=self.ctb_name, start_ts=start_ts, end_ts=ts_cast_delete_value) self.tdCom.sdelete_rows(tbname=self.tb_name, start_ts=start_ts, end_ts=ts_cast_delete_value) From cacc7db61cc0b8be237a523ba49b94fb62e0c6e2 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Mon, 28 Oct 2024 19:33:11 +0800 Subject: [PATCH 370/695] fix(stream): set the correct start ts. --- source/libs/stream/inc/streamInt.h | 2 +- source/libs/stream/src/streamData.c | 8 ++++---- source/libs/stream/src/streamSched.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/source/libs/stream/inc/streamInt.h b/source/libs/stream/inc/streamInt.h index 6d49e6b10c6e..190f009e8870 100644 --- a/source/libs/stream/inc/streamInt.h +++ b/source/libs/stream/inc/streamInt.h @@ -240,7 +240,7 @@ int32_t initCheckpointReadyMsg(SStreamTask* pTask, int32_t upstreamNodeId, int32 int32_t flushStateDataInExecutor(SStreamTask* pTask, SStreamQueueItem* pCheckpointBlock); int32_t streamCreateSinkResTrigger(SStreamTrigger** pTrigger); int32_t streamCreateForcewindowTrigger(SStreamTrigger** pTrigger, int32_t trigger, SInterval* pInterval, - STimeWindow* pLatestWindow); + STimeWindow* pLatestWindow, const char* id); #ifdef __cplusplus } diff --git a/source/libs/stream/src/streamData.c b/source/libs/stream/src/streamData.c index 4bbff3ad2143..306d6a02390e 100644 --- a/source/libs/stream/src/streamData.c +++ b/source/libs/stream/src/streamData.c @@ -307,7 +307,7 @@ void streamFreeQitem(SStreamQueueItem* data) { } } -int32_t streamCreateForcewindowTrigger(SStreamTrigger** pTrigger, int32_t trigger, SInterval* pInterval, STimeWindow* pLatestWindow) { +int32_t streamCreateForcewindowTrigger(SStreamTrigger** pTrigger, int32_t trigger, SInterval* pInterval, STimeWindow* pLatestWindow, const char* id) { QRY_PARAM_CHECK(pTrigger); int64_t ts = INT64_MIN; SStreamTrigger* p = NULL; @@ -333,7 +333,7 @@ int32_t streamCreateForcewindowTrigger(SStreamTrigger** pTrigger, int32_t trigge ts = taosGetTimestampMs(); if (pLatestWindow->skey == INT64_MIN) { - STimeWindow window = getAlignQueryTimeWindow(&interval, ts); + STimeWindow window = getAlignQueryTimeWindow(&interval, ts - trigger); p->pBlock->info.window.skey = window.skey; p->pBlock->info.window.ekey = TMAX(ts, window.ekey); @@ -344,8 +344,8 @@ int32_t streamCreateForcewindowTrigger(SStreamTrigger** pTrigger, int32_t trigge } p->pBlock->info.type = STREAM_GET_RESULT; - stDebug("force_window_close trigger block generated, window range:%" PRId64 "-%" PRId64, p->pBlock->info.window.skey, - p->pBlock->info.window.ekey); + stDebug("s-task:%s force_window_close trigger block generated, window range:%" PRId64 "-%" PRId64, id, + p->pBlock->info.window.skey, p->pBlock->info.window.ekey); *pTrigger = p; return code; diff --git a/source/libs/stream/src/streamSched.c b/source/libs/stream/src/streamSched.c index 042d082ed9b3..74cbc0161719 100644 --- a/source/libs/stream/src/streamSched.c +++ b/source/libs/stream/src/streamSched.c @@ -181,7 +181,7 @@ void streamTaskSchedHelper(void* param, void* tmrId) { while (1) { code = streamCreateForcewindowTrigger(&pTrigger, pTask->info.delaySchedParam, &pTask->info.interval, - &pTask->status.latestForceWindow); + &pTask->status.latestForceWindow, id); if (code != 0) { stError("s-task:%s failed to prepare force window close trigger, code:%s, try again in %dms", id, tstrerror(code), nextTrigger); From 85989212c64e8cdeb16ef865a177a569bbb0be61 Mon Sep 17 00:00:00 2001 From: xsren <285808407@qq.com> Date: Mon, 28 Oct 2024 19:38:56 +0800 Subject: [PATCH 371/695] fix: set scolumnInfo nodata flag where table scan notload --- include/common/tmsg.h | 2 +- source/common/src/tdatablock.c | 8 ++++++-- source/libs/executor/src/executil.c | 2 +- source/libs/executor/src/scanoperator.c | 13 +++++++++++++ source/libs/planner/src/planPhysiCreater.c | 8 ++++---- 5 files changed, 25 insertions(+), 8 deletions(-) diff --git a/include/common/tmsg.h b/include/common/tmsg.h index 14e3f9b0ebb7..d6aad934e04a 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -1215,7 +1215,7 @@ typedef struct { int32_t bytes; int8_t type; uint8_t pk; - bool reserve; + bool noData; } SColumnInfo; typedef struct STimeWindow { diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c index 5ac5ffdd9bef..4724a3d241e6 100644 --- a/source/common/src/tdatablock.c +++ b/source/common/src/tdatablock.c @@ -3544,7 +3544,7 @@ int32_t blockDataCheck(const SSDataBlock* pDataBlock) { BLOCK_DATA_CHECK_TRESSA(pCol != NULL); isVarType = IS_VAR_DATA_TYPE(pCol->info.type); checkRows = pDataBlock->info.rows; - if (pCol->info.reserve == false) continue; + if (pCol->info.noData == true) continue; if (isVarType) { BLOCK_DATA_CHECK_TRESSA(pCol->varmeta.offset); @@ -3578,7 +3578,11 @@ int32_t blockDataCheck(const SSDataBlock* pDataBlock) { colLen = varDataTLen(pColData); } - BLOCK_DATA_CHECK_TRESSA(colLen >= VARSTR_HEADER_SIZE); + if (pCol->info.type == TSDB_DATA_TYPE_JSON) { + BLOCK_DATA_CHECK_TRESSA(colLen >= CHAR_BYTES); + } else { + BLOCK_DATA_CHECK_TRESSA(colLen >= VARSTR_HEADER_SIZE); + } BLOCK_DATA_CHECK_TRESSA(colLen <= pCol->info.bytes); if (pCol->reassigned) { diff --git a/source/libs/executor/src/executil.c b/source/libs/executor/src/executil.c index 1a43d423488c..8cd573e971e1 100644 --- a/source/libs/executor/src/executil.c +++ b/source/libs/executor/src/executil.c @@ -390,7 +390,7 @@ SSDataBlock* createDataBlockFromDescNode(SDataBlockDescNode* pNode) { createColumnInfoData(pDescNode->dataType.type, pDescNode->dataType.bytes, pDescNode->slotId); idata.info.scale = pDescNode->dataType.scale; idata.info.precision = pDescNode->dataType.precision; - idata.info.reserve = pDescNode->reserve; + idata.info.noData = pDescNode->reserve; code = blockDataAppendColInfo(pBlock, &idata); if (code != TSDB_CODE_SUCCESS) { diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index bae9926f6370..f936e9500509 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -1461,6 +1461,18 @@ static void destroyTableScanOperatorInfo(void* param) { taosMemoryFreeClear(param); } +static void resetClolumnReserve(SSDataBlock* pBlock, int32_t dataRequireFlag) { + if (pBlock && dataRequireFlag == FUNC_DATA_REQUIRED_NOT_LOAD) { + int32_t numOfCols = taosArrayGetSize(pBlock->pDataBlock); + for (int32_t i = 0; i < numOfCols; ++i) { + SColumnInfoData* pCol = (SColumnInfoData*)taosArrayGet(pBlock->pDataBlock, i); + if (pCol) { + pCol->info.noData = true; + } + } + } +} + int32_t createTableScanOperatorInfo(STableScanPhysiNode* pTableScanNode, SReadHandle* readHandle, STableListInfo* pTableListInfo, SExecTaskInfo* pTaskInfo, SOperatorInfo** pOptrInfo) { @@ -1511,6 +1523,7 @@ int32_t createTableScanOperatorInfo(STableScanPhysiNode* pTableScanNode, SReadHa pInfo->base.readerAPI = pTaskInfo->storageAPI.tsdReader; initResultSizeInfo(&pOperator->resultInfo, 4096); pInfo->pResBlock = createDataBlockFromDescNode(pDescNode); + resetClolumnReserve(pInfo->pResBlock, pInfo->base.dataBlockLoadFlag); QUERY_CHECK_NULL(pInfo->pResBlock, code, lino, _error, terrno); code = prepareDataBlockBuf(pInfo->pResBlock, &pInfo->base.matchInfo); diff --git a/source/libs/planner/src/planPhysiCreater.c b/source/libs/planner/src/planPhysiCreater.c index a48504b79dd9..a67071516da2 100644 --- a/source/libs/planner/src/planPhysiCreater.c +++ b/source/libs/planner/src/planPhysiCreater.c @@ -233,7 +233,7 @@ static int32_t buildDataBlockSlots(SPhysiPlanContext* pCxt, SNodeList* pList, SD int32_t len = 0; code = getSlotKey(pNode, NULL, &name, &len, 16); if (TSDB_CODE_SUCCESS == code) { - code = nodesListStrictAppend(pDataBlockDesc->pSlots, createSlotDesc(pCxt, name, pNode, slotId, true, true)); + code = nodesListStrictAppend(pDataBlockDesc->pSlots, createSlotDesc(pCxt, name, pNode, slotId, true, false)); } code = putSlotToHash(name, len, pDataBlockDesc->dataBlockId, slotId, pNode, pHash); if (TSDB_CODE_SUCCESS == code) { @@ -341,7 +341,7 @@ static int32_t addDataBlockSlotsImpl(SPhysiPlanContext* pCxt, SNodeList* pList, } static int32_t addDataBlockSlots(SPhysiPlanContext* pCxt, SNodeList* pList, SDataBlockDescNode* pDataBlockDesc) { - return addDataBlockSlotsImpl(pCxt, pList, pDataBlockDesc, NULL, false, false); + return addDataBlockSlotsImpl(pCxt, pList, pDataBlockDesc, NULL, false, true); } static int32_t addDataBlockSlot(SPhysiPlanContext* pCxt, SNode** pNode, SDataBlockDescNode* pDataBlockDesc) { @@ -363,11 +363,11 @@ static int32_t addDataBlockSlot(SPhysiPlanContext* pCxt, SNode** pNode, SDataBlo static int32_t addDataBlockSlotsForProject(SPhysiPlanContext* pCxt, const char* pStmtName, SNodeList* pList, SDataBlockDescNode* pDataBlockDesc) { - return addDataBlockSlotsImpl(pCxt, pList, pDataBlockDesc, pStmtName, false, false); + return addDataBlockSlotsImpl(pCxt, pList, pDataBlockDesc, pStmtName, false, true); } static int32_t pushdownDataBlockSlots(SPhysiPlanContext* pCxt, SNodeList* pList, SDataBlockDescNode* pDataBlockDesc) { - return addDataBlockSlotsImpl(pCxt, pList, pDataBlockDesc, NULL, true, false); + return addDataBlockSlotsImpl(pCxt, pList, pDataBlockDesc, NULL, true, true); } typedef struct SSetSlotIdCxt { From 6c155d949e43457561ce02147b99dca0ab263ae9 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Mon, 28 Oct 2024 23:13:31 +0800 Subject: [PATCH 372/695] fix:[TS-5441] test case error --- tests/system-test/2-query/db.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/system-test/2-query/db.py b/tests/system-test/2-query/db.py index cd7c5bd26eb5..d4e5f89aa3a0 100644 --- a/tests/system-test/2-query/db.py +++ b/tests/system-test/2-query/db.py @@ -57,7 +57,7 @@ def case2(self): tdSql.checkData(0, 2, 0) tdSql.query("show dnode 1 variables like '%debugFlag'") - tdSql.checkRows(24) + tdSql.checkRows(25) tdSql.query("show dnode 1 variables like '____debugFlag'") tdSql.checkRows(2) From 1463bd3efdcfc2fa3d5333ad44fb327c45b17804 Mon Sep 17 00:00:00 2001 From: xsren <285808407@qq.com> Date: Tue, 29 Oct 2024 00:03:40 +0800 Subject: [PATCH 373/695] fix: show streams --- source/common/src/systable.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/common/src/systable.c b/source/common/src/systable.c index eef38bf18eee..211aa2064504 100644 --- a/source/common/src/systable.c +++ b/source/common/src/systable.c @@ -165,8 +165,8 @@ static const SSysDbTableSchema userStbsSchema[] = { static const SSysDbTableSchema streamSchema[] = { {.name = "stream_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false}, {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = false}, - {.name = "stream_id", .bytes = 16 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false}, - {.name = "history_id", .bytes = 16 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false}, + {.name = "stream_id", .bytes = 19 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false}, + {.name = "history_id", .bytes = 19 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false}, {.name = "sql", .bytes = TSDB_SHOW_SQL_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false}, {.name = "status", .bytes = 20 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false}, {.name = "source_db", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false}, From 4bd1e0c3cf2b62d2d20cf3c01013519f475cd0cc Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Tue, 29 Oct 2024 00:20:04 +0800 Subject: [PATCH 374/695] test: add test cases. --- tests/script/tsim/stream/forcewindowclose.sim | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 tests/script/tsim/stream/forcewindowclose.sim diff --git a/tests/script/tsim/stream/forcewindowclose.sim b/tests/script/tsim/stream/forcewindowclose.sim new file mode 100644 index 000000000000..77def52b3cbb --- /dev/null +++ b/tests/script/tsim/stream/forcewindowclose.sim @@ -0,0 +1,50 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sleep 50 +sql connect + +print =============== create database +sql create database test vgroups 2; +sql select * from information_schema.ins_databases +if $rows != 3 then + return -1 +endi + +print $data00 $data01 $data02 + +sql use test +sql create stable st(ts timestamp, a int) tags(t int); +sql create table tu1 using st tags(1); + +sql create stream stream1 trigger force_window_close into str_dst as select _wstart, count(*) from st partition by tbname interval(5s); + +run tsim/stream/checkTaskStatus.sim + +sql insert into tu1 values(now, 1); +sleep 5500 + +sql pause stream stream1 + +$loop_count = 0 + +loop0: +sleep 500 +$loop_count = $loop_count + 1 +if $loop_count == 20 then + goto end_loop +endi + +sql insert into tu1 values(now, 1); +goto loop0 + +end_loop: + +sql resume stream stream1 +sql select * from str_dst + +if $rows != 3 then + print expect 3, actual: $rows +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT From 2a1bb79206651887766ed81c1ac3702abfd26a79 Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Tue, 29 Oct 2024 08:33:53 +0800 Subject: [PATCH 375/695] fix default values for s3_chunkpages in test cases --- tests/develop-test/2-query/show_create_db.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/develop-test/2-query/show_create_db.py b/tests/develop-test/2-query/show_create_db.py index a698a3e92e7a..9589b6dc6fdf 100644 --- a/tests/develop-test/2-query/show_create_db.py +++ b/tests/develop-test/2-query/show_create_db.py @@ -42,17 +42,17 @@ def run(self): tdSql.query('show create database scd;') tdSql.checkRows(1) tdSql.checkData(0, 0, 'scd') - tdSql.checkData(0, 1, "CREATE DATABASE `scd` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 10d WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 2 KEEP 3650d,3650d,3650d PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 ENCRYPT_ALGORITHM 'none' S3_CHUNKPAGES 262144 S3_KEEPLOCAL 525600m S3_COMPACT 1") + tdSql.checkData(0, 1, "CREATE DATABASE `scd` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 10d WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 2 KEEP 3650d,3650d,3650d PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 ENCRYPT_ALGORITHM 'none' S3_CHUNKPAGES 131072 S3_KEEPLOCAL 525600m S3_COMPACT 1") tdSql.query('show create database scd2;') tdSql.checkRows(1) tdSql.checkData(0, 0, 'scd2') - tdSql.checkData(0, 1, "CREATE DATABASE `scd2` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 10d WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 3 KEEP 3650d,3650d,3650d PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 ENCRYPT_ALGORITHM 'none' S3_CHUNKPAGES 262144 S3_KEEPLOCAL 525600m S3_COMPACT 1") + tdSql.checkData(0, 1, "CREATE DATABASE `scd2` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 10d WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 3 KEEP 3650d,3650d,3650d PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 ENCRYPT_ALGORITHM 'none' S3_CHUNKPAGES 131072 S3_KEEPLOCAL 525600m S3_COMPACT 1") tdSql.query('show create database scd4') tdSql.checkRows(1) tdSql.checkData(0, 0, 'scd4') - tdSql.checkData(0, 1, "CREATE DATABASE `scd4` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 10d WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 13 KEEP 3650d,3650d,3650d PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 ENCRYPT_ALGORITHM 'none' S3_CHUNKPAGES 262144 S3_KEEPLOCAL 525600m S3_COMPACT 1") + tdSql.checkData(0, 1, "CREATE DATABASE `scd4` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 10d WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 13 KEEP 3650d,3650d,3650d PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 ENCRYPT_ALGORITHM 'none' S3_CHUNKPAGES 131072 S3_KEEPLOCAL 525600m S3_COMPACT 1") self.restartTaosd(1, dbname='scd') @@ -60,16 +60,16 @@ def run(self): tdSql.query('show create database scd;') tdSql.checkRows(1) tdSql.checkData(0, 0, 'scd') - tdSql.checkData(0, 1, "CREATE DATABASE `scd` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 10d WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 2 KEEP 3650d,3650d,3650d PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 ENCRYPT_ALGORITHM 'none' S3_CHUNKPAGES 262144 S3_KEEPLOCAL 525600m S3_COMPACT 1") + tdSql.checkData(0, 1, "CREATE DATABASE `scd` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 10d WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 2 KEEP 3650d,3650d,3650d PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 ENCRYPT_ALGORITHM 'none' S3_CHUNKPAGES 131072 S3_KEEPLOCAL 525600m S3_COMPACT 1") tdSql.query('show create database scd2;') tdSql.checkRows(1) tdSql.checkData(0, 0, 'scd2') - tdSql.checkData(0, 1, "CREATE DATABASE `scd2` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 10d WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 3 KEEP 3650d,3650d,3650d PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 ENCRYPT_ALGORITHM 'none' S3_CHUNKPAGES 262144 S3_KEEPLOCAL 525600m S3_COMPACT 1") + tdSql.checkData(0, 1, "CREATE DATABASE `scd2` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 10d WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 3 KEEP 3650d,3650d,3650d PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 ENCRYPT_ALGORITHM 'none' S3_CHUNKPAGES 131072 S3_KEEPLOCAL 525600m S3_COMPACT 1") tdSql.query('show create database scd4') tdSql.checkRows(1) tdSql.checkData(0, 0, 'scd4') - tdSql.checkData(0, 1, "CREATE DATABASE `scd4` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 10d WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 13 KEEP 3650d,3650d,3650d PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 ENCRYPT_ALGORITHM 'none' S3_CHUNKPAGES 262144 S3_KEEPLOCAL 525600m S3_COMPACT 1") + tdSql.checkData(0, 1, "CREATE DATABASE `scd4` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 10d WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 13 KEEP 3650d,3650d,3650d PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 ENCRYPT_ALGORITHM 'none' S3_CHUNKPAGES 131072 S3_KEEPLOCAL 525600m S3_COMPACT 1") tdSql.execute('drop database scd') From fb16e4912e7ae093f9e8072acd8c1fd9fbcf1743 Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Tue, 29 Oct 2024 08:49:11 +0800 Subject: [PATCH 376/695] rename s3_chunksize to s3_chunkpages & fix default value --- docs/zh/08-operation/12-multi.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/zh/08-operation/12-multi.md b/docs/zh/08-operation/12-multi.md index 6afd6427529f..5489226ce174 100644 --- a/docs/zh/08-operation/12-multi.md +++ b/docs/zh/08-operation/12-multi.md @@ -109,7 +109,7 @@ s3migrate database ; | # | 参数 | 默认值 | 最小值 | 最大值 | 描述 | | :--- | :----------- | :----- | :----- | :------ | :----------------------------------------------------------- | | 1 | s3_keeplocal | 365 | 1 | 365000 | 数据在本地保留的天数,即 data 文件在本地磁盘保留多长时间后可以上传到 S3。默认单位:天,支持 m(分钟)、h(小时)和 d(天)三个单位 | -| 2 | s3_chunksize | 131072 | 131072 | 1048576 | 上传对象的大小阈值,与 tsdb_pagesize 参数一样,不可修改,单位为 TSDB 页 | +| 2 | s3_chunkpages | 131072 | 131072 | 1048576 | 上传对象的大小阈值,与 tsdb_pagesize 参数一样,不可修改,单位为 TSDB 页 | | 3 | s3_compact | 1 | 0 | 1 | TSDB 文件组首次上传 S3 时,是否自动进行 compact 操作。 | ### 对象存储读写次数估算 @@ -118,13 +118,13 @@ s3migrate database ; #### 数据上传 -当 TSDB 时序数据超过 `s3_keeplocal` 参数指定的时间,相关的数据文件会被切分成多个文件块,每个文件块的默认大小是 500M 字节 (`s3_chunksize * tsdb_pagesize`)。除了最后一个文件块保留在本地文件系统外,其余的文件块会被上传到对象存储服务。 +当 TSDB 时序数据超过 `s3_keeplocal` 参数指定的时间,相关的数据文件会被切分成多个文件块,每个文件块的默认大小是 512M 字节 (`s3_chunkpages * tsdb_pagesize`)。除了最后一个文件块保留在本地文件系统外,其余的文件块会被上传到对象存储服务。 ```math -上传次数 = 数据文件大小 / (s3_chunksize * tsdb_pagesize) - 1 +上传次数 = 数据文件大小 / (s3_chunkpages * tsdb_pagesize) - 1 ``` -在创建数据库时,可以通过 `s3_chunksize` 参数调整每个文件块的大小,从而控制每个数据文件的上传次数。 +在创建数据库时,可以通过 `s3_chunkpages` 参数调整每个文件块的大小,从而控制每个数据文件的上传次数。 其它类型的文件如 head, stt, sma 等,保留在本地文件系统,以加速预计算相关查询。 From 82b17bdd96fa7b3ee8e811b6c54da1c8e807975c Mon Sep 17 00:00:00 2001 From: chenhaoran Date: Tue, 29 Oct 2024 09:15:44 +0800 Subject: [PATCH 377/695] test:use the black tool to format the code style --- .../8-stream/force_window_close_interval.py | 528 +++++++++++++----- 1 file changed, 401 insertions(+), 127 deletions(-) diff --git a/tests/system-test/8-stream/force_window_close_interval.py b/tests/system-test/8-stream/force_window_close_interval.py index 8eeca329da12..af06cfdfd3ad 100644 --- a/tests/system-test/8-stream/force_window_close_interval.py +++ b/tests/system-test/8-stream/force_window_close_interval.py @@ -5,31 +5,52 @@ from util.cases import * from util.common import * + class TDTestCase: - updatecfgDict = {'debugFlag': 135, 'asynclog': 0} + updatecfgDict = {"debugFlag": 135, "asynclog": 0} + def init(self, conn, logSql, replicaVar=1): self.replicaVar = int(replicaVar) tdLog.debug("start to execute %s" % __file__) tdSql.init(conn.cursor(), logSql) self.tdCom = tdCom - def force_window_close(self, interval, partition="tbname", funciton_name="", funciton_name_alias= "",delete=False, fill_value=None, fill_history_value=None, case_when=None, ignore_expired=1, ignore_update=1): + def force_window_close( + self, + interval, + partition="tbname", + funciton_name="", + funciton_name_alias="", + delete=False, + fill_value=None, + fill_history_value=None, + case_when=None, + ignore_expired=1, + ignore_update=1, + ): # partition must be tbname, and not NONE. - tdLog.info(f"*** testing stream force_window_close+interp+every: every: {interval}, partition: {partition}, fill_history: {fill_history_value}, fill: {fill_value}, delete: {delete}, case_when: {case_when} ***") - self.tdCom.subtable=False - col_value_type = "Incremental" if partition=="c1" else "random" - custom_col_index = 1 if partition=="c1" else None + tdLog.info( + f"*** testing stream force_window_close+interp+every: every: {interval}, partition: {partition}, fill_history: {fill_history_value}, fill: {fill_value}, delete: {delete}, case_when: {case_when} ***" + ) + self.tdCom.subtable = False + col_value_type = "Incremental" if partition == "c1" else "random" + custom_col_index = 1 if partition == "c1" else None self.tdCom.custom_col_val = 0 self.delete = delete self.tdCom.case_name = sys._getframe().f_code.co_name - self.tdCom.prepare_data(interval=interval, fill_history_value=fill_history_value, custom_col_index=custom_col_index, col_value_type=col_value_type) + self.tdCom.prepare_data( + interval=interval, + fill_history_value=fill_history_value, + custom_col_index=custom_col_index, + col_value_type=col_value_type, + ) self.stb_name = self.tdCom.stb_name.replace(f"{self.tdCom.dbname}.", "") self.ctb_name = self.tdCom.ctb_name.replace(f"{self.tdCom.dbname}.", "") self.tb_name = self.tdCom.tb_name.replace(f"{self.tdCom.dbname}.", "") - self.stb_stream_des_table = f'{self.stb_name}{self.tdCom.des_table_suffix}' - - self.ctb_stream_des_table = f'{self.ctb_name}{self.tdCom.des_table_suffix}' - self.tb_stream_des_table = f'{self.tb_name}{self.tdCom.des_table_suffix}' + self.stb_stream_des_table = f"{self.stb_name}{self.tdCom.des_table_suffix}" + + self.ctb_stream_des_table = f"{self.ctb_name}{self.tdCom.des_table_suffix}" + self.tb_stream_des_table = f"{self.tb_name}{self.tdCom.des_table_suffix}" if partition == "tbname": if case_when: stream_case_when_partition = case_when @@ -52,161 +73,333 @@ def force_window_close(self, interval, partition="tbname", funciton_name="", fun partition_elm_alias = self.tdCom.partition_tag_alias if partition == "tbname" or partition is None: if case_when: - stb_subtable_value = f'concat(concat("{self.stb_name}_{self.tdCom.subtable_prefix}", {stream_case_when_partition}), "{self.tdCom.subtable_suffix}")' if self.tdCom.subtable else None - ctb_subtable_value = f'concat(concat("{self.ctb_name}_{self.tdCom.subtable_prefix}", {stream_case_when_partition}), "{self.tdCom.subtable_suffix}")' if self.tdCom.subtable else None - tb_subtable_value = f'concat(concat("{self.tb_name}_{self.tdCom.subtable_prefix}", {stream_case_when_partition}), "{self.tdCom.subtable_suffix}")' if self.tdCom.subtable else None + stb_subtable_value = ( + f'concat(concat("{self.stb_name}_{self.tdCom.subtable_prefix}", {stream_case_when_partition}), "{self.tdCom.subtable_suffix}")' + if self.tdCom.subtable + else None + ) + ctb_subtable_value = ( + f'concat(concat("{self.ctb_name}_{self.tdCom.subtable_prefix}", {stream_case_when_partition}), "{self.tdCom.subtable_suffix}")' + if self.tdCom.subtable + else None + ) + tb_subtable_value = ( + f'concat(concat("{self.tb_name}_{self.tdCom.subtable_prefix}", {stream_case_when_partition}), "{self.tdCom.subtable_suffix}")' + if self.tdCom.subtable + else None + ) else: - stb_subtable_value = f'concat(concat("{self.stb_name}_{self.tdCom.subtable_prefix}", {partition_elm_alias}), "{self.tdCom.subtable_suffix}")' if self.tdCom.subtable else None - ctb_subtable_value = f'concat(concat("{self.ctb_name}_{self.tdCom.subtable_prefix}", {partition_elm_alias}), "{self.tdCom.subtable_suffix}")' if self.tdCom.subtable else None - tb_subtable_value = f'concat(concat("{self.tb_name}_{self.tdCom.subtable_prefix}", {partition_elm_alias}), "{self.tdCom.subtable_suffix}")' if self.tdCom.subtable else None + stb_subtable_value = ( + f'concat(concat("{self.stb_name}_{self.tdCom.subtable_prefix}", {partition_elm_alias}), "{self.tdCom.subtable_suffix}")' + if self.tdCom.subtable + else None + ) + ctb_subtable_value = ( + f'concat(concat("{self.ctb_name}_{self.tdCom.subtable_prefix}", {partition_elm_alias}), "{self.tdCom.subtable_suffix}")' + if self.tdCom.subtable + else None + ) + tb_subtable_value = ( + f'concat(concat("{self.tb_name}_{self.tdCom.subtable_prefix}", {partition_elm_alias}), "{self.tdCom.subtable_suffix}")' + if self.tdCom.subtable + else None + ) else: - stb_subtable_value = f'concat(concat("{self.stb_name}_{self.tdCom.subtable_prefix}", cast(cast(abs(cast({partition_elm_alias} as int)) as bigint) as varchar(100))), "{self.tdCom.subtable_suffix}")' if self.tdCom.subtable else None - ctb_subtable_value = f'concat(concat("{self.ctb_name}_{self.tdCom.subtable_prefix}", cast(cast(abs(cast({partition_elm_alias} as int)) as bigint) as varchar(100))), "{self.tdCom.subtable_suffix}")' if self.tdCom.subtable else None - tb_subtable_value = f'concat(concat("{self.tb_name}_{self.tdCom.subtable_prefix}", cast(cast(abs(cast({partition_elm_alias} as int)) as bigint) as varchar(100))), "{self.tdCom.subtable_suffix}")' if self.tdCom.subtable else None + stb_subtable_value = ( + f'concat(concat("{self.stb_name}_{self.tdCom.subtable_prefix}", cast(cast(abs(cast({partition_elm_alias} as int)) as bigint) as varchar(100))), "{self.tdCom.subtable_suffix}")' + if self.tdCom.subtable + else None + ) + ctb_subtable_value = ( + f'concat(concat("{self.ctb_name}_{self.tdCom.subtable_prefix}", cast(cast(abs(cast({partition_elm_alias} as int)) as bigint) as varchar(100))), "{self.tdCom.subtable_suffix}")' + if self.tdCom.subtable + else None + ) + tb_subtable_value = ( + f'concat(concat("{self.tb_name}_{self.tdCom.subtable_prefix}", cast(cast(abs(cast({partition_elm_alias} as int)) as bigint) as varchar(100))), "{self.tdCom.subtable_suffix}")' + if self.tdCom.subtable + else None + ) if partition: - partition_elm = f'partition by {partition} {partition_elm_alias}' + partition_elm = f"partition by {partition} {partition_elm_alias}" else: partition_elm = "" if fill_value: if "value" in fill_value.lower(): - fill_value='VALUE,1,2,3,4,5,6,7,8,9,10,11,1,2,3,4,5,6,7,8,9,10,11' + fill_value = "VALUE,1,2,3,4,5,6,7,8,9,10,11,1,2,3,4,5,6,7,8,9,10,11" # create error stream tdLog.info("create error stream") sleep(10) - tdSql.error(f"create stream itp_force_error_1 trigger force_window_close IGNORE EXPIRED 1 IGNORE UPDATE 0 into itp_force_error_1 as select _irowts,tbname,_isfilled,interp(c1,1) from {self.stb_name} partition by tbname every(5s) fill(prev) ;") - tdSql.error(f"create stream itp_force_error_1 trigger force_window_close IGNORE EXPIRED 0 IGNORE UPDATE 1 into itp_force_error_1 as select _irowts,tbname,_isfilled,interp(c1,1) from {self.stb_name} partition by tbname every(5s) fill(prev) ;") - tdSql.error(f"create stream itp_force_error_1 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 1 into itp_force_error_1 as select _irowts,tbname,_isfilled,interp(c1,1) from {self.stb_name} partition by tbname every(5s) fill(prev) ;") - tdSql.error(f"create stream itp_force_error_1 trigger force_window_close IGNORE EXPIRED 1 IGNORE UPDATE 0 into itp_force_error_1 as select _irowts,tbname,_isfilled,interp(c11,1) from {self.stb_name} partition by tbname every(5s) fill(prev) ;") - + tdSql.error( + f"create stream itp_force_error_1 trigger force_window_close IGNORE EXPIRED 1 IGNORE UPDATE 0 into itp_force_error_1 as select _irowts,tbname,_isfilled,interp(c1,1) from {self.stb_name} partition by tbname every(5s) fill(prev) ;" + ) + tdSql.error( + f"create stream itp_force_error_1 trigger force_window_close IGNORE EXPIRED 0 IGNORE UPDATE 1 into itp_force_error_1 as select _irowts,tbname,_isfilled,interp(c1,1) from {self.stb_name} partition by tbname every(5s) fill(prev) ;" + ) + tdSql.error( + f"create stream itp_force_error_1 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 1 into itp_force_error_1 as select _irowts,tbname,_isfilled,interp(c1,1) from {self.stb_name} partition by tbname every(5s) fill(prev) ;" + ) + tdSql.error( + f"create stream itp_force_error_1 trigger force_window_close IGNORE EXPIRED 1 IGNORE UPDATE 0 into itp_force_error_1 as select _irowts,tbname,_isfilled,interp(c11,1) from {self.stb_name} partition by tbname every(5s) fill(prev) ;" + ) # function name : interp trigger_mode = "force_window_close" - - # # subtable is true # create stream add :subtable_value=stb_subtable_value or subtable_value=ctb_subtable_value # no subtable # create stream super table and child table tdLog.info("create stream super table and child table") - self.tdCom.create_stream(stream_name=f'{self.stb_name}{self.tdCom.stream_suffix}', des_table=self.stb_stream_des_table, source_sql=f'select _irowts as irowts,tbname as table_name, _isfilled as isfilled, {funciton_name} as {funciton_name_alias} from {self.stb_name} {partition_elm} every({self.tdCom.dataDict["interval"]}s)', trigger_mode=trigger_mode, fill_value=fill_value, fill_history_value=fill_history_value,ignore_expired=ignore_expired,ignore_update=ignore_update) - self.tdCom.create_stream(stream_name=f'{self.ctb_name}{self.tdCom.stream_suffix}', des_table=self.ctb_stream_des_table, source_sql=f'select _irowts as irowts, tbname as table_name, _isfilled as isfilled, {funciton_name} as {funciton_name_alias} from {self.ctb_name} {partition_elm} every({self.tdCom.dataDict["interval"]}s)', trigger_mode=trigger_mode, fill_value=fill_value, fill_history_value=fill_history_value,ignore_expired=ignore_expired,ignore_update=ignore_update) - + self.tdCom.create_stream( + stream_name=f"{self.stb_name}{self.tdCom.stream_suffix}", + des_table=self.stb_stream_des_table, + source_sql=f'select _irowts as irowts,tbname as table_name, _isfilled as isfilled, {funciton_name} as {funciton_name_alias} from {self.stb_name} {partition_elm} every({self.tdCom.dataDict["interval"]}s)', + trigger_mode=trigger_mode, + fill_value=fill_value, + fill_history_value=fill_history_value, + ignore_expired=ignore_expired, + ignore_update=ignore_update, + ) + self.tdCom.create_stream( + stream_name=f"{self.ctb_name}{self.tdCom.stream_suffix}", + des_table=self.ctb_stream_des_table, + source_sql=f'select _irowts as irowts, tbname as table_name, _isfilled as isfilled, {funciton_name} as {funciton_name_alias} from {self.ctb_name} {partition_elm} every({self.tdCom.dataDict["interval"]}s)', + trigger_mode=trigger_mode, + fill_value=fill_value, + fill_history_value=fill_history_value, + ignore_expired=ignore_expired, + ignore_update=ignore_update, + ) # creat stream set filter of tag and tbname tdLog.info("create stream with tag and tbname filter") tag_t1_value = self.tdCom.tag_value_list[0] - where_tag = f'where t1 = {tag_t1_value}' + where_tag = f"where t1 = {tag_t1_value}" where_tbname = f'where tbname="{self.ctb_name}"' print(f"tag: {tag_t1_value}") - self.stb_stream_des_where_tag_table = f'{self.stb_name}_where_tag{self.tdCom.des_table_suffix}' - self.tdCom.create_stream(stream_name=f'{self.stb_name}_where_tag{self.tdCom.stream_suffix}', des_table=self.stb_stream_des_where_tag_table, source_sql=f'select _irowts as irowts,tbname as table_name, _isfilled as isfilled, {funciton_name} as {funciton_name_alias} from {self.stb_name} {where_tag} {partition_elm} every({self.tdCom.dataDict["interval"]}s)', trigger_mode=trigger_mode, fill_value=fill_value, fill_history_value=fill_history_value,ignore_expired=ignore_expired,ignore_update=ignore_update) - self.stb_stream_des_where_tbname_table = f'{self.stb_name}_where_tbname{self.tdCom.des_table_suffix}' - self.tdCom.create_stream(stream_name=f'{self.stb_name}_where_tbname{self.tdCom.stream_suffix}', des_table=self.stb_stream_des_where_tbname_table, source_sql=f'select _irowts as irowts,tbname as table_name, _isfilled as isfilled, {funciton_name} as {funciton_name_alias} from {self.stb_name} {where_tbname} {partition_elm} every({self.tdCom.dataDict["interval"]}s)', trigger_mode=trigger_mode, fill_value=fill_value, fill_history_value=fill_history_value,ignore_expired=ignore_expired,ignore_update=ignore_update) - + self.stb_stream_des_where_tag_table = ( + f"{self.stb_name}_where_tag{self.tdCom.des_table_suffix}" + ) + self.tdCom.create_stream( + stream_name=f"{self.stb_name}_where_tag{self.tdCom.stream_suffix}", + des_table=self.stb_stream_des_where_tag_table, + source_sql=f'select _irowts as irowts,tbname as table_name, _isfilled as isfilled, {funciton_name} as {funciton_name_alias} from {self.stb_name} {where_tag} {partition_elm} every({self.tdCom.dataDict["interval"]}s)', + trigger_mode=trigger_mode, + fill_value=fill_value, + fill_history_value=fill_history_value, + ignore_expired=ignore_expired, + ignore_update=ignore_update, + ) + self.stb_stream_des_where_tbname_table = ( + f"{self.stb_name}_where_tbname{self.tdCom.des_table_suffix}" + ) + self.tdCom.create_stream( + stream_name=f"{self.stb_name}_where_tbname{self.tdCom.stream_suffix}", + des_table=self.stb_stream_des_where_tbname_table, + source_sql=f'select _irowts as irowts,tbname as table_name, _isfilled as isfilled, {funciton_name} as {funciton_name_alias} from {self.stb_name} {where_tbname} {partition_elm} every({self.tdCom.dataDict["interval"]}s)', + trigger_mode=trigger_mode, + fill_value=fill_value, + fill_history_value=fill_history_value, + ignore_expired=ignore_expired, + ignore_update=ignore_update, + ) + # set partition by tag and column if partition: tdLog.info("create stream with partition by tag and tbname ") - partition_elm_new = f'partition by {partition}, t1' - self.tdCom.create_stream(stream_name=f'{self.stb_name}_partition_tag{self.tdCom.stream_suffix}', des_table=f'{self.stb_name}_partition_tag{self.tdCom.des_table_suffix}', source_sql=f'select _irowts as irowts, tbname as table_name, t1 as t_t1, _isfilled as isfilled, {funciton_name} as {funciton_name_alias} from {self.stb_name} {partition_elm_new} every({self.tdCom.dataDict["interval"]}s)', trigger_mode=trigger_mode, fill_value=fill_value, fill_history_value=fill_history_value,ignore_expired=ignore_expired,ignore_update=ignore_update) - partition_elm_new = f'partition by {partition}, c1' - self.tdCom.create_stream(stream_name=f'{self.stb_name}_partition_column1{self.tdCom.stream_suffix}', des_table=f'{self.stb_name}_partition_column1{self.tdCom.des_table_suffix}', source_sql=f'select _irowts as irowts, tbname as table_name, c1 as c_c1, _isfilled as isfilled, {funciton_name} as {funciton_name_alias} from {self.stb_name} {partition_elm_new} every({self.tdCom.dataDict["interval"]}s)', trigger_mode=trigger_mode, fill_value=fill_value, fill_history_value=fill_history_value,ignore_expired=ignore_expired,ignore_update=ignore_update) - partition_elm_new = f'partition by {partition}, c2' - self.tdCom.create_stream(stream_name=f'{self.stb_name}_partition_column2{self.tdCom.stream_suffix}', des_table=f'{self.stb_name}_partition_column2{self.tdCom.des_table_suffix}', source_sql=f'select _irowts as irowts, tbname as table_name, c2 as c_c2, _isfilled as isfilled, {funciton_name} as {funciton_name_alias} from {self.stb_name} {partition_elm_new} every({self.tdCom.dataDict["interval"]}s)', trigger_mode=trigger_mode, fill_value=fill_value, fill_history_value=fill_history_value,ignore_expired=ignore_expired,ignore_update=ignore_update) - + partition_elm_new = f"partition by {partition}, t1" + self.tdCom.create_stream( + stream_name=f"{self.stb_name}_partition_tag{self.tdCom.stream_suffix}", + des_table=f"{self.stb_name}_partition_tag{self.tdCom.des_table_suffix}", + source_sql=f'select _irowts as irowts, tbname as table_name, t1 as t_t1, _isfilled as isfilled, {funciton_name} as {funciton_name_alias} from {self.stb_name} {partition_elm_new} every({self.tdCom.dataDict["interval"]}s)', + trigger_mode=trigger_mode, + fill_value=fill_value, + fill_history_value=fill_history_value, + ignore_expired=ignore_expired, + ignore_update=ignore_update, + ) + partition_elm_new = f"partition by {partition}, c1" + self.tdCom.create_stream( + stream_name=f"{self.stb_name}_partition_column1{self.tdCom.stream_suffix}", + des_table=f"{self.stb_name}_partition_column1{self.tdCom.des_table_suffix}", + source_sql=f'select _irowts as irowts, tbname as table_name, c1 as c_c1, _isfilled as isfilled, {funciton_name} as {funciton_name_alias} from {self.stb_name} {partition_elm_new} every({self.tdCom.dataDict["interval"]}s)', + trigger_mode=trigger_mode, + fill_value=fill_value, + fill_history_value=fill_history_value, + ignore_expired=ignore_expired, + ignore_update=ignore_update, + ) + partition_elm_new = f"partition by {partition}, c2" + self.tdCom.create_stream( + stream_name=f"{self.stb_name}_partition_column2{self.tdCom.stream_suffix}", + des_table=f"{self.stb_name}_partition_column2{self.tdCom.des_table_suffix}", + source_sql=f'select _irowts as irowts, tbname as table_name, c2 as c_c2, _isfilled as isfilled, {funciton_name} as {funciton_name_alias} from {self.stb_name} {partition_elm_new} every({self.tdCom.dataDict["interval"]}s)', + trigger_mode=trigger_mode, + fill_value=fill_value, + fill_history_value=fill_history_value, + ignore_expired=ignore_expired, + ignore_update=ignore_update, + ) if fill_value: if "value" in fill_value.lower(): - fill_value='VALUE,1,2,3,4,5,6,7,8,9,10,11' + fill_value = "VALUE,1,2,3,4,5,6,7,8,9,10,11" # create stream general table tdLog.info("create stream general table") - self.tdCom.create_stream(stream_name=f'{self.tb_name}{self.tdCom.stream_suffix}', des_table=self.tb_stream_des_table, source_sql=f'select _irowts as irowts,tbname as table_name, _isfilled as isfilled, {funciton_name} as {funciton_name_alias} from {self.tb_name} every({self.tdCom.dataDict["interval"]}s)', trigger_mode=trigger_mode, fill_value=fill_value, fill_history_value=fill_history_value,ignore_expired=ignore_expired,ignore_update=ignore_update) - + self.tdCom.create_stream( + stream_name=f"{self.tb_name}{self.tdCom.stream_suffix}", + des_table=self.tb_stream_des_table, + source_sql=f'select _irowts as irowts,tbname as table_name, _isfilled as isfilled, {funciton_name} as {funciton_name_alias} from {self.tb_name} every({self.tdCom.dataDict["interval"]}s)', + trigger_mode=trigger_mode, + fill_value=fill_value, + fill_history_value=fill_history_value, + ignore_expired=ignore_expired, + ignore_update=ignore_update, + ) + # insert data self.tdCom.date_time = self.tdCom.genTs(precision=self.tdCom.precision)[0] start_time = self.tdCom.date_time time.sleep(1) - start_force_ts = str(0) + start_force_ts = str(0) for i in range(self.tdCom.range_count): - ts_value = str(self.tdCom.date_time+self.tdCom.dataDict["interval"])+f'+{i*10}s' + ts_value = ( + str(self.tdCom.date_time + self.tdCom.dataDict["interval"]) + + f"+{i*10}s" + ) print(ts_value) if start_force_ts == "0": - start_force_ts = ts_value + start_force_ts = ts_value ts_cast_delete_value = self.tdCom.time_cast(ts_value) - self.tdCom.sinsert_rows(tbname=self.tdCom.ctb_name, ts_value=ts_value, custom_col_index=custom_col_index, col_value_type=col_value_type) - if i%2 == 0: - self.tdCom.sinsert_rows(tbname=self.tdCom.ctb_name, ts_value=ts_value, custom_col_index=custom_col_index, col_value_type=col_value_type) - if self.delete and i%2 != 0: - self.tdCom.sdelete_rows(tbname=self.tdCom.ctb_name, start_ts=ts_cast_delete_value) + self.tdCom.sinsert_rows( + tbname=self.tdCom.ctb_name, + ts_value=ts_value, + custom_col_index=custom_col_index, + col_value_type=col_value_type, + ) + if i % 2 == 0: + self.tdCom.sinsert_rows( + tbname=self.tdCom.ctb_name, + ts_value=ts_value, + custom_col_index=custom_col_index, + col_value_type=col_value_type, + ) + if self.delete and i % 2 != 0: + self.tdCom.sdelete_rows( + tbname=self.tdCom.ctb_name, start_ts=ts_cast_delete_value + ) self.tdCom.date_time += 1 - self.tdCom.sinsert_rows(tbname=self.tdCom.tb_name, ts_value=ts_value, custom_col_index=custom_col_index, col_value_type=col_value_type) - if i%2 == 0: - self.tdCom.sinsert_rows(tbname=self.tdCom.tb_name, ts_value=ts_value, custom_col_index=custom_col_index, col_value_type=col_value_type) - if self.delete and i%2 != 0: - self.tdCom.sdelete_rows(tbname=self.tdCom.tb_name, start_ts=ts_cast_delete_value) + self.tdCom.sinsert_rows( + tbname=self.tdCom.tb_name, + ts_value=ts_value, + custom_col_index=custom_col_index, + col_value_type=col_value_type, + ) + if i % 2 == 0: + self.tdCom.sinsert_rows( + tbname=self.tdCom.tb_name, + ts_value=ts_value, + custom_col_index=custom_col_index, + col_value_type=col_value_type, + ) + if self.delete and i % 2 != 0: + self.tdCom.sdelete_rows( + tbname=self.tdCom.tb_name, start_ts=ts_cast_delete_value + ) self.tdCom.date_time += 1 if partition: - partition_elm = f'partition by {partition}' + partition_elm = f"partition by {partition}" else: partition_elm = "" if not fill_value: for tbname in [self.stb_name, self.ctb_name, self.tb_name]: if tbname != self.tb_name: - self.tdCom.check_query_data(f'select wstart, {self.tdCom.stb_output_select_str} from {tbname}{self.tdCom.des_table_suffix} order by wstart', f'select _wstart AS wstart, {self.tdCom.stb_source_select_str} from {tbname} {partition_elm} interval({self.tdCom.dataDict["interval"]}s) order by wstart', sorted=True) + self.tdCom.check_query_data( + f"select wstart, {self.tdCom.stb_output_select_str} from {tbname}{self.tdCom.des_table_suffix} order by wstart", + f'select _wstart AS wstart, {self.tdCom.stb_source_select_str} from {tbname} {partition_elm} interval({self.tdCom.dataDict["interval"]}s) order by wstart', + sorted=True, + ) else: - self.tdCom.check_query_data(f'select wstart, {self.tdCom.tb_output_select_str} from {tbname}{self.tdCom.des_table_suffix} order by wstart', f'select _wstart AS wstart, {self.tdCom.tb_source_select_str} from {tbname} {partition_elm} interval({self.tdCom.dataDict["interval"]}s) order by wstart', sorted=True) + self.tdCom.check_query_data( + f"select wstart, {self.tdCom.tb_output_select_str} from {tbname}{self.tdCom.des_table_suffix} order by wstart", + f'select _wstart AS wstart, {self.tdCom.tb_source_select_str} from {tbname} {partition_elm} interval({self.tdCom.dataDict["interval"]}s) order by wstart', + sorted=True, + ) if self.tdCom.subtable: for tname in [self.stb_name, self.ctb_name]: - group_id = self.tdCom.get_group_id_from_stb(f'{tname}_output') - tdSql.query(f'select * from {self.ctb_name}') + group_id = self.tdCom.get_group_id_from_stb(f"{tname}_output") + tdSql.query(f"select * from {self.ctb_name}") ptn_counter = 0 for c1_value in tdSql.queryResult: if partition == "c1": - tbname = self.tdCom.get_subtable_wait(f'{tname}_{self.tdCom.subtable_prefix}{abs(c1_value[1])}{self.tdCom.subtable_suffix}') - tdSql.query(f'select count(*) from `{tbname}`') + tbname = self.tdCom.get_subtable_wait( + f"{tname}_{self.tdCom.subtable_prefix}{abs(c1_value[1])}{self.tdCom.subtable_suffix}" + ) + tdSql.query(f"select count(*) from `{tbname}`") elif partition is None: - tbname = self.tdCom.get_subtable_wait(f'{tname}_{self.tdCom.subtable_prefix}no_partition{self.tdCom.subtable_suffix}') - tdSql.query(f'select count(*) from `{tbname}`') + tbname = self.tdCom.get_subtable_wait( + f"{tname}_{self.tdCom.subtable_prefix}no_partition{self.tdCom.subtable_suffix}" + ) + tdSql.query(f"select count(*) from `{tbname}`") elif partition == "abs(c1)": abs_c1_value = abs(c1_value[1]) - tbname = self.tdCom.get_subtable_wait(f'{tname}_{self.tdCom.subtable_prefix}{abs_c1_value}{self.tdCom.subtable_suffix}') - tdSql.query(f'select count(*) from `{tbname}`') + tbname = self.tdCom.get_subtable_wait( + f"{tname}_{self.tdCom.subtable_prefix}{abs_c1_value}{self.tdCom.subtable_suffix}" + ) + tdSql.query(f"select count(*) from `{tbname}`") elif partition == "tbname" and ptn_counter == 0: - tbname = self.tdCom.get_subtable_wait(f'{tname}_{self.tdCom.subtable_prefix}{self.ctb_name}{self.tdCom.subtable_suffix}_{tname}_output_{group_id}') - tdSql.query(f'select count(*) from `{tbname}`') + tbname = self.tdCom.get_subtable_wait( + f"{tname}_{self.tdCom.subtable_prefix}{self.ctb_name}{self.tdCom.subtable_suffix}_{tname}_output_{group_id}" + ) + tdSql.query(f"select count(*) from `{tbname}`") ptn_counter += 1 tdSql.checkEqual(tdSql.queryResult[0][0] > 0, True) - group_id = self.tdCom.get_group_id_from_stb(f'{self.tb_name}_output') - tdSql.query(f'select * from {self.tb_name}') + group_id = self.tdCom.get_group_id_from_stb(f"{self.tb_name}_output") + tdSql.query(f"select * from {self.tb_name}") ptn_counter = 0 for c1_value in tdSql.queryResult: if partition == "c1": - tbname = self.tdCom.get_subtable_wait(f'{self.tb_name}_{self.tdCom.subtable_prefix}{abs(c1_value[1])}{self.tdCom.subtable_suffix}') - tdSql.query(f'select count(*) from `{tbname}`') + tbname = self.tdCom.get_subtable_wait( + f"{self.tb_name}_{self.tdCom.subtable_prefix}{abs(c1_value[1])}{self.tdCom.subtable_suffix}" + ) + tdSql.query(f"select count(*) from `{tbname}`") elif partition is None: - tbname = self.tdCom.get_subtable_wait(f'{self.tb_name}_{self.tdCom.subtable_prefix}no_partition{self.tdCom.subtable_suffix}') - tdSql.query(f'select count(*) from `{tbname}`') + tbname = self.tdCom.get_subtable_wait( + f"{self.tb_name}_{self.tdCom.subtable_prefix}no_partition{self.tdCom.subtable_suffix}" + ) + tdSql.query(f"select count(*) from `{tbname}`") elif partition == "abs(c1)": abs_c1_value = abs(c1_value[1]) - tbname = self.tdCom.get_subtable_wait(f'{self.tb_name}_{self.tdCom.subtable_prefix}{abs_c1_value}{self.tdCom.subtable_suffix}') - tdSql.query(f'select count(*) from `{tbname}`') + tbname = self.tdCom.get_subtable_wait( + f"{self.tb_name}_{self.tdCom.subtable_prefix}{abs_c1_value}{self.tdCom.subtable_suffix}" + ) + tdSql.query(f"select count(*) from `{tbname}`") elif partition == "tbname" and ptn_counter == 0: - tbname = self.tdCom.get_subtable_wait(f'{self.tb_name}_{self.tdCom.subtable_prefix}{self.tb_name}{self.tdCom.subtable_suffix}_{self.tb_name}_output_{group_id}') - tdSql.query(f'select count(*) from `{tbname}`') + tbname = self.tdCom.get_subtable_wait( + f"{self.tb_name}_{self.tdCom.subtable_prefix}{self.tb_name}{self.tdCom.subtable_suffix}_{self.tb_name}_output_{group_id}" + ) + tdSql.query(f"select count(*) from `{tbname}`") ptn_counter += 1 tdSql.checkEqual(tdSql.queryResult[0][0] > 0, True) if fill_value: end_date_time = self.tdCom.date_time final_range_count = self.tdCom.range_count - history_ts = str(start_time)+f'-{self.tdCom.dataDict["interval"]*(final_range_count+2)}s' + history_ts = ( + str(start_time) + + f'-{self.tdCom.dataDict["interval"]*(final_range_count+2)}s' + ) start_ts = self.tdCom.time_cast(history_ts, "-") - future_ts = str(end_date_time)+f'+{self.tdCom.dataDict["interval"]*(final_range_count+2)}s' + future_ts = ( + str(end_date_time) + + f'+{self.tdCom.dataDict["interval"]*(final_range_count+2)}s' + ) end_ts = self.tdCom.time_cast(future_ts) self.tdCom.sinsert_rows(tbname=self.ctb_name, ts_value=history_ts) self.tdCom.sinsert_rows(tbname=self.tb_name, ts_value=history_ts) @@ -214,97 +407,177 @@ def force_window_close(self, interval, partition="tbname", funciton_name="", fun self.tdCom.sinsert_rows(tbname=self.tb_name, ts_value=future_ts) self.tdCom.date_time = start_time # update - history_ts = str(start_time)+f'-{self.tdCom.dataDict["interval"]*(final_range_count+2)}s' + history_ts = ( + str(start_time) + + f'-{self.tdCom.dataDict["interval"]*(final_range_count+2)}s' + ) start_ts = self.tdCom.time_cast(history_ts, "-") - future_ts = str(end_date_time)+f'+{self.tdCom.dataDict["interval"]*(final_range_count+2)}s' + future_ts = ( + str(end_date_time) + + f'+{self.tdCom.dataDict["interval"]*(final_range_count+2)}s' + ) end_ts = self.tdCom.time_cast(future_ts) self.tdCom.sinsert_rows(tbname=self.ctb_name, ts_value=history_ts) self.tdCom.sinsert_rows(tbname=self.tb_name, ts_value=history_ts) self.tdCom.sinsert_rows(tbname=self.ctb_name, ts_value=future_ts) self.tdCom.sinsert_rows(tbname=self.tb_name, ts_value=future_ts) - + # get query time range using interval count windows - tdSql.query(f'select _wstart, _wend ,last(ts) from {self.stb_name} where ts >= {start_force_ts} and ts <= {end_ts} partition by tbname interval({self.tdCom.dataDict["interval"]}s)fill ({fill_value}) ') + tdSql.query( + f'select _wstart, _wend ,last(ts) from {self.stb_name} where ts >= {start_force_ts} and ts <= {end_ts} partition by tbname interval({self.tdCom.dataDict["interval"]}s)fill ({fill_value}) ' + ) # getData don't support negative index - end_new_ts = tdSql.getData(tdSql.queryRows-1, 1) - end_last_but_one_ts = tdSql.getData(tdSql.queryRows-2, 1) - #source data include that fill valuse is null and "_isfilled" column of the stream output is false - tdSql.execute(f"insert into {self.ctb_name} (ts,c1) values(\"{end_new_ts}\",-102) ") - tdSql.execute(f"insert into {self.tb_name} (ts,c1) values(\"{end_new_ts}\",-51) ") - tdSql.execute(f"insert into {self.ctb_name} (ts,c1) values(\"{end_last_but_one_ts}\",NULL) ") - + end_new_ts = tdSql.getData(tdSql.queryRows - 1, 1) + end_last_but_one_ts = tdSql.getData(tdSql.queryRows - 2, 1) + # source data include that fill valuse is null and "_isfilled" column of the stream output is false + tdSql.execute( + f'insert into {self.ctb_name} (ts,c1) values("{end_new_ts}",-102) ' + ) + tdSql.execute( + f'insert into {self.tb_name} (ts,c1) values("{end_new_ts}",-51) ' + ) + tdSql.execute( + f'insert into {self.ctb_name} (ts,c1) values("{end_last_but_one_ts}",NULL) ' + ) + for i in range(self.tdCom.range_count): - ts_value = str(self.tdCom.date_time+self.tdCom.dataDict["interval"])+f'+{i*10}s' + ts_value = ( + str(self.tdCom.date_time + self.tdCom.dataDict["interval"]) + + f"+{i*10}s" + ) ts_cast_delete_value = self.tdCom.time_cast(ts_value) self.tdCom.sinsert_rows(tbname=self.ctb_name, ts_value=ts_value) self.tdCom.date_time += 1 self.tdCom.sinsert_rows(tbname=self.tb_name, ts_value=ts_value) self.tdCom.date_time += 1 if self.delete: - self.tdCom.sdelete_rows(tbname=self.ctb_name, start_ts=self.tdCom.time_cast(start_time), end_ts=ts_cast_delete_value) - self.tdCom.sdelete_rows(tbname=self.tb_name, start_ts=self.tdCom.time_cast(start_time), end_ts=ts_cast_delete_value) + self.tdCom.sdelete_rows( + tbname=self.ctb_name, + start_ts=self.tdCom.time_cast(start_time), + end_ts=ts_cast_delete_value, + ) + self.tdCom.sdelete_rows( + tbname=self.tb_name, + start_ts=self.tdCom.time_cast(start_time), + end_ts=ts_cast_delete_value, + ) # wait for the stream to process the data # print(self.tdCom.dataDict["interval"]*(final_range_count+2)) - time.sleep(self.tdCom.dataDict["interval"]*(final_range_count+2)) + time.sleep(self.tdCom.dataDict["interval"] * (final_range_count + 2)) # check the data for tbname in [self.stb_name, self.ctb_name, self.tb_name]: print(tbname) - tdSql.query(f'select _wstart, _wend ,last(ts) from {tbname} where ts >= {start_force_ts} and ts <= {end_ts} partition by tbname interval({self.tdCom.dataDict["interval"]}s)fill ({fill_value}) ') + tdSql.query( + f'select _wstart, _wend ,last(ts) from {tbname} where ts >= {start_force_ts} and ts <= {end_ts} partition by tbname interval({self.tdCom.dataDict["interval"]}s)fill ({fill_value}) ' + ) start_new_ts = tdSql.getData(0, 1) if tbname == self.ctb_name: if "value" in fill_value.lower(): - fill_value='VALUE,1,2,3,6,7,8,9,10,11,1,2,3,4,5,6,7,8,9,10,11' + fill_value = "VALUE,1,2,3,6,7,8,9,10,11,1,2,3,4,5,6,7,8,9,10,11" if partition == "tbname": - self.tdCom.check_query_data(f'select irowts, table_name, isfilled, {funciton_name_alias} from {tbname}{self.tdCom.des_table_suffix} where irowts >= {start_force_ts} and irowts <= "{end_new_ts}" order by irowts', f'select _irowts as irowts ,tbname as table_name, _isfilled as isfilled , {funciton_name} as {funciton_name_alias} from {tbname} partition by {partition} range("{start_new_ts}","{end_new_ts}") every({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by irowts', fill_value=fill_value) + self.tdCom.check_query_data( + f'select irowts, table_name, isfilled, {funciton_name_alias} from {tbname}{self.tdCom.des_table_suffix} where irowts >= {start_force_ts} and irowts <= "{end_new_ts}" order by irowts', + f'select _irowts as irowts ,tbname as table_name, _isfilled as isfilled , {funciton_name} as {funciton_name_alias} from {tbname} partition by {partition} range("{start_new_ts}","{end_new_ts}") every({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by irowts', + fill_value=fill_value, + ) elif tbname == self.stb_name: if partition == "tbname": - self.tdCom.check_query_data(f'select irowts, table_name, isfilled, {funciton_name_alias} from {tbname}{self.tdCom.des_table_suffix} where irowts >= {start_force_ts} and irowts <= "{end_new_ts}" order by irowts', f'select _irowts as irowts ,tbname as table_name, _isfilled as isfilled , {funciton_name} as {funciton_name_alias} from {tbname} partition by {partition} range("{start_new_ts}","{end_new_ts}") every({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by irowts', fill_value=fill_value) + self.tdCom.check_query_data( + f'select irowts, table_name, isfilled, {funciton_name_alias} from {tbname}{self.tdCom.des_table_suffix} where irowts >= {start_force_ts} and irowts <= "{end_new_ts}" order by irowts', + f'select _irowts as irowts ,tbname as table_name, _isfilled as isfilled , {funciton_name} as {funciton_name_alias} from {tbname} partition by {partition} range("{start_new_ts}","{end_new_ts}") every({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by irowts', + fill_value=fill_value, + ) # check tag and tbname filter - self.tdCom.check_query_data(f'select irowts, table_name, isfilled, {funciton_name_alias} from {self.stb_stream_des_where_tag_table} where irowts >= {start_force_ts} and irowts <= "{end_new_ts}" order by irowts', f'select _irowts as irowts ,tbname as table_name, _isfilled as isfilled , {funciton_name} as {funciton_name_alias} from {tbname} {where_tag} partition by {partition} range("{start_new_ts}","{end_new_ts}") every({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by irowts', fill_value=fill_value) - self.tdCom.check_query_data(f'select irowts, table_name, isfilled, {funciton_name_alias} from {self.stb_stream_des_where_tbname_table} where irowts >= {start_force_ts} and irowts <= "{end_new_ts}" order by irowts', f'select _irowts as irowts ,tbname as table_name, _isfilled as isfilled , {funciton_name} as {funciton_name_alias} from {tbname} {where_tbname} partition by {partition} range("{start_new_ts}","{end_new_ts}") every({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by irowts', fill_value=fill_value) + self.tdCom.check_query_data( + f'select irowts, table_name, isfilled, {funciton_name_alias} from {self.stb_stream_des_where_tag_table} where irowts >= {start_force_ts} and irowts <= "{end_new_ts}" order by irowts', + f'select _irowts as irowts ,tbname as table_name, _isfilled as isfilled , {funciton_name} as {funciton_name_alias} from {tbname} {where_tag} partition by {partition} range("{start_new_ts}","{end_new_ts}") every({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by irowts', + fill_value=fill_value, + ) + self.tdCom.check_query_data( + f'select irowts, table_name, isfilled, {funciton_name_alias} from {self.stb_stream_des_where_tbname_table} where irowts >= {start_force_ts} and irowts <= "{end_new_ts}" order by irowts', + f'select _irowts as irowts ,tbname as table_name, _isfilled as isfilled , {funciton_name} as {funciton_name_alias} from {tbname} {where_tbname} partition by {partition} range("{start_new_ts}","{end_new_ts}") every({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by irowts', + fill_value=fill_value, + ) else: if "value" in fill_value.lower(): - fill_value='VALUE,1' + fill_value = "VALUE,1" if partition == "tbname": - self.tdCom.check_query_data(f'select irowts, isfilled, {funciton_name_alias} from {tbname}{self.tdCom.des_table_suffix} where irowts >= {start_force_ts} and irowts <= "{end_new_ts}" order by irowts', f'select _irowts as irowts , _isfilled as isfilled , {funciton_name} as {funciton_name_alias} from {tbname} partition by {partition} range("{start_new_ts}","{end_new_ts}") every({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by irowts', fill_value=fill_value) + self.tdCom.check_query_data( + f'select irowts, isfilled, {funciton_name_alias} from {tbname}{self.tdCom.des_table_suffix} where irowts >= {start_force_ts} and irowts <= "{end_new_ts}" order by irowts', + f'select _irowts as irowts , _isfilled as isfilled , {funciton_name} as {funciton_name_alias} from {tbname} partition by {partition} range("{start_new_ts}","{end_new_ts}") every({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by irowts', + fill_value=fill_value, + ) # Recreate a sub-table that meets the filtering "where_tag" and check if the streaming results are automatically included within it." where_tag_ctbname = f"{self.ctb_name}_where_tag" - tdSql.execute(f"create table {where_tag_ctbname} using {self.stb_name} (t1) tags({tag_t1_value}) ") + tdSql.execute( + f"create table {where_tag_ctbname} using {self.stb_name} (t1) tags({tag_t1_value}) " + ) where_tag_timestamp = self.tdCom.genTs(precision=self.tdCom.precision)[0] - where_tag_ts_start_value = str(where_tag_timestamp)+ '+2s' - self.tdCom.sinsert_rows(tbname=where_tag_ctbname, ts_value=where_tag_ts_start_value) - time.sleep(self.tdCom.dataDict["interval"]+5) - tdSql.query(f'select distinct(table_name) from {self.stb_stream_des_where_tag_table} where table_name="{where_tag_ctbname}"') + where_tag_ts_start_value = str(where_tag_timestamp) + "+2s" + self.tdCom.sinsert_rows( + tbname=where_tag_ctbname, ts_value=where_tag_ts_start_value + ) + time.sleep(self.tdCom.dataDict["interval"] + 5) + tdSql.query( + f"select distinct(table_name) from {self.stb_stream_des_where_tag_table} where table_name=\"{where_tag_ctbname}\"" + ) tdSql.checkEqual(tdSql.queryResult[0][0], where_tag_ctbname) - - if self.delete: - self.tdCom.sdelete_rows(tbname=self.ctb_name, start_ts=start_ts, end_ts=ts_cast_delete_value) - self.tdCom.sdelete_rows(tbname=self.tb_name, start_ts=start_ts, end_ts=ts_cast_delete_value) + self.tdCom.sdelete_rows( + tbname=self.ctb_name, start_ts=start_ts, end_ts=ts_cast_delete_value + ) + self.tdCom.sdelete_rows( + tbname=self.tb_name, start_ts=start_ts, end_ts=ts_cast_delete_value + ) for tbname in [self.stb_name, self.ctb_name, self.tb_name]: if tbname != self.tb_name: if "value" in fill_value.lower(): - fill_value='VALUE,1,2,3,6,7,8,9,10,11,1,2,3,4,5,6,7,8,9,10,11' + fill_value = ( + "VALUE,1,2,3,6,7,8,9,10,11,1,2,3,4,5,6,7,8,9,10,11" + ) if partition == "tbname": - self.tdCom.check_query_data(f'select wstart, {self.tdCom.fill_stb_output_select_str} from {tbname}{self.tdCom.des_table_suffix} order by wstart', f'select _wstart AS wstart, {self.tdCom.fill_stb_source_select_str} from {tbname} where ts >= {start_ts.replace("-", "+")} and ts <= {end_ts} partition by {partition} interval({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by wstart', fill_value=fill_value) + self.tdCom.check_query_data( + f"select wstart, {self.tdCom.fill_stb_output_select_str} from {tbname}{self.tdCom.des_table_suffix} order by wstart", + f'select _wstart AS wstart, {self.tdCom.fill_stb_source_select_str} from {tbname} where ts >= {start_ts.replace("-", "+")} and ts <= {end_ts} partition by {partition} interval({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by wstart', + fill_value=fill_value, + ) else: - self.tdCom.check_query_data(f'select wstart, {self.tdCom.fill_stb_output_select_str} from {tbname}{self.tdCom.des_table_suffix} order by wstart,`min(c1)`', f'select * from (select _wstart AS wstart, {self.tdCom.fill_stb_source_select_str} from {tbname} where ts >= {start_ts} and ts <= {end_ts} partition by {partition} interval({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by wstart) where `min(c1)` is not Null order by wstart,`min(c1)`', fill_value=fill_value) + self.tdCom.check_query_data( + f"select wstart, {self.tdCom.fill_stb_output_select_str} from {tbname}{self.tdCom.des_table_suffix} order by wstart,`min(c1)`", + f'select * from (select _wstart AS wstart, {self.tdCom.fill_stb_source_select_str} from {tbname} where ts >= {start_ts} and ts <= {end_ts} partition by {partition} interval({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by wstart) where `min(c1)` is not Null order by wstart,`min(c1)`', + fill_value=fill_value, + ) else: if "value" in fill_value.lower(): - fill_value='VALUE,1,2,3,6,7,8,9,10,11' + fill_value = "VALUE,1,2,3,6,7,8,9,10,11" if partition == "tbname": - self.tdCom.check_query_data(f'select wstart, {self.tdCom.fill_tb_output_select_str} from {tbname}{self.tdCom.des_table_suffix} order by wstart', f'select _wstart AS wstart, {self.tdCom.fill_tb_source_select_str} from {tbname} where ts >= {start_ts.replace("-", "+")} and ts <= {end_ts} partition by {partition} interval({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by wstart', fill_value=fill_value) + self.tdCom.check_query_data( + f"select wstart, {self.tdCom.fill_tb_output_select_str} from {tbname}{self.tdCom.des_table_suffix} order by wstart", + f'select _wstart AS wstart, {self.tdCom.fill_tb_source_select_str} from {tbname} where ts >= {start_ts.replace("-", "+")} and ts <= {end_ts} partition by {partition} interval({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by wstart', + fill_value=fill_value, + ) else: - self.tdCom.check_query_data(f'select wstart, {self.tdCom.fill_tb_output_select_str} from {tbname}{self.tdCom.des_table_suffix} order by wstart,`min(c1)`', f'select * from (select _wstart AS wstart, {self.tdCom.fill_tb_source_select_str} from {tbname} where ts >= {start_ts} and ts <= {end_ts} partition by {partition} interval({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by wstart) where `min(c1)` is not Null order by wstart,`min(c1)`', fill_value=fill_value) - + self.tdCom.check_query_data( + f"select wstart, {self.tdCom.fill_tb_output_select_str} from {tbname}{self.tdCom.des_table_suffix} order by wstart,`min(c1)`", + f'select * from (select _wstart AS wstart, {self.tdCom.fill_tb_source_select_str} from {tbname} where ts >= {start_ts} and ts <= {end_ts} partition by {partition} interval({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by wstart) where `min(c1)` is not Null order by wstart,`min(c1)`', + fill_value=fill_value, + ) def run(self): - self.force_window_close(interval=10, partition="tbname", funciton_name="interp(c1)", funciton_name_alias="intp_c1" ,delete=False, ignore_update=1, fill_value="PREV") + self.force_window_close( + interval=10, + partition="tbname", + funciton_name="interp(c1)", + funciton_name_alias="intp_c1", + delete=False, + ignore_update=1, + fill_value="PREV", + ) # self.force_window_close(interval=random.randint(10, 15), partition="c1", ignore_update=1) # self.force_window_close(interval=random.randint(10, 15), partition="abs(c1)", ignore_update=1) # self.force_window_close(interval=random.randint(10, 15), partition=None, delete=True) @@ -319,7 +592,8 @@ def stop(self): tdSql.close() tdLog.success(f"{__file__} successfully executed") + event = threading.Event() tdCases.addLinux(__file__, TDTestCase()) -tdCases.addWindows(__file__, TDTestCase()) \ No newline at end of file +tdCases.addWindows(__file__, TDTestCase()) From b0c1e79f3a9facc99f268898ad31b99b58c49946 Mon Sep 17 00:00:00 2001 From: chenhaoran Date: Tue, 29 Oct 2024 09:52:50 +0800 Subject: [PATCH 378/695] test: execute balancing vgroup in a loop --- tests/system-test/7-tmq/ts-4674.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/system-test/7-tmq/ts-4674.py b/tests/system-test/7-tmq/ts-4674.py index 0b3dc1b077d8..c4ba99b725e5 100644 --- a/tests/system-test/7-tmq/ts-4674.py +++ b/tests/system-test/7-tmq/ts-4674.py @@ -35,10 +35,11 @@ def get_leader(self): def balance_vnode(self): leader_before = self.get_leader() - tdSql.query("balance vgroup leader") + while True: leader_after = -1 tdLog.debug("balancing vgroup leader") + tdSql.query("balance vgroup leader") while True: tdLog.debug("get new vgroup leader") leader_after = self.get_leader() @@ -51,6 +52,7 @@ def balance_vnode(self): break else : time.sleep(1) + tdLog.debug("leader not changed") def consume_TS_4674_Test(self): From 316f96fb405cfa729d421da5796ebb4a42bd4c65 Mon Sep 17 00:00:00 2001 From: chenhaoran Date: Tue, 29 Oct 2024 09:57:44 +0800 Subject: [PATCH 379/695] test: execute balancing vgroup in a loop --- tests/system-test/7-tmq/ts-4674.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/system-test/7-tmq/ts-4674.py b/tests/system-test/7-tmq/ts-4674.py index c4ba99b725e5..79379aaaed71 100644 --- a/tests/system-test/7-tmq/ts-4674.py +++ b/tests/system-test/7-tmq/ts-4674.py @@ -39,7 +39,7 @@ def balance_vnode(self): while True: leader_after = -1 tdLog.debug("balancing vgroup leader") - tdSql.query("balance vgroup leader") + tdSql.execute("balance vgroup leader") while True: tdLog.debug("get new vgroup leader") leader_after = self.get_leader() From a5501f30461b19be30f15a47c3fa82f8f6f3cec9 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Tue, 29 Oct 2024 10:07:08 +0800 Subject: [PATCH 380/695] test: add test cases. --- tests/script/tsim/stream/snodeCheck.sim | 64 +++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 tests/script/tsim/stream/snodeCheck.sim diff --git a/tests/script/tsim/stream/snodeCheck.sim b/tests/script/tsim/stream/snodeCheck.sim new file mode 100644 index 000000000000..f4ab8c812497 --- /dev/null +++ b/tests/script/tsim/stream/snodeCheck.sim @@ -0,0 +1,64 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/deploy.sh -n dnode2 -i 2 +system sh/deploy.sh -n dnode3 -i 3 + +system sh/cfg.sh -n dnode1 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode2 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode3 -c supportVnodes -v 4 + +print ========== step1 +system sh/exec.sh -n dnode1 -s start +sql connect + +print ========== step2 +sql create dnode $hostname port 7200 +system sh/exec.sh -n dnode2 -s start + +sql create dnode $hostname port 7300 +system sh/exec.sh -n dnode3 -s start + +$x = 0 +step2: + $x = $x + 1 + sleep 1000 + if $x == 10 then + print ====> dnode not ready! + return -1 + endi +sql select * from information_schema.ins_dnodes +print ===> $data00 $data01 $data02 $data03 $data04 $data05 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 +if $rows != 3 then + return -1 +endi +if $data(1)[4] != ready then + goto step2 +endi +if $data(2)[4] != ready then + goto step2 +endi + +print ========== step3 +sql drop database if exists test; +sql create database if not exists test vgroups 4 replica 3 precision "ms" ; +sql use test; + +sql create table test.test (ts timestamp, c1 int) tags (t1 int) ; + +print create stream without snode existing +sql_error create stream stream_t1 trigger at_once into str_dst as select count(*) from test interval(20s); + +print create snode +sql create snode on dnode 1; + +sql create stream stream_t1 trigger at_once into str_dst as select count(*) from test interval(20s); + +print drop snode and then create stream +sql drop snode on dnode 1; + +sql_error create stream stream_t2 trigger at_once into str_dst as select count(*) from test interval(20s); + +system sh/exec.sh -n dnode1 -s stop -x SIGINT +system sh/exec.sh -n dnode2 -s stop -x SIGINT +system sh/exec.sh -n dnode3 -s stop -x SIGINT From 18c1b76cb4a20205f21dfe3af6464853729135b8 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Tue, 29 Oct 2024 10:09:07 +0800 Subject: [PATCH 381/695] test: add into test suite --- tests/parallel_test/cases.task | 1 + tests/script/tsim/testsuit.sim | 1 + 2 files changed, 2 insertions(+) diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 09216add8261..2cf0ec7dc3e7 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -1317,6 +1317,7 @@ ,,y,script,./test.sh -f tsim/stream/basic2.sim ,,y,script,./test.sh -f tsim/stream/basic3.sim ,,y,script,./test.sh -f tsim/stream/basic4.sim +,,y,script,./test.sh -f tsim/stream/snodeCheck.sim ,,y,script,./test.sh -f tsim/stream/checkpointInterval0.sim ,,y,script,./test.sh -f tsim/stream/checkStreamSTable1.sim ,,y,script,./test.sh -f tsim/stream/checkStreamSTable.sim diff --git a/tests/script/tsim/testsuit.sim b/tests/script/tsim/testsuit.sim index c208a07488d3..ff3bb82aafa7 100644 --- a/tests/script/tsim/testsuit.sim +++ b/tests/script/tsim/testsuit.sim @@ -102,6 +102,7 @@ run tsim/stream/triggerInterval0.sim run tsim/stream/triggerSession0.sim run tsim/stream/distributeIntervalRetrive0.sim run tsim/stream/basic0.sim +run tsim/stream/snodeCheck.sim run tsim/stream/session0.sim run tsim/stream/schedSnode.sim run tsim/stream/partitionby.sim From 097d3caa902beab27bd2b0ba4dbefe6fa85cef8c Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Tue, 29 Oct 2024 10:20:27 +0800 Subject: [PATCH 382/695] fix(stream): add refId for meta at the end of init functions --- source/libs/stream/src/streamMeta.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/libs/stream/src/streamMeta.c b/source/libs/stream/src/streamMeta.c index 7e9b60b61a8b..17883f5fb103 100644 --- a/source/libs/stream/src/streamMeta.c +++ b/source/libs/stream/src/streamMeta.c @@ -434,7 +434,6 @@ int32_t streamMetaOpen(const char* path, void* ahandle, FTaskBuild buildTaskFn, pMeta->closeFlag = false; stInfo("vgId:%d open stream meta succ, latest checkpoint:%" PRId64 ", stage:%" PRId64, vgId, pMeta->chkpId, stage); - pMeta->rid = taosAddRef(streamMetaId, pMeta); // set the attribute when running on Linux OS TdThreadRwlockAttr attr; @@ -468,6 +467,9 @@ int32_t streamMetaOpen(const char* path, void* ahandle, FTaskBuild buildTaskFn, code = taosThreadMutexInit(&pMeta->backendMutex, NULL); TSDB_CHECK_CODE(code, lino, _err); + // add refId at the end of initialization function + pMeta->rid = taosAddRef(streamMetaId, pMeta); + *p = pMeta; return code; From 01819f202ede0331e2749467c8dd8bb0696a3486 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Tue, 29 Oct 2024 10:34:45 +0800 Subject: [PATCH 383/695] opt log --- source/util/src/tlog.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/source/util/src/tlog.c b/source/util/src/tlog.c index 6174a9cb3e32..d2c8d090e535 100644 --- a/source/util/src/tlog.c +++ b/source/util/src/tlog.c @@ -675,8 +675,8 @@ static inline void taosPrintLogImp(ELogLevel level, int32_t dflag, const char *b use taosPrintLogImpl_useStackBuffer to avoid stack overflow */ -int8_t taosPrintLogImpl_useStackBuffer(const char *flags, int32_t level, int32_t dflag, const char *format, - va_list args) { +static int8_t taosPrintLogImplUseStackBuffer(const char *flags, int32_t level, int32_t dflag, const char *format, + va_list args) { char buffer[LOG_MAX_STACK_LINE_BUFFER_SIZE]; int32_t len = taosBuildLogHead(buffer, flags); @@ -696,8 +696,8 @@ int8_t taosPrintLogImpl_useStackBuffer(const char *flags, int32_t level, int32_t } return 0; } -int8_t taosPrintLogImpl_useHeapBuffer(const char *flags, int32_t level, int32_t dflag, const char *format, - va_list args) { +static int8_t taosPrintLogImplUseHeapBuffer(const char *flags, int32_t level, int32_t dflag, const char *format, + va_list args) { char *buffer = taosMemoryCalloc(1, LOG_MAX_LINE_BUFFER_SIZE + 1); if (buffer == NULL) { return 1; @@ -726,9 +726,9 @@ void taosPrintLog(const char *flags, int32_t level, int32_t dflag, const char *f va_start(argpointer, format); va_copy(argpointer_copy, argpointer); - if (taosPrintLogImpl_useStackBuffer(flags, level, dflag, format, argpointer) == 0) { + if (taosPrintLogImplUseStackBuffer(flags, level, dflag, format, argpointer) == 0) { } else { - TAOS_UNUSED(taosPrintLogImpl_useHeapBuffer(flags, level, dflag, format, argpointer_copy)); + TAOS_UNUSED(taosPrintLogImplUseHeapBuffer(flags, level, dflag, format, argpointer_copy)); } va_end(argpointer_copy); va_end(argpointer); From 281668738acf1b057d78b0cb52c1407f5c280997 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Tue, 29 Oct 2024 10:20:27 +0800 Subject: [PATCH 384/695] fix(stream): add refId for meta at the end of init functions --- source/libs/stream/src/streamMeta.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/libs/stream/src/streamMeta.c b/source/libs/stream/src/streamMeta.c index 7e9b60b61a8b..17883f5fb103 100644 --- a/source/libs/stream/src/streamMeta.c +++ b/source/libs/stream/src/streamMeta.c @@ -434,7 +434,6 @@ int32_t streamMetaOpen(const char* path, void* ahandle, FTaskBuild buildTaskFn, pMeta->closeFlag = false; stInfo("vgId:%d open stream meta succ, latest checkpoint:%" PRId64 ", stage:%" PRId64, vgId, pMeta->chkpId, stage); - pMeta->rid = taosAddRef(streamMetaId, pMeta); // set the attribute when running on Linux OS TdThreadRwlockAttr attr; @@ -468,6 +467,9 @@ int32_t streamMetaOpen(const char* path, void* ahandle, FTaskBuild buildTaskFn, code = taosThreadMutexInit(&pMeta->backendMutex, NULL); TSDB_CHECK_CODE(code, lino, _err); + // add refId at the end of initialization function + pMeta->rid = taosAddRef(streamMetaId, pMeta); + *p = pMeta; return code; From 02d56519a21f93484da08024cf2d7a871099e0e0 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Tue, 29 Oct 2024 11:23:58 +0800 Subject: [PATCH 385/695] feat: parse dnodeId from dnodeList --- include/util/taoserror.h | 1 + source/dnode/mnode/impl/inc/mndVgroup.h | 2 +- source/dnode/mnode/impl/src/mndDb.c | 56 ++++++++++++++++++++++--- source/dnode/mnode/impl/src/mndVgroup.c | 2 +- source/util/src/terror.c | 1 + 5 files changed, 55 insertions(+), 7 deletions(-) diff --git a/include/util/taoserror.h b/include/util/taoserror.h index db4a3c3fe42a..fc03487ce3bf 100644 --- a/include/util/taoserror.h +++ b/include/util/taoserror.h @@ -353,6 +353,7 @@ int32_t taosGetErrSize(); #define TSDB_CODE_MND_ENCRYPT_NOT_ALLOW_CHANGE TAOS_DEF_ERROR_CODE(0, 0x039B) #define TSDB_CODE_MND_INVALID_WAL_LEVEL TAOS_DEF_ERROR_CODE(0, 0x039C) #define TSDB_CODE_MND_INVALID_DNODE_LIST_FMT TAOS_DEF_ERROR_CODE(0, 0x039D) +#define TSDB_CODE_MND_DNODE_LIST_REPEAT TAOS_DEF_ERROR_CODE(0, 0x039E) // mnode-node #define TSDB_CODE_MND_MNODE_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x03A0) diff --git a/source/dnode/mnode/impl/inc/mndVgroup.h b/source/dnode/mnode/impl/inc/mndVgroup.h index 682a51a68781..01596094eb48 100644 --- a/source/dnode/mnode/impl/inc/mndVgroup.h +++ b/source/dnode/mnode/impl/inc/mndVgroup.h @@ -37,7 +37,7 @@ int64_t mndGetVgroupMemory(SMnode *pMnode, SDbObj *pDb, SVgObj *pVgroup); SArray *mndBuildDnodesArray(SMnode *, int32_t exceptDnodeId); int32_t mndAllocSmaVgroup(SMnode *, SDbObj *pDb, SVgObj *pVgroup); -int32_t mndAllocVgroup(SMnode *, SDbObj *pDb, SVgObj **ppVgroups); +int32_t mndAllocVgroup(SMnode *, SDbObj *pDb, SVgObj **ppVgroups, SArray *dnodeList); int32_t mndAddNewVgPrepareAction(SMnode *, STrans *pTrans, SVgObj *pVg); int32_t mndAddCreateVnodeAction(SMnode *, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup, SVnodeGid *pVgid); int32_t mndAddAlterVnodeConfirmAction(SMnode *, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup); diff --git a/source/dnode/mnode/impl/src/mndDb.c b/source/dnode/mnode/impl/src/mndDb.c index aea92662a1ec..409e6ff8488a 100644 --- a/source/dnode/mnode/impl/src/mndDb.c +++ b/source/dnode/mnode/impl/src/mndDb.c @@ -746,7 +746,7 @@ static int32_t mndSetCreateDbUndoActions(SMnode *pMnode, STrans *pTrans, SDbObj TAOS_RETURN(code); } -static int32_t mndCreateDb(SMnode *pMnode, SRpcMsg *pReq, SCreateDbReq *pCreate, SUserObj *pUser) { +static int32_t mndCreateDb(SMnode *pMnode, SRpcMsg *pReq, SCreateDbReq *pCreate, SUserObj *pUser, SArray *dnodeList) { int32_t code = 0; SUserObj newUserObj = {0}; SDbObj dbObj = {0}; @@ -823,7 +823,7 @@ static int32_t mndCreateDb(SMnode *pMnode, SRpcMsg *pReq, SCreateDbReq *pCreate, } SVgObj *pVgroups = NULL; - if ((code = mndAllocVgroup(pMnode, &dbObj, &pVgroups)) != 0) { + if ((code = mndAllocVgroup(pMnode, &dbObj, &pVgroups, dnodeList)) != 0) { mError("db:%s, failed to create, alloc vgroup failed, since %s", pCreate->db, terrstr()); TAOS_RETURN(code); } @@ -883,10 +883,48 @@ static void mndBuildAuditDetailInt64(char *detail, char *tmp, char *format, int6 } } -static int32_t mndCheckDbDnodeList(SMnode *pMnode, SCreateDbReq *pReq) { +static int32_t mndCheckDbDnodeList(SMnode *pMnode, SCreateDbReq *pReq, SArray *dnodeList) { if (pReq->dnodeListStr[0] == 0) return 0; mInfo("db:%s, dnode list is %s", pReq->db, pReq->dnodeListStr); + + char *pos = pReq->dnodeListStr; + while (pos != NULL) { + if (pos[0] < '0' || pos[0] > '9') { + terrno = TSDB_CODE_MND_INVALID_DNODE_LIST_FMT; + return terrno; + } + + int32_t dnodeId = taosStr2Int32(pos, NULL, 10); + SDnodeObj *pDnode = mndAcquireDnode(pMnode, dnodeId); + if (pDnode != NULL) { + mndReleaseDnode(pMnode, pDnode); + if (taosArrayPush(dnodeList, &dnodeId) == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + return terrno; + } + } else { + mError("db:%s, invalid dnode:%d from pos:%s", pReq->db, dnodeId, pos); + terrno = TSDB_CODE_MND_DNODE_NOT_EXIST; + return terrno; + } + + pos = strstr(pos, ","); + if (pos != NULL) { + pos++; + } + } + + int32_t dnodeSize = (int32_t)taosArrayGetSize(dnodeList); + for (int32_t i = 0; i < dnodeSize; ++i) { + for (int32_t j = i + 1; j < dnodeSize; ++j) { + if (((int32_t *)TARRAY_DATA(dnodeList))[i] == ((int32_t *)TARRAY_DATA(dnodeList))[j]) { + terrno = TSDB_CODE_MND_DNODE_LIST_REPEAT; + return terrno; + } + } + } + return 0; } @@ -939,6 +977,13 @@ static int32_t mndProcessCreateDbReq(SRpcMsg *pReq) { SDbObj *pDb = NULL; SUserObj *pUser = NULL; SCreateDbReq createReq = {0}; + SArray *dnodeList = NULL; + + dnodeList = taosArrayInit(mndGetDnodeSize(pMnode), sizeof(int32_t)); + if (dnodeList == NULL) { + code = TSDB_CODE_OUT_OF_MEMORY; + goto _OVER; + } TAOS_CHECK_GOTO(tDeserializeSCreateDbReq(pReq->pCont, pReq->contLen, &createReq), NULL, _OVER); #ifdef WINDOWS @@ -982,11 +1027,11 @@ static int32_t mndProcessCreateDbReq(SRpcMsg *pReq) { TAOS_CHECK_GOTO(mndCheckDbEncryptKey(pMnode, &createReq), &lino, _OVER); - TAOS_CHECK_GOTO(mndCheckDbDnodeList(pMnode, &createReq), &lino, _OVER); + TAOS_CHECK_GOTO(mndCheckDbDnodeList(pMnode, &createReq, dnodeList), &lino, _OVER); TAOS_CHECK_GOTO(mndAcquireUser(pMnode, pReq->info.conn.user, &pUser), &lino, _OVER); - TAOS_CHECK_GOTO(mndCreateDb(pMnode, pReq, &createReq, pUser), &lino, _OVER); + TAOS_CHECK_GOTO(mndCreateDb(pMnode, pReq, &createReq, pUser, dnodeList), &lino, _OVER); if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS; SName name = {0}; @@ -1003,6 +1048,7 @@ static int32_t mndProcessCreateDbReq(SRpcMsg *pReq) { mndReleaseDb(pMnode, pDb); mndReleaseUser(pMnode, pUser); tFreeSCreateDbReq(&createReq); + taosArrayDestroy(dnodeList); TAOS_RETURN(code); } diff --git a/source/dnode/mnode/impl/src/mndVgroup.c b/source/dnode/mnode/impl/src/mndVgroup.c index 5a79ac6bc8d0..2076b49cff5f 100644 --- a/source/dnode/mnode/impl/src/mndVgroup.c +++ b/source/dnode/mnode/impl/src/mndVgroup.c @@ -868,7 +868,7 @@ int32_t mndAllocSmaVgroup(SMnode *pMnode, SDbObj *pDb, SVgObj *pVgroup) { return 0; } -int32_t mndAllocVgroup(SMnode *pMnode, SDbObj *pDb, SVgObj **ppVgroups) { +int32_t mndAllocVgroup(SMnode *pMnode, SDbObj *pDb, SVgObj **ppVgroups, SArray *dnodeList) { int32_t code = -1; SArray *pArray = NULL; SVgObj *pVgroups = NULL; diff --git a/source/util/src/terror.c b/source/util/src/terror.c index 43fd47fcc7fe..a4872e35cf76 100644 --- a/source/util/src/terror.c +++ b/source/util/src/terror.c @@ -269,6 +269,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_SYS_TABLENAME, "Invalid system table TAOS_DEFINE_ERROR(TSDB_CODE_MND_ENCRYPT_NOT_ALLOW_CHANGE, "Encryption is not allowed to be changed after database is created") TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_WAL_LEVEL, "Invalid option, wal_level 0 should be used with replica 1") TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_DNODE_LIST_FMT, "Invalid dnode list format") +TAOS_DEFINE_ERROR(TSDB_CODE_MND_DNODE_LIST_REPEAT, "There are duplicate items in the dnode list") // mnode-node TAOS_DEFINE_ERROR(TSDB_CODE_MND_MNODE_ALREADY_EXIST, "Mnode already exists") From cf3e84e79d88e4227aa40c6aabee1e3ab5199d36 Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Tue, 29 Oct 2024 12:25:25 +0800 Subject: [PATCH 386/695] tsdb/cache: cache schema to reuse --- source/dnode/vnode/src/inc/tsdb.h | 4 +++- source/dnode/vnode/src/tsdb/tsdbCache.c | 26 +++++++++++++++++++++++-- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/source/dnode/vnode/src/inc/tsdb.h b/source/dnode/vnode/src/inc/tsdb.h index ed8f99ec7531..f1ee5267a1ae 100644 --- a/source/dnode/vnode/src/inc/tsdb.h +++ b/source/dnode/vnode/src/inc/tsdb.h @@ -342,7 +342,9 @@ typedef struct { rocksdb_writeoptions_t *writeoptions; rocksdb_readoptions_t *readoptions; rocksdb_writebatch_t *writebatch; - TdThreadMutex writeBatchMutex; + TdThreadMutex writeBatchMutex; + tb_uid_t suid; + tb_uid_t uid; STSchema *pTSchema; } SRocksCache; diff --git a/source/dnode/vnode/src/tsdb/tsdbCache.c b/source/dnode/vnode/src/tsdb/tsdbCache.c index 5583e464ed40..fa375a9fa0a3 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCache.c +++ b/source/dnode/vnode/src/tsdb/tsdbCache.c @@ -221,7 +221,7 @@ static int32_t tsdbOpenRocksCache(STsdb *pTsdb) { rocksdb_writebatch_t *writebatch = rocksdb_writebatch_create(); - TAOS_CHECK_GOTO(taosThreadMutexInit(&pTsdb->rCache.writeBatchMutex, NULL), &lino, _err6) ; + TAOS_CHECK_GOTO(taosThreadMutexInit(&pTsdb->rCache.writeBatchMutex, NULL), &lino, _err6); pTsdb->rCache.writebatch = writebatch; pTsdb->rCache.my_comparator = cmp; @@ -230,6 +230,8 @@ static int32_t tsdbOpenRocksCache(STsdb *pTsdb) { pTsdb->rCache.readoptions = readoptions; pTsdb->rCache.flushoptions = flushoptions; pTsdb->rCache.db = db; + pTsdb->rCache.suid = -1; + pTsdb->rCache.uid = -1; pTsdb->rCache.pTSchema = NULL; TAOS_RETURN(code); @@ -1302,6 +1304,22 @@ static int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, SArray TAOS_RETURN(code); } +static int32_t tsdbUpdateSkm(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid) { + if (suid) { + if (pTsdb->rCache.suid == suid) { + pTsdb->rCache.uid = uid; + return 0; + } + } else if (pTsdb->rCache.uid == uid) { + return 0; + } + + pTsdb->rCache.suid = suid; + pTsdb->rCache.uid = uid; + tDestroyTSchema(pTsdb->rCache.pTSchema); + return metaGetTbTSchemaEx(pTsdb->pVnode->pMeta, suid, uid, -1, &pTsdb->rCache.pTSchema); +} + int32_t tsdbCacheRowFormatUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, int64_t version, int32_t nRow, SRow **aRow) { int32_t code = 0, lino = 0; @@ -1314,7 +1332,11 @@ int32_t tsdbCacheRowFormatUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, int6 SArray *ctxArray = NULL; SSHashObj *iColHash = NULL; + TAOS_CHECK_GOTO(tsdbUpdateSkm(pTsdb, suid, uid), &lino, _exit); + pTSchema = pTsdb->rCache.pTSchema; + /* TAOS_CHECK_GOTO(metaGetTbTSchemaEx(pTsdb->pVnode->pMeta, suid, uid, sver, &pTSchema), &lino, _exit); + */ TSDBROW tRow = {.type = TSDBROW_ROW_FMT, .version = version}; int32_t nCol = pTSchema->numOfCols; @@ -1393,7 +1415,7 @@ int32_t tsdbCacheRowFormatUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, int6 } _exit: - taosMemoryFreeClear(pTSchema); + // taosMemoryFreeClear(pTSchema); taosArrayDestroy(ctxArray); tSimpleHashCleanup(iColHash); From 518f38172037695378d4cf0cf40def48e74e561f Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Tue, 29 Oct 2024 12:57:17 +0800 Subject: [PATCH 387/695] Update index.md --- docs/zh/06-advanced/06-data-analysis/index.md | 153 +++++++++++++++++- 1 file changed, 150 insertions(+), 3 deletions(-) diff --git a/docs/zh/06-advanced/06-data-analysis/index.md b/docs/zh/06-advanced/06-data-analysis/index.md index a1ca53d7d0c7..c4f0bd8edacb 100644 --- a/docs/zh/06-advanced/06-data-analysis/index.md +++ b/docs/zh/06-advanced/06-data-analysis/index.md @@ -5,9 +5,156 @@ title: 数据分析功能 ## 概述 -TDengine 提供数据分析功能的扩展组件,通过引入 ANode,TDengine 能够支持时间序列的机器学习分析 - -下图展示了数据分析的技术架构。 +TDengine 通过 ANode(AnalysisNode) 是提供数据分析功能的扩展组件,通过 Restful 接口提供分析服务,从而拓展 TDengine 的功能,支持时间序列高级分析功能。 +ANode 是无状态的数据分析节点,集群中可以存在多个 ANode节点,相互之间没有关联。将 ANode 注册到 TDengine 集群以后,通过 SQL 语句即可调用并完成时序分析任务。 +下图是数据分析的技术架构示意图。 ![数据分析功能架构图](./pic/data-analysis.png) +## 安装部署 +### 环境准备 +ANode 的要求节点上准备有 Python 3.10 及以上版本以及相应的Python包自动安装组件 Pip ,同时请确保能够正常连接互联网。 + +### 安装及卸载 +使用专门的 ANode 安装包 TDengine-enterprise-anode-1.x.x.tar.gz 进行 ANode 的安装部署工作,安装过程与 TDengien 的安装流程一致。 + +```bash +tar -xzvf TDengine-enterprise-anode-1.0.0.tar.gz +cd TDengine-enterprise-anode-1.0.0 +sudo ./install.sh +``` + +卸载 ANode,执行命令 `rmtaosanode` 即可。 + +### 其他 +为了避免 ANode 安装后影响目标节点现有的 Python 库。 ANode 使用 Python 虚拟环境运行,安装后的默认 Python 目录处于 `/var/lib/taos/taosanode/venv/`。为了避免反复安装虚拟环境带来的开销,卸载 ANode 并不会自动删除该虚拟环境,如果您确认不需要 Python 的虚拟环境,可以手动删除。 + +## 启动及停止服务 +安装 ANode 以后,可以使用`systemctl`来管理 ANode 的服务。使用如下命令可以启动/停止/检查状态。 + +```bash +systemctl start taosanoded +systemctl stop taosanoded +systemctl status taosanoded +``` + +## 目录及配置说明 +|目录/文件|说明| +|---------------|------| +|/usr/local/taos/taosanode/bin|Anode 的可执行文件目录| +|/usr/local/taos/taosanode/resource|Anode 的资源文件目录,连接到文件夹 /var/lib/taos/taosanode/resource/| +|/usr/local/taos/taosanode/lib|Anode 库文件目录| +|/var/lib/taos/taosanode/model/|Anode 的模型文件目录,链接到文件夹 /var/lib/taos/taosanode/model| +|/var/log/taos/taosanode/|Anode 的日志文件目录| +|/etc/taos/taosanode.ini|Anode 的配置文件| + +### 配置说明 + +Anode 提供的 RestFul 服务使用 uWSGI 驱动,因此 ANode 的配置和 uWSGI 的配置在同一个配置文件中,具体如下: + +```ini +[uwsgi] +# charset +env=LC_ALL=en_US.UTF-8 + +# ip:port +http = 127.0.0.1:6050 + +# the local unix socket file than communicate to Nginx +#socket = 127.0.0.1:8001 +#socket-timeout=10 + +# base directory +chdir = /usr/local/taos/taosanode/lib + +# initialize python file +wsgi-file = /usr/local/taos/taosanode/lib/app.py + +# invoke app model +callable = app + +# auto remove unix Socket and pid file when stopping +vacuum = true + +# socket exec model +#chmod-socket = 664 + +# uWSGI pid +uid=root + +# uWSGI gid +gid=root + +# main process +master = true + +# the number of worker processes +processes = 2 + +# pid file +pidfile = /usr/local/taos/taosanode/uwsgi.pid + +# enable threads +enable-threads=true + +# the number of threads for each process +threads=2 + +# memory useage report +memory-report = true +reload-mercy = 10 + +# conflict with systemctl, so do NOT uncomment this +# daemonize = /var/log/taos/taosanode/taosanode.log + +# set log +logto = /var/log/taos/taosanode/taosanode.log + +# monitor server +stats = 127.0.0.1:8387 + +# python virtual environment directory +virtualenv = /usr/local/taos/taosanode/venv/ + +[taosanode] +# default app log file +app-log = /var/log/taos/taosanode/taosanode.app.log + +# model storage directory +model-dir=/usr/local/taos/taosanode/model/ + +# default log level +log-level = DEBUG + +``` + +## ANode 基本操作 +### 管理 ANode +创建 ANode 的 SQL 语法如下: +```sql +CREATE ANODE {node_url} +``` +node_url 是提供服务的 ANode 的 IP 和 PORT, 例如:`create anode 'http://localhost:6050'`。启动 ANode 以后如果不注册到 TDengine 集群中,无法提供正常的服务。 + +查看 ANode +列出集群中所有的数据分析节点,包括其 `FQDN`, `PORT`, `STATUS`。 +```sql +SHOW ANODES; +``` +查看当前 ANode 提供的时序数据分析服务列表 + +```SQL +SHOW ANODES FULL; +``` + +强制刷新 TDengine 集群中分析算法缓存 +```SQL +UPDATE ANODE {node_id} +UPDATE ALL ANODES +``` + +删除集群中的 ANode 的 SQL 语法如下: +```sql +DROP ANODE {anode_id} +``` +删除 ANode 不等于停止相应的进程。 From f1c95a84dca2973532ee0fe46e95171919816b56 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Tue, 29 Oct 2024 13:51:52 +0800 Subject: [PATCH 388/695] adj ci --- tests/parallel_test/cases.task | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index d5480871c36c..d03edecc975f 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -1396,7 +1396,7 @@ ,,y,script,./test.sh -f tsim/stream/streamTwaError.sim ,,y,script,./test.sh -f tsim/stream/streamTwaFwcFill.sim ,,y,script,./test.sh -f tsim/stream/streamTwaFwcFillPrimaryKey.sim -,,y,script,./test.sh -f tsim/stream/streamTwaFwcIntervalPrimaryKeyl.sim +,,y,script,./test.sh -f tsim/stream/streamTwaFwcIntervalPrimaryKey.sim ,,y,script,./test.sh -f tsim/stream/triggerInterval0.sim ,,y,script,./test.sh -f tsim/stream/triggerSession0.sim ,,y,script,./test.sh -f tsim/stream/udTableAndCol0.sim From fc2e62a18cced179af96d5a45afd5267327682d9 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Tue, 29 Oct 2024 14:14:26 +0800 Subject: [PATCH 389/695] use len of context buffer --- source/libs/executor/src/sysscanoperator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/executor/src/sysscanoperator.c b/source/libs/executor/src/sysscanoperator.c index 057913e04e96..8aad415f70a3 100644 --- a/source/libs/executor/src/sysscanoperator.c +++ b/source/libs/executor/src/sysscanoperator.c @@ -2032,7 +2032,7 @@ static EDealRes getDBNameFromConditionWalker(SNode* pNode, void* pContext) { SValueNode* node = (SValueNode*)pNode; char* dbName = nodesGetValueFromNode(node); - tstrncpy((char*)pContext, varDataVal(dbName), varDataLen(dbName) + 1); + tstrncpy((char*)pContext, varDataVal(dbName), TSDB_DB_NAME_LEN); return DEAL_RES_END; // stop walk } default: From 65b69d64c95e20f347a70b0033804e8a5f6d1875 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Tue, 29 Oct 2024 14:22:05 +0800 Subject: [PATCH 390/695] Update index.md --- docs/zh/06-advanced/06-data-analysis/index.md | 76 ++++++++++++++++++- 1 file changed, 73 insertions(+), 3 deletions(-) diff --git a/docs/zh/06-advanced/06-data-analysis/index.md b/docs/zh/06-advanced/06-data-analysis/index.md index c4f0bd8edacb..464acf7bec95 100644 --- a/docs/zh/06-advanced/06-data-analysis/index.md +++ b/docs/zh/06-advanced/06-data-analysis/index.md @@ -128,13 +128,17 @@ log-level = DEBUG ``` +**提示** +请勿设置 `daemonize` 参数,该参数会导致 uWSGI 与 systemctl 冲突,从而无法正常启动。 + + ## ANode 基本操作 ### 管理 ANode 创建 ANode 的 SQL 语法如下: ```sql CREATE ANODE {node_url} ``` -node_url 是提供服务的 ANode 的 IP 和 PORT, 例如:`create anode 'http://localhost:6050'`。启动 ANode 以后如果不注册到 TDengine 集群中,无法提供正常的服务。 +node_url 是提供服务的 ANode 的 IP 和 PORT, 例如:`create anode 'http://localhost:6050'`。启动 ANode 以后如果不注册到 TDengine 集群中,无法提供正常的服务。不建议 ANode 注册到两个或多个集群中。 查看 ANode 列出集群中所有的数据分析节点,包括其 `FQDN`, `PORT`, `STATUS`。 @@ -153,8 +157,74 @@ UPDATE ANODE {node_id} UPDATE ALL ANODES ``` -删除集群中的 ANode 的 SQL 语法如下: +删除集群中的 ANode 语法如下: ```sql DROP ANODE {anode_id} ``` -删除 ANode 不等于停止相应的进程。 +删除 ANode 只是将 ANode 从 TDengine 集群中删除,管理 ANode 的启停仍然需要使用`systemctl`命令。 + +### 时序数据分析功能 + +#### 时序数据异常检测 +异常窗口寻找时间序列中可能出现异常的多个时间区间,可基于此窗口边界,对数据进行聚合或标量查询。 + +```SQL +SELECT {aggregate_function} +FROM {subquery} +WHERE {filer_condition} +ANOMALY_WINDOW(column, options) +``` + +**语法说明** +1. column:进行时序数据异常检测的输入数据列,当前只支持单列输入,且只能是数值类型,不能是字符类型(例如:`NCHAR` `VARCHAR` `VARBINARY`等类型),**不支持函数表达式**。 +2. options:调用异常检测的算法,及与算法相关的参数。采用 逗号分隔的K/V字符串表示,其中的字符串不需要使用单引号、双引号、或转意号等符号,不能使用中文及其他宽字符。例如:`algo=ksigma, k=2` 表示进行异常检测的算法是 ksigma,该算法接受的输入参数是 2。 + +全部支持的参数列表如下: +|参数|含义|默认值| +|---|---|---| +|algo|异常检测调用的算法|iqr| +|wncheck|对输入数据列是否进行白噪声检查|取值为0或者1,默认值为 1,表示进行白噪声检查| + +异常检测的返回结果以窗口的形式呈现,因此窗口查询相关的伪列在这种场景下仍然可用。可以使用的伪列如下: +1. _WSTART: 异常窗口开始时间戳 +2. _WEND:异常窗口结束时间戳 +3. _WDURATION:异常窗口持续时间 + +**示例** + + + +**使用说明** +1. 异常检测的结果可以作为外层查询的子查询输入,在 `select` 子句中使用的聚合函数或标量函数与其他类型的窗口查询相同。 +2. 输入数据默认进行白噪声检查,如果检查结果是输入数据是白噪声,将不会有任何(异常)窗口信息返回。 + + +#### 时序数据预测 +数据预测以一段训练数据作为输入,预测接下来若干时间点的后续运行结果。其调用的语法如下: +```SQL +SELECT {pseudo_column}, forecast(column, options) from {subquery} where [where_clause] +``` + +**语法说明** +1. forecast:关键字 +2. column:预测的时序数据列。与异常检测相同,只支持数值类型输入。 +3. options:异常检测函数的参数,使用规则与 anomaly_window 相同 + +|参数|含义|默认值| +|---|---|---| +|algo|预测分析使用的算法|holtwinters| +|wncheck|白噪声(white noise data)检查|默认值为 1,0 表示不进行检查| +|conf|预测数据的置信区间范围 ,取值范围[0, 100]|95| +|every|预测数据的采样间隔|输入数据的采样间隔| +|start|预测结果的开始时间戳|无| +|rows|预测结果的记录数|无| + +预测查询结果新增了三个伪列,具体如下: +1. _FROWTS:预测结果的时间戳 +2. _FLOW:置信区间下界 +3. _FHIGH:置信区间上界。对于没有置信区间的预测算法,其置信区间同预测结果。 + +**示例** + + +**使用说明** From 5261c87620ff5f48d2ee2605211f4f07c47df4fd Mon Sep 17 00:00:00 2001 From: chenhaoran Date: Tue, 29 Oct 2024 14:32:40 +0800 Subject: [PATCH 391/695] tetst:add testecase for clear consumer with session and poll timout --- tests/army/tmq/drop_lost_comsumers.py | 160 ++++++++++++++------------ tests/army/tmq/per_consumer.py | 33 +++--- 2 files changed, 105 insertions(+), 88 deletions(-) diff --git a/tests/army/tmq/drop_lost_comsumers.py b/tests/army/tmq/drop_lost_comsumers.py index b88aae8c037d..d2ec7965165d 100644 --- a/tests/army/tmq/drop_lost_comsumers.py +++ b/tests/army/tmq/drop_lost_comsumers.py @@ -20,9 +20,17 @@ from frame.common import * class TaosConsumer: + #TODo: add to tq.py and remove from here def __init__(self): - pass - + self.sub_once = True + self.once_consumer_rows = 0 + self.sub_log = False + self.safe_counter = ThreadSafeCounter() + + def log_info(self, message): + if self.sub_log: + tdLog.info(message) + def sub_consumer(self ,consumer ,group_id ,topic_name ): group_id = int(group_id) if group_id < 100 : @@ -33,9 +41,9 @@ def sub_consumer(self ,consumer ,group_id ,topic_name ): nrows = 0 while True: start = datetime.now() - print(f"time:{start},consumer:{group_id}, start to consume") + tdLog.info(f"time:{start},consumer:{group_id}, start to consume") message = consumer.poll(timeout=10.0) - + if message: id = message.offset() topic = message.topic() @@ -48,14 +56,11 @@ def sub_consumer(self ,consumer ,group_id ,topic_name ): values = block.fetchall end = datetime.now() elapsed_time = end -start - print(f"time:{end},consumer:{group_id}, elapsed time:{elapsed_time},consumer_nrows:{nrows},consumer_addrows:{addrows}, consumer_ncols:{ncols},offset:{id}") + tdLog.info(f"time:{end},consumer:{group_id}, elapsed time:{elapsed_time},consumer_nrows:{nrows},consumer_addrows:{addrows}, consumer_ncols:{ncols},offset:{id}") consumer.commit() - print(f"consumer:{group_id},consumer_nrows:{nrows}") + tdLog.info(f"consumer:{group_id},consumer_nrows:{nrows}") # consumer.unsubscribe() # consumer.close() - # break - # if nrows >= 1000000: - # break def set_conf(self,td_connect_ip="localhost",group_id=1,client_id="test_consumer_py",enable_auto_commit="false",auto_commit_interval_ms="1000",auto_offset_reset="earliest",msg_with_table_name="true",session_timeout_ms=10000,max_poll_interval_ms=180000,experimental_snapshot_enable="false"): conf = { @@ -74,7 +79,7 @@ def set_conf(self,td_connect_ip="localhost",group_id=1,client_id="test_consumer_ } return conf - def sub_consumer_once(self,consumer, group_id, topic_name, counter, stop_event): + def sub_consumer_once(self, consumer, group_id, topic_name, stop_event): group_id = int(group_id) if group_id < 100 : consumer.subscribe([topic_name]) @@ -83,11 +88,12 @@ def sub_consumer_once(self,consumer, group_id, topic_name, counter, stop_event): while not stop_event.is_set(): start = datetime.now() - tdLog.info(f"time:{start},consumer:{group_id}, start to consume") - #start = datetime.now() - #print(f"time:{start},consumer:{group_id}, start to consume") - tdLog.info(f"consumer_nrows:{consumer_nrows}") - message = consumer.poll(timeout=10.0) + self.log_info(f"time:{start},consumer:{group_id}, start to consume,consumer_nrows:{consumer_nrows}") + if consumer_nrows < self.once_consumer_rows: + message = consumer.poll(timeout=1.0) + elif consumer_nrows >= self.once_consumer_rows: + pass + # tdLog.info("stop consumer when consumer all rows") if message: id = message.offset() @@ -96,43 +102,35 @@ def sub_consumer_once(self,consumer, group_id, topic_name, counter, stop_event): for block in message: addrows = block.nrows() nrows += block.nrows() - counter.rows(block.nrows()) + self.safe_counter.rows(block.nrows()) ncols = block.ncols() values = block.fetchall end = datetime.now() elapsed_time = end -start - # tdLog.info(f"time:{end},consumer:{group_id}, elapsed time:{elapsed_time},consumer_nrows:{nrows},consumer_addrows:{addrows}, consumer_ncols:{ncols},offset:{id}") - consumer.commit() - # tdLog.info(f"consumer:{group_id},consumer_nrows:{nrows}") + + self.log_info(f"time:{end},consumer:{group_id}, elapsed time:{elapsed_time},consumer_nrows:{nrows},consumer_addrows:{addrows}, consumer_ncols:{ncols},offset:{id}") + self.log_info(f"consumer:{group_id},consumer_nrows:{nrows},counter.counter:{self.safe_counter.counter}") + # consumer.commit() consumer_nrows = nrows - # consumer.unsubscribe() - # consumer.close() - # break + # consumer.unsubscribe() + # consumer.close() + # break + tdLog.info("Consumer subscription thread is stopping.") - print("Consumer subscription thread is stopping.") - def taosc_consumer(self, conf, topic_name, counter,stop_event): + def taosc_consumer(self, conf: list, topic_name: str, stop_event): try: - print(conf) + tdLog.info(conf) from taos.tmq import Consumer - print("3333") + tdLog.info("start to config consumer") consumer = Consumer(conf) - print("456") + tdLog.info("start to subscribe") group_id = int(conf["group.id"]) tdLog.info(f"{consumer},{group_id}") - except Exception as e: - tdLog.exit(f"{e}") - #counsmer sub: - # while True: - # try: - # self.sub_consumer_once(consumer,group_id) - # except Exception as e: - # print(str(e)) - # time.sleep(1) - # break - # only consumer once - try: - self.sub_consumer_once(consumer, group_id, topic_name, counter, stop_event) - + if self.sub_once: + self.sub_consumer_once(consumer, group_id, topic_name, stop_event) + else: + self.sub_consumer(consumer, group_id, topic_name) + # only consumer once except Exception as e: tdLog.exit(f"{e}") @@ -162,6 +160,17 @@ def init(self, conn, logSql, replicaVar=1): tdLog.debug(f"start to excute {__file__}") tdSql.init(conn.cursor()) self.consumer_instance = TaosConsumer() + #db parameter + self.table_number = 1000 + self.rows_per_table = 1000 + #consumer parameter + self.consumer_groups_num = 2 + self.session_timeout_ms= 180000 + self.max_poll_interval_ms= 180000 + #case consumer parameter + self.consumer_rows_per_thread = self.table_number * self.rows_per_table + self.consumer_all_rows = self.consumer_rows_per_thread * self.consumer_groups_num + #tdSql.init(conn.cursor(), logSql) # output sql.txt file def caseDescription(self): ''' @@ -172,20 +181,22 @@ def caseDescription(self): ''' return - def check_consumer(self,count,rows): + def check_consumer(self, count, rows, stop_event=None): time.sleep(count) - print(count) try: + tdLog.info(f"wait timeout count:{count} and check consumer status whether is closed") for ct in range(5): tdSql.query(f'show consumers') anser_rows=tdSql.getRows() - if tdSql.checkRows(rows): + if anser_rows == rows: break else: time.sleep(1) - tdLog.info(f"wait for {count} seconds to check that consumers number is {rows}") + tdLog.info(f"wait for {count} seconds to check that consumers number is {anser_rows}") if anser_rows != rows: - tdLog.exit(f"consumer number is not {rows}") + if stop_event: + stop_event.set() + tdLog.exit(f"consumer number is {anser_rows } but not expected {rows}") except Exception as e: tdLog.exit(f"{e},check consumer error") @@ -206,58 +217,63 @@ def drop_session_timeout_consmuers(self, consumer_groups_num, session_timeout_ms os.system("rm -rf consumer.log") - def drop_max_poll_timeout_consmuers(self, consumer_groups_num, consumer_rows, topic_name, timeout): + def drop_max_poll_timeout_consmuers(self, topic_name, timeout): tdSql.execute(f'drop topic if exists {topic_name};') tdSql.execute(f'use db_sub') tdSql.execute(f'create topic {topic_name} as select * from db_sub.meters;') threads = [] - counter = ThreadSafeCounter() + self.safe_counter = ThreadSafeCounter() + self.consumer_instance.safe_counter = self.safe_counter stop_event = threading.Event() - for id in range(consumer_groups_num): + self.consumer_instance.once_consumer_rows = self.consumer_rows_per_thread + tdLog.info(f"consumer_rows:{self.consumer_instance.once_consumer_rows}") + self.consumer_instance.sub_once = True + for id in range(self.consumer_groups_num): conf = self.consumer_instance.set_conf(group_id=id, session_timeout_ms=self.session_timeout_ms, max_poll_interval_ms=self.max_poll_interval_ms) - threads.append(threading.Thread(target=self.consumer_instance.taosc_consumer, args=(conf, topic_name, counter, stop_event))) + threads.append(threading.Thread(target=self.consumer_instance.taosc_consumer, args=(conf, topic_name, stop_event))) for tr in threads: tr.start() - consumer_all_rows = consumer_rows * consumer_groups_num while True: - if counter.get() < consumer_all_rows: + if self.safe_counter.get() < self.consumer_all_rows: time.sleep(5) - print(f"consumer_all_rows:{consumer_all_rows},counter.get():{counter.get()}") - elif counter.get() >= consumer_all_rows: - self.check_consumer(timeout+20, 0) + tdLog.info(f"consumer_all_rows:{self.consumer_all_rows},counter.get():{self.safe_counter.get()}") + elif self.safe_counter.get() >= self.consumer_all_rows: + # adding 5s is for heartbeat check + self.check_consumer(timeout+5, 0, stop_event) stop_event.set() tr.join() break - time.sleep(2) + time.sleep(1) tdSql.execute(f'drop topic if exists {topic_name};') - def case_session_12s(self): + def case_session_timeout(self): + tdLog.info("start to test session_timeout_ms=12s") #test session_timeout_ms=12s - session_timeout_ms=12000 - max_poll_interval_ms=180000 + self.session_timeout_ms=12000 + self.max_poll_interval_ms=180000 topic_name = "select_d1" - self.drop_session_timeout_consmuers(consumer_groups_num=1, session_timeout_ms=session_timeout_ms, max_poll_interval_ms=max_poll_interval_ms, topic_name=topic_name , timeout=int(session_timeout_ms/1000)) - + self.drop_session_timeout_consmuers(consumer_groups_num=1, session_timeout_ms=self.session_timeout_ms, max_poll_interval_ms=self.max_poll_interval_ms, topic_name=topic_name , timeout=int(self.session_timeout_ms/1000)) + tdLog.info("stop to test session_timeout_ms=12s and done ") - def case_max_poll_12s(self,consumer_rows): - #test max_poll_interval_ms=12s + def case_max_poll_timeout(self): + tdLog.info("start to test max_poll_interval_ms=20s") + #test max_poll_interval_ms=20s self.session_timeout_ms=180000 - self.max_poll_interval_ms=12000 + self.max_poll_interval_ms=20000 topic_name = "select_d1" - self.drop_max_poll_timeout_consmuers(consumer_groups_num=1, topic_name=topic_name, consumer_rows=consumer_rows, timeout=int(self.max_poll_interval_ms/1000)) + self.drop_max_poll_timeout_consmuers(topic_name=topic_name, timeout=int(self.max_poll_interval_ms/1000)) + tdLog.info("stop to test max_poll_interval_ms=20s and done ") def run(self): - table_number = 1000 - rows_per_table = 1000 vgroups = 4 - etool.benchMark(command=f"-d db_sub -t {table_number} -n {rows_per_table} -v {vgroups} -y") - consumer_rows = table_number * rows_per_table # 消费的目标行数 - # self.case_session_12s() - self.case_max_poll_12s(consumer_rows) - remaining_threads = threading.Lock() + etool.benchMark(command=f"-d db_sub -t {self.table_number} -n {self.rows_per_table} -v {vgroups} -a {self.replicaVar} -y") + # test case start here + + self.case_session_timeout() + self.case_max_poll_timeout() def stop(self): tdSql.close() diff --git a/tests/army/tmq/per_consumer.py b/tests/army/tmq/per_consumer.py index 67c82d5d3e5d..810d7d44f81b 100644 --- a/tests/army/tmq/per_consumer.py +++ b/tests/army/tmq/per_consumer.py @@ -2,6 +2,7 @@ import taos import time from datetime import datetime +from frame.log import * import subprocess from multiprocessing import Process import threading @@ -11,7 +12,7 @@ try: conn = taos.connect() except Exception as e: - print(str(e)) + tdLog.info(str(e)) @click.command() @click.option('-c', '--consumer-groups-num', "consumer_group_num", default=1, help='Number of consumer group.') @@ -20,10 +21,10 @@ def test_timeout_sub(consumer_group_num,session_timeout_ms,max_poll_interval_ms): threads = [] - print(consumer_group_num,session_timeout_ms,max_poll_interval_ms) + tdLog.info(consumer_group_num,session_timeout_ms,max_poll_interval_ms) for id in range(consumer_group_num): conf = set_conf(group_id=id,session_timeout_ms=session_timeout_ms,max_poll_interval_ms=max_poll_interval_ms) - print(conf) + tdLog.info(conf) threads.append(threading.Thread(target=taosc_consumer, args=(conf,))) for tr in threads: tr.start() @@ -36,13 +37,13 @@ def sub_consumer(consumer,group_id): try: consumer.subscribe(["select_d1"]) except Exception as e: - print(f"subscribe error") + tdLog.info(f"subscribe error") exit(1) nrows = 0 while True: start = datetime.now() - print(f"time:{start},consumer:{group_id}, start to consume") + tdLog.info(f"time:{start},consumer:{group_id}, start to consume") message = consumer.poll(timeout=10.0) if message: @@ -57,9 +58,9 @@ def sub_consumer(consumer,group_id): values = block.fetchall end = datetime.now() elapsed_time = end -start - print(f"time:{end},consumer:{group_id}, elapsed time:{elapsed_time},consumer_nrows:{nrows},consumer_addrows:{addrows}, consumer_ncols:{ncols},offset:{id}") + tdLog.info(f"time:{end},consumer:{group_id}, elapsed time:{elapsed_time},consumer_nrows:{nrows},consumer_addrows:{addrows}, consumer_ncols:{ncols},offset:{id}") consumer.commit() - print(f"consumer:{group_id},consumer_nrows:{nrows}") + tdLog.info(f"consumer:{group_id},consumer_nrows:{nrows}") # consumer.unsubscribe() # consumer.close() # break @@ -73,14 +74,14 @@ def sub_consumer_once(consumer,group_id): consumer_nrows = 0 while True: start = datetime.now() - print(f"time:{start},consumer:{group_id}, start to consume") + tdLog.info(f"time:{start},consumer:{group_id}, start to consume") #start = datetime.now() - #print(f"time:{start},consumer:{group_id}, start to consume") - print(f"consumer_nrows:{consumer_nrows}") + #tdLog.info(f"time:{start},consumer:{group_id}, start to consume") + tdLog.info(f"consumer_nrows:{consumer_nrows}") if consumer_nrows < 1000000: message = consumer.poll(timeout=10.0) else: - print(" stop consumer when consumer all rows") + tdLog.info(" stop consumer when consumer all rows") if message: id = message.offset() @@ -94,9 +95,9 @@ def sub_consumer_once(consumer,group_id): values = block.fetchall end = datetime.now() elapsed_time = end -start - # print(f"time:{end},consumer:{group_id}, elapsed time:{elapsed_time},consumer_nrows:{nrows},consumer_addrows:{addrows}, consumer_ncols:{ncols},offset:{id}") + # tdLog.info(f"time:{end},consumer:{group_id}, elapsed time:{elapsed_time},consumer_nrows:{nrows},consumer_addrows:{addrows}, consumer_ncols:{ncols},offset:{id}") consumer.commit() - # print(f"consumer:{group_id},consumer_nrows:{nrows}") + # tdLog.info(f"consumer:{group_id},consumer_nrows:{nrows}") consumer_nrows = nrows # consumer.unsubscribe() # consumer.close() @@ -122,20 +123,20 @@ def set_conf(td_connect_ip="localhost",group_id=1,client_id="test_consumer_py",e def taosc_consumer(conf): consumer = Consumer(conf) group_id = int(conf["group.id"]) - print(f"{consumer},{group_id}") + tdLog.info(f"{consumer},{group_id}") #counsmer sub: # while True: # try: # self.sub_consumer_once(consumer,group_id) # except Exception as e: - # print(str(e)) + # tdLog.info(str(e)) # time.sleep(1) # break # only consumer once try: sub_consumer_once(consumer,group_id) except Exception as e: - print(str(e)) + tdLog.info(str(e)) #consumer.close() From d99c9159082d2047cf10d008420c50749735aff5 Mon Sep 17 00:00:00 2001 From: chenhaoran Date: Tue, 29 Oct 2024 14:38:33 +0800 Subject: [PATCH 392/695] test:use the black tool to format the code style --- tests/army/tmq/drop_lost_comsumers.py | 211 ++++++++++++++++---------- tests/army/tmq/per_consumer.py | 123 +++++++++------ 2 files changed, 211 insertions(+), 123 deletions(-) diff --git a/tests/army/tmq/drop_lost_comsumers.py b/tests/army/tmq/drop_lost_comsumers.py index d2ec7965165d..f4559310898a 100644 --- a/tests/army/tmq/drop_lost_comsumers.py +++ b/tests/army/tmq/drop_lost_comsumers.py @@ -1,4 +1,3 @@ - import taos import sys import time @@ -19,8 +18,9 @@ from taos.tmq import Consumer from frame.common import * + class TaosConsumer: - #TODo: add to tq.py and remove from here + # TODo: add to tq.py and remove from here def __init__(self): self.sub_once = True self.once_consumer_rows = 0 @@ -31,43 +31,57 @@ def log_info(self, message): if self.sub_log: tdLog.info(message) - def sub_consumer(self ,consumer ,group_id ,topic_name ): + def sub_consumer(self, consumer, group_id, topic_name): group_id = int(group_id) - if group_id < 100 : + if group_id < 100: try: consumer.subscribe([topic_name]) except TmqError: - tdLog.exit(f"subscribe error") + tdLog.exit(f"subscribe error") nrows = 0 while True: start = datetime.now() tdLog.info(f"time:{start},consumer:{group_id}, start to consume") message = consumer.poll(timeout=10.0) - + if message: id = message.offset() topic = message.topic() database = message.database() - + for block in message: addrows = block.nrows() nrows += block.nrows() ncols = block.ncols() values = block.fetchall end = datetime.now() - elapsed_time = end -start - tdLog.info(f"time:{end},consumer:{group_id}, elapsed time:{elapsed_time},consumer_nrows:{nrows},consumer_addrows:{addrows}, consumer_ncols:{ncols},offset:{id}") + elapsed_time = end - start + tdLog.info( + f"time:{end},consumer:{group_id}, elapsed time:{elapsed_time},consumer_nrows:{nrows},consumer_addrows:{addrows}, consumer_ncols:{ncols},offset:{id}" + ) consumer.commit() tdLog.info(f"consumer:{group_id},consumer_nrows:{nrows}") - # consumer.unsubscribe() - # consumer.close() + # consumer.unsubscribe() + # consumer.close() - def set_conf(self,td_connect_ip="localhost",group_id=1,client_id="test_consumer_py",enable_auto_commit="false",auto_commit_interval_ms="1000",auto_offset_reset="earliest",msg_with_table_name="true",session_timeout_ms=10000,max_poll_interval_ms=180000,experimental_snapshot_enable="false"): + def set_conf( + self, + td_connect_ip="localhost", + group_id=1, + client_id="test_consumer_py", + enable_auto_commit="false", + auto_commit_interval_ms="1000", + auto_offset_reset="earliest", + msg_with_table_name="true", + session_timeout_ms=10000, + max_poll_interval_ms=180000, + experimental_snapshot_enable="false", + ): conf = { # auth options # consume options "td.connect.ip": f"{td_connect_ip}", - "group.id": f"{group_id}", + "group.id": f"{group_id}", "client.id": f"{client_id}", "enable.auto.commit": f"{enable_auto_commit}", "auto.commit.interval.ms": f"{auto_commit_interval_ms}", @@ -75,25 +89,28 @@ def set_conf(self,td_connect_ip="localhost",group_id=1,client_id="test_consumer_ "msg.with.table.name": f"{msg_with_table_name}", "session.timeout.ms": f"{session_timeout_ms}", "max.poll.interval.ms": f"{max_poll_interval_ms}", - "experimental.snapshot.enable" :f"{experimental_snapshot_enable}", + "experimental.snapshot.enable": f"{experimental_snapshot_enable}", } return conf - + def sub_consumer_once(self, consumer, group_id, topic_name, stop_event): group_id = int(group_id) - if group_id < 100 : + if group_id < 100: consumer.subscribe([topic_name]) nrows = 0 consumer_nrows = 0 - + while not stop_event.is_set(): start = datetime.now() - self.log_info(f"time:{start},consumer:{group_id}, start to consume,consumer_nrows:{consumer_nrows}") + self.log_info( + f"time:{start},consumer:{group_id}, start to consume,consumer_nrows:{consumer_nrows}" + ) if consumer_nrows < self.once_consumer_rows: - message = consumer.poll(timeout=1.0) + message = consumer.poll(timeout=1.0) elif consumer_nrows >= self.once_consumer_rows: + # when break the loop, the consumer will be closed, so we need to continue to keep consumer alive util the stop_event is set pass - # tdLog.info("stop consumer when consumer all rows") + # tdLog.info("stop consumer when consumer all rows") if message: id = message.offset() @@ -106,37 +123,42 @@ def sub_consumer_once(self, consumer, group_id, topic_name, stop_event): ncols = block.ncols() values = block.fetchall end = datetime.now() - elapsed_time = end -start + elapsed_time = end - start - self.log_info(f"time:{end},consumer:{group_id}, elapsed time:{elapsed_time},consumer_nrows:{nrows},consumer_addrows:{addrows}, consumer_ncols:{ncols},offset:{id}") - self.log_info(f"consumer:{group_id},consumer_nrows:{nrows},counter.counter:{self.safe_counter.counter}") + self.log_info( + f"time:{end},consumer:{group_id}, elapsed time:{elapsed_time},consumer_nrows:{nrows},consumer_addrows:{addrows}, consumer_ncols:{ncols},offset:{id}" + ) + self.log_info( + f"consumer:{group_id},consumer_nrows:{nrows},counter.counter:{self.safe_counter.counter}" + ) # consumer.commit() consumer_nrows = nrows # consumer.unsubscribe() # consumer.close() - # break + # break tdLog.info("Consumer subscription thread is stopping.") def taosc_consumer(self, conf: list, topic_name: str, stop_event): try: tdLog.info(conf) from taos.tmq import Consumer + tdLog.info("start to config consumer") consumer = Consumer(conf) tdLog.info("start to subscribe") group_id = int(conf["group.id"]) tdLog.info(f"{consumer},{group_id}") if self.sub_once: - self.sub_consumer_once(consumer, group_id, topic_name, stop_event) + self.sub_consumer_once(consumer, group_id, topic_name, stop_event) else: self.sub_consumer(consumer, group_id, topic_name) # only consumer once except Exception as e: tdLog.exit(f"{e}") - - #consumer.close() - + # consumer.close() + + class ThreadSafeCounter: def __init__(self): self.counter = 0 @@ -154,45 +176,51 @@ def get(self): class TDTestCase: # updatecfgDict = {'debugFlag': 135, 'asynclog': 0} - def init(self, conn, logSql, replicaVar=1): self.replicaVar = int(replicaVar) tdLog.debug(f"start to excute {__file__}") tdSql.init(conn.cursor()) self.consumer_instance = TaosConsumer() - #db parameter + # db parameter self.table_number = 1000 self.rows_per_table = 1000 - #consumer parameter + # consumer parameter self.consumer_groups_num = 2 - self.session_timeout_ms= 180000 - self.max_poll_interval_ms= 180000 - #case consumer parameter + self.session_timeout_ms = 180000 + self.max_poll_interval_ms = 180000 + # case consumer parameter self.consumer_rows_per_thread = self.table_number * self.rows_per_table - self.consumer_all_rows = self.consumer_rows_per_thread * self.consumer_groups_num + self.consumer_all_rows = ( + self.consumer_rows_per_thread * self.consumer_groups_num + ) + + # tdSql.init(conn.cursor(), logSql) # output sql.txt file - #tdSql.init(conn.cursor(), logSql) # output sql.txt file def caseDescription(self): - ''' - drop_lost_consmuers: + """ + drop_lost_consmuers: 1. verifying that the boundary and valid values of session_timeout_ms are in effect 2. verifying that the boundary and valid values of max_poll_interval_ms are in effect 3. verifying that consumer will be closed when the session_timeout_ms and max_poll_interval_ms is expired - ''' + """ return - + def check_consumer(self, count, rows, stop_event=None): time.sleep(count) try: - tdLog.info(f"wait timeout count:{count} and check consumer status whether is closed") + tdLog.info( + f"wait timeout count:{count} and check consumer status whether is closed" + ) for ct in range(5): - tdSql.query(f'show consumers') - anser_rows=tdSql.getRows() + tdSql.query(f"show consumers") + anser_rows = tdSql.getRows() if anser_rows == rows: break else: time.sleep(1) - tdLog.info(f"wait for {count} seconds to check that consumers number is {anser_rows}") + tdLog.info( + f"wait for {count} seconds to check that consumers number is {anser_rows}" + ) if anser_rows != rows: if stop_event: stop_event.set() @@ -200,27 +228,37 @@ def check_consumer(self, count, rows, stop_event=None): except Exception as e: tdLog.exit(f"{e},check consumer error") - def drop_session_timeout_consmuers(self, consumer_groups_num, session_timeout_ms, max_poll_interval_ms, topic_name, timeout): - tdSql.execute(f'drop topic if exists {topic_name};') - tdSql.execute(f'use db_sub') - tdSql.execute(f'create topic {topic_name} as select * from db_sub.meters;') + def drop_session_timeout_consmuers( + self, + consumer_groups_num, + session_timeout_ms, + max_poll_interval_ms, + topic_name, + timeout, + ): + tdSql.execute(f"drop topic if exists {topic_name};") + tdSql.execute(f"use db_sub") + tdSql.execute(f"create topic {topic_name} as select * from db_sub.meters;") # start consumer and config some parameters - os.system(f"nohup python3 ./tmq/per_consumer.py -c {consumer_groups_num} -s {session_timeout_ms} -p {max_poll_interval_ms} > consumer.log &") + os.system( + f"nohup python3 ./tmq/per_consumer.py -c {consumer_groups_num} -s {session_timeout_ms} -p {max_poll_interval_ms} > consumer.log &" + ) # wait 4s for consuming data time.sleep(4) # kill consumer to simulate session_timeout_ms tdLog.info("kill per_consumer.py") - tdCom.kill_signal_process(signal=9,processor_name="python3\s*./tmq/per_consumer.py") - self.check_consumer(timeout,0) - tdSql.execute(f'drop topic if exists {topic_name};') + tdCom.kill_signal_process( + signal=9, processor_name="python3\s*./tmq/per_consumer.py" + ) + self.check_consumer(timeout, 0) + tdSql.execute(f"drop topic if exists {topic_name};") os.system("rm -rf consumer.log") - - + def drop_max_poll_timeout_consmuers(self, topic_name, timeout): - tdSql.execute(f'drop topic if exists {topic_name};') - tdSql.execute(f'use db_sub') - tdSql.execute(f'create topic {topic_name} as select * from db_sub.meters;') + tdSql.execute(f"drop topic if exists {topic_name};") + tdSql.execute(f"use db_sub") + tdSql.execute(f"create topic {topic_name} as select * from db_sub.meters;") threads = [] self.safe_counter = ThreadSafeCounter() @@ -230,48 +268,68 @@ def drop_max_poll_timeout_consmuers(self, topic_name, timeout): tdLog.info(f"consumer_rows:{self.consumer_instance.once_consumer_rows}") self.consumer_instance.sub_once = True for id in range(self.consumer_groups_num): - conf = self.consumer_instance.set_conf(group_id=id, session_timeout_ms=self.session_timeout_ms, max_poll_interval_ms=self.max_poll_interval_ms) - threads.append(threading.Thread(target=self.consumer_instance.taosc_consumer, args=(conf, topic_name, stop_event))) + conf = self.consumer_instance.set_conf( + group_id=id, + session_timeout_ms=self.session_timeout_ms, + max_poll_interval_ms=self.max_poll_interval_ms, + ) + threads.append( + threading.Thread( + target=self.consumer_instance.taosc_consumer, + args=(conf, topic_name, stop_event), + ) + ) for tr in threads: tr.start() - + while True: if self.safe_counter.get() < self.consumer_all_rows: time.sleep(5) - tdLog.info(f"consumer_all_rows:{self.consumer_all_rows},counter.get():{self.safe_counter.get()}") + tdLog.info( + f"consumer_all_rows:{self.consumer_all_rows},counter.get():{self.safe_counter.get()}" + ) elif self.safe_counter.get() >= self.consumer_all_rows: - # adding 5s is for heartbeat check - self.check_consumer(timeout+5, 0, stop_event) + # adding 5s is for heartbeat check + self.check_consumer(timeout + 5, 0, stop_event) stop_event.set() tr.join() break time.sleep(1) - tdSql.execute(f'drop topic if exists {topic_name};') - + tdSql.execute(f"drop topic if exists {topic_name};") + def case_session_timeout(self): tdLog.info("start to test session_timeout_ms=12s") - #test session_timeout_ms=12s - self.session_timeout_ms=12000 - self.max_poll_interval_ms=180000 + # test session_timeout_ms=12s + self.session_timeout_ms = 12000 + self.max_poll_interval_ms = 180000 topic_name = "select_d1" - self.drop_session_timeout_consmuers(consumer_groups_num=1, session_timeout_ms=self.session_timeout_ms, max_poll_interval_ms=self.max_poll_interval_ms, topic_name=topic_name , timeout=int(self.session_timeout_ms/1000)) + self.drop_session_timeout_consmuers( + consumer_groups_num=1, + session_timeout_ms=self.session_timeout_ms, + max_poll_interval_ms=self.max_poll_interval_ms, + topic_name=topic_name, + timeout=int(self.session_timeout_ms / 1000), + ) tdLog.info("stop to test session_timeout_ms=12s and done ") def case_max_poll_timeout(self): tdLog.info("start to test max_poll_interval_ms=20s") - #test max_poll_interval_ms=20s - self.session_timeout_ms=180000 - self.max_poll_interval_ms=20000 + # test max_poll_interval_ms=20s + self.session_timeout_ms = 180000 + self.max_poll_interval_ms = 20000 topic_name = "select_d1" - self.drop_max_poll_timeout_consmuers(topic_name=topic_name, timeout=int(self.max_poll_interval_ms/1000)) + self.drop_max_poll_timeout_consmuers( + topic_name=topic_name, timeout=int(self.max_poll_interval_ms / 1000) + ) tdLog.info("stop to test max_poll_interval_ms=20s and done ") - def run(self): vgroups = 4 - etool.benchMark(command=f"-d db_sub -t {self.table_number} -n {self.rows_per_table} -v {vgroups} -a {self.replicaVar} -y") + etool.benchMark( + command=f"-d db_sub -t {self.table_number} -n {self.rows_per_table} -v {vgroups} -a {self.replicaVar} -y" + ) # test case start here - + self.case_session_timeout() self.case_max_poll_timeout() @@ -279,5 +337,6 @@ def stop(self): tdSql.close() tdLog.success(f"{__file__} successfully executed") + tdCases.addLinux(__file__, TDTestCase()) tdCases.addWindows(__file__, TDTestCase()) diff --git a/tests/army/tmq/per_consumer.py b/tests/army/tmq/per_consumer.py index 810d7d44f81b..418c88dead43 100644 --- a/tests/army/tmq/per_consumer.py +++ b/tests/army/tmq/per_consumer.py @@ -9,21 +9,46 @@ from taos.tmq import Consumer import click +# TDDO +# 1. using tmq common class to replace the function, file drop_lost_consumers.py has the same function + try: conn = taos.connect() except Exception as e: tdLog.info(str(e)) - -@click.command() -@click.option('-c', '--consumer-groups-num', "consumer_group_num", default=1, help='Number of consumer group.') -@click.option('-s', '--session-timeout-ms', "session_timeout_ms", default=60000, help='session timeout:ms') -@click.option('-p', '--max-poll-interval-ms',"max_poll_interval_ms", default=180000, help='max poll interval timeout:ms') -def test_timeout_sub(consumer_group_num,session_timeout_ms,max_poll_interval_ms): + +@click.command() +@click.option( + "-c", + "--consumer-groups-num", + "consumer_group_num", + default=1, + help="Number of consumer group.", +) +@click.option( + "-s", + "--session-timeout-ms", + "session_timeout_ms", + default=60000, + help="session timeout:ms", +) +@click.option( + "-p", + "--max-poll-interval-ms", + "max_poll_interval_ms", + default=180000, + help="max poll interval timeout:ms", +) +def test_timeout_sub(consumer_group_num, session_timeout_ms, max_poll_interval_ms): threads = [] - tdLog.info(consumer_group_num,session_timeout_ms,max_poll_interval_ms) + tdLog.info(consumer_group_num, session_timeout_ms, max_poll_interval_ms) for id in range(consumer_group_num): - conf = set_conf(group_id=id,session_timeout_ms=session_timeout_ms,max_poll_interval_ms=max_poll_interval_ms) + conf = set_conf( + group_id=id, + session_timeout_ms=session_timeout_ms, + max_poll_interval_ms=max_poll_interval_ms, + ) tdLog.info(conf) threads.append(threading.Thread(target=taosc_consumer, args=(conf,))) for tr in threads: @@ -31,52 +56,54 @@ def test_timeout_sub(consumer_group_num,session_timeout_ms,max_poll_interval_ms) for tr in threads: tr.join() -def sub_consumer(consumer,group_id): + +def sub_consumer(consumer, group_id): group_id = int(group_id) - if group_id < 100 : + if group_id < 100: try: consumer.subscribe(["select_d1"]) except Exception as e: - tdLog.info(f"subscribe error") - exit(1) + tdLog.info(f"subscribe error") + exit(1) nrows = 0 while True: start = datetime.now() tdLog.info(f"time:{start},consumer:{group_id}, start to consume") message = consumer.poll(timeout=10.0) - + if message: id = message.offset() topic = message.topic() database = message.database() - + for block in message: addrows = block.nrows() nrows += block.nrows() ncols = block.ncols() values = block.fetchall end = datetime.now() - elapsed_time = end -start - tdLog.info(f"time:{end},consumer:{group_id}, elapsed time:{elapsed_time},consumer_nrows:{nrows},consumer_addrows:{addrows}, consumer_ncols:{ncols},offset:{id}") + elapsed_time = end - start + tdLog.info( + f"time:{end},consumer:{group_id}, elapsed time:{elapsed_time},consumer_nrows:{nrows},consumer_addrows:{addrows}, consumer_ncols:{ncols},offset:{id}" + ) consumer.commit() tdLog.info(f"consumer:{group_id},consumer_nrows:{nrows}") - # consumer.unsubscribe() - # consumer.close() - # break - # if nrows >= 1000000: - # break -def sub_consumer_once(consumer,group_id): + # consumer.unsubscribe() + # consumer.close() + + +def sub_consumer_once(consumer, group_id): group_id = int(group_id) - if group_id < 100 : + if group_id < 100: consumer.subscribe(["select_d1"]) nrows = 0 consumer_nrows = 0 while True: start = datetime.now() tdLog.info(f"time:{start},consumer:{group_id}, start to consume") - #start = datetime.now() - #tdLog.info(f"time:{start},consumer:{group_id}, start to consume") + # start = datetime.now() + # tdLog.info(f"time:{start},consumer:{group_id}, start to consume") tdLog.info(f"consumer_nrows:{consumer_nrows}") if consumer_nrows < 1000000: message = consumer.poll(timeout=10.0) @@ -87,28 +114,40 @@ def sub_consumer_once(consumer,group_id): id = message.offset() topic = message.topic() database = message.database() - + for block in message: addrows = block.nrows() nrows += block.nrows() ncols = block.ncols() values = block.fetchall end = datetime.now() - elapsed_time = end -start + elapsed_time = end - start # tdLog.info(f"time:{end},consumer:{group_id}, elapsed time:{elapsed_time},consumer_nrows:{nrows},consumer_addrows:{addrows}, consumer_ncols:{ncols},offset:{id}") consumer.commit() # tdLog.info(f"consumer:{group_id},consumer_nrows:{nrows}") consumer_nrows = nrows - # consumer.unsubscribe() - # consumer.close() - # break + # consumer.unsubscribe() + # consumer.close() + # break + -def set_conf(td_connect_ip="localhost",group_id=1,client_id="test_consumer_py",enable_auto_commit="false",auto_commit_interval_ms="1000",auto_offset_reset="earliest",msg_with_table_name="true",session_timeout_ms=10000,max_poll_interval_ms=20000,experimental_snapshot_enable="false"): +def set_conf( + td_connect_ip="localhost", + group_id=1, + client_id="test_consumer_py", + enable_auto_commit="false", + auto_commit_interval_ms="1000", + auto_offset_reset="earliest", + msg_with_table_name="true", + session_timeout_ms=10000, + max_poll_interval_ms=20000, + experimental_snapshot_enable="false", +): conf = { # auth options # consume options "td.connect.ip": f"{td_connect_ip}", - "group.id": f"{group_id}", + "group.id": f"{group_id}", "client.id": f"{client_id}", "enable.auto.commit": f"{enable_auto_commit}", "auto.commit.interval.ms": f"{auto_commit_interval_ms}", @@ -116,30 +155,20 @@ def set_conf(td_connect_ip="localhost",group_id=1,client_id="test_consumer_py",e "msg.with.table.name": f"{msg_with_table_name}", "session.timeout.ms": f"{session_timeout_ms}", "max.poll.interval.ms": f"{max_poll_interval_ms}", - "experimental.snapshot.enable" :f"{experimental_snapshot_enable}", + "experimental.snapshot.enable": f"{experimental_snapshot_enable}", } return conf + def taosc_consumer(conf): consumer = Consumer(conf) group_id = int(conf["group.id"]) tdLog.info(f"{consumer},{group_id}") - #counsmer sub: - # while True: - # try: - # self.sub_consumer_once(consumer,group_id) - # except Exception as e: - # tdLog.info(str(e)) - # time.sleep(1) - # break - # only consumer once try: - sub_consumer_once(consumer,group_id) + sub_consumer_once(consumer, group_id) except Exception as e: tdLog.info(str(e)) - - #consumer.close() -if __name__ == '__main__': - test_timeout_sub() \ No newline at end of file +if __name__ == "__main__": + test_timeout_sub() From adf7ea29cbfe142391e3113d6342e508973135ce Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Tue, 29 Oct 2024 13:09:39 +0800 Subject: [PATCH 393/695] feat: alloc dnode from input dnode list --- include/common/tmsg.h | 1 + source/common/src/tmsg.c | 7 +++++ source/dnode/mnode/impl/inc/mndVgroup.h | 2 +- source/dnode/mnode/impl/src/mndDb.c | 41 ++++++++++++++++++------- source/dnode/mnode/impl/src/mndVgroup.c | 28 ++++++++++++----- source/libs/parser/inc/sql.y | 1 + source/libs/parser/src/parTranslater.c | 2 ++ 7 files changed, 63 insertions(+), 19 deletions(-) diff --git a/include/common/tmsg.h b/include/common/tmsg.h index d14facec259d..8bba723bf1c3 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -1369,6 +1369,7 @@ typedef struct { int32_t sqlLen; char* sql; int8_t withArbitrator; + char dnodeListStr[TSDB_DNODE_LIST_LEN]; } SAlterDbReq; int32_t tSerializeSAlterDbReq(void* buf, int32_t bufLen, SAlterDbReq* pReq); diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index 6cbf3665a727..3cc8ea4250b6 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -4017,6 +4017,8 @@ int32_t tSerializeSAlterDbReq(void *buf, int32_t bufLen, SAlterDbReq *pReq) { ENCODESQL(); TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->withArbitrator)); + TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->dnodeListStr)); + tEndEncode(&encoder); _exit: @@ -4084,6 +4086,11 @@ int32_t tDeserializeSAlterDbReq(void *buf, int32_t bufLen, SAlterDbReq *pReq) { if (!tDecodeIsEnd(&decoder)) { TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->withArbitrator)); } + + if (!tDecodeIsEnd(&decoder)) { + TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->dnodeListStr)); + } + tEndDecode(&decoder); _exit: diff --git a/source/dnode/mnode/impl/inc/mndVgroup.h b/source/dnode/mnode/impl/inc/mndVgroup.h index 01596094eb48..a8a806e497b2 100644 --- a/source/dnode/mnode/impl/inc/mndVgroup.h +++ b/source/dnode/mnode/impl/inc/mndVgroup.h @@ -35,7 +35,7 @@ void mndSortVnodeGid(SVgObj *pVgroup); int64_t mndGetVnodesMemory(SMnode *pMnode, int32_t dnodeId); int64_t mndGetVgroupMemory(SMnode *pMnode, SDbObj *pDb, SVgObj *pVgroup); -SArray *mndBuildDnodesArray(SMnode *, int32_t exceptDnodeId); +SArray *mndBuildDnodesArray(SMnode *, int32_t exceptDnodeId, SArray *dnodeList); int32_t mndAllocSmaVgroup(SMnode *, SDbObj *pDb, SVgObj *pVgroup); int32_t mndAllocVgroup(SMnode *, SDbObj *pDb, SVgObj **ppVgroups, SArray *dnodeList); int32_t mndAddNewVgPrepareAction(SMnode *, STrans *pTrans, SVgObj *pVg); diff --git a/source/dnode/mnode/impl/src/mndDb.c b/source/dnode/mnode/impl/src/mndDb.c index 409e6ff8488a..f01f6b0a6f91 100644 --- a/source/dnode/mnode/impl/src/mndDb.c +++ b/source/dnode/mnode/impl/src/mndDb.c @@ -883,12 +883,20 @@ static void mndBuildAuditDetailInt64(char *detail, char *tmp, char *format, int6 } } -static int32_t mndCheckDbDnodeList(SMnode *pMnode, SCreateDbReq *pReq, SArray *dnodeList) { - if (pReq->dnodeListStr[0] == 0) return 0; +static int32_t mndCheckDbDnodeList(SMnode *pMnode, char *db, char *dnodeListStr, SArray *dnodeList) { + if (dnodeListStr[0] == 0) return 0; - mInfo("db:%s, dnode list is %s", pReq->db, pReq->dnodeListStr); + mInfo("db:%s, dnode list is %s", db, dnodeListStr); - char *pos = pReq->dnodeListStr; + int32_t len = strlen(dnodeListStr); + for (int32_t i = 0; i < len; ++i) { + if ((dnodeListStr[i] < '0' || dnodeListStr[i] > '9') && dnodeListStr[i] != ',') { + terrno = TSDB_CODE_MND_INVALID_DNODE_LIST_FMT; + return terrno; + } + } + + char *pos = dnodeListStr; while (pos != NULL) { if (pos[0] < '0' || pos[0] > '9') { terrno = TSDB_CODE_MND_INVALID_DNODE_LIST_FMT; @@ -904,7 +912,7 @@ static int32_t mndCheckDbDnodeList(SMnode *pMnode, SCreateDbReq *pReq, SArray *d return terrno; } } else { - mError("db:%s, invalid dnode:%d from pos:%s", pReq->db, dnodeId, pos); + mError("db:%s, invalid dnode:%d from pos:%s", db, dnodeId, pos); terrno = TSDB_CODE_MND_DNODE_NOT_EXIST; return terrno; } @@ -1027,7 +1035,7 @@ static int32_t mndProcessCreateDbReq(SRpcMsg *pReq) { TAOS_CHECK_GOTO(mndCheckDbEncryptKey(pMnode, &createReq), &lino, _OVER); - TAOS_CHECK_GOTO(mndCheckDbDnodeList(pMnode, &createReq, dnodeList), &lino, _OVER); + TAOS_CHECK_GOTO(mndCheckDbDnodeList(pMnode, createReq.db, createReq.dnodeListStr, dnodeList), &lino, _OVER); TAOS_CHECK_GOTO(mndAcquireUser(pMnode, pReq->info.conn.user, &pUser), &lino, _OVER); @@ -1218,12 +1226,13 @@ static int32_t mndSetAlterDbCommitLogs(SMnode *pMnode, STrans *pTrans, SDbObj *p TAOS_RETURN(code); } -static int32_t mndSetAlterDbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj *pOldDb, SDbObj *pNewDb) { +static int32_t mndSetAlterDbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj *pOldDb, SDbObj *pNewDb, + SArray *dnodeList) { int32_t code = 0, lino = 0; SSdb *pSdb = pMnode->pSdb; void *pIter = NULL; SVgObj *pVgroup = NULL; - SArray *pArray = mndBuildDnodesArray(pMnode, 0); + SArray *pArray = mndBuildDnodesArray(pMnode, 0, dnodeList); while (1) { pIter = sdbFetch(pSdb, SDB_VGROUP, pIter, (void **)&pVgroup); @@ -1262,7 +1271,7 @@ static int32_t mndSetAlterDbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj * TAOS_RETURN(code); } -static int32_t mndAlterDb(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pOld, SDbObj *pNew) { +static int32_t mndAlterDb(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pOld, SDbObj *pNew, SArray *dnodeList) { int32_t code = -1; STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB, pReq, "alter-db"); if (pTrans == NULL) { @@ -1277,7 +1286,7 @@ static int32_t mndAlterDb(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pOld, SDbObj *p TAOS_CHECK_GOTO(mndSetAlterDbPrepareLogs(pMnode, pTrans, pOld, pNew), NULL, _OVER); TAOS_CHECK_GOTO(mndSetAlterDbCommitLogs(pMnode, pTrans, pOld, pNew), NULL, _OVER); - TAOS_CHECK_GOTO(mndSetAlterDbRedoActions(pMnode, pTrans, pOld, pNew), NULL, _OVER); + TAOS_CHECK_GOTO(mndSetAlterDbRedoActions(pMnode, pTrans, pOld, pNew, dnodeList), NULL, _OVER); TAOS_CHECK_GOTO(mndTransPrepare(pMnode, pTrans), NULL, _OVER); code = 0; @@ -1292,6 +1301,13 @@ static int32_t mndProcessAlterDbReq(SRpcMsg *pReq) { SDbObj *pDb = NULL; SAlterDbReq alterReq = {0}; SDbObj dbObj = {0}; + SArray *dnodeList = NULL; + + dnodeList = taosArrayInit(mndGetDnodeSize(pMnode), sizeof(int32_t)); + if (dnodeList == NULL) { + code = TSDB_CODE_OUT_OF_MEMORY; + goto _OVER; + } TAOS_CHECK_GOTO(tDeserializeSAlterDbReq(pReq->pCont, pReq->contLen, &alterReq), NULL, _OVER); @@ -1334,9 +1350,11 @@ static int32_t mndProcessAlterDbReq(SRpcMsg *pReq) { TAOS_CHECK_GOTO(mndCheckInChangeDbCfg(pMnode, &pDb->cfg, &dbObj.cfg), NULL, _OVER); + TAOS_CHECK_GOTO(mndCheckDbDnodeList(pMnode, alterReq.db, alterReq.dnodeListStr, dnodeList), NULL, _OVER); + dbObj.cfgVersion++; dbObj.updateTime = taosGetTimestampMs(); - code = mndAlterDb(pMnode, pReq, pDb, &dbObj); + code = mndAlterDb(pMnode, pReq, pDb, &dbObj, dnodeList); if (dbObj.cfg.replications != pDb->cfg.replications) { // return quickly, operation executed asynchronously @@ -1360,6 +1378,7 @@ static int32_t mndProcessAlterDbReq(SRpcMsg *pReq) { mndReleaseDb(pMnode, pDb); taosArrayDestroy(dbObj.cfg.pRetensions); tFreeSAlterDbReq(&alterReq); + taosArrayDestroy(dnodeList); TAOS_RETURN(code); } diff --git a/source/dnode/mnode/impl/src/mndVgroup.c b/source/dnode/mnode/impl/src/mndVgroup.c index 2076b49cff5f..d8208a2d736b 100644 --- a/source/dnode/mnode/impl/src/mndVgroup.c +++ b/source/dnode/mnode/impl/src/mndVgroup.c @@ -717,11 +717,25 @@ static bool mndBuildDnodesArrayFp(SMnode *pMnode, void *pObj, void *p1, void *p2 SDnodeObj *pDnode = pObj; SArray *pArray = p1; int32_t exceptDnodeId = *(int32_t *)p2; + SArray *dnodeList = p3; if (exceptDnodeId == pDnode->id) { return true; } + if (dnodeList != NULL) { + bool inDnodeList = false; + for (int32_t index = 0; index < taosArrayGetSize(dnodeList); ++index) { + int32_t dnodeId = *(int32_t *)taosArrayGet(dnodeList, index); + if (pDnode->id) { + inDnodeList = true; + } + } + if (!inDnodeList) { + return true; + } + } + int64_t curMs = taosGetTimestampMs(); bool online = mndIsDnodeOnline(pDnode, curMs); bool isMnode = mndIsMnode(pMnode, pDnode->id); @@ -741,7 +755,7 @@ static bool mndBuildDnodesArrayFp(SMnode *pMnode, void *pObj, void *p1, void *p2 return true; } -SArray *mndBuildDnodesArray(SMnode *pMnode, int32_t exceptDnodeId) { +SArray *mndBuildDnodesArray(SMnode *pMnode, int32_t exceptDnodeId, SArray *dnodeList) { SSdb *pSdb = pMnode->pSdb; int32_t numOfDnodes = mndGetDnodeSize(pMnode); @@ -752,7 +766,7 @@ SArray *mndBuildDnodesArray(SMnode *pMnode, int32_t exceptDnodeId) { } sdbTraverse(pSdb, SDB_DNODE, mndResetDnodesArrayFp, NULL, NULL, NULL); - sdbTraverse(pSdb, SDB_DNODE, mndBuildDnodesArrayFp, pArray, &exceptDnodeId, NULL); + sdbTraverse(pSdb, SDB_DNODE, mndBuildDnodesArrayFp, pArray, &exceptDnodeId, dnodeList); mDebug("build %d dnodes array", (int32_t)taosArrayGetSize(pArray)); for (int32_t i = 0; i < (int32_t)taosArrayGetSize(pArray); ++i) { @@ -845,7 +859,7 @@ static int32_t mndGetAvailableDnode(SMnode *pMnode, SDbObj *pDb, SVgObj *pVgroup int32_t mndAllocSmaVgroup(SMnode *pMnode, SDbObj *pDb, SVgObj *pVgroup) { int32_t code = 0; - SArray *pArray = mndBuildDnodesArray(pMnode, 0); + SArray *pArray = mndBuildDnodesArray(pMnode, 0, NULL); if (pArray == NULL) { code = TSDB_CODE_MND_RETURN_VALUE_NULL; if (terrno != 0) code = terrno; @@ -879,7 +893,7 @@ int32_t mndAllocVgroup(SMnode *pMnode, SDbObj *pDb, SVgObj **ppVgroups, SArray * goto _OVER; } - pArray = mndBuildDnodesArray(pMnode, 0); + pArray = mndBuildDnodesArray(pMnode, 0, dnodeList); if (pArray == NULL) { code = TSDB_CODE_MND_RETURN_VALUE_NULL; if (terrno != 0) code = terrno; @@ -2062,7 +2076,7 @@ int32_t mndSetMoveVgroupInfoToTrans(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, int32_t mndSetMoveVgroupsInfoToTrans(SMnode *pMnode, STrans *pTrans, int32_t delDnodeId, bool force, bool unsafe) { int32_t code = 0; - SArray *pArray = mndBuildDnodesArray(pMnode, delDnodeId); + SArray *pArray = mndBuildDnodesArray(pMnode, delDnodeId, NULL); if (pArray == NULL) { code = TSDB_CODE_MND_RETURN_VALUE_NULL; if (terrno != 0) code = terrno; @@ -3140,7 +3154,7 @@ int32_t mndSplitVgroup(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SVgObj *pVgro int32_t code = -1; STrans *pTrans = NULL; SDbObj dbObj = {0}; - SArray *pArray = mndBuildDnodesArray(pMnode, 0); + SArray *pArray = mndBuildDnodesArray(pMnode, 0, NULL); int32_t numOfStreams = 0; if ((code = mndGetNumOfStreams(pMnode, pDb->name, &numOfStreams)) != 0) { @@ -3506,7 +3520,7 @@ static int32_t mndProcessBalanceVgroupMsg(SRpcMsg *pReq) { sdbRelease(pMnode->pSdb, pDnode); } - pArray = mndBuildDnodesArray(pMnode, 0); + pArray = mndBuildDnodesArray(pMnode, 0, NULL); if (pArray == NULL) { code = TSDB_CODE_MND_RETURN_VALUE_NULL; if (terrno != 0) code = terrno; diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index 635e9f570f71..a9b965b4fa51 100644 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -322,6 +322,7 @@ alter_db_option(A) ::= S3_KEEPLOCAL NK_VARIABLE(B). alter_db_option(A) ::= S3_COMPACT NK_INTEGER(B). { A.type = DB_OPTION_S3_COMPACT, A.val = B; } alter_db_option(A) ::= KEEP_TIME_OFFSET NK_INTEGER(B). { A.type = DB_OPTION_KEEP_TIME_OFFSET; A.val = B; } alter_db_option(A) ::= ENCRYPT_ALGORITHM NK_STRING(B). { A.type = DB_OPTION_ENCRYPT_ALGORITHM; A.val = B; } +alter_db_option(A) ::= DNODES NK_STRING(B). { A.type = DB_OPTION_DNODES; A.val = B; } %type integer_list { SNodeList* } %destructor integer_list { nodesDestroyList($$); } diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index dd3cadc104d0..d6a62b238320 100755 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -8240,6 +8240,8 @@ static int32_t buildAlterDbReq(STranslateContext* pCxt, SAlterDatabaseStmt* pStm pReq->s3KeepLocal = pStmt->pOptions->s3KeepLocal; pReq->s3Compact = pStmt->pOptions->s3Compact; pReq->withArbitrator = pStmt->pOptions->withArbitrator; + tstrncpy(pReq->dnodeListStr, pStmt->pOptions->dnodeListStr, TSDB_DNODE_LIST_LEN); + return code; } From e364d5aa66479400f3e2fe2ccae136a1467042c1 Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Tue, 29 Oct 2024 14:41:14 +0800 Subject: [PATCH 394/695] tsdb/cache: invalidate cached schema --- source/dnode/vnode/src/inc/vnodeInt.h | 1 + source/dnode/vnode/src/meta/metaTable.c | 6 ++++++ source/dnode/vnode/src/tsdb/tsdbCache.c | 14 ++++++++++++-- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/source/dnode/vnode/src/inc/vnodeInt.h b/source/dnode/vnode/src/inc/vnodeInt.h index fc98d6578bec..7673e562a8a5 100644 --- a/source/dnode/vnode/src/inc/vnodeInt.h +++ b/source/dnode/vnode/src/inc/vnodeInt.h @@ -222,6 +222,7 @@ int32_t tsdbCacheNewSTableColumn(STsdb* pTsdb, SArray* uids, int16_t cid, int8_t int32_t tsdbCacheDropSTableColumn(STsdb* pTsdb, SArray* uids, int16_t cid, bool hasPrimayKey); int32_t tsdbCacheNewNTableColumn(STsdb* pTsdb, int64_t uid, int16_t cid, int8_t col_type); int32_t tsdbCacheDropNTableColumn(STsdb* pTsdb, int64_t uid, int16_t cid, bool hasPrimayKey); +void tsdbCacheInvalidateSchema(STsdb* pTsdb, tb_uid_t suid, tb_uid_t uid); int tsdbScanAndConvertSubmitMsg(STsdb* pTsdb, SSubmitReq2* pMsg); int tsdbInsertData(STsdb* pTsdb, int64_t version, SSubmitReq2* pMsg, SSubmitRsp2* pRsp); int32_t tsdbInsertTableData(STsdb* pTsdb, int64_t version, SSubmitTbData* pSubmitTbData, int32_t* affectedRows); diff --git a/source/dnode/vnode/src/meta/metaTable.c b/source/dnode/vnode/src/meta/metaTable.c index 21d12ef77def..f525a28bd6f7 100644 --- a/source/dnode/vnode/src/meta/metaTable.c +++ b/source/dnode/vnode/src/meta/metaTable.c @@ -620,6 +620,8 @@ int metaAlterSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) { } } if (uids) taosArrayDestroy(uids); + + tsdbCacheInvalidateSchema(pTsdb, pReq->suid, -1); } metaWLock(pMeta); @@ -1945,6 +1947,10 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl break; } + if (!TSDB_CACHE_NO(pMeta->pVnode->config)) { + tsdbCacheInvalidateSchema(pMeta->pVnode->pTsdb, 0, entry.uid); + } + entry.version = version; // do actual write diff --git a/source/dnode/vnode/src/tsdb/tsdbCache.c b/source/dnode/vnode/src/tsdb/tsdbCache.c index fa375a9fa0a3..abc1e214a432 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCache.c +++ b/source/dnode/vnode/src/tsdb/tsdbCache.c @@ -493,7 +493,7 @@ int tsdbCacheFlushDirty(const void *key, size_t klen, void *value, void *ud) { int32_t tsdbCacheCommit(STsdb *pTsdb) { int32_t code = 0; char *err = NULL; - + /* SLRUCache *pCache = pTsdb->lruCache; rocksdb_writebatch_t *wb = pTsdb->rCache.writebatch; @@ -511,7 +511,7 @@ int32_t tsdbCacheCommit(STsdb *pTsdb) { rocksdb_free(err); code = TSDB_CODE_FAILED; } - + */ TAOS_RETURN(code); } @@ -1304,6 +1304,16 @@ static int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, SArray TAOS_RETURN(code); } +void tsdbCacheInvalidateSchema(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid) { + if (suid) { + if (pTsdb->rCache.suid == suid) { + pTsdb->rCache.suid = -1; + } + } else if (pTsdb->rCache.uid == uid) { + pTsdb->rCache.uid = -1; + } +} + static int32_t tsdbUpdateSkm(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid) { if (suid) { if (pTsdb->rCache.suid == suid) { From 6b67c2ebf0be26e47810ce2719f3320b6a61f937 Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Tue, 29 Oct 2024 15:07:13 +0800 Subject: [PATCH 395/695] uncomment tsdb cache commit --- source/dnode/vnode/src/tsdb/tsdbCache.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbCache.c b/source/dnode/vnode/src/tsdb/tsdbCache.c index abc1e214a432..801e89c2b616 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCache.c +++ b/source/dnode/vnode/src/tsdb/tsdbCache.c @@ -493,7 +493,7 @@ int tsdbCacheFlushDirty(const void *key, size_t klen, void *value, void *ud) { int32_t tsdbCacheCommit(STsdb *pTsdb) { int32_t code = 0; char *err = NULL; - /* + SLRUCache *pCache = pTsdb->lruCache; rocksdb_writebatch_t *wb = pTsdb->rCache.writebatch; @@ -511,7 +511,7 @@ int32_t tsdbCacheCommit(STsdb *pTsdb) { rocksdb_free(err); code = TSDB_CODE_FAILED; } - */ + TAOS_RETURN(code); } From 923f26b1eb817bd1104f3f664e6a261b0843c16c Mon Sep 17 00:00:00 2001 From: Yubesitie <151515717+Yubesitie@users.noreply.github.com> Date: Tue, 29 Oct 2024 15:13:12 +0800 Subject: [PATCH 396/695] Update 07-explorer.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 拼写错误 --- docs/zh/14-reference/01-components/07-explorer.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/zh/14-reference/01-components/07-explorer.md b/docs/zh/14-reference/01-components/07-explorer.md index 499fb3697c88..eab4aef15b37 100644 --- a/docs/zh/14-reference/01-components/07-explorer.md +++ b/docs/zh/14-reference/01-components/07-explorer.md @@ -8,7 +8,7 @@ taosExplorer 是一个为用户提供 TDengine 实例的可视化管理交互工 ## 安装 -taosEexplorer 无需单独安装,从 TDengine 3.3.0.0 版本开始,它随着 TDengine 安装包一起发布,安装完成后,就可以看到 `taos-explorer` 服务。如果按照 GitHub 里步骤自己编译 TDengine 源代码生成的安装包不包含 taosExplorer。 +taosExplorer 无需单独安装,从 TDengine 3.3.0.0 版本开始,它随着 TDengine 安装包一起发布,安装完成后,就可以看到 `taos-explorer` 服务。如果按照 GitHub 里步骤自己编译 TDengine 源代码生成的安装包不包含 taosExplorer。 ## 配置 From 36e115d2cd0799c5e577981bfde1e313e9420361 Mon Sep 17 00:00:00 2001 From: xsren <285808407@qq.com> Date: Tue, 29 Oct 2024 15:49:16 +0800 Subject: [PATCH 397/695] fix: colDataSetVal repeatedly sets the same row --- source/common/src/systable.c | 6 +++--- source/common/src/tdatablock.c | 12 ++++++++++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/source/common/src/systable.c b/source/common/src/systable.c index 211aa2064504..cb11e4a24ee6 100644 --- a/source/common/src/systable.c +++ b/source/common/src/systable.c @@ -190,9 +190,9 @@ static const SSysDbTableSchema streamTaskSchema[] = { {.name = "stage", .bytes = 8, .type = TSDB_DATA_TYPE_BIGINT, .sysInfo = false}, {.name = "in_queue", .bytes = 20, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false}, {.name = "process_total", .bytes = 14, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false}, - {.name = "process_throughput", .bytes = 14, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false}, - {.name = "out_total", .bytes = 14, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false}, - {.name = "out_throughput", .bytes = 14, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false}, + {.name = "process_throughput", .bytes = 15, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false}, + {.name = "out_total", .bytes = 15, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false}, + {.name = "out_throughput", .bytes = 15, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false}, // {.name = "dispatch_throughput", .bytes = 12, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false}, // {.name = "dispatch_total", .bytes = 12, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false}, // {.name = "out_queue", .bytes = 20, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false}, diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c index 4724a3d241e6..3187d2315a96 100644 --- a/source/common/src/tdatablock.c +++ b/source/common/src/tdatablock.c @@ -109,6 +109,14 @@ int32_t colDataSetVal(SColumnInfoData* pColumnInfoData, uint32_t rowIndex, const dataLen = varDataTLen(pData); } + if(rowIndex == 0 && pColumnInfoData->varmeta.length > 0) { + return 0; + } + if (pColumnInfoData->varmeta.offset[rowIndex] > 0 && + pColumnInfoData->varmeta.offset[rowIndex] < pColumnInfoData->varmeta.length) { + return 0; + } + SVarColAttr* pAttr = &pColumnInfoData->varmeta; if (pAttr->allocLen < pAttr->length + dataLen) { uint32_t newSize = pAttr->allocLen; @@ -3552,7 +3560,7 @@ int32_t blockDataCheck(const SSDataBlock* pDataBlock) { BLOCK_DATA_CHECK_TRESSA(pCol->nullbitmap); } - nextPos = 0; + nextPos = -1; for (int64_t r = 0; r < checkRows; ++r) { if (tsSafetyCheckLevel <= TSDB_SAFETY_CHECK_LEVELL_NORMAL) break; if (!colDataIsNull_s(pCol, r)) { @@ -3564,7 +3572,7 @@ int32_t blockDataCheck(const SSDataBlock* pDataBlock) { BLOCK_DATA_CHECK_TRESSA(pCol->varmeta.offset[r] <= pCol->varmeta.length); if (pCol->reassigned) { BLOCK_DATA_CHECK_TRESSA(pCol->varmeta.offset[r] >= 0); - } else if (0 == r) { + } else if (0 == r || nextPos == -1) { nextPos = pCol->varmeta.offset[r]; } else { BLOCK_DATA_CHECK_TRESSA(pCol->varmeta.offset[r] == nextPos); From 3ebdaf1d82f8ed8c4e3f74903fd4fcb8a5ca0aff Mon Sep 17 00:00:00 2001 From: chenhaoran Date: Tue, 29 Oct 2024 16:21:44 +0800 Subject: [PATCH 398/695] test: use pylint to formate code --- tests/army/tmq/drop_lost_comsumers.py | 162 ++++++++++++-------------- 1 file changed, 76 insertions(+), 86 deletions(-) diff --git a/tests/army/tmq/drop_lost_comsumers.py b/tests/army/tmq/drop_lost_comsumers.py index f4559310898a..cef67ddfccc7 100644 --- a/tests/army/tmq/drop_lost_comsumers.py +++ b/tests/army/tmq/drop_lost_comsumers.py @@ -1,26 +1,20 @@ -import taos -import sys import time -import socket import os import threading -import multiprocessing -from multiprocessing import Process, Queue +import datetime +from taos.tmq import Consumer +from taos.error import TmqError -from frame.log import * -from frame.cases import * -from frame.sql import * +from frame.log import tdLog +from frame.cases import tdCases +from frame.sql import tdSql from frame.caseBase import * -from frame import * -from taos.tmq import * from frame import etool -from datetime import datetime -from taos.tmq import Consumer -from frame.common import * +from frame.common import tdCom class TaosConsumer: - # TODo: add to tq.py and remove from here + # TODO: Move this class to tq.py and remove it from here def __init__(self): self.sub_once = True self.once_consumer_rows = 0 @@ -40,24 +34,26 @@ def sub_consumer(self, consumer, group_id, topic_name): tdLog.exit(f"subscribe error") nrows = 0 while True: - start = datetime.now() + start = datetime.datetime.now() tdLog.info(f"time:{start},consumer:{group_id}, start to consume") message = consumer.poll(timeout=10.0) if message: - id = message.offset() - topic = message.topic() - database = message.database() + message_offset = message.offset() + # topic = message.topic() + # database = message.database() for block in message: addrows = block.nrows() nrows += block.nrows() ncols = block.ncols() - values = block.fetchall - end = datetime.now() + # values = block.fetchall + end = datetime.datetime.now() elapsed_time = end - start tdLog.info( - f"time:{end},consumer:{group_id}, elapsed time:{elapsed_time},consumer_nrows:{nrows},consumer_addrows:{addrows}, consumer_ncols:{ncols},offset:{id}" + f"time:{end},consumer:{group_id}, elapsed time:{elapsed_time}," + f"consumer_nrows:{nrows},consumer_addrows:{addrows}," + f"consumer_ncols:{ncols},offset:{id}" ) consumer.commit() tdLog.info(f"consumer:{group_id},consumer_nrows:{nrows}") @@ -101,10 +97,11 @@ def sub_consumer_once(self, consumer, group_id, topic_name, stop_event): consumer_nrows = 0 while not stop_event.is_set(): - start = datetime.now() + start = datetime.datetime.now() self.log_info( f"time:{start},consumer:{group_id}, start to consume,consumer_nrows:{consumer_nrows}" ) + message = None if consumer_nrows < self.once_consumer_rows: message = consumer.poll(timeout=1.0) elif consumer_nrows >= self.once_consumer_rows: @@ -113,36 +110,32 @@ def sub_consumer_once(self, consumer, group_id, topic_name, stop_event): # tdLog.info("stop consumer when consumer all rows") if message: - id = message.offset() - topic = message.topic() - database = message.database() + message_offset = message.offset() + # topic = message.topic() + # database = message.database() for block in message: addrows = block.nrows() nrows += block.nrows() self.safe_counter.rows(block.nrows()) ncols = block.ncols() - values = block.fetchall - end = datetime.now() + # values = block.fetchall + end = datetime.datetime.now() elapsed_time = end - start self.log_info( - f"time:{end},consumer:{group_id}, elapsed time:{elapsed_time},consumer_nrows:{nrows},consumer_addrows:{addrows}, consumer_ncols:{ncols},offset:{id}" + f"time:{end},consumer:{group_id}, elapsed time:{elapsed_time},consumer_nrows:{nrows},consumer_addrows:{addrows}, consumer_ncols:{ncols},offset:{message_offset}" ) self.log_info( f"consumer:{group_id},consumer_nrows:{nrows},counter.counter:{self.safe_counter.counter}" ) # consumer.commit() consumer_nrows = nrows - # consumer.unsubscribe() - # consumer.close() - # break + tdLog.info("Consumer subscription thread is stopping.") - def taosc_consumer(self, conf: list, topic_name: str, stop_event): + def taosc_consumer(self, conf: list, topic_name: str, stop_event: threading.Event): try: tdLog.info(conf) - from taos.tmq import Consumer - tdLog.info("start to config consumer") consumer = Consumer(conf) tdLog.info("start to subscribe") @@ -175,12 +168,7 @@ def get(self): class TDTestCase: # updatecfgDict = {'debugFlag': 135, 'asynclog': 0} - - def init(self, conn, logSql, replicaVar=1): - self.replicaVar = int(replicaVar) - tdLog.debug(f"start to excute {__file__}") - tdSql.init(conn.cursor()) - self.consumer_instance = TaosConsumer() + def __init__(self): # db parameter self.table_number = 1000 self.rows_per_table = 1000 @@ -193,7 +181,12 @@ def init(self, conn, logSql, replicaVar=1): self.consumer_all_rows = ( self.consumer_rows_per_thread * self.consumer_groups_num ) - + self.topic_name = "select_d1" + def init(self, conn, logSql, replicaVar=1): + self.replicaVar = int(replicaVar) + tdLog.debug(f"start to excute {__file__}") + tdSql.init(conn.cursor(), logSql) + self.consumer_instance = TaosConsumer() # tdSql.init(conn.cursor(), logSql) # output sql.txt file def caseDescription(self): @@ -211,16 +204,15 @@ def check_consumer(self, count, rows, stop_event=None): tdLog.info( f"wait timeout count:{count} and check consumer status whether is closed" ) - for ct in range(5): - tdSql.query(f"show consumers") + for _ in range(5): + tdSql.query("show consumers") anser_rows = tdSql.getRows() if anser_rows == rows: break - else: - time.sleep(1) - tdLog.info( - f"wait for {count} seconds to check that consumers number is {anser_rows}" - ) + time.sleep(1) + tdLog.info( + f"wait for {count} seconds to check that consumers number is {anser_rows}" + ) if anser_rows != rows: if stop_event: stop_event.set() @@ -228,37 +220,30 @@ def check_consumer(self, count, rows, stop_event=None): except Exception as e: tdLog.exit(f"{e},check consumer error") - def drop_session_timeout_consmuers( - self, - consumer_groups_num, - session_timeout_ms, - max_poll_interval_ms, - topic_name, - timeout, - ): - tdSql.execute(f"drop topic if exists {topic_name};") - tdSql.execute(f"use db_sub") - tdSql.execute(f"create topic {topic_name} as select * from db_sub.meters;") + def drop_session_timeout_consmuers(self): + tdSql.execute(f"drop topic if exists {self.topic_name};") + tdSql.execute("use db_sub") + tdSql.execute(f"create topic {self.topic_name} as select * from db_sub.meters;") # start consumer and config some parameters os.system( - f"nohup python3 ./tmq/per_consumer.py -c {consumer_groups_num} -s {session_timeout_ms} -p {max_poll_interval_ms} > consumer.log &" + f"nohup python3 ./tmq/per_consumer.py -c {self.consumer_groups_num} -s {self.session_timeout_ms} -p {self.max_poll_interval_ms} > consumer.log &" ) # wait 4s for consuming data time.sleep(4) # kill consumer to simulate session_timeout_ms tdLog.info("kill per_consumer.py") tdCom.kill_signal_process( - signal=9, processor_name="python3\s*./tmq/per_consumer.py" + signal=9, processor_name=r"python3\s*./tmq/per_consumer.py" ) - self.check_consumer(timeout, 0) - tdSql.execute(f"drop topic if exists {topic_name};") + self.check_consumer(int(self.session_timeout_ms / 1000), 0) + tdSql.execute(f"drop topic if exists {self.topic_name};") os.system("rm -rf consumer.log") - def drop_max_poll_timeout_consmuers(self, topic_name, timeout): - tdSql.execute(f"drop topic if exists {topic_name};") - tdSql.execute(f"use db_sub") - tdSql.execute(f"create topic {topic_name} as select * from db_sub.meters;") + def drop_max_poll_timeout_consmuers(self): + tdSql.execute(f"drop topic if exists {self.topic_name};") + tdSql.execute("use db_sub") + tdSql.execute(f"create topic {self.topic_name} as select * from db_sub.meters;") threads = [] self.safe_counter = ThreadSafeCounter() @@ -267,16 +252,16 @@ def drop_max_poll_timeout_consmuers(self, topic_name, timeout): self.consumer_instance.once_consumer_rows = self.consumer_rows_per_thread tdLog.info(f"consumer_rows:{self.consumer_instance.once_consumer_rows}") self.consumer_instance.sub_once = True - for id in range(self.consumer_groups_num): + for group_id in range(self.consumer_groups_num): conf = self.consumer_instance.set_conf( - group_id=id, + group_id=group_id, session_timeout_ms=self.session_timeout_ms, max_poll_interval_ms=self.max_poll_interval_ms, ) threads.append( threading.Thread( target=self.consumer_instance.taosc_consumer, - args=(conf, topic_name, stop_event), + args=(conf, self.topic_name, stop_event), ) ) for tr in threads: @@ -290,50 +275,55 @@ def drop_max_poll_timeout_consmuers(self, topic_name, timeout): ) elif self.safe_counter.get() >= self.consumer_all_rows: # adding 5s is for heartbeat check - self.check_consumer(timeout + 5, 0, stop_event) + self.check_consumer(int(self.max_poll_interval_ms / 1000 ) + 5, 0, stop_event) stop_event.set() - tr.join() break + for tr in threads: + tr.join() time.sleep(1) - tdSql.execute(f"drop topic if exists {topic_name};") + tdSql.execute(f"drop topic if exists {self.topic_name};") def case_session_timeout(self): + """ + TEST CASE: verifying that the boundary and valid values of session_timeout_ms are in effect + """ + tdLog.info("start to test session_timeout_ms=12s") # test session_timeout_ms=12s self.session_timeout_ms = 12000 self.max_poll_interval_ms = 180000 - topic_name = "select_d1" - self.drop_session_timeout_consmuers( - consumer_groups_num=1, - session_timeout_ms=self.session_timeout_ms, - max_poll_interval_ms=self.max_poll_interval_ms, - topic_name=topic_name, - timeout=int(self.session_timeout_ms / 1000), - ) + # self.set_session_timeout = int(self.session_timeout_ms / 1000) + self.drop_session_timeout_consmuers() tdLog.info("stop to test session_timeout_ms=12s and done ") def case_max_poll_timeout(self): + """ + TEST CASE: verifying that the boundary and valid values of max_poll_interval_ms are in effect + """ tdLog.info("start to test max_poll_interval_ms=20s") # test max_poll_interval_ms=20s self.session_timeout_ms = 180000 self.max_poll_interval_ms = 20000 - topic_name = "select_d1" - self.drop_max_poll_timeout_consmuers( - topic_name=topic_name, timeout=int(self.max_poll_interval_ms / 1000) - ) + self.drop_max_poll_timeout_consmuers() tdLog.info("stop to test max_poll_interval_ms=20s and done ") def run(self): + """ + Run the test cases for session timeout and max poll timeout. + """ vgroups = 4 etool.benchMark( command=f"-d db_sub -t {self.table_number} -n {self.rows_per_table} -v {vgroups} -a {self.replicaVar} -y" ) # test case start here - + self.topic_name = "select_d1" self.case_session_timeout() self.case_max_poll_timeout() def stop(self): + """ + Closes the taos connection and logs the success message. + """ tdSql.close() tdLog.success(f"{__file__} successfully executed") From ff2f2f2b5ff8e0a47990369496a6ca8c8af88c2a Mon Sep 17 00:00:00 2001 From: dmchen Date: Tue, 29 Oct 2024 04:11:11 +0000 Subject: [PATCH 399/695] fix/TD-32703-add-log --- source/libs/sync/src/syncAppendEntries.c | 15 ++++++++---- source/libs/sync/src/syncAppendEntriesReply.c | 6 +++-- source/libs/sync/src/syncPipeline.c | 24 ++++++++++++++++--- source/libs/sync/src/syncUtil.c | 4 ++-- 4 files changed, 38 insertions(+), 11 deletions(-) diff --git a/source/libs/sync/src/syncAppendEntries.c b/source/libs/sync/src/syncAppendEntries.c index e3f94c1c9a6f..0345880874cf 100644 --- a/source/libs/sync/src/syncAppendEntries.c +++ b/source/libs/sync/src/syncAppendEntries.c @@ -95,6 +95,8 @@ int32_t syncNodeOnAppendEntries(SSyncNode* ths, const SRpcMsg* pRpcMsg) { bool accepted = false; SSyncRaftEntry* pEntry = NULL; bool resetElect = false; + const STraceId* trace = &pRpcMsg->info.traceId; + char tbuf[40] = {0}; // if already drop replica, do not process if (!syncNodeInRaftGroup(ths, &(pMsg->srcId))) { @@ -150,10 +152,10 @@ int32_t syncNodeOnAppendEntries(SSyncNode* ths, const SRpcMsg* pRpcMsg) { goto _IGNORE; } - sTrace("vgId:%d, recv append entries msg. index:%" PRId64 ", term:%" PRId64 ", preLogIndex:%" PRId64 - ", prevLogTerm:%" PRId64 " commitIndex:%" PRId64 " entryterm:%" PRId64, - pMsg->vgId, pMsg->prevLogIndex + 1, pMsg->term, pMsg->prevLogIndex, pMsg->prevLogTerm, pMsg->commitIndex, - pEntry->term); + sGTrace("vgId:%d, recv append entries msg. index:%" PRId64 ", term:%" PRId64 ", preLogIndex:%" PRId64 + ", prevLogTerm:%" PRId64 " commitIndex:%" PRId64 " entryterm:%" PRId64, + pMsg->vgId, pMsg->prevLogIndex + 1, pMsg->term, pMsg->prevLogIndex, pMsg->prevLogTerm, pMsg->commitIndex, + pEntry->term); if (ths->fsmState == SYNC_FSM_STATE_INCOMPLETE) { pReply->fsmState = ths->fsmState; @@ -179,6 +181,11 @@ int32_t syncNodeOnAppendEntries(SSyncNode* ths, const SRpcMsg* pRpcMsg) { sTrace("vgId:%d, update commit return index %" PRId64 "", ths->vgId, returnIndex); } + TRACE_SET_MSGID(&(rpcRsp.info.traceId), tGenIdPI64()); + trace = &(rpcRsp.info.traceId); + sGTrace("vgId:%d, send append reply matchIndex:%" PRId64 " term:%" PRId64 " lastSendIndex:%" PRId64 + " to dest: 0x%016" PRIx64, + ths->vgId, pReply->matchIndex, pReply->term, pReply->lastSendIndex, pReply->destId.addr); // ack, i.e. send response TAOS_CHECK_RETURN(syncNodeSendMsgById(&pReply->destId, ths, &rpcRsp)); diff --git a/source/libs/sync/src/syncAppendEntriesReply.c b/source/libs/sync/src/syncAppendEntriesReply.c index 005cf4337d49..a7f36be9e928 100644 --- a/source/libs/sync/src/syncAppendEntriesReply.c +++ b/source/libs/sync/src/syncAppendEntriesReply.c @@ -43,6 +43,8 @@ int32_t syncNodeOnAppendEntriesReply(SSyncNode* ths, const SRpcMsg* pRpcMsg) { int32_t code = 0; SyncAppendEntriesReply* pMsg = (SyncAppendEntriesReply*)pRpcMsg->pCont; int32_t ret = 0; + const STraceId* trace = &pRpcMsg->info.traceId; + char tbuf[40] = {0}; // if already drop replica, do not process if (!syncNodeInRaftGroup(ths, &(pMsg->srcId))) { @@ -63,8 +65,8 @@ int32_t syncNodeOnAppendEntriesReply(SSyncNode* ths, const SRpcMsg* pRpcMsg) { return TSDB_CODE_SYN_WRONG_TERM; } - sTrace("vgId:%d, received append entries reply. srcId:0x%016" PRIx64 ", term:%" PRId64 ", matchIndex:%" PRId64 "", - pMsg->vgId, pMsg->srcId.addr, pMsg->term, pMsg->matchIndex); + sGTrace("vgId:%d, received append entries reply. srcId:0x%016" PRIx64 ", term:%" PRId64 ", matchIndex:%" PRId64 "", + pMsg->vgId, pMsg->srcId.addr, pMsg->term, pMsg->matchIndex); if (pMsg->success) { SyncIndex oldMatchIndex = syncIndexMgrGetIndex(ths->pMatchIndex, &(pMsg->srcId)); diff --git a/source/libs/sync/src/syncPipeline.c b/source/libs/sync/src/syncPipeline.c index 9f6acf6d8379..efb71b571484 100644 --- a/source/libs/sync/src/syncPipeline.c +++ b/source/libs/sync/src/syncPipeline.c @@ -1026,6 +1026,14 @@ int32_t syncLogReplRecover(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncAppendEn int32_t code = 0; if (pMgr->restored != false) return TSDB_CODE_SYN_INTERNAL_ERROR; + sTrace("vgId:%d, begin to recover sync log repl. peer: dnode:%d (%" PRIx64 "), repl-mgr:[%" PRId64 ", %" PRId64 + ", %" PRId64 ") restore:%d, buffer: [%" PRId64 ", %" PRId64 ", %" PRId64 ", %" PRId64 + "), msg: {lastSendIndex:%" PRId64 ", matchIndex:%" PRId64 ", fsmState:%d, success:%d, lastMatchTerm:%" PRId64 + "}", + pNode->vgId, DID(&destId), destId.addr, pMgr->startIndex, pMgr->matchIndex, pMgr->endIndex, pMgr->restored, + pBuf->startIndex, pBuf->commitIndex, pBuf->matchIndex, pBuf->endIndex, pMsg->lastSendIndex, pMsg->matchIndex, + pMsg->fsmState, pMsg->success, pMsg->lastMatchTerm); + if (pMgr->endIndex == 0) { if (pMgr->startIndex != 0) return TSDB_CODE_SYN_INTERNAL_ERROR; if (pMgr->matchIndex != 0) return TSDB_CODE_SYN_INTERNAL_ERROR; @@ -1171,6 +1179,11 @@ int32_t syncLogReplProbe(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncIndex inde int64_t nowMs = taosGetMonoTimestampMs(); int32_t code = 0; + sTrace("vgId:%d, begin to probe peer:%" PRIx64 " with msg of index:%" PRId64 ". repl-mgr:[%" PRId64 ", %" PRId64 + ", %" PRId64 "), restored:%d", + pNode->vgId, pNode->replicasId[pMgr->peerId].addr, index, pMgr->startIndex, pMgr->matchIndex, pMgr->endIndex, + pMgr->restored); + if (pMgr->endIndex > pMgr->startIndex && nowMs < pMgr->states[pMgr->startIndex % pMgr->size].timeMs + retryMaxWaitMs) { return 0; @@ -1206,6 +1219,10 @@ int32_t syncLogReplProbe(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncIndex inde int32_t syncLogReplAttempt(SSyncLogReplMgr* pMgr, SSyncNode* pNode) { if (!pMgr->restored) return TSDB_CODE_SYN_INTERNAL_ERROR; + sTrace("vgId:%d, begin to attempt replicate log entries from end to match. repl-mgr:[%" PRId64 ", %" PRId64 + ", %" PRId64 "), restore:%d", + pNode->vgId, pMgr->startIndex, pMgr->matchIndex, pMgr->endIndex, pMgr->restored); + SRaftId* pDestId = &pNode->replicasId[pMgr->peerId]; int32_t batchSize = TMAX(1, pMgr->size >> (4 + pMgr->retryBackoff)); int32_t code = 0; @@ -1527,11 +1544,12 @@ int32_t syncLogReplSendTo(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncIndex ind goto _err; } + TRACE_SET_MSGID(&(msgOut.info.traceId), tGenIdPI64()); + STraceId* trace = &(msgOut.info.traceId); + sGTrace("vgId:%d, replicate one msg index:%" PRId64 " term:%" PRId64 " prevterm:%" PRId64 " to dest: 0x%016" PRIx64, + pNode->vgId, pEntry->index, pEntry->term, prevLogTerm, pDestId->addr); TAOS_CHECK_GOTO(syncNodeSendAppendEntries(pNode, pDestId, &msgOut), &lino, _err); - sTrace("vgId:%d, replicate one msg index:%" PRId64 " term:%" PRId64 " prevterm:%" PRId64 " to dest: 0x%016" PRIx64, - pNode->vgId, pEntry->index, pEntry->term, prevLogTerm, pDestId->addr); - if (!inBuf) { syncEntryDestroy(pEntry); pEntry = NULL; diff --git a/source/libs/sync/src/syncUtil.c b/source/libs/sync/src/syncUtil.c index 212a75c2ae45..efb258d952dd 100644 --- a/source/libs/sync/src/syncUtil.c +++ b/source/libs/sync/src/syncUtil.c @@ -152,8 +152,8 @@ static void syncLogReplStates2Str(SSyncNode* pSyncNode, char* buf, int32_t bufLe for (int32_t i = 0; i < pSyncNode->replicaNum; i++) { SSyncLogReplMgr* pMgr = pSyncNode->logReplMgrs[i]; if (pMgr == NULL) break; - len += tsnprintf(buf + len, bufLen - len, "%d:%d [%" PRId64 " %" PRId64 ", %" PRId64 "]", i, pMgr->restored, - pMgr->startIndex, pMgr->matchIndex, pMgr->endIndex); + len += tsnprintf(buf + len, bufLen - len, "%d:%d [%" PRId64 ", %" PRId64 ", %" PRId64 "]", i, pMgr->restored, + pMgr->startIndex, pMgr->matchIndex, pMgr->endIndex); if (i + 1 < pSyncNode->replicaNum) { len += tsnprintf(buf + len, bufLen - len, "%s", ", "); } From 23249271fb56abdbe892b11da2ade6549ff51db3 Mon Sep 17 00:00:00 2001 From: dmchen Date: Tue, 29 Oct 2024 06:38:36 +0000 Subject: [PATCH 400/695] fix/TD-32703-add-log --- source/libs/transport/src/transCli.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index c3e214b5e3be..5ade768d0c29 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -3090,7 +3090,7 @@ int32_t transReleaseCliHandle(void* handle) { static int32_t transInitMsg(void* pInstRef, const SEpSet* pEpSet, STransMsg* pReq, STransCtx* ctx, SCliReq** pCliMsg) { int32_t code = 0; - TRACE_SET_MSGID(&pReq->info.traceId, tGenIdPI64()); + if (pReq->info.traceId.msgId == 0) TRACE_SET_MSGID(&pReq->info.traceId, tGenIdPI64()); SCliReq* pCliReq = NULL; SReqCtx* pCtx = taosMemoryCalloc(1, sizeof(SReqCtx)); From e9feec94b3e5067a9421d2a0014e5818119bdb4b Mon Sep 17 00:00:00 2001 From: Pengrongkun Date: Sun, 27 Oct 2024 11:04:39 +0800 Subject: [PATCH 401/695] TD-32120:add api taos_stmt2_get_all_fields --- include/client/taos.h | 16 ++++--- source/client/src/clientMain.c | 10 ++++ source/client/src/clientStmt2.c | 45 ++++++++++++++++++ source/libs/parser/src/parInsertSql.c | 27 +++++++++-- source/libs/parser/src/parInsertStmt.c | 7 +-- tests/script/api/makefile | 2 + tests/script/api/stmt2-get-fields.c | 64 ++++++++++++++++++++++++++ 7 files changed, 156 insertions(+), 15 deletions(-) create mode 100644 tests/script/api/stmt2-get-fields.c diff --git a/include/client/taos.h b/include/client/taos.h index 80dbe27c4719..00fec66a7143 100644 --- a/include/client/taos.h +++ b/include/client/taos.h @@ -81,6 +81,13 @@ typedef enum { TSDB_SML_TIMESTAMP_NANO_SECONDS, } TSDB_SML_TIMESTAMP_TYPE; +typedef enum TAOS_FIELD_T { + TAOS_FIELD_COL = 1, + TAOS_FIELD_TAG, + TAOS_FIELD_QUERY, + TAOS_FIELD_TBNAME, +} TAOS_FIELD_T; + typedef struct taosField { char name[65]; int8_t type; @@ -93,6 +100,7 @@ typedef struct TAOS_FIELD_E { uint8_t precision; uint8_t scale; int32_t bytes; + TAOS_FIELD_T field_type; } TAOS_FIELD_E; #ifdef WINDOWS @@ -195,13 +203,6 @@ DLL_EXPORT int taos_stmt_affected_rows_once(TAOS_STMT *stmt); typedef void TAOS_STMT2; -typedef enum TAOS_FIELD_T { - TAOS_FIELD_COL = 1, - TAOS_FIELD_TAG, - TAOS_FIELD_QUERY, - TAOS_FIELD_TBNAME, -} TAOS_FIELD_T; - typedef struct TAOS_STMT2_OPTION { int64_t reqid; bool singleStbInsert; @@ -232,6 +233,7 @@ DLL_EXPORT int taos_stmt2_exec(TAOS_STMT2 *stmt, int *affected_rows); DLL_EXPORT int taos_stmt2_close(TAOS_STMT2 *stmt); DLL_EXPORT int taos_stmt2_is_insert(TAOS_STMT2 *stmt, int *insert); DLL_EXPORT int taos_stmt2_get_fields(TAOS_STMT2 *stmt, TAOS_FIELD_T field_type, int *count, TAOS_FIELD_E **fields); +DLL_EXPORT int taos_stmt2_get_all_fields(TAOS_STMT2 *stmt, int *count, TAOS_FIELD_E **fields); DLL_EXPORT void taos_stmt2_free_fields(TAOS_STMT2 *stmt, TAOS_FIELD_E *fields); DLL_EXPORT TAOS_RES *taos_stmt2_result(TAOS_STMT2 *stmt); DLL_EXPORT char *taos_stmt2_error(TAOS_STMT2 *stmt); diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c index 64631fd75453..43f8c9e1f987 100644 --- a/source/client/src/clientMain.c +++ b/source/client/src/clientMain.c @@ -2103,6 +2103,16 @@ int taos_stmt2_get_fields(TAOS_STMT2 *stmt, TAOS_FIELD_T field_type, int *count, } } +int taos_stmt2_get_all_fields(TAOS_STMT2 *stmt, int *count, TAOS_FIELD_E **fields) { + if (stmt == NULL || NULL == count) { + tscError("NULL parameter for %s", __FUNCTION__); + terrno = TSDB_CODE_INVALID_PARA; + return terrno; + } + + return stmtGetColFields2(stmt, count, fields); +} + void taos_stmt2_free_fields(TAOS_STMT2 *stmt, TAOS_FIELD_E *fields) { (void)stmt; if (!fields) return; diff --git a/source/client/src/clientStmt2.c b/source/client/src/clientStmt2.c index 2f046b61d622..2d76d91e38e9 100644 --- a/source/client/src/clientStmt2.c +++ b/source/client/src/clientStmt2.c @@ -1068,6 +1068,48 @@ static int stmtFetchColFields2(STscStmt2* pStmt, int32_t* fieldNum, TAOS_FIELD_E return TSDB_CODE_SUCCESS; } + +static int stmtFetchFields2(STscStmt2* pStmt, int32_t* fieldNum, TAOS_FIELD_E** fields) { + SBoundColInfo* tags = (SBoundColInfo*)pStmt->bInfo.boundTags; + STableMeta* meta = ((SVnodeModifyOpStmt*)(pStmt->sql.pQuery->pRoot))->pTableMeta; + if (tags == NULL || meta == NULL || (meta->schema == NULL && tags->numOfBound != 0)) { + return TSDB_CODE_INVALID_PARA; + } + + if (fields) { + *fields = taosMemoryCalloc(tags->numOfBound, sizeof(TAOS_FIELD_E)); + if (NULL == *fields) { + return terrno; + } + + SSchema* pSchema = meta->schema; + int32_t tbnameIdx = meta->tableInfo.numOfTags + meta->tableInfo.numOfColumns; + for (int32_t i = 0; i < tags->numOfBound; ++i) { + int16_t idx = tags->pColIndex[i]; + if (idx == tbnameIdx) { + (*fields)[i].field_type = TAOS_FIELD_TBNAME; + strcpy((*fields)[i].name, "tbname"); + continue; + } else if (idx < meta->tableInfo.numOfColumns) { + (*fields)[i].field_type = TAOS_FIELD_COL; + } else { + (*fields)[i].field_type = TAOS_FIELD_TAG; + } + SSchema schema = pSchema[tags->pColIndex[i]]; + if (TSDB_DATA_TYPE_TIMESTAMP == schema.type) { + (*fields)[i].precision = meta->tableInfo.precision; + } + + tstrncpy((*fields)[i].name, schema.name, sizeof((*fields)[i].name)); + (*fields)[i].type = schema.type; + (*fields)[i].bytes = schema.bytes; + } + } + + *fieldNum = tags->numOfBound; + + return TSDB_CODE_SUCCESS; +} /* SArray* stmtGetFreeCol(STscStmt2* pStmt, int32_t* idx) { while (true) { @@ -1847,6 +1889,9 @@ int stmtGetColFields2(TAOS_STMT2* stmt, int* nums, TAOS_FIELD_E** fields) { _return: pStmt->errCode = preCode; + if (code == TSDB_CODE_TSC_INVALID_OPERATION) { + return stmtFetchFields2(stmt, nums, fields); + } return code; } diff --git a/source/libs/parser/src/parInsertSql.c b/source/libs/parser/src/parInsertSql.c index 1c26a7c70ed2..77617ad3b3a0 100644 --- a/source/libs/parser/src/parInsertSql.c +++ b/source/libs/parser/src/parInsertSql.c @@ -780,6 +780,9 @@ static int32_t buildCreateTbReq(SVnodeModifyOpStmt* pStmt, STag* pTag, SArray* p } int32_t checkAndTrimValue(SToken* pToken, char* tmpTokenBuf, SMsgBuf* pMsgBuf, int8_t type) { + if (pToken->type == TK_NK_QUESTION) { + return buildInvalidOperationMsg(pMsgBuf, "insert into super table syntax is not supported for stmt"); + } if ((pToken->type != TK_NOW && pToken->type != TK_TODAY && pToken->type != TK_NK_INTEGER && pToken->type != TK_NK_STRING && pToken->type != TK_NK_FLOAT && pToken->type != TK_NK_BOOL && pToken->type != TK_NULL && pToken->type != TK_NK_HEX && pToken->type != TK_NK_OCT && pToken->type != TK_NK_BIN && @@ -2422,9 +2425,6 @@ static int32_t parseInsertStbClauseBottom(SInsertParseContext* pCxt, SVnodeModif // 1. [(tag1_name, ...)] ... // 2. VALUES ... | FILE ... static int32_t parseInsertTableClauseBottom(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt) { - if (pStmt->stbSyntax && TSDB_QUERY_HAS_TYPE(pStmt->insertType, TSDB_QUERY_TYPE_STMT_INSERT)) { - return buildInvalidOperationMsg(&pCxt->msg, "insert into super table syntax is not supported for stmt"); - } if (!pStmt->stbSyntax) { STableDataCxt* pTableCxt = NULL; int32_t code = parseSchemaClauseBottom(pCxt, pStmt, &pTableCxt); @@ -3066,8 +3066,9 @@ int32_t parseInsertSql(SParseContext* pCxt, SQuery** pQuery, SCatalogReq* pCatal .isStmtBind = pCxt->isStmtBind}; int32_t code = initInsertQuery(&context, pCatalogReq, pMetaData, pQuery); + SVnodeModifyOpStmt* pStmt = (SVnodeModifyOpStmt*)((*pQuery)->pRoot); if (TSDB_CODE_SUCCESS == code) { - code = parseInsertSqlImpl(&context, (SVnodeModifyOpStmt*)(*pQuery)->pRoot); + code = parseInsertSqlImpl(&context, pStmt); } if (TSDB_CODE_SUCCESS == code) { code = setNextStageInfo(&context, *pQuery, pCatalogReq); @@ -3076,8 +3077,24 @@ int32_t parseInsertSql(SParseContext* pCxt, SQuery** pQuery, SCatalogReq* pCatal QUERY_EXEC_STAGE_SCHEDULE == (*pQuery)->execStage) { code = setRefreshMeta(*pQuery); } - insDestroyBoundColInfo(&context.tags); + if (pStmt->stbSyntax && TSDB_QUERY_HAS_TYPE(pStmt->insertType, TSDB_QUERY_TYPE_STMT_INSERT) && + code == TSDB_CODE_TSC_INVALID_OPERATION) { + context.tags.numOfBound = pStmt->pStbRowsCxt->boundColsInfo.numOfBound; + context.tags.numOfCols = pStmt->pStbRowsCxt->boundColsInfo.numOfCols; + context.tags. hasBoundCols= pStmt->pStbRowsCxt->boundColsInfo.hasBoundCols; + context.tags.pColIndex = taosMemoryMalloc(sizeof(int16_t) * context.tags.numOfBound); + memcpy(context.tags.pColIndex, pStmt->pStbRowsCxt->boundColsInfo.pColIndex, + sizeof(int16_t) * pStmt->pStbRowsCxt->boundColsInfo.numOfBound); + code = setStmtInfo(&context, pStmt); + if (TSDB_CODE_SUCCESS == code) { + insDestroyBoundColInfo(&context.tags); + return TSDB_CODE_TSC_INVALID_OPERATION; + } + } + + insDestroyBoundColInfo(&context.tags); + // if no data to insert, set emptyMode to avoid request server if (!context.needRequest) { (*pQuery)->execMode = QUERY_EXEC_MODE_EMPTY_RESULT; diff --git a/source/libs/parser/src/parInsertStmt.c b/source/libs/parser/src/parInsertStmt.c index ee61611bf27c..f18b7b817b4e 100644 --- a/source/libs/parser/src/parInsertStmt.c +++ b/source/libs/parser/src/parInsertStmt.c @@ -885,7 +885,7 @@ int32_t qBindStmtSingleColValue2(void* pBlock, SArray* pCols, TAOS_STMT2_BIND* b } int32_t buildBoundFields(int32_t numOfBound, int16_t* boundColumns, SSchema* pSchema, int32_t* fieldNum, - TAOS_FIELD_E** fields, uint8_t timePrec) { + TAOS_FIELD_E** fields, uint8_t timePrec, TAOS_FIELD_T fieldType) { if (fields) { *fields = taosMemoryCalloc(numOfBound, sizeof(TAOS_FIELD_E)); if (NULL == *fields) { @@ -900,6 +900,7 @@ int32_t buildBoundFields(int32_t numOfBound, int16_t* boundColumns, SSchema* pSc for (int32_t i = 0; i < numOfBound; ++i) { schema = &pSchema[boundColumns[i]]; strcpy((*fields)[i].name, schema->name); + (*fields)[i].field_type = schema->type; (*fields)[i].type = schema->type; (*fields)[i].bytes = schema->bytes; } @@ -929,7 +930,7 @@ int32_t qBuildStmtTagFields(void* pBlock, void* boundTags, int32_t* fieldNum, TA return TSDB_CODE_SUCCESS; } - CHECK_CODE(buildBoundFields(tags->numOfBound, tags->pColIndex, pSchema, fieldNum, fields, 0)); + CHECK_CODE(buildBoundFields(tags->numOfBound, tags->pColIndex, pSchema, fieldNum, fields, 0, TAOS_FIELD_TAG)); return TSDB_CODE_SUCCESS; } @@ -947,7 +948,7 @@ int32_t qBuildStmtColFields(void* pBlock, int32_t* fieldNum, TAOS_FIELD_E** fiel } CHECK_CODE(buildBoundFields(pDataBlock->boundColsInfo.numOfBound, pDataBlock->boundColsInfo.pColIndex, pSchema, - fieldNum, fields, pDataBlock->pMeta->tableInfo.precision)); + fieldNum, fields, pDataBlock->pMeta->tableInfo.precision, TAOS_FIELD_COL)); return TSDB_CODE_SUCCESS; } diff --git a/tests/script/api/makefile b/tests/script/api/makefile index d8a4e192187a..9c2bb6be3d56 100644 --- a/tests/script/api/makefile +++ b/tests/script/api/makefile @@ -25,6 +25,7 @@ exe: gcc $(CFLAGS) ./stmt.c -o $(ROOT)stmt $(LFLAGS) gcc $(CFLAGS) ./stmt2.c -o $(ROOT)stmt2 $(LFLAGS) gcc $(CFLAGS) ./stmt2-example.c -o $(ROOT)stmt2-example $(LFLAGS) + gcc $(CFLAGS) ./stmt2-get-fields.c -o $(ROOT)stmt2-get-fields $(LFLAGS) gcc $(CFLAGS) ./stmt2-nohole.c -o $(ROOT)stmt2-nohole $(LFLAGS) gcc $(CFLAGS) ./stmt-crash.c -o $(ROOT)stmt-crash $(LFLAGS) @@ -42,5 +43,6 @@ clean: rm $(ROOT)stmt rm $(ROOT)stmt2 rm $(ROOT)stmt2-example + rm $(ROOT)stmt2-get-fields rm $(ROOT)stmt2-nohole rm $(ROOT)stmt-crash diff --git a/tests/script/api/stmt2-get-fields.c b/tests/script/api/stmt2-get-fields.c new file mode 100644 index 000000000000..60bee16873ef --- /dev/null +++ b/tests/script/api/stmt2-get-fields.c @@ -0,0 +1,64 @@ +// TAOS standard API example. The same syntax as MySQL, but only a subet +// to compile: gcc -o stmt2-get-fields stmt2-get-fields.c -ltaos + +#include +#include +#include +#include "taos.h" + +void do_query(TAOS *taos, const char *sql) { + TAOS_RES *result = taos_query(taos, sql); + int code = taos_errno(result); + if (code) { + printf("failed to query: %s, reason:%s\n", sql, taos_errstr(result)); + taos_free_result(result); + return; + } + taos_free_result(result); +} + +void do_stmt(TAOS *taos) { + do_query(taos, "drop database if exists db"); + do_query(taos, "create database db"); + do_query(taos, + "create table db.stb (ts timestamp, b binary(10)) tags(t1 " + "int, t2 binary(10))"); + + TAOS_STMT2_OPTION option = {0}; + TAOS_STMT2 *stmt = taos_stmt2_init(taos, &option); + const char *sql = "insert into db.stb(t1,t2,ts,b,tbname) values(?,?,?,?,?)"; + + int code = taos_stmt2_prepare(stmt, sql, 0); + if (code != 0) { + printf("failed to execute taos_stmt2_prepare. error:%s\n", taos_stmt2_error(stmt)); + taos_stmt2_close(stmt); + return; + } + + int fieldNum = 0; + TAOS_FIELD_E *pFields = NULL; + code = taos_stmt2_get_all_fields(stmt, &fieldNum, &pFields); + if (code != 0) { + printf("failed get col,ErrCode: 0x%x, ErrMessage: %s.\n", code, taos_stmt2_error(stmt)); + } else { + printf("col nums:%d\n", fieldNum); + for(int i = 0; i < fieldNum; i++) { + printf("field[%d]: %s,type:%d\n", i, pFields[i].name,pFields[i].field_type); + } + } + + + taos_stmt2_close(stmt); +} + +int main() { + TAOS *taos = taos_connect("localhost", "root", "taosdata", "", 0); + if (!taos) { + printf("failed to connect to db, reason:%s\n", taos_errstr(taos)); + exit(1); + } + + do_stmt(taos); + taos_close(taos); + taos_cleanup(); +} \ No newline at end of file From 946b3efd46a26ad6aeb232e499208efbe43364ed Mon Sep 17 00:00:00 2001 From: Feng Chao Date: Tue, 29 Oct 2024 18:02:02 +0800 Subject: [PATCH 402/695] Update test_case_when.py --- tests/army/query/test_case_when.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/army/query/test_case_when.py b/tests/army/query/test_case_when.py index 9edc9daad695..dea5a5f01f69 100644 --- a/tests/army/query/test_case_when.py +++ b/tests/army/query/test_case_when.py @@ -348,6 +348,18 @@ def test_case_when_statements(self): # tdSql.query("select case c_float when 2.2 then 9.2233720e+18 when 3.3 then -9.2233720e+18 else 'aa' end from st1;") # tdSql.query("select case t1.c_int when 2 then 'run' when t1.c_int is null then 'other' else t2.c_varchar end from st1 t1, st2 t2 where t1.ts=t2.ts;") + tdSql.query("select avg(case when c_tinyint>=2 then c_tinyint else c_null end) from st1;") + assert(tdSql.checkRows(1) and tdSql.res == [(6.0,)]) + + tdSql.query("select sum(case when c_tinyint>=2 then c_tinyint else c_null end) from st1;") + assert(tdSql.checkRows(1) and tdSql.res == [(54,)]) + + tdSql.query("select first(case when c_int >=2 then 'abc' else 0 end) from st1;") + assert(tdSql.checkRows(1) and tdSql.res == [('abc',)]) + + tdSql.query("select last(case when c_int >=2 then c_int else 0 end) from st1;") + assert(tdSql.checkRows(1) and tdSql.res == [(0,)]) + def run(self): self.prepare_data() self.test_case_when_statements() From 7e89000d4e10d76c4200bda0cbb445e20e24fb68 Mon Sep 17 00:00:00 2001 From: chenhaoran Date: Tue, 29 Oct 2024 18:02:14 +0800 Subject: [PATCH 403/695] test: add the frequency of printing consumer logs --- tests/army/tmq/drop_lost_comsumers.py | 55 +++++++++++++++------------ tests/army/tmq/per_consumer.py | 32 ++++++++++------ 2 files changed, 50 insertions(+), 37 deletions(-) diff --git a/tests/army/tmq/drop_lost_comsumers.py b/tests/army/tmq/drop_lost_comsumers.py index cef67ddfccc7..a5e8140c4aa5 100644 --- a/tests/army/tmq/drop_lost_comsumers.py +++ b/tests/army/tmq/drop_lost_comsumers.py @@ -24,7 +24,8 @@ def __init__(self): def log_info(self, message): if self.sub_log: tdLog.info(message) - + + #TODO merge sub_consumer and sub_consumer_once def sub_consumer(self, consumer, group_id, topic_name): group_id = int(group_id) if group_id < 100: @@ -95,20 +96,23 @@ def sub_consumer_once(self, consumer, group_id, topic_name, stop_event): consumer.subscribe([topic_name]) nrows = 0 consumer_nrows = 0 - + count = 0 while not stop_event.is_set(): start = datetime.datetime.now() - self.log_info( - f"time:{start},consumer:{group_id}, start to consume,consumer_nrows:{consumer_nrows}" - ) + # self.log_info( + # f"time:{start},consumer:{group_id}, start to consume,consumer_nrows:{consumer_nrows}" + # ) message = None if consumer_nrows < self.once_consumer_rows: message = consumer.poll(timeout=1.0) elif consumer_nrows >= self.once_consumer_rows: - # when break the loop, the consumer will be closed, so we need to continue to keep consumer alive util the stop_event is set - pass - # tdLog.info("stop consumer when consumer all rows") - + if count == 0: + # when break the loop, the consumer will be closed, so we need to continue to keep consumer alive util the stop_event is set + tdLog.info("stop consumer when consumer all rows") + count += 1 + # tdLog.info("stop consumer when consumer all rows") + else: + continue if message: message_offset = message.offset() # topic = message.topic() @@ -122,12 +126,13 @@ def sub_consumer_once(self, consumer, group_id, topic_name, stop_event): end = datetime.datetime.now() elapsed_time = end - start - self.log_info( - f"time:{end},consumer:{group_id}, elapsed time:{elapsed_time},consumer_nrows:{nrows},consumer_addrows:{addrows}, consumer_ncols:{ncols},offset:{message_offset}" - ) + # self.log_info( + # f"time:{end},consumer:{group_id}, elapsed time:{elapsed_time},consumer_nrows:{nrows},consumer_addrows:{addrows}, consumer_ncols:{ncols},offset:{message_offset}" + # ) self.log_info( - f"consumer:{group_id},consumer_nrows:{nrows},counter.counter:{self.safe_counter.counter}" + f"consumer:{group_id},consumer_nrows:{nrows},counter.counter:{self.safe_counter.counter},counter.get():{self.safe_counter.get()}" ) + # consumer.commit() consumer_nrows = nrows @@ -204,7 +209,7 @@ def check_consumer(self, count, rows, stop_event=None): tdLog.info( f"wait timeout count:{count} and check consumer status whether is closed" ) - for _ in range(5): + for _ in range(2): tdSql.query("show consumers") anser_rows = tdSql.getRows() if anser_rows == rows: @@ -227,10 +232,10 @@ def drop_session_timeout_consmuers(self): # start consumer and config some parameters os.system( - f"nohup python3 ./tmq/per_consumer.py -c {self.consumer_groups_num} -s {self.session_timeout_ms} -p {self.max_poll_interval_ms} > consumer.log &" + f"nohup python3 ./tmq/per_consumer.py -c {self.consumer_groups_num} -s {self.session_timeout_ms} -p {self.max_poll_interval_ms} -t {self.topic_name} > consumer.log &" ) - # wait 4s for consuming data - time.sleep(4) + # wait 5s for consuming data + time.sleep(5) # kill consumer to simulate session_timeout_ms tdLog.info("kill per_consumer.py") tdCom.kill_signal_process( @@ -268,18 +273,18 @@ def drop_max_poll_timeout_consmuers(self): tr.start() while True: - if self.safe_counter.get() < self.consumer_all_rows: - time.sleep(5) + if self.safe_counter.counter < self.consumer_all_rows: + # control print log frequency + time.sleep(1) tdLog.info( - f"consumer_all_rows:{self.consumer_all_rows},counter.get():{self.safe_counter.get()}" + f"consumer_all_rows:{self.consumer_all_rows},counter.get():{self.safe_counter.counter}" ) - elif self.safe_counter.get() >= self.consumer_all_rows: + elif self.safe_counter.counter == self.consumer_all_rows: # adding 5s is for heartbeat check self.check_consumer(int(self.max_poll_interval_ms / 1000 ) + 5, 0, stop_event) stop_event.set() break - for tr in threads: - tr.join() + time.sleep(1) tdSql.execute(f"drop topic if exists {self.topic_name};") @@ -302,7 +307,7 @@ def case_max_poll_timeout(self): """ tdLog.info("start to test max_poll_interval_ms=20s") # test max_poll_interval_ms=20s - self.session_timeout_ms = 180000 + self.session_timeout_ms = 300000 self.max_poll_interval_ms = 20000 self.drop_max_poll_timeout_consmuers() tdLog.info("stop to test max_poll_interval_ms=20s and done ") @@ -317,7 +322,7 @@ def run(self): ) # test case start here self.topic_name = "select_d1" - self.case_session_timeout() + # self.case_session_timeout() self.case_max_poll_timeout() def stop(self): diff --git a/tests/army/tmq/per_consumer.py b/tests/army/tmq/per_consumer.py index 418c88dead43..b8f409d7109f 100644 --- a/tests/army/tmq/per_consumer.py +++ b/tests/army/tmq/per_consumer.py @@ -1,8 +1,9 @@ import os import taos -import time +import sys from datetime import datetime -from frame.log import * +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from frame.log import tdLog import subprocess from multiprocessing import Process import threading @@ -40,28 +41,35 @@ default=180000, help="max poll interval timeout:ms", ) -def test_timeout_sub(consumer_group_num, session_timeout_ms, max_poll_interval_ms): +@click.option( + "-t", + "--topic-name", + "topic_name", + default="select_d1", + help="topic name", +) +def test_timeout_sub(consumer_group_num, session_timeout_ms, max_poll_interval_ms, topic_name): threads = [] - tdLog.info(consumer_group_num, session_timeout_ms, max_poll_interval_ms) + tdLog.info(f"consumer_group_num:{consumer_group_num}, session_timeout_ms:{session_timeout_ms}, max_poll_interval_ms:{max_poll_interval_ms}") for id in range(consumer_group_num): conf = set_conf( group_id=id, session_timeout_ms=session_timeout_ms, max_poll_interval_ms=max_poll_interval_ms, ) - tdLog.info(conf) - threads.append(threading.Thread(target=taosc_consumer, args=(conf,))) + tdLog.info(f"conf:{conf}") + threads.append(threading.Thread(target=taosc_consumer, args=(conf,topic_name))) for tr in threads: tr.start() for tr in threads: tr.join() -def sub_consumer(consumer, group_id): +def sub_consumer(consumer, group_id, topic_name): group_id = int(group_id) if group_id < 100: try: - consumer.subscribe(["select_d1"]) + consumer.subscribe([topic_name]) except Exception as e: tdLog.info(f"subscribe error") exit(1) @@ -93,10 +101,10 @@ def sub_consumer(consumer, group_id): # consumer.close() -def sub_consumer_once(consumer, group_id): +def sub_consumer_once(consumer, group_id, topic_name): group_id = int(group_id) if group_id < 100: - consumer.subscribe(["select_d1"]) + consumer.subscribe([topic_name]) nrows = 0 consumer_nrows = 0 while True: @@ -160,12 +168,12 @@ def set_conf( return conf -def taosc_consumer(conf): +def taosc_consumer(conf,topic_name): consumer = Consumer(conf) group_id = int(conf["group.id"]) tdLog.info(f"{consumer},{group_id}") try: - sub_consumer_once(consumer, group_id) + sub_consumer_once(consumer, group_id, topic_name) except Exception as e: tdLog.info(str(e)) From 419c2e2974dc1cb6cb1d6e12675833d6d2b625d1 Mon Sep 17 00:00:00 2001 From: Jing Sima Date: Tue, 29 Oct 2024 11:13:50 +0800 Subject: [PATCH 404/695] fix:[TS-5567] fix bug when partition/group by const value's alias name. --- source/libs/parser/src/parTranslater.c | 114 +++++++++++-------- tests/system-test/2-query/group_partition.py | 19 +++- 2 files changed, 83 insertions(+), 50 deletions(-) diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 636be7c5cce6..7ce8d87b18c1 100755 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -1603,25 +1603,6 @@ static EDealRes translateColumnUseAlias(STranslateContext* pCxt, SColumnNode** p } } if (*pFound) { - if (QUERY_NODE_FUNCTION == nodeType(pFoundNode) && (SQL_CLAUSE_GROUP_BY == pCxt->currClause || SQL_CLAUSE_PARTITION_BY == pCxt->currClause)) { - pCxt->errCode = getFuncInfo(pCxt, (SFunctionNode*)pFoundNode); - if (TSDB_CODE_SUCCESS == pCxt->errCode) { - if (fmIsVectorFunc(((SFunctionNode*)pFoundNode)->funcId)) { - pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_ILLEGAL_USE_AGG_FUNCTION, (*pCol)->colName); - return DEAL_RES_ERROR; - } else if (fmIsPseudoColumnFunc(((SFunctionNode*)pFoundNode)->funcId)) { - if ('\0' != (*pCol)->tableAlias[0]) { - return translateColumnWithPrefix(pCxt, pCol); - } else { - return translateColumnWithoutPrefix(pCxt, pCol); - } - } else { - /* Do nothing and replace old node with found node. */ - } - } else { - return DEAL_RES_ERROR; - } - } SNode* pNew = NULL; int32_t code = nodesCloneNode(pFoundNode, &pNew); if (NULL == pNew) { @@ -1630,14 +1611,6 @@ static EDealRes translateColumnUseAlias(STranslateContext* pCxt, SColumnNode** p } nodesDestroyNode(*(SNode**)pCol); *(SNode**)pCol = (SNode*)pNew; - if (QUERY_NODE_COLUMN == nodeType(pFoundNode)) { - pCxt->errCode = TSDB_CODE_SUCCESS; - if ('\0' != (*pCol)->tableAlias[0]) { - return translateColumnWithPrefix(pCxt, pCol); - } else { - return translateColumnWithoutPrefix(pCxt, pCol); - } - } } return DEAL_RES_CONTINUE; } @@ -1882,6 +1855,39 @@ static bool clauseSupportAlias(ESqlClause clause) { SQL_CLAUSE_ORDER_BY == clause; } +static EDealRes translateColumnInGroupByClause(STranslateContext* pCxt, SColumnNode** pCol, bool *translateAsAlias) { + *translateAsAlias = false; + // count(*)/first(*)/last(*) and so on + if (0 == strcmp((*pCol)->colName, "*")) { + return DEAL_RES_CONTINUE; + } + + if (pCxt->pParseCxt->biMode) { + SNode** ppNode = (SNode**)pCol; + bool ret; + pCxt->errCode = biRewriteToTbnameFunc(pCxt, ppNode, &ret); + if (TSDB_CODE_SUCCESS != pCxt->errCode) return DEAL_RES_ERROR; + if (ret) { + return translateFunction(pCxt, (SFunctionNode**)ppNode); + } + } + + EDealRes res = DEAL_RES_CONTINUE; + if ('\0' != (*pCol)->tableAlias[0]) { + res = translateColumnWithPrefix(pCxt, pCol); + } else { + bool found = false; + res = translateColumnWithoutPrefix(pCxt, pCol); + if (!(*pCol)->node.asParam && + res != DEAL_RES_CONTINUE && + res != DEAL_RES_END && pCxt->errCode != TSDB_CODE_PAR_AMBIGUOUS_COLUMN) { + res = translateColumnUseAlias(pCxt, pCol, &found); + *translateAsAlias = true; + } + } + return res; +} + static EDealRes translateColumn(STranslateContext* pCxt, SColumnNode** pCol) { if (NULL == pCxt->pCurrStmt || (isSelectStmt(pCxt->pCurrStmt) && NULL == ((SSelectStmt*)pCxt->pCurrStmt)->pFromTable)) { @@ -5472,12 +5478,13 @@ typedef struct SReplaceGroupByAliasCxt { SNodeList* pProjectionList; } SReplaceGroupByAliasCxt; -static EDealRes replaceGroupByAliasImpl(SNode** pNode, void* pContext) { +static EDealRes translateGroupPartitionByImpl(SNode** pNode, void* pContext) { SReplaceGroupByAliasCxt* pCxt = pContext; SNodeList* pProjectionList = pCxt->pProjectionList; SNode* pProject = NULL; + int32_t code = TSDB_CODE_SUCCESS; + STranslateContext* pTransCxt = pCxt->pTranslateCxt; if (QUERY_NODE_VALUE == nodeType(*pNode)) { - STranslateContext* pTransCxt = pCxt->pTranslateCxt; SValueNode* pVal = (SValueNode*) *pNode; if (DEAL_RES_ERROR == translateValue(pTransCxt, pVal)) { return DEAL_RES_CONTINUE; @@ -5488,43 +5495,58 @@ static EDealRes replaceGroupByAliasImpl(SNode** pNode, void* pContext) { int32_t pos = getPositionValue(pVal); if (0 < pos && pos <= LIST_LENGTH(pProjectionList)) { SNode* pNew = NULL; - int32_t code = nodesCloneNode(nodesListGetNode(pProjectionList, pos - 1), (SNode**)&pNew); + code = nodesCloneNode(nodesListGetNode(pProjectionList, pos - 1), (SNode**)&pNew); if (TSDB_CODE_SUCCESS != code) { pCxt->pTranslateCxt->errCode = code; return DEAL_RES_ERROR; } nodesDestroyNode(*pNode); *pNode = pNew; - return DEAL_RES_CONTINUE; - } else { - return DEAL_RES_CONTINUE; } + code = translateExpr(pTransCxt, pNode); + if (TSDB_CODE_SUCCESS != code) { + pTransCxt->errCode = code; + return DEAL_RES_ERROR; + } + return DEAL_RES_CONTINUE; } else if (QUERY_NODE_COLUMN == nodeType(*pNode)) { - STranslateContext* pTransCxt = pCxt->pTranslateCxt; - return translateColumn(pTransCxt, (SColumnNode**)pNode); + bool asAlias = false; + EDealRes res = translateColumnInGroupByClause(pTransCxt, (SColumnNode**)pNode, &asAlias); + if (DEAL_RES_ERROR == res) { + return DEAL_RES_ERROR; + } + pTransCxt->errCode = TSDB_CODE_SUCCESS; + if (nodeType(*pNode) == QUERY_NODE_COLUMN && !asAlias) { + return DEAL_RES_CONTINUE; + } + code = translateExpr(pTransCxt, pNode); + if (TSDB_CODE_SUCCESS != code) { + pTransCxt->errCode = code; + return DEAL_RES_ERROR; + } + return DEAL_RES_CONTINUE; } - - return DEAL_RES_CONTINUE; + return doTranslateExpr(pNode, pTransCxt); } -static int32_t replaceGroupByAlias(STranslateContext* pCxt, SSelectStmt* pSelect) { +static int32_t translateGroupByList(STranslateContext* pCxt, SSelectStmt* pSelect) { if (NULL == pSelect->pGroupByList) { return TSDB_CODE_SUCCESS; } SReplaceGroupByAliasCxt cxt = { .pTranslateCxt = pCxt, .pProjectionList = pSelect->pProjectionList}; - nodesRewriteExprsPostOrder(pSelect->pGroupByList, replaceGroupByAliasImpl, &cxt); + nodesRewriteExprsPostOrder(pSelect->pGroupByList, translateGroupPartitionByImpl, &cxt); return pCxt->errCode; } -static int32_t replacePartitionByAlias(STranslateContext* pCxt, SSelectStmt* pSelect) { +static int32_t translatePartitionByList(STranslateContext* pCxt, SSelectStmt* pSelect) { if (NULL == pSelect->pPartitionByList) { return TSDB_CODE_SUCCESS; } SReplaceGroupByAliasCxt cxt = { .pTranslateCxt = pCxt, .pProjectionList = pSelect->pProjectionList}; - nodesRewriteExprsPostOrder(pSelect->pPartitionByList, replaceGroupByAliasImpl, &cxt); + nodesRewriteExprsPostOrder(pSelect->pPartitionByList, translateGroupPartitionByImpl, &cxt); return pCxt->errCode; } @@ -5588,11 +5610,8 @@ static int32_t translateGroupBy(STranslateContext* pCxt, SSelectStmt* pSelect) { NODES_DESTORY_LIST(pSelect->pGroupByList); return TSDB_CODE_SUCCESS; } - code = replaceGroupByAlias(pCxt, pSelect); - } - if (TSDB_CODE_SUCCESS == code) { pSelect->timeLineResMode = TIME_LINE_NONE; - code = translateExprList(pCxt, pSelect->pGroupByList); + code = translateGroupByList(pCxt, pSelect); } return code; } @@ -6287,10 +6306,7 @@ static int32_t translatePartitionBy(STranslateContext* pCxt, SSelectStmt* pSelec (QUERY_NODE_FUNCTION == nodeType(pPar) && FUNCTION_TYPE_TBNAME == ((SFunctionNode*)pPar)->funcType))) { pSelect->timeLineResMode = TIME_LINE_MULTI; } - code = replacePartitionByAlias(pCxt, pSelect); - if (TSDB_CODE_SUCCESS == code) { - code = translateExprList(pCxt, pSelect->pPartitionByList); - } + code = translatePartitionByList(pCxt, pSelect); } if (TSDB_CODE_SUCCESS == code) { code = translateExprList(pCxt, pSelect->pTags); diff --git a/tests/system-test/2-query/group_partition.py b/tests/system-test/2-query/group_partition.py index 384df02e8d3f..7ee528841c5c 100644 --- a/tests/system-test/2-query/group_partition.py +++ b/tests/system-test/2-query/group_partition.py @@ -420,7 +420,23 @@ def test_error(self): tdSql.error(f"select t2, count(*) from {self.dbname}.{self.stable} group by t2 where t2 = 1") tdSql.error(f"select t2, count(*) from {self.dbname}.{self.stable} group by t2 interval(1d)") - + def test_TS5567(self): + tdSql.query(f"select const_col from (select 1 as const_col from {self.dbname}.{self.stable}) t group by const_col") + tdSql.checkRows(50) + tdSql.query(f"select const_col from (select 1 as const_col from {self.dbname}.{self.stable}) t partition by const_col") + tdSql.checkRows(50) + tdSql.query(f"select const_col from (select 1 as const_col, count(c1) from {self.dbname}.{self.stable} t group by c1) group by const_col") + tdSql.checkRows(10) + tdSql.query(f"select const_col from (select 1 as const_col, count(c1) from {self.dbname}.{self.stable} t group by c1) partition by const_col") + tdSql.checkRows(10) + tdSql.query(f"select const_col as c_c from (select 1 as const_col from {self.dbname}.{self.stable}) t group by c_c") + tdSql.checkRows(50) + tdSql.query(f"select const_col as c_c from (select 1 as const_col from {self.dbname}.{self.stable}) t partition by c_c") + tdSql.checkRows(50) + tdSql.query(f"select const_col from (select 1 as const_col, count(c1) from {self.dbname}.{self.stable} t group by c1) group by 1") + tdSql.checkRows(10) + tdSql.query(f"select const_col from (select 1 as const_col, count(c1) from {self.dbname}.{self.stable} t group by c1) partition by 1") + tdSql.checkRows(10) def run(self): tdSql.prepare() self.prepare_db() @@ -453,6 +469,7 @@ def run(self): self.test_window(nonempty_tb_num) self.test_event_window(nonempty_tb_num) + self.test_TS5567() ## test old version before changed # self.test_groupby('group', 0, 0) From a0818d2a2d2304627bf35390f5c7f14aa96717ad Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Tue, 29 Oct 2024 18:34:51 +0800 Subject: [PATCH 405/695] fix issue --- source/libs/executor/src/scanoperator.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index a14db482b20e..5cee4a1f096d 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -4272,6 +4272,10 @@ void streamScanReleaseState(SOperatorInfo* pOperator) { code = pInfo->stateStore.updateInfoSerialize(pScanEnCoder, pInfo->pUpdateInfo); QUERY_CHECK_CODE(code, lino, _end); + tEndEncode(pScanEnCoder); + tEncoderClear(pScanEnCoder); + pScanEnCoder = NULL; + pInfo->stateStore.streamStateSaveInfo(pInfo->pState, STREAM_SCAN_OP_STATE_NAME, strlen(STREAM_SCAN_OP_STATE_NAME), pBuff, len); _end: From 69f6c3eb5149033e3d3af4438f9ec452e90f8178 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Tue, 29 Oct 2024 18:45:30 +0800 Subject: [PATCH 406/695] fix(stream): adjust init ref position. --- source/libs/stream/src/streamMeta.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/libs/stream/src/streamMeta.c b/source/libs/stream/src/streamMeta.c index 17883f5fb103..064098ed35f0 100644 --- a/source/libs/stream/src/streamMeta.c +++ b/source/libs/stream/src/streamMeta.c @@ -458,9 +458,6 @@ int32_t streamMetaOpen(const char* path, void* ahandle, FTaskBuild buildTaskFn, code = metaRefMgtAdd(pMeta->vgId, pRid); TSDB_CHECK_CODE(code, lino, _err); - code = createMetaHbInfo(pRid, &pMeta->pHbInfo); - TSDB_CHECK_CODE(code, lino, _err); - code = bkdMgtCreate(tpath, (SBkdMgt**)&pMeta->bkdChkptMgt); TSDB_CHECK_CODE(code, lino, _err); @@ -469,6 +466,9 @@ int32_t streamMetaOpen(const char* path, void* ahandle, FTaskBuild buildTaskFn, // add refId at the end of initialization function pMeta->rid = taosAddRef(streamMetaId, pMeta); + code = createMetaHbInfo(pRid, &pMeta->pHbInfo); + + TSDB_CHECK_CODE(code, lino, _err); *p = pMeta; return code; From c149449717079441ead616a0aca7197a8e307983 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Tue, 29 Oct 2024 18:45:30 +0800 Subject: [PATCH 407/695] fix(stream): adjust init ref position. --- source/libs/stream/src/streamMeta.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/libs/stream/src/streamMeta.c b/source/libs/stream/src/streamMeta.c index 17883f5fb103..064098ed35f0 100644 --- a/source/libs/stream/src/streamMeta.c +++ b/source/libs/stream/src/streamMeta.c @@ -458,9 +458,6 @@ int32_t streamMetaOpen(const char* path, void* ahandle, FTaskBuild buildTaskFn, code = metaRefMgtAdd(pMeta->vgId, pRid); TSDB_CHECK_CODE(code, lino, _err); - code = createMetaHbInfo(pRid, &pMeta->pHbInfo); - TSDB_CHECK_CODE(code, lino, _err); - code = bkdMgtCreate(tpath, (SBkdMgt**)&pMeta->bkdChkptMgt); TSDB_CHECK_CODE(code, lino, _err); @@ -469,6 +466,9 @@ int32_t streamMetaOpen(const char* path, void* ahandle, FTaskBuild buildTaskFn, // add refId at the end of initialization function pMeta->rid = taosAddRef(streamMetaId, pMeta); + code = createMetaHbInfo(pRid, &pMeta->pHbInfo); + + TSDB_CHECK_CODE(code, lino, _err); *p = pMeta; return code; From 9bae0adba6a56cefdad9da1965e949b433eee49e Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Tue, 29 Oct 2024 19:14:37 +0800 Subject: [PATCH 408/695] fix(stream): start scheduler task after set the refId. --- source/dnode/snode/src/snode.c | 1 - source/dnode/vnode/src/tq/tq.c | 1 - source/libs/stream/src/streamCheckStatus.c | 2 +- source/libs/stream/src/streamCheckpoint.c | 2 +- source/libs/stream/src/streamDispatch.c | 4 ++-- source/libs/stream/src/streamMeta.c | 6 ++++++ source/libs/stream/src/streamSched.c | 23 +++++++++++++++------ source/libs/stream/src/streamStartHistory.c | 2 +- 8 files changed, 28 insertions(+), 13 deletions(-) diff --git a/source/dnode/snode/src/snode.c b/source/dnode/snode/src/snode.c index e8d4663bbbb0..6eee8c510be2 100644 --- a/source/dnode/snode/src/snode.c +++ b/source/dnode/snode/src/snode.c @@ -38,7 +38,6 @@ int32_t sndBuildStreamTask(SSnode *pSnode, SStreamTask *pTask, int64_t nextProce streamTaskOpenAllUpstreamInput(pTask); streamTaskResetUpstreamStageInfo(pTask); - streamSetupScheduleTrigger(pTask); SCheckpointInfo *pChkInfo = &pTask->chkInfo; tqSetRestoreVersionInfo(pTask); diff --git a/source/dnode/vnode/src/tq/tq.c b/source/dnode/vnode/src/tq/tq.c index 292912102988..ec7ac1054c92 100644 --- a/source/dnode/vnode/src/tq/tq.c +++ b/source/dnode/vnode/src/tq/tq.c @@ -765,7 +765,6 @@ int32_t tqBuildStreamTask(void* pTqObj, SStreamTask* pTask, int64_t nextProcessV } streamTaskResetUpstreamStageInfo(pTask); - streamSetupScheduleTrigger(pTask); SCheckpointInfo* pChkInfo = &pTask->chkInfo; tqSetRestoreVersionInfo(pTask); diff --git a/source/libs/stream/src/streamCheckStatus.c b/source/libs/stream/src/streamCheckStatus.c index 60f8744448bf..64b19e4ed9e3 100644 --- a/source/libs/stream/src/streamCheckStatus.c +++ b/source/libs/stream/src/streamCheckStatus.c @@ -750,7 +750,7 @@ void rspMonitorFn(void* param, void* tmrId) { SStreamTask* pTask = taosAcquireRef(streamTaskRefPool, taskRefId); if (pTask == NULL) { - stError("invalid task rid:%" PRId64 " failed to acquired stream-task", taskRefId); + stError("invalid task rid:%" PRId64 " failed to acquired stream-task at %s", taskRefId, __func__); streamTaskFreeRefId(param); return; } diff --git a/source/libs/stream/src/streamCheckpoint.c b/source/libs/stream/src/streamCheckpoint.c index d1b57c32b975..7724d1c5ffbe 100644 --- a/source/libs/stream/src/streamCheckpoint.c +++ b/source/libs/stream/src/streamCheckpoint.c @@ -1008,7 +1008,7 @@ void checkpointTriggerMonitorFn(void* param, void* tmrId) { SStreamTask* pTask = taosAcquireRef(streamTaskRefPool, taskRefId); if (pTask == NULL) { - stError("invalid task rid:%" PRId64 " failed to acquired stream-task", taskRefId); + stError("invalid task rid:%" PRId64 " failed to acquired stream-task at %s", taskRefId, __func__); streamTaskFreeRefId(param); return; } diff --git a/source/libs/stream/src/streamDispatch.c b/source/libs/stream/src/streamDispatch.c index ff410087591f..5f31364e76c8 100644 --- a/source/libs/stream/src/streamDispatch.c +++ b/source/libs/stream/src/streamDispatch.c @@ -539,7 +539,7 @@ static void doMonitorDispatchData(void* param, void* tmrId) { pTask = taosAcquireRef(streamTaskRefPool, taskRefId); if (pTask == NULL) { - stError("invalid task rid:%" PRId64 " failed to acquired stream-task", taskRefId); + stError("invalid task rid:%" PRId64 " failed to acquired stream-task at %s", taskRefId, __func__); streamTaskFreeRefId(param); return; } @@ -1082,7 +1082,7 @@ static void chkptReadyMsgSendMonitorFn(void* param, void* tmrId) { SStreamTask* pTask = taosAcquireRef(streamTaskRefPool, taskRefId); if (pTask == NULL) { - stError("invalid task rid:%" PRId64 " failed to acquired stream-task", taskRefId); + stError("invalid task rid:%" PRId64 " failed to acquired stream-task at %s", taskRefId, __func__); streamTaskFreeRefId(param); return; } diff --git a/source/libs/stream/src/streamMeta.c b/source/libs/stream/src/streamMeta.c index d414b02d6989..598f809c21a1 100644 --- a/source/libs/stream/src/streamMeta.c +++ b/source/libs/stream/src/streamMeta.c @@ -745,6 +745,9 @@ int32_t streamMetaRegisterTask(SStreamMeta* pMeta, int64_t ver, SStreamTask* pTa int32_t val = atomic_add_fetch_32(&pMeta->numOfStreamTasks, 1); } + // enable the scheduler for stream tasks + streamSetupScheduleTrigger(pTask); + *pAdded = true; return code; } @@ -1147,6 +1150,9 @@ void streamMetaLoadAllTasks(SStreamMeta* pMeta) { continue; } + // enable the scheduler for stream tasks after acquire the task RefId. + streamSetupScheduleTrigger(pTask); + stInfo("s-task:0x%x vgId:%d set refId:%"PRId64, (int32_t) id.taskId, vgId, pTask->id.refId); if (pTask->info.fillHistory == 0) { int32_t val = atomic_add_fetch_32(&pMeta->numOfStreamTasks, 1); diff --git a/source/libs/stream/src/streamSched.c b/source/libs/stream/src/streamSched.c index 7c77797ef94b..25d6161aba10 100644 --- a/source/libs/stream/src/streamSched.c +++ b/source/libs/stream/src/streamSched.c @@ -20,12 +20,15 @@ static void streamTaskResumeHelper(void* param, void* tmrId); static void streamTaskSchedHelper(void* param, void* tmrId); void streamSetupScheduleTrigger(SStreamTask* pTask) { - int64_t delaySchema = pTask->info.delaySchedParam; - if (delaySchema != 0 && pTask->info.fillHistory == 0) { + int64_t delayParam = pTask->info.delaySchedParam; + if (delayParam != 0 && pTask->info.fillHistory == 0) { int64_t* pTaskRefId = NULL; int32_t code = streamTaskAllocRefId(pTask, &pTaskRefId); if (code == 0) { - streamTmrStart(streamTaskSchedHelper, (int32_t)delaySchema, pTaskRefId, streamTimer, + stDebug("s-task:%s refId:%" PRId64 " enable the scheduler trigger, delay:%" PRId64, pTask->id.idStr, + pTask->id.refId, delayParam); + + streamTmrStart(streamTaskSchedHelper, (int32_t)delayParam, pTaskRefId, streamTimer, &pTask->schedInfo.pDelayTimer, pTask->pMeta->vgId, "sched-tmr"); pTask->schedInfo.status = TASK_TRIGGER_STATUS__INACTIVE; } @@ -93,7 +96,7 @@ void streamTaskResumeHelper(void* param, void* tmrId) { int64_t taskRefId = *(int64_t*)param; SStreamTask* pTask = taosAcquireRef(streamTaskRefPool, taskRefId); if (pTask == NULL) { - stError("invalid task rid:%" PRId64 " failed to acquired stream-task", taskRefId); + stError("invalid task rid:%" PRId64 " failed to acquired stream-task at %s", taskRefId, __func__); streamTaskFreeRefId(param); return; } @@ -129,7 +132,7 @@ void streamTaskSchedHelper(void* param, void* tmrId) { int64_t taskRefId = *(int64_t*)param; SStreamTask* pTask = taosAcquireRef(streamTaskRefPool, taskRefId); if (pTask == NULL) { - stError("invalid task rid:%" PRId64 " failed to acquired stream-task", taskRefId); + stError("invalid task rid:%" PRId64 " failed to acquired stream-task at %s", taskRefId, __func__); streamTaskFreeRefId(param); return; } @@ -141,13 +144,21 @@ void streamTaskSchedHelper(void* param, void* tmrId) { int8_t status = atomic_load_8(&pTask->schedInfo.status); stTrace("s-task:%s in scheduler, trigger status:%d, next:%dms", id, status, nextTrigger); - if (streamTaskShouldStop(pTask) || streamTaskShouldPause(pTask)) { + if (streamTaskShouldStop(pTask)) { stDebug("s-task:%s should stop, jump out of schedTimer", id); streamMetaReleaseTask(pTask->pMeta, pTask); streamTaskFreeRefId(param); return; } + if (streamTaskShouldPause(pTask)) { + stDebug("s-task:%s is paused, recheck in %.2fs", id, nextTrigger/1000.0); + streamTmrStart(streamTaskSchedHelper, nextTrigger, param, streamTimer, &pTask->schedInfo.pDelayTimer, vgId, + "sched-run-tmr"); + streamMetaReleaseTask(pTask->pMeta, pTask); + return; + } + if (streamTaskGetStatus(pTask).state == TASK_STATUS__CK) { stDebug("s-task:%s in checkpoint procedure, not retrieve result, next:%dms", id, nextTrigger); } else { diff --git a/source/libs/stream/src/streamStartHistory.c b/source/libs/stream/src/streamStartHistory.c index 54026f5db2cf..4d38c48fc5ce 100644 --- a/source/libs/stream/src/streamStartHistory.c +++ b/source/libs/stream/src/streamStartHistory.c @@ -583,7 +583,7 @@ void doExecScanhistoryInFuture(void* param, void* tmrId) { SStreamTask* pTask = taosAcquireRef(streamTaskRefPool, taskRefId); if (pTask == NULL) { - stError("invalid task rid:%" PRId64 " failed to acquired stream-task", taskRefId); + stError("invalid task rid:%" PRId64 " failed to acquired stream-task at %s", taskRefId, __func__); streamTaskFreeRefId(param); return; } From a603c16f6c2b80a6217afa3b1af2a9d78750bd09 Mon Sep 17 00:00:00 2001 From: xiao-77 Date: Tue, 29 Oct 2024 19:21:59 +0800 Subject: [PATCH 409/695] set case tmqVnodeTransform-stb-removewal.py's sync debug flag to 143 --- tests/system-test/7-tmq/tmqVnodeTransform-stb-removewal.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/system-test/7-tmq/tmqVnodeTransform-stb-removewal.py b/tests/system-test/7-tmq/tmqVnodeTransform-stb-removewal.py index 40879d5c661e..938dcfcc9e28 100644 --- a/tests/system-test/7-tmq/tmqVnodeTransform-stb-removewal.py +++ b/tests/system-test/7-tmq/tmqVnodeTransform-stb-removewal.py @@ -17,6 +17,8 @@ from tmqCommon import * class TDTestCase: + + updatecfgDict = {'sDebugFlag':143} def __init__(self): self.vgroups = 1 self.ctbNum = 10 From 71f4ae695720e108c20bcf6513d15e5199f7aa9c Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Tue, 29 Oct 2024 19:48:17 +0800 Subject: [PATCH 410/695] fix(stream): adjust refId init position. --- source/libs/stream/src/streamMeta.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/source/libs/stream/src/streamMeta.c b/source/libs/stream/src/streamMeta.c index 064098ed35f0..bc7878f7618a 100644 --- a/source/libs/stream/src/streamMeta.c +++ b/source/libs/stream/src/streamMeta.c @@ -451,13 +451,6 @@ int32_t streamMetaOpen(const char* path, void* ahandle, FTaskBuild buildTaskFn, code = taosThreadRwlockAttrDestroy(&attr); TSDB_CHECK_CODE(code, lino, _err); - int64_t* pRid = taosMemoryMalloc(sizeof(int64_t)); - TSDB_CHECK_NULL(pRid, code, lino, _err, terrno); - - memcpy(pRid, &pMeta->rid, sizeof(pMeta->rid)); - code = metaRefMgtAdd(pMeta->vgId, pRid); - TSDB_CHECK_CODE(code, lino, _err); - code = bkdMgtCreate(tpath, (SBkdMgt**)&pMeta->bkdChkptMgt); TSDB_CHECK_CODE(code, lino, _err); @@ -466,6 +459,15 @@ int32_t streamMetaOpen(const char* path, void* ahandle, FTaskBuild buildTaskFn, // add refId at the end of initialization function pMeta->rid = taosAddRef(streamMetaId, pMeta); + + int64_t* pRid = taosMemoryMalloc(sizeof(int64_t)); + TSDB_CHECK_NULL(pRid, code, lino, _err, terrno); + + memcpy(pRid, &pMeta->rid, sizeof(pMeta->rid)); + + code = metaRefMgtAdd(pMeta->vgId, pRid); + TSDB_CHECK_CODE(code, lino, _err); + code = createMetaHbInfo(pRid, &pMeta->pHbInfo); TSDB_CHECK_CODE(code, lino, _err); From c6c23271c73d908d8d8b2e3feadf51770d2d85da Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Tue, 29 Oct 2024 19:48:17 +0800 Subject: [PATCH 411/695] fix(stream): adjust refId init position. --- source/libs/stream/src/streamMeta.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/source/libs/stream/src/streamMeta.c b/source/libs/stream/src/streamMeta.c index 064098ed35f0..bc7878f7618a 100644 --- a/source/libs/stream/src/streamMeta.c +++ b/source/libs/stream/src/streamMeta.c @@ -451,13 +451,6 @@ int32_t streamMetaOpen(const char* path, void* ahandle, FTaskBuild buildTaskFn, code = taosThreadRwlockAttrDestroy(&attr); TSDB_CHECK_CODE(code, lino, _err); - int64_t* pRid = taosMemoryMalloc(sizeof(int64_t)); - TSDB_CHECK_NULL(pRid, code, lino, _err, terrno); - - memcpy(pRid, &pMeta->rid, sizeof(pMeta->rid)); - code = metaRefMgtAdd(pMeta->vgId, pRid); - TSDB_CHECK_CODE(code, lino, _err); - code = bkdMgtCreate(tpath, (SBkdMgt**)&pMeta->bkdChkptMgt); TSDB_CHECK_CODE(code, lino, _err); @@ -466,6 +459,15 @@ int32_t streamMetaOpen(const char* path, void* ahandle, FTaskBuild buildTaskFn, // add refId at the end of initialization function pMeta->rid = taosAddRef(streamMetaId, pMeta); + + int64_t* pRid = taosMemoryMalloc(sizeof(int64_t)); + TSDB_CHECK_NULL(pRid, code, lino, _err, terrno); + + memcpy(pRid, &pMeta->rid, sizeof(pMeta->rid)); + + code = metaRefMgtAdd(pMeta->vgId, pRid); + TSDB_CHECK_CODE(code, lino, _err); + code = createMetaHbInfo(pRid, &pMeta->pHbInfo); TSDB_CHECK_CODE(code, lino, _err); From 694e7577703a5d5e23c1d2f3ddcef09dc48c86a6 Mon Sep 17 00:00:00 2001 From: xsren <285808407@qq.com> Date: Tue, 29 Oct 2024 19:50:21 +0800 Subject: [PATCH 412/695] fix: coldata set val --- source/common/src/tdatablock.c | 35 +++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c index 3187d2315a96..c185ac9d8624 100644 --- a/source/common/src/tdatablock.c +++ b/source/common/src/tdatablock.c @@ -87,6 +87,16 @@ int32_t getJsonValueLen(const char* data) { return dataLen; } +static int32_t getDataLen(int32_t type, const char* pData) { + int32_t dataLen = 0; + if (type == TSDB_DATA_TYPE_JSON) { + dataLen = getJsonValueLen(pData); + } else { + dataLen = varDataTLen(pData); + } + return dataLen; +} + int32_t colDataSetVal(SColumnInfoData* pColumnInfoData, uint32_t rowIndex, const char* pData, bool isNull) { if (isNull || pData == NULL) { // There is a placehold for each NULL value of binary or nchar type. @@ -102,19 +112,18 @@ int32_t colDataSetVal(SColumnInfoData* pColumnInfoData, uint32_t rowIndex, const int32_t type = pColumnInfoData->info.type; if (IS_VAR_DATA_TYPE(type)) { - int32_t dataLen = 0; - if (type == TSDB_DATA_TYPE_JSON) { - dataLen = getJsonValueLen(pData); - } else { - dataLen = varDataTLen(pData); - } - - if(rowIndex == 0 && pColumnInfoData->varmeta.length > 0) { - return 0; - } - if (pColumnInfoData->varmeta.offset[rowIndex] > 0 && - pColumnInfoData->varmeta.offset[rowIndex] < pColumnInfoData->varmeta.length) { - return 0; + int32_t dataLen = getDataLen(type, pData); + if (pColumnInfoData->varmeta.offset[rowIndex] > 0) { + if (rowIndex == 0) { + pColumnInfoData->varmeta.length = 0; + } else { + int32_t start = pColumnInfoData->varmeta.offset[rowIndex - 1]; + int32_t lastDataLen = getDataLen(type, pColumnInfoData->pData + start); + if (start + lastDataLen < pColumnInfoData->varmeta.length) { + uInfo("column data is reassigned, row:%d, offset:%d, length:%d", rowIndex, start, lastDataLen); + pColumnInfoData->varmeta.length = start + lastDataLen; + } + } } SVarColAttr* pAttr = &pColumnInfoData->varmeta; From 6690a9ec84a80d146da41e5f594bc64d7b085e27 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Tue, 29 Oct 2024 21:24:27 +0800 Subject: [PATCH 413/695] feat: remove alter db options --- include/common/tmsg.h | 1 - source/common/src/tmsg.c | 5 - source/dnode/mnode/impl/src/mndDb.c | 25 +- source/dnode/mnode/impl/src/mndVgroup.c | 2 +- source/libs/parser/inc/sql.y | 1 - source/libs/parser/src/parTranslater.c | 1 - source/libs/parser/src/sql.c | 8503 ++++++++++------------- 7 files changed, 3528 insertions(+), 5010 deletions(-) diff --git a/include/common/tmsg.h b/include/common/tmsg.h index 8bba723bf1c3..d14facec259d 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -1369,7 +1369,6 @@ typedef struct { int32_t sqlLen; char* sql; int8_t withArbitrator; - char dnodeListStr[TSDB_DNODE_LIST_LEN]; } SAlterDbReq; int32_t tSerializeSAlterDbReq(void* buf, int32_t bufLen, SAlterDbReq* pReq); diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index 3cc8ea4250b6..62583fd77768 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -4017,7 +4017,6 @@ int32_t tSerializeSAlterDbReq(void *buf, int32_t bufLen, SAlterDbReq *pReq) { ENCODESQL(); TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->withArbitrator)); - TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->dnodeListStr)); tEndEncode(&encoder); @@ -4087,10 +4086,6 @@ int32_t tDeserializeSAlterDbReq(void *buf, int32_t bufLen, SAlterDbReq *pReq) { TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->withArbitrator)); } - if (!tDecodeIsEnd(&decoder)) { - TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->dnodeListStr)); - } - tEndDecode(&decoder); _exit: diff --git a/source/dnode/mnode/impl/src/mndDb.c b/source/dnode/mnode/impl/src/mndDb.c index f01f6b0a6f91..e8c49d9ffabe 100644 --- a/source/dnode/mnode/impl/src/mndDb.c +++ b/source/dnode/mnode/impl/src/mndDb.c @@ -462,8 +462,8 @@ static int32_t mndCheckDbCfg(SMnode *pMnode, SDbCfg *pCfg) { if (pCfg->cacheLast < TSDB_CACHE_MODEL_NONE || pCfg->cacheLast > TSDB_CACHE_MODEL_BOTH) return code; if (pCfg->hashMethod != 1) return code; if (pCfg->replications > mndGetDnodeSize(pMnode)) { - terrno = TSDB_CODE_MND_NO_ENOUGH_DNODES; - return code; + code = TSDB_CODE_MND_NO_ENOUGH_DNODES; + TAOS_RETURN(code); } if (pCfg->walRetentionPeriod < TSDB_DB_MIN_WAL_RETENTION_PERIOD) return code; if (pCfg->walRetentionSize < TSDB_DB_MIN_WAL_RETENTION_SIZE) return code; @@ -1226,13 +1226,12 @@ static int32_t mndSetAlterDbCommitLogs(SMnode *pMnode, STrans *pTrans, SDbObj *p TAOS_RETURN(code); } -static int32_t mndSetAlterDbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj *pOldDb, SDbObj *pNewDb, - SArray *dnodeList) { +static int32_t mndSetAlterDbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj *pOldDb, SDbObj *pNewDb) { int32_t code = 0, lino = 0; SSdb *pSdb = pMnode->pSdb; void *pIter = NULL; SVgObj *pVgroup = NULL; - SArray *pArray = mndBuildDnodesArray(pMnode, 0, dnodeList); + SArray *pArray = mndBuildDnodesArray(pMnode, 0, NULL); while (1) { pIter = sdbFetch(pSdb, SDB_VGROUP, pIter, (void **)&pVgroup); @@ -1271,7 +1270,7 @@ static int32_t mndSetAlterDbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj * TAOS_RETURN(code); } -static int32_t mndAlterDb(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pOld, SDbObj *pNew, SArray *dnodeList) { +static int32_t mndAlterDb(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pOld, SDbObj *pNew) { int32_t code = -1; STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB, pReq, "alter-db"); if (pTrans == NULL) { @@ -1286,7 +1285,7 @@ static int32_t mndAlterDb(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pOld, SDbObj *p TAOS_CHECK_GOTO(mndSetAlterDbPrepareLogs(pMnode, pTrans, pOld, pNew), NULL, _OVER); TAOS_CHECK_GOTO(mndSetAlterDbCommitLogs(pMnode, pTrans, pOld, pNew), NULL, _OVER); - TAOS_CHECK_GOTO(mndSetAlterDbRedoActions(pMnode, pTrans, pOld, pNew, dnodeList), NULL, _OVER); + TAOS_CHECK_GOTO(mndSetAlterDbRedoActions(pMnode, pTrans, pOld, pNew), NULL, _OVER); TAOS_CHECK_GOTO(mndTransPrepare(pMnode, pTrans), NULL, _OVER); code = 0; @@ -1301,13 +1300,6 @@ static int32_t mndProcessAlterDbReq(SRpcMsg *pReq) { SDbObj *pDb = NULL; SAlterDbReq alterReq = {0}; SDbObj dbObj = {0}; - SArray *dnodeList = NULL; - - dnodeList = taosArrayInit(mndGetDnodeSize(pMnode), sizeof(int32_t)); - if (dnodeList == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; - goto _OVER; - } TAOS_CHECK_GOTO(tDeserializeSAlterDbReq(pReq->pCont, pReq->contLen, &alterReq), NULL, _OVER); @@ -1350,11 +1342,9 @@ static int32_t mndProcessAlterDbReq(SRpcMsg *pReq) { TAOS_CHECK_GOTO(mndCheckInChangeDbCfg(pMnode, &pDb->cfg, &dbObj.cfg), NULL, _OVER); - TAOS_CHECK_GOTO(mndCheckDbDnodeList(pMnode, alterReq.db, alterReq.dnodeListStr, dnodeList), NULL, _OVER); - dbObj.cfgVersion++; dbObj.updateTime = taosGetTimestampMs(); - code = mndAlterDb(pMnode, pReq, pDb, &dbObj, dnodeList); + code = mndAlterDb(pMnode, pReq, pDb, &dbObj); if (dbObj.cfg.replications != pDb->cfg.replications) { // return quickly, operation executed asynchronously @@ -1378,7 +1368,6 @@ static int32_t mndProcessAlterDbReq(SRpcMsg *pReq) { mndReleaseDb(pMnode, pDb); taosArrayDestroy(dbObj.cfg.pRetensions); tFreeSAlterDbReq(&alterReq); - taosArrayDestroy(dnodeList); TAOS_RETURN(code); } diff --git a/source/dnode/mnode/impl/src/mndVgroup.c b/source/dnode/mnode/impl/src/mndVgroup.c index d8208a2d736b..ddf42e0a59cf 100644 --- a/source/dnode/mnode/impl/src/mndVgroup.c +++ b/source/dnode/mnode/impl/src/mndVgroup.c @@ -727,7 +727,7 @@ static bool mndBuildDnodesArrayFp(SMnode *pMnode, void *pObj, void *p1, void *p2 bool inDnodeList = false; for (int32_t index = 0; index < taosArrayGetSize(dnodeList); ++index) { int32_t dnodeId = *(int32_t *)taosArrayGet(dnodeList, index); - if (pDnode->id) { + if (pDnode->id == dnodeId) { inDnodeList = true; } } diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index a9b965b4fa51..635e9f570f71 100644 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -322,7 +322,6 @@ alter_db_option(A) ::= S3_KEEPLOCAL NK_VARIABLE(B). alter_db_option(A) ::= S3_COMPACT NK_INTEGER(B). { A.type = DB_OPTION_S3_COMPACT, A.val = B; } alter_db_option(A) ::= KEEP_TIME_OFFSET NK_INTEGER(B). { A.type = DB_OPTION_KEEP_TIME_OFFSET; A.val = B; } alter_db_option(A) ::= ENCRYPT_ALGORITHM NK_STRING(B). { A.type = DB_OPTION_ENCRYPT_ALGORITHM; A.val = B; } -alter_db_option(A) ::= DNODES NK_STRING(B). { A.type = DB_OPTION_DNODES; A.val = B; } %type integer_list { SNodeList* } %destructor integer_list { nodesDestroyList($$); } diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index d6a62b238320..67ffde66acde 100755 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -8240,7 +8240,6 @@ static int32_t buildAlterDbReq(STranslateContext* pCxt, SAlterDatabaseStmt* pStm pReq->s3KeepLocal = pStmt->pOptions->s3KeepLocal; pReq->s3Compact = pStmt->pOptions->s3Compact; pReq->withArbitrator = pStmt->pOptions->withArbitrator; - tstrncpy(pReq->dnodeListStr, pStmt->pOptions->dnodeListStr, TSDB_DNODE_LIST_LEN); return code; } diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c index 9ddf50f7aaf0..a352b237b6fe 100644 --- a/source/libs/parser/src/sql.c +++ b/source/libs/parser/src/sql.c @@ -1,5 +1,3 @@ -/* This file is automatically generated by Lemon from input grammar -** source file "sql.y". */ /* ** 2000-05-29 ** @@ -24,8 +22,9 @@ ** The following is the concatenation of all %include directives from the ** input grammar file: */ +#include +#include /************ Begin %include sections from the grammar ************************/ -#line 11 "sql.y" #include #include @@ -42,401 +41,12 @@ #include "parAst.h" #define YYSTACKDEPTH 0 -#line 46 "sql.c" /**************** End of %include directives **********************************/ -/* These constants specify the various numeric values for terminal symbols. -***************** Begin token definitions *************************************/ -#ifndef TK_OR -#define TK_OR 1 -#define TK_AND 2 -#define TK_UNION 3 -#define TK_ALL 4 -#define TK_MINUS 5 -#define TK_EXCEPT 6 -#define TK_INTERSECT 7 -#define TK_NK_BITAND 8 -#define TK_NK_BITOR 9 -#define TK_NK_LSHIFT 10 -#define TK_NK_RSHIFT 11 -#define TK_NK_PLUS 12 -#define TK_NK_MINUS 13 -#define TK_NK_STAR 14 -#define TK_NK_SLASH 15 -#define TK_NK_REM 16 -#define TK_NK_CONCAT 17 -#define TK_CREATE 18 -#define TK_ACCOUNT 19 -#define TK_NK_ID 20 -#define TK_PASS 21 -#define TK_NK_STRING 22 -#define TK_ALTER 23 -#define TK_PPS 24 -#define TK_TSERIES 25 -#define TK_STORAGE 26 -#define TK_STREAMS 27 -#define TK_QTIME 28 -#define TK_DBS 29 -#define TK_USERS 30 -#define TK_CONNS 31 -#define TK_STATE 32 -#define TK_NK_COMMA 33 -#define TK_HOST 34 -#define TK_IS_IMPORT 35 -#define TK_NK_INTEGER 36 -#define TK_CREATEDB 37 -#define TK_USER 38 -#define TK_ENABLE 39 -#define TK_SYSINFO 40 -#define TK_ADD 41 -#define TK_DROP 42 -#define TK_GRANT 43 -#define TK_ON 44 -#define TK_TO 45 -#define TK_REVOKE 46 -#define TK_FROM 47 -#define TK_SUBSCRIBE 48 -#define TK_READ 49 -#define TK_WRITE 50 -#define TK_NK_DOT 51 -#define TK_WITH 52 -#define TK_ENCRYPT_KEY 53 -#define TK_ANODE 54 -#define TK_UPDATE 55 -#define TK_ANODES 56 -#define TK_DNODE 57 -#define TK_PORT 58 -#define TK_DNODES 59 -#define TK_RESTORE 60 -#define TK_NK_IPTOKEN 61 -#define TK_FORCE 62 -#define TK_UNSAFE 63 -#define TK_CLUSTER 64 -#define TK_LOCAL 65 -#define TK_QNODE 66 -#define TK_BNODE 67 -#define TK_SNODE 68 -#define TK_MNODE 69 -#define TK_VNODE 70 -#define TK_DATABASE 71 -#define TK_USE 72 -#define TK_FLUSH 73 -#define TK_TRIM 74 -#define TK_S3MIGRATE 75 -#define TK_COMPACT 76 -#define TK_IF 77 -#define TK_NOT 78 -#define TK_EXISTS 79 -#define TK_BUFFER 80 -#define TK_CACHEMODEL 81 -#define TK_CACHESIZE 82 -#define TK_COMP 83 -#define TK_DURATION 84 -#define TK_NK_VARIABLE 85 -#define TK_MAXROWS 86 -#define TK_MINROWS 87 -#define TK_KEEP 88 -#define TK_PAGES 89 -#define TK_PAGESIZE 90 -#define TK_TSDB_PAGESIZE 91 -#define TK_PRECISION 92 -#define TK_REPLICA 93 -#define TK_VGROUPS 94 -#define TK_SINGLE_STABLE 95 -#define TK_RETENTIONS 96 -#define TK_SCHEMALESS 97 -#define TK_WAL_LEVEL 98 -#define TK_WAL_FSYNC_PERIOD 99 -#define TK_WAL_RETENTION_PERIOD 100 -#define TK_WAL_RETENTION_SIZE 101 -#define TK_WAL_ROLL_PERIOD 102 -#define TK_WAL_SEGMENT_SIZE 103 -#define TK_STT_TRIGGER 104 -#define TK_TABLE_PREFIX 105 -#define TK_TABLE_SUFFIX 106 -#define TK_S3_CHUNKPAGES 107 -#define TK_S3_KEEPLOCAL 108 -#define TK_S3_COMPACT 109 -#define TK_KEEP_TIME_OFFSET 110 -#define TK_ENCRYPT_ALGORITHM 111 -#define TK_NK_COLON 112 -#define TK_BWLIMIT 113 -#define TK_START 114 -#define TK_TIMESTAMP 115 -#define TK_END 116 -#define TK_TABLE 117 -#define TK_NK_LP 118 -#define TK_NK_RP 119 -#define TK_USING 120 -#define TK_FILE 121 -#define TK_STABLE 122 -#define TK_COLUMN 123 -#define TK_MODIFY 124 -#define TK_RENAME 125 -#define TK_TAG 126 -#define TK_SET 127 -#define TK_NK_EQ 128 -#define TK_TAGS 129 -#define TK_BOOL 130 -#define TK_TINYINT 131 -#define TK_SMALLINT 132 -#define TK_INT 133 -#define TK_INTEGER 134 -#define TK_BIGINT 135 -#define TK_FLOAT 136 -#define TK_DOUBLE 137 -#define TK_BINARY 138 -#define TK_NCHAR 139 -#define TK_UNSIGNED 140 -#define TK_JSON 141 -#define TK_VARCHAR 142 -#define TK_MEDIUMBLOB 143 -#define TK_BLOB 144 -#define TK_VARBINARY 145 -#define TK_GEOMETRY 146 -#define TK_DECIMAL 147 -#define TK_COMMENT 148 -#define TK_MAX_DELAY 149 -#define TK_WATERMARK 150 -#define TK_ROLLUP 151 -#define TK_TTL 152 -#define TK_SMA 153 -#define TK_DELETE_MARK 154 -#define TK_FIRST 155 -#define TK_LAST 156 -#define TK_SHOW 157 -#define TK_FULL 158 -#define TK_PRIVILEGES 159 -#define TK_DATABASES 160 -#define TK_TABLES 161 -#define TK_STABLES 162 -#define TK_MNODES 163 -#define TK_QNODES 164 -#define TK_ARBGROUPS 165 -#define TK_FUNCTIONS 166 -#define TK_INDEXES 167 -#define TK_ACCOUNTS 168 -#define TK_APPS 169 -#define TK_CONNECTIONS 170 -#define TK_LICENCES 171 -#define TK_GRANTS 172 -#define TK_LOGS 173 -#define TK_MACHINES 174 -#define TK_ENCRYPTIONS 175 -#define TK_QUERIES 176 -#define TK_SCORES 177 -#define TK_TOPICS 178 -#define TK_VARIABLES 179 -#define TK_BNODES 180 -#define TK_SNODES 181 -#define TK_TRANSACTIONS 182 -#define TK_DISTRIBUTED 183 -#define TK_CONSUMERS 184 -#define TK_SUBSCRIPTIONS 185 -#define TK_VNODES 186 -#define TK_ALIVE 187 -#define TK_VIEWS 188 -#define TK_VIEW 189 -#define TK_COMPACTS 190 -#define TK_NORMAL 191 -#define TK_CHILD 192 -#define TK_LIKE 193 -#define TK_TBNAME 194 -#define TK_QTAGS 195 -#define TK_AS 196 -#define TK_SYSTEM 197 -#define TK_TSMA 198 -#define TK_INTERVAL 199 -#define TK_RECURSIVE 200 -#define TK_TSMAS 201 -#define TK_FUNCTION 202 -#define TK_INDEX 203 -#define TK_COUNT 204 -#define TK_LAST_ROW 205 -#define TK_META 206 -#define TK_ONLY 207 -#define TK_TOPIC 208 -#define TK_CONSUMER 209 -#define TK_GROUP 210 -#define TK_DESC 211 -#define TK_DESCRIBE 212 -#define TK_RESET 213 -#define TK_QUERY 214 -#define TK_CACHE 215 -#define TK_EXPLAIN 216 -#define TK_ANALYZE 217 -#define TK_VERBOSE 218 -#define TK_NK_BOOL 219 -#define TK_RATIO 220 -#define TK_NK_FLOAT 221 -#define TK_OUTPUTTYPE 222 -#define TK_AGGREGATE 223 -#define TK_BUFSIZE 224 -#define TK_LANGUAGE 225 -#define TK_REPLACE 226 -#define TK_STREAM 227 -#define TK_INTO 228 -#define TK_PAUSE 229 -#define TK_RESUME 230 -#define TK_PRIMARY 231 -#define TK_KEY 232 -#define TK_TRIGGER 233 -#define TK_AT_ONCE 234 -#define TK_WINDOW_CLOSE 235 -#define TK_IGNORE 236 -#define TK_EXPIRED 237 -#define TK_FILL_HISTORY 238 -#define TK_SUBTABLE 239 -#define TK_UNTREATED 240 -#define TK_KILL 241 -#define TK_CONNECTION 242 -#define TK_TRANSACTION 243 -#define TK_BALANCE 244 -#define TK_VGROUP 245 -#define TK_LEADER 246 -#define TK_MERGE 247 -#define TK_REDISTRIBUTE 248 -#define TK_SPLIT 249 -#define TK_DELETE 250 -#define TK_INSERT 251 -#define TK_NK_BIN 252 -#define TK_NK_HEX 253 -#define TK_NULL 254 -#define TK_NK_QUESTION 255 -#define TK_NK_ALIAS 256 -#define TK_NK_ARROW 257 -#define TK_ROWTS 258 -#define TK_QSTART 259 -#define TK_QEND 260 -#define TK_QDURATION 261 -#define TK_WSTART 262 -#define TK_WEND 263 -#define TK_WDURATION 264 -#define TK_IROWTS 265 -#define TK_ISFILLED 266 -#define TK_FLOW 267 -#define TK_FHIGH 268 -#define TK_FROWTS 269 -#define TK_CAST 270 -#define TK_POSITION 271 -#define TK_IN 272 -#define TK_FOR 273 -#define TK_NOW 274 -#define TK_TODAY 275 -#define TK_RAND 276 -#define TK_SUBSTR 277 -#define TK_SUBSTRING 278 -#define TK_BOTH 279 -#define TK_TRAILING 280 -#define TK_LEADING 281 -#define TK_TIMEZONE 282 -#define TK_CLIENT_VERSION 283 -#define TK_SERVER_VERSION 284 -#define TK_SERVER_STATUS 285 -#define TK_CURRENT_USER 286 -#define TK_PI 287 -#define TK_CASE 288 -#define TK_WHEN 289 -#define TK_THEN 290 -#define TK_ELSE 291 -#define TK_BETWEEN 292 -#define TK_IS 293 -#define TK_NK_LT 294 -#define TK_NK_GT 295 -#define TK_NK_LE 296 -#define TK_NK_GE 297 -#define TK_NK_NE 298 -#define TK_MATCH 299 -#define TK_NMATCH 300 -#define TK_CONTAINS 301 -#define TK_JOIN 302 -#define TK_INNER 303 -#define TK_LEFT 304 -#define TK_RIGHT 305 -#define TK_OUTER 306 -#define TK_SEMI 307 -#define TK_ANTI 308 -#define TK_ASOF 309 -#define TK_WINDOW 310 -#define TK_WINDOW_OFFSET 311 -#define TK_JLIMIT 312 -#define TK_SELECT 313 -#define TK_NK_HINT 314 -#define TK_DISTINCT 315 -#define TK_WHERE 316 -#define TK_PARTITION 317 -#define TK_BY 318 -#define TK_SESSION 319 -#define TK_STATE_WINDOW 320 -#define TK_EVENT_WINDOW 321 -#define TK_COUNT_WINDOW 322 -#define TK_ANOMALY_WINDOW 323 -#define TK_SLIDING 324 -#define TK_FILL 325 -#define TK_VALUE 326 -#define TK_VALUE_F 327 -#define TK_NONE 328 -#define TK_PREV 329 -#define TK_NULL_F 330 -#define TK_LINEAR 331 -#define TK_NEXT 332 -#define TK_HAVING 333 -#define TK_RANGE 334 -#define TK_EVERY 335 -#define TK_ORDER 336 -#define TK_SLIMIT 337 -#define TK_SOFFSET 338 -#define TK_LIMIT 339 -#define TK_OFFSET 340 -#define TK_ASC 341 -#define TK_NULLS 342 -#define TK_ABORT 343 -#define TK_AFTER 344 -#define TK_ATTACH 345 -#define TK_BEFORE 346 -#define TK_BEGIN 347 -#define TK_BITAND 348 -#define TK_BITNOT 349 -#define TK_BITOR 350 -#define TK_BLOCKS 351 -#define TK_CHANGE 352 -#define TK_COMMA 353 -#define TK_CONCAT 354 -#define TK_CONFLICT 355 -#define TK_COPY 356 -#define TK_DEFERRED 357 -#define TK_DELIMITERS 358 -#define TK_DETACH 359 -#define TK_DIVIDE 360 -#define TK_DOT 361 -#define TK_EACH 362 -#define TK_FAIL 363 -#define TK_GLOB 364 -#define TK_ID 365 -#define TK_IMMEDIATE 366 -#define TK_IMPORT 367 -#define TK_INITIALLY 368 -#define TK_INSTEAD 369 -#define TK_ISNULL 370 -#define TK_MODULES 371 -#define TK_NK_BITNOT 372 -#define TK_NK_SEMI 373 -#define TK_NOTNULL 374 -#define TK_OF 375 -#define TK_PLUS 376 -#define TK_PRIVILEGE 377 -#define TK_RAISE 378 -#define TK_RESTRICT 379 -#define TK_ROW 380 -#define TK_STAR 381 -#define TK_STATEMENT 382 -#define TK_STRICT 383 -#define TK_STRING 384 -#define TK_TIMES 385 -#define TK_VALUES 386 -#define TK_VARIABLE 387 -#define TK_WAL 388 -#endif -/**************** End token definitions ***************************************/ +/* These constants specify the various numeric values for terminal symbols +** in a format understandable to "makeheaders". This section is blank unless +** "lemon" is run with the "-m" command-line option. +***************** Begin makeheaders token definitions *************************/ +/**************** End makeheaders token definitions ***************************/ /* The next sections is a series of control #defines. ** various aspects of the generated parser. @@ -534,18 +144,18 @@ typedef union { #define ParseCTX_FETCH #define ParseCTX_STORE #define YYFALLBACK 1 -#define YYNSTATE 1025 -#define YYNRULE 784 -#define YYNRULE_WITH_ACTION 784 +#define YYNSTATE 1026 +#define YYNRULE 785 +#define YYNRULE_WITH_ACTION 785 #define YYNTOKEN 389 -#define YY_MAX_SHIFT 1024 -#define YY_MIN_SHIFTREDUCE 1516 -#define YY_MAX_SHIFTREDUCE 2299 -#define YY_ERROR_ACTION 2300 -#define YY_ACCEPT_ACTION 2301 -#define YY_NO_ACTION 2302 -#define YY_MIN_REDUCE 2303 -#define YY_MAX_REDUCE 3086 +#define YY_MAX_SHIFT 1025 +#define YY_MIN_SHIFTREDUCE 1518 +#define YY_MAX_SHIFTREDUCE 2302 +#define YY_ERROR_ACTION 2303 +#define YY_ACCEPT_ACTION 2304 +#define YY_NO_ACTION 2305 +#define YY_MIN_REDUCE 2306 +#define YY_MAX_REDUCE 3090 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -614,753 +224,753 @@ typedef union { *********** Begin parsing tables **********************************************/ #define YY_ACTTAB_COUNT (4475) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 839, 683, 3059, 691, 684, 2351, 684, 2351, 3054, 2577, - /* 10 */ 3054, 2816, 60, 58, 678, 59, 57, 56, 55, 54, - /* 20 */ 506, 2304, 2016, 2521, 915, 2517, 838, 231, 858, 3058, - /* 30 */ 2816, 3055, 840, 3055, 3057, 205, 2014, 332, 2124, 2399, - /* 40 */ 2041, 2820, 151, 2841, 530, 150, 149, 148, 147, 146, - /* 50 */ 145, 144, 143, 142, 914, 851, 170, 466, 854, 389, - /* 60 */ 2820, 53, 52, 220, 680, 59, 57, 56, 55, 54, - /* 70 */ 2303, 2119, 151, 2045, 884, 150, 149, 148, 147, 146, - /* 80 */ 145, 144, 143, 142, 782, 2022, 2041, 2674, 2859, 829, - /* 90 */ 2647, 2822, 2824, 501, 160, 159, 158, 157, 156, 155, - /* 100 */ 154, 153, 152, 688, 2806, 919, 896, 2672, 901, 685, - /* 110 */ 2822, 2825, 1592, 2759, 1591, 1021, 851, 170, 61, 990, - /* 120 */ 989, 988, 987, 536, 919, 986, 985, 175, 980, 979, - /* 130 */ 978, 977, 976, 975, 974, 174, 968, 967, 966, 535, - /* 140 */ 534, 963, 962, 961, 211, 210, 960, 531, 959, 958, - /* 150 */ 957, 2840, 63, 1593, 2891, 2127, 2128, 197, 134, 2842, - /* 160 */ 900, 2844, 2845, 895, 75, 2448, 883, 2892, 919, 2041, - /* 170 */ 802, 772, 1592, 213, 1591, 2954, 2042, 251, 3054, 500, - /* 180 */ 2950, 207, 2962, 850, 75, 162, 849, 766, 166, 770, - /* 190 */ 768, 303, 302, 3054, 2077, 2087, 3060, 231, 198, 232, - /* 200 */ 2315, 3055, 840, 3059, 2126, 2129, 528, 3001, 509, 2570, - /* 210 */ 2572, 838, 231, 1593, 1862, 1863, 3055, 840, 195, 2017, - /* 220 */ 2044, 2015, 824, 107, 914, 9, 882, 2220, 106, 2522, - /* 230 */ 53, 52, 914, 2041, 59, 57, 56, 55, 54, 676, - /* 240 */ 64, 853, 200, 2962, 2963, 2213, 168, 2967, 674, 227, - /* 250 */ 318, 670, 666, 581, 2020, 2021, 2074, 2841, 2076, 2079, - /* 260 */ 2080, 2081, 2082, 2083, 2084, 2085, 2086, 2088, 2089, 2090, - /* 270 */ 892, 885, 894, 914, 917, 916, 881, 2111, 2112, 2113, - /* 280 */ 2114, 2115, 2118, 2120, 2121, 2122, 2123, 2125, 2, 60, - /* 290 */ 58, 2216, 700, 2841, 445, 105, 2039, 506, 75, 2016, - /* 300 */ 458, 118, 2859, 625, 644, 642, 469, 441, 897, 2046, - /* 310 */ 245, 1889, 1890, 2014, 646, 2124, 915, 2517, 2806, 2286, - /* 320 */ 896, 2616, 53, 52, 127, 2074, 59, 57, 56, 55, - /* 330 */ 54, 510, 468, 604, 2599, 648, 236, 220, 2859, 2191, - /* 340 */ 446, 606, 830, 825, 818, 814, 810, 339, 2119, 2674, - /* 350 */ 2154, 884, 584, 785, 2806, 19, 896, 701, 2667, 339, - /* 360 */ 1888, 1891, 2022, 498, 2647, 2840, 2042, 2326, 2891, 2671, - /* 370 */ 901, 63, 436, 2842, 900, 2844, 2845, 895, 893, 339, - /* 380 */ 883, 2892, 919, 874, 2919, 954, 187, 186, 951, 950, - /* 390 */ 949, 184, 1021, 467, 973, 15, 337, 2474, 572, 2044, - /* 400 */ 571, 2840, 2251, 887, 2891, 592, 2674, 2078, 134, 2842, - /* 410 */ 900, 2844, 2845, 895, 886, 2155, 883, 2892, 919, 922, - /* 420 */ 508, 172, 224, 181, 2925, 2954, 2671, 901, 2806, 500, - /* 430 */ 2950, 570, 2127, 2128, 801, 339, 2654, 2633, 2564, 634, - /* 440 */ 633, 631, 630, 629, 624, 623, 622, 621, 450, 590, - /* 450 */ 2643, 611, 610, 609, 608, 607, 601, 600, 599, 267, - /* 460 */ 594, 593, 465, 686, 699, 2359, 585, 1850, 1851, 2075, - /* 470 */ 220, 2077, 2087, 1869, 821, 820, 2249, 2250, 2252, 2253, - /* 480 */ 2254, 2126, 2129, 2974, 2188, 2189, 2190, 2974, 2974, 2974, - /* 490 */ 2974, 2974, 620, 339, 2160, 618, 2017, 2648, 2015, 41, - /* 500 */ 617, 1786, 1787, 882, 247, 53, 52, 619, 616, 59, - /* 510 */ 57, 56, 55, 54, 44, 502, 2149, 2150, 2151, 2152, - /* 520 */ 2153, 2157, 2158, 2159, 79, 2293, 2193, 2194, 2195, 2196, - /* 530 */ 2197, 2020, 2021, 2074, 2841, 2076, 2079, 2080, 2081, 2082, - /* 540 */ 2083, 2084, 2085, 2086, 2088, 2089, 2090, 892, 885, 854, - /* 550 */ 3059, 917, 916, 881, 2111, 2112, 2212, 786, 3054, 2118, - /* 560 */ 2120, 2121, 2122, 2123, 2125, 2, 60, 58, 2841, 2191, - /* 570 */ 2016, 828, 533, 532, 506, 337, 2016, 3058, 73, 2859, - /* 580 */ 2577, 3055, 3056, 897, 2014, 2135, 45, 355, 1747, 799, - /* 590 */ 2014, 2041, 2124, 702, 269, 2806, 2023, 896, 686, 866, - /* 600 */ 2359, 2859, 1561, 1738, 946, 945, 944, 1742, 943, 1744, - /* 610 */ 1745, 942, 939, 2859, 1753, 936, 1755, 1756, 933, 930, - /* 620 */ 927, 1568, 2499, 473, 786, 2119, 195, 2969, 884, 2806, - /* 630 */ 923, 896, 19, 2022, 137, 596, 2643, 2523, 75, 2022, - /* 640 */ 693, 2713, 2840, 526, 2519, 2891, 1563, 1566, 1567, 134, - /* 650 */ 2842, 900, 2844, 2845, 895, 2292, 2966, 883, 2892, 919, - /* 660 */ 915, 2517, 706, 1021, 213, 196, 2954, 725, 724, 1021, - /* 670 */ 500, 2950, 15, 827, 526, 2519, 2840, 915, 2517, 2891, - /* 680 */ 161, 2841, 2045, 135, 2842, 900, 2844, 2845, 895, 731, - /* 690 */ 249, 883, 2892, 919, 487, 2721, 897, 161, 3002, 2489, - /* 700 */ 2954, 56, 55, 54, 2953, 2950, 736, 788, 2713, 2127, - /* 710 */ 2128, 627, 2643, 2974, 2188, 2189, 2190, 2974, 2974, 2974, - /* 720 */ 2974, 2974, 518, 53, 52, 956, 2859, 59, 57, 56, - /* 730 */ 55, 54, 752, 751, 750, 851, 170, 14, 13, 742, - /* 740 */ 167, 746, 2806, 783, 896, 745, 1683, 521, 2077, 2087, - /* 750 */ 744, 749, 480, 479, 2191, 12, 743, 558, 2126, 2129, - /* 760 */ 478, 739, 738, 737, 2969, 2078, 254, 2017, 2022, 2015, - /* 770 */ 2571, 2572, 43, 2017, 1695, 2015, 956, 2045, 53, 52, - /* 780 */ 882, 2026, 59, 57, 56, 55, 54, 2799, 1694, 2840, - /* 790 */ 523, 703, 2891, 2965, 2041, 1685, 199, 2842, 900, 2844, - /* 800 */ 2845, 895, 2020, 2021, 883, 2892, 919, 2301, 2020, 2021, - /* 810 */ 2074, 2841, 2076, 2079, 2080, 2081, 2082, 2083, 2084, 2085, - /* 820 */ 2086, 2088, 2089, 2090, 892, 885, 897, 2075, 917, 916, - /* 830 */ 881, 2111, 2112, 339, 2262, 2325, 2118, 2120, 2121, 2122, - /* 840 */ 2123, 2125, 2, 12, 60, 58, 803, 3012, 851, 170, - /* 850 */ 512, 2661, 506, 704, 2016, 2168, 2859, 947, 226, 1699, - /* 860 */ 1747, 140, 2962, 2963, 919, 168, 2967, 649, 2014, 2969, - /* 870 */ 2124, 117, 2806, 1698, 896, 1738, 946, 945, 944, 1742, - /* 880 */ 943, 1744, 1745, 891, 890, 2577, 1753, 889, 1755, 1756, - /* 890 */ 888, 930, 927, 464, 2324, 562, 2806, 539, 2964, 2188, - /* 900 */ 2189, 2190, 538, 2119, 2575, 1917, 884, 1985, 113, 396, - /* 910 */ 19, 1595, 1596, 915, 2517, 1568, 307, 2022, 2046, 2840, - /* 920 */ 2506, 126, 2891, 564, 560, 638, 135, 2842, 900, 2844, - /* 930 */ 2845, 895, 1984, 68, 883, 2892, 919, 2511, 517, 516, - /* 940 */ 553, 1566, 1567, 2954, 2841, 915, 2517, 1021, 2951, 2508, - /* 950 */ 15, 2800, 651, 234, 802, 2806, 225, 915, 2517, 897, - /* 960 */ 2760, 2361, 3054, 520, 519, 578, 190, 238, 2078, 486, - /* 970 */ 2721, 409, 533, 532, 201, 2962, 2963, 579, 168, 2967, - /* 980 */ 3060, 231, 2030, 512, 839, 3055, 840, 2127, 2128, 2859, - /* 990 */ 407, 89, 3054, 256, 88, 2323, 2023, 919, 2124, 727, - /* 1000 */ 726, 1943, 1944, 470, 2491, 2806, 2504, 896, 447, 2322, - /* 1010 */ 838, 231, 2502, 2046, 512, 3055, 840, 802, 637, 255, - /* 1020 */ 265, 661, 659, 656, 654, 3054, 2077, 2087, 919, 97, - /* 1030 */ 2075, 2119, 635, 3, 53, 52, 2126, 2129, 59, 57, - /* 1040 */ 56, 55, 54, 3060, 231, 2022, 173, 66, 3055, 840, - /* 1050 */ 2321, 2017, 2840, 2015, 113, 2891, 2806, 2507, 882, 134, - /* 1060 */ 2842, 900, 2844, 2845, 895, 2243, 75, 883, 2892, 919, - /* 1070 */ 2806, 748, 747, 471, 3074, 879, 2954, 346, 347, 2244, - /* 1080 */ 500, 2950, 345, 2510, 574, 3058, 2020, 2021, 2074, 573, - /* 1090 */ 2076, 2079, 2080, 2081, 2082, 2083, 2084, 2085, 2086, 2088, - /* 1100 */ 2089, 2090, 892, 885, 970, 76, 917, 916, 881, 2111, - /* 1110 */ 2112, 2806, 984, 982, 2118, 2120, 2121, 2122, 2123, 2125, - /* 1120 */ 2, 60, 58, 2130, 915, 2517, 2320, 2319, 2242, 506, - /* 1130 */ 2318, 2016, 53, 52, 2331, 1014, 59, 57, 56, 55, - /* 1140 */ 54, 802, 306, 2577, 598, 2014, 305, 2124, 2449, 3054, - /* 1150 */ 759, 496, 954, 187, 186, 951, 950, 949, 184, 101, - /* 1160 */ 100, 577, 2575, 846, 244, 773, 2577, 3060, 231, 2488, - /* 1170 */ 2317, 40, 3055, 840, 511, 395, 972, 569, 567, 2031, - /* 1180 */ 2119, 2026, 403, 884, 304, 2575, 2554, 2806, 2806, 444, - /* 1190 */ 2402, 2806, 556, 314, 2022, 552, 548, 544, 541, 570, - /* 1200 */ 2727, 53, 52, 762, 402, 59, 57, 56, 55, 54, - /* 1210 */ 756, 754, 915, 2517, 2034, 2036, 12, 301, 10, 2314, - /* 1220 */ 116, 2841, 2521, 196, 1021, 453, 34, 61, 485, 2577, - /* 1230 */ 774, 2806, 612, 2520, 917, 916, 897, 527, 3009, 185, - /* 1240 */ 915, 2517, 2118, 2120, 2121, 2122, 2123, 2125, 2575, 915, - /* 1250 */ 2517, 53, 52, 915, 2517, 59, 57, 56, 55, 54, - /* 1260 */ 613, 339, 308, 85, 2127, 2128, 2859, 2045, 84, 614, - /* 1270 */ 752, 751, 750, 705, 2041, 2746, 809, 742, 167, 746, - /* 1280 */ 2806, 396, 2806, 745, 896, 915, 2517, 2313, 744, 749, - /* 1290 */ 480, 479, 333, 2312, 743, 915, 2517, 2577, 478, 739, - /* 1300 */ 738, 737, 2386, 2077, 2087, 2512, 915, 2517, 875, 877, - /* 1310 */ 2926, 2926, 2263, 2126, 2129, 309, 2576, 954, 187, 186, - /* 1320 */ 951, 950, 949, 184, 753, 67, 317, 2311, 2017, 2840, - /* 1330 */ 2015, 2156, 2891, 833, 843, 882, 134, 2842, 900, 2844, - /* 1340 */ 2845, 895, 2722, 2316, 883, 2892, 919, 948, 2806, 952, - /* 1350 */ 2568, 3074, 2568, 2954, 2806, 2310, 735, 500, 2950, 2309, - /* 1360 */ 734, 205, 2238, 2020, 2021, 2074, 2841, 2076, 2079, 2080, - /* 1370 */ 2081, 2082, 2083, 2084, 2085, 2086, 2088, 2089, 2090, 892, - /* 1380 */ 885, 897, 2626, 917, 916, 881, 2111, 2112, 2806, 915, - /* 1390 */ 2517, 2118, 2120, 2121, 2122, 2123, 2125, 2, 60, 58, - /* 1400 */ 2841, 915, 2517, 915, 2517, 2202, 506, 2750, 2016, 857, - /* 1410 */ 2161, 2859, 915, 2517, 2308, 897, 2806, 3022, 842, 2307, - /* 1420 */ 2806, 350, 2014, 871, 2124, 171, 588, 2806, 2925, 896, - /* 1430 */ 42, 2306, 357, 53, 52, 915, 2517, 59, 57, 56, - /* 1440 */ 55, 54, 53, 52, 529, 2859, 59, 57, 56, 55, - /* 1450 */ 54, 775, 915, 2517, 195, 908, 1570, 2119, 915, 2517, - /* 1460 */ 884, 2806, 2040, 896, 546, 2522, 953, 915, 2517, 2568, - /* 1470 */ 847, 2022, 909, 2588, 2840, 2806, 3015, 2891, 913, 163, - /* 1480 */ 2806, 413, 2842, 900, 2844, 2845, 895, 385, 32, 883, - /* 1490 */ 2892, 919, 2806, 103, 91, 2492, 294, 296, 2841, 292, - /* 1500 */ 295, 1021, 177, 2046, 61, 2109, 2295, 2296, 2840, 2579, - /* 1510 */ 2075, 2891, 740, 897, 1678, 134, 2842, 900, 2844, 2845, - /* 1520 */ 895, 222, 177, 883, 2892, 919, 298, 2384, 176, 297, - /* 1530 */ 3074, 300, 2954, 812, 299, 1676, 500, 2950, 2375, 741, - /* 1540 */ 185, 2127, 2128, 2859, 2101, 2373, 62, 822, 104, 755, - /* 1550 */ 53, 52, 62, 2232, 59, 57, 56, 55, 54, 2806, - /* 1560 */ 757, 896, 1674, 1679, 14, 13, 880, 760, 53, 52, - /* 1570 */ 364, 363, 59, 57, 56, 55, 54, 2025, 53, 52, - /* 1580 */ 2077, 2087, 59, 57, 56, 55, 54, 325, 1933, 47, - /* 1590 */ 2126, 2129, 53, 52, 214, 344, 59, 57, 56, 55, - /* 1600 */ 54, 90, 62, 366, 365, 2017, 2840, 2015, 1941, 2891, - /* 1610 */ 77, 852, 882, 134, 2842, 900, 2844, 2845, 895, 2236, - /* 1620 */ 62, 883, 2892, 919, 2827, 2024, 856, 165, 2929, 2860, - /* 1630 */ 2954, 632, 2248, 776, 500, 2950, 368, 367, 2247, 844, - /* 1640 */ 2020, 2021, 2074, 62, 2076, 2079, 2080, 2081, 2082, 2083, - /* 1650 */ 2084, 2085, 2086, 2088, 2089, 2090, 892, 885, 62, 2441, - /* 1660 */ 917, 916, 881, 2111, 2112, 62, 90, 647, 2118, 2120, - /* 1670 */ 2121, 2122, 2123, 2125, 2, 60, 58, 2841, 182, 2097, - /* 1680 */ 323, 348, 779, 506, 2440, 2016, 163, 863, 2100, 2099, - /* 1690 */ 185, 2829, 897, 132, 816, 129, 2162, 2352, 46, 2014, - /* 1700 */ 87, 2124, 2367, 2102, 370, 369, 2110, 53, 52, 3005, - /* 1710 */ 39, 59, 57, 56, 55, 54, 372, 371, 1656, 53, - /* 1720 */ 52, 819, 2859, 59, 57, 56, 55, 54, 2841, 2103, - /* 1730 */ 374, 373, 376, 375, 2119, 378, 377, 884, 2806, 802, - /* 1740 */ 896, 925, 2146, 897, 1886, 380, 379, 3054, 2022, 382, - /* 1750 */ 381, 2091, 1876, 384, 383, 1629, 964, 965, 48, 492, - /* 1760 */ 1008, 826, 2028, 183, 360, 3060, 231, 1657, 185, 164, - /* 1770 */ 3055, 840, 912, 2859, 488, 182, 1729, 860, 1021, 1648, - /* 1780 */ 1646, 61, 2652, 555, 2565, 2840, 401, 537, 2891, 2806, - /* 1790 */ 2358, 896, 134, 2842, 900, 2844, 2845, 895, 795, 3006, - /* 1800 */ 883, 2892, 919, 3016, 1630, 834, 835, 3074, 330, 2954, - /* 1810 */ 2027, 338, 335, 500, 2950, 2653, 53, 52, 2127, 2128, - /* 1820 */ 59, 57, 56, 55, 54, 2475, 5, 1760, 540, 545, - /* 1830 */ 2096, 462, 2039, 554, 2049, 566, 2840, 565, 239, 2891, - /* 1840 */ 568, 240, 394, 135, 2842, 900, 2844, 2845, 895, 1768, - /* 1850 */ 242, 883, 2892, 919, 1775, 1773, 1910, 2077, 2087, 582, - /* 1860 */ 2954, 188, 2040, 589, 878, 2950, 253, 2126, 2129, 53, - /* 1870 */ 52, 591, 595, 59, 57, 56, 55, 54, 597, 640, - /* 1880 */ 602, 615, 2017, 626, 2015, 2645, 53, 52, 636, 882, - /* 1890 */ 59, 57, 56, 55, 54, 628, 639, 641, 652, 477, - /* 1900 */ 475, 653, 650, 259, 258, 657, 2047, 655, 658, 262, - /* 1910 */ 660, 662, 4, 681, 682, 689, 2042, 2020, 2021, 2074, - /* 1920 */ 690, 2076, 2079, 2080, 2081, 2082, 2083, 2084, 2085, 2086, - /* 1930 */ 2088, 2089, 2090, 892, 885, 692, 270, 917, 916, 881, - /* 1940 */ 2111, 2112, 694, 787, 109, 2118, 2120, 2121, 2122, 2123, - /* 1950 */ 2125, 2, 60, 58, 273, 2048, 695, 2050, 696, 276, - /* 1960 */ 506, 698, 2016, 2051, 855, 278, 2668, 110, 2052, 111, - /* 1970 */ 112, 49, 2662, 1727, 2841, 730, 2014, 707, 2124, 284, - /* 1980 */ 2098, 287, 474, 472, 114, 733, 732, 763, 764, 897, - /* 1990 */ 2736, 3047, 139, 2505, 291, 439, 2501, 2095, 778, 115, - /* 2000 */ 802, 293, 191, 780, 138, 2841, 735, 310, 3054, 136, - /* 2010 */ 734, 2119, 2043, 178, 884, 2503, 2498, 192, 193, 2859, - /* 2020 */ 897, 802, 397, 2714, 790, 2022, 3060, 231, 791, 3054, - /* 2030 */ 789, 3055, 840, 315, 313, 2806, 2733, 896, 2732, 823, - /* 2040 */ 797, 861, 3021, 794, 3020, 8, 832, 3060, 231, 326, - /* 2050 */ 2859, 806, 3055, 840, 796, 1021, 2841, 2993, 61, 807, - /* 2060 */ 805, 837, 804, 320, 204, 2973, 2806, 328, 896, 324, - /* 2070 */ 322, 897, 327, 2986, 836, 329, 331, 845, 848, 169, - /* 2080 */ 493, 2044, 2840, 2210, 2208, 2891, 217, 340, 179, 134, - /* 2090 */ 2842, 900, 2844, 2845, 895, 2127, 2128, 883, 2892, 919, - /* 2100 */ 3077, 2859, 3053, 398, 3074, 2970, 2954, 859, 334, 2682, - /* 2110 */ 500, 2950, 2681, 898, 1, 2680, 2891, 2806, 497, 896, - /* 2120 */ 135, 2842, 900, 2844, 2845, 895, 864, 872, 883, 2892, - /* 2130 */ 919, 399, 869, 74, 2077, 2087, 865, 2954, 180, 2935, - /* 2140 */ 353, 457, 2950, 904, 2126, 2129, 902, 233, 906, 907, - /* 2150 */ 2798, 2797, 128, 400, 2793, 2518, 2792, 404, 2784, 2017, - /* 2160 */ 358, 2015, 2783, 125, 2840, 387, 882, 2891, 2775, 2774, - /* 2170 */ 921, 134, 2842, 900, 2844, 2845, 895, 1540, 1016, 883, - /* 2180 */ 2892, 919, 2790, 1017, 2789, 2781, 3074, 2780, 2954, 1018, - /* 2190 */ 189, 1013, 500, 2950, 2020, 2021, 2074, 391, 2076, 2079, - /* 2200 */ 2080, 2081, 2082, 2083, 2084, 2085, 2086, 2088, 2089, 2090, - /* 2210 */ 892, 885, 1020, 2769, 917, 916, 881, 2111, 2112, 2768, - /* 2220 */ 2787, 2786, 2118, 2120, 2121, 2122, 2123, 2125, 2, 60, - /* 2230 */ 58, 2778, 2777, 2766, 2765, 390, 2763, 506, 2762, 2016, - /* 2240 */ 2569, 65, 476, 454, 427, 782, 440, 455, 524, 438, - /* 2250 */ 428, 2841, 406, 2014, 408, 2124, 2758, 2757, 2756, 98, - /* 2260 */ 2751, 542, 543, 1967, 1968, 547, 897, 237, 2749, 549, - /* 2270 */ 550, 551, 1966, 2748, 2747, 463, 2745, 557, 2744, 559, - /* 2280 */ 2743, 561, 2742, 563, 1954, 2718, 241, 2717, 2119, 243, - /* 2290 */ 1913, 884, 99, 1912, 2695, 2694, 2859, 2693, 575, 576, - /* 2300 */ 2692, 2691, 2022, 2635, 580, 1849, 2632, 583, 2631, 2625, - /* 2310 */ 2622, 586, 2806, 246, 896, 248, 102, 2620, 587, 2621, - /* 2320 */ 2619, 2624, 2623, 2618, 2617, 2615, 2614, 449, 448, 2613, - /* 2330 */ 2612, 2610, 1021, 2841, 603, 15, 250, 513, 605, 2609, - /* 2340 */ 2608, 2607, 2606, 2630, 2605, 2604, 2603, 2628, 897, 2611, - /* 2350 */ 2602, 522, 2601, 2124, 2600, 2598, 2597, 2596, 2595, 2840, - /* 2360 */ 2594, 2593, 2891, 252, 2592, 108, 134, 2842, 900, 2844, - /* 2370 */ 2845, 895, 2127, 2128, 883, 2892, 919, 2591, 2859, 257, - /* 2380 */ 2582, 2927, 2590, 2954, 2589, 2587, 2119, 500, 2950, 2586, - /* 2390 */ 2660, 2629, 2627, 2585, 2806, 2584, 896, 1855, 2583, 643, - /* 2400 */ 2581, 645, 2580, 2578, 2406, 1696, 260, 2405, 1700, 261, - /* 2410 */ 1692, 2077, 2087, 2404, 451, 452, 2403, 2401, 2398, 263, - /* 2420 */ 665, 2126, 2129, 663, 264, 664, 2397, 668, 2390, 672, - /* 2430 */ 667, 2377, 669, 671, 2365, 675, 2017, 677, 2015, 2364, - /* 2440 */ 673, 2840, 679, 882, 2891, 2347, 1569, 212, 134, 2842, - /* 2450 */ 900, 2844, 2845, 895, 94, 266, 883, 2892, 919, 2346, - /* 2460 */ 2826, 2716, 223, 876, 268, 2954, 687, 95, 2712, 500, - /* 2470 */ 2950, 2020, 2021, 2074, 2702, 2076, 2079, 2080, 2081, 2082, - /* 2480 */ 2083, 2084, 2085, 2086, 2088, 2089, 2090, 892, 885, 784, - /* 2490 */ 2690, 917, 916, 881, 2111, 2112, 275, 2689, 277, 2118, - /* 2500 */ 2120, 2121, 2122, 2123, 2125, 2, 280, 1024, 2666, 282, - /* 2510 */ 2659, 2493, 1622, 2400, 2396, 2841, 708, 709, 2394, 710, - /* 2520 */ 712, 713, 714, 2392, 717, 716, 393, 718, 2389, 720, - /* 2530 */ 897, 722, 2372, 721, 2007, 2370, 1983, 2371, 2369, 2366, - /* 2540 */ 728, 1012, 1010, 2343, 2495, 221, 1779, 290, 86, 2494, - /* 2550 */ 2387, 1780, 1682, 1681, 1006, 1002, 998, 994, 1680, 388, - /* 2560 */ 2859, 1677, 1675, 1673, 981, 1672, 983, 515, 514, 2008, - /* 2570 */ 1671, 2385, 1670, 481, 1664, 482, 2806, 1669, 896, 2376, - /* 2580 */ 483, 1666, 1665, 1663, 2374, 484, 2342, 2341, 2340, 917, - /* 2590 */ 916, 761, 765, 2339, 2338, 767, 769, 2118, 2120, 2121, - /* 2600 */ 2122, 2123, 2125, 2337, 771, 133, 1948, 758, 1950, 141, - /* 2610 */ 361, 1947, 2715, 1952, 33, 312, 80, 2711, 69, 1919, - /* 2620 */ 1921, 2841, 2701, 2840, 792, 70, 2891, 1923, 2688, 316, - /* 2630 */ 202, 2842, 900, 2844, 2845, 895, 897, 1938, 883, 2892, - /* 2640 */ 919, 867, 793, 2687, 2841, 1898, 798, 194, 800, 1897, - /* 2650 */ 3059, 22, 17, 808, 25, 781, 811, 489, 35, 897, - /* 2660 */ 6, 2265, 7, 23, 228, 24, 2859, 216, 38, 229, - /* 2670 */ 2827, 78, 319, 2205, 26, 2280, 2239, 18, 2279, 36, - /* 2680 */ 817, 2237, 2806, 813, 896, 815, 359, 494, 873, 2859, - /* 2690 */ 2203, 342, 841, 3075, 2284, 321, 341, 2246, 203, 215, - /* 2700 */ 2283, 495, 72, 37, 336, 2806, 503, 896, 208, 2231, - /* 2710 */ 96, 2686, 2665, 2664, 2201, 311, 2285, 230, 120, 2286, - /* 2720 */ 2841, 121, 351, 2185, 2658, 2184, 343, 119, 122, 2840, - /* 2730 */ 2241, 27, 2891, 218, 349, 897, 437, 2842, 900, 2844, - /* 2740 */ 2845, 895, 82, 71, 883, 2892, 919, 11, 868, 13, - /* 2750 */ 2032, 209, 2840, 2147, 219, 2891, 352, 2067, 21, 199, - /* 2760 */ 2842, 900, 2844, 2845, 895, 2859, 862, 883, 2892, 919, - /* 2770 */ 2137, 2841, 870, 28, 29, 354, 2657, 2136, 2094, 2490, - /* 2780 */ 20, 2806, 2093, 896, 50, 932, 897, 123, 935, 938, - /* 2790 */ 941, 51, 910, 362, 2092, 2059, 16, 30, 31, 83, - /* 2800 */ 905, 903, 2106, 356, 2841, 490, 124, 129, 2299, 92, - /* 2810 */ 3013, 911, 2904, 2903, 918, 81, 2859, 924, 920, 897, - /* 2820 */ 1761, 525, 926, 386, 1758, 928, 929, 931, 2840, 1757, - /* 2830 */ 934, 2891, 2806, 1754, 896, 437, 2842, 900, 2844, 2845, - /* 2840 */ 895, 1748, 937, 883, 2892, 919, 2298, 940, 899, 2859, - /* 2850 */ 1746, 130, 131, 1774, 93, 1752, 491, 1751, 1750, 1749, - /* 2860 */ 1770, 1620, 955, 1660, 1659, 2806, 1658, 896, 1655, 2841, - /* 2870 */ 1652, 1651, 1650, 1649, 969, 1647, 1645, 1690, 1644, 2840, - /* 2880 */ 1643, 1689, 2891, 971, 897, 235, 437, 2842, 900, 2844, - /* 2890 */ 2845, 895, 2841, 1641, 883, 2892, 919, 1640, 1639, 1638, - /* 2900 */ 1637, 1636, 1635, 1686, 1684, 1632, 1631, 894, 1628, 1627, - /* 2910 */ 1626, 1625, 2840, 992, 2859, 2891, 2395, 991, 993, 430, - /* 2920 */ 2842, 900, 2844, 2845, 895, 2393, 995, 883, 2892, 919, - /* 2930 */ 2806, 997, 896, 996, 2391, 999, 1000, 2859, 1001, 2388, - /* 2940 */ 1003, 1004, 1005, 2368, 1007, 2363, 1009, 2362, 1011, 2336, - /* 2950 */ 1558, 1541, 1015, 2806, 1546, 896, 1548, 392, 1019, 1022, - /* 2960 */ 2841, 2302, 2018, 405, 1023, 2302, 2302, 2302, 2302, 2302, - /* 2970 */ 2302, 2302, 2302, 831, 2302, 897, 2302, 2840, 2302, 2302, - /* 2980 */ 2891, 2302, 2302, 2302, 202, 2842, 900, 2844, 2845, 895, - /* 2990 */ 2302, 2302, 883, 2892, 919, 2302, 2302, 2302, 2302, 2302, - /* 3000 */ 2840, 2302, 2302, 2891, 2302, 2859, 2302, 436, 2842, 900, - /* 3010 */ 2844, 2845, 895, 2302, 2302, 883, 2892, 919, 2302, 2920, - /* 3020 */ 2302, 2806, 2302, 896, 2302, 2841, 2302, 289, 2302, 2302, - /* 3030 */ 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, - /* 3040 */ 897, 2302, 2302, 729, 2302, 504, 206, 3076, 2302, 2302, - /* 3050 */ 2302, 2302, 2841, 2302, 2302, 723, 719, 715, 711, 2302, - /* 3060 */ 288, 2302, 2302, 2302, 2302, 2302, 2302, 897, 2840, 2302, - /* 3070 */ 2859, 2891, 2302, 2302, 2302, 437, 2842, 900, 2844, 2845, - /* 3080 */ 895, 2302, 2302, 883, 2892, 919, 2806, 2302, 896, 2302, - /* 3090 */ 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2859, 2302, 2302, - /* 3100 */ 2302, 2302, 2302, 2302, 2302, 2302, 286, 2302, 2302, 2302, - /* 3110 */ 499, 285, 2302, 2806, 2302, 896, 2302, 2302, 2302, 2302, - /* 3120 */ 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, - /* 3130 */ 2302, 2302, 2302, 2840, 2302, 2302, 2891, 505, 2841, 2302, - /* 3140 */ 422, 2842, 900, 2844, 2845, 895, 2302, 2302, 883, 2892, - /* 3150 */ 919, 2302, 2302, 897, 2302, 2302, 2302, 2302, 2841, 2302, - /* 3160 */ 2840, 2302, 2302, 2891, 2302, 2302, 2302, 437, 2842, 900, - /* 3170 */ 2844, 2845, 895, 897, 2302, 883, 2892, 919, 272, 2841, - /* 3180 */ 2302, 2302, 2302, 2859, 2302, 2302, 2302, 283, 2302, 2302, - /* 3190 */ 2302, 274, 281, 2302, 897, 2302, 2302, 279, 697, 2806, - /* 3200 */ 2302, 896, 2302, 2859, 2302, 2302, 2302, 2302, 2302, 2302, - /* 3210 */ 2302, 2302, 2302, 2302, 2302, 2302, 271, 2302, 2302, 2806, - /* 3220 */ 2302, 896, 2302, 507, 2859, 2302, 2302, 2302, 2302, 2302, - /* 3230 */ 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, - /* 3240 */ 2806, 2302, 896, 2302, 2302, 2302, 2840, 2302, 2302, 2891, - /* 3250 */ 2302, 2302, 2302, 437, 2842, 900, 2844, 2845, 895, 2302, - /* 3260 */ 2302, 883, 2892, 919, 2302, 2302, 2840, 2302, 2302, 2891, - /* 3270 */ 2302, 2302, 2302, 418, 2842, 900, 2844, 2845, 895, 2302, - /* 3280 */ 2302, 883, 2892, 919, 2302, 2841, 2302, 777, 2302, 2302, - /* 3290 */ 2891, 2302, 2302, 2302, 432, 2842, 900, 2844, 2845, 895, - /* 3300 */ 897, 2302, 883, 2892, 919, 2841, 2302, 2302, 2302, 2302, - /* 3310 */ 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, - /* 3320 */ 897, 2302, 2302, 2302, 2302, 2841, 2302, 2302, 2302, 2302, - /* 3330 */ 2859, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, - /* 3340 */ 897, 2302, 2302, 2302, 2302, 2302, 2806, 2302, 896, 2302, - /* 3350 */ 2859, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, - /* 3360 */ 2302, 2302, 2302, 2302, 2302, 2302, 2806, 2302, 896, 2302, - /* 3370 */ 2859, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, - /* 3380 */ 2302, 2302, 2302, 2302, 2302, 2302, 2806, 2302, 896, 2302, - /* 3390 */ 2302, 2302, 2302, 2840, 2302, 2302, 2891, 2302, 2302, 2302, - /* 3400 */ 414, 2842, 900, 2844, 2845, 895, 2302, 2302, 883, 2892, - /* 3410 */ 919, 2302, 2841, 2840, 2302, 2302, 2891, 2302, 2302, 2302, - /* 3420 */ 410, 2842, 900, 2844, 2845, 895, 2302, 897, 883, 2892, - /* 3430 */ 919, 2302, 2302, 2840, 2302, 2302, 2891, 2302, 2841, 2302, - /* 3440 */ 411, 2842, 900, 2844, 2845, 895, 2302, 2302, 883, 2892, - /* 3450 */ 919, 2302, 2302, 897, 2302, 2302, 2302, 2859, 2302, 2302, - /* 3460 */ 2302, 2841, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, - /* 3470 */ 2302, 2302, 2302, 2806, 2302, 896, 897, 2302, 2302, 2302, - /* 3480 */ 2302, 2841, 2302, 2859, 2302, 2302, 2302, 2302, 2302, 2302, - /* 3490 */ 2302, 2302, 2302, 2302, 2302, 2302, 897, 2302, 2302, 2806, - /* 3500 */ 2302, 896, 2302, 2841, 2302, 2302, 2859, 2302, 2302, 2302, - /* 3510 */ 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 897, 2302, - /* 3520 */ 2840, 2302, 2806, 2891, 896, 2302, 2859, 415, 2842, 900, - /* 3530 */ 2844, 2845, 895, 2302, 2302, 883, 2892, 919, 2302, 2302, - /* 3540 */ 2302, 2302, 2806, 2302, 896, 2302, 2840, 2302, 2859, 2891, - /* 3550 */ 2302, 2302, 2302, 429, 2842, 900, 2844, 2845, 895, 2302, - /* 3560 */ 2302, 883, 2892, 919, 2806, 2302, 896, 2302, 2841, 2840, - /* 3570 */ 2302, 2302, 2891, 2302, 2302, 2302, 416, 2842, 900, 2844, - /* 3580 */ 2845, 895, 2302, 897, 883, 2892, 919, 2841, 2302, 2840, - /* 3590 */ 2302, 2302, 2891, 2302, 2302, 2302, 417, 2842, 900, 2844, - /* 3600 */ 2845, 895, 897, 2302, 883, 2892, 919, 2302, 2302, 2841, - /* 3610 */ 2302, 2840, 2302, 2859, 2891, 2302, 2302, 2302, 433, 2842, - /* 3620 */ 900, 2844, 2845, 895, 897, 2302, 883, 2892, 919, 2806, - /* 3630 */ 2302, 896, 2859, 2302, 2302, 2302, 2302, 2302, 2302, 2302, - /* 3640 */ 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2806, 2302, - /* 3650 */ 896, 2302, 2302, 2302, 2859, 2302, 2302, 2302, 2302, 2302, - /* 3660 */ 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, - /* 3670 */ 2806, 2302, 896, 2302, 2841, 2302, 2840, 2302, 2302, 2891, - /* 3680 */ 2302, 2302, 2302, 419, 2842, 900, 2844, 2845, 895, 897, - /* 3690 */ 2302, 883, 2892, 919, 2302, 2840, 2302, 2302, 2891, 2302, - /* 3700 */ 2302, 2302, 434, 2842, 900, 2844, 2845, 895, 2302, 2302, - /* 3710 */ 883, 2892, 919, 2302, 2302, 2302, 2302, 2840, 2302, 2859, - /* 3720 */ 2891, 2302, 2302, 2841, 420, 2842, 900, 2844, 2845, 895, - /* 3730 */ 2302, 2302, 883, 2892, 919, 2806, 2302, 896, 897, 2302, - /* 3740 */ 2302, 2302, 2302, 2841, 2302, 2302, 2302, 2302, 2302, 2302, - /* 3750 */ 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 897, 2302, - /* 3760 */ 2302, 2302, 2302, 2841, 2302, 2302, 2302, 2302, 2859, 2302, - /* 3770 */ 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 897, 2302, - /* 3780 */ 2302, 2302, 2840, 2302, 2806, 2891, 896, 2302, 2859, 435, - /* 3790 */ 2842, 900, 2844, 2845, 895, 2302, 2302, 883, 2892, 919, - /* 3800 */ 2302, 2302, 2302, 2302, 2806, 2302, 896, 2302, 2859, 2302, - /* 3810 */ 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, - /* 3820 */ 2302, 2302, 2302, 2302, 2806, 2302, 896, 2302, 2302, 2302, - /* 3830 */ 2302, 2840, 2302, 2302, 2891, 2302, 2302, 2302, 421, 2842, - /* 3840 */ 900, 2844, 2845, 895, 2302, 2302, 883, 2892, 919, 2302, - /* 3850 */ 2841, 2840, 2302, 2302, 2891, 2302, 2302, 2302, 412, 2842, - /* 3860 */ 900, 2844, 2845, 895, 2302, 897, 883, 2892, 919, 2841, - /* 3870 */ 2302, 2840, 2302, 2302, 2891, 2302, 2302, 2302, 423, 2842, - /* 3880 */ 900, 2844, 2845, 895, 897, 2302, 883, 2892, 919, 2841, - /* 3890 */ 2302, 2302, 2302, 2302, 2302, 2859, 2302, 2302, 2302, 2302, - /* 3900 */ 2302, 2302, 2302, 2302, 897, 2302, 2302, 2302, 2302, 2302, - /* 3910 */ 2302, 2806, 2302, 896, 2859, 2302, 2302, 2302, 2302, 2302, - /* 3920 */ 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, - /* 3930 */ 2806, 2302, 896, 2302, 2859, 2302, 2302, 2302, 2302, 2302, - /* 3940 */ 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, - /* 3950 */ 2806, 2302, 896, 2302, 2302, 2302, 2841, 2302, 2840, 2302, - /* 3960 */ 2302, 2891, 2302, 2302, 2302, 424, 2842, 900, 2844, 2845, - /* 3970 */ 895, 897, 2302, 883, 2892, 919, 2841, 2840, 2302, 2302, - /* 3980 */ 2891, 2302, 2302, 2302, 425, 2842, 900, 2844, 2845, 895, - /* 3990 */ 2302, 897, 883, 2892, 919, 2841, 2302, 2840, 2302, 2302, - /* 4000 */ 2891, 2859, 2302, 2302, 426, 2842, 900, 2844, 2845, 895, - /* 4010 */ 897, 2302, 883, 2892, 919, 2302, 2302, 2806, 2302, 896, - /* 4020 */ 2302, 2859, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, - /* 4030 */ 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2806, 2302, 896, - /* 4040 */ 2859, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, - /* 4050 */ 2302, 2302, 2302, 2302, 2302, 2302, 2806, 2302, 896, 2302, - /* 4060 */ 2302, 2302, 2302, 2841, 2840, 2302, 2302, 2891, 2302, 2302, - /* 4070 */ 2302, 442, 2842, 900, 2844, 2845, 895, 2302, 897, 883, - /* 4080 */ 2892, 919, 2841, 2302, 2840, 2302, 2302, 2891, 2302, 2302, - /* 4090 */ 2302, 443, 2842, 900, 2844, 2845, 895, 897, 2302, 883, - /* 4100 */ 2892, 919, 2302, 2840, 2302, 2302, 2891, 2302, 2859, 2302, - /* 4110 */ 2853, 2842, 900, 2844, 2845, 895, 2302, 2302, 883, 2892, - /* 4120 */ 919, 2302, 2302, 2302, 2806, 2302, 896, 2859, 2302, 2302, - /* 4130 */ 2302, 2841, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, - /* 4140 */ 2302, 2302, 2302, 2806, 2302, 896, 897, 2302, 2302, 2302, - /* 4150 */ 2302, 2841, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, - /* 4160 */ 2302, 2302, 2302, 2302, 2302, 2302, 897, 2302, 2302, 2302, - /* 4170 */ 2302, 2840, 2302, 2302, 2891, 2302, 2859, 2302, 2852, 2842, - /* 4180 */ 900, 2844, 2845, 895, 2302, 2302, 883, 2892, 919, 2302, - /* 4190 */ 2840, 2302, 2806, 2891, 896, 2302, 2859, 2851, 2842, 900, - /* 4200 */ 2844, 2845, 895, 2302, 2302, 883, 2892, 919, 2302, 2302, - /* 4210 */ 2302, 2302, 2806, 2302, 896, 2302, 2302, 2302, 2302, 2841, - /* 4220 */ 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, - /* 4230 */ 2302, 2302, 2302, 2302, 897, 2302, 2302, 2302, 2302, 2840, - /* 4240 */ 2302, 2302, 2891, 2841, 2302, 2302, 459, 2842, 900, 2844, - /* 4250 */ 2845, 895, 2302, 2302, 883, 2892, 919, 2302, 897, 2840, - /* 4260 */ 2302, 2302, 2891, 2302, 2859, 2302, 460, 2842, 900, 2844, - /* 4270 */ 2845, 895, 2302, 2302, 883, 2892, 919, 2302, 2302, 2302, - /* 4280 */ 2806, 2302, 896, 2302, 2302, 2302, 2302, 2302, 2859, 2302, - /* 4290 */ 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, - /* 4300 */ 2302, 2302, 2302, 2302, 2806, 2302, 896, 2302, 2302, 2302, - /* 4310 */ 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, - /* 4320 */ 2302, 2302, 2302, 2302, 2302, 2841, 2302, 2840, 2302, 2302, - /* 4330 */ 2891, 2302, 2302, 2302, 456, 2842, 900, 2844, 2845, 895, - /* 4340 */ 897, 2302, 883, 2892, 919, 2302, 2302, 2302, 2302, 2841, - /* 4350 */ 2302, 2840, 2302, 2302, 2891, 2302, 2302, 2302, 461, 2842, - /* 4360 */ 900, 2844, 2845, 895, 897, 2302, 883, 2892, 919, 2302, - /* 4370 */ 2859, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, - /* 4380 */ 2302, 2302, 2302, 2302, 2302, 2302, 2806, 2302, 896, 2302, - /* 4390 */ 2302, 2302, 2302, 2302, 2859, 2302, 2302, 2302, 2302, 2302, - /* 4400 */ 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, - /* 4410 */ 2806, 2302, 896, 2302, 2302, 2302, 2302, 2302, 2302, 2302, - /* 4420 */ 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, - /* 4430 */ 2302, 2302, 2302, 898, 2302, 2302, 2891, 2302, 2302, 2302, - /* 4440 */ 432, 2842, 900, 2844, 2845, 895, 2302, 2302, 883, 2892, - /* 4450 */ 919, 2302, 2302, 2302, 2302, 2302, 2302, 2840, 2302, 2302, - /* 4460 */ 2891, 2302, 2302, 2302, 431, 2842, 900, 2844, 2845, 895, - /* 4470 */ 2302, 2302, 883, 2892, 919, + /* 0 */ 839, 683, 3063, 2678, 684, 2354, 113, 2510, 3058, 678, + /* 10 */ 3058, 2820, 60, 58, 225, 59, 57, 56, 55, 54, + /* 20 */ 506, 2307, 2019, 2676, 901, 471, 838, 231, 224, 3062, + /* 30 */ 2820, 3059, 840, 3059, 3061, 2514, 2017, 2803, 2127, 2402, + /* 40 */ 523, 2824, 151, 2845, 2568, 150, 149, 148, 147, 146, + /* 50 */ 145, 144, 143, 142, 196, 851, 170, 914, 854, 680, + /* 60 */ 2824, 53, 52, 526, 2523, 59, 57, 56, 55, 54, + /* 70 */ 512, 2122, 151, 2048, 884, 150, 149, 148, 147, 146, + /* 80 */ 145, 144, 143, 142, 919, 2025, 914, 2678, 2863, 53, + /* 90 */ 52, 2826, 2829, 59, 57, 56, 55, 54, 957, 691, + /* 100 */ 512, 498, 684, 2354, 2810, 919, 896, 2675, 901, 2044, + /* 110 */ 2826, 2828, 501, 2763, 919, 1022, 851, 170, 61, 991, + /* 120 */ 990, 989, 988, 536, 919, 987, 986, 175, 981, 980, + /* 130 */ 979, 978, 977, 976, 975, 174, 969, 968, 967, 535, + /* 140 */ 534, 964, 963, 962, 211, 210, 961, 531, 960, 959, + /* 150 */ 958, 2844, 2804, 2525, 2895, 2130, 2131, 127, 134, 2846, + /* 160 */ 900, 2848, 2849, 895, 45, 355, 883, 2896, 919, 914, + /* 170 */ 802, 772, 1594, 213, 1593, 2958, 2045, 251, 3058, 500, + /* 180 */ 2954, 207, 2966, 850, 63, 162, 849, 766, 166, 770, + /* 190 */ 768, 303, 302, 3058, 2080, 2090, 3064, 231, 829, 232, + /* 200 */ 785, 3059, 840, 3063, 2129, 2132, 528, 3005, 75, 2574, + /* 210 */ 2576, 838, 231, 1595, 782, 512, 3059, 840, 914, 2020, + /* 220 */ 2047, 2018, 824, 107, 197, 9, 882, 2223, 106, 919, + /* 230 */ 53, 52, 2452, 2044, 59, 57, 56, 55, 54, 676, + /* 240 */ 64, 853, 200, 2966, 2967, 699, 168, 2971, 674, 227, + /* 250 */ 318, 670, 666, 581, 2023, 2024, 2077, 2845, 2079, 2082, + /* 260 */ 2083, 2084, 2085, 2086, 2087, 2088, 2089, 2091, 2092, 2093, + /* 270 */ 892, 885, 894, 307, 917, 916, 881, 2114, 2115, 2116, + /* 280 */ 2117, 2118, 2121, 2123, 2124, 2125, 2126, 2128, 2, 60, + /* 290 */ 58, 2219, 2296, 2845, 445, 105, 2042, 506, 2306, 2019, + /* 300 */ 458, 118, 2863, 625, 644, 642, 469, 441, 897, 2049, + /* 310 */ 245, 1892, 1893, 2017, 646, 2127, 63, 79, 2810, 2289, + /* 320 */ 896, 2620, 160, 159, 158, 157, 156, 155, 154, 153, + /* 330 */ 152, 466, 468, 604, 2750, 648, 828, 220, 2863, 2194, + /* 340 */ 446, 606, 830, 825, 818, 814, 810, 2138, 2122, 2678, + /* 350 */ 2157, 884, 584, 2044, 2810, 19, 896, 3062, 1946, 1947, + /* 360 */ 1891, 1894, 2025, 508, 2651, 2844, 2863, 2329, 2895, 2675, + /* 370 */ 901, 2028, 436, 2846, 900, 2848, 2849, 895, 893, 339, + /* 380 */ 883, 2896, 919, 874, 2923, 954, 187, 186, 951, 950, + /* 390 */ 949, 184, 1022, 467, 2048, 15, 337, 2044, 851, 170, + /* 400 */ 1698, 2844, 2254, 339, 2895, 592, 518, 2081, 134, 2846, + /* 410 */ 900, 2848, 2849, 895, 1697, 2158, 883, 2896, 919, 558, + /* 420 */ 2603, 172, 2295, 181, 2929, 2958, 533, 532, 2810, 500, + /* 430 */ 2954, 75, 2130, 2131, 2077, 339, 2658, 2637, 827, 634, + /* 440 */ 633, 631, 630, 629, 624, 623, 622, 621, 450, 702, + /* 450 */ 2026, 611, 610, 609, 608, 607, 601, 600, 599, 510, + /* 460 */ 594, 593, 465, 2045, 706, 220, 585, 1853, 1854, 2078, + /* 470 */ 220, 2080, 2090, 1872, 821, 820, 2252, 2253, 2255, 2256, + /* 480 */ 2257, 2129, 2132, 2978, 2191, 2192, 2193, 2978, 2978, 2978, + /* 490 */ 2978, 2978, 2651, 649, 2163, 618, 2020, 2652, 2018, 41, + /* 500 */ 617, 688, 2044, 882, 956, 53, 52, 685, 616, 59, + /* 510 */ 57, 56, 55, 54, 44, 502, 2152, 2153, 2154, 2155, + /* 520 */ 2156, 2160, 2161, 2162, 140, 2966, 2967, 2081, 168, 2971, + /* 530 */ 2754, 2023, 2024, 2077, 2845, 2079, 2082, 2083, 2084, 2085, + /* 540 */ 2086, 2087, 2088, 2089, 2091, 2092, 2093, 892, 885, 854, + /* 550 */ 3063, 917, 916, 881, 2114, 2115, 2031, 562, 3058, 2121, + /* 560 */ 2123, 2124, 2125, 2126, 2128, 2, 60, 58, 2845, 2194, + /* 570 */ 2019, 1865, 1866, 75, 506, 700, 2019, 3062, 620, 2863, + /* 580 */ 222, 3059, 3060, 897, 2017, 564, 560, 546, 1750, 2078, + /* 590 */ 2017, 1988, 2127, 619, 205, 2810, 332, 896, 1789, 1790, + /* 600 */ 75, 2328, 1563, 1741, 946, 945, 944, 1745, 943, 1747, + /* 610 */ 1748, 942, 939, 2863, 1756, 936, 1758, 1759, 933, 930, + /* 620 */ 927, 1570, 517, 516, 786, 2122, 339, 887, 884, 2810, + /* 630 */ 2049, 896, 19, 2025, 137, 2029, 915, 2521, 886, 2025, + /* 640 */ 701, 2671, 2844, 526, 2523, 2895, 1565, 1568, 1569, 134, + /* 650 */ 2846, 900, 2848, 2849, 895, 12, 530, 883, 2896, 919, + /* 660 */ 915, 2521, 2810, 1022, 213, 117, 2958, 590, 2647, 1022, + /* 670 */ 500, 2954, 15, 572, 971, 571, 2844, 915, 2521, 2895, + /* 680 */ 161, 2845, 521, 135, 2846, 900, 2848, 2849, 895, 731, + /* 690 */ 842, 883, 2896, 919, 487, 2725, 897, 236, 3006, 1920, + /* 700 */ 2958, 2503, 473, 2194, 2957, 2954, 570, 693, 2717, 2130, + /* 710 */ 2131, 2575, 2576, 2978, 2191, 2192, 2193, 2978, 2978, 2978, + /* 720 */ 2978, 2978, 247, 53, 52, 783, 2863, 59, 57, 56, + /* 730 */ 55, 54, 752, 751, 750, 851, 170, 915, 2521, 742, + /* 740 */ 167, 746, 2810, 2025, 896, 745, 973, 2973, 2080, 2090, + /* 750 */ 744, 749, 480, 479, 915, 2521, 743, 161, 2129, 2132, + /* 760 */ 478, 739, 738, 737, 1597, 1598, 736, 2020, 339, 2018, + /* 770 */ 915, 2521, 43, 2020, 68, 2018, 2970, 2048, 53, 52, + /* 780 */ 882, 389, 59, 57, 56, 55, 54, 267, 2047, 2844, + /* 790 */ 578, 686, 2895, 2362, 2496, 339, 199, 2846, 900, 2848, + /* 800 */ 2849, 895, 2023, 2024, 883, 2896, 919, 2304, 2023, 2024, + /* 810 */ 2077, 2845, 2079, 2082, 2083, 2084, 2085, 2086, 2087, 2088, + /* 820 */ 2089, 2091, 2092, 2093, 892, 885, 897, 176, 917, 916, + /* 830 */ 881, 2114, 2115, 947, 2265, 2044, 2121, 2123, 2124, 2125, + /* 840 */ 2126, 2128, 2, 12, 60, 58, 803, 3016, 2191, 2192, + /* 850 */ 2193, 269, 506, 195, 2019, 686, 2863, 2362, 786, 1686, + /* 860 */ 1750, 201, 2966, 2967, 2527, 168, 2971, 1987, 2017, 198, + /* 870 */ 2127, 2318, 2810, 2508, 896, 1741, 946, 945, 944, 1745, + /* 880 */ 943, 1747, 1748, 891, 890, 2581, 1756, 889, 1758, 1759, + /* 890 */ 888, 930, 927, 464, 596, 2647, 2973, 539, 520, 519, + /* 900 */ 346, 347, 538, 2122, 2579, 345, 884, 638, 1688, 396, + /* 910 */ 19, 3019, 2196, 2197, 2198, 2199, 2200, 2025, 1681, 2844, + /* 920 */ 915, 2521, 2895, 627, 2647, 2969, 135, 2846, 900, 2848, + /* 930 */ 2849, 895, 915, 2521, 883, 2896, 919, 2506, 915, 2521, + /* 940 */ 579, 788, 2717, 2958, 2845, 915, 2521, 1022, 2955, 249, + /* 950 */ 15, 2327, 598, 226, 802, 2581, 915, 2521, 612, 897, + /* 960 */ 2764, 2364, 3058, 496, 337, 613, 190, 1682, 703, 486, + /* 970 */ 2725, 409, 533, 532, 2579, 256, 614, 1594, 254, 1593, + /* 980 */ 3064, 231, 2033, 2581, 839, 3059, 840, 2130, 2131, 2863, + /* 990 */ 407, 89, 3058, 395, 88, 2326, 2026, 12, 2127, 10, + /* 1000 */ 637, 255, 858, 470, 2495, 2810, 314, 896, 447, 2081, + /* 1010 */ 838, 231, 2810, 2049, 635, 3059, 840, 802, 1595, 402, + /* 1020 */ 265, 661, 659, 656, 654, 3058, 2080, 2090, 2665, 974, + /* 1030 */ 704, 2122, 2478, 1702, 53, 52, 2129, 2132, 59, 57, + /* 1040 */ 56, 55, 54, 3064, 231, 2025, 2581, 1701, 3059, 840, + /* 1050 */ 91, 2020, 2844, 2018, 511, 2895, 2810, 2048, 882, 134, + /* 1060 */ 2846, 900, 2848, 2849, 895, 2579, 75, 883, 2896, 919, + /* 1070 */ 875, 2078, 2930, 2325, 3078, 879, 2958, 56, 55, 54, + /* 1080 */ 500, 2954, 14, 13, 574, 1570, 2023, 2024, 2077, 573, + /* 1090 */ 2079, 2082, 2083, 2084, 2085, 2086, 2087, 2088, 2089, 2091, + /* 1100 */ 2092, 2093, 892, 885, 104, 76, 917, 916, 881, 2114, + /* 1110 */ 2115, 1568, 1569, 2324, 2121, 2123, 2124, 2125, 2126, 2128, + /* 1120 */ 2, 60, 58, 2133, 915, 2521, 651, 2323, 2525, 506, + /* 1130 */ 2322, 2019, 53, 52, 2810, 2370, 59, 57, 56, 55, + /* 1140 */ 54, 802, 306, 775, 705, 2017, 305, 2127, 171, 3058, + /* 1150 */ 759, 2929, 954, 187, 186, 951, 950, 949, 184, 101, + /* 1160 */ 100, 577, 915, 2521, 244, 773, 509, 3064, 231, 2492, + /* 1170 */ 2321, 40, 3059, 840, 2810, 2319, 195, 569, 567, 2034, + /* 1180 */ 2122, 2029, 2516, 884, 304, 725, 724, 2526, 2810, 444, + /* 1190 */ 2405, 2810, 556, 1009, 2025, 552, 548, 544, 541, 570, + /* 1200 */ 2171, 53, 52, 762, 2246, 59, 57, 56, 55, 54, + /* 1210 */ 756, 754, 915, 2521, 2037, 2039, 948, 301, 2247, 2572, + /* 1220 */ 116, 2845, 727, 726, 1022, 453, 34, 61, 485, 2581, + /* 1230 */ 774, 2810, 309, 234, 917, 916, 897, 527, 3013, 748, + /* 1240 */ 747, 2320, 2121, 2123, 2124, 2125, 2126, 2128, 2579, 915, + /* 1250 */ 2521, 53, 52, 915, 2521, 59, 57, 56, 55, 54, + /* 1260 */ 2216, 339, 2453, 85, 2130, 2131, 2863, 2245, 84, 317, + /* 1270 */ 752, 751, 750, 857, 2044, 205, 809, 742, 167, 746, + /* 1280 */ 97, 801, 2810, 745, 896, 915, 2521, 2317, 744, 749, + /* 1290 */ 480, 479, 822, 2049, 743, 915, 2521, 173, 478, 739, + /* 1300 */ 738, 737, 2810, 2080, 2090, 350, 915, 2521, 2511, 877, + /* 1310 */ 833, 2930, 2266, 2129, 2132, 871, 553, 954, 187, 186, + /* 1320 */ 951, 950, 949, 184, 126, 776, 357, 2316, 2020, 2844, + /* 1330 */ 2018, 2159, 2895, 985, 983, 882, 134, 2846, 900, 2848, + /* 1340 */ 2849, 895, 2581, 238, 883, 2896, 919, 952, 2810, 2592, + /* 1350 */ 2572, 3078, 2512, 2958, 2493, 2315, 403, 500, 2954, 2314, + /* 1360 */ 2558, 866, 2241, 2023, 2024, 2077, 2845, 2079, 2082, 2083, + /* 1370 */ 2084, 2085, 2086, 2087, 2088, 2089, 2091, 2092, 2093, 892, + /* 1380 */ 885, 897, 2205, 917, 916, 881, 2114, 2115, 2810, 915, + /* 1390 */ 2521, 2121, 2123, 2124, 2125, 2126, 2128, 2, 60, 58, + /* 1400 */ 2845, 915, 2521, 915, 2521, 2313, 506, 2312, 2019, 908, + /* 1410 */ 2164, 2863, 915, 2521, 2311, 897, 2810, 3026, 396, 2310, + /* 1420 */ 2810, 909, 2017, 913, 2127, 73, 2309, 2810, 185, 896, + /* 1430 */ 42, 956, 385, 53, 52, 2973, 799, 59, 57, 56, + /* 1440 */ 55, 54, 53, 52, 529, 2863, 59, 57, 56, 55, + /* 1450 */ 54, 2581, 953, 1572, 195, 2572, 2630, 2122, 735, 2043, + /* 1460 */ 884, 2810, 734, 896, 2968, 2526, 2810, 113, 2810, 2583, + /* 1470 */ 2580, 2025, 2731, 294, 2844, 2810, 292, 2895, 177, 2726, + /* 1480 */ 2810, 413, 2846, 900, 2848, 2849, 895, 2810, 32, 883, + /* 1490 */ 2896, 919, 196, 2334, 1015, 3, 2515, 333, 2845, 843, + /* 1500 */ 588, 1022, 2524, 846, 61, 2112, 922, 632, 2844, 66, + /* 1510 */ 2078, 2895, 2027, 897, 67, 134, 2846, 900, 2848, 2849, + /* 1520 */ 895, 163, 177, 883, 2896, 919, 296, 852, 298, 295, + /* 1530 */ 3078, 297, 2958, 185, 308, 103, 500, 2954, 2389, 740, + /* 1540 */ 741, 2130, 2131, 2863, 2104, 300, 2298, 2299, 299, 325, + /* 1550 */ 53, 52, 812, 2235, 59, 57, 56, 55, 54, 2810, + /* 1560 */ 753, 896, 1679, 1677, 1936, 14, 13, 165, 53, 52, + /* 1570 */ 880, 2215, 59, 57, 56, 55, 54, 2864, 53, 52, + /* 1580 */ 2080, 2090, 59, 57, 56, 55, 54, 2444, 1658, 47, + /* 1590 */ 2129, 2132, 53, 52, 62, 62, 59, 57, 56, 55, + /* 1600 */ 54, 132, 214, 129, 62, 2020, 2844, 2018, 1944, 2895, + /* 1610 */ 2387, 2378, 882, 134, 2846, 900, 2848, 2849, 895, 856, + /* 1620 */ 344, 883, 2896, 919, 364, 363, 2831, 647, 2933, 2443, + /* 1630 */ 2958, 2355, 755, 757, 500, 2954, 2376, 1659, 2239, 3009, + /* 1640 */ 2023, 2024, 2077, 819, 2079, 2082, 2083, 2084, 2085, 2086, + /* 1650 */ 2087, 2088, 2089, 2091, 2092, 2093, 892, 885, 760, 492, + /* 1660 */ 917, 916, 881, 2114, 2115, 488, 90, 62, 2121, 2123, + /* 1670 */ 2124, 2125, 2126, 2128, 2, 60, 58, 2845, 77, 2100, + /* 1680 */ 2251, 2250, 779, 506, 826, 2019, 62, 860, 323, 2102, + /* 1690 */ 2113, 62, 897, 2833, 816, 366, 365, 2030, 46, 2017, + /* 1700 */ 62, 2127, 2656, 2105, 90, 537, 348, 53, 52, 555, + /* 1710 */ 39, 59, 57, 56, 55, 54, 2361, 923, 2569, 53, + /* 1720 */ 52, 795, 2863, 59, 57, 56, 55, 54, 2845, 87, + /* 1730 */ 368, 367, 370, 369, 2122, 372, 371, 884, 2810, 802, + /* 1740 */ 896, 182, 163, 897, 3010, 185, 2149, 3058, 2025, 374, + /* 1750 */ 373, 965, 863, 2103, 376, 375, 378, 377, 48, 380, + /* 1760 */ 379, 382, 381, 925, 2165, 3064, 231, 384, 383, 183, + /* 1770 */ 3059, 840, 2106, 2863, 1650, 966, 185, 2094, 1022, 3020, + /* 1780 */ 335, 61, 834, 835, 1631, 2844, 1889, 330, 2895, 2810, + /* 1790 */ 1879, 896, 134, 2846, 900, 2848, 2849, 895, 1648, 164, + /* 1800 */ 883, 2896, 919, 2657, 844, 338, 2479, 3078, 540, 2958, + /* 1810 */ 847, 182, 5, 500, 2954, 401, 53, 52, 2130, 2131, + /* 1820 */ 59, 57, 56, 55, 54, 545, 462, 360, 912, 2042, + /* 1830 */ 2099, 1732, 554, 1632, 2052, 566, 2844, 565, 239, 2895, + /* 1840 */ 1913, 582, 240, 135, 2846, 900, 2848, 2849, 895, 1763, + /* 1850 */ 568, 883, 2896, 919, 394, 1771, 242, 2080, 2090, 2043, + /* 1860 */ 2958, 589, 1778, 253, 878, 2954, 591, 2129, 2132, 53, + /* 1870 */ 52, 597, 595, 59, 57, 56, 55, 54, 640, 602, + /* 1880 */ 615, 2649, 2020, 628, 2018, 1776, 53, 52, 626, 882, + /* 1890 */ 59, 57, 56, 55, 54, 636, 639, 188, 652, 477, + /* 1900 */ 475, 641, 650, 653, 259, 258, 657, 655, 658, 262, + /* 1910 */ 660, 662, 2050, 681, 4, 682, 689, 2023, 2024, 2077, + /* 1920 */ 692, 2079, 2082, 2083, 2084, 2085, 2086, 2087, 2088, 2089, + /* 1930 */ 2091, 2092, 2093, 892, 885, 690, 270, 917, 916, 881, + /* 1940 */ 2114, 2115, 2045, 787, 109, 2121, 2123, 2124, 2125, 2126, + /* 1950 */ 2128, 2, 60, 58, 694, 273, 2051, 695, 2053, 696, + /* 1960 */ 506, 276, 2019, 698, 855, 278, 2054, 2672, 110, 2055, + /* 1970 */ 1730, 49, 2666, 111, 2845, 730, 2017, 284, 2127, 707, + /* 1980 */ 2101, 112, 474, 472, 114, 733, 2740, 287, 763, 897, + /* 1990 */ 764, 3051, 2737, 732, 2509, 139, 291, 2098, 439, 778, + /* 2000 */ 802, 2736, 2505, 780, 138, 2845, 735, 115, 3058, 178, + /* 2010 */ 734, 2122, 2046, 397, 884, 293, 191, 136, 2507, 2863, + /* 2020 */ 897, 802, 2502, 192, 2718, 2025, 3064, 231, 193, 3058, + /* 2030 */ 310, 3059, 840, 791, 789, 2810, 790, 896, 794, 315, + /* 2040 */ 823, 313, 3025, 796, 797, 806, 861, 3064, 231, 3024, + /* 2050 */ 2863, 832, 3059, 840, 8, 1022, 2845, 2997, 61, 204, + /* 2060 */ 807, 320, 326, 322, 324, 805, 2810, 804, 896, 837, + /* 2070 */ 327, 897, 328, 2990, 329, 836, 493, 2977, 331, 848, + /* 2080 */ 334, 3081, 2844, 845, 3057, 2895, 169, 2047, 2213, 134, + /* 2090 */ 2846, 900, 2848, 2849, 895, 2130, 2131, 883, 2896, 919, + /* 2100 */ 2211, 2863, 2974, 217, 3078, 340, 2958, 179, 398, 859, + /* 2110 */ 500, 2954, 2686, 898, 1, 2685, 2895, 2810, 2684, 896, + /* 2120 */ 135, 2846, 900, 2848, 2849, 895, 497, 399, 883, 2896, + /* 2130 */ 919, 864, 180, 869, 2080, 2090, 865, 2958, 872, 353, + /* 2140 */ 74, 457, 2954, 233, 2129, 2132, 2939, 902, 906, 400, + /* 2150 */ 904, 2802, 907, 2801, 358, 2797, 2796, 2788, 125, 2020, + /* 2160 */ 2522, 2018, 128, 2787, 2844, 387, 882, 2895, 1542, 2779, + /* 2170 */ 921, 134, 2846, 900, 2848, 2849, 895, 2778, 404, 883, + /* 2180 */ 2896, 919, 2794, 1018, 1019, 2793, 3078, 782, 2958, 1017, + /* 2190 */ 1014, 406, 500, 2954, 2023, 2024, 2077, 189, 2079, 2082, + /* 2200 */ 2083, 2084, 2085, 2086, 2087, 2088, 2089, 2091, 2092, 2093, + /* 2210 */ 892, 885, 2785, 390, 917, 916, 881, 2114, 2115, 391, + /* 2220 */ 2784, 1021, 2121, 2123, 2124, 2125, 2126, 2128, 2, 60, + /* 2230 */ 58, 440, 2773, 2772, 2791, 476, 2790, 506, 2782, 2019, + /* 2240 */ 2781, 65, 2770, 2769, 2767, 2766, 427, 2573, 454, 455, + /* 2250 */ 438, 2845, 524, 2017, 428, 2127, 408, 2762, 2761, 2760, + /* 2260 */ 98, 2755, 542, 543, 1970, 547, 897, 1971, 237, 2753, + /* 2270 */ 549, 550, 551, 1969, 2752, 2751, 463, 2749, 557, 2748, + /* 2280 */ 559, 2747, 561, 2746, 563, 1957, 2722, 241, 2122, 2721, + /* 2290 */ 243, 884, 99, 1916, 1915, 2699, 2863, 2698, 2697, 575, + /* 2300 */ 576, 2696, 2025, 2695, 2639, 580, 1852, 2636, 583, 2635, + /* 2310 */ 2629, 2626, 2810, 587, 896, 246, 586, 2625, 102, 2624, + /* 2320 */ 2623, 2628, 2627, 2622, 248, 2621, 2619, 449, 448, 2618, + /* 2330 */ 2617, 250, 1022, 2845, 2616, 15, 603, 513, 605, 2614, + /* 2340 */ 2613, 2612, 2611, 2610, 2634, 2609, 2608, 2607, 897, 2632, + /* 2350 */ 2615, 522, 2606, 2127, 2605, 2604, 2602, 2601, 2600, 2844, + /* 2360 */ 2599, 2598, 2895, 2597, 252, 2596, 134, 2846, 900, 2848, + /* 2370 */ 2849, 895, 2130, 2131, 883, 2896, 919, 2595, 2863, 108, + /* 2380 */ 2594, 2931, 2593, 2958, 2591, 2590, 2122, 500, 2954, 2664, + /* 2390 */ 2633, 2631, 2589, 2588, 2810, 1858, 896, 2587, 2586, 257, + /* 2400 */ 643, 2585, 645, 2584, 2582, 1699, 2409, 260, 1703, 2408, + /* 2410 */ 1695, 2080, 2090, 2407, 451, 2406, 452, 2404, 2401, 261, + /* 2420 */ 665, 2129, 2132, 663, 263, 664, 2400, 668, 2393, 672, + /* 2430 */ 264, 667, 669, 2380, 2368, 671, 2020, 677, 2018, 2367, + /* 2440 */ 673, 2844, 2350, 882, 2895, 2830, 675, 679, 134, 2846, + /* 2450 */ 900, 2848, 2849, 895, 266, 212, 883, 2896, 919, 223, + /* 2460 */ 94, 1571, 2349, 876, 268, 2958, 2720, 2716, 95, 500, + /* 2470 */ 2954, 2023, 2024, 2077, 687, 2079, 2082, 2083, 2084, 2085, + /* 2480 */ 2086, 2087, 2088, 2089, 2091, 2092, 2093, 892, 885, 784, + /* 2490 */ 2706, 917, 916, 881, 2114, 2115, 2694, 275, 277, 2121, + /* 2500 */ 2123, 2124, 2125, 2126, 2128, 2, 2693, 1025, 280, 2670, + /* 2510 */ 282, 2663, 2497, 2403, 1624, 2845, 2399, 708, 709, 710, + /* 2520 */ 2397, 712, 713, 714, 2395, 716, 393, 717, 718, 2392, + /* 2530 */ 897, 720, 2375, 721, 2010, 722, 1986, 2373, 2374, 2372, + /* 2540 */ 2369, 1013, 1011, 728, 2346, 221, 2499, 290, 86, 1782, + /* 2550 */ 1783, 2498, 1685, 1684, 1007, 1003, 999, 995, 1683, 388, + /* 2560 */ 2863, 1680, 1678, 2390, 1676, 2388, 982, 515, 514, 2011, + /* 2570 */ 1675, 1674, 1673, 2379, 1667, 984, 2810, 1672, 896, 1669, + /* 2580 */ 481, 1668, 482, 1666, 483, 2377, 484, 2345, 2344, 917, + /* 2590 */ 916, 761, 2343, 765, 2342, 767, 2341, 2121, 2123, 2124, + /* 2600 */ 2125, 2126, 2128, 769, 2340, 133, 771, 758, 1951, 141, + /* 2610 */ 361, 1953, 1950, 1955, 2719, 33, 80, 312, 2715, 1922, + /* 2620 */ 1924, 2845, 2705, 2844, 792, 69, 2895, 70, 1926, 316, + /* 2630 */ 202, 2846, 900, 2848, 2849, 895, 897, 1941, 883, 2896, + /* 2640 */ 919, 867, 793, 2692, 2845, 781, 2691, 194, 1901, 798, + /* 2650 */ 1900, 800, 3063, 22, 808, 17, 23, 811, 6, 897, + /* 2660 */ 489, 7, 24, 216, 228, 2206, 2863, 35, 2831, 2268, + /* 2670 */ 38, 319, 229, 2242, 36, 78, 2208, 26, 2283, 336, + /* 2680 */ 2240, 2282, 2810, 494, 896, 817, 359, 813, 873, 2863, + /* 2690 */ 815, 342, 841, 3079, 2287, 203, 341, 321, 2249, 215, + /* 2700 */ 37, 2286, 495, 72, 96, 2810, 503, 896, 208, 2234, + /* 2710 */ 2204, 230, 2690, 2669, 2288, 311, 2289, 119, 25, 2188, + /* 2720 */ 2845, 120, 2187, 2668, 343, 121, 2244, 2662, 218, 2844, + /* 2730 */ 349, 122, 2895, 82, 71, 897, 437, 2846, 900, 2848, + /* 2740 */ 2849, 895, 27, 352, 883, 2896, 919, 13, 18, 209, + /* 2750 */ 868, 2140, 2844, 11, 2139, 2895, 2035, 2150, 219, 199, + /* 2760 */ 2846, 900, 2848, 2849, 895, 2863, 21, 883, 2896, 919, + /* 2770 */ 28, 2845, 29, 351, 20, 2070, 899, 50, 2661, 123, + /* 2780 */ 2097, 2810, 2096, 896, 129, 932, 897, 935, 2494, 938, + /* 2790 */ 910, 941, 51, 362, 2095, 2062, 16, 30, 31, 2302, + /* 2800 */ 862, 83, 1755, 903, 2845, 490, 356, 870, 124, 354, + /* 2810 */ 3017, 92, 911, 2908, 2907, 905, 2863, 924, 2109, 897, + /* 2820 */ 918, 81, 525, 920, 1764, 1761, 926, 928, 2844, 929, + /* 2830 */ 931, 2895, 2810, 1760, 896, 437, 2846, 900, 2848, 2849, + /* 2840 */ 895, 1757, 934, 883, 2896, 919, 937, 1751, 1749, 2863, + /* 2850 */ 940, 2301, 386, 1777, 130, 1754, 491, 1753, 1752, 131, + /* 2860 */ 1773, 93, 1622, 955, 1663, 2810, 1662, 896, 1661, 2845, + /* 2870 */ 1660, 1657, 1654, 1653, 1693, 1652, 1651, 1649, 1692, 2844, + /* 2880 */ 1640, 1647, 2895, 1646, 897, 1645, 437, 2846, 900, 2848, + /* 2890 */ 2849, 895, 2845, 235, 883, 2896, 919, 1643, 1642, 1641, + /* 2900 */ 1639, 1638, 970, 1637, 972, 1689, 1687, 894, 1634, 1633, + /* 2910 */ 1630, 1629, 2844, 1628, 2863, 2895, 1627, 2398, 992, 430, + /* 2920 */ 2846, 900, 2848, 2849, 895, 993, 2396, 883, 2896, 919, + /* 2930 */ 2810, 994, 896, 996, 997, 2394, 998, 2863, 1000, 1002, + /* 2940 */ 1001, 2391, 1004, 1005, 1006, 2371, 1008, 2366, 2365, 1010, + /* 2950 */ 1012, 1560, 2339, 2810, 1543, 896, 1016, 1548, 1550, 392, + /* 2960 */ 2845, 1020, 2305, 2305, 2021, 405, 2305, 1023, 2305, 1024, + /* 2970 */ 2305, 2305, 2305, 831, 2305, 897, 2305, 2844, 2305, 2305, + /* 2980 */ 2895, 2305, 2305, 2305, 202, 2846, 900, 2848, 2849, 895, + /* 2990 */ 2305, 2305, 883, 2896, 919, 2305, 2305, 2305, 2305, 2305, + /* 3000 */ 2844, 2305, 2305, 2895, 2305, 2863, 2305, 436, 2846, 900, + /* 3010 */ 2848, 2849, 895, 2305, 2305, 883, 2896, 919, 2305, 2924, + /* 3020 */ 2305, 2810, 2305, 896, 2305, 2845, 2305, 289, 2305, 2305, + /* 3030 */ 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2305, + /* 3040 */ 897, 2305, 2305, 729, 2305, 504, 206, 3080, 2305, 2305, + /* 3050 */ 2305, 2305, 2845, 2305, 2305, 723, 719, 715, 711, 2305, + /* 3060 */ 288, 2305, 2305, 2305, 2305, 2305, 2305, 897, 2844, 2305, + /* 3070 */ 2863, 2895, 2305, 2305, 2305, 437, 2846, 900, 2848, 2849, + /* 3080 */ 895, 2305, 2305, 883, 2896, 919, 2810, 2305, 896, 2305, + /* 3090 */ 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2863, 2305, 2305, + /* 3100 */ 2305, 2305, 2305, 2305, 2305, 2305, 286, 2305, 2305, 2305, + /* 3110 */ 499, 285, 2305, 2810, 2305, 896, 2305, 2305, 2305, 2305, + /* 3120 */ 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2305, + /* 3130 */ 2305, 2305, 2305, 2844, 2305, 2305, 2895, 505, 2845, 2305, + /* 3140 */ 422, 2846, 900, 2848, 2849, 895, 2305, 2305, 883, 2896, + /* 3150 */ 919, 2305, 2305, 897, 2305, 2305, 2305, 2305, 2845, 2305, + /* 3160 */ 2844, 2305, 2305, 2895, 2305, 2305, 2305, 437, 2846, 900, + /* 3170 */ 2848, 2849, 895, 897, 2305, 883, 2896, 919, 272, 2845, + /* 3180 */ 2305, 2305, 2305, 2863, 2305, 2305, 2305, 283, 2305, 2305, + /* 3190 */ 2305, 274, 281, 2305, 897, 2305, 2305, 279, 697, 2810, + /* 3200 */ 2305, 896, 2305, 2863, 2305, 2305, 2305, 2305, 2305, 2305, + /* 3210 */ 2305, 2305, 2305, 2305, 2305, 2305, 271, 2305, 2305, 2810, + /* 3220 */ 2305, 896, 2305, 507, 2863, 2305, 2305, 2305, 2305, 2305, + /* 3230 */ 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2305, + /* 3240 */ 2810, 2305, 896, 2305, 2305, 2305, 2844, 2305, 2305, 2895, + /* 3250 */ 2305, 2305, 2305, 437, 2846, 900, 2848, 2849, 895, 2305, + /* 3260 */ 2305, 883, 2896, 919, 2305, 2305, 2844, 2305, 2305, 2895, + /* 3270 */ 2305, 2305, 2305, 418, 2846, 900, 2848, 2849, 895, 2305, + /* 3280 */ 2305, 883, 2896, 919, 2305, 2845, 2305, 777, 2305, 2305, + /* 3290 */ 2895, 2305, 2305, 2305, 432, 2846, 900, 2848, 2849, 895, + /* 3300 */ 897, 2305, 883, 2896, 919, 2845, 2305, 2305, 2305, 2305, + /* 3310 */ 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2305, + /* 3320 */ 897, 2305, 2305, 2305, 2305, 2845, 2305, 2305, 2305, 2305, + /* 3330 */ 2863, 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2305, + /* 3340 */ 897, 2305, 2305, 2305, 2305, 2305, 2810, 2305, 896, 2305, + /* 3350 */ 2863, 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2305, + /* 3360 */ 2305, 2305, 2305, 2305, 2305, 2305, 2810, 2305, 896, 2305, + /* 3370 */ 2863, 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2305, + /* 3380 */ 2305, 2305, 2305, 2305, 2305, 2305, 2810, 2305, 896, 2305, + /* 3390 */ 2305, 2305, 2305, 2844, 2305, 2305, 2895, 2305, 2305, 2305, + /* 3400 */ 414, 2846, 900, 2848, 2849, 895, 2305, 2305, 883, 2896, + /* 3410 */ 919, 2305, 2845, 2844, 2305, 2305, 2895, 2305, 2305, 2305, + /* 3420 */ 410, 2846, 900, 2848, 2849, 895, 2305, 897, 883, 2896, + /* 3430 */ 919, 2305, 2305, 2844, 2305, 2305, 2895, 2305, 2845, 2305, + /* 3440 */ 411, 2846, 900, 2848, 2849, 895, 2305, 2305, 883, 2896, + /* 3450 */ 919, 2305, 2305, 897, 2305, 2305, 2305, 2863, 2305, 2305, + /* 3460 */ 2305, 2845, 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2305, + /* 3470 */ 2305, 2305, 2305, 2810, 2305, 896, 897, 2305, 2305, 2305, + /* 3480 */ 2305, 2845, 2305, 2863, 2305, 2305, 2305, 2305, 2305, 2305, + /* 3490 */ 2305, 2305, 2305, 2305, 2305, 2305, 897, 2305, 2305, 2810, + /* 3500 */ 2305, 896, 2305, 2845, 2305, 2305, 2863, 2305, 2305, 2305, + /* 3510 */ 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2305, 897, 2305, + /* 3520 */ 2844, 2305, 2810, 2895, 896, 2305, 2863, 415, 2846, 900, + /* 3530 */ 2848, 2849, 895, 2305, 2305, 883, 2896, 919, 2305, 2305, + /* 3540 */ 2305, 2305, 2810, 2305, 896, 2305, 2844, 2305, 2863, 2895, + /* 3550 */ 2305, 2305, 2305, 429, 2846, 900, 2848, 2849, 895, 2305, + /* 3560 */ 2305, 883, 2896, 919, 2810, 2305, 896, 2305, 2845, 2844, + /* 3570 */ 2305, 2305, 2895, 2305, 2305, 2305, 416, 2846, 900, 2848, + /* 3580 */ 2849, 895, 2305, 897, 883, 2896, 919, 2845, 2305, 2844, + /* 3590 */ 2305, 2305, 2895, 2305, 2305, 2305, 417, 2846, 900, 2848, + /* 3600 */ 2849, 895, 897, 2305, 883, 2896, 919, 2305, 2305, 2845, + /* 3610 */ 2305, 2844, 2305, 2863, 2895, 2305, 2305, 2305, 433, 2846, + /* 3620 */ 900, 2848, 2849, 895, 897, 2305, 883, 2896, 919, 2810, + /* 3630 */ 2305, 896, 2863, 2305, 2305, 2305, 2305, 2305, 2305, 2305, + /* 3640 */ 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2810, 2305, + /* 3650 */ 896, 2305, 2305, 2305, 2863, 2305, 2305, 2305, 2305, 2305, + /* 3660 */ 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2305, + /* 3670 */ 2810, 2305, 896, 2305, 2845, 2305, 2844, 2305, 2305, 2895, + /* 3680 */ 2305, 2305, 2305, 419, 2846, 900, 2848, 2849, 895, 897, + /* 3690 */ 2305, 883, 2896, 919, 2305, 2844, 2305, 2305, 2895, 2305, + /* 3700 */ 2305, 2305, 434, 2846, 900, 2848, 2849, 895, 2305, 2305, + /* 3710 */ 883, 2896, 919, 2305, 2305, 2305, 2305, 2844, 2305, 2863, + /* 3720 */ 2895, 2305, 2305, 2845, 420, 2846, 900, 2848, 2849, 895, + /* 3730 */ 2305, 2305, 883, 2896, 919, 2810, 2305, 896, 897, 2305, + /* 3740 */ 2305, 2305, 2305, 2845, 2305, 2305, 2305, 2305, 2305, 2305, + /* 3750 */ 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2305, 897, 2305, + /* 3760 */ 2305, 2305, 2305, 2845, 2305, 2305, 2305, 2305, 2863, 2305, + /* 3770 */ 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2305, 897, 2305, + /* 3780 */ 2305, 2305, 2844, 2305, 2810, 2895, 896, 2305, 2863, 435, + /* 3790 */ 2846, 900, 2848, 2849, 895, 2305, 2305, 883, 2896, 919, + /* 3800 */ 2305, 2305, 2305, 2305, 2810, 2305, 896, 2305, 2863, 2305, + /* 3810 */ 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2305, + /* 3820 */ 2305, 2305, 2305, 2305, 2810, 2305, 896, 2305, 2305, 2305, + /* 3830 */ 2305, 2844, 2305, 2305, 2895, 2305, 2305, 2305, 421, 2846, + /* 3840 */ 900, 2848, 2849, 895, 2305, 2305, 883, 2896, 919, 2305, + /* 3850 */ 2845, 2844, 2305, 2305, 2895, 2305, 2305, 2305, 412, 2846, + /* 3860 */ 900, 2848, 2849, 895, 2305, 897, 883, 2896, 919, 2845, + /* 3870 */ 2305, 2844, 2305, 2305, 2895, 2305, 2305, 2305, 423, 2846, + /* 3880 */ 900, 2848, 2849, 895, 897, 2305, 883, 2896, 919, 2845, + /* 3890 */ 2305, 2305, 2305, 2305, 2305, 2863, 2305, 2305, 2305, 2305, + /* 3900 */ 2305, 2305, 2305, 2305, 897, 2305, 2305, 2305, 2305, 2305, + /* 3910 */ 2305, 2810, 2305, 896, 2863, 2305, 2305, 2305, 2305, 2305, + /* 3920 */ 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2305, + /* 3930 */ 2810, 2305, 896, 2305, 2863, 2305, 2305, 2305, 2305, 2305, + /* 3940 */ 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2305, + /* 3950 */ 2810, 2305, 896, 2305, 2305, 2305, 2845, 2305, 2844, 2305, + /* 3960 */ 2305, 2895, 2305, 2305, 2305, 424, 2846, 900, 2848, 2849, + /* 3970 */ 895, 897, 2305, 883, 2896, 919, 2845, 2844, 2305, 2305, + /* 3980 */ 2895, 2305, 2305, 2305, 425, 2846, 900, 2848, 2849, 895, + /* 3990 */ 2305, 897, 883, 2896, 919, 2845, 2305, 2844, 2305, 2305, + /* 4000 */ 2895, 2863, 2305, 2305, 426, 2846, 900, 2848, 2849, 895, + /* 4010 */ 897, 2305, 883, 2896, 919, 2305, 2305, 2810, 2305, 896, + /* 4020 */ 2305, 2863, 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2305, + /* 4030 */ 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2810, 2305, 896, + /* 4040 */ 2863, 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2305, + /* 4050 */ 2305, 2305, 2305, 2305, 2305, 2305, 2810, 2305, 896, 2305, + /* 4060 */ 2305, 2305, 2305, 2845, 2844, 2305, 2305, 2895, 2305, 2305, + /* 4070 */ 2305, 442, 2846, 900, 2848, 2849, 895, 2305, 897, 883, + /* 4080 */ 2896, 919, 2845, 2305, 2844, 2305, 2305, 2895, 2305, 2305, + /* 4090 */ 2305, 443, 2846, 900, 2848, 2849, 895, 897, 2305, 883, + /* 4100 */ 2896, 919, 2305, 2844, 2305, 2305, 2895, 2305, 2863, 2305, + /* 4110 */ 2857, 2846, 900, 2848, 2849, 895, 2305, 2305, 883, 2896, + /* 4120 */ 919, 2305, 2305, 2305, 2810, 2305, 896, 2863, 2305, 2305, + /* 4130 */ 2305, 2845, 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2305, + /* 4140 */ 2305, 2305, 2305, 2810, 2305, 896, 897, 2305, 2305, 2305, + /* 4150 */ 2305, 2845, 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2305, + /* 4160 */ 2305, 2305, 2305, 2305, 2305, 2305, 897, 2305, 2305, 2305, + /* 4170 */ 2305, 2844, 2305, 2305, 2895, 2305, 2863, 2305, 2856, 2846, + /* 4180 */ 900, 2848, 2849, 895, 2305, 2305, 883, 2896, 919, 2305, + /* 4190 */ 2844, 2305, 2810, 2895, 896, 2305, 2863, 2855, 2846, 900, + /* 4200 */ 2848, 2849, 895, 2305, 2305, 883, 2896, 919, 2305, 2305, + /* 4210 */ 2305, 2305, 2810, 2305, 896, 2305, 2305, 2305, 2305, 2845, + /* 4220 */ 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2305, + /* 4230 */ 2305, 2305, 2305, 2305, 897, 2305, 2305, 2305, 2305, 2844, + /* 4240 */ 2305, 2305, 2895, 2845, 2305, 2305, 459, 2846, 900, 2848, + /* 4250 */ 2849, 895, 2305, 2305, 883, 2896, 919, 2305, 897, 2844, + /* 4260 */ 2305, 2305, 2895, 2305, 2863, 2305, 460, 2846, 900, 2848, + /* 4270 */ 2849, 895, 2305, 2305, 883, 2896, 919, 2305, 2305, 2305, + /* 4280 */ 2810, 2305, 896, 2305, 2305, 2305, 2305, 2305, 2863, 2305, + /* 4290 */ 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2305, + /* 4300 */ 2305, 2305, 2305, 2305, 2810, 2305, 896, 2305, 2305, 2305, + /* 4310 */ 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2305, + /* 4320 */ 2305, 2305, 2305, 2305, 2305, 2845, 2305, 2844, 2305, 2305, + /* 4330 */ 2895, 2305, 2305, 2305, 456, 2846, 900, 2848, 2849, 895, + /* 4340 */ 897, 2305, 883, 2896, 919, 2305, 2305, 2305, 2305, 2845, + /* 4350 */ 2305, 2844, 2305, 2305, 2895, 2305, 2305, 2305, 461, 2846, + /* 4360 */ 900, 2848, 2849, 895, 897, 2305, 883, 2896, 919, 2305, + /* 4370 */ 2863, 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2305, + /* 4380 */ 2305, 2305, 2305, 2305, 2305, 2305, 2810, 2305, 896, 2305, + /* 4390 */ 2305, 2305, 2305, 2305, 2863, 2305, 2305, 2305, 2305, 2305, + /* 4400 */ 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2305, + /* 4410 */ 2810, 2305, 896, 2305, 2305, 2305, 2305, 2305, 2305, 2305, + /* 4420 */ 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2305, + /* 4430 */ 2305, 2305, 2305, 898, 2305, 2305, 2895, 2305, 2305, 2305, + /* 4440 */ 432, 2846, 900, 2848, 2849, 895, 2305, 2305, 883, 2896, + /* 4450 */ 919, 2305, 2305, 2305, 2305, 2305, 2305, 2844, 2305, 2305, + /* 4460 */ 2895, 2305, 2305, 2305, 431, 2846, 900, 2848, 2849, 895, + /* 4470 */ 2305, 2305, 883, 2896, 919, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 536, 401, 536, 401, 404, 405, 404, 405, 544, 437, - /* 10 */ 544, 423, 12, 13, 4, 12, 13, 14, 15, 16, - /* 20 */ 20, 0, 22, 438, 406, 407, 562, 563, 456, 563, - /* 30 */ 423, 567, 568, 567, 568, 538, 36, 540, 38, 0, - /* 40 */ 20, 453, 21, 392, 426, 24, 25, 26, 27, 28, - /* 50 */ 29, 30, 31, 32, 20, 406, 407, 431, 407, 34, - /* 60 */ 453, 8, 9, 437, 54, 12, 13, 14, 15, 16, - /* 70 */ 0, 71, 21, 20, 74, 24, 25, 26, 27, 28, - /* 80 */ 29, 30, 31, 32, 499, 85, 20, 455, 437, 20, - /* 90 */ 464, 503, 504, 505, 24, 25, 26, 27, 28, 29, - /* 100 */ 30, 31, 32, 14, 453, 517, 455, 475, 476, 20, - /* 110 */ 503, 504, 20, 479, 22, 115, 406, 407, 118, 80, + /* 0 */ 536, 401, 536, 455, 404, 405, 415, 440, 544, 4, + /* 10 */ 544, 423, 12, 13, 485, 12, 13, 14, 15, 16, + /* 20 */ 20, 0, 22, 475, 476, 434, 562, 563, 436, 563, + /* 30 */ 423, 567, 568, 567, 568, 444, 36, 440, 38, 0, + /* 40 */ 443, 453, 21, 392, 452, 24, 25, 26, 27, 28, + /* 50 */ 29, 30, 31, 32, 437, 406, 407, 20, 407, 54, + /* 60 */ 453, 8, 9, 446, 447, 12, 13, 14, 15, 16, + /* 70 */ 503, 71, 21, 20, 74, 24, 25, 26, 27, 28, + /* 80 */ 29, 30, 31, 32, 517, 85, 20, 455, 437, 8, + /* 90 */ 9, 503, 504, 12, 13, 14, 15, 16, 59, 401, + /* 100 */ 503, 469, 404, 405, 453, 517, 455, 475, 476, 20, + /* 110 */ 503, 504, 505, 479, 517, 115, 406, 407, 118, 80, /* 120 */ 81, 82, 83, 84, 517, 86, 87, 88, 89, 90, /* 130 */ 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, /* 140 */ 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, - /* 150 */ 111, 500, 118, 61, 503, 155, 156, 416, 507, 508, - /* 160 */ 509, 510, 511, 512, 118, 424, 515, 516, 517, 20, + /* 150 */ 111, 500, 440, 438, 503, 155, 156, 120, 507, 508, + /* 160 */ 509, 510, 511, 512, 525, 526, 515, 516, 517, 20, /* 170 */ 536, 21, 20, 522, 22, 524, 20, 71, 544, 528, /* 180 */ 529, 532, 533, 534, 118, 536, 537, 37, 36, 39, - /* 190 */ 40, 41, 42, 544, 194, 195, 562, 563, 391, 548, - /* 200 */ 393, 567, 568, 3, 204, 205, 451, 556, 427, 454, - /* 210 */ 455, 562, 563, 61, 194, 195, 567, 568, 437, 219, - /* 220 */ 20, 221, 199, 117, 20, 44, 226, 14, 122, 448, - /* 230 */ 8, 9, 20, 20, 12, 13, 14, 15, 16, 57, - /* 240 */ 118, 531, 532, 533, 534, 4, 536, 537, 66, 196, + /* 190 */ 40, 41, 42, 544, 194, 195, 562, 563, 20, 548, + /* 200 */ 20, 567, 568, 3, 204, 205, 451, 556, 118, 454, + /* 210 */ 455, 562, 563, 61, 499, 503, 567, 568, 20, 219, + /* 220 */ 20, 221, 199, 117, 416, 44, 226, 14, 122, 517, + /* 230 */ 8, 9, 424, 20, 12, 13, 14, 15, 16, 57, + /* 240 */ 118, 531, 532, 533, 534, 20, 536, 537, 66, 196, /* 250 */ 71, 69, 70, 406, 254, 255, 256, 392, 258, 259, /* 260 */ 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, - /* 270 */ 270, 271, 407, 20, 274, 275, 276, 277, 278, 279, + /* 270 */ 270, 271, 407, 149, 274, 275, 276, 277, 278, 279, /* 280 */ 280, 281, 282, 283, 284, 285, 286, 287, 288, 12, - /* 290 */ 13, 14, 406, 392, 18, 189, 20, 20, 118, 22, + /* 290 */ 13, 14, 211, 392, 18, 189, 20, 20, 0, 22, /* 300 */ 78, 122, 437, 27, 457, 458, 30, 460, 407, 256, - /* 310 */ 463, 155, 156, 36, 38, 38, 406, 407, 453, 119, - /* 320 */ 455, 0, 8, 9, 120, 256, 12, 13, 14, 15, - /* 330 */ 16, 431, 56, 57, 0, 59, 426, 437, 437, 158, - /* 340 */ 64, 65, 319, 320, 321, 322, 323, 313, 71, 455, - /* 350 */ 128, 74, 76, 20, 453, 78, 455, 471, 472, 313, - /* 360 */ 204, 205, 85, 469, 464, 500, 20, 392, 503, 475, - /* 370 */ 476, 118, 507, 508, 509, 510, 511, 512, 513, 313, + /* 310 */ 463, 155, 156, 36, 38, 38, 118, 4, 453, 119, + /* 320 */ 455, 0, 24, 25, 26, 27, 28, 29, 30, 31, + /* 330 */ 32, 431, 56, 57, 0, 59, 407, 437, 437, 158, + /* 340 */ 64, 65, 319, 320, 321, 322, 323, 14, 71, 455, + /* 350 */ 128, 74, 76, 20, 453, 78, 455, 3, 234, 235, + /* 360 */ 204, 205, 85, 469, 464, 500, 437, 392, 503, 475, + /* 370 */ 476, 36, 507, 508, 509, 510, 511, 512, 513, 313, /* 380 */ 515, 516, 517, 518, 519, 148, 149, 150, 151, 152, - /* 390 */ 153, 154, 115, 117, 422, 118, 196, 425, 218, 20, - /* 400 */ 220, 500, 254, 438, 503, 129, 455, 194, 507, 508, - /* 410 */ 509, 510, 511, 512, 449, 193, 515, 516, 517, 20, - /* 420 */ 469, 520, 436, 522, 523, 524, 475, 476, 453, 528, - /* 430 */ 529, 251, 155, 156, 52, 313, 160, 161, 452, 163, - /* 440 */ 164, 165, 166, 167, 168, 169, 170, 171, 172, 406, - /* 450 */ 407, 175, 176, 177, 178, 179, 180, 181, 182, 402, - /* 460 */ 184, 185, 186, 406, 20, 408, 190, 191, 192, 256, + /* 390 */ 153, 154, 115, 117, 20, 118, 196, 20, 406, 407, + /* 400 */ 22, 500, 254, 313, 503, 129, 36, 194, 507, 508, + /* 410 */ 509, 510, 511, 512, 36, 193, 515, 516, 517, 76, + /* 420 */ 0, 520, 341, 522, 523, 524, 12, 13, 453, 528, + /* 430 */ 529, 118, 155, 156, 256, 313, 160, 161, 509, 163, + /* 440 */ 164, 165, 166, 167, 168, 169, 170, 171, 172, 20, + /* 450 */ 36, 175, 176, 177, 178, 179, 180, 181, 182, 431, + /* 460 */ 184, 185, 186, 20, 77, 437, 190, 191, 192, 256, /* 470 */ 437, 194, 195, 197, 326, 327, 328, 329, 330, 331, /* 480 */ 332, 204, 205, 302, 303, 304, 305, 306, 307, 308, - /* 490 */ 309, 310, 158, 313, 272, 174, 219, 464, 221, 2, - /* 500 */ 179, 155, 156, 226, 461, 8, 9, 173, 187, 12, + /* 490 */ 309, 310, 464, 115, 272, 174, 219, 464, 221, 2, + /* 500 */ 179, 14, 20, 226, 77, 8, 9, 20, 187, 12, /* 510 */ 13, 14, 15, 16, 292, 293, 294, 295, 296, 297, - /* 520 */ 298, 299, 300, 301, 4, 211, 306, 307, 308, 309, - /* 530 */ 310, 254, 255, 256, 392, 258, 259, 260, 261, 262, + /* 520 */ 298, 299, 300, 301, 532, 533, 534, 194, 536, 537, + /* 530 */ 0, 254, 255, 256, 392, 258, 259, 260, 261, 262, /* 540 */ 263, 264, 265, 266, 267, 268, 269, 270, 271, 407, - /* 550 */ 536, 274, 275, 276, 277, 278, 315, 406, 544, 282, + /* 550 */ 536, 274, 275, 276, 277, 278, 221, 214, 544, 282, /* 560 */ 283, 284, 285, 286, 287, 288, 12, 13, 392, 158, - /* 570 */ 22, 407, 12, 13, 20, 196, 22, 563, 196, 437, - /* 580 */ 437, 567, 568, 407, 36, 14, 525, 526, 115, 207, - /* 590 */ 36, 20, 38, 20, 402, 453, 36, 455, 406, 456, - /* 600 */ 408, 437, 4, 130, 131, 132, 133, 134, 135, 136, + /* 570 */ 22, 194, 195, 118, 20, 406, 22, 563, 158, 437, + /* 580 */ 246, 567, 568, 407, 36, 242, 243, 57, 115, 256, + /* 590 */ 36, 221, 38, 173, 538, 453, 540, 455, 155, 156, + /* 600 */ 118, 392, 4, 130, 131, 132, 133, 134, 135, 136, /* 610 */ 137, 138, 139, 437, 141, 142, 143, 144, 145, 146, - /* 620 */ 147, 23, 438, 439, 406, 71, 437, 506, 74, 453, - /* 630 */ 231, 455, 78, 85, 437, 406, 407, 448, 118, 85, - /* 640 */ 489, 490, 500, 446, 447, 503, 48, 49, 50, 507, - /* 650 */ 508, 509, 510, 511, 512, 341, 535, 515, 516, 517, - /* 660 */ 406, 407, 77, 115, 522, 437, 524, 411, 412, 115, - /* 670 */ 528, 529, 118, 509, 446, 447, 500, 406, 407, 503, - /* 680 */ 426, 392, 20, 507, 508, 509, 510, 511, 512, 435, - /* 690 */ 461, 515, 516, 517, 497, 498, 407, 426, 556, 0, - /* 700 */ 524, 14, 15, 16, 528, 529, 435, 489, 490, 155, - /* 710 */ 156, 406, 407, 302, 303, 304, 305, 306, 307, 308, - /* 720 */ 309, 310, 36, 8, 9, 77, 437, 12, 13, 14, - /* 730 */ 15, 16, 80, 81, 82, 406, 407, 1, 2, 87, - /* 740 */ 88, 89, 453, 129, 455, 93, 36, 36, 194, 195, - /* 750 */ 98, 99, 100, 101, 158, 289, 104, 76, 204, 205, - /* 760 */ 108, 109, 110, 111, 506, 194, 461, 219, 85, 221, - /* 770 */ 454, 455, 2, 219, 22, 221, 77, 20, 8, 9, - /* 780 */ 226, 221, 12, 13, 14, 15, 16, 440, 36, 500, - /* 790 */ 443, 406, 503, 535, 20, 85, 507, 508, 509, 510, + /* 620 */ 147, 23, 252, 253, 406, 71, 313, 438, 74, 453, + /* 630 */ 256, 455, 78, 85, 437, 221, 406, 407, 449, 85, + /* 640 */ 471, 472, 500, 446, 447, 503, 48, 49, 50, 507, + /* 650 */ 508, 509, 510, 511, 512, 289, 426, 515, 516, 517, + /* 660 */ 406, 407, 453, 115, 522, 189, 524, 406, 407, 115, + /* 670 */ 528, 529, 118, 218, 13, 220, 500, 406, 407, 503, + /* 680 */ 426, 392, 36, 507, 508, 509, 510, 511, 512, 435, + /* 690 */ 336, 515, 516, 517, 497, 498, 407, 426, 556, 223, + /* 700 */ 524, 438, 439, 158, 528, 529, 251, 489, 490, 155, + /* 710 */ 156, 454, 455, 302, 303, 304, 305, 306, 307, 308, + /* 720 */ 309, 310, 461, 8, 9, 129, 437, 12, 13, 14, + /* 730 */ 15, 16, 80, 81, 82, 406, 407, 406, 407, 87, + /* 740 */ 88, 89, 453, 85, 455, 93, 85, 506, 194, 195, + /* 750 */ 98, 99, 100, 101, 406, 407, 104, 426, 204, 205, + /* 760 */ 108, 109, 110, 111, 62, 63, 435, 219, 313, 221, + /* 770 */ 406, 407, 2, 219, 426, 221, 535, 20, 8, 9, + /* 780 */ 226, 34, 12, 13, 14, 15, 16, 402, 20, 500, + /* 790 */ 426, 406, 503, 408, 0, 313, 507, 508, 509, 510, /* 800 */ 511, 512, 254, 255, 515, 516, 517, 389, 254, 255, /* 810 */ 256, 392, 258, 259, 260, 261, 262, 263, 264, 265, - /* 820 */ 266, 267, 268, 269, 270, 271, 407, 256, 274, 275, - /* 830 */ 276, 277, 278, 313, 119, 392, 282, 283, 284, 285, - /* 840 */ 286, 287, 288, 289, 12, 13, 557, 558, 406, 407, - /* 850 */ 503, 466, 20, 468, 22, 119, 437, 129, 196, 22, - /* 860 */ 115, 532, 533, 534, 517, 536, 537, 115, 36, 506, - /* 870 */ 38, 189, 453, 36, 455, 130, 131, 132, 133, 134, + /* 820 */ 266, 267, 268, 269, 270, 271, 407, 33, 274, 275, + /* 830 */ 276, 277, 278, 129, 119, 20, 282, 283, 284, 285, + /* 840 */ 286, 287, 288, 289, 12, 13, 557, 558, 303, 304, + /* 850 */ 305, 402, 20, 437, 22, 406, 437, 408, 406, 36, + /* 860 */ 115, 532, 533, 534, 448, 536, 537, 221, 36, 391, + /* 870 */ 38, 393, 453, 438, 455, 130, 131, 132, 133, 134, /* 880 */ 135, 136, 137, 138, 139, 437, 141, 142, 143, 144, - /* 890 */ 145, 146, 147, 445, 392, 214, 453, 479, 535, 303, - /* 900 */ 304, 305, 484, 71, 456, 223, 74, 221, 415, 437, - /* 910 */ 78, 62, 63, 406, 407, 23, 149, 85, 256, 500, - /* 920 */ 440, 413, 503, 242, 243, 94, 507, 508, 509, 510, - /* 930 */ 511, 512, 221, 426, 515, 516, 517, 444, 252, 253, - /* 940 */ 44, 49, 50, 524, 392, 406, 407, 115, 529, 441, - /* 950 */ 118, 440, 115, 196, 536, 453, 485, 406, 407, 407, - /* 960 */ 479, 409, 544, 252, 253, 426, 18, 71, 194, 497, - /* 970 */ 498, 23, 12, 13, 532, 533, 534, 426, 536, 537, - /* 980 */ 562, 563, 22, 503, 536, 567, 568, 155, 156, 437, - /* 990 */ 42, 43, 544, 162, 46, 392, 36, 517, 38, 411, - /* 1000 */ 412, 234, 235, 55, 0, 453, 438, 455, 60, 392, - /* 1010 */ 562, 563, 438, 256, 503, 567, 568, 536, 187, 188, - /* 1020 */ 72, 73, 74, 75, 76, 544, 194, 195, 517, 413, - /* 1030 */ 256, 71, 201, 33, 8, 9, 204, 205, 12, 13, - /* 1040 */ 14, 15, 16, 562, 563, 85, 430, 47, 567, 568, - /* 1050 */ 392, 219, 500, 221, 415, 503, 453, 441, 226, 507, - /* 1060 */ 508, 509, 510, 511, 512, 22, 118, 515, 516, 517, - /* 1070 */ 453, 420, 421, 434, 522, 115, 524, 149, 150, 36, - /* 1080 */ 528, 529, 154, 444, 479, 3, 254, 255, 256, 484, + /* 890 */ 145, 146, 147, 445, 406, 407, 506, 479, 252, 253, + /* 900 */ 149, 150, 484, 71, 456, 154, 74, 94, 85, 437, + /* 910 */ 78, 465, 306, 307, 308, 309, 310, 85, 36, 500, + /* 920 */ 406, 407, 503, 406, 407, 535, 507, 508, 509, 510, + /* 930 */ 511, 512, 406, 407, 515, 516, 517, 438, 406, 407, + /* 940 */ 426, 489, 490, 524, 392, 406, 407, 115, 529, 461, + /* 950 */ 118, 392, 426, 196, 536, 437, 406, 407, 426, 407, + /* 960 */ 479, 409, 544, 445, 196, 426, 18, 85, 406, 497, + /* 970 */ 498, 23, 12, 13, 456, 162, 426, 20, 461, 22, + /* 980 */ 562, 563, 22, 437, 536, 567, 568, 155, 156, 437, + /* 990 */ 42, 43, 544, 438, 46, 392, 36, 289, 38, 291, + /* 1000 */ 187, 188, 456, 55, 0, 453, 438, 455, 60, 194, + /* 1010 */ 562, 563, 453, 256, 201, 567, 568, 536, 61, 438, + /* 1020 */ 72, 73, 74, 75, 76, 544, 194, 195, 466, 422, + /* 1030 */ 468, 71, 425, 22, 8, 9, 204, 205, 12, 13, + /* 1040 */ 14, 15, 16, 562, 563, 85, 437, 36, 567, 568, + /* 1050 */ 129, 219, 500, 221, 445, 503, 453, 20, 226, 507, + /* 1060 */ 508, 509, 510, 511, 512, 456, 118, 515, 516, 517, + /* 1070 */ 521, 256, 523, 392, 522, 115, 524, 14, 15, 16, + /* 1080 */ 528, 529, 1, 2, 479, 23, 254, 255, 256, 484, /* 1090 */ 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, - /* 1100 */ 268, 269, 270, 271, 13, 157, 274, 275, 276, 277, - /* 1110 */ 278, 453, 420, 421, 282, 283, 284, 285, 286, 287, - /* 1120 */ 288, 12, 13, 14, 406, 407, 392, 392, 85, 20, - /* 1130 */ 392, 22, 8, 9, 395, 396, 12, 13, 14, 15, - /* 1140 */ 16, 536, 150, 437, 426, 36, 154, 38, 424, 544, - /* 1150 */ 4, 445, 148, 149, 150, 151, 152, 153, 154, 211, - /* 1160 */ 212, 213, 456, 33, 216, 19, 437, 562, 563, 0, - /* 1170 */ 392, 47, 567, 568, 445, 438, 85, 229, 230, 219, - /* 1180 */ 71, 221, 428, 74, 38, 456, 432, 453, 453, 241, - /* 1190 */ 0, 453, 244, 438, 85, 247, 248, 249, 250, 251, - /* 1200 */ 432, 8, 9, 57, 438, 12, 13, 14, 15, 16, - /* 1210 */ 64, 65, 406, 407, 254, 255, 289, 71, 291, 392, - /* 1220 */ 228, 392, 438, 437, 115, 233, 33, 118, 236, 437, - /* 1230 */ 238, 453, 426, 447, 274, 275, 407, 445, 409, 33, - /* 1240 */ 406, 407, 282, 283, 284, 285, 286, 287, 456, 406, + /* 1100 */ 268, 269, 270, 271, 183, 157, 274, 275, 276, 277, + /* 1110 */ 278, 49, 50, 392, 282, 283, 284, 285, 286, 287, + /* 1120 */ 288, 12, 13, 14, 406, 407, 115, 392, 438, 20, + /* 1130 */ 392, 22, 8, 9, 453, 0, 12, 13, 14, 15, + /* 1140 */ 16, 536, 150, 55, 426, 36, 154, 38, 520, 544, + /* 1150 */ 4, 523, 148, 149, 150, 151, 152, 153, 154, 211, + /* 1160 */ 212, 213, 406, 407, 216, 19, 427, 562, 563, 0, + /* 1170 */ 392, 47, 567, 568, 453, 393, 437, 229, 230, 219, + /* 1180 */ 71, 221, 426, 74, 38, 411, 412, 448, 453, 241, + /* 1190 */ 0, 453, 244, 58, 85, 247, 248, 249, 250, 251, + /* 1200 */ 119, 8, 9, 57, 22, 12, 13, 14, 15, 16, + /* 1210 */ 64, 65, 406, 407, 254, 255, 450, 71, 36, 453, + /* 1220 */ 228, 392, 411, 412, 115, 233, 33, 118, 236, 437, + /* 1230 */ 238, 453, 426, 196, 274, 275, 407, 445, 409, 420, + /* 1240 */ 421, 392, 282, 283, 284, 285, 286, 287, 456, 406, /* 1250 */ 407, 8, 9, 406, 407, 12, 13, 14, 15, 16, - /* 1260 */ 426, 313, 494, 117, 155, 156, 437, 20, 122, 426, - /* 1270 */ 80, 81, 82, 426, 20, 0, 33, 87, 88, 89, - /* 1280 */ 453, 437, 453, 93, 455, 406, 407, 392, 98, 99, - /* 1290 */ 100, 101, 571, 392, 104, 406, 407, 437, 108, 109, - /* 1300 */ 110, 111, 0, 194, 195, 426, 406, 407, 521, 521, - /* 1310 */ 523, 523, 119, 204, 205, 426, 456, 148, 149, 150, - /* 1320 */ 151, 152, 153, 154, 22, 119, 426, 392, 219, 500, - /* 1330 */ 221, 193, 503, 13, 33, 226, 507, 508, 509, 510, - /* 1340 */ 511, 512, 498, 393, 515, 516, 517, 450, 453, 450, - /* 1350 */ 453, 522, 453, 524, 453, 392, 148, 528, 529, 392, - /* 1360 */ 152, 538, 119, 254, 255, 256, 392, 258, 259, 260, + /* 1260 */ 4, 313, 424, 117, 155, 156, 437, 85, 122, 426, + /* 1270 */ 80, 81, 82, 426, 20, 538, 33, 87, 88, 89, + /* 1280 */ 413, 52, 453, 93, 455, 406, 407, 392, 98, 99, + /* 1290 */ 100, 101, 560, 256, 104, 406, 407, 430, 108, 109, + /* 1300 */ 110, 111, 453, 194, 195, 426, 406, 407, 441, 521, + /* 1310 */ 13, 523, 119, 204, 205, 426, 44, 148, 149, 150, + /* 1320 */ 151, 152, 153, 154, 413, 237, 426, 392, 219, 500, + /* 1330 */ 221, 193, 503, 420, 421, 226, 507, 508, 509, 510, + /* 1340 */ 511, 512, 437, 71, 515, 516, 517, 450, 453, 0, + /* 1350 */ 453, 522, 441, 524, 0, 392, 428, 528, 529, 392, + /* 1360 */ 432, 456, 119, 254, 255, 256, 392, 258, 259, 260, /* 1370 */ 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, - /* 1380 */ 271, 407, 0, 274, 275, 276, 277, 278, 453, 406, + /* 1380 */ 271, 407, 85, 274, 275, 276, 277, 278, 453, 406, /* 1390 */ 407, 282, 283, 284, 285, 286, 287, 288, 12, 13, - /* 1400 */ 392, 406, 407, 406, 407, 85, 20, 0, 22, 426, - /* 1410 */ 272, 437, 406, 407, 392, 407, 453, 409, 336, 392, - /* 1420 */ 453, 426, 36, 426, 38, 520, 44, 453, 523, 455, - /* 1430 */ 292, 392, 426, 8, 9, 406, 407, 12, 13, 14, + /* 1400 */ 392, 406, 407, 406, 407, 392, 20, 392, 22, 426, + /* 1410 */ 272, 437, 406, 407, 392, 407, 453, 409, 437, 392, + /* 1420 */ 453, 426, 36, 426, 38, 196, 392, 453, 33, 455, + /* 1430 */ 292, 77, 426, 8, 9, 506, 207, 12, 13, 14, /* 1440 */ 15, 16, 8, 9, 427, 437, 12, 13, 14, 15, - /* 1450 */ 16, 55, 406, 407, 437, 426, 14, 71, 406, 407, - /* 1460 */ 74, 453, 20, 455, 57, 448, 450, 406, 407, 453, - /* 1470 */ 340, 85, 426, 0, 500, 453, 465, 503, 426, 33, - /* 1480 */ 453, 507, 508, 509, 510, 511, 512, 426, 514, 515, - /* 1490 */ 516, 517, 453, 47, 129, 0, 123, 123, 392, 126, - /* 1500 */ 126, 115, 33, 256, 118, 119, 155, 156, 500, 0, - /* 1510 */ 256, 503, 13, 407, 36, 507, 508, 509, 510, 511, - /* 1520 */ 512, 246, 33, 515, 516, 517, 123, 0, 33, 126, - /* 1530 */ 522, 123, 524, 33, 126, 36, 528, 529, 0, 13, - /* 1540 */ 33, 155, 156, 437, 119, 0, 33, 560, 183, 22, + /* 1450 */ 16, 437, 450, 14, 437, 453, 0, 71, 148, 20, + /* 1460 */ 74, 453, 152, 455, 535, 448, 453, 415, 453, 0, + /* 1470 */ 456, 85, 432, 123, 500, 453, 126, 503, 33, 498, + /* 1480 */ 453, 507, 508, 509, 510, 511, 512, 453, 514, 515, + /* 1490 */ 516, 517, 437, 395, 396, 33, 444, 571, 392, 33, + /* 1500 */ 44, 115, 447, 33, 118, 119, 20, 158, 500, 47, + /* 1510 */ 256, 503, 36, 407, 119, 507, 508, 509, 510, 511, + /* 1520 */ 512, 33, 33, 515, 516, 517, 123, 539, 123, 126, + /* 1530 */ 522, 126, 524, 33, 494, 47, 528, 529, 0, 13, + /* 1540 */ 13, 155, 156, 437, 119, 123, 155, 156, 126, 553, /* 1550 */ 8, 9, 33, 119, 12, 13, 14, 15, 16, 453, - /* 1560 */ 22, 455, 36, 85, 1, 2, 78, 22, 8, 9, - /* 1570 */ 12, 13, 12, 13, 14, 15, 16, 36, 8, 9, - /* 1580 */ 194, 195, 12, 13, 14, 15, 16, 553, 119, 47, + /* 1560 */ 22, 455, 36, 36, 119, 1, 2, 410, 8, 9, + /* 1570 */ 78, 315, 12, 13, 14, 15, 16, 437, 8, 9, + /* 1580 */ 194, 195, 12, 13, 14, 15, 16, 423, 36, 47, /* 1590 */ 204, 205, 8, 9, 33, 33, 12, 13, 14, 15, - /* 1600 */ 16, 33, 33, 12, 13, 219, 500, 221, 119, 503, - /* 1610 */ 33, 539, 226, 507, 508, 509, 510, 511, 512, 119, - /* 1620 */ 33, 515, 516, 517, 51, 36, 119, 410, 522, 437, - /* 1630 */ 524, 158, 119, 237, 528, 529, 12, 13, 119, 338, - /* 1640 */ 254, 255, 256, 33, 258, 259, 260, 261, 262, 263, - /* 1650 */ 264, 265, 266, 267, 268, 269, 270, 271, 33, 423, - /* 1660 */ 274, 275, 276, 277, 278, 33, 33, 158, 282, 283, + /* 1600 */ 16, 118, 33, 120, 33, 219, 500, 221, 119, 503, + /* 1610 */ 0, 0, 226, 507, 508, 509, 510, 511, 512, 119, + /* 1620 */ 33, 515, 516, 517, 12, 13, 51, 158, 522, 423, + /* 1630 */ 524, 405, 22, 22, 528, 529, 0, 85, 119, 465, + /* 1640 */ 254, 255, 256, 559, 258, 259, 260, 261, 262, 263, + /* 1650 */ 264, 265, 266, 267, 268, 269, 270, 271, 22, 559, + /* 1660 */ 274, 275, 276, 277, 278, 478, 33, 33, 282, 283, /* 1670 */ 284, 285, 286, 287, 288, 12, 13, 392, 33, 119, - /* 1680 */ 119, 119, 479, 20, 423, 22, 33, 119, 119, 119, - /* 1690 */ 33, 118, 407, 118, 409, 120, 119, 405, 273, 36, - /* 1700 */ 33, 38, 0, 119, 12, 13, 119, 8, 9, 465, - /* 1710 */ 47, 12, 13, 14, 15, 16, 12, 13, 36, 8, - /* 1720 */ 9, 559, 437, 12, 13, 14, 15, 16, 392, 119, + /* 1680 */ 119, 119, 479, 20, 559, 22, 33, 559, 119, 119, + /* 1690 */ 119, 33, 407, 118, 409, 12, 13, 221, 273, 36, + /* 1700 */ 33, 38, 465, 119, 33, 410, 119, 8, 9, 501, + /* 1710 */ 47, 12, 13, 14, 15, 16, 407, 231, 452, 8, + /* 1720 */ 9, 486, 437, 12, 13, 14, 15, 16, 392, 33, /* 1730 */ 12, 13, 12, 13, 71, 12, 13, 74, 453, 536, - /* 1740 */ 455, 33, 254, 407, 119, 12, 13, 544, 85, 12, - /* 1750 */ 13, 119, 119, 12, 13, 36, 13, 13, 47, 559, - /* 1760 */ 58, 559, 221, 33, 119, 562, 563, 85, 33, 33, - /* 1770 */ 567, 568, 119, 437, 478, 33, 119, 559, 115, 36, - /* 1780 */ 36, 118, 465, 501, 452, 500, 119, 410, 503, 453, - /* 1790 */ 407, 455, 507, 508, 509, 510, 511, 512, 486, 465, - /* 1800 */ 515, 516, 517, 465, 85, 543, 543, 522, 530, 524, - /* 1810 */ 221, 546, 564, 528, 529, 465, 8, 9, 155, 156, - /* 1820 */ 12, 13, 14, 15, 16, 425, 316, 119, 480, 57, - /* 1830 */ 119, 502, 20, 406, 20, 491, 500, 236, 496, 503, - /* 1840 */ 491, 415, 482, 507, 508, 509, 510, 511, 512, 119, - /* 1850 */ 415, 515, 516, 517, 119, 119, 217, 194, 195, 406, - /* 1860 */ 524, 119, 20, 407, 528, 529, 47, 204, 205, 8, - /* 1870 */ 9, 462, 407, 12, 13, 14, 15, 16, 462, 193, - /* 1880 */ 459, 406, 219, 407, 221, 406, 8, 9, 459, 226, - /* 1890 */ 12, 13, 14, 15, 16, 462, 459, 459, 116, 41, - /* 1900 */ 42, 419, 114, 406, 418, 113, 20, 406, 417, 406, - /* 1910 */ 406, 406, 52, 399, 403, 399, 20, 254, 255, 256, - /* 1920 */ 403, 258, 259, 260, 261, 262, 263, 264, 265, 266, - /* 1930 */ 267, 268, 269, 270, 271, 491, 415, 274, 275, 276, - /* 1940 */ 277, 278, 455, 479, 415, 282, 283, 284, 285, 286, - /* 1950 */ 287, 288, 12, 13, 415, 20, 408, 20, 481, 415, - /* 1960 */ 20, 408, 22, 20, 479, 415, 472, 415, 20, 415, - /* 1970 */ 415, 272, 466, 52, 392, 399, 36, 406, 38, 433, - /* 1980 */ 119, 415, 124, 125, 433, 127, 437, 395, 395, 407, - /* 1990 */ 453, 409, 406, 437, 437, 399, 437, 119, 239, 118, - /* 2000 */ 536, 437, 437, 495, 196, 392, 148, 413, 544, 437, - /* 2010 */ 152, 71, 20, 493, 74, 437, 437, 437, 437, 437, - /* 2020 */ 407, 536, 491, 490, 225, 85, 562, 563, 488, 544, - /* 2030 */ 224, 567, 568, 413, 487, 453, 453, 455, 453, 325, - /* 2040 */ 406, 324, 552, 455, 552, 333, 210, 562, 563, 551, - /* 2050 */ 437, 453, 567, 568, 480, 115, 392, 555, 118, 335, - /* 2060 */ 334, 312, 317, 473, 552, 542, 453, 549, 455, 554, - /* 2070 */ 473, 407, 550, 409, 311, 480, 541, 337, 339, 407, - /* 2080 */ 342, 20, 500, 129, 314, 503, 408, 413, 413, 507, + /* 1740 */ 455, 33, 33, 407, 465, 33, 254, 544, 85, 12, + /* 1750 */ 13, 13, 119, 119, 12, 13, 12, 13, 47, 12, + /* 1760 */ 13, 12, 13, 33, 119, 562, 563, 12, 13, 33, + /* 1770 */ 567, 568, 119, 437, 36, 13, 33, 119, 115, 465, + /* 1780 */ 564, 118, 543, 543, 36, 500, 119, 530, 503, 453, + /* 1790 */ 119, 455, 507, 508, 509, 510, 511, 512, 36, 33, + /* 1800 */ 515, 516, 517, 465, 338, 546, 425, 522, 480, 524, + /* 1810 */ 340, 33, 316, 528, 529, 119, 8, 9, 155, 156, + /* 1820 */ 12, 13, 14, 15, 16, 57, 502, 119, 119, 20, + /* 1830 */ 119, 119, 406, 85, 20, 491, 500, 236, 496, 503, + /* 1840 */ 217, 406, 415, 507, 508, 509, 510, 511, 512, 119, + /* 1850 */ 491, 515, 516, 517, 482, 119, 415, 194, 195, 20, + /* 1860 */ 524, 407, 119, 47, 528, 529, 462, 204, 205, 8, + /* 1870 */ 9, 462, 407, 12, 13, 14, 15, 16, 193, 459, + /* 1880 */ 406, 406, 219, 462, 221, 119, 8, 9, 407, 226, + /* 1890 */ 12, 13, 14, 15, 16, 459, 459, 119, 116, 41, + /* 1900 */ 42, 459, 114, 419, 406, 418, 113, 406, 417, 406, + /* 1910 */ 406, 406, 20, 399, 52, 403, 399, 254, 255, 256, + /* 1920 */ 491, 258, 259, 260, 261, 262, 263, 264, 265, 266, + /* 1930 */ 267, 268, 269, 270, 271, 403, 415, 274, 275, 276, + /* 1940 */ 277, 278, 20, 479, 415, 282, 283, 284, 285, 286, + /* 1950 */ 287, 288, 12, 13, 455, 415, 20, 408, 20, 481, + /* 1960 */ 20, 415, 22, 408, 479, 415, 20, 472, 415, 20, + /* 1970 */ 52, 272, 466, 415, 392, 399, 36, 433, 38, 406, + /* 1980 */ 119, 415, 124, 125, 433, 127, 453, 415, 395, 407, + /* 1990 */ 395, 409, 453, 437, 437, 406, 437, 119, 399, 239, + /* 2000 */ 536, 453, 437, 495, 196, 392, 148, 118, 544, 493, + /* 2010 */ 152, 71, 20, 491, 74, 437, 437, 437, 437, 437, + /* 2020 */ 407, 536, 437, 437, 490, 85, 562, 563, 437, 544, + /* 2030 */ 413, 567, 568, 488, 224, 453, 225, 455, 455, 413, + /* 2040 */ 325, 487, 552, 480, 406, 453, 324, 562, 563, 552, + /* 2050 */ 437, 210, 567, 568, 333, 115, 392, 555, 118, 552, + /* 2060 */ 335, 473, 551, 473, 554, 334, 453, 317, 455, 312, + /* 2070 */ 550, 407, 549, 409, 480, 311, 342, 542, 541, 339, + /* 2080 */ 565, 572, 500, 337, 566, 503, 407, 20, 129, 507, /* 2090 */ 508, 509, 510, 511, 512, 155, 156, 515, 516, 517, - /* 2100 */ 572, 437, 566, 473, 522, 506, 524, 453, 565, 453, + /* 2100 */ 314, 437, 506, 408, 522, 413, 524, 413, 473, 453, /* 2110 */ 528, 529, 453, 500, 547, 453, 503, 453, 453, 455, - /* 2120 */ 507, 508, 509, 510, 511, 512, 202, 466, 515, 516, - /* 2130 */ 517, 473, 453, 118, 194, 195, 470, 524, 413, 527, - /* 2140 */ 413, 528, 529, 453, 204, 205, 202, 545, 467, 466, - /* 2150 */ 453, 453, 118, 432, 453, 407, 453, 406, 453, 219, - /* 2160 */ 413, 221, 453, 413, 500, 413, 226, 503, 453, 453, - /* 2170 */ 442, 507, 508, 509, 510, 511, 512, 22, 394, 515, - /* 2180 */ 516, 517, 453, 35, 453, 453, 522, 453, 524, 37, - /* 2190 */ 397, 40, 528, 529, 254, 255, 256, 400, 258, 259, + /* 2120 */ 507, 508, 509, 510, 511, 512, 453, 473, 515, 516, + /* 2130 */ 517, 202, 413, 453, 194, 195, 470, 524, 466, 413, + /* 2140 */ 118, 528, 529, 545, 204, 205, 527, 202, 467, 432, + /* 2150 */ 453, 453, 466, 453, 413, 453, 453, 453, 413, 219, + /* 2160 */ 407, 221, 118, 453, 500, 413, 226, 503, 22, 453, + /* 2170 */ 442, 507, 508, 509, 510, 511, 512, 453, 406, 515, + /* 2180 */ 516, 517, 453, 35, 37, 453, 522, 499, 524, 394, + /* 2190 */ 40, 414, 528, 529, 254, 255, 256, 397, 258, 259, /* 2200 */ 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, - /* 2210 */ 270, 271, 399, 453, 274, 275, 276, 277, 278, 453, - /* 2220 */ 453, 453, 282, 283, 284, 285, 286, 287, 288, 12, - /* 2230 */ 13, 453, 453, 453, 453, 398, 453, 20, 453, 22, - /* 2240 */ 453, 483, 439, 474, 429, 499, 492, 474, 439, 429, - /* 2250 */ 429, 392, 414, 36, 390, 38, 0, 0, 0, 47, - /* 2260 */ 0, 36, 245, 36, 36, 245, 407, 36, 0, 36, - /* 2270 */ 36, 245, 36, 0, 0, 245, 0, 36, 0, 36, - /* 2280 */ 0, 22, 0, 36, 240, 0, 227, 0, 71, 227, - /* 2290 */ 221, 74, 228, 219, 0, 0, 437, 0, 215, 214, - /* 2300 */ 0, 0, 85, 161, 51, 51, 0, 36, 0, 0, - /* 2310 */ 0, 36, 453, 51, 455, 51, 47, 0, 57, 0, - /* 2320 */ 0, 0, 0, 0, 0, 0, 0, 12, 13, 0, - /* 2330 */ 0, 0, 115, 392, 36, 118, 179, 22, 179, 0, + /* 2210 */ 270, 271, 453, 398, 274, 275, 276, 277, 278, 400, + /* 2220 */ 453, 399, 282, 283, 284, 285, 286, 287, 288, 12, + /* 2230 */ 13, 492, 453, 453, 453, 439, 453, 20, 453, 22, + /* 2240 */ 453, 483, 453, 453, 453, 453, 429, 453, 474, 474, + /* 2250 */ 429, 392, 439, 36, 429, 38, 390, 0, 0, 0, + /* 2260 */ 47, 0, 36, 245, 36, 245, 407, 36, 36, 0, + /* 2270 */ 36, 36, 245, 36, 0, 0, 245, 0, 36, 0, + /* 2280 */ 36, 0, 22, 0, 36, 240, 0, 227, 71, 0, + /* 2290 */ 227, 74, 228, 221, 219, 0, 437, 0, 0, 215, + /* 2300 */ 214, 0, 85, 0, 161, 51, 51, 0, 36, 0, + /* 2310 */ 0, 0, 453, 57, 455, 51, 36, 0, 47, 0, + /* 2320 */ 0, 0, 0, 0, 51, 0, 0, 12, 13, 0, + /* 2330 */ 0, 179, 115, 392, 0, 118, 36, 22, 179, 0, /* 2340 */ 0, 0, 0, 0, 0, 0, 0, 0, 407, 0, /* 2350 */ 0, 36, 0, 38, 0, 0, 0, 0, 0, 500, - /* 2360 */ 0, 0, 503, 51, 0, 47, 507, 508, 509, 510, - /* 2370 */ 511, 512, 155, 156, 515, 516, 517, 0, 437, 161, + /* 2360 */ 0, 0, 503, 0, 51, 0, 507, 508, 509, 510, + /* 2370 */ 511, 512, 155, 156, 515, 516, 517, 0, 437, 47, /* 2380 */ 0, 522, 0, 524, 0, 0, 71, 528, 529, 0, - /* 2390 */ 0, 0, 0, 0, 453, 0, 455, 22, 0, 160, - /* 2400 */ 0, 159, 0, 0, 0, 22, 71, 0, 22, 71, - /* 2410 */ 36, 194, 195, 0, 52, 52, 0, 0, 0, 71, + /* 2390 */ 0, 0, 0, 0, 453, 22, 455, 0, 0, 161, + /* 2400 */ 160, 0, 159, 0, 0, 22, 0, 71, 22, 0, + /* 2410 */ 36, 194, 195, 0, 52, 0, 52, 0, 0, 71, /* 2420 */ 44, 204, 205, 36, 71, 57, 0, 57, 0, 57, - /* 2430 */ 36, 0, 44, 36, 0, 36, 219, 56, 221, 0, - /* 2440 */ 44, 500, 36, 226, 503, 0, 14, 33, 507, 508, - /* 2450 */ 509, 510, 511, 512, 44, 47, 515, 516, 517, 0, - /* 2460 */ 51, 0, 51, 522, 45, 524, 51, 44, 0, 528, - /* 2470 */ 529, 254, 255, 256, 0, 258, 259, 260, 261, 262, + /* 2430 */ 71, 36, 44, 0, 0, 36, 219, 56, 221, 0, + /* 2440 */ 44, 500, 0, 226, 503, 51, 36, 36, 507, 508, + /* 2450 */ 509, 510, 511, 512, 47, 33, 515, 516, 517, 51, + /* 2460 */ 44, 14, 0, 522, 45, 524, 0, 0, 44, 528, + /* 2470 */ 529, 254, 255, 256, 51, 258, 259, 260, 261, 262, /* 2480 */ 263, 264, 265, 266, 267, 268, 269, 270, 271, 1, - /* 2490 */ 0, 274, 275, 276, 277, 278, 44, 0, 210, 282, - /* 2500 */ 283, 284, 285, 286, 287, 288, 51, 19, 0, 51, - /* 2510 */ 0, 0, 79, 0, 0, 392, 36, 57, 0, 44, - /* 2520 */ 36, 57, 44, 0, 57, 36, 38, 44, 0, 36, - /* 2530 */ 407, 44, 0, 57, 219, 0, 221, 0, 0, 0, - /* 2540 */ 36, 53, 54, 0, 0, 57, 22, 126, 128, 0, - /* 2550 */ 0, 36, 22, 36, 66, 67, 68, 69, 36, 71, - /* 2560 */ 437, 36, 36, 36, 33, 36, 33, 252, 253, 254, - /* 2570 */ 36, 0, 36, 22, 22, 22, 453, 36, 455, 0, - /* 2580 */ 22, 36, 36, 36, 0, 22, 0, 0, 0, 274, - /* 2590 */ 275, 36, 36, 0, 0, 36, 36, 282, 283, 284, - /* 2600 */ 285, 286, 287, 0, 22, 117, 36, 59, 36, 20, - /* 2610 */ 122, 36, 0, 119, 118, 51, 118, 0, 196, 36, - /* 2620 */ 22, 392, 0, 500, 22, 196, 503, 226, 0, 202, + /* 2490 */ 0, 274, 275, 276, 277, 278, 0, 44, 210, 282, + /* 2500 */ 283, 284, 285, 286, 287, 288, 0, 19, 51, 0, + /* 2510 */ 51, 0, 0, 0, 79, 392, 0, 36, 57, 44, + /* 2520 */ 0, 36, 57, 44, 0, 36, 38, 57, 44, 0, + /* 2530 */ 407, 36, 0, 57, 219, 44, 221, 0, 0, 0, + /* 2540 */ 0, 53, 54, 36, 0, 57, 0, 126, 128, 22, + /* 2550 */ 36, 0, 22, 36, 66, 67, 68, 69, 36, 71, + /* 2560 */ 437, 36, 36, 0, 36, 0, 33, 252, 253, 254, + /* 2570 */ 36, 36, 36, 0, 22, 33, 453, 36, 455, 36, + /* 2580 */ 22, 36, 22, 36, 22, 0, 22, 0, 0, 274, + /* 2590 */ 275, 36, 0, 36, 0, 36, 0, 282, 283, 284, + /* 2600 */ 285, 286, 287, 36, 0, 117, 22, 59, 36, 20, + /* 2610 */ 122, 36, 36, 119, 0, 118, 118, 51, 0, 36, + /* 2620 */ 22, 392, 0, 500, 22, 196, 503, 196, 226, 202, /* 2630 */ 507, 508, 509, 510, 511, 512, 407, 232, 515, 516, - /* 2640 */ 517, 153, 196, 0, 392, 196, 206, 222, 206, 196, - /* 2650 */ 3, 33, 318, 22, 318, 231, 36, 36, 118, 407, - /* 2660 */ 52, 119, 52, 33, 51, 33, 437, 33, 33, 33, - /* 2670 */ 51, 3, 118, 36, 33, 36, 119, 318, 36, 118, - /* 2680 */ 114, 119, 453, 118, 455, 116, 198, 36, 200, 437, - /* 2690 */ 85, 203, 569, 570, 36, 119, 208, 119, 118, 118, - /* 2700 */ 36, 36, 33, 118, 51, 453, 477, 455, 51, 119, - /* 2710 */ 118, 0, 0, 0, 119, 227, 119, 118, 44, 119, - /* 2720 */ 392, 44, 203, 119, 0, 119, 119, 118, 44, 500, - /* 2730 */ 119, 33, 503, 118, 118, 407, 507, 508, 509, 510, - /* 2740 */ 511, 512, 118, 302, 515, 516, 517, 290, 119, 2, - /* 2750 */ 22, 51, 500, 254, 51, 503, 118, 22, 118, 507, - /* 2760 */ 508, 509, 510, 511, 512, 437, 199, 515, 516, 517, - /* 2770 */ 116, 392, 199, 118, 118, 198, 0, 116, 119, 0, - /* 2780 */ 118, 453, 119, 455, 118, 118, 407, 44, 118, 118, - /* 2790 */ 118, 118, 22, 51, 119, 119, 118, 118, 118, 118, - /* 2800 */ 199, 119, 119, 118, 392, 477, 118, 120, 22, 118, - /* 2810 */ 558, 121, 118, 118, 118, 118, 437, 36, 129, 407, - /* 2820 */ 119, 36, 118, 33, 119, 36, 118, 36, 500, 119, + /* 2640 */ 517, 153, 196, 0, 392, 231, 0, 222, 196, 206, + /* 2650 */ 196, 206, 3, 33, 22, 318, 33, 36, 52, 407, + /* 2660 */ 36, 52, 33, 33, 51, 85, 437, 118, 51, 119, + /* 2670 */ 33, 118, 33, 119, 118, 3, 36, 33, 36, 51, + /* 2680 */ 119, 36, 453, 36, 455, 114, 198, 118, 200, 437, + /* 2690 */ 116, 203, 569, 570, 36, 118, 208, 119, 119, 118, + /* 2700 */ 118, 36, 36, 33, 118, 453, 477, 455, 51, 119, + /* 2710 */ 119, 118, 0, 0, 119, 227, 119, 118, 318, 119, + /* 2720 */ 392, 44, 119, 0, 119, 44, 119, 0, 118, 500, + /* 2730 */ 118, 44, 503, 118, 302, 407, 507, 508, 509, 510, + /* 2740 */ 511, 512, 33, 118, 515, 516, 517, 2, 318, 51, + /* 2750 */ 119, 116, 500, 290, 116, 503, 22, 254, 51, 507, + /* 2760 */ 508, 509, 510, 511, 512, 437, 118, 515, 516, 517, + /* 2770 */ 118, 392, 118, 203, 118, 22, 257, 118, 0, 44, + /* 2780 */ 119, 453, 119, 455, 120, 118, 407, 118, 0, 118, + /* 2790 */ 22, 118, 118, 51, 119, 119, 118, 118, 118, 22, + /* 2800 */ 199, 118, 140, 119, 392, 477, 118, 199, 118, 198, + /* 2810 */ 558, 118, 121, 118, 118, 199, 437, 36, 119, 407, + /* 2820 */ 118, 118, 36, 129, 119, 119, 118, 36, 500, 118, /* 2830 */ 36, 503, 453, 119, 455, 507, 508, 509, 510, 511, - /* 2840 */ 512, 119, 36, 515, 516, 517, 232, 36, 257, 437, - /* 2850 */ 119, 118, 118, 36, 118, 140, 477, 140, 140, 140, - /* 2860 */ 22, 79, 78, 22, 36, 453, 36, 455, 36, 392, - /* 2870 */ 36, 36, 36, 36, 112, 36, 36, 85, 36, 500, - /* 2880 */ 36, 85, 503, 112, 407, 33, 507, 508, 509, 510, - /* 2890 */ 511, 512, 392, 36, 515, 516, 517, 36, 36, 22, - /* 2900 */ 36, 36, 36, 85, 36, 36, 36, 407, 36, 36, - /* 2910 */ 22, 36, 500, 57, 437, 503, 0, 36, 44, 507, - /* 2920 */ 508, 509, 510, 511, 512, 0, 36, 515, 516, 517, - /* 2930 */ 453, 44, 455, 57, 0, 36, 57, 437, 44, 0, - /* 2940 */ 36, 57, 44, 0, 36, 0, 22, 0, 22, 0, - /* 2950 */ 36, 22, 33, 453, 36, 455, 36, 22, 21, 21, - /* 2960 */ 392, 573, 22, 22, 20, 573, 573, 573, 573, 573, + /* 2840 */ 512, 119, 36, 515, 516, 517, 36, 119, 119, 437, + /* 2850 */ 36, 232, 33, 36, 118, 140, 477, 140, 140, 118, + /* 2860 */ 22, 118, 79, 78, 22, 453, 22, 455, 36, 392, + /* 2870 */ 36, 36, 36, 36, 85, 36, 36, 36, 85, 500, + /* 2880 */ 22, 36, 503, 36, 407, 36, 507, 508, 509, 510, + /* 2890 */ 511, 512, 392, 33, 515, 516, 517, 36, 36, 36, + /* 2900 */ 36, 36, 112, 36, 112, 85, 36, 407, 36, 36, + /* 2910 */ 36, 36, 500, 22, 437, 503, 36, 0, 36, 507, + /* 2920 */ 508, 509, 510, 511, 512, 57, 0, 515, 516, 517, + /* 2930 */ 453, 44, 455, 36, 57, 0, 44, 437, 36, 44, + /* 2940 */ 57, 0, 36, 57, 44, 0, 36, 0, 0, 22, + /* 2950 */ 22, 36, 0, 453, 22, 455, 33, 36, 36, 22, + /* 2960 */ 392, 21, 573, 573, 22, 22, 573, 21, 573, 20, /* 2970 */ 573, 573, 573, 561, 573, 407, 573, 500, 573, 573, /* 2980 */ 503, 573, 573, 573, 507, 508, 509, 510, 511, 512, /* 2990 */ 573, 573, 515, 516, 517, 573, 573, 573, 573, 573, @@ -1552,7 +1162,7 @@ static const YYCODETYPE yy_lookahead[] = { /* 4850 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, /* 4860 */ 389, 389, 389, 389, }; -#define YY_SHIFT_COUNT (1024) +#define YY_SHIFT_COUNT (1025) #define YY_SHIFT_MIN (0) #define YY_SHIFT_MAX (2989) static const unsigned short int yy_shift_ofst[] = { @@ -1562,103 +1172,103 @@ static const unsigned short int yy_shift_ofst[] = { /* 30 */ 1940, 1940, 1663, 1940, 1940, 1940, 1940, 1940, 1940, 1940, /* 40 */ 1940, 1940, 1940, 1940, 1940, 1940, 1940, 1940, 1940, 1940, /* 50 */ 1940, 1940, 1940, 1940, 1940, 1940, 1940, 1940, 1940, 1940, - /* 60 */ 1940, 1940, 1940, 34, 66, 180, 253, 46, 122, 46, - /* 70 */ 46, 253, 253, 46, 960, 46, 276, 960, 520, 46, - /* 80 */ 149, 2315, 156, 156, 212, 212, 2315, 2315, 598, 598, - /* 90 */ 156, 20, 20, 346, 89, 89, 69, 204, 212, 212, - /* 100 */ 212, 212, 212, 212, 212, 212, 212, 212, 212, 333, - /* 110 */ 444, 573, 212, 212, 585, 149, 212, 333, 212, 149, - /* 120 */ 212, 212, 212, 212, 149, 212, 212, 212, 149, 212, - /* 130 */ 149, 149, 149, 648, 222, 222, 473, 473, 745, 652, + /* 60 */ 1940, 1940, 1940, 66, 482, 455, 198, 90, 122, 90, + /* 70 */ 90, 198, 198, 90, 960, 90, 276, 960, 313, 90, + /* 80 */ 89, 2315, 156, 156, 149, 149, 2315, 2315, 598, 598, + /* 90 */ 156, 377, 377, 443, 487, 487, 178, 37, 149, 149, + /* 100 */ 149, 149, 149, 149, 149, 149, 149, 149, 149, 180, + /* 110 */ 225, 429, 149, 149, 387, 89, 149, 180, 149, 89, + /* 120 */ 149, 149, 149, 149, 89, 149, 149, 149, 89, 149, + /* 130 */ 89, 89, 89, 427, 222, 222, 473, 473, 745, 652, /* 140 */ 181, 51, 548, 548, 548, 548, 548, 548, 548, 548, /* 150 */ 548, 548, 548, 548, 548, 548, 548, 548, 548, 548, - /* 160 */ 548, 1858, 200, 20, 346, 849, 849, 710, 379, 379, - /* 170 */ 379, 927, 927, 699, 1091, 710, 585, 149, 614, 149, - /* 180 */ 149, 466, 149, 149, 683, 149, 683, 683, 728, 25, + /* 160 */ 548, 1858, 200, 377, 443, 702, 702, 823, 768, 768, + /* 170 */ 768, 708, 708, 1354, 661, 823, 387, 89, 596, 89, + /* 180 */ 89, 366, 89, 89, 658, 89, 658, 658, 704, 747, /* 190 */ 2488, 473, 473, 473, 473, 473, 473, 1190, 21, 53, - /* 200 */ 411, 411, 314, 148, 23, 220, 152, 596, 213, 571, - /* 210 */ 560, 560, 892, 662, 1043, 1043, 1043, 382, 1043, 774, - /* 220 */ 757, 92, 896, 1442, 1208, 682, 1247, 1247, 1254, 1320, - /* 230 */ 1320, 1082, 1000, 241, 1247, 1091, 1510, 1772, 1812, 1814, - /* 240 */ 1601, 585, 1814, 585, 1639, 1812, 1842, 1819, 1842, 1819, - /* 250 */ 1686, 1812, 1842, 1812, 1819, 1686, 1686, 1686, 1782, 1788, - /* 260 */ 1812, 1812, 1792, 1812, 1812, 1812, 1886, 1860, 1886, 1860, - /* 270 */ 1814, 585, 585, 1896, 585, 1935, 1937, 585, 1935, 585, - /* 280 */ 1943, 585, 1948, 585, 585, 1921, 1921, 1812, 585, 1886, - /* 290 */ 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, - /* 300 */ 149, 1812, 25, 25, 1886, 683, 683, 683, 1759, 1881, - /* 310 */ 1814, 648, 1992, 1799, 1806, 1896, 648, 1510, 1812, 683, - /* 320 */ 1714, 1717, 1714, 1717, 1712, 1836, 1714, 1724, 1726, 1745, - /* 330 */ 1510, 1749, 1763, 1738, 1739, 1740, 1842, 2061, 1954, 1770, - /* 340 */ 1935, 648, 648, 1717, 683, 683, 683, 683, 1717, 683, - /* 350 */ 1924, 648, 683, 1948, 648, 2015, 683, 1944, 1948, 648, - /* 360 */ 728, 648, 1842, 683, 683, 683, 683, 683, 683, 683, - /* 370 */ 683, 683, 683, 683, 683, 683, 683, 683, 683, 683, - /* 380 */ 683, 683, 683, 683, 683, 2034, 683, 1812, 648, 2155, - /* 390 */ 2148, 2152, 2151, 1886, 4475, 4475, 4475, 4475, 4475, 4475, - /* 400 */ 4475, 4475, 4475, 4475, 4475, 4475, 39, 2989, 70, 1146, + /* 200 */ 411, 411, 81, 148, 23, 606, 152, 545, 213, 333, + /* 210 */ 414, 414, 1062, 757, 1182, 1182, 1182, 1229, 1182, 815, + /* 220 */ 1037, 957, 1272, 1439, 1310, 476, 374, 374, 1254, 1297, + /* 230 */ 1297, 354, 1462, 1256, 374, 661, 1496, 1768, 1809, 1814, + /* 240 */ 1601, 387, 1814, 387, 1623, 1809, 1839, 1816, 1839, 1816, + /* 250 */ 1685, 1809, 1839, 1809, 1816, 1685, 1685, 1685, 1782, 1788, + /* 260 */ 1809, 1809, 1793, 1809, 1809, 1809, 1892, 1862, 1892, 1862, + /* 270 */ 1814, 387, 387, 1922, 387, 1936, 1938, 387, 1936, 387, + /* 280 */ 1946, 387, 1949, 387, 387, 1918, 1918, 1809, 387, 1892, + /* 290 */ 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, + /* 300 */ 89, 1809, 747, 747, 1892, 658, 658, 658, 1760, 1889, + /* 310 */ 1814, 427, 1992, 1811, 1810, 1922, 427, 1496, 1809, 658, + /* 320 */ 1715, 1722, 1715, 1722, 1721, 1841, 1715, 1725, 1731, 1750, + /* 330 */ 1496, 1757, 1764, 1734, 1740, 1746, 1839, 2067, 1959, 1786, + /* 340 */ 1936, 427, 427, 1722, 658, 658, 658, 658, 1722, 658, + /* 350 */ 1929, 427, 658, 1949, 427, 2022, 658, 1945, 1949, 427, + /* 360 */ 704, 427, 1839, 658, 658, 658, 658, 658, 658, 658, + /* 370 */ 658, 658, 658, 658, 658, 658, 658, 658, 658, 658, + /* 380 */ 658, 658, 658, 658, 658, 2044, 658, 1809, 427, 2146, + /* 390 */ 2148, 2147, 2150, 1892, 4475, 4475, 4475, 4475, 4475, 4475, + /* 400 */ 4475, 4475, 4475, 4475, 4475, 4475, 39, 2989, 298, 1146, /* 410 */ 1193, 1243, 1425, 1711, 715, 1434, 1560, 1570, 1124, 497, /* 420 */ 770, 1584, 1542, 1861, 1878, 1699, 1808, 1004, 1169, 1026, /* 430 */ 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 237, 150, - /* 440 */ 992, 831, 3, 3, 681, 106, 321, 182, 686, 711, - /* 450 */ 334, 752, 837, 767, 928, 928, 687, 736, 1138, 687, - /* 460 */ 687, 687, 1407, 1275, 1206, 1382, 1446, 1365, 1473, 1509, - /* 470 */ 10, 1495, 1373, 399, 1374, 1403, 399, 1408, 1478, 1499, - /* 480 */ 1526, 1302, 1527, 1538, 1545, 1396, 1469, 1489, 179, 1500, - /* 490 */ 1513, 1519, 1561, 1351, 1301, 1130, 1507, 1562, 1568, 1569, - /* 500 */ 1563, 1577, 1488, 1587, 1610, 1632, 1573, 1625, 1633, 1645, - /* 510 */ 1653, 1657, 1558, 1591, 1624, 1692, 1704, 1718, 1720, 1723, - /* 520 */ 1733, 1737, 1741, 1667, 399, 1708, 1730, 1735, 1736, 1742, - /* 530 */ 1575, 1682, 1541, 1589, 1743, 1744, 1719, 1702, 2256, 2257, - /* 540 */ 2258, 2212, 2260, 2225, 2017, 2227, 2228, 2231, 2020, 2268, - /* 550 */ 2233, 2234, 2026, 2236, 2273, 2274, 2030, 2276, 2241, 2278, - /* 560 */ 2243, 2280, 2259, 2282, 2247, 2044, 2285, 2059, 2287, 2062, - /* 570 */ 2064, 2069, 2074, 2294, 2295, 2297, 2083, 2085, 2300, 2301, - /* 580 */ 2142, 2253, 2254, 2306, 2271, 2308, 2309, 2275, 2261, 2310, - /* 590 */ 2262, 2319, 2269, 2317, 2320, 2321, 2264, 2322, 2323, 2324, - /* 600 */ 2325, 2326, 2329, 2157, 2298, 2330, 2159, 2331, 2339, 2340, - /* 610 */ 2341, 2342, 2343, 2344, 2345, 2346, 2347, 2349, 2350, 2352, - /* 620 */ 2354, 2355, 2356, 2357, 2358, 2360, 2361, 2312, 2364, 2318, - /* 630 */ 2377, 2382, 2384, 2385, 2389, 2390, 2391, 2392, 2393, 2395, - /* 640 */ 2375, 2398, 2218, 2380, 2239, 2400, 2242, 2402, 2403, 2383, - /* 650 */ 2362, 2386, 2363, 2404, 2335, 2407, 2338, 2374, 2413, 2348, - /* 660 */ 2416, 2353, 2417, 2418, 2387, 2368, 2376, 2426, 2394, 2370, - /* 670 */ 2388, 2428, 2397, 2372, 2396, 2431, 2399, 2434, 2381, 2439, - /* 680 */ 2406, 2445, 2408, 2410, 2414, 2409, 2411, 2432, 2415, 2459, - /* 690 */ 2419, 2423, 2461, 2468, 2474, 2490, 2452, 2288, 2497, 2409, - /* 700 */ 2455, 2508, 2409, 2458, 2510, 2511, 2433, 2513, 2514, 2480, - /* 710 */ 2460, 2475, 2518, 2484, 2464, 2478, 2523, 2489, 2467, 2483, - /* 720 */ 2528, 2493, 2476, 2487, 2532, 2535, 2537, 2538, 2539, 2504, - /* 730 */ 2543, 2544, 2420, 2421, 2515, 2524, 2549, 2530, 2517, 2522, - /* 740 */ 2525, 2526, 2527, 2529, 2534, 2536, 2541, 2531, 2533, 2545, - /* 750 */ 2546, 2552, 2547, 2550, 2551, 2571, 2553, 2579, 2558, 2548, - /* 760 */ 2584, 2563, 2555, 2586, 2587, 2588, 2556, 2593, 2559, 2594, - /* 770 */ 2560, 2603, 2582, 2589, 2570, 2572, 2575, 2494, 2496, 2612, - /* 780 */ 2422, 2405, 2424, 2498, 2401, 2409, 2564, 2617, 2429, 2583, - /* 790 */ 2598, 2622, 2425, 2602, 2446, 2427, 2628, 2643, 2449, 2440, - /* 800 */ 2453, 2442, 2647, 2618, 2334, 2540, 2542, 2554, 2557, 2631, - /* 810 */ 2561, 2562, 2620, 2621, 2565, 2608, 2569, 2610, 2566, 2576, - /* 820 */ 2630, 2632, 2578, 2580, 2581, 2585, 2590, 2634, 2613, 2619, - /* 830 */ 2592, 2635, 2336, 2605, 2595, 2636, 2599, 2637, 2597, 2600, - /* 840 */ 2668, 2641, 2359, 2639, 2642, 2651, 2658, 2664, 2665, 2604, - /* 850 */ 2606, 2653, 2441, 2669, 2657, 2711, 2712, 2609, 2674, 2607, - /* 860 */ 2611, 2615, 2616, 2567, 2624, 2713, 2677, 2519, 2724, 2629, - /* 870 */ 2638, 2573, 2684, 2577, 2698, 2654, 2457, 2661, 2747, 2728, - /* 880 */ 2499, 2640, 2655, 2656, 2662, 2666, 2659, 2663, 2667, 2670, - /* 890 */ 2671, 2672, 2673, 2675, 2700, 2678, 2679, 2703, 2676, 2735, - /* 900 */ 2591, 2680, 2681, 2776, 2682, 2685, 2601, 2743, 2688, 2687, - /* 910 */ 2779, 2770, 2690, 2691, 2409, 2742, 2694, 2695, 2683, 2696, - /* 920 */ 2697, 2689, 2786, 2614, 2701, 2781, 2785, 2704, 2705, 2789, - /* 930 */ 2708, 2710, 2791, 2667, 2714, 2794, 2670, 2722, 2806, 2671, - /* 940 */ 2731, 2811, 2672, 2715, 2717, 2718, 2719, 2733, 2790, 2734, - /* 950 */ 2817, 2736, 2790, 2790, 2838, 2782, 2784, 2841, 2828, 2830, - /* 960 */ 2832, 2834, 2835, 2836, 2837, 2839, 2840, 2842, 2844, 2792, - /* 970 */ 2762, 2796, 2771, 2852, 2857, 2861, 2862, 2877, 2864, 2865, - /* 980 */ 2866, 2818, 2531, 2868, 2533, 2869, 2870, 2872, 2873, 2888, - /* 990 */ 2875, 2916, 2881, 2856, 2874, 2925, 2890, 2876, 2887, 2934, - /* 1000 */ 2899, 2879, 2894, 2939, 2904, 2884, 2898, 2943, 2908, 2945, - /* 1010 */ 2924, 2947, 2926, 2914, 2949, 2929, 2919, 2918, 2920, 2935, - /* 1020 */ 2937, 2940, 2941, 2938, 2944, + /* 440 */ 992, 813, 3, 3, 343, 106, 321, 182, 370, 646, + /* 450 */ 420, 378, 1011, 124, 751, 751, 1063, 1081, 1138, 1063, + /* 460 */ 1063, 1063, 530, 334, 1395, 1456, 1488, 921, 1349, 1469, + /* 470 */ 5, 794, 1350, 1486, 1403, 1405, 1486, 1422, 882, 1526, + /* 480 */ 1527, 1538, 1610, 1611, 1636, 1088, 1445, 1489, 179, 1519, + /* 490 */ 1561, 1562, 1569, 1391, 1466, 1470, 1500, 1587, 1633, 1634, + /* 500 */ 1564, 1645, 1492, 1571, 1653, 1658, 1575, 1667, 1671, 1708, + /* 510 */ 1709, 1712, 1612, 1683, 1718, 1720, 1723, 1737, 1742, 1744, + /* 520 */ 1747, 1749, 1755, 1696, 1486, 1730, 1736, 1743, 1766, 1778, + /* 530 */ 1483, 1552, 335, 1476, 1738, 1762, 1748, 1135, 2257, 2258, + /* 540 */ 2259, 2213, 2261, 2226, 2018, 2228, 2231, 2232, 2020, 2269, + /* 550 */ 2234, 2235, 2027, 2237, 2274, 2275, 2031, 2277, 2242, 2279, + /* 560 */ 2244, 2281, 2260, 2283, 2248, 2045, 2286, 2060, 2289, 2063, + /* 570 */ 2064, 2072, 2075, 2295, 2297, 2298, 2084, 2086, 2301, 2303, + /* 580 */ 2143, 2254, 2255, 2307, 2272, 2309, 2310, 2280, 2256, 2311, + /* 590 */ 2264, 2317, 2271, 2319, 2320, 2321, 2273, 2322, 2323, 2325, + /* 600 */ 2326, 2329, 2330, 2152, 2300, 2334, 2159, 2339, 2340, 2341, + /* 610 */ 2342, 2343, 2344, 2345, 2346, 2347, 2349, 2350, 2352, 2354, + /* 620 */ 2355, 2356, 2357, 2358, 2360, 2361, 2363, 2313, 2365, 2332, + /* 630 */ 2377, 2380, 2382, 2384, 2385, 2389, 2390, 2391, 2392, 2393, + /* 640 */ 2373, 2397, 2238, 2398, 2240, 2401, 2243, 2403, 2404, 2383, + /* 650 */ 2362, 2386, 2364, 2406, 2336, 2409, 2348, 2374, 2413, 2353, + /* 660 */ 2415, 2359, 2417, 2418, 2387, 2368, 2376, 2426, 2395, 2370, + /* 670 */ 2388, 2428, 2399, 2372, 2396, 2433, 2410, 2434, 2381, 2439, + /* 680 */ 2411, 2442, 2407, 2416, 2422, 2394, 2408, 2447, 2423, 2462, + /* 690 */ 2419, 2424, 2466, 2467, 2490, 2496, 2453, 2288, 2506, 2394, + /* 700 */ 2457, 2509, 2394, 2459, 2511, 2512, 2435, 2513, 2516, 2481, + /* 710 */ 2461, 2475, 2520, 2485, 2465, 2479, 2524, 2489, 2470, 2484, + /* 720 */ 2529, 2495, 2476, 2491, 2532, 2537, 2538, 2539, 2540, 2507, + /* 730 */ 2544, 2546, 2420, 2421, 2514, 2527, 2551, 2530, 2517, 2522, + /* 740 */ 2525, 2526, 2528, 2534, 2535, 2536, 2541, 2533, 2542, 2543, + /* 750 */ 2545, 2552, 2547, 2563, 2558, 2565, 2560, 2573, 2562, 2548, + /* 760 */ 2585, 2564, 2555, 2587, 2588, 2592, 2557, 2594, 2559, 2596, + /* 770 */ 2567, 2604, 2584, 2589, 2572, 2575, 2576, 2494, 2497, 2614, + /* 780 */ 2429, 2405, 2414, 2498, 2402, 2394, 2566, 2618, 2431, 2583, + /* 790 */ 2598, 2622, 2425, 2602, 2446, 2427, 2643, 2646, 2452, 2443, + /* 800 */ 2454, 2445, 2649, 2620, 2337, 2549, 2550, 2553, 2554, 2632, + /* 810 */ 2556, 2561, 2621, 2624, 2569, 2606, 2574, 2609, 2571, 2578, + /* 820 */ 2623, 2629, 2579, 2577, 2581, 2582, 2590, 2630, 2613, 2617, + /* 830 */ 2586, 2637, 2400, 2580, 2591, 2639, 2593, 2640, 2595, 2597, + /* 840 */ 2672, 2644, 2430, 2642, 2645, 2647, 2658, 2665, 2666, 2600, + /* 850 */ 2603, 2628, 2432, 2670, 2657, 2712, 2713, 2599, 2677, 2605, + /* 860 */ 2607, 2610, 2612, 2601, 2615, 2723, 2681, 2570, 2727, 2631, + /* 870 */ 2625, 2608, 2687, 2611, 2709, 2635, 2463, 2638, 2745, 2734, + /* 880 */ 2503, 2648, 2652, 2654, 2656, 2659, 2661, 2663, 2667, 2669, + /* 890 */ 2671, 2673, 2674, 2675, 2698, 2678, 2679, 2707, 2676, 2753, + /* 900 */ 2519, 2680, 2683, 2778, 2684, 2688, 2616, 2735, 2690, 2664, + /* 910 */ 2788, 2768, 2691, 2693, 2394, 2742, 2695, 2696, 2699, 2702, + /* 920 */ 2703, 2694, 2777, 2619, 2705, 2781, 2786, 2708, 2706, 2791, + /* 930 */ 2711, 2714, 2794, 2667, 2722, 2806, 2669, 2728, 2810, 2671, + /* 940 */ 2729, 2814, 2673, 2662, 2715, 2717, 2718, 2736, 2819, 2741, + /* 950 */ 2817, 2743, 2819, 2819, 2838, 2783, 2785, 2842, 2844, 2832, + /* 960 */ 2834, 2835, 2836, 2837, 2839, 2840, 2841, 2845, 2847, 2849, + /* 970 */ 2789, 2790, 2793, 2792, 2860, 2861, 2862, 2863, 2858, 2864, + /* 980 */ 2865, 2867, 2820, 2533, 2870, 2542, 2872, 2873, 2874, 2875, + /* 990 */ 2891, 2880, 2917, 2882, 2868, 2887, 2926, 2897, 2877, 2892, + /* 1000 */ 2935, 2902, 2883, 2895, 2941, 2906, 2886, 2900, 2945, 2910, + /* 1010 */ 2947, 2927, 2948, 2928, 2915, 2952, 2932, 2923, 2921, 2922, + /* 1020 */ 2937, 2940, 2942, 2943, 2946, 2949, }; #define YY_REDUCE_COUNT (405) #define YY_REDUCE_MIN (-536) @@ -1671,145 +1281,145 @@ static const short yy_reduce_ofst[] = { /* 40 */ 3089, 3111, 3176, 3195, 3217, 3282, 3331, 3351, 3371, 3458, /* 50 */ 3477, 3497, 3564, 3584, 3603, 3671, 3690, 3739, 3759, 3827, /* 60 */ 3851, 3933, 3957, -351, 448, 605, -290, -366, 481, 1203, - /* 70 */ 1464, 329, 442, 1485, -412, -536, -153, -393, -534, 14, - /* 80 */ 197, 347, -106, -49, 254, 271, 480, 511, -400, -398, - /* 90 */ -368, -374, -100, -245, 57, 192, 164, -382, -90, 507, - /* 100 */ 539, 551, 43, 229, 718, 806, 834, 843, 305, 151, - /* 110 */ -114, 385, 847, 879, 639, 472, 889, 218, 900, 706, - /* 120 */ 983, 995, 997, 1006, -219, 1029, 1046, 1052, 729, 1061, - /* 130 */ 228, 792, 1017, 616, 61, 61, 184, -415, -35, -259, - /* 140 */ -503, -193, -25, 443, 502, 603, 617, 658, 734, 735, - /* 150 */ 738, 778, 827, 895, 901, 935, 963, 967, 1022, 1027, - /* 160 */ 1039, -14, 121, 33, 316, 256, 588, 651, 121, 258, - /* 170 */ 363, 787, 788, 508, -28, 692, 493, 844, 768, -428, - /* 180 */ 143, 905, 189, 786, 897, 860, 899, 1016, 754, 739, - /* 190 */ 471, 568, 574, 737, 755, 766, 784, 724, 950, 1011, - /* 200 */ 823, 823, 721, 987, 1034, 1072, 1217, 823, 1192, 1192, - /* 210 */ 1236, 1261, 1292, 1244, 1162, 1200, 1202, 1296, 1218, 1192, - /* 220 */ 1317, 1377, 1282, 1383, 1332, 1312, 1334, 1338, 1192, 1262, - /* 230 */ 1263, 1248, 1278, 1265, 1350, 1400, 1348, 1329, 1427, 1344, - /* 240 */ 1342, 1426, 1349, 1435, 1360, 1453, 1456, 1409, 1465, 1416, - /* 250 */ 1421, 1475, 1476, 1479, 1433, 1429, 1437, 1438, 1482, 1486, - /* 260 */ 1497, 1501, 1491, 1503, 1504, 1505, 1514, 1511, 1516, 1517, - /* 270 */ 1444, 1521, 1529, 1487, 1539, 1548, 1477, 1544, 1553, 1550, - /* 280 */ 1494, 1552, 1506, 1554, 1555, 1546, 1551, 1571, 1566, 1576, - /* 290 */ 1549, 1556, 1557, 1559, 1564, 1565, 1572, 1578, 1579, 1580, - /* 300 */ 1581, 1586, 1592, 1593, 1596, 1537, 1583, 1585, 1508, 1520, - /* 310 */ 1531, 1594, 1533, 1540, 1547, 1588, 1620, 1574, 1634, 1598, - /* 320 */ 1490, 1590, 1492, 1597, 1502, 1515, 1512, 1498, 1522, 1518, - /* 330 */ 1595, 1523, 1535, 1528, 1536, 1543, 1672, 1599, 1567, 1602, - /* 340 */ 1678, 1674, 1675, 1630, 1654, 1656, 1659, 1662, 1658, 1665, - /* 350 */ 1666, 1725, 1679, 1661, 1727, 1612, 1690, 1681, 1683, 1747, - /* 360 */ 1721, 1750, 1748, 1697, 1698, 1701, 1703, 1705, 1709, 1715, - /* 370 */ 1716, 1729, 1731, 1732, 1734, 1760, 1766, 1767, 1768, 1778, - /* 380 */ 1779, 1780, 1781, 1783, 1785, 1728, 1787, 1751, 1752, 1784, - /* 390 */ 1793, 1837, 1797, 1813, 1758, 1803, 1746, 1754, 1769, 1773, - /* 400 */ 1815, 1820, 1809, 1821, 1838, 1864, + /* 70 */ 1464, -8, 329, 1485, -393, -536, -153, -412, -534, 14, + /* 80 */ 197, -403, -368, -106, 254, 331, -433, -288, -400, -302, + /* 90 */ -452, -100, 28, -245, 385, 449, -71, 230, 271, 348, + /* 100 */ 364, 514, 261, 488, 526, 532, 539, 550, 517, 218, + /* 110 */ 169, 562, 718, 756, -409, 472, 806, 452, 843, 518, + /* 120 */ 847, 879, 889, 900, 739, 983, 995, 997, 609, 1006, + /* 130 */ -383, 792, 1017, 867, -361, -361, 263, -285, 189, -192, + /* 140 */ 56, 478, -25, 209, 559, 603, 681, 721, 735, 738, + /* 150 */ 778, 849, 895, 935, 963, 967, 1013, 1015, 1022, 1027, + /* 160 */ 1034, -408, 241, 33, 257, 774, 811, 819, 241, 390, + /* 170 */ 929, 549, 788, 911, 607, 913, 1052, 981, 1040, 546, + /* 180 */ 905, 628, 416, 1055, 766, 1014, 897, 1002, 928, 1098, + /* 190 */ -471, 435, 499, 555, 568, 581, 690, 838, 782, 446, + /* 200 */ 737, 737, 926, 732, 996, 988, 1157, 737, 1140, 1140, + /* 210 */ 1164, 1206, 1226, 1174, 1084, 1100, 1125, 1187, 1128, 1140, + /* 220 */ 1237, 1295, 1208, 1309, 1266, 1235, 1279, 1314, 1140, 1239, + /* 230 */ 1240, 1216, 1257, 1259, 1338, 1381, 1328, 1324, 1426, 1344, + /* 240 */ 1342, 1427, 1359, 1441, 1372, 1435, 1454, 1404, 1465, 1409, + /* 250 */ 1420, 1474, 1481, 1475, 1421, 1436, 1437, 1442, 1484, 1487, + /* 260 */ 1498, 1501, 1491, 1503, 1504, 1505, 1514, 1512, 1517, 1532, + /* 270 */ 1429, 1521, 1529, 1499, 1540, 1549, 1478, 1546, 1555, 1550, + /* 280 */ 1495, 1553, 1506, 1558, 1566, 1544, 1551, 1573, 1572, 1576, + /* 290 */ 1556, 1557, 1559, 1565, 1578, 1579, 1580, 1581, 1585, 1586, + /* 300 */ 1591, 1589, 1593, 1595, 1599, 1533, 1539, 1548, 1508, 1516, + /* 310 */ 1522, 1617, 1534, 1545, 1554, 1583, 1626, 1563, 1638, 1592, + /* 320 */ 1490, 1588, 1497, 1590, 1502, 1510, 1507, 1511, 1520, 1523, + /* 330 */ 1594, 1535, 1537, 1509, 1518, 1515, 1679, 1596, 1567, 1598, + /* 340 */ 1695, 1692, 1694, 1635, 1656, 1659, 1662, 1665, 1654, 1673, + /* 350 */ 1666, 1719, 1680, 1672, 1726, 1619, 1697, 1681, 1686, 1741, + /* 360 */ 1717, 1745, 1753, 1698, 1700, 1702, 1703, 1704, 1710, 1716, + /* 370 */ 1724, 1729, 1732, 1759, 1767, 1779, 1780, 1781, 1783, 1785, + /* 380 */ 1787, 1789, 1790, 1791, 1792, 1728, 1794, 1772, 1752, 1795, + /* 390 */ 1800, 1815, 1819, 1822, 1758, 1796, 1688, 1739, 1774, 1775, + /* 400 */ 1817, 1821, 1813, 1825, 1777, 1866, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 10 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 20 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 30 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 40 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 50 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 60 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 70 */ 2300, 2300, 2300, 2683, 2300, 2300, 2639, 2300, 2300, 2300, - /* 80 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 90 */ 2300, 2646, 2646, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 100 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 110 */ 2300, 2300, 2300, 2300, 2410, 2300, 2300, 2300, 2300, 2300, - /* 120 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 130 */ 2300, 2300, 2300, 2408, 2956, 2300, 3084, 2724, 2300, 2300, - /* 140 */ 2985, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 150 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 160 */ 2300, 2300, 2968, 2300, 2300, 2381, 2381, 2300, 2968, 2968, - /* 170 */ 2968, 2928, 2928, 2408, 2300, 2300, 2410, 2300, 2726, 2300, - /* 180 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2553, 2330, - /* 190 */ 2709, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 3014, - /* 200 */ 2960, 2961, 3078, 2300, 3017, 2979, 2300, 2974, 2300, 2300, - /* 210 */ 2300, 2300, 2300, 3004, 2300, 2300, 2300, 2300, 2300, 2300, - /* 220 */ 2651, 2300, 2752, 2300, 2496, 2703, 2300, 2300, 2300, 2300, - /* 230 */ 2300, 3062, 2958, 2998, 2300, 2300, 3008, 2300, 2300, 2300, - /* 240 */ 2740, 2410, 2300, 2410, 2696, 2634, 2300, 2644, 2300, 2644, - /* 250 */ 2641, 2300, 2300, 2300, 2644, 2641, 2641, 2641, 2484, 2480, - /* 260 */ 2300, 2300, 2478, 2300, 2300, 2300, 2300, 2360, 2300, 2360, - /* 270 */ 2300, 2410, 2410, 2300, 2410, 2300, 2300, 2410, 2300, 2410, - /* 280 */ 2300, 2410, 2300, 2410, 2410, 2513, 2513, 2300, 2410, 2300, - /* 290 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 300 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2738, 2719, - /* 310 */ 2300, 2408, 2300, 2707, 2705, 2300, 2408, 3008, 2300, 2300, - /* 320 */ 3032, 3027, 3032, 3027, 3046, 3042, 3032, 3051, 3048, 3010, - /* 330 */ 3008, 2991, 2987, 3081, 3068, 3064, 2300, 2300, 2996, 2994, - /* 340 */ 2300, 2408, 2408, 3027, 2300, 2300, 2300, 2300, 3027, 2300, - /* 350 */ 2300, 2408, 2300, 2300, 2408, 2300, 2300, 2300, 2300, 2408, - /* 360 */ 2300, 2408, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 370 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 380 */ 2300, 2300, 2300, 2300, 2300, 2515, 2300, 2300, 2408, 2300, - /* 390 */ 2332, 2334, 2344, 2300, 2698, 3084, 2724, 2729, 2679, 2679, - /* 400 */ 2556, 2556, 3084, 2556, 2411, 2305, 2300, 2300, 2300, 2300, - /* 410 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 420 */ 2300, 2300, 2857, 2300, 2300, 2300, 2300, 2300, 2300, 3045, - /* 430 */ 3044, 2858, 2300, 2932, 2931, 2930, 2921, 2857, 2509, 2300, - /* 440 */ 2300, 2300, 2856, 2855, 2300, 2300, 2300, 2300, 2300, 2300, - /* 450 */ 2300, 2300, 2300, 2300, 2670, 2669, 2849, 2300, 2300, 2850, - /* 460 */ 2848, 2847, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 470 */ 2300, 2300, 2300, 2500, 2300, 2300, 2497, 2300, 2300, 2300, - /* 480 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 490 */ 2300, 2300, 2300, 2300, 3065, 3069, 2300, 2300, 2300, 2300, - /* 500 */ 2957, 2300, 2300, 2300, 2300, 2300, 2828, 2300, 2300, 2300, - /* 510 */ 2300, 2300, 2796, 2791, 2782, 2773, 2788, 2779, 2767, 2785, - /* 520 */ 2776, 2764, 2761, 2300, 2524, 2300, 2300, 2300, 2300, 2300, - /* 530 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 540 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 550 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 560 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 570 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 580 */ 2640, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 590 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 600 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 610 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 620 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 630 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 640 */ 2300, 2300, 2300, 2300, 2300, 2300, 2655, 2300, 2300, 2300, - /* 650 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 660 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 670 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 680 */ 2300, 2300, 2300, 2300, 2349, 2835, 2300, 2300, 2300, 2300, - /* 690 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2838, - /* 700 */ 2300, 2300, 2839, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 710 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 720 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 730 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 740 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2455, 2454, 2300, - /* 750 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 760 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 770 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2840, 2300, 2300, - /* 780 */ 2300, 2300, 2723, 2300, 2300, 2830, 2300, 2300, 2300, 2300, - /* 790 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 800 */ 2300, 2300, 3061, 3011, 2300, 2300, 2300, 2300, 2300, 2300, - /* 810 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 820 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2828, - /* 830 */ 2300, 3043, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 3059, - /* 840 */ 2300, 3063, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2967, - /* 850 */ 2963, 2300, 2300, 2959, 2300, 2300, 2300, 2300, 2300, 2300, - /* 860 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 870 */ 2300, 2300, 2300, 2300, 2918, 2300, 2300, 2300, 2952, 2300, - /* 880 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2552, 2551, - /* 890 */ 2550, 2549, 2300, 2300, 2300, 2300, 2300, 2300, 2840, 2300, - /* 900 */ 2843, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 910 */ 2300, 2300, 2300, 2300, 2827, 2300, 2895, 2894, 2300, 2300, - /* 920 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2546, 2300, 2300, - /* 930 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 940 */ 2300, 2300, 2300, 2530, 2528, 2527, 2526, 2300, 2563, 2300, - /* 950 */ 2300, 2300, 2559, 2558, 2300, 2300, 2300, 2300, 2300, 2300, - /* 960 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 970 */ 2300, 2300, 2300, 2429, 2300, 2300, 2300, 2300, 2300, 2300, - /* 980 */ 2300, 2300, 2421, 2300, 2420, 2300, 2300, 2300, 2300, 2300, - /* 990 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 1000 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 1010 */ 2300, 2300, 2300, 2300, 2300, 2300, 2329, 2300, 2300, 2300, - /* 1020 */ 2300, 2300, 2300, 2300, 2300, + /* 0 */ 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, + /* 10 */ 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, + /* 20 */ 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, + /* 30 */ 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, + /* 40 */ 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, + /* 50 */ 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, + /* 60 */ 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, + /* 70 */ 2303, 2303, 2303, 2687, 2303, 2303, 2643, 2303, 2303, 2303, + /* 80 */ 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, + /* 90 */ 2303, 2650, 2650, 2303, 2303, 2303, 2303, 2303, 2303, 2303, + /* 100 */ 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, + /* 110 */ 2303, 2303, 2303, 2303, 2413, 2303, 2303, 2303, 2303, 2303, + /* 120 */ 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, + /* 130 */ 2303, 2303, 2303, 2411, 2960, 2303, 3088, 2728, 2303, 2303, + /* 140 */ 2989, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, + /* 150 */ 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, + /* 160 */ 2303, 2303, 2972, 2303, 2303, 2384, 2384, 2303, 2972, 2972, + /* 170 */ 2972, 2932, 2932, 2411, 2303, 2303, 2413, 2303, 2730, 2303, + /* 180 */ 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2557, 2333, + /* 190 */ 2713, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 3018, + /* 200 */ 2964, 2965, 3082, 2303, 3021, 2983, 2303, 2978, 2303, 2303, + /* 210 */ 2303, 2303, 2303, 3008, 2303, 2303, 2303, 2303, 2303, 2303, + /* 220 */ 2655, 2303, 2756, 2303, 2500, 2707, 2303, 2303, 2303, 2303, + /* 230 */ 2303, 3066, 2962, 3002, 2303, 2303, 3012, 2303, 2303, 2303, + /* 240 */ 2744, 2413, 2303, 2413, 2700, 2638, 2303, 2648, 2303, 2648, + /* 250 */ 2645, 2303, 2303, 2303, 2648, 2645, 2645, 2645, 2488, 2484, + /* 260 */ 2303, 2303, 2482, 2303, 2303, 2303, 2303, 2363, 2303, 2363, + /* 270 */ 2303, 2413, 2413, 2303, 2413, 2303, 2303, 2413, 2303, 2413, + /* 280 */ 2303, 2413, 2303, 2413, 2413, 2517, 2517, 2303, 2413, 2303, + /* 290 */ 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, + /* 300 */ 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2742, 2723, + /* 310 */ 2303, 2411, 2303, 2711, 2709, 2303, 2411, 3012, 2303, 2303, + /* 320 */ 3036, 3031, 3036, 3031, 3050, 3046, 3036, 3055, 3052, 3014, + /* 330 */ 3012, 2995, 2991, 3085, 3072, 3068, 2303, 2303, 3000, 2998, + /* 340 */ 2303, 2411, 2411, 3031, 2303, 2303, 2303, 2303, 3031, 2303, + /* 350 */ 2303, 2411, 2303, 2303, 2411, 2303, 2303, 2303, 2303, 2411, + /* 360 */ 2303, 2411, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, + /* 370 */ 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, + /* 380 */ 2303, 2303, 2303, 2303, 2303, 2519, 2303, 2303, 2411, 2303, + /* 390 */ 2335, 2337, 2347, 2303, 2702, 3088, 2728, 2733, 2683, 2683, + /* 400 */ 2560, 2560, 3088, 2560, 2414, 2308, 2303, 2303, 2303, 2303, + /* 410 */ 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, + /* 420 */ 2303, 2303, 2861, 2303, 2303, 2303, 2303, 2303, 2303, 3049, + /* 430 */ 3048, 2862, 2303, 2936, 2935, 2934, 2925, 2861, 2513, 2303, + /* 440 */ 2303, 2303, 2860, 2859, 2303, 2303, 2303, 2303, 2303, 2303, + /* 450 */ 2303, 2303, 2303, 2303, 2674, 2673, 2853, 2303, 2303, 2854, + /* 460 */ 2852, 2851, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, + /* 470 */ 2303, 2303, 2303, 2504, 2303, 2303, 2501, 2303, 2303, 2303, + /* 480 */ 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, + /* 490 */ 2303, 2303, 2303, 2303, 3069, 3073, 2303, 2303, 2303, 2303, + /* 500 */ 2961, 2303, 2303, 2303, 2303, 2303, 2832, 2303, 2303, 2303, + /* 510 */ 2303, 2303, 2800, 2795, 2786, 2777, 2792, 2783, 2771, 2789, + /* 520 */ 2780, 2768, 2765, 2303, 2528, 2303, 2303, 2303, 2303, 2303, + /* 530 */ 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, + /* 540 */ 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, + /* 550 */ 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, + /* 560 */ 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, + /* 570 */ 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, + /* 580 */ 2644, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, + /* 590 */ 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, + /* 600 */ 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, + /* 610 */ 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, + /* 620 */ 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, + /* 630 */ 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, + /* 640 */ 2303, 2303, 2303, 2303, 2303, 2303, 2659, 2303, 2303, 2303, + /* 650 */ 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, + /* 660 */ 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, + /* 670 */ 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, + /* 680 */ 2303, 2303, 2303, 2303, 2352, 2839, 2303, 2303, 2303, 2303, + /* 690 */ 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2842, + /* 700 */ 2303, 2303, 2843, 2303, 2303, 2303, 2303, 2303, 2303, 2303, + /* 710 */ 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, + /* 720 */ 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, + /* 730 */ 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, + /* 740 */ 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2459, 2458, 2303, + /* 750 */ 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, + /* 760 */ 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, + /* 770 */ 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2844, 2303, 2303, + /* 780 */ 2303, 2303, 2727, 2303, 2303, 2834, 2303, 2303, 2303, 2303, + /* 790 */ 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, + /* 800 */ 2303, 2303, 3065, 3015, 2303, 2303, 2303, 2303, 2303, 2303, + /* 810 */ 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, + /* 820 */ 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2832, + /* 830 */ 2303, 3047, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 3063, + /* 840 */ 2303, 3067, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2971, + /* 850 */ 2967, 2303, 2303, 2963, 2303, 2303, 2303, 2303, 2303, 2303, + /* 860 */ 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, + /* 870 */ 2303, 2303, 2303, 2303, 2922, 2303, 2303, 2303, 2956, 2303, + /* 880 */ 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2556, 2555, + /* 890 */ 2554, 2553, 2303, 2303, 2303, 2303, 2303, 2303, 2844, 2303, + /* 900 */ 2847, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, + /* 910 */ 2303, 2303, 2303, 2303, 2831, 2303, 2899, 2898, 2303, 2303, + /* 920 */ 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2550, 2303, 2303, + /* 930 */ 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, + /* 940 */ 2303, 2303, 2303, 2534, 2532, 2531, 2530, 2303, 2567, 2303, + /* 950 */ 2303, 2303, 2563, 2562, 2303, 2303, 2303, 2303, 2303, 2303, + /* 960 */ 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, + /* 970 */ 2303, 2303, 2303, 2303, 2432, 2303, 2303, 2303, 2303, 2303, + /* 980 */ 2303, 2303, 2303, 2424, 2303, 2423, 2303, 2303, 2303, 2303, + /* 990 */ 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, + /* 1000 */ 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2303, + /* 1010 */ 2303, 2303, 2303, 2303, 2303, 2303, 2303, 2332, 2303, 2303, + /* 1020 */ 2303, 2303, 2303, 2303, 2303, 2303, }; /********** End of lemon-generated parsing tables *****************************/ @@ -2271,7 +1881,6 @@ typedef struct yyParser yyParser; #ifndef NDEBUG #include -#include static FILE *yyTraceFILE = 0; static char *yyTracePrompt = 0; #endif /* NDEBUG */ @@ -3031,645 +2640,646 @@ static const char *const yyRuleName[] = { /* 142 */ "db_options ::= db_options S3_COMPACT NK_INTEGER", /* 143 */ "db_options ::= db_options KEEP_TIME_OFFSET NK_INTEGER", /* 144 */ "db_options ::= db_options ENCRYPT_ALGORITHM NK_STRING", - /* 145 */ "alter_db_options ::= alter_db_option", - /* 146 */ "alter_db_options ::= alter_db_options alter_db_option", - /* 147 */ "alter_db_option ::= BUFFER NK_INTEGER", - /* 148 */ "alter_db_option ::= CACHEMODEL NK_STRING", - /* 149 */ "alter_db_option ::= CACHESIZE NK_INTEGER", - /* 150 */ "alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER", - /* 151 */ "alter_db_option ::= KEEP integer_list", - /* 152 */ "alter_db_option ::= KEEP variable_list", - /* 153 */ "alter_db_option ::= PAGES NK_INTEGER", - /* 154 */ "alter_db_option ::= REPLICA NK_INTEGER", - /* 155 */ "alter_db_option ::= WAL_LEVEL NK_INTEGER", - /* 156 */ "alter_db_option ::= STT_TRIGGER NK_INTEGER", - /* 157 */ "alter_db_option ::= MINROWS NK_INTEGER", - /* 158 */ "alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER", - /* 159 */ "alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER", - /* 160 */ "alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER", - /* 161 */ "alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER", - /* 162 */ "alter_db_option ::= S3_KEEPLOCAL NK_INTEGER", - /* 163 */ "alter_db_option ::= S3_KEEPLOCAL NK_VARIABLE", - /* 164 */ "alter_db_option ::= S3_COMPACT NK_INTEGER", - /* 165 */ "alter_db_option ::= KEEP_TIME_OFFSET NK_INTEGER", - /* 166 */ "alter_db_option ::= ENCRYPT_ALGORITHM NK_STRING", - /* 167 */ "integer_list ::= NK_INTEGER", - /* 168 */ "integer_list ::= integer_list NK_COMMA NK_INTEGER", - /* 169 */ "variable_list ::= NK_VARIABLE", - /* 170 */ "variable_list ::= variable_list NK_COMMA NK_VARIABLE", - /* 171 */ "retention_list ::= retention", - /* 172 */ "retention_list ::= retention_list NK_COMMA retention", - /* 173 */ "retention ::= NK_VARIABLE NK_COLON NK_VARIABLE", - /* 174 */ "retention ::= NK_MINUS NK_COLON NK_VARIABLE", - /* 175 */ "speed_opt ::=", - /* 176 */ "speed_opt ::= BWLIMIT NK_INTEGER", - /* 177 */ "start_opt ::=", - /* 178 */ "start_opt ::= START WITH NK_INTEGER", - /* 179 */ "start_opt ::= START WITH NK_STRING", - /* 180 */ "start_opt ::= START WITH TIMESTAMP NK_STRING", - /* 181 */ "end_opt ::=", - /* 182 */ "end_opt ::= END WITH NK_INTEGER", - /* 183 */ "end_opt ::= END WITH NK_STRING", - /* 184 */ "end_opt ::= END WITH TIMESTAMP NK_STRING", - /* 185 */ "cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options", - /* 186 */ "cmd ::= CREATE TABLE multi_create_clause", - /* 187 */ "cmd ::= CREATE TABLE not_exists_opt USING full_table_name NK_LP tag_list_opt NK_RP FILE NK_STRING", - /* 188 */ "cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options", - /* 189 */ "cmd ::= DROP TABLE with_opt multi_drop_clause", - /* 190 */ "cmd ::= DROP STABLE with_opt exists_opt full_table_name", - /* 191 */ "cmd ::= ALTER TABLE alter_table_clause", - /* 192 */ "cmd ::= ALTER STABLE alter_table_clause", - /* 193 */ "alter_table_clause ::= full_table_name alter_table_options", - /* 194 */ "alter_table_clause ::= full_table_name ADD COLUMN column_name type_name column_options", - /* 195 */ "alter_table_clause ::= full_table_name DROP COLUMN column_name", - /* 196 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name", - /* 197 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name column_options", - /* 198 */ "alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name", - /* 199 */ "alter_table_clause ::= full_table_name ADD TAG column_name type_name", - /* 200 */ "alter_table_clause ::= full_table_name DROP TAG column_name", - /* 201 */ "alter_table_clause ::= full_table_name MODIFY TAG column_name type_name", - /* 202 */ "alter_table_clause ::= full_table_name RENAME TAG column_name column_name", - /* 203 */ "alter_table_clause ::= full_table_name SET TAG column_name NK_EQ tags_literal", - /* 204 */ "multi_create_clause ::= create_subtable_clause", - /* 205 */ "multi_create_clause ::= multi_create_clause create_subtable_clause", - /* 206 */ "create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP tags_literal_list NK_RP table_options", - /* 207 */ "multi_drop_clause ::= drop_table_clause", - /* 208 */ "multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause", - /* 209 */ "drop_table_clause ::= exists_opt full_table_name", - /* 210 */ "with_opt ::=", - /* 211 */ "with_opt ::= WITH", - /* 212 */ "specific_cols_opt ::=", - /* 213 */ "specific_cols_opt ::= NK_LP col_name_list NK_RP", - /* 214 */ "full_table_name ::= table_name", - /* 215 */ "full_table_name ::= db_name NK_DOT table_name", - /* 216 */ "tag_def_list ::= tag_def", - /* 217 */ "tag_def_list ::= tag_def_list NK_COMMA tag_def", - /* 218 */ "tag_def ::= column_name type_name", - /* 219 */ "column_def_list ::= column_def", - /* 220 */ "column_def_list ::= column_def_list NK_COMMA column_def", - /* 221 */ "column_def ::= column_name type_name column_options", - /* 222 */ "type_name ::= BOOL", - /* 223 */ "type_name ::= TINYINT", - /* 224 */ "type_name ::= SMALLINT", - /* 225 */ "type_name ::= INT", - /* 226 */ "type_name ::= INTEGER", - /* 227 */ "type_name ::= BIGINT", - /* 228 */ "type_name ::= FLOAT", - /* 229 */ "type_name ::= DOUBLE", - /* 230 */ "type_name ::= BINARY NK_LP NK_INTEGER NK_RP", - /* 231 */ "type_name ::= TIMESTAMP", - /* 232 */ "type_name ::= NCHAR NK_LP NK_INTEGER NK_RP", - /* 233 */ "type_name ::= TINYINT UNSIGNED", - /* 234 */ "type_name ::= SMALLINT UNSIGNED", - /* 235 */ "type_name ::= INT UNSIGNED", - /* 236 */ "type_name ::= BIGINT UNSIGNED", - /* 237 */ "type_name ::= JSON", - /* 238 */ "type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP", - /* 239 */ "type_name ::= MEDIUMBLOB", - /* 240 */ "type_name ::= BLOB", - /* 241 */ "type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP", - /* 242 */ "type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP", - /* 243 */ "type_name ::= DECIMAL", - /* 244 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP", - /* 245 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", - /* 246 */ "type_name_default_len ::= BINARY", - /* 247 */ "type_name_default_len ::= NCHAR", - /* 248 */ "type_name_default_len ::= VARCHAR", - /* 249 */ "type_name_default_len ::= VARBINARY", - /* 250 */ "tags_def_opt ::=", - /* 251 */ "tags_def_opt ::= tags_def", - /* 252 */ "tags_def ::= TAGS NK_LP tag_def_list NK_RP", - /* 253 */ "table_options ::=", - /* 254 */ "table_options ::= table_options COMMENT NK_STRING", - /* 255 */ "table_options ::= table_options MAX_DELAY duration_list", - /* 256 */ "table_options ::= table_options WATERMARK duration_list", - /* 257 */ "table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP", - /* 258 */ "table_options ::= table_options TTL NK_INTEGER", - /* 259 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP", - /* 260 */ "table_options ::= table_options DELETE_MARK duration_list", - /* 261 */ "alter_table_options ::= alter_table_option", - /* 262 */ "alter_table_options ::= alter_table_options alter_table_option", - /* 263 */ "alter_table_option ::= COMMENT NK_STRING", - /* 264 */ "alter_table_option ::= TTL NK_INTEGER", - /* 265 */ "duration_list ::= duration_literal", - /* 266 */ "duration_list ::= duration_list NK_COMMA duration_literal", - /* 267 */ "rollup_func_list ::= rollup_func_name", - /* 268 */ "rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name", - /* 269 */ "rollup_func_name ::= function_name", - /* 270 */ "rollup_func_name ::= FIRST", - /* 271 */ "rollup_func_name ::= LAST", - /* 272 */ "col_name_list ::= col_name", - /* 273 */ "col_name_list ::= col_name_list NK_COMMA col_name", - /* 274 */ "col_name ::= column_name", - /* 275 */ "cmd ::= SHOW DNODES", - /* 276 */ "cmd ::= SHOW USERS", - /* 277 */ "cmd ::= SHOW USERS FULL", - /* 278 */ "cmd ::= SHOW USER PRIVILEGES", - /* 279 */ "cmd ::= SHOW db_kind_opt DATABASES", - /* 280 */ "cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt", - /* 281 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt", - /* 282 */ "cmd ::= SHOW db_name_cond_opt VGROUPS", - /* 283 */ "cmd ::= SHOW MNODES", - /* 284 */ "cmd ::= SHOW QNODES", - /* 285 */ "cmd ::= SHOW ANODES", - /* 286 */ "cmd ::= SHOW ANODES FULL", - /* 287 */ "cmd ::= SHOW ARBGROUPS", - /* 288 */ "cmd ::= SHOW FUNCTIONS", - /* 289 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt", - /* 290 */ "cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name", - /* 291 */ "cmd ::= SHOW STREAMS", - /* 292 */ "cmd ::= SHOW ACCOUNTS", - /* 293 */ "cmd ::= SHOW APPS", - /* 294 */ "cmd ::= SHOW CONNECTIONS", - /* 295 */ "cmd ::= SHOW LICENCES", - /* 296 */ "cmd ::= SHOW GRANTS", - /* 297 */ "cmd ::= SHOW GRANTS FULL", - /* 298 */ "cmd ::= SHOW GRANTS LOGS", - /* 299 */ "cmd ::= SHOW CLUSTER MACHINES", - /* 300 */ "cmd ::= SHOW CREATE DATABASE db_name", - /* 301 */ "cmd ::= SHOW CREATE TABLE full_table_name", - /* 302 */ "cmd ::= SHOW CREATE STABLE full_table_name", - /* 303 */ "cmd ::= SHOW ENCRYPTIONS", - /* 304 */ "cmd ::= SHOW QUERIES", - /* 305 */ "cmd ::= SHOW SCORES", - /* 306 */ "cmd ::= SHOW TOPICS", - /* 307 */ "cmd ::= SHOW VARIABLES", - /* 308 */ "cmd ::= SHOW CLUSTER VARIABLES", - /* 309 */ "cmd ::= SHOW LOCAL VARIABLES", - /* 310 */ "cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt", - /* 311 */ "cmd ::= SHOW BNODES", - /* 312 */ "cmd ::= SHOW SNODES", - /* 313 */ "cmd ::= SHOW CLUSTER", - /* 314 */ "cmd ::= SHOW TRANSACTIONS", - /* 315 */ "cmd ::= SHOW TABLE DISTRIBUTED full_table_name", - /* 316 */ "cmd ::= SHOW CONSUMERS", - /* 317 */ "cmd ::= SHOW SUBSCRIPTIONS", - /* 318 */ "cmd ::= SHOW TAGS FROM table_name_cond from_db_opt", - /* 319 */ "cmd ::= SHOW TAGS FROM db_name NK_DOT table_name", - /* 320 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt", - /* 321 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name", - /* 322 */ "cmd ::= SHOW VNODES ON DNODE NK_INTEGER", - /* 323 */ "cmd ::= SHOW VNODES", - /* 324 */ "cmd ::= SHOW db_name_cond_opt ALIVE", - /* 325 */ "cmd ::= SHOW CLUSTER ALIVE", - /* 326 */ "cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt", - /* 327 */ "cmd ::= SHOW CREATE VIEW full_table_name", - /* 328 */ "cmd ::= SHOW COMPACTS", - /* 329 */ "cmd ::= SHOW COMPACT NK_INTEGER", - /* 330 */ "table_kind_db_name_cond_opt ::=", - /* 331 */ "table_kind_db_name_cond_opt ::= table_kind", - /* 332 */ "table_kind_db_name_cond_opt ::= db_name NK_DOT", - /* 333 */ "table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT", - /* 334 */ "table_kind ::= NORMAL", - /* 335 */ "table_kind ::= CHILD", - /* 336 */ "db_name_cond_opt ::=", - /* 337 */ "db_name_cond_opt ::= db_name NK_DOT", - /* 338 */ "like_pattern_opt ::=", - /* 339 */ "like_pattern_opt ::= LIKE NK_STRING", - /* 340 */ "table_name_cond ::= table_name", - /* 341 */ "from_db_opt ::=", - /* 342 */ "from_db_opt ::= FROM db_name", - /* 343 */ "tag_list_opt ::=", - /* 344 */ "tag_list_opt ::= tag_item", - /* 345 */ "tag_list_opt ::= tag_list_opt NK_COMMA tag_item", - /* 346 */ "tag_item ::= TBNAME", - /* 347 */ "tag_item ::= QTAGS", - /* 348 */ "tag_item ::= column_name", - /* 349 */ "tag_item ::= column_name column_alias", - /* 350 */ "tag_item ::= column_name AS column_alias", - /* 351 */ "db_kind_opt ::=", - /* 352 */ "db_kind_opt ::= USER", - /* 353 */ "db_kind_opt ::= SYSTEM", - /* 354 */ "cmd ::= CREATE TSMA not_exists_opt tsma_name ON full_table_name tsma_func_list INTERVAL NK_LP duration_literal NK_RP", - /* 355 */ "cmd ::= CREATE RECURSIVE TSMA not_exists_opt tsma_name ON full_table_name INTERVAL NK_LP duration_literal NK_RP", - /* 356 */ "cmd ::= DROP TSMA exists_opt full_tsma_name", - /* 357 */ "cmd ::= SHOW db_name_cond_opt TSMAS", - /* 358 */ "full_tsma_name ::= tsma_name", - /* 359 */ "full_tsma_name ::= db_name NK_DOT tsma_name", - /* 360 */ "tsma_func_list ::= FUNCTION NK_LP func_list NK_RP", - /* 361 */ "cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options", - /* 362 */ "cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP", - /* 363 */ "cmd ::= DROP INDEX exists_opt full_index_name", - /* 364 */ "full_index_name ::= index_name", - /* 365 */ "full_index_name ::= db_name NK_DOT index_name", - /* 366 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt", - /* 367 */ "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", - /* 368 */ "func_list ::= func", - /* 369 */ "func_list ::= func_list NK_COMMA func", - /* 370 */ "func ::= sma_func_name NK_LP expression_list NK_RP", - /* 371 */ "sma_func_name ::= function_name", - /* 372 */ "sma_func_name ::= COUNT", - /* 373 */ "sma_func_name ::= FIRST", - /* 374 */ "sma_func_name ::= LAST", - /* 375 */ "sma_func_name ::= LAST_ROW", - /* 376 */ "sma_stream_opt ::=", - /* 377 */ "sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal", - /* 378 */ "sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal", - /* 379 */ "sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal", - /* 380 */ "with_meta ::= AS", - /* 381 */ "with_meta ::= WITH META AS", - /* 382 */ "with_meta ::= ONLY META AS", - /* 383 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery", - /* 384 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name", - /* 385 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt", - /* 386 */ "cmd ::= DROP TOPIC exists_opt topic_name", - /* 387 */ "cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name", - /* 388 */ "cmd ::= DESC full_table_name", - /* 389 */ "cmd ::= DESCRIBE full_table_name", - /* 390 */ "cmd ::= RESET QUERY CACHE", - /* 391 */ "cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery", - /* 392 */ "cmd ::= EXPLAIN analyze_opt explain_options insert_query", - /* 393 */ "analyze_opt ::=", - /* 394 */ "analyze_opt ::= ANALYZE", - /* 395 */ "explain_options ::=", - /* 396 */ "explain_options ::= explain_options VERBOSE NK_BOOL", - /* 397 */ "explain_options ::= explain_options RATIO NK_FLOAT", - /* 398 */ "cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt", - /* 399 */ "cmd ::= DROP FUNCTION exists_opt function_name", - /* 400 */ "agg_func_opt ::=", - /* 401 */ "agg_func_opt ::= AGGREGATE", - /* 402 */ "bufsize_opt ::=", - /* 403 */ "bufsize_opt ::= BUFSIZE NK_INTEGER", - /* 404 */ "language_opt ::=", - /* 405 */ "language_opt ::= LANGUAGE NK_STRING", - /* 406 */ "or_replace_opt ::=", - /* 407 */ "or_replace_opt ::= OR REPLACE", - /* 408 */ "cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery", - /* 409 */ "cmd ::= DROP VIEW exists_opt full_view_name", - /* 410 */ "full_view_name ::= view_name", - /* 411 */ "full_view_name ::= db_name NK_DOT view_name", - /* 412 */ "cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery", - /* 413 */ "cmd ::= DROP STREAM exists_opt stream_name", - /* 414 */ "cmd ::= PAUSE STREAM exists_opt stream_name", - /* 415 */ "cmd ::= RESUME STREAM exists_opt ignore_opt stream_name", - /* 416 */ "col_list_opt ::=", - /* 417 */ "col_list_opt ::= NK_LP column_stream_def_list NK_RP", - /* 418 */ "column_stream_def_list ::= column_stream_def", - /* 419 */ "column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def", - /* 420 */ "column_stream_def ::= column_name stream_col_options", - /* 421 */ "stream_col_options ::=", - /* 422 */ "stream_col_options ::= stream_col_options PRIMARY KEY", - /* 423 */ "tag_def_or_ref_opt ::=", - /* 424 */ "tag_def_or_ref_opt ::= tags_def", - /* 425 */ "tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP", - /* 426 */ "stream_options ::=", - /* 427 */ "stream_options ::= stream_options TRIGGER AT_ONCE", - /* 428 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE", - /* 429 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal", - /* 430 */ "stream_options ::= stream_options WATERMARK duration_literal", - /* 431 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER", - /* 432 */ "stream_options ::= stream_options FILL_HISTORY NK_INTEGER", - /* 433 */ "stream_options ::= stream_options DELETE_MARK duration_literal", - /* 434 */ "stream_options ::= stream_options IGNORE UPDATE NK_INTEGER", - /* 435 */ "subtable_opt ::=", - /* 436 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP", - /* 437 */ "ignore_opt ::=", - /* 438 */ "ignore_opt ::= IGNORE UNTREATED", - /* 439 */ "cmd ::= KILL CONNECTION NK_INTEGER", - /* 440 */ "cmd ::= KILL QUERY NK_STRING", - /* 441 */ "cmd ::= KILL TRANSACTION NK_INTEGER", - /* 442 */ "cmd ::= KILL COMPACT NK_INTEGER", - /* 443 */ "cmd ::= BALANCE VGROUP", - /* 444 */ "cmd ::= BALANCE VGROUP LEADER on_vgroup_id", - /* 445 */ "cmd ::= BALANCE VGROUP LEADER DATABASE db_name", - /* 446 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", - /* 447 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", - /* 448 */ "cmd ::= SPLIT VGROUP NK_INTEGER", - /* 449 */ "on_vgroup_id ::=", - /* 450 */ "on_vgroup_id ::= ON NK_INTEGER", - /* 451 */ "dnode_list ::= DNODE NK_INTEGER", - /* 452 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", - /* 453 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", - /* 454 */ "cmd ::= query_or_subquery", - /* 455 */ "cmd ::= insert_query", - /* 456 */ "insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery", - /* 457 */ "insert_query ::= INSERT INTO full_table_name query_or_subquery", - /* 458 */ "tags_literal ::= NK_INTEGER", - /* 459 */ "tags_literal ::= NK_INTEGER NK_PLUS duration_literal", - /* 460 */ "tags_literal ::= NK_INTEGER NK_MINUS duration_literal", - /* 461 */ "tags_literal ::= NK_PLUS NK_INTEGER", - /* 462 */ "tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal", - /* 463 */ "tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal", - /* 464 */ "tags_literal ::= NK_MINUS NK_INTEGER", - /* 465 */ "tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal", - /* 466 */ "tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal", - /* 467 */ "tags_literal ::= NK_FLOAT", - /* 468 */ "tags_literal ::= NK_PLUS NK_FLOAT", - /* 469 */ "tags_literal ::= NK_MINUS NK_FLOAT", - /* 470 */ "tags_literal ::= NK_BIN", - /* 471 */ "tags_literal ::= NK_BIN NK_PLUS duration_literal", - /* 472 */ "tags_literal ::= NK_BIN NK_MINUS duration_literal", - /* 473 */ "tags_literal ::= NK_PLUS NK_BIN", - /* 474 */ "tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal", - /* 475 */ "tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal", - /* 476 */ "tags_literal ::= NK_MINUS NK_BIN", - /* 477 */ "tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal", - /* 478 */ "tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal", - /* 479 */ "tags_literal ::= NK_HEX", - /* 480 */ "tags_literal ::= NK_HEX NK_PLUS duration_literal", - /* 481 */ "tags_literal ::= NK_HEX NK_MINUS duration_literal", - /* 482 */ "tags_literal ::= NK_PLUS NK_HEX", - /* 483 */ "tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal", - /* 484 */ "tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal", - /* 485 */ "tags_literal ::= NK_MINUS NK_HEX", - /* 486 */ "tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal", - /* 487 */ "tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal", - /* 488 */ "tags_literal ::= NK_STRING", - /* 489 */ "tags_literal ::= NK_STRING NK_PLUS duration_literal", - /* 490 */ "tags_literal ::= NK_STRING NK_MINUS duration_literal", - /* 491 */ "tags_literal ::= NK_BOOL", - /* 492 */ "tags_literal ::= NULL", - /* 493 */ "tags_literal ::= literal_func", - /* 494 */ "tags_literal ::= literal_func NK_PLUS duration_literal", - /* 495 */ "tags_literal ::= literal_func NK_MINUS duration_literal", - /* 496 */ "tags_literal_list ::= tags_literal", - /* 497 */ "tags_literal_list ::= tags_literal_list NK_COMMA tags_literal", - /* 498 */ "literal ::= NK_INTEGER", - /* 499 */ "literal ::= NK_FLOAT", - /* 500 */ "literal ::= NK_STRING", - /* 501 */ "literal ::= NK_BOOL", - /* 502 */ "literal ::= TIMESTAMP NK_STRING", - /* 503 */ "literal ::= duration_literal", - /* 504 */ "literal ::= NULL", - /* 505 */ "literal ::= NK_QUESTION", - /* 506 */ "duration_literal ::= NK_VARIABLE", - /* 507 */ "signed ::= NK_INTEGER", - /* 508 */ "signed ::= NK_PLUS NK_INTEGER", - /* 509 */ "signed ::= NK_MINUS NK_INTEGER", - /* 510 */ "signed ::= NK_FLOAT", - /* 511 */ "signed ::= NK_PLUS NK_FLOAT", - /* 512 */ "signed ::= NK_MINUS NK_FLOAT", - /* 513 */ "signed_literal ::= signed", - /* 514 */ "signed_literal ::= NK_STRING", - /* 515 */ "signed_literal ::= NK_BOOL", - /* 516 */ "signed_literal ::= TIMESTAMP NK_STRING", - /* 517 */ "signed_literal ::= duration_literal", - /* 518 */ "signed_literal ::= NULL", - /* 519 */ "signed_literal ::= literal_func", - /* 520 */ "signed_literal ::= NK_QUESTION", - /* 521 */ "literal_list ::= signed_literal", - /* 522 */ "literal_list ::= literal_list NK_COMMA signed_literal", - /* 523 */ "db_name ::= NK_ID", - /* 524 */ "table_name ::= NK_ID", - /* 525 */ "column_name ::= NK_ID", - /* 526 */ "function_name ::= NK_ID", - /* 527 */ "view_name ::= NK_ID", - /* 528 */ "table_alias ::= NK_ID", - /* 529 */ "column_alias ::= NK_ID", - /* 530 */ "column_alias ::= NK_ALIAS", - /* 531 */ "user_name ::= NK_ID", - /* 532 */ "topic_name ::= NK_ID", - /* 533 */ "stream_name ::= NK_ID", - /* 534 */ "cgroup_name ::= NK_ID", - /* 535 */ "index_name ::= NK_ID", - /* 536 */ "tsma_name ::= NK_ID", - /* 537 */ "expr_or_subquery ::= expression", - /* 538 */ "expression ::= literal", - /* 539 */ "expression ::= pseudo_column", - /* 540 */ "expression ::= column_reference", - /* 541 */ "expression ::= function_expression", - /* 542 */ "expression ::= case_when_expression", - /* 543 */ "expression ::= NK_LP expression NK_RP", - /* 544 */ "expression ::= NK_PLUS expr_or_subquery", - /* 545 */ "expression ::= NK_MINUS expr_or_subquery", - /* 546 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery", - /* 547 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery", - /* 548 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery", - /* 549 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery", - /* 550 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery", - /* 551 */ "expression ::= column_reference NK_ARROW NK_STRING", - /* 552 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery", - /* 553 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery", - /* 554 */ "expression_list ::= expr_or_subquery", - /* 555 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery", - /* 556 */ "column_reference ::= column_name", - /* 557 */ "column_reference ::= table_name NK_DOT column_name", - /* 558 */ "column_reference ::= NK_ALIAS", - /* 559 */ "column_reference ::= table_name NK_DOT NK_ALIAS", - /* 560 */ "pseudo_column ::= ROWTS", - /* 561 */ "pseudo_column ::= TBNAME", - /* 562 */ "pseudo_column ::= table_name NK_DOT TBNAME", - /* 563 */ "pseudo_column ::= QSTART", - /* 564 */ "pseudo_column ::= QEND", - /* 565 */ "pseudo_column ::= QDURATION", - /* 566 */ "pseudo_column ::= WSTART", - /* 567 */ "pseudo_column ::= WEND", - /* 568 */ "pseudo_column ::= WDURATION", - /* 569 */ "pseudo_column ::= IROWTS", - /* 570 */ "pseudo_column ::= ISFILLED", - /* 571 */ "pseudo_column ::= QTAGS", - /* 572 */ "pseudo_column ::= FLOW", - /* 573 */ "pseudo_column ::= FHIGH", - /* 574 */ "pseudo_column ::= FROWTS", - /* 575 */ "function_expression ::= function_name NK_LP expression_list NK_RP", - /* 576 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", - /* 577 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP", - /* 578 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP", - /* 579 */ "function_expression ::= POSITION NK_LP expr_or_subquery IN expr_or_subquery NK_RP", - /* 580 */ "function_expression ::= TRIM NK_LP expr_or_subquery NK_RP", - /* 581 */ "function_expression ::= TRIM NK_LP trim_specification_type FROM expr_or_subquery NK_RP", - /* 582 */ "function_expression ::= TRIM NK_LP expr_or_subquery FROM expr_or_subquery NK_RP", - /* 583 */ "function_expression ::= TRIM NK_LP trim_specification_type expr_or_subquery FROM expr_or_subquery NK_RP", - /* 584 */ "function_expression ::= substr_func NK_LP expression_list NK_RP", - /* 585 */ "function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery NK_RP", - /* 586 */ "function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery FOR expr_or_subquery NK_RP", - /* 587 */ "function_expression ::= REPLACE NK_LP expression_list NK_RP", - /* 588 */ "function_expression ::= literal_func", - /* 589 */ "function_expression ::= rand_func", - /* 590 */ "literal_func ::= noarg_func NK_LP NK_RP", - /* 591 */ "literal_func ::= NOW", - /* 592 */ "literal_func ::= TODAY", - /* 593 */ "rand_func ::= RAND NK_LP NK_RP", - /* 594 */ "rand_func ::= RAND NK_LP expression_list NK_RP", - /* 595 */ "substr_func ::= SUBSTR", - /* 596 */ "substr_func ::= SUBSTRING", - /* 597 */ "trim_specification_type ::= BOTH", - /* 598 */ "trim_specification_type ::= TRAILING", - /* 599 */ "trim_specification_type ::= LEADING", - /* 600 */ "noarg_func ::= NOW", - /* 601 */ "noarg_func ::= TODAY", - /* 602 */ "noarg_func ::= TIMEZONE", - /* 603 */ "noarg_func ::= DATABASE", - /* 604 */ "noarg_func ::= CLIENT_VERSION", - /* 605 */ "noarg_func ::= SERVER_VERSION", - /* 606 */ "noarg_func ::= SERVER_STATUS", - /* 607 */ "noarg_func ::= CURRENT_USER", - /* 608 */ "noarg_func ::= USER", - /* 609 */ "noarg_func ::= PI", - /* 610 */ "star_func ::= COUNT", - /* 611 */ "star_func ::= FIRST", - /* 612 */ "star_func ::= LAST", - /* 613 */ "star_func ::= LAST_ROW", - /* 614 */ "star_func_para_list ::= NK_STAR", - /* 615 */ "star_func_para_list ::= other_para_list", - /* 616 */ "other_para_list ::= star_func_para", - /* 617 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", - /* 618 */ "star_func_para ::= expr_or_subquery", - /* 619 */ "star_func_para ::= table_name NK_DOT NK_STAR", - /* 620 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END", - /* 621 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END", - /* 622 */ "when_then_list ::= when_then_expr", - /* 623 */ "when_then_list ::= when_then_list when_then_expr", - /* 624 */ "when_then_expr ::= WHEN common_expression THEN common_expression", - /* 625 */ "case_when_else_opt ::=", - /* 626 */ "case_when_else_opt ::= ELSE common_expression", - /* 627 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery", - /* 628 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery", - /* 629 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery", - /* 630 */ "predicate ::= expr_or_subquery IS NULL", - /* 631 */ "predicate ::= expr_or_subquery IS NOT NULL", - /* 632 */ "predicate ::= expr_or_subquery in_op in_predicate_value", - /* 633 */ "compare_op ::= NK_LT", - /* 634 */ "compare_op ::= NK_GT", - /* 635 */ "compare_op ::= NK_LE", - /* 636 */ "compare_op ::= NK_GE", - /* 637 */ "compare_op ::= NK_NE", - /* 638 */ "compare_op ::= NK_EQ", - /* 639 */ "compare_op ::= LIKE", - /* 640 */ "compare_op ::= NOT LIKE", - /* 641 */ "compare_op ::= MATCH", - /* 642 */ "compare_op ::= NMATCH", - /* 643 */ "compare_op ::= CONTAINS", - /* 644 */ "in_op ::= IN", - /* 645 */ "in_op ::= NOT IN", - /* 646 */ "in_predicate_value ::= NK_LP literal_list NK_RP", - /* 647 */ "boolean_value_expression ::= boolean_primary", - /* 648 */ "boolean_value_expression ::= NOT boolean_primary", - /* 649 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", - /* 650 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", - /* 651 */ "boolean_primary ::= predicate", - /* 652 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", - /* 653 */ "common_expression ::= expr_or_subquery", - /* 654 */ "common_expression ::= boolean_value_expression", - /* 655 */ "from_clause_opt ::=", - /* 656 */ "from_clause_opt ::= FROM table_reference_list", - /* 657 */ "table_reference_list ::= table_reference", - /* 658 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", - /* 659 */ "table_reference ::= table_primary", - /* 660 */ "table_reference ::= joined_table", - /* 661 */ "table_primary ::= table_name alias_opt", - /* 662 */ "table_primary ::= db_name NK_DOT table_name alias_opt", - /* 663 */ "table_primary ::= subquery alias_opt", - /* 664 */ "table_primary ::= parenthesized_joined_table", - /* 665 */ "alias_opt ::=", - /* 666 */ "alias_opt ::= table_alias", - /* 667 */ "alias_opt ::= AS table_alias", - /* 668 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", - /* 669 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", - /* 670 */ "joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt", - /* 671 */ "join_type ::=", - /* 672 */ "join_type ::= INNER", - /* 673 */ "join_type ::= LEFT", - /* 674 */ "join_type ::= RIGHT", - /* 675 */ "join_type ::= FULL", - /* 676 */ "join_subtype ::=", - /* 677 */ "join_subtype ::= OUTER", - /* 678 */ "join_subtype ::= SEMI", - /* 679 */ "join_subtype ::= ANTI", - /* 680 */ "join_subtype ::= ASOF", - /* 681 */ "join_subtype ::= WINDOW", - /* 682 */ "join_on_clause_opt ::=", - /* 683 */ "join_on_clause_opt ::= ON search_condition", - /* 684 */ "window_offset_clause_opt ::=", - /* 685 */ "window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP", - /* 686 */ "window_offset_literal ::= NK_VARIABLE", - /* 687 */ "window_offset_literal ::= NK_MINUS NK_VARIABLE", - /* 688 */ "jlimit_clause_opt ::=", - /* 689 */ "jlimit_clause_opt ::= JLIMIT NK_INTEGER", - /* 690 */ "query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_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", - /* 691 */ "hint_list ::=", - /* 692 */ "hint_list ::= NK_HINT", - /* 693 */ "tag_mode_opt ::=", - /* 694 */ "tag_mode_opt ::= TAGS", - /* 695 */ "set_quantifier_opt ::=", - /* 696 */ "set_quantifier_opt ::= DISTINCT", - /* 697 */ "set_quantifier_opt ::= ALL", - /* 698 */ "select_list ::= select_item", - /* 699 */ "select_list ::= select_list NK_COMMA select_item", - /* 700 */ "select_item ::= NK_STAR", - /* 701 */ "select_item ::= common_expression", - /* 702 */ "select_item ::= common_expression column_alias", - /* 703 */ "select_item ::= common_expression AS column_alias", - /* 704 */ "select_item ::= table_name NK_DOT NK_STAR", - /* 705 */ "where_clause_opt ::=", - /* 706 */ "where_clause_opt ::= WHERE search_condition", - /* 707 */ "partition_by_clause_opt ::=", - /* 708 */ "partition_by_clause_opt ::= PARTITION BY partition_list", - /* 709 */ "partition_list ::= partition_item", - /* 710 */ "partition_list ::= partition_list NK_COMMA partition_item", - /* 711 */ "partition_item ::= expr_or_subquery", - /* 712 */ "partition_item ::= expr_or_subquery column_alias", - /* 713 */ "partition_item ::= expr_or_subquery AS column_alias", - /* 714 */ "twindow_clause_opt ::=", - /* 715 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP", - /* 716 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP", - /* 717 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt", - /* 718 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt", - /* 719 */ "twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition", - /* 720 */ "twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP", - /* 721 */ "twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", - /* 722 */ "twindow_clause_opt ::= ANOMALY_WINDOW NK_LP expr_or_subquery NK_RP", - /* 723 */ "twindow_clause_opt ::= ANOMALY_WINDOW NK_LP expr_or_subquery NK_COMMA NK_STRING NK_RP", - /* 724 */ "sliding_opt ::=", - /* 725 */ "sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP", - /* 726 */ "interval_sliding_duration_literal ::= NK_VARIABLE", - /* 727 */ "interval_sliding_duration_literal ::= NK_STRING", - /* 728 */ "interval_sliding_duration_literal ::= NK_INTEGER", - /* 729 */ "fill_opt ::=", - /* 730 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", - /* 731 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP", - /* 732 */ "fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP", - /* 733 */ "fill_mode ::= NONE", - /* 734 */ "fill_mode ::= PREV", - /* 735 */ "fill_mode ::= NULL", - /* 736 */ "fill_mode ::= NULL_F", - /* 737 */ "fill_mode ::= LINEAR", - /* 738 */ "fill_mode ::= NEXT", - /* 739 */ "group_by_clause_opt ::=", - /* 740 */ "group_by_clause_opt ::= GROUP BY group_by_list", - /* 741 */ "group_by_list ::= expr_or_subquery", - /* 742 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery", - /* 743 */ "having_clause_opt ::=", - /* 744 */ "having_clause_opt ::= HAVING search_condition", - /* 745 */ "range_opt ::=", - /* 746 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP", - /* 747 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_RP", - /* 748 */ "every_opt ::=", - /* 749 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", - /* 750 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt", - /* 751 */ "query_simple ::= query_specification", - /* 752 */ "query_simple ::= union_query_expression", - /* 753 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery", - /* 754 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery", - /* 755 */ "query_simple_or_subquery ::= query_simple", - /* 756 */ "query_simple_or_subquery ::= subquery", - /* 757 */ "query_or_subquery ::= query_expression", - /* 758 */ "query_or_subquery ::= subquery", - /* 759 */ "order_by_clause_opt ::=", - /* 760 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", - /* 761 */ "slimit_clause_opt ::=", - /* 762 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", - /* 763 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", - /* 764 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 765 */ "limit_clause_opt ::=", - /* 766 */ "limit_clause_opt ::= LIMIT NK_INTEGER", - /* 767 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", - /* 768 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 769 */ "subquery ::= NK_LP query_expression NK_RP", - /* 770 */ "subquery ::= NK_LP subquery NK_RP", - /* 771 */ "search_condition ::= common_expression", - /* 772 */ "sort_specification_list ::= sort_specification", - /* 773 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", - /* 774 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt", - /* 775 */ "ordering_specification_opt ::=", - /* 776 */ "ordering_specification_opt ::= ASC", - /* 777 */ "ordering_specification_opt ::= DESC", - /* 778 */ "null_ordering_opt ::=", - /* 779 */ "null_ordering_opt ::= NULLS FIRST", - /* 780 */ "null_ordering_opt ::= NULLS LAST", - /* 781 */ "column_options ::=", - /* 782 */ "column_options ::= column_options PRIMARY KEY", - /* 783 */ "column_options ::= column_options NK_ID NK_STRING", + /* 145 */ "db_options ::= db_options DNODES NK_STRING", + /* 146 */ "alter_db_options ::= alter_db_option", + /* 147 */ "alter_db_options ::= alter_db_options alter_db_option", + /* 148 */ "alter_db_option ::= BUFFER NK_INTEGER", + /* 149 */ "alter_db_option ::= CACHEMODEL NK_STRING", + /* 150 */ "alter_db_option ::= CACHESIZE NK_INTEGER", + /* 151 */ "alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER", + /* 152 */ "alter_db_option ::= KEEP integer_list", + /* 153 */ "alter_db_option ::= KEEP variable_list", + /* 154 */ "alter_db_option ::= PAGES NK_INTEGER", + /* 155 */ "alter_db_option ::= REPLICA NK_INTEGER", + /* 156 */ "alter_db_option ::= WAL_LEVEL NK_INTEGER", + /* 157 */ "alter_db_option ::= STT_TRIGGER NK_INTEGER", + /* 158 */ "alter_db_option ::= MINROWS NK_INTEGER", + /* 159 */ "alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER", + /* 160 */ "alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER", + /* 161 */ "alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER", + /* 162 */ "alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER", + /* 163 */ "alter_db_option ::= S3_KEEPLOCAL NK_INTEGER", + /* 164 */ "alter_db_option ::= S3_KEEPLOCAL NK_VARIABLE", + /* 165 */ "alter_db_option ::= S3_COMPACT NK_INTEGER", + /* 166 */ "alter_db_option ::= KEEP_TIME_OFFSET NK_INTEGER", + /* 167 */ "alter_db_option ::= ENCRYPT_ALGORITHM NK_STRING", + /* 168 */ "integer_list ::= NK_INTEGER", + /* 169 */ "integer_list ::= integer_list NK_COMMA NK_INTEGER", + /* 170 */ "variable_list ::= NK_VARIABLE", + /* 171 */ "variable_list ::= variable_list NK_COMMA NK_VARIABLE", + /* 172 */ "retention_list ::= retention", + /* 173 */ "retention_list ::= retention_list NK_COMMA retention", + /* 174 */ "retention ::= NK_VARIABLE NK_COLON NK_VARIABLE", + /* 175 */ "retention ::= NK_MINUS NK_COLON NK_VARIABLE", + /* 176 */ "speed_opt ::=", + /* 177 */ "speed_opt ::= BWLIMIT NK_INTEGER", + /* 178 */ "start_opt ::=", + /* 179 */ "start_opt ::= START WITH NK_INTEGER", + /* 180 */ "start_opt ::= START WITH NK_STRING", + /* 181 */ "start_opt ::= START WITH TIMESTAMP NK_STRING", + /* 182 */ "end_opt ::=", + /* 183 */ "end_opt ::= END WITH NK_INTEGER", + /* 184 */ "end_opt ::= END WITH NK_STRING", + /* 185 */ "end_opt ::= END WITH TIMESTAMP NK_STRING", + /* 186 */ "cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options", + /* 187 */ "cmd ::= CREATE TABLE multi_create_clause", + /* 188 */ "cmd ::= CREATE TABLE not_exists_opt USING full_table_name NK_LP tag_list_opt NK_RP FILE NK_STRING", + /* 189 */ "cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options", + /* 190 */ "cmd ::= DROP TABLE with_opt multi_drop_clause", + /* 191 */ "cmd ::= DROP STABLE with_opt exists_opt full_table_name", + /* 192 */ "cmd ::= ALTER TABLE alter_table_clause", + /* 193 */ "cmd ::= ALTER STABLE alter_table_clause", + /* 194 */ "alter_table_clause ::= full_table_name alter_table_options", + /* 195 */ "alter_table_clause ::= full_table_name ADD COLUMN column_name type_name column_options", + /* 196 */ "alter_table_clause ::= full_table_name DROP COLUMN column_name", + /* 197 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name", + /* 198 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name column_options", + /* 199 */ "alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name", + /* 200 */ "alter_table_clause ::= full_table_name ADD TAG column_name type_name", + /* 201 */ "alter_table_clause ::= full_table_name DROP TAG column_name", + /* 202 */ "alter_table_clause ::= full_table_name MODIFY TAG column_name type_name", + /* 203 */ "alter_table_clause ::= full_table_name RENAME TAG column_name column_name", + /* 204 */ "alter_table_clause ::= full_table_name SET TAG column_name NK_EQ tags_literal", + /* 205 */ "multi_create_clause ::= create_subtable_clause", + /* 206 */ "multi_create_clause ::= multi_create_clause create_subtable_clause", + /* 207 */ "create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP tags_literal_list NK_RP table_options", + /* 208 */ "multi_drop_clause ::= drop_table_clause", + /* 209 */ "multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause", + /* 210 */ "drop_table_clause ::= exists_opt full_table_name", + /* 211 */ "with_opt ::=", + /* 212 */ "with_opt ::= WITH", + /* 213 */ "specific_cols_opt ::=", + /* 214 */ "specific_cols_opt ::= NK_LP col_name_list NK_RP", + /* 215 */ "full_table_name ::= table_name", + /* 216 */ "full_table_name ::= db_name NK_DOT table_name", + /* 217 */ "tag_def_list ::= tag_def", + /* 218 */ "tag_def_list ::= tag_def_list NK_COMMA tag_def", + /* 219 */ "tag_def ::= column_name type_name", + /* 220 */ "column_def_list ::= column_def", + /* 221 */ "column_def_list ::= column_def_list NK_COMMA column_def", + /* 222 */ "column_def ::= column_name type_name column_options", + /* 223 */ "type_name ::= BOOL", + /* 224 */ "type_name ::= TINYINT", + /* 225 */ "type_name ::= SMALLINT", + /* 226 */ "type_name ::= INT", + /* 227 */ "type_name ::= INTEGER", + /* 228 */ "type_name ::= BIGINT", + /* 229 */ "type_name ::= FLOAT", + /* 230 */ "type_name ::= DOUBLE", + /* 231 */ "type_name ::= BINARY NK_LP NK_INTEGER NK_RP", + /* 232 */ "type_name ::= TIMESTAMP", + /* 233 */ "type_name ::= NCHAR NK_LP NK_INTEGER NK_RP", + /* 234 */ "type_name ::= TINYINT UNSIGNED", + /* 235 */ "type_name ::= SMALLINT UNSIGNED", + /* 236 */ "type_name ::= INT UNSIGNED", + /* 237 */ "type_name ::= BIGINT UNSIGNED", + /* 238 */ "type_name ::= JSON", + /* 239 */ "type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP", + /* 240 */ "type_name ::= MEDIUMBLOB", + /* 241 */ "type_name ::= BLOB", + /* 242 */ "type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP", + /* 243 */ "type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP", + /* 244 */ "type_name ::= DECIMAL", + /* 245 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP", + /* 246 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", + /* 247 */ "type_name_default_len ::= BINARY", + /* 248 */ "type_name_default_len ::= NCHAR", + /* 249 */ "type_name_default_len ::= VARCHAR", + /* 250 */ "type_name_default_len ::= VARBINARY", + /* 251 */ "tags_def_opt ::=", + /* 252 */ "tags_def_opt ::= tags_def", + /* 253 */ "tags_def ::= TAGS NK_LP tag_def_list NK_RP", + /* 254 */ "table_options ::=", + /* 255 */ "table_options ::= table_options COMMENT NK_STRING", + /* 256 */ "table_options ::= table_options MAX_DELAY duration_list", + /* 257 */ "table_options ::= table_options WATERMARK duration_list", + /* 258 */ "table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP", + /* 259 */ "table_options ::= table_options TTL NK_INTEGER", + /* 260 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP", + /* 261 */ "table_options ::= table_options DELETE_MARK duration_list", + /* 262 */ "alter_table_options ::= alter_table_option", + /* 263 */ "alter_table_options ::= alter_table_options alter_table_option", + /* 264 */ "alter_table_option ::= COMMENT NK_STRING", + /* 265 */ "alter_table_option ::= TTL NK_INTEGER", + /* 266 */ "duration_list ::= duration_literal", + /* 267 */ "duration_list ::= duration_list NK_COMMA duration_literal", + /* 268 */ "rollup_func_list ::= rollup_func_name", + /* 269 */ "rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name", + /* 270 */ "rollup_func_name ::= function_name", + /* 271 */ "rollup_func_name ::= FIRST", + /* 272 */ "rollup_func_name ::= LAST", + /* 273 */ "col_name_list ::= col_name", + /* 274 */ "col_name_list ::= col_name_list NK_COMMA col_name", + /* 275 */ "col_name ::= column_name", + /* 276 */ "cmd ::= SHOW DNODES", + /* 277 */ "cmd ::= SHOW USERS", + /* 278 */ "cmd ::= SHOW USERS FULL", + /* 279 */ "cmd ::= SHOW USER PRIVILEGES", + /* 280 */ "cmd ::= SHOW db_kind_opt DATABASES", + /* 281 */ "cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt", + /* 282 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt", + /* 283 */ "cmd ::= SHOW db_name_cond_opt VGROUPS", + /* 284 */ "cmd ::= SHOW MNODES", + /* 285 */ "cmd ::= SHOW QNODES", + /* 286 */ "cmd ::= SHOW ANODES", + /* 287 */ "cmd ::= SHOW ANODES FULL", + /* 288 */ "cmd ::= SHOW ARBGROUPS", + /* 289 */ "cmd ::= SHOW FUNCTIONS", + /* 290 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt", + /* 291 */ "cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name", + /* 292 */ "cmd ::= SHOW STREAMS", + /* 293 */ "cmd ::= SHOW ACCOUNTS", + /* 294 */ "cmd ::= SHOW APPS", + /* 295 */ "cmd ::= SHOW CONNECTIONS", + /* 296 */ "cmd ::= SHOW LICENCES", + /* 297 */ "cmd ::= SHOW GRANTS", + /* 298 */ "cmd ::= SHOW GRANTS FULL", + /* 299 */ "cmd ::= SHOW GRANTS LOGS", + /* 300 */ "cmd ::= SHOW CLUSTER MACHINES", + /* 301 */ "cmd ::= SHOW CREATE DATABASE db_name", + /* 302 */ "cmd ::= SHOW CREATE TABLE full_table_name", + /* 303 */ "cmd ::= SHOW CREATE STABLE full_table_name", + /* 304 */ "cmd ::= SHOW ENCRYPTIONS", + /* 305 */ "cmd ::= SHOW QUERIES", + /* 306 */ "cmd ::= SHOW SCORES", + /* 307 */ "cmd ::= SHOW TOPICS", + /* 308 */ "cmd ::= SHOW VARIABLES", + /* 309 */ "cmd ::= SHOW CLUSTER VARIABLES", + /* 310 */ "cmd ::= SHOW LOCAL VARIABLES", + /* 311 */ "cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt", + /* 312 */ "cmd ::= SHOW BNODES", + /* 313 */ "cmd ::= SHOW SNODES", + /* 314 */ "cmd ::= SHOW CLUSTER", + /* 315 */ "cmd ::= SHOW TRANSACTIONS", + /* 316 */ "cmd ::= SHOW TABLE DISTRIBUTED full_table_name", + /* 317 */ "cmd ::= SHOW CONSUMERS", + /* 318 */ "cmd ::= SHOW SUBSCRIPTIONS", + /* 319 */ "cmd ::= SHOW TAGS FROM table_name_cond from_db_opt", + /* 320 */ "cmd ::= SHOW TAGS FROM db_name NK_DOT table_name", + /* 321 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt", + /* 322 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name", + /* 323 */ "cmd ::= SHOW VNODES ON DNODE NK_INTEGER", + /* 324 */ "cmd ::= SHOW VNODES", + /* 325 */ "cmd ::= SHOW db_name_cond_opt ALIVE", + /* 326 */ "cmd ::= SHOW CLUSTER ALIVE", + /* 327 */ "cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt", + /* 328 */ "cmd ::= SHOW CREATE VIEW full_table_name", + /* 329 */ "cmd ::= SHOW COMPACTS", + /* 330 */ "cmd ::= SHOW COMPACT NK_INTEGER", + /* 331 */ "table_kind_db_name_cond_opt ::=", + /* 332 */ "table_kind_db_name_cond_opt ::= table_kind", + /* 333 */ "table_kind_db_name_cond_opt ::= db_name NK_DOT", + /* 334 */ "table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT", + /* 335 */ "table_kind ::= NORMAL", + /* 336 */ "table_kind ::= CHILD", + /* 337 */ "db_name_cond_opt ::=", + /* 338 */ "db_name_cond_opt ::= db_name NK_DOT", + /* 339 */ "like_pattern_opt ::=", + /* 340 */ "like_pattern_opt ::= LIKE NK_STRING", + /* 341 */ "table_name_cond ::= table_name", + /* 342 */ "from_db_opt ::=", + /* 343 */ "from_db_opt ::= FROM db_name", + /* 344 */ "tag_list_opt ::=", + /* 345 */ "tag_list_opt ::= tag_item", + /* 346 */ "tag_list_opt ::= tag_list_opt NK_COMMA tag_item", + /* 347 */ "tag_item ::= TBNAME", + /* 348 */ "tag_item ::= QTAGS", + /* 349 */ "tag_item ::= column_name", + /* 350 */ "tag_item ::= column_name column_alias", + /* 351 */ "tag_item ::= column_name AS column_alias", + /* 352 */ "db_kind_opt ::=", + /* 353 */ "db_kind_opt ::= USER", + /* 354 */ "db_kind_opt ::= SYSTEM", + /* 355 */ "cmd ::= CREATE TSMA not_exists_opt tsma_name ON full_table_name tsma_func_list INTERVAL NK_LP duration_literal NK_RP", + /* 356 */ "cmd ::= CREATE RECURSIVE TSMA not_exists_opt tsma_name ON full_table_name INTERVAL NK_LP duration_literal NK_RP", + /* 357 */ "cmd ::= DROP TSMA exists_opt full_tsma_name", + /* 358 */ "cmd ::= SHOW db_name_cond_opt TSMAS", + /* 359 */ "full_tsma_name ::= tsma_name", + /* 360 */ "full_tsma_name ::= db_name NK_DOT tsma_name", + /* 361 */ "tsma_func_list ::= FUNCTION NK_LP func_list NK_RP", + /* 362 */ "cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options", + /* 363 */ "cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP", + /* 364 */ "cmd ::= DROP INDEX exists_opt full_index_name", + /* 365 */ "full_index_name ::= index_name", + /* 366 */ "full_index_name ::= db_name NK_DOT index_name", + /* 367 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt", + /* 368 */ "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", + /* 369 */ "func_list ::= func", + /* 370 */ "func_list ::= func_list NK_COMMA func", + /* 371 */ "func ::= sma_func_name NK_LP expression_list NK_RP", + /* 372 */ "sma_func_name ::= function_name", + /* 373 */ "sma_func_name ::= COUNT", + /* 374 */ "sma_func_name ::= FIRST", + /* 375 */ "sma_func_name ::= LAST", + /* 376 */ "sma_func_name ::= LAST_ROW", + /* 377 */ "sma_stream_opt ::=", + /* 378 */ "sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal", + /* 379 */ "sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal", + /* 380 */ "sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal", + /* 381 */ "with_meta ::= AS", + /* 382 */ "with_meta ::= WITH META AS", + /* 383 */ "with_meta ::= ONLY META AS", + /* 384 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery", + /* 385 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name", + /* 386 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt", + /* 387 */ "cmd ::= DROP TOPIC exists_opt topic_name", + /* 388 */ "cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name", + /* 389 */ "cmd ::= DESC full_table_name", + /* 390 */ "cmd ::= DESCRIBE full_table_name", + /* 391 */ "cmd ::= RESET QUERY CACHE", + /* 392 */ "cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery", + /* 393 */ "cmd ::= EXPLAIN analyze_opt explain_options insert_query", + /* 394 */ "analyze_opt ::=", + /* 395 */ "analyze_opt ::= ANALYZE", + /* 396 */ "explain_options ::=", + /* 397 */ "explain_options ::= explain_options VERBOSE NK_BOOL", + /* 398 */ "explain_options ::= explain_options RATIO NK_FLOAT", + /* 399 */ "cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt", + /* 400 */ "cmd ::= DROP FUNCTION exists_opt function_name", + /* 401 */ "agg_func_opt ::=", + /* 402 */ "agg_func_opt ::= AGGREGATE", + /* 403 */ "bufsize_opt ::=", + /* 404 */ "bufsize_opt ::= BUFSIZE NK_INTEGER", + /* 405 */ "language_opt ::=", + /* 406 */ "language_opt ::= LANGUAGE NK_STRING", + /* 407 */ "or_replace_opt ::=", + /* 408 */ "or_replace_opt ::= OR REPLACE", + /* 409 */ "cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery", + /* 410 */ "cmd ::= DROP VIEW exists_opt full_view_name", + /* 411 */ "full_view_name ::= view_name", + /* 412 */ "full_view_name ::= db_name NK_DOT view_name", + /* 413 */ "cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery", + /* 414 */ "cmd ::= DROP STREAM exists_opt stream_name", + /* 415 */ "cmd ::= PAUSE STREAM exists_opt stream_name", + /* 416 */ "cmd ::= RESUME STREAM exists_opt ignore_opt stream_name", + /* 417 */ "col_list_opt ::=", + /* 418 */ "col_list_opt ::= NK_LP column_stream_def_list NK_RP", + /* 419 */ "column_stream_def_list ::= column_stream_def", + /* 420 */ "column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def", + /* 421 */ "column_stream_def ::= column_name stream_col_options", + /* 422 */ "stream_col_options ::=", + /* 423 */ "stream_col_options ::= stream_col_options PRIMARY KEY", + /* 424 */ "tag_def_or_ref_opt ::=", + /* 425 */ "tag_def_or_ref_opt ::= tags_def", + /* 426 */ "tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP", + /* 427 */ "stream_options ::=", + /* 428 */ "stream_options ::= stream_options TRIGGER AT_ONCE", + /* 429 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE", + /* 430 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal", + /* 431 */ "stream_options ::= stream_options WATERMARK duration_literal", + /* 432 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER", + /* 433 */ "stream_options ::= stream_options FILL_HISTORY NK_INTEGER", + /* 434 */ "stream_options ::= stream_options DELETE_MARK duration_literal", + /* 435 */ "stream_options ::= stream_options IGNORE UPDATE NK_INTEGER", + /* 436 */ "subtable_opt ::=", + /* 437 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP", + /* 438 */ "ignore_opt ::=", + /* 439 */ "ignore_opt ::= IGNORE UNTREATED", + /* 440 */ "cmd ::= KILL CONNECTION NK_INTEGER", + /* 441 */ "cmd ::= KILL QUERY NK_STRING", + /* 442 */ "cmd ::= KILL TRANSACTION NK_INTEGER", + /* 443 */ "cmd ::= KILL COMPACT NK_INTEGER", + /* 444 */ "cmd ::= BALANCE VGROUP", + /* 445 */ "cmd ::= BALANCE VGROUP LEADER on_vgroup_id", + /* 446 */ "cmd ::= BALANCE VGROUP LEADER DATABASE db_name", + /* 447 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", + /* 448 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", + /* 449 */ "cmd ::= SPLIT VGROUP NK_INTEGER", + /* 450 */ "on_vgroup_id ::=", + /* 451 */ "on_vgroup_id ::= ON NK_INTEGER", + /* 452 */ "dnode_list ::= DNODE NK_INTEGER", + /* 453 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", + /* 454 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", + /* 455 */ "cmd ::= query_or_subquery", + /* 456 */ "cmd ::= insert_query", + /* 457 */ "insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery", + /* 458 */ "insert_query ::= INSERT INTO full_table_name query_or_subquery", + /* 459 */ "tags_literal ::= NK_INTEGER", + /* 460 */ "tags_literal ::= NK_INTEGER NK_PLUS duration_literal", + /* 461 */ "tags_literal ::= NK_INTEGER NK_MINUS duration_literal", + /* 462 */ "tags_literal ::= NK_PLUS NK_INTEGER", + /* 463 */ "tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal", + /* 464 */ "tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal", + /* 465 */ "tags_literal ::= NK_MINUS NK_INTEGER", + /* 466 */ "tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal", + /* 467 */ "tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal", + /* 468 */ "tags_literal ::= NK_FLOAT", + /* 469 */ "tags_literal ::= NK_PLUS NK_FLOAT", + /* 470 */ "tags_literal ::= NK_MINUS NK_FLOAT", + /* 471 */ "tags_literal ::= NK_BIN", + /* 472 */ "tags_literal ::= NK_BIN NK_PLUS duration_literal", + /* 473 */ "tags_literal ::= NK_BIN NK_MINUS duration_literal", + /* 474 */ "tags_literal ::= NK_PLUS NK_BIN", + /* 475 */ "tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal", + /* 476 */ "tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal", + /* 477 */ "tags_literal ::= NK_MINUS NK_BIN", + /* 478 */ "tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal", + /* 479 */ "tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal", + /* 480 */ "tags_literal ::= NK_HEX", + /* 481 */ "tags_literal ::= NK_HEX NK_PLUS duration_literal", + /* 482 */ "tags_literal ::= NK_HEX NK_MINUS duration_literal", + /* 483 */ "tags_literal ::= NK_PLUS NK_HEX", + /* 484 */ "tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal", + /* 485 */ "tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal", + /* 486 */ "tags_literal ::= NK_MINUS NK_HEX", + /* 487 */ "tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal", + /* 488 */ "tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal", + /* 489 */ "tags_literal ::= NK_STRING", + /* 490 */ "tags_literal ::= NK_STRING NK_PLUS duration_literal", + /* 491 */ "tags_literal ::= NK_STRING NK_MINUS duration_literal", + /* 492 */ "tags_literal ::= NK_BOOL", + /* 493 */ "tags_literal ::= NULL", + /* 494 */ "tags_literal ::= literal_func", + /* 495 */ "tags_literal ::= literal_func NK_PLUS duration_literal", + /* 496 */ "tags_literal ::= literal_func NK_MINUS duration_literal", + /* 497 */ "tags_literal_list ::= tags_literal", + /* 498 */ "tags_literal_list ::= tags_literal_list NK_COMMA tags_literal", + /* 499 */ "literal ::= NK_INTEGER", + /* 500 */ "literal ::= NK_FLOAT", + /* 501 */ "literal ::= NK_STRING", + /* 502 */ "literal ::= NK_BOOL", + /* 503 */ "literal ::= TIMESTAMP NK_STRING", + /* 504 */ "literal ::= duration_literal", + /* 505 */ "literal ::= NULL", + /* 506 */ "literal ::= NK_QUESTION", + /* 507 */ "duration_literal ::= NK_VARIABLE", + /* 508 */ "signed ::= NK_INTEGER", + /* 509 */ "signed ::= NK_PLUS NK_INTEGER", + /* 510 */ "signed ::= NK_MINUS NK_INTEGER", + /* 511 */ "signed ::= NK_FLOAT", + /* 512 */ "signed ::= NK_PLUS NK_FLOAT", + /* 513 */ "signed ::= NK_MINUS NK_FLOAT", + /* 514 */ "signed_literal ::= signed", + /* 515 */ "signed_literal ::= NK_STRING", + /* 516 */ "signed_literal ::= NK_BOOL", + /* 517 */ "signed_literal ::= TIMESTAMP NK_STRING", + /* 518 */ "signed_literal ::= duration_literal", + /* 519 */ "signed_literal ::= NULL", + /* 520 */ "signed_literal ::= literal_func", + /* 521 */ "signed_literal ::= NK_QUESTION", + /* 522 */ "literal_list ::= signed_literal", + /* 523 */ "literal_list ::= literal_list NK_COMMA signed_literal", + /* 524 */ "db_name ::= NK_ID", + /* 525 */ "table_name ::= NK_ID", + /* 526 */ "column_name ::= NK_ID", + /* 527 */ "function_name ::= NK_ID", + /* 528 */ "view_name ::= NK_ID", + /* 529 */ "table_alias ::= NK_ID", + /* 530 */ "column_alias ::= NK_ID", + /* 531 */ "column_alias ::= NK_ALIAS", + /* 532 */ "user_name ::= NK_ID", + /* 533 */ "topic_name ::= NK_ID", + /* 534 */ "stream_name ::= NK_ID", + /* 535 */ "cgroup_name ::= NK_ID", + /* 536 */ "index_name ::= NK_ID", + /* 537 */ "tsma_name ::= NK_ID", + /* 538 */ "expr_or_subquery ::= expression", + /* 539 */ "expression ::= literal", + /* 540 */ "expression ::= pseudo_column", + /* 541 */ "expression ::= column_reference", + /* 542 */ "expression ::= function_expression", + /* 543 */ "expression ::= case_when_expression", + /* 544 */ "expression ::= NK_LP expression NK_RP", + /* 545 */ "expression ::= NK_PLUS expr_or_subquery", + /* 546 */ "expression ::= NK_MINUS expr_or_subquery", + /* 547 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery", + /* 548 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery", + /* 549 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery", + /* 550 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery", + /* 551 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery", + /* 552 */ "expression ::= column_reference NK_ARROW NK_STRING", + /* 553 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery", + /* 554 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery", + /* 555 */ "expression_list ::= expr_or_subquery", + /* 556 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery", + /* 557 */ "column_reference ::= column_name", + /* 558 */ "column_reference ::= table_name NK_DOT column_name", + /* 559 */ "column_reference ::= NK_ALIAS", + /* 560 */ "column_reference ::= table_name NK_DOT NK_ALIAS", + /* 561 */ "pseudo_column ::= ROWTS", + /* 562 */ "pseudo_column ::= TBNAME", + /* 563 */ "pseudo_column ::= table_name NK_DOT TBNAME", + /* 564 */ "pseudo_column ::= QSTART", + /* 565 */ "pseudo_column ::= QEND", + /* 566 */ "pseudo_column ::= QDURATION", + /* 567 */ "pseudo_column ::= WSTART", + /* 568 */ "pseudo_column ::= WEND", + /* 569 */ "pseudo_column ::= WDURATION", + /* 570 */ "pseudo_column ::= IROWTS", + /* 571 */ "pseudo_column ::= ISFILLED", + /* 572 */ "pseudo_column ::= QTAGS", + /* 573 */ "pseudo_column ::= FLOW", + /* 574 */ "pseudo_column ::= FHIGH", + /* 575 */ "pseudo_column ::= FROWTS", + /* 576 */ "function_expression ::= function_name NK_LP expression_list NK_RP", + /* 577 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", + /* 578 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP", + /* 579 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP", + /* 580 */ "function_expression ::= POSITION NK_LP expr_or_subquery IN expr_or_subquery NK_RP", + /* 581 */ "function_expression ::= TRIM NK_LP expr_or_subquery NK_RP", + /* 582 */ "function_expression ::= TRIM NK_LP trim_specification_type FROM expr_or_subquery NK_RP", + /* 583 */ "function_expression ::= TRIM NK_LP expr_or_subquery FROM expr_or_subquery NK_RP", + /* 584 */ "function_expression ::= TRIM NK_LP trim_specification_type expr_or_subquery FROM expr_or_subquery NK_RP", + /* 585 */ "function_expression ::= substr_func NK_LP expression_list NK_RP", + /* 586 */ "function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery NK_RP", + /* 587 */ "function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery FOR expr_or_subquery NK_RP", + /* 588 */ "function_expression ::= REPLACE NK_LP expression_list NK_RP", + /* 589 */ "function_expression ::= literal_func", + /* 590 */ "function_expression ::= rand_func", + /* 591 */ "literal_func ::= noarg_func NK_LP NK_RP", + /* 592 */ "literal_func ::= NOW", + /* 593 */ "literal_func ::= TODAY", + /* 594 */ "rand_func ::= RAND NK_LP NK_RP", + /* 595 */ "rand_func ::= RAND NK_LP expression_list NK_RP", + /* 596 */ "substr_func ::= SUBSTR", + /* 597 */ "substr_func ::= SUBSTRING", + /* 598 */ "trim_specification_type ::= BOTH", + /* 599 */ "trim_specification_type ::= TRAILING", + /* 600 */ "trim_specification_type ::= LEADING", + /* 601 */ "noarg_func ::= NOW", + /* 602 */ "noarg_func ::= TODAY", + /* 603 */ "noarg_func ::= TIMEZONE", + /* 604 */ "noarg_func ::= DATABASE", + /* 605 */ "noarg_func ::= CLIENT_VERSION", + /* 606 */ "noarg_func ::= SERVER_VERSION", + /* 607 */ "noarg_func ::= SERVER_STATUS", + /* 608 */ "noarg_func ::= CURRENT_USER", + /* 609 */ "noarg_func ::= USER", + /* 610 */ "noarg_func ::= PI", + /* 611 */ "star_func ::= COUNT", + /* 612 */ "star_func ::= FIRST", + /* 613 */ "star_func ::= LAST", + /* 614 */ "star_func ::= LAST_ROW", + /* 615 */ "star_func_para_list ::= NK_STAR", + /* 616 */ "star_func_para_list ::= other_para_list", + /* 617 */ "other_para_list ::= star_func_para", + /* 618 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", + /* 619 */ "star_func_para ::= expr_or_subquery", + /* 620 */ "star_func_para ::= table_name NK_DOT NK_STAR", + /* 621 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END", + /* 622 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END", + /* 623 */ "when_then_list ::= when_then_expr", + /* 624 */ "when_then_list ::= when_then_list when_then_expr", + /* 625 */ "when_then_expr ::= WHEN common_expression THEN common_expression", + /* 626 */ "case_when_else_opt ::=", + /* 627 */ "case_when_else_opt ::= ELSE common_expression", + /* 628 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery", + /* 629 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery", + /* 630 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery", + /* 631 */ "predicate ::= expr_or_subquery IS NULL", + /* 632 */ "predicate ::= expr_or_subquery IS NOT NULL", + /* 633 */ "predicate ::= expr_or_subquery in_op in_predicate_value", + /* 634 */ "compare_op ::= NK_LT", + /* 635 */ "compare_op ::= NK_GT", + /* 636 */ "compare_op ::= NK_LE", + /* 637 */ "compare_op ::= NK_GE", + /* 638 */ "compare_op ::= NK_NE", + /* 639 */ "compare_op ::= NK_EQ", + /* 640 */ "compare_op ::= LIKE", + /* 641 */ "compare_op ::= NOT LIKE", + /* 642 */ "compare_op ::= MATCH", + /* 643 */ "compare_op ::= NMATCH", + /* 644 */ "compare_op ::= CONTAINS", + /* 645 */ "in_op ::= IN", + /* 646 */ "in_op ::= NOT IN", + /* 647 */ "in_predicate_value ::= NK_LP literal_list NK_RP", + /* 648 */ "boolean_value_expression ::= boolean_primary", + /* 649 */ "boolean_value_expression ::= NOT boolean_primary", + /* 650 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", + /* 651 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", + /* 652 */ "boolean_primary ::= predicate", + /* 653 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", + /* 654 */ "common_expression ::= expr_or_subquery", + /* 655 */ "common_expression ::= boolean_value_expression", + /* 656 */ "from_clause_opt ::=", + /* 657 */ "from_clause_opt ::= FROM table_reference_list", + /* 658 */ "table_reference_list ::= table_reference", + /* 659 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", + /* 660 */ "table_reference ::= table_primary", + /* 661 */ "table_reference ::= joined_table", + /* 662 */ "table_primary ::= table_name alias_opt", + /* 663 */ "table_primary ::= db_name NK_DOT table_name alias_opt", + /* 664 */ "table_primary ::= subquery alias_opt", + /* 665 */ "table_primary ::= parenthesized_joined_table", + /* 666 */ "alias_opt ::=", + /* 667 */ "alias_opt ::= table_alias", + /* 668 */ "alias_opt ::= AS table_alias", + /* 669 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", + /* 670 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", + /* 671 */ "joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt", + /* 672 */ "join_type ::=", + /* 673 */ "join_type ::= INNER", + /* 674 */ "join_type ::= LEFT", + /* 675 */ "join_type ::= RIGHT", + /* 676 */ "join_type ::= FULL", + /* 677 */ "join_subtype ::=", + /* 678 */ "join_subtype ::= OUTER", + /* 679 */ "join_subtype ::= SEMI", + /* 680 */ "join_subtype ::= ANTI", + /* 681 */ "join_subtype ::= ASOF", + /* 682 */ "join_subtype ::= WINDOW", + /* 683 */ "join_on_clause_opt ::=", + /* 684 */ "join_on_clause_opt ::= ON search_condition", + /* 685 */ "window_offset_clause_opt ::=", + /* 686 */ "window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP", + /* 687 */ "window_offset_literal ::= NK_VARIABLE", + /* 688 */ "window_offset_literal ::= NK_MINUS NK_VARIABLE", + /* 689 */ "jlimit_clause_opt ::=", + /* 690 */ "jlimit_clause_opt ::= JLIMIT NK_INTEGER", + /* 691 */ "query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_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", + /* 692 */ "hint_list ::=", + /* 693 */ "hint_list ::= NK_HINT", + /* 694 */ "tag_mode_opt ::=", + /* 695 */ "tag_mode_opt ::= TAGS", + /* 696 */ "set_quantifier_opt ::=", + /* 697 */ "set_quantifier_opt ::= DISTINCT", + /* 698 */ "set_quantifier_opt ::= ALL", + /* 699 */ "select_list ::= select_item", + /* 700 */ "select_list ::= select_list NK_COMMA select_item", + /* 701 */ "select_item ::= NK_STAR", + /* 702 */ "select_item ::= common_expression", + /* 703 */ "select_item ::= common_expression column_alias", + /* 704 */ "select_item ::= common_expression AS column_alias", + /* 705 */ "select_item ::= table_name NK_DOT NK_STAR", + /* 706 */ "where_clause_opt ::=", + /* 707 */ "where_clause_opt ::= WHERE search_condition", + /* 708 */ "partition_by_clause_opt ::=", + /* 709 */ "partition_by_clause_opt ::= PARTITION BY partition_list", + /* 710 */ "partition_list ::= partition_item", + /* 711 */ "partition_list ::= partition_list NK_COMMA partition_item", + /* 712 */ "partition_item ::= expr_or_subquery", + /* 713 */ "partition_item ::= expr_or_subquery column_alias", + /* 714 */ "partition_item ::= expr_or_subquery AS column_alias", + /* 715 */ "twindow_clause_opt ::=", + /* 716 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP", + /* 717 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP", + /* 718 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt", + /* 719 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt", + /* 720 */ "twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition", + /* 721 */ "twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP", + /* 722 */ "twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", + /* 723 */ "twindow_clause_opt ::= ANOMALY_WINDOW NK_LP expr_or_subquery NK_RP", + /* 724 */ "twindow_clause_opt ::= ANOMALY_WINDOW NK_LP expr_or_subquery NK_COMMA NK_STRING NK_RP", + /* 725 */ "sliding_opt ::=", + /* 726 */ "sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP", + /* 727 */ "interval_sliding_duration_literal ::= NK_VARIABLE", + /* 728 */ "interval_sliding_duration_literal ::= NK_STRING", + /* 729 */ "interval_sliding_duration_literal ::= NK_INTEGER", + /* 730 */ "fill_opt ::=", + /* 731 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", + /* 732 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP", + /* 733 */ "fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP", + /* 734 */ "fill_mode ::= NONE", + /* 735 */ "fill_mode ::= PREV", + /* 736 */ "fill_mode ::= NULL", + /* 737 */ "fill_mode ::= NULL_F", + /* 738 */ "fill_mode ::= LINEAR", + /* 739 */ "fill_mode ::= NEXT", + /* 740 */ "group_by_clause_opt ::=", + /* 741 */ "group_by_clause_opt ::= GROUP BY group_by_list", + /* 742 */ "group_by_list ::= expr_or_subquery", + /* 743 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery", + /* 744 */ "having_clause_opt ::=", + /* 745 */ "having_clause_opt ::= HAVING search_condition", + /* 746 */ "range_opt ::=", + /* 747 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP", + /* 748 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_RP", + /* 749 */ "every_opt ::=", + /* 750 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", + /* 751 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt", + /* 752 */ "query_simple ::= query_specification", + /* 753 */ "query_simple ::= union_query_expression", + /* 754 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery", + /* 755 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery", + /* 756 */ "query_simple_or_subquery ::= query_simple", + /* 757 */ "query_simple_or_subquery ::= subquery", + /* 758 */ "query_or_subquery ::= query_expression", + /* 759 */ "query_or_subquery ::= subquery", + /* 760 */ "order_by_clause_opt ::=", + /* 761 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", + /* 762 */ "slimit_clause_opt ::=", + /* 763 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", + /* 764 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", + /* 765 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 766 */ "limit_clause_opt ::=", + /* 767 */ "limit_clause_opt ::= LIMIT NK_INTEGER", + /* 768 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", + /* 769 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 770 */ "subquery ::= NK_LP query_expression NK_RP", + /* 771 */ "subquery ::= NK_LP subquery NK_RP", + /* 772 */ "search_condition ::= common_expression", + /* 773 */ "sort_specification_list ::= sort_specification", + /* 774 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", + /* 775 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt", + /* 776 */ "ordering_specification_opt ::=", + /* 777 */ "ordering_specification_opt ::= ASC", + /* 778 */ "ordering_specification_opt ::= DESC", + /* 779 */ "null_ordering_opt ::=", + /* 780 */ "null_ordering_opt ::= NULLS FIRST", + /* 781 */ "null_ordering_opt ::= NULLS LAST", + /* 782 */ "column_options ::=", + /* 783 */ "column_options ::= column_options PRIMARY KEY", + /* 784 */ "column_options ::= column_options NK_ID NK_STRING", }; #endif /* NDEBUG */ @@ -3884,9 +3494,7 @@ static void yy_destructor( case 568: /* query_simple_or_subquery */ case 570: /* sort_specification */ { -#line 7 "sql.y" nodesDestroyNode((yypminor->yy974)); -#line 3889 "sql.c" } break; case 390: /* account_options */ @@ -3896,9 +3504,7 @@ static void yy_destructor( case 478: /* with_meta */ case 487: /* bufsize_opt */ { -#line 54 "sql.y" -#line 3901 "sql.c" } break; case 394: /* ip_range_list */ @@ -3938,18 +3544,14 @@ static void yy_destructor( case 564: /* order_by_clause_opt */ case 569: /* sort_specification_list */ { -#line 85 "sql.y" nodesDestroyList((yypminor->yy946)); -#line 3943 "sql.c" } break; case 397: /* is_import_opt */ case 398: /* is_createdb_opt */ case 400: /* sysinfo_opt */ { -#line 99 "sql.y" -#line 3952 "sql.c" } break; case 399: /* user_name */ @@ -3974,25 +3576,19 @@ static void yy_destructor( case 517: /* noarg_func */ case 535: /* alias_opt */ { -#line 1095 "sql.y" -#line 3979 "sql.c" } break; case 401: /* privileges */ case 404: /* priv_type_list */ case 405: /* priv_type */ { -#line 131 "sql.y" -#line 3988 "sql.c" } break; case 402: /* priv_level */ { -#line 148 "sql.y" -#line 3995 "sql.c" } break; case 411: /* force_opt */ @@ -4007,97 +3603,71 @@ static void yy_destructor( case 546: /* set_quantifier_opt */ case 547: /* tag_mode_opt */ { -#line 186 "sql.y" -#line 4012 "sql.c" } break; case 424: /* alter_db_option */ case 452: /* alter_table_option */ { -#line 294 "sql.y" -#line 4020 "sql.c" } break; case 438: /* type_name */ case 449: /* type_name_default_len */ { -#line 436 "sql.y" -#line 4028 "sql.c" } break; case 457: /* db_kind_opt */ case 463: /* table_kind */ { -#line 617 "sql.y" -#line 4036 "sql.c" } break; case 458: /* table_kind_db_name_cond_opt */ { -#line 582 "sql.y" -#line 4043 "sql.c" } break; case 467: /* tsma_func_list */ { -#line 636 "sql.y" nodesDestroyNode((yypminor->yy974)); -#line 4050 "sql.c" } break; case 514: /* trim_specification_type */ { -#line 1241 "sql.y" -#line 4057 "sql.c" } break; case 525: /* compare_op */ case 526: /* in_op */ { -#line 1328 "sql.y" -#line 4065 "sql.c" } break; case 538: /* join_type */ { -#line 1409 "sql.y" -#line 4072 "sql.c" } break; case 539: /* join_subtype */ { -#line 1417 "sql.y" -#line 4079 "sql.c" } break; case 560: /* fill_mode */ { -#line 1537 "sql.y" -#line 4086 "sql.c" } break; case 571: /* ordering_specification_opt */ { -#line 1622 "sql.y" -#line 4093 "sql.c" } break; case 572: /* null_ordering_opt */ { -#line 1628 "sql.y" -#line 4100 "sql.c" } break; /********* End destructor definitions *****************************************/ @@ -4264,7 +3834,7 @@ static YYACTIONTYPE yy_find_shift_action( #endif /* YYWILDCARD */ return yy_default[stateno]; }else{ - assert( i>=0 && i<(int)(sizeof(yy_action)/sizeof(yy_action[0])) ); + assert( i>=0 && iyytos; - assert( yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ); #ifndef NDEBUG - if( yyTraceFILE ){ + if( yyTraceFILE && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){ yysize = yyRuleInfoNRhs[yyruleno]; if( yysize ){ fprintf(yyTraceFILE, "%sReduce %d [%s]%s, pop back to state %d.\n", @@ -6050,21 +5621,15 @@ static YYACTIONTYPE yy_reduce( /********** Begin reduce actions **********************************************/ YYMINORTYPE yylhsminor; case 0: /* cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ -#line 50 "sql.y" { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } -#line 6055 "sql.c" yy_destructor(yypParser,390,&yymsp[0].minor); break; case 1: /* cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ -#line 51 "sql.y" { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } -#line 6061 "sql.c" yy_destructor(yypParser,391,&yymsp[0].minor); break; case 2: /* account_options ::= */ -#line 55 "sql.y" { } -#line 6067 "sql.c" break; case 3: /* account_options ::= account_options PPS literal */ case 4: /* account_options ::= account_options TSERIES literal */ yytestcase(yyruleno==4); @@ -6076,24 +5641,18 @@ static YYACTIONTYPE yy_reduce( 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,390,&yymsp[-2].minor); -#line 56 "sql.y" { } -#line 6081 "sql.c" yy_destructor(yypParser,392,&yymsp[0].minor); } break; case 12: /* alter_account_options ::= alter_account_option */ { yy_destructor(yypParser,393,&yymsp[0].minor); -#line 68 "sql.y" { } -#line 6089 "sql.c" } break; case 13: /* alter_account_options ::= alter_account_options alter_account_option */ { yy_destructor(yypParser,391,&yymsp[-1].minor); -#line 69 "sql.y" { } -#line 6096 "sql.c" yy_destructor(yypParser,393,&yymsp[0].minor); } break; @@ -6107,2912 +5666,1979 @@ static YYACTIONTYPE yy_reduce( case 21: /* alter_account_option ::= USERS literal */ yytestcase(yyruleno==21); case 22: /* alter_account_option ::= CONNS literal */ yytestcase(yyruleno==22); case 23: /* alter_account_option ::= STATE literal */ yytestcase(yyruleno==23); -#line 73 "sql.y" { } -#line 6112 "sql.c" yy_destructor(yypParser,392,&yymsp[0].minor); break; case 24: /* ip_range_list ::= NK_STRING */ -#line 86 "sql.y" { yylhsminor.yy946 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } -#line 6118 "sql.c" yymsp[0].minor.yy946 = yylhsminor.yy946; break; case 25: /* ip_range_list ::= ip_range_list NK_COMMA NK_STRING */ -#line 87 "sql.y" { yylhsminor.yy946 = addNodeToList(pCxt, yymsp[-2].minor.yy946, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } -#line 6124 "sql.c" yymsp[-2].minor.yy946 = yylhsminor.yy946; break; case 26: /* white_list ::= HOST ip_range_list */ -#line 91 "sql.y" { yymsp[-1].minor.yy946 = yymsp[0].minor.yy946; } -#line 6130 "sql.c" break; case 27: /* white_list_opt ::= */ - case 212: /* specific_cols_opt ::= */ yytestcase(yyruleno==212); - case 250: /* tags_def_opt ::= */ yytestcase(yyruleno==250); - case 343: /* tag_list_opt ::= */ yytestcase(yyruleno==343); - case 416: /* col_list_opt ::= */ yytestcase(yyruleno==416); - case 423: /* tag_def_or_ref_opt ::= */ yytestcase(yyruleno==423); - case 707: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==707); - case 739: /* group_by_clause_opt ::= */ yytestcase(yyruleno==739); - case 759: /* order_by_clause_opt ::= */ yytestcase(yyruleno==759); -#line 95 "sql.y" + case 213: /* specific_cols_opt ::= */ yytestcase(yyruleno==213); + case 251: /* tags_def_opt ::= */ yytestcase(yyruleno==251); + case 344: /* tag_list_opt ::= */ yytestcase(yyruleno==344); + case 417: /* col_list_opt ::= */ yytestcase(yyruleno==417); + case 424: /* tag_def_or_ref_opt ::= */ yytestcase(yyruleno==424); + case 708: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==708); + case 740: /* group_by_clause_opt ::= */ yytestcase(yyruleno==740); + case 760: /* order_by_clause_opt ::= */ yytestcase(yyruleno==760); { yymsp[1].minor.yy946 = NULL; } -#line 6143 "sql.c" break; case 28: /* white_list_opt ::= white_list */ - case 251: /* tags_def_opt ::= tags_def */ yytestcase(yyruleno==251); - case 424: /* tag_def_or_ref_opt ::= tags_def */ yytestcase(yyruleno==424); - case 615: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==615); -#line 96 "sql.y" + case 252: /* tags_def_opt ::= tags_def */ yytestcase(yyruleno==252); + case 425: /* tag_def_or_ref_opt ::= tags_def */ yytestcase(yyruleno==425); + case 616: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==616); { yylhsminor.yy946 = yymsp[0].minor.yy946; } -#line 6151 "sql.c" yymsp[0].minor.yy946 = yylhsminor.yy946; break; case 29: /* is_import_opt ::= */ case 31: /* is_createdb_opt ::= */ yytestcase(yyruleno==31); -#line 100 "sql.y" { yymsp[1].minor.yy815 = 0; } -#line 6158 "sql.c" break; case 30: /* is_import_opt ::= IS_IMPORT NK_INTEGER */ case 32: /* is_createdb_opt ::= CREATEDB NK_INTEGER */ yytestcase(yyruleno==32); case 42: /* sysinfo_opt ::= SYSINFO NK_INTEGER */ yytestcase(yyruleno==42); -#line 101 "sql.y" { yymsp[-1].minor.yy815 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); } -#line 6165 "sql.c" break; case 33: /* cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt is_createdb_opt is_import_opt white_list_opt */ -#line 109 "sql.y" { pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-6].minor.yy557, &yymsp[-4].minor.yy0, yymsp[-3].minor.yy815, yymsp[-1].minor.yy815, yymsp[-2].minor.yy815); pCxt->pRootNode = addCreateUserStmtWhiteList(pCxt, pCxt->pRootNode, yymsp[0].minor.yy946); } -#line 6173 "sql.c" break; case 34: /* cmd ::= ALTER USER user_name PASS NK_STRING */ -#line 113 "sql.y" { pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy557, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } -#line 6178 "sql.c" break; case 35: /* cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ -#line 114 "sql.y" { pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy557, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); } -#line 6183 "sql.c" break; case 36: /* cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ -#line 115 "sql.y" { pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy557, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); } -#line 6188 "sql.c" break; case 37: /* cmd ::= ALTER USER user_name CREATEDB NK_INTEGER */ -#line 116 "sql.y" { pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy557, TSDB_ALTER_USER_CREATEDB, &yymsp[0].minor.yy0); } -#line 6193 "sql.c" break; case 38: /* cmd ::= ALTER USER user_name ADD white_list */ -#line 117 "sql.y" { pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy557, TSDB_ALTER_USER_ADD_WHITE_LIST, yymsp[0].minor.yy946); } -#line 6198 "sql.c" break; case 39: /* cmd ::= ALTER USER user_name DROP white_list */ -#line 118 "sql.y" { pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy557, TSDB_ALTER_USER_DROP_WHITE_LIST, yymsp[0].minor.yy946); } -#line 6203 "sql.c" break; case 40: /* cmd ::= DROP USER user_name */ -#line 119 "sql.y" { pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy557); } -#line 6208 "sql.c" break; case 41: /* sysinfo_opt ::= */ -#line 123 "sql.y" { yymsp[1].minor.yy815 = 1; } -#line 6213 "sql.c" break; case 43: /* cmd ::= GRANT privileges ON priv_level with_clause_opt TO user_name */ -#line 127 "sql.y" { pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-5].minor.yy483, &yymsp[-3].minor.yy723, &yymsp[0].minor.yy557, yymsp[-2].minor.yy974); } -#line 6218 "sql.c" break; case 44: /* cmd ::= REVOKE privileges ON priv_level with_clause_opt FROM user_name */ -#line 128 "sql.y" { pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-5].minor.yy483, &yymsp[-3].minor.yy723, &yymsp[0].minor.yy557, yymsp[-2].minor.yy974); } -#line 6223 "sql.c" break; case 45: /* privileges ::= ALL */ -#line 132 "sql.y" { yymsp[0].minor.yy483 = PRIVILEGE_TYPE_ALL; } -#line 6228 "sql.c" break; case 46: /* privileges ::= priv_type_list */ case 48: /* priv_type_list ::= priv_type */ yytestcase(yyruleno==48); -#line 133 "sql.y" { yylhsminor.yy483 = yymsp[0].minor.yy483; } -#line 6234 "sql.c" yymsp[0].minor.yy483 = yylhsminor.yy483; break; case 47: /* privileges ::= SUBSCRIBE */ -#line 134 "sql.y" { yymsp[0].minor.yy483 = PRIVILEGE_TYPE_SUBSCRIBE; } -#line 6240 "sql.c" break; case 49: /* priv_type_list ::= priv_type_list NK_COMMA priv_type */ -#line 139 "sql.y" { yylhsminor.yy483 = yymsp[-2].minor.yy483 | yymsp[0].minor.yy483; } -#line 6245 "sql.c" yymsp[-2].minor.yy483 = yylhsminor.yy483; break; case 50: /* priv_type ::= READ */ -#line 143 "sql.y" { yymsp[0].minor.yy483 = PRIVILEGE_TYPE_READ; } -#line 6251 "sql.c" break; case 51: /* priv_type ::= WRITE */ -#line 144 "sql.y" { yymsp[0].minor.yy483 = PRIVILEGE_TYPE_WRITE; } -#line 6256 "sql.c" break; case 52: /* priv_type ::= ALTER */ -#line 145 "sql.y" { yymsp[0].minor.yy483 = PRIVILEGE_TYPE_ALTER; } -#line 6261 "sql.c" break; case 53: /* priv_level ::= NK_STAR NK_DOT NK_STAR */ -#line 149 "sql.y" { yylhsminor.yy723.first = yymsp[-2].minor.yy0; yylhsminor.yy723.second = yymsp[0].minor.yy0; } -#line 6266 "sql.c" yymsp[-2].minor.yy723 = yylhsminor.yy723; break; case 54: /* priv_level ::= db_name NK_DOT NK_STAR */ -#line 150 "sql.y" { yylhsminor.yy723.first = yymsp[-2].minor.yy557; yylhsminor.yy723.second = yymsp[0].minor.yy0; } -#line 6272 "sql.c" yymsp[-2].minor.yy723 = yylhsminor.yy723; break; case 55: /* priv_level ::= db_name NK_DOT table_name */ -#line 151 "sql.y" { yylhsminor.yy723.first = yymsp[-2].minor.yy557; yylhsminor.yy723.second = yymsp[0].minor.yy557; } -#line 6278 "sql.c" yymsp[-2].minor.yy723 = yylhsminor.yy723; break; case 56: /* priv_level ::= topic_name */ -#line 152 "sql.y" { yylhsminor.yy723.first = yymsp[0].minor.yy557; yylhsminor.yy723.second = nil_token; } -#line 6284 "sql.c" yymsp[0].minor.yy723 = yylhsminor.yy723; break; case 57: /* with_clause_opt ::= */ - case 177: /* start_opt ::= */ yytestcase(yyruleno==177); - case 181: /* end_opt ::= */ yytestcase(yyruleno==181); - case 338: /* like_pattern_opt ::= */ yytestcase(yyruleno==338); - case 435: /* subtable_opt ::= */ yytestcase(yyruleno==435); - case 625: /* case_when_else_opt ::= */ yytestcase(yyruleno==625); - case 655: /* from_clause_opt ::= */ yytestcase(yyruleno==655); - case 682: /* join_on_clause_opt ::= */ yytestcase(yyruleno==682); - case 684: /* window_offset_clause_opt ::= */ yytestcase(yyruleno==684); - case 688: /* jlimit_clause_opt ::= */ yytestcase(yyruleno==688); - case 705: /* where_clause_opt ::= */ yytestcase(yyruleno==705); - case 714: /* twindow_clause_opt ::= */ yytestcase(yyruleno==714); - case 724: /* sliding_opt ::= */ yytestcase(yyruleno==724); - case 729: /* fill_opt ::= */ yytestcase(yyruleno==729); - case 743: /* having_clause_opt ::= */ yytestcase(yyruleno==743); - case 745: /* range_opt ::= */ yytestcase(yyruleno==745); - case 748: /* every_opt ::= */ yytestcase(yyruleno==748); - case 761: /* slimit_clause_opt ::= */ yytestcase(yyruleno==761); - case 765: /* limit_clause_opt ::= */ yytestcase(yyruleno==765); -#line 154 "sql.y" + case 178: /* start_opt ::= */ yytestcase(yyruleno==178); + case 182: /* end_opt ::= */ yytestcase(yyruleno==182); + case 339: /* like_pattern_opt ::= */ yytestcase(yyruleno==339); + case 436: /* subtable_opt ::= */ yytestcase(yyruleno==436); + case 626: /* case_when_else_opt ::= */ yytestcase(yyruleno==626); + case 656: /* from_clause_opt ::= */ yytestcase(yyruleno==656); + case 683: /* join_on_clause_opt ::= */ yytestcase(yyruleno==683); + case 685: /* window_offset_clause_opt ::= */ yytestcase(yyruleno==685); + case 689: /* jlimit_clause_opt ::= */ yytestcase(yyruleno==689); + case 706: /* where_clause_opt ::= */ yytestcase(yyruleno==706); + case 715: /* twindow_clause_opt ::= */ yytestcase(yyruleno==715); + case 725: /* sliding_opt ::= */ yytestcase(yyruleno==725); + case 730: /* fill_opt ::= */ yytestcase(yyruleno==730); + case 744: /* having_clause_opt ::= */ yytestcase(yyruleno==744); + case 746: /* range_opt ::= */ yytestcase(yyruleno==746); + case 749: /* every_opt ::= */ yytestcase(yyruleno==749); + case 762: /* slimit_clause_opt ::= */ yytestcase(yyruleno==762); + case 766: /* limit_clause_opt ::= */ yytestcase(yyruleno==766); { yymsp[1].minor.yy974 = NULL; } -#line 6308 "sql.c" break; case 58: /* with_clause_opt ::= WITH search_condition */ - case 656: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==656); - case 683: /* join_on_clause_opt ::= ON search_condition */ yytestcase(yyruleno==683); - case 706: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==706); - case 744: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==744); -#line 155 "sql.y" + case 657: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==657); + case 684: /* join_on_clause_opt ::= ON search_condition */ yytestcase(yyruleno==684); + case 707: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==707); + case 745: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==745); { yymsp[-1].minor.yy974 = yymsp[0].minor.yy974; } -#line 6317 "sql.c" break; case 59: /* cmd ::= CREATE ENCRYPT_KEY NK_STRING */ -#line 158 "sql.y" { pCxt->pRootNode = createEncryptKeyStmt(pCxt, &yymsp[0].minor.yy0); } -#line 6322 "sql.c" break; case 60: /* cmd ::= CREATE ANODE NK_STRING */ -#line 161 "sql.y" { pCxt->pRootNode = createCreateAnodeStmt(pCxt, &yymsp[0].minor.yy0); } -#line 6327 "sql.c" break; case 61: /* cmd ::= UPDATE ANODE NK_INTEGER */ -#line 162 "sql.y" { pCxt->pRootNode = createUpdateAnodeStmt(pCxt, &yymsp[0].minor.yy0, false); } -#line 6332 "sql.c" break; case 62: /* cmd ::= UPDATE ALL ANODES */ -#line 163 "sql.y" { pCxt->pRootNode = createUpdateAnodeStmt(pCxt, NULL, true); } -#line 6337 "sql.c" break; case 63: /* cmd ::= DROP ANODE NK_INTEGER */ -#line 164 "sql.y" { pCxt->pRootNode = createDropAnodeStmt(pCxt, &yymsp[0].minor.yy0); } -#line 6342 "sql.c" break; case 64: /* cmd ::= CREATE DNODE dnode_endpoint */ -#line 167 "sql.y" { pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy557, NULL); } -#line 6347 "sql.c" break; case 65: /* cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ -#line 168 "sql.y" { pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy557, &yymsp[0].minor.yy0); } -#line 6352 "sql.c" break; case 66: /* cmd ::= DROP DNODE NK_INTEGER force_opt */ -#line 169 "sql.y" { pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy569, false); } -#line 6357 "sql.c" break; case 67: /* cmd ::= DROP DNODE dnode_endpoint force_opt */ -#line 170 "sql.y" { pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy557, yymsp[0].minor.yy569, false); } -#line 6362 "sql.c" break; case 68: /* cmd ::= DROP DNODE NK_INTEGER unsafe_opt */ -#line 171 "sql.y" { pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, false, yymsp[0].minor.yy569); } -#line 6367 "sql.c" break; case 69: /* cmd ::= DROP DNODE dnode_endpoint unsafe_opt */ -#line 172 "sql.y" { pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy557, false, yymsp[0].minor.yy569); } -#line 6372 "sql.c" break; case 70: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ -#line 173 "sql.y" { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, NULL); } -#line 6377 "sql.c" break; case 71: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ -#line 174 "sql.y" { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-2].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } -#line 6382 "sql.c" break; case 72: /* cmd ::= ALTER ALL DNODES NK_STRING */ -#line 175 "sql.y" { pCxt->pRootNode = createAlterDnodeStmt(pCxt, NULL, &yymsp[0].minor.yy0, NULL); } -#line 6387 "sql.c" break; case 73: /* cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ -#line 176 "sql.y" { pCxt->pRootNode = createAlterDnodeStmt(pCxt, NULL, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } -#line 6392 "sql.c" break; case 74: /* cmd ::= RESTORE DNODE NK_INTEGER */ -#line 177 "sql.y" { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_DNODE_STMT, &yymsp[0].minor.yy0); } -#line 6397 "sql.c" break; case 75: /* dnode_endpoint ::= NK_STRING */ case 76: /* dnode_endpoint ::= NK_ID */ yytestcase(yyruleno==76); case 77: /* dnode_endpoint ::= NK_IPTOKEN */ yytestcase(yyruleno==77); - case 372: /* sma_func_name ::= COUNT */ yytestcase(yyruleno==372); - case 373: /* sma_func_name ::= FIRST */ yytestcase(yyruleno==373); - case 374: /* sma_func_name ::= LAST */ yytestcase(yyruleno==374); - case 375: /* sma_func_name ::= LAST_ROW */ yytestcase(yyruleno==375); - case 523: /* db_name ::= NK_ID */ yytestcase(yyruleno==523); - case 524: /* table_name ::= NK_ID */ yytestcase(yyruleno==524); - case 525: /* column_name ::= NK_ID */ yytestcase(yyruleno==525); - case 526: /* function_name ::= NK_ID */ yytestcase(yyruleno==526); - case 527: /* view_name ::= NK_ID */ yytestcase(yyruleno==527); - case 528: /* table_alias ::= NK_ID */ yytestcase(yyruleno==528); - case 529: /* column_alias ::= NK_ID */ yytestcase(yyruleno==529); - case 530: /* column_alias ::= NK_ALIAS */ yytestcase(yyruleno==530); - case 531: /* user_name ::= NK_ID */ yytestcase(yyruleno==531); - case 532: /* topic_name ::= NK_ID */ yytestcase(yyruleno==532); - case 533: /* stream_name ::= NK_ID */ yytestcase(yyruleno==533); - case 534: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==534); - case 535: /* index_name ::= NK_ID */ yytestcase(yyruleno==535); - case 536: /* tsma_name ::= NK_ID */ yytestcase(yyruleno==536); - case 595: /* substr_func ::= SUBSTR */ yytestcase(yyruleno==595); - case 596: /* substr_func ::= SUBSTRING */ yytestcase(yyruleno==596); - case 600: /* noarg_func ::= NOW */ yytestcase(yyruleno==600); - case 601: /* noarg_func ::= TODAY */ yytestcase(yyruleno==601); - case 602: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==602); - case 603: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==603); - case 604: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==604); - case 605: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==605); - case 606: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==606); - case 607: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==607); - case 608: /* noarg_func ::= USER */ yytestcase(yyruleno==608); - case 609: /* noarg_func ::= PI */ yytestcase(yyruleno==609); - case 610: /* star_func ::= COUNT */ yytestcase(yyruleno==610); - case 611: /* star_func ::= FIRST */ yytestcase(yyruleno==611); - case 612: /* star_func ::= LAST */ yytestcase(yyruleno==612); - case 613: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==613); -#line 181 "sql.y" + case 373: /* sma_func_name ::= COUNT */ yytestcase(yyruleno==373); + case 374: /* sma_func_name ::= FIRST */ yytestcase(yyruleno==374); + case 375: /* sma_func_name ::= LAST */ yytestcase(yyruleno==375); + case 376: /* sma_func_name ::= LAST_ROW */ yytestcase(yyruleno==376); + case 524: /* db_name ::= NK_ID */ yytestcase(yyruleno==524); + case 525: /* table_name ::= NK_ID */ yytestcase(yyruleno==525); + case 526: /* column_name ::= NK_ID */ yytestcase(yyruleno==526); + case 527: /* function_name ::= NK_ID */ yytestcase(yyruleno==527); + case 528: /* view_name ::= NK_ID */ yytestcase(yyruleno==528); + case 529: /* table_alias ::= NK_ID */ yytestcase(yyruleno==529); + case 530: /* column_alias ::= NK_ID */ yytestcase(yyruleno==530); + case 531: /* column_alias ::= NK_ALIAS */ yytestcase(yyruleno==531); + case 532: /* user_name ::= NK_ID */ yytestcase(yyruleno==532); + case 533: /* topic_name ::= NK_ID */ yytestcase(yyruleno==533); + case 534: /* stream_name ::= NK_ID */ yytestcase(yyruleno==534); + case 535: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==535); + case 536: /* index_name ::= NK_ID */ yytestcase(yyruleno==536); + case 537: /* tsma_name ::= NK_ID */ yytestcase(yyruleno==537); + case 596: /* substr_func ::= SUBSTR */ yytestcase(yyruleno==596); + case 597: /* substr_func ::= SUBSTRING */ yytestcase(yyruleno==597); + case 601: /* noarg_func ::= NOW */ yytestcase(yyruleno==601); + case 602: /* noarg_func ::= TODAY */ yytestcase(yyruleno==602); + case 603: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==603); + case 604: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==604); + case 605: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==605); + case 606: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==606); + case 607: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==607); + case 608: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==608); + case 609: /* noarg_func ::= USER */ yytestcase(yyruleno==609); + case 610: /* noarg_func ::= PI */ yytestcase(yyruleno==610); + case 611: /* star_func ::= COUNT */ yytestcase(yyruleno==611); + case 612: /* star_func ::= FIRST */ yytestcase(yyruleno==612); + case 613: /* star_func ::= LAST */ yytestcase(yyruleno==613); + case 614: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==614); { yylhsminor.yy557 = yymsp[0].minor.yy0; } -#line 6438 "sql.c" yymsp[0].minor.yy557 = yylhsminor.yy557; break; case 78: /* force_opt ::= */ case 105: /* not_exists_opt ::= */ yytestcase(yyruleno==105); case 107: /* exists_opt ::= */ yytestcase(yyruleno==107); - case 210: /* with_opt ::= */ yytestcase(yyruleno==210); - case 393: /* analyze_opt ::= */ yytestcase(yyruleno==393); - case 400: /* agg_func_opt ::= */ yytestcase(yyruleno==400); - case 406: /* or_replace_opt ::= */ yytestcase(yyruleno==406); - case 437: /* ignore_opt ::= */ yytestcase(yyruleno==437); - case 693: /* tag_mode_opt ::= */ yytestcase(yyruleno==693); - case 695: /* set_quantifier_opt ::= */ yytestcase(yyruleno==695); -#line 187 "sql.y" + case 211: /* with_opt ::= */ yytestcase(yyruleno==211); + case 394: /* analyze_opt ::= */ yytestcase(yyruleno==394); + case 401: /* agg_func_opt ::= */ yytestcase(yyruleno==401); + case 407: /* or_replace_opt ::= */ yytestcase(yyruleno==407); + case 438: /* ignore_opt ::= */ yytestcase(yyruleno==438); + case 694: /* tag_mode_opt ::= */ yytestcase(yyruleno==694); + case 696: /* set_quantifier_opt ::= */ yytestcase(yyruleno==696); { yymsp[1].minor.yy569 = false; } -#line 6453 "sql.c" break; case 79: /* force_opt ::= FORCE */ case 80: /* unsafe_opt ::= UNSAFE */ yytestcase(yyruleno==80); - case 211: /* with_opt ::= WITH */ yytestcase(yyruleno==211); - case 394: /* analyze_opt ::= ANALYZE */ yytestcase(yyruleno==394); - case 401: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==401); - case 694: /* tag_mode_opt ::= TAGS */ yytestcase(yyruleno==694); - case 696: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==696); -#line 188 "sql.y" + case 212: /* with_opt ::= WITH */ yytestcase(yyruleno==212); + case 395: /* analyze_opt ::= ANALYZE */ yytestcase(yyruleno==395); + case 402: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==402); + case 695: /* tag_mode_opt ::= TAGS */ yytestcase(yyruleno==695); + case 697: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==697); { yymsp[0].minor.yy569 = true; } -#line 6464 "sql.c" break; case 81: /* cmd ::= ALTER CLUSTER NK_STRING */ -#line 195 "sql.y" { pCxt->pRootNode = createAlterClusterStmt(pCxt, &yymsp[0].minor.yy0, NULL); } -#line 6469 "sql.c" break; case 82: /* cmd ::= ALTER CLUSTER NK_STRING NK_STRING */ -#line 196 "sql.y" { pCxt->pRootNode = createAlterClusterStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } -#line 6474 "sql.c" break; case 83: /* cmd ::= ALTER LOCAL NK_STRING */ -#line 199 "sql.y" { pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[0].minor.yy0, NULL); } -#line 6479 "sql.c" break; case 84: /* cmd ::= ALTER LOCAL NK_STRING NK_STRING */ -#line 200 "sql.y" { pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } -#line 6484 "sql.c" break; case 85: /* cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ -#line 203 "sql.y" { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_QNODE_STMT, &yymsp[0].minor.yy0); } -#line 6489 "sql.c" break; case 86: /* cmd ::= DROP QNODE ON DNODE NK_INTEGER */ -#line 204 "sql.y" { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_QNODE_STMT, &yymsp[0].minor.yy0); } -#line 6494 "sql.c" break; case 87: /* cmd ::= RESTORE QNODE ON DNODE NK_INTEGER */ -#line 205 "sql.y" { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_QNODE_STMT, &yymsp[0].minor.yy0); } -#line 6499 "sql.c" break; case 88: /* cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ -#line 208 "sql.y" { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_BNODE_STMT, &yymsp[0].minor.yy0); } -#line 6504 "sql.c" break; case 89: /* cmd ::= DROP BNODE ON DNODE NK_INTEGER */ -#line 209 "sql.y" { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_BNODE_STMT, &yymsp[0].minor.yy0); } -#line 6509 "sql.c" break; case 90: /* cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ -#line 212 "sql.y" { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_SNODE_STMT, &yymsp[0].minor.yy0); } -#line 6514 "sql.c" break; case 91: /* cmd ::= DROP SNODE ON DNODE NK_INTEGER */ -#line 213 "sql.y" { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_SNODE_STMT, &yymsp[0].minor.yy0); } -#line 6519 "sql.c" break; case 92: /* cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ -#line 216 "sql.y" { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_MNODE_STMT, &yymsp[0].minor.yy0); } -#line 6524 "sql.c" break; case 93: /* cmd ::= DROP MNODE ON DNODE NK_INTEGER */ -#line 217 "sql.y" { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_MNODE_STMT, &yymsp[0].minor.yy0); } -#line 6529 "sql.c" break; case 94: /* cmd ::= RESTORE MNODE ON DNODE NK_INTEGER */ -#line 218 "sql.y" { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_MNODE_STMT, &yymsp[0].minor.yy0); } -#line 6534 "sql.c" break; case 95: /* cmd ::= RESTORE VNODE ON DNODE NK_INTEGER */ -#line 221 "sql.y" { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_VNODE_STMT, &yymsp[0].minor.yy0); } -#line 6539 "sql.c" break; case 96: /* cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ -#line 224 "sql.y" { pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy569, &yymsp[-1].minor.yy557, yymsp[0].minor.yy974); } -#line 6544 "sql.c" break; case 97: /* cmd ::= DROP DATABASE exists_opt db_name */ -#line 225 "sql.y" { pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy569, &yymsp[0].minor.yy557); } -#line 6549 "sql.c" break; case 98: /* cmd ::= USE db_name */ -#line 226 "sql.y" { pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy557); } -#line 6554 "sql.c" break; case 99: /* cmd ::= ALTER DATABASE db_name alter_db_options */ -#line 227 "sql.y" { pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy557, yymsp[0].minor.yy974); } -#line 6559 "sql.c" break; case 100: /* cmd ::= FLUSH DATABASE db_name */ -#line 228 "sql.y" { pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy557); } -#line 6564 "sql.c" break; case 101: /* cmd ::= TRIM DATABASE db_name speed_opt */ -#line 229 "sql.y" { pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy557, yymsp[0].minor.yy904); } -#line 6569 "sql.c" break; case 102: /* cmd ::= S3MIGRATE DATABASE db_name */ -#line 230 "sql.y" { pCxt->pRootNode = createS3MigrateDatabaseStmt(pCxt, &yymsp[0].minor.yy557); } -#line 6574 "sql.c" break; case 103: /* cmd ::= COMPACT DATABASE db_name start_opt end_opt */ -#line 231 "sql.y" { pCxt->pRootNode = createCompactStmt(pCxt, &yymsp[-2].minor.yy557, yymsp[-1].minor.yy974, yymsp[0].minor.yy974); } -#line 6579 "sql.c" break; case 104: /* not_exists_opt ::= IF NOT EXISTS */ -#line 235 "sql.y" { yymsp[-2].minor.yy569 = true; } -#line 6584 "sql.c" break; case 106: /* exists_opt ::= IF EXISTS */ - case 407: /* or_replace_opt ::= OR REPLACE */ yytestcase(yyruleno==407); - case 438: /* ignore_opt ::= IGNORE UNTREATED */ yytestcase(yyruleno==438); -#line 240 "sql.y" + case 408: /* or_replace_opt ::= OR REPLACE */ yytestcase(yyruleno==408); + case 439: /* ignore_opt ::= IGNORE UNTREATED */ yytestcase(yyruleno==439); { yymsp[-1].minor.yy569 = true; } -#line 6591 "sql.c" break; case 108: /* db_options ::= */ -#line 243 "sql.y" { yymsp[1].minor.yy974 = createDefaultDatabaseOptions(pCxt); } -#line 6596 "sql.c" break; case 109: /* db_options ::= db_options BUFFER NK_INTEGER */ -#line 244 "sql.y" { yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } -#line 6601 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 110: /* db_options ::= db_options CACHEMODEL NK_STRING */ -#line 245 "sql.y" { yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); } -#line 6607 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 111: /* db_options ::= db_options CACHESIZE NK_INTEGER */ -#line 246 "sql.y" { yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); } -#line 6613 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 112: /* db_options ::= db_options COMP NK_INTEGER */ -#line 247 "sql.y" { yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_COMP, &yymsp[0].minor.yy0); } -#line 6619 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 113: /* db_options ::= db_options DURATION NK_INTEGER */ case 114: /* db_options ::= db_options DURATION NK_VARIABLE */ yytestcase(yyruleno==114); -#line 248 "sql.y" { yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } -#line 6626 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 115: /* db_options ::= db_options MAXROWS NK_INTEGER */ -#line 250 "sql.y" { yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } -#line 6632 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 116: /* db_options ::= db_options MINROWS NK_INTEGER */ -#line 251 "sql.y" { yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } -#line 6638 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 117: /* db_options ::= db_options KEEP integer_list */ case 118: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==118); -#line 252 "sql.y" { yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_KEEP, yymsp[0].minor.yy946); } -#line 6645 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 119: /* db_options ::= db_options PAGES NK_INTEGER */ -#line 254 "sql.y" { yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } -#line 6651 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 120: /* db_options ::= db_options PAGESIZE NK_INTEGER */ -#line 255 "sql.y" { yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } -#line 6657 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 121: /* db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ -#line 256 "sql.y" { yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); } -#line 6663 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 122: /* db_options ::= db_options PRECISION NK_STRING */ -#line 257 "sql.y" { yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } -#line 6669 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 123: /* db_options ::= db_options REPLICA NK_INTEGER */ -#line 258 "sql.y" { yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } -#line 6675 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 124: /* db_options ::= db_options VGROUPS NK_INTEGER */ -#line 260 "sql.y" { yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } -#line 6681 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 125: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */ -#line 261 "sql.y" { yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } -#line 6687 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 126: /* db_options ::= db_options RETENTIONS retention_list */ -#line 262 "sql.y" { yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_RETENTIONS, yymsp[0].minor.yy946); } -#line 6693 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 127: /* db_options ::= db_options SCHEMALESS NK_INTEGER */ -#line 263 "sql.y" { yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } -#line 6699 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 128: /* db_options ::= db_options WAL_LEVEL NK_INTEGER */ -#line 264 "sql.y" { yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_WAL, &yymsp[0].minor.yy0); } -#line 6705 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 129: /* db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ -#line 265 "sql.y" { yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } -#line 6711 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 130: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ -#line 266 "sql.y" { yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); } -#line 6717 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 131: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ -#line 267 "sql.y" { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-3].minor.yy974, DB_OPTION_WAL_RETENTION_PERIOD, &t); } -#line 6727 "sql.c" yymsp[-3].minor.yy974 = yylhsminor.yy974; break; case 132: /* db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ -#line 272 "sql.y" { yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); } -#line 6733 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 133: /* db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ -#line 273 "sql.y" { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-3].minor.yy974, DB_OPTION_WAL_RETENTION_SIZE, &t); } -#line 6743 "sql.c" yymsp[-3].minor.yy974 = yylhsminor.yy974; break; case 134: /* db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ -#line 278 "sql.y" { yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); } -#line 6749 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 135: /* db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ -#line 279 "sql.y" { yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); } -#line 6755 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 136: /* db_options ::= db_options STT_TRIGGER NK_INTEGER */ -#line 280 "sql.y" { yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); } -#line 6761 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 137: /* db_options ::= db_options TABLE_PREFIX signed */ -#line 281 "sql.y" { yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_TABLE_PREFIX, yymsp[0].minor.yy974); } -#line 6767 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 138: /* db_options ::= db_options TABLE_SUFFIX signed */ -#line 282 "sql.y" { yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_TABLE_SUFFIX, yymsp[0].minor.yy974); } -#line 6773 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 139: /* db_options ::= db_options S3_CHUNKPAGES NK_INTEGER */ -#line 283 "sql.y" { yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_S3_CHUNKPAGES, &yymsp[0].minor.yy0); } -#line 6779 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 140: /* db_options ::= db_options S3_KEEPLOCAL NK_INTEGER */ case 141: /* db_options ::= db_options S3_KEEPLOCAL NK_VARIABLE */ yytestcase(yyruleno==141); -#line 284 "sql.y" { yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_S3_KEEPLOCAL, &yymsp[0].minor.yy0); } -#line 6786 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 142: /* db_options ::= db_options S3_COMPACT NK_INTEGER */ -#line 286 "sql.y" { yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_S3_COMPACT, &yymsp[0].minor.yy0); } -#line 6792 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 143: /* db_options ::= db_options KEEP_TIME_OFFSET NK_INTEGER */ -#line 287 "sql.y" { yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_KEEP_TIME_OFFSET, &yymsp[0].minor.yy0); } -#line 6798 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; case 144: /* db_options ::= db_options ENCRYPT_ALGORITHM NK_STRING */ -#line 288 "sql.y" { yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_ENCRYPT_ALGORITHM, &yymsp[0].minor.yy0); } -#line 6804 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; - case 145: /* alter_db_options ::= alter_db_option */ -#line 290 "sql.y" + case 145: /* db_options ::= db_options DNODES NK_STRING */ +{ yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_DNODES, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy974 = yylhsminor.yy974; + break; + case 146: /* alter_db_options ::= alter_db_option */ { yylhsminor.yy974 = createAlterDatabaseOptions(pCxt); yylhsminor.yy974 = setAlterDatabaseOption(pCxt, yylhsminor.yy974, &yymsp[0].minor.yy683); } -#line 6810 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; - case 146: /* alter_db_options ::= alter_db_options alter_db_option */ -#line 291 "sql.y" + case 147: /* alter_db_options ::= alter_db_options alter_db_option */ { yylhsminor.yy974 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy974, &yymsp[0].minor.yy683); } -#line 6816 "sql.c" yymsp[-1].minor.yy974 = yylhsminor.yy974; break; - case 147: /* alter_db_option ::= BUFFER NK_INTEGER */ -#line 295 "sql.y" + case 148: /* alter_db_option ::= BUFFER NK_INTEGER */ { yymsp[-1].minor.yy683.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; } -#line 6822 "sql.c" break; - case 148: /* alter_db_option ::= CACHEMODEL NK_STRING */ -#line 296 "sql.y" + case 149: /* alter_db_option ::= CACHEMODEL NK_STRING */ { yymsp[-1].minor.yy683.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; } -#line 6827 "sql.c" break; - case 149: /* alter_db_option ::= CACHESIZE NK_INTEGER */ -#line 297 "sql.y" + case 150: /* alter_db_option ::= CACHESIZE NK_INTEGER */ { yymsp[-1].minor.yy683.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; } -#line 6832 "sql.c" break; - case 150: /* alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ -#line 298 "sql.y" + case 151: /* alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ { yymsp[-1].minor.yy683.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; } -#line 6837 "sql.c" break; - case 151: /* alter_db_option ::= KEEP integer_list */ - case 152: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==152); -#line 299 "sql.y" + case 152: /* alter_db_option ::= KEEP integer_list */ + case 153: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==153); { yymsp[-1].minor.yy683.type = DB_OPTION_KEEP; yymsp[-1].minor.yy683.pList = yymsp[0].minor.yy946; } -#line 6843 "sql.c" break; - case 153: /* alter_db_option ::= PAGES NK_INTEGER */ -#line 301 "sql.y" + case 154: /* alter_db_option ::= PAGES NK_INTEGER */ { yymsp[-1].minor.yy683.type = DB_OPTION_PAGES; yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; } -#line 6848 "sql.c" break; - case 154: /* alter_db_option ::= REPLICA NK_INTEGER */ -#line 302 "sql.y" + case 155: /* alter_db_option ::= REPLICA NK_INTEGER */ { yymsp[-1].minor.yy683.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; } -#line 6853 "sql.c" break; - case 155: /* alter_db_option ::= WAL_LEVEL NK_INTEGER */ -#line 304 "sql.y" + case 156: /* alter_db_option ::= WAL_LEVEL NK_INTEGER */ { yymsp[-1].minor.yy683.type = DB_OPTION_WAL; yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; } -#line 6858 "sql.c" break; - case 156: /* alter_db_option ::= STT_TRIGGER NK_INTEGER */ -#line 305 "sql.y" + case 157: /* alter_db_option ::= STT_TRIGGER NK_INTEGER */ { yymsp[-1].minor.yy683.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; } -#line 6863 "sql.c" break; - case 157: /* alter_db_option ::= MINROWS NK_INTEGER */ -#line 306 "sql.y" + case 158: /* alter_db_option ::= MINROWS NK_INTEGER */ { yymsp[-1].minor.yy683.type = DB_OPTION_MINROWS; yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; } -#line 6868 "sql.c" break; - case 158: /* alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */ -#line 307 "sql.y" + case 159: /* alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */ { yymsp[-1].minor.yy683.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; } -#line 6873 "sql.c" break; - case 159: /* alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ -#line 308 "sql.y" + case 160: /* alter_db_option ::= 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; yymsp[-2].minor.yy683.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-2].minor.yy683.val = t; } -#line 6882 "sql.c" break; - case 160: /* alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */ -#line 313 "sql.y" + case 161: /* alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */ { yymsp[-1].minor.yy683.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; } -#line 6887 "sql.c" break; - case 161: /* alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ -#line 314 "sql.y" + case 162: /* alter_db_option ::= 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; yymsp[-2].minor.yy683.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-2].minor.yy683.val = t; } -#line 6896 "sql.c" break; - case 162: /* alter_db_option ::= S3_KEEPLOCAL NK_INTEGER */ - case 163: /* alter_db_option ::= S3_KEEPLOCAL NK_VARIABLE */ yytestcase(yyruleno==163); -#line 319 "sql.y" + case 163: /* alter_db_option ::= S3_KEEPLOCAL NK_INTEGER */ + case 164: /* alter_db_option ::= S3_KEEPLOCAL NK_VARIABLE */ yytestcase(yyruleno==164); { yymsp[-1].minor.yy683.type = DB_OPTION_S3_KEEPLOCAL; yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; } -#line 6902 "sql.c" break; - case 164: /* alter_db_option ::= S3_COMPACT NK_INTEGER */ -#line 321 "sql.y" + case 165: /* alter_db_option ::= S3_COMPACT NK_INTEGER */ { yymsp[-1].minor.yy683.type = DB_OPTION_S3_COMPACT, yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; } -#line 6907 "sql.c" break; - case 165: /* alter_db_option ::= KEEP_TIME_OFFSET NK_INTEGER */ -#line 322 "sql.y" + case 166: /* alter_db_option ::= KEEP_TIME_OFFSET NK_INTEGER */ { yymsp[-1].minor.yy683.type = DB_OPTION_KEEP_TIME_OFFSET; yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; } -#line 6912 "sql.c" break; - case 166: /* alter_db_option ::= ENCRYPT_ALGORITHM NK_STRING */ -#line 323 "sql.y" + case 167: /* alter_db_option ::= ENCRYPT_ALGORITHM NK_STRING */ { yymsp[-1].minor.yy683.type = DB_OPTION_ENCRYPT_ALGORITHM; yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; } -#line 6917 "sql.c" break; - case 167: /* integer_list ::= NK_INTEGER */ -#line 327 "sql.y" + case 168: /* integer_list ::= NK_INTEGER */ { yylhsminor.yy946 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } -#line 6922 "sql.c" yymsp[0].minor.yy946 = yylhsminor.yy946; break; - case 168: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */ - case 452: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==452); -#line 328 "sql.y" + case 169: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */ + case 453: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==453); { yylhsminor.yy946 = addNodeToList(pCxt, yymsp[-2].minor.yy946, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } -#line 6929 "sql.c" yymsp[-2].minor.yy946 = yylhsminor.yy946; break; - case 169: /* variable_list ::= NK_VARIABLE */ -#line 332 "sql.y" + case 170: /* variable_list ::= NK_VARIABLE */ { yylhsminor.yy946 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } -#line 6935 "sql.c" yymsp[0].minor.yy946 = yylhsminor.yy946; break; - case 170: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */ -#line 333 "sql.y" + case 171: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */ { yylhsminor.yy946 = addNodeToList(pCxt, yymsp[-2].minor.yy946, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } -#line 6941 "sql.c" yymsp[-2].minor.yy946 = yylhsminor.yy946; break; - case 171: /* retention_list ::= retention */ - case 204: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==204); - case 207: /* multi_drop_clause ::= drop_table_clause */ yytestcase(yyruleno==207); - case 216: /* tag_def_list ::= tag_def */ yytestcase(yyruleno==216); - case 219: /* column_def_list ::= column_def */ yytestcase(yyruleno==219); - case 267: /* rollup_func_list ::= rollup_func_name */ yytestcase(yyruleno==267); - case 272: /* col_name_list ::= col_name */ yytestcase(yyruleno==272); - case 344: /* tag_list_opt ::= tag_item */ yytestcase(yyruleno==344); - case 368: /* func_list ::= func */ yytestcase(yyruleno==368); - case 418: /* column_stream_def_list ::= column_stream_def */ yytestcase(yyruleno==418); - case 496: /* tags_literal_list ::= tags_literal */ yytestcase(yyruleno==496); - case 521: /* literal_list ::= signed_literal */ yytestcase(yyruleno==521); - case 616: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==616); - case 622: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==622); - case 698: /* select_list ::= select_item */ yytestcase(yyruleno==698); - case 709: /* partition_list ::= partition_item */ yytestcase(yyruleno==709); - case 772: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==772); -#line 337 "sql.y" + case 172: /* retention_list ::= retention */ + case 205: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==205); + case 208: /* multi_drop_clause ::= drop_table_clause */ yytestcase(yyruleno==208); + case 217: /* tag_def_list ::= tag_def */ yytestcase(yyruleno==217); + case 220: /* column_def_list ::= column_def */ yytestcase(yyruleno==220); + case 268: /* rollup_func_list ::= rollup_func_name */ yytestcase(yyruleno==268); + case 273: /* col_name_list ::= col_name */ yytestcase(yyruleno==273); + case 345: /* tag_list_opt ::= tag_item */ yytestcase(yyruleno==345); + case 369: /* func_list ::= func */ yytestcase(yyruleno==369); + case 419: /* column_stream_def_list ::= column_stream_def */ yytestcase(yyruleno==419); + case 497: /* tags_literal_list ::= tags_literal */ yytestcase(yyruleno==497); + case 522: /* literal_list ::= signed_literal */ yytestcase(yyruleno==522); + case 617: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==617); + case 623: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==623); + case 699: /* select_list ::= select_item */ yytestcase(yyruleno==699); + case 710: /* partition_list ::= partition_item */ yytestcase(yyruleno==710); + case 773: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==773); { yylhsminor.yy946 = createNodeList(pCxt, yymsp[0].minor.yy974); } -#line 6963 "sql.c" yymsp[0].minor.yy946 = yylhsminor.yy946; break; - case 172: /* retention_list ::= retention_list NK_COMMA retention */ - case 208: /* multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ yytestcase(yyruleno==208); - case 217: /* tag_def_list ::= tag_def_list NK_COMMA tag_def */ yytestcase(yyruleno==217); - case 220: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==220); - case 268: /* rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ yytestcase(yyruleno==268); - case 273: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==273); - case 345: /* tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ yytestcase(yyruleno==345); - case 369: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==369); - case 419: /* column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def */ yytestcase(yyruleno==419); - case 497: /* tags_literal_list ::= tags_literal_list NK_COMMA tags_literal */ yytestcase(yyruleno==497); - case 522: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==522); - case 617: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==617); - case 699: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==699); - case 710: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==710); - case 773: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==773); -#line 338 "sql.y" + case 173: /* retention_list ::= retention_list NK_COMMA retention */ + case 209: /* multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ yytestcase(yyruleno==209); + case 218: /* tag_def_list ::= tag_def_list NK_COMMA tag_def */ yytestcase(yyruleno==218); + case 221: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==221); + case 269: /* rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ yytestcase(yyruleno==269); + case 274: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==274); + case 346: /* tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ yytestcase(yyruleno==346); + case 370: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==370); + case 420: /* column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def */ yytestcase(yyruleno==420); + case 498: /* tags_literal_list ::= tags_literal_list NK_COMMA tags_literal */ yytestcase(yyruleno==498); + case 523: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==523); + case 618: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==618); + case 700: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==700); + case 711: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==711); + case 774: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==774); { yylhsminor.yy946 = addNodeToList(pCxt, yymsp[-2].minor.yy946, yymsp[0].minor.yy974); } -#line 6983 "sql.c" yymsp[-2].minor.yy946 = yylhsminor.yy946; break; - case 173: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ - case 174: /* retention ::= NK_MINUS NK_COLON NK_VARIABLE */ yytestcase(yyruleno==174); -#line 340 "sql.y" + case 174: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ + case 175: /* retention ::= NK_MINUS NK_COLON NK_VARIABLE */ yytestcase(yyruleno==175); { yylhsminor.yy974 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } -#line 6990 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; - case 175: /* speed_opt ::= */ - case 402: /* bufsize_opt ::= */ yytestcase(yyruleno==402); -#line 345 "sql.y" + case 176: /* speed_opt ::= */ + case 403: /* bufsize_opt ::= */ yytestcase(yyruleno==403); { yymsp[1].minor.yy904 = 0; } -#line 6997 "sql.c" break; - case 176: /* speed_opt ::= BWLIMIT NK_INTEGER */ - case 403: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==403); -#line 346 "sql.y" + case 177: /* speed_opt ::= BWLIMIT NK_INTEGER */ + case 404: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==404); { yymsp[-1].minor.yy904 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } -#line 7003 "sql.c" break; - case 178: /* start_opt ::= START WITH NK_INTEGER */ - case 182: /* end_opt ::= END WITH NK_INTEGER */ yytestcase(yyruleno==182); -#line 349 "sql.y" + case 179: /* start_opt ::= START WITH NK_INTEGER */ + case 183: /* end_opt ::= END WITH NK_INTEGER */ yytestcase(yyruleno==183); { yymsp[-2].minor.yy974 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } -#line 7009 "sql.c" break; - case 179: /* start_opt ::= START WITH NK_STRING */ - case 183: /* end_opt ::= END WITH NK_STRING */ yytestcase(yyruleno==183); -#line 350 "sql.y" + case 180: /* start_opt ::= START WITH NK_STRING */ + case 184: /* end_opt ::= END WITH NK_STRING */ yytestcase(yyruleno==184); { yymsp[-2].minor.yy974 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } -#line 7015 "sql.c" break; - case 180: /* start_opt ::= START WITH TIMESTAMP NK_STRING */ - case 184: /* end_opt ::= END WITH TIMESTAMP NK_STRING */ yytestcase(yyruleno==184); -#line 351 "sql.y" + case 181: /* start_opt ::= START WITH TIMESTAMP NK_STRING */ + case 185: /* end_opt ::= END WITH TIMESTAMP NK_STRING */ yytestcase(yyruleno==185); { yymsp[-3].minor.yy974 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } -#line 7021 "sql.c" break; - case 185: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ - case 188: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==188); -#line 360 "sql.y" + case 186: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ + case 189: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==189); { pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy569, yymsp[-5].minor.yy974, yymsp[-3].minor.yy946, yymsp[-1].minor.yy946, yymsp[0].minor.yy974); } -#line 7027 "sql.c" break; - case 186: /* cmd ::= CREATE TABLE multi_create_clause */ -#line 361 "sql.y" + case 187: /* cmd ::= CREATE TABLE multi_create_clause */ { pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy946); } -#line 7032 "sql.c" break; - case 187: /* cmd ::= CREATE TABLE not_exists_opt USING full_table_name NK_LP tag_list_opt NK_RP FILE NK_STRING */ -#line 363 "sql.y" + case 188: /* cmd ::= CREATE TABLE not_exists_opt USING full_table_name NK_LP tag_list_opt NK_RP FILE NK_STRING */ { pCxt->pRootNode = createCreateSubTableFromFileClause(pCxt, yymsp[-7].minor.yy569, yymsp[-5].minor.yy974, yymsp[-3].minor.yy946, &yymsp[0].minor.yy0); } -#line 7037 "sql.c" break; - case 189: /* cmd ::= DROP TABLE with_opt multi_drop_clause */ -#line 366 "sql.y" + case 190: /* cmd ::= DROP TABLE with_opt multi_drop_clause */ { pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[-1].minor.yy569, yymsp[0].minor.yy946); } -#line 7042 "sql.c" break; - case 190: /* cmd ::= DROP STABLE with_opt exists_opt full_table_name */ -#line 367 "sql.y" + case 191: /* cmd ::= DROP STABLE with_opt exists_opt full_table_name */ { pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-2].minor.yy569, yymsp[-1].minor.yy569, yymsp[0].minor.yy974); } -#line 7047 "sql.c" break; - case 191: /* cmd ::= ALTER TABLE alter_table_clause */ - case 454: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==454); - case 455: /* cmd ::= insert_query */ yytestcase(yyruleno==455); -#line 369 "sql.y" + case 192: /* cmd ::= ALTER TABLE alter_table_clause */ + case 455: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==455); + case 456: /* cmd ::= insert_query */ yytestcase(yyruleno==456); { pCxt->pRootNode = yymsp[0].minor.yy974; } -#line 7054 "sql.c" break; - case 192: /* cmd ::= ALTER STABLE alter_table_clause */ -#line 370 "sql.y" + case 193: /* cmd ::= ALTER STABLE alter_table_clause */ { pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy974); } -#line 7059 "sql.c" break; - case 193: /* alter_table_clause ::= full_table_name alter_table_options */ -#line 372 "sql.y" + case 194: /* alter_table_clause ::= full_table_name alter_table_options */ { yylhsminor.yy974 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy974, yymsp[0].minor.yy974); } -#line 7064 "sql.c" yymsp[-1].minor.yy974 = yylhsminor.yy974; break; - case 194: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name column_options */ -#line 374 "sql.y" + case 195: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name column_options */ { yylhsminor.yy974 = createAlterTableAddModifyColOptions2(pCxt, yymsp[-5].minor.yy974, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-2].minor.yy557, yymsp[-1].minor.yy424, yymsp[0].minor.yy974); } -#line 7070 "sql.c" yymsp[-5].minor.yy974 = yylhsminor.yy974; break; - case 195: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ -#line 375 "sql.y" + case 196: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ { yylhsminor.yy974 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy974, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy557); } -#line 7076 "sql.c" yymsp[-3].minor.yy974 = yylhsminor.yy974; break; - case 196: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ -#line 377 "sql.y" + case 197: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ { yylhsminor.yy974 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy974, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy557, yymsp[0].minor.yy424); } -#line 7082 "sql.c" yymsp[-4].minor.yy974 = yylhsminor.yy974; break; - case 197: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name column_options */ -#line 379 "sql.y" + case 198: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name column_options */ { yylhsminor.yy974 = createAlterTableAddModifyColOptions(pCxt, yymsp[-4].minor.yy974, TSDB_ALTER_TABLE_UPDATE_COLUMN_COMPRESS, &yymsp[-1].minor.yy557, yymsp[0].minor.yy974); } -#line 7088 "sql.c" yymsp[-4].minor.yy974 = yylhsminor.yy974; break; - case 198: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ -#line 381 "sql.y" + case 199: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ { yylhsminor.yy974 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy974, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy557, &yymsp[0].minor.yy557); } -#line 7094 "sql.c" yymsp[-4].minor.yy974 = yylhsminor.yy974; break; - case 199: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ -#line 383 "sql.y" + case 200: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ { yylhsminor.yy974 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy974, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy557, yymsp[0].minor.yy424); } -#line 7100 "sql.c" yymsp[-4].minor.yy974 = yylhsminor.yy974; break; - case 200: /* alter_table_clause ::= full_table_name DROP TAG column_name */ -#line 384 "sql.y" + case 201: /* alter_table_clause ::= full_table_name DROP TAG column_name */ { yylhsminor.yy974 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy974, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy557); } -#line 7106 "sql.c" yymsp[-3].minor.yy974 = yylhsminor.yy974; break; - case 201: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ -#line 386 "sql.y" + case 202: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ { yylhsminor.yy974 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy974, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy557, yymsp[0].minor.yy424); } -#line 7112 "sql.c" yymsp[-4].minor.yy974 = yylhsminor.yy974; break; - case 202: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ -#line 388 "sql.y" + case 203: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ { yylhsminor.yy974 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy974, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy557, &yymsp[0].minor.yy557); } -#line 7118 "sql.c" yymsp[-4].minor.yy974 = yylhsminor.yy974; break; - case 203: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ tags_literal */ -#line 390 "sql.y" + case 204: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ tags_literal */ { yylhsminor.yy974 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy974, &yymsp[-2].minor.yy557, yymsp[0].minor.yy974); } -#line 7124 "sql.c" yymsp[-5].minor.yy974 = yylhsminor.yy974; break; - case 205: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ - case 623: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==623); -#line 395 "sql.y" + case 206: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ + case 624: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==624); { yylhsminor.yy946 = addNodeToList(pCxt, yymsp[-1].minor.yy946, yymsp[0].minor.yy974); } -#line 7131 "sql.c" yymsp[-1].minor.yy946 = yylhsminor.yy946; break; - case 206: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP tags_literal_list NK_RP table_options */ -#line 399 "sql.y" + case 207: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP tags_literal_list NK_RP table_options */ { yylhsminor.yy974 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy569, yymsp[-8].minor.yy974, yymsp[-6].minor.yy974, yymsp[-5].minor.yy946, yymsp[-2].minor.yy946, yymsp[0].minor.yy974); } -#line 7137 "sql.c" yymsp[-9].minor.yy974 = yylhsminor.yy974; break; - case 209: /* drop_table_clause ::= exists_opt full_table_name */ -#line 406 "sql.y" + case 210: /* drop_table_clause ::= exists_opt full_table_name */ { yylhsminor.yy974 = createDropTableClause(pCxt, yymsp[-1].minor.yy569, yymsp[0].minor.yy974); } -#line 7143 "sql.c" yymsp[-1].minor.yy974 = yylhsminor.yy974; break; - case 213: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */ - case 417: /* col_list_opt ::= NK_LP column_stream_def_list NK_RP */ yytestcase(yyruleno==417); -#line 416 "sql.y" + case 214: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */ + case 418: /* col_list_opt ::= NK_LP column_stream_def_list NK_RP */ yytestcase(yyruleno==418); { yymsp[-2].minor.yy946 = yymsp[-1].minor.yy946; } -#line 7150 "sql.c" break; - case 214: /* full_table_name ::= table_name */ - case 358: /* full_tsma_name ::= tsma_name */ yytestcase(yyruleno==358); -#line 418 "sql.y" + case 215: /* full_table_name ::= table_name */ + case 359: /* full_tsma_name ::= tsma_name */ yytestcase(yyruleno==359); { yylhsminor.yy974 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy557, NULL); } -#line 7156 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; - case 215: /* full_table_name ::= db_name NK_DOT table_name */ - case 359: /* full_tsma_name ::= db_name NK_DOT tsma_name */ yytestcase(yyruleno==359); -#line 419 "sql.y" + case 216: /* full_table_name ::= db_name NK_DOT table_name */ + case 360: /* full_tsma_name ::= db_name NK_DOT tsma_name */ yytestcase(yyruleno==360); { yylhsminor.yy974 = createRealTableNode(pCxt, &yymsp[-2].minor.yy557, &yymsp[0].minor.yy557, NULL); } -#line 7163 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; - case 218: /* tag_def ::= column_name type_name */ -#line 425 "sql.y" + case 219: /* tag_def ::= column_name type_name */ { yylhsminor.yy974 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy557, yymsp[0].minor.yy424, NULL); } -#line 7169 "sql.c" yymsp[-1].minor.yy974 = yylhsminor.yy974; break; - case 221: /* column_def ::= column_name type_name column_options */ -#line 433 "sql.y" + case 222: /* column_def ::= column_name type_name column_options */ { yylhsminor.yy974 = createColumnDefNode(pCxt, &yymsp[-2].minor.yy557, yymsp[-1].minor.yy424, yymsp[0].minor.yy974); } -#line 7175 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; - case 222: /* type_name ::= BOOL */ -#line 437 "sql.y" + case 223: /* type_name ::= BOOL */ { yymsp[0].minor.yy424 = createDataType(TSDB_DATA_TYPE_BOOL); } -#line 7181 "sql.c" break; - case 223: /* type_name ::= TINYINT */ -#line 438 "sql.y" + case 224: /* type_name ::= TINYINT */ { yymsp[0].minor.yy424 = createDataType(TSDB_DATA_TYPE_TINYINT); } -#line 7186 "sql.c" break; - case 224: /* type_name ::= SMALLINT */ -#line 439 "sql.y" + case 225: /* type_name ::= SMALLINT */ { yymsp[0].minor.yy424 = createDataType(TSDB_DATA_TYPE_SMALLINT); } -#line 7191 "sql.c" break; - case 225: /* type_name ::= INT */ - case 226: /* type_name ::= INTEGER */ yytestcase(yyruleno==226); -#line 440 "sql.y" + case 226: /* type_name ::= INT */ + case 227: /* type_name ::= INTEGER */ yytestcase(yyruleno==227); { yymsp[0].minor.yy424 = createDataType(TSDB_DATA_TYPE_INT); } -#line 7197 "sql.c" break; - case 227: /* type_name ::= BIGINT */ -#line 442 "sql.y" + case 228: /* type_name ::= BIGINT */ { yymsp[0].minor.yy424 = createDataType(TSDB_DATA_TYPE_BIGINT); } -#line 7202 "sql.c" break; - case 228: /* type_name ::= FLOAT */ -#line 443 "sql.y" + case 229: /* type_name ::= FLOAT */ { yymsp[0].minor.yy424 = createDataType(TSDB_DATA_TYPE_FLOAT); } -#line 7207 "sql.c" break; - case 229: /* type_name ::= DOUBLE */ -#line 444 "sql.y" + case 230: /* type_name ::= DOUBLE */ { yymsp[0].minor.yy424 = createDataType(TSDB_DATA_TYPE_DOUBLE); } -#line 7212 "sql.c" break; - case 230: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ -#line 445 "sql.y" + case 231: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ { yymsp[-3].minor.yy424 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } -#line 7217 "sql.c" break; - case 231: /* type_name ::= TIMESTAMP */ -#line 446 "sql.y" + case 232: /* type_name ::= TIMESTAMP */ { yymsp[0].minor.yy424 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } -#line 7222 "sql.c" break; - case 232: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ -#line 447 "sql.y" + case 233: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ { yymsp[-3].minor.yy424 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } -#line 7227 "sql.c" break; - case 233: /* type_name ::= TINYINT UNSIGNED */ -#line 448 "sql.y" + case 234: /* type_name ::= TINYINT UNSIGNED */ { yymsp[-1].minor.yy424 = createDataType(TSDB_DATA_TYPE_UTINYINT); } -#line 7232 "sql.c" break; - case 234: /* type_name ::= SMALLINT UNSIGNED */ -#line 449 "sql.y" + case 235: /* type_name ::= SMALLINT UNSIGNED */ { yymsp[-1].minor.yy424 = createDataType(TSDB_DATA_TYPE_USMALLINT); } -#line 7237 "sql.c" break; - case 235: /* type_name ::= INT UNSIGNED */ -#line 450 "sql.y" + case 236: /* type_name ::= INT UNSIGNED */ { yymsp[-1].minor.yy424 = createDataType(TSDB_DATA_TYPE_UINT); } -#line 7242 "sql.c" break; - case 236: /* type_name ::= BIGINT UNSIGNED */ -#line 451 "sql.y" + case 237: /* type_name ::= BIGINT UNSIGNED */ { yymsp[-1].minor.yy424 = createDataType(TSDB_DATA_TYPE_UBIGINT); } -#line 7247 "sql.c" break; - case 237: /* type_name ::= JSON */ -#line 452 "sql.y" + case 238: /* type_name ::= JSON */ { yymsp[0].minor.yy424 = createDataType(TSDB_DATA_TYPE_JSON); } -#line 7252 "sql.c" break; - case 238: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ -#line 453 "sql.y" + case 239: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ { yymsp[-3].minor.yy424 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } -#line 7257 "sql.c" break; - case 239: /* type_name ::= MEDIUMBLOB */ -#line 454 "sql.y" + case 240: /* type_name ::= MEDIUMBLOB */ { yymsp[0].minor.yy424 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } -#line 7262 "sql.c" break; - case 240: /* type_name ::= BLOB */ -#line 455 "sql.y" + case 241: /* type_name ::= BLOB */ { yymsp[0].minor.yy424 = createDataType(TSDB_DATA_TYPE_BLOB); } -#line 7267 "sql.c" break; - case 241: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ -#line 456 "sql.y" + case 242: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ { yymsp[-3].minor.yy424 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } -#line 7272 "sql.c" break; - case 242: /* type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ -#line 457 "sql.y" + case 243: /* type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ { yymsp[-3].minor.yy424 = createVarLenDataType(TSDB_DATA_TYPE_GEOMETRY, &yymsp[-1].minor.yy0); } -#line 7277 "sql.c" break; - case 243: /* type_name ::= DECIMAL */ -#line 458 "sql.y" + case 244: /* type_name ::= DECIMAL */ { yymsp[0].minor.yy424 = createDataType(TSDB_DATA_TYPE_DECIMAL); } -#line 7282 "sql.c" break; - case 244: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ -#line 459 "sql.y" + case 245: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ { yymsp[-3].minor.yy424 = createDataType(TSDB_DATA_TYPE_DECIMAL); } -#line 7287 "sql.c" break; - case 245: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ -#line 460 "sql.y" + case 246: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ { yymsp[-5].minor.yy424 = createDataType(TSDB_DATA_TYPE_DECIMAL); } -#line 7292 "sql.c" break; - case 246: /* type_name_default_len ::= BINARY */ -#line 464 "sql.y" + case 247: /* type_name_default_len ::= BINARY */ { yymsp[0].minor.yy424 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, NULL); } -#line 7297 "sql.c" break; - case 247: /* type_name_default_len ::= NCHAR */ -#line 465 "sql.y" + case 248: /* type_name_default_len ::= NCHAR */ { yymsp[0].minor.yy424 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, NULL); } -#line 7302 "sql.c" break; - case 248: /* type_name_default_len ::= VARCHAR */ -#line 466 "sql.y" + case 249: /* type_name_default_len ::= VARCHAR */ { yymsp[0].minor.yy424 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, NULL); } -#line 7307 "sql.c" break; - case 249: /* type_name_default_len ::= VARBINARY */ -#line 467 "sql.y" + case 250: /* type_name_default_len ::= VARBINARY */ { yymsp[0].minor.yy424 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, NULL); } -#line 7312 "sql.c" break; - case 252: /* tags_def ::= TAGS NK_LP tag_def_list NK_RP */ - case 425: /* tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP */ yytestcase(yyruleno==425); -#line 476 "sql.y" + case 253: /* tags_def ::= TAGS NK_LP tag_def_list NK_RP */ + case 426: /* tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP */ yytestcase(yyruleno==426); { yymsp[-3].minor.yy946 = yymsp[-1].minor.yy946; } -#line 7318 "sql.c" break; - case 253: /* table_options ::= */ -#line 478 "sql.y" + case 254: /* table_options ::= */ { yymsp[1].minor.yy974 = createDefaultTableOptions(pCxt); } -#line 7323 "sql.c" break; - case 254: /* table_options ::= table_options COMMENT NK_STRING */ -#line 479 "sql.y" + case 255: /* table_options ::= table_options COMMENT NK_STRING */ { yylhsminor.yy974 = setTableOption(pCxt, yymsp[-2].minor.yy974, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } -#line 7328 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; - case 255: /* table_options ::= table_options MAX_DELAY duration_list */ -#line 480 "sql.y" + case 256: /* table_options ::= table_options MAX_DELAY duration_list */ { yylhsminor.yy974 = setTableOption(pCxt, yymsp[-2].minor.yy974, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy946); } -#line 7334 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; - case 256: /* table_options ::= table_options WATERMARK duration_list */ -#line 481 "sql.y" + case 257: /* table_options ::= table_options WATERMARK duration_list */ { yylhsminor.yy974 = setTableOption(pCxt, yymsp[-2].minor.yy974, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy946); } -#line 7340 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; - case 257: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ -#line 482 "sql.y" + case 258: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ { yylhsminor.yy974 = setTableOption(pCxt, yymsp[-4].minor.yy974, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy946); } -#line 7346 "sql.c" yymsp[-4].minor.yy974 = yylhsminor.yy974; break; - case 258: /* table_options ::= table_options TTL NK_INTEGER */ -#line 483 "sql.y" + case 259: /* table_options ::= table_options TTL NK_INTEGER */ { yylhsminor.yy974 = setTableOption(pCxt, yymsp[-2].minor.yy974, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } -#line 7352 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; - case 259: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ -#line 484 "sql.y" + case 260: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ { yylhsminor.yy974 = setTableOption(pCxt, yymsp[-4].minor.yy974, TABLE_OPTION_SMA, yymsp[-1].minor.yy946); } -#line 7358 "sql.c" yymsp[-4].minor.yy974 = yylhsminor.yy974; break; - case 260: /* table_options ::= table_options DELETE_MARK duration_list */ -#line 485 "sql.y" + case 261: /* table_options ::= table_options DELETE_MARK duration_list */ { yylhsminor.yy974 = setTableOption(pCxt, yymsp[-2].minor.yy974, TABLE_OPTION_DELETE_MARK, yymsp[0].minor.yy946); } -#line 7364 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; - case 261: /* alter_table_options ::= alter_table_option */ -#line 487 "sql.y" + case 262: /* alter_table_options ::= alter_table_option */ { yylhsminor.yy974 = createAlterTableOptions(pCxt); yylhsminor.yy974 = setTableOption(pCxt, yylhsminor.yy974, yymsp[0].minor.yy683.type, &yymsp[0].minor.yy683.val); } -#line 7370 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; - case 262: /* alter_table_options ::= alter_table_options alter_table_option */ -#line 488 "sql.y" + case 263: /* alter_table_options ::= alter_table_options alter_table_option */ { yylhsminor.yy974 = setTableOption(pCxt, yymsp[-1].minor.yy974, yymsp[0].minor.yy683.type, &yymsp[0].minor.yy683.val); } -#line 7376 "sql.c" yymsp[-1].minor.yy974 = yylhsminor.yy974; break; - case 263: /* alter_table_option ::= COMMENT NK_STRING */ -#line 492 "sql.y" + case 264: /* alter_table_option ::= COMMENT NK_STRING */ { yymsp[-1].minor.yy683.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; } -#line 7382 "sql.c" break; - case 264: /* alter_table_option ::= TTL NK_INTEGER */ -#line 493 "sql.y" + case 265: /* alter_table_option ::= TTL NK_INTEGER */ { yymsp[-1].minor.yy683.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; } -#line 7387 "sql.c" break; - case 265: /* duration_list ::= duration_literal */ - case 554: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==554); -#line 497 "sql.y" + case 266: /* duration_list ::= duration_literal */ + case 555: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==555); { yylhsminor.yy946 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy974)); } -#line 7393 "sql.c" yymsp[0].minor.yy946 = yylhsminor.yy946; break; - case 266: /* duration_list ::= duration_list NK_COMMA duration_literal */ - case 555: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==555); -#line 498 "sql.y" + case 267: /* duration_list ::= duration_list NK_COMMA duration_literal */ + case 556: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==556); { yylhsminor.yy946 = addNodeToList(pCxt, yymsp[-2].minor.yy946, releaseRawExprNode(pCxt, yymsp[0].minor.yy974)); } -#line 7400 "sql.c" yymsp[-2].minor.yy946 = yylhsminor.yy946; break; - case 269: /* rollup_func_name ::= function_name */ -#line 505 "sql.y" + case 270: /* rollup_func_name ::= function_name */ { yylhsminor.yy974 = createFunctionNode(pCxt, &yymsp[0].minor.yy557, NULL); } -#line 7406 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; - case 270: /* rollup_func_name ::= FIRST */ - case 271: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==271); - case 347: /* tag_item ::= QTAGS */ yytestcase(yyruleno==347); -#line 506 "sql.y" + case 271: /* rollup_func_name ::= FIRST */ + case 272: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==272); + case 348: /* tag_item ::= QTAGS */ yytestcase(yyruleno==348); { yylhsminor.yy974 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } -#line 7414 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; - case 274: /* col_name ::= column_name */ - case 348: /* tag_item ::= column_name */ yytestcase(yyruleno==348); -#line 514 "sql.y" + case 275: /* col_name ::= column_name */ + case 349: /* tag_item ::= column_name */ yytestcase(yyruleno==349); { yylhsminor.yy974 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy557); } -#line 7421 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; - case 275: /* cmd ::= SHOW DNODES */ -#line 517 "sql.y" + case 276: /* cmd ::= SHOW DNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT); } -#line 7427 "sql.c" break; - case 276: /* cmd ::= SHOW USERS */ -#line 518 "sql.y" + case 277: /* cmd ::= SHOW USERS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USERS_STMT); } -#line 7432 "sql.c" break; - case 277: /* cmd ::= SHOW USERS FULL */ -#line 519 "sql.y" + case 278: /* cmd ::= SHOW USERS FULL */ { pCxt->pRootNode = createShowStmtWithFull(pCxt, QUERY_NODE_SHOW_USERS_FULL_STMT); } -#line 7437 "sql.c" break; - case 278: /* cmd ::= SHOW USER PRIVILEGES */ -#line 520 "sql.y" + case 279: /* cmd ::= SHOW USER PRIVILEGES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USER_PRIVILEGES_STMT); } -#line 7442 "sql.c" break; - case 279: /* cmd ::= SHOW db_kind_opt DATABASES */ -#line 521 "sql.y" + case 280: /* cmd ::= SHOW db_kind_opt DATABASES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT); (void)setShowKind(pCxt, pCxt->pRootNode, yymsp[-1].minor.yy741); } -#line 7450 "sql.c" break; - case 280: /* cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */ -#line 525 "sql.y" + case 281: /* cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */ { pCxt->pRootNode = createShowTablesStmt(pCxt, yymsp[-2].minor.yy595, yymsp[0].minor.yy974, OP_TYPE_LIKE); } -#line 7457 "sql.c" break; - case 281: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ -#line 528 "sql.y" + case 282: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy974, yymsp[0].minor.yy974, OP_TYPE_LIKE); } -#line 7462 "sql.c" break; - case 282: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ -#line 529 "sql.y" + case 283: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy974, NULL, OP_TYPE_LIKE); } -#line 7467 "sql.c" break; - case 283: /* cmd ::= SHOW MNODES */ -#line 530 "sql.y" + case 284: /* cmd ::= SHOW MNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT); } -#line 7472 "sql.c" break; - case 284: /* cmd ::= SHOW QNODES */ -#line 532 "sql.y" + case 285: /* cmd ::= SHOW QNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QNODES_STMT); } -#line 7477 "sql.c" break; - case 285: /* cmd ::= SHOW ANODES */ -#line 533 "sql.y" + case 286: /* cmd ::= SHOW ANODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_ANODES_STMT); } -#line 7482 "sql.c" break; - case 286: /* cmd ::= SHOW ANODES FULL */ -#line 534 "sql.y" + case 287: /* cmd ::= SHOW ANODES FULL */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_ANODES_FULL_STMT); } -#line 7487 "sql.c" break; - case 287: /* cmd ::= SHOW ARBGROUPS */ -#line 535 "sql.y" + case 288: /* cmd ::= SHOW ARBGROUPS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_ARBGROUPS_STMT); } -#line 7492 "sql.c" break; - case 288: /* cmd ::= SHOW FUNCTIONS */ -#line 536 "sql.y" + case 289: /* cmd ::= SHOW FUNCTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT); } -#line 7497 "sql.c" break; - case 289: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ -#line 537 "sql.y" + case 290: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy974, yymsp[-1].minor.yy974, OP_TYPE_EQUAL); } -#line 7502 "sql.c" break; - case 290: /* cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ -#line 538 "sql.y" + case 291: /* cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy557), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy557), OP_TYPE_EQUAL); } -#line 7507 "sql.c" break; - case 291: /* cmd ::= SHOW STREAMS */ -#line 539 "sql.y" + case 292: /* cmd ::= SHOW STREAMS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT); } -#line 7512 "sql.c" break; - case 292: /* cmd ::= SHOW ACCOUNTS */ -#line 540 "sql.y" + case 293: /* cmd ::= SHOW ACCOUNTS */ { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } -#line 7517 "sql.c" break; - case 293: /* cmd ::= SHOW APPS */ -#line 541 "sql.y" + case 294: /* cmd ::= SHOW APPS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_APPS_STMT); } -#line 7522 "sql.c" break; - case 294: /* cmd ::= SHOW CONNECTIONS */ -#line 542 "sql.y" + case 295: /* cmd ::= SHOW CONNECTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONNECTIONS_STMT); } -#line 7527 "sql.c" break; - case 295: /* cmd ::= SHOW LICENCES */ - case 296: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==296); -#line 543 "sql.y" + case 296: /* cmd ::= SHOW LICENCES */ + case 297: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==297); { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LICENCES_STMT); } -#line 7533 "sql.c" break; - case 297: /* cmd ::= SHOW GRANTS FULL */ -#line 545 "sql.y" + case 298: /* cmd ::= SHOW GRANTS FULL */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_GRANTS_FULL_STMT); } -#line 7538 "sql.c" break; - case 298: /* cmd ::= SHOW GRANTS LOGS */ -#line 546 "sql.y" + case 299: /* cmd ::= SHOW GRANTS LOGS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_GRANTS_LOGS_STMT); } -#line 7543 "sql.c" break; - case 299: /* cmd ::= SHOW CLUSTER MACHINES */ -#line 547 "sql.y" + case 300: /* cmd ::= SHOW CLUSTER MACHINES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_MACHINES_STMT); } -#line 7548 "sql.c" break; - case 300: /* cmd ::= SHOW CREATE DATABASE db_name */ -#line 548 "sql.y" + case 301: /* cmd ::= SHOW CREATE DATABASE db_name */ { pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy557); } -#line 7553 "sql.c" break; - case 301: /* cmd ::= SHOW CREATE TABLE full_table_name */ -#line 549 "sql.y" + case 302: /* cmd ::= SHOW CREATE TABLE full_table_name */ { pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy974); } -#line 7558 "sql.c" break; - case 302: /* cmd ::= SHOW CREATE STABLE full_table_name */ -#line 550 "sql.y" + case 303: /* cmd ::= SHOW CREATE STABLE full_table_name */ { pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy974); } -#line 7564 "sql.c" break; - case 303: /* cmd ::= SHOW ENCRYPTIONS */ -#line 552 "sql.y" + case 304: /* cmd ::= SHOW ENCRYPTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_ENCRYPTIONS_STMT); } -#line 7569 "sql.c" break; - case 304: /* cmd ::= SHOW QUERIES */ -#line 553 "sql.y" + case 305: /* cmd ::= SHOW QUERIES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT); } -#line 7574 "sql.c" break; - case 305: /* cmd ::= SHOW SCORES */ -#line 554 "sql.y" + case 306: /* cmd ::= SHOW SCORES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SCORES_STMT); } -#line 7579 "sql.c" break; - case 306: /* cmd ::= SHOW TOPICS */ -#line 555 "sql.y" + case 307: /* cmd ::= SHOW TOPICS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TOPICS_STMT); } -#line 7584 "sql.c" break; - case 307: /* cmd ::= SHOW VARIABLES */ - case 308: /* cmd ::= SHOW CLUSTER VARIABLES */ yytestcase(yyruleno==308); -#line 556 "sql.y" + case 308: /* cmd ::= SHOW VARIABLES */ + case 309: /* cmd ::= SHOW CLUSTER VARIABLES */ yytestcase(yyruleno==309); { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VARIABLES_STMT); } -#line 7590 "sql.c" break; - case 309: /* cmd ::= SHOW LOCAL VARIABLES */ -#line 558 "sql.y" + case 310: /* cmd ::= SHOW LOCAL VARIABLES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT); } -#line 7595 "sql.c" break; - case 310: /* cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ -#line 559 "sql.y" + case 311: /* cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ { pCxt->pRootNode = createShowDnodeVariablesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[-2].minor.yy0), yymsp[0].minor.yy974); } -#line 7600 "sql.c" break; - case 311: /* cmd ::= SHOW BNODES */ -#line 560 "sql.y" + case 312: /* cmd ::= SHOW BNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_BNODES_STMT); } -#line 7605 "sql.c" break; - case 312: /* cmd ::= SHOW SNODES */ -#line 561 "sql.y" + case 313: /* cmd ::= SHOW SNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SNODES_STMT); } -#line 7610 "sql.c" break; - case 313: /* cmd ::= SHOW CLUSTER */ -#line 562 "sql.y" + case 314: /* cmd ::= SHOW CLUSTER */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_STMT); } -#line 7615 "sql.c" break; - case 314: /* cmd ::= SHOW TRANSACTIONS */ -#line 563 "sql.y" + case 315: /* cmd ::= SHOW TRANSACTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TRANSACTIONS_STMT); } -#line 7620 "sql.c" break; - case 315: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ -#line 564 "sql.y" + case 316: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ { pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy974); } -#line 7625 "sql.c" break; - case 316: /* cmd ::= SHOW CONSUMERS */ -#line 565 "sql.y" + case 317: /* cmd ::= SHOW CONSUMERS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONSUMERS_STMT); } -#line 7630 "sql.c" break; - case 317: /* cmd ::= SHOW SUBSCRIPTIONS */ -#line 566 "sql.y" + case 318: /* cmd ::= SHOW SUBSCRIPTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT); } -#line 7635 "sql.c" break; - case 318: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ -#line 567 "sql.y" + case 319: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy974, yymsp[-1].minor.yy974, OP_TYPE_EQUAL); } -#line 7640 "sql.c" break; - case 319: /* cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ -#line 568 "sql.y" + case 320: /* cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy557), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy557), OP_TYPE_EQUAL); } -#line 7645 "sql.c" break; - case 320: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ -#line 569 "sql.y" + case 321: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ { pCxt->pRootNode = createShowTableTagsStmt(pCxt, yymsp[-1].minor.yy974, yymsp[0].minor.yy974, yymsp[-3].minor.yy946); } -#line 7650 "sql.c" break; - case 321: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ -#line 570 "sql.y" + case 322: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ { pCxt->pRootNode = createShowTableTagsStmt(pCxt, createIdentifierValueNode(pCxt, &yymsp[0].minor.yy557), createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy557), yymsp[-4].minor.yy946); } -#line 7655 "sql.c" break; - case 322: /* cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ -#line 571 "sql.y" + case 323: /* cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ { pCxt->pRootNode = createShowVnodesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0), NULL); } -#line 7660 "sql.c" break; - case 323: /* cmd ::= SHOW VNODES */ -#line 572 "sql.y" + case 324: /* cmd ::= SHOW VNODES */ { pCxt->pRootNode = createShowVnodesStmt(pCxt, NULL, NULL); } -#line 7665 "sql.c" break; - case 324: /* cmd ::= SHOW db_name_cond_opt ALIVE */ -#line 574 "sql.y" + case 325: /* cmd ::= SHOW db_name_cond_opt ALIVE */ { pCxt->pRootNode = createShowAliveStmt(pCxt, yymsp[-1].minor.yy974, QUERY_NODE_SHOW_DB_ALIVE_STMT); } -#line 7670 "sql.c" break; - case 325: /* cmd ::= SHOW CLUSTER ALIVE */ -#line 575 "sql.y" + case 326: /* cmd ::= SHOW CLUSTER ALIVE */ { pCxt->pRootNode = createShowAliveStmt(pCxt, NULL, QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT); } -#line 7675 "sql.c" break; - case 326: /* cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt */ -#line 576 "sql.y" + case 327: /* cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt */ { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VIEWS_STMT, yymsp[-2].minor.yy974, yymsp[0].minor.yy974, OP_TYPE_LIKE); } -#line 7680 "sql.c" break; - case 327: /* cmd ::= SHOW CREATE VIEW full_table_name */ -#line 577 "sql.y" + case 328: /* cmd ::= SHOW CREATE VIEW full_table_name */ { pCxt->pRootNode = createShowCreateViewStmt(pCxt, QUERY_NODE_SHOW_CREATE_VIEW_STMT, yymsp[0].minor.yy974); } -#line 7685 "sql.c" break; - case 328: /* cmd ::= SHOW COMPACTS */ -#line 578 "sql.y" + case 329: /* cmd ::= SHOW COMPACTS */ { pCxt->pRootNode = createShowCompactsStmt(pCxt, QUERY_NODE_SHOW_COMPACTS_STMT); } -#line 7690 "sql.c" break; - case 329: /* cmd ::= SHOW COMPACT NK_INTEGER */ -#line 579 "sql.y" + case 330: /* cmd ::= SHOW COMPACT NK_INTEGER */ { pCxt->pRootNode = createShowCompactDetailsStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } -#line 7695 "sql.c" break; - case 330: /* table_kind_db_name_cond_opt ::= */ -#line 583 "sql.y" + case 331: /* table_kind_db_name_cond_opt ::= */ { yymsp[1].minor.yy595.kind = SHOW_KIND_ALL; yymsp[1].minor.yy595.dbName = nil_token; } -#line 7700 "sql.c" break; - case 331: /* table_kind_db_name_cond_opt ::= table_kind */ -#line 584 "sql.y" + case 332: /* table_kind_db_name_cond_opt ::= table_kind */ { yylhsminor.yy595.kind = yymsp[0].minor.yy741; yylhsminor.yy595.dbName = nil_token; } -#line 7705 "sql.c" yymsp[0].minor.yy595 = yylhsminor.yy595; break; - case 332: /* table_kind_db_name_cond_opt ::= db_name NK_DOT */ -#line 585 "sql.y" + case 333: /* table_kind_db_name_cond_opt ::= db_name NK_DOT */ { yylhsminor.yy595.kind = SHOW_KIND_ALL; yylhsminor.yy595.dbName = yymsp[-1].minor.yy557; } -#line 7711 "sql.c" yymsp[-1].minor.yy595 = yylhsminor.yy595; break; - case 333: /* table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */ -#line 586 "sql.y" + case 334: /* table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */ { yylhsminor.yy595.kind = yymsp[-2].minor.yy741; yylhsminor.yy595.dbName = yymsp[-1].minor.yy557; } -#line 7717 "sql.c" yymsp[-2].minor.yy595 = yylhsminor.yy595; break; - case 334: /* table_kind ::= NORMAL */ -#line 590 "sql.y" + case 335: /* table_kind ::= NORMAL */ { yymsp[0].minor.yy741 = SHOW_KIND_TABLES_NORMAL; } -#line 7723 "sql.c" break; - case 335: /* table_kind ::= CHILD */ -#line 591 "sql.y" + case 336: /* table_kind ::= CHILD */ { yymsp[0].minor.yy741 = SHOW_KIND_TABLES_CHILD; } -#line 7728 "sql.c" break; - case 336: /* db_name_cond_opt ::= */ - case 341: /* from_db_opt ::= */ yytestcase(yyruleno==341); -#line 593 "sql.y" + case 337: /* db_name_cond_opt ::= */ + case 342: /* from_db_opt ::= */ yytestcase(yyruleno==342); { yymsp[1].minor.yy974 = createDefaultDatabaseCondValue(pCxt); } -#line 7734 "sql.c" break; - case 337: /* db_name_cond_opt ::= db_name NK_DOT */ -#line 594 "sql.y" + case 338: /* db_name_cond_opt ::= db_name NK_DOT */ { yylhsminor.yy974 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy557); } -#line 7739 "sql.c" yymsp[-1].minor.yy974 = yylhsminor.yy974; break; - case 339: /* like_pattern_opt ::= LIKE NK_STRING */ -#line 597 "sql.y" + case 340: /* like_pattern_opt ::= LIKE NK_STRING */ { yymsp[-1].minor.yy974 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } -#line 7745 "sql.c" break; - case 340: /* table_name_cond ::= table_name */ -#line 599 "sql.y" + case 341: /* table_name_cond ::= table_name */ { yylhsminor.yy974 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy557); } -#line 7750 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; - case 342: /* from_db_opt ::= FROM db_name */ -#line 602 "sql.y" + case 343: /* from_db_opt ::= FROM db_name */ { yymsp[-1].minor.yy974 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy557); } -#line 7756 "sql.c" break; - case 346: /* tag_item ::= TBNAME */ -#line 610 "sql.y" + case 347: /* tag_item ::= TBNAME */ { yylhsminor.yy974 = setProjectionAlias(pCxt, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL), &yymsp[0].minor.yy0); } -#line 7761 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; - case 349: /* tag_item ::= column_name column_alias */ -#line 613 "sql.y" + case 350: /* tag_item ::= column_name column_alias */ { yylhsminor.yy974 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy557), &yymsp[0].minor.yy557); } -#line 7767 "sql.c" yymsp[-1].minor.yy974 = yylhsminor.yy974; break; - case 350: /* tag_item ::= column_name AS column_alias */ -#line 614 "sql.y" + case 351: /* tag_item ::= column_name AS column_alias */ { yylhsminor.yy974 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-2].minor.yy557), &yymsp[0].minor.yy557); } -#line 7773 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; - case 351: /* db_kind_opt ::= */ -#line 618 "sql.y" + case 352: /* db_kind_opt ::= */ { yymsp[1].minor.yy741 = SHOW_KIND_ALL; } -#line 7779 "sql.c" break; - case 352: /* db_kind_opt ::= USER */ -#line 619 "sql.y" + case 353: /* db_kind_opt ::= USER */ { yymsp[0].minor.yy741 = SHOW_KIND_DATABASES_USER; } -#line 7784 "sql.c" break; - case 353: /* db_kind_opt ::= SYSTEM */ -#line 620 "sql.y" + case 354: /* db_kind_opt ::= SYSTEM */ { yymsp[0].minor.yy741 = SHOW_KIND_DATABASES_SYSTEM; } -#line 7789 "sql.c" break; - case 354: /* cmd ::= CREATE TSMA not_exists_opt tsma_name ON full_table_name tsma_func_list INTERVAL NK_LP duration_literal NK_RP */ -#line 626 "sql.y" + case 355: /* cmd ::= CREATE TSMA not_exists_opt tsma_name ON full_table_name tsma_func_list INTERVAL NK_LP duration_literal NK_RP */ { pCxt->pRootNode = createCreateTSMAStmt(pCxt, yymsp[-8].minor.yy569, &yymsp[-7].minor.yy557, yymsp[-4].minor.yy974, yymsp[-5].minor.yy974, releaseRawExprNode(pCxt, yymsp[-1].minor.yy974)); } -#line 7794 "sql.c" break; - case 355: /* cmd ::= CREATE RECURSIVE TSMA not_exists_opt tsma_name ON full_table_name INTERVAL NK_LP duration_literal NK_RP */ -#line 628 "sql.y" + case 356: /* cmd ::= CREATE RECURSIVE TSMA not_exists_opt tsma_name ON full_table_name INTERVAL NK_LP duration_literal NK_RP */ { pCxt->pRootNode = createCreateTSMAStmt(pCxt, yymsp[-7].minor.yy569, &yymsp[-6].minor.yy557, NULL, yymsp[-4].minor.yy974, releaseRawExprNode(pCxt, yymsp[-1].minor.yy974)); } -#line 7799 "sql.c" break; - case 356: /* cmd ::= DROP TSMA exists_opt full_tsma_name */ -#line 629 "sql.y" + case 357: /* cmd ::= DROP TSMA exists_opt full_tsma_name */ { pCxt->pRootNode = createDropTSMAStmt(pCxt, yymsp[-1].minor.yy569, yymsp[0].minor.yy974); } -#line 7804 "sql.c" break; - case 357: /* cmd ::= SHOW db_name_cond_opt TSMAS */ -#line 630 "sql.y" + case 358: /* cmd ::= SHOW db_name_cond_opt TSMAS */ { pCxt->pRootNode = createShowTSMASStmt(pCxt, yymsp[-1].minor.yy974); } -#line 7809 "sql.c" break; - case 360: /* tsma_func_list ::= FUNCTION NK_LP func_list NK_RP */ -#line 637 "sql.y" + case 361: /* tsma_func_list ::= FUNCTION NK_LP func_list NK_RP */ { yymsp[-3].minor.yy974 = createTSMAOptions(pCxt, yymsp[-1].minor.yy946); } -#line 7814 "sql.c" break; - case 361: /* cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */ -#line 641 "sql.y" + case 362: /* cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */ { pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy569, yymsp[-3].minor.yy974, yymsp[-1].minor.yy974, NULL, yymsp[0].minor.yy974); } -#line 7819 "sql.c" break; - case 362: /* cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */ -#line 643 "sql.y" + case 363: /* cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */ { pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_NORMAL, yymsp[-6].minor.yy569, yymsp[-5].minor.yy974, yymsp[-3].minor.yy974, yymsp[-1].minor.yy946, NULL); } -#line 7824 "sql.c" break; - case 363: /* cmd ::= DROP INDEX exists_opt full_index_name */ -#line 644 "sql.y" + case 364: /* cmd ::= DROP INDEX exists_opt full_index_name */ { pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy569, yymsp[0].minor.yy974); } -#line 7829 "sql.c" break; - case 364: /* full_index_name ::= index_name */ -#line 646 "sql.y" + case 365: /* full_index_name ::= index_name */ { yylhsminor.yy974 = createRealTableNodeForIndexName(pCxt, NULL, &yymsp[0].minor.yy557); } -#line 7834 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; - case 365: /* full_index_name ::= db_name NK_DOT index_name */ -#line 647 "sql.y" + case 366: /* full_index_name ::= db_name NK_DOT index_name */ { yylhsminor.yy974 = createRealTableNodeForIndexName(pCxt, &yymsp[-2].minor.yy557, &yymsp[0].minor.yy557); } -#line 7840 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; - case 366: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ -#line 650 "sql.y" + case 367: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ { yymsp[-9].minor.yy974 = createIndexOption(pCxt, yymsp[-7].minor.yy946, releaseRawExprNode(pCxt, yymsp[-3].minor.yy974), NULL, yymsp[-1].minor.yy974, yymsp[0].minor.yy974); } -#line 7846 "sql.c" break; - case 367: /* 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 */ -#line 653 "sql.y" + case 368: /* 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.yy974 = createIndexOption(pCxt, yymsp[-9].minor.yy946, releaseRawExprNode(pCxt, yymsp[-5].minor.yy974), releaseRawExprNode(pCxt, yymsp[-3].minor.yy974), yymsp[-1].minor.yy974, yymsp[0].minor.yy974); } -#line 7851 "sql.c" break; - case 370: /* func ::= sma_func_name NK_LP expression_list NK_RP */ -#line 660 "sql.y" + case 371: /* func ::= sma_func_name NK_LP expression_list NK_RP */ { yylhsminor.yy974 = createFunctionNode(pCxt, &yymsp[-3].minor.yy557, yymsp[-1].minor.yy946); } -#line 7856 "sql.c" yymsp[-3].minor.yy974 = yylhsminor.yy974; break; - case 371: /* sma_func_name ::= function_name */ - case 666: /* alias_opt ::= table_alias */ yytestcase(yyruleno==666); -#line 664 "sql.y" + case 372: /* sma_func_name ::= function_name */ + case 667: /* alias_opt ::= table_alias */ yytestcase(yyruleno==667); { yylhsminor.yy557 = yymsp[0].minor.yy557; } -#line 7863 "sql.c" yymsp[0].minor.yy557 = yylhsminor.yy557; break; - case 376: /* sma_stream_opt ::= */ - case 426: /* stream_options ::= */ yytestcase(yyruleno==426); -#line 670 "sql.y" + case 377: /* sma_stream_opt ::= */ + case 427: /* stream_options ::= */ yytestcase(yyruleno==427); { yymsp[1].minor.yy974 = createStreamOptions(pCxt); } -#line 7870 "sql.c" break; - case 377: /* sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ -#line 671 "sql.y" + case 378: /* sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ { ((SStreamOptions*)yymsp[-2].minor.yy974)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy974); yylhsminor.yy974 = yymsp[-2].minor.yy974; } -#line 7875 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; - case 378: /* sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ -#line 672 "sql.y" + case 379: /* sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ { ((SStreamOptions*)yymsp[-2].minor.yy974)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy974); yylhsminor.yy974 = yymsp[-2].minor.yy974; } -#line 7881 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; - case 379: /* sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ -#line 673 "sql.y" + case 380: /* sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ { ((SStreamOptions*)yymsp[-2].minor.yy974)->pDeleteMark = releaseRawExprNode(pCxt, yymsp[0].minor.yy974); yylhsminor.yy974 = yymsp[-2].minor.yy974; } -#line 7887 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; - case 380: /* with_meta ::= AS */ -#line 678 "sql.y" + case 381: /* with_meta ::= AS */ { yymsp[0].minor.yy904 = 0; } -#line 7893 "sql.c" break; - case 381: /* with_meta ::= WITH META AS */ -#line 679 "sql.y" + case 382: /* with_meta ::= WITH META AS */ { yymsp[-2].minor.yy904 = 1; } -#line 7898 "sql.c" break; - case 382: /* with_meta ::= ONLY META AS */ -#line 680 "sql.y" + case 383: /* with_meta ::= ONLY META AS */ { yymsp[-2].minor.yy904 = 2; } -#line 7903 "sql.c" break; - case 383: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ -#line 682 "sql.y" + case 384: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ { pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy569, &yymsp[-2].minor.yy557, yymsp[0].minor.yy974); } -#line 7908 "sql.c" break; - case 384: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ -#line 684 "sql.y" + case 385: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ { pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy569, &yymsp[-3].minor.yy557, &yymsp[0].minor.yy557, yymsp[-2].minor.yy904); } -#line 7913 "sql.c" break; - case 385: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ -#line 686 "sql.y" + case 386: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ { pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-5].minor.yy569, &yymsp[-4].minor.yy557, yymsp[-1].minor.yy974, yymsp[-3].minor.yy904, yymsp[0].minor.yy974); } -#line 7918 "sql.c" break; - case 386: /* cmd ::= DROP TOPIC exists_opt topic_name */ -#line 688 "sql.y" + case 387: /* cmd ::= DROP TOPIC exists_opt topic_name */ { pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy569, &yymsp[0].minor.yy557); } -#line 7923 "sql.c" break; - case 387: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ -#line 689 "sql.y" + case 388: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ { pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy569, &yymsp[-2].minor.yy557, &yymsp[0].minor.yy557); } -#line 7928 "sql.c" break; - case 388: /* cmd ::= DESC full_table_name */ - case 389: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==389); -#line 692 "sql.y" + case 389: /* cmd ::= DESC full_table_name */ + case 390: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==390); { pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy974); } -#line 7934 "sql.c" break; - case 390: /* cmd ::= RESET QUERY CACHE */ -#line 696 "sql.y" + case 391: /* cmd ::= RESET QUERY CACHE */ { pCxt->pRootNode = createResetQueryCacheStmt(pCxt); } -#line 7939 "sql.c" break; - case 391: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ - case 392: /* cmd ::= EXPLAIN analyze_opt explain_options insert_query */ yytestcase(yyruleno==392); -#line 699 "sql.y" + case 392: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ + case 393: /* cmd ::= EXPLAIN analyze_opt explain_options insert_query */ yytestcase(yyruleno==393); { pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy569, yymsp[-1].minor.yy974, yymsp[0].minor.yy974); } -#line 7945 "sql.c" break; - case 395: /* explain_options ::= */ -#line 707 "sql.y" + case 396: /* explain_options ::= */ { yymsp[1].minor.yy974 = createDefaultExplainOptions(pCxt); } -#line 7950 "sql.c" break; - case 396: /* explain_options ::= explain_options VERBOSE NK_BOOL */ -#line 708 "sql.y" + case 397: /* explain_options ::= explain_options VERBOSE NK_BOOL */ { yylhsminor.yy974 = setExplainVerbose(pCxt, yymsp[-2].minor.yy974, &yymsp[0].minor.yy0); } -#line 7955 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; - case 397: /* explain_options ::= explain_options RATIO NK_FLOAT */ -#line 709 "sql.y" + case 398: /* explain_options ::= explain_options RATIO NK_FLOAT */ { yylhsminor.yy974 = setExplainRatio(pCxt, yymsp[-2].minor.yy974, &yymsp[0].minor.yy0); } -#line 7961 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; - case 398: /* cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ -#line 714 "sql.y" + case 399: /* cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ { pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-7].minor.yy569, yymsp[-9].minor.yy569, &yymsp[-6].minor.yy557, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy424, yymsp[-1].minor.yy904, &yymsp[0].minor.yy557, yymsp[-10].minor.yy569); } -#line 7967 "sql.c" break; - case 399: /* cmd ::= DROP FUNCTION exists_opt function_name */ -#line 715 "sql.y" + case 400: /* cmd ::= DROP FUNCTION exists_opt function_name */ { pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy569, &yymsp[0].minor.yy557); } -#line 7972 "sql.c" break; - case 404: /* language_opt ::= */ - case 449: /* on_vgroup_id ::= */ yytestcase(yyruleno==449); -#line 729 "sql.y" + case 405: /* language_opt ::= */ + case 450: /* on_vgroup_id ::= */ yytestcase(yyruleno==450); { yymsp[1].minor.yy557 = nil_token; } -#line 7978 "sql.c" break; - case 405: /* language_opt ::= LANGUAGE NK_STRING */ - case 450: /* on_vgroup_id ::= ON NK_INTEGER */ yytestcase(yyruleno==450); -#line 730 "sql.y" + case 406: /* language_opt ::= LANGUAGE NK_STRING */ + case 451: /* on_vgroup_id ::= ON NK_INTEGER */ yytestcase(yyruleno==451); { yymsp[-1].minor.yy557 = yymsp[0].minor.yy0; } -#line 7984 "sql.c" break; - case 408: /* cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */ -#line 739 "sql.y" + case 409: /* cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */ { pCxt->pRootNode = createCreateViewStmt(pCxt, yymsp[-4].minor.yy569, yymsp[-2].minor.yy974, &yymsp[-1].minor.yy0, yymsp[0].minor.yy974); } -#line 7989 "sql.c" break; - case 409: /* cmd ::= DROP VIEW exists_opt full_view_name */ -#line 740 "sql.y" + case 410: /* cmd ::= DROP VIEW exists_opt full_view_name */ { pCxt->pRootNode = createDropViewStmt(pCxt, yymsp[-1].minor.yy569, yymsp[0].minor.yy974); } -#line 7994 "sql.c" break; - case 410: /* full_view_name ::= view_name */ -#line 742 "sql.y" + case 411: /* full_view_name ::= view_name */ { yylhsminor.yy974 = createViewNode(pCxt, NULL, &yymsp[0].minor.yy557); } -#line 7999 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; - case 411: /* full_view_name ::= db_name NK_DOT view_name */ -#line 743 "sql.y" + case 412: /* full_view_name ::= db_name NK_DOT view_name */ { yylhsminor.yy974 = createViewNode(pCxt, &yymsp[-2].minor.yy557, &yymsp[0].minor.yy557); } -#line 8005 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; - case 412: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */ -#line 748 "sql.y" + case 413: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */ { pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-9].minor.yy569, &yymsp[-8].minor.yy557, yymsp[-5].minor.yy974, yymsp[-7].minor.yy974, yymsp[-3].minor.yy946, yymsp[-2].minor.yy974, yymsp[0].minor.yy974, yymsp[-4].minor.yy946); } -#line 8011 "sql.c" break; - case 413: /* cmd ::= DROP STREAM exists_opt stream_name */ -#line 749 "sql.y" + case 414: /* cmd ::= DROP STREAM exists_opt stream_name */ { pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy569, &yymsp[0].minor.yy557); } -#line 8016 "sql.c" break; - case 414: /* cmd ::= PAUSE STREAM exists_opt stream_name */ -#line 750 "sql.y" + case 415: /* cmd ::= PAUSE STREAM exists_opt stream_name */ { pCxt->pRootNode = createPauseStreamStmt(pCxt, yymsp[-1].minor.yy569, &yymsp[0].minor.yy557); } -#line 8021 "sql.c" break; - case 415: /* cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ -#line 751 "sql.y" + case 416: /* cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ { pCxt->pRootNode = createResumeStreamStmt(pCxt, yymsp[-2].minor.yy569, yymsp[-1].minor.yy569, &yymsp[0].minor.yy557); } -#line 8026 "sql.c" break; - case 420: /* column_stream_def ::= column_name stream_col_options */ -#line 764 "sql.y" + case 421: /* column_stream_def ::= column_name stream_col_options */ { yylhsminor.yy974 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy557, createDataType(TSDB_DATA_TYPE_NULL), yymsp[0].minor.yy974); } -#line 8031 "sql.c" yymsp[-1].minor.yy974 = yylhsminor.yy974; break; - case 421: /* stream_col_options ::= */ - case 781: /* column_options ::= */ yytestcase(yyruleno==781); -#line 765 "sql.y" + case 422: /* stream_col_options ::= */ + case 782: /* column_options ::= */ yytestcase(yyruleno==782); { yymsp[1].minor.yy974 = createDefaultColumnOptions(pCxt); } -#line 8038 "sql.c" break; - case 422: /* stream_col_options ::= stream_col_options PRIMARY KEY */ - case 782: /* column_options ::= column_options PRIMARY KEY */ yytestcase(yyruleno==782); -#line 766 "sql.y" + case 423: /* stream_col_options ::= stream_col_options PRIMARY KEY */ + case 783: /* column_options ::= column_options PRIMARY KEY */ yytestcase(yyruleno==783); { yylhsminor.yy974 = setColumnOptionsPK(pCxt, yymsp[-2].minor.yy974); } -#line 8044 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; - case 427: /* stream_options ::= stream_options TRIGGER AT_ONCE */ - case 428: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ yytestcase(yyruleno==428); -#line 776 "sql.y" + case 428: /* stream_options ::= stream_options TRIGGER AT_ONCE */ + case 429: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ yytestcase(yyruleno==429); { yylhsminor.yy974 = setStreamOptions(pCxt, yymsp[-2].minor.yy974, SOPT_TRIGGER_TYPE_SET, &yymsp[0].minor.yy0, NULL); } -#line 8051 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; - case 429: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ -#line 778 "sql.y" + case 430: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ { yylhsminor.yy974 = setStreamOptions(pCxt, yymsp[-3].minor.yy974, SOPT_TRIGGER_TYPE_SET, &yymsp[-1].minor.yy0, releaseRawExprNode(pCxt, yymsp[0].minor.yy974)); } -#line 8057 "sql.c" yymsp[-3].minor.yy974 = yylhsminor.yy974; break; - case 430: /* stream_options ::= stream_options WATERMARK duration_literal */ -#line 779 "sql.y" + case 431: /* stream_options ::= stream_options WATERMARK duration_literal */ { yylhsminor.yy974 = setStreamOptions(pCxt, yymsp[-2].minor.yy974, SOPT_WATERMARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy974)); } -#line 8063 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; - case 431: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ -#line 780 "sql.y" + case 432: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ { yylhsminor.yy974 = setStreamOptions(pCxt, yymsp[-3].minor.yy974, SOPT_IGNORE_EXPIRED_SET, &yymsp[0].minor.yy0, NULL); } -#line 8069 "sql.c" yymsp[-3].minor.yy974 = yylhsminor.yy974; break; - case 432: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ -#line 781 "sql.y" + case 433: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ { yylhsminor.yy974 = setStreamOptions(pCxt, yymsp[-2].minor.yy974, SOPT_FILL_HISTORY_SET, &yymsp[0].minor.yy0, NULL); } -#line 8075 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; - case 433: /* stream_options ::= stream_options DELETE_MARK duration_literal */ -#line 782 "sql.y" + case 434: /* stream_options ::= stream_options DELETE_MARK duration_literal */ { yylhsminor.yy974 = setStreamOptions(pCxt, yymsp[-2].minor.yy974, SOPT_DELETE_MARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy974)); } -#line 8081 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; - case 434: /* stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ -#line 783 "sql.y" + case 435: /* stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ { yylhsminor.yy974 = setStreamOptions(pCxt, yymsp[-3].minor.yy974, SOPT_IGNORE_UPDATE_SET, &yymsp[0].minor.yy0, NULL); } -#line 8087 "sql.c" yymsp[-3].minor.yy974 = yylhsminor.yy974; break; - case 436: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - case 725: /* sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ yytestcase(yyruleno==725); - case 749: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==749); -#line 786 "sql.y" + case 437: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + case 726: /* sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ yytestcase(yyruleno==726); + case 750: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==750); { yymsp[-3].minor.yy974 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy974); } -#line 8095 "sql.c" break; - case 439: /* cmd ::= KILL CONNECTION NK_INTEGER */ -#line 794 "sql.y" + case 440: /* cmd ::= KILL CONNECTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); } -#line 8100 "sql.c" break; - case 440: /* cmd ::= KILL QUERY NK_STRING */ -#line 795 "sql.y" + case 441: /* cmd ::= KILL QUERY NK_STRING */ { pCxt->pRootNode = createKillQueryStmt(pCxt, &yymsp[0].minor.yy0); } -#line 8105 "sql.c" break; - case 441: /* cmd ::= KILL TRANSACTION NK_INTEGER */ -#line 796 "sql.y" + case 442: /* cmd ::= KILL TRANSACTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_TRANSACTION_STMT, &yymsp[0].minor.yy0); } -#line 8110 "sql.c" break; - case 442: /* cmd ::= KILL COMPACT NK_INTEGER */ -#line 797 "sql.y" + case 443: /* cmd ::= KILL COMPACT NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_COMPACT_STMT, &yymsp[0].minor.yy0); } -#line 8115 "sql.c" break; - case 443: /* cmd ::= BALANCE VGROUP */ -#line 800 "sql.y" + case 444: /* cmd ::= BALANCE VGROUP */ { pCxt->pRootNode = createBalanceVgroupStmt(pCxt); } -#line 8120 "sql.c" break; - case 444: /* cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ -#line 801 "sql.y" + case 445: /* cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ { pCxt->pRootNode = createBalanceVgroupLeaderStmt(pCxt, &yymsp[0].minor.yy557); } -#line 8125 "sql.c" break; - case 445: /* cmd ::= BALANCE VGROUP LEADER DATABASE db_name */ -#line 802 "sql.y" + case 446: /* cmd ::= BALANCE VGROUP LEADER DATABASE db_name */ { pCxt->pRootNode = createBalanceVgroupLeaderDBNameStmt(pCxt, &yymsp[0].minor.yy557); } -#line 8130 "sql.c" break; - case 446: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ -#line 803 "sql.y" + case 447: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ { pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } -#line 8135 "sql.c" break; - case 447: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ -#line 804 "sql.y" + case 448: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ { pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy946); } -#line 8140 "sql.c" break; - case 448: /* cmd ::= SPLIT VGROUP NK_INTEGER */ -#line 805 "sql.y" + case 449: /* cmd ::= SPLIT VGROUP NK_INTEGER */ { pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); } -#line 8145 "sql.c" break; - case 451: /* dnode_list ::= DNODE NK_INTEGER */ -#line 814 "sql.y" + case 452: /* dnode_list ::= DNODE NK_INTEGER */ { yymsp[-1].minor.yy946 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } -#line 8150 "sql.c" break; - case 453: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ -#line 821 "sql.y" + case 454: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ { pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy974, yymsp[0].minor.yy974); } -#line 8155 "sql.c" break; - case 456: /* insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ -#line 830 "sql.y" + case 457: /* insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ { yymsp[-6].minor.yy974 = createInsertStmt(pCxt, yymsp[-4].minor.yy974, yymsp[-2].minor.yy946, yymsp[0].minor.yy974); } -#line 8160 "sql.c" break; - case 457: /* insert_query ::= INSERT INTO full_table_name query_or_subquery */ -#line 831 "sql.y" + case 458: /* insert_query ::= INSERT INTO full_table_name query_or_subquery */ { yymsp[-3].minor.yy974 = createInsertStmt(pCxt, yymsp[-1].minor.yy974, NULL, yymsp[0].minor.yy974); } -#line 8165 "sql.c" break; - case 458: /* tags_literal ::= NK_INTEGER */ - case 470: /* tags_literal ::= NK_BIN */ yytestcase(yyruleno==470); - case 479: /* tags_literal ::= NK_HEX */ yytestcase(yyruleno==479); -#line 834 "sql.y" + case 459: /* tags_literal ::= NK_INTEGER */ + case 471: /* tags_literal ::= NK_BIN */ yytestcase(yyruleno==471); + case 480: /* tags_literal ::= NK_HEX */ yytestcase(yyruleno==480); { yylhsminor.yy974 = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0, NULL); } -#line 8172 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; - case 459: /* tags_literal ::= NK_INTEGER NK_PLUS duration_literal */ - case 460: /* tags_literal ::= NK_INTEGER NK_MINUS duration_literal */ yytestcase(yyruleno==460); - case 471: /* tags_literal ::= NK_BIN NK_PLUS duration_literal */ yytestcase(yyruleno==471); - case 472: /* tags_literal ::= NK_BIN NK_MINUS duration_literal */ yytestcase(yyruleno==472); - case 480: /* tags_literal ::= NK_HEX NK_PLUS duration_literal */ yytestcase(yyruleno==480); - case 481: /* tags_literal ::= NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==481); - case 489: /* tags_literal ::= NK_STRING NK_PLUS duration_literal */ yytestcase(yyruleno==489); - case 490: /* tags_literal ::= NK_STRING NK_MINUS duration_literal */ yytestcase(yyruleno==490); -#line 835 "sql.y" + case 460: /* tags_literal ::= NK_INTEGER NK_PLUS duration_literal */ + case 461: /* tags_literal ::= NK_INTEGER NK_MINUS duration_literal */ yytestcase(yyruleno==461); + case 472: /* tags_literal ::= NK_BIN NK_PLUS duration_literal */ yytestcase(yyruleno==472); + case 473: /* tags_literal ::= NK_BIN NK_MINUS duration_literal */ yytestcase(yyruleno==473); + case 481: /* tags_literal ::= NK_HEX NK_PLUS duration_literal */ yytestcase(yyruleno==481); + case 482: /* tags_literal ::= NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==482); + case 490: /* tags_literal ::= NK_STRING NK_PLUS duration_literal */ yytestcase(yyruleno==490); + case 491: /* tags_literal ::= NK_STRING NK_MINUS duration_literal */ yytestcase(yyruleno==491); { SToken l = yymsp[-2].minor.yy0; SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974); l.n = (r.z + r.n) - l.z; yylhsminor.yy974 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, yymsp[0].minor.yy974); } -#line 8190 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; - case 461: /* tags_literal ::= NK_PLUS NK_INTEGER */ - case 464: /* tags_literal ::= NK_MINUS NK_INTEGER */ yytestcase(yyruleno==464); - case 473: /* tags_literal ::= NK_PLUS NK_BIN */ yytestcase(yyruleno==473); - case 476: /* tags_literal ::= NK_MINUS NK_BIN */ yytestcase(yyruleno==476); - case 482: /* tags_literal ::= NK_PLUS NK_HEX */ yytestcase(yyruleno==482); - case 485: /* tags_literal ::= NK_MINUS NK_HEX */ yytestcase(yyruleno==485); -#line 847 "sql.y" + case 462: /* tags_literal ::= NK_PLUS NK_INTEGER */ + case 465: /* tags_literal ::= NK_MINUS NK_INTEGER */ yytestcase(yyruleno==465); + case 474: /* tags_literal ::= NK_PLUS NK_BIN */ yytestcase(yyruleno==474); + case 477: /* tags_literal ::= NK_MINUS NK_BIN */ yytestcase(yyruleno==477); + case 483: /* tags_literal ::= NK_PLUS NK_HEX */ yytestcase(yyruleno==483); + case 486: /* tags_literal ::= NK_MINUS NK_HEX */ yytestcase(yyruleno==486); { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; yylhsminor.yy974 = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &t, NULL); } -#line 8205 "sql.c" yymsp[-1].minor.yy974 = yylhsminor.yy974; break; - case 462: /* tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal */ - case 463: /* tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal */ yytestcase(yyruleno==463); - case 465: /* tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal */ yytestcase(yyruleno==465); - case 466: /* tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal */ yytestcase(yyruleno==466); - case 474: /* tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal */ yytestcase(yyruleno==474); - case 475: /* tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal */ yytestcase(yyruleno==475); - case 477: /* tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal */ yytestcase(yyruleno==477); - case 478: /* tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal */ yytestcase(yyruleno==478); - case 483: /* tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal */ yytestcase(yyruleno==483); - case 484: /* tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==484); - case 486: /* tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal */ yytestcase(yyruleno==486); - case 487: /* tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==487); -#line 852 "sql.y" + case 463: /* tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal */ + case 464: /* tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal */ yytestcase(yyruleno==464); + case 466: /* tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal */ yytestcase(yyruleno==466); + case 467: /* tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal */ yytestcase(yyruleno==467); + case 475: /* tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal */ yytestcase(yyruleno==475); + case 476: /* tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal */ yytestcase(yyruleno==476); + case 478: /* tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal */ yytestcase(yyruleno==478); + case 479: /* tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal */ yytestcase(yyruleno==479); + case 484: /* tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal */ yytestcase(yyruleno==484); + case 485: /* tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==485); + case 487: /* tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal */ yytestcase(yyruleno==487); + case 488: /* tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==488); { SToken l = yymsp[-3].minor.yy0; SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974); l.n = (r.z + r.n) - l.z; yylhsminor.yy974 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, yymsp[0].minor.yy974); } -#line 8227 "sql.c" yymsp[-3].minor.yy974 = yylhsminor.yy974; break; - case 467: /* tags_literal ::= NK_FLOAT */ -#line 881 "sql.y" + case 468: /* tags_literal ::= NK_FLOAT */ { yylhsminor.yy974 = createRawValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0, NULL); } -#line 8233 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; - case 468: /* tags_literal ::= NK_PLUS NK_FLOAT */ - case 469: /* tags_literal ::= NK_MINUS NK_FLOAT */ yytestcase(yyruleno==469); -#line 882 "sql.y" + case 469: /* tags_literal ::= NK_PLUS NK_FLOAT */ + case 470: /* tags_literal ::= NK_MINUS NK_FLOAT */ yytestcase(yyruleno==470); { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; yylhsminor.yy974 = createRawValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t, NULL); } -#line 8244 "sql.c" yymsp[-1].minor.yy974 = yylhsminor.yy974; break; - case 488: /* tags_literal ::= NK_STRING */ -#line 988 "sql.y" + case 489: /* tags_literal ::= NK_STRING */ { yylhsminor.yy974 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0, NULL); } -#line 8250 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; - case 491: /* tags_literal ::= NK_BOOL */ -#line 1001 "sql.y" + case 492: /* tags_literal ::= NK_BOOL */ { yylhsminor.yy974 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0, NULL); } -#line 8256 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; - case 492: /* tags_literal ::= NULL */ -#line 1002 "sql.y" + case 493: /* tags_literal ::= NULL */ { yylhsminor.yy974 = createRawValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0, NULL); } -#line 8262 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; - case 493: /* tags_literal ::= literal_func */ -#line 1004 "sql.y" + case 494: /* tags_literal ::= literal_func */ { yylhsminor.yy974 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BINARY, NULL, yymsp[0].minor.yy974); } -#line 8268 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; - case 494: /* tags_literal ::= literal_func NK_PLUS duration_literal */ - case 495: /* tags_literal ::= literal_func NK_MINUS duration_literal */ yytestcase(yyruleno==495); -#line 1005 "sql.y" + case 495: /* tags_literal ::= literal_func NK_PLUS duration_literal */ + case 496: /* tags_literal ::= literal_func NK_MINUS duration_literal */ yytestcase(yyruleno==496); { SToken l = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy974); SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974); l.n = (r.z + r.n) - l.z; yylhsminor.yy974 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, yymsp[-2].minor.yy974, yymsp[0].minor.yy974); } -#line 8280 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; - case 498: /* literal ::= NK_INTEGER */ -#line 1024 "sql.y" + case 499: /* literal ::= NK_INTEGER */ { yylhsminor.yy974 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); } -#line 8286 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; - case 499: /* literal ::= NK_FLOAT */ -#line 1025 "sql.y" + case 500: /* literal ::= NK_FLOAT */ { yylhsminor.yy974 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } -#line 8292 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; - case 500: /* literal ::= NK_STRING */ -#line 1026 "sql.y" + case 501: /* literal ::= NK_STRING */ { yylhsminor.yy974 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } -#line 8298 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; - case 501: /* literal ::= NK_BOOL */ -#line 1027 "sql.y" + case 502: /* literal ::= NK_BOOL */ { yylhsminor.yy974 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } -#line 8304 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; - case 502: /* literal ::= TIMESTAMP NK_STRING */ -#line 1028 "sql.y" + case 503: /* literal ::= TIMESTAMP NK_STRING */ { yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } -#line 8310 "sql.c" yymsp[-1].minor.yy974 = yylhsminor.yy974; break; - case 503: /* literal ::= duration_literal */ - case 513: /* signed_literal ::= signed */ yytestcase(yyruleno==513); - case 537: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==537); - case 538: /* expression ::= literal */ yytestcase(yyruleno==538); - case 540: /* expression ::= column_reference */ yytestcase(yyruleno==540); - case 541: /* expression ::= function_expression */ yytestcase(yyruleno==541); - case 542: /* expression ::= case_when_expression */ yytestcase(yyruleno==542); - case 588: /* function_expression ::= literal_func */ yytestcase(yyruleno==588); - case 589: /* function_expression ::= rand_func */ yytestcase(yyruleno==589); - case 647: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==647); - case 651: /* boolean_primary ::= predicate */ yytestcase(yyruleno==651); - case 653: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==653); - case 654: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==654); - case 657: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==657); - case 659: /* table_reference ::= table_primary */ yytestcase(yyruleno==659); - case 660: /* table_reference ::= joined_table */ yytestcase(yyruleno==660); - case 664: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==664); - case 751: /* query_simple ::= query_specification */ yytestcase(yyruleno==751); - case 752: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==752); - case 755: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==755); - case 757: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==757); -#line 1029 "sql.y" + case 504: /* literal ::= duration_literal */ + case 514: /* signed_literal ::= signed */ yytestcase(yyruleno==514); + case 538: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==538); + case 539: /* expression ::= literal */ yytestcase(yyruleno==539); + case 541: /* expression ::= column_reference */ yytestcase(yyruleno==541); + case 542: /* expression ::= function_expression */ yytestcase(yyruleno==542); + case 543: /* expression ::= case_when_expression */ yytestcase(yyruleno==543); + case 589: /* function_expression ::= literal_func */ yytestcase(yyruleno==589); + case 590: /* function_expression ::= rand_func */ yytestcase(yyruleno==590); + case 648: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==648); + case 652: /* boolean_primary ::= predicate */ yytestcase(yyruleno==652); + case 654: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==654); + case 655: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==655); + case 658: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==658); + case 660: /* table_reference ::= table_primary */ yytestcase(yyruleno==660); + case 661: /* table_reference ::= joined_table */ yytestcase(yyruleno==661); + case 665: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==665); + case 752: /* query_simple ::= query_specification */ yytestcase(yyruleno==752); + case 753: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==753); + case 756: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==756); + case 758: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==758); { yylhsminor.yy974 = yymsp[0].minor.yy974; } -#line 8336 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; - case 504: /* literal ::= NULL */ -#line 1030 "sql.y" + case 505: /* literal ::= NULL */ { yylhsminor.yy974 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } -#line 8342 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; - case 505: /* literal ::= NK_QUESTION */ -#line 1031 "sql.y" + case 506: /* literal ::= NK_QUESTION */ { yylhsminor.yy974 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } -#line 8348 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; - case 506: /* duration_literal ::= NK_VARIABLE */ - case 726: /* interval_sliding_duration_literal ::= NK_VARIABLE */ yytestcase(yyruleno==726); - case 727: /* interval_sliding_duration_literal ::= NK_STRING */ yytestcase(yyruleno==727); - case 728: /* interval_sliding_duration_literal ::= NK_INTEGER */ yytestcase(yyruleno==728); -#line 1033 "sql.y" + case 507: /* duration_literal ::= NK_VARIABLE */ + case 727: /* interval_sliding_duration_literal ::= NK_VARIABLE */ yytestcase(yyruleno==727); + case 728: /* interval_sliding_duration_literal ::= NK_STRING */ yytestcase(yyruleno==728); + case 729: /* interval_sliding_duration_literal ::= NK_INTEGER */ yytestcase(yyruleno==729); { yylhsminor.yy974 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } -#line 8357 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; - case 507: /* signed ::= NK_INTEGER */ -#line 1035 "sql.y" + case 508: /* signed ::= NK_INTEGER */ { yylhsminor.yy974 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } -#line 8363 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; - case 508: /* signed ::= NK_PLUS NK_INTEGER */ -#line 1036 "sql.y" + case 509: /* signed ::= NK_PLUS NK_INTEGER */ { yymsp[-1].minor.yy974 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } -#line 8369 "sql.c" break; - case 509: /* signed ::= NK_MINUS NK_INTEGER */ -#line 1037 "sql.y" + case 510: /* 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.yy974 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); } -#line 8378 "sql.c" yymsp[-1].minor.yy974 = yylhsminor.yy974; break; - case 510: /* signed ::= NK_FLOAT */ -#line 1042 "sql.y" + case 511: /* signed ::= NK_FLOAT */ { yylhsminor.yy974 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } -#line 8384 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; - case 511: /* signed ::= NK_PLUS NK_FLOAT */ -#line 1043 "sql.y" + case 512: /* signed ::= NK_PLUS NK_FLOAT */ { yymsp[-1].minor.yy974 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } -#line 8390 "sql.c" break; - case 512: /* signed ::= NK_MINUS NK_FLOAT */ -#line 1044 "sql.y" + case 513: /* 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.yy974 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); } -#line 8399 "sql.c" yymsp[-1].minor.yy974 = yylhsminor.yy974; break; - case 514: /* signed_literal ::= NK_STRING */ -#line 1051 "sql.y" + case 515: /* signed_literal ::= NK_STRING */ { yylhsminor.yy974 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } -#line 8405 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; - case 515: /* signed_literal ::= NK_BOOL */ -#line 1052 "sql.y" + case 516: /* signed_literal ::= NK_BOOL */ { yylhsminor.yy974 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } -#line 8411 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; - case 516: /* signed_literal ::= TIMESTAMP NK_STRING */ -#line 1053 "sql.y" + case 517: /* signed_literal ::= TIMESTAMP NK_STRING */ { yymsp[-1].minor.yy974 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } -#line 8417 "sql.c" - break; - case 517: /* signed_literal ::= duration_literal */ - case 519: /* signed_literal ::= literal_func */ yytestcase(yyruleno==519); - case 618: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==618); - case 701: /* select_item ::= common_expression */ yytestcase(yyruleno==701); - case 711: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==711); - case 756: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==756); - case 758: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==758); - case 771: /* search_condition ::= common_expression */ yytestcase(yyruleno==771); -#line 1054 "sql.y" + break; + case 518: /* signed_literal ::= duration_literal */ + case 520: /* signed_literal ::= literal_func */ yytestcase(yyruleno==520); + case 619: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==619); + case 702: /* select_item ::= common_expression */ yytestcase(yyruleno==702); + case 712: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==712); + case 757: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==757); + case 759: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==759); + case 772: /* search_condition ::= common_expression */ yytestcase(yyruleno==772); { yylhsminor.yy974 = releaseRawExprNode(pCxt, yymsp[0].minor.yy974); } -#line 8429 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; - case 518: /* signed_literal ::= NULL */ -#line 1055 "sql.y" + case 519: /* signed_literal ::= NULL */ { yylhsminor.yy974 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } -#line 8435 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; - case 520: /* signed_literal ::= NK_QUESTION */ -#line 1057 "sql.y" + case 521: /* signed_literal ::= NK_QUESTION */ { yylhsminor.yy974 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); } -#line 8441 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; - case 539: /* expression ::= pseudo_column */ -#line 1123 "sql.y" + case 540: /* expression ::= pseudo_column */ { yylhsminor.yy974 = yymsp[0].minor.yy974; (void)setRawExprNodeIsPseudoColumn(pCxt, yylhsminor.yy974, true); } -#line 8447 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; - case 543: /* expression ::= NK_LP expression NK_RP */ - case 652: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==652); - case 770: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==770); -#line 1127 "sql.y" + case 544: /* expression ::= NK_LP expression NK_RP */ + case 653: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==653); + case 771: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==771); { yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy974)); } -#line 8455 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; - case 544: /* expression ::= NK_PLUS expr_or_subquery */ -#line 1128 "sql.y" + case 545: /* expression ::= NK_PLUS expr_or_subquery */ { SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974); yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy974)); } -#line 8464 "sql.c" yymsp[-1].minor.yy974 = yylhsminor.yy974; break; - case 545: /* expression ::= NK_MINUS expr_or_subquery */ -#line 1132 "sql.y" + case 546: /* expression ::= NK_MINUS expr_or_subquery */ { SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974); yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy974), NULL)); } -#line 8473 "sql.c" yymsp[-1].minor.yy974 = yylhsminor.yy974; break; - case 546: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ -#line 1136 "sql.y" + case 547: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy974); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974); yylhsminor.yy974 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), releaseRawExprNode(pCxt, yymsp[0].minor.yy974))); } -#line 8483 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; - case 547: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ -#line 1141 "sql.y" + case 548: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy974); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974); yylhsminor.yy974 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), releaseRawExprNode(pCxt, yymsp[0].minor.yy974))); } -#line 8493 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; - case 548: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */ -#line 1146 "sql.y" + case 549: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy974); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974); yylhsminor.yy974 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), releaseRawExprNode(pCxt, yymsp[0].minor.yy974))); } -#line 8503 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; - case 549: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ -#line 1151 "sql.y" + case 550: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy974); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974); yylhsminor.yy974 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), releaseRawExprNode(pCxt, yymsp[0].minor.yy974))); } -#line 8513 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; - case 550: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */ -#line 1156 "sql.y" + case 551: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy974); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974); yylhsminor.yy974 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), releaseRawExprNode(pCxt, yymsp[0].minor.yy974))); } -#line 8523 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; - case 551: /* expression ::= column_reference NK_ARROW NK_STRING */ -#line 1161 "sql.y" + case 552: /* expression ::= column_reference NK_ARROW NK_STRING */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy974); yylhsminor.yy974 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); } -#line 8532 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; - case 552: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ -#line 1165 "sql.y" + case 553: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy974); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974); yylhsminor.yy974 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), releaseRawExprNode(pCxt, yymsp[0].minor.yy974))); } -#line 8542 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; - case 553: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ -#line 1170 "sql.y" + case 554: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy974); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974); yylhsminor.yy974 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), releaseRawExprNode(pCxt, yymsp[0].minor.yy974))); } -#line 8552 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; - case 556: /* column_reference ::= column_name */ -#line 1181 "sql.y" + case 557: /* column_reference ::= column_name */ { yylhsminor.yy974 = createRawExprNode(pCxt, &yymsp[0].minor.yy557, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy557)); } -#line 8558 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; - case 557: /* column_reference ::= table_name NK_DOT column_name */ -#line 1182 "sql.y" + case 558: /* column_reference ::= table_name NK_DOT column_name */ { yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy557, &yymsp[0].minor.yy557, createColumnNode(pCxt, &yymsp[-2].minor.yy557, &yymsp[0].minor.yy557)); } -#line 8564 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; - case 558: /* column_reference ::= NK_ALIAS */ -#line 1183 "sql.y" + case 559: /* column_reference ::= NK_ALIAS */ { yylhsminor.yy974 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } -#line 8570 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; - case 559: /* column_reference ::= table_name NK_DOT NK_ALIAS */ -#line 1184 "sql.y" + case 560: /* column_reference ::= table_name NK_DOT NK_ALIAS */ { yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy557, &yymsp[0].minor.yy0, createColumnNode(pCxt, &yymsp[-2].minor.yy557, &yymsp[0].minor.yy0)); } -#line 8576 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; - case 560: /* pseudo_column ::= ROWTS */ - case 561: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==561); - case 563: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==563); - case 564: /* pseudo_column ::= QEND */ yytestcase(yyruleno==564); - case 565: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==565); - case 566: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==566); - case 567: /* pseudo_column ::= WEND */ yytestcase(yyruleno==567); - case 568: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==568); - case 569: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==569); - case 570: /* pseudo_column ::= ISFILLED */ yytestcase(yyruleno==570); - case 571: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==571); - case 572: /* pseudo_column ::= FLOW */ yytestcase(yyruleno==572); - case 573: /* pseudo_column ::= FHIGH */ yytestcase(yyruleno==573); - case 574: /* pseudo_column ::= FROWTS */ yytestcase(yyruleno==574); - case 591: /* literal_func ::= NOW */ yytestcase(yyruleno==591); - case 592: /* literal_func ::= TODAY */ yytestcase(yyruleno==592); -#line 1186 "sql.y" + case 561: /* pseudo_column ::= ROWTS */ + case 562: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==562); + case 564: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==564); + case 565: /* pseudo_column ::= QEND */ yytestcase(yyruleno==565); + case 566: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==566); + case 567: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==567); + case 568: /* pseudo_column ::= WEND */ yytestcase(yyruleno==568); + case 569: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==569); + case 570: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==570); + case 571: /* pseudo_column ::= ISFILLED */ yytestcase(yyruleno==571); + case 572: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==572); + case 573: /* pseudo_column ::= FLOW */ yytestcase(yyruleno==573); + case 574: /* pseudo_column ::= FHIGH */ yytestcase(yyruleno==574); + case 575: /* pseudo_column ::= FROWTS */ yytestcase(yyruleno==575); + case 592: /* literal_func ::= NOW */ yytestcase(yyruleno==592); + case 593: /* literal_func ::= TODAY */ yytestcase(yyruleno==593); { yylhsminor.yy974 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } -#line 8597 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; - case 562: /* pseudo_column ::= table_name NK_DOT TBNAME */ -#line 1188 "sql.y" + case 563: /* pseudo_column ::= table_name NK_DOT TBNAME */ { yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy557, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy557)))); } -#line 8603 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; - case 575: /* function_expression ::= function_name NK_LP expression_list NK_RP */ - case 576: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==576); - case 584: /* function_expression ::= substr_func NK_LP expression_list NK_RP */ yytestcase(yyruleno==584); -#line 1202 "sql.y" + case 576: /* function_expression ::= function_name NK_LP expression_list NK_RP */ + case 577: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==577); + case 585: /* function_expression ::= substr_func NK_LP expression_list NK_RP */ yytestcase(yyruleno==585); { yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy557, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy557, yymsp[-1].minor.yy946)); } -#line 8611 "sql.c" yymsp[-3].minor.yy974 = yylhsminor.yy974; break; - case 577: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ - case 578: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP */ yytestcase(yyruleno==578); -#line 1205 "sql.y" + case 578: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ + case 579: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP */ yytestcase(yyruleno==579); { yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy974), yymsp[-1].minor.yy424)); } -#line 8618 "sql.c" yymsp[-5].minor.yy974 = yylhsminor.yy974; break; - case 579: /* function_expression ::= POSITION NK_LP expr_or_subquery IN expr_or_subquery NK_RP */ -#line 1209 "sql.y" + case 580: /* function_expression ::= POSITION NK_LP expr_or_subquery IN expr_or_subquery NK_RP */ { yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createPositionFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy974), releaseRawExprNode(pCxt, yymsp[-1].minor.yy974))); } -#line 8624 "sql.c" yymsp[-5].minor.yy974 = yylhsminor.yy974; break; - case 580: /* function_expression ::= TRIM NK_LP expr_or_subquery NK_RP */ -#line 1211 "sql.y" + case 581: /* function_expression ::= TRIM NK_LP expr_or_subquery NK_RP */ { yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createTrimFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy974), TRIM_TYPE_BOTH)); } -#line 8630 "sql.c" yymsp[-3].minor.yy974 = yylhsminor.yy974; break; - case 581: /* function_expression ::= TRIM NK_LP trim_specification_type FROM expr_or_subquery NK_RP */ -#line 1213 "sql.y" + case 582: /* function_expression ::= TRIM NK_LP trim_specification_type FROM expr_or_subquery NK_RP */ { yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createTrimFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy974), yymsp[-3].minor.yy300)); } -#line 8636 "sql.c" yymsp[-5].minor.yy974 = yylhsminor.yy974; break; - case 582: /* function_expression ::= TRIM NK_LP expr_or_subquery FROM expr_or_subquery NK_RP */ -#line 1215 "sql.y" + case 583: /* function_expression ::= TRIM NK_LP expr_or_subquery FROM expr_or_subquery NK_RP */ { yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createTrimFunctionNodeExt(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy974), releaseRawExprNode(pCxt, yymsp[-1].minor.yy974), TRIM_TYPE_BOTH)); } -#line 8642 "sql.c" yymsp[-5].minor.yy974 = yylhsminor.yy974; break; - case 583: /* function_expression ::= TRIM NK_LP trim_specification_type expr_or_subquery FROM expr_or_subquery NK_RP */ -#line 1217 "sql.y" + case 584: /* function_expression ::= TRIM NK_LP trim_specification_type expr_or_subquery FROM expr_or_subquery NK_RP */ { yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-6].minor.yy0, &yymsp[0].minor.yy0, createTrimFunctionNodeExt(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy974), releaseRawExprNode(pCxt, yymsp[-1].minor.yy974), yymsp[-4].minor.yy300)); } -#line 8648 "sql.c" yymsp[-6].minor.yy974 = yylhsminor.yy974; break; - case 585: /* function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery NK_RP */ -#line 1221 "sql.y" + case 586: /* function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery NK_RP */ { yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy557, &yymsp[0].minor.yy0, createSubstrFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy974), releaseRawExprNode(pCxt, yymsp[-1].minor.yy974))); } -#line 8654 "sql.c" yymsp[-5].minor.yy974 = yylhsminor.yy974; break; - case 586: /* function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery FOR expr_or_subquery NK_RP */ -#line 1223 "sql.y" + case 587: /* function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery FOR expr_or_subquery NK_RP */ { yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-7].minor.yy557, &yymsp[0].minor.yy0, createSubstrFunctionNodeExt(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy974), releaseRawExprNode(pCxt, yymsp[-3].minor.yy974), releaseRawExprNode(pCxt, yymsp[-1].minor.yy974))); } -#line 8660 "sql.c" yymsp[-7].minor.yy974 = yylhsminor.yy974; break; - case 587: /* function_expression ::= REPLACE NK_LP expression_list NK_RP */ - case 594: /* rand_func ::= RAND NK_LP expression_list NK_RP */ yytestcase(yyruleno==594); -#line 1224 "sql.y" + case 588: /* function_expression ::= REPLACE NK_LP expression_list NK_RP */ + case 595: /* rand_func ::= RAND NK_LP expression_list NK_RP */ yytestcase(yyruleno==595); { yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy946)); } -#line 8667 "sql.c" yymsp[-3].minor.yy974 = yylhsminor.yy974; break; - case 590: /* literal_func ::= noarg_func NK_LP NK_RP */ -#line 1228 "sql.y" + case 591: /* literal_func ::= noarg_func NK_LP NK_RP */ { yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy557, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy557, NULL)); } -#line 8673 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; - case 593: /* rand_func ::= RAND NK_LP NK_RP */ -#line 1232 "sql.y" + case 594: /* rand_func ::= RAND NK_LP NK_RP */ { yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy0, NULL)); } -#line 8679 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; - case 597: /* trim_specification_type ::= BOTH */ -#line 1242 "sql.y" + case 598: /* trim_specification_type ::= BOTH */ { yymsp[0].minor.yy300 = TRIM_TYPE_BOTH; } -#line 8685 "sql.c" break; - case 598: /* trim_specification_type ::= TRAILING */ -#line 1243 "sql.y" + case 599: /* trim_specification_type ::= TRAILING */ { yymsp[0].minor.yy300 = TRIM_TYPE_TRAILING; } -#line 8690 "sql.c" break; - case 599: /* trim_specification_type ::= LEADING */ -#line 1244 "sql.y" + case 600: /* trim_specification_type ::= LEADING */ { yymsp[0].minor.yy300 = TRIM_TYPE_LEADING; } -#line 8695 "sql.c" break; - case 614: /* star_func_para_list ::= NK_STAR */ -#line 1268 "sql.y" + case 615: /* star_func_para_list ::= NK_STAR */ { yylhsminor.yy946 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } -#line 8700 "sql.c" yymsp[0].minor.yy946 = yylhsminor.yy946; break; - case 619: /* star_func_para ::= table_name NK_DOT NK_STAR */ - case 704: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==704); -#line 1277 "sql.y" + case 620: /* star_func_para ::= table_name NK_DOT NK_STAR */ + case 705: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==705); { yylhsminor.yy974 = createColumnNode(pCxt, &yymsp[-2].minor.yy557, &yymsp[0].minor.yy0); } -#line 8707 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; - case 620: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */ -#line 1280 "sql.y" + case 621: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */ { yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy946, yymsp[-1].minor.yy974)); } -#line 8713 "sql.c" yymsp[-3].minor.yy974 = yylhsminor.yy974; break; - case 621: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ -#line 1282 "sql.y" + case 622: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ { yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy974), yymsp[-2].minor.yy946, yymsp[-1].minor.yy974)); } -#line 8719 "sql.c" yymsp[-4].minor.yy974 = yylhsminor.yy974; break; - case 624: /* when_then_expr ::= WHEN common_expression THEN common_expression */ -#line 1289 "sql.y" + case 625: /* when_then_expr ::= WHEN common_expression THEN common_expression */ { yymsp[-3].minor.yy974 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), releaseRawExprNode(pCxt, yymsp[0].minor.yy974)); } -#line 8725 "sql.c" break; - case 626: /* case_when_else_opt ::= ELSE common_expression */ -#line 1292 "sql.y" + case 627: /* case_when_else_opt ::= ELSE common_expression */ { yymsp[-1].minor.yy974 = releaseRawExprNode(pCxt, yymsp[0].minor.yy974); } -#line 8730 "sql.c" break; - case 627: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */ - case 632: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==632); -#line 1295 "sql.y" + case 628: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */ + case 633: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==633); { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy974); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974); yylhsminor.yy974 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy140, releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), releaseRawExprNode(pCxt, yymsp[0].minor.yy974))); } -#line 8740 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; - case 628: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ -#line 1302 "sql.y" + case 629: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy974); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974); yylhsminor.yy974 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy974), releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), releaseRawExprNode(pCxt, yymsp[0].minor.yy974))); } -#line 8750 "sql.c" yymsp[-4].minor.yy974 = yylhsminor.yy974; break; - case 629: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ -#line 1308 "sql.y" + case 630: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy974); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974); yylhsminor.yy974 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy974), releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), releaseRawExprNode(pCxt, yymsp[0].minor.yy974))); } -#line 8760 "sql.c" yymsp[-5].minor.yy974 = yylhsminor.yy974; break; - case 630: /* predicate ::= expr_or_subquery IS NULL */ -#line 1313 "sql.y" + case 631: /* predicate ::= expr_or_subquery IS NULL */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy974); yylhsminor.yy974 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), NULL)); } -#line 8769 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; - case 631: /* predicate ::= expr_or_subquery IS NOT NULL */ -#line 1317 "sql.y" + case 632: /* predicate ::= expr_or_subquery IS NOT NULL */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy974); yylhsminor.yy974 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy974), NULL)); } -#line 8778 "sql.c" yymsp[-3].minor.yy974 = yylhsminor.yy974; break; - case 633: /* compare_op ::= NK_LT */ -#line 1329 "sql.y" + case 634: /* compare_op ::= NK_LT */ { yymsp[0].minor.yy140 = OP_TYPE_LOWER_THAN; } -#line 8784 "sql.c" break; - case 634: /* compare_op ::= NK_GT */ -#line 1330 "sql.y" + case 635: /* compare_op ::= NK_GT */ { yymsp[0].minor.yy140 = OP_TYPE_GREATER_THAN; } -#line 8789 "sql.c" break; - case 635: /* compare_op ::= NK_LE */ -#line 1331 "sql.y" + case 636: /* compare_op ::= NK_LE */ { yymsp[0].minor.yy140 = OP_TYPE_LOWER_EQUAL; } -#line 8794 "sql.c" break; - case 636: /* compare_op ::= NK_GE */ -#line 1332 "sql.y" + case 637: /* compare_op ::= NK_GE */ { yymsp[0].minor.yy140 = OP_TYPE_GREATER_EQUAL; } -#line 8799 "sql.c" break; - case 637: /* compare_op ::= NK_NE */ -#line 1333 "sql.y" + case 638: /* compare_op ::= NK_NE */ { yymsp[0].minor.yy140 = OP_TYPE_NOT_EQUAL; } -#line 8804 "sql.c" break; - case 638: /* compare_op ::= NK_EQ */ -#line 1334 "sql.y" + case 639: /* compare_op ::= NK_EQ */ { yymsp[0].minor.yy140 = OP_TYPE_EQUAL; } -#line 8809 "sql.c" break; - case 639: /* compare_op ::= LIKE */ -#line 1335 "sql.y" + case 640: /* compare_op ::= LIKE */ { yymsp[0].minor.yy140 = OP_TYPE_LIKE; } -#line 8814 "sql.c" break; - case 640: /* compare_op ::= NOT LIKE */ -#line 1336 "sql.y" + case 641: /* compare_op ::= NOT LIKE */ { yymsp[-1].minor.yy140 = OP_TYPE_NOT_LIKE; } -#line 8819 "sql.c" break; - case 641: /* compare_op ::= MATCH */ -#line 1337 "sql.y" + case 642: /* compare_op ::= MATCH */ { yymsp[0].minor.yy140 = OP_TYPE_MATCH; } -#line 8824 "sql.c" break; - case 642: /* compare_op ::= NMATCH */ -#line 1338 "sql.y" + case 643: /* compare_op ::= NMATCH */ { yymsp[0].minor.yy140 = OP_TYPE_NMATCH; } -#line 8829 "sql.c" break; - case 643: /* compare_op ::= CONTAINS */ -#line 1339 "sql.y" + case 644: /* compare_op ::= CONTAINS */ { yymsp[0].minor.yy140 = OP_TYPE_JSON_CONTAINS; } -#line 8834 "sql.c" break; - case 644: /* in_op ::= IN */ -#line 1343 "sql.y" + case 645: /* in_op ::= IN */ { yymsp[0].minor.yy140 = OP_TYPE_IN; } -#line 8839 "sql.c" break; - case 645: /* in_op ::= NOT IN */ -#line 1344 "sql.y" + case 646: /* in_op ::= NOT IN */ { yymsp[-1].minor.yy140 = OP_TYPE_NOT_IN; } -#line 8844 "sql.c" break; - case 646: /* in_predicate_value ::= NK_LP literal_list NK_RP */ -#line 1346 "sql.y" + case 647: /* in_predicate_value ::= NK_LP literal_list NK_RP */ { yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy946)); } -#line 8849 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; - case 648: /* boolean_value_expression ::= NOT boolean_primary */ -#line 1350 "sql.y" + case 649: /* boolean_value_expression ::= NOT boolean_primary */ { SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974); yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy974), NULL)); } -#line 8858 "sql.c" yymsp[-1].minor.yy974 = yylhsminor.yy974; break; - case 649: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ -#line 1355 "sql.y" + case 650: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy974); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974); yylhsminor.yy974 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), releaseRawExprNode(pCxt, yymsp[0].minor.yy974))); } -#line 8868 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; - case 650: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ -#line 1361 "sql.y" + case 651: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy974); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974); yylhsminor.yy974 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), releaseRawExprNode(pCxt, yymsp[0].minor.yy974))); } -#line 8878 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; - case 658: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ -#line 1379 "sql.y" + case 659: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ { yylhsminor.yy974 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, JOIN_STYPE_NONE, yymsp[-2].minor.yy974, yymsp[0].minor.yy974, NULL); } -#line 8884 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; - case 661: /* table_primary ::= table_name alias_opt */ -#line 1385 "sql.y" + case 662: /* table_primary ::= table_name alias_opt */ { yylhsminor.yy974 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy557, &yymsp[0].minor.yy557); } -#line 8890 "sql.c" yymsp[-1].minor.yy974 = yylhsminor.yy974; break; - case 662: /* table_primary ::= db_name NK_DOT table_name alias_opt */ -#line 1386 "sql.y" + case 663: /* table_primary ::= db_name NK_DOT table_name alias_opt */ { yylhsminor.yy974 = createRealTableNode(pCxt, &yymsp[-3].minor.yy557, &yymsp[-1].minor.yy557, &yymsp[0].minor.yy557); } -#line 8896 "sql.c" yymsp[-3].minor.yy974 = yylhsminor.yy974; break; - case 663: /* table_primary ::= subquery alias_opt */ -#line 1387 "sql.y" + case 664: /* table_primary ::= subquery alias_opt */ { yylhsminor.yy974 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy974), &yymsp[0].minor.yy557); } -#line 8902 "sql.c" yymsp[-1].minor.yy974 = yylhsminor.yy974; break; - case 665: /* alias_opt ::= */ -#line 1392 "sql.y" + case 666: /* alias_opt ::= */ { yymsp[1].minor.yy557 = nil_token; } -#line 8908 "sql.c" break; - case 667: /* alias_opt ::= AS table_alias */ -#line 1394 "sql.y" + case 668: /* alias_opt ::= AS table_alias */ { yymsp[-1].minor.yy557 = yymsp[0].minor.yy557; } -#line 8913 "sql.c" break; - case 668: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - case 669: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==669); -#line 1396 "sql.y" + case 669: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + case 670: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==670); { yymsp[-2].minor.yy974 = yymsp[-1].minor.yy974; } -#line 8919 "sql.c" break; - case 670: /* joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt */ -#line 1402 "sql.y" + case 671: /* joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt */ { yylhsminor.yy974 = createJoinTableNode(pCxt, yymsp[-6].minor.yy792, yymsp[-5].minor.yy744, yymsp[-7].minor.yy974, yymsp[-3].minor.yy974, yymsp[-2].minor.yy974); yylhsminor.yy974 = addWindowOffsetClause(pCxt, yylhsminor.yy974, yymsp[-1].minor.yy974); yylhsminor.yy974 = addJLimitClause(pCxt, yylhsminor.yy974, yymsp[0].minor.yy974); } -#line 8928 "sql.c" yymsp[-7].minor.yy974 = yylhsminor.yy974; break; - case 671: /* join_type ::= */ -#line 1410 "sql.y" + case 672: /* join_type ::= */ { yymsp[1].minor.yy792 = JOIN_TYPE_INNER; } -#line 8934 "sql.c" break; - case 672: /* join_type ::= INNER */ -#line 1411 "sql.y" + case 673: /* join_type ::= INNER */ { yymsp[0].minor.yy792 = JOIN_TYPE_INNER; } -#line 8939 "sql.c" break; - case 673: /* join_type ::= LEFT */ -#line 1412 "sql.y" + case 674: /* join_type ::= LEFT */ { yymsp[0].minor.yy792 = JOIN_TYPE_LEFT; } -#line 8944 "sql.c" break; - case 674: /* join_type ::= RIGHT */ -#line 1413 "sql.y" + case 675: /* join_type ::= RIGHT */ { yymsp[0].minor.yy792 = JOIN_TYPE_RIGHT; } -#line 8949 "sql.c" break; - case 675: /* join_type ::= FULL */ -#line 1414 "sql.y" + case 676: /* join_type ::= FULL */ { yymsp[0].minor.yy792 = JOIN_TYPE_FULL; } -#line 8954 "sql.c" break; - case 676: /* join_subtype ::= */ -#line 1418 "sql.y" + case 677: /* join_subtype ::= */ { yymsp[1].minor.yy744 = JOIN_STYPE_NONE; } -#line 8959 "sql.c" break; - case 677: /* join_subtype ::= OUTER */ -#line 1419 "sql.y" + case 678: /* join_subtype ::= OUTER */ { yymsp[0].minor.yy744 = JOIN_STYPE_OUTER; } -#line 8964 "sql.c" break; - case 678: /* join_subtype ::= SEMI */ -#line 1420 "sql.y" + case 679: /* join_subtype ::= SEMI */ { yymsp[0].minor.yy744 = JOIN_STYPE_SEMI; } -#line 8969 "sql.c" break; - case 679: /* join_subtype ::= ANTI */ -#line 1421 "sql.y" + case 680: /* join_subtype ::= ANTI */ { yymsp[0].minor.yy744 = JOIN_STYPE_ANTI; } -#line 8974 "sql.c" break; - case 680: /* join_subtype ::= ASOF */ -#line 1422 "sql.y" + case 681: /* join_subtype ::= ASOF */ { yymsp[0].minor.yy744 = JOIN_STYPE_ASOF; } -#line 8979 "sql.c" break; - case 681: /* join_subtype ::= WINDOW */ -#line 1423 "sql.y" + case 682: /* join_subtype ::= WINDOW */ { yymsp[0].minor.yy744 = JOIN_STYPE_WIN; } -#line 8984 "sql.c" break; - case 685: /* window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP */ -#line 1430 "sql.y" + case 686: /* window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP */ { yymsp[-5].minor.yy974 = createWindowOffsetNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy974), releaseRawExprNode(pCxt, yymsp[-1].minor.yy974)); } -#line 8989 "sql.c" break; - case 686: /* window_offset_literal ::= NK_VARIABLE */ -#line 1432 "sql.y" + case 687: /* window_offset_literal ::= NK_VARIABLE */ { yylhsminor.yy974 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createTimeOffsetValueNode(pCxt, &yymsp[0].minor.yy0)); } -#line 8994 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; - case 687: /* window_offset_literal ::= NK_MINUS NK_VARIABLE */ -#line 1433 "sql.y" + case 688: /* window_offset_literal ::= NK_MINUS NK_VARIABLE */ { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; yylhsminor.yy974 = createRawExprNode(pCxt, &t, createTimeOffsetValueNode(pCxt, &t)); } -#line 9004 "sql.c" yymsp[-1].minor.yy974 = yylhsminor.yy974; break; - case 689: /* jlimit_clause_opt ::= JLIMIT NK_INTEGER */ - case 762: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ yytestcase(yyruleno==762); - case 766: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==766); -#line 1440 "sql.y" + case 690: /* jlimit_clause_opt ::= JLIMIT NK_INTEGER */ + case 763: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ yytestcase(yyruleno==763); + case 767: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==767); { yymsp[-1].minor.yy974 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } -#line 9012 "sql.c" break; - case 690: /* query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_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 */ -#line 1446 "sql.y" + case 691: /* query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_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[-13].minor.yy974 = createSelectStmt(pCxt, yymsp[-11].minor.yy569, yymsp[-9].minor.yy946, yymsp[-8].minor.yy974, yymsp[-12].minor.yy946); yymsp[-13].minor.yy974 = setSelectStmtTagMode(pCxt, yymsp[-13].minor.yy974, yymsp[-10].minor.yy569); @@ -9025,243 +7651,156 @@ yymsp[0].minor.yy974); } yymsp[-13].minor.yy974 = addEveryClause(pCxt, yymsp[-13].minor.yy974, yymsp[-4].minor.yy974); yymsp[-13].minor.yy974 = addFillClause(pCxt, yymsp[-13].minor.yy974, yymsp[-3].minor.yy974); } -#line 9028 "sql.c" break; - case 691: /* hint_list ::= */ -#line 1461 "sql.y" + case 692: /* hint_list ::= */ { yymsp[1].minor.yy946 = createHintNodeList(pCxt, NULL); } -#line 9033 "sql.c" break; - case 692: /* hint_list ::= NK_HINT */ -#line 1462 "sql.y" + case 693: /* hint_list ::= NK_HINT */ { yylhsminor.yy946 = createHintNodeList(pCxt, &yymsp[0].minor.yy0); } -#line 9038 "sql.c" yymsp[0].minor.yy946 = yylhsminor.yy946; break; - case 697: /* set_quantifier_opt ::= ALL */ -#line 1473 "sql.y" + case 698: /* set_quantifier_opt ::= ALL */ { yymsp[0].minor.yy569 = false; } -#line 9044 "sql.c" break; - case 700: /* select_item ::= NK_STAR */ -#line 1480 "sql.y" + case 701: /* select_item ::= NK_STAR */ { yylhsminor.yy974 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } -#line 9049 "sql.c" yymsp[0].minor.yy974 = yylhsminor.yy974; break; - case 702: /* select_item ::= common_expression column_alias */ - case 712: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==712); -#line 1482 "sql.y" + case 703: /* select_item ::= common_expression column_alias */ + case 713: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==713); { yylhsminor.yy974 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy974), &yymsp[0].minor.yy557); } -#line 9056 "sql.c" yymsp[-1].minor.yy974 = yylhsminor.yy974; break; - case 703: /* select_item ::= common_expression AS column_alias */ - case 713: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==713); -#line 1483 "sql.y" + case 704: /* select_item ::= common_expression AS column_alias */ + case 714: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==714); { yylhsminor.yy974 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), &yymsp[0].minor.yy557); } -#line 9063 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; - case 708: /* partition_by_clause_opt ::= PARTITION BY partition_list */ - case 740: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==740); - case 760: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==760); -#line 1492 "sql.y" + case 709: /* partition_by_clause_opt ::= PARTITION BY partition_list */ + case 741: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==741); + case 761: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==761); { yymsp[-2].minor.yy946 = yymsp[0].minor.yy946; } -#line 9071 "sql.c" break; - case 715: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ -#line 1505 "sql.y" + case 716: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ { yymsp[-5].minor.yy974 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy974), releaseRawExprNode(pCxt, yymsp[-1].minor.yy974)); } -#line 9076 "sql.c" break; - case 716: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ -#line 1506 "sql.y" + case 717: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ { yymsp[-3].minor.yy974 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy974)); } -#line 9081 "sql.c" break; - case 717: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ -#line 1508 "sql.y" + case 718: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ { yymsp[-5].minor.yy974 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy974), NULL, yymsp[-1].minor.yy974, yymsp[0].minor.yy974); } -#line 9086 "sql.c" break; - case 718: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ -#line 1512 "sql.y" + case 719: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ { yymsp[-7].minor.yy974 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy974), releaseRawExprNode(pCxt, yymsp[-3].minor.yy974), yymsp[-1].minor.yy974, yymsp[0].minor.yy974); } -#line 9091 "sql.c" break; - case 719: /* twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ -#line 1514 "sql.y" + case 720: /* twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ { yymsp[-6].minor.yy974 = createEventWindowNode(pCxt, yymsp[-3].minor.yy974, yymsp[0].minor.yy974); } -#line 9096 "sql.c" break; - case 720: /* twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */ -#line 1516 "sql.y" + case 721: /* twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */ { yymsp[-3].minor.yy974 = createCountWindowNode(pCxt, &yymsp[-1].minor.yy0, &yymsp[-1].minor.yy0); } -#line 9101 "sql.c" break; - case 721: /* twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ -#line 1518 "sql.y" + case 722: /* twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ { yymsp[-5].minor.yy974 = createCountWindowNode(pCxt, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0); } -#line 9106 "sql.c" break; - case 722: /* twindow_clause_opt ::= ANOMALY_WINDOW NK_LP expr_or_subquery NK_RP */ -#line 1520 "sql.y" + case 723: /* twindow_clause_opt ::= ANOMALY_WINDOW NK_LP expr_or_subquery NK_RP */ { yymsp[-3].minor.yy974 = createAnomalyWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy974), NULL); } -#line 9111 "sql.c" break; - case 723: /* twindow_clause_opt ::= ANOMALY_WINDOW NK_LP expr_or_subquery NK_COMMA NK_STRING NK_RP */ -#line 1522 "sql.y" + case 724: /* twindow_clause_opt ::= ANOMALY_WINDOW NK_LP expr_or_subquery NK_COMMA NK_STRING NK_RP */ { yymsp[-5].minor.yy974 = createAnomalyWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy974), &yymsp[-1].minor.yy0); } -#line 9116 "sql.c" break; - case 730: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ -#line 1532 "sql.y" + case 731: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ { yymsp[-3].minor.yy974 = createFillNode(pCxt, yymsp[-1].minor.yy102, NULL); } -#line 9121 "sql.c" break; - case 731: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ -#line 1533 "sql.y" + case 732: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ { yymsp[-5].minor.yy974 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy946)); } -#line 9126 "sql.c" break; - case 732: /* fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ -#line 1534 "sql.y" + case 733: /* fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ { yymsp[-5].minor.yy974 = createFillNode(pCxt, FILL_MODE_VALUE_F, createNodeListNode(pCxt, yymsp[-1].minor.yy946)); } -#line 9131 "sql.c" break; - case 733: /* fill_mode ::= NONE */ -#line 1538 "sql.y" + case 734: /* fill_mode ::= NONE */ { yymsp[0].minor.yy102 = FILL_MODE_NONE; } -#line 9136 "sql.c" break; - case 734: /* fill_mode ::= PREV */ -#line 1539 "sql.y" + case 735: /* fill_mode ::= PREV */ { yymsp[0].minor.yy102 = FILL_MODE_PREV; } -#line 9141 "sql.c" break; - case 735: /* fill_mode ::= NULL */ -#line 1540 "sql.y" + case 736: /* fill_mode ::= NULL */ { yymsp[0].minor.yy102 = FILL_MODE_NULL; } -#line 9146 "sql.c" break; - case 736: /* fill_mode ::= NULL_F */ -#line 1541 "sql.y" + case 737: /* fill_mode ::= NULL_F */ { yymsp[0].minor.yy102 = FILL_MODE_NULL_F; } -#line 9151 "sql.c" break; - case 737: /* fill_mode ::= LINEAR */ -#line 1542 "sql.y" + case 738: /* fill_mode ::= LINEAR */ { yymsp[0].minor.yy102 = FILL_MODE_LINEAR; } -#line 9156 "sql.c" break; - case 738: /* fill_mode ::= NEXT */ -#line 1543 "sql.y" + case 739: /* fill_mode ::= NEXT */ { yymsp[0].minor.yy102 = FILL_MODE_NEXT; } -#line 9161 "sql.c" break; - case 741: /* group_by_list ::= expr_or_subquery */ -#line 1552 "sql.y" + case 742: /* group_by_list ::= expr_or_subquery */ { yylhsminor.yy946 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy974))); } -#line 9166 "sql.c" yymsp[0].minor.yy946 = yylhsminor.yy946; break; - case 742: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ -#line 1553 "sql.y" + case 743: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ { yylhsminor.yy946 = addNodeToList(pCxt, yymsp[-2].minor.yy946, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy974))); } -#line 9172 "sql.c" yymsp[-2].minor.yy946 = yylhsminor.yy946; break; - case 746: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ -#line 1560 "sql.y" + case 747: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ { yymsp[-5].minor.yy974 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy974), releaseRawExprNode(pCxt, yymsp[-1].minor.yy974)); } -#line 9178 "sql.c" break; - case 747: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ -#line 1562 "sql.y" + case 748: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ { yymsp[-3].minor.yy974 = createInterpTimePoint(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy974)); } -#line 9183 "sql.c" break; - case 750: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ -#line 1569 "sql.y" + case 751: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ { yylhsminor.yy974 = addOrderByClause(pCxt, yymsp[-3].minor.yy974, yymsp[-2].minor.yy946); yylhsminor.yy974 = addSlimitClause(pCxt, yylhsminor.yy974, yymsp[-1].minor.yy974); yylhsminor.yy974 = addLimitClause(pCxt, yylhsminor.yy974, yymsp[0].minor.yy974); } -#line 9192 "sql.c" yymsp[-3].minor.yy974 = yylhsminor.yy974; break; - case 753: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ -#line 1579 "sql.y" + case 754: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ { yylhsminor.yy974 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy974, yymsp[0].minor.yy974); } -#line 9198 "sql.c" yymsp[-3].minor.yy974 = yylhsminor.yy974; break; - case 754: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ -#line 1581 "sql.y" + case 755: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ { yylhsminor.yy974 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy974, yymsp[0].minor.yy974); } -#line 9204 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; - case 763: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - case 767: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==767); -#line 1596 "sql.y" + case 764: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + case 768: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==768); { yymsp[-3].minor.yy974 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } -#line 9211 "sql.c" break; - case 764: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - case 768: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==768); -#line 1597 "sql.y" + case 765: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + case 769: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==769); { yymsp[-3].minor.yy974 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } -#line 9217 "sql.c" break; - case 769: /* subquery ::= NK_LP query_expression NK_RP */ -#line 1605 "sql.y" + case 770: /* subquery ::= NK_LP query_expression NK_RP */ { yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy974); } -#line 9222 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; - case 774: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ -#line 1619 "sql.y" + case 775: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ { yylhsminor.yy974 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), yymsp[-1].minor.yy410, yymsp[0].minor.yy307); } -#line 9228 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; - case 775: /* ordering_specification_opt ::= */ -#line 1623 "sql.y" + case 776: /* ordering_specification_opt ::= */ { yymsp[1].minor.yy410 = ORDER_ASC; } -#line 9234 "sql.c" break; - case 776: /* ordering_specification_opt ::= ASC */ -#line 1624 "sql.y" + case 777: /* ordering_specification_opt ::= ASC */ { yymsp[0].minor.yy410 = ORDER_ASC; } -#line 9239 "sql.c" break; - case 777: /* ordering_specification_opt ::= DESC */ -#line 1625 "sql.y" + case 778: /* ordering_specification_opt ::= DESC */ { yymsp[0].minor.yy410 = ORDER_DESC; } -#line 9244 "sql.c" break; - case 778: /* null_ordering_opt ::= */ -#line 1629 "sql.y" + case 779: /* null_ordering_opt ::= */ { yymsp[1].minor.yy307 = NULL_ORDER_DEFAULT; } -#line 9249 "sql.c" break; - case 779: /* null_ordering_opt ::= NULLS FIRST */ -#line 1630 "sql.y" + case 780: /* null_ordering_opt ::= NULLS FIRST */ { yymsp[-1].minor.yy307 = NULL_ORDER_FIRST; } -#line 9254 "sql.c" break; - case 780: /* null_ordering_opt ::= NULLS LAST */ -#line 1631 "sql.y" + case 781: /* null_ordering_opt ::= NULLS LAST */ { yymsp[-1].minor.yy307 = NULL_ORDER_LAST; } -#line 9259 "sql.c" break; - case 783: /* column_options ::= column_options NK_ID NK_STRING */ -#line 1639 "sql.y" + case 784: /* column_options ::= column_options NK_ID NK_STRING */ { yylhsminor.yy974 = setColumnOptions(pCxt, yymsp[-2].minor.yy974, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } -#line 9264 "sql.c" yymsp[-2].minor.yy974 = yylhsminor.yy974; break; default: @@ -9324,7 +7863,6 @@ static void yy_syntax_error( ParseCTX_FETCH #define TOKEN yyminor /************ Begin %syntax_error code ****************************************/ -#line 29 "sql.y" if (TSDB_CODE_SUCCESS == pCxt->errCode) { if(TOKEN.z) { @@ -9335,7 +7873,6 @@ static void yy_syntax_error( } else if (TSDB_CODE_PAR_DB_NOT_SPECIFIED == pCxt->errCode && TK_NK_FLOAT == TOKEN.type) { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_SYNTAX_ERROR, TOKEN.z); } -#line 9338 "sql.c" /************ End %syntax_error code ******************************************/ ParseARG_STORE /* Suppress warning about unused %extra_argument variable */ ParseCTX_STORE From 689cdd4e441acfd3e52f08ce21bff8d6ef0fe324 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Tue, 29 Oct 2024 21:33:36 +0800 Subject: [PATCH 414/695] test: add dnodes cases --- source/common/src/tmsg.c | 2 - source/libs/parser/src/parTranslater.c | 1 - tests/script/tsim/db/dnodelist.sim | 258 +++++++++++++++++++++++++ 3 files changed, 258 insertions(+), 3 deletions(-) create mode 100644 tests/script/tsim/db/dnodelist.sim diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index 62583fd77768..6cbf3665a727 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -4017,7 +4017,6 @@ int32_t tSerializeSAlterDbReq(void *buf, int32_t bufLen, SAlterDbReq *pReq) { ENCODESQL(); TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->withArbitrator)); - tEndEncode(&encoder); _exit: @@ -4085,7 +4084,6 @@ int32_t tDeserializeSAlterDbReq(void *buf, int32_t bufLen, SAlterDbReq *pReq) { if (!tDecodeIsEnd(&decoder)) { TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->withArbitrator)); } - tEndDecode(&decoder); _exit: diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 67ffde66acde..dd3cadc104d0 100755 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -8240,7 +8240,6 @@ static int32_t buildAlterDbReq(STranslateContext* pCxt, SAlterDatabaseStmt* pStm pReq->s3KeepLocal = pStmt->pOptions->s3KeepLocal; pReq->s3Compact = pStmt->pOptions->s3Compact; pReq->withArbitrator = pStmt->pOptions->withArbitrator; - return code; } diff --git a/tests/script/tsim/db/dnodelist.sim b/tests/script/tsim/db/dnodelist.sim new file mode 100644 index 000000000000..08bf08a1fef3 --- /dev/null +++ b/tests/script/tsim/db/dnodelist.sim @@ -0,0 +1,258 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/deploy.sh -n dnode2 -i 2 +system sh/deploy.sh -n dnode3 -i 3 +system sh/deploy.sh -n dnode4 -i 4 +system sh/deploy.sh -n dnode5 -i 5 +system sh/exec.sh -n dnode1 -s start +system sh/exec.sh -n dnode2 -s start +system sh/exec.sh -n dnode3 -s start +system sh/exec.sh -n dnode4 -s start +system sh/exec.sh -n dnode5 -s start + +sql connect +sql create dnode $hostname port 7200 +sql create dnode $hostname port 7300 +sql create dnode $hostname port 7400 +sql create dnode $hostname port 7500 + +$x = 0 +step1: + $x = $x + 1 + sleep 1000 + if $x == 10 then + print ====> dnode not ready! + return -1 + endi +sql select * from information_schema.ins_dnodes +print ===> $data00 $data01 $data02 $data03 $data04 $data05 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 +print ===> $data20 $data21 $data22 $data23 $data24 $data25 +print ===> $data30 $data31 $data32 $data33 $data34 $data35 +print ===> $data40 $data41 $data42 $data43 $data44 $data45 +if $rows != 5 then + return -1 +endi +if $data(1)[4] != ready then + goto step1 +endi +if $data(2)[4] != ready then + goto step1 +endi +if $data(3)[4] != ready then + goto step1 +endi +if $data(4)[4] != ready then + goto step1 +endi +if $data(5)[4] != ready then + goto step1 +endi + +print --- error case + +sql_error create database d1 vgroups 1 dnodes '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'; +sql_error create database d1 vgroups 1 dnodes '1 '; +sql_error create database d1 vgroups 1 dnodes ' 1'; +sql_error create database d1 vgroups 1 dnodes '1,'; +sql_error create database d1 vgroups 1 dnodes '1, '; +sql_error create database d1 vgroups 1 dnodes 'a '; +sql_error create database d1 vgroups 1 dnodes '- '; +sql_error create database d1 vgroups 1 dnodes '1,1'; +sql_error create database d1 vgroups 1 dnodes '1, 1'; +sql_error create database d1 vgroups 1 dnodes '1,1234567890'; +sql_error create database d1 vgroups 1 dnodes '1,2,6'; +sql_error create database d1 vgroups 1 dnodes ',1,2'; +sql_error create database d1 vgroups 1 dnodes 'x1,2'; +sql_error create database d1 vgroups 1 dnodes 'c1,ab2'; +sql_error create database d1 vgroups 1 dnodes '1,1,2'; + +sql_error create database d1 vgroups 1 replica 2 dnodes '1'; +sql_error create database d1 vgroups 1 replica 2 dnodes '1,8'; +sql_error create database d1 vgroups 1 replica 3 dnodes '1'; +sql_error create database d1 vgroups 1 replica 3 dnodes '1,2'; +sql_error create database d1 vgroups 1 replica 3 dnodes '1,2,4,6'; + +print --- replica 1 + +print --- case10 +sql create database d10 vgroups 1 dnodes '1'; +sql show dnodes; +if $data(1)[2] != 1 then + return -1 +endi +sql_error alter database d10 replica 1 dnodes '1,2,3'; +sql drop database d10; + +print --- case11 +sql create database d11 vgroups 1 dnodes '2'; +sql show dnodes; +if $data(2)[2] != 1 then + return -1 +endi +sql drop database d11; + +print --- case12 +sql create database d12 vgroups 2 dnodes '3,4'; +sql show dnodes; +if $data(3)[2] != 1 then + return -1 +endi +if $data(4)[2] != 1 then + return -1 +endi +sql drop database d12; + +print --- case13 +sql create database d13 vgroups 2 dnodes '5'; +sql show dnodes; +if $data(5)[2] != 2 then + return -1 +endi +sql drop database d13; + +print --- case14 +sql create database d14 vgroups 1 dnodes '1,2,5'; +sql drop database d14; + +print --- case15 +sql create database d15 vgroups 2 dnodes '1,4,3'; +sql drop database d15; + +print --- case16 +sql create database d16 vgroups 3 dnodes '1'; +sql show dnodes; +if $data(1)[2] != 3 then + return -1 +endi +sql drop database d16; + +print --- case17 +sql create database d17 vgroups 3 dnodes '1,4'; +sql drop database d17; + +print --- case18 +sql create database d18 vgroups 3 dnodes '1,2,4'; +sql show dnodes; +if $data(1)[2] != 1 then + return -1 +endi +if $data(2)[2] != 1 then + return -1 +endi +if $data(4)[2] != 1 then + return -1 +endi +sql drop database d18; + +print --- replica 2 + +print --- case20 +sql create database d20 replica 2 vgroups 1 dnodes '1,2'; +sql show dnodes; +if $data(1)[2] != 1 then + return -1 +endi +if $data(2)[2] != 1 then + return -1 +endi +sql drop database d20; + +print --- case21 +sql create database d21 replica 2 vgroups 3 dnodes '1,2,3'; +sql show dnodes; +if $data(1)[2] != 2 then + return -1 +endi +if $data(2)[2] != 2 then + return -1 +endi +if $data(3)[2] != 2 then + return -1 +endi +sql drop database d21; + +print --- case22 +sql create database d22 replica 2 vgroups 2 dnodes '1,2'; +sql show dnodes; +if $data(1)[2] != 2 then + return -1 +endi +if $data(2)[2] != 2 then + return -1 +endi +sql drop database d22; + +print --- replica 3 + +print --- case30 +sql create database d30 replica 3 vgroups 3 dnodes '1,2,3'; +sql show dnodes; +if $data(1)[2] != 3 then + return -1 +endi +if $data(2)[2] != 3 then + return -1 +endi +if $data(3)[2] != 3 then + return -1 +endi +sql_error alter database d30 replica 1 dnodes '1'; +sql drop database d30; + +print --- case31 +sql create database d31 replica 3 vgroups 2 dnodes '1,2,4'; +sql show dnodes; +if $data(1)[2] != 2 then + return -1 +endi +if $data(2)[2] != 2 then + return -1 +endi +if $data(4)[2] != 2 then + return -1 +endi +sql drop database d31; + +print --- case32 +sql create database d32 replica 3 vgroups 4 dnodes '4,2,3,1'; +sql show dnodes; +if $data(1)[2] != 3 then + return -1 +endi +if $data(2)[2] != 3 then + return -1 +endi +if $data(3)[2] != 3 then + return -1 +endi +if $data(4)[2] != 3 then + return -1 +endi +sql drop database d32; + +print --- case33 +sql create database d33 replica 3 vgroups 5 dnodes '4,2,3,1,5'; +sql show dnodes; +if $data(1)[2] != 3 then + return -1 +endi +if $data(2)[2] != 3 then + return -1 +endi +if $data(3)[2] != 3 then + return -1 +endi +if $data(4)[2] != 3 then + return -1 +endi +if $data(5)[2] != 3 then + return -1 +endi +sql drop database d33; + +return + +system sh/exec.sh -n dnode1 -s stop -x SIGINT +system sh/exec.sh -n dnode2 -s stop -x SIGINT +system sh/exec.sh -n dnode3 -s stop -x SIGINT From 439032092a507411d7a42017b398dee423375aca Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Tue, 29 Oct 2024 21:38:05 +0800 Subject: [PATCH 415/695] doc: minor changes --- docs/zh/04-get-started/01-docker.md | 2 +- docs/zh/04-get-started/03-package.md | 2 +- docs/zh/04-get-started/_07-use.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/zh/04-get-started/01-docker.md b/docs/zh/04-get-started/01-docker.md index 848a7fd499d6..4bd932259537 100644 --- a/docs/zh/04-get-started/01-docker.md +++ b/docs/zh/04-get-started/01-docker.md @@ -121,4 +121,4 @@ SELECT AVG(current), MAX(voltage), MIN(phase) FROM test.meters WHERE groupId = 1 SELECT _wstart, AVG(current), MAX(voltage), MIN(phase) FROM test.d1001 INTERVAL(10s); ``` -在上面的查询中,使用系统提供的伪列_wstart 来给出每个窗口的开始时间。 +在上面的查询中,使用系统提供的伪列 _wstart 来给出每个窗口的开始时间。 diff --git a/docs/zh/04-get-started/03-package.md b/docs/zh/04-get-started/03-package.md index 2a1f594b4fa1..dcc5c58d1747 100644 --- a/docs/zh/04-get-started/03-package.md +++ b/docs/zh/04-get-started/03-package.md @@ -317,4 +317,4 @@ SELECT AVG(current), MAX(voltage), MIN(phase) FROM test.meters WHERE groupId = 1 SELECT _wstart, AVG(current), MAX(voltage), MIN(phase) FROM test.d1001 INTERVAL(10s); ``` -在上面的查询中,使用系统提供的伪列_wstart 来给出每个窗口的开始时间。 \ No newline at end of file +在上面的查询中,使用系统提供的伪列 _wstart 来给出每个窗口的开始时间。 \ No newline at end of file diff --git a/docs/zh/04-get-started/_07-use.md b/docs/zh/04-get-started/_07-use.md index d206ed410226..8c976e9b55ed 100644 --- a/docs/zh/04-get-started/_07-use.md +++ b/docs/zh/04-get-started/_07-use.md @@ -54,4 +54,4 @@ SELECT AVG(current), MAX(voltage), MIN(phase) FROM test.meters WHERE groupId = 1 SELECT _wstart, AVG(current), MAX(voltage), MIN(phase) FROM test.d1001 INTERVAL(10s); ``` -在上面的查询中,使用系统提供的伪列_wstart 来给出每个窗口的开始时间。 \ No newline at end of file +在上面的查询中,使用系统提供的伪列 _wstart 来给出每个窗口的开始时间。 \ No newline at end of file From 62fbb62b9ce036ab47c148f5a162df8c0e482567 Mon Sep 17 00:00:00 2001 From: xsren <285808407@qq.com> Date: Tue, 29 Oct 2024 23:06:57 +0800 Subject: [PATCH 416/695] fix: merge conflict --- source/libs/command/src/command.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/source/libs/command/src/command.c b/source/libs/command/src/command.c index 2f44da6c4fe7..6272ac7049ac 100644 --- a/source/libs/command/src/command.c +++ b/source/libs/command/src/command.c @@ -52,8 +52,6 @@ static int32_t buildRetrieveTableRsp(SSDataBlock* pBlock, int32_t numOfCols, SRe int32_t len = blockEncode(pBlock, (*pRsp)->data + PAYLOAD_PREFIX_LEN, dataEncodeBufSize, numOfCols); if(len < 0) { - int32_t len = blockEncode(pBlock, (*pRsp)->data + PAYLOAD_PREFIX_LEN, dataEncodeBufSize, numOfCols); - if (len < 0) { taosMemoryFree(*pRsp); return terrno; } From d4b0550a01fc787d8e92c84caafc2f4145ab3430 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Tue, 29 Oct 2024 20:04:37 +0800 Subject: [PATCH 417/695] fix double free --- source/libs/transport/src/transCli.c | 34 +++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index c3e214b5e3be..4887240f5db2 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -1300,12 +1300,22 @@ static void cliBatchSendCb(uv_write_t* req, int status) { SCliThrd* pThrd = conn->hostThrd; STrans* pInst = pThrd->pInst; + while (!QUEUE_IS_EMPTY(&wrapper->node)) { + queue* h = QUEUE_HEAD(&wrapper->node); + QUEUE_REMOVE(h); + + SCliReq* pReq = QUEUE_DATA(h, SCliReq, q); + transQueuePush(&conn->reqsSentOut, &pReq->q); + } + QUEUE_INIT(&wrapper->node); + freeWReqToWQ(&conn->wq, wrapper); int32_t ref = transUnrefCliHandle(conn); if (ref <= 0) { return; } + cliConnRmReqs(conn); if (status != 0) { tDebug("%s conn %p failed to send msg since %s", CONN_GET_INST_LABEL(conn), conn, uv_err_name(status)); @@ -1398,6 +1408,10 @@ int32_t cliBatchSend(SCliConn* pConn, int8_t direct) { int j = 0; int32_t batchLimit = 64; + + queue reqToSend; + QUEUE_INIT(&reqToSend); + while (!transQueueEmpty(&pConn->reqsToSend)) { queue* h = transQueuePop(&pConn->reqsToSend); SCliReq* pCliMsg = QUEUE_DATA(h, SCliReq, q); @@ -1453,24 +1467,42 @@ int32_t cliBatchSend(SCliConn* pConn, int8_t direct) { STraceId* trace = &pCliMsg->msg.info.traceId; tGDebug("%s conn %p %s is sent to %s, local info:%s, seq:%" PRId64 ", sid:%" PRId64 "", CONN_GET_INST_LABEL(pConn), pConn, TMSG_INFO(pReq->msgType), pConn->dst, pConn->src, pConn->seq, pReq->info.qId); - transQueuePush(&pConn->reqsSentOut, &pCliMsg->q); + + QUEUE_PUSH(&reqToSend, &pCliMsg->q); if (j >= batchLimit) { break; } } transRefCliHandle(pConn); uv_write_t* req = allocWReqFromWQ(&pConn->wq, pConn); + if (req == NULL) { tError("%s conn %p failed to send msg since %s", CONN_GET_INST_LABEL(pConn), pConn, tstrerror(terrno)); + while (!QUEUE_IS_EMPTY(&reqToSend)) { + queue* h = QUEUE_HEAD(&reqToSend); + QUEUE_REMOVE(h); + SCliReq* pReq = QUEUE_DATA(h, SCliReq, q); + transQueuePush(&pConn->reqsToSend, &pReq->q); + } transRefCliHandle(pConn); return terrno; } + SWReqsWrapper* pWreq = req->data; + QUEUE_MOVE(&reqToSend, &pWreq->node); tDebug("%s conn %p start to send msg, batch size:%d, len:%d", CONN_GET_INST_LABEL(pConn), pConn, j, totalLen); int32_t ret = uv_write(req, (uv_stream_t*)pConn->stream, wb, j, cliBatchSendCb); if (ret != 0) { tError("%s conn %p failed to send msg since %s", CONN_GET_INST_LABEL(pConn), pConn, uv_err_name(ret)); + while (!QUEUE_IS_EMPTY(&pWreq->node)) { + queue* h = QUEUE_HEAD(&pWreq->node); + QUEUE_REMOVE(h); + SCliReq* pReq = QUEUE_DATA(h, SCliReq, q); + transQueuePush(&pConn->reqsToSend, &pReq->q); + } + QUEUE_INIT(&pWreq->node); + freeWReqToWQ(&pConn->wq, req->data); code = TSDB_CODE_THIRDPARTY_ERROR; TAOS_UNUSED(transUnrefCliHandle(pConn)); From f0ec5736113153a0618f532611373c0b63c50b4d Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Tue, 29 Oct 2024 20:23:28 +0800 Subject: [PATCH 418/695] fix double free --- source/libs/transport/src/transCli.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index 4887240f5db2..eda45f3d6bd4 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -1307,8 +1307,6 @@ static void cliBatchSendCb(uv_write_t* req, int status) { SCliReq* pReq = QUEUE_DATA(h, SCliReq, q); transQueuePush(&conn->reqsSentOut, &pReq->q); } - QUEUE_INIT(&wrapper->node); - freeWReqToWQ(&conn->wq, wrapper); int32_t ref = transUnrefCliHandle(conn); @@ -1501,8 +1499,6 @@ int32_t cliBatchSend(SCliConn* pConn, int8_t direct) { SCliReq* pReq = QUEUE_DATA(h, SCliReq, q); transQueuePush(&pConn->reqsToSend, &pReq->q); } - QUEUE_INIT(&pWreq->node); - freeWReqToWQ(&pConn->wq, req->data); code = TSDB_CODE_THIRDPARTY_ERROR; TAOS_UNUSED(transUnrefCliHandle(pConn)); From 6b5e64dc8e8d7a900703a4d0cfe80acb7e1fa54d Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Wed, 30 Oct 2024 09:13:07 +0800 Subject: [PATCH 419/695] fix(stream): adjust start timer position. --- source/libs/stream/src/streamHb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/libs/stream/src/streamHb.c b/source/libs/stream/src/streamHb.c index 19391bf7a05f..65102edc245d 100644 --- a/source/libs/stream/src/streamHb.c +++ b/source/libs/stream/src/streamHb.c @@ -316,12 +316,13 @@ int32_t createMetaHbInfo(int64_t* pRid, SMetaHbInfo** pRes) { return terrno; } - streamTmrStart(streamMetaHbToMnode, META_HB_CHECK_INTERVAL, pRid, streamTimer, &pInfo->hbTmr, 0, "stream-hb"); pInfo->tickCounter = 0; pInfo->msgSendTs = -1; pInfo->hbCount = 0; *pRes = pInfo; + + streamTmrStart(streamMetaHbToMnode, META_HB_CHECK_INTERVAL, pRid, streamTimer, &pInfo->hbTmr, 0, "stream-hb"); return TSDB_CODE_SUCCESS; } From e618a04e510e2b83f0cb929d3fac85656d7a2f9b Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Wed, 30 Oct 2024 09:13:07 +0800 Subject: [PATCH 420/695] fix(stream): adjust start timer position. --- source/libs/stream/src/streamHb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/libs/stream/src/streamHb.c b/source/libs/stream/src/streamHb.c index 19391bf7a05f..65102edc245d 100644 --- a/source/libs/stream/src/streamHb.c +++ b/source/libs/stream/src/streamHb.c @@ -316,12 +316,13 @@ int32_t createMetaHbInfo(int64_t* pRid, SMetaHbInfo** pRes) { return terrno; } - streamTmrStart(streamMetaHbToMnode, META_HB_CHECK_INTERVAL, pRid, streamTimer, &pInfo->hbTmr, 0, "stream-hb"); pInfo->tickCounter = 0; pInfo->msgSendTs = -1; pInfo->hbCount = 0; *pRes = pInfo; + + streamTmrStart(streamMetaHbToMnode, META_HB_CHECK_INTERVAL, pRid, streamTimer, &pInfo->hbTmr, 0, "stream-hb"); return TSDB_CODE_SUCCESS; } From 1dfad47bfa91ce403ec769be51ee19b48f0fc0cf Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Wed, 30 Oct 2024 10:01:23 +0800 Subject: [PATCH 421/695] fix quit error --- source/libs/transport/src/transCli.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index eda45f3d6bd4..8255956f620f 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -1246,8 +1246,8 @@ static void cliHandleException(SCliConn* conn) { } cliDestroyAllQidFromThrd(conn); - QUEUE_REMOVE(&conn->q); - if (conn->list) { + if (pThrd->quit == false && conn->list) { + QUEUE_REMOVE(&conn->q); conn->list->totalSize -= 1; conn->list = NULL; } From 8b4b7c141e1d2adedf9b0b3e40194e8812cea7e6 Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Wed, 30 Oct 2024 10:22:19 +0800 Subject: [PATCH 422/695] fix schema update with sver param --- source/dnode/vnode/src/tsdb/tsdbCache.c | 76 ++++++++++++------------- source/util/src/tlrucache.c | 20 +++++-- 2 files changed, 51 insertions(+), 45 deletions(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbCache.c b/source/dnode/vnode/src/tsdb/tsdbCache.c index 801e89c2b616..16812b16f4a1 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCache.c +++ b/source/dnode/vnode/src/tsdb/tsdbCache.c @@ -1136,19 +1136,17 @@ static int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, SArray (void)taosThreadMutexLock(&pTsdb->lruMutex); for (int i = 0; i < num_keys; ++i) { - SLastUpdateCtx *updCtx = (SLastUpdateCtx *)taosArrayGet(updCtxArray, i); - - int8_t lflag = updCtx->lflag; - SRowKey *pRowKey = &updCtx->tsdbRowKey.key; - SColVal *pColVal = &updCtx->colVal; + SLastUpdateCtx *updCtx = &((SLastUpdateCtx *)TARRAY_DATA(updCtxArray))[i]; + int8_t lflag = updCtx->lflag; + SRowKey *pRowKey = &updCtx->tsdbRowKey.key; + SColVal *pColVal = &updCtx->colVal; if (lflag == LFLAG_LAST && !COL_VAL_IS_VALUE(pColVal)) { continue; } SLastKey *key = &(SLastKey){.lflag = lflag, .uid = uid, .cid = pColVal->cid}; - size_t klen = ROCKS_KEY_LEN; - LRUHandle *h = taosLRUCacheLookup(pCache, key, klen); + LRUHandle *h = taosLRUCacheLookup(pCache, key, ROCKS_KEY_LEN); if (h) { SLastCol *pLastCol = (SLastCol *)taosLRUCacheValue(pCache, h); if (pLastCol->cacheStatus != TSDB_LAST_CACHE_NO_CACHE) { @@ -1304,28 +1302,30 @@ static int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, SArray TAOS_RETURN(code); } -void tsdbCacheInvalidateSchema(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid) { - if (suid) { - if (pTsdb->rCache.suid == suid) { +void tsdbCacheInvalidateSchema(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, int32_t sver) { + if (pTsdb->rCache.pTSchema && pTsdb->rCache.suid == suid) { + if (pTsdb->rCache.suid && sver == pTsdb->rCache.sver) { + pTsdb->rCache.sver = -1; pTsdb->rCache.suid = -1; + } else if (pTsdb->rCache.uid == uid && pTsdb->rCache.sver == sver) { + pTsdb->rCache.sver = -1; + pTsdb->rCache.uid = -1; } - } else if (pTsdb->rCache.uid == uid) { - pTsdb->rCache.uid = -1; } } -static int32_t tsdbUpdateSkm(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid) { - if (suid) { - if (pTsdb->rCache.suid == suid) { - pTsdb->rCache.uid = uid; +static int32_t tsdbUpdateSkm(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, int32_t sver) { + if (pTsdb->rCache.pTSchema && pTsdb->rCache.suid == suid) { + if (pTsdb->rCache.suid && sver == pTsdb->rCache.sver) { + return 0; + } else if (pTsdb->rCache.uid == uid && pTsdb->rCache.sver == sver) { return 0; } - } else if (pTsdb->rCache.uid == uid) { - return 0; } pTsdb->rCache.suid = suid; pTsdb->rCache.uid = uid; + pTsdb->rCache.sver = sver; tDestroyTSchema(pTsdb->rCache.pTSchema); return metaGetTbTSchemaEx(pTsdb->pVnode->pMeta, suid, uid, -1, &pTsdb->rCache.pTSchema); } @@ -1335,36 +1335,27 @@ int32_t tsdbCacheRowFormatUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, int6 int32_t code = 0, lino = 0; // 1. prepare last - TSDBROW lRow = {.type = TSDBROW_ROW_FMT, .pTSRow = aRow[nRow - 1], .version = version}; - + TSDBROW lRow = {.type = TSDBROW_ROW_FMT, .pTSRow = aRow[nRow - 1], .version = version}; STSchema *pTSchema = NULL; int32_t sver = TSDBROW_SVERSION(&lRow); SArray *ctxArray = NULL; SSHashObj *iColHash = NULL; - TAOS_CHECK_GOTO(tsdbUpdateSkm(pTsdb, suid, uid), &lino, _exit); + TAOS_CHECK_GOTO(tsdbUpdateSkm(pTsdb, suid, uid, sver), &lino, _exit); pTSchema = pTsdb->rCache.pTSchema; - /* - TAOS_CHECK_GOTO(metaGetTbTSchemaEx(pTsdb->pVnode->pMeta, suid, uid, sver, &pTSchema), &lino, _exit); - */ TSDBROW tRow = {.type = TSDBROW_ROW_FMT, .version = version}; int32_t nCol = pTSchema->numOfCols; - ctxArray = taosArrayInit(nCol, sizeof(SLastUpdateCtx)); - iColHash = tSimpleHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT)); + ctxArray = taosArrayInit(nCol * 2, sizeof(SLastUpdateCtx)); // 1. prepare by lrow STsdbRowKey tsdbRowKey = {0}; tsdbRowGetKey(&lRow, &tsdbRowKey); STSDBRowIter iter = {0}; - code = tsdbRowIterOpen(&iter, &lRow, pTSchema); - if (code != TSDB_CODE_SUCCESS) { - tsdbError("vgId:%d, %s tsdbRowIterOpen failed at line %d since %s", TD_VID(pTsdb->pVnode), __func__, __LINE__, - tstrerror(code)); - TAOS_CHECK_GOTO(code, &lino, _exit); - } + TAOS_CHECK_GOTO(tsdbRowIterOpen(&iter, &lRow, pTSchema), &lino, _exit); + int32_t iCol = 0; for (SColVal *pColVal = tsdbRowIterNext(&iter); pColVal && iCol < nCol; pColVal = tsdbRowIterNext(&iter), iCol++) { SLastUpdateCtx updateCtx = {.lflag = LFLAG_LAST_ROW, .tsdbRowKey = tsdbRowKey, .colVal = *pColVal}; @@ -1372,15 +1363,19 @@ int32_t tsdbCacheRowFormatUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, int6 TAOS_CHECK_GOTO(terrno, &lino, _exit); } - if (!COL_VAL_IS_VALUE(pColVal)) { + if (COL_VAL_IS_VALUE(pColVal)) { + updateCtx.lflag = LFLAG_LAST; + if (!taosArrayPush(ctxArray, &updateCtx)) { + TAOS_CHECK_GOTO(terrno, &lino, _exit); + } + } else { + if (!iColHash) { + iColHash = tSimpleHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT)); + } + if (tSimpleHashPut(iColHash, &iCol, sizeof(iCol), NULL, 0)) { TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit); } - continue; - } - updateCtx.lflag = LFLAG_LAST; - if (!taosArrayPush(ctxArray, &updateCtx)) { - TAOS_CHECK_GOTO(terrno, &lino, _exit); } } tsdbRowClose(&iter); @@ -1425,7 +1420,10 @@ int32_t tsdbCacheRowFormatUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, int6 } _exit: - // taosMemoryFreeClear(pTSchema); + if (code) { + tsdbError("vgId:%d, %s failed at line %d since %s", TD_VID(pTsdb->pVnode), __func__, __LINE__, tstrerror(code)); + } + taosArrayDestroy(ctxArray); tSimpleHashCleanup(iColHash); diff --git a/source/util/src/tlrucache.c b/source/util/src/tlrucache.c index 92dcf015a612..160808f9563c 100644 --- a/source/util/src/tlrucache.c +++ b/source/util/src/tlrucache.c @@ -14,12 +14,12 @@ */ #define _DEFAULT_SOURCE +#include "tlrucache.h" #include "os.h" #include "taoserror.h" #include "tarray.h" #include "tdef.h" #include "tlog.h" -#include "tlrucache.h" #include "tutil.h" typedef struct SLRUEntry SLRUEntry; @@ -110,7 +110,7 @@ struct SLRUEntryTable { }; static int taosLRUEntryTableInit(SLRUEntryTable *table, int maxUpperHashBits) { - table->lengthBits = 4; + table->lengthBits = 16; table->list = taosMemoryCalloc(1 << table->lengthBits, sizeof(SLRUEntry *)); if (!table->list) { TAOS_RETURN(terrno); @@ -168,7 +168,14 @@ static SLRUEntry **taosLRUEntryTableFindPtr(SLRUEntryTable *table, const void *k while (*entry && ((*entry)->hash != hash || memcmp(key, (*entry)->keyData, keyLen) != 0)) { entry = &(*entry)->nextHash; } - + /* + SLRUEntry *pentry = table->list[hash >> (32 - table->lengthBits)]; + SLRUEntry **entry = &table->list[hash >> (32 - table->lengthBits)]; + while (pentry && (pentry->hash != hash || memcmp(key, pentry->keyData, keyLen) != 0)) { + entry = &pentry->nextHash; + pentry = *entry; + } + */ return entry; } @@ -371,9 +378,9 @@ static void taosLRUCacheShardCleanup(SLRUCacheShard *shard) { static LRUStatus taosLRUCacheShardInsertEntry(SLRUCacheShard *shard, SLRUEntry *e, LRUHandle **handle, bool freeOnFail) { - LRUStatus status = TAOS_LRU_STATUS_OK; + LRUStatus status = TAOS_LRU_STATUS_OK; SLRUEntry *toFree = NULL; - SArray *lastReferenceList = NULL; + SArray *lastReferenceList = NULL; if (shard->usage + e->totalCharge > shard->capacity) { lastReferenceList = taosArrayInit(16, POINTER_BYTES); if (!lastReferenceList) { @@ -744,7 +751,8 @@ void taosLRUCacheCleanup(SLRUCache *cache) { } LRUStatus taosLRUCacheInsert(SLRUCache *cache, const void *key, size_t keyLen, void *value, size_t charge, - _taos_lru_deleter_t deleter, _taos_lru_overwriter_t overwriter, LRUHandle **handle, LRUPriority priority, void *ud) { + _taos_lru_deleter_t deleter, _taos_lru_overwriter_t overwriter, LRUHandle **handle, + LRUPriority priority, void *ud) { uint32_t hash = TAOS_LRU_CACHE_SHARD_HASH32(key, keyLen); uint32_t shardIndex = hash & cache->shardedCache.shardMask; From a3b797031d3799e11be0555b223ca4a2a6833dc6 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Wed, 30 Oct 2024 10:23:28 +0800 Subject: [PATCH 423/695] fix quit error --- source/libs/transport/src/transCli.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index 8255956f620f..9964750d175d 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -3142,7 +3142,7 @@ static int32_t transInitMsg(void* pInstRef, const SEpSet* pEpSet, STransMsg* pRe if (ctx != NULL) pCtx->userCtx = *ctx; pCliReq = taosMemoryCalloc(1, sizeof(SCliReq)); - if (pReq == NULL) { + if (pCliReq == NULL) { TAOS_CHECK_GOTO(terrno, NULL, _exception); } From d8df6db06ab039e47a6356b3870e15454d5d83e9 Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Wed, 30 Oct 2024 10:22:19 +0800 Subject: [PATCH 424/695] fix schema update with sver param --- source/dnode/vnode/src/inc/tsdb.h | 1 + source/dnode/vnode/src/inc/vnodeInt.h | 2 +- source/dnode/vnode/src/meta/metaTable.c | 4 +- source/dnode/vnode/src/tsdb/tsdbCache.c | 76 ++++++++++++------------- source/util/src/tlrucache.c | 20 +++++-- 5 files changed, 55 insertions(+), 48 deletions(-) diff --git a/source/dnode/vnode/src/inc/tsdb.h b/source/dnode/vnode/src/inc/tsdb.h index f1ee5267a1ae..c1123db7a33d 100644 --- a/source/dnode/vnode/src/inc/tsdb.h +++ b/source/dnode/vnode/src/inc/tsdb.h @@ -343,6 +343,7 @@ typedef struct { rocksdb_readoptions_t *readoptions; rocksdb_writebatch_t *writebatch; TdThreadMutex writeBatchMutex; + int32_t sver; tb_uid_t suid; tb_uid_t uid; STSchema *pTSchema; diff --git a/source/dnode/vnode/src/inc/vnodeInt.h b/source/dnode/vnode/src/inc/vnodeInt.h index 7673e562a8a5..98f11086bc1b 100644 --- a/source/dnode/vnode/src/inc/vnodeInt.h +++ b/source/dnode/vnode/src/inc/vnodeInt.h @@ -222,7 +222,7 @@ int32_t tsdbCacheNewSTableColumn(STsdb* pTsdb, SArray* uids, int16_t cid, int8_t int32_t tsdbCacheDropSTableColumn(STsdb* pTsdb, SArray* uids, int16_t cid, bool hasPrimayKey); int32_t tsdbCacheNewNTableColumn(STsdb* pTsdb, int64_t uid, int16_t cid, int8_t col_type); int32_t tsdbCacheDropNTableColumn(STsdb* pTsdb, int64_t uid, int16_t cid, bool hasPrimayKey); -void tsdbCacheInvalidateSchema(STsdb* pTsdb, tb_uid_t suid, tb_uid_t uid); +void tsdbCacheInvalidateSchema(STsdb* pTsdb, tb_uid_t suid, tb_uid_t uid, int32_t sver); int tsdbScanAndConvertSubmitMsg(STsdb* pTsdb, SSubmitReq2* pMsg); int tsdbInsertData(STsdb* pTsdb, int64_t version, SSubmitReq2* pMsg, SSubmitRsp2* pRsp); int32_t tsdbInsertTableData(STsdb* pTsdb, int64_t version, SSubmitTbData* pSubmitTbData, int32_t* affectedRows); diff --git a/source/dnode/vnode/src/meta/metaTable.c b/source/dnode/vnode/src/meta/metaTable.c index f525a28bd6f7..5c3516a962eb 100644 --- a/source/dnode/vnode/src/meta/metaTable.c +++ b/source/dnode/vnode/src/meta/metaTable.c @@ -621,7 +621,7 @@ int metaAlterSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) { } if (uids) taosArrayDestroy(uids); - tsdbCacheInvalidateSchema(pTsdb, pReq->suid, -1); + tsdbCacheInvalidateSchema(pTsdb, pReq->suid, -1, pReq->schemaRow.version); } metaWLock(pMeta); @@ -1948,7 +1948,7 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl } if (!TSDB_CACHE_NO(pMeta->pVnode->config)) { - tsdbCacheInvalidateSchema(pMeta->pVnode->pTsdb, 0, entry.uid); + tsdbCacheInvalidateSchema(pMeta->pVnode->pTsdb, 0, entry.uid, pSchema->version); } entry.version = version; diff --git a/source/dnode/vnode/src/tsdb/tsdbCache.c b/source/dnode/vnode/src/tsdb/tsdbCache.c index 801e89c2b616..16812b16f4a1 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCache.c +++ b/source/dnode/vnode/src/tsdb/tsdbCache.c @@ -1136,19 +1136,17 @@ static int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, SArray (void)taosThreadMutexLock(&pTsdb->lruMutex); for (int i = 0; i < num_keys; ++i) { - SLastUpdateCtx *updCtx = (SLastUpdateCtx *)taosArrayGet(updCtxArray, i); - - int8_t lflag = updCtx->lflag; - SRowKey *pRowKey = &updCtx->tsdbRowKey.key; - SColVal *pColVal = &updCtx->colVal; + SLastUpdateCtx *updCtx = &((SLastUpdateCtx *)TARRAY_DATA(updCtxArray))[i]; + int8_t lflag = updCtx->lflag; + SRowKey *pRowKey = &updCtx->tsdbRowKey.key; + SColVal *pColVal = &updCtx->colVal; if (lflag == LFLAG_LAST && !COL_VAL_IS_VALUE(pColVal)) { continue; } SLastKey *key = &(SLastKey){.lflag = lflag, .uid = uid, .cid = pColVal->cid}; - size_t klen = ROCKS_KEY_LEN; - LRUHandle *h = taosLRUCacheLookup(pCache, key, klen); + LRUHandle *h = taosLRUCacheLookup(pCache, key, ROCKS_KEY_LEN); if (h) { SLastCol *pLastCol = (SLastCol *)taosLRUCacheValue(pCache, h); if (pLastCol->cacheStatus != TSDB_LAST_CACHE_NO_CACHE) { @@ -1304,28 +1302,30 @@ static int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, SArray TAOS_RETURN(code); } -void tsdbCacheInvalidateSchema(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid) { - if (suid) { - if (pTsdb->rCache.suid == suid) { +void tsdbCacheInvalidateSchema(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, int32_t sver) { + if (pTsdb->rCache.pTSchema && pTsdb->rCache.suid == suid) { + if (pTsdb->rCache.suid && sver == pTsdb->rCache.sver) { + pTsdb->rCache.sver = -1; pTsdb->rCache.suid = -1; + } else if (pTsdb->rCache.uid == uid && pTsdb->rCache.sver == sver) { + pTsdb->rCache.sver = -1; + pTsdb->rCache.uid = -1; } - } else if (pTsdb->rCache.uid == uid) { - pTsdb->rCache.uid = -1; } } -static int32_t tsdbUpdateSkm(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid) { - if (suid) { - if (pTsdb->rCache.suid == suid) { - pTsdb->rCache.uid = uid; +static int32_t tsdbUpdateSkm(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, int32_t sver) { + if (pTsdb->rCache.pTSchema && pTsdb->rCache.suid == suid) { + if (pTsdb->rCache.suid && sver == pTsdb->rCache.sver) { + return 0; + } else if (pTsdb->rCache.uid == uid && pTsdb->rCache.sver == sver) { return 0; } - } else if (pTsdb->rCache.uid == uid) { - return 0; } pTsdb->rCache.suid = suid; pTsdb->rCache.uid = uid; + pTsdb->rCache.sver = sver; tDestroyTSchema(pTsdb->rCache.pTSchema); return metaGetTbTSchemaEx(pTsdb->pVnode->pMeta, suid, uid, -1, &pTsdb->rCache.pTSchema); } @@ -1335,36 +1335,27 @@ int32_t tsdbCacheRowFormatUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, int6 int32_t code = 0, lino = 0; // 1. prepare last - TSDBROW lRow = {.type = TSDBROW_ROW_FMT, .pTSRow = aRow[nRow - 1], .version = version}; - + TSDBROW lRow = {.type = TSDBROW_ROW_FMT, .pTSRow = aRow[nRow - 1], .version = version}; STSchema *pTSchema = NULL; int32_t sver = TSDBROW_SVERSION(&lRow); SArray *ctxArray = NULL; SSHashObj *iColHash = NULL; - TAOS_CHECK_GOTO(tsdbUpdateSkm(pTsdb, suid, uid), &lino, _exit); + TAOS_CHECK_GOTO(tsdbUpdateSkm(pTsdb, suid, uid, sver), &lino, _exit); pTSchema = pTsdb->rCache.pTSchema; - /* - TAOS_CHECK_GOTO(metaGetTbTSchemaEx(pTsdb->pVnode->pMeta, suid, uid, sver, &pTSchema), &lino, _exit); - */ TSDBROW tRow = {.type = TSDBROW_ROW_FMT, .version = version}; int32_t nCol = pTSchema->numOfCols; - ctxArray = taosArrayInit(nCol, sizeof(SLastUpdateCtx)); - iColHash = tSimpleHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT)); + ctxArray = taosArrayInit(nCol * 2, sizeof(SLastUpdateCtx)); // 1. prepare by lrow STsdbRowKey tsdbRowKey = {0}; tsdbRowGetKey(&lRow, &tsdbRowKey); STSDBRowIter iter = {0}; - code = tsdbRowIterOpen(&iter, &lRow, pTSchema); - if (code != TSDB_CODE_SUCCESS) { - tsdbError("vgId:%d, %s tsdbRowIterOpen failed at line %d since %s", TD_VID(pTsdb->pVnode), __func__, __LINE__, - tstrerror(code)); - TAOS_CHECK_GOTO(code, &lino, _exit); - } + TAOS_CHECK_GOTO(tsdbRowIterOpen(&iter, &lRow, pTSchema), &lino, _exit); + int32_t iCol = 0; for (SColVal *pColVal = tsdbRowIterNext(&iter); pColVal && iCol < nCol; pColVal = tsdbRowIterNext(&iter), iCol++) { SLastUpdateCtx updateCtx = {.lflag = LFLAG_LAST_ROW, .tsdbRowKey = tsdbRowKey, .colVal = *pColVal}; @@ -1372,15 +1363,19 @@ int32_t tsdbCacheRowFormatUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, int6 TAOS_CHECK_GOTO(terrno, &lino, _exit); } - if (!COL_VAL_IS_VALUE(pColVal)) { + if (COL_VAL_IS_VALUE(pColVal)) { + updateCtx.lflag = LFLAG_LAST; + if (!taosArrayPush(ctxArray, &updateCtx)) { + TAOS_CHECK_GOTO(terrno, &lino, _exit); + } + } else { + if (!iColHash) { + iColHash = tSimpleHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT)); + } + if (tSimpleHashPut(iColHash, &iCol, sizeof(iCol), NULL, 0)) { TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit); } - continue; - } - updateCtx.lflag = LFLAG_LAST; - if (!taosArrayPush(ctxArray, &updateCtx)) { - TAOS_CHECK_GOTO(terrno, &lino, _exit); } } tsdbRowClose(&iter); @@ -1425,7 +1420,10 @@ int32_t tsdbCacheRowFormatUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, int6 } _exit: - // taosMemoryFreeClear(pTSchema); + if (code) { + tsdbError("vgId:%d, %s failed at line %d since %s", TD_VID(pTsdb->pVnode), __func__, __LINE__, tstrerror(code)); + } + taosArrayDestroy(ctxArray); tSimpleHashCleanup(iColHash); diff --git a/source/util/src/tlrucache.c b/source/util/src/tlrucache.c index 92dcf015a612..160808f9563c 100644 --- a/source/util/src/tlrucache.c +++ b/source/util/src/tlrucache.c @@ -14,12 +14,12 @@ */ #define _DEFAULT_SOURCE +#include "tlrucache.h" #include "os.h" #include "taoserror.h" #include "tarray.h" #include "tdef.h" #include "tlog.h" -#include "tlrucache.h" #include "tutil.h" typedef struct SLRUEntry SLRUEntry; @@ -110,7 +110,7 @@ struct SLRUEntryTable { }; static int taosLRUEntryTableInit(SLRUEntryTable *table, int maxUpperHashBits) { - table->lengthBits = 4; + table->lengthBits = 16; table->list = taosMemoryCalloc(1 << table->lengthBits, sizeof(SLRUEntry *)); if (!table->list) { TAOS_RETURN(terrno); @@ -168,7 +168,14 @@ static SLRUEntry **taosLRUEntryTableFindPtr(SLRUEntryTable *table, const void *k while (*entry && ((*entry)->hash != hash || memcmp(key, (*entry)->keyData, keyLen) != 0)) { entry = &(*entry)->nextHash; } - + /* + SLRUEntry *pentry = table->list[hash >> (32 - table->lengthBits)]; + SLRUEntry **entry = &table->list[hash >> (32 - table->lengthBits)]; + while (pentry && (pentry->hash != hash || memcmp(key, pentry->keyData, keyLen) != 0)) { + entry = &pentry->nextHash; + pentry = *entry; + } + */ return entry; } @@ -371,9 +378,9 @@ static void taosLRUCacheShardCleanup(SLRUCacheShard *shard) { static LRUStatus taosLRUCacheShardInsertEntry(SLRUCacheShard *shard, SLRUEntry *e, LRUHandle **handle, bool freeOnFail) { - LRUStatus status = TAOS_LRU_STATUS_OK; + LRUStatus status = TAOS_LRU_STATUS_OK; SLRUEntry *toFree = NULL; - SArray *lastReferenceList = NULL; + SArray *lastReferenceList = NULL; if (shard->usage + e->totalCharge > shard->capacity) { lastReferenceList = taosArrayInit(16, POINTER_BYTES); if (!lastReferenceList) { @@ -744,7 +751,8 @@ void taosLRUCacheCleanup(SLRUCache *cache) { } LRUStatus taosLRUCacheInsert(SLRUCache *cache, const void *key, size_t keyLen, void *value, size_t charge, - _taos_lru_deleter_t deleter, _taos_lru_overwriter_t overwriter, LRUHandle **handle, LRUPriority priority, void *ud) { + _taos_lru_deleter_t deleter, _taos_lru_overwriter_t overwriter, LRUHandle **handle, + LRUPriority priority, void *ud) { uint32_t hash = TAOS_LRU_CACHE_SHARD_HASH32(key, keyLen); uint32_t shardIndex = hash & cache->shardedCache.shardMask; From 7d89545d3ceb35dd50925f94fc0d2c6561192d65 Mon Sep 17 00:00:00 2001 From: Shungang Li Date: Wed, 30 Oct 2024 10:26:49 +0800 Subject: [PATCH 425/695] enh: alter taosCheckAndSetDebugFlag log level --- source/common/src/tglobal.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index 5ab5500fa65d..4076679ff4af 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -2346,8 +2346,13 @@ static void taosCheckAndSetDebugFlag(int32_t *pFlagPtr, char *name, int32_t flag if (noNeedToSetVars != NULL && taosArraySearch(noNeedToSetVars, name, taosLogVarComp, TD_EQ) != NULL) { return; } - if (taosSetDebugFlag(pFlagPtr, name, flag) != 0) { - uError("failed to set flag %s to %d", name, flag); + int32_t code = 0; + if ((code = taosSetDebugFlag(pFlagPtr, name, flag)) != 0) { + if (code != TSDB_CODE_CFG_NOT_FOUND) { + uError("failed to set flag %s to %d", name, flag); + } else { + uDebug("failed to set flag %s to %d", name, flag); + } } return; } From 0513612b382f8125a9abede06203fefe256f7ec7 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Wed, 30 Oct 2024 10:33:05 +0800 Subject: [PATCH 426/695] add log --- tests/system-test/7-tmq/tmqConsFromTsdb1-1ctb-funcNFilter.py | 1 + tests/system-test/7-tmq/tmqConsFromTsdb1.py | 1 + 2 files changed, 2 insertions(+) diff --git a/tests/system-test/7-tmq/tmqConsFromTsdb1-1ctb-funcNFilter.py b/tests/system-test/7-tmq/tmqConsFromTsdb1-1ctb-funcNFilter.py index 85adb50e8857..cd5dac5bbd1a 100644 --- a/tests/system-test/7-tmq/tmqConsFromTsdb1-1ctb-funcNFilter.py +++ b/tests/system-test/7-tmq/tmqConsFromTsdb1-1ctb-funcNFilter.py @@ -16,6 +16,7 @@ from tmqCommon import * class TDTestCase: + updatecfgDict = {'debugFlag': 143} def __init__(self): self.vgroups = 1 self.ctbNum = 1 diff --git a/tests/system-test/7-tmq/tmqConsFromTsdb1.py b/tests/system-test/7-tmq/tmqConsFromTsdb1.py index f66605f5f47e..e245c6faa901 100644 --- a/tests/system-test/7-tmq/tmqConsFromTsdb1.py +++ b/tests/system-test/7-tmq/tmqConsFromTsdb1.py @@ -16,6 +16,7 @@ from tmqCommon import * class TDTestCase: + updatecfgDict = {'debugFlag': 143} def __init__(self): self.vgroups = 1 self.ctbNum = 10 From 542a6d3672adffa0a985ea905f85700f44a66098 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Wed, 30 Oct 2024 10:33:50 +0800 Subject: [PATCH 427/695] opt transport quit --- source/libs/transport/inc/transComm.h | 1 + source/libs/transport/src/transCli.c | 1 + source/libs/transport/src/transComm.c | 2 ++ 3 files changed, 4 insertions(+) diff --git a/source/libs/transport/inc/transComm.h b/source/libs/transport/inc/transComm.h index d835d12c7915..5c79b379edae 100644 --- a/source/libs/transport/inc/transComm.h +++ b/source/libs/transport/inc/transComm.h @@ -353,6 +353,7 @@ typedef struct { queue node; void (*freeFunc)(void* arg); int32_t size; + int8_t inited; } STransQueue; /* diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index 9964750d175d..b5bdbd5ada7f 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -1092,6 +1092,7 @@ static int32_t cliCreateConn(SCliThrd* pThrd, SCliConn** pCliConn, char* ip, int transQueueDestroy(&conn->reqsToSend); transQueueDestroy(&conn->reqsSentOut); taosMemoryFree(conn->dstAddr); + taosMemoryFree(conn->ipStr); } tError("failed to create conn, code:%d", code); taosMemoryFree(conn); diff --git a/source/libs/transport/src/transComm.c b/source/libs/transport/src/transComm.c index 35ca6678b87d..66bd4a08f3bb 100644 --- a/source/libs/transport/src/transComm.c +++ b/source/libs/transport/src/transComm.c @@ -423,6 +423,7 @@ int32_t transQueueInit(STransQueue* wq, void (*freeFunc)(void* arg)) { QUEUE_INIT(&wq->node); wq->freeFunc = (void (*)(void*))freeFunc; wq->size = 0; + wq->inited = 1; return 0; } void transQueuePush(STransQueue* q, void* arg) { @@ -497,6 +498,7 @@ void transQueueRemove(STransQueue* q, void* e) { bool transQueueEmpty(STransQueue* q) { return q->size == 0 ? true : false; } void transQueueClear(STransQueue* q) { + if (q->inited == 0) return; while (!QUEUE_IS_EMPTY(&q->node)) { queue* h = QUEUE_HEAD(&q->node); QUEUE_REMOVE(h); From 69b36fee446ffcd0c14b20a0126878c361ccb1a6 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Wed, 30 Oct 2024 10:58:47 +0800 Subject: [PATCH 428/695] handle mem failure --- source/libs/transport/src/transCli.c | 7 +++++++ source/libs/transport/src/transSvr.c | 7 ++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index b5bdbd5ada7f..c11b85ec8708 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -1349,6 +1349,9 @@ bool cliConnMayAddUserInfo(SCliConn* pConn, STransMsgHead** ppHead, int32_t* msg } STransMsgHead* pHead = *ppHead; STransMsgHead* tHead = taosMemoryCalloc(1, *msgLen + sizeof(pInst->user)); + if (tHead == NULL) { + return false; + } memcpy((char*)tHead, (char*)pHead, TRANS_MSG_OVERHEAD); memcpy((char*)tHead + TRANS_MSG_OVERHEAD, pInst->user, sizeof(pInst->user)); @@ -1435,6 +1438,10 @@ int32_t cliBatchSend(SCliConn* pConn, int8_t direct) { if (cliConnMayAddUserInfo(pConn, &pHead, &msgLen)) { content = transContFromHead(pHead); contLen = transContLenFromMsg(msgLen); + } else { + if (pConn->userInited == 0) { + return terrno; + } } if (pHead->comp == 0) { pHead->noResp = REQUEST_NO_RESP(pReq) ? 1 : 0; diff --git a/source/libs/transport/src/transSvr.c b/source/libs/transport/src/transSvr.c index 5723f2ff237a..d02bfb8281e8 100644 --- a/source/libs/transport/src/transSvr.c +++ b/source/libs/transport/src/transSvr.c @@ -1289,8 +1289,8 @@ static FORCE_INLINE SSvrConn* createConn(void* hThrd) { int32_t code = 0; SWorkThrd* pThrd = hThrd; int32_t lino; - - SSvrConn* pConn = (SSvrConn*)taosMemoryCalloc(1, sizeof(SSvrConn)); + int8_t wqInited = 0; + SSvrConn* pConn = (SSvrConn*)taosMemoryCalloc(1, sizeof(SSvrConn)); if (pConn == NULL) { TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _end); } @@ -1340,6 +1340,7 @@ static FORCE_INLINE SSvrConn* createConn(void* hThrd) { code = initWQ(&pConn->wq); TAOS_CHECK_GOTO(code, &lino, _end); + wqInited = 1; // init client handle pConn->pTcp = (uv_tcp_t*)taosMemoryMalloc(sizeof(uv_tcp_t)); @@ -1372,7 +1373,7 @@ static FORCE_INLINE SSvrConn* createConn(void* hThrd) { transDestroyBuffer(&pConn->readBuf); taosHashCleanup(pConn->pQTable); taosMemoryFree(pConn->pTcp); - destroyWQ(&pConn->wq); + if (wqInited) destroyWQ(&pConn->wq); taosMemoryFree(pConn->buf); taosMemoryFree(pConn); pConn = NULL; From 52f9ea59639f8cd6851f3af3d1226906b17244fe Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Wed, 30 Oct 2024 11:06:09 +0800 Subject: [PATCH 429/695] handle mem failure --- source/libs/transport/src/transCli.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index c11b85ec8708..a2db392dcc53 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -3219,6 +3219,7 @@ int32_t transSendRequestWithId(void* pInstRef, const SEpSet* pEpSet, STransMsg* return TSDB_CODE_INVALID_PARA; } int32_t code = 0; + int8_t transIdInited = 0; STrans* pInst = (STrans*)transAcquireExHandle(transGetInstMgt(), (int64_t)pInstRef); if (pInst == NULL) { @@ -3236,6 +3237,7 @@ int32_t transSendRequestWithId(void* pInstRef, const SEpSet* pEpSet, STransMsg* if (exh == NULL) { TAOS_CHECK_GOTO(TSDB_CODE_RPC_MODULE_QUIT, NULL, _exception); } + transIdInited = 1; pReq->info.handle = (void*)(*transpointId); pReq->info.qId = *transpointId; @@ -3252,9 +3254,6 @@ int32_t transSendRequestWithId(void* pInstRef, const SEpSet* pEpSet, STransMsg* return (code == TSDB_CODE_RPC_ASYNC_MODULE_QUIT ? TSDB_CODE_RPC_MODULE_QUIT : code); } - // if (pReq->msgType == TDMT_SCH_DROP_TASK) { - // TAOS_UNUSED(transReleaseCliHandle(pReq->info.handle)); - // } transReleaseExHandle(transGetRefMgt(), *transpointId); transReleaseExHandle(transGetInstMgt(), (int64_t)pInstRef); return 0; @@ -3262,6 +3261,7 @@ int32_t transSendRequestWithId(void* pInstRef, const SEpSet* pEpSet, STransMsg* _exception: transFreeMsg(pReq->pCont); pReq->pCont = NULL; + if (transIdInited) transReleaseExHandle(transGetRefMgt(), *transpointId); transReleaseExHandle(transGetInstMgt(), (int64_t)pInstRef); tError("failed to send request since %s", tstrerror(code)); From e6e36bcd2dd0c53d271105189ff3e8d720d94a2a Mon Sep 17 00:00:00 2001 From: wangjiaming0909 <604227650@qq.com> Date: Tue, 29 Oct 2024 12:17:14 +0800 Subject: [PATCH 430/695] fix PARITION (INTERVAL) HAVING() caused planner internal err --- source/libs/parser/src/parTranslater.c | 2 +- tests/system-test/2-query/fill_with_group.py | 32 ++++++++++++++++++-- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 395801e3dd4f..34b8290b673d 100755 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -3752,7 +3752,7 @@ static EDealRes doCheckExprForGroupBy(SNode** pNode, void* pContext) { bool partionByTbname = hasTbnameFunction(pSelect->pPartitionByList); FOREACH(pPartKey, pSelect->pPartitionByList) { if (nodesEqualNode(pPartKey, *pNode)) { - return pCxt->currClause == SQL_CLAUSE_HAVING ? DEAL_RES_IGNORE_CHILD : rewriteExprToGroupKeyFunc(pCxt, pNode); + return pSelect->hasAggFuncs ? rewriteExprToGroupKeyFunc(pCxt, pNode) : DEAL_RES_IGNORE_CHILD; } if ((partionByTbname) && QUERY_NODE_COLUMN == nodeType(*pNode) && ((SColumnNode*)*pNode)->colType == COLUMN_TYPE_TAG) { diff --git a/tests/system-test/2-query/fill_with_group.py b/tests/system-test/2-query/fill_with_group.py index 3b98ec30cee9..4a4033850453 100644 --- a/tests/system-test/2-query/fill_with_group.py +++ b/tests/system-test/2-query/fill_with_group.py @@ -344,9 +344,35 @@ def test_fill_with_complex_expr(self): tdSql.query(sql, queryTimes=1) tdSql.checkRows(55) - # TODO Fix Me! - sql = "explain SELECT count(*), timediff(_wend, last(ts)), timediff('2018-09-20 01:00:00', _wstart) FROM meters WHERE ts >= '2018-09-20 00:00:00.000' AND ts < '2018-09-20 01:00:00.000' PARTITION BY concat(tbname, 'asd') INTERVAL(5m) having(concat(tbname, 'asd') like '%asd');" - tdSql.error(sql, -2147473664) # Error: Planner internal error + sql = "SELECT count(*), timediff(_wend, last(ts)), timediff('2018-09-20 01:00:00', _wstart) FROM meters WHERE ts >= '2018-09-20 00:00:00.000' AND ts < '2018-09-20 01:00:00.000' PARTITION BY concat(tbname, 'asd') INTERVAL(5m) having(concat(tbname, 'asd') like '%asd');" + tdSql.query(sql, queryTimes=1) + tdSql.checkRows(60) + + sql = "SELECT count(*), timediff(_wend, last(ts)), timediff('2018-09-20 01:00:00', _wstart) FROM meters WHERE ts >= '2018-09-20 00:00:00.000' AND ts < '2018-09-20 01:00:00.000' PARTITION BY concat(tbname, 'asd') INTERVAL(5m) having(concat(tbname, 'asd') like 'asd%');" + tdSql.query(sql, queryTimes=1) + tdSql.checkRows(0) + + sql = "SELECT c1 FROM meters PARTITION BY c1 HAVING c1 > 0 slimit 2 limit 10" + tdSql.query(sql, queryTimes=1) + tdSql.checkRows(20) + + sql = "SELECT t1 FROM meters PARTITION BY t1 HAVING(t1 = 1)" + tdSql.query(sql, queryTimes=1) + tdSql.checkRows(20000) + + sql = "SELECT concat(t2, 'asd') FROM meters PARTITION BY t2 HAVING(t2 like '%5')" + tdSql.query(sql, queryTimes=1) + tdSql.checkRows(10000) + tdSql.checkData(0, 0, 'tb5asd') + + sql = "SELECT concat(t2, 'asd') FROM meters PARTITION BY concat(t2, 'asd') HAVING(concat(t2, 'asd')like '%5%')" + tdSql.query(sql, queryTimes=1) + tdSql.checkRows(10000) + tdSql.checkData(0, 0, 'tb5asd') + + sql = "SELECT avg(c1) FROM meters PARTITION BY tbname, t1 HAVING(t1 = 1)" + tdSql.query(sql, queryTimes=1) + tdSql.checkRows(2) def run(self): self.prepareTestEnv() From 14ddaf7c3932216f5e7c0366ad3498eba6c1baab Mon Sep 17 00:00:00 2001 From: wangjiaming0909 <604227650@qq.com> Date: Wed, 30 Oct 2024 11:08:41 +0800 Subject: [PATCH 431/695] add parition having tests and fix merge align interval + limit --- source/libs/executor/src/timewindowoperator.c | 7 +++- tests/system-test/2-query/fill_with_group.py | 37 +++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c index 34ecda6ce709..8c5f62803496 100644 --- a/source/libs/executor/src/timewindowoperator.c +++ b/source/libs/executor/src/timewindowoperator.c @@ -2018,7 +2018,12 @@ static void doMergeAlignedIntervalAgg(SOperatorInfo* pOperator) { cleanupAfterGroupResultGen(pMiaInfo, pRes); code = doFilter(pRes, pOperator->exprSupp.pFilterInfo, NULL); QUERY_CHECK_CODE(code, lino, _end); - break; + if (pRes->info.rows == 0) { + // After filtering for last group, the result is empty, so we need to continue to process next group + continue; + } else { + break; + } } else { // continue pRes->info.id.groupId = pMiaInfo->groupId; diff --git a/tests/system-test/2-query/fill_with_group.py b/tests/system-test/2-query/fill_with_group.py index 4a4033850453..3847f1dec448 100644 --- a/tests/system-test/2-query/fill_with_group.py +++ b/tests/system-test/2-query/fill_with_group.py @@ -374,6 +374,43 @@ def test_fill_with_complex_expr(self): tdSql.query(sql, queryTimes=1) tdSql.checkRows(2) + sql = "SELECT count(*) FROM meters PARTITION BY concat(tbname, 'asd') HAVING(concat(tbname, 'asd') like '%asd')" + tdSql.query(sql, queryTimes=1) + tdSql.checkRows(10) + + sql = "SELECT count(*), concat(tbname, 'asd') FROM meters PARTITION BY concat(tbname, 'asd') HAVING(concat(tbname, 'asd') like '%asd')" + tdSql.query(sql, queryTimes=1) + tdSql.checkRows(10) + + sql = "SELECT count(*) FROM meters PARTITION BY t1 HAVING(t1 < 4) order by t1 +1" + tdSql.query(sql, queryTimes=1) + tdSql.checkRows(4) + + sql = "SELECT count(*), t1 + 100 FROM meters PARTITION BY t1 HAVING(t1 < 4) order by t1 +1" + tdSql.query(sql, queryTimes=1) + tdSql.checkRows(4) + + sql = "SELECT count(*), t1 + 100 FROM meters PARTITION BY t1 INTERVAL(1d) HAVING(t1 < 4) order by t1 +1 desc" + tdSql.query(sql, queryTimes=1) + tdSql.checkRows(280) + + sql = "SELECT count(*), concat(t3, 'asd') FROM meters PARTITION BY concat(t3, 'asd') INTERVAL(1d) HAVING(concat(t3, 'asd') like '%5asd' and count(*) = 118)" + tdSql.query(sql, queryTimes=1) + tdSql.checkRows(1) + + sql = "SELECT count(*), concat(t3, 'asd') FROM meters PARTITION BY concat(t3, 'asd') INTERVAL(1d) HAVING(concat(t3, 'asd') like '%5asd' and count(*) != 118)" + tdSql.query(sql, queryTimes=1) + tdSql.checkRows(69) + + sql = "SELECT count(*), concat(t3, 'asd') FROM meters PARTITION BY concat(t3, 'asd') INTERVAL(1d) HAVING(concat(t3, 'asd') like '%5asd') order by count(*) asc limit 10" + tdSql.query(sql, queryTimes=1) + tdSql.checkRows(10) + + sql = "SELECT count(*), concat(t3, 'asd') FROM meters PARTITION BY concat(t3, 'asd') INTERVAL(1d) HAVING(concat(t3, 'asd') like '%5asd' or concat(t3, 'asd') like '%3asd') order by count(*) asc limit 10000" + tdSql.query(sql, queryTimes=1) + tdSql.checkRows(140) + + def run(self): self.prepareTestEnv() self.test_partition_by_with_interval_fill_prev_new_group_fill_error() From 0b5f2ec57b8d8bcf8c8632527eccabc185f76285 Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Wed, 30 Oct 2024 11:11:29 +0800 Subject: [PATCH 432/695] test(blob): testing & fixes for blob --- tests/army/storage/blob/s3Basic.json | 2 +- tests/army/storage/blob/s3Basic1.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/army/storage/blob/s3Basic.json b/tests/army/storage/blob/s3Basic.json index ee341b209613..2b911a989ff9 100644 --- a/tests/army/storage/blob/s3Basic.json +++ b/tests/army/storage/blob/s3Basic.json @@ -20,7 +20,7 @@ "replica": 1, "duration":"10d", "s3_keeplocal":"30d", - "s3_chunksize":"131072", + "s3_chunkpages":"131072", "tsdb_pagesize":"1", "s3_compact":"1", "wal_retention_size":"1", diff --git a/tests/army/storage/blob/s3Basic1.json b/tests/army/storage/blob/s3Basic1.json index 02be308443c5..087f89edec4a 100644 --- a/tests/army/storage/blob/s3Basic1.json +++ b/tests/army/storage/blob/s3Basic1.json @@ -20,7 +20,7 @@ "replica": 1, "duration":"10d", "s3_keeplocal":"30d", - "s3_chunksize":"131072", + "s3_chunkpages":"131072", "tsdb_pagesize":"1", "s3_compact":"1", "wal_retention_size":"1", From 0e4134d94a2ba20892f9e2c009b75144d5031579 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Wed, 30 Oct 2024 11:49:56 +0800 Subject: [PATCH 433/695] Update index.md --- docs/zh/06-advanced/06-data-analysis/index.md | 47 +++++++++++++------ 1 file changed, 33 insertions(+), 14 deletions(-) diff --git a/docs/zh/06-advanced/06-data-analysis/index.md b/docs/zh/06-advanced/06-data-analysis/index.md index 464acf7bec95..3281045320df 100644 --- a/docs/zh/06-advanced/06-data-analysis/index.md +++ b/docs/zh/06-advanced/06-data-analysis/index.md @@ -176,8 +176,8 @@ ANOMALY_WINDOW(column, options) ``` **语法说明** -1. column:进行时序数据异常检测的输入数据列,当前只支持单列输入,且只能是数值类型,不能是字符类型(例如:`NCHAR` `VARCHAR` `VARBINARY`等类型),**不支持函数表达式**。 -2. options:调用异常检测的算法,及与算法相关的参数。采用 逗号分隔的K/V字符串表示,其中的字符串不需要使用单引号、双引号、或转意号等符号,不能使用中文及其他宽字符。例如:`algo=ksigma, k=2` 表示进行异常检测的算法是 ksigma,该算法接受的输入参数是 2。 +1. `column`:进行时序数据异常检测的输入数据列,当前只支持单列输入,且只能是数值类型,不能是字符类型(例如:`NCHAR` `VARCHAR` `VARBINARY`等类型),**不支持函数表达式**。 +2. `options`:调用异常检测的算法,及与算法相关的参数。采用 逗号分隔的K/V字符串表示,其中的字符串不需要使用单引号、双引号、或转意号等符号,不能使用中文及其他宽字符。例如:`algo=ksigma, k=2` 表示进行异常检测的算法是 ksigma,该算法接受的输入参数是 2。 全部支持的参数列表如下: |参数|含义|默认值| @@ -186,12 +186,22 @@ ANOMALY_WINDOW(column, options) |wncheck|对输入数据列是否进行白噪声检查|取值为0或者1,默认值为 1,表示进行白噪声检查| 异常检测的返回结果以窗口的形式呈现,因此窗口查询相关的伪列在这种场景下仍然可用。可以使用的伪列如下: -1. _WSTART: 异常窗口开始时间戳 -2. _WEND:异常窗口结束时间戳 -3. _WDURATION:异常窗口持续时间 +1. `_WSTART`: 异常窗口开始时间戳 +2. `_WEND`:异常窗口结束时间戳 +3. `_WDURATION`:异常窗口持续时间 **示例** +```SQL + +--- 使用 iqr 算法进行异常检测,检测列 i32 列。 +SELECT _wstart, _wend, SUM(i32) +FROM ai.atb +ANOMALY_WINDOW(i32, "algo=iqr"); +--- 使用 ksigma 算法进行异常检测,输入参数 k 值为 2,检测列 i32 列 +SELECT _wstart, _wend, SUM(i32) +FROM ai.atb ANOMALY_WINDOW(i32, "algo=ksigma,k=2"); +``` **使用说明** @@ -202,13 +212,13 @@ ANOMALY_WINDOW(column, options) #### 时序数据预测 数据预测以一段训练数据作为输入,预测接下来若干时间点的后续运行结果。其调用的语法如下: ```SQL -SELECT {pseudo_column}, forecast(column, options) from {subquery} where [where_clause] +SELECT {pseudo_column}, forecast(column, options) FROM {subquery} WHERE [where_clause] ``` **语法说明** -1. forecast:关键字 -2. column:预测的时序数据列。与异常检测相同,只支持数值类型输入。 -3. options:异常检测函数的参数,使用规则与 anomaly_window 相同 +1. `forecast`:关键字 +2. `column`:预测的时序数据列。与异常检测相同,只支持数值类型输入。 +3. `options`:异常检测函数的参数,使用规则与 anomaly_window 相同 |参数|含义|默认值| |---|---|---| @@ -216,15 +226,24 @@ SELECT {pseudo_column}, forecast(column, options) from {subquery} where [where_c |wncheck|白噪声(white noise data)检查|默认值为 1,0 表示不进行检查| |conf|预测数据的置信区间范围 ,取值范围[0, 100]|95| |every|预测数据的采样间隔|输入数据的采样间隔| -|start|预测结果的开始时间戳|无| -|rows|预测结果的记录数|无| +|start|预测结果的开始时间戳|输入数据最后一个时间戳加上一个采样时间段| +|rows|预测结果的记录数|10| 预测查询结果新增了三个伪列,具体如下: -1. _FROWTS:预测结果的时间戳 -2. _FLOW:置信区间下界 -3. _FHIGH:置信区间上界。对于没有置信区间的预测算法,其置信区间同预测结果。 +1. `_FROWTS`:预测结果的时间戳 +2. `_FLOW`:置信区间下界 +3. `_FHIGH`:置信区间上界。对于没有置信区间的预测算法,其置信区间同预测结果。 **示例** +```SQL +--- 使用 arima 算法进行预测,预测结果是 10 条记录(默认值),数据进行白噪声检查,默认置信区间 95%. +select _flow, _fhigh, _frowts, forecast(i32, "algo=arima") from ai.ftb; +--- 使用 arima 算法进行预测,输入数据的是周期数据,每10个采样点是一个周期。返回置信区间是 95%. +select _flow, _fhigh, _frowts, forecast(i32, "algo=arima,alpha=95,period=10") from ai.ftb; +``` **使用说明** +1. `start`:返回预测结果的起始时间,改变这个起始时间不会影响返回的预测数值,只影响起始时间。 +2. `every`:可以与输入数据的采样频率不同。采样频率只能低于或等于输入数据采样频率,不能高于输入数据的采样频率。 +3. 对于某些不需要计算置信区间的算法,即使指定了置信区间,返回的结果中其上下界退化成为一个点。 From 9f9b22e436a4bd1e68d79ad7dcfd4a2084322b82 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Wed, 30 Oct 2024 11:56:24 +0800 Subject: [PATCH 434/695] handle quit error --- source/libs/transport/src/transCli.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index a2db392dcc53..8a1710b6093a 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -905,6 +905,10 @@ static void addConnToPool(void* pool, SCliConn* conn) { } SCliThrd* thrd = conn->hostThrd; + if (thrd->quit == false) { + return; + } + cliResetConnTimer(conn); if (conn->list == NULL && conn->dstAddr != NULL) { conn->list = taosHashGet((SHashObj*)pool, conn->dstAddr, strlen(conn->dstAddr)); From 989457969ede3f425216074af5f15c7a79950851 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Wed, 30 Oct 2024 11:56:36 +0800 Subject: [PATCH 435/695] handle quit error --- source/libs/transport/src/transCli.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index 8a1710b6093a..f40ff3eee295 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -905,7 +905,7 @@ static void addConnToPool(void* pool, SCliConn* conn) { } SCliThrd* thrd = conn->hostThrd; - if (thrd->quit == false) { + if (thrd->quit == true) { return; } From 5ba90c2388770d5727774dd5810fee4c935f927c Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Wed, 30 Oct 2024 13:35:34 +0800 Subject: [PATCH 436/695] handle quit error --- source/libs/transport/src/transCli.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index f40ff3eee295..36fc9a784638 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -127,6 +127,7 @@ typedef struct { typedef struct SCliReq { SReqCtx* ctx; queue q; + queue sendQ; STransMsgType type; uint64_t st; int64_t seq; @@ -1309,8 +1310,8 @@ static void cliBatchSendCb(uv_write_t* req, int status) { queue* h = QUEUE_HEAD(&wrapper->node); QUEUE_REMOVE(h); - SCliReq* pReq = QUEUE_DATA(h, SCliReq, q); - transQueuePush(&conn->reqsSentOut, &pReq->q); + SCliReq* pReq = QUEUE_DATA(h, SCliReq, sendQ); + pReq->sent = 1; } freeWReqToWQ(&conn->wq, wrapper); @@ -1471,14 +1472,16 @@ int32_t cliBatchSend(SCliConn* pConn, int8_t direct) { wb[j++] = uv_buf_init((char*)pHead, msgLen); totalLen += msgLen; - pCliMsg->sent = 1; pCliMsg->seq = pConn->seq; STraceId* trace = &pCliMsg->msg.info.traceId; tGDebug("%s conn %p %s is sent to %s, local info:%s, seq:%" PRId64 ", sid:%" PRId64 "", CONN_GET_INST_LABEL(pConn), pConn, TMSG_INFO(pReq->msgType), pConn->dst, pConn->src, pConn->seq, pReq->info.qId); - QUEUE_PUSH(&reqToSend, &pCliMsg->q); + // QUEUE_PUSH(&reqToSend, &pCliMsg->q); + transQueuePush(&pConn->reqsSentOut, &pCliMsg->q); + QUEUE_INIT(&pCliMsg->sendQ); + QUEUE_PUSH(&reqToSend, &pCliMsg->sendQ); if (j >= batchLimit) { break; } @@ -1488,29 +1491,18 @@ int32_t cliBatchSend(SCliConn* pConn, int8_t direct) { if (req == NULL) { tError("%s conn %p failed to send msg since %s", CONN_GET_INST_LABEL(pConn), pConn, tstrerror(terrno)); - while (!QUEUE_IS_EMPTY(&reqToSend)) { - queue* h = QUEUE_HEAD(&reqToSend); - QUEUE_REMOVE(h); - SCliReq* pReq = QUEUE_DATA(h, SCliReq, q); - transQueuePush(&pConn->reqsToSend, &pReq->q); - } transRefCliHandle(pConn); return terrno; } SWReqsWrapper* pWreq = req->data; + QUEUE_MOVE(&reqToSend, &pWreq->node); tDebug("%s conn %p start to send msg, batch size:%d, len:%d", CONN_GET_INST_LABEL(pConn), pConn, j, totalLen); int32_t ret = uv_write(req, (uv_stream_t*)pConn->stream, wb, j, cliBatchSendCb); if (ret != 0) { tError("%s conn %p failed to send msg since %s", CONN_GET_INST_LABEL(pConn), pConn, uv_err_name(ret)); - while (!QUEUE_IS_EMPTY(&pWreq->node)) { - queue* h = QUEUE_HEAD(&pWreq->node); - QUEUE_REMOVE(h); - SCliReq* pReq = QUEUE_DATA(h, SCliReq, q); - transQueuePush(&pConn->reqsToSend, &pReq->q); - } freeWReqToWQ(&pConn->wq, req->data); code = TSDB_CODE_THIRDPARTY_ERROR; TAOS_UNUSED(transUnrefCliHandle(pConn)); From 9aeb74e6d9b0d90fdf247860e635643a81f5f2ec Mon Sep 17 00:00:00 2001 From: sheyanjie-qq <249478495@qq.com> Date: Wed, 30 Oct 2024 13:54:55 +0800 Subject: [PATCH 437/695] improve doc --- docs/zh/08-operation/02-planning.md | 18 +++++++++--------- docs/zh/14-reference/07-supported.md | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/docs/zh/08-operation/02-planning.md b/docs/zh/08-operation/02-planning.md index 66da1df8bfa4..396fd0d3d5b4 100644 --- a/docs/zh/08-operation/02-planning.md +++ b/docs/zh/08-operation/02-planning.md @@ -53,7 +53,7 @@ M = (T × S × 3 + (N / 4096) + 100) 与 WebSocket 连接方式相比,RESTful 连接方式在内存占用上更大,除了缓冲区所需的内存以外,还需要考虑每个连接响应结果的内存开销。这种内存开销与响应结果的JSON 数据大小密切相关,特别是在查询数据量很大时,会占用大量内存。 -由于 RESTful 连接方式不支持分批获取查询数据,这就导致在查询获取超大结果集时,可能会占用特别大的内存,从而导致内存溢出,因此,在大型项目中,建议打开batchfetch=true 选项,以启用 WebSocket 连接方式,实现流式结果集返回,从而避免内存溢出的风险 +由于 RESTful 连接方式不支持分批获取查询数据,这就导致在查询获取超大结果集时,可能会占用特别大的内存,从而导致内存溢出,因此,在大型项目中,建议使用 WebSocket 连接方式,实现流式结果集返回,从而避免内存溢出的风险 **注意** - 建议采用 RESTful/WebSocket 连接方式来访问 TDengine 集群,而不采用taosc 原生连接方式。 @@ -146,11 +146,11 @@ TDengine 的多级存储功能在使用上还具备以下优点。 下表列出了 TDengine 的一些接口或组件的常用端口,这些端口均可以通过配置文件中的参数进行修改。 -|接口或组件 | 端口 | -|:---------------------------:|:---------:| -|原生接口(taosc) | 6030 | -|RESTful 接口 | 6041 | -|WebSocket 接口 |6041 | -|taosKeeper | 6043 | -|taosX | 6050, 6055 | -|taosExplorer | 6060 | \ No newline at end of file +| 接口或组件 | 端口 | +| :---------------: | :--------: | +| 原生接口(taosc) | 6030 | +| RESTful 接口 | 6041 | +| WebSocket 接口 | 6041 | +| taosKeeper | 6043 | +| taosX | 6050, 6055 | +| taosExplorer | 6060 | diff --git a/docs/zh/14-reference/07-supported.md b/docs/zh/14-reference/07-supported.md index 10ca237653c8..b243b14383be 100644 --- a/docs/zh/14-reference/07-supported.md +++ b/docs/zh/14-reference/07-supported.md @@ -26,10 +26,10 @@ description: "TDengine 服务端、客户端和连接器支持的平台列表" | ----------- | ------------- | ------------- | --------- | ------------- | --------- | | **OS** | **Linux** | **Win64** | **Linux** | **macOS** | **macOS** | | **C/C++** | ● | ● | ● | ● | ● | -| **JDBC** | ● | ● | ● | ○ | ○ | +| **JDBC** | ● | ● | ● | ● | ● | | **Python** | ● | ● | ● | ● | ● | | **Go** | ● | ● | ● | ● | ● | -| **NodeJs** | ● | ● | ● | ○ | ○ | +| **NodeJs** | ● | ● | ● | ● | ● | | **C#** | ● | ● | ○ | ○ | ○ | | **Rust** | ● | ● | ○ | ● | ● | | **RESTful** | ● | ● | ● | ● | ● | From 6d4d79a4d3c5724fbcfcc19d392c697196bac7a1 Mon Sep 17 00:00:00 2001 From: xsren <285808407@qq.com> Date: Wed, 30 Oct 2024 14:04:12 +0800 Subject: [PATCH 438/695] fix: geometry ST_AsText --- source/libs/function/src/builtins.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c index e66ddf519766..d91060fb6e31 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -1533,14 +1533,16 @@ static int32_t translateToJson(SFunctionNode* pFunc, char* pErrBuf, int32_t len) static int32_t translateOutGeom(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { FUNC_ERR_RET(validateParam(pFunc, pErrBuf, len)); - pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_GEOMETRY].bytes, .type = TSDB_DATA_TYPE_GEOMETRY}; + SDataType dt = *getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0)); + pFunc->node.resType = (SDataType){.bytes = dt.bytes, .type = TSDB_DATA_TYPE_GEOMETRY}; return TSDB_CODE_SUCCESS; } static int32_t translateInGeomOutStr(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { FUNC_ERR_RET(validateParam(pFunc, pErrBuf, len)); - pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_VARCHAR].bytes, .type = TSDB_DATA_TYPE_VARCHAR}; + SDataType dt = *getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0)); + pFunc->node.resType = (SDataType){.bytes = dt.bytes, .type = TSDB_DATA_TYPE_VARCHAR}; return TSDB_CODE_SUCCESS; } From 19f85afc11314d07e18e63c7754c3616d3b6d8b6 Mon Sep 17 00:00:00 2001 From: dengbin40 <46433701+dengbin40@users.noreply.github.com> Date: Sun, 29 Sep 2024 09:58:18 +0800 Subject: [PATCH 439/695] =?UTF-8?q?fix:=20=E5=A2=9E=E5=8A=A0pod=E8=8A=82?= =?UTF-8?q?=E7=82=B9=E7=9A=84=E5=88=86=E5=B8=83=E5=BC=8F=E9=83=A8=E7=BD=B2?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/zh/08-operation/03-deployment.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/docs/zh/08-operation/03-deployment.md b/docs/zh/08-operation/03-deployment.md index 2e0c2a798931..e549e8613d1c 100644 --- a/docs/zh/08-operation/03-deployment.md +++ b/docs/zh/08-operation/03-deployment.md @@ -368,6 +368,18 @@ spec: labels: app: "tdengine" spec: + affinity: + podAntiAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - weight: 100 + podAffinityTerm: + labelSelector: + matchExpressions: + - key: app + operator: In + values: + - tdengine + topologyKey: kubernetes.io/hostname containers: - name: "tdengine" image: "tdengine/tdengine:3.2.3.0" @@ -837,4 +849,4 @@ Helm 管理下,清理操作也变得简单: helm uninstall tdengine ``` -但 Helm 也不会自动移除 PVC,需要手动获取 PVC 然后删除掉。 \ No newline at end of file +但 Helm 也不会自动移除 PVC,需要手动获取 PVC 然后删除掉。 From aa3c79100bb55ad5fd296f88de21c4bc978e4b51 Mon Sep 17 00:00:00 2001 From: Pengrongkun Date: Wed, 30 Oct 2024 14:24:10 +0800 Subject: [PATCH 440/695] fix some format --- include/client/taos.h | 32 ++++++------- source/client/src/clientMain.c | 11 ++--- source/client/src/clientStmt2.c | 16 +++---- source/libs/parser/src/parInsertSql.c | 63 ++++++++++++++------------ source/libs/parser/src/parInsertStmt.c | 8 ++-- 5 files changed, 66 insertions(+), 64 deletions(-) diff --git a/include/client/taos.h b/include/client/taos.h index 00fec66a7143..6797dfee5f68 100644 --- a/include/client/taos.h +++ b/include/client/taos.h @@ -95,11 +95,11 @@ typedef struct taosField { } TAOS_FIELD; typedef struct TAOS_FIELD_E { - char name[65]; - int8_t type; - uint8_t precision; - uint8_t scale; - int32_t bytes; + char name[65]; + int8_t type; + uint8_t precision; + uint8_t scale; + int32_t bytes; TAOS_FIELD_T field_type; } TAOS_FIELD_E; @@ -253,17 +253,17 @@ DLL_EXPORT int64_t taos_affected_rows64(TAOS_RES *res); DLL_EXPORT TAOS_FIELD *taos_fetch_fields(TAOS_RES *res); DLL_EXPORT int taos_select_db(TAOS *taos, const char *db); DLL_EXPORT int taos_print_row(char *str, TAOS_ROW row, TAOS_FIELD *fields, int num_fields); -DLL_EXPORT int taos_print_row_with_size(char *str, uint32_t size, TAOS_ROW row, TAOS_FIELD *fields, int num_fields); -DLL_EXPORT void taos_stop_query(TAOS_RES *res); -DLL_EXPORT bool taos_is_null(TAOS_RES *res, int32_t row, int32_t col); -DLL_EXPORT int taos_is_null_by_column(TAOS_RES *res, int columnIndex, bool result[], int *rows); -DLL_EXPORT bool taos_is_update_query(TAOS_RES *res); -DLL_EXPORT int taos_fetch_block(TAOS_RES *res, TAOS_ROW *rows); -DLL_EXPORT int taos_fetch_block_s(TAOS_RES *res, int *numOfRows, TAOS_ROW *rows); -DLL_EXPORT int taos_fetch_raw_block(TAOS_RES *res, int *numOfRows, void **pData); -DLL_EXPORT int *taos_get_column_data_offset(TAOS_RES *res, int columnIndex); -DLL_EXPORT int taos_validate_sql(TAOS *taos, const char *sql); -DLL_EXPORT void taos_reset_current_db(TAOS *taos); +DLL_EXPORT int taos_print_row_with_size(char *str, uint32_t size, TAOS_ROW row, TAOS_FIELD *fields, int num_fields); +DLL_EXPORT void taos_stop_query(TAOS_RES *res); +DLL_EXPORT bool taos_is_null(TAOS_RES *res, int32_t row, int32_t col); +DLL_EXPORT int taos_is_null_by_column(TAOS_RES *res, int columnIndex, bool result[], int *rows); +DLL_EXPORT bool taos_is_update_query(TAOS_RES *res); +DLL_EXPORT int taos_fetch_block(TAOS_RES *res, TAOS_ROW *rows); +DLL_EXPORT int taos_fetch_block_s(TAOS_RES *res, int *numOfRows, TAOS_ROW *rows); +DLL_EXPORT int taos_fetch_raw_block(TAOS_RES *res, int *numOfRows, void **pData); +DLL_EXPORT int *taos_get_column_data_offset(TAOS_RES *res, int columnIndex); +DLL_EXPORT int taos_validate_sql(TAOS *taos, const char *sql); +DLL_EXPORT void taos_reset_current_db(TAOS *taos); DLL_EXPORT int *taos_fetch_lengths(TAOS_RES *res); DLL_EXPORT TAOS_ROW *taos_result_block(TAOS_RES *res); diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c index 43f8c9e1f987..54da1c013c58 100644 --- a/source/client/src/clientMain.c +++ b/source/client/src/clientMain.c @@ -84,7 +84,7 @@ void taos_cleanup(void) { taosCloseRef(id); nodesDestroyAllocatorSet(); -// cleanupAppInfo(); + // cleanupAppInfo(); rpcCleanup(); tscDebug("rpc cleanup"); @@ -388,7 +388,6 @@ void taos_free_result(TAOS_RES *res) { tDeleteMqBatchMetaRsp(&pRsp->batchMetaRsp); } taosMemoryFree(pRsp); - } void taos_kill_query(TAOS *taos) { @@ -484,7 +483,7 @@ TAOS_ROW taos_fetch_row(TAOS_RES *res) { int taos_print_row(char *str, TAOS_ROW row, TAOS_FIELD *fields, int num_fields) { return taos_print_row_with_size(str, INT32_MAX, row, fields, num_fields); } -int taos_print_row_with_size(char *str, uint32_t size, TAOS_ROW row, TAOS_FIELD *fields, int num_fields){ +int taos_print_row_with_size(char *str, uint32_t size, TAOS_ROW row, TAOS_FIELD *fields, int num_fields) { int32_t len = 0; for (int i = 0; i < num_fields; ++i) { if (i > 0 && len < size - 1) { @@ -589,7 +588,7 @@ int taos_print_row_with_size(char *str, uint32_t size, TAOS_ROW row, TAOS_FIELD break; } } - if (len < size){ + if (len < size) { str[len] = 0; } @@ -2082,7 +2081,7 @@ int taos_stmt2_is_insert(TAOS_STMT2 *stmt, int *insert) { } int taos_stmt2_get_fields(TAOS_STMT2 *stmt, TAOS_FIELD_T field_type, int *count, TAOS_FIELD_E **fields) { - if (stmt == NULL || NULL == count) { + if (stmt == NULL || count == NULL) { tscError("NULL parameter for %s", __FUNCTION__); terrno = TSDB_CODE_INVALID_PARA; return terrno; @@ -2104,7 +2103,7 @@ int taos_stmt2_get_fields(TAOS_STMT2 *stmt, TAOS_FIELD_T field_type, int *count, } int taos_stmt2_get_all_fields(TAOS_STMT2 *stmt, int *count, TAOS_FIELD_E **fields) { - if (stmt == NULL || NULL == count) { + if (stmt == NULL || count == NULL) { tscError("NULL parameter for %s", __FUNCTION__); terrno = TSDB_CODE_INVALID_PARA; return terrno; diff --git a/source/client/src/clientStmt2.c b/source/client/src/clientStmt2.c index 2d76d91e38e9..5d04006f06bd 100644 --- a/source/client/src/clientStmt2.c +++ b/source/client/src/clientStmt2.c @@ -1076,33 +1076,33 @@ static int stmtFetchFields2(STscStmt2* pStmt, int32_t* fieldNum, TAOS_FIELD_E** return TSDB_CODE_INVALID_PARA; } - if (fields) { + if (fields != NULL) { *fields = taosMemoryCalloc(tags->numOfBound, sizeof(TAOS_FIELD_E)); if (NULL == *fields) { return terrno; } SSchema* pSchema = meta->schema; - int32_t tbnameIdx = meta->tableInfo.numOfTags + meta->tableInfo.numOfColumns; + int32_t tbnameIdx = meta->tableInfo.numOfTags + meta->tableInfo.numOfColumns; for (int32_t i = 0; i < tags->numOfBound; ++i) { int16_t idx = tags->pColIndex[i]; if (idx == tbnameIdx) { (*fields)[i].field_type = TAOS_FIELD_TBNAME; - strcpy((*fields)[i].name, "tbname"); + tstrncpy((*fields)[i].name, "tbname", sizeof((*fields)[i].name)); continue; } else if (idx < meta->tableInfo.numOfColumns) { (*fields)[i].field_type = TAOS_FIELD_COL; } else { (*fields)[i].field_type = TAOS_FIELD_TAG; } - SSchema schema = pSchema[tags->pColIndex[i]]; - if (TSDB_DATA_TYPE_TIMESTAMP == schema.type) { + + if (TSDB_DATA_TYPE_TIMESTAMP == pSchema[tags->pColIndex[i]].type) { (*fields)[i].precision = meta->tableInfo.precision; } - tstrncpy((*fields)[i].name, schema.name, sizeof((*fields)[i].name)); - (*fields)[i].type = schema.type; - (*fields)[i].bytes = schema.bytes; + tstrncpy((*fields)[i].name, pSchema[tags->pColIndex[i]].name, sizeof((*fields)[i].name)); + (*fields)[i].type = pSchema[tags->pColIndex[i]].type; + (*fields)[i].bytes = pSchema[tags->pColIndex[i]].bytes; } } diff --git a/source/libs/parser/src/parInsertSql.c b/source/libs/parser/src/parInsertSql.c index 77617ad3b3a0..f4ef09951527 100644 --- a/source/libs/parser/src/parInsertSql.c +++ b/source/libs/parser/src/parInsertSql.c @@ -30,7 +30,7 @@ typedef struct SInsertParseContext { bool forceUpdate; bool needTableTagVal; bool needRequest; // whether or not request server - bool isStmtBind; // whether is stmt bind + bool isStmtBind; // whether is stmt bind } SInsertParseContext; typedef int32_t (*_row_append_fn_t)(SMsgBuf* pMsgBuf, const void* value, int32_t len, void* param); @@ -757,7 +757,7 @@ int32_t parseTagValue(SMsgBuf* pMsgBuf, const char** pSql, uint8_t precision, SS STagVal val = {0}; int32_t code = parseTagToken(pSql, pToken, pTagSchema, precision, &val, pMsgBuf); if (TSDB_CODE_SUCCESS == code) { - if (NULL == taosArrayPush(pTagVals, &val)){ + if (NULL == taosArrayPush(pTagVals, &val)) { code = terrno; } } @@ -775,8 +775,8 @@ static int32_t buildCreateTbReq(SVnodeModifyOpStmt* pStmt, STag* pTag, SArray* p return terrno; } return insBuildCreateTbReq(pStmt->pCreateTblReq, pStmt->targetTableName.tname, pTag, pStmt->pTableMeta->suid, - pStmt->usingTableName.tname, pTagName, pStmt->pTableMeta->tableInfo.numOfTags, - TSDB_DEFAULT_TABLE_TTL); + pStmt->usingTableName.tname, pTagName, pStmt->pTableMeta->tableInfo.numOfTags, + TSDB_DEFAULT_TABLE_TTL); } int32_t checkAndTrimValue(SToken* pToken, char* tmpTokenBuf, SMsgBuf* pMsgBuf, int8_t type) { @@ -813,7 +813,7 @@ typedef struct SRewriteTagCondCxt { static int32_t rewriteTagCondColumnImpl(STagVal* pVal, SNode** pNode) { SValueNode* pValue = NULL; - int32_t code = nodesMakeNode(QUERY_NODE_VALUE, (SNode**)&pValue); + int32_t code = nodesMakeNode(QUERY_NODE_VALUE, (SNode**)&pValue); if (NULL == pValue) { return code; } @@ -1044,7 +1044,7 @@ static int32_t storeChildTableMeta(SInsertParseContext* pCxt, SVnodeModifyOpStmt return TSDB_CODE_OUT_OF_MEMORY; } - char tbFName[TSDB_TABLE_FNAME_LEN]; + char tbFName[TSDB_TABLE_FNAME_LEN]; int32_t code = tNameExtractFullName(&pStmt->targetTableName, tbFName); if (TSDB_CODE_SUCCESS != code) { taosMemoryFree(pBackup); @@ -1239,7 +1239,7 @@ static int32_t getTargetTableMetaAndVgroup(SInsertParseContext* pCxt, SVnodeModi } static int32_t collectUseTable(const SName* pName, SHashObj* pTable) { - char fullName[TSDB_TABLE_FNAME_LEN]; + char fullName[TSDB_TABLE_FNAME_LEN]; int32_t code = tNameExtractFullName(pName, fullName); if (TSDB_CODE_SUCCESS != code) { return code; @@ -1385,7 +1385,7 @@ static int32_t getTableDataCxt(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pS pStmt->pTableMeta, &pStmt->pCreateTblReq, pTableCxt, false, false); } - char tbFName[TSDB_TABLE_FNAME_LEN]; + char tbFName[TSDB_TABLE_FNAME_LEN]; int32_t code = tNameExtractFullName(&pStmt->targetTableName, tbFName); if (TSDB_CODE_SUCCESS != code) { return code; @@ -1926,8 +1926,8 @@ static int32_t processCtbAutoCreationAndCtbMeta(SInsertParseContext* pCxt, SVnod } if (code == TSDB_CODE_SUCCESS) { code = insBuildCreateTbReq(pStbRowsCxt->pCreateCtbReq, pStbRowsCxt->ctbName.tname, pStbRowsCxt->pTag, - pStbRowsCxt->pStbMeta->uid, pStbRowsCxt->stbName.tname, pStbRowsCxt->aTagNames, - getNumOfTags(pStbRowsCxt->pStbMeta), TSDB_DEFAULT_TABLE_TTL); + pStbRowsCxt->pStbMeta->uid, pStbRowsCxt->stbName.tname, pStbRowsCxt->aTagNames, + getNumOfTags(pStbRowsCxt->pStbMeta), TSDB_DEFAULT_TABLE_TTL); pStbRowsCxt->pTag = NULL; } @@ -1936,9 +1936,9 @@ static int32_t processCtbAutoCreationAndCtbMeta(SInsertParseContext* pCxt, SVnod code = tNameExtractFullName(&pStbRowsCxt->ctbName, ctbFName); SVgroupInfo vg; SRequestConnInfo conn = {.pTrans = pCxt->pComCxt->pTransporter, - .requestId = pCxt->pComCxt->requestId, - .requestObjRefId = pCxt->pComCxt->requestRid, - .mgmtEps = pCxt->pComCxt->mgmtEpSet}; + .requestId = pCxt->pComCxt->requestId, + .requestObjRefId = pCxt->pComCxt->requestRid, + .mgmtEps = pCxt->pComCxt->mgmtEpSet}; if (TSDB_CODE_SUCCESS == code) { code = catalogGetTableHashVgroup(pCxt->pComCxt->pCatalog, &conn, &pStbRowsCxt->ctbName, &vg); } @@ -2179,8 +2179,8 @@ static int32_t parseCsvFile(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt if (code == TSDB_CODE_SUCCESS) { SStbRowsDataContext* pStbRowsCxt = rowsDataCxt.pStbRowsCxt; void* pData = pTableDataCxt; - code = taosHashPut(pStmt->pTableCxtHashObj, &pStbRowsCxt->pCtbMeta->uid, sizeof(pStbRowsCxt->pCtbMeta->uid), &pData, - POINTER_BYTES); + code = taosHashPut(pStmt->pTableCxtHashObj, &pStbRowsCxt->pCtbMeta->uid, sizeof(pStbRowsCxt->pCtbMeta->uid), + &pData, POINTER_BYTES); if (TSDB_CODE_SUCCESS != code) { break; } @@ -2252,7 +2252,7 @@ static int32_t parseDataFromFileImpl(SInsertParseContext* pCxt, SVnodeModifyOpSt if (!pStmt->stbSyntax && numOfRows > 0) { void* pData = rowsDataCxt.pTableDataCxt; code = taosHashPut(pStmt->pTableCxtHashObj, &pStmt->pTableMeta->uid, sizeof(pStmt->pTableMeta->uid), &pData, - POINTER_BYTES); + POINTER_BYTES); } return code; @@ -2366,8 +2366,7 @@ static int32_t constructStbRowsDataContext(SVnodeModifyOpStmt* pStmt, SStbRowsDa if (TSDB_CODE_SUCCESS == code) { // col values and bound cols info of STableDataContext is not used pStbRowsCxt->aColVals = taosArrayInit(getNumOfColumns(pStbRowsCxt->pStbMeta), sizeof(SColVal)); - if (!pStbRowsCxt->aColVals) - code = terrno; + if (!pStbRowsCxt->aColVals) code = terrno; } if (TSDB_CODE_SUCCESS == code) { code = insInitColValues(pStbRowsCxt->pStbMeta, pStbRowsCxt->aColVals); @@ -2511,9 +2510,9 @@ static int32_t checkTableClauseFirstToken(SInsertParseContext* pCxt, SVnodeModif } // db.? situation,ensure that the only thing following the '.' mark is '?' - char *tbNameAfterDbName = strnchr(pTbName->z, '.', pTbName->n, true); + char* tbNameAfterDbName = strnchr(pTbName->z, '.', pTbName->n, true); if ((tbNameAfterDbName != NULL) && (*(tbNameAfterDbName + 1) == '?')) { - char *tbName = NULL; + char* tbName = NULL; if (NULL == pCxt->pComCxt->pStmtCb) { return buildSyntaxErrMsg(&pCxt->msg, "? only used in stmt", pTbName->z); } @@ -2528,7 +2527,8 @@ static int32_t checkTableClauseFirstToken(SInsertParseContext* pCxt, SVnodeModif if (pCxt->isStmtBind) { if (TK_NK_ID == pTbName->type || (tbNameAfterDbName != NULL && *(tbNameAfterDbName + 1) != '?')) { // In SQL statements, the table name has already been specified. - parserWarn("0x%" PRIx64 " table name is specified in sql, ignore the table name in bind param", pCxt->pComCxt->requestId); + parserWarn("0x%" PRIx64 " table name is specified in sql, ignore the table name in bind param", + pCxt->pComCxt->requestId); } } @@ -2614,7 +2614,7 @@ static void destroySubTableHashElem(void* p) { taosMemoryFree(*(STableMeta**)p); static int32_t createVnodeModifOpStmt(SInsertParseContext* pCxt, bool reentry, SNode** pOutput) { SVnodeModifyOpStmt* pStmt = NULL; - int32_t code = nodesMakeNode(QUERY_NODE_VNODE_MODIFY_STMT, (SNode**)&pStmt); + int32_t code = nodesMakeNode(QUERY_NODE_VNODE_MODIFY_STMT, (SNode**)&pStmt); if (NULL == pStmt) { return code; } @@ -2729,7 +2729,7 @@ static int32_t buildTagNameFromMeta(STableMeta* pMeta, SArray** pTagName) { return terrno; } SSchema* pSchema = getTableTagSchema(pMeta); - int32_t code = 0; + int32_t code = 0; for (int32_t i = 0; i < pMeta->tableInfo.numOfTags; ++i) { if (NULL == taosArrayPush(*pTagName, pSchema[i].name)) { code = terrno; @@ -2834,7 +2834,7 @@ static int32_t resetVnodeModifOpStmt(SInsertParseContext* pCxt, SQuery* pQuery) } if (NULL == pStmt->pTableBlockHashObj) { pStmt->pTableBlockHashObj = - taosHashInit(128, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK); + taosHashInit(128, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK); } if (NULL == pStmt->pVgroupsHashObj || NULL == pStmt->pTableBlockHashObj) { code = TSDB_CODE_OUT_OF_MEMORY; @@ -2866,7 +2866,7 @@ static int32_t initInsertQuery(SInsertParseContext* pCxt, SCatalogReq* pCatalogR static int32_t setRefreshMeta(SQuery* pQuery) { SVnodeModifyOpStmt* pStmt = (SVnodeModifyOpStmt*)pQuery->pRoot; - int32_t code = 0; + int32_t code = 0; if (taosHashGetSize(pStmt->pTableNameHashObj) > 0) { taosArrayDestroy(pQuery->pTableList); @@ -3065,7 +3065,7 @@ int32_t parseInsertSql(SParseContext* pCxt, SQuery** pQuery, SCatalogReq* pCatal .forceUpdate = (NULL != pCatalogReq ? pCatalogReq->forceUpdate : false), .isStmtBind = pCxt->isStmtBind}; - int32_t code = initInsertQuery(&context, pCatalogReq, pMetaData, pQuery); + int32_t code = initInsertQuery(&context, pCatalogReq, pMetaData, pQuery); SVnodeModifyOpStmt* pStmt = (SVnodeModifyOpStmt*)((*pQuery)->pRoot); if (TSDB_CODE_SUCCESS == code) { code = parseInsertSqlImpl(&context, pStmt); @@ -3082,10 +3082,14 @@ int32_t parseInsertSql(SParseContext* pCxt, SQuery** pQuery, SCatalogReq* pCatal code == TSDB_CODE_TSC_INVALID_OPERATION) { context.tags.numOfBound = pStmt->pStbRowsCxt->boundColsInfo.numOfBound; context.tags.numOfCols = pStmt->pStbRowsCxt->boundColsInfo.numOfCols; - context.tags. hasBoundCols= pStmt->pStbRowsCxt->boundColsInfo.hasBoundCols; + context.tags.hasBoundCols = pStmt->pStbRowsCxt->boundColsInfo.hasBoundCols; context.tags.pColIndex = taosMemoryMalloc(sizeof(int16_t) * context.tags.numOfBound); - memcpy(context.tags.pColIndex, pStmt->pStbRowsCxt->boundColsInfo.pColIndex, - sizeof(int16_t) * pStmt->pStbRowsCxt->boundColsInfo.numOfBound); + if (NULL == context.tags.pColIndex) { + return terrno; + } + + (void)memcpy(context.tags.pColIndex, pStmt->pStbRowsCxt->boundColsInfo.pColIndex, + sizeof(int16_t) * pStmt->pStbRowsCxt->boundColsInfo.numOfBound); code = setStmtInfo(&context, pStmt); if (TSDB_CODE_SUCCESS == code) { insDestroyBoundColInfo(&context.tags); @@ -3094,7 +3098,6 @@ int32_t parseInsertSql(SParseContext* pCxt, SQuery** pQuery, SCatalogReq* pCatal } insDestroyBoundColInfo(&context.tags); - // if no data to insert, set emptyMode to avoid request server if (!context.needRequest) { (*pQuery)->execMode = QUERY_EXEC_MODE_EMPTY_RESULT; diff --git a/source/libs/parser/src/parInsertStmt.c b/source/libs/parser/src/parInsertStmt.c index f18b7b817b4e..8c17689ea7d5 100644 --- a/source/libs/parser/src/parInsertStmt.c +++ b/source/libs/parser/src/parInsertStmt.c @@ -242,7 +242,7 @@ int32_t qBindStmtTagsValue(void* pBlock, void* boundTags, int64_t suid, const ch } code = insBuildCreateTbReq(pDataBlock->pData->pCreateTbReq, tName, pTag, suid, sTableName, tagName, - pDataBlock->pMeta->tableInfo.numOfTags, TSDB_DEFAULT_TABLE_TTL); + pDataBlock->pMeta->tableInfo.numOfTags, TSDB_DEFAULT_TABLE_TTL); pTag = NULL; end: @@ -594,7 +594,7 @@ int32_t qBindStmtTagsValue2(void* pBlock, void* boundTags, int64_t suid, const c } code = insBuildCreateTbReq(pDataBlock->pData->pCreateTbReq, tName, pTag, suid, sTableName, tagName, - pDataBlock->pMeta->tableInfo.numOfTags, TSDB_DEFAULT_TABLE_TTL); + pDataBlock->pMeta->tableInfo.numOfTags, TSDB_DEFAULT_TABLE_TTL); pTag = NULL; end: @@ -886,7 +886,7 @@ int32_t qBindStmtSingleColValue2(void* pBlock, SArray* pCols, TAOS_STMT2_BIND* b int32_t buildBoundFields(int32_t numOfBound, int16_t* boundColumns, SSchema* pSchema, int32_t* fieldNum, TAOS_FIELD_E** fields, uint8_t timePrec, TAOS_FIELD_T fieldType) { - if (fields) { + if (fields != NULL) { *fields = taosMemoryCalloc(numOfBound, sizeof(TAOS_FIELD_E)); if (NULL == *fields) { return terrno; @@ -940,7 +940,7 @@ int32_t qBuildStmtColFields(void* pBlock, int32_t* fieldNum, TAOS_FIELD_E** fiel SSchema* pSchema = getTableColumnSchema(pDataBlock->pMeta); if (pDataBlock->boundColsInfo.numOfBound <= 0) { *fieldNum = 0; - if (fields) { + if (fields != NULL) { *fields = NULL; } From 25ea22e0b17268099de9dcd0b174d59ebbdaa30e Mon Sep 17 00:00:00 2001 From: haoranchen Date: Wed, 30 Oct 2024 14:24:59 +0800 Subject: [PATCH 441/695] Update tests/army/frame/common.py Co-authored-by: WANG Xu --- tests/army/frame/common.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/army/frame/common.py b/tests/army/frame/common.py index bad86c828f36..a82bf4c94f2d 100644 --- a/tests/army/frame/common.py +++ b/tests/army/frame/common.py @@ -807,8 +807,9 @@ def kill_signal_process(self, signal=15, processor_name: str = "taosd"): if (platform.system().lower() == 'windows'): os.system(f"TASKKILL /F /IM {processor_name}.exe") else: - tdLog.debug(f"unset LD_PRELOAD; sudo pkill -f -{signal} '{processor_name}' ") - os.system(f"unset LD_PRELOAD; sudo pkill -f -{signal} '{processor_name}' ") + command = f"unset LD_PRELOAD; sudo pkill -f -{signal} '{processor_name}'" + tdLog.debug(f"command: {command}") + os.system(command) def gen_tag_col_str(self, gen_type, data_type, count): From e9ef7a85744d7a84c6008fe4ea7cb192a03297ac Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Wed, 30 Oct 2024 14:29:26 +0800 Subject: [PATCH 442/695] rename s3_chunksize to s3_chunkpages --- tests/army/storage/blob/ablob.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/army/storage/blob/ablob.py b/tests/army/storage/blob/ablob.py index fae492a3dffe..f6e783d6f3f4 100644 --- a/tests/army/storage/blob/ablob.py +++ b/tests/army/storage/blob/ablob.py @@ -152,13 +152,13 @@ def checkCreateDb(self, keepLocal, chunkSize, compact): if keepLocal is not None: kw1 = f"s3_keeplocal {keepLocal}" if chunkSize is not None: - kw2 = f"s3_chunksize {chunkSize}" + kw2 = f"s3_chunkpages {chunkSize}" if compact is not None: kw3 = f"s3_compact {compact}" sql = f" create database db1 vgroups 1 duration 1h {kw1} {kw2} {kw3}" tdSql.execute(sql, show=True) - #sql = f"select name,s3_keeplocal,s3_chunksize,s3_compact from information_schema.ins_databases where name='db1';" + #sql = f"select name,s3_keeplocal,s3_chunkpages,s3_compact from information_schema.ins_databases where name='db1';" sql = f"select * from information_schema.ins_databases where name='db1';" tdSql.query(sql) # 29 30 31 -> chunksize keeplocal compact @@ -178,9 +178,9 @@ def checkExcept(self): f"create database db2 s3_keeplocal -1", f"create database db2 s3_keeplocal 0", f"create database db2 s3_keeplocal 365001", - f"create database db2 s3_chunksize -1", - f"create database db2 s3_chunksize 0", - f"create database db2 s3_chunksize 900000000", + f"create database db2 s3_chunkpages -1", + f"create database db2 s3_chunkpages 0", + f"create database db2 s3_chunkpages 900000000", f"create database db2 s3_compact -1", f"create database db2 s3_compact 100", f"create database db2 duration 1d s3_keeplocal 1d" From ba88253bf19be9a21855eb8e8a7edf0d012bb7ca Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Wed, 30 Oct 2024 14:42:13 +0800 Subject: [PATCH 443/695] lru: remove commented section --- source/util/src/tlrucache.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/source/util/src/tlrucache.c b/source/util/src/tlrucache.c index 160808f9563c..43a220af50a6 100644 --- a/source/util/src/tlrucache.c +++ b/source/util/src/tlrucache.c @@ -168,14 +168,7 @@ static SLRUEntry **taosLRUEntryTableFindPtr(SLRUEntryTable *table, const void *k while (*entry && ((*entry)->hash != hash || memcmp(key, (*entry)->keyData, keyLen) != 0)) { entry = &(*entry)->nextHash; } - /* - SLRUEntry *pentry = table->list[hash >> (32 - table->lengthBits)]; - SLRUEntry **entry = &table->list[hash >> (32 - table->lengthBits)]; - while (pentry && (pentry->hash != hash || memcmp(key, pentry->keyData, keyLen) != 0)) { - entry = &pentry->nextHash; - pentry = *entry; - } - */ + return entry; } From ef50e5d407dd3ae39929cd5761e9e6646b35e06b Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Wed, 30 Oct 2024 15:21:11 +0800 Subject: [PATCH 444/695] enh: optimize the error message for the case of the drop column --- include/util/taoserror.h | 1 + source/dnode/mnode/impl/src/mndStb.c | 8 ++++---- source/util/src/terror.c | 1 + 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/include/util/taoserror.h b/include/util/taoserror.h index a53923b904be..dd9b90d390cc 100644 --- a/include/util/taoserror.h +++ b/include/util/taoserror.h @@ -392,6 +392,7 @@ int32_t taosGetErrSize(); #define TSDB_CODE_MND_INVALID_SCHEMA_VER TAOS_DEF_ERROR_CODE(0, 0x03C6) #define TSDB_CODE_MND_STABLE_UID_NOT_MATCH TAOS_DEF_ERROR_CODE(0, 0x03C7) #define TSDB_CODE_MND_FIELD_CONFLICT_WITH_TSMA TAOS_DEF_ERROR_CODE(0, 0x03C8) +#define TSDB_CODE_MND_ONLY_TS_SCHEMA_NOT_ALLOW TAOS_DEF_ERROR_CODE(0, 0x03C9) // mnode-trans #define TSDB_CODE_MND_TRANS_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x03D0) diff --git a/source/dnode/mnode/impl/src/mndStb.c b/source/dnode/mnode/impl/src/mndStb.c index 2500d1ef407d..2986bdc117f6 100644 --- a/source/dnode/mnode/impl/src/mndStb.c +++ b/source/dnode/mnode/impl/src/mndStb.c @@ -1928,7 +1928,7 @@ static int32_t mndDropSuperTableColumn(SMnode *pMnode, const SStbObj *pOld, SStb } if (pOld->numOfColumns == 2) { - code = TSDB_CODE_MND_INVALID_STB_ALTER_OPTION; + code = TSDB_CODE_MND_ONLY_TS_SCHEMA_NOT_ALLOW; TAOS_RETURN(code); } @@ -4295,9 +4295,9 @@ static int32_t mndDropTbAdd(SMnode *pMnode, SHashObj *pVgHashMap, const SVgroupI return 0; } -int vgInfoCmp(const void* lp, const void* rp) { - SVgroupInfo* pLeft = (SVgroupInfo*)lp; - SVgroupInfo* pRight = (SVgroupInfo*)rp; +int vgInfoCmp(const void *lp, const void *rp) { + SVgroupInfo *pLeft = (SVgroupInfo *)lp; + SVgroupInfo *pRight = (SVgroupInfo *)rp; if (pLeft->hashBegin < pRight->hashBegin) { return -1; } else if (pLeft->hashBegin > pRight->hashBegin) { diff --git a/source/util/src/terror.c b/source/util/src/terror.c index 52a3be120d5a..0a9eab43f83a 100644 --- a/source/util/src/terror.c +++ b/source/util/src/terror.c @@ -307,6 +307,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_STABLE_UID_NOT_MATCH, "Invalid stable uid") TAOS_DEFINE_ERROR(TSDB_CODE_MND_FIELD_CONFLICT_WITH_TSMA, "Field used by tsma") TAOS_DEFINE_ERROR(TSDB_CODE_MND_DNODE_IN_CREATING, "Dnode in creating status") TAOS_DEFINE_ERROR(TSDB_CODE_MND_DNODE_IN_DROPPING, "Dnode in dropping status") +TAOS_DEFINE_ERROR(TSDB_CODE_MND_ONLY_TS_SCHEMA_NOT_ALLOW, "Schema with only ts field is not allowed") // mnode-trans TAOS_DEFINE_ERROR(TSDB_CODE_MND_TRANS_ALREADY_EXIST, "Transaction already exists") From 4b21fd866df6ea3a95659a9e724cac5ce747218e Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 30 Oct 2024 15:21:32 +0800 Subject: [PATCH 445/695] doc: update os support info --- docs/zh/14-reference/07-supported.md | 47 ++++++++++++++++++---------- 1 file changed, 30 insertions(+), 17 deletions(-) diff --git a/docs/zh/14-reference/07-supported.md b/docs/zh/14-reference/07-supported.md index 10ca237653c8..828c8717e20a 100644 --- a/docs/zh/14-reference/07-supported.md +++ b/docs/zh/14-reference/07-supported.md @@ -6,12 +6,25 @@ description: "TDengine 服务端、客户端和连接器支持的平台列表" ## TDengine 服务端支持的平台列表 -| | **Windows server 2016/2019** | **Windows 10/11** | **CentOS 7.9/8** | **Ubuntu 18 以上** | **统信 UOS** | **银河/中标麒麟** | **凝思 V60/V80** | **macOS** | -| ------------ | ---------------------------- | ----------------- | ---------------- | ------------------ | ------------ | ----------------- | ---------------- | --------- | -| X64 | ●/E | ●/E | ● | ● | ●/E | ●/E | ●/E | ● | -| 树莓派 ARM64 | | | ● | | | | | | -| 华为云 ARM64 | | | | ● | | | | | -| M1 | | | | | | | | ● | +| | **版本** | **X64 64bit** | **ARM64** | **M1** | +| ----------------------|----------------| ------------- | --------- | ------ | +| **CentOS** | **7.9 以上** | ● | ● | | +| **Ubuntu** | **18 以上** | ● | ● | | +| **RedHat** | **RHEL 6 以上** | ● | ● | | +| **Debian** | **6.0 以上** | ● | ● | | +| **FreeBSD** | **12 以上** | ● | ● | | +| **OpenSUSE** | **全部版本** | ● | ● | | +| **SUSE Linux** | **11 以上** | ● | ● | | +| **Fedora** | **21 以上** | ● | ● | | +| **Windows Server** | **2016/2019** | ●/E | | | +| **Windows** | **10/11** | ●/E | | | +| **银河麒麟** | **V10 以上** | ●/E | | | +| **中标麒麟** | **V7.0 以上** | ●/E | | | +| **通信 UOS** | **V20 以上** | ●/E | | | +| **凝思磐石** | **V6.0 以上** | ●/E | | | +| **华为欧拉 openEuler** | **V20.03 以上** | ●/E | | | +| **龙蜥 Anolis OS** | **V8.6 以上** | ●/E | | | +| **macOS** | **11.0 以上** | | | ● | 注:1) ● 表示经过官方测试验证, ○ 表示非官方测试验证,E 表示仅企业版支持。 2) 社区版仅支持主流操作系统的较新版本,包括 Ubuntu 18+/CentOS 7+/RedHat/Debian/CoreOS/FreeBSD/OpenSUSE/SUSE Linux/Fedora/macOS 等。如果有其他操作系统及版本的需求,请联系企业版支持。 @@ -22,16 +35,16 @@ description: "TDengine 服务端、客户端和连接器支持的平台列表" 对照矩阵如下: -| **CPU** | **X64 64bit** | **X64 64bit** | **ARM64** | **X64 64bit** | **ARM64** | -| ----------- | ------------- | ------------- | --------- | ------------- | --------- | -| **OS** | **Linux** | **Win64** | **Linux** | **macOS** | **macOS** | -| **C/C++** | ● | ● | ● | ● | ● | -| **JDBC** | ● | ● | ● | ○ | ○ | -| **Python** | ● | ● | ● | ● | ● | -| **Go** | ● | ● | ● | ● | ● | -| **NodeJs** | ● | ● | ● | ○ | ○ | -| **C#** | ● | ● | ○ | ○ | ○ | -| **Rust** | ● | ● | ○ | ● | ● | -| **RESTful** | ● | ● | ● | ● | ● | +| **CPU** | **X64 64bit** | **X64 64bit** | **X64 64bit** | **ARM64** | **ARM64** | +| ----------- | ------------- | ------------- | ------------- | --------- | --------- | +| **OS** | **Linux** | **Win64** | **macOS** | **Linux** | **macOS** | +| **C/C++** | ● | ● | ● | ● | ● | +| **JDBC** | ● | ● | ○ | ● | ○ | +| **Python** | ● | ● | ● | ● | ● | +| **Go** | ● | ● | ● | ● | ● | +| **NodeJs** | ● | ● | ○ | ● | ○ | +| **C#** | ● | ● | ○ | ○ | ○ | +| **Rust** | ● | ● | ● | ○ | ● | +| **RESTful** | ● | ● | ● | ● | ● | 注:● 表示官方测试验证通过,○ 表示非官方测试验证通过,-- 表示未经验证。 From 0e01b1a9c0dca38c32ede76b6f1b612733c8f38b Mon Sep 17 00:00:00 2001 From: dmchen Date: Wed, 30 Oct 2024 07:29:13 +0000 Subject: [PATCH 446/695] fix/TD-32766-check-ref-before-free-main --- source/dnode/mgmt/mgmt_vnode/src/vmFile.c | 6 +++--- source/dnode/mgmt/mgmt_vnode/src/vmInt.c | 16 ++++++++++++---- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmFile.c b/source/dnode/mgmt/mgmt_vnode/src/vmFile.c index d07fe9c5ac7a..7566b69c02ed 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmFile.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmFile.c @@ -38,7 +38,7 @@ int32_t vmGetAllVnodeListFromHash(SVnodeMgmt *pMgmt, int32_t *numOfVnodes, SVnod SVnodeObj *pVnode = *ppVnode; if (pVnode && num < size) { int32_t refCount = atomic_add_fetch_32(&pVnode->refCount, 1); - // dTrace("vgId:%d, acquire vnode list, ref:%d", pVnode->vgId, refCount); + dTrace("vgId:%d,acquire vnode, vnode:%p, ref:%d", pVnode->vgId, pVnode, refCount); pVnodes[num++] = (*ppVnode); pIter = taosHashIterate(pMgmt->hash, pIter); } else { @@ -52,7 +52,7 @@ int32_t vmGetAllVnodeListFromHash(SVnodeMgmt *pMgmt, int32_t *numOfVnodes, SVnod SVnodeObj *pVnode = *ppVnode; if (pVnode && num < size) { int32_t refCount = atomic_add_fetch_32(&pVnode->refCount, 1); - // dTrace("vgId:%d, acquire vnode list, ref:%d", pVnode->vgId, refCount); + dTrace("vgId:%d, acquire vnode, vnode:%p, ref:%d", pVnode->vgId, pVnode, refCount); pVnodes[num++] = (*ppVnode); pIter = taosHashIterate(pMgmt->closedHash, pIter); } else { @@ -84,7 +84,7 @@ int32_t vmGetVnodeListFromHash(SVnodeMgmt *pMgmt, int32_t *numOfVnodes, SVnodeOb SVnodeObj *pVnode = *ppVnode; if (pVnode && num < size) { int32_t refCount = atomic_add_fetch_32(&pVnode->refCount, 1); - // dTrace("vgId:%d, acquire vnode list, ref:%d", pVnode->vgId, refCount); + dTrace("vgId:%d, acquire vnode, vnode:%p, ref:%d", pVnode->vgId, pVnode, refCount); pVnodes[num++] = (*ppVnode); pIter = taosHashIterate(pMgmt->hash, pIter); } else { diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmInt.c b/source/dnode/mgmt/mgmt_vnode/src/vmInt.c index a28504338268..0913d7539bc6 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmInt.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmInt.c @@ -103,7 +103,7 @@ SVnodeObj *vmAcquireVnodeImpl(SVnodeMgmt *pMgmt, int32_t vgId, bool strict) { pVnode = NULL; } else { int32_t refCount = atomic_add_fetch_32(&pVnode->refCount, 1); - // dTrace("vgId:%d, acquire vnode, ref:%d", pVnode->vgId, refCount); + dTrace("vgId:%d, acquire vnode, vnode:%p, ref:%d", pVnode->vgId, pVnode, refCount); } (void)taosThreadRwlockUnlock(&pMgmt->lock); @@ -115,16 +115,24 @@ SVnodeObj *vmAcquireVnode(SVnodeMgmt *pMgmt, int32_t vgId) { return vmAcquireVno void vmReleaseVnode(SVnodeMgmt *pMgmt, SVnodeObj *pVnode) { if (pVnode == NULL) return; - (void)taosThreadRwlockRdlock(&pMgmt->lock); + //(void)taosThreadRwlockRdlock(&pMgmt->lock); int32_t refCount = atomic_sub_fetch_32(&pVnode->refCount, 1); - // dTrace("vgId:%d, release vnode, ref:%d", pVnode->vgId, refCount); - (void)taosThreadRwlockUnlock(&pMgmt->lock); + dTrace("vgId:%d, release vnode, vnode:%p, ref:%d", pVnode->vgId, pVnode, refCount); + //(void)taosThreadRwlockUnlock(&pMgmt->lock); } static void vmFreeVnodeObj(SVnodeObj **ppVnode) { if (!ppVnode || !(*ppVnode)) return; SVnodeObj *pVnode = *ppVnode; + + int32_t refCount = 1; + while (refCount > 0) { + dWarn("vgId:%d, vnode is refenced, retry to free in 200ms, vnode:%p, ref:%d", pVnode->vgId, pVnode, refCount); + taosMsleep(200); + refCount = atomic_load_32(&pVnode->refCount); + } + taosMemoryFree(pVnode->path); taosMemoryFree(pVnode); ppVnode[0] = NULL; From 83642604034258298de85652cc30f8478a7e8a21 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Wed, 30 Oct 2024 15:30:32 +0800 Subject: [PATCH 447/695] enh: change the error code --- include/util/taoserror.h | 1 - source/dnode/mnode/impl/src/mndStb.c | 2 +- source/util/src/terror.c | 1 - 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/include/util/taoserror.h b/include/util/taoserror.h index dd9b90d390cc..a53923b904be 100644 --- a/include/util/taoserror.h +++ b/include/util/taoserror.h @@ -392,7 +392,6 @@ int32_t taosGetErrSize(); #define TSDB_CODE_MND_INVALID_SCHEMA_VER TAOS_DEF_ERROR_CODE(0, 0x03C6) #define TSDB_CODE_MND_STABLE_UID_NOT_MATCH TAOS_DEF_ERROR_CODE(0, 0x03C7) #define TSDB_CODE_MND_FIELD_CONFLICT_WITH_TSMA TAOS_DEF_ERROR_CODE(0, 0x03C8) -#define TSDB_CODE_MND_ONLY_TS_SCHEMA_NOT_ALLOW TAOS_DEF_ERROR_CODE(0, 0x03C9) // mnode-trans #define TSDB_CODE_MND_TRANS_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x03D0) diff --git a/source/dnode/mnode/impl/src/mndStb.c b/source/dnode/mnode/impl/src/mndStb.c index 2986bdc117f6..3725d3a3fc55 100644 --- a/source/dnode/mnode/impl/src/mndStb.c +++ b/source/dnode/mnode/impl/src/mndStb.c @@ -1928,7 +1928,7 @@ static int32_t mndDropSuperTableColumn(SMnode *pMnode, const SStbObj *pOld, SStb } if (pOld->numOfColumns == 2) { - code = TSDB_CODE_MND_ONLY_TS_SCHEMA_NOT_ALLOW; + code = TSDB_CODE_PAR_INVALID_DROP_COL; TAOS_RETURN(code); } diff --git a/source/util/src/terror.c b/source/util/src/terror.c index 0a9eab43f83a..52a3be120d5a 100644 --- a/source/util/src/terror.c +++ b/source/util/src/terror.c @@ -307,7 +307,6 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_STABLE_UID_NOT_MATCH, "Invalid stable uid") TAOS_DEFINE_ERROR(TSDB_CODE_MND_FIELD_CONFLICT_WITH_TSMA, "Field used by tsma") TAOS_DEFINE_ERROR(TSDB_CODE_MND_DNODE_IN_CREATING, "Dnode in creating status") TAOS_DEFINE_ERROR(TSDB_CODE_MND_DNODE_IN_DROPPING, "Dnode in dropping status") -TAOS_DEFINE_ERROR(TSDB_CODE_MND_ONLY_TS_SCHEMA_NOT_ALLOW, "Schema with only ts field is not allowed") // mnode-trans TAOS_DEFINE_ERROR(TSDB_CODE_MND_TRANS_ALREADY_EXIST, "Transaction already exists") From 935d118f42c295f0e3d7a5ea81b55151b37232fd Mon Sep 17 00:00:00 2001 From: dmchen Date: Wed, 30 Oct 2024 07:29:13 +0000 Subject: [PATCH 448/695] fix/TD-32766-check-ref-before-free-main --- source/dnode/mgmt/mgmt_vnode/src/vmFile.c | 6 +++--- source/dnode/mgmt/mgmt_vnode/src/vmInt.c | 16 ++++++++++++---- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmFile.c b/source/dnode/mgmt/mgmt_vnode/src/vmFile.c index d07fe9c5ac7a..7566b69c02ed 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmFile.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmFile.c @@ -38,7 +38,7 @@ int32_t vmGetAllVnodeListFromHash(SVnodeMgmt *pMgmt, int32_t *numOfVnodes, SVnod SVnodeObj *pVnode = *ppVnode; if (pVnode && num < size) { int32_t refCount = atomic_add_fetch_32(&pVnode->refCount, 1); - // dTrace("vgId:%d, acquire vnode list, ref:%d", pVnode->vgId, refCount); + dTrace("vgId:%d,acquire vnode, vnode:%p, ref:%d", pVnode->vgId, pVnode, refCount); pVnodes[num++] = (*ppVnode); pIter = taosHashIterate(pMgmt->hash, pIter); } else { @@ -52,7 +52,7 @@ int32_t vmGetAllVnodeListFromHash(SVnodeMgmt *pMgmt, int32_t *numOfVnodes, SVnod SVnodeObj *pVnode = *ppVnode; if (pVnode && num < size) { int32_t refCount = atomic_add_fetch_32(&pVnode->refCount, 1); - // dTrace("vgId:%d, acquire vnode list, ref:%d", pVnode->vgId, refCount); + dTrace("vgId:%d, acquire vnode, vnode:%p, ref:%d", pVnode->vgId, pVnode, refCount); pVnodes[num++] = (*ppVnode); pIter = taosHashIterate(pMgmt->closedHash, pIter); } else { @@ -84,7 +84,7 @@ int32_t vmGetVnodeListFromHash(SVnodeMgmt *pMgmt, int32_t *numOfVnodes, SVnodeOb SVnodeObj *pVnode = *ppVnode; if (pVnode && num < size) { int32_t refCount = atomic_add_fetch_32(&pVnode->refCount, 1); - // dTrace("vgId:%d, acquire vnode list, ref:%d", pVnode->vgId, refCount); + dTrace("vgId:%d, acquire vnode, vnode:%p, ref:%d", pVnode->vgId, pVnode, refCount); pVnodes[num++] = (*ppVnode); pIter = taosHashIterate(pMgmt->hash, pIter); } else { diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmInt.c b/source/dnode/mgmt/mgmt_vnode/src/vmInt.c index a28504338268..0913d7539bc6 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmInt.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmInt.c @@ -103,7 +103,7 @@ SVnodeObj *vmAcquireVnodeImpl(SVnodeMgmt *pMgmt, int32_t vgId, bool strict) { pVnode = NULL; } else { int32_t refCount = atomic_add_fetch_32(&pVnode->refCount, 1); - // dTrace("vgId:%d, acquire vnode, ref:%d", pVnode->vgId, refCount); + dTrace("vgId:%d, acquire vnode, vnode:%p, ref:%d", pVnode->vgId, pVnode, refCount); } (void)taosThreadRwlockUnlock(&pMgmt->lock); @@ -115,16 +115,24 @@ SVnodeObj *vmAcquireVnode(SVnodeMgmt *pMgmt, int32_t vgId) { return vmAcquireVno void vmReleaseVnode(SVnodeMgmt *pMgmt, SVnodeObj *pVnode) { if (pVnode == NULL) return; - (void)taosThreadRwlockRdlock(&pMgmt->lock); + //(void)taosThreadRwlockRdlock(&pMgmt->lock); int32_t refCount = atomic_sub_fetch_32(&pVnode->refCount, 1); - // dTrace("vgId:%d, release vnode, ref:%d", pVnode->vgId, refCount); - (void)taosThreadRwlockUnlock(&pMgmt->lock); + dTrace("vgId:%d, release vnode, vnode:%p, ref:%d", pVnode->vgId, pVnode, refCount); + //(void)taosThreadRwlockUnlock(&pMgmt->lock); } static void vmFreeVnodeObj(SVnodeObj **ppVnode) { if (!ppVnode || !(*ppVnode)) return; SVnodeObj *pVnode = *ppVnode; + + int32_t refCount = 1; + while (refCount > 0) { + dWarn("vgId:%d, vnode is refenced, retry to free in 200ms, vnode:%p, ref:%d", pVnode->vgId, pVnode, refCount); + taosMsleep(200); + refCount = atomic_load_32(&pVnode->refCount); + } + taosMemoryFree(pVnode->path); taosMemoryFree(pVnode); ppVnode[0] = NULL; From 65f11a24633d7457e41aec32c6a81be5e79b0c09 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 30 Oct 2024 15:38:29 +0800 Subject: [PATCH 449/695] doc: minor changes --- docs/zh/14-reference/07-supported.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/zh/14-reference/07-supported.md b/docs/zh/14-reference/07-supported.md index 828c8717e20a..96d12311be0c 100644 --- a/docs/zh/14-reference/07-supported.md +++ b/docs/zh/14-reference/07-supported.md @@ -18,10 +18,10 @@ description: "TDengine 服务端、客户端和连接器支持的平台列表" | **Fedora** | **21 以上** | ● | ● | | | **Windows Server** | **2016/2019** | ●/E | | | | **Windows** | **10/11** | ●/E | | | -| **银河麒麟** | **V10 以上** | ●/E | | | -| **中标麒麟** | **V7.0 以上** | ●/E | | | +| **银河麒麟** | **V10 以上** | ●/E | ●/E | | +| **中标麒麟** | **V7.0 以上** | ●/E | ●/E | | | **通信 UOS** | **V20 以上** | ●/E | | | -| **凝思磐石** | **V6.0 以上** | ●/E | | | +| **凝思磐石** | **V8.0 以上** | ●/E | | | | **华为欧拉 openEuler** | **V20.03 以上** | ●/E | | | | **龙蜥 Anolis OS** | **V8.6 以上** | ●/E | | | | **macOS** | **11.0 以上** | | | ● | From eed49788c0cfac34a3acc431d209732747937993 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 30 Oct 2024 15:50:39 +0800 Subject: [PATCH 450/695] doc: update index --- docs/zh/01-index.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/zh/01-index.md b/docs/zh/01-index.md index 32ea117fbb26..1c9ad0b2e1c4 100644 --- a/docs/zh/01-index.md +++ b/docs/zh/01-index.md @@ -6,7 +6,7 @@ slug: / TDengine 是一款[开源](https://www.taosdata.com/tdengine/open_source_time-series_database)、[高性能](https://www.taosdata.com/fast)、[云原生](https://www.taosdata.com/tdengine/cloud_native_time-series_database)的时序数据库Time Series Database, TSDB), 它专为物联网、车联网、工业互联网、金融、IT 运维等场景优化设计。同时它还带有内建的缓存、流式计算、数据订阅等系统功能,能大幅减少系统设计的复杂度,降低研发和运营成本,是一款极简的时序数据处理平台。本文档是 TDengine 的用户手册,主要是介绍 TDengine 的基本概念、安装、使用、功能、开发接口、运营维护、TDengine 内核设计等等,它主要是面向架构师、开发工程师与系统管理员的。如果你对时序数据的基本概念、价值以及其所能带来的业务价值尚不了解,请参考[时序数据基础](./concept) -TDengine 充分利用了时序数据的特点,提出了“一个数据采集点一张表”与“超级表”的概念,设计了创新的存储引擎,让数据的写入、查询和存储效率都得到极大的提升。为正确理解并使用 TDengine,无论如何,请您仔细阅读[数据模型](./basic/model)一章。 +TDengine 充分利用了时序数据的特点,提出了“一个数据采集点一张表”与“超级表”的概念,设计了创新的存储引擎,让数据的写入、查询和存储效率都得到极大的提升。为正确理解并使用 TDengine,无论你在工作中是什么角色,请您仔细阅读[数据模型](./basic/model)一章。 如果你是开发工程师,请一定仔细阅读[开发指南](./develop)一章,该部分对数据库连接、建模、插入数据、查询、流式计算、缓存、数据订阅、用户自定义函数等功能都做了详细介绍,并配有各种编程语言的示例代码。大部分情况下,你只要复制粘贴示例代码,针对自己的应用稍作改动,就能跑起来。对 REST API、各种编程语言的连接器(Connector)想做更多详细了解的话,请看[连接器](./reference/connector)一章。 @@ -16,6 +16,8 @@ TDengine 采用 SQL 作为查询语言,大大降低学习成本、降低迁移 如果你是系统管理员,关心安装、升级、容错灾备、关心数据导入、导出、配置参数,如何监测 TDengine 是否健康运行,如何提升系统运行的性能,请仔细参考[运维指南](./operation)一章。 +如果你对数据库内核设计感兴趣,或是开源爱好者,建议仔细阅读[技术内幕](./tdinterna)一章。该章从分布式架构到存储引擎、查询引擎、数据订阅,再到流计算引擎都做了详细阐述。建议对照文档,查看TDengine在GitHub的源代码,对TDengine的设计和编码做深入了解,更欢迎加入开源社区,贡献代码。 + 最后,作为一个开源软件,欢迎大家的参与。如果发现文档有任何错误、描述不清晰的地方,请在每个页面的最下方,点击“编辑本文档”直接进行修改。 Together, we make a difference! From 1cdad6572410aa034f909e85589b5189cca3a5e6 Mon Sep 17 00:00:00 2001 From: Chait Diwadkar <94201190+cdiwadkar16@users.noreply.github.com> Date: Fri, 6 Sep 2024 14:01:09 -0700 Subject: [PATCH 451/695] docs/Update 01-docker.md Corrected spelling mistake and have a statement on how to login to taos-explorer using root/taosdata. --- docs/en/04-get-started/01-docker.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/en/04-get-started/01-docker.md b/docs/en/04-get-started/01-docker.md index 882e2ef19405..f361e5a10f2c 100644 --- a/docs/en/04-get-started/01-docker.md +++ b/docs/en/04-get-started/01-docker.md @@ -75,9 +75,9 @@ taos> ## TDegnine Graphic User Interface -From TDengine 3.3.0.0, there is a new componenet called `taos-explorer` added in the TDengine docker image. You can use it to manage the databases, super tables, child tables, and data in your TDengine system. There are also some features only available in TDengine Enterprise Edition, please contact TDengine sales team in case you need these features. +From TDengine 3.3.0.0, there is a new component called `taos-explorer` added in the TDengine docker image. You can use it to manage the databases, super tables, child tables, and data in your TDengine system. There are also some features only available in TDengine Enterprise Edition, please contact TDengine sales team in case you need these features. -To use taos-explorer in the container, you need to access the host port mapped from container port 6060. Assuming the host name is abc.com, and the port used on host is 6060, you need to access `http://abc.com:6060`. taos-explorer uses port 6060 by default in the container. When you use it the first time, you need to register with your enterprise email, then can logon using your user name and password in the TDengine database management system. +To use taos-explorer in the container, you need to access the host port mapped from container port 6060. Assuming the host name is abc.com, and the port used on host is 6060, you need to access `http://abc.com:6060`. taos-explorer uses port 6060 by default in the container. The default username and password to log in to the TDengine Database Management System is "root/taosdata". ## Test data insert performance From 6da22e64838a677c7bd68e8d017771963fb0a01e Mon Sep 17 00:00:00 2001 From: Shungang Li Date: Wed, 30 Oct 2024 16:13:27 +0800 Subject: [PATCH 452/695] enh: tsdb cache schema --- source/dnode/vnode/src/tsdb/tsdbCache.c | 37 ++++++++++++++----------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbCache.c b/source/dnode/vnode/src/tsdb/tsdbCache.c index 16812b16f4a1..334725d9d0b2 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCache.c +++ b/source/dnode/vnode/src/tsdb/tsdbCache.c @@ -230,6 +230,7 @@ static int32_t tsdbOpenRocksCache(STsdb *pTsdb) { pTsdb->rCache.readoptions = readoptions; pTsdb->rCache.flushoptions = flushoptions; pTsdb->rCache.db = db; + pTsdb->rCache.sver = -1; pTsdb->rCache.suid = -1; pTsdb->rCache.uid = -1; pTsdb->rCache.pTSchema = NULL; @@ -1303,31 +1304,35 @@ static int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, SArray } void tsdbCacheInvalidateSchema(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, int32_t sver) { - if (pTsdb->rCache.pTSchema && pTsdb->rCache.suid == suid) { - if (pTsdb->rCache.suid && sver == pTsdb->rCache.sver) { - pTsdb->rCache.sver = -1; - pTsdb->rCache.suid = -1; - } else if (pTsdb->rCache.uid == uid && pTsdb->rCache.sver == sver) { - pTsdb->rCache.sver = -1; - pTsdb->rCache.uid = -1; - } + SRocksCache *pRCache = &pTsdb->rCache; + if (!pRCache->pTSchema || sver <= pTsdb->rCache.sver) return; + + if (suid > 0 && suid == pRCache->suid) { + pRCache->sver = -1; + pRCache->suid = -1; + } + if (suid == 0 && uid == pRCache->uid) { + pRCache->sver = -1; + pRCache->uid = -1; } } static int32_t tsdbUpdateSkm(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, int32_t sver) { - if (pTsdb->rCache.pTSchema && pTsdb->rCache.suid == suid) { - if (pTsdb->rCache.suid && sver == pTsdb->rCache.sver) { + SRocksCache *pRCache = &pTsdb->rCache; + if (pRCache->pTSchema && sver == pRCache->sver) { + if (suid > 0 && suid == pRCache->suid) { return 0; - } else if (pTsdb->rCache.uid == uid && pTsdb->rCache.sver == sver) { + } + if (suid == 0 && uid == pRCache->uid) { return 0; } } - pTsdb->rCache.suid = suid; - pTsdb->rCache.uid = uid; - pTsdb->rCache.sver = sver; - tDestroyTSchema(pTsdb->rCache.pTSchema); - return metaGetTbTSchemaEx(pTsdb->pVnode->pMeta, suid, uid, -1, &pTsdb->rCache.pTSchema); + pRCache->suid = suid; + pRCache->uid = uid; + pRCache->sver = sver; + tDestroyTSchema(pRCache->pTSchema); + return metaGetTbTSchemaEx(pTsdb->pVnode->pMeta, suid, uid, -1, &pRCache->pTSchema); } int32_t tsdbCacheRowFormatUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, int64_t version, int32_t nRow, From 016c4fa9d7009b00e5231cb9c55da2d53e28e62d Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 30 Oct 2024 16:14:14 +0800 Subject: [PATCH 453/695] doc: update minor errors --- docs/zh/14-reference/07-supported.md | 38 ++++++++++++++-------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/docs/zh/14-reference/07-supported.md b/docs/zh/14-reference/07-supported.md index 96d12311be0c..a0622571430a 100644 --- a/docs/zh/14-reference/07-supported.md +++ b/docs/zh/14-reference/07-supported.md @@ -6,25 +6,25 @@ description: "TDengine 服务端、客户端和连接器支持的平台列表" ## TDengine 服务端支持的平台列表 -| | **版本** | **X64 64bit** | **ARM64** | **M1** | -| ----------------------|----------------| ------------- | --------- | ------ | -| **CentOS** | **7.9 以上** | ● | ● | | -| **Ubuntu** | **18 以上** | ● | ● | | -| **RedHat** | **RHEL 6 以上** | ● | ● | | -| **Debian** | **6.0 以上** | ● | ● | | -| **FreeBSD** | **12 以上** | ● | ● | | -| **OpenSUSE** | **全部版本** | ● | ● | | -| **SUSE Linux** | **11 以上** | ● | ● | | -| **Fedora** | **21 以上** | ● | ● | | -| **Windows Server** | **2016/2019** | ●/E | | | -| **Windows** | **10/11** | ●/E | | | -| **银河麒麟** | **V10 以上** | ●/E | ●/E | | -| **中标麒麟** | **V7.0 以上** | ●/E | ●/E | | -| **通信 UOS** | **V20 以上** | ●/E | | | -| **凝思磐石** | **V8.0 以上** | ●/E | | | -| **华为欧拉 openEuler** | **V20.03 以上** | ●/E | | | -| **龙蜥 Anolis OS** | **V8.6 以上** | ●/E | | | -| **macOS** | **11.0 以上** | | | ● | +| | **版本** | **X64 64bit** | **ARM64** | +| ----------------------|----------------| ------------- | --------- | +| **CentOS** | **7.9 以上** | ● | ● | +| **Ubuntu** | **18 以上** | ● | ● | +| **RedHat** | **RHEL 7 以上** | ● | ● | +| **Debian** | **6.0 以上** | ● | ● | +| **FreeBSD** | **12 以上** | ● | ● | +| **OpenSUSE** | **全部版本** | ● | ● | +| **SUSE Linux** | **11 以上** | ● | ● | +| **Fedora** | **21 以上** | ● | ● | +| **Windows Server** | **2016 以上** | ●/E | | +| **Windows** | **10/11** | ●/E | | +| **银河麒麟** | **V10 以上** | ●/E | ●/E | +| **中标麒麟** | **V7.0 以上** | ●/E | ●/E | +| **统信 UOS** | **V20 以上** | ●/E | | +| **凝思磐石** | **V8.0 以上** | ●/E | | +| **华为欧拉 openEuler** | **V20.03 以上** | ●/E | | +| **龙蜥 Anolis OS** | **V8.6 以上** | ●/E | | +| **macOS** | **11.0 以上** | | ● | 注:1) ● 表示经过官方测试验证, ○ 表示非官方测试验证,E 表示仅企业版支持。 2) 社区版仅支持主流操作系统的较新版本,包括 Ubuntu 18+/CentOS 7+/RedHat/Debian/CoreOS/FreeBSD/OpenSUSE/SUSE Linux/Fedora/macOS 等。如果有其他操作系统及版本的需求,请联系企业版支持。 From 6aba3e9cac2a2de018161c82376e78a2bceea996 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 30 Oct 2024 16:17:53 +0800 Subject: [PATCH 454/695] doc: minor changes --- docs/zh/14-reference/07-supported.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/zh/14-reference/07-supported.md b/docs/zh/14-reference/07-supported.md index a0622571430a..f98f96755ae3 100644 --- a/docs/zh/14-reference/07-supported.md +++ b/docs/zh/14-reference/07-supported.md @@ -43,7 +43,7 @@ description: "TDengine 服务端、客户端和连接器支持的平台列表" | **Python** | ● | ● | ● | ● | ● | | **Go** | ● | ● | ● | ● | ● | | **NodeJs** | ● | ● | ○ | ● | ○ | -| **C#** | ● | ● | ○ | ○ | ○ | +| **C#** | ● | ● | ○ | ● | ○ | | **Rust** | ● | ● | ● | ○ | ● | | **RESTful** | ● | ● | ● | ● | ● | From 57743282dbdeef25e8760018190bb9dae8d1e705 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Wed, 30 Oct 2024 16:23:57 +0800 Subject: [PATCH 455/695] handle quit error --- source/libs/transport/src/transCli.c | 38 ++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index 36fc9a784638..6f843d7fc3ae 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -132,6 +132,7 @@ typedef struct SCliReq { uint64_t st; int64_t seq; int32_t sent; //(0: no send, 1: alread sent) + int8_t inSendQ; STransMsg msg; int8_t inRetry; @@ -275,6 +276,8 @@ static FORCE_INLINE void destroyReqAndAhanlde(void* cmsg); static FORCE_INLINE int cliRBChoseIdx(STrans* pInst); static FORCE_INLINE void destroyReqCtx(SReqCtx* ctx); +static FORCE_INLINE void removeReqFromSendQ(SCliReq* pReq); + static int32_t cliHandleState_mayUpdateState(SCliConn* pConn, SCliReq* pReq); static int32_t cliHandleState_mayHandleReleaseResp(SCliConn* conn, STransMsgHead* pHead); static int32_t cliHandleState_mayCreateAhandle(SCliConn* conn, STransMsgHead* pHead, STransMsg* pResp); @@ -701,6 +704,7 @@ void cliHandleResp(SCliConn* conn) { tstrerror(code)); } } + removeReqFromSendQ(pReq); code = cliBuildRespFromCont(pReq, &resp, pHead); STraceId* trace = &resp.info.traceId; @@ -1279,7 +1283,7 @@ static void cliHandleException(SCliConn* conn) { bool filterToRmReq(void* h, void* arg) { queue* el = h; SCliReq* pReq = QUEUE_DATA(el, SCliReq, q); - if (pReq->sent == 1 && REQUEST_NO_RESP(&pReq->msg)) { + if (pReq->sent == 1 && pReq->inSendQ == 0 && REQUEST_NO_RESP(&pReq->msg)) { return true; } return false; @@ -1311,7 +1315,7 @@ static void cliBatchSendCb(uv_write_t* req, int status) { QUEUE_REMOVE(h); SCliReq* pReq = QUEUE_DATA(h, SCliReq, sendQ); - pReq->sent = 1; + pReq->inSendQ = 0; } freeWReqToWQ(&conn->wq, wrapper); @@ -1473,6 +1477,7 @@ int32_t cliBatchSend(SCliConn* pConn, int8_t direct) { totalLen += msgLen; pCliMsg->seq = pConn->seq; + pCliMsg->inSendQ = 1; STraceId* trace = &pCliMsg->msg.info.traceId; tGDebug("%s conn %p %s is sent to %s, local info:%s, seq:%" PRId64 ", sid:%" PRId64 "", CONN_GET_INST_LABEL(pConn), @@ -1482,6 +1487,8 @@ int32_t cliBatchSend(SCliConn* pConn, int8_t direct) { transQueuePush(&pConn->reqsSentOut, &pCliMsg->q); QUEUE_INIT(&pCliMsg->sendQ); QUEUE_PUSH(&reqToSend, &pCliMsg->sendQ); + + pCliMsg->inSendQ = 1; if (j >= batchLimit) { break; } @@ -1491,6 +1498,14 @@ int32_t cliBatchSend(SCliConn* pConn, int8_t direct) { if (req == NULL) { tError("%s conn %p failed to send msg since %s", CONN_GET_INST_LABEL(pConn), pConn, tstrerror(terrno)); + while (!QUEUE_IS_EMPTY(&reqToSend)) { + queue* h = QUEUE_HEAD(&reqToSend); + QUEUE_REMOVE(h); + + SCliReq* pCliMsg = QUEUE_DATA(h, SCliReq, sendQ); + pCliMsg->inSendQ = 0; + } + transRefCliHandle(pConn); return terrno; } @@ -1503,6 +1518,14 @@ int32_t cliBatchSend(SCliConn* pConn, int8_t direct) { int32_t ret = uv_write(req, (uv_stream_t*)pConn->stream, wb, j, cliBatchSendCb); if (ret != 0) { tError("%s conn %p failed to send msg since %s", CONN_GET_INST_LABEL(pConn), pConn, uv_err_name(ret)); + while (!QUEUE_IS_EMPTY(&pWreq->node)) { + queue* h = QUEUE_HEAD(&pWreq->node); + QUEUE_REMOVE(h); + + SCliReq* pCliMsg = QUEUE_DATA(h, SCliReq, sendQ); + pCliMsg->inSendQ = 0; + } + freeWReqToWQ(&pConn->wq, req->data); code = TSDB_CODE_THIRDPARTY_ERROR; TAOS_UNUSED(transUnrefCliHandle(pConn)); @@ -2214,11 +2237,21 @@ static void cliAsyncCb(uv_async_t* handle) { if (pThrd->stopMsg != NULL) cliHandleQuit(pThrd, pThrd->stopMsg); } +static FORCE_INLINE void removeReqFromSendQ(SCliReq* pReq) { + if (pReq == NULL || pReq->inSendQ == 0) { + return; + } + QUEUE_REMOVE(&pReq->sendQ); + pReq->inSendQ = 0; +} + static FORCE_INLINE void destroyReq(void* arg) { SCliReq* pReq = arg; if (pReq == NULL) { return; } + + removeReqFromSendQ(pReq); STraceId* trace = &pReq->msg.info.traceId; tGDebug("free memory:%p, free ctx: %p", pReq, pReq->ctx); @@ -2993,6 +3026,7 @@ int32_t cliNotifyCb(SCliConn* pConn, SCliReq* pReq, STransMsg* pResp) { STrans* pInst = pThrd->pInst; if (pReq != NULL) { + removeReqFromSendQ(pReq); if (pResp->code != TSDB_CODE_SUCCESS) { if (cliMayRetry(pConn, pReq, pResp)) { return TSDB_CODE_RPC_ASYNC_IN_PROCESS; From 8d4813590fcb3e6d5a1a1420686cc87d7b19f32e Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Wed, 30 Oct 2024 16:27:44 +0800 Subject: [PATCH 456/695] handle quit error --- source/libs/transport/src/transCli.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index 6f843d7fc3ae..9d4608c0994f 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -1477,13 +1477,12 @@ int32_t cliBatchSend(SCliConn* pConn, int8_t direct) { totalLen += msgLen; pCliMsg->seq = pConn->seq; - pCliMsg->inSendQ = 1; + pCliMsg->sent = 1; STraceId* trace = &pCliMsg->msg.info.traceId; tGDebug("%s conn %p %s is sent to %s, local info:%s, seq:%" PRId64 ", sid:%" PRId64 "", CONN_GET_INST_LABEL(pConn), pConn, TMSG_INFO(pReq->msgType), pConn->dst, pConn->src, pConn->seq, pReq->info.qId); - // QUEUE_PUSH(&reqToSend, &pCliMsg->q); transQueuePush(&pConn->reqsSentOut, &pCliMsg->q); QUEUE_INIT(&pCliMsg->sendQ); QUEUE_PUSH(&reqToSend, &pCliMsg->sendQ); @@ -1500,10 +1499,9 @@ int32_t cliBatchSend(SCliConn* pConn, int8_t direct) { tError("%s conn %p failed to send msg since %s", CONN_GET_INST_LABEL(pConn), pConn, tstrerror(terrno)); while (!QUEUE_IS_EMPTY(&reqToSend)) { queue* h = QUEUE_HEAD(&reqToSend); - QUEUE_REMOVE(h); SCliReq* pCliMsg = QUEUE_DATA(h, SCliReq, sendQ); - pCliMsg->inSendQ = 0; + removeReqFromSendQ(pCliMsg); } transRefCliHandle(pConn); @@ -1519,11 +1517,9 @@ int32_t cliBatchSend(SCliConn* pConn, int8_t direct) { if (ret != 0) { tError("%s conn %p failed to send msg since %s", CONN_GET_INST_LABEL(pConn), pConn, uv_err_name(ret)); while (!QUEUE_IS_EMPTY(&pWreq->node)) { - queue* h = QUEUE_HEAD(&pWreq->node); - QUEUE_REMOVE(h); - + queue* h = QUEUE_HEAD(&pWreq->node); SCliReq* pCliMsg = QUEUE_DATA(h, SCliReq, sendQ); - pCliMsg->inSendQ = 0; + removeReqFromSendQ(pCliMsg); } freeWReqToWQ(&pConn->wq, req->data); From 70c9d9847f8a56d46a7a51ab77183671b855dcf5 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Wed, 30 Oct 2024 16:28:26 +0800 Subject: [PATCH 457/695] handle quit error --- source/libs/transport/src/transCli.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index 9d4608c0994f..02bc6cd2d5cd 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -1498,8 +1498,7 @@ int32_t cliBatchSend(SCliConn* pConn, int8_t direct) { if (req == NULL) { tError("%s conn %p failed to send msg since %s", CONN_GET_INST_LABEL(pConn), pConn, tstrerror(terrno)); while (!QUEUE_IS_EMPTY(&reqToSend)) { - queue* h = QUEUE_HEAD(&reqToSend); - + queue* h = QUEUE_HEAD(&reqToSend); SCliReq* pCliMsg = QUEUE_DATA(h, SCliReq, sendQ); removeReqFromSendQ(pCliMsg); } From cd0a23c983a90d9df57030454a48fab4d01baa59 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Wed, 30 Oct 2024 16:29:42 +0800 Subject: [PATCH 458/695] remove sudo --- tests/pytest/util/common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/pytest/util/common.py b/tests/pytest/util/common.py index 1ec6d2cbb990..5827f0757f54 100644 --- a/tests/pytest/util/common.py +++ b/tests/pytest/util/common.py @@ -840,7 +840,7 @@ def killProcessor(self, processorName): if (platform.system().lower() == 'windows'): os.system("TASKKILL /F /IM %s.exe"%processorName) else: - os.system("unset LD_PRELOAD; sudo pkill %s " % processorName) + os.system("unset LD_PRELOAD; pkill %s " % processorName) def gen_tag_col_str(self, gen_type, data_type, count): """ From a191e9993a4a309e5be89249ddd085a69dc2a24d Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Wed, 30 Oct 2024 16:30:46 +0800 Subject: [PATCH 459/695] handle quit error --- source/libs/transport/src/transCli.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index 02bc6cd2d5cd..1e4276c4385d 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -1311,11 +1311,9 @@ static void cliBatchSendCb(uv_write_t* req, int status) { STrans* pInst = pThrd->pInst; while (!QUEUE_IS_EMPTY(&wrapper->node)) { - queue* h = QUEUE_HEAD(&wrapper->node); - QUEUE_REMOVE(h); - + queue* h = QUEUE_HEAD(&wrapper->node); SCliReq* pReq = QUEUE_DATA(h, SCliReq, sendQ); - pReq->inSendQ = 0; + removeReqFromSendQ(pReq); } freeWReqToWQ(&conn->wq, wrapper); From 25064ce77cbdea4d95cffc1cb64d26fdb0600d4d Mon Sep 17 00:00:00 2001 From: RuiLiang51666 <130521128+RuiLiang51666@users.noreply.github.com> Date: Thu, 12 Sep 2024 15:35:19 +0800 Subject: [PATCH 460/695] Update 01-index.md add the missing period. --- docs/zh/01-index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/zh/01-index.md b/docs/zh/01-index.md index 1c9ad0b2e1c4..1fda72024ce4 100644 --- a/docs/zh/01-index.md +++ b/docs/zh/01-index.md @@ -4,7 +4,7 @@ sidebar_label: 文档首页 slug: / --- -TDengine 是一款[开源](https://www.taosdata.com/tdengine/open_source_time-series_database)、[高性能](https://www.taosdata.com/fast)、[云原生](https://www.taosdata.com/tdengine/cloud_native_time-series_database)的时序数据库Time Series Database, TSDB), 它专为物联网、车联网、工业互联网、金融、IT 运维等场景优化设计。同时它还带有内建的缓存、流式计算、数据订阅等系统功能,能大幅减少系统设计的复杂度,降低研发和运营成本,是一款极简的时序数据处理平台。本文档是 TDengine 的用户手册,主要是介绍 TDengine 的基本概念、安装、使用、功能、开发接口、运营维护、TDengine 内核设计等等,它主要是面向架构师、开发工程师与系统管理员的。如果你对时序数据的基本概念、价值以及其所能带来的业务价值尚不了解,请参考[时序数据基础](./concept) +TDengine 是一款[开源](https://www.taosdata.com/tdengine/open_source_time-series_database)、[高性能](https://www.taosdata.com/fast)、[云原生](https://www.taosdata.com/tdengine/cloud_native_time-series_database)的时序数据库Time Series Database, TSDB), 它专为物联网、车联网、工业互联网、金融、IT 运维等场景优化设计。同时它还带有内建的缓存、流式计算、数据订阅等系统功能,能大幅减少系统设计的复杂度,降低研发和运营成本,是一款极简的时序数据处理平台。本文档是 TDengine 的用户手册,主要是介绍 TDengine 的基本概念、安装、使用、功能、开发接口、运营维护、TDengine 内核设计等等,它主要是面向架构师、开发工程师与系统管理员的。如果你对时序数据的基本概念、价值以及其所能带来的业务价值尚不了解,请参考[时序数据基础](./concept)。 TDengine 充分利用了时序数据的特点,提出了“一个数据采集点一张表”与“超级表”的概念,设计了创新的存储引擎,让数据的写入、查询和存储效率都得到极大的提升。为正确理解并使用 TDengine,无论你在工作中是什么角色,请您仔细阅读[数据模型](./basic/model)一章。 From fbb8585593968ba5194ba699613b0ee361628490 Mon Sep 17 00:00:00 2001 From: dmchen Date: Wed, 30 Oct 2024 09:00:42 +0000 Subject: [PATCH 461/695] fix/TD-32766-check-ref-before-free-check-first --- source/dnode/mgmt/mgmt_vnode/src/vmInt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmInt.c b/source/dnode/mgmt/mgmt_vnode/src/vmInt.c index 0913d7539bc6..682c1792709d 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmInt.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmInt.c @@ -126,7 +126,7 @@ static void vmFreeVnodeObj(SVnodeObj **ppVnode) { SVnodeObj *pVnode = *ppVnode; - int32_t refCount = 1; + int32_t refCount = atomic_load_32(&pVnode->refCount); while (refCount > 0) { dWarn("vgId:%d, vnode is refenced, retry to free in 200ms, vnode:%p, ref:%d", pVnode->vgId, pVnode, refCount); taosMsleep(200); From eaba7dfb5fcff1ac8e0afdb47be3aa009f89ed45 Mon Sep 17 00:00:00 2001 From: dmchen Date: Wed, 30 Oct 2024 09:01:50 +0000 Subject: [PATCH 462/695] fix/TD-32766-check-ref-before-free-first-check --- source/dnode/mgmt/mgmt_vnode/src/vmInt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmInt.c b/source/dnode/mgmt/mgmt_vnode/src/vmInt.c index 0913d7539bc6..682c1792709d 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmInt.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmInt.c @@ -126,7 +126,7 @@ static void vmFreeVnodeObj(SVnodeObj **ppVnode) { SVnodeObj *pVnode = *ppVnode; - int32_t refCount = 1; + int32_t refCount = atomic_load_32(&pVnode->refCount); while (refCount > 0) { dWarn("vgId:%d, vnode is refenced, retry to free in 200ms, vnode:%p, ref:%d", pVnode->vgId, pVnode, refCount); taosMsleep(200); From 296eb9a14665247838a9166a43651507924a1d50 Mon Sep 17 00:00:00 2001 From: Yu Chen <74105241+yu285@users.noreply.github.com> Date: Wed, 30 Oct 2024 17:11:20 +0800 Subject: [PATCH 463/695] =?UTF-8?q?docs=EF=BC=9AUpdate=20get-started=20des?= =?UTF-8?q?cription?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/zh/04-get-started/03-package.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/zh/04-get-started/03-package.md b/docs/zh/04-get-started/03-package.md index 2a1f594b4fa1..cef3cb6943a5 100644 --- a/docs/zh/04-get-started/03-package.md +++ b/docs/zh/04-get-started/03-package.md @@ -14,7 +14,9 @@ TDengine 完整的软件包包括服务端(taosd)、应用驱动(taosc) 为方便使用,标准的服务端安装包包含了 taosd、taosAdapter、taosc、taos、taosdump、taosBenchmark、TDinsight 安装脚本和示例代码;如果您只需要用到服务端程序和客户端连接的 C/C++ 语言支持,也可以仅下载 Lite 版本的安装包。 -在 Linux 系统上,TDengine 社区版提供 Deb 和 RPM 格式安装包,用户可以根据自己的运行环境选择合适的安装包。其中 Deb 支持 Debian/Ubuntu 及其衍生系统,RPM 支持 CentOS/RHEL/SUSE 及其衍生系统。同时我们也为企业用户提供 tar.gz 格式安装包,也支持通过 `apt-get` 工具从线上进行安装。需要注意的是,RPM 和 Deb 包不含 `taosdump` 和 TDinsight 安装脚本,这些工具需要通过安装 taosTools 包获得。TDengine 也提供 Windows x64 平台和 macOS x64/m1 平台的安装包。 +在 Linux 系统上,TDengine 社区版提供 Deb 和 RPM 格式安装包,其中 Deb 支持 Debian/Ubuntu 及其衍生系统,RPM 支持 CentOS/RHEL/SUSE 及其衍生系统,用户可以根据自己的运行环境自行选择。同时我们也提供了 tar.gz 格式安装包,以及 `apt-get` 工具从线上进行安装。 + +此外,TDengine 也提供 macOS x64/m1 平台的 pkg 安装包。 ## 运行环境要求 在linux系统中,运行环境最低要求如下: @@ -317,4 +319,4 @@ SELECT AVG(current), MAX(voltage), MIN(phase) FROM test.meters WHERE groupId = 1 SELECT _wstart, AVG(current), MAX(voltage), MIN(phase) FROM test.d1001 INTERVAL(10s); ``` -在上面的查询中,使用系统提供的伪列_wstart 来给出每个窗口的开始时间。 \ No newline at end of file +在上面的查询中,使用系统提供的伪列_wstart 来给出每个窗口的开始时间。 From 456ed98e1707361406e9136f2c4b7a4cbf8b0415 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Wed, 30 Oct 2024 17:36:55 +0800 Subject: [PATCH 464/695] handle quit error --- source/libs/transport/src/transCli.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index 1e4276c4385d..b3f325c5b8ac 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -604,7 +604,7 @@ int32_t cliHandleState_mayHandleReleaseResp(SCliConn* conn, STransMsgHead* pHead queue* el = QUEUE_HEAD(&set); QUEUE_REMOVE(el); SCliReq* pReq = QUEUE_DATA(el, SCliReq, q); - + removeReqFromSendQ(pReq); STraceId* trace = &pReq->msg.info.traceId; tGDebug("start to free msg %p", pReq); destroyReqWrapper(pReq, pThrd); From 74065f91d805588d51d94a7dba5737fe1be3d722 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Wed, 30 Oct 2024 17:39:33 +0800 Subject: [PATCH 465/695] fix: data source ep issue --- include/libs/qcom/query.h | 2 +- include/util/taoserror.h | 1 + source/libs/scheduler/src/schJob.c | 2 +- source/libs/scheduler/src/schUtil.c | 2 +- source/util/src/terror.c | 1 + 5 files changed, 5 insertions(+), 3 deletions(-) diff --git a/include/libs/qcom/query.h b/include/libs/qcom/query.h index 81a39524631d..d2f714f40081 100644 --- a/include/libs/qcom/query.h +++ b/include/libs/qcom/query.h @@ -364,7 +364,7 @@ void* getTaskPoolWorkerCb(); #define NEED_CLIENT_REFRESH_VG_ERROR(_code) \ ((_code) == TSDB_CODE_VND_HASH_MISMATCH || (_code) == TSDB_CODE_VND_INVALID_VGROUP_ID) #define NEED_CLIENT_REFRESH_TBLMETA_ERROR(_code) \ - ((_code) == TSDB_CODE_TDB_INVALID_TABLE_SCHEMA_VER || (_code) == TSDB_CODE_MND_INVALID_SCHEMA_VER) + ((_code) == TSDB_CODE_TDB_INVALID_TABLE_SCHEMA_VER || (_code) == TSDB_CODE_MND_INVALID_SCHEMA_VER || (_code) == TSDB_CODE_SCH_DATA_SRC_EP_MISS) #define NEED_CLIENT_HANDLE_ERROR(_code) \ (NEED_CLIENT_RM_TBLMETA_ERROR(_code) || NEED_CLIENT_REFRESH_VG_ERROR(_code) || \ NEED_CLIENT_REFRESH_TBLMETA_ERROR(_code)) diff --git a/include/util/taoserror.h b/include/util/taoserror.h index a53923b904be..2a67a3cae16a 100644 --- a/include/util/taoserror.h +++ b/include/util/taoserror.h @@ -771,6 +771,7 @@ int32_t taosGetErrSize(); #define TSDB_CODE_SCH_TIMEOUT_ERROR TAOS_DEF_ERROR_CODE(0, 0x2504) #define TSDB_CODE_SCH_JOB_IS_DROPPING TAOS_DEF_ERROR_CODE(0, 0x2505) #define TSDB_CODE_SCH_JOB_NOT_EXISTS TAOS_DEF_ERROR_CODE(0, 0x2506) +#define TSDB_CODE_SCH_DATA_SRC_EP_MISS TAOS_DEF_ERROR_CODE(0, 0x2507) //parser #define TSDB_CODE_PAR_SYNTAX_ERROR TAOS_DEF_ERROR_CODE(0, 0x2600) diff --git a/source/libs/scheduler/src/schJob.c b/source/libs/scheduler/src/schJob.c index ab9bc6a98fd0..375a3161852b 100644 --- a/source/libs/scheduler/src/schJob.c +++ b/source/libs/scheduler/src/schJob.c @@ -402,7 +402,7 @@ int32_t schValidateAndBuildJob(SQueryPlan *pDag, SSchJob *pJob) { for (int32_t n = 0; n < taskNum; ++n) { SSubplan *plan = (SSubplan *)nodesListGetNode(plans->pNodeList, n); - SCH_ERR_RET(schValidateSubplan(pJob, plan, pLevel->level, n, taskNum)); + SCH_ERR_JRET(schValidateSubplan(pJob, plan, pLevel->level, n, taskNum)); SCH_SET_JOB_TYPE(pJob, plan->subplanType); diff --git a/source/libs/scheduler/src/schUtil.c b/source/libs/scheduler/src/schUtil.c index 59951ab6185a..4697de6f2852 100644 --- a/source/libs/scheduler/src/schUtil.c +++ b/source/libs/scheduler/src/schUtil.c @@ -385,7 +385,7 @@ int32_t schValidateSubplan(SSchJob *pJob, SSubplan* pSubplan, int32_t level, int if (SCH_IS_DATA_BIND_PLAN(pSubplan)) { if (pSubplan->execNode.epSet.numOfEps <= 0) { SCH_JOB_ELOG("no execNode specifed for data src plan %d, numOfEps:%d", pSubplan->subplanType, pSubplan->execNode.epSet.numOfEps); - SCH_ERR_RET(TSDB_CODE_QRY_INVALID_INPUT); + SCH_ERR_RET(TSDB_CODE_SCH_DATA_SRC_EP_MISS); } if (pSubplan->execNode.epSet.inUse >= pSubplan->execNode.epSet.numOfEps) { SCH_JOB_ELOG("invalid epset inUse %d for data src plan %d, numOfEps:%d", pSubplan->execNode.epSet.inUse, pSubplan->subplanType, pSubplan->execNode.epSet.numOfEps); diff --git a/source/util/src/terror.c b/source/util/src/terror.c index 52a3be120d5a..4d8b3627efc5 100644 --- a/source/util/src/terror.c +++ b/source/util/src/terror.c @@ -618,6 +618,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_SCH_INTERNAL_ERROR, "scheduler internal er TAOS_DEFINE_ERROR(TSDB_CODE_SCH_TIMEOUT_ERROR, "Task timeout") TAOS_DEFINE_ERROR(TSDB_CODE_SCH_JOB_IS_DROPPING, "Job is dropping") TAOS_DEFINE_ERROR(TSDB_CODE_SCH_JOB_NOT_EXISTS, "Job no longer exist") +TAOS_DEFINE_ERROR(TSDB_CODE_SCH_DATA_SRC_EP_MISS, "No valid epSet for data source node") // parser TAOS_DEFINE_ERROR(TSDB_CODE_PAR_SYNTAX_ERROR, "syntax error near") From ae369cdeb873d25f0841ffa8e78649210040db5a Mon Sep 17 00:00:00 2001 From: beliefstar Date: Tue, 13 Aug 2024 16:50:41 +0800 Subject: [PATCH 466/695] Update 02-cache.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit wal_level设置为2时,每次写入请求都会执行fsync,不需要控制执行频率,只有当wal_level设置为1时,才需要控制fsync的执行频率。 --- docs/zh/06-advanced/02-cache.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/zh/06-advanced/02-cache.md b/docs/zh/06-advanced/02-cache.md index ca1da30dbfcc..b83509c2dd5f 100644 --- a/docs/zh/06-advanced/02-cache.md +++ b/docs/zh/06-advanced/02-cache.md @@ -54,7 +54,7 @@ TDengine 利用这些日志文件实现故障前的状态恢复。在写入 WAL 数据库参数 wal_level 和 wal_fsync_period 共同决定了 WAL 的保存行为。。 - wal_level:此参数控制 WAL 的保存级别。级别 1 表示仅将数据写入 WAL,但不立即执行 fsync 函数;级别 2 则表示在写入 WAL 的同时执行 fsync 函数。默认情况下,wal_level 设为 1。虽然执行 fsync 函数可以提高数据的持久性,但相应地也会降低写入性能。 -- wal_fsync_period:当 wal_level 设置为 2 时,这个参数控制执行 fsync 的频率。设置为 0 表示每次写入后立即执行 fsync,这可以确保数据的安全性,但可能会牺牲一些性能。当设置为大于 0 的数值时,表示 fsync 周期,默认为 3000,范围是[1, 180000],单位毫秒。 +- wal_fsync_period:当 wal_level 设置为 1 时,这个参数控制执行 fsync 的频率。设置为 0 表示每次写入后立即执行 fsync,这可以确保数据的安全性,但可能会牺牲一些性能。当设置为大于 0 的数值时,表示 fsync 周期,默认为 3000,范围是[1, 180000],单位毫秒。 ```sql CREATE DATABASE POWER WAL_LEVEL 1 WAL_FSYNC_PERIOD 3000; @@ -119,4 +119,4 @@ taos> select last_row(ts,current) from meters; Query OK, 1 row(s) in set (0.046682s) ``` -可以看到查询的时延从 353/344ms 缩短到了 44ms,提升约 8 倍。 \ No newline at end of file +可以看到查询的时延从 353/344ms 缩短到了 44ms,提升约 8 倍。 From 68be4a7c3baab3969dd63bd1d0e414b6a2556880 Mon Sep 17 00:00:00 2001 From: Yu Chen <74105241+yu285@users.noreply.github.com> Date: Wed, 18 Sep 2024 16:13:04 +0800 Subject: [PATCH 467/695] Update 14-stream.md --- docs/zh/14-reference/03-taos-sql/14-stream.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/zh/14-reference/03-taos-sql/14-stream.md b/docs/zh/14-reference/03-taos-sql/14-stream.md index cd5c76a4ad38..6baad76e232f 100644 --- a/docs/zh/14-reference/03-taos-sql/14-stream.md +++ b/docs/zh/14-reference/03-taos-sql/14-stream.md @@ -212,11 +212,11 @@ TDengine 对于修改数据提供两种处理方式,由 IGNORE UPDATE 选项 ```sql [field1_name,...] ``` -用来指定stb_name的列与subquery输出结果的对应关系。如果stb_name的列与subquery输出结果的位置、数量全部匹配,则不需要显示指定对应关系。如果stb_name的列与subquery输出结果的数据类型不匹配,会把subquery输出结果的类型转换成对应的stb_name的列的类型。 +在本页文档顶部的 [field1_name,...] 是用来指定 stb_name 的列与 subquery 输出结果的对应关系的。如果 stb_name 的列与 subquery 输出结果的位置、数量全部匹配,则不需要显示指定对应关系。如果 stb_name 的列与 subquery 输出结果的数据类型不匹配,会把 subquery 输出结果的类型转换成对应的 stb_name 的列的类型。 对于已经存在的超级表,检查列的schema信息 -1. 检查列的schema信息是否匹配,对于不匹配的,则自动进行类型转换,当前只有数据长度大于4096byte时才报错,其余场景都能进行类型转换。 -2. 检查列的个数是否相同,如果不同,需要显示的指定超级表与subquery的列的对应关系,否则报错;如果相同,可以指定对应关系,也可以不指定,不指定则按位置顺序对应。 +1. 检查列的 schema 信息是否匹配,对于不匹配的,则自动进行类型转换,当前只有数据长度大于 4096byte 时才报错,其余场景都能进行类型转换。 +2. 检查列的个数是否相同,如果不同,需要显示的指定超级表与 subquery 的列的对应关系,否则报错;如果相同,可以指定对应关系,也可以不指定,不指定则按位置顺序对应。 ## 自定义TAG From 97c9dba167a629efea6ba0abc47109c0c1a80312 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Wed, 30 Oct 2024 17:51:59 +0800 Subject: [PATCH 468/695] add test case --- source/libs/transport/test/CMakeLists.txt | 19 + source/libs/transport/test/cliBench.c | 56 +-- source/libs/transport/test/svrBench.c | 38 +- source/libs/transport/test/transUT.cpp | 30 +- source/libs/transport/test/transUT2.cpp | 529 ++++++++++++++++++++++ 5 files changed, 603 insertions(+), 69 deletions(-) create mode 100644 source/libs/transport/test/transUT2.cpp diff --git a/source/libs/transport/test/CMakeLists.txt b/source/libs/transport/test/CMakeLists.txt index e68e93c48e36..3a5213a726af 100644 --- a/source/libs/transport/test/CMakeLists.txt +++ b/source/libs/transport/test/CMakeLists.txt @@ -1,5 +1,6 @@ add_executable(transportTest "") add_executable(transUT "") +add_executable(transUT2 "") add_executable(svrBench "") add_executable(cliBench "") add_executable(httpBench "") @@ -9,6 +10,10 @@ target_sources(transUT "transUT.cpp" ) +target_sources(transUT2 + PRIVATE + "transUT2.cpp" +) target_sources(transportTest PRIVATE "transportTests.cpp" @@ -56,6 +61,20 @@ target_include_directories(transUT "${CMAKE_CURRENT_SOURCE_DIR}/../inc" ) +target_link_libraries (transUT2 + os + util + common + gtest_main + transport +) + +target_include_directories(transUT2 + PUBLIC + "${TD_SOURCE_DIR}/include/libs/transport" + "${CMAKE_CURRENT_SOURCE_DIR}/../inc" +) + target_include_directories(svrBench PUBLIC "${TD_SOURCE_DIR}/include/libs/transport" diff --git a/source/libs/transport/test/cliBench.c b/source/libs/transport/test/cliBench.c index e73c209d5585..6330b2d2c6a9 100644 --- a/source/libs/transport/test/cliBench.c +++ b/source/libs/transport/test/cliBench.c @@ -53,8 +53,6 @@ static void processResponse(void *parent, SRpcMsg *pMsg, SEpSet *pEpSet) { tDebug("thread:%d, response is received, type:%d contLen:%d code:0x%x", pInfo->index, pMsg->msgType, pMsg->contLen, pMsg->code); - if (pEpSet) pInfo->epSet = *pEpSet; - rpcFreeCont(pMsg->pCont); tsem_post(&pInfo->rspSem); } @@ -72,12 +70,12 @@ static void *sendRequest(void *param) { rpcMsg.pCont = rpcMallocCont(pInfo->msgSize); rpcMsg.contLen = pInfo->msgSize; rpcMsg.info.ahandle = pInfo; - rpcMsg.info.noResp = 1; + rpcMsg.info.noResp = 0; rpcMsg.msgType = 1; tDebug("thread:%d, send request, contLen:%d num:%d", pInfo->index, pInfo->msgSize, pInfo->num); rpcSendRequest(pInfo->pRpc, &pInfo->epSet, &rpcMsg, NULL); if (pInfo->num % 20000 == 0) tInfo("thread:%d, %d requests have been sent", pInfo->index, pInfo->num); - // tsem_wait(&pInfo->rspSem); + tsem_wait(&pInfo->rspSem); } tDebug("thread:%d, it is over", pInfo->index); @@ -110,17 +108,15 @@ int main(int argc, char *argv[]) { rpcInit.label = "APP"; rpcInit.numOfThreads = 1; rpcInit.cfp = processResponse; - rpcInit.sessions = 100; + rpcInit.sessions = 1000; rpcInit.idleTime = tsShellActivityTimer * 1000; rpcInit.user = "michael"; rpcInit.connType = TAOS_CONN_CLIENT; - rpcInit.connLimitNum = 10; - rpcInit.connLimitLock = 1; - rpcInit.shareConnLimit = 16 * 1024; + rpcInit.shareConnLimit = tsShareConnLimit; rpcInit.supportBatch = 1; - - rpcDebugFlag = 135; + rpcInit.compressSize = -1; + rpcDebugFlag = 143; for (int i = 1; i < argc; ++i) { if (strcmp(argv[i], "-p") == 0 && i < argc - 1) { } else if (strcmp(argv[i], "-i") == 0 && i < argc - 1) { @@ -139,6 +135,10 @@ int main(int argc, char *argv[]) { } else if (strcmp(argv[i], "-u") == 0 && i < argc - 1) { } else if (strcmp(argv[i], "-k") == 0 && i < argc - 1) { } else if (strcmp(argv[i], "-spi") == 0 && i < argc - 1) { + } else if (strcmp(argv[i], "-l") == 0 && i < argc - 1) { + rpcInit.shareConnLimit = atoi(argv[++i]); + } else if (strcmp(argv[i], "-c") == 0 && i < argc - 1) { + rpcInit.compressSize = atoi(argv[++i]); } else if (strcmp(argv[i], "-d") == 0 && i < argc - 1) { rpcDebugFlag = atoi(argv[++i]); } else { @@ -150,6 +150,8 @@ int main(int argc, char *argv[]) { printf(" [-n requests]: number of requests per thread, default is:%d\n", numOfReqs); printf(" [-u user]: user name for the connection, default is:%s\n", rpcInit.user); printf(" [-d debugFlag]: debug flag, default:%d\n", rpcDebugFlag); + printf(" [-c compressSize]: compress size, default:%d\n", tsCompressMsgSize); + printf(" [-l shareConnLimit]: share conn limit, default:%d\n", tsShareConnLimit); printf(" [-h help]: print out this help\n\n"); exit(0); } @@ -168,18 +170,18 @@ int main(int argc, char *argv[]) { int64_t now = taosGetTimestampUs(); - SInfo *pInfo = (SInfo *)taosMemoryCalloc(1, sizeof(SInfo) * appThreads); - SInfo *p = pInfo; + SInfo **pInfo = (SInfo **)taosMemoryCalloc(1, sizeof(SInfo *) * appThreads); for (int i = 0; i < appThreads; ++i) { - pInfo->index = i; - pInfo->epSet = epSet; - pInfo->numOfReqs = numOfReqs; - pInfo->msgSize = msgSize; - tsem_init(&pInfo->rspSem, 0, 0); - pInfo->pRpc = pRpc; - - taosThreadCreate(&pInfo->thread, NULL, sendRequest, pInfo); - pInfo++; + SInfo *p = taosMemoryCalloc(1, sizeof(SInfo)); + p->index = i; + p->epSet = epSet; + p->numOfReqs = numOfReqs; + p->msgSize = msgSize; + tsem_init(&p->rspSem, 0, 0); + p->pRpc = pRpc; + pInfo[i] = p; + + taosThreadCreate(&p->thread, NULL, sendRequest, pInfo[i]); } do { @@ -192,12 +194,14 @@ int main(int argc, char *argv[]) { tInfo("Performance: %.3f requests per second, msgSize:%d bytes", 1000.0 * numOfReqs * appThreads / usedTime, msgSize); for (int i = 0; i < appThreads; i++) { - SInfo *pInfo = p; - taosThreadJoin(pInfo->thread, NULL); - p++; + SInfo *p = pInfo[i]; + taosThreadJoin(p->thread, NULL); + taosMemoryFree(p); } - int ch = getchar(); - UNUSED(ch); + taosMemoryFree(pInfo); + + // int ch = getchar(); + // UNUSED(ch); taosCloseLog(); diff --git a/source/libs/transport/test/svrBench.c b/source/libs/transport/test/svrBench.c index 6408e4dcb2d8..dacde982ed55 100644 --- a/source/libs/transport/test/svrBench.c +++ b/source/libs/transport/test/svrBench.c @@ -76,23 +76,6 @@ void *processShellMsg(void *arg) { for (int i = 0; i < numOfMsgs; ++i) { taosGetQitem(qall, (void **)&pRpcMsg); - - if (pDataFile != NULL) { - if (taosWriteFile(pDataFile, pRpcMsg->pCont, pRpcMsg->contLen) < 0) { - tInfo("failed to write data file, reason:%s", strerror(errno)); - } - } - } - - if (commit >= 2) { - num += numOfMsgs; - // if (taosFsync(pDataFile) < 0) { - // tInfo("failed to flush data to file, reason:%s", strerror(errno)); - //} - - if (num % 10000 == 0) { - tInfo("%d request have been written into disk", num); - } } taosResetQitems(qall); @@ -107,16 +90,7 @@ void *processShellMsg(void *arg) { rpcMsg.code = 0; rpcSendResponse(&rpcMsg); - void *handle = pRpcMsg->info.handle; taosFreeQitem(pRpcMsg); - //{ - // SRpcMsg nRpcMsg = {0}; - // nRpcMsg.pCont = rpcMallocCont(msgSize); - // nRpcMsg.contLen = msgSize; - // nRpcMsg.info.handle = handle; - // nRpcMsg.code = TSDB_CODE_CTG_NOT_READY; - // rpcSendResponse(&nRpcMsg); - //} } taosUpdateItemSize(qinfo.queue, numOfMsgs); @@ -149,12 +123,13 @@ int main(int argc, char *argv[]) { rpcInit.localPort = 7000; memcpy(rpcInit.localFqdn, "localhost", strlen("localhost")); rpcInit.label = "SER"; - rpcInit.numOfThreads = 1; + rpcInit.numOfThreads = 10; rpcInit.cfp = processRequestMsg; rpcInit.idleTime = 2 * 1500; taosVersionStrToInt(version, &(rpcInit.compatibilityVer)); rpcDebugFlag = 131; + rpcInit.compressSize = -1; for (int i = 1; i < argc; ++i) { if (strcmp(argv[i], "-p") == 0 && i < argc - 1) { @@ -205,8 +180,8 @@ int main(int argc, char *argv[]) { if (pDataFile == NULL) tInfo("failed to open data file, reason:%s", strerror(errno)); } - int32_t numOfAthread = 5; - multiQ = taosMemoryMalloc(sizeof(numOfAthread)); + int32_t numOfAthread = 1; + multiQ = taosMemoryMalloc(sizeof(MultiThreadQhandle)); multiQ->numOfThread = numOfAthread; multiQ->qhandle = (STaosQueue **)taosMemoryMalloc(sizeof(STaosQueue *) * numOfAthread); multiQ->qset = (STaosQset **)taosMemoryMalloc(sizeof(STaosQset *) * numOfAthread); @@ -221,11 +196,6 @@ int main(int argc, char *argv[]) { threads[i].idx = i; taosThreadCreate(&(threads[i].thread), NULL, processShellMsg, (void *)&threads[i]); } - // qhandle = taosOpenQueue(); - // qset = taosOpenQset(); - // taosAddIntoQset(qset, qhandle, NULL); - - // processShellMsg(); if (pDataFile != NULL) { taosCloseFile(&pDataFile); diff --git a/source/libs/transport/test/transUT.cpp b/source/libs/transport/test/transUT.cpp index e57d01bcbc79..cac8abf85778 100644 --- a/source/libs/transport/test/transUT.cpp +++ b/source/libs/transport/test/transUT.cpp @@ -54,6 +54,7 @@ class Client { rpcInit_.user = (char *)user; rpcInit_.parent = this; rpcInit_.connType = TAOS_CONN_CLIENT; + rpcInit_.shareConnLimit = 200; taosVersionStrToInt(version, &(rpcInit_.compatibilityVer)); this->transCli = rpcOpen(&rpcInit_); @@ -85,6 +86,14 @@ class Client { SemWait(); *resp = this->resp; } + void sendReq(SRpcMsg *req) { + SEpSet epSet = {0}; + epSet.inUse = 0; + addEpIntoEpSet(&epSet, "127.0.0.1", 7000); + + rpcSendRequest(this->transCli, &epSet, req, NULL); + + } void SendAndRecvNoHandle(SRpcMsg *req, SRpcMsg *resp) { if (req->info.handle != NULL) { rpcReleaseHandle(req->info.handle, TAOS_CONN_CLIENT); @@ -160,6 +169,7 @@ static void processReq(void *parent, SRpcMsg *pMsg, SEpSet *pEpSet) { rpcMsg.contLen = 100; rpcMsg.info = pMsg->info; rpcMsg.code = 0; + rpcFreeCont(pMsg->pCont); rpcSendResponse(&rpcMsg); } @@ -264,6 +274,7 @@ class TransObj { cli->Stop(); } void cliSendAndRecv(SRpcMsg *req, SRpcMsg *resp) { cli->SendAndRecv(req, resp); } + void cliSendReq(SRpcMsg *req) { cli->sendReq(req); } void cliSendAndRecvNoHandle(SRpcMsg *req, SRpcMsg *resp) { cli->SendAndRecvNoHandle(req, resp); } ~TransObj() { @@ -492,15 +503,16 @@ TEST_F(TransEnv, queryExcept) { TEST_F(TransEnv, noResp) { SRpcMsg resp = {0}; SRpcMsg req = {0}; - // for (int i = 0; i < 5; i++) { - // memset(&req, 0, sizeof(req)); - // req.info.noResp = 1; - // req.msgType = 1; - // req.pCont = rpcMallocCont(10); - // req.contLen = 10; - // tr->cliSendAndRecv(&req, &resp); - //} - // taosMsleep(2000); + for (int i = 0; i < 500000; i++) { + memset(&req, 0, sizeof(req)); + req.info.noResp = 1; + req.msgType = 3; + req.pCont = rpcMallocCont(10); + req.contLen = 10; + tr->cliSendReq(&req); + //tr->cliSendAndRecv(&req, &resp); + } + taosMsleep(2000); // no resp } diff --git a/source/libs/transport/test/transUT2.cpp b/source/libs/transport/test/transUT2.cpp new file mode 100644 index 000000000000..22faf0a3ed9d --- /dev/null +++ b/source/libs/transport/test/transUT2.cpp @@ -0,0 +1,529 @@ +/* + * 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 "tdatablock.h" +#include "tglobal.h" +#include "tlog.h" +#include "tmisce.h" +#include "transLog.h" +#include "trpc.h" +#include "tversion.h" +using namespace std; + +const char *label = "APP"; +const char *secret = "secret"; +const char *user = "user"; +const char *ckey = "ckey"; + +class Server; +int port = 7000; +// server process +// server except + +typedef void (*CB)(void *parent, SRpcMsg *pMsg, SEpSet *pEpSet); + +static void processContinueSend(void *parent, SRpcMsg *pMsg, SEpSet *pEpSet); +static void processReleaseHandleCb(void *parent, SRpcMsg *pMsg, SEpSet *pEpSet); +static void processRegisterFailure(void *parent, SRpcMsg *pMsg, SEpSet *pEpSet); +static void processReq(void *parent, SRpcMsg *pMsg, SEpSet *pEpSet); +// client process; +static void processResp(void *parent, SRpcMsg *pMsg, SEpSet *pEpSet); +class Client { + public: + void Init(int nThread) { + memcpy(tsTempDir, TD_TMP_DIR_PATH, strlen(TD_TMP_DIR_PATH)); + memset(&rpcInit_, 0, sizeof(rpcInit_)); + rpcInit_.localPort = 0; + rpcInit_.label = (char *)"client"; + rpcInit_.numOfThreads = nThread; + rpcInit_.cfp = processResp; + rpcInit_.user = (char *)user; + rpcInit_.parent = this; + rpcInit_.connType = TAOS_CONN_CLIENT; + rpcInit_.shareConnLimit = 200; + + taosVersionStrToInt(version, &(rpcInit_.compatibilityVer)); + this->transCli = rpcOpen(&rpcInit_); + //tsem_init(&this->sem, 0, 0); + } + void SetResp(SRpcMsg *pMsg) { + // set up resp; + this->resp = *pMsg; + } + SRpcMsg *Resp() { return &this->resp; } + + void Restart(CB cb) { + rpcClose(this->transCli); + rpcInit_.cfp = cb; + taosVersionStrToInt(version, &(rpcInit_.compatibilityVer)); + this->transCli = rpcOpen(&rpcInit_); + } + void Stop() { + rpcClose(this->transCli); + this->transCli = NULL; + } + + void SendAndRecv(SRpcMsg *req, SRpcMsg *resp) { + SEpSet epSet = {0}; + epSet.inUse = 0; + addEpIntoEpSet(&epSet, "127.0.0.1", 7000); + + rpcSendRequest(this->transCli, &epSet, req, NULL); + SemWait(); + *resp = this->resp; + } + void sendReq(SRpcMsg *req) { + SEpSet epSet = {0}; + epSet.inUse = 0; + addEpIntoEpSet(&epSet, "127.0.0.1", 7000); + + rpcSendRequest(this->transCli, &epSet, req, NULL); + } + + void sendReqWithId(SRpcMsg *req, int64_t *id) { + SEpSet epSet = {0}; + epSet.inUse = 0; + addEpIntoEpSet(&epSet, "127.0.0.1",7000); + rpcSendRequestWithCtx(this->transCli, &epSet, req, id, NULL); + + } + void freeId(int64_t *id) { + rpcFreeConnById(this->transCli, *id); + } + void SendAndRecvNoHandle(SRpcMsg *req, SRpcMsg *resp) { + if (req->info.handle != NULL) { + rpcReleaseHandle(req->info.handle, TAOS_CONN_CLIENT); + req->info.handle = NULL; + } + SendAndRecv(req, resp); + } + + void SemWait() { tsem_wait(&this->sem); } + void SemPost() { tsem_post(&this->sem); } + void Reset() {} + + ~Client() { + if (this->transCli) rpcClose(this->transCli); + } + + private: + tsem_t sem; + SRpcInit rpcInit_; + void *transCli; + SRpcMsg resp; +}; +class Server { + public: + Server() { + memcpy(tsTempDir, TD_TMP_DIR_PATH, strlen(TD_TMP_DIR_PATH)); + memset(&rpcInit_, 0, sizeof(rpcInit_)); + + memcpy(rpcInit_.localFqdn, "localhost", strlen("localhost")); + rpcInit_.localPort = port; + rpcInit_.label = (char *)"server"; + rpcInit_.numOfThreads = 5; + rpcInit_.cfp = processReq; + rpcInit_.user = (char *)user; + rpcInit_.connType = TAOS_CONN_SERVER; + taosVersionStrToInt(version, &(rpcInit_.compatibilityVer)); + } + void Start() { + this->transSrv = rpcOpen(&this->rpcInit_); + taosMsleep(1000); + } + void SetSrvContinueSend(CB cb) { + this->Stop(); + rpcInit_.cfp = cb; + this->Start(); + } + void Stop() { + if (this->transSrv == NULL) return; + rpcClose(this->transSrv); + this->transSrv = NULL; + } + void SetSrvSend(void (*cfp)(void *parent, SRpcMsg *pMsg, SEpSet *pEpSet)) { + this->Stop(); + rpcInit_.cfp = cfp; + this->Start(); + } + void Restart() { + this->Stop(); + this->Start(); + } + ~Server() { + if (this->transSrv) rpcClose(this->transSrv); + this->transSrv = NULL; + } + + private: + SRpcInit rpcInit_; + void *transSrv; +}; +static void processReq(void *parent, SRpcMsg *pMsg, SEpSet *pEpSet) { + SRpcMsg rpcMsg = {0}; + rpcMsg.pCont = rpcMallocCont(100); + rpcMsg.contLen = 100; + rpcMsg.info = pMsg->info; + rpcMsg.code = 0; + rpcFreeCont(pMsg->pCont); + rpcSendResponse(&rpcMsg); +} + +static void processContinueSend(void *parent, SRpcMsg *pMsg, SEpSet *pEpSet) { + // for (int i = 0; i < 10; i++) { + // SRpcMsg rpcMsg = {0}; + // rpcMsg.pCont = rpcMallocCont(100); + // rpcMsg.contLen = 100; + // rpcMsg.info = pMsg->info; + // rpcMsg.code = 0; + // rpcSendResponse(&rpcMsg); + // } +} +static void processReleaseHandleCb(void *parent, SRpcMsg *pMsg, SEpSet *pEpSet) { + SRpcMsg rpcMsg = {0}; + rpcMsg.pCont = rpcMallocCont(100); + rpcMsg.contLen = 100; + rpcMsg.info = pMsg->info; + rpcMsg.code = 0; + rpcSendResponse(&rpcMsg); + + rpcReleaseHandle(&pMsg->info, TAOS_CONN_SERVER); +} +static void processRegisterFailure(void *parent, SRpcMsg *pMsg, SEpSet *pEpSet) { + // { + // SRpcMsg rpcMsg1 = {0}; + // rpcMsg1.pCont = rpcMallocCont(100); + // rpcMsg1.contLen = 100; + // rpcMsg1.info = pMsg->info; + // rpcMsg1.code = 0; + // rpcRegisterBrokenLinkArg(&rpcMsg1); + // } + // taosMsleep(10); + + // SRpcMsg rpcMsg = {0}; + // rpcMsg.pCont = rpcMallocCont(100); + // rpcMsg.contLen = 100; + // rpcMsg.info = pMsg->info; + // rpcMsg.code = 0; + // rpcSendResponse(&rpcMsg); +} +// client process; +static void processResp(void *parent, SRpcMsg *pMsg, SEpSet *pEpSet) { + Client *client = (Client *)parent; + rpcFreeCont(pMsg->pCont); + STraceId *trace = (STraceId *)&pMsg->info.traceId; + tGDebug("received resp %s",tstrerror(pMsg->code)); +} + +static void initEnv() { + dDebugFlag = 143; + vDebugFlag = 0; + mDebugFlag = 143; + cDebugFlag = 0; + jniDebugFlag = 0; + tmrDebugFlag = 143; + uDebugFlag = 143; + rpcDebugFlag = 143; + qDebugFlag = 0; + wDebugFlag = 0; + sDebugFlag = 0; + tsdbDebugFlag = 0; + tsLogEmbedded = 1; + tsAsyncLog = 0; + + std::string path = TD_TMP_DIR_PATH "transport"; + // taosRemoveDir(path.c_str()); + taosMkDir(path.c_str()); + + tstrncpy(tsLogDir, path.c_str(), PATH_MAX); + if (taosInitLog("taosdlog", 1, false) != 0) { + printf("failed to init log file\n"); + } +} + +class TransObj { + public: + TransObj() { + initEnv(); + cli = new Client; + cli->Init(1); + srv = new Server; + srv->Start(); + } + + void RestartCli(CB cb) { + // + cli->Restart(cb); + } + void StopSrv() { + // + srv->Stop(); + } + // call when link broken, and notify query or fetch stop + void SetSrvContinueSend(void (*cfp)(void *parent, SRpcMsg *pMsg, SEpSet *pEpSet)) { + /////// + srv->SetSrvContinueSend(cfp); + } + void RestartSrv() { srv->Restart(); } + void StopCli() { + /////// + cli->Stop(); + } + void cliSendAndRecv(SRpcMsg *req, SRpcMsg *resp) { cli->SendAndRecv(req, resp); } + void cliSendReq(SRpcMsg *req) { cli->sendReq(req); } + + void cliSendReqWithId(SRpcMsg *req, int64_t *id) { cli->sendReqWithId(req, id);} + void cliFreeReqId(int64_t *id) { cli->freeId(id);} + void cliSendAndRecvNoHandle(SRpcMsg *req, SRpcMsg *resp) { cli->SendAndRecvNoHandle(req, resp); } + + ~TransObj() { + delete cli; + delete srv; + } + + private: + Client *cli; + Server *srv; +}; +class TransEnv : public ::testing::Test { + protected: + virtual void SetUp() { + // set up trans obj + tr = new TransObj(); + } + virtual void TearDown() { + // tear down + delete tr; + } + + TransObj *tr = NULL; +}; + +TEST_F(TransEnv, 01sendAndRec) { + // for (int i = 0; i < 10; i++) { + // SRpcMsg req = {0}, resp = {0}; + // req.msgType = 0; + // req.pCont = rpcMallocCont(10); + // req.contLen = 10; + // tr->cliSendAndRecv(&req, &resp); + // assert(resp.code == 0); + // } +} + +TEST_F(TransEnv, 02StopServer) { + // for (int i = 0; i < 1; i++) { + // SRpcMsg req = {0}, resp = {0}; + // req.msgType = 0; + // req.info.ahandle = (void *)0x35; + // req.pCont = rpcMallocCont(10); + // req.contLen = 10; + // tr->cliSendAndRecv(&req, &resp); + // assert(resp.code == 0); + // } + // SRpcMsg req = {0}, resp = {0}; + // req.info.ahandle = (void *)0x35; + // req.msgType = 1; + // req.pCont = rpcMallocCont(10); + // req.contLen = 10; + // tr->StopSrv(); + // // tr->RestartSrv(); + // tr->cliSendAndRecv(&req, &resp); + // assert(resp.code != 0); +} +TEST_F(TransEnv, clientUserDefined) { + // tr->RestartSrv(); + // for (int i = 0; i < 10; i++) { + // SRpcMsg req = {0}, resp = {0}; + // req.msgType = 0; + // req.pCont = rpcMallocCont(10); + // req.contLen = 10; + // tr->cliSendAndRecv(&req, &resp); + // assert(resp.code == 0); + // } + + ////////////////// +} + +TEST_F(TransEnv, cliPersistHandle) { + // SRpcMsg resp = {0}; + // void *handle = NULL; + // for (int i = 0; i < 10; i++) { + // SRpcMsg req = {0}; + // req.info = resp.info; + // req.info.persistHandle = 1; + + // req.msgType = 1; + // req.pCont = rpcMallocCont(10); + // req.contLen = 10; + // tr->cliSendAndRecv(&req, &resp); + // // if (i == 5) { + // // std::cout << "stop server" << std::endl; + // // tr->StopSrv(); + // //} + // // if (i >= 6) { + // // EXPECT_TRUE(resp.code != 0); + // //} + // handle = resp.info.handle; + // } + // rpcReleaseHandle(handle, TAOS_CONN_CLIENT); + // for (int i = 0; i < 10; i++) { + // SRpcMsg req = {0}; + // req.msgType = 1; + // req.pCont = rpcMallocCont(10); + // req.contLen = 10; + // tr->cliSendAndRecv(&req, &resp); + // } + + // taosMsleep(1000); + ////////////////// +} + +TEST_F(TransEnv, srvReleaseHandle) { + // SRpcMsg resp = {0}; + // tr->SetSrvContinueSend(processReleaseHandleCb); + // // tr->Restart(processReleaseHandleCb); + // void *handle = NULL; + // SRpcMsg req = {0}; + // for (int i = 0; i < 1; i++) { + // memset(&req, 0, sizeof(req)); + // req.info = resp.info; + // req.info.persistHandle = 1; + // req.msgType = 1; + // req.pCont = rpcMallocCont(10); + // req.contLen = 10; + // tr->cliSendAndRecv(&req, &resp); + // // tr->cliSendAndRecvNoHandle(&req, &resp); + // EXPECT_TRUE(resp.code == 0); + // } + ////////////////// +} +// reopen later +// TEST_F(TransEnv, cliReleaseHandleExcept) { +// SRpcMsg resp = {0}; +// SRpcMsg req = {0}; +// for (int i = 0; i < 3; i++) { +// memset(&req, 0, sizeof(req)); +// req.info = resp.info; +// req.info.persistHandle = 1; +// req.info.ahandle = (void *)1234; +// req.msgType = 1; +// req.pCont = rpcMallocCont(10); +// req.contLen = 10; +// tr->cliSendAndRecv(&req, &resp); +// if (i == 1) { +// std::cout << "stop server" << std::endl; +// tr->StopSrv(); +// } +// if (i > 1) { +// EXPECT_TRUE(resp.code != 0); +// } +// } +// ////////////////// +//} +TEST_F(TransEnv, srvContinueSend) { + // tr->SetSrvContinueSend(processContinueSend); + // SRpcMsg req = {0}, resp = {0}; + // for (int i = 0; i < 10; i++) { + // // memset(&req, 0, sizeof(req)); + // // memset(&resp, 0, sizeof(resp)); + // // req.msgType = 1; + // // req.pCont = rpcMallocCont(10); + // // req.contLen = 10; + // // tr->cliSendAndRecv(&req, &resp); + // } + // taosMsleep(1000); +} + +TEST_F(TransEnv, srvPersistHandleExcept) { + // tr->SetSrvContinueSend(processContinueSend); + // // tr->SetCliPersistFp(cliPersistHandle); + // SRpcMsg resp = {0}; + // SRpcMsg req = {0}; + // for (int i = 0; i < 5; i++) { + // // memset(&req, 0, sizeof(req)); + // // req.info = resp.info; + // // req.msgType = 1; + // // req.pCont = rpcMallocCont(10); + // // req.contLen = 10; + // // tr->cliSendAndRecv(&req, &resp); + // // if (i > 2) { + // // tr->StopCli(); + // // break; + // //} + // } + // taosMsleep(2000); + // conn broken + // +} +TEST_F(TransEnv, cliPersistHandleExcept) { + // tr->SetSrvContinueSend(processContinueSend); + // SRpcMsg resp = {0}; + // SRpcMsg req = {0}; + // for (int i = 0; i < 5; i++) { + // // memset(&req, 0, sizeof(req)); + // // req.info = resp.info; + // // req.msgType = 1; + // // req.pCont = rpcMallocCont(10); + // // req.contLen = 10; + // // tr->cliSendAndRecv(&req, &resp); + // // if (i > 2) { + // // tr->StopSrv(); + // // break; + // //} + // } + // taosMsleep(2000); + // // conn broken + // +} + +TEST_F(TransEnv, multiCliPersistHandleExcept) { + // conn broken +} +TEST_F(TransEnv, queryExcept) { + //taosMsleep(4 * 1000); +} +TEST_F(TransEnv, idTest) { + SRpcMsg resp = {0}; + SRpcMsg req = {0}; + for (int i = 0; i < 50000; i++) { + memset(&req, 0, sizeof(req)); + req.info.noResp = 0; + req.msgType = 3; + req.pCont = rpcMallocCont(10); + req.contLen = 10; + int64_t id; + tr->cliSendReqWithId(&req, &id); + tr->cliFreeReqId(&id); + } + taosMsleep(1000); + // no resp +} +TEST_F(TransEnv, noResp) { + SRpcMsg resp = {0}; + SRpcMsg req = {0}; + for (int i = 0; i < 500000; i++) { + memset(&req, 0, sizeof(req)); + req.info.noResp = 0; + req.msgType = 3; + req.pCont = rpcMallocCont(10); + req.contLen = 10; + tr->cliSendReq(&req); + //tr->cliSendAndRecv(&req, &resp); + } + taosMsleep(100000); + // no resp +} From 411bcd04e1b8b43bb23a9d0340d3407ddf8c9dde Mon Sep 17 00:00:00 2001 From: Yu Chen <74105241+yu285@users.noreply.github.com> Date: Fri, 21 Jun 2024 16:22:30 +0800 Subject: [PATCH 469/695] docs:Update README-CN.md --- README-CN.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README-CN.md b/README-CN.md index 06ac087859ca..1f785eb4584d 100644 --- a/README-CN.md +++ b/README-CN.md @@ -348,7 +348,7 @@ TDengine 提供了丰富的应用程序开发接口,其中包括 C/C++、Java # 成为社区贡献者 -点击 [这里](https://www.taosdata.com/cn/contributor/),了解如何成为 TDengine 的贡献者。 +点击 [这里](https://www.taosdata.com/contributor),了解如何成为 TDengine 的贡献者。 # 加入技术交流群 From a881ff3edfc8e7382513d480684a996bbeb5e909 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Wed, 30 Oct 2024 18:06:30 +0800 Subject: [PATCH 470/695] add test case --- source/libs/transport/src/transCli.c | 5 +++++ source/libs/transport/test/transUT2.cpp | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index b3f325c5b8ac..43f64924e1ab 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -457,6 +457,7 @@ static bool filteBySeq(void* key, void* arg) { SFiterArg* targ = arg; SCliReq* pReq = QUEUE_DATA(key, SCliReq, q); if (pReq->seq == targ->seq && pReq->msg.msgType + 1 == targ->msgType) { + removeReqFromSendQ(pReq); return true; } else { return false; @@ -543,6 +544,7 @@ bool filterByQid(void* key, void* arg) { SCliReq* pReq = QUEUE_DATA(key, SCliReq, q); if (pReq->msg.info.qId == *qid) { + removeReqFromSendQ(pReq); return true; } else { return false; @@ -1226,6 +1228,7 @@ static FORCE_INLINE void destroyReqInQueue(SCliConn* conn, queue* set, int32_t c QUEUE_REMOVE(el); SCliReq* pReq = QUEUE_DATA(el, SCliReq, q); + removeReqFromSendQ(pReq); notifyAndDestroyReq(conn, pReq, code); } } @@ -1284,6 +1287,7 @@ bool filterToRmReq(void* h, void* arg) { queue* el = h; SCliReq* pReq = QUEUE_DATA(el, SCliReq, q); if (pReq->sent == 1 && pReq->inSendQ == 0 && REQUEST_NO_RESP(&pReq->msg)) { + removeReqFromSendQ(pReq); return true; } return false; @@ -3700,6 +3704,7 @@ bool filterTimeoutReq(void* key, void* arg) { if (pReq->msg.info.qId == 0 && !REQUEST_NO_RESP(&pReq->msg) && pReq->ctx) { int64_t elapse = ((st - pReq->st) / 1000000); if (listArg && elapse >= listArg->pInst->readTimeout) { + removeReqFromSendQ(pReq); return true; } else { return false; diff --git a/source/libs/transport/test/transUT2.cpp b/source/libs/transport/test/transUT2.cpp index 22faf0a3ed9d..f69151813e1d 100644 --- a/source/libs/transport/test/transUT2.cpp +++ b/source/libs/transport/test/transUT2.cpp @@ -524,6 +524,6 @@ TEST_F(TransEnv, noResp) { tr->cliSendReq(&req); //tr->cliSendAndRecv(&req, &resp); } - taosMsleep(100000); + taosMsleep(10000); // no resp } From 2106a59872b1795c7c2cb7411cfe280912e18812 Mon Sep 17 00:00:00 2001 From: Jing Sima Date: Tue, 29 Oct 2024 13:27:09 +0800 Subject: [PATCH 471/695] fix:[TD-32727] fix bug when select interp with two more group key. --- source/libs/executor/src/timesliceoperator.c | 62 ++++++++++++++------ 1 file changed, 44 insertions(+), 18 deletions(-) diff --git a/source/libs/executor/src/timesliceoperator.c b/source/libs/executor/src/timesliceoperator.c index 6803f40da417..71851fe931ae 100644 --- a/source/libs/executor/src/timesliceoperator.c +++ b/source/libs/executor/src/timesliceoperator.c @@ -42,7 +42,7 @@ typedef struct STimeSliceOperatorInfo { SRowKey prevKey; bool prevTsSet; uint64_t groupId; - SGroupKeys* pPrevGroupKey; + SArray* pPrevGroupKeys; SSDataBlock* pNextGroupRes; SSDataBlock* pRemainRes; // save block unfinished processing int32_t remainIndex; // the remaining index in the block to be processed @@ -288,6 +288,7 @@ static bool genInterpolationResult(STimeSliceOperatorInfo* pSliceInfo, SExprSupp // output the result int32_t fillColIndex = 0; + int32_t groupKeyIndex = 0; bool hasInterp = true; for (int32_t j = 0; j < pExprSup->numOfExprs; ++j) { SExprInfo* pExprInfo = &pExprSup->pExprInfo[j]; @@ -320,7 +321,9 @@ static bool genInterpolationResult(STimeSliceOperatorInfo* pSliceInfo, SExprSupp QUERY_CHECK_CODE(code, lino, _end); } else if (!isSelectGroupConstValueFunc(pExprInfo)) { // use stored group key - SGroupKeys* pkey = pSliceInfo->pPrevGroupKey; + SGroupKeys *pkey = taosArrayGet(pSliceInfo->pPrevGroupKeys, groupKeyIndex); + QUERY_CHECK_NULL(pkey, code, lino, _end, terrno); + groupKeyIndex++; if (pkey->isNull == false) { code = colDataSetVal(pDst, rows, pkey->pData, false); QUERY_CHECK_CODE(code, lino, _end); @@ -645,13 +648,20 @@ static int32_t initFillLinearInfo(STimeSliceOperatorInfo* pInfo, SSDataBlock* pB return code; } +static void destroyGroupKey(void* pKey) { + SGroupKeys* key = (SGroupKeys*)pKey; + if (key->pData != NULL) { + taosMemoryFreeClear(key->pData); + } +} + static int32_t initGroupKeyKeeper(STimeSliceOperatorInfo* pInfo, SExprSupp* pExprSup) { - if (pInfo->pPrevGroupKey != NULL) { + if (pInfo->pPrevGroupKeys != NULL) { return TSDB_CODE_SUCCESS; } - pInfo->pPrevGroupKey = taosMemoryCalloc(1, sizeof(SGroupKeys)); - if (pInfo->pPrevGroupKey == NULL) { + pInfo->pPrevGroupKeys = taosArrayInit(pExprSup->numOfExprs, sizeof(SGroupKeys)); + if (pInfo->pPrevGroupKeys == NULL) { return terrno; } @@ -659,11 +669,17 @@ static int32_t initGroupKeyKeeper(STimeSliceOperatorInfo* pInfo, SExprSupp* pExp SExprInfo* pExprInfo = &pExprSup->pExprInfo[i]; if (isGroupKeyFunc(pExprInfo)) { - pInfo->pPrevGroupKey->bytes = pExprInfo->base.resSchema.bytes; - pInfo->pPrevGroupKey->type = pExprInfo->base.resSchema.type; - pInfo->pPrevGroupKey->isNull = false; - pInfo->pPrevGroupKey->pData = taosMemoryCalloc(1, pInfo->pPrevGroupKey->bytes); - if (!pInfo->pPrevGroupKey->pData) { + SGroupKeys key = {.bytes = pExprInfo->base.resSchema.bytes, + .type = pExprInfo->base.resSchema.type, + .isNull = false, + .pData = taosMemoryCalloc(1, pExprInfo->base.resSchema.bytes)}; + if (!key.pData) { + taosArrayDestroyEx(pInfo->pPrevGroupKeys, destroyGroupKey); + return terrno; + } + if (NULL == taosArrayPush(pInfo->pPrevGroupKeys, &key)) { + taosMemoryFree(key.pData); + taosArrayDestroyEx(pInfo->pPrevGroupKeys, destroyGroupKey); return terrno; } } @@ -910,7 +926,7 @@ static void genInterpAfterDataBlock(STimeSliceOperatorInfo* pSliceInfo, SOperato SInterval* pInterval = &pSliceInfo->interval; if (pSliceInfo->fillType == TSDB_FILL_NEXT || pSliceInfo->fillType == TSDB_FILL_LINEAR || - pSliceInfo->pPrevGroupKey == NULL) { + pSliceInfo->pPrevGroupKeys == NULL) { return; } @@ -921,12 +937,18 @@ static void genInterpAfterDataBlock(STimeSliceOperatorInfo* pSliceInfo, SOperato } } -static void copyPrevGroupKey(SExprSupp* pExprSup, SGroupKeys* pGroupKey, SSDataBlock* pSrcBlock) { +static int32_t copyPrevGroupKey(SExprSupp* pExprSup, SArray * pGroupKeys, SSDataBlock* pSrcBlock) { + int32_t groupKeyIdx = 0; for (int32_t j = 0; j < pExprSup->numOfExprs; ++j) { SExprInfo* pExprInfo = &pExprSup->pExprInfo[j]; if (isGroupKeyFunc(pExprInfo)) { int32_t srcSlot = pExprInfo->base.pParam[0].pCol->slotId; + SGroupKeys *pGroupKey = taosArrayGet(pGroupKeys, groupKeyIdx); + if (pGroupKey == NULL) { + return terrno; + } + groupKeyIdx++; SColumnInfoData* pSrc = taosArrayGet(pSrcBlock->pDataBlock, srcSlot); if (colDataIsNull_s(pSrc, 0)) { @@ -942,9 +964,9 @@ static void copyPrevGroupKey(SExprSupp* pExprSup, SGroupKeys* pGroupKey, SSDataB } pGroupKey->isNull = false; - break; } } + return TSDB_CODE_SUCCESS; } static void resetTimesliceInfo(STimeSliceOperatorInfo* pSliceInfo) { @@ -986,7 +1008,11 @@ static void doHandleTimeslice(SOperatorInfo* pOperator, SSDataBlock* pBlock) { T_LONG_JMP(pTaskInfo->env, code); } doTimesliceImpl(pOperator, pSliceInfo, pBlock, pTaskInfo, ignoreNull); - copyPrevGroupKey(&pOperator->exprSupp, pSliceInfo->pPrevGroupKey, pBlock); + code = copyPrevGroupKey(&pOperator->exprSupp, pSliceInfo->pPrevGroupKeys, pBlock); + if (code != TSDB_CODE_SUCCESS) { + qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(code)); + T_LONG_JMP(pTaskInfo->env, code); + } } static int32_t doTimesliceNext(SOperatorInfo* pOperator, SSDataBlock** ppRes) { @@ -1160,7 +1186,7 @@ int32_t createTimeSliceOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pPhyN pInfo->prevTsSet = false; pInfo->prevKey.ts = INT64_MIN; pInfo->groupId = 0; - pInfo->pPrevGroupKey = NULL; + pInfo->pPrevGroupKeys = NULL; pInfo->pNextGroupRes = NULL; pInfo->pRemainRes = NULL; pInfo->remainIndex = 0; @@ -1233,9 +1259,9 @@ void destroyTimeSliceOperatorInfo(void* param) { } taosArrayDestroy(pInfo->pLinearInfo); - if (pInfo->pPrevGroupKey) { - taosMemoryFree(pInfo->pPrevGroupKey->pData); - taosMemoryFree(pInfo->pPrevGroupKey); + if (pInfo->pPrevGroupKeys) { + taosArrayDestroyEx(pInfo->pPrevGroupKeys, destroyGroupKey); + pInfo->pPrevGroupKeys = NULL; } if (pInfo->hasPk && IS_VAR_DATA_TYPE(pInfo->pkCol.type)) { taosMemoryFreeClear(pInfo->prevKey.pks[0].pData); From 412c20968e7dcdc7395aaeb27f50d1637acd4595 Mon Sep 17 00:00:00 2001 From: Jing Sima Date: Wed, 30 Oct 2024 16:28:12 +0800 Subject: [PATCH 472/695] fix:[TD-32727] Add test case for TD-32727. --- tests/army/query/function/ans/interp.csv | 368 +++++++++++++++++++++++ tests/army/query/function/in/interp.in | 15 + tests/army/query/function/test_interp.py | 72 +++++ tests/parallel_test/cases.task | 1 + 4 files changed, 456 insertions(+) create mode 100644 tests/army/query/function/ans/interp.csv create mode 100644 tests/army/query/function/in/interp.in create mode 100644 tests/army/query/function/test_interp.py diff --git a/tests/army/query/function/ans/interp.csv b/tests/army/query/function/ans/interp.csv new file mode 100644 index 000000000000..e1ba236aa11b --- /dev/null +++ b/tests/army/query/function/ans/interp.csv @@ -0,0 +1,368 @@ + +taos> select _irowts as irowts ,tbname as table_name, _isfilled as isfilled , interp(c1) as intp_c1 from test.td32727 partition by tbname range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill (null) order by irowts; + irowts | table_name | isfilled | intp_c1 | +================================================================================ + 2020-02-01 00:00:04.000 | td32727 | true | NULL | + 2020-02-01 00:00:05.000 | td32727 | false | 5 | + 2020-02-01 00:00:06.000 | td32727 | true | NULL | + 2020-02-01 00:00:07.000 | td32727 | true | NULL | + 2020-02-01 00:00:08.000 | td32727 | true | NULL | + 2020-02-01 00:00:09.000 | td32727 | true | NULL | + 2020-02-01 00:00:10.000 | td32727 | false | 10 | + 2020-02-01 00:00:11.000 | td32727 | true | NULL | + 2020-02-01 00:00:12.000 | td32727 | true | NULL | + 2020-02-01 00:00:13.000 | td32727 | true | NULL | + 2020-02-01 00:00:14.000 | td32727 | true | NULL | + 2020-02-01 00:00:15.000 | td32727 | false | 15 | + 2020-02-01 00:00:16.000 | td32727 | true | NULL | + +taos> select _irowts as irowts ,tbname as table_name, _isfilled as isfilled , interp(c1) as intp_c1 from test.td32727 partition by tbname range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill (next) order by irowts; + irowts | table_name | isfilled | intp_c1 | +================================================================================ + 2020-02-01 00:00:04.000 | td32727 | true | 5 | + 2020-02-01 00:00:05.000 | td32727 | false | 5 | + 2020-02-01 00:00:06.000 | td32727 | true | 10 | + 2020-02-01 00:00:07.000 | td32727 | true | 10 | + 2020-02-01 00:00:08.000 | td32727 | true | 10 | + 2020-02-01 00:00:09.000 | td32727 | true | 10 | + 2020-02-01 00:00:10.000 | td32727 | false | 10 | + 2020-02-01 00:00:11.000 | td32727 | true | 15 | + 2020-02-01 00:00:12.000 | td32727 | true | 15 | + 2020-02-01 00:00:13.000 | td32727 | true | 15 | + 2020-02-01 00:00:14.000 | td32727 | true | 15 | + 2020-02-01 00:00:15.000 | td32727 | false | 15 | + +taos> select _irowts as irowts ,tbname as table_name, _isfilled as isfilled , interp(c1) as intp_c1 from test.td32727 partition by tbname range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill (prev) order by irowts; + irowts | table_name | isfilled | intp_c1 | +================================================================================ + 2020-02-01 00:00:05.000 | td32727 | false | 5 | + 2020-02-01 00:00:06.000 | td32727 | true | 5 | + 2020-02-01 00:00:07.000 | td32727 | true | 5 | + 2020-02-01 00:00:08.000 | td32727 | true | 5 | + 2020-02-01 00:00:09.000 | td32727 | true | 5 | + 2020-02-01 00:00:10.000 | td32727 | false | 10 | + 2020-02-01 00:00:11.000 | td32727 | true | 10 | + 2020-02-01 00:00:12.000 | td32727 | true | 10 | + 2020-02-01 00:00:13.000 | td32727 | true | 10 | + 2020-02-01 00:00:14.000 | td32727 | true | 10 | + 2020-02-01 00:00:15.000 | td32727 | false | 15 | + 2020-02-01 00:00:16.000 | td32727 | true | 15 | + +taos> select _irowts as irowts ,tbname as table_name, _isfilled as isfilled , interp(c1) as intp_c1 from test.td32727 partition by tbname range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill (linear) order by irowts; + irowts | table_name | isfilled | intp_c1 | +================================================================================ + 2020-02-01 00:00:05.000 | td32727 | false | 5 | + 2020-02-01 00:00:06.000 | td32727 | true | 6 | + 2020-02-01 00:00:07.000 | td32727 | true | 7 | + 2020-02-01 00:00:08.000 | td32727 | true | 8 | + 2020-02-01 00:00:09.000 | td32727 | true | 9 | + 2020-02-01 00:00:10.000 | td32727 | false | 10 | + 2020-02-01 00:00:11.000 | td32727 | true | 11 | + 2020-02-01 00:00:12.000 | td32727 | true | 12 | + 2020-02-01 00:00:13.000 | td32727 | true | 13 | + 2020-02-01 00:00:14.000 | td32727 | true | 14 | + 2020-02-01 00:00:15.000 | td32727 | false | 15 | + +taos> select _irowts as irowts ,tbname as table_name, _isfilled as isfilled , interp(c1) as intp_c1 from test.td32727 partition by tbname range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill (value, 1) order by irowts; + irowts | table_name | isfilled | intp_c1 | +================================================================================ + 2020-02-01 00:00:04.000 | td32727 | true | 1 | + 2020-02-01 00:00:05.000 | td32727 | false | 5 | + 2020-02-01 00:00:06.000 | td32727 | true | 1 | + 2020-02-01 00:00:07.000 | td32727 | true | 1 | + 2020-02-01 00:00:08.000 | td32727 | true | 1 | + 2020-02-01 00:00:09.000 | td32727 | true | 1 | + 2020-02-01 00:00:10.000 | td32727 | false | 10 | + 2020-02-01 00:00:11.000 | td32727 | true | 1 | + 2020-02-01 00:00:12.000 | td32727 | true | 1 | + 2020-02-01 00:00:13.000 | td32727 | true | 1 | + 2020-02-01 00:00:14.000 | td32727 | true | 1 | + 2020-02-01 00:00:15.000 | td32727 | false | 15 | + 2020-02-01 00:00:16.000 | td32727 | true | 1 | + +taos> select _irowts as irowts ,tbname as table_name, c2 as c_c2, _isfilled as isfilled , interp(c1) as intp_c1 from test.td32727 partition by tbname,c2 range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill (null) order by irowts, c2; + irowts | table_name | c_c2 | isfilled | intp_c1 | +============================================================================================== + 2020-02-01 00:00:04.000 | td32727 | 5 | true | NULL | + 2020-02-01 00:00:04.000 | td32727 | 10 | true | NULL | + 2020-02-01 00:00:04.000 | td32727 | 15 | true | NULL | + 2020-02-01 00:00:05.000 | td32727 | 5 | false | 5 | + 2020-02-01 00:00:05.000 | td32727 | 10 | true | NULL | + 2020-02-01 00:00:05.000 | td32727 | 15 | true | NULL | + 2020-02-01 00:00:06.000 | td32727 | 5 | true | NULL | + 2020-02-01 00:00:06.000 | td32727 | 10 | true | NULL | + 2020-02-01 00:00:06.000 | td32727 | 15 | true | NULL | + 2020-02-01 00:00:07.000 | td32727 | 5 | true | NULL | + 2020-02-01 00:00:07.000 | td32727 | 10 | true | NULL | + 2020-02-01 00:00:07.000 | td32727 | 15 | true | NULL | + 2020-02-01 00:00:08.000 | td32727 | 5 | true | NULL | + 2020-02-01 00:00:08.000 | td32727 | 10 | true | NULL | + 2020-02-01 00:00:08.000 | td32727 | 15 | true | NULL | + 2020-02-01 00:00:09.000 | td32727 | 5 | true | NULL | + 2020-02-01 00:00:09.000 | td32727 | 10 | true | NULL | + 2020-02-01 00:00:09.000 | td32727 | 15 | true | NULL | + 2020-02-01 00:00:10.000 | td32727 | 5 | true | NULL | + 2020-02-01 00:00:10.000 | td32727 | 10 | false | 10 | + 2020-02-01 00:00:10.000 | td32727 | 15 | true | NULL | + 2020-02-01 00:00:11.000 | td32727 | 5 | true | NULL | + 2020-02-01 00:00:11.000 | td32727 | 10 | true | NULL | + 2020-02-01 00:00:11.000 | td32727 | 15 | true | NULL | + 2020-02-01 00:00:12.000 | td32727 | 5 | true | NULL | + 2020-02-01 00:00:12.000 | td32727 | 10 | true | NULL | + 2020-02-01 00:00:12.000 | td32727 | 15 | true | NULL | + 2020-02-01 00:00:13.000 | td32727 | 5 | true | NULL | + 2020-02-01 00:00:13.000 | td32727 | 10 | true | NULL | + 2020-02-01 00:00:13.000 | td32727 | 15 | true | NULL | + 2020-02-01 00:00:14.000 | td32727 | 5 | true | NULL | + 2020-02-01 00:00:14.000 | td32727 | 10 | true | NULL | + 2020-02-01 00:00:14.000 | td32727 | 15 | true | NULL | + 2020-02-01 00:00:15.000 | td32727 | 5 | true | NULL | + 2020-02-01 00:00:15.000 | td32727 | 10 | true | NULL | + 2020-02-01 00:00:15.000 | td32727 | 15 | false | 15 | + 2020-02-01 00:00:16.000 | td32727 | 5 | true | NULL | + 2020-02-01 00:00:16.000 | td32727 | 10 | true | NULL | + 2020-02-01 00:00:16.000 | td32727 | 15 | true | NULL | + +taos> select _irowts as irowts ,tbname as table_name, c2 as c_c2, _isfilled as isfilled , interp(c1) as intp_c1 from test.td32727 partition by tbname,c2 range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill (next) order by irowts, c2; + irowts | table_name | c_c2 | isfilled | intp_c1 | +============================================================================================== + 2020-02-01 00:00:04.000 | td32727 | 5 | true | 5 | + 2020-02-01 00:00:04.000 | td32727 | 10 | true | 10 | + 2020-02-01 00:00:04.000 | td32727 | 15 | true | 15 | + 2020-02-01 00:00:05.000 | td32727 | 5 | false | 5 | + 2020-02-01 00:00:05.000 | td32727 | 10 | true | 10 | + 2020-02-01 00:00:05.000 | td32727 | 15 | true | 15 | + 2020-02-01 00:00:06.000 | td32727 | 10 | true | 10 | + 2020-02-01 00:00:06.000 | td32727 | 15 | true | 15 | + 2020-02-01 00:00:07.000 | td32727 | 10 | true | 10 | + 2020-02-01 00:00:07.000 | td32727 | 15 | true | 15 | + 2020-02-01 00:00:08.000 | td32727 | 10 | true | 10 | + 2020-02-01 00:00:08.000 | td32727 | 15 | true | 15 | + 2020-02-01 00:00:09.000 | td32727 | 10 | true | 10 | + 2020-02-01 00:00:09.000 | td32727 | 15 | true | 15 | + 2020-02-01 00:00:10.000 | td32727 | 10 | false | 10 | + 2020-02-01 00:00:10.000 | td32727 | 15 | true | 15 | + 2020-02-01 00:00:11.000 | td32727 | 15 | true | 15 | + 2020-02-01 00:00:12.000 | td32727 | 15 | true | 15 | + 2020-02-01 00:00:13.000 | td32727 | 15 | true | 15 | + 2020-02-01 00:00:14.000 | td32727 | 15 | true | 15 | + 2020-02-01 00:00:15.000 | td32727 | 15 | false | 15 | + +taos> select _irowts as irowts ,tbname as table_name, c2 as c_c2, _isfilled as isfilled , interp(c1) as intp_c1 from test.td32727 partition by tbname,c2 range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill (prev) order by irowts, c2; + irowts | table_name | c_c2 | isfilled | intp_c1 | +============================================================================================== + 2020-02-01 00:00:05.000 | td32727 | 5 | false | 5 | + 2020-02-01 00:00:06.000 | td32727 | 5 | true | 5 | + 2020-02-01 00:00:07.000 | td32727 | 5 | true | 5 | + 2020-02-01 00:00:08.000 | td32727 | 5 | true | 5 | + 2020-02-01 00:00:09.000 | td32727 | 5 | true | 5 | + 2020-02-01 00:00:10.000 | td32727 | 5 | true | 5 | + 2020-02-01 00:00:10.000 | td32727 | 10 | false | 10 | + 2020-02-01 00:00:11.000 | td32727 | 5 | true | 5 | + 2020-02-01 00:00:11.000 | td32727 | 10 | true | 10 | + 2020-02-01 00:00:12.000 | td32727 | 5 | true | 5 | + 2020-02-01 00:00:12.000 | td32727 | 10 | true | 10 | + 2020-02-01 00:00:13.000 | td32727 | 5 | true | 5 | + 2020-02-01 00:00:13.000 | td32727 | 10 | true | 10 | + 2020-02-01 00:00:14.000 | td32727 | 5 | true | 5 | + 2020-02-01 00:00:14.000 | td32727 | 10 | true | 10 | + 2020-02-01 00:00:15.000 | td32727 | 5 | true | 5 | + 2020-02-01 00:00:15.000 | td32727 | 10 | true | 10 | + 2020-02-01 00:00:15.000 | td32727 | 15 | false | 15 | + 2020-02-01 00:00:16.000 | td32727 | 5 | true | 5 | + 2020-02-01 00:00:16.000 | td32727 | 10 | true | 10 | + 2020-02-01 00:00:16.000 | td32727 | 15 | true | 15 | + +taos> select _irowts as irowts ,tbname as table_name, c2 as c_c2, _isfilled as isfilled , interp(c1) as intp_c1 from test.td32727 partition by tbname,c2 range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill (linear) order by irowts, c2; + irowts | table_name | c_c2 | isfilled | intp_c1 | +============================================================================================== + 2020-02-01 00:00:05.000 | td32727 | 5 | false | 5 | + 2020-02-01 00:00:10.000 | td32727 | 10 | false | 10 | + 2020-02-01 00:00:15.000 | td32727 | 15 | false | 15 | + +taos> select _irowts as irowts ,tbname as table_name, c2 as c_c2, _isfilled as isfilled , interp(c1) as intp_c1 from test.td32727 partition by tbname,c2 range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill (value, 1) order by irowts, c2; + irowts | table_name | c_c2 | isfilled | intp_c1 | +============================================================================================== + 2020-02-01 00:00:04.000 | td32727 | 5 | true | 1 | + 2020-02-01 00:00:04.000 | td32727 | 10 | true | 1 | + 2020-02-01 00:00:04.000 | td32727 | 15 | true | 1 | + 2020-02-01 00:00:05.000 | td32727 | 5 | false | 5 | + 2020-02-01 00:00:05.000 | td32727 | 10 | true | 1 | + 2020-02-01 00:00:05.000 | td32727 | 15 | true | 1 | + 2020-02-01 00:00:06.000 | td32727 | 5 | true | 1 | + 2020-02-01 00:00:06.000 | td32727 | 10 | true | 1 | + 2020-02-01 00:00:06.000 | td32727 | 15 | true | 1 | + 2020-02-01 00:00:07.000 | td32727 | 5 | true | 1 | + 2020-02-01 00:00:07.000 | td32727 | 10 | true | 1 | + 2020-02-01 00:00:07.000 | td32727 | 15 | true | 1 | + 2020-02-01 00:00:08.000 | td32727 | 5 | true | 1 | + 2020-02-01 00:00:08.000 | td32727 | 10 | true | 1 | + 2020-02-01 00:00:08.000 | td32727 | 15 | true | 1 | + 2020-02-01 00:00:09.000 | td32727 | 5 | true | 1 | + 2020-02-01 00:00:09.000 | td32727 | 10 | true | 1 | + 2020-02-01 00:00:09.000 | td32727 | 15 | true | 1 | + 2020-02-01 00:00:10.000 | td32727 | 5 | true | 1 | + 2020-02-01 00:00:10.000 | td32727 | 10 | false | 10 | + 2020-02-01 00:00:10.000 | td32727 | 15 | true | 1 | + 2020-02-01 00:00:11.000 | td32727 | 5 | true | 1 | + 2020-02-01 00:00:11.000 | td32727 | 10 | true | 1 | + 2020-02-01 00:00:11.000 | td32727 | 15 | true | 1 | + 2020-02-01 00:00:12.000 | td32727 | 5 | true | 1 | + 2020-02-01 00:00:12.000 | td32727 | 10 | true | 1 | + 2020-02-01 00:00:12.000 | td32727 | 15 | true | 1 | + 2020-02-01 00:00:13.000 | td32727 | 5 | true | 1 | + 2020-02-01 00:00:13.000 | td32727 | 10 | true | 1 | + 2020-02-01 00:00:13.000 | td32727 | 15 | true | 1 | + 2020-02-01 00:00:14.000 | td32727 | 5 | true | 1 | + 2020-02-01 00:00:14.000 | td32727 | 10 | true | 1 | + 2020-02-01 00:00:14.000 | td32727 | 15 | true | 1 | + 2020-02-01 00:00:15.000 | td32727 | 5 | true | 1 | + 2020-02-01 00:00:15.000 | td32727 | 10 | true | 1 | + 2020-02-01 00:00:15.000 | td32727 | 15 | false | 15 | + 2020-02-01 00:00:16.000 | td32727 | 5 | true | 1 | + 2020-02-01 00:00:16.000 | td32727 | 10 | true | 1 | + 2020-02-01 00:00:16.000 | td32727 | 15 | true | 1 | + +taos> select _irowts as irowts ,tbname as table_name, c2 as c_c2, c3 as c_c3, _isfilled as isfilled , interp(c1) as intp_c1 from test.td32727 partition by tbname,c2,c3 range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill (null) order by irowts, c2, c3; + irowts | table_name | c_c2 | c_c3 | isfilled | intp_c1 | +====================================================================================================================== + 2020-02-01 00:00:04.000 | td32727 | 5 | 5 | true | NULL | + 2020-02-01 00:00:04.000 | td32727 | 10 | 10 | true | NULL | + 2020-02-01 00:00:04.000 | td32727 | 15 | 15 | true | NULL | + 2020-02-01 00:00:05.000 | td32727 | 5 | 5 | false | 5 | + 2020-02-01 00:00:05.000 | td32727 | 10 | 10 | true | NULL | + 2020-02-01 00:00:05.000 | td32727 | 15 | 15 | true | NULL | + 2020-02-01 00:00:06.000 | td32727 | 5 | 5 | true | NULL | + 2020-02-01 00:00:06.000 | td32727 | 10 | 10 | true | NULL | + 2020-02-01 00:00:06.000 | td32727 | 15 | 15 | true | NULL | + 2020-02-01 00:00:07.000 | td32727 | 5 | 5 | true | NULL | + 2020-02-01 00:00:07.000 | td32727 | 10 | 10 | true | NULL | + 2020-02-01 00:00:07.000 | td32727 | 15 | 15 | true | NULL | + 2020-02-01 00:00:08.000 | td32727 | 5 | 5 | true | NULL | + 2020-02-01 00:00:08.000 | td32727 | 10 | 10 | true | NULL | + 2020-02-01 00:00:08.000 | td32727 | 15 | 15 | true | NULL | + 2020-02-01 00:00:09.000 | td32727 | 5 | 5 | true | NULL | + 2020-02-01 00:00:09.000 | td32727 | 10 | 10 | true | NULL | + 2020-02-01 00:00:09.000 | td32727 | 15 | 15 | true | NULL | + 2020-02-01 00:00:10.000 | td32727 | 5 | 5 | true | NULL | + 2020-02-01 00:00:10.000 | td32727 | 10 | 10 | false | 10 | + 2020-02-01 00:00:10.000 | td32727 | 15 | 15 | true | NULL | + 2020-02-01 00:00:11.000 | td32727 | 5 | 5 | true | NULL | + 2020-02-01 00:00:11.000 | td32727 | 10 | 10 | true | NULL | + 2020-02-01 00:00:11.000 | td32727 | 15 | 15 | true | NULL | + 2020-02-01 00:00:12.000 | td32727 | 5 | 5 | true | NULL | + 2020-02-01 00:00:12.000 | td32727 | 10 | 10 | true | NULL | + 2020-02-01 00:00:12.000 | td32727 | 15 | 15 | true | NULL | + 2020-02-01 00:00:13.000 | td32727 | 5 | 5 | true | NULL | + 2020-02-01 00:00:13.000 | td32727 | 10 | 10 | true | NULL | + 2020-02-01 00:00:13.000 | td32727 | 15 | 15 | true | NULL | + 2020-02-01 00:00:14.000 | td32727 | 5 | 5 | true | NULL | + 2020-02-01 00:00:14.000 | td32727 | 10 | 10 | true | NULL | + 2020-02-01 00:00:14.000 | td32727 | 15 | 15 | true | NULL | + 2020-02-01 00:00:15.000 | td32727 | 5 | 5 | true | NULL | + 2020-02-01 00:00:15.000 | td32727 | 10 | 10 | true | NULL | + 2020-02-01 00:00:15.000 | td32727 | 15 | 15 | false | 15 | + 2020-02-01 00:00:16.000 | td32727 | 5 | 5 | true | NULL | + 2020-02-01 00:00:16.000 | td32727 | 10 | 10 | true | NULL | + 2020-02-01 00:00:16.000 | td32727 | 15 | 15 | true | NULL | + +taos> select _irowts as irowts ,tbname as table_name, c2 as c_c2, c3 as c_c3, _isfilled as isfilled , interp(c1) as intp_c1 from test.td32727 partition by tbname,c2,c3 range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill (next) order by irowts, c2, c3; + irowts | table_name | c_c2 | c_c3 | isfilled | intp_c1 | +====================================================================================================================== + 2020-02-01 00:00:04.000 | td32727 | 5 | 5 | true | 5 | + 2020-02-01 00:00:04.000 | td32727 | 10 | 10 | true | 10 | + 2020-02-01 00:00:04.000 | td32727 | 15 | 15 | true | 15 | + 2020-02-01 00:00:05.000 | td32727 | 5 | 5 | false | 5 | + 2020-02-01 00:00:05.000 | td32727 | 10 | 10 | true | 10 | + 2020-02-01 00:00:05.000 | td32727 | 15 | 15 | true | 15 | + 2020-02-01 00:00:06.000 | td32727 | 10 | 10 | true | 10 | + 2020-02-01 00:00:06.000 | td32727 | 15 | 15 | true | 15 | + 2020-02-01 00:00:07.000 | td32727 | 10 | 10 | true | 10 | + 2020-02-01 00:00:07.000 | td32727 | 15 | 15 | true | 15 | + 2020-02-01 00:00:08.000 | td32727 | 10 | 10 | true | 10 | + 2020-02-01 00:00:08.000 | td32727 | 15 | 15 | true | 15 | + 2020-02-01 00:00:09.000 | td32727 | 10 | 10 | true | 10 | + 2020-02-01 00:00:09.000 | td32727 | 15 | 15 | true | 15 | + 2020-02-01 00:00:10.000 | td32727 | 10 | 10 | false | 10 | + 2020-02-01 00:00:10.000 | td32727 | 15 | 15 | true | 15 | + 2020-02-01 00:00:11.000 | td32727 | 15 | 15 | true | 15 | + 2020-02-01 00:00:12.000 | td32727 | 15 | 15 | true | 15 | + 2020-02-01 00:00:13.000 | td32727 | 15 | 15 | true | 15 | + 2020-02-01 00:00:14.000 | td32727 | 15 | 15 | true | 15 | + 2020-02-01 00:00:15.000 | td32727 | 15 | 15 | false | 15 | + +taos> select _irowts as irowts ,tbname as table_name, c2 as c_c2, c3 as c_c3, _isfilled as isfilled , interp(c1) as intp_c1 from test.td32727 partition by tbname,c2,c3 range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill (prev) order by irowts, c2, c3; + irowts | table_name | c_c2 | c_c3 | isfilled | intp_c1 | +====================================================================================================================== + 2020-02-01 00:00:05.000 | td32727 | 5 | 5 | false | 5 | + 2020-02-01 00:00:06.000 | td32727 | 5 | 5 | true | 5 | + 2020-02-01 00:00:07.000 | td32727 | 5 | 5 | true | 5 | + 2020-02-01 00:00:08.000 | td32727 | 5 | 5 | true | 5 | + 2020-02-01 00:00:09.000 | td32727 | 5 | 5 | true | 5 | + 2020-02-01 00:00:10.000 | td32727 | 5 | 5 | true | 5 | + 2020-02-01 00:00:10.000 | td32727 | 10 | 10 | false | 10 | + 2020-02-01 00:00:11.000 | td32727 | 5 | 5 | true | 5 | + 2020-02-01 00:00:11.000 | td32727 | 10 | 10 | true | 10 | + 2020-02-01 00:00:12.000 | td32727 | 5 | 5 | true | 5 | + 2020-02-01 00:00:12.000 | td32727 | 10 | 10 | true | 10 | + 2020-02-01 00:00:13.000 | td32727 | 5 | 5 | true | 5 | + 2020-02-01 00:00:13.000 | td32727 | 10 | 10 | true | 10 | + 2020-02-01 00:00:14.000 | td32727 | 5 | 5 | true | 5 | + 2020-02-01 00:00:14.000 | td32727 | 10 | 10 | true | 10 | + 2020-02-01 00:00:15.000 | td32727 | 5 | 5 | true | 5 | + 2020-02-01 00:00:15.000 | td32727 | 10 | 10 | true | 10 | + 2020-02-01 00:00:15.000 | td32727 | 15 | 15 | false | 15 | + 2020-02-01 00:00:16.000 | td32727 | 5 | 5 | true | 5 | + 2020-02-01 00:00:16.000 | td32727 | 10 | 10 | true | 10 | + 2020-02-01 00:00:16.000 | td32727 | 15 | 15 | true | 15 | + +taos> select _irowts as irowts ,tbname as table_name, c2 as c_c2, c3 as c_c3, _isfilled as isfilled , interp(c1) as intp_c1 from test.td32727 partition by tbname,c2,c3 range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill (linear) order by irowts, c2, c3; + irowts | table_name | c_c2 | c_c3 | isfilled | intp_c1 | +====================================================================================================================== + 2020-02-01 00:00:05.000 | td32727 | 5 | 5 | false | 5 | + 2020-02-01 00:00:10.000 | td32727 | 10 | 10 | false | 10 | + 2020-02-01 00:00:15.000 | td32727 | 15 | 15 | false | 15 | + +taos> select _irowts as irowts ,tbname as table_name, c2 as c_c2, c3 as c_c3, _isfilled as isfilled , interp(c1) as intp_c1 from test.td32727 partition by tbname,c2,c3 range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill (value, 1) order by irowts, c2, c3; + irowts | table_name | c_c2 | c_c3 | isfilled | intp_c1 | +====================================================================================================================== + 2020-02-01 00:00:04.000 | td32727 | 5 | 5 | true | 1 | + 2020-02-01 00:00:04.000 | td32727 | 10 | 10 | true | 1 | + 2020-02-01 00:00:04.000 | td32727 | 15 | 15 | true | 1 | + 2020-02-01 00:00:05.000 | td32727 | 5 | 5 | false | 5 | + 2020-02-01 00:00:05.000 | td32727 | 10 | 10 | true | 1 | + 2020-02-01 00:00:05.000 | td32727 | 15 | 15 | true | 1 | + 2020-02-01 00:00:06.000 | td32727 | 5 | 5 | true | 1 | + 2020-02-01 00:00:06.000 | td32727 | 10 | 10 | true | 1 | + 2020-02-01 00:00:06.000 | td32727 | 15 | 15 | true | 1 | + 2020-02-01 00:00:07.000 | td32727 | 5 | 5 | true | 1 | + 2020-02-01 00:00:07.000 | td32727 | 10 | 10 | true | 1 | + 2020-02-01 00:00:07.000 | td32727 | 15 | 15 | true | 1 | + 2020-02-01 00:00:08.000 | td32727 | 5 | 5 | true | 1 | + 2020-02-01 00:00:08.000 | td32727 | 10 | 10 | true | 1 | + 2020-02-01 00:00:08.000 | td32727 | 15 | 15 | true | 1 | + 2020-02-01 00:00:09.000 | td32727 | 5 | 5 | true | 1 | + 2020-02-01 00:00:09.000 | td32727 | 10 | 10 | true | 1 | + 2020-02-01 00:00:09.000 | td32727 | 15 | 15 | true | 1 | + 2020-02-01 00:00:10.000 | td32727 | 5 | 5 | true | 1 | + 2020-02-01 00:00:10.000 | td32727 | 10 | 10 | false | 10 | + 2020-02-01 00:00:10.000 | td32727 | 15 | 15 | true | 1 | + 2020-02-01 00:00:11.000 | td32727 | 5 | 5 | true | 1 | + 2020-02-01 00:00:11.000 | td32727 | 10 | 10 | true | 1 | + 2020-02-01 00:00:11.000 | td32727 | 15 | 15 | true | 1 | + 2020-02-01 00:00:12.000 | td32727 | 5 | 5 | true | 1 | + 2020-02-01 00:00:12.000 | td32727 | 10 | 10 | true | 1 | + 2020-02-01 00:00:12.000 | td32727 | 15 | 15 | true | 1 | + 2020-02-01 00:00:13.000 | td32727 | 5 | 5 | true | 1 | + 2020-02-01 00:00:13.000 | td32727 | 10 | 10 | true | 1 | + 2020-02-01 00:00:13.000 | td32727 | 15 | 15 | true | 1 | + 2020-02-01 00:00:14.000 | td32727 | 5 | 5 | true | 1 | + 2020-02-01 00:00:14.000 | td32727 | 10 | 10 | true | 1 | + 2020-02-01 00:00:14.000 | td32727 | 15 | 15 | true | 1 | + 2020-02-01 00:00:15.000 | td32727 | 5 | 5 | true | 1 | + 2020-02-01 00:00:15.000 | td32727 | 10 | 10 | true | 1 | + 2020-02-01 00:00:15.000 | td32727 | 15 | 15 | false | 15 | + 2020-02-01 00:00:16.000 | td32727 | 5 | 5 | true | 1 | + 2020-02-01 00:00:16.000 | td32727 | 10 | 10 | true | 1 | + 2020-02-01 00:00:16.000 | td32727 | 15 | 15 | true | 1 | + diff --git a/tests/army/query/function/in/interp.in b/tests/army/query/function/in/interp.in new file mode 100644 index 000000000000..4825ab46b167 --- /dev/null +++ b/tests/army/query/function/in/interp.in @@ -0,0 +1,15 @@ +select _irowts as irowts ,tbname as table_name, _isfilled as isfilled , interp(c1) as intp_c1 from test.td32727 partition by tbname range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill (null) order by irowts; +select _irowts as irowts ,tbname as table_name, _isfilled as isfilled , interp(c1) as intp_c1 from test.td32727 partition by tbname range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill (next) order by irowts; +select _irowts as irowts ,tbname as table_name, _isfilled as isfilled , interp(c1) as intp_c1 from test.td32727 partition by tbname range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill (prev) order by irowts; +select _irowts as irowts ,tbname as table_name, _isfilled as isfilled , interp(c1) as intp_c1 from test.td32727 partition by tbname range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill (linear) order by irowts; +select _irowts as irowts ,tbname as table_name, _isfilled as isfilled , interp(c1) as intp_c1 from test.td32727 partition by tbname range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill (value, 1) order by irowts; +select _irowts as irowts ,tbname as table_name, c2 as c_c2, _isfilled as isfilled , interp(c1) as intp_c1 from test.td32727 partition by tbname,c2 range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill (null) order by irowts, c2; +select _irowts as irowts ,tbname as table_name, c2 as c_c2, _isfilled as isfilled , interp(c1) as intp_c1 from test.td32727 partition by tbname,c2 range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill (next) order by irowts, c2; +select _irowts as irowts ,tbname as table_name, c2 as c_c2, _isfilled as isfilled , interp(c1) as intp_c1 from test.td32727 partition by tbname,c2 range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill (prev) order by irowts, c2; +select _irowts as irowts ,tbname as table_name, c2 as c_c2, _isfilled as isfilled , interp(c1) as intp_c1 from test.td32727 partition by tbname,c2 range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill (linear) order by irowts, c2; +select _irowts as irowts ,tbname as table_name, c2 as c_c2, _isfilled as isfilled , interp(c1) as intp_c1 from test.td32727 partition by tbname,c2 range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill (value, 1) order by irowts, c2; +select _irowts as irowts ,tbname as table_name, c2 as c_c2, c3 as c_c3, _isfilled as isfilled , interp(c1) as intp_c1 from test.td32727 partition by tbname,c2,c3 range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill (null) order by irowts, c2, c3; +select _irowts as irowts ,tbname as table_name, c2 as c_c2, c3 as c_c3, _isfilled as isfilled , interp(c1) as intp_c1 from test.td32727 partition by tbname,c2,c3 range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill (next) order by irowts, c2, c3; +select _irowts as irowts ,tbname as table_name, c2 as c_c2, c3 as c_c3, _isfilled as isfilled , interp(c1) as intp_c1 from test.td32727 partition by tbname,c2,c3 range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill (prev) order by irowts, c2, c3; +select _irowts as irowts ,tbname as table_name, c2 as c_c2, c3 as c_c3, _isfilled as isfilled , interp(c1) as intp_c1 from test.td32727 partition by tbname,c2,c3 range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill (linear) order by irowts, c2, c3; +select _irowts as irowts ,tbname as table_name, c2 as c_c2, c3 as c_c3, _isfilled as isfilled , interp(c1) as intp_c1 from test.td32727 partition by tbname,c2,c3 range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill (value, 1) order by irowts, c2, c3; diff --git a/tests/army/query/function/test_interp.py b/tests/army/query/function/test_interp.py new file mode 100644 index 000000000000..f903e7be7340 --- /dev/null +++ b/tests/army/query/function/test_interp.py @@ -0,0 +1,72 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +from frame import etool +from frame.etool import * +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame.common import * + +class TDTestCase(TBase): + updatecfgDict = { + "keepColumnName": "1", + "ttlChangeOnWrite": "1", + "querySmaOptimize": "1", + "slowLogScope": "none", + "queryBufferSize": 10240 + } + + def insert_data(self): + tdLog.printNoPrefix("==========step1:create table") + + tdSql.execute("create database test keep 36500") + tdSql.execute("use test") + tdSql.execute( + f'''create table if not exists test.td32727 + (ts timestamp, c0 tinyint, c1 smallint, c2 int, c3 bigint, c4 double, c5 float, c6 bool, c7 varchar(10), c8 nchar(10), c9 tinyint unsigned, c10 smallint unsigned, c11 int unsigned, c12 bigint unsigned) + ''' + ) + + tdLog.printNoPrefix("==========step2:insert data") + + tdSql.execute(f"insert into test.td32727 values ('2020-02-01 00:00:05', 5, 5, 5, 5, 5.0, 5.0, true, 'varchar', 'nchar', 5, 5, 5, 5)") + tdSql.execute(f"insert into test.td32727 values ('2020-02-01 00:00:10', 10, 10, 10, 10, 10.0, 10.0, true, 'varchar', 'nchar', 10, 10, 10, 10)") + tdSql.execute(f"insert into test.td32727 values ('2020-02-01 00:00:15', 15, 15, 15, 15, 15.0, 15.0, true, 'varchar', 'nchar', 15, 15, 15, 15)") + + + def test_normal_query_new(self, testCase): + # read sql from .sql file and execute + tdLog.info("test normal query.") + self.sqlFile = etool.curFile(__file__, f"in/{testCase}.in") + self.ansFile = etool.curFile(__file__, f"ans/{testCase}.csv") + + tdCom.compare_testcase_result(self.sqlFile, self.ansFile, testCase) + + def test_interp(self): + self.test_normal_query_new("interp") + + def run(self): + tdLog.debug(f"start to excute {__file__}") + + self.insert_data() + + # math function + self.test_interp() + + tdLog.success(f"{__file__} successfully executed") + + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 09216add8261..216be82868f9 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -16,6 +16,7 @@ ,,y,army,./pytest.sh python3 ./test.py -f query/function/test_func_elapsed.py ,,y,army,./pytest.sh python3 ./test.py -f query/function/test_function.py ,,y,army,./pytest.sh python3 ./test.py -f query/function/test_resinfo.py +,,y,army,./pytest.sh python3 ./test.py -f query/function/test_interp.py ,,y,army,./pytest.sh python3 ./test.py -f query/function/concat.py ,,y,army,./pytest.sh python3 ./test.py -f query/function/cast.py ,,y,army,./pytest.sh python3 ./test.py -f query/test_join.py From 3895a7707af617ee8acf9689ce51ca7bb4c00b6b Mon Sep 17 00:00:00 2001 From: Pengrongkun Date: Wed, 30 Oct 2024 16:51:59 +0800 Subject: [PATCH 473/695] convert TAOS_FIELD_E to TAOS_FIELD_ALL, to prevent modifications to the original API --- include/client/taos.h | 13 ++++++-- source/client/inc/clientStmt2.h | 1 + source/client/src/clientMain.c | 10 ++++-- source/client/src/clientStmt2.c | 45 ++++++++++++++++++++++++-- source/libs/parser/src/parInsertStmt.c | 7 ++-- tests/script/api/stmt2-get-fields.c | 13 ++++---- 6 files changed, 72 insertions(+), 17 deletions(-) diff --git a/include/client/taos.h b/include/client/taos.h index 6797dfee5f68..266e0e192d87 100644 --- a/include/client/taos.h +++ b/include/client/taos.h @@ -95,13 +95,21 @@ typedef struct taosField { } TAOS_FIELD; typedef struct TAOS_FIELD_E { + char name[65]; + int8_t type; + uint8_t precision; + uint8_t scale; + int32_t bytes; +} TAOS_FIELD_E; + +typedef struct TAOS_FIELD_ALL { char name[65]; int8_t type; uint8_t precision; uint8_t scale; int32_t bytes; TAOS_FIELD_T field_type; -} TAOS_FIELD_E; +} TAOS_FIELD_ALL; #ifdef WINDOWS #define DLL_EXPORT __declspec(dllexport) @@ -233,8 +241,9 @@ DLL_EXPORT int taos_stmt2_exec(TAOS_STMT2 *stmt, int *affected_rows); DLL_EXPORT int taos_stmt2_close(TAOS_STMT2 *stmt); DLL_EXPORT int taos_stmt2_is_insert(TAOS_STMT2 *stmt, int *insert); DLL_EXPORT int taos_stmt2_get_fields(TAOS_STMT2 *stmt, TAOS_FIELD_T field_type, int *count, TAOS_FIELD_E **fields); -DLL_EXPORT int taos_stmt2_get_all_fields(TAOS_STMT2 *stmt, int *count, TAOS_FIELD_E **fields); +DLL_EXPORT int taos_stmt2_get_all_fields(TAOS_STMT2 *stmt, int *count, TAOS_FIELD_ALL **fields); DLL_EXPORT void taos_stmt2_free_fields(TAOS_STMT2 *stmt, TAOS_FIELD_E *fields); +DLL_EXPORT void taos_stmt2_free_all_fields(TAOS_STMT2 *stmt, TAOS_FIELD_ALL *fields); DLL_EXPORT TAOS_RES *taos_stmt2_result(TAOS_STMT2 *stmt); DLL_EXPORT char *taos_stmt2_error(TAOS_STMT2 *stmt); diff --git a/source/client/inc/clientStmt2.h b/source/client/inc/clientStmt2.h index 4e9a09c0820d..e54057e72f18 100644 --- a/source/client/inc/clientStmt2.h +++ b/source/client/inc/clientStmt2.h @@ -222,6 +222,7 @@ int stmtSetTbTags2(TAOS_STMT2 *stmt, TAOS_STMT2_BIND *tags); int stmtBindBatch2(TAOS_STMT2 *stmt, TAOS_STMT2_BIND *bind, int32_t colIdx); int stmtGetTagFields2(TAOS_STMT2 *stmt, int *nums, TAOS_FIELD_E **fields); int stmtGetColFields2(TAOS_STMT2 *stmt, int *nums, TAOS_FIELD_E **fields); +int stmtGetColFieldsALL2(TAOS_STMT2 *stmt, int *nums, TAOS_FIELD_ALL **fields); int stmtGetParamNum2(TAOS_STMT2 *stmt, int *nums); int stmtGetParamTbName(TAOS_STMT2 *stmt, int *nums); int stmtIsInsert2(TAOS_STMT2 *stmt, int *insert); diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c index 54da1c013c58..f2fc2b8bdc27 100644 --- a/source/client/src/clientMain.c +++ b/source/client/src/clientMain.c @@ -2102,14 +2102,14 @@ int taos_stmt2_get_fields(TAOS_STMT2 *stmt, TAOS_FIELD_T field_type, int *count, } } -int taos_stmt2_get_all_fields(TAOS_STMT2 *stmt, int *count, TAOS_FIELD_E **fields) { +int taos_stmt2_get_all_fields(TAOS_STMT2 *stmt, int *count, TAOS_FIELD_ALL **fields) { if (stmt == NULL || count == NULL) { tscError("NULL parameter for %s", __FUNCTION__); terrno = TSDB_CODE_INVALID_PARA; return terrno; } - return stmtGetColFields2(stmt, count, fields); + return stmtGetColFieldsALL2(stmt, count, fields); } void taos_stmt2_free_fields(TAOS_STMT2 *stmt, TAOS_FIELD_E *fields) { @@ -2118,6 +2118,12 @@ void taos_stmt2_free_fields(TAOS_STMT2 *stmt, TAOS_FIELD_E *fields) { taosMemoryFree(fields); } +DLL_EXPORT void taos_stmt2_free_all_fields(TAOS_STMT2 *stmt, TAOS_FIELD_ALL *fields) { + (void)stmt; + if (!fields) return; + taosMemoryFree(fields); +} + TAOS_RES *taos_stmt2_result(TAOS_STMT2 *stmt) { if (stmt == NULL) { tscError("NULL parameter for %s", __FUNCTION__); diff --git a/source/client/src/clientStmt2.c b/source/client/src/clientStmt2.c index 5d04006f06bd..67de878ee572 100644 --- a/source/client/src/clientStmt2.c +++ b/source/client/src/clientStmt2.c @@ -1069,7 +1069,7 @@ static int stmtFetchColFields2(STscStmt2* pStmt, int32_t* fieldNum, TAOS_FIELD_E return TSDB_CODE_SUCCESS; } -static int stmtFetchFields2(STscStmt2* pStmt, int32_t* fieldNum, TAOS_FIELD_E** fields) { +static int stmtFetchFields2(STscStmt2* pStmt, int32_t* fieldNum, TAOS_FIELD_ALL** fields) { SBoundColInfo* tags = (SBoundColInfo*)pStmt->bInfo.boundTags; STableMeta* meta = ((SVnodeModifyOpStmt*)(pStmt->sql.pQuery->pRoot))->pTableMeta; if (tags == NULL || meta == NULL || (meta->schema == NULL && tags->numOfBound != 0)) { @@ -1077,7 +1077,7 @@ static int stmtFetchFields2(STscStmt2* pStmt, int32_t* fieldNum, TAOS_FIELD_E** } if (fields != NULL) { - *fields = taosMemoryCalloc(tags->numOfBound, sizeof(TAOS_FIELD_E)); + *fields = taosMemoryCalloc(tags->numOfBound, sizeof(TAOS_FIELD_ALL)); if (NULL == *fields) { return terrno; } @@ -1886,6 +1886,47 @@ int stmtGetColFields2(TAOS_STMT2* stmt, int* nums, TAOS_FIELD_E** fields) { STMT_ERRI_JRET(stmtFetchColFields2(stmt, nums, fields)); +_return: + + pStmt->errCode = preCode; + + return code; +} + +int stmtGetColFieldsALL2(TAOS_STMT2* stmt, int* nums, TAOS_FIELD_ALL** fields) { + int32_t code = 0; + STscStmt2* pStmt = (STscStmt2*)stmt; + int32_t preCode = pStmt->errCode; + + STMT_DLOG_E("start to get col fields"); + + if (pStmt->errCode != TSDB_CODE_SUCCESS) { + return pStmt->errCode; + } + + if (STMT_TYPE_QUERY == pStmt->sql.type) { + STMT_ERRI_JRET(TSDB_CODE_TSC_STMT_API_ERROR); + } + + STMT_ERRI_JRET(stmtSwitchStatus(pStmt, STMT_FETCH_FIELDS)); + + if (pStmt->bInfo.needParse && pStmt->sql.runTimes && pStmt->sql.type > 0 && + STMT_TYPE_MULTI_INSERT != pStmt->sql.type) { + pStmt->bInfo.needParse = false; + } + + if (pStmt->exec.pRequest && STMT_TYPE_QUERY == pStmt->sql.type && pStmt->sql.runTimes) { + taos_free_result(pStmt->exec.pRequest); + pStmt->exec.pRequest = NULL; + STMT_ERR_RET(stmtCreateRequest(pStmt)); + } + + STMT_ERRI_JRET(stmtCreateRequest(pStmt)); + + if (pStmt->bInfo.needParse) { + STMT_ERRI_JRET(stmtParseSql(pStmt)); + } + _return: pStmt->errCode = preCode; diff --git a/source/libs/parser/src/parInsertStmt.c b/source/libs/parser/src/parInsertStmt.c index 8c17689ea7d5..1355d9e09fb8 100644 --- a/source/libs/parser/src/parInsertStmt.c +++ b/source/libs/parser/src/parInsertStmt.c @@ -885,7 +885,7 @@ int32_t qBindStmtSingleColValue2(void* pBlock, SArray* pCols, TAOS_STMT2_BIND* b } int32_t buildBoundFields(int32_t numOfBound, int16_t* boundColumns, SSchema* pSchema, int32_t* fieldNum, - TAOS_FIELD_E** fields, uint8_t timePrec, TAOS_FIELD_T fieldType) { + TAOS_FIELD_E** fields, uint8_t timePrec) { if (fields != NULL) { *fields = taosMemoryCalloc(numOfBound, sizeof(TAOS_FIELD_E)); if (NULL == *fields) { @@ -900,7 +900,6 @@ int32_t buildBoundFields(int32_t numOfBound, int16_t* boundColumns, SSchema* pSc for (int32_t i = 0; i < numOfBound; ++i) { schema = &pSchema[boundColumns[i]]; strcpy((*fields)[i].name, schema->name); - (*fields)[i].field_type = schema->type; (*fields)[i].type = schema->type; (*fields)[i].bytes = schema->bytes; } @@ -930,7 +929,7 @@ int32_t qBuildStmtTagFields(void* pBlock, void* boundTags, int32_t* fieldNum, TA return TSDB_CODE_SUCCESS; } - CHECK_CODE(buildBoundFields(tags->numOfBound, tags->pColIndex, pSchema, fieldNum, fields, 0, TAOS_FIELD_TAG)); + CHECK_CODE(buildBoundFields(tags->numOfBound, tags->pColIndex, pSchema, fieldNum, fields, 0)); return TSDB_CODE_SUCCESS; } @@ -948,7 +947,7 @@ int32_t qBuildStmtColFields(void* pBlock, int32_t* fieldNum, TAOS_FIELD_E** fiel } CHECK_CODE(buildBoundFields(pDataBlock->boundColsInfo.numOfBound, pDataBlock->boundColsInfo.pColIndex, pSchema, - fieldNum, fields, pDataBlock->pMeta->tableInfo.precision, TAOS_FIELD_COL)); + fieldNum, fields, pDataBlock->pMeta->tableInfo.precision)); return TSDB_CODE_SUCCESS; } diff --git a/tests/script/api/stmt2-get-fields.c b/tests/script/api/stmt2-get-fields.c index 60bee16873ef..23b91b56c905 100644 --- a/tests/script/api/stmt2-get-fields.c +++ b/tests/script/api/stmt2-get-fields.c @@ -25,8 +25,8 @@ void do_stmt(TAOS *taos) { "int, t2 binary(10))"); TAOS_STMT2_OPTION option = {0}; - TAOS_STMT2 *stmt = taos_stmt2_init(taos, &option); - const char *sql = "insert into db.stb(t1,t2,ts,b,tbname) values(?,?,?,?,?)"; + TAOS_STMT2 *stmt = taos_stmt2_init(taos, &option); + const char *sql = "insert into db.stb(t1,t2,ts,b,tbname) values(?,?,?,?,?)"; int code = taos_stmt2_prepare(stmt, sql, 0); if (code != 0) { @@ -35,19 +35,18 @@ void do_stmt(TAOS *taos) { return; } - int fieldNum = 0; - TAOS_FIELD_E *pFields = NULL; + int fieldNum = 0; + TAOS_FIELD_ALL *pFields = NULL; code = taos_stmt2_get_all_fields(stmt, &fieldNum, &pFields); if (code != 0) { printf("failed get col,ErrCode: 0x%x, ErrMessage: %s.\n", code, taos_stmt2_error(stmt)); } else { printf("col nums:%d\n", fieldNum); - for(int i = 0; i < fieldNum; i++) { - printf("field[%d]: %s,type:%d\n", i, pFields[i].name,pFields[i].field_type); + for (int i = 0; i < fieldNum; i++) { + printf("field[%d]: %s,type:%d\n", i, pFields[i].name, pFields[i].field_type); } } - taos_stmt2_close(stmt); } From a3d00ef5b576c1939d56a93b44c9212969f07980 Mon Sep 17 00:00:00 2001 From: yinheli Date: Wed, 8 May 2024 23:02:50 +0800 Subject: [PATCH 474/695] fix(typo): doc --- docs/en/03-intro.md | 2 +- docs/en/14-reference/03-taos-sql/31-compress.md | 4 ++-- docs/en/26-tdinternal/04-load-balance.md | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/en/03-intro.md b/docs/en/03-intro.md index 4e0089950a63..853e96704fc2 100644 --- a/docs/en/03-intro.md +++ b/docs/en/03-intro.md @@ -46,7 +46,7 @@ For more details on features, please read through the entire documentation. By making full use of [characteristics of time series data](https://tdengine.com/characteristics-of-time-series-data/), TDengine differentiates itself from other time series databases with the following advantages. -- **[High-Performance](https://tdengine.com/high-performance/)**: TDengine is the only time-series database to solve the high cardinality issue to support billions of data collection points while out performing other time-series databases for data ingestion, querying and data compression. +- **[High-Performance](https://tdengine.com/high-performance/)**: TDengine is the only time-series database to solve the high cardinality issue to support billions of data collection points while outperforming other time-series databases for data ingestion, querying and data compression. - **[Simplified Solution](https://tdengine.com/comprehensive-industrial-data-solution/)**: Through built-in caching, stream processing and data subscription features, TDengine provides a simplified solution for time-series data processing. It reduces system design complexity and operation costs significantly. diff --git a/docs/en/14-reference/03-taos-sql/31-compress.md b/docs/en/14-reference/03-taos-sql/31-compress.md index 10a06a4c91c5..39abfe69bd71 100644 --- a/docs/en/14-reference/03-taos-sql/31-compress.md +++ b/docs/en/14-reference/03-taos-sql/31-compress.md @@ -41,7 +41,7 @@ In this article, it specifically refers to the level within the secondary compre ### Create Table with Compression ```sql -CREATE [dbname.]tabname (colName colType [ENCODE 'encode_type'] [COMPRESS 'compress_type' [LEVEL 'level'], [, other cerate_definition]...]) +CREATE [dbname.]tabname (colName colType [ENCODE 'encode_type'] [COMPRESS 'compress_type' [LEVEL 'level'], [, other create_definition]...]) ``` **Parameter Description** @@ -58,7 +58,7 @@ CREATE [dbname.]tabname (colName colType [ENCODE 'encode_type'] [COMPRESS 'compr ### Change Compression Method ```sql -ALTER TABLE [db_name.]tabName MODIFY COLUMN colName [ENCODE 'ecode_type'] [COMPRESS 'compress_type'] [LEVEL "high"] +ALTER TABLE [db_name.]tabName MODIFY COLUMN colName [ENCODE 'encode_type'] [COMPRESS 'compress_type'] [LEVEL "high"] ``` **Parameter Description** diff --git a/docs/en/26-tdinternal/04-load-balance.md b/docs/en/26-tdinternal/04-load-balance.md index 474272c46d21..c7aca23cc9d2 100644 --- a/docs/en/26-tdinternal/04-load-balance.md +++ b/docs/en/26-tdinternal/04-load-balance.md @@ -4,7 +4,7 @@ sidebar_label: Load Balance description: This document describes how TDengine implements load balancing. --- -The load balance in TDengine is mainly about processing data series data. TDengine employes builtin hash algorithm to distribute all the tables, sub-tables and their data of a database across all the vgroups that belongs to the database. Each table or sub-table can only be handled by a single vgroup, while each vgroup can process multiple table or sub-table. +The load balance in TDengine is mainly about processing data series data. TDengine employs builtin hash algorithm to distribute all the tables, sub-tables and their data of a database across all the vgroups that belongs to the database. Each table or sub-table can only be handled by a single vgroup, while each vgroup can process multiple table or sub-table. The number of vgroup can be specified when creating a database, using the parameter `vgroups`. @@ -12,10 +12,10 @@ The number of vgroup can be specified when creating a database, using the parame create database db0 vgroups 100; ``` -The proper value of `vgroups` depends on available system resources. Assuming there is only one database to be created in the system, then the number of `vgroups` is determined by the available resources from all dnodes. In principle more vgroups can be created if you have more CPU and memory. Disk I/O is another important factor to consider. Once the bottleneck shows on disk I/O, more vgroups may downgrad the system performance significantly. If multiple databases are to be created in the system, then the total number of `vroups` of all the databases are dependent on the available system resources. It needs to be careful to distribute vgroups among these databases, you need to consider the number of tables, data writing frequency, size of each data row for all these databases. A recommended practice is to firstly choose a starting number for `vgroups`, for example double of the number of CPU cores, then try to adjust and optimize system configurations to find the best setting for `vgroups`, then distribute these vgroups among databases. +The proper value of `vgroups` depends on available system resources. Assuming there is only one database to be created in the system, then the number of `vgroups` is determined by the available resources from all dnodes. In principle more vgroups can be created if you have more CPU and memory. Disk I/O is another important factor to consider. Once the bottleneck shows on disk I/O, more vgroups may degrade the system performance significantly. If multiple databases are to be created in the system, then the total number of `vgroups` of all the databases are dependent on the available system resources. It needs to be careful to distribute vgroups among these databases, you need to consider the number of tables, data writing frequency, size of each data row for all these databases. A recommended practice is to firstly choose a starting number for `vgroups`, for example double of the number of CPU cores, then try to adjust and optimize system configurations to find the best setting for `vgroups`, then distribute these vgroups among databases. -Furthermode, TDengine distributes the vgroups of each database equally among all dnodes. In case of replica 3, the distribution is even more complex, TDengine tries its best to prevent any dnode from becoming a bottleneck. +Furthermore, TDengine distributes the vgroups of each database equally among all dnodes. In case of replica 3, the distribution is even more complex, TDengine tries its best to prevent any dnode from becoming a bottleneck. -TDegnine utilizes the above ways to achieve load balance in a cluster, and finally achieve higher throughput. +TDengine utilizes the above ways to achieve load balance in a cluster, and finally achieve higher throughput. Once the load balance is achieved, after some operations like deleting tables or dropping databases, the load across all dnodes may become imbalanced, the method of rebalance will be provided in later versions. However, even without explicit rebalancing, TDengine will try its best to achieve new balance without manual interfering when a new database is created. From 7d05ccbfa03ea43055e507cc01fe4831e9566b7c Mon Sep 17 00:00:00 2001 From: Jing Sima Date: Tue, 29 Oct 2024 11:13:50 +0800 Subject: [PATCH 475/695] fix:[TS-5567] fix bug when partition/group by const value's alias name. --- source/libs/parser/src/parTranslater.c | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 7b1896d6a9ff..1faa010663d1 100755 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -1607,26 +1607,6 @@ static EDealRes translateColumnUseAlias(STranslateContext* pCxt, SColumnNode** p } } if (*pFound) { - if (QUERY_NODE_FUNCTION == nodeType(pFoundNode) && - (SQL_CLAUSE_GROUP_BY == pCxt->currClause || SQL_CLAUSE_PARTITION_BY == pCxt->currClause)) { - pCxt->errCode = getFuncInfo(pCxt, (SFunctionNode*)pFoundNode); - if (TSDB_CODE_SUCCESS == pCxt->errCode) { - if (fmIsVectorFunc(((SFunctionNode*)pFoundNode)->funcId)) { - pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_ILLEGAL_USE_AGG_FUNCTION, (*pCol)->colName); - return DEAL_RES_ERROR; - } else if (fmIsPseudoColumnFunc(((SFunctionNode*)pFoundNode)->funcId)) { - if ('\0' != (*pCol)->tableAlias[0]) { - return translateColumnWithPrefix(pCxt, pCol); - } else { - return translateColumnWithoutPrefix(pCxt, pCol); - } - } else { - /* Do nothing and replace old node with found node. */ - } - } else { - return DEAL_RES_ERROR; - } - } SNode* pNew = NULL; int32_t code = nodesCloneNode(pFoundNode, &pNew); if (NULL == pNew) { @@ -5496,8 +5476,7 @@ static EDealRes translateGroupPartitionByImpl(SNode** pNode, void* pContext) { int32_t code = TSDB_CODE_SUCCESS; STranslateContext* pTransCxt = pCxt->pTranslateCxt; if (QUERY_NODE_VALUE == nodeType(*pNode)) { - STranslateContext* pTransCxt = pCxt->pTranslateCxt; - SValueNode* pVal = (SValueNode*)*pNode; + SValueNode* pVal = (SValueNode*) *pNode; if (DEAL_RES_ERROR == translateValue(pTransCxt, pVal)) { return DEAL_RES_CONTINUE; } @@ -5506,7 +5485,7 @@ static EDealRes translateGroupPartitionByImpl(SNode** pNode, void* pContext) { } int32_t pos = getPositionValue(pVal); if (0 < pos && pos <= LIST_LENGTH(pProjectionList)) { - SNode* pNew = NULL; + SNode* pNew = NULL; code = nodesCloneNode(nodesListGetNode(pProjectionList, pos - 1), (SNode**)&pNew); if (TSDB_CODE_SUCCESS != code) { pCxt->pTranslateCxt->errCode = code; From dd217cef88feba24db4259ed73d80af52e99df95 Mon Sep 17 00:00:00 2001 From: yinheli Date: Thu, 9 May 2024 10:29:04 +0800 Subject: [PATCH 476/695] chore(fix/doc): REST API table formatting --- docs/en/14-reference/05-connectors/60-rest-api.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/14-reference/05-connectors/60-rest-api.mdx b/docs/en/14-reference/05-connectors/60-rest-api.mdx index 2c3cd21f414e..a29751e951a5 100644 --- a/docs/en/14-reference/05-connectors/60-rest-api.mdx +++ b/docs/en/14-reference/05-connectors/60-rest-api.mdx @@ -125,7 +125,7 @@ where `TOKEN` is the string after Base64 encoding of `{username}:{password}`, e. Starting from `TDengine 3.0.3.0`, `taosAdapter` provides a configuration parameter `httpCodeServerError` to set whether to return a non-200 http status code when the C interface returns an error | **Description** | **httpCodeServerError false** | **httpCodeServerError true** | -|--------------------|---------------------------- ------|---------------------------------------| +|--------------------|----------------------------------|---------------------------------------| | taos_errno() returns 0 | 200 | 200 | | taos_errno() returns non-0 | 200 (except authentication error) | 500 (except authentication error and 400/502 error) | | Parameter error | 400 (only handle HTTP request URL parameter error) | 400 (handle HTTP request URL parameter error and taosd return error) | From edfefbff77bd71368eba6bad8e530cae26765c12 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Wed, 30 Oct 2024 19:07:47 +0800 Subject: [PATCH 477/695] fix: value node clone issue --- include/common/ttypes.h | 16 ++++++++++++---- source/libs/nodes/src/nodesCloneFuncs.c | 2 +- source/libs/parser/inc/parInt.h | 2 ++ source/libs/parser/src/parTranslater.c | 24 ++++++++++++++---------- source/libs/scalar/src/sclvector.c | 4 ++-- 5 files changed, 31 insertions(+), 17 deletions(-) diff --git a/include/common/ttypes.h b/include/common/ttypes.h index 3934553b1c06..76c59f37bb6e 100644 --- a/include/common/ttypes.h +++ b/include/common/ttypes.h @@ -238,12 +238,20 @@ typedef struct { case TSDB_DATA_TYPE_UBIGINT: \ snprintf(_output, (int32_t)(_outputBytes), "%" PRIu64, *(uint64_t *)(_input)); \ break; \ - case TSDB_DATA_TYPE_FLOAT: \ - snprintf(_output, (int32_t)(_outputBytes), "%f", *(float *)(_input)); \ + case TSDB_DATA_TYPE_FLOAT: { \ + int32_t n = snprintf(_output, (int32_t)(_outputBytes), "%f", *(float *)(_input)); \ + if (n >= (_outputBytes)) { \ + snprintf(_output, (int32_t)(_outputBytes), "%*.7f", (_outputBytes) - 1, *(float *)(_input)); \ + } \ break; \ - case TSDB_DATA_TYPE_DOUBLE: \ - snprintf(_output, (int32_t)(_outputBytes), "%f", *(double *)(_input)); \ + } \ + case TSDB_DATA_TYPE_DOUBLE: { \ + int32_t n = snprintf(_output, (int32_t)(_outputBytes), "%f", *(double *)(_input)); \ + if (n >= (_outputBytes)) { \ + snprintf(_output, (int32_t)(_outputBytes), "%*.7f", (_outputBytes) - 1, *(double *)(_input)); \ + } \ break; \ + } \ case TSDB_DATA_TYPE_UINT: \ snprintf(_output, (int32_t)(_outputBytes), "%u", *(uint32_t *)(_input)); \ break; \ diff --git a/source/libs/nodes/src/nodesCloneFuncs.c b/source/libs/nodes/src/nodesCloneFuncs.c index b2b06e6beab9..8731199a5b7a 100644 --- a/source/libs/nodes/src/nodesCloneFuncs.c +++ b/source/libs/nodes/src/nodesCloneFuncs.c @@ -175,7 +175,7 @@ static int32_t valueNodeCopy(const SValueNode* pSrc, SValueNode* pDst) { case TSDB_DATA_TYPE_VARCHAR: case TSDB_DATA_TYPE_VARBINARY: case TSDB_DATA_TYPE_GEOMETRY: { - int32_t len = pSrc->node.resType.bytes + 1; + int32_t len = varDataTLen(pSrc->datum.p); pDst->datum.p = taosMemoryCalloc(1, len); if (NULL == pDst->datum.p) { return terrno; diff --git a/source/libs/parser/inc/parInt.h b/source/libs/parser/inc/parInt.h index c231de653c9f..5999ada70f16 100644 --- a/source/libs/parser/inc/parInt.h +++ b/source/libs/parser/inc/parInt.h @@ -28,6 +28,8 @@ extern "C" { #define QUERY_SMA_OPTIMIZE_DISABLE 0 #define QUERY_SMA_OPTIMIZE_ENABLE 1 +#define QUERY_NUMBER_MAX_DISPLAY_LEN 65 + int32_t parseInsertSql(SParseContext* pCxt, SQuery** pQuery, SCatalogReq* pCatalogReq, const SMetaData* pMetaData); int32_t continueCreateTbFromFile(SParseContext* pCxt, SQuery** pQuery); int32_t parse(SParseContext* pParseCxt, SQuery** pQuery); diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 26151230d3f9..5636c4bdad8e 100755 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -3297,7 +3297,7 @@ extern int8_t gDisplyTypes[TSDB_DATA_TYPE_MAX][TSDB_DATA_TYPE_MAX]; static int32_t selectCommonType(SDataType* commonType, const SDataType* newType) { if (commonType->type < TSDB_DATA_TYPE_NULL || commonType->type >= TSDB_DATA_TYPE_MAX || newType->type < TSDB_DATA_TYPE_NULL || newType->type >= TSDB_DATA_TYPE_MAX) { - return TSDB_CODE_INVALID_PARA; + return TSDB_CODE_INVALID_PARA; } int8_t type1 = commonType->type; int8_t type2 = newType->type; @@ -3307,23 +3307,27 @@ static int32_t selectCommonType(SDataType* commonType, const SDataType* newType) } else { resultType = gDisplyTypes[type2][type1]; } + if (resultType == -1) { - return TSDB_CODE_SCALAR_CONVERT_ERROR; + return TSDB_CODE_SCALAR_CONVERT_ERROR; } + if (commonType->type == newType->type) { commonType->bytes = TMAX(commonType->bytes, newType->bytes); return TSDB_CODE_SUCCESS; } - commonType->bytes = TMAX(TMAX(commonType->bytes, newType->bytes), TYPE_BYTES[resultType]); - if((resultType == TSDB_DATA_TYPE_VARCHAR || resultType == TSDB_DATA_TYPE_NCHAR) && ( - (IS_FLOAT_TYPE(commonType->type) || IS_FLOAT_TYPE(newType->type)) || - (IS_NUMERIC_TYPE(commonType->type) || IS_NUMERIC_TYPE(newType->type)))) - { - commonType->bytes = TMAX(commonType->bytes, 32); - } + + if ((resultType == TSDB_DATA_TYPE_VARCHAR) && (IS_MATHABLE_TYPE(commonType->type) || IS_MATHABLE_TYPE(newType->type))) { + commonType->bytes = TMAX(TMAX(commonType->bytes, newType->bytes), QUERY_NUMBER_MAX_DISPLAY_LEN); + } else if ((resultType == TSDB_DATA_TYPE_NCHAR) && (IS_MATHABLE_TYPE(commonType->type) || IS_MATHABLE_TYPE(newType->type))) { + commonType->bytes = TMAX(TMAX(commonType->bytes, newType->bytes), QUERY_NUMBER_MAX_DISPLAY_LEN * TSDB_NCHAR_SIZE); + } else { + commonType->bytes = TMAX(TMAX(commonType->bytes, newType->bytes), TYPE_BYTES[resultType]); + } + commonType->type = resultType; + return TSDB_CODE_SUCCESS; - } static EDealRes translateCaseWhen(STranslateContext* pCxt, SCaseWhenNode* pCaseWhen) { diff --git a/source/libs/scalar/src/sclvector.c b/source/libs/scalar/src/sclvector.c index 2fb37e34bf5e..8db0562c631a 100644 --- a/source/libs/scalar/src/sclvector.c +++ b/source/libs/scalar/src/sclvector.c @@ -1031,7 +1031,7 @@ int8_t gConvertTypes[TSDB_DATA_TYPE_MAX][TSDB_DATA_TYPE_MAX] = { /*GEOM*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0}; int8_t gDisplyTypes[TSDB_DATA_TYPE_MAX][TSDB_DATA_TYPE_MAX] = { - /*NULL BOOL TINY SMAL INT BIGI FLOA DOUB VARC TIME NCHA UTINY USMA UINT UBIG JSON VARB DECI BLOB MEDB GEOM*/ + /*NULL BOOL TINY SMAL INT BIGI FLOA DOUB VARC TIM NCHA UTIN USMA UINT UBIG JSON VARB DECI BLOB MEDB GEOM*/ /*NULL*/ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, -1, -1, -1, 20, /*BOOL*/ 0, 1, 2, 3, 4, 5, 6, 7, 8, 5, 10, 11, 12, 13, 14, -1, -1, -1, -1, -1, -1, /*TINY*/ 0, 0, 2, 3, 4, 5, 8, 8, 8, 5, 10, 3, 4, 5, 8, -1, -1, -1, -1, -1, -1, @@ -1047,7 +1047,7 @@ int8_t gDisplyTypes[TSDB_DATA_TYPE_MAX][TSDB_DATA_TYPE_MAX] = { /*USMA*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 13, 14, -1, -1, -1, -1, -1, -1, /*UINT*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 14, -1, -1, -1, -1, -1, -1, /*UBIG*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, -1, -1, -1, -1, -1, -1, - /*JSON*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, + /*JSON*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, -1, -1, -1, -1, -1, /*VARB*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, -1, -1, -1, -1, /*DECI*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, /*BLOB*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, From eee6779e82c59cc89afd1d801e94c9048863465a Mon Sep 17 00:00:00 2001 From: iceman Date: Wed, 29 May 2024 10:17:30 +0800 Subject: [PATCH 478/695] Update index.md --- docs/zh/14-reference/05-connector/index.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/zh/14-reference/05-connector/index.md b/docs/zh/14-reference/05-connector/index.md index bd2cff6a3d2f..4142d111e019 100644 --- a/docs/zh/14-reference/05-connector/index.md +++ b/docs/zh/14-reference/05-connector/index.md @@ -34,8 +34,8 @@ TDengine 版本更新往往会增加新的功能特性,列表中的连接器 | **3.0.0.0 及以上** | 3.0.2以上 | 当前版本 | 3.0 分支 | 3.0.0 | 3.1.0 | 当前版本 | 与 TDengine 相同版本 | | **2.4.0.14 及以上** | 2.0.38 | 当前版本 | develop 分支 | 1.0.2 - 1.0.6 | 2.0.10 - 2.0.12 | 当前版本 | 与 TDengine 相同版本 | | **2.4.0.4 - 2.4.0.13** | 2.0.37 | 当前版本 | develop 分支 | 1.0.2 - 1.0.6 | 2.0.10 - 2.0.12 | 当前版本 | 与 TDengine 相同版本 | -| **2.2.x.x ** | 2.0.36 | 当前版本 | master 分支 | n/a | 2.0.7 - 2.0.9 | 当前版本 | 与 TDengine 相同版本 | -| **2.0.x.x ** | 2.0.34 | 当前版本 | master 分支 | n/a | 2.0.1 - 2.0.6 | 当前版本 | 与 TDengine 相同版本 | +| **2.2.x.x** | 2.0.36 | 当前版本 | master 分支 | n/a | 2.0.7 - 2.0.9 | 当前版本 | 与 TDengine 相同版本 | +| **2.0.x.x** | 2.0.34 | 当前版本 | master 分支 | n/a | 2.0.1 - 2.0.6 | 当前版本 | 与 TDengine 相同版本 | ## 功能特性 From cfbf4c29179c1d103a2c72e58da00334d195a983 Mon Sep 17 00:00:00 2001 From: Zack Litzsinger Date: Fri, 7 Jun 2024 10:20:57 -0400 Subject: [PATCH 479/695] Fix typo in docs for derivative function time_inerval -> time_interval --- docs/en/14-reference/03-taos-sql/10-function.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/14-reference/03-taos-sql/10-function.md b/docs/en/14-reference/03-taos-sql/10-function.md index 2ba3c416fdfe..d2efd668b001 100644 --- a/docs/en/14-reference/03-taos-sql/10-function.md +++ b/docs/en/14-reference/03-taos-sql/10-function.md @@ -1187,7 +1187,7 @@ CSUM(expr) ### DERIVATIVE ```sql -DERIVATIVE(expr, time_inerval, ignore_negative) +DERIVATIVE(expr, time_interval, ignore_negative) ignore_negative: { 0 From 8db0eddc868f184a927caeddb699844f88ab9366 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Wed, 30 Oct 2024 19:31:19 +0800 Subject: [PATCH 480/695] Update index.md --- docs/zh/06-advanced/06-data-analysis/index.md | 63 ++++++++++++------- 1 file changed, 40 insertions(+), 23 deletions(-) diff --git a/docs/zh/06-advanced/06-data-analysis/index.md b/docs/zh/06-advanced/06-data-analysis/index.md index 3281045320df..d192899c4016 100644 --- a/docs/zh/06-advanced/06-data-analysis/index.md +++ b/docs/zh/06-advanced/06-data-analysis/index.md @@ -134,30 +134,31 @@ log-level = DEBUG ## ANode 基本操作 ### 管理 ANode -创建 ANode 的 SQL 语法如下: +#### 创建 ANode ```sql CREATE ANODE {node_url} ``` node_url 是提供服务的 ANode 的 IP 和 PORT, 例如:`create anode 'http://localhost:6050'`。启动 ANode 以后如果不注册到 TDengine 集群中,无法提供正常的服务。不建议 ANode 注册到两个或多个集群中。 -查看 ANode +#### 查看 ANode 列出集群中所有的数据分析节点,包括其 `FQDN`, `PORT`, `STATUS`。 ```sql SHOW ANODES; ``` -查看当前 ANode 提供的时序数据分析服务列表 + +#### 查看提供的时序数据分析服务 ```SQL SHOW ANODES FULL; ``` -强制刷新 TDengine 集群中分析算法缓存 +#### 强制刷新 TDengine 集群中分析算法缓存 ```SQL UPDATE ANODE {node_id} UPDATE ALL ANODES ``` -删除集群中的 ANode 语法如下: +#### 删除 ANode ```sql DROP ANODE {anode_id} ``` @@ -166,18 +167,21 @@ DROP ANODE {anode_id} ### 时序数据分析功能 #### 时序数据异常检测 -异常窗口寻找时间序列中可能出现异常的多个时间区间,可基于此窗口边界,对数据进行聚合或标量查询。 +异常窗口寻找时间序列中可能出现异常的多个时间区间,可基于此窗口边界,对数据进行聚合或标量查询。 时间序列异常窗口中的所有数据均是依据指定算法判断出来的异常值。 ```SQL -SELECT {aggregate_function} -FROM {subquery} -WHERE {filer_condition} -ANOMALY_WINDOW(column, options) +ANOMALY_WINDOW(column_name, option_expr) + +option_expr: {" +algo=expr1 +[,wncheck=1|0] +[,expr2] +"} ``` **语法说明** 1. `column`:进行时序数据异常检测的输入数据列,当前只支持单列输入,且只能是数值类型,不能是字符类型(例如:`NCHAR` `VARCHAR` `VARBINARY`等类型),**不支持函数表达式**。 -2. `options`:调用异常检测的算法,及与算法相关的参数。采用 逗号分隔的K/V字符串表示,其中的字符串不需要使用单引号、双引号、或转意号等符号,不能使用中文及其他宽字符。例如:`algo=ksigma, k=2` 表示进行异常检测的算法是 ksigma,该算法接受的输入参数是 2。 +2. `options`:字符串。其中使用 K/V 调用异常检测的算法,及与算法相关的参数。采用 逗号分隔的K/V字符串表示,其中的字符串不需要使用单引号、双引号、或转意号等符号,不能使用中文及其他宽字符。例如:`algo=ksigma, k=2` 表示进行异常检测的算法是 ksigma,该算法接受的输入参数是 2。 全部支持的参数列表如下: |参数|含义|默认值| @@ -192,7 +196,6 @@ ANOMALY_WINDOW(column, options) **示例** ```SQL - --- 使用 iqr 算法进行异常检测,检测列 i32 列。 SELECT _wstart, _wend, SUM(i32) FROM ai.atb @@ -200,25 +203,36 @@ ANOMALY_WINDOW(i32, "algo=iqr"); --- 使用 ksigma 算法进行异常检测,输入参数 k 值为 2,检测列 i32 列 SELECT _wstart, _wend, SUM(i32) -FROM ai.atb ANOMALY_WINDOW(i32, "algo=ksigma,k=2"); +FROM ai.atb +ANOMALY_WINDOW(i32, "algo=ksigma,k=2"); ``` **使用说明** -1. 异常检测的结果可以作为外层查询的子查询输入,在 `select` 子句中使用的聚合函数或标量函数与其他类型的窗口查询相同。 +1. 异常检测的结果可以作为外层查询的子查询输入,在 `SELECT` 子句中使用的聚合函数或标量函数与其他类型的窗口查询相同。 2. 输入数据默认进行白噪声检查,如果检查结果是输入数据是白噪声,将不会有任何(异常)窗口信息返回。 #### 时序数据预测 数据预测以一段训练数据作为输入,预测接下来若干时间点的后续运行结果。其调用的语法如下: ```SQL -SELECT {pseudo_column}, forecast(column, options) FROM {subquery} WHERE [where_clause] +FORECAST(column_expr, option_expr) + +option_expr: {" +algo=expr1 +[,wncheck=1|0] +[,conf=conf_val] +[,every=every_val] +[,rows=rows_val] +[,start=start_ts_val] +[,expr2] +"} + ``` **语法说明** -1. `forecast`:关键字 -2. `column`:预测的时序数据列。与异常检测相同,只支持数值类型输入。 -3. `options`:异常检测函数的参数,使用规则与 anomaly_window 相同 +1. `column_expr`:预测的时序数据列。与异常检测相同,只支持数值类型输入。 +2. `options`:异常检测函数的参数,使用规则与 anomaly_window 相同。预测还支持`conf`, `every`, `rows`, `start`, `rows` 几个参数,其含义如下: |参数|含义|默认值| |---|---|---| @@ -232,18 +246,21 @@ SELECT {pseudo_column}, forecast(column, options) FROM {subquery} WHERE [where_c 预测查询结果新增了三个伪列,具体如下: 1. `_FROWTS`:预测结果的时间戳 2. `_FLOW`:置信区间下界 -3. `_FHIGH`:置信区间上界。对于没有置信区间的预测算法,其置信区间同预测结果。 +3. `_FHIGH`:置信区间上界, 对于没有置信区间的预测算法,其置信区间同预测结果 **示例** ```SQL --- 使用 arima 算法进行预测,预测结果是 10 条记录(默认值),数据进行白噪声检查,默认置信区间 95%. -select _flow, _fhigh, _frowts, forecast(i32, "algo=arima") from ai.ftb; +SELECT _flow, _fhigh, _frowts, FORECAST(i32, "algo=arima") +FROM ai.ftb; --- 使用 arima 算法进行预测,输入数据的是周期数据,每10个采样点是一个周期。返回置信区间是 95%. -select _flow, _fhigh, _frowts, forecast(i32, "algo=arima,alpha=95,period=10") from ai.ftb; +SELECT _flow, _fhigh, _frowts, FORECAST(i32, "algo=arima,alpha=95,period=10") +FROM ai.ftb; ``` + **使用说明** -1. `start`:返回预测结果的起始时间,改变这个起始时间不会影响返回的预测数值,只影响起始时间。 -2. `every`:可以与输入数据的采样频率不同。采样频率只能低于或等于输入数据采样频率,不能高于输入数据的采样频率。 +1. `START`:返回预测结果的起始时间,改变这个起始时间不会影响返回的预测数值,只影响起始时间。 +2. `EVERY`:可以与输入数据的采样频率不同。采样频率只能低于或等于输入数据采样频率,不能**高于**输入数据的采样频率。 3. 对于某些不需要计算置信区间的算法,即使指定了置信区间,返回的结果中其上下界退化成为一个点。 From 7a6d197418f77bb5b72536b80d394f6863d86a02 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Wed, 30 Oct 2024 19:32:06 +0800 Subject: [PATCH 481/695] Update index.md --- docs/zh/06-advanced/06-data-analysis/index.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/zh/06-advanced/06-data-analysis/index.md b/docs/zh/06-advanced/06-data-analysis/index.md index d192899c4016..e0e100d02f69 100644 --- a/docs/zh/06-advanced/06-data-analysis/index.md +++ b/docs/zh/06-advanced/06-data-analysis/index.md @@ -41,12 +41,12 @@ systemctl status taosanoded ## 目录及配置说明 |目录/文件|说明| |---------------|------| -|/usr/local/taos/taosanode/bin|Anode 的可执行文件目录| -|/usr/local/taos/taosanode/resource|Anode 的资源文件目录,连接到文件夹 /var/lib/taos/taosanode/resource/| -|/usr/local/taos/taosanode/lib|Anode 库文件目录| -|/var/lib/taos/taosanode/model/|Anode 的模型文件目录,链接到文件夹 /var/lib/taos/taosanode/model| -|/var/log/taos/taosanode/|Anode 的日志文件目录| -|/etc/taos/taosanode.ini|Anode 的配置文件| +|/usr/local/taos/taosanode/bin|可执行文件目录| +|/usr/local/taos/taosanode/resource|资源文件目录,连接到文件夹 /var/lib/taos/taosanode/resource/| +|/usr/local/taos/taosanode/lib|库文件目录| +|/var/lib/taos/taosanode/model/|模型文件目录,链接到文件夹 /var/lib/taos/taosanode/model| +|/var/log/taos/taosanode/|日志文件目录| +|/etc/taos/taosanode.ini|配置文件| ### 配置说明 From ba9c796c9dbb2144ce84fb3eb15c66d7182e44b5 Mon Sep 17 00:00:00 2001 From: dmchen Date: Wed, 30 Oct 2024 11:33:00 +0000 Subject: [PATCH 482/695] fix/TD-32703-add-wal-log --- source/libs/wal/src/walMeta.c | 6 ++++-- tests/system-test/7-tmq/tmqVnodeTransform-stb-removewal.py | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/source/libs/wal/src/walMeta.c b/source/libs/wal/src/walMeta.c index d9666eb02f58..3c396f0599d3 100644 --- a/source/libs/wal/src/walMeta.c +++ b/source/libs/wal/src/walMeta.c @@ -1058,6 +1058,8 @@ int32_t walSaveMeta(SWal* pWal) { TAOS_CHECK_GOTO(TAOS_SYSTEM_ERROR(errno), &lino, _err); } + wInfo("vgId:%d, save meta file: %s, firstVer:%" PRId64 ", lastVer:%" PRId64, pWal->cfg.vgId, tmpFnameStr, + pWal->vers.firstVer, pWal->vers.lastVer); // rename it n = walBuildMetaName(pWal, metaVer + 1, fnameStr); @@ -1155,8 +1157,8 @@ int32_t walLoadMeta(SWal* pWal) { (void)taosCloseFile(&pFile); taosMemoryFree(buf); - wInfo("vgId:%d, load meta file: %s, fileInfoSet size:%d", pWal->cfg.vgId, fnameStr, - (int32_t)taosArrayGetSize(pWal->fileInfoSet)); + wInfo("vgId:%d, load meta file: %s, firstVer:%" PRId64 ", lastVer:%" PRId64 ", fileInfoSet size:%d", pWal->cfg.vgId, + fnameStr, pWal->vers.firstVer, pWal->vers.lastVer, (int32_t)taosArrayGetSize(pWal->fileInfoSet)); printFileSet(pWal->fileInfoSet); TAOS_RETURN(code); diff --git a/tests/system-test/7-tmq/tmqVnodeTransform-stb-removewal.py b/tests/system-test/7-tmq/tmqVnodeTransform-stb-removewal.py index 938dcfcc9e28..e0632686d4f9 100644 --- a/tests/system-test/7-tmq/tmqVnodeTransform-stb-removewal.py +++ b/tests/system-test/7-tmq/tmqVnodeTransform-stb-removewal.py @@ -18,7 +18,7 @@ class TDTestCase: - updatecfgDict = {'sDebugFlag':143} + updatecfgDict = {'sDebugFlag':143, 'wDebugFlag':143} def __init__(self): self.vgroups = 1 self.ctbNum = 10 From cf806e0297ca8b971465436c8a9b741d0c2f798e Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Wed, 30 Oct 2024 19:37:35 +0800 Subject: [PATCH 483/695] Update index.md --- docs/zh/06-advanced/06-data-analysis/index.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/docs/zh/06-advanced/06-data-analysis/index.md b/docs/zh/06-advanced/06-data-analysis/index.md index e0e100d02f69..1ab36d41784d 100644 --- a/docs/zh/06-advanced/06-data-analysis/index.md +++ b/docs/zh/06-advanced/06-data-analysis/index.md @@ -42,7 +42,7 @@ systemctl status taosanoded |目录/文件|说明| |---------------|------| |/usr/local/taos/taosanode/bin|可执行文件目录| -|/usr/local/taos/taosanode/resource|资源文件目录,连接到文件夹 /var/lib/taos/taosanode/resource/| +|/usr/local/taos/taosanode/resource|资源文件目录,链接到文件夹 /var/lib/taos/taosanode/resource/| |/usr/local/taos/taosanode/lib|库文件目录| |/var/lib/taos/taosanode/model/|模型文件目录,链接到文件夹 /var/lib/taos/taosanode/model| |/var/log/taos/taosanode/|日志文件目录| @@ -212,6 +212,14 @@ ANOMALY_WINDOW(i32, "algo=ksigma,k=2"); 1. 异常检测的结果可以作为外层查询的子查询输入,在 `SELECT` 子句中使用的聚合函数或标量函数与其他类型的窗口查询相同。 2. 输入数据默认进行白噪声检查,如果检查结果是输入数据是白噪声,将不会有任何(异常)窗口信息返回。 +**当前支持异常检测算法** +- iqr +- ksigma +- grubbs +- lof +- shesd +- tac + #### 时序数据预测 数据预测以一段训练数据作为输入,预测接下来若干时间点的后续运行结果。其调用的语法如下: @@ -264,3 +272,7 @@ FROM ai.ftb; 1. `START`:返回预测结果的起始时间,改变这个起始时间不会影响返回的预测数值,只影响起始时间。 2. `EVERY`:可以与输入数据的采样频率不同。采样频率只能低于或等于输入数据采样频率,不能**高于**输入数据的采样频率。 3. 对于某些不需要计算置信区间的算法,即使指定了置信区间,返回的结果中其上下界退化成为一个点。 + +**支持预测算法** +- arima +- holtwinters From 73be7ddbc68ef247ff293af7506113d027fe402c Mon Sep 17 00:00:00 2001 From: xsren <285808407@qq.com> Date: Wed, 30 Oct 2024 19:38:08 +0800 Subject: [PATCH 484/695] fix: set tablefield of stream block to NULL --- source/dnode/vnode/src/tq/tqUtil.c | 3 +++ source/libs/executor/src/scanoperator.c | 13 ++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/source/dnode/vnode/src/tq/tqUtil.c b/source/dnode/vnode/src/tq/tqUtil.c index b4866b8c653c..1edc3d42ab30 100644 --- a/source/dnode/vnode/src/tq/tqUtil.c +++ b/source/dnode/vnode/src/tq/tqUtil.c @@ -626,6 +626,9 @@ int32_t tqExtractDelDataBlock(const void* pData, int32_t len, int64_t ver, void* tmp = taosArrayGet(pDelBlock->pDataBlock, CALCULATE_END_TS_COLUMN_INDEX); TSDB_CHECK_NULL(tmp, code, line, END, terrno) colDataSetNULL(tmp, i); + tmp = taosArrayGet(pDelBlock->pDataBlock, TABLE_NAME_COLUMN_INDEX); + TSDB_CHECK_NULL(tmp, code, line, END, terrno) + colDataSetNULL(tmp, i); } if (type == 0) { diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index f936e9500509..918be0465f32 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -2115,6 +2115,7 @@ static int32_t generateSessionScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSr SColumnInfoData* pDestGpCol = taosArrayGet(pDestBlock->pDataBlock, GROUPID_COLUMN_INDEX); SColumnInfoData* pDestCalStartTsCol = taosArrayGet(pDestBlock->pDataBlock, CALCULATE_START_TS_COLUMN_INDEX); SColumnInfoData* pDestCalEndTsCol = taosArrayGet(pDestBlock->pDataBlock, CALCULATE_END_TS_COLUMN_INDEX); + SColumnInfoData* pDestTableNameInxCol = taosArrayGet(pDestBlock->pDataBlock, TABLE_NAME_COLUMN_INDEX); for (int32_t i = 0; i < pSrcBlock->info.rows; i++) { uint64_t groupId = pSrcGp[i]; if (groupId == 0) { @@ -2152,7 +2153,7 @@ static int32_t generateSessionScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSr QUERY_CHECK_CODE(code, lino, _end); colDataSetNULL(pDestCalStartTsCol, i); - colDataSetNULL(pDestCalEndTsCol, i); + colDataSetNULL(pDestTableNameInxCol, i); pDestBlock->info.rows++; } @@ -2205,6 +2206,7 @@ static int32_t generateCountScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSrcB SColumnInfoData* pDestGpCol = taosArrayGet(pDestBlock->pDataBlock, GROUPID_COLUMN_INDEX); SColumnInfoData* pDestCalStartTsCol = taosArrayGet(pDestBlock->pDataBlock, CALCULATE_START_TS_COLUMN_INDEX); SColumnInfoData* pDestCalEndTsCol = taosArrayGet(pDestBlock->pDataBlock, CALCULATE_END_TS_COLUMN_INDEX); + SColumnInfoData* pDestTableNameInxCol = taosArrayGet(pDestBlock->pDataBlock, TABLE_NAME_COLUMN_INDEX); for (int32_t i = 0; i < pSrcBlock->info.rows; i++) { uint64_t groupId = pSrcGp[i]; if (groupId == 0) { @@ -2233,6 +2235,8 @@ static int32_t generateCountScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSrcB code = colDataSetVal(pDestCalEndTsCol, i, (const char*)&range.win.ekey, false); QUERY_CHECK_CODE(code, lino, _end); + colDataSetNULL(pDestTableNameInxCol, i); + pDestBlock->info.rows++; } @@ -2287,6 +2291,7 @@ static int32_t generateIntervalScanRange(SStreamScanInfo* pInfo, SSDataBlock* pS SColumnInfoData* pGpCol = taosArrayGet(pDestBlock->pDataBlock, GROUPID_COLUMN_INDEX); SColumnInfoData* pCalStartTsCol = taosArrayGet(pDestBlock->pDataBlock, CALCULATE_START_TS_COLUMN_INDEX); SColumnInfoData* pCalEndTsCol = taosArrayGet(pDestBlock->pDataBlock, CALCULATE_END_TS_COLUMN_INDEX); + SColumnInfoData* pDestTableNameInxCol = taosArrayGet(pDestBlock->pDataBlock, TABLE_NAME_COLUMN_INDEX); for (int32_t i = 0; i < pSrcBlock->info.rows;) { uint64_t srcUid = srcUidData[i]; uint64_t groupId = srcGp[i]; @@ -2319,6 +2324,8 @@ static int32_t generateIntervalScanRange(SStreamScanInfo* pInfo, SSDataBlock* pS code = colDataSetVal(pGpCol, pDestBlock->info.rows, (const char*)(&groupId), false); QUERY_CHECK_CODE(code, lino, _end); + colDataSetNULL(pDestTableNameInxCol, pDestBlock->info.rows); + pDestBlock->info.rows++; } @@ -3074,6 +3081,7 @@ static int32_t filterDelBlockByUid(SSDataBlock* pDst, const SSDataBlock* pSrc, S colDataSetNULL(taosArrayGet(pDst->pDataBlock, GROUPID_COLUMN_INDEX), j); colDataSetNULL(taosArrayGet(pDst->pDataBlock, CALCULATE_START_TS_COLUMN_INDEX), j); colDataSetNULL(taosArrayGet(pDst->pDataBlock, CALCULATE_END_TS_COLUMN_INDEX), j); + colDataSetNULL(taosArrayGet(pDst->pDataBlock, TABLE_NAME_COLUMN_INDEX), j); j++; } } @@ -3670,6 +3678,9 @@ static int32_t doStreamScanNext(SOperatorInfo* pOperator, SSDataBlock** ppRes) { // printDataBlock(pInfo->pCheckpointRes, "stream scan ck", GET_TASKID(pTaskInfo)); (*ppRes) = pInfo->pCheckpointRes; return code; + } else { + qError("stream scan error, invalid block type %d, %s", pInfo->blockType, id); + code = TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR; } _end: From 23cd94c3564bd6746e6b3d25c8d7fbab0a3fee42 Mon Sep 17 00:00:00 2001 From: Yaming Pei Date: Wed, 30 Oct 2024 19:38:31 +0800 Subject: [PATCH 485/695] docs: modify the taosBenchmark documentation for the float min problem --- docs/en/14-reference/01-components/10-taosbenchmark | 3 +++ docs/zh/14-reference/02-tools/10-taosbenchmark.md | 2 ++ 2 files changed, 5 insertions(+) diff --git a/docs/en/14-reference/01-components/10-taosbenchmark b/docs/en/14-reference/01-components/10-taosbenchmark index e4884b889c95..45c5cd2fb8b0 100644 --- a/docs/en/14-reference/01-components/10-taosbenchmark +++ b/docs/en/14-reference/01-components/10-taosbenchmark @@ -364,6 +364,9 @@ The configuration parameters for specifying super table tag columns and data col - **min**: The minimum value of the column/label of the data type. The generated value will equal or large than the minimum value. - **max**: The maximum value of the column/label of the data type. The generated value will less than the maximum value. + +- **scalingFactor**: Floating-point precision enhancement factor, which takes effect only when the data type is float/double. It has a valid range of positive integers from 1 to 1,000,000. It is used to enhance the precision of generated floating-point numbers, particularly when the min or max values are small. This property enhances the precision after the decimal point by powers of 10: scalingFactor of 10 indicates an enhancement of 1 decimal precision, 100 indicates an enhancement of 2 decimal precision, and so on. + - **fun**: This column of data is filled with functions. Currently, only the sin and cos functions are supported. The input parameter is the timestamp and converted to an angle value. The conversion formula is: angle x=input time column ts value % 360. At the same time, it supports coefficient adjustment and random fluctuation factor adjustment, presented in a fixed format expression, such as fun="10\*sin(x)+100\*random(5)", where x represents the angle, ranging from 0 to 360 degrees, and the growth step size is consistent with the time column step size. 10 represents the coefficient of multiplication, 100 represents the coefficient of addition or subtraction, and 5 represents the fluctuation range within a random range of 5%. The currently supported data types are int, bigint, float, and double. Note: The expression is fixed and cannot be reversed. - **values**: The value field of the nchar/binary column/label, which will be chosen randomly from the values. diff --git a/docs/zh/14-reference/02-tools/10-taosbenchmark.md b/docs/zh/14-reference/02-tools/10-taosbenchmark.md index 3c43c589151b..303cfaa395c5 100644 --- a/docs/zh/14-reference/02-tools/10-taosbenchmark.md +++ b/docs/zh/14-reference/02-tools/10-taosbenchmark.md @@ -364,6 +364,8 @@ taosBenchmark -A INT,DOUBLE,NCHAR,BINARY\(16\) - **max** : 数据类型的 列/标签 的最大值。生成的值将小于最小值。 +- **scalingFactor** : 浮点数精度增强因子,仅当数据类型是float/double时生效,有效值范围为1至1000000的正整数。用于增强生成浮点数的精度,特别是在min或max值较小的情况下。此属性按10的幂次增强小数点后的精度:scalingFactor为10表示增强1位小数精度,100表示增强2位,依此类推。 + - **fun** : 此列数据以函数填充,目前只支持 sin 和 cos 两函数,输入参数为时间戳换算成角度值,换算公式: 角度 x = 输入的时间列ts值 % 360。同时支持系数调节,随机波动因子调节,以固定格式的表达式展现,如 fun=“10\*sin(x)+100\*random(5)” , x 表示角度,取值 0 ~ 360度,增长步长与时间列步长一致。10 表示乘的系数,100 表示加或减的系数,5 表示波动幅度在 5% 的随机范围内。目前支持的数据类型为 int, bigint, float, double 四种数据类型。注意:表达式为固定模式,不可前后颠倒。 - **values** : nchar/binary 列/标签的值域,将从值中随机选择。 From af03868864db5aec6a2cf831f3fd90159cf91d02 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Wed, 30 Oct 2024 19:42:09 +0800 Subject: [PATCH 486/695] fix unit test --- source/dnode/mnode/impl/test/stb/stb.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/dnode/mnode/impl/test/stb/stb.cpp b/source/dnode/mnode/impl/test/stb/stb.cpp index aa12c107a143..e92231907ffe 100644 --- a/source/dnode/mnode/impl/test/stb/stb.cpp +++ b/source/dnode/mnode/impl/test/stb/stb.cpp @@ -782,7 +782,7 @@ TEST_F(MndTestStb, 07_Alter_Stb_DropColumn) { { void* pReq = BuildAlterStbDropColumnReq(stbname, "col1", &contLen); SRpcMsg* pRsp = test.SendReq(TDMT_MND_ALTER_STB, pReq, contLen); - ASSERT_EQ(pRsp->code, TSDB_CODE_MND_INVALID_STB_ALTER_OPTION); + ASSERT_EQ(pRsp->code, TSDB_CODE_PAR_INVALID_DROP_COL); rpcFreeCont(pRsp->pCont); } From d5f6f9aacb0035a18ea33a44ac047493f8521549 Mon Sep 17 00:00:00 2001 From: yingzhao Date: Wed, 30 Oct 2024 19:53:00 +0800 Subject: [PATCH 487/695] fix(dosc): br compile eror --- docs/zh/06-advanced/05-data-in/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/zh/06-advanced/05-data-in/index.md b/docs/zh/06-advanced/05-data-in/index.md index 50c66cc37782..0dfa04db56c6 100644 --- a/docs/zh/06-advanced/05-data-in/index.md +++ b/docs/zh/06-advanced/05-data-in/index.md @@ -22,7 +22,7 @@ TDengine Enterprise 配备了一个强大的可视化数据管理工具—taosEx | Aveva Historian | AVEVA Historian 2020 RS SP1 | 工业大数据分析软件,前身为 Wonderware Historian,专为工业环境设计,用于存储、管理和分析来自各种工业设备、传感器的实时和历史数据 | | OPC DA | Matrikon OPC version: 1.7.2.7433 | OPC 是 Open Platform Communications 的缩写,是一种开放式、标准化的通信协议,用于不同厂商的自动化设备之间进行数据交换。它最初由微软公司开发,旨在解决工业控制领域中不同设备之间互操作性差的问题;OPC 协议最初于 1996 年发布,当时称为 OPC DA (Data Access),主要用于实时数据采集和控制。 | | OPC UA | KeepWare KEPServerEx 6.5 | 2006 年,OPC 基金会发布了 OPC UA (Unified Architecture) 标准,它是一种基于服务的面向对象的协议,具有更高的灵活性和可扩展性,已成为 OPC 协议的主流版本 | -| MQTT | emqx: 3.0.0 到 5.7.1
      hivemq: 4.0.0 到 4.31.0
      mosquitto: 1.4.4 到 2.0.18 | Message Queuing Telemetry Transport 的缩写,一种基于发布/订阅模式的轻量级通讯协议,专为低开销、低带宽占用的即时通讯设计,广泛适用于物联网、小型设备、移动应用等领域。 | +| MQTT | emqx: 3.0.0 到 5.7.1
      hivemq: 4.0.0 到 4.31.0
      mosquitto: 1.4.4 到 2.0.18 | Message Queuing Telemetry Transport 的缩写,一种基于发布/订阅模式的轻量级通讯协议,专为低开销、低带宽占用的即时通讯设计,广泛适用于物联网、小型设备、移动应用等领域。 | | Kafka | 2.11 ~ 3.8.0 | 由 Apache 软件基金会开发的一个开源流处理平台,主要用于处理实时数据,并提供一个统一、高通量、低延迟的消息系统。它具备高速度、可伸缩性、持久性和分布式设计等特点,使得它能够在每秒处理数十万次的读写操作,支持上千个客户端,同时保持数据的可靠性和可用性。 | | InfluxDB | 1.7、1.8、2.0-2.7 | InfluxDB 是一种流行的开源时间序列数据库,它针对处理大量时间序列数据进行了优化。| | OpenTSDB | 2.4.1 | 基于 HBase 的分布式、可伸缩的时序数据库。它主要用于存储、索引和提供从大规模集群(包括网络设备、操作系统、应用程序等)中收集的指标数据,使这些数据更易于访问和图形化展示。 | From 25767e7fb3ffb7121a035fd6c8ef4d46f9123ed2 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 30 Oct 2024 20:36:39 +0800 Subject: [PATCH 488/695] doc: minor changes --- docs/zh/14-reference/02-tools/10-taosbenchmark.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/zh/14-reference/02-tools/10-taosbenchmark.md b/docs/zh/14-reference/02-tools/10-taosbenchmark.md index 303cfaa395c5..d6552905778a 100644 --- a/docs/zh/14-reference/02-tools/10-taosbenchmark.md +++ b/docs/zh/14-reference/02-tools/10-taosbenchmark.md @@ -364,7 +364,7 @@ taosBenchmark -A INT,DOUBLE,NCHAR,BINARY\(16\) - **max** : 数据类型的 列/标签 的最大值。生成的值将小于最小值。 -- **scalingFactor** : 浮点数精度增强因子,仅当数据类型是float/double时生效,有效值范围为1至1000000的正整数。用于增强生成浮点数的精度,特别是在min或max值较小的情况下。此属性按10的幂次增强小数点后的精度:scalingFactor为10表示增强1位小数精度,100表示增强2位,依此类推。 +- **scalingFactor** : 浮点数精度增强因子,仅当数据类型是 float/double 时生效,有效值范围为 1 至 1000000 的正整数。用于增强生成浮点数的精度,特别是在 min 或 max 值较小的情况下。此属性按 10 的幂次增强小数点后的精度:scalingFactor 为 10 表示增强 1 位小数精度,100 表示增强 2 位,依此类推。 - **fun** : 此列数据以函数填充,目前只支持 sin 和 cos 两函数,输入参数为时间戳换算成角度值,换算公式: 角度 x = 输入的时间列ts值 % 360。同时支持系数调节,随机波动因子调节,以固定格式的表达式展现,如 fun=“10\*sin(x)+100\*random(5)” , x 表示角度,取值 0 ~ 360度,增长步长与时间列步长一致。10 表示乘的系数,100 表示加或减的系数,5 表示波动幅度在 5% 的随机范围内。目前支持的数据类型为 int, bigint, float, double 四种数据类型。注意:表达式为固定模式,不可前后颠倒。 From 01748085cca30ff398a81c151ca519965caef9fe Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Thu, 31 Oct 2024 00:25:26 +0800 Subject: [PATCH 489/695] fix(stream): not remove task when trying to stop it. --- source/libs/stream/src/streamStartTask.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/source/libs/stream/src/streamStartTask.c b/source/libs/stream/src/streamStartTask.c index 3518b8681d8b..ed12687e4107 100644 --- a/source/libs/stream/src/streamStartTask.c +++ b/source/libs/stream/src/streamStartTask.c @@ -453,10 +453,6 @@ int32_t streamMetaStopAllTasks(SStreamMeta* pMeta) { } streamMetaReleaseTask(pMeta, pTask); - ret = taosRemoveRef(streamTaskRefPool, refId); - if (ret) { - stError("vgId:%d failed to remove task:0x%x, refId:%"PRId64, pMeta->vgId, pTaskId->taskId, refId); - } } taosArrayDestroy(pTaskList); From d70db52bb953ae2bf83c72af9ccf708d5e62e031 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Thu, 31 Oct 2024 09:29:05 +0800 Subject: [PATCH 490/695] Update 14-stream.md --- docs/zh/14-reference/03-taos-sql/14-stream.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/zh/14-reference/03-taos-sql/14-stream.md b/docs/zh/14-reference/03-taos-sql/14-stream.md index cd5c76a4ad38..9567381f7de1 100644 --- a/docs/zh/14-reference/03-taos-sql/14-stream.md +++ b/docs/zh/14-reference/03-taos-sql/14-stream.md @@ -291,3 +291,4 @@ RESUME STREAM [IF EXISTS] [IGNORE UNTREATED] stream_name; CREATE SNODE ON DNODE [id] ``` 其中的 id 是集群中的 dnode 的序号。请注意选择的dnode,流计算的中间状态将自动在其上进行备份。 +从 3.3.4.0 版本开始,在多副本环境中创建流会进行 snode 的**存在性检查**,要求首先创建 snode。如果 snode 不存在,无法创建流。 From 9376d78b67aea47cd92f31b045b6fe77067c4318 Mon Sep 17 00:00:00 2001 From: chenhaoran Date: Wed, 30 Oct 2024 19:30:09 +0800 Subject: [PATCH 491/695] test:verify the output of the stream with partition by tag and column --- .../8-stream/force_window_close_interval.py | 67 ++++++++++++++++--- 1 file changed, 58 insertions(+), 9 deletions(-) diff --git a/tests/system-test/8-stream/force_window_close_interval.py b/tests/system-test/8-stream/force_window_close_interval.py index af06cfdfd3ad..a93e79f9917a 100644 --- a/tests/system-test/8-stream/force_window_close_interval.py +++ b/tests/system-test/8-stream/force_window_close_interval.py @@ -179,7 +179,7 @@ def force_window_close( tag_t1_value = self.tdCom.tag_value_list[0] where_tag = f"where t1 = {tag_t1_value}" where_tbname = f'where tbname="{self.ctb_name}"' - print(f"tag: {tag_t1_value}") + # print(f"tag: {tag_t1_value}") self.stb_stream_des_where_tag_table = ( f"{self.stb_name}_where_tag{self.tdCom.des_table_suffix}" @@ -209,12 +209,21 @@ def force_window_close( ) # set partition by tag and column + self.stb_stream_des_partition_tag_table = ( + f"{self.stb_name}_partition_tag{self.tdCom.des_table_suffix}" + ) + self.stb_stream_des_partition_column1_table = ( + f"{self.stb_name}_partition_column1{self.tdCom.des_table_suffix}" + ) + self.stb_stream_des_partition_column2_table = ( + f"{self.stb_name}_partition_column2{self.tdCom.des_table_suffix}" + ) if partition: tdLog.info("create stream with partition by tag and tbname ") partition_elm_new = f"partition by {partition}, t1" self.tdCom.create_stream( stream_name=f"{self.stb_name}_partition_tag{self.tdCom.stream_suffix}", - des_table=f"{self.stb_name}_partition_tag{self.tdCom.des_table_suffix}", + des_table=self.stb_stream_des_partition_tag_table, source_sql=f'select _irowts as irowts, tbname as table_name, t1 as t_t1, _isfilled as isfilled, {funciton_name} as {funciton_name_alias} from {self.stb_name} {partition_elm_new} every({self.tdCom.dataDict["interval"]}s)', trigger_mode=trigger_mode, fill_value=fill_value, @@ -248,6 +257,7 @@ def force_window_close( if fill_value: if "value" in fill_value.lower(): fill_value = "VALUE,1,2,3,4,5,6,7,8,9,10,11" + # create stream general table tdLog.info("create stream general table") self.tdCom.create_stream( @@ -261,6 +271,9 @@ def force_window_close( ignore_update=ignore_update, ) + #sleep 10s wait stream_task status is ready + time.sleep(10) + # insert data self.tdCom.date_time = self.tdCom.genTs(precision=self.tdCom.precision)[0] start_time = self.tdCom.date_time @@ -271,7 +284,7 @@ def force_window_close( str(self.tdCom.date_time + self.tdCom.dataDict["interval"]) + f"+{i*10}s" ) - print(ts_value) + # print(ts_value) if start_force_ts == "0": start_force_ts = ts_value ts_cast_delete_value = self.tdCom.time_cast(ts_value) @@ -468,7 +481,7 @@ def force_window_close( # check the data for tbname in [self.stb_name, self.ctb_name, self.tb_name]: - print(tbname) + tdLog.info(f"tbname:{tbname}") tdSql.query( f'select _wstart, _wend ,last(ts) from {tbname} where ts >= {start_force_ts} and ts <= {end_ts} partition by tbname interval({self.tdCom.dataDict["interval"]}s)fill ({fill_value}) ' ) @@ -477,6 +490,8 @@ def force_window_close( if "value" in fill_value.lower(): fill_value = "VALUE,1,2,3,6,7,8,9,10,11,1,2,3,4,5,6,7,8,9,10,11" if partition == "tbname": + # check data for child table + tdLog.info("check data for child table ") self.tdCom.check_query_data( f'select irowts, table_name, isfilled, {funciton_name_alias} from {tbname}{self.tdCom.des_table_suffix} where irowts >= {start_force_ts} and irowts <= "{end_new_ts}" order by irowts', f'select _irowts as irowts ,tbname as table_name, _isfilled as isfilled , {funciton_name} as {funciton_name_alias} from {tbname} partition by {partition} range("{start_new_ts}","{end_new_ts}") every({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by irowts', @@ -484,12 +499,15 @@ def force_window_close( ) elif tbname == self.stb_name: if partition == "tbname": + # check data for super table + tdLog.info("check data for super table") self.tdCom.check_query_data( f'select irowts, table_name, isfilled, {funciton_name_alias} from {tbname}{self.tdCom.des_table_suffix} where irowts >= {start_force_ts} and irowts <= "{end_new_ts}" order by irowts', f'select _irowts as irowts ,tbname as table_name, _isfilled as isfilled , {funciton_name} as {funciton_name_alias} from {tbname} partition by {partition} range("{start_new_ts}","{end_new_ts}") every({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by irowts', fill_value=fill_value, ) - # check tag and tbname filter + # tag and tbname filter + tdLog.info("check data for tag and tbname filter") self.tdCom.check_query_data( f'select irowts, table_name, isfilled, {funciton_name_alias} from {self.stb_stream_des_where_tag_table} where irowts >= {start_force_ts} and irowts <= "{end_new_ts}" order by irowts', f'select _irowts as irowts ,tbname as table_name, _isfilled as isfilled , {funciton_name} as {funciton_name_alias} from {tbname} {where_tag} partition by {partition} range("{start_new_ts}","{end_new_ts}") every({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by irowts', @@ -500,10 +518,28 @@ def force_window_close( f'select _irowts as irowts ,tbname as table_name, _isfilled as isfilled , {funciton_name} as {funciton_name_alias} from {tbname} {where_tbname} partition by {partition} range("{start_new_ts}","{end_new_ts}") every({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by irowts', fill_value=fill_value, ) + # check partition by tag and column(c1 or c2) + tdLog.info("check data for partition by tag and column") + self.tdCom.check_query_data( + f'select irowts, table_name, t_t1, isfilled, {funciton_name_alias} from {self.stb_stream_des_partition_tag_table} where irowts >= {start_force_ts} and irowts <= "{end_new_ts}" order by t_t1, irowts', + f'select _irowts as irowts ,tbname as table_name, t1 as t_t1, _isfilled as isfilled , {funciton_name} as {funciton_name_alias} from {tbname} {where_tbname} partition by {partition},t1 range("{start_new_ts}","{end_new_ts}") every({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by t_t1, irowts', + fill_value=fill_value, + ) + self.tdCom.check_query_data( + f'select irowts, table_name, c_c1, isfilled, {funciton_name_alias} from {self.stb_stream_des_partition_column1_table} where irowts >= {start_force_ts} and irowts <= "{end_new_ts}" order by c_c1, irowts', + f'select _irowts as irowts ,tbname as table_name, c1 as c_c1, _isfilled as isfilled , {funciton_name} as {funciton_name_alias} from {tbname} {where_tbname} partition by {partition},c1 range("{start_new_ts}","{end_new_ts}") every({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by c_c1, irowts', + fill_value=fill_value, + ) + self.tdCom.check_query_data( + f'select irowts, table_name, c_c2, isfilled, {funciton_name_alias} from {self.stb_stream_des_partition_column2_table} where irowts >= {start_force_ts} and irowts <= "{end_new_ts}" order by c_c2, irowts', + f'select _irowts as irowts ,tbname as table_name, c2 as c_c2, _isfilled as isfilled , {funciton_name} as {funciton_name_alias} from {tbname}, {where_tbname} partition by {partition},c2 range("{start_new_ts}","{end_new_ts}") every({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by c_c2, irowts', + fill_value=fill_value, + ) else: if "value" in fill_value.lower(): fill_value = "VALUE,1" if partition == "tbname": + # check data for general table self.tdCom.check_query_data( f'select irowts, isfilled, {funciton_name_alias} from {tbname}{self.tdCom.des_table_suffix} where irowts >= {start_force_ts} and irowts <= "{end_new_ts}" order by irowts', f'select _irowts as irowts , _isfilled as isfilled , {funciton_name} as {funciton_name_alias} from {tbname} partition by {partition} range("{start_new_ts}","{end_new_ts}") every({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by irowts', @@ -512,19 +548,32 @@ def force_window_close( # Recreate a sub-table that meets the filtering "where_tag" and check if the streaming results are automatically included within it." where_tag_ctbname = f"{self.ctb_name}_where_tag" + where_tag_ctbname_other_tag = f"{self.ctb_name}_where_tag_1" + tag_t1_value_other = abs(tag_t1_value)-1 tdSql.execute( f"create table {where_tag_ctbname} using {self.stb_name} (t1) tags({tag_t1_value}) " ) + tdSql.execute( + f"create table {where_tag_ctbname_other_tag} using {self.stb_name} (t1) tags({tag_t1_value_other}) " + ) where_tag_timestamp = self.tdCom.genTs(precision=self.tdCom.precision)[0] where_tag_ts_start_value = str(where_tag_timestamp) + "+2s" self.tdCom.sinsert_rows( tbname=where_tag_ctbname, ts_value=where_tag_ts_start_value ) - time.sleep(self.tdCom.dataDict["interval"] + 5) - tdSql.query( - f"select distinct(table_name) from {self.stb_stream_des_where_tag_table} where table_name=\"{where_tag_ctbname}\"" + self.tdCom.sinsert_rows( + tbname=where_tag_ctbname_other_tag, ts_value=where_tag_ts_start_value ) - tdSql.checkEqual(tdSql.queryResult[0][0], where_tag_ctbname) + time.sleep(self.tdCom.dataDict["interval"]) + for _ in range(self.tdCom.dataDict["interval"]): + tdSql.query( + f"select distinct(table_name) from {self.stb_stream_des_where_tag_table} where table_name=\"{where_tag_ctbname}\"" + ) + if tdSql.queryRows > 0: + if tdSql.checkDataNotExit(0,0, where_tag_ctbname): + break + else: + time.sleep(1) if self.delete: self.tdCom.sdelete_rows( From e7b4fbcf90c7de8f6350647557d6f3c95fabd960 Mon Sep 17 00:00:00 2001 From: chenhaoran Date: Wed, 30 Oct 2024 21:33:54 +0800 Subject: [PATCH 492/695] test:add checking stream status and set interval 8 to test --- tests/pytest/util/common.py | 19 ++++++----- .../8-stream/force_window_close_interval.py | 32 +++++++++++++------ 2 files changed, 34 insertions(+), 17 deletions(-) diff --git a/tests/pytest/util/common.py b/tests/pytest/util/common.py index 5827f0757f54..c12f324fd7bb 100644 --- a/tests/pytest/util/common.py +++ b/tests/pytest/util/common.py @@ -1012,7 +1012,7 @@ def check_stream_wal_info(self, wal_info): # If no match was found, or the pattern does not match the expected format, return False return False - def check_stream_task_status(self, stream_name, vgroups, stream_timeout=None): + def check_stream_task_status(self, stream_name, vgroups, stream_timeout=0, check_wal_info=True): """check stream status Args: @@ -1048,13 +1048,16 @@ def check_stream_task_status(self, stream_name, vgroups, stream_timeout=None): print(f"result_task_status:{result_task_status},result_task_history:{result_task_history},result_task_alll:{result_task_alll}") if result_task_status_rows == 1 and result_task_status ==[('ready',)] : if result_task_history_rows == 1 and result_task_history == [(None,)] : - for vgroup_num in range(vgroups): - if self.check_stream_wal_info(result_task_alll[vgroup_num][4]) : - check_stream_success += 1 - tdLog.info(f"check stream task list[{check_stream_success}] sucessfully :") - else: - check_stream_success = 0 - break + if check_wal_info: + for vgroup_num in range(vgroups): + if self.check_stream_wal_info(result_task_alll[vgroup_num][4]) : + check_stream_success += 1 + tdLog.info(f"check stream task list[{check_stream_success}] sucessfully :") + else: + check_stream_success = 0 + break + else: + check_stream_success = vgroups if check_stream_success == vgroups: break diff --git a/tests/system-test/8-stream/force_window_close_interval.py b/tests/system-test/8-stream/force_window_close_interval.py index a93e79f9917a..88b1628b25d2 100644 --- a/tests/system-test/8-stream/force_window_close_interval.py +++ b/tests/system-test/8-stream/force_window_close_interval.py @@ -126,7 +126,7 @@ def force_window_close( partition_elm = "" if fill_value: if "value" in fill_value.lower(): - fill_value = "VALUE,1,2,3,4,5,6,7,8,9,10,11,1,2,3,4,5,6,7,8,9,10,11" + fill_value = "VALUE,1" # create error stream tdLog.info("create error stream") @@ -256,7 +256,7 @@ def force_window_close( if fill_value: if "value" in fill_value.lower(): - fill_value = "VALUE,1,2,3,4,5,6,7,8,9,10,11" + fill_value = "VALUE,1" # create stream general table tdLog.info("create stream general table") @@ -271,8 +271,15 @@ def force_window_close( ignore_update=ignore_update, ) - #sleep 10s wait stream_task status is ready - time.sleep(10) + # wait and check stream_task status is ready + time.sleep(self.tdCom.dataDict["interval"]) + tdSql.query("show streams") + tdLog.info(f"tdSql.queryResult:{tdSql.queryResult},tdSql.queryRows:{tdSql.queryRows}") + for stream_number in range(tdSql.queryRows): + stream_name = tdSql.queryResult[stream_number][0] + tdCom.check_stream_task_status( + stream_name=stream_name, vgroups=2, stream_timeout=20,check_wal_info=False + ) # insert data self.tdCom.date_time = self.tdCom.genTs(precision=self.tdCom.precision)[0] @@ -487,8 +494,6 @@ def force_window_close( ) start_new_ts = tdSql.getData(0, 1) if tbname == self.ctb_name: - if "value" in fill_value.lower(): - fill_value = "VALUE,1,2,3,6,7,8,9,10,11,1,2,3,4,5,6,7,8,9,10,11" if partition == "tbname": # check data for child table tdLog.info("check data for child table ") @@ -536,8 +541,6 @@ def force_window_close( fill_value=fill_value, ) else: - if "value" in fill_value.lower(): - fill_value = "VALUE,1" if partition == "tbname": # check data for general table self.tdCom.check_query_data( @@ -618,8 +621,18 @@ def force_window_close( ) def run(self): + for fill_value in ["PREV", "NEXT", "VALUE"]: + self.force_window_close( + interval=10, + partition="tbname", + funciton_name="interp(c1)", + funciton_name_alias="intp_c1", + delete=False, + ignore_update=1, + fill_value=fill_value, + ) self.force_window_close( - interval=10, + interval=8, partition="tbname", funciton_name="interp(c1)", funciton_name_alias="intp_c1", @@ -644,5 +657,6 @@ def stop(self): event = threading.Event() + tdCases.addLinux(__file__, TDTestCase()) tdCases.addWindows(__file__, TDTestCase()) From c87b054a02348acbf9881fc6c783d3a99bcc4a9b Mon Sep 17 00:00:00 2001 From: Jing Sima Date: Tue, 29 Oct 2024 13:27:09 +0800 Subject: [PATCH 493/695] fix:[TD-32727] fix bug when select interp with two more group key. --- source/libs/executor/src/timesliceoperator.c | 62 ++++++++++++++------ 1 file changed, 44 insertions(+), 18 deletions(-) diff --git a/source/libs/executor/src/timesliceoperator.c b/source/libs/executor/src/timesliceoperator.c index 5dcdfd2791a8..53fe76d85137 100644 --- a/source/libs/executor/src/timesliceoperator.c +++ b/source/libs/executor/src/timesliceoperator.c @@ -42,7 +42,7 @@ typedef struct STimeSliceOperatorInfo { SRowKey prevKey; bool prevTsSet; uint64_t groupId; - SGroupKeys* pPrevGroupKey; + SArray* pPrevGroupKeys; SSDataBlock* pNextGroupRes; SSDataBlock* pRemainRes; // save block unfinished processing int32_t remainIndex; // the remaining index in the block to be processed @@ -288,6 +288,7 @@ static bool genInterpolationResult(STimeSliceOperatorInfo* pSliceInfo, SExprSupp // output the result int32_t fillColIndex = 0; + int32_t groupKeyIndex = 0; bool hasInterp = true; for (int32_t j = 0; j < pExprSup->numOfExprs; ++j) { SExprInfo* pExprInfo = &pExprSup->pExprInfo[j]; @@ -320,7 +321,9 @@ static bool genInterpolationResult(STimeSliceOperatorInfo* pSliceInfo, SExprSupp QUERY_CHECK_CODE(code, lino, _end); } else if (!isSelectGroupConstValueFunc(pExprInfo)) { // use stored group key - SGroupKeys* pkey = pSliceInfo->pPrevGroupKey; + SGroupKeys *pkey = taosArrayGet(pSliceInfo->pPrevGroupKeys, groupKeyIndex); + QUERY_CHECK_NULL(pkey, code, lino, _end, terrno); + groupKeyIndex++; if (pkey->isNull == false) { code = colDataSetVal(pDst, rows, pkey->pData, false); QUERY_CHECK_CODE(code, lino, _end); @@ -645,13 +648,20 @@ static int32_t initFillLinearInfo(STimeSliceOperatorInfo* pInfo, SSDataBlock* pB return code; } +static void destroyGroupKey(void* pKey) { + SGroupKeys* key = (SGroupKeys*)pKey; + if (key->pData != NULL) { + taosMemoryFreeClear(key->pData); + } +} + static int32_t initGroupKeyKeeper(STimeSliceOperatorInfo* pInfo, SExprSupp* pExprSup) { - if (pInfo->pPrevGroupKey != NULL) { + if (pInfo->pPrevGroupKeys != NULL) { return TSDB_CODE_SUCCESS; } - pInfo->pPrevGroupKey = taosMemoryCalloc(1, sizeof(SGroupKeys)); - if (pInfo->pPrevGroupKey == NULL) { + pInfo->pPrevGroupKeys = taosArrayInit(pExprSup->numOfExprs, sizeof(SGroupKeys)); + if (pInfo->pPrevGroupKeys == NULL) { return terrno; } @@ -659,11 +669,17 @@ static int32_t initGroupKeyKeeper(STimeSliceOperatorInfo* pInfo, SExprSupp* pExp SExprInfo* pExprInfo = &pExprSup->pExprInfo[i]; if (isGroupKeyFunc(pExprInfo)) { - pInfo->pPrevGroupKey->bytes = pExprInfo->base.resSchema.bytes; - pInfo->pPrevGroupKey->type = pExprInfo->base.resSchema.type; - pInfo->pPrevGroupKey->isNull = false; - pInfo->pPrevGroupKey->pData = taosMemoryCalloc(1, pInfo->pPrevGroupKey->bytes); - if (!pInfo->pPrevGroupKey->pData) { + SGroupKeys key = {.bytes = pExprInfo->base.resSchema.bytes, + .type = pExprInfo->base.resSchema.type, + .isNull = false, + .pData = taosMemoryCalloc(1, pExprInfo->base.resSchema.bytes)}; + if (!key.pData) { + taosArrayDestroyEx(pInfo->pPrevGroupKeys, destroyGroupKey); + return terrno; + } + if (NULL == taosArrayPush(pInfo->pPrevGroupKeys, &key)) { + taosMemoryFree(key.pData); + taosArrayDestroyEx(pInfo->pPrevGroupKeys, destroyGroupKey); return terrno; } } @@ -910,7 +926,7 @@ static void genInterpAfterDataBlock(STimeSliceOperatorInfo* pSliceInfo, SOperato SInterval* pInterval = &pSliceInfo->interval; if (pSliceInfo->fillType == TSDB_FILL_NEXT || pSliceInfo->fillType == TSDB_FILL_LINEAR || - pSliceInfo->pPrevGroupKey == NULL) { + pSliceInfo->pPrevGroupKeys == NULL) { return; } @@ -921,12 +937,18 @@ static void genInterpAfterDataBlock(STimeSliceOperatorInfo* pSliceInfo, SOperato } } -static void copyPrevGroupKey(SExprSupp* pExprSup, SGroupKeys* pGroupKey, SSDataBlock* pSrcBlock) { +static int32_t copyPrevGroupKey(SExprSupp* pExprSup, SArray * pGroupKeys, SSDataBlock* pSrcBlock) { + int32_t groupKeyIdx = 0; for (int32_t j = 0; j < pExprSup->numOfExprs; ++j) { SExprInfo* pExprInfo = &pExprSup->pExprInfo[j]; if (isGroupKeyFunc(pExprInfo)) { int32_t srcSlot = pExprInfo->base.pParam[0].pCol->slotId; + SGroupKeys *pGroupKey = taosArrayGet(pGroupKeys, groupKeyIdx); + if (pGroupKey == NULL) { + return terrno; + } + groupKeyIdx++; SColumnInfoData* pSrc = taosArrayGet(pSrcBlock->pDataBlock, srcSlot); if (colDataIsNull_s(pSrc, 0)) { @@ -942,9 +964,9 @@ static void copyPrevGroupKey(SExprSupp* pExprSup, SGroupKeys* pGroupKey, SSDataB } pGroupKey->isNull = false; - break; } } + return TSDB_CODE_SUCCESS; } static void resetTimesliceInfo(STimeSliceOperatorInfo* pSliceInfo) { @@ -986,7 +1008,11 @@ static void doHandleTimeslice(SOperatorInfo* pOperator, SSDataBlock* pBlock) { T_LONG_JMP(pTaskInfo->env, code); } doTimesliceImpl(pOperator, pSliceInfo, pBlock, pTaskInfo, ignoreNull); - copyPrevGroupKey(&pOperator->exprSupp, pSliceInfo->pPrevGroupKey, pBlock); + code = copyPrevGroupKey(&pOperator->exprSupp, pSliceInfo->pPrevGroupKeys, pBlock); + if (code != TSDB_CODE_SUCCESS) { + qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(code)); + T_LONG_JMP(pTaskInfo->env, code); + } } static int32_t doTimesliceNext(SOperatorInfo* pOperator, SSDataBlock** ppRes) { @@ -1160,7 +1186,7 @@ int32_t createTimeSliceOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pPhyN pInfo->prevTsSet = false; pInfo->prevKey.ts = INT64_MIN; pInfo->groupId = 0; - pInfo->pPrevGroupKey = NULL; + pInfo->pPrevGroupKeys = NULL; pInfo->pNextGroupRes = NULL; pInfo->pRemainRes = NULL; pInfo->remainIndex = 0; @@ -1233,9 +1259,9 @@ void destroyTimeSliceOperatorInfo(void* param) { } taosArrayDestroy(pInfo->pLinearInfo); - if (pInfo->pPrevGroupKey) { - taosMemoryFree(pInfo->pPrevGroupKey->pData); - taosMemoryFree(pInfo->pPrevGroupKey); + if (pInfo->pPrevGroupKeys) { + taosArrayDestroyEx(pInfo->pPrevGroupKeys, destroyGroupKey); + pInfo->pPrevGroupKeys = NULL; } if (pInfo->hasPk && IS_VAR_DATA_TYPE(pInfo->pkCol.type)) { taosMemoryFreeClear(pInfo->prevKey.pks[0].pData); From 5a4c7c2e2aaac4df859d4d96d5627500efa11c91 Mon Sep 17 00:00:00 2001 From: Jing Sima Date: Wed, 30 Oct 2024 16:28:12 +0800 Subject: [PATCH 494/695] fix:[TD-32727] Add test case for TD-32727. --- tests/army/query/function/ans/interp.csv | 368 +++++++++++++++++++++++ tests/army/query/function/in/interp.in | 15 + tests/army/query/function/test_interp.py | 72 +++++ tests/parallel_test/cases.task | 1 + 4 files changed, 456 insertions(+) create mode 100644 tests/army/query/function/ans/interp.csv create mode 100644 tests/army/query/function/in/interp.in create mode 100644 tests/army/query/function/test_interp.py diff --git a/tests/army/query/function/ans/interp.csv b/tests/army/query/function/ans/interp.csv new file mode 100644 index 000000000000..e1ba236aa11b --- /dev/null +++ b/tests/army/query/function/ans/interp.csv @@ -0,0 +1,368 @@ + +taos> select _irowts as irowts ,tbname as table_name, _isfilled as isfilled , interp(c1) as intp_c1 from test.td32727 partition by tbname range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill (null) order by irowts; + irowts | table_name | isfilled | intp_c1 | +================================================================================ + 2020-02-01 00:00:04.000 | td32727 | true | NULL | + 2020-02-01 00:00:05.000 | td32727 | false | 5 | + 2020-02-01 00:00:06.000 | td32727 | true | NULL | + 2020-02-01 00:00:07.000 | td32727 | true | NULL | + 2020-02-01 00:00:08.000 | td32727 | true | NULL | + 2020-02-01 00:00:09.000 | td32727 | true | NULL | + 2020-02-01 00:00:10.000 | td32727 | false | 10 | + 2020-02-01 00:00:11.000 | td32727 | true | NULL | + 2020-02-01 00:00:12.000 | td32727 | true | NULL | + 2020-02-01 00:00:13.000 | td32727 | true | NULL | + 2020-02-01 00:00:14.000 | td32727 | true | NULL | + 2020-02-01 00:00:15.000 | td32727 | false | 15 | + 2020-02-01 00:00:16.000 | td32727 | true | NULL | + +taos> select _irowts as irowts ,tbname as table_name, _isfilled as isfilled , interp(c1) as intp_c1 from test.td32727 partition by tbname range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill (next) order by irowts; + irowts | table_name | isfilled | intp_c1 | +================================================================================ + 2020-02-01 00:00:04.000 | td32727 | true | 5 | + 2020-02-01 00:00:05.000 | td32727 | false | 5 | + 2020-02-01 00:00:06.000 | td32727 | true | 10 | + 2020-02-01 00:00:07.000 | td32727 | true | 10 | + 2020-02-01 00:00:08.000 | td32727 | true | 10 | + 2020-02-01 00:00:09.000 | td32727 | true | 10 | + 2020-02-01 00:00:10.000 | td32727 | false | 10 | + 2020-02-01 00:00:11.000 | td32727 | true | 15 | + 2020-02-01 00:00:12.000 | td32727 | true | 15 | + 2020-02-01 00:00:13.000 | td32727 | true | 15 | + 2020-02-01 00:00:14.000 | td32727 | true | 15 | + 2020-02-01 00:00:15.000 | td32727 | false | 15 | + +taos> select _irowts as irowts ,tbname as table_name, _isfilled as isfilled , interp(c1) as intp_c1 from test.td32727 partition by tbname range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill (prev) order by irowts; + irowts | table_name | isfilled | intp_c1 | +================================================================================ + 2020-02-01 00:00:05.000 | td32727 | false | 5 | + 2020-02-01 00:00:06.000 | td32727 | true | 5 | + 2020-02-01 00:00:07.000 | td32727 | true | 5 | + 2020-02-01 00:00:08.000 | td32727 | true | 5 | + 2020-02-01 00:00:09.000 | td32727 | true | 5 | + 2020-02-01 00:00:10.000 | td32727 | false | 10 | + 2020-02-01 00:00:11.000 | td32727 | true | 10 | + 2020-02-01 00:00:12.000 | td32727 | true | 10 | + 2020-02-01 00:00:13.000 | td32727 | true | 10 | + 2020-02-01 00:00:14.000 | td32727 | true | 10 | + 2020-02-01 00:00:15.000 | td32727 | false | 15 | + 2020-02-01 00:00:16.000 | td32727 | true | 15 | + +taos> select _irowts as irowts ,tbname as table_name, _isfilled as isfilled , interp(c1) as intp_c1 from test.td32727 partition by tbname range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill (linear) order by irowts; + irowts | table_name | isfilled | intp_c1 | +================================================================================ + 2020-02-01 00:00:05.000 | td32727 | false | 5 | + 2020-02-01 00:00:06.000 | td32727 | true | 6 | + 2020-02-01 00:00:07.000 | td32727 | true | 7 | + 2020-02-01 00:00:08.000 | td32727 | true | 8 | + 2020-02-01 00:00:09.000 | td32727 | true | 9 | + 2020-02-01 00:00:10.000 | td32727 | false | 10 | + 2020-02-01 00:00:11.000 | td32727 | true | 11 | + 2020-02-01 00:00:12.000 | td32727 | true | 12 | + 2020-02-01 00:00:13.000 | td32727 | true | 13 | + 2020-02-01 00:00:14.000 | td32727 | true | 14 | + 2020-02-01 00:00:15.000 | td32727 | false | 15 | + +taos> select _irowts as irowts ,tbname as table_name, _isfilled as isfilled , interp(c1) as intp_c1 from test.td32727 partition by tbname range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill (value, 1) order by irowts; + irowts | table_name | isfilled | intp_c1 | +================================================================================ + 2020-02-01 00:00:04.000 | td32727 | true | 1 | + 2020-02-01 00:00:05.000 | td32727 | false | 5 | + 2020-02-01 00:00:06.000 | td32727 | true | 1 | + 2020-02-01 00:00:07.000 | td32727 | true | 1 | + 2020-02-01 00:00:08.000 | td32727 | true | 1 | + 2020-02-01 00:00:09.000 | td32727 | true | 1 | + 2020-02-01 00:00:10.000 | td32727 | false | 10 | + 2020-02-01 00:00:11.000 | td32727 | true | 1 | + 2020-02-01 00:00:12.000 | td32727 | true | 1 | + 2020-02-01 00:00:13.000 | td32727 | true | 1 | + 2020-02-01 00:00:14.000 | td32727 | true | 1 | + 2020-02-01 00:00:15.000 | td32727 | false | 15 | + 2020-02-01 00:00:16.000 | td32727 | true | 1 | + +taos> select _irowts as irowts ,tbname as table_name, c2 as c_c2, _isfilled as isfilled , interp(c1) as intp_c1 from test.td32727 partition by tbname,c2 range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill (null) order by irowts, c2; + irowts | table_name | c_c2 | isfilled | intp_c1 | +============================================================================================== + 2020-02-01 00:00:04.000 | td32727 | 5 | true | NULL | + 2020-02-01 00:00:04.000 | td32727 | 10 | true | NULL | + 2020-02-01 00:00:04.000 | td32727 | 15 | true | NULL | + 2020-02-01 00:00:05.000 | td32727 | 5 | false | 5 | + 2020-02-01 00:00:05.000 | td32727 | 10 | true | NULL | + 2020-02-01 00:00:05.000 | td32727 | 15 | true | NULL | + 2020-02-01 00:00:06.000 | td32727 | 5 | true | NULL | + 2020-02-01 00:00:06.000 | td32727 | 10 | true | NULL | + 2020-02-01 00:00:06.000 | td32727 | 15 | true | NULL | + 2020-02-01 00:00:07.000 | td32727 | 5 | true | NULL | + 2020-02-01 00:00:07.000 | td32727 | 10 | true | NULL | + 2020-02-01 00:00:07.000 | td32727 | 15 | true | NULL | + 2020-02-01 00:00:08.000 | td32727 | 5 | true | NULL | + 2020-02-01 00:00:08.000 | td32727 | 10 | true | NULL | + 2020-02-01 00:00:08.000 | td32727 | 15 | true | NULL | + 2020-02-01 00:00:09.000 | td32727 | 5 | true | NULL | + 2020-02-01 00:00:09.000 | td32727 | 10 | true | NULL | + 2020-02-01 00:00:09.000 | td32727 | 15 | true | NULL | + 2020-02-01 00:00:10.000 | td32727 | 5 | true | NULL | + 2020-02-01 00:00:10.000 | td32727 | 10 | false | 10 | + 2020-02-01 00:00:10.000 | td32727 | 15 | true | NULL | + 2020-02-01 00:00:11.000 | td32727 | 5 | true | NULL | + 2020-02-01 00:00:11.000 | td32727 | 10 | true | NULL | + 2020-02-01 00:00:11.000 | td32727 | 15 | true | NULL | + 2020-02-01 00:00:12.000 | td32727 | 5 | true | NULL | + 2020-02-01 00:00:12.000 | td32727 | 10 | true | NULL | + 2020-02-01 00:00:12.000 | td32727 | 15 | true | NULL | + 2020-02-01 00:00:13.000 | td32727 | 5 | true | NULL | + 2020-02-01 00:00:13.000 | td32727 | 10 | true | NULL | + 2020-02-01 00:00:13.000 | td32727 | 15 | true | NULL | + 2020-02-01 00:00:14.000 | td32727 | 5 | true | NULL | + 2020-02-01 00:00:14.000 | td32727 | 10 | true | NULL | + 2020-02-01 00:00:14.000 | td32727 | 15 | true | NULL | + 2020-02-01 00:00:15.000 | td32727 | 5 | true | NULL | + 2020-02-01 00:00:15.000 | td32727 | 10 | true | NULL | + 2020-02-01 00:00:15.000 | td32727 | 15 | false | 15 | + 2020-02-01 00:00:16.000 | td32727 | 5 | true | NULL | + 2020-02-01 00:00:16.000 | td32727 | 10 | true | NULL | + 2020-02-01 00:00:16.000 | td32727 | 15 | true | NULL | + +taos> select _irowts as irowts ,tbname as table_name, c2 as c_c2, _isfilled as isfilled , interp(c1) as intp_c1 from test.td32727 partition by tbname,c2 range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill (next) order by irowts, c2; + irowts | table_name | c_c2 | isfilled | intp_c1 | +============================================================================================== + 2020-02-01 00:00:04.000 | td32727 | 5 | true | 5 | + 2020-02-01 00:00:04.000 | td32727 | 10 | true | 10 | + 2020-02-01 00:00:04.000 | td32727 | 15 | true | 15 | + 2020-02-01 00:00:05.000 | td32727 | 5 | false | 5 | + 2020-02-01 00:00:05.000 | td32727 | 10 | true | 10 | + 2020-02-01 00:00:05.000 | td32727 | 15 | true | 15 | + 2020-02-01 00:00:06.000 | td32727 | 10 | true | 10 | + 2020-02-01 00:00:06.000 | td32727 | 15 | true | 15 | + 2020-02-01 00:00:07.000 | td32727 | 10 | true | 10 | + 2020-02-01 00:00:07.000 | td32727 | 15 | true | 15 | + 2020-02-01 00:00:08.000 | td32727 | 10 | true | 10 | + 2020-02-01 00:00:08.000 | td32727 | 15 | true | 15 | + 2020-02-01 00:00:09.000 | td32727 | 10 | true | 10 | + 2020-02-01 00:00:09.000 | td32727 | 15 | true | 15 | + 2020-02-01 00:00:10.000 | td32727 | 10 | false | 10 | + 2020-02-01 00:00:10.000 | td32727 | 15 | true | 15 | + 2020-02-01 00:00:11.000 | td32727 | 15 | true | 15 | + 2020-02-01 00:00:12.000 | td32727 | 15 | true | 15 | + 2020-02-01 00:00:13.000 | td32727 | 15 | true | 15 | + 2020-02-01 00:00:14.000 | td32727 | 15 | true | 15 | + 2020-02-01 00:00:15.000 | td32727 | 15 | false | 15 | + +taos> select _irowts as irowts ,tbname as table_name, c2 as c_c2, _isfilled as isfilled , interp(c1) as intp_c1 from test.td32727 partition by tbname,c2 range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill (prev) order by irowts, c2; + irowts | table_name | c_c2 | isfilled | intp_c1 | +============================================================================================== + 2020-02-01 00:00:05.000 | td32727 | 5 | false | 5 | + 2020-02-01 00:00:06.000 | td32727 | 5 | true | 5 | + 2020-02-01 00:00:07.000 | td32727 | 5 | true | 5 | + 2020-02-01 00:00:08.000 | td32727 | 5 | true | 5 | + 2020-02-01 00:00:09.000 | td32727 | 5 | true | 5 | + 2020-02-01 00:00:10.000 | td32727 | 5 | true | 5 | + 2020-02-01 00:00:10.000 | td32727 | 10 | false | 10 | + 2020-02-01 00:00:11.000 | td32727 | 5 | true | 5 | + 2020-02-01 00:00:11.000 | td32727 | 10 | true | 10 | + 2020-02-01 00:00:12.000 | td32727 | 5 | true | 5 | + 2020-02-01 00:00:12.000 | td32727 | 10 | true | 10 | + 2020-02-01 00:00:13.000 | td32727 | 5 | true | 5 | + 2020-02-01 00:00:13.000 | td32727 | 10 | true | 10 | + 2020-02-01 00:00:14.000 | td32727 | 5 | true | 5 | + 2020-02-01 00:00:14.000 | td32727 | 10 | true | 10 | + 2020-02-01 00:00:15.000 | td32727 | 5 | true | 5 | + 2020-02-01 00:00:15.000 | td32727 | 10 | true | 10 | + 2020-02-01 00:00:15.000 | td32727 | 15 | false | 15 | + 2020-02-01 00:00:16.000 | td32727 | 5 | true | 5 | + 2020-02-01 00:00:16.000 | td32727 | 10 | true | 10 | + 2020-02-01 00:00:16.000 | td32727 | 15 | true | 15 | + +taos> select _irowts as irowts ,tbname as table_name, c2 as c_c2, _isfilled as isfilled , interp(c1) as intp_c1 from test.td32727 partition by tbname,c2 range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill (linear) order by irowts, c2; + irowts | table_name | c_c2 | isfilled | intp_c1 | +============================================================================================== + 2020-02-01 00:00:05.000 | td32727 | 5 | false | 5 | + 2020-02-01 00:00:10.000 | td32727 | 10 | false | 10 | + 2020-02-01 00:00:15.000 | td32727 | 15 | false | 15 | + +taos> select _irowts as irowts ,tbname as table_name, c2 as c_c2, _isfilled as isfilled , interp(c1) as intp_c1 from test.td32727 partition by tbname,c2 range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill (value, 1) order by irowts, c2; + irowts | table_name | c_c2 | isfilled | intp_c1 | +============================================================================================== + 2020-02-01 00:00:04.000 | td32727 | 5 | true | 1 | + 2020-02-01 00:00:04.000 | td32727 | 10 | true | 1 | + 2020-02-01 00:00:04.000 | td32727 | 15 | true | 1 | + 2020-02-01 00:00:05.000 | td32727 | 5 | false | 5 | + 2020-02-01 00:00:05.000 | td32727 | 10 | true | 1 | + 2020-02-01 00:00:05.000 | td32727 | 15 | true | 1 | + 2020-02-01 00:00:06.000 | td32727 | 5 | true | 1 | + 2020-02-01 00:00:06.000 | td32727 | 10 | true | 1 | + 2020-02-01 00:00:06.000 | td32727 | 15 | true | 1 | + 2020-02-01 00:00:07.000 | td32727 | 5 | true | 1 | + 2020-02-01 00:00:07.000 | td32727 | 10 | true | 1 | + 2020-02-01 00:00:07.000 | td32727 | 15 | true | 1 | + 2020-02-01 00:00:08.000 | td32727 | 5 | true | 1 | + 2020-02-01 00:00:08.000 | td32727 | 10 | true | 1 | + 2020-02-01 00:00:08.000 | td32727 | 15 | true | 1 | + 2020-02-01 00:00:09.000 | td32727 | 5 | true | 1 | + 2020-02-01 00:00:09.000 | td32727 | 10 | true | 1 | + 2020-02-01 00:00:09.000 | td32727 | 15 | true | 1 | + 2020-02-01 00:00:10.000 | td32727 | 5 | true | 1 | + 2020-02-01 00:00:10.000 | td32727 | 10 | false | 10 | + 2020-02-01 00:00:10.000 | td32727 | 15 | true | 1 | + 2020-02-01 00:00:11.000 | td32727 | 5 | true | 1 | + 2020-02-01 00:00:11.000 | td32727 | 10 | true | 1 | + 2020-02-01 00:00:11.000 | td32727 | 15 | true | 1 | + 2020-02-01 00:00:12.000 | td32727 | 5 | true | 1 | + 2020-02-01 00:00:12.000 | td32727 | 10 | true | 1 | + 2020-02-01 00:00:12.000 | td32727 | 15 | true | 1 | + 2020-02-01 00:00:13.000 | td32727 | 5 | true | 1 | + 2020-02-01 00:00:13.000 | td32727 | 10 | true | 1 | + 2020-02-01 00:00:13.000 | td32727 | 15 | true | 1 | + 2020-02-01 00:00:14.000 | td32727 | 5 | true | 1 | + 2020-02-01 00:00:14.000 | td32727 | 10 | true | 1 | + 2020-02-01 00:00:14.000 | td32727 | 15 | true | 1 | + 2020-02-01 00:00:15.000 | td32727 | 5 | true | 1 | + 2020-02-01 00:00:15.000 | td32727 | 10 | true | 1 | + 2020-02-01 00:00:15.000 | td32727 | 15 | false | 15 | + 2020-02-01 00:00:16.000 | td32727 | 5 | true | 1 | + 2020-02-01 00:00:16.000 | td32727 | 10 | true | 1 | + 2020-02-01 00:00:16.000 | td32727 | 15 | true | 1 | + +taos> select _irowts as irowts ,tbname as table_name, c2 as c_c2, c3 as c_c3, _isfilled as isfilled , interp(c1) as intp_c1 from test.td32727 partition by tbname,c2,c3 range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill (null) order by irowts, c2, c3; + irowts | table_name | c_c2 | c_c3 | isfilled | intp_c1 | +====================================================================================================================== + 2020-02-01 00:00:04.000 | td32727 | 5 | 5 | true | NULL | + 2020-02-01 00:00:04.000 | td32727 | 10 | 10 | true | NULL | + 2020-02-01 00:00:04.000 | td32727 | 15 | 15 | true | NULL | + 2020-02-01 00:00:05.000 | td32727 | 5 | 5 | false | 5 | + 2020-02-01 00:00:05.000 | td32727 | 10 | 10 | true | NULL | + 2020-02-01 00:00:05.000 | td32727 | 15 | 15 | true | NULL | + 2020-02-01 00:00:06.000 | td32727 | 5 | 5 | true | NULL | + 2020-02-01 00:00:06.000 | td32727 | 10 | 10 | true | NULL | + 2020-02-01 00:00:06.000 | td32727 | 15 | 15 | true | NULL | + 2020-02-01 00:00:07.000 | td32727 | 5 | 5 | true | NULL | + 2020-02-01 00:00:07.000 | td32727 | 10 | 10 | true | NULL | + 2020-02-01 00:00:07.000 | td32727 | 15 | 15 | true | NULL | + 2020-02-01 00:00:08.000 | td32727 | 5 | 5 | true | NULL | + 2020-02-01 00:00:08.000 | td32727 | 10 | 10 | true | NULL | + 2020-02-01 00:00:08.000 | td32727 | 15 | 15 | true | NULL | + 2020-02-01 00:00:09.000 | td32727 | 5 | 5 | true | NULL | + 2020-02-01 00:00:09.000 | td32727 | 10 | 10 | true | NULL | + 2020-02-01 00:00:09.000 | td32727 | 15 | 15 | true | NULL | + 2020-02-01 00:00:10.000 | td32727 | 5 | 5 | true | NULL | + 2020-02-01 00:00:10.000 | td32727 | 10 | 10 | false | 10 | + 2020-02-01 00:00:10.000 | td32727 | 15 | 15 | true | NULL | + 2020-02-01 00:00:11.000 | td32727 | 5 | 5 | true | NULL | + 2020-02-01 00:00:11.000 | td32727 | 10 | 10 | true | NULL | + 2020-02-01 00:00:11.000 | td32727 | 15 | 15 | true | NULL | + 2020-02-01 00:00:12.000 | td32727 | 5 | 5 | true | NULL | + 2020-02-01 00:00:12.000 | td32727 | 10 | 10 | true | NULL | + 2020-02-01 00:00:12.000 | td32727 | 15 | 15 | true | NULL | + 2020-02-01 00:00:13.000 | td32727 | 5 | 5 | true | NULL | + 2020-02-01 00:00:13.000 | td32727 | 10 | 10 | true | NULL | + 2020-02-01 00:00:13.000 | td32727 | 15 | 15 | true | NULL | + 2020-02-01 00:00:14.000 | td32727 | 5 | 5 | true | NULL | + 2020-02-01 00:00:14.000 | td32727 | 10 | 10 | true | NULL | + 2020-02-01 00:00:14.000 | td32727 | 15 | 15 | true | NULL | + 2020-02-01 00:00:15.000 | td32727 | 5 | 5 | true | NULL | + 2020-02-01 00:00:15.000 | td32727 | 10 | 10 | true | NULL | + 2020-02-01 00:00:15.000 | td32727 | 15 | 15 | false | 15 | + 2020-02-01 00:00:16.000 | td32727 | 5 | 5 | true | NULL | + 2020-02-01 00:00:16.000 | td32727 | 10 | 10 | true | NULL | + 2020-02-01 00:00:16.000 | td32727 | 15 | 15 | true | NULL | + +taos> select _irowts as irowts ,tbname as table_name, c2 as c_c2, c3 as c_c3, _isfilled as isfilled , interp(c1) as intp_c1 from test.td32727 partition by tbname,c2,c3 range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill (next) order by irowts, c2, c3; + irowts | table_name | c_c2 | c_c3 | isfilled | intp_c1 | +====================================================================================================================== + 2020-02-01 00:00:04.000 | td32727 | 5 | 5 | true | 5 | + 2020-02-01 00:00:04.000 | td32727 | 10 | 10 | true | 10 | + 2020-02-01 00:00:04.000 | td32727 | 15 | 15 | true | 15 | + 2020-02-01 00:00:05.000 | td32727 | 5 | 5 | false | 5 | + 2020-02-01 00:00:05.000 | td32727 | 10 | 10 | true | 10 | + 2020-02-01 00:00:05.000 | td32727 | 15 | 15 | true | 15 | + 2020-02-01 00:00:06.000 | td32727 | 10 | 10 | true | 10 | + 2020-02-01 00:00:06.000 | td32727 | 15 | 15 | true | 15 | + 2020-02-01 00:00:07.000 | td32727 | 10 | 10 | true | 10 | + 2020-02-01 00:00:07.000 | td32727 | 15 | 15 | true | 15 | + 2020-02-01 00:00:08.000 | td32727 | 10 | 10 | true | 10 | + 2020-02-01 00:00:08.000 | td32727 | 15 | 15 | true | 15 | + 2020-02-01 00:00:09.000 | td32727 | 10 | 10 | true | 10 | + 2020-02-01 00:00:09.000 | td32727 | 15 | 15 | true | 15 | + 2020-02-01 00:00:10.000 | td32727 | 10 | 10 | false | 10 | + 2020-02-01 00:00:10.000 | td32727 | 15 | 15 | true | 15 | + 2020-02-01 00:00:11.000 | td32727 | 15 | 15 | true | 15 | + 2020-02-01 00:00:12.000 | td32727 | 15 | 15 | true | 15 | + 2020-02-01 00:00:13.000 | td32727 | 15 | 15 | true | 15 | + 2020-02-01 00:00:14.000 | td32727 | 15 | 15 | true | 15 | + 2020-02-01 00:00:15.000 | td32727 | 15 | 15 | false | 15 | + +taos> select _irowts as irowts ,tbname as table_name, c2 as c_c2, c3 as c_c3, _isfilled as isfilled , interp(c1) as intp_c1 from test.td32727 partition by tbname,c2,c3 range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill (prev) order by irowts, c2, c3; + irowts | table_name | c_c2 | c_c3 | isfilled | intp_c1 | +====================================================================================================================== + 2020-02-01 00:00:05.000 | td32727 | 5 | 5 | false | 5 | + 2020-02-01 00:00:06.000 | td32727 | 5 | 5 | true | 5 | + 2020-02-01 00:00:07.000 | td32727 | 5 | 5 | true | 5 | + 2020-02-01 00:00:08.000 | td32727 | 5 | 5 | true | 5 | + 2020-02-01 00:00:09.000 | td32727 | 5 | 5 | true | 5 | + 2020-02-01 00:00:10.000 | td32727 | 5 | 5 | true | 5 | + 2020-02-01 00:00:10.000 | td32727 | 10 | 10 | false | 10 | + 2020-02-01 00:00:11.000 | td32727 | 5 | 5 | true | 5 | + 2020-02-01 00:00:11.000 | td32727 | 10 | 10 | true | 10 | + 2020-02-01 00:00:12.000 | td32727 | 5 | 5 | true | 5 | + 2020-02-01 00:00:12.000 | td32727 | 10 | 10 | true | 10 | + 2020-02-01 00:00:13.000 | td32727 | 5 | 5 | true | 5 | + 2020-02-01 00:00:13.000 | td32727 | 10 | 10 | true | 10 | + 2020-02-01 00:00:14.000 | td32727 | 5 | 5 | true | 5 | + 2020-02-01 00:00:14.000 | td32727 | 10 | 10 | true | 10 | + 2020-02-01 00:00:15.000 | td32727 | 5 | 5 | true | 5 | + 2020-02-01 00:00:15.000 | td32727 | 10 | 10 | true | 10 | + 2020-02-01 00:00:15.000 | td32727 | 15 | 15 | false | 15 | + 2020-02-01 00:00:16.000 | td32727 | 5 | 5 | true | 5 | + 2020-02-01 00:00:16.000 | td32727 | 10 | 10 | true | 10 | + 2020-02-01 00:00:16.000 | td32727 | 15 | 15 | true | 15 | + +taos> select _irowts as irowts ,tbname as table_name, c2 as c_c2, c3 as c_c3, _isfilled as isfilled , interp(c1) as intp_c1 from test.td32727 partition by tbname,c2,c3 range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill (linear) order by irowts, c2, c3; + irowts | table_name | c_c2 | c_c3 | isfilled | intp_c1 | +====================================================================================================================== + 2020-02-01 00:00:05.000 | td32727 | 5 | 5 | false | 5 | + 2020-02-01 00:00:10.000 | td32727 | 10 | 10 | false | 10 | + 2020-02-01 00:00:15.000 | td32727 | 15 | 15 | false | 15 | + +taos> select _irowts as irowts ,tbname as table_name, c2 as c_c2, c3 as c_c3, _isfilled as isfilled , interp(c1) as intp_c1 from test.td32727 partition by tbname,c2,c3 range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill (value, 1) order by irowts, c2, c3; + irowts | table_name | c_c2 | c_c3 | isfilled | intp_c1 | +====================================================================================================================== + 2020-02-01 00:00:04.000 | td32727 | 5 | 5 | true | 1 | + 2020-02-01 00:00:04.000 | td32727 | 10 | 10 | true | 1 | + 2020-02-01 00:00:04.000 | td32727 | 15 | 15 | true | 1 | + 2020-02-01 00:00:05.000 | td32727 | 5 | 5 | false | 5 | + 2020-02-01 00:00:05.000 | td32727 | 10 | 10 | true | 1 | + 2020-02-01 00:00:05.000 | td32727 | 15 | 15 | true | 1 | + 2020-02-01 00:00:06.000 | td32727 | 5 | 5 | true | 1 | + 2020-02-01 00:00:06.000 | td32727 | 10 | 10 | true | 1 | + 2020-02-01 00:00:06.000 | td32727 | 15 | 15 | true | 1 | + 2020-02-01 00:00:07.000 | td32727 | 5 | 5 | true | 1 | + 2020-02-01 00:00:07.000 | td32727 | 10 | 10 | true | 1 | + 2020-02-01 00:00:07.000 | td32727 | 15 | 15 | true | 1 | + 2020-02-01 00:00:08.000 | td32727 | 5 | 5 | true | 1 | + 2020-02-01 00:00:08.000 | td32727 | 10 | 10 | true | 1 | + 2020-02-01 00:00:08.000 | td32727 | 15 | 15 | true | 1 | + 2020-02-01 00:00:09.000 | td32727 | 5 | 5 | true | 1 | + 2020-02-01 00:00:09.000 | td32727 | 10 | 10 | true | 1 | + 2020-02-01 00:00:09.000 | td32727 | 15 | 15 | true | 1 | + 2020-02-01 00:00:10.000 | td32727 | 5 | 5 | true | 1 | + 2020-02-01 00:00:10.000 | td32727 | 10 | 10 | false | 10 | + 2020-02-01 00:00:10.000 | td32727 | 15 | 15 | true | 1 | + 2020-02-01 00:00:11.000 | td32727 | 5 | 5 | true | 1 | + 2020-02-01 00:00:11.000 | td32727 | 10 | 10 | true | 1 | + 2020-02-01 00:00:11.000 | td32727 | 15 | 15 | true | 1 | + 2020-02-01 00:00:12.000 | td32727 | 5 | 5 | true | 1 | + 2020-02-01 00:00:12.000 | td32727 | 10 | 10 | true | 1 | + 2020-02-01 00:00:12.000 | td32727 | 15 | 15 | true | 1 | + 2020-02-01 00:00:13.000 | td32727 | 5 | 5 | true | 1 | + 2020-02-01 00:00:13.000 | td32727 | 10 | 10 | true | 1 | + 2020-02-01 00:00:13.000 | td32727 | 15 | 15 | true | 1 | + 2020-02-01 00:00:14.000 | td32727 | 5 | 5 | true | 1 | + 2020-02-01 00:00:14.000 | td32727 | 10 | 10 | true | 1 | + 2020-02-01 00:00:14.000 | td32727 | 15 | 15 | true | 1 | + 2020-02-01 00:00:15.000 | td32727 | 5 | 5 | true | 1 | + 2020-02-01 00:00:15.000 | td32727 | 10 | 10 | true | 1 | + 2020-02-01 00:00:15.000 | td32727 | 15 | 15 | false | 15 | + 2020-02-01 00:00:16.000 | td32727 | 5 | 5 | true | 1 | + 2020-02-01 00:00:16.000 | td32727 | 10 | 10 | true | 1 | + 2020-02-01 00:00:16.000 | td32727 | 15 | 15 | true | 1 | + diff --git a/tests/army/query/function/in/interp.in b/tests/army/query/function/in/interp.in new file mode 100644 index 000000000000..4825ab46b167 --- /dev/null +++ b/tests/army/query/function/in/interp.in @@ -0,0 +1,15 @@ +select _irowts as irowts ,tbname as table_name, _isfilled as isfilled , interp(c1) as intp_c1 from test.td32727 partition by tbname range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill (null) order by irowts; +select _irowts as irowts ,tbname as table_name, _isfilled as isfilled , interp(c1) as intp_c1 from test.td32727 partition by tbname range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill (next) order by irowts; +select _irowts as irowts ,tbname as table_name, _isfilled as isfilled , interp(c1) as intp_c1 from test.td32727 partition by tbname range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill (prev) order by irowts; +select _irowts as irowts ,tbname as table_name, _isfilled as isfilled , interp(c1) as intp_c1 from test.td32727 partition by tbname range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill (linear) order by irowts; +select _irowts as irowts ,tbname as table_name, _isfilled as isfilled , interp(c1) as intp_c1 from test.td32727 partition by tbname range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill (value, 1) order by irowts; +select _irowts as irowts ,tbname as table_name, c2 as c_c2, _isfilled as isfilled , interp(c1) as intp_c1 from test.td32727 partition by tbname,c2 range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill (null) order by irowts, c2; +select _irowts as irowts ,tbname as table_name, c2 as c_c2, _isfilled as isfilled , interp(c1) as intp_c1 from test.td32727 partition by tbname,c2 range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill (next) order by irowts, c2; +select _irowts as irowts ,tbname as table_name, c2 as c_c2, _isfilled as isfilled , interp(c1) as intp_c1 from test.td32727 partition by tbname,c2 range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill (prev) order by irowts, c2; +select _irowts as irowts ,tbname as table_name, c2 as c_c2, _isfilled as isfilled , interp(c1) as intp_c1 from test.td32727 partition by tbname,c2 range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill (linear) order by irowts, c2; +select _irowts as irowts ,tbname as table_name, c2 as c_c2, _isfilled as isfilled , interp(c1) as intp_c1 from test.td32727 partition by tbname,c2 range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill (value, 1) order by irowts, c2; +select _irowts as irowts ,tbname as table_name, c2 as c_c2, c3 as c_c3, _isfilled as isfilled , interp(c1) as intp_c1 from test.td32727 partition by tbname,c2,c3 range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill (null) order by irowts, c2, c3; +select _irowts as irowts ,tbname as table_name, c2 as c_c2, c3 as c_c3, _isfilled as isfilled , interp(c1) as intp_c1 from test.td32727 partition by tbname,c2,c3 range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill (next) order by irowts, c2, c3; +select _irowts as irowts ,tbname as table_name, c2 as c_c2, c3 as c_c3, _isfilled as isfilled , interp(c1) as intp_c1 from test.td32727 partition by tbname,c2,c3 range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill (prev) order by irowts, c2, c3; +select _irowts as irowts ,tbname as table_name, c2 as c_c2, c3 as c_c3, _isfilled as isfilled , interp(c1) as intp_c1 from test.td32727 partition by tbname,c2,c3 range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill (linear) order by irowts, c2, c3; +select _irowts as irowts ,tbname as table_name, c2 as c_c2, c3 as c_c3, _isfilled as isfilled , interp(c1) as intp_c1 from test.td32727 partition by tbname,c2,c3 range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill (value, 1) order by irowts, c2, c3; diff --git a/tests/army/query/function/test_interp.py b/tests/army/query/function/test_interp.py new file mode 100644 index 000000000000..f903e7be7340 --- /dev/null +++ b/tests/army/query/function/test_interp.py @@ -0,0 +1,72 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +from frame import etool +from frame.etool import * +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame.common import * + +class TDTestCase(TBase): + updatecfgDict = { + "keepColumnName": "1", + "ttlChangeOnWrite": "1", + "querySmaOptimize": "1", + "slowLogScope": "none", + "queryBufferSize": 10240 + } + + def insert_data(self): + tdLog.printNoPrefix("==========step1:create table") + + tdSql.execute("create database test keep 36500") + tdSql.execute("use test") + tdSql.execute( + f'''create table if not exists test.td32727 + (ts timestamp, c0 tinyint, c1 smallint, c2 int, c3 bigint, c4 double, c5 float, c6 bool, c7 varchar(10), c8 nchar(10), c9 tinyint unsigned, c10 smallint unsigned, c11 int unsigned, c12 bigint unsigned) + ''' + ) + + tdLog.printNoPrefix("==========step2:insert data") + + tdSql.execute(f"insert into test.td32727 values ('2020-02-01 00:00:05', 5, 5, 5, 5, 5.0, 5.0, true, 'varchar', 'nchar', 5, 5, 5, 5)") + tdSql.execute(f"insert into test.td32727 values ('2020-02-01 00:00:10', 10, 10, 10, 10, 10.0, 10.0, true, 'varchar', 'nchar', 10, 10, 10, 10)") + tdSql.execute(f"insert into test.td32727 values ('2020-02-01 00:00:15', 15, 15, 15, 15, 15.0, 15.0, true, 'varchar', 'nchar', 15, 15, 15, 15)") + + + def test_normal_query_new(self, testCase): + # read sql from .sql file and execute + tdLog.info("test normal query.") + self.sqlFile = etool.curFile(__file__, f"in/{testCase}.in") + self.ansFile = etool.curFile(__file__, f"ans/{testCase}.csv") + + tdCom.compare_testcase_result(self.sqlFile, self.ansFile, testCase) + + def test_interp(self): + self.test_normal_query_new("interp") + + def run(self): + tdLog.debug(f"start to excute {__file__}") + + self.insert_data() + + # math function + self.test_interp() + + tdLog.success(f"{__file__} successfully executed") + + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index abc470e73f77..8d15def68f2f 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -16,6 +16,7 @@ ,,y,army,./pytest.sh python3 ./test.py -f query/function/test_func_elapsed.py ,,y,army,./pytest.sh python3 ./test.py -f query/function/test_function.py ,,y,army,./pytest.sh python3 ./test.py -f query/function/test_resinfo.py +,,y,army,./pytest.sh python3 ./test.py -f query/function/test_interp.py ,,y,army,./pytest.sh python3 ./test.py -f query/function/concat.py ,,y,army,./pytest.sh python3 ./test.py -f query/function/cast.py ,,y,army,./pytest.sh python3 ./test.py -f query/test_join.py From 2d310221b34327b2d702c56b11e76409f67484f2 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Thu, 31 Oct 2024 10:03:43 +0800 Subject: [PATCH 495/695] enh:[TD-32166]refactor code in sml --- source/client/src/clientSml.c | 72 +++++++++++++------------------ source/client/src/clientSmlJson.c | 3 +- 2 files changed, 30 insertions(+), 45 deletions(-) diff --git a/source/client/src/clientSml.c b/source/client/src/clientSml.c index 9d3b28e10578..e8221c8b8d59 100644 --- a/source/client/src/clientSml.c +++ b/source/client/src/clientSml.c @@ -138,7 +138,7 @@ void smlBuildInvalidDataMsg(SSmlMsgBuf *pBuf, const char *msg1, const char *msg2 if (pBuf->buf == NULL) { return; } - (void)memset(pBuf->buf, 0, pBuf->len); + pBuf->buf[0] = 0; if (msg1) { (void)strncat(pBuf->buf, msg1, pBuf->len - 1); } @@ -475,7 +475,7 @@ static int32_t smlParseTableName(SArray *tags, char *childTableName, char *tbnam } } if (autoChildName) { - (void)memset(childTableName, 0, TSDB_TABLE_NAME_LEN); + childTableName[0] = '\0'; for (int i = 0; i < taosArrayGetSize(tags); i++) { SSmlKv *tag = (SSmlKv *)taosArrayGet(tags, i); SML_CHECK_NULL(tag); @@ -499,7 +499,6 @@ static int32_t smlParseTableName(SArray *tags, char *childTableName, char *tbnam SML_CHECK_NULL(tag); // handle child table name if (childTableNameLen == tag->keyLen && strncmp(tag->key, tbnameKey, tag->keyLen) == 0) { - (void)memset(childTableName, 0, TSDB_TABLE_NAME_LEN); tstrncpy(childTableName, tag->value, TMIN(TSDB_TABLE_NAME_LEN, tag->length + 1)); if (tsSmlDot2Underline) { smlStrReplace(childTableName, strlen(childTableName)); @@ -524,8 +523,7 @@ int32_t smlSetCTableName(SSmlTableInfo *oneTable, char *tbnameKey) { dst = taosArrayDup(oneTable->tags, NULL); SML_CHECK_NULL(dst); if (oneTable->sTableNameLen >= TSDB_TABLE_NAME_LEN) { - code = TSDB_CODE_SML_INTERNAL_ERROR; - goto END; + SML_CHECK_CODE(TSDB_CODE_SML_INTERNAL_ERROR); } char superName[TSDB_TABLE_NAME_LEN] = {0}; RandTableName rName = {dst, NULL, (uint8_t)oneTable->sTableNameLen, oneTable->childTableName}; @@ -676,8 +674,9 @@ int32_t smlGetMeta(SSmlHandle *info, const void *measure, int32_t measureLen, ST conn.requestId = info->pRequest->requestId; conn.requestObjRefId = info->pRequest->self; conn.mgmtEps = getEpSet_s(&info->taos->pAppInfo->mgmtEp); - (void)memset(pName.tname, 0, TSDB_TABLE_NAME_LEN); + int32_t len = TMIN(measureLen, TSDB_TABLE_NAME_LEN - 1); (void)memcpy(pName.tname, measure, measureLen); + pName.tname[len] = 0; return catalogGetSTableMeta(info->pCatalog, &conn, &pName, pTableMeta); } @@ -766,8 +765,7 @@ static int32_t smlProcessSchemaAction(SSmlHandle *info, SSchema *schemaField, SH SSmlKv *kv = (SSmlKv *)taosArrayGet(checkDumplicateCols, j); SML_CHECK_NULL(kv); if (taosHashGet(schemaHash, kv->key, kv->keyLen) != NULL) { - code = TSDB_CODE_PAR_DUPLICATED_COLUMN; - goto END; + SML_CHECK_CODE(TSDB_CODE_PAR_DUPLICATED_COLUMN); } } END: @@ -788,8 +786,7 @@ static int32_t smlCheckMeta(SSchema *schema, int32_t length, SArray *cols, bool SSmlKv *kv = (SSmlKv *)taosArrayGet(cols, i); SML_CHECK_NULL(kv); if (taosHashGet(hashTmp, kv->key, kv->keyLen) == NULL) { - code = TSDB_CODE_SML_INVALID_DATA; - goto END; + SML_CHECK_CODE(TSDB_CODE_SML_INVALID_DATA); } } @@ -810,7 +807,7 @@ static int32_t getBytes(uint8_t type, int32_t length) { static int32_t smlBuildFieldsList(SSmlHandle *info, SSchema *schemaField, SHashObj *schemaHash, SArray *cols, SArray *results, int32_t numOfCols, bool isTag) { int32_t code = TSDB_CODE_SUCCESS; - int32_t lino = TSDB_CODE_SUCCESS; + int32_t lino = 0; for (int j = 0; j < taosArrayGetSize(cols); ++j) { SSmlKv *kv = (SSmlKv *)taosArrayGet(cols, j); SML_CHECK_NULL(kv); @@ -825,9 +822,7 @@ static int32_t smlBuildFieldsList(SSmlHandle *info, SSchema *schemaField, SHashO } else if (action == SCHEMA_ACTION_CHANGE_COLUMN_SIZE || action == SCHEMA_ACTION_CHANGE_TAG_SIZE) { uint16_t *index = (uint16_t *)taosHashGet(schemaHash, kv->key, kv->keyLen); if (index == NULL) { - uError("smlBuildFieldsList get error, key:%s", kv->key); - code = TSDB_CODE_SML_INVALID_DATA; - goto END; + SML_CHECK_CODE(TSDB_CODE_SML_INVALID_DATA); } uint16_t newIndex = *index; if (isTag) newIndex -= numOfCols; @@ -894,17 +889,14 @@ static int32_t smlSendMetaMsg(SSmlHandle *info, SName *pName, SArray *pColumns, pSql = (action == SCHEMA_ACTION_ADD_COLUMN) ? "sml_add_column" : "sml_modify_column_size"; smlBuildCreateStbReq(&pReq, pTableMeta->sversion + 1, pTableMeta->tversion, pTableMeta->uid, TD_REQ_FROM_TAOX); } else { - uError("SML:0x%" PRIx64 " invalid action:%d", info->id, action); - code = TSDB_CODE_SML_INVALID_DATA; - goto END; + SML_CHECK_CODE(TSDB_CODE_SML_INVALID_DATA); } SML_CHECK_CODE(buildRequest(info->taos->id, pSql, strlen(pSql), NULL, false, &pRequest, 0)); pRequest->syncQuery = true; if (!pRequest->pDb) { - code = TSDB_CODE_PAR_DB_NOT_SPECIFIED; - goto END; + SML_CHECK_CODE(TSDB_CODE_PAR_DB_NOT_SPECIFIED); } if (pReq.numOfTags == 0) { @@ -924,15 +916,16 @@ static int32_t smlSendMetaMsg(SSmlHandle *info, SName *pName, SArray *pColumns, pCmdMsg.msgType = TDMT_MND_CREATE_STB; pCmdMsg.msgLen = tSerializeSMCreateStbReq(NULL, 0, &pReq); if (pCmdMsg.msgLen < 0) { - code = pCmdMsg.msgLen; - goto END; + uError("failed to serialize create stable request1, code:%d, terrno:%d", pCmdMsg.msgLen, terrno); + SML_CHECK_CODE(TSDB_CODE_SML_INVALID_DATA); } pCmdMsg.pMsg = taosMemoryMalloc(pCmdMsg.msgLen); SML_CHECK_NULL(pCmdMsg.pMsg); code = tSerializeSMCreateStbReq(pCmdMsg.pMsg, pCmdMsg.msgLen, &pReq); if (code < 0) { taosMemoryFree(pCmdMsg.pMsg); - goto END; + uError("failed to serialize create stable request2, code:%d, terrno:%d", code, terrno); + SML_CHECK_CODE(TSDB_CODE_SML_INVALID_DATA); } SQuery pQuery = {0}; @@ -1108,8 +1101,9 @@ static int32_t smlModifyDBSchemas(SSmlHandle *info) { PROCESS_SLASH_IN_MEASUREMENT(measure, superTableLen); } smlStrReplace(measure, superTableLen); - (void)memset(pName.tname, 0, TSDB_TABLE_NAME_LEN); - (void)memcpy(pName.tname, measure, TMIN(superTableLen, TSDB_TABLE_NAME_LEN - 1)); + size_t nameLen = TMIN(superTableLen, TSDB_TABLE_NAME_LEN - 1); + (void)memcpy(pName.tname, measure, nameLen); + pName.tname[nameLen] = '\0'; taosMemoryFree(measure); code = catalogGetSTableMeta(info->pCatalog, &conn, &pName, &pTableMeta); @@ -1118,8 +1112,7 @@ static int32_t smlModifyDBSchemas(SSmlHandle *info) { SML_CHECK_CODE(smlCreateTable(info, &conn, sTableData, &pName, &pTableMeta)); } else if (code == TSDB_CODE_SUCCESS) { if (smlIsPKTable(pTableMeta)) { - code = TSDB_CODE_SML_NOT_SUPPORT_PK; - goto END; + SML_CHECK_CODE(TSDB_CODE_SML_NOT_SUPPORT_PK); } hashTmp = taosHashInit(pTableMeta->tableInfo.numOfTags, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK); @@ -1176,8 +1169,7 @@ static int32_t smlInsertMeta(SHashObj *metaHash, SArray *metaArray, SArray *cols if (ret == 0) { SML_CHECK_NULL(taosArrayPush(metaArray, kv)); if (taosHashGet(checkDuplicate, kv->key, kv->keyLen) != NULL) { - code = TSDB_CODE_PAR_DUPLICATED_COLUMN; - goto END; + SML_CHECK_CODE(TSDB_CODE_PAR_DUPLICATED_COLUMN); } } else if (terrno == TSDB_CODE_DUP_KEY) { return TSDB_CODE_PAR_DUPLICATED_COLUMN; @@ -1208,8 +1200,7 @@ static int32_t smlUpdateMeta(SHashObj *metaHash, SArray *metaArray, SArray *cols } if (kv->type != value->type) { smlBuildInvalidDataMsg(msg, "the type is not the same like before", kv->key); - code = TSDB_CODE_SML_NOT_SAME_TYPE; - goto END; + SML_CHECK_CODE(TSDB_CODE_SML_NOT_SAME_TYPE); } if (IS_VAR_DATA_TYPE(kv->type) && (kv->length > value->length)) { // update string len, if bigger @@ -1219,16 +1210,13 @@ static int32_t smlUpdateMeta(SHashObj *metaHash, SArray *metaArray, SArray *cols size_t tmp = taosArrayGetSize(metaArray); if (tmp > INT16_MAX) { smlBuildInvalidDataMsg(msg, "too many cols or tags", kv->key); - uError("too many cols or tags"); - code = TSDB_CODE_SML_INVALID_DATA; - goto END; + SML_CHECK_CODE(TSDB_CODE_SML_INVALID_DATA); } int16_t size = tmp; SML_CHECK_CODE(taosHashPut(metaHash, kv->key, kv->keyLen, &size, SHORT_BYTES)); SML_CHECK_NULL(taosArrayPush(metaArray, kv)); if (taosHashGet(checkDuplicate, kv->key, kv->keyLen) != NULL) { - code = TSDB_CODE_PAR_DUPLICATED_COLUMN; - goto END; + SML_CHECK_CODE(TSDB_CODE_PAR_DUPLICATED_COLUMN); } } } @@ -1349,8 +1337,7 @@ static int32_t smlPushCols(SArray *colsArray, SArray *cols) { terrno = 0; code = taosHashPut(kvHash, kv->key, kv->keyLen, &kv, POINTER_BYTES); if (terrno == TSDB_CODE_DUP_KEY) { - code = TSDB_CODE_PAR_DUPLICATED_COLUMN; - goto END; + SML_CHECK_CODE(TSDB_CODE_PAR_DUPLICATED_COLUMN); } SML_CHECK_CODE(code); } @@ -1417,8 +1404,7 @@ static int32_t smlParseEnd(SSmlHandle *info) { code = taosHashPut(info->superTables, elements->measure, elements->measureLen, &meta, POINTER_BYTES); if (code != TSDB_CODE_SUCCESS) { smlDestroySTableMeta(&meta); - uError("SML:0x%" PRIx64 " put measure to hash failed", info->id); - goto END; + SML_CHECK_CODE(code); } SML_CHECK_CODE(smlInsertMeta(meta->tagHash, meta->tags, tinfo->tags, NULL)); SML_CHECK_CODE(smlInsertMeta(meta->colHash, meta->cols, elements->colArray, meta->tagHash)); @@ -1459,8 +1445,8 @@ static int32_t smlInsertData(SSmlHandle *info) { PROCESS_SLASH_IN_MEASUREMENT(measure, measureLen); } smlStrReplace(measure, measureLen); - (void)memset(pName.tname, 0, TSDB_TABLE_NAME_LEN); (void)memcpy(pName.tname, measure, measureLen); + pName.tname[measureLen] = '\0'; if (info->pRequest->tableList == NULL) { info->pRequest->tableList = taosArrayInit(1, sizeof(SName)); @@ -1485,8 +1471,7 @@ static int32_t smlInsertData(SSmlHandle *info) { (SSmlSTableMeta **)taosHashGet(info->superTables, tableData->sTableName, tableData->sTableNameLen); if (unlikely(NULL == pMeta || NULL == *pMeta || NULL == (*pMeta)->tableMeta)) { uError("SML:0x%" PRIx64 " %s NULL == pMeta. table name: %s", info->id, __FUNCTION__, tableData->childTableName); - code = TSDB_CODE_SML_INTERNAL_ERROR; - goto END; + SML_CHECK_CODE(TSDB_CODE_SML_INTERNAL_ERROR); } // use tablemeta of stable to save vgid and uid of child table @@ -1565,12 +1550,13 @@ int32_t smlClearForRerun(SSmlHandle *info) { } static void printRaw(int64_t id, int lineNum, int numLines, ELogLevel level, char* data, int32_t len){ - char *print = taosMemoryCalloc(len + 1, 1); + char *print = taosMemoryMalloc(len + 1); if (print == NULL) { uError("SML:0x%" PRIx64 " smlParseLine failed. code : %d", id, terrno); return; } (void)memcpy(print, data, len); + print[len] = '\0'; if (level == DEBUG_DEBUG){ uDebug("SML:0x%" PRIx64 " smlParseLine is raw, line %d/%d : %s", id, lineNum, numLines, print); }else if (level == DEBUG_ERROR){ diff --git a/source/client/src/clientSmlJson.c b/source/client/src/clientSmlJson.c index 2dcc36eada13..9a27a30d84fe 100644 --- a/source/client/src/clientSmlJson.c +++ b/source/client/src/clientSmlJson.c @@ -470,8 +470,7 @@ static int32_t smlParseJSONStringExt(SSmlHandle *info, cJSON *root, SSmlLineInfo uError("SML:0x%" PRIx64 " Unable to parse timestamp from JSON payload %s %s %" PRId64, info->id, info->msgBuf.buf,tmp, ts); taosMemoryFree(tmp); } - code = TSDB_CODE_INVALID_TIMESTAMP; - goto END; + SML_CHECK_CODE(TSDB_CODE_INVALID_TIMESTAMP); } SSmlKv kvTs = {0}; smlBuildTsKv(&kvTs, ts); From b701665ac6db40ee49082687ceb07b73f147efc7 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Thu, 31 Oct 2024 10:29:59 +0800 Subject: [PATCH 496/695] fix: compile issue --- include/common/ttypes.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/common/ttypes.h b/include/common/ttypes.h index 76c59f37bb6e..087e5931952a 100644 --- a/include/common/ttypes.h +++ b/include/common/ttypes.h @@ -241,14 +241,14 @@ typedef struct { case TSDB_DATA_TYPE_FLOAT: { \ int32_t n = snprintf(_output, (int32_t)(_outputBytes), "%f", *(float *)(_input)); \ if (n >= (_outputBytes)) { \ - snprintf(_output, (int32_t)(_outputBytes), "%*.7f", (_outputBytes) - 1, *(float *)(_input)); \ + snprintf(_output, (int32_t)(_outputBytes), "%*.7f", (int32_t)((_outputBytes) - 1), *(float *)(_input)); \ } \ break; \ } \ case TSDB_DATA_TYPE_DOUBLE: { \ int32_t n = snprintf(_output, (int32_t)(_outputBytes), "%f", *(double *)(_input)); \ if (n >= (_outputBytes)) { \ - snprintf(_output, (int32_t)(_outputBytes), "%*.7f", (_outputBytes) - 1, *(double *)(_input)); \ + snprintf(_output, (int32_t)(_outputBytes), "%*.7f", (int32_t)((_outputBytes) - 1), *(double *)(_input)); \ } \ break; \ } \ From be82bbf90ca87b1cb6a80cb78810994e354baac0 Mon Sep 17 00:00:00 2001 From: yanyuxing Date: Thu, 31 Oct 2024 10:46:39 +0800 Subject: [PATCH 497/695] feat(packaging): add client install summary information --- packaging/tools/mac_install_summary_client.txt | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 packaging/tools/mac_install_summary_client.txt diff --git a/packaging/tools/mac_install_summary_client.txt b/packaging/tools/mac_install_summary_client.txt new file mode 100644 index 000000000000..f49703c55501 --- /dev/null +++ b/packaging/tools/mac_install_summary_client.txt @@ -0,0 +1,4 @@ +TDengine client is installed successfully. Please open a terminal and execute the commands below: + +To configure TDengine client, sudo vi /etc/taos/taos.cfg +To access TDengine command line interface, taos -h YouServerName \ No newline at end of file From ad83a9a6509244e1c04ec53de5a4eb2d2d5f9e45 Mon Sep 17 00:00:00 2001 From: xsren <285808407@qq.com> Date: Thu, 31 Oct 2024 11:16:39 +0800 Subject: [PATCH 498/695] fix: reset offset when trimdatablock --- source/common/src/tdatablock.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c index c185ac9d8624..49dd9948f2a2 100644 --- a/source/common/src/tdatablock.c +++ b/source/common/src/tdatablock.c @@ -114,16 +114,7 @@ int32_t colDataSetVal(SColumnInfoData* pColumnInfoData, uint32_t rowIndex, const if (IS_VAR_DATA_TYPE(type)) { int32_t dataLen = getDataLen(type, pData); if (pColumnInfoData->varmeta.offset[rowIndex] > 0) { - if (rowIndex == 0) { - pColumnInfoData->varmeta.length = 0; - } else { - int32_t start = pColumnInfoData->varmeta.offset[rowIndex - 1]; - int32_t lastDataLen = getDataLen(type, pColumnInfoData->pData + start); - if (start + lastDataLen < pColumnInfoData->varmeta.length) { - uInfo("column data is reassigned, row:%d, offset:%d, length:%d", rowIndex, start, lastDataLen); - pColumnInfoData->varmeta.length = start + lastDataLen; - } - } + pColumnInfoData->varmeta.length = pColumnInfoData->varmeta.offset[rowIndex]; } SVarColAttr* pAttr = &pColumnInfoData->varmeta; @@ -3391,6 +3382,7 @@ int32_t trimDataBlock(SSDataBlock* pBlock, int32_t totalRows, const bool* pBoolL } memcpy(p2, p1, len); + pDst->varmeta.offset[numOfRows] = -1; code = colDataSetVal(pDst, numOfRows, p2, false); taosMemoryFree(p2); if (code) { From 40cf21b15ce07e56a0c2d43b4567675ddf852b82 Mon Sep 17 00:00:00 2001 From: xiao-77 Date: Thu, 31 Oct 2024 11:24:31 +0800 Subject: [PATCH 499/695] fix firstVer incorrect while romove wal dir --- source/libs/wal/src/walWrite.c | 2 +- tests/system-test/7-tmq/tmqVnodeTransform-stb-removewal.py | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/source/libs/wal/src/walWrite.c b/source/libs/wal/src/walWrite.c index c8c37b11bc56..1c53baf360ae 100644 --- a/source/libs/wal/src/walWrite.c +++ b/source/libs/wal/src/walWrite.c @@ -664,7 +664,7 @@ static FORCE_INLINE int32_t walWriteImpl(SWal *pWal, int64_t index, tmsg_t msgTy // set status if (pWal->vers.firstVer == -1) { - pWal->vers.firstVer = 0; + pWal->vers.firstVer = index; } pWal->vers.lastVer = index; pWal->totSize += sizeof(SWalCkHead) + cyptedBodyLen; diff --git a/tests/system-test/7-tmq/tmqVnodeTransform-stb-removewal.py b/tests/system-test/7-tmq/tmqVnodeTransform-stb-removewal.py index e0632686d4f9..40879d5c661e 100644 --- a/tests/system-test/7-tmq/tmqVnodeTransform-stb-removewal.py +++ b/tests/system-test/7-tmq/tmqVnodeTransform-stb-removewal.py @@ -17,8 +17,6 @@ from tmqCommon import * class TDTestCase: - - updatecfgDict = {'sDebugFlag':143, 'wDebugFlag':143} def __init__(self): self.vgroups = 1 self.ctbNum = 10 From fd1f3ba048e90a750961acab8a3257a7b9538f4c Mon Sep 17 00:00:00 2001 From: Shungang Li Date: Thu, 31 Oct 2024 11:40:39 +0800 Subject: [PATCH 500/695] enh: taosCheckAndSetDebugFlag print errstr --- source/common/src/tglobal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index 4076679ff4af..00052cc810c7 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -2349,9 +2349,9 @@ static void taosCheckAndSetDebugFlag(int32_t *pFlagPtr, char *name, int32_t flag int32_t code = 0; if ((code = taosSetDebugFlag(pFlagPtr, name, flag)) != 0) { if (code != TSDB_CODE_CFG_NOT_FOUND) { - uError("failed to set flag %s to %d", name, flag); + uError("failed to set flag %s to %d, since:%s", name, flag, tstrerror(code)); } else { - uDebug("failed to set flag %s to %d", name, flag); + uDebug("failed to set flag %s to %d, since:%s", name, flag, tstrerror(code)); } } return; From fde2a56076be942bfef4df63b9813240e9c05ba9 Mon Sep 17 00:00:00 2001 From: Shungang Li Date: Thu, 31 Oct 2024 11:47:32 +0800 Subject: [PATCH 501/695] enh: tsdbCacheRowFormatUpdate check for memory funcs --- source/dnode/vnode/src/tsdb/tsdbCache.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/source/dnode/vnode/src/tsdb/tsdbCache.c b/source/dnode/vnode/src/tsdb/tsdbCache.c index 8e4a53845af6..1ae7dfeff7b2 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCache.c +++ b/source/dnode/vnode/src/tsdb/tsdbCache.c @@ -1350,6 +1350,9 @@ int32_t tsdbCacheRowFormatUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, int6 int32_t nCol = pTSchema->numOfCols; ctxArray = taosArrayInit(nCol * 2, sizeof(SLastUpdateCtx)); + if (ctxArray == NULL) { + TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit); + } // 1. prepare by lrow STsdbRowKey tsdbRowKey = {0}; @@ -1362,20 +1365,27 @@ int32_t tsdbCacheRowFormatUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, int6 for (SColVal *pColVal = tsdbRowIterNext(&iter); pColVal && iCol < nCol; pColVal = tsdbRowIterNext(&iter), iCol++) { SLastUpdateCtx updateCtx = {.lflag = LFLAG_LAST_ROW, .tsdbRowKey = tsdbRowKey, .colVal = *pColVal}; if (!taosArrayPush(ctxArray, &updateCtx)) { + tsdbRowClose(&iter); TAOS_CHECK_GOTO(terrno, &lino, _exit); } if (COL_VAL_IS_VALUE(pColVal)) { updateCtx.lflag = LFLAG_LAST; if (!taosArrayPush(ctxArray, &updateCtx)) { + tsdbRowClose(&iter); TAOS_CHECK_GOTO(terrno, &lino, _exit); } } else { if (!iColHash) { iColHash = tSimpleHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT)); + if (ctxArray == NULL) { + tsdbRowClose(&iter); + TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit); + } } if (tSimpleHashPut(iColHash, &iCol, sizeof(iCol), NULL, 0)) { + tsdbRowClose(&iter); TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit); } } From 385c4934d291883fe56c2f9d39c84cb326d41920 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Thu, 31 Oct 2024 12:11:44 +0800 Subject: [PATCH 502/695] doc: update query result --- docs/zh/05-basic/03-query.md | 309 +++++++++++++++++++---------------- 1 file changed, 165 insertions(+), 144 deletions(-) diff --git a/docs/zh/05-basic/03-query.md b/docs/zh/05-basic/03-query.md index 6afdba0997b6..21f4b74f73cb 100644 --- a/docs/zh/05-basic/03-query.md +++ b/docs/zh/05-basic/03-query.md @@ -20,21 +20,22 @@ taosBenchmark --start-timestamp=1600000000000 --tables=100 --records=10000000 -- ```sql SELECT * FROM meters -WHERE voltage > 10 +WHERE voltage > 230 ORDER BY ts DESC -LIMIT 5 +LIMIT 5; ``` -上面的 SQL,从超级表 `meters` 中查询出电压 `voltage` 大于 10 的记录,按时间降序排列,且仅输出前 5 行。查询结果如下: +上面的 SQL,从超级表 `meters` 中查询出电压 `voltage` 大于 230 的记录,按时间降序排列,且仅输出前 5 行。查询结果如下: ```text - ts | current | voltage | phase | groupid | location | -========================================================================================================== -2023-11-14 22:13:10.000 | 1.1294620 | 18 | 0.3531540 | 8 | California.MountainView | -2023-11-14 22:13:10.000 | 1.0294620 | 12 | 0.3631540 | 2 | California.Campbell | -2023-11-14 22:13:10.000 | 1.0294620 | 16 | 0.3531540 | 1 | California.Campbell | -2023-11-14 22:13:10.000 | 1.1294620 | 18 | 0.3531540 | 2 | California.Campbell | -2023-11-14 22:13:10.000 | 1.1294620 | 16 | 0.3431540 | 7 | California.PaloAlto | + ts | current | voltage | phase | groupid | location | +============================================================================================================ +2023-11-15 06:13:10.000 | 14.0601978 | 232 | 146.5000000 | 10 | California.Sunnyvale | +2023-11-15 06:13:10.000 | 14.0601978 | 232 | 146.5000000 | 1 | California.LosAngles | +2023-11-15 06:13:10.000 | 14.0601978 | 232 | 146.5000000 | 10 | California.Sunnyvale | +2023-11-15 06:13:10.000 | 14.0601978 | 232 | 146.5000000 | 5 | California.Cupertino | +2023-11-15 06:13:10.000 | 14.0601978 | 232 | 146.5000000 | 4 | California.SanFrancisco | +Query OK, 5 row(s) in set (0.145403s) ``` ## 聚合查询 @@ -48,28 +49,28 @@ TDengine 支持通过 GROUP BY 子句,对数据进行聚合查询。SQL 语句 group by 子句用于对数据进行分组,并为每个分组返回一行汇总信息。在 group by 子句中,可以使用表或视图中的任何列作为分组依据,这些列不需要出现在 select 列表中。此外,用户可以直接在超级表上执行聚合查询,无须预先创建子表。以智能电表的数据模型为例,使用 group by 子句的 SQL 如下: ```sql -SELECT groupid,avg(voltage) +SELECT groupid, avg(voltage) FROM meters WHERE ts >= "2022-01-01T00:00:00+08:00" AND ts < "2023-01-01T00:00:00+08:00" -GROUP BY groupid +GROUP BY groupid; ``` 上面的 SQL,查询超级表 `meters` 中,时间戳大于等于 `2022-01-01T00:00:00+08:00`,且时间戳小于 `2023-01-01T00:00:00+08:00` 的数据,按照 `groupid` 进行分组,求每组的平均电压。查询结果如下: ```text - groupid | avg(voltage) | -========================================== - 8 | 9.104040404040404 | - 5 | 9.078333333333333 | - 1 | 9.087037037037037 | - 7 | 8.991414141414142 | - 9 | 8.789814814814815 | - 6 | 9.051010101010101 | - 4 | 9.135353535353536 | - 10 | 9.213131313131314 | - 2 | 9.008888888888889 | - 3 | 8.783888888888889 | + groupid | avg(voltage) | +====================================== + 8 | 243.961981544901079 | + 5 | 243.961981544901079 | + 1 | 243.961981544901079 | + 7 | 243.961981544901079 | + 9 | 243.961981544901079 | + 6 | 243.961981544901079 | + 4 | 243.961981544901079 | + 10 | 243.961981544901079 | + 2 | 243.961981544901079 | + 3 | 243.961981544901079 | Query OK, 10 row(s) in set (0.042446s) ``` @@ -110,24 +111,24 @@ TDengine 按如下方式处理数据切分子句。 ```sql SELECT location, avg(voltage) FROM meters -PARTITION BY location +PARTITION BY location; ``` 上面的示例 SQL 查询超级表 `meters`,将数据按标签 `location` 进行分组,每个分组计算电压的平均值。查询结果如下: ```text - location | avg(voltage) | -========================================================= - California.SantaClara | 8.793334320000000 | - California.SanFrancisco | 9.017645882352941 | - California.SanJose | 9.156112940000000 | - California.LosAngles | 9.036753507692307 | - California.SanDiego | 8.967037053333334 | - California.Sunnyvale | 8.978572085714285 | - California.PaloAlto | 8.936665800000000 | - California.Cupertino | 8.987654066666666 | - California.MountainView | 9.046297266666667 | - California.Campbell | 9.149999028571429 | + location | avg(voltage) | +====================================================== + California.SantaClara | 243.962050000000005 | + California.SanFrancisco | 243.962050000000005 | + California.SanJose | 243.962050000000005 | + California.LosAngles | 243.962050000000005 | + California.SanDiego | 243.962050000000005 | + California.Sunnyvale | 243.962050000000005 | + California.PaloAlto | 243.962050000000005 | + California.Cupertino | 243.962050000000005 | + California.MountainView | 243.962050000000005 | + California.Campbell | 243.962050000000005 | Query OK, 10 row(s) in set (2.415961s) ``` @@ -200,20 +201,20 @@ SLIMIT 2; 上面的 SQL,查询超级表 `meters` 中,时间戳大于等于 `2022-01-01T00:00:00+08:00`,且时间戳小于 `2022-01-01T00:05:00+08:00` 的数据;数据首先按照子表名 `tbname` 进行数据切分,再按照每 1 分钟的时间窗口进行切分,且每个时间窗口向后偏移 5 秒;最后,仅取前 2 个分片的数据作为结果。查询结果如下: ```text - tbname | _wstart | _wend | avg(voltage) | -========================================================================================== - d40 | 2021-12-31 15:59:05.000 | 2021-12-31 16:00:05.000 | 4.000000000000000 | - d40 | 2021-12-31 16:00:05.000 | 2021-12-31 16:01:05.000 | 5.000000000000000 | - d40 | 2021-12-31 16:01:05.000 | 2021-12-31 16:02:05.000 | 8.000000000000000 | - d40 | 2021-12-31 16:02:05.000 | 2021-12-31 16:03:05.000 | 7.666666666666667 | - d40 | 2021-12-31 16:03:05.000 | 2021-12-31 16:04:05.000 | 9.666666666666666 | - d40 | 2021-12-31 16:04:05.000 | 2021-12-31 16:05:05.000 | 15.199999999999999 | - d41 | 2021-12-31 15:59:05.000 | 2021-12-31 16:00:05.000 | 4.000000000000000 | - d41 | 2021-12-31 16:00:05.000 | 2021-12-31 16:01:05.000 | 7.000000000000000 | - d41 | 2021-12-31 16:01:05.000 | 2021-12-31 16:02:05.000 | 9.000000000000000 | - d41 | 2021-12-31 16:02:05.000 | 2021-12-31 16:03:05.000 | 10.666666666666666 | - d41 | 2021-12-31 16:03:05.000 | 2021-12-31 16:04:05.000 | 8.333333333333334 | - d41 | 2021-12-31 16:04:05.000 | 2021-12-31 16:05:05.000 | 9.600000000000000 | + tbname | _wstart | _wend | avg(voltage) | +====================================================================================== + d2 | 2021-12-31 23:59:05.000 | 2022-01-01 00:00:05.000 | 253.000000000000000 | + d2 | 2022-01-01 00:00:05.000 | 2022-01-01 00:01:05.000 | 244.166666666666657 | + d2 | 2022-01-01 00:01:05.000 | 2022-01-01 00:02:05.000 | 241.833333333333343 | + d2 | 2022-01-01 00:02:05.000 | 2022-01-01 00:03:05.000 | 243.166666666666657 | + d2 | 2022-01-01 00:03:05.000 | 2022-01-01 00:04:05.000 | 240.833333333333343 | + d2 | 2022-01-01 00:04:05.000 | 2022-01-01 00:05:05.000 | 244.800000000000011 | + d26 | 2021-12-31 23:59:05.000 | 2022-01-01 00:00:05.000 | 253.000000000000000 | + d26 | 2022-01-01 00:00:05.000 | 2022-01-01 00:01:05.000 | 244.166666666666657 | + d26 | 2022-01-01 00:01:05.000 | 2022-01-01 00:02:05.000 | 241.833333333333343 | + d26 | 2022-01-01 00:02:05.000 | 2022-01-01 00:03:05.000 | 243.166666666666657 | + d26 | 2022-01-01 00:03:05.000 | 2022-01-01 00:04:05.000 | 240.833333333333343 | + d26 | 2022-01-01 00:04:05.000 | 2022-01-01 00:05:05.000 | 244.800000000000011 | Query OK, 12 row(s) in set (0.021265s) ``` @@ -255,19 +256,19 @@ SLIMIT 1; 上面的 SQL,查询超级表 `meters` 中,时间戳大于等于 `2022-01-01T00:00:00+08:00`,且时间戳小于 `2022-01-01T00:05:00+08:00` 的数据,数据首先按照子表名 `tbname` 进行数据切分,再按照每 1 分钟的时间窗口进行切分,且时间窗口按照 30 秒进行滑动;最后,仅取前 1 个分片的数据作为结果。查询结果如下: ```text - tbname | _wstart | avg(voltage) | -================================================================ - d40 | 2021-12-31 15:59:30.000 | 4.000000000000000 | - d40 | 2021-12-31 16:00:00.000 | 5.666666666666667 | - d40 | 2021-12-31 16:00:30.000 | 4.333333333333333 | - d40 | 2021-12-31 16:01:00.000 | 5.000000000000000 | - d40 | 2021-12-31 16:01:30.000 | 9.333333333333334 | - d40 | 2021-12-31 16:02:00.000 | 9.666666666666666 | - d40 | 2021-12-31 16:02:30.000 | 10.000000000000000 | - d40 | 2021-12-31 16:03:00.000 | 10.333333333333334 | - d40 | 2021-12-31 16:03:30.000 | 10.333333333333334 | - d40 | 2021-12-31 16:04:00.000 | 13.000000000000000 | - d40 | 2021-12-31 16:04:30.000 | 15.333333333333334 | + tbname | _wstart | avg(voltage) | +============================================================= + d2 | 2021-12-31 23:59:30.000 | 248.333333333333343 | + d2 | 2022-01-01 00:00:00.000 | 246.000000000000000 | + d2 | 2022-01-01 00:00:30.000 | 244.666666666666657 | + d2 | 2022-01-01 00:01:00.000 | 240.833333333333343 | + d2 | 2022-01-01 00:01:30.000 | 239.500000000000000 | + d2 | 2022-01-01 00:02:00.000 | 243.833333333333343 | + d2 | 2022-01-01 00:02:30.000 | 243.833333333333343 | + d2 | 2022-01-01 00:03:00.000 | 241.333333333333343 | + d2 | 2022-01-01 00:03:30.000 | 241.666666666666657 | + d2 | 2022-01-01 00:04:00.000 | 244.166666666666657 | + d2 | 2022-01-01 00:04:30.000 | 244.666666666666657 | Query OK, 11 row(s) in set (0.013153s) ``` @@ -290,13 +291,13 @@ SLIMIT 1; 上面的 SQL,查询超级表 `meters` 中,时间戳大于等于 `2022-01-01T00:00:00+08:00`,且时间戳小于 `2022-01-01T00:05:00+08:00` 的数据,数据首先按照子表名 `tbname` 进行数据切分,再按照每 1 分钟的时间窗口进行切分,且时间窗口按照 1 分钟进行切分;最后,仅取前 1 个分片的数据作为结果。查询结果如下: ```text - tbname | _wstart | _wend | avg(voltage) | -================================================================================================================= - d28 | 2021-12-31 16:00:00.000 | 2021-12-31 16:01:00.000 | 7.333333333333333 | - d28 | 2021-12-31 16:01:00.000 | 2021-12-31 16:02:00.000 | 8.000000000000000 | - d28 | 2021-12-31 16:02:00.000 | 2021-12-31 16:03:00.000 | 11.000000000000000 | - d28 | 2021-12-31 16:03:00.000 | 2021-12-31 16:04:00.000 | 6.666666666666667 | - d28 | 2021-12-31 16:04:00.000 | 2021-12-31 16:05:00.000 | 10.000000000000000 | + tbname | _wstart | _wend | avg(voltage) | +====================================================================================== + d2 | 2022-01-01 00:00:00.000 | 2022-01-01 00:01:00.000 | 246.000000000000000 | + d2 | 2022-01-01 00:01:00.000 | 2022-01-01 00:02:00.000 | 240.833333333333343 | + d2 | 2022-01-01 00:02:00.000 | 2022-01-01 00:03:00.000 | 243.833333333333343 | + d2 | 2022-01-01 00:03:00.000 | 2022-01-01 00:04:00.000 | 241.333333333333343 | + d2 | 2022-01-01 00:04:00.000 | 2022-01-01 00:05:00.000 | 244.166666666666657 | Query OK, 5 row(s) in set (0.016812s) ``` @@ -342,53 +343,65 @@ SLIMIT 2; 上面的 SQL,查询超级表 `meters` 中,时间戳大于等于 `2022-01-01T00:00:00+08:00`,且时间戳小于 `2022-01-01T00:05:00+08:00` 的数据;数据首先按照子表名 `tbname` 进行数据切分,再按照每 1 分钟的时间窗口进行切分,如果窗口内的数据出现缺失,则使用使用前一个非 NULL 值填充数据;最后,仅取前 2 个分片的数据作为结果。查询结果如下: ```text - tbname | _wstart | _wend | avg(voltage) | -================================================================================================================= - d40 | 2021-12-31 16:00:00.000 | 2021-12-31 16:01:00.000 | 5.666666666666667 | - d40 | 2021-12-31 16:01:00.000 | 2021-12-31 16:02:00.000 | 5.000000000000000 | - d40 | 2021-12-31 16:02:00.000 | 2021-12-31 16:03:00.000 | 9.666666666666666 | - d40 | 2021-12-31 16:03:00.000 | 2021-12-31 16:04:00.000 | 10.333333333333334 | - d40 | 2021-12-31 16:04:00.000 | 2021-12-31 16:05:00.000 | 13.000000000000000 | - d41 | 2021-12-31 16:00:00.000 | 2021-12-31 16:01:00.000 | 5.666666666666667 | - d41 | 2021-12-31 16:01:00.000 | 2021-12-31 16:02:00.000 | 9.333333333333334 | - d41 | 2021-12-31 16:02:00.000 | 2021-12-31 16:03:00.000 | 11.000000000000000 | - d41 | 2021-12-31 16:03:00.000 | 2021-12-31 16:04:00.000 | 7.666666666666667 | - d41 | 2021-12-31 16:04:00.000 | 2021-12-31 16:05:00.000 | 10.000000000000000 | + tbname | _wstart | _wend | avg(voltage) | +======================================================================================= + d2 | 2022-01-01 00:00:00.000 | 2022-01-01 00:01:00.000 | 246.000000000000000 | + d2 | 2022-01-01 00:01:00.000 | 2022-01-01 00:02:00.000 | 240.833333333333343 | + d2 | 2022-01-01 00:02:00.000 | 2022-01-01 00:03:00.000 | 243.833333333333343 | + d2 | 2022-01-01 00:03:00.000 | 2022-01-01 00:04:00.000 | 241.333333333333343 | + d2 | 2022-01-01 00:04:00.000 | 2022-01-01 00:05:00.000 | 244.166666666666657 | + d26 | 2022-01-01 00:00:00.000 | 2022-01-01 00:01:00.000 | 246.000000000000000 | + d26 | 2022-01-01 00:01:00.000 | 2022-01-01 00:02:00.000 | 240.833333333333343 | + d26 | 2022-01-01 00:02:00.000 | 2022-01-01 00:03:00.000 | 243.833333333333343 | + d26 | 2022-01-01 00:03:00.000 | 2022-01-01 00:04:00.000 | 241.333333333333343 | + d26 | 2022-01-01 00:04:00.000 | 2022-01-01 00:05:00.000 | 244.166666666666657 | Query OK, 10 row(s) in set (0.022866s) ``` ### 状态窗口 -使用整数(布尔值)或字符串来标识产生记录时候设备的状态量。产生的记录如果具有相同的状态量数值则归属于同一个状态窗口,数值改变后该窗口关闭。TDengine 还支持将 CASE 表达式用在状态量,可以表达某个状态的开始是由满足某个条件而触发,这个状态的结束是由另外一个条件满足而触发的语义。以智能电表为例,电压正常范围是 205V 到 235V,那么可以通过监控电压来判断电路是否正常。 +使用整数(布尔值)或字符串来标识产生记录时候设备的状态量。产生的记录如果具有相同的状态量数值则归属于同一个状态窗口,数值改变后该窗口关闭。TDengine 还支持将 CASE 表达式用在状态量,可以表达某个状态的开始是由满足某个条件而触发,这个状态的结束是由另外一个条件满足而触发的语义。以智能电表为例,电压正常范围是 225V 到 235V,那么可以通过监控电压来判断电路是否正常。 ```sql -SELECT tbname, _wstart, _wend,_wduration, CASE WHEN voltage >= 205 and voltage <= 235 THEN 1 ELSE 0 END status +SELECT tbname, _wstart, _wend,_wduration, CASE WHEN voltage >= 225 and voltage <= 235 THEN 1 ELSE 0 END status FROM meters WHERE ts >= "2022-01-01T00:00:00+08:00" AND ts < "2022-01-01T00:05:00+08:00" PARTITION BY tbname STATE_WINDOW( - CASE WHEN voltage >= 205 and voltage <= 235 THEN 1 ELSE 0 END + CASE WHEN voltage >= 225 and voltage <= 235 THEN 1 ELSE 0 END ) -SLIMIT 10; +SLIMIT 2; ``` -以上 SQL,查询超级表 meters 中,时间戳大于等于 2022-01-01T00:00:00+08:00,且时间戳小于 2022-01-01T00:05:00+08:00的数据;数据首先按照子表名 tbname 进行数据切分;根据电压是否在正常范围内进行状态窗口的划分;最后,取前 10 个分片的数据作为结果。查询结果如下: +以上 SQL,查询超级表 meters 中,时间戳大于等于 2022-01-01T00:00:00+08:00,且时间戳小于 2022-01-01T00:05:00+08:00的数据;数据首先按照子表名 tbname 进行数据切分;根据电压是否在正常范围内进行状态窗口的划分;最后,取前 2 个分片的数据作为结果。查询结果如下:(由于数据是随机生成,结果集包含的数据条数会有不同) ```text - tbname | _wstart | _wend | _wduration | status | -===================================================================================================================================== - d76 | 2021-12-31 16:00:00.000 | 2021-12-31 16:04:50.000 | 290000 | 0 | - d47 | 2021-12-31 16:00:00.000 | 2021-12-31 16:04:50.000 | 290000 | 0 | - d37 | 2021-12-31 16:00:00.000 | 2021-12-31 16:04:50.000 | 290000 | 0 | - d87 | 2021-12-31 16:00:00.000 | 2021-12-31 16:04:50.000 | 290000 | 0 | - d64 | 2021-12-31 16:00:00.000 | 2021-12-31 16:04:50.000 | 290000 | 0 | - d35 | 2021-12-31 16:00:00.000 | 2021-12-31 16:04:50.000 | 290000 | 0 | - d83 | 2021-12-31 16:00:00.000 | 2021-12-31 16:04:50.000 | 290000 | 0 | - d51 | 2021-12-31 16:00:00.000 | 2021-12-31 16:04:50.000 | 290000 | 0 | - d63 | 2021-12-31 16:00:00.000 | 2021-12-31 16:04:50.000 | 290000 | 0 | - d0 | 2021-12-31 16:00:00.000 | 2021-12-31 16:04:50.000 | 290000 | 0 | -Query OK, 10 row(s) in set (0.040495s) + tbname | _wstart | _wend | _wduration | status | +=============================================================================================== + d2 | 2022-01-01 00:00:00.000 | 2022-01-01 00:01:20.000 | 80000 | 0 | + d2 | 2022-01-01 00:01:30.000 | 2022-01-01 00:01:30.000 | 0 | 1 | + d2 | 2022-01-01 00:01:40.000 | 2022-01-01 00:01:40.000 | 0 | 0 | + d2 | 2022-01-01 00:01:50.000 | 2022-01-01 00:01:50.000 | 0 | 1 | + d2 | 2022-01-01 00:02:00.000 | 2022-01-01 00:02:20.000 | 20000 | 0 | + d2 | 2022-01-01 00:02:30.000 | 2022-01-01 00:02:30.000 | 0 | 1 | + d2 | 2022-01-01 00:02:40.000 | 2022-01-01 00:03:00.000 | 20000 | 0 | + d2 | 2022-01-01 00:03:10.000 | 2022-01-01 00:03:10.000 | 0 | 1 | + d2 | 2022-01-01 00:03:20.000 | 2022-01-01 00:03:40.000 | 20000 | 0 | + d2 | 2022-01-01 00:03:50.000 | 2022-01-01 00:03:50.000 | 0 | 1 | + d2 | 2022-01-01 00:04:00.000 | 2022-01-01 00:04:50.000 | 50000 | 0 | + d26 | 2022-01-01 00:00:00.000 | 2022-01-01 00:01:20.000 | 80000 | 0 | + d26 | 2022-01-01 00:01:30.000 | 2022-01-01 00:01:30.000 | 0 | 1 | + d26 | 2022-01-01 00:01:40.000 | 2022-01-01 00:01:40.000 | 0 | 0 | + d26 | 2022-01-01 00:01:50.000 | 2022-01-01 00:01:50.000 | 0 | 1 | + d26 | 2022-01-01 00:02:00.000 | 2022-01-01 00:02:20.000 | 20000 | 0 | + d26 | 2022-01-01 00:02:30.000 | 2022-01-01 00:02:30.000 | 0 | 1 | + d26 | 2022-01-01 00:02:40.000 | 2022-01-01 00:03:00.000 | 20000 | 0 | + d26 | 2022-01-01 00:03:10.000 | 2022-01-01 00:03:10.000 | 0 | 1 | + d26 | 2022-01-01 00:03:20.000 | 2022-01-01 00:03:40.000 | 20000 | 0 | + d26 | 2022-01-01 00:03:50.000 | 2022-01-01 00:03:50.000 | 0 | 1 | + d26 | 2022-01-01 00:04:00.000 | 2022-01-01 00:04:50.000 | 50000 | 0 | +Query OK, 22 row(s) in set (0.153403s) ``` ### 会话窗口 @@ -417,18 +430,18 @@ SLIMIT 10; 上面的 SQL,查询超级表 meters 中,时间戳大于等于 2022-01-01T00:00:00+08:00,且时间戳小于 2022-01-01T00:10:00+08:00的数据;数据先按照子表名 tbname 进行数据切分,再根据 10 分钟的会话窗口进行切分;最后,取前 10 个分片的数据作为结果,返回子表名、窗口开始时间、窗口结束时间、窗口宽度、窗口内数据条数。查询结果如下: ```text - tbname | _wstart | _wend | _wduration | count(*) | -===================================================================================================================================== - d76 | 2021-12-31 16:00:00.000 | 2021-12-31 16:09:50.000 | 590000 | 60 | - d47 | 2021-12-31 16:00:00.000 | 2021-12-31 16:09:50.000 | 590000 | 60 | - d37 | 2021-12-31 16:00:00.000 | 2021-12-31 16:09:50.000 | 590000 | 60 | - d87 | 2021-12-31 16:00:00.000 | 2021-12-31 16:09:50.000 | 590000 | 60 | - d64 | 2021-12-31 16:00:00.000 | 2021-12-31 16:09:50.000 | 590000 | 60 | - d35 | 2021-12-31 16:00:00.000 | 2021-12-31 16:09:50.000 | 590000 | 60 | - d83 | 2021-12-31 16:00:00.000 | 2021-12-31 16:09:50.000 | 590000 | 60 | - d51 | 2021-12-31 16:00:00.000 | 2021-12-31 16:09:50.000 | 590000 | 60 | - d63 | 2021-12-31 16:00:00.000 | 2021-12-31 16:09:50.000 | 590000 | 60 | - d0 | 2021-12-31 16:00:00.000 | 2021-12-31 16:09:50.000 | 590000 | 60 | + tbname | _wstart | _wend | _wduration | count(*) | +=============================================================================================== + d2 | 2022-01-01 00:00:00.000 | 2022-01-01 00:09:50.000 | 590000 | 60 | + d26 | 2022-01-01 00:00:00.000 | 2022-01-01 00:09:50.000 | 590000 | 60 | + d52 | 2022-01-01 00:00:00.000 | 2022-01-01 00:09:50.000 | 590000 | 60 | + d64 | 2022-01-01 00:00:00.000 | 2022-01-01 00:09:50.000 | 590000 | 60 | + d76 | 2022-01-01 00:00:00.000 | 2022-01-01 00:09:50.000 | 590000 | 60 | + d28 | 2022-01-01 00:00:00.000 | 2022-01-01 00:09:50.000 | 590000 | 60 | + d4 | 2022-01-01 00:00:00.000 | 2022-01-01 00:09:50.000 | 590000 | 60 | + d88 | 2022-01-01 00:00:00.000 | 2022-01-01 00:09:50.000 | 590000 | 60 | + d77 | 2022-01-01 00:00:00.000 | 2022-01-01 00:09:50.000 | 590000 | 60 | + d54 | 2022-01-01 00:00:00.000 | 2022-01-01 00:09:50.000 | 590000 | 60 | Query OK, 10 row(s) in set (0.043489s) ``` @@ -458,26 +471,26 @@ FROM meters WHERE ts >= "2022-01-01T00:00:00+08:00" AND ts < "2022-01-01T00:10:00+08:00" PARTITION BY tbname -EVENT_WINDOW START WITH voltage >= 10 END WITH voltage < 20 -LIMIT 10; +EVENT_WINDOW START WITH voltage >= 225 END WITH voltage < 235 +LIMIT 5; ``` -上面的 SQL,查询超级表meters中,时间戳大于等于2022-01-01T00:00:00+08:00,且时间戳小于2022-01-01T00:10:00+08:00的数据;数据先按照子表名tbname进行数据切分,再根据事件窗口条件:电压大于等于 10V,且小于 20V 进行切分;最后,取前 10 行的数据作为结果,返回子表名、窗口开始时间、窗口结束时间、窗口宽度、窗口内数据条数。查询结果如下: +上面的 SQL,查询超级表meters中,时间戳大于等于2022-01-01T00:00:00+08:00,且时间戳小于2022-01-01T00:10:00+08:00的数据;数据先按照子表名tbname进行数据切分,再根据事件窗口条件:电压大于等于 225V,且小于 235V 进行切分;最后,取每个分片的前 5 行的数据作为结果,返回子表名、窗口开始时间、窗口结束时间、窗口宽度、窗口内数据条数。查询结果如下: ```text - tbname | _wstart | _wend | _wduration | count(*) | -===================================================================================================================================== - d0 | 2021-12-31 16:00:00.000 | 2021-12-31 16:00:00.000 | 0 | 1 | - d0 | 2021-12-31 16:00:30.000 | 2021-12-31 16:00:30.000 | 0 | 1 | - d0 | 2021-12-31 16:00:40.000 | 2021-12-31 16:00:40.000 | 0 | 1 | - d0 | 2021-12-31 16:01:20.000 | 2021-12-31 16:01:20.000 | 0 | 1 | - d0 | 2021-12-31 16:02:20.000 | 2021-12-31 16:02:20.000 | 0 | 1 | - d0 | 2021-12-31 16:02:30.000 | 2021-12-31 16:02:30.000 | 0 | 1 | - d0 | 2021-12-31 16:03:10.000 | 2021-12-31 16:03:10.000 | 0 | 1 | - d0 | 2021-12-31 16:03:30.000 | 2021-12-31 16:03:30.000 | 0 | 1 | - d0 | 2021-12-31 16:03:40.000 | 2021-12-31 16:03:40.000 | 0 | 1 | - d0 | 2021-12-31 16:03:50.000 | 2021-12-31 16:03:50.000 | 0 | 1 | -Query OK, 10 row(s) in set (0.034127s) + tbname | _wstart | _wend | _wduration | count(*) | +============================================================================================== + d0 | 2022-01-01 00:00:00.000 | 2022-01-01 00:01:30.000 | 90000 | 10 | + d0 | 2022-01-01 00:01:40.000 | 2022-01-01 00:02:30.000 | 50000 | 6 | + d0 | 2022-01-01 00:02:40.000 | 2022-01-01 00:03:10.000 | 30000 | 4 | + d0 | 2022-01-01 00:03:20.000 | 2022-01-01 00:07:10.000 | 230000 | 24 | + d0 | 2022-01-01 00:07:20.000 | 2022-01-01 00:07:50.000 | 30000 | 4 | + d1 | 2022-01-01 00:00:00.000 | 2022-01-01 00:01:30.000 | 90000 | 10 | + d1 | 2022-01-01 00:01:40.000 | 2022-01-01 00:02:30.000 | 50000 | 6 | + d1 | 2022-01-01 00:02:40.000 | 2022-01-01 00:03:10.000 | 30000 | 4 | + d1 | 2022-01-01 00:03:20.000 | 2022-01-01 00:07:10.000 | 230000 | 24 | +…… +Query OK, 500 row(s) in set (0.328557s) ``` ### 计数窗口 @@ -492,17 +505,25 @@ sliding_val 是一个常量,表示窗口滑动的数量,类似于 interval select _wstart, _wend, count(*) from meters where ts >= "2022-01-01T00:00:00+08:00" and ts < "2022-01-01T00:30:00+08:00" -count_window(10); +count_window(1000); ``` -上面的 SQL 查询超级表 meters 中时间戳大于等于 2022-01-01T00:00:00+08:00 且时间戳小于 2022-01-01T00:10:00+08:00 的数据。以每 10 条数据为一组,返回每组的开始时间、结束时间和分组条数。查询结果如下。 +上面的 SQL 查询超级表 meters 中时间戳大于等于 2022-01-01T00:00:00+08:00 且时间戳小于 2022-01-01T00:10:00+08:00 的数据。以每 1000 条数据为一组,返回每组的开始时间、结束时间和分组条数。查询结果如下: ```text -_wstart | _wend |count(*)| -=========================================================== -2021-12-31 16:00:00.000 | 2021-12-31 16:10:00.000 | 10 | -2021-12-31 16:10:00.000 | 2021-12-31 16:20:00.000 | 10 | -2021-12-31 16:20:00.000 | 2021-12-31 16:30:00.000 | 10 | + _wstart | _wend | count(*) | +===================================================================== + 2022-01-01 00:00:00.000 | 2022-01-01 00:01:30.000 | 1000 | + 2022-01-01 00:01:40.000 | 2022-01-01 00:03:10.000 | 1000 | + 2022-01-01 00:03:20.000 | 2022-01-01 00:04:50.000 | 1000 | + 2022-01-01 00:05:00.000 | 2022-01-01 00:06:30.000 | 1000 | + 2022-01-01 00:06:40.000 | 2022-01-01 00:08:10.000 | 1000 | + 2022-01-01 00:08:20.000 | 2022-01-01 00:09:50.000 | 1000 | + 2022-01-01 00:10:00.000 | 2022-01-01 00:11:30.000 | 1000 | + 2022-01-01 00:11:40.000 | 2022-01-01 00:13:10.000 | 1000 | + 2022-01-01 00:13:20.000 | 2022-01-01 00:14:50.000 | 1000 | + 2022-01-01 00:15:00.000 | 2022-01-01 00:16:30.000 | 1000 | +Query OK, 10 row(s) in set (0.062794s) ``` ## 时序数据特有函数 @@ -563,14 +584,14 @@ UNION ALL 上面的 SQL,分别查询:子表 d1 的 1 条数据,子表 d11 的 2 条数据,子表 d21 的 3 条数据,并将结果合并。返回的结果如下: ```text - tbname | ts | current | voltage | phase | -================================================================================================= - d11 | 2020-09-13 12:26:40.000 | 1.0260611 | 6 | 0.3620200 | - d11 | 2020-09-13 12:26:50.000 | 2.9544230 | 8 | 1.0048079 | - d21 | 2020-09-13 12:26:40.000 | 1.0260611 | 2 | 0.3520200 | - d21 | 2020-09-13 12:26:50.000 | 2.9544230 | 2 | 0.9948080 | - d21 | 2020-09-13 12:27:00.000 | -0.0000430 | 12 | 0.0099860 | - d1 | 2020-09-13 12:26:40.000 | 1.0260611 | 10 | 0.3520200 | + tbname | ts | current | voltage | phase | +==================================================================================== + d11 | 2020-09-13 20:26:40.000 | 11.5680809 | 247 | 146.5000000 | + d11 | 2020-09-13 20:26:50.000 | 14.2392311 | 234 | 148.0000000 | + d1 | 2020-09-13 20:26:40.000 | 11.5680809 | 247 | 146.5000000 | + d21 | 2020-09-13 20:26:40.000 | 11.5680809 | 247 | 146.5000000 | + d21 | 2020-09-13 20:26:50.000 | 14.2392311 | 234 | 148.0000000 | + d21 | 2020-09-13 20:27:00.000 | 10.0999422 | 251 | 146.0000000 | Query OK, 6 row(s) in set (0.006438s) ``` From 210e0ae69f27fb51936c4db3db24545a3480327f Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Thu, 31 Oct 2024 12:39:54 +0800 Subject: [PATCH 503/695] doc: minor changes --- docs/en/14-reference/12-config/index.md | 19 ++++++++++--------- docs/zh/06-advanced/02-cache.md | 4 ++-- .../zh/14-reference/01-components/01-taosd.md | 1 + .../zh/14-reference/01-components/02-taosc.md | 1 + 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/docs/en/14-reference/12-config/index.md b/docs/en/14-reference/12-config/index.md index 14a1a0fb9d9d..77d183a5ef7b 100755 --- a/docs/en/14-reference/12-config/index.md +++ b/docs/en/14-reference/12-config/index.md @@ -701,15 +701,6 @@ The charset that takes effect is UTF-8. | Type | String | | Default Value | _tag_null | -### smlDataFormat - -| Attribute | Description | -| ----------- | ----------------------------------------------------------------------------------- | -| Applicable | Client only | -| Meaning | Whether schemaless columns are consistently ordered, depat, discarded since 3.0.3.0 | -| Value Range | 0: not consistent; 1: consistent. | -| Default | 0 | - ### smlTsDefaultName | Attribute | Description | @@ -719,6 +710,16 @@ The charset that takes effect is UTF-8. | Type | String | | Default Value | _ts | +### smlDot2Underline + +| Attribute | Description | +| -------- | -------------------------------------------------------- | +| Applicable | Client only | +| Meaning | Convert the dot in the supertable name to an underscore | +| Type | Bool | +| Default Value | true | + + ## Compress Parameters ### compressMsgSize diff --git a/docs/zh/06-advanced/02-cache.md b/docs/zh/06-advanced/02-cache.md index b83509c2dd5f..065adbf50ae4 100644 --- a/docs/zh/06-advanced/02-cache.md +++ b/docs/zh/06-advanced/02-cache.md @@ -54,10 +54,10 @@ TDengine 利用这些日志文件实现故障前的状态恢复。在写入 WAL 数据库参数 wal_level 和 wal_fsync_period 共同决定了 WAL 的保存行为。。 - wal_level:此参数控制 WAL 的保存级别。级别 1 表示仅将数据写入 WAL,但不立即执行 fsync 函数;级别 2 则表示在写入 WAL 的同时执行 fsync 函数。默认情况下,wal_level 设为 1。虽然执行 fsync 函数可以提高数据的持久性,但相应地也会降低写入性能。 -- wal_fsync_period:当 wal_level 设置为 1 时,这个参数控制执行 fsync 的频率。设置为 0 表示每次写入后立即执行 fsync,这可以确保数据的安全性,但可能会牺牲一些性能。当设置为大于 0 的数值时,表示 fsync 周期,默认为 3000,范围是[1, 180000],单位毫秒。 +- wal_fsync_period:当 wal_level 设置为 2 时,这个参数控制执行 fsync 的频率。设置为 0 表示每次写入后立即执行 fsync,这可以确保数据的安全性,但可能会牺牲一些性能。当设置为大于 0 的数值时,表示 fsync 周期,默认为 3000,范围是[1, 180000],单位毫秒。 ```sql -CREATE DATABASE POWER WAL_LEVEL 1 WAL_FSYNC_PERIOD 3000; +CREATE DATABASE POWER WAL_LEVEL 2 WAL_FSYNC_PERIOD 3000; ``` 在创建数据库时可以选择不同的参数类型,来选择性能优先或者可靠性优先。 diff --git a/docs/zh/14-reference/01-components/01-taosd.md b/docs/zh/14-reference/01-components/01-taosd.md index f11321c84f17..091f9416eb1b 100644 --- a/docs/zh/14-reference/01-components/01-taosd.md +++ b/docs/zh/14-reference/01-components/01-taosd.md @@ -180,6 +180,7 @@ charset 的有效值是 UTF-8。 | tmrDebugFlag | 定时器模块的日志开关,取值范围同上 | | uDebugFlag | 共用功能模块的日志开关,取值范围同上 | | rpcDebugFlag | rpc 模块的日志开关,取值范围同上 | +| cDebugFlag | 客户端模块的日志开关,取值范围同上 | | jniDebugFlag | jni 模块的日志开关,取值范围同上 | | qDebugFlag | query 模块的日志开关,取值范围同上 | | dDebugFlag | dnode 模块的日志开关,取值范围同上,缺省值 135 | diff --git a/docs/zh/14-reference/01-components/02-taosc.md b/docs/zh/14-reference/01-components/02-taosc.md index d9f36a2df77c..bd1e700041e9 100755 --- a/docs/zh/14-reference/01-components/02-taosc.md +++ b/docs/zh/14-reference/01-components/02-taosc.md @@ -35,6 +35,7 @@ TDengine 客户端驱动提供了应用编程所需要的全部 API,并且在 |smlAutoChildTableNameDelimiter | schemaless tag之间的连接符,连起来作为子表名,无缺省值 | |smlTagName | schemaless tag 为空时默认的 tag 名字, 缺省值 "_tag_null" | |smlTsDefaultName | schemaless自动建表的时间列名字通过该配置设置, 缺省值 "_ts" | +|smlDot2Underline | schemaless 把超级表名中的 dot 转成下划线 | |enableCoreFile | crash 时是否生成 core 文件,0: 不生成, 1: 生成;缺省值:1 | |enableScience | 是否开启科学计数法显示浮点数; 0: 不开始, 1: 开启;缺省值:1 | |compressMsgSize | 是否对 RPC 消息进行压缩; -1: 所有消息都不压缩; 0: 所有消息都压缩; N (N>0): 只有大于 N 个字节的消息才压缩; 缺省值 -1| From 3d1379a8303ded33019890801abb4a4a2d9210a3 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Thu, 31 Oct 2024 12:43:16 +0800 Subject: [PATCH 504/695] doc: minor changes --- docs/zh/05-basic/03-query.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/zh/05-basic/03-query.md b/docs/zh/05-basic/03-query.md index 21f4b74f73cb..4a1771d5fd72 100644 --- a/docs/zh/05-basic/03-query.md +++ b/docs/zh/05-basic/03-query.md @@ -28,13 +28,13 @@ LIMIT 5; 上面的 SQL,从超级表 `meters` 中查询出电压 `voltage` 大于 230 的记录,按时间降序排列,且仅输出前 5 行。查询结果如下: ```text - ts | current | voltage | phase | groupid | location | -============================================================================================================ -2023-11-15 06:13:10.000 | 14.0601978 | 232 | 146.5000000 | 10 | California.Sunnyvale | -2023-11-15 06:13:10.000 | 14.0601978 | 232 | 146.5000000 | 1 | California.LosAngles | -2023-11-15 06:13:10.000 | 14.0601978 | 232 | 146.5000000 | 10 | California.Sunnyvale | -2023-11-15 06:13:10.000 | 14.0601978 | 232 | 146.5000000 | 5 | California.Cupertino | -2023-11-15 06:13:10.000 | 14.0601978 | 232 | 146.5000000 | 4 | California.SanFrancisco | + ts | current | voltage | phase | groupid | location | +=================================================================================================== +2023-11-15 06:13:10.000 | 14.0601978 | 232 | 146.5000000 | 10 | California.Sunnyvale | +2023-11-15 06:13:10.000 | 14.0601978 | 232 | 146.5000000 | 1 | California.LosAngles | +2023-11-15 06:13:10.000 | 14.0601978 | 232 | 146.5000000 | 10 | California.Sunnyvale | +2023-11-15 06:13:10.000 | 14.0601978 | 232 | 146.5000000 | 5 | California.Cupertino | +2023-11-15 06:13:10.000 | 14.0601978 | 232 | 146.5000000 | 4 | California.SanFrancisco | Query OK, 5 row(s) in set (0.145403s) ``` From 930dc4abf7d7907ffaa6cdef64b1ec82084b36e4 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Thu, 31 Oct 2024 13:15:01 +0800 Subject: [PATCH 505/695] fix(stream): remove invalid acquire. --- source/libs/stream/src/streamStartHistory.c | 9 --------- source/libs/stream/src/streamTask.c | 2 +- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/source/libs/stream/src/streamStartHistory.c b/source/libs/stream/src/streamStartHistory.c index 4d38c48fc5ce..54a8929123ce 100644 --- a/source/libs/stream/src/streamStartHistory.c +++ b/source/libs/stream/src/streamStartHistory.c @@ -88,15 +88,6 @@ void streamExecScanHistoryInFuture(SStreamTask* pTask, int32_t idleDuration) { numOfTicks = SCANHISTORY_IDLE_TICK; } - // add ref for task - SStreamTask* p = NULL; - int32_t code = streamMetaAcquireTask(pTask->pMeta, pTask->id.streamId, pTask->id.taskId, &p); - if (p == NULL || code != 0) { - stError("s-task:0x%x failed to acquire task, status:%s, not exec scan-history data", pTask->id.taskId, - streamTaskGetStatus(pTask).name); - return; - } - pTask->schedHistoryInfo.numOfTicks = numOfTicks; stDebug("s-task:%s scan-history resumed in %.2fs", pTask->id.idStr, numOfTicks * 0.1); diff --git a/source/libs/stream/src/streamTask.c b/source/libs/stream/src/streamTask.c index 67d76ba2ef21..297dd6e72f1f 100644 --- a/source/libs/stream/src/streamTask.c +++ b/source/libs/stream/src/streamTask.c @@ -227,7 +227,7 @@ void tFreeStreamTask(void* pParam) { } streamMutexUnlock(&pTask->lock); - stDebug("start to free s-task:0x%x %p, state:%s", taskId, pTask, p); + stDebug("start to free s-task:0x%x %p, state:%s, refId:%" PRId64, taskId, pTask, p, pTask->id.refId); SCheckpointInfo* pCkInfo = &pTask->chkInfo; stDebug("s-task:0x%x task exec summary: create:%" PRId64 ", init:%" PRId64 ", start:%" PRId64 From e260eb7a07d6e6176b9052ed22a27d8f067aa305 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Thu, 31 Oct 2024 13:35:42 +0800 Subject: [PATCH 506/695] Revert "enh(stmt2):add api taos_stmt2_get_all_fields" --- include/client/taos.h | 47 ++++++-------- source/client/inc/clientStmt2.h | 1 - source/client/src/clientMain.c | 25 ++------ source/client/src/clientStmt2.c | 86 -------------------------- source/libs/parser/src/parInsertSql.c | 82 ++++++++++-------------- source/libs/parser/src/parInsertStmt.c | 8 +-- tests/script/api/makefile | 2 - tests/script/api/stmt2-get-fields.c | 63 ------------------- 8 files changed, 58 insertions(+), 256 deletions(-) delete mode 100644 tests/script/api/stmt2-get-fields.c diff --git a/include/client/taos.h b/include/client/taos.h index 266e0e192d87..80dbe27c4719 100644 --- a/include/client/taos.h +++ b/include/client/taos.h @@ -81,13 +81,6 @@ typedef enum { TSDB_SML_TIMESTAMP_NANO_SECONDS, } TSDB_SML_TIMESTAMP_TYPE; -typedef enum TAOS_FIELD_T { - TAOS_FIELD_COL = 1, - TAOS_FIELD_TAG, - TAOS_FIELD_QUERY, - TAOS_FIELD_TBNAME, -} TAOS_FIELD_T; - typedef struct taosField { char name[65]; int8_t type; @@ -102,15 +95,6 @@ typedef struct TAOS_FIELD_E { int32_t bytes; } TAOS_FIELD_E; -typedef struct TAOS_FIELD_ALL { - char name[65]; - int8_t type; - uint8_t precision; - uint8_t scale; - int32_t bytes; - TAOS_FIELD_T field_type; -} TAOS_FIELD_ALL; - #ifdef WINDOWS #define DLL_EXPORT __declspec(dllexport) #else @@ -211,6 +195,13 @@ DLL_EXPORT int taos_stmt_affected_rows_once(TAOS_STMT *stmt); typedef void TAOS_STMT2; +typedef enum TAOS_FIELD_T { + TAOS_FIELD_COL = 1, + TAOS_FIELD_TAG, + TAOS_FIELD_QUERY, + TAOS_FIELD_TBNAME, +} TAOS_FIELD_T; + typedef struct TAOS_STMT2_OPTION { int64_t reqid; bool singleStbInsert; @@ -241,9 +232,7 @@ DLL_EXPORT int taos_stmt2_exec(TAOS_STMT2 *stmt, int *affected_rows); DLL_EXPORT int taos_stmt2_close(TAOS_STMT2 *stmt); DLL_EXPORT int taos_stmt2_is_insert(TAOS_STMT2 *stmt, int *insert); DLL_EXPORT int taos_stmt2_get_fields(TAOS_STMT2 *stmt, TAOS_FIELD_T field_type, int *count, TAOS_FIELD_E **fields); -DLL_EXPORT int taos_stmt2_get_all_fields(TAOS_STMT2 *stmt, int *count, TAOS_FIELD_ALL **fields); DLL_EXPORT void taos_stmt2_free_fields(TAOS_STMT2 *stmt, TAOS_FIELD_E *fields); -DLL_EXPORT void taos_stmt2_free_all_fields(TAOS_STMT2 *stmt, TAOS_FIELD_ALL *fields); DLL_EXPORT TAOS_RES *taos_stmt2_result(TAOS_STMT2 *stmt); DLL_EXPORT char *taos_stmt2_error(TAOS_STMT2 *stmt); @@ -262,17 +251,17 @@ DLL_EXPORT int64_t taos_affected_rows64(TAOS_RES *res); DLL_EXPORT TAOS_FIELD *taos_fetch_fields(TAOS_RES *res); DLL_EXPORT int taos_select_db(TAOS *taos, const char *db); DLL_EXPORT int taos_print_row(char *str, TAOS_ROW row, TAOS_FIELD *fields, int num_fields); -DLL_EXPORT int taos_print_row_with_size(char *str, uint32_t size, TAOS_ROW row, TAOS_FIELD *fields, int num_fields); -DLL_EXPORT void taos_stop_query(TAOS_RES *res); -DLL_EXPORT bool taos_is_null(TAOS_RES *res, int32_t row, int32_t col); -DLL_EXPORT int taos_is_null_by_column(TAOS_RES *res, int columnIndex, bool result[], int *rows); -DLL_EXPORT bool taos_is_update_query(TAOS_RES *res); -DLL_EXPORT int taos_fetch_block(TAOS_RES *res, TAOS_ROW *rows); -DLL_EXPORT int taos_fetch_block_s(TAOS_RES *res, int *numOfRows, TAOS_ROW *rows); -DLL_EXPORT int taos_fetch_raw_block(TAOS_RES *res, int *numOfRows, void **pData); -DLL_EXPORT int *taos_get_column_data_offset(TAOS_RES *res, int columnIndex); -DLL_EXPORT int taos_validate_sql(TAOS *taos, const char *sql); -DLL_EXPORT void taos_reset_current_db(TAOS *taos); +DLL_EXPORT int taos_print_row_with_size(char *str, uint32_t size, TAOS_ROW row, TAOS_FIELD *fields, int num_fields); +DLL_EXPORT void taos_stop_query(TAOS_RES *res); +DLL_EXPORT bool taos_is_null(TAOS_RES *res, int32_t row, int32_t col); +DLL_EXPORT int taos_is_null_by_column(TAOS_RES *res, int columnIndex, bool result[], int *rows); +DLL_EXPORT bool taos_is_update_query(TAOS_RES *res); +DLL_EXPORT int taos_fetch_block(TAOS_RES *res, TAOS_ROW *rows); +DLL_EXPORT int taos_fetch_block_s(TAOS_RES *res, int *numOfRows, TAOS_ROW *rows); +DLL_EXPORT int taos_fetch_raw_block(TAOS_RES *res, int *numOfRows, void **pData); +DLL_EXPORT int *taos_get_column_data_offset(TAOS_RES *res, int columnIndex); +DLL_EXPORT int taos_validate_sql(TAOS *taos, const char *sql); +DLL_EXPORT void taos_reset_current_db(TAOS *taos); DLL_EXPORT int *taos_fetch_lengths(TAOS_RES *res); DLL_EXPORT TAOS_ROW *taos_result_block(TAOS_RES *res); diff --git a/source/client/inc/clientStmt2.h b/source/client/inc/clientStmt2.h index e54057e72f18..4e9a09c0820d 100644 --- a/source/client/inc/clientStmt2.h +++ b/source/client/inc/clientStmt2.h @@ -222,7 +222,6 @@ int stmtSetTbTags2(TAOS_STMT2 *stmt, TAOS_STMT2_BIND *tags); int stmtBindBatch2(TAOS_STMT2 *stmt, TAOS_STMT2_BIND *bind, int32_t colIdx); int stmtGetTagFields2(TAOS_STMT2 *stmt, int *nums, TAOS_FIELD_E **fields); int stmtGetColFields2(TAOS_STMT2 *stmt, int *nums, TAOS_FIELD_E **fields); -int stmtGetColFieldsALL2(TAOS_STMT2 *stmt, int *nums, TAOS_FIELD_ALL **fields); int stmtGetParamNum2(TAOS_STMT2 *stmt, int *nums); int stmtGetParamTbName(TAOS_STMT2 *stmt, int *nums); int stmtIsInsert2(TAOS_STMT2 *stmt, int *insert); diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c index f2fc2b8bdc27..64631fd75453 100644 --- a/source/client/src/clientMain.c +++ b/source/client/src/clientMain.c @@ -84,7 +84,7 @@ void taos_cleanup(void) { taosCloseRef(id); nodesDestroyAllocatorSet(); - // cleanupAppInfo(); +// cleanupAppInfo(); rpcCleanup(); tscDebug("rpc cleanup"); @@ -388,6 +388,7 @@ void taos_free_result(TAOS_RES *res) { tDeleteMqBatchMetaRsp(&pRsp->batchMetaRsp); } taosMemoryFree(pRsp); + } void taos_kill_query(TAOS *taos) { @@ -483,7 +484,7 @@ TAOS_ROW taos_fetch_row(TAOS_RES *res) { int taos_print_row(char *str, TAOS_ROW row, TAOS_FIELD *fields, int num_fields) { return taos_print_row_with_size(str, INT32_MAX, row, fields, num_fields); } -int taos_print_row_with_size(char *str, uint32_t size, TAOS_ROW row, TAOS_FIELD *fields, int num_fields) { +int taos_print_row_with_size(char *str, uint32_t size, TAOS_ROW row, TAOS_FIELD *fields, int num_fields){ int32_t len = 0; for (int i = 0; i < num_fields; ++i) { if (i > 0 && len < size - 1) { @@ -588,7 +589,7 @@ int taos_print_row_with_size(char *str, uint32_t size, TAOS_ROW row, TAOS_FIELD break; } } - if (len < size) { + if (len < size){ str[len] = 0; } @@ -2081,7 +2082,7 @@ int taos_stmt2_is_insert(TAOS_STMT2 *stmt, int *insert) { } int taos_stmt2_get_fields(TAOS_STMT2 *stmt, TAOS_FIELD_T field_type, int *count, TAOS_FIELD_E **fields) { - if (stmt == NULL || count == NULL) { + if (stmt == NULL || NULL == count) { tscError("NULL parameter for %s", __FUNCTION__); terrno = TSDB_CODE_INVALID_PARA; return terrno; @@ -2102,28 +2103,12 @@ int taos_stmt2_get_fields(TAOS_STMT2 *stmt, TAOS_FIELD_T field_type, int *count, } } -int taos_stmt2_get_all_fields(TAOS_STMT2 *stmt, int *count, TAOS_FIELD_ALL **fields) { - if (stmt == NULL || count == NULL) { - tscError("NULL parameter for %s", __FUNCTION__); - terrno = TSDB_CODE_INVALID_PARA; - return terrno; - } - - return stmtGetColFieldsALL2(stmt, count, fields); -} - void taos_stmt2_free_fields(TAOS_STMT2 *stmt, TAOS_FIELD_E *fields) { (void)stmt; if (!fields) return; taosMemoryFree(fields); } -DLL_EXPORT void taos_stmt2_free_all_fields(TAOS_STMT2 *stmt, TAOS_FIELD_ALL *fields) { - (void)stmt; - if (!fields) return; - taosMemoryFree(fields); -} - TAOS_RES *taos_stmt2_result(TAOS_STMT2 *stmt) { if (stmt == NULL) { tscError("NULL parameter for %s", __FUNCTION__); diff --git a/source/client/src/clientStmt2.c b/source/client/src/clientStmt2.c index 67de878ee572..2f046b61d622 100644 --- a/source/client/src/clientStmt2.c +++ b/source/client/src/clientStmt2.c @@ -1068,48 +1068,6 @@ static int stmtFetchColFields2(STscStmt2* pStmt, int32_t* fieldNum, TAOS_FIELD_E return TSDB_CODE_SUCCESS; } - -static int stmtFetchFields2(STscStmt2* pStmt, int32_t* fieldNum, TAOS_FIELD_ALL** fields) { - SBoundColInfo* tags = (SBoundColInfo*)pStmt->bInfo.boundTags; - STableMeta* meta = ((SVnodeModifyOpStmt*)(pStmt->sql.pQuery->pRoot))->pTableMeta; - if (tags == NULL || meta == NULL || (meta->schema == NULL && tags->numOfBound != 0)) { - return TSDB_CODE_INVALID_PARA; - } - - if (fields != NULL) { - *fields = taosMemoryCalloc(tags->numOfBound, sizeof(TAOS_FIELD_ALL)); - if (NULL == *fields) { - return terrno; - } - - SSchema* pSchema = meta->schema; - int32_t tbnameIdx = meta->tableInfo.numOfTags + meta->tableInfo.numOfColumns; - for (int32_t i = 0; i < tags->numOfBound; ++i) { - int16_t idx = tags->pColIndex[i]; - if (idx == tbnameIdx) { - (*fields)[i].field_type = TAOS_FIELD_TBNAME; - tstrncpy((*fields)[i].name, "tbname", sizeof((*fields)[i].name)); - continue; - } else if (idx < meta->tableInfo.numOfColumns) { - (*fields)[i].field_type = TAOS_FIELD_COL; - } else { - (*fields)[i].field_type = TAOS_FIELD_TAG; - } - - if (TSDB_DATA_TYPE_TIMESTAMP == pSchema[tags->pColIndex[i]].type) { - (*fields)[i].precision = meta->tableInfo.precision; - } - - tstrncpy((*fields)[i].name, pSchema[tags->pColIndex[i]].name, sizeof((*fields)[i].name)); - (*fields)[i].type = pSchema[tags->pColIndex[i]].type; - (*fields)[i].bytes = pSchema[tags->pColIndex[i]].bytes; - } - } - - *fieldNum = tags->numOfBound; - - return TSDB_CODE_SUCCESS; -} /* SArray* stmtGetFreeCol(STscStmt2* pStmt, int32_t* idx) { while (true) { @@ -1893,50 +1851,6 @@ int stmtGetColFields2(TAOS_STMT2* stmt, int* nums, TAOS_FIELD_E** fields) { return code; } -int stmtGetColFieldsALL2(TAOS_STMT2* stmt, int* nums, TAOS_FIELD_ALL** fields) { - int32_t code = 0; - STscStmt2* pStmt = (STscStmt2*)stmt; - int32_t preCode = pStmt->errCode; - - STMT_DLOG_E("start to get col fields"); - - if (pStmt->errCode != TSDB_CODE_SUCCESS) { - return pStmt->errCode; - } - - if (STMT_TYPE_QUERY == pStmt->sql.type) { - STMT_ERRI_JRET(TSDB_CODE_TSC_STMT_API_ERROR); - } - - STMT_ERRI_JRET(stmtSwitchStatus(pStmt, STMT_FETCH_FIELDS)); - - if (pStmt->bInfo.needParse && pStmt->sql.runTimes && pStmt->sql.type > 0 && - STMT_TYPE_MULTI_INSERT != pStmt->sql.type) { - pStmt->bInfo.needParse = false; - } - - if (pStmt->exec.pRequest && STMT_TYPE_QUERY == pStmt->sql.type && pStmt->sql.runTimes) { - taos_free_result(pStmt->exec.pRequest); - pStmt->exec.pRequest = NULL; - STMT_ERR_RET(stmtCreateRequest(pStmt)); - } - - STMT_ERRI_JRET(stmtCreateRequest(pStmt)); - - if (pStmt->bInfo.needParse) { - STMT_ERRI_JRET(stmtParseSql(pStmt)); - } - -_return: - - pStmt->errCode = preCode; - if (code == TSDB_CODE_TSC_INVALID_OPERATION) { - return stmtFetchFields2(stmt, nums, fields); - } - - return code; -} - int stmtGetParamNum2(TAOS_STMT2* stmt, int* nums) { STscStmt2* pStmt = (STscStmt2*)stmt; diff --git a/source/libs/parser/src/parInsertSql.c b/source/libs/parser/src/parInsertSql.c index f4ef09951527..1c26a7c70ed2 100644 --- a/source/libs/parser/src/parInsertSql.c +++ b/source/libs/parser/src/parInsertSql.c @@ -30,7 +30,7 @@ typedef struct SInsertParseContext { bool forceUpdate; bool needTableTagVal; bool needRequest; // whether or not request server - bool isStmtBind; // whether is stmt bind + bool isStmtBind; // whether is stmt bind } SInsertParseContext; typedef int32_t (*_row_append_fn_t)(SMsgBuf* pMsgBuf, const void* value, int32_t len, void* param); @@ -757,7 +757,7 @@ int32_t parseTagValue(SMsgBuf* pMsgBuf, const char** pSql, uint8_t precision, SS STagVal val = {0}; int32_t code = parseTagToken(pSql, pToken, pTagSchema, precision, &val, pMsgBuf); if (TSDB_CODE_SUCCESS == code) { - if (NULL == taosArrayPush(pTagVals, &val)) { + if (NULL == taosArrayPush(pTagVals, &val)){ code = terrno; } } @@ -775,14 +775,11 @@ static int32_t buildCreateTbReq(SVnodeModifyOpStmt* pStmt, STag* pTag, SArray* p return terrno; } return insBuildCreateTbReq(pStmt->pCreateTblReq, pStmt->targetTableName.tname, pTag, pStmt->pTableMeta->suid, - pStmt->usingTableName.tname, pTagName, pStmt->pTableMeta->tableInfo.numOfTags, - TSDB_DEFAULT_TABLE_TTL); + pStmt->usingTableName.tname, pTagName, pStmt->pTableMeta->tableInfo.numOfTags, + TSDB_DEFAULT_TABLE_TTL); } int32_t checkAndTrimValue(SToken* pToken, char* tmpTokenBuf, SMsgBuf* pMsgBuf, int8_t type) { - if (pToken->type == TK_NK_QUESTION) { - return buildInvalidOperationMsg(pMsgBuf, "insert into super table syntax is not supported for stmt"); - } if ((pToken->type != TK_NOW && pToken->type != TK_TODAY && pToken->type != TK_NK_INTEGER && pToken->type != TK_NK_STRING && pToken->type != TK_NK_FLOAT && pToken->type != TK_NK_BOOL && pToken->type != TK_NULL && pToken->type != TK_NK_HEX && pToken->type != TK_NK_OCT && pToken->type != TK_NK_BIN && @@ -813,7 +810,7 @@ typedef struct SRewriteTagCondCxt { static int32_t rewriteTagCondColumnImpl(STagVal* pVal, SNode** pNode) { SValueNode* pValue = NULL; - int32_t code = nodesMakeNode(QUERY_NODE_VALUE, (SNode**)&pValue); + int32_t code = nodesMakeNode(QUERY_NODE_VALUE, (SNode**)&pValue); if (NULL == pValue) { return code; } @@ -1044,7 +1041,7 @@ static int32_t storeChildTableMeta(SInsertParseContext* pCxt, SVnodeModifyOpStmt return TSDB_CODE_OUT_OF_MEMORY; } - char tbFName[TSDB_TABLE_FNAME_LEN]; + char tbFName[TSDB_TABLE_FNAME_LEN]; int32_t code = tNameExtractFullName(&pStmt->targetTableName, tbFName); if (TSDB_CODE_SUCCESS != code) { taosMemoryFree(pBackup); @@ -1239,7 +1236,7 @@ static int32_t getTargetTableMetaAndVgroup(SInsertParseContext* pCxt, SVnodeModi } static int32_t collectUseTable(const SName* pName, SHashObj* pTable) { - char fullName[TSDB_TABLE_FNAME_LEN]; + char fullName[TSDB_TABLE_FNAME_LEN]; int32_t code = tNameExtractFullName(pName, fullName); if (TSDB_CODE_SUCCESS != code) { return code; @@ -1385,7 +1382,7 @@ static int32_t getTableDataCxt(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pS pStmt->pTableMeta, &pStmt->pCreateTblReq, pTableCxt, false, false); } - char tbFName[TSDB_TABLE_FNAME_LEN]; + char tbFName[TSDB_TABLE_FNAME_LEN]; int32_t code = tNameExtractFullName(&pStmt->targetTableName, tbFName); if (TSDB_CODE_SUCCESS != code) { return code; @@ -1926,8 +1923,8 @@ static int32_t processCtbAutoCreationAndCtbMeta(SInsertParseContext* pCxt, SVnod } if (code == TSDB_CODE_SUCCESS) { code = insBuildCreateTbReq(pStbRowsCxt->pCreateCtbReq, pStbRowsCxt->ctbName.tname, pStbRowsCxt->pTag, - pStbRowsCxt->pStbMeta->uid, pStbRowsCxt->stbName.tname, pStbRowsCxt->aTagNames, - getNumOfTags(pStbRowsCxt->pStbMeta), TSDB_DEFAULT_TABLE_TTL); + pStbRowsCxt->pStbMeta->uid, pStbRowsCxt->stbName.tname, pStbRowsCxt->aTagNames, + getNumOfTags(pStbRowsCxt->pStbMeta), TSDB_DEFAULT_TABLE_TTL); pStbRowsCxt->pTag = NULL; } @@ -1936,9 +1933,9 @@ static int32_t processCtbAutoCreationAndCtbMeta(SInsertParseContext* pCxt, SVnod code = tNameExtractFullName(&pStbRowsCxt->ctbName, ctbFName); SVgroupInfo vg; SRequestConnInfo conn = {.pTrans = pCxt->pComCxt->pTransporter, - .requestId = pCxt->pComCxt->requestId, - .requestObjRefId = pCxt->pComCxt->requestRid, - .mgmtEps = pCxt->pComCxt->mgmtEpSet}; + .requestId = pCxt->pComCxt->requestId, + .requestObjRefId = pCxt->pComCxt->requestRid, + .mgmtEps = pCxt->pComCxt->mgmtEpSet}; if (TSDB_CODE_SUCCESS == code) { code = catalogGetTableHashVgroup(pCxt->pComCxt->pCatalog, &conn, &pStbRowsCxt->ctbName, &vg); } @@ -2179,8 +2176,8 @@ static int32_t parseCsvFile(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt if (code == TSDB_CODE_SUCCESS) { SStbRowsDataContext* pStbRowsCxt = rowsDataCxt.pStbRowsCxt; void* pData = pTableDataCxt; - code = taosHashPut(pStmt->pTableCxtHashObj, &pStbRowsCxt->pCtbMeta->uid, sizeof(pStbRowsCxt->pCtbMeta->uid), - &pData, POINTER_BYTES); + code = taosHashPut(pStmt->pTableCxtHashObj, &pStbRowsCxt->pCtbMeta->uid, sizeof(pStbRowsCxt->pCtbMeta->uid), &pData, + POINTER_BYTES); if (TSDB_CODE_SUCCESS != code) { break; } @@ -2252,7 +2249,7 @@ static int32_t parseDataFromFileImpl(SInsertParseContext* pCxt, SVnodeModifyOpSt if (!pStmt->stbSyntax && numOfRows > 0) { void* pData = rowsDataCxt.pTableDataCxt; code = taosHashPut(pStmt->pTableCxtHashObj, &pStmt->pTableMeta->uid, sizeof(pStmt->pTableMeta->uid), &pData, - POINTER_BYTES); + POINTER_BYTES); } return code; @@ -2366,7 +2363,8 @@ static int32_t constructStbRowsDataContext(SVnodeModifyOpStmt* pStmt, SStbRowsDa if (TSDB_CODE_SUCCESS == code) { // col values and bound cols info of STableDataContext is not used pStbRowsCxt->aColVals = taosArrayInit(getNumOfColumns(pStbRowsCxt->pStbMeta), sizeof(SColVal)); - if (!pStbRowsCxt->aColVals) code = terrno; + if (!pStbRowsCxt->aColVals) + code = terrno; } if (TSDB_CODE_SUCCESS == code) { code = insInitColValues(pStbRowsCxt->pStbMeta, pStbRowsCxt->aColVals); @@ -2424,6 +2422,9 @@ static int32_t parseInsertStbClauseBottom(SInsertParseContext* pCxt, SVnodeModif // 1. [(tag1_name, ...)] ... // 2. VALUES ... | FILE ... static int32_t parseInsertTableClauseBottom(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt) { + if (pStmt->stbSyntax && TSDB_QUERY_HAS_TYPE(pStmt->insertType, TSDB_QUERY_TYPE_STMT_INSERT)) { + return buildInvalidOperationMsg(&pCxt->msg, "insert into super table syntax is not supported for stmt"); + } if (!pStmt->stbSyntax) { STableDataCxt* pTableCxt = NULL; int32_t code = parseSchemaClauseBottom(pCxt, pStmt, &pTableCxt); @@ -2510,9 +2511,9 @@ static int32_t checkTableClauseFirstToken(SInsertParseContext* pCxt, SVnodeModif } // db.? situation,ensure that the only thing following the '.' mark is '?' - char* tbNameAfterDbName = strnchr(pTbName->z, '.', pTbName->n, true); + char *tbNameAfterDbName = strnchr(pTbName->z, '.', pTbName->n, true); if ((tbNameAfterDbName != NULL) && (*(tbNameAfterDbName + 1) == '?')) { - char* tbName = NULL; + char *tbName = NULL; if (NULL == pCxt->pComCxt->pStmtCb) { return buildSyntaxErrMsg(&pCxt->msg, "? only used in stmt", pTbName->z); } @@ -2527,8 +2528,7 @@ static int32_t checkTableClauseFirstToken(SInsertParseContext* pCxt, SVnodeModif if (pCxt->isStmtBind) { if (TK_NK_ID == pTbName->type || (tbNameAfterDbName != NULL && *(tbNameAfterDbName + 1) != '?')) { // In SQL statements, the table name has already been specified. - parserWarn("0x%" PRIx64 " table name is specified in sql, ignore the table name in bind param", - pCxt->pComCxt->requestId); + parserWarn("0x%" PRIx64 " table name is specified in sql, ignore the table name in bind param", pCxt->pComCxt->requestId); } } @@ -2614,7 +2614,7 @@ static void destroySubTableHashElem(void* p) { taosMemoryFree(*(STableMeta**)p); static int32_t createVnodeModifOpStmt(SInsertParseContext* pCxt, bool reentry, SNode** pOutput) { SVnodeModifyOpStmt* pStmt = NULL; - int32_t code = nodesMakeNode(QUERY_NODE_VNODE_MODIFY_STMT, (SNode**)&pStmt); + int32_t code = nodesMakeNode(QUERY_NODE_VNODE_MODIFY_STMT, (SNode**)&pStmt); if (NULL == pStmt) { return code; } @@ -2729,7 +2729,7 @@ static int32_t buildTagNameFromMeta(STableMeta* pMeta, SArray** pTagName) { return terrno; } SSchema* pSchema = getTableTagSchema(pMeta); - int32_t code = 0; + int32_t code = 0; for (int32_t i = 0; i < pMeta->tableInfo.numOfTags; ++i) { if (NULL == taosArrayPush(*pTagName, pSchema[i].name)) { code = terrno; @@ -2834,7 +2834,7 @@ static int32_t resetVnodeModifOpStmt(SInsertParseContext* pCxt, SQuery* pQuery) } if (NULL == pStmt->pTableBlockHashObj) { pStmt->pTableBlockHashObj = - taosHashInit(128, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK); + taosHashInit(128, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK); } if (NULL == pStmt->pVgroupsHashObj || NULL == pStmt->pTableBlockHashObj) { code = TSDB_CODE_OUT_OF_MEMORY; @@ -2866,7 +2866,7 @@ static int32_t initInsertQuery(SInsertParseContext* pCxt, SCatalogReq* pCatalogR static int32_t setRefreshMeta(SQuery* pQuery) { SVnodeModifyOpStmt* pStmt = (SVnodeModifyOpStmt*)pQuery->pRoot; - int32_t code = 0; + int32_t code = 0; if (taosHashGetSize(pStmt->pTableNameHashObj) > 0) { taosArrayDestroy(pQuery->pTableList); @@ -3065,10 +3065,9 @@ int32_t parseInsertSql(SParseContext* pCxt, SQuery** pQuery, SCatalogReq* pCatal .forceUpdate = (NULL != pCatalogReq ? pCatalogReq->forceUpdate : false), .isStmtBind = pCxt->isStmtBind}; - int32_t code = initInsertQuery(&context, pCatalogReq, pMetaData, pQuery); - SVnodeModifyOpStmt* pStmt = (SVnodeModifyOpStmt*)((*pQuery)->pRoot); + int32_t code = initInsertQuery(&context, pCatalogReq, pMetaData, pQuery); if (TSDB_CODE_SUCCESS == code) { - code = parseInsertSqlImpl(&context, pStmt); + code = parseInsertSqlImpl(&context, (SVnodeModifyOpStmt*)(*pQuery)->pRoot); } if (TSDB_CODE_SUCCESS == code) { code = setNextStageInfo(&context, *pQuery, pCatalogReq); @@ -3077,27 +3076,8 @@ int32_t parseInsertSql(SParseContext* pCxt, SQuery** pQuery, SCatalogReq* pCatal QUERY_EXEC_STAGE_SCHEDULE == (*pQuery)->execStage) { code = setRefreshMeta(*pQuery); } - - if (pStmt->stbSyntax && TSDB_QUERY_HAS_TYPE(pStmt->insertType, TSDB_QUERY_TYPE_STMT_INSERT) && - code == TSDB_CODE_TSC_INVALID_OPERATION) { - context.tags.numOfBound = pStmt->pStbRowsCxt->boundColsInfo.numOfBound; - context.tags.numOfCols = pStmt->pStbRowsCxt->boundColsInfo.numOfCols; - context.tags.hasBoundCols = pStmt->pStbRowsCxt->boundColsInfo.hasBoundCols; - context.tags.pColIndex = taosMemoryMalloc(sizeof(int16_t) * context.tags.numOfBound); - if (NULL == context.tags.pColIndex) { - return terrno; - } - - (void)memcpy(context.tags.pColIndex, pStmt->pStbRowsCxt->boundColsInfo.pColIndex, - sizeof(int16_t) * pStmt->pStbRowsCxt->boundColsInfo.numOfBound); - code = setStmtInfo(&context, pStmt); - if (TSDB_CODE_SUCCESS == code) { - insDestroyBoundColInfo(&context.tags); - return TSDB_CODE_TSC_INVALID_OPERATION; - } - } - insDestroyBoundColInfo(&context.tags); + // if no data to insert, set emptyMode to avoid request server if (!context.needRequest) { (*pQuery)->execMode = QUERY_EXEC_MODE_EMPTY_RESULT; diff --git a/source/libs/parser/src/parInsertStmt.c b/source/libs/parser/src/parInsertStmt.c index 1355d9e09fb8..ee61611bf27c 100644 --- a/source/libs/parser/src/parInsertStmt.c +++ b/source/libs/parser/src/parInsertStmt.c @@ -242,7 +242,7 @@ int32_t qBindStmtTagsValue(void* pBlock, void* boundTags, int64_t suid, const ch } code = insBuildCreateTbReq(pDataBlock->pData->pCreateTbReq, tName, pTag, suid, sTableName, tagName, - pDataBlock->pMeta->tableInfo.numOfTags, TSDB_DEFAULT_TABLE_TTL); + pDataBlock->pMeta->tableInfo.numOfTags, TSDB_DEFAULT_TABLE_TTL); pTag = NULL; end: @@ -594,7 +594,7 @@ int32_t qBindStmtTagsValue2(void* pBlock, void* boundTags, int64_t suid, const c } code = insBuildCreateTbReq(pDataBlock->pData->pCreateTbReq, tName, pTag, suid, sTableName, tagName, - pDataBlock->pMeta->tableInfo.numOfTags, TSDB_DEFAULT_TABLE_TTL); + pDataBlock->pMeta->tableInfo.numOfTags, TSDB_DEFAULT_TABLE_TTL); pTag = NULL; end: @@ -886,7 +886,7 @@ int32_t qBindStmtSingleColValue2(void* pBlock, SArray* pCols, TAOS_STMT2_BIND* b int32_t buildBoundFields(int32_t numOfBound, int16_t* boundColumns, SSchema* pSchema, int32_t* fieldNum, TAOS_FIELD_E** fields, uint8_t timePrec) { - if (fields != NULL) { + if (fields) { *fields = taosMemoryCalloc(numOfBound, sizeof(TAOS_FIELD_E)); if (NULL == *fields) { return terrno; @@ -939,7 +939,7 @@ int32_t qBuildStmtColFields(void* pBlock, int32_t* fieldNum, TAOS_FIELD_E** fiel SSchema* pSchema = getTableColumnSchema(pDataBlock->pMeta); if (pDataBlock->boundColsInfo.numOfBound <= 0) { *fieldNum = 0; - if (fields != NULL) { + if (fields) { *fields = NULL; } diff --git a/tests/script/api/makefile b/tests/script/api/makefile index 9c2bb6be3d56..d8a4e192187a 100644 --- a/tests/script/api/makefile +++ b/tests/script/api/makefile @@ -25,7 +25,6 @@ exe: gcc $(CFLAGS) ./stmt.c -o $(ROOT)stmt $(LFLAGS) gcc $(CFLAGS) ./stmt2.c -o $(ROOT)stmt2 $(LFLAGS) gcc $(CFLAGS) ./stmt2-example.c -o $(ROOT)stmt2-example $(LFLAGS) - gcc $(CFLAGS) ./stmt2-get-fields.c -o $(ROOT)stmt2-get-fields $(LFLAGS) gcc $(CFLAGS) ./stmt2-nohole.c -o $(ROOT)stmt2-nohole $(LFLAGS) gcc $(CFLAGS) ./stmt-crash.c -o $(ROOT)stmt-crash $(LFLAGS) @@ -43,6 +42,5 @@ clean: rm $(ROOT)stmt rm $(ROOT)stmt2 rm $(ROOT)stmt2-example - rm $(ROOT)stmt2-get-fields rm $(ROOT)stmt2-nohole rm $(ROOT)stmt-crash diff --git a/tests/script/api/stmt2-get-fields.c b/tests/script/api/stmt2-get-fields.c deleted file mode 100644 index 23b91b56c905..000000000000 --- a/tests/script/api/stmt2-get-fields.c +++ /dev/null @@ -1,63 +0,0 @@ -// TAOS standard API example. The same syntax as MySQL, but only a subet -// to compile: gcc -o stmt2-get-fields stmt2-get-fields.c -ltaos - -#include -#include -#include -#include "taos.h" - -void do_query(TAOS *taos, const char *sql) { - TAOS_RES *result = taos_query(taos, sql); - int code = taos_errno(result); - if (code) { - printf("failed to query: %s, reason:%s\n", sql, taos_errstr(result)); - taos_free_result(result); - return; - } - taos_free_result(result); -} - -void do_stmt(TAOS *taos) { - do_query(taos, "drop database if exists db"); - do_query(taos, "create database db"); - do_query(taos, - "create table db.stb (ts timestamp, b binary(10)) tags(t1 " - "int, t2 binary(10))"); - - TAOS_STMT2_OPTION option = {0}; - TAOS_STMT2 *stmt = taos_stmt2_init(taos, &option); - const char *sql = "insert into db.stb(t1,t2,ts,b,tbname) values(?,?,?,?,?)"; - - int code = taos_stmt2_prepare(stmt, sql, 0); - if (code != 0) { - printf("failed to execute taos_stmt2_prepare. error:%s\n", taos_stmt2_error(stmt)); - taos_stmt2_close(stmt); - return; - } - - int fieldNum = 0; - TAOS_FIELD_ALL *pFields = NULL; - code = taos_stmt2_get_all_fields(stmt, &fieldNum, &pFields); - if (code != 0) { - printf("failed get col,ErrCode: 0x%x, ErrMessage: %s.\n", code, taos_stmt2_error(stmt)); - } else { - printf("col nums:%d\n", fieldNum); - for (int i = 0; i < fieldNum; i++) { - printf("field[%d]: %s,type:%d\n", i, pFields[i].name, pFields[i].field_type); - } - } - - taos_stmt2_close(stmt); -} - -int main() { - TAOS *taos = taos_connect("localhost", "root", "taosdata", "", 0); - if (!taos) { - printf("failed to connect to db, reason:%s\n", taos_errstr(taos)); - exit(1); - } - - do_stmt(taos); - taos_close(taos); - taos_cleanup(); -} \ No newline at end of file From 871dd7104003bd945131f45a8609d3a1fafd8f43 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Thu, 31 Oct 2024 14:08:38 +0800 Subject: [PATCH 507/695] fix(stream): add some logs. --- source/libs/stream/src/streamSched.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/libs/stream/src/streamSched.c b/source/libs/stream/src/streamSched.c index 25d6161aba10..c5c4a8cc3438 100644 --- a/source/libs/stream/src/streamSched.c +++ b/source/libs/stream/src/streamSched.c @@ -137,6 +137,8 @@ void streamTaskSchedHelper(void* param, void* tmrId) { return; } + stDebug("s-task:%s acquire task, refId:%"PRId64, pTask->id.idStr, pTask->id.refId); + const char* id = pTask->id.idStr; int32_t nextTrigger = (int32_t)pTask->info.delaySchedParam; int32_t vgId = pTask->pMeta->vgId; From 974591f2658ce8b53cf360db386ce038df24c208 Mon Sep 17 00:00:00 2001 From: xsren <285808407@qq.com> Date: Thu, 31 Oct 2024 14:23:28 +0800 Subject: [PATCH 508/695] fix: colDataSetOrCover --- include/common/tdatablock.h | 1 + source/common/src/tdatablock.c | 19 +++++++++++++++---- source/libs/executor/src/executorInt.c | 2 +- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/include/common/tdatablock.h b/include/common/tdatablock.h index 3b24ef9490c8..6578999db415 100644 --- a/include/common/tdatablock.h +++ b/include/common/tdatablock.h @@ -190,6 +190,7 @@ static FORCE_INLINE void colDataSetDouble(SColumnInfoData* pColumnInfoData, uint int32_t getJsonValueLen(const char* data); int32_t colDataSetVal(SColumnInfoData* pColumnInfoData, uint32_t rowIndex, const char* pData, bool isNull); +int32_t colDataSetValOrCover(SColumnInfoData* pColumnInfoData, uint32_t rowIndex, const char* pData, bool isNull); int32_t colDataReassignVal(SColumnInfoData* pColumnInfoData, uint32_t dstRowIdx, uint32_t srcRowIdx, const char* pData); int32_t colDataSetNItems(SColumnInfoData* pColumnInfoData, uint32_t rowIndex, const char* pData, uint32_t numOfRows, bool trimValue); diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c index 49dd9948f2a2..94ebcc70331d 100644 --- a/source/common/src/tdatablock.c +++ b/source/common/src/tdatablock.c @@ -97,8 +97,8 @@ static int32_t getDataLen(int32_t type, const char* pData) { return dataLen; } -int32_t colDataSetVal(SColumnInfoData* pColumnInfoData, uint32_t rowIndex, const char* pData, bool isNull) { - if (isNull || pData == NULL) { +static int32_t colDataSetValHelp(SColumnInfoData* pColumnInfoData, uint32_t rowIndex, const char* pData, bool isNull) { + if (isNull || pData == NULL) { // There is a placehold for each NULL value of binary or nchar type. if (IS_VAR_DATA_TYPE(pColumnInfoData->info.type)) { pColumnInfoData->varmeta.offset[rowIndex] = -1; // it is a null value of VAR type. @@ -143,7 +143,7 @@ int32_t colDataSetVal(SColumnInfoData* pColumnInfoData, uint32_t rowIndex, const uint32_t len = pColumnInfoData->varmeta.length; pColumnInfoData->varmeta.offset[rowIndex] = len; - (void) memmove(pColumnInfoData->pData + len, pData, dataLen); + (void)memmove(pColumnInfoData->pData + len, pData, dataLen); pColumnInfoData->varmeta.length += dataLen; } else { memcpy(pColumnInfoData->pData + pColumnInfoData->info.bytes * rowIndex, pData, pColumnInfoData->info.bytes); @@ -153,6 +153,18 @@ int32_t colDataSetVal(SColumnInfoData* pColumnInfoData, uint32_t rowIndex, const return 0; } +int32_t colDataSetVal(SColumnInfoData* pColumnInfoData, uint32_t rowIndex, const char* pData, bool isNull) { + if (IS_VAR_DATA_TYPE(pColumnInfoData->info.type)) { + pColumnInfoData->varmeta.offset[rowIndex] = -1; + } + + return colDataSetValHelp(pColumnInfoData, rowIndex, pData, isNull); +} + +int32_t colDataSetValOrCover(SColumnInfoData* pColumnInfoData, uint32_t rowIndex, const char* pData, bool isNull) { + return colDataSetValHelp(pColumnInfoData, rowIndex, pData, isNull); +} + int32_t colDataReassignVal(SColumnInfoData* pColumnInfoData, uint32_t dstRowIdx, uint32_t srcRowIdx, const char* pData) { int32_t type = pColumnInfoData->info.type; @@ -3382,7 +3394,6 @@ int32_t trimDataBlock(SSDataBlock* pBlock, int32_t totalRows, const bool* pBoolL } memcpy(p2, p1, len); - pDst->varmeta.offset[numOfRows] = -1; code = colDataSetVal(pDst, numOfRows, p2, false); taosMemoryFree(p2); if (code) { diff --git a/source/libs/executor/src/executorInt.c b/source/libs/executor/src/executorInt.c index b39cf4014d5f..1b823bf69d9f 100644 --- a/source/libs/executor/src/executorInt.c +++ b/source/libs/executor/src/executorInt.c @@ -702,7 +702,7 @@ int32_t copyResultrowToDataBlock(SExprInfo* pExprInfo, int32_t numOfExprs, SResu QUERY_CHECK_NULL(pColInfoData, code, lino, _end, terrno); char* in = GET_ROWCELL_INTERBUF(pCtx[j].resultInfo); for (int32_t k = 0; k < pRow->numOfRows; ++k) { - code = colDataSetVal(pColInfoData, pBlock->info.rows + k, in, pCtx[j].resultInfo->isNullRes); + code = colDataSetValOrCover(pColInfoData, pBlock->info.rows + k, in, pCtx[j].resultInfo->isNullRes); QUERY_CHECK_CODE(code, lino, _end); } } From 4d420effb826f84059425c8a38b00e191fbb4940 Mon Sep 17 00:00:00 2001 From: Yu Chen <74105241+yu285@users.noreply.github.com> Date: Thu, 31 Oct 2024 14:40:09 +0800 Subject: [PATCH 509/695] docs:Update description about "stt_trigger" --- docs/zh/14-reference/03-taos-sql/02-database.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/zh/14-reference/03-taos-sql/02-database.md b/docs/zh/14-reference/03-taos-sql/02-database.md index 7d040a2c44f7..cfbe8423d9b9 100644 --- a/docs/zh/14-reference/03-taos-sql/02-database.md +++ b/docs/zh/14-reference/03-taos-sql/02-database.md @@ -63,7 +63,7 @@ database_option: { - MAXROWS:文件块中记录的最大条数,默认为 4096 条。 - MINROWS:文件块中记录的最小条数,默认为 100 条。 - KEEP:表示数据文件保存的天数,缺省值为 3650,取值范围 [1, 365000],且必须大于或等于3倍的 DURATION 参数值。数据库会自动删除保存时间超过 KEEP 值的数据。KEEP 可以使用加单位的表示形式,如 KEEP 100h、KEEP 10d 等,支持 m(分钟)、h(小时)和 d(天)三个单位。也可以不写单位,如 KEEP 50,此时默认单位为天。企业版支持[多级存储](https://docs.taosdata.com/tdinternal/arch/#%E5%A4%9A%E7%BA%A7%E5%AD%98%E5%82%A8)功能, 因此, 可以设置多个保存时间(多个以英文逗号分隔,最多 3 个,满足 keep 0 \<= keep 1 \<= keep 2,如 KEEP 100h,100d,3650d); 社区版不支持多级存储功能(即使配置了多个保存时间, 也不会生效, KEEP 会取最大的保存时间)。 -- STT_TRIGGER:表示落盘文件触发文件合并的个数。默认为 1,范围 1 到 16。对于少表高频场景,此参数建议使用默认配置,或较小的值;而对于多表低频场景,此参数建议配置较大的值。 +- STT_TRIGGER:表示落盘文件触发文件合并的个数。开源版本固定为 1,企业版本可设置范围为 1 到 16。对于少表高频写入场景,此参数建议使用默认配置;而对于多表低频写入场景,此参数建议配置较大的值。 - SINGLE_STABLE:表示此数据库中是否只可以创建一个超级表,用于超级表列非常多的情况。 - 0:表示可以创建多张超级表。 - 1:表示只可以创建一张超级表。 From b1ad121bae8cf31956efcbca9e777ea9b5e53038 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Thu, 31 Oct 2024 14:49:16 +0800 Subject: [PATCH 510/695] fix(stream): release task before returning. --- source/dnode/vnode/src/tqCommon/tqCommon.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source/dnode/vnode/src/tqCommon/tqCommon.c b/source/dnode/vnode/src/tqCommon/tqCommon.c index e8d929e4aa9f..59e739d1ffb6 100644 --- a/source/dnode/vnode/src/tqCommon/tqCommon.c +++ b/source/dnode/vnode/src/tqCommon/tqCommon.c @@ -200,6 +200,8 @@ int32_t tqStreamTaskProcessUpdateReq(SStreamMeta* pMeta, SMsgCb* cb, SRpcMsg* pM bool update = streamMetaInitUpdateTaskList(pMeta, req.transId); if (!update) { rsp.code = TSDB_CODE_SUCCESS; + + streamMetaReleaseTask(pMeta, pTask); streamMetaWUnLock(pMeta); taosArrayDestroy(req.pNodeList); @@ -214,7 +216,10 @@ int32_t tqStreamTaskProcessUpdateReq(SStreamMeta* pMeta, SMsgCb* cb, SRpcMsg* pM tqDebug("s-task:%s (vgId:%d) already update in transId:%d, discard the nodeEp update msg", idstr, vgId, req.transId); rsp.code = TSDB_CODE_SUCCESS; + + streamMetaReleaseTask(pMeta, pTask); streamMetaWUnLock(pMeta); + taosArrayDestroy(req.pNodeList); return rsp.code; } From 3a66d2fb3bbec8c0a0bc7c3589ed61e5fd77f4ea Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Thu, 31 Oct 2024 14:51:56 +0800 Subject: [PATCH 511/695] fix:[TS-5441] error if cols not equal in write_raw_block --- source/libs/parser/src/parInsertUtil.c | 189 +++++++++----------- utils/test/c/write_raw_block_test.c | 235 ++++++------------------- 2 files changed, 145 insertions(+), 279 deletions(-) diff --git a/source/libs/parser/src/parInsertUtil.c b/source/libs/parser/src/parInsertUtil.c index 8adf32d2ddd4..bcb560ab5ef9 100644 --- a/source/libs/parser/src/parInsertUtil.c +++ b/source/libs/parser/src/parInsertUtil.c @@ -147,7 +147,7 @@ int16_t insFindCol(SToken* pColname, int16_t start, int16_t end, SSchema* pSchem } int32_t insBuildCreateTbReq(SVCreateTbReq* pTbReq, const char* tname, STag* pTag, int64_t suid, const char* sname, - SArray* tagName, uint8_t tagNum, int32_t ttl) { + SArray* tagName, uint8_t tagNum, int32_t ttl) { pTbReq->type = TD_CHILD_TABLE; pTbReq->ctb.pTag = (uint8_t*)pTag; pTbReq->name = taosStrdup(tname); @@ -174,7 +174,7 @@ static void initBoundCols(int32_t ncols, int16_t* pBoundCols) { static int32_t initColValues(STableMeta* pTableMeta, SArray* pValues) { SSchema* pSchemas = getTableColumnSchema(pTableMeta); - int32_t code = 0; + int32_t code = 0; for (int32_t i = 0; i < pTableMeta->tableInfo.numOfColumns; ++i) { SColVal val = COL_VAL_NONE(pSchemas[i].colId, pSchemas[i].type); if (NULL == taosArrayPush(pValues, &val)) { @@ -886,19 +886,77 @@ static bool findFileds(SSchema* pSchema, TAOS_FIELD* fields, int numFields) { return false; } +int32_t checkSchema(SSchema* pColSchema, int8_t* fields, char* errstr, int32_t errstrLen) { + if (*fields != pColSchema->type) { + if (errstr != NULL) + snprintf(errstr, errstrLen, "column type not equal, name:%s, schema type:%s, data type:%s", pColSchema->name, + tDataTypes[pColSchema->type].name, tDataTypes[*fields].name); + return TSDB_CODE_INVALID_PARA; + } + if (IS_VAR_DATA_TYPE(pColSchema->type) && *(int32_t*)(fields + sizeof(int8_t)) > pColSchema->bytes) { + if (errstr != NULL) + snprintf(errstr, errstrLen, + "column var data bytes error, name:%s, schema type:%s, bytes:%d, data type:%s, bytes:%d", + pColSchema->name, tDataTypes[pColSchema->type].name, pColSchema->bytes, tDataTypes[*fields].name, + *(int32_t*)(fields + sizeof(int8_t))); + return TSDB_CODE_INVALID_PARA; + } + + if (!IS_VAR_DATA_TYPE(pColSchema->type) && *(int32_t*)(fields + sizeof(int8_t)) != pColSchema->bytes) { + if (errstr != NULL) + snprintf(errstr, errstrLen, + "column normal data bytes not equal, name:%s, schema type:%s, bytes:%d, data type:%s, bytes:%d", + pColSchema->name, tDataTypes[pColSchema->type].name, pColSchema->bytes, tDataTypes[*fields].name, + *(int32_t*)(fields + sizeof(int8_t))); + return TSDB_CODE_INVALID_PARA; + } + return 0; +} + +#define PRCESS_DATA(i, j) \ + ret = checkSchema(pColSchema, fields, errstr, errstrLen); \ + if (ret != 0) { \ + goto end; \ + } \ + \ + if (pColSchema->colId == PRIMARYKEY_TIMESTAMP_COL_ID) { \ + hasTs = true; \ + } \ + \ + int8_t* offset = pStart; \ + if (IS_VAR_DATA_TYPE(pColSchema->type)) { \ + pStart += numOfRows * sizeof(int32_t); \ + } else { \ + pStart += BitmapLen(numOfRows); \ + } \ + char* pData = pStart; \ + \ + SColData* pCol = taosArrayGet(pTableCxt->pData->aCol, j); \ + ret = tColDataAddValueByDataBlock(pCol, pColSchema->type, pColSchema->bytes, numOfRows, offset, pData); \ + if (ret != 0) { \ + goto end; \ + } \ + fields += sizeof(int8_t) + sizeof(int32_t); \ + if (needChangeLength && version == BLOCK_VERSION_1) { \ + pStart += htonl(colLength[i]); \ + } else { \ + pStart += colLength[i]; \ + } \ + boundInfo->pColIndex[j] = -1; + int rawBlockBindData(SQuery* query, STableMeta* pTableMeta, void* data, SVCreateTbReq* pCreateTb, void* tFields, int numFields, bool needChangeLength, char* errstr, int32_t errstrLen, bool raw) { int ret = 0; - if(data == NULL) { + if (data == NULL) { uError("rawBlockBindData, data is NULL"); return TSDB_CODE_APP_ERROR; } void* tmp = taosHashGet(((SVnodeModifyOpStmt*)(query->pRoot))->pTableBlockHashObj, &pTableMeta->uid, sizeof(pTableMeta->uid)); - SVCreateTbReq *pCreateReqTmp = NULL; - if (tmp == NULL && pCreateTb != NULL){ + SVCreateTbReq* pCreateReqTmp = NULL; + if (tmp == NULL && pCreateTb != NULL) { ret = cloneSVreateTbReq(pCreateTb, &pCreateReqTmp); - if (ret != TSDB_CODE_SUCCESS){ + if (ret != TSDB_CODE_SUCCESS) { uError("cloneSVreateTbReq error"); goto end; } @@ -906,7 +964,7 @@ int rawBlockBindData(SQuery* query, STableMeta* pTableMeta, void* data, SVCreate STableDataCxt* pTableCxt = NULL; ret = insGetTableDataCxt(((SVnodeModifyOpStmt*)(query->pRoot))->pTableBlockHashObj, &pTableMeta->uid, - sizeof(pTableMeta->uid), pTableMeta, &pCreateReqTmp, &pTableCxt, true, false); + sizeof(pTableMeta->uid), pTableMeta, &pCreateReqTmp, &pTableCxt, true, false); if (pCreateReqTmp != NULL) { tdDestroySVCreateTbReq(pCreateReqTmp); taosMemoryFree(pCreateReqTmp); @@ -963,121 +1021,48 @@ int rawBlockBindData(SQuery* query, STableMeta* pTableMeta, void* data, SVCreate ret = TSDB_CODE_INVALID_PARA; goto end; } -// if (tFields != NULL && numFields > boundInfo->numOfBound) { -// if (errstr != NULL) snprintf(errstr, errstrLen, "numFields:%d bigger than num of bound cols:%d", numFields, boundInfo->numOfBound); -// ret = TSDB_CODE_INVALID_PARA; -// goto end; -// } - if (tFields == NULL && numOfCols != boundInfo->numOfBound) { - if (errstr != NULL) snprintf(errstr, errstrLen, "numFields:%d not equal to num of bound cols:%d", numOfCols, boundInfo->numOfBound); - ret = TSDB_CODE_INVALID_PARA; - goto end; - } + bool hasTs = false; if (tFields == NULL) { - for (int j = 0; j < boundInfo->numOfBound; j++) { - SSchema* pColSchema = &pSchema[j]; - SColData* pCol = taosArrayGet(pTableCxt->pData->aCol, j); - if (*fields != pColSchema->type && *(int32_t*)(fields + sizeof(int8_t)) != pColSchema->bytes) { - if (errstr != NULL) - snprintf(errstr, errstrLen, - "column type or bytes not equal, name:%s, schema type:%s, bytes:%d, data type:%s, bytes:%d", - pColSchema->name, tDataTypes[pColSchema->type].name, pColSchema->bytes, tDataTypes[*fields].name, - *(int32_t*)(fields + sizeof(int8_t))); - ret = TSDB_CODE_INVALID_PARA; - goto end; - } - - int8_t* offset = pStart; - if (IS_VAR_DATA_TYPE(pColSchema->type)) { - pStart += numOfRows * sizeof(int32_t); - } else { - pStart += BitmapLen(numOfRows); - } - char* pData = pStart; - ret = tColDataAddValueByDataBlock(pCol, pColSchema->type, pColSchema->bytes, numOfRows, offset, pData); - if (ret != 0) { - goto end; - } - fields += sizeof(int8_t) + sizeof(int32_t); - if (needChangeLength && version == BLOCK_VERSION_1) { - pStart += htonl(colLength[j]); - } else { - pStart += colLength[j]; - } + int32_t len = TMIN(numOfCols, boundInfo->numOfBound); + for (int j = 0; j < len; j++) { + SSchema* pColSchema = &pSchema[j]; + PRCESS_DATA(j, j) } } else { - bool hasTs = false; for (int i = 0; i < numFields; i++) { for (int j = 0; j < boundInfo->numOfBound; j++) { SSchema* pColSchema = &pSchema[j]; - char* fieldName = NULL; + char* fieldName = NULL; if (raw) { fieldName = ((SSchemaWrapper*)tFields)->pSchema[i].name; } else { fieldName = ((TAOS_FIELD*)tFields)[i].name; } if (strcmp(pColSchema->name, fieldName) == 0) { - if (*fields != pColSchema->type && *(int32_t*)(fields + sizeof(int8_t)) != pColSchema->bytes) { - if (errstr != NULL) - snprintf(errstr, errstrLen, - "column type or bytes not equal, name:%s, schema type:%s, bytes:%d, data type:%s, bytes:%d", - pColSchema->name, tDataTypes[pColSchema->type].name, pColSchema->bytes, tDataTypes[*fields].name, - *(int32_t*)(fields + sizeof(int8_t))); - ret = TSDB_CODE_INVALID_PARA; - goto end; - } - - if (pColSchema->colId == PRIMARYKEY_TIMESTAMP_COL_ID) { - hasTs = true; - } - - int8_t* offset = pStart; - if (IS_VAR_DATA_TYPE(pColSchema->type)) { - pStart += numOfRows * sizeof(int32_t); - } else { - pStart += BitmapLen(numOfRows); -// for(int k = 0; k < numOfRows; k++) { -// if(!colDataIsNull_f(offset, k) && pColSchema->type == TSDB_DATA_TYPE_INT){ -// printf("colName:%s,val:%d", fieldName, *(int32_t*)(pStart + k * sizeof(int32_t))); -// } -// } - } - char* pData = pStart; - - SColData* pCol = taosArrayGet(pTableCxt->pData->aCol, j); - ret = tColDataAddValueByDataBlock(pCol, pColSchema->type, pColSchema->bytes, numOfRows, offset, pData); - if (ret != 0) { - goto end; - } - fields += sizeof(int8_t) + sizeof(int32_t); - if (needChangeLength && version == BLOCK_VERSION_1) { - pStart += htonl(colLength[i]); - } else { - pStart += colLength[i]; - } - boundInfo->pColIndex[j] = -1; + PRCESS_DATA(i, j) break; } } } + } - if (!hasTs) { - if (errstr != NULL) snprintf(errstr, errstrLen, "timestamp column(primary key) not found in raw data"); - ret = TSDB_CODE_INVALID_PARA; - goto end; - } + if (!hasTs) { + if (errstr != NULL) snprintf(errstr, errstrLen, "timestamp column(primary key) not found in raw data"); + ret = TSDB_CODE_INVALID_PARA; + goto end; + } - for (int c = 0; c < boundInfo->numOfBound; ++c) { - if (boundInfo->pColIndex[c] != -1) { - SColData* pCol = taosArrayGet(pTableCxt->pData->aCol, c); - ret = tColDataAddValueByDataBlock(pCol, 0, 0, numOfRows, NULL, NULL); - if (ret != 0) { - goto end; - } - } else { - boundInfo->pColIndex[c] = c; // restore for next block + // process NULL data + for (int c = 0; c < boundInfo->numOfBound; ++c) { + if (boundInfo->pColIndex[c] != -1) { + SColData* pCol = taosArrayGet(pTableCxt->pData->aCol, c); + ret = tColDataAddValueByDataBlock(pCol, 0, 0, numOfRows, NULL, NULL); + if (ret != 0) { + goto end; } + } else { + boundInfo->pColIndex[c] = c; // restore for next block } } diff --git a/utils/test/c/write_raw_block_test.c b/utils/test/c/write_raw_block_test.c index 8ed997bc921d..ae4a606e6e65 100644 --- a/utils/test/c/write_raw_block_test.c +++ b/utils/test/c/write_raw_block_test.c @@ -19,196 +19,77 @@ #include "taos.h" #include "types.h" -int buildStable(TAOS* pConn) { - TAOS_RES* pRes = taos_query(pConn, - "CREATE STABLE `meters` (`ts` TIMESTAMP, `current` INT, `voltage` INT, `phase` FLOAT) TAGS " - "(`groupid` INT, `location` VARCHAR(16))"); - if (taos_errno(pRes) != 0) { - printf("failed to create super table meters, reason:%s\n", taos_errstr(pRes)); - return -1; - } +TAOS* pConn = NULL; +void action(char* sql) { + TAOS_RES* pRes = taos_query(pConn, sql); + ASSERT(taos_errno(pRes) == 0); taos_free_result(pRes); - - pRes = taos_query(pConn, "create table d0 using meters tags(1, 'San Francisco')"); - if (taos_errno(pRes) != 0) { - printf("failed to create child table d0, reason:%s\n", taos_errstr(pRes)); - return -1; - } - taos_free_result(pRes); - - pRes = taos_query(pConn, "insert into d0 (ts, current) values (now, 120)"); - if (taos_errno(pRes) != 0) { - printf("failed to insert into table d0, reason:%s\n", taos_errstr(pRes)); - return -1; - } - taos_free_result(pRes); - - pRes = taos_query(pConn, "create table d1 using meters tags(2, 'San Francisco')"); - if (taos_errno(pRes) != 0) { - printf("failed to create child table d1, reason:%s\n", taos_errstr(pRes)); - return -1; - } - taos_free_result(pRes); - - pRes = taos_query(pConn, "create table d2 using meters tags(3, 'San Francisco')"); - if (taos_errno(pRes) != 0) { - printf("failed to create child table d2, reason:%s\n", taos_errstr(pRes)); - return -1; - } - taos_free_result(pRes); - - pRes = taos_query(pConn, "create table ntba(ts timestamp, addr binary(32))"); - if (taos_errno(pRes) != 0) { - printf("failed to create ntba, reason:%s\n", taos_errstr(pRes)); - return -1; - } - taos_free_result(pRes); - - pRes = taos_query(pConn, "create table ntbb(ts timestamp, addr binary(8))"); - if (taos_errno(pRes) != 0) { - printf("failed to create ntbb, reason:%s\n", taos_errstr(pRes)); - return -1; - } - taos_free_result(pRes); - - pRes = taos_query(pConn, "insert into ntba values(now,'123456789abcdefg123456789')"); - if (taos_errno(pRes) != 0) { - printf("failed to insert table ntba, reason:%s\n", taos_errstr(pRes)); - return -1; - } - taos_free_result(pRes); - - pRes = taos_query(pConn, "insert into ntba values(now + 1s,'hello')"); - if (taos_errno(pRes) != 0) { - printf("failed to insert table ntba, reason:%s\n", taos_errstr(pRes)); - return -1; - } - taos_free_result(pRes); - - return 0; } -int32_t init_env() { - TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0); - if (pConn == NULL) { - return -1; - } - int32_t ret = -1; - - TAOS_RES* pRes = taos_query(pConn, "drop database if exists db_raw"); - if (taos_errno(pRes) != 0) { - printf("error in drop db_taosx, reason:%s\n", taos_errstr(pRes)); - goto END; - } - taos_free_result(pRes); - - pRes = taos_query(pConn, "create database if not exists db_raw vgroups 2"); - if (taos_errno(pRes) != 0) { - printf("error in create db_taosx, reason:%s\n", taos_errstr(pRes)); - goto END; - } - taos_free_result(pRes); - - pRes = taos_query(pConn, "use db_raw"); - if (taos_errno(pRes) != 0) { - printf("error in create db_taosx, reason:%s\n", taos_errstr(pRes)); - goto END; - } - taos_free_result(pRes); - - buildStable(pConn); - - pRes = taos_query(pConn, "select * from d0"); - if (taos_errno(pRes) != 0) { - printf("error in drop db_taosx, reason:%s\n", taos_errstr(pRes)); - goto END; - } - void *data = NULL; +int32_t test_write_raw_block(char* query, char* dst) { + TAOS_RES* pRes = taos_query(pConn, query); + ASSERT(taos_errno(pRes) == 0); + void* data = NULL; int32_t numOfRows = 0; int error_code = taos_fetch_raw_block(pRes, &numOfRows, &data); - if(error_code !=0 ){ - printf("error fetch raw block, reason:%s\n", taos_errstr(pRes)); - goto END; - } - - taos_write_raw_block(pConn, numOfRows, data, "d1"); + ASSERT(error_code == 0); + error_code = taos_write_raw_block(pConn, numOfRows, data, dst); taos_free_result(pRes); + return error_code; +} - pRes = taos_query(pConn, "select ts,phase from d0"); - if (taos_errno(pRes) != 0) { - printf("error in drop db_taosx, reason:%s\n", taos_errstr(pRes)); - goto END; - } - error_code = taos_fetch_raw_block(pRes, &numOfRows, &data); - if(error_code !=0 ){ - printf("error fetch raw block, reason:%s\n", taos_errstr(pRes)); - goto END; - } +int32_t test_write_raw_block_with_fields(char* query, char* dst) { + TAOS_RES* pRes = taos_query(pConn, query); + ASSERT(taos_errno(pRes) == 0); + void* data = NULL; + int32_t numOfRows = 0; + int error_code = taos_fetch_raw_block(pRes, &numOfRows, &data); + ASSERT(error_code == 0); int numFields = taos_num_fields(pRes); - TAOS_FIELD *fields = taos_fetch_fields(pRes); - taos_write_raw_block_with_fields(pConn, numOfRows, data, "d2", fields, numFields); + TAOS_FIELD* fields = taos_fetch_fields(pRes); + error_code = taos_write_raw_block_with_fields(pConn, numOfRows, data, dst, fields, numFields); taos_free_result(pRes); + return error_code; +} - // check error msg - pRes = taos_query(pConn, "select * from ntba"); - if (taos_errno(pRes) != 0) { - printf("error select * from ntba, reason:%s\n", taos_errstr(pRes)); - goto END; - } - - data = NULL; - numOfRows = 0; - error_code = taos_fetch_raw_block(pRes, &numOfRows, &data); - if(error_code !=0 ){ - printf("error fetch select * from ntba, reason:%s\n", taos_errstr(pRes)); - goto END; - } - error_code = taos_write_raw_block(pConn, numOfRows, data, "ntbb"); - if(error_code == 0) { - printf(" taos_write_raw_block to ntbb expect failed , but success!\n"); - goto END; - } - - // pass NULL return last error code describe - const char* err = tmq_err2str(error_code); - printf("write_raw_block return code =0x%x err=%s\n", error_code, err); - if(strcmp(err, "success") == 0) { - printf("expect failed , but error string is success! err=%s\n", err); - goto END; - } - - // no exist table - error_code = taos_write_raw_block(pConn, numOfRows, data, "no-exist-table"); - if(error_code == 0) { - printf(" taos_write_raw_block to no-exist-table expect failed , but success!\n"); - goto END; - } - - err = tmq_err2str(error_code); - printf("write_raw_block no exist table return code =0x%x err=%s\n", error_code, err); - if(strcmp(err, "success") == 0) { - printf("expect failed write no exist table, but error string is success! err=%s\n", err); - goto END; - } - - // success - ret = 0; - -END: - // free - if(pRes) taos_free_result(pRes); - if(pConn) taos_close(pConn); - return ret; +void init_env() { + pConn = taos_connect("localhost", "root", "taosdata", NULL, 0); + ASSERT(pConn); + + action("drop database if exists db_raw"); + action("create database if not exists db_raw vgroups 2"); + action("use db_raw"); + + action( + "CREATE STABLE `meters` (`ts` TIMESTAMP, `current` INT, `voltage` INT, `phase` FLOAT) TAGS (`groupid` INT, " + "`location` VARCHAR(16))"); + action("create table d0 using meters tags(1, 'San Francisco')"); + action("create table d1 using meters tags(2, 'San Francisco')"); + action("create table d2 using meters tags(3, 'San Francisco')"); + action("insert into d0 (ts, current) values (now, 120)"); + + action("create table ntba(ts timestamp, addr binary(32))"); + action("create table ntbb(ts timestamp, addr binary(8))"); + action("create table ntbc(ts timestamp, addr binary(8), c2 int)"); + + action("insert into ntba values(now,'123456789abcdefg123456789')"); + action("insert into ntbb values(now + 1s,'hello')"); + action("insert into ntbc values(now + 13s, 'sdf', 123)"); } int main(int argc, char* argv[]) { - printf("test write_raw_block...\n"); - int ret = init_env(); - if (ret < 0) { - printf("test write_raw_block failed.\n"); - return ret; - } - printf("test write_raw_block ok.\n"); + printf("test write_raw_block start.\n"); + init_env(); + ASSERT(test_write_raw_block("select * from d0", "d1") == 0); // test schema same + ASSERT(test_write_raw_block("select * from ntbb", "ntba") == 0); // test schema compatible + ASSERT(test_write_raw_block("select * from ntbb", "ntbc") == 0); // test schema small + ASSERT(test_write_raw_block("select * from ntbc", "ntbb") == 0); // test schema bigger + ASSERT(test_write_raw_block("select * from ntba", "ntbb") != 0); // test schema mismatch + ASSERT(test_write_raw_block("select * from ntba", "no-exist-table") != 0); // test no exist table + ASSERT(test_write_raw_block("select addr from ntba", "ntbb") != 0); // test without ts + ASSERT(test_write_raw_block_with_fields("select ts,phase from d0", "d2") == 0); // test with fields + + printf("test write_raw_block end.\n"); return 0; } \ No newline at end of file From 2879fafc1c6e9a27e268e630336949f3d54d1183 Mon Sep 17 00:00:00 2001 From: Shungang Li Date: Thu, 31 Oct 2024 14:54:01 +0800 Subject: [PATCH 512/695] fix: typo issue --- source/dnode/vnode/src/tsdb/tsdbCache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbCache.c b/source/dnode/vnode/src/tsdb/tsdbCache.c index 1ae7dfeff7b2..2cef541cdba3 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCache.c +++ b/source/dnode/vnode/src/tsdb/tsdbCache.c @@ -1378,7 +1378,7 @@ int32_t tsdbCacheRowFormatUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, int6 } else { if (!iColHash) { iColHash = tSimpleHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT)); - if (ctxArray == NULL) { + if (iColHash == NULL) { tsdbRowClose(&iter); TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit); } From 8b596ec4c41690ed42b7e60931b8a0eeba5c4e2b Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Thu, 31 Oct 2024 15:14:26 +0800 Subject: [PATCH 513/695] fix(stream): release task after acquire. --- source/libs/stream/src/streamMeta.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source/libs/stream/src/streamMeta.c b/source/libs/stream/src/streamMeta.c index 598f809c21a1..2a271b9960fc 100644 --- a/source/libs/stream/src/streamMeta.c +++ b/source/libs/stream/src/streamMeta.c @@ -538,6 +538,11 @@ void streamMetaClear(SStreamMeta* pMeta) { if (code) { stError("vgId:%d remove task refId failed, refId:%" PRId64, pMeta->vgId, refId); } + + code = taosReleaseRef(streamTaskRefPool, refId); + if (code) { + stError("vgId:%d failed to release refId:%" PRId64, pMeta->vgId, refId); + } } if (pMeta->streamBackendRid != 0) { From a685c1394a4316fe0c1dfc9a472c4f6be14f6ee9 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Thu, 31 Oct 2024 15:20:18 +0800 Subject: [PATCH 514/695] refactor: do some internal refactor. --- include/libs/stream/tstream.h | 1 - source/libs/stream/src/streamMeta.c | 4 ++-- source/libs/stream/src/streamTask.c | 2 -- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/include/libs/stream/tstream.h b/include/libs/stream/tstream.h index 449df5207f67..81be70e35f7c 100644 --- a/include/libs/stream/tstream.h +++ b/include/libs/stream/tstream.h @@ -455,7 +455,6 @@ struct SStreamTask { // the followings attributes don't be serialized SScanhistorySchedInfo schedHistoryInfo; - int32_t refCnt; int32_t transferStateAlignCnt; struct SStreamMeta* pMeta; SSHashObj* pNameMap; diff --git a/source/libs/stream/src/streamMeta.c b/source/libs/stream/src/streamMeta.c index 2a271b9960fc..93c205005f2b 100644 --- a/source/libs/stream/src/streamMeta.c +++ b/source/libs/stream/src/streamMeta.c @@ -529,7 +529,7 @@ void streamMetaClear(SStreamMeta* pMeta) { // release the ref by timer if (p->info.delaySchedParam != 0 && p->info.fillHistory == 0) { // one more ref in timer - stDebug("s-task:%s stop schedTimer, and (before) desc ref:%d", p->id.idStr, p->refCnt); + stDebug("s-task:%s stop schedTimer", p->id.idStr); streamTmrStop(p->schedInfo.pDelayTimer); p->info.delaySchedParam = 0; } @@ -929,7 +929,7 @@ int32_t streamMetaUnregisterTask(SStreamMeta* pMeta, int64_t streamId, int32_t t } if (pTask->info.delaySchedParam != 0 && pTask->info.fillHistory == 0) { - stDebug("s-task:%s stop schedTimer, and (before) desc ref:%d", pTask->id.idStr, pTask->refCnt); + stDebug("s-task:%s stop schedTimer", pTask->id.idStr); streamTmrStop(pTask->schedInfo.pDelayTimer); pTask->info.delaySchedParam = 0; } diff --git a/source/libs/stream/src/streamTask.c b/source/libs/stream/src/streamTask.c index 297dd6e72f1f..08870a54431f 100644 --- a/source/libs/stream/src/streamTask.c +++ b/source/libs/stream/src/streamTask.c @@ -423,9 +423,7 @@ int32_t streamTaskInit(SStreamTask* pTask, SStreamMeta* pMeta, SMsgCb* pMsgCb, i return code; } - pTask->refCnt = 1; pTask->id.refId = 0; - pTask->inputq.status = TASK_INPUT_STATUS__NORMAL; pTask->outputq.status = TASK_OUTPUT_STATUS__NORMAL; From eaea66cf480866f2b2b50a82aabe20e9ea160f59 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Thu, 31 Oct 2024 15:39:13 +0800 Subject: [PATCH 515/695] fix: value node clone issue --- source/libs/nodes/src/nodesCloneFuncs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/nodes/src/nodesCloneFuncs.c b/source/libs/nodes/src/nodesCloneFuncs.c index 8731199a5b7a..866b105ca17f 100644 --- a/source/libs/nodes/src/nodesCloneFuncs.c +++ b/source/libs/nodes/src/nodesCloneFuncs.c @@ -176,7 +176,7 @@ static int32_t valueNodeCopy(const SValueNode* pSrc, SValueNode* pDst) { case TSDB_DATA_TYPE_VARBINARY: case TSDB_DATA_TYPE_GEOMETRY: { int32_t len = varDataTLen(pSrc->datum.p); - pDst->datum.p = taosMemoryCalloc(1, len); + pDst->datum.p = taosMemoryCalloc(1, len + 1); if (NULL == pDst->datum.p) { return terrno; } From 72111db344385101a6f786c5b0f8a8df53c1200f Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Thu, 31 Oct 2024 15:44:25 +0800 Subject: [PATCH 516/695] test: add dnode list case --- tests/parallel_test/cases.task | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 817d9f049a44..8552982da088 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -1083,6 +1083,7 @@ ,,y,script,./test.sh -f tsim/user/privilege_table.sim ,,y,script,./test.sh -f tsim/user/privilege_create_db.sim ,,y,script,./test.sh -f tsim/db/alter_option.sim +,,y,script,./test.sh -f tsim/db/dnodelist.sim # ,,y,script,./test.sh -f tsim/db/alter_replica_31.sim ,,y,script,./test.sh -f tsim/db/basic1.sim ,,y,script,./test.sh -f tsim/db/basic2.sim From 5158bf6b96833752ee87a69af54498d92448b802 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Thu, 31 Oct 2024 15:50:56 +0800 Subject: [PATCH 517/695] fix issue --- source/libs/executor/inc/executorInt.h | 1 + source/libs/executor/inc/streamexecutorInt.h | 2 + source/libs/executor/src/streamfilloperator.c | 3 +- .../src/streamintervalsliceoperator.c | 7 +++ .../executor/src/streamtimesliceoperator.c | 47 +++++++++++++++---- .../8-stream/force_window_close_interval.py | 3 +- 6 files changed, 51 insertions(+), 12 deletions(-) diff --git a/source/libs/executor/inc/executorInt.h b/source/libs/executor/inc/executorInt.h index aa7344758a9f..1e59f3f6205d 100644 --- a/source/libs/executor/inc/executorInt.h +++ b/source/libs/executor/inc/executorInt.h @@ -856,6 +856,7 @@ typedef struct SStreamTimeSliceOperatorInfo { SGroupResInfo groupResInfo; bool ignoreNull; bool isHistoryOp; + SArray* pCloseTs; struct SOperatorInfo* pOperator; } SStreamTimeSliceOperatorInfo; diff --git a/source/libs/executor/inc/streamexecutorInt.h b/source/libs/executor/inc/streamexecutorInt.h index 1acfb4d2050f..3ebf6726c7eb 100644 --- a/source/libs/executor/inc/streamexecutorInt.h +++ b/source/libs/executor/inc/streamexecutorInt.h @@ -100,6 +100,8 @@ int32_t getQualifiedRowNumDesc(SExprSupp* pExprSup, SSDataBlock* pBlock, TSKEY* int32_t createStreamIntervalSliceOperatorInfo(struct SOperatorInfo* downstream, SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo, SReadHandle* pHandle, struct SOperatorInfo** ppOptInfo); +int32_t buildAllResultKey(SStreamAggSupporter* pAggSup, TSKEY ts, SArray* pUpdated); +void removeDuplicateTs(SArray* pTsArrray); #ifdef __cplusplus } diff --git a/source/libs/executor/src/streamfilloperator.c b/source/libs/executor/src/streamfilloperator.c index 08be9a4a64fd..3b6f77ad41a9 100644 --- a/source/libs/executor/src/streamfilloperator.c +++ b/source/libs/executor/src/streamfilloperator.c @@ -1272,7 +1272,7 @@ static int32_t doStreamForceFillImpl(SOperatorInfo* pOperator) { return code; } -static int32_t buildAllResultKey(SStreamAggSupporter* pAggSup, TSKEY ts, SArray* pUpdated) { +int32_t buildAllResultKey(SStreamAggSupporter* pAggSup, TSKEY ts, SArray* pUpdated) { int32_t code = TSDB_CODE_SUCCESS; int32_t lino = 0; int64_t groupId = 0; @@ -1367,6 +1367,7 @@ static int32_t doStreamForceFillNext(SOperatorInfo* pOperator, SSDataBlock** ppR QUERY_CHECK_CODE(code, lino, _end); } + removeDuplicateTs(pInfo->pCloseTs); for (int32_t i = 0; i < taosArrayGetSize(pInfo->pCloseTs); i++) { TSKEY ts = *(TSKEY*) taosArrayGet(pInfo->pCloseTs, i); code = buildAllResultKey(pInfo->pStreamAggSup, ts, pInfo->pUpdated); diff --git a/source/libs/executor/src/streamintervalsliceoperator.c b/source/libs/executor/src/streamintervalsliceoperator.c index 2b53159cb9cb..1179d8ce0c73 100644 --- a/source/libs/executor/src/streamintervalsliceoperator.c +++ b/source/libs/executor/src/streamintervalsliceoperator.c @@ -19,6 +19,7 @@ #include "storageapi.h" #include "streamexecutorInt.h" #include "tcommon.h" +#include "tcompare.h" #include "tdatablock.h" #include "ttime.h" @@ -627,3 +628,9 @@ int32_t createStreamIntervalSliceOperatorInfo(SOperatorInfo* downstream, SPhysiN (*ppOptInfo) = NULL; return code; } + +void removeDuplicateTs(SArray* pTsArrray) { + __compar_fn_t fn = getKeyComparFunc(TSDB_DATA_TYPE_TIMESTAMP, TSDB_ORDER_ASC); + taosArraySort(pTsArrray, fn); + taosArrayRemoveDuplicate(pTsArrray, fn, NULL); +} \ No newline at end of file diff --git a/source/libs/executor/src/streamtimesliceoperator.c b/source/libs/executor/src/streamtimesliceoperator.c index 07c96d38df94..113d5d5f5ad7 100644 --- a/source/libs/executor/src/streamtimesliceoperator.c +++ b/source/libs/executor/src/streamtimesliceoperator.c @@ -177,6 +177,8 @@ void destroyStreamTimeSliceOperatorInfo(void* param) { taosArrayDestroy(pInfo->historyWins); + taosArrayDestroy(pInfo->pCloseTs); + taosMemoryFreeClear(param); } @@ -1449,11 +1451,15 @@ void doBuildTimeSlicePointResult(SStreamAggSupporter* pAggSup, STimeWindowAggSup int32_t numOfRows = getNumOfTotalRes(pGroupResInfo); for (; pGroupResInfo->index < numOfRows; pGroupResInfo->index++) { SWinKey* pKey = (SWinKey*)taosArrayGet(pGroupResInfo->pRows, pGroupResInfo->index); - qDebug("===stream=== build interp res. key:%" PRId64 ",groupId:%" PRId64, pKey->ts, pKey->groupId); + qDebug("===stream=== build interp res. key:%" PRId64 ",groupId:%" PRIu64, pKey->ts, pKey->groupId); if (pBlock->info.id.groupId == 0) { pBlock->info.id.groupId = pKey->groupId; } else if (pBlock->info.id.groupId != pKey->groupId) { - break; + if (pBlock->info.rows > 0) { + break; + } else { + pBlock->info.id.groupId = pKey->groupId; + } } SSlicePoint curPoint = {.key.ts = pKey->ts, .key.groupId = pKey->groupId}; SSlicePoint prevPoint = {0}; @@ -1813,8 +1819,8 @@ static int32_t doStreamTimeSliceNext(SOperatorInfo* pOperator, SSDataBlock** ppR goto _end; } break; case STREAM_GET_RESULT: { - code = setAllResultKey(pAggSup, pBlock->info.window.skey, pInfo->pUpdatedMap); - QUERY_CHECK_CODE(code, lino, _end); + void* pPushRes = taosArrayPush(pInfo->pCloseTs, &pBlock->info.window.skey); + QUERY_CHECK_NULL(pPushRes, code, lino, _end, terrno); continue; } default: @@ -1831,12 +1837,29 @@ static int32_t doStreamTimeSliceNext(SOperatorInfo* pOperator, SSDataBlock** ppR QUERY_CHECK_CODE(code, lino, _end); } - void* pIte = NULL; - int32_t iter = 0; - while ((pIte = tSimpleHashIterate(pInfo->pUpdatedMap, pIte, &iter)) != NULL) { - SWinKey* pKey = (SWinKey*)tSimpleHashGetKey(pIte, NULL); - void* tmp = taosArrayPush(pInfo->pUpdated, pKey); - QUERY_CHECK_NULL(tmp, code, lino, _end, terrno); + if (taosArrayGetSize(pInfo->pCloseTs) > 0) { + removeDuplicateTs(pInfo->pCloseTs); + int32_t size = taosArrayGetSize(pInfo->pCloseTs); + qDebug("build stream result, ts count:%d", size); + for (int32_t i = 0; i < size; i++) { + TSKEY ts = *(TSKEY*) taosArrayGet(pInfo->pCloseTs, i); + code = buildAllResultKey(&pInfo->streamAggSup, ts, pInfo->pUpdated); + QUERY_CHECK_CODE(code, lino, _end); + } + qDebug("build stream result, ts count:%d", taosArrayGetSize(pInfo->pUpdated)); + taosArrayClear(pInfo->pCloseTs); + if (size > 1024) { + taosArrayDestroy(pInfo->pCloseTs); + pInfo->pCloseTs = taosArrayInit(1024, sizeof(TSKEY)); + } + } else { + void* pIte = NULL; + int32_t iter = 0; + while ((pIte = tSimpleHashIterate(pInfo->pUpdatedMap, pIte, &iter)) != NULL) { + SWinKey* pKey = (SWinKey*)tSimpleHashGetKey(pIte, NULL); + void* tmp = taosArrayPush(pInfo->pUpdated, pKey); + QUERY_CHECK_NULL(tmp, code, lino, _end, terrno); + } } taosArraySort(pInfo->pUpdated, winKeyCmprImpl); @@ -2088,6 +2111,10 @@ int32_t createStreamTimeSliceOperatorInfo(SOperatorInfo* downstream, SPhysiNode* if (pHandle) { pInfo->isHistoryOp = pHandle->fillHistory; } + + pInfo->pCloseTs = taosArrayInit(1024, sizeof(TSKEY)); + QUERY_CHECK_NULL(pInfo->pCloseTs, code, lino, _error, terrno); + pInfo->pOperator = pOperator; pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERP_FUNC; diff --git a/tests/system-test/8-stream/force_window_close_interval.py b/tests/system-test/8-stream/force_window_close_interval.py index 88b1628b25d2..d0e87847a977 100644 --- a/tests/system-test/8-stream/force_window_close_interval.py +++ b/tests/system-test/8-stream/force_window_close_interval.py @@ -275,8 +275,9 @@ def force_window_close( time.sleep(self.tdCom.dataDict["interval"]) tdSql.query("show streams") tdLog.info(f"tdSql.queryResult:{tdSql.queryResult},tdSql.queryRows:{tdSql.queryRows}") + localQueryResult = tdSql.queryResult for stream_number in range(tdSql.queryRows): - stream_name = tdSql.queryResult[stream_number][0] + stream_name = localQueryResult[stream_number][0] tdCom.check_stream_task_status( stream_name=stream_name, vgroups=2, stream_timeout=20,check_wal_info=False ) From 0a4cdb4c471890369274390e538df9c384d48617 Mon Sep 17 00:00:00 2001 From: dmchen Date: Thu, 31 Oct 2024 08:03:29 +0000 Subject: [PATCH 518/695] fix/TD-32703-add-wal-log --- source/dnode/mgmt/mgmt_vnode/src/vmHandle.c | 2 +- source/libs/wal/src/walMeta.c | 32 +++++++++++++-------- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c index 8a8dcc74a5bd..006f44b349cb 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c @@ -741,7 +741,7 @@ int32_t vmProcessAlterVnodeReplicaReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) { int32_t vgId = alterReq.vgId; dInfo( - "vgId:%d,vnode management handle msgType:%s, start to alter vnode replica:%d selfIndex:%d leanerReplica:%d " + "vgId:%d, vnode management handle msgType:%s, start to alter vnode replica:%d selfIndex:%d leanerReplica:%d " "learnerSelfIndex:%d strict:%d changeVersion:%d", vgId, TMSG_INFO(pMsg->msgType), alterReq.replica, alterReq.selfIndex, alterReq.learnerReplica, alterReq.learnerSelfIndex, alterReq.strict, alterReq.changeVersion); diff --git a/source/libs/wal/src/walMeta.c b/source/libs/wal/src/walMeta.c index 3c396f0599d3..da26ddae3ae2 100644 --- a/source/libs/wal/src/walMeta.c +++ b/source/libs/wal/src/walMeta.c @@ -411,14 +411,14 @@ static int32_t walTrimIdxFile(SWal* pWal, int32_t fileIdx) { TAOS_RETURN(TSDB_CODE_SUCCESS); } -void printFileSet(SArray* fileSet) { +static void printFileSet(int32_t vgId, SArray* fileSet, const char* str) { int32_t sz = taosArrayGetSize(fileSet); for (int32_t i = 0; i < sz; i++) { SWalFileInfo* pFileInfo = taosArrayGet(fileSet, i); - wInfo("firstVer:%" PRId64 ", lastVer:%" PRId64 ", fileSize:%" PRId64 ", syncedOffset:%" PRId64 ", createTs:%" PRId64 - ", closeTs:%" PRId64, - pFileInfo->firstVer, pFileInfo->lastVer, pFileInfo->fileSize, pFileInfo->syncedOffset, pFileInfo->createTs, - pFileInfo->closeTs); + wInfo("vgId:%d, %s-%d, firstVer:%" PRId64 ", lastVer:%" PRId64 ", fileSize:%" PRId64 ", syncedOffset:%" PRId64 + ", createTs:%" PRId64 ", closeTs:%" PRId64, + vgId, str, i, pFileInfo->firstVer, pFileInfo->lastVer, pFileInfo->fileSize, pFileInfo->syncedOffset, + pFileInfo->createTs, pFileInfo->closeTs); } } @@ -430,6 +430,9 @@ int32_t walCheckAndRepairMeta(SWal* pWal) { regex_t logRegPattern; regex_t idxRegPattern; + wInfo("vgId:%d, begin to repair meta, wal path:%s, firstVer:%" PRId64 ", lastVer:%" PRId64 ", snapshotVer:%" PRId64, + pWal->cfg.vgId, pWal->path, pWal->vers.firstVer, pWal->vers.lastVer, pWal->vers.snapshotVer); + if (regcomp(&logRegPattern, logPattern, REG_EXTENDED) != 0) { wError("failed to compile log pattern, error:%s", tstrerror(terrno)); return terrno; @@ -482,9 +485,9 @@ int32_t walCheckAndRepairMeta(SWal* pWal) { taosArraySort(actualLog, compareWalFileInfo); - wInfo("vgId:%d, wal path:%s, actual log file num:%d", pWal->cfg.vgId, pWal->path, + wInfo("vgId:%d, actual log file, wal path:%s, num:%d", pWal->cfg.vgId, pWal->path, (int32_t)taosArrayGetSize(actualLog)); - printFileSet(actualLog); + printFileSet(pWal->cfg.vgId, actualLog, "actual log file"); int metaFileNum = taosArrayGetSize(pWal->fileInfoSet); int actualFileNum = taosArrayGetSize(actualLog); @@ -500,9 +503,9 @@ int32_t walCheckAndRepairMeta(SWal* pWal) { TAOS_RETURN(code); } - wInfo("vgId:%d, wal path:%s, meta log file num:%d", pWal->cfg.vgId, pWal->path, + wInfo("vgId:%d, log file in meta, wal path:%s, num:%d", pWal->cfg.vgId, pWal->path, (int32_t)taosArrayGetSize(pWal->fileInfoSet)); - printFileSet(pWal->fileInfoSet); + printFileSet(pWal->cfg.vgId, pWal->fileInfoSet, "log file in meta"); int32_t sz = taosArrayGetSize(pWal->fileInfoSet); @@ -563,7 +566,9 @@ int32_t walCheckAndRepairMeta(SWal* pWal) { // repair ts of files TAOS_CHECK_RETURN(walRepairLogFileTs(pWal, &updateMeta)); - printFileSet(pWal->fileInfoSet); + wInfo("vgId:%d, log file after repair, wal path:%s, num:%d", pWal->cfg.vgId, pWal->path, + (int32_t)taosArrayGetSize(pWal->fileInfoSet)); + printFileSet(pWal->cfg.vgId, pWal->fileInfoSet, "file after repair"); // update meta file if (updateMeta) { TAOS_CHECK_RETURN(walSaveMeta(pWal)); @@ -571,6 +576,9 @@ int32_t walCheckAndRepairMeta(SWal* pWal) { TAOS_CHECK_RETURN(walLogEntriesComplete(pWal)); + wInfo("vgId:%d, success to repair meta, wal path:%s, firstVer:%" PRId64 ", lastVer:%" PRId64 ", snapshotVer:%" PRId64, + pWal->cfg.vgId, pWal->path, pWal->vers.firstVer, pWal->vers.lastVer, pWal->vers.snapshotVer); + return code; } @@ -1157,9 +1165,9 @@ int32_t walLoadMeta(SWal* pWal) { (void)taosCloseFile(&pFile); taosMemoryFree(buf); - wInfo("vgId:%d, load meta file: %s, firstVer:%" PRId64 ", lastVer:%" PRId64 ", fileInfoSet size:%d", pWal->cfg.vgId, + wInfo("vgId:%d, meta file loaded: %s, firstVer:%" PRId64 ", lastVer:%" PRId64 ", fileInfoSet size:%d", pWal->cfg.vgId, fnameStr, pWal->vers.firstVer, pWal->vers.lastVer, (int32_t)taosArrayGetSize(pWal->fileInfoSet)); - printFileSet(pWal->fileInfoSet); + printFileSet(pWal->cfg.vgId, pWal->fileInfoSet, "file in meta"); TAOS_RETURN(code); } From c7ebc4f77b923f26cb97f5e4677b72d6e9c16fb1 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Thu, 31 Oct 2024 16:09:10 +0800 Subject: [PATCH 519/695] fix: compile errors --- source/dnode/mnode/impl/inc/mndDb.h | 1 + source/dnode/mnode/impl/src/mndDb.c | 54 +---------------------------- 2 files changed, 2 insertions(+), 53 deletions(-) diff --git a/source/dnode/mnode/impl/inc/mndDb.h b/source/dnode/mnode/impl/inc/mndDb.h index b72d1386c1bb..fdb6b5a80b97 100644 --- a/source/dnode/mnode/impl/inc/mndDb.h +++ b/source/dnode/mnode/impl/inc/mndDb.h @@ -37,6 +37,7 @@ const char *mndGetDbStr(const char *src); const char *mndGetStableStr(const char *src); int32_t mndProcessCompactDbReq(SRpcMsg *pReq); +int32_t mndCheckDbDnodeList(SMnode *pMnode, char *db, char *dnodeListStr, SArray *dnodeList); #ifdef __cplusplus } diff --git a/source/dnode/mnode/impl/src/mndDb.c b/source/dnode/mnode/impl/src/mndDb.c index e8c49d9ffabe..58404caa835c 100644 --- a/source/dnode/mnode/impl/src/mndDb.c +++ b/source/dnode/mnode/impl/src/mndDb.c @@ -57,6 +57,7 @@ static int32_t mndProcessGetDbCfgReq(SRpcMsg *pReq); #ifndef TD_ENTERPRISE int32_t mndProcessCompactDbReq(SRpcMsg *pReq) { return TSDB_CODE_OPS_NOT_SUPPORT; } +int32_t mndCheckDbDnodeList(SMnode *pMnode, char *db, char *dnodeListStr, SArray *dnodeList) { return 0; } #endif int32_t mndInitDb(SMnode *pMnode) { @@ -883,59 +884,6 @@ static void mndBuildAuditDetailInt64(char *detail, char *tmp, char *format, int6 } } -static int32_t mndCheckDbDnodeList(SMnode *pMnode, char *db, char *dnodeListStr, SArray *dnodeList) { - if (dnodeListStr[0] == 0) return 0; - - mInfo("db:%s, dnode list is %s", db, dnodeListStr); - - int32_t len = strlen(dnodeListStr); - for (int32_t i = 0; i < len; ++i) { - if ((dnodeListStr[i] < '0' || dnodeListStr[i] > '9') && dnodeListStr[i] != ',') { - terrno = TSDB_CODE_MND_INVALID_DNODE_LIST_FMT; - return terrno; - } - } - - char *pos = dnodeListStr; - while (pos != NULL) { - if (pos[0] < '0' || pos[0] > '9') { - terrno = TSDB_CODE_MND_INVALID_DNODE_LIST_FMT; - return terrno; - } - - int32_t dnodeId = taosStr2Int32(pos, NULL, 10); - SDnodeObj *pDnode = mndAcquireDnode(pMnode, dnodeId); - if (pDnode != NULL) { - mndReleaseDnode(pMnode, pDnode); - if (taosArrayPush(dnodeList, &dnodeId) == NULL) { - terrno = TSDB_CODE_OUT_OF_MEMORY; - return terrno; - } - } else { - mError("db:%s, invalid dnode:%d from pos:%s", db, dnodeId, pos); - terrno = TSDB_CODE_MND_DNODE_NOT_EXIST; - return terrno; - } - - pos = strstr(pos, ","); - if (pos != NULL) { - pos++; - } - } - - int32_t dnodeSize = (int32_t)taosArrayGetSize(dnodeList); - for (int32_t i = 0; i < dnodeSize; ++i) { - for (int32_t j = i + 1; j < dnodeSize; ++j) { - if (((int32_t *)TARRAY_DATA(dnodeList))[i] == ((int32_t *)TARRAY_DATA(dnodeList))[j]) { - terrno = TSDB_CODE_MND_DNODE_LIST_REPEAT; - return terrno; - } - } - } - - return 0; -} - static int32_t mndCheckDbEncryptKey(SMnode *pMnode, SCreateDbReq *pReq) { int32_t code = 0; SSdb *pSdb = pMnode->pSdb; From fde9eeb9ca06ef2c6ff5e89786118437ed3f1ade Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Thu, 31 Oct 2024 16:10:05 +0800 Subject: [PATCH 520/695] fix ci issue --- source/libs/executor/src/streamtimesliceoperator.c | 4 ++-- tests/system-test/8-stream/force_window_close_interval.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/source/libs/executor/src/streamtimesliceoperator.c b/source/libs/executor/src/streamtimesliceoperator.c index 113d5d5f5ad7..b49b42f0b2e5 100644 --- a/source/libs/executor/src/streamtimesliceoperator.c +++ b/source/libs/executor/src/streamtimesliceoperator.c @@ -1840,13 +1840,13 @@ static int32_t doStreamTimeSliceNext(SOperatorInfo* pOperator, SSDataBlock** ppR if (taosArrayGetSize(pInfo->pCloseTs) > 0) { removeDuplicateTs(pInfo->pCloseTs); int32_t size = taosArrayGetSize(pInfo->pCloseTs); - qDebug("build stream result, ts count:%d", size); + qDebug("===stream===build stream result, ts count:%d", size); for (int32_t i = 0; i < size; i++) { TSKEY ts = *(TSKEY*) taosArrayGet(pInfo->pCloseTs, i); code = buildAllResultKey(&pInfo->streamAggSup, ts, pInfo->pUpdated); QUERY_CHECK_CODE(code, lino, _end); } - qDebug("build stream result, ts count:%d", taosArrayGetSize(pInfo->pUpdated)); + qDebug("===stream===build stream result, res count:%ld", taosArrayGetSize(pInfo->pUpdated)); taosArrayClear(pInfo->pCloseTs); if (size > 1024) { taosArrayDestroy(pInfo->pCloseTs); diff --git a/tests/system-test/8-stream/force_window_close_interval.py b/tests/system-test/8-stream/force_window_close_interval.py index d0e87847a977..34e03dbc7052 100644 --- a/tests/system-test/8-stream/force_window_close_interval.py +++ b/tests/system-test/8-stream/force_window_close_interval.py @@ -533,12 +533,12 @@ def force_window_close( ) self.tdCom.check_query_data( f'select irowts, table_name, c_c1, isfilled, {funciton_name_alias} from {self.stb_stream_des_partition_column1_table} where irowts >= {start_force_ts} and irowts <= "{end_new_ts}" order by c_c1, irowts', - f'select _irowts as irowts ,tbname as table_name, c1 as c_c1, _isfilled as isfilled , {funciton_name} as {funciton_name_alias} from {tbname} {where_tbname} partition by {partition},c1 range("{start_new_ts}","{end_new_ts}") every({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by c_c1, irowts', + f'select _irowts as irowts ,tbname as table_name, c1 as c_c1, _isfilled as isfilled , {funciton_name} as {funciton_name_alias} from {tbname} {where_tbname} and ts >= {start_force_ts} partition by {partition},c1 range("{start_new_ts}","{end_new_ts}") every({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by c_c1, irowts', fill_value=fill_value, ) self.tdCom.check_query_data( f'select irowts, table_name, c_c2, isfilled, {funciton_name_alias} from {self.stb_stream_des_partition_column2_table} where irowts >= {start_force_ts} and irowts <= "{end_new_ts}" order by c_c2, irowts', - f'select _irowts as irowts ,tbname as table_name, c2 as c_c2, _isfilled as isfilled , {funciton_name} as {funciton_name_alias} from {tbname}, {where_tbname} partition by {partition},c2 range("{start_new_ts}","{end_new_ts}") every({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by c_c2, irowts', + f'select _irowts as irowts ,tbname as table_name, c2 as c_c2, _isfilled as isfilled , {funciton_name} as {funciton_name_alias} from {tbname} {where_tbname} and ts >= {start_force_ts} partition by {partition},c2 range("{start_new_ts}","{end_new_ts}") every({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by c_c2, irowts', fill_value=fill_value, ) else: From aec6f3a105e6dbf15f421ddf710121a0cb7822c1 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Thu, 31 Oct 2024 16:10:35 +0800 Subject: [PATCH 521/695] feat: adjust error messages --- source/util/src/terror.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/util/src/terror.c b/source/util/src/terror.c index a4872e35cf76..d9831acf9023 100644 --- a/source/util/src/terror.c +++ b/source/util/src/terror.c @@ -269,7 +269,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_SYS_TABLENAME, "Invalid system table TAOS_DEFINE_ERROR(TSDB_CODE_MND_ENCRYPT_NOT_ALLOW_CHANGE, "Encryption is not allowed to be changed after database is created") TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_WAL_LEVEL, "Invalid option, wal_level 0 should be used with replica 1") TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_DNODE_LIST_FMT, "Invalid dnode list format") -TAOS_DEFINE_ERROR(TSDB_CODE_MND_DNODE_LIST_REPEAT, "There are duplicate items in the dnode list") +TAOS_DEFINE_ERROR(TSDB_CODE_MND_DNODE_LIST_REPEAT, "Duplicate items in the dnode list") // mnode-node TAOS_DEFINE_ERROR(TSDB_CODE_MND_MNODE_ALREADY_EXIST, "Mnode already exists") From 5bab977a4359c24274d4d60e12613dfe71926693 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Thu, 31 Oct 2024 16:36:35 +0800 Subject: [PATCH 522/695] fix: create db errors --- source/dnode/mnode/impl/src/mndDb.c | 6 +++++- source/dnode/mnode/impl/src/mndVgroup.c | 19 +++++++++++-------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndDb.c b/source/dnode/mnode/impl/src/mndDb.c index 58404caa835c..2379975db266 100644 --- a/source/dnode/mnode/impl/src/mndDb.c +++ b/source/dnode/mnode/impl/src/mndDb.c @@ -57,7 +57,6 @@ static int32_t mndProcessGetDbCfgReq(SRpcMsg *pReq); #ifndef TD_ENTERPRISE int32_t mndProcessCompactDbReq(SRpcMsg *pReq) { return TSDB_CODE_OPS_NOT_SUPPORT; } -int32_t mndCheckDbDnodeList(SMnode *pMnode, char *db, char *dnodeListStr, SArray *dnodeList) { return 0; } #endif int32_t mndInitDb(SMnode *pMnode) { @@ -926,6 +925,11 @@ static int32_t mndCheckDbEncryptKey(SMnode *pMnode, SCreateDbReq *pReq) { TAOS_RETURN(code); } +int32_t mndCheckDbDnodeList(SMnode *pMnode, char *db, char *dnodeListStr, SArray *dnodeList) { + terrno = TSDB_CODE_OPS_NOT_SUPPORT; + return terrno; +} + static int32_t mndProcessCreateDbReq(SRpcMsg *pReq) { SMnode *pMnode = pReq->info.node; int32_t code = -1; diff --git a/source/dnode/mnode/impl/src/mndVgroup.c b/source/dnode/mnode/impl/src/mndVgroup.c index ddf42e0a59cf..913e6e329585 100644 --- a/source/dnode/mnode/impl/src/mndVgroup.c +++ b/source/dnode/mnode/impl/src/mndVgroup.c @@ -724,15 +724,18 @@ static bool mndBuildDnodesArrayFp(SMnode *pMnode, void *pObj, void *p1, void *p2 } if (dnodeList != NULL) { - bool inDnodeList = false; - for (int32_t index = 0; index < taosArrayGetSize(dnodeList); ++index) { - int32_t dnodeId = *(int32_t *)taosArrayGet(dnodeList, index); - if (pDnode->id == dnodeId) { - inDnodeList = true; + int32_t dnodeListSize = taosArrayGetSize(dnodeList); + if (dnodeListSize > 0) { + bool inDnodeList = false; + for (int32_t index = 0; index < dnodeListSize; ++index) { + int32_t dnodeId = *(int32_t *)taosArrayGet(dnodeList, index); + if (pDnode->id == dnodeId) { + inDnodeList = true; + } + } + if (!inDnodeList) { + return true; } - } - if (!inDnodeList) { - return true; } } From 25f07c6e342c2f5746c99ded7dc4ea50a6ab9505 Mon Sep 17 00:00:00 2001 From: qevolg <2227465945@qq.com> Date: Thu, 31 Oct 2024 16:42:52 +0800 Subject: [PATCH 523/695] fix(.github): fix taoskeeper ci --- .github/workflows/taoskeeper-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/taoskeeper-ci.yml b/.github/workflows/taoskeeper-ci.yml index 38dfb6d43c00..ba43937029d6 100644 --- a/.github/workflows/taoskeeper-ci.yml +++ b/.github/workflows/taoskeeper-ci.yml @@ -28,7 +28,7 @@ jobs: run: | mkdir debug cd debug - cmake .. -DBUILD_HTTP=false -DBUILD_JDBC=false -DBUILD_TOOLS=false -DBUILD_TEST=off -DBUILD_KEEPER=true + cmake .. -DBUILD_HTTP=false -DBUILD_JDBC=false -DBUILD_TOOLS=false -DBUILD_TEST=off -DBUILD_KEEPER=true -DBUILD_DEPENDENCY_TESTS=false make -j 4 sudo make install which taosd From 3129d425762af79fa3ba991f466e5a2c3a3808af Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Thu, 31 Oct 2024 16:44:10 +0800 Subject: [PATCH 524/695] fix: minor changes --- source/dnode/mnode/impl/src/mndDb.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndDb.c b/source/dnode/mnode/impl/src/mndDb.c index 2379975db266..2bd5e7ed9cdf 100644 --- a/source/dnode/mnode/impl/src/mndDb.c +++ b/source/dnode/mnode/impl/src/mndDb.c @@ -926,8 +926,12 @@ static int32_t mndCheckDbEncryptKey(SMnode *pMnode, SCreateDbReq *pReq) { } int32_t mndCheckDbDnodeList(SMnode *pMnode, char *db, char *dnodeListStr, SArray *dnodeList) { - terrno = TSDB_CODE_OPS_NOT_SUPPORT; - return terrno; + if (dnodeListStr[0] != 0) { + terrno = TSDB_CODE_OPS_NOT_SUPPORT; + return terrno; + } else { + return 0; + } } static int32_t mndProcessCreateDbReq(SRpcMsg *pReq) { From 44a9752cd3848ccdc96aa149a466aa0c46226f46 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Thu, 31 Oct 2024 16:49:12 +0800 Subject: [PATCH 525/695] fix: minor changes --- source/dnode/mnode/impl/src/mndDb.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/dnode/mnode/impl/src/mndDb.c b/source/dnode/mnode/impl/src/mndDb.c index 2bd5e7ed9cdf..7a8965da565c 100644 --- a/source/dnode/mnode/impl/src/mndDb.c +++ b/source/dnode/mnode/impl/src/mndDb.c @@ -925,6 +925,7 @@ static int32_t mndCheckDbEncryptKey(SMnode *pMnode, SCreateDbReq *pReq) { TAOS_RETURN(code); } +#ifndef TD_ENTERPRISE int32_t mndCheckDbDnodeList(SMnode *pMnode, char *db, char *dnodeListStr, SArray *dnodeList) { if (dnodeListStr[0] != 0) { terrno = TSDB_CODE_OPS_NOT_SUPPORT; @@ -933,6 +934,7 @@ int32_t mndCheckDbDnodeList(SMnode *pMnode, char *db, char *dnodeListStr, SArray return 0; } } +#endif static int32_t mndProcessCreateDbReq(SRpcMsg *pReq) { SMnode *pMnode = pReq->info.node; From af68768b2bd75490b56d5e7467a142422ac83957 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Thu, 31 Oct 2024 16:53:26 +0800 Subject: [PATCH 526/695] Update index.md --- docs/zh/06-advanced/06-data-analysis/index.md | 62 +++++++++++++------ 1 file changed, 42 insertions(+), 20 deletions(-) diff --git a/docs/zh/06-advanced/06-data-analysis/index.md b/docs/zh/06-advanced/06-data-analysis/index.md index 1ab36d41784d..fb7280815004 100644 --- a/docs/zh/06-advanced/06-data-analysis/index.md +++ b/docs/zh/06-advanced/06-data-analysis/index.md @@ -125,7 +125,6 @@ model-dir=/usr/local/taos/taosanode/model/ # default log level log-level = DEBUG - ``` **提示** @@ -167,7 +166,12 @@ DROP ANODE {anode_id} ### 时序数据分析功能 #### 时序数据异常检测 -异常窗口寻找时间序列中可能出现异常的多个时间区间,可基于此窗口边界,对数据进行聚合或标量查询。 时间序列异常窗口中的所有数据均是依据指定算法判断出来的异常值。 +异常检测是针对输入的时序数据,使用预设或用户指定的算法确定时间序列中**可能**出现异常时间序列点,对于时间序列中若干个连续的异常点,将自动合并成为一个连续的(闭区间)异常窗口。对于只有单个点的场景,异常窗口窗口退化成为一个起始时间和结束时间相同的点。 +异常检测生成的异常窗口受检测算法和算法参数的共同影响,对于异常窗口范围内的数据,可以应用 TDengine 提供的聚合和标量函数进行查询或变换处理。 +对于输入时间序列 (1, 20), (2, 22), (3, 91), (4, 120), (5, 18), (6, 19)。系统检测到 (3, 91), (4, 120) 为异常点,那么返回的异常窗口是闭区间 [3, 4]。 + + +##### 语法 ```SQL ANOMALY_WINDOW(column_name, option_expr) @@ -179,11 +183,12 @@ algo=expr1 "} ``` -**语法说明** 1. `column`:进行时序数据异常检测的输入数据列,当前只支持单列输入,且只能是数值类型,不能是字符类型(例如:`NCHAR` `VARCHAR` `VARBINARY`等类型),**不支持函数表达式**。 2. `options`:字符串。其中使用 K/V 调用异常检测的算法,及与算法相关的参数。采用 逗号分隔的K/V字符串表示,其中的字符串不需要使用单引号、双引号、或转意号等符号,不能使用中文及其他宽字符。例如:`algo=ksigma, k=2` 表示进行异常检测的算法是 ksigma,该算法接受的输入参数是 2。 +3. 异常检测的结果可以作为外层查询的子查询输入,在 `SELECT` 子句中使用的聚合函数或标量函数与其他类型的窗口查询相同。 +4. 输入数据默认进行白噪声检查,如果检查结果是输入数据是白噪声,将不会有任何(异常)窗口信息返回。 -全部支持的参数列表如下: +**参数说明** |参数|含义|默认值| |---|---|---| |algo|异常检测调用的算法|iqr| @@ -207,12 +212,16 @@ FROM ai.atb ANOMALY_WINDOW(i32, "algo=ksigma,k=2"); ``` +``` +taos> SELECT _wstart, _wend, count(*) FROM ai.atb ANOMAYL_WINDOW(i32); + _wstart | _wend | count(*) | +============================================================================ + 2020-01-01 00:00:16.000 | 2020-01-01 00:00:16.001 | 1 | +Query OK, 1 row(s) in set (0.028946s) +``` -**使用说明** -1. 异常检测的结果可以作为外层查询的子查询输入,在 `SELECT` 子句中使用的聚合函数或标量函数与其他类型的窗口查询相同。 -2. 输入数据默认进行白噪声检查,如果检查结果是输入数据是白噪声,将不会有任何(异常)窗口信息返回。 -**当前支持异常检测算法** +**可用异常检测算法** - iqr - ksigma - grubbs @@ -222,7 +231,9 @@ ANOMALY_WINDOW(i32, "algo=ksigma,k=2"); #### 时序数据预测 -数据预测以一段训练数据作为输入,预测接下来若干时间点的后续运行结果。其调用的语法如下: +数据预测以一段训练数据作为输入,预测接下来一个连续时间区间内,时序数据的趋势。 + +##### 语法 ```SQL FORECAST(column_expr, option_expr) @@ -237,11 +248,11 @@ algo=expr1 "} ``` - -**语法说明** 1. `column_expr`:预测的时序数据列。与异常检测相同,只支持数值类型输入。 2. `options`:异常检测函数的参数,使用规则与 anomaly_window 相同。预测还支持`conf`, `every`, `rows`, `start`, `rows` 几个参数,其含义如下: +**参数说明** + |参数|含义|默认值| |---|---|---| |algo|预测分析使用的算法|holtwinters| @@ -251,10 +262,10 @@ algo=expr1 |start|预测结果的开始时间戳|输入数据最后一个时间戳加上一个采样时间段| |rows|预测结果的记录数|10| -预测查询结果新增了三个伪列,具体如下: -1. `_FROWTS`:预测结果的时间戳 -2. `_FLOW`:置信区间下界 -3. `_FHIGH`:置信区间上界, 对于没有置信区间的预测算法,其置信区间同预测结果 +1. 预测查询结果新增了三个伪列,具体如下: `_FROWTS`:预测结果的时间戳、`_FLOW`:置信区间下界、`_FHIGH`:置信区间上界, 对于没有置信区间的预测算法,其置信区间同预测结果 +2. 更改参数 `START`:返回预测结果的起始时间,改变这个起始时间不会影响返回的预测数值,只影响起始时间。 +3. `EVERY`:可以与输入数据的采样频率不同。采样频率只能低于或等于输入数据采样频率,不能**高于**输入数据的采样频率。 +4. 对于某些不需要计算置信区间的算法,即使指定了置信区间,返回的结果中其上下界退化成为一个点。 **示例** @@ -267,12 +278,23 @@ FROM ai.ftb; SELECT _flow, _fhigh, _frowts, FORECAST(i32, "algo=arima,alpha=95,period=10") FROM ai.ftb; ``` +``` +taos> select _flow, _fhigh, _frowts, forecast(i32) from ai.ftb; + _flow | _fhigh | _frowts | forecast(i32) | +======================================================================================== + 10.5286684 | 41.8038254 | 2020-01-01 00:01:35.001 | 26 | + -21.9861946 | 83.3938904 | 2020-01-01 00:01:36.001 | 30 | + -78.5686035 | 144.6729126 | 2020-01-01 00:01:37.001 | 33 | + -154.9797363 | 230.3057709 | 2020-01-01 00:01:38.001 | 37 | + -253.9852905 | 337.6083984 | 2020-01-01 00:01:39.001 | 41 | + -375.7857971 | 466.4594727 | 2020-01-01 00:01:40.001 | 45 | + -514.8043823 | 622.4426270 | 2020-01-01 00:01:41.001 | 53 | + -680.6343994 | 796.2861328 | 2020-01-01 00:01:42.001 | 57 | + -868.4956665 | 992.8603516 | 2020-01-01 00:01:43.001 | 62 | + -1076.1566162 | 1214.4498291 | 2020-01-01 00:01:44.001 | 69 | +``` -**使用说明** -1. `START`:返回预测结果的起始时间,改变这个起始时间不会影响返回的预测数值,只影响起始时间。 -2. `EVERY`:可以与输入数据的采样频率不同。采样频率只能低于或等于输入数据采样频率,不能**高于**输入数据的采样频率。 -3. 对于某些不需要计算置信区间的算法,即使指定了置信区间,返回的结果中其上下界退化成为一个点。 -**支持预测算法** +**可用预测算法** - arima - holtwinters From 9b743c10bdbf8ebf7517831ead093562402099f8 Mon Sep 17 00:00:00 2001 From: qevolg <2227465945@qq.com> Date: Thu, 31 Oct 2024 16:59:43 +0800 Subject: [PATCH 527/695] chore(*): trigger taoskeeper ci --- examples/c/asyncdemo.c | 1 + tools/keeper/api/adapter2_test.go | 1 + 2 files changed, 2 insertions(+) diff --git a/examples/c/asyncdemo.c b/examples/c/asyncdemo.c index 91ec6f24b190..ef0bbc1e554d 100644 --- a/examples/c/asyncdemo.c +++ b/examples/c/asyncdemo.c @@ -17,6 +17,7 @@ // this example opens multiple tables, insert/retrieve multiple tables // it is used by TAOS internally for one performance testing // to compiple: gcc -o asyncdemo asyncdemo.c -ltaos +// #include #include diff --git a/tools/keeper/api/adapter2_test.go b/tools/keeper/api/adapter2_test.go index e6fd263c43fa..5456dfeecf1a 100644 --- a/tools/keeper/api/adapter2_test.go +++ b/tools/keeper/api/adapter2_test.go @@ -14,6 +14,7 @@ import ( ) func TestAdapter2(t *testing.T) { + // c := &config.Config{ InstanceID: 64, Port: 6043, From ad6fe3f1ed706ded00e2259f39400d5c4b1114ee Mon Sep 17 00:00:00 2001 From: qevolg <2227465945@qq.com> Date: Thu, 31 Oct 2024 17:00:29 +0800 Subject: [PATCH 528/695] chore(*): trigger taoskeeper ci --- examples/c/asyncdemo.c | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/c/asyncdemo.c b/examples/c/asyncdemo.c index ef0bbc1e554d..91ec6f24b190 100644 --- a/examples/c/asyncdemo.c +++ b/examples/c/asyncdemo.c @@ -17,7 +17,6 @@ // this example opens multiple tables, insert/retrieve multiple tables // it is used by TAOS internally for one performance testing // to compiple: gcc -o asyncdemo asyncdemo.c -ltaos -// #include #include From c9ee2a8565db7196782870521c81031be6ef4d03 Mon Sep 17 00:00:00 2001 From: qevolg <2227465945@qq.com> Date: Thu, 31 Oct 2024 17:03:14 +0800 Subject: [PATCH 529/695] chore(*): trigger taoskeeper ci --- tools/keeper/api/adapter2_test.go | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/keeper/api/adapter2_test.go b/tools/keeper/api/adapter2_test.go index 5456dfeecf1a..e6fd263c43fa 100644 --- a/tools/keeper/api/adapter2_test.go +++ b/tools/keeper/api/adapter2_test.go @@ -14,7 +14,6 @@ import ( ) func TestAdapter2(t *testing.T) { - // c := &config.Config{ InstanceID: 64, Port: 6043, From c8cb0d0716fb9de05874beb1748ae403d407459a Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Thu, 31 Oct 2024 17:06:11 +0800 Subject: [PATCH 530/695] doc: update database option --- docs/zh/14-reference/03-taos-sql/02-database.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/zh/14-reference/03-taos-sql/02-database.md b/docs/zh/14-reference/03-taos-sql/02-database.md index 7d040a2c44f7..e679f05296fd 100644 --- a/docs/zh/14-reference/03-taos-sql/02-database.md +++ b/docs/zh/14-reference/03-taos-sql/02-database.md @@ -30,6 +30,7 @@ database_option: { | SINGLE_STABLE {0 | 1} | TABLE_PREFIX value | TABLE_SUFFIX value + | DNODES value | TSDB_PAGESIZE value | WAL_LEVEL {1 | 2} | WAL_FSYNC_PERIOD value @@ -70,6 +71,7 @@ database_option: { - TABLE_PREFIX:当其为正值时,在决定把一个表分配到哪个 vgroup 时要忽略表名中指定长度的前缀;当其为负值时,在决定把一个表分配到哪个 vgroup 时只使用表名中指定长度的前缀;例如,假定表名为 "v30001",当 TSDB_PREFIX = 2 时 使用 "0001" 来决定分配到哪个 vgroup ,当 TSDB_PREFIX = -2 时使用 "v3" 来决定分配到哪个 vgroup - TABLE_SUFFIX:当其为正值时,在决定把一个表分配到哪个 vgroup 时要忽略表名中指定长度的后缀;当其为负值时,在决定把一个表分配到哪个 vgroup 时只使用表名中指定长度的后缀;例如,假定表名为 "v30001",当 TSDB_SUFFIX = 2 时 使用 "v300" 来决定分配到哪个 vgroup ,当 TSDB_SUFFIX = -2 时使用 "01" 来决定分配到哪个 vgroup。 - TSDB_PAGESIZE:一个 VNODE 中时序数据存储引擎的页大小,单位为 KB,默认为 4 KB。范围为 1 到 16384,即 1 KB到 16 MB。 +- DNODES:指定 VNODE 所在的 DNODE 列表,如 '1,2,3',以逗号区分且字符间不能有空格,仅企业版支持。 - WAL_LEVEL:WAL 级别,默认为 1。 - 1:写 WAL,但不执行 fsync。 - 2:写 WAL,而且执行 fsync。 From 726594b926d3e8b7f131e9b611179a68d338f65c Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Thu, 31 Oct 2024 17:08:07 +0800 Subject: [PATCH 531/695] fix: float display issue --- include/common/ttypes.h | 4 ++-- source/libs/scalar/src/sclfunc.c | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/include/common/ttypes.h b/include/common/ttypes.h index 087e5931952a..bf9205ecfe99 100644 --- a/include/common/ttypes.h +++ b/include/common/ttypes.h @@ -241,14 +241,14 @@ typedef struct { case TSDB_DATA_TYPE_FLOAT: { \ int32_t n = snprintf(_output, (int32_t)(_outputBytes), "%f", *(float *)(_input)); \ if (n >= (_outputBytes)) { \ - snprintf(_output, (int32_t)(_outputBytes), "%*.7f", (int32_t)((_outputBytes) - 1), *(float *)(_input)); \ + snprintf(_output, (int32_t)(_outputBytes), "%.7e", *(float *)(_input)); \ } \ break; \ } \ case TSDB_DATA_TYPE_DOUBLE: { \ int32_t n = snprintf(_output, (int32_t)(_outputBytes), "%f", *(double *)(_input)); \ if (n >= (_outputBytes)) { \ - snprintf(_output, (int32_t)(_outputBytes), "%*.7f", (int32_t)((_outputBytes) - 1), *(double *)(_input)); \ + snprintf(_output, (int32_t)(_outputBytes), "%.15e", *(double *)(_input)); \ } \ break; \ } \ diff --git a/source/libs/scalar/src/sclfunc.c b/source/libs/scalar/src/sclfunc.c index 6f6362a8f791..d01a5ed7abc0 100644 --- a/source/libs/scalar/src/sclfunc.c +++ b/source/libs/scalar/src/sclfunc.c @@ -2085,7 +2085,8 @@ int32_t castFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutp (void)memcpy(varDataVal(output), convBuf, len); varDataSetLen(output, len); } else { - NUM_TO_STRING(inputType, input, bufSize, buf); + int32_t outputSize = TMIN(outputLen - VARSTR_HEADER_SIZE, bufSize); + NUM_TO_STRING(inputType, input, outputSize, buf); int32_t len = (int32_t)strlen(buf); len = (outputLen - VARSTR_HEADER_SIZE) > len ? len : (outputLen - VARSTR_HEADER_SIZE); (void)memcpy(varDataVal(output), buf, len); From b663adf946bf6d247c5ebd9ee0e363a7ecc2a144 Mon Sep 17 00:00:00 2001 From: xsren <285808407@qq.com> Date: Thu, 31 Oct 2024 17:33:08 +0800 Subject: [PATCH 532/695] feat: delete report --- include/libs/monitor/clientMonitor.h | 3 ++ source/client/src/clientImpl.c | 2 + source/client/src/clientMonitor.c | 71 ++++++++++++++++++++++++++-- 3 files changed, 73 insertions(+), 3 deletions(-) diff --git a/include/libs/monitor/clientMonitor.h b/include/libs/monitor/clientMonitor.h index 0085173ecd7e..b09a1ac11ce4 100644 --- a/include/libs/monitor/clientMonitor.h +++ b/include/libs/monitor/clientMonitor.h @@ -24,6 +24,7 @@ extern "C" { #include "thash.h" #include "query.h" #include "tqueue.h" +#include "clientInt.h" typedef enum { SQL_RESULT_SUCCESS = 0, @@ -81,6 +82,8 @@ void monitorCreateClientCounter(int64_t clusterId, const char* name, void monitorCounterInc(int64_t clusterId, const char* counterName, const char** label_values); const char* monitorResultStr(SQL_RESULT_CODE code); int32_t monitorPutData2MonitorQueue(MonitorSlowLogData data); + +void clientOperateReport(SRequestObj* pRequest); #ifdef __cplusplus } #endif diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index 2c67cafdf590..13ca874c47dd 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -2945,6 +2945,8 @@ TAOS_RES* taosQueryImpl(TAOS* taos, const char* sql, bool validateOnly, int8_t s tscDebug("taos_query end with sql:%s", sql); + clientOperateReport(pRequest); + return pRequest; } diff --git a/source/client/src/clientMonitor.c b/source/client/src/clientMonitor.c index 595c87195375..0624d8d94da2 100644 --- a/source/client/src/clientMonitor.c +++ b/source/client/src/clientMonitor.c @@ -2,8 +2,6 @@ #include "cJSON.h" #include "clientInt.h" #include "clientLog.h" -#include "os.h" -#include "tglobal.h" #include "tmisce.h" #include "tqueue.h" #include "ttime.h" @@ -932,4 +930,71 @@ int32_t monitorPutData2MonitorQueue(MonitorSlowLogData data) { taosFreeQitem(slowLogData); } return 0; -} \ No newline at end of file +} + +int32_t reportCB(void* param, SDataBuf* pMsg, int32_t code) { + taosMemoryFree(pMsg->pData); + taosMemoryFree(pMsg->pEpSet); + tscDebug("[del report]delete reportCB code:%d", code); + return 0; +} + +void clientOperateReport(SRequestObj* pRequest) { + if (pRequest == NULL || pRequest->pQuery == NULL) { + tscError("[del report]invalid request"); + return; + } + + if (QUERY_NODE_DELETE_STMT == nodeType(pRequest->pQuery->pRoot)) { + SDeleteStmt* pStmt = (SDeleteStmt*)pRequest->pQuery->pRoot; + STscObj* pTscObj = pRequest->pTscObj; + + if(nodeType(pStmt->pFromTable) != QUERY_NODE_REAL_TABLE) { + tscError("[del report]invalid from table node type:%d", nodeType(pStmt->pFromTable)); + return; + } + SRealTableNode* pTable = (SRealTableNode*)pStmt->pFromTable; + SAuditReq req; + req.pSql = pRequest->sqlstr; + req.sqlLen = pRequest->sqlLen; + tsnprintf(req.table, TSDB_TABLE_NAME_LEN, "%s", pTable->table.tableName); + tsnprintf(req.db, TSDB_DB_FNAME_LEN, "%s", pTable->table.dbName); + tsnprintf(req.operation, AUDIT_OPERATION_LEN, "delete"); + int32_t tlen = tSerializeSAuditReq(NULL, 0, &req); + void* pReq = taosMemoryCalloc(1, tlen); + if (pReq == NULL) { + tscError("[del report]failed to allocate memory for req"); + return; + } + + if (tSerializeSAuditReq(pReq, tlen, &req) < 0) { + tscError("[del report]failed to serialize req"); + taosMemoryFree(pReq); + return; + } + + SMsgSendInfo* sendInfo = taosMemoryCalloc(1, sizeof(SMsgSendInfo)); + if (sendInfo == NULL) { + tscError("[del report]failed to allocate memory for sendInfo"); + taosMemoryFree(pReq); + return; + } + + sendInfo->msgInfo = (SDataBuf){.pData = pReq, .len = tlen, .handle = NULL}; + + sendInfo->requestId = generateRequestId(); + sendInfo->requestObjRefId = 0; + sendInfo->param = NULL; + sendInfo->fp = reportCB; + sendInfo->msgType = TDMT_MND_AUDIT; + + SEpSet epSet = getEpSet_s(&pTscObj->pAppInfo->mgmtEp); + + int32_t code = asyncSendMsgToServer(pTscObj->pAppInfo->pTransporter, &epSet, NULL, sendInfo); + if (code != 0) { + tscError("[del report]failed to send msg to server, code:%d", code); + taosMemoryFree(sendInfo); + } + tscDebug("[del report]delete data, sql:%s", req.pSql); + } +} From e4da6fa17a10cde2d51d6d69c07bf79e97344977 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Thu, 31 Oct 2024 17:38:26 +0800 Subject: [PATCH 533/695] Update 01-arima.md --- .../06-advanced/06-data-analysis/01-arima.md | 43 ++++++++++++++++++- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/docs/zh/06-advanced/06-data-analysis/01-arima.md b/docs/zh/06-advanced/06-data-analysis/01-arima.md index 1668da453c17..a51e293a48b0 100644 --- a/docs/zh/06-advanced/06-data-analysis/01-arima.md +++ b/docs/zh/06-advanced/06-data-analysis/01-arima.md @@ -3,8 +3,47 @@ title: "ARIMA" sidebar_label: "ARIMA" --- -本节讲述如何 ARIMA 算法的使用方法。 +本节讲述 ARIMA 算法模型的使用方法。 ## 功能概述 -…… \ No newline at end of file +ARIMA 即自回归移动平均模型(Autoregressive Integrated Moving Average, ARIMA),也记作 ARIMA(p,d,q),是统计模型中最常见的一种用来进行时间序列预测的模型。 +ARIMA模型是一种自回归模型,只需要自变量即可预测后续的值。ARIMA模型要求时序数据是**平稳**,或经过差分处理后平稳,如果是不平稳的数据,**无法**获得正确的结果。 + +>平稳的时间序列:其性质不随观测时间的变化而变化。具有趋势或季节性的时间序列不是平稳时间序列——趋势和季节性使得时间序列在不同时段呈现不同性质。 + +以下参数可以动态输入控制预测过程中生成 合适的 ARIMA 的模型。 + +- p= 自回归模型阶数 +- d= 差分阶数 +- q= 移动平均模型阶数 + + +### 参数 +分析平台中使用自动化的 ARIMA 模型进行计算,因此每次计算的时候会根据输入的数据自动拟合最合适的模型,然后根据该模型进行预测输出结果。 +|参数名称|说明|必填项| +|---|---|---| +|period|输入时间序列数据每个周期包含的数据点个数。如果不设置该参数或则该参数设置为 0, 将使用非季节性/周期性的 ARIMA 模型预测。|选填| +|start_p| 自回归模型阶数的 起始值,0 开始的整数,不推荐大于 10 |选填| +|max_p| 自回归模型阶数的 结束值,0 开始的整数,不推荐大于 10 |选填| +|start_q| 移动平均模型阶数的起始值, 0 开始的整数,不推荐大于 10 |选填| +|max_q| 移动平均模型阶数的结束值, 0 开始的整数,不推荐大于 10 |选填| +|d| 差分阶数|选填| + +`start_p`、`max_p` `start_q` `max_q` 四个参数约束了模型在多大的范围内去搜寻合适的最优解。相同输入数据的条件下,参数范围越大,消耗的资源越多,系统响应的时间越长。 + +### 返回结果 +```json5 +{ +"rows": fc_rows, // 预测结果的行数 +"period": period, // 返回结果的周期性,同输入 +"alpha": alpha, // 返回结果的置信区间,同输入 +"algo": "arima", // 返回结果使用的算法 +"mse",mse, // 拟合输入时序数据时候生成模型的最小均方误差(MSE) +"res": res // 列模式的结果 +} +``` + +### 算法详细解释 +- https://en.wikipedia.org/wiki/Autoregressive_moving-average_model +- https://baike.baidu.com/item/%E8%87%AA%E5%9B%9E%E5%BD%92%E6%BB%91%E5%8A%A8%E5%B9%B3%E5%9D%87%E6%A8%A1%E5%9E%8B/5023931?fromtitle=ARMA%E6%A8%A1%E5%9E%8B&fromid=8048415 From 6010e52a2389a77897a0bf474066973baf0f40ac Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Thu, 31 Oct 2024 17:42:06 +0800 Subject: [PATCH 534/695] blob/param: new cases for default value checking --- tests/army/storage/blob/ablob.py | 39 ++++++++++++++++---------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/tests/army/storage/blob/ablob.py b/tests/army/storage/blob/ablob.py index f6e783d6f3f4..d3e00f3424d5 100644 --- a/tests/army/storage/blob/ablob.py +++ b/tests/army/storage/blob/ablob.py @@ -31,8 +31,6 @@ class TDTestCase(TBase): - index = eutil.cpuRand(20) + 1 - bucketName = f"ci-bucket{index}" updatecfgDict = { "supportVnodes":"1000", 's3EndPoint': 'https://.blob.core.windows.net', @@ -44,7 +42,6 @@ class TDTestCase(TBase): 's3MigrateEnabled': '1' } - tdLog.info(f"assign bucketName is {bucketName}\n") maxFileSize = (128 + 10) * 1014 * 1024 # add 10M buffer def insertData(self): @@ -172,6 +169,23 @@ def checkCreateDb(self, keepLocal, chunkSize, compact): sql = "drop database db1" tdSql.execute(sql) + def checkDefault(self, keepLocal, chunkSize, compact): + sql = f" create database db1 vgroups 1" + tdSql.execute(sql, show=True) + #sql = f"select name,s3_keeplocal,s3_chunkpages,s3_compact from information_schema.ins_databases where name='db1';" + sql = f"select * from information_schema.ins_databases where name='db1';" + tdSql.query(sql) + # 29 30 31 -> chunksize keeplocal compact + if chunkSize is not None: + tdSql.checkData(0, 29, chunkSize) + if keepLocal is not None: + keepLocalm = keepLocal * 24 * 60 + tdSql.checkData(0, 30, f"{keepLocalm}m") + if compact is not None: + tdSql.checkData(0, 31, compact) + sql = "drop database db1" + tdSql.execute(sql) + def checkExcept(self): # errors sqls = [ @@ -226,16 +240,7 @@ def checkBasic(self): # except self.checkExcept() - - # - def preDb(self, vgroups): - cnt = int(time.time())%2 + 1 - for i in range(cnt): - vg = eutil.cpuRand(9) + 1 - sql = f"create database predb vgroups {vg}" - tdSql.execute(sql, show=True) - sql = "drop database predb" - tdSql.execute(sql, show=True) + self.checkDefault(365, 131072, 1) # history def insertHistory(self): @@ -287,9 +292,6 @@ def run(self): if eos.isArm64Cpu(): tdLog.success(f"{__file__} arm64 ignore executed") else: - - self.preDb(10) - # insert data self.insertData() @@ -311,7 +313,6 @@ def run(self): # check insert correct again self.checkInsertCorrect() - # check stream correct and drop stream #self.checkStreamCorrect() @@ -321,7 +322,7 @@ def run(self): # insert history disorder data self.insertHistory() - # checkBasic + # check db params self.checkBasic() #self.checkInsertCorrect() @@ -335,10 +336,8 @@ def run(self): # drop database and free s3 file self.dropDb() - tdLog.success(f"{__file__} successfully executed") - tdCases.addLinux(__file__, TDTestCase()) tdCases.addWindows(__file__, TDTestCase()) From 5b9f43453295759b3e0f64f1aca83962e072944e Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Thu, 31 Oct 2024 17:47:54 +0800 Subject: [PATCH 535/695] fix issue for value --- source/libs/executor/inc/tfill.h | 1 + source/libs/executor/src/streamfilloperator.c | 12 ++++--- .../executor/src/streamtimesliceoperator.c | 36 ++++++++++++++----- .../8-stream/force_window_close_interval.py | 10 +++--- 4 files changed, 41 insertions(+), 18 deletions(-) diff --git a/source/libs/executor/inc/tfill.h b/source/libs/executor/inc/tfill.h index c58a2a5d5baf..6072063bbfe6 100644 --- a/source/libs/executor/inc/tfill.h +++ b/source/libs/executor/inc/tfill.h @@ -119,6 +119,7 @@ typedef struct SStreamFillInfo { int32_t delIndex; uint64_t curGroupId; bool hasNext; + SResultRowData* pNonFillRow; } SStreamFillInfo; int64_t getNumOfResultsAfterFillGap(SFillInfo* pFillInfo, int64_t ekey, int32_t maxNumOfRows); diff --git a/source/libs/executor/src/streamfilloperator.c b/source/libs/executor/src/streamfilloperator.c index 3b6f77ad41a9..385d1e577699 100644 --- a/source/libs/executor/src/streamfilloperator.c +++ b/source/libs/executor/src/streamfilloperator.c @@ -1541,14 +1541,12 @@ SStreamFillInfo* initStreamFillInfo(SStreamFillSupporter* pFillSup, SSDataBlock* } pFillInfo->pLinearInfo->winIndex = 0; + pFillInfo->pNonFillRow = NULL; pFillInfo->pResRow = NULL; if (pFillSup->type == TSDB_FILL_SET_VALUE || pFillSup->type == TSDB_FILL_SET_VALUE_F || pFillSup->type == TSDB_FILL_NULL || pFillSup->type == TSDB_FILL_NULL_F) { pFillInfo->pResRow = taosMemoryCalloc(1, sizeof(SResultRowData)); - if (!pFillInfo->pResRow) { - code = terrno; - QUERY_CHECK_CODE(code, lino, _end); - } + QUERY_CHECK_NULL(pFillInfo->pResRow, code, lino, _end, terrno); pFillInfo->pResRow->key = INT64_MIN; pFillInfo->pResRow->pRowVal = taosMemoryCalloc(1, pFillSup->rowSize); @@ -1568,6 +1566,12 @@ SStreamFillInfo* initStreamFillInfo(SStreamFillSupporter* pFillSup, SSDataBlock* pCell->bytes = pColData->info.bytes; pCell->type = pColData->info.type; } + + pFillInfo->pNonFillRow = taosMemoryCalloc(1, sizeof(SResultRowData)); + QUERY_CHECK_NULL(pFillInfo->pNonFillRow, code, lino, _end, terrno); + pFillInfo->pNonFillRow->key = INT64_MIN; + pFillInfo->pNonFillRow->pRowVal = taosMemoryCalloc(1, pFillSup->rowSize); + memcpy(pFillInfo->pNonFillRow->pRowVal, pFillInfo->pResRow->pRowVal, pFillSup->rowSize); } pFillInfo->type = pFillSup->type; diff --git a/source/libs/executor/src/streamtimesliceoperator.c b/source/libs/executor/src/streamtimesliceoperator.c index b49b42f0b2e5..f61c73152329 100644 --- a/source/libs/executor/src/streamtimesliceoperator.c +++ b/source/libs/executor/src/streamtimesliceoperator.c @@ -30,6 +30,8 @@ #define STREAM_TIME_SLICE_OP_STATE_NAME "StreamTimeSliceHistoryState" #define STREAM_TIME_SLICE_OP_CHECKPOINT_NAME "StreamTimeSliceOperator_Checkpoint" +#define IS_FILL_CONST_VALUE(type) ((type == TSDB_FILL_NULL || type == TSDB_FILL_NULL_F || type == TSDB_FILL_SET_VALUE || type == TSDB_FILL_SET_VALUE_F)) + int32_t saveTimeSliceWinResult(SWinKey* pKey, SSHashObj* pUpdatedMap) { return tSimpleHashPut(pUpdatedMap, pKey, sizeof(SWinKey), NULL, 0); } @@ -371,7 +373,17 @@ SResultCellData* getSliceResultCell(SResultCellData* pRowVal, int32_t index) { return pCell; } -static int32_t fillPointResult(SStreamFillSupporter* pFillSup, SResultRowData* pResRow, TSKEY ts, SSDataBlock* pBlock, +static bool isGroupKeyFunc(SExprInfo* pExprInfo) { + int32_t functionType = pExprInfo->pExpr->_function.functionType; + return (functionType == FUNCTION_TYPE_GROUP_KEY); +} + +static bool isSelectGroupConstValueFunc(SExprInfo* pExprInfo) { + int32_t functionType = pExprInfo->pExpr->_function.functionType; + return (functionType == FUNCTION_TYPE_GROUP_CONST_VALUE); +} + +static int32_t fillPointResult(SStreamFillSupporter* pFillSup, SResultRowData* pResRow, SResultRowData* pNonFillRow, TSKEY ts, SSDataBlock* pBlock, bool* pRes, bool isFilled) { int32_t code = TSDB_CODE_SUCCESS; int32_t lino = 0; @@ -401,7 +413,12 @@ static int32_t fillPointResult(SStreamFillSupporter* pFillSup, SResultRowData* p QUERY_CHECK_CODE(code, lino, _end); } else { int32_t srcSlot = pFillCol->pExpr->base.pParam[0].pCol->slotId; - SResultCellData* pCell = getSliceResultCell(pResRow->pRowVal, srcSlot); + SResultCellData* pCell = NULL; + if (IS_FILL_CONST_VALUE(pFillSup->type) && (isGroupKeyFunc(pFillCol->pExpr) || isSelectGroupConstValueFunc(pFillCol->pExpr)) ) { + pCell = getSliceResultCell(pNonFillRow->pRowVal, srcSlot); + } else { + pCell = getSliceResultCell(pResRow->pRowVal, srcSlot); + } code = setRowCell(pDstCol, pBlock->info.rows, pCell); QUERY_CHECK_CODE(code, lino, _end); } @@ -424,7 +441,7 @@ static void fillNormalRange(SStreamFillSupporter* pFillSup, SStreamFillInfo* pFi STimeWindow st = {.skey = pFillInfo->current, .ekey = pFillInfo->current}; // if (inWinRange(&pFillSup->winRange, &st)) { bool res = true; - code = fillPointResult(pFillSup, pFillInfo->pResRow, pFillInfo->current, pBlock, &res, true); + code = fillPointResult(pFillSup, pFillInfo->pResRow, pFillInfo->pNonFillRow, pFillInfo->current, pBlock, &res, true); QUERY_CHECK_CODE(code, lino, _end); // } pFillInfo->current = taosTimeAdd(pFillInfo->current, pFillSup->interval.sliding, pFillSup->interval.slidingUnit, @@ -533,13 +550,13 @@ static void doStreamFillRange(SStreamFillSupporter* pFillSup, SStreamFillInfo* p int32_t lino = 0; bool res = true; if (pFillInfo->needFill == false && pFillInfo->pos != FILL_POS_INVALID) { - code = fillPointResult(pFillSup, &pFillSup->cur, pFillSup->cur.key, pRes, &res, false); + code = fillPointResult(pFillSup, &pFillSup->cur, pFillInfo->pNonFillRow, pFillSup->cur.key, pRes, &res, false); QUERY_CHECK_CODE(code, lino, _end); return; } if (pFillInfo->pos == FILL_POS_START) { - code = fillPointResult(pFillSup, &pFillSup->cur, pFillSup->cur.key, pRes, &res, false); + code = fillPointResult(pFillSup, &pFillSup->cur, pFillInfo->pNonFillRow, pFillSup->cur.key, pRes, &res, false); QUERY_CHECK_CODE(code, lino, _end); if (res) { pFillInfo->pos = FILL_POS_INVALID; @@ -549,7 +566,7 @@ static void doStreamFillRange(SStreamFillSupporter* pFillSup, SStreamFillInfo* p fillNormalRange(pFillSup, pFillInfo, pRes); if (pFillInfo->pos == FILL_POS_MID) { - code = fillPointResult(pFillSup, &pFillSup->cur, pFillSup->cur.key, pRes, &res, false); + code = fillPointResult(pFillSup, &pFillSup->cur, pFillInfo->pNonFillRow, pFillSup->cur.key, pRes, &res, false); QUERY_CHECK_CODE(code, lino, _end); if (res) { pFillInfo->pos = FILL_POS_INVALID; @@ -567,7 +584,7 @@ static void doStreamFillRange(SStreamFillSupporter* pFillSup, SStreamFillInfo* p fillLinearRange(pFillSup, pFillInfo, pRes); if (pFillInfo->pos == FILL_POS_MID) { - code = fillPointResult(pFillSup, &pFillSup->cur, pFillSup->cur.key, pRes, &res, false); + code = fillPointResult(pFillSup, &pFillSup->cur, pFillInfo->pNonFillRow, pFillSup->cur.key, pRes, &res, false); QUERY_CHECK_CODE(code, lino, _end); if (res) { pFillInfo->pos = FILL_POS_INVALID; @@ -583,7 +600,7 @@ static void doStreamFillRange(SStreamFillSupporter* pFillSup, SStreamFillInfo* p } } if (pFillInfo->pos == FILL_POS_END) { - code = fillPointResult(pFillSup, &pFillSup->cur, pFillSup->cur.key, pRes, &res, false); + code = fillPointResult(pFillSup, &pFillSup->cur, pFillInfo->pNonFillRow, pFillSup->cur.key, pRes, &res, false); QUERY_CHECK_CODE(code, lino, _end); if (res) { pFillInfo->pos = FILL_POS_INVALID; @@ -929,6 +946,7 @@ static int32_t getPointInfoFromState(SStreamAggSupporter* pAggSup, SStreamFillSu return code; } +// partition key static void copyNonFillValueInfo(SStreamFillSupporter* pFillSup, SStreamFillInfo* pFillInfo) { for (int32_t i = 0; i < pFillSup->numOfAllCols; ++i) { SFillColInfo* pFillCol = pFillSup->pAllColInfo + i; @@ -936,7 +954,7 @@ static void copyNonFillValueInfo(SStreamFillSupporter* pFillSup, SStreamFillInfo !isIsfilledPseudoColumn(pFillCol->pExpr)) { int32_t srcSlot = pFillCol->pExpr->base.pParam[0].pCol->slotId; SResultCellData* pSrcCell = getResultCell(&pFillSup->cur, srcSlot); - SResultCellData* pDestCell = getResultCell(pFillInfo->pResRow, srcSlot); + SResultCellData* pDestCell = getResultCell(pFillInfo->pNonFillRow, srcSlot); pDestCell->isNull = pSrcCell->isNull; if (!pDestCell->isNull) { memcpy(pDestCell->pData, pSrcCell->pData, pSrcCell->bytes); diff --git a/tests/system-test/8-stream/force_window_close_interval.py b/tests/system-test/8-stream/force_window_close_interval.py index 34e03dbc7052..b97aa8ff8181 100644 --- a/tests/system-test/8-stream/force_window_close_interval.py +++ b/tests/system-test/8-stream/force_window_close_interval.py @@ -532,13 +532,13 @@ def force_window_close( fill_value=fill_value, ) self.tdCom.check_query_data( - f'select irowts, table_name, c_c1, isfilled, {funciton_name_alias} from {self.stb_stream_des_partition_column1_table} where irowts >= {start_force_ts} and irowts <= "{end_new_ts}" order by c_c1, irowts', - f'select _irowts as irowts ,tbname as table_name, c1 as c_c1, _isfilled as isfilled , {funciton_name} as {funciton_name_alias} from {tbname} {where_tbname} and ts >= {start_force_ts} partition by {partition},c1 range("{start_new_ts}","{end_new_ts}") every({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by c_c1, irowts', + f'select irowts, c_c1, isfilled, {funciton_name_alias} from {self.stb_stream_des_partition_column1_table} where irowts >= {start_force_ts} and irowts <= "{end_new_ts}" order by c_c1, irowts', + f'select _irowts as irowts , c1 as c_c1, _isfilled as isfilled , {funciton_name} as {funciton_name_alias} from {tbname} {where_tbname} and ts >= {start_force_ts} partition by {partition},c1 range("{start_new_ts}","{end_new_ts}") every({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by c_c1, irowts', fill_value=fill_value, ) self.tdCom.check_query_data( - f'select irowts, table_name, c_c2, isfilled, {funciton_name_alias} from {self.stb_stream_des_partition_column2_table} where irowts >= {start_force_ts} and irowts <= "{end_new_ts}" order by c_c2, irowts', - f'select _irowts as irowts ,tbname as table_name, c2 as c_c2, _isfilled as isfilled , {funciton_name} as {funciton_name_alias} from {tbname} {where_tbname} and ts >= {start_force_ts} partition by {partition},c2 range("{start_new_ts}","{end_new_ts}") every({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by c_c2, irowts', + f'select irowts, c_c2, isfilled, {funciton_name_alias} from {self.stb_stream_des_partition_column2_table} where irowts >= {start_force_ts} and irowts <= "{end_new_ts}" order by c_c2, irowts', + f'select _irowts as irowts , c2 as c_c2, _isfilled as isfilled , {funciton_name} as {funciton_name_alias} from {tbname} {where_tbname} and ts >= {start_force_ts} partition by {partition},c2 range("{start_new_ts}","{end_new_ts}") every({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by c_c2, irowts', fill_value=fill_value, ) else: @@ -622,7 +622,7 @@ def force_window_close( ) def run(self): - for fill_value in ["PREV", "NEXT", "VALUE"]: + for fill_value in ["PREV", "VALUE"]: self.force_window_close( interval=10, partition="tbname", From 2eba89973f03da218fc080491200eec02484c1bf Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Thu, 31 Oct 2024 18:51:33 +0800 Subject: [PATCH 536/695] doc: add new file for holtwinters. --- docs/zh/06-advanced/06-data-analysis/01-arima.md | 2 +- docs/zh/06-advanced/06-data-analysis/02-holtwinters.md | 0 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 docs/zh/06-advanced/06-data-analysis/02-holtwinters.md diff --git a/docs/zh/06-advanced/06-data-analysis/01-arima.md b/docs/zh/06-advanced/06-data-analysis/01-arima.md index a51e293a48b0..32f6009c969d 100644 --- a/docs/zh/06-advanced/06-data-analysis/01-arima.md +++ b/docs/zh/06-advanced/06-data-analysis/01-arima.md @@ -39,7 +39,7 @@ ARIMA模型是一种自回归模型,只需要自变量即可预测后续的值 "period": period, // 返回结果的周期性,同输入 "alpha": alpha, // 返回结果的置信区间,同输入 "algo": "arima", // 返回结果使用的算法 -"mse",mse, // 拟合输入时序数据时候生成模型的最小均方误差(MSE) +"mse":mse, // 拟合输入时序数据时候生成模型的最小均方误差(MSE) "res": res // 列模式的结果 } ``` diff --git a/docs/zh/06-advanced/06-data-analysis/02-holtwinters.md b/docs/zh/06-advanced/06-data-analysis/02-holtwinters.md new file mode 100644 index 000000000000..e69de29bb2d1 From e9b9ebeb6e2474170402f9ad1638231feba842a0 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Thu, 31 Oct 2024 18:52:24 +0800 Subject: [PATCH 537/695] fic comp issue --- source/libs/executor/src/streamfilloperator.c | 2 ++ source/libs/executor/src/streamtimesliceoperator.c | 11 +++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/source/libs/executor/src/streamfilloperator.c b/source/libs/executor/src/streamfilloperator.c index 385d1e577699..cb330e2e72fe 100644 --- a/source/libs/executor/src/streamfilloperator.c +++ b/source/libs/executor/src/streamfilloperator.c @@ -122,6 +122,8 @@ void destroyStreamFillInfo(SStreamFillInfo* pFillInfo) { pFillInfo->type == TSDB_FILL_NULL || pFillInfo->type == TSDB_FILL_NULL_F) { taosMemoryFreeClear(pFillInfo->pResRow->pRowVal); taosMemoryFreeClear(pFillInfo->pResRow); + taosMemoryFreeClear(pFillInfo->pNonFillRow->pRowVal); + taosMemoryFreeClear(pFillInfo->pNonFillRow); } destroyStreamFillLinearInfo(pFillInfo->pLinearInfo); pFillInfo->pLinearInfo = NULL; diff --git a/source/libs/executor/src/streamtimesliceoperator.c b/source/libs/executor/src/streamtimesliceoperator.c index f61c73152329..ec0c56f74796 100644 --- a/source/libs/executor/src/streamtimesliceoperator.c +++ b/source/libs/executor/src/streamtimesliceoperator.c @@ -991,9 +991,9 @@ static void setForceWindowCloseFillRule(SStreamFillSupporter* pFillSup, SStreamF } else { pFillInfo->pos = FILL_POS_INVALID; setFillKeyInfo(ts, ts + 1, &pFillSup->interval, pFillInfo); - if (pFillSup->cur.pRowVal != NULL) { - copyNonFillValueInfo(pFillSup, pFillInfo); - } + } + if (pFillSup->cur.pRowVal != NULL) { + copyNonFillValueInfo(pFillSup, pFillInfo); } } break; case TSDB_FILL_PREV: { @@ -1021,6 +1021,9 @@ static void setForceWindowCloseFillRule(SStreamFillSupporter* pFillSup, SStreamF static void setTimeSliceFillRule(SStreamFillSupporter* pFillSup, SStreamFillInfo* pFillInfo, TSKEY ts) { int32_t code = TSDB_CODE_SUCCESS; int32_t lino = 0; + if (IS_FILL_CONST_VALUE(pFillInfo->type)) { + copyNonFillValueInfo(pFillSup, pFillInfo); + } if (!hasNextWindow(pFillSup) && !hasPrevWindow(pFillSup)) { pFillInfo->needFill = false; pFillInfo->pos = FILL_POS_START; @@ -1057,7 +1060,7 @@ static void setTimeSliceFillRule(SStreamFillSupporter* pFillSup, SStreamFillInfo setFillKeyInfo(startTs, nextWKey, &pFillSup->interval, pFillInfo); pFillInfo->pos = FILL_POS_START; } - copyNonFillValueInfo(pFillSup, pFillInfo); + // copyNonFillValueInfo(pFillSup, pFillInfo); } break; case TSDB_FILL_PREV: { if (hasPrevWindow(pFillSup) && hasNextWindow(pFillSup) && pFillInfo->preRowKey != pFillInfo->prePointKey && From c18b26ff9c06a04d8ee06ff381ed99073c9ce37d Mon Sep 17 00:00:00 2001 From: Shungang Li Date: Wed, 30 Oct 2024 10:21:58 +0800 Subject: [PATCH 538/695] enh: add more log for arbtrans --- source/dnode/mnode/impl/src/mndArbGroup.c | 6 ++++++ source/libs/sync/src/syncUtil.c | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndArbGroup.c b/source/dnode/mnode/impl/src/mndArbGroup.c index 1dd21900e3fb..77ba6d65ddfe 100644 --- a/source/dnode/mnode/impl/src/mndArbGroup.c +++ b/source/dnode/mnode/impl/src/mndArbGroup.c @@ -250,6 +250,12 @@ static int32_t mndArbGroupActionUpdate(SSdb *pSdb, SArbGroup *pOld, SArbGroup *p pOld->assignedLeader.acked = pNew->assignedLeader.acked; pOld->version++; + mInfo( + "arbgroup:%d, perform update action. members[0].token:%s, members[1].token:%s, isSync:%d, as-dnodeid:%d, " + "as-token:%s, as-acked:%d, version:%" PRId64, + pOld->vgId, pOld->members[0].state.token, pOld->members[1].state.token, pOld->isSync, + pOld->assignedLeader.dnodeId, pOld->assignedLeader.token, pOld->assignedLeader.acked, pOld->version); + _OVER: (void)taosThreadMutexUnlock(&pOld->mutex); diff --git a/source/libs/sync/src/syncUtil.c b/source/libs/sync/src/syncUtil.c index 212a75c2ae45..996d8531e23a 100644 --- a/source/libs/sync/src/syncUtil.c +++ b/source/libs/sync/src/syncUtil.c @@ -234,14 +234,14 @@ void syncPrintNodeLog(const char* flags, ELogLevel level, int32_t dflag, SSyncNo ", elect-times:%d, as-leader-times:%d, as-assigned-leader-times:%d, cfg-ch-times:%d, hb-slow:%d, hbr-slow:%d, " "aq-items:%d, snaping:%" PRId64 ", replicas:%d, last-cfg:%" PRId64 ", chging:%d, restore:%d, quorum:%d, elect-lc-timer:%" PRId64 ", hb:%" PRId64 - ", buffer:%s, repl-mgrs:%s, members:%s, hb:%s, hb-reply:%s", + ", buffer:%s, repl-mgrs:%s, members:%s, hb:%s, hb-reply:%s, arb-token:%s", pNode->vgId, eventLog, syncStr(pNode->state), currentTerm, pNode->commitIndex, pNode->assignedCommitIndex, appliedIndex, logBeginIndex, logLastIndex, pNode->minMatchIndex, snapshot.lastApplyIndex, snapshot.lastApplyTerm, pNode->electNum, pNode->becomeLeaderNum, pNode->becomeAssignedLeaderNum, pNode->configChangeNum, pNode->hbSlowNum, pNode->hbrSlowNum, aqItems, pNode->snapshottingIndex, pNode->replicaNum, pNode->raftCfg.lastConfigIndex, pNode->changing, pNode->restoreFinish, syncNodeDynamicQuorum(pNode), pNode->electTimerLogicClock, pNode->heartbeatTimerLogicClockUser, bufferStatesStr, - replMgrStatesStr, cfgStr, hbTimeStr, hbrTimeStr); + replMgrStatesStr, cfgStr, hbTimeStr, hbrTimeStr, pNode->arbToken); } } From ff565f0f39b4b01925b6375382b7c00f89b7716f Mon Sep 17 00:00:00 2001 From: Shungang Li Date: Thu, 31 Oct 2024 18:58:55 +0800 Subject: [PATCH 539/695] fix: mndProcessArbCheckSyncTimer no check for sync --- source/dnode/mnode/impl/src/mndArbGroup.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndArbGroup.c b/source/dnode/mnode/impl/src/mndArbGroup.c index 77ba6d65ddfe..e6e8294cd08e 100644 --- a/source/dnode/mnode/impl/src/mndArbGroup.c +++ b/source/dnode/mnode/impl/src/mndArbGroup.c @@ -629,8 +629,8 @@ static int32_t mndProcessArbCheckSyncTimer(SRpcMsg *pReq) { SArbAssignedLeader *pAssignedLeader = &arbGroupDup.assignedLeader; int32_t currentAssignedDnodeId = pAssignedLeader->dnodeId; - // 1. has assigned && is sync && no response => send req - if (currentAssignedDnodeId != 0 && arbGroupDup.isSync == true && pAssignedLeader->acked == false) { + // 1. has assigned && no response => send req + if (currentAssignedDnodeId != 0 && pAssignedLeader->acked == false) { (void)mndSendArbSetAssignedLeaderReq(pMnode, currentAssignedDnodeId, vgId, arbToken, term, pAssignedLeader->token); mInfo("vgId:%d, arb send set assigned leader to dnodeId:%d", vgId, currentAssignedDnodeId); From efcb4420b590a9ef50062013f52dd367367e96f7 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Thu, 31 Oct 2024 19:04:18 +0800 Subject: [PATCH 540/695] Update 02-holtwinters.md --- .../06-data-analysis/02-holtwinters.md | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/docs/zh/06-advanced/06-data-analysis/02-holtwinters.md b/docs/zh/06-advanced/06-data-analysis/02-holtwinters.md index e69de29bb2d1..3b9a1e03cb29 100644 --- a/docs/zh/06-advanced/06-data-analysis/02-holtwinters.md +++ b/docs/zh/06-advanced/06-data-analysis/02-holtwinters.md @@ -0,0 +1,37 @@ +--- +title: "HoltWinters" +sidebar_label: "HoltWinters" +--- + +本节讲述 HoltWinters 算法模型的使用方法。 + +## 功能概述 +HoltWinters模型又称为多次指数平滑模型(EMA)。对含有线性趋势和周期波动的非平稳序列适用,利用指数平滑法让模型参数不断适应非平稳序列的变化,并对未来趋势进行**短期**预测。 +HoltWinters有两种不同的季节性组成部分,当季节变化在该时间序列中大致保持不变时,通常选择**加法模型**;而当季节变化与时间序列的水平成比例变化时,通常选择**乘法模型**。 +该模型对于返回数据也不提供计算的置信区间范围结果。在 95% 置信区间的上下界结果与预测结果相同。 + + +### 参数 +分析平台中使用自动化的 ARIMA 模型进行计算,因此每次计算的时候会根据输入的数据自动拟合最合适的模型,然后根据该模型进行预测输出结果。 +|参数名称|说明|必填项| +|---|---|---| +|period| 输入时间序列数据每个周期包含的数据点个数。如果不设置该参数或则该参数设置为 0, 将使用一次(简单)指数平滑方式进行数据拟合,并据此进行未来数据的预测|选填| +|trend| 趋势模型使用加法模型还是乘法模型|选填| +|seasonal| 季节性采用加法模型还是乘法模型|选填| + +参数 `trend` 和 `seasonal`的均可以选择 `add` (加法模型)或 `mul`(乘法模型)。 + +### 返回结果 +```json5 +{ +"rows": rows, // 结果的行数 +"period": period, // 返回结果的周期性, 该结果与输入的周期性相同,如果没有周期性,该值为 0 +"algo": 'holtwinters' // 返回结果使用的计算模型 +"mse":mse, // 最小均方误差(minmum square error) +"res": res // 具体的结果,按照列形式返回的结果。一般意义上包含了 两列[timestamp][fc_results]。 +} +``` + +### 算法详细解释 +- https://en.wikipedia.org/wiki/Exponential_smoothing +- https://orangematter.solarwinds.com/2019/12/15/holt-winters-forecasting-simplified/ From 1d31d114a3b4e67c12f7e6f7068cce19ddbbcb79 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Thu, 31 Oct 2024 19:06:08 +0800 Subject: [PATCH 541/695] doc: add anomaly detection md --- docs/zh/06-advanced/06-data-analysis/03-anomaly-detection.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 docs/zh/06-advanced/06-data-analysis/03-anomaly-detection.md diff --git a/docs/zh/06-advanced/06-data-analysis/03-anomaly-detection.md b/docs/zh/06-advanced/06-data-analysis/03-anomaly-detection.md new file mode 100644 index 000000000000..e69de29bb2d1 From 089d54684b352663d1791f42474b30437b49e2a2 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Thu, 31 Oct 2024 19:23:20 +0800 Subject: [PATCH 542/695] Update 03-anomaly-detection.md --- .../06-data-analysis/03-anomaly-detection.md | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/docs/zh/06-advanced/06-data-analysis/03-anomaly-detection.md b/docs/zh/06-advanced/06-data-analysis/03-anomaly-detection.md index e69de29bb2d1..afa895f336c5 100644 --- a/docs/zh/06-advanced/06-data-analysis/03-anomaly-detection.md +++ b/docs/zh/06-advanced/06-data-analysis/03-anomaly-detection.md @@ -0,0 +1,37 @@ +--- +title: "Anomaly-detection" +sidebar_label: "Anomaly-detection" +--- + +本节讲述 HoltWinters 算法模型的使用方法。 + +## 功能概述 +HoltWinters模型又称为多次指数平滑模型(EMA)。对含有线性趋势和周期波动的非平稳序列适用,利用指数平滑法让模型参数不断适应非平稳序列的变化,并对未来趋势进行**短期**预测。 +HoltWinters有两种不同的季节性组成部分,当季节变化在该时间序列中大致保持不变时,通常选择**加法模型**;而当季节变化与时间序列的水平成比例变化时,通常选择**乘法模型**。 +该模型对于返回数据也不提供计算的置信区间范围结果。在 95% 置信区间的上下界结果与预测结果相同。 + + +### 参数 +分析平台中使用自动化的 ARIMA 模型进行计算,因此每次计算的时候会根据输入的数据自动拟合最合适的模型,然后根据该模型进行预测输出结果。 +|参数名称|说明|必填项| +|---|---|---| +|period| 输入时间序列数据每个周期包含的数据点个数。如果不设置该参数或则该参数设置为 0, 将使用一次(简单)指数平滑方式进行数据拟合,并据此进行未来数据的预测|选填| +|trend| 趋势模型使用加法模型还是乘法模型|选填| +|seasonal| 季节性采用加法模型还是乘法模型|选填| + +参数 `trend` 和 `seasonal`的均可以选择 `add` (加法模型)或 `mul`(乘法模型)。 + +### 返回结果 +```json5 +{ +"rows": rows, // 结果的行数 +"period": period, // 返回结果的周期性, 该结果与输入的周期性相同,如果没有周期性,该值为 0 +"algo": 'holtwinters' // 返回结果使用的计算模型 +"mse":mse, // 最小均方误差(minmum square error) +"res": res // 具体的结果,按照列形式返回的结果。一般意义上包含了 两列[timestamp][fc_results]。 +} +``` + +### 算法详细解释 +- https://en.wikipedia.org/wiki/Exponential_smoothing +- https://orangematter.solarwinds.com/2019/12/15/holt-winters-forecasting-simplified/ From 6c8881681e3b9327f15b7ef56384c91f75462733 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Thu, 31 Oct 2024 20:03:38 +0800 Subject: [PATCH 543/695] Update 03-anomaly-detection.md --- .../06-data-analysis/03-anomaly-detection.md | 65 ++++++++++--------- 1 file changed, 33 insertions(+), 32 deletions(-) diff --git a/docs/zh/06-advanced/06-data-analysis/03-anomaly-detection.md b/docs/zh/06-advanced/06-data-analysis/03-anomaly-detection.md index afa895f336c5..2c55411d59f2 100644 --- a/docs/zh/06-advanced/06-data-analysis/03-anomaly-detection.md +++ b/docs/zh/06-advanced/06-data-analysis/03-anomaly-detection.md @@ -3,35 +3,36 @@ title: "Anomaly-detection" sidebar_label: "Anomaly-detection" --- -本节讲述 HoltWinters 算法模型的使用方法。 - -## 功能概述 -HoltWinters模型又称为多次指数平滑模型(EMA)。对含有线性趋势和周期波动的非平稳序列适用,利用指数平滑法让模型参数不断适应非平稳序列的变化,并对未来趋势进行**短期**预测。 -HoltWinters有两种不同的季节性组成部分,当季节变化在该时间序列中大致保持不变时,通常选择**加法模型**;而当季节变化与时间序列的水平成比例变化时,通常选择**乘法模型**。 -该模型对于返回数据也不提供计算的置信区间范围结果。在 95% 置信区间的上下界结果与预测结果相同。 - - -### 参数 -分析平台中使用自动化的 ARIMA 模型进行计算,因此每次计算的时候会根据输入的数据自动拟合最合适的模型,然后根据该模型进行预测输出结果。 -|参数名称|说明|必填项| -|---|---|---| -|period| 输入时间序列数据每个周期包含的数据点个数。如果不设置该参数或则该参数设置为 0, 将使用一次(简单)指数平滑方式进行数据拟合,并据此进行未来数据的预测|选填| -|trend| 趋势模型使用加法模型还是乘法模型|选填| -|seasonal| 季节性采用加法模型还是乘法模型|选填| - -参数 `trend` 和 `seasonal`的均可以选择 `add` (加法模型)或 `mul`(乘法模型)。 - -### 返回结果 -```json5 -{ -"rows": rows, // 结果的行数 -"period": period, // 返回结果的周期性, 该结果与输入的周期性相同,如果没有周期性,该值为 0 -"algo": 'holtwinters' // 返回结果使用的计算模型 -"mse":mse, // 最小均方误差(minmum square error) -"res": res // 具体的结果,按照列形式返回的结果。一般意义上包含了 两列[timestamp][fc_results]。 -} -``` - -### 算法详细解释 -- https://en.wikipedia.org/wiki/Exponential_smoothing -- https://orangematter.solarwinds.com/2019/12/15/holt-winters-forecasting-simplified/ +本节讲述 异常检测 算法模型的使用方法。 + +## 概述 +分析平台提供了 6 种异常检查模型,6 种异常检查模型分为 3 个类别,分别属于基于统计的异常检测模型、基于数据密度的检测模型、基于深度学习的异常检测模型。在不指定异常检测使用的方法的情况下,默认调用 iqr 的方法进行计算。 + + +### 统计学异常检测方法 + +- k-sigma: k-sigma 范围之外的数据是异常点,不指定***k***值,默认为3, 即序列均值的 3 倍标准差范围为边界,超过边界的是异常值。KSigma 要求数据整体上服从正态分布,则如果一个点偏离均值K倍标准差,则该点被视为异常点. + +|参数名称|说明|是否必选|默认值| +|---|---|---|---| +|k|标准差倍数|选填|3| + + +- iqr:四分位距 (IQR) 是一种衡量变异性的方法. 四分位数将一个按等级排序的数据集划分为四个相等的部分。即 Q1(第 1 个四分位数)、Q2(第 2 个四分位数)和 Q3(第 3 个四分位数)。IQR 定义为 Q3–Q1,位于 Q3+1.5 。无输入参数。 + +- grubbs: 格拉布斯的算法,也称为最大标准残差测试。Grubbs 通常用作检验最大值、最小值偏离均值的程度是否为异常,该单变量数据集遵循近似标准正态分布。非正态分布数据集不能使用该方法。无输入参数。 + +- SHESD: 带有季节性的 ESD 检测算法。ESD 可以检测时间序列数据的多异常点。需要指定异常点比例的upper bound是k,最差的情况是至多49.9%。实际中,数据集的异常比例一般不超过5% + +### 基于数据密度的检测方法 +LOF: 局部离群因子(LOF,又叫局部异常因子)算法是Breunig于2000年提出的一种基于密度的局部离群点检测算法,该方法适用于不同类簇密度分散情况迥异的数据。根据数据点周围的数据密集情况,首先计算每个数据点的一个局部可达密度,然后通过局部可达密度进一步计算得到每个数据点的一个离群因子,该离群因子即标识了一个数据点的离群程度,因子值越大,表示离群程度越高,因子值越小,表示离群程度越低。最后,输出离群程度最大的top(n)个点。 + + +### 基于深度学习的检测方法 +使用自动编码器的异常检测模型。可以对具有周期性的数据具有较好的检测结果。但是使用该模型需要针对输入的时序数据进行训练,同时将训练完成的模型部署到服务目录中,才能够运行与使用。 + + +### 参考文献 +- Hochenbaum, O. S. Vallis, and A. Kejariwal. 2017. Automatic Anomaly Detection in the Cloud Via Statistical Learning. arXiv preprint arXiv:1704.07706 (2017). +- Breunig, M. M.; Kriegel, H.-P.; Ng, R. T.; Sander, J. (2000). LOF: Identifying Density-based Local Outliers (PDF). Proceedings of the 2000 ACM SIGMOD International Conference on Management of Data. SIGMOD. pp. 93–104. doi:10.1145/335191.335388. ISBN 1-58113-217-4. + From 3dfc4b0b88b5706be7ddc6aeca20021167fecc48 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Thu, 31 Oct 2024 20:05:12 +0800 Subject: [PATCH 544/695] Update index.md --- docs/zh/06-advanced/06-data-analysis/index.md | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/docs/zh/06-advanced/06-data-analysis/index.md b/docs/zh/06-advanced/06-data-analysis/index.md index fb7280815004..14a871c68fb5 100644 --- a/docs/zh/06-advanced/06-data-analysis/index.md +++ b/docs/zh/06-advanced/06-data-analysis/index.md @@ -165,6 +165,27 @@ DROP ANODE {anode_id} ### 时序数据分析功能 +#### 白噪声检查 + +平台提供Restful的服务检测输入时间序列是否是白噪声时间序列(White Noise Data, WND),白噪声时间序列及随机数序列。 + +此外,分析平台要求输入的数据不能是 , 因此针对的所有数据均默认进行 白噪声检查。当前白噪声检查采用通行的 Ljung-Box检验,Ljung-Box 统计量检查过程需要遍历整个输入序列并进行计算。 + +如果用户能够明确输入序列一定不是白噪声序列,那么可以通过输入参数,指定预测之前忽略该检查,从而节省分析过程的 CPU 计算资源。 + +同时支持独立地针对输入序列进行白噪声检测(该检测功能暂不独立对外开放)。 + + +#### 数据重采样和时间戳对齐 + +数据分析平台支持将输入的数据进行重采样的预处理,从而确保输出结果按照用户指定的等间隔进行处理。处理过程分为两种类别: + + 数据时间戳对齐。由于真实数据时间可能并非严格按照查询指定的时间戳输入。此时数据平台将自动将数据的时间间隔按照指定的时间间隔进行对齐。例如有输入时间序列:[11, 22, 29, 41],用户指定时间间隔为 10,那么该序列将被对齐重整为以下序列 [10, 20, 30, 40]。 + 数据时间重采样。用户输入的时间序列其采样频率超过了指定的查询需要获得结果的时间间隔,例如输入原始数据是 5, 但是输出结果的频率是 10. [0, 5, 10, 15, 20, 25, 30],那么该输入数据列将重采用为间隔 为 10 的输入序列,其结果如下 [0, 10, 20,30]。[5, 15, 25] 处的数据将被丢弃。 + +需要注意的是,数据输入平台不支持缺失数据补齐后进行的预测分析,如果输入时间序列数据[11, 22, 29, 49],并且用户要求的时间间隔为 10, 重整对齐后的序列是 [10, 20, 30, 50] 那么该序列进行预测分析将返回错误。 + + #### 时序数据异常检测 异常检测是针对输入的时序数据,使用预设或用户指定的算法确定时间序列中**可能**出现异常时间序列点,对于时间序列中若干个连续的异常点,将自动合并成为一个连续的(闭区间)异常窗口。对于只有单个点的场景,异常窗口窗口退化成为一个起始时间和结束时间相同的点。 异常检测生成的异常窗口受检测算法和算法参数的共同影响,对于异常窗口范围内的数据,可以应用 TDengine 提供的聚合和标量函数进行查询或变换处理。 From 016d176ea5f40c640110af5650aafc33d12eb077 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Fri, 1 Nov 2024 08:55:03 +0800 Subject: [PATCH 545/695] fix: number to string output length issue --- source/libs/scalar/src/sclfunc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/scalar/src/sclfunc.c b/source/libs/scalar/src/sclfunc.c index d01a5ed7abc0..9e75abcfe899 100644 --- a/source/libs/scalar/src/sclfunc.c +++ b/source/libs/scalar/src/sclfunc.c @@ -2085,7 +2085,7 @@ int32_t castFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutp (void)memcpy(varDataVal(output), convBuf, len); varDataSetLen(output, len); } else { - int32_t outputSize = TMIN(outputLen - VARSTR_HEADER_SIZE, bufSize); + int32_t outputSize = (outputLen - VARSTR_HEADER_SIZE) < bufSize ? (outputLen - VARSTR_HEADER_SIZE + 1): bufSize; NUM_TO_STRING(inputType, input, outputSize, buf); int32_t len = (int32_t)strlen(buf); len = (outputLen - VARSTR_HEADER_SIZE) > len ? len : (outputLen - VARSTR_HEADER_SIZE); From 819db93a65881b849a9ffaadc1bcf523b3341d30 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Fri, 1 Nov 2024 08:59:04 +0800 Subject: [PATCH 546/695] Update 02-holtwinters.md --- docs/zh/06-advanced/06-data-analysis/02-holtwinters.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/zh/06-advanced/06-data-analysis/02-holtwinters.md b/docs/zh/06-advanced/06-data-analysis/02-holtwinters.md index 3b9a1e03cb29..be3e2490ad55 100644 --- a/docs/zh/06-advanced/06-data-analysis/02-holtwinters.md +++ b/docs/zh/06-advanced/06-data-analysis/02-holtwinters.md @@ -32,6 +32,6 @@ HoltWinters有两种不同的季节性组成部分,当季节变化在该时间 } ``` -### 算法详细解释 +### 参考文献 - https://en.wikipedia.org/wiki/Exponential_smoothing - https://orangematter.solarwinds.com/2019/12/15/holt-winters-forecasting-simplified/ From eb67fb6f83cef4b5e927e8fe2d8e73bfa647ddc2 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Fri, 1 Nov 2024 08:59:34 +0800 Subject: [PATCH 547/695] Update 01-arima.md --- docs/zh/06-advanced/06-data-analysis/01-arima.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/zh/06-advanced/06-data-analysis/01-arima.md b/docs/zh/06-advanced/06-data-analysis/01-arima.md index 32f6009c969d..30d4b45977db 100644 --- a/docs/zh/06-advanced/06-data-analysis/01-arima.md +++ b/docs/zh/06-advanced/06-data-analysis/01-arima.md @@ -44,6 +44,6 @@ ARIMA模型是一种自回归模型,只需要自变量即可预测后续的值 } ``` -### 算法详细解释 +### 参考文献 - https://en.wikipedia.org/wiki/Autoregressive_moving-average_model - https://baike.baidu.com/item/%E8%87%AA%E5%9B%9E%E5%BD%92%E6%BB%91%E5%8A%A8%E5%B9%B3%E5%9D%87%E6%A8%A1%E5%9E%8B/5023931?fromtitle=ARMA%E6%A8%A1%E5%9E%8B&fromid=8048415 From 135adabd98241980255f0d1c5139e029e74a8894 Mon Sep 17 00:00:00 2001 From: Jing Sima Date: Fri, 1 Nov 2024 09:11:35 +0800 Subject: [PATCH 548/695] fix:[TD-32727] set SArray pointer to NULL after destroy. --- source/libs/executor/src/timesliceoperator.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/libs/executor/src/timesliceoperator.c b/source/libs/executor/src/timesliceoperator.c index 71851fe931ae..88c16426541c 100644 --- a/source/libs/executor/src/timesliceoperator.c +++ b/source/libs/executor/src/timesliceoperator.c @@ -675,11 +675,13 @@ static int32_t initGroupKeyKeeper(STimeSliceOperatorInfo* pInfo, SExprSupp* pExp .pData = taosMemoryCalloc(1, pExprInfo->base.resSchema.bytes)}; if (!key.pData) { taosArrayDestroyEx(pInfo->pPrevGroupKeys, destroyGroupKey); + pInfo->pPrevGroupKeys = NULL; return terrno; } if (NULL == taosArrayPush(pInfo->pPrevGroupKeys, &key)) { taosMemoryFree(key.pData); taosArrayDestroyEx(pInfo->pPrevGroupKeys, destroyGroupKey); + pInfo->pPrevGroupKeys = NULL; return terrno; } } From bda37462fce0c973e10b55034b6bbc79954adb28 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Fri, 1 Nov 2024 09:13:04 +0800 Subject: [PATCH 549/695] fix: optimize float display --- include/common/ttypes.h | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/include/common/ttypes.h b/include/common/ttypes.h index bf9205ecfe99..0ef47cdd12e8 100644 --- a/include/common/ttypes.h +++ b/include/common/ttypes.h @@ -239,16 +239,22 @@ typedef struct { snprintf(_output, (int32_t)(_outputBytes), "%" PRIu64, *(uint64_t *)(_input)); \ break; \ case TSDB_DATA_TYPE_FLOAT: { \ - int32_t n = snprintf(_output, (int32_t)(_outputBytes), "%f", *(float *)(_input)); \ - if (n >= (_outputBytes)) { \ - snprintf(_output, (int32_t)(_outputBytes), "%.7e", *(float *)(_input)); \ + int32_t n = snprintf(_output, (int32_t)(_outputBytes), "%f", *(float *)(_input)); \ + if (n >= (_outputBytes)) { \ + n = snprintf(_output, (int32_t)(_outputBytes), "%.7e", *(float *)(_input)); \ + if (n >= (_outputBytes)) { \ + snprintf(_output, (int32_t)(_outputBytes), "%f", *(float *)(_input)); \ + } \ } \ break; \ } \ case TSDB_DATA_TYPE_DOUBLE: { \ - int32_t n = snprintf(_output, (int32_t)(_outputBytes), "%f", *(double *)(_input)); \ - if (n >= (_outputBytes)) { \ - snprintf(_output, (int32_t)(_outputBytes), "%.15e", *(double *)(_input)); \ + int32_t n = snprintf(_output, (int32_t)(_outputBytes), "%f", *(double *)(_input)); \ + if (n >= (_outputBytes)) { \ + snprintf(_output, (int32_t)(_outputBytes), "%.15e", *(double *)(_input)); \ + if (n >= (_outputBytes)) { \ + snprintf(_output, (int32_t)(_outputBytes), "%f", *(double *)(_input)); \ + } \ } \ break; \ } \ From 310025b479bdfe15f9f7c3b1f67fa8fd55c2f069 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Fri, 1 Nov 2024 09:38:03 +0800 Subject: [PATCH 550/695] Update 03-anomaly-detection.md --- .../06-data-analysis/03-anomaly-detection.md | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/docs/zh/06-advanced/06-data-analysis/03-anomaly-detection.md b/docs/zh/06-advanced/06-data-analysis/03-anomaly-detection.md index 2c55411d59f2..8f1e1f064a79 100644 --- a/docs/zh/06-advanced/06-data-analysis/03-anomaly-detection.md +++ b/docs/zh/06-advanced/06-data-analysis/03-anomaly-detection.md @@ -11,21 +11,26 @@ sidebar_label: "Anomaly-detection" ### 统计学异常检测方法 -- k-sigma: k-sigma 范围之外的数据是异常点,不指定***k***值,默认为3, 即序列均值的 3 倍标准差范围为边界,超过边界的是异常值。KSigma 要求数据整体上服从正态分布,则如果一个点偏离均值K倍标准差,则该点被视为异常点. +- k-sigma[1]: 即 ***68–95–99.7 rule*** 。***k***值默认为3, 即序列均值的 3 倍标准差范围为边界,超过边界的是异常值。KSigma 要求数据整体上服从正态分布,如果一个点偏离均值K倍标准差,则该点被视为异常点. |参数名称|说明|是否必选|默认值| |---|---|---|---| |k|标准差倍数|选填|3| -- iqr:四分位距 (IQR) 是一种衡量变异性的方法. 四分位数将一个按等级排序的数据集划分为四个相等的部分。即 Q1(第 1 个四分位数)、Q2(第 2 个四分位数)和 Q3(第 3 个四分位数)。IQR 定义为 Q3–Q1,位于 Q3+1.5 。无输入参数。 +- IQR[2]:四分位距 (Interquartile range, IQR) 是一种衡量变异性的方法. 四分位数将一个按等级排序的数据集划分为四个相等的部分。即 Q1(第 1 个四分位数)、Q2(第 2 个四分位数)和 Q3(第 3 个四分位数)。IQR 定义为 Q3–Q1,位于 Q3+1.5 。无输入参数。 -- grubbs: 格拉布斯的算法,也称为最大标准残差测试。Grubbs 通常用作检验最大值、最小值偏离均值的程度是否为异常,该单变量数据集遵循近似标准正态分布。非正态分布数据集不能使用该方法。无输入参数。 +- Grubbs[3]: 又称为 Grubbs' test,即最大标准残差测试。Grubbs 通常用作检验最大值、最小值偏离均值的程度是否为异常,该单变量数据集遵循近似标准正态分布。非正态分布数据集不能使用该方法。无输入参数。 + +- SHESD[4]: 带有季节性的 ESD 检测算法。ESD 可以检测时间序列数据的多异常点。需要指定异常点比例的上界***k***,最差的情况是至多49.9%。数据集的异常比例一般不超过5% + +|参数名称|说明|是否必选|默认值| +|---|---|---|---| +|k|异常点在输入数据集中占比,范围是$`1\le K \le 49.9`$ |选填|5| -- SHESD: 带有季节性的 ESD 检测算法。ESD 可以检测时间序列数据的多异常点。需要指定异常点比例的upper bound是k,最差的情况是至多49.9%。实际中,数据集的异常比例一般不超过5% ### 基于数据密度的检测方法 -LOF: 局部离群因子(LOF,又叫局部异常因子)算法是Breunig于2000年提出的一种基于密度的局部离群点检测算法,该方法适用于不同类簇密度分散情况迥异的数据。根据数据点周围的数据密集情况,首先计算每个数据点的一个局部可达密度,然后通过局部可达密度进一步计算得到每个数据点的一个离群因子,该离群因子即标识了一个数据点的离群程度,因子值越大,表示离群程度越高,因子值越小,表示离群程度越低。最后,输出离群程度最大的top(n)个点。 +LOF[5]: 局部离群因子(LOF,又叫局部异常因子)算法是Breunig于2000年提出的一种基于密度的局部离群点检测算法,该方法适用于不同类簇密度分散情况迥异的数据。根据数据点周围的数据密集情况,首先计算每个数据点的一个局部可达密度,然后通过局部可达密度进一步计算得到每个数据点的一个离群因子,该离群因子即标识了一个数据点的离群程度,因子值越大,表示离群程度越高,因子值越小,表示离群程度越低。最后,输出离群程度最大的top(n)个点。 ### 基于深度学习的检测方法 @@ -33,6 +38,9 @@ LOF: 局部离群因子(LOF,又叫局部异常因子)算法是Breunig于2000 ### 参考文献 -- Hochenbaum, O. S. Vallis, and A. Kejariwal. 2017. Automatic Anomaly Detection in the Cloud Via Statistical Learning. arXiv preprint arXiv:1704.07706 (2017). -- Breunig, M. M.; Kriegel, H.-P.; Ng, R. T.; Sander, J. (2000). LOF: Identifying Density-based Local Outliers (PDF). Proceedings of the 2000 ACM SIGMOD International Conference on Management of Data. SIGMOD. pp. 93–104. doi:10.1145/335191.335388. ISBN 1-58113-217-4. +1. https://en.wikipedia.org/wiki/68%E2%80%9395%E2%80%9399.7_rule +2. https://en.wikipedia.org/wiki/Interquartile_range +3. Adikaram, K. K. L. B.; Hussein, M. A.; Effenberger, M.; Becker, T. (2015-01-14). "Data Transformation Technique to Improve the Outlier Detection Power of Grubbs's Test for Data Expected to Follow Linear Relation". Journal of Applied Mathematics. 2015: 1–9. doi:10.1155/2015/708948. +4. Hochenbaum, O. S. Vallis, and A. Kejariwal. 2017. Automatic Anomaly Detection in the Cloud Via Statistical Learning. arXiv preprint arXiv:1704.07706 (2017). +5. Breunig, M. M.; Kriegel, H.-P.; Ng, R. T.; Sander, J. (2000). LOF: Identifying Density-based Local Outliers (PDF). Proceedings of the 2000 ACM SIGMOD International Conference on Management of Data. SIGMOD. pp. 93–104. doi:10.1145/335191.335388. ISBN 1-58113-217-4. From 31f4cb5eb4506e2d37119447d95a5de9321d3ab7 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Fri, 1 Nov 2024 09:46:09 +0800 Subject: [PATCH 551/695] fix possible crash --- source/util/src/tcompression.c | 5 ++++- tests/script/tsim/compress/commitlog.sim | 9 ++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/source/util/src/tcompression.c b/source/util/src/tcompression.c index 9c9ded693e03..7ef35bebaf5f 100644 --- a/source/util/src/tcompression.c +++ b/source/util/src/tcompression.c @@ -1617,7 +1617,10 @@ int32_t tsDecompressBigint(void *pIn, int32_t nIn, int32_t nEle, void *pOut, int uTrace("encode:%s, compress:%s, level:%d, type:%s, l1:%d", compressL1Dict[l1].name, compressL2Dict[l2].name, \ lvl, tDataTypes[type].name, l1); \ int32_t len = compressL1Dict[l1].comprFn(pIn, nEle, pBuf, type); \ - int8_t alvl = tsGetCompressL2Level(l2, lvl); \ + if (len < 0) { \ + return len; \ + } \ + int8_t alvl = tsGetCompressL2Level(l2, lvl); \ return compressL2Dict[l2].comprFn(pBuf, len, pOut, nOut, type, alvl); \ } else { \ uTrace("dencode:%s, decompress:%s, level:%d, type:%s", compressL1Dict[l1].name, compressL2Dict[l2].name, lvl, \ diff --git a/tests/script/tsim/compress/commitlog.sim b/tests/script/tsim/compress/commitlog.sim index 38899b95ba9f..c936d8be46b7 100644 --- a/tests/script/tsim/compress/commitlog.sim +++ b/tests/script/tsim/compress/commitlog.sim @@ -20,7 +20,7 @@ sql create table $tb (ts timestamp, b bool, t tinyint, s smallint, i int, big bi $count = 0 while $count < $N $ms = 1591200000000 + $count - sql insert into $tb values( $ms , 1, 0, $count , $count , $count ,'it is a string') + sql insert into $tb values( $ms , $count/256, 0, $count , $count , $count ,'it is a string') $count = $count + 1 endw @@ -29,6 +29,13 @@ if $rows != $N then return -1 endi +sql flush database $db + +sql select * from $tb +if $rows != $N then + return -1 +endi + print =============== step2 $i = 1 $db = $dbPrefix . $i From 8c3e4ce63daac2a6140d05f56a97a16a197423a0 Mon Sep 17 00:00:00 2001 From: xsren <285808407@qq.com> Date: Fri, 1 Nov 2024 09:48:11 +0800 Subject: [PATCH 552/695] enh: set default safetyCheckLevel to normal --- source/common/src/tglobal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index 1aef08bc7e18..b57db2a84a80 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -139,7 +139,7 @@ bool tsEnableCrashReport = true; #endif char *tsClientCrashReportUri = "/ccrashreport"; char *tsSvrCrashReportUri = "/dcrashreport"; -int8_t tsSafetyCheckLevel = TSDB_SAFETY_CHECK_LEVELL_NEVER; +int8_t tsSafetyCheckLevel = TSDB_SAFETY_CHECK_LEVELL_NORMAL; // schemaless bool tsSmlDot2Underline = true; From d6f1d0853c39e3355d6e4a7d176526445156c7dc Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Fri, 1 Nov 2024 09:50:35 +0800 Subject: [PATCH 553/695] change test case --- tests/script/tsim/compress/commitlog.sim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/script/tsim/compress/commitlog.sim b/tests/script/tsim/compress/commitlog.sim index c936d8be46b7..d0380dd55959 100644 --- a/tests/script/tsim/compress/commitlog.sim +++ b/tests/script/tsim/compress/commitlog.sim @@ -20,7 +20,7 @@ sql create table $tb (ts timestamp, b bool, t tinyint, s smallint, i int, big bi $count = 0 while $count < $N $ms = 1591200000000 + $count - sql insert into $tb values( $ms , $count/256, 0, $count , $count , $count ,'it is a string') + sql insert into $tb values( $ms , 10, 0, $count , $count , $count ,'it is a string') $count = $count + 1 endw From 4cc8374aaa526411713e9bdd91cf9fdbdca067d2 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Fri, 1 Nov 2024 09:56:19 +0800 Subject: [PATCH 554/695] adj ci --- .../8-stream/force_window_close_interval.py | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/tests/system-test/8-stream/force_window_close_interval.py b/tests/system-test/8-stream/force_window_close_interval.py index b97aa8ff8181..4a4a6dceeb6a 100644 --- a/tests/system-test/8-stream/force_window_close_interval.py +++ b/tests/system-test/8-stream/force_window_close_interval.py @@ -281,6 +281,8 @@ def force_window_close( tdCom.check_stream_task_status( stream_name=stream_name, vgroups=2, stream_timeout=20,check_wal_info=False ) + time.sleep(self.tdCom.dataDict["interval"]) + time.sleep(30) # insert data self.tdCom.date_time = self.tdCom.genTs(precision=self.tdCom.precision)[0] @@ -516,7 +518,7 @@ def force_window_close( tdLog.info("check data for tag and tbname filter") self.tdCom.check_query_data( f'select irowts, table_name, isfilled, {funciton_name_alias} from {self.stb_stream_des_where_tag_table} where irowts >= {start_force_ts} and irowts <= "{end_new_ts}" order by irowts', - f'select _irowts as irowts ,tbname as table_name, _isfilled as isfilled , {funciton_name} as {funciton_name_alias} from {tbname} {where_tag} partition by {partition} range("{start_new_ts}","{end_new_ts}") every({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by irowts', + f'select _irowts as irowts ,tbname as table_name, _isfilled as isfilled , {funciton_name} as {funciton_name_alias} from {tbname} {where_tag} and ts >= {start_force_ts} partition by {partition} range("{start_new_ts}","{end_new_ts}") every({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by irowts', fill_value=fill_value, ) self.tdCom.check_query_data( @@ -531,16 +533,17 @@ def force_window_close( f'select _irowts as irowts ,tbname as table_name, t1 as t_t1, _isfilled as isfilled , {funciton_name} as {funciton_name_alias} from {tbname} {where_tbname} partition by {partition},t1 range("{start_new_ts}","{end_new_ts}") every({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by t_t1, irowts', fill_value=fill_value, ) - self.tdCom.check_query_data( - f'select irowts, c_c1, isfilled, {funciton_name_alias} from {self.stb_stream_des_partition_column1_table} where irowts >= {start_force_ts} and irowts <= "{end_new_ts}" order by c_c1, irowts', - f'select _irowts as irowts , c1 as c_c1, _isfilled as isfilled , {funciton_name} as {funciton_name_alias} from {tbname} {where_tbname} and ts >= {start_force_ts} partition by {partition},c1 range("{start_new_ts}","{end_new_ts}") every({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by c_c1, irowts', - fill_value=fill_value, - ) - self.tdCom.check_query_data( - f'select irowts, c_c2, isfilled, {funciton_name_alias} from {self.stb_stream_des_partition_column2_table} where irowts >= {start_force_ts} and irowts <= "{end_new_ts}" order by c_c2, irowts', - f'select _irowts as irowts , c2 as c_c2, _isfilled as isfilled , {funciton_name} as {funciton_name_alias} from {tbname} {where_tbname} and ts >= {start_force_ts} partition by {partition},c2 range("{start_new_ts}","{end_new_ts}") every({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by c_c2, irowts', - fill_value=fill_value, - ) + if fill_value == "PREV": + self.tdCom.check_query_data( + f'select irowts, c_c1, isfilled, {funciton_name_alias} from {self.stb_stream_des_partition_column1_table} where irowts >= {start_force_ts} and irowts <= "{end_new_ts}" order by c_c1, irowts', + f'select _irowts as irowts , c1 as c_c1, _isfilled as isfilled , {funciton_name} as {funciton_name_alias} from {tbname} {where_tbname} and ts >= {start_force_ts} partition by {partition},c1 range("{start_new_ts}","{end_new_ts}") every({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by c_c1, irowts', + fill_value=fill_value, + ) + self.tdCom.check_query_data( + f'select irowts, c_c2, isfilled, {funciton_name_alias} from {self.stb_stream_des_partition_column2_table} where irowts >= {start_force_ts} and irowts <= "{end_new_ts}" order by c_c2, irowts', + f'select _irowts as irowts , c2 as c_c2, _isfilled as isfilled , {funciton_name} as {funciton_name_alias} from {tbname} {where_tbname} and ts >= {start_force_ts} partition by {partition},c2 range("{start_new_ts}","{end_new_ts}") every({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by c_c2, irowts', + fill_value=fill_value, + ) else: if partition == "tbname": # check data for general table @@ -622,7 +625,7 @@ def force_window_close( ) def run(self): - for fill_value in ["PREV", "VALUE"]: + for fill_value in ["PREV", "VALUE","NULL"]: self.force_window_close( interval=10, partition="tbname", From 0c30b3cf3c3b9d1d606eccf71720c0296ddd40d0 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Fri, 1 Nov 2024 10:25:14 +0800 Subject: [PATCH 555/695] fix ci issue --- source/libs/executor/test/queryPlanTests.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/executor/test/queryPlanTests.cpp b/source/libs/executor/test/queryPlanTests.cpp index 2b0c0e11188c..6710435aba59 100755 --- a/source/libs/executor/test/queryPlanTests.cpp +++ b/source/libs/executor/test/queryPlanTests.cpp @@ -2384,7 +2384,7 @@ void qptCreateWindowPhysiNode(SWindowPhysiNode* pWindow) { pWindow->watermark = taosRand(); pWindow->deleteMark = taosRand(); pWindow->igExpired = taosRand(); - pWindow->destHasPrimayKey = taosRand(); + pWindow->destHasPrimaryKey = taosRand(); pWindow->mergeDataBlock = QPT_RAND_BOOL_V; } From d3903308f0a5a1890d1980e6abf2ef498b6d6d09 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Fri, 1 Nov 2024 10:52:46 +0800 Subject: [PATCH 556/695] doc: update pic. --- .../06-data-analysis/pic/data-analysis.png | Bin 63007 -> 50231 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/docs/zh/06-advanced/06-data-analysis/pic/data-analysis.png b/docs/zh/06-advanced/06-data-analysis/pic/data-analysis.png index 1598238f2cc7ce6fafa1be9e45c9d46f5759d36c..44fd82832f3e26d546ad15756decba130e5fc4a8 100644 GIT binary patch literal 50231 zcmeFZcT`hb*Dt&&B1N!Kl&W%+B2}bU@hBd;fCVBTAW}o`5SkPVf(3(gR1!p~0-+Z{ zKm`&cNDWPd&_P2F<*psh^M3C=&ojRF`{VoTj+-$YvUgUQYt6al{LQlRz}QfSot2jr zf*|(4uKZ~NK}<*pVjN&*0&j{sPPKvm=)6sIw4nk#|1@}Dbhuz}0fLGX*tTr;foB$v zE9Tx1B=raUk4}6nnFWHH+W-3Vf?0so+>mRf<$IFQHcSTily53Fh0)Reta#c9(+@#e^xAy1Kf+m= z!Mfm&_=(cJMsLIaZ=?VJwxHp?v?gy$<(FRfVRk#(Mtjr~Mo|1M70)^+wHuGqURj*} zten|7c_)&W_89cXCov;OZ~6=Dv`3>;4PqA^P48#Xco&{?beLbbRQc_lo0RRGgH6Y1 zZEnr346Zfxc{Zk^q7+mG*j*UU)83bkUU?~8(|_5qeCZ)zyHSJV( z9FxMo<}4FwI6N$Ibl}dR9$HVW0W_rJ@%&7wdGYC@!+Y%qhixHPNy#3=pmeJXxCjg~c^Wo;K8zR)pe4l)_Q^J(*LAEqCi-K{B~SJTBT3 z$N0k}2`Z3MA%ojA3L$b^ZaI0UnxY=Gm8$S}w~FBbgrZT%_~bYD0cKa)z@vgL^6MgX zo|L}M%YXM=J3`v(60R3SPA5s^(F8i&W#e6Gruu>bU&P*ic3(p6I3%zlGuF5LX~T3z zVn!#$R<>KC6kO_!#RO?DNwd=*JI3n-CI2U2sGsNW1y)4P=L!|GhxR z*5@;u3EPT$2QpkCJ2G{67&m>c^cQ-M@J?R$0UB-4_u$4sg`sGL;SYP1So}2D8#Rli zwjN2m=J>B!vaSvPeXLWyQ9zg2|EEi*fg`bP?fc#UgrBqDXhVl%mp8ebEMpbwc=slC zyu|bBapC1XzF3g|)ogNk9f=r<`LAXfITP;W-`KrATKiHCBDaDSXd^D^*P>?8f3FG> z@3eOuA1V2p?D2n*eKvoGDE?2K6n=MQ*$Dez3aZn`kvQYuwb!*hkoa$^%!g-SdHEp6 z-zysXd+h(K;-LSdwqQ@Arczc?{hRt8Eo!2UwPZ}cci(Y4#sDoWH3{u{9%Bf1SSK!q zsm9Sk{_7o!J2G+VgR|v}vBf-@^;D&}vZmBM(S*1T{e7U!v>f*&+?ejwzhpQHG}1Dy z+njl?c@Rjl`r-evZRq+~?0;+Py8Qiy^){@C6PIV&5@LQ$hHOs`$*lgM8VSV|J8aIR z*7LRWpf-}icw3-w`NEwU_t;{4&8=TTv9ehXcDKioLhFy}_f{fFZ3|l`+Z=#yQVPR% zdz<>IMz$6XHuaU%hEhY11^?QpPH4KRTI2NJSJA*!#|;*v^yohu^epYMvlT5iZky)L zDT#eG#8-)ZA960X50KxGrms0cWlv79NiGLwQ36 zB2ClcQ@yi#rSo7$t}1SR2E_c)yAT`PMaGJ#FG>6M!t0W)TOO} zOQt5N|CSn1^juPPdG9A9do?KqVM;`JI*TGT~!bizBkoj z1nUAq`%$Ij$&XK07;i)|E6-NgsupafXWuGLfS?9hSnW7AJdLDg1Qw=MAiPE#({BDjJ#@|N?^kx)J=}vDOJb51~B3mnjfS{=d z@CGU6;cnj+bW1$&5_H6$g0--q%>j2tC9sBkShPBeos5ee9Q(TlHT@UHeTITTrz~rj zm@LG}3Ulg=LIg7e8MDFi*jX!EW6tKus0ipy-|HNB)AP>Mm#)xs0g`?%$_Grcxi^U< zcX+@!%%^*Rj4V4=Lh0)m@9(K+LDwO;s{rdhkBAO$gQi$H!oBxBM21#?azCF01WtWc z%lkD6=`i!mjQi6=5b7w{aG%?PJq_I%-gapYZIxwf{3KQDuN57bBt%yRl8>B=8UY)< z4Ufx?5FZX|o9v&g-vzwfDAgl(f&E70jLduvP4fG`2t>m%2`1^ntMF>GrE8t1??*H0 zkvj&+Vu;?O?KxtB_!gW)M@R~3{)_o)_qF41F+2^<_Uzc^@mj>N9;BHJ3Tpl@`-Vge{t)c>P_;P=B zhg@VZcGYe0+TeZ&B3%SW-nf`l#MJYXdnt#fqhno_k*jS zdiQao1Yk_55j;~wt&PD67%hZrz$VSj=Z`!VMgo7sX>ppy*)3Z;O%A10OfCH?rw}6wA1|mtig(s8o)9j(JO!|_+w0G zozQdKI)MoyUkO#W@c785xU+o_a$d<9+4Vbym;{*QL}sDRAinnv9kf&uwidRfmNxai zunwqIuz^|XZEn=|@V*YfD$J5lxQ(ILzaBMckA9P>;J`sz znzVfuJ3bsR2-CGG49-f$&D^ES9x#0NceEny-r|BO+Lgt49DbC@5ph~XO06B>Ze zt7ErGz&MijWdi)A=f6lo!X){e;{JOe0eB#M_Fm7KGw?}IT!L3JK+_oDkN@50bEC|B zf1e3AfPh(SXl}{6e3QnB`aen|_P^x*;vHl0377xL1Kn5U6)O_ZRR@#>)F7zM7Z5IO zUAGnZ`J1i{s>+&Z(_v06w^zmK531O}>xX_G9%yJPJ#r+EYa?m(q=Qf)^I?<0&c9eJ40-gTIE-!`ywJ(be$n3Fv*|#=2e8bkSs< z1{poycMjPWC9l;MrO=Q$)PFlw0gE4w$4t0%gRz#!W_BzM4|z2!U~pq|b$*h|vk}1M z374pq4}z6AMDV(1UAVVI7O=!ZB3+ieHs2`Ef@7yXAHMATTUx96s%oS1?(**=jJJVJ z`P_qO`Vd=R!BYRc+XK_L**eBryb=${YMA<}5jn~f4%ALV{({?ET;F|;L3s{6uN>7= z{;K$A)jMf$h@v1nfnF=FlWF}$^{`g1XKk7MYx3Yx97^L;+F=XVestGtrnGd~aOJZ> z(6~Dn<5#c23VCbu-F|MxmsrNL*`%OfZYP#@b2G2Iu05%wR1!16AKOj1XVMDVJ3a@N z65i^o4xEGJ$>z0`@7-?+>en5jxhWgHxSXGhezVHnJ+h$bOlcXxm|^=Uga!28tyK_p zL3Ro$4`VJq+6bv^&HGfGUQqo4&jZeVj_PKa-u6pX-2QMCuzT5ZY~y9zqb@Fg5_$v4 z#Z@IoJ?{+V+WC=pz^D@jgX?yhS=gPs#)!+vVAy@`cuVIB zUDu&;j~9Jat#r4gK|jRe<0q>3Qu}@SVz7u*6E)!}Zhz~Ky`B&erQ8Yf`kgkkLykJh}Yo=k6<-3U~ z3!m%S$(DoYE>!LGrZ*bZA`4{zo5;T!b-C5#P2TcOrmx!Cc?)?_I&jVms1m_!EBZ8N&2I`7vd*&To&ed@m2 zZO_qk6dtgLf26x+(-(3AGF&3bjh5b1VGftxsgj=flf(jmlsM;_G`ZhNI1JTn-{Z@fvTu}ZtT3Rq6(CGh8#6Te&sNF zH9xjazk_;c5Vu4XRfe(wML&WZ)!d#syUwd~@VfT~3mDJxCKP|rK8JjDsR zpyWrV!2u9E{~>fziQn6PKQQ)hM@og35;X&e()0n`u%x*$Y_PCTzh5o(xfg=0c3I?~ z8;bF)6G=-2^S|#b&^(tdf%4-)@r0AXA~;Px97bKfSJM&?;Ek3PDn+SvUzRjbD^JQi z#+<^~mrJ*6Uwaq%={G63_HzgTVQ{pb5=lH};ykBVimR>ljEi^=tQRZ7`HK5f3&Y$P z+XcS@gQRM82Styj-$^~PyEWa5AdaatVvgMC+1#f$Slul|p9RdzXpz~Qt5>(w5Paj5 z>GB=79<23X#+&q5$w9szF4#Z?6?JQNt3dlY3{uo(aU}Q;nMz-*hWf4oHBWYQ92 zB`)a^XUAfNLXWkC=cKNl#XAzp2Xw9=*U+JTiFIA_t2?3aW;QTjc$v%2^Lych{Sk}9 zy(W)`F)iy|8itx@izS1Tp2}IjJmX(g8{f`moKnOD&G=s%DK5QUUd^qC(rM*Z0_Rrn zw#0Bk(=$mT{_*3K{ODh`vvD0fRP(QBrvyic&HH0)XRY&OFJvHFeB`?Fos(EE-$m|P7a8WPjM0uwn{Q{)_qugB zG0ImW-(e?kmVDep1K=O0MX z-{%|37nF&!Ul0mf9TuVuNkNas!^(a)=eh|{ZXruYyWb;`+JrTKv%U4G(`HYkHebAx1!J%hd^7pa_k zy!@->4tmJ6RM@y|64l$y<7*l%-|_L(`mawZ7w}Q;=weXK=d9#Q0wipDu0Q6GoLWyF2eye5aL z3iaA`encrEaj&Rtu?fe$n2|RYsdVuc^zogT=<>IZrc;PmclJkmg zHy-%T^|y9W(beq4m6l2650;38rsR6-&DH-QgrFtsa;Y;>#u{H!Ni;~Wbp3ifVRv9L z>-&i5f?pD;zS~QeX&=$o)zU3@`v6YjtbVE-YQaZLnIdGlfB6(=+1de}W^|>4QdOSZ zi(8=!tMSAax7Hkyl{%V)rzLToDQ{-!GyVcHqjfl#Eg^WaEuGwMZ;BrtF+E%VUKQVT zJ-%b=%9B!i>%vV-*K`s6dIxn#S$F?_qSh&eTPJbDGN1BLb-g~76uMDnSe{}H9zA}w zt|DY&d+BT6md(pS)6qCd#RD#AY-X5(z-3?*DTJ0WF_FA9*15}+E7*Nx`%}dN-R{79R zebYxJgkLYGmtAJXr$7H*#iv#mzUf;O1_6kLMVmSUm)V<}{7|?9Jc{ur^pA1$k7-iK zK$@*H{x_G=V%f@i?+&$UlRq=KYoo@&+Iv#j>p*$CYNj7y5#aPt*nd!(d-r2<>hmT# zY9gM2oWhM=6I{F=Y7~s4e6E|otERiT7<>F&yYa(cQ$=MrrD)6ZbD2Xbei($QXpRAV z#%Pc}{332AIv}_HLngj@MUrme+V8b%<9w|C8RI%V{>{E-GkuKmI}3$7CBEMCng^~c`X~0I34KcqeS%C$feY`jAF7e zcJmnk`CfxvCN--(`RZWR)_%3@xUuNU?C>Dh?xqxMQD{-+gjXKNe+Vj6yyEy zmq{ty7owR7X21F0{^Fk*%P zR##QI{{&O2zyp*In7$Mwv+O?Z(A-g5HE)aOtaZ`g4lYL$Lj3ug)G3cCQM(J4i-N`F zQP|lLudM>og8aB=jcw{`-W#mlKB%DNE`9Z`*(X2W^mOD>LC!9So%O+Sge959y6tfpzrveWgL6A8S2wydA~!(Lq|s?X zA>H0-d#q%dT*h^;JcHrmacXHPUU+t}D$FHwBp*j{c+|IO3j!=@+nI(XtJFA@hP965 z8i*tmz?=-YZ@l$BA3An6GCsO}<4}p&pXp)Th)ED!v2c4*JtsG(e%FQSlO#z!8k1W~ z^_h?*RTq34Myc6W;k*6vlkxto8lT$B?Skg)n!3@b&z6K+&I0no)pU>&%{ld^M2@t& z*B@`0Day&>oBWdOzWBkV+?UT~Bu6#W=!RfZE!E#gXrrvQ{!u;-|2!o$sGfTm@Rk=Ppk7!uZcOBV|tRR(@bVno$J^UIHyhS zzu2kgl7i#BbM(F>hY?hwfY*fzUYXEo3h=HArMQ8RDV#m)lS8d^jIi6y)@`+Ef&^Vd z%8js<@}|BILObgTO?@cz!@#mydxq29f=5cfdUkj>d%oMQ+u4gdtS0R)5opm4>)oBg z*ka%MjUhO$8@#=`4T8KBf1%i7zW|V?$U5p0hLS9z^I~zG`QWo_RlNp|8-RC^*0>j| zA3a|5~AElU07 zD(l(Yfu4ZVy>Gjp(x)~s-8>g_KDVd^p|CO-oXIl`IZ)6CX<^auul$m4SzN<~85QQ0 zyy|&|wSrqt{A^2-*4$P+?O*kb78vkI17|hs2&-d5y7o=sA}7MPtl^UVeR{?W9vone z4IR4N?KSpIM<3hVYdATw{8HJkb=m7cv|AL(W;gQLMVx}U`yZeeX+}v!Rq~O+e1-<~$Y9Mqbq5u$y1PvhyF}Ju&Wq zHIrR`=?HaRNl%j|J6dxw$>RidRjP5pn_$Cm_KFpmaYmvz7 zEG{502%oW507n^#iY)P*Z(0LU6G!~3f862(k+9{99t?xgJJ(&0HEX1DyulElx4;(& zADmL_tlHiAwR;?7K)!`h%Xg=9fV(*#rQq?*Nj8YU$2k1q6*tBE*HmTgr$L2MQAR~@ z9^e#p;)&7-j_5{z*Uv9fLaXxn$YPX@7Mn+JC<(T0EEoSOo`{X82$TuzDNfndXt60Q zLCbMeq9@biy*0+zA*0iI5tKOOW|`(xdpZZalF?H)IE|WAuXs>| zi5oaKf@oRX?JZZ0>?i`Z?O4*$ypB}6s<^%&-Mn#U;*PXIJL1cb8%ekbq}BF! z7&L~ik85(+X$G&&10Cfpil&qCUnwCQ)$h*B;O3-v$1-DOPxSWTtX+D^hW^;J&;w5v z|KD|-)Oq)YM4vnTuTIKynA#*4U+!6U$X!8`dixaGCG*{p2rqO!_UDdFsd{UBU<&r}G+8H>sI<@J*k?IHaWtPQ+6uVX^Bs1;Vbs zmX+srcX7%R7|Qt7Cs7$Jl;fUny!YP|+21KZFx*v@Ed^LM8vXMRnSsZ6QDn1-xRtJ(24I>&cn`PvG#y>7bmNaC1rBM?i(P)SduO`vi{-JnL7Sy(J5r#W1J)UCoDXwZ-?cUVI?ncu zGA3cPogPQ6CHEPUm1ozH=B+)bms0Ld!`1l58$o)Dnn+_uhTGDFLr}OM&`h?uw(m~O z7DhKNKOH}pshBewdgE$F(2E*{^yi61WlNJtK&fkGA-r7!!leZv(;~gB9ucZYbn-42aoEsn8z>pE$>^Ian^+>zy?8VCak`Q7em> z2GD~&y&@p&4Ct1TZg3O(v+#lZ0Gij!LGgFIo6-6%>Esz-S8wu&I4%uipJcIkb=;3% znMW_9Rd2OG#5d17bU(#6CUBC{jFvN0+|K){oGjOIt)6G$IpXC}5>zTl){x4JsQZbV zaB-xxZk|!z=7K^E92uhZ`GhfiXDAaLyPDUG1!I>2ol~X>O}j?m*5e!cX`l4WTp%JPoPwr#6V2#)kEI!dhuz6|4!>^?WCX^rUZ z9w?=tSbK1>8WWr|;JhI%s>9e^!d2U;7iE=+(2|}upVIBzU&YJjGTf%7m%f*6kTY}8 za@zo<{@V5Kk<&F$-Q9RP&tgI;e1Jq8LYJ4eml1liC)0OAG&+`dOW-ScYqFG%>+tlGvkHsDHjnZt`n_@jt2Zq!&pGH}+mbo-u$crh-~KCH zziW^To#;Lk0wgawL15Sz^9vav$@z{hRPuTs%pIH1dTwB~Zj@K5_swOqj z(c-LT4g`e4g_lO13`P252eSkg`hnL0(9XLuMOumnas*D$TMK5lp2k#9UU%><_(*~X z`}YUY(snXO`RD=o0iRCbkQieQHO5`k#qSk;ygC-fYH22Ra5cGwnXo=~Q#V15S2pQ6% z!aaEUD7X&p;u8-1;8nN+?3SzWuz59tC#d@p@WecxmW<%~#kqgRf$$gPp$@<5f~51SQ8A~V1Q>fiGta?mqTpAo_w4|OX0yzbj7!CSrZ`Nxd|s|p#c%_YAPJ$ zIR5^-qCcY?X-f&1{jUy=X5w=IT!W>i!b|1qqq-07B^`x;u!OfnkGAw;04aMr@uKfH z&OjpWR}V~mDbOxZ=VA9DxOX+JcmHo($C14k!SIW83s!&@!S}{+OhLfIh-Qb<^_Vub#ON#+kSetyjUzdrR~8OdJ>$Bg$#1T0@wi{l95*cLTElQuZao zxZ``H0h3Yxk9TbRJGzI0UR-K{PY5>1}H@!5CX5*pG>$9Z?|SL zO?};6FVsBPaLPIf=0Pvb&-)o)j=Vfv1#{dRWVfyn6FDz*jpz)<*MHkSRV(Z=mlF|x5*#K^s(`dxhVdtE4=a+n8VJI4+)t~-v z)l%VahEdd38;OPS@{t2}o$+O-yx1>!I9{9C^s)rRc;I^7LAqXABW%s{m`f~NxF_0( zpsffb5ARz9x1IT%%;fyc^!)XkG2@Q zEjWp4CScP0W)=(+E^Jkg(u}KJ-x_MQ$rFGp98;2xe%2ppN#?lKMkDpfqygV3A)Z@$ zn@d$*#e#XYcXwV?prIlsy^RlEN@90gsshMc5TX>8uQ*a9Zqz7`Tirk}0q%q!iBbS{ zVOq)<*7S$T-Pzr}l4648;}1K}G;h0W(nL*%1qn)lBE0rG>-#e)$}T+Gpo#q4>C#-F zo4$%#j+$jPhy7xaDby%xC|Dl>A^_=wEZ`le93Szo@Jf$Nbr{&J z&fp0&jUG9Tm%cnE=-*oVf+u&j*B2zzv|PaHQ~PS7R3cyTO5jEfyKqJ24e=26kB@0= zybkc*g?LWRgdGI?!{ju3Jy`{j#Qq~BQARm(ekv7HVAFdR%qI!X;-g8Mj&Dm$3r{xL zwh|?YUGZlZEhAHd0q_K&&+q@?1m#+=-oL?VkaJ17d97}O^S1ZHay{~wr@qFS?-!%B z7ifb^0t&7FDX3LPSv|)=97Ab;nhxslYc-=8UOdYku2Jlji<6_?u@u z^1FQ{;6!E?w>IC@t%X#{)7nWS`=4&ab)HT=214TIP^Lhh#6E3&E6%l+oUX3k>&XtZ zim@C(5v3IYKIV4Eo+H!-Rn$R}vnaXB%d%UTG~%`3NuRojp}$E0yoVOf08e6~=9|}L zPg#fLVx+2tsHtOcOyA;0{Grp=mM{Xri(z_{2`M=eLu&*zdqJSU9`1DtFqSpCxprS0 zKO!kp{8K`c*$g>Cd$1%MfA2l1(hWqX1;r~Wd%Gx~rF8ikj$EP7fIaGEByp}_i(l!0fi>W1}lcBl64_$ac@3X+Cw<$Q_ zdRcEaZl6MMJK6Nk?BFovr@p+~(O%}Y3gL(j(U3DWmB1AQt*gOY7js{a2!OX`3-ueC zyCXJp0pAecYQo0+Z&4O2SLcNn-UZvaoq&aGMup>VAu9p1(BZbY){_f{Ihy6Ou0;aL z0^0mc`!1l%Kvjs~=o!Z^r-5H6Mz4X^;sQidx zlX@5Gw^byJ@d|)a!biQf({nG58okRq3@u}SqRc(KrLB|v*jtZ)Y0iOZvN1(>3nq~J zH$5k7uXqp-x(}s^_#J2+SC6ramjeI;NCMPwNta2nF*P`F7F*Np`AEPNCUWWp0HoTv zjgRO#Ji7bcccLePXR$)VRh3EO;K(muc4Q!(xi%#}F*m`$f3jjac672rxb>?i*xw+K z%75osI`!I-A<=7fP~i>D-j`CNN6&B%M>#wv6F-!V%Lxv4%Yw#m{ba@Wn)MImMe>0>3bx`xZ$TETU^z2hNV0~CPkef5$I zDPOgojEQkst5gnf6yVYtKT2eq1>IeVpk`L}hl*Nlx+qIt-z)0R85K1L`TD@-ErTLB zvy+^T@!U?Ff#F>Xtj6&LHFp8e7n^ z3`PNY6{-ggw=4^<=zA z4!<1`hY$ZS_2J?YT-GLyYJhkatWDc+!69y37oxYKbgL{|5Oq#*3d z5ve)UUFrE<^liOVpx@pCz){grTJg+O%lvFhd(u-x4c*lDVd%1lcm0z7BXz#=sH0_~ zhoAjiC~?r-^O8EV&FJ3#X~PV;4|Shfx#c2TaXi)}NEtvl$P_>)=ozEp+EK%;fdGAU zJk5r{9vGBmDpbFH_n0a?@FBxb^bbX%j=E5jR1_j$&EeSbAIyWW7n_d`Ya~%y_g&vP z6&H()w!p^ci3coo_g$DvVm%d9o7B9jSXP*8cQlUTYAy(m23Fdq-obfbx)j_P{c=Uvz^7VmJKpI)V zF}qGV_4TIA11>`^R;f3VM0z!VpEr+WgcUp7o~s;qXhK-t@WSra`?O4etOLbSMldRTFCATuQ2(@4vr>UFbmh}LTjJlXXM#z?9hj}T1G8UBCD^>m&K|V zosjnWGgtG`@L>UVH%3k0ztnjU2N-OrM^@i_s>?<{9o%_&w$cEz3Xl*S(tCSZG~^Q# zR8X=u+r_BhtE;XDTALsv`|9E}5reJWWW<0FW>DN^5SDD%!)YjFw%Po^8Blsh?8Nbl zDQ~EyB2f=IOr3*)v2XyoXXxr5W6nhHg*>{2CwwI4fPq7i(HM_cT!@P=y6c)l>qLsa zc>Y|^C^G>2k`8+be?)8D6-)fW?h1qNOs0h-RyqqdH)jqx*sE&*Nec+NE)bY{m$!%6 zeWvrG$I-a4j*u{{W@Z@otqpXCpxz+RWHi$D8$5Cej;$;sjB!xP-E{XUlZ1W4SRyXF zj2ReH)Js~BpdM}J-!B}gH-bx$h_zOTJ}5zMMa}FF0S_NLO7)>C6iM z!ivWEk&z?RjZ!;MdtMg!k4#p@HBpc3hy0kwvsKQhqSn$1@-2+7au{?7`>Us8yRlY; zTPnb9@-KlmWeqLAfC--j3pYOgkzKuy7Zl#kJYhXfdh|6_&~%I)l024qgF+Yn0aQRC zCm&b;Dhx^BFfArDL1n2KIV##}(W6+7Tyl2s)mt+ajv(a&1p~MvF6s&`k6&3oGRZYe zl2%KyBTODLW_It%FLU9)2=p`Tm23GjD*9fDK3E&g5xgd%Ff!b57pVd8)p3{!oGZTu z-D8UFYJ5#&51si$AALw;nS0pvs@KRq@NENJaIEEdvI3O)deoa08GC!kG3il|`q9Rf zCd7hh>EaDW1*r6tT8S+KWDlJ5EE5&&Wi1b4QunqfcU<=w2ddYq@XE$OZP4PcFa2kL zXaje8RDtyyL>Qgz0^)S0oKs4o?Be8wFYCLx+raKf2()f&+G+xQ4_C0bm6@&gyWF}v zJwacTS*SN_G^0Fd^0uhQN=fbyWv?wfNeV0k78Rxbo3{|WqhgGTsK25G^M?k}k*V@7 zl$Q9Wrww<%QvM#UN{;&>=eY`E55;44x$~TLQctGI$xr=goXA|0(oc(2+^3yFPKuY`*=1L)PbkNMxiK|wWqC2O0fl%lJogq84Q^a zsAm_ExkzTO#pX9<^HTEG_+R~UMl$Kr{y_J>O$RP6FApnsZX+wdXDNgYZ+VVnzs;zy zqBle=2w{pv-W-T`O1-UO^)-VUG>tsgkrdn$1a<)hWOrQbI)FmtC*FxUEEn_*kAeKB zj`(?&wequzo-Siw25@u9VMe#*ECw>lknEWWO`-~fr}Kb4UqKwNoaIuaTug2s*(SUs zQKddD$M{Sli*-4Ue709fXJ#13t(90x-r=1zPhFhSa2+bxSSIdfy6dg)o=uPio;?VK z2V@7nx_FWy%P@EJu1l71O|Fi3TE%a3e%#420dHj@2B+>X@TPBBuhqUS^b>zF@EVkW zE)0-}W(`+}3ct(S^^-}V_{n7t(^#{MwJ(i`nis7Nq^is zNCPtN`Hyz)kp*J6YlD?|dEDZHZCmLw=I7#0o;QAjg*u_u>KqcI{%zSx@%sSEy-tWS zZ%qw(_fvLyVx8VYlfaqfS2$891a1)QER4(aaKKj^m#z#~;iQwHB6*vjG$g2Yg0FYB@d2qhupfgR&zZqVZpf4r1t&`n+)bk4R3z6(Gq5 z$2_xC?LKCkePhIlUfVMH6Qt_ArQ*tiI2KrJ8r2$8RkAaN79Q9uf!GBcU|Vve7t~dv zZh3}!;jCD3I`?=!0^CEGKsSA=T^-&{iZ^vm1`xX^jxe>c7ibZka~#tfi{n)*W00!I z)tTX+n-C1_3C%{Us%I42y`KW7$`=4UEjo&A@31W?MB~zVJh$qNra+!h4I$?>poc9o} z>Bv+q57UJ1?V@OkXGfPtVqblk!vhEQy|AR2g9I!3*r+b0vDf0H>-4Q_f4;dZNwU_1 z;k-)r!Xrub#iUi6Iw8c`d(1e{tJwesh{rXv?%Qv{!|J8Oz!SlKBcO2`*WHWR7YX+$ zmMlAoUidX0n!S2jez9j7q-TR*=ul>ICqfd({k3s<9CAQZEgBMx-#LqX zsNVa%pP0}ndkc2PylekmVJMv{m+>t7ara!HdXk!Fix=6IDdY zV-EQrFMQt@njNYkUX~DyK04_%aSSMVJ(}GS*v7nOgj&UlcJw`nnPz;i%e+GmIJMaP zDk-Whg4sNi_7!e_~y$HWQl4>-evh;00OGdhLd<(kLrl1jX!#2}YguZ%+y ziG4}k=Xw^{bU^VJ)ByZ5=uV$Wl!k@=*{gB)&`$| zox8GBt{t0JeWUj&V4Be|jbA0{rJ~Q7j{8uYe8ZK*eK{u5l4N!8U#{aFZ1e#$tAkzB z#sQ>Q0~o#`GVqsp`FeS|s8q$P#O_K{l_Hk5N9?lsX#|v=^g+a}o^B(oxfyeP* zM1~x^*H)Zb0T6Ho{-2wiWQOR0&PcP9K~nxziEk(uzYcq!^-Zv{uv(W`4LrL>J=FfG zFH{Ls4 zDG@0G5n-%g?vqn#v-u?VByF@LRmKwEbq+}DEI83k=4lZCj|E(Mf2lhxqFe3%as)q`E0 zfzQOJ`$ZS?@IDLb)W6a<(u{!uO)x9Yec^GkY+I+Gvisb$^l3joyJ}M8cPz6(Dq;g>_qw z$K3J%txVwF>aDBCKF=GIxu3;{Sn3;4+bH^k`n1OGuF6E!q3aHkJYJs`zKyBHZHFWV zr!&^36LsicnpoGic;-^7V=2Ci@)bTEMi?|tYJK^v5Xd^z{PXH)!@J_oygStxr8X6J zQn#>gXskCim%P>`Uw_88y=7ck2N-*82ty2PvmJ1$FP8uTc+uuSmP8Uy1w2w5F8UIEe9|L?OJGiWo`$Ff2Vm-}+3(4~N0`MT@5fFt? zn4dyVDK#AxJ9eQ?xL0q%`&~5IoY_J*S`y$ML3pPWdWKQVt$+C4LZcP&azc|ZJPXeO z5#d&>z_8#$R*&*B?e3|m6@_%`v4`j=itns)^-7S_MBtfHe`lNK2(Fmj!h)%bbfFUM&WanIUH!|9JE-{i?EEX25r`e%Fp`Z9VM2m{yw z%)B+PS2k8J-`jaQWq%e2#i2=Q@3>xXe{@Ap;Q4eZLgifXG-u)4OL%299@Q{!{Pf28 zv0XdLd_Puoy{c40GCfH$EwvbFU4paDC9LHE>EYkyWMS?l0GthLLrQif5IFKB)*zkl!CjBap_L(+;jcCF z&j4vSyLRlKIZ+~4(#bB-Ll%z*QERJ7TUF<0o(3sIQSx87+$F_!Kk1rL2jI_n0tERL z%6xw(u^w4=2-?{gx;QXUt8z<|;^bAB+xMY&(h_lFU2V0b65O&RJ}n1+;>yEx_Y3Ug zTTVs;Kul+PX<2|1;^j}W9shifjXu+S`X*YuUFu710gg$WGMz(gDVWV~t8dC!YN3>e z=FVbql*Rkp1=3(Mo4{?u95#V5vsfXh;K;+G8{D?unJ6MMh44Hmrst;dFmD61>%bG0 z-XN#Jl@H+P81ubiH*+@936L;0*bj-GR$S^k66eZ(6&TRY=cE&tZxhkofdfH&l4aYq zmPsHH14>oR99?um#j?yd4?wt-m@~OH=QZy2WLzW$UPfeEQhZzUP@(0AK1)QOtBf#M zuPPJXwc@bH;5*V>-kdJ8wg!O(Rxrlh;XvzIi0ro-EY1q9t(1|C-@UE<-sN5L!eQ)b zxf9mr@hDa**Sn-l!NN5dc7$N#C5|g&;KyciKuhOc_AS-!`z%^uksK5HPd%5)6e=3y=$w2fI_tkAMXn=HZr3`p92CE*Qei5VxEKE|j@@Wv)58nZ5@B)#8YVqm{SumVeLcMTR z?Y*x0NKeKaf2MPl+8(B-YFI#Y8Y?(PdXyeEM(V9&808q3a|9S3*n9DF^DmPe*V~i6 zX^*jlhayoN7_5=H@EW+$IO&pmXe>Wf16d0q4RFb6mTfUUz-_;!j^M)40?pnNpQ7oP zEh?VLb&z_db9xGT(FN1bXfx%yG*STG1uksF*LKyPb`EMiVk0J5Dkkmpzvsm=ItnT3 zZQ(s}m!|rP{_sQPb(Gv`Tj}{)Wbl7`w_lZDl1)y0bN9wnC0&Dg3z-lCWl4ZjA<=V;mBF|?zc<%~e^uG5 z_GgS%u8Umzh^{9I#KF$`vcn1SEN}@o%fjx0t5Z0yKB3u+4(U8kddw9Y;bqcmhF{^+ zCm$Tozx4(a$v1NZKiF3}*i{J*L=8ah*N(FtsJz6qkHsQM{0NylVJuhITG*&^Qn$|c zB3N;e9|*^n0=L_2{L0k}0SsF4ZwL>qGUS8r@kJO7X?q-Hb1!`k<_DLnvRI3?8*c_& zVV7k+0uhSHp_wTnEBeW*Dq%<*6M%Mpjv{m*75^V}^vc`ZdufQ9U$c+Q5U!&+nlUMo+LMV^N9`P-BVwwvO2l$5~-p2em4(XZf zo08XgL^Kj}%ZW@SX*nElZ48T6^!>|{cD4B}sK}6#;ZDYJco#cOHjxI%{wAWMPFV8R zz{=EScxm6t^D3-KugQYkuc@um(MVQ&t~R;9oHiDUATt zMTA^KzxI%U>ndZF)N*VyDhGujRBxQqwG`@n?qR7PD;aNPszV;J3$m{Gv7vC#9W4

      3H5#G%@7tE$2OWZIO@Xm_cSm74;8Pm7LTt#a|HR>D5%bHpi5P*+j}cd z3)QkxjcYf1Rg)9^U=*v7OVNWb!GlsuU~4eO;exT%i3cJUNC}k*BcXC}0^_q?GtX5B zaI(UK{S^q+I9<&$J9)b*E#)DiNJlBNl}^ce&O-IKM1Sx+dN{r$Y7~1X;G%lt2Dd6% z4aom!2pkv{mAKYt#b#|GaUUd{taB;XJV2GW-CIo|NObn!i#|Ftoc34TX>uTVc|SUH znpGaNO3fSB$+S?iP9u8cPs{Tp2Az4_17NU-z=rEW1_0}ymnw`x0C@vFxmvvGr8HAfu)gRBEIqs}rsxRFjMzb-=$g*vs# zDap?dH(-;eh=okvz!wD)nC>AaNq~j{uKWbG)Bd)0WCt=!yGuuPf zYvk48(Mz{Y>$@wfec*giJ;*SBjpkTV`q`(V4k`+DGG7Ig!@icNGRkPb)W8g6xts(S zeU`Kx8Q71jHtK;|EK)Mz`^{gQ4+u-7(aR0QjP4CM3my)t5Wp`79BWGLJM?^W~E&o?NOA)vNC)^&iQ*z9|!nW){7(AD&y+T|(dGh6hXgLHZ;GoGl z0+w^w(H1?yiP7b;YPCmONf{3h&vvhDpHj?Dei(h8rbE0x0$j3{0z7NT5J&Dv6X6}H z>OVTF9}Q#sB#*jQ{Dub-zQiyZ4b&sPFHl+*YB-KOTpU&X=G%{Kc2ms=A= z39lV0?JSwzNaqb-%^v1|scSjnLMe9DJ2svVG**EC0bEG})`qK7IY-BCOl)mySVg_F z;4DMxbgjLL8jW<9v0Sn!_=Q3^JCkd;vCi{SXMaW0H{0j7T+1i@B&~nBvd#*`CW5;( zzJG)qCUuK^zw5HH#R!GJ0l&s@ElRRf>VL8K=J8PX|G)5us8n)ATI>piq>_EFu4GFQ zlU*U}5M#(Tq@u-^UDnEyeINVMa*-?}%V5SCl1gHAGEnGU1 zE^}mLLA36n#$z}C0QD?px@7|*l6XPzE}P<@2s%2PHXwIs$Af~j?i7SMm%gR#qF>|9 z*03&u`pk_KvTA6Ua1P8yS|rvQ#g2u9##Ydak+?x;O(AsGq8j%OH{ zNts~AK~R(~Z{b=?ZtW`8Q2&Y7d&AZb{(Pz(AJ-)T_AmP=9PuBxUK_0d2~;VT&%Fe3 zd`pVea3&j+y$5_98=YnPZ#BN9M`k3$GZ4nhOqmVzVh<`n#f=RA(YtnX z=!FikT9EatwmiXaDo?HV z6B2-(0;l%xSuE(H^T-44f>Q@|aO&i<_j3o;o%D|l_6JKVK0P#2Es358z=972E(dh@ zoGdq0=3oz*Xnc|Vv?Fz5Ab=$Z&Sker1kDmA%B-i=zHLTjeEinLI{^$}Rd7qXgZ`b< zX4kk!Ag34O`2k$+d3w!;z+o_P0eQ?=yU9{R5+g-Ch}#D-oy@**Zd1|EHvyA%Ma&6*A8*qHvTSjv-0Wq zM|Ej7ndw;jxgI`{Cq9+_wt{xiYEOY1a5w>kg(Z~7UFL2ydu|Dhh0SswE^rtBU(~GG z#~1GKeKQO;CfA_=P7pwIps7m(_wT7d?uQyZAAg`({POqoQjyQv7zPp2U}M~P`urZ? zqD+B^#2fDy2U=<~%nbL-J&)EZN_yTs5J+v)TM7U9UhrcUd9`w3|lJFbu&5$fNyFH&e)3Awp}Cu>A6C>7Fv0# zT$$2|LxOjIkpH9cV6`j&jRIP*ckN%JE28BgqeLk+;g;{%$z`7tsF&4qoe@<*?)v zwII)Yq<3SaUbxrg8xX;8lD1a4v8o8*<=fx%zP#f>MTLqNI870lVhWQl1N$bZ&cN^W z1lEKlQ2landNDz2V#SQ@yYh#6RrL_wu+V;2|EsHv;#IUuaGGYm&NqK*D!{Yqf>r$P z>C|qe!lXbQchvw+_p87Z02Nsya$xL@|H*llBPf{_if2Yu!MhMCiVD>^x9(rgfDNH^ zxb~TsdknJ7UE~dXl-#`Pp_Ae{hf&0|Tr@NU;TI6KT}bzs6JUq3Ve~8XWAJNR-mPE$ zE~=}C>n$ap3$Hg^d~L*U3{*XkRn2f>Q>#DeJIb9<({`^c>G^ldUB@08T7FO#QpJ5# zCiDaL2`xb&%X#(C&ge*%2ZjD$A4s0j)$NI=1&uQf*u27=2{VdFNy^;NnP_;;sh*w> zrVzm9j!6tv$iQeGEo6J>^k=zq@}7l11wanMeZDemP_2OJS|ZYNWNc=)>P|`ORl}s- z0er71SSKJ$1K>Uv{a?LlLG z96naF0*SBlAaBvXbWzf*BXdqtU45SXttT$`KJc3J2j#10gZ4mE=3rh?NrIy_m%2wf zqtHHqQr{shnf4E~pr^V_wd6~y7#PzFCcL%MBny-RE8g2uTQe#un!s3@7dCQFwGrJI z#==P_m0UvOw;;dXUC=oY5;q;?Yl_U61mXY!n1zqLm9`5UcR;M7EEffmi{LAH^1gNZ zfIc}Na?msQtWmygKxwj+gJz8gNE;1|l2!kK`aq45Psq1e0un5r+DJJVC0Epxt6y(L zx9}zGwFVjOedNG}^sKBU0ASyt^BY0Rl#fc8em=N*xROk(HaoEWw|)gP(MBBS_Yd+L zI-AI|;x6exK2zqnlh(eGb^l;T@AUl^xCS&6&iX>P=A4fWShk(4o3o{C!lim@z;6S~ zY%qz{hr;>zEB=HZsAF?}0`yoG==rJ9|H9E6Tzno)Hhvl5l$IIN%M(iL$=V29Y_7mw zc30LR9FtM!(R*?h7Q*@&T?CNBZvEFPN8laQtH1x!bR+ocH^#Lolsr(^vgqhqpG;P$ z95BWJt$FqI-I&YW#^(c7JYBc4Yo^*;VWF|k*9)Twv_e3Xxv$z^2VDT|G8sU1`0u(O zb?agMVDN*2(B|sss@i!ec#Srv7XiuelkN=h?iCz#IfX6&r5j_?rne8`mPX{%=(LnU z9~$;j_wV(fhB5T;2YyASWkWbvfdG~M<3shXqJe!7-D2O34{|{&k);o?5!8me>Q2(X z&@L0z1(r$(`{A#furdd>xV2`{ z8!^;anLEHbhOv%tHCO1_6*CbQXjve*D=)!cb*2Cr|Hl~ceGiu=j?mu-azZx%5kOyY z#iN3F4hVNnR%Q5)k(IF{%G@pBYZDthstZ^k3P4OoSC1)AR8rmkdRdWea#<9FX3J(! z7|+)MCFW9{kmA&Kgx$BJk@>&r5kPJrtPl=C^c&L1QDFubw;3tD+eioR<4ygC3F z^u zMqDQruhrNZQ{%I5Z8*3Hz8|M%_u0_!hTF#E5yCnLq@@hQkza+SjbL+B9@=|-?`36& zep)GOf4O-_P=CIlL`Dpj7wML&2o~rx2;2!iN9SGc_#NH*Yh-RCZJV~ubV=D*+Fsk% zh-|)wh7+^*|BQ_@fy!#sZ&6Cp8VUI`x)~wxNP^mjsXL25j**K|XE1{n=^&06C#7b4 zC}*bl?GptMwFkX%^rP|_U|hrK1(lk?XDyZXP1U7ymJ0SAMr1CiuFF_8=SplP9xquD zU6gnL6ra#R3WKn?Q!6p`y7b54vJ(3OTK=xR&|vnJ*na!la;6|G_>O2y6of*(L2p&m z^wP{jzNS=-c@f)B{8`MSbVSLAjU`l7fYaEUa9(HlX8hatQB(OCH>xiLMFaKl=cBZf zU3zHNM-?aE$?b)5X0SZ?JWJR3nTET9^4v{oAC1$%vjJOnU;S7#>e-Zp-*GqM#UtmF zR3523hS~;46mGkooT(O#-Yp3TLtLlNm=hOYJ;qMpe_kB{?rVKIDuZPw)U&k!@}bMf zjDp+`?IWUtl5C+)X|?Qm$j5W#4h20gPx=W4Ms`_SVvydCfYv7_5hxJk4vLKbg>Uw} z9i{k&V-a`8a@D>QYF#U8-n~#Y^_ti3A95m2<2v|5mY5f~l3c9w^^N=Kwrya>)?{a} zLsql@63@<7emxE3?ta1clYj9;*)oAIKIpvYbfZSqD0Ic=d`K!0HINB;`l&3p*AIz; zLXnRZe*Pi9X?hm`XH>%r?mq1mh15EX)9hSJn6dUHdxL$}-;Sv0omo3e!`gWe?+Xn+ z-aa}pD2Zs|Hx+kC>qYPH zT`y~VzaHbxs91aj)IA$K->MkEV+Vl?mcnzsBR&Kul+eAuw}5r!ram=$M8!nYZT#iW zzd$TcKO>6)B&aOt7%fB#vZ}f?_j+11KXfDQ_BHP(HR$N9$qHl*2y9BD1?PZ%hRHd{ zq=sDf`-}lM`&x~^_oI}tIg1+LHLwxobd)IgX=i1NG^i7meT095M_eQmqv>aLg@ zZkDjK7=W$06OwqRcm2Uzo;}dYiJ{U_{*hvr0zuv#*I0IFYj|-Fl&R;ui_4cpRM1IQ z_nk0i-=CobWg`k!ad9%#H+aHLP>*rj6_8h`0fhFu%%8iVA76QqDY?*(0yqs|Q{daG zpb7mH1EQl&ZUU=3&zYJ2^QzN9$XUCvr}A)R&Zi`Kq@qmCYYT2d%0z>I_~3eB2^XXW z$Yq>+Z$G$A>7MIjfoi0VkGR9L5h>w04wjLnFqG{C^y!bZ^G?l<@o<4%z>N##<`!n1 z^s!D$MO>`wyc>BJqz)FP^)>Vl)(jO;{2*VgOG4%)5p@yU@Bdi4?Fue{0qUDMS0ZY| zucJUep!PsxqC>lNYphoTEG%{I(+(8)wydh}D8Rnl3X^21upeW9)9_l2Y44ytKVTjR z{K)^>$nx%Rx8U$0s13F#vjpeL@nfT~4=bNitE0#J%D!u~zeTb}P=16U!8=l2kdHb7 z!4!aMSAUG6W9qBib!>Hn#Q_gI;axp)#BXv7FkC~SG@wLvc)*)WZtwTh!@5}PcQO7? ziy8n}VNa@T#`o?cnE|{3n8zz3_`FfRwiWJ?$V-7}!o6|65d+wtg1O2-u;V0v6{VC% z&h@?We^3P%MTE+M7raY9hYmYFxX36w=ieh4>H}GrZQ`8+ zUw-dUQP{VxOm0yDEq1oyHgTK2&1oO<>*zL3b9>{?f#{7LMsJn`Ij$@CiJWKbrvq7& z`)PxV&Jb--)4iXIJv4AGVr$`FTZR%Nt1=C()1()nEC>OKw%e)nc-yd-|Yf;%eg;z($<{q zfjoJ&Q?sYx+Q2s8r-3JMTI};o(r}{}buIRF4d-%10ec=szCq3-$NCH+5{$Q_dj{bA zRNZrU@F26D;z>~c0WNtED%X01DrsAfXMj6jfGqdFD+542zEk;F@~@n{l{>8B$F$Uw zE+ul?Mjf%lEZNqZNkNjltTL${^T+4As1cM$tXeH&8qV3mjH-V#FQF0YvxkN^zL%s) zv!*F~5&=fEhz+>- z^{rzjQn!93^~iz>5yd9B&mqZ6VAh339NU%Vf4@pTR9W>8*HH_Rc>a-erb1*b=y!_P z&WtoTbIW}HEpL!V>uHej9RC#gQ15ryeGvNr3l_Xou#?mFuBd*BqWpHh6Kh%>c$ng6 zW$C&@ds(2J`ckOxS;=cX3fW#uPSBW5p$izW-n-In#d_l{;dE7K16-^NsbG&33UFAn zDLBruoxXGg+d^_T*kx=-rM#mCd6w`KmKj(@zCE%9s9l z?uiTpQ!2pS;Bdfnb+`1uy8W(MK@M9zc12c^e`^rPS|KS9KrmnhelMJH&7!%<1 zd<^nHfCCZS4fu6Ht?U$t6(Hdbg5GI$PTli-aB>Aic;KpLKrnm=mhnJK{PPp#bpPZ6 zI13j-gR?VHpi$(VFVV`?!&noJgb6{R0B#LVW_$a=YuXAf)CIG$j#0u7kJ5kqhAV=# zT6em&FQo{)1wOYkf)Hl|W4<2<7l2X)ck=oA-iMirVJsH>Sg#2n2VkcPKF2!|c05AP zA8;#A@$EFh`P0RmLpcDI443f|EvoI~6!Q2O6r!J8U>F$@^FaDWFiKgwdC%j0W1 zAO!g5UltrLAaD$R|9$$&W8j4YN=|TY>Jl)=B~+@f{AAl<$pMFMiR=`B@33crAj)5N zwXYvr1S}9x=lVd zZ_T5Gtbskv(Hf`w02=dtY7xJIa#Wu*RW@cTaT=$!_<@c^mbzXW z>N}U=`O$>0OM7H^4*t?T!F^80HZrH7K0fe_XN}wajs>qtW%t23#v87ET1DW-l2Z3# z*NfndYH1p$p&GE74_tf&rdi!{@bf%qrjLyL6?ymwArIUF6HQYu8vn-yFxPVaD~0gn z7F?|a-%s#hWd9y^IE|3K&+no!^KC3Rgv$Xpg53t%T=JrNE4(a-wkj_08&|Z24~GhY zRdK`_{&}A__y!17wMpI$`BqITZFfP2_}Azt`4)VWszAql5o&$gq`p0@6 zvt)gT4SDD6F1U7O%3EIHMl!Yl-)`n%e-7}Xde?qCQ$LSOJqS#M7!Bv+^~}Ptxz#V@ z;c~McmwSC+TIp;lKZSc1t`~8&r`$J!o=T3}ja3Rd6$dsn4F-_)Jiur5VO2Nw$j~iG zM7gDq+*R>zgtsl$U1tuxhvt}vS4RY>!csT%JBc$TCAYmh!`0Ivm+$F${j9{1Ho1@E^xH+sE3MPy1P-y7|Aj^^Sx986XXYexVoEe*3IIAop-hjVKSw?_{3ObZNrL zj$DUFUK&P=zofjZ^wR*s>XsA>!4*qID!EbY$dqf)8!%W4ThS6X*x~so=Rcj+IpUg|T ziYh>7e6<^61Zo7>MC!?a0dh{(_@TU_J*{_kKg<_iXG)FA%%v8+z8R7W_=dXCn$$HA zWi`s`Ot}dU3 z-uirGzAIO^1aAoyXK>P=GS4m^BaUZRzw|r#`RkFv zUD;+djaj^?<6Kqak4LOhHE87KjzER7#H_`LvFrgZHssEi9O z0xyAUvM##` zq6qzya34&=4FH*$N<)4Nzb(^i`#D=wV{k*Izk`bfapizI@$C~7m?W7V1dri8)_GhO znPBRHINFU8Jby+mRUEp1d=!nLmJzp;c;>>mP4eAmoq~KY!}n$u6__uMPED;qwp$bs~79;26#2V01|Fk zZdiwWcLGecL5w6u_QStteqZqsK21x$2l{$4PLxQ;Jj|(STrytyI?oPsG*ZKUnZ%N-%MKY8=oVmlk27=Sl2RENk(#y^WF^DjOZ`jO8Q(0g z1EE`BLYV4DCI3SlJak%L=9Hgi-T-wxFMa((0O@k67a^CPpp+?|1f*}ey}t09do*U9 zYpWjJ&$z2|JZ8=(uvXHkr95*z)-Bx^sV*Mv^2`y!0dqVqiBHv%|B@wOx9ajauS`q2 zQRtQQZ{)%|JksFFPWr8R)nl`ssb?jeCb;$JfyQ0tDhFw}XpgRmbrfm;z|7h0&lph1 z^FRoctVruemDPI@#^#a*%<(}JbK5bR`lA=9hjRH`^rOD4w{)+OpCg}|r}@q=hm{QM z2?TX9P%rO%V@?i3CGcNvVQA_zYyMxiTt)QkQUk8x@5G8tdGL=o1rffJ*o})A639R z7=(-7qtev#y3)D8@Ee&m*j`*h^+ZU2!t;j%c=Fn-vwj+oz>f3t2Hs!EmNPKX0{?PW zAl0vQuyRN4{bNXi)&GCcwuT2E&?!SkA772Z_J+ux!iTd%c8q7R#{b#VG1Mf|lWDLA z>IbH*Y7}P=yfw$lWWwJ!LZ^2OU#LyAqI@^Z!w8N; zZD%WL-TtPZ1;5-CINbpE6kK%@D%c)AXYuHwp9(mBt)PNSs+T-Gck<-i0rKJEwHNf%SV zYEinofau-z=C<&~J}!2^CC1`B()3joDUi z@FGGj*6lBaUIYi7*mnB8PXhdZ>VvHm73`%5w=G?_l}7})R3f5}MQC>bmzfG^*pqMX zn!8R{fM@{pC2jS1$A2DYfwLr#$~PJKYawT_m_rDMn8hFTs8HH5?0lhOZ4DOTr5yJ|q$3T@6 z^0v(=G&BMVeSVlk0aLOUxJwU0&9)f;lL-v3N3Ug=-E-Bf5-`jvG`yStuR#9Bfps=` z(#-r(x8vCTv=c4=3Kz}U#iVPpt|W1`0eYTL-g?hB)vN8#+rWuzjhZ!WGV^n}Ub?x5cx zocF*Bqd(7CQbJhW!QtC4iJ#RP&#Rmb!3C`Lg5GGW@!s&LS^3pYeaZ>JSAgq5WB*57 zWB>P}|Nr#U?`>iu&B>*=^5E}NQg3!UaEU(tQ{m9w!%xph{$&4pt>Q3Wk`xO^ngwHH z1JR^uQI{vO-{B4i$KG2H*-vn@9X3DwxZG1$WIx9pg#Y@g+%Rp-DBmg1sW%h0XA?a6I9up^zoW7W;pr7ZPbp>N-BN3gcNU*3M*p|-L>yNA18w`hXs&J+|X{b!w| zK)O4E1`6ef{hvM*YJy?NRgoil=bSQB1ARZpBW#u69rD1R06UlZMicz88-u)6P7x8( za3}`+Noe)|eT5yX*#AAW(JBA``YI1q7Ms)xTsh6_#ABEBdX~G>|f&sruD@ z6l~Br7%`ry=+Q8j=doQ&esi8d#mwp3QiPTsbf_+FevsY#@C%@yzta1vaB1qQ-x`dp z&j4bH&mq}Rb) zRL_t=ayY-o$oisRE74l=n`_!fQQde$v4ADaTB9HN+3Hw%v}f?VrFH#ml4S!r0hNYk z16>F&n30nv93nO$OuBWf+WQ_c6K~7H=0#%jBD(CXQd(P3+*OYV^hHkUyj5aikxa{4 z^AdXguHwVM)rq_~`Cw(uL26G@$wUA7)3aEjhpMEDy$lOH zrJ}SHycFn%`E@kJi`?tif?DHT8@qm59Pw!(xh!Z_dK_6!IdYZe@wR>S9TX7f%TavF zE2YRiuC9yPw}{Hx@aYV-h{u0iIirtnBC9XW#fh871r-=~{N8W#Gi)?JBA7XEtBEOU zdTp6Eq(aFmo7f~N`o-jDVFHpNJ=-Opd{uKD2+|qBjtLpUT^l2IKUJE;+pTiGw9$i1 zO7mPSJ$tP{Yeuc?!C%t%aM8-!o3zFb1(EtQ=ghMVwJwU+$~JW44LrvCTE@-}3W`tPeGRQOt8QsdKfE{xZj~v`+7X zg!p^r!kS#K(%b#jPS$z^16t=Q8P zwm(_pI1J3V#h=Cd=gQV@>vqbtpP-BPHNVSjLLi26&NO}yr=QxJroipoLk^imU~=^< zSM+Vl6wWp-RA%VQHv5p{^v{m^f8?JySA-mSB)mDbm~@rn7#1mhy34l!og@;355^m? z&U3Vo&xar?!(CF7%l*l!lcUz>(eov>zMXXojSC;sc`9vDf9Z1r#^t*ks)&N6ncFS_&?ABi(1;rZcrkUb6dPQH*$@!Q`gYN>6UBH+SCzwhzS>}m* zI~70kEEt5H2$5x+x;>#fUtD!BM34qHbwG^Uhh?oF31n}b|B~vzY@-+Gcs(;;ESvCU z=tBJyOV)}4)mmfyDfuiz?);n(-kBn@qS&US9mZMSPS%rJx^ z2(x#>Gr9Oh@iVrFDxu1Il`&Pgs!~eQZG(?D`X$KWDj|*`rrb&h{LFcT@erWIFkVFs z4hi^o4_&NRcPOpg_^7%0agmAF0itoSHkx3WJLE4xeuIB?*pByj>2Z4|_JLjF+U}4Pkvpm`rD4;gh?_6*$LHx2>js#mw{*XdH9yc!5C5{3 zzcRB)l_Hj`Ui6eUD~&8NbIM&D8TW_Y_}oSF8zU-m)bbJapu`86&sXL zVOvPX3&zHU4K;C~7xHwKHx{a#vXn-hG-#>Qh*>dz9&^n&h54f3*kHuO_STvo2Tg3s zI}>L$93l)s2c=tGK&sl9BUJopirsD2GSRd!c*WlK)dHc8%{;h-p zYGE|?7L%jYOjksaWth!~=St6#x!A}nVcDg?30mgxxQAq|p8nlaotbP$c(NS>S7IJY zA^XE!^zO=YBnc#shHxw+yv4*j0<9&JQI{G+iU!wDkR#IhDVslIwtvS|nO(12{vzFY z#k2IYUYh&$wDM=^e)IeKR`r2jBcKLsn^1K#?RmBW6YfnbGlo>T^|Q1Jdd?sj!4bQ* zp;mT_pEup`Cl<3OACsVl7??@Y5oYv7+^fm@+1R?#sH!;ez<$kei|r58lW04tZ=t-Y zJJVM2;ppqmYhHRbMYPKrS-##L*VLB+ zCpQ{=do{N=GxndY%XX8lHPSyJN@mr4+;i+z2gAA|-7mhn)2Uk#YP$#kAsRdCVyWqu%s9B zT`7XbE^r*o7qd&Z8*gA~#PpTPm=2F<fFe((<=emXZ5jO; zPMRB|sz$*S6F;HfZF?5SHYU~<YZR$ztnf9)FrdqFqQA#aOgH|Qsj)am z;Jm6eKYA3b17u|Y+s_M(UQai0++LOz+A4X;$#qNEg;O6>p|PDhRKX;_vNVz zW?{}87fA}v1&#EzknJ_q{0v{hugQkbO43SdxTestqd>1uzh|!MVC9UAg1+-OWvPs! zhpmTeOdo##6QxoevbE8=-AE)2hcJho%F=&Ec?P}Rzc0^--l#s5e@cB$x5_AEf#6oA zE;M3;&l07PNL5+Pg`Ol#Yf!oC zTv};OC~gZXDcd?0fi>KwjYg==h*lx4{|0t~@8)X2aa%pgwNypiBm-aDz%a(wSK3dg zg)j!P7DYf#&S5n2^l{lT(e~!ucDNt(-!Zt}>Eny7Tn1kYK-b5Wk40)yVP~o^@G^Es!~+Y0V?h_nzmye%NA7Wkxo<9);o{u2W2fz=1k@Eq z`u26~1zTW#`q%Xak8Xp#Rwp9b_d)_f|Kg+pPq^*VOqLTfo2Vd$?B7mc>s{_)-~r5M z(sx?7QFmg-Or2v)JX^ux^o^8ktFTA)7WrYTk{k=Bp`~GIxCiZW_bfAhg8pGXu)C0z zs#tb;gM3nW{WFzYNS7^_%GNqimY^p!Lr>UuFca0QTvc-YHwDp3U>BA?t?H}E)nmxo z>7p9^8To_o=_Xwic?(jlHISMF=4qpHr-n=L?~lTZVHq3-f!C?x$Vlt+Wy&{Y4D&*oVzP=$@ z(1*f7v&)U)+Hi5fI|YIXlT`}i>m-cgs}V2dLn=HL12ZkWG# z86c-w6KzaE&5I#P$h2vBTKcfGkU7 zekm88g6TEP(pm$#L^fo-tHbjYVnckogk~50Y$=GWYCUcgNEo#K(Gv(PytF|OJx@FK7k{|vK}&d#WZydL-Qt$?Gaxw0JDR(T+t^T>FIKpg(mTZezcc16s9y7Rq zUb~siFoKYIijMUj(qVmEJLavwX2W<{WVW2LO0ytlS&jB3Z#i6dJ==b4-y4aSvDki0 zkA7zUc(j9!VEsd1VH#roFgtjWX%*tD9OAhW~tNd|{ zW`Avy-(S47+gTke_KD194(8*l4j~d+S$4tVB2uv}1$Mp^-TP|PTm53>aLir1T2jed z0Uq8@xFD`zkC#Cjw87+nsywOl<;4?X{*?+0H$}RGb^gq{W3sgZ@%!VZVcS;8IYe|x zdWh>d-7zglqQgkTWWEybAvEAYxyG6oa(zK~*Qf-dUhG#2W7$tHI^y;8`7+Loh=DA< z)iXrdITKrk6-Sy_jj?U7iAz~~5_#@2BTjiC3&6k*zJh~M8xjvk*f2a7-I$|UO!K3~ zrCN70PlYCBk6+;UZ2HH!7+qhn&$l0v*&gu(U7u2(EbN`+=(hIm6tCio_8)vJG{nBi zJ)_@-wrRWnqlT7HcHb&^NoAEp?&M{@Y)DZt8vo)f9{fCZb0};!4rc4TP z*uln_+rSV~K<5hcCg7R|#~dadf=2hip0HERf{*5{3B<#>LB)gz&tBK-g;ta7Z^ruk zpgXD0n^!rhs&4-h-u~KS#9mi*us>@s)yu)%^aB2K1Es43PjP+hsQvv|Kr8EeNhGA? zR#GZa_(_LhtWC#Mo<(HWX#aK$9^F4@!pKCYZskoL*RftNKUyhN*s<#A8u z5JGN9&j2P1RICr%IKhc+BR763YS*!;@Z9Q}zM)kuywdI2DOLv(39Q~6j}d)xEFY}I zV~uP5^*Sg0WgmWQ!Dg~)k=YNB{X0}AzOwTT(iF4=5Y}kZHKm-@fx?I1-A#x?8a9p_z)sQV zi;|>`^%}8<6Dx+)oZOFZ%-gIrn9H0R+{`&c(Vv)~tfW$k$`(n==p5miG9u9!ss5E4K$l*&`d*JO>2CTFeRi{jU zl5Wg;aMGqmU*iP5)EwC{Q)^|62n$b4IK~qslUUxV*d+ZePU}wCqxGIliV-onDQWA# zc%Bs9!K%P%G-zd(NRcc!iFzgCL6Vrh9_XSN{0>tc-08&q*(!%&;#kaPB>k?Lf)z(u zYJZQELFcrlPV-rYWYPlgS4i2isDvqxRey$pQES;Yh=+}pv|@!h^zwz*OX4Y)_2`l@ z{<2w}4Rx^FUL#0*s-yPC@^acWsp6B!dj~6RDt%3`RK3TB#qW<1N=y7w)7>h|stn_H z*LZmUWtv!=9FQr$30mn#{vutrPt-^h@mg(x@ZGeBZ zkX9=sr#Y(70gMP;5y#@=Chd5k7yiLtkFh|jX*=@A)uvxUyPi!@`o7J3TwI%lbZxty z?tNJx_h;jNUlS>1&EWVf?wlfaCG3%Z_atvZH<`ixpqLoP$^MJXPKSLTk2JQMJg2+K z+}l&4gYR8<|i{<&2UEL@C96I3_&w>dVv_3&&co^Ot~<*-Wc4G)>}H0jmYg& zWVs}EEjiS|<4OFKLt;>)S`5b}lH9txEk%FazxYb$v2}Mn>CbYv}0K&)G)L>X7m%*FzO>#Cly#Hyh&%G4ypt5>su@p{Zi!UW_i0+G1cku+4{v zD$wlkU+4-lZBDJ-Qse3g#Oj9hUuE1xnW3zxYx;EYEW^1XCSoHY9=(y^9#A5 z!8n0Vi=Nxdqg!6FaRIJWM1cYg13Fg4#4ozjG(K6`!}tW%!3w>oKNnNhewzmNO6=R* z4|eJeR+K%L6zUa5>f%-u-u~SYWBWBO)Fv#1gB!0nz{A$<#v9pH`^jWkEtl1QRHD}0 zt@+2FvXqwb4C4Hm#^pCN3V$XVe6}aN)4J2DiOgC~f$mLoIc-edjahjecg;RtVJ<`? zOTpNWBtD5TvXyd9RerbrF0RG&oP4lurvmL(Y?VyloaYwFGkTAM9M_y10})K!^UAGt zxbDJg&{@pTdM$5{^O;q~Ya%zym1}ST6F6&;6 z5U_p8>4y(2)iw`T3J*-OQKXNzEgqnLOebH!nR6+V!tn-)O-ZOfOTIPS6`wy9GW^SG zLzK@-AnpjtGMX#hMVaw}c^==TZi}3*}?(Kynie+HwaTOt&TG?!~iV;b{t%R(( zz1{(eiw{brs$7l!CZOn2#7Nkh39@}wz~@QtQrQFLU4eC+uI}A8dhBxy?Nz;zTR@-H z@0&oxmWSQH{IISmnYvuhhTGtN>>hF;(7aM?Dfd=0?ztrlWim~6h%FJnatC$^FFKm?aLeI+=7N2#tXwK z?rSblZ&&5#`CrW^w{Fg!>REeJUpicM4=msb5TKj=U0O5j0Z0f$>7&?cZwylWbsWmD zJqb(0=+SezPcQ@Y+S7i`9Q)$cm)tO~mj0ds(&-m)oNflDn8L+mC;<1(0n| zU_lsvlciqaoZ{gew=%73cIUKP6WI08=Vt{&3KKeE^MI~G2%MTYkwdp zWKs2@3(SJh*-A{)dXMKKBVA=6g6-@;jDnqVp60rHdz=dQPl3wfOhf%Z`HrD7zTuQ$ z8)7e!Oe6U__e!5jZ@ADgXY?fnb0tcg=&-%wNFCzcwNb)I>NszIC*7^A*>`o}adOj) z`2Jy=qE&tTeLZ{#-bScH2%z6}d#h8o2K{Aod*!2m1q z{eL(a&Q@raU8bc6zx1tIB($xMtbcY|Uf<`tHnc>zRUYt;EATbLX8M@iktEBD$@PL0 zo=m(an*8eZbW@^AWw_h;tJKB8)*14&~S1q_ewL?ohqFrbYI&#>{ z{|^+X{NjgOWN?-JC%0YKbW__TNPvuGAet$rsHe@$G%6?#=W2L@jD5LUAZO_~GiDU(yPe`79FIba##|$<&Zeuyp zUNepscsZ&C%a>M66Cba%3Ky4FL?zP6R}(mR?a)_^A)Kn9NcuU;BRIArLk zeLtkS*1FAXthrd-ek8GYw0OM5%K8T4*nyhXVZyJfK=hg5Y5vKSX74~aAlGP_IjeYw zAZ@^KyMWFeJfBgS)p2M2k>>A5i%Oq|E-4=rqNQ~BbZC2wV!tRWWm)?Od64gnq~9oMXKv zOZmbaW>}^=KBeEts%IcmcsZqVk}L^@j>o~FvPpW#AQMD%?ALB< zukULYzEv*s@V(wh^`wt&j_{e{^X`}Uo2>9LO{$;+9MxE7Qk$AqZCR^Yh$$f? zzsBMAhYyb})mj8fcCD^Agp*#kr>zp@YZ1XpQWu8N(VuzmgEY$?zlmSbe%%w+XE@TW zp2e|U&xmntT}Xa3vR!k8h`OKXPoVv5cxDZSKJxv7+j@_3-lhjL%*nl(8TWgJj`n7< zKmym-$>ttM2UOrJ)-bJSehed_8^iXKJKaK2B$3!(eYSa}KO@bvr9P19;nzs)-6ixh zbWuSOomOUeoX?ifLdRP++TEK79Qi1OMdhoG7f8D_Zm+*M+u%$F$tsVd3HsX?j{0ZX zVZwZhu7yZxVY*~$1zKfpGK?pEaOwFO3Eh6Jnn!Jey!`mH7LuFRviGR}_`ReWnbEi} zA-~70{Z-2#wRRE23H(Cxg)gJvL>D%&+X<&e>n=4K&6;PEH3|6wPqYk>DzjguoIh&w z;9D=qAWoJpj`bIKd^AHkG)77;)t;@J3R^@SH=5Abl*`11(6GVd^ESi5XKP=6sjEbi z{1Yo2HOaL~jOqG?%B}`_W<@%NF*lCU*VU}_HQPL&b+C;Qfj+Tp{HaQB6)~3=H z=F>lxHZC?S{{G@mZld+hYbajzs7gA2i%DBGBp8e{>1nhpB$*t9JSJ_n}RyHav1J#pEtL=%hKqd}LjV9M5%UAa@ z^rw`G`I(V2^O_v5^tA9}IO6cUMYYj@S#(i=1FF&pWuqG>#_>e#(((h4OZDxXl+;ps6 zbyMrg5gtkoXc-PpQ|zc&CD3aZ`ML@E>gFI=L@|GaM)%mHDux`ljP6WWkq*J7?P>3_ zB0uQH^l0?fpF=bb@&?y8NRhLG&LR?LT~iuBdZaW~xBsNuyVU_qA^K*AwzvmqfJ4u) zS8U}MuN!U+G7uCI1#8|t6xja>Lv!4dxRLCj%RWb9A6pJ!9pi8(^HZqE67T&PrurUE z37(~=_P!#1n8oU@tI{RPEuQ5#va}Vjb13qNwl|%@6g`rRm<6`PE<%1T=Q?; z2NHo|@IX8))Us#wmgERW-1o?2n_kASYsS|VSaMSHX8d@##SC?0&vE3inRSS{ANt)%VIGcV*a?Vt4{2J3M)#Ib@3*g4s+$po8)jhAdQ`)&%^4 z#8Ng*J6pH-zF1tlbjnRMguJ<$r`YU*rE?es^v5?$h89SBR8Fqy15c%;S7rQ@SM0CF zRkd{7!VrK|lncZ8;}OMrsn@c#{RKIO!5d9+3N%(v|FW&%?P#``nHG>Qh6ssn5&L%g#GG3zk?=%*@Sk=oc*(fq@lU z#!i^QmNE}?;^gU0S_9!;ys<5*6z`naY=&GBMkES1*dj>k8}e@NO3!s`l*#wmG$(dg z{S`+eT23q{nRA{R3!?R?P6F>gdZ~z+@(~yWQLp39QUfLo3uX*8{p*i{0`j(moot$H zIJZKwmACHEW7nr-AJ&WMayJ=V$m8r2KRp`Isc&;3(AOY%K$T@h%v|B7v8^6!9Ph=f zH~b!TcUBit5G~7zm=@v456zZuB+V$`EOe6lNyMt~XiNLd-ngGGYk%(U{Rf%UD_%^BFK4#}tbFE@a-8 zU>fk3Xl_kwW~!^MV%p0KrnA3b;94J(6Y$i^~}=R$^p$cVWkFawXETvd1Pt zlAmHrI>9n0C9gSu+piIM!BcQhO$Y4G^u

      |1yF&^SgV9Uvu*tSEEClMA`Rag{L~7 zRo5U8s|kZd30E_uQwFmAGv;%BS)7vYEwPvJsJq<9&>Iyk1S9`3oHSC8;KuVOl`szW z#Z!{nnLQ>nZUuymzvEH6NH+0#zy0Cx4D#hToEM$2j}NQeQXxM18#jID;^0#ERkvptS98#z1(nDtpSw<-KLM8~kz_h&T^Ny)$Wx-Ups@DJ3-gibdm9}d~ zUK~Fh%lpE@0RFSRU)Oc-44kAUXmWFm zm03bxndhB%t5JMQTD=8yq28T$CD;Dk=e42I_2s!7( z(WA8b6jZx+$KRTh6C*iBH9FIu&eK!slP6KqUOVmh9Gy&0dVe_m0;~wyk~+K^S!`|R zCHsq}JFRp;vFNY?3azF|xVy?ai{bDcXF9l^t_m@CRa(+f{wh(LcW0Bi+^Lbxts1}f z*>=ZsOV@G{leGyvi9}X-|HJ$BRLKFM&@P*K9j?b);NZl zSX`d=_oNiqmMHiBJz@t5(?f1rZYCP`F*Y)<5V<1rD^p6UpkfEu{U;4?#@4AL<6+Mg z{il<4hH*E@u7dXtbwv+=LVUxeO@~9GKkjl~1QtiT{EArBRAac$(?;UB9X18MpZ#v} z;gjI^eL?F>M;_;4Zj7218QV8Rnp-*p8yBnS%h@cV(nr;z=kxme08zvRTDtoDT?{`o zD#os~CtR%evFQJ-hvTImB1!$RBkw6#U|UadZV(aMBx{S*<0Bdwm#hTc}wfn zdEVv(u*@dgRhb=Sh|RHbD*wJ}kjA?{(NG+!98S5kAA9I+-lz<(_`-1M5`(R<(`5Cc zblBV5>8!m^KCVY|zryd>pWg?4`8_&XN#2{j|GeLgwC$Q(U|;g;**!YzsVQGl0T-0N zIfi<%mImFGO56>*79t8Q$&Tug^*J#?#*HXRHVKm==eD=xaqouG%IoGHa9onhrJ*Ai z>yqTZ|IlTgEC^8o_U#F|u?CL=8NPJO<`VZv@&o4fRe$wU5sp-NKZd$ZL18;IDlWKN z#W~Grv3!V8-3=vO6)v^APtyzIJ(Zj*`(*4-c$-YmrNp4 z8pZ|sZ?pkejgJ|6Z(I8_Xzfqt2FpMRzBnqusYIsTblQC6gPV?oi@y8;3?V+z`X?2P znz6x`;xfeTW}Ne~qs@t>0t`V+YNDOHvG^cpV)N12TnF^u27pI2p8Le)XQA-k)`?t; zO>ghy;$Ye`1Q8m|!SxWjwM-s!ayxSEQS~oyV2?~3yr~na=3`j!Iq0h-2#mmu*yv`S z6)Wc@i0;W=edABMbhGweHi-mdTQk^ML%BxOcVt^!ys9UUAu$3CEW4 zL^s6w(_}(@WQmf@LK>3V+=n^$yET*b;`2`)3t}dGN}*>VpCKli^^rYeoaw(i7x0)B zjuSfWfG7wUOUl)eZ&lhV22j78G3ut9XPpAO-mG6Adc+TtG(>8{Hu5Y}tuYbx0k$Vl zAJ2!=T&GE*q>;r?ZqsVzL1(D1JON zFF`F!RbS&v&ATX-hpV{>C5G>OUejHd2t?--o5qw;Fh@aA{J9m=1=V$RCvtGeW{5z) zK>b!NCe^Sze}AY-w&t4uNd2AM_0aXW7WX|Aq+vJhJ&3}mVCAQ0YQuNg(l|^~y zcSC_HU$v1$kQo#&nJd1cboCSGlX-G1$^Z#>*PA`0R^>|l=Yt1kT{i>?^~nK=3rVA*I`f+8{U9;J^Ur303uZGv=w>$A`uX?o z+x<@IL-LMYC0eQ7oC3Vr*V7l zi`1j!cK43}yI3IpOH3&JV2Z)@F{xdW+9N(buZ5}+8khRT&DIr|Ek>IL`eS8W>H7?(l5=hznYBy_?+_LGK3cY0 znTSs$h;37v{Oaw4!a5>c^aX#mX$BG<0i9|lbVQ)!C;1`_`|^c$XF3ap!1e|;9r7X; zS2-ekb%sStmMMzZO^_%PCFAYHj7N&jk~(FQ58+)m%g&|l2*h5 zX?Qf()zS=RT(+=J@$qzceccf;(Y`0Yv9yt9Q$Dhozqrh%NM6E_LNdjQRgg!{-bwg; zrzz1Jpzq$-!M5qp#B&cC3088Ka2Q$(vcHR^X{+Q|hcDEbA(b>_9=kNjidnSN7}wsL z-()5W&FTnZoF>?Y>e?R>PS`BGJj3I54U3)lH4z@h1~k%??mpE4z)u3YG2TN z^rXhBjidmek86ns`J0>QXa0GF`UbW~4a&FRT|XCmB*Ea7&!$&6^o(TP#ZY`1uJUV@ z-tm{qwy&wG_8N}|W|6{DLv+Q0QET}ng4sddTPFI|t}5QG?zONY&Aa3-KIt8>l}kUx z>*sLRL*+8vU)Ox3+ifS_4g{<-oqMpW^qX`?vtJ#c_#WpT(_fZO@T#n6ylfEw|N3oN zL)5jSKZbwulVvS_;4UUScTL1h^9Zna)J}lq^@vo|7rfg`cSU__ADH8@j|@C zkNZvx5^lf!fZ8@?x}S#A zi!DNS#O0ijWgWZ8KPsY%8%qbN{hsjJXK5DRtkAht-6{(uVX>~R-!CM6#;4EDicS{z zc=^QTXDCO43O#z7oZ0kE8OFzxK@*bHJD!1qM;o=0^{`9o1hHieMBvT zSU?dQ#PZF(p+|^sE(rTN!uEw8*2d8DC@9*De}0ljqm5;qzGHh~TF;%!Luet< zAet0g9LtWqfR>KBj$9dWl}@*e26Aiv>c{X8DwwNPMBnkfkTJr4MY6hNZnCLU6{e8} zKXzFCUUk%vG5jADA0mZn$0aDcL!jfpw`U zo}$!QDlW3h%Wp@1YaQ5_%EUT54Q%kLn z0HB+nWaVvCAZRYO&Ts8+t7*|dGFpBZ6f7T|?kNgY4EtE6*oP1Mh+8=oll!z$aK06? z-^YqR*G?{QVj=N$E>j@67VW5^SF+~g`stVGU58|*o%6ES9;G5OA zpe5x@2g97B8@C$n2b``k zc-5;>2X&{j=B6U(4d2%t&7Egk3K*(ygbnc9Xw94F-kRzkZ|W#nL2)OmA*jtxR=GA0 zi*5x@vGSLEs?CfFhL)|%yVwB=9U)SBVjw^zyP&B*Ah6FF2C+WQtqz~FtC?E1f6W>$ zI2J=We^l*cMZKn7u{TBt>&ds;X;ftvpWSA4Ui0Jt^3t9v$7!aP`i}!VT#0DunYecC z;mx{S7%eUV?mSxBwEH}q4$Mic)z|SO;v8(_IoWg-8UUJk9!r-g18XA|=FOsmRnPeP z_aFDWah_Wkj*$``Vt29qXBes0S*D%gL6SL1$qf17DS?S5IYhi#dK213dIF{ zT?>&h_Xo$!*IOIe>5Vc|)OC&ChzuwXDP><~&f=n|pWKQg48=u?ocODJ@Er16F7ZB$ z&rg${N>kGHC2X8ty=TOVx2T4kNp5xUzT`MAX!#B>(6U)04)FVhrNcoCSKZkbf@R(( zq)CF;(Sr8oQhPT=0c+Vb#mvu&9nGnlwn(W|2>mE5XBf<}#W}vCLew!u$wCkE9u4P+ zuhgcm1u%|tm;l=%0=6Zb(_I8`M8iui_vn|z`E9dn53xh1B=%oxb%a)s7oE^=nt(B{ zRm01hJJePCkb!Q&bt-J5cD0k`U8*mQ0Ykjm_p6itGV4vGZKmd-v#^-MDT0REziQs7 zVU1EqM1sK$@1LjB%Gc{aAeXovvaUXNHpUD;z(c=_zvyCe#`pfi=4`?+p~o41)N@p8 zyo>IhP_Z6Wn&ciX8)XU}axgeDVWg|J4OIu)F}*NzE5z`|Ww}{=p(>)M_OGSZwm*IG z&pKVEcAw`|J-!Z_YS^L9Lc*r7SNdHg*2gD>f~T!o?vjd`F}UJWkVIb}b&%80pDhEc zYy`i$q;fv8hOTSPGSYTS*UMZzn^V=TRWmH>8H*%)3au_8yF0?7jC}Q4n3f|Br`&UU zbiBCZm0OhODtC2MgNb3mxS0N?|}t zojbmkaN19Bp>x&0%QJ9EZh@q*W())A^G3?cPjo~PMcAUe848;$+IhmC6AdZxu|d!(s{WM_-@DVmvxC)YKf z&3v+5hf-e|gueBnw^}AS#cn!>zbM(xcC2Sk9IRdtmwvtZL&&)Zn*Kia0wukg#_2{* zv8a6UiN)Hr5=8XCBNH_7a4*|tHB8>IF5&)0DR#v+i4KzLsKUs7a((xejySDhJJ6Kw zkxuA$9l8RC=~@{V`?NMu6OH%0dT7(b!F_HK)buB;eyid63;2XNfLO_rJ<$rB4!q(` z8(K2EkVlk7p5r!F6FM(S$R7JP$YtNeyvS{e>_pOSoLU?Ix4aRCv$SDedJI+peNAN8 z#A=8-mIZnXMjes<&6VyCp}xy%R`M$A8F zLtW_YA`o>p-wqhHzJyNTlj_8&ZIkxdz~agmVl$H`nBFuQyBHw$6#0AUTG(j?<)q4U zBgN|TQIDXy7oQBHj&yzbd%m}LZHF7t26y)A^Da}Cs3m?P7j5w)g`#t6i~T(U*Hb!3 zXl7%c0gXP@5cCZs)gK6?bb(<8q&tp43YXX($3;^UT;2t`B$dn{a-b1Q`6m%meLIr{ ziIFnm+aAp5%u1AS%QDv_5r|F4bibworHtR-g{Zm$pr9OQ5u{9w(l2j{f&cn`BgEcz z_bk!M2(Y8{?-#BS27o`mFg{}F4@3Zl`e^qhC-12*bdcuYRoE8Nz<5A@srmCQ0_#kCA5 zosD8Z+>YIlBoY_~w21gA9QEtS_(QiNt!3?@m*GT97;^%M4(IC{d)U^niJ6gWunFiz zXsogZuPOc!N|X%ZckpX-J+BhBWYALxjfw7*jLfe@eN)1MfYZ>lG_QKVz zS33(G0pvWHW4$4+!Ig~0yPkIj(Rg#s=uA+}v+%kkn58}}2kIT?*5t3BZ4xpMhQr(h zxW&1>8v@h%Nl9Iz2wqY-Ba!*T*O_wI$PAnWjd!Qjpgng$}YNlPt4%GL9R@Q#|P=Pjfo2pvt1;!wvim-iqJy1wbMO*c$jpj{32MmTCB7s{t?WrHg zd4tf8l9j95uKGLkXn-XIo?-9-uI%uijMY5u7g5f<1(()2tc;_B@?WaS?S^5bS?7d5 zfht&8UcKilPXNlhw@Dwz1p_6z1ZBioS-#aDyot*BLnb!%D`+0CaC@@x6A-oM{Kvmy zK4#mbO4JQEeh5yah?su=DQv%0i{N|-_;vxiq#a`2HsyGUxkZowVPRRLQL^WP7Aac1 zpZ?D+?D^Z_iPul2G10WNG{ARgy1{%W&Qd8L?h? zn*IkNysj3;dFi?v5|b}-eHGbz`~_6Y|Fs2LBx|U*GcF>57QN<|Ql9Qtwh59t5Uq0W zcKYd|r;09;^#SE5eL>skHOfg+NWoH$7r62EhFa>W2eoicKleZ#WfNq_oykD<+i1Pu zl=cNEaRubDCytgl95>coej}-0}iXG^~R?7uAeA=W`4U$hm zcl8=j=B3v*>feM=EzF2}VSK#9_2&*Pae?RI8qAPrz^a+I5@{Nhp3W8?g#tDdta zr00nm3FND6SuUQCBeU@x)sjyJMzswfQoel*)E-K`Gp`4E6&*F1WAi=|B=UXn{FVD2 zf6N^O^3J@NqFqgEnNu7fJ&(`9GAN_Ad~v&II=_uhp=NYmOZn@it*>{)Y#JgB*&i+! z(JN*Hqy>}14QILZM(O36WtUy-*2sX+v&DTvKk7msWx>xYh`dzLL4)tJVH3!gy|sr} zuJp7-aPEvBAa+F*g)wQY%>=zGwq-jcMr+QX8+t4uYR9gD6Y{AG`(wxrKfgw_P`k&Z ziKrpuC)WG1*u#;@#R^NhgJg%KDUch&+oe4eI6ka}EN;WjKIYrdDfXDI-h7Kk2ny|7 zz?M(u%l`tDu8rA31|zK5^!v|$=CgD(k#`bE+k~J~%x?cWJGX)$=U@+$lt?U33fM88 zo%kxGhU87PBq}bAL`HcGP8o0~mbJV^Tmvp|*+=@ju}Hq42Z_pi7L$XB66M$sK;BQg z{v8g7u#e`vm!3(h_Wy0sUYzQc(0 zGrgeEAjT3BbxibpOO==IR|7t3YrJ#CPSSk1A20eJT{Tkl(DY;t>qt}3&r6;8yaozB z8kw!gc=nR!6?;LX0vT#aPn_fk%hI`EesH7r&<+g5wT~~5E?c2L4?F18yI}ay@%^Td zS6GM0AFg~$l);04)3=EN;w8T{g#$9dv)jLkyN=#`yRdWoWN}S%`wz%N4=B3gskV_% zD3lpDDAbutAUmec_W#*|9<7ZZ$4b`QcBQ9uJH!uCh5n$GYA6BpC~9x`y~DFZV_jyE z$TWfi$u%WKrLZY|ZCpuuRd_MQhV24*7iApf<6=!A*(^!YyF*>;unZCMaoDdzi*RDVj^KvW*^6HY#hr0-!DliX37reQ^hWV>P zeTPa+jqeIq#&u%V7(`>+v8fc^@Zwu)m7V&DiL>qtnp+d~ zVq@^@=+4~Q#(_pw#`ZVmC7}uPl!0|@O|xx1^8iv#owvJpxCWKgpwLDI;z`#kT@1Ha zq#|d};%m}y8u);6%JKgBM_9MRR8YBQ*N3*LVF^1E#A{#6QlHcKl>oW45r6NSf6eVj(g^T{t>>&IB+5 zhdYHnD_3{q;R$S6Z@wrOA4cUav{;BTMbl4NX|+hrKH;7rel>o#pP*Wj(b6N$!$(IQ zg+P$7v5Bdy&cTYq?SC8iCxFND1au*`b6QHT4X6`sA&?<}=nb*YPxMcJ0h4quGTZvVmH1?$jb0jJ;_eLi z^E$El=TD@(j@Stm5YOo;9C+C5``WmN^zhY2QmSB5Es?CIM*0(q_G*s&yW-5d4ZG#V zb}z*6-H-u0q7CY@Elxw-ZsTj6U9-@L-$Di=p=fM`Z4W8;BuK&u$`-V(TA{NVi4EgK zbyq0s1xkz$Y8lbPRu+SIg0ReQZ*}(nzbv}{e#)T#$@D}2|6G7*t1SPcNuBo dP2#WrIJ45LmAISpld_dyuIEnH{SIC9i0hoDUeF6lQfaMx6JVapk5Y($A zq&p~LGs_(^+XLdk>9N_-|8yi88D0A@I(l+4GqtqTI=*#sMPByLpFajEC+B^3Rh6&a z($OZdS+8h6R*&3rb8)e}YpR*FNXJukE9vN6b$@VRz1}Y5I>0KoFw5t#;irDGI2$=?bJHiPY!{Zdh^pP7YgVJ@BO%#RqV=1l^g);d9aSm}2Xo+s=AQy2RH78pre-hw! z_0pipjO!4Opx_a8rRw7^ZLBUbLiPdNc@v9;R4Dhr0&zj*>B2F6Gm{0w40AW3Pk&0} z%UU6v9+Vpv=4_b3HEkF_c%Nf_f9maQa#)YvyFp!ZlNrQ%ZyLqMO{vtS0=*xA`#Z5st6G2x0tf1&v3nE$MWEd(0KF*-kq#P(~2tm)7nn%@{)A zG^h&yKYIPLNHWy3t(24*Uk03|ios-8ECoG|P*RtoNlG1(x4Y=HP+3?}{@ zZ=W`3_8@eIZD}Iz9j8}?8$V1VC@6`$atBPIFk+qi+p|W;4 zM2q}_->vcxY&Zgv4e!%%(()Q0&g7j}q>SE4d031c1Ip*_1rOCv-@()H333WrHdG*f zC87F>r}oHHPHjlFiPi)P*VRjSqxVA(TStOHwFgE#f0q`2LV+7 zW0lyG4Oggf+LOqo3FL*QF=>VjfCo8q)C71_^Zz0g#k%AILg!AA5={-6WYOa+{r{(1 ziEZ}s3R_Ss&cMFN z6{*%!EqnjH*}`ZGoz;K5#>Xw{9Lzk*bW@2p(76QB4G{!{&4Op5df0G%M7HoHPm)NF zY(MmlIL_Wx8efaMrxGxFhSioxVYkP7`3t<8(p##Un)^A@o5of5-$||4s*apS4~4Co zzUC4jsN;6>-DRrh!DgwBPoLZQ=Xig}+5hTh+?FdsV8ymMvt`0K{JO7X7JsAL#}0MT zUTEq^6Nqi99?w&Tu0uVhVBvnoIUba-W&ld`_Ge6!)|b+z~t z@WS}hyDI`P>Ln(ixph-%Q>c(nG{mjHac>5_zF>bNFDZr6eRFN>$5)5_29ZmM>9{bc5SJ#)|N*0J6m_638r7}YQD$j9lv4-XGdwZFeu$I+c- zrl5HSeYhn5%-7^#-I-k{l50*d8wwAF4)t{VCBMuXyrQKNjSxTkcjvIU1p$tSh%56W zi2E(9bhYqXEcZQNyUIKE-g}0tnkJX{w=9|l&}@@~r-FpO^qbQFz9%xQ@a_Xu=LJB} zu>;@8STUA4nN+Bw`Lyym%`a=VX7`jW2O zN={VRzBZ68pZeZzjv=?*EohPlgmMyC3XN5TH?o{}0_GgfuD3Je{z2go$jpG63iqUq zvSo@t3Jck&GMcyy1q@IJ9&f1bwZzZxe%GSj=$x;=rTS|0Lm#=p?BSKQ*QyU(=0>HH z->-1X?R@bWI{Od-rcaRI@RrjXcnL!o(0X$7qnS)3+XoLGK0$Of)4~2`i@~d|*Q$$) z>KyOs5B;B|K6xEJK4$a&A7$>Ssz}f5YFD$jj+|z>6Q>)T>QP<{qiN8TgmGrvmo=wX z?A3G{ufkrQyB2W{TPxoX@AUJpd-sHT3_Z#4-iwX*MVIJDURIlzKG9I(9C-whAWb4g zqpvyKU{Q!N_W+7-z4`_lhLW)2+0hh(^NZAZcjvDu+r~#t%xsOdku`*Da%XEd@j>;OZhpFcUq`s`UzWi=y8s|n0V}>&Imvo z06JemfR@GiHJ>3h*pJo05_Fs934E%yF5UD(f<!EO=g$YK#SX-Mp^LoITihRm2vM`u0o6P zfBZibhFR07b70|$7d&HQq}X11HE~4XiS!T0RrTvGwzAptx0)1F&=_F3 zLyg>BMy)?3xqDzqUmZR4Y17ur8X8#>B;v3HeP02UT>U&nLQMt*;!?Kg>ZO);q)`2J zqg|_$L~~ofb!CcSJf{f6cB?QcQL|{Z$3EV&1RsdGH?0^(F7(~xa+i7({4C|RGS(D< zw`bnHlHwyE7VX8C!>Tox&MhGVm}eWTd{nHsYJbz!IfY`!XSl-uDV8Cs;M39jK&+{d zL)-;A`iq;orgW{I47|K@<1fD^abUQw?nItvq5p;)2}N9{ADPiZ9nOLHl~M#1U%xPC z1j7-eoGtwvU`^Z4U|_tnlCOhiz4Y-92WK^idGI; zcLP}{p+w6p^;V6?>^#6B##O!+Tuw--&Z~^sri`%!rtEeBZp>4E4sD|>QK%NygG3a7 zD;@zFL;T4L=pP(ckS$W2A3t8)ptsT8b|#F!icLJm$QJy0@6xd1EL+r``hy2U_&MAP zLS8=$HpGj7PvWW~!{&a!7%uIQK4S4*ST#ruH<0 zUPby*px3{*f_?8wpO8zGvnf~L=c9&lKzPP2@`w4e>`0T~9(Tv>t8$C`RDoLxx9~H) zz;z920`LjBgp?t;8(6*wrcp6V^@Z@N3>A(c^eSaslN9WoMrfMgQ>{LPkg{)pyY_Zv zPO~yyev$AZFR&y$Nq{x|P?rsF2_$4;!Vb0{g)eopESDS22!>^gVtbvR2|6vYPP=kj<1#qD2!|? zHa}2vQnRKRVHwGz*ll!~R5(*-18h}X(|AN#!J=}pha@WfzLBO8?y{kL%X*UtgLCvL zAH>Dr6~sQU*g|+YJkhx`bDQ(}8#p2z^4jvbyJU#hLSw;ze{@J5Z_2s08Z2ChIOf0* zLIo{fBzmfhdM9PbfJSvjINp1(-ZuZ{sxAUjdVFfSd_Bn&2a%sIZC%g+_Pjvr5#&@4@GL}jI zF^yh##&8!wJ+Jt>mw3ULHbiRpEm^%ZBeSip??G;tG-bBatP;Q6!^_ljk5qEoB@9u{X{+uojR0n2!4Vf3N%$@v*okD!LFoQINOx}WrOJ=} zE0hG7ew_<~eX;OeO3=s~`mYC3BLqi1^I-!`!ma01lG3j;4?Ep_SeXHlfJ2_o2%;%K zFlEMxucru9Zk*fpY*4VO%Bs!~AUFuyhn?h3Y>UA^OjX?UXEnUJiPRiEK)ZJd69{}> zi?^JgAjvFnN9E`^-MVT;WLo!8W|&)%mT_RVee z*`e3pDe40WiL*N^g^2l9D+cpm7beM$G8+hRFLQ(I4C_j^psGhZbyD)580^G~kA5ZF zC~mcDKE?AU=tnRs&dJQthnX2?f&^c_9%grswK}q;e$OQech)+gRY~h0VxA(aIHcl5n7!Re8O|Gp)e#D+5+fFZH zd-WpwAjRJiN>C*0>1UMvSN)aoBSs$Ymrs6cLkp|%>CBjkK9EbzjREV+nCz@{+Py=w z!jefrq{$ojZfM8>%R3z;^Oxu|5wZDLX51JBQjKomI3`jas#Cl6rZ+Zi3PWhL(2P|K zUGSmIet1nX==kaXtB&x>NappsznG*HrH;;= zXE1n33MRjR{TDso;toT-=8W%iA!XlDDZi_w7@MzxmkjT@Gd12h^&dmhrt{mNRVVs10HM#0DZ{htx+V;ez8*#LpW%7 zf2`G53_r4aH&%8XS`RUX02vbL$B4#;T7QY`_deHZmcw(B`tyTR3^-uMN47aMV+c3n zuEvqQ6v`CB!Hwb7!b&UQx`Tu!V1jzimB?=Uns6n zAk%nS?GS5^Sg1tus&{@;aDb|WqB9f?C3$NjinNw(gT4i<6(eFV@6+A=(j`4tx*ck1 z4!DWaybqN1Af&Cbd+D`ogvKPURy$^~FHi~0~PrC2!holS>N zD5&K-Ep&)e&>A$Z&xpTh{&wj@Id%5iof&(Jm8uk|q+LUjbn*;XBUTd=-&yhJdMRiY z1RI6;kuN=NnmQ#XjasLwi6UiRubx|m|K6`w#AG{4zzGuK`^{75FjsB_;xqnB9FlN> z9r&tyr&#QHQ59v36DH=B5i_nv+J0BLm!*s>-SWsv5fD-&;F3G2+wYXkitlNk*qt{d zpXdb*s!tnwVoQvnG~z{tk7|#*=RIZ;-ws1dMl4Z6<19F7z2K(jx35JtSHT%Y2j0H% zP<}*&xFq88*^wCteBc6Q4nQa~*K4S#U!_QJj=WX};otD7NQM+)?#a;q zU#Z*&UKI^=4m(a?kIG=hFPKNaHGWv^kWKonJM1s-$Rm? zvBmdO!NBkgM8P)GWfYBb@HJ6q0VgXy4F6YMa3SEBzg=AF3qHF`1<}pCB9zZgwj9Mh z!tB4eC)<^yw9o_7YkB7d|H_fezPBAe_ucRMWc`l!`1eh|Puo@*k&M3{;A{VoA$M01 zn_SE|EPVf)(ZyTUB&1m!lgFlb+ac4DtmSeBi=A7{VW}g+T9^9kELH1MZuC+J5}-&H~A~mV)FFn z_Ju89FR^paN<@sxk^j1-{xn9;{=Q^T=cWHGHrmbRnM*&jnFpwhoh)bEaZA5E`Z$SQ z(?Gx_KXB*~XLidx{7u2~LU_C^;pC*O3ypTh+9dvH&l!Dd_Kl@;#(BhIx@L!$c)uk= z<@;)fsa8lD--^=8Oi&$d_wN1P#$m3ubFBp~w;td+UWKVW`t;Q5)f2id@z9K^0LD;QCyu?@ z)N5|6YE3^Nq>AURm}X8^^&NK?WBtix9=kL1S|}2lY!Ig2ktCjVop^I09B@XFTuH@A z$~xB7o)7z~*eu0Bg98wWt4)$P7fHWP?eP~u%Zj|J-|1(ca>G{y;SLa{LdIPT$7z9U zUDq{YwQdm2kZ>gac`qQh5O`oO_!J@`woxD>?1E4w4`xlRT{xKBk^`YeynDy|?cZ}; zr5}dd1V%~S)c!X71$jo*YZ<8T=6UA$pW0W}i?dB=>>|F}nL^C89SIiG2!Z9qfz45_?L z-<27992vJs7^tM!{lsed`wg7So!_O8iWjh~KyFx4Av}K+6u|&NkHbb*M|IN2)1?O0 zEEk8ys+oSgaba9RLfMv@V^@Ewbm)yT~yTT)Uz=i+R6Q5H!-+iMs#6tg%v>t%TREO!Ird$PlA>}7i9QJvv8Bp0HssSzyg+lN)-f0 zLqSXb{pxn=C2<&cS=9ReXr2nUo2aNg88^7{ih_)r8%+aWtKYIHMXcI|o`b>eJwe$s z%*31Y?)CPIzZ1dS)r2h{&k*C8GUODI|~K-y3*cTKDUhB7JuFr?e-hY%6K>;vsi5Gy_MGzFc`P( z@17T;e|gkcekH5wepcp6^+}+=+%*8Lcb#gBh`LJ;n0Fn|y&ex*)NSb z>YLem%^P^qJn0%#UOug})e^kVx7c}i>)8i}aRn)vmMxiv0VA8W8%f($$v&QW4MerU zqHhq0|L_l#J`67PweSxP2@Wn5ITQ^pLe&>!?ca3r(^0Y*whi{aRoi@JRA$6jDJ`q| zZdS;ZnX<*Kq5Dg0SzY&MZXN2`2RnNDhdkUn!ayW=CjF}zZc7F%i11octU4QY(oBma zgZchf%zy?@X#{0$Rbz``XkGPxW)&oR7HZm813Cf6DM>i6{>_*uI(j05KSu&V_=6p%fi$L=e`TkbAqj6H~n;Z%dgvcUd+=0av+)`Mlw(pJUndq&-kIl|D+rO4e?H^3~GIAl$=PW?7NY-GQ|1r1)K48I*vkiG=L+wQNH7pX!DS6Tlq2{P$$44B`C%fA&~Dw7Th3ZQwDsm4IbBfR0eY*} zEwbano*k)nAK8)k?&gByab3uU!jFO}35=|Uju|6L$O-!@ zh2)m^CByC;RA#H#r4Bv;AxV^+BZ04`NOS`|h5V?#UnenFgK2Q?b zBL{S-O_6=O^kKfx2Zj=RTFumA!~cXBLWA#OkWkzd4AKRo6-p;H2$RdXE2~9d{+?UN z6s=?977f10xI_$9qS`h0?W*ogfe)FT>4?;~&zV@oUm#>t5wU5*>b5eMrJBh#woV>+ zLhI3n(`HaliB)ys=P?_z|5g^lqeFFPWpLt;(rvC3?G}O`ju?YYt@-UIu8I_dBMQrA z)}KEv4bY$S|2?WtVc9Ynp3Q)C5Jd=7hyaI{`HDFd#)6yZk-(JKhT zSq~i+3*;s*p|QvFLcfXg?aW#H$)*h#jvn75)!oK{KU*f*x;*NELQ?Zd>;5uf=tuABqLA28+=1(k4n=u@E+e%+O%(4a;-k(ymk<_VE_I=_^-D80b!QWYk2$7gM!$s*W($3 zdM@ApT%#a3E6GXxeyi~6V&V@D>&_sd(U0{HLqpdNz!eUC=(&?1Y|VqJVCE;5E4^Df zb(5KNhRvwiPK|Go5Q)NByyS=9dZNnB?fXxkR?i5UIW(%MGg~}p_6!+29NQo9IIA`} z$sDdSk}N7>aQ>0Kh}(cmR!oV5IQ8b=fs-aJ-G$3VKs5#1Bt}(KIj9h7pkjX4|3+0I zCNcA@EInTG{+GfiMTcw+hn9)_{SU7*Ui**L9+ZTe+9fz_RNPA(tWjPJ^q#wbw`K5N zx$-UKadV?d{+A*%O=;7pTqUfrx0bo}@C~bhXUIEW#kCD+&o??QY6m_%-jEQ3D>=m4 zn8g%nMZPmeTKjr`oqlTQk*4GQc|!Y>7st)w61NwMdw@1ahemPzAYU4E|%Od zn;`5_VT7@)OhE7-MnW+yj56;^5zL~pfoD+)G&pO}>M91?4!bD4meJ>;!Hd&P)n0XI zdAjw2(%*BSb7g`Bh1J@(x&A@yu4I6hhG$|wzZtjlD{DsK=T-KQuUo2}@7qezFFgXS zQ?7^G=n@`Oe?y;Rw#~XLTjI|agz{_I0$}u5kA9Q=!njF$&CA;)Sm}q3u8#`3rx>_P zR7LD0-K<@WzrCmvb@2=|TeBU>thc6QwVDe!5w!H|7(*QnX2oEgX<1mZqRV97;)VUw zzUqb-wY@YNX;+;TbDnfPN-%;7-Z}p=ERA?|U9NQFdQRfCVS|xN;XVIqU$WnqnHRK_ zOLUzu*z{9_ZIXw`&F&V?*auut7346Nzm#^c`9(z|rc$c}VRW&0BfxFmPuFE`-)1(f zj!*a%`ewwVzQUT80py2%v#K(9$Z$Xh?j0@BOZ$$U*mx6?vY#?n(X6_aq9q->T2w5& zDA=ccWm3MaslA>$I}jd{(j=8X;I6eg`6QOsdxbsQHtFW-VnGe{X5G}IcOrpunK#uY z>{9aVQanb5R`s@XPD|N}W<)A#UO{3cF6hKe_-k#2R@=W~>A1(6j}^>N!q*fsdi*3N zVk=nItUW3M+=K&N+brQtl8UC67gYjmtl!9Q333@U&DvcO$+p$8tI>vS-_|3G)vJYH%+niRhjrd80k< zm_;x2-}X?Xnzj%e`zJzI_E4jg%D373&sS}KF-7`8o~XvZoUuO}ZRoczW)Ytm)ZECE zw7qxZ>ZEIWU2=9c1Mc1hMkCbQ9}@PO&u*KYXwe(qFM9l*&1l}+)$ndt+3|>aL+K5p z>43i78u4^qv7!a|#Ng6T+}_alW#8V9D~bPl$^Y{W(L6I}#CDN$*dS11&IGYi2$iH$s2=+9aSX z`fqK<$3O09J2|;Shm_tzBqAwfRa;J=D2raGqV`f@#&0Mlf2ie;Y5NxsVRZU0E^g&tLNe2@qTT84vQ?AX z=2?2yuwI->Ys6=bY#)7I(~4i8z9*`{7c;WNyC>~9eq!A^dXKVv(bJj!ccYOEb}JEA zh{j4pbyXXXKm(B;&aZ7>&CUO0k~uh&;=Xg-b>>#_Rne6DRWrMX?!4Fk^+~{YyAhY@ zh7I0yL}#MMth#-u66CJ;-6sP{S7D2T*n5Nc{qqWxn?D=MOlC=m`xb6EYi$Bu zX0F3a2bFQu2q2X8u*7<~aMoj^E)J?I05mH3?$5a+n(#q}YwRgrPGD_`4I(HIZwmC4 zTpH)3w8*BU`e^Y>GMZIzn!CkxF`_Z$iL_QaDt)Ea|dPk;b1Vj>YFItD>WdH(O-t>^()EPQ2JDTRF2!Qihq2{U+G+RqVO?r?qL?Z{5@; zU;k3f?b>d}?_U^&(uvO_W5exZt~&Sp=wzGXw7ly1H=2up*JWX3Pd~~m(y}|kH?#Lw zzqAD>A+Ly0f=M?Y_OL2{4xiE;2&+q#T)G`mZ0(mV~JOlmg@$;_5ct(LS=9>O87V_ z1!;CgAn}wuYSFw7h~s>WeG+fROR`rjnQ>B0kL=qO7NlpudP~R+WSzC=9mc39AouIW zbRlT(-Q+0MVReI48hg$?o`q)7`nr$8RHXggj={$Zc|)fiYEg<0~u*&rBkIP z)FVy;IPjtnzNz<~-SJ9;5q(RtSB_=+na9rUW#65iZbZDf-fwo7iUnU8xxnQ*7r~e< zW-GI^k5`^neC&N^2Sw*8LQPswF;Kq7^q9MYsf;&~gUd{gykl)=g75Xz$=S>QDqcv* zh+HAv%#9zhH-El@h1pzS|0BM>^+Rg3_>|KU^E2laYl%B9agMx?6Gwjx-@TX+iGdBv zsdv)u(=YqImzb>?_%-B`Jmq#fB(Oy0?QhC0%I%0TRG{uz z%Kj*3vdyC3^@sY~PvMdDs`j>CgEN_NwlCN;8Wedf%(?Uoq0K#IUk?1ieg=*EEfU}C zqkxNZmnkP1rEK?pM7~g4d%@p0_bNWt4)uGG)mbOE#{5+dH@>)KTngN-C>;;z_PVJ3 zbID)N8i-uIw$5=?Ul#d0x&NXy67%QDhATJ8;c_SIMge47X9zw2xGJ=|^pq`mJxvU) zD?y(jxts)KZqMi-uGU79jLKs-!z16N<7}2NPw=3PW__EU*OR2u!cTn$SO#bZ*5zhvzs_%26+0Mvbv7-8qY6tzjlsvtlG)ODujaq8~CASTqv59 zE4e0j_II}Ii?-Owy0cWtw(K7x$QER>-nN4WE^Uu&A*P*Cqn*M+e~*?V`Sa+nvWz#c z7*>Q#i-_yz-#QJ9-tB5Weu0I@*N?>_$_o;l?1s5XV!9Uey1Kqy&wU*J zT<>ofg~9uX0C=#$@AonjYx`4-<*Fbyfz~_m>pxoc;y6DZhNBTMJz9>1oo6+4qibkD z=#?RxD84#%9(4R@`28Jq*}YboK0SSf7U^~dlb5ZsUjb__%=o~*YWV6&OXd4JtXu5ypm3dmQlN}PQdG z=~Y3bo!8fR(y1-$|Kg4~>|80go-4Wde8}M2=YI(pLi-idpD#YfPhO4a6ABxp%}YQ2 z2U+5WJRR@-;)!aZRf>3{KR3)C8A4;1bJaMHMw>%`E2HU2euAw}$dc#ZaN6j&D}X&Y zR7}=U-4$g!y%ixiE903q*}5e2Aj!oC zLBGYgUtGkT^=-_)Oj??MElDMs6>pgONo(MdvC4qkaBIC3ytAc%$+q263*GvGcR_k) zrdXhLK`Tk-3?Nf}6o&e7yRqq~IDt~`cf}wpP6jRdOZ{xIPYAt3BD4G->*pkGjrmC^ zVO_iIqKjwzY_eRaw`UuyE1D!kzCJOpuSFP2#4tIK<@{2o3sF$wb>-FKkMx^U&5w_61;`qS0-qgJI?Vi9PQ&gN57EVa`Wq(nFdXV#MPP9Ns z;`kkGPl6%Sx+l=pKYF}Evk|kdlOP6@f4m?ik&@j6_9jJ1zWpq6&fm^@YjHLs=S1mk z<|_X*WnZ4AfF0ln<|8fru8S-zDx$!EvJOrYyD19q_+P4L`xJB~o7I|o91z!X5%bN= z>y*R=%ouRbe1Z3VeY|;YHvePRNVpC&g7NJUQdf7Ne>cREx$foyg{GH?9hay0nbcI} zKgN&Ripd1shh7SuE%~~#;s8*K?}*f}zs2CcuUj^R)FnUCLe?nC-!>uFQb|jB9YnYM zjz~+^3oStcT0zq3&7uU1rL7w5_TCu0FX6xb&ps2CE-P#AgDBHk)qLFI0*^hjzXxYq zunKdqBJ5BI%|_2$!N>^xd+2`e+i6`6uCB`tlUrJ7nsihTlj4w&4Nwy~qpkkQ+c_vum|0SG~i*iFZN>$wAVgJcho%EKM`7;eUm3qMP_rusod+*R`XEr#=1o*2UU z-L~!Tm0QfXP#j4|!m2%VW~`(gpzZp8xSk&|Z=M&EYuUhCJ^R&MD~2pAXU3!M1AAti z>vpRG>7VDVu4K1&cEl@I%6cYX8<}D~mjxDl-w-g9UTB=gn0xwd>_C>dtw&GX!db*N z!kPx?<7?=DW&OUHItVBV&igc-Q$T+$IX|b1{Nz-ieDXNCEYRH?IighD)6$E?L$tjN z%|bg)gHp&(V;UBu{okf5pQp^NX7G@7M3w%#FC~-v``sO6_dq6J9?4gONmgRw_Mptx zKMM>9F{B**!$Uf4e;UoJGTcKILMh`e;OAei^ahHD?5a<)*$vLfk%vpZI1wB_zMAnA zGRVh?iErJ{hP-ZKmKU}0&yvE1Nj9dEzbg*j6Bk}J&$f%Y1ueZp>yB+UjeoCb{tWi{ zd|7%~JiVDc9&|lgk$t6dJL3~X81#;ueJPL4@;^(KRv5{&W5H&7ahD%HUX_49Yj^)9 z@8<*k9uYaFSqvUdeE8Heka-W5x`*Zl^2ZV@4vGY4x08?*l~uEek;|7Tkh)`tEvB$)li za|i9NBx!oN)wTyXenhkPn0IeDck7$l!>^{qw{} zN>&K3eUL(h+(m=s1vyKVHD2}%B=_H^(66B;rdt~+l4!W8ot|9E|FWF^AmH={5qjjD zcD=d(d|B`Z!i0nU6ksVp`>~8$L*^1QzGFm5-eUCI>*BeHTAFoZX1q%FgO)5PCR04k znrwH18Se{Ox>?qm5+RDiTazg7%b^fn1Kl5#0F}(0#E~XZoPB$jRQC)kZYu*rAbRGn zjp{rg{3Z*9s>2uPplmJ#e$(NuVb+^Q`Z>Wsg?HDEdL`gnv_*y`C=n8ka!L4zW*zlV z6oLC;MhMGK-W}8=t8==`kK_lq)Ch$Eu&4nX%FZZX#|jCgxZ617N!YbLl7QO_JBWKq zYSI7I$YV&DNq$7O2-0L?#m@`d%02P-vNf&Lo_**5^dq34YslThM6~-Wh#s<(XmT}p z-HL%MnW>iJA%hs`_IPa7@{RV_oA*<^!GaVVjIQ8xs^eJr`S?Csm)ZT1B)oWr72nr` zn8#!%&^}q57ocRpp{$eM4t~CGh5x7w3*W3(|(=HNZVG9NrlXSCy zLwTg^Td%Menl#w=j(I{@n7AWT3JnXc;nx?K3Z z8@(<#6Ax)xv*V}Ui(rn{dB0VdZep>Kosq9wg9dBfP^vs`7#d_CLY?aV;%U zHqrwG)`&<_Wh=FVUiMWWVJlM!Ei2rPVJSJVz`^tr{x1 zVU|cz^LjDvP7qBj*-k;Pz! zz5Q6v8Y(TLCZp@UZ4k6#zo-XhHZhi6x?l6V(YkhETqQ5IwLBDWc)Rv37NIj$Y-y5zsgynf3u)MR?+Elu$fNLQeiVMKp$0j*$ZwJs zJzwd>B%{2RXmcZa`^#<=Oy>+dmRQYa!rooJB-;ykW7*)J@f?@j`RwioG}gl}nX|`- z`iYCG;?d+iIo!rBUlS~_e2WB{ozYcu=dCT>3W)c33Nu754#IhsnS7!XF zR3FL#o7fWVqzj6)YxAU6dz-|NF$60ATn05kJKlM6^>IvY=eC{(lMe@@51o6f%5>Fg_H09gD#%Hvs2=P)Wjhw*O1+mXsQ2`OHH#|sO z2>IBM&rYfZMf^XI^`%tdGkCBWlbIAqljNpEPrB}xQQ*Lpmtj@bNmS%^^*(=Ou_^vT z{Gen99a}6pAGH|Jj52qs`ePz^SWEqKwDhB1GnVd6dRCLvKU?%Vf*9l#X?QCa(OlT` z%*O7K#$?-)wOBe(V(c3s)==HYGP6mhgP3KfPO`dkL;hFm=GahB`qzLRuP+T(&;B8^ zft`U6^X7FqscX*z3~ntt2X=&)K1-_iUfr^di0yduw#1F=`ES=ywo`Ys z>smcre<%JAr(X&s!SI+HTwX&pWq47x%jVJ7#SMGbnyU1$J`hE<6$XDS_=$+Y_r3eo zoiJ5*&Agv=BUHrB?w_Rqsh@(nW6TUo{$(XcucQD`q>0Bm)wJVK&OR}Mv*AMf>4Bb!kShE-(gh%g+c><9LO;D+5oN>8@8y#-RA*CA zUK2fcs8>n-vb+()jVY?v*=`s*e|&quk)E`IDywU>v4$Vvot)LXfUwg$ne3;zm?*92 zg#7e~azD+HV;=NVm~kq8a7BK4&)CgUvGTdikt*EFiS4gu^*MB=xL44k;Y^$TLLi1a z&LlPY6lFR4{}ik7tf_YS zGq0%9le6YWsej9!AYAnl4Gx}`-#?G(>lN_dE_)`xmF0e9o*VzWmUULa6IwIh(<%?{ z&LNrpzM7xhf6LLgy;Lmu+NFWUoUc`rTszX8C?TF_>(5)6A1v+xB?%_?vzq;1u9K!mtJV5#-gx;RAWeGfP~>e2q$|)du_+A; z_a{b}7g(+{R%Et?t$UaIL2g1*vj=aOyhM`w`KVdPI9}5h`C{D08A0>yt}cX}cqp5k zbi1Cq@?i+`?hv;XBL$6vSG?o=e_WFTI_=C??}{D`%Rc4rXJdTk-1*IfPQ~j0@%O@m z;&a6{4OX=FicEjZBe|=2hQ~Z#;`aIKFa9u+!st@=K7DzaNu;?{`iJEN$Kh-?Qdo#{ zOnt2o_E&D+e*9%VDmfOil&kD6#*fQktw9H}EZzf|8faoBL`5%)t7?Osd2G!{BK-!8 zJs&MNj|n9KZWihoW{Vi)?vHxdcl_hckNFshq+zLoVM#Y#oac+lU+Ec^M|Q5Hp?B_< ztP3TTCwpjHVUbeU9>`vE% ziO#Ob*?X_et16O=6i4lT+ao9K-=YI3uDIFyC_eh~AYqJmLr@hZ8fnaqFAloKh8In& zA0C|Q^1gRr_z~B6g~Au(u--%sx9+Vk7e4=vg}BoVjB=V8q&4S=cyz>J`e4qwUZZu7 z4q4dpm##2YmzJacf_%T+9BE51Io}od9(EgXoGV9{eIE0k?YsUo60TA%dW2&0G}+q! z{QU`wmCVGW$*!2IVIL(rb0R%{S6RBHe|nB)d*3;Z9n<@7(YjcTO32BDQF&TpF5}_r|x-MNy|a zuKR`oCl*GnP15V>i*gBy&X9aXKjFTScF*q$72)srz`4f_f(=cs8q%CRG`-(}s*m?C z{7sG(hbJ8qW&`AxTz_1x*myX^m3*VyrCaUp^`_&f>aMHe{0T<(&Aw4HzTvhe4YQAL z<6Yk3BbUGN?lsYUNq?XCSjT%nwrJ&lXFkX*B9R zd#7f}R*K^k-F05`fqDf*`_^dWAA3uExn=%;djTvo+i0DxU66P~?qe;%!$rqqVpX{~ zaFHq7pf+LR#Omdrqy#=T#;1}lZ|D{?sB0h_raHCyeG(SjQlRi&j4R#0ZFS-c)~!oF zJwC2K{o{g>Tvygrq{x=(If2m@|Jn1sld6Oe-x-UuqawDR{ywwihm3Z3J6jnAkwTff^_FS ze7^VlyZ65C`2!Bi%ro!j{XA#RoU=3U@mJ}1b9ekbQ`*Xw;UE9&l^;DD>QY>_yZAVY zkAHn&;1o|5Qs%8TEWI-~Pqy|btEReyHt^2$s;7JPFll_4S$gHC{`hsW^qW_cvObcj zgw)|UB57HdNl!k;m|wp37jg4Z$vI7_>%WBe)353$e(OG^Y0fD&prT8{+{iL ztf&7SU+#%=Cz-nB6}(kd62G$1c49(+MP%d+~a4 z)NG;a>Hj>~ut3-vU;n_=%snBqI!0^@JLnRakIOqUDcutB7>E-2!B*aNbIwnGvIcSB zXVLBm-}O};kq5@l*6}bD>N+s{&8>$!X}X*Yps{P(z{yXDb#Zc8LF-2PsgXrH3eMe7 zMyyPn}lg2qn6cu@(K`yi~j zv9U31QyFQCIM6u#ftT>qs*FSZB>ZgeaPcsH@n8P$Jwu~jln0_ST~xGsO73iT)WVg0+WbM?c0oBoLct!8y$o5>qSrB8KM{EKCYHsZAMv=Z08DVd}6Aud!1cR&a+IOz#wPj^YEsFFz9d<$w0lBF?R)!~GCk$6k;ZYW_ z!3*+9`E41qF=)auS~^fMyP4PThXr$n6ZOhA+c z7P~+MOBN_&5+?BUVf70&cp*Q6kVtd|R(NP+r|Uz&Q!o>gcl8QO0Yd!3)CiK057Y2B zoS5^0Ff3Y7EeeZgJSo)%|KQ576HhI$2^vMg#Eb=!&<;B+$DrwPn*)}{_yq?8_Jpg% zvB?69{s-#-NJ5Vs_%Otr`r@z|ZNT-y@w8P73(w$`z3~{)IgIKz!rCHS5QG&Mj>3Ku z=O742bzn&b*k%!cRWJ(bOpQSW0p-B$VFDE82qg^m8y@8=iwmIvVFNgvFd?5mu5V~@ z!U)MPYQ7PG!Q#`PY0yta;YL@XM-L1q+0nMGc>Te^hlEiZF4HL_v7f7nqwztpBaJf5e--Yd0feYrBot&yHpm{67{iUDRVo>tERLL==D-dI??=pp1tY zvJ$?~SV-uroC*dJItG74Y+)BXZFp$79`Mm1bS9zm!@ht`9TeiwPY2d-V|4qAus;H;^_z!92D-X-STxcNT` z!~6N;LwX5)ci6cBwF?lb@YR3K<3d@0UgG}^@_%inzx~R7!SeqD5+;^94VIihPr|U^ zDXlLY;iVrDZ(tLZe*ed!$VKq>KqTDGHGdjdM4|@6Rft#;w9Q$&WAI;WZVv}jaKaR1 zpq|6@{OJ?5%^AK32b@N^2y_1iKpywOtXZdj56@c=W~2K4&RJg>?WcbqR)RtB4I=}H z?HMsD0e@|UG+!<(FXx|Qr~=t!7T8mXA$FNIgoPvvqL5zpH3m)M;#qh?G!Fgp& zQ~X=RoxQvm;u?%=7cSFJ`I9PGJz~dBVF@Y6;$v(Pno&IH4(NKiSYOK2DkUGADCRBV z3N_sx80fD*>&#?x`5C|6UY*syOk~R?l*3|RhtRxEuKVGO7yYNX>3MyMNl}amGDNOP z68T6BzIHWvD#8M!L^BBxCAIQ4qraqyGDR^>GiYP>goi3pX+JsK-P?Fdh1)AcieO4Qr$ zoRj>zV-TJjK`gJ7W*Sa2Ibj79eI6Q}SvelPJwLs<=Q}K}hAP*LQ8#|{-ObS0Kyt|1 zg?HpQ-^ez9*lStI6JmWzY%41Cbt~^~yn)Zh`u=`h>}F^n`KspaQoojbQ4G=mYGkB) zZT>dWg>=uEf`r7TIi%^(EcMai{Q93>@+!LyIe!Kd6sg< zq#Gz`Y->!@aULQ*ph|vWCBmzI+u_Bk!%m3OUsr-1jqA9}b|?Kz zXW^mWo;s>rP-LwMFTv^eZtJFq(rLzHXVv>+R`nipQrclnz2Vf!XN?){KGjA)vwOe( z)%^PK_xozMBQq>`I3+LP_> z6eDHhG?loO&!u_>70nF&a%1nipKNg}{di887y0yVs06Fot>a^`szJAG@*!Rgm0)d5 z`8yPMx=A{c>QkiI?uh$%KpRnVj=Qjq1;b(-{{h&YOGmt zA+RNdO=d>et~?Rkrt}mN_LhkT#@ut#G1c@>KE@paDE8+fJ}=QH=ViLuLUZ`b`bleA z?d~t)+O)9${z=*0ud;$*O2r@#8F*o@?pp)f|7iiJsE^-x0nc*G5d1L@o4j8i|;Lzv4`0|515S z-|27R;Qzzq21!!Z1vU|Ahh73;;Ds?53MbYJB2q7y5&t4;3!f*NEMHVLy`ysh6h1b% z>Zg?9|9oU5fc=nu5^)hTVGICik~D<>i;;!sqPhQ^`md6T+6onHxiJ8?jE2`BVF{!! z5PI_dSC2sgE^K*$MO#keg1@93qKj&{`|WpF0C0H!k@@0NGsMybr2o6&JQy&ic+MKBhC(WNIJ1TN?vC2V?z`;YAFa^JW= z8Cbxf%E>H}(n0+;iTVaWCtAA-lNf#8UdXIW2q#B`k4Q|AOYGZ>=O`pdNO9Vdh4Dwb zmo1(b5ahvER7mBB-rz3()iVOHQP&k#^kK7hVt28pEc-}z1%QymRL_$qxkbs^;!UWN zOV3R%ljX5e)(*-(A$dH_X*E;$;ek)S9?36nbLPb#Me;2>X=k^pFl;H`ygP{(+GRK= zO#Fkzj`e3Ad{nDQWJ|7`ty@jd;Hnb~Hs{uK zl`?g@c>&zbGBZ@7nY&G0lL0U3n7+W(28SX9k!}Iw-4qZKj1# z;)EBwb^~f&5DyqsJk!DG?Z;JzGum!vf@rq`Q%t)miFXJeR__>!s=97-^VEm+)u*AJ zTY@iL7TiGe_UPJ$IlRdLb^~H26@9#1QXLUD+OqA7Wfa!_ zOUcSiiR{juio-vqQ?w2{2d~^Njf2?gd9#wo4rBhDj5ZF5*>oIM1$_R#xst9kofp^Dz(8A9d?|t-E65rzHOVo12*%OA2VcgZWoj$v|a^H&W_RX*%w0 zkhymSdmxXUQNh}WdY&(DnA{Eac?LuayukCSdb(YF@2c9#h50a0&E&k0Os~eew9*2K2I@o373h}RrpS{t`LK_xp z@+SAq1o4Md@sapD5mt+&NrN{`kJ=@s$)XxcB~?Ru###4nFmc}3bJ;=SP%{#$c6c>c z#5o#MzG-KHMls~-jo*Rhc{Yt{mBX;qP9M_2|J$0K*xo+#!~2-fJ1H5s65Zd&TCnzx z(RVO+cb46^KcC3-RGm6 zKD_ksxpS*h1DE_*W1YV*QsUTZApY`k!wb9w(N>2yf~@zZY!ZP}pE-JUe=rSwu!>jy z3RJ%J{}d=qja~imoq5q=NmdgacF)W;ZZ`GJ5fIrfG&uZ2_nmpp&P&SfQlm{j$H{tC z7vBU>KpIYhqQ&0k7arVU$NN91d2+h=;>i)pKSoUc3kzFkQ{Q*FL??vZv4mGMfvMs* zoXfT~bD85}7_VFo%k;7=a|BtQ54b(ZjK9!J`nt7+M`3m5tK|6G8q7;@M*Iy*1Xob# znm>Nek)5W9CFj{De-krMrTWSpZ%?XNaoiG8LmaTEA+O#7ml5@3)aWz+=0Efs={_il zeXD^IC4UlwvyKI?7`%iRG&k60C#li*0JeDO8)2l4Po9(Az=W5N6Sc+T6a)!!7*=DDn+!|#mCm~vgM6KUN?XdDOOO+?*Nz<`+zp#eT!1`v z2%Q1H7s3H}KN^+5>sR}#!GUEY9Q_Vm+;USXVX1(NlflRoG>#A!f&};ekmlH{vD-`d zK%HE`h3rMnAJhttlyj(yYz!;^ji?4gg#oE#nqO{l>QjUQt0)zWny(>1gGg3FvS+|>DHp0;b9CqZjjCqRS@+spOxp2J|7GdJH!hwzP&gk*c$1g>vAqr zJw$_?d$oVO3oOd{Rd?yW`{}w++_TL|li=#RZZ)OJ!q_4Ihq`kP#Tf;oe)|7GErh`U zJOxTjKQDMD8%KoZd!$L;PhO4r^SB@qJi>=MIptBIfC}>tU`GGrS_|A|^8Al$_U|+z zAWnh>ANuDl z=FJzPAVeq7Vh(5v7%=8fjQR-@H2XNw7VtQWIhTS{h8X5q5dH(wB!->s{9@z{yH-J3 zlPpAs{eHt2ACh26h$7}3qRupc9=KnVN6Pz=;AHt(Uv}BcV!$JRJg!~74!AHH07`qU z3Mac|v2(Riz zS|hH4N?r)g5ZDPy%&d8lG2rL;&V=VebmPV!6r47qREYixqCcd#q5D$o&X4v)eCA-_ z$pV{6GkaolNzw!QTO9^tw zz6eqf*0o1&sQN*jaNhjulw@(?yIoO+=jR)hf@X!^))AsJE?-<|6No2#kme^JZ6L*^ z=8N&)peB_0dh24Xd57V9#8cp)g>XXp!k@wm!Yhmmfv(CcX~KSbAxu9h9U68GF@?yI z|Ks-k)gzvsCszR;=O-@t&8M=uSK)^!Fem@M4=I7KRO$#nT(Lrk3#9OY6>O9as=Dr; zoS(6Uz?k9@Q4lJ~@@RLqp*Vjl!(757kDukQQUVDbWl~Rq*E&#%a_|^!?ABuRD0T%v6dVU#t2qY_vK1jz9X9vW8pIleqr(YFZmZR80tG_9fq%Qu%A6L+ur>VfBZFBdf87^QPyT%t|7d2rBKP2 zuA#|}La1+6s$|TwPi|4dG~B9grQkk?TX z*)um;P6GwcV}jeJC7Czuru`le-a@@xrwZ>VAEjvO>nhKJ&v_`c#wU)f7gYjcPgugM z6D-oz2C7L{7l zq4uuzqksR%@3PNn=5k*QwR?@?H*+m2?|Ub4w6^+uiNPA?FWx7rI4%XpY!A&**iiX+ z&8n&FS~`-K9M3$Q9E`56%?C_B8W+6n<-rv6JgK*VaAMd#xv^edQw} z<9LDjlusXTRSil$^6FhH!ys6lGT+mmMk7K@PUDTNibnhmk)(HxaQem-f=@~yjl$8l zQ);xf1k$%n67;>eQ?BBhJ74v+AzIKEjrVwH3D-C2IZ1Ze=dgl6yM z@s_)n(aTGiv)77*<~z-OQn3xDX2?(03|jKXEq{F5n)UO-Op zEG1pd{3`A0c~>U#)9F-QwnbFKF#YiUaC{p{yOYk_oVd&fG6y_cqR%2VP%bCAM~Q*M z11EYLd{5~zzx(>vo^LL6O-~b-R}}~99ACD`NWU^X^ZQhpxLxSb_R)P5Ym8yFQ#l{q zlfCd)iPD1g%HgW?K9^(Ghu5#%A|(KqhrtUvT^>U*P~1z$OVWOy8dWm)jYSPOS%PF0 zd;tcw$hmwn+~l?mWn@WPoAvbSHrXk^QoM<_{N4TKh(z+%Gf@<}{Sp>p7a}wy z#>}khh|sbb9@`nSe6*J*IJoNJ9~N#Ok5s(VTCdgg-aJ#4r*y^f-mCYCc-my->g&~! zoAV)E#qM2Uakez#5VI<68cbl{4Z%vwGebr9*0AB*cZX{)mmFXIM$+oYnfRFIw+Vy4 z5?8de9BQ^u-lRM&RWIkz(c@x6VC@lTDLP7tS z=Dce^w4`ci0Pl#wQ(Rn3WnJdc?!3JvLm@5A?-jE7rkJ~%Ew8!^@eKP?OSg89*8k4T zxSbGhY^=o|P~-yeKYIj7nh-K5(?g@sT4em5;FZREe8}mgpH^#~L(Rjt=M+sx>Kg9l z4A{$^pTst#_cgaI#>U3pLiLS>Nplkkcd@!7Y8!mM=&P7K@x8ASHoRZ}hy~CDKWJNA zgwmbE2PZAV3bp4wPm=G3mN}ysnXDsLFlBY(RBVX!7G9^b(M^Z_6Pw^;dnO#&7^USvo4IhJv5IOD$=A8SFGx@FuX4HtQ zvfR88Vf6w`jIDk*o?7yvZw|hJYL-duQonq^=7-4q*5AS2(gty#;v7?trg9t9Qktl5 z3DS3(<|+C1x{j^DfmY&K*a_Eu%lo-Ml@`#_2wQ?x9+)`c2Ex&kFYrEQ>>j`1c0Tn- zr8cuX1C3)tk5A%A=Y2@bTe+|;&1{50!DRh)&nx@xh2&?{P5u-AuvPb(sHwpi)_`u7 zy{j_+nL_6zyQ$dy1*_RxId8e;d8a2#o!49Mnk(2+tVTVelw}u{j`)6lu2UmAZkQzE zr}QsAkxikh;kEzxWNh568~M6P)R1L9@!ZNRg6Ht5J9?lZL2h%LJFiOBJ*CV1d@y=; zEm{FZnd#hqg;c-mI`5vyQ>O;4mXJ%bfm#b(x#vE3lt@>)tPk#maUijpGyvVzNVkZ* ziZFL(6yB3720{9_9W{k7QNXf2E!p(3g0H({22`*s)K~?c!+@ig1rx*_`(^PDS(Ka~ z{%~kIz2_kI?bczvp4ZmRh0&{t^<;#&iJ_^KmhVBw>GUY(?aJ<30|YUen5XQjddZ;g zj?a{lF_`2s_u~6vr$MIg>fmZThnFNwoD(Y;&WEU7k-}Yaiq0QwX)!v;tvT~6T3%yo z9`i#41dYuo@K{a+W`Z}E$)MdQOPO&icpHP3h=3`0#R4RQmK^YT38<9M6i(OI?4I#% zAnzgMttCz6A9;TtDB3DQ9GnEyJU7oE#3|BX2dV$_Wg^^N0Q19h&3aQIIAlr^vK+ZR zIk(EF@{beBsC#~3uScAt2NbK=pY*XZ8;AwU`4Zzkenz+=3Q)nZU{C)gNhr5?N+U}J z?S?EhE|eQnOoc^hPzz&%fBxr&HgyhK{Wgn zgk=?iS9I!#-UE2DNViAgNjg#Dbt-fL=!=otp~D6cGh&9d`z$oO|CT;vxv7v>4E}22B`jvSbQIswx*Z*)uyNBm&OkA2 zYRK?={h!g#fmTCO4=g;bQ^<7u9}(gj9r6B%=A~Ev>`nziXhG$iCC|BQ4bn>z`a38A zLo3YJQlNf6>I0R2PlsS-`c+Pp_qRKC1nk%vTI_b+hQ@D=r&w>fd$mm09U1>^F+;RT zUyLY)>>Lb@KurQz&mPd=ToJ~|#m~)}p!AI#Z_hOh!zP**S2x!~g)s}47+L}s_q`mi z=FEM6Ydm9_6q-%>fWRu{`gwwgm&KQAJ2P6xpDnj&)dho{^^YH`&CR^ITl)=fV_ONe z!S9&U_#XI+L-Ho-s&5sRjto-Np@_Fs!k_GWw{o4mqvObf7RrJEv6uqHaO>4}{V3^y z9i(?Kc}9mN*AF^LNP%?=Zzo=hl^SvEeBuA?FT0RsQoFv#TQO*vI(duB_>Z2rh_S%% zTlC_HEVZp6FcU`9rK>6`Wrk%Kv0&$G@~;!)g2b>5i&I(c zwRp9zuIF98qE`E^l!N*_Lm4?-Oe-2Jnwam%T2tbKPi?CbzmNxFe2S+HZ#c-@XUrkX ze+t19bp#t9x100AgVm?nX9kS#J5;OZxaH4QLv8bs4X-;9r4PW5jsuED239M7L`*sJq2AL8+ z#P=tCC#4GXBZX8~wzn)VKPHzGkGcgb{?c$-i;R zp0Tx_g;uLpDEc$gRc(qYR9%H#U}e#Koy_P&=x2?$WM za{U4_-sf@!fZNRsxo7^xft{a-)&^>{5>bgH=zpG78D3SyLCVHQttqf6RL-4*@!n(Y zGXj}tONgj^nL7!;llKP5e(Aa6olT2H?m&&9{sCj#rrvM*Qu=?>VLxY8bu|Kpo!*Q8o3<@&K4=g z6eF~`Fj05-m44&|OFv0)-IuzflS9G@^}Hm)n&iu|$I-R3M_SWu{7Y-PE`Uj%Je2nx znkG>%^}vf3eYj80QAeU9@=osCOD!Q(NKFZm1Qk|C2_x4>ew}WkZ6NmFq+gI53;JeO zTLq#P)>|8IBIu{a4j7qEcvy2%#W%>!9RG@9(L6T69^5MA{8LQ0;7-qrvGHGrjFDMF z&$<77uzI}1&NI1*Jr$C%XW)8C*?1#}j8Is^%k0XUFecl}3~13{U5Ra#1wy-C<5q~@*W0JaBWb1`F#lLixg!x2zzrK>@PqthwWHAyF4eJ z&J9o~zPclR1OAGM3X5pXJ^t(vVE2{ji&R2(7QqIWAZD@e=o!1OnfKHOlA?Y$n&}^Q zgWKR5*2xx%JmCAWe0Z~2nIE;0N{q{AVNx3-2^du>Cl|uFQ(+hL-eEd|gT@$$S{4JcwTpl7)e7%^*9CpWcr!|vz?$?92~VfFO1`(i*K3C3som)lgbT`bme)ho^&r}jF;0dSyZD$E z8=WVB=~9`KC~!cg?-S-+^Sc^nAE`cn88MPASrgsgQ_dfO2Wb<-H=bD&Y*5Mr?ZE@v z&~{`hEmjz>d~NaMr@)wp7?=FU&awhg-M-t5Mc zquBK^zN9O%EM|=C`|yi)2|QYO45LaSi0N2D%2Q(bXpOc~5dxM05hahz=c}42p&>~J zry+QZB!GDa26n->BFyf3WvM!x$OhMH{R(ex0bPDf^|Z#Xe?^HEXEqC}>Y5PV2NBnO z{NZxf6=PKSG37D;dyJqk#uV4v!P9XiB!HL`7xkemdvv`HNj$;N_XgoloD=o_P~zJw zf`m$hyk_HvG=c5%S2kv#A+~1`%3XQ9T)~$ac zmQ=|=tkobqBVHkM8V&I7(xElj1a1WZihcrbb7SkmuP=hYvHuLc(Dhblm0UvJxSn_5 z!>j~5wnX;4DVOJu?7%ebR2nVT6|aBK*K-E1-xzY2FS9`LHU2t&B!n}d>SQOxeUz1O zI2X_VhgxmRmiqfK-V~xp|3rQp?ZZxkO+}cGc}6~pe@U=$h7`txxcpVg1YgNtO*a2T z8so^-yaX}x?1XT{UlT|eqdt0>H4MvaEeDD>+fa3Cuw$DTBFvo`;t5uSiEUe~<#O+A zy$qo-12^swP?Ul-FL7MZb2hqx!x>`Eqoi9TwCz6@zr!zqsg~K#-wD}1&$^p1$6Xy) zORzDq`*gW6i(JU42t)TJQ&mIqk{~=<2(W^*@7dAgzFL?->+sk1il09}*X|(1bs|Sv zs)U$?jf0K3Wr81u|B8?%mP06p5eH1Oqmi_~3w3l&K=k>_LgX8u|5lx|RP_Bc;hPVL zfSd3A?SV+siktYtSI*DFG3fvI#{^NMCx@xt; z31_#Z&BBh*M}Y`hZ%t@bmigzWh^>la5M+Yw`n7#bpl_`aRSce|$G>6$eZ!YdI!BEoc5FMC_r(Hyt0+%g1FaQ{$5 z{;=xN@Pkm}rmAn*dAQ3jKItTNjWsj>{q881_=VHAF+F>5{VPtVBv?tCfKk|JFwusa@t?m~xbHBFi z-e_9K+uFMFX5NOM63g(cHmWfKI(xNSM)3!-+@&0Sx^lXka=XA074Tl8)kIdgr7Juh zER?M~xoRs$s1fEA)#oK!L1k@+wtT{UbrL(_{m8sf@Paev?^#?Dt|bqgWjDEx`_bKa z`!{-cHTn=!qNX%bQt_kpCE9bHb8O)GrIYh%nGs7%{MYD68VUd6eJ#QoUb-rC6L%9~ z4z307_X;VK@AqVlA&wse-mC%>p$d7u`suLmIvlMR(p$-8Gt8iP1Zs2K7r(qFVR;ODIVED!5u-On5+GBE{p5bkbK~@(+}zfp zJ2<2ia7sxPTgOB2(7af`quT>Ki9r(AMxx-JQI`Zt^vz&Oc~IU5;u4K59;mZ*pt7|tc-w!TKJB${zO3f8U*7*o zaXp*XOGEv7SB*m>HhcjR_})fz8&Y}pn^GJFOz6;GrP!CLbx~D0 z{a8OIxt||Jn{?${yVCD^4m&PxLMOA{moc^Ko^!_X{x2ZeSh1>)}s(sWy@TrfkVb`WmgEoYl8cR9bybAmPzFtMtwjNxvLIN&y$!m+h<)^w(JV^s9@Z z2{~i{ziC^mzTg@vZ7G|9mhz!afq5RHVke}&_1|{ficXK3Ies~7gyNWLZWxfiOZM5Z z=Lji>+j_VvguDF9bEc5A$O+s^X_>uaO5kmwO#MiP#kFq|g>iWT8ISVdOQaIyRQVc0 z(TxWW&3t8~rsQhKO_Vs=6^yZ7oN;_&5^ZH1s;dX<@ZW!K#C1HgXzt#^nHgezBr%4I z_cLLmB;|50PXz)L;t8wW|TMp&i9=s(1X8E{(!*+X%Yas8kF1Omo< z;seo$$ovTEpC+dwO_){+S;<2|^8P7%HYDR!vYZEy?H(a`ONAVXtGvoQkQB%$W?*`q zO~8`^6`NAe_MLhEGeS+FA>s1c%FCUKikGyGPrH@jol}glEQqUQ{Wqhg-OzwJ)GK=2 zSB4K*Y%{7jfmmZCBM-9n#3?h23}o@48aFwu0V54E;FUFYz0QmgLenyU=Wn14EokLl zfwQD<<@YOTJwc5wm(Z1uW9$LpFO^yZVWN<&uTSBso7!4AzBiHsEtyZXsil$lXY12i z3Nid;Gb|WU70M?3bQ>15Npcoi3sMsQ`n3>W;(+qOYSo)Twku_8C=ix?MStQB^!j&f zfhkTz1>*%_@)VKmqdN0nOt6*Azri){hkB@0$#75l^V(;3e?eE<+}>-C{kFZ*LY+{f1a zR@F`*bi?$cbWd9rFn;7fob@nti5aVd!GZpQpJ77-@k;$eIva7@ zkMsZ=iQHZ;eTgRsyo*D2PRy2H)$Pe0Q_KDfWF4z3Uhc3MV`pw((^e{i z8m(__=kSBa?e_x6L2}s;h@q6la2H}!vnqe`-Ksr|_w|o`F?Ul1!-aU<#vt&WKtjJ@ zW9ix@V!Co^TO*2~vVPs9cl@M5N4j_J{E&Lk)BQ_Jla#uq>ZwN1uSbT7mu-P~N(qDu z-+PM)`-=Y|A9QoQUXjAMJug=x#nA}i2;ISttcqtr?`XZ5Ntm#6$kcCAfRO?DR8w@` zkq9|*>Fx?W9`|LZ)h;_Dq@=6zUwUpkV)I*!Zi*rfyfpX{j9{XgVWT)>S}C0G1Xf`Q zH(!pnK$;)8f$l&K^q+OS%8YSZiw6o?q_)h#C=9c~Gh6QGPuSc2Dz2L0rItMn*8hdx)SpXHKX>yk|`>3*cRqc!8 z9kviR>c0cH^Ghz-@afZ8(_3h z8Q(~escvA2X>BoK`82S}e%vV*MBWst~)yK0YNB)gp;dHYLO5 zSz~9|*@F<=CIHCVmhi7&h-Y|QDb_dYjrOP=}S98hqUOFRI#vczD5zG7HOY9NrN3#5RR zmbfkWd|gJC374Ig=ND<$L6GnR>OCgKO&{9>=OBoHB>`$IqBabf7~H*X?&$4jWrh^^ zx}thP3ju@?M6vE_Hem)w#E}P^%;@hgtB98N+^=8-U#z)lo(6Uu*b%DpD{on0e5o1k`N4bFiHO}(`v&c0YqSE z)Pj_fQ*%{z_C`%|6qD^^cZw(X-M}t;IPVhPwYmAL{0U7*psxU9mh;7g`Hver@D(_G zUzZLvYF1{L(aqn}O8tmvpF!I8HDKe%Z$|VN!O#zv=<{SW2Pb0;sX6mS-)xIUg(Rup z|EgZAIr@?U_j+9>TspVkI76vR=ltnEy%Hv0 zuw0yLm#v5s`YzEK4F;A$QkCgDdldaPqCu|_zP3V zfxqZC%`amvIj`_be>+(Cjf>gbB0Tmez29ryo(|z|3E@(jg@2x?WFJzdKfB!7zB;T; z$rZ!wm-~$ z5o+HC%S=u9|2<9??-eG*+$1xQy5pYW+Ai8BeHnAJD30PpQfKKC)n`{J?RiUaoVO6J zOwS8@Nhin?}{Pzh9N|9)Z;L$y;B2T zbBu;%KgGx8Ag(6ZlG>iRJz6CLPq0S3oS+AOG+;Xf^rOvylLQHN>57Scnz==QQV@Sa zAf1Gaa~5Gx-OAXiKp2^-i_zC72sJ{Zn`{M|_4h=%M&QxC{}B~ODSm%9h_TZ;e zc37YJAwIqYto^o@kH0|&7!ms(oxt?@B>4{z)_w>1G=XEQ5ZXOe;rJvbc$p%^A!yVxrTK^@43^%0ieb3iS#EtO;?Ql{G-?-E` z14Br0|4bjFFmhJ;L5$#_hyq8>g#Pq1e|qB8*vdTte0@A!XdNEr#LA*9BbPd(4C+N> zfKmV%Czq-3&k2zY69&WFd1wPh&*U2ulgrlc1B`-(M6X z8WWV04FxZ~*W;0T8K-HrwqIW2UG-`z`=o802;NH4Gil%3g_&|uQStNRy~t=osH5ZJ zF<5xik4^4vFb0#cgNBjJ9w1YsCE*o|uybY+p{Up3m zs$c#HlKo)K1`*h%$DWb3socUJMiSuVlN4-_^RG%ZYnMckCDe=*xBdg}7B@+A7=-|5^ASPb4p}Ewdv`A zEQgqkrN>=x-{w}#lZR&ehqt6K;^cr#XCiB=yY&kWBn>?f;>|9v0OoV|UC z@^e6n)Ve$%jomJlD|2hAmjIpRalU=xf9boMRX+W*O5yj6_#8+Tg@g zFxrumBs^jrc37OJxshf2(CJ~Av2ed}I&RzuY4y{)(EIedl z1YJM;wwH`sgDWD-G+(1E*Ir}uJN|Y?h-cXAB|i_OP+5DlyH}0^n^10+>D_Eciih2e zF{1Y;;~TZ4kp)&BTS)K++YI3oe9{~#K_6?zc1HBQ`}M(}-&#Kn zGiPh-AI;`h%NI|o*OqcwgPQmQDyw2J^6 z>-!lo19?x_I0gdz+0a)E5#X1t z`oO@K2c;{w=)25DtZPOPj}%|zT2cV+-l`(hRA++~zfn;xNv&xbB@O$?410&7IYTb2&^xYeCZT)onnKh8P&)_ z^0=cu+Rp%a)>%fS`h=X+%ZwmFNDBd;`5{heO$6>)F`-{nGsQ{}A&27aeB`UqO>PUc z2;`7+9~mRIh_%=>4vXlicTxWN?omHNr8&ZYP08#LFZ1g$ z`_dS())j?HvStK!Zc!}d_lX6PD;1cpY8$y4NVJg?i7(1_6eB~&sV7&EZBvK<>@3iqG;r&4#qTWJ$I z9H3~1?b77GFV1ZAjtu~lKk3qZ3*M`l_(zwW=)anRrAn_Kyg#o0)HC2IG4-(?|5lun zNr-f*5HEM_xn`fcd?~oucfE3^`$SXl!xtZA*P+4(p}) zq4B|*+6}i+O@*`8!16?t=Kn?2TL8t;MD4<}i@R%rJAtqScM=E?+}%lVf)kvD;K4(1 zcX!vtgOlKH!QCD1zTbEMTlG)X*3L|A&*>xG+h@A_d2oojHvzTDcLF1qTM0(D=6%_3 zja>(j@dg|7)6!VQ%?#D4o-nB zO9USJdp%)rekrvwzV_yfOyn=~3luxLnY0^ZY+*j+35JH!S61Ff9}Qx2_-MuBCt5n* z!TT!rUfjK@U)QQ%VXt#Ti6>nOgTe*`-2ZIX`Tr$cWL7Fw4K==OV5Vd1ZWakc&fmnY zJ&^i?i=Z8xz1LrJ>PbJ}swMXIyzYm@`6u`oA+(K29pAm=!kQ;kCs@fsth;?ms_^5u+Hqr;T+*!(7%Xgd<5n= zF2+F1pF8M(T4HA|I+!z>@(Mq0H*c`_mDc{gBF(_FeI4I7$RawT4P#!Fq`dnA+~%{b zy&PJ&;E}#r#jd@*KE+gU4J@5gn^A9QVc9MFn|Rg(tiXpY2eXxp zfqpn}GEEuxqxJ6YuG_O8dxNua!8jj+Dk%|uA3D}wB^(r@VXtb8sy~F3Lt<~T}NB4*kuS!M%gZOqxNVV6oC=V zLO6N^B#_d+?|KmlmUTRzC*N@rwpB%tejSe|sHwZejmuiw!>@}|pb%GjpDKjK@b{=I z?)CeuY7_PBz^z#VKOtMOQuA*-f0Z!Tlk8$?BzH9nkg}+@yV1(=F(pQdQ9=E<7Tz--Mw`}sv_&=n+Yh6<-IR8k&6OWl{!y-{ z)P70$j=#-~tK2`>U^GN2npD)2+wej>r(mbl|h@Kog4c;gWDRw#1AnC8Kv$Q+L=G4^@!?BHcu! z*Mgr-bU%_Kcg=i%2jQ7$?M)uEOC3{Yn$TWyvLcPxI)1;H3|~TAsVRJ+<`Ddf91=B( zqRi&F$a|~EiChKZfk=EV0Ay^aowT*WUk!?4G*w?fNt%sw1;^PDEQ5V^eI0u5C!bJ$ zC)1%K16WAV61n7-T*h-XGaxm#n zAuF%|VDgXA0drFzeb0r)pO#;}ir&0JZ!K==i7nfES6})lLMK{^<>sw|d^(P!>ordb z^IL)e!J9HQA&GI%$GX#cI6h}^NOCh=zzt=pc&q6*h)AH0vstY=t=v#}F}^Qbuin!fwn=*8MPV0}(KU49L2i zuE*5x0CYbz^9;_ZTBAZr0A(j+WhmJI9>>>44L@rNc=yupzmaE!Icz&7@q}%yOmLib zKQzXZC%Iv$?{b#z>C3-MCeAWPWaQp7aem#%1@#w{+yAiNtYR_fql#$w@;1Y4U=xc| zJK)GeXMCE!^oQZU6?=AHQ@{@w5Qbpzdz0OG-%Zl2gZSB&ZYCTCv{zX%v^nV-D2|8;Bh?nh2jUnj-!3Zg~v8 zJtjiA9JS^dK}r_B;bE*NjcVcU5lc73%^|kWw1Va7w z+z89^s1b=sP$>L5ygn=yvjes|)4?>o`Vj}1S*xFc^}2P>FyfAniV#EwNySwF;~8iQmwv@k5I6a`$;I!QVPaqizSyvS=K>F*2?^NI zJ+*_V1~7W^jDfOx*o;AYQ=l5j5mda_0MHqO^w_vM{S{zVDtyJZL=3pFAy0&J0uho! z-THdIp@k`rk-b3hWLD2Ia0*9`PS_;}gzX_v^2rl~*H|6cKqeW&t=M%%h1OTXFvYy~ zWTC-B>k4ih_DD8^*M0x60&z7%rjOeWUtZ*FVB$o^-xdoNm&3|sKD8|JQX##@)+i)Z zWx?hdMfv02o4LldAv1xCR7S9z07QS#3N|n$12$s9g-IZCzc*mJ4J2f+Vtp9q;TyRg zGi2bJ8kcc7ws%c9H;Cx48L_l7Q_b+CTmCiX+J!XeWFMtzxY@2RZfO|B;S26>fiFNI zV4RVu00N56E&3>0GYfk>tnmOh_%joX04NEW_=j2nZzLf83-Sco6k0yw6)P-I`C;9AqjvL)o@ZClF4$QBJnk&4lz)P8}Nf?wC;dw_@~B(PmLgy5D>@G zRv*IcY`I@hLvh$Zz2#odNI<;X9!o(&j_DB+P)}wfHFH8tvl*UD1AW%vkiP|nJdl;g z2%Os7NwZE7(djm=`q3u)p0h)6*1CYVk>Hi+f=ND(pbGWLJF_j6XmG#31ty|@*8E2j z%Vwyz@Uf`^F%sH$G1FaXD@6s~T`~ms{sB5)r=>##W{VvaUEP@K3Dgm!L$2O>(+z5` zt$GVq{;=0#WVm~8(4q}6!74h04um?q?IaJmn2q@HvC^Q)Hv!_rQlOrue`God=d+}- z)|Yg6he6Xi)8D2+@=F{NGb{?^W{-21T5Ux~qBU z!X0Gg$Gua&fm_acBJ+WKBxbis?~oGWhv*G~iZ$Y_xe%VtjF8`H%4oYTaZqdYYW1=`X={wJBX6pS%enJ*A~6gd{!yQ!exqDs{Z`ZebPm zCi9vzuD5XxLr&rcW*H}8Qb0cq{ViI=_2KV8DTDXOQgl?Xf1Z>O?6|6W#5t@zIs>Y0vi;;jr zxrr+uP%Sf5iQ4)Fz_lf z3N5pv&VU1zST@Gub1{x_CN=IPAgq@MrQEn>SDeKy^bF7I?9WF`2o(bW{W645tFQpW z%7F90BV}PlVzwsZQ94G+>VX9)MK{LJ4>jra|t=K{Q0Kg;-70-)HLB<7Y`G-y%5}n$kN1p?Ie1e%W#X z;_oP69aVT6-fpc2Lgclxj<(Eksimxq`|Akqx4_H=Xo@I1W`!`O^o^>Ar<7WYE*#)_ z5HWyu{KH$Ok=jc$Y<)sal1Y2~wN!%69sW;xIDIc`*q%+L%ou!@Aw<9*|*925XaKa|QJ&FPQk3HpSpvY7gm3F|(f&ctKrl6-G18b>2g zhLAf{e9*$60>hKck^hq|iL|P9vmX^QNNP@q@`Dci(kP>EX^A(hB1HWOpMyjA&fV~V9fm_7OuFA#YG?+^Y}qvEsO59=yp8o zxN?<)?W;H?GT3l{nYX3Eo@Al*0EE{S=ziHr0dM16*A;aQevlq{?Ud@)wnofbVUkjL zb6Q!9aNA<~19!$`B{*pK_V8|uw>f$9T)}%WEjLmU2tCfloyM_a*G=+_4!{aQ#XjFw z+d9e{tS!C7tFuA+;e~|oJABv|lPZfkFn63_{I@o@GA5cs_7y&sAT%zKyfvi1_9xC7 zIfXdM3XY8|ZS#p;fZ7@s`Ku}%{C8Qo6Z{e>>^|?Z=L$^!7*t?o1~-?}-6a=;`%6&c zX*=Qba5?s}OMN-`gOB3c0YfNncwBLaIVAj#JW$>!L#s6w`wE;sg9W?+zK@_2`h^-l zVCVzQ?!XMl~9n8Wd^G~spWRrA_OB;r3rB=g|`AK0+ zKfs2}6*+u@C)1&w%M|tdJEMs2j=4kbdQ=JiR4$nCemLAQ2n83o-MM!C$mlr;P|h+) zdr}BPedD&f|2X;S-}e!9!4nwgMl07NoOkShXI4P#jGr~RU4;m zq)2SgbEg7?ITBg*tY;654jg4o?rd>dYz-B~7Hon^C`|o*S2rwpRVq z$3Ipy#BKr$j3dNtCAPD)LmqS7iG~hj*zAys^9x&|r3a~i4Jn4Xl9ZysdFX0##TxKI zXcY6>cTid+xPqastnxXigM4^zpeJt}?%4wU_j(^j2PHTV2dEki^mmpbdbds;nX*z& z9Q1BG-x;YDyX^D)1O!(W3o(R$46k!JbD)^ALaJ0%|Eg9&SZ{@t!wDYy93o%BFFbMV zN36pQt=}xkUY2Xt*d3`b-6(0W??q14s{Cw_Hdxs!KM7t8*`6*$0iYZwHpWFZ-zLGo zKP1^9&CSz|sTNSNSaVL|i0n#xQ4NbQp55E7rtx&xs5(RYfB1-c+b*`DaAtss+c;7Z zxrh?xiSDDhPO~Km|gk>Riy*msGXRAlev^th`6 z`%%=Lk2dfpR>3G2_5QMmWI$R~b1HA9-h%M7`>N9*^~C*PblmOAUGh}Wb#)fSVGl}E zDsYB2+DCP56vY_Mt*P-3;MaJ*hU2{k4#5 zJN)_Obz(0@6PjCjkml8FBMyA{zJk@WRWc@a%tK8oO#5$!p8C4@Wgad=#ooS)vke{9 zGwKJ^=Rz{G#RK0Pd1@4(jR-+|(|dRG#Hd4z()VvF{cXX!pxsv=Mj|}QHnTlEI((np z9+E9Z5a#Sh9Zqkx7k=RQqHsF2d zX#>dc+M*-r_>i8tB(~rIj}AM`YpX_`RF+4?z^Pg~b<7Dyc1*_oRRMR$z2eByIU9}V z$1gAU2aAOd04&vhPDxL7@h{bjtrD#c`V7yNCiC_4xeYtr{o{QTP<5s1Cx(EKRP@0~ z^-HL?-$N~&=xK5IA#$00OivMMSLq*H7P;`-`vPQ@=ZrMgr40DoCID@0diM1z25r5Z zZRr`zU5yC(6AeEMAc_R3opeRImfZ_w#I7jY0aXSj%O7t;Q7u? z&B%WmaIkFjZCBp7Fj%l=x_37&E&cRHnD>g<01NQD+iVaD!jgu4FD}~NaU^!wFA<0_ZuQAs+I4V(qGQX$H_Sz$bS9{$MDF`LXqA}#} z#UF!s;obMkWhKnNPI)`$H>-ZF6<5RQeMBWk+n)_MEKP|l z+6kcprN}4Go4C!XUb^~Kz2g7CscS8^nkR?V}go@Ik_AMd{JUhXbMMN~q;Ar=xl!+ti) z|1>pbekQYnNa=Nk=krL>ocyG`rnRKpJOHB2GE z?~yY^LF+=^wHg_7_LQixkV)tj(x1GQR&is}@&J1Upuh#)NuV)YXbypNqzSDmh-mFs z`hJ%A{or2=@%!5XUcJtP8lIh}J>=1A^72n{TlBnP8c()neznxB+XDWyKg$)5&|tb_9NO0TkOOOb63)!CS$DAi?1StLC;YroqUWC=Mf(j`0GMr9Z-IwOGVi zBPG5IlHBODJfC>Ap|qv~AcNH#-nC`c6hqjgC1R(zKf>&$`%IVGj z-&z3iWB~>t50UrM*lW!4@3>Q!<$%I#slRejtw5`alSihe-z&fBefIDWw!NZ8}`E2ad|mvyS*T`6R^B5?NV7g;%9Q*a%_{h*Ya(3k1cYw^_`xD zQfn1X8TAX6`C(EZS<}X50VCimrR2|`mD(nz(lQHA%|EQS3OBZ~%KrrVS|Za-m%JIt z&?n-a7h2i&d^7UVwD?drK51?52ZxAfwEGH+t7trFa+F*e zE%9fsfzW>t8f+1MV+4kW0Trm*rIEQ0y+-jkPPtrh8^x&kS;B6=5v$ned-MyoB!*Nf zdI6e4zF#7NNFaB0s5{iD#8b1rd|0aG6G25J;k4S<5{>UcX-@v&&s4@27gS;{H8o;! z`QRmk7Nob09S()NVbp_@7lJ&QcerUUBv;K#0@39PGCQ4f3iR1FlK$@|r%V40S&vDU|p z8zeu*3v2I3@5)M^adrObMwE9A&>X|&p2oYe=UMJH8GKzNyzAA5-@J}Xnk{Dqf@Wme zGK%x^ll$Ul(#zR@C0Cy%!MrhkMtWt~R>jnUQx+aidiv+YBtfqpkHUi=Juk{G-FWpz z(oMeYe^K!pn5u4wq*mZ18}^de@im$XxJ;KhW3NNc9hA4h508*CIg7I1-NikvEHKUf zDIx?q80yS?v2mq;`tbe`N6TUV+%3UDVLauZ+fsiI@1NOpi}kwSb3&@u##~ow4S#;z z=%RYPb>ehB`kgFC2=c$>v zAZ_<$61dB}@O$HX|4+=`==?A-?WJR=(&xT!O!PxvW#w()poL%JWT(pXj>3>f!fWZB z9*>!2#UI8SA+__SoWJ@_XG-@aHkhg~{um238-uTtt6PC>NJ3Xknl6|-ndxz@OD?PvnE(80TtbO{ z0QA5gXv=r-em=3cV`OJ9XgGgDhUGbIQ|ZIU`6I%pY!)8H{!LeA?m};JCJHLhT|Q^V zWI7YiU7hl4(Q@o-Db+p>KWe2FemXCa6bpZjSO<}e=-EELj@qIGL8R>UcZQx7QnHdC zID7RH?DAV#)lGq(s6&tE`sZo-*$qGl^t#Se}OrUGz@ z|5i>weevEXO39W<&8k8}11O{EbGZ&Z7{?X_?){`eyCG)MA~0T4nIbS-E24e-^=l0% z9$Meh%Y`gxmt#31-q?jl+x*bk)z~FiWIQl(we+a*t$J1|rLhnvz1GX!fh!*5?aWnZ zpp*aeo4(AG);*A+$_q=^13G=g{|d5xG<+0WH7bvKImkhoQ^owW^uu||Z>74Tbr;lM z7f-U+NvpiE**JED5Fs@ynaz2xPeGb)GS2lL?SXIjgjq}f63{!K0Xw2kcnL763qr9y z;T7C^_q0=)@iWYs(iqb6&N4#u|7yi(@^b#NqAlP?%>R`$IL`yh@tk=wuEpUr!Gc7} zf?;Tui=0HBDB$HxpEYs~w6^?KFYLh*$2*vnn+?X!e3^z9AZmlXnyu@HhWjron+& z3oQOVLu`|+-iZQ7NIgL#p^>HEO_>sx zja6^40Vmn$e^j)&Cv+@w@0<9?!JKrYLJYtr|E^1B6h0oay`1}aAymmv-Le9$MUGeY zV-0JA92gQFpz@+z6fs;XVL?|6mMWBzI-bYGpszBN@_z&0YM<9T7`wF)Ypg;aZ|)BV zA1f?UiBE`|=+5k`cB5ndnu2X_ZQF44vQD+vJneJRU=fHA>VkT4DZXSC51UU0??Hn_>ROCb_aA)Tqqo6+gcEe8*v~w+v=~Ab&3f9p4iybN!{?D zFawSN2=L4-nV&)G2gkHv!`JJSk^)&bAJgTr`oXv;xbjH^%y40*+BHT1oUhe@5CFu{ zSvRnZ;5TWr3J~C5O+mV29;kqEefgyaG60B#*cii-i0p5{1lwtF^zmIGeMGDRcvUbF zf*t|@;2tiVwCC!pF)=f$H~{Uq*@tsqVV;1I;Ruk>m=w{0DbQp~6auQbe>WH0A_6MC zTmXDwD=PfQ|EVdC#5vFh2j=X>JrCx9-}&!=cHxa^!L3l0qUqj64~Va>Q;I`^8H^#O z9sip60rAfNu5pO5{h@eEaQMy%F9)Ejt%45dVpDd2>wk|0uMq(?&?OIS0AS#f0+CvI zw#zAN?Z1oki5)U1*&zr~@IP#ExO@%0!7WwzsVU-GIG;DXCjWC_;>c6{cQT;uY$29} ze-_LEv3|4jnFxSp^n9E!4%fwJGY0<$zwU{10|a;&?7*2SkkGNI0rBxJ5Tcqp0V*lF z_t!2y4y-!-#Bzx|= z^%ZRdDT9nr1{$OiZMAR^3pIG2hyf6}p=vXZ|3H9!bot5WjW>Q<8GKx^pt zGjK>#_cw67cwd3?I!!pebR-<%-opti)P)dEyb(VpHPO4{x(Lh41@!&Vsn5nt4Vj36 z5&#^ph!jJG2+aU9;sg84K>qk%gBzVKPbC35paFowqXC7zz#Uf*HQr=dE&$VrLs9|} z{KcvO0s0KUpm28lKXv1xbZ=8*wNW9Vpy_O1yhM zpb#2{1a0sKG5aXOA$xP+Wf7skESw$0Bi-nj`5h8;Bg9&-6)z7QDi2ztMP7vAX3Um@ z=uQ8s0Bi5qNEvd--jINRiW~|;H((9DZ3zQd8y)$9ihDa<=j4C|44G4jZ=~nj8z6!i zqkq6P7KQfKB3%gL{U_2-kp#fcm_>r30-(3=|3_ou2)JFFz(nFXZD@hUKoJ;Kxn<_U zGimm2IqE-)ms*Y-^!^>{QdlB+$b&G^VcztlZ+7 zP)0C0vh7MM{1#hTm`HpBlvN1D1Hk$Lky&9V&~4Wbpe%V%)}?>}AR`QL|7YDV=s><6 z>nwD)?brae%M6?vY7&Wmu-f`Z4mY#B&kijBe-XlW4Xokcul(m*rVQ{lN_!sz^30`#eY=vQ=vks<)xHGFj-Z2X|%n}jr|3Gx4@-=LFSHz>;^ zUHLzCfmt-Ti^E*v`+VROdJ*%lIzo5bIFYk1_1i1;5#b@XL4&)o7a%7tS*ebxEC}~U z)XNf>v3K&r|45?*QfASR;DLk8oQ_VdlKwyLg?sUDF@T>rOXN180{mxb_XarI3^Sk( zLS*(WYN*I`uuz$M|6j!rc-A{iv8c17-t9314(WhH0tYT6q5>qozR<-(O%CY7JA=eE z7Gt<6g}fxy+u`%{w`p$y`XRVq;ZRUn?hXE3ZDSnY2$R9$dvJ|aL6QZ410E~%zc_Er zhR1ope{r7k|D-Es{@a(_aSftyA%x12qDb&?Hu%%bs4&8jUvYtRLyA68D6kbhor_N0 z)ltLt77XZj)yU4EAww_r`}`%<)8Q4kj9;m&ziGukWLIO?qn=RdpN2dCT1I5nwY)@P zMAgeYZFZr>@D~6YqAb?>DcEJ3tvh;vC^)2AS-+J7Fr@BVX&?LvqMp**Zb@W6{m?k$ zbL8&`4dA*eSqbR;;)atn(I%=zNw$&Sk6{IY>z{3;g#)>I2TRnY%=DWo0HLI< zs+`8Y;nntQHlkLm`%Gc#Tjo$}vl~g$&eP}ld#Q_tGS!_p{M4c-E6wjth=I0?v z^zpd;NR0$nkHM{l?H4E5AUh&N6e2~J9ZH?v5N$6!EiQYk5f@--e68OLqHNY!7ONQ@xBHrh(0Z|? zXOp}w!eXB>cIj%M^rO+|tk`)*i8z#3lfJ<%W$F{ z*Pkal^3A`#-d`2h7tFp_zgyfJTsIM`8b0V%eUt7ph*AJ&Gyd(d7Ek;438wzWauk!n z=3LLT<%>rghizDI4!(AS@29_1j=%Kw?45s?i@wxbjAP5+?c8p`(nyY}_Qs?sGmuwp|k!s%)(^>aA9?m$iT+->mOpr<PjiYnXgBku~V|0TXv!u*LMwzdJp#h z+>HGwwbN0sy=-Kbx7U{zPxemi{a&fo#QKGq{o)qLP-?lb*=v>fnm;!GPt!LkPf+Y# z1{K*@w97d5Kc-l(Oy8g$Pq`=2Z9QF&&%t{MzJA-Go5`BKWfspKuicfD8o3&F{Fe)z zslrx`>W151ga)Exb%&2OM>EdHMk!g2Up8U~HFw5aU*9lYzl6AnRS9{TP=08=fJJ9( zq#=hlV(Gqo(W-aINyT|onzYbmof8)MGyiz6_B!l#Cz^Y-{cguAq_nu4GoXt8Owy)H@LTq*JTdwdL|` zJka?!z3+%nf5zw;N0ln+tLx$B3$@6%B?>X^pMNpzX`@QEMexZd<6`Jq6w4i>D;mv9 zmU)XcwqSN6(9m!E;cDDLG*z)2Sjg%j6j$a&Rt~f!r`+75?gpTP~>~Xh$l?}V7 zS1#5PiY(a+WPHOjFE*#VFit+|?9#8DfC%tIlb<><@b?@W%S zH{X>F)azt+oX?GzY}an--&`DxR%CvJ(o834cGze7u@c#?+aa@BY}6qcc1p znAlhM8_%)t#n*ur^oTBK?%8^6!#fZ~^nUT!pB`V{PZsNHNTBucg=ekeypdzy7r6AO zrGsv;)jwqH)bY&nBG7XemlF9sB-T|t$9Imt3T4 zvM(2b<1;f_kPG{ipJeR^VHteI``(Lk>M~R>pFd-Wd!($$_{@4zEtNj!q{Vs|?tUDh z6BT{=%vOs$^g8`e?aJ?P+0MR{mo&st1qt$+;IwB+8>e{yHpXpR{1 zB!1fz>t14cGt!$&4j}J_lekU0V`07}9JLJMO*K^ct~L9b6bzAZ0eD;hN1EuwRy+U= z3fM}aDEE9j8w)iz3wPk&?xz9p0nl6oc2+PBXTM*G`DTI*86w#> zUPess%P5L4m(Mx&@?b3 z045a_wam&!a1S0Bjy6KnLWFGtGALF3UH}M_04~D_EFcu`Sl_lH;EkRq0Q?1&{Q)6D zCZu_A3dt#8&Y)!AmNvx@4|tWy>H@6Fr!s?~pba~7d&UFxToLMVW@QQ|RHyS{4qnhi>`Ap#{=Yz8BruSQ5v>prK}=n(#|#&Fg8x&<~p;hN>H z^FV;$FnHW?_}9I1M$UtSk%6f}xX`{`z}mfDuXQjUUKaSQZ;uJ}Mw3kCb<74xbBqP>IiZWHBJ0AC2*U_exP&F92A_#$$u>&zD8)5FPv3BJd zB`g8>ZAD{OAPyk@*Zk_eB~YrC14ZII|5qCqzy>Z3lYl~8;R9fc^*ashO91QvyvYBz zO<{(QB#+W=cJN6e_4}SUzEkQ?(8{em_-E<)<$6cQ0O!PdW8|0V^9QuDw-J94=!xeUq~Kd#Q*J7}eCxg{cuL&BZ#w^vV3moamS;OHfr7 zY4bf#5S8ERZ&B5JJh%9Q7UjQXt4d#xrhVv+n(hDoOV!Qw|AG@=cQW`PKCh!{FS$F4 zXbs2e`O9>zl>uQ$kJBmkO<%gF<%5oq(xJ+sT(THpbaZQ~|KbrPRU-~7G;jW!aK&^{ z1#-x=funs_kP|=Qx6;jtl}(?YB`;kix6LfWeXw6!=A9a5tyF%}-wIjfE6^`+f&^Sg zOZn3(e>{weDK++7U%JeZl(wY^JF;Qi5^Q9~f9w0psDXUxiR5J2N56z)Zq8G;icyQA{DQ zatUih=T~t&r?)_@Z}*)$_2Ol9v^~<HI`0{K-KRE3 zJZH?%t@hi2>xFtsy;!#oNv>HnCid80<_$=b$(L`4iv+f|XAG^QMs;vu3al^l!etzZ zA@!jOB2~HS!iQ{QetcrrB3Hn7))yTgxJEQs*8rEEmcYRmm@W+#s?6 z)2mBgk9zJ_UA^n7=TZ&?3{NQZ$2%*JXEihkNpJGb({INPpsu7P|0uq!RT7$Hg?`oq~Z4C`;!JxiZ)`@>$#ol8mx)kCd#{j z?p^$9PuA3Pjl1=6rDu)F%*@_;MX^d-oPcf593c1)5RtA8h<0E~<(Uk`ikxq4M!uqy z^tOY5km+KDoYL8xlOu%^85?dzzMYWxKTRz8`cpd>Lkw@a5sT+;s`F233XJBT0Eee> zz1nd?;H5U!#a!QLCG4^$jVrM}AtdMr&d{KCLuV?(;s*H$8iO{dLPn0u_6P zmWN8~P8QXwpJ(Sx z0Mw-2fDF%E4U>x2v9yl8vaeQ$m(uf>5*oDEf@9Sn%wVRO~;+tcACY1G%Wm&F-W+6@sN87_BvROLxi)^}u1tS~VspXV0XT~VR%FpZ(Tjo}mRUaRH4N~-Cbv42#I_^Sh)Ped>Jb%pUFDB==B=6Z zxhQ}*9VnX&nUS=snV33S-dpQE2$?L*Sg!ikZ`NSW?*XU7oyAf9F#t$9?=6p8!tmqV z{N4VA)xRB*-gbk+&UU}twXxr;qEG2BA`KiL=ytA!6E&emy6|qiPmE$n;K$O<2d+)Q zAP;HZXS^mF-}_B{(()PT7AIav8WQp$$(v*v6T<$5YT7oNt!!m^tKQiJY1*T{yace+Y!-Os|CHP%+2JxCsLvQ zol;RqFriqN-@?gDE!7Vv&GWZQI6RYcj;sJ>M(vpviW`sP{g&#O#|ry|kG@urjxwo& z(*juAm)*r6W_?I$%s)QyrR{tZ$I3^;+0;BA_`e(hqZfp!AB|!D!0yb@%K4VZQ@y6t z_Jo{qRH3-yffi%IK{Y?WYc}dji=35|)0XsKN5?Z2jq^H?+W@dR=gew7eM5x7*#;xXlDV!pgEm78-XQZ54qRor_G zZ#eOdNg!=BP*T#; z=xDbu*V^A3@ldX10dt#U@XzG(EHP1qKtOE%3(*AFVeYT6w#EUv%b51JPP-xZ%Wm)8 zG=y&qSb1s@IA}j1otjqHF9Dh3RCpj$<2hQOQ->8mNz1w>fZ4{Wu6=qFE`s zCqv_@+oL{4JK1D_(+g?sw{sBFF!8qQVYjzcI>Nj61{_B&Kttdr{~&kRdS)Cz3+{z! zdkN1;124EJ*IkGXQpevcl8TVlI{R70ZP3=LHs|EQr@MEM9CghUL}MGrw2y!&=1XgG zCO}E&Y=RC4>CpR`s6%2tm#O>_Xa!NSQ#GNqAZ#Bd=dBGL=8r$H`CW#yIj{gddNr`R zj~1$2ND)CWQc@WpQ5HZEuN3kCYFj_OX9r$LAEfRI%PC@Zz*(}|0n`h4^xf9?ZsH& zPyu7ih-nOQJ+!r$@q=M7L@$U1VuLPD4>f<4BqsL4DfLQhNqQ$%y2egV^gcbo?vW5SEd$}XGAV@} zT)+H52IVCd(;Qup?Gr*$08U5@@b(vgecN_S51qg2?>IDnN>Xqtwi^xvPl)2I^(5sd z#{&KL8-pSGKNwJc+=Yu%GCE?6$N)Y~kk9NGlM(>Z#v3DNBO|BRA700?uGjx0Gxa2U zaBcLm!WCaAp|z)jTK*Rvtw3D_;5)-~$oG@tBT)OEhk_5I%l5C=0Ta|rtnBCtz$Sp! z;)#P@#)gZh1l~>w6ehc10|rWR^iYlp8lW^tU_XeakAm17mG$@(_<*#Hu`$p{AGPVB zTwbpOaO^io72IC4u2rlSi$FIc`$$PiPtw2*2>>>KOnEh)%M2YF6Crd4PkamXx{jL* zUmWKvb3GuiOyUw*>$V&MoCi4`S3@ezNVa<}Iys6;VR*et+Q1E(!_yztJ*iwK59M6+ zr0YQy&-bXllZd!T)X2#Aupmz$GnfEogSxER3j2Hnb~p^F@1um#fF0iA7#r+Byi$w4 ziHxDOJd>lfY%@X!$U&d`sH`~?AL-55hF})DiGR4XnppAZpMoK_! zJ&`{(s7wQ7gR|C+YOFsgpy-cSRUDyJ3n3|m3S|6n`53AsN3<(LPnuw=yd81@Ro@!( z{orpg!NMC-;+ckciK(8^B#2hL4$5OW5LP>;Q^9_3R+Vk3GLYm#+jk)ZavI?hup~ z3@GXictw7<4?oADhwg&vQUIxgGvL{$SgV%pGQaI#?%Ev3Ot<_*7lN9{^IKFAM#Mgc zn9;CLt>iu#z0IwXI zxK`qaY<^kyZaxi0n7%9MGydqZR)t8xj<5poNuMDCqu@^RILR}GU|XM@k+qPmvG(An zKAJ)_E(c44)rwwi043aoKM<+$VZLDgPb++__GbgH?Tp#zpyL=<0KUWyq+zR_8f1$r z-a!1!N?cHnK1Zl&J10GjF31oy{A`g9jMFl(ZTEhZE&J6d7djQhG{<|N6}Pf4x~ijY-`)CL02U^0+; zDR|~e1DDBSh~8B;B@>d7l8_=yqHL8$1ljB&!1(3xJ?1nlch7}+6c*t?pjq>w;FF$% za%9wM4bo#c3EEbRy`K47<`uYKO2Z%hf6L|#G~yc9Zn5x;kw_c^G*7L>Al6|XzFt4X zkj=0v3N)+31JrJ*Y57??8cmc^cVQT)&SWc#4>)Ja7nQ7 z^OuAEOE{Kx&F3x-WAwIYpcH^IRwO@s4<&|F03x#9&Mlt@L0^za47Zqz!j7^W$!K}N zy@#;OGQg0-TShxVpRrHun=m4zE>Jy%G=gL%&MqZh;+!sT?Q_BTX=rH<)H2SdS@Zrs zyJbSQMq%@$d>1l%nw~Tt1(-6RW+TSzGW$5Ss6MnVE?`(c>K`e_d0mcua8%Z(`3o8j zdrAK)3HXc|`_xz@wRkr7J=uXFdUk#xb{+yVRbf&`x?t{7TZ!Nd>Wzl;9b%*q?kWk` z@16Tfz{bIIwt<8RX`2dN_So&U(yOk8vCGo{Lq`9Zj*H)Rp38#UUq34V8%Mw(R)Z-M62^$E zItAyFNc}W52!O0n=(l@PMPxh^S7tNxc`u%;5u=6=fUVc4h!HxhaP>_v$FJFV7y}I^ zAA!_xAl+!_;==dtSBn{Xw(ZK*ANh+XMi=t6c<`m~z6IzS*69iR#NXhxuLmUD513L0 zu9R#q*bMV#$wH4hu(b6{bCDBkO@^4okrE1T@{ptvG-~$noOLiKO_!($$;t67iPuRThom9XFnY>1Q%G}g(vpJ38hM5h-G6F;VwP% z1bmc{I}EbBBpP@kYDJYg@3CL?@XS2cK&1j2RRqz$!Tyu;MF+^V9xNKYvKY7sk;m^c z%cFPt+xhJlU%bD^=h%cz&@#6>DuR41Zo3jAT4=v6W;@j+31l!&c}&#kiOlTK*e$|G z8@RnP#E|j*5dV{AFC{p`6ZZ71m{T!gjLoD|?panOrnTm?6_Js2;Bd5doJ z4{W?~*6y3H%x|(k1+`wHv|MBJ8VHm}ClOEczm{bl0vg9?h`1JmI6VeMy4SOQee!fR z_(AmTaPXPSqW?!|`9u4w<~TPN$n|dl=+e)!lGp~>aV}t{wAuh@X(k0zjY)d4Ci|yi zJ-t@`TsoblyDpAbDk7RQw?m*#ZuF>Dz0l8IUP{kFIf;Zs_8KV`SN5ct`$z=wjmcZ} zUG;4Y9Qhw3Zxo!^BvAR>#;#SR3f#&r@pH|;2zNAy(ru>*RCcPa#gIE>X`ffXk(cS;u39948CK!(a1nWZN*{4=sPTpRo_{Nv znn-W%k+FMu#86%b22VW;aPd8`%{M&)R(GIcuFZhrO2ZiVii>uDlq@<8Xtb);b-S-F z`bE%Ngf_(Ip6ZVq1ERyP!bXDlcE@0j#;9;9Wr(D5YI8Pe&$aKk*;)JEi(%A)B7*Ec zlUD)nXwm=yeLsD$!72$N(68SlD@x=m$HmR(&~VMMbof(t$F7M-!Ejm9Jh6iRtgb;R z_L@o_s46mF3Mxd_xoIy>b$Fg^Lk=E}>|?se@-I+cjbKXKra(ysid|kQ0l~T4(S?w` zveM~8Z@zEelaLP%BD?z?_-KCn2}BtFTKl1F^&(c`rzFHK$G zi2wN}2%vSXldhGiiGv6@o{f-?>skKW6w6;CjLk#8xTj7mfxU&&f+C@@X`G$M_d zBMyR%0rQM*CmnV`0bhDJ0EWaf4*Po5+OmHDRIjbofwPd8v6*i@tfEjL?43ol4iFXUcfsU%CUjykx2ep3CzLRuxZTbz={W8eK_!@ zs9xizYC49_6IXY?bk`KPT>J(oM#SBOpdi_h4)aW*bTo0@=Y~faOzA!Keu4`J07^PX;J!qoR^x zPh|m_edj`_zGLm&F`{Ya>q*h01j;LL1?m#EW9DUWoGE#*uo95(F_#p{kb$`}jRZSl zXtxJ9E^ef&8;y3)zMR!-Q3g(!jh_}lug7#gql*@JMlM8OLfE=rKjS76MJH0eui*&2 z>BJv-gqBeTNV_d+1@v2=J^%t9ae(d2A~fVkt(L;Nlz@kzf}k=0UxywXVET8tuiQ&J z1pIB3P^EIFg%Zw&3_Z0tOJ}s80=Mbn@D{`=J4GTE*c-+;ZzZ2~n@RFb2?^avXfX~; zk>KHRR|D>v<#DGe{u2D<8pw!O2&~-(AFtWvOgK*za@}P;P3&NxMNoHil2uo~Xm{NnEJtNp3p}Sl1 zKJcS6W%*eD7Xj)!O2>G>(2Y@5pGK4ss2S^WCdDB^X&(W6(gcDPtRb9Z;V@Rom4Ayt z_Zdk^EWz0s|9BAx93PK~B8M)~;TVhj0io&}^pBxL=V`glC+ufm+`w)%CS+d&((TGO z_euh2=vw59v?4`O)1!_>IkT@}qR8g)gL66&WWTux>|XMb9pXSPs$qvk`CAKLw_LaPgNFci;@5{d(wkVgtat$DQyF2p_{tR z11x?g;C=7}E`*sFwuO~O{+hxw?{7Zm&(P&r8OC)%r${EIx0gp#Nfc&sktFI6BHOEy;@ep^LzC?Kz!h+3$~K9pYg z1{?O$K-yThDwrnt0E@TZD{Rbc5_>8WK4x_h{mZ}z0(Y3h`ql7jc6MY1 z1It^^%EWs@Reth~aiZGqX!+*^|K;G(et0O06p5v_!8`7=I5X!*k+2G~Vd?I$8|I0z zi;4(VrJwJKP}Aiw&m`b5i<`nZ`#iSW%dL6)r4M?(rj<(m3?o?FC8l?*i}H#~wO8Ug zi}3W2Q@|wNz^J54SWAefn3N<`lWg@_vEcrT<06x_-x#WBA+|E zCj<0^FPr;VKE2A&cyO|A2Z_i)&*rUlrN$P-)@rrWU}jRM4O|ei;u;%HWi|hMo+;lC zLf7^^1Wg<~YtOeuS$HsYkk68ymNFf5 zeLK0l%(Ix~LGHU0!meb6aBHlmWxQDH^ytmXgn2?|{1mAx+i&lq5pwyD2f5>CfF7pC z=a2bwLlI;2;qCqQ0_@(@!gHg+!V2+CHWxc>A!fa+y{FV_5ETp7tpOM-!rltKe%OUsj9D zv}d@t@jGGq1*KE&;h_0uVhJ5P*K2|xIkC|`yel($UTh+FsUZwKn{;{g^r&`?;+Dam zM~`A$kB$z%UB^Ekn$5u;&al7SX2ojZv#4WYQQ2U!>=Z`Yr7e7D!B;LFVSg?MH#?}_ zq+zxrbT|Lc+1rBWW|$z()PB@PTC>t<LwTiL|n9g`;#zlStzQ6ye ztRY#@s9QG3o*1w$-JULvef#B)$M-B@gG7Do!HNc!9F-R(&%M2Y z;T|pp1s@p=|H&Lb)fcy2uyghTRhmW-o5+Om&oSNyFE0LapNtHQ>A!j;752}yy2}6o zbZ2DnL!hhfpuX(zZgHr+nb9AF)Mt5yU?151Dg0#P@N*|}l9TA8G1)iTw{68D5A6$c zx8j$W`)qxZrb5QUu8t;kO(s3B(aQG;`NYls3GbSGu80X%grcUsX}Cq>{BIH7Noi8E zdYF#*3fyw5E*X9*?>+E7r{5SVZf@#;=H6ZJzWZiL6w1&$roh4>CSc7*TMmBx7g38t z4tDqba8W)aD9QY0wSJO21O>KV^pmGQtY~4FX*3W1 z_E7Ks9Uxdzg#ZlR{93!wKl^SRn|<<-`eaHh0kFKR!(%b6s}PuPW$^eN12QEE>&q=lGX3w=3c`nvgF0VhD`W7Dv_SwPOrTVBm`xb?J6# zD?PJL_OMGiPp51nUP>&^=z7P-T=(Py&p*I!j1)h81wmJ%cNHaAm|*g7w)^Q&Q{gVT z2nK4&3ej+Auu@)8YP@lw$NBp0cTj;^vh->to9{cEU#x-3%J(EE3h#?Kj!^0{r|u4b z#hYYq-K3hWZj4M__Koi>EK=Rx)b~m(;GqO~OJk}0h5S~zma+o<8%mmYV@wDxdwn>< z6DJ7hs-=SaE3C8EjS)qQ#3;GH&PoV;)i;sdPI6SIr2PLP{hbtGuNdmfik=T7Q_5>I za`h@;<^3RdeItS-|4%pvz6{y4}!hLhFo&!h-4 zIKnxktvHrS65^pUI67|%S!i@Uh%8H@x*CZXL6g(6dp~mHoFGwEpnBkcNWlP}V~8T#p-yYx1lyn9S?%lk+r&4+|B`AD-(8S_w>|z+nY&ycE;-hYG^aW@f?SKsG})Zx!rdH~z2@j^=$8Qk+E< zsh6dueocBfR>VO40jLQ4&L=Bp%!i3@@wmu)AjchKU8H`bEY=HK2#=p?U$wMEY{2yJ zs<`uzxp*!M>`Q}gEryemx$=|s^PP?`UBJsON^alky0-5~86Fbth#jVQiC##Y5HToG zKJp%!#Hea-PpF-*#!#{$;nLJ0uueNXZ^2G0#^4mEHxslo-TPiQTitG9SUVL~|H3?d zBWX+vsA`*jZ8CT0vzX?6tz**E+kw*^ZIAv6MHjlgLsNM>BOs7gVwQYde;YElZf}tI z3pbW@tNgT{`ZnaE-ge0{g1Zm#JlI=QJUW?7qAP*62>FGdHGQN00geF%87i;M z+_#48WVB7l*TmDZKkvxJPYD3X-Yd#TY6Y*f<=mN)h4N-WHdUoTJ4PS3@I{~5$$8$f zMX}q99!(&o^C6vdz;^4Uo{vSByiMMPSEubeFLQzOiY%!c!^nSc*i0^w3MthFt`7Ma z>4)-b=aq&rgwQE7?U>?7K{3~tWMj=b_8_wP-0 zf&0y`z`0Tmo+vlO08_az4$Z&K`J|-^dC0IloohzW!7MspRlRFrfXliRUsNp5{G_F@35*jQT*% zB_+k|U14PPw*KtN4ZfzFRle&m=ea>o>yfW{(h(5$1bQIk${Va+IPskOg^J{gmG}UE6bkPg~zQ-(T`!A!Wl(p79!=N@pYb_Qk;D&}(6=O=ho4 z@$7DryvqjX#4OayULD{@-xHQy?pT`*_ZHA`r<|Q=tk_;{ zs|%c(Krmy8QGyZk4A<&f05OghFoN+dr%I`V{xR)#1C|TGx(td?t8(h5?TDMW3AC}V z%X-2y(T!1MV;DOA@%PVOMZR*X;c-yGkFMfNW3m7EFxtxtzI173jANXB-W~1tYIa_f zCAek0-=|q%4$xNx^Ba*SNygJ%m*0$e2)xlE2XK}yk$A>ckZ-*$^1ARe6?GX*Cv!}m zZwIN?xO!<8t0aaCAsLv&rq)ERsIjW@*`Oryw zJHAj%89Q`y3>L=l@Lk6s)gyaV(&W$`i+ILFWo>zk&mv{ zt9e2zzeL}?EpgUKihY2*KZOC`f{hK|TZ~x(SCdPslVQ@fG?k8j;RH2iZxTfo@?-d5 zhzETRfBEh$fsa0ny_HqCB^M~RnQJ}_7N|w4gE9!$`{)A-G7TW~^_QR=YsNBBbSK@= zHb_R)5T}zEmjFH83VFXHCE?3x+qqj@u9RN6@wg-IL`WEuMtrX{5t0<0TT9+W_~YwB z4|^FwWQUa@jY@~84%L`Zts00uLM9N1bH0~!vv1wT*(zV;X`VN0D78Dyz63(?5RG=) zzFFtpqfaBFea11+y@NRKby44dNe-mu$mvrXgd}`PMii+GMqfNHG|I)mw**A369^Jg zg?D0vdm>J^!(N&tSnHZdM!y|(v8P8h@%$`YyxGg);Z3O-sN_-fHT5%*;xf%=i#A9# zeZFi9<8KMaKF}8L^6+-nPv<)geeY-2`(dv%bzi8G0l`0U+KbpED=QA67M$awOU9GA zdy*=H-Z%-&10_#Dk+pM65E#{@W2!tRb^*Gz0JE=VdEW8F$&o%5iUlIh@W9-`_`iMZ$Cz?&Zq%a6clgH0$a< zcm8_qr>hSWYMJB`$mw`8t-axAb5+}LNx{Q`#ObJch)k|Qe)a?+au}zS{yYd^AHm!< zM59Ib0EnOPQM>p}xqi!UsxQ|H-EaS_PbC|=J`dP=>zw?BJ36XV5Ss_5w=Kya6!-co zk9#gpr;dtx5;>dl5!t~sy#z;UPuoHhfxNf&q}9xP&0z-DrHsdn7LQx63gXz@BD^L` zdel1d9lBST=#oeRjgt#_OHaB`Xumef5{qyZoh-nA=+EECIG8)-Ahl;r)QNoeHMZFp z2jA`|^P1N=G7XOJTE-Deyf7?ikhqRW9su7qT|u)#pLo zZ-y`-kFDkmQ198p(=2e`^b+BSlLR(FtbKb30;35dHBmSrrBEVr30XXZu+me+$E=Jb z451dtw6f77F#<=e=tfw*E>%E*lF4(-1E%vbE}U|MFwOQQj&AEK$^L)F+leoVR6%#5 z=J$VeQS_zb4#iulr$@a?ejt?YOx>g`58^XwX1C4tIzYU(l4;ey-XEoyVz>j)J`T!( zG?D?CC|})#(@-c5V|ebVAV%?w$7-v%%K+6v9&WsRBzA?+)656Tm}U8Gut0V@FdGss zu_*<>H^E|UV5nzpFpFmC%DlzW4KoY#9!g|ENJBv&Glc+~%s?)1kwSxS56ZdO2kGTm;A zPHBw()vlBp(?2lyyrN!Yf#Sim?78tSwm_{u3PuF^7PTaa)~@@zYaFn%3`s|U#qj$SdRZK#$CA!|HG z@s{eosAiA}(V6Mk>^*tohE>@rcu9ff8Hr7??$F{-thQpSPcy1VnWGk|+Zv10A{|5U z9~errdfcf^gY<7(TbhlU-doRV#!}+&eai|kxE;IP4HlE+xyB9+Ah>S!nhaa_?YUhz z5M8peXF_>khJN?!4>qQmHqZth@9It#g>9*S+;HKf__s?%``}Q`N8qkFu*!D&#=BMr zZe_JP8qZKtcA9ck&Q${V`;2eIw}DR^u@YEVI_}UWI(3j8^azZG9hIt>pk||fgns9p z%+P3FOfRG-SNv%6KF9{|bJjkLhcp;U6j<-SdGs!g62P7>+uwUH9Z)Gyz437RHGK!o zPa1z6Z3&=tzzr>)iuU*StF7l#;8Vt2+)S}hTrrC0crHeXmCucQ`b17*Gvu7~>K)5_QB{D}-6xs)CeFA=xTDdKTPc~(xL({44<}Q=GVnaOjerSR zCmrB;{Gx%4J2gPtS$c#CBaFNM1;mrzs0rVGbaaxlwOOEBQ3qB<%6mV(pgA8w6#kJ{ zuefIVs3C0d_D6==KIM=`N3?zi>GZ|R4_&l{`qCC$gz%_f`qz?2Um{26sC3Qgv4@(R zxXQNY`UyB2R(kP{>OF7C42P9EgFzd(c$U+#i%ZHy=Tb7B0vcrKoXSG0kKz-X!WPo^ z=~-G zg?saM2r5Ur)d>6T^{9~hu@-g_`RR(s0~NRkau0Fi>vo@t__d7?Z^jp zL5X#pzm`AetI)EIG2YfJZ(PVxKQrmv=C~s9%RY*2HsEl`EY5FNhd)KV^KuFN5>hah zQqyt*DtTZVa#k+JErVxtzPn70f;7vLg|1R?eSNvs?{&Qk4r-~f>0Pf+>qY7b^xShu zixRm7LtUGx#^QZdwaZA4g!>@Xwvm}=Na)ySchg&yB!SN@< zv_s1VtP4VS`^Uq|ZS`K^)g!Op6^hYSYfg?0gA^4DEcu^NOo=ngzt}xaez}yCwY1fV zo$m39FILX-<-1Z!Y{vX%(>kT11T(B&i#|(h*r2}r{Z*fSDw^}md*d+YmE+X2L?g=A zyuJ56bXneyaw#M#oL;Mb)urm-*;fC$!}D2^+jon+;R7v`zfUGn(J64{9`@H4_ETSf zdB^10HQ#aGECh_143XSkGOvDOvf<4KGVEzNu6Fh}XIs7e>eg2;ypsv@I|rJ4=Vp94 zQ}mYg1nP`EJyPro3e$eiDgTRh344B7D{{JDN6rbW6l+wl{EI97hz&|fJ_J;b+k^hT_V zCI95MEYRn*esrX1OMQU8fQOqyiZ(X)ofm$tZ6A#`%xXKNH{GIY!bPN8F^MIFJYy)wHna!ss z>h>87Tq@3j1K^FHm%NA8P*dD~ce-3ss?-FtJ>?R0wSm~#h1FI@mTQGamQgRp>r^LG z3bt*;N@bFT*WA4t(|M-vqSYo`;W|@Haz+&q-rP?zv>m0^#$LsONCfg zBJ#}~Q}7Sr1h+zza+#^{i`zG%Jbya-K5AU2Yi@nFP^uN?0O!YVJ&%6;TJSBw8Oyu; z9w30sDwFz*UnBZOH9y;-F@4Y4BUx$6W&(VrVtkfO98~d)#(u8UMCh9-sT6-C;&IkR zU!7cDh2BhF{F^!au9fYc2tUYIyg~YG5KhLtZf-{^>fc z=kWzwFk9EaGwHk<`{pSW6Qt^+CYCtA!tU8#tMJCYhunu-xc3Z@$FSOl^Ek0|%;flo zHK(@P*BIsOm`Xke==uTS3stbeJV|Nl=I12m-bBX&xNei}vr^zZHigRJE53!_#>%2# zGX>l;4HFwRuz_FB{JajALNBew&`m8JgLlD(9!OG)W`+^#3qt~44`e%q?utqOO5Q|4 zkbAzkaOVT0B<#HV(}{JT_JVhzs+m3btH9Kzc!kBWv9S9dl?!WMz(GEBS5k$Z-T{r= zm%<_5mujrvIVf)G6^EQNag>iam%QHM4F^*2XisEw?!;FOjGO6U+WFKxeBw|W#@vR= zvA3F@ej9lTzs;oQc^p_K_;YLY-GFl1#>S>cSi8X)>7LdM-VdQOo2P%A_9`sl8fau+uO)J_^pV|a4vizzpm`aBCq^B>6lDCZiO Date: Fri, 1 Nov 2024 11:15:38 +0800 Subject: [PATCH 557/695] Update index.md From 53aa105da9df0a7ce08be9cde95ebc40e817106b Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Fri, 1 Nov 2024 11:23:52 +0800 Subject: [PATCH 558/695] add disable support and add test case --- source/common/src/tcol.c | 3 + source/util/src/tcompression.c | 3 +- .../script/tsim/compress/compressDisable.sim | 146 ++++++++++++++++++ tests/script/win-test-file | 1 + 4 files changed, 151 insertions(+), 2 deletions(-) create mode 100644 tests/script/tsim/compress/compressDisable.sim diff --git a/source/common/src/tcol.c b/source/common/src/tcol.c index 84027c25b6b3..923aab12ca0e 100644 --- a/source/common/src/tcol.c +++ b/source/common/src/tcol.c @@ -363,6 +363,9 @@ int8_t validColEncode(uint8_t type, uint8_t l1) { if (l1 == TSDB_COLVAL_ENCODE_NOCHANGE) { return 1; } + if (l1 == TSDB_COLVAL_ENCODE_DISABLED) { + return 1; + } if (type == TSDB_DATA_TYPE_BOOL) { return TSDB_COLVAL_ENCODE_RLE == l1 ? 1 : 0; } else if (type >= TSDB_DATA_TYPE_TINYINT && type <= TSDB_DATA_TYPE_INT) { diff --git a/source/util/src/tcompression.c b/source/util/src/tcompression.c index 9c9ded693e03..b954a24744dc 100644 --- a/source/util/src/tcompression.c +++ b/source/util/src/tcompression.c @@ -1628,8 +1628,7 @@ int32_t tsDecompressBigint(void *pIn, int32_t nIn, int32_t nEle, void *pOut, int } \ } else if (l1 == L1_DISABLED && l2 != L2_DISABLED) { \ if (compress) { \ - uTrace("encode:%s, compress:%s, level:%d, type:%s", "disabled", compressL2Dict[l1].name, lvl, \ - tDataTypes[type].name); \ + uTrace("encode:%s, compress:%s, level:%d, type:%s", "disabled", "disable", lvl, tDataTypes[type].name); \ int8_t alvl = tsGetCompressL2Level(l2, lvl); \ return compressL2Dict[l2].comprFn(pIn, nIn, pOut, nOut, type, alvl); \ } else { \ diff --git a/tests/script/tsim/compress/compressDisable.sim b/tests/script/tsim/compress/compressDisable.sim new file mode 100644 index 000000000000..dac7ef712ae5 --- /dev/null +++ b/tests/script/tsim/compress/compressDisable.sim @@ -0,0 +1,146 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sql connect + +print ============================ dnode1 start +$i = 0 +$dbPrefix = db +$tbPrefix = tb +$db = $dbPrefix . $i +$tb = $tbPrefix . $i + +$N = 2000 + +print =============== step1 +sql create database $db +sql use $db +sql create table $tb (ts timestamp, b bool encode 'disabled', t tinyint encode 'disabled', s smallint encode 'disabled', i int encode 'disabled', big bigint encode 'disabled', str binary(256)) + +$count = 0 +while $count < $N + $ms = 1591200000000 + $count + sql insert into $tb values( $ms , 1, 0, $count , $count , $count ,'it is a string') + $count = $count + 1 +endw + +sql select * from $tb +if $rows != $N then + return -1 +endi + +sql flush database $db + +sql select * from $tb +if $rows != $N then + return -1 +endi + +sql alter table $tb modify column ts encode 'disabled' + +$count = 0 +while $count < $N + $ms = 1591200030000 + $count + sql insert into $tb values( $ms , 1, 0, $count , $count , $count ,'it is a string') + $count = $count + 1 +endw + +$M = 4000 +sql select * from $tb +if $rows != $M then + return -1 +endi + +sql flush database $db + +sql select * from $tb +if $rows != $M then + return -1 +endi + + +$stb1 = txx1 +sql create table txx1 (ts timestamp encode 'disabled' compress 'disabled' level 'h', f int compress 'lz4') tags(t int) + +$count = 0 +$subTb1 = txx1_sub1 +$subTb2 = txx1_sub2 + +sql create table $subTb1 using $stb1 tags(1) +sql create table $subTb2 using $stb1 tags(2) + +while $count < $N + $ms = 1591200030000 + $count + sql insert into $subTb1 values( $ms , 1) + + $ms2 = 1591200040000 + $count + sql insert into $subTb2 values( $ms2 , 1) + $count = $count + 1 +endw + +$count = 0 +sql select * from $stb1 +if $rows != $M then + return -1 +endi + +sql flush database $db + +sql select * from $stb1 +if $rows != $M then + return -1 +endi + +$L = 8000 +sql alter table $stb1 modify column ts encode 'delta-i' +sql alter table $stb1 modify column f encode 'disabled' + +while $count < $N + $ms = 1591200050000 + $count + sql insert into $subTb1 values( $ms , 1) + + $ms2 = 1591200060000 + $count + sql insert into $subTb2 values( $ms2 , 1) + $count = $count + 1 +endw + + +sql select * from $stb1 +if $rows != $L then + return -1 +endi + +sql flush database $db + +sql select * from $stb1 +if $rows != $L then + return -1 +endi + +sql alter table $stb1 modify column ts encode 'disabled' + + +$count = 0 +$I = 12000 +while $count < $N + $ms = 1591200070000 + $count + sql insert into $subTb1 values( $ms , 1) + + $ms2 = 1591200080000 + $count + sql insert into $subTb2 values( $ms2 , 1) + $count = $count + 1 +endw + + +sql select * from $stb1 +if $rows != $I then + return -1 +endi + +sql flush database $db + +sql select * from $stb1 +if $rows != $I then + return -1 +endi + diff --git a/tests/script/win-test-file b/tests/script/win-test-file index ff69e9196729..ef99442214ea 100644 --- a/tests/script/win-test-file +++ b/tests/script/win-test-file @@ -325,6 +325,7 @@ ./test.sh -f tsim/compress/compress.sim ./test.sh -f tsim/compress/compress_col.sim ./test.sh -f tsim/compress/uncompress.sim +./test.sh -f tsim/compress/compressDisable.sim ./test.sh -f tsim/compute/avg.sim ./test.sh -f tsim/compute/block_dist.sim ./test.sh -f tsim/compute/bottom.sim From 4074e38c23ebd4fc0998ab950e495c0d3e13a624 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Fri, 1 Nov 2024 11:26:39 +0800 Subject: [PATCH 559/695] Update 01-arima.md --- docs/zh/06-advanced/06-data-analysis/01-arima.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/zh/06-advanced/06-data-analysis/01-arima.md b/docs/zh/06-advanced/06-data-analysis/01-arima.md index 30d4b45977db..6799d488871c 100644 --- a/docs/zh/06-advanced/06-data-analysis/01-arima.md +++ b/docs/zh/06-advanced/06-data-analysis/01-arima.md @@ -32,7 +32,12 @@ ARIMA模型是一种自回归模型,只需要自变量即可预测后续的值 `start_p`、`max_p` `start_q` `max_q` 四个参数约束了模型在多大的范围内去搜寻合适的最优解。相同输入数据的条件下,参数范围越大,消耗的资源越多,系统响应的时间越长。 -### 返回结果 +### 示例及结果 +针对 i32 列进行数据预测,输入列 i32 每 10 个点是一个周期,start_p 起始是 1, 最大拟合是 5,start_q是1,最大值是5,预测结果中返回 95% 置信区间范围边界。 +``` +FORECAST(i32, "algo=arima,alpha=95,period=10, start_p=1, max_p=5, start_q=1, max_q=5") +``` + ```json5 { "rows": fc_rows, // 预测结果的行数 From e7bc8de0e1e65ffdfcbbc3000ab6f606f2d32cbf Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Fri, 1 Nov 2024 11:31:03 +0800 Subject: [PATCH 560/695] Update 02-holtwinters.md --- docs/zh/06-advanced/06-data-analysis/02-holtwinters.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/zh/06-advanced/06-data-analysis/02-holtwinters.md b/docs/zh/06-advanced/06-data-analysis/02-holtwinters.md index be3e2490ad55..470ef462539f 100644 --- a/docs/zh/06-advanced/06-data-analysis/02-holtwinters.md +++ b/docs/zh/06-advanced/06-data-analysis/02-holtwinters.md @@ -12,6 +12,7 @@ HoltWinters有两种不同的季节性组成部分,当季节变化在该时间 ### 参数 + 分析平台中使用自动化的 ARIMA 模型进行计算,因此每次计算的时候会根据输入的数据自动拟合最合适的模型,然后根据该模型进行预测输出结果。 |参数名称|说明|必填项| |---|---|---| @@ -21,7 +22,12 @@ HoltWinters有两种不同的季节性组成部分,当季节变化在该时间 参数 `trend` 和 `seasonal`的均可以选择 `add` (加法模型)或 `mul`(乘法模型)。 -### 返回结果 +### 示例及结果 +针对 i32 列进行数据预测,输入列 i32 每 10 个点是一个周期,趋势采用乘法模型,季节采用乘法模型 +``` +FORECAST(i32, "algo=holtwinters,period=10,trend=mul,seasonal=mul") +``` + ```json5 { "rows": rows, // 结果的行数 From 2a248056466945bbd227f48dc71c076adcdcfbb3 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Fri, 1 Nov 2024 11:34:18 +0800 Subject: [PATCH 561/695] add block data capacity --- source/libs/executor/src/groupoperator.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/libs/executor/src/groupoperator.c b/source/libs/executor/src/groupoperator.c index 9cf2a3ea1769..0f85c3346d10 100644 --- a/source/libs/executor/src/groupoperator.c +++ b/source/libs/executor/src/groupoperator.c @@ -1263,7 +1263,10 @@ static SSDataBlock* buildStreamPartitionResult(SOperatorInfo* pOperator) { QUERY_CHECK_CONDITION((hasRemainPartion(pInfo)), code, lino, _end, TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR); SPartitionDataInfo* pParInfo = (SPartitionDataInfo*)pInfo->parIte; blockDataCleanup(pDest); - int32_t rows = taosArrayGetSize(pParInfo->rowIds); + int32_t rows = taosArrayGetSize(pParInfo->rowIds); + code = blockDataEnsureCapacity(pDest, rows); + QUERY_CHECK_CODE(code, lino, _end); + SSDataBlock* pSrc = pInfo->pInputDataBlock; for (int32_t i = 0; i < rows; i++) { int32_t rowIndex = *(int32_t*)taosArrayGet(pParInfo->rowIds, i); From a11a5d67d9e06f3588bef97a89add8ee4e367b47 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Fri, 1 Nov 2024 11:37:24 +0800 Subject: [PATCH 562/695] Update index.md --- docs/zh/06-advanced/06-data-analysis/index.md | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/docs/zh/06-advanced/06-data-analysis/index.md b/docs/zh/06-advanced/06-data-analysis/index.md index 14a871c68fb5..e3bf2f4158f4 100644 --- a/docs/zh/06-advanced/06-data-analysis/index.md +++ b/docs/zh/06-advanced/06-data-analysis/index.md @@ -167,12 +167,9 @@ DROP ANODE {anode_id} #### 白噪声检查 -平台提供Restful的服务检测输入时间序列是否是白噪声时间序列(White Noise Data, WND),白噪声时间序列及随机数序列。 - -此外,分析平台要求输入的数据不能是 , 因此针对的所有数据均默认进行 白噪声检查。当前白噪声检查采用通行的 Ljung-Box检验,Ljung-Box 统计量检查过程需要遍历整个输入序列并进行计算。 - +平台提供 Restful的服务检测输入时间序列是否是白噪声时间序列(White Noise Data, WND),白噪声时间序列及随机数序列。 +此外,分析平台要求输入的数据不能是 , 因此针对的所有数据均默认进行 白噪声检查。当前白噪声检查采用通行的 `Ljung-Box`检验,`Ljung-Box` 统计量检查过程需要遍历整个输入序列并进行计算。 如果用户能够明确输入序列一定不是白噪声序列,那么可以通过输入参数,指定预测之前忽略该检查,从而节省分析过程的 CPU 计算资源。 - 同时支持独立地针对输入序列进行白噪声检测(该检测功能暂不独立对外开放)。 @@ -180,8 +177,8 @@ DROP ANODE {anode_id} 数据分析平台支持将输入的数据进行重采样的预处理,从而确保输出结果按照用户指定的等间隔进行处理。处理过程分为两种类别: - 数据时间戳对齐。由于真实数据时间可能并非严格按照查询指定的时间戳输入。此时数据平台将自动将数据的时间间隔按照指定的时间间隔进行对齐。例如有输入时间序列:[11, 22, 29, 41],用户指定时间间隔为 10,那么该序列将被对齐重整为以下序列 [10, 20, 30, 40]。 - 数据时间重采样。用户输入的时间序列其采样频率超过了指定的查询需要获得结果的时间间隔,例如输入原始数据是 5, 但是输出结果的频率是 10. [0, 5, 10, 15, 20, 25, 30],那么该输入数据列将重采用为间隔 为 10 的输入序列,其结果如下 [0, 10, 20,30]。[5, 15, 25] 处的数据将被丢弃。 +- 数据时间戳对齐。由于真实数据时间可能并非严格按照查询指定的时间戳输入。此时数据平台将自动将数据的时间间隔按照指定的时间间隔进行对齐。例如有输入时间序列:[11, 22, 29, 41],用户指定时间间隔为 10,那么该序列将被对齐重整为以下序列 [10, 20, 30, 40]。 +- 数据时间重采样。用户输入的时间序列其采样频率超过了指定的查询需要获得结果的时间间隔,例如输入原始数据是 5, 但是输出结果的频率是 10. [0, 5, 10, 15, 20, 25, 30],那么该输入数据列将重采用为间隔 为 10 的输入序列,其结果如下 [0, 10, 20,30]。[5, 15, 25] 处的数据将被丢弃。 需要注意的是,数据输入平台不支持缺失数据补齐后进行的预测分析,如果输入时间序列数据[11, 22, 29, 49],并且用户要求的时间间隔为 10, 重整对齐后的序列是 [10, 20, 30, 50] 那么该序列进行预测分析将返回错误。 From 08267fec5ceb1a7149b81912f6669220c52119f0 Mon Sep 17 00:00:00 2001 From: xsren <285808407@qq.com> Date: Fri, 1 Nov 2024 11:40:53 +0800 Subject: [PATCH 563/695] feat: delete report --- source/client/src/clientImpl.c | 3 +- source/client/src/clientMonitor.c | 116 +++++++++++++++++------------- 2 files changed, 69 insertions(+), 50 deletions(-) diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index 13ca874c47dd..04c536a2d0f8 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -2836,6 +2836,7 @@ void syncQueryFn(void* param, void* res, int32_t code) { if (pParam->pRequest) { pParam->pRequest->code = code; + clientOperateReport(pParam->pRequest); } if (TSDB_CODE_SUCCESS != tsem_post(&pParam->sem)) { @@ -2945,8 +2946,6 @@ TAOS_RES* taosQueryImpl(TAOS* taos, const char* sql, bool validateOnly, int8_t s tscDebug("taos_query end with sql:%s", sql); - clientOperateReport(pRequest); - return pRequest; } diff --git a/source/client/src/clientMonitor.c b/source/client/src/clientMonitor.c index 0624d8d94da2..3469543e4d95 100644 --- a/source/client/src/clientMonitor.c +++ b/source/client/src/clientMonitor.c @@ -939,62 +939,82 @@ int32_t reportCB(void* param, SDataBuf* pMsg, int32_t code) { return 0; } -void clientOperateReport(SRequestObj* pRequest) { - if (pRequest == NULL || pRequest->pQuery == NULL) { - tscError("[del report]invalid request"); - return; +int32_t senAuditInfo(STscObj* pTscObj, void* pReq, int32_t len) { + SMsgSendInfo* sendInfo = taosMemoryCalloc(1, sizeof(SMsgSendInfo)); + if (sendInfo == NULL) { + tscError("[del report]failed to allocate memory for sendInfo"); + return terrno; } - if (QUERY_NODE_DELETE_STMT == nodeType(pRequest->pQuery->pRoot)) { - SDeleteStmt* pStmt = (SDeleteStmt*)pRequest->pQuery->pRoot; - STscObj* pTscObj = pRequest->pTscObj; + sendInfo->msgInfo = (SDataBuf){.pData = pReq, .len = len, .handle = NULL}; - if(nodeType(pStmt->pFromTable) != QUERY_NODE_REAL_TABLE) { - tscError("[del report]invalid from table node type:%d", nodeType(pStmt->pFromTable)); - return; - } - SRealTableNode* pTable = (SRealTableNode*)pStmt->pFromTable; - SAuditReq req; - req.pSql = pRequest->sqlstr; - req.sqlLen = pRequest->sqlLen; - tsnprintf(req.table, TSDB_TABLE_NAME_LEN, "%s", pTable->table.tableName); - tsnprintf(req.db, TSDB_DB_FNAME_LEN, "%s", pTable->table.dbName); - tsnprintf(req.operation, AUDIT_OPERATION_LEN, "delete"); - int32_t tlen = tSerializeSAuditReq(NULL, 0, &req); - void* pReq = taosMemoryCalloc(1, tlen); - if (pReq == NULL) { - tscError("[del report]failed to allocate memory for req"); - return; - } + sendInfo->requestId = generateRequestId(); + sendInfo->requestObjRefId = 0; + sendInfo->param = NULL; + sendInfo->fp = reportCB; + sendInfo->msgType = TDMT_MND_AUDIT; - if (tSerializeSAuditReq(pReq, tlen, &req) < 0) { - tscError("[del report]failed to serialize req"); - taosMemoryFree(pReq); - return; - } + SEpSet epSet = getEpSet_s(&pTscObj->pAppInfo->mgmtEp); - SMsgSendInfo* sendInfo = taosMemoryCalloc(1, sizeof(SMsgSendInfo)); - if (sendInfo == NULL) { - tscError("[del report]failed to allocate memory for sendInfo"); - taosMemoryFree(pReq); - return; - } + int32_t code = asyncSendMsgToServer(pTscObj->pAppInfo->pTransporter, &epSet, NULL, sendInfo); + if (code != 0) { + tscError("[del report]failed to send msg to server, code:%d", code); + taosMemoryFree(sendInfo); + return code; + } + return TSDB_CODE_SUCCESS; +} - sendInfo->msgInfo = (SDataBuf){.pData = pReq, .len = tlen, .handle = NULL}; +static void reportDeleteSql(SRequestObj* pRequest) { + SDeleteStmt* pStmt = (SDeleteStmt*)pRequest->pQuery->pRoot; + STscObj* pTscObj = pRequest->pTscObj; - sendInfo->requestId = generateRequestId(); - sendInfo->requestObjRefId = 0; - sendInfo->param = NULL; - sendInfo->fp = reportCB; - sendInfo->msgType = TDMT_MND_AUDIT; + if (pRequest->code != TSDB_CODE_SUCCESS) { + tscDebug("[del report]delete request result code:%d", pRequest->code); + return; + } - SEpSet epSet = getEpSet_s(&pTscObj->pAppInfo->mgmtEp); + if (nodeType(pStmt->pFromTable) != QUERY_NODE_REAL_TABLE) { + tscError("[del report]invalid from table node type:%d", nodeType(pStmt->pFromTable)); + return; + } - int32_t code = asyncSendMsgToServer(pTscObj->pAppInfo->pTransporter, &epSet, NULL, sendInfo); - if (code != 0) { - tscError("[del report]failed to send msg to server, code:%d", code); - taosMemoryFree(sendInfo); - } - tscDebug("[del report]delete data, sql:%s", req.pSql); + SRealTableNode* pTable = (SRealTableNode*)pStmt->pFromTable; + SAuditReq req; + req.pSql = pRequest->sqlstr; + req.sqlLen = pRequest->sqlLen; + tsnprintf(req.table, TSDB_TABLE_NAME_LEN, "%s", pTable->table.tableName); + tsnprintf(req.db, TSDB_DB_FNAME_LEN, "%s", pTable->table.dbName); + tsnprintf(req.operation, AUDIT_OPERATION_LEN, "delete"); + int32_t tlen = tSerializeSAuditReq(NULL, 0, &req); + void* pReq = taosMemoryCalloc(1, tlen); + if (pReq == NULL) { + tscError("[del report]failed to allocate memory for req"); + return; + } + + if (tSerializeSAuditReq(pReq, tlen, &req) < 0) { + tscError("[del report]failed to serialize req"); + taosMemoryFree(pReq); + return; + } + + int32_t code = senAuditInfo(pRequest->pTscObj, pReq, tlen); + if (code != 0) { + tscError("[del report]failed to send audit info, code:%d", code); + taosMemoryFree(pReq); + return; + } + tscDebug("[del report]delete data, sql:%s", req.pSql); +} + +void clientOperateReport(SRequestObj* pRequest) { + if (pRequest == NULL || pRequest->pQuery == NULL) { + tscError("[del report]invalid request"); + return; + } + + if (QUERY_NODE_DELETE_STMT == nodeType(pRequest->pQuery->pRoot)) { + reportDeleteSql(pRequest); } } From 647066c4f9221c4e77cf2291b483a2f51ff3ba7f Mon Sep 17 00:00:00 2001 From: Jinqing Kuang Date: Wed, 30 Oct 2024 15:12:49 +0800 Subject: [PATCH 564/695] enh(query)[TD-32652]: enable AVX implementation with CPU dispatching Extract AVX implementation of specific functions into separate files. The CPU dispatching mechanism will now check the machine's instruction set at runtime to determine whether to use the AVX implementation or fallback to the naive version. This enhancement improves performance on most machines while ensuring compatibility with older hardwares. --- cmake/cmake.define | 41 +- include/util/tcompression.h | 9 +- include/util/tdef.h | 1 + source/libs/function/CMakeLists.txt | 4 + source/libs/function/inc/builtinsimpl.h | 5 + source/libs/function/src/detail/tminmax.c | 349 +++++------------- source/libs/function/src/detail/tminmaxavx.c | 227 ++++++++++++ source/os/src/osEnv.c | 1 - source/util/CMakeLists.txt | 4 + source/util/src/tcompression.c | 53 ++- .../src/{tdecompress.c => tdecompressavx.c} | 120 +++--- 11 files changed, 437 insertions(+), 377 deletions(-) create mode 100644 source/libs/function/src/detail/tminmaxavx.c rename source/util/src/{tdecompress.c => tdecompressavx.c} (95%) diff --git a/cmake/cmake.define b/cmake/cmake.define index 8b762011a483..91e35a1e7be9 100644 --- a/cmake/cmake.define +++ b/cmake/cmake.define @@ -177,48 +177,11 @@ ELSE() SET(COMPILER_SUPPORT_AVX512VL false) ELSE() CHECK_C_COMPILER_FLAG("-mfma" COMPILER_SUPPORT_FMA) + CHECK_C_COMPILER_FLAG("-mavx" COMPILER_SUPPORT_AVX) + CHECK_C_COMPILER_FLAG("-mavx2" COMPILER_SUPPORT_AVX2) CHECK_C_COMPILER_FLAG("-mavx512f" COMPILER_SUPPORT_AVX512F) CHECK_C_COMPILER_FLAG("-mavx512vbmi" COMPILER_SUPPORT_AVX512BMI) CHECK_C_COMPILER_FLAG("-mavx512vl" COMPILER_SUPPORT_AVX512VL) - - INCLUDE(CheckCSourceRuns) - SET(CMAKE_REQUIRED_FLAGS "-mavx") - check_c_source_runs(" - #include - int main() { - __m256d a, b, c; - double buf[4] = {0}; - a = _mm256_loadu_pd(buf); - b = _mm256_loadu_pd(buf); - c = _mm256_add_pd(a, b); - _mm256_storeu_pd(buf, c); - for (int i = 0; i < sizeof(buf) / sizeof(buf[0]); ++i) { - IF (buf[i] != 0) { - return 1; - } - } - return 0; - } - " COMPILER_SUPPORT_AVX) - - SET(CMAKE_REQUIRED_FLAGS "-mavx2") - check_c_source_runs(" - #include - int main() { - __m256i a, b, c; - int buf[8] = {0}; - a = _mm256_loadu_si256((__m256i *)buf); - b = _mm256_loadu_si256((__m256i *)buf); - c = _mm256_and_si256(a, b); - _mm256_storeu_si256((__m256i *)buf, c); - for (int i = 0; i < sizeof(buf) / sizeof(buf[0]); ++i) { - IF (buf[i] != 0) { - return 1; - } - } - return 0; - } - " COMPILER_SUPPORT_AVX2) ENDIF() IF(COMPILER_SUPPORT_SSE42) diff --git a/include/util/tcompression.h b/include/util/tcompression.h index 1f09b750cbea..140b7fe392a3 100644 --- a/include/util/tcompression.h +++ b/include/util/tcompression.h @@ -152,15 +152,12 @@ int32_t tsDecompressBigint(void *pIn, int32_t nIn, int32_t nEle, void *pOut, int // for internal usage int32_t getWordLength(char type); -#ifdef __AVX2__ int32_t tsDecompressIntImpl_Hw(const char *const input, const int32_t nelements, char *const output, const char type); int32_t tsDecompressFloatImpAvx2(const char *input, int32_t nelements, char *output); int32_t tsDecompressDoubleImpAvx2(const char *input, int32_t nelements, char *output); -#endif -#ifdef __AVX512VL__ -void tsDecompressTimestampAvx2(const char *input, int32_t nelements, char *output, bool bigEndian); -void tsDecompressTimestampAvx512(const char *const input, const int32_t nelements, char *const output, bool bigEndian); -#endif +int32_t tsDecompressTimestampAvx2(const char *input, int32_t nelements, char *output, bool bigEndian); +int32_t tsDecompressTimestampAvx512(const char *const input, const int32_t nelements, char *const output, + bool bigEndian); /************************************************************************* * REGULAR COMPRESSION 2 diff --git a/include/util/tdef.h b/include/util/tdef.h index b4cb1bdd1c04..2ed22dc09a48 100644 --- a/include/util/tdef.h +++ b/include/util/tdef.h @@ -41,6 +41,7 @@ extern const int32_t TYPE_BYTES[21]; #define FLOAT_BYTES sizeof(float) #define DOUBLE_BYTES sizeof(double) #define POINTER_BYTES sizeof(void *) +#define M256_BYTES 32 #define TSDB_KEYSIZE sizeof(TSKEY) #define TSDB_NCHAR_SIZE sizeof(TdUcs4) diff --git a/source/libs/function/CMakeLists.txt b/source/libs/function/CMakeLists.txt index 4164852111cc..d5c9cccc0eaa 100644 --- a/source/libs/function/CMakeLists.txt +++ b/source/libs/function/CMakeLists.txt @@ -1,6 +1,10 @@ aux_source_directory(src FUNCTION_SRC) aux_source_directory(src/detail FUNCTION_SRC_DETAIL) list(REMOVE_ITEM FUNCTION_SRC src/udfd.c) +IF(COMPILER_SUPPORT_AVX2) + MESSAGE(STATUS "AVX2 instructions is ACTIVATED") + set_source_files_properties(src/detail/tminmaxavx.c PROPERTIES COMPILE_FLAGS -mavx2) +ENDIF() add_library(function STATIC ${FUNCTION_SRC} ${FUNCTION_SRC_DETAIL}) target_include_directories( function diff --git a/source/libs/function/inc/builtinsimpl.h b/source/libs/function/inc/builtinsimpl.h index 36e53d0a80ee..a1c82dc58b79 100644 --- a/source/libs/function/inc/builtinsimpl.h +++ b/source/libs/function/inc/builtinsimpl.h @@ -25,6 +25,11 @@ extern "C" { #include "functionResInfoInt.h" int32_t doMinMaxHelper(SqlFunctionCtx* pCtx, int32_t isMinFunc, int32_t* nElems); +int32_t i8VectorCmpAVX2(const void* pData, int32_t numOfRows, bool isMinFunc, bool signVal, int64_t* res); +int32_t i16VectorCmpAVX2(const void* pData, int32_t numOfRows, bool isMinFunc, bool signVal, int64_t* res); +int32_t i32VectorCmpAVX2(const void* pData, int32_t numOfRows, bool isMinFunc, bool signVal, int64_t* res); +int32_t floatVectorCmpAVX2(const float* pData, int32_t numOfRows, bool isMinFunc, float* res); +int32_t doubleVectorCmpAVX2(const double* pData, int32_t numOfRows, bool isMinFunc, double* res); int32_t saveTupleData(SqlFunctionCtx* pCtx, int32_t rowIndex, const SSDataBlock* pSrcBlock, STuplePos* pPos); int32_t updateTupleData(SqlFunctionCtx* pCtx, int32_t rowIndex, const SSDataBlock* pSrcBlock, STuplePos* pPos); diff --git a/source/libs/function/src/detail/tminmax.c b/source/libs/function/src/detail/tminmax.c index 69c1a8a6ddc7..87120960331b 100644 --- a/source/libs/function/src/detail/tminmax.c +++ b/source/libs/function/src/detail/tminmax.c @@ -72,173 +72,6 @@ #define GET_INVOKE_INTRINSIC_THRESHOLD(_bits, _bytes) ((_bits) / ((_bytes) << 3u)) -#ifdef __AVX2__ -static void calculateRounds(int32_t numOfRows, int32_t bytes, int32_t* remainder, int32_t* rounds, int32_t* width) { - const int32_t bitWidth = 256; - - *width = (bitWidth >> 3u) / bytes; - *remainder = numOfRows % (*width); - *rounds = numOfRows / (*width); -} - -#define EXTRACT_MAX_VAL(_first, _sec, _width, _remain, _v) \ - __COMPARE_EXTRACT_MAX(0, (_width), (_v), (_first)) \ - __COMPARE_EXTRACT_MAX(0, (_remain), (_v), (_sec)) - -#define EXTRACT_MIN_VAL(_first, _sec, _width, _remain, _v) \ - __COMPARE_EXTRACT_MIN(0, (_width), (_v), (_first)) \ - __COMPARE_EXTRACT_MIN(0, (_remain), (_v), (_sec)) - -#define CMP_TYPE_MIN_MAX(type, cmp) \ - const type* p = pData; \ - __m256i initVal = _mm256_lddqu_si256((__m256i*)p); \ - p += width; \ - for (int32_t i = 1; i < (rounds); ++i) { \ - __m256i next = _mm256_lddqu_si256((__m256i*)p); \ - initVal = CMP_FUNC_##cmp##_##type(initVal, next); \ - p += width; \ - } \ - const type* q = (const type*)&initVal; \ - type* v = (type*)res; \ - EXTRACT_##cmp##_VAL(q, p, width, remain, *v) - -static void i8VectorCmpAVX2(const void* pData, int32_t numOfRows, bool isMinFunc, bool signVal, int64_t* res) { - const int8_t* p = pData; - - int32_t width, remain, rounds; - calculateRounds(numOfRows, sizeof(int8_t), &remain, &rounds, &width); - -#define CMP_FUNC_MIN_int8_t _mm256_min_epi8 -#define CMP_FUNC_MAX_int8_t _mm256_max_epi8 -#define CMP_FUNC_MIN_uint8_t _mm256_min_epu8 -#define CMP_FUNC_MAX_uint8_t _mm256_max_epu8 - - if (!isMinFunc) { // max function - if (signVal) { - CMP_TYPE_MIN_MAX(int8_t, MAX); - } else { - CMP_TYPE_MIN_MAX(uint8_t, MAX); - } - } else { // min function - if (signVal) { - CMP_TYPE_MIN_MAX(int8_t, MIN); - } else { - CMP_TYPE_MIN_MAX(uint8_t, MIN); - } - } -} - -static void i16VectorCmpAVX2(const void* pData, int32_t numOfRows, bool isMinFunc, bool signVal, int64_t* res) { - int32_t width, remain, rounds; - calculateRounds(numOfRows, sizeof(int16_t), &remain, &rounds, &width); - -#define CMP_FUNC_MIN_int16_t _mm256_min_epi16 -#define CMP_FUNC_MAX_int16_t _mm256_max_epi16 -#define CMP_FUNC_MIN_uint16_t _mm256_min_epu16 -#define CMP_FUNC_MAX_uint16_t _mm256_max_epu16 - if (!isMinFunc) { // max function - if (signVal) { - CMP_TYPE_MIN_MAX(int16_t, MAX); - } else { - CMP_TYPE_MIN_MAX(uint16_t, MAX); - } - } else { // min function - if (signVal) { - CMP_TYPE_MIN_MAX(int16_t, MIN); - } else { - CMP_TYPE_MIN_MAX(uint16_t, MIN); - } - } -} - -static void i32VectorCmpAVX2(const void* pData, int32_t numOfRows, bool isMinFunc, bool signVal, int64_t* res) { - int32_t width, remain, rounds; - calculateRounds(numOfRows, sizeof(int32_t), &remain, &rounds, &width); - -#define CMP_FUNC_MIN_int32_t _mm256_min_epi32 -#define CMP_FUNC_MAX_int32_t _mm256_max_epi32 -#define CMP_FUNC_MIN_uint32_t _mm256_min_epu32 -#define CMP_FUNC_MAX_uint32_t _mm256_max_epu32 - if (!isMinFunc) { // max function - if (signVal) { - CMP_TYPE_MIN_MAX(int32_t, MAX); - } else { - CMP_TYPE_MIN_MAX(uint32_t, MAX); - } - } else { // min function - if (signVal) { - CMP_TYPE_MIN_MAX(int32_t, MIN); - } else { - CMP_TYPE_MIN_MAX(uint32_t, MIN); - } - } -} - -static void floatVectorCmpAVX2(const float* pData, int32_t numOfRows, bool isMinFunc, float* res) { - const float* p = pData; - - int32_t width, remain, rounds; - calculateRounds(numOfRows, sizeof(float), &remain, &rounds, &width); - - __m256 next; - __m256 initVal = _mm256_loadu_ps(p); - p += width; - - if (!isMinFunc) { // max function - for (int32_t i = 1; i < rounds; ++i) { - next = _mm256_loadu_ps(p); - initVal = _mm256_max_ps(initVal, next); - p += width; - } - - const float* q = (const float*)&initVal; - EXTRACT_MAX_VAL(q, p, width, remain, *res) - } else { // min function - for (int32_t i = 1; i < rounds; ++i) { - next = _mm256_loadu_ps(p); - initVal = _mm256_min_ps(initVal, next); - p += width; - } - - const float* q = (const float*)&initVal; - EXTRACT_MIN_VAL(q, p, width, remain, *res) - } -} - -static void doubleVectorCmpAVX2(const double* pData, int32_t numOfRows, bool isMinFunc, double* res) { - const double* p = pData; - - int32_t width, remain, rounds; - calculateRounds(numOfRows, sizeof(double), &remain, &rounds, &width); - - __m256d next; - __m256d initVal = _mm256_loadu_pd(p); - p += width; - - if (!isMinFunc) { // max function - for (int32_t i = 1; i < rounds; ++i) { - next = _mm256_loadu_pd(p); - initVal = _mm256_max_pd(initVal, next); - p += width; - } - - // let sum up the final results - const double* q = (const double*)&initVal; - EXTRACT_MAX_VAL(q, p, width, remain, *res) - } else { // min function - for (int32_t i = 1; i < rounds; ++i) { - next = _mm256_loadu_pd(p); - initVal = _mm256_min_pd(initVal, next); - p += width; - } - - // let sum up the final results - const double* q = (const double*)&initVal; - EXTRACT_MIN_VAL(q, p, width, remain, *res) - } -} -#endif - static int32_t findFirstValPosition(const SColumnInfoData* pCol, int32_t start, int32_t numOfRows, bool isStr) { int32_t i = start; @@ -255,31 +88,31 @@ static void handleInt8Col(const void* data, int32_t start, int32_t numOfRows, SM pBuf->v = ((const int8_t*)data)[start]; } -#ifdef __AVX2__ - if (tsAVX2Supported && tsSIMDEnable && numOfRows * sizeof(int8_t) >= sizeof(__m256i)) { - i8VectorCmpAVX2(data + start * sizeof(int8_t), numOfRows, isMinFunc, signVal, &pBuf->v); - } else { -#else - if (true) { -#endif - if (signVal) { - const int8_t* p = (const int8_t*)data; - int8_t* v = (int8_t*)&pBuf->v; - - if (isMinFunc) { - __COMPARE_EXTRACT_MIN(start, start + numOfRows, *v, p); - } else { - __COMPARE_EXTRACT_MAX(start, start + numOfRows, *v, p); - } + if (tsAVX2Supported && tsSIMDEnable && numOfRows * sizeof(int8_t) >= M256_BYTES) { + int32_t code = i8VectorCmpAVX2(((char*)data) + start * sizeof(int8_t), numOfRows, isMinFunc, signVal, &pBuf->v); + if (code == TSDB_CODE_SUCCESS) { + pBuf->assign = true; + return; + } + } + + if (signVal) { + const int8_t* p = (const int8_t*)data; + int8_t* v = (int8_t*)&pBuf->v; + + if (isMinFunc) { + __COMPARE_EXTRACT_MIN(start, start + numOfRows, *v, p); } else { - const uint8_t* p = (const uint8_t*)data; - uint8_t* v = (uint8_t*)&pBuf->v; + __COMPARE_EXTRACT_MAX(start, start + numOfRows, *v, p); + } + } else { + const uint8_t* p = (const uint8_t*)data; + uint8_t* v = (uint8_t*)&pBuf->v; - if (isMinFunc) { - __COMPARE_EXTRACT_MIN(start, start + numOfRows, *v, p); - } else { - __COMPARE_EXTRACT_MAX(start, start + numOfRows, *v, p); - } + if (isMinFunc) { + __COMPARE_EXTRACT_MIN(start, start + numOfRows, *v, p); + } else { + __COMPARE_EXTRACT_MAX(start, start + numOfRows, *v, p); } } @@ -292,31 +125,31 @@ static void handleInt16Col(const void* data, int32_t start, int32_t numOfRows, S pBuf->v = ((const int16_t*)data)[start]; } -#ifdef __AVX2__ - if (tsAVX2Supported && tsSIMDEnable && numOfRows * sizeof(int16_t) >= sizeof(__m256i)) { - i16VectorCmpAVX2(data + start * sizeof(int16_t), numOfRows, isMinFunc, signVal, &pBuf->v); - } else { -#else - if (true) { -#endif - if (signVal) { - const int16_t* p = (const int16_t*)data; - int16_t* v = (int16_t*)&pBuf->v; - - if (isMinFunc) { - __COMPARE_EXTRACT_MIN(start, start + numOfRows, *v, p); - } else { - __COMPARE_EXTRACT_MAX(start, start + numOfRows, *v, p); - } + if (tsAVX2Supported && tsSIMDEnable && numOfRows * sizeof(int16_t) >= M256_BYTES) { + int32_t code = i16VectorCmpAVX2(((char*)data) + start * sizeof(int16_t), numOfRows, isMinFunc, signVal, &pBuf->v); + if (code == TSDB_CODE_SUCCESS) { + pBuf->assign = true; + return; + } + } + + if (signVal) { + const int16_t* p = (const int16_t*)data; + int16_t* v = (int16_t*)&pBuf->v; + + if (isMinFunc) { + __COMPARE_EXTRACT_MIN(start, start + numOfRows, *v, p); } else { - const uint16_t* p = (const uint16_t*)data; - uint16_t* v = (uint16_t*)&pBuf->v; + __COMPARE_EXTRACT_MAX(start, start + numOfRows, *v, p); + } + } else { + const uint16_t* p = (const uint16_t*)data; + uint16_t* v = (uint16_t*)&pBuf->v; - if (isMinFunc) { - __COMPARE_EXTRACT_MIN(start, start + numOfRows, *v, p); - } else { - __COMPARE_EXTRACT_MAX(start, start + numOfRows, *v, p); - } + if (isMinFunc) { + __COMPARE_EXTRACT_MIN(start, start + numOfRows, *v, p); + } else { + __COMPARE_EXTRACT_MAX(start, start + numOfRows, *v, p); } } @@ -329,31 +162,31 @@ static void handleInt32Col(const void* data, int32_t start, int32_t numOfRows, S pBuf->v = ((const int32_t*)data)[start]; } -#ifdef __AVX2__ - if (tsAVX2Supported && tsSIMDEnable && numOfRows * sizeof(int32_t) >= sizeof(__m256i)) { - i32VectorCmpAVX2(data + start * sizeof(int32_t), numOfRows, isMinFunc, signVal, &pBuf->v); - } else { -#else - if (true) { -#endif - if (signVal) { - const int32_t* p = (const int32_t*)data; - int32_t* v = (int32_t*)&pBuf->v; - - if (isMinFunc) { - __COMPARE_EXTRACT_MIN(start, start + numOfRows, *v, p); - } else { - __COMPARE_EXTRACT_MAX(start, start + numOfRows, *v, p); - } + if (tsAVX2Supported && tsSIMDEnable && numOfRows * sizeof(int32_t) >= M256_BYTES) { + int32_t code = i32VectorCmpAVX2(((char*)data) + start * sizeof(int32_t), numOfRows, isMinFunc, signVal, &pBuf->v); + if (code == TSDB_CODE_SUCCESS) { + pBuf->assign = true; + return; + } + } + + if (signVal) { + const int32_t* p = (const int32_t*)data; + int32_t* v = (int32_t*)&pBuf->v; + + if (isMinFunc) { + __COMPARE_EXTRACT_MIN(start, start + numOfRows, *v, p); } else { - const uint32_t* p = (const uint32_t*)data; - uint32_t* v = (uint32_t*)&pBuf->v; + __COMPARE_EXTRACT_MAX(start, start + numOfRows, *v, p); + } + } else { + const uint32_t* p = (const uint32_t*)data; + uint32_t* v = (uint32_t*)&pBuf->v; - if (isMinFunc) { - __COMPARE_EXTRACT_MIN(start, start + numOfRows, *v, p); - } else { - __COMPARE_EXTRACT_MAX(start, start + numOfRows, *v, p); - } + if (isMinFunc) { + __COMPARE_EXTRACT_MIN(start, start + numOfRows, *v, p); + } else { + __COMPARE_EXTRACT_MAX(start, start + numOfRows, *v, p); } } @@ -397,20 +230,20 @@ static void handleFloatCol(SColumnInfoData* pCol, int32_t start, int32_t numOfRo *val = pData[start]; } -#ifdef __AVX2__ - if (tsAVXSupported && tsSIMDEnable && numOfRows * sizeof(float) >= sizeof(__m256i)) { - floatVectorCmpAVX2(pData + start, numOfRows, isMinFunc, val); - } else { -#else - if (true) { -#endif - if (isMinFunc) { // min - __COMPARE_EXTRACT_MIN(start, start + numOfRows, *val, pData); - } else { // max - __COMPARE_EXTRACT_MAX(start, start + numOfRows, *val, pData); + if (tsAVX2Supported && tsSIMDEnable && numOfRows * sizeof(float) >= M256_BYTES) { + int32_t code = floatVectorCmpAVX2(pData + start, numOfRows, isMinFunc, val); + if (code == TSDB_CODE_SUCCESS) { + pBuf->assign = true; + return; } } + if (isMinFunc) { // min + __COMPARE_EXTRACT_MIN(start, start + numOfRows, *val, pData); + } else { // max + __COMPARE_EXTRACT_MAX(start, start + numOfRows, *val, pData); + } + pBuf->assign = true; } @@ -422,20 +255,20 @@ static void handleDoubleCol(SColumnInfoData* pCol, int32_t start, int32_t numOfR *val = pData[start]; } -#ifdef __AVX2__ - if (tsAVXSupported && tsSIMDEnable && numOfRows * sizeof(double) >= sizeof(__m256i)) { - doubleVectorCmpAVX2(pData + start, numOfRows, isMinFunc, val); - } else { -#else - if (true) { -#endif - if (isMinFunc) { // min - __COMPARE_EXTRACT_MIN(start, start + numOfRows, *val, pData); - } else { // max - __COMPARE_EXTRACT_MAX(start, start + numOfRows, *val, pData); + if (tsAVX2Supported && tsSIMDEnable && numOfRows * sizeof(double) >= M256_BYTES) { + int32_t code = doubleVectorCmpAVX2(pData + start, numOfRows, isMinFunc, val); + if (code == TSDB_CODE_SUCCESS) { + pBuf->assign = true; + return; } } + if (isMinFunc) { // min + __COMPARE_EXTRACT_MIN(start, start + numOfRows, *val, pData); + } else { // max + __COMPARE_EXTRACT_MAX(start, start + numOfRows, *val, pData); + } + pBuf->assign = true; } diff --git a/source/libs/function/src/detail/tminmaxavx.c b/source/libs/function/src/detail/tminmaxavx.c new file mode 100644 index 000000000000..8fe6cc5448f8 --- /dev/null +++ b/source/libs/function/src/detail/tminmaxavx.c @@ -0,0 +1,227 @@ +/* + * 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 "builtinsimpl.h" + +#ifdef __AVX2__ +static void calculateRounds(int32_t numOfRows, int32_t bytes, int32_t* remainder, int32_t* rounds, int32_t* width) { + const int32_t bitWidth = 256; + + *width = (bitWidth >> 3u) / bytes; + *remainder = numOfRows % (*width); + *rounds = numOfRows / (*width); +} + +#define __COMPARE_EXTRACT_MIN(start, end, val, _data) \ + for (int32_t i = (start); i < (end); ++i) { \ + if ((val) > (_data)[i]) { \ + (val) = (_data)[i]; \ + } \ + } + +#define __COMPARE_EXTRACT_MAX(start, end, val, _data) \ + for (int32_t i = (start); i < (end); ++i) { \ + if ((val) < (_data)[i]) { \ + (val) = (_data)[i]; \ + } \ + } + +#define EXTRACT_MAX_VAL(_first, _sec, _width, _remain, _v) \ + __COMPARE_EXTRACT_MAX(0, (_width), (_v), (_first)) \ + __COMPARE_EXTRACT_MAX(0, (_remain), (_v), (_sec)) + +#define EXTRACT_MIN_VAL(_first, _sec, _width, _remain, _v) \ + __COMPARE_EXTRACT_MIN(0, (_width), (_v), (_first)) \ + __COMPARE_EXTRACT_MIN(0, (_remain), (_v), (_sec)) + +#define CMP_TYPE_MIN_MAX(type, cmp) \ + const type* p = pData; \ + __m256i initVal = _mm256_lddqu_si256((__m256i*)p); \ + p += width; \ + for (int32_t i = 1; i < (rounds); ++i) { \ + __m256i next = _mm256_lddqu_si256((__m256i*)p); \ + initVal = CMP_FUNC_##cmp##_##type(initVal, next); \ + p += width; \ + } \ + const type* q = (const type*)&initVal; \ + type* v = (type*)res; \ + EXTRACT_##cmp##_VAL(q, p, width, remain, *v) +#endif + +int32_t i8VectorCmpAVX2(const void* pData, int32_t numOfRows, bool isMinFunc, bool signVal, int64_t* res) { +#ifdef __AVX2__ + const int8_t* p = pData; + + int32_t width, remain, rounds; + calculateRounds(numOfRows, sizeof(int8_t), &remain, &rounds, &width); + +#define CMP_FUNC_MIN_int8_t _mm256_min_epi8 +#define CMP_FUNC_MAX_int8_t _mm256_max_epi8 +#define CMP_FUNC_MIN_uint8_t _mm256_min_epu8 +#define CMP_FUNC_MAX_uint8_t _mm256_max_epu8 + + if (!isMinFunc) { // max function + if (signVal) { + CMP_TYPE_MIN_MAX(int8_t, MAX); + } else { + CMP_TYPE_MIN_MAX(uint8_t, MAX); + } + } else { // min function + if (signVal) { + CMP_TYPE_MIN_MAX(int8_t, MIN); + } else { + CMP_TYPE_MIN_MAX(uint8_t, MIN); + } + } + return TSDB_CODE_SUCCESS; +#else + uError("unable run %s without avx2 instructions", __func__); + return TSDB_CODE_OPS_NOT_SUPPORT; +#endif +} + +int32_t i16VectorCmpAVX2(const void* pData, int32_t numOfRows, bool isMinFunc, bool signVal, int64_t* res) { +#ifdef __AVX2__ + int32_t width, remain, rounds; + calculateRounds(numOfRows, sizeof(int16_t), &remain, &rounds, &width); + +#define CMP_FUNC_MIN_int16_t _mm256_min_epi16 +#define CMP_FUNC_MAX_int16_t _mm256_max_epi16 +#define CMP_FUNC_MIN_uint16_t _mm256_min_epu16 +#define CMP_FUNC_MAX_uint16_t _mm256_max_epu16 + if (!isMinFunc) { // max function + if (signVal) { + CMP_TYPE_MIN_MAX(int16_t, MAX); + } else { + CMP_TYPE_MIN_MAX(uint16_t, MAX); + } + } else { // min function + if (signVal) { + CMP_TYPE_MIN_MAX(int16_t, MIN); + } else { + CMP_TYPE_MIN_MAX(uint16_t, MIN); + } + } + return TSDB_CODE_SUCCESS; +#else + uError("unable run %s without avx2 instructions", __func__); + return TSDB_CODE_OPS_NOT_SUPPORT; +#endif +} + +int32_t i32VectorCmpAVX2(const void* pData, int32_t numOfRows, bool isMinFunc, bool signVal, int64_t* res) { +#ifdef __AVX2__ + int32_t width, remain, rounds; + calculateRounds(numOfRows, sizeof(int32_t), &remain, &rounds, &width); + +#define CMP_FUNC_MIN_int32_t _mm256_min_epi32 +#define CMP_FUNC_MAX_int32_t _mm256_max_epi32 +#define CMP_FUNC_MIN_uint32_t _mm256_min_epu32 +#define CMP_FUNC_MAX_uint32_t _mm256_max_epu32 + if (!isMinFunc) { // max function + if (signVal) { + CMP_TYPE_MIN_MAX(int32_t, MAX); + } else { + CMP_TYPE_MIN_MAX(uint32_t, MAX); + } + } else { // min function + if (signVal) { + CMP_TYPE_MIN_MAX(int32_t, MIN); + } else { + CMP_TYPE_MIN_MAX(uint32_t, MIN); + } + } + return TSDB_CODE_SUCCESS; +#else + uError("unable run %s without avx2 instructions", __func__); + return TSDB_CODE_OPS_NOT_SUPPORT; +#endif +} + +int32_t floatVectorCmpAVX2(const float* pData, int32_t numOfRows, bool isMinFunc, float* res) { +#ifdef __AVX2__ + const float* p = pData; + + int32_t width, remain, rounds; + calculateRounds(numOfRows, sizeof(float), &remain, &rounds, &width); + + __m256 next; + __m256 initVal = _mm256_loadu_ps(p); + p += width; + + if (!isMinFunc) { // max function + for (int32_t i = 1; i < rounds; ++i) { + next = _mm256_loadu_ps(p); + initVal = _mm256_max_ps(initVal, next); + p += width; + } + + const float* q = (const float*)&initVal; + EXTRACT_MAX_VAL(q, p, width, remain, *res) + } else { // min function + for (int32_t i = 1; i < rounds; ++i) { + next = _mm256_loadu_ps(p); + initVal = _mm256_min_ps(initVal, next); + p += width; + } + + const float* q = (const float*)&initVal; + EXTRACT_MIN_VAL(q, p, width, remain, *res) + } + return TSDB_CODE_SUCCESS; +#else + uError("unable run %s without avx2 instructions", __func__); + return TSDB_CODE_OPS_NOT_SUPPORT; +#endif +} + +int32_t doubleVectorCmpAVX2(const double* pData, int32_t numOfRows, bool isMinFunc, double* res) { +#ifdef __AVX2__ + const double* p = pData; + + int32_t width, remain, rounds; + calculateRounds(numOfRows, sizeof(double), &remain, &rounds, &width); + + __m256d next; + __m256d initVal = _mm256_loadu_pd(p); + p += width; + + if (!isMinFunc) { // max function + for (int32_t i = 1; i < rounds; ++i) { + next = _mm256_loadu_pd(p); + initVal = _mm256_max_pd(initVal, next); + p += width; + } + + // let sum up the final results + const double* q = (const double*)&initVal; + EXTRACT_MAX_VAL(q, p, width, remain, *res) + } else { // min function + for (int32_t i = 1; i < rounds; ++i) { + next = _mm256_loadu_pd(p); + initVal = _mm256_min_pd(initVal, next); + p += width; + } + + // let sum up the final results + const double* q = (const double*)&initVal; + EXTRACT_MIN_VAL(q, p, width, remain, *res) + } + return TSDB_CODE_SUCCESS; +#else + uError("unable run %s without avx2 instructions", __func__); + return TSDB_CODE_OPS_NOT_SUPPORT; +#endif +} diff --git a/source/os/src/osEnv.c b/source/os/src/osEnv.c index a3791eb02678..05c9936c2eae 100644 --- a/source/os/src/osEnv.c +++ b/source/os/src/osEnv.c @@ -37,7 +37,6 @@ float tsNumOfCores = 0; int64_t tsTotalMemoryKB = 0; char *tsProcPath = NULL; -char tsSIMDEnable = 1; char tsAVX512Enable = 0; char tsSSE42Supported = 0; char tsAVXSupported = 0; diff --git a/source/util/CMakeLists.txt b/source/util/CMakeLists.txt index 063988ea00c5..7f5955f3ddb6 100644 --- a/source/util/CMakeLists.txt +++ b/source/util/CMakeLists.txt @@ -1,5 +1,9 @@ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/src/version.c.in" "${CMAKE_CURRENT_SOURCE_DIR}/src/version.c") aux_source_directory(src UTIL_SRC) +IF(COMPILER_SUPPORT_AVX2) + MESSAGE(STATUS "AVX2 instructions is ACTIVATED") + set_source_files_properties(src/tdecompressavx.c PROPERTIES COMPILE_FLAGS -mavx2) +ENDIF() add_library(util STATIC ${UTIL_SRC}) if(DEFINED GRANT_CFG_INCLUDE_DIR) diff --git a/source/util/src/tcompression.c b/source/util/src/tcompression.c index 9c9ded693e03..525ee71126b6 100644 --- a/source/util/src/tcompression.c +++ b/source/util/src/tcompression.c @@ -471,12 +471,12 @@ int32_t tsDecompressINTImp(const char *const input, const int32_t nelements, cha return nelements * word_length; } -#ifdef __AVX512F__ if (tsSIMDEnable && tsAVX512Enable && tsAVX512Supported) { - tsDecompressIntImpl_Hw(input, nelements, output, type); - return nelements * word_length; + int32_t cnt = tsDecompressIntImpl_Hw(input, nelements, output, type); + if (cnt >= 0) { + return cnt; + } } -#endif // Selector value: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 char bit_per_integer[] = {0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 15, 20, 30, 60}; @@ -867,12 +867,12 @@ int32_t tsDecompressTimestampImp(const char *const input, const int32_t nelement memcpy(output, input + 1, nelements * longBytes); return nelements * longBytes; } else if (input[0] == 1) { // Decompress -#ifdef __AVX512VL__ if (tsSIMDEnable && tsAVX512Enable && tsAVX512Supported) { - tsDecompressTimestampAvx512(const char *const input, const int32_t nelements, char *const output, bool bigEndian); - return nelements * longBytes; + int32_t cnt = tsDecompressTimestampAvx512(input, nelements, output, false); + if (cnt >= 0) { + return cnt; + } } -#endif int64_t *ostream = (int64_t *)output; @@ -1103,13 +1103,14 @@ int32_t tsDecompressDoubleImp(const char *const input, int32_t ninput, const int return nelements * DOUBLE_BYTES; } -#ifdef __AVX2__ // use AVX2 implementation when allowed and the compression ratio is not high double compressRatio = 1.0 * nelements * DOUBLE_BYTES / ninput; if (tsSIMDEnable && tsAVX2Supported && compressRatio < 2) { - return tsDecompressDoubleImpAvx2(input + 1, nelements, output); + int32_t cnt = tsDecompressDoubleImpAvx2(input + 1, nelements, output); + if (cnt >= 0) { + return cnt; + } } -#endif // use implementation without SIMD instructions by default return tsDecompressDoubleImpHelper(input + 1, nelements, output); @@ -1257,13 +1258,14 @@ int32_t tsDecompressFloatImp(const char *const input, int32_t ninput, const int3 return nelements * FLOAT_BYTES; } -#ifdef __AVX2__ // use AVX2 implementation when allowed and the compression ratio is not high double compressRatio = 1.0 * nelements * FLOAT_BYTES / ninput; if (tsSIMDEnable && tsAVX2Supported && compressRatio < 2) { - return tsDecompressFloatImpAvx2(input + 1, nelements, output); + int32_t cnt = tsDecompressFloatImpAvx2(input + 1, nelements, output); + if (cnt >= 0) { + return cnt; + } } -#endif // use implementation without SIMD instructions by default return tsDecompressFloatImpHelper(input + 1, nelements, output); @@ -1883,3 +1885,26 @@ int8_t tUpdateCompress(uint32_t oldCmpr, uint32_t newCmpr, uint8_t l2Disabled, u return update; } + +int32_t getWordLength(char type) { + int32_t wordLength = 0; + switch (type) { + case TSDB_DATA_TYPE_BIGINT: + wordLength = LONG_BYTES; + break; + case TSDB_DATA_TYPE_INT: + wordLength = INT_BYTES; + break; + case TSDB_DATA_TYPE_SMALLINT: + wordLength = SHORT_BYTES; + break; + case TSDB_DATA_TYPE_TINYINT: + wordLength = CHAR_BYTES; + break; + default: + uError("Invalid decompress integer type:%d", type); + return TSDB_CODE_INVALID_PARA; + } + + return wordLength; +} diff --git a/source/util/src/tdecompress.c b/source/util/src/tdecompressavx.c similarity index 95% rename from source/util/src/tdecompress.c rename to source/util/src/tdecompressavx.c index 81223d73111a..143867b783e1 100644 --- a/source/util/src/tdecompress.c +++ b/source/util/src/tdecompressavx.c @@ -13,35 +13,16 @@ * along with this program. If not, see . */ -#include "os.h" #include "tcompression.h" -#include "ttypes.h" - -int32_t getWordLength(char type) { - int32_t wordLength = 0; - switch (type) { - case TSDB_DATA_TYPE_BIGINT: - wordLength = LONG_BYTES; - break; - case TSDB_DATA_TYPE_INT: - wordLength = INT_BYTES; - break; - case TSDB_DATA_TYPE_SMALLINT: - wordLength = SHORT_BYTES; - break; - case TSDB_DATA_TYPE_TINYINT: - wordLength = CHAR_BYTES; - break; - default: - uError("Invalid decompress integer type:%d", type); - return TSDB_CODE_INVALID_PARA; - } - - return wordLength; -} #ifdef __AVX2__ +char tsSIMDEnable = 1; +#else +char tsSIMDEnable = 0; +#endif + int32_t tsDecompressIntImpl_Hw(const char *const input, const int32_t nelements, char *const output, const char type) { +#ifdef __AVX2__ int32_t word_length = getWordLength(type); // Selector value: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 @@ -75,12 +56,12 @@ int32_t tsDecompressIntImpl_Hw(const char *const input, const int32_t nelements, int32_t batch = 0; int32_t remain = 0; if (tsSIMDEnable && tsAVX512Supported && tsAVX512Enable) { -#if __AVX512F__ +#ifdef __AVX512F__ batch = num >> 3; remain = num & 0x07; #endif } else if (tsSIMDEnable && tsAVX2Supported) { -#if __AVX2__ +#ifdef __AVX2__ batch = num >> 2; remain = num & 0x03; #endif @@ -88,7 +69,7 @@ int32_t tsDecompressIntImpl_Hw(const char *const input, const int32_t nelements, if (selector == 0 || selector == 1) { if (tsSIMDEnable && tsAVX512Supported && tsAVX512Enable) { -#if __AVX512F__ +#ifdef __AVX512F__ for (int32_t i = 0; i < batch; ++i) { __m512i prev = _mm512_set1_epi64(prevValue); _mm512_storeu_si512((__m512i *)&p[_pos], prev); @@ -117,7 +98,7 @@ int32_t tsDecompressIntImpl_Hw(const char *const input, const int32_t nelements, } } else { if (tsSIMDEnable && tsAVX512Supported && tsAVX512Enable) { -#if __AVX512F__ +#ifdef __AVX512F__ __m512i sum_mask1 = _mm512_set_epi64(6, 6, 4, 4, 2, 2, 0, 0); __m512i sum_mask2 = _mm512_set_epi64(5, 5, 5, 5, 1, 1, 1, 1); __m512i sum_mask3 = _mm512_set_epi64(3, 3, 3, 3, 3, 3, 3, 3); @@ -310,10 +291,13 @@ int32_t tsDecompressIntImpl_Hw(const char *const input, const int32_t nelements, } return nelements * word_length; +#else + uError("unable run %s without avx2 instructions", __func__); + return -1; +#endif } -#define M256_BYTES sizeof(__m256i) - +#ifdef __AVX2__ FORCE_INLINE __m256i decodeFloatAvx2(const char *data, const char *flag) { __m256i dataVec = _mm256_load_si256((__m256i *)data); __m256i flagVec = _mm256_load_si256((__m256i *)flag); @@ -332,7 +316,27 @@ FORCE_INLINE __m256i decodeFloatAvx2(const char *data, const char *flag) { return diffVec; } +FORCE_INLINE __m256i decodeDoubleAvx2(const char *data, const char *flag) { + __m256i dataVec = _mm256_load_si256((__m256i *)data); + __m256i flagVec = _mm256_load_si256((__m256i *)flag); + __m256i k7 = _mm256_set1_epi64x(7); + __m256i lopart = _mm256_set_epi64x(0, -1, 0, -1); + __m256i hipart = _mm256_set_epi64x(-1, 0, -1, 0); + __m256i trTail = _mm256_cmpgt_epi64(flagVec, k7); + __m256i trHead = _mm256_andnot_si256(trTail, _mm256_set1_epi64x(-1)); + __m256i shiftVec = _mm256_slli_epi64(_mm256_sub_epi64(k7, _mm256_and_si256(flagVec, k7)), 3); + __m256i maskVec = hipart; + __m256i diffVec = _mm256_sllv_epi64(dataVec, _mm256_and_si256(shiftVec, maskVec)); + maskVec = _mm256_or_si256(trHead, lopart); + diffVec = _mm256_srlv_epi64(diffVec, _mm256_and_si256(shiftVec, maskVec)); + maskVec = _mm256_and_si256(trTail, lopart); + diffVec = _mm256_sllv_epi64(diffVec, _mm256_and_si256(shiftVec, maskVec)); + return diffVec; +} +#endif + int32_t tsDecompressFloatImpAvx2(const char *input, int32_t nelements, char *output) { +#ifdef __AVX2__ // Allocate memory-aligned buffer char buf[M256_BYTES * 3]; memset(buf, 0, sizeof(buf)); @@ -343,7 +347,7 @@ int32_t tsDecompressFloatImpAvx2(const char *input, int32_t nelements, char *out // Load data into the buffer for batch processing int32_t batchSize = M256_BYTES / FLOAT_BYTES; - int32_t idx = 0; + int32_t idx = 0; uint32_t cur = 0; for (int32_t i = 0; i < nelements; i += 2) { if (idx == batchSize) { @@ -380,27 +384,14 @@ int32_t tsDecompressFloatImpAvx2(const char *input, int32_t nelements, char *out out += idx * FLOAT_BYTES; } return (int32_t)(out - output); -} - -FORCE_INLINE __m256i decodeDoubleAvx2(const char *data, const char *flag) { - __m256i dataVec = _mm256_load_si256((__m256i *)data); - __m256i flagVec = _mm256_load_si256((__m256i *)flag); - __m256i k7 = _mm256_set1_epi64x(7); - __m256i lopart = _mm256_set_epi64x(0, -1, 0, -1); - __m256i hipart = _mm256_set_epi64x(-1, 0, -1, 0); - __m256i trTail = _mm256_cmpgt_epi64(flagVec, k7); - __m256i trHead = _mm256_andnot_si256(trTail, _mm256_set1_epi64x(-1)); - __m256i shiftVec = _mm256_slli_epi64(_mm256_sub_epi64(k7, _mm256_and_si256(flagVec, k7)), 3); - __m256i maskVec = hipart; - __m256i diffVec = _mm256_sllv_epi64(dataVec, _mm256_and_si256(shiftVec, maskVec)); - maskVec = _mm256_or_si256(trHead, lopart); - diffVec = _mm256_srlv_epi64(diffVec, _mm256_and_si256(shiftVec, maskVec)); - maskVec = _mm256_and_si256(trTail, lopart); - diffVec = _mm256_sllv_epi64(diffVec, _mm256_and_si256(shiftVec, maskVec)); - return diffVec; +#else + uError("unable run %s without avx2 instructions", __func__); + return -1; +#endif } int32_t tsDecompressDoubleImpAvx2(const char *input, const int32_t nelements, char *const output) { +#ifdef __AVX2__ // Allocate memory-aligned buffer char buf[M256_BYTES * 3]; memset(buf, 0, sizeof(buf)); @@ -448,12 +439,15 @@ int32_t tsDecompressDoubleImpAvx2(const char *input, const int32_t nelements, ch out += idx * DOUBLE_BYTES; } return (int32_t)(out - output); -} +#else + uError("unable run %s without avx2 instructions", __func__); + return -1; #endif +} -#if __AVX512VL__ -// decode two timestamps in one loop. -void tsDecompressTimestampAvx2(const char *const input, const int32_t nelements, char *const output, bool bigEndian) { +int32_t tsDecompressTimestampAvx2(const char *const input, const int32_t nelements, char *const output, + bool bigEndian) { +#ifdef __AVX512VL__ int64_t *ostream = (int64_t *)output; int32_t ipos = 1, opos = 0; @@ -588,11 +582,16 @@ void tsDecompressTimestampAvx2(const char *const input, const int32_t nelements, ostream[opos++] = prevVal[1] + prevDeltaX; } } - return; + return opos; +#else + uError("unable run %s without avx512 instructions", __func__); + return -1; +#endif } -void tsDecompressTimestampAvx512(const char *const input, const int32_t nelements, char *const output, - bool UNUSED_PARAM(bigEndian)) { +int32_t tsDecompressTimestampAvx512(const char *const input, const int32_t nelements, char *const output, + bool UNUSED_PARAM(bigEndian)) { +#ifdef __AVX512VL__ int64_t *ostream = (int64_t *)output; int32_t ipos = 1, opos = 0; @@ -700,6 +699,9 @@ void tsDecompressTimestampAvx512(const char *const input, const int32_t nelement } } - return; -} + return opos; +#else + uError("unable run %s without avx512 instructions", __func__); + return -1; #endif +} From aa8454a1b45c116e9e7c62435eef79b6164bb224 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Fri, 1 Nov 2024 12:45:13 +0800 Subject: [PATCH 565/695] doc: add addins. --- docs/zh/06-advanced/06-data-analysis/addins.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 docs/zh/06-advanced/06-data-analysis/addins.md diff --git a/docs/zh/06-advanced/06-data-analysis/addins.md b/docs/zh/06-advanced/06-data-analysis/addins.md new file mode 100644 index 000000000000..e69de29bb2d1 From 9c90967e64c1c2214f9c5e3eac6bbe775acfe35d Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Fri, 1 Nov 2024 12:54:37 +0800 Subject: [PATCH 566/695] Update addins.md --- .../zh/06-advanced/06-data-analysis/addins.md | 166 ++++++++++++++++++ 1 file changed, 166 insertions(+) diff --git a/docs/zh/06-advanced/06-data-analysis/addins.md b/docs/zh/06-advanced/06-data-analysis/addins.md index e69de29bb2d1..090a3776db5d 100644 --- a/docs/zh/06-advanced/06-data-analysis/addins.md +++ b/docs/zh/06-advanced/06-data-analysis/addins.md @@ -0,0 +1,166 @@ +--- +title: "addins" +sidebar_label: "addins" +--- + +本节说明如何将自己开发的新预测算法和异常检测算法整合到 TDengine 分析平台, 并能够通过 SQL 语句进行调用。 + +## 目录结构 + + +|目录|说明| +|---|---| +|taos|Python 源代码目录,其下包含了算法具体保存目录 algo,放置杂项目录 misc, 单元测试和集成测试目录 test。 algo目录下 ad 放置异常检测算法代码, fc 放置预测算法代码| +|script|是安装脚本和发布脚本放置目录| +|model|放置针对数据集完成的训练模型| +|cfg| 配置文件目录| + +## 约定与限制 + +定义异常检测算法的 Python 代码文件 需放在 /taos/algo/ad 目录中,预测算法 Python 代码文件需要放在 /taos/algo/fc 目录中,以确保系统启动的时候能够正常加载对应目录下的 Python 文件。 + + +### 类命名规范 + +算法类的名称需要 以下划线开始,以 Service 结尾。例如:_KsigmaService 是 KSigma 异常检测算法的实现类。 + +### 类继承约定 + +异常检测算法需要从 `AbstractAnomalyDetectionService` 继承,并实现其核心抽象方法 `execute`. +预测算法需要从 `AbstractForecastService` 继承,同样需要实现其核心抽象方法 `execute`。 + +### 类属性初始化 +每个算法实现的类需要静态初始化两个类属性,分别是 + +`name`: 的触发调用关键词,全小写英文字母。 +`desc`:该算法的描述信息。 + +### 核心方法输入与输出约定 + +`execute` 是算法处理的核心方法。调用该方法的时候, self.list 已经设置好输入数组。 +异常检测输出结果 + +`execute` 的返回值是长度与 self.list 相同的数组,数组位置为 -1 的即为异常值点。例如:输入数组是 [2, 2, 2, 2, 100], 如果 100 是异常点,那么返回值是 [1, 1, 1, 1, -1]。 +预测输出结果 + +对于预测算法, `AbstractForecastService` 的对象属性说明如下: + +|属性名称|说明|默认值| +|---|---|---| +|period|输入时序数据的周期性,多少个数据点表示一个完整的周期。如果没有周期性,那么设置为 0 即可。| 0| +|start_ts|预测数据的开始时间| 0| +|time_step|预测结果的两个数据点之间时间间隔|0 | +|fc_rows|预测结果数量| 0 | +|return_conf|返回结果中是否包含执行区间范围,如果算法计算结果不包含置信区间,那么上界和下界与自身相同| 1| +|conf|执行区间分位数 0.05| + + +预测返回结果如下: +```python +return { + "rows": self.fc_rows, # 预测数据行数 + "period": self.period, # 数据周期性,同输入 + "algo": "holtwinters", # 预测使用的算法 + "mse": mse, # 预测算法的 mse + "res": res # 结果数组 [时间戳数组, 预测结果数组, 预测结果执行区间下界数组,预测结果执行区间上界数组] +} +``` + + +### 示例代码 + +```python +import numpy as np +from service import AbstractAnomalyDetectionService + +# 算法实现类名称 需要以下划线 "_" 开始,并以 Service 结束,如下 _IqrService 是 IQR 异常检测算法的实现类。 +class _IqrService(AbstractAnomalyDetectionService): + """ IQR algorithm 定义类,从 AbstractAnomalyDetectionService 继承,并实现 AbstractAnomalyDetectionService类的抽象函数 """ + + # 定义算法调用关键词,全小写ASCII码(必须添加) + name = 'iqr' + + # 该算法的描述信息(建议添加) + desc = """found the anomaly data according to the inter-quartile range""" + + def __init__(self): + super().__init__() + + def execute(self): + """ execute 是算法实现逻辑的核心实现,直接修改该实现即可 """ + + # self.list 是输入数值列,list 类型,例如:[1,2,3,4,5]。设置 self.list 的方法在父类中已经进行了定义。实现自己的算法,修改该文件即可,以下代码使用自己的实现替换即可。 + #lower = np.quantile(self.list, 0.25) + #upper = np.quantile(self.list, 0.75) + + #min_val = lower - 1.5 * (upper - lower) + #max_val = upper + 1.5 * (upper - lower) + #threshold = [min_val, max_val] + + # 返回值是与输入数值列长度相同的数据列,异常值对应位置是 -1。例如上述输入数据列,返回数值列是 [1, 1, 1, 1, -1],表示 [5] 是异常值。 + return [-1 if k < threshold[0] or k > threshold[1] else 1 for k in self.list] + + + def set_params(self, params): + """该算法无需任何输入参数,直接重载父类该函数,不处理算法参数设置逻辑""" + pass +``` + + +### 单元测试 + +在测试文件目录中的 anomaly_test.py 中增加单元测试用例。 +```python +def test_iqr(self): + """ 测试 _IqrService 类 """ + s = loader.get_service("iqr") + + # 设置需要进行检测的输入数据 + s.set_input_list(AnomalyDetectionTest.input_list) + + # 测试 set_params 的处理逻辑 + try: + s.set_params({"k": 2}) + except ValueError as e: + self.assertEqual(1, 0) + + r = s.execute() + + # 绘制异常检测结果 + draw_ad_results(AnomalyDetectionTest.input_list, r, "iqr") + + # 检查结果 + self.assertEqual(r[-1], -1) + self.assertEqual(len(r), len(AnomalyDetectionTest.input_list)) +``` + +### 需要模型的算法 + +针对特定数据集,进行模型训练的算法,在训练完成后。需要将训练得到的模型保存在 model 目录中。需要注意的是,针对每个算法,需要建立独立的文件夹。例如 auto_encoder 的训练算法在 model 目录下建立了, autoencoder的目录,使用该算法针对不同数据集训练得到的模型,均需要放置在该目录下。 + +训练完成后的模型,使用 joblib 进行保存。 + +并在 model 目录下建立对应的文件夹存放该模型。 + +保存模型的调用,可参考 encoder.py 的方式,用户通过调用 set_params 方法,并指定参数 {"model": "ad_encoder_keras"} 的方式,可以调用该模型进行计算。 + +具体的调用方式如下: + +```python +def test_autoencoder_ad(self): + # 获取特定的算法服务 + s = loader.get_service("ac") + data = self.__load_remote_data_for_ad() + + # 设置异常检查的输入数据 + s.set_input_list(data) + + # 指定调用的模型,该模型是之前针对该数据集进行训练获得 + s.set_params({"model": "ad_encoder_keras"}) + # 执行检查动作,并返回结果 + r = s.execute() + + num_of_error = -(sum(filter(lambda x: x == -1, r))) + self.assertEqual(num_of_error, 109) +``` + From fb69f55e975cbd142602e7d2326824ee1c8e36e7 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Fri, 1 Nov 2024 12:55:29 +0800 Subject: [PATCH 567/695] Update addins.md --- docs/zh/06-advanced/06-data-analysis/addins.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/zh/06-advanced/06-data-analysis/addins.md b/docs/zh/06-advanced/06-data-analysis/addins.md index 090a3776db5d..4ce69695ac51 100644 --- a/docs/zh/06-advanced/06-data-analysis/addins.md +++ b/docs/zh/06-advanced/06-data-analysis/addins.md @@ -67,7 +67,7 @@ return { ``` -### 示例代码 +## 示例代码 ```python import numpy as np @@ -107,7 +107,7 @@ class _IqrService(AbstractAnomalyDetectionService): ``` -### 单元测试 +## 单元测试 在测试文件目录中的 anomaly_test.py 中增加单元测试用例。 ```python @@ -134,7 +134,7 @@ def test_iqr(self): self.assertEqual(len(r), len(AnomalyDetectionTest.input_list)) ``` -### 需要模型的算法 +## 需要模型的算法 针对特定数据集,进行模型训练的算法,在训练完成后。需要将训练得到的模型保存在 model 目录中。需要注意的是,针对每个算法,需要建立独立的文件夹。例如 auto_encoder 的训练算法在 model 目录下建立了, autoencoder的目录,使用该算法针对不同数据集训练得到的模型,均需要放置在该目录下。 From a9a7a3da40ccdc7e0379e7b8990bb6067ae276d6 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Fri, 1 Nov 2024 13:00:44 +0800 Subject: [PATCH 568/695] Update addins.md --- docs/zh/06-advanced/06-data-analysis/addins.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/zh/06-advanced/06-data-analysis/addins.md b/docs/zh/06-advanced/06-data-analysis/addins.md index 4ce69695ac51..ff3d78179441 100644 --- a/docs/zh/06-advanced/06-data-analysis/addins.md +++ b/docs/zh/06-advanced/06-data-analysis/addins.md @@ -37,10 +37,10 @@ sidebar_label: "addins" ### 核心方法输入与输出约定 -`execute` 是算法处理的核心方法。调用该方法的时候, self.list 已经设置好输入数组。 +`execute` 是算法处理的核心方法。调用该方法的时候, `self.list` 已经设置好输入数组。 异常检测输出结果 -`execute` 的返回值是长度与 self.list 相同的数组,数组位置为 -1 的即为异常值点。例如:输入数组是 [2, 2, 2, 2, 100], 如果 100 是异常点,那么返回值是 [1, 1, 1, 1, -1]。 +`execute` 的返回值是长度与 `self.list` 相同的数组,数组位置为 -1 的即为异常值点。例如:输入数组是 [2, 2, 2, 2, 100], 如果 100 是异常点,那么返回值是 [1, 1, 1, 1, -1]。 预测输出结果 对于预测算法, `AbstractForecastService` 的对象属性说明如下: From 6f68677b7ea8dee9cf3e818ec407d05c59a244b4 Mon Sep 17 00:00:00 2001 From: xsren <285808407@qq.com> Date: Fri, 1 Nov 2024 13:40:00 +0800 Subject: [PATCH 569/695] enh: delete report switch --- source/client/src/clientMonitor.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/client/src/clientMonitor.c b/source/client/src/clientMonitor.c index 3469543e4d95..44ed2628804c 100644 --- a/source/client/src/clientMonitor.c +++ b/source/client/src/clientMonitor.c @@ -17,6 +17,7 @@ STaosQueue* monitorQueue; SHashObj* monitorSlowLogHash; char tmpSlowLogPath[PATH_MAX] = {0}; TdThread monitorThread; +extern bool tsEnableAuditDelete; static int32_t getSlowLogTmpDir(char* tmpPath, int32_t size) { int ret = tsnprintf(tmpPath, size, "%s/tdengine_slow_log/", tsTempDir); @@ -1014,7 +1015,7 @@ void clientOperateReport(SRequestObj* pRequest) { return; } - if (QUERY_NODE_DELETE_STMT == nodeType(pRequest->pQuery->pRoot)) { + if (tsEnableAuditDelete && QUERY_NODE_DELETE_STMT == nodeType(pRequest->pQuery->pRoot)) { reportDeleteSql(pRequest); } } From 3ee62943ddb4362dda0c25f920e9f86046712768 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Fri, 1 Nov 2024 13:44:06 +0800 Subject: [PATCH 570/695] doc: add addins. --- docs/zh/06-advanced/06-data-analysis/addins.md | 1 + docs/zh/06-advanced/06-data-analysis/pic/dir.png | Bin 0 -> 7286 bytes 2 files changed, 1 insertion(+) create mode 100644 docs/zh/06-advanced/06-data-analysis/pic/dir.png diff --git a/docs/zh/06-advanced/06-data-analysis/addins.md b/docs/zh/06-advanced/06-data-analysis/addins.md index ff3d78179441..867bd9ff235a 100644 --- a/docs/zh/06-advanced/06-data-analysis/addins.md +++ b/docs/zh/06-advanced/06-data-analysis/addins.md @@ -7,6 +7,7 @@ sidebar_label: "addins" ## 目录结构 +![数据分析功能架构图](./pic/dir.png) |目录|说明| |---|---| diff --git a/docs/zh/06-advanced/06-data-analysis/pic/dir.png b/docs/zh/06-advanced/06-data-analysis/pic/dir.png new file mode 100644 index 0000000000000000000000000000000000000000..d5aafb44274b375795df8e63eb10b813eb56047f GIT binary patch literal 7286 zcma)hc|4Te8@EEp&LFbnHuf#DWnX5Pv4pY9UWCZLlU*~TFeqEHG)Q*Y*X&WDu?>-k zEZMV@-qG`Wp5OAmf4qO(bAQe~=Un%>u5+DpeZSuuWpGQ2`ZC*PA|fJcI1GXy+;N0! zll&6l_fZ&Hf^fUwgV0hZDj#HDAv8$tsp+W^5mhBpp4yWV+7zBJ3m+mP2H*4R!WSp5 zKq4Y`N;pK#IM8N2JKl`ZY`*VAt6#%>=FF|uulDm)`ApqX&CH83`Xu8~G3D2$^<$=P zCF{rXQ{%y|oDmTKvl=NVG#=PNMgV95S~a>wOy7ZQ1(;Y}vLhooX|rhQ1<#F?3~Xc0 zv_io5hfBP4>NZ!<5G0KOSlu@QpwA};q3AdQZLoPo&P^k+O$v#_!_riV)#-GS%0sAy zrZ6TCab=`SyhwUjE_K&{xB9!oe@3#qU4xJbFmTJOV#q&T_}i$RF2*K!g}0bay+-Zt z=eqV7#pTkn-hq!nfsQDqs>0~>XTDS_^*bAC`6@LwYb%v1Xx#gCSgg55Yrzc29IS{_7MH!TeyeZVZ4;x?K)EEX`Uh3syx3qm0Z^x$Ml>K^_rw4C#G?WFY4%c=4`?uxGztRh(ZJ8v3RL*--{ z3gnP@@V3Xc;)>k9@DeOcnq|AtH?6r{_qPb;4eW#gn1PL+C%O3tU$W8S<($g$i*-|+ zHU5g4CMG-&r^2Z3@nTNpvM&0rEB>nVsO8qgo2}u1wO6Z}cfv$*sT~w(h&pdBOf$`3 zSwsOvQdMgnO7fY_dH}agA%GikDm4eRT{;wQTB|=Y?2bO+M@wXjGGq|Z1Ibs%Cbj5< zYnUZ+OmcO*+`3eOMy}DXFTq~f)GKMHdKqu#B)|V;N9hu>CYDw{e$=0sO9&`yDP>-{ z{3RE5_aX!dQ+-r%KP_=xPkg-gr=m+I4rHG_TpM!WDZ9`bblR5-1495!a6lR{92fLa z4P0KK>f}y4)s&O_=~Ilmf{-ESfL(MmOS^mBKs5Dxovo9yqGi|C*xC|NoaDJv4iJV% z?HsW^>AZDU930JuAYkvQ!Q0b&Mi4UR- zsWaF;{e<^$Kjt8+G{+7=owzE7&=*Qu!07gG{LcFMPO$wk>6eL7BXE8;Ib*;1rIMjJ zlNH4^0sq>q@22_LubBG7+AqwSuX9|07HfVJ$JHIhv?x_;b7IaN^Z zFMOV2zTNSOQ;-BV_61qPG|&S0NjT1@M2Wqt9}e<77^P?t(f)SZqoYMS$lEDe8#^aM zhDZxp5~S$cYtzI(+}OD7Y&1)%hRJ{Sj$!4!(5O-f^05hX9`L!UW}a34R!*{0?I3<6 z>OvmCHJi;l8`xAsu291D&0b4EM8SK}WmOO=hZh@tV8&k;&dqx!<_ zLM(X@bVsoZlOxHCnjcU7=K20woRx-islb6A{P$|yYm0oCp^hr%v6$sHI<>NlK5<&# zZW1sa?`g!(d){gIuIQxmgKct{AshXGb(&4Us|OD9Y0J@;2o_g25;e%tJTz z#AdEKDnqPd=)^Uoama-ViXVj@ez|4tYrfa=+8>n(FQQdu#}guNn?0ony@@Z)q&Qi_ zu?EGJ0?8!>mp2odl%<-$Yi_+pi+co<6at8bTsW4BY(pP{m2Za;r{%D~GhMl#)AEWb z#oQErA^!6~`sIZ1<7)_IC|bKP6-H}p-5h=x#nn@ueP_Bn`>?(=nQSjeOUr-#IMa@K zB#uPl<05e9Z`$={*JQLOCNH@WHjqVbRn*_^_8O>l_@F>$|ivr^>;V z+`pvUs9T-=M`1605NRJ}@xzI0Tx-==N`~H=&c<)3u^fk-c)n?4RoPUDT_1D3J^gAx zUW7}ymb|@=>SU`bnmaR{q4&@~&*WV2-J(J?(XL>o>! zQ=*X^Am!mpZ~5BfDUS)OYXk789QH#L$9fmD_O zrU#pc2({fN4;u)k7$OqmP>7~guIJ&FCgVE8MXdhZ@frnCRCV?96TkSkZGxE@SSY@d=r*MDZ$ic|LE8fI7%yuBC?la%lncNSYwYG2|2h|5s(Z20-(d!PB|0 zm}Md;KtFK(4DX_~=0M4CW7R8sbg@O{Dq4zk+vY82n0=6|L`)Qi%nD8N%I($blUyl) zo|=snn0CW>+|J|7Z%sG^S*}u+9OrF?-t9ENzHMoMJ$QZw&0uYrlRsH~MJphlI3naaJEJ9hh!KxgWOgUc|D$>RRl3Dg1^}bmDcD3=daDhCA%~ zl3hokq?^*-DUV`w{vEdDq6&H^mlxx5yhmV~y?39{&bQ1i?*wVwEN^b5$w8*bn*8Yd zF-5AM;{8(o1gW_GU1iB@`P2~{j){fXf3APnfW9#^)lNm2!FZ}2N$yInmE27XDg8@Dk@ZqODZ4n*%O7DLe5Xo>RJ0>7Im}Irju-vq&q}8lykS9wd@MaTEv9 z&6Q>~d2>}pujBzv#qw6Lz6*=cuJU4*f4~gH`}Ju7Uuj81Sshs!N1~z07&6D-wrkP= zA}K^IXwD)W^DA~gNMmJ+^orYXCSL&qJakA{Tru``;Cg@SCHSQd zEHG}^v+)vZh)$*RPl=ZHJfh9=_Z?K*6CdyPWolbg3|6NgLh&^{T9svnHZq3Yw)Zq} zNm0hj2Ky{iOJi{C1$P(3gE&D!~1#PZKm0_TA!N8y&i;edg<>cH)Ic4)4oy-gaU)&C7>nC zKbv`h<(Zz2a%_uoki~TXf%WVf`5ZHZwRO(B=-z^yZywqjU5spg!0DNFaikj!|=Sa!^6Oet-W_tW47J1sf*R;^}Zy9Q16fZ)(H#e{q1pux|#j1 z$k88DqW4&HA4K~b#yQa#}b>|YvMISR~H(1$QALqf_i8m zmQ}rH-~@g)Uzkyv-nv2ClJ-E$4Xt<6V<#Rw`cUq2yo8RWa<#7S;b){2)@Dxe{RwB7 z#;4cz=TTb!c}cOnnU?Iv+D=k~>!E_?Vfco%%$;w3qm+-vpYcI4oizIGTk-Yn;IECiLh1q5(dx&hw{3={@fcqE`F4Zy&(@*IALn+ICkO_S)uRNW6YL7<$CrkIvz zpXzn*!&kO*O*4`?n&%ZSbL`>My+|s==r?7QV`9lR;fym<1>=F2lA86}G9>37$v+oX zNYpoV1nl85%n#bpIGV{+1EXNr0-XdvU2oM#Ho){7pX&BOXQ-FT5%;{&Dy-!3cq(T* zOrrD5DN7XReu8pp-d&rBaeopBMq_zvHF*(kmNHJFb@Pjh7H!2#6jw_;@0f$&A(k{K z5dZ?FW!s@#7{4<{`rM?GRB=#ky0jE}D>|I!&HgA`J8V9t#e&u3)iNDF7v;J|IIXs@ zg2~Z6Ad)Zn2%706AG5d^c7=K0w`d_%vA#F;Nv+w~&(g`-ELRdx|8hPDZ6+lpy|{5p zdTMB?h+D@Kv8va~i3Gb(VenY|tW0O7#4sOXZB@A8yVBZMrP4IMc8khu?{l0qFom21 z=#0ln**D5>4c+Z26-QT<=Q16Hs_dVkEIYbn2=%n!o|n_E%eap-qswuC?5`#J4bHXC z0^&JGKb7ohZ3J+}Jh`yBUQd069q*xzQ$J3deHtS2r7Irn&L#|=e1!MzP|8)L!C3dU zq#tZ(;r9v@IYPd-HG^C(Ga3TLUi$&xmc<`Ax^y!`F`6N+PqeX2$0$(qsmQJOK@D5G zGo6wvp&z5_tK~I)*K3LvlVH~zAgd+CJ^RTr(;ESlmyr#g&6TjrM@R{?Tw{7T!GZ*U z>foZJm6|(ly|wT=Q~Xg6*O5EuO_62}{!Rn6se1EiB&75R|HYYG>s z1(m?w$SasmHj|0L5biVx0shhoAVxJXyAc4CkpF)*{)1Hh!&H&iG3jj@ohjsus1aIN zpgMtJMk471Q+GKIzCEhE_msy)L(ECE3h=L@{+(tMkxJ~>a2j~m*0b`L*#4SQg6zl| z4A$S-QZZ1uZgudgG|m7Q536C|23+)KS<71^CQ?@@s-oC^p4}VpiHd2z_n=tg4G!Hn zbrnX)+LNs0gF}f!hr*-N73Gcc;8~-0i$!xT`r^Q+kE0Cm zKLtfRef!8Eg>z){p+R(F_ZBFHdgaT#&iIC@D!&5u9O>C{F^WRbRwP7W4j)dbYKKv5 z)jQPfzYoI)()R@9%oV>U4!EbJY+}h~2sR@JP$cKZZ*`+U0%3h)h}eLqkr9cB2gglz z8hb3;vW|@c$y#HzCtA1CUf*B3GFBV%Vw(_1Uq&y0RD0G-#rrK7W!LdTWfq!@O@i1qJrOQmcr*M5#}XJ&xc6b<f#!DuiGgo)A1re(9UQQqG==sU^|QfT{BS0(1Y? zF(Q#5m-+fD^bS;i9qQ*;@0ig`#;W%!PAU9M@>j^%jeGEJb<7#$`4h9MVYj}=#tICe zJOSKj1fX~6g&O;jA5)ggJHUc-{2L+%~>usK;e1AB=`|KCCI=rhkcYCU76_Jl;ROU&!2vO;xh* zP-rXO;+$476sh;N!AKPmy5+$xpq-=&S&qm7T%e%Vyx*&%*FIPSToSShQUjZd8s7zS z#G_zGkr3DBNLnT}QybHGUuavd4xzH5vBa4p@u`bZ403Hc%4F!@h0Fn3d##H4nU%(9 zc-_~Tu9-HU@`UOX?-E(f39(TraK1PQP9{~v(w{}yVED8E5?sJMH}TAHrEJ6Iv~E&} zRz^g;W3&E6e#sv5c)6+Ol5sS(*vRqwMgNH7!NY95va9vC+#7j_|j{4V@pre9P~tZlErM*dUa zKA<~)yrBEx_jg6_0rB@;EA#$)XEM4ve@24Ts7!OZN*v;A4hizXaI$9<5G%NGLVeha zc$7k|)G#X>qvc+Pui`aQ=F%=v74)zm7ZyOI&o>#x#=acHEckH!Egn!1POdCf9Ym-i9kxnxv)#Bn0#6^p&@wQxIPA9Ych?@ znBObG-Z`{Tsz4w9ZCz+SP3Lwi1~IhlIp#%+PyEnfX&A<@#1YqsI~U|(s6|C zg_aT{7--oXT4rEiLnKU}Gh)f`)s%Vufl_N(SMMEqEzCuA43(<&kR>iY~}?h&OWWOtC|e8wbYM$?A7sO|;XBvD^Fw;3J|2`Bh#fL)FTSc#x$ z<^PX{YGAtxt^ECxDsLZ78~S?#JL)B3=g#~%kPYOr4HuhLV7XHbaE~Rh>cnr|z6uSd zKac3o6Q7xq-V>ZLg~GFJjw?s+^d#;7_5920RIbLG^D7Yx&^*GVA8rmsTWuUG=?iia$&lk;1cs>K3P(US#HcxIe>BiUre$TQ~`A?Ewpb1P5|qy@VWmY-im}V>=_&sX%lO8Ov!|$8jJv{dR}`=NE5l77ndTk9 z0ePN2kOK4(^^yNh&}R^;4J_INgq7u{cw!}*6jrMQOm1zW(#D^N;ymB`g(d+NiF*CL zExT?X4E7zxxKeWtggQoZJR^XW2z{)0iNV1dx1_1XHNFh7vcR~6ks>T>(T)8YJJm@W zzG1s)GU_8z1da9DYf8BjV~bVx?vDeO3sQ$m5jXbu6_Mvf;6DX0hn|}M7Qm#{pS=a7 zS(pJEHxtB8Rdpq)Y*Sp{V-}}X{XkXBMNruxiZkX~^1J_n#|G&l zf!|bxgA3LL5e=#s-?svoQMr?5uidn+YAKze`NsgYQFtdYp~h$;N6n1l*LmF=W;RVV zm#rGC&0|(N+Z;YH379|}{>;-?^$o0Cnf*iM`;NWWa~>;^wgc6yS1VqAq4rHnyQXH& z@4t9fEyD8C>@IK%KU4!{ZfR<^koNpL%>I~QFS|FD4~%2Y(i-+A4ET{!qf?JLPIR^_ z{2J5U>wpJU)Nf2Vx)AqyR#WFZRsO8>|9Zpg=3{{s^wpy9{?zYuJ?;$&S>KfUbOQK(G;~u!aZG4XnE{w%YgfASx#GUwD+F8_ zrJ*#?dy$xS(_!e#H}lF52{8oTXJPhuug}seygPfU!ze~wNlfCrB)@3m6JZoOc~?x& ztZP=N2~O8ZIxzp@-|#VVba4RWozjqvSczR<+GvZFDUkk@41fl_P=o?&O@ZtAqo=0s z-5>C3aHP{H=aw=}{YGs_Vnox{#9b#dWfXH4Uz_FjM<`h)DIfkz4E^YOE{0atMxBeH z<}r)RAKoa(7!lY5I*AIJ=_Y`PV33a#t~r-Bg{&*LwL1r$kkm&qy>z8_~TKlyA#hrZ>%EY(B#GA;hmp9kDJ{~)rw)_UwnZ2+0 zlnH~2#-OXBh#ZH#dX>am*}G`X$Q}O`^Q;IptzC_zBlTS*CM@r8$7-=4Jp_;OdCeT tkVvtoT_OATk@No|H2;||;#6C|1riGfy)N{a6227@!J)Sx Date: Fri, 1 Nov 2024 14:51:10 +0800 Subject: [PATCH 571/695] chore(.github): modify go test command --- .github/workflows/taoskeeper-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/taoskeeper-ci.yml b/.github/workflows/taoskeeper-ci.yml index ba43937029d6..9fedf1adf5d2 100644 --- a/.github/workflows/taoskeeper-ci.yml +++ b/.github/workflows/taoskeeper-ci.yml @@ -48,7 +48,7 @@ jobs: working-directory: tools/keeper run: | go mod tidy - go test -v -coverpkg=./... -coverprofile=coverage.out ./... + go test -v -ldflags="-X 'github.com/taosdata/taoskeeper/version.IsEnterprise=true'" -coverpkg=./... -coverprofile=coverage.out ./... go tool cover -func=coverage.out - name: Clean up From b2eba84cdc5269102fe7bba2287f1d79f8b97b6b Mon Sep 17 00:00:00 2001 From: qevolg <2227465945@qq.com> Date: Fri, 1 Nov 2024 14:51:53 +0800 Subject: [PATCH 572/695] style(keeper): format code --- tools/keeper/main.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tools/keeper/main.go b/tools/keeper/main.go index 43432bde3d70..5f7d47cb1cf5 100644 --- a/tools/keeper/main.go +++ b/tools/keeper/main.go @@ -1,11 +1,8 @@ package main -import ( - "github.com/taosdata/taoskeeper/system" -) +import "github.com/taosdata/taoskeeper/system" func main() { r := system.Init() system.Start(r) - // config.IsEnterprise } From 22fbe9453b583165f03fbe0cced1c04f4e2ab32b Mon Sep 17 00:00:00 2001 From: qevolg <2227465945@qq.com> Date: Fri, 1 Nov 2024 14:52:27 +0800 Subject: [PATCH 573/695] test(keeper): add test cases --- tools/keeper/process/empty_test.go | 8 -- tools/keeper/process/handle_test.go | 121 ++++++++++++++++++++++++++++ tools/keeper/system/program_test.go | 25 +++++- 3 files changed, 145 insertions(+), 9 deletions(-) delete mode 100644 tools/keeper/process/empty_test.go create mode 100644 tools/keeper/process/handle_test.go diff --git a/tools/keeper/process/empty_test.go b/tools/keeper/process/empty_test.go deleted file mode 100644 index 6718d125255f..000000000000 --- a/tools/keeper/process/empty_test.go +++ /dev/null @@ -1,8 +0,0 @@ -package process - -import ( - "testing" -) - -func TestEmpty(t *testing.T) { -} diff --git a/tools/keeper/process/handle_test.go b/tools/keeper/process/handle_test.go new file mode 100644 index 000000000000..bfd5c369b4cb --- /dev/null +++ b/tools/keeper/process/handle_test.go @@ -0,0 +1,121 @@ +package process + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func Test_i2string(t *testing.T) { + tests := []struct { + value interface{} + expected string + }{ + {"abc", "abc"}, + {"abcdef", "abcdef"}, + {[]byte{97, 98, 99, 100, 101, 102}, "abcdef"}, + } + + for _, tt := range tests { + res := i2string(tt.value) + assert.Equal(t, tt.expected, res) + } +} + +func Test_i2string_panic(t *testing.T) { + defer func() { + if r := recover(); r == nil { + t.Errorf("Expected panic for unexpected type, but did not panic") + } + }() + + i2string(12345) +} + +func Test_i2float(t *testing.T) { + tests := []struct { + value interface{} + expected float64 + }{ + {int8(1), 1.0}, + {int16(1), 1.0}, + {int32(1), 1.0}, + {int64(1), 1.0}, + {uint8(1), 1.0}, + {uint16(1), 1.0}, + {uint32(1), 1.0}, + {uint64(1), 1.0}, + {float32(1.5), 1.5}, + {float64(1.5), 1.5}, + {true, 1.0}, + {false, 0.0}, + } + + for _, tt := range tests { + res := i2float(tt.value) + assert.Equal(t, tt.expected, res) + } +} + +func Test_i2float_panic(t *testing.T) { + defer func() { + if r := recover(); r == nil { + t.Errorf("Expected panic for unexpected type, but did not panic") + } + }() + + i2float("unexpected type") +} + +func Test_getRoleStr(t *testing.T) { + tests := []struct { + value float64 + expected string + }{ + {0, "offline"}, + {99.5, "follower"}, + {100, "follower"}, + {100.4, "follower"}, + {100.5, "candidate"}, + {101, "candidate"}, + {101.4, "candidate"}, + {101.5, "leader"}, + {102, "leader"}, + {102.4, "leader"}, + {102.5, "error"}, + {103, "error"}, + {104, "learner"}, + {99.4, "unknown"}, + {105, "unknown"}, + {-1, "unknown"}, + {150, "unknown"}, + } + + for _, tt := range tests { + res := getRoleStr(tt.value) + assert.Equal(t, tt.expected, res) + } +} + +func Test_getStatusStr(t *testing.T) { + tests := []struct { + value float64 + expected string + }{ + {-0.4, "offline"}, + {0, "offline"}, + {0.4, "offline"}, + {0.5, "ready"}, + {1, "ready"}, + {1.4, "ready"}, + {1.5, "unknown"}, + {2, "unknown"}, + {-0.5, "unknown"}, + {-1, "unknown"}, + } + + for _, tt := range tests { + res := getStatusStr(tt.value) + assert.Equal(t, tt.expected, res) + } +} diff --git a/tools/keeper/system/program_test.go b/tools/keeper/system/program_test.go index eabc4fff35ec..63fbb6301418 100644 --- a/tools/keeper/system/program_test.go +++ b/tools/keeper/system/program_test.go @@ -3,15 +3,18 @@ package system import ( "context" "fmt" + "net/http" "testing" + "time" + "github.com/kardianos/service" "github.com/stretchr/testify/assert" "github.com/taosdata/taoskeeper/db" "github.com/taosdata/taoskeeper/infrastructure/config" "github.com/taosdata/taoskeeper/util" ) -func TestStart(t *testing.T) { +func TestInit(t *testing.T) { server := Init() assert.NotNil(t, server) @@ -20,3 +23,23 @@ func TestStart(t *testing.T) { conn.Query(context.Background(), fmt.Sprintf("drop database if exists %s", config.Conf.Metrics.Database.Name), util.GetQidOwn()) conn.Query(context.Background(), fmt.Sprintf("drop database if exists %s", config.Conf.Audit.Database.Name), util.GetQidOwn()) } + +func Test_program(t *testing.T) { + server := &http.Server{} + prg := newProgram(server) + svcConfig := &service.Config{ + Name: "taoskeeper", + DisplayName: "taoskeeper", + Description: "taosKeeper is a tool for TDengine that exports monitoring metrics", + } + svc, err := service.New(prg, svcConfig) + assert.NoError(t, err) + + err = prg.Start(svc) + assert.NoError(t, err) + + time.Sleep(100 * time.Millisecond) + + err = prg.Stop(svc) + assert.NoError(t, err) +} From be1b6db22038c1d6c78496566f5d06675deaf530 Mon Sep 17 00:00:00 2001 From: qevolg <2227465945@qq.com> Date: Fri, 1 Nov 2024 15:00:29 +0800 Subject: [PATCH 574/695] chore(.github): modify go test command --- .github/workflows/taoskeeper-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/taoskeeper-ci.yml b/.github/workflows/taoskeeper-ci.yml index 9fedf1adf5d2..b991aa9522e2 100644 --- a/.github/workflows/taoskeeper-ci.yml +++ b/.github/workflows/taoskeeper-ci.yml @@ -48,7 +48,7 @@ jobs: working-directory: tools/keeper run: | go mod tidy - go test -v -ldflags="-X 'github.com/taosdata/taoskeeper/version.IsEnterprise=true'" -coverpkg=./... -coverprofile=coverage.out ./... + sudo go test -v -ldflags="-X 'github.com/taosdata/taoskeeper/version.IsEnterprise=true'" -coverpkg=./... -coverprofile=coverage.out ./... go tool cover -func=coverage.out - name: Clean up From ced675a93c53b113387cbe833522adcaddc36b47 Mon Sep 17 00:00:00 2001 From: qevolg <2227465945@qq.com> Date: Fri, 1 Nov 2024 15:02:56 +0800 Subject: [PATCH 575/695] test(keeper): trigger taoskeeper ci --- tools/keeper/api/adapter2_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/keeper/api/adapter2_test.go b/tools/keeper/api/adapter2_test.go index e6fd263c43fa..5456dfeecf1a 100644 --- a/tools/keeper/api/adapter2_test.go +++ b/tools/keeper/api/adapter2_test.go @@ -14,6 +14,7 @@ import ( ) func TestAdapter2(t *testing.T) { + // c := &config.Config{ InstanceID: 64, Port: 6043, From c1d2fe42cdea2692f6fb8140e4d70d3d446be15b Mon Sep 17 00:00:00 2001 From: qevolg <2227465945@qq.com> Date: Fri, 1 Nov 2024 15:03:12 +0800 Subject: [PATCH 576/695] test(keeper): trigger taoskeeper ci --- tools/keeper/api/adapter2_test.go | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/keeper/api/adapter2_test.go b/tools/keeper/api/adapter2_test.go index 5456dfeecf1a..e6fd263c43fa 100644 --- a/tools/keeper/api/adapter2_test.go +++ b/tools/keeper/api/adapter2_test.go @@ -14,7 +14,6 @@ import ( ) func TestAdapter2(t *testing.T) { - // c := &config.Config{ InstanceID: 64, Port: 6043, From 03bb35a5cbeb2f5e7d5b12df03e377db91433116 Mon Sep 17 00:00:00 2001 From: qevolg <2227465945@qq.com> Date: Fri, 1 Nov 2024 15:09:58 +0800 Subject: [PATCH 577/695] style(.github): format code --- .github/workflows/taoskeeper-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/taoskeeper-ci.yml b/.github/workflows/taoskeeper-ci.yml index b991aa9522e2..fbc662ffb21f 100644 --- a/.github/workflows/taoskeeper-ci.yml +++ b/.github/workflows/taoskeeper-ci.yml @@ -48,7 +48,7 @@ jobs: working-directory: tools/keeper run: | go mod tidy - sudo go test -v -ldflags="-X 'github.com/taosdata/taoskeeper/version.IsEnterprise=true'" -coverpkg=./... -coverprofile=coverage.out ./... + sudo go test -v -ldflags="-X 'github.com/taosdata/taoskeeper/version.IsEnterprise=true'" -coverpkg=./... -coverprofile=coverage.out ./... go tool cover -func=coverage.out - name: Clean up From f7e11e00c062b1c135a6b2b044c95640aa1fbca4 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 1 Nov 2024 15:34:57 +0800 Subject: [PATCH 578/695] fix: check return codes --- source/dnode/mnode/impl/src/mndDb.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndDb.c b/source/dnode/mnode/impl/src/mndDb.c index 7a8965da565c..0d17ccd0b087 100644 --- a/source/dnode/mnode/impl/src/mndDb.c +++ b/source/dnode/mnode/impl/src/mndDb.c @@ -946,10 +946,7 @@ static int32_t mndProcessCreateDbReq(SRpcMsg *pReq) { SArray *dnodeList = NULL; dnodeList = taosArrayInit(mndGetDnodeSize(pMnode), sizeof(int32_t)); - if (dnodeList == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; - goto _OVER; - } + TSDB_CHECK_NULL(dnodeList, code, lino, _OVER, TSDB_CODE_OUT_OF_MEMORY); TAOS_CHECK_GOTO(tDeserializeSCreateDbReq(pReq->pCont, pReq->contLen, &createReq), NULL, _OVER); #ifdef WINDOWS @@ -1191,6 +1188,8 @@ static int32_t mndSetAlterDbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj * SVgObj *pVgroup = NULL; SArray *pArray = mndBuildDnodesArray(pMnode, 0, NULL); + TSDB_CHECK_NULL(pArray, code, lino, _err, TSDB_CODE_OUT_OF_MEMORY); + while (1) { pIter = sdbFetch(pSdb, SDB_VGROUP, pIter, (void **)&pVgroup); if (pIter == NULL) break; From 39a0916b803444155742c4a764acaaf5dba6c675 Mon Sep 17 00:00:00 2001 From: factosea <285808407@qq.com> Date: Fri, 1 Nov 2024 15:38:33 +0800 Subject: [PATCH 579/695] fix: return value --- source/client/src/clientMonitor.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/client/src/clientMonitor.c b/source/client/src/clientMonitor.c index 44ed2628804c..3b19e070b8f6 100644 --- a/source/client/src/clientMonitor.c +++ b/source/client/src/clientMonitor.c @@ -984,9 +984,9 @@ static void reportDeleteSql(SRequestObj* pRequest) { SAuditReq req; req.pSql = pRequest->sqlstr; req.sqlLen = pRequest->sqlLen; - tsnprintf(req.table, TSDB_TABLE_NAME_LEN, "%s", pTable->table.tableName); - tsnprintf(req.db, TSDB_DB_FNAME_LEN, "%s", pTable->table.dbName); - tsnprintf(req.operation, AUDIT_OPERATION_LEN, "delete"); + TAOS_UNUSED(tsnprintf(req.table, TSDB_TABLE_NAME_LEN, "%s", pTable->table.tableName)); + TAOS_UNUSED(tsnprintf(req.db, TSDB_DB_FNAME_LEN, "%s", pTable->table.dbName)); + TAOS_UNUSED(tsnprintf(req.operation, AUDIT_OPERATION_LEN, "delete")); int32_t tlen = tSerializeSAuditReq(NULL, 0, &req); void* pReq = taosMemoryCalloc(1, tlen); if (pReq == NULL) { From 362aa5f7cb64aa3ff9ec7bdeaa44da77e1f02d4f Mon Sep 17 00:00:00 2001 From: Shungang Li Date: Fri, 1 Nov 2024 15:57:55 +0800 Subject: [PATCH 580/695] enh: refactor mndProcessArbCheckSyncTimer --- source/dnode/mnode/impl/src/mndArbGroup.c | 185 +++++++++++++--------- 1 file changed, 113 insertions(+), 72 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndArbGroup.c b/source/dnode/mnode/impl/src/mndArbGroup.c index e6e8294cd08e..1faee3744cbc 100644 --- a/source/dnode/mnode/impl/src/mndArbGroup.c +++ b/source/dnode/mnode/impl/src/mndArbGroup.c @@ -583,19 +583,84 @@ static int32_t mndSendArbSetAssignedLeaderReq(SMnode *pMnode, int32_t dnodeId, i return code; } +typedef enum { + CHECK_SYNC_NONE = 0, + CHECK_SYNC_SET_ASSIGNED_LEADER = 1, + CHECK_SYNC_CHECK_SYNC = 2, + CHECK_SYNC_UPDATE = 3 +} ECheckSyncOp; + +static void mndArbCheckSync(SArbGroup *pArbGroup, int64_t nowMs, ECheckSyncOp *pOp, SArbGroup *pNewGroup) { + *pOp = CHECK_SYNC_NONE; + int32_t code = 0; + + int32_t vgId = pArbGroup->vgId; + + bool member0IsTimeout = mndCheckArbMemberHbTimeout(pArbGroup, 0, nowMs); + bool member1IsTimeout = mndCheckArbMemberHbTimeout(pArbGroup, 1, nowMs); + SArbAssignedLeader *pAssignedLeader = &pArbGroup->assignedLeader; + int32_t currentAssignedDnodeId = pAssignedLeader->dnodeId; + + // 1. has assigned && no response => send req + if (currentAssignedDnodeId != 0 && pAssignedLeader->acked == false) { + *pOp = CHECK_SYNC_SET_ASSIGNED_LEADER; + return; + } + + // 2. both of the two members are timeout => skip + if (member0IsTimeout && member1IsTimeout) { + return; + } + + // 3. no member is timeout => check sync + if (member0IsTimeout == false && member1IsTimeout == false) { + // no assigned leader and not sync + if (currentAssignedDnodeId == 0 && !pArbGroup->isSync) { + *pOp = CHECK_SYNC_CHECK_SYNC; + } + return; + } + + // 4. one of the members is timeout => set assigned leader + int32_t candidateIndex = member0IsTimeout ? 1 : 0; + SArbGroupMember *pMember = &pArbGroup->members[candidateIndex]; + + // has assigned leader and dnodeId not match => skip + if (currentAssignedDnodeId != 0 && currentAssignedDnodeId != pMember->info.dnodeId) { + mInfo("arb skip to set assigned leader to vgId:%d dnodeId:%d, assigned leader has been set to dnodeId:%d", vgId, + pMember->info.dnodeId, currentAssignedDnodeId); + return; + } + + // not sync => skip + if (pArbGroup->isSync == false) { + if (currentAssignedDnodeId == pMember->info.dnodeId) { + mDebug("arb skip to set assigned leader to vgId:%d dnodeId:%d, arb group is not sync", vgId, + pMember->info.dnodeId); + } else { + mInfo("arb skip to set assigned leader to vgId:%d dnodeId:%d, arb group is not sync", vgId, + pMember->info.dnodeId); + } + return; + } + + // is sync && no assigned leader => write to sdb + mndArbGroupDupObj(pArbGroup, pNewGroup); + mndArbGroupSetAssignedLeader(pNewGroup, candidateIndex); + *pOp = CHECK_SYNC_UPDATE; +} + static int32_t mndProcessArbCheckSyncTimer(SRpcMsg *pReq) { - int32_t code = 0; + int32_t code = 0, lino = 0; SMnode *pMnode = pReq->info.node; SSdb *pSdb = pMnode->pSdb; SArbGroup *pArbGroup = NULL; - SArbGroup arbGroupDup = {0}; void *pIter = NULL; + SArray *pUpdateArray = NULL; char arbToken[TSDB_ARB_TOKEN_SIZE]; - if ((code = mndGetArbToken(pMnode, arbToken)) != 0) { - mError("failed to get arb token for arb-check-sync timer"); - TAOS_RETURN(code); - } + TAOS_CHECK_EXIT(mndGetArbToken(pMnode, arbToken)); + int64_t term = mndGetTerm(pMnode); if (term < 0) { mError("arb failed to get term since %s", terrstr()); @@ -612,88 +677,64 @@ static int32_t mndProcessArbCheckSyncTimer(SRpcMsg *pReq) { return 0; } - SArray *pUpdateArray = taosArrayInit(16, sizeof(SArbGroup)); - while (1) { pIter = sdbFetch(pSdb, SDB_ARBGROUP, pIter, (void **)&pArbGroup); if (pIter == NULL) break; + SArbGroup arbGroupDup = {0}; + (void)taosThreadMutexLock(&pArbGroup->mutex); mndArbGroupDupObj(pArbGroup, &arbGroupDup); (void)taosThreadMutexUnlock(&pArbGroup->mutex); - int32_t vgId = arbGroupDup.vgId; - - bool member0IsTimeout = mndCheckArbMemberHbTimeout(&arbGroupDup, 0, nowMs); - bool member1IsTimeout = mndCheckArbMemberHbTimeout(&arbGroupDup, 1, nowMs); - SArbAssignedLeader *pAssignedLeader = &arbGroupDup.assignedLeader; - int32_t currentAssignedDnodeId = pAssignedLeader->dnodeId; - - // 1. has assigned && no response => send req - if (currentAssignedDnodeId != 0 && pAssignedLeader->acked == false) { - (void)mndSendArbSetAssignedLeaderReq(pMnode, currentAssignedDnodeId, vgId, arbToken, term, - pAssignedLeader->token); - mInfo("vgId:%d, arb send set assigned leader to dnodeId:%d", vgId, currentAssignedDnodeId); - sdbRelease(pSdb, pArbGroup); - continue; - } - - // 2. both of the two members are timeout => skip - if (member0IsTimeout && member1IsTimeout) { - sdbRelease(pSdb, pArbGroup); - continue; - } + sdbRelease(pSdb, pArbGroup); - // 3. no member is timeout => check sync - if (member0IsTimeout == false && member1IsTimeout == false) { - // no assigned leader and not sync - if (currentAssignedDnodeId == 0 && !arbGroupDup.isSync) { - (void)mndSendArbCheckSyncReq(pMnode, arbGroupDup.vgId, arbToken, term, arbGroupDup.members[0].state.token, + ECheckSyncOp op = CHECK_SYNC_NONE; + SArbGroup newGroup = {0}; + mndArbCheckSync(&arbGroupDup, nowMs, &op, &newGroup); + + int32_t vgId = arbGroupDup.vgId; + SArbAssignedLeader *pAssgndLeader = &arbGroupDup.assignedLeader; + int32_t assgndDnodeId = pAssgndLeader->dnodeId; + + switch (op) { + case CHECK_SYNC_NONE: + mTrace("vgId:%d, arb skip to send msg by check sync", vgId); + break; + case CHECK_SYNC_SET_ASSIGNED_LEADER: + (void)mndSendArbSetAssignedLeaderReq(pMnode, assgndDnodeId, vgId, arbToken, term, pAssgndLeader->token); + mInfo("vgId:%d, arb send set assigned leader to dnodeId:%d", vgId, assgndDnodeId); + break; + case CHECK_SYNC_CHECK_SYNC: + (void)mndSendArbCheckSyncReq(pMnode, vgId, arbToken, term, arbGroupDup.members[0].state.token, arbGroupDup.members[1].state.token); - } - sdbRelease(pSdb, pArbGroup); - continue; - } - - // 4. one of the members is timeout => set assigned leader - int32_t candidateIndex = member0IsTimeout ? 1 : 0; - SArbGroupMember *pMember = &arbGroupDup.members[candidateIndex]; - - // has assigned leader and dnodeId not match => skip - if (currentAssignedDnodeId != 0 && currentAssignedDnodeId != pMember->info.dnodeId) { - mInfo("arb skip to set assigned leader to vgId:%d dnodeId:%d, assigned leader has been set to dnodeId:%d", vgId, - pMember->info.dnodeId, currentAssignedDnodeId); - sdbRelease(pSdb, pArbGroup); - continue; - } + mInfo("vgId:%d, arb send check sync request", vgId); + break; + case CHECK_SYNC_UPDATE: + if (!pUpdateArray) { + pUpdateArray = taosArrayInit(16, sizeof(SArbGroup)); + if (!pUpdateArray) { + TAOS_CHECK_EXIT(TSDB_CODE_OUT_OF_MEMORY); + } + } - // not sync => skip - if (arbGroupDup.isSync == false) { - if (currentAssignedDnodeId == pMember->info.dnodeId) { - mDebug("arb skip to set assigned leader to vgId:%d dnodeId:%d, arb group is not sync", vgId, - pMember->info.dnodeId); - } else { - mInfo("arb skip to set assigned leader to vgId:%d dnodeId:%d, arb group is not sync", vgId, - pMember->info.dnodeId); - } - sdbRelease(pSdb, pArbGroup); - continue; + if (taosArrayPush(pUpdateArray, &newGroup) == NULL) { + TAOS_CHECK_EXIT(terrno); + } + break; + default: + mError("vgId:%d, arb unknown check sync op:%d", vgId, op); + break; } + } - // is sync && no assigned leader => write to sdb - SArbGroup newGroup = {0}; - mndArbGroupDupObj(&arbGroupDup, &newGroup); - mndArbGroupSetAssignedLeader(&newGroup, candidateIndex); - if (taosArrayPush(pUpdateArray, &newGroup) == NULL) { - taosArrayDestroy(pUpdateArray); - return terrno; - } + TAOS_CHECK_EXIT(mndPullupArbUpdateGroupBatch(pMnode, pUpdateArray)); - sdbRelease(pSdb, pArbGroup); +_exit: + if (code != 0) { + mError("failed to check sync at line %d since %s", lino, terrstr()); } - TAOS_CHECK_RETURN(mndPullupArbUpdateGroupBatch(pMnode, pUpdateArray)); - taosArrayDestroy(pUpdateArray); return 0; } From ece22fcf46491461352ee6cd5d0ac8d6887a1afa Mon Sep 17 00:00:00 2001 From: menshibin Date: Fri, 1 Nov 2024 16:13:25 +0800 Subject: [PATCH 581/695] node.js version upgrade --- docs/examples/node/package.json | 2 +- docs/zh/14-reference/05-connector/35-node.mdx | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/examples/node/package.json b/docs/examples/node/package.json index 3f5f54e9d7c4..14303c8f3748 100644 --- a/docs/examples/node/package.json +++ b/docs/examples/node/package.json @@ -4,6 +4,6 @@ "main": "index.js", "license": "MIT", "dependencies": { - "@tdengine/websocket": "^3.1.0" + "@tdengine/websocket": "^3.1.1" } } diff --git a/docs/zh/14-reference/05-connector/35-node.mdx b/docs/zh/14-reference/05-connector/35-node.mdx index 6ac34d247175..d9512eae78d7 100644 --- a/docs/zh/14-reference/05-connector/35-node.mdx +++ b/docs/zh/14-reference/05-connector/35-node.mdx @@ -26,6 +26,7 @@ Node.js 连接器目前仅支持 WebSocket 连接器, 其通过 taosAdapter | Node.js 连接器 版本 | 主要变化 | TDengine 版本 | | :------------------: | :----------------------: | :----------------: | +| 3.1.1 | 优化了数据传输性能 | 3.3.2.0 及更高版本 | | 3.1.0 | 新版本发布,支持 WebSocket 连接 | 3.2.0.0 及更高版本 | ## 处理异常 From f0760a3bb03404253161bd559c60e7365da33230 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Fri, 1 Nov 2024 16:17:10 +0800 Subject: [PATCH 582/695] fix: msg preprocess fail issue --- source/libs/qworker/src/qwMsg.c | 2 +- source/libs/qworker/src/qworker.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/libs/qworker/src/qwMsg.c b/source/libs/qworker/src/qwMsg.c index 69014d5b1c58..20b81bfc14d8 100644 --- a/source/libs/qworker/src/qwMsg.c +++ b/source/libs/qworker/src/qwMsg.c @@ -429,7 +429,7 @@ int32_t qWorkerPreprocessQueryMsg(void *qWorkerMgmt, SRpcMsg *pMsg, bool chkGran tFreeSSubQueryMsg(&msg); - return TSDB_CODE_SUCCESS; + return code; } int32_t qWorkerAbortPreprocessQueryMsg(void *qWorkerMgmt, SRpcMsg *pMsg) { diff --git a/source/libs/qworker/src/qworker.c b/source/libs/qworker/src/qworker.c index ddc4812b559a..9b96c1e51906 100644 --- a/source/libs/qworker/src/qworker.c +++ b/source/libs/qworker/src/qworker.c @@ -751,7 +751,7 @@ int32_t qwPreprocessQuery(QW_FPARAMS_DEF, SQWMsg *qwMsg) { qwReleaseTaskCtx(mgmt, ctx); } - return TSDB_CODE_SUCCESS; + return code; } int32_t qwProcessQuery(QW_FPARAMS_DEF, SQWMsg *qwMsg, char *sql) { From e1399e612ca69651a6c24d5351a23fc4e4b7e8ad Mon Sep 17 00:00:00 2001 From: menshibin Date: Fri, 1 Nov 2024 16:28:20 +0800 Subject: [PATCH 583/695] node.js version upgrade --- docs/examples/node/websocketexample/sql_example.js | 1 - docs/examples/node/websocketexample/tmq_seek_example.js | 1 - 2 files changed, 2 deletions(-) diff --git a/docs/examples/node/websocketexample/sql_example.js b/docs/examples/node/websocketexample/sql_example.js index 0a09228d970f..c120b84d99fe 100644 --- a/docs/examples/node/websocketexample/sql_example.js +++ b/docs/examples/node/websocketexample/sql_example.js @@ -3,7 +3,6 @@ const taos = require("@tdengine/websocket"); let dsn = 'ws://localhost:6041'; async function createConnect() { - try { let conf = new taos.WSConfig(dsn); conf.setUser('root'); diff --git a/docs/examples/node/websocketexample/tmq_seek_example.js b/docs/examples/node/websocketexample/tmq_seek_example.js index f676efe36f6d..be4d8ddfa4a5 100644 --- a/docs/examples/node/websocketexample/tmq_seek_example.js +++ b/docs/examples/node/websocketexample/tmq_seek_example.js @@ -10,7 +10,6 @@ const groupId = "group1"; const clientId = "client1"; async function createConsumer() { - let groupId = "group1"; let clientId = "client1"; let configMap = new Map([ From 2ebc84d02af09c2ec7e64926371f49021ee8092c Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Fri, 1 Nov 2024 16:17:10 +0800 Subject: [PATCH 584/695] fix: msg preprocess fail issue --- source/libs/qworker/src/qwMsg.c | 2 +- source/libs/qworker/src/qworker.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/libs/qworker/src/qwMsg.c b/source/libs/qworker/src/qwMsg.c index 69014d5b1c58..20b81bfc14d8 100644 --- a/source/libs/qworker/src/qwMsg.c +++ b/source/libs/qworker/src/qwMsg.c @@ -429,7 +429,7 @@ int32_t qWorkerPreprocessQueryMsg(void *qWorkerMgmt, SRpcMsg *pMsg, bool chkGran tFreeSSubQueryMsg(&msg); - return TSDB_CODE_SUCCESS; + return code; } int32_t qWorkerAbortPreprocessQueryMsg(void *qWorkerMgmt, SRpcMsg *pMsg) { diff --git a/source/libs/qworker/src/qworker.c b/source/libs/qworker/src/qworker.c index ddc4812b559a..9b96c1e51906 100644 --- a/source/libs/qworker/src/qworker.c +++ b/source/libs/qworker/src/qworker.c @@ -751,7 +751,7 @@ int32_t qwPreprocessQuery(QW_FPARAMS_DEF, SQWMsg *qwMsg) { qwReleaseTaskCtx(mgmt, ctx); } - return TSDB_CODE_SUCCESS; + return code; } int32_t qwProcessQuery(QW_FPARAMS_DEF, SQWMsg *qwMsg, char *sql) { From 2551b32d1df19c1a17133a0850934a571c9100e7 Mon Sep 17 00:00:00 2001 From: Shungang Li Date: Fri, 1 Nov 2024 17:52:10 +0800 Subject: [PATCH 585/695] enh: add unit test for mndArbCheckSync --- source/dnode/mnode/impl/inc/mndArbGroup.h | 9 ++ source/dnode/mnode/impl/src/mndArbGroup.c | 9 +- .../mnode/impl/test/arbgroup/arbgroup.cpp | 128 +++++++++++++----- 3 files changed, 107 insertions(+), 39 deletions(-) diff --git a/source/dnode/mnode/impl/inc/mndArbGroup.h b/source/dnode/mnode/impl/inc/mndArbGroup.h index 779d64c7e2be..66ef3f766bee 100644 --- a/source/dnode/mnode/impl/inc/mndArbGroup.h +++ b/source/dnode/mnode/impl/inc/mndArbGroup.h @@ -47,6 +47,15 @@ bool mndUpdateArbGroupBySetAssignedLeader(SArbGroup *pGroup, int32_t vgId, char int32_t mndGetArbGroupSize(SMnode *pMnode); +typedef enum { + CHECK_SYNC_NONE = 0, + CHECK_SYNC_SET_ASSIGNED_LEADER = 1, + CHECK_SYNC_CHECK_SYNC = 2, + CHECK_SYNC_UPDATE = 3 +} ECheckSyncOp; + +void mndArbCheckSync(SArbGroup *pArbGroup, int64_t nowMs, ECheckSyncOp *pOp, SArbGroup *pNewGroup); + #ifdef __cplusplus } #endif diff --git a/source/dnode/mnode/impl/src/mndArbGroup.c b/source/dnode/mnode/impl/src/mndArbGroup.c index 1faee3744cbc..0192044e67c4 100644 --- a/source/dnode/mnode/impl/src/mndArbGroup.c +++ b/source/dnode/mnode/impl/src/mndArbGroup.c @@ -583,14 +583,7 @@ static int32_t mndSendArbSetAssignedLeaderReq(SMnode *pMnode, int32_t dnodeId, i return code; } -typedef enum { - CHECK_SYNC_NONE = 0, - CHECK_SYNC_SET_ASSIGNED_LEADER = 1, - CHECK_SYNC_CHECK_SYNC = 2, - CHECK_SYNC_UPDATE = 3 -} ECheckSyncOp; - -static void mndArbCheckSync(SArbGroup *pArbGroup, int64_t nowMs, ECheckSyncOp *pOp, SArbGroup *pNewGroup) { +void mndArbCheckSync(SArbGroup *pArbGroup, int64_t nowMs, ECheckSyncOp *pOp, SArbGroup *pNewGroup) { *pOp = CHECK_SYNC_NONE; int32_t code = 0; diff --git a/source/dnode/mnode/impl/test/arbgroup/arbgroup.cpp b/source/dnode/mnode/impl/test/arbgroup/arbgroup.cpp index fdfc560d54fe..11fba524fe65 100644 --- a/source/dnode/mnode/impl/test/arbgroup/arbgroup.cpp +++ b/source/dnode/mnode/impl/test/arbgroup/arbgroup.cpp @@ -80,17 +80,17 @@ TEST_F(ArbgroupTest, 01_encode_decode_sdb) { SArbGroup* pNewGroup = (SArbGroup*)sdbGetRowObj(pRow); - EXPECT_EQ(group.vgId, pNewGroup->vgId); - EXPECT_EQ(group.dbUid, pNewGroup->dbUid); - EXPECT_EQ(group.members[0].info.dnodeId, pNewGroup->members[0].info.dnodeId); - EXPECT_EQ(group.members[1].info.dnodeId, pNewGroup->members[1].info.dnodeId); - EXPECT_EQ(group.isSync, pNewGroup->isSync); - EXPECT_EQ(group.assignedLeader.dnodeId, pNewGroup->assignedLeader.dnodeId); - - EXPECT_EQ(std::string(group.members[0].state.token), std::string(pNewGroup->members[0].state.token)); - EXPECT_EQ(std::string(group.members[1].state.token), std::string(pNewGroup->members[1].state.token)); - EXPECT_EQ(std::string(group.assignedLeader.token), std::string(pNewGroup->assignedLeader.token)); - EXPECT_EQ(group.version, pNewGroup->version); + ASSERT_EQ(group.vgId, pNewGroup->vgId); + ASSERT_EQ(group.dbUid, pNewGroup->dbUid); + ASSERT_EQ(group.members[0].info.dnodeId, pNewGroup->members[0].info.dnodeId); + ASSERT_EQ(group.members[1].info.dnodeId, pNewGroup->members[1].info.dnodeId); + ASSERT_EQ(group.isSync, pNewGroup->isSync); + ASSERT_EQ(group.assignedLeader.dnodeId, pNewGroup->assignedLeader.dnodeId); + + ASSERT_EQ(std::string(group.members[0].state.token), std::string(pNewGroup->members[0].state.token)); + ASSERT_EQ(std::string(group.members[1].state.token), std::string(pNewGroup->members[1].state.token)); + ASSERT_EQ(std::string(group.assignedLeader.token), std::string(pNewGroup->assignedLeader.token)); + ASSERT_EQ(group.version, pNewGroup->version); taosMemoryFree(pRow); taosMemoryFree(pRaw); @@ -129,9 +129,9 @@ TEST_F(ArbgroupTest, 02_process_heart_beat_rsp) { SArbGroup newGroup = {0}; bool updateToken = mndUpdateArbGroupByHeartBeat(&group, &rspMember, nowMs, dnodeId, &newGroup); - EXPECT_FALSE(updateToken); - EXPECT_NE(group.members[0].state.responsedHbSeq, rspMember.hbSeq); - EXPECT_NE(group.members[0].state.lastHbMs, nowMs); + ASSERT_EQ(updateToken, false); + ASSERT_NE(group.members[0].state.responsedHbSeq, rspMember.hbSeq); + ASSERT_NE(group.members[0].state.lastHbMs, nowMs); } { // old token @@ -144,9 +144,9 @@ TEST_F(ArbgroupTest, 02_process_heart_beat_rsp) { SArbGroup newGroup = {0}; bool updateToken = mndUpdateArbGroupByHeartBeat(&group, &rspMember, nowMs, dnodeId, &newGroup); - EXPECT_FALSE(updateToken); - EXPECT_EQ(group.members[0].state.responsedHbSeq, rspMember.hbSeq); - EXPECT_EQ(group.members[0].state.lastHbMs, nowMs); + ASSERT_EQ(updateToken, false); + ASSERT_EQ(group.members[0].state.responsedHbSeq, rspMember.hbSeq); + ASSERT_EQ(group.members[0].state.lastHbMs, nowMs); } { // new token @@ -159,14 +159,14 @@ TEST_F(ArbgroupTest, 02_process_heart_beat_rsp) { SArbGroup newGroup = {0}; bool updateToken = mndUpdateArbGroupByHeartBeat(&group, &rspMember, nowMs, dnodeId, &newGroup); - EXPECT_TRUE(updateToken); - EXPECT_EQ(group.members[0].state.responsedHbSeq, rspMember.hbSeq); - EXPECT_EQ(group.members[0].state.lastHbMs, nowMs); + ASSERT_EQ(updateToken, true); + ASSERT_EQ(group.members[0].state.responsedHbSeq, rspMember.hbSeq); + ASSERT_EQ(group.members[0].state.lastHbMs, nowMs); - EXPECT_EQ(std::string(newGroup.members[0].state.token), std::string(rspMember.memberToken)); - EXPECT_FALSE(newGroup.isSync); - EXPECT_EQ(newGroup.assignedLeader.dnodeId, 0); - EXPECT_EQ(std::string(newGroup.assignedLeader.token).size(), 0); + ASSERT_EQ(std::string(newGroup.members[0].state.token), std::string(rspMember.memberToken)); + ASSERT_EQ(newGroup.isSync, false); + ASSERT_EQ(newGroup.assignedLeader.dnodeId, 0); + ASSERT_EQ(std::string(newGroup.assignedLeader.token).size(), 0); } taosThreadMutexDestroy(&group.mutex); @@ -203,7 +203,7 @@ TEST_F(ArbgroupTest, 03_process_check_sync_rsp) { SArbGroup newGroup = {0}; bool updateIsSync = mndUpdateArbGroupByCheckSync(&group, vgId, member0Token, member1Token, newIsSync, &newGroup); - EXPECT_FALSE(updateIsSync); + ASSERT_EQ(updateIsSync, false); } { // newIsSync @@ -216,8 +216,8 @@ TEST_F(ArbgroupTest, 03_process_check_sync_rsp) { SArbGroup newGroup = {0}; bool updateIsSync = mndUpdateArbGroupByCheckSync(&group, vgId, member0Token, member1Token, newIsSync, &newGroup); - EXPECT_TRUE(updateIsSync); - EXPECT_TRUE(newGroup.isSync); + ASSERT_EQ(updateIsSync, true); + ASSERT_EQ(newGroup.isSync, true); } taosThreadMutexDestroy(&group.mutex); @@ -254,7 +254,7 @@ TEST_F(ArbgroupTest, 04_process_set_assigned_leader){ SArbGroup newGroup = {0}; bool updateAssigned = mndUpdateArbGroupBySetAssignedLeader(&group, vgId, memberToken, errcode, &newGroup); - EXPECT_FALSE(updateAssigned); + ASSERT_EQ(updateAssigned, false); } { // errcode != TSDB_CODE_SUCCESS @@ -265,7 +265,7 @@ TEST_F(ArbgroupTest, 04_process_set_assigned_leader){ SArbGroup newGroup = {0}; bool updateAssigned = mndUpdateArbGroupBySetAssignedLeader(&group, vgId, memberToken, errcode, &newGroup); - EXPECT_FALSE(updateAssigned); + ASSERT_EQ(updateAssigned, false); } { // errcode == TSDB_CODE_SUCCESS @@ -276,11 +276,77 @@ TEST_F(ArbgroupTest, 04_process_set_assigned_leader){ SArbGroup newGroup = {0}; bool updateAssigned = mndUpdateArbGroupBySetAssignedLeader(&group, vgId, memberToken, errcode, &newGroup); - EXPECT_TRUE(updateAssigned); - EXPECT_FALSE(newGroup.isSync); + ASSERT_EQ(updateAssigned, true); + ASSERT_EQ(newGroup.isSync, false); } taosThreadMutexDestroy(&group.mutex); } +TEST_F(ArbgroupTest, 05_check_sync_timer) { + const int32_t assgndDnodeId = 1; + const int32_t vgId = 5; + const int64_t nowMs = 173044838300; + + SArbGroup group = {0}; + group.vgId = vgId; + group.dbUid = 1234; + group.members[0].info.dnodeId = assgndDnodeId; + group.members[0].state.lastHbMs = nowMs - 10; + + group.members[1].info.dnodeId = 2; + group.members[1].state.lastHbMs = nowMs - 10; + + group.isSync = 1; + taosThreadMutexInit(&group.mutex, NULL); + + SArbAssignedLeader assgnedLeader = {.dnodeId = assgndDnodeId, .acked = false}; + strncpy(assgnedLeader.token, group.members[0].state.token, TSDB_ARB_TOKEN_SIZE); + + SArbAssignedLeader nonoAsgndLeader = {.dnodeId = 0, .acked = false}; + + ECheckSyncOp op = CHECK_SYNC_NONE; + SArbGroup newGroup = {0}; + + // 1. asgnd,sync,noAck --> send set assigned + group.assignedLeader = assgnedLeader; + group.assignedLeader.acked = false; + group.isSync = true; + mndArbCheckSync(&group, nowMs, &op, &newGroup); + + ASSERT_EQ(op, CHECK_SYNC_SET_ASSIGNED_LEADER); + + // 2. asgnd,notSync,noAck --> send set assgnd + newGroup = {0}; + group.assignedLeader = assgnedLeader; + group.isSync = false; + group.assignedLeader.acked = false; + mndArbCheckSync(&group, nowMs, &op, &newGroup); + + ASSERT_EQ(op, CHECK_SYNC_SET_ASSIGNED_LEADER); + + // 3. noAsgnd,notSync,noAck(init) --> check sync + newGroup = {0}; + group.assignedLeader = nonoAsgndLeader; + group.isSync = false; + group.assignedLeader.acked = false; + mndArbCheckSync(&group, nowMs, &op, &newGroup); + + ASSERT_EQ(op, CHECK_SYNC_CHECK_SYNC); + + // 4. noAsgnd,sync,noAck,one timeout--> update arbgroup (asgnd,sync,noAck) + newGroup = {0}; + group.assignedLeader = nonoAsgndLeader; + group.isSync = true; + group.assignedLeader.acked = false; + group.members[1].state.lastHbMs = nowMs - 2 * tsArbSetAssignedTimeoutSec * 1000; // member1 timeout + mndArbCheckSync(&group, nowMs, &op, &newGroup); + + ASSERT_EQ(op, CHECK_SYNC_UPDATE); + ASSERT_EQ(newGroup.assignedLeader.dnodeId, assgndDnodeId); + ASSERT_EQ(std::string(newGroup.assignedLeader.token), std::string(group.members[0].state.token)); + ASSERT_EQ(newGroup.isSync, true); + ASSERT_EQ(newGroup.assignedLeader.acked, false); +} + #pragma GCC diagnostic pop From 17077d1a3244d461e1e05440c64a9a13013b2fa5 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Fri, 1 Nov 2024 17:53:06 +0800 Subject: [PATCH 586/695] handle mem leak failure --- source/client/src/clientImpl.c | 44 +++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index 74fd4e13a728..8d867455663c 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -1770,19 +1770,15 @@ void updateTargetEpSet(SMsgSendInfo* pSendInfo, STscObj* pTscObj, SRpcMsg* pMsg, } } -int32_t doProcessMsgFromServer(void* param) { - AsyncArg* arg = (AsyncArg*)param; - SRpcMsg* pMsg = &arg->msg; - SEpSet* pEpSet = arg->pEpset; - +int32_t doProcessMsFromServerImpl(SRpcMsg* pMsg, SEpSet* pEpSet) { SMsgSendInfo* pSendInfo = (SMsgSendInfo*)pMsg->info.ahandle; if (pMsg->info.ahandle == NULL) { tscError("doProcessMsgFromServer pMsg->info.ahandle == NULL"); - taosMemoryFree(arg->pEpset); rpcFreeCont(pMsg->pCont); - taosMemoryFree(arg); + taosMemoryFree(pEpSet); return TSDB_CODE_TSC_INTERNAL_ERROR; } + STscObj* pTscObj = NULL; STraceId* trace = &pMsg->info.traceId; @@ -1802,10 +1798,9 @@ int32_t doProcessMsgFromServer(void* param) { if (TSDB_CODE_SUCCESS != taosReleaseRef(clientReqRefPool, pSendInfo->requestObjRefId)) { tscError("doProcessMsgFromServer taosReleaseRef failed"); } - taosMemoryFree(arg->pEpset); rpcFreeCont(pMsg->pCont); + taosMemoryFree(pEpSet); destroySendMsgInfo(pSendInfo); - taosMemoryFree(arg); return TSDB_CODE_TSC_INTERNAL_ERROR; } pTscObj = pRequest->pTscObj; @@ -1844,20 +1839,24 @@ int32_t doProcessMsgFromServer(void* param) { rpcFreeCont(pMsg->pCont); destroySendMsgInfo(pSendInfo); - - taosMemoryFree(arg); return TSDB_CODE_SUCCESS; } +int32_t doProcessMsgFromServer(void* param) { + AsyncArg* arg = (AsyncArg*)param; + int32_t code = doProcessMsFromServerImpl(&arg->msg, arg->pEpset); + taosMemoryFree(arg); + return code; +} void processMsgFromServer(void* parent, SRpcMsg* pMsg, SEpSet* pEpSet) { + int32_t code = 0; SEpSet* tEpSet = NULL; if (pEpSet != NULL) { tEpSet = taosMemoryCalloc(1, sizeof(SEpSet)); if (NULL == tEpSet) { - pMsg->code = TSDB_CODE_OUT_OF_MEMORY; - rpcFreeCont(pMsg->pCont); - destroySendMsgInfo(pMsg->info.ahandle); - return; + code = terrno; + pMsg->code = terrno; + goto _exit; } (void)memcpy((void*)tEpSet, (void*)pEpSet, sizeof(SEpSet)); } @@ -1879,12 +1878,12 @@ void processMsgFromServer(void* parent, SRpcMsg* pMsg, SEpSet* pEpSet) { AsyncArg* arg = taosMemoryCalloc(1, sizeof(AsyncArg)); if (NULL == arg) { - pMsg->code = TSDB_CODE_OUT_OF_MEMORY; - taosMemoryFree(tEpSet); - rpcFreeCont(pMsg->pCont); - destroySendMsgInfo(pMsg->info.ahandle); + code = terrno; + pMsg->code = code; + goto _exit; return; } + arg->msg = *pMsg; arg->pEpset = tEpSet; @@ -1895,6 +1894,13 @@ void processMsgFromServer(void* parent, SRpcMsg* pMsg, SEpSet* pEpSet) { destroySendMsgInfo(pMsg->info.ahandle); taosMemoryFree(arg); } + return; +_exit: + tscError("failed to sched msg to tsc since %s", tstrerror(code)); + code = doProcessMsFromServerImpl(pMsg, tEpSet); + if (code != 0) { + tscError("failed to sched msg to tsc, tsc ready quit"); + } } TAOS* taos_connect_auth(const char* ip, const char* user, const char* auth, const char* db, uint16_t port) { From e7b974fd6a41a5dd9b54f85028e202b684c8ce90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=B9=E9=87=91=E6=A0=87?= <34178510+JinbiaoYin@users.noreply.github.com> Date: Thu, 13 Jun 2024 17:19:37 +0800 Subject: [PATCH 587/695] Update 07-tag-index.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 中文括号错误 --- docs/zh/14-reference/03-taos-sql/07-tag-index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/zh/14-reference/03-taos-sql/07-tag-index.md b/docs/zh/14-reference/03-taos-sql/07-tag-index.md index 383c5b2a1f0a..364d465ba394 100644 --- a/docs/zh/14-reference/03-taos-sql/07-tag-index.md +++ b/docs/zh/14-reference/03-taos-sql/07-tag-index.md @@ -11,7 +11,7 @@ description: 使用标签索引提升查询性能 创建索引的语法如下 ```sql -CREATE INDEX index_name ON tbl_name (tagColName) +CREATE INDEX index_name ON tbl_name (tagColName) ``` 其中 `index_name` 为索引名称, `tbl_name` 为超级表名称,`tagColName` 为要在其上建立索引的 tag 列的名称。`tagColName` 的类型不受限制,即任何类型的 tag 列都可以建立索引。 From 74969b0fd4a6d5341092a3733e51bf08e76540ad Mon Sep 17 00:00:00 2001 From: yinheli Date: Mon, 13 May 2024 17:37:08 +0800 Subject: [PATCH 588/695] chore(typo): fix typo --- source/dnode/mnode/impl/inc/mndDef.h | 2 +- source/dnode/mnode/impl/src/mndDnode.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/dnode/mnode/impl/inc/mndDef.h b/source/dnode/mnode/impl/inc/mndDef.h index 742db8f450a9..d2d9b2e8eb2f 100644 --- a/source/dnode/mnode/impl/inc/mndDef.h +++ b/source/dnode/mnode/impl/inc/mndDef.h @@ -70,7 +70,7 @@ typedef enum { MND_OPER_WRITE_DB, MND_OPER_READ_DB, MND_OPER_READ_OR_WRITE_DB, - MND_OPER_SHOW_VARIBALES, + MND_OPER_SHOW_VARIABLES, MND_OPER_SUBSCRIBE, MND_OPER_CREATE_TOPIC, MND_OPER_DROP_TOPIC, diff --git a/source/dnode/mnode/impl/src/mndDnode.c b/source/dnode/mnode/impl/src/mndDnode.c index 5e10583a0a6e..2a1689854b88 100644 --- a/source/dnode/mnode/impl/src/mndDnode.c +++ b/source/dnode/mnode/impl/src/mndDnode.c @@ -1068,7 +1068,7 @@ static int32_t mndProcessShowVariablesReq(SRpcMsg *pReq) { SShowVariablesRsp rsp = {0}; int32_t code = -1; - if (mndCheckOperPrivilege(pReq->info.node, pReq->info.conn.user, MND_OPER_SHOW_VARIBALES) != 0) { + if (mndCheckOperPrivilege(pReq->info.node, pReq->info.conn.user, MND_OPER_SHOW_VARIABLES) != 0) { goto _OVER; } From 7041e6474493a184a2abb5c56a6ce5719adcd44d Mon Sep 17 00:00:00 2001 From: xsren <285808407@qq.com> Date: Sun, 3 Nov 2024 23:00:31 +0800 Subject: [PATCH 589/695] add colDataSetVal func desc --- include/common/tdatablock.h | 4 +++ source/libs/executor/src/dataDispatcher.c | 39 +++++++++++++++++++---- 2 files changed, 37 insertions(+), 6 deletions(-) diff --git a/include/common/tdatablock.h b/include/common/tdatablock.h index 6578999db415..1103b89ccb04 100644 --- a/include/common/tdatablock.h +++ b/include/common/tdatablock.h @@ -189,7 +189,11 @@ static FORCE_INLINE void colDataSetDouble(SColumnInfoData* pColumnInfoData, uint int32_t getJsonValueLen(const char* data); +// For the VAR_DATA_TYPE type, new data is inserted strictly according to the position of SVarColAttr.length. +// If the same row is inserted repeatedly, data holes will result. int32_t colDataSetVal(SColumnInfoData* pColumnInfoData, uint32_t rowIndex, const char* pData, bool isNull); +// For the VAR_DATA_TYPE type, if a row already has data before inserting it (judged by offset != -1), +// it will be inserted at the original position and the old data will be overwritten. int32_t colDataSetValOrCover(SColumnInfoData* pColumnInfoData, uint32_t rowIndex, const char* pData, bool isNull); int32_t colDataReassignVal(SColumnInfoData* pColumnInfoData, uint32_t dstRowIdx, uint32_t srcRowIdx, const char* pData); int32_t colDataSetNItems(SColumnInfoData* pColumnInfoData, uint32_t rowIndex, const char* pData, uint32_t numOfRows, diff --git a/source/libs/executor/src/dataDispatcher.c b/source/libs/executor/src/dataDispatcher.c index 236d6a4d3ee3..48f4ed3ed1aa 100644 --- a/source/libs/executor/src/dataDispatcher.c +++ b/source/libs/executor/src/dataDispatcher.c @@ -70,21 +70,15 @@ static int32_t inputSafetyCheck(SDataDispatchHandle* pHandle, const SInputData* SNode* pNode; int32_t numOfCols = 0; - int32_t realOutputRowSize = 0; FOREACH(pNode, pHandle->pSchema->pSlots) { SSlotDescNode* pSlotDesc = (SSlotDescNode*)pNode; if (pSlotDesc->output) { - realOutputRowSize += pSlotDesc->dataType.bytes; ++numOfCols; } else { // Slots must be sorted, and slots with 'output' set to true must come first break; } } - if (realOutputRowSize != pSchema->outputRowSize) { - qError("invalid schema, realOutputRowSize:%d, outputRowSize:%d", realOutputRowSize, pSchema->outputRowSize); - return TSDB_CODE_QRY_INVALID_INPUT; - } if (numOfCols > taosArrayGetSize(pInput->pData->pDataBlock)) { qError("invalid column number, schema:%d, input:%zu", numOfCols, taosArrayGetSize(pInput->pData->pDataBlock)); @@ -397,8 +391,41 @@ static int32_t getCacheSize(struct SDataSinkHandle* pHandle, uint64_t* size) { return TSDB_CODE_SUCCESS; } +static int32_t blockDescNodeCheck(SDataBlockDescNode* pInputDataBlockDesc) { + if(tsSafetyCheckLevel == TSDB_SAFETY_CHECK_LEVELL_NEVER) { + return TSDB_CODE_SUCCESS; + } + + if (pInputDataBlockDesc == NULL) { + qError("invalid schema"); + return TSDB_CODE_QRY_INVALID_INPUT; + } + + SNode* pNode; + int32_t realOutputRowSize = 0; + FOREACH(pNode, pInputDataBlockDesc->pSlots) { + SSlotDescNode* pSlotDesc = (SSlotDescNode*)pNode; + if (pSlotDesc->output) { + realOutputRowSize += pSlotDesc->dataType.bytes; + } else { + // Slots must be sorted, and slots with 'output' set to true must come first + break; + } + } + if (realOutputRowSize != pInputDataBlockDesc->outputRowSize) { + qError("invalid schema, realOutputRowSize:%d, outputRowSize:%d", realOutputRowSize, pInputDataBlockDesc->outputRowSize); + return TSDB_CODE_QRY_INVALID_INPUT; + } + return TSDB_CODE_SUCCESS; +} + int32_t createDataDispatcher(SDataSinkManager* pManager, const SDataSinkNode* pDataSink, DataSinkHandle* pHandle) { int32_t code; + code = blockDescNodeCheck(pDataSink->pInputDataBlockDesc); + if (code) { + qError("failed to check input data block desc, code:%d", code); + return code; + } SDataDispatchHandle* dispatcher = taosMemoryCalloc(1, sizeof(SDataDispatchHandle)); if (NULL == dispatcher) { From 8d19b071ba81cdc15e4ed542338c74bde5ea5858 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Mon, 4 Nov 2024 09:15:31 +0800 Subject: [PATCH 590/695] delete log --- tests/system-test/7-tmq/tmqConsFromTsdb1-1ctb-funcNFilter.py | 1 - tests/system-test/7-tmq/tmqConsFromTsdb1.py | 1 - 2 files changed, 2 deletions(-) diff --git a/tests/system-test/7-tmq/tmqConsFromTsdb1-1ctb-funcNFilter.py b/tests/system-test/7-tmq/tmqConsFromTsdb1-1ctb-funcNFilter.py index cd5dac5bbd1a..85adb50e8857 100644 --- a/tests/system-test/7-tmq/tmqConsFromTsdb1-1ctb-funcNFilter.py +++ b/tests/system-test/7-tmq/tmqConsFromTsdb1-1ctb-funcNFilter.py @@ -16,7 +16,6 @@ from tmqCommon import * class TDTestCase: - updatecfgDict = {'debugFlag': 143} def __init__(self): self.vgroups = 1 self.ctbNum = 1 diff --git a/tests/system-test/7-tmq/tmqConsFromTsdb1.py b/tests/system-test/7-tmq/tmqConsFromTsdb1.py index e245c6faa901..f66605f5f47e 100644 --- a/tests/system-test/7-tmq/tmqConsFromTsdb1.py +++ b/tests/system-test/7-tmq/tmqConsFromTsdb1.py @@ -16,7 +16,6 @@ from tmqCommon import * class TDTestCase: - updatecfgDict = {'debugFlag': 143} def __init__(self): self.vgroups = 1 self.ctbNum = 10 From 6286b28a32b942c3cf8657c8c16ad655beb7bd1e Mon Sep 17 00:00:00 2001 From: Shungang Li Date: Mon, 4 Nov 2024 09:30:20 +0800 Subject: [PATCH 591/695] fix: avoid compile error on win --- source/dnode/mnode/impl/test/arbgroup/arbgroup.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/source/dnode/mnode/impl/test/arbgroup/arbgroup.cpp b/source/dnode/mnode/impl/test/arbgroup/arbgroup.cpp index 11fba524fe65..d5ca01942022 100644 --- a/source/dnode/mnode/impl/test/arbgroup/arbgroup.cpp +++ b/source/dnode/mnode/impl/test/arbgroup/arbgroup.cpp @@ -300,10 +300,14 @@ TEST_F(ArbgroupTest, 05_check_sync_timer) { group.isSync = 1; taosThreadMutexInit(&group.mutex, NULL); - SArbAssignedLeader assgnedLeader = {.dnodeId = assgndDnodeId, .acked = false}; + SArbAssignedLeader assgnedLeader = {0}; + assgnedLeader.dnodeId = assgndDnodeId; + assgnedLeader.acked = false; strncpy(assgnedLeader.token, group.members[0].state.token, TSDB_ARB_TOKEN_SIZE); - SArbAssignedLeader nonoAsgndLeader = {.dnodeId = 0, .acked = false}; + SArbAssignedLeader noneAsgndLeader = {0}; + noneAsgndLeader.dnodeId = 0; + noneAsgndLeader.acked = false; ECheckSyncOp op = CHECK_SYNC_NONE; SArbGroup newGroup = {0}; @@ -327,7 +331,7 @@ TEST_F(ArbgroupTest, 05_check_sync_timer) { // 3. noAsgnd,notSync,noAck(init) --> check sync newGroup = {0}; - group.assignedLeader = nonoAsgndLeader; + group.assignedLeader = noneAsgndLeader; group.isSync = false; group.assignedLeader.acked = false; mndArbCheckSync(&group, nowMs, &op, &newGroup); @@ -336,7 +340,7 @@ TEST_F(ArbgroupTest, 05_check_sync_timer) { // 4. noAsgnd,sync,noAck,one timeout--> update arbgroup (asgnd,sync,noAck) newGroup = {0}; - group.assignedLeader = nonoAsgndLeader; + group.assignedLeader = noneAsgndLeader; group.isSync = true; group.assignedLeader.acked = false; group.members[1].state.lastHbMs = nowMs - 2 * tsArbSetAssignedTimeoutSec * 1000; // member1 timeout From 355aa885de6885ac537ed38f0b5f27f5920a19db Mon Sep 17 00:00:00 2001 From: Jing Sima Date: Thu, 31 Oct 2024 17:11:34 +0800 Subject: [PATCH 592/695] fix:[TD-32506] fix mem leak in percentile function. --- source/libs/executor/inc/executorInt.h | 7 ++++-- source/libs/executor/src/aggregateoperator.c | 20 ++++++++++++---- source/libs/executor/src/groupoperator.c | 4 ++-- .../executor/src/streamtimewindowoperator.c | 4 ++-- source/libs/executor/src/timewindowoperator.c | 24 +++++++++++++------ 5 files changed, 42 insertions(+), 17 deletions(-) diff --git a/source/libs/executor/inc/executorInt.h b/source/libs/executor/inc/executorInt.h index 572ff88be90e..98d3fefada4a 100644 --- a/source/libs/executor/inc/executorInt.h +++ b/source/libs/executor/inc/executorInt.h @@ -553,6 +553,7 @@ typedef struct SIntervalAggOperatorInfo { EOPTR_EXEC_MODEL execModel; // operator execution model [batch model|stream model] STimeWindowAggSupp twAggSup; SArray* pPrevValues; // SArray used to keep the previous not null value for interpolation. + bool cleanGroupResInfo; struct SOperatorInfo* pOperator; // for limit optimization bool limited; @@ -831,8 +832,10 @@ void cleanupExprSupp(SExprSupp* pSup); void cleanupResultInfoInStream(SExecTaskInfo* pTaskInfo, void* pState, SExprSupp* pSup, SGroupResInfo* pGroupResInfo); -void cleanupResultInfo(SExecTaskInfo* pTaskInfo, SExprSupp* pSup, SDiskbasedBuf* pBuf, - SGroupResInfo* pGroupResInfo, SSHashObj* pHashmap); +void cleanupResultInfoInHashMap(SExecTaskInfo* pTaskInfo, SExprSupp* pSup, SDiskbasedBuf* pBuf, + SGroupResInfo* pGroupResInfo, SSHashObj* pHashmap); +void cleanupResultInfo(SExecTaskInfo* pTaskInfo, SExprSupp* pSup, SGroupResInfo* pGroupResInfo, + SAggSupporter *pAggSup, bool cleanHashmap); void cleanupResultInfoWithoutHash(SExecTaskInfo* pTaskInfo, SExprSupp* pSup, SDiskbasedBuf* pBuf, SGroupResInfo* pGroupResInfo); diff --git a/source/libs/executor/src/aggregateoperator.c b/source/libs/executor/src/aggregateoperator.c index 91b435fbec38..829ca6da5094 100644 --- a/source/libs/executor/src/aggregateoperator.c +++ b/source/libs/executor/src/aggregateoperator.c @@ -49,6 +49,7 @@ typedef struct SAggOperatorInfo { SSDataBlock* pNewGroupBlock; bool hasCountFunc; SOperatorInfo* pOperator; + bool cleanGroupResInfo; } SAggOperatorInfo; static void destroyAggOperatorInfo(void* param); @@ -121,6 +122,7 @@ int32_t createAggregateOperatorInfo(SOperatorInfo* downstream, SAggPhysiNode* pA pInfo->binfo.outputTsOrder = pAggNode->node.outputTsOrder; pInfo->hasCountFunc = pAggNode->hasCountLikeFunc; pInfo->pOperator = pOperator; + pInfo->cleanGroupResInfo = false; setOperatorInfo(pOperator, "TableAggregate", QUERY_NODE_PHYSICAL_PLAN_HASH_AGG, !pAggNode->node.forceCreateNonBlockingOptr, OP_NOT_OPENED, pInfo, pTaskInfo); @@ -159,8 +161,8 @@ void destroyAggOperatorInfo(void* param) { cleanupBasicInfo(&pInfo->binfo); if (pInfo->pOperator) { - cleanupResultInfoWithoutHash(pInfo->pOperator->pTaskInfo, &pInfo->pOperator->exprSupp, pInfo->aggSup.pResultBuf, - &pInfo->groupResInfo); + cleanupResultInfo(pInfo->pOperator->pTaskInfo, &pInfo->pOperator->exprSupp, &pInfo->groupResInfo, &pInfo->aggSup, + pInfo->cleanGroupResInfo); pInfo->pOperator = NULL; } cleanupAggSup(&pInfo->aggSup); @@ -191,6 +193,7 @@ static bool nextGroupedResult(SOperatorInfo* pOperator) { int32_t order = pAggInfo->binfo.inputTsOrder; SSDataBlock* pBlock = pAggInfo->pNewGroupBlock; + pAggInfo->cleanGroupResInfo = false; if (pBlock) { pAggInfo->pNewGroupBlock = NULL; tSimpleHashClear(pAggInfo->aggSup.pResultRowHashTable); @@ -263,6 +266,7 @@ static bool nextGroupedResult(SOperatorInfo* pOperator) { code = initGroupedResultInfo(&pAggInfo->groupResInfo, pAggInfo->aggSup.pResultRowHashTable, 0); QUERY_CHECK_CODE(code, lino, _end); + pAggInfo->cleanGroupResInfo = true; _end: if (code != TSDB_CODE_SUCCESS) { @@ -627,7 +631,7 @@ void cleanupResultInfoInStream(SExecTaskInfo* pTaskInfo, void* pState, SExprSupp } } -void cleanupResultInfoWithoutHash(SExecTaskInfo* pTaskInfo, SExprSupp* pSup, SDiskbasedBuf* pBuf, +void cleanupResultInfoInGroupResInfo(SExecTaskInfo* pTaskInfo, SExprSupp* pSup, SDiskbasedBuf* pBuf, SGroupResInfo* pGroupResInfo) { int32_t numOfExprs = pSup->numOfExprs; int32_t* rowEntryOffset = pSup->rowEntryInfoOffset; @@ -663,7 +667,7 @@ void cleanupResultInfoWithoutHash(SExecTaskInfo* pTaskInfo, SExprSupp* pSup, SDi } } -void cleanupResultInfo(SExecTaskInfo* pTaskInfo, SExprSupp* pSup, SDiskbasedBuf* pBuf, +void cleanupResultInfoInHashMap(SExecTaskInfo* pTaskInfo, SExprSupp* pSup, SDiskbasedBuf* pBuf, SGroupResInfo* pGroupResInfo, SSHashObj* pHashmap) { int32_t numOfExprs = pSup->numOfExprs; int32_t* rowEntryOffset = pSup->rowEntryInfoOffset; @@ -701,6 +705,14 @@ void cleanupResultInfo(SExecTaskInfo* pTaskInfo, SExprSupp* pSup, SDiskbasedBuf* } } +void cleanupResultInfo(SExecTaskInfo* pTaskInfo, SExprSupp* pSup, SGroupResInfo* pGroupResInfo, + SAggSupporter *pAggSup, bool cleanGroupResInfo) { + if (cleanGroupResInfo) { + cleanupResultInfoInGroupResInfo(pTaskInfo, pSup, pAggSup->pResultBuf, pGroupResInfo); + } else { + cleanupResultInfoInHashMap(pTaskInfo, pSup, pAggSup->pResultBuf, pGroupResInfo, pAggSup->pResultRowHashTable); + } +} void cleanupAggSup(SAggSupporter* pAggSup) { taosMemoryFreeClear(pAggSup->keyBuf); tSimpleHashCleanup(pAggSup->pResultRowHashTable); diff --git a/source/libs/executor/src/groupoperator.c b/source/libs/executor/src/groupoperator.c index 0f85c3346d10..e4db766a6a67 100644 --- a/source/libs/executor/src/groupoperator.c +++ b/source/libs/executor/src/groupoperator.c @@ -88,8 +88,8 @@ static void destroyGroupOperatorInfo(void* param) { cleanupExprSupp(&pInfo->scalarSup); if (pInfo->pOperator != NULL) { - cleanupResultInfo(pInfo->pOperator->pTaskInfo, &pInfo->pOperator->exprSupp, pInfo->aggSup.pResultBuf, - &pInfo->groupResInfo, pInfo->aggSup.pResultRowHashTable); + cleanupResultInfo(pInfo->pOperator->pTaskInfo, &pInfo->pOperator->exprSupp, &pInfo->groupResInfo, &pInfo->aggSup, + false); pInfo->pOperator = NULL; } diff --git a/source/libs/executor/src/streamtimewindowoperator.c b/source/libs/executor/src/streamtimewindowoperator.c index 67ec976ee94a..a7f8934c036d 100644 --- a/source/libs/executor/src/streamtimewindowoperator.c +++ b/source/libs/executor/src/streamtimewindowoperator.c @@ -474,8 +474,8 @@ void destroyStreamFinalIntervalOperatorInfo(void* param) { SStreamIntervalOperatorInfo* pInfo = (SStreamIntervalOperatorInfo*)param; cleanupBasicInfo(&pInfo->binfo); if (pInfo->pOperator) { - cleanupResultInfo(pInfo->pOperator->pTaskInfo, &pInfo->pOperator->exprSupp, pInfo->aggSup.pResultBuf, - &pInfo->groupResInfo, pInfo->aggSup.pResultRowHashTable); + cleanupResultInfo(pInfo->pOperator->pTaskInfo, &pInfo->pOperator->exprSupp, &pInfo->groupResInfo, &pInfo->aggSup, + false); pInfo->pOperator = NULL; } cleanupAggSup(&pInfo->aggSup); diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c index 34ecda6ce709..538d2a8a2e7b 100644 --- a/source/libs/executor/src/timewindowoperator.c +++ b/source/libs/executor/src/timewindowoperator.c @@ -38,6 +38,7 @@ typedef struct SSessionAggOperatorInfo { int32_t tsSlotId; // primary timestamp slot id STimeWindowAggSupp twAggSup; SOperatorInfo* pOperator; + bool cleanGroupResInfo; } SSessionAggOperatorInfo; typedef struct SStateWindowOperatorInfo { @@ -52,6 +53,7 @@ typedef struct SStateWindowOperatorInfo { int32_t tsSlotId; // primary timestamp column slot id STimeWindowAggSupp twAggSup; SOperatorInfo* pOperator; + bool cleanGroupResInfo; } SStateWindowOperatorInfo; typedef enum SResultTsInterpType { @@ -943,6 +945,7 @@ static int32_t doOpenIntervalAgg(SOperatorInfo* pOperator) { int32_t scanFlag = MAIN_SCAN; int64_t st = taosGetTimestampUs(); + pInfo->cleanGroupResInfo = false; while (1) { SSDataBlock* pBlock = getNextBlockFromDownstream(pOperator, 0); if (pBlock == NULL) { @@ -965,6 +968,7 @@ static int32_t doOpenIntervalAgg(SOperatorInfo* pOperator) { code = initGroupedResultInfo(&pInfo->groupResInfo, pInfo->aggSup.pResultRowHashTable, pInfo->binfo.outputTsOrder); QUERY_CHECK_CODE(code, lino, _end); + pInfo->cleanGroupResInfo = true; OPTR_SET_OPENED(pOperator); @@ -1092,6 +1096,7 @@ static int32_t openStateWindowAggOptr(SOperatorInfo* pOperator) { int64_t st = taosGetTimestampUs(); SOperatorInfo* downstream = pOperator->pDownstream[0]; + pInfo->cleanGroupResInfo = false; while (1) { SSDataBlock* pBlock = getNextBlockFromDownstream(pOperator, 0); if (pBlock == NULL) { @@ -1120,7 +1125,7 @@ static int32_t openStateWindowAggOptr(SOperatorInfo* pOperator) { pOperator->cost.openCost = (taosGetTimestampUs() - st) / 1000.0; code = initGroupedResultInfo(&pInfo->groupResInfo, pInfo->aggSup.pResultRowHashTable, TSDB_ORDER_ASC); QUERY_CHECK_CODE(code, lino, _end); - + pInfo->cleanGroupResInfo = true; pOperator->status = OP_RES_TO_RETURN; _end: @@ -1230,8 +1235,8 @@ static void destroyStateWindowOperatorInfo(void* param) { cleanupBasicInfo(&pInfo->binfo); taosMemoryFreeClear(pInfo->stateKey.pData); if (pInfo->pOperator) { - cleanupResultInfoWithoutHash(pInfo->pOperator->pTaskInfo, &pInfo->pOperator->exprSupp, pInfo->aggSup.pResultBuf, - &pInfo->groupResInfo); + cleanupResultInfo(pInfo->pOperator->pTaskInfo, &pInfo->pOperator->exprSupp, &pInfo->groupResInfo, &pInfo->aggSup, + pInfo->cleanGroupResInfo); pInfo->pOperator = NULL; } @@ -1257,8 +1262,8 @@ void destroyIntervalOperatorInfo(void* param) { cleanupBasicInfo(&pInfo->binfo); if (pInfo->pOperator) { - cleanupResultInfoWithoutHash(pInfo->pOperator->pTaskInfo, &pInfo->pOperator->exprSupp, pInfo->aggSup.pResultBuf, - &pInfo->groupResInfo); + cleanupResultInfo(pInfo->pOperator->pTaskInfo, &pInfo->pOperator->exprSupp, &pInfo->groupResInfo, &pInfo->aggSup, + pInfo->cleanGroupResInfo); pInfo->pOperator = NULL; } @@ -1452,6 +1457,7 @@ int32_t createIntervalOperatorInfo(SOperatorInfo* downstream, SIntervalPhysiNode } pInfo->pOperator = pOperator; + pInfo->cleanGroupResInfo = false; initResultRowInfo(&pInfo->binfo.resultRowInfo); setOperatorInfo(pOperator, "TimeIntervalAggOperator", QUERY_NODE_PHYSICAL_PLAN_HASH_INTERVAL, true, OP_NOT_OPENED, pInfo, pTaskInfo); @@ -1573,6 +1579,7 @@ static int32_t doSessionWindowAggNext(SOperatorInfo* pOperator, SSDataBlock** pp SOptrBasicInfo* pBInfo = &pInfo->binfo; SExprSupp* pSup = &pOperator->exprSupp; + pInfo->cleanGroupResInfo = false; if (pOperator->status == OP_RES_TO_RETURN) { while (1) { doBuildResultDatablock(pOperator, &pInfo->binfo, &pInfo->groupResInfo, pInfo->aggSup.pResultBuf); @@ -1628,6 +1635,7 @@ static int32_t doSessionWindowAggNext(SOperatorInfo* pOperator, SSDataBlock** pp code = initGroupedResultInfo(&pInfo->groupResInfo, pInfo->aggSup.pResultRowHashTable, TSDB_ORDER_ASC); QUERY_CHECK_CODE(code, lino, _end); + pInfo->cleanGroupResInfo = true; code = blockDataEnsureCapacity(pBInfo->pRes, pOperator->resultInfo.capacity); QUERY_CHECK_CODE(code, lino, _end); @@ -1731,6 +1739,7 @@ int32_t createStatewindowOperatorInfo(SOperatorInfo* downstream, SStateWinodwPhy pInfo->tsSlotId = tsSlotId; pInfo->pOperator = pOperator; + pInfo->cleanGroupResInfo = false; setOperatorInfo(pOperator, "StateWindowOperator", QUERY_NODE_PHYSICAL_PLAN_MERGE_STATE, true, OP_NOT_OPENED, pInfo, pTaskInfo); pOperator->fpSet = createOperatorFpSet(openStateWindowAggOptr, doStateWindowAggNext, NULL, destroyStateWindowOperatorInfo, @@ -1763,8 +1772,8 @@ void destroySWindowOperatorInfo(void* param) { cleanupBasicInfo(&pInfo->binfo); colDataDestroy(&pInfo->twAggSup.timeWindowData); if (pInfo->pOperator) { - cleanupResultInfoWithoutHash(pInfo->pOperator->pTaskInfo, &pInfo->pOperator->exprSupp, pInfo->aggSup.pResultBuf, - &pInfo->groupResInfo); + cleanupResultInfo(pInfo->pOperator->pTaskInfo, &pInfo->pOperator->exprSupp, &pInfo->groupResInfo, &pInfo->aggSup, + pInfo->cleanGroupResInfo); pInfo->pOperator = NULL; } @@ -1835,6 +1844,7 @@ int32_t createSessionAggOperatorInfo(SOperatorInfo* downstream, SSessionWinodwPh QUERY_CHECK_CODE(code, lino, _error); pInfo->pOperator = pOperator; + pInfo->cleanGroupResInfo = false; setOperatorInfo(pOperator, "SessionWindowAggOperator", QUERY_NODE_PHYSICAL_PLAN_MERGE_SESSION, true, OP_NOT_OPENED, pInfo, pTaskInfo); pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, doSessionWindowAggNext, NULL, destroySWindowOperatorInfo, From 9df427c0cde0dbc9c3fe65b08ef1989a84d62bd4 Mon Sep 17 00:00:00 2001 From: Jing Sima Date: Fri, 1 Nov 2024 13:42:27 +0800 Subject: [PATCH 593/695] fix:[TD-32506] Add test case for TD-32506 --- source/libs/function/src/tpercentile.c | 4 +- tests/army/query/function/test_percentile.py | 194 +++++++++++++++++++ tests/parallel_test/cases.task | 1 + 3 files changed, 198 insertions(+), 1 deletion(-) create mode 100644 tests/army/query/function/test_percentile.py diff --git a/source/libs/function/src/tpercentile.c b/source/libs/function/src/tpercentile.c index 429ab52a8d47..78c16ec7cb8b 100644 --- a/source/libs/function/src/tpercentile.c +++ b/source/libs/function/src/tpercentile.c @@ -224,7 +224,7 @@ int32_t tBucketDoubleHash(tMemBucket *pBucket, const void *value, int32_t *index *index = -1; - if (v > pBucket->range.dMaxVal || v < pBucket->range.dMinVal || isnan(v)) { + if (v > pBucket->range.dMaxVal || v < pBucket->range.dMinVal || isnan(v) || isinf(v)) { return TSDB_CODE_SUCCESS; } @@ -232,6 +232,8 @@ int32_t tBucketDoubleHash(tMemBucket *pBucket, const void *value, int32_t *index double span = pBucket->range.dMaxVal - pBucket->range.dMinVal; if (fabs(span) < DBL_EPSILON) { *index = 0; + } else if (isinf(span)) { + *index = -1; } else { double slotSpan = span / pBucket->numOfSlots; *index = (int32_t)((v - pBucket->range.dMinVal) / slotSpan); diff --git a/tests/army/query/function/test_percentile.py b/tests/army/query/function/test_percentile.py new file mode 100644 index 000000000000..004cad54c99e --- /dev/null +++ b/tests/army/query/function/test_percentile.py @@ -0,0 +1,194 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +from frame import etool +from frame.etool import * +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame.common import * + +class TDTestCase(TBase): + updatecfgDict = { + "keepColumnName": "1", + "ttlChangeOnWrite": "1", + "querySmaOptimize": "1", + "slowLogScope": "none", + "queryBufferSize": 10240 + } + + def insert_data(self): + tdLog.printNoPrefix("==========step1:create table") + + tdSql.execute(f'create database if not exists td32506') + tdSql.execute(f'use td32506') + tdSql.execute(f'CREATE STABLE fs_table (ts TIMESTAMP, speed INT, color VARCHAR(16), tinyint_type_col_name TINYINT, smallint_type_col_name SMALLINT, bigint_type_col_name BIGINT, ' + f'utinyint_type_col_name TINYINT, usmallint_type_col_name SMALLINT, uint_type_col_name INT, ubigint_type_col_name BIGINT, float_type_col_name FLOAT, ' + f'double_type_col_name DOUBLE, bool_type_col_name BOOL, nchar_type_col_name NCHAR(16), varchar_type_col_name VARCHAR(16), ' + f'varbinary_type_col_name VARBINARY(16),geometry_type_col_name GEOMETRY(32)) TAGS (b VARCHAR(200), f FLOAT, tinyint_type_tag_name TINYINT, ' + f'smallint_type_tag_name SMALLINT, int_type_tag_name INT, bigint_type_tag_name BIGINT, utinyint_type_tag_name TINYINT, ' + f'usmallint_type_tag_name SMALLINT UNSIGNED, uint_type_tag_name INT UNSIGNED, ubigint_type_tag_name BIGINT, double_type_tag_name DOUBLE, ' + f'bool_type_tag_name BOOL, nchar_type_tag_name NCHAR(16), varchar_type_tag_name VARCHAR(16), varbinary_type_tag_name VARBINARY(64), ' + f'geometry_type_tag_name GEOMETRY(32), extratag INT)') + tdSql.execute(f'CREATE TABLE reg_table_159 USING fs_table ' + f'(b, f, tinyint_type_tag_name, smallint_type_tag_name, int_type_tag_name, bigint_type_tag_name, ' + f'utinyint_type_tag_name, usmallint_type_tag_name, uint_type_tag_name, ubigint_type_tag_name, ' + f'double_type_tag_name, bool_type_tag_name, nchar_type_tag_name, varchar_type_tag_name, varbinary_type_tag_name) ' + f'TAGS ("fgiaaopuphardlom", -3.302167e+38, 40, 18667, 1116729408, -6426992149481917950, 55, 4674, 1756351183, ' + f'7228005179153159914, -3.428740e+307, false, "emvhqjcixroitxiw", "fixwxdovhhbizqdm", "\x786565787775656D6F667A666A646463")') + + tdLog.printNoPrefix("==========step2:insert data") + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(nchar_type_tag_name,double_type_tag_name,bigint_type_tag_name,usmallint_type_tag_name,varchar_type_tag_name,geometry_type_tag_name,int_type_tag_name,varbinary_type_tag_name,ubigint_type_tag_name,smallint_type_tag_name,utinyint_type_tag_name,uint_type_tag_name,f,tinyint_type_tag_name,bool_type_tag_name,b) TAGS("emvhqjcixroitxiw", -3.4287401579952453e+307, -6426992149481917950, 4674, "fixwxdovhhbizqdm", "point(1.0 1.0)", 1116729408, "xeexwuemofzfjddc", 7228005179153159914, 18667, 55, 1756351183, -3.302167385734522e+38, 40, False, "fgiaaopuphardlom") (ts,varchar_type_col_name,uint_type_col_name,speed,smallint_type_col_name,nchar_type_col_name,ubigint_type_col_name,varbinary_type_col_name,float_type_col_name,bigint_type_col_name,double_type_col_name,geometry_type_col_name,color,bool_type_col_name,usmallint_type_col_name,utinyint_type_col_name,tinyint_type_col_name) VALUES ("2016-12-16 00:49:27", "jvudhjbmixxuubhl", 1327384783, 215895363, 16025, "llosyvhgzqpixdru", -3772449087838215561, "jvludkxlqobiigip", -2.978105332100778e+37, -5559805599911459602, -4.028726372555818e+307, "point(1.0 1.0)", "bdencejzdarqaeef", True, 19468, 35, -30);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(int_type_tag_name,bool_type_tag_name) TAGS(1653079398, True) (ts,bigint_type_col_name,ubigint_type_col_name,float_type_col_name,color,double_type_col_name,bool_type_col_name,smallint_type_col_name,uint_type_col_name) VALUES ("2016-12-16 00:58:36", 1083391961316260438, 3613986442426750782, -1.0453149756996617e+38, "tvaiakmmcxzbepra", -1.4689107839018581e+308, True, -18675, 138061020);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(double_type_tag_name,bigint_type_tag_name,ubigint_type_tag_name,int_type_tag_name,varchar_type_tag_name,b,f,smallint_type_tag_name,tinyint_type_tag_name,bool_type_tag_name,uint_type_tag_name,utinyint_type_tag_name,nchar_type_tag_name,usmallint_type_tag_name,geometry_type_tag_name,varbinary_type_tag_name) TAGS(-7.061730755263099e+307, 2107452935481758830, 2258834966577471147, -952230254, "vhnwshrapagnalqu", "levvmtztgprzatat", 6.737169619795772e+37, 8872, 2, True, 1075287886, -60, "mpdmcvwntqfusvhm", 36270, "point(1.0 1.0)", "ctnxatxiaymaekvj") (ts) VALUES ("2016-12-16 01:23:36");') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(geometry_type_tag_name,f,usmallint_type_tag_name,smallint_type_tag_name,double_type_tag_name) TAGS("point(1.0 1.0)", -8.285007090644336e+37, 50936, -28943, 3.4910133200480327e+307) (ts,tinyint_type_col_name,geometry_type_col_name,ubigint_type_col_name,smallint_type_col_name) VALUES ("2016-12-16 01:37:37", 20, "point(1.0 1.0)", -8279051334405446366, -11586);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(varbinary_type_tag_name,f,ubigint_type_tag_name,nchar_type_tag_name,uint_type_tag_name,int_type_tag_name,utinyint_type_tag_name,smallint_type_tag_name) TAGS("qbwmnupomqkllhdf", -1.731243531476578e+38, -3044376275988311477, "onwtdayawxuoayuh", 3923375490, -122362890, -50, -25842) (ts,tinyint_type_col_name,uint_type_col_name,bigint_type_col_name,varbinary_type_col_name,color) VALUES ("2016-12-16 01:47:01", 38, -912910938, -7421282029380796738, "zqqrmdatsixdjwmv", "qensugigfedpokag");') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(f,nchar_type_tag_name,bigint_type_tag_name,b,tinyint_type_tag_name,smallint_type_tag_name) TAGS(3.0006598369272955e+38, "qgmecuzexdlbjoen", 2548336842131148813, "kvulvyjmnsujbygx", 54, 12017) (ts,ubigint_type_col_name,double_type_col_name,geometry_type_col_name,color,bool_type_col_name,tinyint_type_col_name) VALUES ("2016-12-16 02:41:15", -8037368176580035774, 1.8094617142119061e+307, "point(1.0 1.0)", "uriutisredzfnels", False, -50);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(smallint_type_tag_name,usmallint_type_tag_name,uint_type_tag_name,geometry_type_tag_name) TAGS(-18163, 36635, 3511596470, "point(1.0 1.0)") (ts,utinyint_type_col_name,varchar_type_col_name,uint_type_col_name,bigint_type_col_name,bool_type_col_name,varbinary_type_col_name,ubigint_type_col_name,smallint_type_col_name,geometry_type_col_name,float_type_col_name,color,tinyint_type_col_name,usmallint_type_col_name,speed,double_type_col_name) VALUES ("2016-12-16 02:41:32", 53, "izpzycfgyyljiafe", 748493885, 1182091325231355552, True, "wirugruhofvuzvfq", -6622830592002864757, 2403, "point(1.0 1.0)", -2.0533976172415304e+38, "ypyrkfwkzsvykvbq", -98, 7975, 1661529650, 1.4776735328584477e+308);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(tinyint_type_tag_name,varchar_type_tag_name,bool_type_tag_name,uint_type_tag_name,ubigint_type_tag_name,double_type_tag_name,f) TAGS(58, "mxcovlujiaipbrxe", False, 3023725445, -8300199672256037241, 3.493291803670194e+307, -2.0809024953240414e+38) (ts,utinyint_type_col_name,varbinary_type_col_name,bigint_type_col_name,speed,color,uint_type_col_name,usmallint_type_col_name,bool_type_col_name,geometry_type_col_name,nchar_type_col_name) VALUES ("2016-12-16 03:00:08", -47, "achpeufmryizqrmv", -3195561950072510641, -674332102, "ocyfdyeztjbdajyj", 1620966159, 3256, True, "point(1.0 1.0)", "ujaddbbtrpfhirhk");') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(usmallint_type_tag_name,bool_type_tag_name,b,smallint_type_tag_name,geometry_type_tag_name,double_type_tag_name) TAGS(22844, False, "mtfrbktpnjmdaazm", 26985, "point(1.0 1.0)", 1.6179238326982066e+308) (ts) VALUES ("2016-12-16 03:02:29");') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(geometry_type_tag_name,f,uint_type_tag_name,smallint_type_tag_name,tinyint_type_tag_name) TAGS("point(1.0 1.0)", -3.0320850510538104e+38, 3560125456, 11119, 100) (ts,varbinary_type_col_name,double_type_col_name,bigint_type_col_name) VALUES ("2016-12-16 03:04:06", "sujwqvsfertzzcuk", -1.4040026870544444e+308, 2475978411998036438);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(varbinary_type_tag_name,usmallint_type_tag_name) TAGS("orgrtrdbgldlyogq", 28231) (ts,varchar_type_col_name,double_type_col_name,bool_type_col_name,usmallint_type_col_name,geometry_type_col_name,bigint_type_col_name,color,speed,uint_type_col_name,ubigint_type_col_name) VALUES ("2016-12-16 03:04:22", "xdwjwlgxgpkaqnnb", 9.723011865690129e+307, True, -13258, "point(1.0 1.0)", 7895225088661281332, "srsjscgbnyrhrpmo", -1908698583, -777280648, -562221736344996425);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(tinyint_type_tag_name) TAGS(-86) (ts,nchar_type_col_name) VALUES ("2016-12-16 03:12:18", "vcjkutzmjnmwreep");') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(f,tinyint_type_tag_name) TAGS(-6.142189587223866e+37, -107) (ts,uint_type_col_name,usmallint_type_col_name,bigint_type_col_name,geometry_type_col_name,double_type_col_name,nchar_type_col_name,utinyint_type_col_name,speed,tinyint_type_col_name,ubigint_type_col_name,varbinary_type_col_name) VALUES ("2016-12-16 03:16:08", -1334666808, 16860, 3563429449831894323, "point(1.0 1.0)", -6.706661740752272e+307, "vmfhrazqvgrsyjbi", 106, -2118429478, -24, -5510629554223761040, "hcpvgxxsqivxahrs");') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(geometry_type_tag_name,varbinary_type_tag_name,f,b,tinyint_type_tag_name,utinyint_type_tag_name) TAGS("point(1.0 1.0)", "ycquvwnecivxvdkq", 1.0805517348297708e+38, "qvdfdhvjokfwimfb", -16, -28) (ts,color,varbinary_type_col_name) VALUES ("2016-12-16 03:24:44", "khyzooeyfjsndqbl", "mxeaotkheqyjkwfe");') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(f,double_type_tag_name,nchar_type_tag_name,tinyint_type_tag_name,bigint_type_tag_name,bool_type_tag_name,ubigint_type_tag_name,uint_type_tag_name) TAGS(-2.6250101215841932e+38, -1.4224845739873728e+308, "vitarwbjdtoaouwk", -21, 2835005149249208489, False, -2853745842969962537, 2818492304) (ts,float_type_col_name,varbinary_type_col_name,speed,utinyint_type_col_name,double_type_col_name,uint_type_col_name) VALUES ("2016-12-16 03:33:59", 4.143242721974893e+37, "tkcfmjxczscjjbfw", -126722956, 32, 1.5620105176463347e+308, -403334517);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(f,bool_type_tag_name,usmallint_type_tag_name,varbinary_type_tag_name,uint_type_tag_name) TAGS(1.1219685887309601e+38, True, 38172, "yjkrksyfhkqpxulw", 3797495177) (ts,double_type_col_name,ubigint_type_col_name,speed,nchar_type_col_name,smallint_type_col_name,usmallint_type_col_name) VALUES ("2016-12-16 03:37:00", 4.3397415421427257e+307, 2658580196646742125, 1848731552, "dauismisbvpldvbh", -8915, -10205);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(double_type_tag_name,nchar_type_tag_name,f,bool_type_tag_name,varchar_type_tag_name,bigint_type_tag_name,int_type_tag_name,usmallint_type_tag_name,varbinary_type_tag_name,smallint_type_tag_name,ubigint_type_tag_name,geometry_type_tag_name,b,utinyint_type_tag_name) TAGS(1.8933544224270275e+307, "xeuwzufexkviruji", -1.0719023172814157e+38, False, "etafmdbercjranpw", 8783154341984945645, 1620912647, 35459, "amdmlvxpympytkxq", 27136, 4977907901152915273, "point(1.0 1.0)", "sndpqcboosvhuzuq", -27) (ts) VALUES ("2016-12-16 03:38:29");') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(ubigint_type_tag_name,f,int_type_tag_name,varbinary_type_tag_name,usmallint_type_tag_name,varchar_type_tag_name,smallint_type_tag_name,b,geometry_type_tag_name,uint_type_tag_name) TAGS(-1374459770575094448, 2.693293747482498e+38, 650971033, "pmviadhwiouunffs", 44961, "nxvgxzcwabujtppn", 17943, "pcctjatkdlbevdrn", "point(1.0 1.0)", 1568392342) (ts,utinyint_type_col_name,varbinary_type_col_name,nchar_type_col_name,float_type_col_name) VALUES ("2016-12-16 03:50:53", 37, "tqdxypikpbpopiid", "evjbmpbxsscpssei", 2.890872457201385e+38);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(double_type_tag_name,nchar_type_tag_name,uint_type_tag_name,varbinary_type_tag_name,varchar_type_tag_name,b,utinyint_type_tag_name,bool_type_tag_name,geometry_type_tag_name,bigint_type_tag_name,ubigint_type_tag_name,tinyint_type_tag_name,usmallint_type_tag_name,int_type_tag_name,smallint_type_tag_name) TAGS(3.1967188798436023e+307, "dlqosxrxmrdlexvu", 490088010, "abfyijmjhtypgmjo", "vrjjkvfezfqjsjxn", "jguyfszmyqtoaiuy", 15, False, "point(1.0 1.0)", 7656873837277040486, -2879397104283241297, 79, 1548, 474297665, 27763) (ts,usmallint_type_col_name,tinyint_type_col_name,float_type_col_name,ubigint_type_col_name,varchar_type_col_name,speed,uint_type_col_name,geometry_type_col_name,double_type_col_name,utinyint_type_col_name,color,varbinary_type_col_name) VALUES ("2016-12-16 04:02:41", -22725, 121, -1.7363002143786742e+38, -5956529834331945772, "fdebpzbdywcxygxq", -1037829517, -344092943, "point(1.0 1.0)", 1.687974407803454e+308, -15, "njduhepaglkeckdd", "svrtpquvktqimuab");') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(f,smallint_type_tag_name,geometry_type_tag_name,usmallint_type_tag_name,int_type_tag_name,tinyint_type_tag_name,utinyint_type_tag_name,varbinary_type_tag_name,bigint_type_tag_name,bool_type_tag_name,ubigint_type_tag_name,uint_type_tag_name) TAGS(2.0855939441502307e+38, 31096, "point(1.0 1.0)", 1835, -1486483188, -63, -123, "dhfkbddofbppzizu", -8035802647163979457, True, -7483826213921795749, 795995100) (ts,geometry_type_col_name,bigint_type_col_name) VALUES ("2016-12-16 04:10:21", "point(1.0 1.0)", 1969408246531214471);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(usmallint_type_tag_name,tinyint_type_tag_name,ubigint_type_tag_name,utinyint_type_tag_name,varbinary_type_tag_name,int_type_tag_name,double_type_tag_name,nchar_type_tag_name,b,f,geometry_type_tag_name,smallint_type_tag_name) TAGS(25593, 43, 7818398761945137262, -55, "vpwzpopkwmijjyqx", 826644318, -8.222056376363248e+307, "jjxxlxujrdkmkqez", "hkzvxvlmluxfhiao", 9.217736393675792e+37, "point(1.0 1.0)", 13064) (ts,float_type_col_name,geometry_type_col_name,nchar_type_col_name,tinyint_type_col_name,usmallint_type_col_name,ubigint_type_col_name,smallint_type_col_name,bool_type_col_name,utinyint_type_col_name,varchar_type_col_name,double_type_col_name,uint_type_col_name,bigint_type_col_name,varbinary_type_col_name) VALUES ("2016-12-16 04:12:51", -1.1155033313780145e+38, "point(1.0 1.0)", "vwwljlxnuieozvfo", 5, -21906, 166234169597926020, -26423, True, -124, "johlaoepdvtqhimi", 1.6733911742274567e+308, 2100308092, 5485398075914940612, "goqmambtlodgwgxq");') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(geometry_type_tag_name,bigint_type_tag_name,tinyint_type_tag_name,int_type_tag_name,double_type_tag_name,usmallint_type_tag_name,bool_type_tag_name,varchar_type_tag_name,b,uint_type_tag_name,f) TAGS("point(1.0 1.0)", -303959115421074377, 55, 58404549, 1.1317582542682038e+308, 8228, False, "bctnlrzfozjhicdk", "tgtjnkhoxjrqmnmu", 2346764198, -1.431762906013641e+38) (ts,float_type_col_name,speed,bigint_type_col_name,smallint_type_col_name) VALUES ("2016-12-16 04:13:42", 9.989635187087936e+37, -1325033823, 6439771353766292866, -8002);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(nchar_type_tag_name) TAGS("zsmwyzfqmozmyniw") (ts,bool_type_col_name,speed,varbinary_type_col_name,uint_type_col_name,varchar_type_col_name,geometry_type_col_name,double_type_col_name,utinyint_type_col_name,bigint_type_col_name) VALUES ("2016-12-16 04:21:19", True, -1595645133, "fcmpqbuxdduvfwrq", -1256972424, "doijzwclrxdbzwwq", "point(1.0 1.0)", 6.027483417919201e+307, 107, 5847005732723402961);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(double_type_tag_name,smallint_type_tag_name,varchar_type_tag_name,usmallint_type_tag_name,b,geometry_type_tag_name,uint_type_tag_name,ubigint_type_tag_name) TAGS(1.9234061768725975e+306, 27143, "dlsvyehikpxuzggw", 18465, "xhwupqgazckmiobv", "point(1.0 1.0)", 1009963833, 2202148978430704618) (ts,nchar_type_col_name,color,tinyint_type_col_name,ubigint_type_col_name) VALUES ("2016-12-16 04:25:17", "qshpnutukcvqxtaj", "zryqatfkrrhxravq", -123, 5614613512735569542);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(smallint_type_tag_name,bigint_type_tag_name,uint_type_tag_name,ubigint_type_tag_name,geometry_type_tag_name,usmallint_type_tag_name,double_type_tag_name,varchar_type_tag_name,bool_type_tag_name,nchar_type_tag_name,tinyint_type_tag_name,int_type_tag_name,varbinary_type_tag_name,b,f,utinyint_type_tag_name) TAGS(-25502, -4694006038921375834, 4273176734, -7092260276769281916, "point(1.0 1.0)", 3016, 1.6354692626546982e+308, "hjbzklszxdzdoxqn", False, "dexhfkdiumjzdbtu", 55, 1628959, "caeogfirfkzuqrgm", "kklniqcfjgtnpaat", 1.2381441388115072e+38, 34) (ts,smallint_type_col_name,float_type_col_name,uint_type_col_name,nchar_type_col_name,geometry_type_col_name,varchar_type_col_name,varbinary_type_col_name) VALUES ("2016-12-16 04:30:12", -15424, -9.958486706164754e+37, 1543951155, "uonnnwqaxjnzcktw", "point(1.0 1.0)", "sbnhooyzwvvvgdsb", "iguafwamsgzdtcid");') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(tinyint_type_tag_name,bigint_type_tag_name,nchar_type_tag_name,geometry_type_tag_name,usmallint_type_tag_name,b,smallint_type_tag_name,f,ubigint_type_tag_name,int_type_tag_name,uint_type_tag_name,varchar_type_tag_name) TAGS(125, 7128483423223572360, "wknmbdmxriwytuzs", "point(1.0 1.0)", 23719, "cehohszybqisbcsr", 29052, -1.2266502524670797e+38, -5190174475276867332, -1054122176, 3316814729, "zeympzallufrrwwk") (ts,float_type_col_name) VALUES ("2016-12-16 04:42:07", -3.0086436232306867e+38);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(usmallint_type_tag_name,smallint_type_tag_name) TAGS(24922, 19120) (ts,ubigint_type_col_name,varbinary_type_col_name,bool_type_col_name,bigint_type_col_name,usmallint_type_col_name,tinyint_type_col_name) VALUES ("2016-12-16 04:44:37", 2119708740431033246, "tfscgthihrecwcca", True, 3858755530043058209, 16911, 49);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(bool_type_tag_name,geometry_type_tag_name,varchar_type_tag_name,int_type_tag_name,nchar_type_tag_name,uint_type_tag_name,tinyint_type_tag_name,utinyint_type_tag_name,smallint_type_tag_name,double_type_tag_name,usmallint_type_tag_name) TAGS(False, "point(1.0 1.0)", "lgomrzeuveghuavk", 698597980, "fibwfbupmoxwxwhu", 2299571086, 88, 26, -784, 5.836820071314546e+307, 44181) (ts,color,nchar_type_col_name,ubigint_type_col_name,float_type_col_name,utinyint_type_col_name,usmallint_type_col_name,geometry_type_col_name,varchar_type_col_name,tinyint_type_col_name,double_type_col_name,speed,uint_type_col_name,bigint_type_col_name,varbinary_type_col_name,smallint_type_col_name) VALUES ("2016-12-16 04:48:53", "fdrpbbuwolrgigwu", "ovkkzehagcozavag", -859824747452770489, 2.668460352935784e+38, -36, -4146, "point(1.0 1.0)", "zpnfvkdabqhvvugr", 122, -1.6659109789494941e+308, -339715491, -744820813, 4922622614018944659, "drckbshqwqdgjywk", 26922);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(varchar_type_tag_name,nchar_type_tag_name,bool_type_tag_name,varbinary_type_tag_name,usmallint_type_tag_name,geometry_type_tag_name,utinyint_type_tag_name,b,bigint_type_tag_name,uint_type_tag_name,tinyint_type_tag_name,double_type_tag_name) TAGS("fnudpzattpadznjh", "curlvpnayxqyhgnj", True, "qujeqlinronfmnra", 26904, "point(1.0 1.0)", 103, "rmdyvbxvfscrklat", 1772757837581587144, 3755231946, -28, 1.392881389803201e+308) (ts) VALUES ("2016-12-16 04:49:43");') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(geometry_type_tag_name,smallint_type_tag_name,usmallint_type_tag_name,f,uint_type_tag_name,b,varbinary_type_tag_name,bigint_type_tag_name,utinyint_type_tag_name) TAGS("point(1.0 1.0)", 23766, 34510, -9.391278476138455e+37, 1424312679, "usmzlgendwxwjzkd", "gfsuserzmdovezbh", -3630795755071364737, 33) (ts,ubigint_type_col_name,speed,bool_type_col_name,smallint_type_col_name,geometry_type_col_name,varbinary_type_col_name,usmallint_type_col_name) VALUES ("2016-12-16 05:08:42", 9043564226598764196, -1058070689, True, -27689, "point(1.0 1.0)", "jkcbtfqphclecaiw", -2968);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(nchar_type_tag_name,bigint_type_tag_name,b) TAGS("dtpxqkpvzwqhqtlf", 8497835948198860590, "labufkbmgoaihoke") (ts,speed,uint_type_col_name,ubigint_type_col_name,utinyint_type_col_name,usmallint_type_col_name,varchar_type_col_name,color,varbinary_type_col_name,tinyint_type_col_name,smallint_type_col_name,nchar_type_col_name,bigint_type_col_name,float_type_col_name,bool_type_col_name,double_type_col_name) VALUES ("2016-12-16 05:32:32", -1915664223, 1413499274, -5989223773653851128, -116, 26921, "ownicmwaptorttec", "ygzvhoyputddyowk", "wrkogplcbpemkxdn", -33, 18817, "clrhqokhsspzbxgc", -859502208102825417, -1.5128753403587181e+38, True, -1.3508466034943649e+308);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(geometry_type_tag_name,varbinary_type_tag_name,int_type_tag_name,b,tinyint_type_tag_name,double_type_tag_name,ubigint_type_tag_name,bigint_type_tag_name,uint_type_tag_name) TAGS("point(1.0 1.0)", "uvvthorbwmsnfjoz", 1030009117, "tyysttboblgpkypz", -69, 1.23842724503325e+308, 9192485125431744596, 29000826379644817, 3538861351) (ts) VALUES ("2016-12-16 05:41:58");') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(int_type_tag_name,bool_type_tag_name,varchar_type_tag_name,utinyint_type_tag_name,ubigint_type_tag_name,tinyint_type_tag_name,double_type_tag_name,f,varbinary_type_tag_name,b,uint_type_tag_name,bigint_type_tag_name,geometry_type_tag_name,usmallint_type_tag_name,smallint_type_tag_name) TAGS(859129059, True, "uxbtbeicqswhoomz", -62, 3734511001108851286, 34, -1.5815188393505786e+308, 4.745631034394835e+37, "qoxpifitbedupend", "ppnqdxusgmlszoqw", 1004378621, 3705733919632701068, "point(1.0 1.0)", 38489, 29461) (ts,tinyint_type_col_name,usmallint_type_col_name,varchar_type_col_name,color,geometry_type_col_name,float_type_col_name,bool_type_col_name,speed,double_type_col_name,bigint_type_col_name,varbinary_type_col_name,uint_type_col_name) VALUES ("2016-12-16 06:08:50", 76, 12466, "nujbmtudnrleyvdy", "bgzmcovdcpghdlzi", "point(1.0 1.0)", -1.7192977879525407e+38, False, -910281174, 1.5781580952881898e+308, -3488933529074665133, "tfrgpkdcgqesmvbt", -1938221877);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(nchar_type_tag_name,varchar_type_tag_name,tinyint_type_tag_name,utinyint_type_tag_name,f,double_type_tag_name,bigint_type_tag_name,int_type_tag_name,usmallint_type_tag_name,bool_type_tag_name,smallint_type_tag_name,geometry_type_tag_name,b,ubigint_type_tag_name,varbinary_type_tag_name) TAGS("zfsuqkilwplvrebi", "ccqtsosvtnlbnkig", 103, 78, 1.3362517686508279e+38, -9.563002829076875e+307, -6627606384484374568, 1126761657, 27844, True, 30861, "point(1.0 1.0)", "hmnpllitztvocynw", 8180438212890952155, "qfekhbflxpldbddz") (ts,varchar_type_col_name,geometry_type_col_name,uint_type_col_name,usmallint_type_col_name) VALUES ("2016-12-16 06:12:48", "kavbtvnlqfmeyfgh", "point(1.0 1.0)", 86018588, 3835);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(nchar_type_tag_name,bigint_type_tag_name,utinyint_type_tag_name,varbinary_type_tag_name,varchar_type_tag_name,geometry_type_tag_name,int_type_tag_name) TAGS("rfnbxcuzeizhglks", 7283103569704428551, 94, "dudcfczmlnwyrkvp", "geivplrozxtocipa", "point(1.0 1.0)", -1224429691) (ts,float_type_col_name,varbinary_type_col_name,double_type_col_name,tinyint_type_col_name,uint_type_col_name) VALUES ("2016-12-16 06:26:38", -1.3097826665873164e+37, "xwfgtqoddvxyhcre", 1.5229330656778251e+308, 118, 1385681942);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(ubigint_type_tag_name,nchar_type_tag_name,bigint_type_tag_name,utinyint_type_tag_name) TAGS(9169294385094804151, "rdibiqdizmdrkfrf", 3962954747786936314, 54) (ts,geometry_type_col_name,varbinary_type_col_name,utinyint_type_col_name,smallint_type_col_name,float_type_col_name,tinyint_type_col_name,bigint_type_col_name,speed) VALUES ("2016-12-16 06:32:37", "point(1.0 1.0)", "ciymbzfmbfqqsxkv", -76, 32317, -9.09960741209682e+37, 77, 3789368028357457617, -432822270);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(double_type_tag_name,f,tinyint_type_tag_name,varchar_type_tag_name,bool_type_tag_name,utinyint_type_tag_name,bigint_type_tag_name,smallint_type_tag_name,int_type_tag_name,b,geometry_type_tag_name,nchar_type_tag_name,usmallint_type_tag_name,varbinary_type_tag_name) TAGS(-1.2944016628561449e+308, 7.983554080975201e+37, 53, "fcbmysknvqvehfiz", True, -6, -8922838578018838847, -20254, 1722340321, "wrrcjsdfwrihjnqy", "point(1.0 1.0)", "yflqloxmpchzkdts", 57539, "kvvzxzerqnmnzxwk") (ts,nchar_type_col_name,tinyint_type_col_name,ubigint_type_col_name,geometry_type_col_name,usmallint_type_col_name,double_type_col_name,varchar_type_col_name,uint_type_col_name,bool_type_col_name,speed,bigint_type_col_name,varbinary_type_col_name,utinyint_type_col_name) VALUES ("2016-12-16 06:34:00", "mrzcfbzniotxzbdi", 58, 7707860227701048488, "point(1.0 1.0)", 31402, -5.6095749182351896e+306, "ibzewxdivctecfot", -1652235605, False, -933263235, 384543174410180162, "woixarpkcucglfey", 124);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(double_type_tag_name,tinyint_type_tag_name,nchar_type_tag_name,bool_type_tag_name,bigint_type_tag_name,geometry_type_tag_name,uint_type_tag_name,varchar_type_tag_name,int_type_tag_name,varbinary_type_tag_name,utinyint_type_tag_name) TAGS(-5.930942323411467e+307, -121, "ckbowkjukztkjqoi", True, -2618046353021226711, "point(1.0 1.0)", 2166418040, "yxhuoimpnuqhlhgw", -1659085223, "zeyylgulwwdnwsii", -3) (ts,bigint_type_col_name) VALUES ("2016-12-16 06:34:14", -4941469222634542296);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(bigint_type_tag_name,b,tinyint_type_tag_name,varbinary_type_tag_name,smallint_type_tag_name,double_type_tag_name,nchar_type_tag_name,bool_type_tag_name,utinyint_type_tag_name,f,uint_type_tag_name) TAGS(5489251136620324287, "igrbjdomcwywiekb", -25, "xhhaerxfxfobwcvn", 14001, -1.796912338313077e+307, "umtnvilvgmbxbxsq", True, 43, -1.8528500716419152e+38, 1497513541) (ts) VALUES ("2016-12-16 06:35:34");') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(bigint_type_tag_name,ubigint_type_tag_name,f,b,bool_type_tag_name,geometry_type_tag_name,utinyint_type_tag_name,nchar_type_tag_name,smallint_type_tag_name,int_type_tag_name,usmallint_type_tag_name,varchar_type_tag_name) TAGS(2431406493780788447, 4861403703027821860, 1.99259675649246e+38, "yzdneqzibyuwrypn", True, "point(1.0 1.0)", -127, "llytlpdymtuetvfm", -25050, -543736632, 11798, "dgznnsdqgrnrmazq") (ts,bool_type_col_name) VALUES ("2016-12-16 06:36:04", False);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(smallint_type_tag_name,tinyint_type_tag_name,double_type_tag_name,varbinary_type_tag_name,varchar_type_tag_name,geometry_type_tag_name) TAGS(-5334, -79, 1.2315866993517746e+308, "mywxqnmbjqsxdsff", "dahqwtcwipwwbdye", "point(1.0 1.0)") (ts,uint_type_col_name,bigint_type_col_name,geometry_type_col_name,varbinary_type_col_name,tinyint_type_col_name,speed,bool_type_col_name,color,ubigint_type_col_name,float_type_col_name) VALUES ("2016-12-16 07:08:57", -703937341, 508746925742892883, "point(1.0 1.0)", "yymznbjazhklgjxb", 12, 1587775618, True, "ozzyhsagmrpiyrjq", 5401400824616407615, -1.7440186980309764e+37);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(double_type_tag_name,varchar_type_tag_name,tinyint_type_tag_name,bigint_type_tag_name,bool_type_tag_name,geometry_type_tag_name,usmallint_type_tag_name,ubigint_type_tag_name,b,utinyint_type_tag_name,f,smallint_type_tag_name) TAGS(-7.999887918520793e+307, "qwbmvcvwhlkxwwld", 21, 468530456171689843, True, "point(1.0 1.0)", 10723, 4059334937310534108, "wgqsiptkcwhvmjwe", 99, -5.310912588143673e+37, -17363) (ts,float_type_col_name,geometry_type_col_name,smallint_type_col_name,varbinary_type_col_name,uint_type_col_name,speed,nchar_type_col_name,color,ubigint_type_col_name,bigint_type_col_name,usmallint_type_col_name,tinyint_type_col_name) VALUES ("2016-12-16 07:14:40", 2.8869331003756176e+38, "point(1.0 1.0)", -29659, "tbhqqyiqgtgckyyg", -471326270, 944696481, "ysahvyevqkwulqqv", "lzhzxslfmdzwsxpf", -9113216317948681955, 3545622045223678570, -25303, -80);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(nchar_type_tag_name) TAGS("auxtouxzloojhqtf") (ts,varbinary_type_col_name,nchar_type_col_name,double_type_col_name,color) VALUES ("2016-12-16 07:15:30", "ddluzbitxrtbkjbj", "ljgnuemqzlbotqwi", -5.352451641324967e+307, "suwegzsujiqfyvqt");') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(b,geometry_type_tag_name,utinyint_type_tag_name,double_type_tag_name,nchar_type_tag_name,uint_type_tag_name,bigint_type_tag_name,int_type_tag_name,varbinary_type_tag_name,smallint_type_tag_name,bool_type_tag_name,ubigint_type_tag_name,varchar_type_tag_name,usmallint_type_tag_name,tinyint_type_tag_name,f) TAGS("pizyvqqjzxhkofpm", "point(1.0 1.0)", -22, 1.5081448005935855e+308, "ufwxcfxfunjhxxzm", 282211280, 4861090276718143202, -2091585085, "lbxpmtsvtpucnlzy", -30781, False, 124484168740646, "yjuefabvljbxrgsx", 33815, -72, -1.128908264468181e+38) (ts,bigint_type_col_name,ubigint_type_col_name,bool_type_col_name,varchar_type_col_name,double_type_col_name,smallint_type_col_name,tinyint_type_col_name,uint_type_col_name,speed,geometry_type_col_name) VALUES ("2016-12-16 07:17:15", 1001689612302252183, -105401984359440882, False, "wbbktwsethudmtja", -4.557626601447439e+307, 21541, -98, -2080051974, -1861023150, "point(1.0 1.0)");') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(uint_type_tag_name,varchar_type_tag_name,varbinary_type_tag_name,int_type_tag_name,bigint_type_tag_name,geometry_type_tag_name) TAGS(2320968032, "dhquczttiqbnfyjr", "cixjeekgvvixcbud", -484475030, -4789196290580581091, "point(1.0 1.0)") (ts,bigint_type_col_name,varbinary_type_col_name,nchar_type_col_name,double_type_col_name,speed,color,varchar_type_col_name,bool_type_col_name,uint_type_col_name,ubigint_type_col_name,smallint_type_col_name,utinyint_type_col_name,float_type_col_name) VALUES ("2016-12-16 07:18:05", -1206873661752154164, "pjkbldrvpglbnulx", "dztdpobuyksgdhgt", -1.1951640769154985e+308, 542907991, "ekubcyxbjiciigss", "xnxufupmzhskjmpq", False, 267042413, 3084280261011428030, 26039, 31, 2.539995004940438e+38);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(ubigint_type_tag_name,uint_type_tag_name,varbinary_type_tag_name,bool_type_tag_name,tinyint_type_tag_name,nchar_type_tag_name,int_type_tag_name,double_type_tag_name) TAGS(-4414306501424620178, 4231079052, "mthgdnjdhnjraffo", False, -106, "hwcjdivkccrlukjw", 1762002945, -1.0781154156730552e+307) (ts,float_type_col_name,varbinary_type_col_name,usmallint_type_col_name,double_type_col_name,speed,varchar_type_col_name,nchar_type_col_name,utinyint_type_col_name,bigint_type_col_name,bool_type_col_name,geometry_type_col_name,uint_type_col_name,smallint_type_col_name,ubigint_type_col_name,color,tinyint_type_col_name) VALUES ("2016-12-16 07:24:51", -8.579854162437403e+37, "izylbbcyhuxvmohl", -11832, -1.238446106977585e+308, 1414832325, "nukonaftikjqqbdj", "cykvszvrxguiajwg", -28, -4542731759437382057, False, "point(1.0 1.0)", -250287824, -22672, 2059749290085408427, "wvojjnanujjbrjbk", 37);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(utinyint_type_tag_name,uint_type_tag_name,usmallint_type_tag_name,bool_type_tag_name,bigint_type_tag_name,geometry_type_tag_name,varchar_type_tag_name,b,nchar_type_tag_name,int_type_tag_name) TAGS(-87, 3054590850, 10240, False, 7471097903390818886, "point(1.0 1.0)", "gvmesmuwkboibbwm", "qnkzvaetvvsoliqw", "tsaezwjdobewrsgg", 718941504) (ts,uint_type_col_name,bool_type_col_name,color,varchar_type_col_name,speed,utinyint_type_col_name,tinyint_type_col_name,bigint_type_col_name,nchar_type_col_name) VALUES ("2016-12-16 07:47:31", -1418250282, True, "cxyfgdrwrdryoxdv", "urqrvjnzpghqycjl", 1139755242, -53, -40, -3750115493851220318, "yvystiojfnkeinwv");') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(usmallint_type_tag_name) TAGS(11662) (ts,float_type_col_name,smallint_type_col_name,nchar_type_col_name,bigint_type_col_name,bool_type_col_name,tinyint_type_col_name,uint_type_col_name,speed,varchar_type_col_name,varbinary_type_col_name,usmallint_type_col_name,color,double_type_col_name,utinyint_type_col_name,geometry_type_col_name) VALUES ("2016-12-16 07:47:42", 1.5652814126254586e+38, 31965, "jzglkmapiqvmkcgt", -456718528158805320, True, 13, 1550395191, -468850482, "qsuieurxcdhljsyg", "pimzexqqdusasasq", -25133, "heaqwaulngjummmj", 1.4472853493781175e+307, -100, "point(1.0 1.0)");') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(geometry_type_tag_name,tinyint_type_tag_name,b,varbinary_type_tag_name,int_type_tag_name,bool_type_tag_name,bigint_type_tag_name,usmallint_type_tag_name,varchar_type_tag_name,utinyint_type_tag_name,uint_type_tag_name,ubigint_type_tag_name) TAGS("point(1.0 1.0)", 71, "egjrjdgnsdelmvoi", "nnvaiqrgsmsgulsf", -1764160281, False, -3170988760692140923, 59567, "vvwezjglauxztbkw", -28, 3876664873, 2077268665321637137) (ts,geometry_type_col_name,ubigint_type_col_name,utinyint_type_col_name,speed,varbinary_type_col_name,float_type_col_name,bigint_type_col_name,color) VALUES ("2016-12-16 07:53:43", "point(1.0 1.0)", -8518449815289332525, -90, -1716688898, "llphooyquheusfis", 1.8971999924428717e+38, 6265618875544853883, "mhnrsjknurfeejin");') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(utinyint_type_tag_name,int_type_tag_name,usmallint_type_tag_name,bool_type_tag_name,uint_type_tag_name,bigint_type_tag_name,varbinary_type_tag_name,geometry_type_tag_name,f,double_type_tag_name,smallint_type_tag_name,nchar_type_tag_name,varchar_type_tag_name,ubigint_type_tag_name) TAGS(-107, -1135898492, 7359, True, 2054944069, -5204892746217048371, "dtbkgxohffiiqvex", "point(1.0 1.0)", -1.6139634795645272e+38, -3.4474223981039393e+307, -4519, "geosetpzbiyvrxsl", "owahukwcrwnazqmg", -6817825300706607165) (ts,nchar_type_col_name) VALUES ("2016-12-16 07:57:23", "yfefrbnkzlnvszku");') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(b,varbinary_type_tag_name,utinyint_type_tag_name,tinyint_type_tag_name,geometry_type_tag_name,uint_type_tag_name) TAGS("gujkmscmzrumlzgr", "kyjkxjmmiujedyoc", -63, -30, "point(1.0 1.0)", 3040843900) (ts,varbinary_type_col_name,uint_type_col_name,usmallint_type_col_name,tinyint_type_col_name,bigint_type_col_name,nchar_type_col_name,float_type_col_name,bool_type_col_name,utinyint_type_col_name,speed,varchar_type_col_name,smallint_type_col_name,ubigint_type_col_name,color) VALUES ("2016-12-16 08:00:58", "tzthqrttxnhexwie", -1719097053, 12664, 92, 8111449057800298881, "ckhlhqkuqbbkkqbc", -1.2378307380230564e+38, True, -77, 832149914, "zhaatkireunhqjmr", 10552, -1885112753329295315, "etiwbiqspffpftuy");') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(bigint_type_tag_name,uint_type_tag_name,usmallint_type_tag_name,int_type_tag_name,bool_type_tag_name,tinyint_type_tag_name,smallint_type_tag_name,f,b,nchar_type_tag_name,varbinary_type_tag_name,double_type_tag_name,geometry_type_tag_name,ubigint_type_tag_name,varchar_type_tag_name,utinyint_type_tag_name) TAGS(6936877712832826111, 379134044, 5584, -873981273, True, -36, 23332, 3.0590465783887826e+38, "doyrcpkmqdmkvisu", "ebrzlgpzjdhwgbkg", "favnzcgrgbqhjykc", -5.409211271125824e+306, "point(1.0 1.0)", 7020490078397766201, "dfmaignpkotpzfzp", 0) (ts,utinyint_type_col_name,color,tinyint_type_col_name,usmallint_type_col_name,speed,float_type_col_name,smallint_type_col_name,varbinary_type_col_name,uint_type_col_name,bool_type_col_name,double_type_col_name) VALUES ("2016-12-16 08:08:05", 100, "embwiippvzztzfsx", -29, 30679, 398157649, -2.8271578721561e+38, 16481, "eapyuftmoemhlous", 1346563710, False, 1.2527960914103297e+308);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(usmallint_type_tag_name,varchar_type_tag_name,f,int_type_tag_name) TAGS(14445, "frbgwoxdfgvomhij", 3.112685005605257e+38, 919563343) (ts,smallint_type_col_name,uint_type_col_name,nchar_type_col_name,color,tinyint_type_col_name,utinyint_type_col_name,double_type_col_name,float_type_col_name,bigint_type_col_name,usmallint_type_col_name) VALUES ("2016-12-16 08:10:32", 30534, 287062448, "radqyprkqzicegcm", "digmvwqxesuzblxo", -45, 57, 4.2367818689200055e+307, -1.2630859264197575e+38, 5777026179863424498, -18041);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(tinyint_type_tag_name,geometry_type_tag_name,b) TAGS(-125, "point(1.0 1.0)", "sknwbldiaotpguoh") (ts,geometry_type_col_name,speed,bool_type_col_name,uint_type_col_name,nchar_type_col_name,tinyint_type_col_name,smallint_type_col_name,bigint_type_col_name,usmallint_type_col_name,varchar_type_col_name,float_type_col_name,varbinary_type_col_name,double_type_col_name) VALUES ("2016-12-16 08:21:15", "point(1.0 1.0)", -533077180, True, 125980213, "rzpvyyiafbdgsrlt", -18, 516, 1836336637894618829, -32398, "qyolcbkiphumcyni", -1.7088547654566307e+38, "uhfuttyjdsiwfpge", 9.045738084106129e+307);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(nchar_type_tag_name,varchar_type_tag_name) TAGS("eibgfpzivbkqipxh", "bajctkjmycezvfjy") (ts,uint_type_col_name,nchar_type_col_name,geometry_type_col_name,speed,varbinary_type_col_name,varchar_type_col_name,ubigint_type_col_name,usmallint_type_col_name) VALUES ("2016-12-16 08:27:17", 182114551, "bqoiqgcelwawaxoh", "point(1.0 1.0)", -2048616567, "ngeyahwjhojgfrji", "ajndkftrjrhebhkh", 7449846270987100591, 21014);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(ubigint_type_tag_name,double_type_tag_name) TAGS(-4625726455522573231, 2.8073063831603936e+307) (ts,float_type_col_name,bigint_type_col_name,uint_type_col_name,usmallint_type_col_name,color,varchar_type_col_name,tinyint_type_col_name,nchar_type_col_name,bool_type_col_name,varbinary_type_col_name,geometry_type_col_name,utinyint_type_col_name) VALUES ("2016-12-16 08:28:17", 2.389718468668489e+38, 232575111591325522, 1038517632, 22294, "gkuqyywzvitscnmf", "pzotmkbymjkajqxh", 84, "zwaqqoiitsaldvxd", False, "lutscwlzfncvtbzh", "point(1.0 1.0)", 104);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(ubigint_type_tag_name,varchar_type_tag_name,utinyint_type_tag_name,geometry_type_tag_name,smallint_type_tag_name,usmallint_type_tag_name,int_type_tag_name,b,uint_type_tag_name,f,varbinary_type_tag_name,nchar_type_tag_name,double_type_tag_name,tinyint_type_tag_name,bool_type_tag_name,bigint_type_tag_name) TAGS(3789358482002489003, "cbbfcxtbficxjubk", 87, "point(1.0 1.0)", 16290, 65141, 1107108066, "dbvdcpsxhwxkfcyz", 1995515016, 2.7409223337049425e+38, "qngmplwikoseyylt", "tgzwjjwlcizxxwnr", -1.6889546962063194e+308, -114, False, -3482122891531832648) (ts,nchar_type_col_name,tinyint_type_col_name,geometry_type_col_name,double_type_col_name,color,smallint_type_col_name,speed,usmallint_type_col_name,ubigint_type_col_name,varbinary_type_col_name,bigint_type_col_name,varchar_type_col_name,utinyint_type_col_name,float_type_col_name,bool_type_col_name,uint_type_col_name) VALUES ("2016-12-16 08:28:56", "ofdxnlygqcwvsdcj", -29, "point(1.0 1.0)", -1.8130271598650515e+307, "nefvavoukqtdzkgt", -17717, 1471102951, -22978, 6641200189088106550, "tzjbozbjlczkgwxa", -6094740512181599472, "etogqzsgcqipiztv", 83, 3.26367598847478e+38, False, -748583096);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(f,uint_type_tag_name,nchar_type_tag_name,bool_type_tag_name,double_type_tag_name,int_type_tag_name,tinyint_type_tag_name) TAGS(-3.3072135298943572e+38, 1159943179, "kswqkzvltgixlmfs", True, -4.306722847726777e+307, 232669674, 110) (ts,double_type_col_name,smallint_type_col_name,utinyint_type_col_name,bool_type_col_name,tinyint_type_col_name,color,float_type_col_name,bigint_type_col_name,uint_type_col_name,geometry_type_col_name,ubigint_type_col_name,usmallint_type_col_name,nchar_type_col_name,varbinary_type_col_name,varchar_type_col_name) VALUES ("2016-12-16 08:32:49", 6.47061313170663e+307, 10319, -39, False, 11, "zrdnjfphcwpeinqc", -1.9983066068141309e+37, -7934490781005501591, 254843018, "point(1.0 1.0)", 3715382894868674189, 15127, "czgcvwrtlnhrftfw", "mmsahbdykxugoszh", "oarqmzgnlqfgoetb");') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(varchar_type_tag_name,usmallint_type_tag_name,nchar_type_tag_name,double_type_tag_name,bigint_type_tag_name,b,f) TAGS("eqpvdmknfwrubsuz", 25062, "viftdmeaoemnzlte", -8.206973826119586e+307, -3370842340933526422, "laotfjfckrruwnso", 1.6151693420601788e+37) (ts,ubigint_type_col_name,usmallint_type_col_name,bool_type_col_name,varchar_type_col_name,uint_type_col_name,color,float_type_col_name,smallint_type_col_name) VALUES ("2016-12-16 08:39:16", 3961511905025407799, 17678, False, "donavljkknjvmamp", 1568179614, "dgtldyeuhhgqsrhz", 4.974589437659843e+37, 4642);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(b,varbinary_type_tag_name,utinyint_type_tag_name,smallint_type_tag_name,int_type_tag_name,geometry_type_tag_name,ubigint_type_tag_name,nchar_type_tag_name,double_type_tag_name,tinyint_type_tag_name,usmallint_type_tag_name,bigint_type_tag_name,uint_type_tag_name,bool_type_tag_name) TAGS("hsbqzsfvkllngzft", "oshuiqqteddxsxhg", 12, -6023, -1854137419, "point(1.0 1.0)", -7820787410908786398, "ktlafrcpckbnasok", -1.1140330045511274e+308, -121, 30336, -5235830165957712064, 1885913417, True) (ts,bigint_type_col_name,varbinary_type_col_name,utinyint_type_col_name,usmallint_type_col_name,tinyint_type_col_name,color) VALUES ("2016-12-16 08:47:05", 1101333002744137125, "ztteslebezjpmdic", 9, -16849, -109, "otxajtxgosmycgwf");') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(smallint_type_tag_name,tinyint_type_tag_name,usmallint_type_tag_name,geometry_type_tag_name,varbinary_type_tag_name) TAGS(12811, 115, 11564, "point(1.0 1.0)", "fvllsyeldqjvxwvh") (ts,nchar_type_col_name,color,float_type_col_name,ubigint_type_col_name,tinyint_type_col_name,geometry_type_col_name,double_type_col_name,varbinary_type_col_name,bigint_type_col_name,uint_type_col_name) VALUES ("2016-12-16 08:52:23", "kzlebaiflssmhrez", "rmgygwigqpcedjfd", -1.0528922331364947e+38, 2053899259005385975, -4, "point(1.0 1.0)", 1.2949613471672877e+307, "xpnwhkobylhldlja", -2081901725973275838, 1084220081);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(bool_type_tag_name,int_type_tag_name,tinyint_type_tag_name,uint_type_tag_name,bigint_type_tag_name,geometry_type_tag_name,b,double_type_tag_name,nchar_type_tag_name,smallint_type_tag_name,f,varchar_type_tag_name,ubigint_type_tag_name) TAGS(False, 81017693, -59, 3106871640, 6594200175307481979, "point(1.0 1.0)", "cxlcaxjqbottjwbt", 1.0810790118515493e+307, "mzpfnozkhzccymcy", -23268, -2.5710992840734416e+38, "bzcemqcjmfensoam", -6857344180628167939) (ts,varchar_type_col_name,tinyint_type_col_name,speed,bool_type_col_name,color,nchar_type_col_name,float_type_col_name,bigint_type_col_name,double_type_col_name,utinyint_type_col_name,ubigint_type_col_name,usmallint_type_col_name,geometry_type_col_name,uint_type_col_name,smallint_type_col_name) VALUES ("2016-12-16 08:52:40", "goxjebyqxffhytny", 42, 956707019, False, "mwhbccpdjxrnlfmj", "hsswrkdrgvqzrqvc", -3.1923783000520714e+37, 6439233177980554597, 1.5462567361109987e+308, -104, 5670859655382432947, -13629, "point(1.0 1.0)", -291035521, -28198);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(int_type_tag_name,tinyint_type_tag_name,bool_type_tag_name,ubigint_type_tag_name,geometry_type_tag_name,varchar_type_tag_name,smallint_type_tag_name,f,varbinary_type_tag_name,nchar_type_tag_name,double_type_tag_name,bigint_type_tag_name) TAGS(-1951062887, -15, False, 8992786638768246075, "point(1.0 1.0)", "zkbchpvyaborestv", 14319, -2.9661092483352556e+38, "sgmkfslmxakjfqna", "hujharmlkobjdcnn", -1.3558306099409006e+308, 6268021739102999331) (ts) VALUES ("2016-12-16 09:57:37");') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(usmallint_type_tag_name,f,b,bigint_type_tag_name,smallint_type_tag_name,bool_type_tag_name,ubigint_type_tag_name) TAGS(1359, 3.0441073077150407e+38, "hdozqqjsswenceob", 4323504650099562462, -468, False, 2127413600006157512) (ts) VALUES ("2016-12-16 09:57:50");') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(nchar_type_tag_name,double_type_tag_name,tinyint_type_tag_name,geometry_type_tag_name,ubigint_type_tag_name,usmallint_type_tag_name,uint_type_tag_name) TAGS("jrfnpvmonxehrxqh", 5.481850803776123e+307, -72, "point(1.0 1.0)", -6843236102647158686, 12864, 3757105281) (ts) VALUES ("2016-12-16 10:04:07");') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(utinyint_type_tag_name,nchar_type_tag_name,usmallint_type_tag_name,bool_type_tag_name,tinyint_type_tag_name,f,ubigint_type_tag_name,int_type_tag_name,double_type_tag_name,varchar_type_tag_name,varbinary_type_tag_name,bigint_type_tag_name,geometry_type_tag_name) TAGS(38, "gdjxupnqalfsczwf", 6556, True, 16, 2.3326392387567076e+38, -3052440068987461367, 1379207868, 9.408456780510208e+307, "yfoiebrvvxepulkf", "gyldwqexpqwtymqb", -8612949720672024630, "point(1.0 1.0)") (ts,nchar_type_col_name,tinyint_type_col_name,uint_type_col_name,varchar_type_col_name,float_type_col_name,smallint_type_col_name,speed) VALUES ("2016-12-16 10:07:23", "xhzhyldsilkilnhj", -111, 29265820, "hfayzyyeielxuajo", -1.9673771091182076e+38, -16871, -687056858);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(b,f,ubigint_type_tag_name,double_type_tag_name) TAGS("ojupiiqggvxiyyeg", 1.828613068144597e+38, -3546696963839193043, 1.063690235483227e+308) (ts,bigint_type_col_name,geometry_type_col_name,color,speed,tinyint_type_col_name,usmallint_type_col_name,double_type_col_name,utinyint_type_col_name,ubigint_type_col_name,uint_type_col_name,float_type_col_name,bool_type_col_name,varbinary_type_col_name,smallint_type_col_name,nchar_type_col_name) VALUES ("2016-12-16 10:08:10", -8093382424883326599, "point(1.0 1.0)", "cqihlukuoejlpfry", 979506951, 21, -22385, -1.5427105800265006e+308, 27, -8297437264602062727, -1746384009, 2.252643841383272e+38, True, "lyyysgtqcxnmrtup", -12771, "lfzvhkaxvgdtprxe");') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(ubigint_type_tag_name,tinyint_type_tag_name,smallint_type_tag_name) TAGS(-3588987228330855806, -26, 21365) (ts,tinyint_type_col_name) VALUES ("2016-12-16 10:09:18", -32);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(uint_type_tag_name,nchar_type_tag_name,double_type_tag_name,utinyint_type_tag_name) TAGS(245950801, "yvkkiivzhbqnnmsk", -1.658703905525468e+308, 28) (ts,smallint_type_col_name) VALUES ("2016-12-16 10:13:19", 26054);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(uint_type_tag_name,bool_type_tag_name,ubigint_type_tag_name,varchar_type_tag_name,double_type_tag_name,geometry_type_tag_name,varbinary_type_tag_name,b,utinyint_type_tag_name) TAGS(1694485723, False, -474604515817697594, "rtgthkbkwlbutbgv", 2.3887324912266175e+307, "point(1.0 1.0)", "gopcjcoagmnblahg", "jwnrdxiishgvobmd", 48) (ts,nchar_type_col_name,double_type_col_name,bigint_type_col_name,uint_type_col_name,smallint_type_col_name,tinyint_type_col_name,utinyint_type_col_name) VALUES ("2016-12-16 10:19:33", "xeinqeysquavrsyz", -8.949042643309358e+305, -5607735618216794531, -1459791787, -19075, -55, -127);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(f,uint_type_tag_name,utinyint_type_tag_name,ubigint_type_tag_name,smallint_type_tag_name,geometry_type_tag_name,usmallint_type_tag_name,nchar_type_tag_name,varchar_type_tag_name,bool_type_tag_name,b,tinyint_type_tag_name,extratag,varbinary_type_tag_name) TAGS(-2.4047245829078376e+38, 2561944294, 9, -8008616984432962570, -13634, "point(1.0 1.0)", 40692, "wnbqrneelpvqwlja", "jvqvobbxkeelzunr", True, "fmdtxmzdhmejwdtg", 34, 935844453, "pejduzquhxddarph") (ts,varbinary_type_col_name,varchar_type_col_name,double_type_col_name,bool_type_col_name,nchar_type_col_name,usmallint_type_col_name) VALUES ("2016-12-16 11:27:47", "sgusymsmfcwjnpcy", "npntezujzhtxahzl", -2.8300806976493463e+307, True, "vozigylgtwuwqyxd", -29259);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(utinyint_type_tag_name,geometry_type_tag_name) TAGS(2, "point(1.0 1.0)") (ts,tinyint_type_col_name,color,double_type_col_name,smallint_type_col_name,utinyint_type_col_name,float_type_col_name,varbinary_type_col_name,bool_type_col_name,speed,nchar_type_col_name,ubigint_type_col_name,uint_type_col_name,bigint_type_col_name) VALUES ("2016-12-16 11:38:41", 65, "xbkejkdziselkysy", -1.3741827310590848e+308, 31519, -36, 5.743820075715186e+37, "gnqhbldkghybjgsu", True, 1371169555, "xhfnbxeeaaniflfh", -479840166843776187, 1922629809, -8139122071465810064);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(int_type_tag_name,usmallint_type_tag_name,geometry_type_tag_name,nchar_type_tag_name,varbinary_type_tag_name,smallint_type_tag_name,f,uint_type_tag_name,bigint_type_tag_name,double_type_tag_name,utinyint_type_tag_name,tinyint_type_tag_name,extratag,bool_type_tag_name) TAGS(-270631341, 46930, "point(1.0 1.0)", "gnbznssgvnzwrwxw", "cesmnjhqapqjvrja", 23088, -3.3164207581144432e+38, 1700967625, -1030316662035835968, 1.2011743206213233e+308, -92, 121, 367729172, True) (ts,color,utinyint_type_col_name,usmallint_type_col_name,tinyint_type_col_name,bigint_type_col_name,ubigint_type_col_name,nchar_type_col_name,varchar_type_col_name,speed,double_type_col_name,smallint_type_col_name,float_type_col_name) VALUES ("2016-12-16 11:42:49", "tldfcpsuvkwvvcxt", 27, 23508, 56, 7459772708834616479, 4287277222975526137, "irlpvwywkyfduafy", "fthdcsvpfasrorxm", 2014476868, 6.679126531840444e+307, 24227, 7.882713831816527e+36);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(varbinary_type_tag_name) TAGS("ouvptxbwrpffphkp") (ts,color,double_type_col_name,float_type_col_name,nchar_type_col_name,bigint_type_col_name,varchar_type_col_name,ubigint_type_col_name,bool_type_col_name,tinyint_type_col_name,uint_type_col_name,geometry_type_col_name,speed,usmallint_type_col_name,smallint_type_col_name,utinyint_type_col_name) VALUES ("2016-12-16 12:34:44", "wnyagxmugtlzloqs", 2.5224403678140916e+307, -2.9593116477640043e+38, "wpatbvwqhdetaoko", 7131704094598121396, "cenguwerksdlwthz", -3084446013548702169, False, 121, -53423625, "point(1.0 1.0)", 1601558648, 23715, -10339, 45);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(b,varbinary_type_tag_name,int_type_tag_name,varchar_type_tag_name,bool_type_tag_name,smallint_type_tag_name,utinyint_type_tag_name,double_type_tag_name,nchar_type_tag_name,tinyint_type_tag_name,uint_type_tag_name,ubigint_type_tag_name) TAGS("ebiacunkvnicuhlq", "fqqxcyidlzmeaqqn", 1865880042, "fqyixbagtpigrvkm", True, -15973, 52, -1.2233588646642921e+308, "kjegzlhpztxcjjjt", 49, 3661613052, -3064287245566411855) (ts,tinyint_type_col_name,speed,usmallint_type_col_name,uint_type_col_name,bool_type_col_name,double_type_col_name,varbinary_type_col_name) VALUES ("2016-12-16 12:35:29", -54, -1777243683, -5292, -240610904, False, -1.4017848527201252e+308, "diubdgptppxueerk");') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(ubigint_type_tag_name,tinyint_type_tag_name,varbinary_type_tag_name,int_type_tag_name,utinyint_type_tag_name,varchar_type_tag_name,b,double_type_tag_name,smallint_type_tag_name,uint_type_tag_name) TAGS(7218832446436978154, 34, "jqvhmixowianctmg", -169644439, -111, "yulvetumzeimvdew", "bsbqhjdbykaxhkah", -4.3917327843321925e+307, -12324, 3993659508) (ts,geometry_type_col_name,usmallint_type_col_name,color,tinyint_type_col_name,smallint_type_col_name,varchar_type_col_name,varbinary_type_col_name,double_type_col_name,utinyint_type_col_name,nchar_type_col_name,bigint_type_col_name,bool_type_col_name,uint_type_col_name,ubigint_type_col_name,float_type_col_name,speed) VALUES ("2016-12-16 12:55:41", "point(1.0 1.0)", 631, "nmddklgtjxrugcig", -88, -8868, "miajgamwlraattqs", "kffhsedlnafobisv", 1.4423313487130354e+308, -116, "kxoycofwhmsaeohq", -1136894476255564565, True, -939744415, -6653064581027995564, -1.9832809127199404e+38, -745235635);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(f,varchar_type_tag_name,utinyint_type_tag_name,nchar_type_tag_name,double_type_tag_name,usmallint_type_tag_name,bool_type_tag_name,geometry_type_tag_name,uint_type_tag_name,smallint_type_tag_name,bigint_type_tag_name,b,varbinary_type_tag_name,int_type_tag_name,extratag,tinyint_type_tag_name) TAGS(6.311858336249026e+37, "jgyxmmpsdxqtdwrb", 109, "ziwccnmvbdvxjqvt", -8.093949887150045e+307, 50753, True, "point(1.0 1.0)", 1312277084, -22696, -6774059684436011400, "cfvnaoytrwsqfgik", "scoopbahexobzuzi", 260884614, 2013977267, -98) (ts,geometry_type_col_name,bigint_type_col_name,float_type_col_name,varbinary_type_col_name) VALUES ("2016-12-16 12:58:13", "point(1.0 1.0)", 222826911129858937, 1.4161786490709517e+38, "pwyyqxegncyrgybp");') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(extratag,tinyint_type_tag_name,bool_type_tag_name,utinyint_type_tag_name,int_type_tag_name,varbinary_type_tag_name,uint_type_tag_name,ubigint_type_tag_name,smallint_type_tag_name) TAGS(-350969142, -27, True, 95, -2014323156, "ytaraprsrowqgtya", 2187064438, 7657067162517860811, -11739) (ts,ubigint_type_col_name,speed,float_type_col_name,geometry_type_col_name,utinyint_type_col_name,smallint_type_col_name,uint_type_col_name,usmallint_type_col_name,tinyint_type_col_name) VALUES ("2016-12-16 12:58:20", 1695470437837518753, -248107853, -2.308796864773065e+38, "point(1.0 1.0)", 96, 27392, -317204398, -28969, 27);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(usmallint_type_tag_name,varchar_type_tag_name,extratag,geometry_type_tag_name,f,bool_type_tag_name,double_type_tag_name,uint_type_tag_name,ubigint_type_tag_name,smallint_type_tag_name,bigint_type_tag_name,nchar_type_tag_name,utinyint_type_tag_name,b,varbinary_type_tag_name,int_type_tag_name) TAGS(9315, "zcptltyqaoeubpam", -411172808, "point(1.0 1.0)", -1.274336621267979e+38, True, -1.574639717196322e+308, 3207202020, 8037317073978039576, 14431, 1953592773870071856, "qwzkcwunsuoqokru", -83, "crpiwmvdmhhxtnon", "rzvcgilgehavrorx", 1770221516) (ts,float_type_col_name,color,uint_type_col_name,speed,varchar_type_col_name,bigint_type_col_name,smallint_type_col_name) VALUES ("2016-12-16 12:58:25", 2.203270740971935e+38, "gclrvxcyluoaqkul", -1757420543, -1667540040, "fhcuwffqunwujhnu", -6952698129894047939, 31135);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(extratag,geometry_type_tag_name,smallint_type_tag_name,bigint_type_tag_name,int_type_tag_name,b,bool_type_tag_name,varchar_type_tag_name,varbinary_type_tag_name,tinyint_type_tag_name,ubigint_type_tag_name,nchar_type_tag_name,usmallint_type_tag_name,utinyint_type_tag_name) TAGS(928439163, "point(1.0 1.0)", -5510, -6111546345505423465, 1619259430, "zqnekxkjgjysmuiz", False, "uzacypoysstbvzjr", "rzhyionncrfhslvk", -95, 2084839207513824909, "xbakjryihqmzoyxb", 1124, -51) (ts) VALUES ("2016-12-16 13:10:00");') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(bigint_type_tag_name,f,tinyint_type_tag_name,smallint_type_tag_name,varbinary_type_tag_name,uint_type_tag_name,utinyint_type_tag_name) TAGS(-7654723116287337126, 7.0413764481621105e+37, 28, 14707, "ohmuqnoqockmmvyr", 503417135, -1) (ts,varchar_type_col_name,color,geometry_type_col_name,usmallint_type_col_name,float_type_col_name,uint_type_col_name,ubigint_type_col_name,bigint_type_col_name,nchar_type_col_name,bool_type_col_name) VALUES ("2016-12-16 13:11:00", "vvnkffiwzkwchxku", "ettaavibyrfbkwnd", "point(1.0 1.0)", -14161, -1.8652679722611485e+38, -32936243, -5932829237196271077, 1036650175201440454, "gnkdvttswywmpmqr", False);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(double_type_tag_name,utinyint_type_tag_name,b,extratag) TAGS(-1.6449590526148958e+308, 5, "oyqjdboasjbcgkoa", 769124366) (ts,smallint_type_col_name,utinyint_type_col_name,varbinary_type_col_name,float_type_col_name,bool_type_col_name) VALUES ("2016-12-16 13:12:21", -13042, 36, "ioqlptmacnphnudi", -2.8818733348179174e+38, True);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(f,geometry_type_tag_name,extratag,usmallint_type_tag_name,varchar_type_tag_name,bigint_type_tag_name,utinyint_type_tag_name,b,tinyint_type_tag_name) TAGS(-3.002723197204508e+38, "point(1.0 1.0)", 673924760, 10423, "zqbdmmvwolrmxtdy", 9067788071941407006, 58, "xfzkhhjsdslfocok", -6) (ts,bigint_type_col_name,float_type_col_name,usmallint_type_col_name,bool_type_col_name,uint_type_col_name,color,double_type_col_name) VALUES ("2016-12-16 13:18:58", -8128143152489083329, 3.1863841600401516e+38, -16841, False, -1439274645, "ayaagfubotrfelgd", 3.940540502421231e+307);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(utinyint_type_tag_name,geometry_type_tag_name,uint_type_tag_name,double_type_tag_name,extratag,ubigint_type_tag_name,int_type_tag_name,varchar_type_tag_name,bigint_type_tag_name,varbinary_type_tag_name,usmallint_type_tag_name,nchar_type_tag_name,f) TAGS(72, "point(1.0 1.0)", 664119737, 8.636577697672091e+307, -1956689850, 5442726894170414063, -620118845, "atdkvjdrsslbkqwk", -1730258878203616660, "jetzkpnswyrblizo", 62924, "yubdmiswgttrzlud", -2.6952802203722693e+38) (ts,tinyint_type_col_name,varbinary_type_col_name,bigint_type_col_name,utinyint_type_col_name,nchar_type_col_name,usmallint_type_col_name,geometry_type_col_name,double_type_col_name,color,uint_type_col_name,float_type_col_name,ubigint_type_col_name,varchar_type_col_name,bool_type_col_name,speed) VALUES ("2016-12-16 13:22:31", -101, "pezwjcdegugdqlmj", 2660651858547046010, -106, "xdhkuoxnpbrxzikz", 32513, "point(1.0 1.0)", 1.0237067068787619e+308, "qipropwsssqtdswq", -918947945, -3.2678520762372033e+38, 407015107737783176, "vvigrjnmxmzasgqt", False, -1322323386);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(uint_type_tag_name,varchar_type_tag_name,geometry_type_tag_name,double_type_tag_name,extratag,bool_type_tag_name,usmallint_type_tag_name,tinyint_type_tag_name,f,int_type_tag_name,ubigint_type_tag_name) TAGS(667307468, "lykdtqsuiuxbdejt", "point(1.0 1.0)", -3.233371151222957e+307, 780193507, False, 6454, -104, -1.6348292668856767e+38, -332964092, 6842647149944893582) (ts,bigint_type_col_name,nchar_type_col_name,double_type_col_name,smallint_type_col_name,varbinary_type_col_name,bool_type_col_name,speed,ubigint_type_col_name,utinyint_type_col_name,color,geometry_type_col_name,float_type_col_name,tinyint_type_col_name,usmallint_type_col_name) VALUES ("2016-12-16 13:23:55", -2751819826451411816, "fwuvslqvozjdkybl", -1.4309368487421518e+308, -29059, "ncbtjyvhgdmrtwyb", False, 476112352, 5847161143554335168, 103, "rkxynqftsspdyohe", "point(1.0 1.0)", -2.7303867859897275e+38, 120, -15572);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(extratag,int_type_tag_name) TAGS(1467247951, -27058643) (ts,smallint_type_col_name) VALUES ("2016-12-16 13:28:54", 11705);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(ubigint_type_tag_name,double_type_tag_name,bool_type_tag_name,uint_type_tag_name,varbinary_type_tag_name,f,int_type_tag_name,extratag) TAGS(-7641570078560113172, -1.5720182754543317e+308, False, 3978085195, "otsbskgvmxxpqsuv", 1.761118847494028e+38, -798787056, 1618027135) (ts,tinyint_type_col_name,usmallint_type_col_name,float_type_col_name,varchar_type_col_name,color) VALUES ("2016-12-16 13:30:00", 34, -27037, 8.233875034151866e+37, "klvhnzbiagpaygjr", "azavalppgglodkpt");') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(utinyint_type_tag_name,smallint_type_tag_name,nchar_type_tag_name,b,extratag,usmallint_type_tag_name,tinyint_type_tag_name,varchar_type_tag_name,f,varbinary_type_tag_name,geometry_type_tag_name) TAGS(-113, 26916, "hiabnhvkskqdxcft", "rilirkzfvvcsoxvu", 1985911354, 63961, -49, "tkqjhnbsfqlkrmen", 2.4436889435795517e+38, "ljxwjovyuimnwfyn", "point(1.0 1.0)") (ts,float_type_col_name,speed,double_type_col_name,nchar_type_col_name,tinyint_type_col_name,smallint_type_col_name,geometry_type_col_name,utinyint_type_col_name,varchar_type_col_name) VALUES ("2016-12-16 13:32:10", -2.8391080467349558e+38, -334011151, -6.231241486564915e+307, "yikfspsjjzvjmiig", 65, 32623, "point(1.0 1.0)", -79, "vqcenjbphvbzuyec");') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(f,bool_type_tag_name,b,nchar_type_tag_name,uint_type_tag_name,utinyint_type_tag_name,varchar_type_tag_name) TAGS(7.628181285293382e+37, False, "xasbwapuqiwnuapm", "wgbkfpitzqilvgam", 1495376777, -22, "cyihglhaaqdhsbrt") (ts,bigint_type_col_name,ubigint_type_col_name,color) VALUES ("2016-12-16 13:33:30", 6511707951588009422, 2723033375589066235, "gxikhegxccxagvge");') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(utinyint_type_tag_name,smallint_type_tag_name,bigint_type_tag_name,usmallint_type_tag_name,bool_type_tag_name,nchar_type_tag_name,geometry_type_tag_name,uint_type_tag_name,varchar_type_tag_name) TAGS(106, 142, 1896023978688432555, 64760, True, "kbfjnghakyfiaydm", "point(1.0 1.0)", 1202839796, "hmpxrvvhazkoxktl") (ts,color,double_type_col_name,geometry_type_col_name,float_type_col_name,ubigint_type_col_name,varbinary_type_col_name,bigint_type_col_name) VALUES ("2016-12-16 13:34:57", "rnlnepdxpkshnoon", -9.753180446674174e+307, "point(1.0 1.0)", 7.136745784580883e+37, -5844625605864726019, "cjivuqrqtdkhbiwa", 2274288423212647405);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(nchar_type_tag_name,double_type_tag_name,tinyint_type_tag_name,utinyint_type_tag_name,geometry_type_tag_name) TAGS("nebcguavuaezyyde", 1.2787498546480036e+308, -102, -1, "point(1.0 1.0)") (ts,bool_type_col_name,geometry_type_col_name,utinyint_type_col_name,usmallint_type_col_name) VALUES ("2016-12-16 13:37:33", True, "point(1.0 1.0)", 60, 3057);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(f,bigint_type_tag_name,utinyint_type_tag_name,double_type_tag_name,usmallint_type_tag_name,int_type_tag_name,b) TAGS(-3.3009424548590525e+38, 7360584785531994343, 20, 1.426103197404768e+308, 47478, -1878972741, "nscbvzswvnmgwucm") (ts,smallint_type_col_name,geometry_type_col_name,utinyint_type_col_name,bool_type_col_name,uint_type_col_name) VALUES ("2016-12-16 13:37:39", -27464, "point(1.0 1.0)", 112, True, 1250310797);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(ubigint_type_tag_name,double_type_tag_name,smallint_type_tag_name,usmallint_type_tag_name,varbinary_type_tag_name) TAGS(-1589972917066394459, 8.923822004171481e+307, 15758, 5488, "ruuxldxnhfwxpstv") (ts,uint_type_col_name,color,bool_type_col_name,ubigint_type_col_name,smallint_type_col_name,varchar_type_col_name,varbinary_type_col_name,float_type_col_name,usmallint_type_col_name,double_type_col_name,nchar_type_col_name,geometry_type_col_name) VALUES ("2016-12-16 13:44:22", 963762484, "wlcggiilxpahshwd", True, 3728201935390266604, -2468, "edlyrnopkadknbig", "odaximfsofanwsiq", 1.2948243726798647e+38, 22342, 1.6685972624971541e+308, "ebxjnldwzyxugscc", "point(1.0 1.0)");') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(tinyint_type_tag_name,usmallint_type_tag_name,smallint_type_tag_name,geometry_type_tag_name,bigint_type_tag_name,uint_type_tag_name,b,int_type_tag_name,ubigint_type_tag_name,utinyint_type_tag_name,nchar_type_tag_name) TAGS(-88, 51955, 29505, "point(1.0 1.0)", -6962148594230058647, 2678324900, "kygvkaanownlmuny", -1846762302, -785520152137980973, 49, "oxptoddkmvlzukes") (ts,tinyint_type_col_name,varchar_type_col_name,bigint_type_col_name) VALUES ("2016-12-16 13:49:22", 31, "nicxhhisdvunqmyq", 8945862635913752172);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(smallint_type_tag_name,b,varchar_type_tag_name,int_type_tag_name,bigint_type_tag_name) TAGS(23202, "imrskuasopukglor", "bvizzkkpezerxhqu", 317353908, 754217902580887681) (ts,geometry_type_col_name) VALUES ("2016-12-16 13:53:17", "point(1.0 1.0)");') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(int_type_tag_name,tinyint_type_tag_name,uint_type_tag_name,utinyint_type_tag_name,double_type_tag_name,ubigint_type_tag_name,bigint_type_tag_name,varbinary_type_tag_name,bool_type_tag_name,usmallint_type_tag_name,b,extratag,f,varchar_type_tag_name,nchar_type_tag_name,geometry_type_tag_name,smallint_type_tag_name) TAGS(-1011316156, 122, 3910130646, 43, 8.512388268116912e+307, 1669456457022538791, 2195079875842603602, "erjqjbgtlgvbwwja", True, 42205, "wovnwgvyflnrbkjr", 1404754906, 2.2368721201787224e+38, "yjisfzjurskvjdck", "vmjcbkwgfouvenyq", "point(1.0 1.0)", -6290) (ts,bool_type_col_name,ubigint_type_col_name,speed,tinyint_type_col_name,usmallint_type_col_name,utinyint_type_col_name,nchar_type_col_name,double_type_col_name,varbinary_type_col_name,smallint_type_col_name,uint_type_col_name,bigint_type_col_name,geometry_type_col_name,varchar_type_col_name) VALUES ("2016-12-16 13:55:15", False, -8830864698607791783, 200778707, 80, -12482, -108, "qlzsnerbfpxtrhsu", 7.918325930212065e+307, "bkeuitzjnwepwsoz", -24175, 1796806861, 8456809260387320755, "point(1.0 1.0)", "bfhekhbyzfnbfvbc");') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(int_type_tag_name,varbinary_type_tag_name,varchar_type_tag_name,b,nchar_type_tag_name,extratag,double_type_tag_name,smallint_type_tag_name,uint_type_tag_name,utinyint_type_tag_name,tinyint_type_tag_name,bigint_type_tag_name,bool_type_tag_name,f,usmallint_type_tag_name,ubigint_type_tag_name,geometry_type_tag_name) TAGS(-109100963, "fkktjbsjdjozysqb", "kvckvuuvjkhrwvum", "svohobpldtonpiqs", "bgrvrzilrbtkzaim", 1058428584, 7.196238081264505e+306, 1884, 2991872141, -109, 117, 1510579019662137511, False, 1.2245033771852769e+38, 19364, -4972876200109100193, "point(1.0 1.0)") (ts,nchar_type_col_name,utinyint_type_col_name,varbinary_type_col_name,bigint_type_col_name,geometry_type_col_name,ubigint_type_col_name,smallint_type_col_name,bool_type_col_name,speed,color,uint_type_col_name) VALUES ("2016-12-16 13:58:17", "fhofoqbrebyjlnkk", 78, "jbttouyukxktabti", 715764060196867324, "point(1.0 1.0)", -3965830703103714728, 6591, True, -2043004502, "ipjtaiujqrieidut", -1209525645);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(varbinary_type_tag_name,uint_type_tag_name,utinyint_type_tag_name,bool_type_tag_name,smallint_type_tag_name,f,bigint_type_tag_name) TAGS("rqnninzykiejsiaq", 2744710939, 125, True, -3120, 2.294739380866984e+38, 3223998974927684831) (ts,nchar_type_col_name,smallint_type_col_name,bigint_type_col_name,geometry_type_col_name,color,ubigint_type_col_name,float_type_col_name,varchar_type_col_name,double_type_col_name,varbinary_type_col_name,speed,utinyint_type_col_name) VALUES ("2016-12-16 13:58:26", "dpuonivwjikfanqj", 28149, -8363753204688150611, "point(1.0 1.0)", "deqhimtcneshajxu", -7721659794023728322, 3.1823124307599837e+38, "lmykqmofvaeejays", 1.3450730693544848e+308, "cpvchycerzkkriye", -935361460, -32);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(nchar_type_tag_name,varbinary_type_tag_name,b) TAGS("gzexbtkchcrciore", "xzsaapvhaldvnsee", "luhcuujwpvsqcydj") (ts,varbinary_type_col_name,uint_type_col_name,smallint_type_col_name) VALUES ("2016-12-16 14:17:37", "vegoocllfotccxme", 1106951626, 22765);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(smallint_type_tag_name,nchar_type_tag_name,b,varchar_type_tag_name,bigint_type_tag_name,tinyint_type_tag_name) TAGS(16570, "silgmziwpdxxoyek", "yqvguhekzckruinc", "aajlxcknjrbyhkha", -8045441217037238680, 107) (ts,varchar_type_col_name,float_type_col_name,speed,utinyint_type_col_name,bool_type_col_name,color) VALUES ("2016-12-16 14:19:46", "heftclalnprpfawp", 6.0294286136178425e+37, 302462364, -8, False, "zdadyskvxrgyaqsm");') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(smallint_type_tag_name,varbinary_type_tag_name,tinyint_type_tag_name,uint_type_tag_name,nchar_type_tag_name) TAGS(10191, "lhxvlfkfbtrhsjkt", 124, 77770857, "dmsjeojxddyuxink") (ts,tinyint_type_col_name,speed,uint_type_col_name,bool_type_col_name,varbinary_type_col_name,double_type_col_name,color) VALUES ("2016-12-16 14:32:40", 21, 379371801, 608762533, False, "rjgbwgnnkkemctro", 1.4188655662190125e+308, "sbwlxrlpgnkmvadl");') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(bool_type_tag_name,int_type_tag_name) TAGS(False, 2060765790) (ts) VALUES ("2016-12-16 14:59:59");') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(nchar_type_tag_name,b) TAGS("ieyyywpqpqushibb", "dkvjhgnakkgqzijs") (ts) VALUES ("2016-12-16 15:16:49");') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(nchar_type_tag_name,varchar_type_tag_name,usmallint_type_tag_name,tinyint_type_tag_name,double_type_tag_name,bigint_type_tag_name,uint_type_tag_name,utinyint_type_tag_name,int_type_tag_name,bool_type_tag_name,extratag,b,geometry_type_tag_name,f) TAGS("mgatrnymxrqqmdyx", "oljnaeurozmvfqhp", 48759, 38, 3.403325685451397e+307, -6460116231033920128, 1576382718, 104, -603843450, True, 309025710, "tcbaxjfsqakxpvji", "point(1.0 1.0)", 2.8892847575707817e+38) (ts,usmallint_type_col_name,ubigint_type_col_name,nchar_type_col_name,uint_type_col_name,double_type_col_name,varbinary_type_col_name) VALUES ("2016-12-16 15:20:44", -17861, 7575197484024879527, "txwlduparjczcbnx", -2111059045, 4.196810591621617e+307, "asimawbydzjggkce");') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(usmallint_type_tag_name,bigint_type_tag_name,double_type_tag_name) TAGS(58633, -7506966660525849170, 6.430296151375471e+307) (ts,smallint_type_col_name,color,bigint_type_col_name,geometry_type_col_name,speed,nchar_type_col_name,float_type_col_name,double_type_col_name,varchar_type_col_name,usmallint_type_col_name,uint_type_col_name,varbinary_type_col_name) VALUES ("2016-12-16 15:51:23", -16594, "twlhrkfaqrwnjumx", -6411319415230721292, "point(1.0 1.0)", 1147845389, "dkuebijphjfmniyc", -2.276532994058693e+38, -4.871085226210322e+307, "ttundubdmhuwtaaa", -29548, -424312121, "zgvfwozyxijapwho");') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(uint_type_tag_name,int_type_tag_name) TAGS(4147856182, 710788816) (ts,uint_type_col_name,double_type_col_name,nchar_type_col_name) VALUES ("2016-12-16 16:03:05", -391718933, 9.11108254173214e+306, "mtfdzaczermguiog");') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(varbinary_type_tag_name,int_type_tag_name,uint_type_tag_name,utinyint_type_tag_name,bool_type_tag_name,nchar_type_tag_name,bigint_type_tag_name,varchar_type_tag_name,extratag,b,smallint_type_tag_name,ubigint_type_tag_name,usmallint_type_tag_name) TAGS("abhddtiwgwsawqif", -326574137, 3092694575, 117, True, "elqkqieyrmvxdfal", 513325224677025259, "coxihpudvcdmvavx", 949926470, "jtbtsxdafkcutiyq", 18084, -3755127971745692605, 15049) (ts,color,uint_type_col_name,bigint_type_col_name,ubigint_type_col_name,bool_type_col_name,geometry_type_col_name,tinyint_type_col_name,varchar_type_col_name,speed,usmallint_type_col_name,varbinary_type_col_name,double_type_col_name,smallint_type_col_name,nchar_type_col_name,float_type_col_name) VALUES ("2016-12-16 16:10:12", "geiqxfxzxvcisxvq", 404296035, 6018544511539939806, -2723124593683508517, False, "point(1.0 1.0)", -35, "vpgmwoviojtaksyc", -1590408139, -21520, "yivgshgarquqsmkx", -5.091863294679578e+307, -6162, "hwxnlpshligbgdwr", 2.8760534412729593e+38);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(geometry_type_tag_name,f,nchar_type_tag_name,double_type_tag_name,ubigint_type_tag_name,extratag,b,varbinary_type_tag_name) TAGS("point(1.0 1.0)", -8.890969508566344e+37, "olgmpbkzjdyaaxkw", 1.1670001553372841e+308, -6483556380230416046, -1489326043, "kavalxtywfupgxae", "nimnqvcrgffqrnry") (ts,geometry_type_col_name,double_type_col_name,varchar_type_col_name,tinyint_type_col_name,nchar_type_col_name,bool_type_col_name,float_type_col_name,utinyint_type_col_name,usmallint_type_col_name,bigint_type_col_name,speed,uint_type_col_name,smallint_type_col_name,color) VALUES ("2016-12-16 16:31:17", "point(1.0 1.0)", -1.6228106351276176e+308, "mrbiqastjhshphqy", -31, "sldcopievsrcpmdn", True, 1.2788940507924604e+38, -53, 1934, -93937490102293875, 251909968, -1180421292, 2009, "fvcuvlqkjdivmbhf");') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(nchar_type_tag_name,varchar_type_tag_name,uint_type_tag_name,geometry_type_tag_name,extratag,bigint_type_tag_name,double_type_tag_name,usmallint_type_tag_name,int_type_tag_name,varbinary_type_tag_name,bool_type_tag_name,ubigint_type_tag_name,f) TAGS("hcwwkenozisgewdo", "ftzlnzgbqcyttqkz", 557595811, "point(1.0 1.0)", -1874674248, -2833874801024332821, 1.106348478672925e+308, 10205, -377441795, "nlqfaejgqdmixvco", True, -8116329742748132558, 2.0010693036315465e+37) (ts,varbinary_type_col_name,smallint_type_col_name,geometry_type_col_name,tinyint_type_col_name,usmallint_type_col_name,color,nchar_type_col_name,bigint_type_col_name,utinyint_type_col_name,bool_type_col_name,ubigint_type_col_name,speed,double_type_col_name,float_type_col_name,varchar_type_col_name) VALUES ("2016-12-16 16:59:27", "kjukvijrgrplxrqt", 15581, "point(1.0 1.0)", 94, 25505, "btgdgtpeqlczgeua", "sstxtgzlyuxqmpla", -8232897057478421459, -38, False, 1902106109546699459, -2035112348, -6.609585770864842e+307, -5.473155208537856e+37, "wkymamybnhbkbwod");') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(b,extratag,varchar_type_tag_name,double_type_tag_name,tinyint_type_tag_name,utinyint_type_tag_name,geometry_type_tag_name,varbinary_type_tag_name,bool_type_tag_name) TAGS("obtjobsephyqxyky", 1926001254, "scxtotlkrgfzsqej", 8.631070766476075e+307, 116, -122, "point(1.0 1.0)", "venokzvoaqfytamy", False) (ts,tinyint_type_col_name,varchar_type_col_name,utinyint_type_col_name,geometry_type_col_name,varbinary_type_col_name,ubigint_type_col_name,nchar_type_col_name,bool_type_col_name,double_type_col_name,bigint_type_col_name,float_type_col_name,smallint_type_col_name,uint_type_col_name) VALUES ("2016-12-16 17:09:37", 38, "wihymoxehtmockaj", 119, "point(1.0 1.0)", "lamqyqtuicaumtur", 228827014834750467, "wjeizsgkbechyzya", True, -4.942776530531653e+307, -7607643892481897470, -8.442862379478159e+36, -19143, -2117225342);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(utinyint_type_tag_name,varchar_type_tag_name,f,smallint_type_tag_name,tinyint_type_tag_name,double_type_tag_name,varbinary_type_tag_name,extratag,nchar_type_tag_name,bool_type_tag_name,bigint_type_tag_name,usmallint_type_tag_name,geometry_type_tag_name) TAGS(-103, "rlxmlphalsiwfxkb", -3.256319143371585e+38, -23823, -50, -4.530638219225517e+307, "ycpjvlrnkgdcxbxl", -1782343000, "eibzodmwkyfectbm", False, -3662763902289367996, 11348, "point(1.0 1.0)") (ts,color,bool_type_col_name,uint_type_col_name) VALUES ("2016-12-16 17:13:24", "bpczdwxzdhdlacff", True, 853512564);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(f,geometry_type_tag_name,double_type_tag_name,usmallint_type_tag_name,b,uint_type_tag_name,varbinary_type_tag_name,varchar_type_tag_name,bool_type_tag_name,bigint_type_tag_name,extratag,smallint_type_tag_name,int_type_tag_name,tinyint_type_tag_name,nchar_type_tag_name) TAGS(2.8559644361518244e+38, "point(1.0 1.0)", -8.660488863866903e+307, 51580, "mfdzkxvqcmvlwcab", 1370077655, "gsocrcrzmrbagyvu", "gwtxcyfmdzlvijkk", False, 4749716129372507648, -1343610171, 3648, 67398117, 55, "onuoalimpzxphmrb") (ts,varchar_type_col_name,nchar_type_col_name) VALUES ("2016-12-16 17:19:38", "lbdzxuiflnytuwcm", "qyiblgcvjolvnfxd");') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(bool_type_tag_name,utinyint_type_tag_name,varchar_type_tag_name,b,nchar_type_tag_name,double_type_tag_name,uint_type_tag_name,varbinary_type_tag_name,bigint_type_tag_name,ubigint_type_tag_name,f,int_type_tag_name,usmallint_type_tag_name,smallint_type_tag_name,geometry_type_tag_name) TAGS(True, -128, "ghxlfvebdngntlsy", "gyshejexhflthjyt", "csoufooqhjixarep", -3.560079945924916e+307, 3796289973, "xrwzaykbqpnpowzg", -5254959553491612400, 6959026343484215526, -2.426597157147208e+38, 1953534210, 56530, -27622, "point(1.0 1.0)") (ts,nchar_type_col_name,varbinary_type_col_name,varchar_type_col_name,uint_type_col_name,speed,ubigint_type_col_name,double_type_col_name,usmallint_type_col_name,bool_type_col_name,bigint_type_col_name,tinyint_type_col_name,color,float_type_col_name,geometry_type_col_name,smallint_type_col_name,utinyint_type_col_name) VALUES ("2016-12-16 17:28:43", "bxarvuznezbovivi", "ljmaaewnxbwquqbv", "vmttcfyjpofkfxdz", -160343511, -1153710436, -6078325270497694207, -1.6708621643614452e+308, -18667, False, -5283782545471513173, 34, "xmbhflvmvnjsjukp", 1.7453583209432804e+38, "point(1.0 1.0)", 21766, 96);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(varchar_type_tag_name,ubigint_type_tag_name,bool_type_tag_name,nchar_type_tag_name,varbinary_type_tag_name,int_type_tag_name,b,utinyint_type_tag_name) TAGS("xzxnwavsfkqexqst", 6248701313661488236, False, "tfzyiigcdgdviljn", "pyaziteptbnjwetv", 1550386893, "hvgiajgmbrfjbhzv", -50) (ts,uint_type_col_name,ubigint_type_col_name,utinyint_type_col_name,nchar_type_col_name) VALUES ("2016-12-16 17:29:35", -2140028488, 9126620526143931960, 48, "vzlvftkxtgejntwx");') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(int_type_tag_name,f,varchar_type_tag_name) TAGS(962788507, 1.835407119522404e+38, "dcugcviilgfzpjup") (ts,usmallint_type_col_name,smallint_type_col_name,bigint_type_col_name,geometry_type_col_name,ubigint_type_col_name,speed,nchar_type_col_name,double_type_col_name,float_type_col_name) VALUES ("2016-12-16 17:33:20", 2254, 28827, -8316728271968247646, "point(1.0 1.0)", 6630573292051824500, -1180210336, "bvbksqzbwgmpufzu", 2.591615616226201e+307, 1.8393414054114685e+38);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(bigint_type_tag_name,b,f,double_type_tag_name,ubigint_type_tag_name,int_type_tag_name,varbinary_type_tag_name,bool_type_tag_name,smallint_type_tag_name,tinyint_type_tag_name,uint_type_tag_name,varchar_type_tag_name,usmallint_type_tag_name,nchar_type_tag_name,geometry_type_tag_name,extratag) TAGS(-1652523720828862491, "rshcsvsqtejnnyzt", -2.8033588099999885e+38, 1.1267740923697902e+308, 6134475623749100063, 275423891, "symfelluxyjghegv", True, 28636, 15, 2850861607, "dluujqzooplynbpi", 11747, "xkepcycandqyqhng", "point(1.0 1.0)", 28000589) (ts,float_type_col_name) VALUES ("2016-12-16 17:35:20", -2.768468628882595e+38);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(usmallint_type_tag_name,utinyint_type_tag_name,b,varbinary_type_tag_name,varchar_type_tag_name,smallint_type_tag_name,nchar_type_tag_name,tinyint_type_tag_name,bigint_type_tag_name) TAGS(40614, -17, "xwadkvwyxpirlkuv", "tfgddotpqkdjbtbh", "weehvoxpqcioyipx", -25537, "xtrykrvmibasrfpk", 64, 2611368116480765912) (ts,color,geometry_type_col_name,usmallint_type_col_name,float_type_col_name,smallint_type_col_name,bigint_type_col_name,utinyint_type_col_name) VALUES ("2016-12-16 17:37:51", "jdyzckzuwxieaecb", "point(1.0 1.0)", -27205, -1.711911078586609e+38, 31375, -6123067329853056480, -90);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(bigint_type_tag_name,usmallint_type_tag_name) TAGS(1819937892824962656, 8171) (ts,ubigint_type_col_name,float_type_col_name,bool_type_col_name,uint_type_col_name,color,double_type_col_name) VALUES ("2016-12-16 17:43:42", -4609243792627697209, 2.006334657982245e+38, False, 1603774652, "czkpwgrrldvfefpq", -5.301467469348041e+307);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(bigint_type_tag_name,b,usmallint_type_tag_name,int_type_tag_name,uint_type_tag_name,double_type_tag_name,tinyint_type_tag_name,utinyint_type_tag_name) TAGS(1581454524159189903, "aauchczywgtewzec", 10564, -1624200982, 1778830750, 1.007077574465233e+308, -117, -8) (ts,double_type_col_name,color,nchar_type_col_name,utinyint_type_col_name,bigint_type_col_name,uint_type_col_name,tinyint_type_col_name,varchar_type_col_name) VALUES ("2016-12-16 17:47:52", 3.178641188947165e+307, "plewvtmwmncovgwi", "afkkkizxcmpvjrof", 97, -4082154569696236500, 785036327, 36, "tnjnpkqduaiplcbr");') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(smallint_type_tag_name) TAGS(-9259) (ts,ubigint_type_col_name,utinyint_type_col_name,varbinary_type_col_name,bool_type_col_name,varchar_type_col_name,nchar_type_col_name,geometry_type_col_name,usmallint_type_col_name,speed) VALUES ("2016-12-16 17:50:22", 6575849309295898287, -110, "ebiistxhnphfulox", False, "djlqhenlzryusbkd", "ltldluztvsgqjeku", "point(1.0 1.0)", 8278, 1651340708);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(double_type_tag_name,nchar_type_tag_name,geometry_type_tag_name,smallint_type_tag_name,utinyint_type_tag_name,extratag) TAGS(1.0764964917532312e+308, "ykuhegoyikhmcgre", "point(1.0 1.0)", 9094, 74, 1323341877) (ts,varbinary_type_col_name) VALUES ("2016-12-16 17:51:12", "nafbgufapnohskpj");') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(smallint_type_tag_name,double_type_tag_name) TAGS(28583, 1.953720446700205e+307) (ts,nchar_type_col_name,varbinary_type_col_name,utinyint_type_col_name,geometry_type_col_name,varchar_type_col_name,speed) VALUES ("2016-12-16 18:11:59", "qwqpnycixypxdgkx", "sqdczulupdskltin", -2, "point(1.0 1.0)", "gbqmwfvaobmucwws", -1295442484);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(ubigint_type_tag_name,uint_type_tag_name,utinyint_type_tag_name,nchar_type_tag_name,bigint_type_tag_name,tinyint_type_tag_name,geometry_type_tag_name,f,int_type_tag_name,double_type_tag_name,varchar_type_tag_name,extratag,bool_type_tag_name,smallint_type_tag_name,b,usmallint_type_tag_name) TAGS(-1899740088608098071, 3000382785, -90, "lyiqgjrtcmygsulu", 3674173029313761846, 24, "point(1.0 1.0)", -2.0614150673404532e+38, -83384014, 8.266327304822514e+307, "hmriafyufcvjdmxp", -1458878109, True, 2751, "ldrlpabgmvlmmvpg", 14211) (ts,color,ubigint_type_col_name,uint_type_col_name,smallint_type_col_name,varbinary_type_col_name,speed,tinyint_type_col_name,double_type_col_name,float_type_col_name,varchar_type_col_name,usmallint_type_col_name,geometry_type_col_name,bool_type_col_name) VALUES ("2016-12-16 18:14:29", "hlfayalksfvnguaw", 7446576754933889227, -200330992, 28598, "bqqqhufmncpjhsuv", 218558271, -85, -9.741398605743586e+307, 7.376357821892906e+37, "tpvxybkpxgmhowjr", 25868, "point(1.0 1.0)", False);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(geometry_type_tag_name,nchar_type_tag_name,usmallint_type_tag_name,uint_type_tag_name,varchar_type_tag_name,b,int_type_tag_name,utinyint_type_tag_name,varbinary_type_tag_name,double_type_tag_name,bigint_type_tag_name,smallint_type_tag_name,f,ubigint_type_tag_name,bool_type_tag_name) TAGS("point(1.0 1.0)", "sjzthkwujsqenwih", 48703, 4087817577, "xmqagtnxequrrylr", "ijtbyhilxioxzuah", -352262545, 1, "sckpgzmooxqjheoe", 1.1198965017615236e+308, 6916146561643120258, 32531, -1.6419733589465474e+38, -4935693961629680589, False) (ts,nchar_type_col_name,geometry_type_col_name,double_type_col_name,varbinary_type_col_name,varchar_type_col_name,bigint_type_col_name,smallint_type_col_name,tinyint_type_col_name) VALUES ("2016-12-16 18:16:09", "jssdvwbxvsbmilue", "point(1.0 1.0)", 6.391478347681934e+307, "zdtetttfsnleoyet", "ppoptsqilikhsino", -840467639559539794, -31830, -103);') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(geometry_type_tag_name,smallint_type_tag_name,bigint_type_tag_name,int_type_tag_name,utinyint_type_tag_name,f,uint_type_tag_name,tinyint_type_tag_name) TAGS("point(1.0 1.0)", 24091, 2578286530814614745, 1008675772, -8, 7.362335563770809e+37, 1819796668, 44) (ts,utinyint_type_col_name,bigint_type_col_name,tinyint_type_col_name,ubigint_type_col_name,smallint_type_col_name,varbinary_type_col_name,float_type_col_name,speed,varchar_type_col_name,bool_type_col_name,usmallint_type_col_name,color,geometry_type_col_name) VALUES ("2016-12-16 18:16:59", 93, -2924293332667446092, 18, -1926645562871095772, 25986, "xjlujcacaynnnmub", -9.456838052905681e+37, 529848418, "nxkirdhlqqloitkl", True, 4620, "acujdfhatzkugcrk", "point(1.0 1.0)");') + tdSql.execute(f'INSERT INTO td32506.reg_table_159 using td32506.fs_table(tinyint_type_tag_name,usmallint_type_tag_name,b,f,varbinary_type_tag_name,bigint_type_tag_name,smallint_type_tag_name,geometry_type_tag_name,varchar_type_tag_name,extratag,utinyint_type_tag_name,uint_type_tag_name,ubigint_type_tag_name,double_type_tag_name,bool_type_tag_name,int_type_tag_name) TAGS(-98, 2946, "qgvkaujyrikpmgxp", 3.2784411370027565e+38, "dspxtsyqnqdyciab", -794888918858663169, -1378, "point(1.0 1.0)", "diaerlydilfkqveu", -1591170700, -9, 88084273, -8326438069324931384, -6.790019844508353e+307, False, 1326851510) (ts,speed,double_type_col_name,geometry_type_col_name,ubigint_type_col_name,bool_type_col_name,utinyint_type_col_name,bigint_type_col_name,usmallint_type_col_name,color,smallint_type_col_name,varchar_type_col_name,nchar_type_col_name,float_type_col_name,varbinary_type_col_name) VALUES ("2016-12-16 18:17:51", -1374792144, -1.149850424042433e+308, "point(1.0 1.0)", 8907011909602006795, False, 104, 1588514034331429385, -18984, "namrvnonxcrzziic", -26616, "ueddmjfyoclvjwfx", "mkkexxinfededdfr", -2.403953587086065e+38, "kadxrwlomevmukfr");') + + def test_percentile(self): + tdSql.error('SELECT SPREAD(bigint_type_tag_name),LEASTSQUARES(bigint_type_tag_name, 9, 2),COUNT(bigint_type_tag_name),HYPERLOGLOG(bigint_type_tag_name),PERCENTILE(bigint_type_tag_name,89,27,20,19,87,99,26,17,45),AVG(bigint_type_tag_name), HYPERLOGLOG(tinyint_type_tag_name),AVG(tinyint_type_tag_name),SPREAD(tinyint_type_tag_name),STDDEV(tinyint_type_tag_name),SUM(tinyint_type_tag_name),COUNT(tinyint_type_tag_name),APERCENTILE(tinyint_type_tag_name, 1, "t-digest"),LEASTSQUARES(tinyint_type_tag_name, 8, 1), STDDEV(usmallint_type_tag_name), COUNT(nchar_type_tag_name),HYPERLOGLOG(nchar_type_tag_name), PERCENTILE(double_type_col_name,6,23,52,24,1,53,95,51,38),HYPERLOGLOG(double_type_col_name),SPREAD(double_type_col_name) FROM td32506.reg_table_159 STATE_WINDOW(1);') + + def run(self): + tdLog.debug(f"start to excute {__file__}") + + self.insert_data() + + # math function + self.test_percentile() + + tdLog.success(f"{__file__} successfully executed") + + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 216be82868f9..d389c2792938 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -15,6 +15,7 @@ ,,y,army,./pytest.sh python3 ./test.py -f cluster/snapshot.py -N 3 -L 3 -D 2 ,,y,army,./pytest.sh python3 ./test.py -f query/function/test_func_elapsed.py ,,y,army,./pytest.sh python3 ./test.py -f query/function/test_function.py +,,y,army,./pytest.sh python3 ./test.py -f query/function/test_percentile.py ,,y,army,./pytest.sh python3 ./test.py -f query/function/test_resinfo.py ,,y,army,./pytest.sh python3 ./test.py -f query/function/test_interp.py ,,y,army,./pytest.sh python3 ./test.py -f query/function/concat.py From 6bb0d6dff3c8d213a8a44e740bb31a40923c9273 Mon Sep 17 00:00:00 2001 From: haoranchen Date: Mon, 4 Nov 2024 10:17:07 +0800 Subject: [PATCH 594/695] Update 01-taosd.md --- docs/zh/14-reference/01-components/01-taosd.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/zh/14-reference/01-components/01-taosd.md b/docs/zh/14-reference/01-components/01-taosd.md index 091f9416eb1b..89a97b108d01 100644 --- a/docs/zh/14-reference/01-components/01-taosd.md +++ b/docs/zh/14-reference/01-components/01-taosd.md @@ -156,8 +156,8 @@ charset 的有效值是 UTF-8。 ### 内存相关 | 参数名称 | 参数说明 | | :----------------: | :---------------------------------------------: | -| rpcQueueMemoryAllowed | 一个 dnode 允许的 rpc 消息占用的内存最大值,单位 bytes,取值范围:10485760-INT64_MAX,缺省值:服务器内存的 1/10 | -| syncLogBufferMemoryAllowed | 一个 dnode 允许的 sync 日志缓存消息占用的内存最大值,单位 bytes,取值范围:10485760-INT64_MAX,缺省值:服务器内存的 1/10,3.1.3.2/3.3.2.13 版本开始生效 | +| rpcQueueMemoryAllowed | 一个 dnode 允许的 rpc 消息占用的内存最大值,单位 bytes,取值范围:104857600-INT64_MAX,缺省值:服务器内存的 1/10 | +| syncLogBufferMemoryAllowed | 一个 dnode 允许的 sync 日志缓存消息占用的内存最大值,单位 bytes,取值范围:104857600-INT64_MAX,缺省值:服务器内存的 1/10,3.1.3.2/3.3.2.13 版本开始生效 | ### 性能调优 From 5e19ac7485ef099c137040b5cac39bd8a78cbe50 Mon Sep 17 00:00:00 2001 From: yinheli Date: Wed, 8 May 2024 19:06:35 +0800 Subject: [PATCH 595/695] fix: typo --- docs/zh/14-reference/03-taos-sql/03-table.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/zh/14-reference/03-taos-sql/03-table.md b/docs/zh/14-reference/03-taos-sql/03-table.md index 9e4cc66eaf53..81ad60e3d23f 100644 --- a/docs/zh/14-reference/03-taos-sql/03-table.md +++ b/docs/zh/14-reference/03-taos-sql/03-table.md @@ -42,12 +42,12 @@ table_option: { **使用说明** 1. 表(列)名命名规则参见[名称命名规则](./19-limit.md#名称命名规则)。 -1. 表名最大长度为 192。 -1. 表的第一个字段必须是 TIMESTAMP,并且系统自动将其设为主键。 -1. 除时间戳主键列之外,还可以通过 PRIMARY KEY 关键字指定第二列为额外的主键列。被指定为主键列的第二列必须为整型或字符串类型(varchar)。 -1. 表的每行长度不能超过 48KB(从 3.0.5.0 版本开始为 64KB);(注意:每个 BINARY/NCHAR/GEOMETRY 类型的列还会额外占用 2 个字节的存储位置)。 -1. 使用数据类型 BINARY/NCHAR/GEOMETRY,需指定其最长的字节数,如 BINARY(20),表示 20 字节。 -1. 关于 `ENCODE` 和 `COMPRESS` 的使用,请参考[按列压缩](../compress) +2. 表名最大长度为 192。 +3. 表的第一个字段必须是 TIMESTAMP,并且系统自动将其设为主键。 +4. 除时间戳主键列之外,还可以通过 PRIMARY KEY 关键字指定第二列为额外的主键列。被指定为主键列的第二列必须为整型或字符串类型(VARCHAR)。 +5. 表的每行长度不能超过 48KB(从 3.0.5.0 版本开始为 64KB);(注意:每个 VARCHAR/NCHAR/GEOMETRY 类型的列还会额外占用 2 个字节的存储位置)。 +6. 使用数据类型 VARCHAR/NCHAR/GEOMETRY,需指定其最长的字节数,如 VARCHAR(20),表示 20 字节。 +7. 关于 `ENCODE` 和 `COMPRESS` 的使用,请参考[按列压缩](../compress) **参数说明** From 0f535e06aaec3b3f97ed8e7113a3f46e475cf562 Mon Sep 17 00:00:00 2001 From: dmchen Date: Mon, 4 Nov 2024 11:12:18 +0800 Subject: [PATCH 596/695] feat/TS-5484-audit-delete-fix-review --- source/common/src/tmsg.c | 13 +++++++++++++ source/dnode/mnode/impl/src/mndDnode.c | 3 +++ 2 files changed, 16 insertions(+) diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index 8b55f2c4e9d2..458badc7640e 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -567,6 +567,7 @@ int32_t tSerializeSClientHbBatchRsp(void *buf, int32_t bufLen, const SClientHbBa TAOS_CHECK_EXIT(tSerializeSClientHbRsp(&encoder, pRsp)); } TAOS_CHECK_EXIT(tSerializeSMonitorParas(&encoder, &pBatchRsp->monitorParas)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pBatchRsp->enableAuditDelete)); tEndEncode(&encoder); _exit: @@ -609,6 +610,12 @@ int32_t tDeserializeSClientHbBatchRsp(void *buf, int32_t bufLen, SClientHbBatchR TAOS_CHECK_EXIT(tDeserializeSMonitorParas(&decoder, &pBatchRsp->monitorParas)); } + if (!tDecodeIsEnd(&decoder)) { + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pBatchRsp->enableAuditDelete)); + } else { + pBatchRsp->enableAuditDelete = 0; + } + tEndDecode(&decoder); _exit: @@ -6348,6 +6355,7 @@ int32_t tSerializeSConnectRsp(void *buf, int32_t bufLen, SConnectRsp *pRsp) { TAOS_CHECK_EXIT(tEncodeI32(&encoder, pRsp->authVer)); TAOS_CHECK_EXIT(tEncodeI64(&encoder, pRsp->whiteListVer)); TAOS_CHECK_EXIT(tSerializeSMonitorParas(&encoder, &pRsp->monitorParas)); + TAOS_CHECK_EXIT(tEncodeI8(&encoder, pRsp->enableAuditDelete)); tEndEncode(&encoder); _exit: @@ -6399,6 +6407,11 @@ int32_t tDeserializeSConnectRsp(void *buf, int32_t bufLen, SConnectRsp *pRsp) { if (!tDecodeIsEnd(&decoder)) { TAOS_CHECK_EXIT(tDeserializeSMonitorParas(&decoder, &pRsp->monitorParas)); } + if (!tDecodeIsEnd(&decoder)) { + TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pRsp->enableAuditDelete)); + } else { + pRsp->enableAuditDelete = 0; + } tEndDecode(&decoder); _exit: diff --git a/source/dnode/mnode/impl/src/mndDnode.c b/source/dnode/mnode/impl/src/mndDnode.c index 08e9886df4bc..24ae8382f935 100644 --- a/source/dnode/mnode/impl/src/mndDnode.c +++ b/source/dnode/mnode/impl/src/mndDnode.c @@ -607,12 +607,15 @@ static int32_t mndProcessStatisReq(SRpcMsg *pReq) { } static int32_t mndProcessAuditReq(SRpcMsg *pReq) { + mTrace("process audit req:%p", pReq); if (tsEnableAudit && tsEnableAuditDelete) { SMnode *pMnode = pReq->info.node; SAuditReq auditReq = {0}; TAOS_CHECK_RETURN(tDeserializeSAuditReq(pReq->pCont, pReq->contLen, &auditReq)); + mDebug("received audit req:%s, %s, %s, %s", auditReq.operation, auditReq.db, auditReq.table, auditReq.pSql); + auditAddRecord(pReq, pMnode->clusterId, auditReq.operation, auditReq.db, auditReq.table, auditReq.pSql, auditReq.sqlLen); From f686a5b8ae10f9c36fe625bc8d7e98aeb8447340 Mon Sep 17 00:00:00 2001 From: kailixu Date: Mon, 4 Nov 2024 11:22:52 +0800 Subject: [PATCH 597/695] enh: add active info for show grants logs --- source/common/src/systable.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source/common/src/systable.c b/source/common/src/systable.c index 02efb40f9f56..e44ca9cb2690 100644 --- a/source/common/src/systable.c +++ b/source/common/src/systable.c @@ -437,6 +437,7 @@ static const SSysDbTableSchema userGrantsLogsSchema[] = { {.name = "state", .bytes = 1536 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, {.name = "active", .bytes = 512 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, {.name = "machine", .bytes = TSDB_GRANT_LOG_COL_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, + {.name = "active_info", .bytes = 512 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, }; static const SSysDbTableSchema userMachinesSchema[] = { From 031146b3b5316ba203b8802c20212b64e7219163 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Mon, 4 Nov 2024 11:53:24 +0800 Subject: [PATCH 598/695] fix: check memory calloc --- source/libs/function/src/tudf.c | 34 ++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/source/libs/function/src/tudf.c b/source/libs/function/src/tudf.c index b19320d27fda..a8198a804db2 100644 --- a/source/libs/function/src/tudf.c +++ b/source/libs/function/src/tudf.c @@ -77,6 +77,8 @@ void udfUdfdExit(uv_process_t *process, int64_t exitStatus, int32_t termSignal) static int32_t udfSpawnUdfd(SUdfdData *pData) { fnInfo("start to init udfd"); + + int32_t err = 0; uv_process_options_t options = {0}; char path[PATH_MAX] = {0}; @@ -177,22 +179,39 @@ static int32_t udfSpawnUdfd(SUdfdData *pData) { char **envUdfdWithPEnv = NULL; if (environ != NULL) { + int32_t lenEnvUdfd = ARRAY_SIZE(envUdfd); int32_t numEnviron = 0; while (environ[numEnviron] != NULL) { numEnviron++; } - int32_t lenEnvUdfd = ARRAY_SIZE(envUdfd); - envUdfdWithPEnv = (char **)taosMemoryMalloc((numEnviron + lenEnvUdfd) * sizeof(char *)); + envUdfdWithPEnv = (char **)taosMemoryCalloc(numEnviron + lenEnvUdfd, sizeof(char *)); + if (envUdfdWithPEnv == NULL) { + err = TSDB_CODE_OUT_OF_MEMORY; + goto _OVER; + } for (int32_t i = 0; i < numEnviron; i++) { - envUdfdWithPEnv[i] = (char *)taosMemoryMalloc(strlen(environ[i]) + 1); - strcpy(envUdfdWithPEnv[i], environ[i]); + int32_t len = strlen(environ[i]) + 1; + envUdfdWithPEnv[i] = (char *)taosMemoryCalloc(len, 1); + if (envUdfdWithPEnv[i] == NULL) { + err = TSDB_CODE_OUT_OF_MEMORY; + goto _OVER; + } + + tstrncpy(envUdfdWithPEnv[i], environ[i], len); } + for (int32_t i = 0; i < lenEnvUdfd; i++) { if (envUdfd[i] != NULL) { - envUdfdWithPEnv[numEnviron + i] = (char *)taosMemoryMalloc(strlen(envUdfd[i]) + 1); - strcpy(envUdfdWithPEnv[numEnviron + i], envUdfd[i]); + int32_t len = strlen(envUdfd[i]) + 1; + envUdfdWithPEnv[numEnviron + i] = (char *)taosMemoryCalloc(len, 1); + if (envUdfdWithPEnv[numEnviron + i] == NULL) { + err = TSDB_CODE_OUT_OF_MEMORY; + goto _OVER; + } + + tstrncpy(envUdfdWithPEnv[numEnviron + i], envUdfd[i], len); } } envUdfdWithPEnv[numEnviron + lenEnvUdfd - 1] = NULL; @@ -202,7 +221,7 @@ static int32_t udfSpawnUdfd(SUdfdData *pData) { options.env = envUdfd; } - int32_t err = uv_spawn(&pData->loop, &pData->process, &options); + err = uv_spawn(&pData->loop, &pData->process, &options); pData->process.data = (void *)pData; #ifdef WINDOWS @@ -230,6 +249,7 @@ static int32_t udfSpawnUdfd(SUdfdData *pData) { fnInfo("udfd is initialized"); } +_OVER: if (taosFqdnEnvItem) { taosMemoryFree(taosFqdnEnvItem); } From 83f96706c7594ab7e0a850a58101020dc06454fa Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Mon, 4 Nov 2024 11:58:25 +0800 Subject: [PATCH 599/695] fix: compile errors --- include/os/osString.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/os/osString.h b/include/os/osString.h index 995aa4a59138..09a697d834be 100644 --- a/include/os/osString.h +++ b/include/os/osString.h @@ -22,7 +22,7 @@ extern "C" { typedef wchar_t TdWchar; typedef int32_t TdUcs4; -#if !defined(DISALLOW_NCHAR_WITHOUT_ICONV) && defined(DARWIN) +#ifndef DISALLOW_NCHAR_WITHOUT_ICONV #include "iconv.h" #else typedef void *iconv_t; From 296b2a7b8e9f586ed509f5f54b1b16d291274ac6 Mon Sep 17 00:00:00 2001 From: xsren <285808407@qq.com> Date: Mon, 4 Nov 2024 12:56:12 +0800 Subject: [PATCH 600/695] cfg: enableAuditDelete --- source/client/inc/clientInt.h | 6 +++++- source/client/src/clientEnv.c | 20 ++++++++++---------- source/client/src/clientHb.c | 3 ++- source/client/src/clientMonitor.c | 20 +++++++++++++++----- source/client/src/clientMsgHandler.c | 3 ++- source/client/src/clientSml.c | 2 +- 6 files changed, 35 insertions(+), 19 deletions(-) diff --git a/source/client/inc/clientInt.h b/source/client/inc/clientInt.h index 114bc00125d8..7aefdf54354c 100644 --- a/source/client/inc/clientInt.h +++ b/source/client/inc/clientInt.h @@ -108,6 +108,10 @@ typedef struct SQueryExecMetric { int64_t execCostUs; } SQueryExecMetric; +typedef struct { + SMonitorParas monitorParas; + int8_t enableAuditDelete; +} SAppInstServerCFG; struct SAppInstInfo { int64_t numOfConns; SCorEpSet mgmtEp; @@ -121,7 +125,7 @@ struct SAppInstInfo { void* pTransporter; SAppHbMgr* pAppHbMgr; char* instKey; - SMonitorParas monitorParas; + SAppInstServerCFG serverCfg; }; typedef struct SAppInfo { diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c index f892575f0a26..d759abe2938c 100644 --- a/source/client/src/clientEnv.c +++ b/source/client/src/clientEnv.c @@ -166,11 +166,11 @@ static int32_t generateWriteSlowLog(STscObj *pTscObj, SRequestObj *pRequest, int ENV_JSON_FALSE_CHECK(cJSON_AddItemToObject(json, "type", cJSON_CreateNumber(reqType))); ENV_JSON_FALSE_CHECK(cJSON_AddItemToObject( json, "rows_num", cJSON_CreateNumber(pRequest->body.resInfo.numOfRows + pRequest->body.resInfo.totalRows))); - if (pRequest->sqlstr != NULL && strlen(pRequest->sqlstr) > pTscObj->pAppInfo->monitorParas.tsSlowLogMaxLen) { - char tmp = pRequest->sqlstr[pTscObj->pAppInfo->monitorParas.tsSlowLogMaxLen]; - pRequest->sqlstr[pTscObj->pAppInfo->monitorParas.tsSlowLogMaxLen] = '\0'; + if (pRequest->sqlstr != NULL && strlen(pRequest->sqlstr) > pTscObj->pAppInfo->serverCfg.monitorParas.tsSlowLogMaxLen) { + char tmp = pRequest->sqlstr[pTscObj->pAppInfo->serverCfg.monitorParas.tsSlowLogMaxLen]; + pRequest->sqlstr[pTscObj->pAppInfo->serverCfg.monitorParas.tsSlowLogMaxLen] = '\0'; ENV_JSON_FALSE_CHECK(cJSON_AddItemToObject(json, "sql", cJSON_CreateString(pRequest->sqlstr))); - pRequest->sqlstr[pTscObj->pAppInfo->monitorParas.tsSlowLogMaxLen] = tmp; + pRequest->sqlstr[pTscObj->pAppInfo->serverCfg.monitorParas.tsSlowLogMaxLen] = tmp; } else { ENV_JSON_FALSE_CHECK(cJSON_AddItemToObject(json, "sql", cJSON_CreateString(pRequest->sqlstr))); } @@ -284,7 +284,7 @@ static void deregisterRequest(SRequestObj *pRequest) { } } - if (pTscObj->pAppInfo->monitorParas.tsEnableMonitor) { + if (pTscObj->pAppInfo->serverCfg.monitorParas.tsEnableMonitor) { if (QUERY_NODE_VNODE_MODIFY_STMT == pRequest->stmtType || QUERY_NODE_INSERT_STMT == pRequest->stmtType) { sqlReqLog(pTscObj->id, pRequest->killed, pRequest->code, MONITORSQLTYPEINSERT); } else if (QUERY_NODE_SELECT_STMT == pRequest->stmtType) { @@ -294,15 +294,15 @@ static void deregisterRequest(SRequestObj *pRequest) { } } - if ((duration >= pTscObj->pAppInfo->monitorParas.tsSlowLogThreshold * 1000000UL || - duration >= pTscObj->pAppInfo->monitorParas.tsSlowLogThresholdTest * 1000000UL) && - checkSlowLogExceptDb(pRequest, pTscObj->pAppInfo->monitorParas.tsSlowLogExceptDb)) { + if ((duration >= pTscObj->pAppInfo->serverCfg.monitorParas.tsSlowLogThreshold * 1000000UL || + duration >= pTscObj->pAppInfo->serverCfg.monitorParas.tsSlowLogThresholdTest * 1000000UL) && + checkSlowLogExceptDb(pRequest, pTscObj->pAppInfo->serverCfg.monitorParas.tsSlowLogExceptDb)) { (void)atomic_add_fetch_64((int64_t *)&pActivity->numOfSlowQueries, 1); - if (pTscObj->pAppInfo->monitorParas.tsSlowLogScope & reqType) { + if (pTscObj->pAppInfo->serverCfg.monitorParas.tsSlowLogScope & reqType) { taosPrintSlowLog("PID:%d, Conn:%u,QID:0x%" PRIx64 ", Start:%" PRId64 " us, Duration:%" PRId64 "us, SQL:%s", taosGetPId(), pTscObj->connId, pRequest->requestId, pRequest->metric.start, duration, pRequest->sqlstr); - if (pTscObj->pAppInfo->monitorParas.tsEnableMonitor) { + if (pTscObj->pAppInfo->serverCfg.monitorParas.tsEnableMonitor) { slowQueryLog(pTscObj->id, pRequest->killed, pRequest->code, duration); if (TSDB_CODE_SUCCESS != generateWriteSlowLog(pTscObj, pRequest, reqType, duration)) { tscError("failed to generate write slow log"); diff --git a/source/client/src/clientHb.c b/source/client/src/clientHb.c index 75716d0bd220..07be4bb59625 100644 --- a/source/client/src/clientHb.c +++ b/source/client/src/clientHb.c @@ -605,7 +605,8 @@ static int32_t hbAsyncCallBack(void *param, SDataBuf *pMsg, int32_t code) { return code; } - pInst->monitorParas = pRsp.monitorParas; + pInst->serverCfg.monitorParas = pRsp.monitorParas; + pInst->serverCfg.enableAuditDelete = pRsp.enableAuditDelete; tscDebug("[monitor] paras from hb, clusterId:%" PRIx64 " monitorParas threshold:%d scope:%d", pInst->clusterId, pRsp.monitorParas.tsSlowLogThreshold, pRsp.monitorParas.tsSlowLogScope); diff --git a/source/client/src/clientMonitor.c b/source/client/src/clientMonitor.c index 3b19e070b8f6..901f4ceef845 100644 --- a/source/client/src/clientMonitor.c +++ b/source/client/src/clientMonitor.c @@ -215,7 +215,7 @@ static void reportSendProcess(void* param, void* tmrId) { SEpSet ep = getEpSet_s(&pInst->mgmtEp); generateClusterReport(pMonitor->registry, pInst->pTransporter, &ep); bool reset = - taosTmrReset(reportSendProcess, pInst->monitorParas.tsMonitorInterval * 1000, param, monitorTimer, &tmrId); + taosTmrReset(reportSendProcess, pInst->serverCfg.monitorParas.tsMonitorInterval * 1000, param, monitorTimer, &tmrId); tscDebug("reset timer, pMonitor:%p, %d", pMonitor, reset); taosRUnLockLatch(&monitorLock); } @@ -288,7 +288,7 @@ void monitorCreateClient(int64_t clusterId) { goto fail; } pMonitor->timer = - taosTmrStart(reportSendProcess, pInst->monitorParas.tsMonitorInterval * 1000, (void*)pMonitor, monitorTimer); + taosTmrStart(reportSendProcess, pInst->serverCfg.monitorParas.tsMonitorInterval * 1000, (void*)pMonitor, monitorTimer); if (pMonitor->timer == NULL) { tscError("failed to start timer"); goto fail; @@ -659,7 +659,7 @@ static void monitorSendAllSlowLog() { taosHashCancelIterate(monitorSlowLogHash, pIter); return; } - if (t - pClient->lastCheckTime > pInst->monitorParas.tsMonitorInterval * 1000) { + if (t - pClient->lastCheckTime > pInst->serverCfg.monitorParas.tsMonitorInterval * 1000) { pClient->lastCheckTime = t; } else { continue; @@ -685,7 +685,7 @@ static void monitorSendAllSlowLog() { static void monitorSendAllSlowLogFromTempDir(int64_t clusterId) { SAppInstInfo* pInst = getAppInstByClusterId((int64_t)clusterId); - if (pInst == NULL || !pInst->monitorParas.tsEnableMonitor) { + if (pInst == NULL || !pInst->serverCfg.monitorParas.tsEnableMonitor) { tscInfo("[monitor] monitor is disabled, skip send slow log"); return; } @@ -970,6 +970,16 @@ static void reportDeleteSql(SRequestObj* pRequest) { SDeleteStmt* pStmt = (SDeleteStmt*)pRequest->pQuery->pRoot; STscObj* pTscObj = pRequest->pTscObj; + if (pTscObj == NULL || pTscObj->pAppInfo == NULL) { + tscError("[del report]invalid tsc obj"); + return; + } + + if(pTscObj->pAppInfo->serverCfg.enableAuditDelete == 0) { + tscDebug("[del report]audit delete is disabled"); + return; + } + if (pRequest->code != TSDB_CODE_SUCCESS) { tscDebug("[del report]delete request result code:%d", pRequest->code); return; @@ -1015,7 +1025,7 @@ void clientOperateReport(SRequestObj* pRequest) { return; } - if (tsEnableAuditDelete && QUERY_NODE_DELETE_STMT == nodeType(pRequest->pQuery->pRoot)) { + if (QUERY_NODE_DELETE_STMT == nodeType(pRequest->pQuery->pRoot)) { reportDeleteSql(pRequest); } } diff --git a/source/client/src/clientMsgHandler.c b/source/client/src/clientMsgHandler.c index aef3cef1c5d0..34007c2be733 100644 --- a/source/client/src/clientMsgHandler.c +++ b/source/client/src/clientMsgHandler.c @@ -135,7 +135,8 @@ int32_t processConnectRsp(void* param, SDataBuf* pMsg, int32_t code) { // update the appInstInfo pTscObj->pAppInfo->clusterId = connectRsp.clusterId; - pTscObj->pAppInfo->monitorParas = connectRsp.monitorParas; + pTscObj->pAppInfo->serverCfg.monitorParas = connectRsp.monitorParas; + pTscObj->pAppInfo->serverCfg.enableAuditDelete = connectRsp.enableAuditDelete; tscDebug("[monitor] paras from connect rsp, clusterId:%" PRIx64 " monitorParas threshold:%d scope:%d", connectRsp.clusterId, connectRsp.monitorParas.tsSlowLogThreshold, connectRsp.monitorParas.tsSlowLogScope); lastClusterId = connectRsp.clusterId; diff --git a/source/client/src/clientSml.c b/source/client/src/clientSml.c index e8221c8b8d59..0f649f99ffc3 100644 --- a/source/client/src/clientSml.c +++ b/source/client/src/clientSml.c @@ -1695,7 +1695,7 @@ static int smlProcess(SSmlHandle *info, char *lines[], char *rawLine, char *rawL } void smlSetReqSQL(SRequestObj *request, char *lines[], char *rawLine, char *rawLineEnd) { - if (request->pTscObj->pAppInfo->monitorParas.tsSlowLogScope & SLOW_LOG_TYPE_INSERT) { + if (request->pTscObj->pAppInfo->serverCfg.monitorParas.tsSlowLogScope & SLOW_LOG_TYPE_INSERT) { int32_t len = 0; int32_t rlen = 0; char *p = NULL; From 9221bfb51e559cf5ab74d566df3131db5617ec7a Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Mon, 4 Nov 2024 13:18:11 +0800 Subject: [PATCH 601/695] handle mem leak failure --- source/client/src/clientImpl.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index 8d867455663c..0473a025f9d8 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -1770,7 +1770,7 @@ void updateTargetEpSet(SMsgSendInfo* pSendInfo, STscObj* pTscObj, SRpcMsg* pMsg, } } -int32_t doProcessMsFromServerImpl(SRpcMsg* pMsg, SEpSet* pEpSet) { +int32_t doProcessMsgFromServerImpl(SRpcMsg* pMsg, SEpSet* pEpSet) { SMsgSendInfo* pSendInfo = (SMsgSendInfo*)pMsg->info.ahandle; if (pMsg->info.ahandle == NULL) { tscError("doProcessMsgFromServer pMsg->info.ahandle == NULL"); @@ -1843,7 +1843,7 @@ int32_t doProcessMsFromServerImpl(SRpcMsg* pMsg, SEpSet* pEpSet) { } int32_t doProcessMsgFromServer(void* param) { AsyncArg* arg = (AsyncArg*)param; - int32_t code = doProcessMsFromServerImpl(&arg->msg, arg->pEpset); + int32_t code = doProcessMsgFromServerImpl(&arg->msg, arg->pEpset); taosMemoryFree(arg); return code; } @@ -1881,7 +1881,6 @@ void processMsgFromServer(void* parent, SRpcMsg* pMsg, SEpSet* pEpSet) { code = terrno; pMsg->code = code; goto _exit; - return; } arg->msg = *pMsg; @@ -1897,7 +1896,7 @@ void processMsgFromServer(void* parent, SRpcMsg* pMsg, SEpSet* pEpSet) { return; _exit: tscError("failed to sched msg to tsc since %s", tstrerror(code)); - code = doProcessMsFromServerImpl(pMsg, tEpSet); + code = doProcessMsgFromServerImpl(pMsg, tEpSet); if (code != 0) { tscError("failed to sched msg to tsc, tsc ready quit"); } From 44958e3c76765f894746123fd9c20cd8a45e48a0 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Mon, 4 Nov 2024 13:21:15 +0800 Subject: [PATCH 602/695] handle mem leak failure --- source/client/src/clientImpl.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index 0473a025f9d8..e2f9b4a85cd9 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -1886,12 +1886,9 @@ void processMsgFromServer(void* parent, SRpcMsg* pMsg, SEpSet* pEpSet) { arg->msg = *pMsg; arg->pEpset = tEpSet; - if (0 != taosAsyncExec(doProcessMsgFromServer, arg, NULL)) { - tscError("failed to sched msg to tsc, tsc ready to quit"); - rpcFreeCont(pMsg->pCont); - taosMemoryFree(arg->pEpset); - destroySendMsgInfo(pMsg->info.ahandle); + if ((code = taosAsyncExec(doProcessMsgFromServer, arg, NULL)) != 0) { taosMemoryFree(arg); + goto _exit; } return; _exit: From b762aec1613fffce64d1e9e182c085ca53937122 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Mon, 4 Nov 2024 13:37:23 +0800 Subject: [PATCH 603/695] fix: complie errors --- include/os/osString.h | 2 +- source/os/src/osString.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/include/os/osString.h b/include/os/osString.h index 09a697d834be..995aa4a59138 100644 --- a/include/os/osString.h +++ b/include/os/osString.h @@ -22,7 +22,7 @@ extern "C" { typedef wchar_t TdWchar; typedef int32_t TdUcs4; -#ifndef DISALLOW_NCHAR_WITHOUT_ICONV +#if !defined(DISALLOW_NCHAR_WITHOUT_ICONV) && defined(DARWIN) #include "iconv.h" #else typedef void *iconv_t; diff --git a/source/os/src/osString.c b/source/os/src/osString.c index 7960f8436916..18da778227d1 100644 --- a/source/os/src/osString.c +++ b/source/os/src/osString.c @@ -17,6 +17,10 @@ #define _DEFAULT_SOURCE #include "os.h" +#ifndef DISALLOW_NCHAR_WITHOUT_ICONV +#include "iconv.h" +#endif + extern int wcwidth(wchar_t c); extern int wcswidth(const wchar_t *s, size_t n); From 14843014f963e8cac327694813cd20bb51ce2de1 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Mon, 4 Nov 2024 13:57:08 +0800 Subject: [PATCH 604/695] handle mem leak failure --- source/client/src/clientImpl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index e2f9b4a85cd9..30a85d72ad4b 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -1887,6 +1887,7 @@ void processMsgFromServer(void* parent, SRpcMsg* pMsg, SEpSet* pEpSet) { arg->pEpset = tEpSet; if ((code = taosAsyncExec(doProcessMsgFromServer, arg, NULL)) != 0) { + pMsg->code = code; taosMemoryFree(arg); goto _exit; } From 71e27240cb3be095f5e6abf9f7e2d00722cfa7f3 Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Mon, 4 Nov 2024 14:00:27 +0800 Subject: [PATCH 605/695] stream/rocks: fix meta file dir --- source/libs/stream/src/streamBackendRocksdb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/stream/src/streamBackendRocksdb.c b/source/libs/stream/src/streamBackendRocksdb.c index b82d06b6c763..5923efbac971 100644 --- a/source/libs/stream/src/streamBackendRocksdb.c +++ b/source/libs/stream/src/streamBackendRocksdb.c @@ -5065,7 +5065,7 @@ int32_t dbChkpDumpTo(SDbChkp* p, char* dname, SArray* list) { goto _ERROR; } memset(dstBuf, 0, cap); - nBytes = snprintf(dstDir, cap, "%s%s%s", dstDir, TD_DIRSEP, chkpMeta); + nBytes = snprintf(dstBuf, cap, "%s%s%s", dstDir, TD_DIRSEP, chkpMeta); if (nBytes <= 0 || nBytes >= cap) { code = TSDB_CODE_OUT_OF_RANGE; goto _ERROR; From 175a3f7d57b887ab414f4108577fec6e619ad017 Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Mon, 4 Nov 2024 14:22:28 +0800 Subject: [PATCH 606/695] strea/checkpoint: fix meta file path --- source/libs/stream/src/streamBackendRocksdb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/stream/src/streamBackendRocksdb.c b/source/libs/stream/src/streamBackendRocksdb.c index 5923efbac971..b69e19105900 100644 --- a/source/libs/stream/src/streamBackendRocksdb.c +++ b/source/libs/stream/src/streamBackendRocksdb.c @@ -5071,7 +5071,7 @@ int32_t dbChkpDumpTo(SDbChkp* p, char* dname, SArray* list) { goto _ERROR; } - TdFilePtr pFile = taosOpenFile(dstDir, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_TRUNC); + TdFilePtr pFile = taosOpenFile(dstBuf, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_TRUNC); if (pFile == NULL) { code = terrno; stError("chkp failed to create meta file: %s, reason:%s", dstDir, tstrerror(code)); From 02ed4f457dbb8dd1a728a35b22a847381f821055 Mon Sep 17 00:00:00 2001 From: xsren <285808407@qq.com> Date: Mon, 4 Nov 2024 15:03:19 +0800 Subject: [PATCH 607/695] delete sql.c --- source/libs/parser/src/sql.c | 8100 ---------------------------------- 1 file changed, 8100 deletions(-) delete mode 100644 source/libs/parser/src/sql.c diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c deleted file mode 100644 index 5849977a3a2f..000000000000 --- a/source/libs/parser/src/sql.c +++ /dev/null @@ -1,8100 +0,0 @@ -/* -** 2000-05-29 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** Driver template for the LEMON parser generator. -** -** The "lemon" program processes an LALR(1) input grammar file, then uses -** this template to construct a parser. The "lemon" program inserts text -** at each "%%" line. Also, any "P-a-r-s-e" identifer prefix (without the -** interstitial "-" characters) contained in this template is changed into -** the value of the %name directive from the grammar. Otherwise, the content -** of this template is copied straight through into the generate parser -** source file. -** -** The following is the concatenation of all %include directives from the -** input grammar file: -*/ -#include -#include -/************ Begin %include sections from the grammar ************************/ - -#include -#include -#include -#include -#include - -#define ALLOW_FORBID_FUNC - -#include "functionMgt.h" -#include "nodes.h" -#include "parToken.h" -#include "ttokendef.h" -#include "parAst.h" - -#define YYSTACKDEPTH 0 -/**************** End of %include directives **********************************/ -/* These constants specify the various numeric values for terminal symbols -** in a format understandable to "makeheaders". This section is blank unless -** "lemon" is run with the "-m" command-line option. -***************** Begin makeheaders token definitions *************************/ -/**************** End makeheaders token definitions ***************************/ - -/* The next sections is a series of control #defines. -** various aspects of the generated parser. -** YYCODETYPE is the data type used to store the integer codes -** that represent terminal and non-terminal symbols. -** "unsigned char" is used if there are fewer than -** 256 symbols. Larger types otherwise. -** YYNOCODE is a number of type YYCODETYPE that is not used for -** any terminal or nonterminal symbol. -** YYFALLBACK If defined, this indicates that one or more tokens -** (also known as: "terminal symbols") have fall-back -** values which should be used if the original symbol -** would not parse. This permits keywords to sometimes -** be used as identifiers, for example. -** YYACTIONTYPE is the data type used for "action codes" - numbers -** that indicate what to do in response to the next -** token. -** ParseTOKENTYPE is the data type used for minor type for terminal -** symbols. Background: A "minor type" is a semantic -** value associated with a terminal or non-terminal -** symbols. For example, for an "ID" terminal symbol, -** the minor type might be the name of the identifier. -** Each non-terminal can have a different minor type. -** Terminal symbols all have the same minor type, though. -** This macros defines the minor type for terminal -** symbols. -** YYMINORTYPE is the data type used for all minor types. -** This is typically a union of many types, one of -** which is ParseTOKENTYPE. The entry in the union -** for terminal symbols is called "yy0". -** YYSTACKDEPTH is the maximum depth of the parser's stack. If -** zero the stack is dynamically sized using realloc() -** ParseARG_SDECL A static variable declaration for the %extra_argument -** ParseARG_PDECL A parameter declaration for the %extra_argument -** ParseARG_PARAM Code to pass %extra_argument as a subroutine parameter -** ParseARG_STORE Code to store %extra_argument into yypParser -** ParseARG_FETCH Code to extract %extra_argument from yypParser -** ParseCTX_* As ParseARG_ except for %extra_context -** YYERRORSYMBOL is the code number of the error symbol. If not -** defined, then do no error processing. -** YYNSTATE the combined number of states. -** YYNRULE the number of rules in the grammar -** YYNTOKEN Number of terminal symbols -** YY_MAX_SHIFT Maximum value for shift actions -** YY_MIN_SHIFTREDUCE Minimum value for shift-reduce actions -** YY_MAX_SHIFTREDUCE Maximum value for shift-reduce actions -** YY_ERROR_ACTION The yy_action[] code for syntax error -** YY_ACCEPT_ACTION The yy_action[] code for accept -** YY_NO_ACTION The yy_action[] code for no-op -** YY_MIN_REDUCE Minimum value for reduce actions -** YY_MAX_REDUCE Maximum value for reduce actions -*/ -#ifndef INTERFACE -# define INTERFACE 1 -#endif -/************* Begin control #defines *****************************************/ -#define YYCODETYPE unsigned short int -#define YYNOCODE 573 -#define YYACTIONTYPE unsigned short int -#define ParseTOKENTYPE SToken -typedef union { - int yyinit; - ParseTOKENTYPE yy0; - EFillMode yy102; - EOperatorType yy140; - ETrimType yy300; - ENullOrder yy307; - EOrder yy410; - SDataType yy424; - int64_t yy483; - SToken yy557; - bool yy569; - SShowTablesOption yy595; - SAlterOption yy683; - STokenPair yy723; - EShowKind yy741; - EJoinSubType yy744; - EJoinType yy792; - int8_t yy815; - int32_t yy904; - SNodeList* yy946; - SNode* yy974; -} YYMINORTYPE; -#ifndef YYSTACKDEPTH -#define YYSTACKDEPTH 100 -#endif -#define ParseARG_SDECL SAstCreateContext* pCxt ; -#define ParseARG_PDECL , SAstCreateContext* pCxt -#define ParseARG_PARAM ,pCxt -#define ParseARG_FETCH SAstCreateContext* pCxt =yypParser->pCxt ; -#define ParseARG_STORE yypParser->pCxt =pCxt ; -#define ParseCTX_SDECL -#define ParseCTX_PDECL -#define ParseCTX_PARAM -#define ParseCTX_FETCH -#define ParseCTX_STORE -#define YYFALLBACK 1 -#define YYNSTATE 1025 -#define YYNRULE 784 -#define YYNRULE_WITH_ACTION 784 -#define YYNTOKEN 389 -#define YY_MAX_SHIFT 1024 -#define YY_MIN_SHIFTREDUCE 1516 -#define YY_MAX_SHIFTREDUCE 2299 -#define YY_ERROR_ACTION 2300 -#define YY_ACCEPT_ACTION 2301 -#define YY_NO_ACTION 2302 -#define YY_MIN_REDUCE 2303 -#define YY_MAX_REDUCE 3086 -/************* End control #defines *******************************************/ -#define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) - -/* Define the yytestcase() macro to be a no-op if is not already defined -** otherwise. -** -** Applications can choose to define yytestcase() in the %include section -** to a macro that can assist in verifying code coverage. For production -** code the yytestcase() macro should be turned off. But it is useful -** for testing. -*/ -#ifndef yytestcase -# define yytestcase(X) -#endif - - -/* Next are the tables used to determine what action to take based on the -** current state and lookahead token. These tables are used to implement -** functions that take a state number and lookahead value and return an -** action integer. -** -** Suppose the action integer is N. Then the action is determined as -** follows -** -** 0 <= N <= YY_MAX_SHIFT Shift N. That is, push the lookahead -** token onto the stack and goto state N. -** -** N between YY_MIN_SHIFTREDUCE Shift to an arbitrary state then -** and YY_MAX_SHIFTREDUCE reduce by rule N-YY_MIN_SHIFTREDUCE. -** -** N == YY_ERROR_ACTION A syntax error has occurred. -** -** N == YY_ACCEPT_ACTION The parser accepts its input. -** -** N == YY_NO_ACTION No such action. Denotes unused -** slots in the yy_action[] table. -** -** N between YY_MIN_REDUCE Reduce by rule N-YY_MIN_REDUCE -** and YY_MAX_REDUCE -** -** The action table is constructed as a single large table named yy_action[]. -** Given state S and lookahead X, the action is computed as either: -** -** (A) N = yy_action[ yy_shift_ofst[S] + X ] -** (B) N = yy_default[S] -** -** The (A) formula is preferred. The B formula is used instead if -** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X. -** -** The formulas above are for computing the action when the lookahead is -** a terminal symbol. If the lookahead is a non-terminal (as occurs after -** a reduce action) then the yy_reduce_ofst[] array is used in place of -** the yy_shift_ofst[] array. -** -** The following are the tables generated in this section: -** -** yy_action[] A single table containing all actions. -** yy_lookahead[] A table containing the lookahead for each entry in -** yy_action. Used to detect hash collisions. -** yy_shift_ofst[] For each state, the offset into yy_action for -** shifting terminals. -** yy_reduce_ofst[] For each state, the offset into yy_action for -** shifting non-terminals after a reduce. -** yy_default[] Default action for each state. -** -*********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (4475) -static const YYACTIONTYPE yy_action[] = { - /* 0 */ 839, 683, 3059, 691, 684, 2351, 684, 2351, 3054, 2577, - /* 10 */ 3054, 2816, 60, 58, 678, 59, 57, 56, 55, 54, - /* 20 */ 506, 2304, 2016, 2521, 915, 2517, 838, 231, 858, 3058, - /* 30 */ 2816, 3055, 840, 3055, 3057, 205, 2014, 332, 2124, 2399, - /* 40 */ 2041, 2820, 151, 2841, 530, 150, 149, 148, 147, 146, - /* 50 */ 145, 144, 143, 142, 914, 851, 170, 466, 854, 389, - /* 60 */ 2820, 53, 52, 220, 680, 59, 57, 56, 55, 54, - /* 70 */ 2303, 2119, 151, 2045, 884, 150, 149, 148, 147, 146, - /* 80 */ 145, 144, 143, 142, 782, 2022, 2041, 2674, 2859, 829, - /* 90 */ 2647, 2822, 2824, 501, 160, 159, 158, 157, 156, 155, - /* 100 */ 154, 153, 152, 688, 2806, 919, 896, 2672, 901, 685, - /* 110 */ 2822, 2825, 1592, 2759, 1591, 1021, 851, 170, 61, 990, - /* 120 */ 989, 988, 987, 536, 919, 986, 985, 175, 980, 979, - /* 130 */ 978, 977, 976, 975, 974, 174, 968, 967, 966, 535, - /* 140 */ 534, 963, 962, 961, 211, 210, 960, 531, 959, 958, - /* 150 */ 957, 2840, 63, 1593, 2891, 2127, 2128, 197, 134, 2842, - /* 160 */ 900, 2844, 2845, 895, 75, 2448, 883, 2892, 919, 2041, - /* 170 */ 802, 772, 1592, 213, 1591, 2954, 2042, 251, 3054, 500, - /* 180 */ 2950, 207, 2962, 850, 75, 162, 849, 766, 166, 770, - /* 190 */ 768, 303, 302, 3054, 2077, 2087, 3060, 231, 198, 232, - /* 200 */ 2315, 3055, 840, 3059, 2126, 2129, 528, 3001, 509, 2570, - /* 210 */ 2572, 838, 231, 1593, 1862, 1863, 3055, 840, 195, 2017, - /* 220 */ 2044, 2015, 824, 107, 914, 9, 882, 2220, 106, 2522, - /* 230 */ 53, 52, 914, 2041, 59, 57, 56, 55, 54, 676, - /* 240 */ 64, 853, 200, 2962, 2963, 2213, 168, 2967, 674, 227, - /* 250 */ 318, 670, 666, 581, 2020, 2021, 2074, 2841, 2076, 2079, - /* 260 */ 2080, 2081, 2082, 2083, 2084, 2085, 2086, 2088, 2089, 2090, - /* 270 */ 892, 885, 894, 914, 917, 916, 881, 2111, 2112, 2113, - /* 280 */ 2114, 2115, 2118, 2120, 2121, 2122, 2123, 2125, 2, 60, - /* 290 */ 58, 2216, 700, 2841, 445, 105, 2039, 506, 75, 2016, - /* 300 */ 458, 118, 2859, 625, 644, 642, 469, 441, 897, 2046, - /* 310 */ 245, 1889, 1890, 2014, 646, 2124, 915, 2517, 2806, 2286, - /* 320 */ 896, 2616, 53, 52, 127, 2074, 59, 57, 56, 55, - /* 330 */ 54, 510, 468, 604, 2599, 648, 236, 220, 2859, 2191, - /* 340 */ 446, 606, 830, 825, 818, 814, 810, 339, 2119, 2674, - /* 350 */ 2154, 884, 584, 785, 2806, 19, 896, 701, 2667, 339, - /* 360 */ 1888, 1891, 2022, 498, 2647, 2840, 2042, 2326, 2891, 2671, - /* 370 */ 901, 63, 436, 2842, 900, 2844, 2845, 895, 893, 339, - /* 380 */ 883, 2892, 919, 874, 2919, 954, 187, 186, 951, 950, - /* 390 */ 949, 184, 1021, 467, 973, 15, 337, 2474, 572, 2044, - /* 400 */ 571, 2840, 2251, 887, 2891, 592, 2674, 2078, 134, 2842, - /* 410 */ 900, 2844, 2845, 895, 886, 2155, 883, 2892, 919, 922, - /* 420 */ 508, 172, 224, 181, 2925, 2954, 2671, 901, 2806, 500, - /* 430 */ 2950, 570, 2127, 2128, 801, 339, 2654, 2633, 2564, 634, - /* 440 */ 633, 631, 630, 629, 624, 623, 622, 621, 450, 590, - /* 450 */ 2643, 611, 610, 609, 608, 607, 601, 600, 599, 267, - /* 460 */ 594, 593, 465, 686, 699, 2359, 585, 1850, 1851, 2075, - /* 470 */ 220, 2077, 2087, 1869, 821, 820, 2249, 2250, 2252, 2253, - /* 480 */ 2254, 2126, 2129, 2974, 2188, 2189, 2190, 2974, 2974, 2974, - /* 490 */ 2974, 2974, 620, 339, 2160, 618, 2017, 2648, 2015, 41, - /* 500 */ 617, 1786, 1787, 882, 247, 53, 52, 619, 616, 59, - /* 510 */ 57, 56, 55, 54, 44, 502, 2149, 2150, 2151, 2152, - /* 520 */ 2153, 2157, 2158, 2159, 79, 2293, 2193, 2194, 2195, 2196, - /* 530 */ 2197, 2020, 2021, 2074, 2841, 2076, 2079, 2080, 2081, 2082, - /* 540 */ 2083, 2084, 2085, 2086, 2088, 2089, 2090, 892, 885, 854, - /* 550 */ 3059, 917, 916, 881, 2111, 2112, 2212, 786, 3054, 2118, - /* 560 */ 2120, 2121, 2122, 2123, 2125, 2, 60, 58, 2841, 2191, - /* 570 */ 2016, 828, 533, 532, 506, 337, 2016, 3058, 73, 2859, - /* 580 */ 2577, 3055, 3056, 897, 2014, 2135, 45, 355, 1747, 799, - /* 590 */ 2014, 2041, 2124, 702, 269, 2806, 2023, 896, 686, 866, - /* 600 */ 2359, 2859, 1561, 1738, 946, 945, 944, 1742, 943, 1744, - /* 610 */ 1745, 942, 939, 2859, 1753, 936, 1755, 1756, 933, 930, - /* 620 */ 927, 1568, 2499, 473, 786, 2119, 195, 2969, 884, 2806, - /* 630 */ 923, 896, 19, 2022, 137, 596, 2643, 2523, 75, 2022, - /* 640 */ 693, 2713, 2840, 526, 2519, 2891, 1563, 1566, 1567, 134, - /* 650 */ 2842, 900, 2844, 2845, 895, 2292, 2966, 883, 2892, 919, - /* 660 */ 915, 2517, 706, 1021, 213, 196, 2954, 725, 724, 1021, - /* 670 */ 500, 2950, 15, 827, 526, 2519, 2840, 915, 2517, 2891, - /* 680 */ 161, 2841, 2045, 135, 2842, 900, 2844, 2845, 895, 731, - /* 690 */ 249, 883, 2892, 919, 487, 2721, 897, 161, 3002, 2489, - /* 700 */ 2954, 56, 55, 54, 2953, 2950, 736, 788, 2713, 2127, - /* 710 */ 2128, 627, 2643, 2974, 2188, 2189, 2190, 2974, 2974, 2974, - /* 720 */ 2974, 2974, 518, 53, 52, 956, 2859, 59, 57, 56, - /* 730 */ 55, 54, 752, 751, 750, 851, 170, 14, 13, 742, - /* 740 */ 167, 746, 2806, 783, 896, 745, 1683, 521, 2077, 2087, - /* 750 */ 744, 749, 480, 479, 2191, 12, 743, 558, 2126, 2129, - /* 760 */ 478, 739, 738, 737, 2969, 2078, 254, 2017, 2022, 2015, - /* 770 */ 2571, 2572, 43, 2017, 1695, 2015, 956, 2045, 53, 52, - /* 780 */ 882, 2026, 59, 57, 56, 55, 54, 2799, 1694, 2840, - /* 790 */ 523, 703, 2891, 2965, 2041, 1685, 199, 2842, 900, 2844, - /* 800 */ 2845, 895, 2020, 2021, 883, 2892, 919, 2301, 2020, 2021, - /* 810 */ 2074, 2841, 2076, 2079, 2080, 2081, 2082, 2083, 2084, 2085, - /* 820 */ 2086, 2088, 2089, 2090, 892, 885, 897, 2075, 917, 916, - /* 830 */ 881, 2111, 2112, 339, 2262, 2325, 2118, 2120, 2121, 2122, - /* 840 */ 2123, 2125, 2, 12, 60, 58, 803, 3012, 851, 170, - /* 850 */ 512, 2661, 506, 704, 2016, 2168, 2859, 947, 226, 1699, - /* 860 */ 1747, 140, 2962, 2963, 919, 168, 2967, 649, 2014, 2969, - /* 870 */ 2124, 117, 2806, 1698, 896, 1738, 946, 945, 944, 1742, - /* 880 */ 943, 1744, 1745, 891, 890, 2577, 1753, 889, 1755, 1756, - /* 890 */ 888, 930, 927, 464, 2324, 562, 2806, 539, 2964, 2188, - /* 900 */ 2189, 2190, 538, 2119, 2575, 1917, 884, 1985, 113, 396, - /* 910 */ 19, 1595, 1596, 915, 2517, 1568, 307, 2022, 2046, 2840, - /* 920 */ 2506, 126, 2891, 564, 560, 638, 135, 2842, 900, 2844, - /* 930 */ 2845, 895, 1984, 68, 883, 2892, 919, 2511, 517, 516, - /* 940 */ 553, 1566, 1567, 2954, 2841, 915, 2517, 1021, 2951, 2508, - /* 950 */ 15, 2800, 651, 234, 802, 2806, 225, 915, 2517, 897, - /* 960 */ 2760, 2361, 3054, 520, 519, 578, 190, 238, 2078, 486, - /* 970 */ 2721, 409, 533, 532, 201, 2962, 2963, 579, 168, 2967, - /* 980 */ 3060, 231, 2030, 512, 839, 3055, 840, 2127, 2128, 2859, - /* 990 */ 407, 89, 3054, 256, 88, 2323, 2023, 919, 2124, 727, - /* 1000 */ 726, 1943, 1944, 470, 2491, 2806, 2504, 896, 447, 2322, - /* 1010 */ 838, 231, 2502, 2046, 512, 3055, 840, 802, 637, 255, - /* 1020 */ 265, 661, 659, 656, 654, 3054, 2077, 2087, 919, 97, - /* 1030 */ 2075, 2119, 635, 3, 53, 52, 2126, 2129, 59, 57, - /* 1040 */ 56, 55, 54, 3060, 231, 2022, 173, 66, 3055, 840, - /* 1050 */ 2321, 2017, 2840, 2015, 113, 2891, 2806, 2507, 882, 134, - /* 1060 */ 2842, 900, 2844, 2845, 895, 2243, 75, 883, 2892, 919, - /* 1070 */ 2806, 748, 747, 471, 3074, 879, 2954, 346, 347, 2244, - /* 1080 */ 500, 2950, 345, 2510, 574, 3058, 2020, 2021, 2074, 573, - /* 1090 */ 2076, 2079, 2080, 2081, 2082, 2083, 2084, 2085, 2086, 2088, - /* 1100 */ 2089, 2090, 892, 885, 970, 76, 917, 916, 881, 2111, - /* 1110 */ 2112, 2806, 984, 982, 2118, 2120, 2121, 2122, 2123, 2125, - /* 1120 */ 2, 60, 58, 2130, 915, 2517, 2320, 2319, 2242, 506, - /* 1130 */ 2318, 2016, 53, 52, 2331, 1014, 59, 57, 56, 55, - /* 1140 */ 54, 802, 306, 2577, 598, 2014, 305, 2124, 2449, 3054, - /* 1150 */ 759, 496, 954, 187, 186, 951, 950, 949, 184, 101, - /* 1160 */ 100, 577, 2575, 846, 244, 773, 2577, 3060, 231, 2488, - /* 1170 */ 2317, 40, 3055, 840, 511, 395, 972, 569, 567, 2031, - /* 1180 */ 2119, 2026, 403, 884, 304, 2575, 2554, 2806, 2806, 444, - /* 1190 */ 2402, 2806, 556, 314, 2022, 552, 548, 544, 541, 570, - /* 1200 */ 2727, 53, 52, 762, 402, 59, 57, 56, 55, 54, - /* 1210 */ 756, 754, 915, 2517, 2034, 2036, 12, 301, 10, 2314, - /* 1220 */ 116, 2841, 2521, 196, 1021, 453, 34, 61, 485, 2577, - /* 1230 */ 774, 2806, 612, 2520, 917, 916, 897, 527, 3009, 185, - /* 1240 */ 915, 2517, 2118, 2120, 2121, 2122, 2123, 2125, 2575, 915, - /* 1250 */ 2517, 53, 52, 915, 2517, 59, 57, 56, 55, 54, - /* 1260 */ 613, 339, 308, 85, 2127, 2128, 2859, 2045, 84, 614, - /* 1270 */ 752, 751, 750, 705, 2041, 2746, 809, 742, 167, 746, - /* 1280 */ 2806, 396, 2806, 745, 896, 915, 2517, 2313, 744, 749, - /* 1290 */ 480, 479, 333, 2312, 743, 915, 2517, 2577, 478, 739, - /* 1300 */ 738, 737, 2386, 2077, 2087, 2512, 915, 2517, 875, 877, - /* 1310 */ 2926, 2926, 2263, 2126, 2129, 309, 2576, 954, 187, 186, - /* 1320 */ 951, 950, 949, 184, 753, 67, 317, 2311, 2017, 2840, - /* 1330 */ 2015, 2156, 2891, 833, 843, 882, 134, 2842, 900, 2844, - /* 1340 */ 2845, 895, 2722, 2316, 883, 2892, 919, 948, 2806, 952, - /* 1350 */ 2568, 3074, 2568, 2954, 2806, 2310, 735, 500, 2950, 2309, - /* 1360 */ 734, 205, 2238, 2020, 2021, 2074, 2841, 2076, 2079, 2080, - /* 1370 */ 2081, 2082, 2083, 2084, 2085, 2086, 2088, 2089, 2090, 892, - /* 1380 */ 885, 897, 2626, 917, 916, 881, 2111, 2112, 2806, 915, - /* 1390 */ 2517, 2118, 2120, 2121, 2122, 2123, 2125, 2, 60, 58, - /* 1400 */ 2841, 915, 2517, 915, 2517, 2202, 506, 2750, 2016, 857, - /* 1410 */ 2161, 2859, 915, 2517, 2308, 897, 2806, 3022, 842, 2307, - /* 1420 */ 2806, 350, 2014, 871, 2124, 171, 588, 2806, 2925, 896, - /* 1430 */ 42, 2306, 357, 53, 52, 915, 2517, 59, 57, 56, - /* 1440 */ 55, 54, 53, 52, 529, 2859, 59, 57, 56, 55, - /* 1450 */ 54, 775, 915, 2517, 195, 908, 1570, 2119, 915, 2517, - /* 1460 */ 884, 2806, 2040, 896, 546, 2522, 953, 915, 2517, 2568, - /* 1470 */ 847, 2022, 909, 2588, 2840, 2806, 3015, 2891, 913, 163, - /* 1480 */ 2806, 413, 2842, 900, 2844, 2845, 895, 385, 32, 883, - /* 1490 */ 2892, 919, 2806, 103, 91, 2492, 294, 296, 2841, 292, - /* 1500 */ 295, 1021, 177, 2046, 61, 2109, 2295, 2296, 2840, 2579, - /* 1510 */ 2075, 2891, 740, 897, 1678, 134, 2842, 900, 2844, 2845, - /* 1520 */ 895, 222, 177, 883, 2892, 919, 298, 2384, 176, 297, - /* 1530 */ 3074, 300, 2954, 812, 299, 1676, 500, 2950, 2375, 741, - /* 1540 */ 185, 2127, 2128, 2859, 2101, 2373, 62, 822, 104, 755, - /* 1550 */ 53, 52, 62, 2232, 59, 57, 56, 55, 54, 2806, - /* 1560 */ 757, 896, 1674, 1679, 14, 13, 880, 760, 53, 52, - /* 1570 */ 364, 363, 59, 57, 56, 55, 54, 2025, 53, 52, - /* 1580 */ 2077, 2087, 59, 57, 56, 55, 54, 325, 1933, 47, - /* 1590 */ 2126, 2129, 53, 52, 214, 344, 59, 57, 56, 55, - /* 1600 */ 54, 90, 62, 366, 365, 2017, 2840, 2015, 1941, 2891, - /* 1610 */ 77, 852, 882, 134, 2842, 900, 2844, 2845, 895, 2236, - /* 1620 */ 62, 883, 2892, 919, 2827, 2024, 856, 165, 2929, 2860, - /* 1630 */ 2954, 632, 2248, 776, 500, 2950, 368, 367, 2247, 844, - /* 1640 */ 2020, 2021, 2074, 62, 2076, 2079, 2080, 2081, 2082, 2083, - /* 1650 */ 2084, 2085, 2086, 2088, 2089, 2090, 892, 885, 62, 2441, - /* 1660 */ 917, 916, 881, 2111, 2112, 62, 90, 647, 2118, 2120, - /* 1670 */ 2121, 2122, 2123, 2125, 2, 60, 58, 2841, 182, 2097, - /* 1680 */ 323, 348, 779, 506, 2440, 2016, 163, 863, 2100, 2099, - /* 1690 */ 185, 2829, 897, 132, 816, 129, 2162, 2352, 46, 2014, - /* 1700 */ 87, 2124, 2367, 2102, 370, 369, 2110, 53, 52, 3005, - /* 1710 */ 39, 59, 57, 56, 55, 54, 372, 371, 1656, 53, - /* 1720 */ 52, 819, 2859, 59, 57, 56, 55, 54, 2841, 2103, - /* 1730 */ 374, 373, 376, 375, 2119, 378, 377, 884, 2806, 802, - /* 1740 */ 896, 925, 2146, 897, 1886, 380, 379, 3054, 2022, 382, - /* 1750 */ 381, 2091, 1876, 384, 383, 1629, 964, 965, 48, 492, - /* 1760 */ 1008, 826, 2028, 183, 360, 3060, 231, 1657, 185, 164, - /* 1770 */ 3055, 840, 912, 2859, 488, 182, 1729, 860, 1021, 1648, - /* 1780 */ 1646, 61, 2652, 555, 2565, 2840, 401, 537, 2891, 2806, - /* 1790 */ 2358, 896, 134, 2842, 900, 2844, 2845, 895, 795, 3006, - /* 1800 */ 883, 2892, 919, 3016, 1630, 834, 835, 3074, 330, 2954, - /* 1810 */ 2027, 338, 335, 500, 2950, 2653, 53, 52, 2127, 2128, - /* 1820 */ 59, 57, 56, 55, 54, 2475, 5, 1760, 540, 545, - /* 1830 */ 2096, 462, 2039, 554, 2049, 566, 2840, 565, 239, 2891, - /* 1840 */ 568, 240, 394, 135, 2842, 900, 2844, 2845, 895, 1768, - /* 1850 */ 242, 883, 2892, 919, 1775, 1773, 1910, 2077, 2087, 582, - /* 1860 */ 2954, 188, 2040, 589, 878, 2950, 253, 2126, 2129, 53, - /* 1870 */ 52, 591, 595, 59, 57, 56, 55, 54, 597, 640, - /* 1880 */ 602, 615, 2017, 626, 2015, 2645, 53, 52, 636, 882, - /* 1890 */ 59, 57, 56, 55, 54, 628, 639, 641, 652, 477, - /* 1900 */ 475, 653, 650, 259, 258, 657, 2047, 655, 658, 262, - /* 1910 */ 660, 662, 4, 681, 682, 689, 2042, 2020, 2021, 2074, - /* 1920 */ 690, 2076, 2079, 2080, 2081, 2082, 2083, 2084, 2085, 2086, - /* 1930 */ 2088, 2089, 2090, 892, 885, 692, 270, 917, 916, 881, - /* 1940 */ 2111, 2112, 694, 787, 109, 2118, 2120, 2121, 2122, 2123, - /* 1950 */ 2125, 2, 60, 58, 273, 2048, 695, 2050, 696, 276, - /* 1960 */ 506, 698, 2016, 2051, 855, 278, 2668, 110, 2052, 111, - /* 1970 */ 112, 49, 2662, 1727, 2841, 730, 2014, 707, 2124, 284, - /* 1980 */ 2098, 287, 474, 472, 114, 733, 732, 763, 764, 897, - /* 1990 */ 2736, 3047, 139, 2505, 291, 439, 2501, 2095, 778, 115, - /* 2000 */ 802, 293, 191, 780, 138, 2841, 735, 310, 3054, 136, - /* 2010 */ 734, 2119, 2043, 178, 884, 2503, 2498, 192, 193, 2859, - /* 2020 */ 897, 802, 397, 2714, 790, 2022, 3060, 231, 791, 3054, - /* 2030 */ 789, 3055, 840, 315, 313, 2806, 2733, 896, 2732, 823, - /* 2040 */ 797, 861, 3021, 794, 3020, 8, 832, 3060, 231, 326, - /* 2050 */ 2859, 806, 3055, 840, 796, 1021, 2841, 2993, 61, 807, - /* 2060 */ 805, 837, 804, 320, 204, 2973, 2806, 328, 896, 324, - /* 2070 */ 322, 897, 327, 2986, 836, 329, 331, 845, 848, 169, - /* 2080 */ 493, 2044, 2840, 2210, 2208, 2891, 217, 340, 179, 134, - /* 2090 */ 2842, 900, 2844, 2845, 895, 2127, 2128, 883, 2892, 919, - /* 2100 */ 3077, 2859, 3053, 398, 3074, 2970, 2954, 859, 334, 2682, - /* 2110 */ 500, 2950, 2681, 898, 1, 2680, 2891, 2806, 497, 896, - /* 2120 */ 135, 2842, 900, 2844, 2845, 895, 864, 872, 883, 2892, - /* 2130 */ 919, 399, 869, 74, 2077, 2087, 865, 2954, 180, 2935, - /* 2140 */ 353, 457, 2950, 904, 2126, 2129, 902, 233, 906, 907, - /* 2150 */ 2798, 2797, 128, 400, 2793, 2518, 2792, 404, 2784, 2017, - /* 2160 */ 358, 2015, 2783, 125, 2840, 387, 882, 2891, 2775, 2774, - /* 2170 */ 921, 134, 2842, 900, 2844, 2845, 895, 1540, 1016, 883, - /* 2180 */ 2892, 919, 2790, 1017, 2789, 2781, 3074, 2780, 2954, 1018, - /* 2190 */ 189, 1013, 500, 2950, 2020, 2021, 2074, 391, 2076, 2079, - /* 2200 */ 2080, 2081, 2082, 2083, 2084, 2085, 2086, 2088, 2089, 2090, - /* 2210 */ 892, 885, 1020, 2769, 917, 916, 881, 2111, 2112, 2768, - /* 2220 */ 2787, 2786, 2118, 2120, 2121, 2122, 2123, 2125, 2, 60, - /* 2230 */ 58, 2778, 2777, 2766, 2765, 390, 2763, 506, 2762, 2016, - /* 2240 */ 2569, 65, 476, 454, 427, 782, 440, 455, 524, 438, - /* 2250 */ 428, 2841, 406, 2014, 408, 2124, 2758, 2757, 2756, 98, - /* 2260 */ 2751, 542, 543, 1967, 1968, 547, 897, 237, 2749, 549, - /* 2270 */ 550, 551, 1966, 2748, 2747, 463, 2745, 557, 2744, 559, - /* 2280 */ 2743, 561, 2742, 563, 1954, 2718, 241, 2717, 2119, 243, - /* 2290 */ 1913, 884, 99, 1912, 2695, 2694, 2859, 2693, 575, 576, - /* 2300 */ 2692, 2691, 2022, 2635, 580, 1849, 2632, 583, 2631, 2625, - /* 2310 */ 2622, 586, 2806, 246, 896, 248, 102, 2620, 587, 2621, - /* 2320 */ 2619, 2624, 2623, 2618, 2617, 2615, 2614, 449, 448, 2613, - /* 2330 */ 2612, 2610, 1021, 2841, 603, 15, 250, 513, 605, 2609, - /* 2340 */ 2608, 2607, 2606, 2630, 2605, 2604, 2603, 2628, 897, 2611, - /* 2350 */ 2602, 522, 2601, 2124, 2600, 2598, 2597, 2596, 2595, 2840, - /* 2360 */ 2594, 2593, 2891, 252, 2592, 108, 134, 2842, 900, 2844, - /* 2370 */ 2845, 895, 2127, 2128, 883, 2892, 919, 2591, 2859, 257, - /* 2380 */ 2582, 2927, 2590, 2954, 2589, 2587, 2119, 500, 2950, 2586, - /* 2390 */ 2660, 2629, 2627, 2585, 2806, 2584, 896, 1855, 2583, 643, - /* 2400 */ 2581, 645, 2580, 2578, 2406, 1696, 260, 2405, 1700, 261, - /* 2410 */ 1692, 2077, 2087, 2404, 451, 452, 2403, 2401, 2398, 263, - /* 2420 */ 665, 2126, 2129, 663, 264, 664, 2397, 668, 2390, 672, - /* 2430 */ 667, 2377, 669, 671, 2365, 675, 2017, 677, 2015, 2364, - /* 2440 */ 673, 2840, 679, 882, 2891, 2347, 1569, 212, 134, 2842, - /* 2450 */ 900, 2844, 2845, 895, 94, 266, 883, 2892, 919, 2346, - /* 2460 */ 2826, 2716, 223, 876, 268, 2954, 687, 95, 2712, 500, - /* 2470 */ 2950, 2020, 2021, 2074, 2702, 2076, 2079, 2080, 2081, 2082, - /* 2480 */ 2083, 2084, 2085, 2086, 2088, 2089, 2090, 892, 885, 784, - /* 2490 */ 2690, 917, 916, 881, 2111, 2112, 275, 2689, 277, 2118, - /* 2500 */ 2120, 2121, 2122, 2123, 2125, 2, 280, 1024, 2666, 282, - /* 2510 */ 2659, 2493, 1622, 2400, 2396, 2841, 708, 709, 2394, 710, - /* 2520 */ 712, 713, 714, 2392, 717, 716, 393, 718, 2389, 720, - /* 2530 */ 897, 722, 2372, 721, 2007, 2370, 1983, 2371, 2369, 2366, - /* 2540 */ 728, 1012, 1010, 2343, 2495, 221, 1779, 290, 86, 2494, - /* 2550 */ 2387, 1780, 1682, 1681, 1006, 1002, 998, 994, 1680, 388, - /* 2560 */ 2859, 1677, 1675, 1673, 981, 1672, 983, 515, 514, 2008, - /* 2570 */ 1671, 2385, 1670, 481, 1664, 482, 2806, 1669, 896, 2376, - /* 2580 */ 483, 1666, 1665, 1663, 2374, 484, 2342, 2341, 2340, 917, - /* 2590 */ 916, 761, 765, 2339, 2338, 767, 769, 2118, 2120, 2121, - /* 2600 */ 2122, 2123, 2125, 2337, 771, 133, 1948, 758, 1950, 141, - /* 2610 */ 361, 1947, 2715, 1952, 33, 312, 80, 2711, 69, 1919, - /* 2620 */ 1921, 2841, 2701, 2840, 792, 70, 2891, 1923, 2688, 316, - /* 2630 */ 202, 2842, 900, 2844, 2845, 895, 897, 1938, 883, 2892, - /* 2640 */ 919, 867, 793, 2687, 2841, 1898, 798, 194, 800, 1897, - /* 2650 */ 3059, 22, 17, 808, 25, 781, 811, 489, 35, 897, - /* 2660 */ 6, 2265, 7, 23, 228, 24, 2859, 216, 38, 229, - /* 2670 */ 2827, 78, 319, 2205, 26, 2280, 2239, 18, 2279, 36, - /* 2680 */ 817, 2237, 2806, 813, 896, 815, 359, 494, 873, 2859, - /* 2690 */ 2203, 342, 841, 3075, 2284, 321, 341, 2246, 203, 215, - /* 2700 */ 2283, 495, 72, 37, 336, 2806, 503, 896, 208, 2231, - /* 2710 */ 96, 2686, 2665, 2664, 2201, 311, 2285, 230, 120, 2286, - /* 2720 */ 2841, 121, 351, 2185, 2658, 2184, 343, 119, 122, 2840, - /* 2730 */ 2241, 27, 2891, 218, 349, 897, 437, 2842, 900, 2844, - /* 2740 */ 2845, 895, 82, 71, 883, 2892, 919, 11, 868, 13, - /* 2750 */ 2032, 209, 2840, 2147, 219, 2891, 352, 2067, 21, 199, - /* 2760 */ 2842, 900, 2844, 2845, 895, 2859, 862, 883, 2892, 919, - /* 2770 */ 2137, 2841, 870, 28, 29, 354, 2657, 2136, 2094, 2490, - /* 2780 */ 20, 2806, 2093, 896, 50, 932, 897, 123, 935, 938, - /* 2790 */ 941, 51, 910, 362, 2092, 2059, 16, 30, 31, 83, - /* 2800 */ 905, 903, 2106, 356, 2841, 490, 124, 129, 2299, 92, - /* 2810 */ 3013, 911, 2904, 2903, 918, 81, 2859, 924, 920, 897, - /* 2820 */ 1761, 525, 926, 386, 1758, 928, 929, 931, 2840, 1757, - /* 2830 */ 934, 2891, 2806, 1754, 896, 437, 2842, 900, 2844, 2845, - /* 2840 */ 895, 1748, 937, 883, 2892, 919, 2298, 940, 899, 2859, - /* 2850 */ 1746, 130, 131, 1774, 93, 1752, 491, 1751, 1750, 1749, - /* 2860 */ 1770, 1620, 955, 1660, 1659, 2806, 1658, 896, 1655, 2841, - /* 2870 */ 1652, 1651, 1650, 1649, 969, 1647, 1645, 1690, 1644, 2840, - /* 2880 */ 1643, 1689, 2891, 971, 897, 235, 437, 2842, 900, 2844, - /* 2890 */ 2845, 895, 2841, 1641, 883, 2892, 919, 1640, 1639, 1638, - /* 2900 */ 1637, 1636, 1635, 1686, 1684, 1632, 1631, 894, 1628, 1627, - /* 2910 */ 1626, 1625, 2840, 992, 2859, 2891, 2395, 991, 993, 430, - /* 2920 */ 2842, 900, 2844, 2845, 895, 2393, 995, 883, 2892, 919, - /* 2930 */ 2806, 997, 896, 996, 2391, 999, 1000, 2859, 1001, 2388, - /* 2940 */ 1003, 1004, 1005, 2368, 1007, 2363, 1009, 2362, 1011, 2336, - /* 2950 */ 1558, 1541, 1015, 2806, 1546, 896, 1548, 392, 1019, 1022, - /* 2960 */ 2841, 2302, 2018, 405, 1023, 2302, 2302, 2302, 2302, 2302, - /* 2970 */ 2302, 2302, 2302, 831, 2302, 897, 2302, 2840, 2302, 2302, - /* 2980 */ 2891, 2302, 2302, 2302, 202, 2842, 900, 2844, 2845, 895, - /* 2990 */ 2302, 2302, 883, 2892, 919, 2302, 2302, 2302, 2302, 2302, - /* 3000 */ 2840, 2302, 2302, 2891, 2302, 2859, 2302, 436, 2842, 900, - /* 3010 */ 2844, 2845, 895, 2302, 2302, 883, 2892, 919, 2302, 2920, - /* 3020 */ 2302, 2806, 2302, 896, 2302, 2841, 2302, 289, 2302, 2302, - /* 3030 */ 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, - /* 3040 */ 897, 2302, 2302, 729, 2302, 504, 206, 3076, 2302, 2302, - /* 3050 */ 2302, 2302, 2841, 2302, 2302, 723, 719, 715, 711, 2302, - /* 3060 */ 288, 2302, 2302, 2302, 2302, 2302, 2302, 897, 2840, 2302, - /* 3070 */ 2859, 2891, 2302, 2302, 2302, 437, 2842, 900, 2844, 2845, - /* 3080 */ 895, 2302, 2302, 883, 2892, 919, 2806, 2302, 896, 2302, - /* 3090 */ 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2859, 2302, 2302, - /* 3100 */ 2302, 2302, 2302, 2302, 2302, 2302, 286, 2302, 2302, 2302, - /* 3110 */ 499, 285, 2302, 2806, 2302, 896, 2302, 2302, 2302, 2302, - /* 3120 */ 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, - /* 3130 */ 2302, 2302, 2302, 2840, 2302, 2302, 2891, 505, 2841, 2302, - /* 3140 */ 422, 2842, 900, 2844, 2845, 895, 2302, 2302, 883, 2892, - /* 3150 */ 919, 2302, 2302, 897, 2302, 2302, 2302, 2302, 2841, 2302, - /* 3160 */ 2840, 2302, 2302, 2891, 2302, 2302, 2302, 437, 2842, 900, - /* 3170 */ 2844, 2845, 895, 897, 2302, 883, 2892, 919, 272, 2841, - /* 3180 */ 2302, 2302, 2302, 2859, 2302, 2302, 2302, 283, 2302, 2302, - /* 3190 */ 2302, 274, 281, 2302, 897, 2302, 2302, 279, 697, 2806, - /* 3200 */ 2302, 896, 2302, 2859, 2302, 2302, 2302, 2302, 2302, 2302, - /* 3210 */ 2302, 2302, 2302, 2302, 2302, 2302, 271, 2302, 2302, 2806, - /* 3220 */ 2302, 896, 2302, 507, 2859, 2302, 2302, 2302, 2302, 2302, - /* 3230 */ 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, - /* 3240 */ 2806, 2302, 896, 2302, 2302, 2302, 2840, 2302, 2302, 2891, - /* 3250 */ 2302, 2302, 2302, 437, 2842, 900, 2844, 2845, 895, 2302, - /* 3260 */ 2302, 883, 2892, 919, 2302, 2302, 2840, 2302, 2302, 2891, - /* 3270 */ 2302, 2302, 2302, 418, 2842, 900, 2844, 2845, 895, 2302, - /* 3280 */ 2302, 883, 2892, 919, 2302, 2841, 2302, 777, 2302, 2302, - /* 3290 */ 2891, 2302, 2302, 2302, 432, 2842, 900, 2844, 2845, 895, - /* 3300 */ 897, 2302, 883, 2892, 919, 2841, 2302, 2302, 2302, 2302, - /* 3310 */ 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, - /* 3320 */ 897, 2302, 2302, 2302, 2302, 2841, 2302, 2302, 2302, 2302, - /* 3330 */ 2859, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, - /* 3340 */ 897, 2302, 2302, 2302, 2302, 2302, 2806, 2302, 896, 2302, - /* 3350 */ 2859, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, - /* 3360 */ 2302, 2302, 2302, 2302, 2302, 2302, 2806, 2302, 896, 2302, - /* 3370 */ 2859, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, - /* 3380 */ 2302, 2302, 2302, 2302, 2302, 2302, 2806, 2302, 896, 2302, - /* 3390 */ 2302, 2302, 2302, 2840, 2302, 2302, 2891, 2302, 2302, 2302, - /* 3400 */ 414, 2842, 900, 2844, 2845, 895, 2302, 2302, 883, 2892, - /* 3410 */ 919, 2302, 2841, 2840, 2302, 2302, 2891, 2302, 2302, 2302, - /* 3420 */ 410, 2842, 900, 2844, 2845, 895, 2302, 897, 883, 2892, - /* 3430 */ 919, 2302, 2302, 2840, 2302, 2302, 2891, 2302, 2841, 2302, - /* 3440 */ 411, 2842, 900, 2844, 2845, 895, 2302, 2302, 883, 2892, - /* 3450 */ 919, 2302, 2302, 897, 2302, 2302, 2302, 2859, 2302, 2302, - /* 3460 */ 2302, 2841, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, - /* 3470 */ 2302, 2302, 2302, 2806, 2302, 896, 897, 2302, 2302, 2302, - /* 3480 */ 2302, 2841, 2302, 2859, 2302, 2302, 2302, 2302, 2302, 2302, - /* 3490 */ 2302, 2302, 2302, 2302, 2302, 2302, 897, 2302, 2302, 2806, - /* 3500 */ 2302, 896, 2302, 2841, 2302, 2302, 2859, 2302, 2302, 2302, - /* 3510 */ 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 897, 2302, - /* 3520 */ 2840, 2302, 2806, 2891, 896, 2302, 2859, 415, 2842, 900, - /* 3530 */ 2844, 2845, 895, 2302, 2302, 883, 2892, 919, 2302, 2302, - /* 3540 */ 2302, 2302, 2806, 2302, 896, 2302, 2840, 2302, 2859, 2891, - /* 3550 */ 2302, 2302, 2302, 429, 2842, 900, 2844, 2845, 895, 2302, - /* 3560 */ 2302, 883, 2892, 919, 2806, 2302, 896, 2302, 2841, 2840, - /* 3570 */ 2302, 2302, 2891, 2302, 2302, 2302, 416, 2842, 900, 2844, - /* 3580 */ 2845, 895, 2302, 897, 883, 2892, 919, 2841, 2302, 2840, - /* 3590 */ 2302, 2302, 2891, 2302, 2302, 2302, 417, 2842, 900, 2844, - /* 3600 */ 2845, 895, 897, 2302, 883, 2892, 919, 2302, 2302, 2841, - /* 3610 */ 2302, 2840, 2302, 2859, 2891, 2302, 2302, 2302, 433, 2842, - /* 3620 */ 900, 2844, 2845, 895, 897, 2302, 883, 2892, 919, 2806, - /* 3630 */ 2302, 896, 2859, 2302, 2302, 2302, 2302, 2302, 2302, 2302, - /* 3640 */ 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2806, 2302, - /* 3650 */ 896, 2302, 2302, 2302, 2859, 2302, 2302, 2302, 2302, 2302, - /* 3660 */ 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, - /* 3670 */ 2806, 2302, 896, 2302, 2841, 2302, 2840, 2302, 2302, 2891, - /* 3680 */ 2302, 2302, 2302, 419, 2842, 900, 2844, 2845, 895, 897, - /* 3690 */ 2302, 883, 2892, 919, 2302, 2840, 2302, 2302, 2891, 2302, - /* 3700 */ 2302, 2302, 434, 2842, 900, 2844, 2845, 895, 2302, 2302, - /* 3710 */ 883, 2892, 919, 2302, 2302, 2302, 2302, 2840, 2302, 2859, - /* 3720 */ 2891, 2302, 2302, 2841, 420, 2842, 900, 2844, 2845, 895, - /* 3730 */ 2302, 2302, 883, 2892, 919, 2806, 2302, 896, 897, 2302, - /* 3740 */ 2302, 2302, 2302, 2841, 2302, 2302, 2302, 2302, 2302, 2302, - /* 3750 */ 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 897, 2302, - /* 3760 */ 2302, 2302, 2302, 2841, 2302, 2302, 2302, 2302, 2859, 2302, - /* 3770 */ 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 897, 2302, - /* 3780 */ 2302, 2302, 2840, 2302, 2806, 2891, 896, 2302, 2859, 435, - /* 3790 */ 2842, 900, 2844, 2845, 895, 2302, 2302, 883, 2892, 919, - /* 3800 */ 2302, 2302, 2302, 2302, 2806, 2302, 896, 2302, 2859, 2302, - /* 3810 */ 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, - /* 3820 */ 2302, 2302, 2302, 2302, 2806, 2302, 896, 2302, 2302, 2302, - /* 3830 */ 2302, 2840, 2302, 2302, 2891, 2302, 2302, 2302, 421, 2842, - /* 3840 */ 900, 2844, 2845, 895, 2302, 2302, 883, 2892, 919, 2302, - /* 3850 */ 2841, 2840, 2302, 2302, 2891, 2302, 2302, 2302, 412, 2842, - /* 3860 */ 900, 2844, 2845, 895, 2302, 897, 883, 2892, 919, 2841, - /* 3870 */ 2302, 2840, 2302, 2302, 2891, 2302, 2302, 2302, 423, 2842, - /* 3880 */ 900, 2844, 2845, 895, 897, 2302, 883, 2892, 919, 2841, - /* 3890 */ 2302, 2302, 2302, 2302, 2302, 2859, 2302, 2302, 2302, 2302, - /* 3900 */ 2302, 2302, 2302, 2302, 897, 2302, 2302, 2302, 2302, 2302, - /* 3910 */ 2302, 2806, 2302, 896, 2859, 2302, 2302, 2302, 2302, 2302, - /* 3920 */ 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, - /* 3930 */ 2806, 2302, 896, 2302, 2859, 2302, 2302, 2302, 2302, 2302, - /* 3940 */ 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, - /* 3950 */ 2806, 2302, 896, 2302, 2302, 2302, 2841, 2302, 2840, 2302, - /* 3960 */ 2302, 2891, 2302, 2302, 2302, 424, 2842, 900, 2844, 2845, - /* 3970 */ 895, 897, 2302, 883, 2892, 919, 2841, 2840, 2302, 2302, - /* 3980 */ 2891, 2302, 2302, 2302, 425, 2842, 900, 2844, 2845, 895, - /* 3990 */ 2302, 897, 883, 2892, 919, 2841, 2302, 2840, 2302, 2302, - /* 4000 */ 2891, 2859, 2302, 2302, 426, 2842, 900, 2844, 2845, 895, - /* 4010 */ 897, 2302, 883, 2892, 919, 2302, 2302, 2806, 2302, 896, - /* 4020 */ 2302, 2859, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, - /* 4030 */ 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2806, 2302, 896, - /* 4040 */ 2859, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, - /* 4050 */ 2302, 2302, 2302, 2302, 2302, 2302, 2806, 2302, 896, 2302, - /* 4060 */ 2302, 2302, 2302, 2841, 2840, 2302, 2302, 2891, 2302, 2302, - /* 4070 */ 2302, 442, 2842, 900, 2844, 2845, 895, 2302, 897, 883, - /* 4080 */ 2892, 919, 2841, 2302, 2840, 2302, 2302, 2891, 2302, 2302, - /* 4090 */ 2302, 443, 2842, 900, 2844, 2845, 895, 897, 2302, 883, - /* 4100 */ 2892, 919, 2302, 2840, 2302, 2302, 2891, 2302, 2859, 2302, - /* 4110 */ 2853, 2842, 900, 2844, 2845, 895, 2302, 2302, 883, 2892, - /* 4120 */ 919, 2302, 2302, 2302, 2806, 2302, 896, 2859, 2302, 2302, - /* 4130 */ 2302, 2841, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, - /* 4140 */ 2302, 2302, 2302, 2806, 2302, 896, 897, 2302, 2302, 2302, - /* 4150 */ 2302, 2841, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, - /* 4160 */ 2302, 2302, 2302, 2302, 2302, 2302, 897, 2302, 2302, 2302, - /* 4170 */ 2302, 2840, 2302, 2302, 2891, 2302, 2859, 2302, 2852, 2842, - /* 4180 */ 900, 2844, 2845, 895, 2302, 2302, 883, 2892, 919, 2302, - /* 4190 */ 2840, 2302, 2806, 2891, 896, 2302, 2859, 2851, 2842, 900, - /* 4200 */ 2844, 2845, 895, 2302, 2302, 883, 2892, 919, 2302, 2302, - /* 4210 */ 2302, 2302, 2806, 2302, 896, 2302, 2302, 2302, 2302, 2841, - /* 4220 */ 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, - /* 4230 */ 2302, 2302, 2302, 2302, 897, 2302, 2302, 2302, 2302, 2840, - /* 4240 */ 2302, 2302, 2891, 2841, 2302, 2302, 459, 2842, 900, 2844, - /* 4250 */ 2845, 895, 2302, 2302, 883, 2892, 919, 2302, 897, 2840, - /* 4260 */ 2302, 2302, 2891, 2302, 2859, 2302, 460, 2842, 900, 2844, - /* 4270 */ 2845, 895, 2302, 2302, 883, 2892, 919, 2302, 2302, 2302, - /* 4280 */ 2806, 2302, 896, 2302, 2302, 2302, 2302, 2302, 2859, 2302, - /* 4290 */ 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, - /* 4300 */ 2302, 2302, 2302, 2302, 2806, 2302, 896, 2302, 2302, 2302, - /* 4310 */ 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, - /* 4320 */ 2302, 2302, 2302, 2302, 2302, 2841, 2302, 2840, 2302, 2302, - /* 4330 */ 2891, 2302, 2302, 2302, 456, 2842, 900, 2844, 2845, 895, - /* 4340 */ 897, 2302, 883, 2892, 919, 2302, 2302, 2302, 2302, 2841, - /* 4350 */ 2302, 2840, 2302, 2302, 2891, 2302, 2302, 2302, 461, 2842, - /* 4360 */ 900, 2844, 2845, 895, 897, 2302, 883, 2892, 919, 2302, - /* 4370 */ 2859, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, - /* 4380 */ 2302, 2302, 2302, 2302, 2302, 2302, 2806, 2302, 896, 2302, - /* 4390 */ 2302, 2302, 2302, 2302, 2859, 2302, 2302, 2302, 2302, 2302, - /* 4400 */ 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, - /* 4410 */ 2806, 2302, 896, 2302, 2302, 2302, 2302, 2302, 2302, 2302, - /* 4420 */ 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, - /* 4430 */ 2302, 2302, 2302, 898, 2302, 2302, 2891, 2302, 2302, 2302, - /* 4440 */ 432, 2842, 900, 2844, 2845, 895, 2302, 2302, 883, 2892, - /* 4450 */ 919, 2302, 2302, 2302, 2302, 2302, 2302, 2840, 2302, 2302, - /* 4460 */ 2891, 2302, 2302, 2302, 431, 2842, 900, 2844, 2845, 895, - /* 4470 */ 2302, 2302, 883, 2892, 919, -}; -static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 536, 401, 536, 401, 404, 405, 404, 405, 544, 437, - /* 10 */ 544, 423, 12, 13, 4, 12, 13, 14, 15, 16, - /* 20 */ 20, 0, 22, 438, 406, 407, 562, 563, 456, 563, - /* 30 */ 423, 567, 568, 567, 568, 538, 36, 540, 38, 0, - /* 40 */ 20, 453, 21, 392, 426, 24, 25, 26, 27, 28, - /* 50 */ 29, 30, 31, 32, 20, 406, 407, 431, 407, 34, - /* 60 */ 453, 8, 9, 437, 54, 12, 13, 14, 15, 16, - /* 70 */ 0, 71, 21, 20, 74, 24, 25, 26, 27, 28, - /* 80 */ 29, 30, 31, 32, 499, 85, 20, 455, 437, 20, - /* 90 */ 464, 503, 504, 505, 24, 25, 26, 27, 28, 29, - /* 100 */ 30, 31, 32, 14, 453, 517, 455, 475, 476, 20, - /* 110 */ 503, 504, 20, 479, 22, 115, 406, 407, 118, 80, - /* 120 */ 81, 82, 83, 84, 517, 86, 87, 88, 89, 90, - /* 130 */ 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, - /* 140 */ 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, - /* 150 */ 111, 500, 118, 61, 503, 155, 156, 416, 507, 508, - /* 160 */ 509, 510, 511, 512, 118, 424, 515, 516, 517, 20, - /* 170 */ 536, 21, 20, 522, 22, 524, 20, 71, 544, 528, - /* 180 */ 529, 532, 533, 534, 118, 536, 537, 37, 36, 39, - /* 190 */ 40, 41, 42, 544, 194, 195, 562, 563, 391, 548, - /* 200 */ 393, 567, 568, 3, 204, 205, 451, 556, 427, 454, - /* 210 */ 455, 562, 563, 61, 194, 195, 567, 568, 437, 219, - /* 220 */ 20, 221, 199, 117, 20, 44, 226, 14, 122, 448, - /* 230 */ 8, 9, 20, 20, 12, 13, 14, 15, 16, 57, - /* 240 */ 118, 531, 532, 533, 534, 4, 536, 537, 66, 196, - /* 250 */ 71, 69, 70, 406, 254, 255, 256, 392, 258, 259, - /* 260 */ 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, - /* 270 */ 270, 271, 407, 20, 274, 275, 276, 277, 278, 279, - /* 280 */ 280, 281, 282, 283, 284, 285, 286, 287, 288, 12, - /* 290 */ 13, 14, 406, 392, 18, 189, 20, 20, 118, 22, - /* 300 */ 78, 122, 437, 27, 457, 458, 30, 460, 407, 256, - /* 310 */ 463, 155, 156, 36, 38, 38, 406, 407, 453, 119, - /* 320 */ 455, 0, 8, 9, 120, 256, 12, 13, 14, 15, - /* 330 */ 16, 431, 56, 57, 0, 59, 426, 437, 437, 158, - /* 340 */ 64, 65, 319, 320, 321, 322, 323, 313, 71, 455, - /* 350 */ 128, 74, 76, 20, 453, 78, 455, 471, 472, 313, - /* 360 */ 204, 205, 85, 469, 464, 500, 20, 392, 503, 475, - /* 370 */ 476, 118, 507, 508, 509, 510, 511, 512, 513, 313, - /* 380 */ 515, 516, 517, 518, 519, 148, 149, 150, 151, 152, - /* 390 */ 153, 154, 115, 117, 422, 118, 196, 425, 218, 20, - /* 400 */ 220, 500, 254, 438, 503, 129, 455, 194, 507, 508, - /* 410 */ 509, 510, 511, 512, 449, 193, 515, 516, 517, 20, - /* 420 */ 469, 520, 436, 522, 523, 524, 475, 476, 453, 528, - /* 430 */ 529, 251, 155, 156, 52, 313, 160, 161, 452, 163, - /* 440 */ 164, 165, 166, 167, 168, 169, 170, 171, 172, 406, - /* 450 */ 407, 175, 176, 177, 178, 179, 180, 181, 182, 402, - /* 460 */ 184, 185, 186, 406, 20, 408, 190, 191, 192, 256, - /* 470 */ 437, 194, 195, 197, 326, 327, 328, 329, 330, 331, - /* 480 */ 332, 204, 205, 302, 303, 304, 305, 306, 307, 308, - /* 490 */ 309, 310, 158, 313, 272, 174, 219, 464, 221, 2, - /* 500 */ 179, 155, 156, 226, 461, 8, 9, 173, 187, 12, - /* 510 */ 13, 14, 15, 16, 292, 293, 294, 295, 296, 297, - /* 520 */ 298, 299, 300, 301, 4, 211, 306, 307, 308, 309, - /* 530 */ 310, 254, 255, 256, 392, 258, 259, 260, 261, 262, - /* 540 */ 263, 264, 265, 266, 267, 268, 269, 270, 271, 407, - /* 550 */ 536, 274, 275, 276, 277, 278, 315, 406, 544, 282, - /* 560 */ 283, 284, 285, 286, 287, 288, 12, 13, 392, 158, - /* 570 */ 22, 407, 12, 13, 20, 196, 22, 563, 196, 437, - /* 580 */ 437, 567, 568, 407, 36, 14, 525, 526, 115, 207, - /* 590 */ 36, 20, 38, 20, 402, 453, 36, 455, 406, 456, - /* 600 */ 408, 437, 4, 130, 131, 132, 133, 134, 135, 136, - /* 610 */ 137, 138, 139, 437, 141, 142, 143, 144, 145, 146, - /* 620 */ 147, 23, 438, 439, 406, 71, 437, 506, 74, 453, - /* 630 */ 231, 455, 78, 85, 437, 406, 407, 448, 118, 85, - /* 640 */ 489, 490, 500, 446, 447, 503, 48, 49, 50, 507, - /* 650 */ 508, 509, 510, 511, 512, 341, 535, 515, 516, 517, - /* 660 */ 406, 407, 77, 115, 522, 437, 524, 411, 412, 115, - /* 670 */ 528, 529, 118, 509, 446, 447, 500, 406, 407, 503, - /* 680 */ 426, 392, 20, 507, 508, 509, 510, 511, 512, 435, - /* 690 */ 461, 515, 516, 517, 497, 498, 407, 426, 556, 0, - /* 700 */ 524, 14, 15, 16, 528, 529, 435, 489, 490, 155, - /* 710 */ 156, 406, 407, 302, 303, 304, 305, 306, 307, 308, - /* 720 */ 309, 310, 36, 8, 9, 77, 437, 12, 13, 14, - /* 730 */ 15, 16, 80, 81, 82, 406, 407, 1, 2, 87, - /* 740 */ 88, 89, 453, 129, 455, 93, 36, 36, 194, 195, - /* 750 */ 98, 99, 100, 101, 158, 289, 104, 76, 204, 205, - /* 760 */ 108, 109, 110, 111, 506, 194, 461, 219, 85, 221, - /* 770 */ 454, 455, 2, 219, 22, 221, 77, 20, 8, 9, - /* 780 */ 226, 221, 12, 13, 14, 15, 16, 440, 36, 500, - /* 790 */ 443, 406, 503, 535, 20, 85, 507, 508, 509, 510, - /* 800 */ 511, 512, 254, 255, 515, 516, 517, 389, 254, 255, - /* 810 */ 256, 392, 258, 259, 260, 261, 262, 263, 264, 265, - /* 820 */ 266, 267, 268, 269, 270, 271, 407, 256, 274, 275, - /* 830 */ 276, 277, 278, 313, 119, 392, 282, 283, 284, 285, - /* 840 */ 286, 287, 288, 289, 12, 13, 557, 558, 406, 407, - /* 850 */ 503, 466, 20, 468, 22, 119, 437, 129, 196, 22, - /* 860 */ 115, 532, 533, 534, 517, 536, 537, 115, 36, 506, - /* 870 */ 38, 189, 453, 36, 455, 130, 131, 132, 133, 134, - /* 880 */ 135, 136, 137, 138, 139, 437, 141, 142, 143, 144, - /* 890 */ 145, 146, 147, 445, 392, 214, 453, 479, 535, 303, - /* 900 */ 304, 305, 484, 71, 456, 223, 74, 221, 415, 437, - /* 910 */ 78, 62, 63, 406, 407, 23, 149, 85, 256, 500, - /* 920 */ 440, 413, 503, 242, 243, 94, 507, 508, 509, 510, - /* 930 */ 511, 512, 221, 426, 515, 516, 517, 444, 252, 253, - /* 940 */ 44, 49, 50, 524, 392, 406, 407, 115, 529, 441, - /* 950 */ 118, 440, 115, 196, 536, 453, 485, 406, 407, 407, - /* 960 */ 479, 409, 544, 252, 253, 426, 18, 71, 194, 497, - /* 970 */ 498, 23, 12, 13, 532, 533, 534, 426, 536, 537, - /* 980 */ 562, 563, 22, 503, 536, 567, 568, 155, 156, 437, - /* 990 */ 42, 43, 544, 162, 46, 392, 36, 517, 38, 411, - /* 1000 */ 412, 234, 235, 55, 0, 453, 438, 455, 60, 392, - /* 1010 */ 562, 563, 438, 256, 503, 567, 568, 536, 187, 188, - /* 1020 */ 72, 73, 74, 75, 76, 544, 194, 195, 517, 413, - /* 1030 */ 256, 71, 201, 33, 8, 9, 204, 205, 12, 13, - /* 1040 */ 14, 15, 16, 562, 563, 85, 430, 47, 567, 568, - /* 1050 */ 392, 219, 500, 221, 415, 503, 453, 441, 226, 507, - /* 1060 */ 508, 509, 510, 511, 512, 22, 118, 515, 516, 517, - /* 1070 */ 453, 420, 421, 434, 522, 115, 524, 149, 150, 36, - /* 1080 */ 528, 529, 154, 444, 479, 3, 254, 255, 256, 484, - /* 1090 */ 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, - /* 1100 */ 268, 269, 270, 271, 13, 157, 274, 275, 276, 277, - /* 1110 */ 278, 453, 420, 421, 282, 283, 284, 285, 286, 287, - /* 1120 */ 288, 12, 13, 14, 406, 407, 392, 392, 85, 20, - /* 1130 */ 392, 22, 8, 9, 395, 396, 12, 13, 14, 15, - /* 1140 */ 16, 536, 150, 437, 426, 36, 154, 38, 424, 544, - /* 1150 */ 4, 445, 148, 149, 150, 151, 152, 153, 154, 211, - /* 1160 */ 212, 213, 456, 33, 216, 19, 437, 562, 563, 0, - /* 1170 */ 392, 47, 567, 568, 445, 438, 85, 229, 230, 219, - /* 1180 */ 71, 221, 428, 74, 38, 456, 432, 453, 453, 241, - /* 1190 */ 0, 453, 244, 438, 85, 247, 248, 249, 250, 251, - /* 1200 */ 432, 8, 9, 57, 438, 12, 13, 14, 15, 16, - /* 1210 */ 64, 65, 406, 407, 254, 255, 289, 71, 291, 392, - /* 1220 */ 228, 392, 438, 437, 115, 233, 33, 118, 236, 437, - /* 1230 */ 238, 453, 426, 447, 274, 275, 407, 445, 409, 33, - /* 1240 */ 406, 407, 282, 283, 284, 285, 286, 287, 456, 406, - /* 1250 */ 407, 8, 9, 406, 407, 12, 13, 14, 15, 16, - /* 1260 */ 426, 313, 494, 117, 155, 156, 437, 20, 122, 426, - /* 1270 */ 80, 81, 82, 426, 20, 0, 33, 87, 88, 89, - /* 1280 */ 453, 437, 453, 93, 455, 406, 407, 392, 98, 99, - /* 1290 */ 100, 101, 571, 392, 104, 406, 407, 437, 108, 109, - /* 1300 */ 110, 111, 0, 194, 195, 426, 406, 407, 521, 521, - /* 1310 */ 523, 523, 119, 204, 205, 426, 456, 148, 149, 150, - /* 1320 */ 151, 152, 153, 154, 22, 119, 426, 392, 219, 500, - /* 1330 */ 221, 193, 503, 13, 33, 226, 507, 508, 509, 510, - /* 1340 */ 511, 512, 498, 393, 515, 516, 517, 450, 453, 450, - /* 1350 */ 453, 522, 453, 524, 453, 392, 148, 528, 529, 392, - /* 1360 */ 152, 538, 119, 254, 255, 256, 392, 258, 259, 260, - /* 1370 */ 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, - /* 1380 */ 271, 407, 0, 274, 275, 276, 277, 278, 453, 406, - /* 1390 */ 407, 282, 283, 284, 285, 286, 287, 288, 12, 13, - /* 1400 */ 392, 406, 407, 406, 407, 85, 20, 0, 22, 426, - /* 1410 */ 272, 437, 406, 407, 392, 407, 453, 409, 336, 392, - /* 1420 */ 453, 426, 36, 426, 38, 520, 44, 453, 523, 455, - /* 1430 */ 292, 392, 426, 8, 9, 406, 407, 12, 13, 14, - /* 1440 */ 15, 16, 8, 9, 427, 437, 12, 13, 14, 15, - /* 1450 */ 16, 55, 406, 407, 437, 426, 14, 71, 406, 407, - /* 1460 */ 74, 453, 20, 455, 57, 448, 450, 406, 407, 453, - /* 1470 */ 340, 85, 426, 0, 500, 453, 465, 503, 426, 33, - /* 1480 */ 453, 507, 508, 509, 510, 511, 512, 426, 514, 515, - /* 1490 */ 516, 517, 453, 47, 129, 0, 123, 123, 392, 126, - /* 1500 */ 126, 115, 33, 256, 118, 119, 155, 156, 500, 0, - /* 1510 */ 256, 503, 13, 407, 36, 507, 508, 509, 510, 511, - /* 1520 */ 512, 246, 33, 515, 516, 517, 123, 0, 33, 126, - /* 1530 */ 522, 123, 524, 33, 126, 36, 528, 529, 0, 13, - /* 1540 */ 33, 155, 156, 437, 119, 0, 33, 560, 183, 22, - /* 1550 */ 8, 9, 33, 119, 12, 13, 14, 15, 16, 453, - /* 1560 */ 22, 455, 36, 85, 1, 2, 78, 22, 8, 9, - /* 1570 */ 12, 13, 12, 13, 14, 15, 16, 36, 8, 9, - /* 1580 */ 194, 195, 12, 13, 14, 15, 16, 553, 119, 47, - /* 1590 */ 204, 205, 8, 9, 33, 33, 12, 13, 14, 15, - /* 1600 */ 16, 33, 33, 12, 13, 219, 500, 221, 119, 503, - /* 1610 */ 33, 539, 226, 507, 508, 509, 510, 511, 512, 119, - /* 1620 */ 33, 515, 516, 517, 51, 36, 119, 410, 522, 437, - /* 1630 */ 524, 158, 119, 237, 528, 529, 12, 13, 119, 338, - /* 1640 */ 254, 255, 256, 33, 258, 259, 260, 261, 262, 263, - /* 1650 */ 264, 265, 266, 267, 268, 269, 270, 271, 33, 423, - /* 1660 */ 274, 275, 276, 277, 278, 33, 33, 158, 282, 283, - /* 1670 */ 284, 285, 286, 287, 288, 12, 13, 392, 33, 119, - /* 1680 */ 119, 119, 479, 20, 423, 22, 33, 119, 119, 119, - /* 1690 */ 33, 118, 407, 118, 409, 120, 119, 405, 273, 36, - /* 1700 */ 33, 38, 0, 119, 12, 13, 119, 8, 9, 465, - /* 1710 */ 47, 12, 13, 14, 15, 16, 12, 13, 36, 8, - /* 1720 */ 9, 559, 437, 12, 13, 14, 15, 16, 392, 119, - /* 1730 */ 12, 13, 12, 13, 71, 12, 13, 74, 453, 536, - /* 1740 */ 455, 33, 254, 407, 119, 12, 13, 544, 85, 12, - /* 1750 */ 13, 119, 119, 12, 13, 36, 13, 13, 47, 559, - /* 1760 */ 58, 559, 221, 33, 119, 562, 563, 85, 33, 33, - /* 1770 */ 567, 568, 119, 437, 478, 33, 119, 559, 115, 36, - /* 1780 */ 36, 118, 465, 501, 452, 500, 119, 410, 503, 453, - /* 1790 */ 407, 455, 507, 508, 509, 510, 511, 512, 486, 465, - /* 1800 */ 515, 516, 517, 465, 85, 543, 543, 522, 530, 524, - /* 1810 */ 221, 546, 564, 528, 529, 465, 8, 9, 155, 156, - /* 1820 */ 12, 13, 14, 15, 16, 425, 316, 119, 480, 57, - /* 1830 */ 119, 502, 20, 406, 20, 491, 500, 236, 496, 503, - /* 1840 */ 491, 415, 482, 507, 508, 509, 510, 511, 512, 119, - /* 1850 */ 415, 515, 516, 517, 119, 119, 217, 194, 195, 406, - /* 1860 */ 524, 119, 20, 407, 528, 529, 47, 204, 205, 8, - /* 1870 */ 9, 462, 407, 12, 13, 14, 15, 16, 462, 193, - /* 1880 */ 459, 406, 219, 407, 221, 406, 8, 9, 459, 226, - /* 1890 */ 12, 13, 14, 15, 16, 462, 459, 459, 116, 41, - /* 1900 */ 42, 419, 114, 406, 418, 113, 20, 406, 417, 406, - /* 1910 */ 406, 406, 52, 399, 403, 399, 20, 254, 255, 256, - /* 1920 */ 403, 258, 259, 260, 261, 262, 263, 264, 265, 266, - /* 1930 */ 267, 268, 269, 270, 271, 491, 415, 274, 275, 276, - /* 1940 */ 277, 278, 455, 479, 415, 282, 283, 284, 285, 286, - /* 1950 */ 287, 288, 12, 13, 415, 20, 408, 20, 481, 415, - /* 1960 */ 20, 408, 22, 20, 479, 415, 472, 415, 20, 415, - /* 1970 */ 415, 272, 466, 52, 392, 399, 36, 406, 38, 433, - /* 1980 */ 119, 415, 124, 125, 433, 127, 437, 395, 395, 407, - /* 1990 */ 453, 409, 406, 437, 437, 399, 437, 119, 239, 118, - /* 2000 */ 536, 437, 437, 495, 196, 392, 148, 413, 544, 437, - /* 2010 */ 152, 71, 20, 493, 74, 437, 437, 437, 437, 437, - /* 2020 */ 407, 536, 491, 490, 225, 85, 562, 563, 488, 544, - /* 2030 */ 224, 567, 568, 413, 487, 453, 453, 455, 453, 325, - /* 2040 */ 406, 324, 552, 455, 552, 333, 210, 562, 563, 551, - /* 2050 */ 437, 453, 567, 568, 480, 115, 392, 555, 118, 335, - /* 2060 */ 334, 312, 317, 473, 552, 542, 453, 549, 455, 554, - /* 2070 */ 473, 407, 550, 409, 311, 480, 541, 337, 339, 407, - /* 2080 */ 342, 20, 500, 129, 314, 503, 408, 413, 413, 507, - /* 2090 */ 508, 509, 510, 511, 512, 155, 156, 515, 516, 517, - /* 2100 */ 572, 437, 566, 473, 522, 506, 524, 453, 565, 453, - /* 2110 */ 528, 529, 453, 500, 547, 453, 503, 453, 453, 455, - /* 2120 */ 507, 508, 509, 510, 511, 512, 202, 466, 515, 516, - /* 2130 */ 517, 473, 453, 118, 194, 195, 470, 524, 413, 527, - /* 2140 */ 413, 528, 529, 453, 204, 205, 202, 545, 467, 466, - /* 2150 */ 453, 453, 118, 432, 453, 407, 453, 406, 453, 219, - /* 2160 */ 413, 221, 453, 413, 500, 413, 226, 503, 453, 453, - /* 2170 */ 442, 507, 508, 509, 510, 511, 512, 22, 394, 515, - /* 2180 */ 516, 517, 453, 35, 453, 453, 522, 453, 524, 37, - /* 2190 */ 397, 40, 528, 529, 254, 255, 256, 400, 258, 259, - /* 2200 */ 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, - /* 2210 */ 270, 271, 399, 453, 274, 275, 276, 277, 278, 453, - /* 2220 */ 453, 453, 282, 283, 284, 285, 286, 287, 288, 12, - /* 2230 */ 13, 453, 453, 453, 453, 398, 453, 20, 453, 22, - /* 2240 */ 453, 483, 439, 474, 429, 499, 492, 474, 439, 429, - /* 2250 */ 429, 392, 414, 36, 390, 38, 0, 0, 0, 47, - /* 2260 */ 0, 36, 245, 36, 36, 245, 407, 36, 0, 36, - /* 2270 */ 36, 245, 36, 0, 0, 245, 0, 36, 0, 36, - /* 2280 */ 0, 22, 0, 36, 240, 0, 227, 0, 71, 227, - /* 2290 */ 221, 74, 228, 219, 0, 0, 437, 0, 215, 214, - /* 2300 */ 0, 0, 85, 161, 51, 51, 0, 36, 0, 0, - /* 2310 */ 0, 36, 453, 51, 455, 51, 47, 0, 57, 0, - /* 2320 */ 0, 0, 0, 0, 0, 0, 0, 12, 13, 0, - /* 2330 */ 0, 0, 115, 392, 36, 118, 179, 22, 179, 0, - /* 2340 */ 0, 0, 0, 0, 0, 0, 0, 0, 407, 0, - /* 2350 */ 0, 36, 0, 38, 0, 0, 0, 0, 0, 500, - /* 2360 */ 0, 0, 503, 51, 0, 47, 507, 508, 509, 510, - /* 2370 */ 511, 512, 155, 156, 515, 516, 517, 0, 437, 161, - /* 2380 */ 0, 522, 0, 524, 0, 0, 71, 528, 529, 0, - /* 2390 */ 0, 0, 0, 0, 453, 0, 455, 22, 0, 160, - /* 2400 */ 0, 159, 0, 0, 0, 22, 71, 0, 22, 71, - /* 2410 */ 36, 194, 195, 0, 52, 52, 0, 0, 0, 71, - /* 2420 */ 44, 204, 205, 36, 71, 57, 0, 57, 0, 57, - /* 2430 */ 36, 0, 44, 36, 0, 36, 219, 56, 221, 0, - /* 2440 */ 44, 500, 36, 226, 503, 0, 14, 33, 507, 508, - /* 2450 */ 509, 510, 511, 512, 44, 47, 515, 516, 517, 0, - /* 2460 */ 51, 0, 51, 522, 45, 524, 51, 44, 0, 528, - /* 2470 */ 529, 254, 255, 256, 0, 258, 259, 260, 261, 262, - /* 2480 */ 263, 264, 265, 266, 267, 268, 269, 270, 271, 1, - /* 2490 */ 0, 274, 275, 276, 277, 278, 44, 0, 210, 282, - /* 2500 */ 283, 284, 285, 286, 287, 288, 51, 19, 0, 51, - /* 2510 */ 0, 0, 79, 0, 0, 392, 36, 57, 0, 44, - /* 2520 */ 36, 57, 44, 0, 57, 36, 38, 44, 0, 36, - /* 2530 */ 407, 44, 0, 57, 219, 0, 221, 0, 0, 0, - /* 2540 */ 36, 53, 54, 0, 0, 57, 22, 126, 128, 0, - /* 2550 */ 0, 36, 22, 36, 66, 67, 68, 69, 36, 71, - /* 2560 */ 437, 36, 36, 36, 33, 36, 33, 252, 253, 254, - /* 2570 */ 36, 0, 36, 22, 22, 22, 453, 36, 455, 0, - /* 2580 */ 22, 36, 36, 36, 0, 22, 0, 0, 0, 274, - /* 2590 */ 275, 36, 36, 0, 0, 36, 36, 282, 283, 284, - /* 2600 */ 285, 286, 287, 0, 22, 117, 36, 59, 36, 20, - /* 2610 */ 122, 36, 0, 119, 118, 51, 118, 0, 196, 36, - /* 2620 */ 22, 392, 0, 500, 22, 196, 503, 226, 0, 202, - /* 2630 */ 507, 508, 509, 510, 511, 512, 407, 232, 515, 516, - /* 2640 */ 517, 153, 196, 0, 392, 196, 206, 222, 206, 196, - /* 2650 */ 3, 33, 318, 22, 318, 231, 36, 36, 118, 407, - /* 2660 */ 52, 119, 52, 33, 51, 33, 437, 33, 33, 33, - /* 2670 */ 51, 3, 118, 36, 33, 36, 119, 318, 36, 118, - /* 2680 */ 114, 119, 453, 118, 455, 116, 198, 36, 200, 437, - /* 2690 */ 85, 203, 569, 570, 36, 119, 208, 119, 118, 118, - /* 2700 */ 36, 36, 33, 118, 51, 453, 477, 455, 51, 119, - /* 2710 */ 118, 0, 0, 0, 119, 227, 119, 118, 44, 119, - /* 2720 */ 392, 44, 203, 119, 0, 119, 119, 118, 44, 500, - /* 2730 */ 119, 33, 503, 118, 118, 407, 507, 508, 509, 510, - /* 2740 */ 511, 512, 118, 302, 515, 516, 517, 290, 119, 2, - /* 2750 */ 22, 51, 500, 254, 51, 503, 118, 22, 118, 507, - /* 2760 */ 508, 509, 510, 511, 512, 437, 199, 515, 516, 517, - /* 2770 */ 116, 392, 199, 118, 118, 198, 0, 116, 119, 0, - /* 2780 */ 118, 453, 119, 455, 118, 118, 407, 44, 118, 118, - /* 2790 */ 118, 118, 22, 51, 119, 119, 118, 118, 118, 118, - /* 2800 */ 199, 119, 119, 118, 392, 477, 118, 120, 22, 118, - /* 2810 */ 558, 121, 118, 118, 118, 118, 437, 36, 129, 407, - /* 2820 */ 119, 36, 118, 33, 119, 36, 118, 36, 500, 119, - /* 2830 */ 36, 503, 453, 119, 455, 507, 508, 509, 510, 511, - /* 2840 */ 512, 119, 36, 515, 516, 517, 232, 36, 257, 437, - /* 2850 */ 119, 118, 118, 36, 118, 140, 477, 140, 140, 140, - /* 2860 */ 22, 79, 78, 22, 36, 453, 36, 455, 36, 392, - /* 2870 */ 36, 36, 36, 36, 112, 36, 36, 85, 36, 500, - /* 2880 */ 36, 85, 503, 112, 407, 33, 507, 508, 509, 510, - /* 2890 */ 511, 512, 392, 36, 515, 516, 517, 36, 36, 22, - /* 2900 */ 36, 36, 36, 85, 36, 36, 36, 407, 36, 36, - /* 2910 */ 22, 36, 500, 57, 437, 503, 0, 36, 44, 507, - /* 2920 */ 508, 509, 510, 511, 512, 0, 36, 515, 516, 517, - /* 2930 */ 453, 44, 455, 57, 0, 36, 57, 437, 44, 0, - /* 2940 */ 36, 57, 44, 0, 36, 0, 22, 0, 22, 0, - /* 2950 */ 36, 22, 33, 453, 36, 455, 36, 22, 21, 21, - /* 2960 */ 392, 573, 22, 22, 20, 573, 573, 573, 573, 573, - /* 2970 */ 573, 573, 573, 561, 573, 407, 573, 500, 573, 573, - /* 2980 */ 503, 573, 573, 573, 507, 508, 509, 510, 511, 512, - /* 2990 */ 573, 573, 515, 516, 517, 573, 573, 573, 573, 573, - /* 3000 */ 500, 573, 573, 503, 573, 437, 573, 507, 508, 509, - /* 3010 */ 510, 511, 512, 573, 573, 515, 516, 517, 573, 519, - /* 3020 */ 573, 453, 573, 455, 573, 392, 573, 38, 573, 573, - /* 3030 */ 573, 573, 573, 573, 573, 573, 573, 573, 573, 573, - /* 3040 */ 407, 573, 573, 54, 573, 477, 57, 570, 573, 573, - /* 3050 */ 573, 573, 392, 573, 573, 66, 67, 68, 69, 573, - /* 3060 */ 71, 573, 573, 573, 573, 573, 573, 407, 500, 573, - /* 3070 */ 437, 503, 573, 573, 573, 507, 508, 509, 510, 511, - /* 3080 */ 512, 573, 573, 515, 516, 517, 453, 573, 455, 573, - /* 3090 */ 573, 573, 573, 573, 573, 573, 573, 437, 573, 573, - /* 3100 */ 573, 573, 573, 573, 573, 573, 117, 573, 573, 573, - /* 3110 */ 477, 122, 573, 453, 573, 455, 573, 573, 573, 573, - /* 3120 */ 573, 573, 573, 573, 573, 573, 573, 573, 573, 573, - /* 3130 */ 573, 573, 573, 500, 573, 573, 503, 477, 392, 573, - /* 3140 */ 507, 508, 509, 510, 511, 512, 573, 573, 515, 516, - /* 3150 */ 517, 573, 573, 407, 573, 573, 573, 573, 392, 573, - /* 3160 */ 500, 573, 573, 503, 573, 573, 573, 507, 508, 509, - /* 3170 */ 510, 511, 512, 407, 573, 515, 516, 517, 189, 392, - /* 3180 */ 573, 573, 573, 437, 573, 573, 573, 198, 573, 573, - /* 3190 */ 573, 202, 203, 573, 407, 573, 573, 208, 209, 453, - /* 3200 */ 573, 455, 573, 437, 573, 573, 573, 573, 573, 573, - /* 3210 */ 573, 573, 573, 573, 573, 573, 227, 573, 573, 453, - /* 3220 */ 573, 455, 573, 477, 437, 573, 573, 573, 573, 573, - /* 3230 */ 573, 573, 573, 573, 573, 573, 573, 573, 573, 573, - /* 3240 */ 453, 573, 455, 573, 573, 573, 500, 573, 573, 503, - /* 3250 */ 573, 573, 573, 507, 508, 509, 510, 511, 512, 573, - /* 3260 */ 573, 515, 516, 517, 573, 573, 500, 573, 573, 503, - /* 3270 */ 573, 573, 573, 507, 508, 509, 510, 511, 512, 573, - /* 3280 */ 573, 515, 516, 517, 573, 392, 573, 500, 573, 573, - /* 3290 */ 503, 573, 573, 573, 507, 508, 509, 510, 511, 512, - /* 3300 */ 407, 573, 515, 516, 517, 392, 573, 573, 573, 573, - /* 3310 */ 573, 573, 573, 573, 573, 573, 573, 573, 573, 573, - /* 3320 */ 407, 573, 573, 573, 573, 392, 573, 573, 573, 573, - /* 3330 */ 437, 573, 573, 573, 573, 573, 573, 573, 573, 573, - /* 3340 */ 407, 573, 573, 573, 573, 573, 453, 573, 455, 573, - /* 3350 */ 437, 573, 573, 573, 573, 573, 573, 573, 573, 573, - /* 3360 */ 573, 573, 573, 573, 573, 573, 453, 573, 455, 573, - /* 3370 */ 437, 573, 573, 573, 573, 573, 573, 573, 573, 573, - /* 3380 */ 573, 573, 573, 573, 573, 573, 453, 573, 455, 573, - /* 3390 */ 573, 573, 573, 500, 573, 573, 503, 573, 573, 573, - /* 3400 */ 507, 508, 509, 510, 511, 512, 573, 573, 515, 516, - /* 3410 */ 517, 573, 392, 500, 573, 573, 503, 573, 573, 573, - /* 3420 */ 507, 508, 509, 510, 511, 512, 573, 407, 515, 516, - /* 3430 */ 517, 573, 573, 500, 573, 573, 503, 573, 392, 573, - /* 3440 */ 507, 508, 509, 510, 511, 512, 573, 573, 515, 516, - /* 3450 */ 517, 573, 573, 407, 573, 573, 573, 437, 573, 573, - /* 3460 */ 573, 392, 573, 573, 573, 573, 573, 573, 573, 573, - /* 3470 */ 573, 573, 573, 453, 573, 455, 407, 573, 573, 573, - /* 3480 */ 573, 392, 573, 437, 573, 573, 573, 573, 573, 573, - /* 3490 */ 573, 573, 573, 573, 573, 573, 407, 573, 573, 453, - /* 3500 */ 573, 455, 573, 392, 573, 573, 437, 573, 573, 573, - /* 3510 */ 573, 573, 573, 573, 573, 573, 573, 573, 407, 573, - /* 3520 */ 500, 573, 453, 503, 455, 573, 437, 507, 508, 509, - /* 3530 */ 510, 511, 512, 573, 573, 515, 516, 517, 573, 573, - /* 3540 */ 573, 573, 453, 573, 455, 573, 500, 573, 437, 503, - /* 3550 */ 573, 573, 573, 507, 508, 509, 510, 511, 512, 573, - /* 3560 */ 573, 515, 516, 517, 453, 573, 455, 573, 392, 500, - /* 3570 */ 573, 573, 503, 573, 573, 573, 507, 508, 509, 510, - /* 3580 */ 511, 512, 573, 407, 515, 516, 517, 392, 573, 500, - /* 3590 */ 573, 573, 503, 573, 573, 573, 507, 508, 509, 510, - /* 3600 */ 511, 512, 407, 573, 515, 516, 517, 573, 573, 392, - /* 3610 */ 573, 500, 573, 437, 503, 573, 573, 573, 507, 508, - /* 3620 */ 509, 510, 511, 512, 407, 573, 515, 516, 517, 453, - /* 3630 */ 573, 455, 437, 573, 573, 573, 573, 573, 573, 573, - /* 3640 */ 573, 573, 573, 573, 573, 573, 573, 573, 453, 573, - /* 3650 */ 455, 573, 573, 573, 437, 573, 573, 573, 573, 573, - /* 3660 */ 573, 573, 573, 573, 573, 573, 573, 573, 573, 573, - /* 3670 */ 453, 573, 455, 573, 392, 573, 500, 573, 573, 503, - /* 3680 */ 573, 573, 573, 507, 508, 509, 510, 511, 512, 407, - /* 3690 */ 573, 515, 516, 517, 573, 500, 573, 573, 503, 573, - /* 3700 */ 573, 573, 507, 508, 509, 510, 511, 512, 573, 573, - /* 3710 */ 515, 516, 517, 573, 573, 573, 573, 500, 573, 437, - /* 3720 */ 503, 573, 573, 392, 507, 508, 509, 510, 511, 512, - /* 3730 */ 573, 573, 515, 516, 517, 453, 573, 455, 407, 573, - /* 3740 */ 573, 573, 573, 392, 573, 573, 573, 573, 573, 573, - /* 3750 */ 573, 573, 573, 573, 573, 573, 573, 573, 407, 573, - /* 3760 */ 573, 573, 573, 392, 573, 573, 573, 573, 437, 573, - /* 3770 */ 573, 573, 573, 573, 573, 573, 573, 573, 407, 573, - /* 3780 */ 573, 573, 500, 573, 453, 503, 455, 573, 437, 507, - /* 3790 */ 508, 509, 510, 511, 512, 573, 573, 515, 516, 517, - /* 3800 */ 573, 573, 573, 573, 453, 573, 455, 573, 437, 573, - /* 3810 */ 573, 573, 573, 573, 573, 573, 573, 573, 573, 573, - /* 3820 */ 573, 573, 573, 573, 453, 573, 455, 573, 573, 573, - /* 3830 */ 573, 500, 573, 573, 503, 573, 573, 573, 507, 508, - /* 3840 */ 509, 510, 511, 512, 573, 573, 515, 516, 517, 573, - /* 3850 */ 392, 500, 573, 573, 503, 573, 573, 573, 507, 508, - /* 3860 */ 509, 510, 511, 512, 573, 407, 515, 516, 517, 392, - /* 3870 */ 573, 500, 573, 573, 503, 573, 573, 573, 507, 508, - /* 3880 */ 509, 510, 511, 512, 407, 573, 515, 516, 517, 392, - /* 3890 */ 573, 573, 573, 573, 573, 437, 573, 573, 573, 573, - /* 3900 */ 573, 573, 573, 573, 407, 573, 573, 573, 573, 573, - /* 3910 */ 573, 453, 573, 455, 437, 573, 573, 573, 573, 573, - /* 3920 */ 573, 573, 573, 573, 573, 573, 573, 573, 573, 573, - /* 3930 */ 453, 573, 455, 573, 437, 573, 573, 573, 573, 573, - /* 3940 */ 573, 573, 573, 573, 573, 573, 573, 573, 573, 573, - /* 3950 */ 453, 573, 455, 573, 573, 573, 392, 573, 500, 573, - /* 3960 */ 573, 503, 573, 573, 573, 507, 508, 509, 510, 511, - /* 3970 */ 512, 407, 573, 515, 516, 517, 392, 500, 573, 573, - /* 3980 */ 503, 573, 573, 573, 507, 508, 509, 510, 511, 512, - /* 3990 */ 573, 407, 515, 516, 517, 392, 573, 500, 573, 573, - /* 4000 */ 503, 437, 573, 573, 507, 508, 509, 510, 511, 512, - /* 4010 */ 407, 573, 515, 516, 517, 573, 573, 453, 573, 455, - /* 4020 */ 573, 437, 573, 573, 573, 573, 573, 573, 573, 573, - /* 4030 */ 573, 573, 573, 573, 573, 573, 573, 453, 573, 455, - /* 4040 */ 437, 573, 573, 573, 573, 573, 573, 573, 573, 573, - /* 4050 */ 573, 573, 573, 573, 573, 573, 453, 573, 455, 573, - /* 4060 */ 573, 573, 573, 392, 500, 573, 573, 503, 573, 573, - /* 4070 */ 573, 507, 508, 509, 510, 511, 512, 573, 407, 515, - /* 4080 */ 516, 517, 392, 573, 500, 573, 573, 503, 573, 573, - /* 4090 */ 573, 507, 508, 509, 510, 511, 512, 407, 573, 515, - /* 4100 */ 516, 517, 573, 500, 573, 573, 503, 573, 437, 573, - /* 4110 */ 507, 508, 509, 510, 511, 512, 573, 573, 515, 516, - /* 4120 */ 517, 573, 573, 573, 453, 573, 455, 437, 573, 573, - /* 4130 */ 573, 392, 573, 573, 573, 573, 573, 573, 573, 573, - /* 4140 */ 573, 573, 573, 453, 573, 455, 407, 573, 573, 573, - /* 4150 */ 573, 392, 573, 573, 573, 573, 573, 573, 573, 573, - /* 4160 */ 573, 573, 573, 573, 573, 573, 407, 573, 573, 573, - /* 4170 */ 573, 500, 573, 573, 503, 573, 437, 573, 507, 508, - /* 4180 */ 509, 510, 511, 512, 573, 573, 515, 516, 517, 573, - /* 4190 */ 500, 573, 453, 503, 455, 573, 437, 507, 508, 509, - /* 4200 */ 510, 511, 512, 573, 573, 515, 516, 517, 573, 573, - /* 4210 */ 573, 573, 453, 573, 455, 573, 573, 573, 573, 392, - /* 4220 */ 573, 573, 573, 573, 573, 573, 573, 573, 573, 573, - /* 4230 */ 573, 573, 573, 573, 407, 573, 573, 573, 573, 500, - /* 4240 */ 573, 573, 503, 392, 573, 573, 507, 508, 509, 510, - /* 4250 */ 511, 512, 573, 573, 515, 516, 517, 573, 407, 500, - /* 4260 */ 573, 573, 503, 573, 437, 573, 507, 508, 509, 510, - /* 4270 */ 511, 512, 573, 573, 515, 516, 517, 573, 573, 573, - /* 4280 */ 453, 573, 455, 573, 573, 573, 573, 573, 437, 573, - /* 4290 */ 573, 573, 573, 573, 573, 573, 573, 573, 573, 573, - /* 4300 */ 573, 573, 573, 573, 453, 573, 455, 573, 573, 573, - /* 4310 */ 573, 573, 573, 573, 573, 573, 573, 573, 573, 573, - /* 4320 */ 573, 573, 573, 573, 573, 392, 573, 500, 573, 573, - /* 4330 */ 503, 573, 573, 573, 507, 508, 509, 510, 511, 512, - /* 4340 */ 407, 573, 515, 516, 517, 573, 573, 573, 573, 392, - /* 4350 */ 573, 500, 573, 573, 503, 573, 573, 573, 507, 508, - /* 4360 */ 509, 510, 511, 512, 407, 573, 515, 516, 517, 573, - /* 4370 */ 437, 573, 573, 573, 573, 573, 573, 573, 573, 573, - /* 4380 */ 573, 573, 573, 573, 573, 573, 453, 573, 455, 573, - /* 4390 */ 573, 573, 573, 573, 437, 573, 573, 573, 573, 573, - /* 4400 */ 573, 573, 573, 573, 573, 573, 573, 573, 573, 573, - /* 4410 */ 453, 573, 455, 573, 573, 573, 573, 573, 573, 573, - /* 4420 */ 573, 573, 573, 573, 573, 573, 573, 573, 573, 573, - /* 4430 */ 573, 573, 573, 500, 573, 573, 503, 573, 573, 573, - /* 4440 */ 507, 508, 509, 510, 511, 512, 573, 573, 515, 516, - /* 4450 */ 517, 573, 573, 573, 573, 573, 573, 500, 573, 573, - /* 4460 */ 503, 573, 573, 573, 507, 508, 509, 510, 511, 512, - /* 4470 */ 573, 573, 515, 516, 517, 389, 389, 389, 389, 389, - /* 4480 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, - /* 4490 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, - /* 4500 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, - /* 4510 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, - /* 4520 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, - /* 4530 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, - /* 4540 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, - /* 4550 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, - /* 4560 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, - /* 4570 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, - /* 4580 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, - /* 4590 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, - /* 4600 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, - /* 4610 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, - /* 4620 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, - /* 4630 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, - /* 4640 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, - /* 4650 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, - /* 4660 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, - /* 4670 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, - /* 4680 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, - /* 4690 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, - /* 4700 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, - /* 4710 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, - /* 4720 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, - /* 4730 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, - /* 4740 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, - /* 4750 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, - /* 4760 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, - /* 4770 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, - /* 4780 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, - /* 4790 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, - /* 4800 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, - /* 4810 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, - /* 4820 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, - /* 4830 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, - /* 4840 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, - /* 4850 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, - /* 4860 */ 389, 389, 389, 389, -}; -#define YY_SHIFT_COUNT (1024) -#define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (2989) -static const unsigned short int yy_shift_ofst[] = { - /* 0 */ 948, 277, 554, 277, 832, 832, 832, 832, 832, 832, - /* 10 */ 832, 832, 832, 832, 832, 832, 1109, 1940, 1940, 2217, - /* 20 */ 0, 1386, 1940, 1940, 1940, 1940, 1940, 1940, 1940, 1940, - /* 30 */ 1940, 1940, 1663, 1940, 1940, 1940, 1940, 1940, 1940, 1940, - /* 40 */ 1940, 1940, 1940, 1940, 1940, 1940, 1940, 1940, 1940, 1940, - /* 50 */ 1940, 1940, 1940, 1940, 1940, 1940, 1940, 1940, 1940, 1940, - /* 60 */ 1940, 1940, 1940, 34, 66, 180, 253, 46, 122, 46, - /* 70 */ 46, 253, 253, 46, 960, 46, 276, 960, 520, 46, - /* 80 */ 149, 2315, 156, 156, 212, 212, 2315, 2315, 598, 598, - /* 90 */ 156, 20, 20, 346, 89, 89, 69, 204, 212, 212, - /* 100 */ 212, 212, 212, 212, 212, 212, 212, 212, 212, 333, - /* 110 */ 444, 573, 212, 212, 585, 149, 212, 333, 212, 149, - /* 120 */ 212, 212, 212, 212, 149, 212, 212, 212, 149, 212, - /* 130 */ 149, 149, 149, 648, 222, 222, 473, 473, 745, 652, - /* 140 */ 181, 51, 548, 548, 548, 548, 548, 548, 548, 548, - /* 150 */ 548, 548, 548, 548, 548, 548, 548, 548, 548, 548, - /* 160 */ 548, 1858, 200, 20, 346, 849, 849, 710, 379, 379, - /* 170 */ 379, 927, 927, 699, 1091, 710, 585, 149, 614, 149, - /* 180 */ 149, 466, 149, 149, 683, 149, 683, 683, 728, 25, - /* 190 */ 2488, 473, 473, 473, 473, 473, 473, 1190, 21, 53, - /* 200 */ 411, 411, 314, 148, 23, 220, 152, 596, 213, 571, - /* 210 */ 560, 560, 892, 662, 1043, 1043, 1043, 382, 1043, 774, - /* 220 */ 757, 92, 896, 1442, 1208, 682, 1247, 1247, 1254, 1320, - /* 230 */ 1320, 1082, 1000, 241, 1247, 1091, 1510, 1772, 1812, 1814, - /* 240 */ 1601, 585, 1814, 585, 1639, 1812, 1842, 1819, 1842, 1819, - /* 250 */ 1686, 1812, 1842, 1812, 1819, 1686, 1686, 1686, 1782, 1788, - /* 260 */ 1812, 1812, 1792, 1812, 1812, 1812, 1886, 1860, 1886, 1860, - /* 270 */ 1814, 585, 585, 1896, 585, 1935, 1937, 585, 1935, 585, - /* 280 */ 1943, 585, 1948, 585, 585, 1921, 1921, 1812, 585, 1886, - /* 290 */ 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, - /* 300 */ 149, 1812, 25, 25, 1886, 683, 683, 683, 1759, 1881, - /* 310 */ 1814, 648, 1992, 1799, 1806, 1896, 648, 1510, 1812, 683, - /* 320 */ 1714, 1717, 1714, 1717, 1712, 1836, 1714, 1724, 1726, 1745, - /* 330 */ 1510, 1749, 1763, 1738, 1739, 1740, 1842, 2061, 1954, 1770, - /* 340 */ 1935, 648, 648, 1717, 683, 683, 683, 683, 1717, 683, - /* 350 */ 1924, 648, 683, 1948, 648, 2015, 683, 1944, 1948, 648, - /* 360 */ 728, 648, 1842, 683, 683, 683, 683, 683, 683, 683, - /* 370 */ 683, 683, 683, 683, 683, 683, 683, 683, 683, 683, - /* 380 */ 683, 683, 683, 683, 683, 2034, 683, 1812, 648, 2155, - /* 390 */ 2148, 2152, 2151, 1886, 4475, 4475, 4475, 4475, 4475, 4475, - /* 400 */ 4475, 4475, 4475, 4475, 4475, 4475, 39, 2989, 70, 1146, - /* 410 */ 1193, 1243, 1425, 1711, 715, 1434, 1560, 1570, 1124, 497, - /* 420 */ 770, 1584, 1542, 1861, 1878, 1699, 1808, 1004, 1169, 1026, - /* 430 */ 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 237, 150, - /* 440 */ 992, 831, 3, 3, 681, 106, 321, 182, 686, 711, - /* 450 */ 334, 752, 837, 767, 928, 928, 687, 736, 1138, 687, - /* 460 */ 687, 687, 1407, 1275, 1206, 1382, 1446, 1365, 1473, 1509, - /* 470 */ 10, 1495, 1373, 399, 1374, 1403, 399, 1408, 1478, 1499, - /* 480 */ 1526, 1302, 1527, 1538, 1545, 1396, 1469, 1489, 179, 1500, - /* 490 */ 1513, 1519, 1561, 1351, 1301, 1130, 1507, 1562, 1568, 1569, - /* 500 */ 1563, 1577, 1488, 1587, 1610, 1632, 1573, 1625, 1633, 1645, - /* 510 */ 1653, 1657, 1558, 1591, 1624, 1692, 1704, 1718, 1720, 1723, - /* 520 */ 1733, 1737, 1741, 1667, 399, 1708, 1730, 1735, 1736, 1742, - /* 530 */ 1575, 1682, 1541, 1589, 1743, 1744, 1719, 1702, 2256, 2257, - /* 540 */ 2258, 2212, 2260, 2225, 2017, 2227, 2228, 2231, 2020, 2268, - /* 550 */ 2233, 2234, 2026, 2236, 2273, 2274, 2030, 2276, 2241, 2278, - /* 560 */ 2243, 2280, 2259, 2282, 2247, 2044, 2285, 2059, 2287, 2062, - /* 570 */ 2064, 2069, 2074, 2294, 2295, 2297, 2083, 2085, 2300, 2301, - /* 580 */ 2142, 2253, 2254, 2306, 2271, 2308, 2309, 2275, 2261, 2310, - /* 590 */ 2262, 2319, 2269, 2317, 2320, 2321, 2264, 2322, 2323, 2324, - /* 600 */ 2325, 2326, 2329, 2157, 2298, 2330, 2159, 2331, 2339, 2340, - /* 610 */ 2341, 2342, 2343, 2344, 2345, 2346, 2347, 2349, 2350, 2352, - /* 620 */ 2354, 2355, 2356, 2357, 2358, 2360, 2361, 2312, 2364, 2318, - /* 630 */ 2377, 2382, 2384, 2385, 2389, 2390, 2391, 2392, 2393, 2395, - /* 640 */ 2375, 2398, 2218, 2380, 2239, 2400, 2242, 2402, 2403, 2383, - /* 650 */ 2362, 2386, 2363, 2404, 2335, 2407, 2338, 2374, 2413, 2348, - /* 660 */ 2416, 2353, 2417, 2418, 2387, 2368, 2376, 2426, 2394, 2370, - /* 670 */ 2388, 2428, 2397, 2372, 2396, 2431, 2399, 2434, 2381, 2439, - /* 680 */ 2406, 2445, 2408, 2410, 2414, 2409, 2411, 2432, 2415, 2459, - /* 690 */ 2419, 2423, 2461, 2468, 2474, 2490, 2452, 2288, 2497, 2409, - /* 700 */ 2455, 2508, 2409, 2458, 2510, 2511, 2433, 2513, 2514, 2480, - /* 710 */ 2460, 2475, 2518, 2484, 2464, 2478, 2523, 2489, 2467, 2483, - /* 720 */ 2528, 2493, 2476, 2487, 2532, 2535, 2537, 2538, 2539, 2504, - /* 730 */ 2543, 2544, 2420, 2421, 2515, 2524, 2549, 2530, 2517, 2522, - /* 740 */ 2525, 2526, 2527, 2529, 2534, 2536, 2541, 2531, 2533, 2545, - /* 750 */ 2546, 2552, 2547, 2550, 2551, 2571, 2553, 2579, 2558, 2548, - /* 760 */ 2584, 2563, 2555, 2586, 2587, 2588, 2556, 2593, 2559, 2594, - /* 770 */ 2560, 2603, 2582, 2589, 2570, 2572, 2575, 2494, 2496, 2612, - /* 780 */ 2422, 2405, 2424, 2498, 2401, 2409, 2564, 2617, 2429, 2583, - /* 790 */ 2598, 2622, 2425, 2602, 2446, 2427, 2628, 2643, 2449, 2440, - /* 800 */ 2453, 2442, 2647, 2618, 2334, 2540, 2542, 2554, 2557, 2631, - /* 810 */ 2561, 2562, 2620, 2621, 2565, 2608, 2569, 2610, 2566, 2576, - /* 820 */ 2630, 2632, 2578, 2580, 2581, 2585, 2590, 2634, 2613, 2619, - /* 830 */ 2592, 2635, 2336, 2605, 2595, 2636, 2599, 2637, 2597, 2600, - /* 840 */ 2668, 2641, 2359, 2639, 2642, 2651, 2658, 2664, 2665, 2604, - /* 850 */ 2606, 2653, 2441, 2669, 2657, 2711, 2712, 2609, 2674, 2607, - /* 860 */ 2611, 2615, 2616, 2567, 2624, 2713, 2677, 2519, 2724, 2629, - /* 870 */ 2638, 2573, 2684, 2577, 2698, 2654, 2457, 2661, 2747, 2728, - /* 880 */ 2499, 2640, 2655, 2656, 2662, 2666, 2659, 2663, 2667, 2670, - /* 890 */ 2671, 2672, 2673, 2675, 2700, 2678, 2679, 2703, 2676, 2735, - /* 900 */ 2591, 2680, 2681, 2776, 2682, 2685, 2601, 2743, 2688, 2687, - /* 910 */ 2779, 2770, 2690, 2691, 2409, 2742, 2694, 2695, 2683, 2696, - /* 920 */ 2697, 2689, 2786, 2614, 2701, 2781, 2785, 2704, 2705, 2789, - /* 930 */ 2708, 2710, 2791, 2667, 2714, 2794, 2670, 2722, 2806, 2671, - /* 940 */ 2731, 2811, 2672, 2715, 2717, 2718, 2719, 2733, 2790, 2734, - /* 950 */ 2817, 2736, 2790, 2790, 2838, 2782, 2784, 2841, 2828, 2830, - /* 960 */ 2832, 2834, 2835, 2836, 2837, 2839, 2840, 2842, 2844, 2792, - /* 970 */ 2762, 2796, 2771, 2852, 2857, 2861, 2862, 2877, 2864, 2865, - /* 980 */ 2866, 2818, 2531, 2868, 2533, 2869, 2870, 2872, 2873, 2888, - /* 990 */ 2875, 2916, 2881, 2856, 2874, 2925, 2890, 2876, 2887, 2934, - /* 1000 */ 2899, 2879, 2894, 2939, 2904, 2884, 2898, 2943, 2908, 2945, - /* 1010 */ 2924, 2947, 2926, 2914, 2949, 2929, 2919, 2918, 2920, 2935, - /* 1020 */ 2937, 2940, 2941, 2938, 2944, -}; -#define YY_REDUCE_COUNT (405) -#define YY_REDUCE_MIN (-536) -#define YY_REDUCE_MAX (3957) -static const short yy_reduce_ofst[] = { - /* 0 */ 418, -349, -99, 142, 552, 829, 1008, 1285, 1582, 1664, - /* 10 */ 1106, 1859, 1941, 176, 1336, 1613, -135, 289, 2123, 419, - /* 20 */ 974, 2229, 2252, 2328, 2379, 2412, 2477, 2500, 2568, 2633, - /* 30 */ 2660, 2746, 2766, 2787, 2893, 2913, 2933, 3020, 3046, 3069, - /* 40 */ 3089, 3111, 3176, 3195, 3217, 3282, 3331, 3351, 3371, 3458, - /* 50 */ 3477, 3497, 3564, 3584, 3603, 3671, 3690, 3739, 3759, 3827, - /* 60 */ 3851, 3933, 3957, -351, 448, 605, -290, -366, 481, 1203, - /* 70 */ 1464, 329, 442, 1485, -412, -536, -153, -393, -534, 14, - /* 80 */ 197, 347, -106, -49, 254, 271, 480, 511, -400, -398, - /* 90 */ -368, -374, -100, -245, 57, 192, 164, -382, -90, 507, - /* 100 */ 539, 551, 43, 229, 718, 806, 834, 843, 305, 151, - /* 110 */ -114, 385, 847, 879, 639, 472, 889, 218, 900, 706, - /* 120 */ 983, 995, 997, 1006, -219, 1029, 1046, 1052, 729, 1061, - /* 130 */ 228, 792, 1017, 616, 61, 61, 184, -415, -35, -259, - /* 140 */ -503, -193, -25, 443, 502, 603, 617, 658, 734, 735, - /* 150 */ 738, 778, 827, 895, 901, 935, 963, 967, 1022, 1027, - /* 160 */ 1039, -14, 121, 33, 316, 256, 588, 651, 121, 258, - /* 170 */ 363, 787, 788, 508, -28, 692, 493, 844, 768, -428, - /* 180 */ 143, 905, 189, 786, 897, 860, 899, 1016, 754, 739, - /* 190 */ 471, 568, 574, 737, 755, 766, 784, 724, 950, 1011, - /* 200 */ 823, 823, 721, 987, 1034, 1072, 1217, 823, 1192, 1192, - /* 210 */ 1236, 1261, 1292, 1244, 1162, 1200, 1202, 1296, 1218, 1192, - /* 220 */ 1317, 1377, 1282, 1383, 1332, 1312, 1334, 1338, 1192, 1262, - /* 230 */ 1263, 1248, 1278, 1265, 1350, 1400, 1348, 1329, 1427, 1344, - /* 240 */ 1342, 1426, 1349, 1435, 1360, 1453, 1456, 1409, 1465, 1416, - /* 250 */ 1421, 1475, 1476, 1479, 1433, 1429, 1437, 1438, 1482, 1486, - /* 260 */ 1497, 1501, 1491, 1503, 1504, 1505, 1514, 1511, 1516, 1517, - /* 270 */ 1444, 1521, 1529, 1487, 1539, 1548, 1477, 1544, 1553, 1550, - /* 280 */ 1494, 1552, 1506, 1554, 1555, 1546, 1551, 1571, 1566, 1576, - /* 290 */ 1549, 1556, 1557, 1559, 1564, 1565, 1572, 1578, 1579, 1580, - /* 300 */ 1581, 1586, 1592, 1593, 1596, 1537, 1583, 1585, 1508, 1520, - /* 310 */ 1531, 1594, 1533, 1540, 1547, 1588, 1620, 1574, 1634, 1598, - /* 320 */ 1490, 1590, 1492, 1597, 1502, 1515, 1512, 1498, 1522, 1518, - /* 330 */ 1595, 1523, 1535, 1528, 1536, 1543, 1672, 1599, 1567, 1602, - /* 340 */ 1678, 1674, 1675, 1630, 1654, 1656, 1659, 1662, 1658, 1665, - /* 350 */ 1666, 1725, 1679, 1661, 1727, 1612, 1690, 1681, 1683, 1747, - /* 360 */ 1721, 1750, 1748, 1697, 1698, 1701, 1703, 1705, 1709, 1715, - /* 370 */ 1716, 1729, 1731, 1732, 1734, 1760, 1766, 1767, 1768, 1778, - /* 380 */ 1779, 1780, 1781, 1783, 1785, 1728, 1787, 1751, 1752, 1784, - /* 390 */ 1793, 1837, 1797, 1813, 1758, 1803, 1746, 1754, 1769, 1773, - /* 400 */ 1815, 1820, 1809, 1821, 1838, 1864, -}; -static const YYACTIONTYPE yy_default[] = { - /* 0 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 10 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 20 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 30 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 40 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 50 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 60 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 70 */ 2300, 2300, 2300, 2683, 2300, 2300, 2639, 2300, 2300, 2300, - /* 80 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 90 */ 2300, 2646, 2646, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 100 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 110 */ 2300, 2300, 2300, 2300, 2410, 2300, 2300, 2300, 2300, 2300, - /* 120 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 130 */ 2300, 2300, 2300, 2408, 2956, 2300, 3084, 2724, 2300, 2300, - /* 140 */ 2985, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 150 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 160 */ 2300, 2300, 2968, 2300, 2300, 2381, 2381, 2300, 2968, 2968, - /* 170 */ 2968, 2928, 2928, 2408, 2300, 2300, 2410, 2300, 2726, 2300, - /* 180 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2553, 2330, - /* 190 */ 2709, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 3014, - /* 200 */ 2960, 2961, 3078, 2300, 3017, 2979, 2300, 2974, 2300, 2300, - /* 210 */ 2300, 2300, 2300, 3004, 2300, 2300, 2300, 2300, 2300, 2300, - /* 220 */ 2651, 2300, 2752, 2300, 2496, 2703, 2300, 2300, 2300, 2300, - /* 230 */ 2300, 3062, 2958, 2998, 2300, 2300, 3008, 2300, 2300, 2300, - /* 240 */ 2740, 2410, 2300, 2410, 2696, 2634, 2300, 2644, 2300, 2644, - /* 250 */ 2641, 2300, 2300, 2300, 2644, 2641, 2641, 2641, 2484, 2480, - /* 260 */ 2300, 2300, 2478, 2300, 2300, 2300, 2300, 2360, 2300, 2360, - /* 270 */ 2300, 2410, 2410, 2300, 2410, 2300, 2300, 2410, 2300, 2410, - /* 280 */ 2300, 2410, 2300, 2410, 2410, 2513, 2513, 2300, 2410, 2300, - /* 290 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 300 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2738, 2719, - /* 310 */ 2300, 2408, 2300, 2707, 2705, 2300, 2408, 3008, 2300, 2300, - /* 320 */ 3032, 3027, 3032, 3027, 3046, 3042, 3032, 3051, 3048, 3010, - /* 330 */ 3008, 2991, 2987, 3081, 3068, 3064, 2300, 2300, 2996, 2994, - /* 340 */ 2300, 2408, 2408, 3027, 2300, 2300, 2300, 2300, 3027, 2300, - /* 350 */ 2300, 2408, 2300, 2300, 2408, 2300, 2300, 2300, 2300, 2408, - /* 360 */ 2300, 2408, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 370 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 380 */ 2300, 2300, 2300, 2300, 2300, 2515, 2300, 2300, 2408, 2300, - /* 390 */ 2332, 2334, 2344, 2300, 2698, 3084, 2724, 2729, 2679, 2679, - /* 400 */ 2556, 2556, 3084, 2556, 2411, 2305, 2300, 2300, 2300, 2300, - /* 410 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 420 */ 2300, 2300, 2857, 2300, 2300, 2300, 2300, 2300, 2300, 3045, - /* 430 */ 3044, 2858, 2300, 2932, 2931, 2930, 2921, 2857, 2509, 2300, - /* 440 */ 2300, 2300, 2856, 2855, 2300, 2300, 2300, 2300, 2300, 2300, - /* 450 */ 2300, 2300, 2300, 2300, 2670, 2669, 2849, 2300, 2300, 2850, - /* 460 */ 2848, 2847, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 470 */ 2300, 2300, 2300, 2500, 2300, 2300, 2497, 2300, 2300, 2300, - /* 480 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 490 */ 2300, 2300, 2300, 2300, 3065, 3069, 2300, 2300, 2300, 2300, - /* 500 */ 2957, 2300, 2300, 2300, 2300, 2300, 2828, 2300, 2300, 2300, - /* 510 */ 2300, 2300, 2796, 2791, 2782, 2773, 2788, 2779, 2767, 2785, - /* 520 */ 2776, 2764, 2761, 2300, 2524, 2300, 2300, 2300, 2300, 2300, - /* 530 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 540 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 550 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 560 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 570 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 580 */ 2640, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 590 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 600 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 610 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 620 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 630 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 640 */ 2300, 2300, 2300, 2300, 2300, 2300, 2655, 2300, 2300, 2300, - /* 650 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 660 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 670 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 680 */ 2300, 2300, 2300, 2300, 2349, 2835, 2300, 2300, 2300, 2300, - /* 690 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2838, - /* 700 */ 2300, 2300, 2839, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 710 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 720 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 730 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 740 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2455, 2454, 2300, - /* 750 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 760 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 770 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2840, 2300, 2300, - /* 780 */ 2300, 2300, 2723, 2300, 2300, 2830, 2300, 2300, 2300, 2300, - /* 790 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 800 */ 2300, 2300, 3061, 3011, 2300, 2300, 2300, 2300, 2300, 2300, - /* 810 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 820 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2828, - /* 830 */ 2300, 3043, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 3059, - /* 840 */ 2300, 3063, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2967, - /* 850 */ 2963, 2300, 2300, 2959, 2300, 2300, 2300, 2300, 2300, 2300, - /* 860 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 870 */ 2300, 2300, 2300, 2300, 2918, 2300, 2300, 2300, 2952, 2300, - /* 880 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2552, 2551, - /* 890 */ 2550, 2549, 2300, 2300, 2300, 2300, 2300, 2300, 2840, 2300, - /* 900 */ 2843, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 910 */ 2300, 2300, 2300, 2300, 2827, 2300, 2895, 2894, 2300, 2300, - /* 920 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2546, 2300, 2300, - /* 930 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 940 */ 2300, 2300, 2300, 2530, 2528, 2527, 2526, 2300, 2563, 2300, - /* 950 */ 2300, 2300, 2559, 2558, 2300, 2300, 2300, 2300, 2300, 2300, - /* 960 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 970 */ 2300, 2300, 2300, 2429, 2300, 2300, 2300, 2300, 2300, 2300, - /* 980 */ 2300, 2300, 2421, 2300, 2420, 2300, 2300, 2300, 2300, 2300, - /* 990 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 1000 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, - /* 1010 */ 2300, 2300, 2300, 2300, 2300, 2300, 2329, 2300, 2300, 2300, - /* 1020 */ 2300, 2300, 2300, 2300, 2300, -}; -/********** End of lemon-generated parsing tables *****************************/ - -/* The next table maps tokens (terminal symbols) into fallback tokens. -** If a construct like the following: -** -** %fallback ID X Y Z. -** -** appears in the grammar, then ID becomes a fallback token for X, Y, -** and Z. Whenever one of the tokens X, Y, or Z is input to the parser -** but it does not parse, the type of the token is changed to ID and -** the parse is retried before an error is thrown. -** -** This feature can be used, for example, to cause some keywords in a language -** to revert to identifiers if they keyword does not apply in the context where -** it appears. -*/ -#ifdef YYFALLBACK -static const YYCODETYPE yyFallback[] = { - 0, /* $ => nothing */ - 0, /* OR => nothing */ - 0, /* AND => nothing */ - 0, /* UNION => nothing */ - 0, /* ALL => nothing */ - 0, /* MINUS => nothing */ - 0, /* EXCEPT => nothing */ - 0, /* INTERSECT => nothing */ - 0, /* NK_BITAND => nothing */ - 0, /* NK_BITOR => nothing */ - 0, /* NK_LSHIFT => nothing */ - 0, /* NK_RSHIFT => nothing */ - 0, /* NK_PLUS => nothing */ - 0, /* NK_MINUS => nothing */ - 0, /* NK_STAR => nothing */ - 0, /* NK_SLASH => nothing */ - 0, /* NK_REM => nothing */ - 0, /* NK_CONCAT => nothing */ - 0, /* CREATE => nothing */ - 0, /* ACCOUNT => nothing */ - 0, /* NK_ID => nothing */ - 0, /* PASS => nothing */ - 0, /* NK_STRING => nothing */ - 0, /* ALTER => nothing */ - 0, /* PPS => nothing */ - 0, /* TSERIES => nothing */ - 0, /* STORAGE => nothing */ - 0, /* STREAMS => nothing */ - 0, /* QTIME => nothing */ - 0, /* DBS => nothing */ - 0, /* USERS => nothing */ - 0, /* CONNS => nothing */ - 0, /* STATE => nothing */ - 0, /* NK_COMMA => nothing */ - 0, /* HOST => nothing */ - 0, /* IS_IMPORT => nothing */ - 0, /* NK_INTEGER => nothing */ - 0, /* CREATEDB => nothing */ - 0, /* USER => nothing */ - 0, /* ENABLE => nothing */ - 0, /* SYSINFO => nothing */ - 0, /* ADD => nothing */ - 0, /* DROP => nothing */ - 0, /* GRANT => nothing */ - 0, /* ON => nothing */ - 0, /* TO => nothing */ - 0, /* REVOKE => nothing */ - 0, /* FROM => nothing */ - 0, /* SUBSCRIBE => nothing */ - 0, /* READ => nothing */ - 0, /* WRITE => nothing */ - 0, /* NK_DOT => nothing */ - 0, /* WITH => nothing */ - 0, /* ENCRYPT_KEY => nothing */ - 0, /* ANODE => nothing */ - 0, /* UPDATE => nothing */ - 0, /* ANODES => nothing */ - 0, /* DNODE => nothing */ - 0, /* PORT => nothing */ - 0, /* DNODES => nothing */ - 0, /* RESTORE => nothing */ - 0, /* NK_IPTOKEN => nothing */ - 0, /* FORCE => nothing */ - 0, /* UNSAFE => nothing */ - 0, /* CLUSTER => nothing */ - 0, /* LOCAL => nothing */ - 0, /* QNODE => nothing */ - 0, /* BNODE => nothing */ - 0, /* SNODE => nothing */ - 0, /* MNODE => nothing */ - 0, /* VNODE => nothing */ - 0, /* DATABASE => nothing */ - 0, /* USE => nothing */ - 0, /* FLUSH => nothing */ - 0, /* TRIM => nothing */ - 0, /* S3MIGRATE => nothing */ - 0, /* COMPACT => nothing */ - 0, /* IF => nothing */ - 0, /* NOT => nothing */ - 0, /* EXISTS => nothing */ - 0, /* BUFFER => nothing */ - 0, /* CACHEMODEL => nothing */ - 0, /* CACHESIZE => nothing */ - 0, /* COMP => nothing */ - 0, /* DURATION => nothing */ - 0, /* NK_VARIABLE => nothing */ - 0, /* MAXROWS => nothing */ - 0, /* MINROWS => nothing */ - 0, /* KEEP => nothing */ - 0, /* PAGES => nothing */ - 0, /* PAGESIZE => nothing */ - 0, /* TSDB_PAGESIZE => nothing */ - 0, /* PRECISION => nothing */ - 0, /* REPLICA => 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 */ - 0, /* WAL_SEGMENT_SIZE => nothing */ - 0, /* STT_TRIGGER => nothing */ - 0, /* TABLE_PREFIX => nothing */ - 0, /* TABLE_SUFFIX => nothing */ - 0, /* S3_CHUNKSIZE => nothing */ - 0, /* S3_KEEPLOCAL => nothing */ - 0, /* S3_COMPACT => nothing */ - 0, /* KEEP_TIME_OFFSET => nothing */ - 0, /* ENCRYPT_ALGORITHM => nothing */ - 0, /* NK_COLON => nothing */ - 0, /* BWLIMIT => nothing */ - 0, /* START => nothing */ - 0, /* TIMESTAMP => nothing */ - 343, /* END => ABORT */ - 0, /* TABLE => nothing */ - 0, /* NK_LP => nothing */ - 0, /* NK_RP => nothing */ - 0, /* USING => nothing */ - 343, /* FILE => ABORT */ - 0, /* STABLE => nothing */ - 0, /* COLUMN => nothing */ - 0, /* MODIFY => nothing */ - 0, /* RENAME => nothing */ - 0, /* TAG => nothing */ - 0, /* SET => nothing */ - 0, /* NK_EQ => nothing */ - 0, /* TAGS => nothing */ - 0, /* BOOL => nothing */ - 0, /* TINYINT => nothing */ - 0, /* SMALLINT => nothing */ - 0, /* INT => nothing */ - 0, /* INTEGER => nothing */ - 0, /* BIGINT => nothing */ - 0, /* FLOAT => nothing */ - 0, /* DOUBLE => nothing */ - 0, /* BINARY => nothing */ - 0, /* NCHAR => nothing */ - 0, /* UNSIGNED => nothing */ - 0, /* JSON => nothing */ - 0, /* VARCHAR => nothing */ - 0, /* MEDIUMBLOB => nothing */ - 0, /* BLOB => nothing */ - 0, /* VARBINARY => nothing */ - 0, /* GEOMETRY => nothing */ - 0, /* DECIMAL => nothing */ - 0, /* COMMENT => nothing */ - 0, /* MAX_DELAY => nothing */ - 0, /* WATERMARK => nothing */ - 0, /* ROLLUP => nothing */ - 0, /* TTL => nothing */ - 0, /* SMA => nothing */ - 0, /* DELETE_MARK => nothing */ - 0, /* FIRST => nothing */ - 0, /* LAST => nothing */ - 0, /* SHOW => nothing */ - 0, /* FULL => nothing */ - 0, /* PRIVILEGES => nothing */ - 0, /* DATABASES => nothing */ - 0, /* TABLES => nothing */ - 0, /* STABLES => nothing */ - 0, /* MNODES => nothing */ - 0, /* QNODES => nothing */ - 0, /* ARBGROUPS => nothing */ - 0, /* FUNCTIONS => nothing */ - 0, /* INDEXES => nothing */ - 0, /* ACCOUNTS => nothing */ - 0, /* APPS => nothing */ - 0, /* CONNECTIONS => nothing */ - 0, /* LICENCES => nothing */ - 0, /* GRANTS => nothing */ - 0, /* LOGS => nothing */ - 0, /* MACHINES => nothing */ - 0, /* ENCRYPTIONS => nothing */ - 0, /* QUERIES => nothing */ - 0, /* SCORES => nothing */ - 0, /* TOPICS => nothing */ - 0, /* VARIABLES => nothing */ - 0, /* BNODES => nothing */ - 0, /* SNODES => nothing */ - 0, /* TRANSACTIONS => nothing */ - 0, /* DISTRIBUTED => nothing */ - 0, /* CONSUMERS => nothing */ - 0, /* SUBSCRIPTIONS => nothing */ - 0, /* VNODES => nothing */ - 0, /* ALIVE => nothing */ - 0, /* VIEWS => nothing */ - 343, /* VIEW => ABORT */ - 0, /* COMPACTS => nothing */ - 0, /* NORMAL => nothing */ - 0, /* CHILD => nothing */ - 0, /* LIKE => nothing */ - 0, /* TBNAME => nothing */ - 0, /* QTAGS => nothing */ - 0, /* AS => nothing */ - 0, /* SYSTEM => nothing */ - 0, /* TSMA => nothing */ - 0, /* INTERVAL => nothing */ - 0, /* RECURSIVE => nothing */ - 0, /* TSMAS => nothing */ - 0, /* FUNCTION => nothing */ - 0, /* INDEX => nothing */ - 0, /* COUNT => nothing */ - 0, /* LAST_ROW => nothing */ - 0, /* META => nothing */ - 0, /* ONLY => nothing */ - 0, /* TOPIC => nothing */ - 0, /* CONSUMER => nothing */ - 0, /* GROUP => nothing */ - 0, /* DESC => nothing */ - 0, /* DESCRIBE => nothing */ - 0, /* RESET => nothing */ - 0, /* QUERY => nothing */ - 0, /* CACHE => nothing */ - 0, /* EXPLAIN => nothing */ - 0, /* ANALYZE => nothing */ - 0, /* VERBOSE => nothing */ - 0, /* NK_BOOL => nothing */ - 0, /* RATIO => nothing */ - 0, /* NK_FLOAT => nothing */ - 0, /* OUTPUTTYPE => nothing */ - 0, /* AGGREGATE => nothing */ - 0, /* BUFSIZE => nothing */ - 0, /* LANGUAGE => nothing */ - 0, /* REPLACE => nothing */ - 0, /* STREAM => nothing */ - 0, /* INTO => nothing */ - 0, /* PAUSE => nothing */ - 0, /* RESUME => nothing */ - 0, /* PRIMARY => nothing */ - 343, /* KEY => ABORT */ - 0, /* TRIGGER => nothing */ - 0, /* AT_ONCE => nothing */ - 0, /* WINDOW_CLOSE => nothing */ - 0, /* IGNORE => nothing */ - 0, /* EXPIRED => nothing */ - 0, /* FILL_HISTORY => nothing */ - 0, /* SUBTABLE => nothing */ - 0, /* UNTREATED => nothing */ - 0, /* KILL => nothing */ - 0, /* CONNECTION => nothing */ - 0, /* TRANSACTION => nothing */ - 0, /* BALANCE => nothing */ - 0, /* VGROUP => nothing */ - 0, /* LEADER => nothing */ - 0, /* MERGE => nothing */ - 0, /* REDISTRIBUTE => nothing */ - 0, /* SPLIT => nothing */ - 0, /* DELETE => nothing */ - 0, /* INSERT => nothing */ - 0, /* NK_BIN => nothing */ - 0, /* NK_HEX => nothing */ - 0, /* NULL => nothing */ - 0, /* NK_QUESTION => nothing */ - 0, /* NK_ALIAS => nothing */ - 0, /* NK_ARROW => nothing */ - 0, /* ROWTS => nothing */ - 0, /* QSTART => nothing */ - 0, /* QEND => nothing */ - 0, /* QDURATION => nothing */ - 0, /* WSTART => nothing */ - 0, /* WEND => nothing */ - 0, /* WDURATION => nothing */ - 0, /* IROWTS => nothing */ - 0, /* ISFILLED => nothing */ - 0, /* FLOW => nothing */ - 0, /* FHIGH => nothing */ - 0, /* FROWTS => nothing */ - 0, /* CAST => nothing */ - 0, /* POSITION => nothing */ - 0, /* IN => nothing */ - 343, /* FOR => ABORT */ - 0, /* NOW => nothing */ - 0, /* TODAY => nothing */ - 0, /* RAND => nothing */ - 0, /* SUBSTR => nothing */ - 0, /* SUBSTRING => nothing */ - 0, /* BOTH => nothing */ - 0, /* TRAILING => nothing */ - 0, /* LEADING => nothing */ - 0, /* TIMEZONE => nothing */ - 0, /* CLIENT_VERSION => nothing */ - 0, /* SERVER_VERSION => nothing */ - 0, /* SERVER_STATUS => nothing */ - 0, /* CURRENT_USER => nothing */ - 0, /* PI => nothing */ - 0, /* CASE => nothing */ - 0, /* WHEN => nothing */ - 0, /* THEN => nothing */ - 0, /* ELSE => nothing */ - 0, /* BETWEEN => nothing */ - 0, /* IS => nothing */ - 0, /* NK_LT => nothing */ - 0, /* NK_GT => nothing */ - 0, /* NK_LE => nothing */ - 0, /* NK_GE => nothing */ - 0, /* NK_NE => nothing */ - 0, /* MATCH => nothing */ - 0, /* NMATCH => nothing */ - 0, /* CONTAINS => nothing */ - 0, /* JOIN => nothing */ - 0, /* INNER => nothing */ - 0, /* LEFT => nothing */ - 0, /* RIGHT => nothing */ - 0, /* OUTER => nothing */ - 343, /* SEMI => ABORT */ - 0, /* ANTI => nothing */ - 0, /* ASOF => nothing */ - 0, /* WINDOW => nothing */ - 0, /* WINDOW_OFFSET => nothing */ - 0, /* JLIMIT => nothing */ - 0, /* SELECT => nothing */ - 0, /* NK_HINT => nothing */ - 0, /* DISTINCT => nothing */ - 0, /* WHERE => nothing */ - 0, /* PARTITION => nothing */ - 0, /* BY => nothing */ - 0, /* SESSION => nothing */ - 0, /* STATE_WINDOW => nothing */ - 0, /* EVENT_WINDOW => nothing */ - 0, /* COUNT_WINDOW => nothing */ - 0, /* ANOMALY_WINDOW => nothing */ - 0, /* SLIDING => nothing */ - 0, /* FILL => nothing */ - 0, /* VALUE => nothing */ - 0, /* VALUE_F => nothing */ - 0, /* NONE => nothing */ - 0, /* PREV => nothing */ - 0, /* NULL_F => nothing */ - 0, /* LINEAR => nothing */ - 0, /* NEXT => nothing */ - 0, /* HAVING => nothing */ - 0, /* RANGE => nothing */ - 0, /* EVERY => nothing */ - 0, /* ORDER => nothing */ - 0, /* SLIMIT => nothing */ - 0, /* SOFFSET => nothing */ - 0, /* LIMIT => nothing */ - 0, /* OFFSET => nothing */ - 0, /* ASC => nothing */ - 0, /* NULLS => nothing */ - 0, /* ABORT => nothing */ - 343, /* AFTER => ABORT */ - 343, /* ATTACH => ABORT */ - 343, /* BEFORE => ABORT */ - 343, /* BEGIN => ABORT */ - 343, /* BITAND => ABORT */ - 343, /* BITNOT => ABORT */ - 343, /* BITOR => ABORT */ - 343, /* BLOCKS => ABORT */ - 343, /* CHANGE => ABORT */ - 343, /* COMMA => ABORT */ - 343, /* CONCAT => ABORT */ - 343, /* CONFLICT => ABORT */ - 343, /* COPY => ABORT */ - 343, /* DEFERRED => ABORT */ - 343, /* DELIMITERS => ABORT */ - 343, /* DETACH => ABORT */ - 343, /* DIVIDE => ABORT */ - 343, /* DOT => ABORT */ - 343, /* EACH => ABORT */ - 343, /* FAIL => ABORT */ - 343, /* GLOB => ABORT */ - 343, /* ID => ABORT */ - 343, /* IMMEDIATE => ABORT */ - 343, /* IMPORT => ABORT */ - 343, /* INITIALLY => ABORT */ - 343, /* INSTEAD => ABORT */ - 343, /* ISNULL => ABORT */ - 343, /* MODULES => ABORT */ - 343, /* NK_BITNOT => ABORT */ - 343, /* NK_SEMI => ABORT */ - 343, /* NOTNULL => ABORT */ - 343, /* OF => ABORT */ - 343, /* PLUS => ABORT */ - 343, /* PRIVILEGE => ABORT */ - 343, /* RAISE => ABORT */ - 343, /* RESTRICT => ABORT */ - 343, /* ROW => ABORT */ - 343, /* STAR => ABORT */ - 343, /* STATEMENT => ABORT */ - 343, /* STRICT => ABORT */ - 343, /* STRING => ABORT */ - 343, /* TIMES => ABORT */ - 343, /* VALUES => ABORT */ - 343, /* VARIABLE => ABORT */ - 343, /* WAL => ABORT */ -}; -#endif /* YYFALLBACK */ - -/* The following structure represents a single element of the -** parser's stack. Information stored includes: -** -** + The state number for the parser at this level of the stack. -** -** + The value of the token stored at this level of the stack. -** (In other words, the "major" token.) -** -** + The semantic value stored at this level of the stack. This is -** the information used by the action routines in the grammar. -** It is sometimes called the "minor" token. -** -** After the "shift" half of a SHIFTREDUCE action, the stateno field -** actually contains the reduce action for the second half of the -** SHIFTREDUCE. -*/ -struct yyStackEntry { - YYACTIONTYPE stateno; /* The state-number, or reduce action in SHIFTREDUCE */ - YYCODETYPE major; /* The major token value. This is the code - ** number for the token at this stack level */ - YYMINORTYPE minor; /* The user-supplied minor token value. This - ** is the value of the token */ -}; -typedef struct yyStackEntry yyStackEntry; - -/* The state of the parser is completely contained in an instance of -** the following structure */ -struct yyParser { - yyStackEntry *yytos; /* Pointer to top element of the stack */ -#ifdef YYTRACKMAXSTACKDEPTH - int yyhwm; /* High-water mark of the stack */ -#endif -#ifndef YYNOERRORRECOVERY - int yyerrcnt; /* Shifts left before out of the error */ -#endif - ParseARG_SDECL /* A place to hold %extra_argument */ - ParseCTX_SDECL /* A place to hold %extra_context */ -#if YYSTACKDEPTH<=0 - int yystksz; /* Current side of the stack */ - yyStackEntry *yystack; /* The parser's stack */ - yyStackEntry yystk0; /* First stack entry */ -#else - yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */ - yyStackEntry *yystackEnd; /* Last entry in the stack */ -#endif -}; -typedef struct yyParser yyParser; - -#ifndef NDEBUG -#include -static FILE *yyTraceFILE = 0; -static char *yyTracePrompt = 0; -#endif /* NDEBUG */ - -#ifndef NDEBUG -/* -** Turn parser tracing on by giving a stream to which to write the trace -** and a prompt to preface each trace message. Tracing is turned off -** by making either argument NULL -** -** Inputs: -**

        -**
      • A FILE* to which trace output should be written. -** If NULL, then tracing is turned off. -**
      • A prefix string written at the beginning of every -** line of trace output. If NULL, then tracing is -** turned off. -**
      -** -** Outputs: -** None. -*/ -void ParseTrace(FILE *TraceFILE, char *zTracePrompt){ - yyTraceFILE = TraceFILE; - yyTracePrompt = zTracePrompt; - if( yyTraceFILE==0 ) yyTracePrompt = 0; - else if( yyTracePrompt==0 ) yyTraceFILE = 0; -} -#endif /* NDEBUG */ - -#if defined(YYCOVERAGE) || !defined(NDEBUG) -/* For tracing shifts, the names of all terminals and nonterminals -** are required. The following table supplies these names */ -static const char *const yyTokenName[] = { - /* 0 */ "$", - /* 1 */ "OR", - /* 2 */ "AND", - /* 3 */ "UNION", - /* 4 */ "ALL", - /* 5 */ "MINUS", - /* 6 */ "EXCEPT", - /* 7 */ "INTERSECT", - /* 8 */ "NK_BITAND", - /* 9 */ "NK_BITOR", - /* 10 */ "NK_LSHIFT", - /* 11 */ "NK_RSHIFT", - /* 12 */ "NK_PLUS", - /* 13 */ "NK_MINUS", - /* 14 */ "NK_STAR", - /* 15 */ "NK_SLASH", - /* 16 */ "NK_REM", - /* 17 */ "NK_CONCAT", - /* 18 */ "CREATE", - /* 19 */ "ACCOUNT", - /* 20 */ "NK_ID", - /* 21 */ "PASS", - /* 22 */ "NK_STRING", - /* 23 */ "ALTER", - /* 24 */ "PPS", - /* 25 */ "TSERIES", - /* 26 */ "STORAGE", - /* 27 */ "STREAMS", - /* 28 */ "QTIME", - /* 29 */ "DBS", - /* 30 */ "USERS", - /* 31 */ "CONNS", - /* 32 */ "STATE", - /* 33 */ "NK_COMMA", - /* 34 */ "HOST", - /* 35 */ "IS_IMPORT", - /* 36 */ "NK_INTEGER", - /* 37 */ "CREATEDB", - /* 38 */ "USER", - /* 39 */ "ENABLE", - /* 40 */ "SYSINFO", - /* 41 */ "ADD", - /* 42 */ "DROP", - /* 43 */ "GRANT", - /* 44 */ "ON", - /* 45 */ "TO", - /* 46 */ "REVOKE", - /* 47 */ "FROM", - /* 48 */ "SUBSCRIBE", - /* 49 */ "READ", - /* 50 */ "WRITE", - /* 51 */ "NK_DOT", - /* 52 */ "WITH", - /* 53 */ "ENCRYPT_KEY", - /* 54 */ "ANODE", - /* 55 */ "UPDATE", - /* 56 */ "ANODES", - /* 57 */ "DNODE", - /* 58 */ "PORT", - /* 59 */ "DNODES", - /* 60 */ "RESTORE", - /* 61 */ "NK_IPTOKEN", - /* 62 */ "FORCE", - /* 63 */ "UNSAFE", - /* 64 */ "CLUSTER", - /* 65 */ "LOCAL", - /* 66 */ "QNODE", - /* 67 */ "BNODE", - /* 68 */ "SNODE", - /* 69 */ "MNODE", - /* 70 */ "VNODE", - /* 71 */ "DATABASE", - /* 72 */ "USE", - /* 73 */ "FLUSH", - /* 74 */ "TRIM", - /* 75 */ "S3MIGRATE", - /* 76 */ "COMPACT", - /* 77 */ "IF", - /* 78 */ "NOT", - /* 79 */ "EXISTS", - /* 80 */ "BUFFER", - /* 81 */ "CACHEMODEL", - /* 82 */ "CACHESIZE", - /* 83 */ "COMP", - /* 84 */ "DURATION", - /* 85 */ "NK_VARIABLE", - /* 86 */ "MAXROWS", - /* 87 */ "MINROWS", - /* 88 */ "KEEP", - /* 89 */ "PAGES", - /* 90 */ "PAGESIZE", - /* 91 */ "TSDB_PAGESIZE", - /* 92 */ "PRECISION", - /* 93 */ "REPLICA", - /* 94 */ "VGROUPS", - /* 95 */ "SINGLE_STABLE", - /* 96 */ "RETENTIONS", - /* 97 */ "SCHEMALESS", - /* 98 */ "WAL_LEVEL", - /* 99 */ "WAL_FSYNC_PERIOD", - /* 100 */ "WAL_RETENTION_PERIOD", - /* 101 */ "WAL_RETENTION_SIZE", - /* 102 */ "WAL_ROLL_PERIOD", - /* 103 */ "WAL_SEGMENT_SIZE", - /* 104 */ "STT_TRIGGER", - /* 105 */ "TABLE_PREFIX", - /* 106 */ "TABLE_SUFFIX", - /* 107 */ "S3_CHUNKSIZE", - /* 108 */ "S3_KEEPLOCAL", - /* 109 */ "S3_COMPACT", - /* 110 */ "KEEP_TIME_OFFSET", - /* 111 */ "ENCRYPT_ALGORITHM", - /* 112 */ "NK_COLON", - /* 113 */ "BWLIMIT", - /* 114 */ "START", - /* 115 */ "TIMESTAMP", - /* 116 */ "END", - /* 117 */ "TABLE", - /* 118 */ "NK_LP", - /* 119 */ "NK_RP", - /* 120 */ "USING", - /* 121 */ "FILE", - /* 122 */ "STABLE", - /* 123 */ "COLUMN", - /* 124 */ "MODIFY", - /* 125 */ "RENAME", - /* 126 */ "TAG", - /* 127 */ "SET", - /* 128 */ "NK_EQ", - /* 129 */ "TAGS", - /* 130 */ "BOOL", - /* 131 */ "TINYINT", - /* 132 */ "SMALLINT", - /* 133 */ "INT", - /* 134 */ "INTEGER", - /* 135 */ "BIGINT", - /* 136 */ "FLOAT", - /* 137 */ "DOUBLE", - /* 138 */ "BINARY", - /* 139 */ "NCHAR", - /* 140 */ "UNSIGNED", - /* 141 */ "JSON", - /* 142 */ "VARCHAR", - /* 143 */ "MEDIUMBLOB", - /* 144 */ "BLOB", - /* 145 */ "VARBINARY", - /* 146 */ "GEOMETRY", - /* 147 */ "DECIMAL", - /* 148 */ "COMMENT", - /* 149 */ "MAX_DELAY", - /* 150 */ "WATERMARK", - /* 151 */ "ROLLUP", - /* 152 */ "TTL", - /* 153 */ "SMA", - /* 154 */ "DELETE_MARK", - /* 155 */ "FIRST", - /* 156 */ "LAST", - /* 157 */ "SHOW", - /* 158 */ "FULL", - /* 159 */ "PRIVILEGES", - /* 160 */ "DATABASES", - /* 161 */ "TABLES", - /* 162 */ "STABLES", - /* 163 */ "MNODES", - /* 164 */ "QNODES", - /* 165 */ "ARBGROUPS", - /* 166 */ "FUNCTIONS", - /* 167 */ "INDEXES", - /* 168 */ "ACCOUNTS", - /* 169 */ "APPS", - /* 170 */ "CONNECTIONS", - /* 171 */ "LICENCES", - /* 172 */ "GRANTS", - /* 173 */ "LOGS", - /* 174 */ "MACHINES", - /* 175 */ "ENCRYPTIONS", - /* 176 */ "QUERIES", - /* 177 */ "SCORES", - /* 178 */ "TOPICS", - /* 179 */ "VARIABLES", - /* 180 */ "BNODES", - /* 181 */ "SNODES", - /* 182 */ "TRANSACTIONS", - /* 183 */ "DISTRIBUTED", - /* 184 */ "CONSUMERS", - /* 185 */ "SUBSCRIPTIONS", - /* 186 */ "VNODES", - /* 187 */ "ALIVE", - /* 188 */ "VIEWS", - /* 189 */ "VIEW", - /* 190 */ "COMPACTS", - /* 191 */ "NORMAL", - /* 192 */ "CHILD", - /* 193 */ "LIKE", - /* 194 */ "TBNAME", - /* 195 */ "QTAGS", - /* 196 */ "AS", - /* 197 */ "SYSTEM", - /* 198 */ "TSMA", - /* 199 */ "INTERVAL", - /* 200 */ "RECURSIVE", - /* 201 */ "TSMAS", - /* 202 */ "FUNCTION", - /* 203 */ "INDEX", - /* 204 */ "COUNT", - /* 205 */ "LAST_ROW", - /* 206 */ "META", - /* 207 */ "ONLY", - /* 208 */ "TOPIC", - /* 209 */ "CONSUMER", - /* 210 */ "GROUP", - /* 211 */ "DESC", - /* 212 */ "DESCRIBE", - /* 213 */ "RESET", - /* 214 */ "QUERY", - /* 215 */ "CACHE", - /* 216 */ "EXPLAIN", - /* 217 */ "ANALYZE", - /* 218 */ "VERBOSE", - /* 219 */ "NK_BOOL", - /* 220 */ "RATIO", - /* 221 */ "NK_FLOAT", - /* 222 */ "OUTPUTTYPE", - /* 223 */ "AGGREGATE", - /* 224 */ "BUFSIZE", - /* 225 */ "LANGUAGE", - /* 226 */ "REPLACE", - /* 227 */ "STREAM", - /* 228 */ "INTO", - /* 229 */ "PAUSE", - /* 230 */ "RESUME", - /* 231 */ "PRIMARY", - /* 232 */ "KEY", - /* 233 */ "TRIGGER", - /* 234 */ "AT_ONCE", - /* 235 */ "WINDOW_CLOSE", - /* 236 */ "IGNORE", - /* 237 */ "EXPIRED", - /* 238 */ "FILL_HISTORY", - /* 239 */ "SUBTABLE", - /* 240 */ "UNTREATED", - /* 241 */ "KILL", - /* 242 */ "CONNECTION", - /* 243 */ "TRANSACTION", - /* 244 */ "BALANCE", - /* 245 */ "VGROUP", - /* 246 */ "LEADER", - /* 247 */ "MERGE", - /* 248 */ "REDISTRIBUTE", - /* 249 */ "SPLIT", - /* 250 */ "DELETE", - /* 251 */ "INSERT", - /* 252 */ "NK_BIN", - /* 253 */ "NK_HEX", - /* 254 */ "NULL", - /* 255 */ "NK_QUESTION", - /* 256 */ "NK_ALIAS", - /* 257 */ "NK_ARROW", - /* 258 */ "ROWTS", - /* 259 */ "QSTART", - /* 260 */ "QEND", - /* 261 */ "QDURATION", - /* 262 */ "WSTART", - /* 263 */ "WEND", - /* 264 */ "WDURATION", - /* 265 */ "IROWTS", - /* 266 */ "ISFILLED", - /* 267 */ "FLOW", - /* 268 */ "FHIGH", - /* 269 */ "FROWTS", - /* 270 */ "CAST", - /* 271 */ "POSITION", - /* 272 */ "IN", - /* 273 */ "FOR", - /* 274 */ "NOW", - /* 275 */ "TODAY", - /* 276 */ "RAND", - /* 277 */ "SUBSTR", - /* 278 */ "SUBSTRING", - /* 279 */ "BOTH", - /* 280 */ "TRAILING", - /* 281 */ "LEADING", - /* 282 */ "TIMEZONE", - /* 283 */ "CLIENT_VERSION", - /* 284 */ "SERVER_VERSION", - /* 285 */ "SERVER_STATUS", - /* 286 */ "CURRENT_USER", - /* 287 */ "PI", - /* 288 */ "CASE", - /* 289 */ "WHEN", - /* 290 */ "THEN", - /* 291 */ "ELSE", - /* 292 */ "BETWEEN", - /* 293 */ "IS", - /* 294 */ "NK_LT", - /* 295 */ "NK_GT", - /* 296 */ "NK_LE", - /* 297 */ "NK_GE", - /* 298 */ "NK_NE", - /* 299 */ "MATCH", - /* 300 */ "NMATCH", - /* 301 */ "CONTAINS", - /* 302 */ "JOIN", - /* 303 */ "INNER", - /* 304 */ "LEFT", - /* 305 */ "RIGHT", - /* 306 */ "OUTER", - /* 307 */ "SEMI", - /* 308 */ "ANTI", - /* 309 */ "ASOF", - /* 310 */ "WINDOW", - /* 311 */ "WINDOW_OFFSET", - /* 312 */ "JLIMIT", - /* 313 */ "SELECT", - /* 314 */ "NK_HINT", - /* 315 */ "DISTINCT", - /* 316 */ "WHERE", - /* 317 */ "PARTITION", - /* 318 */ "BY", - /* 319 */ "SESSION", - /* 320 */ "STATE_WINDOW", - /* 321 */ "EVENT_WINDOW", - /* 322 */ "COUNT_WINDOW", - /* 323 */ "ANOMALY_WINDOW", - /* 324 */ "SLIDING", - /* 325 */ "FILL", - /* 326 */ "VALUE", - /* 327 */ "VALUE_F", - /* 328 */ "NONE", - /* 329 */ "PREV", - /* 330 */ "NULL_F", - /* 331 */ "LINEAR", - /* 332 */ "NEXT", - /* 333 */ "HAVING", - /* 334 */ "RANGE", - /* 335 */ "EVERY", - /* 336 */ "ORDER", - /* 337 */ "SLIMIT", - /* 338 */ "SOFFSET", - /* 339 */ "LIMIT", - /* 340 */ "OFFSET", - /* 341 */ "ASC", - /* 342 */ "NULLS", - /* 343 */ "ABORT", - /* 344 */ "AFTER", - /* 345 */ "ATTACH", - /* 346 */ "BEFORE", - /* 347 */ "BEGIN", - /* 348 */ "BITAND", - /* 349 */ "BITNOT", - /* 350 */ "BITOR", - /* 351 */ "BLOCKS", - /* 352 */ "CHANGE", - /* 353 */ "COMMA", - /* 354 */ "CONCAT", - /* 355 */ "CONFLICT", - /* 356 */ "COPY", - /* 357 */ "DEFERRED", - /* 358 */ "DELIMITERS", - /* 359 */ "DETACH", - /* 360 */ "DIVIDE", - /* 361 */ "DOT", - /* 362 */ "EACH", - /* 363 */ "FAIL", - /* 364 */ "GLOB", - /* 365 */ "ID", - /* 366 */ "IMMEDIATE", - /* 367 */ "IMPORT", - /* 368 */ "INITIALLY", - /* 369 */ "INSTEAD", - /* 370 */ "ISNULL", - /* 371 */ "MODULES", - /* 372 */ "NK_BITNOT", - /* 373 */ "NK_SEMI", - /* 374 */ "NOTNULL", - /* 375 */ "OF", - /* 376 */ "PLUS", - /* 377 */ "PRIVILEGE", - /* 378 */ "RAISE", - /* 379 */ "RESTRICT", - /* 380 */ "ROW", - /* 381 */ "STAR", - /* 382 */ "STATEMENT", - /* 383 */ "STRICT", - /* 384 */ "STRING", - /* 385 */ "TIMES", - /* 386 */ "VALUES", - /* 387 */ "VARIABLE", - /* 388 */ "WAL", - /* 389 */ "cmd", - /* 390 */ "account_options", - /* 391 */ "alter_account_options", - /* 392 */ "literal", - /* 393 */ "alter_account_option", - /* 394 */ "ip_range_list", - /* 395 */ "white_list", - /* 396 */ "white_list_opt", - /* 397 */ "is_import_opt", - /* 398 */ "is_createdb_opt", - /* 399 */ "user_name", - /* 400 */ "sysinfo_opt", - /* 401 */ "privileges", - /* 402 */ "priv_level", - /* 403 */ "with_clause_opt", - /* 404 */ "priv_type_list", - /* 405 */ "priv_type", - /* 406 */ "db_name", - /* 407 */ "table_name", - /* 408 */ "topic_name", - /* 409 */ "search_condition", - /* 410 */ "dnode_endpoint", - /* 411 */ "force_opt", - /* 412 */ "unsafe_opt", - /* 413 */ "not_exists_opt", - /* 414 */ "db_options", - /* 415 */ "exists_opt", - /* 416 */ "alter_db_options", - /* 417 */ "speed_opt", - /* 418 */ "start_opt", - /* 419 */ "end_opt", - /* 420 */ "integer_list", - /* 421 */ "variable_list", - /* 422 */ "retention_list", - /* 423 */ "signed", - /* 424 */ "alter_db_option", - /* 425 */ "retention", - /* 426 */ "full_table_name", - /* 427 */ "column_def_list", - /* 428 */ "tags_def_opt", - /* 429 */ "table_options", - /* 430 */ "multi_create_clause", - /* 431 */ "tag_list_opt", - /* 432 */ "tags_def", - /* 433 */ "with_opt", - /* 434 */ "multi_drop_clause", - /* 435 */ "alter_table_clause", - /* 436 */ "alter_table_options", - /* 437 */ "column_name", - /* 438 */ "type_name", - /* 439 */ "column_options", - /* 440 */ "tags_literal", - /* 441 */ "create_subtable_clause", - /* 442 */ "specific_cols_opt", - /* 443 */ "tags_literal_list", - /* 444 */ "drop_table_clause", - /* 445 */ "col_name_list", - /* 446 */ "tag_def_list", - /* 447 */ "tag_def", - /* 448 */ "column_def", - /* 449 */ "type_name_default_len", - /* 450 */ "duration_list", - /* 451 */ "rollup_func_list", - /* 452 */ "alter_table_option", - /* 453 */ "duration_literal", - /* 454 */ "rollup_func_name", - /* 455 */ "function_name", - /* 456 */ "col_name", - /* 457 */ "db_kind_opt", - /* 458 */ "table_kind_db_name_cond_opt", - /* 459 */ "like_pattern_opt", - /* 460 */ "db_name_cond_opt", - /* 461 */ "table_name_cond", - /* 462 */ "from_db_opt", - /* 463 */ "table_kind", - /* 464 */ "tag_item", - /* 465 */ "column_alias", - /* 466 */ "tsma_name", - /* 467 */ "tsma_func_list", - /* 468 */ "full_tsma_name", - /* 469 */ "func_list", - /* 470 */ "index_options", - /* 471 */ "full_index_name", - /* 472 */ "index_name", - /* 473 */ "sliding_opt", - /* 474 */ "sma_stream_opt", - /* 475 */ "func", - /* 476 */ "sma_func_name", - /* 477 */ "expression_list", - /* 478 */ "with_meta", - /* 479 */ "query_or_subquery", - /* 480 */ "where_clause_opt", - /* 481 */ "cgroup_name", - /* 482 */ "analyze_opt", - /* 483 */ "explain_options", - /* 484 */ "insert_query", - /* 485 */ "or_replace_opt", - /* 486 */ "agg_func_opt", - /* 487 */ "bufsize_opt", - /* 488 */ "language_opt", - /* 489 */ "full_view_name", - /* 490 */ "view_name", - /* 491 */ "stream_name", - /* 492 */ "stream_options", - /* 493 */ "col_list_opt", - /* 494 */ "tag_def_or_ref_opt", - /* 495 */ "subtable_opt", - /* 496 */ "ignore_opt", - /* 497 */ "column_stream_def_list", - /* 498 */ "column_stream_def", - /* 499 */ "stream_col_options", - /* 500 */ "expression", - /* 501 */ "on_vgroup_id", - /* 502 */ "dnode_list", - /* 503 */ "literal_func", - /* 504 */ "signed_literal", - /* 505 */ "literal_list", - /* 506 */ "table_alias", - /* 507 */ "expr_or_subquery", - /* 508 */ "pseudo_column", - /* 509 */ "column_reference", - /* 510 */ "function_expression", - /* 511 */ "case_when_expression", - /* 512 */ "star_func", - /* 513 */ "star_func_para_list", - /* 514 */ "trim_specification_type", - /* 515 */ "substr_func", - /* 516 */ "rand_func", - /* 517 */ "noarg_func", - /* 518 */ "other_para_list", - /* 519 */ "star_func_para", - /* 520 */ "when_then_list", - /* 521 */ "case_when_else_opt", - /* 522 */ "common_expression", - /* 523 */ "when_then_expr", - /* 524 */ "predicate", - /* 525 */ "compare_op", - /* 526 */ "in_op", - /* 527 */ "in_predicate_value", - /* 528 */ "boolean_value_expression", - /* 529 */ "boolean_primary", - /* 530 */ "from_clause_opt", - /* 531 */ "table_reference_list", - /* 532 */ "table_reference", - /* 533 */ "table_primary", - /* 534 */ "joined_table", - /* 535 */ "alias_opt", - /* 536 */ "subquery", - /* 537 */ "parenthesized_joined_table", - /* 538 */ "join_type", - /* 539 */ "join_subtype", - /* 540 */ "join_on_clause_opt", - /* 541 */ "window_offset_clause_opt", - /* 542 */ "jlimit_clause_opt", - /* 543 */ "window_offset_literal", - /* 544 */ "query_specification", - /* 545 */ "hint_list", - /* 546 */ "set_quantifier_opt", - /* 547 */ "tag_mode_opt", - /* 548 */ "select_list", - /* 549 */ "partition_by_clause_opt", - /* 550 */ "range_opt", - /* 551 */ "every_opt", - /* 552 */ "fill_opt", - /* 553 */ "twindow_clause_opt", - /* 554 */ "group_by_clause_opt", - /* 555 */ "having_clause_opt", - /* 556 */ "select_item", - /* 557 */ "partition_list", - /* 558 */ "partition_item", - /* 559 */ "interval_sliding_duration_literal", - /* 560 */ "fill_mode", - /* 561 */ "group_by_list", - /* 562 */ "query_expression", - /* 563 */ "query_simple", - /* 564 */ "order_by_clause_opt", - /* 565 */ "slimit_clause_opt", - /* 566 */ "limit_clause_opt", - /* 567 */ "union_query_expression", - /* 568 */ "query_simple_or_subquery", - /* 569 */ "sort_specification_list", - /* 570 */ "sort_specification", - /* 571 */ "ordering_specification_opt", - /* 572 */ "null_ordering_opt", -}; -#endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ - -#ifndef NDEBUG -/* For tracing reduce actions, the names of all rules are required. -*/ -static const char *const yyRuleName[] = { - /* 0 */ "cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options", - /* 1 */ "cmd ::= ALTER ACCOUNT NK_ID alter_account_options", - /* 2 */ "account_options ::=", - /* 3 */ "account_options ::= account_options PPS literal", - /* 4 */ "account_options ::= account_options TSERIES literal", - /* 5 */ "account_options ::= account_options STORAGE literal", - /* 6 */ "account_options ::= account_options STREAMS literal", - /* 7 */ "account_options ::= account_options QTIME literal", - /* 8 */ "account_options ::= account_options DBS literal", - /* 9 */ "account_options ::= account_options USERS literal", - /* 10 */ "account_options ::= account_options CONNS literal", - /* 11 */ "account_options ::= account_options STATE literal", - /* 12 */ "alter_account_options ::= alter_account_option", - /* 13 */ "alter_account_options ::= alter_account_options alter_account_option", - /* 14 */ "alter_account_option ::= PASS literal", - /* 15 */ "alter_account_option ::= PPS literal", - /* 16 */ "alter_account_option ::= TSERIES literal", - /* 17 */ "alter_account_option ::= STORAGE literal", - /* 18 */ "alter_account_option ::= STREAMS literal", - /* 19 */ "alter_account_option ::= QTIME literal", - /* 20 */ "alter_account_option ::= DBS literal", - /* 21 */ "alter_account_option ::= USERS literal", - /* 22 */ "alter_account_option ::= CONNS literal", - /* 23 */ "alter_account_option ::= STATE literal", - /* 24 */ "ip_range_list ::= NK_STRING", - /* 25 */ "ip_range_list ::= ip_range_list NK_COMMA NK_STRING", - /* 26 */ "white_list ::= HOST ip_range_list", - /* 27 */ "white_list_opt ::=", - /* 28 */ "white_list_opt ::= white_list", - /* 29 */ "is_import_opt ::=", - /* 30 */ "is_import_opt ::= IS_IMPORT NK_INTEGER", - /* 31 */ "is_createdb_opt ::=", - /* 32 */ "is_createdb_opt ::= CREATEDB NK_INTEGER", - /* 33 */ "cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt is_createdb_opt is_import_opt white_list_opt", - /* 34 */ "cmd ::= ALTER USER user_name PASS NK_STRING", - /* 35 */ "cmd ::= ALTER USER user_name ENABLE NK_INTEGER", - /* 36 */ "cmd ::= ALTER USER user_name SYSINFO NK_INTEGER", - /* 37 */ "cmd ::= ALTER USER user_name CREATEDB NK_INTEGER", - /* 38 */ "cmd ::= ALTER USER user_name ADD white_list", - /* 39 */ "cmd ::= ALTER USER user_name DROP white_list", - /* 40 */ "cmd ::= DROP USER user_name", - /* 41 */ "sysinfo_opt ::=", - /* 42 */ "sysinfo_opt ::= SYSINFO NK_INTEGER", - /* 43 */ "cmd ::= GRANT privileges ON priv_level with_clause_opt TO user_name", - /* 44 */ "cmd ::= REVOKE privileges ON priv_level with_clause_opt FROM user_name", - /* 45 */ "privileges ::= ALL", - /* 46 */ "privileges ::= priv_type_list", - /* 47 */ "privileges ::= SUBSCRIBE", - /* 48 */ "priv_type_list ::= priv_type", - /* 49 */ "priv_type_list ::= priv_type_list NK_COMMA priv_type", - /* 50 */ "priv_type ::= READ", - /* 51 */ "priv_type ::= WRITE", - /* 52 */ "priv_type ::= ALTER", - /* 53 */ "priv_level ::= NK_STAR NK_DOT NK_STAR", - /* 54 */ "priv_level ::= db_name NK_DOT NK_STAR", - /* 55 */ "priv_level ::= db_name NK_DOT table_name", - /* 56 */ "priv_level ::= topic_name", - /* 57 */ "with_clause_opt ::=", - /* 58 */ "with_clause_opt ::= WITH search_condition", - /* 59 */ "cmd ::= CREATE ENCRYPT_KEY NK_STRING", - /* 60 */ "cmd ::= CREATE ANODE NK_STRING", - /* 61 */ "cmd ::= UPDATE ANODE NK_INTEGER", - /* 62 */ "cmd ::= UPDATE ALL ANODES", - /* 63 */ "cmd ::= DROP ANODE NK_INTEGER", - /* 64 */ "cmd ::= CREATE DNODE dnode_endpoint", - /* 65 */ "cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER", - /* 66 */ "cmd ::= DROP DNODE NK_INTEGER force_opt", - /* 67 */ "cmd ::= DROP DNODE dnode_endpoint force_opt", - /* 68 */ "cmd ::= DROP DNODE NK_INTEGER unsafe_opt", - /* 69 */ "cmd ::= DROP DNODE dnode_endpoint unsafe_opt", - /* 70 */ "cmd ::= ALTER DNODE NK_INTEGER NK_STRING", - /* 71 */ "cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING", - /* 72 */ "cmd ::= ALTER ALL DNODES NK_STRING", - /* 73 */ "cmd ::= ALTER ALL DNODES NK_STRING NK_STRING", - /* 74 */ "cmd ::= RESTORE DNODE NK_INTEGER", - /* 75 */ "dnode_endpoint ::= NK_STRING", - /* 76 */ "dnode_endpoint ::= NK_ID", - /* 77 */ "dnode_endpoint ::= NK_IPTOKEN", - /* 78 */ "force_opt ::=", - /* 79 */ "force_opt ::= FORCE", - /* 80 */ "unsafe_opt ::= UNSAFE", - /* 81 */ "cmd ::= ALTER CLUSTER NK_STRING", - /* 82 */ "cmd ::= ALTER CLUSTER NK_STRING NK_STRING", - /* 83 */ "cmd ::= ALTER LOCAL NK_STRING", - /* 84 */ "cmd ::= ALTER LOCAL NK_STRING NK_STRING", - /* 85 */ "cmd ::= CREATE QNODE ON DNODE NK_INTEGER", - /* 86 */ "cmd ::= DROP QNODE ON DNODE NK_INTEGER", - /* 87 */ "cmd ::= RESTORE QNODE ON DNODE NK_INTEGER", - /* 88 */ "cmd ::= CREATE BNODE ON DNODE NK_INTEGER", - /* 89 */ "cmd ::= DROP BNODE ON DNODE NK_INTEGER", - /* 90 */ "cmd ::= CREATE SNODE ON DNODE NK_INTEGER", - /* 91 */ "cmd ::= DROP SNODE ON DNODE NK_INTEGER", - /* 92 */ "cmd ::= CREATE MNODE ON DNODE NK_INTEGER", - /* 93 */ "cmd ::= DROP MNODE ON DNODE NK_INTEGER", - /* 94 */ "cmd ::= RESTORE MNODE ON DNODE NK_INTEGER", - /* 95 */ "cmd ::= RESTORE VNODE ON DNODE NK_INTEGER", - /* 96 */ "cmd ::= CREATE DATABASE not_exists_opt db_name db_options", - /* 97 */ "cmd ::= DROP DATABASE exists_opt db_name", - /* 98 */ "cmd ::= USE db_name", - /* 99 */ "cmd ::= ALTER DATABASE db_name alter_db_options", - /* 100 */ "cmd ::= FLUSH DATABASE db_name", - /* 101 */ "cmd ::= TRIM DATABASE db_name speed_opt", - /* 102 */ "cmd ::= S3MIGRATE DATABASE db_name", - /* 103 */ "cmd ::= COMPACT DATABASE db_name start_opt end_opt", - /* 104 */ "not_exists_opt ::= IF NOT EXISTS", - /* 105 */ "not_exists_opt ::=", - /* 106 */ "exists_opt ::= IF EXISTS", - /* 107 */ "exists_opt ::=", - /* 108 */ "db_options ::=", - /* 109 */ "db_options ::= db_options BUFFER NK_INTEGER", - /* 110 */ "db_options ::= db_options CACHEMODEL NK_STRING", - /* 111 */ "db_options ::= db_options CACHESIZE NK_INTEGER", - /* 112 */ "db_options ::= db_options COMP NK_INTEGER", - /* 113 */ "db_options ::= db_options DURATION NK_INTEGER", - /* 114 */ "db_options ::= db_options DURATION NK_VARIABLE", - /* 115 */ "db_options ::= db_options MAXROWS NK_INTEGER", - /* 116 */ "db_options ::= db_options MINROWS NK_INTEGER", - /* 117 */ "db_options ::= db_options KEEP integer_list", - /* 118 */ "db_options ::= db_options KEEP variable_list", - /* 119 */ "db_options ::= db_options PAGES NK_INTEGER", - /* 120 */ "db_options ::= db_options PAGESIZE NK_INTEGER", - /* 121 */ "db_options ::= db_options TSDB_PAGESIZE NK_INTEGER", - /* 122 */ "db_options ::= db_options PRECISION NK_STRING", - /* 123 */ "db_options ::= db_options REPLICA NK_INTEGER", - /* 124 */ "db_options ::= db_options VGROUPS NK_INTEGER", - /* 125 */ "db_options ::= db_options SINGLE_STABLE NK_INTEGER", - /* 126 */ "db_options ::= db_options RETENTIONS retention_list", - /* 127 */ "db_options ::= db_options SCHEMALESS NK_INTEGER", - /* 128 */ "db_options ::= db_options WAL_LEVEL NK_INTEGER", - /* 129 */ "db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER", - /* 130 */ "db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER", - /* 131 */ "db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER", - /* 132 */ "db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER", - /* 133 */ "db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER", - /* 134 */ "db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER", - /* 135 */ "db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER", - /* 136 */ "db_options ::= db_options STT_TRIGGER NK_INTEGER", - /* 137 */ "db_options ::= db_options TABLE_PREFIX signed", - /* 138 */ "db_options ::= db_options TABLE_SUFFIX signed", - /* 139 */ "db_options ::= db_options S3_CHUNKSIZE NK_INTEGER", - /* 140 */ "db_options ::= db_options S3_KEEPLOCAL NK_INTEGER", - /* 141 */ "db_options ::= db_options S3_KEEPLOCAL NK_VARIABLE", - /* 142 */ "db_options ::= db_options S3_COMPACT NK_INTEGER", - /* 143 */ "db_options ::= db_options KEEP_TIME_OFFSET NK_INTEGER", - /* 144 */ "db_options ::= db_options ENCRYPT_ALGORITHM NK_STRING", - /* 145 */ "alter_db_options ::= alter_db_option", - /* 146 */ "alter_db_options ::= alter_db_options alter_db_option", - /* 147 */ "alter_db_option ::= BUFFER NK_INTEGER", - /* 148 */ "alter_db_option ::= CACHEMODEL NK_STRING", - /* 149 */ "alter_db_option ::= CACHESIZE NK_INTEGER", - /* 150 */ "alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER", - /* 151 */ "alter_db_option ::= KEEP integer_list", - /* 152 */ "alter_db_option ::= KEEP variable_list", - /* 153 */ "alter_db_option ::= PAGES NK_INTEGER", - /* 154 */ "alter_db_option ::= REPLICA NK_INTEGER", - /* 155 */ "alter_db_option ::= WAL_LEVEL NK_INTEGER", - /* 156 */ "alter_db_option ::= STT_TRIGGER NK_INTEGER", - /* 157 */ "alter_db_option ::= MINROWS NK_INTEGER", - /* 158 */ "alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER", - /* 159 */ "alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER", - /* 160 */ "alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER", - /* 161 */ "alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER", - /* 162 */ "alter_db_option ::= S3_KEEPLOCAL NK_INTEGER", - /* 163 */ "alter_db_option ::= S3_KEEPLOCAL NK_VARIABLE", - /* 164 */ "alter_db_option ::= S3_COMPACT NK_INTEGER", - /* 165 */ "alter_db_option ::= KEEP_TIME_OFFSET NK_INTEGER", - /* 166 */ "alter_db_option ::= ENCRYPT_ALGORITHM NK_STRING", - /* 167 */ "integer_list ::= NK_INTEGER", - /* 168 */ "integer_list ::= integer_list NK_COMMA NK_INTEGER", - /* 169 */ "variable_list ::= NK_VARIABLE", - /* 170 */ "variable_list ::= variable_list NK_COMMA NK_VARIABLE", - /* 171 */ "retention_list ::= retention", - /* 172 */ "retention_list ::= retention_list NK_COMMA retention", - /* 173 */ "retention ::= NK_VARIABLE NK_COLON NK_VARIABLE", - /* 174 */ "retention ::= NK_MINUS NK_COLON NK_VARIABLE", - /* 175 */ "speed_opt ::=", - /* 176 */ "speed_opt ::= BWLIMIT NK_INTEGER", - /* 177 */ "start_opt ::=", - /* 178 */ "start_opt ::= START WITH NK_INTEGER", - /* 179 */ "start_opt ::= START WITH NK_STRING", - /* 180 */ "start_opt ::= START WITH TIMESTAMP NK_STRING", - /* 181 */ "end_opt ::=", - /* 182 */ "end_opt ::= END WITH NK_INTEGER", - /* 183 */ "end_opt ::= END WITH NK_STRING", - /* 184 */ "end_opt ::= END WITH TIMESTAMP NK_STRING", - /* 185 */ "cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options", - /* 186 */ "cmd ::= CREATE TABLE multi_create_clause", - /* 187 */ "cmd ::= CREATE TABLE not_exists_opt USING full_table_name NK_LP tag_list_opt NK_RP FILE NK_STRING", - /* 188 */ "cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options", - /* 189 */ "cmd ::= DROP TABLE with_opt multi_drop_clause", - /* 190 */ "cmd ::= DROP STABLE with_opt exists_opt full_table_name", - /* 191 */ "cmd ::= ALTER TABLE alter_table_clause", - /* 192 */ "cmd ::= ALTER STABLE alter_table_clause", - /* 193 */ "alter_table_clause ::= full_table_name alter_table_options", - /* 194 */ "alter_table_clause ::= full_table_name ADD COLUMN column_name type_name column_options", - /* 195 */ "alter_table_clause ::= full_table_name DROP COLUMN column_name", - /* 196 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name", - /* 197 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name column_options", - /* 198 */ "alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name", - /* 199 */ "alter_table_clause ::= full_table_name ADD TAG column_name type_name", - /* 200 */ "alter_table_clause ::= full_table_name DROP TAG column_name", - /* 201 */ "alter_table_clause ::= full_table_name MODIFY TAG column_name type_name", - /* 202 */ "alter_table_clause ::= full_table_name RENAME TAG column_name column_name", - /* 203 */ "alter_table_clause ::= full_table_name SET TAG column_name NK_EQ tags_literal", - /* 204 */ "multi_create_clause ::= create_subtable_clause", - /* 205 */ "multi_create_clause ::= multi_create_clause create_subtable_clause", - /* 206 */ "create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP tags_literal_list NK_RP table_options", - /* 207 */ "multi_drop_clause ::= drop_table_clause", - /* 208 */ "multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause", - /* 209 */ "drop_table_clause ::= exists_opt full_table_name", - /* 210 */ "with_opt ::=", - /* 211 */ "with_opt ::= WITH", - /* 212 */ "specific_cols_opt ::=", - /* 213 */ "specific_cols_opt ::= NK_LP col_name_list NK_RP", - /* 214 */ "full_table_name ::= table_name", - /* 215 */ "full_table_name ::= db_name NK_DOT table_name", - /* 216 */ "tag_def_list ::= tag_def", - /* 217 */ "tag_def_list ::= tag_def_list NK_COMMA tag_def", - /* 218 */ "tag_def ::= column_name type_name", - /* 219 */ "column_def_list ::= column_def", - /* 220 */ "column_def_list ::= column_def_list NK_COMMA column_def", - /* 221 */ "column_def ::= column_name type_name column_options", - /* 222 */ "type_name ::= BOOL", - /* 223 */ "type_name ::= TINYINT", - /* 224 */ "type_name ::= SMALLINT", - /* 225 */ "type_name ::= INT", - /* 226 */ "type_name ::= INTEGER", - /* 227 */ "type_name ::= BIGINT", - /* 228 */ "type_name ::= FLOAT", - /* 229 */ "type_name ::= DOUBLE", - /* 230 */ "type_name ::= BINARY NK_LP NK_INTEGER NK_RP", - /* 231 */ "type_name ::= TIMESTAMP", - /* 232 */ "type_name ::= NCHAR NK_LP NK_INTEGER NK_RP", - /* 233 */ "type_name ::= TINYINT UNSIGNED", - /* 234 */ "type_name ::= SMALLINT UNSIGNED", - /* 235 */ "type_name ::= INT UNSIGNED", - /* 236 */ "type_name ::= BIGINT UNSIGNED", - /* 237 */ "type_name ::= JSON", - /* 238 */ "type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP", - /* 239 */ "type_name ::= MEDIUMBLOB", - /* 240 */ "type_name ::= BLOB", - /* 241 */ "type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP", - /* 242 */ "type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP", - /* 243 */ "type_name ::= DECIMAL", - /* 244 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP", - /* 245 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", - /* 246 */ "type_name_default_len ::= BINARY", - /* 247 */ "type_name_default_len ::= NCHAR", - /* 248 */ "type_name_default_len ::= VARCHAR", - /* 249 */ "type_name_default_len ::= VARBINARY", - /* 250 */ "tags_def_opt ::=", - /* 251 */ "tags_def_opt ::= tags_def", - /* 252 */ "tags_def ::= TAGS NK_LP tag_def_list NK_RP", - /* 253 */ "table_options ::=", - /* 254 */ "table_options ::= table_options COMMENT NK_STRING", - /* 255 */ "table_options ::= table_options MAX_DELAY duration_list", - /* 256 */ "table_options ::= table_options WATERMARK duration_list", - /* 257 */ "table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP", - /* 258 */ "table_options ::= table_options TTL NK_INTEGER", - /* 259 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP", - /* 260 */ "table_options ::= table_options DELETE_MARK duration_list", - /* 261 */ "alter_table_options ::= alter_table_option", - /* 262 */ "alter_table_options ::= alter_table_options alter_table_option", - /* 263 */ "alter_table_option ::= COMMENT NK_STRING", - /* 264 */ "alter_table_option ::= TTL NK_INTEGER", - /* 265 */ "duration_list ::= duration_literal", - /* 266 */ "duration_list ::= duration_list NK_COMMA duration_literal", - /* 267 */ "rollup_func_list ::= rollup_func_name", - /* 268 */ "rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name", - /* 269 */ "rollup_func_name ::= function_name", - /* 270 */ "rollup_func_name ::= FIRST", - /* 271 */ "rollup_func_name ::= LAST", - /* 272 */ "col_name_list ::= col_name", - /* 273 */ "col_name_list ::= col_name_list NK_COMMA col_name", - /* 274 */ "col_name ::= column_name", - /* 275 */ "cmd ::= SHOW DNODES", - /* 276 */ "cmd ::= SHOW USERS", - /* 277 */ "cmd ::= SHOW USERS FULL", - /* 278 */ "cmd ::= SHOW USER PRIVILEGES", - /* 279 */ "cmd ::= SHOW db_kind_opt DATABASES", - /* 280 */ "cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt", - /* 281 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt", - /* 282 */ "cmd ::= SHOW db_name_cond_opt VGROUPS", - /* 283 */ "cmd ::= SHOW MNODES", - /* 284 */ "cmd ::= SHOW QNODES", - /* 285 */ "cmd ::= SHOW ANODES", - /* 286 */ "cmd ::= SHOW ANODES FULL", - /* 287 */ "cmd ::= SHOW ARBGROUPS", - /* 288 */ "cmd ::= SHOW FUNCTIONS", - /* 289 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt", - /* 290 */ "cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name", - /* 291 */ "cmd ::= SHOW STREAMS", - /* 292 */ "cmd ::= SHOW ACCOUNTS", - /* 293 */ "cmd ::= SHOW APPS", - /* 294 */ "cmd ::= SHOW CONNECTIONS", - /* 295 */ "cmd ::= SHOW LICENCES", - /* 296 */ "cmd ::= SHOW GRANTS", - /* 297 */ "cmd ::= SHOW GRANTS FULL", - /* 298 */ "cmd ::= SHOW GRANTS LOGS", - /* 299 */ "cmd ::= SHOW CLUSTER MACHINES", - /* 300 */ "cmd ::= SHOW CREATE DATABASE db_name", - /* 301 */ "cmd ::= SHOW CREATE TABLE full_table_name", - /* 302 */ "cmd ::= SHOW CREATE STABLE full_table_name", - /* 303 */ "cmd ::= SHOW ENCRYPTIONS", - /* 304 */ "cmd ::= SHOW QUERIES", - /* 305 */ "cmd ::= SHOW SCORES", - /* 306 */ "cmd ::= SHOW TOPICS", - /* 307 */ "cmd ::= SHOW VARIABLES", - /* 308 */ "cmd ::= SHOW CLUSTER VARIABLES", - /* 309 */ "cmd ::= SHOW LOCAL VARIABLES", - /* 310 */ "cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt", - /* 311 */ "cmd ::= SHOW BNODES", - /* 312 */ "cmd ::= SHOW SNODES", - /* 313 */ "cmd ::= SHOW CLUSTER", - /* 314 */ "cmd ::= SHOW TRANSACTIONS", - /* 315 */ "cmd ::= SHOW TABLE DISTRIBUTED full_table_name", - /* 316 */ "cmd ::= SHOW CONSUMERS", - /* 317 */ "cmd ::= SHOW SUBSCRIPTIONS", - /* 318 */ "cmd ::= SHOW TAGS FROM table_name_cond from_db_opt", - /* 319 */ "cmd ::= SHOW TAGS FROM db_name NK_DOT table_name", - /* 320 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt", - /* 321 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name", - /* 322 */ "cmd ::= SHOW VNODES ON DNODE NK_INTEGER", - /* 323 */ "cmd ::= SHOW VNODES", - /* 324 */ "cmd ::= SHOW db_name_cond_opt ALIVE", - /* 325 */ "cmd ::= SHOW CLUSTER ALIVE", - /* 326 */ "cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt", - /* 327 */ "cmd ::= SHOW CREATE VIEW full_table_name", - /* 328 */ "cmd ::= SHOW COMPACTS", - /* 329 */ "cmd ::= SHOW COMPACT NK_INTEGER", - /* 330 */ "table_kind_db_name_cond_opt ::=", - /* 331 */ "table_kind_db_name_cond_opt ::= table_kind", - /* 332 */ "table_kind_db_name_cond_opt ::= db_name NK_DOT", - /* 333 */ "table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT", - /* 334 */ "table_kind ::= NORMAL", - /* 335 */ "table_kind ::= CHILD", - /* 336 */ "db_name_cond_opt ::=", - /* 337 */ "db_name_cond_opt ::= db_name NK_DOT", - /* 338 */ "like_pattern_opt ::=", - /* 339 */ "like_pattern_opt ::= LIKE NK_STRING", - /* 340 */ "table_name_cond ::= table_name", - /* 341 */ "from_db_opt ::=", - /* 342 */ "from_db_opt ::= FROM db_name", - /* 343 */ "tag_list_opt ::=", - /* 344 */ "tag_list_opt ::= tag_item", - /* 345 */ "tag_list_opt ::= tag_list_opt NK_COMMA tag_item", - /* 346 */ "tag_item ::= TBNAME", - /* 347 */ "tag_item ::= QTAGS", - /* 348 */ "tag_item ::= column_name", - /* 349 */ "tag_item ::= column_name column_alias", - /* 350 */ "tag_item ::= column_name AS column_alias", - /* 351 */ "db_kind_opt ::=", - /* 352 */ "db_kind_opt ::= USER", - /* 353 */ "db_kind_opt ::= SYSTEM", - /* 354 */ "cmd ::= CREATE TSMA not_exists_opt tsma_name ON full_table_name tsma_func_list INTERVAL NK_LP duration_literal NK_RP", - /* 355 */ "cmd ::= CREATE RECURSIVE TSMA not_exists_opt tsma_name ON full_table_name INTERVAL NK_LP duration_literal NK_RP", - /* 356 */ "cmd ::= DROP TSMA exists_opt full_tsma_name", - /* 357 */ "cmd ::= SHOW db_name_cond_opt TSMAS", - /* 358 */ "full_tsma_name ::= tsma_name", - /* 359 */ "full_tsma_name ::= db_name NK_DOT tsma_name", - /* 360 */ "tsma_func_list ::= FUNCTION NK_LP func_list NK_RP", - /* 361 */ "cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options", - /* 362 */ "cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP", - /* 363 */ "cmd ::= DROP INDEX exists_opt full_index_name", - /* 364 */ "full_index_name ::= index_name", - /* 365 */ "full_index_name ::= db_name NK_DOT index_name", - /* 366 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt", - /* 367 */ "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", - /* 368 */ "func_list ::= func", - /* 369 */ "func_list ::= func_list NK_COMMA func", - /* 370 */ "func ::= sma_func_name NK_LP expression_list NK_RP", - /* 371 */ "sma_func_name ::= function_name", - /* 372 */ "sma_func_name ::= COUNT", - /* 373 */ "sma_func_name ::= FIRST", - /* 374 */ "sma_func_name ::= LAST", - /* 375 */ "sma_func_name ::= LAST_ROW", - /* 376 */ "sma_stream_opt ::=", - /* 377 */ "sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal", - /* 378 */ "sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal", - /* 379 */ "sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal", - /* 380 */ "with_meta ::= AS", - /* 381 */ "with_meta ::= WITH META AS", - /* 382 */ "with_meta ::= ONLY META AS", - /* 383 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery", - /* 384 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name", - /* 385 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt", - /* 386 */ "cmd ::= DROP TOPIC exists_opt topic_name", - /* 387 */ "cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name", - /* 388 */ "cmd ::= DESC full_table_name", - /* 389 */ "cmd ::= DESCRIBE full_table_name", - /* 390 */ "cmd ::= RESET QUERY CACHE", - /* 391 */ "cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery", - /* 392 */ "cmd ::= EXPLAIN analyze_opt explain_options insert_query", - /* 393 */ "analyze_opt ::=", - /* 394 */ "analyze_opt ::= ANALYZE", - /* 395 */ "explain_options ::=", - /* 396 */ "explain_options ::= explain_options VERBOSE NK_BOOL", - /* 397 */ "explain_options ::= explain_options RATIO NK_FLOAT", - /* 398 */ "cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt", - /* 399 */ "cmd ::= DROP FUNCTION exists_opt function_name", - /* 400 */ "agg_func_opt ::=", - /* 401 */ "agg_func_opt ::= AGGREGATE", - /* 402 */ "bufsize_opt ::=", - /* 403 */ "bufsize_opt ::= BUFSIZE NK_INTEGER", - /* 404 */ "language_opt ::=", - /* 405 */ "language_opt ::= LANGUAGE NK_STRING", - /* 406 */ "or_replace_opt ::=", - /* 407 */ "or_replace_opt ::= OR REPLACE", - /* 408 */ "cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery", - /* 409 */ "cmd ::= DROP VIEW exists_opt full_view_name", - /* 410 */ "full_view_name ::= view_name", - /* 411 */ "full_view_name ::= db_name NK_DOT view_name", - /* 412 */ "cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery", - /* 413 */ "cmd ::= DROP STREAM exists_opt stream_name", - /* 414 */ "cmd ::= PAUSE STREAM exists_opt stream_name", - /* 415 */ "cmd ::= RESUME STREAM exists_opt ignore_opt stream_name", - /* 416 */ "col_list_opt ::=", - /* 417 */ "col_list_opt ::= NK_LP column_stream_def_list NK_RP", - /* 418 */ "column_stream_def_list ::= column_stream_def", - /* 419 */ "column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def", - /* 420 */ "column_stream_def ::= column_name stream_col_options", - /* 421 */ "stream_col_options ::=", - /* 422 */ "stream_col_options ::= stream_col_options PRIMARY KEY", - /* 423 */ "tag_def_or_ref_opt ::=", - /* 424 */ "tag_def_or_ref_opt ::= tags_def", - /* 425 */ "tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP", - /* 426 */ "stream_options ::=", - /* 427 */ "stream_options ::= stream_options TRIGGER AT_ONCE", - /* 428 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE", - /* 429 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal", - /* 430 */ "stream_options ::= stream_options WATERMARK duration_literal", - /* 431 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER", - /* 432 */ "stream_options ::= stream_options FILL_HISTORY NK_INTEGER", - /* 433 */ "stream_options ::= stream_options DELETE_MARK duration_literal", - /* 434 */ "stream_options ::= stream_options IGNORE UPDATE NK_INTEGER", - /* 435 */ "subtable_opt ::=", - /* 436 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP", - /* 437 */ "ignore_opt ::=", - /* 438 */ "ignore_opt ::= IGNORE UNTREATED", - /* 439 */ "cmd ::= KILL CONNECTION NK_INTEGER", - /* 440 */ "cmd ::= KILL QUERY NK_STRING", - /* 441 */ "cmd ::= KILL TRANSACTION NK_INTEGER", - /* 442 */ "cmd ::= KILL COMPACT NK_INTEGER", - /* 443 */ "cmd ::= BALANCE VGROUP", - /* 444 */ "cmd ::= BALANCE VGROUP LEADER on_vgroup_id", - /* 445 */ "cmd ::= BALANCE VGROUP LEADER DATABASE db_name", - /* 446 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", - /* 447 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", - /* 448 */ "cmd ::= SPLIT VGROUP NK_INTEGER", - /* 449 */ "on_vgroup_id ::=", - /* 450 */ "on_vgroup_id ::= ON NK_INTEGER", - /* 451 */ "dnode_list ::= DNODE NK_INTEGER", - /* 452 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", - /* 453 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", - /* 454 */ "cmd ::= query_or_subquery", - /* 455 */ "cmd ::= insert_query", - /* 456 */ "insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery", - /* 457 */ "insert_query ::= INSERT INTO full_table_name query_or_subquery", - /* 458 */ "tags_literal ::= NK_INTEGER", - /* 459 */ "tags_literal ::= NK_INTEGER NK_PLUS duration_literal", - /* 460 */ "tags_literal ::= NK_INTEGER NK_MINUS duration_literal", - /* 461 */ "tags_literal ::= NK_PLUS NK_INTEGER", - /* 462 */ "tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal", - /* 463 */ "tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal", - /* 464 */ "tags_literal ::= NK_MINUS NK_INTEGER", - /* 465 */ "tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal", - /* 466 */ "tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal", - /* 467 */ "tags_literal ::= NK_FLOAT", - /* 468 */ "tags_literal ::= NK_PLUS NK_FLOAT", - /* 469 */ "tags_literal ::= NK_MINUS NK_FLOAT", - /* 470 */ "tags_literal ::= NK_BIN", - /* 471 */ "tags_literal ::= NK_BIN NK_PLUS duration_literal", - /* 472 */ "tags_literal ::= NK_BIN NK_MINUS duration_literal", - /* 473 */ "tags_literal ::= NK_PLUS NK_BIN", - /* 474 */ "tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal", - /* 475 */ "tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal", - /* 476 */ "tags_literal ::= NK_MINUS NK_BIN", - /* 477 */ "tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal", - /* 478 */ "tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal", - /* 479 */ "tags_literal ::= NK_HEX", - /* 480 */ "tags_literal ::= NK_HEX NK_PLUS duration_literal", - /* 481 */ "tags_literal ::= NK_HEX NK_MINUS duration_literal", - /* 482 */ "tags_literal ::= NK_PLUS NK_HEX", - /* 483 */ "tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal", - /* 484 */ "tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal", - /* 485 */ "tags_literal ::= NK_MINUS NK_HEX", - /* 486 */ "tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal", - /* 487 */ "tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal", - /* 488 */ "tags_literal ::= NK_STRING", - /* 489 */ "tags_literal ::= NK_STRING NK_PLUS duration_literal", - /* 490 */ "tags_literal ::= NK_STRING NK_MINUS duration_literal", - /* 491 */ "tags_literal ::= NK_BOOL", - /* 492 */ "tags_literal ::= NULL", - /* 493 */ "tags_literal ::= literal_func", - /* 494 */ "tags_literal ::= literal_func NK_PLUS duration_literal", - /* 495 */ "tags_literal ::= literal_func NK_MINUS duration_literal", - /* 496 */ "tags_literal_list ::= tags_literal", - /* 497 */ "tags_literal_list ::= tags_literal_list NK_COMMA tags_literal", - /* 498 */ "literal ::= NK_INTEGER", - /* 499 */ "literal ::= NK_FLOAT", - /* 500 */ "literal ::= NK_STRING", - /* 501 */ "literal ::= NK_BOOL", - /* 502 */ "literal ::= TIMESTAMP NK_STRING", - /* 503 */ "literal ::= duration_literal", - /* 504 */ "literal ::= NULL", - /* 505 */ "literal ::= NK_QUESTION", - /* 506 */ "duration_literal ::= NK_VARIABLE", - /* 507 */ "signed ::= NK_INTEGER", - /* 508 */ "signed ::= NK_PLUS NK_INTEGER", - /* 509 */ "signed ::= NK_MINUS NK_INTEGER", - /* 510 */ "signed ::= NK_FLOAT", - /* 511 */ "signed ::= NK_PLUS NK_FLOAT", - /* 512 */ "signed ::= NK_MINUS NK_FLOAT", - /* 513 */ "signed_literal ::= signed", - /* 514 */ "signed_literal ::= NK_STRING", - /* 515 */ "signed_literal ::= NK_BOOL", - /* 516 */ "signed_literal ::= TIMESTAMP NK_STRING", - /* 517 */ "signed_literal ::= duration_literal", - /* 518 */ "signed_literal ::= NULL", - /* 519 */ "signed_literal ::= literal_func", - /* 520 */ "signed_literal ::= NK_QUESTION", - /* 521 */ "literal_list ::= signed_literal", - /* 522 */ "literal_list ::= literal_list NK_COMMA signed_literal", - /* 523 */ "db_name ::= NK_ID", - /* 524 */ "table_name ::= NK_ID", - /* 525 */ "column_name ::= NK_ID", - /* 526 */ "function_name ::= NK_ID", - /* 527 */ "view_name ::= NK_ID", - /* 528 */ "table_alias ::= NK_ID", - /* 529 */ "column_alias ::= NK_ID", - /* 530 */ "column_alias ::= NK_ALIAS", - /* 531 */ "user_name ::= NK_ID", - /* 532 */ "topic_name ::= NK_ID", - /* 533 */ "stream_name ::= NK_ID", - /* 534 */ "cgroup_name ::= NK_ID", - /* 535 */ "index_name ::= NK_ID", - /* 536 */ "tsma_name ::= NK_ID", - /* 537 */ "expr_or_subquery ::= expression", - /* 538 */ "expression ::= literal", - /* 539 */ "expression ::= pseudo_column", - /* 540 */ "expression ::= column_reference", - /* 541 */ "expression ::= function_expression", - /* 542 */ "expression ::= case_when_expression", - /* 543 */ "expression ::= NK_LP expression NK_RP", - /* 544 */ "expression ::= NK_PLUS expr_or_subquery", - /* 545 */ "expression ::= NK_MINUS expr_or_subquery", - /* 546 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery", - /* 547 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery", - /* 548 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery", - /* 549 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery", - /* 550 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery", - /* 551 */ "expression ::= column_reference NK_ARROW NK_STRING", - /* 552 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery", - /* 553 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery", - /* 554 */ "expression_list ::= expr_or_subquery", - /* 555 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery", - /* 556 */ "column_reference ::= column_name", - /* 557 */ "column_reference ::= table_name NK_DOT column_name", - /* 558 */ "column_reference ::= NK_ALIAS", - /* 559 */ "column_reference ::= table_name NK_DOT NK_ALIAS", - /* 560 */ "pseudo_column ::= ROWTS", - /* 561 */ "pseudo_column ::= TBNAME", - /* 562 */ "pseudo_column ::= table_name NK_DOT TBNAME", - /* 563 */ "pseudo_column ::= QSTART", - /* 564 */ "pseudo_column ::= QEND", - /* 565 */ "pseudo_column ::= QDURATION", - /* 566 */ "pseudo_column ::= WSTART", - /* 567 */ "pseudo_column ::= WEND", - /* 568 */ "pseudo_column ::= WDURATION", - /* 569 */ "pseudo_column ::= IROWTS", - /* 570 */ "pseudo_column ::= ISFILLED", - /* 571 */ "pseudo_column ::= QTAGS", - /* 572 */ "pseudo_column ::= FLOW", - /* 573 */ "pseudo_column ::= FHIGH", - /* 574 */ "pseudo_column ::= FROWTS", - /* 575 */ "function_expression ::= function_name NK_LP expression_list NK_RP", - /* 576 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", - /* 577 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP", - /* 578 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP", - /* 579 */ "function_expression ::= POSITION NK_LP expr_or_subquery IN expr_or_subquery NK_RP", - /* 580 */ "function_expression ::= TRIM NK_LP expr_or_subquery NK_RP", - /* 581 */ "function_expression ::= TRIM NK_LP trim_specification_type FROM expr_or_subquery NK_RP", - /* 582 */ "function_expression ::= TRIM NK_LP expr_or_subquery FROM expr_or_subquery NK_RP", - /* 583 */ "function_expression ::= TRIM NK_LP trim_specification_type expr_or_subquery FROM expr_or_subquery NK_RP", - /* 584 */ "function_expression ::= substr_func NK_LP expression_list NK_RP", - /* 585 */ "function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery NK_RP", - /* 586 */ "function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery FOR expr_or_subquery NK_RP", - /* 587 */ "function_expression ::= REPLACE NK_LP expression_list NK_RP", - /* 588 */ "function_expression ::= literal_func", - /* 589 */ "function_expression ::= rand_func", - /* 590 */ "literal_func ::= noarg_func NK_LP NK_RP", - /* 591 */ "literal_func ::= NOW", - /* 592 */ "literal_func ::= TODAY", - /* 593 */ "rand_func ::= RAND NK_LP NK_RP", - /* 594 */ "rand_func ::= RAND NK_LP expression_list NK_RP", - /* 595 */ "substr_func ::= SUBSTR", - /* 596 */ "substr_func ::= SUBSTRING", - /* 597 */ "trim_specification_type ::= BOTH", - /* 598 */ "trim_specification_type ::= TRAILING", - /* 599 */ "trim_specification_type ::= LEADING", - /* 600 */ "noarg_func ::= NOW", - /* 601 */ "noarg_func ::= TODAY", - /* 602 */ "noarg_func ::= TIMEZONE", - /* 603 */ "noarg_func ::= DATABASE", - /* 604 */ "noarg_func ::= CLIENT_VERSION", - /* 605 */ "noarg_func ::= SERVER_VERSION", - /* 606 */ "noarg_func ::= SERVER_STATUS", - /* 607 */ "noarg_func ::= CURRENT_USER", - /* 608 */ "noarg_func ::= USER", - /* 609 */ "noarg_func ::= PI", - /* 610 */ "star_func ::= COUNT", - /* 611 */ "star_func ::= FIRST", - /* 612 */ "star_func ::= LAST", - /* 613 */ "star_func ::= LAST_ROW", - /* 614 */ "star_func_para_list ::= NK_STAR", - /* 615 */ "star_func_para_list ::= other_para_list", - /* 616 */ "other_para_list ::= star_func_para", - /* 617 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", - /* 618 */ "star_func_para ::= expr_or_subquery", - /* 619 */ "star_func_para ::= table_name NK_DOT NK_STAR", - /* 620 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END", - /* 621 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END", - /* 622 */ "when_then_list ::= when_then_expr", - /* 623 */ "when_then_list ::= when_then_list when_then_expr", - /* 624 */ "when_then_expr ::= WHEN common_expression THEN common_expression", - /* 625 */ "case_when_else_opt ::=", - /* 626 */ "case_when_else_opt ::= ELSE common_expression", - /* 627 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery", - /* 628 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery", - /* 629 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery", - /* 630 */ "predicate ::= expr_or_subquery IS NULL", - /* 631 */ "predicate ::= expr_or_subquery IS NOT NULL", - /* 632 */ "predicate ::= expr_or_subquery in_op in_predicate_value", - /* 633 */ "compare_op ::= NK_LT", - /* 634 */ "compare_op ::= NK_GT", - /* 635 */ "compare_op ::= NK_LE", - /* 636 */ "compare_op ::= NK_GE", - /* 637 */ "compare_op ::= NK_NE", - /* 638 */ "compare_op ::= NK_EQ", - /* 639 */ "compare_op ::= LIKE", - /* 640 */ "compare_op ::= NOT LIKE", - /* 641 */ "compare_op ::= MATCH", - /* 642 */ "compare_op ::= NMATCH", - /* 643 */ "compare_op ::= CONTAINS", - /* 644 */ "in_op ::= IN", - /* 645 */ "in_op ::= NOT IN", - /* 646 */ "in_predicate_value ::= NK_LP literal_list NK_RP", - /* 647 */ "boolean_value_expression ::= boolean_primary", - /* 648 */ "boolean_value_expression ::= NOT boolean_primary", - /* 649 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", - /* 650 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", - /* 651 */ "boolean_primary ::= predicate", - /* 652 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", - /* 653 */ "common_expression ::= expr_or_subquery", - /* 654 */ "common_expression ::= boolean_value_expression", - /* 655 */ "from_clause_opt ::=", - /* 656 */ "from_clause_opt ::= FROM table_reference_list", - /* 657 */ "table_reference_list ::= table_reference", - /* 658 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", - /* 659 */ "table_reference ::= table_primary", - /* 660 */ "table_reference ::= joined_table", - /* 661 */ "table_primary ::= table_name alias_opt", - /* 662 */ "table_primary ::= db_name NK_DOT table_name alias_opt", - /* 663 */ "table_primary ::= subquery alias_opt", - /* 664 */ "table_primary ::= parenthesized_joined_table", - /* 665 */ "alias_opt ::=", - /* 666 */ "alias_opt ::= table_alias", - /* 667 */ "alias_opt ::= AS table_alias", - /* 668 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", - /* 669 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", - /* 670 */ "joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt", - /* 671 */ "join_type ::=", - /* 672 */ "join_type ::= INNER", - /* 673 */ "join_type ::= LEFT", - /* 674 */ "join_type ::= RIGHT", - /* 675 */ "join_type ::= FULL", - /* 676 */ "join_subtype ::=", - /* 677 */ "join_subtype ::= OUTER", - /* 678 */ "join_subtype ::= SEMI", - /* 679 */ "join_subtype ::= ANTI", - /* 680 */ "join_subtype ::= ASOF", - /* 681 */ "join_subtype ::= WINDOW", - /* 682 */ "join_on_clause_opt ::=", - /* 683 */ "join_on_clause_opt ::= ON search_condition", - /* 684 */ "window_offset_clause_opt ::=", - /* 685 */ "window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP", - /* 686 */ "window_offset_literal ::= NK_VARIABLE", - /* 687 */ "window_offset_literal ::= NK_MINUS NK_VARIABLE", - /* 688 */ "jlimit_clause_opt ::=", - /* 689 */ "jlimit_clause_opt ::= JLIMIT NK_INTEGER", - /* 690 */ "query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_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", - /* 691 */ "hint_list ::=", - /* 692 */ "hint_list ::= NK_HINT", - /* 693 */ "tag_mode_opt ::=", - /* 694 */ "tag_mode_opt ::= TAGS", - /* 695 */ "set_quantifier_opt ::=", - /* 696 */ "set_quantifier_opt ::= DISTINCT", - /* 697 */ "set_quantifier_opt ::= ALL", - /* 698 */ "select_list ::= select_item", - /* 699 */ "select_list ::= select_list NK_COMMA select_item", - /* 700 */ "select_item ::= NK_STAR", - /* 701 */ "select_item ::= common_expression", - /* 702 */ "select_item ::= common_expression column_alias", - /* 703 */ "select_item ::= common_expression AS column_alias", - /* 704 */ "select_item ::= table_name NK_DOT NK_STAR", - /* 705 */ "where_clause_opt ::=", - /* 706 */ "where_clause_opt ::= WHERE search_condition", - /* 707 */ "partition_by_clause_opt ::=", - /* 708 */ "partition_by_clause_opt ::= PARTITION BY partition_list", - /* 709 */ "partition_list ::= partition_item", - /* 710 */ "partition_list ::= partition_list NK_COMMA partition_item", - /* 711 */ "partition_item ::= expr_or_subquery", - /* 712 */ "partition_item ::= expr_or_subquery column_alias", - /* 713 */ "partition_item ::= expr_or_subquery AS column_alias", - /* 714 */ "twindow_clause_opt ::=", - /* 715 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP", - /* 716 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP", - /* 717 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt", - /* 718 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt", - /* 719 */ "twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition", - /* 720 */ "twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP", - /* 721 */ "twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", - /* 722 */ "twindow_clause_opt ::= ANOMALY_WINDOW NK_LP expr_or_subquery NK_RP", - /* 723 */ "twindow_clause_opt ::= ANOMALY_WINDOW NK_LP expr_or_subquery NK_COMMA NK_STRING NK_RP", - /* 724 */ "sliding_opt ::=", - /* 725 */ "sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP", - /* 726 */ "interval_sliding_duration_literal ::= NK_VARIABLE", - /* 727 */ "interval_sliding_duration_literal ::= NK_STRING", - /* 728 */ "interval_sliding_duration_literal ::= NK_INTEGER", - /* 729 */ "fill_opt ::=", - /* 730 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", - /* 731 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP", - /* 732 */ "fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP", - /* 733 */ "fill_mode ::= NONE", - /* 734 */ "fill_mode ::= PREV", - /* 735 */ "fill_mode ::= NULL", - /* 736 */ "fill_mode ::= NULL_F", - /* 737 */ "fill_mode ::= LINEAR", - /* 738 */ "fill_mode ::= NEXT", - /* 739 */ "group_by_clause_opt ::=", - /* 740 */ "group_by_clause_opt ::= GROUP BY group_by_list", - /* 741 */ "group_by_list ::= expr_or_subquery", - /* 742 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery", - /* 743 */ "having_clause_opt ::=", - /* 744 */ "having_clause_opt ::= HAVING search_condition", - /* 745 */ "range_opt ::=", - /* 746 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP", - /* 747 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_RP", - /* 748 */ "every_opt ::=", - /* 749 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", - /* 750 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt", - /* 751 */ "query_simple ::= query_specification", - /* 752 */ "query_simple ::= union_query_expression", - /* 753 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery", - /* 754 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery", - /* 755 */ "query_simple_or_subquery ::= query_simple", - /* 756 */ "query_simple_or_subquery ::= subquery", - /* 757 */ "query_or_subquery ::= query_expression", - /* 758 */ "query_or_subquery ::= subquery", - /* 759 */ "order_by_clause_opt ::=", - /* 760 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", - /* 761 */ "slimit_clause_opt ::=", - /* 762 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", - /* 763 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", - /* 764 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 765 */ "limit_clause_opt ::=", - /* 766 */ "limit_clause_opt ::= LIMIT NK_INTEGER", - /* 767 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", - /* 768 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 769 */ "subquery ::= NK_LP query_expression NK_RP", - /* 770 */ "subquery ::= NK_LP subquery NK_RP", - /* 771 */ "search_condition ::= common_expression", - /* 772 */ "sort_specification_list ::= sort_specification", - /* 773 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", - /* 774 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt", - /* 775 */ "ordering_specification_opt ::=", - /* 776 */ "ordering_specification_opt ::= ASC", - /* 777 */ "ordering_specification_opt ::= DESC", - /* 778 */ "null_ordering_opt ::=", - /* 779 */ "null_ordering_opt ::= NULLS FIRST", - /* 780 */ "null_ordering_opt ::= NULLS LAST", - /* 781 */ "column_options ::=", - /* 782 */ "column_options ::= column_options PRIMARY KEY", - /* 783 */ "column_options ::= column_options NK_ID NK_STRING", -}; -#endif /* NDEBUG */ - - -#if YYSTACKDEPTH<=0 -/* -** Try to increase the size of the parser stack. Return the number -** of errors. Return 0 on success. -*/ -static int yyGrowStack(yyParser *p){ - int newSize; - int idx; - yyStackEntry *pNew; - - newSize = p->yystksz*2 + 100; - idx = p->yytos ? (int)(p->yytos - p->yystack) : 0; - if( p->yystack==&p->yystk0 ){ - pNew = malloc(newSize*sizeof(pNew[0])); - if( pNew ) pNew[0] = p->yystk0; - }else{ - pNew = realloc(p->yystack, newSize*sizeof(pNew[0])); - } - if( pNew ){ - p->yystack = pNew; - p->yytos = &p->yystack[idx]; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sStack grows from %d to %d entries.\n", - yyTracePrompt, p->yystksz, newSize); - } -#endif - p->yystksz = newSize; - } - return pNew==0; -} -#endif - -/* Datatype of the argument to the memory allocated passed as the -** second argument to ParseAlloc() below. This can be changed by -** putting an appropriate #define in the %include section of the input -** grammar. -*/ -#ifndef YYMALLOCARGTYPE -# define YYMALLOCARGTYPE size_t -#endif - -/* Initialize a new parser that has already been allocated. -*/ -void ParseInit(void *yypRawParser ParseCTX_PDECL){ - yyParser *yypParser = (yyParser*)yypRawParser; - ParseCTX_STORE -#ifdef YYTRACKMAXSTACKDEPTH - yypParser->yyhwm = 0; -#endif -#if YYSTACKDEPTH<=0 - yypParser->yytos = NULL; - yypParser->yystack = NULL; - yypParser->yystksz = 0; - if( yyGrowStack(yypParser) ){ - yypParser->yystack = &yypParser->yystk0; - yypParser->yystksz = 1; - } -#endif -#ifndef YYNOERRORRECOVERY - yypParser->yyerrcnt = -1; -#endif - yypParser->yytos = yypParser->yystack; - yypParser->yystack[0].stateno = 0; - yypParser->yystack[0].major = 0; -#if YYSTACKDEPTH>0 - yypParser->yystackEnd = &yypParser->yystack[YYSTACKDEPTH-1]; -#endif -} - -#ifndef Parse_ENGINEALWAYSONSTACK -/* -** This function allocates a new parser. -** The only argument is a pointer to a function which works like -** malloc. -** -** Inputs: -** A pointer to the function used to allocate memory. -** -** Outputs: -** A pointer to a parser. This pointer is used in subsequent calls -** to Parse and ParseFree. -*/ -void *ParseAlloc(void *(*mallocProc)(YYMALLOCARGTYPE) ParseCTX_PDECL){ - yyParser *yypParser; - yypParser = (yyParser*)(*mallocProc)( (YYMALLOCARGTYPE)sizeof(yyParser) ); - if( yypParser ){ - ParseCTX_STORE - ParseInit(yypParser ParseCTX_PARAM); - } - return (void*)yypParser; -} -#endif /* Parse_ENGINEALWAYSONSTACK */ - - -/* The following function deletes the "minor type" or semantic value -** associated with a symbol. The symbol can be either a terminal -** or nonterminal. "yymajor" is the symbol code, and "yypminor" is -** a pointer to the value to be deleted. The code used to do the -** deletions is derived from the %destructor and/or %token_destructor -** directives of the input grammar. -*/ -static void yy_destructor( - yyParser *yypParser, /* The parser */ - YYCODETYPE yymajor, /* Type code for object to destroy */ - YYMINORTYPE *yypminor /* The object to be destroyed */ -){ - ParseARG_FETCH - ParseCTX_FETCH - switch( yymajor ){ - /* Here is inserted the actions which take place when a - ** terminal or non-terminal is destroyed. This can happen - ** when the symbol is popped from the stack during a - ** reduce or during error processing or when a parser is - ** being destroyed before it is finished parsing. - ** - ** Note: during a reduce, the only symbols destroyed are those - ** which appear on the RHS of the rule, but which are *not* used - ** inside the C code. - */ -/********* Begin destructor definitions ***************************************/ - /* Default NON-TERMINAL Destructor */ - case 389: /* cmd */ - case 392: /* literal */ - case 403: /* with_clause_opt */ - case 409: /* search_condition */ - case 414: /* db_options */ - case 416: /* alter_db_options */ - case 418: /* start_opt */ - case 419: /* end_opt */ - case 423: /* signed */ - case 425: /* retention */ - case 426: /* full_table_name */ - case 429: /* table_options */ - case 435: /* alter_table_clause */ - case 436: /* alter_table_options */ - case 439: /* column_options */ - case 440: /* tags_literal */ - case 441: /* create_subtable_clause */ - case 444: /* drop_table_clause */ - case 447: /* tag_def */ - case 448: /* column_def */ - case 453: /* duration_literal */ - case 454: /* rollup_func_name */ - case 456: /* col_name */ - case 459: /* like_pattern_opt */ - case 460: /* db_name_cond_opt */ - case 461: /* table_name_cond */ - case 462: /* from_db_opt */ - case 464: /* tag_item */ - case 468: /* full_tsma_name */ - case 470: /* index_options */ - case 471: /* full_index_name */ - case 473: /* sliding_opt */ - case 474: /* sma_stream_opt */ - case 475: /* func */ - case 479: /* query_or_subquery */ - case 480: /* where_clause_opt */ - case 483: /* explain_options */ - case 484: /* insert_query */ - case 489: /* full_view_name */ - case 492: /* stream_options */ - case 495: /* subtable_opt */ - case 498: /* column_stream_def */ - case 499: /* stream_col_options */ - case 500: /* expression */ - case 503: /* literal_func */ - case 504: /* signed_literal */ - case 507: /* expr_or_subquery */ - case 508: /* pseudo_column */ - case 509: /* column_reference */ - case 510: /* function_expression */ - case 511: /* case_when_expression */ - case 516: /* rand_func */ - case 519: /* star_func_para */ - case 521: /* case_when_else_opt */ - case 522: /* common_expression */ - case 523: /* when_then_expr */ - case 524: /* predicate */ - case 527: /* in_predicate_value */ - case 528: /* boolean_value_expression */ - case 529: /* boolean_primary */ - case 530: /* from_clause_opt */ - case 531: /* table_reference_list */ - case 532: /* table_reference */ - case 533: /* table_primary */ - case 534: /* joined_table */ - case 536: /* subquery */ - case 537: /* parenthesized_joined_table */ - case 540: /* join_on_clause_opt */ - case 541: /* window_offset_clause_opt */ - case 542: /* jlimit_clause_opt */ - case 543: /* window_offset_literal */ - case 544: /* query_specification */ - case 550: /* range_opt */ - case 551: /* every_opt */ - case 552: /* fill_opt */ - case 553: /* twindow_clause_opt */ - case 555: /* having_clause_opt */ - case 556: /* select_item */ - case 558: /* partition_item */ - case 559: /* interval_sliding_duration_literal */ - case 562: /* query_expression */ - case 563: /* query_simple */ - case 565: /* slimit_clause_opt */ - case 566: /* limit_clause_opt */ - case 567: /* union_query_expression */ - case 568: /* query_simple_or_subquery */ - case 570: /* sort_specification */ -{ - nodesDestroyNode((yypminor->yy974)); -} - break; - case 390: /* account_options */ - case 391: /* alter_account_options */ - case 393: /* alter_account_option */ - case 417: /* speed_opt */ - case 478: /* with_meta */ - case 487: /* bufsize_opt */ -{ - -} - break; - case 394: /* ip_range_list */ - case 395: /* white_list */ - case 396: /* white_list_opt */ - case 420: /* integer_list */ - case 421: /* variable_list */ - case 422: /* retention_list */ - case 427: /* column_def_list */ - case 428: /* tags_def_opt */ - case 430: /* multi_create_clause */ - case 431: /* tag_list_opt */ - case 432: /* tags_def */ - case 434: /* multi_drop_clause */ - case 442: /* specific_cols_opt */ - case 443: /* tags_literal_list */ - case 445: /* col_name_list */ - case 446: /* tag_def_list */ - case 450: /* duration_list */ - case 451: /* rollup_func_list */ - case 469: /* func_list */ - case 477: /* expression_list */ - case 493: /* col_list_opt */ - case 494: /* tag_def_or_ref_opt */ - case 497: /* column_stream_def_list */ - case 502: /* dnode_list */ - case 505: /* literal_list */ - case 513: /* star_func_para_list */ - case 518: /* other_para_list */ - case 520: /* when_then_list */ - case 545: /* hint_list */ - case 548: /* select_list */ - case 549: /* partition_by_clause_opt */ - case 554: /* group_by_clause_opt */ - case 557: /* partition_list */ - case 561: /* group_by_list */ - case 564: /* order_by_clause_opt */ - case 569: /* sort_specification_list */ -{ - nodesDestroyList((yypminor->yy946)); -} - break; - case 397: /* is_import_opt */ - case 398: /* is_createdb_opt */ - case 400: /* sysinfo_opt */ -{ - -} - break; - case 399: /* user_name */ - case 406: /* db_name */ - case 407: /* table_name */ - case 408: /* topic_name */ - case 410: /* dnode_endpoint */ - case 437: /* column_name */ - case 455: /* function_name */ - case 465: /* column_alias */ - case 466: /* tsma_name */ - case 472: /* index_name */ - case 476: /* sma_func_name */ - case 481: /* cgroup_name */ - case 488: /* language_opt */ - case 490: /* view_name */ - case 491: /* stream_name */ - case 501: /* on_vgroup_id */ - case 506: /* table_alias */ - case 512: /* star_func */ - case 515: /* substr_func */ - case 517: /* noarg_func */ - case 535: /* alias_opt */ -{ - -} - break; - case 401: /* privileges */ - case 404: /* priv_type_list */ - case 405: /* priv_type */ -{ - -} - break; - case 402: /* priv_level */ -{ - -} - break; - case 411: /* force_opt */ - case 412: /* unsafe_opt */ - case 413: /* not_exists_opt */ - case 415: /* exists_opt */ - case 433: /* with_opt */ - case 482: /* analyze_opt */ - case 485: /* or_replace_opt */ - case 486: /* agg_func_opt */ - case 496: /* ignore_opt */ - case 546: /* set_quantifier_opt */ - case 547: /* tag_mode_opt */ -{ - -} - break; - case 424: /* alter_db_option */ - case 452: /* alter_table_option */ -{ - -} - break; - case 438: /* type_name */ - case 449: /* type_name_default_len */ -{ - -} - break; - case 457: /* db_kind_opt */ - case 463: /* table_kind */ -{ - -} - break; - case 458: /* table_kind_db_name_cond_opt */ -{ - -} - break; - case 467: /* tsma_func_list */ -{ - nodesDestroyNode((yypminor->yy974)); -} - break; - case 514: /* trim_specification_type */ -{ - -} - break; - case 525: /* compare_op */ - case 526: /* in_op */ -{ - -} - break; - case 538: /* join_type */ -{ - -} - break; - case 539: /* join_subtype */ -{ - -} - break; - case 560: /* fill_mode */ -{ - -} - break; - case 571: /* ordering_specification_opt */ -{ - -} - break; - case 572: /* null_ordering_opt */ -{ - -} - break; -/********* End destructor definitions *****************************************/ - default: break; /* If no destructor action specified: do nothing */ - } -} - -/* -** Pop the parser's stack once. -** -** If there is a destructor routine associated with the token which -** is popped from the stack, then call it. -*/ -static void yy_pop_parser_stack(yyParser *pParser){ - yyStackEntry *yytos; - assert( pParser->yytos!=0 ); - assert( pParser->yytos > pParser->yystack ); - yytos = pParser->yytos--; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sPopping %s\n", - yyTracePrompt, - yyTokenName[yytos->major]); - } -#endif - yy_destructor(pParser, yytos->major, &yytos->minor); -} - -/* -** Clear all secondary memory allocations from the parser -*/ -void ParseFinalize(void *p){ - yyParser *pParser = (yyParser*)p; - while( pParser->yytos>pParser->yystack ) yy_pop_parser_stack(pParser); -#if YYSTACKDEPTH<=0 - if( pParser->yystack!=&pParser->yystk0 ) free(pParser->yystack); -#endif -} - -#ifndef Parse_ENGINEALWAYSONSTACK -/* -** Deallocate and destroy a parser. Destructors are called for -** all stack elements before shutting the parser down. -** -** If the YYPARSEFREENEVERNULL macro exists (for example because it -** is defined in a %include section of the input grammar) then it is -** assumed that the input pointer is never NULL. -*/ -void ParseFree( - void *p, /* The parser to be deleted */ - void (*freeProc)(void*) /* Function used to reclaim memory */ -){ -#ifndef YYPARSEFREENEVERNULL - if( p==0 ) return; -#endif - ParseFinalize(p); - (*freeProc)(p); -} -#endif /* Parse_ENGINEALWAYSONSTACK */ - -/* -** Return the peak depth of the stack for a parser. -*/ -#ifdef YYTRACKMAXSTACKDEPTH -int ParseStackPeak(void *p){ - yyParser *pParser = (yyParser*)p; - return pParser->yyhwm; -} -#endif - -/* This array of booleans keeps track of the parser statement -** coverage. The element yycoverage[X][Y] is set when the parser -** is in state X and has a lookahead token Y. In a well-tested -** systems, every element of this matrix should end up being set. -*/ -#if defined(YYCOVERAGE) -static unsigned char yycoverage[YYNSTATE][YYNTOKEN]; -#endif - -/* -** Write into out a description of every state/lookahead combination that -** -** (1) has not been used by the parser, and -** (2) is not a syntax error. -** -** Return the number of missed state/lookahead combinations. -*/ -#if defined(YYCOVERAGE) -int ParseCoverage(FILE *out){ - int stateno, iLookAhead, i; - int nMissed = 0; - for(stateno=0; statenoYY_MAX_SHIFT ) return stateno; - assert( stateno <= YY_SHIFT_COUNT ); -#if defined(YYCOVERAGE) - yycoverage[stateno][iLookAhead] = 1; -#endif - do{ - i = yy_shift_ofst[stateno]; - assert( i>=0 ); - assert( i<=YY_ACTTAB_COUNT ); - assert( i+YYNTOKEN<=(int)YY_NLOOKAHEAD ); - assert( iLookAhead!=YYNOCODE ); - assert( iLookAhead < YYNTOKEN ); - i += iLookAhead; - assert( i<(int)YY_NLOOKAHEAD ); - if( yy_lookahead[i]!=iLookAhead ){ -#ifdef YYFALLBACK - YYCODETYPE iFallback; /* Fallback token */ - assert( iLookAhead %s\n", - yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]); - } -#endif - assert( yyFallback[iFallback]==0 ); /* Fallback loop must terminate */ - iLookAhead = iFallback; - continue; - } -#endif -#ifdef YYWILDCARD - { - int j = i - iLookAhead + YYWILDCARD; - assert( j<(int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])) ); - if( yy_lookahead[j]==YYWILDCARD && iLookAhead>0 ){ -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE, "%sWILDCARD %s => %s\n", - yyTracePrompt, yyTokenName[iLookAhead], - yyTokenName[YYWILDCARD]); - } -#endif /* NDEBUG */ - return yy_action[j]; - } - } -#endif /* YYWILDCARD */ - return yy_default[stateno]; - }else{ - assert( i>=0 && iYY_REDUCE_COUNT ){ - return yy_default[stateno]; - } -#else - assert( stateno<=YY_REDUCE_COUNT ); -#endif - i = yy_reduce_ofst[stateno]; - assert( iLookAhead!=YYNOCODE ); - i += iLookAhead; -#ifdef YYERRORSYMBOL - if( i<0 || i>=YY_ACTTAB_COUNT || yy_lookahead[i]!=iLookAhead ){ - return yy_default[stateno]; - } -#else - assert( i>=0 && iyytos>yypParser->yystack ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will execute if the parser - ** stack every overflows */ -/******** Begin %stack_overflow code ******************************************/ -/******** End %stack_overflow code ********************************************/ - ParseARG_STORE /* Suppress warning about unused %extra_argument var */ - ParseCTX_STORE -} - -/* -** Print tracing information for a SHIFT action -*/ -#ifndef NDEBUG -static void yyTraceShift(yyParser *yypParser, int yyNewState, const char *zTag){ - if( yyTraceFILE ){ - if( yyNewStateyytos->major], - yyNewState); - }else{ - fprintf(yyTraceFILE,"%s%s '%s', pending reduce %d\n", - yyTracePrompt, zTag, yyTokenName[yypParser->yytos->major], - yyNewState - YY_MIN_REDUCE); - } - } -} -#else -# define yyTraceShift(X,Y,Z) -#endif - -/* -** Perform a shift action. -*/ -static void yy_shift( - yyParser *yypParser, /* The parser to be shifted */ - YYACTIONTYPE yyNewState, /* The new state to shift in */ - YYCODETYPE yyMajor, /* The major token to shift in */ - ParseTOKENTYPE yyMinor /* The minor token to shift in */ -){ - yyStackEntry *yytos; - yypParser->yytos++; -#ifdef YYTRACKMAXSTACKDEPTH - if( (int)(yypParser->yytos - yypParser->yystack)>yypParser->yyhwm ){ - yypParser->yyhwm++; - assert( yypParser->yyhwm == (int)(yypParser->yytos - yypParser->yystack) ); - } -#endif -#if YYSTACKDEPTH>0 - if( yypParser->yytos>yypParser->yystackEnd ){ - yypParser->yytos--; - yyStackOverflow(yypParser); - return; - } -#else - if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz] ){ - if( yyGrowStack(yypParser) ){ - yypParser->yytos--; - yyStackOverflow(yypParser); - return; - } - } -#endif - if( yyNewState > YY_MAX_SHIFT ){ - yyNewState += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE; - } - yytos = yypParser->yytos; - yytos->stateno = yyNewState; - yytos->major = yyMajor; - yytos->minor.yy0 = yyMinor; - yyTraceShift(yypParser, yyNewState, "Shift"); -} - -/* For rule J, yyRuleInfoLhs[J] contains the symbol on the left-hand side -** of that rule */ -static const YYCODETYPE yyRuleInfoLhs[] = { - 389, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ - 389, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ - 390, /* (2) account_options ::= */ - 390, /* (3) account_options ::= account_options PPS literal */ - 390, /* (4) account_options ::= account_options TSERIES literal */ - 390, /* (5) account_options ::= account_options STORAGE literal */ - 390, /* (6) account_options ::= account_options STREAMS literal */ - 390, /* (7) account_options ::= account_options QTIME literal */ - 390, /* (8) account_options ::= account_options DBS literal */ - 390, /* (9) account_options ::= account_options USERS literal */ - 390, /* (10) account_options ::= account_options CONNS literal */ - 390, /* (11) account_options ::= account_options STATE literal */ - 391, /* (12) alter_account_options ::= alter_account_option */ - 391, /* (13) alter_account_options ::= alter_account_options alter_account_option */ - 393, /* (14) alter_account_option ::= PASS literal */ - 393, /* (15) alter_account_option ::= PPS literal */ - 393, /* (16) alter_account_option ::= TSERIES literal */ - 393, /* (17) alter_account_option ::= STORAGE literal */ - 393, /* (18) alter_account_option ::= STREAMS literal */ - 393, /* (19) alter_account_option ::= QTIME literal */ - 393, /* (20) alter_account_option ::= DBS literal */ - 393, /* (21) alter_account_option ::= USERS literal */ - 393, /* (22) alter_account_option ::= CONNS literal */ - 393, /* (23) alter_account_option ::= STATE literal */ - 394, /* (24) ip_range_list ::= NK_STRING */ - 394, /* (25) ip_range_list ::= ip_range_list NK_COMMA NK_STRING */ - 395, /* (26) white_list ::= HOST ip_range_list */ - 396, /* (27) white_list_opt ::= */ - 396, /* (28) white_list_opt ::= white_list */ - 397, /* (29) is_import_opt ::= */ - 397, /* (30) is_import_opt ::= IS_IMPORT NK_INTEGER */ - 398, /* (31) is_createdb_opt ::= */ - 398, /* (32) is_createdb_opt ::= CREATEDB NK_INTEGER */ - 389, /* (33) cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt is_createdb_opt is_import_opt white_list_opt */ - 389, /* (34) cmd ::= ALTER USER user_name PASS NK_STRING */ - 389, /* (35) cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ - 389, /* (36) cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ - 389, /* (37) cmd ::= ALTER USER user_name CREATEDB NK_INTEGER */ - 389, /* (38) cmd ::= ALTER USER user_name ADD white_list */ - 389, /* (39) cmd ::= ALTER USER user_name DROP white_list */ - 389, /* (40) cmd ::= DROP USER user_name */ - 400, /* (41) sysinfo_opt ::= */ - 400, /* (42) sysinfo_opt ::= SYSINFO NK_INTEGER */ - 389, /* (43) cmd ::= GRANT privileges ON priv_level with_clause_opt TO user_name */ - 389, /* (44) cmd ::= REVOKE privileges ON priv_level with_clause_opt FROM user_name */ - 401, /* (45) privileges ::= ALL */ - 401, /* (46) privileges ::= priv_type_list */ - 401, /* (47) privileges ::= SUBSCRIBE */ - 404, /* (48) priv_type_list ::= priv_type */ - 404, /* (49) priv_type_list ::= priv_type_list NK_COMMA priv_type */ - 405, /* (50) priv_type ::= READ */ - 405, /* (51) priv_type ::= WRITE */ - 405, /* (52) priv_type ::= ALTER */ - 402, /* (53) priv_level ::= NK_STAR NK_DOT NK_STAR */ - 402, /* (54) priv_level ::= db_name NK_DOT NK_STAR */ - 402, /* (55) priv_level ::= db_name NK_DOT table_name */ - 402, /* (56) priv_level ::= topic_name */ - 403, /* (57) with_clause_opt ::= */ - 403, /* (58) with_clause_opt ::= WITH search_condition */ - 389, /* (59) cmd ::= CREATE ENCRYPT_KEY NK_STRING */ - 389, /* (60) cmd ::= CREATE ANODE NK_STRING */ - 389, /* (61) cmd ::= UPDATE ANODE NK_INTEGER */ - 389, /* (62) cmd ::= UPDATE ALL ANODES */ - 389, /* (63) cmd ::= DROP ANODE NK_INTEGER */ - 389, /* (64) cmd ::= CREATE DNODE dnode_endpoint */ - 389, /* (65) cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ - 389, /* (66) cmd ::= DROP DNODE NK_INTEGER force_opt */ - 389, /* (67) cmd ::= DROP DNODE dnode_endpoint force_opt */ - 389, /* (68) cmd ::= DROP DNODE NK_INTEGER unsafe_opt */ - 389, /* (69) cmd ::= DROP DNODE dnode_endpoint unsafe_opt */ - 389, /* (70) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ - 389, /* (71) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ - 389, /* (72) cmd ::= ALTER ALL DNODES NK_STRING */ - 389, /* (73) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ - 389, /* (74) cmd ::= RESTORE DNODE NK_INTEGER */ - 410, /* (75) dnode_endpoint ::= NK_STRING */ - 410, /* (76) dnode_endpoint ::= NK_ID */ - 410, /* (77) dnode_endpoint ::= NK_IPTOKEN */ - 411, /* (78) force_opt ::= */ - 411, /* (79) force_opt ::= FORCE */ - 412, /* (80) unsafe_opt ::= UNSAFE */ - 389, /* (81) cmd ::= ALTER CLUSTER NK_STRING */ - 389, /* (82) cmd ::= ALTER CLUSTER NK_STRING NK_STRING */ - 389, /* (83) cmd ::= ALTER LOCAL NK_STRING */ - 389, /* (84) cmd ::= ALTER LOCAL NK_STRING NK_STRING */ - 389, /* (85) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ - 389, /* (86) cmd ::= DROP QNODE ON DNODE NK_INTEGER */ - 389, /* (87) cmd ::= RESTORE QNODE ON DNODE NK_INTEGER */ - 389, /* (88) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ - 389, /* (89) cmd ::= DROP BNODE ON DNODE NK_INTEGER */ - 389, /* (90) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ - 389, /* (91) cmd ::= DROP SNODE ON DNODE NK_INTEGER */ - 389, /* (92) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ - 389, /* (93) cmd ::= DROP MNODE ON DNODE NK_INTEGER */ - 389, /* (94) cmd ::= RESTORE MNODE ON DNODE NK_INTEGER */ - 389, /* (95) cmd ::= RESTORE VNODE ON DNODE NK_INTEGER */ - 389, /* (96) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ - 389, /* (97) cmd ::= DROP DATABASE exists_opt db_name */ - 389, /* (98) cmd ::= USE db_name */ - 389, /* (99) cmd ::= ALTER DATABASE db_name alter_db_options */ - 389, /* (100) cmd ::= FLUSH DATABASE db_name */ - 389, /* (101) cmd ::= TRIM DATABASE db_name speed_opt */ - 389, /* (102) cmd ::= S3MIGRATE DATABASE db_name */ - 389, /* (103) cmd ::= COMPACT DATABASE db_name start_opt end_opt */ - 413, /* (104) not_exists_opt ::= IF NOT EXISTS */ - 413, /* (105) not_exists_opt ::= */ - 415, /* (106) exists_opt ::= IF EXISTS */ - 415, /* (107) exists_opt ::= */ - 414, /* (108) db_options ::= */ - 414, /* (109) db_options ::= db_options BUFFER NK_INTEGER */ - 414, /* (110) db_options ::= db_options CACHEMODEL NK_STRING */ - 414, /* (111) db_options ::= db_options CACHESIZE NK_INTEGER */ - 414, /* (112) db_options ::= db_options COMP NK_INTEGER */ - 414, /* (113) db_options ::= db_options DURATION NK_INTEGER */ - 414, /* (114) db_options ::= db_options DURATION NK_VARIABLE */ - 414, /* (115) db_options ::= db_options MAXROWS NK_INTEGER */ - 414, /* (116) db_options ::= db_options MINROWS NK_INTEGER */ - 414, /* (117) db_options ::= db_options KEEP integer_list */ - 414, /* (118) db_options ::= db_options KEEP variable_list */ - 414, /* (119) db_options ::= db_options PAGES NK_INTEGER */ - 414, /* (120) db_options ::= db_options PAGESIZE NK_INTEGER */ - 414, /* (121) db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ - 414, /* (122) db_options ::= db_options PRECISION NK_STRING */ - 414, /* (123) db_options ::= db_options REPLICA NK_INTEGER */ - 414, /* (124) db_options ::= db_options VGROUPS NK_INTEGER */ - 414, /* (125) db_options ::= db_options SINGLE_STABLE NK_INTEGER */ - 414, /* (126) db_options ::= db_options RETENTIONS retention_list */ - 414, /* (127) db_options ::= db_options SCHEMALESS NK_INTEGER */ - 414, /* (128) db_options ::= db_options WAL_LEVEL NK_INTEGER */ - 414, /* (129) db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ - 414, /* (130) db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ - 414, /* (131) db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ - 414, /* (132) db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ - 414, /* (133) db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ - 414, /* (134) db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ - 414, /* (135) db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ - 414, /* (136) db_options ::= db_options STT_TRIGGER NK_INTEGER */ - 414, /* (137) db_options ::= db_options TABLE_PREFIX signed */ - 414, /* (138) db_options ::= db_options TABLE_SUFFIX signed */ - 414, /* (139) db_options ::= db_options S3_CHUNKSIZE NK_INTEGER */ - 414, /* (140) db_options ::= db_options S3_KEEPLOCAL NK_INTEGER */ - 414, /* (141) db_options ::= db_options S3_KEEPLOCAL NK_VARIABLE */ - 414, /* (142) db_options ::= db_options S3_COMPACT NK_INTEGER */ - 414, /* (143) db_options ::= db_options KEEP_TIME_OFFSET NK_INTEGER */ - 414, /* (144) db_options ::= db_options ENCRYPT_ALGORITHM NK_STRING */ - 416, /* (145) alter_db_options ::= alter_db_option */ - 416, /* (146) alter_db_options ::= alter_db_options alter_db_option */ - 424, /* (147) alter_db_option ::= BUFFER NK_INTEGER */ - 424, /* (148) alter_db_option ::= CACHEMODEL NK_STRING */ - 424, /* (149) alter_db_option ::= CACHESIZE NK_INTEGER */ - 424, /* (150) alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ - 424, /* (151) alter_db_option ::= KEEP integer_list */ - 424, /* (152) alter_db_option ::= KEEP variable_list */ - 424, /* (153) alter_db_option ::= PAGES NK_INTEGER */ - 424, /* (154) alter_db_option ::= REPLICA NK_INTEGER */ - 424, /* (155) alter_db_option ::= WAL_LEVEL NK_INTEGER */ - 424, /* (156) alter_db_option ::= STT_TRIGGER NK_INTEGER */ - 424, /* (157) alter_db_option ::= MINROWS NK_INTEGER */ - 424, /* (158) alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */ - 424, /* (159) alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ - 424, /* (160) alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */ - 424, /* (161) alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ - 424, /* (162) alter_db_option ::= S3_KEEPLOCAL NK_INTEGER */ - 424, /* (163) alter_db_option ::= S3_KEEPLOCAL NK_VARIABLE */ - 424, /* (164) alter_db_option ::= S3_COMPACT NK_INTEGER */ - 424, /* (165) alter_db_option ::= KEEP_TIME_OFFSET NK_INTEGER */ - 424, /* (166) alter_db_option ::= ENCRYPT_ALGORITHM NK_STRING */ - 420, /* (167) integer_list ::= NK_INTEGER */ - 420, /* (168) integer_list ::= integer_list NK_COMMA NK_INTEGER */ - 421, /* (169) variable_list ::= NK_VARIABLE */ - 421, /* (170) variable_list ::= variable_list NK_COMMA NK_VARIABLE */ - 422, /* (171) retention_list ::= retention */ - 422, /* (172) retention_list ::= retention_list NK_COMMA retention */ - 425, /* (173) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ - 425, /* (174) retention ::= NK_MINUS NK_COLON NK_VARIABLE */ - 417, /* (175) speed_opt ::= */ - 417, /* (176) speed_opt ::= BWLIMIT NK_INTEGER */ - 418, /* (177) start_opt ::= */ - 418, /* (178) start_opt ::= START WITH NK_INTEGER */ - 418, /* (179) start_opt ::= START WITH NK_STRING */ - 418, /* (180) start_opt ::= START WITH TIMESTAMP NK_STRING */ - 419, /* (181) end_opt ::= */ - 419, /* (182) end_opt ::= END WITH NK_INTEGER */ - 419, /* (183) end_opt ::= END WITH NK_STRING */ - 419, /* (184) end_opt ::= END WITH TIMESTAMP NK_STRING */ - 389, /* (185) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ - 389, /* (186) cmd ::= CREATE TABLE multi_create_clause */ - 389, /* (187) cmd ::= CREATE TABLE not_exists_opt USING full_table_name NK_LP tag_list_opt NK_RP FILE NK_STRING */ - 389, /* (188) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ - 389, /* (189) cmd ::= DROP TABLE with_opt multi_drop_clause */ - 389, /* (190) cmd ::= DROP STABLE with_opt exists_opt full_table_name */ - 389, /* (191) cmd ::= ALTER TABLE alter_table_clause */ - 389, /* (192) cmd ::= ALTER STABLE alter_table_clause */ - 435, /* (193) alter_table_clause ::= full_table_name alter_table_options */ - 435, /* (194) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name column_options */ - 435, /* (195) alter_table_clause ::= full_table_name DROP COLUMN column_name */ - 435, /* (196) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ - 435, /* (197) alter_table_clause ::= full_table_name MODIFY COLUMN column_name column_options */ - 435, /* (198) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ - 435, /* (199) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ - 435, /* (200) alter_table_clause ::= full_table_name DROP TAG column_name */ - 435, /* (201) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ - 435, /* (202) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ - 435, /* (203) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ tags_literal */ - 430, /* (204) multi_create_clause ::= create_subtable_clause */ - 430, /* (205) multi_create_clause ::= multi_create_clause create_subtable_clause */ - 441, /* (206) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP tags_literal_list NK_RP table_options */ - 434, /* (207) multi_drop_clause ::= drop_table_clause */ - 434, /* (208) multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ - 444, /* (209) drop_table_clause ::= exists_opt full_table_name */ - 433, /* (210) with_opt ::= */ - 433, /* (211) with_opt ::= WITH */ - 442, /* (212) specific_cols_opt ::= */ - 442, /* (213) specific_cols_opt ::= NK_LP col_name_list NK_RP */ - 426, /* (214) full_table_name ::= table_name */ - 426, /* (215) full_table_name ::= db_name NK_DOT table_name */ - 446, /* (216) tag_def_list ::= tag_def */ - 446, /* (217) tag_def_list ::= tag_def_list NK_COMMA tag_def */ - 447, /* (218) tag_def ::= column_name type_name */ - 427, /* (219) column_def_list ::= column_def */ - 427, /* (220) column_def_list ::= column_def_list NK_COMMA column_def */ - 448, /* (221) column_def ::= column_name type_name column_options */ - 438, /* (222) type_name ::= BOOL */ - 438, /* (223) type_name ::= TINYINT */ - 438, /* (224) type_name ::= SMALLINT */ - 438, /* (225) type_name ::= INT */ - 438, /* (226) type_name ::= INTEGER */ - 438, /* (227) type_name ::= BIGINT */ - 438, /* (228) type_name ::= FLOAT */ - 438, /* (229) type_name ::= DOUBLE */ - 438, /* (230) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ - 438, /* (231) type_name ::= TIMESTAMP */ - 438, /* (232) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ - 438, /* (233) type_name ::= TINYINT UNSIGNED */ - 438, /* (234) type_name ::= SMALLINT UNSIGNED */ - 438, /* (235) type_name ::= INT UNSIGNED */ - 438, /* (236) type_name ::= BIGINT UNSIGNED */ - 438, /* (237) type_name ::= JSON */ - 438, /* (238) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ - 438, /* (239) type_name ::= MEDIUMBLOB */ - 438, /* (240) type_name ::= BLOB */ - 438, /* (241) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ - 438, /* (242) type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ - 438, /* (243) type_name ::= DECIMAL */ - 438, /* (244) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ - 438, /* (245) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - 449, /* (246) type_name_default_len ::= BINARY */ - 449, /* (247) type_name_default_len ::= NCHAR */ - 449, /* (248) type_name_default_len ::= VARCHAR */ - 449, /* (249) type_name_default_len ::= VARBINARY */ - 428, /* (250) tags_def_opt ::= */ - 428, /* (251) tags_def_opt ::= tags_def */ - 432, /* (252) tags_def ::= TAGS NK_LP tag_def_list NK_RP */ - 429, /* (253) table_options ::= */ - 429, /* (254) table_options ::= table_options COMMENT NK_STRING */ - 429, /* (255) table_options ::= table_options MAX_DELAY duration_list */ - 429, /* (256) table_options ::= table_options WATERMARK duration_list */ - 429, /* (257) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ - 429, /* (258) table_options ::= table_options TTL NK_INTEGER */ - 429, /* (259) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ - 429, /* (260) table_options ::= table_options DELETE_MARK duration_list */ - 436, /* (261) alter_table_options ::= alter_table_option */ - 436, /* (262) alter_table_options ::= alter_table_options alter_table_option */ - 452, /* (263) alter_table_option ::= COMMENT NK_STRING */ - 452, /* (264) alter_table_option ::= TTL NK_INTEGER */ - 450, /* (265) duration_list ::= duration_literal */ - 450, /* (266) duration_list ::= duration_list NK_COMMA duration_literal */ - 451, /* (267) rollup_func_list ::= rollup_func_name */ - 451, /* (268) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ - 454, /* (269) rollup_func_name ::= function_name */ - 454, /* (270) rollup_func_name ::= FIRST */ - 454, /* (271) rollup_func_name ::= LAST */ - 445, /* (272) col_name_list ::= col_name */ - 445, /* (273) col_name_list ::= col_name_list NK_COMMA col_name */ - 456, /* (274) col_name ::= column_name */ - 389, /* (275) cmd ::= SHOW DNODES */ - 389, /* (276) cmd ::= SHOW USERS */ - 389, /* (277) cmd ::= SHOW USERS FULL */ - 389, /* (278) cmd ::= SHOW USER PRIVILEGES */ - 389, /* (279) cmd ::= SHOW db_kind_opt DATABASES */ - 389, /* (280) cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */ - 389, /* (281) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ - 389, /* (282) cmd ::= SHOW db_name_cond_opt VGROUPS */ - 389, /* (283) cmd ::= SHOW MNODES */ - 389, /* (284) cmd ::= SHOW QNODES */ - 389, /* (285) cmd ::= SHOW ANODES */ - 389, /* (286) cmd ::= SHOW ANODES FULL */ - 389, /* (287) cmd ::= SHOW ARBGROUPS */ - 389, /* (288) cmd ::= SHOW FUNCTIONS */ - 389, /* (289) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ - 389, /* (290) cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ - 389, /* (291) cmd ::= SHOW STREAMS */ - 389, /* (292) cmd ::= SHOW ACCOUNTS */ - 389, /* (293) cmd ::= SHOW APPS */ - 389, /* (294) cmd ::= SHOW CONNECTIONS */ - 389, /* (295) cmd ::= SHOW LICENCES */ - 389, /* (296) cmd ::= SHOW GRANTS */ - 389, /* (297) cmd ::= SHOW GRANTS FULL */ - 389, /* (298) cmd ::= SHOW GRANTS LOGS */ - 389, /* (299) cmd ::= SHOW CLUSTER MACHINES */ - 389, /* (300) cmd ::= SHOW CREATE DATABASE db_name */ - 389, /* (301) cmd ::= SHOW CREATE TABLE full_table_name */ - 389, /* (302) cmd ::= SHOW CREATE STABLE full_table_name */ - 389, /* (303) cmd ::= SHOW ENCRYPTIONS */ - 389, /* (304) cmd ::= SHOW QUERIES */ - 389, /* (305) cmd ::= SHOW SCORES */ - 389, /* (306) cmd ::= SHOW TOPICS */ - 389, /* (307) cmd ::= SHOW VARIABLES */ - 389, /* (308) cmd ::= SHOW CLUSTER VARIABLES */ - 389, /* (309) cmd ::= SHOW LOCAL VARIABLES */ - 389, /* (310) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ - 389, /* (311) cmd ::= SHOW BNODES */ - 389, /* (312) cmd ::= SHOW SNODES */ - 389, /* (313) cmd ::= SHOW CLUSTER */ - 389, /* (314) cmd ::= SHOW TRANSACTIONS */ - 389, /* (315) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ - 389, /* (316) cmd ::= SHOW CONSUMERS */ - 389, /* (317) cmd ::= SHOW SUBSCRIPTIONS */ - 389, /* (318) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ - 389, /* (319) cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ - 389, /* (320) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ - 389, /* (321) cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ - 389, /* (322) cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ - 389, /* (323) cmd ::= SHOW VNODES */ - 389, /* (324) cmd ::= SHOW db_name_cond_opt ALIVE */ - 389, /* (325) cmd ::= SHOW CLUSTER ALIVE */ - 389, /* (326) cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt */ - 389, /* (327) cmd ::= SHOW CREATE VIEW full_table_name */ - 389, /* (328) cmd ::= SHOW COMPACTS */ - 389, /* (329) cmd ::= SHOW COMPACT NK_INTEGER */ - 458, /* (330) table_kind_db_name_cond_opt ::= */ - 458, /* (331) table_kind_db_name_cond_opt ::= table_kind */ - 458, /* (332) table_kind_db_name_cond_opt ::= db_name NK_DOT */ - 458, /* (333) table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */ - 463, /* (334) table_kind ::= NORMAL */ - 463, /* (335) table_kind ::= CHILD */ - 460, /* (336) db_name_cond_opt ::= */ - 460, /* (337) db_name_cond_opt ::= db_name NK_DOT */ - 459, /* (338) like_pattern_opt ::= */ - 459, /* (339) like_pattern_opt ::= LIKE NK_STRING */ - 461, /* (340) table_name_cond ::= table_name */ - 462, /* (341) from_db_opt ::= */ - 462, /* (342) from_db_opt ::= FROM db_name */ - 431, /* (343) tag_list_opt ::= */ - 431, /* (344) tag_list_opt ::= tag_item */ - 431, /* (345) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ - 464, /* (346) tag_item ::= TBNAME */ - 464, /* (347) tag_item ::= QTAGS */ - 464, /* (348) tag_item ::= column_name */ - 464, /* (349) tag_item ::= column_name column_alias */ - 464, /* (350) tag_item ::= column_name AS column_alias */ - 457, /* (351) db_kind_opt ::= */ - 457, /* (352) db_kind_opt ::= USER */ - 457, /* (353) db_kind_opt ::= SYSTEM */ - 389, /* (354) cmd ::= CREATE TSMA not_exists_opt tsma_name ON full_table_name tsma_func_list INTERVAL NK_LP duration_literal NK_RP */ - 389, /* (355) cmd ::= CREATE RECURSIVE TSMA not_exists_opt tsma_name ON full_table_name INTERVAL NK_LP duration_literal NK_RP */ - 389, /* (356) cmd ::= DROP TSMA exists_opt full_tsma_name */ - 389, /* (357) cmd ::= SHOW db_name_cond_opt TSMAS */ - 468, /* (358) full_tsma_name ::= tsma_name */ - 468, /* (359) full_tsma_name ::= db_name NK_DOT tsma_name */ - 467, /* (360) tsma_func_list ::= FUNCTION NK_LP func_list NK_RP */ - 389, /* (361) cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */ - 389, /* (362) cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */ - 389, /* (363) cmd ::= DROP INDEX exists_opt full_index_name */ - 471, /* (364) full_index_name ::= index_name */ - 471, /* (365) full_index_name ::= db_name NK_DOT index_name */ - 470, /* (366) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ - 470, /* (367) 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 */ - 469, /* (368) func_list ::= func */ - 469, /* (369) func_list ::= func_list NK_COMMA func */ - 475, /* (370) func ::= sma_func_name NK_LP expression_list NK_RP */ - 476, /* (371) sma_func_name ::= function_name */ - 476, /* (372) sma_func_name ::= COUNT */ - 476, /* (373) sma_func_name ::= FIRST */ - 476, /* (374) sma_func_name ::= LAST */ - 476, /* (375) sma_func_name ::= LAST_ROW */ - 474, /* (376) sma_stream_opt ::= */ - 474, /* (377) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ - 474, /* (378) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ - 474, /* (379) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ - 478, /* (380) with_meta ::= AS */ - 478, /* (381) with_meta ::= WITH META AS */ - 478, /* (382) with_meta ::= ONLY META AS */ - 389, /* (383) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ - 389, /* (384) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ - 389, /* (385) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ - 389, /* (386) cmd ::= DROP TOPIC exists_opt topic_name */ - 389, /* (387) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ - 389, /* (388) cmd ::= DESC full_table_name */ - 389, /* (389) cmd ::= DESCRIBE full_table_name */ - 389, /* (390) cmd ::= RESET QUERY CACHE */ - 389, /* (391) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ - 389, /* (392) cmd ::= EXPLAIN analyze_opt explain_options insert_query */ - 482, /* (393) analyze_opt ::= */ - 482, /* (394) analyze_opt ::= ANALYZE */ - 483, /* (395) explain_options ::= */ - 483, /* (396) explain_options ::= explain_options VERBOSE NK_BOOL */ - 483, /* (397) explain_options ::= explain_options RATIO NK_FLOAT */ - 389, /* (398) cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ - 389, /* (399) cmd ::= DROP FUNCTION exists_opt function_name */ - 486, /* (400) agg_func_opt ::= */ - 486, /* (401) agg_func_opt ::= AGGREGATE */ - 487, /* (402) bufsize_opt ::= */ - 487, /* (403) bufsize_opt ::= BUFSIZE NK_INTEGER */ - 488, /* (404) language_opt ::= */ - 488, /* (405) language_opt ::= LANGUAGE NK_STRING */ - 485, /* (406) or_replace_opt ::= */ - 485, /* (407) or_replace_opt ::= OR REPLACE */ - 389, /* (408) cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */ - 389, /* (409) cmd ::= DROP VIEW exists_opt full_view_name */ - 489, /* (410) full_view_name ::= view_name */ - 489, /* (411) full_view_name ::= db_name NK_DOT view_name */ - 389, /* (412) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */ - 389, /* (413) cmd ::= DROP STREAM exists_opt stream_name */ - 389, /* (414) cmd ::= PAUSE STREAM exists_opt stream_name */ - 389, /* (415) cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ - 493, /* (416) col_list_opt ::= */ - 493, /* (417) col_list_opt ::= NK_LP column_stream_def_list NK_RP */ - 497, /* (418) column_stream_def_list ::= column_stream_def */ - 497, /* (419) column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def */ - 498, /* (420) column_stream_def ::= column_name stream_col_options */ - 499, /* (421) stream_col_options ::= */ - 499, /* (422) stream_col_options ::= stream_col_options PRIMARY KEY */ - 494, /* (423) tag_def_or_ref_opt ::= */ - 494, /* (424) tag_def_or_ref_opt ::= tags_def */ - 494, /* (425) tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP */ - 492, /* (426) stream_options ::= */ - 492, /* (427) stream_options ::= stream_options TRIGGER AT_ONCE */ - 492, /* (428) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ - 492, /* (429) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ - 492, /* (430) stream_options ::= stream_options WATERMARK duration_literal */ - 492, /* (431) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ - 492, /* (432) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ - 492, /* (433) stream_options ::= stream_options DELETE_MARK duration_literal */ - 492, /* (434) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ - 495, /* (435) subtable_opt ::= */ - 495, /* (436) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - 496, /* (437) ignore_opt ::= */ - 496, /* (438) ignore_opt ::= IGNORE UNTREATED */ - 389, /* (439) cmd ::= KILL CONNECTION NK_INTEGER */ - 389, /* (440) cmd ::= KILL QUERY NK_STRING */ - 389, /* (441) cmd ::= KILL TRANSACTION NK_INTEGER */ - 389, /* (442) cmd ::= KILL COMPACT NK_INTEGER */ - 389, /* (443) cmd ::= BALANCE VGROUP */ - 389, /* (444) cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ - 389, /* (445) cmd ::= BALANCE VGROUP LEADER DATABASE db_name */ - 389, /* (446) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ - 389, /* (447) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ - 389, /* (448) cmd ::= SPLIT VGROUP NK_INTEGER */ - 501, /* (449) on_vgroup_id ::= */ - 501, /* (450) on_vgroup_id ::= ON NK_INTEGER */ - 502, /* (451) dnode_list ::= DNODE NK_INTEGER */ - 502, /* (452) dnode_list ::= dnode_list DNODE NK_INTEGER */ - 389, /* (453) cmd ::= DELETE FROM full_table_name where_clause_opt */ - 389, /* (454) cmd ::= query_or_subquery */ - 389, /* (455) cmd ::= insert_query */ - 484, /* (456) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ - 484, /* (457) insert_query ::= INSERT INTO full_table_name query_or_subquery */ - 440, /* (458) tags_literal ::= NK_INTEGER */ - 440, /* (459) tags_literal ::= NK_INTEGER NK_PLUS duration_literal */ - 440, /* (460) tags_literal ::= NK_INTEGER NK_MINUS duration_literal */ - 440, /* (461) tags_literal ::= NK_PLUS NK_INTEGER */ - 440, /* (462) tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal */ - 440, /* (463) tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal */ - 440, /* (464) tags_literal ::= NK_MINUS NK_INTEGER */ - 440, /* (465) tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal */ - 440, /* (466) tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal */ - 440, /* (467) tags_literal ::= NK_FLOAT */ - 440, /* (468) tags_literal ::= NK_PLUS NK_FLOAT */ - 440, /* (469) tags_literal ::= NK_MINUS NK_FLOAT */ - 440, /* (470) tags_literal ::= NK_BIN */ - 440, /* (471) tags_literal ::= NK_BIN NK_PLUS duration_literal */ - 440, /* (472) tags_literal ::= NK_BIN NK_MINUS duration_literal */ - 440, /* (473) tags_literal ::= NK_PLUS NK_BIN */ - 440, /* (474) tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal */ - 440, /* (475) tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal */ - 440, /* (476) tags_literal ::= NK_MINUS NK_BIN */ - 440, /* (477) tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal */ - 440, /* (478) tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal */ - 440, /* (479) tags_literal ::= NK_HEX */ - 440, /* (480) tags_literal ::= NK_HEX NK_PLUS duration_literal */ - 440, /* (481) tags_literal ::= NK_HEX NK_MINUS duration_literal */ - 440, /* (482) tags_literal ::= NK_PLUS NK_HEX */ - 440, /* (483) tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal */ - 440, /* (484) tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal */ - 440, /* (485) tags_literal ::= NK_MINUS NK_HEX */ - 440, /* (486) tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal */ - 440, /* (487) tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal */ - 440, /* (488) tags_literal ::= NK_STRING */ - 440, /* (489) tags_literal ::= NK_STRING NK_PLUS duration_literal */ - 440, /* (490) tags_literal ::= NK_STRING NK_MINUS duration_literal */ - 440, /* (491) tags_literal ::= NK_BOOL */ - 440, /* (492) tags_literal ::= NULL */ - 440, /* (493) tags_literal ::= literal_func */ - 440, /* (494) tags_literal ::= literal_func NK_PLUS duration_literal */ - 440, /* (495) tags_literal ::= literal_func NK_MINUS duration_literal */ - 443, /* (496) tags_literal_list ::= tags_literal */ - 443, /* (497) tags_literal_list ::= tags_literal_list NK_COMMA tags_literal */ - 392, /* (498) literal ::= NK_INTEGER */ - 392, /* (499) literal ::= NK_FLOAT */ - 392, /* (500) literal ::= NK_STRING */ - 392, /* (501) literal ::= NK_BOOL */ - 392, /* (502) literal ::= TIMESTAMP NK_STRING */ - 392, /* (503) literal ::= duration_literal */ - 392, /* (504) literal ::= NULL */ - 392, /* (505) literal ::= NK_QUESTION */ - 453, /* (506) duration_literal ::= NK_VARIABLE */ - 423, /* (507) signed ::= NK_INTEGER */ - 423, /* (508) signed ::= NK_PLUS NK_INTEGER */ - 423, /* (509) signed ::= NK_MINUS NK_INTEGER */ - 423, /* (510) signed ::= NK_FLOAT */ - 423, /* (511) signed ::= NK_PLUS NK_FLOAT */ - 423, /* (512) signed ::= NK_MINUS NK_FLOAT */ - 504, /* (513) signed_literal ::= signed */ - 504, /* (514) signed_literal ::= NK_STRING */ - 504, /* (515) signed_literal ::= NK_BOOL */ - 504, /* (516) signed_literal ::= TIMESTAMP NK_STRING */ - 504, /* (517) signed_literal ::= duration_literal */ - 504, /* (518) signed_literal ::= NULL */ - 504, /* (519) signed_literal ::= literal_func */ - 504, /* (520) signed_literal ::= NK_QUESTION */ - 505, /* (521) literal_list ::= signed_literal */ - 505, /* (522) literal_list ::= literal_list NK_COMMA signed_literal */ - 406, /* (523) db_name ::= NK_ID */ - 407, /* (524) table_name ::= NK_ID */ - 437, /* (525) column_name ::= NK_ID */ - 455, /* (526) function_name ::= NK_ID */ - 490, /* (527) view_name ::= NK_ID */ - 506, /* (528) table_alias ::= NK_ID */ - 465, /* (529) column_alias ::= NK_ID */ - 465, /* (530) column_alias ::= NK_ALIAS */ - 399, /* (531) user_name ::= NK_ID */ - 408, /* (532) topic_name ::= NK_ID */ - 491, /* (533) stream_name ::= NK_ID */ - 481, /* (534) cgroup_name ::= NK_ID */ - 472, /* (535) index_name ::= NK_ID */ - 466, /* (536) tsma_name ::= NK_ID */ - 507, /* (537) expr_or_subquery ::= expression */ - 500, /* (538) expression ::= literal */ - 500, /* (539) expression ::= pseudo_column */ - 500, /* (540) expression ::= column_reference */ - 500, /* (541) expression ::= function_expression */ - 500, /* (542) expression ::= case_when_expression */ - 500, /* (543) expression ::= NK_LP expression NK_RP */ - 500, /* (544) expression ::= NK_PLUS expr_or_subquery */ - 500, /* (545) expression ::= NK_MINUS expr_or_subquery */ - 500, /* (546) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ - 500, /* (547) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ - 500, /* (548) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ - 500, /* (549) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ - 500, /* (550) expression ::= expr_or_subquery NK_REM expr_or_subquery */ - 500, /* (551) expression ::= column_reference NK_ARROW NK_STRING */ - 500, /* (552) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ - 500, /* (553) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ - 477, /* (554) expression_list ::= expr_or_subquery */ - 477, /* (555) expression_list ::= expression_list NK_COMMA expr_or_subquery */ - 509, /* (556) column_reference ::= column_name */ - 509, /* (557) column_reference ::= table_name NK_DOT column_name */ - 509, /* (558) column_reference ::= NK_ALIAS */ - 509, /* (559) column_reference ::= table_name NK_DOT NK_ALIAS */ - 508, /* (560) pseudo_column ::= ROWTS */ - 508, /* (561) pseudo_column ::= TBNAME */ - 508, /* (562) pseudo_column ::= table_name NK_DOT TBNAME */ - 508, /* (563) pseudo_column ::= QSTART */ - 508, /* (564) pseudo_column ::= QEND */ - 508, /* (565) pseudo_column ::= QDURATION */ - 508, /* (566) pseudo_column ::= WSTART */ - 508, /* (567) pseudo_column ::= WEND */ - 508, /* (568) pseudo_column ::= WDURATION */ - 508, /* (569) pseudo_column ::= IROWTS */ - 508, /* (570) pseudo_column ::= ISFILLED */ - 508, /* (571) pseudo_column ::= QTAGS */ - 508, /* (572) pseudo_column ::= FLOW */ - 508, /* (573) pseudo_column ::= FHIGH */ - 508, /* (574) pseudo_column ::= FROWTS */ - 510, /* (575) function_expression ::= function_name NK_LP expression_list NK_RP */ - 510, /* (576) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ - 510, /* (577) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ - 510, /* (578) function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP */ - 510, /* (579) function_expression ::= POSITION NK_LP expr_or_subquery IN expr_or_subquery NK_RP */ - 510, /* (580) function_expression ::= TRIM NK_LP expr_or_subquery NK_RP */ - 510, /* (581) function_expression ::= TRIM NK_LP trim_specification_type FROM expr_or_subquery NK_RP */ - 510, /* (582) function_expression ::= TRIM NK_LP expr_or_subquery FROM expr_or_subquery NK_RP */ - 510, /* (583) function_expression ::= TRIM NK_LP trim_specification_type expr_or_subquery FROM expr_or_subquery NK_RP */ - 510, /* (584) function_expression ::= substr_func NK_LP expression_list NK_RP */ - 510, /* (585) function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery NK_RP */ - 510, /* (586) function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery FOR expr_or_subquery NK_RP */ - 510, /* (587) function_expression ::= REPLACE NK_LP expression_list NK_RP */ - 510, /* (588) function_expression ::= literal_func */ - 510, /* (589) function_expression ::= rand_func */ - 503, /* (590) literal_func ::= noarg_func NK_LP NK_RP */ - 503, /* (591) literal_func ::= NOW */ - 503, /* (592) literal_func ::= TODAY */ - 516, /* (593) rand_func ::= RAND NK_LP NK_RP */ - 516, /* (594) rand_func ::= RAND NK_LP expression_list NK_RP */ - 515, /* (595) substr_func ::= SUBSTR */ - 515, /* (596) substr_func ::= SUBSTRING */ - 514, /* (597) trim_specification_type ::= BOTH */ - 514, /* (598) trim_specification_type ::= TRAILING */ - 514, /* (599) trim_specification_type ::= LEADING */ - 517, /* (600) noarg_func ::= NOW */ - 517, /* (601) noarg_func ::= TODAY */ - 517, /* (602) noarg_func ::= TIMEZONE */ - 517, /* (603) noarg_func ::= DATABASE */ - 517, /* (604) noarg_func ::= CLIENT_VERSION */ - 517, /* (605) noarg_func ::= SERVER_VERSION */ - 517, /* (606) noarg_func ::= SERVER_STATUS */ - 517, /* (607) noarg_func ::= CURRENT_USER */ - 517, /* (608) noarg_func ::= USER */ - 517, /* (609) noarg_func ::= PI */ - 512, /* (610) star_func ::= COUNT */ - 512, /* (611) star_func ::= FIRST */ - 512, /* (612) star_func ::= LAST */ - 512, /* (613) star_func ::= LAST_ROW */ - 513, /* (614) star_func_para_list ::= NK_STAR */ - 513, /* (615) star_func_para_list ::= other_para_list */ - 518, /* (616) other_para_list ::= star_func_para */ - 518, /* (617) other_para_list ::= other_para_list NK_COMMA star_func_para */ - 519, /* (618) star_func_para ::= expr_or_subquery */ - 519, /* (619) star_func_para ::= table_name NK_DOT NK_STAR */ - 511, /* (620) case_when_expression ::= CASE when_then_list case_when_else_opt END */ - 511, /* (621) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ - 520, /* (622) when_then_list ::= when_then_expr */ - 520, /* (623) when_then_list ::= when_then_list when_then_expr */ - 523, /* (624) when_then_expr ::= WHEN common_expression THEN common_expression */ - 521, /* (625) case_when_else_opt ::= */ - 521, /* (626) case_when_else_opt ::= ELSE common_expression */ - 524, /* (627) predicate ::= expr_or_subquery compare_op expr_or_subquery */ - 524, /* (628) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ - 524, /* (629) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ - 524, /* (630) predicate ::= expr_or_subquery IS NULL */ - 524, /* (631) predicate ::= expr_or_subquery IS NOT NULL */ - 524, /* (632) predicate ::= expr_or_subquery in_op in_predicate_value */ - 525, /* (633) compare_op ::= NK_LT */ - 525, /* (634) compare_op ::= NK_GT */ - 525, /* (635) compare_op ::= NK_LE */ - 525, /* (636) compare_op ::= NK_GE */ - 525, /* (637) compare_op ::= NK_NE */ - 525, /* (638) compare_op ::= NK_EQ */ - 525, /* (639) compare_op ::= LIKE */ - 525, /* (640) compare_op ::= NOT LIKE */ - 525, /* (641) compare_op ::= MATCH */ - 525, /* (642) compare_op ::= NMATCH */ - 525, /* (643) compare_op ::= CONTAINS */ - 526, /* (644) in_op ::= IN */ - 526, /* (645) in_op ::= NOT IN */ - 527, /* (646) in_predicate_value ::= NK_LP literal_list NK_RP */ - 528, /* (647) boolean_value_expression ::= boolean_primary */ - 528, /* (648) boolean_value_expression ::= NOT boolean_primary */ - 528, /* (649) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - 528, /* (650) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - 529, /* (651) boolean_primary ::= predicate */ - 529, /* (652) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ - 522, /* (653) common_expression ::= expr_or_subquery */ - 522, /* (654) common_expression ::= boolean_value_expression */ - 530, /* (655) from_clause_opt ::= */ - 530, /* (656) from_clause_opt ::= FROM table_reference_list */ - 531, /* (657) table_reference_list ::= table_reference */ - 531, /* (658) table_reference_list ::= table_reference_list NK_COMMA table_reference */ - 532, /* (659) table_reference ::= table_primary */ - 532, /* (660) table_reference ::= joined_table */ - 533, /* (661) table_primary ::= table_name alias_opt */ - 533, /* (662) table_primary ::= db_name NK_DOT table_name alias_opt */ - 533, /* (663) table_primary ::= subquery alias_opt */ - 533, /* (664) table_primary ::= parenthesized_joined_table */ - 535, /* (665) alias_opt ::= */ - 535, /* (666) alias_opt ::= table_alias */ - 535, /* (667) alias_opt ::= AS table_alias */ - 537, /* (668) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - 537, /* (669) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ - 534, /* (670) joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt */ - 538, /* (671) join_type ::= */ - 538, /* (672) join_type ::= INNER */ - 538, /* (673) join_type ::= LEFT */ - 538, /* (674) join_type ::= RIGHT */ - 538, /* (675) join_type ::= FULL */ - 539, /* (676) join_subtype ::= */ - 539, /* (677) join_subtype ::= OUTER */ - 539, /* (678) join_subtype ::= SEMI */ - 539, /* (679) join_subtype ::= ANTI */ - 539, /* (680) join_subtype ::= ASOF */ - 539, /* (681) join_subtype ::= WINDOW */ - 540, /* (682) join_on_clause_opt ::= */ - 540, /* (683) join_on_clause_opt ::= ON search_condition */ - 541, /* (684) window_offset_clause_opt ::= */ - 541, /* (685) window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP */ - 543, /* (686) window_offset_literal ::= NK_VARIABLE */ - 543, /* (687) window_offset_literal ::= NK_MINUS NK_VARIABLE */ - 542, /* (688) jlimit_clause_opt ::= */ - 542, /* (689) jlimit_clause_opt ::= JLIMIT NK_INTEGER */ - 544, /* (690) query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_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 */ - 545, /* (691) hint_list ::= */ - 545, /* (692) hint_list ::= NK_HINT */ - 547, /* (693) tag_mode_opt ::= */ - 547, /* (694) tag_mode_opt ::= TAGS */ - 546, /* (695) set_quantifier_opt ::= */ - 546, /* (696) set_quantifier_opt ::= DISTINCT */ - 546, /* (697) set_quantifier_opt ::= ALL */ - 548, /* (698) select_list ::= select_item */ - 548, /* (699) select_list ::= select_list NK_COMMA select_item */ - 556, /* (700) select_item ::= NK_STAR */ - 556, /* (701) select_item ::= common_expression */ - 556, /* (702) select_item ::= common_expression column_alias */ - 556, /* (703) select_item ::= common_expression AS column_alias */ - 556, /* (704) select_item ::= table_name NK_DOT NK_STAR */ - 480, /* (705) where_clause_opt ::= */ - 480, /* (706) where_clause_opt ::= WHERE search_condition */ - 549, /* (707) partition_by_clause_opt ::= */ - 549, /* (708) partition_by_clause_opt ::= PARTITION BY partition_list */ - 557, /* (709) partition_list ::= partition_item */ - 557, /* (710) partition_list ::= partition_list NK_COMMA partition_item */ - 558, /* (711) partition_item ::= expr_or_subquery */ - 558, /* (712) partition_item ::= expr_or_subquery column_alias */ - 558, /* (713) partition_item ::= expr_or_subquery AS column_alias */ - 553, /* (714) twindow_clause_opt ::= */ - 553, /* (715) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ - 553, /* (716) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ - 553, /* (717) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ - 553, /* (718) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ - 553, /* (719) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ - 553, /* (720) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */ - 553, /* (721) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - 553, /* (722) twindow_clause_opt ::= ANOMALY_WINDOW NK_LP expr_or_subquery NK_RP */ - 553, /* (723) twindow_clause_opt ::= ANOMALY_WINDOW NK_LP expr_or_subquery NK_COMMA NK_STRING NK_RP */ - 473, /* (724) sliding_opt ::= */ - 473, /* (725) sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ - 559, /* (726) interval_sliding_duration_literal ::= NK_VARIABLE */ - 559, /* (727) interval_sliding_duration_literal ::= NK_STRING */ - 559, /* (728) interval_sliding_duration_literal ::= NK_INTEGER */ - 552, /* (729) fill_opt ::= */ - 552, /* (730) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - 552, /* (731) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ - 552, /* (732) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ - 560, /* (733) fill_mode ::= NONE */ - 560, /* (734) fill_mode ::= PREV */ - 560, /* (735) fill_mode ::= NULL */ - 560, /* (736) fill_mode ::= NULL_F */ - 560, /* (737) fill_mode ::= LINEAR */ - 560, /* (738) fill_mode ::= NEXT */ - 554, /* (739) group_by_clause_opt ::= */ - 554, /* (740) group_by_clause_opt ::= GROUP BY group_by_list */ - 561, /* (741) group_by_list ::= expr_or_subquery */ - 561, /* (742) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ - 555, /* (743) having_clause_opt ::= */ - 555, /* (744) having_clause_opt ::= HAVING search_condition */ - 550, /* (745) range_opt ::= */ - 550, /* (746) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ - 550, /* (747) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ - 551, /* (748) every_opt ::= */ - 551, /* (749) every_opt ::= EVERY NK_LP duration_literal NK_RP */ - 562, /* (750) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ - 563, /* (751) query_simple ::= query_specification */ - 563, /* (752) query_simple ::= union_query_expression */ - 567, /* (753) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ - 567, /* (754) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ - 568, /* (755) query_simple_or_subquery ::= query_simple */ - 568, /* (756) query_simple_or_subquery ::= subquery */ - 479, /* (757) query_or_subquery ::= query_expression */ - 479, /* (758) query_or_subquery ::= subquery */ - 564, /* (759) order_by_clause_opt ::= */ - 564, /* (760) order_by_clause_opt ::= ORDER BY sort_specification_list */ - 565, /* (761) slimit_clause_opt ::= */ - 565, /* (762) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - 565, /* (763) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - 565, /* (764) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - 566, /* (765) limit_clause_opt ::= */ - 566, /* (766) limit_clause_opt ::= LIMIT NK_INTEGER */ - 566, /* (767) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - 566, /* (768) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - 536, /* (769) subquery ::= NK_LP query_expression NK_RP */ - 536, /* (770) subquery ::= NK_LP subquery NK_RP */ - 409, /* (771) search_condition ::= common_expression */ - 569, /* (772) sort_specification_list ::= sort_specification */ - 569, /* (773) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - 570, /* (774) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ - 571, /* (775) ordering_specification_opt ::= */ - 571, /* (776) ordering_specification_opt ::= ASC */ - 571, /* (777) ordering_specification_opt ::= DESC */ - 572, /* (778) null_ordering_opt ::= */ - 572, /* (779) null_ordering_opt ::= NULLS FIRST */ - 572, /* (780) null_ordering_opt ::= NULLS LAST */ - 439, /* (781) column_options ::= */ - 439, /* (782) column_options ::= column_options PRIMARY KEY */ - 439, /* (783) column_options ::= column_options NK_ID NK_STRING */ -}; - -/* For rule J, yyRuleInfoNRhs[J] contains the negative of the number -** of symbols on the right-hand side of that rule. */ -static const signed char yyRuleInfoNRhs[] = { - -6, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ - -4, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ - 0, /* (2) account_options ::= */ - -3, /* (3) account_options ::= account_options PPS literal */ - -3, /* (4) account_options ::= account_options TSERIES literal */ - -3, /* (5) account_options ::= account_options STORAGE literal */ - -3, /* (6) account_options ::= account_options STREAMS literal */ - -3, /* (7) account_options ::= account_options QTIME literal */ - -3, /* (8) account_options ::= account_options DBS literal */ - -3, /* (9) account_options ::= account_options USERS literal */ - -3, /* (10) account_options ::= account_options CONNS literal */ - -3, /* (11) account_options ::= account_options STATE literal */ - -1, /* (12) alter_account_options ::= alter_account_option */ - -2, /* (13) alter_account_options ::= alter_account_options alter_account_option */ - -2, /* (14) alter_account_option ::= PASS literal */ - -2, /* (15) alter_account_option ::= PPS literal */ - -2, /* (16) alter_account_option ::= TSERIES literal */ - -2, /* (17) alter_account_option ::= STORAGE literal */ - -2, /* (18) alter_account_option ::= STREAMS literal */ - -2, /* (19) alter_account_option ::= QTIME literal */ - -2, /* (20) alter_account_option ::= DBS literal */ - -2, /* (21) alter_account_option ::= USERS literal */ - -2, /* (22) alter_account_option ::= CONNS literal */ - -2, /* (23) alter_account_option ::= STATE literal */ - -1, /* (24) ip_range_list ::= NK_STRING */ - -3, /* (25) ip_range_list ::= ip_range_list NK_COMMA NK_STRING */ - -2, /* (26) white_list ::= HOST ip_range_list */ - 0, /* (27) white_list_opt ::= */ - -1, /* (28) white_list_opt ::= white_list */ - 0, /* (29) is_import_opt ::= */ - -2, /* (30) is_import_opt ::= IS_IMPORT NK_INTEGER */ - 0, /* (31) is_createdb_opt ::= */ - -2, /* (32) is_createdb_opt ::= CREATEDB NK_INTEGER */ - -9, /* (33) cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt is_createdb_opt is_import_opt white_list_opt */ - -5, /* (34) cmd ::= ALTER USER user_name PASS NK_STRING */ - -5, /* (35) cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ - -5, /* (36) cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ - -5, /* (37) cmd ::= ALTER USER user_name CREATEDB NK_INTEGER */ - -5, /* (38) cmd ::= ALTER USER user_name ADD white_list */ - -5, /* (39) cmd ::= ALTER USER user_name DROP white_list */ - -3, /* (40) cmd ::= DROP USER user_name */ - 0, /* (41) sysinfo_opt ::= */ - -2, /* (42) sysinfo_opt ::= SYSINFO NK_INTEGER */ - -7, /* (43) cmd ::= GRANT privileges ON priv_level with_clause_opt TO user_name */ - -7, /* (44) cmd ::= REVOKE privileges ON priv_level with_clause_opt FROM user_name */ - -1, /* (45) privileges ::= ALL */ - -1, /* (46) privileges ::= priv_type_list */ - -1, /* (47) privileges ::= SUBSCRIBE */ - -1, /* (48) priv_type_list ::= priv_type */ - -3, /* (49) priv_type_list ::= priv_type_list NK_COMMA priv_type */ - -1, /* (50) priv_type ::= READ */ - -1, /* (51) priv_type ::= WRITE */ - -1, /* (52) priv_type ::= ALTER */ - -3, /* (53) priv_level ::= NK_STAR NK_DOT NK_STAR */ - -3, /* (54) priv_level ::= db_name NK_DOT NK_STAR */ - -3, /* (55) priv_level ::= db_name NK_DOT table_name */ - -1, /* (56) priv_level ::= topic_name */ - 0, /* (57) with_clause_opt ::= */ - -2, /* (58) with_clause_opt ::= WITH search_condition */ - -3, /* (59) cmd ::= CREATE ENCRYPT_KEY NK_STRING */ - -3, /* (60) cmd ::= CREATE ANODE NK_STRING */ - -3, /* (61) cmd ::= UPDATE ANODE NK_INTEGER */ - -3, /* (62) cmd ::= UPDATE ALL ANODES */ - -3, /* (63) cmd ::= DROP ANODE NK_INTEGER */ - -3, /* (64) cmd ::= CREATE DNODE dnode_endpoint */ - -5, /* (65) cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ - -4, /* (66) cmd ::= DROP DNODE NK_INTEGER force_opt */ - -4, /* (67) cmd ::= DROP DNODE dnode_endpoint force_opt */ - -4, /* (68) cmd ::= DROP DNODE NK_INTEGER unsafe_opt */ - -4, /* (69) cmd ::= DROP DNODE dnode_endpoint unsafe_opt */ - -4, /* (70) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ - -5, /* (71) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ - -4, /* (72) cmd ::= ALTER ALL DNODES NK_STRING */ - -5, /* (73) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ - -3, /* (74) cmd ::= RESTORE DNODE NK_INTEGER */ - -1, /* (75) dnode_endpoint ::= NK_STRING */ - -1, /* (76) dnode_endpoint ::= NK_ID */ - -1, /* (77) dnode_endpoint ::= NK_IPTOKEN */ - 0, /* (78) force_opt ::= */ - -1, /* (79) force_opt ::= FORCE */ - -1, /* (80) unsafe_opt ::= UNSAFE */ - -3, /* (81) cmd ::= ALTER CLUSTER NK_STRING */ - -4, /* (82) cmd ::= ALTER CLUSTER NK_STRING NK_STRING */ - -3, /* (83) cmd ::= ALTER LOCAL NK_STRING */ - -4, /* (84) cmd ::= ALTER LOCAL NK_STRING NK_STRING */ - -5, /* (85) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ - -5, /* (86) cmd ::= DROP QNODE ON DNODE NK_INTEGER */ - -5, /* (87) cmd ::= RESTORE QNODE ON DNODE NK_INTEGER */ - -5, /* (88) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ - -5, /* (89) cmd ::= DROP BNODE ON DNODE NK_INTEGER */ - -5, /* (90) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ - -5, /* (91) cmd ::= DROP SNODE ON DNODE NK_INTEGER */ - -5, /* (92) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ - -5, /* (93) cmd ::= DROP MNODE ON DNODE NK_INTEGER */ - -5, /* (94) cmd ::= RESTORE MNODE ON DNODE NK_INTEGER */ - -5, /* (95) cmd ::= RESTORE VNODE ON DNODE NK_INTEGER */ - -5, /* (96) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ - -4, /* (97) cmd ::= DROP DATABASE exists_opt db_name */ - -2, /* (98) cmd ::= USE db_name */ - -4, /* (99) cmd ::= ALTER DATABASE db_name alter_db_options */ - -3, /* (100) cmd ::= FLUSH DATABASE db_name */ - -4, /* (101) cmd ::= TRIM DATABASE db_name speed_opt */ - -3, /* (102) cmd ::= S3MIGRATE DATABASE db_name */ - -5, /* (103) cmd ::= COMPACT DATABASE db_name start_opt end_opt */ - -3, /* (104) not_exists_opt ::= IF NOT EXISTS */ - 0, /* (105) not_exists_opt ::= */ - -2, /* (106) exists_opt ::= IF EXISTS */ - 0, /* (107) exists_opt ::= */ - 0, /* (108) db_options ::= */ - -3, /* (109) db_options ::= db_options BUFFER NK_INTEGER */ - -3, /* (110) db_options ::= db_options CACHEMODEL NK_STRING */ - -3, /* (111) db_options ::= db_options CACHESIZE NK_INTEGER */ - -3, /* (112) db_options ::= db_options COMP NK_INTEGER */ - -3, /* (113) db_options ::= db_options DURATION NK_INTEGER */ - -3, /* (114) db_options ::= db_options DURATION NK_VARIABLE */ - -3, /* (115) db_options ::= db_options MAXROWS NK_INTEGER */ - -3, /* (116) db_options ::= db_options MINROWS NK_INTEGER */ - -3, /* (117) db_options ::= db_options KEEP integer_list */ - -3, /* (118) db_options ::= db_options KEEP variable_list */ - -3, /* (119) db_options ::= db_options PAGES NK_INTEGER */ - -3, /* (120) db_options ::= db_options PAGESIZE NK_INTEGER */ - -3, /* (121) db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ - -3, /* (122) db_options ::= db_options PRECISION NK_STRING */ - -3, /* (123) db_options ::= db_options REPLICA NK_INTEGER */ - -3, /* (124) db_options ::= db_options VGROUPS NK_INTEGER */ - -3, /* (125) db_options ::= db_options SINGLE_STABLE NK_INTEGER */ - -3, /* (126) db_options ::= db_options RETENTIONS retention_list */ - -3, /* (127) db_options ::= db_options SCHEMALESS NK_INTEGER */ - -3, /* (128) db_options ::= db_options WAL_LEVEL NK_INTEGER */ - -3, /* (129) db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ - -3, /* (130) db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ - -4, /* (131) db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ - -3, /* (132) db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ - -4, /* (133) db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ - -3, /* (134) db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ - -3, /* (135) db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ - -3, /* (136) db_options ::= db_options STT_TRIGGER NK_INTEGER */ - -3, /* (137) db_options ::= db_options TABLE_PREFIX signed */ - -3, /* (138) db_options ::= db_options TABLE_SUFFIX signed */ - -3, /* (139) db_options ::= db_options S3_CHUNKSIZE NK_INTEGER */ - -3, /* (140) db_options ::= db_options S3_KEEPLOCAL NK_INTEGER */ - -3, /* (141) db_options ::= db_options S3_KEEPLOCAL NK_VARIABLE */ - -3, /* (142) db_options ::= db_options S3_COMPACT NK_INTEGER */ - -3, /* (143) db_options ::= db_options KEEP_TIME_OFFSET NK_INTEGER */ - -3, /* (144) db_options ::= db_options ENCRYPT_ALGORITHM NK_STRING */ - -1, /* (145) alter_db_options ::= alter_db_option */ - -2, /* (146) alter_db_options ::= alter_db_options alter_db_option */ - -2, /* (147) alter_db_option ::= BUFFER NK_INTEGER */ - -2, /* (148) alter_db_option ::= CACHEMODEL NK_STRING */ - -2, /* (149) alter_db_option ::= CACHESIZE NK_INTEGER */ - -2, /* (150) alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ - -2, /* (151) alter_db_option ::= KEEP integer_list */ - -2, /* (152) alter_db_option ::= KEEP variable_list */ - -2, /* (153) alter_db_option ::= PAGES NK_INTEGER */ - -2, /* (154) alter_db_option ::= REPLICA NK_INTEGER */ - -2, /* (155) alter_db_option ::= WAL_LEVEL NK_INTEGER */ - -2, /* (156) alter_db_option ::= STT_TRIGGER NK_INTEGER */ - -2, /* (157) alter_db_option ::= MINROWS NK_INTEGER */ - -2, /* (158) alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */ - -3, /* (159) alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ - -2, /* (160) alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */ - -3, /* (161) alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ - -2, /* (162) alter_db_option ::= S3_KEEPLOCAL NK_INTEGER */ - -2, /* (163) alter_db_option ::= S3_KEEPLOCAL NK_VARIABLE */ - -2, /* (164) alter_db_option ::= S3_COMPACT NK_INTEGER */ - -2, /* (165) alter_db_option ::= KEEP_TIME_OFFSET NK_INTEGER */ - -2, /* (166) alter_db_option ::= ENCRYPT_ALGORITHM NK_STRING */ - -1, /* (167) integer_list ::= NK_INTEGER */ - -3, /* (168) integer_list ::= integer_list NK_COMMA NK_INTEGER */ - -1, /* (169) variable_list ::= NK_VARIABLE */ - -3, /* (170) variable_list ::= variable_list NK_COMMA NK_VARIABLE */ - -1, /* (171) retention_list ::= retention */ - -3, /* (172) retention_list ::= retention_list NK_COMMA retention */ - -3, /* (173) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ - -3, /* (174) retention ::= NK_MINUS NK_COLON NK_VARIABLE */ - 0, /* (175) speed_opt ::= */ - -2, /* (176) speed_opt ::= BWLIMIT NK_INTEGER */ - 0, /* (177) start_opt ::= */ - -3, /* (178) start_opt ::= START WITH NK_INTEGER */ - -3, /* (179) start_opt ::= START WITH NK_STRING */ - -4, /* (180) start_opt ::= START WITH TIMESTAMP NK_STRING */ - 0, /* (181) end_opt ::= */ - -3, /* (182) end_opt ::= END WITH NK_INTEGER */ - -3, /* (183) end_opt ::= END WITH NK_STRING */ - -4, /* (184) end_opt ::= END WITH TIMESTAMP NK_STRING */ - -9, /* (185) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ - -3, /* (186) cmd ::= CREATE TABLE multi_create_clause */ - -10, /* (187) cmd ::= CREATE TABLE not_exists_opt USING full_table_name NK_LP tag_list_opt NK_RP FILE NK_STRING */ - -9, /* (188) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ - -4, /* (189) cmd ::= DROP TABLE with_opt multi_drop_clause */ - -5, /* (190) cmd ::= DROP STABLE with_opt exists_opt full_table_name */ - -3, /* (191) cmd ::= ALTER TABLE alter_table_clause */ - -3, /* (192) cmd ::= ALTER STABLE alter_table_clause */ - -2, /* (193) alter_table_clause ::= full_table_name alter_table_options */ - -6, /* (194) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name column_options */ - -4, /* (195) alter_table_clause ::= full_table_name DROP COLUMN column_name */ - -5, /* (196) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ - -5, /* (197) alter_table_clause ::= full_table_name MODIFY COLUMN column_name column_options */ - -5, /* (198) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ - -5, /* (199) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ - -4, /* (200) alter_table_clause ::= full_table_name DROP TAG column_name */ - -5, /* (201) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ - -5, /* (202) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ - -6, /* (203) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ tags_literal */ - -1, /* (204) multi_create_clause ::= create_subtable_clause */ - -2, /* (205) multi_create_clause ::= multi_create_clause create_subtable_clause */ - -10, /* (206) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP tags_literal_list NK_RP table_options */ - -1, /* (207) multi_drop_clause ::= drop_table_clause */ - -3, /* (208) multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ - -2, /* (209) drop_table_clause ::= exists_opt full_table_name */ - 0, /* (210) with_opt ::= */ - -1, /* (211) with_opt ::= WITH */ - 0, /* (212) specific_cols_opt ::= */ - -3, /* (213) specific_cols_opt ::= NK_LP col_name_list NK_RP */ - -1, /* (214) full_table_name ::= table_name */ - -3, /* (215) full_table_name ::= db_name NK_DOT table_name */ - -1, /* (216) tag_def_list ::= tag_def */ - -3, /* (217) tag_def_list ::= tag_def_list NK_COMMA tag_def */ - -2, /* (218) tag_def ::= column_name type_name */ - -1, /* (219) column_def_list ::= column_def */ - -3, /* (220) column_def_list ::= column_def_list NK_COMMA column_def */ - -3, /* (221) column_def ::= column_name type_name column_options */ - -1, /* (222) type_name ::= BOOL */ - -1, /* (223) type_name ::= TINYINT */ - -1, /* (224) type_name ::= SMALLINT */ - -1, /* (225) type_name ::= INT */ - -1, /* (226) type_name ::= INTEGER */ - -1, /* (227) type_name ::= BIGINT */ - -1, /* (228) type_name ::= FLOAT */ - -1, /* (229) type_name ::= DOUBLE */ - -4, /* (230) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ - -1, /* (231) type_name ::= TIMESTAMP */ - -4, /* (232) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ - -2, /* (233) type_name ::= TINYINT UNSIGNED */ - -2, /* (234) type_name ::= SMALLINT UNSIGNED */ - -2, /* (235) type_name ::= INT UNSIGNED */ - -2, /* (236) type_name ::= BIGINT UNSIGNED */ - -1, /* (237) type_name ::= JSON */ - -4, /* (238) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ - -1, /* (239) type_name ::= MEDIUMBLOB */ - -1, /* (240) type_name ::= BLOB */ - -4, /* (241) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ - -4, /* (242) type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ - -1, /* (243) type_name ::= DECIMAL */ - -4, /* (244) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ - -6, /* (245) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - -1, /* (246) type_name_default_len ::= BINARY */ - -1, /* (247) type_name_default_len ::= NCHAR */ - -1, /* (248) type_name_default_len ::= VARCHAR */ - -1, /* (249) type_name_default_len ::= VARBINARY */ - 0, /* (250) tags_def_opt ::= */ - -1, /* (251) tags_def_opt ::= tags_def */ - -4, /* (252) tags_def ::= TAGS NK_LP tag_def_list NK_RP */ - 0, /* (253) table_options ::= */ - -3, /* (254) table_options ::= table_options COMMENT NK_STRING */ - -3, /* (255) table_options ::= table_options MAX_DELAY duration_list */ - -3, /* (256) table_options ::= table_options WATERMARK duration_list */ - -5, /* (257) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ - -3, /* (258) table_options ::= table_options TTL NK_INTEGER */ - -5, /* (259) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ - -3, /* (260) table_options ::= table_options DELETE_MARK duration_list */ - -1, /* (261) alter_table_options ::= alter_table_option */ - -2, /* (262) alter_table_options ::= alter_table_options alter_table_option */ - -2, /* (263) alter_table_option ::= COMMENT NK_STRING */ - -2, /* (264) alter_table_option ::= TTL NK_INTEGER */ - -1, /* (265) duration_list ::= duration_literal */ - -3, /* (266) duration_list ::= duration_list NK_COMMA duration_literal */ - -1, /* (267) rollup_func_list ::= rollup_func_name */ - -3, /* (268) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ - -1, /* (269) rollup_func_name ::= function_name */ - -1, /* (270) rollup_func_name ::= FIRST */ - -1, /* (271) rollup_func_name ::= LAST */ - -1, /* (272) col_name_list ::= col_name */ - -3, /* (273) col_name_list ::= col_name_list NK_COMMA col_name */ - -1, /* (274) col_name ::= column_name */ - -2, /* (275) cmd ::= SHOW DNODES */ - -2, /* (276) cmd ::= SHOW USERS */ - -3, /* (277) cmd ::= SHOW USERS FULL */ - -3, /* (278) cmd ::= SHOW USER PRIVILEGES */ - -3, /* (279) cmd ::= SHOW db_kind_opt DATABASES */ - -4, /* (280) cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */ - -4, /* (281) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ - -3, /* (282) cmd ::= SHOW db_name_cond_opt VGROUPS */ - -2, /* (283) cmd ::= SHOW MNODES */ - -2, /* (284) cmd ::= SHOW QNODES */ - -2, /* (285) cmd ::= SHOW ANODES */ - -3, /* (286) cmd ::= SHOW ANODES FULL */ - -2, /* (287) cmd ::= SHOW ARBGROUPS */ - -2, /* (288) cmd ::= SHOW FUNCTIONS */ - -5, /* (289) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ - -6, /* (290) cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ - -2, /* (291) cmd ::= SHOW STREAMS */ - -2, /* (292) cmd ::= SHOW ACCOUNTS */ - -2, /* (293) cmd ::= SHOW APPS */ - -2, /* (294) cmd ::= SHOW CONNECTIONS */ - -2, /* (295) cmd ::= SHOW LICENCES */ - -2, /* (296) cmd ::= SHOW GRANTS */ - -3, /* (297) cmd ::= SHOW GRANTS FULL */ - -3, /* (298) cmd ::= SHOW GRANTS LOGS */ - -3, /* (299) cmd ::= SHOW CLUSTER MACHINES */ - -4, /* (300) cmd ::= SHOW CREATE DATABASE db_name */ - -4, /* (301) cmd ::= SHOW CREATE TABLE full_table_name */ - -4, /* (302) cmd ::= SHOW CREATE STABLE full_table_name */ - -2, /* (303) cmd ::= SHOW ENCRYPTIONS */ - -2, /* (304) cmd ::= SHOW QUERIES */ - -2, /* (305) cmd ::= SHOW SCORES */ - -2, /* (306) cmd ::= SHOW TOPICS */ - -2, /* (307) cmd ::= SHOW VARIABLES */ - -3, /* (308) cmd ::= SHOW CLUSTER VARIABLES */ - -3, /* (309) cmd ::= SHOW LOCAL VARIABLES */ - -5, /* (310) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ - -2, /* (311) cmd ::= SHOW BNODES */ - -2, /* (312) cmd ::= SHOW SNODES */ - -2, /* (313) cmd ::= SHOW CLUSTER */ - -2, /* (314) cmd ::= SHOW TRANSACTIONS */ - -4, /* (315) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ - -2, /* (316) cmd ::= SHOW CONSUMERS */ - -2, /* (317) cmd ::= SHOW SUBSCRIPTIONS */ - -5, /* (318) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ - -6, /* (319) cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ - -7, /* (320) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ - -8, /* (321) cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ - -5, /* (322) cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ - -2, /* (323) cmd ::= SHOW VNODES */ - -3, /* (324) cmd ::= SHOW db_name_cond_opt ALIVE */ - -3, /* (325) cmd ::= SHOW CLUSTER ALIVE */ - -4, /* (326) cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt */ - -4, /* (327) cmd ::= SHOW CREATE VIEW full_table_name */ - -2, /* (328) cmd ::= SHOW COMPACTS */ - -3, /* (329) cmd ::= SHOW COMPACT NK_INTEGER */ - 0, /* (330) table_kind_db_name_cond_opt ::= */ - -1, /* (331) table_kind_db_name_cond_opt ::= table_kind */ - -2, /* (332) table_kind_db_name_cond_opt ::= db_name NK_DOT */ - -3, /* (333) table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */ - -1, /* (334) table_kind ::= NORMAL */ - -1, /* (335) table_kind ::= CHILD */ - 0, /* (336) db_name_cond_opt ::= */ - -2, /* (337) db_name_cond_opt ::= db_name NK_DOT */ - 0, /* (338) like_pattern_opt ::= */ - -2, /* (339) like_pattern_opt ::= LIKE NK_STRING */ - -1, /* (340) table_name_cond ::= table_name */ - 0, /* (341) from_db_opt ::= */ - -2, /* (342) from_db_opt ::= FROM db_name */ - 0, /* (343) tag_list_opt ::= */ - -1, /* (344) tag_list_opt ::= tag_item */ - -3, /* (345) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ - -1, /* (346) tag_item ::= TBNAME */ - -1, /* (347) tag_item ::= QTAGS */ - -1, /* (348) tag_item ::= column_name */ - -2, /* (349) tag_item ::= column_name column_alias */ - -3, /* (350) tag_item ::= column_name AS column_alias */ - 0, /* (351) db_kind_opt ::= */ - -1, /* (352) db_kind_opt ::= USER */ - -1, /* (353) db_kind_opt ::= SYSTEM */ - -11, /* (354) cmd ::= CREATE TSMA not_exists_opt tsma_name ON full_table_name tsma_func_list INTERVAL NK_LP duration_literal NK_RP */ - -11, /* (355) cmd ::= CREATE RECURSIVE TSMA not_exists_opt tsma_name ON full_table_name INTERVAL NK_LP duration_literal NK_RP */ - -4, /* (356) cmd ::= DROP TSMA exists_opt full_tsma_name */ - -3, /* (357) cmd ::= SHOW db_name_cond_opt TSMAS */ - -1, /* (358) full_tsma_name ::= tsma_name */ - -3, /* (359) full_tsma_name ::= db_name NK_DOT tsma_name */ - -4, /* (360) tsma_func_list ::= FUNCTION NK_LP func_list NK_RP */ - -8, /* (361) cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */ - -9, /* (362) cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */ - -4, /* (363) cmd ::= DROP INDEX exists_opt full_index_name */ - -1, /* (364) full_index_name ::= index_name */ - -3, /* (365) full_index_name ::= db_name NK_DOT index_name */ - -10, /* (366) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ - -12, /* (367) 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 */ - -1, /* (368) func_list ::= func */ - -3, /* (369) func_list ::= func_list NK_COMMA func */ - -4, /* (370) func ::= sma_func_name NK_LP expression_list NK_RP */ - -1, /* (371) sma_func_name ::= function_name */ - -1, /* (372) sma_func_name ::= COUNT */ - -1, /* (373) sma_func_name ::= FIRST */ - -1, /* (374) sma_func_name ::= LAST */ - -1, /* (375) sma_func_name ::= LAST_ROW */ - 0, /* (376) sma_stream_opt ::= */ - -3, /* (377) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ - -3, /* (378) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ - -3, /* (379) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ - -1, /* (380) with_meta ::= AS */ - -3, /* (381) with_meta ::= WITH META AS */ - -3, /* (382) with_meta ::= ONLY META AS */ - -6, /* (383) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ - -7, /* (384) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ - -8, /* (385) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ - -4, /* (386) cmd ::= DROP TOPIC exists_opt topic_name */ - -7, /* (387) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ - -2, /* (388) cmd ::= DESC full_table_name */ - -2, /* (389) cmd ::= DESCRIBE full_table_name */ - -3, /* (390) cmd ::= RESET QUERY CACHE */ - -4, /* (391) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ - -4, /* (392) cmd ::= EXPLAIN analyze_opt explain_options insert_query */ - 0, /* (393) analyze_opt ::= */ - -1, /* (394) analyze_opt ::= ANALYZE */ - 0, /* (395) explain_options ::= */ - -3, /* (396) explain_options ::= explain_options VERBOSE NK_BOOL */ - -3, /* (397) explain_options ::= explain_options RATIO NK_FLOAT */ - -12, /* (398) cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ - -4, /* (399) cmd ::= DROP FUNCTION exists_opt function_name */ - 0, /* (400) agg_func_opt ::= */ - -1, /* (401) agg_func_opt ::= AGGREGATE */ - 0, /* (402) bufsize_opt ::= */ - -2, /* (403) bufsize_opt ::= BUFSIZE NK_INTEGER */ - 0, /* (404) language_opt ::= */ - -2, /* (405) language_opt ::= LANGUAGE NK_STRING */ - 0, /* (406) or_replace_opt ::= */ - -2, /* (407) or_replace_opt ::= OR REPLACE */ - -6, /* (408) cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */ - -4, /* (409) cmd ::= DROP VIEW exists_opt full_view_name */ - -1, /* (410) full_view_name ::= view_name */ - -3, /* (411) full_view_name ::= db_name NK_DOT view_name */ - -12, /* (412) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */ - -4, /* (413) cmd ::= DROP STREAM exists_opt stream_name */ - -4, /* (414) cmd ::= PAUSE STREAM exists_opt stream_name */ - -5, /* (415) cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ - 0, /* (416) col_list_opt ::= */ - -3, /* (417) col_list_opt ::= NK_LP column_stream_def_list NK_RP */ - -1, /* (418) column_stream_def_list ::= column_stream_def */ - -3, /* (419) column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def */ - -2, /* (420) column_stream_def ::= column_name stream_col_options */ - 0, /* (421) stream_col_options ::= */ - -3, /* (422) stream_col_options ::= stream_col_options PRIMARY KEY */ - 0, /* (423) tag_def_or_ref_opt ::= */ - -1, /* (424) tag_def_or_ref_opt ::= tags_def */ - -4, /* (425) tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP */ - 0, /* (426) stream_options ::= */ - -3, /* (427) stream_options ::= stream_options TRIGGER AT_ONCE */ - -3, /* (428) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ - -4, /* (429) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ - -3, /* (430) stream_options ::= stream_options WATERMARK duration_literal */ - -4, /* (431) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ - -3, /* (432) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ - -3, /* (433) stream_options ::= stream_options DELETE_MARK duration_literal */ - -4, /* (434) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ - 0, /* (435) subtable_opt ::= */ - -4, /* (436) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - 0, /* (437) ignore_opt ::= */ - -2, /* (438) ignore_opt ::= IGNORE UNTREATED */ - -3, /* (439) cmd ::= KILL CONNECTION NK_INTEGER */ - -3, /* (440) cmd ::= KILL QUERY NK_STRING */ - -3, /* (441) cmd ::= KILL TRANSACTION NK_INTEGER */ - -3, /* (442) cmd ::= KILL COMPACT NK_INTEGER */ - -2, /* (443) cmd ::= BALANCE VGROUP */ - -4, /* (444) cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ - -5, /* (445) cmd ::= BALANCE VGROUP LEADER DATABASE db_name */ - -4, /* (446) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ - -4, /* (447) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ - -3, /* (448) cmd ::= SPLIT VGROUP NK_INTEGER */ - 0, /* (449) on_vgroup_id ::= */ - -2, /* (450) on_vgroup_id ::= ON NK_INTEGER */ - -2, /* (451) dnode_list ::= DNODE NK_INTEGER */ - -3, /* (452) dnode_list ::= dnode_list DNODE NK_INTEGER */ - -4, /* (453) cmd ::= DELETE FROM full_table_name where_clause_opt */ - -1, /* (454) cmd ::= query_or_subquery */ - -1, /* (455) cmd ::= insert_query */ - -7, /* (456) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ - -4, /* (457) insert_query ::= INSERT INTO full_table_name query_or_subquery */ - -1, /* (458) tags_literal ::= NK_INTEGER */ - -3, /* (459) tags_literal ::= NK_INTEGER NK_PLUS duration_literal */ - -3, /* (460) tags_literal ::= NK_INTEGER NK_MINUS duration_literal */ - -2, /* (461) tags_literal ::= NK_PLUS NK_INTEGER */ - -4, /* (462) tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal */ - -4, /* (463) tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal */ - -2, /* (464) tags_literal ::= NK_MINUS NK_INTEGER */ - -4, /* (465) tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal */ - -4, /* (466) tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal */ - -1, /* (467) tags_literal ::= NK_FLOAT */ - -2, /* (468) tags_literal ::= NK_PLUS NK_FLOAT */ - -2, /* (469) tags_literal ::= NK_MINUS NK_FLOAT */ - -1, /* (470) tags_literal ::= NK_BIN */ - -3, /* (471) tags_literal ::= NK_BIN NK_PLUS duration_literal */ - -3, /* (472) tags_literal ::= NK_BIN NK_MINUS duration_literal */ - -2, /* (473) tags_literal ::= NK_PLUS NK_BIN */ - -4, /* (474) tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal */ - -4, /* (475) tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal */ - -2, /* (476) tags_literal ::= NK_MINUS NK_BIN */ - -4, /* (477) tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal */ - -4, /* (478) tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal */ - -1, /* (479) tags_literal ::= NK_HEX */ - -3, /* (480) tags_literal ::= NK_HEX NK_PLUS duration_literal */ - -3, /* (481) tags_literal ::= NK_HEX NK_MINUS duration_literal */ - -2, /* (482) tags_literal ::= NK_PLUS NK_HEX */ - -4, /* (483) tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal */ - -4, /* (484) tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal */ - -2, /* (485) tags_literal ::= NK_MINUS NK_HEX */ - -4, /* (486) tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal */ - -4, /* (487) tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal */ - -1, /* (488) tags_literal ::= NK_STRING */ - -3, /* (489) tags_literal ::= NK_STRING NK_PLUS duration_literal */ - -3, /* (490) tags_literal ::= NK_STRING NK_MINUS duration_literal */ - -1, /* (491) tags_literal ::= NK_BOOL */ - -1, /* (492) tags_literal ::= NULL */ - -1, /* (493) tags_literal ::= literal_func */ - -3, /* (494) tags_literal ::= literal_func NK_PLUS duration_literal */ - -3, /* (495) tags_literal ::= literal_func NK_MINUS duration_literal */ - -1, /* (496) tags_literal_list ::= tags_literal */ - -3, /* (497) tags_literal_list ::= tags_literal_list NK_COMMA tags_literal */ - -1, /* (498) literal ::= NK_INTEGER */ - -1, /* (499) literal ::= NK_FLOAT */ - -1, /* (500) literal ::= NK_STRING */ - -1, /* (501) literal ::= NK_BOOL */ - -2, /* (502) literal ::= TIMESTAMP NK_STRING */ - -1, /* (503) literal ::= duration_literal */ - -1, /* (504) literal ::= NULL */ - -1, /* (505) literal ::= NK_QUESTION */ - -1, /* (506) duration_literal ::= NK_VARIABLE */ - -1, /* (507) signed ::= NK_INTEGER */ - -2, /* (508) signed ::= NK_PLUS NK_INTEGER */ - -2, /* (509) signed ::= NK_MINUS NK_INTEGER */ - -1, /* (510) signed ::= NK_FLOAT */ - -2, /* (511) signed ::= NK_PLUS NK_FLOAT */ - -2, /* (512) signed ::= NK_MINUS NK_FLOAT */ - -1, /* (513) signed_literal ::= signed */ - -1, /* (514) signed_literal ::= NK_STRING */ - -1, /* (515) signed_literal ::= NK_BOOL */ - -2, /* (516) signed_literal ::= TIMESTAMP NK_STRING */ - -1, /* (517) signed_literal ::= duration_literal */ - -1, /* (518) signed_literal ::= NULL */ - -1, /* (519) signed_literal ::= literal_func */ - -1, /* (520) signed_literal ::= NK_QUESTION */ - -1, /* (521) literal_list ::= signed_literal */ - -3, /* (522) literal_list ::= literal_list NK_COMMA signed_literal */ - -1, /* (523) db_name ::= NK_ID */ - -1, /* (524) table_name ::= NK_ID */ - -1, /* (525) column_name ::= NK_ID */ - -1, /* (526) function_name ::= NK_ID */ - -1, /* (527) view_name ::= NK_ID */ - -1, /* (528) table_alias ::= NK_ID */ - -1, /* (529) column_alias ::= NK_ID */ - -1, /* (530) column_alias ::= NK_ALIAS */ - -1, /* (531) user_name ::= NK_ID */ - -1, /* (532) topic_name ::= NK_ID */ - -1, /* (533) stream_name ::= NK_ID */ - -1, /* (534) cgroup_name ::= NK_ID */ - -1, /* (535) index_name ::= NK_ID */ - -1, /* (536) tsma_name ::= NK_ID */ - -1, /* (537) expr_or_subquery ::= expression */ - -1, /* (538) expression ::= literal */ - -1, /* (539) expression ::= pseudo_column */ - -1, /* (540) expression ::= column_reference */ - -1, /* (541) expression ::= function_expression */ - -1, /* (542) expression ::= case_when_expression */ - -3, /* (543) expression ::= NK_LP expression NK_RP */ - -2, /* (544) expression ::= NK_PLUS expr_or_subquery */ - -2, /* (545) expression ::= NK_MINUS expr_or_subquery */ - -3, /* (546) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ - -3, /* (547) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ - -3, /* (548) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ - -3, /* (549) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ - -3, /* (550) expression ::= expr_or_subquery NK_REM expr_or_subquery */ - -3, /* (551) expression ::= column_reference NK_ARROW NK_STRING */ - -3, /* (552) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ - -3, /* (553) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ - -1, /* (554) expression_list ::= expr_or_subquery */ - -3, /* (555) expression_list ::= expression_list NK_COMMA expr_or_subquery */ - -1, /* (556) column_reference ::= column_name */ - -3, /* (557) column_reference ::= table_name NK_DOT column_name */ - -1, /* (558) column_reference ::= NK_ALIAS */ - -3, /* (559) column_reference ::= table_name NK_DOT NK_ALIAS */ - -1, /* (560) pseudo_column ::= ROWTS */ - -1, /* (561) pseudo_column ::= TBNAME */ - -3, /* (562) pseudo_column ::= table_name NK_DOT TBNAME */ - -1, /* (563) pseudo_column ::= QSTART */ - -1, /* (564) pseudo_column ::= QEND */ - -1, /* (565) pseudo_column ::= QDURATION */ - -1, /* (566) pseudo_column ::= WSTART */ - -1, /* (567) pseudo_column ::= WEND */ - -1, /* (568) pseudo_column ::= WDURATION */ - -1, /* (569) pseudo_column ::= IROWTS */ - -1, /* (570) pseudo_column ::= ISFILLED */ - -1, /* (571) pseudo_column ::= QTAGS */ - -1, /* (572) pseudo_column ::= FLOW */ - -1, /* (573) pseudo_column ::= FHIGH */ - -1, /* (574) pseudo_column ::= FROWTS */ - -4, /* (575) function_expression ::= function_name NK_LP expression_list NK_RP */ - -4, /* (576) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ - -6, /* (577) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ - -6, /* (578) function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP */ - -6, /* (579) function_expression ::= POSITION NK_LP expr_or_subquery IN expr_or_subquery NK_RP */ - -4, /* (580) function_expression ::= TRIM NK_LP expr_or_subquery NK_RP */ - -6, /* (581) function_expression ::= TRIM NK_LP trim_specification_type FROM expr_or_subquery NK_RP */ - -6, /* (582) function_expression ::= TRIM NK_LP expr_or_subquery FROM expr_or_subquery NK_RP */ - -7, /* (583) function_expression ::= TRIM NK_LP trim_specification_type expr_or_subquery FROM expr_or_subquery NK_RP */ - -4, /* (584) function_expression ::= substr_func NK_LP expression_list NK_RP */ - -6, /* (585) function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery NK_RP */ - -8, /* (586) function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery FOR expr_or_subquery NK_RP */ - -4, /* (587) function_expression ::= REPLACE NK_LP expression_list NK_RP */ - -1, /* (588) function_expression ::= literal_func */ - -1, /* (589) function_expression ::= rand_func */ - -3, /* (590) literal_func ::= noarg_func NK_LP NK_RP */ - -1, /* (591) literal_func ::= NOW */ - -1, /* (592) literal_func ::= TODAY */ - -3, /* (593) rand_func ::= RAND NK_LP NK_RP */ - -4, /* (594) rand_func ::= RAND NK_LP expression_list NK_RP */ - -1, /* (595) substr_func ::= SUBSTR */ - -1, /* (596) substr_func ::= SUBSTRING */ - -1, /* (597) trim_specification_type ::= BOTH */ - -1, /* (598) trim_specification_type ::= TRAILING */ - -1, /* (599) trim_specification_type ::= LEADING */ - -1, /* (600) noarg_func ::= NOW */ - -1, /* (601) noarg_func ::= TODAY */ - -1, /* (602) noarg_func ::= TIMEZONE */ - -1, /* (603) noarg_func ::= DATABASE */ - -1, /* (604) noarg_func ::= CLIENT_VERSION */ - -1, /* (605) noarg_func ::= SERVER_VERSION */ - -1, /* (606) noarg_func ::= SERVER_STATUS */ - -1, /* (607) noarg_func ::= CURRENT_USER */ - -1, /* (608) noarg_func ::= USER */ - -1, /* (609) noarg_func ::= PI */ - -1, /* (610) star_func ::= COUNT */ - -1, /* (611) star_func ::= FIRST */ - -1, /* (612) star_func ::= LAST */ - -1, /* (613) star_func ::= LAST_ROW */ - -1, /* (614) star_func_para_list ::= NK_STAR */ - -1, /* (615) star_func_para_list ::= other_para_list */ - -1, /* (616) other_para_list ::= star_func_para */ - -3, /* (617) other_para_list ::= other_para_list NK_COMMA star_func_para */ - -1, /* (618) star_func_para ::= expr_or_subquery */ - -3, /* (619) star_func_para ::= table_name NK_DOT NK_STAR */ - -4, /* (620) case_when_expression ::= CASE when_then_list case_when_else_opt END */ - -5, /* (621) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ - -1, /* (622) when_then_list ::= when_then_expr */ - -2, /* (623) when_then_list ::= when_then_list when_then_expr */ - -4, /* (624) when_then_expr ::= WHEN common_expression THEN common_expression */ - 0, /* (625) case_when_else_opt ::= */ - -2, /* (626) case_when_else_opt ::= ELSE common_expression */ - -3, /* (627) predicate ::= expr_or_subquery compare_op expr_or_subquery */ - -5, /* (628) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ - -6, /* (629) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ - -3, /* (630) predicate ::= expr_or_subquery IS NULL */ - -4, /* (631) predicate ::= expr_or_subquery IS NOT NULL */ - -3, /* (632) predicate ::= expr_or_subquery in_op in_predicate_value */ - -1, /* (633) compare_op ::= NK_LT */ - -1, /* (634) compare_op ::= NK_GT */ - -1, /* (635) compare_op ::= NK_LE */ - -1, /* (636) compare_op ::= NK_GE */ - -1, /* (637) compare_op ::= NK_NE */ - -1, /* (638) compare_op ::= NK_EQ */ - -1, /* (639) compare_op ::= LIKE */ - -2, /* (640) compare_op ::= NOT LIKE */ - -1, /* (641) compare_op ::= MATCH */ - -1, /* (642) compare_op ::= NMATCH */ - -1, /* (643) compare_op ::= CONTAINS */ - -1, /* (644) in_op ::= IN */ - -2, /* (645) in_op ::= NOT IN */ - -3, /* (646) in_predicate_value ::= NK_LP literal_list NK_RP */ - -1, /* (647) boolean_value_expression ::= boolean_primary */ - -2, /* (648) boolean_value_expression ::= NOT boolean_primary */ - -3, /* (649) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - -3, /* (650) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - -1, /* (651) boolean_primary ::= predicate */ - -3, /* (652) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ - -1, /* (653) common_expression ::= expr_or_subquery */ - -1, /* (654) common_expression ::= boolean_value_expression */ - 0, /* (655) from_clause_opt ::= */ - -2, /* (656) from_clause_opt ::= FROM table_reference_list */ - -1, /* (657) table_reference_list ::= table_reference */ - -3, /* (658) table_reference_list ::= table_reference_list NK_COMMA table_reference */ - -1, /* (659) table_reference ::= table_primary */ - -1, /* (660) table_reference ::= joined_table */ - -2, /* (661) table_primary ::= table_name alias_opt */ - -4, /* (662) table_primary ::= db_name NK_DOT table_name alias_opt */ - -2, /* (663) table_primary ::= subquery alias_opt */ - -1, /* (664) table_primary ::= parenthesized_joined_table */ - 0, /* (665) alias_opt ::= */ - -1, /* (666) alias_opt ::= table_alias */ - -2, /* (667) alias_opt ::= AS table_alias */ - -3, /* (668) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - -3, /* (669) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ - -8, /* (670) joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt */ - 0, /* (671) join_type ::= */ - -1, /* (672) join_type ::= INNER */ - -1, /* (673) join_type ::= LEFT */ - -1, /* (674) join_type ::= RIGHT */ - -1, /* (675) join_type ::= FULL */ - 0, /* (676) join_subtype ::= */ - -1, /* (677) join_subtype ::= OUTER */ - -1, /* (678) join_subtype ::= SEMI */ - -1, /* (679) join_subtype ::= ANTI */ - -1, /* (680) join_subtype ::= ASOF */ - -1, /* (681) join_subtype ::= WINDOW */ - 0, /* (682) join_on_clause_opt ::= */ - -2, /* (683) join_on_clause_opt ::= ON search_condition */ - 0, /* (684) window_offset_clause_opt ::= */ - -6, /* (685) window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP */ - -1, /* (686) window_offset_literal ::= NK_VARIABLE */ - -2, /* (687) window_offset_literal ::= NK_MINUS NK_VARIABLE */ - 0, /* (688) jlimit_clause_opt ::= */ - -2, /* (689) jlimit_clause_opt ::= JLIMIT NK_INTEGER */ - -14, /* (690) query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_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 */ - 0, /* (691) hint_list ::= */ - -1, /* (692) hint_list ::= NK_HINT */ - 0, /* (693) tag_mode_opt ::= */ - -1, /* (694) tag_mode_opt ::= TAGS */ - 0, /* (695) set_quantifier_opt ::= */ - -1, /* (696) set_quantifier_opt ::= DISTINCT */ - -1, /* (697) set_quantifier_opt ::= ALL */ - -1, /* (698) select_list ::= select_item */ - -3, /* (699) select_list ::= select_list NK_COMMA select_item */ - -1, /* (700) select_item ::= NK_STAR */ - -1, /* (701) select_item ::= common_expression */ - -2, /* (702) select_item ::= common_expression column_alias */ - -3, /* (703) select_item ::= common_expression AS column_alias */ - -3, /* (704) select_item ::= table_name NK_DOT NK_STAR */ - 0, /* (705) where_clause_opt ::= */ - -2, /* (706) where_clause_opt ::= WHERE search_condition */ - 0, /* (707) partition_by_clause_opt ::= */ - -3, /* (708) partition_by_clause_opt ::= PARTITION BY partition_list */ - -1, /* (709) partition_list ::= partition_item */ - -3, /* (710) partition_list ::= partition_list NK_COMMA partition_item */ - -1, /* (711) partition_item ::= expr_or_subquery */ - -2, /* (712) partition_item ::= expr_or_subquery column_alias */ - -3, /* (713) partition_item ::= expr_or_subquery AS column_alias */ - 0, /* (714) twindow_clause_opt ::= */ - -6, /* (715) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ - -4, /* (716) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ - -6, /* (717) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ - -8, /* (718) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ - -7, /* (719) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ - -4, /* (720) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */ - -6, /* (721) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - -4, /* (722) twindow_clause_opt ::= ANOMALY_WINDOW NK_LP expr_or_subquery NK_RP */ - -6, /* (723) twindow_clause_opt ::= ANOMALY_WINDOW NK_LP expr_or_subquery NK_COMMA NK_STRING NK_RP */ - 0, /* (724) sliding_opt ::= */ - -4, /* (725) sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ - -1, /* (726) interval_sliding_duration_literal ::= NK_VARIABLE */ - -1, /* (727) interval_sliding_duration_literal ::= NK_STRING */ - -1, /* (728) interval_sliding_duration_literal ::= NK_INTEGER */ - 0, /* (729) fill_opt ::= */ - -4, /* (730) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - -6, /* (731) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ - -6, /* (732) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ - -1, /* (733) fill_mode ::= NONE */ - -1, /* (734) fill_mode ::= PREV */ - -1, /* (735) fill_mode ::= NULL */ - -1, /* (736) fill_mode ::= NULL_F */ - -1, /* (737) fill_mode ::= LINEAR */ - -1, /* (738) fill_mode ::= NEXT */ - 0, /* (739) group_by_clause_opt ::= */ - -3, /* (740) group_by_clause_opt ::= GROUP BY group_by_list */ - -1, /* (741) group_by_list ::= expr_or_subquery */ - -3, /* (742) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ - 0, /* (743) having_clause_opt ::= */ - -2, /* (744) having_clause_opt ::= HAVING search_condition */ - 0, /* (745) range_opt ::= */ - -6, /* (746) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ - -4, /* (747) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ - 0, /* (748) every_opt ::= */ - -4, /* (749) every_opt ::= EVERY NK_LP duration_literal NK_RP */ - -4, /* (750) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ - -1, /* (751) query_simple ::= query_specification */ - -1, /* (752) query_simple ::= union_query_expression */ - -4, /* (753) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ - -3, /* (754) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ - -1, /* (755) query_simple_or_subquery ::= query_simple */ - -1, /* (756) query_simple_or_subquery ::= subquery */ - -1, /* (757) query_or_subquery ::= query_expression */ - -1, /* (758) query_or_subquery ::= subquery */ - 0, /* (759) order_by_clause_opt ::= */ - -3, /* (760) order_by_clause_opt ::= ORDER BY sort_specification_list */ - 0, /* (761) slimit_clause_opt ::= */ - -2, /* (762) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - -4, /* (763) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - -4, /* (764) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - 0, /* (765) limit_clause_opt ::= */ - -2, /* (766) limit_clause_opt ::= LIMIT NK_INTEGER */ - -4, /* (767) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - -4, /* (768) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - -3, /* (769) subquery ::= NK_LP query_expression NK_RP */ - -3, /* (770) subquery ::= NK_LP subquery NK_RP */ - -1, /* (771) search_condition ::= common_expression */ - -1, /* (772) sort_specification_list ::= sort_specification */ - -3, /* (773) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - -3, /* (774) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ - 0, /* (775) ordering_specification_opt ::= */ - -1, /* (776) ordering_specification_opt ::= ASC */ - -1, /* (777) ordering_specification_opt ::= DESC */ - 0, /* (778) null_ordering_opt ::= */ - -2, /* (779) null_ordering_opt ::= NULLS FIRST */ - -2, /* (780) null_ordering_opt ::= NULLS LAST */ - 0, /* (781) column_options ::= */ - -3, /* (782) column_options ::= column_options PRIMARY KEY */ - -3, /* (783) column_options ::= column_options NK_ID NK_STRING */ -}; - -static void yy_accept(yyParser*); /* Forward Declaration */ - -/* -** Perform a reduce action and the shift that must immediately -** follow the reduce. -** -** The yyLookahead and yyLookaheadToken parameters provide reduce actions -** access to the lookahead token (if any). The yyLookahead will be YYNOCODE -** if the lookahead token has already been consumed. As this procedure is -** only called from one place, optimizing compilers will in-line it, which -** means that the extra parameters have no performance impact. -*/ -static YYACTIONTYPE yy_reduce( - yyParser *yypParser, /* The parser */ - unsigned int yyruleno, /* Number of the rule by which to reduce */ - int yyLookahead, /* Lookahead token, or YYNOCODE if none */ - ParseTOKENTYPE yyLookaheadToken /* Value of the lookahead token */ - ParseCTX_PDECL /* %extra_context */ -){ - int yygoto; /* The next state */ - YYACTIONTYPE yyact; /* The next action */ - yyStackEntry *yymsp; /* The top of the parser's stack */ - int yysize; /* Amount to pop the stack */ - ParseARG_FETCH - (void)yyLookahead; - (void)yyLookaheadToken; - yymsp = yypParser->yytos; -#ifndef NDEBUG - if( yyTraceFILE && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){ - yysize = yyRuleInfoNRhs[yyruleno]; - if( yysize ){ - fprintf(yyTraceFILE, "%sReduce %d [%s]%s, pop back to state %d.\n", - yyTracePrompt, - yyruleno, yyRuleName[yyruleno], - yyrulenoyytos - yypParser->yystack)>yypParser->yyhwm ){ - yypParser->yyhwm++; - assert( yypParser->yyhwm == (int)(yypParser->yytos - yypParser->yystack)); - } -#endif -#if YYSTACKDEPTH>0 - if( yypParser->yytos>=yypParser->yystackEnd ){ - yyStackOverflow(yypParser); - /* The call to yyStackOverflow() above pops the stack until it is - ** empty, causing the main parser loop to exit. So the return value - ** is never used and does not matter. */ - return 0; - } -#else - if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz-1] ){ - if( yyGrowStack(yypParser) ){ - yyStackOverflow(yypParser); - /* The call to yyStackOverflow() above pops the stack until it is - ** empty, causing the main parser loop to exit. So the return value - ** is never used and does not matter. */ - return 0; - } - yymsp = yypParser->yytos; - } -#endif - } - - switch( yyruleno ){ - /* Beginning here are the reduction cases. A typical example - ** follows: - ** case 0: - ** #line - ** { ... } // User supplied code - ** #line - ** break; - */ -/********** Begin reduce actions **********************************************/ - 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,390,&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,391,&yymsp[0].minor); - break; - case 2: /* account_options ::= */ -{ } - break; - case 3: /* account_options ::= account_options PPS literal */ - case 4: /* account_options ::= account_options TSERIES literal */ yytestcase(yyruleno==4); - case 5: /* account_options ::= account_options STORAGE literal */ yytestcase(yyruleno==5); - case 6: /* account_options ::= account_options STREAMS literal */ yytestcase(yyruleno==6); - case 7: /* account_options ::= account_options QTIME literal */ yytestcase(yyruleno==7); - case 8: /* account_options ::= account_options DBS literal */ yytestcase(yyruleno==8); - 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,390,&yymsp[-2].minor); -{ } - yy_destructor(yypParser,392,&yymsp[0].minor); -} - break; - case 12: /* alter_account_options ::= alter_account_option */ -{ yy_destructor(yypParser,393,&yymsp[0].minor); -{ } -} - break; - case 13: /* alter_account_options ::= alter_account_options alter_account_option */ -{ yy_destructor(yypParser,391,&yymsp[-1].minor); -{ } - yy_destructor(yypParser,393,&yymsp[0].minor); -} - break; - case 14: /* alter_account_option ::= PASS literal */ - case 15: /* alter_account_option ::= PPS literal */ yytestcase(yyruleno==15); - case 16: /* alter_account_option ::= TSERIES literal */ yytestcase(yyruleno==16); - case 17: /* alter_account_option ::= STORAGE literal */ yytestcase(yyruleno==17); - case 18: /* alter_account_option ::= STREAMS literal */ yytestcase(yyruleno==18); - case 19: /* alter_account_option ::= QTIME literal */ yytestcase(yyruleno==19); - case 20: /* alter_account_option ::= DBS literal */ yytestcase(yyruleno==20); - case 21: /* alter_account_option ::= USERS literal */ yytestcase(yyruleno==21); - case 22: /* alter_account_option ::= CONNS literal */ yytestcase(yyruleno==22); - case 23: /* alter_account_option ::= STATE literal */ yytestcase(yyruleno==23); -{ } - yy_destructor(yypParser,392,&yymsp[0].minor); - break; - case 24: /* ip_range_list ::= NK_STRING */ -{ yylhsminor.yy946 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy946 = yylhsminor.yy946; - break; - case 25: /* ip_range_list ::= ip_range_list NK_COMMA NK_STRING */ -{ yylhsminor.yy946 = addNodeToList(pCxt, yymsp[-2].minor.yy946, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy946 = yylhsminor.yy946; - break; - case 26: /* white_list ::= HOST ip_range_list */ -{ yymsp[-1].minor.yy946 = yymsp[0].minor.yy946; } - break; - case 27: /* white_list_opt ::= */ - case 212: /* specific_cols_opt ::= */ yytestcase(yyruleno==212); - case 250: /* tags_def_opt ::= */ yytestcase(yyruleno==250); - case 343: /* tag_list_opt ::= */ yytestcase(yyruleno==343); - case 416: /* col_list_opt ::= */ yytestcase(yyruleno==416); - case 423: /* tag_def_or_ref_opt ::= */ yytestcase(yyruleno==423); - case 707: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==707); - case 739: /* group_by_clause_opt ::= */ yytestcase(yyruleno==739); - case 759: /* order_by_clause_opt ::= */ yytestcase(yyruleno==759); -{ yymsp[1].minor.yy946 = NULL; } - break; - case 28: /* white_list_opt ::= white_list */ - case 251: /* tags_def_opt ::= tags_def */ yytestcase(yyruleno==251); - case 424: /* tag_def_or_ref_opt ::= tags_def */ yytestcase(yyruleno==424); - case 615: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==615); -{ yylhsminor.yy946 = yymsp[0].minor.yy946; } - yymsp[0].minor.yy946 = yylhsminor.yy946; - break; - case 29: /* is_import_opt ::= */ - case 31: /* is_createdb_opt ::= */ yytestcase(yyruleno==31); -{ yymsp[1].minor.yy815 = 0; } - break; - case 30: /* is_import_opt ::= IS_IMPORT NK_INTEGER */ - case 32: /* is_createdb_opt ::= CREATEDB NK_INTEGER */ yytestcase(yyruleno==32); - case 42: /* sysinfo_opt ::= SYSINFO NK_INTEGER */ yytestcase(yyruleno==42); -{ yymsp[-1].minor.yy815 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); } - break; - case 33: /* cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt is_createdb_opt is_import_opt white_list_opt */ -{ - pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-6].minor.yy557, &yymsp[-4].minor.yy0, yymsp[-3].minor.yy815, yymsp[-1].minor.yy815, yymsp[-2].minor.yy815); - pCxt->pRootNode = addCreateUserStmtWhiteList(pCxt, pCxt->pRootNode, yymsp[0].minor.yy946); - } - break; - case 34: /* cmd ::= ALTER USER user_name PASS NK_STRING */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy557, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } - break; - case 35: /* cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy557, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); } - break; - case 36: /* cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy557, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); } - break; - case 37: /* cmd ::= ALTER USER user_name CREATEDB NK_INTEGER */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy557, TSDB_ALTER_USER_CREATEDB, &yymsp[0].minor.yy0); } - break; - case 38: /* cmd ::= ALTER USER user_name ADD white_list */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy557, TSDB_ALTER_USER_ADD_WHITE_LIST, yymsp[0].minor.yy946); } - break; - case 39: /* cmd ::= ALTER USER user_name DROP white_list */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy557, TSDB_ALTER_USER_DROP_WHITE_LIST, yymsp[0].minor.yy946); } - break; - case 40: /* cmd ::= DROP USER user_name */ -{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy557); } - break; - case 41: /* sysinfo_opt ::= */ -{ yymsp[1].minor.yy815 = 1; } - break; - case 43: /* cmd ::= GRANT privileges ON priv_level with_clause_opt TO user_name */ -{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-5].minor.yy483, &yymsp[-3].minor.yy723, &yymsp[0].minor.yy557, yymsp[-2].minor.yy974); } - break; - case 44: /* cmd ::= REVOKE privileges ON priv_level with_clause_opt FROM user_name */ -{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-5].minor.yy483, &yymsp[-3].minor.yy723, &yymsp[0].minor.yy557, yymsp[-2].minor.yy974); } - break; - case 45: /* privileges ::= ALL */ -{ yymsp[0].minor.yy483 = PRIVILEGE_TYPE_ALL; } - break; - case 46: /* privileges ::= priv_type_list */ - case 48: /* priv_type_list ::= priv_type */ yytestcase(yyruleno==48); -{ yylhsminor.yy483 = yymsp[0].minor.yy483; } - yymsp[0].minor.yy483 = yylhsminor.yy483; - break; - case 47: /* privileges ::= SUBSCRIBE */ -{ yymsp[0].minor.yy483 = PRIVILEGE_TYPE_SUBSCRIBE; } - break; - case 49: /* priv_type_list ::= priv_type_list NK_COMMA priv_type */ -{ yylhsminor.yy483 = yymsp[-2].minor.yy483 | yymsp[0].minor.yy483; } - yymsp[-2].minor.yy483 = yylhsminor.yy483; - break; - case 50: /* priv_type ::= READ */ -{ yymsp[0].minor.yy483 = PRIVILEGE_TYPE_READ; } - break; - case 51: /* priv_type ::= WRITE */ -{ yymsp[0].minor.yy483 = PRIVILEGE_TYPE_WRITE; } - break; - case 52: /* priv_type ::= ALTER */ -{ yymsp[0].minor.yy483 = PRIVILEGE_TYPE_ALTER; } - break; - case 53: /* priv_level ::= NK_STAR NK_DOT NK_STAR */ -{ yylhsminor.yy723.first = yymsp[-2].minor.yy0; yylhsminor.yy723.second = yymsp[0].minor.yy0; } - yymsp[-2].minor.yy723 = yylhsminor.yy723; - break; - case 54: /* priv_level ::= db_name NK_DOT NK_STAR */ -{ yylhsminor.yy723.first = yymsp[-2].minor.yy557; yylhsminor.yy723.second = yymsp[0].minor.yy0; } - yymsp[-2].minor.yy723 = yylhsminor.yy723; - break; - case 55: /* priv_level ::= db_name NK_DOT table_name */ -{ yylhsminor.yy723.first = yymsp[-2].minor.yy557; yylhsminor.yy723.second = yymsp[0].minor.yy557; } - yymsp[-2].minor.yy723 = yylhsminor.yy723; - break; - case 56: /* priv_level ::= topic_name */ -{ yylhsminor.yy723.first = yymsp[0].minor.yy557; yylhsminor.yy723.second = nil_token; } - yymsp[0].minor.yy723 = yylhsminor.yy723; - break; - case 57: /* with_clause_opt ::= */ - case 177: /* start_opt ::= */ yytestcase(yyruleno==177); - case 181: /* end_opt ::= */ yytestcase(yyruleno==181); - case 338: /* like_pattern_opt ::= */ yytestcase(yyruleno==338); - case 435: /* subtable_opt ::= */ yytestcase(yyruleno==435); - case 625: /* case_when_else_opt ::= */ yytestcase(yyruleno==625); - case 655: /* from_clause_opt ::= */ yytestcase(yyruleno==655); - case 682: /* join_on_clause_opt ::= */ yytestcase(yyruleno==682); - case 684: /* window_offset_clause_opt ::= */ yytestcase(yyruleno==684); - case 688: /* jlimit_clause_opt ::= */ yytestcase(yyruleno==688); - case 705: /* where_clause_opt ::= */ yytestcase(yyruleno==705); - case 714: /* twindow_clause_opt ::= */ yytestcase(yyruleno==714); - case 724: /* sliding_opt ::= */ yytestcase(yyruleno==724); - case 729: /* fill_opt ::= */ yytestcase(yyruleno==729); - case 743: /* having_clause_opt ::= */ yytestcase(yyruleno==743); - case 745: /* range_opt ::= */ yytestcase(yyruleno==745); - case 748: /* every_opt ::= */ yytestcase(yyruleno==748); - case 761: /* slimit_clause_opt ::= */ yytestcase(yyruleno==761); - case 765: /* limit_clause_opt ::= */ yytestcase(yyruleno==765); -{ yymsp[1].minor.yy974 = NULL; } - break; - case 58: /* with_clause_opt ::= WITH search_condition */ - case 656: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==656); - case 683: /* join_on_clause_opt ::= ON search_condition */ yytestcase(yyruleno==683); - case 706: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==706); - case 744: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==744); -{ yymsp[-1].minor.yy974 = yymsp[0].minor.yy974; } - break; - case 59: /* cmd ::= CREATE ENCRYPT_KEY NK_STRING */ -{ pCxt->pRootNode = createEncryptKeyStmt(pCxt, &yymsp[0].minor.yy0); } - break; - case 60: /* cmd ::= CREATE ANODE NK_STRING */ -{ pCxt->pRootNode = createCreateAnodeStmt(pCxt, &yymsp[0].minor.yy0); } - break; - case 61: /* cmd ::= UPDATE ANODE NK_INTEGER */ -{ pCxt->pRootNode = createUpdateAnodeStmt(pCxt, &yymsp[0].minor.yy0, false); } - break; - case 62: /* cmd ::= UPDATE ALL ANODES */ -{ pCxt->pRootNode = createUpdateAnodeStmt(pCxt, NULL, true); } - break; - case 63: /* cmd ::= DROP ANODE NK_INTEGER */ -{ pCxt->pRootNode = createDropAnodeStmt(pCxt, &yymsp[0].minor.yy0); } - break; - case 64: /* cmd ::= CREATE DNODE dnode_endpoint */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy557, NULL); } - break; - case 65: /* cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy557, &yymsp[0].minor.yy0); } - break; - case 66: /* cmd ::= DROP DNODE NK_INTEGER force_opt */ -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy569, false); } - break; - case 67: /* cmd ::= DROP DNODE dnode_endpoint force_opt */ -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy557, yymsp[0].minor.yy569, false); } - break; - case 68: /* cmd ::= DROP DNODE NK_INTEGER unsafe_opt */ -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, false, yymsp[0].minor.yy569); } - break; - case 69: /* cmd ::= DROP DNODE dnode_endpoint unsafe_opt */ -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy557, false, yymsp[0].minor.yy569); } - break; - case 70: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ -{ pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, NULL); } - break; - case 71: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ -{ pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-2].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } - break; - case 72: /* cmd ::= ALTER ALL DNODES NK_STRING */ -{ pCxt->pRootNode = createAlterDnodeStmt(pCxt, NULL, &yymsp[0].minor.yy0, NULL); } - break; - case 73: /* cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ -{ pCxt->pRootNode = createAlterDnodeStmt(pCxt, NULL, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } - break; - case 74: /* cmd ::= RESTORE DNODE NK_INTEGER */ -{ pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_DNODE_STMT, &yymsp[0].minor.yy0); } - break; - case 75: /* dnode_endpoint ::= NK_STRING */ - case 76: /* dnode_endpoint ::= NK_ID */ yytestcase(yyruleno==76); - case 77: /* dnode_endpoint ::= NK_IPTOKEN */ yytestcase(yyruleno==77); - case 372: /* sma_func_name ::= COUNT */ yytestcase(yyruleno==372); - case 373: /* sma_func_name ::= FIRST */ yytestcase(yyruleno==373); - case 374: /* sma_func_name ::= LAST */ yytestcase(yyruleno==374); - case 375: /* sma_func_name ::= LAST_ROW */ yytestcase(yyruleno==375); - case 523: /* db_name ::= NK_ID */ yytestcase(yyruleno==523); - case 524: /* table_name ::= NK_ID */ yytestcase(yyruleno==524); - case 525: /* column_name ::= NK_ID */ yytestcase(yyruleno==525); - case 526: /* function_name ::= NK_ID */ yytestcase(yyruleno==526); - case 527: /* view_name ::= NK_ID */ yytestcase(yyruleno==527); - case 528: /* table_alias ::= NK_ID */ yytestcase(yyruleno==528); - case 529: /* column_alias ::= NK_ID */ yytestcase(yyruleno==529); - case 530: /* column_alias ::= NK_ALIAS */ yytestcase(yyruleno==530); - case 531: /* user_name ::= NK_ID */ yytestcase(yyruleno==531); - case 532: /* topic_name ::= NK_ID */ yytestcase(yyruleno==532); - case 533: /* stream_name ::= NK_ID */ yytestcase(yyruleno==533); - case 534: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==534); - case 535: /* index_name ::= NK_ID */ yytestcase(yyruleno==535); - case 536: /* tsma_name ::= NK_ID */ yytestcase(yyruleno==536); - case 595: /* substr_func ::= SUBSTR */ yytestcase(yyruleno==595); - case 596: /* substr_func ::= SUBSTRING */ yytestcase(yyruleno==596); - case 600: /* noarg_func ::= NOW */ yytestcase(yyruleno==600); - case 601: /* noarg_func ::= TODAY */ yytestcase(yyruleno==601); - case 602: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==602); - case 603: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==603); - case 604: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==604); - case 605: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==605); - case 606: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==606); - case 607: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==607); - case 608: /* noarg_func ::= USER */ yytestcase(yyruleno==608); - case 609: /* noarg_func ::= PI */ yytestcase(yyruleno==609); - case 610: /* star_func ::= COUNT */ yytestcase(yyruleno==610); - case 611: /* star_func ::= FIRST */ yytestcase(yyruleno==611); - case 612: /* star_func ::= LAST */ yytestcase(yyruleno==612); - case 613: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==613); -{ yylhsminor.yy557 = yymsp[0].minor.yy0; } - yymsp[0].minor.yy557 = yylhsminor.yy557; - break; - case 78: /* force_opt ::= */ - case 105: /* not_exists_opt ::= */ yytestcase(yyruleno==105); - case 107: /* exists_opt ::= */ yytestcase(yyruleno==107); - case 210: /* with_opt ::= */ yytestcase(yyruleno==210); - case 393: /* analyze_opt ::= */ yytestcase(yyruleno==393); - case 400: /* agg_func_opt ::= */ yytestcase(yyruleno==400); - case 406: /* or_replace_opt ::= */ yytestcase(yyruleno==406); - case 437: /* ignore_opt ::= */ yytestcase(yyruleno==437); - case 693: /* tag_mode_opt ::= */ yytestcase(yyruleno==693); - case 695: /* set_quantifier_opt ::= */ yytestcase(yyruleno==695); -{ yymsp[1].minor.yy569 = false; } - break; - case 79: /* force_opt ::= FORCE */ - case 80: /* unsafe_opt ::= UNSAFE */ yytestcase(yyruleno==80); - case 211: /* with_opt ::= WITH */ yytestcase(yyruleno==211); - case 394: /* analyze_opt ::= ANALYZE */ yytestcase(yyruleno==394); - case 401: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==401); - case 694: /* tag_mode_opt ::= TAGS */ yytestcase(yyruleno==694); - case 696: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==696); -{ yymsp[0].minor.yy569 = true; } - break; - case 81: /* cmd ::= ALTER CLUSTER NK_STRING */ -{ pCxt->pRootNode = createAlterClusterStmt(pCxt, &yymsp[0].minor.yy0, NULL); } - break; - case 82: /* cmd ::= ALTER CLUSTER NK_STRING NK_STRING */ -{ pCxt->pRootNode = createAlterClusterStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } - break; - case 83: /* cmd ::= ALTER LOCAL NK_STRING */ -{ pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[0].minor.yy0, NULL); } - break; - case 84: /* cmd ::= ALTER LOCAL NK_STRING NK_STRING */ -{ pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } - break; - case 85: /* cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ -{ pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_QNODE_STMT, &yymsp[0].minor.yy0); } - break; - case 86: /* cmd ::= DROP QNODE ON DNODE NK_INTEGER */ -{ pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_QNODE_STMT, &yymsp[0].minor.yy0); } - break; - case 87: /* cmd ::= RESTORE QNODE ON DNODE NK_INTEGER */ -{ pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_QNODE_STMT, &yymsp[0].minor.yy0); } - break; - case 88: /* cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ -{ pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_BNODE_STMT, &yymsp[0].minor.yy0); } - break; - case 89: /* cmd ::= DROP BNODE ON DNODE NK_INTEGER */ -{ pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_BNODE_STMT, &yymsp[0].minor.yy0); } - break; - case 90: /* cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ -{ pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_SNODE_STMT, &yymsp[0].minor.yy0); } - break; - case 91: /* cmd ::= DROP SNODE ON DNODE NK_INTEGER */ -{ pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_SNODE_STMT, &yymsp[0].minor.yy0); } - break; - case 92: /* cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ -{ pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_MNODE_STMT, &yymsp[0].minor.yy0); } - break; - case 93: /* cmd ::= DROP MNODE ON DNODE NK_INTEGER */ -{ pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_MNODE_STMT, &yymsp[0].minor.yy0); } - break; - case 94: /* cmd ::= RESTORE MNODE ON DNODE NK_INTEGER */ -{ pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_MNODE_STMT, &yymsp[0].minor.yy0); } - break; - case 95: /* cmd ::= RESTORE VNODE ON DNODE NK_INTEGER */ -{ pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_VNODE_STMT, &yymsp[0].minor.yy0); } - break; - case 96: /* cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ -{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy569, &yymsp[-1].minor.yy557, yymsp[0].minor.yy974); } - break; - case 97: /* cmd ::= DROP DATABASE exists_opt db_name */ -{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy569, &yymsp[0].minor.yy557); } - break; - case 98: /* cmd ::= USE db_name */ -{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy557); } - break; - case 99: /* cmd ::= ALTER DATABASE db_name alter_db_options */ -{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy557, yymsp[0].minor.yy974); } - break; - case 100: /* cmd ::= FLUSH DATABASE db_name */ -{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy557); } - break; - case 101: /* cmd ::= TRIM DATABASE db_name speed_opt */ -{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy557, yymsp[0].minor.yy904); } - break; - case 102: /* cmd ::= S3MIGRATE DATABASE db_name */ -{ pCxt->pRootNode = createS3MigrateDatabaseStmt(pCxt, &yymsp[0].minor.yy557); } - break; - case 103: /* cmd ::= COMPACT DATABASE db_name start_opt end_opt */ -{ pCxt->pRootNode = createCompactStmt(pCxt, &yymsp[-2].minor.yy557, yymsp[-1].minor.yy974, yymsp[0].minor.yy974); } - break; - case 104: /* not_exists_opt ::= IF NOT EXISTS */ -{ yymsp[-2].minor.yy569 = true; } - break; - case 106: /* exists_opt ::= IF EXISTS */ - case 407: /* or_replace_opt ::= OR REPLACE */ yytestcase(yyruleno==407); - case 438: /* ignore_opt ::= IGNORE UNTREATED */ yytestcase(yyruleno==438); -{ yymsp[-1].minor.yy569 = true; } - break; - case 108: /* db_options ::= */ -{ yymsp[1].minor.yy974 = createDefaultDatabaseOptions(pCxt); } - break; - case 109: /* db_options ::= db_options BUFFER NK_INTEGER */ -{ yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 110: /* db_options ::= db_options CACHEMODEL NK_STRING */ -{ yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 111: /* db_options ::= db_options CACHESIZE NK_INTEGER */ -{ yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 112: /* db_options ::= db_options COMP NK_INTEGER */ -{ yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_COMP, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 113: /* db_options ::= db_options DURATION NK_INTEGER */ - case 114: /* db_options ::= db_options DURATION NK_VARIABLE */ yytestcase(yyruleno==114); -{ yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 115: /* db_options ::= db_options MAXROWS NK_INTEGER */ -{ yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 116: /* db_options ::= db_options MINROWS NK_INTEGER */ -{ yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 117: /* db_options ::= db_options KEEP integer_list */ - case 118: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==118); -{ yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_KEEP, yymsp[0].minor.yy946); } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 119: /* db_options ::= db_options PAGES NK_INTEGER */ -{ yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 120: /* db_options ::= db_options PAGESIZE NK_INTEGER */ -{ yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 121: /* db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ -{ yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 122: /* db_options ::= db_options PRECISION NK_STRING */ -{ yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 123: /* db_options ::= db_options REPLICA NK_INTEGER */ -{ yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 124: /* db_options ::= db_options VGROUPS NK_INTEGER */ -{ yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 125: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */ -{ yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 126: /* db_options ::= db_options RETENTIONS retention_list */ -{ yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_RETENTIONS, yymsp[0].minor.yy946); } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 127: /* db_options ::= db_options SCHEMALESS NK_INTEGER */ -{ yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 128: /* db_options ::= db_options WAL_LEVEL NK_INTEGER */ -{ yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_WAL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 129: /* db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ -{ yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 130: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ -{ yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 131: /* 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.yy974 = setDatabaseOption(pCxt, yymsp[-3].minor.yy974, DB_OPTION_WAL_RETENTION_PERIOD, &t); - } - yymsp[-3].minor.yy974 = yylhsminor.yy974; - break; - case 132: /* db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ -{ yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 133: /* 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.yy974 = setDatabaseOption(pCxt, yymsp[-3].minor.yy974, DB_OPTION_WAL_RETENTION_SIZE, &t); - } - yymsp[-3].minor.yy974 = yylhsminor.yy974; - break; - case 134: /* db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ -{ yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 135: /* db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ -{ yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 136: /* db_options ::= db_options STT_TRIGGER NK_INTEGER */ -{ yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 137: /* db_options ::= db_options TABLE_PREFIX signed */ -{ yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_TABLE_PREFIX, yymsp[0].minor.yy974); } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 138: /* db_options ::= db_options TABLE_SUFFIX signed */ -{ yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_TABLE_SUFFIX, yymsp[0].minor.yy974); } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 139: /* db_options ::= db_options S3_CHUNKSIZE NK_INTEGER */ -{ yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_S3_CHUNKSIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 140: /* db_options ::= db_options S3_KEEPLOCAL NK_INTEGER */ - case 141: /* db_options ::= db_options S3_KEEPLOCAL NK_VARIABLE */ yytestcase(yyruleno==141); -{ yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_S3_KEEPLOCAL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 142: /* db_options ::= db_options S3_COMPACT NK_INTEGER */ -{ yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_S3_COMPACT, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 143: /* db_options ::= db_options KEEP_TIME_OFFSET NK_INTEGER */ -{ yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_KEEP_TIME_OFFSET, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 144: /* db_options ::= db_options ENCRYPT_ALGORITHM NK_STRING */ -{ yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_ENCRYPT_ALGORITHM, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 145: /* alter_db_options ::= alter_db_option */ -{ yylhsminor.yy974 = createAlterDatabaseOptions(pCxt); yylhsminor.yy974 = setAlterDatabaseOption(pCxt, yylhsminor.yy974, &yymsp[0].minor.yy683); } - yymsp[0].minor.yy974 = yylhsminor.yy974; - break; - case 146: /* alter_db_options ::= alter_db_options alter_db_option */ -{ yylhsminor.yy974 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy974, &yymsp[0].minor.yy683); } - yymsp[-1].minor.yy974 = yylhsminor.yy974; - break; - case 147: /* alter_db_option ::= BUFFER NK_INTEGER */ -{ yymsp[-1].minor.yy683.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; } - break; - case 148: /* alter_db_option ::= CACHEMODEL NK_STRING */ -{ yymsp[-1].minor.yy683.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; } - break; - case 149: /* alter_db_option ::= CACHESIZE NK_INTEGER */ -{ yymsp[-1].minor.yy683.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; } - break; - case 150: /* alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ -{ yymsp[-1].minor.yy683.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; } - break; - case 151: /* alter_db_option ::= KEEP integer_list */ - case 152: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==152); -{ yymsp[-1].minor.yy683.type = DB_OPTION_KEEP; yymsp[-1].minor.yy683.pList = yymsp[0].minor.yy946; } - break; - case 153: /* alter_db_option ::= PAGES NK_INTEGER */ -{ yymsp[-1].minor.yy683.type = DB_OPTION_PAGES; yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; } - break; - case 154: /* alter_db_option ::= REPLICA NK_INTEGER */ -{ yymsp[-1].minor.yy683.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; } - break; - case 155: /* alter_db_option ::= WAL_LEVEL NK_INTEGER */ -{ yymsp[-1].minor.yy683.type = DB_OPTION_WAL; yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; } - break; - case 156: /* alter_db_option ::= STT_TRIGGER NK_INTEGER */ -{ yymsp[-1].minor.yy683.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; } - break; - case 157: /* alter_db_option ::= MINROWS NK_INTEGER */ -{ yymsp[-1].minor.yy683.type = DB_OPTION_MINROWS; yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; } - break; - case 158: /* alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */ -{ yymsp[-1].minor.yy683.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; } - break; - case 159: /* alter_db_option ::= 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; - yymsp[-2].minor.yy683.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-2].minor.yy683.val = t; - } - break; - case 160: /* alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */ -{ yymsp[-1].minor.yy683.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; } - break; - case 161: /* alter_db_option ::= 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; - yymsp[-2].minor.yy683.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-2].minor.yy683.val = t; - } - break; - case 162: /* alter_db_option ::= S3_KEEPLOCAL NK_INTEGER */ - case 163: /* alter_db_option ::= S3_KEEPLOCAL NK_VARIABLE */ yytestcase(yyruleno==163); -{ yymsp[-1].minor.yy683.type = DB_OPTION_S3_KEEPLOCAL; yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; } - break; - case 164: /* alter_db_option ::= S3_COMPACT NK_INTEGER */ -{ yymsp[-1].minor.yy683.type = DB_OPTION_S3_COMPACT, yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; } - break; - case 165: /* alter_db_option ::= KEEP_TIME_OFFSET NK_INTEGER */ -{ yymsp[-1].minor.yy683.type = DB_OPTION_KEEP_TIME_OFFSET; yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; } - break; - case 166: /* alter_db_option ::= ENCRYPT_ALGORITHM NK_STRING */ -{ yymsp[-1].minor.yy683.type = DB_OPTION_ENCRYPT_ALGORITHM; yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; } - break; - case 167: /* integer_list ::= NK_INTEGER */ -{ yylhsminor.yy946 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy946 = yylhsminor.yy946; - break; - case 168: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */ - case 452: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==452); -{ yylhsminor.yy946 = addNodeToList(pCxt, yymsp[-2].minor.yy946, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy946 = yylhsminor.yy946; - break; - case 169: /* variable_list ::= NK_VARIABLE */ -{ yylhsminor.yy946 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy946 = yylhsminor.yy946; - break; - case 170: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */ -{ yylhsminor.yy946 = addNodeToList(pCxt, yymsp[-2].minor.yy946, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy946 = yylhsminor.yy946; - break; - case 171: /* retention_list ::= retention */ - case 204: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==204); - case 207: /* multi_drop_clause ::= drop_table_clause */ yytestcase(yyruleno==207); - case 216: /* tag_def_list ::= tag_def */ yytestcase(yyruleno==216); - case 219: /* column_def_list ::= column_def */ yytestcase(yyruleno==219); - case 267: /* rollup_func_list ::= rollup_func_name */ yytestcase(yyruleno==267); - case 272: /* col_name_list ::= col_name */ yytestcase(yyruleno==272); - case 344: /* tag_list_opt ::= tag_item */ yytestcase(yyruleno==344); - case 368: /* func_list ::= func */ yytestcase(yyruleno==368); - case 418: /* column_stream_def_list ::= column_stream_def */ yytestcase(yyruleno==418); - case 496: /* tags_literal_list ::= tags_literal */ yytestcase(yyruleno==496); - case 521: /* literal_list ::= signed_literal */ yytestcase(yyruleno==521); - case 616: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==616); - case 622: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==622); - case 698: /* select_list ::= select_item */ yytestcase(yyruleno==698); - case 709: /* partition_list ::= partition_item */ yytestcase(yyruleno==709); - case 772: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==772); -{ yylhsminor.yy946 = createNodeList(pCxt, yymsp[0].minor.yy974); } - yymsp[0].minor.yy946 = yylhsminor.yy946; - break; - case 172: /* retention_list ::= retention_list NK_COMMA retention */ - case 208: /* multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ yytestcase(yyruleno==208); - case 217: /* tag_def_list ::= tag_def_list NK_COMMA tag_def */ yytestcase(yyruleno==217); - case 220: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==220); - case 268: /* rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ yytestcase(yyruleno==268); - case 273: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==273); - case 345: /* tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ yytestcase(yyruleno==345); - case 369: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==369); - case 419: /* column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def */ yytestcase(yyruleno==419); - case 497: /* tags_literal_list ::= tags_literal_list NK_COMMA tags_literal */ yytestcase(yyruleno==497); - case 522: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==522); - case 617: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==617); - case 699: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==699); - case 710: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==710); - case 773: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==773); -{ yylhsminor.yy946 = addNodeToList(pCxt, yymsp[-2].minor.yy946, yymsp[0].minor.yy974); } - yymsp[-2].minor.yy946 = yylhsminor.yy946; - break; - case 173: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ - case 174: /* retention ::= NK_MINUS NK_COLON NK_VARIABLE */ yytestcase(yyruleno==174); -{ yylhsminor.yy974 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 175: /* speed_opt ::= */ - case 402: /* bufsize_opt ::= */ yytestcase(yyruleno==402); -{ yymsp[1].minor.yy904 = 0; } - break; - case 176: /* speed_opt ::= BWLIMIT NK_INTEGER */ - case 403: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==403); -{ yymsp[-1].minor.yy904 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } - break; - case 178: /* start_opt ::= START WITH NK_INTEGER */ - case 182: /* end_opt ::= END WITH NK_INTEGER */ yytestcase(yyruleno==182); -{ yymsp[-2].minor.yy974 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } - break; - case 179: /* start_opt ::= START WITH NK_STRING */ - case 183: /* end_opt ::= END WITH NK_STRING */ yytestcase(yyruleno==183); -{ yymsp[-2].minor.yy974 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } - break; - case 180: /* start_opt ::= START WITH TIMESTAMP NK_STRING */ - case 184: /* end_opt ::= END WITH TIMESTAMP NK_STRING */ yytestcase(yyruleno==184); -{ yymsp[-3].minor.yy974 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } - break; - case 185: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ - case 188: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==188); -{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy569, yymsp[-5].minor.yy974, yymsp[-3].minor.yy946, yymsp[-1].minor.yy946, yymsp[0].minor.yy974); } - break; - case 186: /* cmd ::= CREATE TABLE multi_create_clause */ -{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy946); } - break; - case 187: /* cmd ::= CREATE TABLE not_exists_opt USING full_table_name NK_LP tag_list_opt NK_RP FILE NK_STRING */ -{ pCxt->pRootNode = createCreateSubTableFromFileClause(pCxt, yymsp[-7].minor.yy569, yymsp[-5].minor.yy974, yymsp[-3].minor.yy946, &yymsp[0].minor.yy0); } - break; - case 189: /* cmd ::= DROP TABLE with_opt multi_drop_clause */ -{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[-1].minor.yy569, yymsp[0].minor.yy946); } - break; - case 190: /* cmd ::= DROP STABLE with_opt exists_opt full_table_name */ -{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-2].minor.yy569, yymsp[-1].minor.yy569, yymsp[0].minor.yy974); } - break; - case 191: /* cmd ::= ALTER TABLE alter_table_clause */ - case 454: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==454); - case 455: /* cmd ::= insert_query */ yytestcase(yyruleno==455); -{ pCxt->pRootNode = yymsp[0].minor.yy974; } - break; - case 192: /* cmd ::= ALTER STABLE alter_table_clause */ -{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy974); } - break; - case 193: /* alter_table_clause ::= full_table_name alter_table_options */ -{ yylhsminor.yy974 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy974, yymsp[0].minor.yy974); } - yymsp[-1].minor.yy974 = yylhsminor.yy974; - break; - case 194: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name column_options */ -{ yylhsminor.yy974 = createAlterTableAddModifyColOptions2(pCxt, yymsp[-5].minor.yy974, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-2].minor.yy557, yymsp[-1].minor.yy424, yymsp[0].minor.yy974); } - yymsp[-5].minor.yy974 = yylhsminor.yy974; - break; - case 195: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ -{ yylhsminor.yy974 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy974, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy557); } - yymsp[-3].minor.yy974 = yylhsminor.yy974; - break; - case 196: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ -{ yylhsminor.yy974 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy974, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy557, yymsp[0].minor.yy424); } - yymsp[-4].minor.yy974 = yylhsminor.yy974; - break; - case 197: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name column_options */ -{ yylhsminor.yy974 = createAlterTableAddModifyColOptions(pCxt, yymsp[-4].minor.yy974, TSDB_ALTER_TABLE_UPDATE_COLUMN_COMPRESS, &yymsp[-1].minor.yy557, yymsp[0].minor.yy974); } - yymsp[-4].minor.yy974 = yylhsminor.yy974; - break; - case 198: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ -{ yylhsminor.yy974 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy974, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy557, &yymsp[0].minor.yy557); } - yymsp[-4].minor.yy974 = yylhsminor.yy974; - break; - case 199: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ -{ yylhsminor.yy974 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy974, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy557, yymsp[0].minor.yy424); } - yymsp[-4].minor.yy974 = yylhsminor.yy974; - break; - case 200: /* alter_table_clause ::= full_table_name DROP TAG column_name */ -{ yylhsminor.yy974 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy974, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy557); } - yymsp[-3].minor.yy974 = yylhsminor.yy974; - break; - case 201: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ -{ yylhsminor.yy974 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy974, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy557, yymsp[0].minor.yy424); } - yymsp[-4].minor.yy974 = yylhsminor.yy974; - break; - case 202: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ -{ yylhsminor.yy974 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy974, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy557, &yymsp[0].minor.yy557); } - yymsp[-4].minor.yy974 = yylhsminor.yy974; - break; - case 203: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ tags_literal */ -{ yylhsminor.yy974 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy974, &yymsp[-2].minor.yy557, yymsp[0].minor.yy974); } - yymsp[-5].minor.yy974 = yylhsminor.yy974; - break; - case 205: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ - case 623: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==623); -{ yylhsminor.yy946 = addNodeToList(pCxt, yymsp[-1].minor.yy946, yymsp[0].minor.yy974); } - yymsp[-1].minor.yy946 = yylhsminor.yy946; - break; - case 206: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP tags_literal_list NK_RP table_options */ -{ yylhsminor.yy974 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy569, yymsp[-8].minor.yy974, yymsp[-6].minor.yy974, yymsp[-5].minor.yy946, yymsp[-2].minor.yy946, yymsp[0].minor.yy974); } - yymsp[-9].minor.yy974 = yylhsminor.yy974; - break; - case 209: /* drop_table_clause ::= exists_opt full_table_name */ -{ yylhsminor.yy974 = createDropTableClause(pCxt, yymsp[-1].minor.yy569, yymsp[0].minor.yy974); } - yymsp[-1].minor.yy974 = yylhsminor.yy974; - break; - case 213: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */ - case 417: /* col_list_opt ::= NK_LP column_stream_def_list NK_RP */ yytestcase(yyruleno==417); -{ yymsp[-2].minor.yy946 = yymsp[-1].minor.yy946; } - break; - case 214: /* full_table_name ::= table_name */ - case 358: /* full_tsma_name ::= tsma_name */ yytestcase(yyruleno==358); -{ yylhsminor.yy974 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy557, NULL); } - yymsp[0].minor.yy974 = yylhsminor.yy974; - break; - case 215: /* full_table_name ::= db_name NK_DOT table_name */ - case 359: /* full_tsma_name ::= db_name NK_DOT tsma_name */ yytestcase(yyruleno==359); -{ yylhsminor.yy974 = createRealTableNode(pCxt, &yymsp[-2].minor.yy557, &yymsp[0].minor.yy557, NULL); } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 218: /* tag_def ::= column_name type_name */ -{ yylhsminor.yy974 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy557, yymsp[0].minor.yy424, NULL); } - yymsp[-1].minor.yy974 = yylhsminor.yy974; - break; - case 221: /* column_def ::= column_name type_name column_options */ -{ yylhsminor.yy974 = createColumnDefNode(pCxt, &yymsp[-2].minor.yy557, yymsp[-1].minor.yy424, yymsp[0].minor.yy974); } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 222: /* type_name ::= BOOL */ -{ yymsp[0].minor.yy424 = createDataType(TSDB_DATA_TYPE_BOOL); } - break; - case 223: /* type_name ::= TINYINT */ -{ yymsp[0].minor.yy424 = createDataType(TSDB_DATA_TYPE_TINYINT); } - break; - case 224: /* type_name ::= SMALLINT */ -{ yymsp[0].minor.yy424 = createDataType(TSDB_DATA_TYPE_SMALLINT); } - break; - case 225: /* type_name ::= INT */ - case 226: /* type_name ::= INTEGER */ yytestcase(yyruleno==226); -{ yymsp[0].minor.yy424 = createDataType(TSDB_DATA_TYPE_INT); } - break; - case 227: /* type_name ::= BIGINT */ -{ yymsp[0].minor.yy424 = createDataType(TSDB_DATA_TYPE_BIGINT); } - break; - case 228: /* type_name ::= FLOAT */ -{ yymsp[0].minor.yy424 = createDataType(TSDB_DATA_TYPE_FLOAT); } - break; - case 229: /* type_name ::= DOUBLE */ -{ yymsp[0].minor.yy424 = createDataType(TSDB_DATA_TYPE_DOUBLE); } - break; - case 230: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy424 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } - break; - case 231: /* type_name ::= TIMESTAMP */ -{ yymsp[0].minor.yy424 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } - break; - case 232: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy424 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } - break; - case 233: /* type_name ::= TINYINT UNSIGNED */ -{ yymsp[-1].minor.yy424 = createDataType(TSDB_DATA_TYPE_UTINYINT); } - break; - case 234: /* type_name ::= SMALLINT UNSIGNED */ -{ yymsp[-1].minor.yy424 = createDataType(TSDB_DATA_TYPE_USMALLINT); } - break; - case 235: /* type_name ::= INT UNSIGNED */ -{ yymsp[-1].minor.yy424 = createDataType(TSDB_DATA_TYPE_UINT); } - break; - case 236: /* type_name ::= BIGINT UNSIGNED */ -{ yymsp[-1].minor.yy424 = createDataType(TSDB_DATA_TYPE_UBIGINT); } - break; - case 237: /* type_name ::= JSON */ -{ yymsp[0].minor.yy424 = createDataType(TSDB_DATA_TYPE_JSON); } - break; - case 238: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy424 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } - break; - case 239: /* type_name ::= MEDIUMBLOB */ -{ yymsp[0].minor.yy424 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } - break; - case 240: /* type_name ::= BLOB */ -{ yymsp[0].minor.yy424 = createDataType(TSDB_DATA_TYPE_BLOB); } - break; - case 241: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy424 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } - break; - case 242: /* type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy424 = createVarLenDataType(TSDB_DATA_TYPE_GEOMETRY, &yymsp[-1].minor.yy0); } - break; - case 243: /* type_name ::= DECIMAL */ -{ yymsp[0].minor.yy424 = createDataType(TSDB_DATA_TYPE_DECIMAL); } - break; - case 244: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy424 = createDataType(TSDB_DATA_TYPE_DECIMAL); } - break; - case 245: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ -{ yymsp[-5].minor.yy424 = createDataType(TSDB_DATA_TYPE_DECIMAL); } - break; - case 246: /* type_name_default_len ::= BINARY */ -{ yymsp[0].minor.yy424 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, NULL); } - break; - case 247: /* type_name_default_len ::= NCHAR */ -{ yymsp[0].minor.yy424 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, NULL); } - break; - case 248: /* type_name_default_len ::= VARCHAR */ -{ yymsp[0].minor.yy424 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, NULL); } - break; - case 249: /* type_name_default_len ::= VARBINARY */ -{ yymsp[0].minor.yy424 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, NULL); } - break; - case 252: /* tags_def ::= TAGS NK_LP tag_def_list NK_RP */ - case 425: /* tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP */ yytestcase(yyruleno==425); -{ yymsp[-3].minor.yy946 = yymsp[-1].minor.yy946; } - break; - case 253: /* table_options ::= */ -{ yymsp[1].minor.yy974 = createDefaultTableOptions(pCxt); } - break; - case 254: /* table_options ::= table_options COMMENT NK_STRING */ -{ yylhsminor.yy974 = setTableOption(pCxt, yymsp[-2].minor.yy974, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 255: /* table_options ::= table_options MAX_DELAY duration_list */ -{ yylhsminor.yy974 = setTableOption(pCxt, yymsp[-2].minor.yy974, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy946); } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 256: /* table_options ::= table_options WATERMARK duration_list */ -{ yylhsminor.yy974 = setTableOption(pCxt, yymsp[-2].minor.yy974, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy946); } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 257: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ -{ yylhsminor.yy974 = setTableOption(pCxt, yymsp[-4].minor.yy974, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy946); } - yymsp[-4].minor.yy974 = yylhsminor.yy974; - break; - case 258: /* table_options ::= table_options TTL NK_INTEGER */ -{ yylhsminor.yy974 = setTableOption(pCxt, yymsp[-2].minor.yy974, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 259: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ -{ yylhsminor.yy974 = setTableOption(pCxt, yymsp[-4].minor.yy974, TABLE_OPTION_SMA, yymsp[-1].minor.yy946); } - yymsp[-4].minor.yy974 = yylhsminor.yy974; - break; - case 260: /* table_options ::= table_options DELETE_MARK duration_list */ -{ yylhsminor.yy974 = setTableOption(pCxt, yymsp[-2].minor.yy974, TABLE_OPTION_DELETE_MARK, yymsp[0].minor.yy946); } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 261: /* alter_table_options ::= alter_table_option */ -{ yylhsminor.yy974 = createAlterTableOptions(pCxt); yylhsminor.yy974 = setTableOption(pCxt, yylhsminor.yy974, yymsp[0].minor.yy683.type, &yymsp[0].minor.yy683.val); } - yymsp[0].minor.yy974 = yylhsminor.yy974; - break; - case 262: /* alter_table_options ::= alter_table_options alter_table_option */ -{ yylhsminor.yy974 = setTableOption(pCxt, yymsp[-1].minor.yy974, yymsp[0].minor.yy683.type, &yymsp[0].minor.yy683.val); } - yymsp[-1].minor.yy974 = yylhsminor.yy974; - break; - case 263: /* alter_table_option ::= COMMENT NK_STRING */ -{ yymsp[-1].minor.yy683.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; } - break; - case 264: /* alter_table_option ::= TTL NK_INTEGER */ -{ yymsp[-1].minor.yy683.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; } - break; - case 265: /* duration_list ::= duration_literal */ - case 554: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==554); -{ yylhsminor.yy946 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy974)); } - yymsp[0].minor.yy946 = yylhsminor.yy946; - break; - case 266: /* duration_list ::= duration_list NK_COMMA duration_literal */ - case 555: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==555); -{ yylhsminor.yy946 = addNodeToList(pCxt, yymsp[-2].minor.yy946, releaseRawExprNode(pCxt, yymsp[0].minor.yy974)); } - yymsp[-2].minor.yy946 = yylhsminor.yy946; - break; - case 269: /* rollup_func_name ::= function_name */ -{ yylhsminor.yy974 = createFunctionNode(pCxt, &yymsp[0].minor.yy557, NULL); } - yymsp[0].minor.yy974 = yylhsminor.yy974; - break; - case 270: /* rollup_func_name ::= FIRST */ - case 271: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==271); - case 347: /* tag_item ::= QTAGS */ yytestcase(yyruleno==347); -{ yylhsminor.yy974 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } - yymsp[0].minor.yy974 = yylhsminor.yy974; - break; - case 274: /* col_name ::= column_name */ - case 348: /* tag_item ::= column_name */ yytestcase(yyruleno==348); -{ yylhsminor.yy974 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy557); } - yymsp[0].minor.yy974 = yylhsminor.yy974; - break; - case 275: /* cmd ::= SHOW DNODES */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT); } - break; - case 276: /* cmd ::= SHOW USERS */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USERS_STMT); } - break; - case 277: /* cmd ::= SHOW USERS FULL */ -{ pCxt->pRootNode = createShowStmtWithFull(pCxt, QUERY_NODE_SHOW_USERS_FULL_STMT); } - break; - case 278: /* cmd ::= SHOW USER PRIVILEGES */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USER_PRIVILEGES_STMT); } - break; - case 279: /* cmd ::= SHOW db_kind_opt DATABASES */ -{ - pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT); - (void)setShowKind(pCxt, pCxt->pRootNode, yymsp[-1].minor.yy741); - } - break; - case 280: /* cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */ -{ - pCxt->pRootNode = createShowTablesStmt(pCxt, yymsp[-2].minor.yy595, yymsp[0].minor.yy974, OP_TYPE_LIKE); - } - break; - case 281: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy974, yymsp[0].minor.yy974, OP_TYPE_LIKE); } - break; - case 282: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy974, NULL, OP_TYPE_LIKE); } - break; - case 283: /* cmd ::= SHOW MNODES */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT); } - break; - case 284: /* cmd ::= SHOW QNODES */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QNODES_STMT); } - break; - case 285: /* cmd ::= SHOW ANODES */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_ANODES_STMT); } - break; - case 286: /* cmd ::= SHOW ANODES FULL */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_ANODES_FULL_STMT); } - break; - case 287: /* cmd ::= SHOW ARBGROUPS */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_ARBGROUPS_STMT); } - break; - case 288: /* cmd ::= SHOW FUNCTIONS */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT); } - break; - case 289: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy974, yymsp[-1].minor.yy974, OP_TYPE_EQUAL); } - break; - case 290: /* cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy557), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy557), OP_TYPE_EQUAL); } - break; - case 291: /* cmd ::= SHOW STREAMS */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT); } - break; - case 292: /* cmd ::= SHOW ACCOUNTS */ -{ pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } - break; - case 293: /* cmd ::= SHOW APPS */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_APPS_STMT); } - break; - case 294: /* cmd ::= SHOW CONNECTIONS */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONNECTIONS_STMT); } - break; - case 295: /* cmd ::= SHOW LICENCES */ - case 296: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==296); -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LICENCES_STMT); } - break; - case 297: /* cmd ::= SHOW GRANTS FULL */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_GRANTS_FULL_STMT); } - break; - case 298: /* cmd ::= SHOW GRANTS LOGS */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_GRANTS_LOGS_STMT); } - break; - case 299: /* cmd ::= SHOW CLUSTER MACHINES */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_MACHINES_STMT); } - break; - case 300: /* cmd ::= SHOW CREATE DATABASE db_name */ -{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy557); } - break; - case 301: /* cmd ::= SHOW CREATE TABLE full_table_name */ -{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy974); } - break; - case 302: /* cmd ::= SHOW CREATE STABLE full_table_name */ -{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, -yymsp[0].minor.yy974); } - break; - case 303: /* cmd ::= SHOW ENCRYPTIONS */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_ENCRYPTIONS_STMT); } - break; - case 304: /* cmd ::= SHOW QUERIES */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT); } - break; - case 305: /* cmd ::= SHOW SCORES */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SCORES_STMT); } - break; - case 306: /* cmd ::= SHOW TOPICS */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TOPICS_STMT); } - break; - case 307: /* cmd ::= SHOW VARIABLES */ - case 308: /* cmd ::= SHOW CLUSTER VARIABLES */ yytestcase(yyruleno==308); -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VARIABLES_STMT); } - break; - case 309: /* cmd ::= SHOW LOCAL VARIABLES */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT); } - break; - case 310: /* cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ -{ pCxt->pRootNode = createShowDnodeVariablesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[-2].minor.yy0), yymsp[0].minor.yy974); } - break; - case 311: /* cmd ::= SHOW BNODES */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_BNODES_STMT); } - break; - case 312: /* cmd ::= SHOW SNODES */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SNODES_STMT); } - break; - case 313: /* cmd ::= SHOW CLUSTER */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_STMT); } - break; - case 314: /* cmd ::= SHOW TRANSACTIONS */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TRANSACTIONS_STMT); } - break; - case 315: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ -{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy974); } - break; - case 316: /* cmd ::= SHOW CONSUMERS */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONSUMERS_STMT); } - break; - case 317: /* cmd ::= SHOW SUBSCRIPTIONS */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT); } - break; - case 318: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy974, yymsp[-1].minor.yy974, OP_TYPE_EQUAL); } - break; - case 319: /* cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy557), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy557), OP_TYPE_EQUAL); } - break; - case 320: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ -{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, yymsp[-1].minor.yy974, yymsp[0].minor.yy974, yymsp[-3].minor.yy946); } - break; - case 321: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ -{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, createIdentifierValueNode(pCxt, &yymsp[0].minor.yy557), createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy557), yymsp[-4].minor.yy946); } - break; - case 322: /* cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ -{ pCxt->pRootNode = createShowVnodesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0), NULL); } - break; - case 323: /* cmd ::= SHOW VNODES */ -{ pCxt->pRootNode = createShowVnodesStmt(pCxt, NULL, NULL); } - break; - case 324: /* cmd ::= SHOW db_name_cond_opt ALIVE */ -{ pCxt->pRootNode = createShowAliveStmt(pCxt, yymsp[-1].minor.yy974, QUERY_NODE_SHOW_DB_ALIVE_STMT); } - break; - case 325: /* cmd ::= SHOW CLUSTER ALIVE */ -{ pCxt->pRootNode = createShowAliveStmt(pCxt, NULL, QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT); } - break; - case 326: /* cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VIEWS_STMT, yymsp[-2].minor.yy974, yymsp[0].minor.yy974, OP_TYPE_LIKE); } - break; - case 327: /* cmd ::= SHOW CREATE VIEW full_table_name */ -{ pCxt->pRootNode = createShowCreateViewStmt(pCxt, QUERY_NODE_SHOW_CREATE_VIEW_STMT, yymsp[0].minor.yy974); } - break; - case 328: /* cmd ::= SHOW COMPACTS */ -{ pCxt->pRootNode = createShowCompactsStmt(pCxt, QUERY_NODE_SHOW_COMPACTS_STMT); } - break; - case 329: /* cmd ::= SHOW COMPACT NK_INTEGER */ -{ pCxt->pRootNode = createShowCompactDetailsStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - break; - case 330: /* table_kind_db_name_cond_opt ::= */ -{ yymsp[1].minor.yy595.kind = SHOW_KIND_ALL; yymsp[1].minor.yy595.dbName = nil_token; } - break; - case 331: /* table_kind_db_name_cond_opt ::= table_kind */ -{ yylhsminor.yy595.kind = yymsp[0].minor.yy741; yylhsminor.yy595.dbName = nil_token; } - yymsp[0].minor.yy595 = yylhsminor.yy595; - break; - case 332: /* table_kind_db_name_cond_opt ::= db_name NK_DOT */ -{ yylhsminor.yy595.kind = SHOW_KIND_ALL; yylhsminor.yy595.dbName = yymsp[-1].minor.yy557; } - yymsp[-1].minor.yy595 = yylhsminor.yy595; - break; - case 333: /* table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */ -{ yylhsminor.yy595.kind = yymsp[-2].minor.yy741; yylhsminor.yy595.dbName = yymsp[-1].minor.yy557; } - yymsp[-2].minor.yy595 = yylhsminor.yy595; - break; - case 334: /* table_kind ::= NORMAL */ -{ yymsp[0].minor.yy741 = SHOW_KIND_TABLES_NORMAL; } - break; - case 335: /* table_kind ::= CHILD */ -{ yymsp[0].minor.yy741 = SHOW_KIND_TABLES_CHILD; } - break; - case 336: /* db_name_cond_opt ::= */ - case 341: /* from_db_opt ::= */ yytestcase(yyruleno==341); -{ yymsp[1].minor.yy974 = createDefaultDatabaseCondValue(pCxt); } - break; - case 337: /* db_name_cond_opt ::= db_name NK_DOT */ -{ yylhsminor.yy974 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy557); } - yymsp[-1].minor.yy974 = yylhsminor.yy974; - break; - case 339: /* like_pattern_opt ::= LIKE NK_STRING */ -{ yymsp[-1].minor.yy974 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } - break; - case 340: /* table_name_cond ::= table_name */ -{ yylhsminor.yy974 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy557); } - yymsp[0].minor.yy974 = yylhsminor.yy974; - break; - case 342: /* from_db_opt ::= FROM db_name */ -{ yymsp[-1].minor.yy974 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy557); } - break; - case 346: /* tag_item ::= TBNAME */ -{ yylhsminor.yy974 = setProjectionAlias(pCxt, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL), &yymsp[0].minor.yy0); } - yymsp[0].minor.yy974 = yylhsminor.yy974; - break; - case 349: /* tag_item ::= column_name column_alias */ -{ yylhsminor.yy974 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy557), &yymsp[0].minor.yy557); } - yymsp[-1].minor.yy974 = yylhsminor.yy974; - break; - case 350: /* tag_item ::= column_name AS column_alias */ -{ yylhsminor.yy974 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-2].minor.yy557), &yymsp[0].minor.yy557); } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 351: /* db_kind_opt ::= */ -{ yymsp[1].minor.yy741 = SHOW_KIND_ALL; } - break; - case 352: /* db_kind_opt ::= USER */ -{ yymsp[0].minor.yy741 = SHOW_KIND_DATABASES_USER; } - break; - case 353: /* db_kind_opt ::= SYSTEM */ -{ yymsp[0].minor.yy741 = SHOW_KIND_DATABASES_SYSTEM; } - break; - case 354: /* cmd ::= CREATE TSMA not_exists_opt tsma_name ON full_table_name tsma_func_list INTERVAL NK_LP duration_literal NK_RP */ -{ pCxt->pRootNode = createCreateTSMAStmt(pCxt, yymsp[-8].minor.yy569, &yymsp[-7].minor.yy557, yymsp[-4].minor.yy974, yymsp[-5].minor.yy974, releaseRawExprNode(pCxt, yymsp[-1].minor.yy974)); } - break; - case 355: /* cmd ::= CREATE RECURSIVE TSMA not_exists_opt tsma_name ON full_table_name INTERVAL NK_LP duration_literal NK_RP */ -{ pCxt->pRootNode = createCreateTSMAStmt(pCxt, yymsp[-7].minor.yy569, &yymsp[-6].minor.yy557, NULL, yymsp[-4].minor.yy974, releaseRawExprNode(pCxt, yymsp[-1].minor.yy974)); } - break; - case 356: /* cmd ::= DROP TSMA exists_opt full_tsma_name */ -{ pCxt->pRootNode = createDropTSMAStmt(pCxt, yymsp[-1].minor.yy569, yymsp[0].minor.yy974); } - break; - case 357: /* cmd ::= SHOW db_name_cond_opt TSMAS */ -{ pCxt->pRootNode = createShowTSMASStmt(pCxt, yymsp[-1].minor.yy974); } - break; - case 360: /* tsma_func_list ::= FUNCTION NK_LP func_list NK_RP */ -{ yymsp[-3].minor.yy974 = createTSMAOptions(pCxt, yymsp[-1].minor.yy946); } - break; - case 361: /* cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */ -{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy569, yymsp[-3].minor.yy974, yymsp[-1].minor.yy974, NULL, yymsp[0].minor.yy974); } - break; - case 362: /* cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */ -{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_NORMAL, yymsp[-6].minor.yy569, yymsp[-5].minor.yy974, yymsp[-3].minor.yy974, yymsp[-1].minor.yy946, NULL); } - break; - case 363: /* cmd ::= DROP INDEX exists_opt full_index_name */ -{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy569, yymsp[0].minor.yy974); } - break; - case 364: /* full_index_name ::= index_name */ -{ yylhsminor.yy974 = createRealTableNodeForIndexName(pCxt, NULL, &yymsp[0].minor.yy557); } - yymsp[0].minor.yy974 = yylhsminor.yy974; - break; - case 365: /* full_index_name ::= db_name NK_DOT index_name */ -{ yylhsminor.yy974 = createRealTableNodeForIndexName(pCxt, &yymsp[-2].minor.yy557, &yymsp[0].minor.yy557); } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 366: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ -{ yymsp[-9].minor.yy974 = createIndexOption(pCxt, yymsp[-7].minor.yy946, releaseRawExprNode(pCxt, yymsp[-3].minor.yy974), NULL, yymsp[-1].minor.yy974, yymsp[0].minor.yy974); } - break; - case 367: /* 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.yy974 = createIndexOption(pCxt, yymsp[-9].minor.yy946, releaseRawExprNode(pCxt, yymsp[-5].minor.yy974), releaseRawExprNode(pCxt, yymsp[-3].minor.yy974), yymsp[-1].minor.yy974, yymsp[0].minor.yy974); } - break; - case 370: /* func ::= sma_func_name NK_LP expression_list NK_RP */ -{ yylhsminor.yy974 = createFunctionNode(pCxt, &yymsp[-3].minor.yy557, yymsp[-1].minor.yy946); } - yymsp[-3].minor.yy974 = yylhsminor.yy974; - break; - case 371: /* sma_func_name ::= function_name */ - case 666: /* alias_opt ::= table_alias */ yytestcase(yyruleno==666); -{ yylhsminor.yy557 = yymsp[0].minor.yy557; } - yymsp[0].minor.yy557 = yylhsminor.yy557; - break; - case 376: /* sma_stream_opt ::= */ - case 426: /* stream_options ::= */ yytestcase(yyruleno==426); -{ yymsp[1].minor.yy974 = createStreamOptions(pCxt); } - break; - case 377: /* sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ -{ ((SStreamOptions*)yymsp[-2].minor.yy974)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy974); yylhsminor.yy974 = yymsp[-2].minor.yy974; } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 378: /* sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ -{ ((SStreamOptions*)yymsp[-2].minor.yy974)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy974); yylhsminor.yy974 = yymsp[-2].minor.yy974; } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 379: /* sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ -{ ((SStreamOptions*)yymsp[-2].minor.yy974)->pDeleteMark = releaseRawExprNode(pCxt, yymsp[0].minor.yy974); yylhsminor.yy974 = yymsp[-2].minor.yy974; } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 380: /* with_meta ::= AS */ -{ yymsp[0].minor.yy904 = 0; } - break; - case 381: /* with_meta ::= WITH META AS */ -{ yymsp[-2].minor.yy904 = 1; } - break; - case 382: /* with_meta ::= ONLY META AS */ -{ yymsp[-2].minor.yy904 = 2; } - break; - case 383: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ -{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy569, &yymsp[-2].minor.yy557, yymsp[0].minor.yy974); } - break; - case 384: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy569, &yymsp[-3].minor.yy557, &yymsp[0].minor.yy557, yymsp[-2].minor.yy904); } - break; - case 385: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ -{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-5].minor.yy569, &yymsp[-4].minor.yy557, yymsp[-1].minor.yy974, yymsp[-3].minor.yy904, yymsp[0].minor.yy974); } - break; - case 386: /* cmd ::= DROP TOPIC exists_opt topic_name */ -{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy569, &yymsp[0].minor.yy557); } - break; - case 387: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ -{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy569, &yymsp[-2].minor.yy557, &yymsp[0].minor.yy557); } - break; - case 388: /* cmd ::= DESC full_table_name */ - case 389: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==389); -{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy974); } - break; - case 390: /* cmd ::= RESET QUERY CACHE */ -{ pCxt->pRootNode = createResetQueryCacheStmt(pCxt); } - break; - case 391: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ - case 392: /* cmd ::= EXPLAIN analyze_opt explain_options insert_query */ yytestcase(yyruleno==392); -{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy569, yymsp[-1].minor.yy974, yymsp[0].minor.yy974); } - break; - case 395: /* explain_options ::= */ -{ yymsp[1].minor.yy974 = createDefaultExplainOptions(pCxt); } - break; - case 396: /* explain_options ::= explain_options VERBOSE NK_BOOL */ -{ yylhsminor.yy974 = setExplainVerbose(pCxt, yymsp[-2].minor.yy974, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 397: /* explain_options ::= explain_options RATIO NK_FLOAT */ -{ yylhsminor.yy974 = setExplainRatio(pCxt, yymsp[-2].minor.yy974, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 398: /* cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ -{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-7].minor.yy569, yymsp[-9].minor.yy569, &yymsp[-6].minor.yy557, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy424, yymsp[-1].minor.yy904, &yymsp[0].minor.yy557, yymsp[-10].minor.yy569); } - break; - case 399: /* cmd ::= DROP FUNCTION exists_opt function_name */ -{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy569, &yymsp[0].minor.yy557); } - break; - case 404: /* language_opt ::= */ - case 449: /* on_vgroup_id ::= */ yytestcase(yyruleno==449); -{ yymsp[1].minor.yy557 = nil_token; } - break; - case 405: /* language_opt ::= LANGUAGE NK_STRING */ - case 450: /* on_vgroup_id ::= ON NK_INTEGER */ yytestcase(yyruleno==450); -{ yymsp[-1].minor.yy557 = yymsp[0].minor.yy0; } - break; - case 408: /* cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */ -{ pCxt->pRootNode = createCreateViewStmt(pCxt, yymsp[-4].minor.yy569, yymsp[-2].minor.yy974, &yymsp[-1].minor.yy0, yymsp[0].minor.yy974); } - break; - case 409: /* cmd ::= DROP VIEW exists_opt full_view_name */ -{ pCxt->pRootNode = createDropViewStmt(pCxt, yymsp[-1].minor.yy569, yymsp[0].minor.yy974); } - break; - case 410: /* full_view_name ::= view_name */ -{ yylhsminor.yy974 = createViewNode(pCxt, NULL, &yymsp[0].minor.yy557); } - yymsp[0].minor.yy974 = yylhsminor.yy974; - break; - case 411: /* full_view_name ::= db_name NK_DOT view_name */ -{ yylhsminor.yy974 = createViewNode(pCxt, &yymsp[-2].minor.yy557, &yymsp[0].minor.yy557); } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 412: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */ -{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-9].minor.yy569, &yymsp[-8].minor.yy557, yymsp[-5].minor.yy974, yymsp[-7].minor.yy974, yymsp[-3].minor.yy946, yymsp[-2].minor.yy974, yymsp[0].minor.yy974, yymsp[-4].minor.yy946); } - break; - case 413: /* cmd ::= DROP STREAM exists_opt stream_name */ -{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy569, &yymsp[0].minor.yy557); } - break; - case 414: /* cmd ::= PAUSE STREAM exists_opt stream_name */ -{ pCxt->pRootNode = createPauseStreamStmt(pCxt, yymsp[-1].minor.yy569, &yymsp[0].minor.yy557); } - break; - case 415: /* cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ -{ pCxt->pRootNode = createResumeStreamStmt(pCxt, yymsp[-2].minor.yy569, yymsp[-1].minor.yy569, &yymsp[0].minor.yy557); } - break; - case 420: /* column_stream_def ::= column_name stream_col_options */ -{ yylhsminor.yy974 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy557, createDataType(TSDB_DATA_TYPE_NULL), yymsp[0].minor.yy974); } - yymsp[-1].minor.yy974 = yylhsminor.yy974; - break; - case 421: /* stream_col_options ::= */ - case 781: /* column_options ::= */ yytestcase(yyruleno==781); -{ yymsp[1].minor.yy974 = createDefaultColumnOptions(pCxt); } - break; - case 422: /* stream_col_options ::= stream_col_options PRIMARY KEY */ - case 782: /* column_options ::= column_options PRIMARY KEY */ yytestcase(yyruleno==782); -{ yylhsminor.yy974 = setColumnOptionsPK(pCxt, yymsp[-2].minor.yy974); } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 427: /* stream_options ::= stream_options TRIGGER AT_ONCE */ - case 428: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ yytestcase(yyruleno==428); -{ yylhsminor.yy974 = setStreamOptions(pCxt, yymsp[-2].minor.yy974, SOPT_TRIGGER_TYPE_SET, &yymsp[0].minor.yy0, NULL); } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 429: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ -{ yylhsminor.yy974 = setStreamOptions(pCxt, yymsp[-3].minor.yy974, SOPT_TRIGGER_TYPE_SET, &yymsp[-1].minor.yy0, releaseRawExprNode(pCxt, yymsp[0].minor.yy974)); } - yymsp[-3].minor.yy974 = yylhsminor.yy974; - break; - case 430: /* stream_options ::= stream_options WATERMARK duration_literal */ -{ yylhsminor.yy974 = setStreamOptions(pCxt, yymsp[-2].minor.yy974, SOPT_WATERMARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy974)); } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 431: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ -{ yylhsminor.yy974 = setStreamOptions(pCxt, yymsp[-3].minor.yy974, SOPT_IGNORE_EXPIRED_SET, &yymsp[0].minor.yy0, NULL); } - yymsp[-3].minor.yy974 = yylhsminor.yy974; - break; - case 432: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ -{ yylhsminor.yy974 = setStreamOptions(pCxt, yymsp[-2].minor.yy974, SOPT_FILL_HISTORY_SET, &yymsp[0].minor.yy0, NULL); } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 433: /* stream_options ::= stream_options DELETE_MARK duration_literal */ -{ yylhsminor.yy974 = setStreamOptions(pCxt, yymsp[-2].minor.yy974, SOPT_DELETE_MARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy974)); } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 434: /* stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ -{ yylhsminor.yy974 = setStreamOptions(pCxt, yymsp[-3].minor.yy974, SOPT_IGNORE_UPDATE_SET, &yymsp[0].minor.yy0, NULL); } - yymsp[-3].minor.yy974 = yylhsminor.yy974; - break; - case 436: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - case 725: /* sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ yytestcase(yyruleno==725); - case 749: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==749); -{ yymsp[-3].minor.yy974 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy974); } - break; - case 439: /* cmd ::= KILL CONNECTION NK_INTEGER */ -{ pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); } - break; - case 440: /* cmd ::= KILL QUERY NK_STRING */ -{ pCxt->pRootNode = createKillQueryStmt(pCxt, &yymsp[0].minor.yy0); } - break; - case 441: /* cmd ::= KILL TRANSACTION NK_INTEGER */ -{ pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_TRANSACTION_STMT, &yymsp[0].minor.yy0); } - break; - case 442: /* cmd ::= KILL COMPACT NK_INTEGER */ -{ pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_COMPACT_STMT, &yymsp[0].minor.yy0); } - break; - case 443: /* cmd ::= BALANCE VGROUP */ -{ pCxt->pRootNode = createBalanceVgroupStmt(pCxt); } - break; - case 444: /* cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ -{ pCxt->pRootNode = createBalanceVgroupLeaderStmt(pCxt, &yymsp[0].minor.yy557); } - break; - case 445: /* cmd ::= BALANCE VGROUP LEADER DATABASE db_name */ -{ pCxt->pRootNode = createBalanceVgroupLeaderDBNameStmt(pCxt, &yymsp[0].minor.yy557); } - break; - case 446: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ -{ pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } - break; - case 447: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ -{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy946); } - break; - case 448: /* cmd ::= SPLIT VGROUP NK_INTEGER */ -{ pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); } - break; - case 451: /* dnode_list ::= DNODE NK_INTEGER */ -{ yymsp[-1].minor.yy946 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - break; - case 453: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ -{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy974, yymsp[0].minor.yy974); } - break; - case 456: /* insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ -{ yymsp[-6].minor.yy974 = createInsertStmt(pCxt, yymsp[-4].minor.yy974, yymsp[-2].minor.yy946, yymsp[0].minor.yy974); } - break; - case 457: /* insert_query ::= INSERT INTO full_table_name query_or_subquery */ -{ yymsp[-3].minor.yy974 = createInsertStmt(pCxt, yymsp[-1].minor.yy974, NULL, yymsp[0].minor.yy974); } - break; - case 458: /* tags_literal ::= NK_INTEGER */ - case 470: /* tags_literal ::= NK_BIN */ yytestcase(yyruleno==470); - case 479: /* tags_literal ::= NK_HEX */ yytestcase(yyruleno==479); -{ yylhsminor.yy974 = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0, NULL); } - yymsp[0].minor.yy974 = yylhsminor.yy974; - break; - case 459: /* tags_literal ::= NK_INTEGER NK_PLUS duration_literal */ - case 460: /* tags_literal ::= NK_INTEGER NK_MINUS duration_literal */ yytestcase(yyruleno==460); - case 471: /* tags_literal ::= NK_BIN NK_PLUS duration_literal */ yytestcase(yyruleno==471); - case 472: /* tags_literal ::= NK_BIN NK_MINUS duration_literal */ yytestcase(yyruleno==472); - case 480: /* tags_literal ::= NK_HEX NK_PLUS duration_literal */ yytestcase(yyruleno==480); - case 481: /* tags_literal ::= NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==481); - case 489: /* tags_literal ::= NK_STRING NK_PLUS duration_literal */ yytestcase(yyruleno==489); - case 490: /* tags_literal ::= NK_STRING NK_MINUS duration_literal */ yytestcase(yyruleno==490); -{ - SToken l = yymsp[-2].minor.yy0; - SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974); - l.n = (r.z + r.n) - l.z; - yylhsminor.yy974 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, yymsp[0].minor.yy974); - } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 461: /* tags_literal ::= NK_PLUS NK_INTEGER */ - case 464: /* tags_literal ::= NK_MINUS NK_INTEGER */ yytestcase(yyruleno==464); - case 473: /* tags_literal ::= NK_PLUS NK_BIN */ yytestcase(yyruleno==473); - case 476: /* tags_literal ::= NK_MINUS NK_BIN */ yytestcase(yyruleno==476); - case 482: /* tags_literal ::= NK_PLUS NK_HEX */ yytestcase(yyruleno==482); - case 485: /* tags_literal ::= NK_MINUS NK_HEX */ yytestcase(yyruleno==485); -{ - SToken t = yymsp[-1].minor.yy0; - t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy974 = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &t, NULL); - } - yymsp[-1].minor.yy974 = yylhsminor.yy974; - break; - case 462: /* tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal */ - case 463: /* tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal */ yytestcase(yyruleno==463); - case 465: /* tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal */ yytestcase(yyruleno==465); - case 466: /* tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal */ yytestcase(yyruleno==466); - case 474: /* tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal */ yytestcase(yyruleno==474); - case 475: /* tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal */ yytestcase(yyruleno==475); - case 477: /* tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal */ yytestcase(yyruleno==477); - case 478: /* tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal */ yytestcase(yyruleno==478); - case 483: /* tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal */ yytestcase(yyruleno==483); - case 484: /* tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==484); - case 486: /* tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal */ yytestcase(yyruleno==486); - case 487: /* tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==487); -{ - SToken l = yymsp[-3].minor.yy0; - SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974); - l.n = (r.z + r.n) - l.z; - yylhsminor.yy974 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, yymsp[0].minor.yy974); - } - yymsp[-3].minor.yy974 = yylhsminor.yy974; - break; - case 467: /* tags_literal ::= NK_FLOAT */ -{ yylhsminor.yy974 = createRawValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0, NULL); } - yymsp[0].minor.yy974 = yylhsminor.yy974; - break; - case 468: /* tags_literal ::= NK_PLUS NK_FLOAT */ - case 469: /* tags_literal ::= NK_MINUS NK_FLOAT */ yytestcase(yyruleno==469); -{ - SToken t = yymsp[-1].minor.yy0; - t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy974 = createRawValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t, NULL); - } - yymsp[-1].minor.yy974 = yylhsminor.yy974; - break; - case 488: /* tags_literal ::= NK_STRING */ -{ yylhsminor.yy974 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0, NULL); } - yymsp[0].minor.yy974 = yylhsminor.yy974; - break; - case 491: /* tags_literal ::= NK_BOOL */ -{ yylhsminor.yy974 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0, NULL); } - yymsp[0].minor.yy974 = yylhsminor.yy974; - break; - case 492: /* tags_literal ::= NULL */ -{ yylhsminor.yy974 = createRawValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0, NULL); } - yymsp[0].minor.yy974 = yylhsminor.yy974; - break; - case 493: /* tags_literal ::= literal_func */ -{ yylhsminor.yy974 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BINARY, NULL, yymsp[0].minor.yy974); } - yymsp[0].minor.yy974 = yylhsminor.yy974; - break; - case 494: /* tags_literal ::= literal_func NK_PLUS duration_literal */ - case 495: /* tags_literal ::= literal_func NK_MINUS duration_literal */ yytestcase(yyruleno==495); -{ - SToken l = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy974); - SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974); - l.n = (r.z + r.n) - l.z; - yylhsminor.yy974 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, yymsp[-2].minor.yy974, yymsp[0].minor.yy974); - } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 498: /* literal ::= NK_INTEGER */ -{ yylhsminor.yy974 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy974 = yylhsminor.yy974; - break; - case 499: /* literal ::= NK_FLOAT */ -{ yylhsminor.yy974 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy974 = yylhsminor.yy974; - break; - case 500: /* literal ::= NK_STRING */ -{ yylhsminor.yy974 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy974 = yylhsminor.yy974; - break; - case 501: /* literal ::= NK_BOOL */ -{ yylhsminor.yy974 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy974 = yylhsminor.yy974; - break; - case 502: /* literal ::= TIMESTAMP NK_STRING */ -{ yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } - yymsp[-1].minor.yy974 = yylhsminor.yy974; - break; - case 503: /* literal ::= duration_literal */ - case 513: /* signed_literal ::= signed */ yytestcase(yyruleno==513); - case 537: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==537); - case 538: /* expression ::= literal */ yytestcase(yyruleno==538); - case 540: /* expression ::= column_reference */ yytestcase(yyruleno==540); - case 541: /* expression ::= function_expression */ yytestcase(yyruleno==541); - case 542: /* expression ::= case_when_expression */ yytestcase(yyruleno==542); - case 588: /* function_expression ::= literal_func */ yytestcase(yyruleno==588); - case 589: /* function_expression ::= rand_func */ yytestcase(yyruleno==589); - case 647: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==647); - case 651: /* boolean_primary ::= predicate */ yytestcase(yyruleno==651); - case 653: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==653); - case 654: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==654); - case 657: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==657); - case 659: /* table_reference ::= table_primary */ yytestcase(yyruleno==659); - case 660: /* table_reference ::= joined_table */ yytestcase(yyruleno==660); - case 664: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==664); - case 751: /* query_simple ::= query_specification */ yytestcase(yyruleno==751); - case 752: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==752); - case 755: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==755); - case 757: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==757); -{ yylhsminor.yy974 = yymsp[0].minor.yy974; } - yymsp[0].minor.yy974 = yylhsminor.yy974; - break; - case 504: /* literal ::= NULL */ -{ yylhsminor.yy974 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy974 = yylhsminor.yy974; - break; - case 505: /* literal ::= NK_QUESTION */ -{ yylhsminor.yy974 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy974 = yylhsminor.yy974; - break; - case 506: /* duration_literal ::= NK_VARIABLE */ - case 726: /* interval_sliding_duration_literal ::= NK_VARIABLE */ yytestcase(yyruleno==726); - case 727: /* interval_sliding_duration_literal ::= NK_STRING */ yytestcase(yyruleno==727); - case 728: /* interval_sliding_duration_literal ::= NK_INTEGER */ yytestcase(yyruleno==728); -{ yylhsminor.yy974 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy974 = yylhsminor.yy974; - break; - case 507: /* signed ::= NK_INTEGER */ -{ yylhsminor.yy974 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy974 = yylhsminor.yy974; - break; - case 508: /* signed ::= NK_PLUS NK_INTEGER */ -{ yymsp[-1].minor.yy974 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } - break; - case 509: /* 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.yy974 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); - } - yymsp[-1].minor.yy974 = yylhsminor.yy974; - break; - case 510: /* signed ::= NK_FLOAT */ -{ yylhsminor.yy974 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy974 = yylhsminor.yy974; - break; - case 511: /* signed ::= NK_PLUS NK_FLOAT */ -{ yymsp[-1].minor.yy974 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } - break; - case 512: /* 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.yy974 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); - } - yymsp[-1].minor.yy974 = yylhsminor.yy974; - break; - case 514: /* signed_literal ::= NK_STRING */ -{ yylhsminor.yy974 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy974 = yylhsminor.yy974; - break; - case 515: /* signed_literal ::= NK_BOOL */ -{ yylhsminor.yy974 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy974 = yylhsminor.yy974; - break; - case 516: /* signed_literal ::= TIMESTAMP NK_STRING */ -{ yymsp[-1].minor.yy974 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } - break; - case 517: /* signed_literal ::= duration_literal */ - case 519: /* signed_literal ::= literal_func */ yytestcase(yyruleno==519); - case 618: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==618); - case 701: /* select_item ::= common_expression */ yytestcase(yyruleno==701); - case 711: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==711); - case 756: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==756); - case 758: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==758); - case 771: /* search_condition ::= common_expression */ yytestcase(yyruleno==771); -{ yylhsminor.yy974 = releaseRawExprNode(pCxt, yymsp[0].minor.yy974); } - yymsp[0].minor.yy974 = yylhsminor.yy974; - break; - case 518: /* signed_literal ::= NULL */ -{ yylhsminor.yy974 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy974 = yylhsminor.yy974; - break; - case 520: /* signed_literal ::= NK_QUESTION */ -{ yylhsminor.yy974 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy974 = yylhsminor.yy974; - break; - case 539: /* expression ::= pseudo_column */ -{ yylhsminor.yy974 = yymsp[0].minor.yy974; (void)setRawExprNodeIsPseudoColumn(pCxt, yylhsminor.yy974, true); } - yymsp[0].minor.yy974 = yylhsminor.yy974; - break; - case 543: /* expression ::= NK_LP expression NK_RP */ - case 652: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==652); - case 770: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==770); -{ yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy974)); } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 544: /* expression ::= NK_PLUS expr_or_subquery */ -{ - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974); - yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy974)); - } - yymsp[-1].minor.yy974 = yylhsminor.yy974; - break; - case 545: /* expression ::= NK_MINUS expr_or_subquery */ -{ - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974); - yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy974), NULL)); - } - yymsp[-1].minor.yy974 = yylhsminor.yy974; - break; - case 546: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ -{ - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy974); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974); - yylhsminor.yy974 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), releaseRawExprNode(pCxt, yymsp[0].minor.yy974))); - } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 547: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ -{ - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy974); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974); - yylhsminor.yy974 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), releaseRawExprNode(pCxt, yymsp[0].minor.yy974))); - } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 548: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */ -{ - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy974); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974); - yylhsminor.yy974 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), releaseRawExprNode(pCxt, yymsp[0].minor.yy974))); - } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 549: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ -{ - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy974); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974); - yylhsminor.yy974 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), releaseRawExprNode(pCxt, yymsp[0].minor.yy974))); - } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 550: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */ -{ - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy974); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974); - yylhsminor.yy974 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), releaseRawExprNode(pCxt, yymsp[0].minor.yy974))); - } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 551: /* expression ::= column_reference NK_ARROW NK_STRING */ -{ - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy974); - yylhsminor.yy974 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); - } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 552: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ -{ - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy974); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974); - yylhsminor.yy974 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), releaseRawExprNode(pCxt, yymsp[0].minor.yy974))); - } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 553: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ -{ - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy974); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974); - yylhsminor.yy974 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), releaseRawExprNode(pCxt, yymsp[0].minor.yy974))); - } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 556: /* column_reference ::= column_name */ -{ yylhsminor.yy974 = createRawExprNode(pCxt, &yymsp[0].minor.yy557, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy557)); } - yymsp[0].minor.yy974 = yylhsminor.yy974; - break; - case 557: /* column_reference ::= table_name NK_DOT column_name */ -{ yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy557, &yymsp[0].minor.yy557, createColumnNode(pCxt, &yymsp[-2].minor.yy557, &yymsp[0].minor.yy557)); } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 558: /* column_reference ::= NK_ALIAS */ -{ yylhsminor.yy974 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy974 = yylhsminor.yy974; - break; - case 559: /* column_reference ::= table_name NK_DOT NK_ALIAS */ -{ yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy557, &yymsp[0].minor.yy0, createColumnNode(pCxt, &yymsp[-2].minor.yy557, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 560: /* pseudo_column ::= ROWTS */ - case 561: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==561); - case 563: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==563); - case 564: /* pseudo_column ::= QEND */ yytestcase(yyruleno==564); - case 565: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==565); - case 566: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==566); - case 567: /* pseudo_column ::= WEND */ yytestcase(yyruleno==567); - case 568: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==568); - case 569: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==569); - case 570: /* pseudo_column ::= ISFILLED */ yytestcase(yyruleno==570); - case 571: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==571); - case 572: /* pseudo_column ::= FLOW */ yytestcase(yyruleno==572); - case 573: /* pseudo_column ::= FHIGH */ yytestcase(yyruleno==573); - case 574: /* pseudo_column ::= FROWTS */ yytestcase(yyruleno==574); - case 591: /* literal_func ::= NOW */ yytestcase(yyruleno==591); - case 592: /* literal_func ::= TODAY */ yytestcase(yyruleno==592); -{ yylhsminor.yy974 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } - yymsp[0].minor.yy974 = yylhsminor.yy974; - break; - case 562: /* pseudo_column ::= table_name NK_DOT TBNAME */ -{ yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy557, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy557)))); } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 575: /* function_expression ::= function_name NK_LP expression_list NK_RP */ - case 576: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==576); - case 584: /* function_expression ::= substr_func NK_LP expression_list NK_RP */ yytestcase(yyruleno==584); -{ yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy557, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy557, yymsp[-1].minor.yy946)); } - yymsp[-3].minor.yy974 = yylhsminor.yy974; - break; - case 577: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ - case 578: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP */ yytestcase(yyruleno==578); -{ yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy974), yymsp[-1].minor.yy424)); } - yymsp[-5].minor.yy974 = yylhsminor.yy974; - break; - case 579: /* function_expression ::= POSITION NK_LP expr_or_subquery IN expr_or_subquery NK_RP */ -{ yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createPositionFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy974), releaseRawExprNode(pCxt, yymsp[-1].minor.yy974))); } - yymsp[-5].minor.yy974 = yylhsminor.yy974; - break; - case 580: /* function_expression ::= TRIM NK_LP expr_or_subquery NK_RP */ -{ yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createTrimFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy974), TRIM_TYPE_BOTH)); } - yymsp[-3].minor.yy974 = yylhsminor.yy974; - break; - case 581: /* function_expression ::= TRIM NK_LP trim_specification_type FROM expr_or_subquery NK_RP */ -{ yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createTrimFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy974), yymsp[-3].minor.yy300)); } - yymsp[-5].minor.yy974 = yylhsminor.yy974; - break; - case 582: /* function_expression ::= TRIM NK_LP expr_or_subquery FROM expr_or_subquery NK_RP */ -{ yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createTrimFunctionNodeExt(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy974), releaseRawExprNode(pCxt, yymsp[-1].minor.yy974), TRIM_TYPE_BOTH)); } - yymsp[-5].minor.yy974 = yylhsminor.yy974; - break; - case 583: /* function_expression ::= TRIM NK_LP trim_specification_type expr_or_subquery FROM expr_or_subquery NK_RP */ -{ yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-6].minor.yy0, &yymsp[0].minor.yy0, createTrimFunctionNodeExt(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy974), releaseRawExprNode(pCxt, yymsp[-1].minor.yy974), yymsp[-4].minor.yy300)); } - yymsp[-6].minor.yy974 = yylhsminor.yy974; - break; - case 585: /* function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery NK_RP */ -{ yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy557, &yymsp[0].minor.yy0, createSubstrFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy974), releaseRawExprNode(pCxt, yymsp[-1].minor.yy974))); } - yymsp[-5].minor.yy974 = yylhsminor.yy974; - break; - case 586: /* function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery FOR expr_or_subquery NK_RP */ -{ yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-7].minor.yy557, &yymsp[0].minor.yy0, createSubstrFunctionNodeExt(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy974), releaseRawExprNode(pCxt, yymsp[-3].minor.yy974), releaseRawExprNode(pCxt, yymsp[-1].minor.yy974))); } - yymsp[-7].minor.yy974 = yylhsminor.yy974; - break; - case 587: /* function_expression ::= REPLACE NK_LP expression_list NK_RP */ - case 594: /* rand_func ::= RAND NK_LP expression_list NK_RP */ yytestcase(yyruleno==594); -{ yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy946)); } - yymsp[-3].minor.yy974 = yylhsminor.yy974; - break; - case 590: /* literal_func ::= noarg_func NK_LP NK_RP */ -{ yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy557, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy557, NULL)); } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 593: /* rand_func ::= RAND NK_LP NK_RP */ -{ yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy0, NULL)); } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 597: /* trim_specification_type ::= BOTH */ -{ yymsp[0].minor.yy300 = TRIM_TYPE_BOTH; } - break; - case 598: /* trim_specification_type ::= TRAILING */ -{ yymsp[0].minor.yy300 = TRIM_TYPE_TRAILING; } - break; - case 599: /* trim_specification_type ::= LEADING */ -{ yymsp[0].minor.yy300 = TRIM_TYPE_LEADING; } - break; - case 614: /* star_func_para_list ::= NK_STAR */ -{ yylhsminor.yy946 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy946 = yylhsminor.yy946; - break; - case 619: /* star_func_para ::= table_name NK_DOT NK_STAR */ - case 704: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==704); -{ yylhsminor.yy974 = createColumnNode(pCxt, &yymsp[-2].minor.yy557, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 620: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */ -{ yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy946, yymsp[-1].minor.yy974)); } - yymsp[-3].minor.yy974 = yylhsminor.yy974; - break; - case 621: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ -{ yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy974), yymsp[-2].minor.yy946, yymsp[-1].minor.yy974)); } - yymsp[-4].minor.yy974 = yylhsminor.yy974; - break; - case 624: /* when_then_expr ::= WHEN common_expression THEN common_expression */ -{ yymsp[-3].minor.yy974 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), releaseRawExprNode(pCxt, yymsp[0].minor.yy974)); } - break; - case 626: /* case_when_else_opt ::= ELSE common_expression */ -{ yymsp[-1].minor.yy974 = releaseRawExprNode(pCxt, yymsp[0].minor.yy974); } - break; - case 627: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */ - case 632: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==632); -{ - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy974); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974); - yylhsminor.yy974 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy140, releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), releaseRawExprNode(pCxt, yymsp[0].minor.yy974))); - } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 628: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ -{ - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy974); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974); - yylhsminor.yy974 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy974), releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), releaseRawExprNode(pCxt, yymsp[0].minor.yy974))); - } - yymsp[-4].minor.yy974 = yylhsminor.yy974; - break; - case 629: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ -{ - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy974); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974); - yylhsminor.yy974 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy974), releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), releaseRawExprNode(pCxt, yymsp[0].minor.yy974))); - } - yymsp[-5].minor.yy974 = yylhsminor.yy974; - break; - case 630: /* predicate ::= expr_or_subquery IS NULL */ -{ - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy974); - yylhsminor.yy974 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), NULL)); - } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 631: /* predicate ::= expr_or_subquery IS NOT NULL */ -{ - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy974); - yylhsminor.yy974 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy974), NULL)); - } - yymsp[-3].minor.yy974 = yylhsminor.yy974; - break; - case 633: /* compare_op ::= NK_LT */ -{ yymsp[0].minor.yy140 = OP_TYPE_LOWER_THAN; } - break; - case 634: /* compare_op ::= NK_GT */ -{ yymsp[0].minor.yy140 = OP_TYPE_GREATER_THAN; } - break; - case 635: /* compare_op ::= NK_LE */ -{ yymsp[0].minor.yy140 = OP_TYPE_LOWER_EQUAL; } - break; - case 636: /* compare_op ::= NK_GE */ -{ yymsp[0].minor.yy140 = OP_TYPE_GREATER_EQUAL; } - break; - case 637: /* compare_op ::= NK_NE */ -{ yymsp[0].minor.yy140 = OP_TYPE_NOT_EQUAL; } - break; - case 638: /* compare_op ::= NK_EQ */ -{ yymsp[0].minor.yy140 = OP_TYPE_EQUAL; } - break; - case 639: /* compare_op ::= LIKE */ -{ yymsp[0].minor.yy140 = OP_TYPE_LIKE; } - break; - case 640: /* compare_op ::= NOT LIKE */ -{ yymsp[-1].minor.yy140 = OP_TYPE_NOT_LIKE; } - break; - case 641: /* compare_op ::= MATCH */ -{ yymsp[0].minor.yy140 = OP_TYPE_MATCH; } - break; - case 642: /* compare_op ::= NMATCH */ -{ yymsp[0].minor.yy140 = OP_TYPE_NMATCH; } - break; - case 643: /* compare_op ::= CONTAINS */ -{ yymsp[0].minor.yy140 = OP_TYPE_JSON_CONTAINS; } - break; - case 644: /* in_op ::= IN */ -{ yymsp[0].minor.yy140 = OP_TYPE_IN; } - break; - case 645: /* in_op ::= NOT IN */ -{ yymsp[-1].minor.yy140 = OP_TYPE_NOT_IN; } - break; - case 646: /* in_predicate_value ::= NK_LP literal_list NK_RP */ -{ yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy946)); } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 648: /* boolean_value_expression ::= NOT boolean_primary */ -{ - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974); - yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy974), NULL)); - } - yymsp[-1].minor.yy974 = yylhsminor.yy974; - break; - case 649: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ -{ - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy974); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974); - yylhsminor.yy974 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), releaseRawExprNode(pCxt, yymsp[0].minor.yy974))); - } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 650: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ -{ - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy974); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974); - yylhsminor.yy974 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), releaseRawExprNode(pCxt, yymsp[0].minor.yy974))); - } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 658: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ -{ yylhsminor.yy974 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, JOIN_STYPE_NONE, yymsp[-2].minor.yy974, yymsp[0].minor.yy974, NULL); } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 661: /* table_primary ::= table_name alias_opt */ -{ yylhsminor.yy974 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy557, &yymsp[0].minor.yy557); } - yymsp[-1].minor.yy974 = yylhsminor.yy974; - break; - case 662: /* table_primary ::= db_name NK_DOT table_name alias_opt */ -{ yylhsminor.yy974 = createRealTableNode(pCxt, &yymsp[-3].minor.yy557, &yymsp[-1].minor.yy557, &yymsp[0].minor.yy557); } - yymsp[-3].minor.yy974 = yylhsminor.yy974; - break; - case 663: /* table_primary ::= subquery alias_opt */ -{ yylhsminor.yy974 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy974), &yymsp[0].minor.yy557); } - yymsp[-1].minor.yy974 = yylhsminor.yy974; - break; - case 665: /* alias_opt ::= */ -{ yymsp[1].minor.yy557 = nil_token; } - break; - case 667: /* alias_opt ::= AS table_alias */ -{ yymsp[-1].minor.yy557 = yymsp[0].minor.yy557; } - break; - case 668: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - case 669: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==669); -{ yymsp[-2].minor.yy974 = yymsp[-1].minor.yy974; } - break; - case 670: /* joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt */ -{ - yylhsminor.yy974 = createJoinTableNode(pCxt, yymsp[-6].minor.yy792, yymsp[-5].minor.yy744, yymsp[-7].minor.yy974, yymsp[-3].minor.yy974, yymsp[-2].minor.yy974); - yylhsminor.yy974 = addWindowOffsetClause(pCxt, yylhsminor.yy974, yymsp[-1].minor.yy974); - yylhsminor.yy974 = addJLimitClause(pCxt, yylhsminor.yy974, yymsp[0].minor.yy974); - } - yymsp[-7].minor.yy974 = yylhsminor.yy974; - break; - case 671: /* join_type ::= */ -{ yymsp[1].minor.yy792 = JOIN_TYPE_INNER; } - break; - case 672: /* join_type ::= INNER */ -{ yymsp[0].minor.yy792 = JOIN_TYPE_INNER; } - break; - case 673: /* join_type ::= LEFT */ -{ yymsp[0].minor.yy792 = JOIN_TYPE_LEFT; } - break; - case 674: /* join_type ::= RIGHT */ -{ yymsp[0].minor.yy792 = JOIN_TYPE_RIGHT; } - break; - case 675: /* join_type ::= FULL */ -{ yymsp[0].minor.yy792 = JOIN_TYPE_FULL; } - break; - case 676: /* join_subtype ::= */ -{ yymsp[1].minor.yy744 = JOIN_STYPE_NONE; } - break; - case 677: /* join_subtype ::= OUTER */ -{ yymsp[0].minor.yy744 = JOIN_STYPE_OUTER; } - break; - case 678: /* join_subtype ::= SEMI */ -{ yymsp[0].minor.yy744 = JOIN_STYPE_SEMI; } - break; - case 679: /* join_subtype ::= ANTI */ -{ yymsp[0].minor.yy744 = JOIN_STYPE_ANTI; } - break; - case 680: /* join_subtype ::= ASOF */ -{ yymsp[0].minor.yy744 = JOIN_STYPE_ASOF; } - break; - case 681: /* join_subtype ::= WINDOW */ -{ yymsp[0].minor.yy744 = JOIN_STYPE_WIN; } - break; - case 685: /* window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP */ -{ yymsp[-5].minor.yy974 = createWindowOffsetNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy974), releaseRawExprNode(pCxt, yymsp[-1].minor.yy974)); } - break; - case 686: /* window_offset_literal ::= NK_VARIABLE */ -{ yylhsminor.yy974 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createTimeOffsetValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy974 = yylhsminor.yy974; - break; - case 687: /* window_offset_literal ::= NK_MINUS NK_VARIABLE */ -{ - SToken t = yymsp[-1].minor.yy0; - t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy974 = createRawExprNode(pCxt, &t, createTimeOffsetValueNode(pCxt, &t)); - } - yymsp[-1].minor.yy974 = yylhsminor.yy974; - break; - case 689: /* jlimit_clause_opt ::= JLIMIT NK_INTEGER */ - case 762: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ yytestcase(yyruleno==762); - case 766: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==766); -{ yymsp[-1].minor.yy974 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } - break; - case 690: /* query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_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[-13].minor.yy974 = createSelectStmt(pCxt, yymsp[-11].minor.yy569, yymsp[-9].minor.yy946, yymsp[-8].minor.yy974, yymsp[-12].minor.yy946); - yymsp[-13].minor.yy974 = setSelectStmtTagMode(pCxt, yymsp[-13].minor.yy974, yymsp[-10].minor.yy569); - yymsp[-13].minor.yy974 = addWhereClause(pCxt, yymsp[-13].minor.yy974, yymsp[-7].minor.yy974); - yymsp[-13].minor.yy974 = addPartitionByClause(pCxt, yymsp[-13].minor.yy974, yymsp[-6].minor.yy946); - yymsp[-13].minor.yy974 = addWindowClauseClause(pCxt, yymsp[-13].minor.yy974, yymsp[-2].minor.yy974); - yymsp[-13].minor.yy974 = addGroupByClause(pCxt, yymsp[-13].minor.yy974, yymsp[-1].minor.yy946); - yymsp[-13].minor.yy974 = addHavingClause(pCxt, yymsp[-13].minor.yy974, yymsp[0].minor.yy974); - yymsp[-13].minor.yy974 = addRangeClause(pCxt, yymsp[-13].minor.yy974, yymsp[-5].minor.yy974); - yymsp[-13].minor.yy974 = addEveryClause(pCxt, yymsp[-13].minor.yy974, yymsp[-4].minor.yy974); - yymsp[-13].minor.yy974 = addFillClause(pCxt, yymsp[-13].minor.yy974, yymsp[-3].minor.yy974); - } - break; - case 691: /* hint_list ::= */ -{ yymsp[1].minor.yy946 = createHintNodeList(pCxt, NULL); } - break; - case 692: /* hint_list ::= NK_HINT */ -{ yylhsminor.yy946 = createHintNodeList(pCxt, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy946 = yylhsminor.yy946; - break; - case 697: /* set_quantifier_opt ::= ALL */ -{ yymsp[0].minor.yy569 = false; } - break; - case 700: /* select_item ::= NK_STAR */ -{ yylhsminor.yy974 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy974 = yylhsminor.yy974; - break; - case 702: /* select_item ::= common_expression column_alias */ - case 712: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==712); -{ yylhsminor.yy974 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy974), &yymsp[0].minor.yy557); } - yymsp[-1].minor.yy974 = yylhsminor.yy974; - break; - case 703: /* select_item ::= common_expression AS column_alias */ - case 713: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==713); -{ yylhsminor.yy974 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), &yymsp[0].minor.yy557); } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 708: /* partition_by_clause_opt ::= PARTITION BY partition_list */ - case 740: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==740); - case 760: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==760); -{ yymsp[-2].minor.yy946 = yymsp[0].minor.yy946; } - break; - case 715: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ -{ yymsp[-5].minor.yy974 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy974), releaseRawExprNode(pCxt, yymsp[-1].minor.yy974)); } - break; - case 716: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ -{ yymsp[-3].minor.yy974 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy974)); } - break; - case 717: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-5].minor.yy974 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy974), NULL, yymsp[-1].minor.yy974, yymsp[0].minor.yy974); } - break; - case 718: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-7].minor.yy974 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy974), releaseRawExprNode(pCxt, yymsp[-3].minor.yy974), yymsp[-1].minor.yy974, yymsp[0].minor.yy974); } - break; - case 719: /* twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ -{ yymsp[-6].minor.yy974 = createEventWindowNode(pCxt, yymsp[-3].minor.yy974, yymsp[0].minor.yy974); } - break; - case 720: /* twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy974 = createCountWindowNode(pCxt, &yymsp[-1].minor.yy0, &yymsp[-1].minor.yy0); } - break; - case 721: /* twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ -{ yymsp[-5].minor.yy974 = createCountWindowNode(pCxt, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0); } - break; - case 722: /* twindow_clause_opt ::= ANOMALY_WINDOW NK_LP expr_or_subquery NK_RP */ -{ yymsp[-3].minor.yy974 = createAnomalyWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy974), NULL); } - break; - case 723: /* twindow_clause_opt ::= ANOMALY_WINDOW NK_LP expr_or_subquery NK_COMMA NK_STRING NK_RP */ -{ yymsp[-5].minor.yy974 = createAnomalyWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy974), &yymsp[-1].minor.yy0); } - break; - case 730: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ -{ yymsp[-3].minor.yy974 = createFillNode(pCxt, yymsp[-1].minor.yy102, NULL); } - break; - case 731: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ -{ yymsp[-5].minor.yy974 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy946)); } - break; - case 732: /* fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ -{ yymsp[-5].minor.yy974 = createFillNode(pCxt, FILL_MODE_VALUE_F, createNodeListNode(pCxt, yymsp[-1].minor.yy946)); } - break; - case 733: /* fill_mode ::= NONE */ -{ yymsp[0].minor.yy102 = FILL_MODE_NONE; } - break; - case 734: /* fill_mode ::= PREV */ -{ yymsp[0].minor.yy102 = FILL_MODE_PREV; } - break; - case 735: /* fill_mode ::= NULL */ -{ yymsp[0].minor.yy102 = FILL_MODE_NULL; } - break; - case 736: /* fill_mode ::= NULL_F */ -{ yymsp[0].minor.yy102 = FILL_MODE_NULL_F; } - break; - case 737: /* fill_mode ::= LINEAR */ -{ yymsp[0].minor.yy102 = FILL_MODE_LINEAR; } - break; - case 738: /* fill_mode ::= NEXT */ -{ yymsp[0].minor.yy102 = FILL_MODE_NEXT; } - break; - case 741: /* group_by_list ::= expr_or_subquery */ -{ yylhsminor.yy946 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy974))); } - yymsp[0].minor.yy946 = yylhsminor.yy946; - break; - case 742: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ -{ yylhsminor.yy946 = addNodeToList(pCxt, yymsp[-2].minor.yy946, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy974))); } - yymsp[-2].minor.yy946 = yylhsminor.yy946; - break; - case 746: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ -{ yymsp[-5].minor.yy974 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy974), releaseRawExprNode(pCxt, yymsp[-1].minor.yy974)); } - break; - case 747: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ -{ yymsp[-3].minor.yy974 = createInterpTimePoint(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy974)); } - break; - case 750: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ -{ - yylhsminor.yy974 = addOrderByClause(pCxt, yymsp[-3].minor.yy974, yymsp[-2].minor.yy946); - yylhsminor.yy974 = addSlimitClause(pCxt, yylhsminor.yy974, yymsp[-1].minor.yy974); - yylhsminor.yy974 = addLimitClause(pCxt, yylhsminor.yy974, yymsp[0].minor.yy974); - } - yymsp[-3].minor.yy974 = yylhsminor.yy974; - break; - case 753: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ -{ yylhsminor.yy974 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy974, yymsp[0].minor.yy974); } - yymsp[-3].minor.yy974 = yylhsminor.yy974; - break; - case 754: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ -{ yylhsminor.yy974 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy974, yymsp[0].minor.yy974); } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 763: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - case 767: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==767); -{ yymsp[-3].minor.yy974 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } - break; - case 764: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - case 768: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==768); -{ yymsp[-3].minor.yy974 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } - break; - case 769: /* subquery ::= NK_LP query_expression NK_RP */ -{ yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy974); } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 774: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ -{ yylhsminor.yy974 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), yymsp[-1].minor.yy410, yymsp[0].minor.yy307); } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - case 775: /* ordering_specification_opt ::= */ -{ yymsp[1].minor.yy410 = ORDER_ASC; } - break; - case 776: /* ordering_specification_opt ::= ASC */ -{ yymsp[0].minor.yy410 = ORDER_ASC; } - break; - case 777: /* ordering_specification_opt ::= DESC */ -{ yymsp[0].minor.yy410 = ORDER_DESC; } - break; - case 778: /* null_ordering_opt ::= */ -{ yymsp[1].minor.yy307 = NULL_ORDER_DEFAULT; } - break; - case 779: /* null_ordering_opt ::= NULLS FIRST */ -{ yymsp[-1].minor.yy307 = NULL_ORDER_FIRST; } - break; - case 780: /* null_ordering_opt ::= NULLS LAST */ -{ yymsp[-1].minor.yy307 = NULL_ORDER_LAST; } - break; - case 783: /* column_options ::= column_options NK_ID NK_STRING */ -{ yylhsminor.yy974 = setColumnOptions(pCxt, yymsp[-2].minor.yy974, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy974 = yylhsminor.yy974; - break; - default: - break; -/********** End reduce actions ************************************************/ - }; - assert( yyrulenoYY_MAX_SHIFT && yyact<=YY_MAX_SHIFTREDUCE) ); - - /* It is not possible for a REDUCE to be followed by an error */ - assert( yyact!=YY_ERROR_ACTION ); - - yymsp += yysize+1; - yypParser->yytos = yymsp; - yymsp->stateno = (YYACTIONTYPE)yyact; - yymsp->major = (YYCODETYPE)yygoto; - yyTraceShift(yypParser, yyact, "... then shift"); - return yyact; -} - -/* -** The following code executes when the parse fails -*/ -#ifndef YYNOERRORRECOVERY -static void yy_parse_failed( - yyParser *yypParser /* The parser */ -){ - ParseARG_FETCH - ParseCTX_FETCH -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt); - } -#endif - while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will be executed whenever the - ** parser fails */ -/************ Begin %parse_failure code ***************************************/ -/************ End %parse_failure code *****************************************/ - ParseARG_STORE /* Suppress warning about unused %extra_argument variable */ - ParseCTX_STORE -} -#endif /* YYNOERRORRECOVERY */ - -/* -** The following code executes when a syntax error first occurs. -*/ -static void yy_syntax_error( - yyParser *yypParser, /* The parser */ - int yymajor, /* The major type of the error token */ - ParseTOKENTYPE yyminor /* The minor type of the error token */ -){ - ParseARG_FETCH - ParseCTX_FETCH -#define TOKEN yyminor -/************ Begin %syntax_error code ****************************************/ - - if (TSDB_CODE_SUCCESS == pCxt->errCode) { - if(TOKEN.z) { - pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_SYNTAX_ERROR, TOKEN.z); - } else { - pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INCOMPLETE_SQL); - } - } else if (TSDB_CODE_PAR_DB_NOT_SPECIFIED == pCxt->errCode && TK_NK_FLOAT == TOKEN.type) { - pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_SYNTAX_ERROR, TOKEN.z); - } -/************ End %syntax_error code ******************************************/ - ParseARG_STORE /* Suppress warning about unused %extra_argument variable */ - ParseCTX_STORE -} - -/* -** The following is executed when the parser accepts -*/ -static void yy_accept( - yyParser *yypParser /* The parser */ -){ - ParseARG_FETCH - ParseCTX_FETCH -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt); - } -#endif -#ifndef YYNOERRORRECOVERY - yypParser->yyerrcnt = -1; -#endif - assert( yypParser->yytos==yypParser->yystack ); - /* Here code is inserted which will be executed whenever the - ** parser accepts */ -/*********** Begin %parse_accept code *****************************************/ -/*********** End %parse_accept code *******************************************/ - ParseARG_STORE /* Suppress warning about unused %extra_argument variable */ - ParseCTX_STORE -} - -/* The main parser program. -** The first argument is a pointer to a structure obtained from -** "ParseAlloc" which describes the current state of the parser. -** The second argument is the major token number. The third is -** the minor token. The fourth optional argument is whatever the -** user wants (and specified in the grammar) and is available for -** use by the action routines. -** -** Inputs: -**
        -**
      • A pointer to the parser (an opaque structure.) -**
      • The major token number. -**
      • The minor token number. -**
      • An option argument of a grammar-specified type. -**
      -** -** Outputs: -** None. -*/ -void Parse( - void *yyp, /* The parser */ - int yymajor, /* The major token code number */ - ParseTOKENTYPE yyminor /* The value for the token */ - ParseARG_PDECL /* Optional %extra_argument parameter */ -){ - YYMINORTYPE yyminorunion; - YYACTIONTYPE yyact; /* The parser action. */ -#if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY) - int yyendofinput; /* True if we are at the end of input */ -#endif -#ifdef YYERRORSYMBOL - int yyerrorhit = 0; /* True if yymajor has invoked an error */ -#endif - yyParser *yypParser = (yyParser*)yyp; /* The parser */ - ParseCTX_FETCH - ParseARG_STORE - - assert( yypParser->yytos!=0 ); -#if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY) - yyendofinput = (yymajor==0); -#endif - - yyact = yypParser->yytos->stateno; -#ifndef NDEBUG - if( yyTraceFILE ){ - if( yyact < YY_MIN_REDUCE ){ - fprintf(yyTraceFILE,"%sInput '%s' in state %d\n", - yyTracePrompt,yyTokenName[yymajor],yyact); - }else{ - fprintf(yyTraceFILE,"%sInput '%s' with pending reduce %d\n", - yyTracePrompt,yyTokenName[yymajor],yyact-YY_MIN_REDUCE); - } - } -#endif - - do{ - assert( yyact==yypParser->yytos->stateno ); - yyact = yy_find_shift_action((YYCODETYPE)yymajor,yyact); - if( yyact >= YY_MIN_REDUCE ){ - yyact = yy_reduce(yypParser,yyact-YY_MIN_REDUCE,yymajor, - yyminor ParseCTX_PARAM); - }else if( yyact <= YY_MAX_SHIFTREDUCE ){ - yy_shift(yypParser,yyact,(YYCODETYPE)yymajor,yyminor); -#ifndef YYNOERRORRECOVERY - yypParser->yyerrcnt--; -#endif - break; - }else if( yyact==YY_ACCEPT_ACTION ){ - yypParser->yytos--; - yy_accept(yypParser); - return; - }else{ - assert( yyact == YY_ERROR_ACTION ); - yyminorunion.yy0 = yyminor; -#ifdef YYERRORSYMBOL - int yymx; -#endif -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt); - } -#endif -#ifdef YYERRORSYMBOL - /* A syntax error has occurred. - ** The response to an error depends upon whether or not the - ** grammar defines an error token "ERROR". - ** - ** This is what we do if the grammar does define ERROR: - ** - ** * Call the %syntax_error function. - ** - ** * Begin popping the stack until we enter a state where - ** it is legal to shift the error symbol, then shift - ** the error symbol. - ** - ** * Set the error count to three. - ** - ** * Begin accepting and shifting new tokens. No new error - ** processing will occur until three tokens have been - ** shifted successfully. - ** - */ - if( yypParser->yyerrcnt<0 ){ - yy_syntax_error(yypParser,yymajor,yyminor); - } - yymx = yypParser->yytos->major; - if( yymx==YYERRORSYMBOL || yyerrorhit ){ -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sDiscard input token %s\n", - yyTracePrompt,yyTokenName[yymajor]); - } -#endif - yy_destructor(yypParser, (YYCODETYPE)yymajor, &yyminorunion); - yymajor = YYNOCODE; - }else{ - while( yypParser->yytos >= yypParser->yystack - && (yyact = yy_find_reduce_action( - yypParser->yytos->stateno, - YYERRORSYMBOL)) > YY_MAX_SHIFTREDUCE - ){ - yy_pop_parser_stack(yypParser); - } - if( yypParser->yytos < yypParser->yystack || yymajor==0 ){ - yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion); - yy_parse_failed(yypParser); -#ifndef YYNOERRORRECOVERY - yypParser->yyerrcnt = -1; -#endif - yymajor = YYNOCODE; - }else if( yymx!=YYERRORSYMBOL ){ - yy_shift(yypParser,yyact,YYERRORSYMBOL,yyminor); - } - } - yypParser->yyerrcnt = 3; - yyerrorhit = 1; - if( yymajor==YYNOCODE ) break; - yyact = yypParser->yytos->stateno; -#elif defined(YYNOERRORRECOVERY) - /* If the YYNOERRORRECOVERY macro is defined, then do not attempt to - ** do any kind of error recovery. Instead, simply invoke the syntax - ** error routine and continue going as if nothing had happened. - ** - ** Applications can set this macro (for example inside %include) if - ** they intend to abandon the parse upon the first syntax error seen. - */ - yy_syntax_error(yypParser,yymajor, yyminor); - yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion); - break; -#else /* YYERRORSYMBOL is not defined */ - /* This is what we do if the grammar does not define ERROR: - ** - ** * Report an error message, and throw away the input token. - ** - ** * If the input token is $, then fail the parse. - ** - ** As before, subsequent error messages are suppressed until - ** three input tokens have been successfully shifted. - */ - if( yypParser->yyerrcnt<=0 ){ - yy_syntax_error(yypParser,yymajor, yyminor); - } - yypParser->yyerrcnt = 3; - yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion); - if( yyendofinput ){ - yy_parse_failed(yypParser); -#ifndef YYNOERRORRECOVERY - yypParser->yyerrcnt = -1; -#endif - } - break; -#endif - } - }while( yypParser->yytos>yypParser->yystack ); -#ifndef NDEBUG - if( yyTraceFILE ){ - yyStackEntry *i; - char cDiv = '['; - fprintf(yyTraceFILE,"%sReturn. Stack=",yyTracePrompt); - for(i=&yypParser->yystack[1]; i<=yypParser->yytos; i++){ - fprintf(yyTraceFILE,"%c%s", cDiv, yyTokenName[i->major]); - cDiv = ' '; - } - fprintf(yyTraceFILE,"]\n"); - } -#endif - return; -} - -/* -** Return the fallback token corresponding to canonical token iToken, or -** 0 if iToken has no fallback. -*/ -int ParseFallback(int iToken){ -#ifdef YYFALLBACK - assert( iToken<(int)(sizeof(yyFallback)/sizeof(yyFallback[0])) ); - return yyFallback[iToken]; -#else - (void)iToken; - return 0; -#endif -} From 03814cfe5af5ee5b8f1c8307acb8cd37fa2094ff Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Mon, 4 Nov 2024 15:16:15 +0800 Subject: [PATCH 608/695] refact: rename version to td_version --- include/common/tglobal.h | 8 ++++---- include/util/version.h | 10 +++++----- source/client/src/clientEnv.c | 2 +- source/client/src/clientImpl.c | 4 ++-- source/client/src/clientMain.c | 4 ++-- source/client/src/clientMsgHandler.c | 4 ++-- source/common/src/tglobal.c | 8 ++++---- source/common/src/tmisce.c | 7 +++---- source/dnode/mgmt/exe/dmMain.c | 9 +++++---- source/dnode/mgmt/node_mgmt/src/dmTransport.c | 20 +++++++++---------- source/dnode/mnode/impl/src/mndMain.c | 2 +- source/dnode/mnode/impl/src/mndProfile.c | 12 +++++------ source/dnode/mnode/impl/src/mndTelem.c | 6 +++--- source/libs/function/src/udfd.c | 8 ++++---- source/libs/parser/src/parTranslater.c | 2 +- source/util/src/version.c.in | 10 +++++----- tools/shell/src/shellArguments.c | 6 +++--- tools/shell/src/shellNettest.c | 4 ++-- 18 files changed, 63 insertions(+), 63 deletions(-) diff --git a/include/common/tglobal.h b/include/common/tglobal.h index 41fb692e42eb..fc47166a6067 100644 --- a/include/common/tglobal.h +++ b/include/common/tglobal.h @@ -194,10 +194,10 @@ extern int32_t tsMinIntervalTime; extern int32_t tsMaxInsertBatchRows; // build info -extern char version[]; -extern char compatible_version[]; -extern char gitinfo[]; -extern char buildinfo[]; +extern char td_version[]; +extern char td_compatible_version[]; +extern char td_gitinfo[]; +extern char td_buildinfo[]; // lossy extern char tsLossyColumns[]; diff --git a/include/util/version.h b/include/util/version.h index b241dd248b9a..7b62914a3328 100644 --- a/include/util/version.h +++ b/include/util/version.h @@ -20,11 +20,11 @@ extern "C" { #endif -extern char version[]; -extern char compatible_version[]; -extern char gitinfo[]; -extern char gitinfoOfInternal[]; -extern char buildinfo[]; +extern char td_version[]; +extern char td_compatible_version[]; +extern char td_gitinfo[]; +extern char td_gitinfoOfInternal[]; +extern char td_buildinfo[]; #ifdef __cplusplus } diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c index f892575f0a26..dae6a93d86fb 100644 --- a/source/client/src/clientEnv.c +++ b/source/client/src/clientEnv.c @@ -375,7 +375,7 @@ int32_t openTransporter(const char *user, const char *auth, int32_t numOfThread, rpcInit.startReadTimer = 1; rpcInit.readTimeout = tsReadTimeout; - int32_t code = taosVersionStrToInt(version, &(rpcInit.compatibilityVer)); + int32_t code = taosVersionStrToInt(td_version, &rpcInit.compatibilityVer); if (TSDB_CODE_SUCCESS != code) { tscError("invalid version string."); return code; diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index 74fd4e13a728..2968b4867e18 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -1700,7 +1700,7 @@ static int32_t buildConnectMsg(SRequestObj* pRequest, SMsgSendInfo** pMsgSendInf tstrncpy(connectReq.app, appInfo.appName, sizeof(connectReq.app)); tstrncpy(connectReq.user, pObj->user, sizeof(connectReq.user)); tstrncpy(connectReq.passwd, pObj->pass, sizeof(connectReq.passwd)); - tstrncpy(connectReq.sVer, version, sizeof(connectReq.sVer)); + tstrncpy(connectReq.sVer, td_version, sizeof(connectReq.sVer)); int32_t contLen = tSerializeSConnectReq(NULL, 0, &connectReq); void* pReq = taosMemoryMalloc(contLen); @@ -2573,7 +2573,7 @@ TSDB_SERVER_STATUS taos_check_server_status(const char* fqdn, int port, char* de rpcInit.connLimitNum = connLimitNum; rpcInit.timeToGetConn = tsTimeToGetAvailableConn; rpcInit.readTimeout = tsReadTimeout; - if (TSDB_CODE_SUCCESS != taosVersionStrToInt(version, &(rpcInit.compatibilityVer))) { + if (TSDB_CODE_SUCCESS != taosVersionStrToInt(td_version, &rpcInit.compatibilityVer)) { tscError("faild to convert taos version from str to int, errcode:%s", terrstr()); goto _OVER; } diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c index 64631fd75453..9899bf52f0c6 100644 --- a/source/client/src/clientMain.c +++ b/source/client/src/clientMain.c @@ -670,7 +670,7 @@ const char *taos_data_type(int type) { } } -const char *taos_get_client_info() { return version; } +const char *taos_get_client_info() { return td_version; } // return int32_t int taos_affected_rows(TAOS_RES *res) { @@ -2144,4 +2144,4 @@ int taos_set_conn_mode(TAOS *taos, int mode, int value) { return 0; } -char *getBuildInfo() { return buildinfo; } +char *getBuildInfo() { return td_buildinfo; } diff --git a/source/client/src/clientMsgHandler.c b/source/client/src/clientMsgHandler.c index aef3cef1c5d0..c3d11b7a4055 100644 --- a/source/client/src/clientMsgHandler.c +++ b/source/client/src/clientMsgHandler.c @@ -80,8 +80,8 @@ int32_t processConnectRsp(void* param, SDataBuf* pMsg, int32_t code) { goto End; } - if ((code = taosCheckVersionCompatibleFromStr(version, connectRsp.sVer, 3)) != 0) { - tscError("version not compatible. client version: %s, server version: %s", version, connectRsp.sVer); + if ((code = taosCheckVersionCompatibleFromStr(td_version, connectRsp.sVer, 3)) != 0) { + tscError("version not compatible. client version: %s, server version: %s", td_version, connectRsp.sVer); goto End; } diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index 834615bdaa84..36e36752c071 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -675,10 +675,10 @@ static int32_t taosAddSystemCfg(SConfig *pCfg) { TAOS_CHECK_RETURN(cfgAddString(pCfg, "os version", info.version, CFG_SCOPE_BOTH, CFG_DYN_NONE)); TAOS_CHECK_RETURN(cfgAddString(pCfg, "os machine", info.machine, CFG_SCOPE_BOTH, CFG_DYN_NONE)); - TAOS_CHECK_RETURN(cfgAddString(pCfg, "version", version, CFG_SCOPE_BOTH, CFG_DYN_NONE)); - TAOS_CHECK_RETURN(cfgAddString(pCfg, "compatible_version", compatible_version, CFG_SCOPE_BOTH, CFG_DYN_NONE)); - TAOS_CHECK_RETURN(cfgAddString(pCfg, "gitinfo", gitinfo, CFG_SCOPE_BOTH, CFG_DYN_NONE)); - TAOS_CHECK_RETURN(cfgAddString(pCfg, "buildinfo", buildinfo, CFG_SCOPE_BOTH, CFG_DYN_NONE)); + TAOS_CHECK_RETURN(cfgAddString(pCfg, "version", td_version, CFG_SCOPE_BOTH, CFG_DYN_NONE)); + TAOS_CHECK_RETURN(cfgAddString(pCfg, "compatible_version", td_compatible_version, CFG_SCOPE_BOTH, CFG_DYN_NONE)); + TAOS_CHECK_RETURN(cfgAddString(pCfg, "gitinfo", td_gitinfo, CFG_SCOPE_BOTH, CFG_DYN_NONE)); + TAOS_CHECK_RETURN(cfgAddString(pCfg, "buildinfo", td_buildinfo, CFG_SCOPE_BOTH, CFG_DYN_NONE)); TAOS_RETURN(TSDB_CODE_SUCCESS); } diff --git a/source/common/src/tmisce.c b/source/common/src/tmisce.c index 10375ba8574b..4df458c2bb7b 100644 --- a/source/common/src/tmisce.c +++ b/source/common/src/tmisce.c @@ -221,10 +221,9 @@ int32_t taosGenCrashJsonMsg(int signum, char** pMsg, int64_t clusterId, int64_t } TAOS_CHECK_GOTO(tjsonAddStringToObject(pJson, "memory", tmp), NULL, _exit); - TAOS_CHECK_GOTO(tjsonAddStringToObject(pJson, "version", version), NULL, _exit); - TAOS_CHECK_GOTO(tjsonAddStringToObject(pJson, "buildInfo", buildinfo), NULL, _exit); - - TAOS_CHECK_GOTO(tjsonAddStringToObject(pJson, "gitInfo", gitinfo), NULL, _exit); + TAOS_CHECK_GOTO(tjsonAddStringToObject(pJson, "version", td_version), NULL, _exit); + TAOS_CHECK_GOTO(tjsonAddStringToObject(pJson, "buildInfo", td_buildinfo), NULL, _exit); + TAOS_CHECK_GOTO(tjsonAddStringToObject(pJson, "gitInfo", td_gitinfo), NULL, _exit); TAOS_CHECK_GOTO(tjsonAddIntegerToObject(pJson, "crashSig", signum), NULL, _exit); TAOS_CHECK_GOTO(tjsonAddIntegerToObject(pJson, "crashTs", taosGetTimestampUs()), NULL, _exit); diff --git a/source/dnode/mgmt/exe/dmMain.c b/source/dnode/mgmt/exe/dmMain.c index f94b9e2d73cb..ade5e168943e 100644 --- a/source/dnode/mgmt/exe/dmMain.c +++ b/source/dnode/mgmt/exe/dmMain.c @@ -297,12 +297,13 @@ static void dmPrintArgs(int32_t argc, char const *argv[]) { static void dmGenerateGrant() { mndGenerateMachineCode(); } static void dmPrintVersion() { - printf("%s\n%sd version: %s compatible_version: %s\n", TD_PRODUCT_NAME, CUS_PROMPT, version, compatible_version); - printf("git: %s\n", gitinfo); + printf("%s\n%sd version: %s compatible_version: %s\n", TD_PRODUCT_NAME, CUS_PROMPT, td_version, + td_compatible_version); + printf("git: %s\n", td_gitinfo); #ifdef TD_ENTERPRISE - printf("gitOfInternal: %s\n", gitinfoOfInternal); + printf("gitOfInternal: %s\n", td_gitinfoOfInternal); #endif - printf("build: %s\n", buildinfo); + printf("build: %s\n", td_buildinfo); } static void dmPrintHelp() { diff --git a/source/dnode/mgmt/node_mgmt/src/dmTransport.c b/source/dnode/mgmt/node_mgmt/src/dmTransport.c index c151529aea54..5a276de251b9 100644 --- a/source/dnode/mgmt/node_mgmt/src/dmTransport.c +++ b/source/dnode/mgmt/node_mgmt/src/dmTransport.c @@ -138,9 +138,9 @@ static void dmProcessRpcMsg(SDnode *pDnode, SRpcMsg *pRpc, SEpSet *pEpSet) { pRpc->info.handle, pRpc->contLen, pRpc->code, pRpc->info.ahandle, pRpc->info.refId); int32_t svrVer = 0; - code = taosVersionStrToInt(version, &svrVer); + code = taosVersionStrToInt(td_version, &svrVer); if (code != 0) { - dError("failed to convert version string:%s to int, code:%d", version, code); + dError("failed to convert version string:%s to int, code:%d", td_version, code); goto _OVER; } if ((code = taosCheckVersionCompatible(pRpc->info.cliVer, svrVer, 3)) != 0) { @@ -434,8 +434,8 @@ int32_t dmInitClient(SDnode *pDnode) { rpcInit.startReadTimer = 1; rpcInit.readTimeout = tsReadTimeout; - if (taosVersionStrToInt(version, &(rpcInit.compatibilityVer)) != 0) { - dError("failed to convert version string:%s to int", version); + if (taosVersionStrToInt(td_version, &rpcInit.compatibilityVer) != 0) { + dError("failed to convert version string:%s to int", td_version); } pTrans->clientRpc = rpcOpen(&rpcInit); @@ -483,8 +483,8 @@ int32_t dmInitStatusClient(SDnode *pDnode) { rpcInit.startReadTimer = 0; rpcInit.readTimeout = 0; - if (taosVersionStrToInt(version, &(rpcInit.compatibilityVer)) != 0) { - dError("failed to convert version string:%s to int", version); + if (taosVersionStrToInt(td_version, &rpcInit.compatibilityVer) != 0) { + dError("failed to convert version string:%s to int", td_version); } pTrans->statusRpc = rpcOpen(&rpcInit); @@ -533,8 +533,8 @@ int32_t dmInitSyncClient(SDnode *pDnode) { rpcInit.startReadTimer = 1; rpcInit.readTimeout = tsReadTimeout; - if (taosVersionStrToInt(version, &(rpcInit.compatibilityVer)) != 0) { - dError("failed to convert version string:%s to int", version); + if (taosVersionStrToInt(td_version, &rpcInit.compatibilityVer) != 0) { + dError("failed to convert version string:%s to int", td_version); } pTrans->syncRpc = rpcOpen(&rpcInit); @@ -588,8 +588,8 @@ int32_t dmInitServer(SDnode *pDnode) { rpcInit.compressSize = tsCompressMsgSize; rpcInit.shareConnLimit = tsShareConnLimit * 16; - if (taosVersionStrToInt(version, &(rpcInit.compatibilityVer)) != 0) { - dError("failed to convert version string:%s to int", version); + if (taosVersionStrToInt(td_version, &rpcInit.compatibilityVer) != 0) { + dError("failed to convert version string:%s to int", td_version); } pTrans->serverRpc = rpcOpen(&rpcInit); diff --git a/source/dnode/mnode/impl/src/mndMain.c b/source/dnode/mnode/impl/src/mndMain.c index 08ebf52ec625..6c30193ea762 100644 --- a/source/dnode/mnode/impl/src/mndMain.c +++ b/source/dnode/mnode/impl/src/mndMain.c @@ -1021,7 +1021,7 @@ int32_t mndGetMonitorInfo(SMnode *pMnode, SMonClusterInfo *pClusterInfo, SMonVgr } // cluster info - tstrncpy(pClusterInfo->version, version, sizeof(pClusterInfo->version)); + tstrncpy(pClusterInfo->version, td_version, sizeof(pClusterInfo->version)); pClusterInfo->monitor_interval = tsMonitorInterval; pClusterInfo->connections_total = mndGetNumOfConnections(pMnode); pClusterInfo->dbs_total = sdbGetSize(pSdb, SDB_DB); diff --git a/source/dnode/mnode/impl/src/mndProfile.c b/source/dnode/mnode/impl/src/mndProfile.c index a1ffee9b06a3..91df640bce38 100644 --- a/source/dnode/mnode/impl/src/mndProfile.c +++ b/source/dnode/mnode/impl/src/mndProfile.c @@ -239,8 +239,8 @@ static int32_t mndProcessConnectReq(SRpcMsg *pReq) { goto _OVER; } - if ((code = taosCheckVersionCompatibleFromStr(connReq.sVer, version, 3)) != 0) { - mGError("version not compatible. client version: %s, server version: %s", connReq.sVer, version); + if ((code = taosCheckVersionCompatibleFromStr(connReq.sVer, td_version, 3)) != 0) { + mGError("version not compatible. client version: %s, server version: %s", connReq.sVer, td_version); goto _OVER; } @@ -308,9 +308,9 @@ static int32_t mndProcessConnectReq(SRpcMsg *pReq) { tstrncpy(connectRsp.monitorParas.tsSlowLogExceptDb, tsSlowLogExceptDb, TSDB_DB_NAME_LEN); connectRsp.whiteListVer = pUser->ipWhiteListVer; - (void)strcpy(connectRsp.sVer, version); - (void)snprintf(connectRsp.sDetailVer, sizeof(connectRsp.sDetailVer), "ver:%s\nbuild:%s\ngitinfo:%s", version, - buildinfo, gitinfo); + tstrncpy(connectRsp.sVer, td_version, sizeof(connectRsp.sVer)); + (void)snprintf(connectRsp.sDetailVer, sizeof(connectRsp.sDetailVer), "ver:%s\nbuild:%s\ngitinfo:%s", td_version, + td_buildinfo, td_gitinfo); mndGetMnodeEpSet(pMnode, &connectRsp.epSet); int32_t contLen = tSerializeSConnectRsp(NULL, 0, &connectRsp); @@ -813,7 +813,7 @@ static int32_t mndProcessSvrVerReq(SRpcMsg *pReq) { int32_t code = 0; int32_t lino = 0; SServerVerRsp rsp = {0}; - tstrncpy(rsp.ver, version, sizeof(rsp.ver)); + tstrncpy(rsp.ver, td_version, sizeof(rsp.ver)); int32_t contLen = tSerializeSServerVerRsp(NULL, 0, &rsp); if (contLen < 0) { diff --git a/source/dnode/mnode/impl/src/mndTelem.c b/source/dnode/mnode/impl/src/mndTelem.c index 0022aee61980..810c71b7c580 100644 --- a/source/dnode/mnode/impl/src/mndTelem.c +++ b/source/dnode/mnode/impl/src/mndTelem.c @@ -115,9 +115,9 @@ static char* mndBuildTelemetryReport(SMnode* pMnode) { snprintf(tmp, sizeof(tmp), "%" PRId64 " kB", tsTotalMemoryKB); TAOS_CHECK_GOTO(tjsonAddStringToObject(pJson, "memory", tmp), &lino, _OVER); - TAOS_CHECK_GOTO(tjsonAddStringToObject(pJson, "version", version), &lino, _OVER); - TAOS_CHECK_GOTO(tjsonAddStringToObject(pJson, "buildInfo", buildinfo), &lino, _OVER); - TAOS_CHECK_GOTO(tjsonAddStringToObject(pJson, "gitInfo", gitinfo), &lino, _OVER); + TAOS_CHECK_GOTO(tjsonAddStringToObject(pJson, "version", td_version), &lino, _OVER); + TAOS_CHECK_GOTO(tjsonAddStringToObject(pJson, "buildInfo", td_buildinfo), &lino, _OVER); + TAOS_CHECK_GOTO(tjsonAddStringToObject(pJson, "gitInfo", td_gitinfo), &lino, _OVER); TAOS_CHECK_GOTO(tjsonAddStringToObject(pJson, "email", pMgmt->email), &lino, _OVER); mndBuildRuntimeInfo(pMnode, pJson); diff --git a/source/libs/function/src/udfd.c b/source/libs/function/src/udfd.c index c360cf689497..6eef99e1f82a 100644 --- a/source/libs/function/src/udfd.c +++ b/source/libs/function/src/udfd.c @@ -1217,7 +1217,7 @@ int32_t udfdOpenClientRpc() { connLimitNum = TMIN(connLimitNum, 500); rpcInit.connLimitNum = connLimitNum; rpcInit.timeToGetConn = tsTimeToGetAvailableConn; - TAOS_CHECK_RETURN(taosVersionStrToInt(version, &(rpcInit.compatibilityVer))); + TAOS_CHECK_RETURN(taosVersionStrToInt(td_version, &rpcInit.compatibilityVer)); global.clientRpc = rpcOpen(&rpcInit); if (global.clientRpc == NULL) { fnError("failed to init dnode rpc client"); @@ -1470,9 +1470,9 @@ static int32_t udfdParseArgs(int32_t argc, char *argv[]) { } static void udfdPrintVersion() { - (void)printf("udfd version: %s compatible_version: %s\n", version, compatible_version); - (void)printf("git: %s\n", gitinfo); - (void)printf("build: %s\n", buildinfo); + (void)printf("udfd version: %s compatible_version: %s\n", td_version, td_compatible_version); + (void)printf("git: %s\n", td_gitinfo); + (void)printf("build: %s\n", td_buildinfo); } static int32_t udfdInitLog() { diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index e475d34055d3..05372ac2dca9 100755 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -2902,7 +2902,7 @@ static int32_t rewriteDatabaseFunc(STranslateContext* pCxt, SNode** pNode) { } static int32_t rewriteClentVersionFunc(STranslateContext* pCxt, SNode** pNode) { - char* pVer = taosStrdup((void*)version); + char* pVer = taosStrdup((void*)td_version); if (NULL == pVer) { return terrno; } diff --git a/source/util/src/version.c.in b/source/util/src/version.c.in index c91b46e18d15..c5123e6f2148 100644 --- a/source/util/src/version.c.in +++ b/source/util/src/version.c.in @@ -1,7 +1,7 @@ -char version[64] = "${TD_VER_NUMBER}"; -char compatible_version[12] = "${TD_VER_COMPATIBLE}"; -char gitinfo[48] = "${TD_VER_GIT}"; -char gitinfoOfInternal[48] = "${TD_VER_GIT_INTERNAL}"; -char buildinfo[64] = "${TD_VER_OSTYPE}-${TD_VER_CPUTYPE} ${TD_VER_DATE}"; +char td_version[64] = "${TD_VER_NUMBER}"; +char td_compatible_version[12] = "${TD_VER_COMPATIBLE}"; +char td_gitinfo[48] = "${TD_VER_GIT}"; +char td_gitinfoOfInternal[48] = "${TD_VER_GIT_INTERNAL}"; +char td_buildinfo[64] = "${TD_VER_OSTYPE}-${TD_VER_CPUTYPE} ${TD_VER_DATE}"; void libtaos_${TD_LIB_VER_NUMBER}_${TD_VER_OSTYPE}_${TD_VER_CPUTYPE}_${TD_VER_VERTYPE}() {}; \ No newline at end of file diff --git a/tools/shell/src/shellArguments.c b/tools/shell/src/shellArguments.c index 4638f2ad74b8..5dd24dc396e0 100644 --- a/tools/shell/src/shellArguments.c +++ b/tools/shell/src/shellArguments.c @@ -440,11 +440,11 @@ int32_t shellParseArgs(int32_t argc, char *argv[]) { #ifdef TD_ENTERPRISE snprintf(shell.info.programVersion, sizeof(shell.info.programVersion), "%s\n%s version: %s compatible_version: %s\ngit: %s\ngitOfInternal: %s\nbuild: %s", TD_PRODUCT_NAME, - CUS_PROMPT, version, compatible_version, gitinfo, gitinfoOfInternal, buildinfo); + CUS_PROMPT, td_version, td_compatible_version, td_gitinfo, td_gitinfoOfInternal, td_buildinfo); #else snprintf(shell.info.programVersion, sizeof(shell.info.programVersion), - "%s\n%s version: %s compatible_version: %s\ngit: %s\nbuild: %s", TD_PRODUCT_NAME, CUS_PROMPT, version, - compatible_version, gitinfo, buildinfo); + "%s\n%s version: %s compatible_version: %s\ngit: %s\nbuild: %s", TD_PRODUCT_NAME, CUS_PROMPT, td_version, + td_compatible_version, td_gitinfo, td_buildinfo); #endif #if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32) diff --git a/tools/shell/src/shellNettest.c b/tools/shell/src/shellNettest.c index 2e5ec7bc24b5..d1ecf503d242 100644 --- a/tools/shell/src/shellNettest.c +++ b/tools/shell/src/shellNettest.c @@ -34,7 +34,7 @@ static void shellWorkAsClient() { rpcInit.user = "_dnd"; rpcInit.timeToGetConn = tsTimeToGetAvailableConn; - taosVersionStrToInt(version, &(rpcInit.compatibilityVer)); + taosVersionStrToInt(td_version, &rpcInit.compatibilityVer); clientRpc = rpcOpen(&rpcInit); if (clientRpc == NULL) { printf("failed to init net test client since %s\r\n", terrstr()); @@ -125,7 +125,7 @@ static void shellWorkAsServer() { rpcInit.connType = TAOS_CONN_SERVER; rpcInit.idleTime = tsShellActivityTimer * 1000; - taosVersionStrToInt(version, &(rpcInit.compatibilityVer)); + taosVersionStrToInt(td_version, &rpcInit.compatibilityVer); void *serverRpc = rpcOpen(&rpcInit); if (serverRpc == NULL) { From b011ef49e02b31cc3039e964f6db5d9ce9d34b2b Mon Sep 17 00:00:00 2001 From: Pengrongkun Date: Sun, 27 Oct 2024 11:04:39 +0800 Subject: [PATCH 609/695] TD-32120:add api taos_stmt2_get_all_fields fix some format convert TAOS_FIELD_E to TAOS_FIELD_ALL, to prevent modifications to the original API rename taos_stmt2_get_stb_fields refact parse for ctbname parameterized refactor some code, fix some core problem. --- include/client/taos.h | 47 ++++--- include/libs/parser/parser.h | 3 +- source/client/inc/clientStmt2.h | 1 + source/client/src/clientMain.c | 25 +++- source/client/src/clientStmt2.c | 50 +++++++- source/libs/parser/src/parInsertSql.c | 170 ++++++++++++++++--------- source/libs/parser/src/parInsertStmt.c | 67 +++++++++- tests/script/api/makefile | 2 + tests/script/api/stmt2-get-fields.c | 129 +++++++++++++++++++ 9 files changed, 405 insertions(+), 89 deletions(-) create mode 100644 tests/script/api/stmt2-get-fields.c diff --git a/include/client/taos.h b/include/client/taos.h index 80dbe27c4719..924d0ff66e43 100644 --- a/include/client/taos.h +++ b/include/client/taos.h @@ -81,6 +81,13 @@ typedef enum { TSDB_SML_TIMESTAMP_NANO_SECONDS, } TSDB_SML_TIMESTAMP_TYPE; +typedef enum TAOS_FIELD_T { + TAOS_FIELD_COL = 1, + TAOS_FIELD_TAG, + TAOS_FIELD_QUERY, + TAOS_FIELD_TBNAME, +} TAOS_FIELD_T; + typedef struct taosField { char name[65]; int8_t type; @@ -95,6 +102,15 @@ typedef struct TAOS_FIELD_E { int32_t bytes; } TAOS_FIELD_E; +typedef struct TAOS_FIELD_STB { + char name[65]; + int8_t type; + uint8_t precision; + uint8_t scale; + int32_t bytes; + TAOS_FIELD_T field_type; +} TAOS_FIELD_STB; + #ifdef WINDOWS #define DLL_EXPORT __declspec(dllexport) #else @@ -195,13 +211,6 @@ DLL_EXPORT int taos_stmt_affected_rows_once(TAOS_STMT *stmt); typedef void TAOS_STMT2; -typedef enum TAOS_FIELD_T { - TAOS_FIELD_COL = 1, - TAOS_FIELD_TAG, - TAOS_FIELD_QUERY, - TAOS_FIELD_TBNAME, -} TAOS_FIELD_T; - typedef struct TAOS_STMT2_OPTION { int64_t reqid; bool singleStbInsert; @@ -232,7 +241,9 @@ DLL_EXPORT int taos_stmt2_exec(TAOS_STMT2 *stmt, int *affected_rows); DLL_EXPORT int taos_stmt2_close(TAOS_STMT2 *stmt); DLL_EXPORT int taos_stmt2_is_insert(TAOS_STMT2 *stmt, int *insert); DLL_EXPORT int taos_stmt2_get_fields(TAOS_STMT2 *stmt, TAOS_FIELD_T field_type, int *count, TAOS_FIELD_E **fields); +DLL_EXPORT int taos_stmt2_get_stb_fields(TAOS_STMT2 *stmt, int *count, TAOS_FIELD_STB **fields); DLL_EXPORT void taos_stmt2_free_fields(TAOS_STMT2 *stmt, TAOS_FIELD_E *fields); +DLL_EXPORT void taos_stmt2_free_stb_fields(TAOS_STMT2 *stmt, TAOS_FIELD_STB *fields); DLL_EXPORT TAOS_RES *taos_stmt2_result(TAOS_STMT2 *stmt); DLL_EXPORT char *taos_stmt2_error(TAOS_STMT2 *stmt); @@ -251,17 +262,17 @@ DLL_EXPORT int64_t taos_affected_rows64(TAOS_RES *res); DLL_EXPORT TAOS_FIELD *taos_fetch_fields(TAOS_RES *res); DLL_EXPORT int taos_select_db(TAOS *taos, const char *db); DLL_EXPORT int taos_print_row(char *str, TAOS_ROW row, TAOS_FIELD *fields, int num_fields); -DLL_EXPORT int taos_print_row_with_size(char *str, uint32_t size, TAOS_ROW row, TAOS_FIELD *fields, int num_fields); -DLL_EXPORT void taos_stop_query(TAOS_RES *res); -DLL_EXPORT bool taos_is_null(TAOS_RES *res, int32_t row, int32_t col); -DLL_EXPORT int taos_is_null_by_column(TAOS_RES *res, int columnIndex, bool result[], int *rows); -DLL_EXPORT bool taos_is_update_query(TAOS_RES *res); -DLL_EXPORT int taos_fetch_block(TAOS_RES *res, TAOS_ROW *rows); -DLL_EXPORT int taos_fetch_block_s(TAOS_RES *res, int *numOfRows, TAOS_ROW *rows); -DLL_EXPORT int taos_fetch_raw_block(TAOS_RES *res, int *numOfRows, void **pData); -DLL_EXPORT int *taos_get_column_data_offset(TAOS_RES *res, int columnIndex); -DLL_EXPORT int taos_validate_sql(TAOS *taos, const char *sql); -DLL_EXPORT void taos_reset_current_db(TAOS *taos); +DLL_EXPORT int taos_print_row_with_size(char *str, uint32_t size, TAOS_ROW row, TAOS_FIELD *fields, int num_fields); +DLL_EXPORT void taos_stop_query(TAOS_RES *res); +DLL_EXPORT bool taos_is_null(TAOS_RES *res, int32_t row, int32_t col); +DLL_EXPORT int taos_is_null_by_column(TAOS_RES *res, int columnIndex, bool result[], int *rows); +DLL_EXPORT bool taos_is_update_query(TAOS_RES *res); +DLL_EXPORT int taos_fetch_block(TAOS_RES *res, TAOS_ROW *rows); +DLL_EXPORT int taos_fetch_block_s(TAOS_RES *res, int *numOfRows, TAOS_ROW *rows); +DLL_EXPORT int taos_fetch_raw_block(TAOS_RES *res, int *numOfRows, void **pData); +DLL_EXPORT int *taos_get_column_data_offset(TAOS_RES *res, int columnIndex); +DLL_EXPORT int taos_validate_sql(TAOS *taos, const char *sql); +DLL_EXPORT void taos_reset_current_db(TAOS *taos); DLL_EXPORT int *taos_fetch_lengths(TAOS_RES *res); DLL_EXPORT TAOS_ROW *taos_result_block(TAOS_RES *res); diff --git a/include/libs/parser/parser.h b/include/libs/parser/parser.h index 832e4f8863ef..0fb6261ac832 100644 --- a/include/libs/parser/parser.h +++ b/include/libs/parser/parser.h @@ -65,7 +65,7 @@ typedef struct SParseCsvCxt { const char* pLastSqlPos; // the location of the last parsed sql } SParseCsvCxt; -typedef void(*setQueryFn)(int64_t); +typedef void (*setQueryFn)(int64_t); typedef struct SParseContext { uint64_t requestId; @@ -147,6 +147,7 @@ int32_t qBindStmtColsValue(void* pBlock, SArray* pCols, TAOS_MULTI_BIND* bind, c int32_t qBindStmtSingleColValue(void* pBlock, SArray* pCols, TAOS_MULTI_BIND* bind, char* msgBuf, int32_t msgBufLen, int32_t colIdx, int32_t rowNum); int32_t qBuildStmtColFields(void* pDataBlock, int32_t* fieldNum, TAOS_FIELD_E** fields); +int32_t qBuildStmtStbColFields(void* pBlock, int32_t* fieldNum, TAOS_FIELD_STB** fields); int32_t qBuildStmtTagFields(void* pBlock, void* boundTags, int32_t* fieldNum, TAOS_FIELD_E** fields); int32_t qBindStmtTagsValue(void* pBlock, void* boundTags, int64_t suid, const char* sTableName, char* tName, TAOS_MULTI_BIND* bind, char* msgBuf, int32_t msgBufLen); diff --git a/source/client/inc/clientStmt2.h b/source/client/inc/clientStmt2.h index 4e9a09c0820d..64abf31bc1bb 100644 --- a/source/client/inc/clientStmt2.h +++ b/source/client/inc/clientStmt2.h @@ -222,6 +222,7 @@ int stmtSetTbTags2(TAOS_STMT2 *stmt, TAOS_STMT2_BIND *tags); int stmtBindBatch2(TAOS_STMT2 *stmt, TAOS_STMT2_BIND *bind, int32_t colIdx); int stmtGetTagFields2(TAOS_STMT2 *stmt, int *nums, TAOS_FIELD_E **fields); int stmtGetColFields2(TAOS_STMT2 *stmt, int *nums, TAOS_FIELD_E **fields); +int stmtGetStbColFields2(TAOS_STMT2 *stmt, int *nums, TAOS_FIELD_STB **fields); int stmtGetParamNum2(TAOS_STMT2 *stmt, int *nums); int stmtGetParamTbName(TAOS_STMT2 *stmt, int *nums); int stmtIsInsert2(TAOS_STMT2 *stmt, int *insert); diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c index 64631fd75453..306af194ab55 100644 --- a/source/client/src/clientMain.c +++ b/source/client/src/clientMain.c @@ -84,7 +84,7 @@ void taos_cleanup(void) { taosCloseRef(id); nodesDestroyAllocatorSet(); -// cleanupAppInfo(); + // cleanupAppInfo(); rpcCleanup(); tscDebug("rpc cleanup"); @@ -388,7 +388,6 @@ void taos_free_result(TAOS_RES *res) { tDeleteMqBatchMetaRsp(&pRsp->batchMetaRsp); } taosMemoryFree(pRsp); - } void taos_kill_query(TAOS *taos) { @@ -484,7 +483,7 @@ TAOS_ROW taos_fetch_row(TAOS_RES *res) { int taos_print_row(char *str, TAOS_ROW row, TAOS_FIELD *fields, int num_fields) { return taos_print_row_with_size(str, INT32_MAX, row, fields, num_fields); } -int taos_print_row_with_size(char *str, uint32_t size, TAOS_ROW row, TAOS_FIELD *fields, int num_fields){ +int taos_print_row_with_size(char *str, uint32_t size, TAOS_ROW row, TAOS_FIELD *fields, int num_fields) { int32_t len = 0; for (int i = 0; i < num_fields; ++i) { if (i > 0 && len < size - 1) { @@ -589,7 +588,7 @@ int taos_print_row_with_size(char *str, uint32_t size, TAOS_ROW row, TAOS_FIELD break; } } - if (len < size){ + if (len < size) { str[len] = 0; } @@ -2082,7 +2081,7 @@ int taos_stmt2_is_insert(TAOS_STMT2 *stmt, int *insert) { } int taos_stmt2_get_fields(TAOS_STMT2 *stmt, TAOS_FIELD_T field_type, int *count, TAOS_FIELD_E **fields) { - if (stmt == NULL || NULL == count) { + if (stmt == NULL || count == NULL) { tscError("NULL parameter for %s", __FUNCTION__); terrno = TSDB_CODE_INVALID_PARA; return terrno; @@ -2103,12 +2102,28 @@ int taos_stmt2_get_fields(TAOS_STMT2 *stmt, TAOS_FIELD_T field_type, int *count, } } +int taos_stmt2_get_stb_fields(TAOS_STMT2 *stmt, int *count, TAOS_FIELD_STB **fields) { + if (stmt == NULL || count == NULL) { + tscError("NULL parameter for %s", __FUNCTION__); + terrno = TSDB_CODE_INVALID_PARA; + return terrno; + } + + return stmtGetStbColFields2(stmt, count, fields); +} + void taos_stmt2_free_fields(TAOS_STMT2 *stmt, TAOS_FIELD_E *fields) { (void)stmt; if (!fields) return; taosMemoryFree(fields); } +DLL_EXPORT void taos_stmt2_free_stb_fields(TAOS_STMT2 *stmt, TAOS_FIELD_STB *fields) { + (void)stmt; + if (!fields) return; + taosMemoryFree(fields); +} + TAOS_RES *taos_stmt2_result(TAOS_STMT2 *stmt) { if (stmt == NULL) { tscError("NULL parameter for %s", __FUNCTION__); diff --git a/source/client/src/clientStmt2.c b/source/client/src/clientStmt2.c index 2f046b61d622..4bbfc6afaa73 100644 --- a/source/client/src/clientStmt2.c +++ b/source/client/src/clientStmt2.c @@ -1068,6 +1068,34 @@ static int stmtFetchColFields2(STscStmt2* pStmt, int32_t* fieldNum, TAOS_FIELD_E return TSDB_CODE_SUCCESS; } + +static int stmtFetchStbColFields2(STscStmt2* pStmt, int32_t* fieldNum, TAOS_FIELD_STB** fields) { + if (pStmt->errCode != TSDB_CODE_SUCCESS) { + return pStmt->errCode; + } + + if (STMT_TYPE_QUERY == pStmt->sql.type) { + tscError("invalid operation to get query column fileds"); + STMT_ERR_RET(TSDB_CODE_TSC_STMT_API_ERROR); + } + + STableDataCxt** pDataBlock = NULL; + + if (pStmt->sql.stbInterlaceMode) { + pDataBlock = &pStmt->sql.siInfo.pDataCtx; + } else { + pDataBlock = + (STableDataCxt**)taosHashGet(pStmt->exec.pBlockHash, pStmt->bInfo.tbFName, strlen(pStmt->bInfo.tbFName)); + if (NULL == pDataBlock) { + tscError("table %s not found in exec blockHash", pStmt->bInfo.tbFName); + STMT_ERR_RET(TSDB_CODE_APP_ERROR); + } + } + + STMT_ERR_RET(qBuildStmtStbColFields(*pDataBlock, fieldNum, fields)); + + return TSDB_CODE_SUCCESS; +} /* SArray* stmtGetFreeCol(STscStmt2* pStmt, int32_t* idx) { while (true) { @@ -1808,7 +1836,7 @@ int stmtGetTagFields2(TAOS_STMT2* stmt, int* nums, TAOS_FIELD_E** fields) { return code; } -int stmtGetColFields2(TAOS_STMT2* stmt, int* nums, TAOS_FIELD_E** fields) { +int stmtParseColFields2(TAOS_STMT2* stmt) { int32_t code = 0; STscStmt2* pStmt = (STscStmt2*)stmt; int32_t preCode = pStmt->errCode; @@ -1842,8 +1870,6 @@ int stmtGetColFields2(TAOS_STMT2* stmt, int* nums, TAOS_FIELD_E** fields) { STMT_ERRI_JRET(stmtParseSql(pStmt)); } - STMT_ERRI_JRET(stmtFetchColFields2(stmt, nums, fields)); - _return: pStmt->errCode = preCode; @@ -1851,6 +1877,24 @@ int stmtGetColFields2(TAOS_STMT2* stmt, int* nums, TAOS_FIELD_E** fields) { return code; } +int stmtGetColFields2(TAOS_STMT2* stmt, int* nums, TAOS_FIELD_E** fields) { + int32_t code = stmtParseColFields2(stmt); + if (code != TSDB_CODE_SUCCESS) { + return code; + } + + return stmtFetchColFields2(stmt, nums, fields); +} + +int stmtGetStbColFields2(TAOS_STMT2* stmt, int* nums, TAOS_FIELD_STB** fields) { + int32_t code = stmtParseColFields2(stmt); + if (code != TSDB_CODE_SUCCESS) { + return code; + } + + return stmtFetchStbColFields2(stmt, nums, fields); +} + int stmtGetParamNum2(TAOS_STMT2* stmt, int* nums) { STscStmt2* pStmt = (STscStmt2*)stmt; diff --git a/source/libs/parser/src/parInsertSql.c b/source/libs/parser/src/parInsertSql.c index 1c26a7c70ed2..4b91f01a8c84 100644 --- a/source/libs/parser/src/parInsertSql.c +++ b/source/libs/parser/src/parInsertSql.c @@ -30,7 +30,7 @@ typedef struct SInsertParseContext { bool forceUpdate; bool needTableTagVal; bool needRequest; // whether or not request server - bool isStmtBind; // whether is stmt bind + bool isStmtBind; // whether is stmt bind } SInsertParseContext; typedef int32_t (*_row_append_fn_t)(SMsgBuf* pMsgBuf, const void* value, int32_t len, void* param); @@ -757,7 +757,7 @@ int32_t parseTagValue(SMsgBuf* pMsgBuf, const char** pSql, uint8_t precision, SS STagVal val = {0}; int32_t code = parseTagToken(pSql, pToken, pTagSchema, precision, &val, pMsgBuf); if (TSDB_CODE_SUCCESS == code) { - if (NULL == taosArrayPush(pTagVals, &val)){ + if (NULL == taosArrayPush(pTagVals, &val)) { code = terrno; } } @@ -775,11 +775,14 @@ static int32_t buildCreateTbReq(SVnodeModifyOpStmt* pStmt, STag* pTag, SArray* p return terrno; } return insBuildCreateTbReq(pStmt->pCreateTblReq, pStmt->targetTableName.tname, pTag, pStmt->pTableMeta->suid, - pStmt->usingTableName.tname, pTagName, pStmt->pTableMeta->tableInfo.numOfTags, - TSDB_DEFAULT_TABLE_TTL); + pStmt->usingTableName.tname, pTagName, pStmt->pTableMeta->tableInfo.numOfTags, + TSDB_DEFAULT_TABLE_TTL); } int32_t checkAndTrimValue(SToken* pToken, char* tmpTokenBuf, SMsgBuf* pMsgBuf, int8_t type) { + if (pToken->type == TK_NK_QUESTION) { + return buildInvalidOperationMsg(pMsgBuf, "insert into super table syntax is not supported for stmt"); + } if ((pToken->type != TK_NOW && pToken->type != TK_TODAY && pToken->type != TK_NK_INTEGER && pToken->type != TK_NK_STRING && pToken->type != TK_NK_FLOAT && pToken->type != TK_NK_BOOL && pToken->type != TK_NULL && pToken->type != TK_NK_HEX && pToken->type != TK_NK_OCT && pToken->type != TK_NK_BIN && @@ -810,7 +813,7 @@ typedef struct SRewriteTagCondCxt { static int32_t rewriteTagCondColumnImpl(STagVal* pVal, SNode** pNode) { SValueNode* pValue = NULL; - int32_t code = nodesMakeNode(QUERY_NODE_VALUE, (SNode**)&pValue); + int32_t code = nodesMakeNode(QUERY_NODE_VALUE, (SNode**)&pValue); if (NULL == pValue) { return code; } @@ -1041,7 +1044,7 @@ static int32_t storeChildTableMeta(SInsertParseContext* pCxt, SVnodeModifyOpStmt return TSDB_CODE_OUT_OF_MEMORY; } - char tbFName[TSDB_TABLE_FNAME_LEN]; + char tbFName[TSDB_TABLE_FNAME_LEN]; int32_t code = tNameExtractFullName(&pStmt->targetTableName, tbFName); if (TSDB_CODE_SUCCESS != code) { taosMemoryFree(pBackup); @@ -1236,7 +1239,7 @@ static int32_t getTargetTableMetaAndVgroup(SInsertParseContext* pCxt, SVnodeModi } static int32_t collectUseTable(const SName* pName, SHashObj* pTable) { - char fullName[TSDB_TABLE_FNAME_LEN]; + char fullName[TSDB_TABLE_FNAME_LEN]; int32_t code = tNameExtractFullName(pName, fullName); if (TSDB_CODE_SUCCESS != code) { return code; @@ -1382,7 +1385,7 @@ static int32_t getTableDataCxt(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pS pStmt->pTableMeta, &pStmt->pCreateTblReq, pTableCxt, false, false); } - char tbFName[TSDB_TABLE_FNAME_LEN]; + char tbFName[TSDB_TABLE_FNAME_LEN]; int32_t code = tNameExtractFullName(&pStmt->targetTableName, tbFName); if (TSDB_CODE_SUCCESS != code) { return code; @@ -1824,37 +1827,49 @@ static int32_t doGetStbRowValues(SInsertParseContext* pCxt, SVnodeModifyOpStmt* code = generateSyntaxErrMsg(&pCxt->msg, TSDB_CODE_PAR_INVALID_COLUMNS_NUM); break; } - if (pCols->pColIndex[i] < numOfCols) { - const SSchema* pSchema = &pSchemas[pCols->pColIndex[i]]; - SColVal* pVal = taosArrayGet(pStbRowsCxt->aColVals, pCols->pColIndex[i]); - code = parseValueToken(pCxt, ppSql, pToken, (SSchema*)pSchema, precision, pVal); - if (TK_NK_VARIABLE == pToken->type) { - code = buildInvalidOperationMsg(&pCxt->msg, "not expected row value"); - } - } else if (pCols->pColIndex[i] < tbnameIdx) { - const SSchema* pTagSchema = &pSchemas[pCols->pColIndex[i]]; - if (canParseTagsAfter) { - tagTokens[(*pNumOfTagTokens)] = *pToken; - tagSchemas[(*pNumOfTagTokens)] = (SSchema*)pTagSchema; - ++(*pNumOfTagTokens); - } else { - code = checkAndTrimValue(pToken, pCxt->tmpTokenBuf, &pCxt->msg, pTagSchema->type); - if (code == TSDB_CODE_SUCCESS && TK_NK_VARIABLE == pToken->type) { + + if (TK_NK_QUESTION == pToken->type) { + pCxt->isStmtBind = true; + if (pCols->pColIndex[i] == tbnameIdx) { + *bFoundTbName = true; + } + if (NULL == pCxt->pComCxt->pStmtCb) { + code = buildSyntaxErrMsg(&pCxt->msg, "? only used in stmt", pToken->z); + break; + } + } else { + if (pCols->pColIndex[i] < numOfCols) { + const SSchema* pSchema = &pSchemas[pCols->pColIndex[i]]; + SColVal* pVal = taosArrayGet(pStbRowsCxt->aColVals, pCols->pColIndex[i]); + code = parseValueToken(pCxt, ppSql, pToken, (SSchema*)pSchema, precision, pVal); + if (TK_NK_VARIABLE == pToken->type) { code = buildInvalidOperationMsg(&pCxt->msg, "not expected row value"); } - if (code == TSDB_CODE_SUCCESS) { - code = parseTagValue(&pCxt->msg, ppSql, precision, (SSchema*)pTagSchema, pToken, pTagNames, pTagVals, - &pStbRowsCxt->pTag); + } else if (pCols->pColIndex[i] < tbnameIdx) { + const SSchema* pTagSchema = &pSchemas[pCols->pColIndex[i]]; + if (canParseTagsAfter) { + tagTokens[(*pNumOfTagTokens)] = *pToken; + tagSchemas[(*pNumOfTagTokens)] = (SSchema*)pTagSchema; + ++(*pNumOfTagTokens); + } else { + code = checkAndTrimValue(pToken, pCxt->tmpTokenBuf, &pCxt->msg, pTagSchema->type); + if (code == TSDB_CODE_SUCCESS && TK_NK_VARIABLE == pToken->type) { + code = buildInvalidOperationMsg(&pCxt->msg, "not expected row value"); + } + if (code == TSDB_CODE_SUCCESS) { + code = parseTagValue(&pCxt->msg, ppSql, precision, (SSchema*)pTagSchema, pToken, pTagNames, pTagVals, + &pStbRowsCxt->pTag); + } + } + } else if (pCols->pColIndex[i] == tbnameIdx) { + code = checkAndTrimValue(pToken, pCxt->tmpTokenBuf, &pCxt->msg, TSDB_DATA_TYPE_BINARY); + if (TK_NK_VARIABLE == pToken->type) { + code = buildInvalidOperationMsg(&pCxt->msg, "not expected tbname"); } - } - } else if (pCols->pColIndex[i] == tbnameIdx) { - code = checkAndTrimValue(pToken, pCxt->tmpTokenBuf, &pCxt->msg, TSDB_DATA_TYPE_BINARY); - if (TK_NK_VARIABLE == pToken->type) { - code = buildInvalidOperationMsg(&pCxt->msg, "not expected tbname"); - } - if (code == TSDB_CODE_SUCCESS) { - code = parseTbnameToken(&pCxt->msg, pStbRowsCxt->ctbName.tname, pToken, bFoundTbName); + if (code == TSDB_CODE_SUCCESS) { + code = parseTbnameToken(&pCxt->msg, pStbRowsCxt->ctbName.tname, pToken, bFoundTbName); + } } } @@ -1888,6 +1903,11 @@ static int32_t getStbRowValues(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pS code = buildSyntaxErrMsg(&pCxt->msg, "tbname value expected", pOrigSql); } + if (code == TSDB_CODE_SUCCESS && pStbRowsCxt->ctbName.tname[0] == '\0') { + *pGotRow = true; + return TSDB_CODE_TSC_STMT_TBNAME_ERROR; + } + bool ctbFirst = true; char ctbFName[TSDB_TABLE_FNAME_LEN]; if (code == TSDB_CODE_SUCCESS) { @@ -1923,8 +1943,8 @@ static int32_t processCtbAutoCreationAndCtbMeta(SInsertParseContext* pCxt, SVnod } if (code == TSDB_CODE_SUCCESS) { code = insBuildCreateTbReq(pStbRowsCxt->pCreateCtbReq, pStbRowsCxt->ctbName.tname, pStbRowsCxt->pTag, - pStbRowsCxt->pStbMeta->uid, pStbRowsCxt->stbName.tname, pStbRowsCxt->aTagNames, - getNumOfTags(pStbRowsCxt->pStbMeta), TSDB_DEFAULT_TABLE_TTL); + pStbRowsCxt->pStbMeta->uid, pStbRowsCxt->stbName.tname, pStbRowsCxt->aTagNames, + getNumOfTags(pStbRowsCxt->pStbMeta), TSDB_DEFAULT_TABLE_TTL); pStbRowsCxt->pTag = NULL; } @@ -1933,9 +1953,9 @@ static int32_t processCtbAutoCreationAndCtbMeta(SInsertParseContext* pCxt, SVnod code = tNameExtractFullName(&pStbRowsCxt->ctbName, ctbFName); SVgroupInfo vg; SRequestConnInfo conn = {.pTrans = pCxt->pComCxt->pTransporter, - .requestId = pCxt->pComCxt->requestId, - .requestObjRefId = pCxt->pComCxt->requestRid, - .mgmtEps = pCxt->pComCxt->mgmtEpSet}; + .requestId = pCxt->pComCxt->requestId, + .requestObjRefId = pCxt->pComCxt->requestRid, + .mgmtEps = pCxt->pComCxt->mgmtEpSet}; if (TSDB_CODE_SUCCESS == code) { code = catalogGetTableHashVgroup(pCxt->pComCxt->pCatalog, &conn, &pStbRowsCxt->ctbName, &vg); } @@ -1979,11 +1999,47 @@ static void clearStbRowsDataContext(SStbRowsDataContext* pStbRowsCxt) { taosMemoryFreeClear(pStbRowsCxt->pCreateCtbReq); } +static int32_t parseStbBoundInfo(SVnodeModifyOpStmt* pStmt, SStbRowsDataContext* pStbRowsCxt, + STableDataCxt** ppTableDataCxt) { + char tbFName[TSDB_TABLE_FNAME_LEN]; + int32_t code = tNameExtractFullName(&pStmt->targetTableName, tbFName); + if (TSDB_CODE_SUCCESS != code) { + return code; + } + if (pStmt->usingTableProcessing) { + pStmt->pTableMeta->uid = 0; + } + + code = insGetTableDataCxt(pStmt->pTableBlockHashObj, tbFName, strlen(tbFName), pStmt->pTableMeta, + &pStmt->pCreateTblReq, ppTableDataCxt, false, true); + if (code != TSDB_CODE_SUCCESS) { + return code; + } + + insDestroyBoundColInfo(&((*ppTableDataCxt)->boundColsInfo)); + (*ppTableDataCxt)->boundColsInfo = pStbRowsCxt->boundColsInfo; + (*ppTableDataCxt)->boundColsInfo.numOfCols = pStbRowsCxt->boundColsInfo.numOfBound; + (*ppTableDataCxt)->boundColsInfo.numOfBound = pStbRowsCxt->boundColsInfo.numOfBound; + (*ppTableDataCxt)->boundColsInfo.hasBoundCols = pStbRowsCxt->boundColsInfo.hasBoundCols; + (*ppTableDataCxt)->boundColsInfo.pColIndex = taosMemoryCalloc(pStbRowsCxt->boundColsInfo.numOfBound, sizeof(int16_t)); + if (NULL == (*ppTableDataCxt)->boundColsInfo.pColIndex) { + return terrno; + } + (void)memcpy((*ppTableDataCxt)->boundColsInfo.pColIndex, pStbRowsCxt->boundColsInfo.pColIndex, + sizeof(int16_t) * pStmt->pStbRowsCxt->boundColsInfo.numOfBound); + return TSDB_CODE_SUCCESS; +} + static int32_t parseOneStbRow(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt, const char** ppSql, SStbRowsDataContext* pStbRowsCxt, bool* pGotRow, SToken* pToken, STableDataCxt** ppTableDataCxt) { bool bFirstTable = false; int32_t code = getStbRowValues(pCxt, pStmt, ppSql, pStbRowsCxt, pGotRow, pToken, &bFirstTable); + + if (code == TSDB_CODE_TSC_STMT_TBNAME_ERROR && *pGotRow) { + return parseStbBoundInfo(pStmt, pStbRowsCxt, ppTableDataCxt); + } + if (code != TSDB_CODE_SUCCESS || !*pGotRow) { return code; } @@ -2176,8 +2232,8 @@ static int32_t parseCsvFile(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt if (code == TSDB_CODE_SUCCESS) { SStbRowsDataContext* pStbRowsCxt = rowsDataCxt.pStbRowsCxt; void* pData = pTableDataCxt; - code = taosHashPut(pStmt->pTableCxtHashObj, &pStbRowsCxt->pCtbMeta->uid, sizeof(pStbRowsCxt->pCtbMeta->uid), &pData, - POINTER_BYTES); + code = taosHashPut(pStmt->pTableCxtHashObj, &pStbRowsCxt->pCtbMeta->uid, sizeof(pStbRowsCxt->pCtbMeta->uid), + &pData, POINTER_BYTES); if (TSDB_CODE_SUCCESS != code) { break; } @@ -2249,7 +2305,7 @@ static int32_t parseDataFromFileImpl(SInsertParseContext* pCxt, SVnodeModifyOpSt if (!pStmt->stbSyntax && numOfRows > 0) { void* pData = rowsDataCxt.pTableDataCxt; code = taosHashPut(pStmt->pTableCxtHashObj, &pStmt->pTableMeta->uid, sizeof(pStmt->pTableMeta->uid), &pData, - POINTER_BYTES); + POINTER_BYTES); } return code; @@ -2363,8 +2419,7 @@ static int32_t constructStbRowsDataContext(SVnodeModifyOpStmt* pStmt, SStbRowsDa if (TSDB_CODE_SUCCESS == code) { // col values and bound cols info of STableDataContext is not used pStbRowsCxt->aColVals = taosArrayInit(getNumOfColumns(pStbRowsCxt->pStbMeta), sizeof(SColVal)); - if (!pStbRowsCxt->aColVals) - code = terrno; + if (!pStbRowsCxt->aColVals) code = terrno; } if (TSDB_CODE_SUCCESS == code) { code = insInitColValues(pStbRowsCxt->pStbMeta, pStbRowsCxt->aColVals); @@ -2422,9 +2477,6 @@ static int32_t parseInsertStbClauseBottom(SInsertParseContext* pCxt, SVnodeModif // 1. [(tag1_name, ...)] ... // 2. VALUES ... | FILE ... static int32_t parseInsertTableClauseBottom(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt) { - if (pStmt->stbSyntax && TSDB_QUERY_HAS_TYPE(pStmt->insertType, TSDB_QUERY_TYPE_STMT_INSERT)) { - return buildInvalidOperationMsg(&pCxt->msg, "insert into super table syntax is not supported for stmt"); - } if (!pStmt->stbSyntax) { STableDataCxt* pTableCxt = NULL; int32_t code = parseSchemaClauseBottom(pCxt, pStmt, &pTableCxt); @@ -2511,9 +2563,9 @@ static int32_t checkTableClauseFirstToken(SInsertParseContext* pCxt, SVnodeModif } // db.? situation,ensure that the only thing following the '.' mark is '?' - char *tbNameAfterDbName = strnchr(pTbName->z, '.', pTbName->n, true); + char* tbNameAfterDbName = strnchr(pTbName->z, '.', pTbName->n, true); if ((tbNameAfterDbName != NULL) && (*(tbNameAfterDbName + 1) == '?')) { - char *tbName = NULL; + char* tbName = NULL; if (NULL == pCxt->pComCxt->pStmtCb) { return buildSyntaxErrMsg(&pCxt->msg, "? only used in stmt", pTbName->z); } @@ -2528,7 +2580,8 @@ static int32_t checkTableClauseFirstToken(SInsertParseContext* pCxt, SVnodeModif if (pCxt->isStmtBind) { if (TK_NK_ID == pTbName->type || (tbNameAfterDbName != NULL && *(tbNameAfterDbName + 1) != '?')) { // In SQL statements, the table name has already been specified. - parserWarn("0x%" PRIx64 " table name is specified in sql, ignore the table name in bind param", pCxt->pComCxt->requestId); + parserWarn("0x%" PRIx64 " table name is specified in sql, ignore the table name in bind param", + pCxt->pComCxt->requestId); } } @@ -2614,7 +2667,7 @@ static void destroySubTableHashElem(void* p) { taosMemoryFree(*(STableMeta**)p); static int32_t createVnodeModifOpStmt(SInsertParseContext* pCxt, bool reentry, SNode** pOutput) { SVnodeModifyOpStmt* pStmt = NULL; - int32_t code = nodesMakeNode(QUERY_NODE_VNODE_MODIFY_STMT, (SNode**)&pStmt); + int32_t code = nodesMakeNode(QUERY_NODE_VNODE_MODIFY_STMT, (SNode**)&pStmt); if (NULL == pStmt) { return code; } @@ -2729,7 +2782,7 @@ static int32_t buildTagNameFromMeta(STableMeta* pMeta, SArray** pTagName) { return terrno; } SSchema* pSchema = getTableTagSchema(pMeta); - int32_t code = 0; + int32_t code = 0; for (int32_t i = 0; i < pMeta->tableInfo.numOfTags; ++i) { if (NULL == taosArrayPush(*pTagName, pSchema[i].name)) { code = terrno; @@ -2834,7 +2887,7 @@ static int32_t resetVnodeModifOpStmt(SInsertParseContext* pCxt, SQuery* pQuery) } if (NULL == pStmt->pTableBlockHashObj) { pStmt->pTableBlockHashObj = - taosHashInit(128, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK); + taosHashInit(128, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK); } if (NULL == pStmt->pVgroupsHashObj || NULL == pStmt->pTableBlockHashObj) { code = TSDB_CODE_OUT_OF_MEMORY; @@ -2866,7 +2919,7 @@ static int32_t initInsertQuery(SInsertParseContext* pCxt, SCatalogReq* pCatalogR static int32_t setRefreshMeta(SQuery* pQuery) { SVnodeModifyOpStmt* pStmt = (SVnodeModifyOpStmt*)pQuery->pRoot; - int32_t code = 0; + int32_t code = 0; if (taosHashGetSize(pStmt->pTableNameHashObj) > 0) { taosArrayDestroy(pQuery->pTableList); @@ -3065,9 +3118,10 @@ int32_t parseInsertSql(SParseContext* pCxt, SQuery** pQuery, SCatalogReq* pCatal .forceUpdate = (NULL != pCatalogReq ? pCatalogReq->forceUpdate : false), .isStmtBind = pCxt->isStmtBind}; - int32_t code = initInsertQuery(&context, pCatalogReq, pMetaData, pQuery); + int32_t code = initInsertQuery(&context, pCatalogReq, pMetaData, pQuery); + SVnodeModifyOpStmt* pStmt = (SVnodeModifyOpStmt*)((*pQuery)->pRoot); if (TSDB_CODE_SUCCESS == code) { - code = parseInsertSqlImpl(&context, (SVnodeModifyOpStmt*)(*pQuery)->pRoot); + code = parseInsertSqlImpl(&context, pStmt); } if (TSDB_CODE_SUCCESS == code) { code = setNextStageInfo(&context, *pQuery, pCatalogReq); @@ -3076,8 +3130,8 @@ int32_t parseInsertSql(SParseContext* pCxt, SQuery** pQuery, SCatalogReq* pCatal QUERY_EXEC_STAGE_SCHEDULE == (*pQuery)->execStage) { code = setRefreshMeta(*pQuery); } - insDestroyBoundColInfo(&context.tags); + insDestroyBoundColInfo(&context.tags); // if no data to insert, set emptyMode to avoid request server if (!context.needRequest) { (*pQuery)->execMode = QUERY_EXEC_MODE_EMPTY_RESULT; diff --git a/source/libs/parser/src/parInsertStmt.c b/source/libs/parser/src/parInsertStmt.c index ee61611bf27c..0979028e6df0 100644 --- a/source/libs/parser/src/parInsertStmt.c +++ b/source/libs/parser/src/parInsertStmt.c @@ -242,7 +242,7 @@ int32_t qBindStmtTagsValue(void* pBlock, void* boundTags, int64_t suid, const ch } code = insBuildCreateTbReq(pDataBlock->pData->pCreateTbReq, tName, pTag, suid, sTableName, tagName, - pDataBlock->pMeta->tableInfo.numOfTags, TSDB_DEFAULT_TABLE_TTL); + pDataBlock->pMeta->tableInfo.numOfTags, TSDB_DEFAULT_TABLE_TTL); pTag = NULL; end: @@ -594,7 +594,7 @@ int32_t qBindStmtTagsValue2(void* pBlock, void* boundTags, int64_t suid, const c } code = insBuildCreateTbReq(pDataBlock->pData->pCreateTbReq, tName, pTag, suid, sTableName, tagName, - pDataBlock->pMeta->tableInfo.numOfTags, TSDB_DEFAULT_TABLE_TTL); + pDataBlock->pMeta->tableInfo.numOfTags, TSDB_DEFAULT_TABLE_TTL); pTag = NULL; end: @@ -797,6 +797,10 @@ int32_t qBindStmtColsValue2(void* pBlock, SArray* pCols, TAOS_STMT2_BIND* bind, for (int c = 0; c < boundInfo->numOfBound; ++c) { SSchema* pColSchema = &pSchema[boundInfo->pColIndex[c]]; SColData* pCol = taosArrayGet(pCols, c); + if (pCol == NULL || pColSchema == NULL) { + code = buildInvalidOperationMsg(&pBuf, "get column schema or column data failed"); + goto _return; + } if (bind[c].num != rowNum) { code = buildInvalidOperationMsg(&pBuf, "row number in each bind param should be the same"); @@ -886,7 +890,7 @@ int32_t qBindStmtSingleColValue2(void* pBlock, SArray* pCols, TAOS_STMT2_BIND* b int32_t buildBoundFields(int32_t numOfBound, int16_t* boundColumns, SSchema* pSchema, int32_t* fieldNum, TAOS_FIELD_E** fields, uint8_t timePrec) { - if (fields) { + if (fields != NULL) { *fields = taosMemoryCalloc(numOfBound, sizeof(TAOS_FIELD_E)); if (NULL == *fields) { return terrno; @@ -910,6 +914,44 @@ int32_t buildBoundFields(int32_t numOfBound, int16_t* boundColumns, SSchema* pSc return TSDB_CODE_SUCCESS; } +int32_t buildStbBoundFields(SBoundColInfo boundColsInfo, SSchema* pSchema, int32_t* fieldNum, TAOS_FIELD_STB** fields, + STableMeta* pMeta) { + if (fields != NULL) { + *fields = taosMemoryCalloc(boundColsInfo.numOfBound, sizeof(TAOS_FIELD_STB)); + if (NULL == *fields) { + return terrno; + } + + SSchema* schema = &pSchema[boundColsInfo.pColIndex[0]]; + if (TSDB_DATA_TYPE_TIMESTAMP == schema->type) { + (*fields)[0].precision = pMeta->tableInfo.precision; + } + + for (int32_t i = 0; i < boundColsInfo.numOfBound; ++i) { + int16_t idx = boundColsInfo.pColIndex[i]; + + if (idx == pMeta->tableInfo.numOfColumns + pMeta->tableInfo.numOfTags) { + (*fields)[i].field_type = TAOS_FIELD_TBNAME; + tstrncpy((*fields)[i].name, "tbname", sizeof((*fields)[i].name)); + continue; + } else if (idx < pMeta->tableInfo.numOfColumns) { + (*fields)[i].field_type = TAOS_FIELD_COL; + } else { + (*fields)[i].field_type = TAOS_FIELD_TAG; + } + + schema = &pSchema[idx]; + tstrncpy((*fields)[i].name, schema->name, sizeof((*fields)[i].name)); + (*fields)[i].type = schema->type; + (*fields)[i].bytes = schema->bytes; + } + } + + *fieldNum = boundColsInfo.numOfBound; + + return TSDB_CODE_SUCCESS; +} + int32_t qBuildStmtTagFields(void* pBlock, void* boundTags, int32_t* fieldNum, TAOS_FIELD_E** fields) { STableDataCxt* pDataBlock = (STableDataCxt*)pBlock; SBoundColInfo* tags = (SBoundColInfo*)boundTags; @@ -939,7 +981,7 @@ int32_t qBuildStmtColFields(void* pBlock, int32_t* fieldNum, TAOS_FIELD_E** fiel SSchema* pSchema = getTableColumnSchema(pDataBlock->pMeta); if (pDataBlock->boundColsInfo.numOfBound <= 0) { *fieldNum = 0; - if (fields) { + if (fields != NULL) { *fields = NULL; } @@ -952,6 +994,23 @@ int32_t qBuildStmtColFields(void* pBlock, int32_t* fieldNum, TAOS_FIELD_E** fiel return TSDB_CODE_SUCCESS; } +int32_t qBuildStmtStbColFields(void* pBlock, int32_t* fieldNum, TAOS_FIELD_STB** fields) { + STableDataCxt* pDataBlock = (STableDataCxt*)pBlock; + SSchema* pSchema = getTableColumnSchema(pDataBlock->pMeta); + if (pDataBlock->boundColsInfo.numOfBound <= 0) { + *fieldNum = 0; + if (fields != NULL) { + *fields = NULL; + } + + return TSDB_CODE_SUCCESS; + } + + CHECK_CODE(buildStbBoundFields(pDataBlock->boundColsInfo, pSchema, fieldNum, fields, pDataBlock->pMeta)); + + return TSDB_CODE_SUCCESS; +} + int32_t qResetStmtColumns(SArray* pCols, bool deepClear) { int32_t colNum = taosArrayGetSize(pCols); diff --git a/tests/script/api/makefile b/tests/script/api/makefile index d8a4e192187a..9c2bb6be3d56 100644 --- a/tests/script/api/makefile +++ b/tests/script/api/makefile @@ -25,6 +25,7 @@ exe: gcc $(CFLAGS) ./stmt.c -o $(ROOT)stmt $(LFLAGS) gcc $(CFLAGS) ./stmt2.c -o $(ROOT)stmt2 $(LFLAGS) gcc $(CFLAGS) ./stmt2-example.c -o $(ROOT)stmt2-example $(LFLAGS) + gcc $(CFLAGS) ./stmt2-get-fields.c -o $(ROOT)stmt2-get-fields $(LFLAGS) gcc $(CFLAGS) ./stmt2-nohole.c -o $(ROOT)stmt2-nohole $(LFLAGS) gcc $(CFLAGS) ./stmt-crash.c -o $(ROOT)stmt-crash $(LFLAGS) @@ -42,5 +43,6 @@ clean: rm $(ROOT)stmt rm $(ROOT)stmt2 rm $(ROOT)stmt2-example + rm $(ROOT)stmt2-get-fields rm $(ROOT)stmt2-nohole rm $(ROOT)stmt-crash diff --git a/tests/script/api/stmt2-get-fields.c b/tests/script/api/stmt2-get-fields.c new file mode 100644 index 000000000000..befde39f8a6c --- /dev/null +++ b/tests/script/api/stmt2-get-fields.c @@ -0,0 +1,129 @@ +// TAOS standard API example. The same syntax as MySQL, but only a subet +// to compile: gcc -o stmt2-get-fields stmt2-get-fields.c -ltaos + +#include +#include +#include +#include "taos.h" + +void getFields(TAOS *taos, const char *sql) { + TAOS_STMT2_OPTION option = {0}; + TAOS_STMT2 *stmt = taos_stmt2_init(taos, &option); + int code = taos_stmt2_prepare(stmt, sql, 0); + if (code != 0) { + printf("failed to execute taos_stmt2_prepare. error:%s\n", taos_stmt2_error(stmt)); + taos_stmt2_close(stmt); + return; + } + int fieldNum = 0; + TAOS_FIELD_STB *pFields = NULL; + code = taos_stmt2_get_stb_fields(stmt, &fieldNum, &pFields); + if (code != 0) { + printf("failed get col,ErrCode: 0x%x, ErrMessage: %s.\n", code, taos_stmt2_error(stmt)); + } else { + printf("col nums:%d\n", fieldNum); + for (int i = 0; i < fieldNum; i++) { + printf("field[%d]: %s, data_type:%d, field_type:%d\n", i, pFields[i].name, pFields[i].type, + pFields[i].field_type); + } + } + printf("====================================\n"); + taos_stmt2_free_stb_fields(stmt, pFields); + taos_stmt2_close(stmt); +} + +void do_query(TAOS *taos, const char *sql) { + TAOS_RES *result = taos_query(taos, sql); + int code = taos_errno(result); + if (code) { + printf("failed to query: %s, reason:%s\n", sql, taos_errstr(result)); + taos_free_result(result); + return; + } + taos_free_result(result); +} + +void do_stmt(TAOS *taos) { + do_query(taos, "drop database if exists db"); + do_query(taos, "create database db"); + do_query(taos, + "create table db.stb (ts timestamp, b binary(10)) tags(t1 " + "int, t2 binary(10))"); + do_query(taos, "CREATE TABLE db.d0 USING db.stb (t1,t2) TAGS (7,'Cali');"); + do_query(taos, "CREATE TABLE db.ntb(nts timestamp, nb binary(10),nvc varchar(16),ni int);"); + + printf("field_type: TAOS_FIELD_COL = 1, TAOS_FIELD_TAG=2, TAOS_FIELD_QUERY=3, TAOS_FIELD_TBNAME=4\n"); + + // case 1 : INSERT INTO db.stb(t1,t2,ts,b,tbname) values(?,?,?,?,?) + // test super table + const char *sql = "insert into db.stb(t1,t2,ts,b,tbname) values(?,?,?,?,?)"; + printf("====================================\n"); + printf("case 1 : %s\n", sql); + getFields(taos, sql); + + // case 2 : INSERT INTO db.d0 VALUES (?,?) + // test child table + sql = "INSERT INTO db.d0(ts,b) VALUES (?,?)"; + printf("case 2 : %s\n", sql); + getFields(taos, sql); + + // case 3 : INSERT INTO db.ntb VALUES(?,?,?,?) + // test normal table + sql = "INSERT INTO db.ntb VALUES(?,?,?,?)"; + printf("case 3 : %s\n", sql); + getFields(taos, sql); + + // case 4 : INSERT INTO db.? using db.stb TAGS(?,?) VALUES(?,?) + // not support this clause + sql = "insert into db.? using db.stb tags(?, ?) values(?,?)"; + printf("case 4 (not support): %s\n", sql); + getFields(taos, sql); + + // case 5 : INSERT INTO db.stb(t1,t2,ts,b) values(?,?,?,?) + // no tbname error + sql = "INSERT INTO db.stb(t1,t2,ts,b) values(?,?,?,?)"; + printf("case 5 (no tbname error): %s\n", sql); + getFields(taos, sql); + + // case 6 : INSERT INTO db.d0 using db.stb values(?,?) + // none para for ctbname + sql = "INSERT INTO db.d0 using db.stb values(?,?)"; + printf("case 6 (no tags error): %s\n", sql); + getFields(taos, sql); + + // case 7 : insert into db.stb(t1,t2,tbname) values(?,?,?) + // no value + sql = "insert into db.stb(t1,t2,tbname) values(?,?,?)"; + printf("case 7 (no PK error): %s\n", sql); + getFields(taos, sql); + + // case 8 : insert into db.stb(ts,b,tbname) values(?,?,?) + // no tag + sql = "insert into db.stb(ts,b,tbname) values(?,?,?)"; + printf("case 8 : %s\n", sql); + getFields(taos, sql); + + // case 9 : insert into db.stb(ts,b,tbname) values(?,?,?,?,?) + // wrong para nums + sql = "insert into db.stb(ts,b,tbname) values(?,?,?,?,?)"; + printf("case 9 (wrong para nums): %s\n", sql); + getFields(taos, sql); + + // case 10 : insert into db.ntb(nts,ni) values(?,?,?,?,?) + // wrong para nums + sql = "insert into db.ntb(nts,ni) values(?,?)"; + printf("case 10 : %s\n", sql); + getFields(taos, sql); +} + +int main() { + TAOS *taos = taos_connect("localhost", "root", "taosdata", "", 0); + if (!taos) { + printf("failed to connect to db, reason:%s\n", taos_errstr(taos)); + exit(1); + } + + do_stmt(taos); + taos_close(taos); + taos_cleanup(); +} \ No newline at end of file From 097174f609a0b8fd8a73da79bd381b3b9919b462 Mon Sep 17 00:00:00 2001 From: yingzhao Date: Mon, 4 Nov 2024 17:24:16 +0800 Subject: [PATCH 610/695] fix(docs): compile error for using curly brace --- docs/zh/06-advanced/06-data-analysis/addins.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/zh/06-advanced/06-data-analysis/addins.md b/docs/zh/06-advanced/06-data-analysis/addins.md index 867bd9ff235a..8b50c93d85bb 100644 --- a/docs/zh/06-advanced/06-data-analysis/addins.md +++ b/docs/zh/06-advanced/06-data-analysis/addins.md @@ -143,7 +143,7 @@ def test_iqr(self): 并在 model 目录下建立对应的文件夹存放该模型。 -保存模型的调用,可参考 encoder.py 的方式,用户通过调用 set_params 方法,并指定参数 {"model": "ad_encoder_keras"} 的方式,可以调用该模型进行计算。 +保存模型的调用,可参考 encoder.py 的方式,用户通过调用 set_params 方法,并指定参数 `{"model": "ad_encoder_keras"}` 的方式,可以调用该模型进行计算。 具体的调用方式如下: From 51e9f93ae68ebfbfd0f758ec16c9bce2131d0041 Mon Sep 17 00:00:00 2001 From: factosea <285808407@qq.com> Date: Mon, 4 Nov 2024 18:44:50 +0800 Subject: [PATCH 611/695] requestid --- source/client/src/clientMonitor.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/client/src/clientMonitor.c b/source/client/src/clientMonitor.c index 901f4ceef845..5f7e11b6a3c0 100644 --- a/source/client/src/clientMonitor.c +++ b/source/client/src/clientMonitor.c @@ -940,7 +940,7 @@ int32_t reportCB(void* param, SDataBuf* pMsg, int32_t code) { return 0; } -int32_t senAuditInfo(STscObj* pTscObj, void* pReq, int32_t len) { +int32_t senAuditInfo(STscObj* pTscObj, void* pReq, int32_t len, uint64_t requestId) { SMsgSendInfo* sendInfo = taosMemoryCalloc(1, sizeof(SMsgSendInfo)); if (sendInfo == NULL) { tscError("[del report]failed to allocate memory for sendInfo"); @@ -949,7 +949,7 @@ int32_t senAuditInfo(STscObj* pTscObj, void* pReq, int32_t len) { sendInfo->msgInfo = (SDataBuf){.pData = pReq, .len = len, .handle = NULL}; - sendInfo->requestId = generateRequestId(); + sendInfo->requestId = requestId; sendInfo->requestObjRefId = 0; sendInfo->param = NULL; sendInfo->fp = reportCB; @@ -1010,7 +1010,7 @@ static void reportDeleteSql(SRequestObj* pRequest) { return; } - int32_t code = senAuditInfo(pRequest->pTscObj, pReq, tlen); + int32_t code = senAuditInfo(pRequest->pTscObj, pReq, tlen, pRequest->requestId); if (code != 0) { tscError("[del report]failed to send audit info, code:%d", code); taosMemoryFree(pReq); @@ -1020,7 +1020,7 @@ static void reportDeleteSql(SRequestObj* pRequest) { } void clientOperateReport(SRequestObj* pRequest) { - if (pRequest == NULL || pRequest->pQuery == NULL) { + if (pRequest == NULL || pRequest->pQuery == NULL || pRequest->pQuery->pRoot == NULL) { tscError("[del report]invalid request"); return; } From 109c1a799f5a58f16582f783fca7ee4573c70a1f Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Mon, 4 Nov 2024 18:49:36 +0800 Subject: [PATCH 612/695] test/blob: perf json file for taos benchmark --- tests/army/storage/blob/perf.json | 67 +++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 tests/army/storage/blob/perf.json diff --git a/tests/army/storage/blob/perf.json b/tests/army/storage/blob/perf.json new file mode 100644 index 000000000000..002515873eae --- /dev/null +++ b/tests/army/storage/blob/perf.json @@ -0,0 +1,67 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "connection_pool_size": 8, + "num_of_records_per_req": 4000, + "prepared_rand": 500, + "thread_count": 4, + "create_table_thread_count": 1, + "confirm_parameter_prompt": "no", + "databases": [ + { + "dbinfo": { + "name": "db", + "drop": "yes", + "vgroups": 3, + "replica": 3, + "duration":"10d", + "s3_keeplocal":"30d", + "s3_chunkpages":"131072", + "tsdb_pagesize":"1", + "s3_compact":"1", + "wal_retention_size":"1", + "wal_retention_period":"1", + "flush_each_batch":"no", + "keep": "3650d" + }, + "super_tables": [ + { + "name": "stb", + "child_table_exists": "no", + "childtable_count": 500, + "insert_rows": 200000, + "childtable_prefix": "d", + "insert_mode": "taosc", + "timestamp_step": 100, + "start_timestamp": 1600000000000, + "columns": [ + { "type": "bool", "name": "bc"}, + { "type": "float", "name": "fc" }, + { "type": "double", "name": "dc"}, + { "type": "tinyint", "name": "ti"}, + { "type": "smallint", "name": "si" }, + { "type": "int", "name": "ic" ,"max": 1,"min": 1}, + { "type": "bigint", "name": "bi" }, + { "type": "utinyint", "name": "uti"}, + { "type": "usmallint", "name": "usi"}, + { "type": "uint", "name": "ui" }, + { "type": "ubigint", "name": "ubi"}, + { "type": "binary", "name": "bin", "len": 50}, + { "type": "nchar", "name": "nch", "len": 100} + ], + "tags": [ + {"type": "tinyint", "name": "groupid","max": 10,"min": 1}, + {"name": "location","type": "binary", "len": 16, "values": + ["San Francisco", "Los Angles", "San Diego", "San Jose", "Palo Alto", "Campbell", "Mountain View","Sunnyvale", "Santa Clara", "Cupertino"] + } + ] + } + ] + } + ] +} + From d572f9e38779047463ebb35bdf1d4f45b9541af8 Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Mon, 4 Nov 2024 19:21:27 +0800 Subject: [PATCH 613/695] blob/doc: connect blob directly without flexify --- docs/zh/08-operation/12-multi.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/zh/08-operation/12-multi.md b/docs/zh/08-operation/12-multi.md index 5489226ce174..1e81a7ff1e36 100644 --- a/docs/zh/08-operation/12-multi.md +++ b/docs/zh/08-operation/12-multi.md @@ -163,3 +163,15 @@ s3BucketName td-test - 认为全部 S3 服务均指向同一数据源,对各个 S3 服务操作完全等价 - 在某一 S3 服务上操作失败后会切换至其他服务,全部服务都失败后将返回最后产生的错误码 - 最大支持的 S3 服务配置数为 10 + +### 不依赖 Flexify 服务 + +用户界面同 S3,不同的地方在于下面三个参数的配置: + +| # | 参数 | 示例值 | 描述 | +| :--- | :----------- | :--------------------------------------- | :----------------------------------------------------------- | +| 1 | s3EndPoint | https://fd2d01c73.blob.core.windows.net | Blob URL | +| 2 | s3AccessKey | fd2d01c73:veUy/iRBeWaI2YAerl+AStw6PPqg== | 冒号分隔的用户 accountId:accountKey | +| 3 | s3BucketName | test-container | Container name | + +其中 fd2d01c73 是账户 ID;微软 Blob 存储服务只支持 Https 协议,不支持 Http。 From d75d22eb3c707d26a7c30f6cef602144d8d2ade7 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Mon, 4 Nov 2024 19:38:18 +0800 Subject: [PATCH 614/695] fix(stream): check the right return code for concurrent checkpoint trans. --- source/common/src/tglobal.c | 3 + source/dnode/mnode/impl/src/mndStream.c | 11 ++- .../script/tsim/stream/concurrentcheckpt.sim | 79 +++++++++++++++++++ 3 files changed, 89 insertions(+), 4 deletions(-) create mode 100644 tests/script/tsim/stream/concurrentcheckpt.sim diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index 00052cc810c7..2104562c0b87 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -1646,6 +1646,9 @@ static int32_t taosSetServerCfg(SConfig *pCfg) { TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "checkpointInterval"); tsStreamCheckpointInterval = pItem->i32; + TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "concurrentCheckpoint"); + tsMaxConcurrentCheckpoint = pItem->i32; + TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "streamSinkDataRate"); tsSinkDataRate = pItem->fval; diff --git a/source/dnode/mnode/impl/src/mndStream.c b/source/dnode/mnode/impl/src/mndStream.c index a4327b777fc5..88b43d497f06 100644 --- a/source/dnode/mnode/impl/src/mndStream.c +++ b/source/dnode/mnode/impl/src/mndStream.c @@ -1284,9 +1284,10 @@ static int32_t mndProcessStreamCheckpoint(SRpcMsg *pReq) { void* p = taosArrayPush(pList, &in); if (p) { int32_t currentSize = taosArrayGetSize(pList); - mDebug("stream:%s (uid:0x%" PRIx64 ") checkpoint interval beyond threshold: %ds(%" PRId64 - "s) beyond concurrently launch threshold:%d", - pStream->name, pStream->uid, tsStreamCheckpointInterval, duration / 1000, currentSize); + mDebug("stream:%s (uid:0x%" PRIx64 ") total %d stream(s) beyond chpt interval threshold: %ds(%" PRId64 + "s), concurrently launch threshold:%d", + pStream->name, pStream->uid, currentSize, tsStreamCheckpointInterval, duration / 1000, + tsMaxConcurrentCheckpoint); } else { mError("failed to record the checkpoint interval info, stream:0x%" PRIx64, pStream->uid); } @@ -1338,7 +1339,7 @@ static int32_t mndProcessStreamCheckpoint(SRpcMsg *pReq) { code = mndProcessStreamCheckpointTrans(pMnode, p, checkpointId, 1, true); sdbRelease(pSdb, p); - if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) { + if (code == 0 || code == TSDB_CODE_ACTION_IN_PROGRESS) { started += 1; if (started >= capacity) { @@ -1346,6 +1347,8 @@ static int32_t mndProcessStreamCheckpoint(SRpcMsg *pReq) { (started + numOfCheckpointTrans)); break; } + } else { + mError("failed to start checkpoint trans, code:%s", tstrerror(code)); } } } diff --git a/tests/script/tsim/stream/concurrentcheckpt.sim b/tests/script/tsim/stream/concurrentcheckpt.sim new file mode 100644 index 000000000000..4162617debcd --- /dev/null +++ b/tests/script/tsim/stream/concurrentcheckpt.sim @@ -0,0 +1,79 @@ +system sh/stop_dnodes.sh + +system sh/deploy.sh -n dnode1 -i 1 +system sh/cfg.sh -n dnode1 -c supportVnodes -v 1 + +print ========== step1 +system sh/exec.sh -n dnode1 -s start +sql connect + +sql create database abc1 vgroups 1; +sql use abc1; +sql create table st1(ts timestamp, k int) tags(a int); +sql create table t1 using st1 tags(1); +sql create table t2 using st1 tags(2); +sql insert into t1 values(now, 1); + +sql create stream str1 trigger at_once into str_dst1 as select count(*) from st1 interval(30s); +sql create stream str2 trigger at_once into str_dst2 as select count(*) from st1 interval(30s); +sql create stream str3 trigger at_once into str_dst3 as select count(*) from st1 interval(30s); + +print ============== create 3 streams, check the concurrently checkpoint +sleep 180000 + +sql select task_id, checkpoint_id from information_schema.ins_stream_tasks order by checkpoint_id; + +print $data01 $data11 $data21 +if $data01 == $data11 then + print not allowed 2 checkpoint start completed + return -1 +endi + +if $data11 == $data21 then + print not allowed 2 checkpoints start concurrently + return -1 +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT + +print ========== concurrent checkpoint is set 2 + +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/cfg.sh -n dnode1 -c concurrentCheckpoint -v 2 + +system sh/exec.sh -n dnode1 -s start + +print ========== step2 +system sh/exec.sh -n dnode1 -s start +sql connect + +sql create database abc1 vgroups 1; +sql use abc1; +sql create table st1(ts timestamp, k int) tags(a int); +sql create table t1 using st1 tags(1); +sql create table t2 using st1 tags(2); +sql insert into t1 values(now, 1); + +sql create stream str1 trigger at_once into str_dst1 as select count(*) from st1 interval(30s); +sql create stream str2 trigger at_once into str_dst2 as select count(*) from st1 interval(30s); +sql create stream str3 trigger at_once into str_dst3 as select count(*) from st1 interval(30s); + +print ============== create 3 streams, check the concurrently checkpoint +sleep 180000 + +sql select count(*) a, checkpoint_id from information_schema.ins_stream_tasks group by checkpoint_id order by a; +print $data00 $data01 +print $data10 $data11 + +if $data00 != 1 then + print expect 1, actual $data00 + return -1 +endi + +if $data10 != 2 then + print expect 2, actual $data10 + return -1 +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT From 0614efdffd0c776f9a1d461f62d9db84fa03da3e Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Mon, 4 Nov 2024 19:38:18 +0800 Subject: [PATCH 615/695] fix(stream): check the right return code for concurrent checkpoint trans. --- source/common/src/tglobal.c | 3 + source/dnode/mnode/impl/src/mndStream.c | 11 ++- .../script/tsim/stream/concurrentcheckpt.sim | 79 +++++++++++++++++++ 3 files changed, 89 insertions(+), 4 deletions(-) create mode 100644 tests/script/tsim/stream/concurrentcheckpt.sim diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index 834615bdaa84..6caddf470320 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -1646,6 +1646,9 @@ static int32_t taosSetServerCfg(SConfig *pCfg) { TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "checkpointInterval"); tsStreamCheckpointInterval = pItem->i32; + TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "concurrentCheckpoint"); + tsMaxConcurrentCheckpoint = pItem->i32; + TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "streamSinkDataRate"); tsSinkDataRate = pItem->fval; diff --git a/source/dnode/mnode/impl/src/mndStream.c b/source/dnode/mnode/impl/src/mndStream.c index e3f9adf03363..8abe739f25f4 100644 --- a/source/dnode/mnode/impl/src/mndStream.c +++ b/source/dnode/mnode/impl/src/mndStream.c @@ -1294,9 +1294,10 @@ static int32_t mndProcessStreamCheckpoint(SRpcMsg *pReq) { void* p = taosArrayPush(pList, &in); if (p) { int32_t currentSize = taosArrayGetSize(pList); - mDebug("stream:%s (uid:0x%" PRIx64 ") checkpoint interval beyond threshold: %ds(%" PRId64 - "s) beyond concurrently launch threshold:%d", - pStream->name, pStream->uid, tsStreamCheckpointInterval, duration / 1000, currentSize); + mDebug("stream:%s (uid:0x%" PRIx64 ") total %d stream(s) beyond chpt interval threshold: %ds(%" PRId64 + "s), concurrently launch threshold:%d", + pStream->name, pStream->uid, currentSize, tsStreamCheckpointInterval, duration / 1000, + tsMaxConcurrentCheckpoint); } else { mError("failed to record the checkpoint interval info, stream:0x%" PRIx64, pStream->uid); } @@ -1348,7 +1349,7 @@ static int32_t mndProcessStreamCheckpoint(SRpcMsg *pReq) { code = mndProcessStreamCheckpointTrans(pMnode, p, checkpointId, 1, true); sdbRelease(pSdb, p); - if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) { + if (code == 0 || code == TSDB_CODE_ACTION_IN_PROGRESS) { started += 1; if (started >= capacity) { @@ -1356,6 +1357,8 @@ static int32_t mndProcessStreamCheckpoint(SRpcMsg *pReq) { (started + numOfCheckpointTrans)); break; } + } else { + mError("failed to start checkpoint trans, code:%s", tstrerror(code)); } } } diff --git a/tests/script/tsim/stream/concurrentcheckpt.sim b/tests/script/tsim/stream/concurrentcheckpt.sim new file mode 100644 index 000000000000..4162617debcd --- /dev/null +++ b/tests/script/tsim/stream/concurrentcheckpt.sim @@ -0,0 +1,79 @@ +system sh/stop_dnodes.sh + +system sh/deploy.sh -n dnode1 -i 1 +system sh/cfg.sh -n dnode1 -c supportVnodes -v 1 + +print ========== step1 +system sh/exec.sh -n dnode1 -s start +sql connect + +sql create database abc1 vgroups 1; +sql use abc1; +sql create table st1(ts timestamp, k int) tags(a int); +sql create table t1 using st1 tags(1); +sql create table t2 using st1 tags(2); +sql insert into t1 values(now, 1); + +sql create stream str1 trigger at_once into str_dst1 as select count(*) from st1 interval(30s); +sql create stream str2 trigger at_once into str_dst2 as select count(*) from st1 interval(30s); +sql create stream str3 trigger at_once into str_dst3 as select count(*) from st1 interval(30s); + +print ============== create 3 streams, check the concurrently checkpoint +sleep 180000 + +sql select task_id, checkpoint_id from information_schema.ins_stream_tasks order by checkpoint_id; + +print $data01 $data11 $data21 +if $data01 == $data11 then + print not allowed 2 checkpoint start completed + return -1 +endi + +if $data11 == $data21 then + print not allowed 2 checkpoints start concurrently + return -1 +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT + +print ========== concurrent checkpoint is set 2 + +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/cfg.sh -n dnode1 -c concurrentCheckpoint -v 2 + +system sh/exec.sh -n dnode1 -s start + +print ========== step2 +system sh/exec.sh -n dnode1 -s start +sql connect + +sql create database abc1 vgroups 1; +sql use abc1; +sql create table st1(ts timestamp, k int) tags(a int); +sql create table t1 using st1 tags(1); +sql create table t2 using st1 tags(2); +sql insert into t1 values(now, 1); + +sql create stream str1 trigger at_once into str_dst1 as select count(*) from st1 interval(30s); +sql create stream str2 trigger at_once into str_dst2 as select count(*) from st1 interval(30s); +sql create stream str3 trigger at_once into str_dst3 as select count(*) from st1 interval(30s); + +print ============== create 3 streams, check the concurrently checkpoint +sleep 180000 + +sql select count(*) a, checkpoint_id from information_schema.ins_stream_tasks group by checkpoint_id order by a; +print $data00 $data01 +print $data10 $data11 + +if $data00 != 1 then + print expect 1, actual $data00 + return -1 +endi + +if $data10 != 2 then + print expect 2, actual $data10 + return -1 +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT From 26334df0905d61e1950527e081964ffbc9411008 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Mon, 4 Nov 2024 20:13:49 +0800 Subject: [PATCH 616/695] test: add a new test case. --- tests/parallel_test/cases.task | 1 + tests/script/tsim/testsuit.sim | 1 + 2 files changed, 2 insertions(+) diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index d389c2792938..4769c5b67a09 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -1319,6 +1319,7 @@ ,,y,script,./test.sh -f tsim/stream/basic2.sim ,,y,script,./test.sh -f tsim/stream/basic3.sim ,,y,script,./test.sh -f tsim/stream/basic4.sim +,,y,script,./test.sh -f tsim/stream/concurrentcheckpt.sim ,,y,script,./test.sh -f tsim/stream/checkpointInterval0.sim ,,y,script,./test.sh -f tsim/stream/checkStreamSTable1.sim ,,y,script,./test.sh -f tsim/stream/checkStreamSTable.sim diff --git a/tests/script/tsim/testsuit.sim b/tests/script/tsim/testsuit.sim index c208a07488d3..fbc89b196b47 100644 --- a/tests/script/tsim/testsuit.sim +++ b/tests/script/tsim/testsuit.sim @@ -110,6 +110,7 @@ run tsim/stream/distributeInterval0.sim run tsim/stream/distributeSession0.sim run tsim/stream/state0.sim run tsim/stream/basic2.sim +run tsim/stream/concurrentcheckpt.sim run tsim/insert/basic1.sim run tsim/insert/commit-merge0.sim run tsim/insert/basic0.sim From fea19d5ad11e46a037157aa40a9793efa9562eb3 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Mon, 4 Nov 2024 20:13:49 +0800 Subject: [PATCH 617/695] test: add a new test case. --- tests/parallel_test/cases.task | 2 +- tests/script/tsim/testsuit.sim | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 4923858a3e4d..77e4cbdbe56b 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -48,7 +48,7 @@ ,,y,army,./pytest.sh python3 ./test.py -f query/window/base.py ,,y,army,./pytest.sh python3 ./test.py -f query/sys/tb_perf_queries_exist_test.py -N 3 ,,y,army,./pytest.sh python3 ./test.py -f query/test_having.py -,,n,army,python3 ./test.py -f tmq/drop_lost_comsumers.py +,,n,army,python3 ./test.py -f tmq/drop_lost_comsumers.py # # system test # diff --git a/tests/script/tsim/testsuit.sim b/tests/script/tsim/testsuit.sim index ff3bb82aafa7..ec52b8c234bd 100644 --- a/tests/script/tsim/testsuit.sim +++ b/tests/script/tsim/testsuit.sim @@ -111,6 +111,7 @@ run tsim/stream/distributeInterval0.sim run tsim/stream/distributeSession0.sim run tsim/stream/state0.sim run tsim/stream/basic2.sim +run tsim/stream/concurrentcheckpt.sim run tsim/insert/basic1.sim run tsim/insert/commit-merge0.sim run tsim/insert/basic0.sim From 2942542e8517a4da187982cf9d0827a2c3a1a305 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Mon, 4 Nov 2024 20:17:41 +0800 Subject: [PATCH 618/695] fix: compile errors --- source/libs/transport/test/cliBench.c | 2 +- source/libs/transport/test/svrBench.c | 4 ++-- source/libs/transport/test/transUT.cpp | 6 +++--- source/libs/transport/test/transUT2.cpp | 6 +++--- tools/shell/src/shellArguments.c | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/source/libs/transport/test/cliBench.c b/source/libs/transport/test/cliBench.c index 6330b2d2c6a9..0a5cb5d1bb2a 100644 --- a/source/libs/transport/test/cliBench.c +++ b/source/libs/transport/test/cliBench.c @@ -158,7 +158,7 @@ int main(int argc, char *argv[]) { } initLogEnv(); - taosVersionStrToInt(version, &(rpcInit.compatibilityVer)); + taosVersionStrToInt(td_version, &(rpcInit.compatibilityVer)); void *pRpc = rpcOpen(&rpcInit); if (pRpc == NULL) { tError("failed to initialize RPC"); diff --git a/source/libs/transport/test/svrBench.c b/source/libs/transport/test/svrBench.c index dacde982ed55..44299d86a3af 100644 --- a/source/libs/transport/test/svrBench.c +++ b/source/libs/transport/test/svrBench.c @@ -127,7 +127,7 @@ int main(int argc, char *argv[]) { rpcInit.cfp = processRequestMsg; rpcInit.idleTime = 2 * 1500; - taosVersionStrToInt(version, &(rpcInit.compatibilityVer)); + taosVersionStrToInt(td_version, &(rpcInit.compatibilityVer)); rpcDebugFlag = 131; rpcInit.compressSize = -1; @@ -165,7 +165,7 @@ int main(int argc, char *argv[]) { rpcInit.connType = TAOS_CONN_SERVER; initLogEnv(); - taosVersionStrToInt(version, &(rpcInit.compatibilityVer)); + taosVersionStrToInt(td_version, &(rpcInit.compatibilityVer)); void *pRpc = rpcOpen(&rpcInit); if (pRpc == NULL) { tError("failed to start RPC server"); diff --git a/source/libs/transport/test/transUT.cpp b/source/libs/transport/test/transUT.cpp index cac8abf85778..8e396d59d774 100644 --- a/source/libs/transport/test/transUT.cpp +++ b/source/libs/transport/test/transUT.cpp @@ -56,7 +56,7 @@ class Client { rpcInit_.connType = TAOS_CONN_CLIENT; rpcInit_.shareConnLimit = 200; - taosVersionStrToInt(version, &(rpcInit_.compatibilityVer)); + taosVersionStrToInt(td_version, &(rpcInit_.compatibilityVer)); this->transCli = rpcOpen(&rpcInit_); tsem_init(&this->sem, 0, 0); } @@ -69,7 +69,7 @@ class Client { void Restart(CB cb) { rpcClose(this->transCli); rpcInit_.cfp = cb; - taosVersionStrToInt(version, &(rpcInit_.compatibilityVer)); + taosVersionStrToInt(td_version, &(rpcInit_.compatibilityVer)); this->transCli = rpcOpen(&rpcInit_); } void Stop() { @@ -129,7 +129,7 @@ class Server { rpcInit_.cfp = processReq; rpcInit_.user = (char *)user; rpcInit_.connType = TAOS_CONN_SERVER; - taosVersionStrToInt(version, &(rpcInit_.compatibilityVer)); + taosVersionStrToInt(td_version, &(rpcInit_.compatibilityVer)); } void Start() { this->transSrv = rpcOpen(&this->rpcInit_); diff --git a/source/libs/transport/test/transUT2.cpp b/source/libs/transport/test/transUT2.cpp index f69151813e1d..54d23b1f64fa 100644 --- a/source/libs/transport/test/transUT2.cpp +++ b/source/libs/transport/test/transUT2.cpp @@ -56,7 +56,7 @@ class Client { rpcInit_.connType = TAOS_CONN_CLIENT; rpcInit_.shareConnLimit = 200; - taosVersionStrToInt(version, &(rpcInit_.compatibilityVer)); + taosVersionStrToInt(td_version, &(rpcInit_.compatibilityVer)); this->transCli = rpcOpen(&rpcInit_); //tsem_init(&this->sem, 0, 0); } @@ -69,7 +69,7 @@ class Client { void Restart(CB cb) { rpcClose(this->transCli); rpcInit_.cfp = cb; - taosVersionStrToInt(version, &(rpcInit_.compatibilityVer)); + taosVersionStrToInt(td_version, &(rpcInit_.compatibilityVer)); this->transCli = rpcOpen(&rpcInit_); } void Stop() { @@ -139,7 +139,7 @@ class Server { rpcInit_.cfp = processReq; rpcInit_.user = (char *)user; rpcInit_.connType = TAOS_CONN_SERVER; - taosVersionStrToInt(version, &(rpcInit_.compatibilityVer)); + taosVersionStrToInt(td_version, &(rpcInit_.compatibilityVer)); } void Start() { this->transSrv = rpcOpen(&this->rpcInit_); diff --git a/tools/shell/src/shellArguments.c b/tools/shell/src/shellArguments.c index 5dd24dc396e0..442329674da8 100644 --- a/tools/shell/src/shellArguments.c +++ b/tools/shell/src/shellArguments.c @@ -102,7 +102,7 @@ void shellPrintHelp() { #include #endif -const char *argp_program_version = version; +const char *argp_program_version = td_version; #ifdef CUS_EMAIL const char *argp_program_bug_address = CUS_EMAIL; #else From 635f16dd53bce83da9d00c819d1524baff2476dd Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Mon, 4 Nov 2024 20:18:17 +0800 Subject: [PATCH 619/695] test: add a new test case. --- tests/parallel_test/cases.task | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 77e4cbdbe56b..1182fdb93ce6 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -1320,6 +1320,7 @@ ,,y,script,./test.sh -f tsim/stream/basic3.sim ,,y,script,./test.sh -f tsim/stream/basic4.sim ,,y,script,./test.sh -f tsim/stream/snodeCheck.sim +,,y,script,./test.sh -f tsim/stream/concurrentcheckpt.sim ,,y,script,./test.sh -f tsim/stream/checkpointInterval0.sim ,,y,script,./test.sh -f tsim/stream/checkStreamSTable1.sim ,,y,script,./test.sh -f tsim/stream/checkStreamSTable.sim From 47f2c60b2581ace7869908fcf8abb33b6324cd9e Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Mon, 4 Nov 2024 20:19:41 +0800 Subject: [PATCH 620/695] fix: compile errors --- source/dnode/mgmt/test/sut/src/client.cpp | 2 +- source/dnode/mnode/impl/test/profile/profile.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/dnode/mgmt/test/sut/src/client.cpp b/source/dnode/mgmt/test/sut/src/client.cpp index 95eea2359d08..6f8b1eb2b44a 100644 --- a/source/dnode/mgmt/test/sut/src/client.cpp +++ b/source/dnode/mgmt/test/sut/src/client.cpp @@ -54,7 +54,7 @@ void TestClient::DoInit() { rpcInit.parent = this; // rpcInit.secret = (char*)secretEncrypt; // rpcInit.spi = 1; - taosVersionStrToInt(version, &(rpcInit.compatibilityVer)); + taosVersionStrToInt(td_version, &rpcInit.compatibilityVer); clientRpc = rpcOpen(&rpcInit); ASSERT(clientRpc); diff --git a/source/dnode/mnode/impl/test/profile/profile.cpp b/source/dnode/mnode/impl/test/profile/profile.cpp index b1b94c65fb5b..2abe6b7ec90b 100644 --- a/source/dnode/mnode/impl/test/profile/profile.cpp +++ b/source/dnode/mnode/impl/test/profile/profile.cpp @@ -76,7 +76,7 @@ TEST_F(MndTestProfile, 02_ConnectMsg_NotExistDB) { strcpy(connectReq.db, "not_exist_db"); strcpy(connectReq.user, "root"); strcpy(connectReq.passwd, secretEncrypt); - strcpy(connectReq.sVer, version); + strcpy(connectReq.sVer, td_version); int32_t contLen = tSerializeSConnectReq(NULL, 0, &connectReq); void* pReq = rpcMallocCont(contLen); From 74e514dc879cf7cc0c551d2b4f5625704774080d Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Mon, 4 Nov 2024 20:22:14 +0800 Subject: [PATCH 621/695] fix: compile errors --- source/dnode/mnode/impl/test/profile/profile.cpp | 2 +- source/dnode/mnode/impl/test/show/show.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/dnode/mnode/impl/test/profile/profile.cpp b/source/dnode/mnode/impl/test/profile/profile.cpp index 2abe6b7ec90b..bfd8909a76c0 100644 --- a/source/dnode/mnode/impl/test/profile/profile.cpp +++ b/source/dnode/mnode/impl/test/profile/profile.cpp @@ -39,7 +39,7 @@ TEST_F(MndTestProfile, 01_ConnectMsg) { strcpy(connectReq.db, ""); strcpy(connectReq.user, "root"); strcpy(connectReq.passwd, secretEncrypt); - strcpy(connectReq.sVer, version); + strcpy(connectReq.sVer, td_version); int32_t contLen = tSerializeSConnectReq(NULL, 0, &connectReq); void* pReq = rpcMallocCont(contLen); diff --git a/source/dnode/mnode/impl/test/show/show.cpp b/source/dnode/mnode/impl/test/show/show.cpp index 2e67ffa946d6..92b914a8dc93 100644 --- a/source/dnode/mnode/impl/test/show/show.cpp +++ b/source/dnode/mnode/impl/test/show/show.cpp @@ -64,7 +64,7 @@ TEST_F(MndTestShow, 03_ShowMsg_Conn) { strcpy(connectReq.db, ""); strcpy(connectReq.user, "root"); strcpy(connectReq.passwd, secretEncrypt); - strcpy(connectReq.sVer, version); + strcpy(connectReq.sVer, td_version); int32_t contLen = tSerializeSConnectReq(NULL, 0, &connectReq); void* pReq = rpcMallocCont(contLen); From 7085e253886336a0f51694f6f67a3e1973101367 Mon Sep 17 00:00:00 2001 From: xsren <285808407@qq.com> Date: Mon, 4 Nov 2024 20:24:23 +0800 Subject: [PATCH 622/695] enh: lemon --- cmake/lemon_CMakeLists.txt.in | 10 ++++++++++ contrib/CMakeLists.txt | 3 +++ source/libs/parser/CMakeLists.txt | 19 +++++++++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 cmake/lemon_CMakeLists.txt.in diff --git a/cmake/lemon_CMakeLists.txt.in b/cmake/lemon_CMakeLists.txt.in new file mode 100644 index 000000000000..1ba1cfd2e0ab --- /dev/null +++ b/cmake/lemon_CMakeLists.txt.in @@ -0,0 +1,10 @@ +# lemon + ExternalProject_Add( + lemon + URL https://www.sqlite.org/src/tarball/sqlite.tar.gz?r=release + CONFIGURE_COMMAND "" + BUILD_COMMAND ${CMAKE_C_COMPILER} -o ${TD_CONTRIB_DIR}/deps-download/lemon-prefix/src/lemon-build/lemon ${TD_CONTRIB_DIR}/deps-download/lemon-prefix/src/lemon/tool/lemon.c + INSTALL_COMMAND cp ${TD_CONTRIB_DIR}/deps-download/lemon-prefix/src/lemon-build/lemon ${CMAKE_BINARY_DIR}/bin/lemon + INSTALL_COMMAND cp ${TD_CONTRIB_DIR}/deps-download/lemon-prefix/src/lemon/tool/lempar.c ${CMAKE_BINARY_DIR}/bin/lempar.c + BUILD_IN_SOURCE 1 + ) \ No newline at end of file diff --git a/contrib/CMakeLists.txt b/contrib/CMakeLists.txt index eae697560b65..4ac32ed82508 100644 --- a/contrib/CMakeLists.txt +++ b/contrib/CMakeLists.txt @@ -184,6 +184,9 @@ if(${BUILD_PCRE2}) cat("${TD_SUPPORT_DIR}/pcre2_CMakeLists.txt.in" ${CONTRIB_TMP_FILE}) endif() +# lemon +cat("${TD_SUPPORT_DIR}/lemon_CMakeLists.txt.in" ${CONTRIB_TMP_FILE}) + # download dependencies configure_file(${CONTRIB_TMP_FILE} "${TD_CONTRIB_DIR}/deps-download/CMakeLists.txt") execute_process(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" . diff --git a/source/libs/parser/CMakeLists.txt b/source/libs/parser/CMakeLists.txt index f1b801c563da..c138e9271618 100644 --- a/source/libs/parser/CMakeLists.txt +++ b/source/libs/parser/CMakeLists.txt @@ -4,7 +4,26 @@ IF(TD_ENTERPRISE) LIST(APPEND PARSER_SRC ${TD_ENTERPRISE_DIR}/src/plugins/view/src/parserView.c) ENDIF() +add_custom_command( + OUTPUT ${TD_SOURCE_DIR}/source/libs/parser/src/sql.c + COMMAND echo "Running lemon process in ${TD_SOURCE_DIR}/source/libs/parser/inc" + COMMAND ${CMAKE_BINARY_DIR}/bin/lemon sql.y || true + COMMAND echo "copy sql.c from ${TD_SOURCE_DIR}/source/libs/parser/inc/sql.c to ${TD_SOURCE_DIR}/source/libs/parser/src/" + COMMAND cp ${TD_SOURCE_DIR}/source/libs/parser/inc/sql.c ${TD_SOURCE_DIR}/source/libs/parser/src/ + COMMAND echo "lemon process completed." + DEPENDS ${TD_SOURCE_DIR}/source/libs/parser/inc/sql.y + WORKING_DIRECTORY ${TD_SOURCE_DIR}/source/libs/parser/inc + COMMENT "Generating sql.c using lemon" +) + +add_custom_target(lemon_target + DEPENDS ${TD_SOURCE_DIR}/source/libs/parser/src/sql.c +) + +list(APPEND PARSER_SRC ${TD_SOURCE_DIR}/source/libs/parser/src/sql.c) + add_library(parser STATIC ${PARSER_SRC}) +add_dependencies(parser lemon_target) target_include_directories( parser PUBLIC "${TD_SOURCE_DIR}/include/libs/parser" From 6857c6fd1772470adac8709e769e6a3738d2dba9 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Mon, 4 Nov 2024 22:52:51 +0800 Subject: [PATCH 623/695] fix: ci errors --- tests/system-test/0-others/sysinfo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/system-test/0-others/sysinfo.py b/tests/system-test/0-others/sysinfo.py index 43a0400f1880..35e574739bd9 100644 --- a/tests/system-test/0-others/sysinfo.py +++ b/tests/system-test/0-others/sysinfo.py @@ -39,7 +39,7 @@ def check_version(self): taos_list = ['server','client'] for i in taos_list: tdSql.query(f'select {i}_version()') - version_info = str(subprocess.run('cat ../../source/util/src/version.c |grep "char version"', shell=True,capture_output=True).stdout.decode('utf8')).split('"')[1] + version_info = str(subprocess.run('cat ../../source/util/src/version.c |grep "char td_version"', shell=True,capture_output=True).stdout.decode('utf8')).split('"')[1] tdSql.checkData(0,0,version_info) def get_server_status(self): From a0009c28e20c2d681a697d825901392366b9047b Mon Sep 17 00:00:00 2001 From: xsren <285808407@qq.com> Date: Tue, 5 Nov 2024 09:32:01 +0800 Subject: [PATCH 624/695] fix: lemon tmp dir --- cmake/lemon_CMakeLists.txt.in | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cmake/lemon_CMakeLists.txt.in b/cmake/lemon_CMakeLists.txt.in index 1ba1cfd2e0ab..e7dd927c8849 100644 --- a/cmake/lemon_CMakeLists.txt.in +++ b/cmake/lemon_CMakeLists.txt.in @@ -3,8 +3,7 @@ lemon URL https://www.sqlite.org/src/tarball/sqlite.tar.gz?r=release CONFIGURE_COMMAND "" - BUILD_COMMAND ${CMAKE_C_COMPILER} -o ${TD_CONTRIB_DIR}/deps-download/lemon-prefix/src/lemon-build/lemon ${TD_CONTRIB_DIR}/deps-download/lemon-prefix/src/lemon/tool/lemon.c - INSTALL_COMMAND cp ${TD_CONTRIB_DIR}/deps-download/lemon-prefix/src/lemon-build/lemon ${CMAKE_BINARY_DIR}/bin/lemon + BUILD_COMMAND ${CMAKE_C_COMPILER} -o ${CMAKE_BINARY_DIR}/bin/lemon ${TD_CONTRIB_DIR}/deps-download/lemon-prefix/src/lemon/tool/lemon.c INSTALL_COMMAND cp ${TD_CONTRIB_DIR}/deps-download/lemon-prefix/src/lemon/tool/lempar.c ${CMAKE_BINARY_DIR}/bin/lempar.c BUILD_IN_SOURCE 1 ) \ No newline at end of file From dfd9f223f5e5034caf8d3ffd196a3d98ad7f164f Mon Sep 17 00:00:00 2001 From: xsren <285808407@qq.com> Date: Tue, 5 Nov 2024 09:41:35 +0800 Subject: [PATCH 625/695] fix: lemon tmp path --- cmake/lemon_CMakeLists.txt.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/lemon_CMakeLists.txt.in b/cmake/lemon_CMakeLists.txt.in index e7dd927c8849..178d98018828 100644 --- a/cmake/lemon_CMakeLists.txt.in +++ b/cmake/lemon_CMakeLists.txt.in @@ -3,7 +3,7 @@ lemon URL https://www.sqlite.org/src/tarball/sqlite.tar.gz?r=release CONFIGURE_COMMAND "" - BUILD_COMMAND ${CMAKE_C_COMPILER} -o ${CMAKE_BINARY_DIR}/bin/lemon ${TD_CONTRIB_DIR}/deps-download/lemon-prefix/src/lemon/tool/lemon.c - INSTALL_COMMAND cp ${TD_CONTRIB_DIR}/deps-download/lemon-prefix/src/lemon/tool/lempar.c ${CMAKE_BINARY_DIR}/bin/lempar.c + BUILD_COMMAND ${CMAKE_C_COMPILER} -o ${CMAKE_BINARY_DIR}/build/bin/lemon ${TD_CONTRIB_DIR}/deps-download/lemon-prefix/src/lemon/tool/lemon.c + INSTALL_COMMAND cp ${TD_CONTRIB_DIR}/deps-download/lemon-prefix/src/lemon/tool/lempar.c ${CMAKE_BINARY_DIR}/build/bin/lempar.c BUILD_IN_SOURCE 1 ) \ No newline at end of file From 1a20ae8013ad351b485c50dafd8dc1c863869611 Mon Sep 17 00:00:00 2001 From: t_max <1172915550@qq.com> Date: Mon, 4 Nov 2024 17:47:33 +0800 Subject: [PATCH 626/695] docs: update port information --- docs/zh/04-get-started/01-docker.md | 7 ++++--- docs/zh/08-operation/02-planning.md | 24 +++++++++++++++--------- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/docs/zh/04-get-started/01-docker.md b/docs/zh/04-get-started/01-docker.md index 848a7fd499d6..e58e7bff714d 100644 --- a/docs/zh/04-get-started/01-docker.md +++ b/docs/zh/04-get-started/01-docker.md @@ -23,17 +23,18 @@ docker pull tdengine/tdengine:3.3.3.0 然后只需执行下面的命令: ```shell -docker run -d -p 6030:6030 -p 6041:6041 -p 6043-6060:6043-6060 -p 6043-6060:6043-6060/udp tdengine/tdengine +docker run -d -p 6030:6030 -p 6041:6041 -p 6043:6043 -p 6044-6049:6044-6049 -p 6044-6045:6044-6045/udp -p 6060:6060 tdengine/tdengine ``` -注意:TDengine 3.0 服务端仅使用 6030 TCP 端口。6041 为 taosAdapter 所使用提供 REST 服务端口。6043-6049 为 taosAdapter 提供第三方应用接入所使用端口,可根据需要选择是否打开。 +注意:TDengine 3.0 服务端仅使用 6030 TCP 端口。6041 为 taosAdapter 所使用提供 REST 服务端口。6043 为 taosKeeper 使用端口。6044-6049 TCP 端口为 taosAdapter 提供第三方应用接入所使用端口,可根据需要选择是否打开。 +6044 和 6045 UDP 端口为 statsd 和 collectd 格式写入接口,可根据需要选择是否打开。6060 为 taosExplorer 使用端口。具体端口使用情况请参考[网络端口要求](../../operation/planning#网络端口要求)。 如果需要将数据持久化到本机的某一个文件夹,则执行下边的命令: ```shell docker run -d -v ~/data/taos/dnode/data:/var/lib/taos \ -v ~/data/taos/dnode/log:/var/log/taos \ - -p 6030:6030 -p 6041:6041 -p 6043-6060:6043-6060 -p 6043-6060:6043-6060/udp tdengine/tdengine + -p 6030:6030 -p 6041:6041 -p 6043:6043 -p 6044-6049:6044-6049 -p 6044-6045:6044-6045/udp -p 6060:6060 tdengine/tdengine ``` :::note diff --git a/docs/zh/08-operation/02-planning.md b/docs/zh/08-operation/02-planning.md index 66da1df8bfa4..04957ed26c93 100644 --- a/docs/zh/08-operation/02-planning.md +++ b/docs/zh/08-operation/02-planning.md @@ -53,7 +53,7 @@ M = (T × S × 3 + (N / 4096) + 100) 与 WebSocket 连接方式相比,RESTful 连接方式在内存占用上更大,除了缓冲区所需的内存以外,还需要考虑每个连接响应结果的内存开销。这种内存开销与响应结果的JSON 数据大小密切相关,特别是在查询数据量很大时,会占用大量内存。 -由于 RESTful 连接方式不支持分批获取查询数据,这就导致在查询获取超大结果集时,可能会占用特别大的内存,从而导致内存溢出,因此,在大型项目中,建议打开batchfetch=true 选项,以启用 WebSocket 连接方式,实现流式结果集返回,从而避免内存溢出的风险 +由于 RESTful 连接方式不支持分批获取查询数据,这就导致在查询获取超大结果集时,可能会占用特别大的内存,从而导致内存溢出,因此,在大型项目中,建议使用 WebSocket 连接方式,实现流式结果集返回,从而避免内存溢出的风险 **注意** - 建议采用 RESTful/WebSocket 连接方式来访问 TDengine 集群,而不采用taosc 原生连接方式。 @@ -146,11 +146,17 @@ TDengine 的多级存储功能在使用上还具备以下优点。 下表列出了 TDengine 的一些接口或组件的常用端口,这些端口均可以通过配置文件中的参数进行修改。 -|接口或组件 | 端口 | -|:---------------------------:|:---------:| -|原生接口(taosc) | 6030 | -|RESTful 接口 | 6041 | -|WebSocket 接口 |6041 | -|taosKeeper | 6043 | -|taosX | 6050, 6055 | -|taosExplorer | 6060 | \ No newline at end of file +| 接口或组件名称 | 端口 | 协议 | +|:------------------------------------:|:----------:|:-------:| +| 原生接口(taosc) | 6030 | TCP | +| RESTful 接口 | 6041 | TCP | +| WebSocket 接口 | 6041 | TCP | +| statsd 格式写入接口 | 6044 | TCP/UDP | +| collectd 格式写入接口 | 6045 | TCP/UDP | +| openTSDB Telnet 格式写入接口 | 6046 | TCP | +| collectd 使用 openTSDB Telnet 格式写入接口 | 6047 | TCP | +| icinga2 使用 openTSDB Telnet 格式写入接口 | 6048 | TCP | +| tcollector 使用 openTSDB Telnet 格式写入接口 | 6049 | TCP | +| taosKeeper | 6043 | TCP | +| taosX | 6050, 6055 | TCP | +| taosExplorer | 6060 | TCP | From 17300c8b792861c7142fe433e11e211155b402ce Mon Sep 17 00:00:00 2001 From: t_max <1172915550@qq.com> Date: Mon, 4 Nov 2024 18:01:25 +0800 Subject: [PATCH 627/695] docs: update port information --- docs/zh/08-operation/02-planning.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/zh/08-operation/02-planning.md b/docs/zh/08-operation/02-planning.md index 04957ed26c93..83f98af0bb5f 100644 --- a/docs/zh/08-operation/02-planning.md +++ b/docs/zh/08-operation/02-planning.md @@ -151,12 +151,12 @@ TDengine 的多级存储功能在使用上还具备以下优点。 | 原生接口(taosc) | 6030 | TCP | | RESTful 接口 | 6041 | TCP | | WebSocket 接口 | 6041 | TCP | +| taosKeeper | 6043 | TCP | | statsd 格式写入接口 | 6044 | TCP/UDP | | collectd 格式写入接口 | 6045 | TCP/UDP | | openTSDB Telnet 格式写入接口 | 6046 | TCP | | collectd 使用 openTSDB Telnet 格式写入接口 | 6047 | TCP | | icinga2 使用 openTSDB Telnet 格式写入接口 | 6048 | TCP | | tcollector 使用 openTSDB Telnet 格式写入接口 | 6049 | TCP | -| taosKeeper | 6043 | TCP | | taosX | 6050, 6055 | TCP | | taosExplorer | 6060 | TCP | From 6f7bca4d803f492dcb1aad30cde4c36d6eec061b Mon Sep 17 00:00:00 2001 From: Feng Chao Date: Tue, 5 Nov 2024 10:33:01 +0800 Subject: [PATCH 628/695] Update test_case_when.py --- tests/army/query/test_case_when.py | 34 ++++++++++++++++-------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/tests/army/query/test_case_when.py b/tests/army/query/test_case_when.py index dea5a5f01f69..e77291418397 100644 --- a/tests/army/query/test_case_when.py +++ b/tests/army/query/test_case_when.py @@ -324,19 +324,15 @@ def test_case_when_statements(self): tdSql.query("select case when ts='2024-10-01 00:00:04.000' then 456646546 when ts>'2024-10-01 00:00:04.000' then 'after today' else 'before today or unknow date' end from st1;") assert(tdSql.checkRows(10) and tdSql.res == [('before today or unknow date',), ('before today or unknow date',), ('before today or unknow date',), ('before today or unknow date',), ('456646546',), ('after today',), ('after today',), ('after today',), ('after today',), ('after today',)]) - tdSql.query("select case when c_geometry is null then c_geometry else c_null end from st1;") - assert(tdSql.checkRows(10) and all([item[0] is None for item in tdSql.res])) - - # tdSql.error("select case when c_geometry is not null then c_geometry else c_null end from st1;") - # tdSql.error("select case when c_geometry='POINT(2 2)' then c_geometry else c_bool end from st1;") - # tdSql.error("select case when c_geometry!='POINT(2 2)' then c_geometry else c_bool end from st1;") + tdSql.error("select case when c_geometry is null then c_geometry else c_null end from st1;") + tdSql.error("select case when c_geometry is not null then c_geometry else c_null end from st1;") + tdSql.error("select case when c_geometry='POINT(2 2)' then c_geometry else c_bool end from st1;") + tdSql.error("select case when c_geometry!='POINT(2 2)' then c_geometry else c_bool end from st1;") - tdSql.query("select case when t is null then t else c_null end from st2;") - assert(tdSql.checkRows(10) and all([item[0] is None for item in tdSql.res])) - - # tdSql.error("select case when t is not null then t else c_null end from st2;") - # tdSql.error("select case when t->'location'='beijing' then t->'location' else c_bool end from st2;") - # tdSql.error("select case when t->'location'!='beijing' then t->'location' else c_bool end from st1;") + tdSql.error("select case when t is null then t else c_null end from st2;") + tdSql.error("select case when t is not null then t else c_null end from st2;") + tdSql.error("select case when t->'location'='beijing' then t->'location' else c_bool end from st2;") + tdSql.error("select case when t->'location'!='beijing' then t->'location' else c_bool end from st1;") tdSql.query("select case when c_float!=2.2 then 387897 else 'test message' end from st1;") assert(tdSql.checkRows(10) and tdSql.res == [('test message',), ('387897',), ('387897',), ('387897',), ('387897',), ('387897',), ('387897',), ('387897',), ('387897',), ('test message',)]) @@ -344,9 +340,15 @@ def test_case_when_statements(self): tdSql.query("select case when c_double!=2.22 then 387897 else 'test message' end from st1;") assert(tdSql.checkRows(10) and tdSql.res == [('test message',), ('387897',), ('387897',), ('387897',), ('387897',), ('387897',), ('387897',), ('387897',), ('387897',), ('test message',)]) - # tdSql.query("select case c_tinyint when 2 then -2147483648 when 3 then 'three' else '4294967295' end from st1;") - # tdSql.query("select case c_float when 2.2 then 9.2233720e+18 when 3.3 then -9.2233720e+18 else 'aa' end from st1;") - # tdSql.query("select case t1.c_int when 2 then 'run' when t1.c_int is null then 'other' else t2.c_varchar end from st1 t1, st2 t2 where t1.ts=t2.ts;") + tdSql.query("select case c_tinyint when 2 then -2147483648 when 3 then 'three' else '4294967295' end from st1;") + assert(tdSql.checkRows(10) and tdSql.res == [('-2147483648',), ('three',), ('4294967295',), ('4294967295',), ('4294967295',), ('4294967295',), ('4294967295',), ('4294967295',), ('4294967295',), ('4294967295',)]) + + tdSql.query("select case c_float when 2.2 then 9.2233720e+18 when 3.3 then -9.2233720e+18 else 'aa' end from st1;") + assert(tdSql.checkRows(10) and tdSql.res == [('9223372000000000000.000000',), ('-9223372000000000000.000000',), ('aa',), ('aa',), ('aa',), ('aa',), ('aa',), ('aa',), ('aa',), ('aa',)]) + + tdSql.query("select case t1.c_int when 2 then 'run' when t1.c_int is null then 'other' else t2.c_varchar end from st1 t1, st2 t2 where t1.ts=t2.ts;") + print(tdSql.res) + assert(tdSql.checkRows(10) and tdSql.res == [('run',), ('cccccccc',), ('dddddddd',), ('eeeeeeee',), ('ffffffff',), ('gggggggg',), ('hhhhhhhh',), ('iiiiiiii',), ('jjjjjjjj',), (None,)]) tdSql.query("select avg(case when c_tinyint>=2 then c_tinyint else c_null end) from st1;") assert(tdSql.checkRows(1) and tdSql.res == [(6.0,)]) @@ -365,7 +367,7 @@ def run(self): self.test_case_when_statements() def stop(self): - # tdSql.execute("drop database test_case_when;") + tdSql.execute("drop database test_case_when;") tdSql.close() tdLog.success("%s successfully executed" % __file__) From 35a1d79b9829df25847092f7025cccde43a99e2c Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Tue, 5 Nov 2024 10:37:39 +0800 Subject: [PATCH 629/695] fix(stream):check scan range of stream operator --- source/libs/executor/src/scanoperator.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 95846087d044..e75a9d59a464 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -2068,6 +2068,7 @@ static int32_t generateSessionScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSr if (pSrcBlock->info.rows == 0) { return TSDB_CODE_SUCCESS; } + SSHashObj* pScanRange = tSimpleHashInit(8, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT)); SExecTaskInfo* pTaskInfo = pInfo->pStreamScanOp->pTaskInfo; SColumnInfoData* pStartTsCol = taosArrayGet(pSrcBlock->pDataBlock, START_TS_COLUMN_INDEX); TSKEY* startData = (TSKEY*)pStartTsCol->pData; @@ -2128,6 +2129,13 @@ static int32_t generateSessionScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSr qError("generate session scan range failed. rang start:%" PRIx64 ", end:%" PRIx64, startData[i], endData[i]); continue; } + + SSessionKey checkKey = {.groupId = groupId, .win.skey = startWin.win.skey, .win.ekey = endWin.win.ekey}; + if (tSimpleHashGet(pScanRange, &checkKey, sizeof(SSessionKey)) != NULL) { + continue; + } + tSimpleHashPut(pScanRange, &checkKey, sizeof(SSessionKey), NULL, 0); + code = colDataSetVal(pDestStartCol, i, (const char*)&startWin.win.skey, false); QUERY_CHECK_CODE(code, lino, _end); @@ -2238,6 +2246,7 @@ static int32_t generateIntervalScanRange(SStreamScanInfo* pInfo, SSDataBlock* pS if (pSrcBlock->info.rows == 0) { return TSDB_CODE_SUCCESS; } + SSHashObj* pScanRange = tSimpleHashInit(8, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT)); SExecTaskInfo* pTaskInfo = pInfo->pStreamScanOp->pTaskInfo; SColumnInfoData* pSrcStartTsCol = (SColumnInfoData*)taosArrayGet(pSrcBlock->pDataBlock, START_TS_COLUMN_INDEX); SColumnInfoData* pSrcEndTsCol = (SColumnInfoData*)taosArrayGet(pSrcBlock->pDataBlock, END_TS_COLUMN_INDEX); @@ -2297,6 +2306,12 @@ static int32_t generateIntervalScanRange(SStreamScanInfo* pInfo, SSDataBlock* pS code = colDataSetVal(pDeUidCol, pDestBlock->info.rows, (const char*)(&srcUid), false); QUERY_CHECK_CODE(code, lino, _end); + SSessionKey checkKey = {.groupId = groupId, .win = win}; + if (tSimpleHashGet(pScanRange, &checkKey, sizeof(SSessionKey)) != NULL) { + continue; + } + tSimpleHashPut(pScanRange, &checkKey, sizeof(SSessionKey), NULL, 0); + code = colDataSetVal(pStartTsCol, pDestBlock->info.rows, (const char*)(&win.skey), false); QUERY_CHECK_CODE(code, lino, _end); @@ -2310,6 +2325,9 @@ static int32_t generateIntervalScanRange(SStreamScanInfo* pInfo, SSDataBlock* pS } _end: + if (pScanRange != NULL) { + tSimpleHashCleanup(pScanRange); + } if (code != TSDB_CODE_SUCCESS) { qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); } From 75f838c4b49672b2523309ad7a0080ef3ac5a81c Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Tue, 5 Nov 2024 11:02:41 +0800 Subject: [PATCH 630/695] fix(stream): fix syntax error. --- source/libs/stream/src/streamMeta.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/stream/src/streamMeta.c b/source/libs/stream/src/streamMeta.c index 90ef5fd6430b..f5de719848e4 100644 --- a/source/libs/stream/src/streamMeta.c +++ b/source/libs/stream/src/streamMeta.c @@ -452,7 +452,7 @@ int32_t streamMetaOpen(const char* path, void* ahandle, FTaskBuild buildTaskFn, TSDB_CHECK_CODE(code, lino, _err); // add refId at the end of initialization function - pMeta->rid = taosAddRef(streamMetaId, pMeta); + pMeta->rid = taosAddRef(streamMetaRefPool, pMeta); int64_t* pRid = taosMemoryMalloc(sizeof(int64_t)); TSDB_CHECK_NULL(pRid, code, lino, _err, terrno); From ce67963f8ddeb2cf6f1ff02c5043b4294dba8a1c Mon Sep 17 00:00:00 2001 From: xsren <285808407@qq.com> Date: Tue, 5 Nov 2024 11:07:44 +0800 Subject: [PATCH 631/695] fix: lemon path --- cmake/lemon_CMakeLists.txt.in | 5 +++-- source/libs/parser/CMakeLists.txt | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/cmake/lemon_CMakeLists.txt.in b/cmake/lemon_CMakeLists.txt.in index 178d98018828..f77f48217f46 100644 --- a/cmake/lemon_CMakeLists.txt.in +++ b/cmake/lemon_CMakeLists.txt.in @@ -3,7 +3,8 @@ lemon URL https://www.sqlite.org/src/tarball/sqlite.tar.gz?r=release CONFIGURE_COMMAND "" - BUILD_COMMAND ${CMAKE_C_COMPILER} -o ${CMAKE_BINARY_DIR}/build/bin/lemon ${TD_CONTRIB_DIR}/deps-download/lemon-prefix/src/lemon/tool/lemon.c - INSTALL_COMMAND cp ${TD_CONTRIB_DIR}/deps-download/lemon-prefix/src/lemon/tool/lempar.c ${CMAKE_BINARY_DIR}/build/bin/lempar.c + BUILD_COMMAND ${CMAKE_C_COMPILER} -o ${TD_CONTRIB_DIR}/deps-download/lemon-prefix/src/lemon/tool/lemon ${TD_CONTRIB_DIR}/deps-download/lemon-prefix/src/lemon/tool/lemon.c + INSTALL_COMMAND "" BUILD_IN_SOURCE 1 + BUILD_ALWAYS 1 ) \ No newline at end of file diff --git a/source/libs/parser/CMakeLists.txt b/source/libs/parser/CMakeLists.txt index c138e9271618..9e28e9bc72d4 100644 --- a/source/libs/parser/CMakeLists.txt +++ b/source/libs/parser/CMakeLists.txt @@ -7,7 +7,7 @@ ENDIF() add_custom_command( OUTPUT ${TD_SOURCE_DIR}/source/libs/parser/src/sql.c COMMAND echo "Running lemon process in ${TD_SOURCE_DIR}/source/libs/parser/inc" - COMMAND ${CMAKE_BINARY_DIR}/bin/lemon sql.y || true + COMMAND ${TD_CONTRIB_DIR}/deps-download/lemon-prefix/src/lemon/tool/lemon sql.y || true COMMAND echo "copy sql.c from ${TD_SOURCE_DIR}/source/libs/parser/inc/sql.c to ${TD_SOURCE_DIR}/source/libs/parser/src/" COMMAND cp ${TD_SOURCE_DIR}/source/libs/parser/inc/sql.c ${TD_SOURCE_DIR}/source/libs/parser/src/ COMMAND echo "lemon process completed." From ecf8f92ac833f8379f021d61e16680480d076f82 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Tue, 5 Nov 2024 11:11:23 +0800 Subject: [PATCH 632/695] fix ci issue --- source/libs/executor/src/scanoperator.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index e75a9d59a464..5135c368b3bb 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -2134,7 +2134,8 @@ static int32_t generateSessionScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSr if (tSimpleHashGet(pScanRange, &checkKey, sizeof(SSessionKey)) != NULL) { continue; } - tSimpleHashPut(pScanRange, &checkKey, sizeof(SSessionKey), NULL, 0); + code = tSimpleHashPut(pScanRange, &checkKey, sizeof(SSessionKey), NULL, 0); + QUERY_CHECK_CODE(code, lino, _end); code = colDataSetVal(pDestStartCol, i, (const char*)&startWin.win.skey, false); QUERY_CHECK_CODE(code, lino, _end); @@ -2310,7 +2311,8 @@ static int32_t generateIntervalScanRange(SStreamScanInfo* pInfo, SSDataBlock* pS if (tSimpleHashGet(pScanRange, &checkKey, sizeof(SSessionKey)) != NULL) { continue; } - tSimpleHashPut(pScanRange, &checkKey, sizeof(SSessionKey), NULL, 0); + code = tSimpleHashPut(pScanRange, &checkKey, sizeof(SSessionKey), NULL, 0); + QUERY_CHECK_CODE(code, lino, _end); code = colDataSetVal(pStartTsCol, pDestBlock->info.rows, (const char*)(&win.skey), false); QUERY_CHECK_CODE(code, lino, _end); From fa90a34dbecbcc481576742739a30b7cfd6c3374 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Tue, 5 Nov 2024 11:14:54 +0800 Subject: [PATCH 633/695] doc: simple changes --- docs/examples/JDBC/taosdemo/readme.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/docs/examples/JDBC/taosdemo/readme.md b/docs/examples/JDBC/taosdemo/readme.md index 141391d1f619..82aba4d9c1cd 100644 --- a/docs/examples/JDBC/taosdemo/readme.md +++ b/docs/examples/JDBC/taosdemo/readme.md @@ -7,8 +7,4 @@ java -jar target/taosdemo-2.0.1-jar-with-dependencies.jar -host -data java -jar target/taosdemo-2.0.1-jar-with-dependencies.jar -host -database -doCreateTable false -superTableSQL "create table weather(ts timestamp, f1 int) tags(t1 nchar(4))" -numOfTables 1000 -numOfRowsPerTable 100000000 -numOfThreadsForInsert 10 -numOfTablesPerSQL 10 -numOfValuesPerSQL 100 ``` -如果发生错误 Exception in thread "main" java.lang.UnsatisfiedLinkError: no taos in java.library.path -请检查是否安装 TDengine 客户端安装包或编译 TDengine 安装。如果确定已经安装过还出现这个错误,可以在命令行 java 后加 -Djava.library.path=/usr/lib 来指定寻找共享库的路径。 - - If you encounter the error Exception in thread "main" `java.lang.UnsatisfiedLinkError: no taos in java.library.path`, please check whether the TDengine client package is installed or TDengine is compiled and installed. If you are sure it is installed and still encounter this error, you can add `-Djava.library.path=/usr/lib` after the `java` command to specify the path to the shared library. From d010323eb6f3cb6344fa14ce3a5a0d51af3ab779 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Tue, 5 Nov 2024 13:15:32 +0800 Subject: [PATCH 634/695] fix ci issue --- source/libs/executor/src/scanoperator.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 5135c368b3bb..cda4084ec9f8 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -2153,6 +2153,7 @@ static int32_t generateSessionScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSr } _end: + tSimpleHashCleanup(pScanRange); if (code != TSDB_CODE_SUCCESS) { qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); } @@ -2327,9 +2328,7 @@ static int32_t generateIntervalScanRange(SStreamScanInfo* pInfo, SSDataBlock* pS } _end: - if (pScanRange != NULL) { - tSimpleHashCleanup(pScanRange); - } + tSimpleHashCleanup(pScanRange); if (code != TSDB_CODE_SUCCESS) { qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); } From e3beccbde14f9c5d31911b697ce7115cc5b5b3c3 Mon Sep 17 00:00:00 2001 From: Shungang Li Date: Thu, 24 Oct 2024 10:50:29 +0800 Subject: [PATCH 635/695] enh: add more log for last cache retrieve --- source/dnode/vnode/src/tsdb/tsdbCacheRead.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/source/dnode/vnode/src/tsdb/tsdbCacheRead.c b/source/dnode/vnode/src/tsdb/tsdbCacheRead.c index d508d759229a..c7626dcf367e 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCacheRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbCacheRead.c @@ -613,6 +613,16 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32 singleTableLastTs = pColVal->rowKey.ts; } + if (p->colVal.value.type != pColVal->colVal.value.type) { + // check for type/cid mismatch + tsdbError("last cache type mismatch, uid:%" PRIu64 + ", schema-type:%d, slotId:%d, cache-type:%d, cache-col:%d", + uid, p->colVal.value.type, slotIds[k], pColVal->colVal.value.type, pColVal->colVal.cid); + taosArrayClearEx(pRow, tsdbCacheFreeSLastColItem); + code = TSDB_CODE_INVALID_PARA; + goto _end; + } + if (!IS_VAR_DATA_TYPE(pColVal->colVal.value.type)) { p->colVal = pColVal->colVal; } else { From 90d1e014db7dbcbddfa0d6d303dbbede7f266638 Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Tue, 5 Nov 2024 14:25:24 +0800 Subject: [PATCH 636/695] az/begin: remove duplicate begin & end of empty impl. --- source/libs/azure/src/az.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/source/libs/azure/src/az.cpp b/source/libs/azure/src/az.cpp index 5f95624c940d..9a1f95b14245 100644 --- a/source/libs/azure/src/az.cpp +++ b/source/libs/azure/src/az.cpp @@ -22,6 +22,10 @@ #include "taoserror.h" #include "tglobal.h" +int32_t azBegin() { return TSDB_CODE_SUCCESS; } + +void azEnd() {} + #if defined(USE_S3) #include @@ -40,10 +44,6 @@ extern char tsS3BucketName[TSDB_FQDN_LEN]; extern int8_t tsS3Enabled; extern int8_t tsS3EpNum; -int32_t azBegin() { return TSDB_CODE_SUCCESS; } - -void azEnd() {} - static void checkPrint(const char *fmt, ...) { va_list arg_ptr; va_start(arg_ptr, fmt); @@ -524,10 +524,6 @@ int32_t azDeleteObjects(const char *object_name[], int nobject) { #else -int32_t azBegin() { return TSDB_CODE_SUCCESS; } - -void azEnd() {} - int32_t azCheckCfg() { return TSDB_CODE_SUCCESS; } int32_t azPutObjectFromFileOffset(const char *file, const char *object_name, int64_t offset, int64_t size) { From 7316b339b6fa3b17a45120402ad12cb551b03f8d Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Tue, 5 Nov 2024 14:34:20 +0800 Subject: [PATCH 637/695] az/get object by prefix: catch all cpp eceptions --- source/libs/azure/src/az.cpp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/source/libs/azure/src/az.cpp b/source/libs/azure/src/az.cpp index 9a1f95b14245..1380b58bbdd0 100644 --- a/source/libs/azure/src/az.cpp +++ b/source/libs/azure/src/az.cpp @@ -32,7 +32,6 @@ void azEnd() {} #include #include "td_block_blob_client.hpp" -// Add appropriate using namespace directives using namespace Azure::Storage; using namespace Azure::Storage::Blobs; @@ -223,7 +222,6 @@ static int32_t azPutObjectFromFileOffsetImpl(const char *file, const char *objec uint8_t blobContent[] = "Hello Azure!"; // Create the block blob client // BlockBlobClient blobClient = containerClient.GetBlockBlobClient(blobName); - // TDBlockBlobClient blobClient(containerClient.GetBlobClient(blobName)); TDBlockBlobClient blobClient(containerClient.GetBlobClient(object_name)); blobClient.UploadFrom(file, offset, size); @@ -467,7 +465,7 @@ int32_t azGetObjectToFile(const char *object_name, const char *fileName) { TAOS_RETURN(code); } -int32_t azGetObjectsByPrefix(const char *prefix, const char *path) { +static int32_t azGetObjectsByPrefixImpl(const char *prefix, const char *path) { const std::string delimiter = "/"; std::string accountName = tsS3AccessKeyId[0]; std::string accountKey = tsS3AccessKeySecret[0]; @@ -514,6 +512,23 @@ int32_t azGetObjectsByPrefix(const char *prefix, const char *path) { return 0; } +int32_t azGetObjectsByPrefix(const char *prefix, const char *path) { + int32_t code = 0; + + try { + code = azGetObjectsByPrefixImpl(prefix, path); + } catch (const std::exception &e) { + azError("%s: Reason Phrase: %s", __func__, e.what()); + + code = TAOS_SYSTEM_ERROR(EIO); + azError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(code)); + + TAOS_RETURN(code); + } + + TAOS_RETURN(code); +} + int32_t azDeleteObjects(const char *object_name[], int nobject) { for (int i = 0; i < nobject; ++i) { azDeleteObjectsByPrefix(object_name[i]); From a51bd9a24ff5661615cdf13487de53d9fd6da697 Mon Sep 17 00:00:00 2001 From: factosea <285808407@qq.com> Date: Tue, 5 Nov 2024 15:42:57 +0800 Subject: [PATCH 638/695] enh: cal output col counts --- source/libs/executor/src/dataDispatcher.c | 38 ++++++++++++++--------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/source/libs/executor/src/dataDispatcher.c b/source/libs/executor/src/dataDispatcher.c index 48f4ed3ed1aa..f255d0b95c1b 100644 --- a/source/libs/executor/src/dataDispatcher.c +++ b/source/libs/executor/src/dataDispatcher.c @@ -45,6 +45,7 @@ typedef struct SDataDispatchHandle { SDataBlockDescNode* pSchema; STaosQueue* pDataBlocks; SDataDispatchBuf nextOutput; + int32_t outPutColCounts; int32_t status; bool queryEnd; uint64_t useconds; @@ -68,23 +69,12 @@ static int32_t inputSafetyCheck(SDataDispatchHandle* pHandle, const SInputData* return TSDB_CODE_QRY_INVALID_INPUT; } - SNode* pNode; - int32_t numOfCols = 0; - FOREACH(pNode, pHandle->pSchema->pSlots) { - SSlotDescNode* pSlotDesc = (SSlotDescNode*)pNode; - if (pSlotDesc->output) { - ++numOfCols; - } else { - // Slots must be sorted, and slots with 'output' set to true must come first - break; - } - } - - if (numOfCols > taosArrayGetSize(pInput->pData->pDataBlock)) { - qError("invalid column number, schema:%d, input:%zu", numOfCols, taosArrayGetSize(pInput->pData->pDataBlock)); + if (pHandle->outPutColCounts > taosArrayGetSize(pInput->pData->pDataBlock)) { + qError("invalid column number, schema:%d, input:%zu", pHandle->outPutColCounts, taosArrayGetSize(pInput->pData->pDataBlock)); return TSDB_CODE_QRY_INVALID_INPUT; } + SNode* pNode; int32_t colNum = 0; FOREACH(pNode, pHandle->pSchema->pSlots) { SSlotDescNode* pSlotDesc = (SSlotDescNode*)pNode; @@ -419,6 +409,25 @@ static int32_t blockDescNodeCheck(SDataBlockDescNode* pInputDataBlockDesc) { return TSDB_CODE_SUCCESS; } +int32_t getOutputColCounts(SDataBlockDescNode* pInputDataBlockDesc) { + if (pInputDataBlockDesc == NULL) { + qError("invalid schema"); + return 0; + } + SNode* pNode; + int32_t numOfCols = 0; + FOREACH(pNode, pInputDataBlockDesc->pSlots) { + SSlotDescNode* pSlotDesc = (SSlotDescNode*)pNode; + if (pSlotDesc->output) { + ++numOfCols; + } else { + // Slots must be sorted, and slots with 'output' set to true must come first + break; + } + } + return numOfCols; +} + int32_t createDataDispatcher(SDataSinkManager* pManager, const SDataSinkNode* pDataSink, DataSinkHandle* pHandle) { int32_t code; code = blockDescNodeCheck(pDataSink->pInputDataBlockDesc); @@ -443,6 +452,7 @@ int32_t createDataDispatcher(SDataSinkManager* pManager, const SDataSinkNode* pD dispatcher->pManager = pManager; pManager = NULL; dispatcher->pSchema = pDataSink->pInputDataBlockDesc; + dispatcher->outPutColCounts = getOutputColCounts(dispatcher->pSchema); dispatcher->status = DS_BUF_EMPTY; dispatcher->queryEnd = false; code = taosOpenQueue(&dispatcher->pDataBlocks); From af18e2a5dd6a161a5d058482807fa1b32308ad71 Mon Sep 17 00:00:00 2001 From: facetosea <25808407@qq.com> Date: Tue, 5 Nov 2024 16:54:49 +0800 Subject: [PATCH 639/695] fix: build lemon --- cmake/lemon_CMakeLists.txt.in | 19 ++++++++++--------- contrib/CMakeLists.txt | 8 ++++++++ 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/cmake/lemon_CMakeLists.txt.in b/cmake/lemon_CMakeLists.txt.in index f77f48217f46..08295adb26b0 100644 --- a/cmake/lemon_CMakeLists.txt.in +++ b/cmake/lemon_CMakeLists.txt.in @@ -1,10 +1,11 @@ # lemon - ExternalProject_Add( - lemon - URL https://www.sqlite.org/src/tarball/sqlite.tar.gz?r=release - CONFIGURE_COMMAND "" - BUILD_COMMAND ${CMAKE_C_COMPILER} -o ${TD_CONTRIB_DIR}/deps-download/lemon-prefix/src/lemon/tool/lemon ${TD_CONTRIB_DIR}/deps-download/lemon-prefix/src/lemon/tool/lemon.c - INSTALL_COMMAND "" - BUILD_IN_SOURCE 1 - BUILD_ALWAYS 1 - ) \ No newline at end of file + +ExternalProject_Add( + lemon + URL https://www.sqlite.org/src/tarball/sqlite.tar.gz?r=release + CONFIGURE_COMMAND "" + BUILD_COMMAND ${C_COMPILER_LEMON} -o ${TD_CONTRIB_DIR}/deps-download/lemon-prefix/src/lemon/tool/lemon ${TD_CONTRIB_DIR}/deps-download/lemon-prefix/src/lemon/tool/lemon.c + INSTALL_COMMAND "" + BUILD_IN_SOURCE 1 + BUILD_ALWAYS 1 +) \ No newline at end of file diff --git a/contrib/CMakeLists.txt b/contrib/CMakeLists.txt index 4ac32ed82508..0899e5d02fe2 100644 --- a/contrib/CMakeLists.txt +++ b/contrib/CMakeLists.txt @@ -184,6 +184,14 @@ if(${BUILD_PCRE2}) cat("${TD_SUPPORT_DIR}/pcre2_CMakeLists.txt.in" ${CONTRIB_TMP_FILE}) endif() +find_program(C_COMPILER_LEMON NAMES gcc) +if(C_COMPILER_LEMON) + message(STATUS "LEMON C compiler: ${C_COMPILER_LEMON}") +else() + set(C_COMPILER_LEMON CMAKE_C_COMPILER) + message(STATUS "LEMON C compiler: ${C_COMPILER_LEMON}") +endif() + # lemon cat("${TD_SUPPORT_DIR}/lemon_CMakeLists.txt.in" ${CONTRIB_TMP_FILE}) From 688b159bec22791b93218fa03d412016e636b809 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Tue, 5 Nov 2024 17:09:52 +0800 Subject: [PATCH 640/695] fix:[TD-32166] change createRequest to buildRequest to avoid printing error because request not in pRequests hash --- source/client/src/clientEnv.c | 2 +- source/client/src/clientRawBlockWrite.c | 8 ++++---- source/client/src/clientSml.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c index 21f7c930360b..b1eb4a683f87 100644 --- a/source/client/src/clientEnv.c +++ b/source/client/src/clientEnv.c @@ -686,7 +686,7 @@ void doDestroyRequest(void *p) { int32_t code = taosHashRemove(pRequest->pTscObj->pRequests, &pRequest->self, sizeof(pRequest->self)); if (TSDB_CODE_SUCCESS != code) { - tscError("failed to remove request from hash, code:%s", tstrerror(code)); + tscWarn("failed to remove request from hash, code:%s", tstrerror(code)); } schedulerFreeJob(&pRequest->body.queryJob, 0); diff --git a/source/client/src/clientRawBlockWrite.c b/source/client/src/clientRawBlockWrite.c index acba8117c63f..213c18ac8ad0 100644 --- a/source/client/src/clientRawBlockWrite.c +++ b/source/client/src/clientRawBlockWrite.c @@ -1590,7 +1590,7 @@ int taos_write_raw_block_with_fields_with_reqid(TAOS* taos, int rows, char* pDat SHashObj* pVgHash = NULL; SRequestObj* pRequest = NULL; - RAW_RETURN_CHECK(createRequest(*(int64_t*)taos, TSDB_SQL_INSERT, reqid, &pRequest)); + RAW_RETURN_CHECK(buildRequest(*(int64_t*)taos, "", 0, NULL, false, &pRequest, reqid)); uDebug(LOG_ID_TAG " write raw block with field, rows:%d, pData:%p, tbname:%s, fields:%p, numFields:%d", LOG_ID_VALUE, rows, pData, tbname, fields, numFields); @@ -1651,7 +1651,7 @@ int taos_write_raw_block_with_reqid(TAOS* taos, int rows, char* pData, const cha SHashObj* pVgHash = NULL; SRequestObj* pRequest = NULL; - RAW_RETURN_CHECK(createRequest(*(int64_t*)taos, TSDB_SQL_INSERT, reqid, &pRequest)); + RAW_RETURN_CHECK(buildRequest(*(int64_t*)taos, "", 0, NULL, false, &pRequest, reqid)); uDebug(LOG_ID_TAG " write raw block, rows:%d, pData:%p, tbname:%s", LOG_ID_VALUE, rows, pData, tbname); @@ -1721,7 +1721,7 @@ static int32_t tmqWriteRawDataImpl(TAOS* taos, void* data, int32_t dataLen) { STableMeta* pTableMeta = NULL; SRequestObj* pRequest = NULL; - RAW_RETURN_CHECK(createRequest(*(int64_t*)taos, TSDB_SQL_INSERT, 0, &pRequest)); + RAW_RETURN_CHECK(buildRequest(*(int64_t*)taos, "", 0, NULL, false, &pRequest, 0)); uDebug(LOG_ID_TAG " write raw data, data:%p, dataLen:%d", LOG_ID_VALUE, data, dataLen); pRequest->syncQuery = true; @@ -1869,7 +1869,7 @@ static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, int32_t dataLen) SHashObj* pCreateTbHash = NULL; SRequestObj* pRequest = NULL; - RAW_RETURN_CHECK(createRequest(*(int64_t*)taos, TSDB_SQL_INSERT, 0, &pRequest)); + RAW_RETURN_CHECK(buildRequest(*(int64_t*)taos, "", 0, NULL, false, &pRequest, 0)); uDebug(LOG_ID_TAG " write raw metadata, data:%p, dataLen:%d", LOG_ID_VALUE, data, dataLen); pRequest->syncQuery = true; diff --git a/source/client/src/clientSml.c b/source/client/src/clientSml.c index e8221c8b8d59..90c7895d9401 100644 --- a/source/client/src/clientSml.c +++ b/source/client/src/clientSml.c @@ -1740,7 +1740,7 @@ TAOS_RES *taos_schemaless_insert_inner(TAOS *taos, char *lines[], char *rawLine, SSmlHandle *info = NULL; int cnt = 0; while (1) { - SML_CHECK_CODE(createRequest(*(int64_t *)taos, TSDB_SQL_INSERT, reqid, &request)); + SML_CHECK_CODE(buildRequest(*(int64_t*)taos, "", 0, NULL, false, &request, reqid)); SSmlMsgBuf msg = {request->msgBufLen, request->msgBuf}; request->code = smlBuildSmlInfo(taos, &info); SML_CHECK_CODE(request->code); From 044f6fbcca3f6ccfb02fb7cb4be8b14263e28adc Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Tue, 5 Nov 2024 17:13:16 +0800 Subject: [PATCH 641/695] refactor: always successfully put the retrieve msg even though the input queue is full already. --- source/libs/stream/src/streamQueue.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/source/libs/stream/src/streamQueue.c b/source/libs/stream/src/streamQueue.c index 6af6ebd0441b..bafd35436033 100644 --- a/source/libs/stream/src/streamQueue.c +++ b/source/libs/stream/src/streamQueue.c @@ -304,8 +304,7 @@ int32_t streamTaskPutDataIntoInputQ(SStreamTask* pTask, SStreamQueueItem* pItem) // use the local variable to avoid the pItem be freed by other threads, since it has been put into queue already. stDebug("s-task:%s submit enqueue msgLen:%d ver:%" PRId64 ", total in queue:%d, size:%.2fMiB", pTask->id.idStr, msgLen, ver, total, size + SIZE_IN_MiB(msgLen)); - } else if (type == STREAM_INPUT__DATA_BLOCK || type == STREAM_INPUT__DATA_RETRIEVE || - type == STREAM_INPUT__REF_DATA_BLOCK) { + } else if (type == STREAM_INPUT__DATA_BLOCK || type == STREAM_INPUT__REF_DATA_BLOCK) { if (streamQueueIsFull(pTask->inputq.queue)) { double size = SIZE_IN_MiB(taosQueueMemorySize(pQueue)); @@ -324,7 +323,7 @@ int32_t streamTaskPutDataIntoInputQ(SStreamTask* pTask, SStreamQueueItem* pItem) double size = SIZE_IN_MiB(taosQueueMemorySize(pQueue)); stDebug("s-task:%s blockdata enqueue, total in queue:%d, size:%.2fMiB", pTask->id.idStr, total, size); } else if (type == STREAM_INPUT__CHECKPOINT || type == STREAM_INPUT__CHECKPOINT_TRIGGER || - type == STREAM_INPUT__TRANS_STATE) { + type == STREAM_INPUT__TRANS_STATE || type == STREAM_INPUT__DATA_RETRIEVE) { int32_t code = taosWriteQitem(pQueue, pItem); if (code != TSDB_CODE_SUCCESS) { streamFreeQitem(pItem); From 693aacb8cbeaead3664a02adbe40783b4fb2b252 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Tue, 5 Nov 2024 17:13:16 +0800 Subject: [PATCH 642/695] refactor: always successfully put the retrieve msg even though the input queue is full already. --- source/libs/stream/src/streamQueue.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/source/libs/stream/src/streamQueue.c b/source/libs/stream/src/streamQueue.c index 6af6ebd0441b..bafd35436033 100644 --- a/source/libs/stream/src/streamQueue.c +++ b/source/libs/stream/src/streamQueue.c @@ -304,8 +304,7 @@ int32_t streamTaskPutDataIntoInputQ(SStreamTask* pTask, SStreamQueueItem* pItem) // use the local variable to avoid the pItem be freed by other threads, since it has been put into queue already. stDebug("s-task:%s submit enqueue msgLen:%d ver:%" PRId64 ", total in queue:%d, size:%.2fMiB", pTask->id.idStr, msgLen, ver, total, size + SIZE_IN_MiB(msgLen)); - } else if (type == STREAM_INPUT__DATA_BLOCK || type == STREAM_INPUT__DATA_RETRIEVE || - type == STREAM_INPUT__REF_DATA_BLOCK) { + } else if (type == STREAM_INPUT__DATA_BLOCK || type == STREAM_INPUT__REF_DATA_BLOCK) { if (streamQueueIsFull(pTask->inputq.queue)) { double size = SIZE_IN_MiB(taosQueueMemorySize(pQueue)); @@ -324,7 +323,7 @@ int32_t streamTaskPutDataIntoInputQ(SStreamTask* pTask, SStreamQueueItem* pItem) double size = SIZE_IN_MiB(taosQueueMemorySize(pQueue)); stDebug("s-task:%s blockdata enqueue, total in queue:%d, size:%.2fMiB", pTask->id.idStr, total, size); } else if (type == STREAM_INPUT__CHECKPOINT || type == STREAM_INPUT__CHECKPOINT_TRIGGER || - type == STREAM_INPUT__TRANS_STATE) { + type == STREAM_INPUT__TRANS_STATE || type == STREAM_INPUT__DATA_RETRIEVE) { int32_t code = taosWriteQitem(pQueue, pItem); if (code != TSDB_CODE_SUCCESS) { streamFreeQitem(pItem); From 16570822e8bce1de77b59c0d56318fd309faffac Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Tue, 5 Nov 2024 17:16:20 +0800 Subject: [PATCH 643/695] blob/config: check dnode s3 params --- tests/system-test/2-query/db.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/tests/system-test/2-query/db.py b/tests/system-test/2-query/db.py index d4e5f89aa3a0..ee6b517061fa 100644 --- a/tests/system-test/2-query/db.py +++ b/tests/system-test/2-query/db.py @@ -62,12 +62,30 @@ def case2(self): tdSql.query("show dnode 1 variables like '____debugFlag'") tdSql.checkRows(2) - tdSql.query("show dnode 1 variables like 's3MigrateEna%'") + tdSql.query("show dnode 1 variables like 's3MigrateEnab%'") tdSql.checkRows(1) tdSql.checkData(0, 0, 1) tdSql.checkData(0, 1, 's3MigrateEnabled') tdSql.checkData(0, 2, 0) + tdSql.query("show dnode 1 variables like 's3MigrateIntervalSec%'") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1) + tdSql.checkData(0, 1, 's3MigrateIntervalSec') + tdSql.checkData(0, 2, 3600) + + tdSql.query("show dnode 1 variables like 's3PageCacheSize%'") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1) + tdSql.checkData(0, 1, 's3PageCacheSize') + tdSql.checkData(0, 2, 4096) + + tdSql.query("show dnode 1 variables like 's3UploadDelaySec%'") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1) + tdSql.checkData(0, 1, 's3UploadDelaySec') + tdSql.checkData(0, 2, 60) + def threadTest(self, threadID): print(f"Thread {threadID} starting...") tdsqln = tdCom.newTdSql() From 340a297c50f2eb73529a85a71681a771bf463133 Mon Sep 17 00:00:00 2001 From: xsren <285808407@qq.com> Date: Tue, 5 Nov 2024 17:17:53 +0800 Subject: [PATCH 644/695] fix: assert --- tests/ci/count_assert.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/ci/count_assert.py b/tests/ci/count_assert.py index aecc57578d07..65a3192aba46 100644 --- a/tests/ci/count_assert.py +++ b/tests/ci/count_assert.py @@ -40,6 +40,7 @@ # List of files to exclude exclude_source_files = [ f"{TD_project_path}/community/source/libs/parser/src/sql.c", + f"{TD_project_path}/community/source/libs/parser/inc/sql.c", f"{TD_project_path}/community/source/util/src/tlog.c", f"{TD_project_path}/community/include/util/tlog.h" ] From c54855cdd995da7f6f40936afd9f9e107c0a4d03 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Tue, 5 Nov 2024 17:18:20 +0800 Subject: [PATCH 645/695] fix:[TD-32166] change createRequest to buildRequest to avoid printing error because request not in pRequests hash --- source/client/src/clientRawBlockWrite.c | 84 ++++++++++++------------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/source/client/src/clientRawBlockWrite.c b/source/client/src/clientRawBlockWrite.c index 229e137a21d9..1799f29eb4c7 100644 --- a/source/client/src/clientRawBlockWrite.c +++ b/source/client/src/clientRawBlockWrite.c @@ -163,7 +163,7 @@ static void buildCreateTableJson(SSchemaWrapper* schemaRow, SSchemaWrapper* sche } RAW_FALSE_CHECK(cJSON_AddItemToObject(json, "tags", tags)); - end: +end: *pJson = json; } @@ -197,7 +197,7 @@ static int32_t setCompressOption(cJSON* json, uint32_t para) { return code; } - end: +end: return code; } static void buildAlterSTableJson(void* alterData, int32_t alterDataLen, cJSON** pJson) { @@ -338,7 +338,7 @@ static void buildAlterSTableJson(void* alterData, int32_t alterDataLen, cJSON** break; } - end: +end: tFreeSMAltertbReq(&req); *pJson = json; } @@ -358,7 +358,7 @@ static void processCreateStb(SMqMetaRsp* metaRsp, cJSON** pJson) { } buildCreateTableJson(&req.schemaRow, &req.schemaTag, req.name, req.suid, TSDB_SUPER_TABLE, &req.colCmpr, pJson); - end: +end: uDebug("create stable return"); tDecoderClear(&coder); } @@ -378,7 +378,7 @@ static void processAlterStb(SMqMetaRsp* metaRsp, cJSON** pJson) { } buildAlterSTableJson(req.alterOriData, req.alterOriDataLen, pJson); - end: +end: uDebug("alter stable return"); tDecoderClear(&coder); } @@ -485,7 +485,7 @@ static void buildChildElement(cJSON* json, SVCreateTbReq* pCreateReq) { RAW_FALSE_CHECK(cJSON_AddItemToArray(tags, tag)); } - end: +end: RAW_FALSE_CHECK(cJSON_AddItemToObject(json, "tags", tags)); taosArrayDestroy(pTagVals); } @@ -514,7 +514,7 @@ static void buildCreateCTableJson(SVCreateTbReq* pCreateReq, int32_t nReqs, cJSO } RAW_FALSE_CHECK(cJSON_AddItemToObject(json, "createList", createList)); - end: +end: *pJson = json; } @@ -542,7 +542,7 @@ static void processCreateTable(SMqMetaRsp* metaRsp, cJSON** pJson) { } } - end: +end: uDebug("create table return"); tDeleteSVCreateTbBatchReq(&req); tDecoderClear(&decoder); @@ -585,7 +585,7 @@ static void processAutoCreateTable(SMqDataRsp* rsp, char** string) { *string = cJSON_PrintUnformatted(pJson); cJSON_Delete(pJson); - end: +end: uDebug("auto created table return, sql json:%s", *string); for (int i = 0; decoder && pCreateReq && i < rsp->createTableNum; i++) { tDecoderClear(&decoder[i]); @@ -773,7 +773,7 @@ static void processAlterTable(SMqMetaRsp* metaRsp, cJSON** pJson) { break; } - end: +end: uDebug("alter table return"); tDecoderClear(&decoder); *pJson = json; @@ -808,7 +808,7 @@ static void processDropSTable(SMqMetaRsp* metaRsp, cJSON** pJson) { RAW_NULL_CHECK(tableName); RAW_FALSE_CHECK(cJSON_AddItemToObject(json, "tableName", tableName)); - end: +end: uDebug("processDropSTable return"); tDecoderClear(&decoder); *pJson = json; @@ -844,7 +844,7 @@ static void processDeleteTable(SMqMetaRsp* metaRsp, cJSON** pJson) { RAW_NULL_CHECK(sqlJson); RAW_FALSE_CHECK(cJSON_AddItemToObject(json, "sql", sqlJson)); - end: +end: uDebug("processDeleteTable return"); tDecoderClear(&coder); *pJson = json; @@ -881,7 +881,7 @@ static void processDropTable(SMqMetaRsp* metaRsp, cJSON** pJson) { } RAW_FALSE_CHECK(cJSON_AddItemToObject(json, "tableNameList", tableNameList)); - end: +end: uDebug("processDropTable return"); tDecoderClear(&decoder); *pJson = json; @@ -989,7 +989,7 @@ static int32_t taosCreateStb(TAOS* taos, void* meta, int32_t metaLen) { code = pRequest->code; - end: +end: uDebug(LOG_ID_TAG " create stable return, msg:%s", LOG_ID_VALUE, tstrerror(code)); destroyRequest(pRequest); tFreeSMCreateStbReq(&pReq); @@ -1023,9 +1023,9 @@ static int32_t taosDropStb(TAOS* taos, void* meta, int32_t metaLen) { SCatalog* pCatalog = NULL; RAW_RETURN_CHECK(catalogGetHandle(pRequest->pTscObj->pAppInfo->clusterId, &pCatalog)); SRequestConnInfo conn = {.pTrans = pRequest->pTscObj->pAppInfo->pTransporter, - .requestId = pRequest->requestId, - .requestObjRefId = pRequest->self, - .mgmtEps = getEpSet_s(&pRequest->pTscObj->pAppInfo->mgmtEp)}; + .requestId = pRequest->requestId, + .requestObjRefId = pRequest->self, + .mgmtEps = getEpSet_s(&pRequest->pTscObj->pAppInfo->mgmtEp)}; SName pName = {0}; toName(pRequest->pTscObj->acctId, pRequest->pDb, req.name, &pName); STableMeta* pTableMeta = NULL; @@ -1088,7 +1088,7 @@ static int32_t taosDropStb(TAOS* taos, void* meta, int32_t metaLen) { code = pRequest->code; - end: +end: uDebug(LOG_ID_TAG " drop stable return, msg:%s", LOG_ID_VALUE, tstrerror(code)); destroyRequest(pRequest); tDecoderClear(&coder); @@ -1142,9 +1142,9 @@ static int32_t taosCreateTable(TAOS* taos, void* meta, int32_t metaLen) { taosHashSetFreeFp(pVgroupHashmap, destroyCreateTbReqBatch); SRequestConnInfo conn = {.pTrans = pTscObj->pAppInfo->pTransporter, - .requestId = pRequest->requestId, - .requestObjRefId = pRequest->self, - .mgmtEps = getEpSet_s(&pTscObj->pAppInfo->mgmtEp)}; + .requestId = pRequest->requestId, + .requestObjRefId = pRequest->self, + .mgmtEps = getEpSet_s(&pTscObj->pAppInfo->mgmtEp)}; pRequest->tableList = taosArrayInit(req.nReqs, sizeof(SName)); RAW_NULL_CHECK(pRequest->tableList); @@ -1269,7 +1269,7 @@ static int32_t taosCreateTable(TAOS* taos, void* meta, int32_t metaLen) { code = pRequest->code; - end: +end: uDebug(LOG_ID_TAG " create table return, msg:%s", LOG_ID_VALUE, tstrerror(code)); tDeleteSVCreateTbBatchReq(&req); @@ -1328,9 +1328,9 @@ static int32_t taosDropTable(TAOS* taos, void* meta, int32_t metaLen) { taosHashSetFreeFp(pVgroupHashmap, destroyDropTbReqBatch); SRequestConnInfo conn = {.pTrans = pTscObj->pAppInfo->pTransporter, - .requestId = pRequest->requestId, - .requestObjRefId = pRequest->self, - .mgmtEps = getEpSet_s(&pTscObj->pAppInfo->mgmtEp)}; + .requestId = pRequest->requestId, + .requestObjRefId = pRequest->self, + .mgmtEps = getEpSet_s(&pTscObj->pAppInfo->mgmtEp)}; pRequest->tableList = taosArrayInit(req.nReqs, sizeof(SName)); RAW_NULL_CHECK(pRequest->tableList); // loop to create table @@ -1395,7 +1395,7 @@ static int32_t taosDropTable(TAOS* taos, void* meta, int32_t metaLen) { } code = pRequest->code; - end: +end: uDebug(LOG_ID_TAG " drop table return, msg:%s", LOG_ID_VALUE, tstrerror(code)); taosHashCleanup(pVgroupHashmap); destroyRequest(pRequest); @@ -1433,7 +1433,7 @@ static int32_t taosDeleteData(TAOS* taos, void* meta, int32_t metaLen) { } taos_free_result(res); - end: +end: uDebug("connId:0x%" PRIx64 " delete data sql:%s, code:%s", *(int64_t*)taos, sql, tstrerror(code)); tDecoderClear(&coder); return code; @@ -1473,9 +1473,9 @@ static int32_t taosAlterTable(TAOS* taos, void* meta, int32_t metaLen) { SCatalog* pCatalog = NULL; RAW_RETURN_CHECK(catalogGetHandle(pTscObj->pAppInfo->clusterId, &pCatalog)); SRequestConnInfo conn = {.pTrans = pTscObj->pAppInfo->pTransporter, - .requestId = pRequest->requestId, - .requestObjRefId = pRequest->self, - .mgmtEps = getEpSet_s(&pTscObj->pAppInfo->mgmtEp)}; + .requestId = pRequest->requestId, + .requestObjRefId = pRequest->self, + .mgmtEps = getEpSet_s(&pTscObj->pAppInfo->mgmtEp)}; SVgroupInfo pInfo = {0}; SName pName = {0}; @@ -1543,7 +1543,7 @@ static int32_t taosAlterTable(TAOS* taos, void* meta, int32_t metaLen) { code = handleAlterTbExecRes(pRes->res, pCatalog); } } - end: +end: uDebug(LOG_ID_TAG " alter table return, meta:%p, len:%d, msg:%s", LOG_ID_VALUE, meta, metaLen, tstrerror(code)); taosArrayDestroy(pArray); if (pVgData) taosMemoryFreeClear(pVgData->pData); @@ -1608,7 +1608,7 @@ int taos_write_raw_block_with_fields_with_reqid(TAOS* taos, int rows, char* pDat launchQueryImpl(pRequest, pQuery, true, NULL); code = pRequest->code; - end: +end: uDebug(LOG_ID_TAG " write raw block with field return, msg:%s", LOG_ID_VALUE, tstrerror(code)); taosMemoryFreeClear(pTableMeta); qDestroyQuery(pQuery); @@ -1668,7 +1668,7 @@ int taos_write_raw_block_with_reqid(TAOS* taos, int rows, char* pData, const cha launchQueryImpl(pRequest, pQuery, true, NULL); code = pRequest->code; - end: +end: uDebug(LOG_ID_TAG " write raw block return, msg:%s", LOG_ID_VALUE, tstrerror(code)); taosMemoryFreeClear(pTableMeta); qDestroyQuery(pQuery); @@ -1719,7 +1719,7 @@ static int32_t buildCreateTbMap(SMqDataRsp* rsp, SHashObj* pHashObj) { } return 0; - end: +end: tDecoderClear(&decoderTmp); tDestroySVCreateTbReq(&pCreateReq, TSDB_MSG_FLG_DECODE); return code; @@ -1826,7 +1826,7 @@ static int32_t getRawCache(SHashObj** pVgHash, SHashObj** pNameHash, SHashObj** } return 0; - end: +end: taosHashCleanup(*pMetaHash); taosHashCleanup(*pNameHash); taosHashCleanup(*pVgHash); @@ -1848,7 +1848,7 @@ static int32_t buildRawRequest(TAOS* taos, SRequestObj** pRequest, SCatalog** pC conn->requestObjRefId = (*pRequest)->self; conn->mgmtEps = getEpSet_s(&(*pRequest)->pTscObj->pAppInfo->mgmtEp); - end: +end: return code; } @@ -1925,7 +1925,7 @@ static int32_t processCacheMeta(SHashObj* pVgHash, SHashObj* pNameHash, SHashObj } *pMeta = pTableMeta; - end: +end: return code; } @@ -1993,7 +1993,7 @@ static int32_t tmqWriteRawDataImpl(TAOS* taos, void* data, int32_t dataLen) { break; } - end: +end: uDebug(LOG_ID_TAG " write raw data return, msg:%s", LOG_ID_VALUE, tstrerror(code)); tDeleteMqDataRsp(&rspObj.dataRsp); tDecoderClear(&decoder); @@ -2075,7 +2075,7 @@ static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, int32_t dataLen) break; } - end: +end: uDebug(LOG_ID_TAG " write raw metadata return, msg:%s", LOG_ID_VALUE, tstrerror(code)); tDeleteSTaosxRsp(&rspObj.dataRsp); void* pIter = taosHashIterate(pCreateTbHash, NULL); @@ -2150,7 +2150,7 @@ static void processBatchMetaToJson(SMqBatchMetaRsp* pMsgRsp, char** string) { *string = fullStr; return; - end: +end: cJSON_Delete(pJson); tDeleteMqBatchMetaRsp(&rsp); } @@ -2233,7 +2233,7 @@ static int32_t encodeMqDataRsp(__encode_func__* encodeFunc, SMqDataRsp* rspObj, raw->raw = buf; raw->raw_len = len; return code; - FAILED: +FAILED: tEncoderClear(&encoder); taosMemoryFree(buf); return code; @@ -2377,7 +2377,7 @@ static int32_t tmqWriteBatchMetaDataImpl(TAOS* taos, void* meta, int32_t metaLen } } - end: +end: tDeleteMqBatchMetaRsp(&rsp); return code; } \ No newline at end of file From 48d5f0e7cdc155096876c95331fb177349f17548 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Tue, 5 Nov 2024 18:14:35 +0800 Subject: [PATCH 646/695] fix issue --- source/libs/executor/inc/streamexecutorInt.h | 3 +- source/libs/executor/src/streamfilloperator.c | 23 +- .../src/streamintervalsliceoperator.c | 21 +- .../executor/src/streamtimesliceoperator.c | 7 +- source/libs/function/src/builtinsimpl.c | 4 + source/libs/stream/src/tstreamFileState.c | 2 +- .../8-stream/force_window_close_interp.py | 615 ++++++++++++++++++ 7 files changed, 663 insertions(+), 12 deletions(-) create mode 100644 tests/system-test/8-stream/force_window_close_interp.py diff --git a/source/libs/executor/inc/streamexecutorInt.h b/source/libs/executor/inc/streamexecutorInt.h index 3ebf6726c7eb..27686b0081af 100644 --- a/source/libs/executor/inc/streamexecutorInt.h +++ b/source/libs/executor/inc/streamexecutorInt.h @@ -40,6 +40,8 @@ extern "C" { #define IS_CONTINUE_INTERVAL_OP(op) ((op)->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_CONTINUE_INTERVAL) +#define IS_FILL_CONST_VALUE(type) ((type == TSDB_FILL_NULL || type == TSDB_FILL_NULL_F || type == TSDB_FILL_SET_VALUE || type == TSDB_FILL_SET_VALUE_F)) + typedef struct SSliceRowData { TSKEY key; char pRowVal[]; @@ -101,7 +103,6 @@ int32_t createStreamIntervalSliceOperatorInfo(struct SOperatorInfo* downstream, SExecTaskInfo* pTaskInfo, SReadHandle* pHandle, struct SOperatorInfo** ppOptInfo); int32_t buildAllResultKey(SStreamAggSupporter* pAggSup, TSKEY ts, SArray* pUpdated); -void removeDuplicateTs(SArray* pTsArrray); #ifdef __cplusplus } diff --git a/source/libs/executor/src/streamfilloperator.c b/source/libs/executor/src/streamfilloperator.c index cb330e2e72fe..cd7ab547d468 100644 --- a/source/libs/executor/src/streamfilloperator.c +++ b/source/libs/executor/src/streamfilloperator.c @@ -1263,6 +1263,21 @@ static int32_t doStreamForceFillImpl(SOperatorInfo* pOperator) { for (int32_t i = 0; i < pBlock->info.rows; i++){ code = keepBlockRowInDiscBuf(pOperator, pFillInfo, pBlock, tsCol, i, groupId, pFillSup->rowSize); QUERY_CHECK_CODE(code, lino, _end); + + int32_t size = taosArrayGetSize(pInfo->pCloseTs); + if (size > 0) { + TSKEY* pTs = (TSKEY*) taosArrayGet(pInfo->pCloseTs, 0); + TSKEY resTs = tsCol[i]; + while (resTs < (*pTs)) { + SWinKey key = {.groupId = groupId, .ts = resTs}; + taosArrayPush(pInfo->pUpdated, &key); + if (IS_FILL_CONST_VALUE(pFillSup->type)) { + break; + } + resTs = taosTimeAdd(resTs, pFillSup->interval.sliding, pFillSup->interval.slidingUnit, + pFillSup->interval.precision); + } + } } code = pAggSup->stateStore.streamStateGroupPut(pAggSup->pState, groupId, NULL, 0); QUERY_CHECK_CODE(code, lino, _end); @@ -1302,6 +1317,11 @@ int32_t buildAllResultKey(SStreamAggSupporter* pAggSup, TSKEY ts, SArray* pUpdat return code; } +static void removeDuplicateResult(SArray* pTsArrray, __compar_fn_t fn) { + taosArraySort(pTsArrray, fn); + taosArrayRemoveDuplicate(pTsArrray, fn, NULL); +} + // force window close static int32_t doStreamForceFillNext(SOperatorInfo* pOperator, SSDataBlock** ppRes) { int32_t code = TSDB_CODE_SUCCESS; @@ -1369,14 +1389,13 @@ static int32_t doStreamForceFillNext(SOperatorInfo* pOperator, SSDataBlock** ppR QUERY_CHECK_CODE(code, lino, _end); } - removeDuplicateTs(pInfo->pCloseTs); for (int32_t i = 0; i < taosArrayGetSize(pInfo->pCloseTs); i++) { TSKEY ts = *(TSKEY*) taosArrayGet(pInfo->pCloseTs, i); code = buildAllResultKey(pInfo->pStreamAggSup, ts, pInfo->pUpdated); QUERY_CHECK_CODE(code, lino, _end); } taosArrayClear(pInfo->pCloseTs); - taosArraySort(pInfo->pUpdated, winKeyCmprImpl); + removeDuplicateResult(pInfo->pUpdated, winKeyCmprImpl); initMultiResInfoFromArrayList(&pInfo->groupResInfo, pInfo->pUpdated); pInfo->groupResInfo.freeItem = false; diff --git a/source/libs/executor/src/streamintervalsliceoperator.c b/source/libs/executor/src/streamintervalsliceoperator.c index 1179d8ce0c73..bc35b58a99d1 100644 --- a/source/libs/executor/src/streamintervalsliceoperator.c +++ b/source/libs/executor/src/streamintervalsliceoperator.c @@ -129,7 +129,7 @@ static int32_t getIntervalSliceCurStateBuf(SStreamAggSupporter* pAggSup, SInterv &curVLen, pWinCode); QUERY_CHECK_CODE(code, lino, _end); - qDebug("===stream=== set stream twa next point buf.ts:%" PRId64 ", groupId:%" PRIu64 ", res:%d", + qDebug("===stream=== set stream twa cur point buf.ts:%" PRId64 ", groupId:%" PRIu64 ", res:%d", curKey.ts, curKey.groupId, *pWinCode); initIntervalSlicePoint(pAggSup, pTWin, groupId, pCurPoint); @@ -147,6 +147,8 @@ static int32_t getIntervalSliceCurStateBuf(SStreamAggSupporter* pAggSup, SInterv STimeWindow prevSTW = {.skey = prevKey.ts}; prevSTW.ekey = taosTimeGetIntervalEnd(prevSTW.skey, pInterval); initIntervalSlicePoint(pAggSup, &prevSTW, groupId, pPrevPoint); + qDebug("===stream=== set stream twa prev point buf.ts:%" PRId64 ", groupId:%" PRIu64 ", res:%d", pPrevPoint->winKey.win.skey, + pPrevPoint->winKey.groupId, prevWinCode); } else { SET_WIN_KEY_INVALID(pPrevPoint->winKey.win.skey); SET_WIN_KEY_INVALID(pPrevPoint->winKey.win.ekey); @@ -195,6 +197,16 @@ void doStreamSliceInterpolation(SSliceRowData* pPrevWinVal, TSKEY winKey, TSKEY } } +void doSetElapsedEndKey(TSKEY winKey, SExprSupp* pSup) { + SqlFunctionCtx* pCtx = pSup->pCtx; + for (int32_t k = 0; k < pSup->numOfExprs; ++k) { + if (fmIsElapsedFunc(pCtx[k].functionId)) { + pCtx[k].end.key = winKey; + pCtx[k].end.val = 0; + } + } +} + static void resetIntervalSliceFunctionKey(SqlFunctionCtx* pCtx, int32_t numOfOutput) { for (int32_t k = 0; k < numOfOutput; ++k) { pCtx[k].start.key = INT64_MIN; @@ -265,6 +277,7 @@ static int32_t doStreamIntervalSliceAggImpl(SOperatorInfo* pOperator, SSDataBloc QUERY_CHECK_CODE(code, lino, _end); resetIntervalSliceFunctionKey(pSup->pCtx, numOfOutput); + doSetElapsedEndKey(prevPoint.winKey.win.ekey, &pOperator->exprSupp); doStreamSliceInterpolation(prevPoint.pLastRow, prevPoint.winKey.win.ekey, curTs, pBlock, startPos, &pOperator->exprSupp, INTERVAL_SLICE_END); updateTimeWindowInfo(&pInfo->twAggSup.timeWindowData, &prevPoint.winKey.win, 1); code = applyAggFunctionOnPartialTuples(pTaskInfo, pSup->pCtx, &pInfo->twAggSup.timeWindowData, startPos, @@ -628,9 +641,3 @@ int32_t createStreamIntervalSliceOperatorInfo(SOperatorInfo* downstream, SPhysiN (*ppOptInfo) = NULL; return code; } - -void removeDuplicateTs(SArray* pTsArrray) { - __compar_fn_t fn = getKeyComparFunc(TSDB_DATA_TYPE_TIMESTAMP, TSDB_ORDER_ASC); - taosArraySort(pTsArrray, fn); - taosArrayRemoveDuplicate(pTsArrray, fn, NULL); -} \ No newline at end of file diff --git a/source/libs/executor/src/streamtimesliceoperator.c b/source/libs/executor/src/streamtimesliceoperator.c index ec0c56f74796..b120bb637433 100644 --- a/source/libs/executor/src/streamtimesliceoperator.c +++ b/source/libs/executor/src/streamtimesliceoperator.c @@ -30,7 +30,6 @@ #define STREAM_TIME_SLICE_OP_STATE_NAME "StreamTimeSliceHistoryState" #define STREAM_TIME_SLICE_OP_CHECKPOINT_NAME "StreamTimeSliceOperator_Checkpoint" -#define IS_FILL_CONST_VALUE(type) ((type == TSDB_FILL_NULL || type == TSDB_FILL_NULL_F || type == TSDB_FILL_SET_VALUE || type == TSDB_FILL_SET_VALUE_F)) int32_t saveTimeSliceWinResult(SWinKey* pKey, SSHashObj* pUpdatedMap) { return tSimpleHashPut(pUpdatedMap, pKey, sizeof(SWinKey), NULL, 0); @@ -1743,6 +1742,12 @@ int32_t setAllResultKey(SStreamAggSupporter* pAggSup, TSKEY ts, SSHashObj* pUpda return code; } +static void removeDuplicateTs(SArray* pTsArrray) { + __compar_fn_t fn = getKeyComparFunc(TSDB_DATA_TYPE_TIMESTAMP, TSDB_ORDER_ASC); + taosArraySort(pTsArrray, fn); + taosArrayRemoveDuplicate(pTsArrray, fn, NULL); +} + static int32_t doStreamTimeSliceNext(SOperatorInfo* pOperator, SSDataBlock** ppRes) { int32_t code = TSDB_CODE_SUCCESS; int32_t lino = 0; diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c index 342d40a42436..0aad1501cebb 100644 --- a/source/libs/function/src/builtinsimpl.c +++ b/source/libs/function/src/builtinsimpl.c @@ -4266,6 +4266,10 @@ int32_t elapsedFunction(SqlFunctionCtx* pCtx) { numOfElems = pInput->numOfRows; // since this is the primary timestamp, no need to exclude NULL values if (numOfElems == 0) { + // for stream + if (pCtx->end.key != INT64_MIN) { + pInfo->max = pCtx->end.key + 1; + } goto _elapsed_over; } diff --git a/source/libs/stream/src/tstreamFileState.c b/source/libs/stream/src/tstreamFileState.c index 57094463598b..dc4ca7c0e5e0 100644 --- a/source/libs/stream/src/tstreamFileState.c +++ b/source/libs/stream/src/tstreamFileState.c @@ -1371,7 +1371,7 @@ int32_t getRowStatePrevRow(SStreamFileState* pFileState, const SWinKey* pKey, SW } else { SWinKey* pPrevKey = taosArrayGet(pWinStates, index); *pResKey = *pPrevKey; - return getHashSortRowBuff(pFileState, pResKey, ppVal, pVLen, pWinCode); + return addRowBuffIfNotExist(pFileState, (void*)pPrevKey, sizeof(SWinKey), ppVal, pVLen, pWinCode); } (*pWinCode) = TSDB_CODE_FAILED; diff --git a/tests/system-test/8-stream/force_window_close_interp.py b/tests/system-test/8-stream/force_window_close_interp.py new file mode 100644 index 000000000000..f39ad82ed769 --- /dev/null +++ b/tests/system-test/8-stream/force_window_close_interp.py @@ -0,0 +1,615 @@ +import sys +import threading +from util.log import * +from util.sql import * +from util.cases import * +from util.common import * + + +class TDTestCase: + updatecfgDict = {"debugFlag": 135, "asynclog": 0} + + def init(self, conn, logSql, replicaVar=1): + self.replicaVar = int(replicaVar) + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + self.tdCom = tdCom + + def get_stream_first_ts(self, table_name1, table_name2): + tdSql.query( + f'select * from {table_name1}{table_name2} order by 1 ' + ) + res_ts = tdSql.getData(0, 0) + return res_ts + + def force_window_close( + self, + interval, + partition="tbname", + funciton_name="", + funciton_name_alias="", + delete=False, + fill_value=None, + fill_history_value=None, + case_when=None, + ignore_expired=1, + ignore_update=1, + ): + # partition must be tbname, and not NONE. + tdLog.info( + f"*** testing stream force_window_close+interp+every: every: {interval}, partition: {partition}, fill_history: {fill_history_value}, fill: {fill_value}, delete: {delete}, case_when: {case_when} ***" + ) + self.tdCom.subtable = False + col_value_type = "Incremental" if partition == "c1" else "random" + custom_col_index = 1 if partition == "c1" else None + self.tdCom.custom_col_val = 0 + self.delete = delete + self.tdCom.case_name = sys._getframe().f_code.co_name + self.tdCom.prepare_data( + interval=interval, + fill_history_value=fill_history_value, + custom_col_index=custom_col_index, + col_value_type=col_value_type, + ) + self.stb_name = self.tdCom.stb_name.replace(f"{self.tdCom.dbname}.", "") + self.ctb_name = self.tdCom.ctb_name.replace(f"{self.tdCom.dbname}.", "") + self.tb_name = self.tdCom.tb_name.replace(f"{self.tdCom.dbname}.", "") + self.stb_stream_des_table = f"{self.stb_name}{self.tdCom.des_table_suffix}" + + self.ctb_stream_des_table = f"{self.ctb_name}{self.tdCom.des_table_suffix}" + self.tb_stream_des_table = f"{self.tb_name}{self.tdCom.des_table_suffix}" + if partition == "tbname": + partition_elm_alias = self.tdCom.partition_tbname_alias + + elif partition == "c1": + partition_elm_alias = self.tdCom.partition_col_alias + elif partition == "abs(c1)": + partition_elm_alias = self.tdCom.partition_expression_alias + elif partition is None: + partition_elm_alias = '"no_partition"' + else: + partition_elm_alias = self.tdCom.partition_tag_alias + + if partition: + partition_elm = f"partition by {partition} {partition_elm_alias}" + else: + partition_elm = "" + if fill_value: + if "value" in fill_value.lower(): + fill_value = "VALUE,1" + + # create error stream + tdLog.info("create error stream") + sleep(10) + tdSql.error( + f"create stream itp_force_error_1 trigger force_window_close IGNORE EXPIRED 1 IGNORE UPDATE 0 into itp_force_error_1 as select _irowts,tbname,_isfilled,interp(c1,1) from {self.stb_name} partition by tbname every(5s) fill(prev) ;" + ) + tdSql.error( + f"create stream itp_force_error_1 trigger force_window_close IGNORE EXPIRED 0 IGNORE UPDATE 1 into itp_force_error_1 as select _irowts,tbname,_isfilled,interp(c1,1) from {self.stb_name} partition by tbname every(5s) fill(prev) ;" + ) + tdSql.error( + f"create stream itp_force_error_1 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 1 into itp_force_error_1 as select _irowts,tbname,_isfilled,interp(c1,1) from {self.stb_name} partition by tbname every(5s) fill(prev) ;" + ) + tdSql.error( + f"create stream itp_force_error_1 trigger force_window_close IGNORE EXPIRED 1 IGNORE UPDATE 0 into itp_force_error_1 as select _irowts,tbname,_isfilled,interp(c11,1) from {self.stb_name} partition by tbname every(5s) fill(prev) ;" + ) + + # function name : interp + trigger_mode = "force_window_close" + + # # subtable is true + # create stream add :subtable_value=stb_subtable_value or subtable_value=ctb_subtable_value + + # no subtable + # create stream super table and child table + tdLog.info("create stream super table and child table") + self.tdCom.create_stream( + stream_name=f"{self.stb_name}{self.tdCom.stream_suffix}", + des_table=self.stb_stream_des_table, + source_sql=f'select _irowts as irowts,tbname as table_name, _isfilled as isfilled, {funciton_name} as {funciton_name_alias} from {self.stb_name} {partition_elm} every({self.tdCom.dataDict["interval"]}s)', + trigger_mode=trigger_mode, + fill_value=fill_value, + fill_history_value=fill_history_value, + ignore_expired=ignore_expired, + ignore_update=ignore_update, + ) + self.tdCom.create_stream( + stream_name=f"{self.ctb_name}{self.tdCom.stream_suffix}", + des_table=self.ctb_stream_des_table, + source_sql=f'select _irowts as irowts, tbname as table_name, _isfilled as isfilled, {funciton_name} as {funciton_name_alias} from {self.ctb_name} {partition_elm} every({self.tdCom.dataDict["interval"]}s)', + trigger_mode=trigger_mode, + fill_value=fill_value, + fill_history_value=fill_history_value, + ignore_expired=ignore_expired, + ignore_update=ignore_update, + ) + + # creat stream set filter of tag and tbname + tdLog.info("create stream with tag and tbname filter") + tag_t1_value = self.tdCom.tag_value_list[0] + where_tag = f"where t1 = {tag_t1_value}" + where_tbname = f'where tbname="{self.ctb_name}"' + # print(f"tag: {tag_t1_value}") + + self.stb_stream_des_where_tag_table = ( + f"{self.stb_name}_where_tag{self.tdCom.des_table_suffix}" + ) + self.tdCom.create_stream( + stream_name=f"{self.stb_name}_where_tag{self.tdCom.stream_suffix}", + des_table=self.stb_stream_des_where_tag_table, + source_sql=f'select _irowts as irowts,tbname as table_name, _isfilled as isfilled, {funciton_name} as {funciton_name_alias} from {self.stb_name} {where_tag} {partition_elm} every({self.tdCom.dataDict["interval"]}s)', + trigger_mode=trigger_mode, + fill_value=fill_value, + fill_history_value=fill_history_value, + ignore_expired=ignore_expired, + ignore_update=ignore_update, + ) + self.stb_stream_des_where_tbname_table = ( + f"{self.stb_name}_where_tbname{self.tdCom.des_table_suffix}" + ) + self.tdCom.create_stream( + stream_name=f"{self.stb_name}_where_tbname{self.tdCom.stream_suffix}", + des_table=self.stb_stream_des_where_tbname_table, + source_sql=f'select _irowts as irowts,tbname as table_name, _isfilled as isfilled, {funciton_name} as {funciton_name_alias} from {self.stb_name} {where_tbname} {partition_elm} every({self.tdCom.dataDict["interval"]}s)', + trigger_mode=trigger_mode, + fill_value=fill_value, + fill_history_value=fill_history_value, + ignore_expired=ignore_expired, + ignore_update=ignore_update, + ) + + # set partition by tag and column + self.stb_stream_des_partition_tag_table = ( + f"{self.stb_name}_partition_tag{self.tdCom.des_table_suffix}" + ) + self.stb_stream_des_partition_column1_table = ( + f"{self.stb_name}_partition_column1{self.tdCom.des_table_suffix}" + ) + self.stb_stream_des_partition_column2_table = ( + f"{self.stb_name}_partition_column2{self.tdCom.des_table_suffix}" + ) + if partition: + tdLog.info("create stream with partition by tag and tbname ") + partition_elm_new = f"partition by {partition}, t1" + self.tdCom.create_stream( + stream_name=f"{self.stb_name}_partition_tag{self.tdCom.stream_suffix}", + des_table=self.stb_stream_des_partition_tag_table, + source_sql=f'select _irowts as irowts, tbname as table_name, t1 as t_t1, _isfilled as isfilled, {funciton_name} as {funciton_name_alias} from {self.stb_name} {partition_elm_new} every({self.tdCom.dataDict["interval"]}s)', + trigger_mode=trigger_mode, + fill_value=fill_value, + fill_history_value=fill_history_value, + ignore_expired=ignore_expired, + ignore_update=ignore_update, + ) + partition_elm_new = f"partition by {partition}, c1" + self.tdCom.create_stream( + stream_name=f"{self.stb_name}_partition_column1{self.tdCom.stream_suffix}", + des_table=f"{self.stb_name}_partition_column1{self.tdCom.des_table_suffix}", + source_sql=f'select _irowts as irowts, tbname as table_name, c1 as c_c1, _isfilled as isfilled, {funciton_name} as {funciton_name_alias} from {self.stb_name} {partition_elm_new} every({self.tdCom.dataDict["interval"]}s)', + trigger_mode=trigger_mode, + fill_value=fill_value, + fill_history_value=fill_history_value, + ignore_expired=ignore_expired, + ignore_update=ignore_update, + ) + partition_elm_new = f"partition by {partition}, c2" + self.tdCom.create_stream( + stream_name=f"{self.stb_name}_partition_column2{self.tdCom.stream_suffix}", + des_table=f"{self.stb_name}_partition_column2{self.tdCom.des_table_suffix}", + source_sql=f'select _irowts as irowts, tbname as table_name, c2 as c_c2, _isfilled as isfilled, {funciton_name} as {funciton_name_alias} from {self.stb_name} {partition_elm_new} every({self.tdCom.dataDict["interval"]}s)', + trigger_mode=trigger_mode, + fill_value=fill_value, + fill_history_value=fill_history_value, + ignore_expired=ignore_expired, + ignore_update=ignore_update, + ) + + if fill_value: + if "value" in fill_value.lower(): + fill_value = "VALUE,1" + + # create stream general table + tdLog.info("create stream general table") + self.tdCom.create_stream( + stream_name=f"{self.tb_name}{self.tdCom.stream_suffix}", + des_table=self.tb_stream_des_table, + source_sql=f'select _irowts as irowts,tbname as table_name, _isfilled as isfilled, {funciton_name} as {funciton_name_alias} from {self.tb_name} every({self.tdCom.dataDict["interval"]}s)', + trigger_mode=trigger_mode, + fill_value=fill_value, + fill_history_value=fill_history_value, + ignore_expired=ignore_expired, + ignore_update=ignore_update, + ) + + # wait and check stream_task status is ready + time.sleep(self.tdCom.dataDict["interval"]) + tdSql.query("show streams") + tdLog.info(f"tdSql.queryResult:{tdSql.queryResult},tdSql.queryRows:{tdSql.queryRows}") + localQueryResult = tdSql.queryResult + for stream_number in range(tdSql.queryRows): + stream_name = localQueryResult[stream_number][0] + tdCom.check_stream_task_status( + stream_name=stream_name, vgroups=2, stream_timeout=20,check_wal_info=False + ) + time.sleep(self.tdCom.dataDict["interval"]) + time.sleep(30) + + # insert data + self.tdCom.date_time = self.tdCom.genTs(precision=self.tdCom.precision)[0] + start_time = self.tdCom.date_time + time.sleep(1) + tdSql.query("select 1;") + start_force_ts = str(0) + for i in range(self.tdCom.range_count): + cur_time = str(self.tdCom.date_time + self.tdCom.dataDict["interval"]) + ts_value = ( + cur_time + f"+{i*10 + 30}s" + ) + # print(ts_value) + if start_force_ts == "0": + start_force_ts = cur_time + ts_cast_delete_value = self.tdCom.time_cast(ts_value) + self.tdCom.sinsert_rows( + tbname=self.tdCom.ctb_name, + ts_value=ts_value, + custom_col_index=custom_col_index, + col_value_type=col_value_type, + ) + if i % 2 == 0: + self.tdCom.sinsert_rows( + tbname=self.tdCom.ctb_name, + ts_value=ts_value, + custom_col_index=custom_col_index, + col_value_type=col_value_type, + ) + if self.delete and i % 2 != 0: + self.tdCom.sdelete_rows( + tbname=self.tdCom.ctb_name, start_ts=ts_cast_delete_value + ) + self.tdCom.date_time += 1 + self.tdCom.sinsert_rows( + tbname=self.tdCom.tb_name, + ts_value=ts_value, + custom_col_index=custom_col_index, + col_value_type=col_value_type, + ) + if i % 2 == 0: + self.tdCom.sinsert_rows( + tbname=self.tdCom.tb_name, + ts_value=ts_value, + custom_col_index=custom_col_index, + col_value_type=col_value_type, + ) + if self.delete and i % 2 != 0: + self.tdCom.sdelete_rows( + tbname=self.tdCom.tb_name, start_ts=ts_cast_delete_value + ) + self.tdCom.date_time += 1 + + if self.tdCom.subtable: + for tname in [self.stb_name, self.ctb_name]: + group_id = self.tdCom.get_group_id_from_stb(f"{tname}_output") + tdSql.query(f"select * from {self.ctb_name}") + ptn_counter = 0 + for c1_value in tdSql.queryResult: + if partition == "c1": + tbname = self.tdCom.get_subtable_wait( + f"{tname}_{self.tdCom.subtable_prefix}{abs(c1_value[1])}{self.tdCom.subtable_suffix}" + ) + tdSql.query(f"select count(*) from `{tbname}`") + elif partition is None: + tbname = self.tdCom.get_subtable_wait( + f"{tname}_{self.tdCom.subtable_prefix}no_partition{self.tdCom.subtable_suffix}" + ) + tdSql.query(f"select count(*) from `{tbname}`") + elif partition == "abs(c1)": + abs_c1_value = abs(c1_value[1]) + tbname = self.tdCom.get_subtable_wait( + f"{tname}_{self.tdCom.subtable_prefix}{abs_c1_value}{self.tdCom.subtable_suffix}" + ) + tdSql.query(f"select count(*) from `{tbname}`") + elif partition == "tbname" and ptn_counter == 0: + tbname = self.tdCom.get_subtable_wait( + f"{tname}_{self.tdCom.subtable_prefix}{self.ctb_name}{self.tdCom.subtable_suffix}_{tname}_output_{group_id}" + ) + tdSql.query(f"select count(*) from `{tbname}`") + ptn_counter += 1 + tdSql.checkEqual(tdSql.queryResult[0][0] > 0, True) + group_id = self.tdCom.get_group_id_from_stb(f"{self.tb_name}_output") + tdSql.query(f"select * from {self.tb_name}") + ptn_counter = 0 + for c1_value in tdSql.queryResult: + if partition == "c1": + tbname = self.tdCom.get_subtable_wait( + f"{self.tb_name}_{self.tdCom.subtable_prefix}{abs(c1_value[1])}{self.tdCom.subtable_suffix}" + ) + tdSql.query(f"select count(*) from `{tbname}`") + elif partition is None: + tbname = self.tdCom.get_subtable_wait( + f"{self.tb_name}_{self.tdCom.subtable_prefix}no_partition{self.tdCom.subtable_suffix}" + ) + tdSql.query(f"select count(*) from `{tbname}`") + elif partition == "abs(c1)": + abs_c1_value = abs(c1_value[1]) + tbname = self.tdCom.get_subtable_wait( + f"{self.tb_name}_{self.tdCom.subtable_prefix}{abs_c1_value}{self.tdCom.subtable_suffix}" + ) + tdSql.query(f"select count(*) from `{tbname}`") + elif partition == "tbname" and ptn_counter == 0: + tbname = self.tdCom.get_subtable_wait( + f"{self.tb_name}_{self.tdCom.subtable_prefix}{self.tb_name}{self.tdCom.subtable_suffix}_{self.tb_name}_output_{group_id}" + ) + tdSql.query(f"select count(*) from `{tbname}`") + ptn_counter += 1 + + tdSql.checkEqual(tdSql.queryResult[0][0] > 0, True) + if fill_value: + end_date_time = self.tdCom.date_time + final_range_count = self.tdCom.range_count + history_ts = ( + str(start_time) + + f'-{self.tdCom.dataDict["interval"]*(final_range_count+2)}s' + ) + start_ts = self.tdCom.time_cast(history_ts, "-") + future_ts = ( + str(end_date_time) + + f'+{self.tdCom.dataDict["interval"]*(final_range_count+2)}s' + ) + end_ts = self.tdCom.time_cast(future_ts) + tdSql.query("select 2;") + self.tdCom.sinsert_rows(tbname=self.ctb_name, ts_value=history_ts) + self.tdCom.sinsert_rows(tbname=self.tb_name, ts_value=history_ts) + self.tdCom.sinsert_rows(tbname=self.ctb_name, ts_value=future_ts) + self.tdCom.sinsert_rows(tbname=self.tb_name, ts_value=future_ts) + self.tdCom.date_time = start_time + # update + history_ts = ( + str(start_time) + + f'-{self.tdCom.dataDict["interval"]*(final_range_count+2)}s' + ) + start_ts = self.tdCom.time_cast(history_ts, "-") + future_ts = ( + str(end_date_time) + + f'+{self.tdCom.dataDict["interval"]*(final_range_count+2)}s' + ) + end_ts = self.tdCom.time_cast(future_ts) + tdSql.query("select 3;") + self.tdCom.sinsert_rows(tbname=self.ctb_name, ts_value=history_ts) + self.tdCom.sinsert_rows(tbname=self.tb_name, ts_value=history_ts) + self.tdCom.sinsert_rows(tbname=self.ctb_name, ts_value=future_ts) + self.tdCom.sinsert_rows(tbname=self.tb_name, ts_value=future_ts) + + # get query time range using interval count windows + tdSql.query( + f'select _wstart, _wend ,last(ts) from {self.stb_name} where ts >= {start_force_ts} and ts <= {end_ts} partition by tbname interval({self.tdCom.dataDict["interval"]}s)fill ({fill_value}) ' + ) + # getData don't support negative index + end_new_ts = tdSql.getData(tdSql.queryRows - 1, 1) + end_last_but_one_ts = tdSql.getData(tdSql.queryRows - 2, 1) + # source data include that fill valuse is null and "_isfilled" column of the stream output is false + tdSql.execute( + f'insert into {self.ctb_name} (ts,c1) values("{end_new_ts}",-102) ' + ) + tdSql.execute( + f'insert into {self.tb_name} (ts,c1) values("{end_new_ts}",-51) ' + ) + tdSql.execute( + f'insert into {self.ctb_name} (ts,c1) values("{end_last_but_one_ts}",NULL) ' + ) + + tdSql.query("select 4;") + for i in range(self.tdCom.range_count): + ts_value = ( + str(self.tdCom.date_time + self.tdCom.dataDict["interval"]) + + f"+{i*10+30}s" + ) + ts_cast_delete_value = self.tdCom.time_cast(ts_value) + self.tdCom.sinsert_rows(tbname=self.ctb_name, ts_value=ts_value) + self.tdCom.date_time += 1 + self.tdCom.sinsert_rows(tbname=self.tb_name, ts_value=ts_value) + self.tdCom.date_time += 1 + if self.delete: + self.tdCom.sdelete_rows( + tbname=self.ctb_name, + start_ts=self.tdCom.time_cast(start_time), + end_ts=ts_cast_delete_value, + ) + self.tdCom.sdelete_rows( + tbname=self.tb_name, + start_ts=self.tdCom.time_cast(start_time), + end_ts=ts_cast_delete_value, + ) + + # wait for the stream to process the data + # print(self.tdCom.dataDict["interval"]*(final_range_count+2)) + time.sleep(self.tdCom.dataDict["interval"] * (final_range_count + 2)) + + # check the data + for tbname in [self.stb_name, self.ctb_name, self.tb_name]: + tdLog.info(f"tbname:{tbname}") + tdSql.query( + f'select _wstart, _wend ,last(ts) from {tbname} where ts >= {start_force_ts} and ts <= {end_ts} partition by tbname interval({self.tdCom.dataDict["interval"]}s)fill ({fill_value}) ' + ) + start_new_ts = tdSql.getData(0, 1) + ragne_start_ts = start_new_ts + if tbname == self.ctb_name: + if partition == "tbname": + # check data for child table + tdLog.info("check data for child table ") + if fill_value != "PREV": + ragne_start_ts = self.get_stream_first_ts(tbname, self.tdCom.des_table_suffix) + self.tdCom.check_query_data( + f'select irowts, table_name, isfilled, {funciton_name_alias} from {tbname}{self.tdCom.des_table_suffix} where irowts >= {start_force_ts} and irowts <= "{end_new_ts}" order by irowts', + f'select _irowts as irowts ,tb1 as table_name, _isfilled as isfilled , {funciton_name} as {funciton_name_alias} from ( select *, tbname as tb1 from {tbname} where ts >= {start_force_ts} ) partition by tb1 range("{ragne_start_ts}","{end_new_ts}") every({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by irowts', + fill_value=fill_value, + ) + elif tbname == self.stb_name: + if partition == "tbname": + # check data for super table + tdLog.info("check data for super table") + if fill_value != "PREV": + ragne_start_ts = self.get_stream_first_ts(tbname, self.tdCom.des_table_suffix) + self.tdCom.check_query_data( + f'select irowts, table_name, isfilled, {funciton_name_alias} from {tbname}{self.tdCom.des_table_suffix} where irowts >= {start_force_ts} and irowts <= "{end_new_ts}" order by irowts', + f'select _irowts as irowts ,tbname as table_name, _isfilled as isfilled , {funciton_name} as {funciton_name_alias} from {tbname} where ts >= {start_force_ts} partition by {partition} range("{ragne_start_ts}","{end_new_ts}") every({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by irowts', + fill_value=fill_value, + ) + # tag and tbname filter + tdLog.info("check data for tag and tbname filter") + if fill_value != "PREV": + ragne_start_ts = self.get_stream_first_ts(self.stb_stream_des_where_tag_table, '') + self.tdCom.check_query_data( + f'select irowts, table_name, isfilled, {funciton_name_alias} from {self.stb_stream_des_where_tag_table} where irowts >= {start_force_ts} and irowts <= "{end_new_ts}" order by irowts', + f'select _irowts as irowts ,tbname as table_name, _isfilled as isfilled , {funciton_name} as {funciton_name_alias} from {tbname} {where_tag} and ts >= {start_force_ts} partition by {partition} range("{ragne_start_ts}","{end_new_ts}") every({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by irowts', + fill_value=fill_value, + ) + if fill_value != "PREV": + ragne_start_ts = self.get_stream_first_ts(self.stb_stream_des_where_tbname_table, '') + self.tdCom.check_query_data( + f'select irowts, table_name, isfilled, {funciton_name_alias} from {self.stb_stream_des_where_tbname_table} where irowts >= {start_force_ts} and irowts <= "{end_new_ts}" order by irowts', + f'select _irowts as irowts ,tb1 as table_name, _isfilled as isfilled , {funciton_name} as {funciton_name_alias} from ( select *, tbname as tb1 from {tbname} {where_tbname} and ts >= {start_force_ts} ) partition by tb1 range("{ragne_start_ts}","{end_new_ts}") every({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by irowts', + fill_value=fill_value, + ) + # check partition by tag and column(c1 or c2) + tdLog.info("check data for partition by tag and column") + if fill_value != "PREV": + ragne_start_ts = self.get_stream_first_ts(self.stb_stream_des_partition_tag_table, '') + self.tdCom.check_query_data( + f'select irowts, table_name, t_t1, isfilled, {funciton_name_alias} from {self.stb_stream_des_partition_tag_table} where irowts >= {start_force_ts} and irowts <= "{end_new_ts}" order by t_t1, irowts', + f'select _irowts as irowts ,tb1 as table_name, t1 as t_t1, _isfilled as isfilled , {funciton_name} as {funciton_name_alias} from ( select *, tbname as tb1 from {tbname} {where_tbname} and ts >= {start_force_ts} ) partition by tb1,t1 range("{ragne_start_ts}","{end_new_ts}") every({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by t_t1, irowts', + fill_value=fill_value, + ) + if fill_value == "PREV": + self.tdCom.check_query_data( + f'select irowts, c_c1, isfilled, {funciton_name_alias} from {self.stb_stream_des_partition_column1_table} where irowts >= {start_force_ts} and irowts <= "{end_new_ts}" order by c_c1, irowts', + f'select _irowts as irowts , c1 as c_c1, _isfilled as isfilled , {funciton_name} as {funciton_name_alias} from {tbname} {where_tbname} and ts >= {start_force_ts} partition by {partition},c1 range("{start_new_ts}","{end_new_ts}") every({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by c_c1, irowts', + fill_value=fill_value, + ) + self.tdCom.check_query_data( + f'select irowts, c_c2, isfilled, {funciton_name_alias} from {self.stb_stream_des_partition_column2_table} where irowts >= {start_force_ts} and irowts <= "{end_new_ts}" order by c_c2, irowts', + f'select _irowts as irowts , c2 as c_c2, _isfilled as isfilled , {funciton_name} as {funciton_name_alias} from {tbname} {where_tbname} and ts >= {start_force_ts} partition by {partition},c2 range("{start_new_ts}","{end_new_ts}") every({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by c_c2, irowts', + fill_value=fill_value, + ) + else: + if partition == "tbname": + # check data for general table + if fill_value != "PREV": + ragne_start_ts = self.get_stream_first_ts(self.stb_stream_des_partition_tag_table, '') + self.tdCom.check_query_data( + f'select irowts, isfilled, {funciton_name_alias} from {tbname}{self.tdCom.des_table_suffix} where irowts >= {start_force_ts} and irowts <= "{end_new_ts}" order by irowts', + f'select _irowts as irowts , _isfilled as isfilled , {funciton_name} as {funciton_name_alias} from ( select *, tbname as tb1 from {tbname} where ts >= {start_force_ts} ) partition by tb1 range("{ragne_start_ts}","{end_new_ts}") every({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by irowts', + fill_value=fill_value, + ) + + # Recreate a sub-table that meets the filtering "where_tag" and check if the streaming results are automatically included within it." + where_tag_ctbname = f"{self.ctb_name}_where_tag" + where_tag_ctbname_other_tag = f"{self.ctb_name}_where_tag_1" + tag_t1_value_other = abs(tag_t1_value)-1 + tdSql.execute( + f"create table {where_tag_ctbname} using {self.stb_name} (t1) tags({tag_t1_value}) " + ) + tdSql.execute( + f"create table {where_tag_ctbname_other_tag} using {self.stb_name} (t1) tags({tag_t1_value_other}) " + ) + where_tag_timestamp = self.tdCom.genTs(precision=self.tdCom.precision)[0] + where_tag_ts_start_value = str(where_tag_timestamp) + "+2s" + tdSql.query("select 5;") + self.tdCom.sinsert_rows( + tbname=where_tag_ctbname, ts_value=where_tag_ts_start_value + ) + self.tdCom.sinsert_rows( + tbname=where_tag_ctbname_other_tag, ts_value=where_tag_ts_start_value + ) + time.sleep(self.tdCom.dataDict["interval"]) + for _ in range(self.tdCom.dataDict["interval"]): + tdSql.query( + f"select distinct(table_name) from {self.stb_stream_des_where_tag_table} where table_name=\"{where_tag_ctbname}\"" + ) + if tdSql.queryRows > 0: + if tdSql.checkDataNotExit(0,0, where_tag_ctbname): + break + else: + time.sleep(1) + + if self.delete: + self.tdCom.sdelete_rows( + tbname=self.ctb_name, start_ts=start_ts, end_ts=ts_cast_delete_value + ) + self.tdCom.sdelete_rows( + tbname=self.tb_name, start_ts=start_ts, end_ts=ts_cast_delete_value + ) + for tbname in [self.stb_name, self.ctb_name, self.tb_name]: + if tbname != self.tb_name: + if "value" in fill_value.lower(): + fill_value = ( + "VALUE,1,2,3,6,7,8,9,10,11,1,2,3,4,5,6,7,8,9,10,11" + ) + if partition == "tbname": + self.tdCom.check_query_data( + f"select wstart, {self.tdCom.fill_stb_output_select_str} from {tbname}{self.tdCom.des_table_suffix} order by wstart", + f'select _wstart AS wstart, {self.tdCom.fill_stb_source_select_str} from {tbname} where ts >= {start_ts.replace("-", "+")} and ts <= {end_ts} partition by {partition} interval({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by wstart', + fill_value=fill_value, + ) + else: + self.tdCom.check_query_data( + f"select wstart, {self.tdCom.fill_stb_output_select_str} from {tbname}{self.tdCom.des_table_suffix} order by wstart,`min(c1)`", + f'select * from (select _wstart AS wstart, {self.tdCom.fill_stb_source_select_str} from {tbname} where ts >= {start_ts} and ts <= {end_ts} partition by {partition} interval({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by wstart) where `min(c1)` is not Null order by wstart,`min(c1)`', + fill_value=fill_value, + ) + + else: + if "value" in fill_value.lower(): + fill_value = "VALUE,1,2,3,6,7,8,9,10,11" + if partition == "tbname": + self.tdCom.check_query_data( + f"select wstart, {self.tdCom.fill_tb_output_select_str} from {tbname}{self.tdCom.des_table_suffix} order by wstart", + f'select _wstart AS wstart, {self.tdCom.fill_tb_source_select_str} from {tbname} where ts >= {start_ts.replace("-", "+")} and ts <= {end_ts} partition by {partition} interval({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by wstart', + fill_value=fill_value, + ) + else: + self.tdCom.check_query_data( + f"select wstart, {self.tdCom.fill_tb_output_select_str} from {tbname}{self.tdCom.des_table_suffix} order by wstart,`min(c1)`", + f'select * from (select _wstart AS wstart, {self.tdCom.fill_tb_source_select_str} from {tbname} where ts >= {start_ts} and ts <= {end_ts} partition by {partition} interval({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by wstart) where `min(c1)` is not Null order by wstart,`min(c1)`', + fill_value=fill_value, + ) + + def run(self): + for fill_value in ["PREV", "VALUE","NULL"]: + self.force_window_close( + interval=10, + partition="tbname", + funciton_name="interp(c1)", + funciton_name_alias="intp_c1", + delete=False, + ignore_update=1, + fill_value=fill_value, + ) + self.force_window_close( + interval=8, + partition="tbname", + funciton_name="interp(c1)", + funciton_name_alias="intp_c1", + delete=False, + ignore_update=1, + fill_value="PREV", + ) + # self.force_window_close(interval=random.randint(10, 15), partition="c1", ignore_update=1) + # self.force_window_close(interval=random.randint(10, 15), partition="abs(c1)", ignore_update=1) + # self.force_window_close(interval=random.randint(10, 15), partition=None, delete=True) + # self.force_window_close(interval=random.randint(10, 15), partition=self.tdCom.stream_case_when_tbname, case_when=f'case when {self.tdCom.stream_case_when_tbname} = tbname then {self.tdCom.partition_tbname_alias} else tbname end') + # self.force_window_close(interval=random.randint(10, 15), partition="tbname", fill_history_value=1, fill_value="NULL") + # for fill_value in ["NULL", "PREV", "NEXT", "LINEAR", "VALUE,1,2,3,4,5,6,7,8,9,10,11,1,2,3,4,5,6,7,8,9,10,11"]: + # # for fill_value in ["PREV", "NEXT", "LINEAR", "VALUE,1,2,3,4,5,6,7,8,9,10,11,1,2,3,4,5,6,7,8,9,10,11"]: + # self.at_once_interval(interval=random.randint(10, 15), partition="tbname", fill_value=fill_value) + # self.at_once_interval(interval=random.randint(10, 15), partition="tbname", fill_value=fill_value, delete=True) + + def stop(self): + tdSql.close() + tdLog.success(f"{__file__} successfully executed") + + +event = threading.Event() + + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) From 082c6b1c509351e7b96c196526d4f0f303bd12e2 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Tue, 5 Nov 2024 18:17:41 +0800 Subject: [PATCH 647/695] enh: compatible with taosanode --- packaging/tools/install.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packaging/tools/install.sh b/packaging/tools/install.sh index 8a6b159a22c1..a6fd69d16fb2 100755 --- a/packaging/tools/install.sh +++ b/packaging/tools/install.sh @@ -185,7 +185,14 @@ function kill_process() { function install_main_path() { #create install main dir and all sub dir - ${csudo}rm -rf ${install_main_dir} || : + ${csudo}rm -rf ${install_main_dir}/cfg || : + ${csudo}rm -rf ${install_main_dir}/bin || : + ${csudo}rm -rf ${install_main_dir}/driver || : + ${csudo}rm -rf ${install_main_dir}/examples || : + ${csudo}rm -rf ${install_main_dir}/include || : + ${csudo}rm -rf ${install_main_dir}/share || : + ${csudo}rm -rf ${install_main_dir}/log || : + ${csudo}mkdir -p ${install_main_dir} ${csudo}mkdir -p ${install_main_dir}/cfg ${csudo}mkdir -p ${install_main_dir}/bin From 9b6f855acf87f3bdd51e97f0a552cf8177d6f218 Mon Sep 17 00:00:00 2001 From: xsren <285808407@qq.com> Date: Tue, 5 Nov 2024 19:20:09 +0800 Subject: [PATCH 648/695] enh: lemon on windows --- cmake/lemon_CMakeLists.txt.in | 3 +- contrib/CMakeLists.txt | 2 +- contrib/lemon/lemon.c | 6038 +++++++++++++++++++++++++++++ contrib/lemon/lempar.c | 1086 ++++++ source/libs/parser/CMakeLists.txt | 2 +- 5 files changed, 7127 insertions(+), 4 deletions(-) create mode 100644 contrib/lemon/lemon.c create mode 100644 contrib/lemon/lempar.c diff --git a/cmake/lemon_CMakeLists.txt.in b/cmake/lemon_CMakeLists.txt.in index 08295adb26b0..58da7206307b 100644 --- a/cmake/lemon_CMakeLists.txt.in +++ b/cmake/lemon_CMakeLists.txt.in @@ -2,9 +2,8 @@ ExternalProject_Add( lemon - URL https://www.sqlite.org/src/tarball/sqlite.tar.gz?r=release CONFIGURE_COMMAND "" - BUILD_COMMAND ${C_COMPILER_LEMON} -o ${TD_CONTRIB_DIR}/deps-download/lemon-prefix/src/lemon/tool/lemon ${TD_CONTRIB_DIR}/deps-download/lemon-prefix/src/lemon/tool/lemon.c + BUILD_COMMAND "${C_COMPILER_LEMON}" -o ${TD_CONTRIB_DIR}/lemon/lemon ${TD_CONTRIB_DIR}/lemon/lemon.c INSTALL_COMMAND "" BUILD_IN_SOURCE 1 BUILD_ALWAYS 1 diff --git a/contrib/CMakeLists.txt b/contrib/CMakeLists.txt index 0899e5d02fe2..1bcc87bc6833 100644 --- a/contrib/CMakeLists.txt +++ b/contrib/CMakeLists.txt @@ -188,7 +188,7 @@ find_program(C_COMPILER_LEMON NAMES gcc) if(C_COMPILER_LEMON) message(STATUS "LEMON C compiler: ${C_COMPILER_LEMON}") else() - set(C_COMPILER_LEMON CMAKE_C_COMPILER) + set(C_COMPILER_LEMON ${CMAKE_C_COMPILER}) message(STATUS "LEMON C compiler: ${C_COMPILER_LEMON}") endif() diff --git a/contrib/lemon/lemon.c b/contrib/lemon/lemon.c new file mode 100644 index 000000000000..d92df2a1a7b9 --- /dev/null +++ b/contrib/lemon/lemon.c @@ -0,0 +1,6038 @@ +/* +** This file contains all sources (including headers) to the LEMON +** LALR(1) parser generator. The sources have been combined into a +** single file to make it easy to include LEMON in the source tree +** and Makefile of another program. +** +** The author of this program disclaims copyright. +*/ +#include +#include +#include +#include +#include +#include + +#define ISSPACE(X) isspace((unsigned char)(X)) +#define ISDIGIT(X) isdigit((unsigned char)(X)) +#define ISALNUM(X) isalnum((unsigned char)(X)) +#define ISALPHA(X) isalpha((unsigned char)(X)) +#define ISUPPER(X) isupper((unsigned char)(X)) +#define ISLOWER(X) islower((unsigned char)(X)) + + +#ifndef __WIN32__ +# if defined(_WIN32) || defined(WIN32) +# define __WIN32__ +# endif +#endif + +#ifdef __WIN32__ +#ifdef __cplusplus +extern "C" { +#endif +extern int access(const char *path, int mode); +#ifdef __cplusplus +} +#endif +#else +#include +#endif + +/* #define PRIVATE static */ +#define PRIVATE + +#ifdef TEST +#define MAXRHS 5 /* Set low to exercise exception code */ +#else +#define MAXRHS 1000 +#endif + +extern void memory_error(); +static int showPrecedenceConflict = 0; +static char *msort(char*,char**,int(*)(const char*,const char*)); + +/* +** Compilers are getting increasingly pedantic about type conversions +** as C evolves ever closer to Ada.... To work around the latest problems +** we have to define the following variant of strlen(). +*/ +#define lemonStrlen(X) ((int)strlen(X)) + +/* +** Header on the linked list of memory allocations. +*/ +typedef struct MemChunk MemChunk; +struct MemChunk { + MemChunk *pNext; + size_t sz; + /* Actually memory follows */ +}; + +/* +** Global linked list of all memory allocations. +*/ +static MemChunk *memChunkList = 0; + +/* +** Wrappers around malloc(), calloc(), realloc() and free(). +** +** All memory allocations are kept on a doubly-linked list. The +** lemon_free_all() function can be called prior to exit to clean +** up any memory leaks. +** +** This is not necessary. But compilers and getting increasingly +** fussy about memory leaks, even in command-line programs like Lemon +** where they do not matter. So this code is provided to hush the +** warnings. +*/ +static void *lemon_malloc(size_t nByte){ + MemChunk *p; + if( nByte<0 ) return 0; + p = malloc( nByte + sizeof(MemChunk) ); + if( p==0 ){ + fprintf(stderr, "Out of memory. Failed to allocate %lld bytes.\n", + (long long int)nByte); + exit(1); + } + p->pNext = memChunkList; + p->sz = nByte; + memChunkList = p; + return (void*)&p[1]; +} +static void *lemon_calloc(size_t nElem, size_t sz){ + void *p = lemon_malloc(nElem*sz); + memset(p, 0, nElem*sz); + return p; +} +static void lemon_free(void *pOld){ + if( pOld ){ + MemChunk *p = (MemChunk*)pOld; + p--; + memset(pOld, 0, p->sz); + } +} +static void *lemon_realloc(void *pOld, size_t nNew){ + void *pNew; + MemChunk *p; + if( pOld==0 ) return lemon_malloc(nNew); + p = (MemChunk*)pOld; + p--; + if( p->sz>=nNew ) return pOld; + pNew = lemon_malloc( nNew ); + memcpy(pNew, pOld, p->sz); + return pNew; +} + +/* Free all outstanding memory allocations. +** Do this right before exiting. +*/ +static void lemon_free_all(void){ + while( memChunkList ){ + MemChunk *pNext = memChunkList->pNext; + free( memChunkList ); + memChunkList = pNext; + } +} + +/* +** Compilers are starting to complain about the use of sprintf() and strcpy(), +** saying they are unsafe. So we define our own versions of those routines too. +** +** There are three routines here: lemon_sprintf(), lemon_vsprintf(), and +** lemon_addtext(). The first two are replacements for sprintf() and vsprintf(). +** The third is a helper routine for vsnprintf() that adds texts to the end of a +** buffer, making sure the buffer is always zero-terminated. +** +** The string formatter is a minimal subset of stdlib sprintf() supporting only +** a few simply conversions: +** +** %d +** %s +** %.*s +** +*/ +static void lemon_addtext( + char *zBuf, /* The buffer to which text is added */ + int *pnUsed, /* Slots of the buffer used so far */ + const char *zIn, /* Text to add */ + int nIn, /* Bytes of text to add. -1 to use strlen() */ + int iWidth /* Field width. Negative to left justify */ +){ + if( nIn<0 ) for(nIn=0; zIn[nIn]; nIn++){} + while( iWidth>nIn ){ zBuf[(*pnUsed)++] = ' '; iWidth--; } + if( nIn==0 ) return; + memcpy(&zBuf[*pnUsed], zIn, nIn); + *pnUsed += nIn; + while( (-iWidth)>nIn ){ zBuf[(*pnUsed)++] = ' '; iWidth++; } + zBuf[*pnUsed] = 0; +} +static int lemon_vsprintf(char *str, const char *zFormat, va_list ap){ + int i, j, k, c; + int nUsed = 0; + const char *z; + char zTemp[50]; + str[0] = 0; + for(i=j=0; (c = zFormat[i])!=0; i++){ + if( c=='%' ){ + int iWidth = 0; + lemon_addtext(str, &nUsed, &zFormat[j], i-j, 0); + c = zFormat[++i]; + if( ISDIGIT(c) || (c=='-' && ISDIGIT(zFormat[i+1])) ){ + if( c=='-' ) i++; + while( ISDIGIT(zFormat[i]) ) iWidth = iWidth*10 + zFormat[i++] - '0'; + if( c=='-' ) iWidth = -iWidth; + c = zFormat[i]; + } + if( c=='d' ){ + int v = va_arg(ap, int); + if( v<0 ){ + lemon_addtext(str, &nUsed, "-", 1, iWidth); + v = -v; + }else if( v==0 ){ + lemon_addtext(str, &nUsed, "0", 1, iWidth); + } + k = 0; + while( v>0 ){ + k++; + zTemp[sizeof(zTemp)-k] = (v%10) + '0'; + v /= 10; + } + lemon_addtext(str, &nUsed, &zTemp[sizeof(zTemp)-k], k, iWidth); + }else if( c=='s' ){ + z = va_arg(ap, const char*); + lemon_addtext(str, &nUsed, z, -1, iWidth); + }else if( c=='.' && memcmp(&zFormat[i], ".*s", 3)==0 ){ + i += 2; + k = va_arg(ap, int); + z = va_arg(ap, const char*); + lemon_addtext(str, &nUsed, z, k, iWidth); + }else if( c=='%' ){ + lemon_addtext(str, &nUsed, "%", 1, 0); + }else{ + fprintf(stderr, "illegal format\n"); + exit(1); + } + j = i+1; + } + } + lemon_addtext(str, &nUsed, &zFormat[j], i-j, 0); + return nUsed; +} +static int lemon_sprintf(char *str, const char *format, ...){ + va_list ap; + int rc; + va_start(ap, format); + rc = lemon_vsprintf(str, format, ap); + va_end(ap); + return rc; +} +static void lemon_strcpy(char *dest, const char *src){ + while( (*(dest++) = *(src++))!=0 ){} +} +static void lemon_strcat(char *dest, const char *src){ + while( *dest ) dest++; + lemon_strcpy(dest, src); +} + + +/* a few forward declarations... */ +struct rule; +struct lemon; +struct action; + +static struct action *Action_new(void); +static struct action *Action_sort(struct action *); + +/********** From the file "build.h" ************************************/ +void FindRulePrecedences(struct lemon*); +void FindFirstSets(struct lemon*); +void FindStates(struct lemon*); +void FindLinks(struct lemon*); +void FindFollowSets(struct lemon*); +void FindActions(struct lemon*); + +/********* From the file "configlist.h" *********************************/ +void Configlist_init(void); +struct config *Configlist_add(struct rule *, int); +struct config *Configlist_addbasis(struct rule *, int); +void Configlist_closure(struct lemon *); +void Configlist_sort(void); +void Configlist_sortbasis(void); +struct config *Configlist_return(void); +struct config *Configlist_basis(void); +void Configlist_eat(struct config *); +void Configlist_reset(void); + +/********* From the file "error.h" ***************************************/ +void ErrorMsg(const char *, int,const char *, ...); + +/****** From the file "option.h" ******************************************/ +enum option_type { OPT_FLAG=1, OPT_INT, OPT_DBL, OPT_STR, + OPT_FFLAG, OPT_FINT, OPT_FDBL, OPT_FSTR}; +struct s_options { + enum option_type type; + const char *label; + char *arg; + const char *message; +}; +int OptInit(char**,struct s_options*,FILE*); +int OptNArgs(void); +char *OptArg(int); +void OptErr(int); +void OptPrint(void); + +/******** From the file "parse.h" *****************************************/ +void Parse(struct lemon *lemp); + +/********* From the file "plink.h" ***************************************/ +struct plink *Plink_new(void); +void Plink_add(struct plink **, struct config *); +void Plink_copy(struct plink **, struct plink *); +void Plink_delete(struct plink *); + +/********** From the file "report.h" *************************************/ +void Reprint(struct lemon *); +void ReportOutput(struct lemon *); +void ReportTable(struct lemon *, int, int); +void ReportHeader(struct lemon *); +void CompressTables(struct lemon *); +void ResortStates(struct lemon *); + +/********** From the file "set.h" ****************************************/ +void SetSize(int); /* All sets will be of size N */ +char *SetNew(void); /* A new set for element 0..N */ +void SetFree(char*); /* Deallocate a set */ +int SetAdd(char*,int); /* Add element to a set */ +int SetUnion(char *,char *); /* A <- A U B, thru element N */ +#define SetFind(X,Y) (X[Y]) /* True if Y is in set X */ + +/********** From the file "struct.h" *************************************/ +/* +** Principal data structures for the LEMON parser generator. +*/ + +typedef enum {LEMON_FALSE=0, LEMON_TRUE} Boolean; + +/* Symbols (terminals and nonterminals) of the grammar are stored +** in the following: */ +enum symbol_type { + TERMINAL, + NONTERMINAL, + MULTITERMINAL +}; +enum e_assoc { + LEFT, + RIGHT, + NONE, + UNK +}; +struct symbol { + const char *name; /* Name of the symbol */ + int index; /* Index number for this symbol */ + enum symbol_type type; /* Symbols are all either TERMINALS or NTs */ + struct rule *rule; /* Linked list of rules of this (if an NT) */ + struct symbol *fallback; /* fallback token in case this token doesn't parse */ + int prec; /* Precedence if defined (-1 otherwise) */ + enum e_assoc assoc; /* Associativity if precedence is defined */ + char *firstset; /* First-set for all rules of this symbol */ + Boolean lambda; /* True if NT and can generate an empty string */ + int useCnt; /* Number of times used */ + char *destructor; /* Code which executes whenever this symbol is + ** popped from the stack during error processing */ + int destLineno; /* Line number for start of destructor. Set to + ** -1 for duplicate destructors. */ + char *datatype; /* The data type of information held by this + ** object. Only used if type==NONTERMINAL */ + int dtnum; /* The data type number. In the parser, the value + ** stack is a union. The .yy%d element of this + ** union is the correct data type for this object */ + int bContent; /* True if this symbol ever carries content - if + ** it is ever more than just syntax */ + /* The following fields are used by MULTITERMINALs only */ + int nsubsym; /* Number of constituent symbols in the MULTI */ + struct symbol **subsym; /* Array of constituent symbols */ +}; + +/* Each production rule in the grammar is stored in the following +** structure. */ +struct rule { + struct symbol *lhs; /* Left-hand side of the rule */ + const char *lhsalias; /* Alias for the LHS (NULL if none) */ + int lhsStart; /* True if left-hand side is the start symbol */ + int ruleline; /* Line number for the rule */ + int nrhs; /* Number of RHS symbols */ + struct symbol **rhs; /* The RHS symbols */ + const char **rhsalias; /* An alias for each RHS symbol (NULL if none) */ + int line; /* Line number at which code begins */ + const char *code; /* The code executed when this rule is reduced */ + const char *codePrefix; /* Setup code before code[] above */ + const char *codeSuffix; /* Breakdown code after code[] above */ + struct symbol *precsym; /* Precedence symbol for this rule */ + int index; /* An index number for this rule */ + int iRule; /* Rule number as used in the generated tables */ + Boolean noCode; /* True if this rule has no associated C code */ + Boolean codeEmitted; /* True if the code has been emitted already */ + Boolean canReduce; /* True if this rule is ever reduced */ + Boolean doesReduce; /* Reduce actions occur after optimization */ + Boolean neverReduce; /* Reduce is theoretically possible, but prevented + ** by actions or other outside implementation */ + struct rule *nextlhs; /* Next rule with the same LHS */ + struct rule *next; /* Next rule in the global list */ +}; + +/* A configuration is a production rule of the grammar together with +** a mark (dot) showing how much of that rule has been processed so far. +** Configurations also contain a follow-set which is a list of terminal +** symbols which are allowed to immediately follow the end of the rule. +** Every configuration is recorded as an instance of the following: */ +enum cfgstatus { + COMPLETE, + INCOMPLETE +}; +struct config { + struct rule *rp; /* The rule upon which the configuration is based */ + int dot; /* The parse point */ + char *fws; /* Follow-set for this configuration only */ + struct plink *fplp; /* Follow-set forward propagation links */ + struct plink *bplp; /* Follow-set backwards propagation links */ + struct state *stp; /* Pointer to state which contains this */ + enum cfgstatus status; /* used during followset and shift computations */ + struct config *next; /* Next configuration in the state */ + struct config *bp; /* The next basis configuration */ +}; + +enum e_action { + SHIFT, + ACCEPT, + REDUCE, + ERROR, + SSCONFLICT, /* A shift/shift conflict */ + SRCONFLICT, /* Was a reduce, but part of a conflict */ + RRCONFLICT, /* Was a reduce, but part of a conflict */ + SH_RESOLVED, /* Was a shift. Precedence resolved conflict */ + RD_RESOLVED, /* Was reduce. Precedence resolved conflict */ + NOT_USED, /* Deleted by compression */ + SHIFTREDUCE /* Shift first, then reduce */ +}; + +/* Every shift or reduce operation is stored as one of the following */ +struct action { + struct symbol *sp; /* The look-ahead symbol */ + enum e_action type; + union { + struct state *stp; /* The new state, if a shift */ + struct rule *rp; /* The rule, if a reduce */ + } x; + struct symbol *spOpt; /* SHIFTREDUCE optimization to this symbol */ + struct action *next; /* Next action for this state */ + struct action *collide; /* Next action with the same hash */ +}; + +/* Each state of the generated parser's finite state machine +** is encoded as an instance of the following structure. */ +struct state { + struct config *bp; /* The basis configurations for this state */ + struct config *cfp; /* All configurations in this set */ + int statenum; /* Sequential number for this state */ + struct action *ap; /* List of actions for this state */ + int nTknAct, nNtAct; /* Number of actions on terminals and nonterminals */ + int iTknOfst, iNtOfst; /* yy_action[] offset for terminals and nonterms */ + int iDfltReduce; /* Default action is to REDUCE by this rule */ + struct rule *pDfltReduce;/* The default REDUCE rule. */ + int autoReduce; /* True if this is an auto-reduce state */ +}; +#define NO_OFFSET (-2147483647) + +/* A followset propagation link indicates that the contents of one +** configuration followset should be propagated to another whenever +** the first changes. */ +struct plink { + struct config *cfp; /* The configuration to which linked */ + struct plink *next; /* The next propagate link */ +}; + +/* The state vector for the entire parser generator is recorded as +** follows. (LEMON uses no global variables and makes little use of +** static variables. Fields in the following structure can be thought +** of as begin global variables in the program.) */ +struct lemon { + struct state **sorted; /* Table of states sorted by state number */ + struct rule *rule; /* List of all rules */ + struct rule *startRule; /* First rule */ + int nstate; /* Number of states */ + int nxstate; /* nstate with tail degenerate states removed */ + int nrule; /* Number of rules */ + int nruleWithAction; /* Number of rules with actions */ + int nsymbol; /* Number of terminal and nonterminal symbols */ + int nterminal; /* Number of terminal symbols */ + int minShiftReduce; /* Minimum shift-reduce action value */ + int errAction; /* Error action value */ + int accAction; /* Accept action value */ + int noAction; /* No-op action value */ + int minReduce; /* Minimum reduce action */ + int maxAction; /* Maximum action value of any kind */ + struct symbol **symbols; /* Sorted array of pointers to symbols */ + int errorcnt; /* Number of errors */ + struct symbol *errsym; /* The error symbol */ + struct symbol *wildcard; /* Token that matches anything */ + char *name; /* Name of the generated parser */ + char *arg; /* Declaration of the 3rd argument to parser */ + char *ctx; /* Declaration of 2nd argument to constructor */ + char *tokentype; /* Type of terminal symbols in the parser stack */ + char *vartype; /* The default type of non-terminal symbols */ + char *start; /* Name of the start symbol for the grammar */ + char *stacksize; /* Size of the parser stack */ + char *include; /* Code to put at the start of the C file */ + char *error; /* Code to execute when an error is seen */ + char *overflow; /* Code to execute on a stack overflow */ + char *failure; /* Code to execute on parser failure */ + char *accept; /* Code to execute when the parser excepts */ + char *extracode; /* Code appended to the generated file */ + char *tokendest; /* Code to execute to destroy token data */ + char *vardest; /* Code for the default non-terminal destructor */ + char *filename; /* Name of the input file */ + char *outname; /* Name of the current output file */ + char *tokenprefix; /* A prefix added to token names in the .h file */ + char *reallocFunc; /* Function to use to allocate stack space */ + char *freeFunc; /* Function to use to free stack space */ + int nconflict; /* Number of parsing conflicts */ + int nactiontab; /* Number of entries in the yy_action[] table */ + int nlookaheadtab; /* Number of entries in yy_lookahead[] */ + int tablesize; /* Total table size of all tables in bytes */ + int basisflag; /* Print only basis configurations */ + int printPreprocessed; /* Show preprocessor output on stdout */ + int has_fallback; /* True if any %fallback is seen in the grammar */ + int nolinenosflag; /* True if #line statements should not be printed */ + int argc; /* Number of command-line arguments */ + char **argv; /* Command-line arguments */ +}; + +#define MemoryCheck(X) if((X)==0){ \ + extern void memory_error(); \ + memory_error(); \ +} + +/**************** From the file "table.h" *********************************/ +/* +** All code in this file has been automatically generated +** from a specification in the file +** "table.q" +** by the associative array code building program "aagen". +** Do not edit this file! Instead, edit the specification +** file, then rerun aagen. +*/ +/* +** Code for processing tables in the LEMON parser generator. +*/ +/* Routines for handling a strings */ + +const char *Strsafe(const char *); + +void Strsafe_init(void); +int Strsafe_insert(const char *); +const char *Strsafe_find(const char *); + +/* Routines for handling symbols of the grammar */ + +struct symbol *Symbol_new(const char *); +int Symbolcmpp(const void *, const void *); +void Symbol_init(void); +int Symbol_insert(struct symbol *, const char *); +struct symbol *Symbol_find(const char *); +struct symbol *Symbol_Nth(int); +int Symbol_count(void); +struct symbol **Symbol_arrayof(void); + +/* Routines to manage the state table */ + +int Configcmp(const char *, const char *); +struct state *State_new(void); +void State_init(void); +int State_insert(struct state *, struct config *); +struct state *State_find(struct config *); +struct state **State_arrayof(void); + +/* Routines used for efficiency in Configlist_add */ + +void Configtable_init(void); +int Configtable_insert(struct config *); +struct config *Configtable_find(struct config *); +void Configtable_clear(int(*)(struct config *)); + +/****************** From the file "action.c" *******************************/ +/* +** Routines processing parser actions in the LEMON parser generator. +*/ + +/* Allocate a new parser action */ +static struct action *Action_new(void){ + static struct action *actionfreelist = 0; + struct action *newaction; + + if( actionfreelist==0 ){ + int i; + int amt = 100; + actionfreelist = (struct action *)lemon_calloc(amt, sizeof(struct action)); + if( actionfreelist==0 ){ + fprintf(stderr,"Unable to allocate memory for a new parser action."); + exit(1); + } + for(i=0; inext; + return newaction; +} + +/* Compare two actions for sorting purposes. Return negative, zero, or +** positive if the first action is less than, equal to, or greater than +** the first +*/ +static int actioncmp( + struct action *ap1, + struct action *ap2 +){ + int rc; + rc = ap1->sp->index - ap2->sp->index; + if( rc==0 ){ + rc = (int)ap1->type - (int)ap2->type; + } + if( rc==0 && (ap1->type==REDUCE || ap1->type==SHIFTREDUCE) ){ + rc = ap1->x.rp->index - ap2->x.rp->index; + } + if( rc==0 ){ + rc = (int) (ap2 - ap1); + } + return rc; +} + +/* Sort parser actions */ +static struct action *Action_sort( + struct action *ap +){ + ap = (struct action *)msort((char *)ap,(char **)&ap->next, + (int(*)(const char*,const char*))actioncmp); + return ap; +} + +void Action_add( + struct action **app, + enum e_action type, + struct symbol *sp, + char *arg +){ + struct action *newaction; + newaction = Action_new(); + newaction->next = *app; + *app = newaction; + newaction->type = type; + newaction->sp = sp; + newaction->spOpt = 0; + if( type==SHIFT ){ + newaction->x.stp = (struct state *)arg; + }else{ + newaction->x.rp = (struct rule *)arg; + } +} +/********************** New code to implement the "acttab" module ***********/ +/* +** This module implements routines use to construct the yy_action[] table. +*/ + +/* +** The state of the yy_action table under construction is an instance of +** the following structure. +** +** The yy_action table maps the pair (state_number, lookahead) into an +** action_number. The table is an array of integers pairs. The state_number +** determines an initial offset into the yy_action array. The lookahead +** value is then added to this initial offset to get an index X into the +** yy_action array. If the aAction[X].lookahead equals the value of the +** of the lookahead input, then the value of the action_number output is +** aAction[X].action. If the lookaheads do not match then the +** default action for the state_number is returned. +** +** All actions associated with a single state_number are first entered +** into aLookahead[] using multiple calls to acttab_action(). Then the +** actions for that single state_number are placed into the aAction[] +** array with a single call to acttab_insert(). The acttab_insert() call +** also resets the aLookahead[] array in preparation for the next +** state number. +*/ +struct lookahead_action { + int lookahead; /* Value of the lookahead token */ + int action; /* Action to take on the given lookahead */ +}; +typedef struct acttab acttab; +struct acttab { + int nAction; /* Number of used slots in aAction[] */ + int nActionAlloc; /* Slots allocated for aAction[] */ + struct lookahead_action + *aAction, /* The yy_action[] table under construction */ + *aLookahead; /* A single new transaction set */ + int mnLookahead; /* Minimum aLookahead[].lookahead */ + int mnAction; /* Action associated with mnLookahead */ + int mxLookahead; /* Maximum aLookahead[].lookahead */ + int nLookahead; /* Used slots in aLookahead[] */ + int nLookaheadAlloc; /* Slots allocated in aLookahead[] */ + int nterminal; /* Number of terminal symbols */ + int nsymbol; /* total number of symbols */ +}; + +/* Return the number of entries in the yy_action table */ +#define acttab_lookahead_size(X) ((X)->nAction) + +/* The value for the N-th entry in yy_action */ +#define acttab_yyaction(X,N) ((X)->aAction[N].action) + +/* The value for the N-th entry in yy_lookahead */ +#define acttab_yylookahead(X,N) ((X)->aAction[N].lookahead) + +/* Free all memory associated with the given acttab */ +void acttab_free(acttab *p){ + lemon_free( p->aAction ); + lemon_free( p->aLookahead ); + lemon_free( p ); +} + +/* Allocate a new acttab structure */ +acttab *acttab_alloc(int nsymbol, int nterminal){ + acttab *p = (acttab *) lemon_calloc( 1, sizeof(*p) ); + if( p==0 ){ + fprintf(stderr,"Unable to allocate memory for a new acttab."); + exit(1); + } + memset(p, 0, sizeof(*p)); + p->nsymbol = nsymbol; + p->nterminal = nterminal; + return p; +} + +/* Add a new action to the current transaction set. +** +** This routine is called once for each lookahead for a particular +** state. +*/ +void acttab_action(acttab *p, int lookahead, int action){ + if( p->nLookahead>=p->nLookaheadAlloc ){ + p->nLookaheadAlloc += 25; + p->aLookahead = (struct lookahead_action *) lemon_realloc( p->aLookahead, + sizeof(p->aLookahead[0])*p->nLookaheadAlloc ); + if( p->aLookahead==0 ){ + fprintf(stderr,"malloc failed\n"); + exit(1); + } + } + if( p->nLookahead==0 ){ + p->mxLookahead = lookahead; + p->mnLookahead = lookahead; + p->mnAction = action; + }else{ + if( p->mxLookaheadmxLookahead = lookahead; + if( p->mnLookahead>lookahead ){ + p->mnLookahead = lookahead; + p->mnAction = action; + } + } + p->aLookahead[p->nLookahead].lookahead = lookahead; + p->aLookahead[p->nLookahead].action = action; + p->nLookahead++; +} + +/* +** Add the transaction set built up with prior calls to acttab_action() +** into the current action table. Then reset the transaction set back +** to an empty set in preparation for a new round of acttab_action() calls. +** +** Return the offset into the action table of the new transaction. +** +** If the makeItSafe parameter is true, then the offset is chosen so that +** it is impossible to overread the yy_lookaside[] table regardless of +** the lookaside token. This is done for the terminal symbols, as they +** come from external inputs and can contain syntax errors. When makeItSafe +** is false, there is more flexibility in selecting offsets, resulting in +** a smaller table. For non-terminal symbols, which are never syntax errors, +** makeItSafe can be false. +*/ +int acttab_insert(acttab *p, int makeItSafe){ + int i, j, k, n, end; + assert( p->nLookahead>0 ); + + /* Make sure we have enough space to hold the expanded action table + ** in the worst case. The worst case occurs if the transaction set + ** must be appended to the current action table + */ + n = p->nsymbol + 1; + if( p->nAction + n >= p->nActionAlloc ){ + int oldAlloc = p->nActionAlloc; + p->nActionAlloc = p->nAction + n + p->nActionAlloc + 20; + p->aAction = (struct lookahead_action *) lemon_realloc( p->aAction, + sizeof(p->aAction[0])*p->nActionAlloc); + if( p->aAction==0 ){ + fprintf(stderr,"malloc failed\n"); + exit(1); + } + for(i=oldAlloc; inActionAlloc; i++){ + p->aAction[i].lookahead = -1; + p->aAction[i].action = -1; + } + } + + /* Scan the existing action table looking for an offset that is a + ** duplicate of the current transaction set. Fall out of the loop + ** if and when the duplicate is found. + ** + ** i is the index in p->aAction[] where p->mnLookahead is inserted. + */ + end = makeItSafe ? p->mnLookahead : 0; + for(i=p->nAction-1; i>=end; i--){ + if( p->aAction[i].lookahead==p->mnLookahead ){ + /* All lookaheads and actions in the aLookahead[] transaction + ** must match against the candidate aAction[i] entry. */ + if( p->aAction[i].action!=p->mnAction ) continue; + for(j=0; jnLookahead; j++){ + k = p->aLookahead[j].lookahead - p->mnLookahead + i; + if( k<0 || k>=p->nAction ) break; + if( p->aLookahead[j].lookahead!=p->aAction[k].lookahead ) break; + if( p->aLookahead[j].action!=p->aAction[k].action ) break; + } + if( jnLookahead ) continue; + + /* No possible lookahead value that is not in the aLookahead[] + ** transaction is allowed to match aAction[i] */ + n = 0; + for(j=0; jnAction; j++){ + if( p->aAction[j].lookahead<0 ) continue; + if( p->aAction[j].lookahead==j+p->mnLookahead-i ) n++; + } + if( n==p->nLookahead ){ + break; /* An exact match is found at offset i */ + } + } + } + + /* If no existing offsets exactly match the current transaction, find an + ** an empty offset in the aAction[] table in which we can add the + ** aLookahead[] transaction. + */ + if( inAction, which means the + ** transaction will be appended. */ + i = makeItSafe ? p->mnLookahead : 0; + for(; inActionAlloc - p->mxLookahead; i++){ + if( p->aAction[i].lookahead<0 ){ + for(j=0; jnLookahead; j++){ + k = p->aLookahead[j].lookahead - p->mnLookahead + i; + if( k<0 ) break; + if( p->aAction[k].lookahead>=0 ) break; + } + if( jnLookahead ) continue; + for(j=0; jnAction; j++){ + if( p->aAction[j].lookahead==j+p->mnLookahead-i ) break; + } + if( j==p->nAction ){ + break; /* Fits in empty slots */ + } + } + } + } + /* Insert transaction set at index i. */ +#if 0 + printf("Acttab:"); + for(j=0; jnLookahead; j++){ + printf(" %d", p->aLookahead[j].lookahead); + } + printf(" inserted at %d\n", i); +#endif + for(j=0; jnLookahead; j++){ + k = p->aLookahead[j].lookahead - p->mnLookahead + i; + p->aAction[k] = p->aLookahead[j]; + if( k>=p->nAction ) p->nAction = k+1; + } + if( makeItSafe && i+p->nterminal>=p->nAction ) p->nAction = i+p->nterminal+1; + p->nLookahead = 0; + + /* Return the offset that is added to the lookahead in order to get the + ** index into yy_action of the action */ + return i - p->mnLookahead; +} + +/* +** Return the size of the action table without the trailing syntax error +** entries. +*/ +int acttab_action_size(acttab *p){ + int n = p->nAction; + while( n>0 && p->aAction[n-1].lookahead<0 ){ n--; } + return n; +} + +/********************** From the file "build.c" *****************************/ +/* +** Routines to construction the finite state machine for the LEMON +** parser generator. +*/ + +/* Find a precedence symbol of every rule in the grammar. +** +** Those rules which have a precedence symbol coded in the input +** grammar using the "[symbol]" construct will already have the +** rp->precsym field filled. Other rules take as their precedence +** symbol the first RHS symbol with a defined precedence. If there +** are not RHS symbols with a defined precedence, the precedence +** symbol field is left blank. +*/ +void FindRulePrecedences(struct lemon *xp) +{ + struct rule *rp; + for(rp=xp->rule; rp; rp=rp->next){ + if( rp->precsym==0 ){ + int i, j; + for(i=0; inrhs && rp->precsym==0; i++){ + struct symbol *sp = rp->rhs[i]; + if( sp->type==MULTITERMINAL ){ + for(j=0; jnsubsym; j++){ + if( sp->subsym[j]->prec>=0 ){ + rp->precsym = sp->subsym[j]; + break; + } + } + }else if( sp->prec>=0 ){ + rp->precsym = rp->rhs[i]; + } + } + } + } + return; +} + +/* Find all nonterminals which will generate the empty string. +** Then go back and compute the first sets of every nonterminal. +** The first set is the set of all terminal symbols which can begin +** a string generated by that nonterminal. +*/ +void FindFirstSets(struct lemon *lemp) +{ + int i, j; + struct rule *rp; + int progress; + + for(i=0; insymbol; i++){ + lemp->symbols[i]->lambda = LEMON_FALSE; + } + for(i=lemp->nterminal; insymbol; i++){ + lemp->symbols[i]->firstset = SetNew(); + } + + /* First compute all lambdas */ + do{ + progress = 0; + for(rp=lemp->rule; rp; rp=rp->next){ + if( rp->lhs->lambda ) continue; + for(i=0; inrhs; i++){ + struct symbol *sp = rp->rhs[i]; + assert( sp->type==NONTERMINAL || sp->lambda==LEMON_FALSE ); + if( sp->lambda==LEMON_FALSE ) break; + } + if( i==rp->nrhs ){ + rp->lhs->lambda = LEMON_TRUE; + progress = 1; + } + } + }while( progress ); + + /* Now compute all first sets */ + do{ + struct symbol *s1, *s2; + progress = 0; + for(rp=lemp->rule; rp; rp=rp->next){ + s1 = rp->lhs; + for(i=0; inrhs; i++){ + s2 = rp->rhs[i]; + if( s2->type==TERMINAL ){ + progress += SetAdd(s1->firstset,s2->index); + break; + }else if( s2->type==MULTITERMINAL ){ + for(j=0; jnsubsym; j++){ + progress += SetAdd(s1->firstset,s2->subsym[j]->index); + } + break; + }else if( s1==s2 ){ + if( s1->lambda==LEMON_FALSE ) break; + }else{ + progress += SetUnion(s1->firstset,s2->firstset); + if( s2->lambda==LEMON_FALSE ) break; + } + } + } + }while( progress ); + return; +} + +/* Compute all LR(0) states for the grammar. Links +** are added to between some states so that the LR(1) follow sets +** can be computed later. +*/ +PRIVATE struct state *getstate(struct lemon *); /* forward reference */ +void FindStates(struct lemon *lemp) +{ + struct symbol *sp; + struct rule *rp; + + Configlist_init(); + + /* Find the start symbol */ + if( lemp->start ){ + sp = Symbol_find(lemp->start); + if( sp==0 ){ + ErrorMsg(lemp->filename,0, + "The specified start symbol \"%s\" is not " + "in a nonterminal of the grammar. \"%s\" will be used as the start " + "symbol instead.",lemp->start,lemp->startRule->lhs->name); + lemp->errorcnt++; + sp = lemp->startRule->lhs; + } + }else if( lemp->startRule ){ + sp = lemp->startRule->lhs; + }else{ + ErrorMsg(lemp->filename,0,"Internal error - no start rule\n"); + exit(1); + } + + /* Make sure the start symbol doesn't occur on the right-hand side of + ** any rule. Report an error if it does. (YACC would generate a new + ** start symbol in this case.) */ + for(rp=lemp->rule; rp; rp=rp->next){ + int i; + for(i=0; inrhs; i++){ + if( rp->rhs[i]==sp ){ /* FIX ME: Deal with multiterminals */ + ErrorMsg(lemp->filename,0, + "The start symbol \"%s\" occurs on the " + "right-hand side of a rule. This will result in a parser which " + "does not work properly.",sp->name); + lemp->errorcnt++; + } + } + } + + /* The basis configuration set for the first state + ** is all rules which have the start symbol as their + ** left-hand side */ + for(rp=sp->rule; rp; rp=rp->nextlhs){ + struct config *newcfp; + rp->lhsStart = 1; + newcfp = Configlist_addbasis(rp,0); + SetAdd(newcfp->fws,0); + } + + /* Compute the first state. All other states will be + ** computed automatically during the computation of the first one. + ** The returned pointer to the first state is not used. */ + (void)getstate(lemp); + return; +} + +/* Return a pointer to a state which is described by the configuration +** list which has been built from calls to Configlist_add. +*/ +PRIVATE void buildshifts(struct lemon *, struct state *); /* Forwd ref */ +PRIVATE struct state *getstate(struct lemon *lemp) +{ + struct config *cfp, *bp; + struct state *stp; + + /* Extract the sorted basis of the new state. The basis was constructed + ** by prior calls to "Configlist_addbasis()". */ + Configlist_sortbasis(); + bp = Configlist_basis(); + + /* Get a state with the same basis */ + stp = State_find(bp); + if( stp ){ + /* A state with the same basis already exists! Copy all the follow-set + ** propagation links from the state under construction into the + ** preexisting state, then return a pointer to the preexisting state */ + struct config *x, *y; + for(x=bp, y=stp->bp; x && y; x=x->bp, y=y->bp){ + Plink_copy(&y->bplp,x->bplp); + Plink_delete(x->fplp); + x->fplp = x->bplp = 0; + } + cfp = Configlist_return(); + Configlist_eat(cfp); + }else{ + /* This really is a new state. Construct all the details */ + Configlist_closure(lemp); /* Compute the configuration closure */ + Configlist_sort(); /* Sort the configuration closure */ + cfp = Configlist_return(); /* Get a pointer to the config list */ + stp = State_new(); /* A new state structure */ + MemoryCheck(stp); + stp->bp = bp; /* Remember the configuration basis */ + stp->cfp = cfp; /* Remember the configuration closure */ + stp->statenum = lemp->nstate++; /* Every state gets a sequence number */ + stp->ap = 0; /* No actions, yet. */ + State_insert(stp,stp->bp); /* Add to the state table */ + buildshifts(lemp,stp); /* Recursively compute successor states */ + } + return stp; +} + +/* +** Return true if two symbols are the same. +*/ +int same_symbol(struct symbol *a, struct symbol *b) +{ + int i; + if( a==b ) return 1; + if( a->type!=MULTITERMINAL ) return 0; + if( b->type!=MULTITERMINAL ) return 0; + if( a->nsubsym!=b->nsubsym ) return 0; + for(i=0; insubsym; i++){ + if( a->subsym[i]!=b->subsym[i] ) return 0; + } + return 1; +} + +/* Construct all successor states to the given state. A "successor" +** state is any state which can be reached by a shift action. +*/ +PRIVATE void buildshifts(struct lemon *lemp, struct state *stp) +{ + struct config *cfp; /* For looping thru the config closure of "stp" */ + struct config *bcfp; /* For the inner loop on config closure of "stp" */ + struct config *newcfg; /* */ + struct symbol *sp; /* Symbol following the dot in configuration "cfp" */ + struct symbol *bsp; /* Symbol following the dot in configuration "bcfp" */ + struct state *newstp; /* A pointer to a successor state */ + + /* Each configuration becomes complete after it contributes to a successor + ** state. Initially, all configurations are incomplete */ + for(cfp=stp->cfp; cfp; cfp=cfp->next) cfp->status = INCOMPLETE; + + /* Loop through all configurations of the state "stp" */ + for(cfp=stp->cfp; cfp; cfp=cfp->next){ + if( cfp->status==COMPLETE ) continue; /* Already used by inner loop */ + if( cfp->dot>=cfp->rp->nrhs ) continue; /* Can't shift this config */ + Configlist_reset(); /* Reset the new config set */ + sp = cfp->rp->rhs[cfp->dot]; /* Symbol after the dot */ + + /* For every configuration in the state "stp" which has the symbol "sp" + ** following its dot, add the same configuration to the basis set under + ** construction but with the dot shifted one symbol to the right. */ + for(bcfp=cfp; bcfp; bcfp=bcfp->next){ + if( bcfp->status==COMPLETE ) continue; /* Already used */ + if( bcfp->dot>=bcfp->rp->nrhs ) continue; /* Can't shift this one */ + bsp = bcfp->rp->rhs[bcfp->dot]; /* Get symbol after dot */ + if( !same_symbol(bsp,sp) ) continue; /* Must be same as for "cfp" */ + bcfp->status = COMPLETE; /* Mark this config as used */ + newcfg = Configlist_addbasis(bcfp->rp,bcfp->dot+1); + Plink_add(&newcfg->bplp,bcfp); + } + + /* Get a pointer to the state described by the basis configuration set + ** constructed in the preceding loop */ + newstp = getstate(lemp); + + /* The state "newstp" is reached from the state "stp" by a shift action + ** on the symbol "sp" */ + if( sp->type==MULTITERMINAL ){ + int i; + for(i=0; insubsym; i++){ + Action_add(&stp->ap,SHIFT,sp->subsym[i],(char*)newstp); + } + }else{ + Action_add(&stp->ap,SHIFT,sp,(char *)newstp); + } + } +} + +/* +** Construct the propagation links +*/ +void FindLinks(struct lemon *lemp) +{ + int i; + struct config *cfp, *other; + struct state *stp; + struct plink *plp; + + /* Housekeeping detail: + ** Add to every propagate link a pointer back to the state to + ** which the link is attached. */ + for(i=0; instate; i++){ + stp = lemp->sorted[i]; + for(cfp=stp?stp->cfp:0; cfp; cfp=cfp->next){ + cfp->stp = stp; + } + } + + /* Convert all backlinks into forward links. Only the forward + ** links are used in the follow-set computation. */ + for(i=0; instate; i++){ + stp = lemp->sorted[i]; + for(cfp=stp?stp->cfp:0; cfp; cfp=cfp->next){ + for(plp=cfp->bplp; plp; plp=plp->next){ + other = plp->cfp; + Plink_add(&other->fplp,cfp); + } + } + } +} + +/* Compute all followsets. +** +** A followset is the set of all symbols which can come immediately +** after a configuration. +*/ +void FindFollowSets(struct lemon *lemp) +{ + int i; + struct config *cfp; + struct plink *plp; + int progress; + int change; + + for(i=0; instate; i++){ + assert( lemp->sorted[i]!=0 ); + for(cfp=lemp->sorted[i]->cfp; cfp; cfp=cfp->next){ + cfp->status = INCOMPLETE; + } + } + + do{ + progress = 0; + for(i=0; instate; i++){ + assert( lemp->sorted[i]!=0 ); + for(cfp=lemp->sorted[i]->cfp; cfp; cfp=cfp->next){ + if( cfp->status==COMPLETE ) continue; + for(plp=cfp->fplp; plp; plp=plp->next){ + change = SetUnion(plp->cfp->fws,cfp->fws); + if( change ){ + plp->cfp->status = INCOMPLETE; + progress = 1; + } + } + cfp->status = COMPLETE; + } + } + }while( progress ); +} + +static int resolve_conflict(struct action *,struct action *); + +/* Compute the reduce actions, and resolve conflicts. +*/ +void FindActions(struct lemon *lemp) +{ + int i,j; + struct config *cfp; + struct state *stp; + struct symbol *sp; + struct rule *rp; + + /* Add all of the reduce actions + ** A reduce action is added for each element of the followset of + ** a configuration which has its dot at the extreme right. + */ + for(i=0; instate; i++){ /* Loop over all states */ + stp = lemp->sorted[i]; + for(cfp=stp->cfp; cfp; cfp=cfp->next){ /* Loop over all configurations */ + if( cfp->rp->nrhs==cfp->dot ){ /* Is dot at extreme right? */ + for(j=0; jnterminal; j++){ + if( SetFind(cfp->fws,j) ){ + /* Add a reduce action to the state "stp" which will reduce by the + ** rule "cfp->rp" if the lookahead symbol is "lemp->symbols[j]" */ + Action_add(&stp->ap,REDUCE,lemp->symbols[j],(char *)cfp->rp); + } + } + } + } + } + + /* Add the accepting token */ + if( lemp->start ){ + sp = Symbol_find(lemp->start); + if( sp==0 ){ + if( lemp->startRule==0 ){ + fprintf(stderr, "internal error on source line %d: no start rule\n", + __LINE__); + exit(1); + } + sp = lemp->startRule->lhs; + } + }else{ + sp = lemp->startRule->lhs; + } + /* Add to the first state (which is always the starting state of the + ** finite state machine) an action to ACCEPT if the lookahead is the + ** start nonterminal. */ + Action_add(&lemp->sorted[0]->ap,ACCEPT,sp,0); + + /* Resolve conflicts */ + for(i=0; instate; i++){ + struct action *ap, *nap; + stp = lemp->sorted[i]; + /* assert( stp->ap ); */ + stp->ap = Action_sort(stp->ap); + for(ap=stp->ap; ap && ap->next; ap=ap->next){ + for(nap=ap->next; nap && nap->sp==ap->sp; nap=nap->next){ + /* The two actions "ap" and "nap" have the same lookahead. + ** Figure out which one should be used */ + lemp->nconflict += resolve_conflict(ap,nap); + } + } + } + + /* Report an error for each rule that can never be reduced. */ + for(rp=lemp->rule; rp; rp=rp->next) rp->canReduce = LEMON_FALSE; + for(i=0; instate; i++){ + struct action *ap; + for(ap=lemp->sorted[i]->ap; ap; ap=ap->next){ + if( ap->type==REDUCE ) ap->x.rp->canReduce = LEMON_TRUE; + } + } + for(rp=lemp->rule; rp; rp=rp->next){ + if( rp->canReduce ) continue; + ErrorMsg(lemp->filename,rp->ruleline,"This rule can not be reduced.\n"); + lemp->errorcnt++; + } +} + +/* Resolve a conflict between the two given actions. If the +** conflict can't be resolved, return non-zero. +** +** NO LONGER TRUE: +** To resolve a conflict, first look to see if either action +** is on an error rule. In that case, take the action which +** is not associated with the error rule. If neither or both +** actions are associated with an error rule, then try to +** use precedence to resolve the conflict. +** +** If either action is a SHIFT, then it must be apx. This +** function won't work if apx->type==REDUCE and apy->type==SHIFT. +*/ +static int resolve_conflict( + struct action *apx, + struct action *apy +){ + struct symbol *spx, *spy; + int errcnt = 0; + assert( apx->sp==apy->sp ); /* Otherwise there would be no conflict */ + if( apx->type==SHIFT && apy->type==SHIFT ){ + apy->type = SSCONFLICT; + errcnt++; + } + if( apx->type==SHIFT && apy->type==REDUCE ){ + spx = apx->sp; + spy = apy->x.rp->precsym; + if( spy==0 || spx->prec<0 || spy->prec<0 ){ + /* Not enough precedence information. */ + apy->type = SRCONFLICT; + errcnt++; + }else if( spx->prec>spy->prec ){ /* higher precedence wins */ + apy->type = RD_RESOLVED; + }else if( spx->precprec ){ + apx->type = SH_RESOLVED; + }else if( spx->prec==spy->prec && spx->assoc==RIGHT ){ /* Use operator */ + apy->type = RD_RESOLVED; /* associativity */ + }else if( spx->prec==spy->prec && spx->assoc==LEFT ){ /* to break tie */ + apx->type = SH_RESOLVED; + }else{ + assert( spx->prec==spy->prec && spx->assoc==NONE ); + apx->type = ERROR; + } + }else if( apx->type==REDUCE && apy->type==REDUCE ){ + spx = apx->x.rp->precsym; + spy = apy->x.rp->precsym; + if( spx==0 || spy==0 || spx->prec<0 || + spy->prec<0 || spx->prec==spy->prec ){ + apy->type = RRCONFLICT; + errcnt++; + }else if( spx->prec>spy->prec ){ + apy->type = RD_RESOLVED; + }else if( spx->precprec ){ + apx->type = RD_RESOLVED; + } + }else{ + assert( + apx->type==SH_RESOLVED || + apx->type==RD_RESOLVED || + apx->type==SSCONFLICT || + apx->type==SRCONFLICT || + apx->type==RRCONFLICT || + apy->type==SH_RESOLVED || + apy->type==RD_RESOLVED || + apy->type==SSCONFLICT || + apy->type==SRCONFLICT || + apy->type==RRCONFLICT + ); + /* The REDUCE/SHIFT case cannot happen because SHIFTs come before + ** REDUCEs on the list. If we reach this point it must be because + ** the parser conflict had already been resolved. */ + } + return errcnt; +} +/********************* From the file "configlist.c" *************************/ +/* +** Routines to processing a configuration list and building a state +** in the LEMON parser generator. +*/ + +static struct config *freelist = 0; /* List of free configurations */ +static struct config *current = 0; /* Top of list of configurations */ +static struct config **currentend = 0; /* Last on list of configs */ +static struct config *basis = 0; /* Top of list of basis configs */ +static struct config **basisend = 0; /* End of list of basis configs */ + +/* Return a pointer to a new configuration */ +PRIVATE struct config *newconfig(void){ + return (struct config*)lemon_calloc(1, sizeof(struct config)); +} + +/* The configuration "old" is no longer used */ +PRIVATE void deleteconfig(struct config *old) +{ + old->next = freelist; + freelist = old; +} + +/* Initialized the configuration list builder */ +void Configlist_init(void){ + current = 0; + currentend = ¤t; + basis = 0; + basisend = &basis; + Configtable_init(); + return; +} + +/* Initialized the configuration list builder */ +void Configlist_reset(void){ + current = 0; + currentend = ¤t; + basis = 0; + basisend = &basis; + Configtable_clear(0); + return; +} + +/* Add another configuration to the configuration list */ +struct config *Configlist_add( + struct rule *rp, /* The rule */ + int dot /* Index into the RHS of the rule where the dot goes */ +){ + struct config *cfp, model; + + assert( currentend!=0 ); + model.rp = rp; + model.dot = dot; + cfp = Configtable_find(&model); + if( cfp==0 ){ + cfp = newconfig(); + cfp->rp = rp; + cfp->dot = dot; + cfp->fws = SetNew(); + cfp->stp = 0; + cfp->fplp = cfp->bplp = 0; + cfp->next = 0; + cfp->bp = 0; + *currentend = cfp; + currentend = &cfp->next; + Configtable_insert(cfp); + } + return cfp; +} + +/* Add a basis configuration to the configuration list */ +struct config *Configlist_addbasis(struct rule *rp, int dot) +{ + struct config *cfp, model; + + assert( basisend!=0 ); + assert( currentend!=0 ); + model.rp = rp; + model.dot = dot; + cfp = Configtable_find(&model); + if( cfp==0 ){ + cfp = newconfig(); + cfp->rp = rp; + cfp->dot = dot; + cfp->fws = SetNew(); + cfp->stp = 0; + cfp->fplp = cfp->bplp = 0; + cfp->next = 0; + cfp->bp = 0; + *currentend = cfp; + currentend = &cfp->next; + *basisend = cfp; + basisend = &cfp->bp; + Configtable_insert(cfp); + } + return cfp; +} + +/* Compute the closure of the configuration list */ +void Configlist_closure(struct lemon *lemp) +{ + struct config *cfp, *newcfp; + struct rule *rp, *newrp; + struct symbol *sp, *xsp; + int i, dot; + + assert( currentend!=0 ); + for(cfp=current; cfp; cfp=cfp->next){ + rp = cfp->rp; + dot = cfp->dot; + if( dot>=rp->nrhs ) continue; + sp = rp->rhs[dot]; + if( sp->type==NONTERMINAL ){ + if( sp->rule==0 && sp!=lemp->errsym ){ + ErrorMsg(lemp->filename,rp->line,"Nonterminal \"%s\" has no rules.", + sp->name); + lemp->errorcnt++; + } + for(newrp=sp->rule; newrp; newrp=newrp->nextlhs){ + newcfp = Configlist_add(newrp,0); + for(i=dot+1; inrhs; i++){ + xsp = rp->rhs[i]; + if( xsp->type==TERMINAL ){ + SetAdd(newcfp->fws,xsp->index); + break; + }else if( xsp->type==MULTITERMINAL ){ + int k; + for(k=0; knsubsym; k++){ + SetAdd(newcfp->fws, xsp->subsym[k]->index); + } + break; + }else{ + SetUnion(newcfp->fws,xsp->firstset); + if( xsp->lambda==LEMON_FALSE ) break; + } + } + if( i==rp->nrhs ) Plink_add(&cfp->fplp,newcfp); + } + } + } + return; +} + +/* Sort the configuration list */ +void Configlist_sort(void){ + current = (struct config*)msort((char*)current,(char**)&(current->next), + Configcmp); + currentend = 0; + return; +} + +/* Sort the basis configuration list */ +void Configlist_sortbasis(void){ + basis = (struct config*)msort((char*)current,(char**)&(current->bp), + Configcmp); + basisend = 0; + return; +} + +/* Return a pointer to the head of the configuration list and +** reset the list */ +struct config *Configlist_return(void){ + struct config *old; + old = current; + current = 0; + currentend = 0; + return old; +} + +/* Return a pointer to the head of the configuration list and +** reset the list */ +struct config *Configlist_basis(void){ + struct config *old; + old = basis; + basis = 0; + basisend = 0; + return old; +} + +/* Free all elements of the given configuration list */ +void Configlist_eat(struct config *cfp) +{ + struct config *nextcfp; + for(; cfp; cfp=nextcfp){ + nextcfp = cfp->next; + assert( cfp->fplp==0 ); + assert( cfp->bplp==0 ); + if( cfp->fws ) SetFree(cfp->fws); + deleteconfig(cfp); + } + return; +} +/***************** From the file "error.c" *********************************/ +/* +** Code for printing error message. +*/ + +void ErrorMsg(const char *filename, int lineno, const char *format, ...){ + va_list ap; + fprintf(stderr, "%s:%d: ", filename, lineno); + va_start(ap, format); + vfprintf(stderr,format,ap); + va_end(ap); + fprintf(stderr, "\n"); +} +/**************** From the file "main.c" ************************************/ +/* +** Main program file for the LEMON parser generator. +*/ + +/* Report an out-of-memory condition and abort. This function +** is used mostly by the "MemoryCheck" macro in struct.h +*/ +void memory_error(void){ + fprintf(stderr,"Out of memory. Aborting...\n"); + exit(1); +} + +static int nDefine = 0; /* Number of -D options on the command line */ +static int nDefineUsed = 0; /* Number of -D options actually used */ +static char **azDefine = 0; /* Name of the -D macros */ +static char *bDefineUsed = 0; /* True for every -D macro actually used */ + +/* This routine is called with the argument to each -D command-line option. +** Add the macro defined to the azDefine array. +*/ +static void handle_D_option(char *z){ + char **paz; + nDefine++; + azDefine = (char **) lemon_realloc(azDefine, sizeof(azDefine[0])*nDefine); + if( azDefine==0 ){ + fprintf(stderr,"out of memory\n"); + exit(1); + } + bDefineUsed = (char*)lemon_realloc(bDefineUsed, nDefine); + if( bDefineUsed==0 ){ + fprintf(stderr,"out of memory\n"); + exit(1); + } + bDefineUsed[nDefine-1] = 0; + paz = &azDefine[nDefine-1]; + *paz = (char *) lemon_malloc( lemonStrlen(z)+1 ); + if( *paz==0 ){ + fprintf(stderr,"out of memory\n"); + exit(1); + } + lemon_strcpy(*paz, z); + for(z=*paz; *z && *z!='='; z++){} + *z = 0; +} + +/* Rember the name of the output directory +*/ +static char *outputDir = NULL; +static void handle_d_option(char *z){ + outputDir = (char *) lemon_malloc( lemonStrlen(z)+1 ); + if( outputDir==0 ){ + fprintf(stderr,"out of memory\n"); + exit(1); + } + lemon_strcpy(outputDir, z); +} + +static char *user_templatename = NULL; +static void handle_T_option(char *z){ + user_templatename = (char *) lemon_malloc( lemonStrlen(z)+1 ); + if( user_templatename==0 ){ + memory_error(); + } + lemon_strcpy(user_templatename, z); +} + +/* Merge together to lists of rules ordered by rule.iRule */ +static struct rule *Rule_merge(struct rule *pA, struct rule *pB){ + struct rule *pFirst = 0; + struct rule **ppPrev = &pFirst; + while( pA && pB ){ + if( pA->iRuleiRule ){ + *ppPrev = pA; + ppPrev = &pA->next; + pA = pA->next; + }else{ + *ppPrev = pB; + ppPrev = &pB->next; + pB = pB->next; + } + } + if( pA ){ + *ppPrev = pA; + }else{ + *ppPrev = pB; + } + return pFirst; +} + +/* +** Sort a list of rules in order of increasing iRule value +*/ +static struct rule *Rule_sort(struct rule *rp){ + unsigned int i; + struct rule *pNext; + struct rule *x[32]; + memset(x, 0, sizeof(x)); + while( rp ){ + pNext = rp->next; + rp->next = 0; + for(i=0; iindex = i; + qsort(lem.symbols,lem.nsymbol,sizeof(struct symbol*), Symbolcmpp); + for(i=0; iindex = i; + while( lem.symbols[i-1]->type==MULTITERMINAL ){ i--; } + assert( strcmp(lem.symbols[i-1]->name,"{default}")==0 ); + lem.nsymbol = i - 1; + for(i=1; ISUPPER(lem.symbols[i]->name[0]); i++); + lem.nterminal = i; + + /* Assign sequential rule numbers. Start with 0. Put rules that have no + ** reduce action C-code associated with them last, so that the switch() + ** statement that selects reduction actions will have a smaller jump table. + */ + for(i=0, rp=lem.rule; rp; rp=rp->next){ + rp->iRule = rp->code ? i++ : -1; + } + lem.nruleWithAction = i; + for(rp=lem.rule; rp; rp=rp->next){ + if( rp->iRule<0 ) rp->iRule = i++; + } + lem.startRule = lem.rule; + lem.rule = Rule_sort(lem.rule); + + /* Generate a reprint of the grammar, if requested on the command line */ + if( rpflag ){ + Reprint(&lem); + }else{ + /* Initialize the size for all follow and first sets */ + SetSize(lem.nterminal+1); + + /* Find the precedence for every production rule (that has one) */ + FindRulePrecedences(&lem); + + /* Compute the lambda-nonterminals and the first-sets for every + ** nonterminal */ + FindFirstSets(&lem); + + /* Compute all LR(0) states. Also record follow-set propagation + ** links so that the follow-set can be computed later */ + lem.nstate = 0; + FindStates(&lem); + lem.sorted = State_arrayof(); + + /* Tie up loose ends on the propagation links */ + FindLinks(&lem); + + /* Compute the follow set of every reducible configuration */ + FindFollowSets(&lem); + + /* Compute the action tables */ + FindActions(&lem); + + /* Compress the action tables */ + if( compress==0 ) CompressTables(&lem); + + /* Reorder and renumber the states so that states with fewer choices + ** occur at the end. This is an optimization that helps make the + ** generated parser tables smaller. */ + if( noResort==0 ) ResortStates(&lem); + + /* Generate a report of the parser generated. (the "y.output" file) */ + if( !quiet ) ReportOutput(&lem); + + /* Generate the source code for the parser */ + ReportTable(&lem, mhflag, sqlFlag); + + /* Produce a header file for use by the scanner. (This step is + ** omitted if the "-m" option is used because makeheaders will + ** generate the file for us.) */ + if( !mhflag ) ReportHeader(&lem); + } + if( statistics ){ + printf("Parser statistics:\n"); + stats_line("terminal symbols", lem.nterminal); + stats_line("non-terminal symbols", lem.nsymbol - lem.nterminal); + stats_line("total symbols", lem.nsymbol); + stats_line("rules", lem.nrule); + stats_line("states", lem.nxstate); + stats_line("conflicts", lem.nconflict); + stats_line("action table entries", lem.nactiontab); + stats_line("lookahead table entries", lem.nlookaheadtab); + stats_line("total table size (bytes)", lem.tablesize); + } + if( lem.nconflict > 0 ){ + fprintf(stderr,"%d parsing conflicts.\n",lem.nconflict); + } + + /* return 0 on success, 1 on failure. */ + exitcode = ((lem.errorcnt > 0) || (lem.nconflict > 0)) ? 1 : 0; + lemon_free_all(); + exit(exitcode); + return (exitcode); +} +/******************** From the file "msort.c" *******************************/ +/* +** A generic merge-sort program. +** +** USAGE: +** Let "ptr" be a pointer to some structure which is at the head of +** a null-terminated list. Then to sort the list call: +** +** ptr = msort(ptr,&(ptr->next),cmpfnc); +** +** In the above, "cmpfnc" is a pointer to a function which compares +** two instances of the structure and returns an integer, as in +** strcmp. The second argument is a pointer to the pointer to the +** second element of the linked list. This address is used to compute +** the offset to the "next" field within the structure. The offset to +** the "next" field must be constant for all structures in the list. +** +** The function returns a new pointer which is the head of the list +** after sorting. +** +** ALGORITHM: +** Merge-sort. +*/ + +/* +** Return a pointer to the next structure in the linked list. +*/ +#define NEXT(A) (*(char**)(((char*)A)+offset)) + +/* +** Inputs: +** a: A sorted, null-terminated linked list. (May be null). +** b: A sorted, null-terminated linked list. (May be null). +** cmp: A pointer to the comparison function. +** offset: Offset in the structure to the "next" field. +** +** Return Value: +** A pointer to the head of a sorted list containing the elements +** of both a and b. +** +** Side effects: +** The "next" pointers for elements in the lists a and b are +** changed. +*/ +static char *merge( + char *a, + char *b, + int (*cmp)(const char*,const char*), + int offset +){ + char *ptr, *head; + + if( a==0 ){ + head = b; + }else if( b==0 ){ + head = a; + }else{ + if( (*cmp)(a,b)<=0 ){ + ptr = a; + a = NEXT(a); + }else{ + ptr = b; + b = NEXT(b); + } + head = ptr; + while( a && b ){ + if( (*cmp)(a,b)<=0 ){ + NEXT(ptr) = a; + ptr = a; + a = NEXT(a); + }else{ + NEXT(ptr) = b; + ptr = b; + b = NEXT(b); + } + } + if( a ) NEXT(ptr) = a; + else NEXT(ptr) = b; + } + return head; +} + +/* +** Inputs: +** list: Pointer to a singly-linked list of structures. +** next: Pointer to pointer to the second element of the list. +** cmp: A comparison function. +** +** Return Value: +** A pointer to the head of a sorted list containing the elements +** originally in list. +** +** Side effects: +** The "next" pointers for elements in list are changed. +*/ +#define LISTSIZE 30 +static char *msort( + char *list, + char **next, + int (*cmp)(const char*,const char*) +){ + unsigned long offset; + char *ep; + char *set[LISTSIZE]; + int i; + offset = (unsigned long)((char*)next - (char*)list); + for(i=0; istate = WAITING_FOR_DECL_KEYWORD; + }else if( ISLOWER(x[0]) ){ + psp->lhs = Symbol_new(x); + psp->nrhs = 0; + psp->lhsalias = 0; + psp->state = WAITING_FOR_ARROW; + }else if( x[0]=='{' ){ + if( psp->prevrule==0 ){ + ErrorMsg(psp->filename,psp->tokenlineno, + "There is no prior rule upon which to attach the code " + "fragment which begins on this line."); + psp->errorcnt++; + }else if( psp->prevrule->code!=0 ){ + ErrorMsg(psp->filename,psp->tokenlineno, + "Code fragment beginning on this line is not the first " + "to follow the previous rule."); + psp->errorcnt++; + }else if( strcmp(x, "{NEVER-REDUCE")==0 ){ + psp->prevrule->neverReduce = 1; + }else{ + psp->prevrule->line = psp->tokenlineno; + psp->prevrule->code = &x[1]; + psp->prevrule->noCode = 0; + } + }else if( x[0]=='[' ){ + psp->state = PRECEDENCE_MARK_1; + }else{ + ErrorMsg(psp->filename,psp->tokenlineno, + "Token \"%s\" should be either \"%%\" or a nonterminal name.", + x); + psp->errorcnt++; + } + break; + case PRECEDENCE_MARK_1: + if( !ISUPPER(x[0]) ){ + ErrorMsg(psp->filename,psp->tokenlineno, + "The precedence symbol must be a terminal."); + psp->errorcnt++; + }else if( psp->prevrule==0 ){ + ErrorMsg(psp->filename,psp->tokenlineno, + "There is no prior rule to assign precedence \"[%s]\".",x); + psp->errorcnt++; + }else if( psp->prevrule->precsym!=0 ){ + ErrorMsg(psp->filename,psp->tokenlineno, + "Precedence mark on this line is not the first " + "to follow the previous rule."); + psp->errorcnt++; + }else{ + psp->prevrule->precsym = Symbol_new(x); + } + psp->state = PRECEDENCE_MARK_2; + break; + case PRECEDENCE_MARK_2: + if( x[0]!=']' ){ + ErrorMsg(psp->filename,psp->tokenlineno, + "Missing \"]\" on precedence mark."); + psp->errorcnt++; + } + psp->state = WAITING_FOR_DECL_OR_RULE; + break; + case WAITING_FOR_ARROW: + if( x[0]==':' && x[1]==':' && x[2]=='=' ){ + psp->state = IN_RHS; + }else if( x[0]=='(' ){ + psp->state = LHS_ALIAS_1; + }else{ + ErrorMsg(psp->filename,psp->tokenlineno, + "Expected to see a \":\" following the LHS symbol \"%s\".", + psp->lhs->name); + psp->errorcnt++; + psp->state = RESYNC_AFTER_RULE_ERROR; + } + break; + case LHS_ALIAS_1: + if( ISALPHA(x[0]) ){ + psp->lhsalias = x; + psp->state = LHS_ALIAS_2; + }else{ + ErrorMsg(psp->filename,psp->tokenlineno, + "\"%s\" is not a valid alias for the LHS \"%s\"\n", + x,psp->lhs->name); + psp->errorcnt++; + psp->state = RESYNC_AFTER_RULE_ERROR; + } + break; + case LHS_ALIAS_2: + if( x[0]==')' ){ + psp->state = LHS_ALIAS_3; + }else{ + ErrorMsg(psp->filename,psp->tokenlineno, + "Missing \")\" following LHS alias name \"%s\".",psp->lhsalias); + psp->errorcnt++; + psp->state = RESYNC_AFTER_RULE_ERROR; + } + break; + case LHS_ALIAS_3: + if( x[0]==':' && x[1]==':' && x[2]=='=' ){ + psp->state = IN_RHS; + }else{ + ErrorMsg(psp->filename,psp->tokenlineno, + "Missing \"->\" following: \"%s(%s)\".", + psp->lhs->name,psp->lhsalias); + psp->errorcnt++; + psp->state = RESYNC_AFTER_RULE_ERROR; + } + break; + case IN_RHS: + if( x[0]=='.' ){ + struct rule *rp; + rp = (struct rule *)lemon_calloc( sizeof(struct rule) + + sizeof(struct symbol*)*psp->nrhs + sizeof(char*)*psp->nrhs, 1); + if( rp==0 ){ + ErrorMsg(psp->filename,psp->tokenlineno, + "Can't allocate enough memory for this rule."); + psp->errorcnt++; + psp->prevrule = 0; + }else{ + int i; + rp->ruleline = psp->tokenlineno; + rp->rhs = (struct symbol**)&rp[1]; + rp->rhsalias = (const char**)&(rp->rhs[psp->nrhs]); + for(i=0; inrhs; i++){ + rp->rhs[i] = psp->rhs[i]; + rp->rhsalias[i] = psp->alias[i]; + if( rp->rhsalias[i]!=0 ){ rp->rhs[i]->bContent = 1; } + } + rp->lhs = psp->lhs; + rp->lhsalias = psp->lhsalias; + rp->nrhs = psp->nrhs; + rp->code = 0; + rp->noCode = 1; + rp->precsym = 0; + rp->index = psp->gp->nrule++; + rp->nextlhs = rp->lhs->rule; + rp->lhs->rule = rp; + rp->next = 0; + if( psp->firstrule==0 ){ + psp->firstrule = psp->lastrule = rp; + }else{ + psp->lastrule->next = rp; + psp->lastrule = rp; + } + psp->prevrule = rp; + } + psp->state = WAITING_FOR_DECL_OR_RULE; + }else if( ISALPHA(x[0]) ){ + if( psp->nrhs>=MAXRHS ){ + ErrorMsg(psp->filename,psp->tokenlineno, + "Too many symbols on RHS of rule beginning at \"%s\".", + x); + psp->errorcnt++; + psp->state = RESYNC_AFTER_RULE_ERROR; + }else{ + psp->rhs[psp->nrhs] = Symbol_new(x); + psp->alias[psp->nrhs] = 0; + psp->nrhs++; + } + }else if( (x[0]=='|' || x[0]=='/') && psp->nrhs>0 && ISUPPER(x[1]) ){ + struct symbol *msp = psp->rhs[psp->nrhs-1]; + if( msp->type!=MULTITERMINAL ){ + struct symbol *origsp = msp; + msp = (struct symbol *) lemon_calloc(1,sizeof(*msp)); + memset(msp, 0, sizeof(*msp)); + msp->type = MULTITERMINAL; + msp->nsubsym = 1; + msp->subsym = (struct symbol**)lemon_calloc(1,sizeof(struct symbol*)); + msp->subsym[0] = origsp; + msp->name = origsp->name; + psp->rhs[psp->nrhs-1] = msp; + } + msp->nsubsym++; + msp->subsym = (struct symbol **) lemon_realloc(msp->subsym, + sizeof(struct symbol*)*msp->nsubsym); + msp->subsym[msp->nsubsym-1] = Symbol_new(&x[1]); + if( ISLOWER(x[1]) || ISLOWER(msp->subsym[0]->name[0]) ){ + ErrorMsg(psp->filename,psp->tokenlineno, + "Cannot form a compound containing a non-terminal"); + psp->errorcnt++; + } + }else if( x[0]=='(' && psp->nrhs>0 ){ + psp->state = RHS_ALIAS_1; + }else{ + ErrorMsg(psp->filename,psp->tokenlineno, + "Illegal character on RHS of rule: \"%s\".",x); + psp->errorcnt++; + psp->state = RESYNC_AFTER_RULE_ERROR; + } + break; + case RHS_ALIAS_1: + if( ISALPHA(x[0]) ){ + psp->alias[psp->nrhs-1] = x; + psp->state = RHS_ALIAS_2; + }else{ + ErrorMsg(psp->filename,psp->tokenlineno, + "\"%s\" is not a valid alias for the RHS symbol \"%s\"\n", + x,psp->rhs[psp->nrhs-1]->name); + psp->errorcnt++; + psp->state = RESYNC_AFTER_RULE_ERROR; + } + break; + case RHS_ALIAS_2: + if( x[0]==')' ){ + psp->state = IN_RHS; + }else{ + ErrorMsg(psp->filename,psp->tokenlineno, + "Missing \")\" following LHS alias name \"%s\".",psp->lhsalias); + psp->errorcnt++; + psp->state = RESYNC_AFTER_RULE_ERROR; + } + break; + case WAITING_FOR_DECL_KEYWORD: + if( ISALPHA(x[0]) ){ + psp->declkeyword = x; + psp->declargslot = 0; + psp->decllinenoslot = 0; + psp->insertLineMacro = 1; + psp->state = WAITING_FOR_DECL_ARG; + if( strcmp(x,"name")==0 ){ + psp->declargslot = &(psp->gp->name); + psp->insertLineMacro = 0; + }else if( strcmp(x,"include")==0 ){ + psp->declargslot = &(psp->gp->include); + }else if( strcmp(x,"code")==0 ){ + psp->declargslot = &(psp->gp->extracode); + }else if( strcmp(x,"token_destructor")==0 ){ + psp->declargslot = &psp->gp->tokendest; + }else if( strcmp(x,"default_destructor")==0 ){ + psp->declargslot = &psp->gp->vardest; + }else if( strcmp(x,"token_prefix")==0 ){ + psp->declargslot = &psp->gp->tokenprefix; + psp->insertLineMacro = 0; + }else if( strcmp(x,"syntax_error")==0 ){ + psp->declargslot = &(psp->gp->error); + }else if( strcmp(x,"parse_accept")==0 ){ + psp->declargslot = &(psp->gp->accept); + }else if( strcmp(x,"parse_failure")==0 ){ + psp->declargslot = &(psp->gp->failure); + }else if( strcmp(x,"stack_overflow")==0 ){ + psp->declargslot = &(psp->gp->overflow); + }else if( strcmp(x,"extra_argument")==0 ){ + psp->declargslot = &(psp->gp->arg); + psp->insertLineMacro = 0; + }else if( strcmp(x,"extra_context")==0 ){ + psp->declargslot = &(psp->gp->ctx); + psp->insertLineMacro = 0; + }else if( strcmp(x,"token_type")==0 ){ + psp->declargslot = &(psp->gp->tokentype); + psp->insertLineMacro = 0; + }else if( strcmp(x,"default_type")==0 ){ + psp->declargslot = &(psp->gp->vartype); + psp->insertLineMacro = 0; + }else if( strcmp(x,"realloc")==0 ){ + psp->declargslot = &(psp->gp->reallocFunc); + psp->insertLineMacro = 0; + }else if( strcmp(x,"free")==0 ){ + psp->declargslot = &(psp->gp->freeFunc); + psp->insertLineMacro = 0; + }else if( strcmp(x,"stack_size")==0 ){ + psp->declargslot = &(psp->gp->stacksize); + psp->insertLineMacro = 0; + }else if( strcmp(x,"start_symbol")==0 ){ + psp->declargslot = &(psp->gp->start); + psp->insertLineMacro = 0; + }else if( strcmp(x,"left")==0 ){ + psp->preccounter++; + psp->declassoc = LEFT; + psp->state = WAITING_FOR_PRECEDENCE_SYMBOL; + }else if( strcmp(x,"right")==0 ){ + psp->preccounter++; + psp->declassoc = RIGHT; + psp->state = WAITING_FOR_PRECEDENCE_SYMBOL; + }else if( strcmp(x,"nonassoc")==0 ){ + psp->preccounter++; + psp->declassoc = NONE; + psp->state = WAITING_FOR_PRECEDENCE_SYMBOL; + }else if( strcmp(x,"destructor")==0 ){ + psp->state = WAITING_FOR_DESTRUCTOR_SYMBOL; + }else if( strcmp(x,"type")==0 ){ + psp->state = WAITING_FOR_DATATYPE_SYMBOL; + }else if( strcmp(x,"fallback")==0 ){ + psp->fallback = 0; + psp->state = WAITING_FOR_FALLBACK_ID; + }else if( strcmp(x,"token")==0 ){ + psp->state = WAITING_FOR_TOKEN_NAME; + }else if( strcmp(x,"wildcard")==0 ){ + psp->state = WAITING_FOR_WILDCARD_ID; + }else if( strcmp(x,"token_class")==0 ){ + psp->state = WAITING_FOR_CLASS_ID; + }else{ + ErrorMsg(psp->filename,psp->tokenlineno, + "Unknown declaration keyword: \"%%%s\".",x); + psp->errorcnt++; + psp->state = RESYNC_AFTER_DECL_ERROR; + } + }else{ + ErrorMsg(psp->filename,psp->tokenlineno, + "Illegal declaration keyword: \"%s\".",x); + psp->errorcnt++; + psp->state = RESYNC_AFTER_DECL_ERROR; + } + break; + case WAITING_FOR_DESTRUCTOR_SYMBOL: + if( !ISALPHA(x[0]) ){ + ErrorMsg(psp->filename,psp->tokenlineno, + "Symbol name missing after %%destructor keyword"); + psp->errorcnt++; + psp->state = RESYNC_AFTER_DECL_ERROR; + }else{ + struct symbol *sp = Symbol_new(x); + psp->declargslot = &sp->destructor; + psp->decllinenoslot = &sp->destLineno; + psp->insertLineMacro = 1; + psp->state = WAITING_FOR_DECL_ARG; + } + break; + case WAITING_FOR_DATATYPE_SYMBOL: + if( !ISALPHA(x[0]) ){ + ErrorMsg(psp->filename,psp->tokenlineno, + "Symbol name missing after %%type keyword"); + psp->errorcnt++; + psp->state = RESYNC_AFTER_DECL_ERROR; + }else{ + struct symbol *sp = Symbol_find(x); + if((sp) && (sp->datatype)){ + ErrorMsg(psp->filename,psp->tokenlineno, + "Symbol %%type \"%s\" already defined", x); + psp->errorcnt++; + psp->state = RESYNC_AFTER_DECL_ERROR; + }else{ + if (!sp){ + sp = Symbol_new(x); + } + psp->declargslot = &sp->datatype; + psp->insertLineMacro = 0; + psp->state = WAITING_FOR_DECL_ARG; + } + } + break; + case WAITING_FOR_PRECEDENCE_SYMBOL: + if( x[0]=='.' ){ + psp->state = WAITING_FOR_DECL_OR_RULE; + }else if( ISUPPER(x[0]) ){ + struct symbol *sp; + sp = Symbol_new(x); + if( sp->prec>=0 ){ + ErrorMsg(psp->filename,psp->tokenlineno, + "Symbol \"%s\" has already be given a precedence.",x); + psp->errorcnt++; + }else{ + sp->prec = psp->preccounter; + sp->assoc = psp->declassoc; + } + }else{ + ErrorMsg(psp->filename,psp->tokenlineno, + "Can't assign a precedence to \"%s\".",x); + psp->errorcnt++; + } + break; + case WAITING_FOR_DECL_ARG: + if( x[0]=='{' || x[0]=='\"' || ISALNUM(x[0]) ){ + const char *zOld, *zNew; + char *zBuf, *z; + int nOld, n, nLine = 0, nNew, nBack; + int addLineMacro; + char zLine[50]; + zNew = x; + if( zNew[0]=='"' || zNew[0]=='{' ) zNew++; + nNew = lemonStrlen(zNew); + if( *psp->declargslot ){ + zOld = *psp->declargslot; + }else{ + zOld = ""; + } + nOld = lemonStrlen(zOld); + n = nOld + nNew + 20; + addLineMacro = !psp->gp->nolinenosflag + && psp->insertLineMacro + && psp->tokenlineno>1 + && (psp->decllinenoslot==0 || psp->decllinenoslot[0]!=0); + if( addLineMacro ){ + for(z=psp->filename, nBack=0; *z; z++){ + if( *z=='\\' ) nBack++; + } + lemon_sprintf(zLine, "#line %d ", psp->tokenlineno); + nLine = lemonStrlen(zLine); + n += nLine + lemonStrlen(psp->filename) + nBack; + } + *psp->declargslot = (char *) lemon_realloc(*psp->declargslot, n); + zBuf = *psp->declargslot + nOld; + if( addLineMacro ){ + if( nOld && zBuf[-1]!='\n' ){ + *(zBuf++) = '\n'; + } + memcpy(zBuf, zLine, nLine); + zBuf += nLine; + *(zBuf++) = '"'; + for(z=psp->filename; *z; z++){ + if( *z=='\\' ){ + *(zBuf++) = '\\'; + } + *(zBuf++) = *z; + } + *(zBuf++) = '"'; + *(zBuf++) = '\n'; + } + if( psp->decllinenoslot && psp->decllinenoslot[0]==0 ){ + psp->decllinenoslot[0] = psp->tokenlineno; + } + memcpy(zBuf, zNew, nNew); + zBuf += nNew; + *zBuf = 0; + psp->state = WAITING_FOR_DECL_OR_RULE; + }else{ + ErrorMsg(psp->filename,psp->tokenlineno, + "Illegal argument to %%%s: %s",psp->declkeyword,x); + psp->errorcnt++; + psp->state = RESYNC_AFTER_DECL_ERROR; + } + break; + case WAITING_FOR_FALLBACK_ID: + if( x[0]=='.' ){ + psp->state = WAITING_FOR_DECL_OR_RULE; + }else if( !ISUPPER(x[0]) ){ + ErrorMsg(psp->filename, psp->tokenlineno, + "%%fallback argument \"%s\" should be a token", x); + psp->errorcnt++; + }else{ + struct symbol *sp = Symbol_new(x); + if( psp->fallback==0 ){ + psp->fallback = sp; + }else if( sp->fallback ){ + ErrorMsg(psp->filename, psp->tokenlineno, + "More than one fallback assigned to token %s", x); + psp->errorcnt++; + }else{ + sp->fallback = psp->fallback; + psp->gp->has_fallback = 1; + } + } + break; + case WAITING_FOR_TOKEN_NAME: + /* Tokens do not have to be declared before use. But they can be + ** in order to control their assigned integer number. The number for + ** each token is assigned when it is first seen. So by including + ** + ** %token ONE TWO THREE. + ** + ** early in the grammar file, that assigns small consecutive values + ** to each of the tokens ONE TWO and THREE. + */ + if( x[0]=='.' ){ + psp->state = WAITING_FOR_DECL_OR_RULE; + }else if( !ISUPPER(x[0]) ){ + ErrorMsg(psp->filename, psp->tokenlineno, + "%%token argument \"%s\" should be a token", x); + psp->errorcnt++; + }else{ + (void)Symbol_new(x); + } + break; + case WAITING_FOR_WILDCARD_ID: + if( x[0]=='.' ){ + psp->state = WAITING_FOR_DECL_OR_RULE; + }else if( !ISUPPER(x[0]) ){ + ErrorMsg(psp->filename, psp->tokenlineno, + "%%wildcard argument \"%s\" should be a token", x); + psp->errorcnt++; + }else{ + struct symbol *sp = Symbol_new(x); + if( psp->gp->wildcard==0 ){ + psp->gp->wildcard = sp; + }else{ + ErrorMsg(psp->filename, psp->tokenlineno, + "Extra wildcard to token: %s", x); + psp->errorcnt++; + } + } + break; + case WAITING_FOR_CLASS_ID: + if( !ISLOWER(x[0]) ){ + ErrorMsg(psp->filename, psp->tokenlineno, + "%%token_class must be followed by an identifier: %s", x); + psp->errorcnt++; + psp->state = RESYNC_AFTER_DECL_ERROR; + }else if( Symbol_find(x) ){ + ErrorMsg(psp->filename, psp->tokenlineno, + "Symbol \"%s\" already used", x); + psp->errorcnt++; + psp->state = RESYNC_AFTER_DECL_ERROR; + }else{ + psp->tkclass = Symbol_new(x); + psp->tkclass->type = MULTITERMINAL; + psp->state = WAITING_FOR_CLASS_TOKEN; + } + break; + case WAITING_FOR_CLASS_TOKEN: + if( x[0]=='.' ){ + psp->state = WAITING_FOR_DECL_OR_RULE; + }else if( ISUPPER(x[0]) || ((x[0]=='|' || x[0]=='/') && ISUPPER(x[1])) ){ + struct symbol *msp = psp->tkclass; + msp->nsubsym++; + msp->subsym = (struct symbol **) lemon_realloc(msp->subsym, + sizeof(struct symbol*)*msp->nsubsym); + if( !ISUPPER(x[0]) ) x++; + msp->subsym[msp->nsubsym-1] = Symbol_new(x); + }else{ + ErrorMsg(psp->filename, psp->tokenlineno, + "%%token_class argument \"%s\" should be a token", x); + psp->errorcnt++; + psp->state = RESYNC_AFTER_DECL_ERROR; + } + break; + case RESYNC_AFTER_RULE_ERROR: +/* if( x[0]=='.' ) psp->state = WAITING_FOR_DECL_OR_RULE; +** break; */ + case RESYNC_AFTER_DECL_ERROR: + if( x[0]=='.' ) psp->state = WAITING_FOR_DECL_OR_RULE; + if( x[0]=='%' ) psp->state = WAITING_FOR_DECL_KEYWORD; + break; + } +} + +/* The text in the input is part of the argument to an %ifdef or %ifndef. +** Evaluate the text as a boolean expression. Return true or false. +*/ +static int eval_preprocessor_boolean(char *z, int lineno){ + int neg = 0; + int res = 0; + int okTerm = 1; + int i; + for(i=0; z[i]!=0; i++){ + if( ISSPACE(z[i]) ) continue; + if( z[i]=='!' ){ + if( !okTerm ) goto pp_syntax_error; + neg = !neg; + continue; + } + if( z[i]=='|' && z[i+1]=='|' ){ + if( okTerm ) goto pp_syntax_error; + if( res ) return 1; + i++; + okTerm = 1; + continue; + } + if( z[i]=='&' && z[i+1]=='&' ){ + if( okTerm ) goto pp_syntax_error; + if( !res ) return 0; + i++; + okTerm = 1; + continue; + } + if( z[i]=='(' ){ + int k; + int n = 1; + if( !okTerm ) goto pp_syntax_error; + for(k=i+1; z[k]; k++){ + if( z[k]==')' ){ + n--; + if( n==0 ){ + z[k] = 0; + res = eval_preprocessor_boolean(&z[i+1], -1); + z[k] = ')'; + if( res<0 ){ + i = i-res; + goto pp_syntax_error; + } + i = k; + break; + } + }else if( z[k]=='(' ){ + n++; + }else if( z[k]==0 ){ + i = k; + goto pp_syntax_error; + } + } + if( neg ){ + res = !res; + neg = 0; + } + okTerm = 0; + continue; + } + if( ISALPHA(z[i]) ){ + int j, k, n; + if( !okTerm ) goto pp_syntax_error; + for(k=i+1; ISALNUM(z[k]) || z[k]=='_'; k++){} + n = k - i; + res = 0; + for(j=0; j0 ){ + fprintf(stderr, "%%if syntax error on line %d.\n", lineno); + fprintf(stderr, " %.*s <-- syntax error here\n", i+1, z); + exit(1); + }else{ + return -(i+1); + } +} + +/* Run the preprocessor over the input file text. The global variables +** azDefine[0] through azDefine[nDefine-1] contains the names of all defined +** macros. This routine looks for "%ifdef" and "%ifndef" and "%endif" and +** comments them out. Text in between is also commented out as appropriate. +*/ +static void preprocess_input(char *z){ + int i, j, k; + int exclude = 0; + int start = 0; + int lineno = 1; + int start_lineno = 1; + for(i=0; z[i]; i++){ + if( z[i]=='\n' ) lineno++; + if( z[i]!='%' || (i>0 && z[i-1]!='\n') ) continue; + if( strncmp(&z[i],"%endif",6)==0 && ISSPACE(z[i+6]) ){ + if( exclude ){ + exclude--; + if( exclude==0 ){ + for(j=start; jfilename; + ps.errorcnt = 0; + ps.state = INITIALIZE; + + /* Begin by reading the input file */ + fp = fopen(ps.filename,"rb"); + if( fp==0 ){ + ErrorMsg(ps.filename,0,"Can't open this file for reading."); + gp->errorcnt++; + return; + } + fseek(fp,0,2); + filesize = ftell(fp); + rewind(fp); + filebuf = (char *)lemon_malloc( filesize+1 ); + if( filesize>100000000 || filebuf==0 ){ + ErrorMsg(ps.filename,0,"Input file too large."); + lemon_free(filebuf); + gp->errorcnt++; + fclose(fp); + return; + } + if( fread(filebuf,1,filesize,fp)!=filesize ){ + ErrorMsg(ps.filename,0,"Can't read in all %d bytes of this file.", + filesize); + lemon_free(filebuf); + gp->errorcnt++; + fclose(fp); + return; + } + fclose(fp); + filebuf[filesize] = 0; + + /* Make an initial pass through the file to handle %ifdef and %ifndef */ + preprocess_input(filebuf); + if( gp->printPreprocessed ){ + printf("%s\n", filebuf); + return; + } + + /* Now scan the text of the input file */ + lineno = 1; + for(cp=filebuf; (c= *cp)!=0; ){ + if( c=='\n' ) lineno++; /* Keep track of the line number */ + if( ISSPACE(c) ){ cp++; continue; } /* Skip all white space */ + if( c=='/' && cp[1]=='/' ){ /* Skip C++ style comments */ + cp+=2; + while( (c= *cp)!=0 && c!='\n' ) cp++; + continue; + } + if( c=='/' && cp[1]=='*' ){ /* Skip C style comments */ + cp+=2; + if( (*cp)=='/' ) cp++; + while( (c= *cp)!=0 && (c!='/' || cp[-1]!='*') ){ + if( c=='\n' ) lineno++; + cp++; + } + if( c ) cp++; + continue; + } + ps.tokenstart = cp; /* Mark the beginning of the token */ + ps.tokenlineno = lineno; /* Linenumber on which token begins */ + if( c=='\"' ){ /* String literals */ + cp++; + while( (c= *cp)!=0 && c!='\"' ){ + if( c=='\n' ) lineno++; + cp++; + } + if( c==0 ){ + ErrorMsg(ps.filename,startline, + "String starting on this line is not terminated before " + "the end of the file."); + ps.errorcnt++; + nextcp = cp; + }else{ + nextcp = cp+1; + } + }else if( c=='{' ){ /* A block of C code */ + int level; + cp++; + for(level=1; (c= *cp)!=0 && (level>1 || c!='}'); cp++){ + if( c=='\n' ) lineno++; + else if( c=='{' ) level++; + else if( c=='}' ) level--; + else if( c=='/' && cp[1]=='*' ){ /* Skip comments */ + int prevc; + cp = &cp[2]; + prevc = 0; + while( (c= *cp)!=0 && (c!='/' || prevc!='*') ){ + if( c=='\n' ) lineno++; + prevc = c; + cp++; + } + }else if( c=='/' && cp[1]=='/' ){ /* Skip C++ style comments too */ + cp = &cp[2]; + while( (c= *cp)!=0 && c!='\n' ) cp++; + if( c ) lineno++; + }else if( c=='\'' || c=='\"' ){ /* String a character literals */ + int startchar, prevc; + startchar = c; + prevc = 0; + for(cp++; (c= *cp)!=0 && (c!=startchar || prevc=='\\'); cp++){ + if( c=='\n' ) lineno++; + if( prevc=='\\' ) prevc = 0; + else prevc = c; + } + } + } + if( c==0 ){ + ErrorMsg(ps.filename,ps.tokenlineno, + "C code starting on this line is not terminated before " + "the end of the file."); + ps.errorcnt++; + nextcp = cp; + }else{ + nextcp = cp+1; + } + }else if( ISALNUM(c) ){ /* Identifiers */ + while( (c= *cp)!=0 && (ISALNUM(c) || c=='_') ) cp++; + nextcp = cp; + }else if( c==':' && cp[1]==':' && cp[2]=='=' ){ /* The operator "::=" */ + cp += 3; + nextcp = cp; + }else if( (c=='/' || c=='|') && ISALPHA(cp[1]) ){ + cp += 2; + while( (c = *cp)!=0 && (ISALNUM(c) || c=='_') ) cp++; + nextcp = cp; + }else{ /* All other (one character) operators */ + cp++; + nextcp = cp; + } + c = *cp; + *cp = 0; /* Null terminate the token */ + parseonetoken(&ps); /* Parse the token */ + *cp = (char)c; /* Restore the buffer */ + cp = nextcp; + } + lemon_free(filebuf); /* Release the buffer after parsing */ + gp->rule = ps.firstrule; + gp->errorcnt = ps.errorcnt; +} +/*************************** From the file "plink.c" *********************/ +/* +** Routines processing configuration follow-set propagation links +** in the LEMON parser generator. +*/ +static struct plink *plink_freelist = 0; + +/* Allocate a new plink */ +struct plink *Plink_new(void){ + struct plink *newlink; + + if( plink_freelist==0 ){ + int i; + int amt = 100; + plink_freelist = (struct plink *)lemon_calloc( amt, sizeof(struct plink) ); + if( plink_freelist==0 ){ + fprintf(stderr, + "Unable to allocate memory for a new follow-set propagation link.\n"); + exit(1); + } + for(i=0; inext; + return newlink; +} + +/* Add a plink to a plink list */ +void Plink_add(struct plink **plpp, struct config *cfp) +{ + struct plink *newlink; + newlink = Plink_new(); + newlink->next = *plpp; + *plpp = newlink; + newlink->cfp = cfp; +} + +/* Transfer every plink on the list "from" to the list "to" */ +void Plink_copy(struct plink **to, struct plink *from) +{ + struct plink *nextpl; + while( from ){ + nextpl = from->next; + from->next = *to; + *to = from; + from = nextpl; + } +} + +/* Delete every plink on the list */ +void Plink_delete(struct plink *plp) +{ + struct plink *nextpl; + + while( plp ){ + nextpl = plp->next; + plp->next = plink_freelist; + plink_freelist = plp; + plp = nextpl; + } +} +/*********************** From the file "report.c" **************************/ +/* +** Procedures for generating reports and tables in the LEMON parser generator. +*/ + +/* Generate a filename with the given suffix. +*/ +PRIVATE char *file_makename(struct lemon *lemp, const char *suffix) +{ + char *name; + char *cp; + char *filename = lemp->filename; + int sz; + + if( outputDir ){ + cp = strrchr(filename, '/'); + if( cp ) filename = cp + 1; + } + sz = lemonStrlen(filename); + sz += lemonStrlen(suffix); + if( outputDir ) sz += lemonStrlen(outputDir) + 1; + sz += 5; + name = (char*)lemon_malloc( sz ); + if( name==0 ){ + fprintf(stderr,"Can't allocate space for a filename.\n"); + exit(1); + } + name[0] = 0; + if( outputDir ){ + lemon_strcpy(name, outputDir); + lemon_strcat(name, "/"); + } + lemon_strcat(name,filename); + cp = strrchr(name,'.'); + if( cp ) *cp = 0; + lemon_strcat(name,suffix); + return name; +} + +/* Open a file with a name based on the name of the input file, +** but with a different (specified) suffix, and return a pointer +** to the stream */ +PRIVATE FILE *file_open( + struct lemon *lemp, + const char *suffix, + const char *mode +){ + FILE *fp; + + if( lemp->outname ) lemon_free(lemp->outname); + lemp->outname = file_makename(lemp, suffix); + fp = fopen(lemp->outname,mode); + if( fp==0 && *mode=='w' ){ + fprintf(stderr,"Can't open file \"%s\".\n",lemp->outname); + lemp->errorcnt++; + return 0; + } + return fp; +} + +/* Print the text of a rule +*/ +void rule_print(FILE *out, struct rule *rp){ + int i, j; + fprintf(out, "%s",rp->lhs->name); + /* if( rp->lhsalias ) fprintf(out,"(%s)",rp->lhsalias); */ + fprintf(out," ::="); + for(i=0; inrhs; i++){ + struct symbol *sp = rp->rhs[i]; + if( sp->type==MULTITERMINAL ){ + fprintf(out," %s", sp->subsym[0]->name); + for(j=1; jnsubsym; j++){ + fprintf(out,"|%s", sp->subsym[j]->name); + } + }else{ + fprintf(out," %s", sp->name); + } + /* if( rp->rhsalias[i] ) fprintf(out,"(%s)",rp->rhsalias[i]); */ + } +} + +/* Duplicate the input file without comments and without actions +** on rules */ +void Reprint(struct lemon *lemp) +{ + struct rule *rp; + struct symbol *sp; + int i, j, maxlen, len, ncolumns, skip; + printf("// Reprint of input file \"%s\".\n// Symbols:\n",lemp->filename); + maxlen = 10; + for(i=0; insymbol; i++){ + sp = lemp->symbols[i]; + len = lemonStrlen(sp->name); + if( len>maxlen ) maxlen = len; + } + ncolumns = 76/(maxlen+5); + if( ncolumns<1 ) ncolumns = 1; + skip = (lemp->nsymbol + ncolumns - 1)/ncolumns; + for(i=0; insymbol; j+=skip){ + sp = lemp->symbols[j]; + assert( sp->index==j ); + printf(" %3d %-*.*s",j,maxlen,maxlen,sp->name); + } + printf("\n"); + } + for(rp=lemp->rule; rp; rp=rp->next){ + rule_print(stdout, rp); + printf("."); + if( rp->precsym ) printf(" [%s]",rp->precsym->name); + /* if( rp->code ) printf("\n %s",rp->code); */ + printf("\n"); + } +} + +/* Print a single rule. +*/ +void RulePrint(FILE *fp, struct rule *rp, int iCursor){ + struct symbol *sp; + int i, j; + fprintf(fp,"%s ::=",rp->lhs->name); + for(i=0; i<=rp->nrhs; i++){ + if( i==iCursor ) fprintf(fp," *"); + if( i==rp->nrhs ) break; + sp = rp->rhs[i]; + if( sp->type==MULTITERMINAL ){ + fprintf(fp," %s", sp->subsym[0]->name); + for(j=1; jnsubsym; j++){ + fprintf(fp,"|%s",sp->subsym[j]->name); + } + }else{ + fprintf(fp," %s", sp->name); + } + } +} + +/* Print the rule for a configuration. +*/ +void ConfigPrint(FILE *fp, struct config *cfp){ + RulePrint(fp, cfp->rp, cfp->dot); +} + +/* #define TEST */ +#if 0 +/* Print a set */ +PRIVATE void SetPrint(out,set,lemp) +FILE *out; +char *set; +struct lemon *lemp; +{ + int i; + char *spacer; + spacer = ""; + fprintf(out,"%12s[",""); + for(i=0; interminal; i++){ + if( SetFind(set,i) ){ + fprintf(out,"%s%s",spacer,lemp->symbols[i]->name); + spacer = " "; + } + } + fprintf(out,"]\n"); +} + +/* Print a plink chain */ +PRIVATE void PlinkPrint(out,plp,tag) +FILE *out; +struct plink *plp; +char *tag; +{ + while( plp ){ + fprintf(out,"%12s%s (state %2d) ","",tag,plp->cfp->stp->statenum); + ConfigPrint(out,plp->cfp); + fprintf(out,"\n"); + plp = plp->next; + } +} +#endif + +/* Print an action to the given file descriptor. Return FALSE if +** nothing was actually printed. +*/ +int PrintAction( + struct action *ap, /* The action to print */ + FILE *fp, /* Print the action here */ + int indent /* Indent by this amount */ +){ + int result = 1; + switch( ap->type ){ + case SHIFT: { + struct state *stp = ap->x.stp; + fprintf(fp,"%*s shift %-7d",indent,ap->sp->name,stp->statenum); + break; + } + case REDUCE: { + struct rule *rp = ap->x.rp; + fprintf(fp,"%*s reduce %-7d",indent,ap->sp->name,rp->iRule); + RulePrint(fp, rp, -1); + break; + } + case SHIFTREDUCE: { + struct rule *rp = ap->x.rp; + fprintf(fp,"%*s shift-reduce %-7d",indent,ap->sp->name,rp->iRule); + RulePrint(fp, rp, -1); + break; + } + case ACCEPT: + fprintf(fp,"%*s accept",indent,ap->sp->name); + break; + case ERROR: + fprintf(fp,"%*s error",indent,ap->sp->name); + break; + case SRCONFLICT: + case RRCONFLICT: + fprintf(fp,"%*s reduce %-7d ** Parsing conflict **", + indent,ap->sp->name,ap->x.rp->iRule); + break; + case SSCONFLICT: + fprintf(fp,"%*s shift %-7d ** Parsing conflict **", + indent,ap->sp->name,ap->x.stp->statenum); + break; + case SH_RESOLVED: + if( showPrecedenceConflict ){ + fprintf(fp,"%*s shift %-7d -- dropped by precedence", + indent,ap->sp->name,ap->x.stp->statenum); + }else{ + result = 0; + } + break; + case RD_RESOLVED: + if( showPrecedenceConflict ){ + fprintf(fp,"%*s reduce %-7d -- dropped by precedence", + indent,ap->sp->name,ap->x.rp->iRule); + }else{ + result = 0; + } + break; + case NOT_USED: + result = 0; + break; + } + if( result && ap->spOpt ){ + fprintf(fp," /* because %s==%s */", ap->sp->name, ap->spOpt->name); + } + return result; +} + +/* Generate the "*.out" log file */ +void ReportOutput(struct lemon *lemp) +{ + int i, n; + struct state *stp; + struct config *cfp; + struct action *ap; + struct rule *rp; + FILE *fp; + + fp = file_open(lemp,".out","wb"); + if( fp==0 ) return; + for(i=0; inxstate; i++){ + stp = lemp->sorted[i]; + fprintf(fp,"State %d:\n",stp->statenum); + if( lemp->basisflag ) cfp=stp->bp; + else cfp=stp->cfp; + while( cfp ){ + char buf[20]; + if( cfp->dot==cfp->rp->nrhs ){ + lemon_sprintf(buf,"(%d)",cfp->rp->iRule); + fprintf(fp," %5s ",buf); + }else{ + fprintf(fp," "); + } + ConfigPrint(fp,cfp); + fprintf(fp,"\n"); +#if 0 + SetPrint(fp,cfp->fws,lemp); + PlinkPrint(fp,cfp->fplp,"To "); + PlinkPrint(fp,cfp->bplp,"From"); +#endif + if( lemp->basisflag ) cfp=cfp->bp; + else cfp=cfp->next; + } + fprintf(fp,"\n"); + for(ap=stp->ap; ap; ap=ap->next){ + if( PrintAction(ap,fp,30) ) fprintf(fp,"\n"); + } + fprintf(fp,"\n"); + } + fprintf(fp, "----------------------------------------------------\n"); + fprintf(fp, "Symbols:\n"); + fprintf(fp, "The first-set of non-terminals is shown after the name.\n\n"); + for(i=0; insymbol; i++){ + int j; + struct symbol *sp; + + sp = lemp->symbols[i]; + fprintf(fp, " %3d: %s", i, sp->name); + if( sp->type==NONTERMINAL ){ + fprintf(fp, ":"); + if( sp->lambda ){ + fprintf(fp, " "); + } + for(j=0; jnterminal; j++){ + if( sp->firstset && SetFind(sp->firstset, j) ){ + fprintf(fp, " %s", lemp->symbols[j]->name); + } + } + } + if( sp->prec>=0 ) fprintf(fp," (precedence=%d)", sp->prec); + fprintf(fp, "\n"); + } + fprintf(fp, "----------------------------------------------------\n"); + fprintf(fp, "Syntax-only Symbols:\n"); + fprintf(fp, "The following symbols never carry semantic content.\n\n"); + for(i=n=0; insymbol; i++){ + int w; + struct symbol *sp = lemp->symbols[i]; + if( sp->bContent ) continue; + w = (int)strlen(sp->name); + if( n>0 && n+w>75 ){ + fprintf(fp,"\n"); + n = 0; + } + if( n>0 ){ + fprintf(fp, " "); + n++; + } + fprintf(fp, "%s", sp->name); + n += w; + } + if( n>0 ) fprintf(fp, "\n"); + fprintf(fp, "----------------------------------------------------\n"); + fprintf(fp, "Rules:\n"); + for(rp=lemp->rule; rp; rp=rp->next){ + fprintf(fp, "%4d: ", rp->iRule); + rule_print(fp, rp); + fprintf(fp,"."); + if( rp->precsym ){ + fprintf(fp," [%s precedence=%d]", + rp->precsym->name, rp->precsym->prec); + } + fprintf(fp,"\n"); + } + fclose(fp); + return; +} + +/* Search for the file "name" which is in the same directory as +** the executable */ +PRIVATE char *pathsearch(char *argv0, char *name, int modemask) +{ + const char *pathlist; + char *pathbufptr = 0; + char *pathbuf = 0; + char *path,*cp; + char c; + +#ifdef __WIN32__ + cp = strrchr(argv0,'\\'); +#else + cp = strrchr(argv0,'/'); +#endif + if( cp ){ + c = *cp; + *cp = 0; + path = (char *)lemon_malloc( lemonStrlen(argv0) + lemonStrlen(name) + 2 ); + if( path ) lemon_sprintf(path,"%s/%s",argv0,name); + *cp = c; + }else{ + pathlist = getenv("PATH"); + if( pathlist==0 ) pathlist = ".:/bin:/usr/bin"; + pathbuf = (char *) lemon_malloc( lemonStrlen(pathlist) + 1 ); + path = (char *)lemon_malloc( lemonStrlen(pathlist)+lemonStrlen(name)+2 ); + if( (pathbuf != 0) && (path!=0) ){ + pathbufptr = pathbuf; + lemon_strcpy(pathbuf, pathlist); + while( *pathbuf ){ + cp = strchr(pathbuf,':'); + if( cp==0 ) cp = &pathbuf[lemonStrlen(pathbuf)]; + c = *cp; + *cp = 0; + lemon_sprintf(path,"%s/%s",pathbuf,name); + *cp = c; + if( c==0 ) pathbuf[0] = 0; + else pathbuf = &cp[1]; + if( access(path,modemask)==0 ) break; + } + } + lemon_free(pathbufptr); + } + return path; +} + +/* Given an action, compute the integer value for that action +** which is to be put in the action table of the generated machine. +** Return negative if no action should be generated. +*/ +PRIVATE int compute_action(struct lemon *lemp, struct action *ap) +{ + int act; + switch( ap->type ){ + case SHIFT: act = ap->x.stp->statenum; break; + case SHIFTREDUCE: { + /* Since a SHIFT is inherient after a prior REDUCE, convert any + ** SHIFTREDUCE action with a nonterminal on the LHS into a simple + ** REDUCE action: */ + if( ap->sp->index>=lemp->nterminal + && (lemp->errsym==0 || ap->sp->index!=lemp->errsym->index) + ){ + act = lemp->minReduce + ap->x.rp->iRule; + }else{ + act = lemp->minShiftReduce + ap->x.rp->iRule; + } + break; + } + case REDUCE: act = lemp->minReduce + ap->x.rp->iRule; break; + case ERROR: act = lemp->errAction; break; + case ACCEPT: act = lemp->accAction; break; + default: act = -1; break; + } + return act; +} + +#define LINESIZE 1000 +/* The next cluster of routines are for reading the template file +** and writing the results to the generated parser */ +/* The first function transfers data from "in" to "out" until +** a line is seen which begins with "%%". The line number is +** tracked. +** +** if name!=0, then any word that begin with "Parse" is changed to +** begin with *name instead. +*/ +PRIVATE void tplt_xfer(char *name, FILE *in, FILE *out, int *lineno) +{ + int i, iStart; + char line[LINESIZE]; + while( fgets(line,LINESIZE,in) && (line[0]!='%' || line[1]!='%') ){ + (*lineno)++; + iStart = 0; + if( name ){ + for(i=0; line[i]; i++){ + if( line[i]=='P' && strncmp(&line[i],"Parse",5)==0 + && (i==0 || !ISALPHA(line[i-1])) + ){ + if( i>iStart ) fprintf(out,"%.*s",i-iStart,&line[iStart]); + fprintf(out,"%s",name); + i += 4; + iStart = i+1; + } + } + } + fprintf(out,"%s",&line[iStart]); + } +} + +/* Skip forward past the header of the template file to the first "%%" +*/ +PRIVATE void tplt_skip_header(FILE *in, int *lineno) +{ + char line[LINESIZE]; + while( fgets(line,LINESIZE,in) && (line[0]!='%' || line[1]!='%') ){ + (*lineno)++; + } +} + +/* The next function finds the template file and opens it, returning +** a pointer to the opened file. */ +PRIVATE FILE *tplt_open(struct lemon *lemp) +{ + static char templatename[] = "lempar.c"; + char buf[1000]; + FILE *in; + char *tpltname; + char *toFree = 0; + char *cp; + + /* first, see if user specified a template filename on the command line. */ + if (user_templatename != 0) { + if( access(user_templatename,004)==-1 ){ + fprintf(stderr,"Can't find the parser driver template file \"%s\".\n", + user_templatename); + lemp->errorcnt++; + return 0; + } + in = fopen(user_templatename,"rb"); + if( in==0 ){ + fprintf(stderr,"Can't open the template file \"%s\".\n", + user_templatename); + lemp->errorcnt++; + return 0; + } + return in; + } + + cp = strrchr(lemp->filename,'.'); + if( cp ){ + lemon_sprintf(buf,"%.*s.lt",(int)(cp-lemp->filename),lemp->filename); + }else{ + lemon_sprintf(buf,"%s.lt",lemp->filename); + } + if( access(buf,004)==0 ){ + tpltname = buf; + }else if( access(templatename,004)==0 ){ + tpltname = templatename; + }else{ + toFree = tpltname = pathsearch(lemp->argv[0],templatename,0); + } + if( tpltname==0 ){ + fprintf(stderr,"Can't find the parser driver template file \"%s\".\n", + templatename); + lemp->errorcnt++; + return 0; + } + in = fopen(tpltname,"rb"); + if( in==0 ){ + fprintf(stderr,"Can't open the template file \"%s\".\n",tpltname); + lemp->errorcnt++; + } + lemon_free(toFree); + return in; +} + +/* Print a #line directive line to the output file. */ +PRIVATE void tplt_linedir(FILE *out, int lineno, char *filename) +{ + fprintf(out,"#line %d \"",lineno); + while( *filename ){ + if( *filename == '\\' ) putc('\\',out); + putc(*filename,out); + filename++; + } + fprintf(out,"\"\n"); +} + +/* Print a string to the file and keep the linenumber up to date */ +PRIVATE void tplt_print(FILE *out, struct lemon *lemp, char *str, int *lineno) +{ + if( str==0 ) return; + while( *str ){ + putc(*str,out); + if( *str=='\n' ) (*lineno)++; + str++; + } + if( str[-1]!='\n' ){ + putc('\n',out); + (*lineno)++; + } + if (!lemp->nolinenosflag) { + (*lineno)++; tplt_linedir(out,*lineno,lemp->outname); + } + return; +} + +/* +** The following routine emits code for the destructor for the +** symbol sp +*/ +void emit_destructor_code( + FILE *out, + struct symbol *sp, + struct lemon *lemp, + int *lineno +){ + char *cp = 0; + + if( sp->type==TERMINAL ){ + cp = lemp->tokendest; + if( cp==0 ) return; + fprintf(out,"{\n"); (*lineno)++; + }else if( sp->destructor ){ + cp = sp->destructor; + fprintf(out,"{\n"); (*lineno)++; + if( !lemp->nolinenosflag ){ + (*lineno)++; + tplt_linedir(out,sp->destLineno,lemp->filename); + } + }else if( lemp->vardest ){ + cp = lemp->vardest; + if( cp==0 ) return; + fprintf(out,"{\n"); (*lineno)++; + }else{ + assert( 0 ); /* Cannot happen */ + } + for(; *cp; cp++){ + if( *cp=='$' && cp[1]=='$' ){ + fprintf(out,"(yypminor->yy%d)",sp->dtnum); + cp++; + continue; + } + if( *cp=='\n' ) (*lineno)++; + fputc(*cp,out); + } + fprintf(out,"\n"); (*lineno)++; + if (!lemp->nolinenosflag) { + (*lineno)++; tplt_linedir(out,*lineno,lemp->outname); + } + fprintf(out,"}\n"); (*lineno)++; + return; +} + +/* +** Return TRUE (non-zero) if the given symbol has a destructor. +*/ +int has_destructor(struct symbol *sp, struct lemon *lemp) +{ + int ret; + if( sp->type==TERMINAL ){ + ret = lemp->tokendest!=0; + }else{ + ret = lemp->vardest!=0 || sp->destructor!=0; + } + return ret; +} + +/* +** Append text to a dynamically allocated string. If zText is 0 then +** reset the string to be empty again. Always return the complete text +** of the string (which is overwritten with each call). +** +** n bytes of zText are stored. If n==0 then all of zText up to the first +** \000 terminator is stored. zText can contain up to two instances of +** %d. The values of p1 and p2 are written into the first and second +** %d. +** +** If n==-1, then the previous character is overwritten. +*/ +PRIVATE char *append_str(const char *zText, int n, int p1, int p2){ + static char empty[1] = { 0 }; + static char *z = 0; + static int alloced = 0; + static int used = 0; + int c; + char zInt[40]; + if( zText==0 ){ + if( used==0 && z!=0 ) z[0] = 0; + used = 0; + return z; + } + if( n<=0 ){ + if( n<0 ){ + used += n; + assert( used>=0 ); + } + n = lemonStrlen(zText); + } + if( (int) (n+sizeof(zInt)*2+used) >= alloced ){ + alloced = n + sizeof(zInt)*2 + used + 200; + z = (char *) lemon_realloc(z, alloced); + } + if( z==0 ) return empty; + while( n-- > 0 ){ + c = *(zText++); + if( c=='%' && n>0 && zText[0]=='d' ){ + lemon_sprintf(zInt, "%d", p1); + p1 = p2; + lemon_strcpy(&z[used], zInt); + used += lemonStrlen(&z[used]); + zText++; + n--; + }else{ + z[used++] = (char)c; + } + } + z[used] = 0; + return z; +} + +/* +** Write and transform the rp->code string so that symbols are expanded. +** Populate the rp->codePrefix and rp->codeSuffix strings, as appropriate. +** +** Return 1 if the expanded code requires that "yylhsminor" local variable +** to be defined. +*/ +PRIVATE int translate_code(struct lemon *lemp, struct rule *rp){ + char *cp, *xp; + int i; + int rc = 0; /* True if yylhsminor is used */ + int dontUseRhs0 = 0; /* If true, use of left-most RHS label is illegal */ + const char *zSkip = 0; /* The zOvwrt comment within rp->code, or NULL */ + char lhsused = 0; /* True if the LHS element has been used */ + char lhsdirect; /* True if LHS writes directly into stack */ + char used[MAXRHS]; /* True for each RHS element which is used */ + char zLhs[50]; /* Convert the LHS symbol into this string */ + char zOvwrt[900]; /* Comment that to allow LHS to overwrite RHS */ + + for(i=0; inrhs; i++) used[i] = 0; + lhsused = 0; + + if( rp->code==0 ){ + static char newlinestr[2] = { '\n', '\0' }; + rp->code = newlinestr; + rp->line = rp->ruleline; + rp->noCode = 1; + }else{ + rp->noCode = 0; + } + + + if( rp->nrhs==0 ){ + /* If there are no RHS symbols, then writing directly to the LHS is ok */ + lhsdirect = 1; + }else if( rp->rhsalias[0]==0 ){ + /* The left-most RHS symbol has no value. LHS direct is ok. But + ** we have to call the destructor on the RHS symbol first. */ + lhsdirect = 1; + if( has_destructor(rp->rhs[0],lemp) ){ + append_str(0,0,0,0); + append_str(" yy_destructor(yypParser,%d,&yymsp[%d].minor);\n", 0, + rp->rhs[0]->index,1-rp->nrhs); + rp->codePrefix = Strsafe(append_str(0,0,0,0)); + rp->noCode = 0; + } + }else if( rp->lhsalias==0 ){ + /* There is no LHS value symbol. */ + lhsdirect = 1; + }else if( strcmp(rp->lhsalias,rp->rhsalias[0])==0 ){ + /* The LHS symbol and the left-most RHS symbol are the same, so + ** direct writing is allowed */ + lhsdirect = 1; + lhsused = 1; + used[0] = 1; + if( rp->lhs->dtnum!=rp->rhs[0]->dtnum ){ + ErrorMsg(lemp->filename,rp->ruleline, + "%s(%s) and %s(%s) share the same label but have " + "different datatypes.", + rp->lhs->name, rp->lhsalias, rp->rhs[0]->name, rp->rhsalias[0]); + lemp->errorcnt++; + } + }else{ + lemon_sprintf(zOvwrt, "/*%s-overwrites-%s*/", + rp->lhsalias, rp->rhsalias[0]); + zSkip = strstr(rp->code, zOvwrt); + if( zSkip!=0 ){ + /* The code contains a special comment that indicates that it is safe + ** for the LHS label to overwrite left-most RHS label. */ + lhsdirect = 1; + }else{ + lhsdirect = 0; + } + } + if( lhsdirect ){ + sprintf(zLhs, "yymsp[%d].minor.yy%d",1-rp->nrhs,rp->lhs->dtnum); + }else{ + rc = 1; + sprintf(zLhs, "yylhsminor.yy%d",rp->lhs->dtnum); + } + + append_str(0,0,0,0); + + /* This const cast is wrong but harmless, if we're careful. */ + for(cp=(char *)rp->code; *cp; cp++){ + if( cp==zSkip ){ + append_str(zOvwrt,0,0,0); + cp += lemonStrlen(zOvwrt)-1; + dontUseRhs0 = 1; + continue; + } + if( ISALPHA(*cp) && (cp==rp->code || (!ISALNUM(cp[-1]) && cp[-1]!='_')) ){ + char saved; + for(xp= &cp[1]; ISALNUM(*xp) || *xp=='_'; xp++); + saved = *xp; + *xp = 0; + if( rp->lhsalias && strcmp(cp,rp->lhsalias)==0 ){ + append_str(zLhs,0,0,0); + cp = xp; + lhsused = 1; + }else{ + for(i=0; inrhs; i++){ + if( rp->rhsalias[i] && strcmp(cp,rp->rhsalias[i])==0 ){ + if( i==0 && dontUseRhs0 ){ + ErrorMsg(lemp->filename,rp->ruleline, + "Label %s used after '%s'.", + rp->rhsalias[0], zOvwrt); + lemp->errorcnt++; + }else if( cp!=rp->code && cp[-1]=='@' ){ + /* If the argument is of the form @X then substituted + ** the token number of X, not the value of X */ + append_str("yymsp[%d].major",-1,i-rp->nrhs+1,0); + }else{ + struct symbol *sp = rp->rhs[i]; + int dtnum; + if( sp->type==MULTITERMINAL ){ + dtnum = sp->subsym[0]->dtnum; + }else{ + dtnum = sp->dtnum; + } + append_str("yymsp[%d].minor.yy%d",0,i-rp->nrhs+1, dtnum); + } + cp = xp; + used[i] = 1; + break; + } + } + } + *xp = saved; + } + append_str(cp, 1, 0, 0); + } /* End loop */ + + /* Main code generation completed */ + cp = append_str(0,0,0,0); + if( cp && cp[0] ) rp->code = Strsafe(cp); + append_str(0,0,0,0); + + /* Check to make sure the LHS has been used */ + if( rp->lhsalias && !lhsused ){ + ErrorMsg(lemp->filename,rp->ruleline, + "Label \"%s\" for \"%s(%s)\" is never used.", + rp->lhsalias,rp->lhs->name,rp->lhsalias); + lemp->errorcnt++; + } + + /* Generate destructor code for RHS minor values which are not referenced. + ** Generate error messages for unused labels and duplicate labels. + */ + for(i=0; inrhs; i++){ + if( rp->rhsalias[i] ){ + if( i>0 ){ + int j; + if( rp->lhsalias && strcmp(rp->lhsalias,rp->rhsalias[i])==0 ){ + ErrorMsg(lemp->filename,rp->ruleline, + "%s(%s) has the same label as the LHS but is not the left-most " + "symbol on the RHS.", + rp->rhs[i]->name, rp->rhsalias[i]); + lemp->errorcnt++; + } + for(j=0; jrhsalias[j] && strcmp(rp->rhsalias[j],rp->rhsalias[i])==0 ){ + ErrorMsg(lemp->filename,rp->ruleline, + "Label %s used for multiple symbols on the RHS of a rule.", + rp->rhsalias[i]); + lemp->errorcnt++; + break; + } + } + } + if( !used[i] ){ + ErrorMsg(lemp->filename,rp->ruleline, + "Label %s for \"%s(%s)\" is never used.", + rp->rhsalias[i],rp->rhs[i]->name,rp->rhsalias[i]); + lemp->errorcnt++; + } + }else if( i>0 && has_destructor(rp->rhs[i],lemp) ){ + append_str(" yy_destructor(yypParser,%d,&yymsp[%d].minor);\n", 0, + rp->rhs[i]->index,i-rp->nrhs+1); + } + } + + /* If unable to write LHS values directly into the stack, write the + ** saved LHS value now. */ + if( lhsdirect==0 ){ + append_str(" yymsp[%d].minor.yy%d = ", 0, 1-rp->nrhs, rp->lhs->dtnum); + append_str(zLhs, 0, 0, 0); + append_str(";\n", 0, 0, 0); + } + + /* Suffix code generation complete */ + cp = append_str(0,0,0,0); + if( cp && cp[0] ){ + rp->codeSuffix = Strsafe(cp); + rp->noCode = 0; + } + + return rc; +} + +/* +** Generate code which executes when the rule "rp" is reduced. Write +** the code to "out". Make sure lineno stays up-to-date. +*/ +PRIVATE void emit_code( + FILE *out, + struct rule *rp, + struct lemon *lemp, + int *lineno +){ + const char *cp; + + /* Setup code prior to the #line directive */ + if( rp->codePrefix && rp->codePrefix[0] ){ + fprintf(out, "{%s", rp->codePrefix); + for(cp=rp->codePrefix; *cp; cp++){ if( *cp=='\n' ) (*lineno)++; } + } + + /* Generate code to do the reduce action */ + if( rp->code ){ + if( !lemp->nolinenosflag ){ + (*lineno)++; + tplt_linedir(out,rp->line,lemp->filename); + } + fprintf(out,"{%s",rp->code); + for(cp=rp->code; *cp; cp++){ if( *cp=='\n' ) (*lineno)++; } + fprintf(out,"}\n"); (*lineno)++; + if( !lemp->nolinenosflag ){ + (*lineno)++; + tplt_linedir(out,*lineno,lemp->outname); + } + } + + /* Generate breakdown code that occurs after the #line directive */ + if( rp->codeSuffix && rp->codeSuffix[0] ){ + fprintf(out, "%s", rp->codeSuffix); + for(cp=rp->codeSuffix; *cp; cp++){ if( *cp=='\n' ) (*lineno)++; } + } + + if( rp->codePrefix ){ + fprintf(out, "}\n"); (*lineno)++; + } + + return; +} + +/* +** Print the definition of the union used for the parser's data stack. +** This union contains fields for every possible data type for tokens +** and nonterminals. In the process of computing and printing this +** union, also set the ".dtnum" field of every terminal and nonterminal +** symbol. +*/ +void print_stack_union( + FILE *out, /* The output stream */ + struct lemon *lemp, /* The main info structure for this parser */ + int *plineno, /* Pointer to the line number */ + int mhflag /* True if generating makeheaders output */ +){ + int lineno; /* The line number of the output */ + char **types; /* A hash table of datatypes */ + int arraysize; /* Size of the "types" array */ + int maxdtlength; /* Maximum length of any ".datatype" field. */ + char *stddt; /* Standardized name for a datatype */ + int i,j; /* Loop counters */ + unsigned hash; /* For hashing the name of a type */ + const char *name; /* Name of the parser */ + + /* Allocate and initialize types[] and allocate stddt[] */ + arraysize = lemp->nsymbol * 2; + types = (char**)lemon_calloc( arraysize, sizeof(char*) ); + if( types==0 ){ + fprintf(stderr,"Out of memory.\n"); + exit(1); + } + for(i=0; ivartype ){ + maxdtlength = lemonStrlen(lemp->vartype); + } + for(i=0; insymbol; i++){ + int len; + struct symbol *sp = lemp->symbols[i]; + if( sp->datatype==0 ) continue; + len = lemonStrlen(sp->datatype); + if( len>maxdtlength ) maxdtlength = len; + } + stddt = (char*)lemon_malloc( maxdtlength*2 + 1 ); + if( stddt==0 ){ + fprintf(stderr,"Out of memory.\n"); + exit(1); + } + + /* Build a hash table of datatypes. The ".dtnum" field of each symbol + ** is filled in with the hash index plus 1. A ".dtnum" value of 0 is + ** used for terminal symbols. If there is no %default_type defined then + ** 0 is also used as the .dtnum value for nonterminals which do not specify + ** a datatype using the %type directive. + */ + for(i=0; insymbol; i++){ + struct symbol *sp = lemp->symbols[i]; + char *cp; + if( sp==lemp->errsym ){ + sp->dtnum = arraysize+1; + continue; + } + if( sp->type!=NONTERMINAL || (sp->datatype==0 && lemp->vartype==0) ){ + sp->dtnum = 0; + continue; + } + cp = sp->datatype; + if( cp==0 ) cp = lemp->vartype; + j = 0; + while( ISSPACE(*cp) ) cp++; + while( *cp ) stddt[j++] = *cp++; + while( j>0 && ISSPACE(stddt[j-1]) ) j--; + stddt[j] = 0; + if( lemp->tokentype && strcmp(stddt, lemp->tokentype)==0 ){ + sp->dtnum = 0; + continue; + } + hash = 0; + for(j=0; stddt[j]; j++){ + hash = hash*53 + stddt[j]; + } + hash = (hash & 0x7fffffff)%arraysize; + while( types[hash] ){ + if( strcmp(types[hash],stddt)==0 ){ + sp->dtnum = hash + 1; + break; + } + hash++; + if( hash>=(unsigned)arraysize ) hash = 0; + } + if( types[hash]==0 ){ + sp->dtnum = hash + 1; + types[hash] = (char*)lemon_malloc( lemonStrlen(stddt)+1 ); + if( types[hash]==0 ){ + fprintf(stderr,"Out of memory.\n"); + exit(1); + } + lemon_strcpy(types[hash],stddt); + } + } + + /* Print out the definition of YYTOKENTYPE and YYMINORTYPE */ + name = lemp->name ? lemp->name : "Parse"; + lineno = *plineno; + if( mhflag ){ fprintf(out,"#if INTERFACE\n"); lineno++; } + fprintf(out,"#define %sTOKENTYPE %s\n",name, + lemp->tokentype?lemp->tokentype:"void*"); lineno++; + if( mhflag ){ fprintf(out,"#endif\n"); lineno++; } + fprintf(out,"typedef union {\n"); lineno++; + fprintf(out," int yyinit;\n"); lineno++; + fprintf(out," %sTOKENTYPE yy0;\n",name); lineno++; + for(i=0; ierrsym && lemp->errsym->useCnt ){ + fprintf(out," int yy%d;\n",lemp->errsym->dtnum); lineno++; + } + lemon_free(stddt); + lemon_free(types); + fprintf(out,"} YYMINORTYPE;\n"); lineno++; + *plineno = lineno; +} + +/* +** Return the name of a C datatype able to represent values between +** lwr and upr, inclusive. If pnByte!=NULL then also write the sizeof +** for that type (1, 2, or 4) into *pnByte. +*/ +static const char *minimum_size_type(int lwr, int upr, int *pnByte){ + const char *zType = "int"; + int nByte = 4; + if( lwr>=0 ){ + if( upr<=255 ){ + zType = "unsigned char"; + nByte = 1; + }else if( upr<65535 ){ + zType = "unsigned short int"; + nByte = 2; + }else{ + zType = "unsigned int"; + nByte = 4; + } + }else if( lwr>=-127 && upr<=127 ){ + zType = "signed char"; + nByte = 1; + }else if( lwr>=-32767 && upr<32767 ){ + zType = "short"; + nByte = 2; + } + if( pnByte ) *pnByte = nByte; + return zType; +} + +/* +** Each state contains a set of token transaction and a set of +** nonterminal transactions. Each of these sets makes an instance +** of the following structure. An array of these structures is used +** to order the creation of entries in the yy_action[] table. +*/ +struct axset { + struct state *stp; /* A pointer to a state */ + int isTkn; /* True to use tokens. False for non-terminals */ + int nAction; /* Number of actions */ + int iOrder; /* Original order of action sets */ +}; + +/* +** Compare to axset structures for sorting purposes +*/ +static int axset_compare(const void *a, const void *b){ + struct axset *p1 = (struct axset*)a; + struct axset *p2 = (struct axset*)b; + int c; + c = p2->nAction - p1->nAction; + if( c==0 ){ + c = p1->iOrder - p2->iOrder; + } + assert( c!=0 || p1==p2 ); + return c; +} + +/* +** Write text on "out" that describes the rule "rp". +*/ +static void writeRuleText(FILE *out, struct rule *rp){ + int j; + fprintf(out,"%s ::=", rp->lhs->name); + for(j=0; jnrhs; j++){ + struct symbol *sp = rp->rhs[j]; + if( sp->type!=MULTITERMINAL ){ + fprintf(out," %s", sp->name); + }else{ + int k; + fprintf(out," %s", sp->subsym[0]->name); + for(k=1; knsubsym; k++){ + fprintf(out,"|%s",sp->subsym[k]->name); + } + } + } +} + + +/* Generate C source code for the parser */ +void ReportTable( + struct lemon *lemp, + int mhflag, /* Output in makeheaders format if true */ + int sqlFlag /* Generate the *.sql file too */ +){ + FILE *out, *in, *sql; + int lineno; + struct state *stp; + struct action *ap; + struct rule *rp; + struct acttab *pActtab; + int i, j, n, sz, mn, mx; + int nLookAhead; + int szActionType; /* sizeof(YYACTIONTYPE) */ + int szCodeType; /* sizeof(YYCODETYPE) */ + const char *name; + int mnTknOfst, mxTknOfst; + int mnNtOfst, mxNtOfst; + struct axset *ax; + char *prefix; + + lemp->minShiftReduce = lemp->nstate; + lemp->errAction = lemp->minShiftReduce + lemp->nrule; + lemp->accAction = lemp->errAction + 1; + lemp->noAction = lemp->accAction + 1; + lemp->minReduce = lemp->noAction + 1; + lemp->maxAction = lemp->minReduce + lemp->nrule; + + in = tplt_open(lemp); + if( in==0 ) return; + out = file_open(lemp,".c","wb"); + if( out==0 ){ + fclose(in); + return; + } + if( sqlFlag==0 ){ + sql = 0; + }else{ + sql = file_open(lemp, ".sql", "wb"); + if( sql==0 ){ + fclose(in); + fclose(out); + return; + } + fprintf(sql, + "BEGIN;\n" + "CREATE TABLE symbol(\n" + " id INTEGER PRIMARY KEY,\n" + " name TEXT NOT NULL,\n" + " isTerminal BOOLEAN NOT NULL,\n" + " fallback INTEGER REFERENCES symbol" + " DEFERRABLE INITIALLY DEFERRED\n" + ");\n" + ); + for(i=0; insymbol; i++){ + fprintf(sql, + "INSERT INTO symbol(id,name,isTerminal,fallback)" + "VALUES(%d,'%s',%s", + i, lemp->symbols[i]->name, + interminal ? "TRUE" : "FALSE" + ); + if( lemp->symbols[i]->fallback ){ + fprintf(sql, ",%d);\n", lemp->symbols[i]->fallback->index); + }else{ + fprintf(sql, ",NULL);\n"); + } + } + fprintf(sql, + "CREATE TABLE rule(\n" + " ruleid INTEGER PRIMARY KEY,\n" + " lhs INTEGER REFERENCES symbol(id),\n" + " txt TEXT\n" + ");\n" + "CREATE TABLE rulerhs(\n" + " ruleid INTEGER REFERENCES rule(ruleid),\n" + " pos INTEGER,\n" + " sym INTEGER REFERENCES symbol(id)\n" + ");\n" + ); + for(i=0, rp=lemp->rule; rp; rp=rp->next, i++){ + assert( i==rp->iRule ); + fprintf(sql, + "INSERT INTO rule(ruleid,lhs,txt)VALUES(%d,%d,'", + rp->iRule, rp->lhs->index + ); + writeRuleText(sql, rp); + fprintf(sql,"');\n"); + for(j=0; jnrhs; j++){ + struct symbol *sp = rp->rhs[j]; + if( sp->type!=MULTITERMINAL ){ + fprintf(sql, + "INSERT INTO rulerhs(ruleid,pos,sym)VALUES(%d,%d,%d);\n", + i,j,sp->index + ); + }else{ + int k; + for(k=0; knsubsym; k++){ + fprintf(sql, + "INSERT INTO rulerhs(ruleid,pos,sym)VALUES(%d,%d,%d);\n", + i,j,sp->subsym[k]->index + ); + } + } + } + } + fprintf(sql, "COMMIT;\n"); + } + lineno = 1; + + fprintf(out, + "/* This file is automatically generated by Lemon from input grammar\n" + "** source file \"%s\"", lemp->filename); lineno++; + if( nDefineUsed==0 ){ + fprintf(out, ".\n*/\n"); lineno += 2; + }else{ + fprintf(out, " with these options:\n**\n"); lineno += 2; + for(i=0; iinclude==0 ) lemp->include = ""; + for(i=0; ISSPACE(lemp->include[i]); i++){ + if( lemp->include[i]=='\n' ){ + lemp->include += i+1; + i = -1; + } + } + if( lemp->include[0]=='/' ){ + tplt_skip_header(in,&lineno); + }else{ + tplt_xfer(lemp->name,in,out,&lineno); + } + + /* Generate the include code, if any */ + tplt_print(out,lemp,lemp->include,&lineno); + if( mhflag ){ + char *incName = file_makename(lemp, ".h"); + fprintf(out,"#include \"%s\"\n", incName); lineno++; + lemon_free(incName); + } + tplt_xfer(lemp->name,in,out,&lineno); + + /* Generate #defines for all tokens */ + if( lemp->tokenprefix ) prefix = lemp->tokenprefix; + else prefix = ""; + if( mhflag ){ + fprintf(out,"#if INTERFACE\n"); lineno++; + }else{ + fprintf(out,"#ifndef %s%s\n", prefix, lemp->symbols[1]->name); + } + for(i=1; interminal; i++){ + fprintf(out,"#define %s%-30s %2d\n",prefix,lemp->symbols[i]->name,i); + lineno++; + } + fprintf(out,"#endif\n"); lineno++; + tplt_xfer(lemp->name,in,out,&lineno); + + /* Generate the defines */ + fprintf(out,"#define YYCODETYPE %s\n", + minimum_size_type(0, lemp->nsymbol, &szCodeType)); lineno++; + fprintf(out,"#define YYNOCODE %d\n",lemp->nsymbol); lineno++; + fprintf(out,"#define YYACTIONTYPE %s\n", + minimum_size_type(0,lemp->maxAction,&szActionType)); lineno++; + if( lemp->wildcard ){ + fprintf(out,"#define YYWILDCARD %d\n", + lemp->wildcard->index); lineno++; + } + print_stack_union(out,lemp,&lineno,mhflag); + fprintf(out, "#ifndef YYSTACKDEPTH\n"); lineno++; + if( lemp->stacksize ){ + fprintf(out,"#define YYSTACKDEPTH %s\n",lemp->stacksize); lineno++; + }else{ + fprintf(out,"#define YYSTACKDEPTH 100\n"); lineno++; + } + fprintf(out, "#endif\n"); lineno++; + if( mhflag ){ + fprintf(out,"#if INTERFACE\n"); lineno++; + } + name = lemp->name ? lemp->name : "Parse"; + if( lemp->arg && lemp->arg[0] ){ + i = lemonStrlen(lemp->arg); + while( i>=1 && ISSPACE(lemp->arg[i-1]) ) i--; + while( i>=1 && (ISALNUM(lemp->arg[i-1]) || lemp->arg[i-1]=='_') ) i--; + fprintf(out,"#define %sARG_SDECL %s;\n",name,lemp->arg); lineno++; + fprintf(out,"#define %sARG_PDECL ,%s\n",name,lemp->arg); lineno++; + fprintf(out,"#define %sARG_PARAM ,%s\n",name,&lemp->arg[i]); lineno++; + fprintf(out,"#define %sARG_FETCH %s=yypParser->%s;\n", + name,lemp->arg,&lemp->arg[i]); lineno++; + fprintf(out,"#define %sARG_STORE yypParser->%s=%s;\n", + name,&lemp->arg[i],&lemp->arg[i]); lineno++; + }else{ + fprintf(out,"#define %sARG_SDECL\n",name); lineno++; + fprintf(out,"#define %sARG_PDECL\n",name); lineno++; + fprintf(out,"#define %sARG_PARAM\n",name); lineno++; + fprintf(out,"#define %sARG_FETCH\n",name); lineno++; + fprintf(out,"#define %sARG_STORE\n",name); lineno++; + } + if( lemp->reallocFunc ){ + fprintf(out,"#define YYREALLOC %s\n", lemp->reallocFunc); lineno++; + }else{ + fprintf(out,"#define YYREALLOC realloc\n"); lineno++; + } + if( lemp->freeFunc ){ + fprintf(out,"#define YYFREE %s\n", lemp->freeFunc); lineno++; + }else{ + fprintf(out,"#define YYFREE free\n"); lineno++; + } + if( lemp->reallocFunc && lemp->freeFunc ){ + fprintf(out,"#define YYDYNSTACK 1\n"); lineno++; + }else{ + fprintf(out,"#define YYDYNSTACK 0\n"); lineno++; + } + if( lemp->ctx && lemp->ctx[0] ){ + i = lemonStrlen(lemp->ctx); + while( i>=1 && ISSPACE(lemp->ctx[i-1]) ) i--; + while( i>=1 && (ISALNUM(lemp->ctx[i-1]) || lemp->ctx[i-1]=='_') ) i--; + fprintf(out,"#define %sCTX_SDECL %s;\n",name,lemp->ctx); lineno++; + fprintf(out,"#define %sCTX_PDECL ,%s\n",name,lemp->ctx); lineno++; + fprintf(out,"#define %sCTX_PARAM ,%s\n",name,&lemp->ctx[i]); lineno++; + fprintf(out,"#define %sCTX_FETCH %s=yypParser->%s;\n", + name,lemp->ctx,&lemp->ctx[i]); lineno++; + fprintf(out,"#define %sCTX_STORE yypParser->%s=%s;\n", + name,&lemp->ctx[i],&lemp->ctx[i]); lineno++; + }else{ + fprintf(out,"#define %sCTX_SDECL\n",name); lineno++; + fprintf(out,"#define %sCTX_PDECL\n",name); lineno++; + fprintf(out,"#define %sCTX_PARAM\n",name); lineno++; + fprintf(out,"#define %sCTX_FETCH\n",name); lineno++; + fprintf(out,"#define %sCTX_STORE\n",name); lineno++; + } + if( mhflag ){ + fprintf(out,"#endif\n"); lineno++; + } + if( lemp->errsym && lemp->errsym->useCnt ){ + fprintf(out,"#define YYERRORSYMBOL %d\n",lemp->errsym->index); lineno++; + fprintf(out,"#define YYERRSYMDT yy%d\n",lemp->errsym->dtnum); lineno++; + } + if( lemp->has_fallback ){ + fprintf(out,"#define YYFALLBACK 1\n"); lineno++; + } + + /* Compute the action table, but do not output it yet. The action + ** table must be computed before generating the YYNSTATE macro because + ** we need to know how many states can be eliminated. + */ + ax = (struct axset *) lemon_calloc(lemp->nxstate*2, sizeof(ax[0])); + if( ax==0 ){ + fprintf(stderr,"malloc failed\n"); + exit(1); + } + for(i=0; inxstate; i++){ + stp = lemp->sorted[i]; + ax[i*2].stp = stp; + ax[i*2].isTkn = 1; + ax[i*2].nAction = stp->nTknAct; + ax[i*2+1].stp = stp; + ax[i*2+1].isTkn = 0; + ax[i*2+1].nAction = stp->nNtAct; + } + mxTknOfst = mnTknOfst = 0; + mxNtOfst = mnNtOfst = 0; + /* In an effort to minimize the action table size, use the heuristic + ** of placing the largest action sets first */ + for(i=0; inxstate*2; i++) ax[i].iOrder = i; + qsort(ax, lemp->nxstate*2, sizeof(ax[0]), axset_compare); + pActtab = acttab_alloc(lemp->nsymbol, lemp->nterminal); + for(i=0; inxstate*2 && ax[i].nAction>0; i++){ + stp = ax[i].stp; + if( ax[i].isTkn ){ + for(ap=stp->ap; ap; ap=ap->next){ + int action; + if( ap->sp->index>=lemp->nterminal ) continue; + action = compute_action(lemp, ap); + if( action<0 ) continue; + acttab_action(pActtab, ap->sp->index, action); + } + stp->iTknOfst = acttab_insert(pActtab, 1); + if( stp->iTknOfstiTknOfst; + if( stp->iTknOfst>mxTknOfst ) mxTknOfst = stp->iTknOfst; + }else{ + for(ap=stp->ap; ap; ap=ap->next){ + int action; + if( ap->sp->indexnterminal ) continue; + if( ap->sp->index==lemp->nsymbol ) continue; + action = compute_action(lemp, ap); + if( action<0 ) continue; + acttab_action(pActtab, ap->sp->index, action); + } + stp->iNtOfst = acttab_insert(pActtab, 0); + if( stp->iNtOfstiNtOfst; + if( stp->iNtOfst>mxNtOfst ) mxNtOfst = stp->iNtOfst; + } +#if 0 /* Uncomment for a trace of how the yy_action[] table fills out */ + { int jj, nn; + for(jj=nn=0; jjnAction; jj++){ + if( pActtab->aAction[jj].action<0 ) nn++; + } + printf("%4d: State %3d %s n: %2d size: %5d freespace: %d\n", + i, stp->statenum, ax[i].isTkn ? "Token" : "Var ", + ax[i].nAction, pActtab->nAction, nn); + } +#endif + } + lemon_free(ax); + + /* Mark rules that are actually used for reduce actions after all + ** optimizations have been applied + */ + for(rp=lemp->rule; rp; rp=rp->next) rp->doesReduce = LEMON_FALSE; + for(i=0; inxstate; i++){ + for(ap=lemp->sorted[i]->ap; ap; ap=ap->next){ + if( ap->type==REDUCE || ap->type==SHIFTREDUCE ){ + ap->x.rp->doesReduce = 1; + } + } + } + + /* Finish rendering the constants now that the action table has + ** been computed */ + fprintf(out,"#define YYNSTATE %d\n",lemp->nxstate); lineno++; + fprintf(out,"#define YYNRULE %d\n",lemp->nrule); lineno++; + fprintf(out,"#define YYNRULE_WITH_ACTION %d\n",lemp->nruleWithAction); + lineno++; + fprintf(out,"#define YYNTOKEN %d\n",lemp->nterminal); lineno++; + fprintf(out,"#define YY_MAX_SHIFT %d\n",lemp->nxstate-1); lineno++; + i = lemp->minShiftReduce; + fprintf(out,"#define YY_MIN_SHIFTREDUCE %d\n",i); lineno++; + i += lemp->nrule; + fprintf(out,"#define YY_MAX_SHIFTREDUCE %d\n", i-1); lineno++; + fprintf(out,"#define YY_ERROR_ACTION %d\n", lemp->errAction); lineno++; + fprintf(out,"#define YY_ACCEPT_ACTION %d\n", lemp->accAction); lineno++; + fprintf(out,"#define YY_NO_ACTION %d\n", lemp->noAction); lineno++; + fprintf(out,"#define YY_MIN_REDUCE %d\n", lemp->minReduce); lineno++; + i = lemp->minReduce + lemp->nrule; + fprintf(out,"#define YY_MAX_REDUCE %d\n", i-1); lineno++; + + /* Minimum and maximum token values that have a destructor */ + mn = mx = 0; + for(i=0; insymbol; i++){ + struct symbol *sp = lemp->symbols[i]; + + if( sp && sp->type!=TERMINAL && sp->destructor ){ + if( mn==0 || sp->indexindex; + if( sp->index>mx ) mx = sp->index; + } + } + if( lemp->tokendest ) mn = 0; + if( lemp->vardest ) mx = lemp->nsymbol-1; + fprintf(out,"#define YY_MIN_DSTRCTR %d\n", mn); lineno++; + fprintf(out,"#define YY_MAX_DSTRCTR %d\n", mx); lineno++; + + tplt_xfer(lemp->name,in,out,&lineno); + + /* Now output the action table and its associates: + ** + ** yy_action[] A single table containing all actions. + ** yy_lookahead[] A table containing the lookahead for each entry in + ** yy_action. Used to detect hash collisions. + ** yy_shift_ofst[] For each state, the offset into yy_action for + ** shifting terminals. + ** yy_reduce_ofst[] For each state, the offset into yy_action for + ** shifting non-terminals after a reduce. + ** yy_default[] Default action for each state. + */ + + /* Output the yy_action table */ + lemp->nactiontab = n = acttab_action_size(pActtab); + lemp->tablesize += n*szActionType; + fprintf(out,"#define YY_ACTTAB_COUNT (%d)\n", n); lineno++; + fprintf(out,"static const YYACTIONTYPE yy_action[] = {\n"); lineno++; + for(i=j=0; inoAction; + if( j==0 ) fprintf(out," /* %5d */ ", i); + fprintf(out, " %4d,", action); + if( j==9 || i==n-1 ){ + fprintf(out, "\n"); lineno++; + j = 0; + }else{ + j++; + } + } + fprintf(out, "};\n"); lineno++; + + /* Output the yy_lookahead table */ + lemp->nlookaheadtab = n = acttab_lookahead_size(pActtab); + lemp->tablesize += n*szCodeType; + fprintf(out,"static const YYCODETYPE yy_lookahead[] = {\n"); lineno++; + for(i=j=0; insymbol; + if( j==0 ) fprintf(out," /* %5d */ ", i); + fprintf(out, " %4d,", la); + if( j==9 ){ + fprintf(out, "\n"); lineno++; + j = 0; + }else{ + j++; + } + } + /* Add extra entries to the end of the yy_lookahead[] table so that + ** yy_shift_ofst[]+iToken will always be a valid index into the array, + ** even for the largest possible value of yy_shift_ofst[] and iToken. */ + nLookAhead = lemp->nterminal + lemp->nactiontab; + while( interminal); + if( j==9 ){ + fprintf(out, "\n"); lineno++; + j = 0; + }else{ + j++; + } + i++; + } + if( j>0 ){ fprintf(out, "\n"); lineno++; } + fprintf(out, "};\n"); lineno++; + + /* Output the yy_shift_ofst[] table */ + n = lemp->nxstate; + while( n>0 && lemp->sorted[n-1]->iTknOfst==NO_OFFSET ) n--; + fprintf(out, "#define YY_SHIFT_COUNT (%d)\n", n-1); lineno++; + fprintf(out, "#define YY_SHIFT_MIN (%d)\n", mnTknOfst); lineno++; + fprintf(out, "#define YY_SHIFT_MAX (%d)\n", mxTknOfst); lineno++; + fprintf(out, "static const %s yy_shift_ofst[] = {\n", + minimum_size_type(mnTknOfst, lemp->nterminal+lemp->nactiontab, &sz)); + lineno++; + lemp->tablesize += n*sz; + for(i=j=0; isorted[i]; + ofst = stp->iTknOfst; + if( ofst==NO_OFFSET ) ofst = lemp->nactiontab; + if( j==0 ) fprintf(out," /* %5d */ ", i); + fprintf(out, " %4d,", ofst); + if( j==9 || i==n-1 ){ + fprintf(out, "\n"); lineno++; + j = 0; + }else{ + j++; + } + } + fprintf(out, "};\n"); lineno++; + + /* Output the yy_reduce_ofst[] table */ + n = lemp->nxstate; + while( n>0 && lemp->sorted[n-1]->iNtOfst==NO_OFFSET ) n--; + fprintf(out, "#define YY_REDUCE_COUNT (%d)\n", n-1); lineno++; + fprintf(out, "#define YY_REDUCE_MIN (%d)\n", mnNtOfst); lineno++; + fprintf(out, "#define YY_REDUCE_MAX (%d)\n", mxNtOfst); lineno++; + fprintf(out, "static const %s yy_reduce_ofst[] = {\n", + minimum_size_type(mnNtOfst-1, mxNtOfst, &sz)); lineno++; + lemp->tablesize += n*sz; + for(i=j=0; isorted[i]; + ofst = stp->iNtOfst; + if( ofst==NO_OFFSET ) ofst = mnNtOfst - 1; + if( j==0 ) fprintf(out," /* %5d */ ", i); + fprintf(out, " %4d,", ofst); + if( j==9 || i==n-1 ){ + fprintf(out, "\n"); lineno++; + j = 0; + }else{ + j++; + } + } + fprintf(out, "};\n"); lineno++; + + /* Output the default action table */ + fprintf(out, "static const YYACTIONTYPE yy_default[] = {\n"); lineno++; + n = lemp->nxstate; + lemp->tablesize += n*szActionType; + for(i=j=0; isorted[i]; + if( j==0 ) fprintf(out," /* %5d */ ", i); + if( stp->iDfltReduce<0 ){ + fprintf(out, " %4d,", lemp->errAction); + }else{ + fprintf(out, " %4d,", stp->iDfltReduce + lemp->minReduce); + } + if( j==9 || i==n-1 ){ + fprintf(out, "\n"); lineno++; + j = 0; + }else{ + j++; + } + } + fprintf(out, "};\n"); lineno++; + tplt_xfer(lemp->name,in,out,&lineno); + + /* Generate the table of fallback tokens. + */ + if( lemp->has_fallback ){ + mx = lemp->nterminal - 1; + /* 2019-08-28: Generate fallback entries for every token to avoid + ** having to do a range check on the index */ + /* while( mx>0 && lemp->symbols[mx]->fallback==0 ){ mx--; } */ + lemp->tablesize += (mx+1)*szCodeType; + for(i=0; i<=mx; i++){ + struct symbol *p = lemp->symbols[i]; + if( p->fallback==0 ){ + fprintf(out, " 0, /* %10s => nothing */\n", p->name); + }else{ + fprintf(out, " %3d, /* %10s => %s */\n", p->fallback->index, + p->name, p->fallback->name); + } + lineno++; + } + } + tplt_xfer(lemp->name, in, out, &lineno); + + /* Generate a table containing the symbolic name of every symbol + */ + for(i=0; insymbol; i++){ + fprintf(out," /* %4d */ \"%s\",\n",i, lemp->symbols[i]->name); lineno++; + } + tplt_xfer(lemp->name,in,out,&lineno); + + /* Generate a table containing a text string that describes every + ** rule in the rule set of the grammar. This information is used + ** when tracing REDUCE actions. + */ + for(i=0, rp=lemp->rule; rp; rp=rp->next, i++){ + assert( rp->iRule==i ); + fprintf(out," /* %3d */ \"", i); + writeRuleText(out, rp); + fprintf(out,"\",\n"); lineno++; + } + tplt_xfer(lemp->name,in,out,&lineno); + + /* Generate code which executes every time a symbol is popped from + ** the stack while processing errors or while destroying the parser. + ** (In other words, generate the %destructor actions) + */ + if( lemp->tokendest ){ + int once = 1; + for(i=0; insymbol; i++){ + struct symbol *sp = lemp->symbols[i]; + if( sp==0 || sp->type!=TERMINAL ) continue; + if( once ){ + fprintf(out, " /* TERMINAL Destructor */\n"); lineno++; + once = 0; + } + fprintf(out," case %d: /* %s */\n", sp->index, sp->name); lineno++; + } + for(i=0; insymbol && lemp->symbols[i]->type!=TERMINAL; i++); + if( insymbol ){ + emit_destructor_code(out,lemp->symbols[i],lemp,&lineno); + fprintf(out," break;\n"); lineno++; + } + } + if( lemp->vardest ){ + struct symbol *dflt_sp = 0; + int once = 1; + for(i=0; insymbol; i++){ + struct symbol *sp = lemp->symbols[i]; + if( sp==0 || sp->type==TERMINAL || + sp->index<=0 || sp->destructor!=0 ) continue; + if( once ){ + fprintf(out, " /* Default NON-TERMINAL Destructor */\n");lineno++; + once = 0; + } + fprintf(out," case %d: /* %s */\n", sp->index, sp->name); lineno++; + dflt_sp = sp; + } + if( dflt_sp!=0 ){ + emit_destructor_code(out,dflt_sp,lemp,&lineno); + } + fprintf(out," break;\n"); lineno++; + } + for(i=0; insymbol; i++){ + struct symbol *sp = lemp->symbols[i]; + if( sp==0 || sp->type==TERMINAL || sp->destructor==0 ) continue; + if( sp->destLineno<0 ) continue; /* Already emitted */ + fprintf(out," case %d: /* %s */\n", sp->index, sp->name); lineno++; + + /* Combine duplicate destructors into a single case */ + for(j=i+1; jnsymbol; j++){ + struct symbol *sp2 = lemp->symbols[j]; + if( sp2 && sp2->type!=TERMINAL && sp2->destructor + && sp2->dtnum==sp->dtnum + && strcmp(sp->destructor,sp2->destructor)==0 ){ + fprintf(out," case %d: /* %s */\n", + sp2->index, sp2->name); lineno++; + sp2->destLineno = -1; /* Avoid emitting this destructor again */ + } + } + + emit_destructor_code(out,lemp->symbols[i],lemp,&lineno); + fprintf(out," break;\n"); lineno++; + } + tplt_xfer(lemp->name,in,out,&lineno); + + /* Generate code which executes whenever the parser stack overflows */ + tplt_print(out,lemp,lemp->overflow,&lineno); + tplt_xfer(lemp->name,in,out,&lineno); + + /* Generate the tables of rule information. yyRuleInfoLhs[] and + ** yyRuleInfoNRhs[]. + ** + ** Note: This code depends on the fact that rules are number + ** sequentially beginning with 0. + */ + for(i=0, rp=lemp->rule; rp; rp=rp->next, i++){ + fprintf(out," %4d, /* (%d) ", rp->lhs->index, i); + rule_print(out, rp); + fprintf(out," */\n"); lineno++; + } + tplt_xfer(lemp->name,in,out,&lineno); + for(i=0, rp=lemp->rule; rp; rp=rp->next, i++){ + fprintf(out," %3d, /* (%d) ", -rp->nrhs, i); + rule_print(out, rp); + fprintf(out," */\n"); lineno++; + } + tplt_xfer(lemp->name,in,out,&lineno); + + /* Generate code which execution during each REDUCE action */ + i = 0; + for(rp=lemp->rule; rp; rp=rp->next){ + i += translate_code(lemp, rp); + } + if( i ){ + fprintf(out," YYMINORTYPE yylhsminor;\n"); lineno++; + } + /* First output rules other than the default: rule */ + for(rp=lemp->rule; rp; rp=rp->next){ + struct rule *rp2; /* Other rules with the same action */ + if( rp->codeEmitted ) continue; + if( rp->noCode ){ + /* No C code actions, so this will be part of the "default:" rule */ + continue; + } + fprintf(out," case %d: /* ", rp->iRule); + writeRuleText(out, rp); + fprintf(out, " */\n"); lineno++; + for(rp2=rp->next; rp2; rp2=rp2->next){ + if( rp2->code==rp->code && rp2->codePrefix==rp->codePrefix + && rp2->codeSuffix==rp->codeSuffix ){ + fprintf(out," case %d: /* ", rp2->iRule); + writeRuleText(out, rp2); + fprintf(out," */ yytestcase(yyruleno==%d);\n", rp2->iRule); lineno++; + rp2->codeEmitted = 1; + } + } + emit_code(out,rp,lemp,&lineno); + fprintf(out," break;\n"); lineno++; + rp->codeEmitted = 1; + } + /* Finally, output the default: rule. We choose as the default: all + ** empty actions. */ + fprintf(out," default:\n"); lineno++; + for(rp=lemp->rule; rp; rp=rp->next){ + if( rp->codeEmitted ) continue; + assert( rp->noCode ); + fprintf(out," /* (%d) ", rp->iRule); + writeRuleText(out, rp); + if( rp->neverReduce ){ + fprintf(out, " (NEVER REDUCES) */ assert(yyruleno!=%d);\n", + rp->iRule); lineno++; + }else if( rp->doesReduce ){ + fprintf(out, " */ yytestcase(yyruleno==%d);\n", rp->iRule); lineno++; + }else{ + fprintf(out, " (OPTIMIZED OUT) */ assert(yyruleno!=%d);\n", + rp->iRule); lineno++; + } + } + fprintf(out," break;\n"); lineno++; + tplt_xfer(lemp->name,in,out,&lineno); + + /* Generate code which executes if a parse fails */ + tplt_print(out,lemp,lemp->failure,&lineno); + tplt_xfer(lemp->name,in,out,&lineno); + + /* Generate code which executes when a syntax error occurs */ + tplt_print(out,lemp,lemp->error,&lineno); + tplt_xfer(lemp->name,in,out,&lineno); + + /* Generate code which executes when the parser accepts its input */ + tplt_print(out,lemp,lemp->accept,&lineno); + tplt_xfer(lemp->name,in,out,&lineno); + + /* Append any addition code the user desires */ + tplt_print(out,lemp,lemp->extracode,&lineno); + + acttab_free(pActtab); + fclose(in); + fclose(out); + if( sql ) fclose(sql); + return; +} + +/* Generate a header file for the parser */ +void ReportHeader(struct lemon *lemp) +{ + FILE *out, *in; + const char *prefix; + char line[LINESIZE]; + char pattern[LINESIZE]; + int i; + + if( lemp->tokenprefix ) prefix = lemp->tokenprefix; + else prefix = ""; + in = file_open(lemp,".h","rb"); + if( in ){ + int nextChar; + for(i=1; interminal && fgets(line,LINESIZE,in); i++){ + lemon_sprintf(pattern,"#define %s%-30s %3d\n", + prefix,lemp->symbols[i]->name,i); + if( strcmp(line,pattern) ) break; + } + nextChar = fgetc(in); + fclose(in); + if( i==lemp->nterminal && nextChar==EOF ){ + /* No change in the file. Don't rewrite it. */ + return; + } + } + out = file_open(lemp,".h","wb"); + if( out ){ + for(i=1; interminal; i++){ + fprintf(out,"#define %s%-30s %3d\n",prefix,lemp->symbols[i]->name,i); + } + fclose(out); + } + return; +} + +/* Reduce the size of the action tables, if possible, by making use +** of defaults. +** +** In this version, we take the most frequent REDUCE action and make +** it the default. Except, there is no default if the wildcard token +** is a possible look-ahead. +*/ +void CompressTables(struct lemon *lemp) +{ + struct state *stp; + struct action *ap, *ap2, *nextap; + struct rule *rp, *rp2, *rbest; + int nbest, n; + int i; + int usesWildcard; + + for(i=0; instate; i++){ + stp = lemp->sorted[i]; + nbest = 0; + rbest = 0; + usesWildcard = 0; + + for(ap=stp->ap; ap; ap=ap->next){ + if( ap->type==SHIFT && ap->sp==lemp->wildcard ){ + usesWildcard = 1; + } + if( ap->type!=REDUCE ) continue; + rp = ap->x.rp; + if( rp->lhsStart ) continue; + if( rp==rbest ) continue; + n = 1; + for(ap2=ap->next; ap2; ap2=ap2->next){ + if( ap2->type!=REDUCE ) continue; + rp2 = ap2->x.rp; + if( rp2==rbest ) continue; + if( rp2==rp ) n++; + } + if( n>nbest ){ + nbest = n; + rbest = rp; + } + } + + /* Do not make a default if the number of rules to default + ** is not at least 1 or if the wildcard token is a possible + ** lookahead. + */ + if( nbest<1 || usesWildcard ) continue; + + + /* Combine matching REDUCE actions into a single default */ + for(ap=stp->ap; ap; ap=ap->next){ + if( ap->type==REDUCE && ap->x.rp==rbest ) break; + } + assert( ap ); + ap->sp = Symbol_new("{default}"); + for(ap=ap->next; ap; ap=ap->next){ + if( ap->type==REDUCE && ap->x.rp==rbest ) ap->type = NOT_USED; + } + stp->ap = Action_sort(stp->ap); + + for(ap=stp->ap; ap; ap=ap->next){ + if( ap->type==SHIFT ) break; + if( ap->type==REDUCE && ap->x.rp!=rbest ) break; + } + if( ap==0 ){ + stp->autoReduce = 1; + stp->pDfltReduce = rbest; + } + } + + /* Make a second pass over all states and actions. Convert + ** every action that is a SHIFT to an autoReduce state into + ** a SHIFTREDUCE action. + */ + for(i=0; instate; i++){ + stp = lemp->sorted[i]; + for(ap=stp->ap; ap; ap=ap->next){ + struct state *pNextState; + if( ap->type!=SHIFT ) continue; + pNextState = ap->x.stp; + if( pNextState->autoReduce && pNextState->pDfltReduce!=0 ){ + ap->type = SHIFTREDUCE; + ap->x.rp = pNextState->pDfltReduce; + } + } + } + + /* If a SHIFTREDUCE action specifies a rule that has a single RHS term + ** (meaning that the SHIFTREDUCE will land back in the state where it + ** started) and if there is no C-code associated with the reduce action, + ** then we can go ahead and convert the action to be the same as the + ** action for the RHS of the rule. + */ + for(i=0; instate; i++){ + stp = lemp->sorted[i]; + for(ap=stp->ap; ap; ap=nextap){ + nextap = ap->next; + if( ap->type!=SHIFTREDUCE ) continue; + rp = ap->x.rp; + if( rp->noCode==0 ) continue; + if( rp->nrhs!=1 ) continue; +#if 1 + /* Only apply this optimization to non-terminals. It would be OK to + ** apply it to terminal symbols too, but that makes the parser tables + ** larger. */ + if( ap->sp->indexnterminal ) continue; +#endif + /* If we reach this point, it means the optimization can be applied */ + nextap = ap; + for(ap2=stp->ap; ap2 && (ap2==ap || ap2->sp!=rp->lhs); ap2=ap2->next){} + assert( ap2!=0 ); + ap->spOpt = ap2->sp; + ap->type = ap2->type; + ap->x = ap2->x; + } + } +} + + +/* +** Compare two states for sorting purposes. The smaller state is the +** one with the most non-terminal actions. If they have the same number +** of non-terminal actions, then the smaller is the one with the most +** token actions. +*/ +static int stateResortCompare(const void *a, const void *b){ + const struct state *pA = *(const struct state**)a; + const struct state *pB = *(const struct state**)b; + int n; + + n = pB->nNtAct - pA->nNtAct; + if( n==0 ){ + n = pB->nTknAct - pA->nTknAct; + if( n==0 ){ + n = pB->statenum - pA->statenum; + } + } + assert( n!=0 ); + return n; +} + + +/* +** Renumber and resort states so that states with fewer choices +** occur at the end. Except, keep state 0 as the first state. +*/ +void ResortStates(struct lemon *lemp) +{ + int i; + struct state *stp; + struct action *ap; + + for(i=0; instate; i++){ + stp = lemp->sorted[i]; + stp->nTknAct = stp->nNtAct = 0; + stp->iDfltReduce = -1; /* Init dflt action to "syntax error" */ + stp->iTknOfst = NO_OFFSET; + stp->iNtOfst = NO_OFFSET; + for(ap=stp->ap; ap; ap=ap->next){ + int iAction = compute_action(lemp,ap); + if( iAction>=0 ){ + if( ap->sp->indexnterminal ){ + stp->nTknAct++; + }else if( ap->sp->indexnsymbol ){ + stp->nNtAct++; + }else{ + assert( stp->autoReduce==0 || stp->pDfltReduce==ap->x.rp ); + stp->iDfltReduce = iAction; + } + } + } + } + qsort(&lemp->sorted[1], lemp->nstate-1, sizeof(lemp->sorted[0]), + stateResortCompare); + for(i=0; instate; i++){ + lemp->sorted[i]->statenum = i; + } + lemp->nxstate = lemp->nstate; + while( lemp->nxstate>1 && lemp->sorted[lemp->nxstate-1]->autoReduce ){ + lemp->nxstate--; + } +} + + +/***************** From the file "set.c" ************************************/ +/* +** Set manipulation routines for the LEMON parser generator. +*/ + +static int size = 0; + +/* Set the set size */ +void SetSize(int n) +{ + size = n+1; +} + +/* Allocate a new set */ +char *SetNew(void){ + char *s; + s = (char*)lemon_calloc( size, 1); + if( s==0 ){ + memory_error(); + } + return s; +} + +/* Deallocate a set */ +void SetFree(char *s) +{ + lemon_free(s); +} + +/* Add a new element to the set. Return TRUE if the element was added +** and FALSE if it was already there. */ +int SetAdd(char *s, int e) +{ + int rv; + assert( e>=0 && esize = 1024; + x1a->count = 0; + x1a->tbl = (x1node*)lemon_calloc(1024, sizeof(x1node) + sizeof(x1node*)); + if( x1a->tbl==0 ){ + lemon_free(x1a); + x1a = 0; + }else{ + int i; + x1a->ht = (x1node**)&(x1a->tbl[1024]); + for(i=0; i<1024; i++) x1a->ht[i] = 0; + } + } +} +/* Insert a new record into the array. Return TRUE if successful. +** Prior data with the same key is NOT overwritten */ +int Strsafe_insert(const char *data) +{ + x1node *np; + unsigned h; + unsigned ph; + + if( x1a==0 ) return 0; + ph = strhash(data); + h = ph & (x1a->size-1); + np = x1a->ht[h]; + while( np ){ + if( strcmp(np->data,data)==0 ){ + /* An existing entry with the same key is found. */ + /* Fail because overwrite is not allows. */ + return 0; + } + np = np->next; + } + if( x1a->count>=x1a->size ){ + /* Need to make the hash table bigger */ + int i,arrSize; + struct s_x1 array; + array.size = arrSize = x1a->size*2; + array.count = x1a->count; + array.tbl = (x1node*)lemon_calloc(arrSize, sizeof(x1node)+sizeof(x1node*)); + if( array.tbl==0 ) return 0; /* Fail due to malloc failure */ + array.ht = (x1node**)&(array.tbl[arrSize]); + for(i=0; icount; i++){ + x1node *oldnp, *newnp; + oldnp = &(x1a->tbl[i]); + h = strhash(oldnp->data) & (arrSize-1); + newnp = &(array.tbl[i]); + if( array.ht[h] ) array.ht[h]->from = &(newnp->next); + newnp->next = array.ht[h]; + newnp->data = oldnp->data; + newnp->from = &(array.ht[h]); + array.ht[h] = newnp; + } + /* lemon_free(x1a->tbl); // This program was originally for 16-bit machines. + ** Don't worry about freeing memory on modern platforms. */ + *x1a = array; + } + /* Insert the new data */ + h = ph & (x1a->size-1); + np = &(x1a->tbl[x1a->count++]); + np->data = data; + if( x1a->ht[h] ) x1a->ht[h]->from = &(np->next); + np->next = x1a->ht[h]; + x1a->ht[h] = np; + np->from = &(x1a->ht[h]); + return 1; +} + +/* Return a pointer to data assigned to the given key. Return NULL +** if no such key. */ +const char *Strsafe_find(const char *key) +{ + unsigned h; + x1node *np; + + if( x1a==0 ) return 0; + h = strhash(key) & (x1a->size-1); + np = x1a->ht[h]; + while( np ){ + if( strcmp(np->data,key)==0 ) break; + np = np->next; + } + return np ? np->data : 0; +} + +/* Return a pointer to the (terminal or nonterminal) symbol "x". +** Create a new symbol if this is the first time "x" has been seen. +*/ +struct symbol *Symbol_new(const char *x) +{ + struct symbol *sp; + + sp = Symbol_find(x); + if( sp==0 ){ + sp = (struct symbol *)lemon_calloc(1, sizeof(struct symbol) ); + MemoryCheck(sp); + sp->name = Strsafe(x); + sp->type = ISUPPER(*x) ? TERMINAL : NONTERMINAL; + sp->rule = 0; + sp->fallback = 0; + sp->prec = -1; + sp->assoc = UNK; + sp->firstset = 0; + sp->lambda = LEMON_FALSE; + sp->destructor = 0; + sp->destLineno = 0; + sp->datatype = 0; + sp->useCnt = 0; + Symbol_insert(sp,sp->name); + } + sp->useCnt++; + return sp; +} + +/* Compare two symbols for sorting purposes. Return negative, +** zero, or positive if a is less then, equal to, or greater +** than b. +** +** Symbols that begin with upper case letters (terminals or tokens) +** must sort before symbols that begin with lower case letters +** (non-terminals). And MULTITERMINAL symbols (created using the +** %token_class directive) must sort at the very end. Other than +** that, the order does not matter. +** +** We find experimentally that leaving the symbols in their original +** order (the order they appeared in the grammar file) gives the +** smallest parser tables in SQLite. +*/ +int Symbolcmpp(const void *_a, const void *_b) +{ + const struct symbol *a = *(const struct symbol **) _a; + const struct symbol *b = *(const struct symbol **) _b; + int i1 = a->type==MULTITERMINAL ? 3 : a->name[0]>'Z' ? 2 : 1; + int i2 = b->type==MULTITERMINAL ? 3 : b->name[0]>'Z' ? 2 : 1; + return i1==i2 ? a->index - b->index : i1 - i2; +} + +/* There is one instance of the following structure for each +** associative array of type "x2". +*/ +struct s_x2 { + int size; /* The number of available slots. */ + /* Must be a power of 2 greater than or */ + /* equal to 1 */ + int count; /* Number of currently slots filled */ + struct s_x2node *tbl; /* The data stored here */ + struct s_x2node **ht; /* Hash table for lookups */ +}; + +/* There is one instance of this structure for every data element +** in an associative array of type "x2". +*/ +typedef struct s_x2node { + struct symbol *data; /* The data */ + const char *key; /* The key */ + struct s_x2node *next; /* Next entry with the same hash */ + struct s_x2node **from; /* Previous link */ +} x2node; + +/* There is only one instance of the array, which is the following */ +static struct s_x2 *x2a; + +/* Allocate a new associative array */ +void Symbol_init(void){ + if( x2a ) return; + x2a = (struct s_x2*)lemon_malloc( sizeof(struct s_x2) ); + if( x2a ){ + x2a->size = 128; + x2a->count = 0; + x2a->tbl = (x2node*)lemon_calloc(128, sizeof(x2node) + sizeof(x2node*)); + if( x2a->tbl==0 ){ + lemon_free(x2a); + x2a = 0; + }else{ + int i; + x2a->ht = (x2node**)&(x2a->tbl[128]); + for(i=0; i<128; i++) x2a->ht[i] = 0; + } + } +} +/* Insert a new record into the array. Return TRUE if successful. +** Prior data with the same key is NOT overwritten */ +int Symbol_insert(struct symbol *data, const char *key) +{ + x2node *np; + unsigned h; + unsigned ph; + + if( x2a==0 ) return 0; + ph = strhash(key); + h = ph & (x2a->size-1); + np = x2a->ht[h]; + while( np ){ + if( strcmp(np->key,key)==0 ){ + /* An existing entry with the same key is found. */ + /* Fail because overwrite is not allows. */ + return 0; + } + np = np->next; + } + if( x2a->count>=x2a->size ){ + /* Need to make the hash table bigger */ + int i,arrSize; + struct s_x2 array; + array.size = arrSize = x2a->size*2; + array.count = x2a->count; + array.tbl = (x2node*)lemon_calloc(arrSize, sizeof(x2node)+sizeof(x2node*)); + if( array.tbl==0 ) return 0; /* Fail due to malloc failure */ + array.ht = (x2node**)&(array.tbl[arrSize]); + for(i=0; icount; i++){ + x2node *oldnp, *newnp; + oldnp = &(x2a->tbl[i]); + h = strhash(oldnp->key) & (arrSize-1); + newnp = &(array.tbl[i]); + if( array.ht[h] ) array.ht[h]->from = &(newnp->next); + newnp->next = array.ht[h]; + newnp->key = oldnp->key; + newnp->data = oldnp->data; + newnp->from = &(array.ht[h]); + array.ht[h] = newnp; + } + /* lemon_free(x2a->tbl); // This program was originally written for 16-bit + ** machines. Don't worry about freeing this trivial amount of memory + ** on modern platforms. Just leak it. */ + *x2a = array; + } + /* Insert the new data */ + h = ph & (x2a->size-1); + np = &(x2a->tbl[x2a->count++]); + np->key = key; + np->data = data; + if( x2a->ht[h] ) x2a->ht[h]->from = &(np->next); + np->next = x2a->ht[h]; + x2a->ht[h] = np; + np->from = &(x2a->ht[h]); + return 1; +} + +/* Return a pointer to data assigned to the given key. Return NULL +** if no such key. */ +struct symbol *Symbol_find(const char *key) +{ + unsigned h; + x2node *np; + + if( x2a==0 ) return 0; + h = strhash(key) & (x2a->size-1); + np = x2a->ht[h]; + while( np ){ + if( strcmp(np->key,key)==0 ) break; + np = np->next; + } + return np ? np->data : 0; +} + +/* Return the n-th data. Return NULL if n is out of range. */ +struct symbol *Symbol_Nth(int n) +{ + struct symbol *data; + if( x2a && n>0 && n<=x2a->count ){ + data = x2a->tbl[n-1].data; + }else{ + data = 0; + } + return data; +} + +/* Return the size of the array */ +int Symbol_count() +{ + return x2a ? x2a->count : 0; +} + +/* Return an array of pointers to all data in the table. +** The array is obtained from malloc. Return NULL if memory allocation +** problems, or if the array is empty. */ +struct symbol **Symbol_arrayof() +{ + struct symbol **array; + int i,arrSize; + if( x2a==0 ) return 0; + arrSize = x2a->count; + array = (struct symbol **)lemon_calloc(arrSize, sizeof(struct symbol *)); + if( array ){ + for(i=0; itbl[i].data; + } + return array; +} + +/* Compare two configurations */ +int Configcmp(const char *_a,const char *_b) +{ + const struct config *a = (struct config *) _a; + const struct config *b = (struct config *) _b; + int x; + x = a->rp->index - b->rp->index; + if( x==0 ) x = a->dot - b->dot; + return x; +} + +/* Compare two states */ +PRIVATE int statecmp(struct config *a, struct config *b) +{ + int rc; + for(rc=0; rc==0 && a && b; a=a->bp, b=b->bp){ + rc = a->rp->index - b->rp->index; + if( rc==0 ) rc = a->dot - b->dot; + } + if( rc==0 ){ + if( a ) rc = 1; + if( b ) rc = -1; + } + return rc; +} + +/* Hash a state */ +PRIVATE unsigned statehash(struct config *a) +{ + unsigned h=0; + while( a ){ + h = h*571 + a->rp->index*37 + a->dot; + a = a->bp; + } + return h; +} + +/* Allocate a new state structure */ +struct state *State_new() +{ + struct state *newstate; + newstate = (struct state *)lemon_calloc(1, sizeof(struct state) ); + MemoryCheck(newstate); + return newstate; +} + +/* There is one instance of the following structure for each +** associative array of type "x3". +*/ +struct s_x3 { + int size; /* The number of available slots. */ + /* Must be a power of 2 greater than or */ + /* equal to 1 */ + int count; /* Number of currently slots filled */ + struct s_x3node *tbl; /* The data stored here */ + struct s_x3node **ht; /* Hash table for lookups */ +}; + +/* There is one instance of this structure for every data element +** in an associative array of type "x3". +*/ +typedef struct s_x3node { + struct state *data; /* The data */ + struct config *key; /* The key */ + struct s_x3node *next; /* Next entry with the same hash */ + struct s_x3node **from; /* Previous link */ +} x3node; + +/* There is only one instance of the array, which is the following */ +static struct s_x3 *x3a; + +/* Allocate a new associative array */ +void State_init(void){ + if( x3a ) return; + x3a = (struct s_x3*)lemon_malloc( sizeof(struct s_x3) ); + if( x3a ){ + x3a->size = 128; + x3a->count = 0; + x3a->tbl = (x3node*)lemon_calloc(128, sizeof(x3node) + sizeof(x3node*)); + if( x3a->tbl==0 ){ + lemon_free(x3a); + x3a = 0; + }else{ + int i; + x3a->ht = (x3node**)&(x3a->tbl[128]); + for(i=0; i<128; i++) x3a->ht[i] = 0; + } + } +} +/* Insert a new record into the array. Return TRUE if successful. +** Prior data with the same key is NOT overwritten */ +int State_insert(struct state *data, struct config *key) +{ + x3node *np; + unsigned h; + unsigned ph; + + if( x3a==0 ) return 0; + ph = statehash(key); + h = ph & (x3a->size-1); + np = x3a->ht[h]; + while( np ){ + if( statecmp(np->key,key)==0 ){ + /* An existing entry with the same key is found. */ + /* Fail because overwrite is not allows. */ + return 0; + } + np = np->next; + } + if( x3a->count>=x3a->size ){ + /* Need to make the hash table bigger */ + int i,arrSize; + struct s_x3 array; + array.size = arrSize = x3a->size*2; + array.count = x3a->count; + array.tbl = (x3node*)lemon_calloc(arrSize, sizeof(x3node)+sizeof(x3node*)); + if( array.tbl==0 ) return 0; /* Fail due to malloc failure */ + array.ht = (x3node**)&(array.tbl[arrSize]); + for(i=0; icount; i++){ + x3node *oldnp, *newnp; + oldnp = &(x3a->tbl[i]); + h = statehash(oldnp->key) & (arrSize-1); + newnp = &(array.tbl[i]); + if( array.ht[h] ) array.ht[h]->from = &(newnp->next); + newnp->next = array.ht[h]; + newnp->key = oldnp->key; + newnp->data = oldnp->data; + newnp->from = &(array.ht[h]); + array.ht[h] = newnp; + } + lemon_free(x3a->tbl); + *x3a = array; + } + /* Insert the new data */ + h = ph & (x3a->size-1); + np = &(x3a->tbl[x3a->count++]); + np->key = key; + np->data = data; + if( x3a->ht[h] ) x3a->ht[h]->from = &(np->next); + np->next = x3a->ht[h]; + x3a->ht[h] = np; + np->from = &(x3a->ht[h]); + return 1; +} + +/* Return a pointer to data assigned to the given key. Return NULL +** if no such key. */ +struct state *State_find(struct config *key) +{ + unsigned h; + x3node *np; + + if( x3a==0 ) return 0; + h = statehash(key) & (x3a->size-1); + np = x3a->ht[h]; + while( np ){ + if( statecmp(np->key,key)==0 ) break; + np = np->next; + } + return np ? np->data : 0; +} + +/* Return an array of pointers to all data in the table. +** The array is obtained from malloc. Return NULL if memory allocation +** problems, or if the array is empty. */ +struct state **State_arrayof(void) +{ + struct state **array; + int i,arrSize; + if( x3a==0 ) return 0; + arrSize = x3a->count; + array = (struct state **)lemon_calloc(arrSize, sizeof(struct state *)); + if( array ){ + for(i=0; itbl[i].data; + } + return array; +} + +/* Hash a configuration */ +PRIVATE unsigned confighash(struct config *a) +{ + unsigned h=0; + h = h*571 + a->rp->index*37 + a->dot; + return h; +} + +/* There is one instance of the following structure for each +** associative array of type "x4". +*/ +struct s_x4 { + int size; /* The number of available slots. */ + /* Must be a power of 2 greater than or */ + /* equal to 1 */ + int count; /* Number of currently slots filled */ + struct s_x4node *tbl; /* The data stored here */ + struct s_x4node **ht; /* Hash table for lookups */ +}; + +/* There is one instance of this structure for every data element +** in an associative array of type "x4". +*/ +typedef struct s_x4node { + struct config *data; /* The data */ + struct s_x4node *next; /* Next entry with the same hash */ + struct s_x4node **from; /* Previous link */ +} x4node; + +/* There is only one instance of the array, which is the following */ +static struct s_x4 *x4a; + +/* Allocate a new associative array */ +void Configtable_init(void){ + if( x4a ) return; + x4a = (struct s_x4*)lemon_malloc( sizeof(struct s_x4) ); + if( x4a ){ + x4a->size = 64; + x4a->count = 0; + x4a->tbl = (x4node*)lemon_calloc(64, sizeof(x4node) + sizeof(x4node*)); + if( x4a->tbl==0 ){ + lemon_free(x4a); + x4a = 0; + }else{ + int i; + x4a->ht = (x4node**)&(x4a->tbl[64]); + for(i=0; i<64; i++) x4a->ht[i] = 0; + } + } +} +/* Insert a new record into the array. Return TRUE if successful. +** Prior data with the same key is NOT overwritten */ +int Configtable_insert(struct config *data) +{ + x4node *np; + unsigned h; + unsigned ph; + + if( x4a==0 ) return 0; + ph = confighash(data); + h = ph & (x4a->size-1); + np = x4a->ht[h]; + while( np ){ + if( Configcmp((const char *) np->data,(const char *) data)==0 ){ + /* An existing entry with the same key is found. */ + /* Fail because overwrite is not allows. */ + return 0; + } + np = np->next; + } + if( x4a->count>=x4a->size ){ + /* Need to make the hash table bigger */ + int i,arrSize; + struct s_x4 array; + array.size = arrSize = x4a->size*2; + array.count = x4a->count; + array.tbl = (x4node*)lemon_calloc(arrSize, + sizeof(x4node) + sizeof(x4node*)); + if( array.tbl==0 ) return 0; /* Fail due to malloc failure */ + array.ht = (x4node**)&(array.tbl[arrSize]); + for(i=0; icount; i++){ + x4node *oldnp, *newnp; + oldnp = &(x4a->tbl[i]); + h = confighash(oldnp->data) & (arrSize-1); + newnp = &(array.tbl[i]); + if( array.ht[h] ) array.ht[h]->from = &(newnp->next); + newnp->next = array.ht[h]; + newnp->data = oldnp->data; + newnp->from = &(array.ht[h]); + array.ht[h] = newnp; + } + *x4a = array; + } + /* Insert the new data */ + h = ph & (x4a->size-1); + np = &(x4a->tbl[x4a->count++]); + np->data = data; + if( x4a->ht[h] ) x4a->ht[h]->from = &(np->next); + np->next = x4a->ht[h]; + x4a->ht[h] = np; + np->from = &(x4a->ht[h]); + return 1; +} + +/* Return a pointer to data assigned to the given key. Return NULL +** if no such key. */ +struct config *Configtable_find(struct config *key) +{ + int h; + x4node *np; + + if( x4a==0 ) return 0; + h = confighash(key) & (x4a->size-1); + np = x4a->ht[h]; + while( np ){ + if( Configcmp((const char *) np->data,(const char *) key)==0 ) break; + np = np->next; + } + return np ? np->data : 0; +} + +/* Remove all data from the table. Pass each data to the function "f" +** as it is removed. ("f" may be null to avoid this step.) */ +void Configtable_clear(int(*f)(struct config *)) +{ + int i; + if( x4a==0 || x4a->count==0 ) return; + if( f ) for(i=0; icount; i++) (*f)(x4a->tbl[i].data); + for(i=0; isize; i++) x4a->ht[i] = 0; + x4a->count = 0; + return; +} diff --git a/contrib/lemon/lempar.c b/contrib/lemon/lempar.c new file mode 100644 index 000000000000..851a0e2e5433 --- /dev/null +++ b/contrib/lemon/lempar.c @@ -0,0 +1,1086 @@ +/* +** 2000-05-29 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** Driver template for the LEMON parser generator. +** +** The "lemon" program processes an LALR(1) input grammar file, then uses +** this template to construct a parser. The "lemon" program inserts text +** at each "%%" line. Also, any "P-a-r-s-e" identifer prefix (without the +** interstitial "-" characters) contained in this template is changed into +** the value of the %name directive from the grammar. Otherwise, the content +** of this template is copied straight through into the generate parser +** source file. +** +** The following is the concatenation of all %include directives from the +** input grammar file: +*/ +/************ Begin %include sections from the grammar ************************/ +%% +/**************** End of %include directives **********************************/ +/* These constants specify the various numeric values for terminal symbols. +***************** Begin token definitions *************************************/ +%% +/**************** End token definitions ***************************************/ + +/* The next sections is a series of control #defines. +** various aspects of the generated parser. +** YYCODETYPE is the data type used to store the integer codes +** that represent terminal and non-terminal symbols. +** "unsigned char" is used if there are fewer than +** 256 symbols. Larger types otherwise. +** YYNOCODE is a number of type YYCODETYPE that is not used for +** any terminal or nonterminal symbol. +** YYFALLBACK If defined, this indicates that one or more tokens +** (also known as: "terminal symbols") have fall-back +** values which should be used if the original symbol +** would not parse. This permits keywords to sometimes +** be used as identifiers, for example. +** YYACTIONTYPE is the data type used for "action codes" - numbers +** that indicate what to do in response to the next +** token. +** ParseTOKENTYPE is the data type used for minor type for terminal +** symbols. Background: A "minor type" is a semantic +** value associated with a terminal or non-terminal +** symbols. For example, for an "ID" terminal symbol, +** the minor type might be the name of the identifier. +** Each non-terminal can have a different minor type. +** Terminal symbols all have the same minor type, though. +** This macros defines the minor type for terminal +** symbols. +** YYMINORTYPE is the data type used for all minor types. +** This is typically a union of many types, one of +** which is ParseTOKENTYPE. The entry in the union +** for terminal symbols is called "yy0". +** YYSTACKDEPTH is the maximum depth of the parser's stack. If +** zero the stack is dynamically sized using realloc() +** ParseARG_SDECL A static variable declaration for the %extra_argument +** ParseARG_PDECL A parameter declaration for the %extra_argument +** ParseARG_PARAM Code to pass %extra_argument as a subroutine parameter +** ParseARG_STORE Code to store %extra_argument into yypParser +** ParseARG_FETCH Code to extract %extra_argument from yypParser +** ParseCTX_* As ParseARG_ except for %extra_context +** YYREALLOC Name of the realloc() function to use +** YYFREE Name of the free() function to use +** YYDYNSTACK True if stack space should be extended on heap +** YYERRORSYMBOL is the code number of the error symbol. If not +** defined, then do no error processing. +** YYNSTATE the combined number of states. +** YYNRULE the number of rules in the grammar +** YYNTOKEN Number of terminal symbols +** YY_MAX_SHIFT Maximum value for shift actions +** YY_MIN_SHIFTREDUCE Minimum value for shift-reduce actions +** YY_MAX_SHIFTREDUCE Maximum value for shift-reduce actions +** YY_ERROR_ACTION The yy_action[] code for syntax error +** YY_ACCEPT_ACTION The yy_action[] code for accept +** YY_NO_ACTION The yy_action[] code for no-op +** YY_MIN_REDUCE Minimum value for reduce actions +** YY_MAX_REDUCE Maximum value for reduce actions +** YY_MIN_DSTRCTR Minimum symbol value that has a destructor +** YY_MAX_DSTRCTR Maximum symbol value that has a destructor +*/ +#ifndef INTERFACE +# define INTERFACE 1 +#endif +/************* Begin control #defines *****************************************/ +%% +/************* End control #defines *******************************************/ +#define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) + +/* Define the yytestcase() macro to be a no-op if is not already defined +** otherwise. +** +** Applications can choose to define yytestcase() in the %include section +** to a macro that can assist in verifying code coverage. For production +** code the yytestcase() macro should be turned off. But it is useful +** for testing. +*/ +#ifndef yytestcase +# define yytestcase(X) +#endif + +/* Macro to determine if stack space has the ability to grow using +** heap memory. +*/ +#if YYSTACKDEPTH<=0 || YYDYNSTACK +# define YYGROWABLESTACK 1 +#else +# define YYGROWABLESTACK 0 +#endif + +/* Guarantee a minimum number of initial stack slots. +*/ +#if YYSTACKDEPTH<=0 +# undef YYSTACKDEPTH +# define YYSTACKDEPTH 2 /* Need a minimum stack size */ +#endif + + +/* Next are the tables used to determine what action to take based on the +** current state and lookahead token. These tables are used to implement +** functions that take a state number and lookahead value and return an +** action integer. +** +** Suppose the action integer is N. Then the action is determined as +** follows +** +** 0 <= N <= YY_MAX_SHIFT Shift N. That is, push the lookahead +** token onto the stack and goto state N. +** +** N between YY_MIN_SHIFTREDUCE Shift to an arbitrary state then +** and YY_MAX_SHIFTREDUCE reduce by rule N-YY_MIN_SHIFTREDUCE. +** +** N == YY_ERROR_ACTION A syntax error has occurred. +** +** N == YY_ACCEPT_ACTION The parser accepts its input. +** +** N == YY_NO_ACTION No such action. Denotes unused +** slots in the yy_action[] table. +** +** N between YY_MIN_REDUCE Reduce by rule N-YY_MIN_REDUCE +** and YY_MAX_REDUCE +** +** The action table is constructed as a single large table named yy_action[]. +** Given state S and lookahead X, the action is computed as either: +** +** (A) N = yy_action[ yy_shift_ofst[S] + X ] +** (B) N = yy_default[S] +** +** The (A) formula is preferred. The B formula is used instead if +** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X. +** +** The formulas above are for computing the action when the lookahead is +** a terminal symbol. If the lookahead is a non-terminal (as occurs after +** a reduce action) then the yy_reduce_ofst[] array is used in place of +** the yy_shift_ofst[] array. +** +** The following are the tables generated in this section: +** +** yy_action[] A single table containing all actions. +** yy_lookahead[] A table containing the lookahead for each entry in +** yy_action. Used to detect hash collisions. +** yy_shift_ofst[] For each state, the offset into yy_action for +** shifting terminals. +** yy_reduce_ofst[] For each state, the offset into yy_action for +** shifting non-terminals after a reduce. +** yy_default[] Default action for each state. +** +*********** Begin parsing tables **********************************************/ +%% +/********** End of lemon-generated parsing tables *****************************/ + +/* The next table maps tokens (terminal symbols) into fallback tokens. +** If a construct like the following: +** +** %fallback ID X Y Z. +** +** appears in the grammar, then ID becomes a fallback token for X, Y, +** and Z. Whenever one of the tokens X, Y, or Z is input to the parser +** but it does not parse, the type of the token is changed to ID and +** the parse is retried before an error is thrown. +** +** This feature can be used, for example, to cause some keywords in a language +** to revert to identifiers if they keyword does not apply in the context where +** it appears. +*/ +#ifdef YYFALLBACK +static const YYCODETYPE yyFallback[] = { +%% +}; +#endif /* YYFALLBACK */ + +/* The following structure represents a single element of the +** parser's stack. Information stored includes: +** +** + The state number for the parser at this level of the stack. +** +** + The value of the token stored at this level of the stack. +** (In other words, the "major" token.) +** +** + The semantic value stored at this level of the stack. This is +** the information used by the action routines in the grammar. +** It is sometimes called the "minor" token. +** +** After the "shift" half of a SHIFTREDUCE action, the stateno field +** actually contains the reduce action for the second half of the +** SHIFTREDUCE. +*/ +struct yyStackEntry { + YYACTIONTYPE stateno; /* The state-number, or reduce action in SHIFTREDUCE */ + YYCODETYPE major; /* The major token value. This is the code + ** number for the token at this stack level */ + YYMINORTYPE minor; /* The user-supplied minor token value. This + ** is the value of the token */ +}; +typedef struct yyStackEntry yyStackEntry; + +/* The state of the parser is completely contained in an instance of +** the following structure */ +struct yyParser { + yyStackEntry *yytos; /* Pointer to top element of the stack */ +#ifdef YYTRACKMAXSTACKDEPTH + int yyhwm; /* High-water mark of the stack */ +#endif +#ifndef YYNOERRORRECOVERY + int yyerrcnt; /* Shifts left before out of the error */ +#endif + ParseARG_SDECL /* A place to hold %extra_argument */ + ParseCTX_SDECL /* A place to hold %extra_context */ + yyStackEntry *yystackEnd; /* Last entry in the stack */ + yyStackEntry *yystack; /* The parser stack */ + yyStackEntry yystk0[YYSTACKDEPTH]; /* Initial stack space */ +}; +typedef struct yyParser yyParser; + +#include +#ifndef NDEBUG +#include +static FILE *yyTraceFILE = 0; +static char *yyTracePrompt = 0; +#endif /* NDEBUG */ + +#ifndef NDEBUG +/* +** Turn parser tracing on by giving a stream to which to write the trace +** and a prompt to preface each trace message. Tracing is turned off +** by making either argument NULL +** +** Inputs: +**
        +**
      • A FILE* to which trace output should be written. +** If NULL, then tracing is turned off. +**
      • A prefix string written at the beginning of every +** line of trace output. If NULL, then tracing is +** turned off. +**
      +** +** Outputs: +** None. +*/ +void ParseTrace(FILE *TraceFILE, char *zTracePrompt){ + yyTraceFILE = TraceFILE; + yyTracePrompt = zTracePrompt; + if( yyTraceFILE==0 ) yyTracePrompt = 0; + else if( yyTracePrompt==0 ) yyTraceFILE = 0; +} +#endif /* NDEBUG */ + +#if defined(YYCOVERAGE) || !defined(NDEBUG) +/* For tracing shifts, the names of all terminals and nonterminals +** are required. The following table supplies these names */ +static const char *const yyTokenName[] = { +%% +}; +#endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ + +#ifndef NDEBUG +/* For tracing reduce actions, the names of all rules are required. +*/ +static const char *const yyRuleName[] = { +%% +}; +#endif /* NDEBUG */ + + +#if YYGROWABLESTACK +/* +** Try to increase the size of the parser stack. Return the number +** of errors. Return 0 on success. +*/ +static int yyGrowStack(yyParser *p){ + int oldSize = 1 + (int)(p->yystackEnd - p->yystack); + int newSize; + int idx; + yyStackEntry *pNew; + + newSize = oldSize*2 + 100; + idx = (int)(p->yytos - p->yystack); + if( p->yystack==p->yystk0 ){ + pNew = YYREALLOC(0, newSize*sizeof(pNew[0])); + if( pNew==0 ) return 1; + memcpy(pNew, p->yystack, oldSize*sizeof(pNew[0])); + }else{ + pNew = YYREALLOC(p->yystack, newSize*sizeof(pNew[0])); + if( pNew==0 ) return 1; + } + p->yystack = pNew; + p->yytos = &p->yystack[idx]; +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE,"%sStack grows from %d to %d entries.\n", + yyTracePrompt, oldSize, newSize); + } +#endif + p->yystackEnd = &p->yystack[newSize-1]; + return 0; +} +#endif /* YYGROWABLESTACK */ + +#if !YYGROWABLESTACK +/* For builds that do no have a growable stack, yyGrowStack always +** returns an error. +*/ +# define yyGrowStack(X) 1 +#endif + +/* Datatype of the argument to the memory allocated passed as the +** second argument to ParseAlloc() below. This can be changed by +** putting an appropriate #define in the %include section of the input +** grammar. +*/ +#ifndef YYMALLOCARGTYPE +# define YYMALLOCARGTYPE size_t +#endif + +/* Initialize a new parser that has already been allocated. +*/ +void ParseInit(void *yypRawParser ParseCTX_PDECL){ + yyParser *yypParser = (yyParser*)yypRawParser; + ParseCTX_STORE +#ifdef YYTRACKMAXSTACKDEPTH + yypParser->yyhwm = 0; +#endif + yypParser->yystack = yypParser->yystk0; + yypParser->yystackEnd = &yypParser->yystack[YYSTACKDEPTH-1]; +#ifndef YYNOERRORRECOVERY + yypParser->yyerrcnt = -1; +#endif + yypParser->yytos = yypParser->yystack; + yypParser->yystack[0].stateno = 0; + yypParser->yystack[0].major = 0; +} + +#ifndef Parse_ENGINEALWAYSONSTACK +/* +** This function allocates a new parser. +** The only argument is a pointer to a function which works like +** malloc. +** +** Inputs: +** A pointer to the function used to allocate memory. +** +** Outputs: +** A pointer to a parser. This pointer is used in subsequent calls +** to Parse and ParseFree. +*/ +void *ParseAlloc(void *(*mallocProc)(YYMALLOCARGTYPE) ParseCTX_PDECL){ + yyParser *yypParser; + yypParser = (yyParser*)(*mallocProc)( (YYMALLOCARGTYPE)sizeof(yyParser) ); + if( yypParser ){ + ParseCTX_STORE + ParseInit(yypParser ParseCTX_PARAM); + } + return (void*)yypParser; +} +#endif /* Parse_ENGINEALWAYSONSTACK */ + + +/* The following function deletes the "minor type" or semantic value +** associated with a symbol. The symbol can be either a terminal +** or nonterminal. "yymajor" is the symbol code, and "yypminor" is +** a pointer to the value to be deleted. The code used to do the +** deletions is derived from the %destructor and/or %token_destructor +** directives of the input grammar. +*/ +static void yy_destructor( + yyParser *yypParser, /* The parser */ + YYCODETYPE yymajor, /* Type code for object to destroy */ + YYMINORTYPE *yypminor /* The object to be destroyed */ +){ + ParseARG_FETCH + ParseCTX_FETCH + switch( yymajor ){ + /* Here is inserted the actions which take place when a + ** terminal or non-terminal is destroyed. This can happen + ** when the symbol is popped from the stack during a + ** reduce or during error processing or when a parser is + ** being destroyed before it is finished parsing. + ** + ** Note: during a reduce, the only symbols destroyed are those + ** which appear on the RHS of the rule, but which are *not* used + ** inside the C code. + */ +/********* Begin destructor definitions ***************************************/ +%% +/********* End destructor definitions *****************************************/ + default: break; /* If no destructor action specified: do nothing */ + } +} + +/* +** Pop the parser's stack once. +** +** If there is a destructor routine associated with the token which +** is popped from the stack, then call it. +*/ +static void yy_pop_parser_stack(yyParser *pParser){ + yyStackEntry *yytos; + assert( pParser->yytos!=0 ); + assert( pParser->yytos > pParser->yystack ); + yytos = pParser->yytos--; +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE,"%sPopping %s\n", + yyTracePrompt, + yyTokenName[yytos->major]); + } +#endif + yy_destructor(pParser, yytos->major, &yytos->minor); +} + +/* +** Clear all secondary memory allocations from the parser +*/ +void ParseFinalize(void *p){ + yyParser *pParser = (yyParser*)p; + + /* In-lined version of calling yy_pop_parser_stack() for each + ** element left in the stack */ + yyStackEntry *yytos = pParser->yytos; + while( yytos>pParser->yystack ){ +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE,"%sPopping %s\n", + yyTracePrompt, + yyTokenName[yytos->major]); + } +#endif + if( yytos->major>=YY_MIN_DSTRCTR ){ + yy_destructor(pParser, yytos->major, &yytos->minor); + } + yytos--; + } + +#if YYGROWABLESTACK + if( pParser->yystack!=pParser->yystk0 ) YYFREE(pParser->yystack); +#endif +} + +#ifndef Parse_ENGINEALWAYSONSTACK +/* +** Deallocate and destroy a parser. Destructors are called for +** all stack elements before shutting the parser down. +** +** If the YYPARSEFREENEVERNULL macro exists (for example because it +** is defined in a %include section of the input grammar) then it is +** assumed that the input pointer is never NULL. +*/ +void ParseFree( + void *p, /* The parser to be deleted */ + void (*freeProc)(void*) /* Function used to reclaim memory */ +){ +#ifndef YYPARSEFREENEVERNULL + if( p==0 ) return; +#endif + ParseFinalize(p); + (*freeProc)(p); +} +#endif /* Parse_ENGINEALWAYSONSTACK */ + +/* +** Return the peak depth of the stack for a parser. +*/ +#ifdef YYTRACKMAXSTACKDEPTH +int ParseStackPeak(void *p){ + yyParser *pParser = (yyParser*)p; + return pParser->yyhwm; +} +#endif + +/* This array of booleans keeps track of the parser statement +** coverage. The element yycoverage[X][Y] is set when the parser +** is in state X and has a lookahead token Y. In a well-tested +** systems, every element of this matrix should end up being set. +*/ +#if defined(YYCOVERAGE) +static unsigned char yycoverage[YYNSTATE][YYNTOKEN]; +#endif + +/* +** Write into out a description of every state/lookahead combination that +** +** (1) has not been used by the parser, and +** (2) is not a syntax error. +** +** Return the number of missed state/lookahead combinations. +*/ +#if defined(YYCOVERAGE) +int ParseCoverage(FILE *out){ + int stateno, iLookAhead, i; + int nMissed = 0; + for(stateno=0; statenoYY_MAX_SHIFT ) return stateno; + assert( stateno <= YY_SHIFT_COUNT ); +#if defined(YYCOVERAGE) + yycoverage[stateno][iLookAhead] = 1; +#endif + do{ + i = yy_shift_ofst[stateno]; + assert( i>=0 ); + assert( i<=YY_ACTTAB_COUNT ); + assert( i+YYNTOKEN<=(int)YY_NLOOKAHEAD ); + assert( iLookAhead!=YYNOCODE ); + assert( iLookAhead < YYNTOKEN ); + i += iLookAhead; + assert( i<(int)YY_NLOOKAHEAD ); + if( yy_lookahead[i]!=iLookAhead ){ +#ifdef YYFALLBACK + YYCODETYPE iFallback; /* Fallback token */ + assert( iLookAhead %s\n", + yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]); + } +#endif + assert( yyFallback[iFallback]==0 ); /* Fallback loop must terminate */ + iLookAhead = iFallback; + continue; + } +#endif +#ifdef YYWILDCARD + { + int j = i - iLookAhead + YYWILDCARD; + assert( j<(int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])) ); + if( yy_lookahead[j]==YYWILDCARD && iLookAhead>0 ){ +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE, "%sWILDCARD %s => %s\n", + yyTracePrompt, yyTokenName[iLookAhead], + yyTokenName[YYWILDCARD]); + } +#endif /* NDEBUG */ + return yy_action[j]; + } + } +#endif /* YYWILDCARD */ + return yy_default[stateno]; + }else{ + assert( i>=0 && i<(int)(sizeof(yy_action)/sizeof(yy_action[0])) ); + return yy_action[i]; + } + }while(1); +} + +/* +** Find the appropriate action for a parser given the non-terminal +** look-ahead token iLookAhead. +*/ +static YYACTIONTYPE yy_find_reduce_action( + YYACTIONTYPE stateno, /* Current state number */ + YYCODETYPE iLookAhead /* The look-ahead token */ +){ + int i; +#ifdef YYERRORSYMBOL + if( stateno>YY_REDUCE_COUNT ){ + return yy_default[stateno]; + } +#else + assert( stateno<=YY_REDUCE_COUNT ); +#endif + i = yy_reduce_ofst[stateno]; + assert( iLookAhead!=YYNOCODE ); + i += iLookAhead; +#ifdef YYERRORSYMBOL + if( i<0 || i>=YY_ACTTAB_COUNT || yy_lookahead[i]!=iLookAhead ){ + return yy_default[stateno]; + } +#else + assert( i>=0 && iyytos>yypParser->yystack ) yy_pop_parser_stack(yypParser); + /* Here code is inserted which will execute if the parser + ** stack every overflows */ +/******** Begin %stack_overflow code ******************************************/ +%% +/******** End %stack_overflow code ********************************************/ + ParseARG_STORE /* Suppress warning about unused %extra_argument var */ + ParseCTX_STORE +} + +/* +** Print tracing information for a SHIFT action +*/ +#ifndef NDEBUG +static void yyTraceShift(yyParser *yypParser, int yyNewState, const char *zTag){ + if( yyTraceFILE ){ + if( yyNewStateyytos->major], + yyNewState); + }else{ + fprintf(yyTraceFILE,"%s%s '%s', pending reduce %d\n", + yyTracePrompt, zTag, yyTokenName[yypParser->yytos->major], + yyNewState - YY_MIN_REDUCE); + } + } +} +#else +# define yyTraceShift(X,Y,Z) +#endif + +/* +** Perform a shift action. +*/ +static void yy_shift( + yyParser *yypParser, /* The parser to be shifted */ + YYACTIONTYPE yyNewState, /* The new state to shift in */ + YYCODETYPE yyMajor, /* The major token to shift in */ + ParseTOKENTYPE yyMinor /* The minor token to shift in */ +){ + yyStackEntry *yytos; + yypParser->yytos++; +#ifdef YYTRACKMAXSTACKDEPTH + if( (int)(yypParser->yytos - yypParser->yystack)>yypParser->yyhwm ){ + yypParser->yyhwm++; + assert( yypParser->yyhwm == (int)(yypParser->yytos - yypParser->yystack) ); + } +#endif + yytos = yypParser->yytos; + if( yytos>yypParser->yystackEnd ){ + if( yyGrowStack(yypParser) ){ + yypParser->yytos--; + yyStackOverflow(yypParser); + return; + } + yytos = yypParser->yytos; + assert( yytos <= yypParser->yystackEnd ); + } + if( yyNewState > YY_MAX_SHIFT ){ + yyNewState += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE; + } + yytos->stateno = yyNewState; + yytos->major = yyMajor; + yytos->minor.yy0 = yyMinor; + yyTraceShift(yypParser, yyNewState, "Shift"); +} + +/* For rule J, yyRuleInfoLhs[J] contains the symbol on the left-hand side +** of that rule */ +static const YYCODETYPE yyRuleInfoLhs[] = { +%% +}; + +/* For rule J, yyRuleInfoNRhs[J] contains the negative of the number +** of symbols on the right-hand side of that rule. */ +static const signed char yyRuleInfoNRhs[] = { +%% +}; + +static void yy_accept(yyParser*); /* Forward Declaration */ + +/* +** Perform a reduce action and the shift that must immediately +** follow the reduce. +** +** The yyLookahead and yyLookaheadToken parameters provide reduce actions +** access to the lookahead token (if any). The yyLookahead will be YYNOCODE +** if the lookahead token has already been consumed. As this procedure is +** only called from one place, optimizing compilers will in-line it, which +** means that the extra parameters have no performance impact. +*/ +static YYACTIONTYPE yy_reduce( + yyParser *yypParser, /* The parser */ + unsigned int yyruleno, /* Number of the rule by which to reduce */ + int yyLookahead, /* Lookahead token, or YYNOCODE if none */ + ParseTOKENTYPE yyLookaheadToken /* Value of the lookahead token */ + ParseCTX_PDECL /* %extra_context */ +){ + int yygoto; /* The next state */ + YYACTIONTYPE yyact; /* The next action */ + yyStackEntry *yymsp; /* The top of the parser's stack */ + int yysize; /* Amount to pop the stack */ + ParseARG_FETCH + (void)yyLookahead; + (void)yyLookaheadToken; + yymsp = yypParser->yytos; + + switch( yyruleno ){ + /* Beginning here are the reduction cases. A typical example + ** follows: + ** case 0: + ** #line + ** { ... } // User supplied code + ** #line + ** break; + */ +/********** Begin reduce actions **********************************************/ +%% +/********** End reduce actions ************************************************/ + }; + assert( yyrulenoYY_MAX_SHIFT && yyact<=YY_MAX_SHIFTREDUCE) ); + + /* It is not possible for a REDUCE to be followed by an error */ + assert( yyact!=YY_ERROR_ACTION ); + + yymsp += yysize+1; + yypParser->yytos = yymsp; + yymsp->stateno = (YYACTIONTYPE)yyact; + yymsp->major = (YYCODETYPE)yygoto; + yyTraceShift(yypParser, yyact, "... then shift"); + return yyact; +} + +/* +** The following code executes when the parse fails +*/ +#ifndef YYNOERRORRECOVERY +static void yy_parse_failed( + yyParser *yypParser /* The parser */ +){ + ParseARG_FETCH + ParseCTX_FETCH +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt); + } +#endif + while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser); + /* Here code is inserted which will be executed whenever the + ** parser fails */ +/************ Begin %parse_failure code ***************************************/ +%% +/************ End %parse_failure code *****************************************/ + ParseARG_STORE /* Suppress warning about unused %extra_argument variable */ + ParseCTX_STORE +} +#endif /* YYNOERRORRECOVERY */ + +/* +** The following code executes when a syntax error first occurs. +*/ +static void yy_syntax_error( + yyParser *yypParser, /* The parser */ + int yymajor, /* The major type of the error token */ + ParseTOKENTYPE yyminor /* The minor type of the error token */ +){ + ParseARG_FETCH + ParseCTX_FETCH +#define TOKEN yyminor +/************ Begin %syntax_error code ****************************************/ +%% +/************ End %syntax_error code ******************************************/ + ParseARG_STORE /* Suppress warning about unused %extra_argument variable */ + ParseCTX_STORE +} + +/* +** The following is executed when the parser accepts +*/ +static void yy_accept( + yyParser *yypParser /* The parser */ +){ + ParseARG_FETCH + ParseCTX_FETCH +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt); + } +#endif +#ifndef YYNOERRORRECOVERY + yypParser->yyerrcnt = -1; +#endif + assert( yypParser->yytos==yypParser->yystack ); + /* Here code is inserted which will be executed whenever the + ** parser accepts */ +/*********** Begin %parse_accept code *****************************************/ +%% +/*********** End %parse_accept code *******************************************/ + ParseARG_STORE /* Suppress warning about unused %extra_argument variable */ + ParseCTX_STORE +} + +/* The main parser program. +** The first argument is a pointer to a structure obtained from +** "ParseAlloc" which describes the current state of the parser. +** The second argument is the major token number. The third is +** the minor token. The fourth optional argument is whatever the +** user wants (and specified in the grammar) and is available for +** use by the action routines. +** +** Inputs: +**
        +**
      • A pointer to the parser (an opaque structure.) +**
      • The major token number. +**
      • The minor token number. +**
      • An option argument of a grammar-specified type. +**
      +** +** Outputs: +** None. +*/ +void Parse( + void *yyp, /* The parser */ + int yymajor, /* The major token code number */ + ParseTOKENTYPE yyminor /* The value for the token */ + ParseARG_PDECL /* Optional %extra_argument parameter */ +){ + YYMINORTYPE yyminorunion; + YYACTIONTYPE yyact; /* The parser action. */ +#if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY) + int yyendofinput; /* True if we are at the end of input */ +#endif +#ifdef YYERRORSYMBOL + int yyerrorhit = 0; /* True if yymajor has invoked an error */ +#endif + yyParser *yypParser = (yyParser*)yyp; /* The parser */ + ParseCTX_FETCH + ParseARG_STORE + + assert( yypParser->yytos!=0 ); +#if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY) + yyendofinput = (yymajor==0); +#endif + + yyact = yypParser->yytos->stateno; +#ifndef NDEBUG + if( yyTraceFILE ){ + if( yyact < YY_MIN_REDUCE ){ + fprintf(yyTraceFILE,"%sInput '%s' in state %d\n", + yyTracePrompt,yyTokenName[yymajor],yyact); + }else{ + fprintf(yyTraceFILE,"%sInput '%s' with pending reduce %d\n", + yyTracePrompt,yyTokenName[yymajor],yyact-YY_MIN_REDUCE); + } + } +#endif + + while(1){ /* Exit by "break" */ + assert( yypParser->yytos>=yypParser->yystack ); + assert( yyact==yypParser->yytos->stateno ); + yyact = yy_find_shift_action((YYCODETYPE)yymajor,yyact); + if( yyact >= YY_MIN_REDUCE ){ + unsigned int yyruleno = yyact - YY_MIN_REDUCE; /* Reduce by this rule */ +#ifndef NDEBUG + assert( yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ); + if( yyTraceFILE ){ + int yysize = yyRuleInfoNRhs[yyruleno]; + if( yysize ){ + fprintf(yyTraceFILE, "%sReduce %d [%s]%s, pop back to state %d.\n", + yyTracePrompt, + yyruleno, yyRuleName[yyruleno], + yyrulenoyytos[yysize].stateno); + }else{ + fprintf(yyTraceFILE, "%sReduce %d [%s]%s.\n", + yyTracePrompt, yyruleno, yyRuleName[yyruleno], + yyrulenoyytos - yypParser->yystack)>yypParser->yyhwm ){ + yypParser->yyhwm++; + assert( yypParser->yyhwm == + (int)(yypParser->yytos - yypParser->yystack)); + } +#endif + if( yypParser->yytos>=yypParser->yystackEnd ){ + if( yyGrowStack(yypParser) ){ + yyStackOverflow(yypParser); + break; + } + } + } + yyact = yy_reduce(yypParser,yyruleno,yymajor,yyminor ParseCTX_PARAM); + }else if( yyact <= YY_MAX_SHIFTREDUCE ){ + yy_shift(yypParser,yyact,(YYCODETYPE)yymajor,yyminor); +#ifndef YYNOERRORRECOVERY + yypParser->yyerrcnt--; +#endif + break; + }else if( yyact==YY_ACCEPT_ACTION ){ + yypParser->yytos--; + yy_accept(yypParser); + return; + }else{ + assert( yyact == YY_ERROR_ACTION ); + yyminorunion.yy0 = yyminor; +#ifdef YYERRORSYMBOL + int yymx; +#endif +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt); + } +#endif +#ifdef YYERRORSYMBOL + /* A syntax error has occurred. + ** The response to an error depends upon whether or not the + ** grammar defines an error token "ERROR". + ** + ** This is what we do if the grammar does define ERROR: + ** + ** * Call the %syntax_error function. + ** + ** * Begin popping the stack until we enter a state where + ** it is legal to shift the error symbol, then shift + ** the error symbol. + ** + ** * Set the error count to three. + ** + ** * Begin accepting and shifting new tokens. No new error + ** processing will occur until three tokens have been + ** shifted successfully. + ** + */ + if( yypParser->yyerrcnt<0 ){ + yy_syntax_error(yypParser,yymajor,yyminor); + } + yymx = yypParser->yytos->major; + if( yymx==YYERRORSYMBOL || yyerrorhit ){ +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE,"%sDiscard input token %s\n", + yyTracePrompt,yyTokenName[yymajor]); + } +#endif + yy_destructor(yypParser, (YYCODETYPE)yymajor, &yyminorunion); + yymajor = YYNOCODE; + }else{ + while( yypParser->yytos > yypParser->yystack ){ + yyact = yy_find_reduce_action(yypParser->yytos->stateno, + YYERRORSYMBOL); + if( yyact<=YY_MAX_SHIFTREDUCE ) break; + yy_pop_parser_stack(yypParser); + } + if( yypParser->yytos <= yypParser->yystack || yymajor==0 ){ + yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion); + yy_parse_failed(yypParser); +#ifndef YYNOERRORRECOVERY + yypParser->yyerrcnt = -1; +#endif + yymajor = YYNOCODE; + }else if( yymx!=YYERRORSYMBOL ){ + yy_shift(yypParser,yyact,YYERRORSYMBOL,yyminor); + } + } + yypParser->yyerrcnt = 3; + yyerrorhit = 1; + if( yymajor==YYNOCODE ) break; + yyact = yypParser->yytos->stateno; +#elif defined(YYNOERRORRECOVERY) + /* If the YYNOERRORRECOVERY macro is defined, then do not attempt to + ** do any kind of error recovery. Instead, simply invoke the syntax + ** error routine and continue going as if nothing had happened. + ** + ** Applications can set this macro (for example inside %include) if + ** they intend to abandon the parse upon the first syntax error seen. + */ + yy_syntax_error(yypParser,yymajor, yyminor); + yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion); + break; +#else /* YYERRORSYMBOL is not defined */ + /* This is what we do if the grammar does not define ERROR: + ** + ** * Report an error message, and throw away the input token. + ** + ** * If the input token is $, then fail the parse. + ** + ** As before, subsequent error messages are suppressed until + ** three input tokens have been successfully shifted. + */ + if( yypParser->yyerrcnt<=0 ){ + yy_syntax_error(yypParser,yymajor, yyminor); + } + yypParser->yyerrcnt = 3; + yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion); + if( yyendofinput ){ + yy_parse_failed(yypParser); +#ifndef YYNOERRORRECOVERY + yypParser->yyerrcnt = -1; +#endif + } + break; +#endif + } + } +#ifndef NDEBUG + if( yyTraceFILE ){ + yyStackEntry *i; + char cDiv = '['; + fprintf(yyTraceFILE,"%sReturn. Stack=",yyTracePrompt); + for(i=&yypParser->yystack[1]; i<=yypParser->yytos; i++){ + fprintf(yyTraceFILE,"%c%s", cDiv, yyTokenName[i->major]); + cDiv = ' '; + } + fprintf(yyTraceFILE,"]\n"); + } +#endif + return; +} + +/* +** Return the fallback token corresponding to canonical token iToken, or +** 0 if iToken has no fallback. +*/ +int ParseFallback(int iToken){ +#ifdef YYFALLBACK + assert( iToken<(int)(sizeof(yyFallback)/sizeof(yyFallback[0])) ); + return yyFallback[iToken]; +#else + (void)iToken; + return 0; +#endif +} diff --git a/source/libs/parser/CMakeLists.txt b/source/libs/parser/CMakeLists.txt index 9e28e9bc72d4..cfdbe2848e60 100644 --- a/source/libs/parser/CMakeLists.txt +++ b/source/libs/parser/CMakeLists.txt @@ -7,7 +7,7 @@ ENDIF() add_custom_command( OUTPUT ${TD_SOURCE_DIR}/source/libs/parser/src/sql.c COMMAND echo "Running lemon process in ${TD_SOURCE_DIR}/source/libs/parser/inc" - COMMAND ${TD_CONTRIB_DIR}/deps-download/lemon-prefix/src/lemon/tool/lemon sql.y || true + COMMAND ${TD_CONTRIB_DIR}/lemon/lemon sql.y || true COMMAND echo "copy sql.c from ${TD_SOURCE_DIR}/source/libs/parser/inc/sql.c to ${TD_SOURCE_DIR}/source/libs/parser/src/" COMMAND cp ${TD_SOURCE_DIR}/source/libs/parser/inc/sql.c ${TD_SOURCE_DIR}/source/libs/parser/src/ COMMAND echo "lemon process completed." From 04cf61b8d84d9d5a38af24978aeb08ef4aecf621 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 6 Nov 2024 09:03:56 +0800 Subject: [PATCH 649/695] docs: data analysis --- .../06-advanced/06-data-analysis/01-arima.md | 22 ++--- .../06-data-analysis/02-holtwinters.md | 20 ++--- .../06-data-analysis/03-anomaly-detection.md | 8 +- .../zh/06-advanced/06-data-analysis/addins.md | 23 ++--- docs/zh/06-advanced/06-data-analysis/index.md | 84 ++++++++++--------- 5 files changed, 81 insertions(+), 76 deletions(-) diff --git a/docs/zh/06-advanced/06-data-analysis/01-arima.md b/docs/zh/06-advanced/06-data-analysis/01-arima.md index 6799d488871c..56383b7e8688 100644 --- a/docs/zh/06-advanced/06-data-analysis/01-arima.md +++ b/docs/zh/06-advanced/06-data-analysis/01-arima.md @@ -7,12 +7,12 @@ sidebar_label: "ARIMA" ## 功能概述 -ARIMA 即自回归移动平均模型(Autoregressive Integrated Moving Average, ARIMA),也记作 ARIMA(p,d,q),是统计模型中最常见的一种用来进行时间序列预测的模型。 -ARIMA模型是一种自回归模型,只需要自变量即可预测后续的值。ARIMA模型要求时序数据是**平稳**,或经过差分处理后平稳,如果是不平稳的数据,**无法**获得正确的结果。 +ARIMA 即自回归移动平均模型(Autoregressive Integrated Moving Average, ARIMA),也记作 ARIMA(p,d,q),是统计模型中最常见的一种用来进行时间序列预测的模型。 +ARIMA 模型是一种自回归模型,只需要自变量即可预测后续的值。ARIMA 模型要求时序数据**平稳**,或经过差分处理后平稳,如果是不平稳的数据,**无法**获得正确的结果。 >平稳的时间序列:其性质不随观测时间的变化而变化。具有趋势或季节性的时间序列不是平稳时间序列——趋势和季节性使得时间序列在不同时段呈现不同性质。 -以下参数可以动态输入控制预测过程中生成 合适的 ARIMA 的模型。 +以下参数可以动态输入控制预测过程中生成 合适的 ARIMA 的模型。 - p= 自回归模型阶数 - d= 差分阶数 @@ -23,19 +23,19 @@ ARIMA模型是一种自回归模型,只需要自变量即可预测后续的值 分析平台中使用自动化的 ARIMA 模型进行计算,因此每次计算的时候会根据输入的数据自动拟合最合适的模型,然后根据该模型进行预测输出结果。 |参数名称|说明|必填项| |---|---|---| -|period|输入时间序列数据每个周期包含的数据点个数。如果不设置该参数或则该参数设置为 0, 将使用非季节性/周期性的 ARIMA 模型预测。|选填| -|start_p| 自回归模型阶数的 起始值,0 开始的整数,不推荐大于 10 |选填| -|max_p| 自回归模型阶数的 结束值,0 开始的整数,不推荐大于 10 |选填| -|start_q| 移动平均模型阶数的起始值, 0 开始的整数,不推荐大于 10 |选填| -|max_q| 移动平均模型阶数的结束值, 0 开始的整数,不推荐大于 10 |选填| -|d| 差分阶数|选填| +|period|输入时间序列每个周期包含的数据点个数。如果不设置该参数或该参数设置为 0,将使用非季节性/周期性的 ARIMA 模型预测。|选填| +|start_p|自回归模型阶数的起始值,0 开始的整数,不推荐大于 10 |选填| +|max_p|自回归模型阶数的结束值,0 开始的整数,不推荐大于 10 |选填| +|start_q|移动平均模型阶数的起始值,0 开始的整数,不推荐大于 10 |选填| +|max_q|移动平均模型阶数的结束值,0 开始的整数,不推荐大于 10 |选填| +|d|差分阶数|选填| `start_p`、`max_p` `start_q` `max_q` 四个参数约束了模型在多大的范围内去搜寻合适的最优解。相同输入数据的条件下,参数范围越大,消耗的资源越多,系统响应的时间越长。 ### 示例及结果 -针对 i32 列进行数据预测,输入列 i32 每 10 个点是一个周期,start_p 起始是 1, 最大拟合是 5,start_q是1,最大值是5,预测结果中返回 95% 置信区间范围边界。 +针对 i32 列进行数据预测,输入列 i32 每 10 个点是一个周期,start_p 起始是 1, 最大拟合是 5,start_q 是 1,最大值是 5,预测结果中返回 95% 置信区间范围边界。 ``` -FORECAST(i32, "algo=arima,alpha=95,period=10, start_p=1, max_p=5, start_q=1, max_q=5") +FORECAST(i32, "algo=arima,alpha=95,period=10,start_p=1,max_p=5,start_q=1,max_q=5") ``` ```json5 diff --git a/docs/zh/06-advanced/06-data-analysis/02-holtwinters.md b/docs/zh/06-advanced/06-data-analysis/02-holtwinters.md index 470ef462539f..6fb4bffdc977 100644 --- a/docs/zh/06-advanced/06-data-analysis/02-holtwinters.md +++ b/docs/zh/06-advanced/06-data-analysis/02-holtwinters.md @@ -6,8 +6,8 @@ sidebar_label: "HoltWinters" 本节讲述 HoltWinters 算法模型的使用方法。 ## 功能概述 -HoltWinters模型又称为多次指数平滑模型(EMA)。对含有线性趋势和周期波动的非平稳序列适用,利用指数平滑法让模型参数不断适应非平稳序列的变化,并对未来趋势进行**短期**预测。 -HoltWinters有两种不同的季节性组成部分,当季节变化在该时间序列中大致保持不变时,通常选择**加法模型**;而当季节变化与时间序列的水平成比例变化时,通常选择**乘法模型**。 +HoltWinters 模型又称为多次指数平滑模型(EMA)。适用于含有线性趋势和周期波动的非平稳序列,利用指数平滑法让模型参数不断适应非平稳序列的变化,并对未来趋势进行**短期**预测。 +HoltWinters 有两种不同的季节性组成部分,当季节变化在该时间序列中大致保持不变时,通常选择**加法模型**;而当季节变化与时间序列的水平成比例变化时,通常选择**乘法模型**。 该模型对于返回数据也不提供计算的置信区间范围结果。在 95% 置信区间的上下界结果与预测结果相同。 @@ -16,9 +16,9 @@ HoltWinters有两种不同的季节性组成部分,当季节变化在该时间 分析平台中使用自动化的 ARIMA 模型进行计算,因此每次计算的时候会根据输入的数据自动拟合最合适的模型,然后根据该模型进行预测输出结果。 |参数名称|说明|必填项| |---|---|---| -|period| 输入时间序列数据每个周期包含的数据点个数。如果不设置该参数或则该参数设置为 0, 将使用一次(简单)指数平滑方式进行数据拟合,并据此进行未来数据的预测|选填| -|trend| 趋势模型使用加法模型还是乘法模型|选填| -|seasonal| 季节性采用加法模型还是乘法模型|选填| +|period|输入时间序列每个周期包含的数据点个数。如果不设置该参数或该参数设置为 0, 将使用一次(简单)指数平滑方式进行数据拟合,并据此进行未来数据的预测|选填| +|trend|趋势模型使用加法模型还是乘法模型|选填| +|seasonal|季节性采用加法模型还是乘法模型|选填| 参数 `trend` 和 `seasonal`的均可以选择 `add` (加法模型)或 `mul`(乘法模型)。 @@ -30,11 +30,11 @@ FORECAST(i32, "algo=holtwinters,period=10,trend=mul,seasonal=mul") ```json5 { -"rows": rows, // 结果的行数 -"period": period, // 返回结果的周期性, 该结果与输入的周期性相同,如果没有周期性,该值为 0 -"algo": 'holtwinters' // 返回结果使用的计算模型 -"mse":mse, // 最小均方误差(minmum square error) -"res": res // 具体的结果,按照列形式返回的结果。一般意义上包含了 两列[timestamp][fc_results]。 +"rows": rows, // 结果的行数 +"period": period, // 返回结果的周期性, 该结果与输入的周期性相同,如果没有周期性,该值为 0 +"algo": 'holtwinters' // 返回结果使用的计算模型 +"mse":mse, // 最小均方误差(minmum square error) +"res": res // 具体的结果,按照列形式返回的结果。一般意义上包含了 两列 [timestamp][fc_results]。 } ``` diff --git a/docs/zh/06-advanced/06-data-analysis/03-anomaly-detection.md b/docs/zh/06-advanced/06-data-analysis/03-anomaly-detection.md index 8f1e1f064a79..d0da330ab3bc 100644 --- a/docs/zh/06-advanced/06-data-analysis/03-anomaly-detection.md +++ b/docs/zh/06-advanced/06-data-analysis/03-anomaly-detection.md @@ -3,7 +3,7 @@ title: "Anomaly-detection" sidebar_label: "Anomaly-detection" --- -本节讲述 异常检测 算法模型的使用方法。 +本节讲述 异常检测算法模型的使用方法。 ## 概述 分析平台提供了 6 种异常检查模型,6 种异常检查模型分为 3 个类别,分别属于基于统计的异常检测模型、基于数据密度的检测模型、基于深度学习的异常检测模型。在不指定异常检测使用的方法的情况下,默认调用 iqr 的方法进行计算。 @@ -11,7 +11,7 @@ sidebar_label: "Anomaly-detection" ### 统计学异常检测方法 -- k-sigma[1]: 即 ***68–95–99.7 rule*** 。***k***值默认为3, 即序列均值的 3 倍标准差范围为边界,超过边界的是异常值。KSigma 要求数据整体上服从正态分布,如果一个点偏离均值K倍标准差,则该点被视为异常点. +- k-sigma[1]: 即 ***68–95–99.7 rule*** 。***k***值默认为 3, 即序列均值的 3 倍标准差范围为边界,超过边界的是异常值。KSigma 要求数据整体上服从正态分布,如果一个点偏离均值 K 倍标准差,则该点被视为异常点. |参数名称|说明|是否必选|默认值| |---|---|---|---| @@ -22,7 +22,7 @@ sidebar_label: "Anomaly-detection" - Grubbs[3]: 又称为 Grubbs' test,即最大标准残差测试。Grubbs 通常用作检验最大值、最小值偏离均值的程度是否为异常,该单变量数据集遵循近似标准正态分布。非正态分布数据集不能使用该方法。无输入参数。 -- SHESD[4]: 带有季节性的 ESD 检测算法。ESD 可以检测时间序列数据的多异常点。需要指定异常点比例的上界***k***,最差的情况是至多49.9%。数据集的异常比例一般不超过5% +- SHESD[4]: 带有季节性的 ESD 检测算法。ESD 可以检测时间序列数据的多异常点。需要指定异常点比例的上界***k***,最差的情况是至多 49.9%。数据集的异常比例一般不超过 5% |参数名称|说明|是否必选|默认值| |---|---|---|---| @@ -30,7 +30,7 @@ sidebar_label: "Anomaly-detection" ### 基于数据密度的检测方法 -LOF[5]: 局部离群因子(LOF,又叫局部异常因子)算法是Breunig于2000年提出的一种基于密度的局部离群点检测算法,该方法适用于不同类簇密度分散情况迥异的数据。根据数据点周围的数据密集情况,首先计算每个数据点的一个局部可达密度,然后通过局部可达密度进一步计算得到每个数据点的一个离群因子,该离群因子即标识了一个数据点的离群程度,因子值越大,表示离群程度越高,因子值越小,表示离群程度越低。最后,输出离群程度最大的top(n)个点。 +LOF[5]: 局部离群因子(LOF,又叫局部异常因子)算法是 Breunig 于 2000 年提出的一种基于密度的局部离群点检测算法,该方法适用于不同类簇密度分散情况迥异的数据。根据数据点周围的数据密集情况,首先计算每个数据点的一个局部可达密度,然后通过局部可达密度进一步计算得到每个数据点的一个离群因子,该离群因子即标识了一个数据点的离群程度,因子值越大,表示离群程度越高,因子值越小,表示离群程度越低。最后,输出离群程度最大的 top(n) 个点。 ### 基于深度学习的检测方法 diff --git a/docs/zh/06-advanced/06-data-analysis/addins.md b/docs/zh/06-advanced/06-data-analysis/addins.md index 8b50c93d85bb..aeaf08d49088 100644 --- a/docs/zh/06-advanced/06-data-analysis/addins.md +++ b/docs/zh/06-advanced/06-data-analysis/addins.md @@ -11,10 +11,10 @@ sidebar_label: "addins" |目录|说明| |---|---| -|taos|Python 源代码目录,其下包含了算法具体保存目录 algo,放置杂项目录 misc, 单元测试和集成测试目录 test。 algo目录下 ad 放置异常检测算法代码, fc 放置预测算法代码| +|taos|Python 源代码目录,其下包含了算法具体保存目录 algo,放置杂项目录 misc, 单元测试和集成测试目录 test。 algo 目录下 ad 放置异常检测算法代码, fc 放置预测算法代码| |script|是安装脚本和发布脚本放置目录| |model|放置针对数据集完成的训练模型| -|cfg| 配置文件目录| +|cfg|配置文件目录| ## 约定与限制 @@ -23,7 +23,7 @@ sidebar_label: "addins" ### 类命名规范 -算法类的名称需要 以下划线开始,以 Service 结尾。例如:_KsigmaService 是 KSigma 异常检测算法的实现类。 +算法类的名称需要以下划线开始,以 Service 结尾。例如:_KsigmaService 是 KSigma 异常检测算法的实现类。 ### 类继承约定 @@ -38,22 +38,22 @@ sidebar_label: "addins" ### 核心方法输入与输出约定 -`execute` 是算法处理的核心方法。调用该方法的时候, `self.list` 已经设置好输入数组。 +`execute` 是算法处理的核心方法。调用该方法的时候,`self.list` 已经设置好输入数组。 异常检测输出结果 -`execute` 的返回值是长度与 `self.list` 相同的数组,数组位置为 -1 的即为异常值点。例如:输入数组是 [2, 2, 2, 2, 100], 如果 100 是异常点,那么返回值是 [1, 1, 1, 1, -1]。 +`execute` 的返回值是长度与 `self.list` 相同的数组,数组位置为 -1 的即为异常值点。例如:输入数组是 [2, 2, 2, 2, 100], 如果 100 是异常点,那么返回值是 [1, 1, 1, 1, -1]。 预测输出结果 -对于预测算法, `AbstractForecastService` 的对象属性说明如下: +对于预测算法,`AbstractForecastService` 的对象属性说明如下: |属性名称|说明|默认值| |---|---|---| -|period|输入时序数据的周期性,多少个数据点表示一个完整的周期。如果没有周期性,那么设置为 0 即可。| 0| +|period|输入时序数据的周期性,多少个数据点表示一个完整的周期。如果没有周期性,那么设置为 0 即可| 0| |start_ts|预测数据的开始时间| 0| |time_step|预测结果的两个数据点之间时间间隔|0 | |fc_rows|预测结果数量| 0 | |return_conf|返回结果中是否包含执行区间范围,如果算法计算结果不包含置信区间,那么上界和下界与自身相同| 1| -|conf|执行区间分位数 0.05| +|conf|执行区间分位数 0.05| 预测返回结果如下: @@ -76,7 +76,7 @@ from service import AbstractAnomalyDetectionService # 算法实现类名称 需要以下划线 "_" 开始,并以 Service 结束,如下 _IqrService 是 IQR 异常检测算法的实现类。 class _IqrService(AbstractAnomalyDetectionService): - """ IQR algorithm 定义类,从 AbstractAnomalyDetectionService 继承,并实现 AbstractAnomalyDetectionService类的抽象函数 """ + """ IQR algorithm 定义类,从 AbstractAnomalyDetectionService 继承,并实现 AbstractAnomalyDetectionService 类的抽象函数 """ # 定义算法调用关键词,全小写ASCII码(必须添加) name = 'iqr' @@ -111,6 +111,7 @@ class _IqrService(AbstractAnomalyDetectionService): ## 单元测试 在测试文件目录中的 anomaly_test.py 中增加单元测试用例。 + ```python def test_iqr(self): """ 测试 _IqrService 类 """ @@ -137,9 +138,9 @@ def test_iqr(self): ## 需要模型的算法 -针对特定数据集,进行模型训练的算法,在训练完成后。需要将训练得到的模型保存在 model 目录中。需要注意的是,针对每个算法,需要建立独立的文件夹。例如 auto_encoder 的训练算法在 model 目录下建立了, autoencoder的目录,使用该算法针对不同数据集训练得到的模型,均需要放置在该目录下。 +针对特定数据集,进行模型训练的算法,在训练完成后。需要将训练得到的模型保存在 model 目录中。需要注意的是,针对每个算法,需要建立独立的文件夹。例如 auto_encoder 的训练算法在 model 目录下建立 autoencoder 的目录,使用该算法针对不同数据集训练得到的模型,均需要放置在该目录下。 -训练完成后的模型,使用 joblib 进行保存。 +训练完成后的模型,使用 joblib 进行保存。 并在 model 目录下建立对应的文件夹存放该模型。 diff --git a/docs/zh/06-advanced/06-data-analysis/index.md b/docs/zh/06-advanced/06-data-analysis/index.md index e3bf2f4158f4..df04c91d285f 100644 --- a/docs/zh/06-advanced/06-data-analysis/index.md +++ b/docs/zh/06-advanced/06-data-analysis/index.md @@ -5,18 +5,18 @@ title: 数据分析功能 ## 概述 -TDengine 通过 ANode(AnalysisNode) 是提供数据分析功能的扩展组件,通过 Restful 接口提供分析服务,从而拓展 TDengine 的功能,支持时间序列高级分析功能。 -ANode 是无状态的数据分析节点,集群中可以存在多个 ANode节点,相互之间没有关联。将 ANode 注册到 TDengine 集群以后,通过 SQL 语句即可调用并完成时序分析任务。 +ANode(Analysis Node)是 TDengine 提供数据分析功能的扩展组件,通过 Restful 接口提供分析服务,拓展 TDengine 的功能,支持时间序列高级分析。 +ANode 是无状态的数据分析节点,集群中可以存在多个 ANode 节点,相互之间没有关联。将 ANode 注册到 TDengine 集群以后,通过 SQL 语句即可调用并完成时序分析任务。 下图是数据分析的技术架构示意图。 ![数据分析功能架构图](./pic/data-analysis.png) ## 安装部署 ### 环境准备 -ANode 的要求节点上准备有 Python 3.10 及以上版本以及相应的Python包自动安装组件 Pip ,同时请确保能够正常连接互联网。 +ANode 要求节点上准备有 Python 3.10 及以上版本,以及相应的 Python 包自动安装组件 Pip,同时请确保能够正常连接互联网。 ### 安装及卸载 -使用专门的 ANode 安装包 TDengine-enterprise-anode-1.x.x.tar.gz 进行 ANode 的安装部署工作,安装过程与 TDengien 的安装流程一致。 +使用专门的 ANode 安装包 TDengine-enterprise-anode-1.x.x.tar.gz 进行 ANode 的安装部署工作,安装过程与 TDengine 的安装流程一致。 ```bash tar -xzvf TDengine-enterprise-anode-1.0.0.tar.gz @@ -30,7 +30,7 @@ sudo ./install.sh 为了避免 ANode 安装后影响目标节点现有的 Python 库。 ANode 使用 Python 虚拟环境运行,安装后的默认 Python 目录处于 `/var/lib/taos/taosanode/venv/`。为了避免反复安装虚拟环境带来的开销,卸载 ANode 并不会自动删除该虚拟环境,如果您确认不需要 Python 的虚拟环境,可以手动删除。 ## 启动及停止服务 -安装 ANode 以后,可以使用`systemctl`来管理 ANode 的服务。使用如下命令可以启动/停止/检查状态。 +安装 ANode 以后,可以使用 `systemctl` 来管理 ANode 的服务。使用如下命令可以启动/停止/检查状态。 ```bash systemctl start taosanoded @@ -50,27 +50,27 @@ systemctl status taosanoded ### 配置说明 -Anode 提供的 RestFul 服务使用 uWSGI 驱动,因此 ANode 的配置和 uWSGI 的配置在同一个配置文件中,具体如下: +Anode 提供的 RestFul 服务使用 uWSGI 驱动,因此 ANode 和 uWSGI 的配置信息存放在同一个配置文件中,具体如下: ```ini [uwsgi] # charset -env=LC_ALL=en_US.UTF-8 +env = LC_ALL = en_US.UTF-8 # ip:port http = 127.0.0.1:6050 # the local unix socket file than communicate to Nginx #socket = 127.0.0.1:8001 -#socket-timeout=10 +#socket-timeout = 10 # base directory chdir = /usr/local/taos/taosanode/lib # initialize python file -wsgi-file = /usr/local/taos/taosanode/lib/app.py +wsgi-file = /usr/local/taos/taosanode/lib/taos/app.py -# invoke app model +# call module of uWSGI callable = app # auto remove unix Socket and pid file when stopping @@ -80,10 +80,10 @@ vacuum = true #chmod-socket = 664 # uWSGI pid -uid=root +uid = root # uWSGI gid -gid=root +gid = root # main process master = true @@ -92,25 +92,27 @@ master = true processes = 2 # pid file -pidfile = /usr/local/taos/taosanode/uwsgi.pid +pidfile = /usr/local/taos/taosanode/taosanode.pid # enable threads -enable-threads=true +enable-threads = true # the number of threads for each process -threads=2 +threads = 4 # memory useage report memory-report = true + +# smooth restart reload-mercy = 10 # conflict with systemctl, so do NOT uncomment this # daemonize = /var/log/taos/taosanode/taosanode.log -# set log +# log directory logto = /var/log/taos/taosanode/taosanode.log -# monitor server +# wWSGI monitor port stats = 127.0.0.1:8387 # python virtual environment directory @@ -121,10 +123,13 @@ virtualenv = /usr/local/taos/taosanode/venv/ app-log = /var/log/taos/taosanode/taosanode.app.log # model storage directory -model-dir=/usr/local/taos/taosanode/model/ +model-dir = /usr/local/taos/taosanode/model/ # default log level log-level = DEBUG + +# draw the query results +draw-result = 0 ``` **提示** @@ -137,7 +142,7 @@ log-level = DEBUG ```sql CREATE ANODE {node_url} ``` -node_url 是提供服务的 ANode 的 IP 和 PORT, 例如:`create anode 'http://localhost:6050'`。启动 ANode 以后如果不注册到 TDengine 集群中,无法提供正常的服务。不建议 ANode 注册到两个或多个集群中。 +node_url 是提供服务的 ANode 的 IP 和 PORT, 例如:`create anode 'http://localhost:6050'`。启动 ANode 以后如果不注册到 TDengine 集群中,则无法提供正常的服务。不建议 ANode 注册到两个或多个集群中。 #### 查看 ANode 列出集群中所有的数据分析节点,包括其 `FQDN`, `PORT`, `STATUS`。 @@ -167,24 +172,23 @@ DROP ANODE {anode_id} #### 白噪声检查 -平台提供 Restful的服务检测输入时间序列是否是白噪声时间序列(White Noise Data, WND),白噪声时间序列及随机数序列。 -此外,分析平台要求输入的数据不能是 , 因此针对的所有数据均默认进行 白噪声检查。当前白噪声检查采用通行的 `Ljung-Box`检验,`Ljung-Box` 统计量检查过程需要遍历整个输入序列并进行计算。 +分析平台提供的 Restful 服务要求输入的时间序列不能是白噪声时间序列(White Noise Data, WND)和随机数序列 , 因此针对所有数据均默认进行白噪声检查。当前白噪声检查采用通行的 `Ljung-Box` 检验,`Ljung-Box` 统计量检查过程需要遍历整个输入序列并进行计算。 如果用户能够明确输入序列一定不是白噪声序列,那么可以通过输入参数,指定预测之前忽略该检查,从而节省分析过程的 CPU 计算资源。 同时支持独立地针对输入序列进行白噪声检测(该检测功能暂不独立对外开放)。 #### 数据重采样和时间戳对齐 -数据分析平台支持将输入的数据进行重采样的预处理,从而确保输出结果按照用户指定的等间隔进行处理。处理过程分为两种类别: +分析平台支持将输入数据进行重采样预处理,从而确保输出结果按照用户指定的等间隔进行处理。处理过程分为两种类别: -- 数据时间戳对齐。由于真实数据时间可能并非严格按照查询指定的时间戳输入。此时数据平台将自动将数据的时间间隔按照指定的时间间隔进行对齐。例如有输入时间序列:[11, 22, 29, 41],用户指定时间间隔为 10,那么该序列将被对齐重整为以下序列 [10, 20, 30, 40]。 -- 数据时间重采样。用户输入的时间序列其采样频率超过了指定的查询需要获得结果的时间间隔,例如输入原始数据是 5, 但是输出结果的频率是 10. [0, 5, 10, 15, 20, 25, 30],那么该输入数据列将重采用为间隔 为 10 的输入序列,其结果如下 [0, 10, 20,30]。[5, 15, 25] 处的数据将被丢弃。 +- 数据时间戳对齐。由于真实数据可能并非严格按照查询指定的时间戳输入。此时分析平台会自动将数据的时间间隔按照指定的时间间隔进行对齐。例如输入时间序列 [11, 22, 29, 41],用户指定时间间隔为 10,该序列将被对齐重整为以下序列 [10, 20, 30, 40]。 +- 数据时间重采样。用户输入时间序列的采样频率超过了输出结果的频率,例如输入时间序列的采样频率是 5,输出结果的频率是 10,输入时间序列 [0, 5, 10, 15, 20, 25, 30] 将被重采用为间隔 为 10 的序列 [0, 10, 20,30],[5, 15, 25] 处的数据将被丢弃。 -需要注意的是,数据输入平台不支持缺失数据补齐后进行的预测分析,如果输入时间序列数据[11, 22, 29, 49],并且用户要求的时间间隔为 10, 重整对齐后的序列是 [10, 20, 30, 50] 那么该序列进行预测分析将返回错误。 +需要注意的是,数据输入平台不支持缺失数据补齐后进行的预测分析,如果输入时间序列数据 [11, 22, 29, 49],并且用户要求的时间间隔为 10,重整对齐后的序列是 [10, 20, 30, 50] 那么该序列进行预测分析将返回错误。 #### 时序数据异常检测 -异常检测是针对输入的时序数据,使用预设或用户指定的算法确定时间序列中**可能**出现异常时间序列点,对于时间序列中若干个连续的异常点,将自动合并成为一个连续的(闭区间)异常窗口。对于只有单个点的场景,异常窗口窗口退化成为一个起始时间和结束时间相同的点。 +异常检测是针对输入的时序数据,使用预设或用户指定的算法确定时间序列中**可能**出现异常的时间序列点,对于时间序列中若干个连续的异常点,将自动合并成为一个连续的(闭区间)异常窗口。对于只有单个点的场景,异常窗口窗口退化成为一个起始时间和结束时间相同的点。 异常检测生成的异常窗口受检测算法和算法参数的共同影响,对于异常窗口范围内的数据,可以应用 TDengine 提供的聚合和标量函数进行查询或变换处理。 对于输入时间序列 (1, 20), (2, 22), (3, 91), (4, 120), (5, 18), (6, 19)。系统检测到 (3, 91), (4, 120) 为异常点,那么返回的异常窗口是闭区间 [3, 4]。 @@ -201,18 +205,18 @@ algo=expr1 "} ``` -1. `column`:进行时序数据异常检测的输入数据列,当前只支持单列输入,且只能是数值类型,不能是字符类型(例如:`NCHAR` `VARCHAR` `VARBINARY`等类型),**不支持函数表达式**。 -2. `options`:字符串。其中使用 K/V 调用异常检测的算法,及与算法相关的参数。采用 逗号分隔的K/V字符串表示,其中的字符串不需要使用单引号、双引号、或转意号等符号,不能使用中文及其他宽字符。例如:`algo=ksigma, k=2` 表示进行异常检测的算法是 ksigma,该算法接受的输入参数是 2。 +1. `column`:进行时序数据异常检测的输入数据列,当前只支持单列,且只能是数值类型,不能是字符类型(例如:`NCHAR` `VARCHAR` `VARBINARY`等类型),**不支持函数表达式**。 +2. `options`:字符串。其中使用 K=V 调用异常检测算法及与算法相关的参数。采用逗号分隔的 K=V 字符串表示,其中的字符串不需要使用单引号、双引号、或转义号等符号,不能使用中文及其他宽字符。例如:`algo=ksigma,k=2` 表示进行异常检测的算法是 ksigma,该算法接受的输入参数是 2。 3. 异常检测的结果可以作为外层查询的子查询输入,在 `SELECT` 子句中使用的聚合函数或标量函数与其他类型的窗口查询相同。 -4. 输入数据默认进行白噪声检查,如果检查结果是输入数据是白噪声,将不会有任何(异常)窗口信息返回。 +4. 输入数据默认进行白噪声检查,如果输入数据是白噪声,将不会有任何(异常)窗口信息返回。 **参数说明** |参数|含义|默认值| |---|---|---| |algo|异常检测调用的算法|iqr| -|wncheck|对输入数据列是否进行白噪声检查|取值为0或者1,默认值为 1,表示进行白噪声检查| +|wncheck|对输入数据列是否进行白噪声检查|取值为 0 或者 1,默认值为 1,表示进行白噪声检查| -异常检测的返回结果以窗口的形式呈现,因此窗口查询相关的伪列在这种场景下仍然可用。可以使用的伪列如下: +异常检测的返回结果以窗口形式呈现,因此窗口查询相关的伪列在这种场景下仍然可用。可以使用的伪列如下: 1. `_WSTART`: 异常窗口开始时间戳 2. `_WEND`:异常窗口结束时间戳 3. `_WDURATION`:异常窗口持续时间 @@ -232,9 +236,9 @@ ANOMALY_WINDOW(i32, "algo=ksigma,k=2"); ``` taos> SELECT _wstart, _wend, count(*) FROM ai.atb ANOMAYL_WINDOW(i32); - _wstart | _wend | count(*) | -============================================================================ - 2020-01-01 00:00:16.000 | 2020-01-01 00:00:16.001 | 1 | + _wstart | _wend | count(*) | +==================================================================== + 2020-01-01 00:00:16.000 | 2020-01-01 00:00:16.001 | 1 | Query OK, 1 row(s) in set (0.028946s) ``` @@ -267,7 +271,7 @@ algo=expr1 ``` 1. `column_expr`:预测的时序数据列。与异常检测相同,只支持数值类型输入。 -2. `options`:异常检测函数的参数,使用规则与 anomaly_window 相同。预测还支持`conf`, `every`, `rows`, `start`, `rows` 几个参数,其含义如下: +2. `options`:异常检测函数的参数,使用规则与 anomaly_window 相同。预测还支持 `conf`, `every`, `rows`, `start`, `rows` 几个参数,其含义如下: **参数说明** @@ -275,13 +279,13 @@ algo=expr1 |---|---|---| |algo|预测分析使用的算法|holtwinters| |wncheck|白噪声(white noise data)检查|默认值为 1,0 表示不进行检查| -|conf|预测数据的置信区间范围 ,取值范围[0, 100]|95| +|conf|预测数据的置信区间范围 ,取值范围 [0, 100]|95| |every|预测数据的采样间隔|输入数据的采样间隔| |start|预测结果的开始时间戳|输入数据最后一个时间戳加上一个采样时间段| |rows|预测结果的记录数|10| -1. 预测查询结果新增了三个伪列,具体如下: `_FROWTS`:预测结果的时间戳、`_FLOW`:置信区间下界、`_FHIGH`:置信区间上界, 对于没有置信区间的预测算法,其置信区间同预测结果 -2. 更改参数 `START`:返回预测结果的起始时间,改变这个起始时间不会影响返回的预测数值,只影响起始时间。 +1. 预测查询结果新增了三个伪列,具体如下:`_FROWTS`:预测结果的时间戳、`_FLOW`:置信区间下界、`_FHIGH`:置信区间上界, 对于没有置信区间的预测算法,其置信区间同预测结果 +2. 更改参数 `START`:返回预测结果的起始时间,改变起始时间不会影响返回的预测数值,只影响起始时间。 3. `EVERY`:可以与输入数据的采样频率不同。采样频率只能低于或等于输入数据采样频率,不能**高于**输入数据的采样频率。 4. 对于某些不需要计算置信区间的算法,即使指定了置信区间,返回的结果中其上下界退化成为一个点。 @@ -292,12 +296,12 @@ algo=expr1 SELECT _flow, _fhigh, _frowts, FORECAST(i32, "algo=arima") FROM ai.ftb; ---- 使用 arima 算法进行预测,输入数据的是周期数据,每10个采样点是一个周期。返回置信区间是 95%. +--- 使用 arima 算法进行预测,输入数据的是周期数据,每 10 个采样点是一个周期。返回置信区间是 95%. SELECT _flow, _fhigh, _frowts, FORECAST(i32, "algo=arima,alpha=95,period=10") FROM ai.ftb; ``` ``` -taos> select _flow, _fhigh, _frowts, forecast(i32) from ai.ftb; +taos> select _flow, _fhigh, _frowts, forecast(i32) from ai.ftb; _flow | _fhigh | _frowts | forecast(i32) | ======================================================================================== 10.5286684 | 41.8038254 | 2020-01-01 00:01:35.001 | 26 | From 1790f2929e5749c0a63d38a695f07dcb2106e701 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 6 Nov 2024 09:41:36 +0800 Subject: [PATCH 650/695] docs: data analysis --- .../06-advanced/06-data-analysis/01-arima.md | 22 +++++++-------- .../06-data-analysis/02-holtwinters.md | 16 +++++------ .../06-data-analysis/03-anomaly-detection.md | 10 +++---- .../zh/06-advanced/06-data-analysis/addins.md | 28 ++++++++++--------- docs/zh/06-advanced/06-data-analysis/index.md | 2 +- 5 files changed, 40 insertions(+), 38 deletions(-) diff --git a/docs/zh/06-advanced/06-data-analysis/01-arima.md b/docs/zh/06-advanced/06-data-analysis/01-arima.md index 56383b7e8688..b9d63e924f8e 100644 --- a/docs/zh/06-advanced/06-data-analysis/01-arima.md +++ b/docs/zh/06-advanced/06-data-analysis/01-arima.md @@ -8,11 +8,11 @@ sidebar_label: "ARIMA" ## 功能概述 ARIMA 即自回归移动平均模型(Autoregressive Integrated Moving Average, ARIMA),也记作 ARIMA(p,d,q),是统计模型中最常见的一种用来进行时间序列预测的模型。 -ARIMA 模型是一种自回归模型,只需要自变量即可预测后续的值。ARIMA 模型要求时序数据**平稳**,或经过差分处理后平稳,如果是不平稳的数据,**无法**获得正确的结果。 +ARIMA 模型是一种自回归模型,只需要自变量即可预测后续的值。ARIMA 模型要求时间序列**平稳**,或经过差分处理后平稳,如果是不平稳的数据,**无法**获得正确的结果。 >平稳的时间序列:其性质不随观测时间的变化而变化。具有趋势或季节性的时间序列不是平稳时间序列——趋势和季节性使得时间序列在不同时段呈现不同性质。 -以下参数可以动态输入控制预测过程中生成 合适的 ARIMA 的模型。 +以下参数可以动态输入,控制预测过程中生成合适的 ARIMA 模型。 - p= 自回归模型阶数 - d= 差分阶数 @@ -21,13 +21,13 @@ ARIMA 模型是一种自回归模型,只需要自变量即可预测后续的 ### 参数 分析平台中使用自动化的 ARIMA 模型进行计算,因此每次计算的时候会根据输入的数据自动拟合最合适的模型,然后根据该模型进行预测输出结果。 -|参数名称|说明|必填项| -|---|---|---| -|period|输入时间序列每个周期包含的数据点个数。如果不设置该参数或该参数设置为 0,将使用非季节性/周期性的 ARIMA 模型预测。|选填| -|start_p|自回归模型阶数的起始值,0 开始的整数,不推荐大于 10 |选填| -|max_p|自回归模型阶数的结束值,0 开始的整数,不推荐大于 10 |选填| -|start_q|移动平均模型阶数的起始值,0 开始的整数,不推荐大于 10 |选填| -|max_q|移动平均模型阶数的结束值,0 开始的整数,不推荐大于 10 |选填| +|参数|说明|必填项| +|---|---|-----| +|period|输入时间序列每个周期包含的数据点个数,如果不设置该参数或该参数设置为 0,将使用非季节性/周期性的 ARIMA 模型预测|选填| +|start_p|自回归模型阶数的起始值,0 开始的整数,不推荐大于 10|选填| +|max_p|自回归模型阶数的结束值,0 开始的整数,不推荐大于 10|选填| +|start_q|移动平均模型阶数的起始值,0 开始的整数,不推荐大于 10|选填| +|max_q|移动平均模型阶数的结束值,0 开始的整数,不推荐大于 10|选填| |d|差分阶数|选填| `start_p`、`max_p` `start_q` `max_q` 四个参数约束了模型在多大的范围内去搜寻合适的最优解。相同输入数据的条件下,参数范围越大,消耗的资源越多,系统响应的时间越长。 @@ -40,11 +40,11 @@ FORECAST(i32, "algo=arima,alpha=95,period=10,start_p=1,max_p=5,start_q=1,max_q=5 ```json5 { -"rows": fc_rows, // 预测结果的行数 +"rows": fc_rows, // 返回结果的行数 "period": period, // 返回结果的周期性,同输入 "alpha": alpha, // 返回结果的置信区间,同输入 "algo": "arima", // 返回结果使用的算法 -"mse":mse, // 拟合输入时序数据时候生成模型的最小均方误差(MSE) +"mse": mse, // 拟合输入时间序列时候生成模型的最小均方误差(MSE) "res": res // 列模式的结果 } ``` diff --git a/docs/zh/06-advanced/06-data-analysis/02-holtwinters.md b/docs/zh/06-advanced/06-data-analysis/02-holtwinters.md index 6fb4bffdc977..38662ca2b302 100644 --- a/docs/zh/06-advanced/06-data-analysis/02-holtwinters.md +++ b/docs/zh/06-advanced/06-data-analysis/02-holtwinters.md @@ -8,15 +8,15 @@ sidebar_label: "HoltWinters" ## 功能概述 HoltWinters 模型又称为多次指数平滑模型(EMA)。适用于含有线性趋势和周期波动的非平稳序列,利用指数平滑法让模型参数不断适应非平稳序列的变化,并对未来趋势进行**短期**预测。 HoltWinters 有两种不同的季节性组成部分,当季节变化在该时间序列中大致保持不变时,通常选择**加法模型**;而当季节变化与时间序列的水平成比例变化时,通常选择**乘法模型**。 -该模型对于返回数据也不提供计算的置信区间范围结果。在 95% 置信区间的上下界结果与预测结果相同。 +该模型对于返回数据不提供计算的置信区间范围结果,在 95% 置信区间的上下界结果与预测结果相同。 ### 参数 -分析平台中使用自动化的 ARIMA 模型进行计算,因此每次计算的时候会根据输入的数据自动拟合最合适的模型,然后根据该模型进行预测输出结果。 -|参数名称|说明|必填项| +分析平台中使用自动化的 HoltWinters 模型进行计算,因此每次计算的时候会根据输入的数据自动拟合最合适的模型,然后根据该模型进行预测输出结果。 +|参数|说明|必填项| |---|---|---| -|period|输入时间序列每个周期包含的数据点个数。如果不设置该参数或该参数设置为 0, 将使用一次(简单)指数平滑方式进行数据拟合,并据此进行未来数据的预测|选填| +|period|输入时间序列每个周期包含的数据点个数。如果不设置该参数或该参数设置为 0,将使用一次(简单)指数平滑方式进行数据拟合,并据此进行未来数据的预测|选填| |trend|趋势模型使用加法模型还是乘法模型|选填| |seasonal|季节性采用加法模型还是乘法模型|选填| @@ -30,11 +30,11 @@ FORECAST(i32, "algo=holtwinters,period=10,trend=mul,seasonal=mul") ```json5 { -"rows": rows, // 结果的行数 -"period": period, // 返回结果的周期性, 该结果与输入的周期性相同,如果没有周期性,该值为 0 +"rows": rows, // 返回结果的行数 +"period": period, // 返回结果的周期性,该结果与输入的周期性相同,如果没有周期性,该值为 0 "algo": 'holtwinters' // 返回结果使用的计算模型 -"mse":mse, // 最小均方误差(minmum square error) -"res": res // 具体的结果,按照列形式返回的结果。一般意义上包含了 两列 [timestamp][fc_results]。 +"mse": mse, // 最小均方误差(minmum square error) +"res": res // 具体的结果,按照列形式返回的结果。一般意义上包含了两列 [timestamp][fc_results]。 } ``` diff --git a/docs/zh/06-advanced/06-data-analysis/03-anomaly-detection.md b/docs/zh/06-advanced/06-data-analysis/03-anomaly-detection.md index d0da330ab3bc..bdfa455ae36f 100644 --- a/docs/zh/06-advanced/06-data-analysis/03-anomaly-detection.md +++ b/docs/zh/06-advanced/06-data-analysis/03-anomaly-detection.md @@ -3,7 +3,7 @@ title: "Anomaly-detection" sidebar_label: "Anomaly-detection" --- -本节讲述 异常检测算法模型的使用方法。 +本节讲述异常检测算法模型的使用方法。 ## 概述 分析平台提供了 6 种异常检查模型,6 种异常检查模型分为 3 个类别,分别属于基于统计的异常检测模型、基于数据密度的检测模型、基于深度学习的异常检测模型。在不指定异常检测使用的方法的情况下,默认调用 iqr 的方法进行计算。 @@ -11,20 +11,20 @@ sidebar_label: "Anomaly-detection" ### 统计学异常检测方法 -- k-sigma[1]: 即 ***68–95–99.7 rule*** 。***k***值默认为 3, 即序列均值的 3 倍标准差范围为边界,超过边界的是异常值。KSigma 要求数据整体上服从正态分布,如果一个点偏离均值 K 倍标准差,则该点被视为异常点. +- k-sigma[1]: 即 ***68–95–99.7 rule*** 。***k***值默认为 3,即序列均值的 3 倍标准差范围为边界,超过边界的是异常值。KSigma 要求数据整体上服从正态分布,如果一个点偏离均值 K 倍标准差,则该点被视为异常点. -|参数名称|说明|是否必选|默认值| +|参数|说明|是否必选|默认值| |---|---|---|---| |k|标准差倍数|选填|3| -- IQR[2]:四分位距 (Interquartile range, IQR) 是一种衡量变异性的方法. 四分位数将一个按等级排序的数据集划分为四个相等的部分。即 Q1(第 1 个四分位数)、Q2(第 2 个四分位数)和 Q3(第 3 个四分位数)。IQR 定义为 Q3–Q1,位于 Q3+1.5 。无输入参数。 +- IQR[2]:四分位距 (Interquartile range, IQR) 是一种衡量变异性的方法. 四分位数将一个按等级排序的数据集划分为四个相等的部分。即 Q1(第 1 个四分位数)、Q2(第 2 个四分位数)和 Q3(第 3 个四分位数)。IQR 定义为 Q3–Q1,位于 Q3+1.5。无输入参数。 - Grubbs[3]: 又称为 Grubbs' test,即最大标准残差测试。Grubbs 通常用作检验最大值、最小值偏离均值的程度是否为异常,该单变量数据集遵循近似标准正态分布。非正态分布数据集不能使用该方法。无输入参数。 - SHESD[4]: 带有季节性的 ESD 检测算法。ESD 可以检测时间序列数据的多异常点。需要指定异常点比例的上界***k***,最差的情况是至多 49.9%。数据集的异常比例一般不超过 5% -|参数名称|说明|是否必选|默认值| +|参数|说明|是否必选|默认值| |---|---|---|---| |k|异常点在输入数据集中占比,范围是$`1\le K \le 49.9`$ |选填|5| diff --git a/docs/zh/06-advanced/06-data-analysis/addins.md b/docs/zh/06-advanced/06-data-analysis/addins.md index aeaf08d49088..c0b892171821 100644 --- a/docs/zh/06-advanced/06-data-analysis/addins.md +++ b/docs/zh/06-advanced/06-data-analysis/addins.md @@ -3,7 +3,7 @@ title: "addins" sidebar_label: "addins" --- -本节说明如何将自己开发的新预测算法和异常检测算法整合到 TDengine 分析平台, 并能够通过 SQL 语句进行调用。 +本节说明如何将自己开发的预测算法和异常检测算法整合到 TDengine 分析平台,并能够通过 SQL 语句进行调用。 ## 目录结构 @@ -11,14 +11,14 @@ sidebar_label: "addins" |目录|说明| |---|---| -|taos|Python 源代码目录,其下包含了算法具体保存目录 algo,放置杂项目录 misc, 单元测试和集成测试目录 test。 algo 目录下 ad 放置异常检测算法代码, fc 放置预测算法代码| +|taos|Python 源代码目录,其下包含了算法具体保存目录 algo,放置杂项目录 misc,单元测试和集成测试目录 test。 algo 目录下 ad 放置异常检测算法代码,fc 放置预测算法代码| |script|是安装脚本和发布脚本放置目录| |model|放置针对数据集完成的训练模型| |cfg|配置文件目录| ## 约定与限制 -定义异常检测算法的 Python 代码文件 需放在 /taos/algo/ad 目录中,预测算法 Python 代码文件需要放在 /taos/algo/fc 目录中,以确保系统启动的时候能够正常加载对应目录下的 Python 文件。 +定义异常检测算法的 Python 代码文件需放在 /taos/algo/ad 目录中,预测算法 Python 代码文件需要放在 /taos/algo/fc 目录中,以确保系统启动的时候能够正常加载对应目录下的 Python 文件。 ### 类命名规范 @@ -27,33 +27,35 @@ sidebar_label: "addins" ### 类继承约定 -异常检测算法需要从 `AbstractAnomalyDetectionService` 继承,并实现其核心抽象方法 `execute`. -预测算法需要从 `AbstractForecastService` 继承,同样需要实现其核心抽象方法 `execute`。 +- 异常检测算法需要从 `AbstractAnomalyDetectionService` 继承,并实现其核心抽象方法 `execute` +- 预测算法需要从 `AbstractForecastService` 继承,同样需要实现其核心抽象方法 `execute` ### 类属性初始化 -每个算法实现的类需要静态初始化两个类属性,分别是 +每个算法实现的类需要静态初始化两个类属性,分别是: -`name`: 的触发调用关键词,全小写英文字母。 -`desc`:该算法的描述信息。 +- `name`:触发调用的关键词,全小写英文字母 +- `desc`:算法的描述信息 ### 核心方法输入与输出约定 `execute` 是算法处理的核心方法。调用该方法的时候,`self.list` 已经设置好输入数组。 + 异常检测输出结果 `execute` 的返回值是长度与 `self.list` 相同的数组,数组位置为 -1 的即为异常值点。例如:输入数组是 [2, 2, 2, 2, 100], 如果 100 是异常点,那么返回值是 [1, 1, 1, 1, -1]。 + 预测输出结果 对于预测算法,`AbstractForecastService` 的对象属性说明如下: |属性名称|说明|默认值| |---|---|---| -|period|输入时序数据的周期性,多少个数据点表示一个完整的周期。如果没有周期性,那么设置为 0 即可| 0| -|start_ts|预测数据的开始时间| 0| +|period|输入时间序列的周期性,多少个数据点表示一个完整的周期。如果没有周期性,那么设置为 0 即可| 0| +|start_ts|预测结果的开始时间| 0| |time_step|预测结果的两个数据点之间时间间隔|0 | -|fc_rows|预测结果数量| 0 | -|return_conf|返回结果中是否包含执行区间范围,如果算法计算结果不包含置信区间,那么上界和下界与自身相同| 1| -|conf|执行区间分位数 0.05| +|fc_rows|预测结果的数量| 0 | +|return_conf|预测结果中是否包含置信区间范围,如果不包含置信区间,那么上界和下界与自身相同| 1| +|conf|置信区间分位数 0.05| 预测返回结果如下: diff --git a/docs/zh/06-advanced/06-data-analysis/index.md b/docs/zh/06-advanced/06-data-analysis/index.md index df04c91d285f..2cbea1caba6c 100644 --- a/docs/zh/06-advanced/06-data-analysis/index.md +++ b/docs/zh/06-advanced/06-data-analysis/index.md @@ -156,7 +156,7 @@ SHOW ANODES; SHOW ANODES FULL; ``` -#### 强制刷新 TDengine 集群中分析算法缓存 +#### 强制刷新集群中的分析算法缓存 ```SQL UPDATE ANODE {node_id} UPDATE ALL ANODES From 379df5f5b2651ef564a431c29abd1713abd56836 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Wed, 6 Nov 2024 10:43:13 +0800 Subject: [PATCH 651/695] add twa ci test --- source/libs/stream/src/streamMeta.c | 6 - .../8-stream/force_window_close_interval.py | 756 +++++------------- 2 files changed, 195 insertions(+), 567 deletions(-) diff --git a/source/libs/stream/src/streamMeta.c b/source/libs/stream/src/streamMeta.c index c0224479afe8..db6c841f5ea0 100644 --- a/source/libs/stream/src/streamMeta.c +++ b/source/libs/stream/src/streamMeta.c @@ -754,9 +754,6 @@ int32_t streamMetaRegisterTask(SStreamMeta* pMeta, int64_t ver, SStreamTask* pTa int32_t val = atomic_add_fetch_32(&pMeta->numOfStreamTasks, 1); } - // enable the scheduler for stream tasks - streamSetupScheduleTrigger(pTask); - *pAdded = true; return code; } @@ -1159,9 +1156,6 @@ void streamMetaLoadAllTasks(SStreamMeta* pMeta) { continue; } - // enable the scheduler for stream tasks after acquire the task RefId. - streamSetupScheduleTrigger(pTask); - stInfo("s-task:0x%x vgId:%d set refId:%"PRId64, (int32_t) id.taskId, vgId, pTask->id.refId); if (pTask->info.fillHistory == 0) { int32_t val = atomic_add_fetch_32(&pMeta->numOfStreamTasks, 1); diff --git a/tests/system-test/8-stream/force_window_close_interval.py b/tests/system-test/8-stream/force_window_close_interval.py index 4a4a6dceeb6a..b75579d2201d 100644 --- a/tests/system-test/8-stream/force_window_close_interval.py +++ b/tests/system-test/8-stream/force_window_close_interval.py @@ -14,24 +14,147 @@ def init(self, conn, logSql, replicaVar=1): tdLog.debug("start to execute %s" % __file__) tdSql.init(conn.cursor(), logSql) self.tdCom = tdCom + + def get_source_firt_ts(self, table_name1): + tdSql.query( + f'select cast(first(ts) as bigint) from {table_name1} order by 1' + ) + # getData don't support negative index + res_ts = tdSql.getData(0, 0) + return res_ts + + def get_source_last_ts(self, table_name1): + tdSql.query( + f'select cast(last(ts) as bigint) from {table_name1} order by 1' + ) + # getData don't support negative index + res_ts = tdSql.getData(0, 0) + return res_ts + + def get_stream_first_win_ts(self, table_name1): + tdSql.query( + f'select _wstart, count(*) from {table_name1} interval({self.tdCom.dataDict["interval"]}s) order by 1' + ) + res_ts = tdSql.getData(0, 0) + return res_ts + + def insert_data(self, custom_col_index, col_value_type): + self.tdCom.date_time = self.tdCom.genTs(precision=self.tdCom.precision)[0] + time.sleep(1) + min_new_ts = 0 + for i in range(self.tdCom.range_count): + cur_time = str(self.tdCom.date_time + self.tdCom.dataDict["interval"]) + ts_value = ( + cur_time + f"+{i * 5 + 30}s" + ) + if min_new_ts == 0: + min_new_ts = ts_value + + ts_cast_delete_value = self.tdCom.time_cast(ts_value) + self.tdCom.sinsert_rows( + tbname=self.tdCom.ctb_name, + ts_value=ts_value, + custom_col_index=custom_col_index, + col_value_type=col_value_type, + ) + if i % 2 == 0 and min_new_ts != ts_value: + self.tdCom.sinsert_rows( + tbname=self.tdCom.ctb_name, + ts_value=ts_value, + custom_col_index=custom_col_index, + col_value_type=col_value_type, + ) + if self.delete and i % 2 != 0: + self.tdCom.sdelete_rows( + tbname=self.tdCom.ctb_name, start_ts=ts_cast_delete_value + ) + self.tdCom.date_time += 1 + self.tdCom.sinsert_rows( + tbname=self.tdCom.tb_name, + ts_value=ts_value, + custom_col_index=custom_col_index, + col_value_type=col_value_type, + ) + if i % 2 == 0 and min_new_ts != ts_value: + self.tdCom.sinsert_rows( + tbname=self.tdCom.tb_name, + ts_value=ts_value, + custom_col_index=custom_col_index, + col_value_type=col_value_type, + ) + if self.delete and i % 2 != 0: + self.tdCom.sdelete_rows( + tbname=self.tdCom.tb_name, start_ts=ts_cast_delete_value + ) + self.tdCom.date_time += 1 + cur_time = str(self.tdCom.date_time + self.tdCom.dataDict["interval"]) + max_new_ts = (cur_time + f"+{self.tdCom.range_count * 10 + 30}s") + self.tdCom.sinsert_rows( + tbname=self.tdCom.ctb_name, + ts_value=max_new_ts, + custom_col_index=custom_col_index, + col_value_type=col_value_type, + ) + self.tdCom.sinsert_rows( + tbname=self.tdCom.tb_name, + ts_value=max_new_ts, + custom_col_index=custom_col_index, + col_value_type=col_value_type, + ) + return (min_new_ts, max_new_ts) + + def insert_disorder_data(self, custom_col_index, col_value_type): + min_ts = self.get_source_firt_ts(self.tb_name) + max_ts = self.get_source_last_ts(self.tb_name) + min_ts_str = str(min_ts) + f"-10000s" + max_ts_str = str(max_ts) + f"+10000s" + self.tdCom.sinsert_rows( + tbname=self.tdCom.ctb_name, + ts_value=min_ts_str, + custom_col_index=custom_col_index, + col_value_type=col_value_type, + ) + self.tdCom.sinsert_rows( + tbname=self.tdCom.tb_name, + ts_value=min_ts_str, + custom_col_index=custom_col_index, + col_value_type=col_value_type, + ) + self.tdCom.sinsert_rows( + tbname=self.tdCom.ctb_name, + ts_value=max_ts_str, + custom_col_index=custom_col_index, + col_value_type=col_value_type, + ) + self.tdCom.sinsert_rows( + tbname=self.tdCom.tb_name, + ts_value=max_ts_str, + custom_col_index=custom_col_index, + col_value_type=col_value_type, + ) def force_window_close( self, interval, partition="tbname", - funciton_name="", - funciton_name_alias="", delete=False, fill_value=None, - fill_history_value=None, - case_when=None, - ignore_expired=1, - ignore_update=1, + filter=None ): # partition must be tbname, and not NONE. tdLog.info( - f"*** testing stream force_window_close+interp+every: every: {interval}, partition: {partition}, fill_history: {fill_history_value}, fill: {fill_value}, delete: {delete}, case_when: {case_when} ***" + f"*** testing stream force_window_close + interval + fill. partition: {partition}, interval: {interval}, fill: {fill_value}, delete: {delete} ***" ) + fwc_downsampling_function_list = ["min(c1)", "max(c2)", "sum(c3)", "twa(c7)", "count(c8)", "elapsed(ts)", "timediff(1, 0, 1h)", "timezone()","min(t1)", "max(t2)", "sum(t3)", + "twa(t7)", "count(t8)"] + fwc_stb_output_select_str = ','.join(list(map(lambda x:f'`{x}`', fwc_downsampling_function_list))) + fwc_tb_output_select_str = ','.join(list(map(lambda x:f'`{x}`', fwc_downsampling_function_list[0:7]))) + fwc_stb_source_select_str = ','.join(fwc_downsampling_function_list) + fwc_tb_source_select_str = ','.join(fwc_downsampling_function_list[0:7]) + + fill_history_value = 0 + ignore_expired = 1 + ignore_update = 1 self.tdCom.subtable = False col_value_type = "Incremental" if partition == "c1" else "random" custom_col_index = 1 if partition == "c1" else None @@ -40,7 +163,6 @@ def force_window_close( self.tdCom.case_name = sys._getframe().f_code.co_name self.tdCom.prepare_data( interval=interval, - fill_history_value=fill_history_value, custom_col_index=custom_col_index, col_value_type=col_value_type, ) @@ -51,228 +173,61 @@ def force_window_close( self.ctb_stream_des_table = f"{self.ctb_name}{self.tdCom.des_table_suffix}" self.tb_stream_des_table = f"{self.tb_name}{self.tdCom.des_table_suffix}" - if partition == "tbname": - if case_when: - stream_case_when_partition = case_when - else: - stream_case_when_partition = self.tdCom.partition_tbname_alias - - partition_elm_alias = self.tdCom.partition_tbname_alias - - elif partition == "c1": - if case_when: - stream_case_when_partition = case_when - else: - stream_case_when_partition = self.tdCom.partition_col_alias - partition_elm_alias = self.tdCom.partition_col_alias - elif partition == "abs(c1)": - partition_elm_alias = self.tdCom.partition_expression_alias - elif partition is None: - partition_elm_alias = '"no_partition"' - else: - partition_elm_alias = self.tdCom.partition_tag_alias - if partition == "tbname" or partition is None: - if case_when: - stb_subtable_value = ( - f'concat(concat("{self.stb_name}_{self.tdCom.subtable_prefix}", {stream_case_when_partition}), "{self.tdCom.subtable_suffix}")' - if self.tdCom.subtable - else None - ) - ctb_subtable_value = ( - f'concat(concat("{self.ctb_name}_{self.tdCom.subtable_prefix}", {stream_case_when_partition}), "{self.tdCom.subtable_suffix}")' - if self.tdCom.subtable - else None - ) - tb_subtable_value = ( - f'concat(concat("{self.tb_name}_{self.tdCom.subtable_prefix}", {stream_case_when_partition}), "{self.tdCom.subtable_suffix}")' - if self.tdCom.subtable - else None - ) - else: - stb_subtable_value = ( - f'concat(concat("{self.stb_name}_{self.tdCom.subtable_prefix}", {partition_elm_alias}), "{self.tdCom.subtable_suffix}")' - if self.tdCom.subtable - else None - ) - ctb_subtable_value = ( - f'concat(concat("{self.ctb_name}_{self.tdCom.subtable_prefix}", {partition_elm_alias}), "{self.tdCom.subtable_suffix}")' - if self.tdCom.subtable - else None - ) - tb_subtable_value = ( - f'concat(concat("{self.tb_name}_{self.tdCom.subtable_prefix}", {partition_elm_alias}), "{self.tdCom.subtable_suffix}")' - if self.tdCom.subtable - else None - ) - else: - stb_subtable_value = ( - f'concat(concat("{self.stb_name}_{self.tdCom.subtable_prefix}", cast(cast(abs(cast({partition_elm_alias} as int)) as bigint) as varchar(100))), "{self.tdCom.subtable_suffix}")' - if self.tdCom.subtable - else None - ) - ctb_subtable_value = ( - f'concat(concat("{self.ctb_name}_{self.tdCom.subtable_prefix}", cast(cast(abs(cast({partition_elm_alias} as int)) as bigint) as varchar(100))), "{self.tdCom.subtable_suffix}")' - if self.tdCom.subtable - else None - ) - tb_subtable_value = ( - f'concat(concat("{self.tb_name}_{self.tdCom.subtable_prefix}", cast(cast(abs(cast({partition_elm_alias} as int)) as bigint) as varchar(100))), "{self.tdCom.subtable_suffix}")' - if self.tdCom.subtable - else None - ) + if partition: - partition_elm = f"partition by {partition} {partition_elm_alias}" + partition_elm = f"partition by {partition}" else: partition_elm = "" + + query_partition_elm = partition_elm + if fill_value: if "value" in fill_value.lower(): - fill_value = "VALUE,1" - - # create error stream - tdLog.info("create error stream") - sleep(10) - tdSql.error( - f"create stream itp_force_error_1 trigger force_window_close IGNORE EXPIRED 1 IGNORE UPDATE 0 into itp_force_error_1 as select _irowts,tbname,_isfilled,interp(c1,1) from {self.stb_name} partition by tbname every(5s) fill(prev) ;" - ) - tdSql.error( - f"create stream itp_force_error_1 trigger force_window_close IGNORE EXPIRED 0 IGNORE UPDATE 1 into itp_force_error_1 as select _irowts,tbname,_isfilled,interp(c1,1) from {self.stb_name} partition by tbname every(5s) fill(prev) ;" - ) - tdSql.error( - f"create stream itp_force_error_1 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 1 into itp_force_error_1 as select _irowts,tbname,_isfilled,interp(c1,1) from {self.stb_name} partition by tbname every(5s) fill(prev) ;" - ) - tdSql.error( - f"create stream itp_force_error_1 trigger force_window_close IGNORE EXPIRED 1 IGNORE UPDATE 0 into itp_force_error_1 as select _irowts,tbname,_isfilled,interp(c11,1) from {self.stb_name} partition by tbname every(5s) fill(prev) ;" - ) + stb_fill_value='VALUE,1,2,3,4,5,6,1,2,3,4,5' + tb_fill_value='VALUE,1,2,3,4,5,6' + else: + stb_fill_value=fill_value + tb_fill_value=fill_value + query_stb_fill_elm = f"fill({stb_fill_value})" + query_tb_fill_elm = f"fill({tb_fill_value})" + else: + query_stb_fill_elm = "" + query_tb_fill_elm = "" + stb_fill_value = None + tb_fill_value=None + + where_elm = "where 1=1" + if filter: + where_elm = f" and {filter}" - # function name : interp trigger_mode = "force_window_close" - # # subtable is true - # create stream add :subtable_value=stb_subtable_value or subtable_value=ctb_subtable_value - # no subtable # create stream super table and child table tdLog.info("create stream super table and child table") self.tdCom.create_stream( - stream_name=f"{self.stb_name}{self.tdCom.stream_suffix}", + stream_name=f'{self.stb_name}{self.tdCom.stream_suffix}', des_table=self.stb_stream_des_table, - source_sql=f'select _irowts as irowts,tbname as table_name, _isfilled as isfilled, {funciton_name} as {funciton_name_alias} from {self.stb_name} {partition_elm} every({self.tdCom.dataDict["interval"]}s)', - trigger_mode=trigger_mode, - fill_value=fill_value, - fill_history_value=fill_history_value, - ignore_expired=ignore_expired, - ignore_update=ignore_update, - ) - self.tdCom.create_stream( - stream_name=f"{self.ctb_name}{self.tdCom.stream_suffix}", - des_table=self.ctb_stream_des_table, - source_sql=f'select _irowts as irowts, tbname as table_name, _isfilled as isfilled, {funciton_name} as {funciton_name_alias} from {self.ctb_name} {partition_elm} every({self.tdCom.dataDict["interval"]}s)', - trigger_mode=trigger_mode, - fill_value=fill_value, - fill_history_value=fill_history_value, - ignore_expired=ignore_expired, - ignore_update=ignore_update, - ) - - # creat stream set filter of tag and tbname - tdLog.info("create stream with tag and tbname filter") - tag_t1_value = self.tdCom.tag_value_list[0] - where_tag = f"where t1 = {tag_t1_value}" - where_tbname = f'where tbname="{self.ctb_name}"' - # print(f"tag: {tag_t1_value}") - - self.stb_stream_des_where_tag_table = ( - f"{self.stb_name}_where_tag{self.tdCom.des_table_suffix}" - ) - self.tdCom.create_stream( - stream_name=f"{self.stb_name}_where_tag{self.tdCom.stream_suffix}", - des_table=self.stb_stream_des_where_tag_table, - source_sql=f'select _irowts as irowts,tbname as table_name, _isfilled as isfilled, {funciton_name} as {funciton_name_alias} from {self.stb_name} {where_tag} {partition_elm} every({self.tdCom.dataDict["interval"]}s)', - trigger_mode=trigger_mode, - fill_value=fill_value, - fill_history_value=fill_history_value, - ignore_expired=ignore_expired, - ignore_update=ignore_update, - ) - self.stb_stream_des_where_tbname_table = ( - f"{self.stb_name}_where_tbname{self.tdCom.des_table_suffix}" - ) - self.tdCom.create_stream( - stream_name=f"{self.stb_name}_where_tbname{self.tdCom.stream_suffix}", - des_table=self.stb_stream_des_where_tbname_table, - source_sql=f'select _irowts as irowts,tbname as table_name, _isfilled as isfilled, {funciton_name} as {funciton_name_alias} from {self.stb_name} {where_tbname} {partition_elm} every({self.tdCom.dataDict["interval"]}s)', + source_sql=f'select _wstart AS wstart, {fwc_stb_source_select_str} from {self.stb_name} {where_elm} {partition_elm} interval({self.tdCom.dataDict["interval"]}s)', trigger_mode=trigger_mode, - fill_value=fill_value, + fill_value=stb_fill_value, fill_history_value=fill_history_value, ignore_expired=ignore_expired, ignore_update=ignore_update, ) - # set partition by tag and column - self.stb_stream_des_partition_tag_table = ( - f"{self.stb_name}_partition_tag{self.tdCom.des_table_suffix}" - ) - self.stb_stream_des_partition_column1_table = ( - f"{self.stb_name}_partition_column1{self.tdCom.des_table_suffix}" - ) - self.stb_stream_des_partition_column2_table = ( - f"{self.stb_name}_partition_column2{self.tdCom.des_table_suffix}" - ) - if partition: - tdLog.info("create stream with partition by tag and tbname ") - partition_elm_new = f"partition by {partition}, t1" - self.tdCom.create_stream( - stream_name=f"{self.stb_name}_partition_tag{self.tdCom.stream_suffix}", - des_table=self.stb_stream_des_partition_tag_table, - source_sql=f'select _irowts as irowts, tbname as table_name, t1 as t_t1, _isfilled as isfilled, {funciton_name} as {funciton_name_alias} from {self.stb_name} {partition_elm_new} every({self.tdCom.dataDict["interval"]}s)', - trigger_mode=trigger_mode, - fill_value=fill_value, - fill_history_value=fill_history_value, - ignore_expired=ignore_expired, - ignore_update=ignore_update, - ) - partition_elm_new = f"partition by {partition}, c1" - self.tdCom.create_stream( - stream_name=f"{self.stb_name}_partition_column1{self.tdCom.stream_suffix}", - des_table=f"{self.stb_name}_partition_column1{self.tdCom.des_table_suffix}", - source_sql=f'select _irowts as irowts, tbname as table_name, c1 as c_c1, _isfilled as isfilled, {funciton_name} as {funciton_name_alias} from {self.stb_name} {partition_elm_new} every({self.tdCom.dataDict["interval"]}s)', - trigger_mode=trigger_mode, - fill_value=fill_value, - fill_history_value=fill_history_value, - ignore_expired=ignore_expired, - ignore_update=ignore_update, - ) - partition_elm_new = f"partition by {partition}, c2" - self.tdCom.create_stream( - stream_name=f"{self.stb_name}_partition_column2{self.tdCom.stream_suffix}", - des_table=f"{self.stb_name}_partition_column2{self.tdCom.des_table_suffix}", - source_sql=f'select _irowts as irowts, tbname as table_name, c2 as c_c2, _isfilled as isfilled, {funciton_name} as {funciton_name_alias} from {self.stb_name} {partition_elm_new} every({self.tdCom.dataDict["interval"]}s)', - trigger_mode=trigger_mode, - fill_value=fill_value, - fill_history_value=fill_history_value, - ignore_expired=ignore_expired, - ignore_update=ignore_update, - ) - - if fill_value: - if "value" in fill_value.lower(): - fill_value = "VALUE,1" - - # create stream general table - tdLog.info("create stream general table") self.tdCom.create_stream( stream_name=f"{self.tb_name}{self.tdCom.stream_suffix}", des_table=self.tb_stream_des_table, - source_sql=f'select _irowts as irowts,tbname as table_name, _isfilled as isfilled, {funciton_name} as {funciton_name_alias} from {self.tb_name} every({self.tdCom.dataDict["interval"]}s)', + source_sql=f'select _wstart AS wstart, {fwc_tb_source_select_str} from {self.tb_name} {where_elm} {partition_elm} interval({self.tdCom.dataDict["interval"]}s)', trigger_mode=trigger_mode, - fill_value=fill_value, + fill_value=tb_fill_value, fill_history_value=fill_history_value, ignore_expired=ignore_expired, ignore_update=ignore_update, ) # wait and check stream_task status is ready - time.sleep(self.tdCom.dataDict["interval"]) tdSql.query("show streams") tdLog.info(f"tdSql.queryResult:{tdSql.queryResult},tdSql.queryRows:{tdSql.queryRows}") localQueryResult = tdSql.queryResult @@ -282,379 +237,58 @@ def force_window_close( stream_name=stream_name, vgroups=2, stream_timeout=20,check_wal_info=False ) time.sleep(self.tdCom.dataDict["interval"]) - time.sleep(30) + time.sleep(20) # insert data - self.tdCom.date_time = self.tdCom.genTs(precision=self.tdCom.precision)[0] - start_time = self.tdCom.date_time - time.sleep(1) - start_force_ts = str(0) - for i in range(self.tdCom.range_count): - ts_value = ( - str(self.tdCom.date_time + self.tdCom.dataDict["interval"]) - + f"+{i*10}s" - ) - # print(ts_value) - if start_force_ts == "0": - start_force_ts = ts_value - ts_cast_delete_value = self.tdCom.time_cast(ts_value) - self.tdCom.sinsert_rows( - tbname=self.tdCom.ctb_name, - ts_value=ts_value, - custom_col_index=custom_col_index, - col_value_type=col_value_type, - ) - if i % 2 == 0: - self.tdCom.sinsert_rows( - tbname=self.tdCom.ctb_name, - ts_value=ts_value, - custom_col_index=custom_col_index, - col_value_type=col_value_type, - ) - if self.delete and i % 2 != 0: - self.tdCom.sdelete_rows( - tbname=self.tdCom.ctb_name, start_ts=ts_cast_delete_value - ) - self.tdCom.date_time += 1 - self.tdCom.sinsert_rows( - tbname=self.tdCom.tb_name, - ts_value=ts_value, - custom_col_index=custom_col_index, - col_value_type=col_value_type, - ) - if i % 2 == 0: - self.tdCom.sinsert_rows( - tbname=self.tdCom.tb_name, - ts_value=ts_value, - custom_col_index=custom_col_index, - col_value_type=col_value_type, - ) - if self.delete and i % 2 != 0: - self.tdCom.sdelete_rows( - tbname=self.tdCom.tb_name, start_ts=ts_cast_delete_value - ) - self.tdCom.date_time += 1 - if partition: - partition_elm = f"partition by {partition}" + tdLog.info("insert data") + start_new_ts, temp = self.insert_data(custom_col_index, col_value_type) + time.sleep(self.tdCom.dataDict["interval"] * 2) + tdLog.info("insert data") + temp, end_new_ts = self.insert_data(custom_col_index, col_value_type) + + #history and future + self.insert_disorder_data(custom_col_index, col_value_type) + + time.sleep(self.tdCom.dataDict["interval"] * 6 * 2) + + tdLog.info("check data") + # check the data + where_elm = f'{where_elm} and ts >= {start_new_ts} and ts <= {end_new_ts}' + for tbname in [self.stb_name, self.tb_name]: + if fill_value: + query_first_win_ts = self.get_stream_first_win_ts(tbname) + query_where_elm = f'where wstart >= "{query_first_win_ts}"' + stream_where_elm = f'where wstart <= {end_new_ts}' else: - partition_elm = "" - - if not fill_value: - for tbname in [self.stb_name, self.ctb_name, self.tb_name]: - if tbname != self.tb_name: - self.tdCom.check_query_data( - f"select wstart, {self.tdCom.stb_output_select_str} from {tbname}{self.tdCom.des_table_suffix} order by wstart", - f'select _wstart AS wstart, {self.tdCom.stb_source_select_str} from {tbname} {partition_elm} interval({self.tdCom.dataDict["interval"]}s) order by wstart', - sorted=True, - ) - else: - self.tdCom.check_query_data( - f"select wstart, {self.tdCom.tb_output_select_str} from {tbname}{self.tdCom.des_table_suffix} order by wstart", - f'select _wstart AS wstart, {self.tdCom.tb_source_select_str} from {tbname} {partition_elm} interval({self.tdCom.dataDict["interval"]}s) order by wstart', - sorted=True, - ) - - if self.tdCom.subtable: - for tname in [self.stb_name, self.ctb_name]: - group_id = self.tdCom.get_group_id_from_stb(f"{tname}_output") - tdSql.query(f"select * from {self.ctb_name}") - ptn_counter = 0 - for c1_value in tdSql.queryResult: - if partition == "c1": - tbname = self.tdCom.get_subtable_wait( - f"{tname}_{self.tdCom.subtable_prefix}{abs(c1_value[1])}{self.tdCom.subtable_suffix}" - ) - tdSql.query(f"select count(*) from `{tbname}`") - elif partition is None: - tbname = self.tdCom.get_subtable_wait( - f"{tname}_{self.tdCom.subtable_prefix}no_partition{self.tdCom.subtable_suffix}" - ) - tdSql.query(f"select count(*) from `{tbname}`") - elif partition == "abs(c1)": - abs_c1_value = abs(c1_value[1]) - tbname = self.tdCom.get_subtable_wait( - f"{tname}_{self.tdCom.subtable_prefix}{abs_c1_value}{self.tdCom.subtable_suffix}" - ) - tdSql.query(f"select count(*) from `{tbname}`") - elif partition == "tbname" and ptn_counter == 0: - tbname = self.tdCom.get_subtable_wait( - f"{tname}_{self.tdCom.subtable_prefix}{self.ctb_name}{self.tdCom.subtable_suffix}_{tname}_output_{group_id}" - ) - tdSql.query(f"select count(*) from `{tbname}`") - ptn_counter += 1 - tdSql.checkEqual(tdSql.queryResult[0][0] > 0, True) - group_id = self.tdCom.get_group_id_from_stb(f"{self.tb_name}_output") - tdSql.query(f"select * from {self.tb_name}") - ptn_counter = 0 - for c1_value in tdSql.queryResult: - if partition == "c1": - tbname = self.tdCom.get_subtable_wait( - f"{self.tb_name}_{self.tdCom.subtable_prefix}{abs(c1_value[1])}{self.tdCom.subtable_suffix}" - ) - tdSql.query(f"select count(*) from `{tbname}`") - elif partition is None: - tbname = self.tdCom.get_subtable_wait( - f"{self.tb_name}_{self.tdCom.subtable_prefix}no_partition{self.tdCom.subtable_suffix}" - ) - tdSql.query(f"select count(*) from `{tbname}`") - elif partition == "abs(c1)": - abs_c1_value = abs(c1_value[1]) - tbname = self.tdCom.get_subtable_wait( - f"{self.tb_name}_{self.tdCom.subtable_prefix}{abs_c1_value}{self.tdCom.subtable_suffix}" - ) - tdSql.query(f"select count(*) from `{tbname}`") - elif partition == "tbname" and ptn_counter == 0: - tbname = self.tdCom.get_subtable_wait( - f"{self.tb_name}_{self.tdCom.subtable_prefix}{self.tb_name}{self.tdCom.subtable_suffix}_{self.tb_name}_output_{group_id}" - ) - tdSql.query(f"select count(*) from `{tbname}`") - ptn_counter += 1 - - tdSql.checkEqual(tdSql.queryResult[0][0] > 0, True) - if fill_value: - end_date_time = self.tdCom.date_time - final_range_count = self.tdCom.range_count - history_ts = ( - str(start_time) - + f'-{self.tdCom.dataDict["interval"]*(final_range_count+2)}s' - ) - start_ts = self.tdCom.time_cast(history_ts, "-") - future_ts = ( - str(end_date_time) - + f'+{self.tdCom.dataDict["interval"]*(final_range_count+2)}s' - ) - end_ts = self.tdCom.time_cast(future_ts) - self.tdCom.sinsert_rows(tbname=self.ctb_name, ts_value=history_ts) - self.tdCom.sinsert_rows(tbname=self.tb_name, ts_value=history_ts) - self.tdCom.sinsert_rows(tbname=self.ctb_name, ts_value=future_ts) - self.tdCom.sinsert_rows(tbname=self.tb_name, ts_value=future_ts) - self.tdCom.date_time = start_time - # update - history_ts = ( - str(start_time) - + f'-{self.tdCom.dataDict["interval"]*(final_range_count+2)}s' - ) - start_ts = self.tdCom.time_cast(history_ts, "-") - future_ts = ( - str(end_date_time) - + f'+{self.tdCom.dataDict["interval"]*(final_range_count+2)}s' - ) - end_ts = self.tdCom.time_cast(future_ts) - self.tdCom.sinsert_rows(tbname=self.ctb_name, ts_value=history_ts) - self.tdCom.sinsert_rows(tbname=self.tb_name, ts_value=history_ts) - self.tdCom.sinsert_rows(tbname=self.ctb_name, ts_value=future_ts) - self.tdCom.sinsert_rows(tbname=self.tb_name, ts_value=future_ts) - - # get query time range using interval count windows - tdSql.query( - f'select _wstart, _wend ,last(ts) from {self.stb_name} where ts >= {start_force_ts} and ts <= {end_ts} partition by tbname interval({self.tdCom.dataDict["interval"]}s)fill ({fill_value}) ' - ) - # getData don't support negative index - end_new_ts = tdSql.getData(tdSql.queryRows - 1, 1) - end_last_but_one_ts = tdSql.getData(tdSql.queryRows - 2, 1) - # source data include that fill valuse is null and "_isfilled" column of the stream output is false - tdSql.execute( - f'insert into {self.ctb_name} (ts,c1) values("{end_new_ts}",-102) ' - ) - tdSql.execute( - f'insert into {self.tb_name} (ts,c1) values("{end_new_ts}",-51) ' - ) - tdSql.execute( - f'insert into {self.ctb_name} (ts,c1) values("{end_last_but_one_ts}",NULL) ' - ) - - for i in range(self.tdCom.range_count): - ts_value = ( - str(self.tdCom.date_time + self.tdCom.dataDict["interval"]) - + f"+{i*10}s" - ) - ts_cast_delete_value = self.tdCom.time_cast(ts_value) - self.tdCom.sinsert_rows(tbname=self.ctb_name, ts_value=ts_value) - self.tdCom.date_time += 1 - self.tdCom.sinsert_rows(tbname=self.tb_name, ts_value=ts_value) - self.tdCom.date_time += 1 - if self.delete: - self.tdCom.sdelete_rows( - tbname=self.ctb_name, - start_ts=self.tdCom.time_cast(start_time), - end_ts=ts_cast_delete_value, - ) - self.tdCom.sdelete_rows( - tbname=self.tb_name, - start_ts=self.tdCom.time_cast(start_time), - end_ts=ts_cast_delete_value, - ) - - # wait for the stream to process the data - # print(self.tdCom.dataDict["interval"]*(final_range_count+2)) - time.sleep(self.tdCom.dataDict["interval"] * (final_range_count + 2)) - - # check the data - for tbname in [self.stb_name, self.ctb_name, self.tb_name]: - tdLog.info(f"tbname:{tbname}") - tdSql.query( - f'select _wstart, _wend ,last(ts) from {tbname} where ts >= {start_force_ts} and ts <= {end_ts} partition by tbname interval({self.tdCom.dataDict["interval"]}s)fill ({fill_value}) ' - ) - start_new_ts = tdSql.getData(0, 1) - if tbname == self.ctb_name: - if partition == "tbname": - # check data for child table - tdLog.info("check data for child table ") - self.tdCom.check_query_data( - f'select irowts, table_name, isfilled, {funciton_name_alias} from {tbname}{self.tdCom.des_table_suffix} where irowts >= {start_force_ts} and irowts <= "{end_new_ts}" order by irowts', - f'select _irowts as irowts ,tbname as table_name, _isfilled as isfilled , {funciton_name} as {funciton_name_alias} from {tbname} partition by {partition} range("{start_new_ts}","{end_new_ts}") every({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by irowts', - fill_value=fill_value, - ) - elif tbname == self.stb_name: - if partition == "tbname": - # check data for super table - tdLog.info("check data for super table") - self.tdCom.check_query_data( - f'select irowts, table_name, isfilled, {funciton_name_alias} from {tbname}{self.tdCom.des_table_suffix} where irowts >= {start_force_ts} and irowts <= "{end_new_ts}" order by irowts', - f'select _irowts as irowts ,tbname as table_name, _isfilled as isfilled , {funciton_name} as {funciton_name_alias} from {tbname} partition by {partition} range("{start_new_ts}","{end_new_ts}") every({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by irowts', - fill_value=fill_value, - ) - # tag and tbname filter - tdLog.info("check data for tag and tbname filter") - self.tdCom.check_query_data( - f'select irowts, table_name, isfilled, {funciton_name_alias} from {self.stb_stream_des_where_tag_table} where irowts >= {start_force_ts} and irowts <= "{end_new_ts}" order by irowts', - f'select _irowts as irowts ,tbname as table_name, _isfilled as isfilled , {funciton_name} as {funciton_name_alias} from {tbname} {where_tag} and ts >= {start_force_ts} partition by {partition} range("{start_new_ts}","{end_new_ts}") every({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by irowts', - fill_value=fill_value, - ) - self.tdCom.check_query_data( - f'select irowts, table_name, isfilled, {funciton_name_alias} from {self.stb_stream_des_where_tbname_table} where irowts >= {start_force_ts} and irowts <= "{end_new_ts}" order by irowts', - f'select _irowts as irowts ,tbname as table_name, _isfilled as isfilled , {funciton_name} as {funciton_name_alias} from {tbname} {where_tbname} partition by {partition} range("{start_new_ts}","{end_new_ts}") every({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by irowts', - fill_value=fill_value, - ) - # check partition by tag and column(c1 or c2) - tdLog.info("check data for partition by tag and column") - self.tdCom.check_query_data( - f'select irowts, table_name, t_t1, isfilled, {funciton_name_alias} from {self.stb_stream_des_partition_tag_table} where irowts >= {start_force_ts} and irowts <= "{end_new_ts}" order by t_t1, irowts', - f'select _irowts as irowts ,tbname as table_name, t1 as t_t1, _isfilled as isfilled , {funciton_name} as {funciton_name_alias} from {tbname} {where_tbname} partition by {partition},t1 range("{start_new_ts}","{end_new_ts}") every({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by t_t1, irowts', - fill_value=fill_value, - ) - if fill_value == "PREV": - self.tdCom.check_query_data( - f'select irowts, c_c1, isfilled, {funciton_name_alias} from {self.stb_stream_des_partition_column1_table} where irowts >= {start_force_ts} and irowts <= "{end_new_ts}" order by c_c1, irowts', - f'select _irowts as irowts , c1 as c_c1, _isfilled as isfilled , {funciton_name} as {funciton_name_alias} from {tbname} {where_tbname} and ts >= {start_force_ts} partition by {partition},c1 range("{start_new_ts}","{end_new_ts}") every({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by c_c1, irowts', - fill_value=fill_value, - ) - self.tdCom.check_query_data( - f'select irowts, c_c2, isfilled, {funciton_name_alias} from {self.stb_stream_des_partition_column2_table} where irowts >= {start_force_ts} and irowts <= "{end_new_ts}" order by c_c2, irowts', - f'select _irowts as irowts , c2 as c_c2, _isfilled as isfilled , {funciton_name} as {funciton_name_alias} from {tbname} {where_tbname} and ts >= {start_force_ts} partition by {partition},c2 range("{start_new_ts}","{end_new_ts}") every({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by c_c2, irowts', - fill_value=fill_value, - ) - else: - if partition == "tbname": - # check data for general table - self.tdCom.check_query_data( - f'select irowts, isfilled, {funciton_name_alias} from {tbname}{self.tdCom.des_table_suffix} where irowts >= {start_force_ts} and irowts <= "{end_new_ts}" order by irowts', - f'select _irowts as irowts , _isfilled as isfilled , {funciton_name} as {funciton_name_alias} from {tbname} partition by {partition} range("{start_new_ts}","{end_new_ts}") every({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by irowts', - fill_value=fill_value, - ) - - # Recreate a sub-table that meets the filtering "where_tag" and check if the streaming results are automatically included within it." - where_tag_ctbname = f"{self.ctb_name}_where_tag" - where_tag_ctbname_other_tag = f"{self.ctb_name}_where_tag_1" - tag_t1_value_other = abs(tag_t1_value)-1 - tdSql.execute( - f"create table {where_tag_ctbname} using {self.stb_name} (t1) tags({tag_t1_value}) " - ) - tdSql.execute( - f"create table {where_tag_ctbname_other_tag} using {self.stb_name} (t1) tags({tag_t1_value_other}) " - ) - where_tag_timestamp = self.tdCom.genTs(precision=self.tdCom.precision)[0] - where_tag_ts_start_value = str(where_tag_timestamp) + "+2s" - self.tdCom.sinsert_rows( - tbname=where_tag_ctbname, ts_value=where_tag_ts_start_value - ) - self.tdCom.sinsert_rows( - tbname=where_tag_ctbname_other_tag, ts_value=where_tag_ts_start_value - ) - time.sleep(self.tdCom.dataDict["interval"]) - for _ in range(self.tdCom.dataDict["interval"]): - tdSql.query( - f"select distinct(table_name) from {self.stb_stream_des_where_tag_table} where table_name=\"{where_tag_ctbname}\"" + query_where_elm = "" + stream_where_elm = "" + + # check data + tdLog.info(f"check data for table {tbname}") + if tbname == self.stb_name: + self.tdCom.check_query_data( + f'select wstart, {fwc_stb_output_select_str} from {tbname}{self.tdCom.des_table_suffix} {stream_where_elm} order by wstart', + f'select * from (select _wstart AS wstart, {fwc_stb_source_select_str} from {tbname} {where_elm} {query_partition_elm} interval({self.tdCom.dataDict["interval"]}s) {query_stb_fill_elm} order by wstart) {query_where_elm}', + sorted=True ) - if tdSql.queryRows > 0: - if tdSql.checkDataNotExit(0,0, where_tag_ctbname): - break - else: - time.sleep(1) - - if self.delete: - self.tdCom.sdelete_rows( - tbname=self.ctb_name, start_ts=start_ts, end_ts=ts_cast_delete_value - ) - self.tdCom.sdelete_rows( - tbname=self.tb_name, start_ts=start_ts, end_ts=ts_cast_delete_value + else: + self.tdCom.check_query_data( + f'select wstart, {fwc_tb_output_select_str} from {tbname}{self.tdCom.des_table_suffix} {stream_where_elm} order by wstart', + f'select * from (select _wstart AS wstart, {fwc_tb_source_select_str} from {tbname} {where_elm} {query_partition_elm} interval({self.tdCom.dataDict["interval"]}s) {query_tb_fill_elm} order by wstart) {query_where_elm}', + sorted=True ) - for tbname in [self.stb_name, self.ctb_name, self.tb_name]: - if tbname != self.tb_name: - if "value" in fill_value.lower(): - fill_value = ( - "VALUE,1,2,3,6,7,8,9,10,11,1,2,3,4,5,6,7,8,9,10,11" - ) - if partition == "tbname": - self.tdCom.check_query_data( - f"select wstart, {self.tdCom.fill_stb_output_select_str} from {tbname}{self.tdCom.des_table_suffix} order by wstart", - f'select _wstart AS wstart, {self.tdCom.fill_stb_source_select_str} from {tbname} where ts >= {start_ts.replace("-", "+")} and ts <= {end_ts} partition by {partition} interval({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by wstart', - fill_value=fill_value, - ) - else: - self.tdCom.check_query_data( - f"select wstart, {self.tdCom.fill_stb_output_select_str} from {tbname}{self.tdCom.des_table_suffix} order by wstart,`min(c1)`", - f'select * from (select _wstart AS wstart, {self.tdCom.fill_stb_source_select_str} from {tbname} where ts >= {start_ts} and ts <= {end_ts} partition by {partition} interval({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by wstart) where `min(c1)` is not Null order by wstart,`min(c1)`', - fill_value=fill_value, - ) - - else: - if "value" in fill_value.lower(): - fill_value = "VALUE,1,2,3,6,7,8,9,10,11" - if partition == "tbname": - self.tdCom.check_query_data( - f"select wstart, {self.tdCom.fill_tb_output_select_str} from {tbname}{self.tdCom.des_table_suffix} order by wstart", - f'select _wstart AS wstart, {self.tdCom.fill_tb_source_select_str} from {tbname} where ts >= {start_ts.replace("-", "+")} and ts <= {end_ts} partition by {partition} interval({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by wstart', - fill_value=fill_value, - ) - else: - self.tdCom.check_query_data( - f"select wstart, {self.tdCom.fill_tb_output_select_str} from {tbname}{self.tdCom.des_table_suffix} order by wstart,`min(c1)`", - f'select * from (select _wstart AS wstart, {self.tdCom.fill_tb_source_select_str} from {tbname} where ts >= {start_ts} and ts <= {end_ts} partition by {partition} interval({self.tdCom.dataDict["interval"]}s) fill ({fill_value}) order by wstart) where `min(c1)` is not Null order by wstart,`min(c1)`', - fill_value=fill_value, - ) def run(self): - for fill_value in ["PREV", "VALUE","NULL"]: + for fill_value in ["VALUE", "NULL", "PREV", None]: self.force_window_close( - interval=10, + interval=5, partition="tbname", - funciton_name="interp(c1)", - funciton_name_alias="intp_c1", - delete=False, - ignore_update=1, + delete=True, fill_value=fill_value, ) - self.force_window_close( - interval=8, - partition="tbname", - funciton_name="interp(c1)", - funciton_name_alias="intp_c1", - delete=False, - ignore_update=1, - fill_value="PREV", - ) - # self.force_window_close(interval=random.randint(10, 15), partition="c1", ignore_update=1) - # self.force_window_close(interval=random.randint(10, 15), partition="abs(c1)", ignore_update=1) - # self.force_window_close(interval=random.randint(10, 15), partition=None, delete=True) - # self.force_window_close(interval=random.randint(10, 15), partition=self.tdCom.stream_case_when_tbname, case_when=f'case when {self.tdCom.stream_case_when_tbname} = tbname then {self.tdCom.partition_tbname_alias} else tbname end') - # self.force_window_close(interval=random.randint(10, 15), partition="tbname", fill_history_value=1, fill_value="NULL") - # for fill_value in ["NULL", "PREV", "NEXT", "LINEAR", "VALUE,1,2,3,4,5,6,7,8,9,10,11,1,2,3,4,5,6,7,8,9,10,11"]: - # # for fill_value in ["PREV", "NEXT", "LINEAR", "VALUE,1,2,3,4,5,6,7,8,9,10,11,1,2,3,4,5,6,7,8,9,10,11"]: - # self.at_once_interval(interval=random.randint(10, 15), partition="tbname", fill_value=fill_value) - # self.at_once_interval(interval=random.randint(10, 15), partition="tbname", fill_value=fill_value, delete=True) def stop(self): + tdLog.info("stop========================================") tdSql.close() tdLog.success(f"{__file__} successfully executed") From 8984231b9fcb8bd5d4f7fe2fb2a92612f19896a8 Mon Sep 17 00:00:00 2001 From: xiao-77 Date: Mon, 4 Nov 2024 18:48:55 +0800 Subject: [PATCH 652/695] fix vnode cannot restart while wal level =0 --- source/libs/wal/src/walMeta.c | 3 ++ source/libs/wal/src/walWrite.c | 7 +++- source/libs/wal/test/walMetaTest.cpp | 56 ++++++++++++++++++++++++++++ 3 files changed, 64 insertions(+), 2 deletions(-) diff --git a/source/libs/wal/src/walMeta.c b/source/libs/wal/src/walMeta.c index d9666eb02f58..be7f5fb0f5bf 100644 --- a/source/libs/wal/src/walMeta.c +++ b/source/libs/wal/src/walMeta.c @@ -424,6 +424,9 @@ void printFileSet(SArray* fileSet) { int32_t walCheckAndRepairMeta(SWal* pWal) { // load log files, get first/snapshot/last version info + if (pWal->cfg.level == TAOS_WAL_SKIP) { + return TSDB_CODE_SUCCESS; + } int32_t code = 0; const char* logPattern = "^[0-9]+.log$"; const char* idxPattern = "^[0-9]+.idx$"; diff --git a/source/libs/wal/src/walWrite.c b/source/libs/wal/src/walWrite.c index c8c37b11bc56..187988b726fd 100644 --- a/source/libs/wal/src/walWrite.c +++ b/source/libs/wal/src/walWrite.c @@ -294,8 +294,11 @@ int32_t walRollback(SWal *pWal, int64_t ver) { static int32_t walRollImpl(SWal *pWal) { int32_t code = 0, lino = 0; + if (pWal->cfg.level == TAOS_WAL_SKIP && pWal->pIdxFile != NULL && pWal->pLogFile != NULL) { + TAOS_RETURN(TSDB_CODE_SUCCESS); + } if (pWal->pIdxFile != NULL) { - if (pWal->cfg.level != TAOS_WAL_SKIP && (code = taosFsyncFile(pWal->pIdxFile)) != 0) { + if ((code = taosFsyncFile(pWal->pIdxFile)) != 0) { TAOS_CHECK_GOTO(terrno, &lino, _exit); } code = taosCloseFile(&pWal->pIdxFile); @@ -305,7 +308,7 @@ static int32_t walRollImpl(SWal *pWal) { } if (pWal->pLogFile != NULL) { - if (pWal->cfg.level != TAOS_WAL_SKIP && (code = taosFsyncFile(pWal->pLogFile)) != 0) { + if ((code = taosFsyncFile(pWal->pLogFile)) != 0) { TAOS_CHECK_GOTO(terrno, &lino, _exit); } code = taosCloseFile(&pWal->pLogFile); diff --git a/source/libs/wal/test/walMetaTest.cpp b/source/libs/wal/test/walMetaTest.cpp index a0285f13632a..3e6fab116f1b 100644 --- a/source/libs/wal/test/walMetaTest.cpp +++ b/source/libs/wal/test/walMetaTest.cpp @@ -455,3 +455,59 @@ TEST_F(WalRetentionEnv, repairMeta1) { } walCloseReader(pRead); } + +class WalSkipLevel : public ::testing::Test { + protected: + static void SetUpTestCase() { + int code = walInit(NULL); + ASSERT(code == 0); + } + + static void TearDownTestCase() { walCleanUp(); } + + void walResetEnv() { + TearDown(); + taosRemoveDir(pathName); + SetUp(); + } + + void SetUp() override { + SWalCfg cfg; + cfg.rollPeriod = -1; + cfg.segSize = -1; + cfg.committed =-1; + cfg.retentionPeriod = -1; + cfg.retentionSize = 0; + cfg.rollPeriod = 0; + cfg.vgId = 1; + cfg.level = TAOS_WAL_SKIP; + pWal = walOpen(pathName, &cfg); + ASSERT(pWal != NULL); + } + + void TearDown() override { + walClose(pWal); + pWal = NULL; + } + + SWal* pWal = NULL; + const char* pathName = TD_TMP_DIR_PATH "wal_test"; +}; + +TEST_F(WalSkipLevel, restart) { + walResetEnv(); + int code; + + int i; + for (i = 0; i < 100; i++) { + char newStr[100]; + sprintf(newStr, "%s-%d", ranStr, i); + int len = strlen(newStr); + code = walAppendLog(pWal, i, 0, syncMeta, newStr, len); + ASSERT_EQ(code, 0); + } + + TearDown(); + + SetUp(); +} \ No newline at end of file From 4d925fa10656c3ea01381b0eee005cfc04f17ef2 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Wed, 6 Nov 2024 11:33:53 +0800 Subject: [PATCH 653/695] adj assert check --- tests/ci/count_assert.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/ci/count_assert.py b/tests/ci/count_assert.py index aecc57578d07..65a3192aba46 100644 --- a/tests/ci/count_assert.py +++ b/tests/ci/count_assert.py @@ -40,6 +40,7 @@ # List of files to exclude exclude_source_files = [ f"{TD_project_path}/community/source/libs/parser/src/sql.c", + f"{TD_project_path}/community/source/libs/parser/inc/sql.c", f"{TD_project_path}/community/source/util/src/tlog.c", f"{TD_project_path}/community/include/util/tlog.h" ] From 527c3d59a9192c673a99d0ffc809d6e0be82e5c5 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Wed, 6 Nov 2024 11:44:02 +0800 Subject: [PATCH 654/695] fix issue --- source/libs/executor/src/streamfilloperator.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/libs/executor/src/streamfilloperator.c b/source/libs/executor/src/streamfilloperator.c index cd7ab547d468..ccf1f7c9e501 100644 --- a/source/libs/executor/src/streamfilloperator.c +++ b/source/libs/executor/src/streamfilloperator.c @@ -1270,7 +1270,9 @@ static int32_t doStreamForceFillImpl(SOperatorInfo* pOperator) { TSKEY resTs = tsCol[i]; while (resTs < (*pTs)) { SWinKey key = {.groupId = groupId, .ts = resTs}; - taosArrayPush(pInfo->pUpdated, &key); + void* pPushRes = taosArrayPush(pInfo->pUpdated, &key); + QUERY_CHECK_NULL(pPushRes, code, lino, _end, terrno); + if (IS_FILL_CONST_VALUE(pFillSup->type)) { break; } From b566e26084efe982570d4541131ce06e767ae058 Mon Sep 17 00:00:00 2001 From: xsren <285808407@qq.com> Date: Wed, 6 Nov 2024 13:47:01 +0800 Subject: [PATCH 655/695] enh: ttokendef.h --- .gitignore | 2 + cmake/lemon_CMakeLists.txt.in | 1 + include/common/ttokendef.h | 389 +----------------------------- source/common/CMakeLists.txt | 2 + source/libs/parser/CMakeLists.txt | 6 +- 5 files changed, 10 insertions(+), 390 deletions(-) diff --git a/.gitignore b/.gitignore index b849df0d0637..d684262f9dda 100644 --- a/.gitignore +++ b/.gitignore @@ -159,4 +159,6 @@ pcre2.h zconf.h version.h geos_c.h +source/libs/parser/src/sql.c +include/common/ttokenauto.h diff --git a/cmake/lemon_CMakeLists.txt.in b/cmake/lemon_CMakeLists.txt.in index 58da7206307b..26226d3eda82 100644 --- a/cmake/lemon_CMakeLists.txt.in +++ b/cmake/lemon_CMakeLists.txt.in @@ -2,6 +2,7 @@ ExternalProject_Add( lemon + SOURCE_DIR ${TD_CONTRIB_DIR}/lemon CONFIGURE_COMMAND "" BUILD_COMMAND "${C_COMPILER_LEMON}" -o ${TD_CONTRIB_DIR}/lemon/lemon ${TD_CONTRIB_DIR}/lemon/lemon.c INSTALL_COMMAND "" diff --git a/include/common/ttokendef.h b/include/common/ttokendef.h index b86830869ccc..e5e40f225ed0 100644 --- a/include/common/ttokendef.h +++ b/include/common/ttokendef.h @@ -16,394 +16,7 @@ #ifndef _TD_COMMON_TOKEN_H_ #define _TD_COMMON_TOKEN_H_ -#define TK_OR 1 -#define TK_AND 2 -#define TK_UNION 3 -#define TK_ALL 4 -#define TK_MINUS 5 -#define TK_EXCEPT 6 -#define TK_INTERSECT 7 -#define TK_NK_BITAND 8 -#define TK_NK_BITOR 9 -#define TK_NK_LSHIFT 10 -#define TK_NK_RSHIFT 11 -#define TK_NK_PLUS 12 -#define TK_NK_MINUS 13 -#define TK_NK_STAR 14 -#define TK_NK_SLASH 15 -#define TK_NK_REM 16 -#define TK_NK_CONCAT 17 -#define TK_CREATE 18 -#define TK_ACCOUNT 19 -#define TK_NK_ID 20 -#define TK_PASS 21 -#define TK_NK_STRING 22 -#define TK_ALTER 23 -#define TK_PPS 24 -#define TK_TSERIES 25 -#define TK_STORAGE 26 -#define TK_STREAMS 27 -#define TK_QTIME 28 -#define TK_DBS 29 -#define TK_USERS 30 -#define TK_CONNS 31 -#define TK_STATE 32 -#define TK_NK_COMMA 33 -#define TK_HOST 34 -#define TK_IS_IMPORT 35 -#define TK_NK_INTEGER 36 -#define TK_CREATEDB 37 -#define TK_USER 38 -#define TK_ENABLE 39 -#define TK_SYSINFO 40 -#define TK_ADD 41 -#define TK_DROP 42 -#define TK_GRANT 43 -#define TK_ON 44 -#define TK_TO 45 -#define TK_REVOKE 46 -#define TK_FROM 47 -#define TK_SUBSCRIBE 48 -#define TK_READ 49 -#define TK_WRITE 50 -#define TK_NK_DOT 51 -#define TK_WITH 52 -#define TK_ENCRYPT_KEY 53 -#define TK_ANODE 54 -#define TK_UPDATE 55 -#define TK_ANODES 56 -#define TK_DNODE 57 -#define TK_PORT 58 -#define TK_DNODES 59 -#define TK_RESTORE 60 -#define TK_NK_IPTOKEN 61 -#define TK_FORCE 62 -#define TK_UNSAFE 63 -#define TK_CLUSTER 64 -#define TK_LOCAL 65 -#define TK_QNODE 66 -#define TK_BNODE 67 -#define TK_SNODE 68 -#define TK_MNODE 69 -#define TK_VNODE 70 -#define TK_DATABASE 71 -#define TK_USE 72 -#define TK_FLUSH 73 -#define TK_TRIM 74 -#define TK_S3MIGRATE 75 -#define TK_COMPACT 76 -#define TK_IF 77 -#define TK_NOT 78 -#define TK_EXISTS 79 -#define TK_BUFFER 80 -#define TK_CACHEMODEL 81 -#define TK_CACHESIZE 82 -#define TK_COMP 83 -#define TK_DURATION 84 -#define TK_NK_VARIABLE 85 -#define TK_MAXROWS 86 -#define TK_MINROWS 87 -#define TK_KEEP 88 -#define TK_PAGES 89 -#define TK_PAGESIZE 90 -#define TK_TSDB_PAGESIZE 91 -#define TK_PRECISION 92 -#define TK_REPLICA 93 -#define TK_VGROUPS 94 -#define TK_SINGLE_STABLE 95 -#define TK_RETENTIONS 96 -#define TK_SCHEMALESS 97 -#define TK_WAL_LEVEL 98 -#define TK_WAL_FSYNC_PERIOD 99 -#define TK_WAL_RETENTION_PERIOD 100 -#define TK_WAL_RETENTION_SIZE 101 -#define TK_WAL_ROLL_PERIOD 102 -#define TK_WAL_SEGMENT_SIZE 103 -#define TK_STT_TRIGGER 104 -#define TK_TABLE_PREFIX 105 -#define TK_TABLE_SUFFIX 106 -#define TK_S3_CHUNKSIZE 107 -#define TK_S3_KEEPLOCAL 108 -#define TK_S3_COMPACT 109 -#define TK_KEEP_TIME_OFFSET 110 -#define TK_ENCRYPT_ALGORITHM 111 -#define TK_NK_COLON 112 -#define TK_BWLIMIT 113 -#define TK_START 114 -#define TK_TIMESTAMP 115 -#define TK_END 116 -#define TK_TABLE 117 -#define TK_NK_LP 118 -#define TK_NK_RP 119 -#define TK_USING 120 -#define TK_FILE 121 -#define TK_STABLE 122 -#define TK_COLUMN 123 -#define TK_MODIFY 124 -#define TK_RENAME 125 -#define TK_TAG 126 -#define TK_SET 127 -#define TK_NK_EQ 128 -#define TK_TAGS 129 -#define TK_BOOL 130 -#define TK_TINYINT 131 -#define TK_SMALLINT 132 -#define TK_INT 133 -#define TK_INTEGER 134 -#define TK_BIGINT 135 -#define TK_FLOAT 136 -#define TK_DOUBLE 137 -#define TK_BINARY 138 -#define TK_NCHAR 139 -#define TK_UNSIGNED 140 -#define TK_JSON 141 -#define TK_VARCHAR 142 -#define TK_MEDIUMBLOB 143 -#define TK_BLOB 144 -#define TK_VARBINARY 145 -#define TK_GEOMETRY 146 -#define TK_DECIMAL 147 -#define TK_COMMENT 148 -#define TK_MAX_DELAY 149 -#define TK_WATERMARK 150 -#define TK_ROLLUP 151 -#define TK_TTL 152 -#define TK_SMA 153 -#define TK_DELETE_MARK 154 -#define TK_FIRST 155 -#define TK_LAST 156 -#define TK_SHOW 157 -#define TK_FULL 158 -#define TK_PRIVILEGES 159 -#define TK_DATABASES 160 -#define TK_TABLES 161 -#define TK_STABLES 162 -#define TK_MNODES 163 -#define TK_QNODES 164 -#define TK_ARBGROUPS 165 -#define TK_FUNCTIONS 166 -#define TK_INDEXES 167 -#define TK_ACCOUNTS 168 -#define TK_APPS 169 -#define TK_CONNECTIONS 170 -#define TK_LICENCES 171 -#define TK_GRANTS 172 -#define TK_LOGS 173 -#define TK_MACHINES 174 -#define TK_ENCRYPTIONS 175 -#define TK_QUERIES 176 -#define TK_SCORES 177 -#define TK_TOPICS 178 -#define TK_VARIABLES 179 -#define TK_BNODES 180 -#define TK_SNODES 181 -#define TK_TRANSACTIONS 182 -#define TK_DISTRIBUTED 183 -#define TK_CONSUMERS 184 -#define TK_SUBSCRIPTIONS 185 -#define TK_VNODES 186 -#define TK_ALIVE 187 -#define TK_VIEWS 188 -#define TK_VIEW 189 -#define TK_COMPACTS 190 -#define TK_NORMAL 191 -#define TK_CHILD 192 -#define TK_LIKE 193 -#define TK_TBNAME 194 -#define TK_QTAGS 195 -#define TK_AS 196 -#define TK_SYSTEM 197 -#define TK_TSMA 198 -#define TK_INTERVAL 199 -#define TK_RECURSIVE 200 -#define TK_TSMAS 201 -#define TK_FUNCTION 202 -#define TK_INDEX 203 -#define TK_COUNT 204 -#define TK_LAST_ROW 205 -#define TK_META 206 -#define TK_ONLY 207 -#define TK_TOPIC 208 -#define TK_CONSUMER 209 -#define TK_GROUP 210 -#define TK_DESC 211 -#define TK_DESCRIBE 212 -#define TK_RESET 213 -#define TK_QUERY 214 -#define TK_CACHE 215 -#define TK_EXPLAIN 216 -#define TK_ANALYZE 217 -#define TK_VERBOSE 218 -#define TK_NK_BOOL 219 -#define TK_RATIO 220 -#define TK_NK_FLOAT 221 -#define TK_OUTPUTTYPE 222 -#define TK_AGGREGATE 223 -#define TK_BUFSIZE 224 -#define TK_LANGUAGE 225 -#define TK_REPLACE 226 -#define TK_STREAM 227 -#define TK_INTO 228 -#define TK_PAUSE 229 -#define TK_RESUME 230 -#define TK_PRIMARY 231 -#define TK_KEY 232 -#define TK_TRIGGER 233 -#define TK_AT_ONCE 234 -#define TK_WINDOW_CLOSE 235 -#define TK_IGNORE 236 -#define TK_EXPIRED 237 -#define TK_FILL_HISTORY 238 -#define TK_SUBTABLE 239 -#define TK_UNTREATED 240 -#define TK_KILL 241 -#define TK_CONNECTION 242 -#define TK_TRANSACTION 243 -#define TK_BALANCE 244 -#define TK_VGROUP 245 -#define TK_LEADER 246 -#define TK_MERGE 247 -#define TK_REDISTRIBUTE 248 -#define TK_SPLIT 249 -#define TK_DELETE 250 -#define TK_INSERT 251 -#define TK_NK_BIN 252 -#define TK_NK_HEX 253 -#define TK_NULL 254 -#define TK_NK_QUESTION 255 -#define TK_NK_ALIAS 256 -#define TK_NK_ARROW 257 -#define TK_ROWTS 258 -#define TK_QSTART 259 -#define TK_QEND 260 -#define TK_QDURATION 261 -#define TK_WSTART 262 -#define TK_WEND 263 -#define TK_WDURATION 264 -#define TK_IROWTS 265 -#define TK_ISFILLED 266 -#define TK_FLOW 267 -#define TK_FHIGH 268 -#define TK_FROWTS 269 -#define TK_CAST 270 -#define TK_POSITION 271 -#define TK_IN 272 -#define TK_FOR 273 -#define TK_NOW 274 -#define TK_TODAY 275 -#define TK_RAND 276 -#define TK_SUBSTR 277 -#define TK_SUBSTRING 278 -#define TK_BOTH 279 -#define TK_TRAILING 280 -#define TK_LEADING 281 -#define TK_TIMEZONE 282 -#define TK_CLIENT_VERSION 283 -#define TK_SERVER_VERSION 284 -#define TK_SERVER_STATUS 285 -#define TK_CURRENT_USER 286 -#define TK_PI 287 -#define TK_CASE 288 -#define TK_WHEN 289 -#define TK_THEN 290 -#define TK_ELSE 291 -#define TK_BETWEEN 292 -#define TK_IS 293 -#define TK_NK_LT 294 -#define TK_NK_GT 295 -#define TK_NK_LE 296 -#define TK_NK_GE 297 -#define TK_NK_NE 298 -#define TK_MATCH 299 -#define TK_NMATCH 300 -#define TK_CONTAINS 301 -#define TK_JOIN 302 -#define TK_INNER 303 -#define TK_LEFT 304 -#define TK_RIGHT 305 -#define TK_OUTER 306 -#define TK_SEMI 307 -#define TK_ANTI 308 -#define TK_ASOF 309 -#define TK_WINDOW 310 -#define TK_WINDOW_OFFSET 311 -#define TK_JLIMIT 312 -#define TK_SELECT 313 -#define TK_NK_HINT 314 -#define TK_DISTINCT 315 -#define TK_WHERE 316 -#define TK_PARTITION 317 -#define TK_BY 318 -#define TK_SESSION 319 -#define TK_STATE_WINDOW 320 -#define TK_EVENT_WINDOW 321 -#define TK_COUNT_WINDOW 322 -#define TK_ANOMALY_WINDOW 323 -#define TK_SLIDING 324 -#define TK_FILL 325 -#define TK_VALUE 326 -#define TK_VALUE_F 327 -#define TK_NONE 328 -#define TK_PREV 329 -#define TK_NULL_F 330 -#define TK_LINEAR 331 -#define TK_NEXT 332 -#define TK_HAVING 333 -#define TK_RANGE 334 -#define TK_EVERY 335 -#define TK_ORDER 336 -#define TK_SLIMIT 337 -#define TK_SOFFSET 338 -#define TK_LIMIT 339 -#define TK_OFFSET 340 -#define TK_ASC 341 -#define TK_NULLS 342 -#define TK_ABORT 343 -#define TK_AFTER 344 -#define TK_ATTACH 345 -#define TK_BEFORE 346 -#define TK_BEGIN 347 -#define TK_BITAND 348 -#define TK_BITNOT 349 -#define TK_BITOR 350 -#define TK_BLOCKS 351 -#define TK_CHANGE 352 -#define TK_COMMA 353 -#define TK_CONCAT 354 -#define TK_CONFLICT 355 -#define TK_COPY 356 -#define TK_DEFERRED 357 -#define TK_DELIMITERS 358 -#define TK_DETACH 359 -#define TK_DIVIDE 360 -#define TK_DOT 361 -#define TK_EACH 362 -#define TK_FAIL 363 -#define TK_GLOB 364 -#define TK_ID 365 -#define TK_IMMEDIATE 366 -#define TK_IMPORT 367 -#define TK_INITIALLY 368 -#define TK_INSTEAD 369 -#define TK_ISNULL 370 -#define TK_MODULES 371 -#define TK_NK_BITNOT 372 -#define TK_NK_SEMI 373 -#define TK_NOTNULL 374 -#define TK_OF 375 -#define TK_PLUS 376 -#define TK_PRIVILEGE 377 -#define TK_RAISE 378 -#define TK_RESTRICT 379 -#define TK_ROW 380 -#define TK_STAR 381 -#define TK_STATEMENT 382 -#define TK_STRICT 383 -#define TK_STRING 384 -#define TK_TIMES 385 -#define TK_VALUES 386 -#define TK_VARIABLE 387 -#define TK_WAL 388 +#include "ttokenauto.h" #define TK_NK_SPACE 600 #define TK_NK_COMMENT 601 diff --git a/source/common/CMakeLists.txt b/source/common/CMakeLists.txt index 42a7c2c61548..64709e1d346a 100644 --- a/source/common/CMakeLists.txt +++ b/source/common/CMakeLists.txt @@ -6,6 +6,8 @@ endif() add_library(common STATIC ${COMMON_SRC}) +add_dependencies(common lemon_target) + if(DEFINED GRANT_CFG_INCLUDE_DIR) add_definitions(-DGRANTS_CFG) endif() diff --git a/source/libs/parser/CMakeLists.txt b/source/libs/parser/CMakeLists.txt index cfdbe2848e60..d6c9810603f4 100644 --- a/source/libs/parser/CMakeLists.txt +++ b/source/libs/parser/CMakeLists.txt @@ -9,15 +9,17 @@ add_custom_command( COMMAND echo "Running lemon process in ${TD_SOURCE_DIR}/source/libs/parser/inc" COMMAND ${TD_CONTRIB_DIR}/lemon/lemon sql.y || true COMMAND echo "copy sql.c from ${TD_SOURCE_DIR}/source/libs/parser/inc/sql.c to ${TD_SOURCE_DIR}/source/libs/parser/src/" - COMMAND cp ${TD_SOURCE_DIR}/source/libs/parser/inc/sql.c ${TD_SOURCE_DIR}/source/libs/parser/src/ + COMMAND mv ${TD_SOURCE_DIR}/source/libs/parser/inc/sql.c ${TD_SOURCE_DIR}/source/libs/parser/src/ + COMMAND mv ${TD_SOURCE_DIR}/source/libs/parser/inc/sql.h ${TD_SOURCE_DIR}/include/common/ttokenauto.h COMMAND echo "lemon process completed." DEPENDS ${TD_SOURCE_DIR}/source/libs/parser/inc/sql.y WORKING_DIRECTORY ${TD_SOURCE_DIR}/source/libs/parser/inc COMMENT "Generating sql.c using lemon" ) -add_custom_target(lemon_target +add_custom_target(lemon_target ALL DEPENDS ${TD_SOURCE_DIR}/source/libs/parser/src/sql.c + DEPENDS ${TD_SOURCE_DIR}/include/common/ttokenauto.h ) list(APPEND PARSER_SRC ${TD_SOURCE_DIR}/source/libs/parser/src/sql.c) From 9fa6fe67c2acbacaa834c4a70b1139758f208b07 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Wed, 6 Nov 2024 14:36:08 +0800 Subject: [PATCH 656/695] add ci --- tests/parallel_test/cases.task | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 86c54a4cabed..151358aec319 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -74,6 +74,8 @@ #,,n,system-test,python3 ./test.py -f 8-stream/vnode_restart.py -N 4 #,,n,system-test,python3 ./test.py -f 8-stream/snode_restart.py -N 4 ,,n,system-test,python3 ./test.py -f 8-stream/snode_restart_with_checkpoint.py -N 4 +,,y,system-test,./pytest.sh python3 ./test.py -f 8-stream/force_window_close_interp.py +,,y,system-test,./pytest.sh python3 ./test.py -f 8-stream/force_window_close_interval.py ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/pk_error.py ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/pk_func.py From 1456d027b7cf797905376b7912b0c8c4af4c31e5 Mon Sep 17 00:00:00 2001 From: xsren <285808407@qq.com> Date: Wed, 6 Nov 2024 15:11:27 +0800 Subject: [PATCH 657/695] fix: lemon_sqll depends --- source/common/CMakeLists.txt | 2 +- source/libs/parser/CMakeLists.txt | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/source/common/CMakeLists.txt b/source/common/CMakeLists.txt index 64709e1d346a..f10eb6a6114c 100644 --- a/source/common/CMakeLists.txt +++ b/source/common/CMakeLists.txt @@ -6,7 +6,7 @@ endif() add_library(common STATIC ${COMMON_SRC}) -add_dependencies(common lemon_target) +add_dependencies(common lemon_sql) if(DEFINED GRANT_CFG_INCLUDE_DIR) add_definitions(-DGRANTS_CFG) diff --git a/source/libs/parser/CMakeLists.txt b/source/libs/parser/CMakeLists.txt index d6c9810603f4..bd2dd95ee0f3 100644 --- a/source/libs/parser/CMakeLists.txt +++ b/source/libs/parser/CMakeLists.txt @@ -5,11 +5,11 @@ IF(TD_ENTERPRISE) ENDIF() add_custom_command( - OUTPUT ${TD_SOURCE_DIR}/source/libs/parser/src/sql.c + OUTPUT ${TD_SOURCE_DIR}/source/libs/parser/src/sql.c ${TD_SOURCE_DIR}/include/common/ttokenauto.h COMMAND echo "Running lemon process in ${TD_SOURCE_DIR}/source/libs/parser/inc" COMMAND ${TD_CONTRIB_DIR}/lemon/lemon sql.y || true COMMAND echo "copy sql.c from ${TD_SOURCE_DIR}/source/libs/parser/inc/sql.c to ${TD_SOURCE_DIR}/source/libs/parser/src/" - COMMAND mv ${TD_SOURCE_DIR}/source/libs/parser/inc/sql.c ${TD_SOURCE_DIR}/source/libs/parser/src/ + COMMAND mv ${TD_SOURCE_DIR}/source/libs/parser/inc/sql.c ${TD_SOURCE_DIR}/source/libs/parser/src/sql.c COMMAND mv ${TD_SOURCE_DIR}/source/libs/parser/inc/sql.h ${TD_SOURCE_DIR}/include/common/ttokenauto.h COMMAND echo "lemon process completed." DEPENDS ${TD_SOURCE_DIR}/source/libs/parser/inc/sql.y @@ -17,15 +17,14 @@ add_custom_command( COMMENT "Generating sql.c using lemon" ) -add_custom_target(lemon_target ALL - DEPENDS ${TD_SOURCE_DIR}/source/libs/parser/src/sql.c - DEPENDS ${TD_SOURCE_DIR}/include/common/ttokenauto.h +add_custom_target(lemon_sql ALL + DEPENDS ${TD_SOURCE_DIR}/source/libs/parser/src/sql.c ${TD_SOURCE_DIR}/include/common/ttokenauto.h ) list(APPEND PARSER_SRC ${TD_SOURCE_DIR}/source/libs/parser/src/sql.c) add_library(parser STATIC ${PARSER_SRC}) -add_dependencies(parser lemon_target) +add_dependencies(parser lemon_sql) target_include_directories( parser PUBLIC "${TD_SOURCE_DIR}/include/libs/parser" From aa8bc8379192af72636f51df46c9d4211c2ecdac Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Wed, 6 Nov 2024 15:46:21 +0800 Subject: [PATCH 658/695] update fqdn cache --- source/libs/transport/src/transCli.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index 43f64924e1ab..3607f153e999 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -1608,6 +1608,8 @@ static int32_t cliDoConn(SCliThrd* pThrd, SCliConn* conn) { ret = uv_tcp_connect(&conn->connReq, (uv_tcp_t*)(conn->stream), (const struct sockaddr*)&addr, cliConnCb); if (ret != 0) { tError("failed connect to %s since %s", conn->dstAddr, uv_err_name(ret)); + if (ret == ) + cliMayUpdateFqdnCache(pThrd->fqdn2ipCache, conn->dstAddr); TAOS_CHECK_GOTO(TSDB_CODE_THIRDPARTY_ERROR, &lino, _exception1); } @@ -1699,6 +1701,7 @@ void cliConnCb(uv_connect_t* req, int status) { if (status != 0) { tDebug("%s conn %p failed to connect to %s since %s", CONN_GET_INST_LABEL(pConn), pConn, pConn->dstAddr, uv_strerror(status)); + cliMayUpdateFqdnCache(pThrd->fqdn2ipCache, pConn->dstAddr); TAOS_UNUSED(transUnrefCliHandle(pConn)); return; } @@ -1850,7 +1853,7 @@ static FORCE_INLINE int32_t cliUpdateFqdnCache(SHashObj* cache, char* fqdn) { size_t len = strlen(fqdn); uint32_t* v = taosHashGet(cache, fqdn, len); if (addr != *v) { - char old[TD_IP_LEN] = {0}, new[TD_IP_LEN] = {0}; + char old[TSDB_FQDN_LEN] = {0}, new[TSDB_FQDN_LEN] = {0}; tinet_ntoa(old, *v); tinet_ntoa(new, addr); tWarn("update ip of fqdn:%s, old: %s, new: %s", fqdn, old, new); @@ -1870,7 +1873,7 @@ static void cliMayUpdateFqdnCache(SHashObj* cache, char* dst) { if (dst[i] == ':') break; } if (i > 0) { - char fqdn[TSDB_FQDN_LEN + 1] = {0}; + char fqdn[TSDB_FQDN_LEN] = {0}; memcpy(fqdn, dst, i); TAOS_UNUSED(cliUpdateFqdnCache(cache, fqdn)); } From 0a9d1d8ff7898b46e9b8729260b1135058f4d793 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Wed, 6 Nov 2024 15:55:42 +0800 Subject: [PATCH 659/695] update fqdn cache --- source/libs/transport/src/transCli.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index 3607f153e999..2bc5ddc1a665 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -620,7 +620,7 @@ int32_t cliHandleState_mayCreateAhandle(SCliConn* conn, STransMsgHead* pHead, ST int32_t code = 0; int64_t qId = taosHton64(pHead->qid); if (qId == 0) { - return 0; + return TSDB_CODE_RPC_NO_STATE; } STransCtx* pCtx = taosHashGet(conn->pQTable, &qId, sizeof(qId)); @@ -1608,7 +1608,6 @@ static int32_t cliDoConn(SCliThrd* pThrd, SCliConn* conn) { ret = uv_tcp_connect(&conn->connReq, (uv_tcp_t*)(conn->stream), (const struct sockaddr*)&addr, cliConnCb); if (ret != 0) { tError("failed connect to %s since %s", conn->dstAddr, uv_err_name(ret)); - if (ret == ) cliMayUpdateFqdnCache(pThrd->fqdn2ipCache, conn->dstAddr); TAOS_CHECK_GOTO(TSDB_CODE_THIRDPARTY_ERROR, &lino, _exception1); } From 268576b38646f8b9e26e2ae86ae241910b331fb4 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Wed, 6 Nov 2024 16:15:36 +0800 Subject: [PATCH 660/695] fix double free when meet mem leak --- source/libs/transport/src/transCli.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index 2bc5ddc1a665..c732def505e2 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -2919,6 +2919,7 @@ bool cliMayRetry(SCliConn* pConn, SCliReq* pReq, STransMsg* pResp) { noDelay = cliResetEpset(pCtx, pResp, false); transFreeMsg(pResp->pCont); } + pResp->pCont = NULL; if (code != TSDB_CODE_RPC_BROKEN_LINK && code != TSDB_CODE_RPC_NETWORK_UNAVAIL && code != TSDB_CODE_SUCCESS) { // save one internal code pCtx->retryCode = code; From 5ba9a088d2e149ca4e180953cfa7aba032ce6b8d Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Wed, 6 Nov 2024 16:15:40 +0800 Subject: [PATCH 661/695] fix(stream): fix the underlying scan operations for stream, when trying to drop stream tasks. --- source/libs/stream/src/streamMeta.c | 8 ++++++++ source/libs/stream/src/streamTaskSm.c | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/source/libs/stream/src/streamMeta.c b/source/libs/stream/src/streamMeta.c index f5de719848e4..9213c729d732 100644 --- a/source/libs/stream/src/streamMeta.c +++ b/source/libs/stream/src/streamMeta.c @@ -887,6 +887,14 @@ static int32_t streamTaskSendTransSuccessMsg(SStreamTask* pTask, void* param) { tstrerror(code)); } } + + // let's kill the query procedure within stream, to end it ASAP. + if (pTask->info.taskLevel != TASK_LEVEL__SINK && pTask->exec.pExecutor != NULL) { + code = qKillTask(pTask->exec.pExecutor, TSDB_CODE_SUCCESS); + if (code != TSDB_CODE_SUCCESS) { + stError("s-task:%s failed to kill task related query handle, code:%s", pTask->id.idStr, tstrerror(code)); + } + } return code; } diff --git a/source/libs/stream/src/streamTaskSm.c b/source/libs/stream/src/streamTaskSm.c index c3a2742aa209..f995c4868894 100644 --- a/source/libs/stream/src/streamTaskSm.c +++ b/source/libs/stream/src/streamTaskSm.c @@ -500,7 +500,9 @@ int32_t streamTaskOnHandleEventSuccess(SStreamTaskSM* pSM, EStreamTaskEvent even STaskStateTrans* pTrans = pSM->pActiveTrans; if (pTrans == NULL) { ETaskStatus s = pSM->current.state; - + // when trying to finish current event successfully, another event with high priorities, such as dropping/stop, has + // interrupted this procedure, and changed the status after freeing the activeTrans, resulting in the failure of + // processing of current event. if (s != TASK_STATUS__DROPPING && s != TASK_STATUS__PAUSE && s != TASK_STATUS__STOP && s != TASK_STATUS__UNINIT && s != TASK_STATUS__READY) { stError("s-task:%s invalid task status:%s on handling event:%s success", id, pSM->current.name, From 8ec3d3f8debfa36c1c45b245f52c0a46e3181e4d Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Wed, 6 Nov 2024 16:29:12 +0800 Subject: [PATCH 662/695] recover tommon.h --- include/common/tcommon.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/common/tcommon.h b/include/common/tcommon.h index c9b68baf89ef..ea764e6760fa 100644 --- a/include/common/tcommon.h +++ b/include/common/tcommon.h @@ -127,6 +127,7 @@ enum { STREAM_INPUT__DATA_SUBMIT = 1, STREAM_INPUT__DATA_BLOCK, STREAM_INPUT__MERGED_SUBMIT, + STREAM_INPUT__TQ_SCAN, STREAM_INPUT__DATA_RETRIEVE, STREAM_INPUT__GET_RES, STREAM_INPUT__CHECKPOINT, From 4b4943335e84bdb482506152caff5bc82344245c Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Wed, 6 Nov 2024 16:15:40 +0800 Subject: [PATCH 663/695] fix(stream): fix the underlying scan operations for stream, when trying to drop stream tasks. --- source/libs/stream/src/streamMeta.c | 8 ++++++++ source/libs/stream/src/streamTaskSm.c | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/source/libs/stream/src/streamMeta.c b/source/libs/stream/src/streamMeta.c index bc7878f7618a..2ce8eefe99f9 100644 --- a/source/libs/stream/src/streamMeta.c +++ b/source/libs/stream/src/streamMeta.c @@ -807,6 +807,14 @@ static int32_t streamTaskSendTransSuccessMsg(SStreamTask* pTask, void* param) { tstrerror(code)); } } + + // let's kill the query procedure within stream, to end it ASAP. + if (pTask->info.taskLevel != TASK_LEVEL__SINK && pTask->exec.pExecutor != NULL) { + code = qKillTask(pTask->exec.pExecutor, TSDB_CODE_SUCCESS); + if (code != TSDB_CODE_SUCCESS) { + stError("s-task:%s failed to kill task related query handle, code:%s", pTask->id.idStr, tstrerror(code)); + } + } return code; } diff --git a/source/libs/stream/src/streamTaskSm.c b/source/libs/stream/src/streamTaskSm.c index c3a2742aa209..f995c4868894 100644 --- a/source/libs/stream/src/streamTaskSm.c +++ b/source/libs/stream/src/streamTaskSm.c @@ -500,7 +500,9 @@ int32_t streamTaskOnHandleEventSuccess(SStreamTaskSM* pSM, EStreamTaskEvent even STaskStateTrans* pTrans = pSM->pActiveTrans; if (pTrans == NULL) { ETaskStatus s = pSM->current.state; - + // when trying to finish current event successfully, another event with high priorities, such as dropping/stop, has + // interrupted this procedure, and changed the status after freeing the activeTrans, resulting in the failure of + // processing of current event. if (s != TASK_STATUS__DROPPING && s != TASK_STATUS__PAUSE && s != TASK_STATUS__STOP && s != TASK_STATUS__UNINIT && s != TASK_STATUS__READY) { stError("s-task:%s invalid task status:%s on handling event:%s success", id, pSM->current.name, From 88cb8a9599ba5a4cd8bb3010920c75c7227a9a35 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Wed, 6 Nov 2024 17:21:21 +0800 Subject: [PATCH 664/695] fix issue --- docs/zh/06-advanced/03-stream.md | 2 +- docs/zh/14-reference/03-taos-sql/14-stream.md | 2 +- source/libs/parser/src/parTranslater.c | 7 ++++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/docs/zh/06-advanced/03-stream.md b/docs/zh/06-advanced/03-stream.md index d2947f96586d..cf45f384e971 100644 --- a/docs/zh/06-advanced/03-stream.md +++ b/docs/zh/06-advanced/03-stream.md @@ -120,7 +120,7 @@ create stream if not exists count_history_s fill_history 1 into count_history as 1. AT_ONCE:写入立即触发。 2. WINDOW_CLOSE:窗口关闭时触发(窗口关闭由事件时间决定,可配合 watermark 使用)。 3. MAX_DELAY time:若窗口关闭,则触发计算。若窗口未关闭,且未关闭时长超过 max delay 指定的时间,则触发计算。 -4. FORCE_WINDOW_CLOSE:以操作系统当前时间为准,只计算当前关闭窗口的结果,并推送出去。窗口只会在被关闭的时刻计算一次,后续不会再重复计算。该模式当前只支持INTERVAL窗口(不支持滑动)和INTERP函数;FILL_HISTORY必须为 0,IGNORE EXPIRED必须为 1,IGNORE EXPIRED必须为 1;FILL只支持PREV 、NULL、 NONE、VALUE。 +4. FORCE_WINDOW_CLOSE:以操作系统当前时间为准,只计算当前关闭窗口的结果,并推送出去。窗口只会在被关闭的时刻计算一次,后续不会再重复计算。该模式当前只支持 INTERVAL 窗口(不支持滑动)和 INTERP 函数;FILL_HISTORY必须为 0,IGNORE EXPIRED 必须为 1,IGNORE UPDATE 必须为 1;FILL 只支持 PREV 、NULL、 NONE、VALUE。 窗口关闭是由事件时间决定的,如事件流中断、或持续延迟,此时事件时间无法更新,可能导致无法得到最新的计算结果。 diff --git a/docs/zh/14-reference/03-taos-sql/14-stream.md b/docs/zh/14-reference/03-taos-sql/14-stream.md index fc65c4e7334c..b6ccf6deeebe 100644 --- a/docs/zh/14-reference/03-taos-sql/14-stream.md +++ b/docs/zh/14-reference/03-taos-sql/14-stream.md @@ -150,7 +150,7 @@ SELECT * from information_schema.`ins_streams`; 2. WINDOW_CLOSE:窗口关闭时触发(窗口关闭由事件时间决定,可配合 watermark 使用) 3. MAX_DELAY time:若窗口关闭,则触发计算。若窗口未关闭,且未关闭时长超过 max delay 指定的时间,则触发计算。 -4. FORCE_WINDOW_CLOSE:以操作系统当前时间为准,只计算当前关闭窗口的结果,并推送出去。窗口只会在被关闭的时刻计算一次,后续不会再重复计算。该模式当前只支持INTERVAL窗口(不支持滑动)和INTERP函数;FILL_HISTORY必须为 0,IGNORE EXPIRED必须为 1,IGNORE EXPIRED必须为 1;FILL只支持PREV 、NULL、 NONE、VALUE。 +4. FORCE_WINDOW_CLOSE:以操作系统当前时间为准,只计算当前关闭窗口的结果,并推送出去。窗口只会在被关闭的时刻计算一次,后续不会再重复计算。该模式当前只支持 INTERVAL 窗口(不支持滑动)和 INTERP 函数;FILL_HISTORY必须为 0,IGNORE EXPIRED 必须为 1,IGNORE UPDATE 必须为 1;FILL 只支持PREV 、NULL、 NONE、VALUE。 由于窗口关闭是由事件时间决定的,如事件流中断、或持续延迟,则事件时间无法更新,可能导致无法得到最新的计算结果。 diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index e6c2ddf8de0e..89976de6531d 100755 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -10567,6 +10567,9 @@ static int32_t addIrowTsToCreateStreamQueryImpl(STranslateContext* pCxt, SSelect if (TSDB_CODE_SUCCESS == code) { code = nodesListPushFront(pSelect->pProjectionList, (SNode*)pFunc); } + if (TSDB_CODE_SUCCESS != code) { + nodesDestroyNode((SNode*)pFunc); + } if (TSDB_CODE_SUCCESS == code && STREAM_CREATE_STABLE_TRUE == pReq->createStb) { SColumnDefNode* pColDef = NULL; @@ -10580,9 +10583,7 @@ static int32_t addIrowTsToCreateStreamQueryImpl(STranslateContext* pCxt, SSelect if (TSDB_CODE_SUCCESS == code) code = nodesListPushFront(pCols, (SNode*)pColDef); if (TSDB_CODE_SUCCESS != code) nodesDestroyNode((SNode*)pColDef); } - if (TSDB_CODE_SUCCESS != code) { - nodesDestroyNode((SNode*)pFunc); - } + return code; } From 7dac2742319164f425793fd103c0e2f9f2a3dabe Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Wed, 6 Nov 2024 17:24:39 +0800 Subject: [PATCH 665/695] fix issue --- include/common/tmsg.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/common/tmsg.h b/include/common/tmsg.h index f6218be7977c..7ff70b243a4a 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -467,11 +467,11 @@ typedef enum ENodeType { QUERY_NODE_PHYSICAL_PLAN_MERGE_COUNT, QUERY_NODE_PHYSICAL_PLAN_STREAM_COUNT, QUERY_NODE_PHYSICAL_PLAN_STREAM_MID_INTERVAL, - QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERP_FUNC, QUERY_NODE_PHYSICAL_PLAN_STREAM_CONTINUE_INTERVAL, QUERY_NODE_PHYSICAL_PLAN_MERGE_ANOMALY, QUERY_NODE_PHYSICAL_PLAN_STREAM_ANOMALY, QUERY_NODE_PHYSICAL_PLAN_FORECAST_FUNC, + QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERP_FUNC, } ENodeType; typedef struct { From 06bfd0a7ba3735affa982775b81720d3feac2504 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Wed, 6 Nov 2024 17:43:04 +0800 Subject: [PATCH 666/695] fix issue --- docs/zh/06-advanced/03-stream.md | 2 +- docs/zh/14-reference/03-taos-sql/14-stream.md | 2 +- source/libs/parser/src/parTranslater.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/zh/06-advanced/03-stream.md b/docs/zh/06-advanced/03-stream.md index cf45f384e971..7486b3b043a3 100644 --- a/docs/zh/06-advanced/03-stream.md +++ b/docs/zh/06-advanced/03-stream.md @@ -120,7 +120,7 @@ create stream if not exists count_history_s fill_history 1 into count_history as 1. AT_ONCE:写入立即触发。 2. WINDOW_CLOSE:窗口关闭时触发(窗口关闭由事件时间决定,可配合 watermark 使用)。 3. MAX_DELAY time:若窗口关闭,则触发计算。若窗口未关闭,且未关闭时长超过 max delay 指定的时间,则触发计算。 -4. FORCE_WINDOW_CLOSE:以操作系统当前时间为准,只计算当前关闭窗口的结果,并推送出去。窗口只会在被关闭的时刻计算一次,后续不会再重复计算。该模式当前只支持 INTERVAL 窗口(不支持滑动)和 INTERP 函数;FILL_HISTORY必须为 0,IGNORE EXPIRED 必须为 1,IGNORE UPDATE 必须为 1;FILL 只支持 PREV 、NULL、 NONE、VALUE。 +4. FORCE_WINDOW_CLOSE:以操作系统当前时间为准,只计算当前关闭窗口的结果,并推送出去。窗口只会在被关闭的时刻计算一次,后续不会再重复计算。该模式当前只支持 INTERVAL 窗口(不支持滑动);FILL_HISTORY必须为 0,IGNORE EXPIRED 必须为 1,IGNORE UPDATE 必须为 1;FILL 只支持 PREV 、NULL、 NONE、VALUE。 窗口关闭是由事件时间决定的,如事件流中断、或持续延迟,此时事件时间无法更新,可能导致无法得到最新的计算结果。 diff --git a/docs/zh/14-reference/03-taos-sql/14-stream.md b/docs/zh/14-reference/03-taos-sql/14-stream.md index b6ccf6deeebe..25a11ecdcb54 100644 --- a/docs/zh/14-reference/03-taos-sql/14-stream.md +++ b/docs/zh/14-reference/03-taos-sql/14-stream.md @@ -150,7 +150,7 @@ SELECT * from information_schema.`ins_streams`; 2. WINDOW_CLOSE:窗口关闭时触发(窗口关闭由事件时间决定,可配合 watermark 使用) 3. MAX_DELAY time:若窗口关闭,则触发计算。若窗口未关闭,且未关闭时长超过 max delay 指定的时间,则触发计算。 -4. FORCE_WINDOW_CLOSE:以操作系统当前时间为准,只计算当前关闭窗口的结果,并推送出去。窗口只会在被关闭的时刻计算一次,后续不会再重复计算。该模式当前只支持 INTERVAL 窗口(不支持滑动)和 INTERP 函数;FILL_HISTORY必须为 0,IGNORE EXPIRED 必须为 1,IGNORE UPDATE 必须为 1;FILL 只支持PREV 、NULL、 NONE、VALUE。 +4. FORCE_WINDOW_CLOSE:以操作系统当前时间为准,只计算当前关闭窗口的结果,并推送出去。窗口只会在被关闭的时刻计算一次,后续不会再重复计算。该模式当前只支持 INTERVAL 窗口(不支持滑动);FILL_HISTORY必须为 0,IGNORE EXPIRED 必须为 1,IGNORE UPDATE 必须为 1;FILL 只支持PREV 、NULL、 NONE、VALUE。 由于窗口关闭是由事件时间决定的,如事件流中断、或持续延迟,则事件时间无法更新,可能导致无法得到最新的计算结果。 diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 89976de6531d..02295b34da8a 100755 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -10559,8 +10559,8 @@ static int32_t addIrowTsToCreateStreamQueryImpl(STranslateContext* pCxt, SSelect if (NULL == pFunc) { return code; } - strcpy(pFunc->functionName, "_irowts"); - strcpy(pFunc->node.userAlias, "_irowts"); + tstrncpy(pFunc->functionName, "_irowts", tListLen(pFunc->functionName)); + tstrncpy(pFunc->node.userAlias, "_irowts", tListLen(pFunc->node.userAlias)); char* defaultName[] = {"_irowts", NULL}; getStreamQueryFirstProjectAliasName(pUserAliasSet, pFunc->node.aliasName, sizeof(pFunc->node.aliasName), defaultName); code = getFuncInfo(pCxt, pFunc); From 8685bf02c3b0cec8d55060e5d8985ce79f2cacf4 Mon Sep 17 00:00:00 2001 From: qevolg <2227465945@qq.com> Date: Wed, 6 Nov 2024 17:43:34 +0800 Subject: [PATCH 667/695] docs: update taoskeeper doc --- .../01-components/06-taoskeeper.md | 142 +++++++++++------- 1 file changed, 86 insertions(+), 56 deletions(-) diff --git a/docs/zh/14-reference/01-components/06-taoskeeper.md b/docs/zh/14-reference/01-components/06-taoskeeper.md index c3d22d25f189..3aa65480c872 100644 --- a/docs/zh/14-reference/01-components/06-taoskeeper.md +++ b/docs/zh/14-reference/01-components/06-taoskeeper.md @@ -13,7 +13,7 @@ taosKeeper 是 TDengine 3.0 版本监控指标的导出工具,通过简单的 taosKeeper 有两种安装方式: -- 安装 TDengine 官方安装包的同时会自动安装 taosKeeper, 详情请参考[ TDengine 安装](../../../get-started/)。 +- 安装 TDengine 官方安装包的同时会自动安装 taosKeeper, 详情请参考[TDengine 安装](../../../get-started/)。 - 单独编译 taosKeeper 并安装,详情请参考 [taosKeeper](https://github.com/taosdata/taoskeeper) 仓库。 @@ -22,55 +22,63 @@ taosKeeper 有两种安装方式: taosKeeper 需要在操作系统终端执行,该工具支持三种配置方式:命令行参数、环境变量 和 配置文件。优先级为:命令行参数、环境变量、配置文件参数。 一般我们推荐使用配置文件。 ### 命令行参数和环境变量 + 命令行参数 和 环境变量说明可以参考命令 `taoskeeper --help` 的输出。下面是一个例子: + ```shell -Usage of taosKeeper v3.3.2.0: - --debug enable debug mode. Env "TAOS_KEEPER_DEBUG" - -P, --port int http port. Env "TAOS_KEEPER_PORT" (default 6043) - --logLevel string log level (panic fatal error warn warning info debug trace). Env "TAOS_KEEPER_LOG_LEVEL" (default "info") - --gopoolsize int coroutine size. Env "TAOS_KEEPER_POOL_SIZE" (default 50000) - -R, --RotationInterval string interval for refresh metrics, such as "300ms", Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". Env "TAOS_KEEPER_ROTATION_INTERVAL" (default "15s") - --tdengine.host string TDengine server's ip. Env "TAOS_KEEPER_TDENGINE_HOST" (default "127.0.0.1") - --tdengine.port int TDengine REST server(taosAdapter)'s port. Env "TAOS_KEEPER_TDENGINE_PORT" (default 6041) - --tdengine.username string TDengine server's username. Env "TAOS_KEEPER_TDENGINE_USERNAME" (default "root") - --tdengine.password string TDengine server's password. Env "TAOS_KEEPER_TDENGINE_PASSWORD" (default "taosdata") - --tdengine.usessl TDengine server use ssl or not. Env "TAOS_KEEPER_TDENGINE_USESSL" - --metrics.prefix string prefix in metrics names. Env "TAOS_KEEPER_METRICS_PREFIX" - --metrics.database.name string database for storing metrics data. Env "TAOS_KEEPER_METRICS_DATABASE" (default "log") - --metrics.tables stringArray export some tables that are not super table, multiple values split with white space. Env "TAOS_KEEPER_METRICS_TABLES" - --environment.incgroup whether running in cgroup. Env "TAOS_KEEPER_ENVIRONMENT_INCGROUP" - --log.path string log path. Env "TAOS_KEEPER_LOG_PATH" (default "/var/log/taos") - --log.rotationCount uint log rotation count. Env "TAOS_KEEPER_LOG_ROTATION_COUNT" (default 5) - --log.rotationTime duration log rotation time. Env "TAOS_KEEPER_LOG_ROTATION_TIME" (default 24h0m0s) - --log.rotationSize string log rotation size(KB MB GB), must be a positive integer. Env "TAOS_KEEPER_LOG_ROTATION_SIZE" (default "100000000") - -c, --config string config path default /etc/taos/taoskeeper.toml - -V, --version Print the version and exit - -h, --help Print this help message and exit +Usage of taoskeeper v3.3.3.0: + -R, --RotationInterval string interval for refresh metrics, such as "300ms", Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". Env "TAOS_KEEPER_ROTATION_INTERVAL" (default "15s") + -c, --config string config path default /etc/taos/taoskeeper.toml + --drop string run taoskeeper in command mode, only support old_taosd_metric_stables. + --environment.incgroup whether running in cgroup. Env "TAOS_KEEPER_ENVIRONMENT_INCGROUP" + --fromTime string parameter of transfer, example: 2020-01-01T00:00:00+08:00 (default "2020-01-01T00:00:00+08:00") + --gopoolsize int coroutine size. Env "TAOS_KEEPER_POOL_SIZE" (default 50000) + -h, --help Print this help message and exit + --instanceId int instance ID. Env "TAOS_KEEPER_INSTANCE_ID" (default 64) + --log.compress whether to compress old log. Env "TAOS_KEEPER_LOG_COMPRESS" + --log.keepDays uint log retention days, must be a positive integer. Env "TAOS_KEEPER_LOG_KEEP_DAYS" (default 30) + --log.level string log level (trace debug info warning error). Env "TAOS_KEEPER_LOG_LEVEL" (default "info") + --log.path string log path. Env "TAOS_KEEPER_LOG_PATH" (default "/var/log/taos") + --log.reservedDiskSize string reserved disk size for log dir (KB MB GB), must be a positive integer. Env "TAOS_KEEPER_LOG_RESERVED_DISK_SIZE" (default "1GB") + --log.rotationCount uint log rotation count. Env "TAOS_KEEPER_LOG_ROTATION_COUNT" (default 5) + --log.rotationSize string log rotation size(KB MB GB), must be a positive integer. Env "TAOS_KEEPER_LOG_ROTATION_SIZE" (default "1GB") + --log.rotationTime duration deprecated: log rotation time always 24 hours. Env "TAOS_KEEPER_LOG_ROTATION_TIME" (default 24h0m0s) + --logLevel string log level (trace debug info warning error). Env "TAOS_KEEPER_LOG_LEVEL" (default "info") + --metrics.database.name string database for storing metrics data. Env "TAOS_KEEPER_METRICS_DATABASE" (default "log") + --metrics.database.options.buffer int database option buffer for audit database. Env "TAOS_KEEPER_METRICS_BUFFER" (default 64) + --metrics.database.options.cachemodel string database option cachemodel for audit database. Env "TAOS_KEEPER_METRICS_CACHEMODEL" (default "both") + --metrics.database.options.keep int database option buffer for audit database. Env "TAOS_KEEPER_METRICS_KEEP" (default 90) + --metrics.database.options.vgroups int database option vgroups for audit database. Env "TAOS_KEEPER_METRICS_VGROUPS" (default 1) + --metrics.prefix string prefix in metrics names. Env "TAOS_KEEPER_METRICS_PREFIX" + --metrics.tables stringArray export some tables that are not super table, multiple values split with white space. Env "TAOS_KEEPER_METRICS_TABLES" + -P, --port int http port. Env "TAOS_KEEPER_PORT" (default 6043) + --tdengine.host string TDengine server's ip. Env "TAOS_KEEPER_TDENGINE_HOST" (default "127.0.0.1") + --tdengine.password string TDengine server's password. Env "TAOS_KEEPER_TDENGINE_PASSWORD" (default "taosdata") + --tdengine.port int TDengine REST server(taosAdapter)'s port. Env "TAOS_KEEPER_TDENGINE_PORT" (default 6041) + --tdengine.username string TDengine server's username. Env "TAOS_KEEPER_TDENGINE_USERNAME" (default "root") + --tdengine.usessl TDengine server use ssl or not. Env "TAOS_KEEPER_TDENGINE_USESSL" + --transfer string run taoskeeper in command mode, only support old_taosd_metric. transfer old metrics data to new tables and exit + -V, --version Print the version and exit ``` - - ### 配置文件 -taosKeeper 支持用 `taoskeeper -c ` 命令来指定配置文件。 -若不指定配置文件,taosKeeper 会使用默认配置文件,其路径为: `/etc/taos/taoskeeper.toml` 。 +taosKeeper 支持用 `taoskeeper -c ` 命令来指定配置文件。 +若不指定配置文件,taosKeeper 会使用默认配置文件,其路径为: `/etc/taos/taoskeeper.toml` 。 若既不指定 taosKeeper 配置文件,且 `/etc/taos/taoskeeper.toml` 也不存在,将使用默认配置。 **下面是配置文件的示例:** + ```toml -# Start with debug middleware for gin -debug = false +instanceId = 64 -# Listen port, default is 6043 +# Listening port, default is 6043. port = 6043 -# log level -loglevel = "info" - -# go pool size +# Go pool size gopoolsize = 50000 -# interval for metrics +# Interval for metrics RotationInterval = "15s" [tdengine] @@ -81,20 +89,21 @@ password = "taosdata" usessl = false [metrics] -# metrics prefix in metrics names. +# Metrics prefix in metrics names. prefix = "taos" -# export some tables that are not super table +# Export some tables that are not super table. tables = [] -# database for storing metrics data +# Database for storing metrics data. [metrics.database] name = "log" -# database options for db storing metrics data + +# Database options for db storing metrics data. [metrics.database.options] vgroups = 1 buffer = 64 -KEEP = 90 +keep = 90 cachemodel = "both" [environment] @@ -102,9 +111,19 @@ cachemodel = "both" incgroup = false [log] -rotationCount = 5 -rotationTime = "24h" -rotationSize = 100000000 +# The directory where log files are stored. +# path = "/var/log/taos" +level = "info" +# Number of log file rotations before deletion. +rotationCount = 30 +# The number of days to retain log files. +keepDays = 30 +# The maximum size of a log file before rotation. +rotationSize = "1GB" +# If set to true, log files will be compressed. +compress = false +# Minimum disk space to reserve. Log files will not be written if disk space falls below this limit. +reservedDiskSize = "1GB" ``` ## 启动 @@ -118,7 +137,6 @@ monitorFqdn localhost # taoskeeper 服务的 FQDN TDengine 监控配置相关,具体请参考:[TDengine 监控配置](../../../operation/monitor)。 - @@ -188,8 +206,7 @@ Active: inactive (dead) - -## 健康检查 +## 健康检查 可以访问 taosKeeper 的 `check_health` 接口来判断服务是否存活,如果服务正常则会返回 HTTP 200 状态码: @@ -208,7 +225,6 @@ Content-Length: 21 {"version":"3.3.2.3"} ``` - ## 数据收集与监控 taosKeeper 作为 TDengine 监控指标的导出工具,可以将 TDengine 产生的监控数据记录在指定数据库中(默认的监控数据是 `log`),这些监控数据可以用来配置 TDengine 监控。 @@ -216,6 +232,7 @@ taosKeeper 作为 TDengine 监控指标的导出工具,可以将 TDengine 产 ### 查看监控数据 可以查看 `log` 库下的超级表,每个超级表都对应一组监控指标,具体指标不再赘述。 + ```shell taos> use log; Database changed. @@ -251,17 +268,14 @@ taos> select last_row(*) from taosd_dnodes_info; Query OK, 1 row(s) in set (0.003168s) ``` - ### 使用 TDInsight 配置监控 -收集到监控数据以后,就可以使用 TDInsight 来配置 TDengine 的监控,具体请参考 [TDinsight 参考手册](../tdinsight/) - +收集到监控数据以后,就可以使用 TDInsight 来配置 TDengine 的监控,具体请参考 [TDinsight 参考手册](../tdinsight/)。 ## 集成 Prometheus taoskeeper 提供了 `/metrics` 接口,返回了 Prometheus 格式的监控数据,Prometheus 可以从 taoskeeper 抽取监控数据,实现通过 Prometheus 监控 TDengine 的目的。 - ### 导出监控指标 下面通过 `curl` 命令展示 `/metrics` 接口返回的数据格式: @@ -298,9 +312,11 @@ taos_cluster_info_first_ep_dnode_id{cluster_id="554014120921134497"} 1 #### taosd 集群 ##### 监控信息支持的标签 + - `cluster_id`: 集群 id ##### 相关指标及其含义 + | 指标名称 | 类型 | 含义 | | ----------------------------------- | ------- | ------------------------------------- | | taos_cluster_info_connections_total | counter | 总连接数 | @@ -328,11 +344,13 @@ taos_cluster_info_first_ep_dnode_id{cluster_id="554014120921134497"} 1 #### dnode ##### 监控信息支持的标签 + - `cluster_id`: 集群 id - `dnode_ep`: dnode 端点 - `dnode_id`:dnode id ##### 相关指标及其含义 + | 指标名称 | 类型 | 含义 | | ------------------------------ | ------- | ---------------------------------------------------------------------------------------- | | taos_d_info_status | gauge | dnode 状态,标签 value 表示状态, ready 表示正常, offline 表示下线, unknown 表示未知。 | @@ -361,13 +379,15 @@ taos_cluster_info_first_ep_dnode_id{cluster_id="554014120921134497"} 1 #### 数据目录 ##### 监控信息支持的标签 + - `cluster_id`: 集群 id - `dnode_ep`: dnode 端点 - `dnode_id`:dnode id - `data_dir_name`:数据目录名 -- `data_dir_level`:数据目录级别 +- `data_dir_level`:数据目录级别 ##### 相关指标及其含义 + | 指标名称 | 类型 | 含义 | | --------------------------------- | ----- | -------------------- | | taos_taosd_dnodes_data_dirs_avail | gauge | 可用空间(单位 Byte) | @@ -377,12 +397,14 @@ taos_cluster_info_first_ep_dnode_id{cluster_id="554014120921134497"} 1 #### 日志目录 ##### 监控信息支持的标签 + - `cluster_id`: 集群 id - `dnode_ep`: dnode 端点 - `dnode_id`:dnode id - `log_dir_name`:日志目录名 ##### 相关指标及其含义 + | 指标名称 | 类型 | 含义 | | -------------------------------- | ----- | -------------------- | | taos_taosd_dnodes_log_dirs_avail | gauge | 可用空间(单位 Byte) | @@ -392,11 +414,13 @@ taos_cluster_info_first_ep_dnode_id{cluster_id="554014120921134497"} 1 #### 日志数量 ##### 监控信息支持的标签 + - `cluster_id`: 集群 id - `dnode_ep`: dnode 端点 - `dnode_id`:dnode id ##### 相关指标及其含义 + | 指标名称 | 类型 | 含义 | | ---------------------- | ------- | ------------ | | taos_log_summary_debug | counter | 调试日志数量 | @@ -404,14 +428,15 @@ taos_cluster_info_first_ep_dnode_id{cluster_id="554014120921134497"} 1 | taos_log_summary_info | counter | 信息日志数量 | | taos_log_summary_trace | counter | 跟踪日志数量 | - #### taosadapter ##### 监控信息支持的标签 + - `endpoint`:端点 - `req_type`:请求类型,0 表示 rest,1 表示 websocket ##### 相关指标及其含义 + | 指标名称 | 类型 | 含义 | | -------------------------------------- | ------- | -------------------- | | taos_adapter_requests_fail | counter | 失败的请求数 | @@ -433,9 +458,11 @@ taos_cluster_info_first_ep_dnode_id{cluster_id="554014120921134497"} 1 #### taoskeeper ##### 监控信息支持的标签 + - `identify`: 节点 endpoint ##### 相关指标及其含义 + | 指标名称 | 类型 | 含义 | | ----------------------- | ----- | ------------------------------------- | | taos_keeper_monitor_cpu | gauge | taoskeeper CPU 使用率(取值范围 0~1) | @@ -444,6 +471,7 @@ taos_cluster_info_first_ep_dnode_id{cluster_id="554014120921134497"} 1 #### 其他 taosd 集群监控项 ##### taos_m_info_role + - **标签**: - `cluster_id`: 集群 id - `mnode_ep`: mnode 端点 @@ -453,6 +481,7 @@ taos_cluster_info_first_ep_dnode_id{cluster_id="554014120921134497"} 1 - **含义**: mnode 角色 ##### taos_taos_sql_req_count + - **标签**: - `cluster_id`: 集群 id - `result`: 请求结果(取值范围: Success, Failed) @@ -462,6 +491,7 @@ taos_cluster_info_first_ep_dnode_id{cluster_id="554014120921134497"} 1 - **含义**: SQL 请求数量 ##### taos_taosd_sql_req_count + - **标签**: - `cluster_id`: 集群 id - `dnode_ep`: dnode 端点 @@ -474,6 +504,7 @@ taos_cluster_info_first_ep_dnode_id{cluster_id="554014120921134497"} 1 - **含义**: SQL 请求数量 ##### taos_taosd_vgroups_info_status + - **标签**: - `cluster_id`: 集群 id - `database_name`: 数据库名称 @@ -482,6 +513,7 @@ taos_cluster_info_first_ep_dnode_id{cluster_id="554014120921134497"} 1 - **含义**: 虚拟组状态。 0 为 unsynced,表示没有leader选出;1 为 ready。 ##### taos_taosd_vgroups_info_tables_num + - **标签**: - `cluster_id`: 集群 id - `database_name`: 数据库名称 @@ -490,6 +522,7 @@ taos_cluster_info_first_ep_dnode_id{cluster_id="554014120921134497"} 1 - **含义**: 虚拟组表数量 ##### taos_taosd_vnodes_info_role + - **标签**: - `cluster_id`: 集群 id - `database_name`: 数据库名称 @@ -499,7 +532,6 @@ taos_cluster_info_first_ep_dnode_id{cluster_id="554014120921134497"} 1 - **类型**: gauge - **含义**: 虚拟节点角色 - ### 抽取配置 Prometheus 提供了 `scrape_configs` 配置如何从 endpoint 抽取监控数据,通常只需要修改 `static_configs` 中的 targets 配置为 taoskeeper 的 endpoint 地址,更多配置信息请参考 [Prometheus 配置文档](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#scrape_config)。 @@ -521,8 +553,6 @@ scrape_configs: 在 Grafana Dashboard 菜单点击 `import`,dashboard ID 填写 `18587`,点击 `Load` 按钮即可导入 `TaosKeeper Prometheus Dashboard for 3.x` dashboard。 - - ## taosKeeper 监控指标 taosKeeper 也会将自己采集的监控数据写入监控数据库,默认是 `log` 库,可以在 taoskeeper 配置文件中修改。 From 393d8cbbeaa6d9fed8e7b8f3946f7436cdeb8f6b Mon Sep 17 00:00:00 2001 From: qevolg <2227465945@qq.com> Date: Wed, 6 Nov 2024 18:01:12 +0800 Subject: [PATCH 668/695] docs: update taoskeeper doc --- docs/zh/14-reference/01-components/06-taoskeeper.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/zh/14-reference/01-components/06-taoskeeper.md b/docs/zh/14-reference/01-components/06-taoskeeper.md index 3aa65480c872..95b550405876 100644 --- a/docs/zh/14-reference/01-components/06-taoskeeper.md +++ b/docs/zh/14-reference/01-components/06-taoskeeper.md @@ -70,6 +70,8 @@ taosKeeper 支持用 `taoskeeper -c ` 命令来指定配置 **下面是配置文件的示例:** ```toml +# The ID of the currently running instance of the component that generated the QID, +# default is 64. instanceId = 64 # Listening port, default is 6043. From a92a36ab8063c7a177885d62e78d4f69f5243b2b Mon Sep 17 00:00:00 2001 From: qevolg <2227465945@qq.com> Date: Wed, 6 Nov 2024 18:03:39 +0800 Subject: [PATCH 669/695] docs: update taoskeeper doc --- docs/zh/14-reference/01-components/06-taoskeeper.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/zh/14-reference/01-components/06-taoskeeper.md b/docs/zh/14-reference/01-components/06-taoskeeper.md index 95b550405876..00b1f1ee51cf 100644 --- a/docs/zh/14-reference/01-components/06-taoskeeper.md +++ b/docs/zh/14-reference/01-components/06-taoskeeper.md @@ -70,8 +70,7 @@ taosKeeper 支持用 `taoskeeper -c ` 命令来指定配置 **下面是配置文件的示例:** ```toml -# The ID of the currently running instance of the component that generated the QID, -# default is 64. +# The ID of the currently running taoskeeper instance, default is 64. instanceId = 64 # Listening port, default is 6043. From fa3fba21fd264ea25e3c46d237c6fb42aca5b1ae Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 6 Nov 2024 21:06:43 +0800 Subject: [PATCH 670/695] doc: typos --- .../14-reference/03-taos-sql/10-function.md | 28 +++++++++---------- docs/zh/14-reference/03-taos-sql/14-stream.md | 5 +++- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/docs/zh/14-reference/03-taos-sql/10-function.md b/docs/zh/14-reference/03-taos-sql/10-function.md index dd58adfeed46..bbc6a0b81a1f 100644 --- a/docs/zh/14-reference/03-taos-sql/10-function.md +++ b/docs/zh/14-reference/03-taos-sql/10-function.md @@ -1569,7 +1569,7 @@ COUNT({* | expr}) ELAPSED(ts_primary_key [, time_unit]) ``` -**功能说明**:elapsed函数表达了统计周期内连续的时间长度,和twa函数配合使用可以计算统计曲线下的面积。在通过INTERVAL子句指定窗口的情况下,统计在给定时间范围内的每个窗口内有数据覆盖的时间范围;如果没有INTERVAL子句,则返回整个给定时间范围内的有数据覆盖的时间范围。注意,ELAPSED返回的并不是时间范围的绝对值,而是绝对值除以time_unit所得到的单位个数。流计算仅在FORCE_WINDOW_CLOSE模式下支持该函数。 +**功能说明**:elapsed 函数表达了统计周期内连续的时间长度,和 twa 函数配合使用可以计算统计曲线下的面积。在通过 INTERVAL 子句指定窗口的情况下,统计在给定时间范围内的每个窗口内有数据覆盖的时间范围;如果没有 INTERVAL 子句,则返回整个给定时间范围内的有数据覆盖的时间范围。注意,ELAPSED 返回的并不是时间范围的绝对值,而是绝对值除以 time_unit 所得到的单位个数。流计算仅在 FORCE_WINDOW_CLOSE 模式下支持该函数。 **返回结果类型**:DOUBLE。 @@ -1578,15 +1578,15 @@ ELAPSED(ts_primary_key [, time_unit]) **适用于**: 表,超级表,嵌套查询的外层查询 **说明**: -- ts_primary_key参数只能是表的第一列,即 TIMESTAMP 类型的主键列。 -- 按time_unit参数指定的时间单位返回,最小是数据库的时间分辨率。time_unit 参数未指定时,以数据库的时间分辨率为时间单位。支持的时间单位 time_unit 如下: +- ts_primary_key 参数只能是表的第一列,即 TIMESTAMP 类型的主键列。 +- 按 time_unit 参数指定的时间单位返回,最小是数据库的时间分辨率。time_unit 参数未指定时,以数据库的时间分辨率为时间单位。支持的时间单位 time_unit 如下: 1b(纳秒), 1u(微秒),1a(毫秒),1s(秒),1m(分),1h(小时),1d(天), 1w(周)。 -- 可以和interval组合使用,返回每个时间窗口的时间戳差值。需要特别注意的是,除第一个时间窗口和最后一个时间窗口外,中间窗口的时间戳差值均为窗口长度。 -- order by asc/desc不影响差值的计算结果。 -- 对于超级表,需要和group by tbname子句组合使用,不可以直接使用。 -- 对于普通表,不支持和group by子句组合使用。 -- 对于嵌套查询,仅当内层查询会输出隐式时间戳列时有效。例如select elapsed(ts) from (select diff(value) from sub1)语句,diff函数会让内层查询输出隐式时间戳列,此为主键列,可以用于elapsed函数的第一个参数。相反,例如select elapsed(ts) from (select * from sub1) 语句,ts列输出到外层时已经没有了主键列的含义,无法使用elapsed函数。此外,elapsed函数作为一个与时间线强依赖的函数,形如select elapsed(ts) from (select diff(value) from st group by tbname)尽管会返回一条计算结果,但并无实际意义,这种用法后续也将被限制。 -- 不支持与leastsquares、diff、derivative、top、bottom、last_row、interp等函数混合使用。 +- 可以和 interval 组合使用,返回每个时间窗口的时间戳差值。需要特别注意的是,除第一个时间窗口和最后一个时间窗口外,中间窗口的时间戳差值均为窗口长度。 +- order by asc/desc 不影响差值的计算结果。 +- 对于超级表,需要和 group by tbname 子句组合使用,不可以直接使用。 +- 对于普通表,不支持和 group by 子句组合使用。 +- 对于嵌套查询,仅当内层查询会输出隐式时间戳列时有效。例如 select elapsed(ts) from (select diff(value) from sub1) 语句,diff 函数会让内层查询输出隐式时间戳列,此为主键列,可以用于 elapsed 函数的第一个参数。相反,例如 select elapsed(ts) from (select * from sub1) 语句,ts 列输出到外层时已经没有了主键列的含义,无法使用 elapsed 函数。此外,elapsed 函数作为一个与时间线强依赖的函数,形如 select elapsed(ts) from (select diff(value) from st group by tbname)尽 管会返回一条计算结果,但并无实际意义,这种用法后续也将被限制。 +- 不支持与 leastsquares、diff、derivative、top、bottom、last_row、interp 等函数混合使用。 ### LEASTSQUARES @@ -1829,14 +1829,14 @@ ignore_null_values: { - INTERP 用于在指定时间断面获取指定列的记录值,如果该时间断面不存在符合条件的行数据,那么会根据 FILL 参数的设定进行插值。 - INTERP 的输入数据为指定列的数据,可以通过条件语句(where 子句)来对原始列数据进行过滤,如果没有指定过滤条件则输入为全部数据。 -- INTERP SQL查询需要同时与 RANGE,EVERY 和 FILL 关键字一起使用;流计算不能使用RANGE,需要EVERY 和 FILL 关键字一起使用。 -- INTERP 的输出时间范围根据 RANGE(timestamp1, timestamp2)字段来指定,需满足 timestamp1 \<= timestamp2。其中 timestamp1 为输出时间范围的起始值,即如果 timestamp1 时刻符合插值条件则 timestamp1 为输出的第一条记录,timestamp2 为输出时间范围的结束值,即输出的最后一条记录的 timestamp 不能大于 timestamp2。 +- INTERP SQL 查询需要同时与 RANGE,EVERY 和 FILL 关键字一起使用;流计算不能使用 RANGE,需要 EVERY 和 FILL 关键字一起使用。 +- INTERP 的输出时间范围根据 RANGE(timestamp1, timestamp2) 字段来指定,需满足 timestamp1 \<= timestamp2。其中 timestamp1 为输出时间范围的起始值,即如果 timestamp1 时刻符合插值条件则 timestamp1 为输出的第一条记录,timestamp2 为输出时间范围的结束值,即输出的最后一条记录的 timestamp 不能大于 timestamp2。 - INTERP 根据 EVERY(time_unit) 字段来确定输出时间范围内的结果条数,即从 timestamp1 开始每隔固定长度的时间(time_unit 值)进行插值,time_unit 可取值时间单位:1a(毫秒),1s(秒),1m(分),1h(小时),1d(天),1w(周)。例如 EVERY(500a) 将对于指定数据每500毫秒间隔进行一次插值. - INTERP 根据 FILL 字段来决定在每个符合输出条件的时刻如何进行插值。关于 FILL 子句如何使用请参考 [FILL 子句](../distinguished/#fill-子句) - INTERP 可以在 RANGE 字段中只指定唯一的时间戳对单个时间点进行插值,在这种情况下,EVERY 字段可以省略。例如:SELECT INTERP(col) FROM tb RANGE('2023-01-01 00:00:00') FILL(linear). - INTERP 作用于超级表时, 会将该超级表下的所有子表数据按照主键列排序后进行插值计算,也可以搭配 PARTITION BY tbname 使用,将结果强制规约到单个时间线。 -- INTERP 可以与伪列 _irowts 一起使用,返回插值点所对应的时间戳(3.0.2.0版本以后支持)。 -- INTERP 可以与伪列 _isfilled 一起使用,显示返回结果是否为原始记录或插值算法产生的数据(3.0.3.0版本以后支持)。 +- INTERP 可以与伪列 _irowts 一起使用,返回插值点所对应的时间戳(3.0.2.0 版本以后支持)。 +- INTERP 可以与伪列 _isfilled 一起使用,显示返回结果是否为原始记录或插值算法产生的数据(3.0.3.0 版本以后支持)。 - INTERP 对于带复合主键的表的查询,若存在相同时间戳的数据,则只有对应的复合主键最小的数据参与运算。 ### LAST @@ -2180,7 +2180,7 @@ STATEDURATION(expr, oper, val, unit) TWA(expr) ``` -**功能说明**:时间加权平均函数。统计表中某列在一段时间内的时间加权平均。对于存在复合主键的表的查询,若时间戳相同的数据存在多条,则只有对应的复合主键最小的数据参与运算。流计算仅在FORCE_WINDOW_CLOSE模式下支持该函数。 +**功能说明**:时间加权平均函数。统计表中某列在一段时间内的时间加权平均。对于存在复合主键的表的查询,若时间戳相同的数据存在多条,则只有对应的复合主键最小的数据参与运算。流计算仅在 FORCE_WINDOW_CLOSE 模式下支持该函数。 **返回数据类型**:DOUBLE。 diff --git a/docs/zh/14-reference/03-taos-sql/14-stream.md b/docs/zh/14-reference/03-taos-sql/14-stream.md index 25a11ecdcb54..0470ebf630b7 100644 --- a/docs/zh/14-reference/03-taos-sql/14-stream.md +++ b/docs/zh/14-reference/03-taos-sql/14-stream.md @@ -150,7 +150,7 @@ SELECT * from information_schema.`ins_streams`; 2. WINDOW_CLOSE:窗口关闭时触发(窗口关闭由事件时间决定,可配合 watermark 使用) 3. MAX_DELAY time:若窗口关闭,则触发计算。若窗口未关闭,且未关闭时长超过 max delay 指定的时间,则触发计算。 -4. FORCE_WINDOW_CLOSE:以操作系统当前时间为准,只计算当前关闭窗口的结果,并推送出去。窗口只会在被关闭的时刻计算一次,后续不会再重复计算。该模式当前只支持 INTERVAL 窗口(不支持滑动);FILL_HISTORY必须为 0,IGNORE EXPIRED 必须为 1,IGNORE UPDATE 必须为 1;FILL 只支持PREV 、NULL、 NONE、VALUE。 +4. FORCE_WINDOW_CLOSE:以操作系统当前时间为准,只计算当前关闭窗口的结果,并推送出去。窗口只会在被关闭的时刻计算一次,后续不会再重复计算。该模式当前只支持 INTERVAL 窗口(不支持滑动);FILL_HISTORY 必须为 0,IGNORE EXPIRED 必须为 1,IGNORE UPDATE 必须为 1;FILL 只支持 PREV 、NULL、NONE、VALUE。 由于窗口关闭是由事件时间决定的,如事件流中断、或持续延迟,则事件时间无法更新,可能导致无法得到最新的计算结果。 @@ -249,8 +249,11 @@ T = 最新事件时间 - DELETE_MARK - [percentile](../function/#percentile) - [top](../function/#top) - [bottom](../function/#bottom) +- [elapsed](../function/#elapsed) +- [interp](../function/#interp) - [derivative](../function/#derivative) - [irate](../function/#irate) +- [twa](../function/#twa) - [histogram](../function/#histogram) - [diff](../function/#diff) - [statecount](../function/#statecount) From 25775cc14a9bc61daf463465b0564d006fedcec3 Mon Sep 17 00:00:00 2001 From: qevolg <2227465945@qq.com> Date: Thu, 7 Nov 2024 09:56:06 +0800 Subject: [PATCH 671/695] fix(keeper): upgrading taoskeeper deps --- tools/keeper/go.mod | 31 ++++++++++---------- tools/keeper/go.sum | 71 +++++++++++++++++++++++++-------------------- 2 files changed, 55 insertions(+), 47 deletions(-) diff --git a/tools/keeper/go.mod b/tools/keeper/go.mod index f520ceb774a2..f8edf2709b4f 100644 --- a/tools/keeper/go.mod +++ b/tools/keeper/go.mod @@ -21,38 +21,39 @@ require ( require ( github.com/beorn7/perks v1.0.1 // indirect - github.com/bytedance/sonic v1.9.1 // indirect + github.com/bytedance/sonic v1.11.2 // indirect github.com/cespare/xxhash/v2 v2.1.2 // indirect - github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect + github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirect + github.com/chenzhuoyu/iasm v0.9.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/fsnotify/fsnotify v1.5.4 // indirect - github.com/gabriel-vasile/mimetype v1.4.2 // indirect - github.com/gin-contrib/cors v1.3.1 // indirect + github.com/gabriel-vasile/mimetype v1.4.3 // indirect + github.com/gin-contrib/cors v1.6.0 // indirect github.com/gin-contrib/gzip v0.0.3 // indirect github.com/gin-contrib/pprof v1.3.0 // indirect github.com/gin-contrib/sse v0.1.0 // indirect github.com/go-ole/go-ole v1.2.6 // indirect github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect - github.com/go-playground/validator/v10 v10.14.0 // indirect + github.com/go-playground/validator/v10 v10.19.0 // indirect github.com/goccy/go-json v0.10.2 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/google/uuid v1.3.0 // indirect github.com/gorilla/websocket v1.5.0 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect - github.com/klauspost/cpuid/v2 v2.2.4 // indirect - github.com/leodido/go-urn v1.2.4 // indirect + github.com/klauspost/cpuid/v2 v2.2.7 // indirect + github.com/leodido/go-urn v1.4.0 // indirect github.com/lestrrat-go/strftime v1.0.6 // indirect github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect github.com/magiconair/properties v1.8.6 // indirect - github.com/mattn/go-isatty v0.0.19 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/pelletier/go-toml v1.9.5 // indirect - github.com/pelletier/go-toml/v2 v2.0.8 // indirect + github.com/pelletier/go-toml/v2 v2.1.1 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect @@ -66,14 +67,14 @@ require ( github.com/tklauser/go-sysconf v0.3.10 // indirect github.com/tklauser/numcpus v0.4.0 // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect - github.com/ugorji/go/codec v1.2.11 // indirect + github.com/ugorji/go/codec v1.2.12 // indirect github.com/yusufpapurcu/wmi v1.2.2 // indirect - golang.org/x/arch v0.3.0 // indirect - golang.org/x/crypto v0.9.0 // indirect - golang.org/x/net v0.10.0 // indirect + golang.org/x/arch v0.7.0 // indirect + golang.org/x/crypto v0.21.0 // indirect + golang.org/x/net v0.23.0 // indirect golang.org/x/sys v0.24.0 // indirect - golang.org/x/text v0.9.0 // indirect - google.golang.org/protobuf v1.30.0 // indirect + golang.org/x/text v0.14.0 // indirect + google.golang.org/protobuf v1.33.0 // indirect gopkg.in/ini.v1 v1.66.4 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/tools/keeper/go.sum b/tools/keeper/go.sum index 9c7721c4d71c..8f6e9bd13afd 100644 --- a/tools/keeper/go.sum +++ b/tools/keeper/go.sum @@ -52,15 +52,20 @@ github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+Ce github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM= -github.com/bytedance/sonic v1.9.1 h1:6iJ6NqdoxCDr6mbY8h18oSO+cShGSMRGCEo7F2h0x8s= -github.com/bytedance/sonic v1.9.1/go.mod h1:i736AoUSYt75HyZLoJW9ERYxcy6eaN6h4BZXU064P/U= +github.com/bytedance/sonic v1.10.0-rc/go.mod h1:ElCzW+ufi8qKqNW0FY314xriJhyJhuoJ3gFZdAHF7NM= +github.com/bytedance/sonic v1.11.2 h1:ywfwo0a/3j9HR8wsYGWsIWl2mvRsI950HyoxiBERw5A= +github.com/bytedance/sonic v1.11.2/go.mod h1:iZcSUejdk5aukTND/Eu/ivjQuEL0Cu9/rf50Hi0u/g4= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE= github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/chenzhuoyu/base64x v0.0.0-20211019084208-fb5309c8db06/go.mod h1:DH46F32mSOjUmXrMHnKwZdA8wcEefY7UVqBKYGjpdQY= -github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 h1:qSGYFH7+jGhDF8vLC+iwCD4WpbV1EBDSzWkJODFLams= github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311/go.mod h1:b583jCggY9gE99b6G5LEC39OIiVsWj+R97kbl5odCEk= +github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d h1:77cEq6EriyTZ0g/qfRdp61a3Uu/AWrgIq2s0ClJV1g0= +github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d/go.mod h1:8EPpVsBuRksnlj1mLy4AWzRNQYxauNi62uWcE3to6eA= +github.com/chenzhuoyu/iasm v0.9.0/go.mod h1:Xjy2NpN3h7aUqeqM+woSuuvxmIe6+DDsiNLIrkAmYog= +github.com/chenzhuoyu/iasm v0.9.1 h1:tUHQJXo3NhBqw6s33wkGn9SP3bvrWLdlVIJ3hQBL7P0= +github.com/chenzhuoyu/iasm v0.9.1/go.mod h1:Xjy2NpN3h7aUqeqM+woSuuvxmIe6+DDsiNLIrkAmYog= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= @@ -88,10 +93,11 @@ github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE= github.com/fsnotify/fsnotify v1.5.4 h1:jRbGcIw6P2Meqdwuo0H1p6JVLbL5DHKAKlYndzMwVZI= github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU= -github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q7OhCmWKU= -github.com/gabriel-vasile/mimetype v1.4.2/go.mod h1:zApsH/mKG4w07erKIaJPFiX0Tsq9BFQgN3qGY5GnNgA= -github.com/gin-contrib/cors v1.3.1 h1:doAsuITavI4IOcd0Y19U4B+O0dNWihRyX//nn4sEmgA= +github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0= +github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk= github.com/gin-contrib/cors v1.3.1/go.mod h1:jjEJ4268OPZUcU7k9Pm653S7lXUGcqMADzFA61xsmDk= +github.com/gin-contrib/cors v1.6.0 h1:0Z7D/bVhE6ja07lI8CTjTonp6SB07o8bNuFyRbsBUQg= +github.com/gin-contrib/cors v1.6.0/go.mod h1:cI+h6iOAyxKRtUtC6iF/Si1KSFvGm/gK+kshxlCi8ro= github.com/gin-contrib/gzip v0.0.3 h1:etUaeesHhEORpZMp18zoOhepboiWnFtXrBZxszWUn4k= github.com/gin-contrib/gzip v0.0.3/go.mod h1:YxxswVZIqOvcHEQpsSn+QF5guQtO1dCfy0shBPy4jFc= github.com/gin-contrib/pprof v1.3.0 h1:G9eK6HnbkSqDZBYbzG4wrjCsA4e+cvYAHUZw6W+W9K0= @@ -127,8 +133,8 @@ github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJn github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI= github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4= -github.com/go-playground/validator/v10 v10.14.0 h1:vgvQWe3XCz3gIeFDm/HnTIbj6UGmg/+t63MyGU2n5js= -github.com/go-playground/validator/v10 v10.14.0/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU= +github.com/go-playground/validator/v10 v10.19.0 h1:ol+5Fu+cSq9JD7SoSqe04GMI92cbn0+wvQ3bZ8b/AU4= +github.com/go-playground/validator/v10 v10.19.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= @@ -235,8 +241,9 @@ github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+o github.com/klauspost/compress v1.12.2/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= github.com/klauspost/compress v1.13.4/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= -github.com/klauspost/cpuid/v2 v2.2.4 h1:acbojRNwl3o09bUq+yDCtZFc1aiwaAAxtcn8YkZXnvk= -github.com/klauspost/cpuid/v2 v2.2.4/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY= +github.com/klauspost/cpuid/v2 v2.2.7 h1:ZWSB3igEs+d0qvnxR/ZBzXVmxkgt8DdzP6m9pfuVLDM= +github.com/klauspost/cpuid/v2 v2.2.7/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= +github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= @@ -250,8 +257,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/leodido/go-urn v1.1.0/go.mod h1:+cyI34gQWZcE1eQU7NVgKkkzdXDQHr1dBMtdAPozLkw= github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= -github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q= -github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4= +github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ= +github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= github.com/lestrrat-go/envload v0.0.0-20180220234015-a3eb8ddeffcc h1:RKf14vYWi2ttpEmkA4aQ3j4u9dStX2t4M8UM6qqNsG8= github.com/lestrrat-go/envload v0.0.0-20180220234015-a3eb8ddeffcc/go.mod h1:kopuH9ugFRkIXf3YoqHKyrJ9YfUFsckUU9S7B+XP+is= github.com/lestrrat-go/strftime v1.0.6 h1:CFGsDEt1pOpFNU+TJB0nhz9jl+K0hZSLE205AhTIGQQ= @@ -262,8 +269,8 @@ github.com/magiconair/properties v1.8.6 h1:5ibWZ6iY0NctNGWo87LalDlEZ6R41TqbbDamh github.com/magiconair/properties v1.8.6/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= -github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 h1:I0XW9+e1XWDxdcEniV4rQAIOPUGDq67JSCiRCgGCZLI= github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= @@ -290,8 +297,8 @@ github.com/panjf2000/ants/v2 v2.4.6 h1:drmj9mcygn2gawZ155dRbo+NfXEfAssjZNU1qoIb4 github.com/panjf2000/ants/v2 v2.4.6/go.mod h1:f6F0NZVFsGCp5A7QW/Zj/m92atWwOkY0OIhFxRNFr4A= github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= -github.com/pelletier/go-toml/v2 v2.0.8 h1:0ctb6s9mE31h0/lhu+J6OPmVeDxJn+kYnJc2jZR9tGQ= -github.com/pelletier/go-toml/v2 v2.0.8/go.mod h1:vuYfssBdrU2XDZ9bYydBu6t+6a6PYNcZljzZR9VXg+4= +github.com/pelletier/go-toml/v2 v2.1.1 h1:LWAJwfNvjQZCFIDKWYQaM62NcYeYViCmWIwmOStowAI= +github.com/pelletier/go-toml/v2 v2.1.1/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= github.com/pierrec/lz4 v2.6.0+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -330,7 +337,7 @@ github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1 github.com/rcrowley/go-metrics v0.0.0-20190826022208-cac0b30c2563/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k= +github.com/rogpeppe/go-internal v1.8.0 h1:FCbCCtXNOY3UtUuHUYaghJg4y7Fd14rXifAYUAtL9R8= github.com/shirou/gopsutil/v3 v3.22.4 h1:srAQaiX6jX/cYL6q29aE0m8lOskT9CurZ9N61YR3yoI= github.com/shirou/gopsutil/v3 v3.22.4/go.mod h1:D01hZJ4pVHPpCTZ3m3T2+wDF2YAGfd+H4ifUguaQzHM= github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= @@ -363,8 +370,7 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.3.0 h1:mjC+YW8QpAdXibNi+vNWgzmgBH4+5l5dCXv8cNysBLI= @@ -387,8 +393,8 @@ github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= -github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4dU= -github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= +github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE= +github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= github.com/xdg/scram v1.0.3/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I= github.com/xdg/stringprep v1.0.3/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -404,8 +410,8 @@ go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= -golang.org/x/arch v0.3.0 h1:02VY4/ZcO/gBOH6PUaoiptASxtXU10jazRCP865E97k= -golang.org/x/arch v0.3.0/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= +golang.org/x/arch v0.7.0 h1:pskyeJh/3AmoQ8CPE95vxHLqp1G1GfGNXTmcl9NEKTc= +golang.org/x/arch v0.7.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= @@ -418,8 +424,8 @@ golang.org/x/crypto v0.0.0-20210314154223-e6e6c4f2bb5b/go.mod h1:T9bdIzuCu7OtxOm golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g= -golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= +golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= +golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -489,8 +495,8 @@ golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= -golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= +golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -565,7 +571,7 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= @@ -577,8 +583,8 @@ golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= -golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -725,8 +731,8 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= -google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -758,6 +764,7 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= From 5cc02a774f685822eced9d50a9e1761001cc201d Mon Sep 17 00:00:00 2001 From: chenhaoran Date: Thu, 7 Nov 2024 11:08:54 +0800 Subject: [PATCH 672/695] test: add smoke test scripts --- .gitignore | 2 +- packaging/smoke_test/conftest.py | 115 ++++++ packaging/smoke_test/debRpmAutoInstall.sh | 15 + packaging/smoke_test/getAndRunInstaller.bat | 57 +++ packaging/smoke_test/getAndRunInstaller.sh | 325 +++++++++++++++ packaging/smoke_test/lib.py | 12 + packaging/smoke_test/main.py | 21 + packaging/smoke_test/pytest_require.txt | 16 + packaging/smoke_test/runCases.bat | 11 + packaging/smoke_test/runCases.sh | 29 ++ packaging/smoke_test/smokeTestClient.py | 251 ++++++++++++ packaging/smoke_test/smokeTestJenkinsFile | 380 ++++++++++++++++++ packaging/smoke_test/start3NodesServer.sh | 67 +++ packaging/smoke_test/test_client.py | 137 +++++++ packaging/smoke_test/test_server.py | 238 +++++++++++ packaging/smoke_test/test_server_unix_case | 10 + packaging/smoke_test/test_server_windows_case | 2 + .../smoke_test/versionCheckAndUninstall.py | 260 ++++++++++++ .../versionCheckAndUninstallforPytest.py | 137 +++++++ tests/system-test/test.py | 5 +- 20 files changed, 2088 insertions(+), 2 deletions(-) create mode 100644 packaging/smoke_test/conftest.py create mode 100755 packaging/smoke_test/debRpmAutoInstall.sh create mode 100644 packaging/smoke_test/getAndRunInstaller.bat create mode 100755 packaging/smoke_test/getAndRunInstaller.sh create mode 100644 packaging/smoke_test/lib.py create mode 100644 packaging/smoke_test/main.py create mode 100644 packaging/smoke_test/pytest_require.txt create mode 100644 packaging/smoke_test/runCases.bat create mode 100644 packaging/smoke_test/runCases.sh create mode 100644 packaging/smoke_test/smokeTestClient.py create mode 100644 packaging/smoke_test/smokeTestJenkinsFile create mode 100644 packaging/smoke_test/start3NodesServer.sh create mode 100644 packaging/smoke_test/test_client.py create mode 100644 packaging/smoke_test/test_server.py create mode 100644 packaging/smoke_test/test_server_unix_case create mode 100644 packaging/smoke_test/test_server_windows_case create mode 100644 packaging/smoke_test/versionCheckAndUninstall.py create mode 100644 packaging/smoke_test/versionCheckAndUninstallforPytest.py diff --git a/.gitignore b/.gitignore index d684262f9dda..7f2382db8707 100644 --- a/.gitignore +++ b/.gitignore @@ -161,4 +161,4 @@ version.h geos_c.h source/libs/parser/src/sql.c include/common/ttokenauto.h - +!packaging/smoke_test/pytest_require.txt diff --git a/packaging/smoke_test/conftest.py b/packaging/smoke_test/conftest.py new file mode 100644 index 000000000000..a5f6ebbbe96a --- /dev/null +++ b/packaging/smoke_test/conftest.py @@ -0,0 +1,115 @@ +# conftest.py +import pytest + + +def pytest_addoption(parser): + parser.addoption( + "--verMode", default="enterprise", help="community or enterprise" + ) + parser.addoption( + "--tVersion", default="3.3.2.6", help="the version of taos" + ) + parser.addoption( + "--baseVersion", default="smoking", help="the path of nas" + ) + parser.addoption( + "--sourcePath", default="nas", help="only support nas currently" + ) + + + + +# Collect the setup and teardown of each test case and their std information +setup_stdout_info = {} +teardown_stdout_info = {} + + +@pytest.hookimpl(hookwrapper=True) +def pytest_runtest_makereport(item, call): + outcome = yield + rep = outcome.get_result() + + # Record the std of setup and teardown + if call.when == 'setup': + for i in rep.sections: + if i[0] == "Captured stdout setup": + if not setup_stdout_info: + setup_stdout_info[item.nodeid] = i[1] + elif call.when == 'teardown': + for i in rep.sections: + if i[0] == "Captured stdout teardown": + teardown_stdout_info[item.nodeid] = i[1] + + +# Insert setup and teardown's std in the summary section +def pytest_html_results_summary(prefix, summary, postfix): + if setup_stdout_info or teardown_stdout_info: + rows = [] + + # Insert setup stdout + if setup_stdout_info: + for nodeid, stdout in setup_stdout_info.items(): + html_content = ''' + + Setup: + + Show Setup + + + + '''.format(stdout.strip()) + + # 如果需要在 Python 脚本中生成 HTML,并使用 JavaScript 控制折叠内容的显示,可以这样做: + + html_script = ''' + + ''' + + # 输出完整的 HTML 代码 + final_html = html_content + html_script + rows.append(final_html) + rows.append("
      ") + # Insert teardown stdout + if teardown_stdout_info: + for nodeid, stdout in teardown_stdout_info.items(): + html_content = ''' + + Teardown: + + Show Teardown + + + + '''.format(stdout.strip()) + + # 如果需要在 Python 脚本中生成 HTML,并使用 JavaScript 控制折叠内容的显示,可以这样做: + + html_script = ''' + + ''' + + # 输出完整的 HTML 代码 + final_html = html_content + html_script + rows.append(final_html) + + prefix.extend(rows) diff --git a/packaging/smoke_test/debRpmAutoInstall.sh b/packaging/smoke_test/debRpmAutoInstall.sh new file mode 100755 index 000000000000..8fadffe4c68d --- /dev/null +++ b/packaging/smoke_test/debRpmAutoInstall.sh @@ -0,0 +1,15 @@ +#!/usr/bin/expect +set packageName [lindex $argv 0] +set packageSuffix [lindex $argv 1] +set timeout 30 +if { ${packageSuffix} == "deb" } { + spawn dpkg -i ${packageName} +} elseif { ${packageSuffix} == "rpm"} { + spawn rpm -ivh ${packageName} +} +expect "*one:" +send "\r" +expect "*skip:" +send "\r" + +expect eof diff --git a/packaging/smoke_test/getAndRunInstaller.bat b/packaging/smoke_test/getAndRunInstaller.bat new file mode 100644 index 000000000000..08b04a027197 --- /dev/null +++ b/packaging/smoke_test/getAndRunInstaller.bat @@ -0,0 +1,57 @@ +set baseVersion=%1% +set version=%2% +set verMode=%3% +set sType=%4% +echo %fileType% +rem stop services +if EXIST C:\TDengine ( + if EXIST C:\TDengine\stop-all.bat ( + call C:\TDengine\stop-all.bat /silent + echo "***************Stop taos services***************" + ) + if exist C:\TDengine\unins000.exe ( + call C:\TDengine\unins000.exe /silent + echo "***************uninstall TDengine***************" + ) + rd /S /q C:\TDengine +) +if EXIST C:\ProDB ( + if EXIST C:\ProDB\stop-all.bat ( + call C:\ProDB\stop-all.bat /silent + echo "***************Stop taos services***************" + ) + if exist C:\ProDB\unins000.exe ( + call C:\ProDB\unins000.exe /silent + echo "***************uninstall TDengine***************" + ) + rd /S /q C:\ProDB +) +if "%verMode%"=="enterprise" ( + if "%sType%"=="client" ( + set fileType=enterprise-client + ) else ( + set fileType=enterprise + ) +) else ( + set fileType=%sType% +) + +if "%baseVersion%"=="ProDB" ( + echo %fileType% + set installer=ProDB-%fileType%-%version%-Windows-x64.exe +) else ( + echo %fileType% + set installer=TDengine-%fileType%-%version%-Windows-x64.exe +) + +if "%baseVersion%"=="ProDB" ( + echo %installer% + scp root@192.168.1.213:/nas/OEM/ProDB/v%version%/%installer% C:\workspace +) else ( + echo %installer% + scp root@192.168.1.213:/nas/TDengine/%baseVersion%/v%version%/%verMode%/%installer% C:\workspace +) + +echo "***************Finish installer transfer!***************" +C:\workspace\%installer% /silent +echo "***************Finish install!***************" \ No newline at end of file diff --git a/packaging/smoke_test/getAndRunInstaller.sh b/packaging/smoke_test/getAndRunInstaller.sh new file mode 100755 index 000000000000..7defe6394c68 --- /dev/null +++ b/packaging/smoke_test/getAndRunInstaller.sh @@ -0,0 +1,325 @@ +#!/bin/sh + + +function usage() { + echo "$0" + echo -e "\t -f test file type,server/client/tools/" + echo -e "\t -m pacakage version Type,community/enterprise" + echo -e "\t -l package type,lite or not" + echo -e "\t -c operation type,x64/arm64" + echo -e "\t -v pacakage version,3.0.1.7" + echo -e "\t -o pacakage version,3.0.1.7" + echo -e "\t -s source Path,web/nas" + echo -e "\t -t package Type,tar/rpm/deb" + echo -e "\t -h help" +} + + +#parameter +scriptDir=$(dirname $(readlink -f $0)) +version="3.0.1.7" +originversion="smoking" +testFile="server" +verMode="communtity" +sourcePath="nas" +cpuType="x64" +lite="true" +packageType="tar" +subFile="package.tar.gz" +while getopts "m:c:f:l:s:o:t:v:h" opt; do + case $opt in + m) + verMode=$OPTARG + ;; + v) + version=$OPTARG + ;; + f) + testFile=$OPTARG + ;; + l) + lite=$OPTARG + ;; + s) + sourcePath=$OPTARG + ;; + o) + originversion=$OPTARG + ;; + c) + cpuType=$OPTARG + ;; + t) + packageType=$OPTARG + ;; + h) + usage + exit 0 + ;; + ?) + echo "Invalid option: -$OPTARG" + usage + exit 0 + ;; + esac +done + +systemType=`uname` +if [ ${systemType} == "Darwin" ]; then + platform="macOS" +else + platform="Linux" +fi + +echo "testFile:${testFile},verMode:${verMode},lite:${lite},cpuType:${cpuType},packageType:${packageType},version-${version},originversion:${originversion},sourcePath:${sourcePath}" +# Color setting +RED='\033[41;30m' +GREEN='\033[1;32m' +YELLOW='\033[1;33m' +BLUE='\033[1;34m' +GREEN_DARK='\033[0;32m' +YELLOW_DARK='\033[0;33m' +BLUE_DARK='\033[0;34m' +GREEN_UNDERLINE='\033[4;32m' +NC='\033[0m' +if [ "${originversion}" = "ProDB" ]; then + TDengine="ProDB" +else + TDengine="TDengine" +fi +if [[ ${verMode} = "enterprise" ]];then + prePackage="${TDengine}-enterprise" + if [[ ${testFile} = "client" ]];then + prePackage="${TDengine}-enterprise-${testFile}" + fi +elif [ ${verMode} = "community" ];then + prePackage="${TDengine}-${testFile}" +fi +if [ ${lite} = "true" ];then + packageLite="-Lite" +elif [ ${lite} = "false" ];then + packageLite="" +fi +if [[ "$packageType" = "tar" ]] ;then + packageType="tar.gz" +fi + +tdPath="${prePackage}-${version}" + +packageName="${tdPath}-${platform}-${cpuType}${packageLite}.${packageType}" + +if [ "$testFile" == "server" ] ;then + installCmd="install.sh" +elif [ ${testFile} = "client" ];then + installCmd="install_client.sh" +fi + +echo "tdPath:${tdPath},packageName:${packageName}}" +cmdInstall() { +command=$1 +if command -v ${command} ;then + echoColor YD "${command} is already installed" +else + if command -v apt ;then + apt-get install ${command} -y + elif command -v yum ;then + yum -y install ${command} + echoColor YD "you should install ${command} manually" + fi +fi +} + +echoColor() { + color=$1 + command=$2 + if [ ${color} = 'Y' ];then + echo -e "${YELLOW}${command}${NC}" + elif [ ${color} = 'YD' ];then + echo -e "${YELLOW_DARK}${command}${NC}" + elif [ ${color} = 'R' ];then + echo -e "${RED}${command}${NC}" + elif [ ${color} = 'G' ];then + echo -e "${GREEN}${command}${NC}\r\n" + elif [ ${color} = 'B' ];then + echo -e "${BLUE}${command}${NC}" + elif [ ${color} = 'BD' ];then + echo -e "${BLUE_DARK}${command}${NC}" + fi +} + +wgetFile() { + + file=$1 + versionPath=$2 + sourceP=$3 + nasServerIP="192.168.1.213" + if [ "${originversion}" = "ProDB" ]; then + packagePath="/nas/OEM/ProDB/v${versionPath}" + else + packagePath="/nas/TDengine/${originversion}/v${versionPath}/${verMode}" + fi + if [ -f ${file} ];then + echoColor YD "${file} already exists ,it will delete it and download it again " + # rm -rf ${file} + fi + + if [[ ${sourceP} = 'web' ]];then + echoColor BD "====download====:wget https://www.taosdata.com/assets-download/3.0/${file}" + wget https://www.taosdata.com/assets-download/3.0/${file} + elif [[ ${sourceP} = 'nas' ]];then + echoColor BD "====download====:scp root@${nasServerIP}:${packagePath}/${file} ." + scp root@${nasServerIP}:${packagePath}/${file} . + fi +} + +function newPath { + +buildPath=$1 + +if [ ! -d ${buildPath} ] ;then + echoColor BD "mkdir -p ${buildPath}" + mkdir -p ${buildPath} +else + echoColor YD "${buildPath} already exists" +fi + +} + +echoColor G "===== install basesoft =====" +cmdInstall tree +cmdInstall wget +cmdInstall expect + +echoColor G "===== Uninstall all components of TDeingne =====" + +if command -v rmtaos ;then + echoColor YD "uninstall all components of TDeingne:rmtaos" + rmtaos +else + echoColor YD "os doesn't include TDengine" +fi + +if [[ ${packageName} =~ "server" ]] ;then + echoColor BD " pkill -9 taosd " + pkill -9 taosd +fi + +if command -v rmprodb ;then + echoColor YD "uninstall all components of TDeingne:rmprodb" + rmprodb +else + echoColor YD "os doesn't include TDengine" +fi + +if [[ ${packageName} =~ "server" ]] ;then + echoColor BD " pkill -9 prodbd " + pkill -9 prodbd +fi + +echoColor G "===== new workroom path =====" +installPath="/usr/local/src/packageTest" + +if [ ${systemType} == "Darwin" ]; then + installPath="${WORK_DIR}/packageTest" +fi + +newPath ${installPath} + +#if [ -d ${installPath}/${tdPath} ] ;then +# echoColor BD "rm -rf ${installPath}/${tdPath}/*" +# rm -rf ${installPath}/${tdPath}/* +#fi + +echoColor G "===== download installPackage =====" +cd ${installPath} && wgetFile ${packageName} ${version} ${sourcePath} +#cd ${oriInstallPath} && wgetFile ${originPackageName} ${originversion} ${sourcePath} + + +cd ${installPath} +cp -r ${scriptDir}/debRpmAutoInstall.sh . + +packageSuffix=$(echo ${packageName} | awk -F '.' '{print $NF}') + + +if [ ! -f debRpmAutoInstall.sh ];then + echo '#!/usr/bin/expect ' > debRpmAutoInstall.sh + echo 'set packageName [lindex $argv 0]' >> debRpmAutoInstall.sh + echo 'set packageSuffix [lindex $argv 1]' >> debRpmAutoInstall.sh + echo 'set timeout 30 ' >> debRpmAutoInstall.sh + echo 'if { ${packageSuffix} == "deb" } {' >> debRpmAutoInstall.sh + echo ' spawn dpkg -i ${packageName} ' >> debRpmAutoInstall.sh + echo '} elseif { ${packageSuffix} == "rpm"} {' >> debRpmAutoInstall.sh + echo ' spawn rpm -ivh ${packageName}' >> debRpmAutoInstall.sh + echo '}' >> debRpmAutoInstall.sh + echo 'expect "*one:"' >> debRpmAutoInstall.sh + echo 'send "\r"' >> debRpmAutoInstall.sh + echo 'expect "*skip:"' >> debRpmAutoInstall.sh + echo 'send "\r" ' >> debRpmAutoInstall.sh +fi + + +echoColor G "===== install Package =====" + +if [[ ${packageName} =~ "deb" ]];then + cd ${installPath} + dpkg -r taostools + dpkg -r tdengine + if [[ ${packageName} =~ "TDengine" ]];then + echoColor BD "./debRpmAutoInstall.sh ${packageName} ${packageSuffix}" && chmod 755 debRpmAutoInstall.sh && ./debRpmAutoInstall.sh ${packageName} ${packageSuffix} + else + echoColor BD "dpkg -i ${packageName}" && dpkg -i ${packageName} + fi +elif [[ ${packageName} =~ "rpm" ]];then + cd ${installPath} + sudo rpm -e tdengine + sudo rpm -e taostools + if [[ ${packageName} =~ "TDengine" ]];then + echoColor BD "./debRpmAutoInstall.sh ${packageName} ${packageSuffix}" && chmod 755 debRpmAutoInstall.sh && ./debRpmAutoInstall.sh ${packageName} ${packageSuffix} + else + echoColor BD "rpm -ivh ${packageName}" && rpm -ivh ${packageName} + fi +elif [[ ${packageName} =~ "tar" ]];then + echoColor G "===== check installPackage File of tar =====" + + cd ${installPath} + echoColor YD "unzip the new installation package" + echoColor BD "tar -xf ${packageName}" && tar -xf ${packageName} + + cd ${installPath}/${tdPath} && tree -I "driver" > ${installPath}/now_${version}_checkfile + + cd ${installPath} + diff ${installPath}/base_${originversion}_checkfile ${installPath}/now_${version}_checkfile > ${installPath}/diffFile.log + diffNumbers=`cat ${installPath}/diffFile.log |wc -l ` + + if [ ${diffNumbers} != 0 ];then + echoColor R "The number and names of files is different from the previous installation package" + diffLog=`cat ${installPath}/diffFile.log` + echoColor Y "${diffLog}" + exit -1 + else + echoColor G "The number and names of files are the same as previous installation packages" + rm -rf ${installPath}/diffFile.log + fi + echoColor YD "===== install Package of tar =====" + cd ${installPath}/${tdPath} + if [ ${testFile} = "server" ];then + echoColor BD "bash ${installCmd} -e no " + bash ${installCmd} -e no + else + echoColor BD "bash ${installCmd} " + bash ${installCmd} + fi +elif [[ ${packageName} =~ "pkg" ]];then + cd ${installPath} + sudo installer -pkg ${packageName} -target / + echoColor YD "===== install Package successfully! =====" +fi + +#cd ${installPath} +# +#rm -rf ${installPath}/${packageName} +#if [ ${platform} == "Linux" ]; then +# rm -rf ${installPath}/${tdPath}/ +#fi +echoColor YD "===== end of shell file =====" + diff --git a/packaging/smoke_test/lib.py b/packaging/smoke_test/lib.py new file mode 100644 index 000000000000..86c30bf8b121 --- /dev/null +++ b/packaging/smoke_test/lib.py @@ -0,0 +1,12 @@ + +import subprocess + + +def run_cmd(command): + print("CMD:", command) + result = subprocess.run(command, capture_output=True, text=True, shell=True) + print("STDOUT:", result.stdout) + print("STDERR:", result.stderr) + print("Return Code:", result.returncode) + #assert result.returncode == 0 + return result diff --git a/packaging/smoke_test/main.py b/packaging/smoke_test/main.py new file mode 100644 index 000000000000..cb7356f80e80 --- /dev/null +++ b/packaging/smoke_test/main.py @@ -0,0 +1,21 @@ +import pytest + +# python3 -m pytest test_server.py -v --html=/var/www/html/report.html --json-report --json-report-file="/var/www/html/report.json" --timeout=60 + +# pytest.main(["-s", "-v"]) +import pytest + +import subprocess + + +# define cmd function + + + + +def main(): + pytest.main(['--html=report.html']) + + +if __name__ == '__main__': + main() diff --git a/packaging/smoke_test/pytest_require.txt b/packaging/smoke_test/pytest_require.txt new file mode 100644 index 000000000000..eadbe92470dc --- /dev/null +++ b/packaging/smoke_test/pytest_require.txt @@ -0,0 +1,16 @@ +pytest-html +pytest-json-report +pytest-timeout +taospy +numpy +fabric2 +psutil +pandas +toml +distro +requests +pexpect +faker +pyopenssl +taos-ws-py +taospy \ No newline at end of file diff --git a/packaging/smoke_test/runCases.bat b/packaging/smoke_test/runCases.bat new file mode 100644 index 000000000000..922766785caf --- /dev/null +++ b/packaging/smoke_test/runCases.bat @@ -0,0 +1,11 @@ +rm -rf %WIN_TDENGINE_ROOT_DIR%\debug +mkdir %WIN_TDENGINE_ROOT_DIR%\debug +mkdir %WIN_TDENGINE_ROOT_DIR%\debug\build +mkdir %WIN_TDENGINE_ROOT_DIR%\debug\build\bin +xcopy C:\TDengine\taos*.exe %WIN_TDENGINE_ROOT_DIR%\debug\build\bin + +set case_out_file=%cd%\case.out + +cd %WIN_TDENGINE_ROOT_DIR%\tests\system-test +python3 .\test.py -f 0-others\taosShell.py +python3 .\test.py -f 6-cluster\5dnode3mnodeSep1VnodeStopDnodeModifyMeta.py -N 6 -M 3 \ No newline at end of file diff --git a/packaging/smoke_test/runCases.sh b/packaging/smoke_test/runCases.sh new file mode 100644 index 000000000000..4de7a7658bc4 --- /dev/null +++ b/packaging/smoke_test/runCases.sh @@ -0,0 +1,29 @@ +#!/bin/bash +ulimit -c unlimited + +rm -rf ${TDENGINE_ROOT_DIR}/debug +mkdir ${TDENGINE_ROOT_DIR}/debug +mkdir ${TDENGINE_ROOT_DIR}/debug/build +mkdir ${TDENGINE_ROOT_DIR}/debug/build/bin + +systemType=`uname` +if [ ${systemType} == "Darwin" ]; then + cp /usr/local/bin/taos* ${TDENGINE_ROOT_DIR}/debug/build/bin/ +else + cp /usr/bin/taos* ${TDENGINE_ROOT_DIR}/debug/build/bin/ +fi + +case_out_file=`pwd`/case.out +python3 -m pip install -r ${TDENGINE_ROOT_DIR}/tests/requirements.txt >> $case_out_file +python3 -m pip install taos-ws-py taospy >> $case_out_file + +cd ${TDENGINE_ROOT_DIR}/tests/army +python3 ./test.py -f query/query_basic.py -N 3 >> $case_out_file + +cd ${TDENGINE_ROOT_DIR}/tests/system-test +python3 ./test.py -f 1-insert/insert_column_value.py >> $case_out_file +python3 ./test.py -f 2-query/primary_ts_base_5.py >> $case_out_file +python3 ./test.py -f 2-query/case_when.py >> $case_out_file +python3 ./test.py -f 2-query/partition_limit_interval.py >> $case_out_file +python3 ./test.py -f 2-query/join.py >> $case_out_file +python3 ./test.py -f 2-query/fill.py >> $case_out_file diff --git a/packaging/smoke_test/smokeTestClient.py b/packaging/smoke_test/smokeTestClient.py new file mode 100644 index 000000000000..eee9667300fd --- /dev/null +++ b/packaging/smoke_test/smokeTestClient.py @@ -0,0 +1,251 @@ +#!/usr/bin/python +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### +# install pip +# pip install src/connector/python/ + +# -*- coding: utf-8 -*- +import sys, os +import re +import platform +import getopt +import subprocess +# from this import d +import time + +# input for server + +opts, args = getopt.gnu_getopt(sys.argv[1:], 'h:P:v:u', [ + 'host=', 'Port=', 'version=']) +serverHost = "" +serverPort = 0 +version = "" +uninstall = False +for key, value in opts: + if key in ['--help']: + print('A collection of test cases written using Python') + print('-h serverHost') + print('-P serverPort') + print('-v test client version') + print('-u test uninstall process, will uninstall TDengine') + sys.exit(0) + + if key in ['-h']: + serverHost = value + if key in ['-P']: + serverPort = int(value) + if key in ['-v']: + version = value + if key in ['-u']: + uninstall = True +if not serverHost: + print("Please input use -h to specify your server host.") + sys.exit(0) +if not version: + print("No version specified, will not run version check.") +if serverPort == 0: + serverPort = 6030 + print("No server port specified, use default 6030.") + + +system = platform.system() + +arch = platform.machine() + +databaseName = re.sub(r'[^a-zA-Z0-9]', '', subprocess.getoutput("hostname")).lower() +# install taospy +taospy_version = "" +if system == 'Windows': + taospy_version = subprocess.getoutput("pip3 show taospy|findstr Version") +else: + taospy_version = subprocess.getoutput("pip3 show taospy|grep Version| awk -F ':' '{print $2}' ") + +print("taospy version %s " % taospy_version) +if taospy_version == "": + subprocess.getoutput("pip3 install git+https://github.com/taosdata/taos-connector-python.git") + print("install taos python connector") +else: + subprocess.getoutput("pip3 install taospy") + +# prepare data by taosBenchmark +cmd = "taosBenchmark -y -a 3 -n 100 -t 100 -d %s -h %s -P %d &" % (databaseName, serverHost, serverPort) +process_out = subprocess.getoutput(cmd) +print(cmd) +#os.system("taosBenchmark -y -a 3 -n 100 -t 100 -d %s -h %s -P %d" % (databaseName, serverHost, serverPort)) +taosBenchmark_test_result = True +time.sleep(10) +import taos + +conn = taos.connect(host=serverHost, + user="root", + password="taosdata", + database=databaseName, + port=serverPort, + timezone="Asia/Shanghai") # default your host's timezone + +server_version = conn.server_info +print("server_version", server_version) +client_version = conn.client_info +print("client_version", client_version) # 3.0.0.0 + +# Execute a sql and get its result set. It's useful for SELECT statement +result: taos.TaosResult = conn.query("SELECT count(*) from meters") + +data = result.fetch_all() +print(data) +if data[0][0] !=10000: + print(" taosBenchmark work not as expected ") + print("!!!!!!!!!!!Test Result: taosBenchmark test failed! !!!!!!!!!!") + sys.exit(1) +#else: +# print("**********Test Result: taosBenchmark test passed **********") + + +# drop database of test +taos_test_result = False +print("drop database test") +print("run taos -s 'drop database %s;' -h %s -P %d" % (databaseName, serverHost, serverPort)) +taos_cmd_outpur = subprocess.getoutput('taos -s "drop database %s;" -h %s -P %d' % (databaseName, serverHost, serverPort)) +print(taos_cmd_outpur) +if ("Drop OK" in taos_cmd_outpur): + taos_test_result = True + #print("*******Test Result: taos test passed ************") + +version_test_result = False +if version: + print("Client info is: %s"%conn.client_info) + taos_V_output = "" + if system == "Windows": + taos_V_output = subprocess.getoutput("taos -V | findstr version") + else: + taos_V_output = subprocess.getoutput("taos -V | grep version") + + print("taos -V output is: %s" % taos_V_output) + if version in taos_V_output and version in conn.client_info: + version_test_result = True + #print("*******Test Result: Version check passed ************") + +conn.close() +if uninstall: + print("Start to run rmtaos") + leftFile = False + print("Platform: ", system) + + if system == "Linux": + # 创建一个subprocess.Popen对象,并使用stdin和stdout进行交互 + process = subprocess.Popen(['rmtaos'], + stdin=subprocess.PIPE, stdout=subprocess.PIPE, text=True) + # 向子进程发送输入 + process.stdin.write("y\n") + process.stdin.flush() # 确保输入被发送到子进程 + process.stdin.write("I confirm that I would like to delete all data, log and configuration files\n") + process.stdin.flush() # 确保输入被发送到子进程 + # 关闭子进程的stdin,防止它无限期等待更多输入 + process.stdin.close() + # 等待子进程结束 + process.wait() + # 检查目录清除情况 + out = subprocess.getoutput("ls /etc/systemd/system/taos*") + if "No such file or directory" not in out: + print("Uninstall left some files: %s" % out) + leftFile = True + out = subprocess.getoutput("ls /usr/bin/taos*") + if "No such file or directory" not in out: + print("Uninstall left some files: %s" % out) + leftFile = True + out = subprocess.getoutput("ls /usr/local/bin/taos*") + if "No such file or directory" not in out: + print("Uninstall left some files: %s" % out) + leftFile = True + out = subprocess.getoutput("ls /usr/lib/libtaos*") + if "No such file or directory" not in out: + print("Uninstall left some files: %s" % out) + leftFile = True + out = subprocess.getoutput("ls /usr/lib64/libtaos*") + if "No such file or directory" not in out: + print("Uninstall left some files: %s" % out) + leftFile = True + out = subprocess.getoutput("ls /usr/include/taos*") + if "No such file or directory" not in out: + print("Uninstall left some files: %s" % out) + leftFile = True + out = subprocess.getoutput("ls /usr/local/taos") + #print(out) + if "No such file or directory" not in out: + print("Uninstall left some files in /usr/local/taos:%s" % out) + leftFile = True + if not leftFile: + print("*******Test Result: uninstall test passed ************") + + elif system == "Darwin": + # 创建一个subprocess.Popen对象,并使用stdin和stdout进行交互 + process = subprocess.Popen(['sudo', 'rmtaos'], + stdin=subprocess.PIPE, stdout=subprocess.PIPE, text=True) + # 向子进程发送输入 + process.stdin.write("y\n") + process.stdin.flush() # 确保输入被发送到子进程 + process.stdin.write("I confirm that I would like to delete all data, log and configuration files\n") + process.stdin.flush() # 确保输入被发送到子进程 + # 关闭子进程的stdin,防止它无限期等待更多输入 + process.stdin.close() + # 等待子进程结束 + process.wait() + # 检查目录清除情况 + out = subprocess.getoutput("ls /usr/local/bin/taos*") + if "No such file or directory" not in out: + print("Uninstall left some files: %s" % out) + leftFile = True + out = subprocess.getoutput("ls /usr/local/lib/libtaos*") + if "No such file or directory" not in out: + print("Uninstall left some files: %s" % out) + leftFile = True + out = subprocess.getoutput("ls /usr/local/include/taos*") + if "No such file or directory" not in out: + print("Uninstall left some files: %s" % out) + leftFile = True + #out = subprocess.getoutput("ls /usr/local/Cellar/tdengine/") + #print(out) + #if out: + # print("Uninstall left some files: /usr/local/Cellar/tdengine/%s" % out) + # leftFile = True + #if not leftFile: + # print("*******Test Result: uninstall test passed ************") + + elif system == "Windows": + process = subprocess.Popen(['unins000','/silent'], + stdin=subprocess.PIPE, stdout=subprocess.PIPE, text=True) + process.wait() + time.sleep(10) + out = subprocess.getoutput("ls C:\TDengine") + print(out) + if len(out.split("\n")) > 3: + leftFile = True + print("Uninstall left some files: %s" % out) + +if taosBenchmark_test_result: + print("**********Test Result: taosBenchmark test passed! **********") +if taos_test_result: + print("**********Test Result: taos test passed! **********") +else: + print("!!!!!!!!!!!Test Result: taos test failed! !!!!!!!!!!") +if version_test_result: + print("**********Test Result: version test passed! **********") +else: + print("!!!!!!!!!!!Test Result: version test failed! !!!!!!!!!!") +if not leftFile: + print("**********Test Result: uninstall test passed! **********") +else: + print("!!!!!!!!!!!Test Result: uninstall test failed! !!!!!!!!!!") +if taosBenchmark_test_result and taos_test_result and version_test_result and not leftFile: + sys.exit(0) +else: + sys.exit(1) + diff --git a/packaging/smoke_test/smokeTestJenkinsFile b/packaging/smoke_test/smokeTestJenkinsFile new file mode 100644 index 000000000000..464393d85d77 --- /dev/null +++ b/packaging/smoke_test/smokeTestJenkinsFile @@ -0,0 +1,380 @@ +def sync_source(branch_name) { + sh ''' + hostname + ip addr|grep 192|awk '{print $2}'|sed "s/\\/.*//" + echo ''' + branch_name + ''' + ''' + sh ''' + cd ${TDENGINE_ROOT_DIR} + set +e + git reset --hard + git fetch || git fetch + git checkout -f '''+branch_name+''' + git reset --hard origin/'''+branch_name+''' + git log | head -n 20 + git clean -fxd + set -e + ''' + return 1 +} +def sync_source_win() { + bat ''' + hostname + taskkill /f /t /im taosd.exe + ipconfig + set + date /t + time /t + ''' + bat ''' + echo %branch_name% + cd %WIN_TDENGINE_ROOT_DIR% + git reset --hard + git fetch || git fetch + git checkout -f ''' + env.BRANCH_NAME + ''' + git reset --hard origin/''' + env.BRANCH_NAME + ''' + git branch + git restore . + git remote prune origin + git pull || git pull + git log | head -n 20 + git clean -fxd + ''' + return 1 +} +pipeline { + agent none + parameters { + choice( + name: 'sourcePath', + choices: ['nas','web'], + description: 'Choice which way to download the installation pacakge;web is Office Web and nas means taos nas server ' + ) + choice( + name: 'verMode', + choices: ['enterprise','community'], + description: 'Choice which types of package you want do check ' + ) + string ( + name:'version', + defaultValue:'3.3.2.0', + description: 'Release version number,eg: 3.0.0.1' + ) + string ( + name:'baseVersion', + defaultValue:'smoking', + description: 'Tnas root path. eg:smoking, 3.3' + ) + choice ( + name:'mode', + choices: ['server','client'], + description: 'Choose which mode of package you want do run ' + ) + choice ( + name:'smoke_branch', + choices: ['test/3.0/smokeTest','test/main/smokeTest','test/3.1/smokeTest'], + description: 'Choose which mode of package you want do run ' + ) + string ( + name:'runPlatforms', + defaultValue:'server_Linux_x64, server_Linux_arm64, server_Windows_x64, server_Mac_x64', + description: 'run package list hotfix usually run: server: server_Linux_x64, server_Linux_arm64 client: client_Linux_x64, client_Linux_arm64 release usually run: enterprise server: server_Linux_x64, server_Linux_arm64, server_Windows_x64 enterprise client: client_Linux_x64, client_Linux_arm64, client_Windows_x64 community server: server_Linux_x64, server_Linux_arm64, server_Mac_x64, server_Mac_arm64(not supported), server_Linux_x64_lite(not supported) community client: client_Linux_x64, client_Linux_arm64, client_Windows_x64, client_Mac_x64, client_Mac_arm64(not supported), client_Linux_x64_lite(not supported)' + ) + } + environment{ + WORK_DIR = "/var/lib/jenkins/workspace" + TDINTERNAL_ROOT_DIR = '/var/lib/jenkins/workspace/TDinternal' + TDENGINE_ROOT_DIR = '/var/lib/jenkins/workspace/TDinternal/community' + BRANCH_NAME = "${smoke_branch}" + } + stages { + stage ('Start Server for Client Test') { + when { + beforeAgent true + expression { mode == 'client' } + } + agent{label " ubuntu18 "} + steps { + timeout(time: 30, unit: 'MINUTES'){ + sync_source("${BRANCH_NAME}") + withEnv(['JENKINS_NODE_COOKIE=dontkillme']) { + sh ''' + cd ${TDENGINE_ROOT_DIR}/packaging/smokeTest + bash getAndRunInstaller.sh -m ${verMode} -f server -l false -c x64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t tar + bash start3NodesServer.sh + ''' + } + } + } + } + stage ('Run SmokeTest') { + parallel { + stage('server_Linux_x64') { + when { + beforeAgent true + allOf { + expression { mode == 'server' } + expression { runPlatforms.contains('server_Linux_x64') } + } + } + agent{label " ubuntu16 "} + steps { + timeout(time: 30, unit: 'MINUTES'){ + sync_source("${BRANCH_NAME}") + sh ''' + mkdir -p /var/www/html/${baseVersion}/${version}/${verMode}/json + cd ${TDENGINE_ROOT_DIR}/packaging/smokeTest + bash getAndRunInstaller.sh -m ${verMode} -f server -l false -c x64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t tar + python3 -m pytest test_server.py -v --html=/var/www/html/${baseVersion}/${version}/${verMode}/${mode}_linux_x64_report.html --json-report --json-report-file=report.json --timeout=300 --verMode=${verMode} --tVersion=${version} --baseVersion=${baseVersion} --sourcePath=${sourcePath} || true + cp report.json /var/www/html/${baseVersion}/${version}/${verMode}/json/${mode}_linux_x64_report.json + curl "http://192.168.0.176/api/addSmoke?version=${version}&tag=${baseVersion}&type=${verMode}&role=server&build=linux_x64" + ''' + } + } + } + stage('server_Linux_arm64') { + when { + beforeAgent true + allOf { + expression { mode == 'server' } + expression { runPlatforms.contains('server_Linux_arm64') } + } + } + agent{label "worker06_arm64"} + steps { + timeout(time: 60, unit: 'MINUTES'){ + sync_source("${BRANCH_NAME}") + sh ''' + cd ${TDENGINE_ROOT_DIR}/packaging/smokeTest + bash getAndRunInstaller.sh -m ${verMode} -f server -l false -c arm64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t tar + python3 -m pytest test_server.py -v --html=${mode}_linux_arm64_report.html --json-report --json-report-file=report.json --timeout=600 --verMode=${verMode} --tVersion=${version} --baseVersion=${baseVersion} --sourcePath=${sourcePath} || true + scp ${mode}_linux_arm64_report.html root@192.168.0.21:/var/www/html/${baseVersion}/${version}/${verMode}/ + scp report.json root@192.168.0.21:/var/www/html/${baseVersion}/${version}/${verMode}/json/${mode}_linux_arm64_report.json + curl "http://192.168.0.176/api/addSmoke?version=${version}&tag=${baseVersion}&type=${verMode}&role=server&build=linux_arm64" + ''' + } + } + } + stage ('server_Mac_x64') { + when { + beforeAgent true + allOf { + expression { mode == 'server' } + expression { runPlatforms.contains('server_Mac_x64') } + } + } + agent{label " release_Darwin_x64 "} + environment{ + WORK_DIR = "/Users/zwen/jenkins/workspace" + TDINTERNAL_ROOT_DIR = '/Users/zwen/jenkins/workspace/TDinternal' + TDENGINE_ROOT_DIR = '/Users/zwen/jenkins/workspace/TDinternal/community' + } + steps { + timeout(time: 30, unit: 'MINUTES'){ + sync_source("${BRANCH_NAME}") + sh ''' + cd ${TDENGINE_ROOT_DIR}/packaging/smokeTest + bash getAndRunInstaller.sh -m ${verMode} -f server -l false -c x64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t pkg + python3 -m pytest -v -k linux --html=${mode}_Mac_x64_report.html --json-report --json-report-file=report.json --timeout=300 --verMode=${verMode} --tVersion=${version} --baseVersion=${baseVersion} --sourcePath=${sourcePath} || true + scp ${mode}_Mac_x64_report.html root@192.168.0.21:/var/www/html/${baseVersion}/${version}/${verMode}/ + scp report.json root@192.168.0.21:/var/www/html/${baseVersion}/${version}/${verMode}/json/${mode}_Mac_x64_report.json + curl "http://192.168.0.176/api/addSmoke?version=${version}&tag=${baseVersion}&type=${verMode}&role=server&build=Mac_x64" + ''' + } + } + } + stage ('server_Mac_arm64') { + when { + beforeAgent true + allOf { + expression { mode == 'server' } + expression { runPlatforms.contains('server_Mac_arm64') } + } + } + agent{label " release_Darwin_arm64 "} + environment{ + WORK_DIR = "/Users/zwen/jenkins/workspace" + TDINTERNAL_ROOT_DIR = '/Users/zwen/jenkins/workspace/TDinternal' + TDENGINE_ROOT_DIR = '/Users/zwen/jenkins/workspace/TDinternal/community' + } + steps { + timeout(time: 30, unit: 'MINUTES'){ + sync_source("${BRANCH_NAME}") + sh ''' + cd ${TDENGINE_ROOT_DIR}/packaging/smokeTest + bash getAndRunInstaller.sh -m ${verMode} -f server -l false -c arm64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t pkg + python3 -m pytest -v -k linux --html=${mode}_Mac_arm64_report.html --json-report --json-report-file=report.json --timeout=300 --verMode=${verMode} --tVersion=${version} --baseVersion=${baseVersion} --sourcePath=${sourcePath} || true + scp ${mode}_Mac_arm64_report.html root@192.168.0.21:/var/www/html/${baseVersion}/${version}/${verMode}/ + scp report.json root@192.168.0.21:/var/www/html/${baseVersion}/${version}/${verMode}/json/${mode}_Mac_arm64_report.json + curl "http://192.168.0.176/api/addSmoke?version=${version}&tag=${baseVersion}&type=${verMode}&role=server&build=Mac_arm64" + ''' + } + } + } + stage('server_Windows_x64') { + when { + beforeAgent true + allOf { + expression { mode == 'server' } + expression { runPlatforms.contains('server_Windows_x64') } + } + } + agent{label " windows11 "} + environment{ + WIN_WORK_DIR="C:\\workspace" + WIN_TDINTERNAL_ROOT_DIR="C:\\workspace\\TDinternal" + WIN_TDENGINE_ROOT_DIR="C:\\workspace\\TDinternal\\community" + } + steps { + timeout(time: 30, unit: 'MINUTES'){ + sync_source_win() + bat ''' + cd %WIN_TDENGINE_ROOT_DIR%\\packaging\\smokeTest + call getAndRunInstaller.bat %baseVersion% %version% %verMode% server + cd %WIN_TDENGINE_ROOT_DIR%\\packaging\\smokeTest + pip3 install -r pytest_require.txt + python3 -m pytest test_server.py -v --html=%mode%_Windows_x64_report.html --json-report --json-report-file=report.json --timeout=300 --verMode=%verMode% --tVersion=%version% --baseVersion=%baseVersion% --sourcePath=%sourcePath% + scp %mode%_Windows_x64_report.html root@192.168.0.21:/var/www/html/%baseVersion%/%version%/%verMode%/ + scp report.json root@192.168.0.21:/var/www/html/%baseVersion%/%version%/%verMode%/json/%mode%_Windows_x64_report.json + curl "http://192.168.0.176/api/addSmoke?version=%version%&tag=%baseVersion%&type=%verMode%&role=server&build=Windows_x64" + ''' + } + } + } + stage('client_Linux_x64') { + when { + beforeAgent true + allOf { + expression { mode == 'client' } + expression { runPlatforms.contains('client_Linux_x64') } + } + } + agent{label " ubuntu16 "} + steps { + timeout(time: 30, unit: 'MINUTES'){ + sync_source("${BRANCH_NAME}") + sh ''' + mkdir -p /var/www/html/${baseVersion}/${version}/${verMode}/json + cd ${TDENGINE_ROOT_DIR}/packaging/smokeTest + bash getAndRunInstaller.sh -m ${verMode} -f client -l false -c x64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t tar + python3 -m pytest test_client.py -v --html=/var/www/html/${baseVersion}/${version}/${verMode}/${mode}_linux_x64_report.html --json-report --json-report-file=report.json --timeout=300 --verMode=${verMode} --tVersion=${version} --baseVersion=${baseVersion} --sourcePath=${sourcePath} || true + cp report.json /var/www/html/${baseVersion}/${version}/${verMode}/json/${mode}_linux_x64_report.json + curl "http://192.168.0.176/api/addSmoke?version=${version}&tag=${baseVersion}&type=${verMode}&role=client&build=linux_x64" + ''' + } + } + } + stage('client_Linux_arm64') { + when { + beforeAgent true + allOf { + expression { mode == 'client' } + expression { runPlatforms.contains('client_Linux_arm64') } + } + } + agent{label " worker06_arm64 "} + steps { + timeout(time: 30, unit: 'MINUTES'){ + sync_source("${BRANCH_NAME}") + sh ''' + cd ${TDENGINE_ROOT_DIR}/packaging/smokeTest + bash getAndRunInstaller.sh -m ${verMode} -f client -l false -c arm64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t tar + python3 -m pytest test_client.py -v --html=${mode}_linux_arm64_report.html --json-report --json-report-file=report.json --timeout=300 --verMode=${verMode} --tVersion=${version} --baseVersion=${baseVersion} --sourcePath=${sourcePath} || true + scp ${mode}_linux_arm64_report.html root@192.168.0.21:/var/www/html/${baseVersion}/${version}/${verMode}/ + scp report.json root@192.168.0.21:/var/www/html/${baseVersion}/${version}/${verMode}/json/${mode}_linux_arm64_report.json + curl "http://192.168.0.176/api/addSmoke?version=${version}&tag=${baseVersion}&type=${verMode}&role=client&build=linux_arm64" + ''' + } + } + } + stage ('client_Mac_x64') { + when { + beforeAgent true + allOf { + expression { mode == 'client' } + expression { runPlatforms.contains('client_Mac_x64') } + } + } + agent{label " release_Darwin_x64 "} + environment{ + WORK_DIR = "/Users/zwen/jenkins/workspace" + TDINTERNAL_ROOT_DIR = '/Users/zwen/jenkins/workspace/TDinternal' + TDENGINE_ROOT_DIR = '/Users/zwen/jenkins/workspace/TDinternal/community' + } + steps { + timeout(time: 30, unit: 'MINUTES'){ + sync_source("${BRANCH_NAME}") + sh ''' + cd ${TDENGINE_ROOT_DIR}/packaging/smokeTest + bash getAndRunInstaller.sh -m ${verMode} -f client -l false -c x64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t pkg + rm -rf /opt/taos/main/TDinternal/debug/* || true + python3 -m pytest test_client.py -v --html=${mode}_Mac_x64_report.html --json-report --json-report-file=report.json --timeout=300 --verMode=${verMode} --tVersion=${version} --baseVersion=${baseVersion} --sourcePath=${sourcePath} || true + scp ${mode}_Mac_x64_report.html root@192.168.0.21:/var/www/html/${baseVersion}/${version}/${verMode}/ + scp report.json root@192.168.0.21:/var/www/html/${baseVersion}/${version}/${verMode}/json/${mode}_Mac_x64_report.json + curl "http://192.168.0.176/api/addSmoke?version=${version}&tag=${baseVersion}&type=${verMode}&role=client&build=Mac_x64" + ''' + } + } + } + stage ('client_Mac_arm64') { + when { + beforeAgent true + allOf { + expression { mode == 'client' } + expression { runPlatforms.contains('client_Mac_arm64') } + } + } + agent{label " release_Darwin_arm64 "} + environment{ + WORK_DIR = "/Users/zwen/jenkins/workspace" + TDINTERNAL_ROOT_DIR = '/Users/zwen/jenkins/workspace/TDinternal' + TDENGINE_ROOT_DIR = '/Users/zwen/jenkins/workspace/TDinternal/community' + } + steps { + timeout(time: 30, unit: 'MINUTES'){ + sync_source("${BRANCH_NAME}") + sh ''' + cd ${TDENGINE_ROOT_DIR}/packaging/smokeTest + bash getAndRunInstaller.sh -m ${verMode} -f client -l false -c arm64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t pkg + rm -rf /opt/taos/main/TDinternal/debug/* || true + python3 -m pytest test_client.py -v --html=${mode}_Mac_arm64_report.html --json-report --json-report-file=report.json --timeout=300 --verMode=${verMode} --tVersion=${version} --baseVersion=${baseVersion} --sourcePath=${sourcePath} || true + scp ${mode}_Mac_arm64_report.html root@192.168.0.21:/var/www/html/${baseVersion}/${version}/${verMode}/ + scp report.json root@192.168.0.21:/var/www/html/${baseVersion}/${version}/${verMode}/json/${mode}_Mac_arm64_report.json + curl "http://192.168.0.176/api/addSmoke?version=${version}&tag=${baseVersion}&type=${verMode}&role=client&build=Mac_arm64" + ''' + } + } + } + stage('client_Windows_x64') { + when { + beforeAgent true + allOf { + expression { mode == 'client' } + expression { runPlatforms.contains('client_Windows_x64') } + } + } + agent{label " windows71 "} + environment{ + WIN_WORK_DIR="C:\\workspace" + WIN_TDINTERNAL_ROOT_DIR="C:\\workspace\\TDinternal" + WIN_TDENGINE_ROOT_DIR="C:\\workspace\\TDinternal\\community" + } + steps { + timeout(time: 30, unit: 'MINUTES'){ + sync_source_win() + bat ''' + cd %WIN_TDENGINE_ROOT_DIR%\\packaging\\smokeTest + call getAndRunInstaller.bat %baseVersion% %version% %verMode% client + pip3 install -r pytest_require.txt + python3 -m pytest test_client.py -v --html=%mode%_Windows_x64_report.html --json-report --json-report-file=report.json --timeout=300 --verMode=%verMode% --tVersion=%version% --baseVersion=%baseVersion% --sourcePath=%sourcePath% + scp %mode%_Windows_x64_report.html root@192.168.0.21:/var/www/html/%baseVersion%/%version%/%verMode%/ + scp report.json root@192.168.0.21:/var/www/html/%baseVersion%/%version%/%verMode%/json/%mode%_Windows_x64_report.json + curl "http://192.168.0.176/api/addSmoke?version=%version%&tag=%baseVersion%&type=%verMode%&role=client&build=Windows_x64" + ''' + } + } + } + } + } + } +} \ No newline at end of file diff --git a/packaging/smoke_test/start3NodesServer.sh b/packaging/smoke_test/start3NodesServer.sh new file mode 100644 index 000000000000..b446a467efc7 --- /dev/null +++ b/packaging/smoke_test/start3NodesServer.sh @@ -0,0 +1,67 @@ +#!/bin/bash +BUILD_ID=dontKillMe + +#******This script setup 3 nodes env for remote client installer test. Only for Linux ********* + +pwd=`pwd` +hostname=`hostname` +if [ -z $JENKINS_HOME ]; then + workdir="${pwd}/cluster" + echo $workdir +else + workdir="${JENKINS_HOME}/workspace/cluster" + echo $workdir +fi + +name="taos" +if command -v prodb ;then + name="prodb" +fi + +# Stop all taosd processes +for(( i=0; i<3; i++)) +do + pid=$(ps -ef | grep ${name}d | grep -v grep | awk '{print $2}') + if [ -n "$pid" ]; then + ${csudo}kill -9 $pid || : + fi +done + +# Init 3 dnodes workdir and config file +rm -rf ${workdir} +mkdir ${workdir} +mkdir ${workdir}/output +mkdir ${workdir}/dnode1 +mkdir ${workdir}/dnode1/data +mkdir ${workdir}/dnode1/log +mkdir ${workdir}/dnode1/cfg +touch ${workdir}/dnode1/cfg/${name}.cfg +echo -e "firstEp ${hostname}:6031\nsecondEp ${hostname}:6032\nfqdn ${hostname}\nserverPort 6031\nlogDir ${workdir}/dnode1/log\ndataDir ${workdir}/dnode1/data\n" >> ${workdir}/dnode1/cfg/${name}.cfg + +# Start first node +nohup ${name}d -c ${workdir}/dnode1/cfg/${name}.cfg & > /dev/null +sleep 5 + +${name} -P 6031 -s "CREATE DNODE \`${hostname}:6032\`;CREATE DNODE \`${hostname}:6033\`" + +mkdir ${workdir}/dnode2 +mkdir ${workdir}/dnode2/data +mkdir ${workdir}/dnode2/log +mkdir ${workdir}/dnode2/cfg +touch ${workdir}/dnode2/cfg/${name}.cfg +echo -e "firstEp ${hostname}:6031\nsecondEp ${hostname}:6032\nfqdn ${hostname}\nserverPort 6032\nlogDir ${workdir}/dnode2/log\ndataDir ${workdir}/dnode2/data\n" >> ${workdir}/dnode2/cfg/${name}.cfg + +nohup ${name}d -c ${workdir}/dnode2/cfg/${name}.cfg & > /dev/null +sleep 5 + +mkdir ${workdir}/dnode3 +mkdir ${workdir}/dnode3/data +mkdir ${workdir}/dnode3/log +mkdir ${workdir}/dnode3/cfg +touch ${workdir}/dnode3/cfg/${name}.cfg +echo -e "firstEp ${hostname}:6031\nsecondEp ${hostname}:6032\nfqdn ${hostname}\nserverPort 6033\nlogDir ${workdir}/dnode3/log\ndataDir ${workdir}/dnode3/data\n" >> ${workdir}/dnode3/cfg/${name}.cfg + +nohup ${name}d -c ${workdir}/dnode3/cfg/${name}.cfg & > /dev/null +sleep 5 + +${name} -P 6031 -s "CREATE MNODE ON DNODE 2;CREATE MNODE ON DNODE 3;" \ No newline at end of file diff --git a/packaging/smoke_test/test_client.py b/packaging/smoke_test/test_client.py new file mode 100644 index 000000000000..0b1003e3702e --- /dev/null +++ b/packaging/smoke_test/test_client.py @@ -0,0 +1,137 @@ +import pytest +import subprocess +import os +import sys +import platform +import getopt +import re +import time +import taos +from versionCheckAndUninstallforPytest import UninstallTaos + +# python3 smokeTestClient.py -h 192.168.0.22 -P 6031 -v ${version} -u + +OEM = ["ProDB"] + + +@pytest.fixture(scope="module") +def get_config(request): + verMode = request.config.getoption("--verMode") + taosVersion = request.config.getoption("--tVersion") + baseVersion = request.config.getoption("--baseVersion") + sourcePath = request.config.getoption("--sourcePath") + config = { + "verMode": verMode, + "taosVersion": taosVersion, + "baseVersion": baseVersion, + "sourcePath": sourcePath, + "system": platform.system(), + "arch": platform.machine(), + "serverHost": "192.168.0.22", + "serverPort": 6031, + "databaseName": re.sub(r'[^a-zA-Z0-9]', '', subprocess.getoutput("hostname")).lower() + } + return config + + +@pytest.fixture(scope="module") +def setup_module(get_config): + config = get_config + # install taospy + if config["system"] == 'Windows': + taospy_version = subprocess.getoutput("pip3 show taospy|findstr Version") + else: + taospy_version = subprocess.getoutput("pip3 show taospy|grep Version| awk -F ':' '{print $2}' ") + + print("taospy version %s " % taospy_version) + if taospy_version == "": + subprocess.getoutput("pip3 install git+https://github.com/taosdata/taos-connector-python.git") + print("install taos python connector") + else: + subprocess.getoutput("pip3 install taospy") + + +def get_connect(host, port, database=None): + conn = taos.connect(host=host, + user="root", + password="taosdata", + database=database, + port=port, + timezone="Asia/Shanghai") # default your host's timezone + return conn + + +def run_cmd(command): + print("CMD: %s" % command) + result = subprocess.run(command, capture_output=True, text=True, shell=True) + print("STDOUT:", result.stdout) + print("STDERR:", result.stderr) + print("Return Code:", result.returncode) + assert result.returncode == 0 + return result + + +class TestClient: + @pytest.mark.all + def test_basic(self, get_config, setup_module): + config = get_config + name = "taos" + + if config["baseVersion"] in OEM: + name = config["baseVersion"].lower() + if config["baseVersion"] in OEM and config["system"] == 'Windows': + cmd = f'{name} -s "create database {config["databaseName"]};" -h {config["serverHost"]} -P {config["serverPort"]}' + run_cmd(cmd) + cmd = f'{name} -s "CREATE STABLE {config["databaseName"]}.meters (`ts` TIMESTAMP,`current` FLOAT, `phase` FLOAT) TAGS (`groupid` INT, `location` VARCHAR(24));" -h {config["serverHost"]} -P {config["serverPort"]}' + run_cmd(cmd) + else: + cmd = f'{name}Benchmark -y -a 3 -n 100 -t 100 -d {config["databaseName"]} -h {config["serverHost"]} -P {config["serverPort"]} &' + run_cmd(cmd) + # os.system("taosBenchmark -y -a 3 -n 100 -t 100 -d %s -h %s -P %d" % (databaseName, serverHost, serverPort)) + time.sleep(5) + conn = get_connect(config["serverHost"], config["serverPort"], config["databaseName"]) + sql = "SELECT count(*) from meters" + result: taos.TaosResult = conn.query(sql) + data = result.fetch_all() + print("SQL: %s" % sql) + print("Result: %s" % data) + if config["system"] == 'Windows' and config["baseVersion"] in OEM: + pass + elif data[0][0] != 10000: + raise f"{name}Benchmark work not as expected " + # drop database of test + cmd = f'{name} -s "drop database {config["databaseName"]};" -h {config["serverHost"]} -P {config["serverPort"]}' + result = run_cmd(cmd) + assert "Drop OK" in result.stdout + conn.close() + + @pytest.mark.all + def test_version(self, get_config, setup_module): + config = get_config + conn = get_connect(config["serverHost"], config["serverPort"]) + server_version = conn.server_info + print("server_version: ", server_version) + client_version = conn.client_info + print("client_version: ", client_version) + name = "taos" + if config["baseVersion"] in OEM: + name = config["baseVersion"].lower() + if config["system"] == "Windows": + taos_V_output = subprocess.getoutput(f"{name} -V | findstr version") + else: + taos_V_output = subprocess.getoutput(f"{name} -V | grep version") + assert config["taosVersion"] in taos_V_output + assert config["taosVersion"] in client_version + if config["taosVersion"] not in server_version: + print("warning: client version is not same as server version") + conn.close() + + @pytest.mark.all + def test_uninstall(self, get_config, setup_module): + config = get_config + name = "taos" + if config["baseVersion"] in OEM: + name = config["baseVersion"].lower() + subprocess.getoutput("rm /usr/local/bin/taos") + subprocess.getoutput("pkill taosd") + UninstallTaos(config["taosVersion"], config["verMode"], True, name) diff --git a/packaging/smoke_test/test_server.py b/packaging/smoke_test/test_server.py new file mode 100644 index 000000000000..768cd2a96214 --- /dev/null +++ b/packaging/smoke_test/test_server.py @@ -0,0 +1,238 @@ +import pytest +import subprocess +import os +from versionCheckAndUninstallforPytest import UninstallTaos +import platform +import re +import time +import signal + +system = platform.system() +current_path = os.path.abspath(os.path.dirname(__file__)) +if system == 'Windows': + with open(r"%s\test_server_windows_case" % current_path) as f: + cases = f.read().splitlines() +else: + with open("%s/test_server_unix_case" % current_path) as f: + cases = f.read().splitlines() + +OEM = ["ProDB"] + + +@pytest.fixture(scope="module") +def get_config(request): + verMode = request.config.getoption("--verMode") + taosVersion = request.config.getoption("--tVersion") + baseVersion = request.config.getoption("--baseVersion") + sourcePath = request.config.getoption("--sourcePath") + config = { + "verMode": verMode, + "taosVersion": taosVersion, + "baseVersion": baseVersion, + "sourcePath": sourcePath, + "system": platform.system(), + "arch": platform.machine() + } + return config + + +@pytest.fixture(scope="module") +def setup_module(get_config): + def run_cmd(command): + print("CMD:", command) + result = subprocess.run(command, capture_output=True, text=False, shell=False) + print("STDOUT:", result.stdout) + print("STDERR:", result.stderr) + print("Return Code:", result.returncode) + assert result.returncode == 0 + return result + + # setup before module tests + config = get_config + # bash getAndRunInstaller.sh -m ${verMode} -f server -l false -c x64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t tar + # t = "tar" + # if config["system"] == "Darwin": + # t = "pkg" + # cmd = "bash getAndRunInstaller.sh -m %s -f server -l false -c x64 -v %s -o %s -s %s -t %s" % ( + # config["verMode"], config["taosVersion"], config["baseVersion"], config["sourcePath"], t) + # run_cmd(cmd) + if config["system"] == "Windows": + cmd = r"mkdir ..\..\debug\build\bin" + else: + cmd = "mkdir -p ../../debug/build/bin/" + subprocess.getoutput(cmd) + if config["system"] == "Linux": # add tmq_sim + cmd = "cp -rf ../../../debug/build/bin/tmq_sim ../../debug/build/bin/." + subprocess.getoutput(cmd) + if config["system"] == "Darwin": + cmd = "sudo cp -rf /usr/local/bin/taos* ../../debug/build/bin/" + elif config["system"] == "Windows": + cmd = r"xcopy C:\TDengine\taos*.exe ..\..\debug\build\bin /Y" + else: + if config["baseVersion"] in OEM: + cmd = '''sudo find /usr/bin -name 'prodb*' -exec sh -c 'for file; do cp "$file" "../../debug/build/bin/taos${file##/usr/bin/%s}"; done' sh {} +''' % ( + config["baseVersion"].lower()) + else: + cmd = "sudo cp /usr/bin/taos* ../../debug/build/bin/" + run_cmd(cmd) + if config["baseVersion"] in OEM: # mock OEM + cmd = "sed -i 's/taos.cfg/%s.cfg/g' ../../tests/pytest/util/dnodes.py" % config["baseVersion"].lower() + run_cmd(cmd) + cmd = "sed -i 's/taosdlog.0/%sdlog.0/g' ../../tests/pytest/util/dnodes.py" % config["baseVersion"].lower() + run_cmd(cmd) + cmd = "sed -i 's/taos.cfg/%s.cfg/g' ../../tests/army/frame/server/dnode.py" % config["baseVersion"].lower() + run_cmd(cmd) + cmd = "sed -i 's/taosdlog.0/%sdlog.0/g' ../../tests/army/frame/server/dnode.py" % config["baseVersion"].lower() + run_cmd(cmd) + cmd = "ln -s /usr/bin/prodb /usr/local/bin/taos" + subprocess.getoutput(cmd) + + # yield + # + # name = "taos" + # if config["baseVersion"] in OEM: + # name = config["baseVersion"].lower() + # subprocess.getoutput("rm /usr/local/bin/taos") + # subprocess.getoutput("pkill taosd") + # UninstallTaos(config["taosVersion"], config["verMode"], True, name) + + +# use pytest fixture to exec case +@pytest.fixture(params=cases) +def run_command(request): + commands = request.param + if commands.strip().startswith("#"): + pytest.skip("This case has been marked as skipped") + d, command = commands.strip().split(",") + if system == "Windows": + cmd = r"cd %s\..\..\tests\%s && %s" % (current_path, d, command) + else: + cmd = "cd %s/../../tests/%s&&sudo %s" % (current_path, d, command) + print(cmd) + result = subprocess.run(cmd, capture_output=True, text=True, shell=True) + return { + "command": command, + "stdout": result.stdout, + "stderr": result.stderr, + "returncode": result.returncode + } + + +class TestServer: + @pytest.mark.all + def test_taosd_up(self, setup_module): + # start process + if system == 'Windows': + subprocess.getoutput("taskkill /IM taosd.exe /F") + cmd = "..\\..\\debug\\build\\bin\\taosd.exe" + else: + subprocess.getoutput("pkill taosd") + cmd = "../../debug/build/bin/taosd" + process = subprocess.Popen( + [cmd], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + text=True + ) + # monitor output + while True: + line = process.stdout.readline() + if line: + print(line.strip()) + if "succeed to write dnode" in line: + time.sleep(15) + # 发送终止信号 + os.kill(process.pid, signal.SIGTERM) + break + + @pytest.mark.all + def test_execute_cases(self, setup_module, run_command): + # assert the result + if run_command['returncode'] != 0: + print(f"Running command: {run_command['command']}") + print("STDOUT:", run_command['stdout']) + print("STDERR:", run_command['stderr']) + print("Return Code:", run_command['returncode']) + else: + print(f"Running command: {run_command['command']}") + if len(run_command['stdout']) > 1000: + print("STDOUT:", run_command['stdout'][:1000] + "...") + else: + print("STDOUT:", run_command['stdout']) + print("STDERR:", run_command['stderr']) + print("Return Code:", run_command['returncode']) + + assert run_command[ + 'returncode'] == 0, f"Command '{run_command['command']}' failed with return code {run_command['returncode']}" + + @pytest.mark.all + @pytest.mark.check_version + def test_check_version(self, get_config, setup_module): + config = get_config + databaseName = re.sub(r'[^a-zA-Z0-9]', '', subprocess.getoutput("hostname")).lower() + # install taospy + taospy_version = "" + system = config["system"] + version = config["taosVersion"] + verMode = config["verMode"] + if system == 'Windows': + taospy_version = subprocess.getoutput("pip3 show taospy|findstr Version") + else: + taospy_version = subprocess.getoutput("pip3 show taospy|grep Version| awk -F ':' '{print $2}' ") + + print("taospy version %s " % taospy_version) + if taospy_version == "": + subprocess.getoutput("pip3 install git+https://github.com/taosdata/taos-connector-python.git") + print("install taos python connector") + else: + subprocess.getoutput("pip3 install taospy") + + # start taosd server + if system == 'Windows': + cmd = ["C:\\TDengine\\start-all.bat"] + # elif system == 'Linux': + # cmd = "systemctl start taosd".split(' ') + else: + # cmd = "sudo launchctl start com.tdengine.taosd".split(' ') + cmd = "start-all.sh" + process_out = subprocess.Popen(cmd, + stdin=subprocess.PIPE, stdout=subprocess.PIPE, text=True) + print(cmd) + time.sleep(5) + + import taos + conn = taos.connect() + check_list = {} + check_list["server_version"] = conn.server_info + check_list["client_version"] = conn.client_info + # Execute sql get version info + result: taos.TaosResult = conn.query("SELECT server_version()") + check_list["select_server"] = result.fetch_all()[0][0] + result: taos.TaosResult = conn.query("SELECT client_version()") + check_list["select_client"] = result.fetch_all()[0][0] + conn.close() + + binary_files = ["taos", "taosd", "taosadapter", "taoskeeper", "taosBenchmark"] + if verMode.lower() == "enterprise": + binary_files.append("taosx") + if config["baseVersion"] in OEM: + binary_files = [i.replace("taos", config["baseVersion"].lower()) for i in binary_files] + if system == "Windows": + for i in binary_files: + check_list[i] = subprocess.getoutput("%s -V | findstr version" % i) + else: + for i in binary_files: + check_list[i] = subprocess.getoutput("%s -V | grep version | awk -F ' ' '{print $3}'" % i) + for i in check_list: + print("%s version is: %s" % (i, check_list[i])) + assert version in check_list[i] + + @pytest.mark.all + def test_uninstall(self, get_config, setup_module): + config = get_config + name = "taos" + if config["baseVersion"] in OEM: + name = config["baseVersion"].lower() + subprocess.getoutput("rm /usr/local/bin/taos") + subprocess.getoutput("pkill taosd") + UninstallTaos(config["taosVersion"], config["verMode"], True, name) diff --git a/packaging/smoke_test/test_server_unix_case b/packaging/smoke_test/test_server_unix_case new file mode 100644 index 000000000000..1bbde1093265 --- /dev/null +++ b/packaging/smoke_test/test_server_unix_case @@ -0,0 +1,10 @@ +system-test,python3 ./test.py -f 2-query/join.py +system-test,python3 ./test.py -f 1-insert/insert_column_value.py +system-test,python3 ./test.py -f 2-query/primary_ts_base_5.py +system-test,python3 ./test.py -f 2-query/case_when.py +system-test,python3 ./test.py -f 2-query/partition_limit_interval.py +system-test,python3 ./test.py -f 2-query/fill.py +army,python3 ./test.py -f query/query_basic.py -N 3 +system-test,python3 ./test.py -f 7-tmq/basic5.py +system-test,python3 ./test.py -f 8-stream/stream_basic.py +system-test,python3 ./test.py -f 6-cluster/5dnode3mnodeStop.py -N 5 -M 3 \ No newline at end of file diff --git a/packaging/smoke_test/test_server_windows_case b/packaging/smoke_test/test_server_windows_case new file mode 100644 index 000000000000..e64213b1eef7 --- /dev/null +++ b/packaging/smoke_test/test_server_windows_case @@ -0,0 +1,2 @@ +system-test,python3 .\test.py -f 0-others\taosShell.py +system-test,python3 .\test.py -f 6-cluster\5dnode3mnodeSep1VnodeStopDnodeModifyMeta.py -N 6 -M 3 \ No newline at end of file diff --git a/packaging/smoke_test/versionCheckAndUninstall.py b/packaging/smoke_test/versionCheckAndUninstall.py new file mode 100644 index 000000000000..80dea9a15fb0 --- /dev/null +++ b/packaging/smoke_test/versionCheckAndUninstall.py @@ -0,0 +1,260 @@ +#!/usr/bin/python +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### +# install pip +# pip install src/connector/python/ + +# -*- coding: utf-8 -*- +import sys, os +import re +import platform +import getopt +import subprocess +# from this import d +import time + +# input for server + +opts, args = getopt.gnu_getopt(sys.argv[1:], 'v:m:u', ['version=', 'verMode=']) +serverHost = "" +serverPort = 0 +version = "" +uninstall = False +verMode = "" +for key, value in opts: + if key in ['--help']: + print('A collection of test cases written using Python') + print('-v test client version') + print('-u test uninstall process, will uninstall TDengine') + sys.exit(0) + + if key in ['-v']: + version = value + if key in ['-u']: + uninstall = True + if key in ['-m']: + verMode = value +if not version: + print("No version specified, will not run version check.") + + +system = platform.system() +arch = platform.machine() + +databaseName = re.sub(r'[^a-zA-Z0-9]', '', subprocess.getoutput("hostname")).lower() +# install taospy +taospy_version = "" +if system == 'Windows': + taospy_version = subprocess.getoutput("pip3 show taospy|findstr Version") +else: + taospy_version = subprocess.getoutput("pip3 show taospy|grep Version| awk -F ':' '{print $2}' ") + +print("taospy version %s " % taospy_version) +if taospy_version == "": + subprocess.getoutput("pip3 install git+https://github.com/taosdata/taos-connector-python.git") + print("install taos python connector") +else: + subprocess.getoutput("pip3 install taospy") + +# start taosd server +if system == 'Windows': + cmd = ["C:\\TDengine\\start-all.bat"] +elif system == 'Linux': + cmd = "systemctl start taosd".split(' ') +else: + cmd = "sudo launchctl start com.tdengine.taosd".split(' ') +process_out = subprocess.Popen(cmd, + stdin=subprocess.PIPE, stdout=subprocess.PIPE, text=True) +print(cmd) +time.sleep(5) + +#get taosc version info +version_test_result = False +if version: + import taos + conn = taos.connect() + server_version = conn.server_info + print("server_version", server_version) + client_version = conn.client_info + print("client_version", client_version) + # Execute sql get version info + result: taos.TaosResult = conn.query("SELECT server_version()") + select_server = result.fetch_all()[0][0] + print("SELECT server_version():" + select_server) + result: taos.TaosResult = conn.query("SELECT client_version()") + select_client = result.fetch_all()[0][0] + print("SELECT client_version():" + select_client) + conn.close() + + taos_V_output = "" + taosd_V_output = "" + taosadapter_V_output = "" + taoskeeper_V_output = "" + taosx_V_output = "" + taosB_V_output = "" + taosxVersion = False + if system == "Windows": + taos_V_output = subprocess.getoutput("taos -V | findstr version") + taosd_V_output = subprocess.getoutput("taosd -V | findstr version") + taosadapter_V_output = subprocess.getoutput("taosadapter -V | findstr version") + taoskeeper_V_output = subprocess.getoutput("taoskeeper -V | findstr version") + taosB_V_output = subprocess.getoutput("taosBenchmark -V | findstr version") + if verMode == "Enterprise": + taosx_V_output = subprocess.getoutput("taosx -V | findstr version") + else: + taos_V_output = subprocess.getoutput("taos -V | grep version | awk -F ' ' '{print $3}'") + taosd_V_output = subprocess.getoutput("taosd -V | grep version | awk -F ' ' '{print $3}'") + taosadapter_V_output = subprocess.getoutput("taosadapter -V | grep version | awk -F ' ' '{print $3}'") + taoskeeper_V_output = subprocess.getoutput("taoskeeper -V | grep version | awk -F ' ' '{print $3}'") + taosB_V_output = subprocess.getoutput("taosBenchmark -V | grep version | awk -F ' ' '{print $3}'") + if verMode == "Enterprise": + taosx_V_output = subprocess.getoutput("taosx -V | grep version | awk -F ' ' '{print $3}'") + + print("taos -V output is: %s" % taos_V_output) + print("taosd -V output is: %s" % taosd_V_output) + print("taosadapter -V output is: %s" % taosadapter_V_output) + print("taoskeeper -V output is: %s" % taoskeeper_V_output) + print("taosBenchmark -V output is: %s" % taosB_V_output) + if verMode == "Enterprise": + print("taosx -V output is: %s" % taosx_V_output) + taosxVersion = version in taosx_V_output + else: + taosxVersion = True + if (version in client_version + and version in server_version + and version in select_server + and version in select_client + and version in taos_V_output + and version in taosd_V_output + and version in taosadapter_V_output + and version in taoskeeper_V_output + and version in taosB_V_output + and taosxVersion + ): + version_test_result = True +leftFile = False +if uninstall: + print("Start to run rmtaos") + print("Platform: ", system) + # stop taosd server + if system == 'Windows': + cmd = "C:\\TDengine\\stop_all.bat" + elif system == 'Linux': + cmd = "systemctl stop taosd" + else: + cmd = "sudo launchctl stop com.tdengine.taosd" + process_out = subprocess.getoutput(cmd) + print(cmd) + time.sleep(10) + if system == "Linux": + # 创建一个subprocess.Popen对象,并使用stdin和stdout进行交互 + process = subprocess.Popen(['rmtaos'], + stdin=subprocess.PIPE, stdout=subprocess.PIPE, text=True) + # 向子进程发送输入 + process.stdin.write("y\n") + process.stdin.flush() # 确保输入被发送到子进程 + process.stdin.write("I confirm that I would like to delete all data, log and configuration files\n") + process.stdin.flush() # 确保输入被发送到子进程 + # 关闭子进程的stdin,防止它无限期等待更多输入 + process.stdin.close() + # 等待子进程结束 + process.wait() + # 检查目录清除情况 + out = subprocess.getoutput("ls /etc/systemd/system/taos*") + if "No such file or directory" not in out: + print("Uninstall left some files: %s" % out) + leftFile = True + out = subprocess.getoutput("ls /usr/bin/taos*") + if "No such file or directory" not in out: + print("Uninstall left some files: %s" % out) + leftFile = True + out = subprocess.getoutput("ls /usr/local/bin/taos*") + if "No such file or directory" not in out: + print("Uninstall left some files: %s" % out) + leftFile = True + out = subprocess.getoutput("ls /usr/lib/libtaos*") + if "No such file or directory" not in out: + print("Uninstall left some files: %s" % out) + leftFile = True + out = subprocess.getoutput("ls /usr/lib64/libtaos*") + if "No such file or directory" not in out: + print("Uninstall left some files: %s" % out) + leftFile = True + out = subprocess.getoutput("ls /usr/include/taos*") + if "No such file or directory" not in out: + print("Uninstall left some files: %s" % out) + leftFile = True + out = subprocess.getoutput("ls /usr/local/taos") + #print(out) + if "No such file or directory" not in out: + print("Uninstall left some files in /usr/local/taos:%s" % out) + leftFile = True + if not leftFile: + print("*******Test Result: uninstall test passed ************") + + elif system == "Darwin": + # 创建一个subprocess.Popen对象,并使用stdin和stdout进行交互 + process = subprocess.Popen(['sudo', 'rmtaos'], + stdin=subprocess.PIPE, stdout=subprocess.PIPE, text=True) + # 向子进程发送输入 + process.stdin.write("y\n") + process.stdin.flush() # 确保输入被发送到子进程 + process.stdin.write("I confirm that I would like to delete all data, log and configuration files\n") + process.stdin.flush() # 确保输入被发送到子进程 + # 关闭子进程的stdin,防止它无限期等待更多输入 + process.stdin.close() + # 等待子进程结束 + process.wait() + # 检查目录清除情况 + out = subprocess.getoutput("ls /usr/local/bin/taos*") + if "No such file or directory" not in out: + print("Uninstall left some files: %s" % out) + leftFile = True + out = subprocess.getoutput("ls /usr/local/lib/libtaos*") + if "No such file or directory" not in out: + print("Uninstall left some files: %s" % out) + leftFile = True + out = subprocess.getoutput("ls /usr/local/include/taos*") + if "No such file or directory" not in out: + print("Uninstall left some files: %s" % out) + leftFile = True + #out = subprocess.getoutput("ls /usr/local/Cellar/tdengine/") + #print(out) + #if out: + # print("Uninstall left some files: /usr/local/Cellar/tdengine/%s" % out) + # leftFile = True + #if not leftFile: + # print("*******Test Result: uninstall test passed ************") + + elif system == "Windows": + process = subprocess.Popen(['unins000','/silent'], + stdin=subprocess.PIPE, stdout=subprocess.PIPE, text=True) + process.wait() + time.sleep(10) + out = subprocess.getoutput("ls C:\TDengine") + print(out) + if len(out.split("\n")) > 3: + leftFile = True + print("Uninstall left some files: %s" % out) + +if version_test_result: + print("**********Test Result: version test passed! **********") +else: + print("!!!!!!!!!!!Test Result: version test failed! !!!!!!!!!!") +if not leftFile: + print("**********Test Result: uninstall test passed! **********") +else: + print("!!!!!!!!!!!Test Result: uninstall test failed! !!!!!!!!!!") +if version_test_result and not leftFile: + sys.exit(0) +else: + sys.exit(1) + diff --git a/packaging/smoke_test/versionCheckAndUninstallforPytest.py b/packaging/smoke_test/versionCheckAndUninstallforPytest.py new file mode 100644 index 000000000000..5b752195545d --- /dev/null +++ b/packaging/smoke_test/versionCheckAndUninstallforPytest.py @@ -0,0 +1,137 @@ +#!/usr/bin/python +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### +# install pip +# pip install src/connector/python/ + +# -*- coding: utf-8 -*- +import sys, os +import re +import platform +import getopt +import subprocess +# from this import d +import time +from lib import run_cmd + + +# input for server +def UninstallTaos(version, verMode, uninstall, name): + if not version: + raise "No version specified, will not run version check." + + system = platform.system() + arch = platform.machine() + leftFile = False + if uninstall: + print("Start to run rm%s" % name) + print("Platform: ", system) + # stop taosd server + if system == 'Windows': + cmd = "C:\\TDengine\\stop_all.bat" + else: + cmd = "stop_all.sh" + process_out = subprocess.getoutput(cmd) + print(cmd) + time.sleep(5) + print("start to rm%s" % name) + if system == "Linux": + # 启动命令 + process = subprocess.Popen(['rm%s' % name], stdin=subprocess.PIPE, stdout=subprocess.PIPE, + stderr=subprocess.PIPE, text=True) + + # 发送交互输入 + stdout, stderr = process.communicate( + input="y\nI confirm that I would like to delete all data, log and configuration files\n") + + # 打印输出(可选) + print(stdout) + print(stderr) + # 检查目录清除情况 + out = subprocess.getoutput("ls /etc/systemd/system/%s*" % name) + if "No such file or directory" not in out: + print("Uninstall left some files: %s" % out) + leftFile = True + out = subprocess.getoutput("ls /usr/bin/%s*" % name) + if "No such file or directory" not in out: + print("Uninstall left some files: %s" % out) + leftFile = True + out = subprocess.getoutput("ls /usr/local/bin/%s*" % name) + if "No such file or directory" not in out: + print("Uninstall left some files: %s" % out) + leftFile = True + out = subprocess.getoutput("ls /usr/lib/lib%s*" % name) + if "No such file or directory" not in out: + print("Uninstall left some files: %s" % out) + leftFile = True + out = subprocess.getoutput("ls /usr/lib64/lib%s*" % name) + if "No such file or directory" not in out: + print("Uninstall left some files: %s" % out) + leftFile = True + out = subprocess.getoutput("ls /usr/include/%s*" % name) + if "No such file or directory" not in out: + print("Uninstall left some files: %s" % out) + leftFile = True + out = subprocess.getoutput("ls /usr/local/%s" % name) + # print(out) + if "No such file or directory" not in out: + print("Uninstall left some files in /usr/local/%s:%s" % (name, out)) + leftFile = True + if not leftFile: + print("*******Test Result: uninstall test passed ************") + + elif system == "Darwin": + # 创建一个subprocess.Popen对象,并使用stdin和stdout进行交互 + process = subprocess.Popen(['sudo', 'rm%s' % name], + stdin=subprocess.PIPE, stdout=subprocess.PIPE, text=True) + # 向子进程发送输入 + process.stdin.write("y\n") + process.stdin.flush() # 确保输入被发送到子进程 + process.stdin.write("I confirm that I would like to delete all data, log and configuration files\n") + process.stdin.flush() # 确保输入被发送到子进程 + # 关闭子进程的stdin,防止它无限期等待更多输入 + process.stdin.close() + # 等待子进程结束 + process.wait() + # 检查目录清除情况 + out = subprocess.getoutput("ls /usr/local/bin/%s*" % name) + if "No such file or directory" not in out: + print("Uninstall left some files: %s" % out) + leftFile = True + out = subprocess.getoutput("ls /usr/local/lib/lib%s*" % name) + if "No such file or directory" not in out: + print("Uninstall left some files: %s" % out) + leftFile = True + out = subprocess.getoutput("ls /usr/local/include/%s*" % name) + if "No such file or directory" not in out: + print("Uninstall left some files: %s" % out) + leftFile = True + # out = subprocess.getoutput("ls /usr/local/Cellar/tdengine/") + # print(out) + # if out: + # print("Uninstall left some files: /usr/local/Cellar/tdengine/%s" % out) + # leftFile = True + # if not leftFile: + # print("*******Test Result: uninstall test passed ************") + + elif system == "Windows": + process = subprocess.Popen(['unins000', '/silent'], + stdin=subprocess.PIPE, stdout=subprocess.PIPE, text=True) + process.wait() + time.sleep(10) + for file in ["C:\TDengine\\taos.exe", "C:\TDengine\\unins000.exe", "C:\ProDB\prodb.exe", + "C:\ProDB\\unins000.exe"]: + if os.path.exists(file): + leftFile = True + if leftFile: + raise "uninstall %s fail, please check" % name + else: + print("**********Test Result: uninstall test passed! **********") diff --git a/tests/system-test/test.py b/tests/system-test/test.py index fb3357a2b9b5..0d40544be8e2 100644 --- a/tests/system-test/test.py +++ b/tests/system-test/test.py @@ -689,6 +689,9 @@ def runOnPreviousCluster(host, config, fileName): if conn is not None: conn.close() if asan: - #tdDnodes.StopAllSigint() + # tdDnodes.StopAllSigint() tdLog.info("Address sanitizer mode finished") + else: + tdDnodes.stopAll() + tdLog.info("stop all td process finished") sys.exit(0) From 81d321a62f7417048f5f90fc1f6fc7ade726de89 Mon Sep 17 00:00:00 2001 From: chenhaoran Date: Thu, 7 Nov 2024 11:36:59 +0800 Subject: [PATCH 673/695] test:modify somketest dir name --- packaging/{smoke_test => smokeTest}/conftest.py | 0 .../debRpmAutoInstall.sh | 0 .../getAndRunInstaller.bat | 0 .../getAndRunInstaller.sh | 0 packaging/{smoke_test => smokeTest}/lib.py | 0 packaging/{smoke_test => smokeTest}/main.py | 0 packaging/{smoke_test => smokeTest}/runCases.bat | 0 packaging/{smoke_test => smokeTest}/runCases.sh | 0 .../{smoke_test => smokeTest}/smokeTestClient.py | 0 .../smokeTestJenkinsFile | 0 .../start3NodesServer.sh | 0 .../{smoke_test => smokeTest}/test_client.py | 0 .../{smoke_test => smokeTest}/test_server.py | 0 .../test_server_unix_case | 0 .../test_server_windows_case | 0 .../versionCheckAndUninstall.py | 0 .../versionCheckAndUninstallforPytest.py | 0 packaging/smoke_test/pytest_require.txt | 16 ---------------- 18 files changed, 16 deletions(-) rename packaging/{smoke_test => smokeTest}/conftest.py (100%) rename packaging/{smoke_test => smokeTest}/debRpmAutoInstall.sh (100%) rename packaging/{smoke_test => smokeTest}/getAndRunInstaller.bat (100%) rename packaging/{smoke_test => smokeTest}/getAndRunInstaller.sh (100%) rename packaging/{smoke_test => smokeTest}/lib.py (100%) rename packaging/{smoke_test => smokeTest}/main.py (100%) rename packaging/{smoke_test => smokeTest}/runCases.bat (100%) rename packaging/{smoke_test => smokeTest}/runCases.sh (100%) rename packaging/{smoke_test => smokeTest}/smokeTestClient.py (100%) rename packaging/{smoke_test => smokeTest}/smokeTestJenkinsFile (100%) rename packaging/{smoke_test => smokeTest}/start3NodesServer.sh (100%) rename packaging/{smoke_test => smokeTest}/test_client.py (100%) rename packaging/{smoke_test => smokeTest}/test_server.py (100%) rename packaging/{smoke_test => smokeTest}/test_server_unix_case (100%) rename packaging/{smoke_test => smokeTest}/test_server_windows_case (100%) rename packaging/{smoke_test => smokeTest}/versionCheckAndUninstall.py (100%) rename packaging/{smoke_test => smokeTest}/versionCheckAndUninstallforPytest.py (100%) delete mode 100644 packaging/smoke_test/pytest_require.txt diff --git a/packaging/smoke_test/conftest.py b/packaging/smokeTest/conftest.py similarity index 100% rename from packaging/smoke_test/conftest.py rename to packaging/smokeTest/conftest.py diff --git a/packaging/smoke_test/debRpmAutoInstall.sh b/packaging/smokeTest/debRpmAutoInstall.sh similarity index 100% rename from packaging/smoke_test/debRpmAutoInstall.sh rename to packaging/smokeTest/debRpmAutoInstall.sh diff --git a/packaging/smoke_test/getAndRunInstaller.bat b/packaging/smokeTest/getAndRunInstaller.bat similarity index 100% rename from packaging/smoke_test/getAndRunInstaller.bat rename to packaging/smokeTest/getAndRunInstaller.bat diff --git a/packaging/smoke_test/getAndRunInstaller.sh b/packaging/smokeTest/getAndRunInstaller.sh similarity index 100% rename from packaging/smoke_test/getAndRunInstaller.sh rename to packaging/smokeTest/getAndRunInstaller.sh diff --git a/packaging/smoke_test/lib.py b/packaging/smokeTest/lib.py similarity index 100% rename from packaging/smoke_test/lib.py rename to packaging/smokeTest/lib.py diff --git a/packaging/smoke_test/main.py b/packaging/smokeTest/main.py similarity index 100% rename from packaging/smoke_test/main.py rename to packaging/smokeTest/main.py diff --git a/packaging/smoke_test/runCases.bat b/packaging/smokeTest/runCases.bat similarity index 100% rename from packaging/smoke_test/runCases.bat rename to packaging/smokeTest/runCases.bat diff --git a/packaging/smoke_test/runCases.sh b/packaging/smokeTest/runCases.sh similarity index 100% rename from packaging/smoke_test/runCases.sh rename to packaging/smokeTest/runCases.sh diff --git a/packaging/smoke_test/smokeTestClient.py b/packaging/smokeTest/smokeTestClient.py similarity index 100% rename from packaging/smoke_test/smokeTestClient.py rename to packaging/smokeTest/smokeTestClient.py diff --git a/packaging/smoke_test/smokeTestJenkinsFile b/packaging/smokeTest/smokeTestJenkinsFile similarity index 100% rename from packaging/smoke_test/smokeTestJenkinsFile rename to packaging/smokeTest/smokeTestJenkinsFile diff --git a/packaging/smoke_test/start3NodesServer.sh b/packaging/smokeTest/start3NodesServer.sh similarity index 100% rename from packaging/smoke_test/start3NodesServer.sh rename to packaging/smokeTest/start3NodesServer.sh diff --git a/packaging/smoke_test/test_client.py b/packaging/smokeTest/test_client.py similarity index 100% rename from packaging/smoke_test/test_client.py rename to packaging/smokeTest/test_client.py diff --git a/packaging/smoke_test/test_server.py b/packaging/smokeTest/test_server.py similarity index 100% rename from packaging/smoke_test/test_server.py rename to packaging/smokeTest/test_server.py diff --git a/packaging/smoke_test/test_server_unix_case b/packaging/smokeTest/test_server_unix_case similarity index 100% rename from packaging/smoke_test/test_server_unix_case rename to packaging/smokeTest/test_server_unix_case diff --git a/packaging/smoke_test/test_server_windows_case b/packaging/smokeTest/test_server_windows_case similarity index 100% rename from packaging/smoke_test/test_server_windows_case rename to packaging/smokeTest/test_server_windows_case diff --git a/packaging/smoke_test/versionCheckAndUninstall.py b/packaging/smokeTest/versionCheckAndUninstall.py similarity index 100% rename from packaging/smoke_test/versionCheckAndUninstall.py rename to packaging/smokeTest/versionCheckAndUninstall.py diff --git a/packaging/smoke_test/versionCheckAndUninstallforPytest.py b/packaging/smokeTest/versionCheckAndUninstallforPytest.py similarity index 100% rename from packaging/smoke_test/versionCheckAndUninstallforPytest.py rename to packaging/smokeTest/versionCheckAndUninstallforPytest.py diff --git a/packaging/smoke_test/pytest_require.txt b/packaging/smoke_test/pytest_require.txt deleted file mode 100644 index eadbe92470dc..000000000000 --- a/packaging/smoke_test/pytest_require.txt +++ /dev/null @@ -1,16 +0,0 @@ -pytest-html -pytest-json-report -pytest-timeout -taospy -numpy -fabric2 -psutil -pandas -toml -distro -requests -pexpect -faker -pyopenssl -taos-ws-py -taospy \ No newline at end of file From a6c7a7c1defc980a59d6cd346eb7f4f9246800b8 Mon Sep 17 00:00:00 2001 From: kailixu Date: Thu, 7 Nov 2024 14:15:22 +0800 Subject: [PATCH 674/695] enh: adjust the num of ins_columns --- tests/system-test/0-others/information_schema.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/system-test/0-others/information_schema.py b/tests/system-test/0-others/information_schema.py index 01e416bb26d3..aa548d4e5981 100644 --- a/tests/system-test/0-others/information_schema.py +++ b/tests/system-test/0-others/information_schema.py @@ -222,7 +222,7 @@ def ins_columns_check(self): tdSql.query("select * from information_schema.ins_columns where db_name ='information_schema'") tdLog.info(len(tdSql.queryResult)) - tdSql.checkEqual(True, len(tdSql.queryResult) in range(280, 281)) + tdSql.checkEqual(True, len(tdSql.queryResult) in range(281, 282)) tdSql.query("select * from information_schema.ins_columns where db_name ='performance_schema'") tdSql.checkEqual(56, len(tdSql.queryResult)) From bc095b5409d5875c617780efde62c07cf9daa599 Mon Sep 17 00:00:00 2001 From: Bo Xiao Date: Thu, 7 Nov 2024 14:45:20 +0800 Subject: [PATCH 675/695] Update 02-database.md Add alter_database_option: MINROWS --- docs/zh/14-reference/03-taos-sql/02-database.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/zh/14-reference/03-taos-sql/02-database.md b/docs/zh/14-reference/03-taos-sql/02-database.md index 24eca979522e..91b39976a1a4 100644 --- a/docs/zh/14-reference/03-taos-sql/02-database.md +++ b/docs/zh/14-reference/03-taos-sql/02-database.md @@ -122,6 +122,7 @@ alter_database_option: { | KEEP value | WAL_RETENTION_PERIOD value | WAL_RETENTION_SIZE value + | MINROWS value } ``` From 7af56a31202d070e9e0b5574fdfce23b4bdae3f0 Mon Sep 17 00:00:00 2001 From: Pengrongkun Date: Thu, 7 Nov 2024 10:27:52 +0800 Subject: [PATCH 676/695] Add TSDB_CODE_TSC_STMT_BIND_NUMBER_ERROR, Clear error message --- include/util/taoserror.h | 1 + source/client/src/clientMain.c | 12 ++++++------ source/util/src/terror.c | 1 + source/util/test/errorCodeTable.ini | 1 + 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/include/util/taoserror.h b/include/util/taoserror.h index 9a8b39b84c99..2c811495fdee 100644 --- a/include/util/taoserror.h +++ b/include/util/taoserror.h @@ -208,6 +208,7 @@ int32_t taosGetErrSize(); #define TSDB_CODE_TSC_COMPRESS_PARAM_ERROR TAOS_DEF_ERROR_CODE(0, 0X0233) #define TSDB_CODE_TSC_COMPRESS_LEVEL_ERROR TAOS_DEF_ERROR_CODE(0, 0X0234) #define TSDB_CODE_TSC_FAIL_GENERATE_JSON TAOS_DEF_ERROR_CODE(0, 0X0235) +#define TSDB_CODE_TSC_STMT_BIND_NUMBER_ERROR TAOS_DEF_ERROR_CODE(0, 0X0236) #define TSDB_CODE_TSC_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0X02FF) // mnode-common diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c index 4a719373f25e..9f6be8e45c89 100644 --- a/source/client/src/clientMain.c +++ b/source/client/src/clientMain.c @@ -1803,7 +1803,7 @@ int taos_stmt_bind_param(TAOS_STMT *stmt, TAOS_MULTI_BIND *bind) { if (bind->num > 1) { tscError("invalid bind number %d for %s", bind->num, __FUNCTION__); - terrno = TSDB_CODE_INVALID_PARA; + terrno = TSDB_CODE_TSC_STMT_BIND_NUMBER_ERROR; return terrno; } @@ -1819,7 +1819,7 @@ int taos_stmt_bind_param_batch(TAOS_STMT *stmt, TAOS_MULTI_BIND *bind) { if (bind->num <= 0 || bind->num > INT16_MAX) { tscError("invalid bind num %d", bind->num); - terrno = TSDB_CODE_INVALID_PARA; + terrno = TSDB_CODE_TSC_STMT_BIND_NUMBER_ERROR; return terrno; } @@ -1831,7 +1831,7 @@ int taos_stmt_bind_param_batch(TAOS_STMT *stmt, TAOS_MULTI_BIND *bind) { } if (0 == insert && bind->num > 1) { tscError("only one row data allowed for query"); - terrno = TSDB_CODE_INVALID_PARA; + terrno = TSDB_CODE_TSC_STMT_BIND_NUMBER_ERROR; return terrno; } @@ -1859,7 +1859,7 @@ int taos_stmt_bind_single_param_batch(TAOS_STMT *stmt, TAOS_MULTI_BIND *bind, in } if (0 == insert && bind->num > 1) { tscError("only one row data allowed for query"); - terrno = TSDB_CODE_INVALID_PARA; + terrno = TSDB_CODE_TSC_STMT_BIND_NUMBER_ERROR; return terrno; } @@ -2019,7 +2019,7 @@ int taos_stmt2_bind_param(TAOS_STMT2 *stmt, TAOS_STMT2_BINDV *bindv, int32_t col if (bind->num <= 0 || bind->num > INT16_MAX) { tscError("invalid bind num %d", bind->num); - terrno = TSDB_CODE_INVALID_PARA; + terrno = TSDB_CODE_TSC_STMT_BIND_NUMBER_ERROR; return terrno; } @@ -2027,7 +2027,7 @@ int taos_stmt2_bind_param(TAOS_STMT2 *stmt, TAOS_STMT2_BINDV *bindv, int32_t col (void)stmtIsInsert2(stmt, &insert); if (0 == insert && bind->num > 1) { tscError("only one row data allowed for query"); - terrno = TSDB_CODE_INVALID_PARA; + terrno = TSDB_CODE_TSC_STMT_BIND_NUMBER_ERROR; return terrno; } diff --git a/source/util/src/terror.c b/source/util/src/terror.c index d660edd0b86e..a5fa9eeb3a34 100644 --- a/source/util/src/terror.c +++ b/source/util/src/terror.c @@ -164,6 +164,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_TSC_ENCODE_PARAM_NULL, "Not found compress pa TAOS_DEFINE_ERROR(TSDB_CODE_TSC_COMPRESS_PARAM_ERROR, "Invalid compress param") TAOS_DEFINE_ERROR(TSDB_CODE_TSC_COMPRESS_LEVEL_ERROR, "Invalid compress level param") TAOS_DEFINE_ERROR(TSDB_CODE_TSC_FAIL_GENERATE_JSON, "failed to generate JSON") +TAOS_DEFINE_ERROR(TSDB_CODE_TSC_STMT_BIND_NUMBER_ERROR, "bind number out of range or not match") TAOS_DEFINE_ERROR(TSDB_CODE_TSC_INTERNAL_ERROR, "Internal error") diff --git a/source/util/test/errorCodeTable.ini b/source/util/test/errorCodeTable.ini index 33c9d77c5e76..e837954a0bf8 100644 --- a/source/util/test/errorCodeTable.ini +++ b/source/util/test/errorCodeTable.ini @@ -97,6 +97,7 @@ TSDB_CODE_TSC_ENCODE_PARAM_ERROR = 0x80000231 TSDB_CODE_TSC_ENCODE_PARAM_NULL = 0x80000232 TSDB_CODE_TSC_COMPRESS_PARAM_ERROR = 0x80000233 TSDB_CODE_TSC_COMPRESS_LEVEL_ERROR = 0x80000234 +TSDB_CODE_TSC_STMT_BIND_NUMBER_ERROR = 0x80000236 TSDB_CODE_TSC_INTERNAL_ERROR = 0x800002FF TSDB_CODE_MND_REQ_REJECTED = 0x80000300 TSDB_CODE_MND_NO_RIGHTS = 0x80000303 From 9473668dd4d7597ff22c506749c7dfefd1e5882a Mon Sep 17 00:00:00 2001 From: haoranchen Date: Thu, 7 Nov 2024 15:46:57 +0800 Subject: [PATCH 677/695] Update test_server.py --- packaging/smokeTest/test_server.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/smokeTest/test_server.py b/packaging/smokeTest/test_server.py index 768cd2a96214..36d86357a388 100644 --- a/packaging/smokeTest/test_server.py +++ b/packaging/smokeTest/test_server.py @@ -40,7 +40,7 @@ def get_config(request): def setup_module(get_config): def run_cmd(command): print("CMD:", command) - result = subprocess.run(command, capture_output=True, text=False, shell=False) + result = subprocess.run(command, capture_output=True, text=True, shell=True) print("STDOUT:", result.stdout) print("STDERR:", result.stderr) print("Return Code:", result.returncode) From fa62b95b1fb46b827995c5bc9528c8ccacd296ec Mon Sep 17 00:00:00 2001 From: chenhaoran Date: Thu, 7 Nov 2024 16:20:33 +0800 Subject: [PATCH 678/695] test: add smoke test scripts --- packaging/delete_ref_lock.py | 59 +++++ packaging/smoke_test/assets/style.css | 319 ++++++++++++++++++++++++ packaging/smoke_test/pytest_require.txt | 16 ++ 3 files changed, 394 insertions(+) create mode 100644 packaging/delete_ref_lock.py create mode 100644 packaging/smoke_test/assets/style.css create mode 100644 packaging/smoke_test/pytest_require.txt diff --git a/packaging/delete_ref_lock.py b/packaging/delete_ref_lock.py new file mode 100644 index 000000000000..cf0e4cdd058a --- /dev/null +++ b/packaging/delete_ref_lock.py @@ -0,0 +1,59 @@ +import subprocess +import re + +# 执行 git fetch 命令并捕获输出 +def git_fetch(): + result = subprocess.run(['git', 'fetch'], capture_output=True, text=True) + return result + +# 解析分支名称 +def parse_branch_name_type1(error_output): + # 使用正则表达式匹配 'is at' 前的分支名称 + match = re.search(r"error: cannot lock ref '(refs/remotes/origin/[^']+)': is at", error_output) + if match: + return match.group(1) + return None + +# 解析第二种错误中的分支名称 +def parse_branch_name_type2(error_output): + # 使用正则表达式匹配 'exists' 前的第一个引号内的分支名称 + match = re.search(r"'(refs/remotes/origin/[^']+)' exists;", error_output) + if match: + return match.group(1) + return None + +# 执行 git update-ref -d 命令 +def git_update_ref(branch_name): + if branch_name: + subprocess.run(['git', 'update-ref', '-d', f'{branch_name}'], check=True) + +# 解析错误类型并执行相应的修复操作 +def handle_error(error_output): + # 错误类型1:本地引用的提交ID与远程不一致 + if "is at" in error_output and "but expected" in error_output: + branch_name = parse_branch_name_type1(error_output) + if branch_name: + print(f"Detected error type 1, attempting to delete ref for branch: {branch_name}") + git_update_ref(branch_name) + else: + print("Error parsing branch name for type 1.") + # 错误类型2:尝试创建新的远程引用时,本地已经存在同名的引用 + elif "exists; cannot create" in error_output: + branch_name = parse_branch_name_type2(error_output) + if branch_name: + print(f"Detected error type 2, attempting to delete ref for branch: {branch_name}") + git_update_ref(branch_name) + else: + print("Error parsing branch name for type 2.") + +# 主函数 +def main(): + fetch_result = git_fetch() + if fetch_result.returncode != 0: # 如果 git fetch 命令失败 + error_output = fetch_result.stderr + handle_error(error_output) + else: + print("Git fetch successful.") + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/packaging/smoke_test/assets/style.css b/packaging/smoke_test/assets/style.css new file mode 100644 index 000000000000..c89d42818c65 --- /dev/null +++ b/packaging/smoke_test/assets/style.css @@ -0,0 +1,319 @@ +body { + font-family: Helvetica, Arial, sans-serif; + font-size: 12px; + /* do not increase min-width as some may use split screens */ + min-width: 800px; + color: #999; + } + + h1 { + font-size: 24px; + color: black; + } + + h2 { + font-size: 16px; + color: black; + } + + p { + color: black; + } + + a { + color: #999; + } + + table { + border-collapse: collapse; + } + + /****************************** + * SUMMARY INFORMATION + ******************************/ + #environment td { + padding: 5px; + border: 1px solid #e6e6e6; + vertical-align: top; + } + #environment tr:nth-child(odd) { + background-color: #f6f6f6; + } + #environment ul { + margin: 0; + padding: 0 20px; + } + + /****************************** + * TEST RESULT COLORS + ******************************/ + span.passed, + .passed .col-result { + color: green; + } + + span.skipped, + span.xfailed, + span.rerun, + .skipped .col-result, + .xfailed .col-result, + .rerun .col-result { + color: orange; + } + + span.error, + span.failed, + span.xpassed, + .error .col-result, + .failed .col-result, + .xpassed .col-result { + color: red; + } + + .col-links__extra { + margin-right: 3px; + } + + /****************************** + * RESULTS TABLE + * + * 1. Table Layout + * 2. Extra + * 3. Sorting items + * + ******************************/ + /*------------------ + * 1. Table Layout + *------------------*/ + #results-table { + border: 1px solid #e6e6e6; + color: #999; + font-size: 12px; + width: 100%; + } + #results-table th, + #results-table td { + padding: 5px; + border: 1px solid #e6e6e6; + text-align: left; + } + #results-table th { + font-weight: bold; + } + + /*------------------ + * 2. Extra + *------------------*/ + .logwrapper { + max-height: 230px; + overflow-y: scroll; + background-color: #e6e6e6; + } + .logwrapper.expanded { + max-height: none; + } + .logwrapper.expanded .logexpander:after { + content: "collapse [-]"; + } + .logwrapper .logexpander { + z-index: 1; + position: sticky; + top: 10px; + width: max-content; + border: 1px solid; + border-radius: 3px; + padding: 5px 7px; + margin: 10px 0 10px calc(100% - 80px); + cursor: pointer; + background-color: #e6e6e6; + } + .logwrapper .logexpander:after { + content: "expand [+]"; + } + .logwrapper .logexpander:hover { + color: #000; + border-color: #000; + } + .logwrapper .log { + min-height: 40px; + position: relative; + top: -50px; + height: calc(100% + 50px); + border: 1px solid #e6e6e6; + color: black; + display: block; + font-family: "Courier New", Courier, monospace; + padding: 5px; + padding-right: 80px; + white-space: pre-wrap; + } + + div.media { + border: 1px solid #e6e6e6; + float: right; + height: 240px; + margin: 0 5px; + overflow: hidden; + width: 320px; + } + + .media-container { + display: grid; + grid-template-columns: 25px auto 25px; + align-items: center; + flex: 1 1; + overflow: hidden; + height: 200px; + } + + .media-container--fullscreen { + grid-template-columns: 0px auto 0px; + } + + .media-container__nav--right, + .media-container__nav--left { + text-align: center; + cursor: pointer; + } + + .media-container__viewport { + cursor: pointer; + text-align: center; + height: inherit; + } + .media-container__viewport img, + .media-container__viewport video { + object-fit: cover; + width: 100%; + max-height: 100%; + } + + .media__name, + .media__counter { + display: flex; + flex-direction: row; + justify-content: space-around; + flex: 0 0 25px; + align-items: center; + } + + .collapsible td:not(.col-links) { + cursor: pointer; + } + .collapsible td:not(.col-links):hover::after { + color: #bbb; + font-style: italic; + cursor: pointer; + } + + .col-result { + width: 130px; + } + .col-result:hover::after { + content: " (hide details)"; + } + + .col-result.collapsed:hover::after { + content: " (show details)"; + } + + #environment-header h2:hover::after { + content: " (hide details)"; + color: #bbb; + font-style: italic; + cursor: pointer; + font-size: 12px; + } + + #environment-header.collapsed h2:hover::after { + content: " (show details)"; + color: #bbb; + font-style: italic; + cursor: pointer; + font-size: 12px; + } + + /*------------------ + * 3. Sorting items + *------------------*/ + .sortable { + cursor: pointer; + } + .sortable.desc:after { + content: " "; + position: relative; + left: 5px; + bottom: -12.5px; + border: 10px solid #4caf50; + border-bottom: 0; + border-left-color: transparent; + border-right-color: transparent; + } + .sortable.asc:after { + content: " "; + position: relative; + left: 5px; + bottom: 12.5px; + border: 10px solid #4caf50; + border-top: 0; + border-left-color: transparent; + border-right-color: transparent; + } + + .hidden, .summary__reload__button.hidden { + display: none; + } + + .summary__data { + flex: 0 0 550px; + } + .summary__reload { + flex: 1 1; + display: flex; + justify-content: center; + } + .summary__reload__button { + flex: 0 0 300px; + display: flex; + color: white; + font-weight: bold; + background-color: #4caf50; + text-align: center; + justify-content: center; + align-items: center; + border-radius: 3px; + cursor: pointer; + } + .summary__reload__button:hover { + background-color: #46a049; + } + .summary__spacer { + flex: 0 0 550px; + } + + .controls { + display: flex; + justify-content: space-between; + } + + .filters, + .collapse { + display: flex; + align-items: center; + } + .filters button, + .collapse button { + color: #999; + border: none; + background: none; + cursor: pointer; + text-decoration: underline; + } + .filters button:hover, + .collapse button:hover { + color: #ccc; + } + + .filter__label { + margin-right: 10px; + } \ No newline at end of file diff --git a/packaging/smoke_test/pytest_require.txt b/packaging/smoke_test/pytest_require.txt new file mode 100644 index 000000000000..eadbe92470dc --- /dev/null +++ b/packaging/smoke_test/pytest_require.txt @@ -0,0 +1,16 @@ +pytest-html +pytest-json-report +pytest-timeout +taospy +numpy +fabric2 +psutil +pandas +toml +distro +requests +pexpect +faker +pyopenssl +taos-ws-py +taospy \ No newline at end of file From 446122ad9650258832e1a212232dc961152e7fc2 Mon Sep 17 00:00:00 2001 From: chenhaoran Date: Thu, 7 Nov 2024 16:22:30 +0800 Subject: [PATCH 679/695] test: add smoke test scripts --- packaging/{smoke_test => smokeTest}/assets/style.css | 0 packaging/smoke_test/pytest_require.txt | 3 ++- 2 files changed, 2 insertions(+), 1 deletion(-) rename packaging/{smoke_test => smokeTest}/assets/style.css (100%) diff --git a/packaging/smoke_test/assets/style.css b/packaging/smokeTest/assets/style.css similarity index 100% rename from packaging/smoke_test/assets/style.css rename to packaging/smokeTest/assets/style.css diff --git a/packaging/smoke_test/pytest_require.txt b/packaging/smoke_test/pytest_require.txt index eadbe92470dc..34019c6e8a7d 100644 --- a/packaging/smoke_test/pytest_require.txt +++ b/packaging/smoke_test/pytest_require.txt @@ -13,4 +13,5 @@ pexpect faker pyopenssl taos-ws-py -taospy \ No newline at end of file +taospy +tzlocal \ No newline at end of file From 234846b5436dd00f447f0cfd1ea182253b3eef4e Mon Sep 17 00:00:00 2001 From: chenhaoran Date: Thu, 7 Nov 2024 16:24:54 +0800 Subject: [PATCH 680/695] test: add smoke test scripts --- .gitignore | 2 +- packaging/{smoke_test => smokeTest}/pytest_require.txt | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename packaging/{smoke_test => smokeTest}/pytest_require.txt (100%) diff --git a/.gitignore b/.gitignore index 7f2382db8707..8f461f2b0228 100644 --- a/.gitignore +++ b/.gitignore @@ -161,4 +161,4 @@ version.h geos_c.h source/libs/parser/src/sql.c include/common/ttokenauto.h -!packaging/smoke_test/pytest_require.txt +!packaging/smokeTest/pytest_require.txt diff --git a/packaging/smoke_test/pytest_require.txt b/packaging/smokeTest/pytest_require.txt similarity index 100% rename from packaging/smoke_test/pytest_require.txt rename to packaging/smokeTest/pytest_require.txt From daedcc53fb2b84b5a9acafffb0486cb3b84dd952 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Thu, 7 Nov 2024 16:28:47 +0800 Subject: [PATCH 681/695] refactor: return the error code and do some refactor. --- .../libs/executor/src/anomalywindowoperator.c | 17 ++++++++++++----- source/util/src/tanal.c | 3 +++ source/util/src/terror.c | 4 ++-- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/source/libs/executor/src/anomalywindowoperator.c b/source/libs/executor/src/anomalywindowoperator.c index d03e527c2ba0..6adfbc6c7731 100644 --- a/source/libs/executor/src/anomalywindowoperator.c +++ b/source/libs/executor/src/anomalywindowoperator.c @@ -55,7 +55,7 @@ typedef struct { static void anomalyDestroyOperatorInfo(void* param); static int32_t anomalyAggregateNext(SOperatorInfo* pOperator, SSDataBlock** ppRes); -static void anomalyAggregateBlocks(SOperatorInfo* pOperator); +static int32_t anomalyAggregateBlocks(SOperatorInfo* pOperator); static int32_t anomalyCacheBlock(SAnomalyWindowOperatorInfo* pInfo, SSDataBlock* pBlock); int32_t createAnomalywindowOperatorInfo(SOperatorInfo* downstream, SPhysiNode* physiNode, SExecTaskInfo* pTaskInfo, @@ -78,6 +78,7 @@ int32_t createAnomalywindowOperatorInfo(SOperatorInfo* downstream, SPhysiNode* p code = TSDB_CODE_ANAL_ALGO_NOT_FOUND; goto _error; } + if (taosAnalGetAlgoUrl(pInfo->algoName, ANAL_ALGO_TYPE_ANOMALY_DETECT, pInfo->algoUrl, sizeof(pInfo->algoUrl)) != 0) { qError("failed to get anomaly_window algorithm url from %s", pInfo->algoName); code = TSDB_CODE_ANAL_ALGO_NOT_LOAD; @@ -198,7 +199,9 @@ static int32_t anomalyAggregateNext(SOperatorInfo* pOperator, SSDataBlock** ppRe QUERY_CHECK_CODE(code, lino, _end); } else { qDebug("group:%" PRId64 ", read finish for new group coming, blocks:%d", pSupp->groupId, numOfBlocks); - anomalyAggregateBlocks(pOperator); + code = anomalyAggregateBlocks(pOperator); + QUERY_CHECK_CODE(code, lino, _end); + pSupp->groupId = pBlock->info.id.groupId; numOfBlocks = 1; pSupp->cachedRows = pBlock->info.rows; @@ -217,7 +220,7 @@ static int32_t anomalyAggregateNext(SOperatorInfo* pOperator, SSDataBlock** ppRe if (numOfBlocks > 0) { qDebug("group:%" PRId64 ", read finish, blocks:%d", pInfo->anomalySup.groupId, numOfBlocks); - anomalyAggregateBlocks(pOperator); + code = anomalyAggregateBlocks(pOperator); } int64_t cost = taosGetTimestampUs() - st; @@ -229,6 +232,7 @@ static int32_t anomalyAggregateNext(SOperatorInfo* pOperator, SSDataBlock** ppRe pTaskInfo->code = code; T_LONG_JMP(pTaskInfo->env, code); } + (*ppRes) = (pBInfo->pRes->info.rows == 0) ? NULL : pBInfo->pRes; return code; } @@ -338,8 +342,8 @@ static int32_t anomalyAnalysisWindow(SOperatorInfo* pOperator) { SAnalBuf analBuf = {.bufType = ANAL_BUF_TYPE_JSON}; char dataBuf[64] = {0}; int32_t code = 0; + int64_t ts = 0; - int64_t ts = 0; // int64_t ts = taosGetTimestampMs(); snprintf(analBuf.fileName, sizeof(analBuf.fileName), "%s/tdengine-anomaly-%" PRId64 "-%" PRId64, tsTempDir, ts, pSupp->groupId); @@ -431,6 +435,7 @@ static int32_t anomalyAnalysisWindow(SOperatorInfo* pOperator) { if (code != 0) { qError("failed to analysis window since %s", tstrerror(code)); } + taosAnalBufDestroy(&analBuf); if (pJson != NULL) tjsonDelete(pJson); return code; @@ -473,7 +478,7 @@ static int32_t anomalyBuildResult(SOperatorInfo* pOperator) { return code; } -static void anomalyAggregateBlocks(SOperatorInfo* pOperator) { +static int32_t anomalyAggregateBlocks(SOperatorInfo* pOperator) { int32_t code = TSDB_CODE_SUCCESS; int32_t lino = 0; SAnomalyWindowOperatorInfo* pInfo = pOperator->info; @@ -623,6 +628,8 @@ static void anomalyAggregateBlocks(SOperatorInfo* pOperator) { pSupp->curWin.ekey = 0; pSupp->curWin.skey = 0; pSupp->curWinIndex = 0; + + return code; } #else diff --git a/source/util/src/tanal.c b/source/util/src/tanal.c index 92eee28ba87a..bb46a48c4298 100644 --- a/source/util/src/tanal.c +++ b/source/util/src/tanal.c @@ -167,6 +167,8 @@ int32_t taosAnalGetAlgoUrl(const char *algoName, EAnalAlgoType type, char *url, char name[TSDB_ANAL_ALGO_KEY_LEN] = {0}; int32_t nameLen = 1 + tsnprintf(name, sizeof(name) - 1, "%d:%s", type, algoName); + char *unused = strntolower(name, name, nameLen); + if (taosThreadMutexLock(&tsAlgos.lock) == 0) { SAnalUrl *pUrl = taosHashAcquire(tsAlgos.hash, name, nameLen); if (pUrl != NULL) { @@ -178,6 +180,7 @@ int32_t taosAnalGetAlgoUrl(const char *algoName, EAnalAlgoType type, char *url, code = terrno; uError("algo:%s, type:%s, url not found", algoName, taosAnalAlgoStr(type)); } + if (taosThreadMutexUnlock(&tsAlgos.lock) != 0) { uError("failed to unlock hash"); return TSDB_CODE_OUT_OF_MEMORY; diff --git a/source/util/src/terror.c b/source/util/src/terror.c index d660edd0b86e..ce209cc7184f 100644 --- a/source/util/src/terror.c +++ b/source/util/src/terror.c @@ -360,8 +360,8 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_ANODE_TOO_MANY_ALGO, "Anode too many algori TAOS_DEFINE_ERROR(TSDB_CODE_MND_ANODE_TOO_LONG_ALGO_NAME, "Anode too long algorithm name") TAOS_DEFINE_ERROR(TSDB_CODE_MND_ANODE_TOO_MANY_ALGO_TYPE, "Anode too many algorithm type") -TAOS_DEFINE_ERROR(TSDB_CODE_ANAL_URL_RSP_IS_NULL, "Analysis url response is NULL") -TAOS_DEFINE_ERROR(TSDB_CODE_ANAL_URL_CANT_ACCESS, "Analysis url can't access") +TAOS_DEFINE_ERROR(TSDB_CODE_ANAL_URL_RSP_IS_NULL, "Analysis service response is NULL") +TAOS_DEFINE_ERROR(TSDB_CODE_ANAL_URL_CANT_ACCESS, "Analysis service can't access") TAOS_DEFINE_ERROR(TSDB_CODE_ANAL_ALGO_NOT_FOUND, "Analysis algorithm not found") TAOS_DEFINE_ERROR(TSDB_CODE_ANAL_ALGO_NOT_LOAD, "Analysis algorithm not loaded") TAOS_DEFINE_ERROR(TSDB_CODE_ANAL_BUF_INVALID_TYPE, "Analysis invalid buffer type") From a8f7f153d92ce3ddb4dba07af57d7ec45fcb1bad Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Thu, 7 Nov 2024 16:44:43 +0800 Subject: [PATCH 682/695] refactor: do some internal refacrtor. --- include/common/{tanal.h => tanalytics.h} | 10 +++---- source/common/src/tmsg.c | 12 ++++---- source/dnode/mgmt/mgmt_dnode/src/dmHandle.c | 2 +- source/dnode/mgmt/mgmt_dnode/src/dmInt.c | 4 +-- source/dnode/mgmt/node_mgmt/src/dmEnv.c | 4 +-- source/dnode/mgmt/node_mgmt/src/dmTransport.c | 2 +- source/dnode/mnode/impl/CMakeLists.txt | 2 +- source/dnode/mnode/impl/src/mndAnode.c | 10 +++---- source/libs/executor/CMakeLists.txt | 2 +- .../libs/executor/src/anomalywindowoperator.c | 4 +-- source/libs/executor/src/forecastoperator.c | 4 +-- source/libs/function/src/builtins.c | 2 +- source/libs/function/src/builtinsimpl.c | 2 +- source/libs/parser/src/parTranslater.c | 2 +- source/util/CMakeLists.txt | 2 +- source/util/src/{tanal.c => tanalytics.c} | 29 +++++++++---------- 16 files changed, 46 insertions(+), 47 deletions(-) rename include/common/{tanal.h => tanalytics.h} (96%) rename source/util/src/{tanal.c => tanalytics.c} (97%) diff --git a/include/common/tanal.h b/include/common/tanalytics.h similarity index 96% rename from include/common/tanal.h rename to include/common/tanalytics.h index 69d110d161d4..85eb963129fb 100644 --- a/include/common/tanal.h +++ b/include/common/tanalytics.h @@ -36,7 +36,7 @@ typedef struct { int32_t anode; int32_t urlLen; char *url; -} SAnalUrl; +} SAnalyticsUrl; typedef enum { ANAL_BUF_TYPE_JSON = 0, @@ -53,18 +53,18 @@ typedef struct { TdFilePtr filePtr; char fileName[TSDB_FILENAME_LEN + 10]; int64_t numOfRows; -} SAnalColBuf; +} SAnalyticsColBuf; typedef struct { EAnalBufType bufType; TdFilePtr filePtr; char fileName[TSDB_FILENAME_LEN]; int32_t numOfCols; - SAnalColBuf *pCols; + SAnalyticsColBuf *pCols; } SAnalBuf; -int32_t taosAnalInit(); -void taosAnalCleanup(); +int32_t taosAnalyticsInit(); +void taosAnalyticsCleanup(); SJson *taosAnalSendReqRetJson(const char *url, EAnalHttpType type, SAnalBuf *pBuf); int32_t taosAnalGetAlgoUrl(const char *algoName, EAnalAlgoType type, char *url, int32_t urlLen); diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index 458badc7640e..6d1699b91165 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -40,7 +40,7 @@ #define TD_MSG_RANGE_CODE_ #include "tmsgdef.h" -#include "tanal.h" +#include "tanalytics.h" #include "tcol.h" #include "tlog.h" @@ -2166,7 +2166,7 @@ int32_t tSerializeRetrieveAnalAlgoRsp(void *buf, int32_t bufLen, SRetrieveAnalAl int32_t numOfAlgos = 0; void *pIter = taosHashIterate(pRsp->hash, NULL); while (pIter != NULL) { - SAnalUrl *pUrl = pIter; + SAnalyticsUrl *pUrl = pIter; size_t nameLen = 0; const char *name = taosHashGetKey(pIter, &nameLen); if (nameLen > 0 && nameLen <= TSDB_ANAL_ALGO_KEY_LEN && pUrl->urlLen > 0) { @@ -2181,7 +2181,7 @@ int32_t tSerializeRetrieveAnalAlgoRsp(void *buf, int32_t bufLen, SRetrieveAnalAl pIter = taosHashIterate(pRsp->hash, NULL); while (pIter != NULL) { - SAnalUrl *pUrl = pIter; + SAnalyticsUrl *pUrl = pIter; size_t nameLen = 0; const char *name = taosHashGetKey(pIter, &nameLen); if (nameLen > 0 && pUrl->urlLen > 0) { @@ -2225,7 +2225,7 @@ int32_t tDeserializeRetrieveAnalAlgoRsp(void *buf, int32_t bufLen, SRetrieveAnal int32_t nameLen; int32_t type; char name[TSDB_ANAL_ALGO_KEY_LEN]; - SAnalUrl url = {0}; + SAnalyticsUrl url = {0}; TAOS_CHECK_EXIT(tStartDecode(&decoder)); TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pRsp->ver)); @@ -2245,7 +2245,7 @@ int32_t tDeserializeRetrieveAnalAlgoRsp(void *buf, int32_t bufLen, SRetrieveAnal TAOS_CHECK_EXIT(tDecodeBinaryAlloc(&decoder, (void **)&url.url, NULL) < 0); } - TAOS_CHECK_EXIT(taosHashPut(pRsp->hash, name, nameLen, &url, sizeof(SAnalUrl))); + TAOS_CHECK_EXIT(taosHashPut(pRsp->hash, name, nameLen, &url, sizeof(SAnalyticsUrl))); } tEndDecode(&decoder); @@ -2258,7 +2258,7 @@ int32_t tDeserializeRetrieveAnalAlgoRsp(void *buf, int32_t bufLen, SRetrieveAnal void tFreeRetrieveAnalAlgoRsp(SRetrieveAnalAlgoRsp *pRsp) { void *pIter = taosHashIterate(pRsp->hash, NULL); while (pIter != NULL) { - SAnalUrl *pUrl = (SAnalUrl *)pIter; + SAnalyticsUrl *pUrl = (SAnalyticsUrl *)pIter; taosMemoryFree(pUrl->url); pIter = taosHashIterate(pRsp->hash, pIter); } diff --git a/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c b/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c index d6b792ca74bd..78cc35a62c1d 100644 --- a/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c +++ b/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c @@ -18,7 +18,7 @@ #include "dmInt.h" #include "monitor.h" #include "systable.h" -#include "tanal.h" +#include "tanalytics.h" #include "tchecksum.h" extern SConfig *tsCfg; diff --git a/source/dnode/mgmt/mgmt_dnode/src/dmInt.c b/source/dnode/mgmt/mgmt_dnode/src/dmInt.c index 04b4e9101ca9..fb7d891c67cd 100644 --- a/source/dnode/mgmt/mgmt_dnode/src/dmInt.c +++ b/source/dnode/mgmt/mgmt_dnode/src/dmInt.c @@ -16,7 +16,7 @@ #define _DEFAULT_SOURCE #include "dmInt.h" #include "libs/function/tudf.h" -#include "tanal.h" +#include "tanalytics.h" static int32_t dmStartMgmt(SDnodeMgmt *pMgmt) { int32_t code = 0; @@ -85,7 +85,7 @@ static int32_t dmOpenMgmt(SMgmtInputOpt *pInput, SMgmtOutputOpt *pOutput) { dError("failed to start udfd since %s", tstrerror(code)); } - if ((code = taosAnalInit()) != 0) { + if ((code = taosAnalyticsInit()) != 0) { dError("failed to init analysis env since %s", tstrerror(code)); } diff --git a/source/dnode/mgmt/node_mgmt/src/dmEnv.c b/source/dnode/mgmt/node_mgmt/src/dmEnv.c index 694cc52d6472..6d4ebe424a58 100644 --- a/source/dnode/mgmt/node_mgmt/src/dmEnv.c +++ b/source/dnode/mgmt/node_mgmt/src/dmEnv.c @@ -21,7 +21,7 @@ #include "tgrant.h" #include "tcompare.h" #include "tcs.h" -#include "tanal.h" +#include "tanalytics.h" // clang-format on #define DM_INIT_AUDIT() \ @@ -209,7 +209,7 @@ void dmCleanup() { dError("failed to close udfc"); } udfStopUdfd(); - taosAnalCleanup(); + taosAnalyticsCleanup(); taosStopCacheRefreshWorker(); (void)dmDiskClose(); DestroyRegexCache(); diff --git a/source/dnode/mgmt/node_mgmt/src/dmTransport.c b/source/dnode/mgmt/node_mgmt/src/dmTransport.c index 5a276de251b9..61543e619e28 100644 --- a/source/dnode/mgmt/node_mgmt/src/dmTransport.c +++ b/source/dnode/mgmt/node_mgmt/src/dmTransport.c @@ -16,7 +16,7 @@ #define _DEFAULT_SOURCE #include "dmMgmt.h" #include "qworker.h" -#include "tanal.h" +#include "tanalytics.h" #include "tversion.h" static inline void dmSendRsp(SRpcMsg *pMsg) { diff --git a/source/dnode/mnode/impl/CMakeLists.txt b/source/dnode/mnode/impl/CMakeLists.txt index 8a390948aebc..ad36d8c8aea9 100644 --- a/source/dnode/mnode/impl/CMakeLists.txt +++ b/source/dnode/mnode/impl/CMakeLists.txt @@ -18,7 +18,7 @@ if(TD_ENTERPRISE) endif() if(${BUILD_WITH_ANALYSIS}) - add_definitions(-DUSE_ANAL) + add_definitions(-DUSE_ANALYTICS) endif() endif() diff --git a/source/dnode/mnode/impl/src/mndAnode.c b/source/dnode/mnode/impl/src/mndAnode.c index 17e3e84c810f..87bfe9f7afa9 100644 --- a/source/dnode/mnode/impl/src/mndAnode.c +++ b/source/dnode/mnode/impl/src/mndAnode.c @@ -21,10 +21,10 @@ #include "mndShow.h" #include "mndTrans.h" #include "mndUser.h" -#include "tanal.h" +#include "tanalytics.h" #include "tjson.h" -#ifdef USE_ANAL +#ifdef USE_ANALYTICS #define TSDB_ANODE_VER_NUMBER 1 #define TSDB_ANODE_RESERVE_SIZE 64 @@ -806,7 +806,7 @@ static int32_t mndProcessAnalAlgoReq(SRpcMsg *pReq) { SSdb *pSdb = pMnode->pSdb; int32_t code = -1; SAnodeObj *pObj = NULL; - SAnalUrl url; + SAnalyticsUrl url; int32_t nameLen; char name[TSDB_ANAL_ALGO_KEY_LEN]; SRetrieveAnalAlgoReq req = {0}; @@ -838,7 +838,7 @@ static int32_t mndProcessAnalAlgoReq(SRpcMsg *pReq) { SAnodeAlgo *algo = taosArrayGet(algos, a); nameLen = 1 + tsnprintf(name, sizeof(name) - 1, "%d:%s", url.type, algo->name); - SAnalUrl *pOldUrl = taosHashAcquire(rsp.hash, name, nameLen); + SAnalyticsUrl *pOldUrl = taosHashAcquire(rsp.hash, name, nameLen); if (pOldUrl == NULL || (pOldUrl != NULL && pOldUrl->anode < url.anode)) { if (pOldUrl != NULL) { taosMemoryFreeClear(pOldUrl->url); @@ -855,7 +855,7 @@ static int32_t mndProcessAnalAlgoReq(SRpcMsg *pReq) { url.urlLen = 1 + tsnprintf(url.url, TSDB_ANAL_ANODE_URL_LEN + TSDB_ANAL_ALGO_TYPE_LEN, "%s/%s", pAnode->url, taosAnalAlgoUrlStr(url.type)); - if (taosHashPut(rsp.hash, name, nameLen, &url, sizeof(SAnalUrl)) != 0) { + if (taosHashPut(rsp.hash, name, nameLen, &url, sizeof(SAnalyticsUrl)) != 0) { taosMemoryFree(url.url); sdbRelease(pSdb, pAnode); goto _OVER; diff --git a/source/libs/executor/CMakeLists.txt b/source/libs/executor/CMakeLists.txt index 014b53837559..9a49076b6b0c 100644 --- a/source/libs/executor/CMakeLists.txt +++ b/source/libs/executor/CMakeLists.txt @@ -7,7 +7,7 @@ if(${TD_DARWIN}) endif(${TD_DARWIN}) if(${BUILD_WITH_ANALYSIS}) - add_definitions(-DUSE_ANAL) + add_definitions(-DUSE_ANALYTICS) endif() target_link_libraries(executor diff --git a/source/libs/executor/src/anomalywindowoperator.c b/source/libs/executor/src/anomalywindowoperator.c index 6adfbc6c7731..94cc5d912956 100644 --- a/source/libs/executor/src/anomalywindowoperator.c +++ b/source/libs/executor/src/anomalywindowoperator.c @@ -19,14 +19,14 @@ #include "functionMgt.h" #include "operator.h" #include "querytask.h" -#include "tanal.h" +#include "tanalytics.h" #include "tcommon.h" #include "tcompare.h" #include "tdatablock.h" #include "tjson.h" #include "ttime.h" -#ifdef USE_ANAL +#ifdef USE_ANALYTICS typedef struct { SArray* blocks; // SSDataBlock* diff --git a/source/libs/executor/src/forecastoperator.c b/source/libs/executor/src/forecastoperator.c index 0afa933ee83a..20dc9e28ba7b 100644 --- a/source/libs/executor/src/forecastoperator.c +++ b/source/libs/executor/src/forecastoperator.c @@ -19,14 +19,14 @@ #include "operator.h" #include "querytask.h" #include "storageapi.h" -#include "tanal.h" +#include "tanalytics.h" #include "tcommon.h" #include "tcompare.h" #include "tdatablock.h" #include "tfill.h" #include "ttime.h" -#ifdef USE_ANAL +#ifdef USE_ANALYTICS typedef struct { char algoName[TSDB_ANAL_ALGO_NAME_LEN]; diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c index 552933dcad36..2d68eb9d51c3 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -19,7 +19,7 @@ #include "geomFunc.h" #include "querynodes.h" #include "scalar.h" -#include "tanal.h" +#include "tanalytics.h" #include "taoserror.h" #include "ttime.h" diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c index 0aad1501cebb..acdac7cbc398 100644 --- a/source/libs/function/src/builtinsimpl.c +++ b/source/libs/function/src/builtinsimpl.c @@ -19,7 +19,7 @@ #include "functionResInfoInt.h" #include "query.h" #include "querynodes.h" -#include "tanal.h" +#include "tanalytics.h" #include "tcompare.h" #include "tdatablock.h" #include "tdigest.h" diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 02295b34da8a..99c03c412ce3 100755 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -24,7 +24,7 @@ #include "parUtil.h" #include "scalar.h" #include "systable.h" -#include "tanal.h" +#include "tanalytics.h" #include "tcol.h" #include "tglobal.h" #include "ttime.h" diff --git a/source/util/CMakeLists.txt b/source/util/CMakeLists.txt index 7f5955f3ddb6..2633bb3268d4 100644 --- a/source/util/CMakeLists.txt +++ b/source/util/CMakeLists.txt @@ -18,7 +18,7 @@ else() endif(${ASSERT_NOT_CORE}) if(${BUILD_WITH_ANALYSIS}) - add_definitions(-DUSE_ANAL) + add_definitions(-DUSE_ANALYTICS) endif() target_include_directories( diff --git a/source/util/src/tanal.c b/source/util/src/tanalytics.c similarity index 97% rename from source/util/src/tanal.c rename to source/util/src/tanalytics.c index bb46a48c4298..99d91700a2ea 100644 --- a/source/util/src/tanal.c +++ b/source/util/src/tanalytics.c @@ -14,18 +14,17 @@ */ #define _DEFAULT_SOURCE -#include "tanal.h" -#include "tmsg.h" +#include "tanalytics.h" #include "ttypes.h" #include "tutil.h" -#ifdef USE_ANAL +#ifdef USE_ANALYTICS #include #define ANAL_ALGO_SPLIT "," typedef struct { int64_t ver; - SHashObj *hash; // algoname:algotype -> SAnalUrl + SHashObj *hash; // algoname:algotype -> SAnalyticsUrl TdThreadMutex lock; } SAlgoMgmt; @@ -69,7 +68,7 @@ EAnalAlgoType taosAnalAlgoInt(const char *name) { return ANAL_ALGO_TYPE_END; } -int32_t taosAnalInit() { +int32_t taosAnalyticsInit() { if (curl_global_init(CURL_GLOBAL_ALL) != 0) { uError("failed to init curl"); return -1; @@ -94,14 +93,14 @@ int32_t taosAnalInit() { static void taosAnalFreeHash(SHashObj *hash) { void *pIter = taosHashIterate(hash, NULL); while (pIter != NULL) { - SAnalUrl *pUrl = (SAnalUrl *)pIter; + SAnalyticsUrl *pUrl = (SAnalyticsUrl *)pIter; taosMemoryFree(pUrl->url); pIter = taosHashIterate(hash, pIter); } taosHashCleanup(hash); } -void taosAnalCleanup() { +void taosAnalyticsCleanup() { curl_global_cleanup(); if (taosThreadMutexDestroy(&tsAlgos.lock) != 0) { uError("failed to destroy anal lock"); @@ -170,7 +169,7 @@ int32_t taosAnalGetAlgoUrl(const char *algoName, EAnalAlgoType type, char *url, char *unused = strntolower(name, name, nameLen); if (taosThreadMutexLock(&tsAlgos.lock) == 0) { - SAnalUrl *pUrl = taosHashAcquire(tsAlgos.hash, name, nameLen); + SAnalyticsUrl *pUrl = taosHashAcquire(tsAlgos.hash, name, nameLen); if (pUrl != NULL) { tstrncpy(url, pUrl->url, urlLen); uDebug("algo:%s, type:%s, url:%s", algoName, taosAnalAlgoStr(type), url); @@ -406,7 +405,7 @@ static int32_t tsosAnalJsonBufOpen(SAnalBuf *pBuf, int32_t numOfCols) { return terrno; } - pBuf->pCols = taosMemoryCalloc(numOfCols, sizeof(SAnalColBuf)); + pBuf->pCols = taosMemoryCalloc(numOfCols, sizeof(SAnalyticsColBuf)); if (pBuf->pCols == NULL) return TSDB_CODE_OUT_OF_MEMORY; pBuf->numOfCols = numOfCols; @@ -415,7 +414,7 @@ static int32_t tsosAnalJsonBufOpen(SAnalBuf *pBuf, int32_t numOfCols) { } for (int32_t i = 0; i < numOfCols; ++i) { - SAnalColBuf *pCol = &pBuf->pCols[i]; + SAnalyticsColBuf *pCol = &pBuf->pCols[i]; snprintf(pCol->fileName, sizeof(pCol->fileName), "%s-c%d", pBuf->fileName, i); pCol->filePtr = taosOpenFile(pCol->fileName, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_TRUNC | TD_FILE_WRITE_THROUGH); @@ -549,7 +548,7 @@ static int32_t taosAnalJsonBufWriteDataEnd(SAnalBuf *pBuf) { if (pBuf->bufType == ANAL_BUF_TYPE_JSON_COL) { for (int32_t i = 0; i < pBuf->numOfCols; ++i) { - SAnalColBuf *pCol = &pBuf->pCols[i]; + SAnalyticsColBuf *pCol = &pBuf->pCols[i]; code = taosFsyncFile(pCol->filePtr); if (code != 0) return code; @@ -591,7 +590,7 @@ int32_t taosAnalJsonBufClose(SAnalBuf *pBuf) { if (pBuf->bufType == ANAL_BUF_TYPE_JSON_COL) { for (int32_t i = 0; i < pBuf->numOfCols; ++i) { - SAnalColBuf *pCol = &pBuf->pCols[i]; + SAnalyticsColBuf *pCol = &pBuf->pCols[i]; if (pCol->filePtr != NULL) { code = taosFsyncFile(pCol->filePtr); if (code != 0) return code; @@ -613,7 +612,7 @@ void taosAnalBufDestroy(SAnalBuf *pBuf) { if (pBuf->bufType == ANAL_BUF_TYPE_JSON_COL) { for (int32_t i = 0; i < pBuf->numOfCols; ++i) { - SAnalColBuf *pCol = &pBuf->pCols[i]; + SAnalyticsColBuf *pCol = &pBuf->pCols[i]; if (pCol->fileName[0] != 0) { if (pCol->filePtr != NULL) (void)taosCloseFile(&pCol->filePtr); if (taosRemoveFile(pCol->fileName) != 0) { @@ -729,8 +728,8 @@ static int32_t taosAnalBufGetCont(SAnalBuf *pBuf, char **ppCont, int64_t *pContL #else -int32_t taosAnalInit() { return 0; } -void taosAnalCleanup() {} +int32_t taosAnalyticsInit() { return 0; } +void taosAnalyticsCleanup() {} SJson *taosAnalSendReqRetJson(const char *url, EAnalHttpType type, SAnalBuf *pBuf) { return NULL; } int32_t taosAnalGetAlgoUrl(const char *algoName, EAnalAlgoType type, char *url, int32_t urlLen) { return 0; } From 73881169c11837750f12509e7cf0201e21abdc10 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Thu, 7 Nov 2024 17:51:12 +0800 Subject: [PATCH 683/695] fix: install for taosanode --- packaging/tools/make_install.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packaging/tools/make_install.sh b/packaging/tools/make_install.sh index 1b8fa2fb702f..0874433e94f2 100755 --- a/packaging/tools/make_install.sh +++ b/packaging/tools/make_install.sh @@ -145,7 +145,14 @@ function kill_taosd() { function install_main_path() { #create install main dir and all sub dir - ${csudo}rm -rf ${install_main_dir} || : + ${csudo}rm -rf ${install_main_dir}/cfg || : + ${csudo}rm -rf ${install_main_dir}/bin || : + ${csudo}rm -rf ${install_main_dir}/driver || : + ${csudo}rm -rf ${install_main_dir}/examples || : + ${csudo}rm -rf ${install_main_dir}/include || : + ${csudo}rm -rf ${install_main_dir}/share || : + ${csudo}rm -rf ${install_main_dir}/log || : + ${csudo}mkdir -p ${install_main_dir} ${csudo}mkdir -p ${install_main_dir}/cfg ${csudo}mkdir -p ${install_main_dir}/bin From 6a601e0459e82b0e1fe499bc904071148587d492 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Thu, 7 Nov 2024 17:54:01 +0800 Subject: [PATCH 684/695] doc(stream):recover stream --- docs/zh/06-advanced/03-stream.md | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/docs/zh/06-advanced/03-stream.md b/docs/zh/06-advanced/03-stream.md index 7486b3b043a3..199715aba51a 100644 --- a/docs/zh/06-advanced/03-stream.md +++ b/docs/zh/06-advanced/03-stream.md @@ -228,4 +228,30 @@ PAUSE STREAM [IF EXISTS] stream_name; RESUME STREAM [IF EXISTS] [IGNORE UNTREATED] stream_name; ``` -没有指定 IF EXISTS,如果该 stream 不存在,则报错。如果存在,则恢复流计算。指定了 IF EXISTS,如果 stream 不存在,则返回成功。如果存在,则恢复流计算。如果指定 IGNORE UNTREATED,则恢复流计算时,忽略流计算暂停期间写入的数据。 \ No newline at end of file +没有指定 IF EXISTS,如果该 stream 不存在,则报错。如果存在,则恢复流计算。指定了 IF EXISTS,如果 stream 不存在,则返回成功。如果存在,则恢复流计算。如果指定 IGNORE UNTREATED,则恢复流计算时,忽略流计算暂停期间写入的数据。 + +### 流计算升级故障恢复 + +升级导致流计算不兼容,需要删除流计算,然后重新创建流计算。步骤如下: +1.修改taos.cfg,添加disableStream 1 +2.启动taosd +3.启动taos, + +```sql +drop stream xxxx; ---- xxx指stream name +flush database stream_source_db; ----流计算读取数据的超级表所在的database; +flush database stream_dest_db; -----流计算写入数据的超级表所在的database; +``` + +举例: + +```sql +create stream streams1 into test1.streamst as select _wstart, count(a) c1 from test.st interval(1s) ; +drop database streams1; +flush database test; +flush database test1; +``` + +4.关闭taosd +5.修改taos.cfg,去掉disableStream 1,或将disableStream改为 0 +6.启动taosd \ No newline at end of file From 56be3e79d259c65c7b038d8435c03cc8a5414a10 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Thu, 7 Nov 2024 17:56:10 +0800 Subject: [PATCH 685/695] doc(stream):recover stream --- docs/zh/06-advanced/03-stream.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/zh/06-advanced/03-stream.md b/docs/zh/06-advanced/03-stream.md index 199715aba51a..73756192705c 100644 --- a/docs/zh/06-advanced/03-stream.md +++ b/docs/zh/06-advanced/03-stream.md @@ -232,10 +232,10 @@ RESUME STREAM [IF EXISTS] [IGNORE UNTREATED] stream_name; ### 流计算升级故障恢复 -升级导致流计算不兼容,需要删除流计算,然后重新创建流计算。步骤如下: -1.修改taos.cfg,添加disableStream 1 -2.启动taosd -3.启动taos, +升级 TDengine 后,如果流计算不兼容,需要删除流计算,然后重新创建流计算。步骤如下: +1.修改 taos.cfg,添加disableStream 1 +2.启动 taosd +3.启动 taos, ```sql drop stream xxxx; ---- xxx指stream name @@ -252,6 +252,6 @@ flush database test; flush database test1; ``` -4.关闭taosd -5.修改taos.cfg,去掉disableStream 1,或将disableStream改为 0 -6.启动taosd \ No newline at end of file +4.关闭 taosd +5.修改 taos.cfg,去掉 disableStream 1,或将 disableStream 改为 0 +6.启动 taosd \ No newline at end of file From 7b6824dd9557416f3e57607b758d99491fe5552b Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Thu, 7 Nov 2024 17:57:26 +0800 Subject: [PATCH 686/695] doc(stream):recover stream --- docs/zh/06-advanced/03-stream.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/zh/06-advanced/03-stream.md b/docs/zh/06-advanced/03-stream.md index 73756192705c..8b8ec3b7a402 100644 --- a/docs/zh/06-advanced/03-stream.md +++ b/docs/zh/06-advanced/03-stream.md @@ -233,8 +233,11 @@ RESUME STREAM [IF EXISTS] [IGNORE UNTREATED] stream_name; ### 流计算升级故障恢复 升级 TDengine 后,如果流计算不兼容,需要删除流计算,然后重新创建流计算。步骤如下: + 1.修改 taos.cfg,添加disableStream 1 + 2.启动 taosd + 3.启动 taos, ```sql @@ -253,5 +256,7 @@ flush database test1; ``` 4.关闭 taosd + 5.修改 taos.cfg,去掉 disableStream 1,或将 disableStream 改为 0 + 6.启动 taosd \ No newline at end of file From 875702106548136059f42696643103ba2060c33b Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Thu, 7 Nov 2024 17:58:56 +0800 Subject: [PATCH 687/695] doc(stream):recover stream --- docs/zh/06-advanced/03-stream.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/zh/06-advanced/03-stream.md b/docs/zh/06-advanced/03-stream.md index 8b8ec3b7a402..cc63a54008d7 100644 --- a/docs/zh/06-advanced/03-stream.md +++ b/docs/zh/06-advanced/03-stream.md @@ -236,7 +236,7 @@ RESUME STREAM [IF EXISTS] [IGNORE UNTREATED] stream_name; 1.修改 taos.cfg,添加disableStream 1 -2.启动 taosd +2.重启 taosd 3.启动 taos, From 334f82215e7bcff9035739ffeecdcdd828850350 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Thu, 7 Nov 2024 18:06:20 +0800 Subject: [PATCH 688/695] doc: minor changes --- docs/zh/06-advanced/03-stream.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/zh/06-advanced/03-stream.md b/docs/zh/06-advanced/03-stream.md index cc63a54008d7..671a6ec55cd6 100644 --- a/docs/zh/06-advanced/03-stream.md +++ b/docs/zh/06-advanced/03-stream.md @@ -234,16 +234,16 @@ RESUME STREAM [IF EXISTS] [IGNORE UNTREATED] stream_name; 升级 TDengine 后,如果流计算不兼容,需要删除流计算,然后重新创建流计算。步骤如下: -1.修改 taos.cfg,添加disableStream 1 +1.修改 taos.cfg,添加 disableStream 1 2.重启 taosd -3.启动 taos, +3.启动 taos ```sql -drop stream xxxx; ---- xxx指stream name -flush database stream_source_db; ----流计算读取数据的超级表所在的database; -flush database stream_dest_db; -----流计算写入数据的超级表所在的database; +drop stream xxxx; ---- xxx 指stream name +flush database stream_source_db; ---- 流计算读取数据的超级表所在的 database +flush database stream_dest_db; ---- 流计算写入数据的超级表所在的 database ``` 举例: From 9a8a91b619b07b9ec048dbc91738f079791912b3 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Thu, 7 Nov 2024 18:10:11 +0800 Subject: [PATCH 689/695] doc(stream):recover stream --- docs/zh/06-advanced/03-stream.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/zh/06-advanced/03-stream.md b/docs/zh/06-advanced/03-stream.md index cc63a54008d7..463fda3f471c 100644 --- a/docs/zh/06-advanced/03-stream.md +++ b/docs/zh/06-advanced/03-stream.md @@ -236,7 +236,7 @@ RESUME STREAM [IF EXISTS] [IGNORE UNTREATED] stream_name; 1.修改 taos.cfg,添加disableStream 1 -2.重启 taosd +2.重启 taosd。如果启动失败,需要手动删除文件夹:$dataDir/vnode/vnode*/tq/stream,$dataDir指 TDengine 存储数据的目录,在 $dataDir/vnode/ 目录下会有多个类似vnode1 、vnode2...vnode* 的目录 3.启动 taos, @@ -259,4 +259,4 @@ flush database test1; 5.修改 taos.cfg,去掉 disableStream 1,或将 disableStream 改为 0 -6.启动 taosd \ No newline at end of file +6.启动 taosd From 044645fa135bd169181fbe8042839b7c7880d7bf Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Thu, 7 Nov 2024 18:12:17 +0800 Subject: [PATCH 690/695] doc(stream):recover stream --- docs/zh/06-advanced/03-stream.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/zh/06-advanced/03-stream.md b/docs/zh/06-advanced/03-stream.md index 463fda3f471c..d1b2f31b2fe3 100644 --- a/docs/zh/06-advanced/03-stream.md +++ b/docs/zh/06-advanced/03-stream.md @@ -236,7 +236,7 @@ RESUME STREAM [IF EXISTS] [IGNORE UNTREATED] stream_name; 1.修改 taos.cfg,添加disableStream 1 -2.重启 taosd。如果启动失败,需要手动删除文件夹:$dataDir/vnode/vnode*/tq/stream,$dataDir指 TDengine 存储数据的目录,在 $dataDir/vnode/ 目录下会有多个类似vnode1 、vnode2...vnode* 的目录 +2.重启 taosd。如果启动失败,需要手动删除文件夹:$dataDir/vnode/vnode*/tq/stream,$dataDir指 TDengine 存储数据的目录,在 $dataDir/vnode/ 目录下会有多个类似vnode1 、vnode2...vnode* 的目录,全部需要删除里面的tq/stream目录 3.启动 taos, From ce0bd07de059c650b63ca0850089974d412ae0d4 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Thu, 7 Nov 2024 18:15:39 +0800 Subject: [PATCH 691/695] doc(stream):recover stream --- docs/zh/06-advanced/03-stream.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/zh/06-advanced/03-stream.md b/docs/zh/06-advanced/03-stream.md index d1b2f31b2fe3..c187adbe1af2 100644 --- a/docs/zh/06-advanced/03-stream.md +++ b/docs/zh/06-advanced/03-stream.md @@ -236,7 +236,7 @@ RESUME STREAM [IF EXISTS] [IGNORE UNTREATED] stream_name; 1.修改 taos.cfg,添加disableStream 1 -2.重启 taosd。如果启动失败,需要手动删除文件夹:$dataDir/vnode/vnode*/tq/stream,$dataDir指 TDengine 存储数据的目录,在 $dataDir/vnode/ 目录下会有多个类似vnode1 、vnode2...vnode* 的目录,全部需要删除里面的tq/stream目录 +2.重启 taosd。如果启动失败,需要手动修改文件夹名字:$dataDir/vnode/vnode*/tq/stream,$dataDir指 TDengine 存储数据的目录,在 $dataDir/vnode/ 目录下会有多个类似vnode1 、vnode2...vnode* 的目录,全部需要修改里面的tq/stream目录的名字,改为vnode1.bk 、vnode2.bk ... vnode*.bk 3.启动 taos, From 1f7c9c93bd8e8870d138867f538daaaa9a05d35f Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Thu, 7 Nov 2024 18:18:03 +0800 Subject: [PATCH 692/695] doc(stream):recover stream --- docs/zh/06-advanced/03-stream.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/zh/06-advanced/03-stream.md b/docs/zh/06-advanced/03-stream.md index 0ebb4b5b3e7e..758fbbd10caf 100644 --- a/docs/zh/06-advanced/03-stream.md +++ b/docs/zh/06-advanced/03-stream.md @@ -259,4 +259,4 @@ flush database test1; 5.修改 taos.cfg,去掉 disableStream 1,或将 disableStream 改为 0 -6.启动 taosd +6.启动 taosd \ No newline at end of file From ba27958c67e97e3998257c59ef267ae4df38292c Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Thu, 7 Nov 2024 18:21:03 +0800 Subject: [PATCH 693/695] doc(stream):recover stream --- docs/zh/06-advanced/03-stream.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/zh/06-advanced/03-stream.md b/docs/zh/06-advanced/03-stream.md index 758fbbd10caf..d22da5c4c830 100644 --- a/docs/zh/06-advanced/03-stream.md +++ b/docs/zh/06-advanced/03-stream.md @@ -236,7 +236,7 @@ RESUME STREAM [IF EXISTS] [IGNORE UNTREATED] stream_name; 1.修改 taos.cfg,添加 disableStream 1 -2.重启 taosd。如果启动失败,需要手动修改文件夹名字:$dataDir/vnode/vnode*/tq/stream,$dataDir指 TDengine 存储数据的目录,在 $dataDir/vnode/ 目录下会有多个类似vnode1 、vnode2...vnode* 的目录,全部需要修改里面的tq/stream目录的名字,改为vnode1.bk 、vnode2.bk ... vnode*.bk +2.重启 taosd。如果启动失败,需要手动修改文件夹名字:$dataDir/vnode/vnode*/tq/stream,$dataDir 指 TDengine 存储数据的目录,在 $dataDir/vnode/ 目录下会有多个类似 vnode1 、vnode2...vnode* 的目录,全部需要修改里面的 tq/stream 目录的名字,改为 vnode1.bk 、vnode2.bk ... vnode*.bk 3.启动 taos From 774ad21b22250a4b0877bd45bb06457f377acae5 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Thu, 7 Nov 2024 19:03:13 +0800 Subject: [PATCH 694/695] doc(stream):recover stream --- docs/zh/06-advanced/03-stream.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/zh/06-advanced/03-stream.md b/docs/zh/06-advanced/03-stream.md index d22da5c4c830..2f6e515fd71d 100644 --- a/docs/zh/06-advanced/03-stream.md +++ b/docs/zh/06-advanced/03-stream.md @@ -236,7 +236,7 @@ RESUME STREAM [IF EXISTS] [IGNORE UNTREATED] stream_name; 1.修改 taos.cfg,添加 disableStream 1 -2.重启 taosd。如果启动失败,需要手动修改文件夹名字:$dataDir/vnode/vnode*/tq/stream,$dataDir 指 TDengine 存储数据的目录,在 $dataDir/vnode/ 目录下会有多个类似 vnode1 、vnode2...vnode* 的目录,全部需要修改里面的 tq/stream 目录的名字,改为 vnode1.bk 、vnode2.bk ... vnode*.bk +2.重启 taosd。如果启动失败,修改 stream 目录的名称,避免 taosd 启动的时候尝试加载 stream 目录下的流计算数据信息。不使用删除操作避免误操作导致的风险。需要修改的文件夹:$dataDir/vnode/vnode*/tq/stream,$dataDir 指 TDengine 存储数据的目录,在 $dataDir/vnode/ 目录下会有多个类似 vnode1 、vnode2...vnode* 的目录,全部需要修改里面的 tq/stream 目录的名字,改为 stream.bk 3.启动 taos From e64ad3a27d40df6d9bddbdfdece17a9724e434bc Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Thu, 7 Nov 2024 19:04:23 +0800 Subject: [PATCH 695/695] doc(stream):recover stream --- docs/zh/06-advanced/03-stream.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/zh/06-advanced/03-stream.md b/docs/zh/06-advanced/03-stream.md index 2f6e515fd71d..c47831dde370 100644 --- a/docs/zh/06-advanced/03-stream.md +++ b/docs/zh/06-advanced/03-stream.md @@ -236,7 +236,7 @@ RESUME STREAM [IF EXISTS] [IGNORE UNTREATED] stream_name; 1.修改 taos.cfg,添加 disableStream 1 -2.重启 taosd。如果启动失败,修改 stream 目录的名称,避免 taosd 启动的时候尝试加载 stream 目录下的流计算数据信息。不使用删除操作避免误操作导致的风险。需要修改的文件夹:$dataDir/vnode/vnode*/tq/stream,$dataDir 指 TDengine 存储数据的目录,在 $dataDir/vnode/ 目录下会有多个类似 vnode1 、vnode2...vnode* 的目录,全部需要修改里面的 tq/stream 目录的名字,改为 stream.bk +2.重启 taosd。如果启动失败,修改 stream 目录的名称,避免 taosd 启动的时候尝试加载 stream 目录下的流计算数据信息。不使用删除操作避免误操作导致的风险。需要修改的文件夹:$dataDir/vnode/vnode*/tq/stream,$dataDir 指 TDengine 存储数据的目录,在 $dataDir/vnode/ 目录下会有多个类似 vnode1 、vnode2...vnode* 的目录,全部需要修改里面的 tq/stream 目录的名字,改为 tq/stream.bk 3.启动 taos